summaryrefslogtreecommitdiffstats
path: root/private/utils/ntbackup
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/utils/ntbackup
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/utils/ntbackup')
-rw-r--r--private/utils/ntbackup/dirs23
-rw-r--r--private/utils/ntbackup/exchange/build/alphamk.inc195
-rw-r--r--private/utils/ntbackup/exchange/build/coffbase.txt776
-rw-r--r--private/utils/ntbackup/exchange/build/i386mk.inc247
-rw-r--r--private/utils/ntbackup/exchange/build/inc/common.ver96
-rw-r--r--private/utils/ntbackup/exchange/build/inc/ntddscsi.h229
-rw-r--r--private/utils/ntbackup/exchange/build/inc/ntverp.h47
-rw-r--r--private/utils/ntbackup/exchange/build/inc/pcrt32.h39
-rw-r--r--private/utils/ntbackup/exchange/build/inc/plan32.h14
-rw-r--r--private/utils/ntbackup/exchange/build/inc/port1632.h40
-rw-r--r--private/utils/ntbackup/exchange/build/inc/ptypes32.h62
-rw-r--r--private/utils/ntbackup/exchange/build/inc/pwin32.h305
-rw-r--r--private/utils/ntbackup/exchange/build/inc/uiexport.h132
-rw-r--r--private/utils/ntbackup/exchange/build/inc/warning.h22
-rw-r--r--private/utils/ntbackup/exchange/build/makefile.def2047
-rw-r--r--private/utils/ntbackup/exchange/build/makefile.plt142
-rw-r--r--private/utils/ntbackup/exchange/build/mipsmk.inc218
-rw-r--r--private/utils/ntbackup/exchange/build/ppcmk.inc227
-rw-r--r--private/utils/ntbackup/exchange/inc/edbmsg.h1737
-rw-r--r--private/utils/ntbackup/exchange/inc/jet.h1804
-rw-r--r--private/utils/ntbackup/exchange/inc/jetbcli.h407
-rw-r--r--private/utils/ntbackup/exchange/inc/morpc.h352
-rw-r--r--private/utils/ntbackup/exchange/inc/rpcbak.h225
-rw-r--r--private/utils/ntbackup/exchange/inc/rpcpri.h288
-rw-r--r--private/utils/ntbackup/exchange/inc/rpcpub.h387
-rw-r--r--private/utils/ntbackup/exchange/inc/sadapi.h197
-rw-r--r--private/utils/ntbackup/exchange/readme.txt8
-rw-r--r--private/utils/ntbackup/inc/abort.h30
-rw-r--r--private/utils/ntbackup/inc/add_icon.h36
-rw-r--r--private/utils/ntbackup/inc/adv_rest.h35
-rw-r--r--private/utils/ntbackup/inc/adv_sel.h61
-rw-r--r--private/utils/ntbackup/inc/adv_serv.h53
-rw-r--r--private/utils/ntbackup/inc/afp_fs.h301
-rw-r--r--private/utils/ntbackup/inc/afpdblk.h149
-rw-r--r--private/utils/ntbackup/inc/afplib.h86
-rw-r--r--private/utils/ntbackup/inc/all.h48
-rw-r--r--private/utils/ntbackup/inc/appdefs.h177
-rw-r--r--private/utils/ntbackup/inc/aspi.h7
-rw-r--r--private/utils/ntbackup/inc/backgrnd.h126
-rw-r--r--private/utils/ntbackup/inc/be_debug.h51
-rw-r--r--private/utils/ntbackup/inc/be_init.h108
-rw-r--r--private/utils/ntbackup/inc/be_tfutl.h53
-rw-r--r--private/utils/ntbackup/inc/bec_prv.h31
-rw-r--r--private/utils/ntbackup/inc/beconfig.h598
-rw-r--r--private/utils/ntbackup/inc/bengine.h82
-rw-r--r--private/utils/ntbackup/inc/bitmaps.h200
-rw-r--r--private/utils/ntbackup/inc/bkup.h82
-rw-r--r--private/utils/ntbackup/inc/bsdu.h566
-rw-r--r--private/utils/ntbackup/inc/bsdu_str.h264
-rw-r--r--private/utils/ntbackup/inc/buff_prv.h35
-rw-r--r--private/utils/ntbackup/inc/buffman.h405
-rw-r--r--private/utils/ntbackup/inc/buffnt.h34
-rw-r--r--private/utils/ntbackup/inc/catmaint.h12
-rw-r--r--private/utils/ntbackup/inc/cattape.h47
-rw-r--r--private/utils/ntbackup/inc/cbemon.h125
-rw-r--r--private/utils/ntbackup/inc/channel.h212
-rw-r--r--private/utils/ntbackup/inc/checksum.h27
-rw-r--r--private/utils/ntbackup/inc/cli.h38
-rw-r--r--private/utils/ntbackup/inc/config.h1
-rw-r--r--private/utils/ntbackup/inc/crit_err.h35
-rw-r--r--private/utils/ntbackup/inc/criterr.h91
-rw-r--r--private/utils/ntbackup/inc/ctl3d.h91
-rw-r--r--private/utils/ntbackup/inc/cursors.h38
-rw-r--r--private/utils/ntbackup/inc/d_o_bkup.h80
-rw-r--r--private/utils/ntbackup/inc/d_o_rset.h47
-rw-r--r--private/utils/ntbackup/inc/datetime.h119
-rw-r--r--private/utils/ntbackup/inc/dateutil.h114
-rw-r--r--private/utils/ntbackup/inc/dblkmap.h37
-rw-r--r--private/utils/ntbackup/inc/dblks.h281
-rw-r--r--private/utils/ntbackup/inc/dddefs.h50
-rw-r--r--private/utils/ntbackup/inc/debug.h90
-rw-r--r--private/utils/ntbackup/inc/del_sel.h9
-rw-r--r--private/utils/ntbackup/inc/details.h173
-rw-r--r--private/utils/ntbackup/inc/detdrive.h34
-rw-r--r--private/utils/ntbackup/inc/detnet.h32
-rw-r--r--private/utils/ntbackup/inc/dialmang.h481
-rw-r--r--private/utils/ntbackup/inc/dialogs.h363
-rw-r--r--private/utils/ntbackup/inc/dil.h94
-rw-r--r--private/utils/ntbackup/inc/dilhwd.h55
-rw-r--r--private/utils/ntbackup/inc/dilntprv.h41
-rw-r--r--private/utils/ntbackup/inc/dle.h286
-rw-r--r--private/utils/ntbackup/inc/dle_str.h662
-rw-r--r--private/utils/ntbackup/inc/dlg_ids.h140
-rw-r--r--private/utils/ntbackup/inc/dlm.h469
-rw-r--r--private/utils/ntbackup/inc/dlm_prv.h93
-rw-r--r--private/utils/ntbackup/inc/do_misc.h62
-rw-r--r--private/utils/ntbackup/inc/dos_fs.h279
-rw-r--r--private/utils/ntbackup/inc/doscom.h170
-rw-r--r--private/utils/ntbackup/inc/dosdblk.h74
-rw-r--r--private/utils/ntbackup/inc/drive.h135
-rw-r--r--private/utils/ntbackup/inc/drvinf.h113
-rw-r--r--private/utils/ntbackup/inc/ems.h45
-rw-r--r--private/utils/ntbackup/inc/ems_fs.h471
-rw-r--r--private/utils/ntbackup/inc/ems_jet.h21
-rw-r--r--private/utils/ntbackup/inc/emsdblk.h106
-rw-r--r--private/utils/ntbackup/inc/enc_priv.h67
-rw-r--r--private/utils/ntbackup/inc/enc_pub.h69
-rw-r--r--private/utils/ntbackup/inc/eng_dbug.h110
-rw-r--r--private/utils/ntbackup/inc/eng_err.h116
-rw-r--r--private/utils/ntbackup/inc/eng_fmt.h15
-rw-r--r--private/utils/ntbackup/inc/eng_mq.h13
-rw-r--r--private/utils/ntbackup/inc/eng_msg.h462
-rw-r--r--private/utils/ntbackup/inc/entrydat.h57
-rw-r--r--private/utils/ntbackup/inc/erase.h52
-rw-r--r--private/utils/ntbackup/inc/err_stgs.h11
-rw-r--r--private/utils/ntbackup/inc/error.h31
-rw-r--r--private/utils/ntbackup/inc/esa.h124
-rw-r--r--private/utils/ntbackup/inc/f31proto.h50
-rw-r--r--private/utils/ntbackup/inc/f40proto.h242
-rw-r--r--private/utils/ntbackup/inc/fake_fs.h31
-rw-r--r--private/utils/ntbackup/inc/farlib.h152
-rw-r--r--private/utils/ntbackup/inc/fartypes.h36
-rw-r--r--private/utils/ntbackup/inc/filerepl.h68
-rw-r--r--private/utils/ntbackup/inc/finitfs.h31
-rw-r--r--private/utils/ntbackup/inc/fmteng.h215
-rw-r--r--private/utils/ntbackup/inc/fmtinf.h121
-rw-r--r--private/utils/ntbackup/inc/freplace.h44
-rw-r--r--private/utils/ntbackup/inc/fsstream.h149
-rw-r--r--private/utils/ntbackup/inc/fsys.h798
-rw-r--r--private/utils/ntbackup/inc/fsys_err.h148
-rw-r--r--private/utils/ntbackup/inc/fsys_prv.h240
-rw-r--r--private/utils/ntbackup/inc/fsys_str.h873
-rw-r--r--private/utils/ntbackup/inc/gen_fs.h187
-rw-r--r--private/utils/ntbackup/inc/gendblk.h54
-rw-r--r--private/utils/ntbackup/inc/generr.h72
-rw-r--r--private/utils/ntbackup/inc/genfuncs.h73
-rw-r--r--private/utils/ntbackup/inc/genstat.h44
-rw-r--r--private/utils/ntbackup/inc/get_next.h33
-rw-r--r--private/utils/ntbackup/inc/global.h422
-rw-r--r--private/utils/ntbackup/inc/helpids.h231
-rw-r--r--private/utils/ntbackup/inc/helpmang.h86
-rw-r--r--private/utils/ntbackup/inc/hwcheck.h30
-rw-r--r--private/utils/ntbackup/inc/hwconf.h217
-rw-r--r--private/utils/ntbackup/inc/hwctext.h198
-rw-r--r--private/utils/ntbackup/inc/hwdlg.h79
-rw-r--r--private/utils/ntbackup/inc/iblock.h29
-rw-r--r--private/utils/ntbackup/inc/ibm_scsi.h7
-rw-r--r--private/utils/ntbackup/inc/icons.h62
-rw-r--r--private/utils/ntbackup/inc/image_fs.h165
-rw-r--r--private/utils/ntbackup/inc/imdblk.h56
-rw-r--r--private/utils/ntbackup/inc/install.h148
-rw-r--r--private/utils/ntbackup/inc/int21.h23
-rw-r--r--private/utils/ntbackup/inc/ipx.h125
-rw-r--r--private/utils/ntbackup/inc/islecfg.h7
-rw-r--r--private/utils/ntbackup/inc/job_new.h15
-rw-r--r--private/utils/ntbackup/inc/job_opts.h76
-rw-r--r--private/utils/ntbackup/inc/jobs.h337
-rw-r--r--private/utils/ntbackup/inc/jobsetup.h15
-rw-r--r--private/utils/ntbackup/inc/jobstat.h108
-rw-r--r--private/utils/ntbackup/inc/keys.h37
-rw-r--r--private/utils/ntbackup/inc/launcher.h197
-rw-r--r--private/utils/ntbackup/inc/ld_dvr.h26
-rw-r--r--private/utils/ntbackup/inc/ldialogs.h72
-rw-r--r--private/utils/ntbackup/inc/lis.h94
-rw-r--r--private/utils/ntbackup/inc/log.h335
-rw-r--r--private/utils/ntbackup/inc/loginpw.h35
-rw-r--r--private/utils/ntbackup/inc/loop_prv.h368
-rw-r--r--private/utils/ntbackup/inc/loops.h85
-rw-r--r--private/utils/ntbackup/inc/lp_msg.h183
-rw-r--r--private/utils/ntbackup/inc/lstdres.h116
-rw-r--r--private/utils/ntbackup/inc/ltappswd.h41
-rw-r--r--private/utils/ntbackup/inc/lw_cntl.h43
-rw-r--r--private/utils/ntbackup/inc/lw_data.h116
-rw-r--r--private/utils/ntbackup/inc/lwdefs.h37
-rw-r--r--private/utils/ntbackup/inc/lwprotos.h133
-rw-r--r--private/utils/ntbackup/inc/machine.h43
-rw-r--r--private/utils/ntbackup/inc/mayn31.h512
-rw-r--r--private/utils/ntbackup/inc/mayn40.h463
-rw-r--r--private/utils/ntbackup/inc/mem.h113
-rw-r--r--private/utils/ntbackup/inc/memmang.h125
-rw-r--r--private/utils/ntbackup/inc/menumang.h107
-rw-r--r--private/utils/ntbackup/inc/menus.h141
-rw-r--r--private/utils/ntbackup/inc/message.h16
-rw-r--r--private/utils/ntbackup/inc/minmax.h27
-rw-r--r--private/utils/ntbackup/inc/misc.h27
-rw-r--r--private/utils/ntbackup/inc/ms_qic.h7
-rw-r--r--private/utils/ntbackup/inc/ms_scsi.h7
-rw-r--r--private/utils/ntbackup/inc/msassert.h84
-rw-r--r--private/utils/ntbackup/inc/msg.h30
-rw-r--r--private/utils/ntbackup/inc/msgbox.h88
-rw-r--r--private/utils/ntbackup/inc/msgboxid.h31
-rw-r--r--private/utils/ntbackup/inc/msii.h9
-rw-r--r--private/utils/ntbackup/inc/msinstal.h134
-rw-r--r--private/utils/ntbackup/inc/mslreq.h26
-rw-r--r--private/utils/ntbackup/inc/msmktemp.h10
-rw-r--r--private/utils/ntbackup/inc/mtf.h512
-rw-r--r--private/utils/ntbackup/inc/mui.h154
-rw-r--r--private/utils/ntbackup/inc/muibar.h31
-rw-r--r--private/utils/ntbackup/inc/muiconf.h1376
-rw-r--r--private/utils/ntbackup/inc/muiutil.h136
-rw-r--r--private/utils/ntbackup/inc/nets.h40
-rw-r--r--private/utils/ntbackup/inc/network.h35
-rw-r--r--private/utils/ntbackup/inc/nextset.h37
-rw-r--r--private/utils/ntbackup/inc/nonafp.h179
-rw-r--r--private/utils/ntbackup/inc/nov386.h67
-rw-r--r--private/utils/ntbackup/inc/novcom.h315
-rw-r--r--private/utils/ntbackup/inc/novdblk.h150
-rw-r--r--private/utils/ntbackup/inc/novinit.h60
-rw-r--r--private/utils/ntbackup/inc/nrl.h588
-rw-r--r--private/utils/ntbackup/inc/ntfs_fs.h495
-rw-r--r--private/utils/ntbackup/inc/ntfsdblk.h235
-rw-r--r--private/utils/ntbackup/inc/nw386.h257
-rw-r--r--private/utils/ntbackup/inc/oem.h23
-rw-r--r--private/utils/ntbackup/inc/ombatch.h154
-rw-r--r--private/utils/ntbackup/inc/ombkup.h80
-rw-r--r--private/utils/ntbackup/inc/omevent.h39
-rw-r--r--private/utils/ntbackup/inc/omhelpid.h339
-rw-r--r--private/utils/ntbackup/inc/ommenus.h105
-rw-r--r--private/utils/ntbackup/inc/omrset.h97
-rw-r--r--private/utils/ntbackup/inc/omstring.h1033
-rw-r--r--private/utils/ntbackup/inc/omxchng.h33
-rw-r--r--private/utils/ntbackup/inc/os2_fs.h377
-rw-r--r--private/utils/ntbackup/inc/os2com.h142
-rw-r--r--private/utils/ntbackup/inc/os2dblk.h97
-rw-r--r--private/utils/ntbackup/inc/osinfo.h157
-rw-r--r--private/utils/ntbackup/inc/overwrit.h29
-rw-r--r--private/utils/ntbackup/inc/parstab.h333
-rw-r--r--private/utils/ntbackup/inc/part.h75
-rw-r--r--private/utils/ntbackup/inc/password.h84
-rw-r--r--private/utils/ntbackup/inc/pchstop.h25
-rw-r--r--private/utils/ntbackup/inc/pdtypes.h79
-rw-r--r--private/utils/ntbackup/inc/polldrv.h71
-rw-r--r--private/utils/ntbackup/inc/portdefs.h478
-rw-r--r--private/utils/ntbackup/inc/proddefs.h368
-rw-r--r--private/utils/ntbackup/inc/prtmang.h40
-rw-r--r--private/utils/ntbackup/inc/pwinstal.h33
-rw-r--r--private/utils/ntbackup/inc/qtc.h915
-rw-r--r--private/utils/ntbackup/inc/qtcxface.h37
-rw-r--r--private/utils/ntbackup/inc/queues.h157
-rw-r--r--private/utils/ntbackup/inc/rem_fs.h246
-rw-r--r--private/utils/ntbackup/inc/remdblk.h76
-rw-r--r--private/utils/ntbackup/inc/reqrep.h159
-rw-r--r--private/utils/ntbackup/inc/res_io.h5
-rw-r--r--private/utils/ntbackup/inc/resmang.h130
-rw-r--r--private/utils/ntbackup/inc/resource.h114
-rw-r--r--private/utils/ntbackup/inc/retbuf.h44
-rw-r--r--private/utils/ntbackup/inc/ribmang.h222
-rw-r--r--private/utils/ntbackup/inc/rinitfs.h30
-rw-r--r--private/utils/ntbackup/inc/rm.h101
-rw-r--r--private/utils/ntbackup/inc/rset.h71
-rw-r--r--private/utils/ntbackup/inc/rt_dlg.h69
-rw-r--r--private/utils/ntbackup/inc/save_sel.h35
-rw-r--r--private/utils/ntbackup/inc/sch_opts.h93
-rw-r--r--private/utils/ntbackup/inc/sched.h44
-rw-r--r--private/utils/ntbackup/inc/schedule.h374
-rw-r--r--private/utils/ntbackup/inc/screen.h74
-rw-r--r--private/utils/ntbackup/inc/scriperr.h51
-rw-r--r--private/utils/ntbackup/inc/script.h94
-rw-r--r--private/utils/ntbackup/inc/script_p.h241
-rw-r--r--private/utils/ntbackup/inc/script_s.h94
-rw-r--r--private/utils/ntbackup/inc/set_cat.h41
-rw-r--r--private/utils/ntbackup/inc/set_dbug.h43
-rw-r--r--private/utils/ntbackup/inc/set_log.h40
-rw-r--r--private/utils/ntbackup/inc/set_opts.h32
-rw-r--r--private/utils/ntbackup/inc/set_prt.h32
-rw-r--r--private/utils/ntbackup/inc/set_rest.h38
-rw-r--r--private/utils/ntbackup/inc/setback.h44
-rw-r--r--private/utils/ntbackup/inc/sio.h80
-rw-r--r--private/utils/ntbackup/inc/skipno.h25
-rw-r--r--private/utils/ntbackup/inc/skipopen.h37
-rw-r--r--private/utils/ntbackup/inc/sleep.h29
-rw-r--r--private/utils/ntbackup/inc/smb.h191
-rw-r--r--private/utils/ntbackup/inc/smb_c.h67
-rw-r--r--private/utils/ntbackup/inc/smb_cs.h138
-rw-r--r--private/utils/ntbackup/inc/smb_s.h37
-rw-r--r--private/utils/ntbackup/inc/some.h3
-rw-r--r--private/utils/ntbackup/inc/special.h61
-rw-r--r--private/utils/ntbackup/inc/srvlogin.h39
-rw-r--r--private/utils/ntbackup/inc/ss_gui.h103
-rw-r--r--private/utils/ntbackup/inc/statline.h55
-rw-r--r--private/utils/ntbackup/inc/stats.h299
-rw-r--r--private/utils/ntbackup/inc/status.h43
-rw-r--r--private/utils/ntbackup/inc/std_err.h30
-rw-r--r--private/utils/ntbackup/inc/stdhooks.h48
-rw-r--r--private/utils/ntbackup/inc/stdmacro.h53
-rw-r--r--private/utils/ntbackup/inc/stdmath.h229
-rw-r--r--private/utils/ntbackup/inc/stdstruc.h25
-rw-r--r--private/utils/ntbackup/inc/stdtypes.h351
-rw-r--r--private/utils/ntbackup/inc/stdwcs.h219
-rw-r--r--private/utils/ntbackup/inc/sx.h230
-rw-r--r--private/utils/ntbackup/inc/sxdd.h39
-rw-r--r--private/utils/ntbackup/inc/sxtf.h63
-rw-r--r--private/utils/ntbackup/inc/sypl10.h248
-rw-r--r--private/utils/ntbackup/inc/syplpto.h37
-rw-r--r--private/utils/ntbackup/inc/tape.h107
-rw-r--r--private/utils/ntbackup/inc/tapepswd.h70
-rw-r--r--private/utils/ntbackup/inc/tbe_defs.h124
-rw-r--r--private/utils/ntbackup/inc/tbe_err.h38
-rw-r--r--private/utils/ntbackup/inc/tble_prv.h35
-rw-r--r--private/utils/ntbackup/inc/tdemo.h52
-rw-r--r--private/utils/ntbackup/inc/tension.h30
-rw-r--r--private/utils/ntbackup/inc/text.h45
-rw-r--r--private/utils/ntbackup/inc/tfl_err.h126
-rw-r--r--private/utils/ntbackup/inc/tfldefs.h204
-rw-r--r--private/utils/ntbackup/inc/tflopen.h63
-rw-r--r--private/utils/ntbackup/inc/tflproto.h134
-rw-r--r--private/utils/ntbackup/inc/tflstats.h48
-rw-r--r--private/utils/ntbackup/inc/tflwatch.h60
-rw-r--r--private/utils/ntbackup/inc/tfpoll.h76
-rw-r--r--private/utils/ntbackup/inc/thw.h80
-rw-r--r--private/utils/ntbackup/inc/timers.h66
-rw-r--r--private/utils/ntbackup/inc/tloc.h57
-rw-r--r--private/utils/ntbackup/inc/tpos.h189
-rw-r--r--private/utils/ntbackup/inc/translat.h176
-rw-r--r--private/utils/ntbackup/inc/transprt.h74
-rw-r--r--private/utils/ntbackup/inc/transutl.h69
-rw-r--r--private/utils/ntbackup/inc/tsearch.h44
-rw-r--r--private/utils/ntbackup/inc/unic_io.h883
-rw-r--r--private/utils/ntbackup/inc/use_sel.h30
-rw-r--r--private/utils/ntbackup/inc/vlm.h805
-rw-r--r--private/utils/ntbackup/inc/vlm_find.h344
-rw-r--r--private/utils/ntbackup/inc/vm.h117
-rw-r--r--private/utils/ntbackup/inc/vqueue.h119
-rw-r--r--private/utils/ntbackup/inc/wcs.h63
-rw-r--r--private/utils/ntbackup/inc/win3216.h54
-rw-r--r--private/utils/ntbackup/inc/winmang.h550
-rw-r--r--private/utils/ntbackup/inc/xferblk.h26
-rw-r--r--private/utils/ntbackup/inc/yes_no.h5
-rw-r--r--private/utils/ntbackup/src/3dcheck.bmpbin0 -> 1522 bytes
-rw-r--r--private/utils/ntbackup/src/addbsd.c579
-rw-r--r--private/utils/ntbackup/src/addfse.c633
-rw-r--r--private/utils/ntbackup/src/addlba.c308
-rw-r--r--private/utils/ntbackup/src/atachdle.c237
-rw-r--r--private/utils/ntbackup/src/att_drv.c318
-rw-r--r--private/utils/ntbackup/src/back_dle.c231
-rw-r--r--private/utils/ntbackup/src/back_obj.c847
-rw-r--r--private/utils/ntbackup/src/back_vcb.c240
-rw-r--r--private/utils/ntbackup/src/be_debug.c65
-rw-r--r--private/utils/ntbackup/src/be_dinit.c105
-rw-r--r--private/utils/ntbackup/src/be_init.c232
-rw-r--r--private/utils/ntbackup/src/be_tfutl.c277
-rw-r--r--private/utils/ntbackup/src/bec_init.c360
-rw-r--r--private/utils/ntbackup/src/bec_mem.c514
-rw-r--r--private/utils/ntbackup/src/bec_misc.c320
-rw-r--r--private/utils/ntbackup/src/bitmaps.rc218
-rw-r--r--private/utils/ntbackup/src/bkuevent.mc99
-rw-r--r--private/utils/ntbackup/src/bsdlasto.c290
-rw-r--r--private/utils/ntbackup/src/bsdmatch.c889
-rw-r--r--private/utils/ntbackup/src/bsdsinfo.c417
-rw-r--r--private/utils/ntbackup/src/bsdthw.c93
-rw-r--r--private/utils/ntbackup/src/bset.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/bsetpart.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/buffman.c942
-rw-r--r--private/utils/ntbackup/src/buffnt.c569
-rw-r--r--private/utils/ntbackup/src/checksum.c269
-rw-r--r--private/utils/ntbackup/src/clearfsl.c136
-rw-r--r--private/utils/ntbackup/src/cli_stub.c72
-rw-r--r--private/utils/ntbackup/src/confmisc.c828
-rw-r--r--private/utils/ntbackup/src/critstub.c65
-rw-r--r--private/utils/ntbackup/src/crptfile.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/ctbrkstb.c69
-rw-r--r--private/utils/ntbackup/src/cursors.rc40
-rw-r--r--private/utils/ntbackup/src/d_about.c1200
-rw-r--r--private/utils/ntbackup/src/d_adv_us.c393
-rw-r--r--private/utils/ntbackup/src/d_attach.c332
-rw-r--r--private/utils/ntbackup/src/d_browse.c644
-rw-r--r--private/utils/ntbackup/src/d_ctape.c497
-rw-r--r--private/utils/ntbackup/src/d_date.c145
-rw-r--r--private/utils/ntbackup/src/d_dbug.c329
-rw-r--r--private/utils/ntbackup/src/d_erase.c166
-rw-r--r--private/utils/ntbackup/src/d_o_bkup.c2590
-rw-r--r--private/utils/ntbackup/src/d_o_rset.c2742
-rw-r--r--private/utils/ntbackup/src/d_o_xchg.c732
-rw-r--r--private/utils/ntbackup/src/d_r_path.c240
-rw-r--r--private/utils/ntbackup/src/d_t_pswd.c355
-rw-r--r--private/utils/ntbackup/src/d_v_path.c239
-rw-r--r--private/utils/ntbackup/src/datetime.c383
-rw-r--r--private/utils/ntbackup/src/dateutil.c506
-rw-r--r--private/utils/ntbackup/src/dblksize.c89
-rw-r--r--private/utils/ntbackup/src/ddeproc.c142
-rw-r--r--private/utils/ntbackup/src/debug.c754
-rw-r--r--private/utils/ntbackup/src/debug.icobin0 -> 766 bytes
-rw-r--r--private/utils/ntbackup/src/defchan.c63
-rw-r--r--private/utils/ntbackup/src/defltblk.c167
-rw-r--r--private/utils/ntbackup/src/details.c1756
-rw-r--r--private/utils/ntbackup/src/detfmt.c391
-rw-r--r--private/utils/ntbackup/src/dettpdrv.c205
-rw-r--r--private/utils/ntbackup/src/dialmang.c604
-rw-r--r--private/utils/ntbackup/src/dialogs.rc261
-rw-r--r--private/utils/ntbackup/src/dilntmsc.c1747
-rw-r--r--private/utils/ntbackup/src/dilnttp.c1621
-rw-r--r--private/utils/ntbackup/src/disks.icobin0 -> 766 bytes
-rw-r--r--private/utils/ntbackup/src/dledelet.c84
-rw-r--r--private/utils/ntbackup/src/dleget.c499
-rw-r--r--private/utils/ntbackup/src/dlereset.c153
-rw-r--r--private/utils/ntbackup/src/dleupdat.c180
-rw-r--r--private/utils/ntbackup/src/dlg_util.c295
-rw-r--r--private/utils/ntbackup/src/dlm_draw.c1605
-rw-r--r--private/utils/ntbackup/src/dlm_init.c937
-rw-r--r--private/utils/ntbackup/src/dlm_lbn.c843
-rw-r--r--private/utils/ntbackup/src/dlm_proc.c969
-rw-r--r--private/utils/ntbackup/src/dlm_scrn.c868
-rw-r--r--private/utils/ntbackup/src/dlm_updt.c1014
-rw-r--r--private/utils/ntbackup/src/do_back.c3457
-rw-r--r--private/utils/ntbackup/src/do_cat.c2948
-rw-r--r--private/utils/ntbackup/src/do_del.c638
-rw-r--r--private/utils/ntbackup/src/do_excl.c829
-rw-r--r--private/utils/ntbackup/src/do_ffr.c602
-rw-r--r--private/utils/ntbackup/src/do_misc.c761
-rw-r--r--private/utils/ntbackup/src/do_next.c427
-rw-r--r--private/utils/ntbackup/src/do_rest.c2438
-rw-r--r--private/utils/ntbackup/src/do_tens.c822
-rw-r--r--private/utils/ntbackup/src/do_very.c1859
-rw-r--r--private/utils/ntbackup/src/docproc.c1561
-rw-r--r--private/utils/ntbackup/src/drives.c1771
-rw-r--r--private/utils/ntbackup/src/ems_tab.c138
-rw-r--r--private/utils/ntbackup/src/enc_tab.c77
-rw-r--r--private/utils/ntbackup/src/encrypt.c481
-rw-r--r--private/utils/ntbackup/src/entrpris.icobin0 -> 1078 bytes
-rw-r--r--private/utils/ntbackup/src/eprintf.c174
-rw-r--r--private/utils/ntbackup/src/erase.c617
-rw-r--r--private/utils/ntbackup/src/exe.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/file.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/files.icobin0 -> 766 bytes
-rw-r--r--private/utils/ntbackup/src/filgetc.c96
-rw-r--r--private/utils/ntbackup/src/floppy1.bmpbin0 -> 438 bytes
-rw-r--r--private/utils/ntbackup/src/floppy2.bmpbin0 -> 438 bytes
-rw-r--r--private/utils/ntbackup/src/floppy3.bmpbin0 -> 438 bytes
-rw-r--r--private/utils/ntbackup/src/floppy4.bmpbin0 -> 438 bytes
-rw-r--r--private/utils/ntbackup/src/fmttab.c581
-rw-r--r--private/utils/ntbackup/src/fol_cm.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fol_cn.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fol_cp.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fol_ocm.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fol_ocn.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fol_ocp.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fold_om.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fold_on.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/fold_op.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/folder.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/folder_m.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/folder_p.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/font.c282
-rw-r--r--private/utils/ntbackup/src/font.dlg36
-rw-r--r--private/utils/ntbackup/src/freplace.c282
-rw-r--r--private/utils/ntbackup/src/frmproc.c936
-rw-r--r--private/utils/ntbackup/src/fsecopy.c129
-rw-r--r--private/utils/ntbackup/src/func_tab.c25
-rw-r--r--private/utils/ntbackup/src/gen_tab.c137
-rw-r--r--private/utils/ntbackup/src/gendblk.c342
-rw-r--r--private/utils/ntbackup/src/get_vcb.c131
-rw-r--r--private/utils/ntbackup/src/getres.c76
-rw-r--r--private/utils/ntbackup/src/getstrm.c468
-rw-r--r--private/utils/ntbackup/src/ginitfs.c138
-rw-r--r--private/utils/ntbackup/src/global.c539
-rw-r--r--private/utils/ntbackup/src/gmkdblk.c434
-rw-r--r--private/utils/ntbackup/src/gmoddblk.c748
-rw-r--r--private/utils/ntbackup/src/gname.c338
-rw-r--r--private/utils/ntbackup/src/gsize.c181
-rw-r--r--private/utils/ntbackup/src/gtnxtdle.c1032
-rw-r--r--private/utils/ntbackup/src/gtnxttpe.c1021
-rw-r--r--private/utils/ntbackup/src/gui.c1750
-rw-r--r--private/utils/ntbackup/src/hcrpfile.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/help.curbin0 -> 326 bytes
-rw-r--r--private/utils/ntbackup/src/helpmang.c1404
-rw-r--r--private/utils/ntbackup/src/hexefile.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/hfile.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/hslider.curbin0 -> 326 bytes
-rw-r--r--private/utils/ntbackup/src/hwcheck.c258
-rw-r--r--private/utils/ntbackup/src/hwconfnt.c1281
-rw-r--r--private/utils/ntbackup/src/hwctext.rc181
-rw-r--r--private/utils/ntbackup/src/icons.rc85
-rw-r--r--private/utils/ntbackup/src/initfsys.c456
-rw-r--r--private/utils/ntbackup/src/log.c1864
-rw-r--r--private/utils/ntbackup/src/logoproc.c257
-rw-r--r--private/utils/ntbackup/src/lp_tdir.c494
-rw-r--r--private/utils/ntbackup/src/lp_tens.c239
-rw-r--r--private/utils/ntbackup/src/lpbackup.c301
-rw-r--r--private/utils/ntbackup/src/lpdelete.c414
-rw-r--r--private/utils/ntbackup/src/lplist.c443
-rw-r--r--private/utils/ntbackup/src/lprestor.c341
-rw-r--r--private/utils/ntbackup/src/lprintf.c610
-rw-r--r--private/utils/ntbackup/src/lptools.c837
-rw-r--r--private/utils/ntbackup/src/lptpcat.c180
-rw-r--r--private/utils/ntbackup/src/lpverify.c353
-rw-r--r--private/utils/ntbackup/src/ltape.bmpbin0 -> 286 bytes
-rw-r--r--private/utils/ntbackup/src/lw_data.c122
-rw-r--r--private/utils/ntbackup/src/lwtfinf.c147
-rw-r--r--private/utils/ntbackup/src/mach_nt.c38
-rw-r--r--private/utils/ntbackup/src/makecfdb.c88
-rw-r--r--private/utils/ntbackup/src/makefile6
-rw-r--r--private/utils/ntbackup/src/makefile.inc2
-rw-r--r--private/utils/ntbackup/src/makeudb.c66
-rw-r--r--private/utils/ntbackup/src/makevcb.c428
-rw-r--r--private/utils/ntbackup/src/mayn31rd.c1724
-rw-r--r--private/utils/ntbackup/src/mayn40rd.c2431
-rw-r--r--private/utils/ntbackup/src/memang32.c801
-rw-r--r--private/utils/ntbackup/src/memver.c79
-rw-r--r--private/utils/ntbackup/src/menumang.c1546
-rw-r--r--private/utils/ntbackup/src/msgbox.c1304
-rw-r--r--private/utils/ntbackup/src/msgbox.dlg52
-rw-r--r--private/utils/ntbackup/src/msmktemp.c72
-rw-r--r--private/utils/ntbackup/src/mtf10wdb.c1639
-rw-r--r--private/utils/ntbackup/src/mtf10wt.c1678
-rw-r--r--private/utils/ntbackup/src/mui.c1904
-rw-r--r--private/utils/ntbackup/src/muiconf.c1483
-rw-r--r--private/utils/ntbackup/src/muiutil.c1560
-rw-r--r--private/utils/ntbackup/src/myn40otc.c315
-rw-r--r--private/utils/ntbackup/src/nostrad.rc89
-rw-r--r--private/utils/ntbackup/src/nothing.c34
-rw-r--r--private/utils/ntbackup/src/ntbackup.c309
-rw-r--r--private/utils/ntbackup/src/ntfs_tab.c184
-rw-r--r--private/utils/ntbackup/src/ntfslink.c476
-rw-r--r--private/utils/ntbackup/src/ntfsregy.c1330
-rw-r--r--private/utils/ntbackup/src/ntfstemp.c449
-rw-r--r--private/utils/ntbackup/src/ntfsutil.c158
-rw-r--r--private/utils/ntbackup/src/om_blank.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_dsap.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_dsas.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_dsax.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_entrs.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_mdbp.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_mdbs.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_mdbx.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_servs.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_sites.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/om_stats.bmpbin0 -> 150 bytes
-rw-r--r--private/utils/ntbackup/src/omabout.dlg49
-rw-r--r--private/utils/ntbackup/src/omacckey.rc34
-rw-r--r--private/utils/ntbackup/src/ombackup.bmpbin0 -> 358 bytes
-rw-r--r--private/utils/ntbackup/src/ombackup.icobin0 -> 766 bytes
-rw-r--r--private/utils/ntbackup/src/ombatch.c1205
-rw-r--r--private/utils/ntbackup/src/ombkup.dlg67
-rw-r--r--private/utils/ntbackup/src/ombrowse.dlg105
-rw-r--r--private/utils/ntbackup/src/omcat.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omcatlog.dlg15
-rw-r--r--private/utils/ntbackup/src/omcdisk.bmpbin0 -> 286 bytes
-rw-r--r--private/utils/ntbackup/src/omcheck.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omeject.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omerase.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omerase.dlg23
-rw-r--r--private/utils/ntbackup/src/omevent.c329
-rw-r--r--private/utils/ntbackup/src/omfdisk.bmpbin0 -> 286 bytes
-rw-r--r--private/utils/ntbackup/src/omfiler.dlg19
-rw-r--r--private/utils/ntbackup/src/omgbacku.bmpbin0 -> 358 bytes
-rw-r--r--private/utils/ntbackup/src/omgcat.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omgcheck.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omgeject.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omgerase.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omgresto.bmpbin0 -> 358 bytes
-rw-r--r--private/utils/ntbackup/src/omgtensi.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omgunche.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omhdisk.bmpbin0 -> 286 bytes
-rw-r--r--private/utils/ntbackup/src/omhwconf.dlg13
-rw-r--r--private/utils/ntbackup/src/ommenus.rc131
-rw-r--r--private/utils/ntbackup/src/ommuibar.c458
-rw-r--r--private/utils/ntbackup/src/omndisk.bmpbin0 -> 286 bytes
-rw-r--r--private/utils/ntbackup/src/omrdisk.bmpbin0 -> 286 bytes
-rw-r--r--private/utils/ntbackup/src/omrestor.bmpbin0 -> 358 bytes
-rw-r--r--private/utils/ntbackup/src/omrset.dlg71
-rw-r--r--private/utils/ntbackup/src/omruntim.dlg82
-rw-r--r--private/utils/ntbackup/src/omselall.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/omselnon.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/omselpar.bmpbin0 -> 214 bytes
-rw-r--r--private/utils/ntbackup/src/omstring.rc1515
-rw-r--r--private/utils/ntbackup/src/omtensio.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omunchec.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/omxchng.dlg52
-rw-r--r--private/utils/ntbackup/src/openbsdu.c109
-rw-r--r--private/utils/ntbackup/src/opensys.c273
-rw-r--r--private/utils/ntbackup/src/otc40msc.c1192
-rw-r--r--private/utils/ntbackup/src/otc40rd.c1058
-rw-r--r--private/utils/ntbackup/src/otc40wt.c1793
-rw-r--r--private/utils/ntbackup/src/parspath.c1104
-rw-r--r--private/utils/ntbackup/src/passdb.c383
-rw-r--r--private/utils/ntbackup/src/password.c813
-rw-r--r--private/utils/ntbackup/src/pdir2.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/polldrv.c1124
-rw-r--r--private/utils/ntbackup/src/posatset.c1185
-rw-r--r--private/utils/ntbackup/src/pwxface.c720
-rw-r--r--private/utils/ntbackup/src/qtc_add.c1028
-rw-r--r--private/utils/ntbackup/src/qtc_back.c1884
-rw-r--r--private/utils/ntbackup/src/qtc_bset.c685
-rw-r--r--private/utils/ntbackup/src/qtc_eom.c894
-rw-r--r--private/utils/ntbackup/src/qtc_init.c660
-rw-r--r--private/utils/ntbackup/src/qtc_srch.c3034
-rw-r--r--private/utils/ntbackup/src/qtc_util.c1555
-rw-r--r--private/utils/ntbackup/src/qtcxface.c1173
-rw-r--r--private/utils/ntbackup/src/queues.c914
-rw-r--r--private/utils/ntbackup/src/resmang.c1381
-rw-r--r--private/utils/ntbackup/src/rest_dle.c259
-rw-r--r--private/utils/ntbackup/src/rest_obj.c983
-rw-r--r--private/utils/ntbackup/src/ribproc.c1968
-rw-r--r--private/utils/ntbackup/src/runtime.c2481
-rw-r--r--private/utils/ntbackup/src/savepath.c164
-rw-r--r--private/utils/ntbackup/src/scanbsd.c283
-rw-r--r--private/utils/ntbackup/src/scomplex.c618
-rw-r--r--private/utils/ntbackup/src/sdisk.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/set_dbug.dlg43
-rw-r--r--private/utils/ntbackup/src/skipno.c133
-rw-r--r--private/utils/ntbackup/src/skipno.dlg12
-rw-r--r--private/utils/ntbackup/src/skipopen.c235
-rw-r--r--private/utils/ntbackup/src/skipopen.dlg33
-rw-r--r--private/utils/ntbackup/src/sleepwin.c85
-rw-r--r--private/utils/ntbackup/src/sources392
-rw-r--r--private/utils/ntbackup/src/statline.c396
-rw-r--r--private/utils/ntbackup/src/stats.c360
-rw-r--r--private/utils/ntbackup/src/stdmath.c1976
-rw-r--r--private/utils/ntbackup/src/stdwcs.c902
-rw-r--r--private/utils/ntbackup/src/stubfunc.c206
-rw-r--r--private/utils/ntbackup/src/sx.c1239
-rw-r--r--private/utils/ntbackup/src/sypl10rd.c1365
-rw-r--r--private/utils/ntbackup/src/tape2.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/tapein2.bmpbin0 -> 246 bytes
-rw-r--r--private/utils/ntbackup/src/tapes2.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/tapes3.icobin0 -> 766 bytes
-rw-r--r--private/utils/ntbackup/src/tapesin2.bmpbin0 -> 310 bytes
-rw-r--r--private/utils/ntbackup/src/tattach.c419
-rw-r--r--private/utils/ntbackup/src/tbdpars.c673
-rw-r--r--private/utils/ntbackup/src/tbgetc.c88
-rw-r--r--private/utils/ntbackup/src/tbnextok.c943
-rw-r--r--private/utils/ntbackup/src/tbpdat.c270
-rw-r--r--private/utils/ntbackup/src/tbprocsw.c857
-rw-r--r--private/utils/ntbackup/src/tbrparse.c882
-rw-r--r--private/utils/ntbackup/src/tchgdir.c213
-rw-r--r--private/utils/ntbackup/src/tclose.c569
-rw-r--r--private/utils/ntbackup/src/tcomplet.c260
-rw-r--r--private/utils/ntbackup/src/tcreate.c508
-rw-r--r--private/utils/ntbackup/src/tdelete.c176
-rw-r--r--private/utils/ntbackup/src/tension.dlg11
-rw-r--r--private/utils/ntbackup/src/tfbuffs.c292
-rw-r--r--private/utils/ntbackup/src/tfclose.c229
-rw-r--r--private/utils/ntbackup/src/tfeject.c123
-rw-r--r--private/utils/ntbackup/src/tfinit.c501
-rw-r--r--private/utils/ntbackup/src/tflutils.c1384
-rw-r--r--private/utils/ntbackup/src/tfopen.c394
-rw-r--r--private/utils/ntbackup/src/tfpoll.c1077
-rw-r--r--private/utils/ntbackup/src/tfread.c1656
-rw-r--r--private/utils/ntbackup/src/tfreten.c299
-rw-r--r--private/utils/ntbackup/src/tfrewind.c116
-rw-r--r--private/utils/ntbackup/src/tfstuff.c290
-rw-r--r--private/utils/ntbackup/src/tftpcat.c737
-rw-r--r--private/utils/ntbackup/src/tfwrite.c1487
-rw-r--r--private/utils/ntbackup/src/tgetinfo.c258
-rw-r--r--private/utils/ntbackup/src/tgetnext.c638
-rw-r--r--private/utils/ntbackup/src/tgetpath.c500
-rw-r--r--private/utils/ntbackup/src/tgetspec.c211
-rw-r--r--private/utils/ntbackup/src/timers.c511
-rw-r--r--private/utils/ntbackup/src/tinitfs.c973
-rw-r--r--private/utils/ntbackup/src/tminddb.c178
-rw-r--r--private/utils/ntbackup/src/tmkdblk.c718
-rw-r--r--private/utils/ntbackup/src/tmoddblk.c1174
-rw-r--r--private/utils/ntbackup/src/tname.c185
-rw-r--r--private/utils/ntbackup/src/topen.c1339
-rw-r--r--private/utils/ntbackup/src/tposmisc.c460
-rw-r--r--private/utils/ntbackup/src/tprintf.c139
-rw-r--r--private/utils/ntbackup/src/translat.c1690
-rw-r--r--private/utils/ntbackup/src/transutl.c382
-rw-r--r--private/utils/ntbackup/src/treadobj.c841
-rw-r--r--private/utils/ntbackup/src/tree.icobin0 -> 766 bytes
-rw-r--r--private/utils/ntbackup/src/treefile.icobin0 -> 766 bytes
-rw-r--r--private/utils/ntbackup/src/tseekobj.c143
-rw-r--r--private/utils/ntbackup/src/tsetinfo.c237
-rw-r--r--private/utils/ntbackup/src/tsize.c253
-rw-r--r--private/utils/ntbackup/src/tverinfo.c279
-rw-r--r--private/utils/ntbackup/src/tverobj.c920
-rw-r--r--private/utils/ntbackup/src/twritobj.c676
-rw-r--r--private/utils/ntbackup/src/uadd_dle.c119
-rw-r--r--private/utils/ntbackup/src/unicode.c892
-rw-r--r--private/utils/ntbackup/src/unitinit.c480
-rw-r--r--private/utils/ntbackup/src/version.rc43
-rw-r--r--private/utils/ntbackup/src/very_dle.c270
-rw-r--r--private/utils/ntbackup/src/very_obj.c494
-rw-r--r--private/utils/ntbackup/src/viewproc.c460
-rw-r--r--private/utils/ntbackup/src/vlm_bset.c2797
-rw-r--r--private/utils/ntbackup/src/vlm_cat.c571
-rw-r--r--private/utils/ntbackup/src/vlm_disk.c1180
-rw-r--r--private/utils/ntbackup/src/vlm_file.c3496
-rw-r--r--private/utils/ntbackup/src/vlm_find.c480
-rw-r--r--private/utils/ntbackup/src/vlm_init.c144
-rw-r--r--private/utils/ntbackup/src/vlm_menu.c1041
-rw-r--r--private/utils/ntbackup/src/vlm_poll.c722
-rw-r--r--private/utils/ntbackup/src/vlm_refr.c735
-rw-r--r--private/utils/ntbackup/src/vlm_srch.c1997
-rw-r--r--private/utils/ntbackup/src/vlm_srv.c1897
-rw-r--r--private/utils/ntbackup/src/vlm_strt.c684
-rw-r--r--private/utils/ntbackup/src/vlm_tape.c1382
-rw-r--r--private/utils/ntbackup/src/vlm_tree.c3830
-rw-r--r--private/utils/ntbackup/src/vlm_util.c2162
-rw-r--r--private/utils/ntbackup/src/vlm_xchg.c3630
-rw-r--r--private/utils/ntbackup/src/vmstubs.c109
-rw-r--r--private/utils/ntbackup/src/vset.dlg87
-rw-r--r--private/utils/ntbackup/src/winassrt.c167
-rw-r--r--private/utils/ntbackup/src/winmang.c2061
-rw-r--r--private/utils/ntbackup/src/writescr.c298
-rw-r--r--private/utils/ntbackup/src/xattach.c560
-rw-r--r--private/utils/ntbackup/src/xchgdir.c106
-rw-r--r--private/utils/ntbackup/src/xclose.c153
-rw-r--r--private/utils/ntbackup/src/xcreate.c310
-rw-r--r--private/utils/ntbackup/src/xgetinfo.c51
-rw-r--r--private/utils/ntbackup/src/xgetnext.c86
-rw-r--r--private/utils/ntbackup/src/xgetpath.c189
-rw-r--r--private/utils/ntbackup/src/xinitfs.c1192
-rw-r--r--private/utils/ntbackup/src/xmkdblk.c126
-rw-r--r--private/utils/ntbackup/src/xmoddblk.c618
-rw-r--r--private/utils/ntbackup/src/xname.c160
-rw-r--r--private/utils/ntbackup/src/xopen.c661
-rw-r--r--private/utils/ntbackup/src/xreadobj.c625
-rw-r--r--private/utils/ntbackup/src/xseekobj.c102
-rw-r--r--private/utils/ntbackup/src/xsetinfo.c50
-rw-r--r--private/utils/ntbackup/src/xsize.c185
-rw-r--r--private/utils/ntbackup/src/xverinfo.c50
-rw-r--r--private/utils/ntbackup/src/xverobj.c100
-rw-r--r--private/utils/ntbackup/src/xwritobj.c724
-rw-r--r--private/utils/ntbackup/src/yprintf.c120
-rw-r--r--private/utils/ntbackup/src/zprintf.c111
706 files changed, 255160 insertions, 0 deletions
diff --git a/private/utils/ntbackup/dirs b/private/utils/ntbackup/dirs
new file mode 100644
index 000000000..4c6956183
--- /dev/null
+++ b/private/utils/ntbackup/dirs
@@ -0,0 +1,23 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ dirs.
+
+Abstract:
+
+ This file specifies the subdirectories of the current directory that
+ contain component makefiles.
+
+
+Author:
+
+ Steve Wood (stevewo) 17-Apr-1990
+
+NOTE: Commented description of this file is in \nt\bak\bin\dirs.tpl
+
+!ENDIF
+
+DIRS= src
diff --git a/private/utils/ntbackup/exchange/build/alphamk.inc b/private/utils/ntbackup/exchange/build/alphamk.inc
new file mode 100644
index 000000000..2498e84ca
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/alphamk.inc
@@ -0,0 +1,195 @@
+!IF 0
+
+Copyright (c) 1994 Microsoft Corporation
+
+Module Name:
+
+ alphamk.inc
+
+Abstract:
+
+ This module contains the ALPHA specific build controls. It is included
+ by makefile.def.
+
+Author:
+
+ Jeff Havens (jhavens) 13-Feb-1994
+
+Revision History:
+
+!ENDIF
+
+#
+# Alpha option control
+#
+
+UMBASE=$(UMBASE:*=alpha)
+UMLIBS=$(UMLIBS:*=alpha)
+NTRES=$(NTRES:*=alpha)
+UMRES=$(UMRES:*=alpha)
+UMOBJS=$(UMOBJS:*=alpha)
+LINKLIBS=$(LINKLIBS:*=alpha)
+DLLBASE=$(DLLBASE:*=alpha)
+DLLDEF=$(DLLDEF:*=alpha)
+MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:*=alpha)
+TARGET=$(TARGET:*=alpha)
+DYNLINK_LIB=$(DYNLINK_LIB:*=alpha)
+TARGETEXEFILES=$(TARGETEXEFILES:*=alpha)
+TARGETLIBFILES=$(TARGETLIBFILES:*=alpha)
+TARGETOBJFILES=$(TARGETOBJFILES:*=alpha)
+UMOBJFILES=$(UMOBJFILES:*=alpha)
+UMEXEFILES=$(UMEXEFILES:*=alpha)
+HEADERFILE=$(HEADERFILE:*=alpha)
+HEADEROBJNAME=$(HEADEROBJNAME:*=alpha)
+HEADEROBJ=$(HEADEROBJ:*=alpha)
+PRECOMPILED=$(PRECOMPILED:*=alpha)
+PRECOMPILED_CXX=$(PRECOMPILED_CXX:*=alpha)
+PRECOMPILED_TARGET=$(PRECOMPILED_TARGET:*=alpha)
+
+!ifdef NTTARGETFILES
+NTTARGETFILES=$(NTTARGETFILES:*=alpha)
+!endif
+!ifdef NTTARGETFILE0
+NTTARGETFILE0=$(NTTARGETFILE0:*=alpha)
+!endif
+!ifdef NTTARGETFILE1
+NTTARGETFILE1=$(NTTARGETFILE1:*=alpha)
+!endif
+
+!IF "$(GPSIZE)" != "0"
+
+LIBC_LIB=$(BASEDIR)\public\sdk\lib\alpha\small.lib $(LIBC_LIB)
+LINKGPSIZE=-gpsize:$(GPSIZE)
+
+!ENDIF
+
+ENTRY_SUFFIX=
+GDI_ENTRY_SUFFIX=
+
+!IF "$(MSC_OPTFLAGS)" == "/Oxs"
+DBGFLAGS=$(MSC_OPTFLAGS:/Oxs=/Ox)
+!ENDIF
+
+!IFDEF ALPHA_WARNING_LEVEL
+MSC_WARNING_LEVEL=$(ALPHA_WARNING_LEVEL)
+!ENDIF
+
+!IFDEF ALPHA_OPTIMIZATION
+MSC_OPTIMIZATION=$(ALPHA_OPTIMIZATION)
+!ENDIF
+
+!IFDEF ALPHA_CPPFLAGS
+MSC_CPPFLAGS=$(ALPHA_CPPFLAGS)
+!ENDIF
+
+ALPHA_AS=asaxp -nologo
+
+ALPHA_START_FILE=start.obj
+
+# Use /Z7 instead of /Zi
+
+DBGFLAGS=$(DBGFLAGS:/Zi=/Z7)
+
+ENV_DEFINES=$(LIBC_DEFINES) $(C_DEFINES) $(NET_C_DEFINES) $(MSC_CPPFLAGS) $(NTCPPFLAGS)
+STD_DEFINES=-DALPHA=1 -D_ALPHA_=1 -DNO_EXT_KEYS -DCONDITION_HANDLING=1 $(STD_DEFINES)
+
+STDFLAGS= /c /Zel /Zp8 /Gy $(MSC_WARNING_LEVEL) $(MFC_FLAGS)
+
+CDEFINES=$(STD_DEFINES) $(TARGET_DBG_DEFINES) $(ENV_DEFINES)
+CFLAGS=$(ALPHA_FLAGS) $(NTALPHAFLAGS) $(STDFLAGS) $(DBGFLAGS) $(ALPHA_PERFFLAGS) \
+ -D__stdcall= -D__cdecl=
+
+ALPHA_CDEFINES=$(CDEFINES)
+ALPHA_CFLAGS=$(CFLAGS)
+
+!IFNDEF _AXPACC_
+_AXPACC_=0
+!ENDIF
+
+ALPHA_CC = cl $(CBSTRING) -nologo -d2"switch no*check*" $(USER_C_FLAGS)
+
+C_COMPILER_NAME = $(ALPHA_CC)
+CXX_COMPILER_NAME = $(ALPHA_CC)
+C_PREPROCESSOR_NAME = $(ALPHA_CC)
+
+GLOBAL_C_FLAGS = -Ialpha\ -I. $(INCPATH0) $(CDEFINES) \
+ $(ALPHA_OPTIONS) $(CFLAGS) \
+ /Gt$(GPSIZE) -DFPO=1
+
+C_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED) $(COMPILER_WARNINGS)
+CXX_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED_CXX) $(COMPILER_WARNINGS)
+C_PREPROCESSOR_FLAGS = $(GLOBAL_C_FLAGS) -EP -Tc
+
+C_COMPILER= $(C_COMPILER_NAME) $(C_COMPILER_FLAGS)
+CXX_COMPILER=$(CXX_COMPILER_NAME) $(CXX_COMPILER_FLAGS)
+C_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS)
+
+ALPHA_ASSEMBLER=$(ALPHA_AS) -O1 -Ialpha\ -I. $(INCPATH0) $(CDEFINES) \
+ $(ALPHA_FLAGS) $(NTALPHAFLAGS) $(ADBGFLAGS) \
+ -D_LANGUAGE_ASSEMBLY
+
+ECHO_MSG=ClAlpha $< " $(C_COMPILER) "
+ECHO_PRECOMPILED_MSG=CpAlpha $(PRECOMPILED_INCLUDE) " $(C_COMPILER) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) $(HEADEROBJ) $(PRECOMPILED_FLAG)"
+
+{..\alpha\}.s{obj\alpha\}.obj:
+ @-erase $@ >nul 2>&1
+ @echo AsAlpha $< " $(ALPHA_ASSEMBLER) "
+ @$(ALPHA_ASSEMBLER) -o $@ $(MAKEDIR)\..\alpha\$(<F)
+
+{alpha\}.s{obj\alpha\}.obj:
+ @-erase $@ >nul 2>&1
+ @echo AsAlpha $< " $(ALPHA_ASSEMBLER) "
+ @$(ALPHA_ASSEMBLER) -o $@ $(MAKEDIR)\alpha\$(<F)
+
+.SUFFIXES: .il
+
+{}.il{}.cod:
+ @-erase $@ >nul 2>&1
+ @type <<
+$(ECHO_MSG)
+<<NOKEEP
+ @$(C_COMPILER_NAME) @<< -FAac -Fa$(<B).cod -B1..\bootbin\null.exe -Bk$(<B). -Fo$(MAKEDIR)\obj\alpha\$(<B).o $(MAKEDIR)\$(<B).c
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+ @del obj\alpha\$(<B).o
+
+{}.il{obj\alpha\}.obj:
+ @-erase $@ >nul 2>&1
+ @type <<
+$(ECHO_MSG)
+<<NOKEEP
+ @$(C_COMPILER_NAME) @<< -B1..\bootbin\null.exe -Bk$(<B). -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(<B).c
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+LIBRARY_OBJS=$(OBJECTS) $(LINKLIBS)
+
+!IFDEF TUKWILA
+_NTTREE=$(_NTALPHATREE)
+!ENDIF
+
+!IFDEF CAIRO_PRODUCT
+!IFDEF _CAIROALPHATREE
+_NTTREE=$(_CAIROALPHATREE)
+!ENDIF
+!ELSE
+!IFDEF _NTALPHATREE
+_NTTREE=$(_NTALPHATREE)
+!ENDIF
+!ENDIF
+
+!IFDEF KERNEL_MODE
+_NTTREE=$(_NTALPHATREE)\km
+!ENDIF
+
+!IFDEF _NTALPHALIBS
+_NTLIBS=$(_NTALPHALIBS)
+!ENDIF
+
+COPYDST=$(ALPHACOPYDST)
+
+LIB_COPY=ntalphacp.cmd
+
+NTTEST_LINK_OPTIONS= -base:0x80080000 -fixed -entry:KiSystemStartup
diff --git a/private/utils/ntbackup/exchange/build/coffbase.txt b/private/utils/ntbackup/exchange/build/coffbase.txt
new file mode 100644
index 000000000..5e8685239
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/coffbase.txt
@@ -0,0 +1,776 @@
+;
+; This file defines the base virtual address for Dynamic Link Libraries (DLL)
+; that are part of the Windows NT System. The first token on a line is the name
+; of the DLL and the second token is the base virtual address, in hexidecimal.
+; The third token is the maximum size of the DLL image file, including symbols.
+;
+; NOTE: I have used the convention of labelling unused areas as _FREExx_.
+; If you need an address, these are available. They were used by printer
+; drivers.
+
+usermode 0x01000000 0x60000000
+slm 0x11000000 0x40000000
+slmck 0x12000000 0x40000000
+sadmin 0x13000000 0x40000000
+;
+; OLE dlls
+;
+ole32 0x19e00000 0x00a00000
+oledlg 0x1a200000 0x00100000
+
+;
+; This section contains the Cairo images. Free areas are labelled with
+; _CFREExx_
+;
+
+proxy 0x10000000 0x00200000
+alertsys 0x10200000 0x00200000
+commnot 0x10400000 0x00200000
+cryptdll 0x10600000 0x00200000
+demoif 0x10800000 0x00200000
+menuedt 0x10a00000 0x00200000
+_CFREE00_ 0x10c00000 0x00200000
+clock 0x10e00000 0x00200000
+cal 0x11000000 0x00200000
+report 0x11200000 0x00200000
+desk 0x11400000 0x00200000
+cxxflt 0x11600000 0x00200000
+clocksch 0x11800000 0x00200000
+_CFREE01_ 0x11a00000 0x00200000
+iclass 0x11c00000 0x00200000
+_CFREE02_ 0x11e00000 0x00200000
+_CFREE02a 0x12000000 0x00200000
+iprod 0x12200000 0x00200000
+kerberos 0x12400000 0x00200000
+ofskd 0x12600000 0x00200000
+applet1 0x12800000 0x00200000
+cairocpl 0x12a00000 0x00200000
+cpo 0x12c00000 0x00200000
+deskapp 0x12e00000 0x00200000
+ntlm 0x13000000 0x00200000
+objsrv 0x13200000 0x00200000
+; for Cairo message store
+msgfno 0x13400000 0x00200000
+lnktrack 0x13600000 0x00200000
+pocket 0x13800000 0x00200000
+dsfsmsgs 0x13a00000 0x00200000
+_CFREE 0x13c00000 0x00200000
+scperf 0x13e00000 0x00100000
+msvcbook 0x13f00000 0x00100000
+dsyscpl 0x14000000 0x00200000
+bmpctl 0x14200000 0x00200000
+spintime 0x14400000 0x00200000
+grpbox 0x14600000 0x00200000
+security 0x14800000 0x00200000
+mdbmsg 0x14a00000 0x00200000
+bimport 0x14c00000 0x00200000
+
+oldctrls 0x15600000 0x00200000
+smctrls 0x15800000 0x00200000
+dahard 0x15a00000 0x00200000
+stdobj 0x15c00000 0x00200000
+csumcat 0x15e00000 0x00200000
+sysmgmt 0x16000000 0x00200000
+cpdskadm 0x16200000 0x00200000
+idfsvol 0x16400000 0x00200000
+testdll 0x16600000 0x00400000
+cap 0x16a00000 0x00200000
+sysinf 0x16c00000 0x00200000
+shdebug 0x16e00000 0x00100000
+_CFREE03_ 0x16f00000 0x00400000
+popups 0x17300000 0x00100000
+replsup 0x17400000 0x00200000
+schema 0x17700000 0x00200000
+useragnt 0x18000000 0x00200000
+vpcont 0x18200000 0x00200000
+uares 0x18400000 0x00200000
+rndrevrp 0x18600000 0x00200000
+pdfpage 0x18800000 0x00200000
+pkgpage 0x18a00000 0x00200000
+package 0x18e00000 0x00200000
+pdf 0x19000000 0x00200000
+dsys 0x19200000 0x00300000
+dfsprov 0x19500000 0x00100000
+dfsinstr 0x19600000 0x00200000
+lprofile 0x19800000 0x00200000
+;19e00000 - 1a2FFFFF used by ole32 and oledlg (see above)
+_CFREE04_ 0x1a300000 0x00B00000
+oleprx32 0x1b000000 0x00500000
+_CFREE05_ 0x1b000000 0x00600000
+testext 0x1b600000 0x00200000
+loghrs 0x1b800000 0x00100000
+scstg 0x1b900000 0x00100000
+smoke 0x1ba00000 0x00100000
+shamu 0x1bc00000 0x01000000
+
+; Repl dlls
+chglogdb 0x1cc00000 0x00100000
+dumyrclr 0x1cd00000 0x00100000
+flatrst 0x1ce00000 0x00100000
+_RFREE1_ 0x1cf00000 0x00300000
+orarcnlr 0x1d200000 0x00100000
+replui 0x1d300000 0x00100000
+roschlog 0x1d400000 0x00100000
+rsmgr 0x1d500000 0x00100000
+dsobjs 0x1d600000 0x00200000
+account 0x1d800000 0x00200000
+ora 0x1da00000 0x00200000
+oraexts 0x1dc00000 0x00100000
+dsmail 0x1dd00000 0x00100000
+atsvc 0x1de00000 0x00100000
+replperf 0x1e000000 0x00100000
+accctrl 0x1e100000 0x00100000
+dssrv 0x1e200000 0x00200000
+
+_CFREE06_ 0x1e400000 0x00600000
+
+;RTO dlls
+_CFREE07_ 0x1eA00000 0x00200000
+webcore 0x1eC00000 0x00200000
+rtoolbar 0x1eE00000 0x00200000
+rtfdoc 0x1f000000 0x00400000
+
+spincube 0x1f400000 0x00200000
+_CFREE08_ 0x1f600000 0x00A00000
+msgina 0x1f400000 0x00200000
+
+smss 0x20000000 0x40000000
+;
+; Printer drivers: resource only data, overlaps SMSS
+;
+brhj770 0x20000000 0x00100000
+brother9 0x20000000 0x00100000
+brothr24 0x20000000 0x00100000
+canon330 0x20000000 0x00100000
+canon800 0x20000000 0x00100000
+canonlbp 0x20000000 0x00100000
+cit24us 0x20000000 0x00100000
+cit9us 0x20000000 0x00100000
+citoh 0x20000000 0x00100000
+dec24pin 0x20000000 0x00100000
+dec9pin 0x20000000 0x00100000
+diconix 0x20000000 0x00100000
+epson24 0x20000000 0x00100000
+epson9 0x20000000 0x00100000
+escp2e 0x20000000 0x00100000
+escp2ms 0x20000000 0x00100000
+fuji24 0x20000000 0x00100000
+fuji9 0x20000000 0x00100000
+hpdskjet 0x20000000 0x00100000
+hppcl 0x20000000 0x00100000
+hppcl5ms 0x20000000 0x00100000
+pcl1200 0x20000000 0x00100000
+ibm238x 0x20000000 0x00100000
+ibm239x 0x20000000 0x00100000
+ibm5204 0x20000000 0x00100000
+ibm5204 0x20000000 0x00100000
+ibmppdsl 0x20000000 0x00100000
+ibmport 0x20000000 0x00100000
+jp350 0x20000000 0x00100000
+kyocera 0x20000000 0x00100000
+mantal 0x20000000 0x00100000
+mantal24 0x20000000 0x00100000
+mantal90 0x20000000 0x00100000
+mt735 0x20000000 0x00100000
+nec24pin 0x20000000 0x00100000
+oki24 0x20000000 0x00100000
+oki9ibm 0x20000000 0x00100000
+olidm24 0x20000000 0x00100000
+olidm9 0x20000000 0x00100000
+paintjet 0x20000000 0x00100000
+panson24 0x20000000 0x00100000
+panson9 0x20000000 0x00100000
+proprint 0x20000000 0x00100000
+proprn24 0x20000000 0x00100000
+ps1 0x20000000 0x00100000
+quietjet 0x20000000 0x00100000
+qwiii 0x20000000 0x00100000
+seiko 0x20000000 0x00100000
+seiko24e 0x20000000 0x00100000
+seikosh9 0x20000000 0x00100000
+star24e 0x20000000 0x00100000
+star9e 0x20000000 0x00100000
+starjet 0x20000000 0x00100000
+thinkjet 0x20000000 0x00100000
+ti850 0x20000000 0x00100000
+toshiba 0x20000000 0x00100000
+txtonly 0x20000000 0x00100000
+
+; Following have code in them
+
+oki9 0x20100000 0x00100000
+dec3200 0x20200000 0x00100000
+
+; End of printer overlap area.
+
+dbgss 0x30000000 0x30000000
+csrss 0x40000000 0x20000000
+cmd 0x50000000 0x10000000
+os2ss 0x40000000 0x20000000
+psxss 0x40000000 0x20000000
+ntdll 0x60100000 0x00100000
+dbgdll 0x60200000 0x00100000
+advapi32 0x60300000 0x00100000
+csrrtl 0x60400000 0x00100000
+csrsrv 0x60500000 0x00100000
+kernel32 0x60600000 0x00100000
+basertl 0x60700000 0x00100000
+basesrv 0x60800000 0x00100000
+user32 0x60A00000 0x00200000
+winsrv 0x60C00000 0x00700000
+winsrv2 0x60C00000 0x00700000
+rasdd 0x61300000 0x00100000
+sysmono 0x61400000 0x00100000
+courier 0x61500000 0x00100000
+helv 0x61600000 0x00100000
+times 0x61700000 0x00100000
+netapi32 0x61800000 0x00200000
+winmgr 0x62100000 0x00100000
+display 0x62200000 0x00100000
+vga 0x62200000 0x00400000
+winspool 0x62600000 0x00100000
+splsrv 0x62700000 0x00100000
+ntprint 0x62800000 0x00100000
+pscript 0x62900000 0x00100000
+halftone 0x62A00000 0x00100000
+lmspool 0x62B00000 0x00100000
+os2dll 0x63000000 0x00200000
+psxdll 0x63200000 0x00200000
+winnet 0x63400000 0x00100000
+msv1_0 0x63500000 0x00100000
+samlib 0x635A0000 0x00100000
+lsaap 0x63600000 0x00100000
+netrap 0x63700000 0x00100000
+TEMPNAME2 0x63800000 0x00700000
+console 0x63f00000 0x00100000
+gdi32 0x64000000 0x00200000
+media 0x65000000 0x00100000
+mediasrv 0x66000000 0x00100000
+
+lprmon 0x66100000 0x00100000
+lprhelp 0x66200000 0x00100000
+lpdsvc 0x66300000 0x00100000
+
+; OpenGL server-side DLL
+glsrv 0x66400000 0x00100000
+
+; kernel-mode user code
+winsrvk 0x66500000 0x00700000
+
+; This space is free!!
+_FREE04_ 0x66c00000 0x00500000
+nddeexts 0x67100000 0x00100000
+sde 0x67200000 0x00100000
+ndrd 0x67300000 0x00100000
+hdxdll 0x67400000 0x00100000
+splexts 0x67500000 0x00100000
+conexts 0x67600000 0x00100000
+gdiexts 0x67700000 0x00100000
+userexts 0x67800000 0x00100000
+; same as userexts
+userkdx 0x67800000 0x00100000
+ntsdexts 0x67900000 0x00100000
+plotter 0x67A00000 0x00100000
+rpcrt4 0x67B00000 0x00100000
+winmm 0x67D00000 0x00100000
+rpcssp 0x67E00000 0x00100000
+mciwave 0x67F00000 0x00100000
+rpclts1 0x68000000 0x00100000
+rpcltc1 0x68100000 0x00100000
+ldrdll 0x68200000 0x00100000
+mcicda 0x68300000 0x00100000
+plotui 0x68400000 0x00100000
+rasddui 0x68500000 0x00100000
+pscrptui 0x68600000 0x00100000
+mmio 0x68700000 0x00100000
+rpcnts1 0x68800000 0x00100000
+rpcntc1 0x68900000 0x00100000
+nlsapi 0x68A00000 0x00100000
+rpcltc6 0x68B00000 0x00100000
+rpclts6 0x68C00000 0x00100000
+olesvr32 0x68D00000 0x00100000
+olecli32 0x68E00000 0x00100000
+msgsvc 0x68F00000 0x00100000
+
+; This space for sale
+decpsmon 0x69000000 0x00100000
+
+sys003 0x69100000 0x00100000
+
+beta2 0x69200000 0x00600000
+psapi 0x69800000 0x00100000
+rpcdce4 0x69900000 0x00100000
+eventlog 0x69A00000 0x00100000
+xactsrv 0x69B00000 0x00100000
+winreg 0x69C00000 0x00100000
+samsrv 0x69D00000 0x00100000
+; same as samsrv
+samlsa 0x69D00000 0x00100000
+mmdrv 0x69F00000 0x00100000
+dlcapi 0x6A000000 0x00100000
+win32spl 0x6A100000 0x00100000
+localspl 0x6A200000 0x00100000
+rpclts5 0x6A300000 0x00100000
+rpcltc5 0x6A400000 0x00100000
+netlogon 0x6A500000 0x00200000
+; same as netlogon
+ntlmsvc 0x6A500000 0x00200000
+tmsre32 0x6A600000 0x00100000
+lsaudll 0x6A700000 0x00100000
+mciseq 0x6A800000 0x00100000
+winprint 0x6A900000 0x00100000
+localmon 0x6AA00000 0x00100000
+msaudite 0x6AB00000 0x00100000
+msobjs 0x6AC00000 0x00100000
+hpmon 0x6AD00000 0x00100000
+alrsvc 0x6AE00000 0x00100000
+srvsvc 0x6AF00000 0x00100000
+wkssvc 0x6B000000 0x00100000
+rpclts3 0x6B100000 0x00100000
+rpcltc3 0x6B200000 0x00100000
+htui 0x6B300000 0x00100000
+lsasrv 0x6B400000 0x00100000
+mmsndsrv 0x6B500000 0x00100000
+midi 0x6B600000 0x00100000
+browser 0x6B700000 0x00100000
+drivers 0x6B800000 0x00100000
+lmmon 0x6B900000 0x00100000
+spoolss 0x6BA00000 0x00100000
+sndblst 0x6BC00000 0x00100000
+opengl32 0x6BD00000 0x00100000
+ntlmssps 0x6BE00000 0x00100000
+glu32 0x6BF00000 0x00100000
+; OpenGL client-side installable driver
+ogldrv 0x6C000000 0x00100000
+
+dciman32 0x6C100000 0x00100000
+
+;
+; The following is an extension for NTSD which traces memory usage in the
+; ULIB utilities...
+;
+memtrace 0x6BF00000 0x00100000
+
+; Cairo Compound Document Forms
+formidbl 0x6C800000 0x00C00000
+fole2ui 0x6D400000 0x00400000
+
+; Windows 95 shell "Sharing" extensions
+ntshrui 0x6D500000 0x00100000
+
+; Win32 shell apps/dlls
+
+control 0x70000000 0x00100000
+access 0x70100000 0x00100000
+sound 0x70200000 0x00100000
+appwiz 0x70300000 0x00100000
+intl 0x70400000 0x00100000
+timedate 0x70500000 0x00100000
+utc 0x70500000 0x00100000
+mouse 0x70600000 0x00100000
+sysdm 0x70700000 0x00100000
+desk 0x70800000 0x00100000
+modem 0x70900000 0x00100000
+security 0x70A00000 0x00100000
+main 0x70B00000 0x00100000
+ups 0x70C00000 0x00100000
+cursors 0x70D00000 0x00100000
+pcmcia 0x70E00000 0x00100000
+comdlg32 0x70F00000 0x00100000
+linkinfo 0x71000000 0x00100000
+version 0x71100000 0x00100000
+comctl32 0x71200000 0x00100000
+nddeapi 0x71300000 0x00100000
+nddenb32 0x71400000 0x00100000
+t1instal 0x71500000 0x00100000
+profile 0x71600000 0x00100000
+mmsys 0x71700000 0x00100000
+ctape 0x71800000 0x00100000
+console 0x71900000 0x00100000
+shscrap 0x71A00000 0x00100000
+password 0x71B00000 0x00100000
+ftsrch 0x71C00000 0x00100000
+docprop 0x71D00000 0x00100000
+shell32 0x71E00000 0x00200000
+shellalt 0x71E00000 0x00200000
+synceng 0x71F00000 0x00080000
+syncui 0x71F80000 0x00080000
+
+; Win32 National Keyboard Layers
+
+kbdus 0x72000000 0x00100000
+kbdbe 0x73000000 0x00100000
+kbdbu 0x73000000 0x00100000
+kbdbr 0x73000000 0x00100000
+kbdca 0x73000000 0x00100000
+kbdcr 0x73000000 0x00100000
+kbdcz 0x73000000 0x00100000
+kbdda 0x73000000 0x00100000
+kbddv 0x73000000 0x00100000
+kbdes 0x73000000 0x00100000
+kbdfc 0x73000000 0x00100000
+kbdfi 0x73000000 0x00100000
+kbdfr 0x73000000 0x00100000
+kbdgr 0x73000000 0x00100000
+kbdhe 0x73000000 0x00100000
+kbdhe220 0x73000000 0x00100000
+kbdhela2 0x73100000 0x00100000
+kbdhe319 0x73000000 0x00100000
+kbdhela3 0x73100000 0x00100000
+kbdhu 0x73000000 0x00100000
+kbdhu1 0x73000000 0x00100000
+kbdic 0x73000000 0x00100000
+kbdit 0x73000000 0x00100000
+kbdit142 0x73000000 0x00100000
+kbdla 0x73000000 0x00100000
+kbdne 0x73000000 0x00100000
+kbdno 0x73000000 0x00100000
+kbdpl 0x73000000 0x00100000
+kbdpl1 0x73000000 0x00100000
+kbdpo 0x73000000 0x00100000
+kbdro 0x73000000 0x00100000
+kbdru 0x73000000 0x00100000
+kbdsf 0x73000000 0x00100000
+kbdsg 0x73000000 0x00100000
+kbdsl 0x73000000 0x00100000
+kbdsp 0x73000000 0x00100000
+kbdsv 0x73000000 0x00100000
+kbdsw 0x73000000 0x00100000
+kbdtuf 0x73000000 0x00100000
+kbdtuq 0x73000000 0x00100000
+kbduk 0x73000000 0x00100000
+kbdusl 0x73000000 0x00100000
+kbdusr 0x73000000 0x00100000
+kbdusx 0x73000000 0x00100000
+kbdhu1 0x73000000 0x00100000
+
+;
+; Cairo ofs dlls
+;
+query 0x74000000 0x00800000
+infosoft 0x74800000 0x00200000
+cxxflt 0x74a00000 0x00200000
+stemdll 0x7d000000 0x00200000
+
+;
+; The following is not currently used until we switch to the new image
+; format with the new section headers.
+;
+executive 0xD0020000 0x18000000
+
+;
+; The following are the Mep extensions
+;
+tglcase 0x09080000 0x00100000
+pmatch 0x09090000 0x00100000
+justify 0x090a0000 0x00100000
+ulcase 0x090b0000 0x00100000
+filter 0x090c0000 0x00100000
+mhelp 0x090d0000 0x00100000
+mepparty 0x090e0000 0x00100000
+srmep 0x090f0000 0x00100000
+mshelp 0x09100000 0x00100000
+mbrowse 0x09110000 0x00100000
+
+;
+; The following are the Z extensions
+;
+zextens 0x09120000 0x00200000
+
+;
+; The following are for the utilities
+;
+ulib 0x09800000 0x00200000
+uhpfs 0x09a10000 0x00100000
+ufat 0x09b20000 0x00100000
+untfs 0x09c30000 0x00100000
+ifsutil 0x09d40000 0x00100000
+cufat 0x09e50000 0x00100000
+cuhpfs 0x09f60000 0x00100000
+fmifs 0x0a070000 0x00100000
+uspifs 0x0a180000 0x00100000
+ureg 0x0a290000 0x00100000
+uofs 0x0a3a0000 0x00400000
+ofsutil 0x0a7b0000 0x00400000
+autoulib 0x0a7b0000 0x00400000
+autouofs 0x0a3a0000 0x00400000
+
+;
+; ofsutil and autoulib are never loaded at the same time
+;
+ulibif 0x0add0000 0x00100000
+cudbfs 0x0aee0000 0x00100000
+
+;
+; The following are for the net error messages
+;
+netmsg 0x09500000 0x00080000
+neth 0x09580000 0x00080000
+netevent 0x09600000 0x00080000
+
+;
+; The following is the I/O error log messages.
+;
+iologmsg 0x09700000 0x00080000
+
+;
+; The following is for the 16-bit loader for the OS/2 subsystem
+;
+loader 0x20000000 0x01000000
+
+;
+; The following is for the PE format image help routines.
+;
+
+imagehlp 0x20000000 0x01000000
+symhelp 0x21000000 0x01000000
+
+;
+; The following is for the Streams/Sockets dll's
+;
+wsock32 0x75000000 0x00400000
+winstrm 0x75400000 0x00100000
+inetmib1 0x75500000 0x00100000
+lmmib2 0x75600000 0x00100000
+tcpipsvc 0x75700000 0x00100000
+nbtsvc 0x75800000 0x00100000
+telnet 0x75900000 0x00100000
+wshtcpip 0x75a00000 0x00100000
+mgmtapi 0x75b00000 0x00100000
+icmp 0x75c00000 0x00100000
+inettrap 0x75d00000 0x00100000
+testdll 0x75e00000 0x00100000
+lmhsvc 0x75f00000 0x00100000
+dhcpsapi 0x76000000 0x00100000
+dhcpcsvc 0x76100000 0x00100000
+dhcpssvc 0x76200000 0x00100000
+tcpsvcs 0x76300000 0x00100000
+ftpsvc 0x76400000 0x00100000
+ftpsvapi 0x76500000 0x00100000
+ftpctrs 0x76600000 0x00100000
+
+;
+; The following are for rpc datagram transport modules
+;
+
+rpcdgc3 0x76700000 0x00100000
+rpcdgs3 0x76800000 0x00100000
+rpcdgc6 0x76900000 0x00100000
+rpcdgs6 0x76a00000 0x00100000
+
+;
+; The following are for RPC ADSP transport interface modules
+;
+
+rpcltc7 0X76b00000 0x00100000
+rpclts7 0X76c00000 0x00100000
+
+;
+; The following are for the HTTP (WWW) server
+;
+
+w3svc 0x76d00000 0x00100000
+w3svapi 0x76e00000 0x00100000
+w3ctrs 0x76f00000 0x00100000
+httpodbc 0x77700000 0x00100000
+
+;
+; The following are for Gopher Service
+;
+
+gopherd 0x77000000 0x00100000
+gdapi 0x77100000 0x00100000
+gdctrs 0x77200000 0x00100000
+gdspace 0x77300000 0x00100000
+
+;
+; The following are Internet services common dlls
+;
+
+tcpsvcs 0x77400000 0x00100000
+inetasrv 0x77500000 0x00100000
+inetctrs 0x77600000 0x00100000
+;used 0x77700000 0x00100000
+
+;
+; Smalprox dlls (client side internet proxy)
+;
+
+miniprox 0x77800000 0x00100000
+_wsock32 0x77900000 0x00080000
+wsock32f 0x77980000 0x00080000
+
+;
+; The following are for the windowed debugger (windbg)
+;
+
+eecxxx86 0x40000000 0x00200000
+eecxxmip 0x40000000 0x00200000
+eecxxalp 0x40000000 0x00200000
+eecxxppc 0x40000000 0x00200000
+eecxx 0x40000000 0x00200000
+emx86 0x48000000 0x00200000
+emmip 0x48000000 0x00200000
+emalp 0x48000000 0x00200000
+emppc 0x48000000 0x00200000
+shcoff 0x50000000 0x00200000
+shcv 0x50000000 0x00200000
+tlloc 0x58000000 0x00200000
+tlser 0x58000000 0x00200000
+tlser32s 0x58000000 0x00200000
+tlser32 0x58000000 0x00200000
+tlpipe 0x58000000 0x00200000
+dm 0x58200000 0x00200000
+dm32s 0x58200000 0x00200000
+dmkdx86 0x58200000 0x00200000
+dmkdmip 0x58200000 0x00200000
+dmkdalp 0x58200000 0x00200000
+dmkdppc 0x58200000 0x00200000
+kdextx86 0x58400000 0x00200000
+kdextmip 0x58400000 0x00200000
+kdextalp 0x58400000 0x00200000
+kdextppc 0x58400000 0x00200000
+
+;
+; The following are for the NetUI components.
+;
+
+acledit 0x58500000 0x00200000
+mpr 0x58700000 0x00100000
+ntlanman 0x58800000 0x00200000
+srvmgr 0x58a00000 0x00200000
+ncpa 0x58c00000 0x00200000
+mprui 0x58e00000 0x00200000
+netui0 0x59000000 0x00200000
+netui1 0x59200000 0x00300000
+netui2 0x59500000 0x00400000
+ftpsmx 0x59900000 0x00100000
+ftpmgr 0x59a00000 0x00100000
+nwcfg 0x59b00000 0x00100000
+ntlanui 0x59c00000 0x00200000
+tcpcfg 0x59e00000 0x00100000
+ipxcfg 0x59f00000 0x00100000
+ntlsapi 0x5a000000 0x00100000
+srvkd 0x5b000000 0x00100000
+llsrpc 0x5c000000 0x00100000
+
+;
+; Network Card detection
+;
+netdtect 0x79000000 0x00100000
+msncdet 0x79100000 0x00100000
+npincdet 0x79200000 0x00100000
+amdncdet 0x79300000 0x00100000
+netflx 0x79400000 0x00100000
+
+;
+; Bloodhound components
+;
+bhsupp 0x79700000 0x00100000
+nal 0x79800000 0x00100000
+bhmon 0x79900000 0x00100000
+ndis30 0x79A00000 0x00100000
+bhnetb 0x79B00000 0x00100000
+rnal 0x79C00000 0x00100000
+bhkctrl 0x79D00000 0x00100000
+;
+; Nw components
+;
+nwsap 0x7A100000 0x00100000
+
+
+;
+; Ports applet
+;
+port 0x73600000 0x00200000
+
+;
+; System applet
+;
+
+system 0x73800000 0x00200000
+
+; more Cairo control panel components
+
+cpprint 0x73A00000 0x00100000
+cpups 0x73B00000 0x00100000
+cpsrvcs 0x74c00000 0x00100000
+
+;
+; DS object property pages.
+;
+
+dsui 0x73C00000 0x00400000
+
+;
+; DS Container object class
+;
+
+dscont 0x7C800000 0x00100000
+
+;
+;
+; jet blue dll.
+;
+
+jet 0x7B100000 0x00400000
+
+
+;
+; wins dlls
+;
+winsctrs 0x7C100000 0x00100000
+winsmib 0x7C200000 0x00200000
+dhcpmib 0x7C400000 0x00100000
+winsevnt 0x7C500000 0x00100000
+winsrpc 0x7C600000 0x00100000
+winsrpcb 0x7C700000 0x00100000
+
+;
+; The following are for the SCC filters used by the Content index
+;
+SCCUT 0x7d500000 0x00040000
+SCCFA 0x7d540000 0x00040000
+SCCFI 0x7d580000 0x00040000
+SCCIFILT 0x7d600000 0x00040000
+VSACS 0x7d640000 0x00040000
+VSBMP 0x7d640000 0x00040000
+VSDBS 0x7d640000 0x00040000
+VSDRW 0x7d640000 0x00040000
+VSEXE 0x7d640000 0x00040000
+VSGIF 0x7d640000 0x00040000
+VSMCW 0x7d640000 0x00040000
+VSMSW 0x7d640000 0x00040000
+VSMWP2 0x7d640000 0x00040000
+VSMWPF 0x7d640000 0x00040000
+VSPCL 0x7d640000 0x00040000
+VSPDX 0x7d640000 0x00040000
+VSPFS 0x7d640000 0x00040000
+VSPP 0x7d640000 0x00040000
+VSQPW 0x7d640000 0x00040000
+VSRTF 0x7d640000 0x00040000
+VSTIFF 0x7d640000 0x00040000
+VSTEXT 0x7d640000 0x00040000
+VSTXT 0x7d640000 0x00040000
+VSVW3 0x7d640000 0x00040000
+VSW6 0x7d640000 0x00040000
+VSWKS 0x7d640000 0x00040000
+VSWMF 0x7d640000 0x00040000
+VSWORD 0x7d640000 0x00040000
+VSWORK 0x7d640000 0x00040000
+VSWP5 0x7d640000 0x00040000
+VSWP6 0x7d640000 0x00040000
+VSWPF 0x7d640000 0x00040000
+VSXL5 0x7d640000 0x00040000
+VSXY 0x7d640000 0x00040000
+
+;
+; MFC Dlls
+;
+CFM30 0x7d680000 0x00200000
+CFM30U 0x7d680000 0x00200000
+CFMO30 0x7d880000 0x00080000
+CFMO30U 0x7d880000 0x00080000
+NTCTL3D 0x7D900000 0x00010000
+
+
diff --git a/private/utils/ntbackup/exchange/build/i386mk.inc b/private/utils/ntbackup/exchange/build/i386mk.inc
new file mode 100644
index 000000000..91326b37a
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/i386mk.inc
@@ -0,0 +1,247 @@
+!IF 0
+
+Copyright (c) 1994 Microsoft Corporation
+
+Module Name:
+
+ i386mk.inc
+
+Abstract:
+
+ This module contains the x86 specific build controls. It is included
+ by makefile.def.
+
+Author:
+
+ Jeff Havens (jhavens) 13-Feb-1994
+
+Revision History:
+
+!ENDIF
+
+#
+# x86 option control
+#
+
+UMBASE=$(UMBASE:*=i386)
+UMLIBS=$(UMLIBS:*=i386)
+NTRES=$(NTRES:*=i386)
+UMRES=$(UMRES:*=i386)
+UMOBJS=$(UMOBJS:*=i386)
+LINKLIBS=$(LINKLIBS:*=i386)
+DLLBASE=$(DLLBASE:*=i386)
+DLLDEF=$(DLLDEF:*=i386)
+MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:*=i386)
+TARGET=$(TARGET:*=i386)
+DYNLINK_LIB=$(DYNLINK_LIB:*=i386)
+TARGETEXEFILES=$(TARGETEXEFILES:*=i386)
+TARGETLIBFILES=$(TARGETLIBFILES:*=i386)
+TARGETOBJFILES=$(TARGETOBJFILES:*=i386)
+UMOBJFILES=$(UMOBJFILES:*=i386)
+UMEXEFILES=$(UMEXEFILES:*=i386)
+HEADERFILE=$(HEADERFILE:*=i386)
+HEADEROBJNAME=$(HEADEROBJNAME:*=i386)
+HEADEROBJ=$(HEADEROBJ:*=i386)
+PRECOMPILED=$(PRECOMPILED:*=i386)
+PRECOMPILED_CXX=$(PRECOMPILED_CXX:*=i386)
+PRECOMPILED_TARGET=$(PRECOMPILED_TARGET:*=i386)
+
+!ifdef NTTARGETFILES
+NTTARGETFILES=$(NTTARGETFILES:*=i386)
+!endif
+!ifdef NTTARGETFILE0
+NTTARGETFILE0=$(NTTARGETFILE0:*=i386)
+!endif
+!ifdef NTTARGETFILE1
+NTTARGETFILE1=$(NTTARGETFILE1:*=i386)
+!endif
+
+!IF "$(DLLENTRY)" != "-noentry"
+DLLENTRY=$(DLLENTRY)@12
+!ENDIF
+
+!IFDEF STD_CALL_ENTRY
+UMENTRY=$(UMENTRY)@4
+!ENDIF
+
+ENTRY_SUFFIX=@8
+GDI_ENTRY_SUFFIX=@12
+
+!IFDEF 386_WARNING_LEVEL
+MSC_WARNING_LEVEL=$(386_WARNING_LEVEL)
+!ENDIF
+!IFDEF 386_OPTIMIZATION
+MSC_OPTIMIZATION=$(386_OPTIMIZATION)
+!message $(MAKEDIR)\sources (1) : Overriding default optimizations with $(386_OPTIMIZATION)
+!ELSE
+!IF "$(CBSTRING)" == ""
+MSC_OPTIMIZATION=$(MSC_OPTIMIZATION) /Gf /QI6
+!ELSE
+MSC_OPTIMIZATION=$(MSC_OPTIMIZATION) /QI6
+!ENDIF
+!ENDIF
+!IFDEF 386_CPPFLAGS
+MSC_CPPFLAGS=$(386_CPPFLAGS)
+!ENDIF
+
+STDFLAGS= /c /Zel /Zp8 /Gy $(CBSTRING) $(MSC_WARNING_LEVEL) $(MSC_CALL_TYPE) /G4 $(MFC_FLAGS)
+
+#LINKLIBS=$(LINKLIBS) $(BASEDIR)\public\sdk\lib\i386\int64.lib
+
+!IF "$(TARGETTYPE)"=="DRIVER" || \
+ "$(TARGETTYPE)"=="GDI_DRIVER" || \
+ "$(TARGETTYPE)"=="MINIPORT"
+#
+#Drivers don't link with link libs.
+#
+
+MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS) $(BASEDIR)\public\sdk\lib\i386\int64.lib
+!ENDIF
+
+!IF "$(386_STDCALL)" == "0"
+MSC_CALL_TYPE=/Gd
+MSC_CALL_DEFINE=
+!ELSE
+! IF "$(386_STDCALL)" == "2"
+MSC_CALL_TYPE=/Gr
+MSC_CALL_DEFINE=
+! ELSE
+MSC_CALL_TYPE=/Gz
+MSC_CALL_DEFINE=-DSTD_CALL
+! ENDIF
+!ENDIF
+
+!IF "$(NTDEBUG)" == "retail" || "$(NTDEBUG)" == ""
+! IFDEF NTNOFPO
+!MESSAGE $(NTMAKEENV)\i386mk.inc(1) : Overriding FPO default with NTNOFPO
+TARGET_DBG_DEFINES= $(TARGET_DBG_DEFINES) -DFPO=0
+DBGFLAGS=$(DBGFLAGS) /Oy-
+! ELSE
+TARGET_DBG_DEFINES= $(TARGET_DBG_DEFINES) -DFPO=1
+DBGFLAGS=$(DBGFLAGS) /Oy
+! ENDIF
+!ELSE
+TARGET_DBG_DEFINES= $(TARGET_DBG_DEFINES) -DFPO=0
+DBGFLAGS=$(DBGFLAGS) /Oy-
+386_ADBGFLAGS=$(386_ADBGFLAGS) /Zi
+!ENDIF
+
+# Use /Z7 instead of /Zi
+
+DBGFLAGS=$(DBGFLAGS:/Zi=/Z7)
+
+!IFDEF NTLEGO
+DBGFLAGS=$(DBGFLAGS) /Z7
+386_ADBGFLAGS=$(386_ADBGFLAGS) /Zi
+LINKER_FLAGS=$(LINKER_FLAGS) -debug:full -debugtype:cv,fixup
+LINKER_MERGE_RDATA=
+!ENDIF
+
+!IF "$(BROWSER_INFO)" == "yes"
+BROWSER= -FR$*.sbr
+!ELSE
+BROWSER=
+!ENDIF
+
+
+#
+# 386 option control
+#
+
+ENV_DEFINES= $(MSC_CPPFLAGS) $(NTCPPFLAGS)
+
+!IF "$(HALTYPE)" == ""
+HALDEF=
+!ELSE
+HALDEF=-D$(HALTYPE)=1
+!ENDIF
+
+STD_DEFINES= -D_X86_=1 -Di386=1 $(HALDEF) $(MSC_CALL_DEFINE) $(STD_DEFINES)
+
+CDEFINES=$(STD_DEFINES) $(TARGET_DBG_DEFINES) $(ENV_DEFINES) \
+ $(LIBC_DEFINES) $(C_DEFINES) $(NET_C_DEFINES)
+CFLAGS=$(386_FLAGS) $(NT386FLAGS) $(STDFLAGS) $(DBGFLAGS) \
+ $(BROWSER) $(386_PERFFLAGS) $(USER_C_FLAGS)
+386_ASMFLAGS=$(386_ADBGFLAGS) $(BROWSER) $(STD_DEFINES) \
+ $(TARGET_DBG_DEFINES) $(ENV_DEFINES) $(ASM_DEFINES)
+
+386_CDEFINES=$(CDEFINES)
+386_CFLAGS=$(CFLAGS)
+
+CC_NAME = cl -nologo
+
+C_COMPILER_NAME = $(CC_NAME)
+CXX_COMPILER_NAME = $(CC_NAME)
+C_PREPROCESSOR_NAME = $(CC_NAME)
+
+GLOBAL_C_FLAGS = -Ii386\ -I. $(INCPATH1) $(CDEFINES) $(CFLAGS)
+
+C_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED) $(COMPILER_WARNINGS)
+CXX_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED_CXX) $(COMPILER_WARNINGS)
+C_PREPROCESSOR_FLAGS = $(GLOBAL_C_FLAGS) -EP -Tc
+
+C_COMPILER = $(C_COMPILER_NAME) $(C_COMPILER_FLAGS)
+CXX_COMPILER = $(CXX_COMPILER_NAME) $(CXX_COMPILER_FLAGS)
+C_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS)
+
+386_ASSEMBLER=ml -c -coff -Cx -nologo -Ii386\ -I. $(INCPATH1) -Zm $(386_ASMFLAGS)
+
+ECHO_MSG=$(C_COMPILER) $<
+ECHO_PRECOMPILED_MSG=$(C_COMPILER) /Yl$(TARGETNAME) $(HEADERFILE) $(HEADEROBJ) $(PRECOMPILED_FLAG) $(PRECOMPILED_INCLUDE)
+
+{}.c{}.asm:
+ $(C_COMPILER_NAME) @<< /Fa $(MAKEDIR)\$(<F)
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\i386\}.asm{}.lst:
+ $(386_ASSEMBLER) /Fl$@ /Foobj\i386\$(@B).obj $<
+
+{i386\}.asm{}.lst:
+ $(386_ASSEMBLER) /Fl$@ /Fo$(MAKEDIR)\obj\i386\$(@B).obj $<
+
+{..\i386\}.asm{obj\i386\}.obj:
+ $(386_ASSEMBLER) -Fo$(MAKEDIR)\$@ $<
+
+{i386\}.asm{obj\i386\}.obj:
+ $(386_ASSEMBLER) -Fo$(MAKEDIR)\$@ $<
+
+LINKFLAGS=$(LNKFLAGS)
+
+LIBRARY_OBJS=$(LINKLIBS) $(OBJECTS)
+
+!IFDEF TUKWILA
+_NTTREE=$(_NT386TREE)
+!ENDIF
+
+!IF DEFINED (CAIRO_PRODUCT)
+! IF DEFINED (_CAIRO386TREE)
+_NTTREE=$(_CAIRO386TREE)
+! ENDIF
+!ELSEIF DEFINED (CHICAGO_PRODUCT)
+! IF DEFINED (_CHICAGO386TREE)
+_NTTREE=$(_CHICAGO386TREE)
+! elseif defined(_NT386TREE)
+_NTTREE=$(_NT386TREE)
+! ENDIF
+!ELSEIF DEFINED (_NT386TREE)
+_NTTREE=$(_NT386TREE)
+!ENDIF
+
+!IFDEF KERNEL_MODE
+_NTTREE=$(_NT386TREE)\km
+!ENDIF
+
+!IFDEF _NT386LIBS
+_NTLIBS=$(_NT386LIBS)
+!ENDIF
+
+COPYDST=$(386COPYDST)
+LIB_COPY=nti386cp.cmd
+
+!IF "$(NTDEBUGTYPE)" == "windbg" || "$(NTDEBUGTYPE)" == "both"
+NTTEST_LINK_OPTIONS=-entry:main
+!ELSE
+NTTEST_LINK_OPTIONS=-fixed -base:0x80100000 -entry:main
+!ENDIF
diff --git a/private/utils/ntbackup/exchange/build/inc/common.ver b/private/utils/ntbackup/exchange/build/inc/common.ver
new file mode 100644
index 000000000..00c8f6b17
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/common.ver
@@ -0,0 +1,96 @@
+
+/*---------------------------------------------------------------*/
+/* */
+/* The following section actually creates the version structure. */
+/* They are ignored if we are not being invoked by RC. */
+/* */
+/* ntverp.H must be included before including this file */
+/* */
+/* If VER_LEGALCOPYRIGHT_STR is not defined, it will be */
+/* constructed using VER_LEGALCOPYRIGHT_YEARS, so at least one */
+/* these macros must be defined before including this file. */
+/* */
+/* VER_FILETYPE, VER_FILESUBTYPE, VER_FILEDESCRIPTION_STR, and */
+/* VER_INTERNALNAME_STR must be defined before including this */
+/* file. */
+/* */
+/* If VER_FILEVERSION is not defined, VER_PRODUCTVERSION will be */
+/* used instead. If VER_FILEVERSION_STR is not defined, */
+/* VER_PRODUCTVERSION_STR will be used instead. */
+/* */
+/* If VER_ORIGINALFILENAME_STR is not defined, it is set to */
+/* the value in VER_INTERNALNAME_STR. */
+/* */
+/* If INTL is defined, then this is assumed to be an */
+/* an international build; two string blocks will be created, */
+/* (since all version resources must have English), and the */
+/* second one can be localized */
+/* */
+/*---------------------------------------------------------------*/
+
+#ifdef RC_INVOKED
+
+#ifndef VER_LEGALCOPYRIGHT_YEARS
+#define VER_LEGALCOPYRIGHT_YEARS "1981-1995"
+#endif
+
+#ifndef VER_LEGALCOPYRIGHT_STR
+#define VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corp. " VER_LEGALCOPYRIGHT_YEARS
+#endif
+
+#ifndef VER_PRODUCTNAME_STR
+#define VER_PRODUCTNAME_STR "Microsoft\256 Windows NT(TM) Operating System"
+#endif
+
+#ifndef VER_PRODUCTVERSION
+#define VER_PRODUCTVERSION 4,00,01,552
+#endif
+
+#ifndef VER_FILEVERSION
+#define VER_FILEVERSION VER_PRODUCTVERSION
+#endif
+
+#ifndef VER_PRODUCTVERSION_STR
+#define VER_PRODUCTVERSION_STR "4.00"
+#endif
+
+#ifndef VER_FILEVERSION_STR
+#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR
+#endif
+
+#ifndef VER_ORIGINALFILENAME_STR
+#define VER_ORIGINALFILENAME_STR VER_INTERNALNAME_STR
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VER_FILEVERSION
+PRODUCTVERSION VER_PRODUCTVERSION
+FILEFLAGSMASK VER_FILEFLAGSMASK
+FILEFLAGS VER_FILEFLAGS
+FILEOS VER_FILEOS
+FILETYPE VER_FILETYPE
+FILESUBTYPE VER_FILESUBTYPE
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */
+ BEGIN
+ VALUE "CompanyName", VER_COMPANYNAME_STR
+ VALUE "FileDescription", VER_FILEDESCRIPTION_STR
+ VALUE "FileVersion", VER_FILEVERSION_STR
+ VALUE "InternalName", VER_INTERNALNAME_STR
+ VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
+ VALUE "OriginalFilename",VER_ORIGINALFILENAME_STR
+ VALUE "ProductName", VER_PRODUCTNAME_STR
+ VALUE "ProductVersion", VER_PRODUCTVERSION_STR
+ END
+
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 0x04B0
+ END
+END
+
+#endif
diff --git a/private/utils/ntbackup/exchange/build/inc/ntddscsi.h b/private/utils/ntbackup/exchange/build/inc/ntddscsi.h
new file mode 100644
index 000000000..332821056
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/ntddscsi.h
@@ -0,0 +1,229 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1990-1993 Microsoft Corporation
+
+Module Name:
+
+ ntddscsi.h
+
+Abstract:
+
+ This is the include file that defines all constants and types for
+ accessing the SCSI port adapters.
+
+Author:
+
+ Jeff Havens
+
+Revision History:
+
+--*/
+
+#ifndef _NTDDSCSIH_
+#define _NTDDSCSIH_
+
+//
+// Device Name - this string is the name of the device. It is the name
+// that should be passed to NtOpenFile when accessing the device.
+//
+// Note: For devices that support multiple units, it should be suffixed
+// with the Ascii representation of the unit number.
+//
+
+#define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER
+
+#define DD_SCSI_DEVICE_NAME "\\Device\\ScsiPort"
+
+
+//
+// NtDeviceIoControlFile IoControlCode values for this device.
+//
+// Warning: Remember that the low two bits of the code specify how the
+// buffers are passed to the driver!
+//
+
+#define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+#define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+#define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SCSI_RESCAN_BUS CTL_CODE(IOCTL_SCSI_BASE, 0x0407, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SCSI_GET_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE, 0x0408, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// Define the SCSI pass through structure.
+//
+
+typedef struct _SCSI_PASS_THROUGH {
+ USHORT Length;
+ UCHAR ScsiStatus;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR CdbLength;
+ UCHAR SenseInfoLength;
+ UCHAR DataIn;
+ ULONG DataTransferLength;
+ ULONG TimeOutValue;
+ ULONG DataBufferOffset;
+ ULONG SenseInfoOffset;
+ UCHAR Cdb[16];
+}SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
+
+//
+// Define the SCSI pass through direct structure.
+//
+
+typedef struct _SCSI_PASS_THROUGH_DIRECT {
+ USHORT Length;
+ UCHAR ScsiStatus;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR CdbLength;
+ UCHAR SenseInfoLength;
+ UCHAR DataIn;
+ ULONG DataTransferLength;
+ ULONG TimeOutValue;
+ PVOID DataBuffer;
+ ULONG SenseInfoOffset;
+ UCHAR Cdb[16];
+}SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
+
+//
+// Define SCSI information.
+// Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
+//
+
+typedef struct _SCSI_BUS_DATA {
+ UCHAR NumberOfLogicalUnits;
+ UCHAR InitiatorBusId;
+ ULONG InquiryDataOffset;
+}SCSI_BUS_DATA, *PSCSI_BUS_DATA;
+
+//
+// Define SCSI adapter bus information structure..
+// Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
+//
+
+typedef struct _SCSI_ADAPTER_BUS_INFO {
+ UCHAR NumberOfBuses;
+ SCSI_BUS_DATA BusData[1];
+} SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO;
+
+//
+// Define SCSI adapter bus information.
+// Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
+//
+
+typedef struct _SCSI_INQUIRY_DATA {
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ BOOLEAN DeviceClaimed;
+ ULONG InquiryDataLength;
+ ULONG NextInquiryDataOffset;
+ UCHAR InquiryData[1];
+}SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
+
+//
+// Define header for I/O control SRB.
+//
+
+typedef struct _SRB_IO_CONTROL {
+ ULONG HeaderLength;
+ UCHAR Signature[8];
+ ULONG Timeout;
+ ULONG ControlCode;
+ ULONG ReturnCode;
+ ULONG Length;
+} SRB_IO_CONTROL, *PSRB_IO_CONTROL;
+
+//
+// SCSI port driver capabilities structure.
+//
+
+typedef struct _IO_SCSI_CAPABILITIES {
+
+ //
+ // Length of this structure
+ //
+
+ ULONG Length;
+
+ //
+ // Maximum transfer size in single SRB
+ //
+
+ ULONG MaximumTransferLength;
+
+ //
+ // Maximum number of physical pages per data buffer
+ //
+
+ ULONG MaximumPhysicalPages;
+
+ //
+ // Async calls from port to class
+ //
+
+ ULONG SupportedAsynchronousEvents;
+
+ //
+ // Alignment mask for data transfers.
+ //
+
+ ULONG AlignmentMask;
+
+ //
+ // Supports tagged queuing
+ //
+
+ BOOLEAN TaggedQueuing;
+
+ //
+ // Host adapter scans down for bios devices.
+ //
+
+ BOOLEAN AdapterScansDown;
+
+ //
+ // The host adapter uses programmed I/O.
+ //
+
+ BOOLEAN AdapterUsesPio;
+
+} IO_SCSI_CAPABILITIES, *PIO_SCSI_CAPABILITIES;
+
+typedef struct _SCSI_ADDRESS {
+ ULONG Length;
+ UCHAR PortNumber;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+}SCSI_ADDRESS, *PSCSI_ADDRESS;
+
+//
+// Define structure for returning crash dump pointers.
+//
+
+typedef struct _ADAPTER_OBJECT;
+
+typedef struct _DUMP_POINTERS {
+ struct _ADAPTER_OBJECT *AdapterObject;
+ PVOID MappedRegisterBase;
+ PVOID PortConfiguration;
+ PVOID CommonBufferVa;
+ LARGE_INTEGER CommonBufferPa;
+ ULONG CommonBufferSize;
+} DUMP_POINTERS, *PDUMP_POINTERS;
+
+//
+// Define values for pass-through DataIn field.
+//
+
+#define SCSI_IOCTL_DATA_OUT 0
+#define SCSI_IOCTL_DATA_IN 1
+#define SCSI_IOCTL_DATA_UNSPECIFIED 2
+#endif
diff --git a/private/utils/ntbackup/exchange/build/inc/ntverp.h b/private/utils/ntbackup/exchange/build/inc/ntverp.h
new file mode 100644
index 000000000..e36cae5ed
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/ntverp.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+ * *
+ * ntverp.H -- Version information for internal builds *
+ * *
+ * This file is only modified by the official builder to update the *
+ * VERSION, VER_PRODUCTVERSION, VER_PRODUCTVERSION_STR and *
+ * VER_PRODUCTBETA_STR values. *
+ * *
+ ****************************************************************************/
+
+/*--------------------------------------------------------------*/
+/* the following values should be modified by the official */
+/* builder for each build */
+/*--------------------------------------------------------------*/
+
+#define VER_PRODUCTBUILD 599
+#define VER_PRODUCTVERSION_STR "4.00"
+#define VER_PRODUCTVERSION 4,00,VER_PRODUCTBUILD,1
+#define VER_PRODUCTBETA_STR ""
+
+/*--------------------------------------------------------------*/
+/* the following section defines values used in the version */
+/* data structure for all files, and which do not change. */
+/*--------------------------------------------------------------*/
+
+/* default is nodebug */
+#if DBG
+#define VER_DEBUG VS_FF_DEBUG
+#else
+#define VER_DEBUG 0
+#endif
+
+/* default is prerelease */
+#if BETA
+#define VER_PRERELEASE VS_FF_PRERELEASE
+#else
+#define VER_PRERELEASE 0
+#endif
+
+#define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+#define VER_FILEOS VOS_NT_WINDOWS32
+#define VER_FILEFLAGS (VER_PRERELEASE|VER_DEBUG)
+
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+#define VER_PRODUCTNAME_STR "Microsoft\256 Windows NT(TM) Operating System"
+#define VER_LEGALTRADEMARKS_STR \
+"Microsoft\256 is a registered trademark of Microsoft Corporation. Windows NT(TM) is a trademark of Microsoft Corporation."
diff --git a/private/utils/ntbackup/exchange/build/inc/pcrt32.h b/private/utils/ntbackup/exchange/build/inc/pcrt32.h
new file mode 100644
index 000000000..9a6e59aec
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/pcrt32.h
@@ -0,0 +1,39 @@
+/*
+ * porting macros for c runtimes - use these to let 16 bit crt calls work
+ * properly on 32 bit code.
+ */
+
+
+#define _ffree free
+#define _fmalloc malloc
+#define _fmemccpy memccpy
+#define _fmemchr memchr
+#define _fmemcmp memcmp
+#define _fmemcpy memcpy
+#define _fmemicmp memicmp
+#define _fmemmove memmove
+#define _fmemset memset
+#define _frealloc realloc
+#define _fstrcat strcat
+#define _fstrchr strchr
+#define _fstrcmp strcmp
+#define _fstrcpy strcpy
+#define _fstrcspn strcspn
+#define _fstrdup strdup
+#define _fstricmp stricmp
+#define _fstrlen strlen
+#define _fstrlwr strlwr
+#define _fstrncat strncat
+#define _fstrncmp strncmp
+#define _fstrncpy strncpy
+#define _fstrnicmp strnicmp
+#define _fstrnset strnset
+#define _fstrpbrk strpbrk
+#define _fstrrchr strrchr
+#define _fstrrev strrev
+#define _fstrset strset
+#define _fstrspn strspn
+#define _fstrstr strstr
+#define _fstrtok strtok
+#define _fstrupr strupr
+
diff --git a/private/utils/ntbackup/exchange/build/inc/plan32.h b/private/utils/ntbackup/exchange/build/inc/plan32.h
new file mode 100644
index 000000000..728c0d82e
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/plan32.h
@@ -0,0 +1,14 @@
+/*****************************************************************************\
+* PLAN32.H - PORTABILITY MAPPING HEADER FILE
+*
+* This file provides macros to map portable lanman code to its 32 bit form.
+\*****************************************************************************/
+
+
+/*----------------------------------LANMAN----------------------------------*/
+
+/* LANMAN MACROS: */
+
+#define COPYTOARRAY(pDest, pSource) pDest = pSource
+
+/* LANMAN API: */
diff --git a/private/utils/ntbackup/exchange/build/inc/port1632.h b/private/utils/ntbackup/exchange/build/inc/port1632.h
new file mode 100644
index 000000000..d24831d19
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/port1632.h
@@ -0,0 +1,40 @@
+/***************************************************************************\
+* Module Name: 1632PORT.H
+*
+* Copyright (c) 1985-1993, Microsoft Corporation
+*
+* Master include file for Portable Windows applications.
+*
+* History:
+* sanfords 1/10/91 Created
+*
+\***************************************************************************/
+
+/*
+ * This file maps a Meta-API for Windows to specific 16-bit or 32-bit forms
+ * allowing a single portable C source for windows to work on multiple
+ * versions of Windows.
+ */
+
+#ifndef _PORT1632_
+#define _PORT1632_
+
+#if defined(WIN16)
+/* ---------------- Maps to windows 3.0 and 3.1 16-bit APIs ----------------*/
+#include "ptypes16.h"
+#include "pwin16.h"
+#include "plan16.h"
+/* -------------------------------------------------------------------------*/
+
+#elif defined(WIN32)
+/* ---------------- Maps to windows 3.2 and 4.0 32-bit APIs ----------------*/
+#include "ptypes32.h"
+#include "pcrt32.h"
+#include "pwin32.h"
+#include "plan32.h"
+/* -------------------------------------------------------------------------*/
+#else
+#error You must define either WIN32 or WIN16
+#endif /* WIN32 or WIN16 */
+#endif /* ndef _PORT1632_ */
+
diff --git a/private/utils/ntbackup/exchange/build/inc/ptypes32.h b/private/utils/ntbackup/exchange/build/inc/ptypes32.h
new file mode 100644
index 000000000..8b2118b09
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/ptypes32.h
@@ -0,0 +1,62 @@
+/*****************************************************************************\
+* PTYPES32.H - PORTABILITY MAPPING HEADER FILE
+*
+* This file provides types for 16/32 bit portable code.
+\*****************************************************************************/
+
+#include <setjmp.h>
+
+/* TYPES: */
+
+#define HUGE_T
+typedef DWORD WORD2DWORD ;
+typedef DWORD CHARPARM ;
+typedef DWORD SHORTPARM ;
+typedef DWORD VERSION ;
+typedef LPSTR PDLLMEM ;
+typedef unsigned long CHAR2ULONG ;
+typedef unsigned long USHORT2ULONG ;
+typedef unsigned long SHORT2ULONG ;
+typedef unsigned long INT2DWORD ;
+typedef unsigned short BYTE2WORD ;
+typedef POINTS MPOINT ;
+typedef WORD INT2WORD ;
+typedef jmp_buf MCATCHBUF ;
+typedef MCATCHBUF *LPMCATCHBUF ;
+
+#define HFILE2INT(h, flags) (INT)_open_osfhandle((long)(h), (int)(flags))
+#define INT2HFILE(i) (HFILE)_get_osfhandle((int)(i))
+#define DUPHFILE(h) MDupHandle(h)
+#define MGLOBALPTR(p) (LPSTR)(p)
+
+/* PRAGMAS */
+
+#define _LOADDS
+#define _EXPORT
+
+#define ERROR_GETADDR_FAILED 0x8001
+
+#define INITWINDOWS()
+
+#define WF_PMODE 0x0001 /* from winkrnl.h */
+#define WF_CPU286 0x0002
+#define WF_CPU386 0x0004
+#define WF_CPU486 0x0008
+#define WF_STANDARD 0x0010
+#define WF_WIN286 0x0010
+#define WF_ENHANCED 0x0020
+#define WF_WIN386 0x0020
+#define WF_CPU086 0x0040
+#define WF_CPU186 0x0080
+#define WF_LARGEFRAME 0x0100
+#define WF_SMALLFRAME 0x0200
+#define WF_80x87 0x0400
+
+
+/* DEFINITIONS */
+
+
+#define TF_FORCEDRIVE (BYTE)0x80
+#define DLLMEM_MOVEABLE 0
+#define DLLMEM_ZEROINIT GMEM_ZEROINIT
+
diff --git a/private/utils/ntbackup/exchange/build/inc/pwin32.h b/private/utils/ntbackup/exchange/build/inc/pwin32.h
new file mode 100644
index 000000000..2b9de0fe7
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/pwin32.h
@@ -0,0 +1,305 @@
+/*****************************************************************************\
+* PWIN32.H - PORTABILITY MAPPING HEADER FILE
+*
+* This file provides macros to map portable windows code to its 32 bit form.
+\*****************************************************************************/
+
+/*-----------------------------------USER------------------------------------*/
+
+/* HELPER MACROS */
+
+#define MAPVALUE(v16, v32) (v32)
+#define MAPTYPE(v16, v32) v32
+#define MAKEMPOINT(l) (*((MPOINT *)&(l)))
+#define MPOINT2POINT(mpt,pt) ((pt).x = (mpt).x, (pt).y = (mpt).y)
+#define POINT2MPOINT(pt, mpt) ((mpt).x = (SHORT)(pt).x, (mpt).y = (SHORT)(pt).y)
+#define LONG2POINT(l, pt) ((pt).x = (SHORT)LOWORD(l), (pt).y = (SHORT)HIWORD(l))
+
+#define SETWINDOWUINT(hwnd, index, ui) (UINT)SetWindowLong(hwnd, index, (LONG)(ui))
+#define GETWINDOWUINT(hwnd, index) (UINT)GetWindowLong(hwnd, index)
+#define SETCLASSUINT(hwnd, index, ui) (UINT)SetClassLong(hwnd, index, (LONG)(ui))
+#define GETCLASSUINT(hwnd, index) (UINT)GetClassLong(hwnd, index)
+
+#define GETCBCLSEXTRA(hwnd) GETCLASSUINT(hwnd, GCL_CBCLSEXTRA)
+#define SETCBCLSEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCL_CBCLSEXTRA, cb)
+#define GETCBWNDEXTRA(hwnd) GETCLASSUINT(hwnd, GCL_CBWNDEXTRA)
+#define SETCBWNDEXTRA(hwnd, cb) SETCLASSUINT(hwnd, GCL_CBWNDEXTRA, cb)
+#define GETCLASSBRBACKGROUND(hwnd) (HBRUSH)GETCLASSUINT(hwnd, GCL_HBRBACKGROUND)
+#define SETCLASSBRBACKGROUND(hwnd, h) (HBRUSH)SETCLASSUINT(hwnd, GCL_HBRBACKGROUND, h)
+#define GETCLASSCURSOR(hwnd) (HCURSOR)GETCLASSUINT(hwnd, GCL_HCURSOR)
+#define SETCLASSCURSOR(hwnd, h) (HCURSOR)SETCLASSUINT(hwnd, GCL_HCURSOR, h)
+#define GETCLASSHMODULE(hwnd) (HMODULE)GETCLASSUINT(hwnd, GCL_HMODULE)
+#define SETCLASSHMODULE(hwnd, h) (HMODULE)SETCLASSUINT(hwnd, GCL_HMODULE, h)
+#define GETCLASSICON(hwnd) (HICON)GETCLASSUINT((hwnd), GCL_HICON)
+#define SETCLASSICON(hwnd, h) (HICON)SETCLASSUINT((hwnd), GCL_HICON, h)
+#define GETCLASSSTYLE(hwnd) GETCLASSUINT((hwnd), GCL_STYLE)
+#define SETCLASSSTYLE(hwnd, style) SETCLASSUINT((hwnd), GCL_STYLE, style)
+#define GETHWNDINSTANCE(hwnd) (HINSTANCE)GETWINDOWUINT((hwnd), GWL_HINSTANCE)
+#define SETHWNDINSTANCE(hwnd, h) (HINSTANCE)SETWINDOWUINT((hwnd), GWL_HINSTANCE, h)
+#define GETHWNDPARENT(hwnd) (HWND)GETWINDOWUINT((hwnd), GWL_HWNDPARENT)
+#define SETHWNDPARENT(hwnd, h) (HWND)SETWINDOWUINT((hwnd), GWL_HWNDPARENT, h)
+#define GETWINDOWID(hwnd) GETWINDOWUINT((hwnd), GWL_ID)
+#define SETWINDOWID(hwnd, id) SETWINDOWUINT((hwnd), GWL_ID, id)
+
+/* USER API */
+
+#define MDlgDirSelect(hDlg, lpstr, nLength, nIDListBox) \
+ DlgDirSelectEx(hDlg, lpstr, nLength, nIDListBox)
+
+#define MDlgDirSelectCOMBOBOX(hDlg, lpstr, nLength, nIDComboBox) \
+ DlgDirSelectComboBoxEx(hDlg, lpstr, nLength, nIDComboBox)
+
+#define MGetLastError GetLastError
+
+#define MMain(hInst, hPrevInst, lpCmdLine, nCmdShow) \
+ INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, \
+ INT nCmdShow) { \
+ INT _argc; \
+ CHAR **_argv;
+
+LPSTR MGetCmdLine(VOID);
+DWORD WINAPI MSendMsgEM_GETSEL(HWND hDlg, WORD2DWORD * piStart, WORD2DWORD * piEnd);
+
+
+/* USER MESSAGES: */
+
+#define GET_WPARAM(wp, lp) (wp)
+#define GET_LPARAM(wp, lp) (lp)
+
+#define GET_WM_ACTIVATE_STATE(wp, lp) LOWORD(wp)
+#define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) (BOOL)HIWORD(wp)
+#define GET_WM_ACTIVATE_HWND(wp, lp) (HWND)(lp)
+#define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) \
+ (WPARAM)MAKELONG((s), (fmin)), (LONG)(hwnd)
+
+#define GET_WM_CHARTOITEM_CHAR(wp, lp) (TCHAR)LOWORD(wp)
+#define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(wp)
+#define GET_WM_CHARTOITEM_HWND(wp, lp) (HWND)(lp)
+#define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) \
+ (WPARAM)MAKELONG((pos), (ch)), (LONG)(hwnd)
+
+#define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
+#define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
+#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
+#define GET_WM_COMMAND_MPS(id, hwnd, cmd) \
+ (WPARAM)MAKELONG(id, cmd), (LONG)(hwnd)
+
+#define WM_CTLCOLOR 0x0019
+
+#define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
+#define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)(lp)
+#define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) (WORD)(msg - WM_CTLCOLORMSGBOX)
+#define GET_WM_CTLCOLOR_MSG(type) (WORD)(WM_CTLCOLORMSGBOX+(type))
+#define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) \
+ (WPARAM)(hdc), (LONG)(hwnd)
+
+
+#define GET_WM_MENUSELECT_CMD(wp, lp) LOWORD(wp)
+#define GET_WM_MENUSELECT_FLAGS(wp, lp) (UINT)(int)(short)HIWORD(wp)
+#define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)(lp)
+#define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) \
+ (WPARAM)MAKELONG(cmd, f), (LONG)(hmenu)
+
+// Note: the following are for interpreting MDIclient to MDI child messages.
+#define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (lp == (LONG)hwnd)
+#define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)(wp)
+#define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)(lp)
+// Note: the following is for sending to the MDI client window.
+#define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA)\
+ (WPARAM)(hwndA), 0
+
+#define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) (WPARAM)hmenuF, (LONG)hmenuW
+
+#define GET_WM_MENUCHAR_CHAR(wp, lp) (TCHAR)LOWORD(wp)
+#define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)(lp)
+#define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)HIWORD(wp)
+#define GET_WM_MENUCHAR_MPS(ch, hmenu, f) \
+ (WPARAM)MAKELONG(ch, f), (LONG)(hmenu)
+
+#define GET_WM_PARENTNOTIFY_MSG(wp, lp) LOWORD(wp)
+#define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(wp)
+#define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)(lp)
+#define GET_WM_PARENTNOTIFY_X(wp, lp) (INT)LOWORD(lp)
+#define GET_WM_PARENTNOTIFY_Y(wp, lp) (INT)HIWORD(lp)
+#define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) \
+ (WPARAM)MAKELONG(id, msg), (LONG)(hwnd)
+#define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) \
+ (WPARAM)MAKELONG(0, msg), MAKELONG(x, y)
+
+#define GET_WM_VKEYTOITEM_CODE(wp, lp) (INT)LOWORD(wp)
+#define GET_WM_VKEYTOITEM_ITEM(wp, lp) HIWORD(wp)
+#define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)(lp)
+#define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) \
+ (WPARAM)MAKELONG(item, code), (LONG)(hwnd)
+
+#define GET_EM_SETSEL_START(wp, lp) (INT)(wp)
+#define GET_EM_SETSEL_END(wp, lp) (lp)
+#define GET_EM_SETSEL_MPS(iStart, iEnd) \
+ (WPARAM)(iStart), (LONG)(iEnd)
+
+#define GET_EM_LINESCROLL_MPS(vert, horz) \
+ (WPARAM)horz, (LONG)vert
+
+#define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)(lp)
+
+#define GET_WM_HSCROLL_CODE(wp, lp) LOWORD(wp)
+#define GET_WM_HSCROLL_POS(wp, lp) HIWORD(wp)
+#define GET_WM_HSCROLL_HWND(wp, lp) (HWND)(lp)
+#define GET_WM_HSCROLL_MPS(code, pos, hwnd) \
+ (WPARAM)MAKELONG(code, pos), (LONG)(hwnd)
+
+#define GET_WM_VSCROLL_CODE(wp, lp) LOWORD(wp)
+#define GET_WM_VSCROLL_POS(wp, lp) HIWORD(wp)
+#define GET_WM_VSCROLL_HWND(wp, lp) (HWND)(lp)
+#define GET_WM_VSCROLL_MPS(code, pos, hwnd) \
+ (WPARAM)MAKELONG(code, pos), (LONG)(hwnd)
+
+/* DDE macros */
+
+LONG WINAPI PackDDElParam(UINT msg, UINT uiLo, UINT uiHi);
+BOOL WINAPI UnpackDDElParam(UINT msg, LONG lParam, PUINT puiLo, PUINT puiHi);
+BOOL WINAPI FreeDDElParam(UINT msg, LONG lParam);
+UINT WINAPI MGetDDElParamLo(UINT msg, LONG lParam);
+UINT WINAPI MGetDDElParamHi(UINT msg, LONG lParam);
+BOOL WINAPI MPostDDEMsg(HWND hTo, UINT msg, HWND hFrom, UINT uiLo, UINT uiHi);
+
+#define DDEFREE(msg, lp) FreeDDElParam(msg, lp)
+
+#define GET_WM_DDE_ACK_STATUS(wp, lp) ((WORD)MGetDDElParamLo(WM_DDE_ACK, lp))
+#define GET_WM_DDE_ACK_ITEM(wp, lp) ((ATOM)MGetDDElParamHi(WM_DDE_ACK, lp))
+#define MPostWM_DDE_ACK(hTo, hFrom, wStatus, aItem) \
+ MPostDDEMsg(hTo, WM_DDE_ACK, hFrom, (UINT)wStatus, (UINT)aItem)
+
+#define GET_WM_DDE_ADVISE_HOPTIONS(wp, lp) ((HANDLE)MGetDDElParamLo(WM_DDE_ADVISE, lp))
+#define GET_WM_DDE_ADVISE_ITEM(wp, lp) ((ATOM)MGetDDElParamHi(WM_DDE_ADVISE, lp))
+#define MPostWM_DDE_ADVISE(hTo, hFrom, hOptions, aItem) \
+ MPostDDEMsg(hTo, WM_DDE_ADVISE, hFrom, (UINT)hOptions, (UINT)aItem)
+
+#define GET_WM_DDE_DATA_HDATA(wp, lp) ((HANDLE)MGetDDElParamLo(WM_DDE_DATA, lp))
+#define GET_WM_DDE_DATA_ITEM(wp, lp) ((ATOM)MGetDDElParamHi(WM_DDE_DATA, lp))
+#define MPostWM_DDE_DATA(hTo, hFrom, hData, aItem) \
+ MPostDDEMsg(hTo, WM_DDE_DATA, hFrom, (UINT)hData, (UINT)aItem)
+
+#define GET_WM_DDE_EXECUTE_HDATA(wp, lp) ((HANDLE)lp)
+#define MPostWM_DDE_EXECUTE(hTo, hFrom, hDataExec) \
+ PostMessage(hTo, WM_DDE_EXECUTE, (WPARAM)hFrom, (LONG)hDataExec)
+
+#define GET_WM_DDE_POKE_HDATA(wp, lp) ((HANDLE)MGetDDElParamLo(WM_DDE_POKE, lp))
+#define GET_WM_DDE_POKE_ITEM(wp, lp) ((ATOM)MGetDDElParamHi(WM_DDE_POKE, lp))
+#define MPostWM_DDE_POKE(hTo, hFrom, hData, aItem) \
+ MPostDDEMsg(hTo, WM_DDE_POKE, hFrom, (UINT)hData, (UINT)aItem)
+
+#define GET_WM_DDE_EXECACK_STATUS(wp, lp) ((WORD)MGetDDElParamLo(WM_DDE_ACK, lp))
+#define GET_WM_DDE_EXECACK_HDATA(wp, lp) ((HANDLE)MGetDDElParamHi(WM_DDE_ACK, lp))
+#define MPostWM_DDE_EXECACK(hTo, hFrom, wStatus, hCommands) \
+ MPostDDEMsg(hTo, WM_DDE_ACK, hFrom, (UINT)wStatus, (UINT)hCommands)
+
+#define GET_WM_DDE_REQUEST_FORMAT(wp, lp) ((ATOM)LOWORD(lp))
+#define GET_WM_DDE_REQUEST_ITEM(wp, lp) ((ATOM)HIWORD(lp))
+#define MPostWM_DDE_REQUEST(hTo, hFrom, fmt, aItem) \
+ MPostDDEMsg(hTo, WM_DDE_REQUEST, hFrom, (UINT)fmt, (UINT)aItem)
+
+#define GET_WM_DDE_UNADVISE_FORMAT(wp, lp) ((ATOM)LOWORD(lp))
+#define GET_WM_DDE_UNADVISE_ITEM(wp, lp) ((ATOM)HIWORD(lp))
+#define MPostWM_DDE_UNADVISE(hTo, hFrom, fmt, aItem) \
+ MPostDDEMsg(hTo, WM_DDE_UNADVISE, hFrom, (UINT)fmt, (UINT)aItem)
+
+#define MPostWM_DDE_TERMINATE(hTo, hFrom) \
+ PostMessage(hTo, WM_DDE_TERMINATE, (WPARAM)hFrom, 0L)
+
+
+/*-----------------------------------GDI-------------------------------------*/
+
+BOOL WINAPI MGetAspectRatioFilter(HDC hdc, INT * pcx, INT * pcy);
+BOOL WINAPI MGetBitmapDimension(HANDLE hBitmap, INT * pcx, INT *pcy);
+BOOL WINAPI MGetBrushOrg(HDC hdc, INT * px, INT * py);
+BOOL WINAPI MGetCurrentPosition(HDC hdc, INT * px, INT * py);
+BOOL WINAPI MGetTextExtent(HDC hdc, LPSTR lpstr, INT cnt, INT *pcx, INT *pcy);
+BOOL WINAPI MGetViewportExt(HDC hdc, INT * pcx, INT * pcy);
+BOOL WINAPI MGetViewportOrg(HDC hdc, INT * px, INT * py);
+BOOL WINAPI MGetWindowExt(HDC hdc, INT * pcx, INT * pcy);
+BOOL WINAPI MGetWindowOrg(HDC hdc, INT * px, INT * py);
+HANDLE WINAPI MGetMetaFileBits(HMETAFILE hmf);
+HMETAFILE WINAPI MSetMetaFileBits(HANDLE h);
+
+#define MCreateDiscardableBitmap(h, x, y) CreateCompatibleBitmap(h, (DWORD)(x), (DWORD)(y))
+#define MMoveTo(hdc, x, y) MoveToEx(hdc, x, y, NULL)
+#define MOffsetViewportOrg(hdc, x, y) OffsetViewportOrgEx(hdc, x, y, NULL)
+#define MOffsetWindowOrg(hdc, x, y) OffsetWindowOrgEx(hdc, x, y, NULL)
+#define MScaleViewportExt(hdc, x, y, xd, yd) ScaleViewportExtEx(hdc, x, y, xd, yd, NULL)
+#define MScaleWindowExt(hdc, x, y, xd, yd) ScaleWindowExtEx(hdc, x, y, xd, yd, NULL)
+#define MSetBitmapDimension(hbm, x, y) SetBitmapDimensionEx(hbm, (DWORD)(x), (DWORD)(y), NULL)
+#define MSetBrushOrg(hbm, x, y) SetBrushOrgEx(hbm, x, y, NULL)
+#define MSetViewportExt(hdc, x, y) SetViewportExtEx(hdc, x, y, NULL)
+#define MSetViewportOrg(hdc, x, y) SetViewportOrgEx(hdc, x, y, NULL)
+#define MSetWindowExt(hdc, x, y) SetWindowExtEx(hdc, x, y, NULL)
+#define MSetWindowOrg(hdc, x, y) SetWindowOrgEx(hdc, x, y, NULL)
+
+/* Removed APIs */
+
+#define MUnrealizeObject(h) ((h), TRUE)
+
+/*-------------------------------------DEV-----------------------------------*/
+
+DWORD WINAPI MDeviceCapabilities(LPSTR lpDriverName, LPSTR lpDeviceName,
+ LPSTR lpPort, WORD2DWORD nIndex, LPSTR lpOutput, LPDEVMODE lpDevMode);
+BOOL WINAPI MDeviceMode(HWND hWnd, LPSTR lpDriverName, LPSTR lpDeviceName, LPSTR lpOutput);
+WORD2DWORD WINAPI MExtDeviceMode(HWND hWnd,LPSTR lpDriverName,
+ LPDEVMODE lpDevModeOutput, LPSTR lpDeviceName, LPSTR lpPort,
+ LPDEVMODE lpDevModeInput, LPSTR lpProfile, WORD2DWORD flMode);
+
+/*-----------------------------------KERNEL----------------------------------*/
+
+HFILE WINAPI MDupHandle(HFILE h);
+BOOL WINAPI MFreeDOSEnvironment(LPSTR lpEnv);
+HANDLE WINAPI MGetInstHandle(VOID);
+LPSTR WINAPI MGetDOSEnvironment(VOID);
+WORD WINAPI MGetDriveType(INT nDrive);
+BYTE WINAPI MGetTempDrive(BYTE cDriveLtr);
+INT WINAPI MGetTempFileName(BYTE cDriveLtr, LPSTR lpstrPrefix, WORD wUnique, LPSTR lpTempFileName);
+INT WINAPI MReadComm(HFILE nCid, LPSTR lpBuf, INT nSize);
+INT WINAPI MWriteComm(HFILE nCid, LPSTR lpBuf, INT nSize);
+
+
+#define GETMAJORVERSION(x) ((x)&0xff)
+#define GETMINORVERSION(x) (((x)>>8)&0xff)
+
+/* FUNCTION MAPPINGS */
+
+#define GetInstanceData(hPrevInst, pbuf, cb) (cb)
+#define MOpenComm(lpstr, wqin, wqout) (wqin), (wqout), CreateFile(lpstr, \
+ GENERIC_READ | GENERIC_WRITE, 0, \
+ NULL, \
+ OPEN_EXISTING | TRUNCATE_EXISTING, \
+ FILE_FLAG_WRITE_THROUGH, 0)
+
+#define MSetCommState(h, lpDCB) SetCommState((HANDLE)h, lpDCB)
+#define MCloseComm(h) (INT)!CloseHandle((HANDLE)h)
+#define MDllSharedAlloc(dwFlags, dwBytes) GlobalAlloc(GMEM_DDESHARE | dwFlags, dwBytes)
+#define MDllSharedFlags(hMem) GlobalFlags(hMem)
+#define MDllSharedFree GlobalFree
+#define MDllSharedHandle GlobalHandle
+#define MDllSharedLock GlobalLock
+#define MDllSharedRealloc(hMem, dwBytes, dwFlags) \
+ GlobalReAlloc(hMem, dwBytes, dwFlags)
+#define MDllSharedSize GlobalSize
+#define MDllSharedUnlock GlobalUnlock
+#define MGetCurrentTask GetCurrentThreadId
+#define MGetModuleUsage(h) ((h), 1)
+#define MGetWinFlags() WF_PMODE
+#define MLoadLibrary(lpsz) LoadLibrary(lpsz)
+#define MLocalInit(w, p1, p2) ((w),(p1),(p2),TRUE)
+#define MLockData(dummy)
+#define MUnlockData(dummy)
+#define M_lclose(fh) _lclose((HFILE)fh)
+#define M_lcreat (HFILE)_lcreat
+#define MOpenFile (HFILE)OpenFile
+#define M_llseek(fh, lOff, iOrg) SetFilePointer((HANDLE)fh, lOff, NULL, (DWORD)iOrg)
+#define MDeleteFile DeleteFile
+#define M_lopen (HFILE)_lopen
+#define M_lread(fh, lpBuf, cb) _lread((HFILE)fh, lpBuf, cb)
+#define M_lwrite(fh, lpBuf, cb) _lwrite((HFILE)fh, lpBuf, cb)
+
+#define MCatch setjmp
+#define MThrow longjmp
+
diff --git a/private/utils/ntbackup/exchange/build/inc/uiexport.h b/private/utils/ntbackup/exchange/build/inc/uiexport.h
new file mode 100644
index 000000000..6bd0b59f4
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/uiexport.h
@@ -0,0 +1,132 @@
+/**********************************************************************/
+/** Microsoft Windows NT **/
+/** Copyright(c) Microsoft Corp., 1992 **/
+/**********************************************************************/
+
+/*
+ uiexport.h
+
+ Prototypes for Net UI exported APIs
+
+
+
+ FILE HISTORY:
+ Johnl 17-Apr-1992 Created
+
+*/
+
+#ifndef _UIEXPORT_H_
+#define _UIEXPORT_H_
+
+
+/* Selections the user can make in the System focus dialog
+ */
+
+/* Low word of the selection type
+ */
+#define FOCUSDLG_DOMAINS_ONLY (1)
+#define FOCUSDLG_SERVERS_ONLY (2)
+#define FOCUSDLG_SERVERS_AND_DOMAINS (3)
+
+/* High word of the selection type contains a bitmask indicating
+ * which domains to display in the dialog.
+ * WARNING: This bitmask are shifted up 16 bits from the bitmask in
+ * \nt\private\net\ui\common\h\domenum.h. If you want to
+ * modify the values of the bitmask, you will need to
+ * make corresponding changes to domenum.h.
+ *
+ */
+
+#define FOCUSDLG_BROWSE_LOGON_DOMAIN 0x00010000
+#define FOCUSDLG_BROWSE_WKSTA_DOMAIN 0x00020000
+#define FOCUSDLG_BROWSE_OTHER_DOMAINS 0x00040000
+#define FOCUSDLG_BROWSE_TRUSTING_DOMAINS 0x00080000
+#define FOCUSDLG_BROWSE_WORKGROUP_DOMAINS 0x00100000
+
+/* Some handy combinations of flags.
+*/
+
+/* FOCUSDLG_BROWSE_LM2X_DOMAINS will return only the domains available
+ from a LanMan 2.x workstation. This returns just the logon,
+ workstation, and other domains. This is the default value.
+*/
+
+#define FOCUSDLG_BROWSE_LM2X_DOMAINS ( FOCUSDLG_BROWSE_LOGON_DOMAIN | \
+ FOCUSDLG_BROWSE_WKSTA_DOMAIN | \
+ FOCUSDLG_BROWSE_OTHER_DOMAINS )
+
+/*
+ FOCUSDLG_BROWSE_LOCAL_DOMAINS will return only the domains available
+ to the local machine. This returns the logon, workstation,
+ and other, plus the domains that trust "us".
+*/
+
+#define FOCUSDLG_BROWSE_LOCAL_DOMAINS ( FOCUSDLG_BROWSE_LM2X_DOMAINS | \
+ FOCUSDLG_BROWSE_TRUSTING_DOMAINS )
+
+/*
+ FOCUSDLG_BROWSE_ALL_DOMAINS is a conglomeration of all potential domain
+ sources available to the domain enumerator.
+*/
+
+#define FOCUSDLG_BROWSE_ALL_DOMAINS ( FOCUSDLG_BROWSE_LOCAL_DOMAINS | \
+ FOCUSDLG_BROWSE_WORKGROUP_DOMAINS )
+
+/*******************************************************************
+
+ NAME: I_SystemFocusDialog
+
+ SYNOPSIS: Presents a dialog to the user from which a server or domain
+ maybe selected.
+
+ ENTRY: hwndOwner - Parent window handle
+ nSelectionType - The type of selection the user is allowed
+ to make
+ pszName - The server or domain name. It will be
+ undefined if the user hits the CANCEL
+ button ( pfOK = FALSE )
+ cchBufSize - The buffer size of the lptstrName.
+ pfUserQuit - If the user hits the OKAY button, it will
+ return TRUE. Otherwise, it will return FALSE.
+ pszHelpFile - The helpfile to use when the user hits F1.
+ If NULL, the default helpfile is used.
+ nHelpContext - The helpcontext to use for the helpfile above.
+ If the above is NULL, this must be 0 (& vice
+ versa).
+
+ EXIT: if *pfOKPressed is TRUE (and an error didn't occur), then
+ lptstrName will be filled with the user selected name.
+
+ RETURNS: NO_ERROR on success, standard ERROR_* error code otherwise
+
+ NOTES: This will be a UNICODE only API when the net group goes UNICODE
+
+ HISTORY:
+ JohnL 22-Apr-1992 Added selection option, exported to private\inc
+ ChuckC 03-Nov-1992 Added helpfile & help context
+
+********************************************************************/
+
+UINT FAR PASCAL I_SystemFocusDialog(
+ HWND hwndOwner,
+ UINT nSelectionType,
+ LPWSTR pszName,
+ UINT cchBufSize,
+ BOOL *pfOKPressed,
+ LPWSTR pszHelpFile,
+ DWORD nHelpContext
+ );
+
+typedef UINT (FAR PASCAL *LPFNI_SYSTEMFOCUSDIALOG)(
+ HWND hwndOwner,
+ UINT nSelectionType,
+ LPWSTR pszName,
+ UINT cchBufSize,
+ BOOL *pfOKPressed,
+ LPWSTR pszHelpFile,
+ DWORD nHelpContext
+ );
+
+
+
+#endif //_UIEXPORT_H_
diff --git a/private/utils/ntbackup/exchange/build/inc/warning.h b/private/utils/ntbackup/exchange/build/inc/warning.h
new file mode 100644
index 000000000..a15603981
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/inc/warning.h
@@ -0,0 +1,22 @@
+#pragma warning(3:4092) // sizeof returns 'unsigned long'
+#pragma warning(3:4121) // structure is sensitive to alignment
+#pragma warning(3:4125) // decimal digit in octal sequence
+#pragma warning(3:4130) // logical operation on address of string constant
+#pragma warning(3:4132) // const object should be initialized
+#pragma warning(4:4206) // Source File is empty
+#pragma warning(4:4101) // Unreferenced local variable
+#pragma warning(4:4208) // delete[exp] - exp evaluated but ignored
+#pragma warning(3:4212) // function declaration used ellipsis
+#pragma warning(error:4700) // Local used w/o being initialized
+#pragma warning(error:4259) // pure virtual function was not defined
+#pragma warning(4:4509) // use of SEH with destructor
+#pragma warning(4:4177) // pragma data_seg s/b at global scope
+
+#if 0
+#pragma warning(3:4100) // Unreferenced formal parameter
+#pragma warning(3:4701) // local may be used w/o init
+#pragma warning(3:4702) // Unreachable code
+#pragma warning(3:4705) // Statement has no effect
+#pragma warning(3:4706) // assignment w/i conditional expression
+#pragma warning(3:4709) // command operator w/o index expression
+#endif
diff --git a/private/utils/ntbackup/exchange/build/makefile.def b/private/utils/ntbackup/exchange/build/makefile.def
new file mode 100644
index 000000000..7f7c14429
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/makefile.def
@@ -0,0 +1,2047 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ makefile.def
+
+Abstract:
+
+ This is the standard makefile for the components of the NT project.
+ It includes the following files:
+
+ .\sources. - developer supplies this file. It defines the
+ required TARGETNAME, TARGETPATH, TARGETTYPE and
+ SOURCES as well as optional macros that control
+ the behavior of the compiler and linker:
+
+ obj\_objects.mac - built by BUILD.EXE from .\sources.
+
+
+Targets:
+
+ all - Builds all targets in this make file
+
+ clean - Erase all targets that can be produced by this make
+ file, ignoring errors. Also rebuilds the depend target.
+
+ depend - Rebuilts source file dependencies, using BUILD.EXE tool
+
+Author:
+
+ Steve Wood (stevewo) 28-Feb-1989
+
+
+Revision History:
+ Reza Baghai (rezab) 25-Jan-1993
+ Added -order:*.prf switch for building EXEs
+ Added $(PERFLIBS) to *_LINKLIBS lines to allow linking with
+ optional performance tuning libraries
+ Sudeep Bharati (sudeepb) 10-Dec-1991
+ Added PROGLIB target type, so that NTVDM can export
+ interfaces from an EXE.
+
+ Roger Lanser (a-rlansr) 27-Apr-1993
+ Added MIPS C8 compiler and attempted to generalize variables
+ between the MIPS and INTEL version of C8.
+ Oh yes, removed last remnants of DECSTATION.
+
+Useful Variables Set:
+
+ CPUTYPE={I386|MIPS|ALPHA|PPC}
+
+Optional Controls Variables (partial list), these are environment variables,
+remember they can be set with env=value on the command line as well:
+
+NOTE: xxx_... is {MSC|386|mips|alpha|PPC} where MSC_ applies to the C8 compiler
+ independent of the cpu type. Specific cpu_ will take precedence
+ over the equivalent MSC_ variable.
+
+EXAMPLE: To compile with codeview symbols for windbg:
+
+ set NTDEBUG=ntsd
+ set NTDEBUGTYPE=windbg
+ set MSC_OPTIMIZATION=/Od
+
+
+ nttest=filename
+
+ umtest=filename
+
+ umappl=filename
+
+ NT_UP
+ Define as 0 in environment to turn on MP.
+ If undefined or equal to 1, you get UP.
+
+ xxx_warning_level
+
+ xxx_optimization
+
+ xxx_STDCALL = 1 use _stdcall calling convention
+ 0 use _cdecl calling convention
+
+ ntdebug
+
+ browser_info
+
+ xxx_cppflags
+
+ ntcppflags
+
+ NT_INST - set to turn on instrumentation
+
+ BASEDIR - \nt or \ntrel (default \nt)
+
+ PRECOMPILED_CXX=1 - do precompiled headers for CXX instead of C files
+ note: precompiled headers can not be used on both
+ c and cxx files in a single directory.
+
+ pnp_power=1 | 0 | <empty>
+
+!ENDIF
+
+!if 0
+!message You must use nmake version 1.30 or greater...
+!endif
+
+#
+# IDL/RDL/TDL build rules.
+#
+
+!ifdef IDL_RULES
+IDL_OUT_DIR =.
+IDL_HDR_OUT_DIR =.
+RDL_OUT_DIR =.
+RDL_HDR_OUT_DIR =.
+
+!ifndef MIDL_INCS
+MIDL_INCS = obj\$(TARGET_DIRECTORY)
+!endif
+
+!ifndef MC_OUT_DIR
+MC_OUT_DIR = obj\$(TARGET_DIRECTORY)
+!endif
+!endif
+
+
+#
+# Select build target and set platform specific variables.
+#
+
+!INCLUDE makefile.plt
+
+#
+# Include the developer supplied file that defines the TARGETNAME, TARGETPATH,
+# TARGETTYPE and SOURCES macros. Make sure it defines them.
+#
+
+!INCLUDE .\sources.
+SOURCES_USED=$(SOURCES_USED) .\sources
+
+#
+# Attempt to include the sources file from the target subdirectory.
+#
+
+!IF EXIST(.\$(TARGET_DIRECTORY)\sources.)
+!INCLUDE .\$(TARGET_DIRECTORY)\sources.
+SOURCES_USED=$(SOURCES_USED) .\$(TARGET_DIRECTORY)\sources.
+!ENDIF
+
+#
+# Attempt to include the sources file from the parent target subdirectory.
+#
+
+!IF EXIST(..\$(TARGET_DIRECTORY)\sources.)
+!INCLUDE ..\$(TARGET_DIRECTORY)\sources.
+SOURCES_USED=$(SOURCES_USED) ..\$(TARGET_DIRECTORY)\sources.
+!ENDIF
+
+!IF "$(_NT_LEGO_ON_THIS_MACHINE)" == ""
+!UNDEF NTLEGO
+!ENDIF
+
+!IFNDEF TARGETPATH
+!ERROR Your .\sources. file must define the TARGETPATH= macro
+!ENDIF
+
+!IFNDEF TARGETTYPE
+!ERROR Your .\sources. file must define the TARGETTYPE= macro
+!ENDIF
+
+!IFNDEF TARGETNAME
+! IF "$(TARGETTYPE)" != "NOTARGET"
+!ERROR Your .\sources. file must define the TARGETNAME= macro
+! ELSE
+TARGETNAME=
+! ENDIF
+!ENDIF
+
+!IFNDEF SOURCES
+!ERROR Your .\sources. file must define the SOURCES= macro
+!ENDIF
+
+!IFNDEF UMTYPE
+UMTYPE=nt
+!ENDIF
+
+!IFNDEF UMBASE
+! IFDEF COFFBASE
+UMBASE=@..\exchange\build\coffbase.txt,$(COFFBASE)
+! ELSE
+UMBASE=@..\exchange\build\coffbase.txt,usermode
+! ENDIF
+!ENDIF
+
+LINKLIBS=$(LINKLIBS) $(PERFLIBS)
+
+!IF DEFINED(USE_MFC) || DEFINED(USE_MFCUNICODE)
+
+#---------------------------------------------------------#
+# this set of defines establishes the "correct" build #
+# environment for an app that needs to use MFC. the #
+# app's sources file only needs to specify USE_MFC=1 #
+# and this makefile will set the enviroment up correctly. #
+#---------------------------------------------------------#
+
+UMENTRY=winmain
+UMENTRYABS=
+USE_CRTDLL=1 # CRTDLL s/b used if MFC is.
+
+MFC_FLAGS=$(MFC_FLAGS) -D_AFXDLL -D_AFX_NOFORCE_LIBS
+!IF "$(NTDEBUG)" == "retail" || "$(NTDEBUG)" == "" || "$(NTDEBUG)" == "ntsdnodbg"
+!IFDEF USE_MFCUNICODE
+MFC_LIBS=$(BASEDIR)\public\sdk\lib\*\cfm30u.lib $(BASEDIR)\public\sdk\lib\*\cfmo30u.lib
+!ELSE
+MFC_LIBS=$(BASEDIR)\public\sdk\lib\*\cfm30.lib $(BASEDIR)\public\sdk\lib\*\cfmo30.lib
+!ENDIF
+MFC_FLAGS=$(MFC_FLAGS) -DNDEBUG
+!ELSE
+!IFDEF USE_MFCUNICODE
+MFC_LIBS=$(BASEDIR)\public\sdk\lib\*\cfm30ud.lib $(BASEDIR)\public\sdk\lib\*\cfmo30ud.lib
+!ELSE
+MFC_LIBS=$(BASEDIR)\public\sdk\lib\*\cfm30d.lib $(BASEDIR)\public\sdk\lib\*\cfmo30d.lib
+!ENDIF
+MFC_FLAGS=$(MFC_FLAGS) -D_DEBUG
+USE_PDB=1
+!ENDIF
+
+!IFDEF USE_MFCUNICODE
+UNICODE=1
+MFC_FLAGS=$(MFC_FLAGS) -DUNICODE -D_UNICODE
+!ENDIF
+
+MFC_INCLUDES=$(BASEDIR)\public\sdk\inc\mfc30
+
+LINKLIBS=$(LINKLIBS) $(MFC_LIBS)
+
+!ENDIF # USE_MFC || USE_MFCUNICODE
+
+!IFDEF USE_CRTDLL
+
+LIBC_LIB=crtdll.lib
+LIBC_DEFINES=-D_DLL=1 -D_MT=1
+
+!ELSE
+
+! IFDEF USE_MSVCRT
+LIBC_LIB=msvcrt.lib
+LIBC_DEFINES=-D_DLL=1 -D_MT=1
+
+!ELSE
+
+! IFDEF USE_LIBCMT
+LIBC_LIB=libcmt.lib
+LIBC_DEFINES=-D_MT=1
+
+! ELSE
+
+LIBC_LIB=libc.lib
+LIBC_DEFINES=
+
+! ENDIF
+! ENDIF
+!ENDIF
+
+
+!IFNDEF GPSIZE
+GPSIZE= 0
+!ENDIF
+
+!IFDEF CAIRO_PRODUCT
+CAIRO_LIB_PATH=$(BASEDIR)\public\sdk\lib\cairo\*
+!ENDIF # CAIRO_PRODUCT
+
+!ifdef NTLIBPATH
+LIBRARY_PATH = $(NTLIBPATH)\*\lib
+!else
+!ifdef CHICAGO_PRODUCT
+LIBRARY_PATH = $(BASEDIR)\public\sdk\lib\chicago\*
+!else
+LIBRARY_PATH = $(BASEDIR)\public\sdk\lib\*
+!endif
+!endif
+
+!ifndef NTLIBCPATH
+NTLIBCPATH=$(LIBRARY_PATH)
+!endif
+
+LIBC_LIB = $(NTLIBCPATH)\$(LIBC_LIB)
+
+NT_LIBS=$(LIBRARY_PATH)\ntdll.lib
+GUI32_LIBS=$(LIBRARY_PATH)\gdi32.lib \
+ $(LIBRARY_PATH)\user32.lib
+
+!IFDEF CAIRO_PRODUCT
+!IFNDEF TUKWILA
+NT_LIBS=$(NT_LIBS:lib\*\ntdll.lib=lib\cairo\*\ntdll.lib)
+!ENDIF
+GUI32_LIBS=$(GUI32_LIBS:lib\*\user32.lib=lib\cairo\*\user32.lib)
+!ENDIF
+
+CRT_LIBS=
+
+NT_CRT=$(LIBRARY_PATH)\nt.lib
+WIN32_LIBS=$(LIBC_LIB) \
+ $(LIBRARY_PATH)\advapi32.lib \
+ $(LIBRARY_PATH)\kernel32.lib
+
+NTSS_LIBS=$(NT_LIBS) $(NT_CRT) $(BASEDIR)\public\sdk\lib\*\smdll.lib
+
+OS2_LIBS=$(NT_LIBS) $(BASEDIR)\public\sdk\lib\*\os2dll.lib \
+ $(CRT_LIBS)
+
+POSIX_LIBS=$(NT_LIBS) $(BASEDIR)\public\sdk\lib\*\libcpsx.lib \
+ $(BASEDIR)\public\sdk\lib\*\psxdll.lib \
+ $(BASEDIR)\public\sdk\lib\*\psxrtl.lib
+
+!ifndef SUBSYSTEM_VERSION
+! ifndef EXPECTED_WINVER
+! ifdef CAIRO_PRODUCT
+SUBSYSTEM_WINVER = ,4.00
+! else
+SUBSYSTEM_WINVER = ,3.51
+! endif
+! else
+SUBSYSTEM_WINVER = ,$(EXPECTED_WINVER)
+! endif
+SUBSYSTEM_CONVER = ,3.51
+SUBSYSTEM_OS2VER =
+SUBSYSTEM_POSIXVER =
+SUBSYSTEM_NATVER = ,3.51
+!else
+SUBSYSTEM_WINVER = ,$(SUBSYSTEM_VERSION)
+SUBSYSTEM_CONVER = ,$(SUBSYSTEM_VERSION)
+SUBSYSTEM_OS2VER = ,$(SUBSYSTEM_VERSION)
+SUBSYSTEM_POSIXVER = ,$(SUBSYSTEM_VERSION)
+SUBSYSTEM_NATVER = ,$(SUBSYSTEM_VERSION)
+!endif
+
+!IF "$(UMTYPE)" == "nt"
+SUBSYSTEM=native$(SUBSYSTEM_NATVER)
+UMINCL=$(BASEDIR)\public\sdk\inc\crt
+
+
+STD_CALL_ENTRY=1
+UMENTRY=-entry:NtProcessStartup
+
+UMLIBS=$(UMLIBS) $(NT_LIBS) $(NT_CRT) $(CRT_LIBS)
+
+!ELSE
+! IF "$(UMTYPE)" == "windows"
+SUBSYSTEM=windows$(SUBSYSTEM_WINVER)
+UMINCL=$(BASEDIR)\public\sdk\inc\crt
+
+! IF "$(UMENTRY)" == "winmain"
+UMENTRY=-entry:WinMainCRTStartup
+! ELSE
+! IF "$(UMENTRYABS)" == ""
+UMENTRY=-entry:mainCRTStartup
+! ELSE
+UMENTRY=-entry:$(UMENTRYABS)
+! ENDIF
+! ENDIF
+
+#UMLIBS=$(UMLIBS) $(WIN32_LIBS) $(GUI32_LIBS)
+
+! ELSE
+! IF "$(UMTYPE)" == "console"
+SUBSYSTEM=console$(SUBSYSTEM_CONVER)
+UMINCL=$(BASEDIR)\public\sdk\inc\crt
+
+! IF "$(UMENTRY)" == "winmain"
+UMENTRY=-entry:WinMainCRTStartup
+! ELSE
+UMENTRY=-entry:mainCRTStartup
+! ENDIF
+
+UMLIBS=$(UMLIBS) $(WIN32_LIBS)
+
+! ELSE
+! IF "$(UMTYPE)" == "ntss"
+SUBSYSTEM=native$(SUBSYSTEM_NATVER)
+UMINCL=$(BASEDIR)\public\sdk\inc\crt
+
+STD_CALL_ENTRY=1
+UMENTRY=-entry:NtProcessStartup
+
+UMLIBS=$(UMLIBS) $(NTSS_LIBS) $(CRT_LIBS)
+
+! ELSE
+! IF "$(UMTYPE)" == "os2"
+SUBSYSTEM=os2$(SUBSYSTEM_OS2VER)
+UMINCL=$(BASEDIR)\public\sdk\inc\os2;$(BASEDIR)\public\sdk\inc\crt
+
+STD_CALL_ENTRY=1
+UMENTRY=-entry:NtProcessStartup
+
+UMLIBS=$(UMLIBS) $(OS2_LIBS)
+
+! ELSE
+! IF "$(UMTYPE)" == "posix"
+SUBSYSTEM=posix$(SUBSYSTEM_POSIXVER)
+UMINCL=$(BASEDIR)\public\sdk\inc\posix;$(BASEDIR)\public\sdk\inc\crt
+
+UMENTRY=-entry:__PosixProcessStartup
+
+UMLIBS=$(UMLIBS) $(POSIX_LIBS)
+
+! ELSE
+! ERROR Invalid UMTYPE value - $(UMTYPE)
+! ENDIF # UMTYPE == posix
+! ENDIF # UMTYPE == os2
+! ENDIF # UMTYPE == ntss
+! ENDIF # UMTYPE == console
+! ENDIF # UMTYPE == windows
+!ENDIF # UMTYPE == nt
+
+
+#
+# If you edit this line you need to modify $(BASEDIR)\private\sdktools\build\build.c
+#
+
+!IFDEF NTINCPATH
+NTINCLUDES=$(BASEDIR)\public\oak\inc;$(NTINCPATH)\$(TARGET_DIRECTORY)\inc
+!ELSE
+NTINCLUDES=$(BASEDIR)\public\oak\inc;$(BASEDIR)\public\sdk\inc
+!ENDIF
+
+!IFNDEF COMPILER_WARNINGS
+COMPILER_WARNINGS=-FI$(BASEDIR)\public\sdk\inc\warning.h
+!ENDIF
+
+!IFDEF CAIRO_PRODUCT
+NTINCLUDES=$(BASEDIR)\private\cinc;$(BASEDIR)\public\sdk\inc\cairo;$(NTINCLUDES)
+!IFDEF NOT_UNICODE
+WIN32_DEFINE=-DWIN32=300 -D_CAIRO_=300
+!ELSE
+WIN32_DEFINE=-DWIN32=300 -D_CAIRO_=300 -DUNICODE -D_UNICODE
+!ENDIF
+
+!ELSE
+
+!IFDEF CHICAGO_PRODUCT
+NTINCLUDES=$(BASEDIR)\private\cinc;$(BASEDIR)\public\sdk\inc\chicago;$(BASEDIR)\public\sdk\inc\chicago\crt;$(NTINCLUDES)
+WIN32_DEFINE=-DWIN32=200 -DFLAT -D_CHICAGO_=200
+
+LINKER_FLAGS=$(LINKER_FLAGS) -map
+
+!ELSE
+WIN32_DEFINE=-DWIN32=100 -D_NT1X_=100
+CAIRO_LIB_PATH=$(BASEDIR)\public\sdk\lib
+!ENDIF
+
+!ENDIF
+
+INCLUDES =$(INCLUDES: =)
+NTINCLUDES =$(NTINCLUDES: =)
+UMINCL =$(UMINCL: =)
+
+!IFDEF USER_INCLUDES
+USER_INCLUDES =$(USER_INCLUDES: =)
+USER_INCL0=-I$(USER_INCLUDES)
+USER_INCL1=-I$(USER_INCLUDES)
+!ELSE
+USER_INCL0=
+USER_INCL1=
+!ENDIF
+
+!IFDEF INCLUDES
+INCL=$(INCLUDES)
+INCPATH0=$(USER_INCL0:;= -I) -I$(INCL:;= -I) -I$(NTINCLUDES:;= -I) -I$(UMINCL:;= -I)
+INCPATH1=$(USER_INCL1:;= -I) -I$(INCL:;= -I) -I$(NTINCLUDES:;= -I) -I$(UMINCL:;= -I)
+!ELSE
+INCPATH0=$(USER_INCL0:;= -I) -I$(NTINCLUDES:;= -I) -I$(UMINCL:;= -I)
+INCPATH1=$(USER_INCL1:;= -I) -I$(NTINCLUDES:;= -I) -I$(UMINCL:;= -I)
+!ENDIF
+
+INCPATH0=$(INCPATH0:-I =)
+INCPATH1=$(INCPATH1:-I =)
+
+!IFDEF MFC_INCLUDES
+MFC_INCLUDES=$(MFC_INCLUDES: =)
+MFC_INCLUDES=-I$(MFC_INCLUDES:;= -I)
+INCPATH0=$(MFC_INCLUDES) $(INCPATH0)
+INCPATH1=$(MFC_INCLUDES) $(INCPATH1)
+!ENDIF
+
+!IFNDEF RELATIVE_DEPTH
+RELATIVE_DEPTH=..\..
+!ENDIF
+
+!IFNDEF DLLENTRY
+DLLENTRY=-noentry
+!ELSE
+DLLENTRY=-entry:$(DLLENTRY)
+!ENDIF
+
+!IFNDEF DLLBASE
+DLLBASE=@$(BASEDIR)\PUBLIC\SDK\LIB\coffbase.txt,$(TARGETNAME)
+!ENDIF
+
+!IFNDEF DLLDEF
+DLLDEF=$(@B).def
+!ENDIF
+
+!IFNDEF BOOTBASE
+! IFDEF FRAZZLE
+BOOTBASE=0xd0100000,0xd0104000
+! ELSE
+BOOTBASE=0xd0ff0000,0xd0ff4000
+! ENDIF
+!ENDIF
+
+DRIVERBASE=0x10000
+HALBASE=0x80400000
+
+#
+# Map lower case to upper case for variables that can be specified from the
+# command line.
+#
+
+!IFDEF nttest
+NTTEST=$(nttest)
+!ENDIF
+
+!IFDEF makedll
+MAKEDLL=$(makedll)
+!ENDIF
+
+!IFDEF umtest
+UMTEST=$(umtest)
+!ENDIF
+
+
+#
+# Include the list of object files (defined as the OBJECTS macro) that was
+# built by BUILD program, using the SOURCES= macro defined in the sources.
+# file. Use macro substitution to build the supported target objects.
+#
+
+!INCLUDE obj\_objects.mac
+
+!IF $(386)
+OBJECTS=$(386_OBJECTS)
+DLLLIBOBJECTS=$(386_DLLLIBOBJECTS)
+!ELSEIF $(MIPS)
+OBJECTS=$(MIPS_OBJECTS)
+DLLLIBOBJECTS=$(MIPS_DLLLIBOBJECTS)
+!ELSEIF $(ALPHA)
+OBJECTS=$(ALPHA_OBJECTS)
+DLLLIBOBJECTS=$(ALPHA_DLLLIBOBJECTS)
+!ELSEIF $(PPC)
+OBJECTS=$(PPC_OBJECTS)
+DLLLIBOBJECTS=$(PPC_DLLLIBOBJECTS)
+!ENDIF
+
+#
+# BUILD.EXE defines the NOLINK variable to disable the building of any
+# test executables when it is recursing on a dirs. file to build components
+# in subdirectories.
+#
+
+!IF "$(BUILDMSG)" != "Stop."
+! IFDEF NOLINK
+! UNDEF NTTEST
+! UNDEF MAKEDLL
+! ELSE
+! IFDEF nolink
+! UNDEF NTTEST
+! UNDEF MAKEDLL
+! ENDIF
+! ENDIF # DEF NOLINK
+!ENDIF # BUILDMSG != "Stop."
+
+
+#
+# Determine type of target link we are doing
+#
+!IF "$(TARGETTYPE)" == "PROGLIB"
+TARGETEXT=exe
+TARGETLIB=
+!ELSE
+! IF "$(TARGETTYPE)" == "PROGRAM"
+TARGETEXT=exe
+TARGETLIB=
+! ELSE
+! IF "$(TARGETTYPE)" == "DYNLINK"
+
+DYNLINK_LIB=$(TARGETPATH)\*\$(TARGETNAME).lib
+
+! IF "$(MAKEDLL)" != ""
+! IF "$(UMTYPE)" == "os2"
+TARGETLIB=$(BASEDIR)\public\sdk\lib\*\ntdll.lib
+! ELSE
+! IF "$(UMTYPE)" == "posix"
+TARGETLIB=$(BASEDIR)\public\sdk\lib\*\libcpsx.lib $(BASEDIR)\public\sdk\lib\*\ntdll.lib $(CRT_LIBS)
+! ELSE
+! IF "$(TARGETNAME)" == "ntdll"
+TARGETLIB=
+! ELSE
+! IFDEF USE_CRTDLL
+! IFDEF CHICAGO_PRODUCT
+TARGETLIB=$(WIN32DLL_LIBS) $(BASEDIR)\public\sdk\lib\*\crtdll.lib
+! ELSE
+TARGETLIB=$(WIN32DLL_LIBS) $(BASEDIR)\public\sdk\lib\*\crtdll.lib $(BASEDIR)\public\sdk\lib\*\ntdll.lib
+! ENDIF
+! ELSE
+! IFDEF USE_MSVCRT
+TARGETLIB=$(WIN32DLL_LIBS) $(LIBC_LIB)
+! ELSE
+TARGETLIB=$(WIN32DLL_LIBS) $(BASEDIR)\public\sdk\lib\*\ntdll.lib $(CRT_LIBS)
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+! IF "$(TARGETEXT)" == ""
+TARGETEXT=dll
+! ENDIF
+! IFDEF CAIROLIB
+
+#
+# If we are linking a DLL then add in the cairo libs.
+#
+
+TARGETLIB=$(CAIROLIB) $(TARGETLIB)
+! ENDIF
+! IFDEF CAIRO_PRODUCT
+! IFNDEF TUKWILA
+TARGETLIB=$(TARGETLIB:lib\*\ntdll.lib=lib\cairo\*\ntdll.lib)
+! ENDIF
+! ENDIF
+! ELSE # "$(MAKEDLL)" != ""
+TARGETEXT=lib
+TARGETLIB=
+! ENDIF # "$(MAKEDLL)" != ""
+! ELSE
+! IF "$(TARGETTYPE)" == "LIBRARY"
+TARGETEXT=lib
+TARGETLIB=
+! ELSE
+! IF "$(TARGETTYPE)" == "DRIVER"
+TARGETEXT=sys
+TARGETLIB=$(BASEDIR)\public\sdk\lib\*\ntoskrnl.lib $(BASEDIR)\public\sdk\lib\*\hal.lib $(CRT_LIBS)
+! ELSE
+! IF "$(TARGETTYPE)" == "EXPORT_DRIVER"
+! IF "$(MAKEDLL)" != ""
+TARGETEXT=sys
+TARGETLIB=$(BASEDIR)\public\sdk\lib\*\ntoskrnl.lib $(BASEDIR)\public\sdk\lib\*\hal.lib $(CRT_LIBS)
+! ELSE
+TARGETEXT=lib
+TARGETLIB=
+! ENDIF
+! ELSE
+! IF "$(TARGETTYPE)" == "HAL"
+! IF "$(MAKEDLL)" != ""
+TARGETEXT=dll
+TARGETLIB=$(BASEDIR)\public\sdk\lib\*\ntoskrnl.lib $(CRT_LIBS)
+! ELSE
+TARGETEXT=lib
+TARGETLIB=
+! ENDIF
+! ELSE
+! IF "$(TARGETTYPE)" == "BOOTPGM"
+TARGETEXT=sys
+! ELSE
+! IF "$(TARGETTYPE)" == "MINIPORT"
+TARGETEXT=sys
+! ELSE
+! IF "$(TARGETTYPE)" == "GDI_DRIVER"
+TARGETEXT=dll
+TARGETLIB=$(BASEDIR)\public\sdk\lib\km\*\win32k.lib
+! ENDIF # TARGETTYPE == GDI_DRIVER
+! ENDIF # TARGETTYPE == MINIPORT
+! ENDIF # TARGETTYPE == BOOTPGM
+! ENDIF # TARGETTYPE == HAL
+! ENDIF # TARGETTYPE == EXPORT_DRIVER
+! ENDIF # TARGETTYPE == DRIVER
+! ENDIF # TARGETTYPE == LIBRARY
+! ENDIF # TARGETTYPE == DYNLINK
+! ENDIF # TARGETTYPE == PROGRAM
+!ENDIF # TARGETTYPE == PROGLIB
+
+
+TARGET=
+
+!IF "$(TARGETTYPE)" != "UMAPPL_NOLIB"
+
+! IF "$(OBJECTS)" != ""
+TARGET=$(TARGETPATH)\*\$(TARGETNAME).$(TARGETEXT)
+! ENDIF
+
+!ENDIF # TARGETTYPE != UMAPPL_NOLIB
+
+!IFNDEF MACHINE_TARGETLIBS
+MACHINE_TARGETLIBS=$(TARGETLIB) $(TARGETLIBS)
+!ENDIF
+
+
+TARGETOBJFILES=$(TARGETOBJFILES) $(OBJECTS)
+
+!IF "$(NOLINK)" == "" || \
+ ("$(NOLINK)" != "" && ("$(TARGETTYPE)"=="LIBRARY" || \
+ ( ("$(TARGETTYPE)"=="DYNLINK" || \
+ "$(TARGETTYPE)"=="PROGLIB" || \
+ "$(TARGETTYPE)"=="EXPORT_DRIVER" || \
+ "$(TARGETTYPE)"=="HAL") && \
+ "$(MAKEDLL)" == "") \
+ ) \
+ )
+
+
+!IF "$(NOLINK)" != "" && "$(TARGET)" != ""
+TARGETLIBFILES=$(TARGETLIBFILES) $(TARGETPATH)\*\$(TARGETNAME).lib
+!ELSE
+TARGETEXEFILES=$(TARGETEXEFILES) $(TARGET)
+!ENDIF
+
+!ENDIF # NOLINK == "" || building .lib file for dll
+
+!IF "$(NTTEST)" != ""
+
+TARGETOBJFILES=$(TARGETOBJFILES) obj\*\$(NTTEST).obj
+
+! IFNDEF NOLINK
+
+TARGETEXEFILES=$(TARGETEXEFILES) obj\*\$(NTTEST).exe
+
+! ENDIF # NDEF NOLINK
+!ENDIF # NTTEST != ""
+
+UMOBJFILES=
+UMEXEFILES=
+
+!IF "$(UMAPPLEXT)" == ""
+! IFDEF _DOT_COM_FILE
+UMAPPLEXT=.com
+! ELSE
+UMAPPLEXT=.exe
+! ENDIF
+!ENDIF
+
+!IF "$(UMAPPL)" != ""
+
+UMOBJFILES=obj\*\$(UMAPPL:*=.obj obj\*\).obj
+
+
+! IF "$(UMAPPLEXT)" == ".com"
+! IFNDEF NOLINK
+
+UMEXEFILES=obj\*\$(UMAPPL:*=.com obj\*\).com
+! ENDIF
+! ELSE
+! IF "$(UMAPPLEXT)" == ".exe"
+! IFNDEF NOLINK
+
+UMEXEFILES=obj\*\$(UMAPPL:*=.exe obj\*\).exe
+! ENDIF
+! ELSE
+
+! IF "$(UMAPPLEXT)" == ".scr"
+! IFNDEF NOLINK
+
+UMEXEFILES=obj\*\$(UMAPPL:*=.scr obj\*\).scr
+
+! ENDIF
+
+! ELSE
+
+! ERROR Unsupport UMAPPLEXT = $(UMAPPLEXT)
+
+! ENDIF # UMAPPLEXT == .scr
+! ENDIF # UMAPPLEXT == .exe
+! ENDIF # UMAPPLEXT == .com
+!ENDIF # UMAPPL != ""
+
+!IF "$(UMTEST)" != ""
+
+UMOBJFILES=$(UMOBJFILES) obj\*\$(UMTEST:*=.obj obj\*\).obj
+
+! IFNDEF NOLINK
+
+UMEXEFILES=$(UMEXEFILES) obj\*\$(UMTEST:*=.exe obj\*\).exe
+
+! ENDIF
+!ENDIF
+
+#
+# Define NT_UP as 0 in environment to turn on MP.
+# If undefined or equal to 1, you get UP.
+#
+
+!IFNDEF NT_UP
+NT_UP=1
+!ENDIF
+
+!IF "$(NT_UP)"=="0"
+NT_UP_DEFINES=
+!ELSE
+NT_UP_DEFINES=-DNT_UP=1
+!ENDIF
+
+!IFNDEF NT_INST
+NT_INST=0
+!ENDIF
+
+!IFNDEF PNP_POWER
+PNP_POWER=0
+!ENDIF
+
+!IF "$(PNP_POWER)"=="0"
+NT_PNP_POWER_DEFINES=
+!ELSE
+NT_PNP_POWER_DEFINES=-D_PNP_POWER_=1
+!ENDIF
+
+
+#
+# User defined variables (environment variables or command line).
+# A cpu specific definition will take precedence over the MSC definition.
+#
+# xxx_WARNING_LEVEL
+# xxx_OPTIMIZATION
+# xxx_CPPFLAGS
+#
+
+!IFNDEF MSC_WARNING_LEVEL
+MSC_WARNING_LEVEL=/W3
+!ENDIF
+
+!IFNDEF MSC_OPTIMIZATION
+MSC_OPTFLAGS=/Oxs $(MSC_OPTIMIZATION)
+!ELSE
+MSC_OPTFLAGS=$(MSC_OPTIMIZATION)
+!ENDIF
+
+#
+# End of user defined variables.
+#
+
+!IFDEF NOT_LEAN_AND_MEAN
+STD_DEFINES=-DCONDITION_HANDLING=1 $(NT_UP_DEFINES) \
+ -DNT_INST=$(NT_INST) $(WIN32_DEFINE) $(NT_PNP_POWER_DEFINES)
+!ELSE
+STD_DEFINES=-DCONDITION_HANDLING=1 -DWIN32_LEAN_AND_MEAN=1 $(NT_UP_DEFINES) \
+ -DNT_INST=$(NT_INST) $(WIN32_DEFINE) $(NT_PNP_POWER_DEFINES)
+!ENDIF
+
+!IFNDEF CBSTRING
+!IF "$(MAJORCOMP)" == "ntos" || "$(MAJORCOMP)" == "NTOS"
+CBSTRING= -cbstring
+!ELSE
+CBSTRING=
+!ENDIF
+!ENDIF
+
+!IF "$(NTDEBUG)" == "retail"
+TARGET_DBG_DEFINES= -DDBG=0 -DDEVL=1
+DBGFLAGS=$(MSC_OPTFLAGS)
+!ELSE
+! IF "$(NTDEBUG)" == ""
+TARGET_DBG_DEFINES= -DDBG=0 -DDEVL=1
+DBGFLAGS=$(MSC_OPTFLAGS)
+! ELSE
+TARGET_DBG_DEFINES= -DDBG=1 -DDEVL=1
+!UNDEF NTLEGO
+! IF "$(NTDEBUG)" == "ntsd"
+DBGFLAGS=$(MSC_OPTFLAGS) /Zi
+! ELSE
+! IF "$(NTDEBUG)" == "cvp"
+DBGFLAGS=$(MSC_OPTFLAGS) /Zd
+! ELSE
+! IF "$(NTDEBUG)" == "sym"
+DBGFLAGS=$(MSC_OPTFLAGS) /Zd
+! ELSE
+! IF "$(NTDEBUG)" == "ntsdnodbg"
+DBGFLAGS=$(MSC_OPTFLAGS) /Zi
+TARGET_DBG_DEFINES= -DDBG=0 -DDEVL=1
+! ELSE
+! ERROR NTDEBUG macro can be either "retail", "", "ntsd", "cvp" or "sym" or "ntsdnodbg"
+! ENDIF
+! ENDIF # NTDEBUG == ntsdnodbg
+! ENDIF # NTDEBUG == sym
+! ENDIF # NTDEBUG == cvp
+! ENDIF # NTDEBUG == ""
+!ENDIF # NTDEBUG == retail
+
+!IF "$(NTDEBUGTYPE)" == "windbg"
+LINKER_DBG_TYPE = -debugtype:cv
+!ELSE
+! IF "$(NTDEBUGTYPE)" == "ntsd" || "$(NTDEBUGTYPE)" == "coff"
+LINKER_DBG_TYPE = -debugtype:coff
+! ELSE
+! IF "$(NTDEBUGTYPE)" == "both"
+LINKER_DBG_TYPE = -debugtype:both
+! ELSE
+! IF "$(NTDEBUGTYPE)" == ""
+LINKER_DBG_TYPE = -debugtype:coff
+! ELSE
+! ERROR NTDEBUGTYPE macro can one of "", "ntsd", "coff", "windbg" or "both"
+! ENDIF
+! ENDIF
+! ENDIF
+!ENDIF
+
+
+!IF "$(PRECOMPILED_OPTION)" == ""
+! IF "$(PRECOMPILED_INCLUDE)" != ""
+! IF "$(PRECOMPILED_INCLUDE)" != "$(PRECOMPILED_INCLUDE:.hxx=)"
+PRECOMPILED_CXX=1
+! ENDIF
+! IF "$(PRECOMPILED_INCLUDE)" != "$(PRECOMPILED_INCLUDE:.cxx=)"
+PRECOMPILED_CXX=1
+! ENDIF
+! IF "$(PRECOMPILED_PCH)" == ""
+PRECOMPILED_PCH=$(PRECOMPILED_INCLUDE:.hxx=.pch)
+PRECOMPILED_PCH=$(PRECOMPILED_PCH:.h=.pch)
+PRECOMPILED_PCH=$(PRECOMPILED_PCH:.cxx=.pch)
+PRECOMPILED_PCH=$(PRECOMPILED_PCH:.c=.pch)
+PRECOMPILED_PCH=$(PRECOMPILED_PCH:..\=)
+! ENDIF
+! IF "$(PRECOMPILED_OBJ)" == ""
+PRECOMPILED_OBJ=$(PRECOMPILED_PCH:.pch=.obj)
+! ENDIF
+! ENDIF
+!ENDIF
+
+! IF "$(PRECOMPILED_OPTION)" == ""
+! IF "$(PRECOMPILED_INCLUDE)" != ""
+! IF "$(PRECOMPILED_PCH)" != ""
+HEADERFILE=/Fpobj\*\$(PRECOMPILED_PCH)
+! ENDIF
+! IF "$(PRECOMPILED_OBJ)" != ""
+HEADEROBJNAME=obj\*\$(PRECOMPILED_OBJ)
+HEADEROBJ=/Fo$(MAKEDIR)\$(HEADEROBJNAME)
+! ENDIF
+! IF "$(PRECOMPILED_CXX)" == ""
+PRECOMPILED=/Yu$(PRECOMPILED_INCLUDE:..\=) $(HEADERFILE)
+PRECOMPILED_CXX=
+! ELSE
+PRECOMPILED=
+PRECOMPILED_CXX=/Yu$(PRECOMPILED_INCLUDE:..\=) $(HEADERFILE)
+! ENDIF
+PRECOMPILED_TARGET=obj\*\$(PRECOMPILED_PCH)
+! ELSE
+! IF "$(PRECOMPILED_INCLUDE)" != ""
+! IF "$(PRECOMPILED_CXX)" == ""
+PRECOMPILED=/Yu$(PRECOMPILED_INCLUDE)
+PRECOMPILED_CXX=
+! ELSE
+PRECOMPILED=
+PRECOMPILED_CXX=/Yu$(PRECOMPILED_INCLUDE)
+! ENDIF
+! ENDIF
+! ENDIF
+! ELSE
+! IF "$(PRECOMPILED_CXX)" == ""
+PRECOMPILED=$(PRECOMPILED_OPTION)
+PRECOMPILED_CXX=
+! ELSE
+PRECOMPILED=
+PRECOMPILED_CXX=$(PRECOMPILED_OPTION)
+! ENDIF
+PRECOMPILED_TARGET=$(PRECOMPILED_TARGET)
+! IF "$(PRECOMPILED_TARGET)" != ""
+HEADERFILE=/Fp$(PRECOMPILED_TARGET)
+! ENDIF
+! IF "$(PRECOMPILED_OBJ)" != ""
+HEADEROBJNAME=$(PRECOMPILED_OBJ)
+HEADEROBJ=/Fo$(HEADEROBJNAME)
+! ENDIF
+! ENDIF
+
+!IF ("$(PRECOMPILED_CXX)" == "") && ("$(USECXX_FLAG)" == "")
+PRECOMPILED_FLAG=/Tc
+!ELSE
+PRECOMPILED_FLAG=/Tp
+!ENDIF
+
+!IF "$(NTNOPCH)" != ""
+PRECOMPILED=
+PRECOMPILED_CXX=
+!ENDIF
+
+#
+# Set linker options
+#
+
+#
+# Merge _PAGE with PAGE, _TEXT with .text, and make sure
+# INIT sections are discardable
+#
+
+LINK_LIB_IGNORE_FLAG=-IGNORE:4001,4037,4039,4065,4070,4078,4087,4089
+LINKER_FLAGS = $(LINKER_FLAGS) \
+ -MERGE:_PAGE=PAGE \
+ -MERGE:_TEXT=.text \
+ -SECTION:INIT,d \
+ -OPT:REF \
+ -RELEASE \
+ -INCREMENTAL:NO \
+ -FULLBUILD \
+ -FORCE:MULTIPLE \
+ -NODEFAULTLIB \
+ $(LINK_LIB_IGNORE_FLAG)
+
+LINKER_MERGE_RDATA=-MERGE:.rdata=.text
+LINKER_OPTIDATA=-optidata
+
+!if "$(USE_PDB)" == ""
+LINKER_FLAGS = $(LINKER_FLAGS) -PDB:NONE
+!elseif ("$(PDB_ROOT)" != "") && ("$(CAIRO_PRODUCT)" == "")
+LINKER_FLAGS = $(LINKER_FLAGS) -PDB:$(PDB_ROOT)\$(TARGETEXT)^\
+PDB_ROOTUM = -PDB:$(PDB_ROOT)\$(UMAPPLEXT:.=)^\
+!elseif ("$(CAIROPDB_ROOT)" != "") && ("$(CAIRO_PRODUCT)" != "")
+LINKER_FLAGS = $(LINKER_FLAGS) -PDB:$(CAIROPDB_ROOT)\$(TARGETEXT)^\
+PDB_ROOTUM = -PDB:$(CAIROPDB_ROOT)\$(UMAPPLEXT:.=)^\
+!endif
+
+!IF "$(NTDEBUG)" == "ntsd" || "$(NTDEBUG)" == "ntsdnodbg"
+! IF "$(PERFFLAGS)" != ""
+LINKER_DBG_SECTION=-debug:mapped,FULL
+! ELSE
+LINKER_DBG_SECTION=-debug:notmapped,FULL
+! ENDIF # PERFFLAGS != NULL
+!ELSE
+! IF "$(NTDEBUG)" == "retail"
+LINKER_DBG_SECTION=-debug:NONE
+! ELSE
+! IF "$(PERFFLAGS)" != ""
+LINKER_DBG_SECTION=-debug:mapped,MINIMAL
+! ELSE
+LINKER_DBG_SECTION=-debug:notmapped,MINIMAL
+! ENDIF # PERFFLAGS != NULL
+! ENDIF # NTDEBUG == retail
+!ENDIF # NTDEBUG == ntsd
+
+!IF "$(NTLEANANDMEAN)" == "leanandmean"
+! IF "$(NTDEBUGTYPE)" == "coff" || \
+ "$(NTTEST)"=="ntoskrnl" || \
+ "$(NTTEST)"=="ntkrnlmp" || \
+ "$(TARGETTYPE)"=="DRIVER" || \
+ "$(TARGETTYPE)"=="MINIPORT" || \
+ "$(TARGETTYPE)"=="EXPORT_DRIVER" || \
+ "$(TARGETTYPE)"=="HAL"
+LINKER_DBG_SECTION=-debug:notmapped,minimal
+! ELSE
+LINKER_DBG_SECTION=-debug:none
+! ENDIF # NTDEBUGTYPE != coff || TARGETTYPE
+!ENDIF # NTLEANANDMEAN == leanandmean
+
+LINK_OS_VERSIONS = -version:3.51 -osversion:3.51
+
+LINKER_FLAGS = $(LINKER_FLAGS) $(LINKER_DBG_SECTION) $(LINKER_DBG_TYPE) $(LINK_OS_VERSIONS)
+LIBRARIAN_FLAGS = $(LIBRARIAN_FLAGS) $(LINK_LIB_IGNORE_FLAG)
+
+LIBRARIAN=lib -out:$@ $(LIBRARIAN_FLAGS) $(LINKER_DBG_TYPE) -machine:$(TARGET_DIRECTORY)
+LINKER=link -out:$@ -machine:$(TARGET_DIRECTORY)
+
+!IFDEF EXEPROFILEINPUT
+EXEORDER=-order:@$(@B).prf
+!ENDIF
+
+!IFNDEF DRIVER_ALIGNMENT
+DRIVER_ALIGNMENT=0x20
+!ENDIF
+
+!ifndef HAL_ALIGNMENT
+HAL_ALIGNMENT=0x20
+!endif
+
+!ifndef KERNEL_ALIGNMENT
+KERNEL_ALIGNMENT=0x40
+!endif
+
+#
+# Standard inference rules for C files that produce object files.
+#
+
+.SUFFIXES: .cxx .cpp .c .f .rc .s .asm .obj .exe .res .p .tdl .odl
+
+#
+# Processor specific control and options.
+#
+
+!include $(TARGET_DIRECTORY)mk.inc
+
+LINKER_FLAGS = $(LINKER_FLAGS) $(LINKER_MERGE_RDATA)
+
+#
+# Clear the suffixes list so we can ensure only pass zero stuff will be built
+#
+!IFDEF PASS0ONLY
+.SUFFIXES:
+!ENDIF
+
+#
+# If NTDBGFILES is defined then use binplace to split the symbols.
+# Define BINPLACE flags as needed if separate .DBG file requested.
+#
+
+!IFDEF NTDBGFILES
+BINPLACE_FLAGS=-s $(_NTTREE)\Symbols $(BINPLACE_FLAGS)
+!ENDIF
+
+!IFDEF _NTTREE
+! IFDEF _WIN95TREE
+! IFDEF NTDBGFILES
+BINPLACE_FLAGS95=$(BINPLACE_FLAGS) -s $(_WIN95TREE)\Symbols
+! ENDIF
+BINPLACE_CMD=binplace -R $(_WIN95TREE) $(BINPLACE_FLAGS95) $@\
+ & binplace -R $(_NTTREE) $(BINPLACE_FLAGS) $@
+! ELSE
+BINPLACE_CMD=binplace -R $(_NTTREE) $(BINPLACE_FLAGS) $@
+! ENDIF
+!ELSE
+BINPLACE_CMD=
+!ENDIF
+
+!ifdef NTDUMPAMAP
+MAPDUMP_CMD = link -dump -map $@ | sort /R /+62 > $(_NTDUMPAMAP)\$(@B).srt
+!else
+MAPDUMP_CMD =
+!endif
+
+
+#
+# Define this macro so including make files can supply a yes prompt
+# as appropriate. Put the "yes." file in a visible place for OEM's
+# so they can make too.
+#
+
+YESRESP=$(BASEDIR)\PUBLIC\OAK\INC\yes.
+
+!IFNDEF NOPASS0
+
+#
+# Pass Zero Inference Rules: IDL files (MIDL) and MC files
+#
+
+.SUFFIXES: .idl .mc
+
+!IF $(386)
+PASS0_OBJECTS=$(PASS0_386_OBJECTS)
+!ELSEIF $(MIPS)
+PASS0_OBJECTS=$(PASS0_MIPS_OBJECTS)
+!ELSEIF $(ALPHA)
+PASS0_OBJECTS=$(PASS0_ALPHA_OBJECTS)
+!ELSEIF $(PPC)
+PASS0_OBJECTS=$(PASS0_PPC_OBJECTS)
+!ENDIF
+
+!ENDIF # IFNDEF NOPASS0
+
+MIDL = midl
+MKTYPLIB = mktyplib
+!IFDEF USE_OLE_MC
+MC = mc -o
+!ELSE
+MC = mc
+!ENDIF
+
+!IF "$(IDL_TYPE)" == "ole" || "$(IDL_TYPE)" == ""
+IDL_TYPE=OLE
+!ELSEIF "$(IDL_TYPE)" == "rpc"
+IDL_TYPE=RPC
+!ENDIF
+
+!IFNDEF PASS0_HEADERDIR
+PASS0_HEADERDIR=$(TARGETPATH)
+!ENDIF
+
+!IFNDEF MIDL_OPTIMIZATION
+MIDL_OPTIMIZATION=-Oi1
+!ENDIF
+
+!IF "$(IDL_TYPE)" == "OLE"
+
+!IF DEFINED(PASS0_CLIENTDIR) || DEFINED(PASS0_SERVERDIR)
+!ERROR PASS0_CLIENTDIR and PASS0_SERVERDIR can only be used with IDL_TYPE=RPC!
+!ENDIF
+
+!IFNDEF PASS0_SOURCEDIR
+PASS0_SOURCEDIR=$(TARGETPATH)
+!ENDIF
+
+!IFNDEF MIDL_UUIDDIR
+MIDL_UUIDDIR=$(PASS0_SOURCEDIR)
+!ENDIF
+
+!IFNDEF NO_PASS0_RULES
+.idl{$(PASS0_HEADERDIR)}.h:
+ $(MIDL) \
+ -Zp8 \
+ $(INCPATH0) \
+ -char unsigned \
+ -ms_ext -c_ext \
+ -proxy $(PASS0_SOURCEDIR)\$(<:.idl=_p.c) \
+ -dlldata $(PASS0_SOURCEDIR)\dlldata.c \
+ -iid $(MIDL_UUIDDIR)\$(<:.idl=_i.c) \
+ -header $(PASS0_HEADERDIR)\$(<:.idl=.h) \
+ -cpp_cmd $(TARGET_CPP) \
+ $(C_DEFINES) \
+ $(MIDL_FLAGS) \
+ $(MIDL_OPTIMIZATION) \
+ $<
+!ENDIF
+
+!ELSEIF "$(IDL_TYPE)" == "RPC"
+
+!IF DEFINED(PASS0_SOURCEDIR) || DEFINED(MIDL_UUIDDR)
+!ERROR PASS0_SOURCEDIR and MIDL_UUIDDIR can only be used with IDL_TYPE=OLE!
+!ENDIF
+
+!IFNDEF PASS0_CLIENTDIR
+PASS0_CLIENTDIR=$(TARGETPATH)
+!ENDIF
+
+!IFNDEF PASS0_SERVERDIR
+PASS0_SERVERDIR=$(PASS0_CLIENTDIR)
+!ENDIF
+
+!IFNDEF NO_PASS0_RULES
+.idl{$(PASS0_HEADERDIR)}.h:
+ $(MIDL) \
+ -Zp8 \
+ $(INCPATH0) \
+ -char unsigned \
+ -ms_ext -c_ext \
+ -cstub $(PASS0_CLIENTDIR)\$(<:.idl=_c.c) \
+ -sstub $(PASS0_SERVERDIR)\$(<:.idl=_s.c) \
+ -cpp_cmd $(TARGET_CPP) \
+ $(C_DEFINES) \
+ $(MIDL_FLAGS) \
+ $(MIDL_OPTIMIZATION) \
+ $<
+!ENDIF
+
+!ELSE
+
+!ERROR Invalid IDL_TYPE value. Supported values: OLE and RPC.
+
+!ENDIF # IDL_TYPE
+
+
+!IFNDEF NO_PASS0_RULES
+
+!IFDEF PASS0_SOURCEDIR
+MC_SOURCEDIR=$(PASS0_SOURCEDIR)
+!ELSE
+MC_SOURCEDIR=$(PASS0_CLIENTDIR)
+!ENDIF
+
+.mc{$(PASS0_HEADERDIR)}.h:
+ $(MC) -h $(PASS0_HEADERDIR) -r $(MC_SOURCEDIR) $(MC_FLAGS) $<
+
+!IF "$(TARGET_CPP)" == "claxp"
+MKTYPLIB_CPP = cl
+!ELSE
+MKTYPLIB_CPP = $(TARGET_CPP)
+!ENDIF
+.odl{obj\$(TARGET_DIRECTORY)\}.tlb:
+ $(MKTYPLIB) \
+ $(INCPATH0) \
+ /tlb obj\$(TARGET_DIRECTORY)\$(<:.tdl=.tlb) \
+ -cpp_cmd $(MKTYPLIB_CPP) \
+ $(MKTYPLIB_FLAGS) \
+ $<
+ $(BINPLACE_CMD)
+
+.tdl{obj\$(TARGET_DIRECTORY)\}.tlb:
+ $(MKTYPLIB) \
+ $(INCPATH0) \
+ /tlb obj\$(TARGET_DIRECTORY)\$(<:.tdl=.tlb) \
+ -cpp_cmd $(MKTYPLIB_CPP) \
+ $(MKTYPLIB_FLAGS) \
+ $<
+ $(BINPLACE_CMD)
+
+!ENDIF
+
+#
+# Default language ID to US English (0x0409)
+#
+
+!IFDEF RCCODEPAGE
+RCOPTIONS=$(RCOPTIONS) -c $(RCCODEPAGE)
+!ENDIF
+
+RC_COMPILER=rc -l 409 $(RCOPTIONS)
+
+{..\}.rc{obj\$(TARGET_DIRECTORY)\}.res:
+ $(RC_COMPILER) -r -fo $(@R).tmp $(CDEFINES) -x $(INCPATH0) $<
+ @cvtres -$(TARGET_DIRECTORY) $(@R).tmp -r -o $@
+!IF "$(NTKEEPRESOURCETMPFILES)" == ""
+ @-erase $(@R).tmp
+!ENDIF
+
+{}.rc{obj\$(TARGET_DIRECTORY)\}.res:
+ $(RC_COMPILER) -r -fo $(@R).tmp $(CDEFINES) -x $(INCPATH0) $<
+ @cvtres -$(TARGET_DIRECTORY) $(@R).tmp -r -o $@
+!IF "$(NTKEEPRESOURCETMPFILES)" == ""
+ @-erase $(@R).tmp
+!ENDIF
+
+!IFNDEF NO_C_RULES
+
+ECHO_RSP = obj\$(TARGET_DIRECTORY)\echo.msg
+CL_RSP = obj\$(TARGET_DIRECTORY)\cl.rsp
+CLCOD_RSP = obj\$(TARGET_DIRECTORY)\clcod.rsp
+LINK_RSP = obj\$(TARGET_DIRECTORY)\lnk.rsp
+
+{..\}.cxx{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\..\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\$(TARGET_DIRECTORY)\}.cxx{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\}.cpp{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\..\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\$(TARGET_DIRECTORY)\}.cpp{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{}.cxx{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{$(TARGET_DIRECTORY)\}.cxx{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{}.cpp{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{$(TARGET_DIRECTORY)\}.cpp{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(CXX_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\}.cxx{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(CXX_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(MAKEDIR)\..\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{..\}.cxx{}.pp:
+ $(CXX_COMPILER_NAME) @<<$(CL_RSP) /E $(MAKEDIR)\$< > $@
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\}.cpp{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(CXX_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(MAKEDIR)\..\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{..\}.cpp{}.pp:
+ $(CXX_COMPILER_NAME) @<<$(CL_RSP) /E $(MAKEDIR)\$< > $@
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{}.cxx{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(CXX_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(MAKEDIR)\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{}.cxx{}.pp:
+ $(CXX_COMPILER_NAME) @<<$(CL_RSP) /E $(MAKEDIR)\$< > $@
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{}.cpp{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(CXX_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(MAKEDIR)\$(<F)
+$(CXX_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{}.cpp{}.pp:
+ $(CXX_COMPILER_NAME) @<<$(CL_RSP) /E $(MAKEDIR)\$< > $@
+$(CXX_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\}.c{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(C_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(USECXX_FLAG) $(MAKEDIR)\..\$(<F)
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\$(TARGET_DIRECTORY)\}.c{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(C_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(USECXX_FLAG) $(MAKEDIR)\$<
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{}.c{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(C_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(USECXX_FLAG) $(MAKEDIR)\$(<F)
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{$(TARGET_DIRECTORY)\}.c{obj\$(TARGET_DIRECTORY)\}.obj:
+ @type <<$(ECHO_RSP)
+$(ECHO_MSG)
+<<NOKEEP
+ @$(C_COMPILER_NAME) @<<$(CL_RSP) -Fo$(MAKEDIR)\$@ $(USECXX_FLAG) $(MAKEDIR)\$<
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\}.c{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(C_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(USECXX_FLAG) $(MAKEDIR)\..\$(<F)
+$(C_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{..\$(TARGET_DIRECTORY)\}.c{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(C_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(USECXX_FLAG) $(MAKEDIR)\$<
+$(C_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{..\}.c{}.pp:
+ $(C_COMPILER_NAME) @<<$(CL_RSP) /E $(USECXX_FLAG) $(MAKEDIR)\$< > $@
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{..\$(TARGET_DIRECTORY)\}.c{}.pp:
+ $(C_COMPILER_NAME) @<<$(CL_RSP) /E $(USECXX_FLAG) $(MAKEDIR)\$< > $@
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{}.c{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(C_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(USECXX_FLAG) $(MAKEDIR)\$(<F)
+$(C_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{$(TARGET_DIRECTORY)\}.c{}.cod:
+ @-erase $(CLCOD_RSP)
+ $(C_COMPILER_NAME) @<<$(CLCOD_RSP) /Fc $(USECXX_FLAG) $(MAKEDIR)\$<
+$(C_COMPILER_FLAGS: =
+)
+<<KEEP
+
+{}.c{}.pp:
+ $(C_COMPILER_NAME) @<<$(CL_RSP) /E $(USECXX_FLAG) $(MAKEDIR)\$< > $@
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+{$(TARGET_DIRECTORY)\}.c{}.pp:
+ $(C_COMPILER_NAME) @<<$(CL_RSP) /E $(USECXX_FLAG) $(MAKEDIR)\$< > $@
+$(C_COMPILER_FLAGS: =
+)
+<<NOKEEP
+
+!ENDIF # NO_C_RULES
+
+!IF "$(NTNOFUZZYLOOKUP)"=="1"
+LIBRARY_OBJS=
+!ENDIF
+
+#
+# Standard inference rule for generating machine specific def files.
+#
+
+.SUFFIXES: .def .src
+
+CPPXX = $(C_PREPROCESSOR_FLAGS:/Tc=)
+CPPXX = $(CPPXX:-Tc=)
+
+{..\}.src{obj\$(TARGET_DIRECTORY)}.def:
+ $(C_PREPROCESSOR_NAME) @<<$(CL_RSP) /Tc$< > $@
+$(CPPXX: =
+)
+<<NOKEEP
+
+{}.src{obj\$(TARGET_DIRECTORY)}.def:
+ $(C_PREPROCESSOR_NAME) @<<$(CL_RSP) /Tc$< > $@
+$(CPPXX: =
+)
+<<NOKEEP
+
+{..\}.def{obj\$(TARGET_DIRECTORY)}.def:
+ $(C_PREPROCESSOR_NAME) @<<$(CL_RSP) /Tc$< > $@
+$(CPPXX: =
+)
+<<NOKEEP
+
+{}.def{obj\$(TARGET_DIRECTORY)}.def:
+ $(C_PREPROCESSOR_NAME) @<<$(CL_RSP) /Tc$< > $@
+$(CPPXX: =
+)
+<<NOKEEP
+
+#
+# Standard inference rule for User Mode object files that produce User Mode
+# image files
+#
+
+{obj\$(TARGET_DIRECTORY)\}.obj{obj\$(TARGET_DIRECTORY)\}$(UMAPPLEXT):
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+$(PDB_ROOTUM)
+$(EXEORDER: =
+)
+$(LINKGPSIZE: =
+)
+$(LINKER_OPTIDATA)
+-base:$(UMBASE)
+-subsystem:$(SUBSYSTEM)
+$(UMENTRY)
+$(LINKFLAGS: =
+)
+$(UMRES: =
+)
+$<
+$(UMOBJS: =
+)
+$(UMLIBS: =
+)
+$(HEADEROBJNAME: =
+)
+$(CRTLIBS: =
+)
+$(LINKLIBS: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+
+#
+# Standard list of targets: all, clean and loc. all is the default target.
+#
+
+!IFNDEF PASS0ONLY
+
+all: obj\_objects.mac \
+ $(NTTARGETFILE0) \
+ $(PASS0_OBJECTS) \
+ $(PRECOMPILED_TARGET) \
+ $(HEADEROBJNAME) \
+ $(TARGETOBJFILES) \
+ $(TARGETLIBFILES) \
+ $(NTTARGETFILE1) \
+ $(TARGETEXEFILES) \
+ $(UMOBJFILES) \
+ $(UMEXEFILES) \
+ $(NTTARGETFILES) $(MISCFILES)
+!IFDEF MISCFILES
+! IFDEF _NTTREE
+ binplace -R $(_NTTREE) $(BINPLACE_FLAGS) $(MISCFILES)
+! ENDIF
+!ENDIF
+!IF "$(BUILDMSG)" != ""
+ @ech ; $(BUILDMSG) ;
+!ENDIF
+
+!ELSE # PASS0ONLY
+
+all: $(NTTARGETFILE0) \
+ $(PASS0_OBJECTS)
+!IF "$(BUILDMSG)" != ""
+ @ech ; $(BUILDMSG) ;
+!ENDIF
+
+!ENDIF # PASS0ONLY
+
+update:
+ @ech Updating library. ;
+
+obj\_objects.mac: $(SOURCES_USED)
+ @echo Rebuilding obj\_objects.mac from $(SOURCES_USED).
+ @build -Of >nul 2>&1
+ @echo obj\_objects.mac was rebuilt, please reinvoke NMAKE
+ @md \ >nul 2>nul
+
+loc:
+ @-loc *.h $(SOURCES)
+
+print:
+ @-ppr *.h $(SOURCES)
+
+!IFDEF NTTARGETFILES
+!INCLUDE .\makefile.inc
+!ELSE
+!IFDEF NTTARGETFILE0
+!INCLUDE .\makefile.inc
+!ELSE
+!IFDEF NTTARGETFILE1
+!INCLUDE .\makefile.inc
+!ENDIF
+!ENDIF
+!ENDIF
+
+!IF "$(PRECOMPILED_INCLUDE)" != ""
+$(PRECOMPILED_TARGET) $(HEADEROBJNAME): $(PRECOMPILED_INCLUDE)
+ @type <<
+$(ECHO_PRECOMPILED_MSG)
+<<NOKEEP
+ @$(C_COMPILER_NAME) @<< $(PRECOMPILED_FLAG)<<
+$(C_COMPILER_FLAGS: =
+) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) $(HEADEROBJ)
+<<NOKEEP
+#include "$(?F)"
+<<NOKEEP
+!ENDIF
+
+!IFNDEF NOLINK
+
+!IF "$(UMTEST)" != "" || "$(UMAPPL)" != ""
+
+
+$(UMEXEFILES): $(UMLIBS) $(CRTLIBS) $(LINKLIBS)
+
+!ENDIF
+!ENDIF
+
+#
+# These dependencies produce the target binaries from the object files.
+# These will trigger the sources to object inference rules to generate the
+# object files.
+#
+
+!IF "$(TARGET)" != ""
+!IF "$(TARGETTYPE)"=="PROGLIB"
+$(TARGET:.exe=.lib) $(TARGET:.exe=.exp): $(DLLDEF) $(LIBRARY_OBJS)
+ -lib -out:$(@R).lib @<<
+$(LINK_LIB_IGNORE_FLAG)
+-machine:$(TARGET_DIRECTORY)
+-def:$(DLLDEF)
+-debugtype:cv
+-nodefaultlib
+$(LIBRARY_OBJS: =
+)
+<<NOKEEP
+$(TARGET): $(OBJECTS) $(TARGETPATH)\$(TARGET_DIRECTORY)\$(TARGETNAME).exp $(UMRES) $(UMLIBS) $(CRTLIBS) $(MACHINE_TARGETLIBS) $(LINKLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+$(EXEORDER: =
+)
+$(LINKGPSIZE: =
+)
+$(LINKER_OPTIDATA)
+-subsystem:$(SUBSYSTEM)
+-base:$(UMBASE)
+$(UMENTRY: =
+)
+$(LINKFLAGS: =
+)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+
+!ELSEIF "$(TARGETTYPE)"=="PROGRAM"
+
+$(TARGET): $(UMRES) $(OBJECTS) $(CRTLIBS) $(UMLIBS) $(MACHINE_TARGETLIBS) $(LINKLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+-subsystem:$(SUBSYSTEM)
+-base:$(UMBASE)
+$(LINKGPSIZE: =
+)
+$(UMENTRY: =
+)
+$(LINKFLAGS: =
+)
+$(LINKER_OPTIDATA)
+$(HEADEROBJNAME: =
+)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+
+!ELSEIF "$(TARGETTYPE)"=="DYNLINK"
+
+!IF "$(DLLLIBOBJECTS)" == ""
+
+$(DYNLINK_LIB) $(DYNLINK_LIB:.lib=.exp): $(DLLDEF) $(LIBRARY_OBJS)
+ -lib -out:$(@R).lib @<<
+$(LINK_LIB_IGNORE_FLAG)
+-machine:$(TARGET_DIRECTORY)
+-def:$(DLLDEF)
+-debugtype:cv
+-nodefaultlib
+$(LIBRARY_OBJS: =
+)
+<<NOKEEP
+
+!ELSE # "$(DLLLIBOBJECTS)" == ""
+
+$(DYNLINK_LIB) $(DYNLINK_LIB:.lib=.exp): $(DLLDEF) $(LIBRARY_OBJS) $(DLLLIBOBJECTS)
+ -lib -out:$(@D)\tmp.lib @<<
+$(LINK_LIB_IGNORE_FLAG)
+-machine:$(TARGET_DIRECTORY)
+-def:$(DLLDEF)
+-debugtype:cv
+-nodefaultlib
+$(LIBRARY_OBJS: =
+)
+<<NOKEEP
+ erase $(@R).exp
+ ren $(@D)\tmp.exp $(@B).exp
+ -lib -out:$(@R).lib @<<
+$(LINK_LIB_IGNORE_FLAG)
+-machine:$(TARGET_DIRECTORY)
+$(@D)\tmp.lib
+$(DLLLIBOBJECTS: =
+)
+<<NOKEEP
+ -erase $(@D)\tmp.lib
+
+!ENDIF # "$(DLLLIBOBJECTS)" == ""
+
+!IF "$(MAKEDLL)" != ""
+
+!IFDEF DLLORDER
+XXXORDER=-order:@$(DLLORDER)
+!ENDIF
+
+!IFDEF NTPROFILEINPUT
+XXXORDER=-order:@$(@B).prf
+#XXXORDER=$(XXXORDER:obj\$(TARGET_DIRECTORY)\=)
+!ENDIF
+
+$(TARGET): $(TARGETPATH)\$(TARGET_DIRECTORY)\$(TARGETNAME).exp $(OBJECTS) $(LINKLIBS) $(CRTLIBS) $(MACHINE_TARGETLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+-dll
+$(XXXORDER: =
+)
+$(LINKER_OPTIDATA)
+-base:$(DLLBASE)
+-subsystem:$(SUBSYSTEM)
+$(DLLENTRY: =
+)
+$(HEADEROBJNAME: =
+)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+ $(MAPDUMP_CMD)
+
+!ENDIF # "$(MAKEDLL)" != ""
+
+!ELSEIF "$(TARGETTYPE)"=="LIBRARY"
+
+$(TARGET): $(OBJECTS)
+ @-erase $@ >nul 2>nul
+ -$(LIBRARIAN) @<<
+$(HEADEROBJNAME: =
+)
+$(**: =
+)
+<<NOKEEP
+
+!ELSEIF "$(TARGETTYPE)"=="DRIVER" || \
+ "$(TARGETTYPE)"=="MINIPORT"
+
+!IFDEF NTPROFILEINPUT
+ORDER=-order:@$(@B).prf
+!ENDIF
+
+$(TARGET): $(OBJECTS) $(MACHINE_TARGETLIBS) $(CRTLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+$(ORDER: =
+)
+$(SECTION_INFO1)
+$(SECTION_INFO2)
+$(LINKER_OPTIDATA)
+-driver
+-align:$(DRIVER_ALIGNMENT)
+-subsystem:native$(SUBSYSTEM_NATVER)
+-base:$(DRIVERBASE)
+-entry:DriverEntry$(ENTRY_SUFFIX)
+-out:$(TARGET)
+$(HEADEROBJNAME: =
+)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+ $(MAPDUMP_CMD)
+
+!ELSEIF "$(TARGETTYPE)"=="GDI_DRIVER"
+
+!IFDEF NTPROFILEINPUT
+ORDER=-order:@$(@B).prf
+!ENDIF
+
+$(TARGET): $(OBJECTS) $(MACHINE_TARGETLIBS) $(CRTLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+-dll
+$(ORDER: =
+)
+$(SECTION_INFO1)
+$(SECTION_INFO2)
+$(LINKER_OPTIDATA)
+-driver
+-align:$(DRIVER_ALIGNMENT)
+-subsystem:native$(SUBSYSTEM_NATVER)
+-base:$(DRIVERBASE)
+-entry:DrvEnableDriver$(GDI_ENTRY_SUFFIX)
+-out:$(TARGET)
+$(HEADEROBJNAME: =
+)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+ $(MAPDUMP_CMD)
+
+!ELSEIF "$(TARGETTYPE)"=="EXPORT_DRIVER"
+
+!IFDEF NTPROFILEINPUT
+ORDER=-order:@$(@B).prf
+!ENDIF
+
+!IF "$(MAKEDLL)" == ""
+$(TARGET) $(TARGET:.lib=.exp): $(DLLDEF) $(OBJECTS) $(LINKLIBS)
+ -lib -out:$(@R).lib @<<
+-machine:$(TARGET_DIRECTORY)
+-def:$(DLLDEF)
+-debugtype:cv
+-nodefaultlib
+$(LINK_LIB_IGNORE_FLAG)
+$(OBJECTS)
+$(LINKLIBS)
+<<NOKEEP
+!ELSE
+$(TARGET:.sys=.lib) $(TARGET:.sys=.exp): $(DLLDEF) $(LIBRARY_OBJS)
+ -lib -out:$(@R).lib @<<
+-machine:$(TARGET_DIRECTORY)
+-def:$(DLLDEF)
+-debugtype:cv
+-nodefaultlib
+$(LINK_LIB_IGNORE_FLAG)
+$(LIBRARY_OBJS)
+<<NOKEEP
+$(TARGET): $(TARGETPATH)\$(TARGET_DIRECTORY)\$(TARGETNAME).exp $(OBJECTS) $(CRTLIBS) $(MACHINE_TARGETLIBS) $(LINKLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+$(ORDER: =
+)
+$(LINKER_OPTIDATA)
+-driver
+-align:$(DRIVER_ALIGNMENT)
+-subsystem:native$(SUBSYSTEM_NATVER)
+-base:$(DRIVERBASE)
+-entry:DriverEntry$(ENTRY_SUFFIX)
+-out:$(TARGET)
+$(HEADEROBJNAME: =
+)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+!ENDIF
+
+!ELSEIF "$(TARGETTYPE)"=="HAL"
+
+!IF "$(MAKEDLL)" == ""
+$(TARGET) $(TARGET:.lib=.exp): $(DLLDEF) obj\$(TARGET_DIRECTORY)\*.obj
+ -lib -out:$(@R).lib -machine:$(TARGET_DIRECTORY) @<<
+-def:$(DLLDEF)
+-debugtype:cv
+-nodefaultlib
+$(LINK_LIB_IGNORE_FLAG)
+obj\$(TARGET_DIRECTORY)\*.obj
+<<NOKEEP
+!ELSE
+$(TARGET:.dll=.lib) $(TARGET:.dll=.exp): $(DLLDEF) obj\$(TARGET_DIRECTORY)\*.obj
+ -lib -out:$(@R).lib -machine:$(TARGET_DIRECTORY) @<<
+-def:$(DLLDEF)
+-debugtype:cv
+-nodefaultlib
+$(LINK_LIB_IGNORE_FLAG)
+obj\$(TARGET_DIRECTORY)\*.obj
+<<NOKEEP
+
+$(TARGET): $(TARGETPATH)\$(TARGET_DIRECTORY)\$(TARGETNAME).exp $(OBJECTS) $(CRTLIBS) $(MACHINE_TARGETLIBS) $(LINKLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+$(LINKER_OPTIDATA)
+-driver
+-align:$(HAL_ALIGNMENT)
+-subsystem:$(SUBSYSTEM)
+-base:$(HALBASE)
+-miscrdata
+-dll
+-entry:HalInitSystem$(ENTRY_SUFFIX)
+-out:$(TARGET)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+ $(MAPDUMP_CMD)
+!ENDIF
+
+!ELSEIF "$(TARGETTYPE)"=="BOOTPGM"
+
+$(TARGET): $(OBJECTS) $(CRTLIBS) $(MACHINE_TARGETLIBS) $(LINKLIBS)
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+-driver
+-subsystem:$(SUBSYSTEM)
+-base:$(BOOTBASE)
+-entry:_start
+-map:$(@R).map
+$(LINKFLAGS: =
+)
+$(**: =
+)
+<<NOKEEP
+
+!ENDIF
+!ENDIF
+
+!IFNDEF NOLINK
+
+!IF "$(NTTEST)" != ""
+
+!IF "$(TARGETPATH)"=="..\..\mpobj"
+KERNEL_DIR=mpobj
+KERNEL_TYPE=mp
+!ELSE
+KERNEL_DIR=obj
+KERNEL_TYPE=up
+!ENDIF
+
+!IFDEF NTPROFILEINPUT
+ORDER=-order:@..\$(@B).prf
+!ENDIF
+
+obj\$(TARGET_DIRECTORY)\$(NTTEST).exe: $(NTRES) obj\$(TARGET_DIRECTORY)\$(NTTEST).obj \
+ $(RELATIVE_DEPTH)\$(KERNEL_DIR)\$(TARGET_DIRECTORY)\*.lib \
+ $(LINKLIBS) \
+ $(BASEDIR)\public\sdk\lib\$(TARGET_DIRECTORY)\hal.lib \
+ $(BASEDIR)\public\sdk\lib\$(TARGET_DIRECTORY)\ntoskrnl.exp \
+ $(BASEDIR)\public\sdk\lib\$(TARGET_DIRECTORY)\lsakrnlp.lib \
+ $(BASEDIR)\public\sdk\lib\$(TARGET_DIRECTORY)\libcntpr.lib
+ $(LINKER) @<<
+$(LINKER_FLAGS: =
+)
+$(ORDER: =
+)
+$(LINKGPSIZE: =
+)
+$(NTTEST_LINK_OPTIONS: =
+)
+$(LINKER_OPTIDATA)
+-driver
+-align:$(KERNEL_ALIGNMENT)
+-subsystem:$(SUBSYSTEM)
+-miscrdata
+$(LINKFLAGS: =
+)
+$(**: =
+)
+<<NOKEEP
+ $(BINPLACE_CMD)
+ $(MAPDUMP_CMD)
+
+!ENDIF
+!ENDIF
diff --git a/private/utils/ntbackup/exchange/build/makefile.plt b/private/utils/ntbackup/exchange/build/makefile.plt
new file mode 100644
index 000000000..aa5899f6c
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/makefile.plt
@@ -0,0 +1,142 @@
+#
+# If not defined, specify where to get incs and libs.
+#
+
+!IFNDEF _NTROOT
+_NTROOT=\nt
+!ENDIF
+
+!IFNDEF BASEDIR
+BASEDIR=$(_NTDRIVE)$(_NTROOT)
+!ENDIF
+
+#
+# If not defined, define the build message banner.
+#
+
+!IFNDEF BUILDMSG
+BUILDMSG=
+!ENDIF
+
+#
+# Determine which target is being built (i386, Mips or Alpha) and define
+# the appropriate target variables.
+#
+
+!IFNDEF 386
+386=0
+!ENDIF
+
+!IFNDEF MIPS
+MIPS=0
+!ENDIF
+
+!IFNDEF ALPHA
+ALPHA=0
+!ENDIF
+
+!IFNDEF PPC
+PPC=0
+!ENDIF
+
+#
+# Default to building for the i386 target, if no target is specified.
+#
+
+!IF !$(386)
+! IF !$(MIPS)
+! IF !$(ALPHA)
+! IF !$(PPC)
+! IFDEF NTMIPSDEFAULT
+MIPS=1
+! IFNDEF TARGETCPU
+TARGETCPU=MIPS
+! ENDIF
+! ELSE
+! IFDEF NTALPHADEFAULT
+ALPHA=1
+! IFNDEF TARGETCPU
+TARGETCPU=ALPHA
+! ENDIF
+! ELSE
+! IFDEF NTPPCDEFAULT
+PPC=1
+! IFNDEF TARGETCPU
+TARGETCPU=PPC
+! ENDIF
+! ELSE
+386=1
+! IFNDEF TARGETCPU
+TARGETCPU=I386
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+!ENDIF
+
+#
+# Define the target platform specific information.
+#
+
+!if $(386)
+
+ASM_SUFFIX=asm
+ASM_INCLUDE_SUFFIX=inc
+
+TARGET_BRACES=
+TARGET_CPP=cl
+TARGET_DEFINES=-Di386 -D_X86_
+TARGET_DIRECTORY=i386
+TARGET_NTTREE=$(_NT386TREE)
+
+MIDL_CPP=$(TARGET_CPP)
+MIDL_FLAGS=$(TARGET_DEFINES) -D_WCHAR_T_DEFINED
+
+!elseif $(MIPS)
+
+ASM_SUFFIX=s
+ASM_INCLUDE_SUFFIX=h
+
+TARGET_BRACES=-B
+TARGET_CPP=cl
+TARGET_DEFINES=-DMIPS -D_MIPS_
+TARGET_DIRECTORY=mips
+TARGET_NTTREE=$(_NTMIPSTREE)
+
+MIDL_CPP=$(TARGET_CPP)
+MIDL_FLAGS=$(TARGET_DEFINES) -D_WCHAR_T_DEFINED
+
+!elseif $(ALPHA)
+
+ASM_SUFFIX=s
+ASM_INCLUDE_SUFFIX=h
+
+TARGET_BRACES=-B
+TARGET_CPP=cl
+TARGET_DEFINES=-DALPHA -D_ALPHA_
+TARGET_DIRECTORY=alpha
+TARGET_NTTREE=$(_NTALPHATREE)
+
+MIDL_CPP=$(TARGET_CPP)
+MIDL_FLAGS=$(TARGET_DEFINES) -D_WCHAR_T_DEFINED
+
+!elseif $(PPC)
+
+ASM_SUFFIX=s
+ASM_INCLUDE_SUFFIX=h
+
+TARGET_BRACES=-B
+TARGET_CPP=cl
+TARGET_DEFINES=-DPPC -D_PPC_
+TARGET_DIRECTORY=ppc
+TARGET_NTTREE=$(_NTPPCTREE)
+
+MIDL_CPP=$(TARGET_CPP)
+MIDL_FLAGS=$(TARGET_DEFINES) -D_WCHAR_T_DEFINED
+
+!else
+!error Must define the target as 386, mips, alpha or ppc.
+!endif
diff --git a/private/utils/ntbackup/exchange/build/mipsmk.inc b/private/utils/ntbackup/exchange/build/mipsmk.inc
new file mode 100644
index 000000000..a38682d5c
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/mipsmk.inc
@@ -0,0 +1,218 @@
+!IF 0
+
+Copyright (c) 1994 Microsoft Corporation
+
+Module Name:
+
+ mipsmk.inc
+
+Abstract:
+
+ This module contains the MIPs specific build controls. It is included
+ by makefile.def.
+
+Author:
+
+ Jeff Havens (jhavens) 13-Feb-1994
+
+Revision History:
+
+!ENDIF
+
+#
+# Mips option control
+#
+
+UMBASE=$(UMBASE:*=mips)
+UMLIBS=$(UMLIBS:*=mips)
+NTRES=$(NTRES:*=mips)
+UMRES=$(UMRES:*=mips)
+UMOBJS=$(UMOBJS:*=mips)
+LINKLIBS=$(LINKLIBS:*=mips)
+DLLBASE=$(DLLBASE:*=mips)
+DLLDEF=$(DLLDEF:*=mips)
+MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:*=mips)
+TARGET=$(TARGET:*=mips)
+DYNLINK_LIB=$(DYNLINK_LIB:*=mips)
+TARGETEXEFILES=$(TARGETEXEFILES:*=mips)
+TARGETLIBFILES=$(TARGETLIBFILES:*=mips)
+TARGETOBJFILES=$(TARGETOBJFILES:*=mips)
+UMOBJFILES=$(UMOBJFILES:*=mips)
+UMEXEFILES=$(UMEXEFILES:*=mips)
+HEADERFILE=$(HEADERFILE:*=mips)
+HEADEROBJNAME=$(HEADEROBJNAME:*=mips)
+HEADEROBJ=$(HEADEROBJ:*=mips)
+PRECOMPILED=$(PRECOMPILED:*=mips)
+PRECOMPILED_CXX=$(PRECOMPILED_CXX:*=mips)
+PRECOMPILED_TARGET=$(PRECOMPILED_TARGET:*=mips)
+
+!ifdef NTTARGETFILES
+NTTARGETFILES=$(NTTARGETFILES:*=mips)
+!endif
+!ifdef NTTARGETFILE0
+NTTARGETFILE0=$(NTTARGETFILE0:*=mips)
+!endif
+!ifdef NTTARGETFILE1
+NTTARGETFILE1=$(NTTARGETFILE1:*=mips)
+!endif
+
+!IF "$(GPSIZE)" != "0"
+
+LIBC_LIB=$(BASEDIR)\public\sdk\lib\mips\small.lib $(LIBC_LIB)
+
+LINKGPSIZE=-gpsize:$(GPSIZE)
+
+!ENDIF
+
+LINKER_FLAGS = $(LINKER_FLAGS) -merge:.xdata=.rdata
+
+MIPS_ENDIAN=MIPSEL
+
+!IF "$(MIPS_F77)" == ""
+MIPS_F77=f772.20
+!ENDIF
+
+ENTRY_SUFFIX=
+GDI_ENTRY_SUFFIX=
+
+!IFDEF MIPS_WARNING_LEVEL
+MSC_WARNING_LEVEL=$(MIPS_WARNING_LEVEL)
+!ENDIF
+!IFDEF MIPS_OPTIMIZATION
+MSC_OPTIMIZATION=$(MIPS_OPTIMIZATION)
+!ENDIF
+!IFDEF MIPS_CPPFLAGS
+MSC_CPPFLAGS=$(MIPS_CPPFLAGS)
+!ENDIF
+
+#
+# Now a bunch of MIPS stuff
+#
+
+!IF "$(MSC_OPTFLAGS)" == "/Oxs"
+DBGFLAGS=$(MSC_OPTFLAGS:/Oxs=/Ox)
+!ENDIF
+
+DBGFLAGS = $(DBGFLAGS:/Zi=-Z7)
+
+# Use /Z7 instead of /Zi
+
+DBGFLAGS=$(DBGFLAGS:-Zi=-Z7)
+
+!IFNDEF MIPS_R3000
+MIPS_CPU=-DR4000 -D_M_MRX000=4000
+MIPS_TRAP_FILE=x4trap.obj
+!ELSE
+MIPS_CPU=-DR3000 -D_M_MRX000=3000
+MIPS_TRAP_FILE=x3trap.obj
+!ENDIF
+
+MIPS_ASM_DEFINES=$(MIPS_ASMCPP)
+ENV_DEFINES=$(LIBC_DEFINES) $(C_DEFINES) $(NET_C_DEFINES) $(MSC_CPPFLAGS) $(NTCPPFLAGS)
+
+STD_DEFINES=-DMIPS=1 -D_MIPS_=1 -D$(MIPS_ENDIAN) -DNO_EXT_KEYS -DCONDITION_HANDLING=1 $(STD_DEFINES)
+
+STDFLAGS=-c
+MS_MIPS=1
+
+MSC_C_COMPILER_NAME=cl $(CBSTRING) -nologo
+
+CDEFINES=$(STD_DEFINES) $(MIPS_CPU) $(TARGET_DBG_DEFINES) $(ENV_DEFINES)
+CFLAGS=$(MIPS_FLAGS) $(NTMIPSFLAGS) $(STDFLAGS) $(DBGFLAGS) $(MIPS_PERFFLAGS) $(USER_C_FLAGS)
+AFLAGS=-Gy $(MIPS_FLAGS) $(NTMIPSFLAGS) $(STDFLAGS) $(DBGFLAGS) $(MIPS_PERFFLAGS)
+
+MIPS_CDEFINES=$(CDEFINES)
+MIPS_CFLAGS=$(CFLAGS) -Zel -Zp8 -Gy $(MSC_WARNING_LEVEL) -QMOb4000
+MIPS_CFLAGS=$(MIPS_CFLAGS:-Qmips=-QM)
+
+C_PREPROCESSOR_NAME = $(MSC_C_COMPILER_NAME)
+C_COMPILER_NAME = $(MSC_C_COMPILER_NAME)
+CXX_COMPILER_NAME = $(MSC_C_COMPILER_NAME)
+MIPS_ASSEMBLER_NAME = $(MSC_C_COMPILER_NAME)
+
+GLOBAL_C_FLAGS = -nologo -Imips\ -I. $(INCPATH0) $(CDEFINES) $(MIPS_CFLAGS) \
+ -DFPO=1 -D__stdcall= -D__cdecl= -D_LANGUAGE_C -DLANGUAGE_C $(MFC_FLAGS)
+
+C_PREPROCESSOR_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED) -EP -Tc
+C_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED) -Gt$(GPSIZE) $(COMPILER_WARNINGS)
+CXX_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED_CXX) -Gt$(GPSIZE) $(COMPILER_WARNINGS)
+
+C_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS)
+C_COMPILER = $(C_COMPILER_NAME) $(C_COMPILER_FLAGS)
+CXX_COMPILER = $(CXX_COMPILER_NAME) $(CXX_COMPILER_FLAGS)
+
+ECHO_MSG=ClMips $< " $(C_COMPILER) "
+
+ECHO_PRECOMPILED_MSG=CpMips $(PRECOMPILED_INCLUDE) " $(C_COMPILER) \
+ /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) \
+ $(HEADEROBJ) $(PRECOMPILED_FLAG)"
+
+MIPS_FORTRAN_COMPILER=$(MIPS_F77) $(MSC_WARNINGS) $(MIPS_OPTIONS) -G $(GPSIZE) \
+ -excpt -G0 $(MSC_OPTIMIZATION) -O -EL -c
+
+MIPS_CRFILTER=echo SHOULDN'T NEED TO CRFILTER THIS!
+
+!IF "$(NTDEBUG)" == "" || "$(NTDEBUG)" == "retail"
+!IFNDEF MIPS_ENABLE_DIVIDE_CHECK
+MIPS_CFLAGS=$(MIPS_CFLAGS) -d2aNoDivCheck
+!ENDIF
+!ENDIF
+
+!ifdef MIPS_ENABLE_MIPS3
+AFLAGS=$(AFLAGS) -d2QMmips3
+!endif
+
+#
+# Use Mips MCL for assembler files.
+#
+
+MIPS_ASSEMBLER_FLAGS = -nologo -Gt$(GPSIZE) -Ge -c $(MIPS_CPU_SWITCHES) \
+ -Imips\ -I. $(INCPATH0) $(CDEFINES) \
+ $(AFLAGS) -D_LANGUAGE_ASSEMBLY
+
+MIPS_ASSEMBLER = $(MIPS_ASSEMBLER_NAME) $(MIPS_ASSEMBLER_FLAGS)
+
+{..\mips\}.s{obj\mips\}.obj:
+ @-erase $@ >nul 2>&1
+ @echo AsMips $< " $(MIPS_ASSEMBLER) "
+ @$(MIPS_ASSEMBLER_NAME) @<< -Fo$(MAKEDIR)\$@ $<
+$(MIPS_ASSEMBLER_FLAGS: =
+)
+<<NOKEEP
+
+{mips\}.s{obj\mips\}.obj:
+ @-erase $@ >nul 2>&1
+ @echo AsMips $< " $(MIPS_ASSEMBLER) $(MIPS_ASSEMBLER_FLAGS)"
+ @$(MIPS_ASSEMBLER_NAME) @<< -Fo$(MAKEDIR)\$@ $<
+$(MIPS_ASSEMBLER_FLAGS: =
+)
+<<NOKEEP
+
+LINKFLAGS=$(LNKFLAGS) -NODEFAULTLIB
+LIBRARY_OBJS=$(LINKLIBS) $(OBJECTS)
+# LIBRARY_OBJS=
+
+!IFDEF TUKWILA
+_NTTREE=$(_NTMIPSTREE)
+!ENDIF
+
+!IFDEF CAIRO_PRODUCT
+!IFDEF _CAIROMIPSTREE
+_NTTREE=$(_CAIROMIPSTREE)
+!ENDIF
+!ELSEIFDEF _NTMIPSTREE
+_NTTREE=$(_NTMIPSTREE)
+!ENDIF
+
+!IFDEF KERNEL_MODE
+_NTTREE=$(_NTMIPSTREE)\km
+!ENDIF
+
+!IFDEF _NTMIPSLIBS
+_NTLIBS=$(_NTMIPSLIBS)
+!ENDIF
+
+COPYDST=$(MIPSCOPYDST)
+LIB_COPY=ntmipscp.cmd
+
+NTTEST_LINK_OPTIONS= -base:0x10000 -entry:KiSystemStartup
diff --git a/private/utils/ntbackup/exchange/build/ppcmk.inc b/private/utils/ntbackup/exchange/build/ppcmk.inc
new file mode 100644
index 000000000..0503ff0b0
--- /dev/null
+++ b/private/utils/ntbackup/exchange/build/ppcmk.inc
@@ -0,0 +1,227 @@
+!IF 0
+
+Copyright (c) 1994 Microsoft Corporation
+
+Module Name:
+
+ppcmk.inc
+
+Abstract:
+
+This module contains the PPC specific build controls. It is included
+by makefile.def.
+
+Author:
+
+Matt Holle (v-matth) 13-Feb-1994
+
+Revision History:
+
+!ENDIF
+
+
+#
+# PPC option control
+#
+
+UMBASE=$(UMBASE:*=ppc)
+UMLIBS=$(UMLIBS:*=ppc)
+NTRES=$(NTRES:*=ppc)
+UMRES=$(UMRES:*=ppc)
+UMOBJS=$(UMOBJS:*=ppc)
+LINKLIBS=$(LINKLIBS:*=ppc)
+DLLBASE=$(DLLBASE:*=ppc)
+DLLDEF=$(DLLDEF:*=ppc)
+MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:*=ppc)
+TARGET=$(TARGET:*=ppc)
+DYNLINK_LIB=$(DYNLINK_LIB:*=ppc)
+TARGETEXEFILES=$(TARGETEXEFILES:*=ppc)
+TARGETLIBFILES=$(TARGETLIBFILES:*=ppc)
+TARGETOBJFILES=$(TARGETOBJFILES:*=ppc)
+UMOBJFILES=$(UMOBJFILES:*=ppc)
+UMEXEFILES=$(UMEXEFILES:*=ppc)
+HEADERFILE=$(HEADERFILE:*=ppc)
+HEADEROBJNAME=$(HEADEROBJNAME:*=ppc)
+HEADEROBJ=$(HEADEROBJ:*=ppc)
+PRECOMPILED=$(PRECOMPILED:*=ppc)
+PRECOMPILED_CXX=$(PRECOMPILED_CXX:*=ppc)
+PRECOMPILED_TARGET=$(PRECOMPILED_TARGET:*=ppc)
+
+#
+# Include 64-bit helper library
+#
+#LINKLIBS=$(LINKLIBS) $(BASEDIR)\public\sdk\lib\ppc\int64.lib
+!IF "$(TARGETTYPE)"=="DRIVER" || \
+ "$(TARGETTYPE)"=="GDI_DRIVER" || \
+ "$(TARGETTYPE)"=="MINIPORT"
+#
+#Drivers don't link with link libs.
+#
+MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS) $(BASEDIR)\public\sdk\lib\ppc\int64.lib
+!ENDIF
+
+!ifdef NTTARGETFILES
+NTTARGETFILES=$(NTTARGETFILES:*=ppc)
+!endif
+!ifdef NTTARGETFILE0
+NTTARGETFILE0=$(NTTARGETFILE0:*=ppc)
+!endif
+!ifdef NTTARGETFILE1
+NTTARGETFILE1=$(NTTARGETFILE1:*=ppc)
+!endif
+
+!IF "$(GPSIZE)" != "0"
+#
+# GPSIZE is irrelevant on PowerPC
+#
+LINKGPSIZE=
+!ENDIF
+
+ENTRY_SUFFIX=
+GDI_ENTRY_SUFFIX=
+
+!IF "$(MSC_OPTFLAGS)" == "/Oxs"
+DBGFLAGS=$(MSC_OPTFLAGS:/Oxs=/Ox)
+!ENDIF
+
+!IFDEF PPC_WARNING_LEVEL
+MSC_WARNING_LEVEL=$(PPC_WARNING_LEVEL)
+!ENDIF
+
+!IFDEF PPC_OPTIMIZATION
+MSC_OPTIMIZATION=$(PPC_OPTIMIZATION)
+!ELSE
+MSC_OPTIMIZATION=
+!ENDIF
+
+!IFDEF PPC_CPPFLAGS
+MSC_CPPFLAGS=$(PPC_CPPFLAGS)
+!ENDIF
+
+PPC_AS=pas
+PPC_DIS=pdis
+PPC_AS_WARNINGS=
+
+PPC_START_FILE=start.obj
+
+ENV_DEFINES=$(LIBC_DEFINES) $(C_DEFINES) $(NET_C_DEFINES) $(MSC_CPPFLAGS) $(NTCPPFLAGS) $(PM_DEFINES)
+STD_DEFINES=-DPPC=1 -D_PPC_=1 -DNO_EXT_KEYS $(STD_DEFINES) -D_M_PPC=1
+
+STDFLAGS=-c -Zel -Zp8 -Gy $(MFC_FLAGS)
+
+PPC_C_COMPILER_NAME = cl $(CBSTRING) -nologo
+PPC_CC = $(PPC_C_COMPILER_NAME)
+
+CDEFINES=$(STD_DEFINES) $(TARGET_DBG_DEFINES) $(ENV_DEFINES)
+CFLAGS=$(PPC_FLAGS) $(NTPPCFLAGS) $(STDFLAGS) $(DBGFLAGS) $(USER_C_FLAGS)
+
+PPC_CDEFINES= $(CDEFINES)
+PPC_CFLAGS = $(CFLAGS) -ZB64 $(MSC_WARNING_LEVEL) # -DALLOC_TEXT
+
+!IFNDEF PPC_OPTIONS
+PPC_OPTIONS=
+!ENDIF
+
+C_COMPILER_NAME = $(PPC_C_COMPILER_NAME)
+C_PREPROCESSOR_NAME = $(PPC_C_COMPILER_NAME)
+CXX_COMPILER_NAME = $(PPC_C_COMPILER_NAME)
+
+GLOBAL_C_FLAGS = -nologo -Ippc\ -I. $(INCPATH0) $(CDEFINES) $(PPC_OPTIONS) \
+ $(PPC_CFLAGS) -D__stdcall= -D__cdecl= -D_cdecl= -Dcdecl= \
+ -DFPO=1 -DLANGUAGE_C
+
+# Disable -WX for now
+
+GLOBAL_C_FLAGS = $(GLOBAL_C_FLAGS:-WX=)
+GLOBAL_C_FLAGS = $(GLOBAL_C_FLAGS:/WX=)
+
+C_PREPROCESSOR_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED) -EP -Tc
+C_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED) $(COMPILER_WARNINGS)
+CXX_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(PRECOMPILED_CXX) $(COMPILER_WARNINGS)
+
+C_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS)
+C_COMPILER = $(C_COMPILER_NAME) $(C_COMPILER_FLAGS)
+CXX_COMPILER = $(CXX_COMPILER_NAME) $(CXX_COMPILER_FLAGS)
+
+PPC_ASSEMBLER = $(PPC_AS) $(PPC_AS_WARNINGS)
+
+ECHO_MSG = ClPpc $< " $(C_COMPILER) "
+ECHO_PRECOMPILED_MSG = CpPpc $(PRECOMPILED_INCLUDE) " $(C_COMPILER) \
+ /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) \
+ $(HEADEROBJ) $(PRECOMPILED_FLAG)"
+
+{.\}.cxx{}.obj:
+ @$(ECHO_MSG)
+ @$(CXX_COMPILER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\..\$(<F)
+
+{.\}.cxx{obj\$(TARGET_DIRECTORY)\}.obj:
+ @$(ECHO_MSG)
+ @$(CXX_COMPILER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\..\$(<F)
+
+{}.cxx{obj\$(TARGET_DIRECTORY)\}.obj:
+ @$(ECHO_MSG)
+ @$(CXX_COMPILER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\..\$(<F)
+
+{..\ppc\}.s{obj\ppc\}.obj:
+ @-erase $@ >nul 2>&1
+ @echo AsPpc $< " $(PPC_ASSEMBLER) "
+ $(C_PREPROCESSOR) $(MAKEDIR)\..\ppc\$(<F) > $(MAKEDIR)\obj\ppc\$(<B).i && $(PPC_ASSEMBLER) -o $@ $(MAKEDIR)\obj\ppc\$(<B).i
+ @-erase $(MAKEDIR)\obj\ppc\$(<B).i >nul 2>&1
+
+
+{ppc\}.s{obj\ppc\}.obj:
+ @-erase $@ >nul 2>&1
+ @echo AsPpc $< " $(PPC_ASSEMBLER) "
+ $(C_PREPROCESSOR) $(MAKEDIR)\ppc\$(<F) > $(MAKEDIR)\obj\ppc\$(<B).i && $(PPC_ASSEMBLER) -o $@ $(MAKEDIR)\obj\ppc\$(<B).i
+ @-erase $(MAKEDIR)\obj\ppc\$(<B).i >nul 2>&1
+
+.SUFFIXES: .il
+
+{}.il{}.cod:
+ @-erase $@ >nul 2>&1
+ @echo MCL $<" $(C_COMPILER) "
+ @$(C_COMPILER) -FAac -Fa$(<B).cod -B1..\bootbin\null.exe -Bk$(<B). -Fo$(MAKEDIR)\obj\ppc\$(<B).o $(MAKEDIR)\$(<B).c
+ @del obj\ppc\$(<B).o
+
+#
+# No reodering under ppc.
+#
+
+LIBRARY_OBJS=$(LINKLIBS) $(OBJECTS)
+
+!IFDEF TUKWILA
+_NTTREE=$(_NTPPCTREE)
+!ENDIF
+
+!IFDEF CAIRO_PRODUCT
+!IFDEF _CAIROPPCTREE
+_NTTREE=$(_CAIROPPCTREE)
+!ENDIF
+!ELSE
+!IFDEF _NTPPCTREE
+_NTTREE=$(_NTPPCTREE)
+!ENDIF
+!ENDIF
+
+!IFDEF KERNEL_MODE
+_NTTREE=$(_NTPPCTREE)\km
+!ENDIF
+
+!IFDEF _NTPPCLIBS
+_NTLIBS=$(_NTPPCLIBS)
+!ENDIF
+
+COPYDST=$(PPCCOPYDST)
+
+LIB_COPY=ntppccp.cmd
+
+NTTEST_LINK_OPTIONS= -base:0x80100000 -entry:KiSystemStartup
+
+#
+# Move the compiler generated function descriptors into .rdata
+#
+# Can be removed when we switch to the MS PPC compiler (assuming
+# it emits the descriptor in .rdata already) BryanT
+#
+
+LINKER_FLAGS = -merge:.reldata=.rdata $(LINKER_FLAGS)
diff --git a/private/utils/ntbackup/exchange/inc/edbmsg.h b/private/utils/ntbackup/exchange/inc/edbmsg.h
new file mode 100644
index 000000000..2288317dc
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/edbmsg.h
@@ -0,0 +1,1737 @@
+/*
+ * EDBMSG.H
+ *
+ * Microsoft Exchange Information Store
+ * Copyright (C) 1986-1996, Microsoft Corporation
+ *
+ * Contains declarations of additional properties and interfaces
+ * offered by Microsoft Exchange Information Store
+ */
+
+#ifndef _EDBMSG_
+#define _EDBMSG_
+
+//
+// SUCCESS
+//
+//
+// Values are 32 bit values layed out as follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-+-----------------------+-------------------------------+
+// |Sev|C|R| Facility | Code |
+// +---+-+-+-----------------------+-------------------------------+
+//
+// where
+//
+// Sev - is the severity code
+//
+// 00 - Success
+// 01 - Informational
+// 10 - Warning
+// 11 - Error
+//
+// C - is the Customer code flag
+//
+// R - is a reserved bit
+//
+// Facility - is the facility code
+//
+// Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+#define FACILITY_SYSTEM 0x0
+#define FACILITY_EDB 0x800
+#define FACILITY_BACKUP 0x7FF
+
+
+//
+// Define the severity codes
+//
+#define STATUS_SEVERITY_WARNING 0x2
+#define STATUS_SEVERITY_SUCCESS 0x0
+#define STATUS_SEVERITY_INFORMATIONAL 0x1
+#define STATUS_SEVERITY_ERROR 0x3
+
+
+//
+// MessageId: hrNone
+//
+// MessageText:
+//
+// The operation was successful
+//
+#define hrNone ((HRESULT)0x00000000L)
+
+//
+// ERRORS
+//
+//
+// MessageId: hrNyi
+//
+// MessageText:
+//
+// The function is not yet implemented
+//
+#define hrNyi ((HRESULT)0xC0000001L)
+
+//
+// Backup errors
+//
+//
+// MessageId: hrInvalidParam
+//
+// MessageText:
+//
+// The parameter is not valid.
+//
+#define hrInvalidParam ((HRESULT)0xC7FF0001L)
+
+//
+// MessageId: hrError
+//
+// MessageText:
+//
+// An internal error has occurred.
+//
+#define hrError ((HRESULT)0xC7FF0002L)
+
+//
+// MessageId: hrInvalidHandle
+//
+// MessageText:
+//
+// The handle is not valid.
+//
+#define hrInvalidHandle ((HRESULT)0xC7FF0003L)
+
+//
+// MessageId: hrRestoreInProgress
+//
+// MessageText:
+//
+// The Restore process is already in progress.
+//
+#define hrRestoreInProgress ((HRESULT)0xC7FF0004L)
+
+//
+// MessageId: hrAlreadyOpen
+//
+// MessageText:
+//
+// The file specified is already open.
+//
+#define hrAlreadyOpen ((HRESULT)0xC7FF0005L)
+
+//
+// MessageId: hrInvalidRecips
+//
+// MessageText:
+//
+// The recipients are invalid.
+//
+#define hrInvalidRecips ((HRESULT)0xC7FF0006L)
+
+//
+// MessageId: hrCouldNotConnect
+//
+// MessageText:
+//
+// Unable to perform the backup. Either you are not connected to the specified backup server
+// or the service you are trying to backup is not running.
+//
+#define hrCouldNotConnect ((HRESULT)0xC7FF0007L)
+
+//
+// MessageId: hrRestoreMapExists
+//
+// MessageText:
+//
+// A restore map already exists for the specified component. You can only specify
+// a restore map when performing a full restore.
+//
+#define hrRestoreMapExists ((HRESULT)0xC7FF0008L)
+
+//
+// MessageId: hrIncrementalBackupDisabled
+//
+// MessageText:
+//
+// Another application has modified the specified Microsoft Exchange database such that any
+// subsequent backups will fail. You must perform a full backup to fix this problem.
+//
+#define hrIncrementalBackupDisabled ((HRESULT)0xC7FF0009L)
+
+//
+// MessageId: hrLogFileNotFound
+//
+// MessageText:
+//
+// Unable to perform an incremental backup because a required Microsoft Exchange database log file could not be found.
+//
+#define hrLogFileNotFound ((HRESULT)0xC7FF000AL)
+
+//
+// MessageId: hrCircularLogging
+//
+// MessageText:
+//
+// The Microsoft Exchange component specified is configured to use circular database logs.
+// It cannot be backed up without a full backup.
+//
+#define hrCircularLogging ((HRESULT)0xC7FF000BL)
+
+//
+// MessageId: hrNoFullRestore
+//
+// MessageText:
+//
+// The databases have not been restored to this machine. You cannot restore an incremental backup
+// until a full backup has been restored.
+//
+#define hrNoFullRestore ((HRESULT)0xC7FF000CL)
+
+//
+// MessageId: hrCommunicationError
+//
+// MessageText:
+//
+// A communications error occurred while attempting to perform a local backup.
+//
+#define hrCommunicationError ((HRESULT)0xC7FF000DL)
+
+//
+// MessageId: hrFullBackupNotTaken
+//
+// MessageText:
+//
+// You must perform a full backup before you can perform an incremental backup.
+//
+#define hrFullBackupNotTaken ((HRESULT)0xC7FF000EL)
+
+#define hrAlreadyListening ((HRESULT)RPC_S_ALREADY_LISTENING)
+//
+// ERRORS
+//
+//
+// SYSTEM errors
+//
+//
+// MessageId: hrFileClose
+//
+// MessageText:
+//
+// Unable to close the DOS file
+//
+#define hrFileClose ((HRESULT)0xC8000066L)
+
+//
+// MessageId: hrOutOfThreads
+//
+// MessageText:
+//
+// Unable to start a thread because there are none available.
+//
+#define hrOutOfThreads ((HRESULT)0xC8000067L)
+
+//
+// MessageId: hrTooManyIO
+//
+// MessageText:
+//
+// The system is busy because there are too many I/Os.
+//
+#define hrTooManyIO ((HRESULT)0xC8000069L)
+
+//
+// BUFFER MANAGER errors
+//
+//
+// MessageId: hrBFNotSynchronous
+//
+// MessageText:
+//
+// The buffer page has been evicted.
+//
+#define hrBFNotSynchronous ((HRESULT)0x880000C8L)
+
+//
+// MessageId: hrBFPageNotFound
+//
+// MessageText:
+//
+// Unable to find the page.
+//
+#define hrBFPageNotFound ((HRESULT)0x880000C9L)
+
+//
+// MessageId: hrBFInUse
+//
+// MessageText:
+//
+// Unable to abandon the buffer.
+//
+#define hrBFInUse ((HRESULT)0xC80000CAL)
+
+//
+// DIRECTORY MANAGER errors
+//
+//
+// MessageId: hrPMRecDeleted
+//
+// MessageText:
+//
+// The record has been deleted.
+//
+#define hrPMRecDeleted ((HRESULT)0xC800012EL)
+
+//
+// MessageId: hrRemainingVersions
+//
+// MessageText:
+//
+// There is idle work remaining.
+//
+#define hrRemainingVersions ((HRESULT)0x88000141L)
+
+//
+// RECORD MANAGER errors
+//
+//
+// MessageId: hrFLDKeyTooBig
+//
+// MessageText:
+//
+// The key was truncated because it is more than 255 bytes.
+//
+#define hrFLDKeyTooBig ((HRESULT)0x88000190L)
+
+//
+// MessageId: hrFLDTooManySegments
+//
+// MessageText:
+//
+// There are too many key segments.
+//
+#define hrFLDTooManySegments ((HRESULT)0xC8000191L)
+
+//
+// MessageId: hrFLDNullKey
+//
+// MessageText:
+//
+// The key is NULL.
+//
+#define hrFLDNullKey ((HRESULT)0x88000192L)
+
+//
+// LOGGING/RECOVERY errors
+//
+//
+// MessageId: hrLogFileCorrupt
+//
+// MessageText:
+//
+// The log file is damaged.
+//
+#define hrLogFileCorrupt ((HRESULT)0xC80001F5L)
+
+//
+// MessageId: hrNoBackupDirectory
+//
+// MessageText:
+//
+// No backup directory was given.
+//
+#define hrNoBackupDirectory ((HRESULT)0xC80001F7L)
+
+//
+// MessageId: hrBackupDirectoryNotEmpty
+//
+// MessageText:
+//
+// The backup directory is not empty.
+//
+#define hrBackupDirectoryNotEmpty ((HRESULT)0xC80001F8L)
+
+//
+// MessageId: hrBackupInProgress
+//
+// MessageText:
+//
+// Backup is already active.
+//
+#define hrBackupInProgress ((HRESULT)0xC80001F9L)
+
+//
+// MessageId: hrMissingPreviousLogFile
+//
+// MessageText:
+//
+// A log file for the checkpoint is missing.
+//
+#define hrMissingPreviousLogFile ((HRESULT)0xC80001FDL)
+
+//
+// MessageId: hrLogWriteFail
+//
+// MessageText:
+//
+// Unable to write to the log file.
+//
+#define hrLogWriteFail ((HRESULT)0xC80001FEL)
+
+//
+// MessageId: hrBadLogVersion
+//
+// MessageText:
+//
+// The version of the log file is not compatible with the version of the Microsoft Exchange Server database (EDB).
+//
+#define hrBadLogVersion ((HRESULT)0xC8000202L)
+
+//
+// MessageId: hrInvalidLogSequence
+//
+// MessageText:
+//
+// The time stamp in the next log does not match what was expected.
+//
+#define hrInvalidLogSequence ((HRESULT)0xC8000203L)
+
+//
+// MessageId: hrLoggingDisabled
+//
+// MessageText:
+//
+// The log is not active.
+//
+#define hrLoggingDisabled ((HRESULT)0xC8000204L)
+
+//
+// MessageId: hrLogBufferTooSmall
+//
+// MessageText:
+//
+// The log buffer is too small to be recovered.
+//
+#define hrLogBufferTooSmall ((HRESULT)0xC8000205L)
+
+//
+// MessageId: hrLogSequenceEnd
+//
+// MessageText:
+//
+// The maximum number of log files has been exceeded.
+//
+#define hrLogSequenceEnd ((HRESULT)0xC8000207L)
+
+//
+// MessageId: hrNoBackup
+//
+// MessageText:
+//
+// There is no backup in progress.
+//
+#define hrNoBackup ((HRESULT)0xC8000208L)
+
+//
+// MessageId: hrInvalidBackupSequence
+//
+// MessageText:
+//
+// The backup call is out of sequence.
+//
+#define hrInvalidBackupSequence ((HRESULT)0xC8000209L)
+
+//
+// MessageId: hrBackupNotAllowedYet
+//
+// MessageText:
+//
+// Unable to perform a backup now.
+//
+#define hrBackupNotAllowedYet ((HRESULT)0xC800020BL)
+
+//
+// MessageId: hrDeleteBackupFileFail
+//
+// MessageText:
+//
+// Unable to delete the backup file.
+//
+#define hrDeleteBackupFileFail ((HRESULT)0xC800020CL)
+
+//
+// MessageId: hrMakeBackupDirectoryFail
+//
+// MessageText:
+//
+// Unable to make a backup temporary directory.
+//
+#define hrMakeBackupDirectoryFail ((HRESULT)0xC800020DL)
+
+//
+// MessageId: hrInvalidBackup
+//
+// MessageText:
+//
+// An incremental backup cannot be performed when circular logging is enabled.
+//
+#define hrInvalidBackup ((HRESULT)0xC800020EL)
+
+//
+// MessageId: hrRecoveredWithErrors
+//
+// MessageText:
+//
+// Errors were encountered during the repair process.
+//
+#define hrRecoveredWithErrors ((HRESULT)0xC800020FL)
+
+//
+// MessageId: hrMissingLogFile
+//
+// MessageText:
+//
+// The current log file is missing.
+//
+#define hrMissingLogFile ((HRESULT)0xC8000210L)
+
+//
+// MessageId: hrLogDiskFull
+//
+// MessageText:
+//
+// The log disk is full.
+//
+#define hrLogDiskFull ((HRESULT)0xC8000211L)
+
+//
+// MessageId: hrBadLogSignature
+//
+// MessageText:
+//
+// A log file is damaged.
+//
+#define hrBadLogSignature ((HRESULT)0xC8000212L)
+
+//
+// MessageId: hrBadDbSignature
+//
+// MessageText:
+//
+// A database file is damaged.
+//
+#define hrBadDbSignature ((HRESULT)0xC8000213L)
+
+//
+// MessageId: hrBadCheckpointSignature
+//
+// MessageText:
+//
+// A checkpoint file is damaged.
+//
+#define hrBadCheckpointSignature ((HRESULT)0xC8000214L)
+
+//
+// MessageId: hrCheckpointCorrupt
+//
+// MessageText:
+//
+// A checkpoint file either could not be found or is damaged.
+//
+#define hrCheckpointCorrupt ((HRESULT)0xC8000215L)
+
+//
+// MessageId: hrDatabaseInconsistent
+//
+// MessageText:
+//
+// The database is damaged.
+//
+#define hrDatabaseInconsistent ((HRESULT)0xC8000226L)
+
+//
+// MessageId: hrConsistentTimeMismatch
+//
+// MessageText:
+//
+// There is a mismatch in the database's last consistent time.
+//
+#define hrConsistentTimeMismatch ((HRESULT)0xC8000227L)
+
+//
+// MessageId: hrPatchFileMismatch
+//
+// MessageText:
+//
+// The patch file is not generated from this backup.
+//
+#define hrPatchFileMismatch ((HRESULT)0xC8000228L)
+
+//
+// MessageId: hrRestoreLogTooLow
+//
+// MessageText:
+//
+// The starting log number is too low for the restore.
+//
+#define hrRestoreLogTooLow ((HRESULT)0xC8000229L)
+
+//
+// MessageId: hrRestoreLogTooHigh
+//
+// MessageText:
+//
+// The starting log number is too high for the restore.
+//
+#define hrRestoreLogTooHigh ((HRESULT)0xC800022AL)
+
+//
+// MessageId: hrGivenLogFileHasBadSignature
+//
+// MessageText:
+//
+// The log file downloaded from the tape is damaged.
+//
+#define hrGivenLogFileHasBadSignature ((HRESULT)0xC800022BL)
+
+//
+// MessageId: hrGivenLogFileIsNotContiguous
+//
+// MessageText:
+//
+// Unable to find a mandatory log file after the tape was downloaded.
+//
+#define hrGivenLogFileIsNotContiguous ((HRESULT)0xC800022CL)
+
+//
+// MessageId: hrMissingRestoreLogFiles
+//
+// MessageText:
+//
+// The data is not fully restored because some log files are missing.
+//
+#define hrMissingRestoreLogFiles ((HRESULT)0xC800022DL)
+
+//
+// MessageId: hrExistingLogFileHasBadSignature
+//
+// MessageText:
+//
+// The log file in the log file path is damaged.
+//
+#define hrExistingLogFileHasBadSignature ((HRESULT)0x8800022EL)
+
+//
+// MessageId: hrExistingLogFileIsNotContiguous
+//
+// MessageText:
+//
+// Unable to find a mandatory log file in the log file path.
+//
+#define hrExistingLogFileIsNotContiguous ((HRESULT)0x8800022FL)
+
+//
+// MessageId: hrMissingFullBackup
+//
+// MessageText:
+//
+// The database missed a previous full backup before the incremental backup.
+//
+#define hrMissingFullBackup ((HRESULT)0xC8000230L)
+
+//
+// MessageId: hrBadBackupDatabaseSize
+//
+// MessageText:
+//
+// The backup database size must be a multiple of 4K (4096 bytes).
+//
+#define hrBadBackupDatabaseSize ((HRESULT)0xC8000231L)
+
+//
+// MessageId: hrTermInProgress
+//
+// MessageText:
+//
+// The database is being shut down.
+//
+#define hrTermInProgress ((HRESULT)0xC80003E8L)
+
+//
+// MessageId: hrFeatureNotAvailable
+//
+// MessageText:
+//
+// The feature is not available.
+//
+#define hrFeatureNotAvailable ((HRESULT)0xC80003E9L)
+
+//
+// MessageId: hrInvalidName
+//
+// MessageText:
+//
+// The name is not valid.
+//
+#define hrInvalidName ((HRESULT)0xC80003EAL)
+
+//
+// MessageId: hrInvalidParameter
+//
+// MessageText:
+//
+// The parameter is not valid.
+//
+#define hrInvalidParameter ((HRESULT)0xC80003EBL)
+
+//
+// MessageId: hrColumnNull
+//
+// MessageText:
+//
+// The value of the column is null.
+//
+#define hrColumnNull ((HRESULT)0x880003ECL)
+
+//
+// MessageId: hrBufferTruncated
+//
+// MessageText:
+//
+// The buffer is too small for data.
+//
+#define hrBufferTruncated ((HRESULT)0x880003EEL)
+
+//
+// MessageId: hrDatabaseAttached
+//
+// MessageText:
+//
+// The database is already attached.
+//
+#define hrDatabaseAttached ((HRESULT)0x880003EFL)
+
+//
+// MessageId: hrInvalidDatabaseId
+//
+// MessageText:
+//
+// The database ID is not valid.
+//
+#define hrInvalidDatabaseId ((HRESULT)0xC80003F2L)
+
+//
+// MessageId: hrOutOfMemory
+//
+// MessageText:
+//
+// The computer is out of memory.
+//
+#define hrOutOfMemory ((HRESULT)0xC80003F3L)
+
+//
+// MessageId: hrOutOfDatabaseSpace
+//
+// MessageText:
+//
+// The database has reached the maximum size of 16 GB.
+//
+#define hrOutOfDatabaseSpace ((HRESULT)0xC80003F4L)
+
+//
+// MessageId: hrOutOfCursors
+//
+// MessageText:
+//
+// Out of table cursors.
+//
+#define hrOutOfCursors ((HRESULT)0xC80003F5L)
+
+//
+// MessageId: hrOutOfBuffers
+//
+// MessageText:
+//
+// Out of database page buffers.
+//
+#define hrOutOfBuffers ((HRESULT)0xC80003F6L)
+
+//
+// MessageId: hrTooManyIndexes
+//
+// MessageText:
+//
+// There are too many indexes.
+//
+#define hrTooManyIndexes ((HRESULT)0xC80003F7L)
+
+//
+// MessageId: hrTooManyKeys
+//
+// MessageText:
+//
+// There are too many columns in an index.
+//
+#define hrTooManyKeys ((HRESULT)0xC80003F8L)
+
+//
+// MessageId: hrRecordDeleted
+//
+// MessageText:
+//
+// The record has been deleted.
+//
+#define hrRecordDeleted ((HRESULT)0xC80003F9L)
+
+//
+// MessageId: hrReadVerifyFailure
+//
+// MessageText:
+//
+// A read verification error occurred.
+//
+#define hrReadVerifyFailure ((HRESULT)0xC80003FAL)
+
+//
+// MessageId: hrOutOfFileHandles
+//
+// MessageText:
+//
+// Out of file handles.
+//
+#define hrOutOfFileHandles ((HRESULT)0xC80003FCL)
+
+//
+// MessageId: hrDiskIO
+//
+// MessageText:
+//
+// A disk I/O error occurred.
+//
+#define hrDiskIO ((HRESULT)0xC80003FEL)
+
+//
+// MessageId: hrInvalidPath
+//
+// MessageText:
+//
+// The path to the file is not valid.
+//
+#define hrInvalidPath ((HRESULT)0xC80003FFL)
+
+//
+// MessageId: hrRecordTooBig
+//
+// MessageText:
+//
+// The record has exceeded the maximum size.
+//
+#define hrRecordTooBig ((HRESULT)0xC8000402L)
+
+//
+// MessageId: hrTooManyOpenDatabases
+//
+// MessageText:
+//
+// There are too many open databases.
+//
+#define hrTooManyOpenDatabases ((HRESULT)0xC8000403L)
+
+//
+// MessageId: hrInvalidDatabase
+//
+// MessageText:
+//
+// The file is not a database file.
+//
+#define hrInvalidDatabase ((HRESULT)0xC8000404L)
+
+//
+// MessageId: hrNotInitialized
+//
+// MessageText:
+//
+// The database was not yet called.
+//
+#define hrNotInitialized ((HRESULT)0xC8000405L)
+
+//
+// MessageId: hrAlreadyInitialized
+//
+// MessageText:
+//
+// The database was already called.
+//
+#define hrAlreadyInitialized ((HRESULT)0xC8000406L)
+
+//
+// MessageId: hrFileAccessDenied
+//
+// MessageText:
+//
+// Unable to access the file.
+//
+#define hrFileAccessDenied ((HRESULT)0xC8000408L)
+
+//
+// MessageId: hrBufferTooSmall
+//
+// MessageText:
+//
+// The buffer is too small.
+//
+#define hrBufferTooSmall ((HRESULT)0xC800040EL)
+
+//
+// MessageId: hrSeekNotEqual
+//
+// MessageText:
+//
+// Either SeekLE or SeekGE did not find an exact match.
+//
+#define hrSeekNotEqual ((HRESULT)0x8800040FL)
+
+//
+// MessageId: hrTooManyColumns
+//
+// MessageText:
+//
+// There are too many columns defined.
+//
+#define hrTooManyColumns ((HRESULT)0xC8000410L)
+
+//
+// MessageId: hrContainerNotEmpty
+//
+// MessageText:
+//
+// The container is not empty.
+//
+#define hrContainerNotEmpty ((HRESULT)0xC8000413L)
+
+//
+// MessageId: hrInvalidFilename
+//
+// MessageText:
+//
+// The filename is not valid.
+//
+#define hrInvalidFilename ((HRESULT)0xC8000414L)
+
+//
+// MessageId: hrInvalidBookmark
+//
+// MessageText:
+//
+// The bookmark is not valid.
+//
+#define hrInvalidBookmark ((HRESULT)0xC8000415L)
+
+//
+// MessageId: hrColumnInUse
+//
+// MessageText:
+//
+// The column is used in an index.
+//
+#define hrColumnInUse ((HRESULT)0xC8000416L)
+
+//
+// MessageId: hrInvalidBufferSize
+//
+// MessageText:
+//
+// The data buffer does not match the column size.
+//
+#define hrInvalidBufferSize ((HRESULT)0xC8000417L)
+
+//
+// MessageId: hrColumnNotUpdatable
+//
+// MessageText:
+//
+// Unable to set the column value.
+//
+#define hrColumnNotUpdatable ((HRESULT)0xC8000418L)
+
+//
+// MessageId: hrIndexInUse
+//
+// MessageText:
+//
+// The index is in use.
+//
+#define hrIndexInUse ((HRESULT)0xC800041BL)
+
+//
+// MessageId: hrNullKeyDisallowed
+//
+// MessageText:
+//
+// Null keys are not allowed on an index.
+//
+#define hrNullKeyDisallowed ((HRESULT)0xC800041DL)
+
+//
+// MessageId: hrNotInTransaction
+//
+// MessageText:
+//
+// The operation must be within a transaction.
+//
+#define hrNotInTransaction ((HRESULT)0xC800041EL)
+
+//
+// MessageId: hrNoIdleActivity
+//
+// MessageText:
+//
+// No idle activity occured.
+//
+#define hrNoIdleActivity ((HRESULT)0x88000422L)
+
+//
+// MessageId: hrTooManyActiveUsers
+//
+// MessageText:
+//
+// There are too many active database users.
+//
+#define hrTooManyActiveUsers ((HRESULT)0xC8000423L)
+
+//
+// MessageId: hrInvalidCountry
+//
+// MessageText:
+//
+// The country code is either not known or is not valid.
+//
+#define hrInvalidCountry ((HRESULT)0xC8000425L)
+
+//
+// MessageId: hrInvalidLanguageId
+//
+// MessageText:
+//
+// The language ID is either not known or is not valid.
+//
+#define hrInvalidLanguageId ((HRESULT)0xC8000426L)
+
+//
+// MessageId: hrInvalidCodePage
+//
+// MessageText:
+//
+// The code page is either not known or is not valid.
+//
+#define hrInvalidCodePage ((HRESULT)0xC8000427L)
+
+//
+// MessageId: hrNoWriteLock
+//
+// MessageText:
+//
+// There is no write lock at transaction level 0.
+//
+#define hrNoWriteLock ((HRESULT)0x8800042BL)
+
+//
+// MessageId: hrColumnSetNull
+//
+// MessageText:
+//
+// The column value is set to null.
+//
+#define hrColumnSetNull ((HRESULT)0x8800042CL)
+
+//
+// MessageId: hrVersionStoreOutOfMemory
+//
+// MessageText:
+//
+// lMaxVerPages exceeded (XJET only)
+//
+#define hrVersionStoreOutOfMemory ((HRESULT)0xC800042DL)
+
+//
+// MessageId: hrCurrencyStackOutOfMemory
+//
+// MessageText:
+//
+// Out of cursors.
+//
+#define hrCurrencyStackOutOfMemory ((HRESULT)0xC800042EL)
+
+//
+// MessageId: hrOutOfSessions
+//
+// MessageText:
+//
+// Out of sessions.
+//
+#define hrOutOfSessions ((HRESULT)0xC800044DL)
+
+//
+// MessageId: hrWriteConflict
+//
+// MessageText:
+//
+// The write lock failed due to an outstanding write lock.
+//
+#define hrWriteConflict ((HRESULT)0xC800044EL)
+
+//
+// MessageId: hrTransTooDeep
+//
+// MessageText:
+//
+// The transactions are nested too deeply.
+//
+#define hrTransTooDeep ((HRESULT)0xC800044FL)
+
+//
+// MessageId: hrInvalidSesid
+//
+// MessageText:
+//
+// The session handle is not valid.
+//
+#define hrInvalidSesid ((HRESULT)0xC8000450L)
+
+//
+// MessageId: hrSessionWriteConflict
+//
+// MessageText:
+//
+// Another session has a private version of the page.
+//
+#define hrSessionWriteConflict ((HRESULT)0xC8000453L)
+
+//
+// MessageId: hrInTransaction
+//
+// MessageText:
+//
+// The operation is not allowed within a transaction.
+//
+#define hrInTransaction ((HRESULT)0xC8000454L)
+
+//
+// MessageId: hrDatabaseDuplicate
+//
+// MessageText:
+//
+// The database already exists.
+//
+#define hrDatabaseDuplicate ((HRESULT)0xC80004B1L)
+
+//
+// MessageId: hrDatabaseInUse
+//
+// MessageText:
+//
+// The database is in use.
+//
+#define hrDatabaseInUse ((HRESULT)0xC80004B2L)
+
+//
+// MessageId: hrDatabaseNotFound
+//
+// MessageText:
+//
+// The database does not exist.
+//
+#define hrDatabaseNotFound ((HRESULT)0xC80004B3L)
+
+//
+// MessageId: hrDatabaseInvalidName
+//
+// MessageText:
+//
+// The database name is not valid.
+//
+#define hrDatabaseInvalidName ((HRESULT)0xC80004B4L)
+
+//
+// MessageId: hrDatabaseInvalidPages
+//
+// MessageText:
+//
+// The number of pages is not valid.
+//
+#define hrDatabaseInvalidPages ((HRESULT)0xC80004B5L)
+
+//
+// MessageId: hrDatabaseCorrupted
+//
+// MessageText:
+//
+// The database file is either damaged or cannot be found.
+//
+#define hrDatabaseCorrupted ((HRESULT)0xC80004B6L)
+
+//
+// MessageId: hrDatabaseLocked
+//
+// MessageText:
+//
+// The database is locked.
+//
+#define hrDatabaseLocked ((HRESULT)0xC80004B7L)
+
+//
+// MessageId: hrTableEmpty
+//
+// MessageText:
+//
+// An empty table was opened.
+//
+#define hrTableEmpty ((HRESULT)0x88000515L)
+
+//
+// MessageId: hrTableLocked
+//
+// MessageText:
+//
+// The table is locked.
+//
+#define hrTableLocked ((HRESULT)0xC8000516L)
+
+//
+// MessageId: hrTableDuplicate
+//
+// MessageText:
+//
+// The table already exists.
+//
+#define hrTableDuplicate ((HRESULT)0xC8000517L)
+
+//
+// MessageId: hrTableInUse
+//
+// MessageText:
+//
+// Unable to lock the table because it is already in use.
+//
+#define hrTableInUse ((HRESULT)0xC8000518L)
+
+//
+// MessageId: hrObjectNotFound
+//
+// MessageText:
+//
+// The table or object does not exist.
+//
+#define hrObjectNotFound ((HRESULT)0xC8000519L)
+
+//
+// MessageId: hrCannotRename
+//
+// MessageText:
+//
+// Unable to rename the temporary file.
+//
+#define hrCannotRename ((HRESULT)0xC800051AL)
+
+//
+// MessageId: hrDensityInvalid
+//
+// MessageText:
+//
+// The file/index density is not valid.
+//
+#define hrDensityInvalid ((HRESULT)0xC800051BL)
+
+//
+// MessageId: hrTableNotEmpty
+//
+// MessageText:
+//
+// Unable to define the clustered index.
+//
+#define hrTableNotEmpty ((HRESULT)0xC800051CL)
+
+//
+// MessageId: hrInvalidTableId
+//
+// MessageText:
+//
+// The table ID is not valid.
+//
+#define hrInvalidTableId ((HRESULT)0xC800051EL)
+
+//
+// MessageId: hrTooManyOpenTables
+//
+// MessageText:
+//
+// Unable to open any more tables.
+//
+#define hrTooManyOpenTables ((HRESULT)0xC800051FL)
+
+//
+// MessageId: hrIllegalOperation
+//
+// MessageText:
+//
+// The operation is not supported on tables.
+//
+#define hrIllegalOperation ((HRESULT)0xC8000520L)
+
+//
+// MessageId: hrObjectDuplicate
+//
+// MessageText:
+//
+// The table or object name is already being used.
+//
+#define hrObjectDuplicate ((HRESULT)0xC8000522L)
+
+//
+// MessageId: hrInvalidObject
+//
+// MessageText:
+//
+// The object is not valid for operation.
+//
+#define hrInvalidObject ((HRESULT)0xC8000524L)
+
+//
+// MessageId: hrIndexCantBuild
+//
+// MessageText:
+//
+// Unable to build a clustered index.
+//
+#define hrIndexCantBuild ((HRESULT)0xC8000579L)
+
+//
+// MessageId: hrIndexHasPrimary
+//
+// MessageText:
+//
+// The primary index is already defined.
+//
+#define hrIndexHasPrimary ((HRESULT)0xC800057AL)
+
+//
+// MessageId: hrIndexDuplicate
+//
+// MessageText:
+//
+// The index is already defined.
+//
+#define hrIndexDuplicate ((HRESULT)0xC800057BL)
+
+//
+// MessageId: hrIndexNotFound
+//
+// MessageText:
+//
+// The index does not exist.
+//
+#define hrIndexNotFound ((HRESULT)0xC800057CL)
+
+//
+// MessageId: hrIndexMustStay
+//
+// MessageText:
+//
+// Unable to delete a clustered index.
+//
+#define hrIndexMustStay ((HRESULT)0xC800057DL)
+
+//
+// MessageId: hrIndexInvalidDef
+//
+// MessageText:
+//
+// The index definition is illegal.
+//
+#define hrIndexInvalidDef ((HRESULT)0xC800057EL)
+
+//
+// MessageId: hrIndexHasClustered
+//
+// MessageText:
+//
+// The clustered index is already defined.
+//
+#define hrIndexHasClustered ((HRESULT)0xC8000580L)
+
+//
+// MessageId: hrCreateIndexFailed
+//
+// MessageText:
+//
+// Unable to create the index because an error occurred while creating a table.
+//
+#define hrCreateIndexFailed ((HRESULT)0x88000581L)
+
+//
+// MessageId: hrTooManyOpenIndexes
+//
+// MessageText:
+//
+// Out of index description blocks.
+//
+#define hrTooManyOpenIndexes ((HRESULT)0xC8000582L)
+
+//
+// MessageId: hrColumnLong
+//
+// MessageText:
+//
+// The column value is too long.
+//
+#define hrColumnLong ((HRESULT)0xC80005DDL)
+
+//
+// MessageId: hrColumnDoesNotFit
+//
+// MessageText:
+//
+// The field will not fit in the record.
+//
+#define hrColumnDoesNotFit ((HRESULT)0xC80005DFL)
+
+//
+// MessageId: hrNullInvalid
+//
+// MessageText:
+//
+// The value cannot be null.
+//
+#define hrNullInvalid ((HRESULT)0xC80005E0L)
+
+//
+// MessageId: hrColumnIndexed
+//
+// MessageText:
+//
+// Unable to delete because the column is indexed.
+//
+#define hrColumnIndexed ((HRESULT)0xC80005E1L)
+
+//
+// MessageId: hrColumnTooBig
+//
+// MessageText:
+//
+// The length of the field exceeds the maximum length of 255 bytes.
+//
+#define hrColumnTooBig ((HRESULT)0xC80005E2L)
+
+//
+// MessageId: hrColumnNotFound
+//
+// MessageText:
+//
+// Unable to find the column.
+//
+#define hrColumnNotFound ((HRESULT)0xC80005E3L)
+
+//
+// MessageId: hrColumnDuplicate
+//
+// MessageText:
+//
+// The field is already defined.
+//
+#define hrColumnDuplicate ((HRESULT)0xC80005E4L)
+
+//
+// MessageId: hrColumn2ndSysMaint
+//
+// MessageText:
+//
+// Only one auto-increment or version column is allowed per table.
+//
+#define hrColumn2ndSysMaint ((HRESULT)0xC80005E6L)
+
+//
+// MessageId: hrInvalidColumnType
+//
+// MessageText:
+//
+// The column data type is not valid.
+//
+#define hrInvalidColumnType ((HRESULT)0xC80005E7L)
+
+//
+// MessageId: hrColumnMaxTruncated
+//
+// MessageText:
+//
+// The column was truncated because it exceeded the maximum length of 255 bytes.
+//
+#define hrColumnMaxTruncated ((HRESULT)0x880005E8L)
+
+//
+// MessageId: hrColumnCannotIndex
+//
+// MessageText:
+//
+// Unable to index a long value column.
+//
+#define hrColumnCannotIndex ((HRESULT)0xC80005E9L)
+
+//
+// MessageId: hrTaggedNotNULL
+//
+// MessageText:
+//
+// Tagged columns cannot be null.
+//
+#define hrTaggedNotNULL ((HRESULT)0xC80005EAL)
+
+//
+// MessageId: hrNoCurrentIndex
+//
+// MessageText:
+//
+// The entry is not valid without a current index.
+//
+#define hrNoCurrentIndex ((HRESULT)0xC80005EBL)
+
+//
+// MessageId: hrKeyIsMade
+//
+// MessageText:
+//
+// The key is completely made.
+//
+#define hrKeyIsMade ((HRESULT)0xC80005ECL)
+
+//
+// MessageId: hrBadColumnId
+//
+// MessageText:
+//
+// The column ID is not correct.
+//
+#define hrBadColumnId ((HRESULT)0xC80005EDL)
+
+//
+// MessageId: hrBadItagSequence
+//
+// MessageText:
+//
+// There is a bad instance identifier for a multivalued column.
+//
+#define hrBadItagSequence ((HRESULT)0xC80005EEL)
+
+//
+// MessageId: hrCannotBeTagged
+//
+// MessageText:
+//
+// AutoIncrement and Version cannot be multivalued.
+//
+#define hrCannotBeTagged ((HRESULT)0xC80005F1L)
+
+//
+// MessageId: hrRecordNotFound
+//
+// MessageText:
+//
+// Unable to find the key.
+//
+#define hrRecordNotFound ((HRESULT)0xC8000641L)
+
+//
+// MessageId: hrNoCurrentRecord
+//
+// MessageText:
+//
+// The currency is not on a record.
+//
+#define hrNoCurrentRecord ((HRESULT)0xC8000643L)
+
+//
+// MessageId: hrRecordClusteredChanged
+//
+// MessageText:
+//
+// A clustered key cannot be changed.
+//
+#define hrRecordClusteredChanged ((HRESULT)0xC8000644L)
+
+//
+// MessageId: hrKeyDuplicate
+//
+// MessageText:
+//
+// The key already exists.
+//
+#define hrKeyDuplicate ((HRESULT)0xC8000645L)
+
+//
+// MessageId: hrAlreadyPrepared
+//
+// MessageText:
+//
+// The current entry has already been copied or cleared.
+//
+#define hrAlreadyPrepared ((HRESULT)0xC8000647L)
+
+//
+// MessageId: hrKeyNotMade
+//
+// MessageText:
+//
+// No key was made.
+//
+#define hrKeyNotMade ((HRESULT)0xC8000648L)
+
+//
+// MessageId: hrUpdateNotPrepared
+//
+// MessageText:
+//
+// Update was not prepared.
+//
+#define hrUpdateNotPrepared ((HRESULT)0xC8000649L)
+
+//
+// MessageId: hrwrnDataHasChanged
+//
+// MessageText:
+//
+// Data has changed.
+//
+#define hrwrnDataHasChanged ((HRESULT)0x8800064AL)
+
+//
+// MessageId: hrerrDataHasChanged
+//
+// MessageText:
+//
+// The operation was abandoned because data has changed.
+//
+#define hrerrDataHasChanged ((HRESULT)0xC800064BL)
+
+//
+// MessageId: hrKeyChanged
+//
+// MessageText:
+//
+// Moved to a new key.
+//
+#define hrKeyChanged ((HRESULT)0x88000652L)
+
+//
+// MessageId: hrTooManySorts
+//
+// MessageText:
+//
+// There are too many sort processes.
+//
+#define hrTooManySorts ((HRESULT)0xC80006A5L)
+
+//
+// MessageId: hrInvalidOnSort
+//
+// MessageText:
+//
+// An operation that is not valid occurred in the sort.
+//
+#define hrInvalidOnSort ((HRESULT)0xC80006A6L)
+
+//
+// MessageId: hrTempFileOpenError
+//
+// MessageText:
+//
+// Unable to open the temporary file.
+//
+#define hrTempFileOpenError ((HRESULT)0xC800070BL)
+
+//
+// MessageId: hrTooManyAttachedDatabases
+//
+// MessageText:
+//
+// There are too many databases open.
+//
+#define hrTooManyAttachedDatabases ((HRESULT)0xC800070DL)
+
+//
+// MessageId: hrDiskFull
+//
+// MessageText:
+//
+// The disk is full.
+//
+#define hrDiskFull ((HRESULT)0xC8000710L)
+
+//
+// MessageId: hrPermissionDenied
+//
+// MessageText:
+//
+// Permission is denied.
+//
+#define hrPermissionDenied ((HRESULT)0xC8000711L)
+
+//
+// MessageId: hrFileNotFound
+//
+// MessageText:
+//
+// Unable to find the file.
+//
+#define hrFileNotFound ((HRESULT)0xC8000713L)
+
+//
+// MessageId: hrFileOpenReadOnly
+//
+// MessageText:
+//
+// The database file is read only.
+//
+#define hrFileOpenReadOnly ((HRESULT)0x88000715L)
+
+//
+// MessageId: hrAfterInitialization
+//
+// MessageText:
+//
+// Unable to restore after initialization.
+//
+#define hrAfterInitialization ((HRESULT)0xC800073AL)
+
+//
+// MessageId: hrLogCorrupted
+//
+// MessageText:
+//
+// The database log files are damaged.
+//
+#define hrLogCorrupted ((HRESULT)0xC800073CL)
+
+//
+// MessageId: hrInvalidOperation
+//
+// MessageText:
+//
+// The operation is not valid.
+//
+#define hrInvalidOperation ((HRESULT)0xC8000772L)
+
+//
+// MessageId: hrAccessDenied
+//
+// MessageText:
+//
+// Access is denied.
+//
+#define hrAccessDenied ((HRESULT)0xC8000773L)
+
+#endif // _EDBMSG_
diff --git a/private/utils/ntbackup/exchange/inc/jet.h b/private/utils/ntbackup/exchange/inc/jet.h
new file mode 100644
index 000000000..7ced38f62
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/jet.h
@@ -0,0 +1,1804 @@
+#if !defined(_JET_INCLUDED)
+#define _JET_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_M_ALPHA)
+#pragma pack(8)
+#else
+#pragma pack(4)
+#endif
+
+#define JET_API __stdcall
+#define JET_NODSAPI __stdcall
+
+typedef long JET_ERR;
+
+typedef unsigned long JET_INSTANCE; /* Instance Identifier */
+typedef unsigned long JET_SESID; /* Session Identifier */
+typedef unsigned long JET_TABLEID; /* Table Identifier */
+typedef unsigned long JET_COLUMNID; /* Column Identifier */
+
+typedef unsigned long JET_DBID; /* Database Identifier */
+typedef unsigned long JET_OBJTYP; /* Object Type */
+typedef unsigned long JET_COLTYP; /* Column Type */
+typedef unsigned long JET_GRBIT; /* Group of Bits */
+typedef unsigned long JET_ACM; /* Access Mask */
+typedef unsigned long JET_RNT; /* Repair Notification Type */
+
+typedef unsigned long JET_SNP; /* Status Notification Process */
+typedef unsigned long JET_SNT; /* Status Notification Type */
+typedef unsigned long JET_SNC; /* Status Notification Code */
+typedef double JET_DATESERIAL; /* JET_coltypDateTime format */
+typedef unsigned long JET_HANDLE; /* backup file handle */
+
+typedef JET_ERR (__stdcall *JET_PFNSTATUS)(JET_SESID sesid, JET_SNP snp, JET_SNT snt, void *pv);
+
+typedef struct tagCONVERT
+ {
+ char *szOldDll;
+ char *szOldSysDb;
+ unsigned long fDbAttached; // Return value indicating if Db was attached
+ } JET_CONVERT;
+
+
+typedef enum
+ {
+ opDBUTILConsistency,
+ opDBUTILDumpData,
+ opDBUTILDumpMetaData,
+ opDBUTILDumpSpace,
+ opDBUTILDumpHeader,
+ opDBUTILDumpLogfile,
+ opDBUTILDumpCheckpoint
+ } DBUTIL_OP;
+
+typedef struct tagDBUTIL
+ {
+ unsigned long cbStruct;
+ char *szDatabase;
+ char *szTable;
+ char *szIndex;
+ DBUTIL_OP op;
+ JET_GRBIT grbitOptions;
+ } JET_DBUTIL;
+
+#define JET_bitDBUtilOptionAllNodes 0x00000001
+#define JET_bitDBUtilOptionKeyStats 0x00000002
+#define JET_bitDBUtilOptionPageDump 0x00000004
+#define JET_bitDBUtilOptionDumpVerbose 0x10000000 // DEBUG only
+
+
+ /* Session information bits */
+
+#define JET_bitCIMCommitted 0x00000001
+#define JET_bitCIMDirty 0x00000002
+#define JET_bitAggregateTransaction 0x00000008
+
+ /* JetGetLastErrorInfo structure */
+
+typedef struct
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ JET_ERR err; /* Extended error code (if any) */
+ unsigned long ul1; /* First general purpose integer */
+ unsigned long ul2; /* Second general purpose integer */
+ unsigned long ul3; /* Third general purpose integer */
+ } JET_EXTERR;
+
+ /* Status Notification Structures */
+
+typedef struct /* Status Notification Progress */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ unsigned long cunitDone; /* Number of units of work completed */
+ unsigned long cunitTotal; /* Total number of units of work */
+ } JET_SNPROG;
+
+ /* ErrCount Notification Structures */
+
+typedef struct /* Status Notification Progress */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ unsigned long cRecUniqueKeyViolation;
+ unsigned long cRecTypeConversionFail;
+ unsigned long cRecRecordLocked;
+ unsigned long cRecTotal; /* Total number of units of work */
+ } JET_SNERRCNT;
+
+
+typedef struct /* Status Notification Message */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ JET_SNC snc; /* Status Notification Code */
+ unsigned long ul; /* Numeric identifier */
+ char sz[256]; /* Identifier */
+ } JET_SNMSG;
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_OBJTYP objtyp;
+ JET_DATESERIAL dtCreate;
+ JET_DATESERIAL dtUpdate;
+ JET_GRBIT grbit;
+ unsigned long flags;
+ unsigned long cRecord;
+ unsigned long cPage;
+ } JET_OBJECTINFO;
+
+
+/* required for Exchange to make RSTMAP RPC capable
+/**/
+#ifdef MIDL_PASS
+#define RPC_STRING [string]
+#else
+#define RPC_STRING
+typedef unsigned short WCHAR;
+#endif
+
+typedef struct
+ {
+ RPC_STRING char *szDatabaseName;
+ RPC_STRING char *szNewDatabaseName;
+ } JET_RSTMAP; /* restore map */
+
+/* required for Exchange unicode support
+/**/
+#define UNICODE_RSTMAP
+
+typedef struct tagJET_RSTMAPW {
+ RPC_STRING WCHAR *wszDatabaseName;
+
+ RPC_STRING WCHAR *wszNewDatabaseName;
+ } JET_RSTMAPW, *PJET_RSTMAPW;
+
+ /* The following flags appear in the grbit field above */
+
+#define JET_bitTableInfoUpdatable 0x00000001
+#define JET_bitTableInfoBookmark 0x00000002
+#define JET_bitTableInfoRollback 0x00000004
+#define JET_bitTableInfoRestartable 0x00000008
+#define JET_bitTableInfoNoInserts 0x00000010
+
+ /* The following flags occur in the flags field above */
+
+#define JET_bitSaveUIDnPWD 0x20000000 /* this bit is only */
+ /* appropriate for rmt links */
+#define JET_bitObjectExclusive 0x40000000 /* Open link exclusively */
+#define JET_bitObjectSystem 0x80000000
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidcontainername;
+ JET_COLUMNID columnidobjectname;
+ JET_COLUMNID columnidobjtyp;
+ JET_COLUMNID columniddtCreate;
+ JET_COLUMNID columniddtUpdate;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidflags;
+ JET_COLUMNID columnidcRecord; /* Level 2 info */
+ JET_COLUMNID columnidcPage; /* Level 2 info */
+ } JET_OBJECTLIST;
+
+#define cObjectInfoCols 9
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidSid;
+ JET_COLUMNID columnidACM;
+ JET_COLUMNID columnidgrbit; /* grbit from JetSetAccess */
+ } JET_OBJECTACMLIST;
+
+#define cObjectAcmCols 3
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidPresentationOrder;
+ JET_COLUMNID columnidcolumnname;
+ JET_COLUMNID columnidcolumnid;
+ JET_COLUMNID columnidcoltyp;
+ JET_COLUMNID columnidCountry;
+ JET_COLUMNID columnidLangid;
+ JET_COLUMNID columnidCp;
+ JET_COLUMNID columnidCollate;
+ JET_COLUMNID columnidcbMax;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidDefault;
+ JET_COLUMNID columnidBaseTableName;
+ JET_COLUMNID columnidBaseColumnName;
+ JET_COLUMNID columnidDefinitionName;
+ } JET_COLUMNLIST;
+
+#define cColumnInfoCols 14
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_COLUMNID columnid;
+ JET_COLTYP coltyp;
+ unsigned short wCountry;
+ unsigned short langid;
+ unsigned short cp;
+ unsigned short wCollate; /* Must be 0 */
+ unsigned long cbMax;
+ JET_GRBIT grbit;
+ } JET_COLUMNDEF;
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_COLUMNID columnid;
+ JET_COLTYP coltyp;
+ unsigned short wCountry;
+ unsigned short langid;
+ unsigned short cp;
+ unsigned short wFiller; /* Must be 0 */
+ unsigned long cbMax;
+ JET_GRBIT grbit;
+ char szBaseTableName[256];
+ char szBaseColumnName[256];
+ } JET_COLUMNBASE;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidindexname;
+ JET_COLUMNID columnidgrbitIndex;
+ JET_COLUMNID columnidcKey;
+ JET_COLUMNID columnidcEntry;
+ JET_COLUMNID columnidcPage;
+ JET_COLUMNID columnidcColumn;
+ JET_COLUMNID columnidiColumn;
+ JET_COLUMNID columnidcolumnid;
+ JET_COLUMNID columnidcoltyp;
+ JET_COLUMNID columnidCountry;
+ JET_COLUMNID columnidLangid;
+ JET_COLUMNID columnidCp;
+ JET_COLUMNID columnidCollate;
+ JET_COLUMNID columnidgrbitColumn;
+ JET_COLUMNID columnidcolumnname;
+ } JET_INDEXLIST;
+
+
+
+typedef struct tag_JET_COLUMNCREATE
+ {
+ unsigned long cbStruct; // size of this structure (for future expansion)
+ char *szColumnName; // column name
+ JET_COLTYP coltyp; // column type
+ unsigned long cbMax; // the maximum length of this column (only relevant for binary and text columns)
+ JET_GRBIT grbit; // column options
+ void *pvDefault; // default value (NULL if none)
+ unsigned long cbDefault; // length of default value
+ unsigned long cp; // code page (for text columns only)
+ JET_COLUMNID columnid; // returned column id
+ JET_ERR err; // returned error code
+ } JET_COLUMNCREATE;
+
+
+typedef struct tagJET_INDEXCREATE
+ {
+ unsigned long cbStruct; // size of this structure (for future expansion)
+ char *szIndexName; // index name
+ char *szKey; // index key
+ unsigned long cbKey; // length of key
+ JET_GRBIT grbit; // index options
+ unsigned long ulDensity; // index density
+ JET_ERR err; // returned error code
+ } JET_INDEXCREATE;
+
+
+typedef struct tagJET_TABLECREATE
+ {
+ unsigned long cbStruct; // size of this structure (for future expansion)
+ char *szTableName; // name of table to create.
+ unsigned long ulPages; // initial pages to allocate for table.
+ unsigned long ulDensity; // table density.
+ JET_COLUMNCREATE *rgcolumncreate; // array of column creation info
+ unsigned long cColumns; // number of columns to create
+ JET_INDEXCREATE *rgindexcreate; // array of index creation info
+ unsigned long cIndexes; // number of indexes to create
+ JET_GRBIT grbit; // Abort column/index creation on error?
+ JET_TABLEID tableid; // returned tableid.
+ unsigned long cCreated; // count of objects created (columns+table+indexes).
+ } JET_TABLECREATE;
+
+
+#define cIndexInfoCols 15
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidReferenceName;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidcColumn;
+ JET_COLUMNID columnidiColumn;
+ JET_COLUMNID columnidReferencingTableName;
+ JET_COLUMNID columnidReferencingColumnName;
+ JET_COLUMNID columnidReferencedTableName;
+ JET_COLUMNID columnidReferencedColumnName;
+ } JET_RELATIONSHIPLIST;
+
+/* for backward compatibility */
+typedef JET_RELATIONSHIPLIST JET_REFERENCELIST;
+
+#define cReferenceInfoCols 8
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_COLUMNID columnidNextTagged;
+ } JET_RETINFO;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ } JET_SETINFO;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long centriesLT;
+ unsigned long centriesInRange;
+ unsigned long centriesTotal;
+ } JET_RECPOS;
+
+typedef struct
+ {
+ unsigned long cDiscont;
+ unsigned long cUnfixedMessyPage;
+ unsigned long centriesLT;
+ unsigned long centriesTotal;
+ unsigned long cpgCompactFreed;
+ } JET_OLCSTAT;
+
+typedef struct
+ {
+ unsigned long ctableid;
+ JET_TABLEID rgtableid[1];
+ } JET_MGBLIST;
+
+/*** Property Manager Structure ***/
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ JET_COLUMNID columnidColumnName;
+ JET_COLUMNID columnidPropertyName;
+ JET_COLUMNID columnidGrbit;
+ JET_COLUMNID columnidPropertyValue;
+ JET_COLUMNID columnidColtyp;
+ } JET_PROPERTYLIST;
+
+
+/************************************************************************/
+/************************* JET CONSTANTS ************************/
+/************************************************************************/
+
+#define JET_tableidNil ((JET_TABLEID) 0xFFFFFFFF)
+
+#define JET_sesidNil ((JET_SESID) 0xFFFFFFFF)
+
+ /* Max size of a bookmark */
+
+#define JET_cbBookmarkMost 4
+
+ /* Max length of a object/column/index/property name */
+
+#define JET_cbNameMost 64
+
+ /* Max length of a "name.name.name..." construct */
+
+#define JET_cbFullNameMost 255
+
+ /* Max size of long-value column chunk */
+
+#define JET_cbColumnLVChunkMost 4035
+
+ /* Max size of non-long-value column data */
+
+#define JET_cbColumnMost 255
+
+ /* Max size of a sort/index key */
+
+#define JET_cbKeyMost 255
+
+ /* Max number of components in a sort/index key */
+
+#define JET_ccolKeyMost 12
+
+ /* Max number of columns in a table/query */
+
+#define JET_ccolTableMost 255
+
+ /* Max Length of a property in the property manager */
+#define JET_cbPropertyMost 2048
+
+ /* Largest initial substring of a long value used in an expression */
+
+#define JET_cbExprLVMost 0x8000L /*** 32 K ***/
+
+ /* Max size of returned (from SQLDriverConnect) conn string */
+
+#define JET_cbConnectMost 255
+
+ /* Max number of levels in an MGB */
+
+#define JET_wGroupLevelMax 12
+
+ /* Size restrictions for Pins */
+#define JET_cchPINMax 20
+#define JET_cchPINMin 4
+
+ /* System parameter codes for JetSetSystemParameter */
+
+/* not supported */
+#define JET_paramPfnStatus 2 /* Status callback function */
+#define JET_paramPfnError 3 /* Error callback function */
+#define JET_paramHwndODBC 4 /* Window handle for ODBC use */
+#define JET_paramIniPath 5 /* Path to the ini file */
+#define JET_paramPageTimeout 6 /* Red ISAM page timeout value */
+#define JET_paramODBCQueryTimeout 7 /* ODBC async query timeout value */
+#define JET_paramODBCLoginTimeout 25 /* ODBC connection attempt timeout value */
+#define JET_paramExprObject 26 /* Expression Evaluation callback */
+#define JET_paramGetTypeComp 27 /* Expression Evaluation callback */
+#define JET_paramHostVersion 28 /* Host Version callback */
+#define JET_paramSQLTraceMode 29 /* Enable/disable SQL tracing */
+#define JET_paramEventId 46 /* NT event id */
+#define JET_paramEventCategory 47 /* NT event category */
+#define JET_paramRmtXactIsolation 39 /* Do not share connections with other sessions */
+#define JET_paramJetInternal 35 /* Whether internal to JET; if set, allows ISAM to do things which are prevented in general */
+#define JET_paramFullQJet 38 /* Allow full QJet functionality */
+
+#define JET_paramLogFlushThreshold 18 /* log buffer flush threshold in 512 bytes [10] */
+#define JET_paramLogFlushPeriod 22 /* log flush period in miliseconds [45] */
+
+#define JET_paramOnLineCompact 37 /* Options for compact pages on-line */
+#define JET_paramRecovery 30 /* Switch for log on/off */
+
+/* debug only not supported */
+#define JET_paramTransactionLevel 32 /* Transaction level of session */
+#define JET_paramAssertAction 44 /* debug only determines action on assert */
+#define JET_paramPrintFunction 49 /* debug only. synched print function */
+#define JET_paramRFS2IOsPermitted 54 /* # IOs permitted to succeed (-1 = all) */
+#define JET_paramRFS2AllocsPermitted 55 /* # allocs permitted to success (-1 = all) */
+
+/* fully supported parameters */
+/* Note that one page = 4kBytes.
+/**/
+#define JET_paramSysDbPath 0 /* path to the system database (defunct) ["<base name>.<base ext>"] */
+#define JET_paramSystemPath 0 /* path to check point file ["."] */
+#define JET_paramTempPath 1 /* path to the temporary database ["."] */
+#define JET_paramMaxBuffers 8 /* maximum page cache size in pages [512] */
+#define JET_paramMaxSessions 9 /* maximum number of sessions [128] */
+#define JET_paramMaxOpenTables 10 /* maximum number of open tables [300] */
+#define JET_paramPreferredMaxOpenTables 59 /* prefered maximum number of open tables [300] */
+#define JET_paramMaxVerPages 11 /* maximum version store size in 16KB buckets [64] */
+#define JET_paramMaxCursors 12 /* maximum number of open cursors [1024] */
+#define JET_paramLogFilePath 13 /* path to the log file directory ["."] */
+#define JET_paramMaxOpenTableIndexes 14 /* maximum open table indexes [300] */
+#define JET_paramMaxTemporaryTables 15 /* maximum concurrent JetCreateIndex [20] */
+#define JET_paramLogBuffers 16 /* maximum log buffers in 512 bytes [21] */
+#define JET_paramLogFileSize 17 /* maximum log file size in kBytes [5120] */
+#define JET_paramBfThrshldLowPrcnt 19 /* low percentage clean buffer flush start [20] */
+#define JET_paramBfThrshldHighPrcnt 20 /* high percentage clean buffer flush stop [80] */
+#define JET_paramWaitLogFlush 21 /* log flush wait time in milliseconds [15] */
+#define JET_paramLogCheckpointPeriod 23 /* checkpoint period in 512 bytes [1024] */
+#define JET_paramLogWaitingUserMax 24 /* maximum sessions waiting log flush [3] */
+#define JET_paramSessionInfo 33 /* per session information [0] */
+#define JET_paramPageFragment 34 /* maximum disk extent considered fragment in pages [8] */
+#define JET_paramMaxOpenDatabases 36 /* maximum number of open databases [100] */
+#define JET_paramBufBatchIOMax 41 /* maximum batch IO in pages [64] */
+#define JET_paramPageReadAheadMax 42 /* maximum read-ahead IO in pages [20] */
+#define JET_paramAsynchIOMax 43 /* maximum asynchronous IO in pages [64] */
+#define JET_paramEventSource 45 /* language independant process descriptor string [""] */
+#define JET_paramDbExtensionSize 48 /* database extension size in pages [16] */
+#define JET_paramCommitDefault 50 /* default grbit for JetCommitTransaction [0] */
+#define JET_paramBufLogGenAgeThreshold 51 /* age threshold in log files [2] */
+#define JET_paramCircularLog 52 /* boolean flag for circular logging [0] */
+#define JET_paramPageTempDBMin 53 /* minimum size temporary database in pages [0] */
+#define JET_paramBaseName 56 /* base name for all DBMS object names ["edb"] */
+#define JET_paramBaseExtension 57 /* base extension for all DBMS object names ["edb"] */
+#define JET_paramTableClassName 58 /* table stats class name (class #, string) */
+
+ /* Flags for JetTerm2 */
+
+#define JET_bitTermComplete 0x00000001
+#define JET_bitTermAbrupt 0x00000002
+
+ /* Flags for JetIdle */
+
+#define JET_bitIdleRemoveReadLocks 0x00000001
+#define JET_bitIdleFlushBuffers 0x00000002
+#define JET_bitIdleCompact 0x00000004
+#define JET_bitIdleStatus 0x80000000
+
+ /* Flags for JetEndSession */
+
+#define JET_bitForceSessionClosed 0x00000001
+
+ /* Flags for JetOpenDatabase */
+
+#define JET_bitDbReadOnly 0x00000001
+#define JET_bitDbExclusive 0x00000002 /* multiple opens allowed */
+#define JET_bitDbRemoteSilent 0x00000004
+#define JET_bitDbSingleExclusive 0x00000008 /* opened exactly once */
+
+ /* Flags for JetCloseDatabase */
+
+#define JET_bitDbForceClose 0x00000001
+
+ /* Flags for JetCreateDatabase */
+
+#define JET_bitDbVersion10 0x00000002 /* INTERNAL USE ONLY */
+#define JET_bitDbVersion1x 0x00000004
+#define JET_bitDbRecoveryOff 0x00000008 /* disable logging/recovery for this database */
+#define JET_bitDbNoLogging JET_bitDbRecoveryOff
+#define JET_bitDbCompleteConnstr 0x00000020
+#define JET_bitDbVersioningOff 0x00000040
+
+ /* Flags for JetBackup */
+
+#define JET_bitBackupIncremental 0x00000001
+#define JET_bitKeepOldLogs 0x00000002
+#define JET_bitBackupAtomic 0x00000004
+
+ /* Database types */
+
+#define JET_dbidNil ((JET_DBID) 0xFFFFFFFF)
+#define JET_dbidNoValid ((JET_DBID) 0xFFFFFFFE) /* used as a flag to indicate that there is no valid dbid */
+
+ /* Flags for JetCreateLink */
+
+/* Can use JET_bitObjectExclusive to cause linked to database to be opened */
+/* exclusively. */
+
+
+
+ /* Flags for JetCreateTableColumnIndex */
+#define JET_bitTableCreateCheckColumnNames 0x00000001 /* Ensures that each column
+ /* specified in the JET_COLUMNCREATE
+ /* array has a unique name
+ /* (for performance reasons,
+ /* the default is to NOT perform
+ /* this check and rely on the
+ /* function caller to ensure
+ /* column name uniqueness).
+ /**/
+#define JET_bitTableCreateCompaction 0x40000000 /* Internal grbit used when
+ /* creating a table during
+ /* off-line compact.
+ /**/
+#define JET_bitTableCreateSystemTable 0x80000000 /* Internal grbit used when
+ /* creating system tables.
+ /**/
+
+
+ /* Flags for JetAddColumn, JetGetColumnInfo, JetOpenTempTable */
+
+#define JET_bitColumnFixed 0x00000001
+#define JET_bitColumnTagged 0x00000002
+#define JET_bitColumnNotNULL 0x00000004
+#define JET_bitColumnVersion 0x00000008
+#define JET_bitColumnAutoincrement 0x00000010
+#define JET_bitColumnUpdatable 0x00000020 /* JetGetColumnInfo only */
+#define JET_bitColumnTTKey 0x00000040 /* JetOpenTempTable only */
+#define JET_bitColumnTTDescending 0x00000080 /* JetOpenTempTable only */
+#define JET_bitColumnNotLast 0x00000100 /* Installable ISAM option */
+#define JET_bitColumnRmtGraphic 0x00000200 /* JetGetColumnInfo */
+#define JET_bitColumnMultiValued 0x00000400
+#define JET_bitColumnColumnGUID 0x00000800
+#define JET_bitColumnMostMany 0x00001000
+#define JET_bitColumnPreventDelete 0x00002000
+
+ /* Flags for JetSetCurrentIndex */
+
+#define JET_bitMoveFirst 0x00000000
+#define JET_bitMoveBeforeFirst 0x00000001
+#define JET_bitNoMove 0x00000002
+
+ /* Flags for JetMakeKey */
+
+#define JET_bitNewKey 0x00000001
+#define JET_bitStrLimit 0x00000002
+#define JET_bitSubStrLimit 0x00000004
+#define JET_bitNormalizedKey 0x00000008
+#define JET_bitKeyDataZeroLength 0x00000010
+
+#ifdef DBCS /* johnta: LIKE "ABC" not converted to ="ABC" for Japanese */
+#define JET_bitLikeExtra1 0x00000020
+#endif /* DBCS */
+
+ /* Flags for ErrDispSetIndexRange */
+
+#define JET_bitRangeInclusive 0x00000001
+#define JET_bitRangeUpperLimit 0x00000002
+#define JET_bitRangeInstantDuration 0x00000004
+#define JET_bitRangeRemove 0x00000008
+
+ /* Constants for JetMove */
+
+#define JET_MoveFirst (0x80000000)
+#define JET_MovePrevious (-1)
+#define JET_MoveNext (+1)
+#define JET_MoveLast (0x7fffffff)
+
+ /* Flags for JetMove */
+
+#define JET_bitMoveKeyNE 0x00000001
+#define JET_bitMoveCheckTS 0x00000002
+#define JET_bitMoveInPage 0x00000004
+
+ /* Flags for JetSeek */
+
+#define JET_bitSeekEQ 0x00000001
+#define JET_bitSeekLT 0x00000002
+#define JET_bitSeekLE 0x00000004
+#define JET_bitSeekGE 0x00000008
+#define JET_bitSeekGT 0x00000010
+#define JET_bitSetIndexRange 0x00000020
+
+ /* Flags for JetFastFind */
+
+#define JET_bitFFindBackwards 0x00000001
+#define JET_bitFFindFromCursor 0x00000004
+
+ /* Flags for JetCreateIndex */
+
+#define JET_bitIndexUnique 0x00000001
+#define JET_bitIndexPrimary 0x00000002
+#define JET_bitIndexDisallowNull 0x00000004
+#define JET_bitIndexIgnoreNull 0x00000008
+#define JET_bitIndexClustered 0x00000010
+#define JET_bitIndexIgnoreAnyNull 0x00000020
+#define JET_bitIndexIgnoreFirstNull 0x00000040
+#define JET_bitIndexLazyFlush 0x00000080
+#define JET_bitIndexEmptyTable 0x40000000 // Internal use only
+#define JET_bitIndexReference 0x80000000 /* IndexInfo only */
+
+ /* Flags for index key definition */
+
+#define JET_bitKeyAscending 0x00000000
+#define JET_bitKeyDescending 0x00000001
+
+
+ /* Flags for JetCreateRelationship */
+
+#define JET_bitRelationUnique 0x00000001
+#define JET_bitRelationDontEnforce 0x00000002
+#define JET_bitRelationInherited 0x00000004
+#define JET_bitRelationTestLegal 0x00000008 /* don't create relationship */
+
+#define JET_bitRelationshipMatchMask 0x000000F0
+#define JET_bitRelationMatchDefault 0x00000000
+#define JET_bitRelationMatchFull 0x00000010
+
+#define JET_bitRelationUpdateActionMask 0x00000F00
+#define JET_bitRelationUpdateDisallow 0x00000000
+#define JET_bitRelationUpdateCascade 0x00000100
+#define JET_bitRelationUpdateSetNull 0x00000200
+#define JET_bitRelationUpdateSetDefault 0x00000300
+
+#define JET_bitRelationDeleteActionMask 0x0000F000
+#define JET_bitRelationDeleteDisallow 0x00000000
+#define JET_bitRelationDeleteCascade 0x00001000
+#define JET_bitRelationDeleteSetNull 0x00002000
+#define JET_bitRelationDeleteSetDefault 0x00003000
+
+#define JET_bitRelationUserMask 0xFF000000 /* non-enforced values */
+#define JET_bitRelationJoinMask 0x03000000
+#define JET_bitRelationInner 0x00000000
+#define JET_bitRelationLeft 0x01000000
+#define JET_bitRelationRight 0x02000000
+
+
+ /* Flags for JetCreateReference/JetCreateRelationship */
+ /* NOTE: use the bitRelationship flags instead! */
+
+#define JET_ReferenceUnique JET_bitRelationUnique
+#define JET_ReferenceDontEnforce JET_bitRelationDontEnforce
+#define JET_ReferenceMatchTypeMask JET_bitRelationMatchMask
+#define JET_ReferenceMatchDefault JET_bitRelationMatchDefault
+#define JET_ReferenceMatchFull JET_bitRelationMatchFull
+#define JET_ReferenceUpdateActionMask JET_bitRelationUpdateActionMask
+#define JET_ReferenceUpdateDisallow JET_bitRelationUpdateDisallow
+#define JET_ReferenceUpdateCascade JET_bitRelationUpdateCascade
+#define JET_ReferenceUpdateSetNull JET_bitRelationUpdateSetNull
+#define JET_ReferenceUpdateSetDefault JET_bitRelationUpdateSetDefault
+#define JET_ReferenceDeleteActionMask JET_bitRelationDeleteActionMask
+#define JET_ReferenceDeleteDisallow JET_bitRelationDeleteDisallow
+#define JET_ReferenceDeleteCascade JET_bitRelationDeleteCascade
+#define JET_ReferenceDeleteSetNull JET_bitRelationDeleteSetNull
+#define JET_ReferenceDeleteSetDefault JET_bitRelationDeleteSetDefault
+
+
+ /* Flags for JetOpenTable */
+
+#define JET_bitTableDenyWrite 0x00000001
+#define JET_bitTableDenyRead 0x00000002
+#define JET_bitTableReadOnly 0x00000004
+#define JET_bitTableAppendOnly 0x00000008
+#define JET_bitTableUpdatable 0x00000010
+#define JET_bitTableScrollable 0x00000020
+#define JET_bitTableFixedSet 0x00000040 /* Fixed working set */
+#define JET_bitTableInconsistent 0x00000080
+#define JET_bitTableBulk 0x00000100
+#define JET_bitTableUsePrimaryIndex 0x00000200 /* Use with FixedSet */
+#define JET_bitTableSampleData 0x00000400
+#define JET_bitTableQuickBrowse 0x00000800 /* Bias optimizer toward index usage */
+#define JET_bitTableDDL 0x00001000 /* similar to JET_bitTableBulk, for DDL */
+#define JET_bitTablePassThrough 0x00002000 /* Remote DBs Only */
+#define JET_bitTableRowReturning 0x00004000
+#define JET_bitTableSequential 0x00008000 /* Intend to access table sequentially */
+
+#define JET_bitTableClassMask 0x000F0000 /* table stats class mask */
+#define JET_bitTableClassNone 0x00000000 /* table belongs to no stats class (default) */
+#define JET_bitTableClass1 0x00010000 /* table belongs to stats class 1 */
+#define JET_bitTableClass2 0x00020000 /* table belongs to stats class 2 */
+#define JET_bitTableClass3 0x00030000 /* table belongs to stats class 3 */
+#define JET_bitTableClass4 0x00040000 /* table belongs to stats class 4 */
+#define JET_bitTableClass5 0x00050000 /* table belongs to stats class 5 */
+#define JET_bitTableClass6 0x00060000 /* table belongs to stats class 6 */
+#define JET_bitTableClass7 0x00070000 /* table belongs to stats class 7 */
+#define JET_bitTableClass8 0x00080000 /* table belongs to stats class 8 */
+#define JET_bitTableClass9 0x00090000 /* table belongs to stats class 9 */
+#define JET_bitTableClass10 0x000A0000 /* table belongs to stats class 10 */
+#define JET_bitTableClass11 0x000B0000 /* table belongs to stats class 11 */
+#define JET_bitTableClass12 0x000C0000 /* table belongs to stats class 12 */
+#define JET_bitTableClass13 0x000D0000 /* table belongs to stats class 13 */
+#define JET_bitTableClass14 0x000E0000 /* table belongs to stats class 14 */
+#define JET_bitTableClass15 0x000F0000 /* table belongs to stats class 15 */
+
+ /* Flags for JetSetQoSql/JetRetrieveQoSql */
+#define JET_bitSqlPassThrough 0x00000001 /* Pass through Query returning records */
+#define JET_bitSqlSPTBulkOp 0x00000002 /* SPT query returning no table */
+
+ /* Flags for JetOpenVtQbe */
+
+#define JET_bitQBEAddBrackets 0x00000001
+#define JET_bitQBERemoveEquals 0x00000002
+
+ /* Flags for JetOpenTempTable and ErrIsamOpenTempTable */
+
+#define JET_bitTTIndexed 0x00000001 /* Allow seek */
+#define JET_bitTTUnique 0x00000002 /* Remove duplicates */
+#define JET_bitTTUpdatable 0x00000004 /* Allow updates */
+#define JET_bitTTScrollable 0x00000008 /* Allow backwards scrolling */
+
+ /* Flags for JetSetColumn */
+
+#define JET_bitSetAppendLV 0x00000001
+#define JET_bitSetValidate 0x00000002
+#define JET_bitSetOverwriteLV 0x00000004 /* overwrite JET_coltypLong* byte range */
+#define JET_bitSetSizeLV 0x00000008 /* set JET_coltypLong* size */
+#define JET_bitSetValidateColumn 0x00000010
+#define JET_bitSetZeroLength 0x00000020
+#define JET_bitSetSeparateLV 0x00000040 /* force LV separation */
+#define JET_bitSetNoVersion 0x00000080 /* INTERNAL USE ONLY */
+
+ /* Set column parameter structure for JetSetColumns */
+
+typedef struct {
+ JET_COLUMNID columnid;
+ const void *pvData;
+ unsigned long cbData;
+ JET_GRBIT grbit;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_ERR err;
+} JET_SETCOLUMN;
+
+ /* Options for JetPrepareUpdate */
+
+#define JET_prepInsert 0
+#define JET_prepInsertBeforeCurrent 1
+#define JET_prepReplace 2
+#define JET_prepCancel 3
+#define JET_prepReplaceNoLock 4
+#define JET_prepInsertCopy 5
+
+ /* Flags for JetRetrieveColumn */
+
+#define JET_bitRetrieveCopy 0x00000001
+#define JET_bitRetrieveFromIndex 0x00000002
+#define JET_bitRetrieveCase 0x00000004
+#define JET_bitRetrieveTag 0x00000008
+#define JET_bitRetrieveNull 0x00000010 /* for columnid 0 only */
+#define JET_bitRetrieveIgnoreDefault 0x00000020 /* for columnid 0 only */
+#define JET_bitRetrieveLongId 0x00000040
+#define JET_bitRetrieveRecord 0x80000000
+#define JET_bitRetrieveFDB 0x40000000
+#define JET_bitRetrieveBookmarks 0x20000000
+
+ /* Retrieve column parameter structure for JetRetrieveColumns */
+
+typedef struct {
+ JET_COLUMNID columnid;
+ void *pvData;
+ unsigned long cbData;
+ unsigned long cbActual;
+ JET_GRBIT grbit;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_COLUMNID columnidNextTagged;
+ JET_ERR err;
+} JET_RETRIEVECOLUMN;
+
+ /* Flags for JetFillFatCursor */
+
+#define JET_bitFCFillRange 0x00000001
+#define JET_bitFCRefreshRange 0x00000002
+#define JET_bitFCFillMemos 0x00000004
+
+ /* Flags for JetCommitTransaction */
+
+#define JET_bitCommitFlush 0x00000001 /* commit and flush page buffers. */
+#define JET_bitCommitLazyFlush 0x00000004 /* lazy flush log buffers. */
+#define JET_bitWaitLastLevel0Commit 0x00000010 /* wait for last level 0 commit record flushed */
+
+ /* Flags for JetRollback */
+
+#define JET_bitRollbackAll 0x00000001
+
+ /* Flags for JetSetAccess and JetGetAccess */
+
+#define JET_bitACEInheritable 0x00000001
+
+ /* Flags for JetCreateSystemDatabase */
+
+#define JET_bitSysDbOverwrite 0x00000001
+
+ /* Flags for Jet Property Management */
+#define JET_bitPropDDL 0x00000001 /* also used for setting */
+#define JET_bitPropInherited 0x00000002 /* not used for setting */
+
+ /* JPM Flags that are only used for setting properties */
+#define JET_bitPropReplaceOnly 0x00000010
+#define JET_bitPropInsertOnly 0x00000020
+#define JET_bitPropDeleteOnly 0x00000040
+
+ /* InfoLevels for Jet Property Management */
+#define JET_PropertyValue 0
+#define JET_PropertyCount 1
+#define JET_PropertySingleCollection 2
+#define JET_PropertyAllCollections 3
+
+ /* Collate values for JetGetColumnInfo and JetGetIndexInfo */
+
+#define JET_sortBinary 0x0000
+#define JET_sortEFGPI 0x0100
+#define JET_sortSNIFD 0x0101
+#define JET_sortSpanish 0x0102
+#define JET_sortDutch 0x0103
+#define JET_sortSweFin 0x0104
+#define JET_sortNorDan 0x0105
+#define JET_sortIcelandic 0x0106
+#define JET_sortCyrillic 0x0107
+#define JET_sortCzech 0x0108
+#define JET_sortHungarian 0x0109
+#define JET_sortPolish 0x010A
+#define JET_sortArabic 0x010B
+#define JET_sortHebrew 0x010C
+#define JET_sortMax 0x010C /* Max for nonDBCS sort orders */
+
+#ifdef DBCS /* johnta: Add the new Japanese sorting order */
+#define JET_sortJapanese 0x010D
+#endif /* DBCS */
+
+#define JET_sortUnknown 0xFFFF
+
+ /* Paradox ISAM specific collate values */
+
+#define JET_sortPdxIntl 0x1000
+#define JET_sortPdxSwedFin 0x1001
+#define JET_sortPdxNorDan 0x1002
+
+ /* Info parameter for JetGetDatabaseInfo */
+
+#define JET_DbInfoFilename 0
+#define JET_DbInfoConnect 1
+#define JET_DbInfoCountry 2
+#define JET_DbInfoLangid 3
+#define JET_DbInfoCp 4
+#define JET_DbInfoCollate 5
+#define JET_DbInfoOptions 6
+#define JET_DbInfoTransactions 7
+#define JET_DbInfoVersion 8
+#define JET_DbInfoIsam 9
+#define JET_DbInfoFilesize 10
+#define JET_DbInfoSpaceOwned 11
+#define JET_DbInfoSpaceAvailable 12
+
+ /* Database versions returned by JetGetDatabaseInfo */
+
+#define JET_DbVersion10 0x00010000
+#define JET_DbVersion11 0x00010001
+#define JET_DbVersion20 0x00020000
+
+
+ /* Isam specific info returned by JetGetDatabaseInfo */
+
+#define JET_IsamInvalid 0
+#define JET_IsamBuiltinRed 1
+#define JET_IsamBuiltinBlue 2
+
+#define JET_IsamInstRed 21
+#define JET_IsamInstBlue 22
+#define JET_IsamInstFox 23
+#define JET_IsamInstParadox 24
+#define JET_IsamInstDbase 25
+#define JET_IsamInstBtrieve 26
+
+#define JET_IsamBuilinMost JET_BuiltinBlue
+#define JET_IsamInstMin JET_IsamInstRed
+#define JET_IsamInstMost JET_IsamInstBtrieve
+
+ /* Link specific info for link identification */
+#define JET_bitLinkInvalid 0x00000000
+#define JET_bitLinkRemote 0x00100000
+#define JET_bitLinkBuiltinRed 0x00200000
+#define JET_bitLinkBuiltinBlue 0x00300000
+#define JET_bitLinkInstRed 0x00400000
+#define JET_bitLinkInstBlue 0x00500000
+#define JET_bitLinkInstFox 0x00600000
+#define JET_bitLinkInstParadox 0x00700000
+#define JET_bitLinkInstDbase 0x00800000
+#define JET_bitLinkInstBtrieve 0x00900000
+
+#define JET_bitFourByteBookmark 0x00000001
+#define JET_bitContiguousBookmarks 0x00000002
+
+ /* Column data types */
+
+#define JET_coltypNil 0
+#define JET_coltypBit 1 /* True or False, Never NULL */
+#define JET_coltypUnsignedByte 2 /* 1-byte integer, unsigned */
+#define JET_coltypShort 3 /* 2-byte integer, signed */
+#define JET_coltypLong 4 /* 4-byte integer, signed */
+#define JET_coltypCurrency 5 /* 8 byte integer, signed */
+#define JET_coltypIEEESingle 6 /* 4-byte IEEE single precision */
+#define JET_coltypIEEEDouble 7 /* 8-byte IEEE double precision */
+#define JET_coltypDateTime 8 /* Integral date, fractional time */
+#define JET_coltypBinary 9 /* Binary data, < 255 bytes */
+#define JET_coltypText 10 /* ANSI text, case insensitive, < 255 bytes */
+#define JET_coltypLongBinary 11 /* Binary data, long value */
+#define JET_coltypLongText 12 /* ANSI text, long value */
+#define JET_coltypDatabase 13 /* Database name parameter */
+#define JET_coltypTableid 14 /* Tableid parameter */
+#define JET_coltypOLE 15 /* OLE blob */
+#define JET_coltypGUID 15
+#define JET_coltypMax 16 /* the number of column types */
+ /* used for validity tests and */
+ /* array declarations. */
+
+ /* Info levels for JetGetObjectInfo */
+
+#define JET_ObjInfo 0U
+#define JET_ObjInfoListNoStats 1U
+#define JET_ObjInfoList 2U
+#define JET_ObjInfoSysTabCursor 3U
+#define JET_ObjInfoListACM 4U /* Blocked by JetGetObjectInfo */
+#define JET_ObjInfoNoStats 5U
+#define JET_ObjInfoSysTabReadOnly 6U
+#define JET_ObjInfoRulesLoaded 7U
+#define JET_ObjInfoMax 8U
+
+ /* Info levels for JetGetTableInfo */
+
+#define JET_TblInfo 0U
+#define JET_TblInfoName 1U
+#define JET_TblInfoDbid 2U
+#define JET_TblInfoMostMany 3U
+#define JET_TblInfoRvt 4U
+#define JET_TblInfoOLC 5U
+#define JET_TblInfoResetOLC 6U
+#define JET_TblInfoSpaceUsage 7U
+#define JET_TblInfoDumpTable 8U
+#define JET_TblInfoSpaceAlloc 9U
+#define JET_TblInfoSpaceOwned 10U // OwnExt
+#define JET_TblInfoSpaceAvailable 11U // AvailExt
+
+ /* Info levels for JetGetIndexInfo and JetGetTableIndexInfo */
+
+#define JET_IdxInfo 0U
+#define JET_IdxInfoList 1U
+#define JET_IdxInfoSysTabCursor 2U
+#define JET_IdxInfoOLC 3U
+#define JET_IdxInfoResetOLC 4U
+#define JET_IdxInfoSpaceAlloc 5U
+#define JET_IdxInfoLangid 6U
+#define JET_IdxInfoCount 7U
+
+ /* Info levels for JetGetReferenceInfo and JetGetTableReferenceInfo */
+
+#define JET_ReferenceInfo 0U
+#define JET_ReferenceInfoReferencing 1U
+#define JET_ReferenceInfoReferenced 2U
+#define JET_ReferenceInfoAll 3U
+#define JET_ReferenceInfoCursor 4U
+
+ /* Info levels for JetGetColumnInfo and JetGetTableColumnInfo */
+
+#define JET_ColInfo 0U
+#define JET_ColInfoList 1U
+ /* CONSIDER: Info level 2 is valid */
+#define JET_ColInfoSysTabCursor 3U
+#define JET_ColInfoBase 4U
+#define JET_ColInfoListCompact 5U
+
+
+ /* Attribute types for query definitions */
+
+#define JET_qoaBeginDef 0
+#define JET_qoaOperation 1
+#define JET_qoaParameter 2
+#define JET_qoaOptions 3
+#define JET_qoaDatabase 4
+#define JET_qoaInputTable 5
+#define JET_qoaOutput 6
+#define JET_qoaJoin 7
+#define JET_qoaRestriction 8
+#define JET_qoaGroup 9
+#define JET_qoaGroupRstr 10
+#define JET_qoaOrdering 11
+#define JET_qoaEndDef 255
+#define JET_qoaValidLeast JET_qoaOperation
+#define JET_qoaValidMost JET_qoaOrdering
+
+
+ /* Query object options */
+
+#define JET_bitFqoOutputAllCols 0x0001
+#define JET_bitFqoRemoveDups 0x0002
+#define JET_bitFqoOwnerAccess 0x0004
+#define JET_bitFqoDistinctRow 0x0008
+#define JET_bitFqoTop 0x0010
+#define JET_bitFqoPercent 0x0020
+#define JET_bitFqoCorresponding 0x0040 /* JET_qopSetOperation */
+
+ /* Query object join type */
+
+#define JET_fjoinInner 1
+#define JET_fjoinLeftOuter 2
+#define JET_fjoinRightOuter 3
+
+ /* Query object operations */
+
+#define JET_qopSelect 1
+#define JET_qopSelectInto 2
+#define JET_qopInsertSelection 3
+#define JET_qopUpdate 4
+#define JET_qopDelete 5
+#define JET_qopTransform 6
+#define JET_qopDDL 7
+#define JET_qopSqlPassThrough 8
+#define JET_qopSetOperation 9
+#define JET_qopSPTBulk 10
+
+#define JET_bitqopSelect 0x0000
+#define JET_bitqopTransform 0x0010
+#define JET_bitqopDelete 0x0020
+#define JET_bitqopUpdate 0x0030
+#define JET_bitqopInsertSelection 0x0040
+#define JET_bitqopSelectInto 0x0050
+#define JET_bitqopDDL 0x0060
+#define JET_bitqopSqlPassThrough 0x0070
+#define JET_bitqopSetOperation 0x0080
+#define JET_bitqopSPTBulk 0x0090
+
+ /* Engine Object Types */
+
+#define JET_objtypNil 0
+#define JET_objtypTable 1
+#define JET_objtypDb 2
+#define JET_objtypContainer 3
+#define JET_objtypSQLLink 4
+#define JET_objtypQuery 5
+#define JET_objtypLink 6
+#define JET_objtypTemplate 7
+#define JET_objtypRelationship 8
+
+ /* All types less than JET_objtypClientMin are reserved by JET */
+
+#define JET_objtypClientMin 0x8000
+
+ /* Security Constant Values */
+
+#define JET_cchUserNameMax 20
+#define JET_cchPasswordMax 14
+
+ /* Security Access Masks */
+
+#define JET_acmNoAccess 0x00000000L
+#define JET_acmFullAccess 0x000FFFFFL
+
+#define JET_acmSpecificMask 0x0000FFFFL
+#define JET_acmSpecific_1 0x00000001L
+#define JET_acmSpecific_2 0x00000002L
+#define JET_acmSpecific_3 0x00000004L
+#define JET_acmSpecific_4 0x00000008L
+#define JET_acmSpecific_5 0x00000010L
+#define JET_acmSpecific_6 0x00000020L
+#define JET_acmSpecific_7 0x00000040L
+#define JET_acmSpecific_8 0x00000080L
+#define JET_acmSpecific_9 0x00000100L
+#define JET_acmSpecific_10 0x00000200L
+#define JET_acmSpecific_11 0x00000400L
+#define JET_acmSpecific_12 0x00000800L
+#define JET_acmSpecific_13 0x00001000L
+#define JET_acmSpecific_14 0x00002000L
+#define JET_acmSpecific_15 0x00004000L
+#define JET_acmSpecific_16 0x00008000L
+
+#define JET_acmStandardMask 0x00FF0000L
+#define JET_acmDelete 0x00010000L
+#define JET_acmReadControl 0x00020000L
+#define JET_acmWriteDac 0x00040000L
+#define JET_acmWriteOwner 0x00080000L
+
+#define JET_acmTblCreate (JET_acmSpecific_1)
+#define JET_acmTblAccessRcols (JET_acmSpecific_2)
+#define JET_acmTblReadDef (JET_acmSpecific_3)
+#define JET_acmTblWriteDef (JET_acmSpecific_4)
+#define JET_acmTblRetrieveData (JET_acmSpecific_5)
+#define JET_acmTblInsertData (JET_acmSpecific_6)
+#define JET_acmTblReplaceData (JET_acmSpecific_7)
+#define JET_acmTblDeleteData (JET_acmSpecific_8)
+
+#define JET_acmDbCreate (JET_acmSpecific_1)
+#define JET_acmDbOpen (JET_acmSpecific_2)
+
+ /* Compact Options */
+
+#define JET_bitCompactDontCopyLocale 0x00000004 /* Don't copy locale from source to dest */
+#define JET_bitCompactVersion10 0x00000008 /* Destination is version 1.0 format */
+#define JET_bitCompactVersion1x 0x00000010 /* Destination is version 1.x format */
+#define JET_bitCompactStats 0x00000020 /* Dump off-line compaction stats (only when progress meter also specified) */
+
+ /* On-line Compact Options */
+
+#define JET_bitCompactOn 0x00000001 /* enable on-line compaction */
+
+ /* Repair Notification Types */
+
+#define JET_rntSelfContained 0
+#define JET_rntDeletedIndex 1
+#define JET_rntDeletedRec 2
+#define JET_rntDeletedLv 3
+#define JET_rntTruncated 4
+
+ /* Status Notification Processes */
+
+#define JET_snpIndex 0
+#define JET_snpQuery 1
+#define JET_snpRepair 2
+#define JET_snpImex 3
+#define JET_snpCompact 4
+#define JET_snpFastFind 5
+#define JET_snpODBCNotReady 6
+#define JET_snpQuerySort 7
+#define JET_snpRestore 8
+#define JET_snpBackup 9
+#define JET_snpUpgrade 10
+
+ /* Status Notification Types */
+
+#define JET_sntProgress 0 /* callback for progress */
+#define JET_sntMessage 1
+#define JET_sntBulkRecords 2 /* callback for # rec for bulk op */
+#define JET_sntFail 3 /* callback for failure during progress */
+#define JET_sntErrCount 4 /* callback for err count */
+#define JET_sntBegin 5 /* callback for beginning of operation */
+#define JET_sntComplete 6 /* callback for completion of operation */
+#define JET_sntCantRollback 7 /* callback for no rollback */
+#define JET_sntRestoreMap 8 /* callback for restore map */
+
+ /* Message codes for JET_snpCompact */
+
+#define JET_sncCopyObject 0 /* Starting to copy object */
+#define JET_sncCopyFailed 1 /* Copy of this object failed */
+#define JET_sncYield 2 /* Client can yield/check for user interrupt */
+#define JET_sncTransactionFull 3 /* Client can yield/check for user interrupt */
+#define JET_sncAboutToWrap 4 /* Find find is about to wrap */
+
+ /* Message codes for JET_snpODBCNotReady */
+
+#define JET_sncODBCNotReady 0 /* Waiting for results from ODBC */
+
+
+ /* Constants for the [ODBC] section of JET.INI */
+
+#define JET_SQLTraceCanonical 0x0001 /* Output ODBC Generic SQL */
+
+ /* Constants for the [Debug] section of JET.INI */
+
+ /* APITrace */
+
+#define JET_APITraceEnter 0x0001
+#define JET_APITraceExit 0x0002
+#define JET_APITraceExitError 0x0004
+#define JET_APIBreakOnError 0x0008
+#define JET_APITraceCount 0x0010
+#define JET_APITraceNoIdle 0x0020
+#define JET_APITraceParameters 0x0040
+
+ /* IdleTrace */
+
+#define JET_IdleTraceCursor 0x0001
+#define JET_IdleTraceBuffer 0x0002
+#define JET_IdleTraceFlush 0x0004
+
+ /* AssertAction */
+
+#define JET_AssertExit 0x0000 /* Exit the application */
+#define JET_AssertBreak 0x0001 /* Break to debugger */
+#define JET_AssertMsgBox 0x0002 /* Display message box */
+#define JET_AssertStop 0x0004 /* Alert and stop */
+
+ /* IOTrace */
+
+#define JET_IOTraceAlloc 0x0001 /* DB Page Allocation */
+#define JET_IOTraceFree 0x0002 /* DB Page Free */
+#define JET_IOTraceRead 0x0004 /* DB Page Read */
+#define JET_IOTraceWrite 0x0008 /* DB Page Write */
+#define JET_IOTraceError 0x0010 /* DB Page I/O Error */
+
+ /* MemTrace */
+
+#define JET_MemTraceAlloc 0x0001 /* Memory allocation */
+#define JET_MemTraceRealloc 0x0002 /* Memory reallocation */
+#define JET_MemTraceFree 0x0004 /* Memory free */
+
+ /* RmtTrace */
+
+#define JET_RmtTraceError 0x0001 /* Remote server error message */
+#define JET_RmtTraceSql 0x0002 /* Remote SQL Prepares & Exec's */
+#define JET_RmtTraceAPI 0x0004 /* Remote ODBC API calls */
+#define JET_RmtTraceODBC 0x0008
+#define JET_RmtSyncODBC 0x0010 /* Turn on ODBC Sync mode */
+
+/**********************************************************************/
+/*********************** ERROR CODES **************************/
+/**********************************************************************/
+
+/* SUCCESS */
+
+#define JET_errSuccess 0 /* Successful Operation */
+
+/* ERRORS */
+
+#define JET_wrnNyi -1 /* Function Not Yet Implemented */
+
+/* SYSTEM errors
+/**/
+#define JET_errRfsFailure -100 /* JET_errRfsFailure */
+#define JET_errRfsNotArmed -101 /* JET_errRfsFailure */
+#define JET_errFileClose -102 /* Could not close DOS file */
+#define JET_errOutOfThreads -103 /* Could not start thread */
+#define JET_errTooManyIO -105 /* System busy due to too many IOs */
+#define JET_errDatabase200Format -106 /* 200 format database */
+#define JET_errDatabase400Format -107 /* 400 format database */
+
+/* BUFFER MANAGER errors
+/**/
+#define wrnBFNotSynchronous 200 /* Buffer page evicted */
+#define wrnBFPageNotFound 201 /* Page not found */
+#define errBFInUse -202 /* Cannot abandon buffer */
+#define wrnBFNewIO 203 /* Buffer access caused a new IO (cache miss) */
+#define wrnBFCacheMiss 204 /* Buffer access was a cache miss but didn't cause a new IO */
+#define wrnBFNoBufAvailable 205 /* Need to allocate new buffer for read (used in Async IO ) */
+
+/* DIRECTORY MANAGER errors
+/**/
+#define errPMOutOfPageSpace -300 /* Out of page space */
+#define errPMItagTooBig -301 /* Itag too big */
+#define errPMRecDeleted -302 /* Record deleted */
+#define errPMTagsUsedUp -303 /* Tags used up */
+#define wrnBMConflict 304 /* conflict in BM Clean up */
+#define errDIRNoShortCircuit -305 /* No Short Circuit Avail */
+#define errDIRCannotSplit -306 /* Cannot horizontally split FDP */
+#define errDIRTop -307 /* Cannot go up */
+#define errDIRFDP 308 /* On an FDP Node */
+#define errDIRNotSynchronous -309 /* May have left critical section */
+#define wrnDIREmptyPage 310 /* Moved through empty page */
+#define errSPConflict -311 /* Device extent being extended */
+#define wrnNDFoundLess 312 /* Found Less */
+#define wrnNDFoundGreater 313 /* Found Greater */
+#define errNDOutSonRange -314 /* Son out of range */
+#define errNDOutItemRange -315 /* Item out of range */
+#define errNDGreaterThanAllItems -316 /* Greater than all items */
+#define errNDLastItemNode -317 /* Last node of item list */
+#define errNDFirstItemNode -318 /* First node of item list */
+#define wrnNDDuplicateItem 319 /* Duplicated Item */
+#define errNDNoItem -320 /* Item not there */
+#define JET_wrnRemainingVersions 321 /* Some versions couldn't be cleaned */
+#define JET_wrnPreviousVersion 322 /* Version already existed */
+#define JET_errPageBoundary -323 /* Reached Page Boundary */
+#define JET_errKeyBoundary -324 /* Reached Key Boundary */
+#define errDIRInPageFather -325 /* sridFather in page to free */
+#define errBMMaxKeyInPage -326 /* used by OLC to avoid cleanup of parent pages */
+#define JET_errBadPageLink -327 /* next/previous page link page does not point back to source */
+#define JET_errBadBookmark -328 /* bookmark has no corresponding address in database */
+#define wrnBMCleanNullOp 329 /* BMClean returns this on encountering a page
+ /* deleted MaxKeyInPage [but there was no conflict]
+
+/* RECORD MANAGER errors
+/**/
+#define wrnFLDKeyTooBig 400 /* Key too big (truncated it) */
+#define errFLDTooManySegments -401 /* Too many key segments */
+#define wrnFLDNullKey 402 /* Key is entirely NULL */
+#define wrnFLDOutOfKeys 403 /* No more keys to extract */
+#define wrnFLDNullSeg 404 /* Null segment in key */
+#define wrnRECLongField 405 /* Separated long value */
+#define JET_wrnSeparateLongValue 406 /* Separated long value */
+#define JET_wrnRecordFoundGreater JET_wrnSeekNotEqual
+#define JET_wrnRecordFoundLess JET_wrnSeekNotEqual
+#define JET_errColumnIllegalNull JET_errNullInvalid
+#define wrnFLDNullFirstSeg 407 /* Null first segment in key */
+#define JET_errKeyTooBig -408 /* Key with column truncation still truncated */
+
+/* LOGGING/RECOVERY errors
+/**/
+#define JET_errInvalidLoggedOperation -500 /* Logged operation cannot be redone */
+#define JET_errLogFileCorrupt -501 /* Log file is corrupt */
+#define errLGNoMoreRecords -502 /* Last log record read */
+#define JET_errNoBackupDirectory -503 /* No backup directory given */
+#define JET_errBackupDirectoryNotEmpty -504 /* The backup directory is not emtpy */
+#define JET_errBackupInProgress -505 /* Backup is active already */
+#define JET_errMissingPreviousLogFile -509 /* Missing the log file for check point */
+#define JET_errLogWriteFail -510 /* Fail when writing to log file */
+#define JET_errBadLogVersion -514 /* Version of log file is not compatible with Jet version */
+#define JET_errInvalidLogSequence -515 /* Timestamp in next log does not match expected */
+#define JET_errLoggingDisabled -516 /* Log is not active */
+#define JET_errLogBufferTooSmall -517 /* Log buffer is too small for recovery */
+#define errLGNotSynchronous -518 /* retry to LGLogRec */
+#define JET_errLogSequenceEnd -519 /* Exceed maximum log file number */
+#define JET_errNoBackup -520 /* No backup in progress */
+#define JET_errInvalidBackupSequence -521 /* Backup call out of sequence */
+#define JET_errBackupNotAllowedYet -523 /* Can not do backup now */
+#define JET_errDeleteBackupFileFail -524 /* Could not delete backup file */
+#define JET_errMakeBackupDirectoryFail -525 /* Could not make backup temp directory */
+#define JET_errInvalidBackup -526 /* Cannot incremental backup when circular logging enabled */
+#define JET_errRecoveredWithErrors -527 /* For repair, restored with errors */
+#define JET_errMissingLogFile -528 /* current log file missing */
+#define JET_errLogDiskFull -529 /* log disk full */
+#define JET_errBadLogSignature -530 /* bad signature for a log file */
+#define JET_errBadDbSignature -531 /* bad signature for a db file */
+#define JET_errBadCheckpointSignature -532 /* bad signature for a checkpoint file */
+#define JET_errCheckpointCorrupt -533 /* checkpoint file not found or corrupt */
+#define JET_errMissingPatchPage -534 /* patch file page not found during recovery */
+
+
+#define JET_errDatabaseInconsistent -550 /* database is in inconsistent state */
+#define JET_errConsistentTimeMismatch -551 /* database last consistent time unmatched */
+#define JET_errDatabasePatchFileMismatch -552 /* patch file is not generated from this backup */
+#define JET_errEndingRestoreLogTooLow -553 /* the starting log number too low for the restore */
+#define JET_errStartingRestoreLogTooHigh -554 /* the starting log number too high for the restore */
+#define JET_errGivenLogFileHasBadSignature -555 /* Restore log file has bad signature */
+#define JET_errGivenLogFileIsNotContiguous -556 /* Restore log file is not contiguous */
+#define JET_errMissingRestoreLogFiles -557 /* Some restore log files are missing */
+#define JET_wrnExistingLogFileHasBadSignature 558 /* Existing log file has bad signature */
+#define JET_wrnExistingLogFileIsNotContiguous 559 /* Existing log file is not contiguous */
+#define JET_errMissingFullBackup -560 /* The database miss a previous full backup befor incremental backup */
+#define JET_errBadBackupDatabaseSize -561 /* The backup database size is not in 4k */
+#define JET_errDatabaseAlreadyUpgraded -562 /* Attempted to upgrade a database that is already current */
+
+#define JET_errTermInProgress -1000 /* Termination in progress */
+#define JET_errFeatureNotAvailable -1001 /* API not supported */
+#define JET_errInvalidName -1002 /* Invalid name */
+#define JET_errInvalidParameter -1003 /* Invalid API parameter */
+#define JET_wrnColumnNull 1004 /* Column is NULL-valued */
+#define JET_wrnBufferTruncated 1006 /* Buffer too small for data */
+#define JET_wrnDatabaseAttached 1007 /* Database is already attached */
+#define JET_wrnSortOverflow 1009 /* Sort does not fit in memory */
+#define JET_errInvalidDatabaseId -1010 /* Invalid database id */
+#define JET_errOutOfMemory -1011 /* Out of Memory */
+#define JET_errOutOfDatabaseSpace -1012 /* Maximum database size reached */
+#define JET_errOutOfCursors -1013 /* Out of table cursors */
+#define JET_errOutOfBuffers -1014 /* Out of database page buffers */
+#define JET_errTooManyIndexes -1015 /* Too many indexes */
+#define JET_errTooManyKeys -1016 /* Too many columns in an index */
+#define JET_errRecordDeleted -1017 /* Record has been deleted */
+#define JET_errReadVerifyFailure -1018 /* Read verification error */
+#define JET_errOutOfFileHandles -1020 /* Out of file handles */
+#define JET_errDiskIO -1022 /* Disk IO error */
+#define JET_errInvalidPath -1023 /* Invalid file path */
+#define JET_errRecordTooBig -1026 /* Record larger than maximum size */
+#define JET_errTooManyOpenDatabases -1027 /* Too many open databases */
+#define JET_errInvalidDatabase -1028 /* Not a database file */
+#define JET_errNotInitialized -1029 /* JetInit not yet called */
+#define JET_errAlreadyInitialized -1030 /* JetInit already called */
+#define JET_errFileAccessDenied -1032 /* Cannot access file */
+#define JET_errQueryNotSupported -1034 /* Query support unavailable */
+#define JET_errSQLLinkNotSupported -1035 /* SQL Link support unavailable */
+#define JET_errBufferTooSmall -1038 /* Buffer is too small */
+#define JET_wrnSeekNotEqual 1039 /* SeekLE or SeekGE didn't find exact match */
+#define JET_errTooManyColumns -1040 /* Too many columns defined */
+#define JET_errContainerNotEmpty -1043 /* Container is not empty */
+#define JET_errInvalidFilename -1044 /* Filename is invalid */
+#define JET_errInvalidBookmark -1045 /* Invalid bookmark */
+#define JET_errColumnInUse -1046 /* Column used in an index */
+#define JET_errInvalidBufferSize -1047 /* Data buffer doesn't match column size */
+#define JET_errColumnNotUpdatable -1048 /* Cannot set column value */
+#define JET_errIndexInUse -1051 /* Index is in use */
+#define JET_errLinkNotSupported -1052 /* Link support unavailable */
+#define JET_errNullKeyDisallowed -1053 /* Null keys are disallowed on index */
+#define JET_errNotInTransaction -1054 /* Operation must be within a transaction */
+#define JET_wrnNoErrorInfo 1055 /* No extended error information */
+#define JET_wrnNoIdleActivity 1058 /* No idle activity occured */
+#define JET_errTooManyActiveUsers -1059 /* Too many active database users */
+#define JET_errInvalidAppend -1060 /* Cannot append long value */
+#define JET_errInvalidCountry -1061 /* Invalid or unknown country code */
+#define JET_errInvalidLanguageId -1062 /* Invalid or unknown language id */
+#define JET_errInvalidCodePage -1063 /* Invalid or unknown code page */
+#define JET_wrnNoWriteLock 1067 /* No write lock at transaction level 0 */
+#define JET_wrnColumnSetNull 1068 /* Column set to NULL-value */
+#define JET_errVersionStoreOutOfMemory -1069 /* lMaxVerPages exceeded (XJET only) */
+#define JET_errCurrencyStackOutOfMemory -1070 /* lCSRPerfFUCB * lMaxCursors exceeded (XJET only) */
+#define JET_errOutOfSessions -1101 /* Out of sessions */
+#define JET_errWriteConflict -1102 /* Write lock failed due to outstanding write lock */
+#define JET_errTransTooDeep -1103 /* Xactions nested too deeply */
+#define JET_errInvalidSesid -1104 /* Invalid session handle */
+#define JET_errSessionWriteConflict -1107 /* Another session has private version of page */
+#define JET_errInTransaction -1108 /* Operation not allowed within a transaction */
+#define JET_errDatabaseDuplicate -1201 /* Database already exists */
+#define JET_errDatabaseInUse -1202 /* Database in use */
+#define JET_errDatabaseNotFound -1203 /* No such database */
+#define JET_errDatabaseInvalidName -1204 /* Invalid database name */
+#define JET_errDatabaseInvalidPages -1205 /* Invalid number of pages */
+#define JET_errDatabaseCorrupted -1206 /* non-db file or corrupted db */
+#define JET_errDatabaseLocked -1207 /* Database exclusively locked */
+#define JET_errCannotDisableVersioning -1208 /* Cannot disable versioning for this database */
+#define JET_wrnTableEmpty 1301 /* Open an empty table */
+#define JET_errTableLocked -1302 /* Table is exclusively locked */
+#define JET_errTableDuplicate -1303 /* Table already exists */
+#define JET_errTableInUse -1304 /* Table is in use, cannot lock */
+#define JET_errObjectNotFound -1305 /* No such table or object */
+#define JET_errDensityInvalid -1307 /* Bad file/index density */
+#define JET_errTableNotEmpty -1308 /* Cannot define clustered index */
+#define JET_errInvalidTableId -1310 /* Invalid table id */
+#define JET_errTooManyOpenTables -1311 /* Cannot open any more tables */
+#define JET_errIllegalOperation -1312 /* Oper. not supported on table */
+#define JET_errObjectDuplicate -1314 /* Table or object name in use */
+#define JET_errInvalidObject -1316 /* object is invalid for operation */
+#define JET_errIndexCantBuild -1401 /* Cannot build clustered index */
+#define JET_errIndexHasPrimary -1402 /* Primary index already defined */
+#define JET_errIndexDuplicate -1403 /* Index is already defined */
+#define JET_errIndexNotFound -1404 /* No such index */
+#define JET_errIndexMustStay -1405 /* Cannot delete clustered index */
+#define JET_errIndexInvalidDef -1406 /* Illegal index definition */
+#define JET_errIndexHasClustered -1408 /* Clustered index already defined */
+#define JET_errInvalidCreateIndex -1409 /* Invali create index description */
+#define JET_errTooManyOpenIndexes -1410 /* Out of index description blocks */
+#define JET_errColumnLong -1501 /* Column value is long */
+#define JET_errColumnNoChunk -1502 /* no such chunk in long value */
+#define JET_errColumnDoesNotFit -1503 /* Field will not fit in record */
+#define JET_errNullInvalid -1504 /* Null not valid */
+#define JET_errColumnIndexed -1505 /* Column indexed, cannot delete */
+#define JET_errColumnTooBig -1506 /* Field length is > maximum */
+#define JET_errColumnNotFound -1507 /* No such column */
+#define JET_errColumnDuplicate -1508 /* Field is already defined */
+#define JET_errColumn2ndSysMaint -1510 /* Second autoinc or version column */
+#define JET_errInvalidColumnType -1511 /* Invalid column data type */
+#define JET_wrnColumnMaxTruncated 1512 /* Max length too big, truncated */
+#define JET_errColumnCannotIndex -1513 /* Cannot index Bit,LongText,LongBinary */
+#define JET_errTaggedNotNULL -1514 /* No non-NULL tagged columns */
+#define JET_errNoCurrentIndex -1515 /* Invalid w/o a current index */
+#define JET_errKeyIsMade -1516 /* The key is completely made */
+#define JET_errBadColumnId -1517 /* Column Id Incorrect */
+#define JET_errBadItagSequence -1518 /* Bad itagSequence for tagged column */
+#define JET_errColumnInRelationship -1519 /* Cannot delete, column participates in relationship */
+#define JET_wrnCopyLongValue 1520 /* Single instance column bursted */
+#define JET_errCannotBeTagged -1521 /* AutoIncrement and Version cannot be tagged */
+#define JET_errRecordNotFound -1601 /* The key was not found */
+#define JET_errRecordNoCopy -1602 /* No working buffer */
+#define JET_errNoCurrentRecord -1603 /* Currency not on a record */
+#define JET_errRecordClusteredChanged -1604 /* Clustered key may not change */
+#define JET_errKeyDuplicate -1605 /* Illegal duplicate key */
+#define JET_errAlreadyPrepared -1607 /* Already copy/clear current */
+#define JET_errKeyNotMade -1608 /* No call to JetMakeKey */
+#define JET_errUpdateNotPrepared -1609 /* No call to JetPrepareUpdate */
+#define JET_wrnDataHasChanged 1610 /* Data has changed */
+#define JET_errDataHasChanged -1611 /* Data has changed, operation aborted */
+#define JET_wrnKeyChanged 1618 /* Moved to new key */
+#define JET_errTooManySorts -1701 /* Too many sort processes */
+#define JET_errInvalidOnSort -1702 /* Invalid operation on Sort */
+#define JET_errTempFileOpenError -1803 /* Temp file could not be opened */
+#define JET_errTooManyAttachedDatabases -1805 /* Too many open databases */
+#define JET_errDiskFull -1808 /* No space left on disk */
+#define JET_errPermissionDenied -1809 /* Permission denied */
+#define JET_errFileNotFound -1811 /* File not found */
+#define JET_wrnFileOpenReadOnly 1813 /* Database file is read only */
+#define JET_errAfterInitialization -1850 /* Cannot Restore after init. */
+#define JET_errLogCorrupted -1852 /* Logs could not be interpreted */
+#define JET_errInvalidOperation -1906 /* invalid operation */
+#define JET_errAccessDenied -1907 /* access denied */
+#define JET_wrnIdleFull 1908 /* ilde registry full */
+
+
+/**********************************************************************/
+/*********************** PROTOTYPES **************************/
+/**********************************************************************/
+
+#if !defined(_JET_NOPROTOTYPES)
+
+JET_ERR JET_API JetInit(JET_INSTANCE *pinstance);
+
+JET_ERR JET_API JetTerm(JET_INSTANCE instance);
+
+JET_ERR JET_API JetTerm2( JET_INSTANCE instance, JET_GRBIT grbit );
+
+JET_ERR JET_API JetSetSystemParameter(JET_INSTANCE *pinstance, JET_SESID sesid, unsigned long paramid,
+ unsigned long lParam, const char *sz);
+
+JET_ERR JET_API JetGetSystemParameter(JET_INSTANCE instance, JET_SESID sesid, unsigned long paramid,
+ unsigned long *plParam, char *sz, unsigned long cbMax);
+
+#define ctAccessPage 1
+#define ctLatchConflict 2
+#define ctSplitRetry 3
+#define ctNeighborPageScanned 4
+#define ctSplits 5
+JET_ERR JET_API JetResetCounter( JET_SESID sesid, long CounterType );
+JET_ERR JET_API JetGetCounter( JET_SESID sesid, long CounterType, long *plValue );
+
+JET_ERR JET_API JetBeginSession(JET_INSTANCE instance, JET_SESID *psesid,
+ const char *szUserName, const char *szPassword);
+
+JET_ERR JET_API JetDupSession(JET_SESID sesid, JET_SESID *psesid);
+
+JET_ERR JET_API JetEndSession(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetVersion(JET_SESID sesid, unsigned long *pwVersion);
+
+JET_ERR JET_API JetIdle(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetCreateDatabase(JET_SESID sesid,
+ const char *szFilename, const char *szConnect,
+ JET_DBID *pdbid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetAttachDatabase(JET_SESID sesid, const char *szFilename, JET_GRBIT grbit );
+
+JET_ERR JET_API JetDetachDatabase(JET_SESID sesid, const char *szFilename);
+
+JET_ERR JET_API JetCreateTable(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, unsigned long lPages, unsigned long lDensity,
+ JET_TABLEID *ptableid);
+
+JET_ERR JET_API JetCreateTableColumnIndex( JET_SESID sesid, JET_DBID dbid,
+ JET_TABLECREATE *ptablecreate );
+
+JET_ERR JET_API JetDeleteTable(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName);
+
+JET_ERR JET_API JetGetTableColumnInfo(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szColumnName, void *pvResult, unsigned long cbMax,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetColumnInfo(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, const char *szColumnName,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetAddColumn(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szColumn, const JET_COLUMNDEF *pcolumndef,
+ const void *pvDefault, unsigned long cbDefault,
+ JET_COLUMNID *pcolumnid);
+
+JET_ERR JET_API JetDeleteColumn(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szColumn);
+
+JET_ERR JET_API JetGetTableIndexInfo(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName, void *pvResult, unsigned long cbResult,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetTableInfo(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetIndexInfo(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, const char *szIndexName,
+ void *pvResult, unsigned long cbResult, unsigned long InfoLevel);
+
+JET_ERR JET_API JetCreateIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName, JET_GRBIT grbit,
+ const char *szKey, unsigned long cbKey, unsigned long lDensity);
+
+JET_ERR JET_API JetDeleteIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName);
+
+JET_ERR JET_API JetGetObjectInfo(JET_SESID sesid, JET_DBID dbid,
+ JET_OBJTYP objtyp, const char *szContainerName,
+ const char *szObjectName, void *pvResult, unsigned long cbMax,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetBeginTransaction(JET_SESID sesid);
+
+JET_ERR JET_API JetCommitTransaction(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetRollback(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetDatabaseInfo(JET_SESID sesid, JET_DBID dbid,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetCloseDatabase(JET_SESID sesid, JET_DBID dbid,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetCloseTable(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetOpenDatabase(JET_SESID sesid, const char *szFilename,
+ const char *szConnect, JET_DBID *pdbid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetOpenTable(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, const void *pvParameters,
+ unsigned long cbParameters, JET_GRBIT grbit, JET_TABLEID *ptableid);
+
+JET_ERR JET_API JetDelete(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetUpdate(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvBookmark, unsigned long cbBookmark,
+ unsigned long *pcbActual);
+
+JET_ERR JET_API JetRetrieveColumn(JET_SESID sesid, JET_TABLEID tableid,
+ JET_COLUMNID columnid, void *pvData, unsigned long cbData,
+ unsigned long *pcbActual, JET_GRBIT grbit, JET_RETINFO *pretinfo);
+
+JET_ERR JET_API JetRetrieveColumns( JET_SESID sesid, JET_TABLEID tableid,
+ JET_RETRIEVECOLUMN *pretrievecolumn, unsigned long cretrievecolumn );
+
+JET_ERR JET_API JetSetColumn(JET_SESID sesid, JET_TABLEID tableid,
+ JET_COLUMNID columnid, const void *pvData, unsigned long cbData,
+ JET_GRBIT grbit, JET_SETINFO *psetinfo);
+
+JET_ERR JET_API JetSetColumns(JET_SESID sesid, JET_TABLEID tableid,
+ JET_SETCOLUMN *psetcolumn, unsigned long csetcolumn );
+
+JET_ERR JET_API JetPrepareUpdate(JET_SESID sesid, JET_TABLEID tableid,
+ unsigned long prep);
+
+JET_ERR JET_API JetGetRecordPosition(JET_SESID sesid, JET_TABLEID tableid,
+ JET_RECPOS *precpos, unsigned long cbRecpos);
+
+JET_ERR JET_API JetGotoPosition(JET_SESID sesid, JET_TABLEID tableid,
+ JET_RECPOS *precpos );
+
+JET_ERR JET_API JetGetCursorInfo(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetDupCursor(JET_SESID sesid, JET_TABLEID tableid,
+ JET_TABLEID *ptableid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetCurrentIndex(JET_SESID sesid, JET_TABLEID tableid,
+ char *szIndexName, unsigned long cchIndexName);
+
+JET_ERR JET_API JetSetCurrentIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName);
+
+JET_ERR JET_API JetSetCurrentIndex2(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName, JET_GRBIT grbit );
+
+JET_ERR JET_API JetMove(JET_SESID sesid, JET_TABLEID tableid,
+ long cRow, JET_GRBIT grbit);
+
+JET_ERR JET_API JetMakeKey(JET_SESID sesid, JET_TABLEID tableid,
+ const void *pvData, unsigned long cbData, JET_GRBIT grbit);
+
+JET_ERR JET_API JetSeek(JET_SESID sesid, JET_TABLEID tableid,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetBookmark(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvBookmark, unsigned long cbMax,
+ unsigned long *pcbActual);
+
+JET_ERR JET_API JetCompact(JET_SESID sesid, const char *szDatabaseSrc,
+ const char *szDatabaseDest, JET_PFNSTATUS pfnStatus, JET_CONVERT *pconvert,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetDBUtilities( JET_DBUTIL *pdbutil );
+
+JET_ERR JET_API JetGotoBookmark(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvBookmark, unsigned long cbBookmark);
+
+JET_ERR JET_API JetComputeStats(JET_SESID sesid, JET_TABLEID tableid);
+
+typedef unsigned long JET_VSESID; /* Received from dispatcher */
+
+struct tagVDBFNDEF;
+
+typedef unsigned long JET_VDBID; /* Received from dispatcher */
+
+struct tagVTFNDEF;
+
+typedef unsigned long JET_VTID; /* Received from dispatcher */
+
+JET_ERR JET_API JetOpenTempTable(JET_SESID sesid,
+ const JET_COLUMNDEF *prgcolumndef, unsigned long ccolumn,
+ JET_GRBIT grbit, JET_TABLEID *ptableid,
+ JET_COLUMNID *prgcolumnid);
+
+JET_ERR JET_API JetOpenTempTable2( JET_SESID sesid,
+ const JET_COLUMNDEF *prgcolumndef,
+ unsigned long ccolumn,
+ unsigned long langid,
+ JET_GRBIT grbit,
+ JET_TABLEID *ptableid,
+ JET_COLUMNID *prgcolumnid );
+
+JET_ERR JET_API JetBackup( const char *szBackupPath, JET_GRBIT grbit, JET_PFNSTATUS pfnStatus );
+
+JET_ERR JET_API JetRestore(const char *sz, JET_PFNSTATUS pfn );
+JET_ERR JET_API JetRestore2(const char *sz, const char *szDest, JET_PFNSTATUS pfn );
+
+JET_ERR JET_API JetSetIndexRange(JET_SESID sesid,
+ JET_TABLEID tableidSrc, JET_GRBIT grbit);
+
+JET_ERR JET_API JetIndexRecordCount(JET_SESID sesid,
+ JET_TABLEID tableid, unsigned long *pcrec, unsigned long crecMax );
+
+JET_ERR JET_API JetRetrieveKey(JET_SESID sesid,
+ JET_TABLEID tableid, void *pvData, unsigned long cbMax,
+ unsigned long *pcbActual, JET_GRBIT grbit );
+
+JET_ERR JET_API JetBeginExternalBackup( JET_GRBIT grbit );
+
+JET_ERR JET_API JetGetAttachInfo( void *pv,
+ unsigned long cbMax,
+ unsigned long *pcbActual );
+
+JET_ERR JET_API JetOpenFile( const char *szFileName,
+ JET_HANDLE *phfFile,
+ unsigned long *pulFileSizeLow,
+ unsigned long *pulFileSizeHigh );
+
+JET_ERR JET_API JetReadFile( JET_HANDLE hfFile,
+ void *pv,
+ unsigned long cb,
+ unsigned long *pcb );
+
+JET_ERR JET_API JetCloseFile( JET_HANDLE hfFile );
+
+JET_ERR JET_API JetGetLogInfo( void *pv,
+ unsigned long cbMax,
+ unsigned long *pcbActual );
+
+JET_ERR JET_API JetTruncateLog( void );
+
+JET_ERR JET_API JetEndExternalBackup( void );
+
+JET_ERR JET_API JetExternalRestore( char *szCheckpointFilePath, char *szLogPath, JET_RSTMAP *rgstmap, long crstfilemap, char *szBackupLogPath, long genLow, long genHigh, JET_PFNSTATUS pfn );
+
+#endif /* _JET_NOPROTOTYPES */
+
+#pragma pack()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _JET_INCLUDED */
+
+
+
+
diff --git a/private/utils/ntbackup/exchange/inc/jetbcli.h b/private/utils/ntbackup/exchange/inc/jetbcli.h
new file mode 100644
index 000000000..a5703feff
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/jetbcli.h
@@ -0,0 +1,407 @@
+/*
+ * EDBBCLI.H
+ *
+ * Microsoft Exchange Information Store
+ * Copyright (C) 1986-1996, Microsoft Corporation
+ *
+ * Contains declarations of additional definitions and interfaces
+ * for the Exchange Online Backup Client APIs.
+ */
+
+#ifndef _EDBBCLI_
+#define _EDBBCLI_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef MIDL_PASS
+#define RPC_STRING [string]
+#else
+#define RPC_STRING
+typedef unsigned short WCHAR;
+#endif
+
+#define EDBBACK_MDB_SERVER "Exchange MDB Database"
+#define EDBBACK_DS_SERVER "Exchange DS Database"
+
+#ifndef EDBBACK_BUILD
+#define EDBBACK_API __declspec(dllimport) _stdcall
+#else
+#define EDBBACK_API
+#endif
+
+typedef DWORD ERR;
+
+typedef LONG HRESULT;
+typedef LONG C;
+typedef TCHAR BFT;
+
+//
+// Type of backup passed into HrBackupPrepare()
+//
+
+#define BACKUP_TYPE_FULL 0x01
+#define BACKUP_TYPE_LOGS_ONLY 0x02
+
+//
+// Set the current log number to this value to disable incremental or
+// differential backup.
+//
+#define BACKUP_DISABLE_INCREMENTAL 0xffffffff
+
+//
+// Backup/Restore file types
+//
+//
+// Please note that these file types are binary values, even though they are text (or wchar) typed.
+//
+// The code in the backup API's rely on the fact that values 0-256 in 8 bit ascii map to the values 0-256 in unicode.
+//
+
+//
+// If the BFT_DIRECTORY bit is set on the backup file type, it indicates that the path specified is a directory,
+// otherwise it is a file name.
+//
+
+#define BFT_DIRECTORY 0x80
+
+//
+// If the BFT_DATABASE bit is set on the backup file type, it indicates that the file goes into the database directory.
+//
+
+#define BFT_DATABASE_DIRECTORY 0x40
+
+//
+// If the BFT_LOG bit is set on the backup file type, it indicates that the file goes into the log directory.
+//
+
+#define BFT_LOG_DIRECTORY 0x20
+
+//
+// Database logs.
+//
+
+#define BFT_LOG (BFT)(TEXT('\x01') | BFT_LOG_DIRECTORY)
+#define BFT_LOG_DIR (BFT)(TEXT('\x02') | BFT_DIRECTORY)
+
+//
+// Checkpoint file.
+//
+
+#define BFT_CHECKPOINT_DIR (BFT)(TEXT('\x03') | BFT_DIRECTORY)
+
+//
+// Database types.
+//
+#define BFT_MDB_PRIVATE_DATABASE (BFT)(TEXT('\x05') | BFT_DATABASE_DIRECTORY)
+#define BFT_MDB_PUBLIC_DATABASE (BFT)(TEXT('\x06') | BFT_DATABASE_DIRECTORY)
+#define BFT_DSA_DATABASE (BFT)(TEXT('\x07') | BFT_DATABASE_DIRECTORY)
+
+//
+// JET patch files
+//
+//
+//
+
+#define BFT_PATCH_FILE (BFT)(TEXT('\x08') | BFT_LOG_DIRECTORY)
+
+//
+// Catch all for unknown file types.
+//
+
+#define BFT_UNKNOWN (BFT)(TEXT('\x0f'))
+
+#include <edbmsg.h>
+
+typedef void *HBC;
+
+typedef struct tagEDB_RSTMAPA
+{
+ RPC_STRING char *szDatabaseName;
+ RPC_STRING char *szNewDatabaseName;
+} EDB_RSTMAPA, *PEDB_RSTMAPA; /* restore map */
+
+// required for Exchange unicode support.
+// UNDONE: NYI
+#define UNICODE_RSTMAP
+
+typedef struct tagEDB_RSTMAPW {
+ RPC_STRING WCHAR *wszDatabaseName;
+ RPC_STRING WCHAR *wszNewDatabaseName;
+} EDB_RSTMAPW, *PEDB_RSTMAPW;
+
+#ifdef UNICODE
+#define EDB_RSTMAP EDB_RSTMAPW
+#define PEDB_RSTMAP PEDB_RSTMAPW
+#else
+#define EDB_RSTMAP EDB_RSTMAPA
+#define PEDB_RSTMAP PEDB_RSTMAPA
+#endif
+
+
+HRESULT
+EDBBACK_API
+HrBackupPrepareA(
+ IN char * szBackupServer,
+ IN char * szBackupAnnotation,
+ IN unsigned long grbit,
+ IN unsigned long btBackupType,
+ OUT HBC *hbcBackupContext
+ );
+
+HRESULT
+EDBBACK_API
+HrBackupPrepareW(
+ IN WCHAR * wszBackupServer,
+ IN WCHAR * wszBackupAnnotation,
+ IN unsigned long grbit,
+ IN unsigned long btBackupType,
+ OUT HBC *hbcBackupContext
+ );
+
+#ifdef UNICODE
+#define HrBackupPrepare HrBackupPrepareW
+#else
+#define HrBackupPrepare HrBackupPrepareA
+#endif
+
+
+HRESULT
+EDBBACK_API
+HrBackupGetDatabaseNamesA(
+ IN HBC pvBackupContext,
+ OUT LPSTR *ppszAttachmentInformation,
+ OUT LPDWORD pcbSize
+ );
+
+HRESULT
+EDBBACK_API
+HrBackupGetDatabaseNamesW(
+ IN HBC pvBackupContext,
+ OUT LPWSTR *ppszAttachmentInformation,
+ OUT LPDWORD pcbSize
+ );
+
+#ifdef UNICODE
+#define HrBackupGetDatabaseNames HrBackupGetDatabaseNamesW
+#else
+#define HrBackupGetDatabaseNames HrBackupGetDatabaseNamesA
+#endif
+
+HRESULT
+EDBBACK_API
+HrBackupOpenFileW(
+ IN HBC pvBackupContext,
+ IN WCHAR * wszAttachmentName,
+ IN DWORD cbReadHintSize,
+ OUT LARGE_INTEGER *pliFileSize
+ );
+
+HRESULT
+EDBBACK_API
+HrBackupOpenFileA(
+ IN HBC pvBackupContext,
+ IN char * szAttachmentName,
+ IN DWORD cbReadHintSize,
+ OUT LARGE_INTEGER *pliFileSize
+ );
+
+#ifdef UNICODE
+#define HrBackupOpenFile HrBackupOpenFileW
+#else
+#define HrBackupOpenFile HrBackupOpenFileA
+#endif
+
+
+HRESULT
+EDBBACK_API
+HrBackupRead(
+ IN HBC pvBackupContext,
+ IN PVOID pvBuffer,
+ IN DWORD cbBuffer,
+ OUT PDWORD pcbRead
+ );
+
+HRESULT
+EDBBACK_API
+HrBackupClose(
+ IN HBC pvBackupContext
+ );
+
+HRESULT
+EDBBACK_API
+HrBackupGetBackupLogsA(
+ IN HBC pvBackupContext,
+ IN LPSTR *szBackupLogFile,
+ IN PDWORD pcbSize
+ );
+
+HRESULT
+EDBBACK_API
+HrBackupGetBackupLogsW(
+ IN HBC pvBackupContext,
+ IN LPWSTR *szBackupLogFile,
+ IN PDWORD pcbSize
+ );
+
+#ifdef UNICODE
+#define HrBackupGetBackupLogs HrBackupGetBackupLogsW
+#else
+#define HrBackupGetBackupLogs HrBackupGetBackupLogsA
+#endif
+
+HRESULT
+EDBBACK_API
+HrBackupTruncateLogs(
+ IN HBC pvBackupContext
+ );
+
+
+HRESULT
+EDBBACK_API
+HrBackupEnd(
+ IN HBC pvBackupContext
+ );
+
+
+VOID
+EDBBACK_API
+BackupFree(
+ IN PVOID pvBuffer
+ );
+
+
+HRESULT
+EDBBACK_API
+HrRestoreGetDatabaseLocationsA(
+ IN HBC hbcBackupContext,
+ OUT LPSTR *ppszDatabaseLocationList,
+ OUT LPDWORD pcbSize
+ );
+
+HRESULT
+EDBBACK_API
+HrRestoreGetDatabaseLocationsW(
+ IN HBC pvBackupContext,
+ OUT LPWSTR *ppszDatabaseLocationList,
+ OUT LPDWORD pcbSize
+ );
+
+#ifdef UNICODE
+#define HrRestoreGetDatabaseLocations HrRestoreGetDatabaseLocationsW
+#else
+#define HrRestoreGetDatabaseLocations HrRestoreGetDatabaseLocationsA
+#endif
+
+HRESULT
+EDBBACK_API
+HrRestorePrepareA(
+ char * szServerName,
+ char * szServiceAnnotation,
+ HBC *phbcBackupContext
+ );
+
+HRESULT
+EDBBACK_API
+HrRestorePrepareW(
+ WCHAR * szServerName,
+ WCHAR * szServiceAnnotation,
+ HBC *phbcBackupContext
+ );
+
+#ifdef UNICODE
+#define HrRestorePrepare HrRestorePrepareW
+#else
+#define HrRestorePrepare HrRestorePrepareA
+#endif
+
+//
+// HrRestoreRegister will register a restore
+// operation. It will interlock all subsequent
+// restore operations, and will prevent the restore target
+// from starting until the call to HrRestoreRegisterComplete.
+//
+
+HRESULT
+EDBBACK_API
+HrRestoreRegisterA(
+ IN HBC hbcRestoreContext,
+ IN char * szCheckpointFilePath,
+ IN char * szLogPath,
+ IN EDB_RSTMAPA rgrstmap[],
+ IN C crstmap,
+ IN char * szBackupLogPath,
+ IN ULONG genLow,
+ IN ULONG genHigh
+ );
+
+HRESULT
+EDBBACK_API
+HrRestoreRegisterW(
+ IN HBC hbcRestoreContext,
+ IN WCHAR * wszCheckpointFilePath,
+ IN WCHAR * wszLogPath,
+ IN EDB_RSTMAPW rgrstmap[],
+ IN C crstmap,
+ IN WCHAR * wszBackupLogPath,
+ IN ULONG genLow,
+ IN ULONG genHigh
+ );
+
+#ifdef UNICODE
+#define HrRestoreRegister HrRestoreRegisterW
+#else
+#define HrRestoreRegister HrRestoreRegisterA
+#endif
+
+//
+// HrRestoreRegisterComplete will complete a restore
+// operation. It will allow further subsequent
+// restore operations, and will allow the restore target
+// to start if hrRestoreState is success.
+//
+// If hrRestoreState is NOT hrNone, this will
+// prevent the restore target from restarting.
+//
+
+HRESULT
+EDBBACK_API
+HrRestoreRegisterComplete(
+ HBC hbcRestoreContext,
+ HRESULT hrRestoreState
+ );
+
+HRESULT
+EDBBACK_API
+HrRestoreEnd(
+ HBC hbcRestoreContext
+ );
+
+HRESULT
+EDBBACK_API
+HrSetCurrentBackupLogW(
+ WCHAR *wszServerName,
+ WCHAR * wszBackupAnnotation,
+ DWORD dwCurrentLog
+ );
+
+HRESULT
+EDBBACK_API
+HrSetCurrentBackupLogA(
+ CHAR * szServerName,
+ CHAR * szBackupAnnotation,
+ DWORD dwCurrentLog
+ );
+
+#ifdef UNICODE
+#define HrSetCurrentBackupLog HrSetCurrentBackupLogW
+#else
+#define HrSetCurrentBackupLog HrSetCurrentBackupLogA
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _EDBBCLI_
+
diff --git a/private/utils/ntbackup/exchange/inc/morpc.h b/private/utils/ntbackup/exchange/inc/morpc.h
new file mode 100644
index 000000000..50e9ea91f
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/morpc.h
@@ -0,0 +1,352 @@
+#ifndef __MORPC_H__
+#define __MORPC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define small char
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+
+
+extern RPC_IF_HANDLE TriggerMonitoringRPC_ServerIfHandle;
+
+extern RPC_IF_HANDLE TriggerMonitoringRPC_ClientIfHandle;
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef _ERROR_STATUS_T_DEFINED
+typedef unsigned long error_status_t;
+#define _ERROR_STATUS_T_DEFINED
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+#define szTriggerRPCProtocol TEXT("ncacn_np")
+#define szTriggerRPCEndpoint TEXT("\\pipe\\Trigger")
+#define szTriggerRPCSecurity TEXT("Security=impersonation dynamic true")
+typedef small RPC_BOOL;
+
+typedef small RPC_BYTE;
+
+typedef long RPC_INT;
+
+typedef long RPC_SC;
+
+typedef long RPC_DWORD;
+
+typedef wchar_t RPC_CHAR;
+
+typedef RPC_CHAR *RPC_SZ;
+
+typedef struct __MIDL_TriggerMonitoringRPC_0001
+ {
+ short rgwSystemTime[8];
+ }
+RPC_SYSTEMTIME;
+
+typedef struct __MIDL_TriggerMonitoringRPC_0002
+ {
+ RPC_BYTE rgbTzi[172];
+ }
+RPC_TIME_ZONE_INFORMATION;
+
+typedef struct __MIDL_TriggerMonitoringRPC_0003
+ {
+ long rgdwServiceStatus[7];
+ }
+RPC_SERVICE_STATUS;
+
+typedef struct __MIDL_TriggerMonitoringRPC_0004
+ {
+ RPC_SYSTEMTIME st;
+ RPC_TIME_ZONE_INFORMATION tzi;
+ RPC_DWORD dwReturn;
+ }
+RemoteSystemTimeInfo;
+
+typedef struct _RemoteServiceStatus
+ {
+ RPC_SC sc;
+ RPC_SZ szShortName;
+ RPC_SZ szDisplayName;
+ RPC_SZ szVersion;
+ RPC_SERVICE_STATUS ss;
+ struct _RemoteServiceStatus *prssNext;
+ }
+RemoteServiceStatus;
+
+typedef struct _BackupListNode
+ {
+ struct _BackupListNode *pnodeNext;
+ struct _BackupListNode *pnodeChildren;
+ RPC_SZ szName;
+ }
+BackupListNode;
+
+RPC_SC _cdecl ScNetworkTimingTest(
+ handle_t h,
+ long cbSend,
+ small rgbSend[],
+ long cbReceive,
+ small rgbReceive[]);
+RPC_SC _cdecl ScGetMaintenanceMode(
+ handle_t h,
+ RPC_BOOL *pfValue,
+ RPC_SYSTEMTIME *pst,
+ RPC_SZ szUser,
+ long cchMac);
+RPC_SC _cdecl ScSetMaintenanceMode(
+ handle_t h,
+ RPC_BOOL fNew,
+ RPC_SZ szUser);
+RPC_SC _cdecl ScGetRemoteSystemTime(
+ handle_t h,
+ RPC_SYSTEMTIME *pst);
+RPC_SC _cdecl ScSetRemoteSystemTime(
+ handle_t h,
+ RPC_SYSTEMTIME *pst);
+#define dwServerFlagMapiRunning 0x00000001
+RPC_SC _cdecl ScGetRemoteServerStatus(
+ handle_t h,
+ RPC_DWORD *pdwServerFlags,
+ RemoteSystemTimeInfo *prsti,
+ RemoteServiceStatus *prss);
+RPC_SC _cdecl ScRasEnumEntries(
+ handle_t h,
+ RPC_INT cb,
+ RPC_BYTE rgbRasEnumEntries[],
+ RPC_INT *pcEntries);
+RPC_SC _cdecl ScGetBackupListNode(
+ handle_t h,
+ BackupListNode **ppnode);
+RPC_SC _cdecl ScRunRID(
+ handle_t h);
+RPC_SC _cdecl ScRunDRACheck(
+ handle_t h,
+ RPC_DWORD dw);
+#define BPTAdd 1
+#define BPTRemove 2
+#define BPTUpdate 3
+RPC_SC _cdecl ScBulkCreateProxy(
+ handle_t h,
+ RPC_SZ szHeader,
+ RPC_DWORD dwOptions);
+RPC_SC _cdecl ScCreateProxy(
+ handle_t h,
+ RPC_SZ szDN);
+RPC_SC _cdecl ScIsProxyUnique(
+ handle_t h,
+ RPC_SZ szProxy,
+ RPC_BOOL *pfUnique,
+ RPC_SZ *pszOwner);
+#define scNoError 0
+#define scInvalidData 1
+#define scCannotLogData 2
+RPC_SC _cdecl ScSaveTrackingData(
+ handle_t h,
+ RPC_INT cb,
+ RPC_BYTE pb[],
+ RPC_DWORD dwFlags);
+#define tevtMessageTransferIn 0
+#define tevtReportTransferIn 2
+#define tevtMessageSubmission 4
+#define tevtMessageTransferOut 7
+#define tevtReportTransferOut 8
+#define tevtMessageDelivery 9
+#define tevtReportDelivery 10
+#define tevtStartAssocByMTSUser 18
+#define tevtReleaseAssocByMTSUser 23
+#define tevtDLExpansion 26
+#define tevtRedirection 28
+#define tevtRerouting 29
+#define tevtDowngrading 31
+#define tevtReportAbsorption 33
+#define tevtReportGenerated 34
+#define tevtUnroutableReportDiscard 43
+#define tevtMessageLocalDelivery 1000
+typedef struct __MIDL_TriggerMonitoringRPC_0005
+ {
+ RPC_INT nEventType;
+ RPC_SYSTEMTIME stEvent;
+ RPC_SZ szGatewayName;
+ RPC_SZ szPartner;
+ RPC_SZ szMTSID;
+ RPC_SZ szRemoteID;
+ RPC_SZ szOriginator;
+ RPC_INT nPriority;
+ RPC_INT nLength;
+ RPC_INT nSeconds;
+ RPC_INT nCost;
+ }
+RPC_GATEWAY_TRACK_INFORMATION;
+
+RPC_SC _cdecl ScSaveGatewayTrackingData(
+ handle_t h,
+ RPC_GATEWAY_TRACK_INFORMATION *pgti,
+ RPC_INT cszRecipients,
+ RPC_SZ rgszRecipients[]);
+
+#if !defined(IMPORT_USED_MULTIPLE) && !defined(IMPORT_USED_SINGLE)
+
+/* routine that gets node for struct __MIDL_TriggerMonitoringRPC_0001 */
+void _gns___MIDL_TriggerMonitoringRPC_0001 (RPC_SYSTEMTIME *, PRPC_MESSAGE);
+
+/* routine that gets node for struct __MIDL_TriggerMonitoringRPC_0002 */
+void _gns___MIDL_TriggerMonitoringRPC_0002 (RPC_TIME_ZONE_INFORMATION *, PRPC_MESSAGE);
+
+/* routine that gets node for struct __MIDL_TriggerMonitoringRPC_0003 */
+void _gns___MIDL_TriggerMonitoringRPC_0003 (RPC_SERVICE_STATUS *, PRPC_MESSAGE);
+
+/* routine that gets node for struct __MIDL_TriggerMonitoringRPC_0004 */
+void _gns___MIDL_TriggerMonitoringRPC_0004 (RemoteSystemTimeInfo *, PRPC_MESSAGE);
+
+/* routine that sizes graph for struct _RemoteServiceStatus */
+void _sgs__RemoteServiceStatus (RemoteServiceStatus *, PRPC_MESSAGE);
+
+/* routine that puts graph for struct _RemoteServiceStatus */
+void _pgs__RemoteServiceStatus (RemoteServiceStatus *, PRPC_MESSAGE);
+
+/* routine that gets node for struct _RemoteServiceStatus */
+void _gns__RemoteServiceStatus (RemoteServiceStatus *, PRPC_MESSAGE);
+
+/* routine that gets graph for struct _RemoteServiceStatus */
+void _ggs__RemoteServiceStatus (RemoteServiceStatus *, unsigned char **, PRPC_MESSAGE);
+
+/* routine that allocates graph for struct _RemoteServiceStatus */
+void _ags__RemoteServiceStatus(unsigned char **, PRPC_MESSAGE);
+
+/* routine that frees graph for struct _RemoteServiceStatus */
+void _fgs__RemoteServiceStatus (RemoteServiceStatus *);
+
+/* routine that sizes graph for struct _BackupListNode */
+void _sgs__BackupListNode (BackupListNode *, PRPC_MESSAGE);
+
+/* routine that puts graph for struct _BackupListNode */
+void _pgs__BackupListNode (BackupListNode *, PRPC_MESSAGE);
+
+/* routine that gets graph for struct _BackupListNode */
+void _ggs__BackupListNode (BackupListNode *, unsigned char **, PRPC_MESSAGE);
+
+/* routine that allocates graph for struct _BackupListNode */
+void _ags__BackupListNode(unsigned char **, PRPC_MESSAGE);
+
+/* routine that frees graph for struct _BackupListNode */
+void _fgs__BackupListNode (BackupListNode *);
+
+/* routine that sizes graph for struct __MIDL_TriggerMonitoringRPC_0005 */
+void _sgs___MIDL_TriggerMonitoringRPC_0005 (RPC_GATEWAY_TRACK_INFORMATION *, PRPC_MESSAGE);
+
+/* routine that puts graph for struct __MIDL_TriggerMonitoringRPC_0005 */
+void _pgs___MIDL_TriggerMonitoringRPC_0005 (RPC_GATEWAY_TRACK_INFORMATION *, PRPC_MESSAGE);
+
+/* routine that gets node for struct __MIDL_TriggerMonitoringRPC_0005 */
+void _gns___MIDL_TriggerMonitoringRPC_0005 (RPC_GATEWAY_TRACK_INFORMATION *, PRPC_MESSAGE);
+
+/* routine that gets graph for struct __MIDL_TriggerMonitoringRPC_0005 */
+void _ggs___MIDL_TriggerMonitoringRPC_0005 (RPC_GATEWAY_TRACK_INFORMATION *, unsigned char **, PRPC_MESSAGE);
+
+/* routine that allocates graph for struct __MIDL_TriggerMonitoringRPC_0005 */
+void _ags___MIDL_TriggerMonitoringRPC_0005(unsigned char **, PRPC_MESSAGE);
+
+/* routine that frees graph for struct __MIDL_TriggerMonitoringRPC_0005 */
+void _fgs___MIDL_TriggerMonitoringRPC_0005 (RPC_GATEWAY_TRACK_INFORMATION *);
+
+#endif /*!defined(IMPORT_USED_MULTIPLE) && !defined(IMPORT_USED_SINGLE)*/
+
+typedef struct _TriggerMonitoringRPC_SERVER_EPV
+ {
+ RPC_SC (_cdecl __RPC_FAR * ScNetworkTimingTest)(
+ handle_t h,
+ long cbSend,
+ small *rgbSend,
+ long cbReceive,
+ small *rgbReceive);
+ RPC_SC (_cdecl __RPC_FAR * ScGetMaintenanceMode)(
+ handle_t h,
+ RPC_BOOL *pfValue,
+ RPC_SYSTEMTIME *pst,
+ RPC_SZ szUser,
+ long cchMac);
+ RPC_SC (_cdecl __RPC_FAR * ScSetMaintenanceMode)(
+ handle_t h,
+ RPC_BOOL fNew,
+ RPC_SZ szUser);
+ RPC_SC (_cdecl __RPC_FAR * ScGetRemoteSystemTime)(
+ handle_t h,
+ RPC_SYSTEMTIME *pst);
+ RPC_SC (_cdecl __RPC_FAR * ScSetRemoteSystemTime)(
+ handle_t h,
+ RPC_SYSTEMTIME *pst);
+ RPC_SC (_cdecl __RPC_FAR * ScGetRemoteServerStatus)(
+ handle_t h,
+ RPC_DWORD *pdwServerFlags,
+ RemoteSystemTimeInfo *prsti,
+ RemoteServiceStatus *prss);
+ RPC_SC (_cdecl __RPC_FAR * ScRasEnumEntries)(
+ handle_t h,
+ RPC_INT cb,
+ RPC_BYTE *rgbRasEnumEntries,
+ RPC_INT *pcEntries);
+ RPC_SC (_cdecl __RPC_FAR * ScGetBackupListNode)(
+ handle_t h,
+ BackupListNode **ppnode);
+ RPC_SC (_cdecl __RPC_FAR * ScRunRID)(
+ handle_t h);
+ RPC_SC (_cdecl __RPC_FAR * ScRunDRACheck)(
+ handle_t h,
+ RPC_DWORD dw);
+ RPC_SC (_cdecl __RPC_FAR * ScBulkCreateProxy)(
+ handle_t h,
+ RPC_SZ szHeader,
+ RPC_DWORD dwOptions);
+ RPC_SC (_cdecl __RPC_FAR * ScCreateProxy)(
+ handle_t h,
+ RPC_SZ szDN);
+ RPC_SC (_cdecl __RPC_FAR * ScIsProxyUnique)(
+ handle_t h,
+ RPC_SZ szProxy,
+ RPC_BOOL *pfUnique,
+ RPC_SZ *pszOwner);
+ RPC_SC (_cdecl __RPC_FAR * ScSaveTrackingData)(
+ handle_t h,
+ RPC_INT cb,
+ RPC_BYTE *pb,
+ RPC_DWORD dwFlags);
+ RPC_SC (_cdecl __RPC_FAR * ScSaveGatewayTrackingData)(
+ handle_t h,
+ RPC_GATEWAY_TRACK_INFORMATION *pgti,
+ RPC_INT cszRecipients,
+ RPC_SZ *rgszRecipients);
+ }
+TriggerMonitoringRPC_SERVER_EPV;
+void __RPC_FAR * __RPC_API MIDL_user_allocate(size_t);
+void __RPC_API MIDL_user_free(void __RPC_FAR *);
+#ifndef __MIDL_USER_DEFINED
+#define midl_user_allocate MIDL_user_allocate
+#define midl_user_free MIDL_user_free
+#define __MIDL_USER_DEFINED
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/exchange/inc/rpcbak.h b/private/utils/ntbackup/exchange/inc/rpcbak.h
new file mode 100644
index 000000000..b33cb8cdc
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/rpcbak.h
@@ -0,0 +1,225 @@
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+/* File created by MIDL compiler version 2.00.0104 */
+/* at Mon Jan 29 16:52:29 1996
+ */
+//@@MIDL_FILE_HEADING( )
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __rpcbak_h__
+#define __rpcbak_h__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/* Forward Declarations */
+
+void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void __RPC_FAR * );
+
+#ifndef __TriggerBackupRPC_INTERFACE_DEFINED__
+#define __TriggerBackupRPC_INTERFACE_DEFINED__
+
+/****************************************
+ * Generated header for interface: TriggerBackupRPC
+ * at Mon Jan 29 16:52:29 1996
+ * using MIDL 2.00.0104
+ ****************************************/
+/* [auto_handle][unique][version][uuid] */
+
+
+#ifndef RPC_COMMON_IDL
+#define RPC_COMMON_IDL
+#define szTriggerRPCProtocol TEXT("ncacn_np")
+#define szTriggerRPCSecurity TEXT("Security=impersonation dynamic true")
+ /* size is 4 */
+typedef long RPC_BOOL;
+
+ /* size is 1 */
+typedef small RPC_BYTE;
+
+ /* size is 4 */
+typedef long RPC_INT;
+
+ /* size is 4 */
+typedef long RPC_SC;
+
+ /* size is 4 */
+typedef long RPC_EC;
+
+ /* size is 4 */
+typedef long RPC_DWORD;
+
+ /* size is 2 */
+typedef wchar_t RPC_CHAR;
+
+ /* size is 4 */
+typedef /* [string] */ RPC_CHAR __RPC_FAR *RPC_SZ;
+
+ /* size is 16 */
+typedef struct __MIDL_TriggerBackupRPC_0001
+ {
+ short rgwSystemTime[ 8 ];
+ } RPC_SYSTEMTIME;
+
+ /* size is 172 */
+typedef struct __MIDL_TriggerBackupRPC_0002
+ {
+ RPC_BYTE rgbTzi[ 172 ];
+ } RPC_TIME_ZONE_INFORMATION;
+
+ /* size is 28 */
+typedef struct __MIDL_TriggerBackupRPC_0003
+ {
+ long rgdwServiceStatus[ 7 ];
+ } RPC_SERVICE_STATUS;
+
+#define ecOK 0 // no error
+#define ecGeneralFailure 50001 // a failure occurred that caused proxy generation to stop
+#define ecSomeProxiesFailed 50002 // some proxies failed to get generated
+#define ecTargetNotValid 50003 // supplied target address not valid
+#define ecTargetNotUnique 50004 // supplied target address not unique
+#define ecProxyDLLNotImplemented 50005 // not implemented yet
+#define ecProxyDLLOOM 50006 // memory allocation error
+#define ecProxyDLLError 50007 // general error
+#define ecProxyDLLProtocol 50008 // protocol error
+#define ecProxyDLLSyntax 50009 // syntax error
+#define ecProxyDLLEOF 50010 // end of file
+#define ecProxyDLLSoftware 50011 // error in software
+#define ecProxyDLLConfig 50012 // configuration error
+#define ecProxyDLLContention 50013 // contention error
+#define ecProxyDLLNotFound 50014 // not found
+#define ecProxyDLLDiskSpace 50015 // out of disk space
+#define ecProxyDLLException 50016 // exception thrown
+#define ecProxyDLLDefault 50017 // unknown error
+#define ecProxyNotValid 50018 // supplied proxy not valid
+#define ecProxyNotUnique 50019 // supplied proxy not unique or unable to generate a unique proxy
+#define ecProxyDuplicate 50020 // a primary proxy of the same type was also supplied
+ /* size is 16 */
+typedef struct _PROXYNODE
+ {
+ struct _PROXYNODE __RPC_FAR *pnodeNext;
+ RPC_SZ wszProxy;
+ RPC_EC ec;
+ RPC_SZ wszDN;
+ } PROXYNODE;
+
+ /* size is 4 */
+typedef struct _PROXYNODE __RPC_FAR *PPROXYNODE;
+
+ /* size is 48 */
+typedef struct _PROXYINFO
+ {
+ RPC_BOOL fContinueOnError;
+ RPC_BOOL fIgnoreOldSecondaries;
+ RPC_SZ wszDN;
+ RPC_SZ wszNickName;
+ RPC_SZ wszCommonName;
+ RPC_SZ wszDisplayName;
+ RPC_SZ wszSurName;
+ RPC_SZ wszGivenName;
+ RPC_SZ wszInitials;
+ RPC_SZ wszTargetAddress;
+ PROXYNODE __RPC_FAR *pPNVerifyProxy;
+ PROXYNODE __RPC_FAR *pPNExcludeProxy;
+ } PROXYINFO;
+
+ /* size is 4 */
+typedef struct _PROXYINFO __RPC_FAR *PPROXYINFO;
+
+ /* size is 8 */
+typedef struct _PROXYLIST
+ {
+ PROXYNODE __RPC_FAR *__RPC_FAR *ppPNProxy;
+ PROXYNODE __RPC_FAR *__RPC_FAR *ppPNFailedProxyType;
+ } PROXYLIST;
+
+ /* size is 4 */
+typedef struct _PROXYLIST __RPC_FAR *PPROXYLIST;
+
+ /* size is 192 */
+typedef struct __MIDL_TriggerBackupRPC_0004
+ {
+ RPC_SYSTEMTIME st;
+ RPC_TIME_ZONE_INFORMATION tzi;
+ RPC_DWORD dwReturn;
+ } RemoteSystemTimeInfo;
+
+ /* size is 48 */
+typedef struct _RemoteServiceStatus
+ {
+ RPC_SC sc;
+ RPC_SZ szShortName;
+ RPC_SZ szDisplayName;
+ RPC_SZ szVersion;
+ RPC_SERVICE_STATUS ss;
+ struct _RemoteServiceStatus __RPC_FAR *prssNext;
+ } RemoteServiceStatus;
+
+#define rmsSuspendRepair 0x0001
+#define rmsSuspendNotif 0x0002
+ /* size is 24 */
+typedef struct _RemoteMaintenanceStatus
+ {
+ RPC_DWORD dwStatus;
+ RPC_SYSTEMTIME st;
+ RPC_SZ szUser;
+ } RemoteMaintenanceStatus;
+
+ /* size is 12 */
+typedef struct _BackupListNode
+ {
+ struct _BackupListNode __RPC_FAR *pnodeNext;
+ struct _BackupListNode __RPC_FAR *pnodeChildren;
+ RPC_SZ szName;
+ } BackupListNode;
+
+ /* size is 44 */
+typedef struct _DistributedLockOwner
+ {
+ RPC_CHAR rgchComputer[ 17 ];
+ RPC_DWORD dwPID;
+ RPC_DWORD dwTID;
+ } DistributedLockOwner;
+
+#define DLR_NO_WAIT 0x00000001
+#define cchMaxLockName 17
+ /* size is 84 */
+typedef struct _DistributedLockRequest
+ {
+ RPC_CHAR rgchLockName[ 17 ];
+ RPC_DWORD dwFlags;
+ DistributedLockOwner dlo;
+ } DistributedLockRequest;
+
+ /* size is 48 */
+typedef struct _DistributedLockReply
+ {
+ RPC_BOOL fGranted;
+ DistributedLockOwner dlo;
+ } DistributedLockReply;
+
+#endif // #ifndef RPC_COMMON_IDL
+ /* size is 4 */
+RPC_SC __cdecl ScGetBackupListNode(
+ /* [in] */ handle_t h,
+ /* [out][in] */ BackupListNode __RPC_FAR *__RPC_FAR *ppnode);
+
+
+
+extern RPC_IF_HANDLE TriggerBackupRPC_ClientIfHandle;
+extern RPC_IF_HANDLE TriggerBackupRPC_ServerIfHandle;
+#endif /* __TriggerBackupRPC_INTERFACE_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/exchange/inc/rpcpri.h b/private/utils/ntbackup/exchange/inc/rpcpri.h
new file mode 100644
index 000000000..4d41fc290
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/rpcpri.h
@@ -0,0 +1,288 @@
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+/* File created by MIDL compiler version 2.00.0104 */
+/* at Mon Jan 29 16:52:33 1996
+ */
+//@@MIDL_FILE_HEADING( )
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __rpcpri_h__
+#define __rpcpri_h__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/* Forward Declarations */
+
+void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void __RPC_FAR * );
+
+#ifndef __TriggerPrivateRPC_INTERFACE_DEFINED__
+#define __TriggerPrivateRPC_INTERFACE_DEFINED__
+
+/****************************************
+ * Generated header for interface: TriggerPrivateRPC
+ * at Mon Jan 29 16:52:33 1996
+ * using MIDL 2.00.0104
+ ****************************************/
+/* [auto_handle][unique][version][uuid] */
+
+
+#ifndef RPC_COMMON_IDL
+#define RPC_COMMON_IDL
+#define szTriggerRPCProtocol TEXT("ncacn_np")
+#define szTriggerRPCSecurity TEXT("Security=impersonation dynamic true")
+ /* size is 4 */
+typedef long RPC_BOOL;
+
+ /* size is 1 */
+typedef small RPC_BYTE;
+
+ /* size is 4 */
+typedef long RPC_INT;
+
+ /* size is 4 */
+typedef long RPC_SC;
+
+ /* size is 4 */
+typedef long RPC_EC;
+
+ /* size is 4 */
+typedef long RPC_DWORD;
+
+ /* size is 2 */
+typedef wchar_t RPC_CHAR;
+
+ /* size is 4 */
+typedef /* [string] */ RPC_CHAR __RPC_FAR *RPC_SZ;
+
+ /* size is 16 */
+typedef struct __MIDL_TriggerPrivateRPC_0001
+ {
+ short rgwSystemTime[ 8 ];
+ } RPC_SYSTEMTIME;
+
+ /* size is 172 */
+typedef struct __MIDL_TriggerPrivateRPC_0002
+ {
+ RPC_BYTE rgbTzi[ 172 ];
+ } RPC_TIME_ZONE_INFORMATION;
+
+ /* size is 28 */
+typedef struct __MIDL_TriggerPrivateRPC_0003
+ {
+ long rgdwServiceStatus[ 7 ];
+ } RPC_SERVICE_STATUS;
+
+#define ecOK 0 // no error
+#define ecGeneralFailure 50001 // a failure occurred that caused proxy generation to stop
+#define ecSomeProxiesFailed 50002 // some proxies failed to get generated
+#define ecTargetNotValid 50003 // supplied target address not valid
+#define ecTargetNotUnique 50004 // supplied target address not unique
+#define ecProxyDLLNotImplemented 50005 // not implemented yet
+#define ecProxyDLLOOM 50006 // memory allocation error
+#define ecProxyDLLError 50007 // general error
+#define ecProxyDLLProtocol 50008 // protocol error
+#define ecProxyDLLSyntax 50009 // syntax error
+#define ecProxyDLLEOF 50010 // end of file
+#define ecProxyDLLSoftware 50011 // error in software
+#define ecProxyDLLConfig 50012 // configuration error
+#define ecProxyDLLContention 50013 // contention error
+#define ecProxyDLLNotFound 50014 // not found
+#define ecProxyDLLDiskSpace 50015 // out of disk space
+#define ecProxyDLLException 50016 // exception thrown
+#define ecProxyDLLDefault 50017 // unknown error
+#define ecProxyNotValid 50018 // supplied proxy not valid
+#define ecProxyNotUnique 50019 // supplied proxy not unique or unable to generate a unique proxy
+#define ecProxyDuplicate 50020 // a primary proxy of the same type was also supplied
+ /* size is 16 */
+typedef struct _PROXYNODE
+ {
+ struct _PROXYNODE __RPC_FAR *pnodeNext;
+ RPC_SZ wszProxy;
+ RPC_EC ec;
+ RPC_SZ wszDN;
+ } PROXYNODE;
+
+ /* size is 4 */
+typedef struct _PROXYNODE __RPC_FAR *PPROXYNODE;
+
+ /* size is 48 */
+typedef struct _PROXYINFO
+ {
+ RPC_BOOL fContinueOnError;
+ RPC_BOOL fIgnoreOldSecondaries;
+ RPC_SZ wszDN;
+ RPC_SZ wszNickName;
+ RPC_SZ wszCommonName;
+ RPC_SZ wszDisplayName;
+ RPC_SZ wszSurName;
+ RPC_SZ wszGivenName;
+ RPC_SZ wszInitials;
+ RPC_SZ wszTargetAddress;
+ PROXYNODE __RPC_FAR *pPNVerifyProxy;
+ PROXYNODE __RPC_FAR *pPNExcludeProxy;
+ } PROXYINFO;
+
+ /* size is 4 */
+typedef struct _PROXYINFO __RPC_FAR *PPROXYINFO;
+
+ /* size is 8 */
+typedef struct _PROXYLIST
+ {
+ PROXYNODE __RPC_FAR *__RPC_FAR *ppPNProxy;
+ PROXYNODE __RPC_FAR *__RPC_FAR *ppPNFailedProxyType;
+ } PROXYLIST;
+
+ /* size is 4 */
+typedef struct _PROXYLIST __RPC_FAR *PPROXYLIST;
+
+ /* size is 192 */
+typedef struct __MIDL_TriggerPrivateRPC_0004
+ {
+ RPC_SYSTEMTIME st;
+ RPC_TIME_ZONE_INFORMATION tzi;
+ RPC_DWORD dwReturn;
+ } RemoteSystemTimeInfo;
+
+ /* size is 48 */
+typedef struct _RemoteServiceStatus
+ {
+ RPC_SC sc;
+ RPC_SZ szShortName;
+ RPC_SZ szDisplayName;
+ RPC_SZ szVersion;
+ RPC_SERVICE_STATUS ss;
+ struct _RemoteServiceStatus __RPC_FAR *prssNext;
+ } RemoteServiceStatus;
+
+#define rmsSuspendRepair 0x0001
+#define rmsSuspendNotif 0x0002
+ /* size is 24 */
+typedef struct _RemoteMaintenanceStatus
+ {
+ RPC_DWORD dwStatus;
+ RPC_SYSTEMTIME st;
+ RPC_SZ szUser;
+ } RemoteMaintenanceStatus;
+
+ /* size is 12 */
+typedef struct _BackupListNode
+ {
+ struct _BackupListNode __RPC_FAR *pnodeNext;
+ struct _BackupListNode __RPC_FAR *pnodeChildren;
+ RPC_SZ szName;
+ } BackupListNode;
+
+ /* size is 44 */
+typedef struct _DistributedLockOwner
+ {
+ RPC_CHAR rgchComputer[ 17 ];
+ RPC_DWORD dwPID;
+ RPC_DWORD dwTID;
+ } DistributedLockOwner;
+
+#define DLR_NO_WAIT 0x00000001
+#define cchMaxLockName 17
+ /* size is 84 */
+typedef struct _DistributedLockRequest
+ {
+ RPC_CHAR rgchLockName[ 17 ];
+ RPC_DWORD dwFlags;
+ DistributedLockOwner dlo;
+ } DistributedLockRequest;
+
+ /* size is 48 */
+typedef struct _DistributedLockReply
+ {
+ RPC_BOOL fGranted;
+ DistributedLockOwner dlo;
+ } DistributedLockReply;
+
+#endif // #ifndef RPC_COMMON_IDL
+ /* size is 4 */
+RPC_SC __cdecl ScGetMaintenanceMode(
+ /* [in] */ handle_t h,
+ /* [out] */ RPC_DWORD __RPC_FAR *pdw,
+ /* [out] */ RPC_SYSTEMTIME __RPC_FAR *pst,
+ /* [out] */ RPC_SZ __RPC_FAR *pszUser);
+
+ /* size is 4 */
+RPC_SC __cdecl ScSetMaintenanceMode(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_DWORD dw,
+ /* [in] */ RPC_SZ szUser);
+
+ /* size is 4 */
+RPC_SC __cdecl ScGetRemoteSystemTime(
+ /* [in] */ handle_t h,
+ /* [out] */ RPC_SYSTEMTIME __RPC_FAR *pst);
+
+ /* size is 4 */
+RPC_SC __cdecl ScSetRemoteSystemTime(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_SYSTEMTIME __RPC_FAR *pst);
+
+#define dwServerFlagMapiRunning 0x00000001
+#define dwServerFlagNoPrivateStore 0x00000002
+ /* size is 4 */
+RPC_SC __cdecl ScGetRemoteServerStatus(
+ /* [in] */ handle_t h,
+ /* [out] */ RPC_DWORD __RPC_FAR *pdwServerFlags,
+ /* [out] */ RemoteSystemTimeInfo __RPC_FAR *prsti,
+ /* [out][in] */ RemoteServiceStatus __RPC_FAR *prss,
+ /* [out] */ RemoteMaintenanceStatus __RPC_FAR *prms);
+
+ /* size is 4 */
+RPC_SC __cdecl ScRunOffLineABTask(
+ /* [in] */ handle_t h);
+
+ /* size is 4 */
+RPC_SC __cdecl ScGetDistributedLock(
+ /* [in] */ handle_t h,
+ /* [in] */ DistributedLockRequest __RPC_FAR *pdlRequest,
+ /* [out] */ DistributedLockReply __RPC_FAR *pdlReply);
+
+ /* size is 4 */
+RPC_SC __cdecl ScReleaseDistributedLock(
+ /* [in] */ handle_t h,
+ /* [in] */ DistributedLockRequest __RPC_FAR *pdlRequest);
+
+ /* size is 4 */
+RPC_SC __cdecl ScKillDistributedLock(
+ /* [in] */ handle_t h,
+ /* [in] */ DistributedLockRequest __RPC_FAR *pdlRequest,
+ /* [out] */ DistributedLockReply __RPC_FAR *pdlReply);
+
+ /* size is 4 */
+RPC_SC __cdecl ScRasEnumEntries(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_INT cb,
+ /* [size_is][out] */ RPC_BYTE __RPC_FAR rgbRasEnumEntries[ ],
+ /* [out] */ RPC_INT __RPC_FAR *pcEntries);
+
+ /* size is 4 */
+RPC_SC __cdecl ScGetExtensionPath(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_SZ szExtensionName,
+ /* [in] */ RPC_SZ szExtensionCPU,
+ /* [out] */ RPC_SZ __RPC_FAR *pszExtensionPath);
+
+
+
+extern RPC_IF_HANDLE TriggerPrivateRPC_ClientIfHandle;
+extern RPC_IF_HANDLE TriggerPrivateRPC_ServerIfHandle;
+#endif /* __TriggerPrivateRPC_INTERFACE_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/exchange/inc/rpcpub.h b/private/utils/ntbackup/exchange/inc/rpcpub.h
new file mode 100644
index 000000000..8be1b562b
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/rpcpub.h
@@ -0,0 +1,387 @@
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+/* File created by MIDL compiler version 2.00.0104 */
+/* at Mon Jan 29 16:52:25 1996
+ */
+//@@MIDL_FILE_HEADING( )
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __rpcpub_h__
+#define __rpcpub_h__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/* Forward Declarations */
+
+void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void __RPC_FAR * );
+
+#ifndef __TriggerPublicRPC_INTERFACE_DEFINED__
+#define __TriggerPublicRPC_INTERFACE_DEFINED__
+
+/****************************************
+ * Generated header for interface: TriggerPublicRPC
+ * at Mon Jan 29 16:52:25 1996
+ * using MIDL 2.00.0104
+ ****************************************/
+/* [auto_handle][unique][version][uuid] */
+
+
+#ifndef RPC_COMMON_IDL
+#define RPC_COMMON_IDL
+#define szTriggerRPCProtocol TEXT("ncacn_np")
+#define szTriggerRPCSecurity TEXT("Security=impersonation dynamic true")
+ /* size is 4 */
+typedef long RPC_BOOL;
+
+ /* size is 1 */
+typedef small RPC_BYTE;
+
+ /* size is 4 */
+typedef long RPC_INT;
+
+ /* size is 4 */
+typedef long RPC_SC;
+
+ /* size is 4 */
+typedef long RPC_EC;
+
+ /* size is 4 */
+typedef long RPC_DWORD;
+
+ /* size is 2 */
+typedef wchar_t RPC_CHAR;
+
+ /* size is 4 */
+typedef /* [string] */ RPC_CHAR __RPC_FAR *RPC_SZ;
+
+ /* size is 16 */
+typedef struct __MIDL_TriggerPublicRPC_0001
+ {
+ short rgwSystemTime[ 8 ];
+ } RPC_SYSTEMTIME;
+
+ /* size is 172 */
+typedef struct __MIDL_TriggerPublicRPC_0002
+ {
+ RPC_BYTE rgbTzi[ 172 ];
+ } RPC_TIME_ZONE_INFORMATION;
+
+ /* size is 28 */
+typedef struct __MIDL_TriggerPublicRPC_0003
+ {
+ long rgdwServiceStatus[ 7 ];
+ } RPC_SERVICE_STATUS;
+
+#define ecOK 0 // no error
+#define ecGeneralFailure 50001 // a failure occurred that caused proxy generation to stop
+#define ecSomeProxiesFailed 50002 // some proxies failed to get generated
+#define ecTargetNotValid 50003 // supplied target address not valid
+#define ecTargetNotUnique 50004 // supplied target address not unique
+#define ecProxyDLLNotImplemented 50005 // not implemented yet
+#define ecProxyDLLOOM 50006 // memory allocation error
+#define ecProxyDLLError 50007 // general error
+#define ecProxyDLLProtocol 50008 // protocol error
+#define ecProxyDLLSyntax 50009 // syntax error
+#define ecProxyDLLEOF 50010 // end of file
+#define ecProxyDLLSoftware 50011 // error in software
+#define ecProxyDLLConfig 50012 // configuration error
+#define ecProxyDLLContention 50013 // contention error
+#define ecProxyDLLNotFound 50014 // not found
+#define ecProxyDLLDiskSpace 50015 // out of disk space
+#define ecProxyDLLException 50016 // exception thrown
+#define ecProxyDLLDefault 50017 // unknown error
+#define ecProxyNotValid 50018 // supplied proxy not valid
+#define ecProxyNotUnique 50019 // supplied proxy not unique or unable to generate a unique proxy
+#define ecProxyDuplicate 50020 // a primary proxy of the same type was also supplied
+ /* size is 16 */
+typedef struct _PROXYNODE
+ {
+ struct _PROXYNODE __RPC_FAR *pnodeNext;
+ RPC_SZ wszProxy;
+ RPC_EC ec;
+ RPC_SZ wszDN;
+ } PROXYNODE;
+
+ /* size is 4 */
+typedef struct _PROXYNODE __RPC_FAR *PPROXYNODE;
+
+ /* size is 48 */
+typedef struct _PROXYINFO
+ {
+ RPC_BOOL fContinueOnError;
+ RPC_BOOL fIgnoreOldSecondaries;
+ RPC_SZ wszDN;
+ RPC_SZ wszNickName;
+ RPC_SZ wszCommonName;
+ RPC_SZ wszDisplayName;
+ RPC_SZ wszSurName;
+ RPC_SZ wszGivenName;
+ RPC_SZ wszInitials;
+ RPC_SZ wszTargetAddress;
+ PROXYNODE __RPC_FAR *pPNVerifyProxy;
+ PROXYNODE __RPC_FAR *pPNExcludeProxy;
+ } PROXYINFO;
+
+ /* size is 4 */
+typedef struct _PROXYINFO __RPC_FAR *PPROXYINFO;
+
+ /* size is 8 */
+typedef struct _PROXYLIST
+ {
+ PROXYNODE __RPC_FAR *__RPC_FAR *ppPNProxy;
+ PROXYNODE __RPC_FAR *__RPC_FAR *ppPNFailedProxyType;
+ } PROXYLIST;
+
+ /* size is 4 */
+typedef struct _PROXYLIST __RPC_FAR *PPROXYLIST;
+
+ /* size is 192 */
+typedef struct __MIDL_TriggerPublicRPC_0004
+ {
+ RPC_SYSTEMTIME st;
+ RPC_TIME_ZONE_INFORMATION tzi;
+ RPC_DWORD dwReturn;
+ } RemoteSystemTimeInfo;
+
+ /* size is 48 */
+typedef struct _RemoteServiceStatus
+ {
+ RPC_SC sc;
+ RPC_SZ szShortName;
+ RPC_SZ szDisplayName;
+ RPC_SZ szVersion;
+ RPC_SERVICE_STATUS ss;
+ struct _RemoteServiceStatus __RPC_FAR *prssNext;
+ } RemoteServiceStatus;
+
+#define rmsSuspendRepair 0x0001
+#define rmsSuspendNotif 0x0002
+ /* size is 24 */
+typedef struct _RemoteMaintenanceStatus
+ {
+ RPC_DWORD dwStatus;
+ RPC_SYSTEMTIME st;
+ RPC_SZ szUser;
+ } RemoteMaintenanceStatus;
+
+ /* size is 12 */
+typedef struct _BackupListNode
+ {
+ struct _BackupListNode __RPC_FAR *pnodeNext;
+ struct _BackupListNode __RPC_FAR *pnodeChildren;
+ RPC_SZ szName;
+ } BackupListNode;
+
+ /* size is 44 */
+typedef struct _DistributedLockOwner
+ {
+ RPC_CHAR rgchComputer[ 17 ];
+ RPC_DWORD dwPID;
+ RPC_DWORD dwTID;
+ } DistributedLockOwner;
+
+#define DLR_NO_WAIT 0x00000001
+#define cchMaxLockName 17
+ /* size is 84 */
+typedef struct _DistributedLockRequest
+ {
+ RPC_CHAR rgchLockName[ 17 ];
+ RPC_DWORD dwFlags;
+ DistributedLockOwner dlo;
+ } DistributedLockRequest;
+
+ /* size is 48 */
+typedef struct _DistributedLockReply
+ {
+ RPC_BOOL fGranted;
+ DistributedLockOwner dlo;
+ } DistributedLockReply;
+
+#endif // #ifndef RPC_COMMON_IDL
+ /* size is 4 */
+RPC_SC __cdecl ScNetworkTimingTest(
+ /* [in] */ handle_t h,
+ /* [in] */ long cbSend,
+ /* [size_is][in] */ small __RPC_FAR rgbSend[ ],
+ /* [in] */ long cbReceive,
+ /* [size_is][out] */ small __RPC_FAR rgbReceive[ ]);
+
+ /* size is 4 */
+RPC_SC __cdecl ScRunRID(
+ /* [in] */ handle_t h);
+
+ /* size is 4 */
+RPC_SC __cdecl ScRunRIDEx(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_BOOL fProxySpace,
+ /* [in] */ RPC_BOOL fGwart);
+
+ /* size is 4 */
+RPC_SC __cdecl ScRunDRACheck(
+ /* [in] */ handle_t h,
+ RPC_DWORD dw);
+
+#define BPTAdd 1
+#define BPTRemove 2
+#define BPTUpdate 3
+ /* size is 4 */
+RPC_SC __cdecl ScBulkCreateProxy(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_SZ szHeader,
+ /* [in] */ RPC_DWORD dwOptions);
+
+ /* size is 4 */
+RPC_SC __cdecl ScBulkCreateMultiProxy(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_INT cszHeader,
+ /* [size_is][in] */ RPC_SZ __RPC_FAR rgszRecipients[ ],
+ /* [in] */ RPC_DWORD dwOptions);
+
+ /* size is 4 */
+RPC_SC __cdecl ScBulkUpdateMultiProxy(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_INT cszSiteAddress,
+ /* [size_is][in] */ RPC_SZ __RPC_FAR rgszOldSiteAddress[ ],
+ /* [size_is][in] */ RPC_SZ __RPC_FAR rgszNewSiteAddress[ ],
+ /* [in] */ RPC_BOOL fSaveSiteAddress);
+
+ /* size is 4 */
+RPC_SC __cdecl ScGetBulkProxyStatus(
+ /* [in] */ handle_t h,
+ /* [out] */ RPC_SYSTEMTIME __RPC_FAR *pstTimeStart,
+ /* [out] */ RPC_DWORD __RPC_FAR *pdwTimeStart,
+ /* [out] */ RPC_DWORD __RPC_FAR *pdwTimeCur,
+ /* [out] */ RPC_INT __RPC_FAR *piRecipients,
+ /* [out] */ RPC_INT __RPC_FAR *pcRecipients);
+
+ /* size is 4 */
+RPC_SC __cdecl ScBulkProxyHalt(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_BOOL fWaitForShutdown);
+
+ /* size is 4 */
+RPC_EC __cdecl EcGetProxies(
+ /* [in] */ handle_t h,
+ /* [in] */ PPROXYINFO pProxyInfo,
+ /* [out][in] */ PPROXYLIST pProxyList);
+
+ /* size is 4 */
+RPC_SC __cdecl ScIsProxyUnique(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_SZ szProxy,
+ /* [out] */ RPC_BOOL __RPC_FAR *pfUnique,
+ /* [out] */ RPC_SZ __RPC_FAR *pszOwner);
+
+ /* size is 4 */
+RPC_SC __cdecl ScProxyValidate(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_SZ szProxy,
+ /* [out] */ RPC_BOOL __RPC_FAR *pfValid,
+ /* [out] */ RPC_SZ __RPC_FAR *pszProxyCorrected);
+
+ /* size is 4 */
+RPC_SC __cdecl ScSiteProxyValidate(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_SZ szSiteProxy,
+ /* [out] */ RPC_BOOL __RPC_FAR *pfValid,
+ /* [out] */ RPC_SZ __RPC_FAR *pszSiteProxyCorrected);
+
+ /* size is 4 */
+RPC_SC __cdecl ScProxyReset(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_BOOL fWaitUntilCompleted);
+
+#define scNoError 0
+#define scInvalidData 1
+#define scCannotLogData 2
+ /* size is 4 */
+RPC_SC __cdecl ScSaveTrackingData(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_INT cb,
+ /* [size_is][in] */ RPC_BYTE __RPC_FAR pb[ ],
+ /* [in] */ RPC_DWORD dwFlags);
+
+#define tevtMessageTransferIn 0
+#define tevtReportTransferIn 2
+#define tevtMessageSubmission 4
+#define tevtMessageTransferOut 7
+#define tevtReportTransferOut 8
+#define tevtMessageDelivery 9
+#define tevtReportDelivery 10
+#define tevtStartAssocByMTSUser 18
+#define tevtReleaseAssocByMTSUser 23
+#define tevtDLExpansion 26
+#define tevtRedirection 28
+#define tevtRerouting 29
+#define tevtDowngrading 31
+#define tevtReportAbsorption 33
+#define tevtReportGenerated 34
+#define tevtUnroutableReportDiscard 43
+#define tevtMessageLocalDelivery 1000
+#define tevtMessageBackboneTransferIn 1001
+#define tevtMessageBackboneTransferOut 1002
+#define tevtMessageGatewayTransferOut 1003
+#define tevtMessageGatewayTransferIn 1004
+#define tevtReportGatewayTransferIn 1005
+#define tevtReportGatewayTransferOut 1006
+#define tevtReportGatewayGenerated 1007
+#define tevtUserMin 2000
+ /* size is 60 */
+typedef struct __MIDL_TriggerPublicRPC_0005
+ {
+ RPC_INT nEventType;
+ RPC_SYSTEMTIME stEvent;
+ RPC_SZ szGatewayName;
+ RPC_SZ szPartner;
+ RPC_SZ szMTSID;
+ RPC_SZ szRemoteID;
+ RPC_SZ szOriginator;
+ RPC_INT nPriority;
+ RPC_INT nLength;
+ RPC_INT nSeconds;
+ RPC_INT nCost;
+ RPC_SZ szSubjectID;
+ } RPC_GATEWAY_TRACK_INFORMATION;
+
+ /* size is 4 */
+RPC_SC __cdecl ScSaveGatewayTrackingData(
+ /* [in] */ handle_t h,
+ /* [in] */ RPC_GATEWAY_TRACK_INFORMATION __RPC_FAR *pgti,
+ /* [in] */ RPC_INT cszRecipients,
+ /* [size_is][in] */ RPC_SZ __RPC_FAR rgszRecipients[ ]);
+
+
+
+extern RPC_IF_HANDLE TriggerPublicRPC_ClientIfHandle;
+extern RPC_IF_HANDLE TriggerPublicRPC_ServerIfHandle;
+#endif /* __TriggerPublicRPC_INTERFACE_DEFINED__ */
+
+/****************************************
+ * Generated header for interface: __MIDL__intf_0001
+ * at Mon Jan 29 16:52:25 1996
+ * using MIDL 2.00.0104
+ ****************************************/
+/* [local] */
+
+
+#define szTrackReportRecipientInfoDelivered L("\t0")
+#define szTrackReportRecipientInfoNonDelivered L("\t1")
+
+
+extern RPC_IF_HANDLE __MIDL__intf_0001_ClientIfHandle;
+extern RPC_IF_HANDLE __MIDL__intf_0001_ServerIfHandle;
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/exchange/inc/sadapi.h b/private/utils/ntbackup/exchange/inc/sadapi.h
new file mode 100644
index 000000000..ce471ed40
--- /dev/null
+++ b/private/utils/ntbackup/exchange/inc/sadapi.h
@@ -0,0 +1,197 @@
+/*
+ * sadapi.h
+ *
+ * Copyright (c) Microsoft Corp. 1986-1996. All Rights Reserved.
+ *
+ * Definition of the public RPC APIs from the SAD Exchange service
+ *
+ */
+
+
+#ifndef _SADLIB_H_
+#define _SADLIB_H_
+
+#include <rpcpub.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/*
+ * Return codes for all functions except SAD_EcGetProxies() and SAD_EcGetProxiesBI().
+ * In addition to this list are all normal NT error codes...
+ */
+typedef enum _SC_RETURN_VALUES
+{
+ SC_OK = 0, // no error
+ SC_Error = 49001, // general error
+ SC_BPActive, // bulk proxy generation is currently running
+ SC_BPInactive, // bulk proxy generation is not currently running
+ SC_BPShutdownPending, // a shutdown in bulk proxy generation is in progress
+ SC_BPSiteAddressMismatch, // a Site Address Mismatch between rgszOldSiteAddress
+ // and rgszNewSiteAddress lists in ScBulkUpdateMultiProxy
+} SC_RETURN_VALUES;
+
+
+#define cchMaxServer (MAX_COMPUTERNAME_LENGTH + 1)
+
+typedef struct _RPCBINDINFO
+{
+ handle_t h;
+ WCHAR wszServer[cchMaxServer];
+ RPC_IF_HANDLE hClientIfHandle;
+} RPCBINDINFO, *PRPCBINDINFO;
+
+
+// Utility entry points
+RPC_SC WINAPI SAD_ScBindA(PRPCBINDINFO pBI, LPSTR szServer);
+RPC_SC WINAPI SAD_ScBindW(PRPCBINDINFO pBI, LPWSTR wszServer);
+void WINAPI SAD_Unbind(PRPCBINDINFO pBI);
+
+#ifdef UNICODE
+#define SAD_ScBind SAD_ScBindW
+#else
+#define SAD_ScBind SAD_ScBindA
+#endif
+
+
+
+// Message Tracking group
+RPC_SC WINAPI SAD_ScSaveGatewayTrackingData(PRPCBINDINFO pBI,
+ RPC_GATEWAY_TRACK_INFORMATION * pgti,
+ INT cszRecipients,
+ LPWSTR rgwszRecipients[]);
+
+// for Microsoft Internal Use ONLY
+RPC_SC WINAPI SAD_ScSaveTrackingData(PRPCBINDINFO pBI, INT cb, BYTE pb[], DWORD dwFlags);
+
+
+// for Gateways - cause the routing table to be recalculated
+RPC_SC WINAPI SAD_ScRunRIDA(LPSTR szServer);
+RPC_SC WINAPI SAD_ScRunRIDW(LPWSTR wszServer);
+RPC_SC WINAPI SAD_ScRunRIDExA(LPSTR szServer, RPC_BOOL fProxySpace, RPC_BOOL fGwart);
+RPC_SC WINAPI SAD_ScRunRIDExW(LPWSTR wszServer, RPC_BOOL fProxySpace, RPC_BOOL fGwart);
+
+#ifdef UNICODE
+#define SAD_ScRunRID SAD_ScRunRIDW
+#define SAD_ScRunRIDEx SAD_ScRunRIDExW
+#else
+#define SAD_ScRunRID SAD_ScRunRIDA
+#define SAD_ScRunRIDEx SAD_ScRunRIDExA
+#endif
+
+
+
+// Proxy Entry points
+
+RPC_EC WINAPI SAD_EcGetProxies(LPWSTR wszServer, PPROXYINFO pProxyInfo, PPROXYLIST pProxyList);
+RPC_EC WINAPI SAD_EcGetProxiesBI(PRPCBINDINFO pBI, PPROXYINFO pProxyInfo, PPROXYLIST pProxyList);
+void WINAPI SAD_FreeProxyListNode(PPROXYNODE pnode);
+RPC_SC WINAPI SAD_ScIsProxyUniqueA(LPSTR szServer,
+ LPSTR szProxy, RPC_BOOL * pfUnique, LPSTR * pszExisting);
+RPC_SC WINAPI SAD_ScIsProxyUniqueW(LPWSTR wszServer,
+ LPWSTR szProxy, RPC_BOOL * pfUnique, LPWSTR * pszExisting);
+
+// dwOptions values for SAD_ScBulkCreateProxy() and SAD_ScBulkCreateMultiProxy()
+#define BPTAdd 1
+#define BPTRemove 2
+#define BPTUpdate 3
+
+RPC_SC WINAPI SAD_ScBulkCreateProxyA(LPSTR szServer, LPSTR szHeader, DWORD dwOptions);
+RPC_SC WINAPI SAD_ScBulkCreateProxyW(LPWSTR wszServer, LPWSTR wszHeader, DWORD dwOptions);
+RPC_SC WINAPI SAD_ScBulkCreateMultiProxyA(LPSTR szServer,
+ INT cszHeader,
+ LPSTR rgszHeader[],
+ DWORD dwOptions);
+RPC_SC WINAPI SAD_ScBulkCreateMultiProxyW(LPWSTR wszServer,
+ INT cwszHeader,
+ LPWSTR rgwszHeader[],
+ DWORD dwOptions);
+RPC_SC WINAPI SAD_ScBulkUpdateMultiProxy(LPWSTR wszServer,
+ INT cwszSiteAddress,
+ LPWSTR rgwszOldSiteAddress[],
+ LPWSTR rgwszNewSiteAddress[],
+ RPC_BOOL fSaveSiteAddress);
+
+
+RPC_SC WINAPI SAD_ScGetBulkProxyStatusA(LPSTR szServer,
+ RPC_SYSTEMTIME * pstTimeStart,
+ DWORD * pdwTimeStart,
+ DWORD * pdwTimeCur,
+ INT * piRecipients,
+ INT * pcRecipients);
+RPC_SC WINAPI SAD_ScGetBulkProxyStatusW(LPWSTR wszServer,
+ RPC_SYSTEMTIME * pstTimeStart,
+ DWORD * pdwTimeStart,
+ DWORD * pdwTimeCur,
+ INT * piRecipients,
+ INT * pcRecipients);
+RPC_SC WINAPI SAD_ScBulkProxyHaltA(LPSTR szServer, RPC_BOOL fWaitForShutdown);
+RPC_SC WINAPI SAD_ScBulkProxyHaltW(LPWSTR wszServer, RPC_BOOL fWaitForShutdown);
+
+#ifdef UNICODE
+#define SAD_ScIsProxyUnique SAD_ScIsProxyUniqueW
+#define SAD_ScBulkCreateProxy SAD_ScBulkCreateProxyW
+#define SAD_ScBulkCreateMultiProxy SAD_ScBulkCreateMultiProxyW
+#define SAD_ScGetBulkProxyStatus SAD_ScGetBulkProxyStatusW
+#define SAD_ScBulkProxyHalt SAD_ScBulkProxyHaltW
+#else
+#define SAD_ScIsProxyUnique SAD_ScIsProxyUniqueA
+#define SAD_ScBulkCreateProxy SAD_ScBulkCreateProxyA
+#define SAD_ScBulkCreateMultiProxy SAD_ScBulkCreateMultiProxyA
+#define SAD_ScGetBulkProxyStatus SAD_ScGetBulkProxyStatusA
+#define SAD_ScBulkProxyHalt SAD_ScBulkProxyHaltA
+#endif
+
+
+
+
+
+
+// Backup entry point (available only in UNICODE!)
+
+RPC_SC WINAPI SAD_ScGetBackupListNodeW(LPWSTR wszServer, BackupListNode ** ppnode);
+void WINAPI SAD_FreeBackupListNode(BackupListNode * pnode);
+
+
+// Run DRA Check calling parameters (dwCheck)
+#define INTRASITE_CHECK 0
+#define INTERSITE_CHECK 1
+
+RPC_SC WINAPI SAD_ScRunDRACheck(LPWSTR wszServer, RPC_DWORD dwCheck);
+
+
+
+// These few lines (or equivalent) need to be supplied by the application that links
+// with SADAPI.LIB.
+#ifdef _SAMPLE_CODE
+void __RPC_FAR * __RPC_API midl_user_allocate(size_t cb)
+{
+ void * pv;
+
+ pv = GlobalAlloc(GMEM_FIXED, cb);
+ if (!pv)
+ RpcRaiseException(RPC_S_OUT_OF_MEMORY);
+
+ return pv;
+}
+
+void __RPC_API midl_user_free(void __RPC_FAR * pv)
+{
+ GlobalFree(pv);
+}
+#endif
+
+
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef _SADLIB_H_
diff --git a/private/utils/ntbackup/exchange/readme.txt b/private/utils/ntbackup/exchange/readme.txt
new file mode 100644
index 000000000..bc2ba8226
--- /dev/null
+++ b/private/utils/ntbackup/exchange/readme.txt
@@ -0,0 +1,8 @@
+The files below this directory are coppied from Exchange's
+tdcommon directory.
+
+Please to not modify. Simply copy the updates from the
+\\iyf\src\tdcommon directory
+
+Thanks,
+Steve
diff --git a/private/utils/ntbackup/inc/abort.h b/private/utils/ntbackup/inc/abort.h
new file mode 100644
index 000000000..7c068fd3c
--- /dev/null
+++ b/private/utils/ntbackup/inc/abort.h
@@ -0,0 +1,30 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: abort.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+
+ $Log: G:/LOGFILES/ABORT.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:31:00 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _abort_h_
+#define _abort_h_
+
+#define CONTINUE_PROCESSING ( ( INT8 ) 0 )
+#define ABORT_CTRL_BREAK ( ( INT8 )-1 )
+#define ABORT_AT_EOM ( ( INT8 )-2 )
+#define ABORT_PROCESSED ( ( INT8 )-3 )
+
+#endif
diff --git a/private/utils/ntbackup/inc/add_icon.h b/private/utils/ntbackup/inc/add_icon.h
new file mode 100644
index 000000000..c71c1d282
--- /dev/null
+++ b/private/utils/ntbackup/inc/add_icon.h
@@ -0,0 +1,36 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: add_icon.h
+
+ Description: Dialog item IDs for adding an icon.
+
+ $Log: G:/UI/LOGFILES/ADD_ICON.H_V $
+
+ Rev 1.3 04 Oct 1992 19:46:10 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 06 Apr 1992 09:56:12 CHUCKB
+Added define for translation.
+
+ Rev 1.1 27 Jan 1992 12:50:52 GLENN
+Fixed dialog IDs.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_JOBPROGMANITEM 32
+#else
+#include "dlg_ids.h"
+#endif
+
+#ifndef _add_icon_h_
+
+#define _add_icon_h_
+
+#define IDD_J_JOBS 0x0068
+#define IDD_J_PMGROUPS 0x0069
+
+#endif
diff --git a/private/utils/ntbackup/inc/adv_rest.h b/private/utils/ntbackup/inc/adv_rest.h
new file mode 100644
index 000000000..4855399ae
--- /dev/null
+++ b/private/utils/ntbackup/inc/adv_rest.h
@@ -0,0 +1,35 @@
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_ADVRESTORE 7
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_A_INCL 106
+#define IDD_A_EXCL 107
+#define IDD_A_SUBDIRS 108
+#define IDD_A_PATH 110
+#define IDD_A_FILE 111
+#define IDD_A_TMONTH 126
+#define IDD_A_TDAY 127
+#define IDD_A_TYEAR 128
+#define IDD_A_FMONTH 129
+#define IDD_A_FDAY 130
+#define IDD_A_FYEAR 131
+#define IDD_A_FROMBOX 141
+#define IDD_A_TOBOX 142
+
+#define IDD_A_ALLFILES 0x016D
+#define IDD_A_RANGE 0x016F
+#define IDD_A_FROM_LEFT 0x0195
+#define IDD_A_TO_LEFT 0x0196
+#define IDD_A_FROM_RIGHT 0x0199
+#define IDD_A_TO_RIGHT 0x019A
+#define IDD_A_DEVICE 0x0167
+#define IDD_A_BACKUPSET 0x0168
+
+#define IDD_A_BACKUPSETLABEL 0x0169
+#define IDD_A_PATHLABEL 0x0202
+#define IDD_A_FILELABEL 0x0203
+#define IDD_A_DEVICELABEL 0x0166
+
diff --git a/private/utils/ntbackup/inc/adv_sel.h b/private/utils/ntbackup/inc/adv_sel.h
new file mode 100644
index 000000000..4e6c32807
--- /dev/null
+++ b/private/utils/ntbackup/inc/adv_sel.h
@@ -0,0 +1,61 @@
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SELECTADVANCED 3
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_A_DATES 105
+#define IDD_A_INCL 106
+#define IDD_A_EXCL 107
+#define IDD_A_SUBDIRS 108
+#define IDD_A_ONLYMOD 109
+#define IDD_A_PATH 110
+#define IDD_A_FILE 111
+#define IDD_A_TARGPATH 112
+#define IDD_A_NOTDEL 114
+#define IDD_A_ONLYDEL 115
+#define IDD_A_NOTACC 116
+#define IDD_A_NUMDAYS 117
+#define IDD_A_PITIME 118
+#define IDD_A_SALFILES 119
+#define IDD_A_HID 120
+#define IDD_A_READONLY 121
+#define IDD_A_SYS 122
+#define IDD_A_GROUP 123
+#define IDD_A_BEFORE 124
+#define IDD_A_AFTER 125
+#define IDD_A_TMONTH 126
+#define IDD_A_TDAY 127
+#define IDD_A_TYEAR 128
+#define IDD_A_FMONTH 129
+#define IDD_A_FDAY 130
+#define IDD_A_FYEAR 131
+#define IDD_SELECT_BOX 132
+#define IDD_UP 140
+#define IDD_A_FROMBOX 141
+#define IDD_A_TOBOX 142
+
+#define IDD_A_ALLFILES 0x016D
+#define IDD_A_ALLMOD 0x016E
+#define IDD_A_LASTNDAYS 0x0170
+#define IDD_A_RANGE 0x016F
+#define IDD_A_FROM 0x0191
+#define IDD_A_TO 0x0192
+#define IDD_A_FROM_1 0x0193
+#define IDD_A_TO_1 0x0194
+#define IDD_A_FROM_LEFT 0x0195
+#define IDD_A_TO_LEFT 0x0196
+#define IDD_A_FROM_2 0x0197
+#define IDD_A_TO_2 0x0198
+#define IDD_A_FROM_RIGHT 0x0199
+#define IDD_A_TO_RIGHT 0x019A
+#define IDD_A_FROM_3 0x019B
+#define IDD_A_TO_3 0x019C
+#define IDD_A_DEVICE 0x0167
+#define IDD_A_NUMWIN 0x0168
+
+#define IDD_THE_LAST 0xFFEE
+#define IDD_DAYS 0xFFEF
+
diff --git a/private/utils/ntbackup/inc/adv_serv.h b/private/utils/ntbackup/inc/adv_serv.h
new file mode 100644
index 000000000..573018eb9
--- /dev/null
+++ b/private/utils/ntbackup/inc/adv_serv.h
@@ -0,0 +1,53 @@
+
+#include "dlg_ids.h"
+
+#define IDD_A_DATES 105
+#define IDD_A_INCL 106
+#define IDD_A_EXCL 107
+#define IDD_A_SUBDIRS 108
+#define IDD_A_ONLYMOD 109
+#define IDD_A_PATH 110
+#define IDD_A_FILE 111
+#define IDD_A_TARGPATH 112
+#define IDD_A_NOTDEL 114
+#define IDD_A_ONLYDEL 115
+#define IDD_A_NOTACC 116
+#define IDD_A_NUMDAYS 117
+#define IDD_A_PITIME 118
+#define IDD_A_SALFILES 119
+#define IDD_A_HID 120
+#define IDD_A_READONLY 121
+#define IDD_A_SYS 122
+#define IDD_A_GROUP 123
+#define IDD_A_BEFORE 124
+#define IDD_A_AFTER 125
+#define IDD_A_TMONTH 126
+#define IDD_A_TDAY 127
+#define IDD_A_TYEAR 128
+#define IDD_A_FMONTH 129
+#define IDD_A_FDAY 130
+#define IDD_A_FYEAR 131
+#define IDD_SELECT_BOX 132
+#define IDD_UP 140
+#define IDD_A_FROMBOX 141
+#define IDD_A_TOBOX 142
+
+#define IDD_A_ALLFILES 0x016D
+#define IDD_A_ALLMOD 0x016E
+#define IDD_A_LASTNDAYS 0x0170
+#define IDD_A_RANGE 0x016F
+#define IDD_A_FROM 0x0191
+#define IDD_A_TO 0x0192
+#define IDD_A_FROM_1 0x0193
+#define IDD_A_TO_1 0x0194
+#define IDD_A_FROM_LEFT 0x0195
+#define IDD_A_TO_LEFT 0x0196
+#define IDD_A_FROM_2 0x0197
+#define IDD_A_TO_2 0x0198
+#define IDD_A_FROM_RIGHT 0x0199
+#define IDD_A_TO_RIGHT 0x019A
+#define IDD_A_FROM_3 0x019B
+#define IDD_A_TO_3 0x019C
+#define IDD_A_DEVICE 0x0167
+#define IDD_A_NUMWIN 0x0168
+
diff --git a/private/utils/ntbackup/inc/afp_fs.h b/private/utils/ntbackup/inc/afp_fs.h
new file mode 100644
index 000000000..fa389ece5
--- /dev/null
+++ b/private/utils/ntbackup/inc/afp_fs.h
@@ -0,0 +1,301 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: afp_fs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: N:/LOGFILES/AFP_FS.H_V $
+ *
+ * Rev 1.14 05 Jan 1993 13:21:22 CHUCKB
+ * Change per code review (took out AFP_IsBlkComplete).
+ *
+ * Rev 1.13 03 Dec 1992 16:48:24 CHUCKB
+ * Added prototype for AFP_IsBlockComplete().
+ *
+ * Rev 1.12 25 Nov 1992 10:51:10 CHUCKB
+ * Made changes for MTF 4.0.
+ *
+ * Rev 1.11 25 Sep 1992 16:08:18 CARLS
+ * added AFP_GetDispSizeDBLK
+ *
+ * Rev 1.10 24 Sep 1992 17:28:44 CHUCKB
+ * Changes for Graceful Red.
+ *
+ * Rev 1.9 22 Sep 1992 17:15:00 CHUCKB
+ * Removed references to fs_GetTotalSizeDBLK().
+ *
+ * Rev 1.8 17 Sep 1992 13:51:54 CHUCKB
+ * Changed return type of prototype for AFP_DetachDLE().
+ *
+ * Rev 1.7 28 Aug 1992 16:09:48 BARRY
+ * Added some 64-bit structures.
+ *
+ * Rev 1.6 28 May 1992 10:39:36 BARRY
+ * Added search mode support prototypes.
+ *
+ * Rev 1.5 20 Dec 1991 09:13:10 STEVEN
+ * move common functions into tables
+ *
+ * Rev 1.4 10 Sep 1991 18:18:36 DON
+ * if NLM, then handles need to be INT32
+ *
+ * Rev 1.3 15 Aug 1991 14:18:08 DON
+ * if OS_NLM, need a LONG trust_index
+ *
+ * Rev 1.2 23 May 1991 18:20:46 BARRY
+ * Remove prototype for function that's been removed.
+ *
+ * Rev 1.1 23 May 1991 16:46:38 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:31:02 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef AFP_FS_H
+#define AFP_FS_H
+
+typedef struct AFP_FILE_HAND_STRUCT {
+#if defined(OS_NLM)
+ UINT32 res_hand ;
+ UINT32 data_hand ;
+#else
+ UINT8 res_hand ;
+ UINT8 data_hand ;
+#endif
+ UINT32 res_size ;
+ UINT32 data_size ;
+ UINT32 res_offset ;
+ UINT32 data_offset ;
+ UINT32 trust_size ;
+ UINT32 trust_offset ;
+ UINT8 trust_format ;
+#if defined(OS_NLM)
+ UINT32 trust_index ; /* Holds trust read index between calls */
+#else
+ UINT16 trust_index ; /* Holds trust read index between calls */
+#endif
+ CHAR file_name[14] ; /* File name for subsequent trust calls */
+
+ UINT64 nextStreamHeaderPosition;
+ UINT64 objPos; /* Object position on restore */
+ UINT64 dataStart; /* Position start of stream's data */
+ UINT32 active_stream_id ; /* id of the stream being processed */
+
+} AFP_FILE_HAND_STRUCT, *AFP_FILE_HAND;
+
+typedef struct AFP_RESERVED_SH_STRUCT {
+ INT16 fhdl ; /* AFP file handle */
+ INT16 active ; /* is stream being processed */
+ STREAM_INFO sh ; /* AFP reserved stream info */
+} AFP_RESERVED_SH, *AFP_RESERVED_SH_PTR ;
+
+ /* sizeof FILE_HAND plus afp reserved struct */
+#define FS_SIZEOF_RESERVED_FILE_HAND \
+ ( sizeof(FILE_HAND_STRUCT) + sizeof(AFP_RESERVED_SH) )
+
+INT16 AFP_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 mask );
+
+INT16 AFP_AttachToDLE(
+ FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd ); /* I - passowrd NOT USED */
+
+INT16 AFP_DetachDLE( FSYS_HAND fsh ) ;
+
+INT16 AFP_PopMinDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 AFP_PushMinDDB(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 AFP_FindFirst(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ CHAR_PTR sname,
+ UINT16 find_type );
+
+INT16 AFP_GetObjInfo(
+ FSYS_HAND fsh ,
+ DBLK_PTR dblk );
+
+INT16 AFP_VerObjInfo(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 AFP_SetObjInfo(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+
+INT16 AFP_FindNext(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 AFP_ChangeDir(
+ FSYS_HAND fsh,
+ CHAR_PTR path,
+ INT16 psize ) ;
+
+INT16 AFP_UpDir( FSYS_HAND fsh ) ;
+
+INT16 AFP_GetCurrentPath(
+ FSYS_HAND fsh,
+ CHAR_PTR path,
+ INT16 *size );
+
+INT16 AFP_GetBasePath(
+ FSYS_HAND fsh,
+ CHAR_PTR base_path,
+ INT16 *size );
+
+INT16 AFP_GetCurrentDDB(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 AFP_GetSpecDBLKS(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ INT32 *index ) ;
+
+INT16 AFP_DeleteObj(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 AFP_MatchDBLK(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk1,
+ DBLK_PTR dblk2,
+ BOOLEAN disp_flag,
+ struct FSE *fse) ;
+
+INT16 AFP_SetAFPInfo( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 AFP_CreateObj(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 AFP_OpenObj(
+ FSYS_HAND fsh,
+ FILE_HAND *hand,
+ DBLK_PTR dblk,
+ OPEN_MODE mode ) ;
+
+INT16 AFP_CloseObj( FILE_HAND hand ) ;
+
+INT16 AFP_ReadObj(
+ FILE_HAND hand,
+ CHAR_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info ) ;
+
+INT16 AFP_SeekObj(
+ FILE_HAND hand,
+ UINT32 *offset );
+
+INT16 AFP_VerObj(
+ FILE_HAND hand,
+ CHAR_PTR buf,
+ CHAR_PTR data,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info ) ;
+
+INT16 AFP_WriteObj(
+ FILE_HAND hand,
+ CHAR_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info ) ;
+
+
+INT16 AFP_ModFnameFDB( FSYS_HAND fsh, BOOLEAN set_it, DBLK_PTR fdb, CHAR_PTR buf, INT16 *size );
+
+INT16 AFP_ModPathDDB( FSYS_HAND fsh, BOOLEAN set_it, DBLK_PTR fdb, CHAR_PTR buf, INT16 *size );
+
+INT16 AFP_GetOSFnameFDB( DBLK_PTR fdb, CHAR_PTR buf );
+
+INT16 AFP_GetOSPathDDB( FSYS_HAND fsh, DBLK_PTR fdb, CHAR_PTR buf );
+
+INT16 AFP_GetDirIDinDDB( DBLK_PTR ddb, CHAR_PTR buf );
+
+INT16 AFP_GetCdateDBLK( DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+INT16 AFP_ModBdateDBLK( BOOLEAN set_it, DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+INT16 AFP_GetMdateDBLK( DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+INT16 AFP_ModAdateDBLK( BOOLEAN set_it, DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+UINT64 AFP_GetDisplaySizeDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 AFP_GetFileVerFDB( DBLK_PTR dblk, UINT32 *ver ) ;
+
+INT16 AFP_ModAttribDBLK( BOOLEAN get_set, DBLK_PTR dblk, UINT32 *attrib) ;
+
+INT16 AFP_GetObjTypeDBLK( DBLK_PTR dblk, OBJECT_TYPE *type ) ;
+
+INT16 AFP_GetOS_InfoDBLK( DBLK_PTR dblk, CHAR_PTR os_info, INT16 *size ) ;
+
+INT16 AFP_GetActualSizeDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 AFP_SizeofFname( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+INT16 AFP_SizeofOSFname( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+INT16 AFP_SizeofOSPath( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 AFP_SizeofDirID( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 AFP_SizeofPath( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 AFP_SizeofOSInfo( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 AFP_CreateFDB( FSYS_HAND fsh, GEN_FDB_DATA_PTR data ) ;
+
+INT16 AFP_CreateDDB( FSYS_HAND fsh, GEN_DDB_DATA_PTR data ) ;
+
+VOID AFP_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+INT16 AFP_ChangeIntoDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 AFP_GetFileInfo386( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+INT16 AFP_GetDirInfo386( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 AFP_GetSearchMode( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+INT16 AFP_SetFileInfo386( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+UINT64 AFP_GetDispSizeDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+UINT16 AFP_SpecExcludeObj( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ DBLK_PTR fdb ) ; /* I - Descriptor block of fdb */
+
+UINT16 AFP_SetDataSize( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ UINT32 size ) ; /* I - new size */
+
+VOID AFP_CheckBindClose( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 AFP_ChangeIntoSubDir( FSYS_HAND fsh, CHAR_PTR l_path,
+ CHAR_PTR s_name, UINT32 entry_id ) ;
+
+VOID AFP_InitMakeData( FSYS_HAND fsh,
+ INT16 blkType,
+ CREATE_DBLK_PTR data );
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/afpdblk.h b/private/utils/ntbackup/inc/afpdblk.h
new file mode 100644
index 000000000..8e5b5a630
--- /dev/null
+++ b/private/utils/ntbackup/inc/afpdblk.h
@@ -0,0 +1,149 @@
+/** :IH1: Copyright (C) Maynard Electronics, Inc 1984-89
+
+:Name: afpcblk.h
+
+:Description: This file contains the definition of the Novell
+ file and directory control blocks.
+
+:Units: Novell < 2.15 File System
+
+
+ $Log: N:/LOGFILES/AFPDBLK.H_V $
+ *
+ * Rev 1.2 05 Jan 1993 17:41:44 CHUCKB
+ * Added some defines per code review.
+ *
+ * Rev 1.1 28 Aug 1992 16:10:28 BARRY
+ * No longer need nov386.h.
+ *
+ * Rev 1.0 09 May 1991 13:31:00 HUNTER
+ * Initial revision.
+
+
+
+**/
+
+#ifndef afpdblk_h
+#define afpdblk_h
+
+/* miximum Novell string lengths */
+#define AFP_MAX_FSIZE 33
+#define AFP_MAX_FLENGTH 32
+
+#define AFP_MAX_SHORT_NAME 16
+#define AFP_MAX_SHORT_PATH 255
+
+#define AFP_NET_HAND_SIZE 6
+
+#define AFP_READ_ONLY 1
+#define AFP_HIDDEN 2
+#define AFP_SYSTEM 4
+#define AFP_EXECUTE 8
+#define AFP_SUBDIR 0x10
+#define AFP_ARCHIVE 0x20
+#define AFP_SHARE 0x80
+#define AFP_TRANS 0x10
+#define AFP_INDEX 0x20
+#define AFP_IN_USE 0x8000
+#define AFP_EMPTY_DIR 0x8000
+
+/* Bit values for the AFP set info bit map */
+#define AFP_SET_ATTRIBUTES 0x0001 /* Set DOS and extended attrs */
+#define AFP_SET_CREATE_DATE 0x0002 /* Set creation date */
+#define AFP_SET_ACCESS_DATE 0x0004 /* Set last access date */
+#define AFP_SET_MODIFY_DATE 0x0008 /* Set modify date and time */
+#define AFP_SET_BACKUP_DATE 0x0010 /* Set archive date and time */
+#define AFP_SET_ALL_INFO 0xffff /* Set all fields */
+
+#define CONVERT_DOS_ATTRIB( atrib ) ((UINT32)(attrib) << 16 )
+
+/* defines used for FSYS_HAND reserved space */
+#define BIND_CLOSED 0x80
+#define BIND_FILE1 0x01 /* NET$BIND or NET$OBJ */
+#define BIND_FILE2 0x02 /* NET$BVAL or NET$VAL */
+#define BIND_FILE3 0x04 /* NET$PROP */
+#define BIND_ALL_286 0x03
+#define BIND_ALL_386 0x07
+
+
+typedef struct AFPNOV_COMMON {
+ UINT32 search_id ; /* */
+ UINT32 entry_id ; /* request */
+ CHAR filespec[AFP_MAX_FSIZE];
+
+
+ UINT16 attrib ;
+ UINT16 create_date ;
+ UINT16 access_date ; /* empty for directories */
+ UINT16 modify_date ;
+ UINT16 modify_time ;
+ UINT16 backup_date ;
+ UINT16 backup_time ;
+ UINT8 finder_info[32] ;
+ UINT8 long_name[AFP_MAX_FSIZE - 1] ;
+ UINT32 owner_id ;
+ CHAR short_name[15] ;
+
+ BOOLEAN os_info_complete ;
+ UINT16 tape_attribs ;
+
+} AFPNOV_COMMON ;
+
+typedef struct AFP_FDB {
+ UINT8 blk_type ; /* block id = FDB_ID */
+ COM_DBLK fs_reserved ;
+
+ AFPNOV_COMMON com ;
+
+ UINT32 data_fork_size ;
+ UINT32 data_fork_offset;
+ UINT32 res_fork_size ;
+ UINT32 res_fork_offset ;
+
+ UINT16 os_name ; /* for backup will be short name */
+
+ NOVELL_386_FILE info_386 ;
+
+} AFP_FDB, *AFP_FDB_PTR ;
+
+
+typedef struct AFP_DDB {
+ UINT8 blk_type ; /* block id = DDB_ID */
+ COM_DBLK fs_reserved ;
+
+ AFPNOV_COMMON com ;
+
+ UINT16 data_size ;
+ UINT32 creat_date ;
+ UINT8 max_rights ;
+ UINT32 trust_fork_size ;
+ UINT32 trust_fork_offset;
+
+ INT16 path_leng ;
+ UINT16 path ; /* short path names \FRED\SUE */
+
+ UINT16 long_path; /* long name for backup :FRED:SUE */
+ INT16 long_path_leng ;
+
+ UINT16 os_path; /* short name for backup */
+ INT16 os_path_leng ;
+
+ UINT8 trust_fork_format ;
+ NOVELL_386_DIR info_386 ;
+
+} AFP_DDB, *AFP_DDB_PTR;
+
+/*
+ Minimal DDB
+*/
+typedef struct AFP_MIN_DDB {
+ Q_ELEM q ;
+ UINT32 search_id ;
+ UINT32 entry_id ;
+ CHAR filespec[ AFP_MAX_FSIZE ] ; /* search path */
+ CHAR_PTR path; /* path made of short names */
+ CHAR_PTR long_path; /* path made from long names */
+} AFP_MIN_DDB, *AFP_MIN_DDB_PTR;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/afplib.h b/private/utils/ntbackup/inc/afplib.h
new file mode 100644
index 000000000..57119dc70
--- /dev/null
+++ b/private/utils/ntbackup/inc/afplib.h
@@ -0,0 +1,86 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: afplib.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: N:/LOGFILES/AFPLIB.H_V $
+ *
+ * Rev 1.3 25 Nov 1992 10:51:18 CHUCKB
+ * Made changes for MTF 4.0.
+ *
+ * Rev 1.2 13 Aug 1991 09:54:22 DAVIDH
+ * Updated for NLM.
+ *
+ * Rev 1.1 23 May 1991 16:46:16 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:31:20 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#define AFP_FORK_IND_DATA 0x00
+#define AFP_FORK_IND_RES 0x01
+
+#define AFP_DENY_NONE 0
+#define AFP_DENY_ALL 12
+#define AFP_DENY_WRITE 8
+
+#define AFP_READ_ACCESS 1
+#define AFP_WRITE_ACCESS 2
+#define AFP_VERIFY_ACCESS 0x81
+
+#define AFP_ACCESS_FILTER 0xf
+
+#ifndef afpdblk_h
+#include "afpdblk.h"
+#endif
+
+UINT32 AFP_GetEntryId(
+#if OS_NLM
+ FSYS_HAND fsh, /* I - File system handle used to get current path */
+#else
+ UINT8 drive_hand, /* I - Netware directory handle */
+#endif
+ CHAR_PTR path ) ; /* I - Netware path from handle */
+
+INT16 ScanDirAFP(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ UINT16 find_type ) ;
+
+INT16 GetFileInfoAFP(
+ FSYS_HAND fsh ,
+ DBLK_PTR dblk ) ;
+
+INT16 AFP_AllocTempHand( FSYS_HAND fsh, UINT32 entry_id, UINT8 *dir_hand ) ;
+
+INT16 AFP_GetIdForDDB(
+ FSYS_HAND fsh,
+ CHAR_PTR path,
+ UINT32 *id ) ;
+
+INT16 AFP_GetMaxRights(
+ FSYS_HAND fsh,
+ UINT32 entry_id,
+ UINT8 *max_rights,
+ UINT32 *creat_date ) ;
+
+INT16 GetShortNameAFP( FSYS_HAND, CHAR_PTR, CHAR_PTR, UINT32 * ) ;
+
+INT16 AFP_FixPathInCurDDB( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 AFP_LowLevelOpen( FSYS_HAND, AFP_FDB_PTR, UINT8 *, UINT8, UINT32 *, INT8 ) ;
+
+VOID ConvertHandAFP( FSYS_HAND fsh, CHAR_PTR net_hand, UINT32 fork_size,
+ UINT8 mode, UINT8 *dos_hand );
+
diff --git a/private/utils/ntbackup/inc/all.h b/private/utils/ntbackup/inc/all.h
new file mode 100644
index 000000000..b6d7f7768
--- /dev/null
+++ b/private/utils/ntbackup/inc/all.h
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <conio.h>
+#include <ctype.h>
+#include <io.h>
+#include <dos.h>
+#include <fcntl.h>
+#include <time.h>
+#include <string.h>
+#include <share.h>
+#include <direct.h>
+#include <errno.h>
+#include <assert.h>
+#include <sys\types.h>
+#include <sys\stat.h>
+
+#ifndef OS_WIN32 //16-bit specific stuff
+# include <bios.h>
+#endif
+
+#include <windows.h>
+#ifdef OS_WIN32 //32-bit specific stuff
+# include <port1632.h>
+#endif
+
+#include <dde.h>
+
+#include <commdlg.h> //common dialog types, etc.
+
+
+#if !defined( OEM_MSOFT ) // Microsoft app doesn't have email feature
+#include <mapi.h> // email
+#endif
+
+#include "portdefs.h"
+#include "stdtypes.h"
+#include "bengine.h"
+
+#ifdef OS_WIN32
+# include "omevent.h"
+#endif
+
+#ifndef SOME
+# include "some.h"
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/appdefs.h b/private/utils/ntbackup/inc/appdefs.h
new file mode 100644
index 000000000..b05d189c4
--- /dev/null
+++ b/private/utils/ntbackup/inc/appdefs.h
@@ -0,0 +1,177 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: appdefs.h
+
+ Description: This file includes global definitions.
+
+ $Log: G:/UI/LOGFILES/APPDEFS.H_V $
+
+ Rev 1.19 01 Mar 1994 15:52:22 STEVEN
+the compiler decides what a character's value is. We should be specific
+
+ Rev 1.18 16 Nov 1993 20:40:44 STEVEN
+increase size of temp strings
+
+ Rev 1.17 14 May 1993 16:21:14 CHUCKB
+Changed max tape password length to 32 for this week.
+
+ Rev 1.16 30 Apr 1993 16:04:00 GLENN
+Added Log file root name size stuff.
+
+ Rev 1.15 19 Apr 1993 15:19:12 GLENN
+Changed max tape name, bset name, bset description.
+
+ Rev 1.14 08 Apr 1993 17:33:32 chrish
+Changed NTPASSWORDPREFIX.
+
+ Rev 1.13 13 Nov 1992 17:40:54 chrish
+Increased tape password length to 256. Added stuff for Tape Security for NT.
+
+ Rev 1.12 01 Nov 1992 16:29:58 DAVEV
+Unicode changes
+
+ Rev 1.11 22 Oct 1992 14:06:12 DAVEV
+remove typedefs of LPSHORT & LPUSHORT
+
+ Rev 1.10 04 Oct 1992 19:46:16 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.9 19 May 1992 10:35:08 MIKEP
+mips changes
+
+ Rev 1.8 20 Apr 1992 13:51:44 GLENN
+Added define for status line text size.
+
+ Rev 1.7 10 Mar 1992 14:01:12 JOHNWT
+fixed block copy error
+
+ Rev 1.6 02 Mar 1992 17:38:00 CARLS
+added define for MAX_READ_TAPE_PASSWORD
+
+ Rev 1.5 19 Feb 1992 10:17:14 ROBG
+Added MAX_UI_FULLPATH_LEN, MAX_UI_SMALLRES_LEN.
+
+ Rev 1.4 11 Feb 1992 11:56:24 MIKEP
+bump size of filenames
+
+ Rev 1.3 06 Feb 1992 17:44:02 JOHNWT
+added pwdb things
+
+ Rev 1.2 23 Jan 1992 12:32:10 GLENN
+Added window title length and size definitions.
+
+ Rev 1.1 10 Jan 1992 16:48:34 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.0 20 Nov 1991 19:42:12 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#ifndef APPDEFS_H
+
+#define APPDEFS_H
+
+
+//
+// Special character added to beginning of the tape password when the
+// NTBACKUP application secures a tape. This character is also stored onto
+// the tape as the tape password under NTBACKUP app.
+//
+#define NTPASSWORDPREFIX ((CHAR)(254)) // This is an ASCII 254
+ // character
+
+//
+// Global Defines
+//
+
+#define MAX_READ_TAPE_PASSWORD_LEN 128
+#define MAX_READ_TAPE_PASSWORD_SIZE (MAX_TAPE_PASSWORD_LEN+1)
+
+#define MAX_TAPE_PASSWORD_LEN 32
+#define MAX_TAPE_PASSWORD_SIZE (MAX_TAPE_PASSWORD_LEN+1)
+
+#define MAX_UI_FILENAME_LEN 255
+#define MAX_UI_FILENAME_SIZE (MAX_UI_FILENAME_LEN+1)
+
+#define MAX_UI_PATH_LEN 255
+#define MAX_UI_PATH_SIZE (MAX_UI_PATH_LEN+1)
+
+#define MAX_UI_FULLPATH_LEN (MAX_UI_PATH_LEN+MAX_UI_FILENAME_LEN)
+#define MAX_UI_FULLPATH_SIZE (MAX_UI_PATH_LEN+MAX_UI_FILENAME_LEN+1)
+
+#define MAX_TAPE_NAME_LEN 50
+#define MAX_TAPE_NAME_SIZE (MAX_TAPE_NAME_LEN+1)
+
+#define MAX_BSET_NAME_LEN 50
+#define MAX_BSET_NAME_SIZE (MAX_BSET_NAME_LEN+1)
+
+#define MAX_BSET_DESC_LEN 50
+#define MAX_BSET_DESC_SIZE (MAX_BSET_DESC_LEN+1)
+
+#define MAX_GROUPNAME_LEN 30
+#define MAX_GROUPNAME_SIZE (MAX_GROUPNAME_LEN+1)
+
+#define MAX_UI_DATE_LEN 30
+#define MAX_UI_DATE_SIZE (MAX_UI_DATE_LEN+1)
+
+#define MAX_UI_TIME_LEN 30
+#define MAX_UI_TIME_SIZE (MAX_UI_TIME_LEN+1)
+
+#define MAX_UI_RESOURCE_LEN 255
+#define MAX_UI_RESOURCE_SIZE (MAX_UI_RESOURCE_LEN+1)
+
+#define MAX_UI_LOGFILEROOT_LEN 6
+#define MAX_UI_LOGFILEROOT_SIZE (MAX_UI_LOGFILEROOT_LEN+1)
+
+// Use small resources length for very small strings.
+
+#define MAX_UI_SMALLRES_LEN 30
+#define MAX_UI_SMALLRES_SIZE (MAX_UI_SMALLRES_LEN+1)
+
+#define MAX_UI_WIN_TITLE_LEN 130
+#define MAX_UI_WIN_TITLE_SIZE (MAX_UI_WIN_TITLE_LEN+1)
+
+#define MAX_STATUS_LINE_LEN 100
+#define MAX_STATUS_LINE_SIZE (MAX_STATUS_LINE_LEN+1)
+
+#define MAX_ENCRYPTION_KEY_SIZE 24
+#define PASSWORD_SIGNATURE_SIZE 12
+
+// These must match the defines used in other products (ie 3.1) if
+// the PWDB is to be moveable between products, especially the
+// DBPW_KEY. If the lock keys are not the same, we can not recognize
+// a locked PWDB and will allow anyone to use it !
+
+#define MAX_PWDBASE_REC_SIZE 230
+#define MAX_LOCKPW_LEN 20
+#define MAX_LOCKPW_SIZE MAX_LOCKPW_LEN+1
+#define DBPW_KEY TEXT("8% øîÈ") // key for lock password
+#define DBPW_NODBPW TEXT("&%@!Ú(") // pw to indicate lock removed
+
+#define GB_TMP_STRING_SIZE 2000
+
+#define ENG_REV_MAJ 1
+#define ENG_REV_MIN 0
+
+#define MKT_VER_MAJ 1
+#define MKT_VER_MIN 0
+
+#define NOT_LOGGING 0
+#define NOW_LOGGING 1
+#define STOP_LOGGING 2
+
+
+// ????? remove as many of the following as possible. Change all references
+// to LMHANDLE and LMHANDLE_PTR to the appropriate memory casts.
+
+typedef CHAR FAR * LMHANDLE ;
+typedef void FAR * LMHANDLE_PTR ;
+
+#define XOR( x, y ) ( (!x && y) || (x && !y) )
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/aspi.h b/private/utils/ntbackup/inc/aspi.h
new file mode 100644
index 000000000..240413f7f
--- /dev/null
+++ b/private/utils/ntbackup/inc/aspi.h
@@ -0,0 +1,7 @@
+#ifndef ASPI_RH
+
+#define ASPI_RH
+
+#define SES_ENG_ASPI 0
+
+#endif
diff --git a/private/utils/ntbackup/inc/backgrnd.h b/private/utils/ntbackup/inc/backgrnd.h
new file mode 100644
index 000000000..e8f21078c
--- /dev/null
+++ b/private/utils/ntbackup/inc/backgrnd.h
@@ -0,0 +1,126 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: backgrnd.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: N:/LOGFILES/BACKGRND.H_V $
+ *
+ * Rev 1.1 11 Sep 1991 09:59:18 DON
+ * changed 'far' to PTR_SIZE - defined in stdtypes.h for portability
+ *
+ * Rev 1.0 09 May 1991 13:31:04 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+/**
+ :IH1: Copyright (C) Maynard Electronics, Inc. 1984-89
+
+ :Name: backgrnd.h
+
+ :Description: Contains the function prototypes for the background
+ process manager.
+
+ The data structure required by applications to use the
+ background process manager is listed below:
+
+ typedef struct { ... } BACKGROUND_CONTROL;
+
+ The application must allocate and pass a structure
+ of type BACKGROUND_CONTROL to the InstallBackgroundRoutine
+ function. The structure must be static until it is
+ passed to the RemoveBackgroundRoutine function.
+
+ The interfaces to the background process manager are
+ listed below:
+
+ VOID InstallBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr,
+ BACKGRND_FUNC_PTR func_ptr );
+
+ This function installs a function to be called repeatedly
+ in the background, behind the main program.
+
+
+ VOID RemoveBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr );
+
+ This function removes a previously installed background routine.
+ The control_elem_ptr must point to the same structure which was
+ passed to the InstallBackgroundRoutine.
+
+ The InstallInt28Routine and RemoveInt28Routine functions work
+ similarly, except that the handlers they install are called
+ when DOS is idling at the prompt (DOS alternates between issuing
+ a no-wait keyboard read and calling interrupt 28).
+
+ InstallBackgroundHooks traps the interrupt vectors necessary for
+ background processing. RemoveBackgroundHooks restores the vectors
+ to their system defaults.
+
+ Since background routines are frequently used to schedule
+ processes to occur at a later time the following macros are
+ provided
+
+ TIME() - returns a UINT32 representing the number of
+ clock ticks since the first background
+ routine was installed.
+
+ NO_TIMEOUT - a value which TIME() will always be less than.
+
+ $Header: N:/LOGFILES/BACKGRND.H_V 1.1 11 Sep 1991 09:59:18 DON $
+
+ $Log$
+
+ Rev 2.0 18 May 1990 19:06:36 PAT
+ Baseline Maynstream 3.1
+**/
+
+
+
+#ifndef BACKGRND
+#define BACKGRND
+
+
+typedef UINT32 TIMEOUT_VALUE;
+extern TIMEOUT_VALUE background_timer;
+
+
+typedef Q_ELEM BACKGRND_CONTROL;
+
+typedef BACKGRND_CONTROL PTR_SIZE *BACKGRND_CONTROL_PTR;
+
+#define BACKGRND_FUNC PF_VOID
+
+typedef enum { CallerIPX,CallerInt28 } CallerType;
+
+typedef VOID (PTR_SIZE *BACKGRND_FUNC_PTR)( CallerType caller );
+
+#define INTR_NUM (0x1C)
+
+
+
+VOID InstallBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr, BACKGRND_FUNC_PTR func_ptr );
+VOID RemoveBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr );
+VOID InstallInt28Routine( BACKGRND_CONTROL_PTR control_elem_ptr, BACKGRND_FUNC_PTR func_ptr );
+VOID RemoveInt28Routine( BACKGRND_CONTROL_PTR control_elem_ptr );
+VOID InstallBackgroundHooks( VOID );
+VOID RemoveBackgroundHook( VOID );
+
+extern UINT8 In28Hook;
+
+#define TIME() background_timer
+#define NO_TIMEOUT ( (UINT32) ( (TIMEOUT_VALUE) 1) << (((sizeof(TIMEOUT_VALUE)-1)*8) - 1) )
+
+#endif
+
+
+
+
diff --git a/private/utils/ntbackup/inc/be_debug.h b/private/utils/ntbackup/inc/be_debug.h
new file mode 100644
index 000000000..d6c939bcb
--- /dev/null
+++ b/private/utils/ntbackup/inc/be_debug.h
@@ -0,0 +1,51 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: be_debug.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: header for debug printing
+
+ Location: BE_PRIVATE
+
+
+ $Log: M:/LOGFILES/BE_DEBUG.H_V $
+ *
+ * Rev 1.1 22 Sep 1992 10:39:42 ChuckS
+ * Added DEBUG_REGISTER_ERR define for use of RegisterError
+ *
+ * Rev 1.0 09 May 1991 15:50:02 STEVEN
+ * Initial revision.
+ *
+ * Rev 1.0 09 May 1991 13:31:04 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef BE_DEBUG_H
+#define BE_DEBUG_H
+
+/* The following defines are a copy of the ones in UI's debug.h */
+
+#define DEBUG_TEMPORARY 0x0000
+#define DEBUG_USER_INTERFACE 0x0001
+#define DEBUG_LOOPS 0x0002
+#define DEBUG_FILE_SYSTEM 0x0004
+#define DEBUG_CATALOGS 0x0008
+#define DEBUG_REMOTE_DRIVE 0x0010
+#define DEBUG_TAPE_FORMAT 0x0020
+#define DEBUG_DEVICE_DRIVER 0x0040
+#define DEBUG_REGISTER_ERROR 0x0080
+#define DEBUG_TEMP_WIN_END 0x8000
+
+VOID BE_Zprintf( UINT16 mask_bits, ... ) ;
+
+/* Close your eyes! You really don't want to see what follows */
+
+/* Copy the resource defines from the user interface */
+#include "eng_dbug.h"
+
+#endif
diff --git a/private/utils/ntbackup/inc/be_init.h b/private/utils/ntbackup/inc/be_init.h
new file mode 100644
index 000000000..5e515a119
--- /dev/null
+++ b/private/utils/ntbackup/inc/be_init.h
@@ -0,0 +1,108 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: be_init.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Definition of be_init structure, various defines and
+ function prototypes.
+
+ Location: BE_PUBLIC
+
+
+ $Log: Q:/LOGFILES/BE_INIT.H_V $
+ *
+ * Rev 1.9 22 Jul 1993 11:34:40 ZEIR
+ * Add'd software_name to be_init_str for MTF
+ *
+ * Rev 1.8 09 Jun 1993 15:24:16 MIKEP
+ * enable c++
+ *
+ * Rev 1.7 23 Jan 1992 15:23:56 CLIFF
+ * Added BE_InitLW function
+ *
+ * Rev 1.6 14 Nov 1991 09:16:18 BARRY
+ * Moved file system init specifiers from be_init.h to fsys_str.h.
+ *
+ * Rev 1.5 24 Oct 1991 15:28:22 BARRY
+ * TRICYCLE: Added file_systems bit-mask field to BE_INIT_STR and
+ * created #defines for each file system.
+ *
+ * Rev 1.4 17 Oct 1991 01:41:00 ED
+ * BIGWHEEL - 8200sx - Added catalog_directory to BE_INIT sruct.
+ *
+ * Rev 1.3 27 Jun 1991 15:35:22 JOHNW
+ * Added driver_directory field to be_init structure.
+ *
+ * Rev 1.2 21 Jun 1991 13:23:26 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.1 04 Jun 1991 19:12:42 BARRY
+ * Removed ControlBreak handler stuff--moved to os-specific modules.
+ *
+ * Rev 1.0 09 May 1991 13:30:58 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _be_init_h_
+#define _be_init_h_
+
+#include <stdarg.h>
+#include "dilhwd.h"
+
+/*
+ Initialization parameter block
+*/
+typedef struct BE_INIT_STR *BE_INIT_STR_PTR;
+typedef struct BE_INIT_STR {
+ UINT16 units_to_init ;
+ struct BSD_LIST **bsd_list_ptr ;
+ struct HEAD_DLE **dle_list_ptr ;
+ struct THW **thw_list_ptr ;
+ BOOLEAN (*critical_error_handler)( CHAR_PTR, UINT16 ) ;
+ VOID (*debug_print)( UINT16, CHAR_PTR, va_list ) ;
+ DIL_HWD_PTR dhwd_ptr ;
+ CHAR driver_name[ 84 ] ;
+ UINT16 number_of_cards ;
+ UINT16 max_channels ;
+ UINT16 tf_buffer_size ;
+ UINT16 remote_filter ;
+ struct VM_STR *vm_hand ;
+ CHAR_PTR driver_directory ;
+ CHAR_PTR catalog_directory ;
+ UINT32 file_systems ; /* Bits set to pick and choose */
+ CHAR_PTR software_name ;
+} BE_INIT_STR ;
+
+/*
+ Error returns
+*/
+#define BE_INIT_SUCCESS 0
+#define BE_FILE_SYS_FAIL -10000
+#define BE_TAPE_FMT_FAIL -10001
+#define BE_SMB_FAIL -10002
+#define BE_NRL_FAIL -10003
+#define BE_BSDU_FAIL -10004
+
+/* defines for units to init */
+#define BE_INIT_FSYS BIT0
+#define BE_INIT_BSDU BIT1
+#define BE_INIT_TFL BIT2
+#define BE_INIT_ALL 0xffff
+
+/*
+ Prototypes
+*/
+
+VOID BE_InstallCtrlBreakHandler( VOID );
+VOID BE_RemoveCtrlBreakHandler( VOID );
+
+INT16 BE_Init( BE_INIT_STR_PTR be_ptr, struct BE_CFG * conf_ptr ) ;
+VOID BE_Deinit( struct HEAD_DLE * ) ;
+VOID BE_InitLW( BE_INIT_STR_PTR be_ptr ) ;
+#endif
+
diff --git a/private/utils/ntbackup/inc/be_tfutl.h b/private/utils/ntbackup/inc/be_tfutl.h
new file mode 100644
index 000000000..d9cb43589
--- /dev/null
+++ b/private/utils/ntbackup/inc/be_tfutl.h
@@ -0,0 +1,53 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: be_tfutl.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Prototypes for Backup Engine utility interface functions
+ for tape format layer calls
+
+ Location: BE_PUBLIC
+
+
+ $Log: J:/LOGFILES/BE_TFUTL.H_V $
+ *
+ * Rev 1.4 28 Jan 1993 09:25:54 DON
+ * Removed BE_EjectTape prototype
+ *
+ * Rev 1.3 09 Nov 1992 15:22:20 DON
+ * Added a prototype to allow UI to eject a tape
+ *
+ * Rev 1.2 13 Oct 1992 12:44:56 CHARLIE
+ * Added prototype for BE_NonNativeFormat
+ *
+ * Rev 1.1 28 Jun 1991 12:06:22 STEVEN
+ * Changes for new BE_CFG
+ *
+ * Rev 1.0 09 May 1991 13:30:32 HUNTER
+ * Initial revision.
+
+**/
+/* begin include list */
+#ifndef _be_tfl_xface_h_
+#define _be_tfl_xface_h_
+
+#include "thw.h"
+#include "be_init.h"
+/* $end$ include list */
+
+/* Defines for Multi-drive status check */
+#define BE_NO_MULTI_DRIVE 0
+#define BE_MULTI_DRIVE 1
+#define BE_END_OF_CHANNEL 2
+
+CHAR_PTR BE_GetCurrentDeviceName( UINT16 channel ) ;
+THW_PTR BE_GetCurrentDevice( UINT16 channel ) ;
+INT16 BE_ReinitTFLayer( BE_INIT_STR_PTR be_ptr, struct BE_CFG *cfg ) ;
+UINT8 BE_CheckMultiDrive( UINT16 channel ) ;
+BOOLEAN BE_DeviceWriteProtected( UINT16 channel ) ;
+BOOLEAN BE_NonNativeFormat( UINT16 channel ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/bec_prv.h b/private/utils/ntbackup/inc/bec_prv.h
new file mode 100644
index 000000000..bac29eb2c
--- /dev/null
+++ b/private/utils/ntbackup/inc/bec_prv.h
@@ -0,0 +1,31 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bec_prv.h
+
+ Date Updated: 18-Jun-91
+
+ Description: Structures and definitions private to the Backup
+ Engine configuration unit.
+
+ $Log: N:/LOGFILES/BEC_PRV.H_V $
+
+ Rev 1.0 19 Jun 1991 10:38:56 BARRY
+Initial revision.
+
+**/
+
+#if !defined( BEC_PRV_H )
+#define BEC_PRV_H
+
+/*
+ * Queue of config structures along with counting semaphore
+ */
+typedef struct BE_CFG_QUEUE_ITEM {
+ BE_CFG_PTR cfg;
+ INT16 use_count;
+} BE_CFG_QITEM, *BE_CFG_QITEM_PTR;
+
+
+#endif /* BEC_PRV_H */
diff --git a/private/utils/ntbackup/inc/beconfig.h b/private/utils/ntbackup/inc/beconfig.h
new file mode 100644
index 000000000..6e2433bbf
--- /dev/null
+++ b/private/utils/ntbackup/inc/beconfig.h
@@ -0,0 +1,598 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: beconfig.h
+
+ Date Updated: 18-Jun-91
+
+ Description: Interface to the Backup Engine configuration unit.
+
+ $Log: Q:/LOGFILES/BECONFIG.H_V $
+
+ Rev 1.49 28 Jul 1993 15:21:16 TerriLynn
+Switched the values of SYPL on and off for ECC translation.
+
+ Rev 1.48 23 Jul 1993 12:13:04 TerriLynn
+Updated sypl defines per LANMAN Upgrade requirements
+
+ Rev 1.47 23 Jul 1993 11:44:26 TerriLynn
+Added extern for Sytron ECC flag
+
+ Rev 1.46 23 Jul 1993 10:59:12 TerriLynn
+Added specific SYPL defines for the
+new Sytron ECC flag.
+
+ Rev 1.45 21 Jul 1993 17:30:18 TerriLynn
+Added Process Sytron ECC Flag
+
+ Rev 1.44 01 Jul 1993 16:45:30 Aaron
+Added ProcSpecialFiles macros
+
+ Rev 1.43 30 Jun 1993 15:23:44 BARRY
+Add process_special_files
+
+ Rev 1.42 17 Jun 1993 16:42:50 DEBBIE
+Changed backup_without_expanding to backup_as_expanded.
+
+ Rev 1.41 09 Jun 1993 15:45:48 MIKEP
+enable c++
+
+ Rev 1.40 30 Apr 1993 16:42:44 DOUG
+Moved NRL_SPX_MaxIpxPacketSize out of CLient only #ifdef
+
+ Rev 1.39 19 Apr 1993 16:58:40 DOUG
+Added new NRL/TLI fields
+
+ Rev 1.38 30 Mar 1993 18:08:44 DON
+Changed migrated/compressed stuff!
+
+ Rev 1.37 24 Mar 1993 15:45:02 DEBBIE
+added fields and macros for migrated files and for uncompressing files
+
+ Rev 1.36 22 Mar 1993 16:49:18 JOHNES
+
+
+ Rev 1.35 19 Mar 1993 11:37:56 JOHNES
+Ifdef'ed out (from P_CLIENT) a bunch of GRFS related fields we don't use
+in the client.
+
+ Rev 1.34 16 Mar 1993 15:07:40 JOHNES
+Ifdef'ed out all references to keep_drive_list (for P_CLIENT only).
+
+ Rev 1.33 11 Mar 1993 11:44:20 ANDY
+Added GRFS and NRL parameters for ENDEAVOUR
+
+ Rev 1.32 01 Mar 1993 17:38:10 MARILYN
+added config option telling whether or not to process checksum streams
+
+ Rev 1.31 09 Feb 1993 10:00:52 DOUG
+Added Client supervisor mode flag
+
+ Rev 1.30 05 Feb 1993 22:32:28 MARILYN
+removed copy/move functionality
+
+ Rev 1.29 08 Dec 1992 14:24:32 DON
+Integrated Move/Copy into tips
+
+ Rev 1.28 08 Dec 1992 11:45:30 DOUG
+Added new GRFS and NRL parameters
+
+ Rev 1.27 13 Oct 1992 12:30:20 STEVEN
+added otc catalog level
+
+ Rev 1.26 28 Aug 1992 16:18:20 BARRY
+Added values for net_num.
+
+ Rev 1.25 23 Jul 1992 09:33:24 STEVEN
+fix warnings
+
+ Rev 1.24 21 May 1992 17:27:18 TIMN
+Added string type defines and partition name type
+
+ Rev 1.23 04 May 1992 12:22:40 STEVEN
+NT_STUFF added string types
+
+ Rev 1.22 02 Feb 1992 17:59:36 GREGG
+Fixed macro to set initial_buff_alloc.
+
+ Rev 1.21 02 Feb 1992 15:54:14 GREGG
+Removed utf_supported boolean from config, and added UINT16 initial_buff_alloc.
+
+ Rev 1.20 27 Jan 1992 18:16:00 GREGG
+Added new config element: utf_supported.
+
+ Rev 1.19 22 Jan 1992 10:49:48 DON
+added define for ENABLE_REMOTE_AFP to special word defines
+
+ Rev 1.18 13 Jan 1992 18:35:50 STEVEN
+added config switch for BSD sort
+
+ Rev 1.17 19 Nov 1991 13:14:32 STEVEN
+added wait time defines for SKIP_OPEN_FILES
+
+ Rev 1.16 14 Nov 1991 10:20:02 BARRY
+TRICYCLE: Added restore_security.
+
+ Rev 1.15 06 Nov 1991 18:37:24 GREGG
+BIGWHEEL - 8200sx - Added catalog_level to BE config.
+
+ Rev 1.14 02 Oct 1991 15:52:48 STEVEN
+BIGWEEL - Added support for Prompt before restore over existing
+
+ Rev 1.13 19 Sep 1991 12:57:12 STEVEN
+Added machine type to config structure
+
+ Rev 1.12 16 Aug 1991 08:59:50 STEVEN
+remove display_novell_servers from structure
+
+ Rev 1.11 12 Aug 1991 16:30:32 BARRY
+Removed macros BEC_GetDisplayNetwareServers() and
+BEC_SetDisplayNetwareServers().
+
+ Rev 1.10 23 Jul 1991 16:23:28 BARRY
+Added prototype for new function BEC_UpdateConfig.
+
+ Rev 1.9 22 Jul 1991 17:36:22 BARRY
+Fix max and min problem.
+
+ Rev 1.8 11 Jul 1991 15:55:08 BARRY
+Made definition of min and max each conditional.
+
+ Rev 1.7 01 Jul 1991 18:41:44 BARRY
+Fixed definition of min() and max(); fixed SetXXX macros.
+
+ Rev 1.6 01 Jul 1991 17:35:32 STEVEN
+added min and max
+
+ Rev 1.5 30 Jun 1991 12:36:52 BARRY
+Changes for partition routines, removal of default drive list.
+
+ Rev 1.4 28 Jun 1991 16:56:20 BARRY
+Got rid of default drive and SetKeepDrive().
+
+ Rev 1.3 26 Jun 1991 16:49:28 BARRY
+tfl_buff_size was misspelled.
+
+ Rev 1.2 25 Jun 1991 15:04:16 BRYAN
+Changed dos_drive_list to keep_drive_list
+
+ Rev 1.1 21 Jun 1991 10:16:18 STEVEN
+added macros and removed ifdefs
+
+ Rev 1.0 19 Jun 1991 10:39:40 BARRY
+Initial revision.
+
+**/
+
+#if !defined( BECONFIG_H )
+#define BECONFIG_H
+
+/*
+ * Since some systems define max and min as functions instead of macros,
+ * define a macro for our own max and min macros here.
+ */
+#define BEC_MIN(x,y) ((x) < (y) ? (x) : (y))
+#define BEC_MAX(x,y) ((x) > (y) ? (x) : (y))
+
+/* return value defines */
+#define BEC_ERR_BASE 0xff00 /* Need to verify this? */
+#define BEC_NOT_IN_QUEUE BEC_ERR_BASE + 1 /* Release of cfg not in Q */
+
+/* Definition of Special Word values */
+#define CREATE_FLOPPY_DLES 0x0002
+#define IGNORE_MAYNARD_ID 0x0020
+#define ENABLE_REMOTE_AFP 0x0040
+#define FAST_TDEMO 0x4000
+
+/* Values for net_num */
+#define NO_NET_DEFINED 0
+#define NOVELL_ADVANCED 1
+#define NOVELL_4_6 2
+#define IBM_PC_NET 3
+
+
+/* Definition of ExistFlag values */
+#define BEC_NO_REST_OVER_EXIST 0
+#define BEC_REST_OVER_EXIST 1
+#define BEC_PROMPT_REST_OVER_EXIST 2
+
+
+/* Definition of SkipOpenFiles values */
+#define BEC_WAIT_OPEN_FILES 0
+#define BEC_SKIP_OPEN_FILES 1
+#define BEC_TIME_WAIT_OPEN_FILES 2
+
+/* Cataloging Levels */
+#define CATALOGS_NONE 0
+#define CATALOGS_PARTIAL 1
+#define CATALOGS_FULL 2
+
+/* NT_STUFF string types */
+#define BEC_ANSI_STR 1
+#define BEC_UNIC_STR 2
+#define BEC_WIDE_STR BEC_UNIC_STR
+
+/* EMS stuff */
+#define BEC_EMS_PUBLIC 1
+#define BEC_EMS_PRIVATE 2
+#define BEC_EMS_BOTH 3
+
+#if defined(OS_NLM)
+/* NRL Protocol types are bit-mapped flags */
+#define NRL_PROT_SPX 0x01
+#define NRL_PROT_TCP 0x02
+#define NRL_PROT_ADSP 0x04
+#endif /* OS_NLM */
+
+#define SYPL_ECC_AUTO 2 /* The default value */
+#define SYPL_ECC_ON 1 /* Forces procesing of Sytron ECC */
+#define SYPL_ECC_OFF 0 /* Depends on hardware ECC */
+
+typedef struct PART_ENTRY {
+ struct PART_ENTRY *next ;
+ INT16 drv_num ;
+ INT16 partition_num ;
+ INT8 partition_name[13] ;
+ INT16 partition_name_size ;
+} PART_ENTRY ;
+
+
+typedef struct BE_CFG *BE_CFG_PTR;
+typedef struct BE_CFG {
+ UINT16 special_word ; /* special word */
+ UINT16 max_buffers ; /* max number of tape buffers */
+ UINT16 reserve_mem ; /* amt not to give to buffers */
+ UINT16 tfl_buff_size ; /* buffer size for tape format*/
+ UINT16 max_buffer_size ; /* SMB maximum buffer size */
+ INT16 skip_open_files ; /* skip open files (NETWORK) */
+ INT16 backup_files_inuse ; /* try to backup files in use */
+ INT16 support_afp_server ; /* support AFP files on */
+ INT16 extended_date_support ; /* extended date support */
+ INT16 hidden_flg ; /* don't read hidden files */
+ INT16 special_flg ; /* don't read system files */
+ INT16 set_archive_flg ; /* set archive bit */
+ INT16 modified_only_flg ; /* backup modified stuff only */
+ INT16 proc_empty_flg ; /* restore empty directorys */
+ INT16 exist_flg ; /* restore existing files? */
+ INT16 prompt_flg ; /* prompt on restore */
+ PART_ENTRY *part_list ; /* partition list */
+#if !defined(P_CLIENT)
+ CHAR keep_drive_list[26 + 1] ; /* drives to keep */
+#endif /* !P_CLIENT */
+ INT16 net_num ; /* network number */
+ INT16 remote_drive_backup ; /* Remote drive backup enabled*/
+ BOOLEAN use_ffr ; /* true if user wants ffr */
+ UINT16 write_format ; /* To specify TF write format */
+ UINT16 nrl_dos_vector ;
+ BOOLEAN xlock ;
+ UINT16 machine_type ;
+ INT16 catalog_level ; /* Catalog level, 0=none, 1=partial, 2=full */
+ BOOLEAN restore_security ; /* Restore security info */
+ BOOLEAN sort_bsd_by_dle ; /* if true we sort the bsds by DLE */
+ UINT16 initial_buff_alloc ; /* mem allocated for tape buffers at init */
+ UINT16 string_types ;
+ UINT16 otc_cat_level ; /* on tape catalog requested level */
+ UINT16 max_remote_resources; /* cumulative sum of all remote resource buffers added */
+#if !defined(P_CLIENT)
+ CHAR backup_server_name[16 + 1] ; /* name of current backup server for netbios */
+#endif /* !P_CLIENT */
+ UINT16 NRL_transport_type; /* NRL transport type (SPX, NetBIOS */
+ UINT16 GRFS_timeout_seconds; /* GRFS response timeout (0=no timeout) */
+ UINT16 NRL_spx_max_ipx_packet ; /* NRL max allowable packet size */
+#if !defined(P_CLIENT)
+ UINT16 NRL_callback_stack_size ; /* NRL callback stack size */
+ UINT16 NRL_max_local_resources ; /* NRL cumulative local resources */
+ UINT16 NRL_max_con_connections ; /* NRL maximum allowed connections */
+#endif /* !P_CLIENT */
+ CHAR NRL_backup_server_list[100+1];/* NRL string of backup servers space delimited */
+#if !defined(P_CLIENT)
+ UINT16 NRL_spx_listens_per_sess ; /* NRL number of listen ecbs per session */
+ UINT16 NRL_spx_retry_count ; /* NRL spx number of times to retry a packet */
+ UINT16 NRL_nb_retry_count ; /* NRL NetBios number of times to retry a packet */
+#endif /* !P_CLIENT */
+ UINT16 NRL_nb_adapter_number; /* NRL adapter number for LAN */
+ CHAR NRL_nb_device_name[8+1]; /* NRL name of LAN device */
+#if !defined(P_CLIENT)
+ UINT16 GRFS_max_con_sessions; /* NRL maximum number of agents allowed */
+#endif /* !P_CLIENT */
+ BOOLEAN supervisor_mode; /* Is Client in Supervisor mode? */
+ BOOLEAN process_checksum_streams ; /* Generate a checksum stream for each stream written */
+#if !defined(P_CLIENT)
+ BOOLEAN backup_migrated_files ; /* backup migrated files */
+ BOOLEAN backup_as_expanded ; /* backup compressed files as expanded files */
+#endif /* !P_CLIENT */
+ /* and use this information to verify the integrity of */
+ /* said stream on tape. */
+#if defined(OS_NLM)
+ UINT16 NRL_protocols; /* NRL protocols to load */
+ UINT16 TCP_cleanup_interval; /* Seconds between TCP resource cleanup */
+ UINT16 TCP_listen_port; /* TCP port for resource listen thread */
+#endif
+ BOOLEAN process_special_files; /* process registry, etc. */
+ INT16 sypl_ecc_flg ; /* process sytron ecc */
+ INT16 ems_pub_pri ;
+ INT16 ems_rip_kick ;
+ INT16 ems_wipe_clean ;
+} BE_CFG;
+
+
+
+/* prototypes relating to the configuration unit */
+
+VOID BEC_Init( VOID ) ;
+VOID BEC_Close( VOID ) ;
+INT16 BEC_UseConfig( BE_CFG_PTR cfg );
+INT16 BEC_ReleaseConfig( BE_CFG_PTR cfg );
+BE_CFG_PTR BEC_CloneConfig( BE_CFG_PTR cfg );
+INT16 BEC_UpdateConfig( BE_CFG_PTR dst, BE_CFG_PTR src );
+
+INT8_PTR BEC_GetPartitionName( BE_CFG_PTR cfg, INT16 drv_num, INT16 part_num ) ;
+INT16 BEC_SetPartitionName( BE_CFG_PTR cfg, INT16 drv_num, INT16 part_num, INT8_PTR part_name, INT16 part_name_size ) ;
+PART_ENTRY *BEC_GetFirstPartition( BE_CFG_PTR cfg ) ;
+PART_ENTRY *BEC_GetNextPartition( BE_CFG_PTR cfg, PART_ENTRY *curr_part ) ;
+INT16 BEC_AddPartition( BE_CFG_PTR cfg, INT16 drv_num, INT16 part_num, INT8_PTR name, INT16 name_size ) ;
+
+#if !defined(P_CLIENT)
+ BOOLEAN BEC_KeepDrive( BE_CFG_PTR cfg, CHAR drv_letter ) ;
+#endif /* !P_CLIENT */
+
+VOID BEC_CheckNetworkType( VOID ) ;
+
+extern BE_CFG uw_max_cfg ;
+extern BE_CFG uw_min_cfg ;
+extern INT16 gnProcessSytronECC ;
+/*
+ * Accessing/setting macros.
+ */
+
+#define BEC_SetStringTypes( x, v ) ( (x)->string_types = (v) )
+#define BEC_GetStringTypes( x ) ( (x)->string_types )
+
+#define BEC_GetSpecialWord( x ) ( (x)->special_word )
+#define BEC_SetSpecialWord( x, v ) ( (x)->special_word = (v) )
+
+
+/**********************************************************************
+
+ Old tape buffer business.
+
+ #ifdef MAYN_OS2
+ #define BEC_GetMaxNumTapeBuffers( x ) ( (x)->max_num_tape_bufs )
+ #define BEC_SetMaxNumTapeBuffers( x, v ) ( (x)->max_num_tape_bufs = (v) )
+ #else
+ #define BEC_GetReserveMemory( x ) ( (x)->reserve_memory )
+ #define BEC_SetReserveMemory( x, v ) ( (x)->reserve_memory = (v) )
+ #endif
+
+**********************************************************************/
+
+#define BEC_GetMaxTapeBuffers( x ) ( (x)->max_buffers )
+#define BEC_SetMaxTapeBuffers( x, v ) ( (x)->max_buffers = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.max_buffers), uw_min_cfg.max_buffers ) )
+
+#define BEC_GetTFLBuffSize( x ) ( (x)->tfl_buff_size )
+#define BEC_SetTFLBuffSize( x, v ) ( (x)->tfl_buff_size = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.tfl_buff_size), uw_min_cfg.tfl_buff_size ) )
+
+#define BEC_GetReserveMem( x ) ( (x)->reserve_mem )
+#define BEC_SetReserveMem( x, v ) ( (x)->reserve_mem = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.reserve_mem), uw_min_cfg.reserve_mem ) )
+
+#define BEC_GetSkipOpenFiles( x ) ( (x)->skip_open_files )
+#define BEC_SetSkipOpenFiles( x, v ) ( (x)->skip_open_files = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.skip_open_files), uw_min_cfg.skip_open_files ) )
+
+#define BEC_GetBackupFilesInUse( x ) ( (x)->backup_files_inuse )
+#define BEC_SetBackupFilesInUse( x, v ) ( (x)->backup_files_inuse = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.backup_files_inuse), uw_min_cfg.backup_files_inuse ) )
+
+#define BEC_GetAFPSupport( x ) ( (x)->support_afp_server )
+#define BEC_SetAFPSupport( x, v ) ( (x)->support_afp_server = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.support_afp_server), uw_min_cfg.support_afp_server ) )
+
+#define BEC_GetExtendedDateSupport( x ) ( (x)->extended_date_support )
+#define BEC_SetExtendedDateSupport( x, v ) ( (x)->extended_date_support = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.extended_date_support), uw_min_cfg.extended_date_support ) )
+
+#define BEC_GetHiddenFlag( x ) ( (x)->hidden_flg )
+#define BEC_SetHiddenFlag( x, v ) ( (x)->hidden_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.hidden_flg), uw_min_cfg.hidden_flg ) )
+
+#define BEC_GetSpecialFlag( x ) ( (x)->special_flg )
+#define BEC_SetSpecialFlag( x, v ) ( (x)->special_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.special_flg), uw_min_cfg.special_flg ) )
+
+#define BEC_GetSetArchiveFlag( x ) ( (x)->set_archive_flg )
+#define BEC_SetSetArchiveFlag( x, v ) ( (x)->set_archive_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.set_archive_flg), uw_min_cfg.set_archive_flg ) )
+
+#define BEC_GetModifiedOnlyFlag( x ) ( (x)->modified_only_flg )
+#define BEC_SetModifiedOnlyFlag( x, v ) ( (x)->modified_only_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.set_archive_flg), uw_min_cfg.set_archive_flg ) )
+
+#define BEC_GetProcEmptyFlag( x ) ( (x)->proc_empty_flg )
+#define BEC_SetProcEmptyFlag( x, v ) ( (x)->proc_empty_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.proc_empty_flg), uw_min_cfg.proc_empty_flg ) )
+
+#define BEC_GetExistFlag( x ) ( (x)->exist_flg )
+#define BEC_SetExistFlag( x, v ) ( (x)->exist_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.exist_flg), uw_min_cfg.exist_flg ) )
+
+#define BEC_GetPromptFlag( x ) ( (x)->prompt_flg )
+#define BEC_SetPromptFlag( x, v ) ( (x)->prompt_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.prompt_flg), uw_min_cfg.prompt_flg ) )
+
+#define BEC_GetPartList( x ) ( (x)->part_list )
+#define BEC_SetPartList( x, v ) ( (x)->part_list = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.part_list), uw_min_cfg.part_list ) )
+
+#define BEC_GetNetNum( x ) ( (x)->net_num )
+#define BEC_SetNetNum( x, v ) ( (x)->net_num = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.net_num), uw_min_cfg.net_num ) )
+
+#if !defined(P_CLIENT)
+ #define BEC_GetKeepDriveList( x ) ( (x)->keep_drive_list )
+#endif /* !P_CLIENT */
+
+#define BEC_GetRemoteDriveBackup( x ) ( (x)->remote_drive_backup )
+#define BEC_SetRemoteDriveBackup( x, v ) ( (x)->remote_drive_backup = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.remote_drive_backup), uw_min_cfg.remote_drive_backup ) )
+
+#define BEC_GetNRLDosVector( x ) ( (x)->nrl_dos_vector )
+#define BEC_SetNRLDosVector( x, v ) ( (x)->nrl_dos_vector = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.nrl_dos_vector), uw_min_cfg.nrl_dos_vector ) )
+
+#define BEC_GetMaxBufferSize( x ) ( (x)->max_buffer_size )
+#define BEC_SetMaxBufferSize( x, v ) ( (x)->max_buffer_size = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.max_buffer_size), uw_min_cfg.max_buffer_size ) )
+
+#define BEC_GetFastFileRestore( x ) ( (x)->use_ffr )
+#define BEC_SetFastFileRestore( x, v ) ( (x)->use_ffr = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.use_ffr), uw_min_cfg.use_ffr ) )
+
+#define BEC_GetWriteFormat( x ) ( (x)->write_format )
+#define BEC_SetWriteFormat( x, v ) ( (x)->write_format = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.write_format), uw_min_cfg.write_format ) )
+
+#define BEC_LockConfig( x ) ( (x)->xlock = 1 )
+#define BEC_UnLockConfig( x ) ( (x)->xlock = 0 )
+
+#define BEC_GetConfiguredMachineType( x ) ( (x)->machine_type )
+#define BEC_SetConfiguredMachineType( x, v ) ( (x)->machine_type = (v))
+
+#define BEC_GetCatalogLevel( x ) ( (x)->catalog_level )
+#define BEC_SetCatalogLevel( x, v ) ( (x)->catalog_level = (v) )
+
+#define BEC_GetOtcCatalogLevel( x ) ( (x)->otc_cat_level )
+#define BEC_SetOtcCatalogLevel( x, v ) ( (x)->otc_cat_level = (v) )
+
+#define BEC_GetRestoreSecurity( x ) ( (x)->restore_security )
+#define BEC_SetRestoreSecurity( x, v ) ( (x)->restore_security = ((v) ? TRUE : FALSE ))
+
+#define BEC_GetSortBSD( x ) ( (x)->sort_bsd_by_dle )
+#define BEC_SetSortBSD( x, v ) ( (x)->sort_bsd_by_dle = (v) )
+
+#define BEC_GetInitialBuffAlloc( x ) ( (x)->initial_buff_alloc )
+#define BEC_SetInitialBuffAlloc( x, v ) ( (x)->initial_buff_alloc = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.initial_buff_alloc ), uw_min_cfg.initial_buff_alloc ) )
+
+#define BEC_GetMaxRemoteResources( x ) ( (x)->max_remote_resources )
+#define BEC_SetMaxRemoteResources( x, v ) ( (x)->max_remote_resources = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.max_remote_resources), uw_min_cfg.max_remote_resources ) )
+
+#define BEC_GetInitialBuffAlloc( x ) ( (x)->initial_buff_alloc )
+#define BEC_SetInitialBuffAlloc( x, v ) ( (x)->initial_buff_alloc = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.initial_buff_alloc ), uw_min_cfg.initial_buff_alloc ) )
+
+#if !defined(P_CLIENT)
+ #define BEC_GetBackupServerName( x ) ( (x)->backup_server_name )
+ #define BEC_SetBackupServerName( x, v ) ( strcpy( (x)->backup_server_name, (v) ) )
+#endif /* !P_CLIENT */
+
+#define BEC_GetNRLTransportType( x ) ( (x)->NRL_transport_type )
+#define BEC_SetNRLTransportType( x, v ) ( (x)->NRL_transport_type = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_transport_type), uw_min_cfg.NRL_transport_type ) )
+
+#define BEC_GetGRFSTimeoutSeconds( x ) ( (x)->GRFS_timeout_seconds )
+#define BEC_SetGRFSTimeoutSeconds( x, v ) ( (x)->GRFS_timeout_seconds = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.GRFS_timeout_seconds), uw_min_cfg.GRFS_timeout_seconds ) )
+
+#define BEC_GetNRLSPXMaxIpxPacket( x ) ( (x)->NRL_spx_max_ipx_packet )
+#define BEC_SetNRLSPXMaxIpxPacket( x, v ) ( (x)->NRL_spx_max_ipx_packet = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_spx_max_ipx_packet ), uw_min_cfg.NRL_spx_max_ipx_packet ) )
+
+#if !defined(P_CLIENT)
+
+ #define BEC_GetNRLCallbackStackSize( x ) ( (x)->NRL_callback_stack_size )
+ #define BEC_SetNRLCallbackStackSize( x, v ) ( (x)->NRL_callback_stack_size = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_callback_stack_size), uw_min_cfg.NRL_callback_stack_size ) )
+
+ #define BEC_GetNRLMaxLocalResources( x ) ( (x)->NRL_max_local_resources )
+ #define BEC_SetNRLMaxLocalResources( x, v ) ( (x)->NRL_max_local_resources = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_max_local_resources), uw_min_cfg.NRL_max_local_resources ) )
+
+ #define BEC_GetNRLMaxConConnections( x ) ( (x)->NRL_max_con_connections )
+ #define BEC_SetNRLMaxConConnections( x, v ) ( (x)->NRL_max_con_connections = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_max_con_connections ), uw_min_cfg.NRL_max_con_connections ) )
+
+ #define BEC_GetNRLBackupServerList( x ) ( (x)->NRL_backup_server_list )
+ #define BEC_SetNRLBackupServerList( x, v ) ( strcpy( (x)->NRL_backup_server_list, (v) ) )
+
+ #define BEC_GetNRLSPXListensPerSess( x ) ( (x)->NRL_spx_listens_per_sess )
+ #define BEC_SetNRLSPXListensPerSess( x, v ) ( (x)->NRL_spx_listens_per_sess = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_spx_listens_per_sess ), uw_min_cfg.NRL_spx_listens_per_sess ) )
+
+ #define BEC_GetNRLSPXRetryCount( x ) ( (x)->NRL_spx_retry_count )
+ #define BEC_SetNRLSPXRetryCount( x, v ) ( (x)->NRL_spx_retry_count = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_spx_retry_count ), uw_min_cfg.NRL_spx_retry_count ) )
+
+ #define BEC_GetNRLNBRetryCount( x ) ( (x)->NRL_nb_retry_count )
+ #define BEC_SetNRLNBRetryCount( x, v ) ( (x)->NRL_nb_retry_count = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_nb_retry_count ), uw_min_cfg.NRL_nb_retry_count ) )
+#endif /* !P_CLIENT */
+
+#define BEC_GetNRLNBAdapterNumber( x ) ( (x)->NRL_nb_adapter_number )
+#define BEC_SetNRLNBAdapterNumber( x, v ) ( (x)->NRL_nb_adapter_number = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_nb_adapter_number ), uw_min_cfg.NRL_nb_adapter_number ) )
+
+#define BEC_GetNRLNBDeviceName( x ) ( (x)->NRL_nb_device_name )
+#define BEC_SetNRLNBDeviceName( x, v ) ( strcpy( (x)->NRL_nb_device_name, (v) ) )
+
+#if !defined(P_CLIENT)
+ #define BEC_GetGRFSMaxConSessions( x ) ( (x)->GRFS_max_con_sessions )
+ #define BEC_SetGRFSMaxConSessions( x, v ) ( (x)->GRFS_max_con_sessions = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.GRFS_max_con_sessions ), uw_min_cfg.GRFS_max_con_sessions ) )
+#endif /* !P_CLIENT */
+
+#define BEC_GetSupervisorMode( x ) ( (x)->supervisor_mode )
+#define BEC_SetSupervisorMode( x, v ) ( (x)->supervisor_mode = ((v) ? TRUE : FALSE ))
+
+#define BEC_GetProcChecksumStrm( x ) ( (x)->process_checksum_streams )
+#define BEC_SetProcChecksumStrm( x, v ) ( (x)->process_checksum_streams = ((v) ? TRUE : FALSE ))
+
+#define BEC_GetProcSpecialFiles( x ) ( (x)->process_special_files )
+#define BEC_SetProcSpecialFiles( x, v ) ( (x)->process_special_files = ((v) ? TRUE : FALSE ))
+
+#if !defined(P_CLIENT)
+
+ #define BEC_GetBackupMigratedFiles( x ) ( (x)->backup_migrated_files )
+ #define BEC_SetBackupMigratedFiles( x, v ) ( (x)->backup_migrated_files = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.backup_migrated_files ), uw_min_cfg.backup_migrated_files ) )
+
+ #define BEC_GetBackupAsExpanded( x ) ( (x)->backup_as_expanded )
+ #define BEC_SetBackupAsExpanded( x, v ) ( (x)->backup_as_expanded = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.backup_as_expanded ), uw_min_cfg.backup_as_expanded ) )
+#endif /* !P_CLIENT */
+
+#if defined(OS_NLM)
+
+#define BEC_GetNRLProtocolsSupported( x ) ( (x)->NRL_protocols )
+#define BEC_SetNRLProtocolsSupported( x, v ) ( (x)->NRL_protocols = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.NRL_protocols), uw_min_cfg.NRL_protocols ) )
+#define BEC_GetTCPCleanupInterval( x ) ( (x)->TCP_cleanup_interval )
+#define BEC_SetTCPCleanupInterval( x, v ) ( (x)->TCP_cleanup_interval = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.TCP_cleanup_interval), uw_min_cfg.TCP_cleanup_interval ) )
+#define BEC_GetTCPListenPort( x ) ( (x)->TCP_listen_port )
+#define BEC_SetTCPListenPort( x, v ) ( (x)->TCP_listen_port = \
+ BEC_MAX( BEC_MIN( ( v ), uw_max_cfg.TCP_listen_port), uw_min_cfg.TCP_listen_port ) )
+
+#endif /* OS_NLM */
+
+#define BEC_GetProcessSytronECCFlag( x ) ( (x)->sypl_ecc_flg )
+#define BEC_SetProcessSytronECCFlag( x, v ) ( (x)->sypl_ecc_flg = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.sypl_ecc_flg), uw_min_cfg.sypl_ecc_flg ) )
+
+#define BEC_GetEmsPubPri( x ) ( (x)->ems_pub_pri )
+#define BEC_SetEmsPubPri( x, v ) ( (x)->ems_pub_pri = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.ems_pub_pri), uw_min_cfg.ems_pub_pri ) )
+
+#define BEC_GetEmsRipKick( x ) ( (x)->ems_rip_kick )
+#define BEC_SetEmsRipKick( x, v ) ( (x)->ems_rip_kick = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.ems_rip_kick), uw_min_cfg.ems_rip_kick ) )
+
+#define BEC_GetEmsWipeClean( x ) ( (x)->ems_wipe_clean )
+#define BEC_SetEmsWipeClean( x, v ) ( (x)->ems_wipe_clean = \
+ BEC_MAX( BEC_MIN( (v), uw_max_cfg.ems_wipe_clean), uw_min_cfg.ems_wipe_clean ) )
+#endif /* BECONFIG_H */
+
diff --git a/private/utils/ntbackup/inc/bengine.h b/private/utils/ntbackup/inc/bengine.h
new file mode 100644
index 000000000..7f569ee35
--- /dev/null
+++ b/private/utils/ntbackup/inc/bengine.h
@@ -0,0 +1,82 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: BENGINE.H
+
+ Description:
+
+ An include file for those of us who don't care which backup
+ engine files we need.
+
+ $Log: G:/UI/LOGFILES/BENGINE.H_V $
+
+ Rev 1.14 05 Aug 1993 16:29:12 MARINA
+added sleep.h
+
+ Rev 1.13 18 Jun 1993 16:52:24 CARLS
+removed MAYN_DEMO around tdemo.h
+
+ Rev 1.12 18 Jun 1993 16:46:10 CARLS
+added tdemo.h for NtDemo build
+
+ Rev 1.11 13 May 1993 11:39:28 MIKEP
+Untemporarily remove nrl.h
+
+ Rev 1.10 12 May 1993 12:04:36 Aaron
+Temporarily (?) removed nrl.h
+
+ Rev 1.9 04 Oct 1992 19:46:18 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.8 07 Jul 1992 16:03:30 MIKEP
+unicode changes
+
+ Rev 1.7 27 Jun 1992 17:58:54 MIKEP
+changes for qtc
+
+ Rev 1.6 14 May 1992 17:39:54 MIKEP
+nt pass2
+
+ Rev 1.5 11 May 1992 12:18:44 STEVEN
+move stdmath.c
+
+ Rev 1.4 11 May 1992 10:51:42 STEVEN
+stdmath
+
+ Rev 1.3 09 Dec 1991 10:07:48 MIKEP
+cut it down
+
+
+
+*****************************************************/
+
+// Bengine.H
+
+#ifndef BENGINE_H
+#define BENGINE_H
+
+#include "stdwcs.h"
+#include "fartypes.h"
+#include "stdmath.h"
+#include "lis.h"
+#include "be_tfutl.h"
+#include "be_init.h"
+#include "enc_pub.h"
+#include "loops.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "tfldefs.h"
+#include "tfpoll.h"
+#include "tflproto.h"
+#include "machine.h"
+#include "nrl.h"
+#include "qtc.h"
+#include "sleep.h"
+
+#ifdef OS_WIN32
+#include "tdemo.h"
+#endif
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/bitmaps.h b/private/utils/ntbackup/inc/bitmaps.h
new file mode 100644
index 000000000..c4885b214
--- /dev/null
+++ b/private/utils/ntbackup/inc/bitmaps.h
@@ -0,0 +1,200 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: bitmaps.h
+
+ Description: This file contains the BITMAP IDs for the Maynstream GUI
+ project.
+
+ $Log: G:/UI/LOGFILES/BITMAPS.H_V $
+
+ Rev 1.12 02 Apr 1993 13:51:22 GLENN
+Added info bitmaps for toolbar.
+
+ Rev 1.11 20 Jan 1993 20:57:22 MIKEP
+floppy
+
+ Rev 1.10 04 Oct 1992 19:46:20 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.9 09 Sep 1992 17:09:26 GLENN
+Added net connect and disconnect bitmap IDs.
+
+ Rev 1.8 20 Aug 1992 08:45:08 GLENN
+Added TAPES and TAPESINDRIVE bitmap stuff.
+
+ Rev 1.7 07 Jul 1992 10:14:26 MIKEP
+fix duplicate entry.
+
+ Rev 1.6 06 Jul 1992 10:32:48 MIKEP
+added ram and cdrom drives
+
+ Rev 1.5 03 Jun 1992 13:33:48 JOHNWT
+added empty dir bitmaps
+
+ Rev 1.4 22 Apr 1992 17:56:44 GLENN
+Added shark and diver bitmap stuff.
+
+ Rev 1.3 09 Mar 1992 09:19:24 GLENN
+Added logo bitmap support.
+
+ Rev 1.2 16 Dec 1991 17:05:40 GLENN
+Added exit button stuff.
+
+ Rev 1.1 15 Dec 1991 10:21:08 MIKEP
+hidden files
+
+ Rev 1.0 20 Nov 1991 19:34:36 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+// BITMAP RESOURCE IDs -- RANGE: 100 - 299
+// ( also used for Bitmap Table indexing)
+
+#define BM_OFFSET 100
+
+#define IDRBM_FLOPPYDRIVE 100 // Unfortunately, you can't add the
+#define IDRBM_HARDDRIVE 101 // BM_OFFSET directly to the base value
+#define IDRBM_RAMDRIVE 102 // to come up with the ID numbers.
+#define IDRBM_NETDRIVE 103 // The Windows' resource compiler can't
+#define IDRBM_TAPEDRIVE01 104 // handle it.
+#define IDRBM_TAPEDRIVE02 105
+#define IDRBM_TAPEDRIVE03 106
+#define IDRBM_MACRO 107
+#define IDRBM_SEL_NONE 108
+#define IDRBM_SEL_PART 109
+#define IDRBM_SEL_ALL 110
+#define IDRBM_FOLDER 111
+#define IDRBM_FOLDERPLUS 112
+#define IDRBM_FOLDERMINUS 113
+#define IDRBM_EXE 114
+#define IDRBM_FILE 115
+#define IDRBM_DOC 116
+#define IDRBM_FOLDEROPEN 117
+#define IDRBM_FOLDERPLUSOPEN 118
+#define IDRBM_FOLDERMINUSOPEN 119
+#define IDRBM_BACKUP 120
+#define IDRBM_RESTORE 121
+#define IDRBM_ERASE 122
+#define IDRBM_RETENSION 123
+#define IDRBM_JOBSTATUS 124
+#define IDRBM_SELECT 125
+#define IDRBM_SELECTALL 126
+#define IDRBM_DESELECT 127
+#define IDRBM_CHECK 128
+#define IDRBM_UNCHECK 129
+#define IDRBM_MODIFIED 130
+#define IDRBM_ADVANCED 131
+#define IDRBM_UNDO 132
+#define IDRBM_RUN 133
+#define IDRBM_SCHEDULE 134
+#define IDRBM_RECORD 135
+#define IDRBM_EDIT 136
+#define IDRBM_SAVE 137
+#define IDRBM_TEST 138
+#define IDRBM_INSERT 139
+#define IDRBM_DELETE 140
+#define IDRBM_SAVEAS 141
+#define IDRBM_CANCEL 142
+#define IDRBM_BACKUP_GRAY 143
+#define IDRBM_RESTORE_GRAY 144
+#define IDRBM_ERASE_GRAY 145
+#define IDRBM_TRANSFER 146
+#define IDRBM_TRANSFER_GRAY 147
+#define IDRBM_RETENSION_GRAY 148
+#define IDRBM_PARENTDIR 149
+#define IDRBM_MEMORY 150
+#define IDRBM_SEARCH 151
+#define IDRBM_TAPE 152
+#define IDRBM_SERVER 153
+#define IDRBM_SDISK 154
+#define IDRBM_IMAGE IDRBM_SDISK // IMAGE IS THE SAME AS A SMALL DISK
+#define IDRBM_BSET 155
+#define IDRBM_LOGFILE 156
+#define IDRBM_UPARROW 157
+#define IDRBM_DNARROW 158
+#define IDRBM_CATALOG 159
+#define IDRBM_VERIFY 160
+#define IDRBM_BSETPART 161
+#define IDRBM_SERVERDETACHED 162
+#define IDRBM_CHECK_GRAY 163
+#define IDRBM_UNCHECK_GRAY 164
+#define IDRBM_MODIFIED_GRAY 165
+#define IDRBM_ADVANCED_GRAY 166
+#define IDRBM_CATALOG_GRAY 167
+#define IDRBM_VERIFY_GRAY 168
+#define IDRBM_SEARCH_GRAY 169
+#define IDRBM_NEXTSET 170
+#define IDRBM_NEXTSET_GRAY 171
+#define IDRBM_EJECT 172
+#define IDRBM_EJECT_GRAY 173
+#define IDRBM_TAPEINDRIVE 174
+#define IDRBM_REWIND 175
+#define IDRBM_REWIND_GRAY 176
+#define IDRBM_LTAPE 177
+#define IDRBM_UPARROW_GRAY 178
+#define IDRBM_DOWNARROW_GRAY 179
+#define IDRBM_RT_ARROW 180
+#define IDRBM_CORRUPTFILE 181
+#define IDRBM_FOLDERC 182
+#define IDRBM_FOLDERPLUSC 183
+#define IDRBM_FOLDERMINUSC 184
+#define IDRBM_FOLDEROPENC 185
+#define IDRBM_FOLDERPLUSOPENC 186
+#define IDRBM_FOLDERMINUSOPENC 187
+#define IDRBM_HFILE 188
+#define IDRBM_HEXEFILE 189
+#define IDRBM_HCRPTFILE 190
+#define IDRBM_EXIT 191
+#define IDRBM_EXIT_GRAY 192
+#define IDRBM_LOGO 193
+#define IDRBM_SEL_ALL_RED 194
+#define IDRBM_CHECK_RED 195
+#define IDRBM_UNCHECK_RED 196
+#define IDRBM_ADVANCED_RED 197
+#define IDRBM_SHARK1 198
+#define IDRBM_SHARK2 199
+#define IDRBM_SHARK3 200
+#define IDRBM_DIVER1 201
+#define IDRBM_DIVER2 202
+#define IDRBM_DIVER3 203
+#define IDRBM_FOLDER_EN 204
+#define IDRBM_FOLDER_EM 205
+#define IDRBM_FOLDER_EP 206
+#define IDRBM_FOLDER_EON 207
+#define IDRBM_FOLDER_EOM 208
+#define IDRBM_FOLDER_EOP 209
+#define IDRBM_FOLDER_ECN 210
+#define IDRBM_FOLDER_ECM 211
+#define IDRBM_FOLDER_ECP 212
+#define IDRBM_FOLDER_EOCN 213
+#define IDRBM_FOLDER_EOCM 214
+#define IDRBM_FOLDER_EOCP 215
+#define IDRBM_CDROM 216
+#define IDRBM_TAPES 217
+#define IDRBM_TAPESINDRIVE 218
+#define IDRBM_NETCONNECT 219
+#define IDRBM_NETCONNECT_GRAY 220
+#define IDRBM_NETDISCON 221
+#define IDRBM_NETDISCON_GRAY 222
+#define IDRBM_FLOPPYSINDRIVE 223
+#define IDRBM_FLOPPYINDRIVE 224
+#define IDRBM_FLOPPYS 225
+#define IDRBM_FLOPPY 226
+#define IDRBM_INFO 227
+#define IDRBM_INFO_GRAY 228
+#define IDRBM_COLINDICATOR 229
+#define IDRBM_EMS_ENTERPRISE 230
+#define IDRBM_EMS_SITE 231
+#define IDRBM_EMS_SERVER 232
+#define IDRBM_EMS_MDB 233
+#define IDRBM_EMS_DSA 234
+#define IDRBM_RCVR_STATUS 235
+#define IDRBM_EMS_MDBX 236
+#define IDRBM_EMS_DSAX 237
+#define IDRBM_EMS_MDBP 238
+#define IDRBM_EMS_DSAP 239
+#define IDRBM_BLANK16x16 240
diff --git a/private/utils/ntbackup/inc/bkup.h b/private/utils/ntbackup/inc/bkup.h
new file mode 100644
index 000000000..37f725d91
--- /dev/null
+++ b/private/utils/ntbackup/inc/bkup.h
@@ -0,0 +1,82 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: bkup.h
+
+ Description:
+
+
+ $Log: G:\ui\logfiles\bkup.h_v $
+
+ Rev 1.6 28 Jul 1993 17:03:14 CARLS
+added spinner box ID
+
+ Rev 1.5 13 Mar 1993 11:50:44 MIKEP
+fixes over the weekend to build
+
+ Rev 1.4 18 Feb 1993 13:34:24 BURT
+Change for Cayman
+
+
+ Rev 1.3 04 Oct 1992 19:46:22 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 06 Apr 1992 09:56:32 CHUCKB
+Added define for translation.
+
+ Rev 1.1 16 Dec 1991 14:24:50 CARLS
+added define for the HELP BUTTON
+
+ Rev 1.0 20 Nov 1991 19:41:00 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_BACKUPSET 33
+#else
+#include "dlg_ids.h"
+#endif
+
+#ifndef BKUP_H
+#define BKUP_H
+
+#define IDM_BACKUPSET 228
+#define IDD_BKUP_INFO_TITLE 101
+#define IDD_BKUP_OK_BUTTON 102
+#define IDD_BKUP_SCROLLBAR 103
+#define IDD_BKUP_CANCEL_BUTTON 104
+#define IDD_BKUP_DESCRIPTION 106
+#define IDD_BKUP_APPEND 108
+#define IDD_BKUP_REPLACE 109
+#define IDD_BKUP_NEXT_BUTTON 111
+#define IDD_BKUP_DRIVE_NAME 112
+#define IDD_BKUP_AUTO_VERIFY 114
+#define IDD_BKUP_TAPE_NAME 117
+#define IDD_BKUP_PASSWORD 118
+#define IDD_BKUP_BACKUP_BINDERY 121
+#define IDD_BKUP_INCLUDE_CATALOGS 122
+#define IDD_BKUP_CATALOG_FULL 123
+#define IDD_BKUP_CATALOG_PARTIAL 124
+#define IDD_BKUP_METHOD 220
+#define IDD_BKUP_SKIP_YES 230
+#define IDD_BKUP_SKIP_NO 231
+#define IDD_BKUP_SKIP_WAIT 232
+#define IDD_BKUP_SKIP_TIME 233
+#define IDD_BKUP_CURRENT_TAPE_NAME 234
+#define IDD_BKUP_PASSWORD_TEXT 125
+#define IDD_BKUP_TAPE_TEXT 240
+#define IDD_BKUP_TAPE_NAME_TEXT 241
+#define IDD_BKUP_SKIP_SECONDS 235
+#define IDD_BKUP_HELP_BUTTON 107
+#define IDD_BKUP_HARDCOMP 242
+#define IDD_BKUP_SOFTCOMP 243
+#define IDD_BKUP_SPINNERBOX 244
+
+#ifdef CAYMAN
+#define IDD_BKUP_REGISTRY 119
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/inc/bsdu.h b/private/utils/ntbackup/inc/bsdu.h
new file mode 100644
index 000000000..18ba98c1b
--- /dev/null
+++ b/private/utils/ntbackup/inc/bsdu.h
@@ -0,0 +1,566 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bsdu.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This header file contains all the function prototypes
+ and macro definitions for the entry points into the BSDU
+
+ Location: BE_PUBLIC
+
+
+ $Log: M:/LOGFILES/BSDU.H_V $
+ *
+ * Rev 1.33.1.0 24 Nov 1993 14:53:32 BARRY
+ * Unicode fixes
+ *
+ * Rev 1.33 20 Jul 1993 17:32:52 MIKEP
+ * Add prototype for bsd_findbyname
+ *
+ * Rev 1.32 20 Jul 1993 11:09:42 MIKEP
+ * add bsd_getname macro
+ *
+ * Rev 1.31 19 Jul 1993 10:21:48 BARRY
+ * BSD_GetDLE changed to function call -- no longer have ptr to DLE.
+ *
+ * Rev 1.30 21 Jun 1993 09:02:36 ChuckS
+ * Added macros for cat_status field.
+ *
+ * Rev 1.29 29 Apr 1993 11:00:24 MIKEP
+ * Add on tape catalog version to bsd
+ *
+ * Rev 1.28 05 Feb 1993 22:29:50 MARILYN
+ * removed copy/move functionality
+ *
+ * Rev 1.27 08 Dec 1992 14:43:54 DON
+ * changed BSD_BACKUP_DIFERENTIAL to BSD_BACKUP_DIFFERENTIAL (2 Fs)
+ *
+ * Rev 1.26 07 Dec 1992 18:20:56 DON
+ * incorporated Marilyns stuff for copy/move
+ *
+ * Rev 1.25 18 Sep 1992 15:53:14 STEVEN
+ * fix spelling
+ *
+ * Rev 1.24 17 Sep 1992 11:12:48 STEVEN
+ * add support for daily backup
+ *
+ * Rev 1.23 12 Aug 1992 17:46:52 STEVEN
+ * fixed bugs at microsoft
+ *
+ * Rev 1.22 29 Jul 1992 15:30:44 STEVEN
+ * fix warnings
+ *
+ * Rev 1.20 27 May 1992 15:37:04 TIMN
+ * Fixed syntax error
+ *
+ * Rev 1.19 14 May 1992 13:45:32 STEVEN
+ * added tim's UNICODE changes
+ *
+ * Rev 1.18 14 May 1992 13:06:28 STEVEN
+ * added support for unreadable BSETS
+ *
+ * Rev 1.17 13 May 1992 19:16:52 TIMN
+ * Updated protos with size parameter
+ *
+ * Rev 1.16 11 May 1992 10:39:22 STEVEN
+ * added get macor for volume name
+ *
+ * Rev 1.15 08 May 1992 16:24:24 STEVEN
+ * added volume label to BSD
+ *
+ * Rev 1.14 29 Apr 1992 16:00:50 BARRY
+ * Added initial selection status for UIs.
+ *
+ * Rev 1.13 20 Apr 1992 11:22:28 BARRY
+ * Added BSD_GetCount macro. Returns the number of BSDs in a list.
+ *
+ * Rev 1.12 14 Jan 1992 10:25:38 STEVEN
+ * fix warnings for WIN32
+ *
+ * Rev 1.11 18 Oct 1991 14:22:06 STEVEN
+ * BIGWHEEL-fix bug in entire dir support
+ *
+ * Rev 1.10 19 Sep 1991 11:04:14 STEVEN
+ * 8200SX - Added GetPrequalify() & BSD_HardwareSupportFeatures()
+ *
+ * Rev 1.9 27 Aug 1991 17:33:58 STEVEN
+ * added BSD target dir support
+ *
+ * Rev 1.8 23 Aug 1991 17:01:42 STEVEN
+ * added support for NORMAL/COPY/DIFFERENTIAL/INCREMENTAL
+ *
+ * Rev 1.7 20 Aug 1991 09:53:44 STEVEN
+ * add ui configuration to BSD structure
+ *
+ * Rev 1.6 23 Jul 1991 16:20:26 STEVEN
+ * added BSD_RefreshConfig( )
+ *
+ * Rev 1.5 21 Jun 1991 08:44:20 STEVEN
+ * new config unit
+ *
+ * Rev 1.4 20 Jun 1991 10:50:28 STEVEN
+ * tried to put 2 in a 1bit bitfield
+ *
+ * Rev 1.3 13 Jun 1991 14:02:06 STEVEN
+ * need version # in LBA for FFR
+ *
+ * Rev 1.2 12 Jun 1991 15:59:50 STEVEN
+ * added virtual memory for LBAs
+ *
+ * Rev 1.1 29 May 1991 17:22:52 STEVEN
+ * Re-Design of BSDU for New Fast File Restore
+ *
+ * Rev 1.0 09 May 1991 13:33:22 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef BSDU_h
+#define BSDU_h 1
+
+#include "queues.h"
+#include "datetime.h"
+#include "bsdu_str.h"
+
+/* $end$ */
+
+/**
+ Constants used as parameters and return values
+**/
+#define USE_WILD_CARD TRUE
+#define NO_WILD_CARD FALSE
+
+#define INCLUDE_SUBDIRS TRUE
+#define NOT_INC_SUBDIRS FALSE
+
+#define NON_DELETED_FILES_ONLY 0
+#define DELETED_FILES_ONLY 1
+#define DELETED_AND_NON_DELETED 2
+
+#define LBA_BEGIN_POSITION 0 /* LBA types - e.g. C:\fred\*.* */
+#define LBA_SINGLE_OBJECT 1 /* - e.g. C:\fred\sue.c */
+
+#define BSD_PROCESS_OBJECT 1
+#define BSD_PROCESS_ELEMENTS 2
+#define BSD_SPECIAL_OBJECT 3
+#define FSL_EMPTY 4
+#define BSD_PROCESS_ENTIRE_DIR 5
+#define BSD_SKIP_OBJECT 0
+
+#define SINGLE_FILE_SELECTION 1
+#define ENTIRE_DIR_SELECTION 2
+#define PARTIAL_SELECTION 0
+
+/*
+ * Values for selection status. The value INITIAL_SELECTED is required by
+ * some UIs for generality, but is NEVER, and shall NEVER be returned by
+ * the BSDU as a selection status.
+ */
+#define INITIAL_SELECTED 255
+#define NONE_SELECTED 0
+#define ALL_SELECTED 1
+#define SOME_SELECTED 2
+
+#define INCLUDE ((UINT16)1)
+#define EXCLUDE ((UINT16)0)
+
+/* defines for backup_type parm to BSD_SetBackupType() */
+#define BSD_BACKUP_COMPATIBLE 0
+#define BSD_BACKUP_NORMAL 1
+#define BSD_BACKUP_COPY 2
+#define BSD_BACKUP_DIFFERENTIAL 3
+#define BSD_BACKUP_INCREMENTAL 4
+#define BSD_BACKUP_DAILY 5
+
+/* BSD header function codes */
+#define BSD_BACKUP 1
+#define BSD_RESTORE 2
+#define BSD_VERIFY 3
+#define BSD_MISC_OPER 4
+#define BSD_TRANSFER 5
+#define BSD_ANY_FUNC 0 /* internal use only */
+
+
+/**
+ BSD manipulation functions
+**/
+INT16 BSD_OpenList( BSD_HAND *bsdh, struct VM_STR *vm_hand ) ;
+VOID BSD_CloseList( BSD_HAND bsdh ) ;
+
+INT16 BSD_Add( BSD_HAND bsdh, BSD_PTR *bsd, struct BE_CFG *cfg, VOID_PTR stats,
+ struct GENERIC_DLE *dle, UINT32 tape_id, UINT16 tape_num,
+ INT16 set_num, struct THW *thw, DATE_TIME_PTR sort_date );
+
+VOID BSD_Remove( BSD_PTR bsd ) ;
+
+INT16 BSD_SetTapeLabel( BSD_PTR bsd, VOID_PTR label, INT16 label_size ) ;
+
+INT16 BSD_SetVolumeLabel( BSD_PTR bsd, VOID_PTR label, INT16 label_size ) ;
+
+INT16 BSD_SetBackupLabel( BSD_PTR bsd, VOID_PTR label, INT16 label_size ) ;
+
+INT16 BSD_SetBackupDescript( BSD_PTR bsd, VOID_PTR descript, INT16 dscr_size ) ;
+
+INT16 BSD_SetTapePswd( BSD_PTR bsd, VOID_PTR tape_pswd, INT16 psw_size ) ;
+
+INT16 BSD_SetBackupPswd( BSD_PTR bsd, VOID_PTR backup_pswd, INT16 psw_size ) ;
+
+INT16 BSD_SetUserName( BSD_PTR bsd, VOID_PTR name, INT16 name_size ) ;
+
+VOID BSD_SetTapePos( BSD_PTR bsd, UINT32 tape_id, UINT16 tape_num,
+ UINT16 set_num ) ;
+
+BSD_PTR BSD_FindByDLE( BSD_HAND bsdh, struct GENERIC_DLE *dle ) ;
+
+BSD_PTR BSD_FindByName( BSD_HAND bsdh, CHAR_PTR name ) ;
+
+BSD_PTR BSD_FindBySourceDevice( BSD_HAND bsdh, VOID_PTR apps_ptr ) ;
+
+BSD_PTR BSD_FindByTapeID( BSD_HAND bsdh, UINT32 tape_id, UINT16 set_num ) ;
+
+INT16 BSD_CreatFSE( FSE_PTR *fse, INT16 oper, VOID_PTR path, INT16 psize,
+ VOID_PTR fname, INT16 fnsize, BOOLEAN wilds, BOOLEAN inc_sub ) ;
+
+VOID BSD_AddFSE( BSD_PTR bsd, FSE_PTR fse ) ;
+
+VOID BSD_RemoveFSE( FSE_PTR fse ) ;
+
+VOID BSD_ClearAllFSE( BSD_PTR bsd ) ;
+
+VOID BSD_ClearDelete( BSD_PTR bsd ) ;
+
+struct FSYS_HAND_STRUCT ;
+struct DBLK ;
+
+INT16 BSD_MatchObj( BSD_PTR bsd, FSE_PTR *fse, struct FSYS_HAND_STRUCT *fsh,
+ struct DBLK *ddb, struct DBLK *fdb, BOOLEAN disp_flag ) ;
+
+INT16 BSD_MatchPathAndFile( BSD_PTR bsd, FSE_PTR *fse,
+ CHAR_PTR fname, CHAR_PTR path, INT16 psize, UINT32 attr,
+ DATE_TIME_PTR date, DATE_TIME_PTR access_date,
+ DATE_TIME_PTR backup_date, BOOLEAN deleted_flag, BOOLEAN disp_flag ) ;
+
+VOID BSD_SaveLastOper( BSD_HAND bsdh );
+
+VOID BSD_ClearLastOper( BSD_HAND bsdh );
+
+VOID BSD_ClearCurrOper( BSD_HAND bsdh );
+
+VOID BSD_ProcLastOper( BSD_HAND bsdh );
+
+VOID BSD_SwapOper( BSD_HAND bsdh );
+
+VOID BSD_BeginFunction( BSD_HAND bsdh, INT16 function ) ; /* fred */
+
+struct GENERIC_DLE* BSD_GetDLE( BSD_PTR bsd );
+
+VOID BSD_SetDLE( BSD_PTR bsd, struct GENERIC_DLE *dle ) ;
+
+INT16 BSD_SetTargetInfo( BSD_PTR bsd, VOID_PTR tgt_path, INT16 psize ) ;
+VOID BSD_GetTargetInfo( BSD_PTR bsd, VOID_PTR *path, INT16 *psize );
+
+VOID BSD_SetBackupType( BSD_PTR bsd, INT16 backup_type ) ;
+
+VOID BSD_RefreshConfig( BSD_HAND bsdh, struct BE_CFG *conf ) ;
+
+BOOLEAN BSD_HardwareSupportsFeature( BSD_PTR bsd, UINT32 feature ) ;
+
+/**
+ FSE Manipulation functions
+**/
+
+INT16 FSE_Copy( FSE_PTR orig_fse, FSE_PTR *new_fse ) ;
+
+INT16 FSE_SetTargetInfo( FSE_PTR fse, VOID_PTR tgt_path, INT16 psize, VOID_PTR tgt_fname, INT16 fn_size ) ;
+VOID FSE_GetTargetInfo( FSE_PTR fse, VOID_PTR *path, INT16 *psize, VOID_PTR *fname, INT16 *fnsize );
+
+INT16 FSE_SetModDate( FSE_PTR fse, DATE_TIME_PTR pre, DATE_TIME_PTR post ) ;
+INT16 FSE_SetAccDate( FSE_PTR fse, DATE_TIME_PTR pre ) ;
+INT16 FSE_SetBakDate( FSE_PTR fse, DATE_TIME_PTR pre ) ;
+VOID FSE_GetModDate( FSE_PTR fse, DATE_TIME_PTR *pre, DATE_TIME_PTR *post ) ;
+VOID FSE_GetAccDate( FSE_PTR fse, DATE_TIME_PTR *pre ) ;
+VOID FSE_GetBakDate( FSE_PTR fse, DATE_TIME_PTR *pre ) ;
+
+INT16 FSE_SetAttribInfo( FSE_PTR fse, UINT32 a_on_mask, UINT32 a_off_mask ) ;
+VOID FSE_GetAttribInfo( FSE_PTR fse, UINT32_PTR a_on_mask, UINT32_PTR a_off_mask ) ;
+/**
+ BSD Macros
+**/
+
+
+#define BSD_GetFirst( bsdh ) \
+ (BSD_PTR)QueueHead( &(bsdh->current_q_hdr) )
+
+#define BSD_GetNext( bsd ) \
+ (BSD_PTR)QueueNext( &((bsd)->q) )
+
+#define BSD_GetName( bsd ) \
+ ((bsd)->dle_name)
+#define BSD_GetTapeCatVer( bsd ) \
+ ((bsd)->tape_cat_ver)
+#define BSD_SetTapeCatVer( bsd, version ) \
+ ((bsd)->tape_cat_ver = (version))
+
+#define BSD_GetTapeID( bsd ) \
+ ((bsd)->tape_id)
+#define BSD_GetTapeNum( bsd )\
+ ((bsd)->tape_num)
+#define BSD_GetSetNum( bsd ) \
+ ((bsd)->set_num)
+#define BSD_GetVolumeLabel( bsd )\
+ ((bsd)->vol_label)
+#define BSD_SizeofVolumeLabel( bsd )\
+ ((bsd)->vol_label_size)
+#define BSD_GetTapeLabel( bsd )\
+ ((bsd)->tape_label)
+#define BSD_SizeofTapeLabel( bsd )\
+ ((bsd)->tape_label_size)
+#define BSD_GetTapePswd( bsd )\
+ ((bsd)->tape_pswd)
+#define BSD_GetTapePswdSize( bsd )\
+ ((bsd)->tape_pswd_size)
+#define BSD_GetBackupLabel( bsd )\
+ ((bsd)->set_label)
+#define BSD_SizeofBackupLabel( bsd )\
+ ((bsd)->set_label_size)
+#define BSD_GetBackupPswd( bsd )\
+ ((bsd)->set_pswd)
+#define BSD_GetBackupPswdSize( bsd )\
+ ((bsd)->set_pswd_size)
+#define BSD_GetBackupDescript( bsd )\
+ ((bsd)->set_descript)
+#define BSD_SizeofBackupDescript( bsd )\
+ ((bsd)->set_descript_size)
+#define BSD_GetUserName( bsd )\
+ ((bsd)->user_name)
+#define BSD_SizeofUserName( bsd )\
+ ((bsd)->user_name_size)
+
+#define BSD_SetLogicalSourceDevice( bsd, app_ptr )\
+ ((bsd)->source_dev = (app_ptr))
+
+#define BSD_GetLogicalSourceDevice( bsd )\
+ ((bsd)->source_dev)
+
+#define BSD_GetMarkStatus( bsd ) \
+ ((bsd)->select_status)
+
+#define BSD_SetMarkStatus( bsd, stat ) \
+ ((bsd)->select_status = (stat) )
+
+
+#define BSD_GetConfigData( bsd ) \
+ ((bsd)->cfg)
+
+#define BSD_GetStatData( bsd ) \
+ ((bsd)->stats)
+
+#define BSD_GetUIConfig( bsd ) \
+ ((bsd)->ui_config)
+
+#define BSD_SetUIConfig( bsd, cfg ) \
+ ((bsd)->ui_config = (VOID_PTR)(cfg))
+
+#define BSD_GetTHW( bsd ) \
+ ((bsd)->thw)
+
+#define BSD_SetTHW( bsd, inp_thw ) \
+ ((bsd)->thw = (inp_thw))
+
+#define BSD_GetOperStatus( bsd )\
+ ( (bsd)->oper_status )
+
+#define BSD_SetOperStatus( bsd, status ) \
+ ((bsd)->oper_status = (status))
+
+#define BSD_GetProcSpecialFlg( bsd ) \
+ ((bsd)->flags.proc_special )
+
+#define BSD_SetProcSpecialFlg( bsd, value ) \
+ ((bsd)->flags.proc_special = value )
+
+#define BSD_GetProcElemOnlyFlg( bsd ) \
+ ((bsd)->flags.proc_nosecure )
+
+#define BSD_SetProcElemOnlyFlg( bsd, value ) \
+ ((bsd)->flags.proc_nosecure = value ) /* FALSE to process security */
+
+#define BSD_GetBackupType( bsd ) \
+ ((bsd)->flags.backup_type )
+
+#define BSD_CompatibleBackup( bsd ) \
+ (!(bsd)->flags.sup_back_type)
+
+#define BSD_SetArchiveBackup( bsd ) \
+ ((bsd)->flags.set_mod_flag )
+
+#define BSD_ModFilesOnly( bsd ) \
+ ((bsd)->flags.modify_only)
+
+#define BSD_GetPBA( bsd ) \
+ ((bsd)->pba )
+
+#define BSD_SetPBA( bsd, val ) \
+ ((bsd)->pba = val )
+
+#define BSD_ViewDate( bsd ) \
+ ( &((bsd)->sort_date) )
+
+#define BSD_GetFunctionCode( bsdh ) \
+ ((bsdh)->function_code )
+
+#define BSD_IsTapeNameChangable( bsd ) \
+ ( (bsd)->flags.tp_name_chg )
+
+#define BSD_IsBsetNameChangable( bsd ) \
+ ( (bsd)->flags.bs_name_chg )
+
+#define BSD_IsBsetDescriptChangable( bsd ) \
+ ( (bsd)->flags.bs_dscr_chg )
+
+#define BSD_MarkTapeNameNotChangable( bsd ) \
+ ( (bsd)->flags.tp_name_chg = FALSE )
+
+#define BSD_MarkBsetNameNotChangable( bsd ) \
+ ( (bsd)->flags.bs_name_chg = FALSE )
+
+#define BSD_MarkBsetDescrNotChangable( bsd ) \
+ ( (bsd)->flags.bs_dscr_chg = FALSE )
+
+#define BSD_SetFullyCataloged( bsd, full ) \
+ ( (bsd)->flags.fully_cataloged = (full) )
+
+#define BSD_GetFullyCataloged( bsd ) \
+ ( (bsd)->flags.fully_cataloged )
+
+#define BSD_IsBsetUnReadable( bsd ) \
+ ( (bsd)->flags.unreadable_set )
+
+#define BSD_SetBsetUnReadable( bsd ) \
+ ( (bsd)->flags.unreadable_set = TRUE )
+
+#define BSD_SetPrequalified( bsd, t_or_f ) \
+ ( (bsd)->flags.prequalified = (t_or_f) )
+
+#define BSD_GetPrequalified( bsd ) \
+ ( (bsd)->flags.prequalified )
+
+/* can only be done if BSD added with NULL sort date */
+#define BSD_SetDate( bsd, date ) \
+ ( (bsd)->sort_date = *date )
+
+
+#define BSD_GetCount( bsd_hand ) (QueueCount( &((bsd_hand)->current_q_hdr)) )
+
+
+/**
+ FSE Macros
+**/
+
+#define BSD_GetFirstFSE( bsd ) \
+ ( (FSE_PTR)QueueHead( &((bsd)->fse_q_hdr) ) )
+
+#define BSD_GetLastFSE( bsd ) \
+ ( (FSE_PTR)QueueTail( &((bsd)->fse_q_hdr) ) )
+
+#define BSD_GetNextFSE( fse ) \
+ ( (FSE_PTR)QueueNext( &((fse)->q) ) )
+
+#define BSD_GetPrevFSE( fse ) \
+ ( (FSE_PTR)QueuePrev( &((fse)->q) ) )
+
+
+#define FSE_GetSelectType( fse ) \
+ ((fse)->flgs.select_type )
+
+#define FSE_HasTargetInfo( fse ) \
+ ((fse)->tgt != NULL )
+
+#define FSE_HasComplexInfo( fse ) \
+ ((fse)->cplx != NULL )
+
+#define FSE_GetPath( fse, dirptr, size ) \
+ ( (*(dirptr) = (fse)->dir),\
+ (*(size) = (fse)->dir_leng))
+
+#define FSE_GetFname( fse ) \
+ ((fse)->fname)
+
+#define FSE_MarkDeleted( fse ) \
+ ((fse)->flgs.proced_fse = 1)
+
+#define FSE_GetDeleteMark( fse ) \
+ ((fse)->flgs.proced_fse)
+
+#define FSE_SetAllVersionsFlg( fse, val ) \
+ ((fse)->flgs.all_vers = (val) )
+
+#define FSE_SetDeletedVersionFlg( fse, val ) \
+ ((fse)->flgs.del_files = (val) )
+
+#define FSE_GetDeletedVersionFlg( fse ) \
+ ((fse)->flgs.del_files)
+
+#define FSE_SetIncSubFlag( fse, flag ) \
+ ((fse)->flgs.inc_subdir = (UINT16)(!(!(flag))))
+
+#define FSE_SetWildFlag( fse, flag ) \
+ ((fse)->flgs.wild_cards = (UINT16)(!(!(flag))))
+
+#define FSE_GetIncSubFlag( fse ) \
+ ((fse)->flgs.inc_subdir)
+
+#define FSE_GetWildFlag( fse ) \
+ ((fse)->flgs.wild_cards)
+
+#define FSE_SetOperType( fse, flag ) \
+ ((fse)->flgs.inc_exc = (flag) )
+
+#define FSE_GetOperType( fse ) \
+ ((fse)->flgs.inc_exc)
+
+VOID BSD_ClearAllLBA( BSD_PTR bsd ) ;
+
+INT16 BSD_AddLBAElem( BSD_PTR bsd, UINT32 lba, UINT16 tape_num, UINT16 type, UINT16 ver ) ;
+
+INT16 BSD_GetFirstLBA( BSD_PTR bsd, LBA_ELEM_PTR lba ) ;
+
+INT16 BSD_GetNextLBA( BSD_PTR bsd, LBA_ELEM_PTR lba ) ;
+
+#define LBA_GetLBA( lba_elem ) \
+ ( (lba_elem)->lba_val )
+
+#define LBA_GetTapeNum( lba_elem ) \
+ ( (lba_elem)->tape_num )
+
+#define LBA_GetType( lba_elem ) \
+ ( (lba_elem)->type )
+
+#define LBA_GetFileVer( lba_elem ) \
+ ( (lba_elem)->file_ver_num )
+
+#define BSD_SetCatStatus( bsd, status ) \
+ ( (bsd)->cat_status = status )
+
+#define BSD_GetCatStatus( bsd ) \
+ ( (bsd)->cat_status )
+
+#define BSD_GetOsId( bsd ) \
+ ( (bsd)->set_os_id )
+
+#define BSD_GetOsVer( bsd ) \
+ ( (bsd)->set_os_ver )
+
+#define BSD_SetOsId( bsd, v ) \
+ ( (bsd)->set_os_id = v )
+
+#define BSD_SetOsVer( bsd, v ) \
+ ( (bsd)->set_os_ver = v )
+
+#endif
+
+
+
diff --git a/private/utils/ntbackup/inc/bsdu_str.h b/private/utils/ntbackup/inc/bsdu_str.h
new file mode 100644
index 000000000..efc0e2be1
--- /dev/null
+++ b/private/utils/ntbackup/inc/bsdu_str.h
@@ -0,0 +1,264 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bsdu_str.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This header file contains the structures maintained by
+ the BSDU unit.
+
+ Location: BE_PUBLIC
+
+
+ $Log: M:/LOGFILES/BSDU_STR.H_V $
+ *
+ * Rev 1.22.1.0 24 Nov 1993 14:53:32 BARRY
+ * Unicode fixes
+ *
+ * Rev 1.22 19 Jul 1993 10:23:42 BARRY
+ * No longer retain pointer to DLE -- use device name instead.
+ *
+ * Rev 1.21 21 Jun 1993 09:02:46 ChuckS
+ * Added cat_status field to BSD for restore
+ *
+ * Rev 1.20 29 Apr 1993 11:00:16 MIKEP
+ * Add on tape catalog version to bsd
+ *
+ * Rev 1.19 05 Feb 1993 22:30:06 MARILYN
+ * removed copy/move functionality
+ *
+ * Rev 1.18 07 Dec 1992 17:12:24 DON
+ * incorporated Marilyns stuff for copy/move
+ *
+ * Rev 1.17 29 Jul 1992 15:31:44 STEVEN
+ * fix warnings
+ *
+ * Rev 1.15 06 Jul 1992 16:18:56 STEVEN
+ * fix sizes for all files
+ *
+ * Rev 1.14 19 May 1992 15:13:58 TIMN
+ * Added all file defines
+ *
+ * Rev 1.13 14 May 1992 13:45:36 STEVEN
+ * added tim's UNICODE changes
+ *
+ * Rev 1.12 14 May 1992 13:06:30 STEVEN
+ * added support for unreadable BSETS
+ *
+ * Rev 1.11 13 May 1992 19:18:08 TIMN
+ * Added string size fields in BSD struct
+ *
+ * Rev 1.10 08 May 1992 16:24:22 STEVEN
+ * added volume label to BSD
+ *
+ * Rev 1.9 19 Sep 1991 10:58:30 STEVEN
+ * 8200SX - Added prequalified boolean
+ *
+ * Rev 1.8 27 Aug 1991 17:34:16 STEVEN
+ * added BSD target dir support
+ *
+ * Rev 1.7 23 Aug 1991 17:02:02 STEVEN
+ * added support for NORMAL/COPY/DIFERENTIAL/INCREMENTAL
+ *
+ * Rev 1.6 20 Aug 1991 09:53:38 STEVEN
+ * add ui configuration to BSD structure
+ *
+ * Rev 1.5 26 Jun 1991 13:50:16 STEVEN
+ *
+ * Rev 1.4 21 Jun 1991 08:44:40 STEVEN
+ * new config unit
+ *
+ * Rev 1.3 13 Jun 1991 14:02:26 STEVEN
+ * need version # in LBA for FFR
+ *
+ * Rev 1.2 12 Jun 1991 16:00:12 STEVEN
+ * added virtual memory for LBAs
+ *
+ * Rev 1.1 20 May 1991 10:13:46 STEVEN
+ * Re-Design of BSDU for new FFR
+ *
+ * Rev 1.0 09 May 1991 13:30:32 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef BSDU_STR_H
+#define BSDU_STR_H 1
+
+
+#if defined( UNICODE )
+# define ALL_FILES TEXT("*.*")
+# define ALL_FILES_LENG ((UINT16)8) /* length for ALL_FILES */
+# define ALL_FILES2 TEXT("*")
+# define ALL_FILES2_LENG ((UINT16)4) /* length for ALL_FILES2 */
+#else
+# define ALL_FILES "*.*"
+# define ALL_FILES_LENG ((UINT16)4) /* length for ALL_FILES */
+# define ALL_FILES2 "*"
+# define ALL_FILES2_LENG ((UINT16)2) /* length for ALL_FILES2 */
+#endif
+
+
+/*
+ Define the Backup Set Descriptor List data structure
+
+ The BSD_LIST contains two BSD queues. The first queue is for current
+ selections. The second queue is for selections from the previous operation.
+ After a backup or a restore, the second queue should be removed and the first
+ queue should moved to the second position.
+
+*/
+
+typedef struct FSE_FLAGS {
+ UINT16 select_type : 2 ;
+ UINT16 inc_exc : 1 ;
+ UINT16 del_files : 2 ;
+ UINT16 all_vers : 1 ;
+ UINT16 inc_subdir : 1 ;
+ UINT16 proced_fse : 1 ;
+ UINT16 wild_cards : 1 ;
+} FSE_FLAGS ;
+
+typedef struct BSD_FLGS{
+ UINT16 bs_name_chg : 1 ; /* TRUE if backup set name is changable */
+ UINT16 tp_name_chg : 1 ; /* TRUE if tape name is changable */
+ UINT16 bs_dscr_chg : 1 ; /* TRUE if backup description changable */
+ UINT16 fully_cataloged :1 ; /* TRUE if fully cataloged set */
+ UINT16 proc_special :1 ; /* should we process special files */
+ UINT16 proc_nosecure :1 ; /* should we process security */
+ UINT16 sup_back_type :1 ; /* support NORMAL/COPY/DIFER/INCREM */
+ UINT16 modify_only : 1 ; /* backup modified files only */
+ UINT16 set_mod_flag : 1 ; /* clear the modified flag after backup */
+ UINT16 backup_type : 3 ; /* support NORMAL/COPY/DIFER/INCREM */
+ UINT16 prequalified : 1 ; /* TRUE if prequalified set */
+ UINT16 unreadable_set : 1 ; /* TRUE if set is unreadable */
+
+} BSD_FLAGS ;
+
+typedef struct BSD_LIST {
+ struct VM_STR *vm_hand ;
+ Q_HEADER current_q_hdr ; /* pointer to list of BSDs */
+ INT16 function_code ; /* backup, restore, verify or other */
+ Q_HEADER last_q_hdr ; /* pointer to last oper's list of BSDs */
+} BSD_LIST, *BSD_HAND;
+
+
+
+/*
+ Define the Backup Set Descriptor Element
+
+ The BSD contains information about the tape of intrest and the
+ disk of intrest. It also contains the head of the FSE queue.
+ The BSD queue is sorted by sort_date, and then by tape number, and
+ then by disk device name. The BSD also contains processing flags
+ and operation completion codes.
+
+*/
+
+typedef struct BSD {
+ Q_ELEM q ; /* points to next BSD */
+ Q_HEADER fse_q_hdr ; /* Queue of FSEs */
+ UINT32 lba_vm_q_head; /* lba Queue cross linked with FSEs */
+ UINT32 lba_vm_q_tail; /* lba Queue cross linked with FSEs */
+ VOID_PTR source_dev ; /* Identifies the source Device */
+ UINT32 tape_id ; /* Identifies set of tapes */
+ UINT16 tape_num ; /* Specifies tape number of set */
+ INT16 set_num ; /* Specifies what set to process */
+ UINT32 pba ; /* Physical Block Address of set */
+ INT16 select_status ; /* Some, All, file, dir, or complex */
+ INT16 vol_label_size ; /* size of volume name */
+ VOID_PTR vol_label ; /* source volume name from VCB */
+ INT16 tape_label_size ; /* size of tape label */
+ VOID_PTR tape_label ; /* user suplied tape label in VCB */
+ INT16 set_label_size ; /* size of set label */
+ VOID_PTR set_label ; /* user suplied set label in VCB */
+ INT16 set_descript_size ; /* size of set description */
+ VOID_PTR set_descript ; /* user suplied set descriptin VCB */
+ INT16 user_name_size ; /* size of user name */
+ VOID_PTR user_name ; /* user suplied name for himself */
+ INT16 tape_pswd_size ; /* size of tape passowrd */
+ VOID_PTR tape_pswd ; /* user specified tape password */
+ INT16 set_pswd_size ; /* size of backup set password */
+ VOID_PTR set_pswd ; /* user specified set password */
+ struct BE_CFG *cfg ; /* pointer to Configuration data */
+ struct HEAD_DLE *dle_head; /* list in which DLE is contained */
+ CHAR_PTR dle_name; /* name for DLE */
+ VOID_PTR stats; /* pointer to statistics structure */
+ struct THW *thw ; /* specifies which tape drive to use*/
+ UINT16 oper_status ; /* status of last operation */
+ BSD_FLAGS flags ; /* bit flags */
+ UINT16 tgt_fse_exist; /* TRUE if a Target FSE exists */
+ DATE_TIME sort_date ; /* date used to sort bsd's */
+ VOID_PTR ui_config ; /* user interface config */
+ VOID_PTR target_path ; /* BSD target path */
+ INT16 tgt_psize ; /* BSD target path size */
+ VOID_PTR match_buffer ; /* internaly used by the matcher */
+ INT16 match_buffer_size ; /* internaly used by the matcher */
+ UINT8 tape_cat_ver ; /* MTF on tape catalog version */
+ UINT32 cat_status ; /* Catalog status word - valid on restore only */
+ UINT8 set_os_id ;
+ UINT8 set_os_ver ;
+} BSD, *BSD_PTR ;
+
+/*
+ Define the File Selection Element
+
+ Each FSE descripes a set of files to be processed. A simple FSE only
+ contains a path, file name, and a set of FSE flags.
+
+*/
+
+
+/*
+ Define the Complex data for an FSE
+
+ A complex FSE contins target directory paths and file names, Before and
+ After dates, as well as attribute flags.
+
+*/
+
+typedef struct FSE_TGT_INFO {
+ INT16 psize ; /* length of new directory name */
+ VOID_PTR path ; /* new directory name for restore/ver */
+ INT16 fnsize ; /* length of new file name */
+ VOID_PTR fname; /* new file name for restore/verify */
+} FSE_TGT_INFO, *FSE_TGT_INFO_PTR ;
+
+typedef struct COMP_FSE {
+ DATE_TIME_PTR pre_m_date ; /* only backup files before this date */
+ DATE_TIME_PTR post_m_date ; /* only backup files after this data */
+ DATE_TIME_PTR access_date; /* Proc things backup up before this date*/
+ DATE_TIME_PTR backup_date; /* Proc things backup up before this date*/
+ UINT32 attr_on_mask ; /* mask of attributes which must be on */
+ UINT32 attr_off_mask ; /* mask of attributes which must be off */
+} FSE_COMPLEX, *FSE_COMPLEX_PTR ;
+
+
+typedef struct FSE {
+ Q_ELEM q ; /* queue of FSEs in order of addition */
+ FSE_FLAGS flgs ; /* misc flags */
+ INT16 dir_leng; /* length of directory name to match */
+ VOID_PTR dir ; /* directory name to match */
+ INT16 fname_leng ; /* length of file name to match */
+ VOID_PTR fname ; /* file name to match */
+
+ FSE_TGT_INFO_PTR tgt ;
+ FSE_COMPLEX_PTR cplx ; /* pointer to complex information */
+
+} FSE, *FSE_PTR;
+
+typedef struct LBA_ELEM {
+
+ UINT32 next ; /* vm queue element - next element pointer */
+ UINT32 vm_ptr ; /* vm pointer for current element */
+ UINT32 lba_val ; /* value of the lba */
+ UINT8 tape_num ; /* tape sequence number */
+ UINT8 type ; /* type of LBA - Single Object or Begin Position */
+ UINT8 file_ver_num; /* file version number for restore of ALL versions */
+
+} LBA_ELEM, *LBA_ELEM_PTR ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/buff_prv.h b/private/utils/ntbackup/inc/buff_prv.h
new file mode 100644
index 000000000..7814ae7c8
--- /dev/null
+++ b/private/utils/ntbackup/inc/buff_prv.h
@@ -0,0 +1,35 @@
+/**
+
+ Unit: Tape Format
+
+ Name: buff_prv.h
+
+ Description: Buffer Manager Private data and types
+
+ $Log: T:/LOGFILES/BUFF_PRV.H_V $
+
+ Rev 1.4 04 Feb 1992 21:13:54 GREGG
+Moved DOS specific stuff to DOS specific header file.
+
+ Rev 1.3 16 Jan 1992 21:04:54 GREGG
+Changes resulting from code review on 1/16/92.
+
+ Rev 1.2 14 Jan 1992 02:02:08 GREGG
+Skateboard - Added internal buffer management structure (DOS only).
+
+ Rev 1.1 13 Jan 1992 19:48:08 NED
+changed mw_vcb_requirements to uw_
+changed lw_bm_master_list to uw_
+
+ Rev 1.0 03 Jan 1992 15:09:22 GREGG
+Initial revision.
+
+**/
+
+#if !defined( _BUFFPRIV_H )
+#define _BUFFPRIV_H
+
+extern Q_HEADER uw_bm_master_list ; /* list of all the lists */
+extern BUF_REQ_PTR uw_vcb_requirements; /* passed via BM_SetVCBRequirements() */
+
+#endif /* _BUFFPRIV_H */
diff --git a/private/utils/ntbackup/inc/buffman.h b/private/utils/ntbackup/inc/buffman.h
new file mode 100644
index 000000000..94c34dd38
--- /dev/null
+++ b/private/utils/ntbackup/inc/buffman.h
@@ -0,0 +1,405 @@
+/**
+
+ Unit: Tape Format
+
+ Name: buffman.h
+
+ Description: New Buffer Manager interface
+
+ $Log: N:/LOGFILES/BUFFMAN.H_V $
+ *
+ * Rev 1.23 10 Jun 1993 08:09:12 MIKEP
+ * enable c++
+ *
+ * Rev 1.22 17 Mar 1993 14:54:16 GREGG
+ * This is Terri Lynn. Added Gregg's changes to switch a tape drive's block
+ * mode so that it matches the block size of the current tape.
+ *
+ * Rev 1.21 09 Mar 1993 18:14:12 GREGG
+ * Initial changes for new stream and EOM processing.
+ *
+ * Rev 1.20 26 May 1992 22:54:00 GREGG
+ * Changed BM_SetBytesFree macro to eliminate warnings.
+ *
+ * Rev 1.19 02 Apr 1992 15:23:16 STEVEN
+ * fix compiler error with trinary and /Ox
+ *
+ * Rev 1.18 11 Feb 1992 17:09:32 NED
+ * Changed translator interface slightly from buffman.
+ *
+ * Rev 1.17 04 Feb 1992 20:56:40 GREGG
+ * Changes for dealing with new config parameters.
+ *
+ * Rev 1.16 16 Jan 1992 21:01:00 GREGG
+ * Changed InitList and OS_InitList prototypes to return INT16 not UINT16.
+ *
+ * Rev 1.15 16 Jan 1992 18:36:24 NED
+ * Skateboard: buffer manager changes
+ *
+ * Rev 1.14 14 Jan 1992 19:44:28 NED
+ * Added prototype of BM_OS_CleanupList()
+ *
+ * Rev 1.13 14 Jan 1992 02:16:02 GREGG
+ * Skateboard - Bug fixes.
+ *
+ * Rev 1.12 13 Jan 1992 20:02:24 NED
+ * supressed silly warning
+ *
+ * Rev 1.11 13 Jan 1992 19:46:52 NED
+ * Added prototypes for BM_AllocVCB() and BM_FreeVCB()
+ * Added conditional for DOS for BM_RESERVED_SIZE
+ *
+ * Rev 1.10 13 Jan 1992 13:48:14 GREGG
+ * Skateboard - Bug fixes.
+ *
+ * Rev 1.9 07 Jan 1992 15:11:00 NED
+ * added pointer to buffer pool within BUF struct
+ *
+ * Rev 1.8 03 Jan 1992 13:32:04 GREGG
+ * New buffer management integration
+ *
+ * Rev 1.7 10 Dec 1991 16:40:36 GREGG
+ * SKATEBOARD - New Buf. Mgr. - Initial integration.
+ *
+ * Rev 1.6 22 Aug 1991 16:44:14 NED
+ * Added macros for referencing the internals of the buffer structure.
+ *
+ * Rev 1.5 24 Jun 1991 13:24:34 CARLS
+ * Added os_reserved array for Windows
+ *
+ * Rev 1.4 04 Jun 1991 11:22:48 BARRY
+ * Removed OS-specific fields from the BUF structure. These are
+ * now allocated as part of the buffer.
+ *
+ * Rev 1.3 03 Jun 1991 08:58:28 CARLS
+ * typing error
+ *
+ * Rev 1.2 03 Jun 1991 08:33:22 CARLS
+ * added changes for Windows
+ *
+ * Rev 1.1 10 May 1991 17:10:18 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:06 GREGG
+Initial revision.
+
+**/
+
+#if !defined( _BUFFMAN_H )
+#define _BUFFMAN_H
+
+/* How to describe the specific requirements for one chunk */
+
+typedef struct BLOCK_REQ *BLOCK_REQ_PTR;
+typedef struct BLOCK_REQ
+{
+ UINT16 min_size ; /* Minimum size of allocation */
+ UINT16 max_size ; /* Maximum size of allocation */
+ UINT16 incr_size ; /* Size to increase by if reallocated for more space */
+ UINT16 block ; /* rw_size must be multiple of this size */
+ UINT16 align ; /* physical byte alignment of allocation */
+}
+BLOCK_REQ;
+
+#define BR_DONT_CARE 0 /* use for size requirements */
+
+/* defines used for align or block requirements */
+#define BR_ALIGN_DONT_CARE 1
+#define BR_ALIGN_WORD 2
+#define BR_ALIGN_64K 0
+
+/* How to describe all the requirements for the buffer manager */
+
+typedef struct BUF_REQ *BUF_REQ_PTR;
+typedef struct BUF_REQ
+{
+ BLOCK_REQ a; /* for tape format transfers */
+ UINT16 tf_size ; /* size which TF can use */
+ UINT16 rw_size ; /* size of device driver transfers */
+
+ BLOCK_REQ b; /* for auxiliary uses */
+} BUF_REQ;
+
+/* Error codes returned from buffer manager requirements sub(sub)unit */
+
+typedef enum BR_ERR
+{
+ BR_NO_ERR = 0, /* OK */
+ BR_ERR_INCOMPATIBLE, /* new requirement is incompatible with current */
+ BR_ERR_BAD_REQUIREMENT /* requirement given is internally inconsistent */
+} BR_ERR;
+
+typedef enum BR_ERR *BR_ERR_PTR;
+
+#if defined( OS_DOS )
+
+ struct _DOS_MEM_CHUNK; /* forward reference */
+
+ /* Pointer to element of DOS memory management linked list */
+ typedef struct _DOS_MEM_CHUNK * DOS_MEM_CHUNK_PTR ;
+
+#endif
+
+/* Pointer to BUF structure to be declared later (mutual reference problem) */
+
+typedef struct BUF *BUF_PTR ;
+
+/* List of buffers, containing a requirements context. */
+
+typedef struct BUF_LIST *BUF_LIST_PTR;
+typedef struct BUF_LIST
+{
+ BUF_REQ requirements_context ;
+ UINT32 max_memory ; /* our suggested memory limit */
+
+ /* BM Private: */
+ Q_HEADER list_header ; /* list of BUFs */
+ BUF_PTR vcb_buff ;
+ UINT32 memory_used ; /* total memory we actually used */
+ Q_ELEM q_elem ; /* for BM list-of-lists */
+#if defined( OS_DOS )
+ DOS_MEM_CHUNK_PTR dos_mem_pool ; /* for DOS memory management */
+#endif
+
+} BUF_LIST;
+
+/* The BUF structure itself. */
+
+typedef struct BUF
+{
+ Q_ELEM tf_qe ; /* Struct for TF queue manipulations */
+
+ /*****************************************/
+ /* BM Private: */
+ BUF_LIST_PTR list_ptr; /* list which this buffer is on (ugh!) */
+ UINT16 alloc_size ; /* size of primary (xfer) allocation
+ * plus BM_RESERVED_SIZE */
+ UINT16 aux_size ; /* size of allocation "b" */
+ Q_ELEM bm_qe ; /* Struct for BM queue manipulations */
+ UINT16 gotten : 1; /* TRUE if BM_Get has been called with no BM_Put */
+ UINT16 reserved : 1; /* TRUE if BM_PutAll should not put this one */
+ /*****************************************/
+
+ /* immediately prior to this allocation is a BM_OS_RESERVED. */
+ VOID_PTR ptr1 ; /* Ptr to primary (xfer) allocation */
+
+ VOID_PTR ptr2 ; /* secondary allocation (opt.) */
+
+ UINT16 tf_size ; /* size which TF can use */
+ UINT16 rw_size ; /* size of device driver transfers */
+
+ UINT16 bytes_free ; /* The number of free in this buffer */
+ UINT16 no_dblks ; /* The number of Dblk */
+ UINT16 next_byte ; /* Write: Where to store next byte
+ Read: Where to get next byte */
+ UINT32 beginning_lba ;
+ INT16 read_error ; /* return code from TpReceive */
+} BUF ;
+
+/* Buffer Pool functions ("inline" and otherwise) */
+
+#define BM_ListCount( buf_list_ptr ) QueueCount(&(buf_list_ptr)->list_header)
+#define BM_ListHead( buf_list_ptr ) QueueHead(&(buf_list_ptr)->list_header)
+#define BM_ListTail( buf_list_ptr ) QueueTail(&(buf_list_ptr)->list_header)
+#define BM_ListRequirements( buf_list_ptr ) (&(buf_list_ptr)->requirements_context)
+#define BM_SetListRequirements( buf_list_ptr, buf_req_ptr ) ((buf_list_ptr)->requirements_context = *(buf_req_ptr))
+
+/* Initialize an empty list */
+INT16 BM_InitList(
+ BUF_LIST_PTR list_ptr, /* I/O -- list to de-initialize */
+ UINT16 initial_buff_alloc /* I -- Initial memory to allocate */
+);
+
+/* De-initialize a list: free all the buffers on the list */
+VOID BM_DeInitList(
+ BUF_LIST_PTR list_ptr /* I/O -- list to de-initialize */
+);
+
+/* Do a BM_Put on all non-reserved buffers in a pool */
+VOID BM_PutAll(
+ BUF_LIST_PTR list_ptr /* I/O -- list to Put */
+);
+
+/* Do a BM_Free on all non-reserved buffers in a pool */
+VOID BM_FreeAll(
+ BUF_LIST_PTR list_ptr /* I/O -- list to Free */
+);
+
+/* Buffer functions ("inline" and otherwise) */
+
+#define BM_Reserve( buf_ptr ) ((buf_ptr)->reserved = 1)
+#define BM_UnReserve( buf_ptr ) ((buf_ptr)->reserved = 0)
+#define BM_QElem( buf_ptr ) ((buf_ptr)->tf_qe)
+#define BM_BMQElem( buf_ptr ) ((buf_ptr)->bm_qe)
+#define BM_XferBase( buf_ptr ) ((buf_ptr)->ptr1)
+#define BM_XferSize( buf_ptr ) ((buf_ptr)->rw_size)
+#define BM_TFSize( buf_ptr ) ((buf_ptr)->tf_size)
+#define BM_BytesFree( buf_ptr ) ((buf_ptr)->bytes_free)
+#define BM_NoDblks( buf_ptr ) ((buf_ptr)->no_dblks)
+#define BM_NextByteOffset( buf_ptr ) ((buf_ptr)->next_byte)
+#define BM_BeginningLBA( buf_ptr ) ((buf_ptr)->beginning_lba)
+#define BM_ReadError( buf_ptr ) ((buf_ptr)->read_error)
+#define BM_AuxBase( buf_ptr ) ((buf_ptr)->ptr2)
+#define BM_AuxSize( buf_ptr ) ((buf_ptr)->aux_size)
+
+#define BM_NextBytePtr( buf_ptr ) (VOID_PTR)((UINT8_PTR)BM_XferBase(buf_ptr) + BM_NextByteOffset(buf_ptr))
+#define BM_LastByteOffset( buf_ptr ) (BM_NextByteOffset(buf_ptr) + BM_BytesFree(buf_ptr))
+#define BM_LastBytePtr( buf_ptr ) (VOID_PTR)((UINT8_PTR)BM_XferBase(buf_ptr) + BM_LastByteOffset(buf_ptr))
+
+#define BM_SetNoDblks( buf_ptr, n ) ((buf_ptr)->no_dblks = (n))
+#define BM_IncNoDblks( buf_ptr ) ((buf_ptr)->no_dblks++)
+
+/* note: we clip bytes_free to at most tf_size */
+#define BM_SetBytesFree( buf_ptr, n ) \
+ if ((n) >= (buf_ptr)->tf_size ) { \
+ (buf_ptr)->bytes_free = (buf_ptr)->tf_size ; \
+ } else { \
+ (buf_ptr)->bytes_free = (n) ; \
+ }
+
+#define BM_SetReadError( buf_ptr, n ) ((buf_ptr)->read_error = (n))
+#define BM_SetNextByteOffset( buf_ptr, n ) ((buf_ptr)->next_byte = (n))
+#define BM_SetBeginningLBA( buf_ptr, n ) ((buf_ptr)->beginning_lba = (n))
+
+#define BM_IsVCBBuff( buf_ptr ) ((buf_ptr) == (buf_ptr->list_ptr->vcb_buff))
+
+/* Put a buffer back on the buffer pool */
+#define BM_Put( buf_ptr ) { msassert( buf_ptr != NULL ); buf_ptr->gotten = FALSE; }
+
+/* Initialize the buffer manager subsystem */
+VOID BM_Init( VOID ) ;
+
+/* De-initialize the buffer manager subsystem */
+VOID BM_DeInit( VOID ) ;
+
+/* Set a requirements context to default values */
+VOID BM_ClearRequirements(
+ BUF_REQ_PTR context /* I/O -- context to clear */
+);
+
+/* Add a set of requirements to an existing context */
+BR_ERR BM_AddRequirements(
+ BUF_REQ_PTR context, /* I/O -- context to add requirements to */
+ BUF_REQ_PTR newreqs /* I -- new requirements */
+);
+
+/* Return the amount of memory used by a (hypothetical) buffer */
+UINT32 BM_RequiredSize(
+ BUF_REQ_PTR br_ptr /* I - requirements pointer */
+);
+
+/* Return the amount of memory used by a (hypothetical) buffer
+ * if it has 0 bytes of main and auxiliary allocation.
+ */
+UINT16 BM_BufferOverhead( VOID );
+
+/* Increases the size of the auxiliary buffer based on an increment value
+ * specified in the requirements context.
+ */
+INT16 BM_ReallocAux(
+ BUF_LIST_PTR list_ptr,
+ BUF_PTR buf_ptr
+);
+
+/********************************************************************
+ * OS-Specific functions
+ ********************************************************************/
+
+/* Allocate a buffer for the given list */
+BUF_PTR BM_Alloc( /* Return: NULL if unsuccessful */
+ BUF_LIST_PTR pool /* list we're allocating it for */
+);
+
+/* Allocate a VCB Buffer */
+BUF_PTR BM_AllocVCB(
+ BUF_LIST_PTR pool_ptr ); /* I - list to allocate from */
+
+/* Return a buffer to the OS free pool */
+VOID BM_Free(
+ BUF_LIST_PTR pool, /* list we're freeing it from */
+ BUF_PTR buffer /* the buffer to free */
+) ;
+
+/* Free a VCB buffer */
+VOID BM_FreeVCB(
+ BUF_LIST_PTR pool_ptr,
+ BUF_PTR buf_ptr );
+
+/* Resize the given buffer (may be VCB buffer) */
+INT16 BM_ReSizeBuff(
+ BUF_PTR buf_ptr,
+ BUF_LIST_PTR pool_ptr ) ;
+
+/* this re-sizes every buffer on the given list
+ * which isn't marked as reserved.
+ * Returns TFLE_xxx
+ */
+INT16 BM_ReSizeList(
+ BUF_LIST_PTR pool /* list to re-size */
+);
+
+/********************************************************************
+ * Non-OS-Specific functions
+ ********************************************************************/
+
+/* Get a buffer from the buffer pool */
+BUF_PTR BM_Get(
+ BUF_LIST_PTR pool /* describes buffer to Get */
+);
+
+/* clear out the TF fields (counts and offsets) in a buffer */
+VOID BM_InitBuf(
+ BUF_PTR buffer
+);
+
+/* Use some of the remaining bytes in a buffer. */
+VOID BM_UpdCnts(
+ BUF_PTR buffer,
+ UINT16 nused
+);
+
+/* consume all the remaining bytes in a buffer */
+VOID BM_UseAll(
+ BUF_PTR buffer
+);
+
+/* Set the buffer manager's idea of the VCB requirements
+ * argument must point to statically allocated memory (no copying is done)
+ */
+VOID BM_SetVCBRequirements(
+ BUF_REQ_PTR vcb_reqs /* points to vcb requirements structure */
+);
+
+/* Get the VCB buffer from the buffer pool */
+BUF_PTR BM_GetVCBBuff(
+ BUF_LIST_PTR pool /* describes buffer to Get */
+);
+
+/* Put a buffer back on the buffer pool */
+VOID BM_PutVCBBuff(
+ BUF_PTR buffer /* buffer to return to pool */
+) ;
+
+/* Translator interface */
+
+/* given a pointer to one of the two Q_ELEM's (link or channel_link)
+ * within the first THW_INF of a (master or channel) drive list,
+ * return translator's requirements via supplied BUF_REQ_PTR.
+ * Return TRUE if requirements structure was filled in.
+ * Assume that each Q_ELEM in list has its "ptr" member pointing at
+ * the THW_INF structure.
+ */
+typedef BOOLEAN (*BM_TR_GET_VCB_REQ_FUNC_PTR)(
+ BUF_REQ_PTR requirements, /* O -- translator's requirements */
+ Q_ELEM_PTR first_drive, /* I -- first drive in list */
+ UINT16 suggested_buff_size /* I - size from config */
+);
+
+typedef VOID (*BM_TR_GET_PREF_FUNC_PTR)(
+ Q_ELEM_PTR first_drive, /* I -- first drive in list */
+ UINT16 suggested_number_of_buffers, /* I -- from config */
+ UINT32 suggested_buffer_size, /* I -- from config */
+ UINT32_PTR buffer_requirements_ptr /* I/O -- needed */
+);
+
+#endif /* _BUFFMAN_H */
diff --git a/private/utils/ntbackup/inc/buffnt.h b/private/utils/ntbackup/inc/buffnt.h
new file mode 100644
index 000000000..8a3fcf408
--- /dev/null
+++ b/private/utils/ntbackup/inc/buffnt.h
@@ -0,0 +1,34 @@
+/**
+
+ Unit: Buffer Manager
+
+ Name: buffnt.h
+
+ Description: OS specific Buffer Manager defines, types and protos
+
+ $Log: T:\logfiles\buffnt.h_v $
+
+ Rev 1.1 28 Jan 1994 18:25:30 GREGG
+Fixed MIPS 16 byte alignment requirement bug.
+
+ Rev 1.0 26 Feb 1992 12:04:02 STEVEN
+Initial revision.
+
+**/
+
+// For byte allignment requirements on tape buffers
+#define BM_NT_DEFAULT_BUF_ALGN_SZ 16
+
+INT16 BM_OS_InitList( BUF_LIST_PTR list_ptr, UINT16 initial_buff_alloc ) ;
+
+#define BM_OS_DeInitList( x )
+#define BM_OS_CleanupList( x )
+#define BM_OS_BufferRequirements( avail_mem, x ) \
+ *avail_mem = 16UL * 1024UL * 1024UL
+
+/* prior to the allocation pointed at by BUF::ptr1, there exists the
+ * following area which may be used for OS-specific purposes.
+ * Thus the real allocation size is actually
+ * larger than that requested by BM_RESERVED_SIZE.
+ */
+#define BM_RESERVED_SIZE 0
diff --git a/private/utils/ntbackup/inc/catmaint.h b/private/utils/ntbackup/inc/catmaint.h
new file mode 100644
index 000000000..bc5e6d4b3
--- /dev/null
+++ b/private/utils/ntbackup/inc/catmaint.h
@@ -0,0 +1,12 @@
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_OPERATIONSCATMAINT 27
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_C_TAPE 0x00C9
+#define IDD_C_CHANGE 0x00CB
+#define IDD_C_REMOVE 0x00CA
+
diff --git a/private/utils/ntbackup/inc/cattape.h b/private/utils/ntbackup/inc/cattape.h
new file mode 100644
index 000000000..b175f0720
--- /dev/null
+++ b/private/utils/ntbackup/inc/cattape.h
@@ -0,0 +1,47 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: cattape.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/CATTAPE.H_V $
+
+ Rev 1.4 04 Oct 1992 19:46:26 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 06 Apr 1992 09:56:06 CHUCKB
+Added define for translation.
+
+ Rev 1.2 27 Jan 1992 12:50:44 GLENN
+Fixed dialog IDs.
+
+ Rev 1.1 14 Dec 1991 11:16:50 CARLS
+new IDs for full/partial
+
+ Rev 1.0 09 Dec 1991 17:06:34 CARLS
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_CATTAPE 29
+#else
+#include "dlg_ids.h"
+#endif
+
+#ifndef CATTAPE_H
+#define CATTAPE_H
+
+#define IDD_CATTAPE_MESSAGE 104
+#define IDD_CATTAPE_CONTINUE_BUTTON 101
+#define IDD_CATTAPE_CANCEL_BUTTON 102
+#define IDD_CATTAPE_HELP_BUTTON 103
+#define IDD_CATTAPE_EXCLAMATION_BITMAP 105
+#define IDD_CATTAPE_CATALOG_FULL 106
+#define IDD_CATTAPE_CATALOG_PARTIAL 107
+
+#endif
diff --git a/private/utils/ntbackup/inc/cbemon.h b/private/utils/ntbackup/inc/cbemon.h
new file mode 100644
index 000000000..48c7b5b2f
--- /dev/null
+++ b/private/utils/ntbackup/inc/cbemon.h
@@ -0,0 +1,125 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: ddemang.h
+
+ Description: Status information for remote monitoring.
+
+ $Log: G:\ui\logfiles\cbemon.h_v $
+
+ Rev 1.3 27 Jun 1993 14:15:00 MIKEP
+add STAT_DRIVE_ERROR state.
+
+ Rev 1.2 15 Jun 1993 13:31:14 DARRYLP
+enhancements
+
+ Rev 1.1 27 Apr 1993 19:56:30 DARRYLP
+ID additions.
+
+ Rev 1.2 08 Apr 1993 16:38:14 DARRYLP
+Updates...
+
+******************************************************************************/
+
+#ifndef DDEMANG_H
+
+#define DDEMANG_H
+
+// Status Block Layout
+
+typedef struct
+{
+ DWORD Instance; // Instance of application reporting data.
+ DWORD DataSize; // Size in bytes of structure passed in
+ DWORD Unicode; // Non-zero if strings are unicode format
+
+ DWORD OperationStatus; // one of the STA_OPER_? defines
+ DWORD AppStatus; // one of the STA_APP_? defines
+ DWORD DriveStatus; // one of the STA_DRIVE_? defines
+
+ DWORD TapeFamily; // current tape in the drive
+ DWORD TapeSeqNumber;
+
+ DWORD BackupSet; // if writing, reading or cataloging a set
+
+ DWORD DirCount; // Directories backed up, restored, etc.
+ DWORD FileCount; // Files backed up, restored, etc.
+ DWORD ByteCountLo; // Bytes read/written
+ DWORD ByteCountHi;
+ DWORD CorruptFileCount;
+ DWORD SkippedFileCount;
+
+ DWORD ElapsedSeconds; // Time spent on current backup set in seconds
+
+ DWORD TapeFamilyNeeded;
+ DWORD TapeSeqNeeded;
+
+ // All strings are NULL terminated.
+
+ DWORD OffsetTapeDriveName;
+ DWORD OffsetCurrentTapeName;
+ DWORD OffsetServerVolume;
+ DWORD OffsetTapeDriveIdentifier;
+ DWORD OffsetTapeNeededName;
+ DWORD OffsetDiskName;
+ DWORD OffsetActiveFile;
+ DWORD OffsetErrorMsg;
+ DWORD OffsetActiveDir;
+} STAT_SETSTATUSBLOCK, *PSTAT_SETSTATUSBLOCK;
+
+#define STAT_OPER_IDLE 0
+#define STAT_OPER_BACKUP 1
+#define STAT_OPER_RESTORE 2
+#define STAT_OPER_ERASE 3
+#define STAT_OPER_VERIFY 4
+#define STAT_OPER_TENSION 5
+#define STAT_OPER_FORMAT 6
+#define STAT_OPER_TRANSFER 7
+#define STAT_OPER_CATALOG 8
+
+#define STAT_APP_OK 0
+#define STAT_APP_NEEDTAPE 1
+#define STAT_START_BACKUP 2
+#define STAT_END_BACKUP 3
+#define STAT_WAITING_OPENFILE 4
+#define STAT_SKIPPED_FILE 5
+#define STAT_CORRUPT_FILE 6
+#define STAT_ERROR 7
+
+#define STAT_DRIVE_EMPTY 0
+#define STAT_DRIVE_FOREIGN 1
+#define STAT_DRIVE_VALID 2
+#define STAT_DRIVE_BLANK 3
+#define STAT_DRIVE_UNFORMATTED 4
+#define STAT_DRIVE_BAD 5
+#define STAT_DRIVE_BUSY 6
+#define STAT_DRIVE_ERROR 7
+
+#define IDSM_INSTANCE 1
+#define IDSM_DATASIZE 2
+#define IDSM_UNICODE 3
+#define IDSM_OPERATIONSTATUS 4
+#define IDSM_APPSTATUS 5
+#define IDSM_DRIVESTATUS 6
+#define IDSM_TAPEFAMILY 7
+#define IDSM_TAPESEQNUMBER 8
+#define IDSM_BACKUPSET 9
+#define IDSM_DIRCOUNT 10
+#define IDSM_FILECOUNT 11
+#define IDSM_BYTECOUNTLO 12
+#define IDSM_BYTECOUNTHI 13
+#define IDSM_CORRUPTFILECOUNT 14
+#define IDSM_SKIPPEDFILECOUNT 15
+#define IDSM_ELAPSEDSECONDS 16
+#define IDSM_TAPEFAMILYNEEDED 17
+#define IDSM_TAPESEQNEEDED 18
+#define IDSM_OFFSETTAPEDRIVENAME 19
+#define IDSM_OFFSETCURRENTTAPENAME 20
+#define IDSM_OFFSETSERVERVOLUME 21
+#define IDSM_OFFSETTAPEDRIVEIDENTIFIER 22
+#define IDSM_OFFSETTAPENEEDEDNAME 23
+#define IDSM_OFFSETDISKNAME 24
+#define IDSM_OFFSETACTIVEFILE 25
+#define IDSM_OFFSETERRORMSG 26
+#define IDSM_OFFSETACTIVEDIR 27
+#endif
diff --git a/private/utils/ntbackup/inc/channel.h b/private/utils/ntbackup/inc/channel.h
new file mode 100644
index 000000000..98338a701
--- /dev/null
+++ b/private/utils/ntbackup/inc/channel.h
@@ -0,0 +1,212 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: channel.h
+
+ Description: Contains the control structure for each channel session.
+ This is the where any specific information for a given
+ channel is stored. The TFL has an array of these for all
+ possible channels. The channel number returned by the TFL
+ is an index into this array.
+
+
+ $Log: N:/LOGFILES/CHANNEL.H_V $
+ *
+ * Rev 1.19 15 Jun 1993 09:15:22 MIKEP
+ * warning fixes
+ *
+ * Rev 1.18 17 May 1993 20:12:38 GREGG
+ * Added logic to deal with the fact that the app above tape format doesn't
+ * keep track of the lba of the vcb.
+ *
+ * Rev 1.17 26 Apr 1993 11:45:38 GREGG
+ * Seventh in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * - Changed handling of EOM processing during non-OTC EOS processing.
+ *
+ * Matches CHANNEL.H 1.17, MAYN40RD.C 1.60, TFWRITE.C 1.63, MTF.H 1.5,
+ * TFLUTILS.C 1.44, MTF10WDB.C 1.10, MTF10WT.C 1.9
+ *
+ * Rev 1.16 17 Mar 1993 15:31:10 TERRI
+ * Added macro CurMediaType for use in the Sytos Plus translator.
+ *
+ * Rev 1.15 09 Mar 1993 18:14:04 GREGG
+ * Initial changes for new stream and EOM processing.
+ *
+ * Rev 1.14 22 Oct 1992 10:54:30 HUNTER
+ * Stream changes.
+ *
+ * Rev 1.13 17 Aug 1992 09:09:04 GREGG
+ * Changes to deal with block sizeing scheme.
+ *
+ * Rev 1.12 04 Aug 1992 15:16:38 GREGG
+ * Burt's fixes for variable length block support.
+ *
+ * Rev 1.11 21 May 1992 16:27:32 GREGG
+ * Added read_from_tape boolean to channel for cases where the translator wants to do the reading him
+ * self.
+ *
+ * Rev 1.10 29 Apr 1992 13:09:04 GREGG
+ * ROLLER BLADES - Added CH_EOM_BETWEEN_SETS channel status bit.
+ *
+ * Rev 1.9 05 Apr 1992 19:18:02 GREGG
+ * ROLLER BLADES - Added lb_size (logical block size) element to channel.
+ *
+ * Rev 1.8 25 Mar 1992 21:46:36 GREGG
+ * ROLLER BLADES - Added 64 bit support.
+ *
+ * Rev 1.7 10 Dec 1991 16:42:28 GREGG
+ * SKATEBOARD - New Buf. Mgr. - Initial integration.
+ *
+ * Rev 1.6 29 Oct 1991 08:47:54 HUNTER
+ * VBLK - Added bits to indicate variable data blocks.
+ *
+ * Rev 1.5 17 Oct 1991 01:14:12 GREGG
+ * BIGWHEEL - 8200SX - Added SX_INFO to channel structure.
+ *
+ * Rev 1.4 17 Sep 1991 13:54:18 GREGG
+ * Added save_fmt and save_env to channel structure for saving fmt during write continuation.
+ *
+ * Rev 1.3 22 Jul 1991 10:54:32 GREGG
+ * Added CH_EOS_AT_EOM channel status bit.
+ *
+ * Rev 1.2 15 Jul 1991 14:53:04 NED
+ * Removed unreferenced channel status bits and added CH_CONTINUING.
+ *
+ * Rev 1.1 10 May 1991 17:09:42 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:14 GREGG
+Initial revision.
+
+**/
+#ifndef _CHANNEL_JUNK
+#define _CHANNEL_JUNK
+
+#include <queues.h>
+
+#include "fsys.h"
+#include "drive.h"
+#include "buffman.h"
+#include "dblkmap.h"
+#include "tflstats.h"
+#include "tpos.h"
+#include "sxtf.h"
+
+/* $end$ include list */
+
+typedef struct _CHANNEL {
+ UINT16 status ; /* The bit field containing stuff */
+ UINT16 mode ; /* Read or Write Mode */
+ DRIVE_PTR cur_drv ; /* The current drive we are operating on */
+ BUF_PTR cur_buff ; /* The current buffer if there is one */
+ BUF_PTR hold_buff ; /* To deal with var stream headers across buffer boundaries */
+ INT16 hiwater ; /* Hi-Water mark */
+ INT16 buffs_enqd ; /* The number of buffs enqued*/
+ UINT64 retranslate_size ; /* Should we recall the translators again */
+ BUF_PTR eom_buff ; /* The buffer at EOM */
+ UINT32 eom_id ; /* The last ID before EOM */
+ UINT16 eom_filter ; /* The filter used on the last block */
+ Q_HEADER channel_list ; /* Contains the channel list */
+ UINT16 perm_filter ; /* The permanent filter */
+ UINT16 loop_filter ; /* The filter from loops */
+ UINT16 active_filter ; /* Active filter */
+ UINT32 eom_lba ; /* The LBA at EOM */
+ UINT32 running_lba ; /* The running LBA */
+ UINT16 cur_fmt ; /* index into Current format (r/w) */
+ VOID_PTR fmt_env ; /* Current Environment Pointer for Channel */
+ UINT16 save_fmt ; /* To save cur_fmt at Continuation time */
+ VOID_PTR save_env ; /* To save fmt_env at Continuation time */
+ FSYS_HAND cur_fsys ; /* Current File System */
+ UINT8_PTR lst_osvcb ; /* The last VCB written to tape */
+ UINT8_PTR lst_osddb ; /* The last OSDDB written to tape */
+ UINT8_PTR lst_osfdb ; /* The last OSFDB written to tape */
+ UINT16 lst_tblk ; /* The last type of TAPE BLOCK */
+ DBLK_PTR cur_dblk ; /* The transfer OS DB buffer */
+ DBLKMAP_PTR map_entry ; /* For the dblk map entry */
+ TPOS_PTR ui_tpos ; /* The user interface TPOS */
+ UINT32 lst_did ; /* The last directory ID */
+ UINT32 lst_fid ; /* The last file ID */
+ INT32 tape_id ; /* The tape id */
+ INT16 ts_num ; /* Tape sequence */
+ INT16 bs_num ; /* backup set num */
+ UINT32 blocks_used ; /* number of tape blocks discarded */
+ SX_INFO sx_info ; /* for Exabyte SX - 2200+ positioning */
+ BUF_LIST buffer_list ; /* our pool of buffers for this channel */
+ UINT16 lb_size ; /* logical block size */
+ BOOLEAN read_from_tape ;
+ STREAM_INFO current_stream ; /* The current stream header */
+ INT16 cross_set ;
+ UINT32 cross_lba ;
+} CHANNEL, *CHANNEL_PTR ;
+
+/* NOTE: The fields "lst_osvcb", "lst_osddb", and "lst_fdb", during a write
+ operation normally contain the last TAPE BLOCK ( i.e. in the write
+ tape format ) of the respective types that was to tape. However,
+ when an EOM condition occurs these are translated in OSDBLKS there
+ current type can be determined by the matching flag, 0 for tape
+ block, 1 for DBLK.
+*/
+
+/* Gets the current Block size */
+#define ChannelBlkSize( channel ) (channel)->cur_drv->thw_inf.drv_info.drv_bsize
+
+/* Gets the Filemark Position of the current drive */
+#define NoFmksOnTape( channel ) (channel)->cur_drv->cur_pos.fmks
+
+/* Gets the Physical Block Address for this VCB */
+#define PbaOfVCB( channel ) (channel)->cur_drv->cur_pos.pba_vcb
+
+/* Current Drive Status */
+#define CurDrvStatus( channel ) (channel)->cur_drv->thw.drv_status
+
+/* Current Drive Attributes */
+#define CurDrvAttribs( channel ) (channel)->cur_drv->thw_inf.drv_info.drv_features
+
+/* Current Media Type */
+#define CurMediaType( channel ) (channel)->cur_drv->thw_inf.drv_info.drv_media
+
+/* Is there a tape mounted */
+#define IsTapeMounted( channel ) (channel)->cur_drv->tape_mounted
+
+/* Some Macros */
+
+/* Status Stuff */
+#define CH_IN_USE 0x0001
+#define CH_AT_EOM 0x0002
+#define CH_CONTINUING 0x0004
+#define CH_EOS_AT_EOM 0x0008
+#define CH_DATA_PHASE 0x0020
+#define CH_DONE 0x0040
+#define CH_VCB_DBLK 0x0080
+#define CH_DDB_DBLK 0x0100
+#define CH_FDB_DBLK 0x0200
+#define CH_FATAL_ERR 0x0400
+#define CH_SKIP_ALL_STREAMS 0x0800
+#define CH_SKIP_CURRENT_STREAM 0x1000
+
+// The following bit will be set to indicate that we need to write the
+// start VBLK after we do an AcquireWriteBuffer.
+#define CH_NEED_VBLK 0x1000
+
+#define SetChannelStatus( x, b ) ( (x)->status = ( (x)->status | (b) ) )
+#define ClrChannelStatus( x, b ) ( (x)->status = ( (x)->status & ~(b) ) )
+#define IsChannelStatus( x, b ) ( (x)->status & (b) )
+
+#define InUse( x ) IsChannelStatus( x, CH_IN_USE )
+#define AtEOM( x ) IsChannelStatus( x, CH_AT_EOM )
+#define DataPhase( x ) IsChannelStatus( x, CH_DATA_PHASE )
+#define IsSetDone( x ) IsChannelStatus( x, CH_DONE )
+#define FatalError( x ) IsChannelStatus( x, CH_FATAL_ERR )
+#define VarBlkPhase( x ) IsChannelStatus( x, CH_VAR_DATA )
+#define NeedVarBlk( x ) IsChannelStatus( x, CH_NEED_VBLK )
+
+/* values for retranslate_size */
+#define CH_NO_RETRANSLATE (~(0UL)) /* no retranslate */
+#define CH_IMMEDIATE_RETRANSLATE (0UL) /* retranslate on next chunk */
+/* Added these for the 4.0 format 64 Bit flavors */
+#define CH_NO_RETRANSLATE_40 (U64_Init( CH_NO_RETRANSLATE, CH_NO_RETRANSLATE ) )
+#define CH_IMMEDIATE_RETRANSLATE_40 (U64_Init( 0L, 0L ) )
+#endif
diff --git a/private/utils/ntbackup/inc/checksum.h b/private/utils/ntbackup/inc/checksum.h
new file mode 100644
index 000000000..7c1c8cdc6
--- /dev/null
+++ b/private/utils/ntbackup/inc/checksum.h
@@ -0,0 +1,27 @@
+/*==========================================================================
+
+ checksum.h - Experimental checksum algorithm.
+
+ Don Cross, 11 December 1992.
+
+ $Log: J:/LOGFILES/CHECKSUM.H_V $
+
+ Rev 1.2 03 Mar 1993 07:41:06 MARILYN
+added version info
+
+
+==========================================================================*/
+#ifndef _CHECKSUM_H_
+#define _CHECKSUM_H_
+
+VOID Checksum_Init ( UINT32_PTR checksum_ptr );
+
+UINT32 Checksum_Block ( UINT32_PTR checksum_ptr,
+ VOID_PTR data_ptr,
+ UINT32 data_len );
+
+INT16 LP_InsertChecksumStream( UINT32 checkSum, LP_ENV_PTR lp ) ;
+INT16 LP_VerifyChecksumStream( UINT32 checksum, LP_ENV_PTR lp ) ;
+
+#endif
+/*--- end of file checksum.h ---*/
diff --git a/private/utils/ntbackup/inc/cli.h b/private/utils/ntbackup/inc/cli.h
new file mode 100644
index 000000000..4125d12c4
--- /dev/null
+++ b/private/utils/ntbackup/inc/cli.h
@@ -0,0 +1,38 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: cli.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: G:/LOGFILES/CLI.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:32:46 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _cli_h_
+#define _cli_h_
+
+
+extern BOOLEAN EnableInterrupts( VOID );
+extern BOOLEAN DisableInterrupts( VOID );
+
+#define RestoreInterruptState( interrupts_were_enabled ) if ( interrupts_were_enabled ) { \
+ EnableInterrupts(); \
+ } \
+ else { \
+ DisableInterrupts(); \
+ }
+
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/config.h b/private/utils/ntbackup/inc/config.h
new file mode 100644
index 000000000..2426702fa
--- /dev/null
+++ b/private/utils/ntbackup/inc/config.h
@@ -0,0 +1 @@
+#include "muiconf.h"
diff --git a/private/utils/ntbackup/inc/crit_err.h b/private/utils/ntbackup/inc/crit_err.h
new file mode 100644
index 000000000..ed37da0e1
--- /dev/null
+++ b/private/utils/ntbackup/inc/crit_err.h
@@ -0,0 +1,35 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: crit_err.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This header file externs the uw_critical_error
+ flag ;
+
+
+ $Log: N:/LOGFILES/CRIT_ERR.H_V $
+ *
+ * Rev 1.1 04 Jun 1991 19:14:04 BARRY
+ * Critical error stuff is now os-specific. Critical error structures
+ * and functions now reside in separate source files.
+ *
+ *
+ * Rev 1.0 09 May 1991 13:30:36 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef CRIT_ERR_H
+#define CRIT_ERR_H
+
+extern INT16 (*uw_crit_err)( CHAR_PTR name, UINT16 err_code ) ;
+extern BOOLEAN uw_critical_error ;
+
+VOID InitCritErrorHandler( BOOLEAN (*crit_err)( CHAR_PTR, UINT16 ) );
+VOID DeInitCritErrorHandler( VOID );
+
+#endif
diff --git a/private/utils/ntbackup/inc/criterr.h b/private/utils/ntbackup/inc/criterr.h
new file mode 100644
index 000000000..5ca7c5ab2
--- /dev/null
+++ b/private/utils/ntbackup/inc/criterr.h
@@ -0,0 +1,91 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: criterr.h
+
+ Description:
+
+ Location:
+
+
+ $Log: G:/UI/LOGFILES/CRITERR.H_V $
+
+ Rev 1.1 04 Oct 1992 19:46:28 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:36:24 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef CRITERR_H
+#define CRITERR_H
+
+#define IGNORE 0
+#define RETRY 1
+#define ABORT 2
+#define FAIL 3
+
+#define CRITICAL_WRITE 0
+#define CRITICAL_READ 1
+
+#define DOS_AREA 0
+#define FAT_AREA 1
+#define DIR_AREA 2
+#define DATA_AREA 3
+
+#define DISK_REC_ERROR 16
+#define DISK_UNREC_ERROR 32
+#define DISK_CRITICAL_ERROR ( DISK_REC_ERROR | DISK_UNREC_ERROR )
+#define CHAR_CRITICAL_ERROR 64
+
+#define is_disk_recoverable(x) ( x & DISK_REC_ERROR )
+#define WRITE_PROTECT_ERROR DISK_REC_ERROR + 0
+#define DRIVE_NOT_READY DISK_REC_ERROR + 1
+#define DRIVE_ERROR DISK_REC_ERROR + 2
+
+#define is_disk_unrecoverable(x) ( x & DISK_UNREC_ERROR )
+#define BAD_FAT DISK_UNREC_ERROR + 0
+#define INVALID_DRIVE DISK_UNREC_ERROR + 1
+#define INTERNAL_ERROR DISK_UNREC_ERROR + 2
+#define GENERAL_ERROR DISK_UNREC_ERROR + 3
+
+#define OUT_OF_PAPER CHAR_CRITICAL_ERROR + 1
+#define UNKNOWN CHAR_CRITICAL_ERROR + 2
+
+#define C_ERR_INPUT_TIMEOUT ( 18 * 60 * 1 )
+
+#define is_disk_error(x) ( x & DISK_CRITICAL_ERROR )
+
+/*
+
+ Function declarations
+
+ set_critical_error( disk_exc_handler, char_exc_handler )
+
+ where,
+
+ INT16 disk_exc_handler( error, drive, drive_oper, drive_region )
+ INT16 error; type of disk error
+ INT16 drive; A=0, B=1, etc...
+ INT16 drive_oper; read or write
+ INT16 drive_region; region on DISK
+
+ and,
+
+ where,
+
+ INT16 char_exc_handler( error, dev_name );
+ INT16 error; type of character error
+ CHAR far *dev_name; character device name
+
+ either entry can be NULL.
+
+*/
+
+VOID set_critical_error( INT16 ( *c_disk_err_rout ) ( ),
+ INT16 ( *c_char_err_rout ) ( ) ) ;
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/ctl3d.h b/private/utils/ntbackup/inc/ctl3d.h
new file mode 100644
index 000000000..72280c31b
--- /dev/null
+++ b/private/utils/ntbackup/inc/ctl3d.h
@@ -0,0 +1,91 @@
+/*-----------------------------------------------------------------------
+| CTL3D.DLL
+|
+| Adds 3d effects to Windows controls
+|
+| See ctl3d.doc for info
+|
+-----------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+BOOL WINAPI Ctl3dSubclassDlg(HWND, WORD);
+BOOL WINAPI Ctl3dSubclassDlgEx(HWND, DWORD);
+
+WORD WINAPI Ctl3dGetVer(void);
+BOOL WINAPI Ctl3dEnabled(void);
+
+HBRUSH WINAPI Ctl3dCtlColor(HDC, LONG); // ARCHAIC, use Ctl3dCtlColorEx
+HBRUSH WINAPI Ctl3dCtlColorEx(UINT wm, WPARAM wParam, LPARAM lParam);
+
+BOOL WINAPI Ctl3dColorChange(void);
+
+BOOL WINAPI Ctl3dSubclassCtl(HWND);
+BOOL WINAPI Ctl3dSubclassCtlEx(HWND, int);
+BOOL WINAPI Ctl3dUnsubclassCtl(HWND);
+
+LONG WINAPI Ctl3dDlgFramePaint(HWND, UINT, WPARAM, LPARAM);
+
+BOOL WINAPI Ctl3dAutoSubclass(HANDLE);
+BOOL WINAPI Ctl3dIsAutoSubclass(VOID);
+BOOL WINAPI Ctl3dUnAutoSubclass(VOID);
+
+BOOL WINAPI Ctl3dRegister(HANDLE);
+BOOL WINAPI Ctl3dUnregister(HANDLE);
+
+//begin DBCS: far east short cut key support
+VOID WINAPI Ctl3dWinIniChange(void);
+//end DBCS
+
+
+/* Ctl3d Control ID */
+#define CTL3D_BUTTON_CTL 0
+#define CTL3D_LISTBOX_CTL 1
+#define CTL3D_EDIT_CTL 2
+#define CTL3D_COMBO_CTL 3
+#define CTL3D_STATIC_CTL 4
+
+/* Ctl3dSubclassDlg3d flags */
+#define CTL3D_BUTTONS 0x0001
+#define CTL3D_LISTBOXES 0x0002
+#define CTL3D_EDITS 0x0004
+#define CTL3D_COMBOS 0x0008
+#define CTL3D_STATICTEXTS 0x0010
+#define CTL3D_STATICFRAMES 0x0020
+
+#define CTL3D_NODLGWINDOW 0x00010000
+#define CTL3D_ALL 0xffff
+
+#define WM_DLGBORDER (WM_USER+3567)
+/* WM_DLGBORDER *(int FAR *)lParam return codes */
+#define CTL3D_NOBORDER 0
+#define CTL3D_BORDER 1
+
+#define WM_DLGSUBCLASS (WM_USER+3568)
+/* WM_DLGSUBCLASS *(int FAR *)lParam return codes */
+#define CTL3D_NOSUBCLASS 0
+#define CTL3D_SUBCLASS 1
+
+#define CTLMSGOFFSET 3569
+#ifdef WIN32
+#define CTL3D_CTLCOLORMSGBOX (WM_USER+CTLMSGOFFSET)
+#define CTL3D_CTLCOLOREDIT (WM_USER+CTLMSGOFFSET+1)
+#define CTL3D_CTLCOLORLISTBOX (WM_USER+CTLMSGOFFSET+2)
+#define CTL3D_CTLCOLORBTN (WM_USER+CTLMSGOFFSET+3)
+#define CTL3D_CTLCOLORSCROLLBAR (WM_USER+CTLMSGOFFSET+4)
+#define CTL3D_CTLCOLORSTATIC (WM_USER+CTLMSGOFFSET+5)
+#define CTL3D_CTLCOLORDLG (WM_USER+CTLMSGOFFSET+6)
+#else
+#define CTL3D_CTLCOLOR (WM_USER+CTLMSGOFFSET)
+#endif
+
+
+/* Resource ID for 3dcheck.bmp (for .lib version of ctl3d) */
+#define CTL3D_3DCHECK 26567
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/private/utils/ntbackup/inc/cursors.h b/private/utils/ntbackup/inc/cursors.h
new file mode 100644
index 000000000..a0ad8d95e
--- /dev/null
+++ b/private/utils/ntbackup/inc/cursors.h
@@ -0,0 +1,38 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: cursors.h
+
+ Description: This file contains the CURSOR IDs for the Maynstream GUI
+ project.
+
+ $Log: G:/UI/LOGFILES/CURSORS.H_V $
+
+ Rev 1.2 04 Oct 1992 19:46:28 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 26 Mar 1992 08:53:08 GLENN
+Added new pen.
+
+ Rev 1.0 20 Nov 1991 19:36:04 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+// CURSOR RESOURCE IDs
+
+// Windows Internal Cursors.
+
+#define IDRC_ARROW IDC_ARROW
+#define IDRC_WAIT IDC_WAIT
+#define IDRC_IBEAM IDC_IBEAM
+
+// GUI Subsystem Cursors. -- RANGE: 21 - 30
+
+#define IDRC_PEN ID(21)
+#define IDRC_HAND ID(22)
+#define IDRC_HSLIDER ID(23)
+#define IDRC_HELP ID(24)
+#define IDRC_PEN2 ID(25)
diff --git a/private/utils/ntbackup/inc/d_o_bkup.h b/private/utils/ntbackup/inc/d_o_bkup.h
new file mode 100644
index 000000000..37a906b80
--- /dev/null
+++ b/private/utils/ntbackup/inc/d_o_bkup.h
@@ -0,0 +1,80 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: D_O_BKUP.H
+
+ Description:
+
+ $Log: G:\ui\logfiles\d_o_bkup.h_v $
+
+ Rev 1.4 25 Jun 1993 10:31:56 CARLS
+added GenerateDefaultTapeName prototype
+
+ Rev 1.3 04 Oct 1992 19:46:52 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 28 Jul 1992 14:55:10 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.1 20 Dec 1991 13:19:16 CARLS
+
+ Rev 1.0 20 Nov 1991 19:37:48 SYSTEM
+Initial revision.
+
+*****************************************************/
+#ifndef d_o_bkup_h
+#define d_o_bkup_h
+
+#ifdef OEM_EMS
+
+// Control Modes
+#define CM_HIDE 0
+#define CM_ENABLE 1
+#define CM_DISABLE 2
+
+typedef struct DLG_CTRL_ENTRY {
+ INT iCtlId;
+ HWND hCtlWnd;
+ INT iCtlDispStyle;
+} DLG_CTRL_ENTRY;
+
+typedef struct DLG_DISPLAY_ENTRY {
+ INT iDispType;
+ DLG_CTRL_ENTRY *CtlTable;
+ UINT16 ucCtrls;
+ DWORD help_id;
+
+} DLG_DISPLAY_ENTRY;
+
+typedef struct DLG_MODE {
+ WORD wModeType;
+ DLG_DISPLAY_ENTRY *DispTable;
+ UINT16 ucDispTables;
+ DLG_DISPLAY_ENTRY *pCurDisp;
+} DLG_MODE;
+
+DLG_MODE *DM_InitCtrlTables( HWND, DLG_MODE *, UINT16, WORD );
+
+VOID DM_DispShowControls( HWND, DLG_MODE *, INT );
+
+DWORD DM_ModeGetHelpId( DLG_MODE * );
+
+#endif // OEM_EMS
+
+
+BOOL DM_StartDialog( HWND, WORD, VOID_PTR ) ;
+INT DM_StartBackupSet( INT ) ;
+VOID BackupSetSave( HWND ) ;
+#ifndef OEM_EMS
+VOID BackupSetRetrieve( HWND ) ;
+#else
+VOID BackupSetRetrieve( HWND, DLG_MODE * );
+#endif
+INT BackupSetDefaultDescription( VOID ) ;
+VOID BackupSetDefaultSettings( VOID ) ;
+BSD_PTR GetBSDPointer( WORD ) ;
+VOID PropagateTapeName( VOID ) ;
+VOID PropagateTapePassword( VOID ) ;
+VOID GenerateDefaultTapeName( CHAR_PTR ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/d_o_rset.h b/private/utils/ntbackup/inc/d_o_rset.h
new file mode 100644
index 000000000..637b02e97
--- /dev/null
+++ b/private/utils/ntbackup/inc/d_o_rset.h
@@ -0,0 +1,47 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: D_O_RSET.H
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/D_O_RSET.H_V $
+
+ Rev 1.4 04 Oct 1992 19:46:54 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 28 Jul 1992 14:55:00 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.2 22 Jan 1992 16:21:46 CHUCKB
+Changed prototype for RestoreSetSave.
+
+ Rev 1.1 20 Jan 1992 09:46:10 GLENN
+Moved configuration definitions to MUICONF.H
+
+ Rev 1.0 20 Nov 1991 19:35:18 SYSTEM
+Initial revision.
+
+*****************************************************/
+#ifndef d_o_rset_h
+#define d_o_rset_h
+
+// For restore definitions, see muiconf.h
+
+BOOL RestoreSetSave( HWND ) ;
+#ifndef OEM_EMS
+VOID RestoreSetRetrieve ( HWND );
+#else
+VOID RestoreSetRetrieve( HWND, DLG_MODE * );
+#endif
+INT RestoreSetDefaultDescription( VOID ) ;
+
+BSD_PTR GetTapeBSDPointer( INT ) ;
+VOID GetCurrentRestoreDriveList( HWND ) ;
+VOID GetRestoreDrive( HWND ) ;
+VOID SetRestoreDrive( HWND ) ;
+VOID RestoreSaveTargetPaths( VOID ) ;
+VOID SetDefaultDLE( HWND ) ;
+INT GetMaxBSDCount( VOID ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/datetime.h b/private/utils/ntbackup/inc/datetime.h
new file mode 100644
index 000000000..eb9438a32
--- /dev/null
+++ b/private/utils/ntbackup/inc/datetime.h
@@ -0,0 +1,119 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: datetime.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the definition for the date_time structure.
+
+ Location: BE_PUBLIC
+
+
+ $Log: M:/LOGFILES/DATETIME.H_V $
+ *
+ * Rev 1.6 09 Jul 1993 13:26:48 JOHNES
+ * Added another display buffer #define.
+ *
+ * Rev 1.5 09 Jul 1993 11:54:34 JOHNES
+ * Added some #defines for date and time display buffer sizes.
+ *
+ *
+ * Rev 1.4 08 Jun 1993 13:59:44 MIKEP
+ * Enable C++ compile.
+ *
+ * Rev 1.3 05 Nov 1992 15:23:58 STEVEN
+ * unicode
+ *
+ * Rev 1.2 24 Jun 1991 17:08:08 STEVEN
+ * remove MBS switch
+ *
+ * Rev 1.1 21 Jun 1991 10:54:44 BILLB
+ * Removed include for mbsmac.h
+ *
+ *
+ * Rev 1.0 09 May 1991 13:31:08 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef _DATE_TIME_J
+#define _DATE_TIME_J
+/* $end$ include list */
+
+ /* Nobody seemed to know what these buffer sizes should be */
+ /* so I dropped these in. I'm not sure ho often they will */
+ /* be used though. */
+#define DISP_DATE_SIZE 9 /* xx/xx/xx(null) */
+#define DISP_TIME_HR_MIN_SIZE 6 /* hh:mm(null) */
+#define DISP_TIME_HMS_SIZE 9 /* hh:mm:ss(null) */
+#define DISP_TIME_HR_MIN_AP_SIZE 7 /* hh:mmp(null) */
+#define DISP_DATE_TIME_SIZE 16 /* xx/xx/xx hh:mmp(null) see UI_ThisDateTimetoString */
+
+
+
+/* Predefine the generic Date & Time structure used throughout */
+
+typedef struct DATE_TIME *DATE_TIME_PTR;
+typedef struct DATE_TIME {
+ UINT16 date_valid ; /* TRUE or FALSE */
+ UINT16 year ; /* year since 1900 */
+ UINT16 month ; /* 1 to 12 */
+ UINT16 day ; /* 1 to 31 */
+ UINT16 hour ; /* 0 to 23 */
+ UINT16 minute ; /* 0 to 59 */
+ UINT16 second ; /* 0 to 59 */
+ UINT16 day_of_week ; /* 1 to 7 for Sunday to Saturday */
+} DATE_TIME;
+
+VOID GetCurrentDate( DATE_TIME_PTR date_time ) ;
+
+INT32 datecmp( DATE_TIME_PTR date_time1, DATE_TIME_PTR date_time2 );
+
+VOID DOSDateTime(
+ DATE_TIME_PTR date_time, /* I - maynard date time to convert */
+ UINT16_PTR date, /* O - DOS dta date structure */
+ UINT16_PTR time ) ; /* O - DOS dta time structure */
+
+
+UINT16 ConvertDateDOS( DATE_TIME_PTR date ) ;
+
+UINT16 ConvertTimeDOS( DATE_TIME_PTR date ) ;
+
+VOID DateTimeDOS(
+ UINT16 DOS_date ,
+ UINT16 DOS_time ,
+ DATE_TIME_PTR date_time ) ;
+
+VOID StringToDateTime( CHAR_PTR date_str, CHAR_PTR time_str, DATE_TIME_PTR date_time );
+
+INT16 CompDate( DATE_TIME_PTR d1, DATE_TIME_PTR d2 ) ;
+
+
+#define DateTimeToDateString( date_time, date_str ) \
+ if ( (date_str) != NULL ) { \
+ sprintf( (date_str), TEXT("%02d/%02d/%02d"), (date_time)->month, \
+ (date_time)->day, \
+ (date_time)->year % 100 ); \
+ }
+
+#define DateTimeToTimeString( date_time, time_str ) \
+ if ( (time_str) != NULL ) { \
+ sprintf( (time_str), TEXT("%02d:%02d:%02d"), (date_time)->hour, \
+ (date_time)->minute, \
+ (date_time)->second ); \
+ }
+
+#define DateTimeToString( date_time, date_str, time_str ) \
+ { \
+ DateTimeToDateString( (date_time), (date_str) ); \
+ DateTimeToTimeString( (date_time), (time_str) ); \
+ }
+
+#define hour12( hour ) ( hour == 0 ? 12:( hour > 12 ) ? hour - 12 : hour )
+
+VOID CurrentDateTimetoString( CHAR_PTR buffer ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/dateutil.h b/private/utils/ntbackup/inc/dateutil.h
new file mode 100644
index 000000000..0af630429
--- /dev/null
+++ b/private/utils/ntbackup/inc/dateutil.h
@@ -0,0 +1,114 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: dateutil.h
+
+ Description: This is the header file for the date utilities module. These are the functions
+ contained in the "DATEUTIL" module :
+
+ DU_IsLeapYear - This routine accepts a year and determines if it is a leap year.
+
+ DU_DateTimeToTm - This routine will accept a tm structure and build the DATE_TIME structure.
+
+ DU_TmToDateTime - This routine will accept the DATE_TIME structure and build a tm structure.
+
+ DU_Time_TToDateTime - This routine takes a time_t pointer which contains a date and time
+ represented as the number of seconds passed since 00:00:00 Jan 1, 1970 (GMT),
+ and converts it to a structure of type DATE_TIME pointed to by datetime.
+
+ DU_DateTimeToTime_T - This routine takes a pointer to a structure of type DATE_TIME
+ and converts it to the number of seconds passed since 00:00:00
+ Jan 1, 1970 (GMT) and assigns that value to the time_t pointer.
+
+ DU_JulianToDateTime - This routine takes a julian date [0-365] and a year and updates
+ the DATE_TIME structure.
+
+ DU_CalcTargetDateBackwd - This routine when passed a date_time structure by reference, and the
+ number of days to go back, it will accordingly update the date_time
+ structure.
+
+ DU_CalcTargetDateFwd - This routine when passed a date_time structure by reference, and the
+ number of days to go forward, it will accordingly update the date_time
+ structure.
+
+ DU_CalcNumberDaysBackwd - This routine when passed a date_time structure by reference, will calculate the
+ number of days that date is back from the current date. It will not update the
+ date_time structure at all.
+
+ DU_CalcNumDaysFromToday - The given DATE_TIME structure is converted into a time_t value. Then the current
+ time_t is read from the system clock. This routine will then calculate the
+ difference in days between the current date and the given date.
+
+ $Log: G:/UI/LOGFILES/DATEUTIL.H_V $
+
+ Rev 1.1 04 Oct 1992 19:46:30 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:36:30 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _dateutil_h
+#define _dateutil_h
+
+#include "stdtypes.h"
+#include "datetime.h"
+#include <time.h>
+/* $end$ include list */
+
+/***** function prototypes *******/
+
+BOOLEAN DU_IsLeapYear(
+ INT16 year
+ ) ;
+
+INT16 DU_DateTimeToTm(
+ struct tm *ms_date_ptr,
+ DATE_TIME_PTR start_date
+ ) ;
+
+INT16 DU_TmToDateTime(
+ struct tm *ms_date_ptr,
+ DATE_TIME_PTR start_date
+ ) ;
+
+INT16 DU_CalcTargetDateBackwd(
+ DATE_TIME_PTR start_date,
+ INT16 days_to_go_back
+ ) ;
+
+INT16 DU_CalcTargetDateFwd(
+ DATE_TIME_PTR start_date,
+ INT16 days_to_go_fwd
+ ) ;
+
+INT16 DU_JulianToDateTime(
+ INT16 j_date,
+ INT16 year,
+ DATE_TIME_PTR dt
+ ) ;
+
+INT16 DU_Time_TToDateTime(
+ time_t *timet,
+ DATE_TIME_PTR datetime
+ ) ;
+
+INT16 DU_DateTimeToTime_T(
+ time_t *timet,
+ DATE_TIME_PTR datetime
+ ) ;
+
+INT16 DU_CalcNumDaysFromToday(
+ DATE_TIME date_time, /* I - date time to be subtracted from today's date */
+ INT16_PTR days_from_today /* O - difference in days from given date and today's date */
+ ) ;
+
+INT16 DU_CalcNumberDaysBackwd(
+ DATE_TIME_PTR input_date,
+ INT16_PTR days_back_ptr
+ ) ;
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/dblkmap.h b/private/utils/ntbackup/inc/dblkmap.h
new file mode 100644
index 000000000..8bfe97c4c
--- /dev/null
+++ b/private/utils/ntbackup/inc/dblkmap.h
@@ -0,0 +1,37 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dblkmap.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the definition for DBLK map
+
+ Location:
+
+
+ $Log: N:/LOGFILES/DBLKMAP.H_V $
+ *
+ * Rev 1.2 13 May 1992 12:01:40 STEVEN
+ * 40 format changes
+ *
+ * Rev 1.1 10 May 1991 17:08:40 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:16 GREGG
+Initial revision.
+
+**/
+#ifndef _DBLK_MAP
+#define _DBLK_MAP
+
+/* $end$ include list */
+
+typedef struct {
+ UINT16 blk_type ; /* The type of this block */
+ UINT16 blk_offset ; /* Where the block resides in the buffer */
+ UINT64 blk_data ; /* data size for block */
+} DBLKMAP, *DBLKMAP_PTR ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/dblks.h b/private/utils/ntbackup/inc/dblks.h
new file mode 100644
index 000000000..320227318
--- /dev/null
+++ b/private/utils/ntbackup/inc/dblks.h
@@ -0,0 +1,281 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dblks.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file defines the DBLK structure and contains
+ the definition of the BLOCK IDs
+
+ Location: BE_PUBLIC
+
+
+ $Log: T:/LOGFILES/DBLKS.H_V $
+ *
+ * Rev 1.22 13 Oct 1993 20:31:24 GREGG
+ * Redefined attribute bit values to match the MTF spec.
+ *
+ * Rev 1.21 03 Sep 1993 10:48:12 GREGG
+ * Set DBLK data size to 1024 and added comment about how to alloc a DBLK struct.
+ *
+ * Rev 1.20 06 Aug 1993 16:33:14 DON
+ * Added VOLB attribute defines for no_redirect_restore and non_volume
+ *
+ * Rev 1.19 15 Jul 1993 19:17:10 GREGG
+ * Added VCB attrib bits for FUTURE_VER, COMPRESSED and ENCRYPTED sets.
+ *
+ * Rev 1.18 15 Jul 1993 13:49:00 DON
+ * Added a field to the common dblk for 'name space'
+ *
+ * Rev 1.17 13 Jul 1993 19:15:12 GREGG
+ * Added 'compressed_obj' element to common DBLK.
+ *
+ * Rev 1.16 09 Jun 1993 15:37:06 MIKEP
+ * enable c++
+ *
+ * Rev 1.15 26 Apr 1993 02:43:38 GREGG
+ * Sixth in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * - Redefined attribute bits to match the spec.
+ * - Eliminated unused/undocumented bits.
+ * - Added code to translate bits on tapes that were written wrong.
+ *
+ * Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ * SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+ *
+ * Rev 1.14 11 Nov 1992 22:49:28 STEVEN
+ * This is Gregg checking files in for Steve. I don't know what he did!
+ *
+ * Rev 1.13 10 Nov 1992 08:12:30 STEVEN
+ * move os path to common part of dblk
+ *
+ * Rev 1.12 20 Oct 1992 15:00:54 STEVEN
+ * added otc stuff for qtc/otc communication
+ *
+ * Rev 1.11 09 Oct 1992 15:57:58 STEVEN
+ * added Daily backup set support
+ *
+ * Rev 1.10 23 Sep 1992 09:31:02 BARRY
+ * Removed remain_size from DBLK.
+ *
+ * Rev 1.9 21 Sep 1992 16:13:40 BARRY
+ * Added FILE_NAME_IN_STREAM attribute definition.
+ *
+ * Rev 1.8 23 Jul 1992 09:05:52 STEVEN
+ * fix warnings
+ *
+ * Rev 1.7 09 Jun 1992 16:59:32 BURT
+ * removed LBA VALID BIT per GH
+ *
+ * Rev 1.6 09 Jun 1992 14:18:40 BURT
+ * Moved some attribute bit defines
+ *
+ *
+ * Rev 1.5 22 May 1992 11:32:42 STEVEN
+ * miss-pell-ed Special
+ *
+ * Rev 1.4 21 May 1992 13:46:32 STEVEN
+ * more long path support
+ *
+ * Rev 1.3 13 May 1992 12:02:14 STEVEN
+ * 40 format changes
+ *
+ * Rev 1.2 05 May 1992 17:20:52 STEVEN
+ * added special bit
+ *
+ * Rev 1.1 12 Mar 1992 15:53:12 STEVEN
+ * 64 bit changes
+ *
+ * Rev 1.0 09 May 1991 13:30:52 HUNTER
+ * Initial revision.
+
+**/
+/* begin include list */
+
+/* $end$ include list */
+#ifndef DBLKS_H
+#define DBLKS_H
+
+/* block types */
+#define UDB_ID ((UINT8)0)
+#define VCB_ID ((UINT8)1)
+#define DDB_ID ((UINT8)8)
+#define FDB_ID ((UINT8)9)
+#define IDB_ID ((UINT8)10)
+#define CFDB_ID ((UINT8)11)
+
+/* SSET (VCB) Attributes */
+
+#define VCB_ARCHIVE_BIT BIT0 /* This is an Transfer set */
+#define VCB_COPY_SET BIT1 /* backup all do not reset modified flag */
+#define VCB_NORMAL_SET BIT2 /* backup all and reset modified flag */
+#define VCB_DIFFERENTIAL_SET BIT3 /* backup modified files and do NOT reset */
+#define VCB_INCREMENTAL_SET BIT4 /* backup modified files and reset modified flag */
+#define VCB_DAILY_SET BIT5 /* backup file modified today */
+#define VCB_OUT_OF_SEQUENCE_BIT BIT6
+#define VCB_IMAGE_BIT BIT7
+
+/* The following three bits are in the vendor specific portion the SSET
+ attribute bit field. They are used internally, and not specified in
+ the MTF document.
+*/
+
+#define VCB_FUTURE_VER_BIT BIT24
+#define VCB_COMPRESSED_BIT BIT25
+#define VCB_ENCRYPTED_BIT BIT26
+
+/* VOLB Attributes (currently only used in the MTF translator) */
+
+#define VOLB_NO_REDIRECT_RESTORE BIT0
+#define VOLB_NON_VOLUME BIT1
+
+/* DIRB (DDB) attribute defines (common to all OS's) */
+
+#define DIR_EMPTY_BIT BIT16
+#define DIR_PATH_IN_STREAM_BIT BIT17
+#define DIR_CORRUPT_BIT BIT18
+
+/* The following bit is in the vendor specific portion the DIRB attribute
+ bit field. It is used internally to indicate that the true type for the
+ DBLK is DBDB (Database DBLK), and is not specified in the MTF document.
+*/
+#define DIR_IS_REALLY_DB BIT24
+
+/* FILE (FDB) attribute defines (common to all OS's) */
+
+#define FILE_IN_USE_BIT BIT16
+#define FILE_NAME_IN_STREAM_BIT BIT17
+#define FILE_CORRUPT_BIT BIT18
+
+/* The following define is used in OUR APP ONLY instead of FILE_CORRUPT_BIT
+ and DIR_CORRUPT_BIT.
+*/
+#define OBJ_CORRUPT_BIT BIT18
+
+/* The following defines are for attribute bits in the "OS Specific"
+ portion of the DBLK attribute field. They are common to NT, SMS, UNIX
+ and Macintosh.
+
+ DO NOT USE THESE FOR DOS OS/2 or non-SMS Novell!!!
+*/
+#define OBJ_READONLY_BIT BIT8
+#define OBJ_HIDDEN_BIT BIT9
+#define OBJ_SYSTEM_BIT BIT10
+#define OBJ_MODIFIED_BIT BIT11
+
+/* DIRB (DDB) attribute bits for DOS */
+
+#define DOS_DIRB_READONLY_BIT BIT8
+#define DOS_DIRB_HIDDEN_BIT BIT9
+#define DOS_DIRB_SYSTEM_BIT BIT10
+#define DOS_DIRB_MODIFIED_BIT BIT11
+
+/* FILE (FDB) attribute bits for DOS */
+
+#define DOS_FILE_READONLY_BIT BIT0
+#define DOS_FILE_HIDDEN_BIT BIT1
+#define DOS_FILE_SYSTEM_BIT BIT2
+#define DOS_FILE_MODIFIED_BIT BIT5
+
+/* DIRB (DDB) attribute bits for OS/2 */
+
+#define OS2_DIRB_READONLY_BIT BIT8
+#define OS2_DIRB_HIDDEN_BIT BIT9
+#define OS2_DIRB_SYSTEM_BIT BIT10
+#define OS2_DIRB_MODIFIED_BIT BIT11
+
+/* FILE (FDB) attribute bits for OS/2 */
+
+#define OS2_FILE_READONLY_BIT BIT0
+#define OS2_FILE_HIDDEN_BIT BIT1
+#define OS2_FILE_SYSTEM_BIT BIT2
+#define OS2_FILE_MODIFIED_BIT BIT5
+
+/* DIRB (DDB) attribute bits for non-SMS Novell */
+
+#define NOV_DIRB_READ_ACCESS_BIT BIT0
+#define NOV_DIRB_WRITE_ACCESS_BIT BIT1
+#define NOV_DIRB_OPEN_FILE_RIGHTS_BIT BIT2
+#define NOV_DIRB_CREATE_FILE_RIGHTS_BIT BIT3
+#define NOV_DIRB_DELETE_FILE_RIGHTS_BIT BIT4
+#define NOV_DIRB_PARENTAL_RIGHTS_BIT BIT5
+#define NOV_DIRB_SEARCH_RIGHTS_BIT BIT6
+#define NOV_DIRB_MOD_FILE_ATTRIBS_BIT BIT7
+#define NOV_DIRB_READONLY_BIT BIT8
+#define NOV_DIRB_HIDEN_BIT BIT9
+#define NOV_DIRB_SYSTEM_BIT BIT10
+#define NOV_DIRB_MODIFIED_BIT BIT11
+
+/* FILE (FDB) attribute bits for non-SMS Novell */
+
+#define NOV_FILE_READONLY_BIT BIT0
+#define NOV_FILE_HIDDEN_BIT BIT1
+#define NOV_FILE_SYSTEM_BIT BIT2
+#define NOV_FILE_EXECUTE_ONLY_BIT BIT3
+#define NOV_FILE_MODIFIED_BIT BIT5
+#define NOV_FILE_SHAREABLE_BIT BIT7
+#define NOV_FILE_TRANSACTIONAL_BIT BIT12
+#define NOV_FILE_INDEXING_BIT BIT13
+
+/* CFIL (CFDB) attribute defines (common to all OS's) */
+
+#define CFDB_LENGTH_CHANGE_BIT BIT16
+#define CFDB_UNREADABLE_BLK_BIT BIT17
+#define CFDB_DEADLOCK_BIT BIT18
+
+
+typedef struct FS_NAME_Q_ELEM *FS_NAME_Q_ELEM_PTR ;
+typedef struct FS_NAME_Q_ELEM {
+ Q_ELEM q ; /* queue element structure for q-ing */
+ UINT16 alloc_size ; /* size of allocated buf -> to by path */
+ CHAR_PTR name ; /* allocated buffer and FS_Path */
+ INT16 name_size; /* length of of FS_Path in bytes */
+} FS_NAME_Q_ELEM ;
+
+typedef struct COMMON_DBLK_DATA {
+ UINT32 blkid ;
+ BOOLEAN continue_obj ;
+ BOOLEAN compressed_obj ;
+ VOID_PTR stream_ptr ; /* pointer to path stream read in */
+ UINT16 stream_offset ; /* current pointer into stream */
+ UINT16 tape_seq_num ;
+ UINT16 string_type ;
+ FS_NAME_Q_ELEM_PTR os_name ;
+ union {
+ UINT32 did ;
+ UINT32 f_mark ;
+ } f_d;
+ struct {
+ UINT32 pba ;
+ UINT32 lba ;
+ }ba;
+ UINT8 os_id ;
+ UINT8 os_ver ;
+ /* SMS is the only FS using this now */
+ UINT32 name_space; /* current name space */
+}COM_DBLK ;
+
+
+/* Note that the number of elements in the data array used to be hard coded
+ to make the structure size exactly 1024. With various compilers doing
+ different structure packing this is no longer possible, and we can't
+ make this a packed structure since a) this would cause alignment faults
+ on some machines and b) we rely on the first two elements in this
+ structure matching up with the first two elements in other structures!!!
+ As a result, I've changed the array size to a flat 1024 to avoid
+ any confusion that there is a known size for this structure. Any
+ allocation of a structure of this type or of a data space to hold this
+ structure should use "sizeof" to allocate the memory.
+*/
+typedef struct DBLK *DBLK_PTR;
+typedef struct DBLK {
+ UINT8 blk_type ;
+ COM_DBLK com ;
+ UINT8 data[1024] ;
+} DBLK;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/dddefs.h b/private/utils/ntbackup/inc/dddefs.h
new file mode 100644
index 000000000..d30ead37d
--- /dev/null
+++ b/private/utils/ntbackup/inc/dddefs.h
@@ -0,0 +1,50 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: dddefs.h
+
+ Description: Contains defines for parameters to Tp calls
+
+ $Log: T:/LOGFILES/DDDEFS.H_V $
+ *
+ * Rev 1.4 17 May 1993 19:05:42 GREGG
+ * Cleaned up the file, and added parameter defines for new function TpSpace.
+
+**/
+#ifndef _DD_DEFINES
+#define _DD_DEFINES
+
+/* For TpReadEndSet and TpSpace */
+
+// Note: The first three defines are for backward compatability with
+// TpReadEndSet. Calls to TpSpace should use the new 'SPACE_'
+// defines! TpSpace will eventually replace TpReadEndSet.
+
+#define FORWARD 0
+#define BACKWARD 1
+#define TO_EOD 2
+
+#define SPACE_FWD_FMK 0
+#define SPACE_BKWD_FMK 1
+#define SPACE_EOD 2
+#define SPACE_FWD_BLK 3
+#define SPACE_BKWD_BLK 4
+
+
+/* For TpErase */
+
+#define ERASE_TYPE_SECURITY 0
+#define ERASE_TYPE_FORMAT 1
+
+
+/* For TpSpecial: SS_CHANGE_BLOCK_SIZE */
+
+#define DEFAULT_BLOCK_SIZE 0xffffffff
+
+
+/* For TpSpecial: SS_SET_DRV_COMPRESSION */
+
+#define ENABLE_DRV_COMPRESSION 0
+#define DISABLE_DRV_COMPRESSION 1
+
+#endif
diff --git a/private/utils/ntbackup/inc/debug.h b/private/utils/ntbackup/inc/debug.h
new file mode 100644
index 000000000..1c23f0168
--- /dev/null
+++ b/private/utils/ntbackup/inc/debug.h
@@ -0,0 +1,90 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: debug.h
+
+ Description: This file contains the structures, definitions, macros,
+ and function prototypes for the Maynstream GUI
+ Debug Manager (DBM).
+
+ $Log: G:/UI/LOGFILES/DEBUG.H_V $
+
+ Rev 1.6 14 Oct 1992 15:51:16 GLENN
+Added /ZL debug logging command line support.
+
+ Rev 1.5 04 Oct 1992 19:46:32 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 30 Sep 1992 10:47:04 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.3 20 Mar 1992 14:41:26 GLENN
+Updated.
+
+ Rev 1.2 19 Mar 1992 16:32:20 MIKEP
+more lines
+
+ Rev 1.1 19 Mar 1992 09:30:48 MIKEP
+debug to file
+
+ Rev 1.0 20 Nov 1991 19:35:32 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef _debug_h_
+#define _debug_h_
+
+#define DEBUG_TEMPORARY 0x0000
+#define DEBUG_USER_INTERFACE 0x0001
+#define DEBUG_LOOPS 0x0002
+#define DEBUG_FILE_SYSTEM 0x0004
+#define DEBUG_CATALOGS 0x0008
+#define DEBUG_REMOTE_DRIVE 0x0010
+#define DEBUG_TAPE_FORMAT 0x0020
+#define DEBUG_DEVICE_DRIVER 0x0040
+#define DEBUG_TEMP_WIN_END 0x8000
+
+/* the above defines are copied in the Bengine BE_debug.h" header file */
+/* if you make a change duplicate in the other file */
+
+VOID zprintf( UINT16, ... ) ;
+VOID zvprintf( UINT16, va_list );
+
+// DEFINITIONS
+
+#define DBM_LINELENGTH 80
+#define DBM_MIN_LINES 10
+#define DBM_NUM_LINES 50
+#define DBM_MAX_LINES 250
+
+#define DBM_WINDOW 1
+#define DBM_FILE 2
+
+
+// DATA STRUCTURES
+
+typedef struct {
+
+ UCHAR szMsg[ DBM_LINELENGTH ];
+ BYTE bTag;
+ Q_ELEM pQElem;
+
+} DS_DEBUGITEM, DEBUGITEM, *PDS_DEBUGITEM, *DEBUGITEM_PTR;
+
+
+// FUCTION PROTOTYPES
+
+BOOL DBM_Init( VOID );
+BOOL DBM_Deinit( VOID );
+BOOL DBM_InsertItem( CHAR_PTR );
+BOOL DBM_Reset( WORD );
+BOOL DBM_SetDebugToFile ( BOOL );
+INT DBM_GetMsgCount( WORD );
+BOOL DBM_SetMsgCount( WORD, INT );
+
+#include "eng_dbug.h"
+
+#endif
diff --git a/private/utils/ntbackup/inc/del_sel.h b/private/utils/ntbackup/inc/del_sel.h
new file mode 100644
index 000000000..9ec70b52b
--- /dev/null
+++ b/private/utils/ntbackup/inc/del_sel.h
@@ -0,0 +1,9 @@
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SELECTDELETE 6
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_DS_LIST 0x0065
diff --git a/private/utils/ntbackup/inc/details.h b/private/utils/ntbackup/inc/details.h
new file mode 100644
index 000000000..53d0e36b0
--- /dev/null
+++ b/private/utils/ntbackup/inc/details.h
@@ -0,0 +1,173 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: details.h
+
+ Description: This file contains header information for the details.c module.
+
+
+ $Log: J:\ui\logfiles\details.h_v $
+
+ Rev 1.12 07 Feb 1994 02:06:26 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.11 15 Sep 1993 13:48:32 CARLS
+added prototype for UI_BuildFullPathFromDDB2
+
+ Rev 1.10 16 Mar 1993 16:47:46 BARRY
+Enlarged UI_MAX_FILE_DISPLAY.
+
+ Rev 1.9 01 Nov 1992 16:30:12 DAVEV
+Unicode changes
+
+ Rev 1.8 04 Oct 1992 19:46:36 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.7 27 Jul 1992 14:53:10 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.6 11 May 1992 19:44:42 STEVEN
+64bit and large path sizes
+
+ Rev 1.5 14 Feb 1992 09:29:24 MIKEP
+enlarge fields for os/2
+
+ Rev 1.4 10 Feb 1992 10:39:22 CHUCKB
+Moved prototype for BuildNumeralWithCommas from details.h to muiutil.h.
+
+ Rev 1.3 31 Jan 1992 13:01:58 GLENN
+Put UI_ReportDiagError() in hwcheck.h.
+
+ Rev 1.2 08 Jan 1992 10:41:10 CARLS
+Added define DETAIL_PRINT_ERROR_DEVIVE
+
+ Rev 1.1 23 Dec 1991 16:31:20 DAVEV
+Removed UI_DotDotDot & related routines
+
+ Rev 1.0 20 Nov 1991 19:39:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+/* $end$ include list */
+
+#ifndef _details_h_
+#define _details_h_
+
+#include "fsys.h"
+#include "tpos.h"
+#include "stats.h"
+
+
+
+/* Initialization defined types for call to UI_UnitsInit */
+#define INIT_ALL -1
+#define INIT_FSYS_BSDU ((INT16)BIT0)
+#define INIT_TFL ((INT16)BIT1)
+#define REINIT_TFL ((INT16)BIT2)
+
+/* Tape Format Initialization error help sessions */
+#define DRIVER_LOAD_FAILURE 6800
+#define REMOTE_INIT_FAILURE 6810
+#define BENGINE_IN_USE 6820
+#define UI_NO_CONTROLLERS 6830
+
+INT16 UI_UnitsInit( BE_INIT_STR_PTR, INT16 ) ;
+VOID UI_UnitsDeInit( VOID ) ;
+
+INT16 UI_TmenuUnitsInit( VOID ) ;
+VOID DefineChannel( BE_INIT_STR_PTR ) ;
+VOID open_tp_win( VOID ) ;
+VOID close_tp_win( VOID ) ;
+
+typedef enum {
+
+ UI_START,
+ UI_END
+
+} UI_TYPE ;
+
+/* display related constants */
+
+#define UI_MAX_DETAIL_LENGTH ( 256 )
+
+#define UI_MAX_TAPENAME_LENGTH ( 80 )
+#define UI_MAX_VOLUME_LENGTH ( 256 )
+#define UI_MAX_LABEL_LENGTH ( 256 )
+
+#define UI_MAX_PATH_LENGTH ( 1024 )
+#define UI_MAX_FILENAME_LENGTH ( 255 )
+
+#define UI_MAX_ATTRIBS_LENGTH ( 15 )
+#define UI_ATTRIBS_PADDING ( 12 )
+#define UI_MAX_NUMERAL_LENGTH ( 26 )
+#define UI_COMMA_SPACING ( 3 )
+#define UI_DOT_COUNT ( 5 )
+#define UI_DOT_TIME ( 9L )
+#define UI_SEARCHING_TIME ( 90L )
+#define UI_SEARCH_MSG_LENGTH ( 50 )
+#define UI_MAX_WIDE_FILE_DISPLAY ( 12 )
+#define UI_MAX_FILE_DISPLAY ( 24 )
+#define UI_TRUNCATION TEXT("...")
+
+/* Define error types for handling loops related errors */
+#define DETAIL_PRINT_ERR_ONLY 0
+#define DETAIL_PRINT_VALUE 1
+#define DETAIL_PRINT_DEVICE 2
+#define DETAIL_PRINT_ERROR_DEVICE 3
+
+extern BOOLEAN lw_search_first_time ;
+
+/* Function prototypes for common USER INTERFACE utilities */
+
+VOID UI_SetResources( VOID ) ;
+CHAR UI_AmOrPm( INT ) ;
+VOID UI_BuildFileDetail( CHAR_PTR, FSYS_HAND, DBLK_PTR, BOOLEAN ) ;
+VOID UI_BuildFileSelectLine( CHAR_PTR buffer, CHAR_PTR name, INT16 name_len, BOOLEAN dir, UINT32 attr, OBJECT_TYPE obj_type, UINT64 size, DATE_TIME *date ) ;
+VOID UI_BuildFileAttribs( CHAR_PTR buffer, UINT32 attrib, OBJECT_TYPE obj_type ) ;
+VOID UI_BuildDirAttribs( CHAR_PTR buffer, UINT32 attrib, OBJECT_TYPE obj_type ) ;
+CHAR_PTR UI_AllocPathBuffer( CHAR_PTR *buffer, UINT16 leng );
+VOID UI_FreePathBuffer( CHAR_PTR *buffer ) ;
+VOID UI_BuildDelimitedPathFromDDB( CHAR_PTR *buffer, FSYS_HAND fsh, DBLK_PTR ddb_dblk_ptr, CHAR delim, BOOLEAN OS_flag ) ;
+VOID UI_BuildFullPathFromDDB( CHAR_PTR *buffer, FSYS_HAND fsh, DBLK_PTR ddb_dblk_ptr, CHAR delim, BOOLEAN OS_flag ) ;
+VOID UI_BuildFullPathFromDDB2( CHAR_PTR *buffer, FSYS_HAND fsh, DBLK_PTR ddb_dblk_ptr, CHAR delim, BOOLEAN OS_flag ) ;
+VOID UI_BuildNumeralWithCommas( CHAR_PTR numeral ) ;
+VOID UI_BytesProcessed( STATS_PTR op_stats_ptr ) ;
+VOID UI_RateProcessed( STATS_PTR op_stats_ptr ) ;
+VOID UI_Time( STATS_PTR op_stats_ptr, INT res_id, UI_TYPE type ) ;
+VOID UI_AppendDelimiter( CHAR_PTR buffer, CHAR delim ) ;
+VOID UI_ClearLastDisplayedFile( VOID ) ;
+VOID UI_ConditionAtEnd( VOID ) ;
+VOID UI_DisplayBreakMsg( VOID ) ;
+VOID UI_ProcessErrorCode( INT16 error, INT16_PTR disposition, INT16 channel ) ;
+INT8 UI_TapeDriveCount( VOID ) ;
+VOID UI_FixPath( CHAR_PTR path_ptr, INT16 length, CHAR delim ) ;
+VOID UI_TruncateString( CHAR_PTR buffer, INT16 length, BOOLEAN replace_spaces ) ;
+BOOLEAN UI_CheckWriteProtectedDevice( UINT16 tf_message, TPOS_PTR tpos, CHAR_PTR drive_name ) ;
+CHAR_PTR UI_DisplayableTapeName( CHAR_PTR tape_name, DATE_TIME_PTR date ) ;
+VOID UI_DisplayFile( CHAR_PTR filename ) ;
+INT16 UI_MaxDirectoryLength( VOID ) ;
+INT16 UI_AttachDrive( FSYS_HAND *, GENERIC_DLE_PTR, BOOLEAN );
+CHAR_PTR UI_GetDLEDescription( GENERIC_DLE_PTR dle_ptr );
+BOOLEAN UI_GetExtendedErrorString( INT16 error, CHAR_PTR msg ) ;
+
+
+UINT16 UI_GetVCB_TPos(
+ UINT16 message,
+ TPOS_PTR tpos_ptr,
+ BOOLEAN valid_vcb_flag,
+ DBLK_PTR vcb_ptr,
+ UINT16 mode ) ;
+
+
+
+#ifdef MAYN_OS2
+VOID UI_GetTickCount( UINT32 *tick_count_ptr ) ;
+#endif
+
+
+#define MacintoshVCB( v ) ( strcmp( TEXT("MACF"), FS_ViewShortMachNameInVCB( (v) ) ) == 0 )
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/detdrive.h b/private/utils/ntbackup/inc/detdrive.h
new file mode 100644
index 000000000..74eb5be30
--- /dev/null
+++ b/private/utils/ntbackup/inc/detdrive.h
@@ -0,0 +1,34 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: detdrive.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains function prototype for DetermineDriver.
+
+ Location: BE_PUBLIC
+
+
+ $log$
+
+**/
+/* $end$ include list */
+
+#ifndef DETDRIVERFUNC
+#define DETDRIVERFUNC
+
+typedef
+ struct {
+ CHAR driver_name[9] ;
+ INT16 driver_type ;
+ } DET_DRIVER, *DET_DRIVER_PTR ;
+
+BOOLEAN DetermineDriver( DET_DRIVER_PTR, INT16 ) ;
+
+#endif
+
+
+
+
diff --git a/private/utils/ntbackup/inc/detnet.h b/private/utils/ntbackup/inc/detnet.h
new file mode 100644
index 000000000..fa295bf05
--- /dev/null
+++ b/private/utils/ntbackup/inc/detnet.h
@@ -0,0 +1,32 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: detnet.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains prototypes for determining the
+ network.
+
+
+ $Log: N:/LOGFILES/DETNET.H_V $
+ *
+ * Rev 1.1 25 Jun 1991 10:50:58 BARRY
+ * Update prototypes to reflect new config.
+ *
+ * Rev 1.0 09 May 1991 13:30:44 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#define NOVELL_ADVANCED 1
+#define NOVELL_4_6 2
+#define IBM_PC_NET 3
+
+INT16 IdentifyNet( CHAR drive, struct BE_CFG *cfg, UINT16 *version ) ;
+
+INT16 CheckNovell( CHAR drive_num, UINT16 *version ) ;
+
+INT16 CheckIBM_PC_Net( VOID ) ;
diff --git a/private/utils/ntbackup/inc/dialmang.h b/private/utils/ntbackup/inc/dialmang.h
new file mode 100644
index 000000000..d9f737c86
--- /dev/null
+++ b/private/utils/ntbackup/inc/dialmang.h
@@ -0,0 +1,481 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: DIALMANG.H
+
+ Description: This header file contains prototypes for the
+ dialog manager. This include file is used
+ by most dialogs and JOB and SCHEDULE related
+ operations.
+
+ $Log: G:\UI\LOGFILES\DIALMANG.H_V $
+
+ Rev 1.47.2.0 02 Feb 1994 11:32:42 Glenn
+Added log file browse ID and PROTOTYPE.
+
+ Rev 1.47 30 Jul 1993 15:58:02 CHUCKB
+Added prototype for DM_WaitForDevice.
+
+ Rev 1.46 14 Jul 1993 09:22:22 CARLS
+added prototypes for skipno dialog functions
+
+ Rev 1.45 13 Jul 1993 17:23:48 MARINA
+correct struct DIALOG_TABLE
+
+ Rev 1.44 22 Jun 1993 15:33:44 GLENN
+change type of handle in prototype.
+
+ Rev 1.43 09 Jun 1993 15:07:16 MIKEP
+enable c++
+
+
+ Rev 1.42 25 May 1993 14:23:36 chrish
+Prototype for DM_Abort backup/restore abort dialog window procedure.
+
+ Rev 1.41 14 May 1993 15:26:02 CARLS
+changed DM_StartSkipOpen prototype
+
+ Rev 1.40 27 Apr 1993 18:05:32 KEVINS
+Enhanced DS_SEARCH structure to include password, subdirectories, and max number of hits.
+
+ Rev 1.39 12 Mar 1993 08:41:08 CARLS
+added prototype for DM_StartFormat
+
+ Rev 1.38 10 Mar 1993 17:23:02 chrish
+Changed prototype for function DM_GetTapePswd to add another parameter
+being passed.
+
+ Rev 1.37 01 Nov 1992 16:30:26 DAVEV
+Unicode changes
+
+ Rev 1.36 07 Oct 1992 15:36:04 MIKEP
+fix nt warnings
+
+ Rev 1.35 04 Oct 1992 19:46:40 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.34 21 Sep 1992 16:51:40 DARRYLP
+Updates for WFW email.
+
+ Rev 1.33 17 Sep 1992 18:03:58 DARRYLP
+New dialog and controls for WFW email.
+
+ Rev 1.32 08 Sep 1992 13:46:10 CHUCKB
+*proc has to be in parentheses.
+
+ Rev 1.31 04 Sep 1992 18:10:34 CHUCKB
+Fixed NT warning in dialog table structure (can't just use FARPROC).
+
+ Rev 1.30 12 Aug 1992 18:24:28 STEVEN
+fix warning
+
+ Rev 1.29 28 Jul 1992 15:08:24 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.28 26 Jun 1992 15:56:36 DAVEV
+
+
+ Rev 1.27 11 Jun 1992 11:00:24 GLENN
+Removed MEMORYTRACE references.
+
+ Rev 1.26 14 May 1992 16:43:06 MIKEP
+nt pass 2
+
+ Rev 1.25 12 May 1992 21:22:56 MIKEP
+NT pass 1
+
+ Rev 1.24 07 Apr 1992 10:57:02 CHUCKB
+Moved DM_DisplayModesMatch prototype.
+
+ Rev 1.23 06 Apr 1992 10:52:06 DAVEV
+Added defines for new d_browse.c module
+
+ Rev 1.22 20 Mar 1992 14:26:50 DAVEV
+temporarly remove conditional inclusion of omhelpid.h instead of helpids.h for OEM_MSOFT
+
+ Rev 1.21 16 Mar 1992 17:04:50 DAVEV
+deleted special omdialog.h version of dialogs.h
+
+ Rev 1.20 12 Mar 1992 11:18:40 DAVEV
+include omdialog.h instead of dialogs.h for Nostradamus (does not affect Winter Park)
+
+ Rev 1.19 03 Mar 1992 17:24:20 GLENN
+Removed bogus IDS_MAXDIALOGNUMS and associated references in dialmang and d_erase.
+
+ Rev 1.18 26 Feb 1992 11:58:16 DAVEV
+Include OMHELPID.H instead of HELPIDS.H if OEM_MSOFT defined
+
+ Rev 1.17 25 Feb 1992 11:37:36 JOHNWT
+removed unneeded defines
+
+ Rev 1.16 31 Jan 1992 13:43:14 JOHNWT
+changed DM_CenterDialog proto
+
+ Rev 1.15 27 Jan 1992 00:39:38 CHUCKB
+Updated dialog id's.
+
+ Rev 1.14 24 Jan 1992 14:01:12 CHUCKB
+Put more dialogs on net.
+
+ Rev 1.13 18 Jan 1992 11:18:26 CARLS
+added DM_CenterDialog prototype
+
+ Rev 1.12 13 Jan 1992 16:49:40 CHUCKB
+Took out defines for job and schedule database file names.
+
+ Rev 1.11 09 Jan 1992 18:25:54 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.10 06 Jan 1992 11:01:46 CHUCKB
+Added include for helpids.h.
+
+ Rev 1.9 23 Dec 1991 15:47:48 GLENN
+Added Settings Options stuff
+
+ Rev 1.8 14 Dec 1991 11:15:42 CARLS
+changes for cattape.dlg
+
+ Rev 1.7 10 Dec 1991 15:41:32 CHUCKB
+Increased max dialog num.
+
+ Rev 1.6 10 Dec 1991 13:35:22 CHUCKB
+Added prototype for advanced restore.
+
+ Rev 1.5 10 Dec 1991 09:51:26 CHUCKB
+No change.
+
+ Rev 1.4 07 Dec 1991 11:51:58 CARLS
+changed prototype for DM_CatTape
+
+ Rev 1.3 06 Dec 1991 15:53:04 JOHNWT
+added DM_NextSet
+
+ Rev 1.2 04 Dec 1991 16:32:42 DAVEV
+16/32 bit Windows port changes-1st pass
+
+ Rev 1.1 02 Dec 1991 14:15:20 CHUCKB
+Changed return type of DM_DaysInMonth to INT.
+
+ Rev 1.0 20 Nov 1991 19:34:20 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef DIALMANG_H
+
+#define DIALMANG_H
+
+typedef struct tm * TIME_PTR;
+
+#include "dlg_ids.h"
+#include "datetime.h"
+
+#if defined ( OEM_MSOFT ) // Include OEM Microsoft product specific headers
+
+# include "omhelpid.h"
+
+#else // Include standard Maynstream product headers
+
+# include "helpids.h"
+
+#endif
+
+#include "dialogs.h"
+
+
+// Defines for the Dialog Manager's table of dialog callback procedures.
+
+#define MODAL 0
+#define MODELESS 1
+
+// defines for DM_ShowDialog return codes
+
+#define DM_SHOWNOTFOUND -1
+#define DM_SHOWCANCEL 0
+#define DM_SHOWOK 1
+
+
+#define DM_CATCANCEL 1
+#define DM_CATPARTIAL 2
+#define DM_CATSKIP 2
+#define DM_CATREREAD 2
+#define DM_CATREMOVE 3
+#define DM_CATPROCEED 4
+
+
+/* Defines for Database Information and Sizes */
+
+#define MAX_PATH_LEN 256
+#define MAX_NUM_SCHEDS 40
+
+/* Defines used when accessing the JOB and SCHEDULE files */
+
+#define FOPEN_ERR -1 // Also defined in jobs.h
+#define FREAD_ERR -2 // and schedule.h
+#define FWRITE_ERR -3
+#define FCLOSE_ERR -4
+
+#define JOBIO 1 // IO error types
+#define SCHEDULEIO (JOBIO+1) // for DialogOnError
+
+
+/* Defines for Timers */
+#define ID_TIMER 1
+
+/* Defines and Macros for Time Functions */
+#define MAX_TIMEBUF_LEN 80
+#define YEAR( x ) ( ( x )->tm_year )
+#define MONTH( x ) ( ( x )->tm_mon + 1 )
+#define MDAY( x ) ( ( x )->tm_mday )
+#define WDAY( x ) ( ( x )->tm_wday )
+#define HOUR( x ) ( ( x )->tm_hour )
+#define MIN( x ) ( ( x )->tm_min )
+#define SEC( x ) ( ( x )->tm_sec )
+
+/* Defines and Macros for CDS functions and Operations */
+#define SELECTION_EXTENSION TEXT("*.BKS")
+
+/* Defines for operation list, tape, job, and schedule functions */
+#define BACKUP 0
+#define ERASE 1
+#define RESTORE 2 // TENSION is defined as 5 in script.h
+#define TRANSFER 4
+#define VERIFY 3
+#define APPEND 6
+#define OVERWRITE 7
+
+// defines for short date formats
+
+#define MDY 1
+#define DMY 2
+#define YMD 3
+
+typedef struct DIALOG_TABLE *DIALOG_TABLE_PTR;
+typedef struct DIALOG_TABLE {
+
+ FARPROC proc;
+ WORD proc_num;
+ BOOL type;
+
+} DIALOG_TABLE;
+
+
+// EXTERNAL DECLARATIONS
+
+extern DIALOG_TABLE DialogCallBackTable[];
+
+
+// Defines for structures used by some dialogs.
+
+typedef struct DS_LOGIN *DS_LOGIN_PTR;
+typedef struct DS_LOGIN {
+
+ LPSTR Server_Name;
+ LPSTR User_Name;
+ INT User_Name_Len;
+ LPSTR Password;
+ INT Password_Len;
+ BOOL Ok;
+
+} DS_LOGIN ;
+
+// Defines for complex info for advanced selections (selection criteria)
+
+#define ADV_ALL 0
+#define ADV_MOD 1
+#define ADV_ACCESS 2
+#define ADV_DATES 3
+
+typedef struct DS_ADVANCED *DS_ADVANCED_PTR;
+typedef struct DS_ADVANCED {
+
+ BOOL Include; // is this an include or exclude
+ VOID_PTR vlm; // the vlm for this selection; NULL for restore
+ CHAR Path[255]; // path to select
+ CHAR File[255]; // file spec for the path
+ BOOL Subdirs; // include subdirectories or not
+ DATE_TIME BeforeDate; // to date; only select files hit before this date
+ DATE_TIME AfterDate; // from date
+ INT criteria; // all files, only modified files, LAD, or date range
+ DATE_TIME LastAccessDate; // files not accessed in this many days
+ UINT32 tape_fid; // family id of a tape to be restored from
+ INT bset_num; // backup set to be restored from; -1 for all
+
+} DS_ADVANCED;
+
+typedef struct DS_RESTORE *DS_RESTORE_PTR;
+typedef struct DS_RESTORE {
+
+ LPSTR lpszBackupSetName;
+ VOID_PTR vlpServerList;
+ VOID_PTR vlpDriveList;
+ VOID_PTR dle;
+
+} DS_RESTORE;
+
+typedef struct DS_SEARCH *DS_SEARCH_PTR;
+typedef struct DS_SEARCH {
+
+ UINT32 Tape;
+ CHAR Path[255];
+ CHAR File[255];
+ UINT16 MaxSrchResults;
+ BOOL SrchPasswProtTapes;
+ BOOL SrchSubdirs;
+
+} DS_SEARCH;
+
+
+
+typedef struct STATUSDATA
+ {
+ WORD wCode;
+ CHAR achMsg[80];
+ } STATUSDATA;
+
+/* attribute flags for DlgDirList */
+
+#define ATTR_DIRS 0xC010 /* find drives and directories */
+#define ATTR_FILES 0x0000 /* find ordinary files */
+#define PROP_FILENAME szPropertyName /* name of property for dialog */
+
+// flag to indicate a config change for the current operation only
+
+#define TEMPCHANGE (LONG)1
+
+ //defines for DM_GetBrowsePath (see d_browse.c)
+# define BROWSE_MAXPATH 1024
+# define BROWSE_MAXDRIVE 3 //drive name: 'X:' X is drive letter
+
+//
+// dialog proc prototypes
+//
+
+DLGRESULT APIENTRY DM_Abort (HWND, MSGID, MP1, MP2); // chs:05-25-93
+DLGRESULT APIENTRY DM_AboutWinter (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_AdvBackup (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_AdvSave (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_AdvUse (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_AdvRestore (HWND, MSGID, MP1, MP2);
+
+// attach to another server
+
+DLGRESULT APIENTRY DM_Attach (HWND, MSGID, MP1, MP2);
+
+// operations
+
+DLGRESULT APIENTRY DM_BackupTargetMin (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_EraseTape (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_TensionTarget (HWND, MSGID, MP1, MP2);
+
+DLGRESULT APIENTRY DM_PromptLabel (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_SearchTape (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_TapePswd (HWND, MSGID, MP1, MP2);
+
+DLGRESULT APIENTRY DM_RestoreTarget (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_VerifyTarget (HWND, MSGID, MP1, MP2);
+
+DLGRESULT APIENTRY DM_CatalogMaint (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_CatalogTape (HWND, MSGID, MP1, MP2);
+
+DLGRESULT APIENTRY DM_DeleteSelection (HWND, MSGID, MP1, MP2);
+
+DLGRESULT APIENTRY DM_BackupSet (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_RestoreSet (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_Runtime (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_Tension (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_ReenterPassword (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_SkipOpen (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_FileReplace (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_Erase (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_NextSet (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_SkipNo (HWND, MSGID, MP1, MP2);
+
+#if defined ( OEM_EMS )
+DLGRESULT APIENTRY DM_ExchgConnect (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_ExchgRecover (HWND, MSGID, MP1, MP2);
+#endif
+
+// settings
+
+DLGRESULT APIENTRY DM_OptionHardware (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_OptionRestore (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_HardwareConfig (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_OptionsBackup (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_OptionRestore (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_OptionsCatalog (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_OptionsLogging (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_OptionsNetwork (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_OptionsTransfer (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_SettingsOptions (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_SettingsDebug (HWND, MSGID, MP1, MP2);
+
+// jobs/scheduler
+
+DLGRESULT APIENTRY DM_New (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_JobOpt (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_Jobs (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_Schedule (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_SchedOpt (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_ProgManItem (HWND, MSGID, MP1, MP2);
+
+// email/windows for workgroups
+
+DLGRESULT APIENTRY DM_Email (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_EmailLogon (HWND, MSGID, MP1, MP2);
+
+// other function prototypes
+
+DLGRESULT APIENTRY DM_PWDBPassword (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY DM_WaitForDevice (HWND, MSGID, MP1, MP2);
+
+INT APIENTRY DM_BeginDialogProcess ( HWND, HANDLE, WORD, PVOID, PVOID );
+VOID DM_MakeHelpPathName ( LPSTR );
+FARPROC DM_SelectProcInstance ( HANDLE );
+PVOID DM_GetRestoreDestination ( LPSTR, VOID_PTR, PVOID );
+PVOID DM_GetVerifyDestination ( LPSTR, VOID_PTR, PVOID );
+BOOL DM_IsLeapYear ( INT );
+INT DM_DialogOnError ( INT nError, WORD wType );
+BOOL DM_IsDateValid ( INT, INT, INT, INT, INT, INT );
+VOID DM_CenterDialog ( HWND );
+
+VOID DM_DisplayModesMatch ( VOID );
+
+BOOL APIENTRY DM_IsInDlgTable ( HWND, WORD );
+INT APIENTRY DM_ShowDialog ( HWND, WORD, PVOID );
+VOID APIENTRY DM_InitDialogs ( VOID );
+
+INT DM_CatMaint ( UINT32 * );
+INT DM_CatBset ( LPSTR );
+INT DM_CatTape ( INT * );
+BOOL DM_GetTapePswd ( LPSTR, LPSTR, LPSTR, LPSTR, INT16 ); // chs:03-10-93
+
+VOID GetTimeDateString ( TIME_PTR, LPSTR, INT );
+VOID GetTimeDateStruct ( TIME_PTR );
+
+DS_SEARCH_PTR DM_GetSearchItem ( VOID );
+INT DM_DaysInMonth ( INT, INT );
+
+BOOL DM_ProceedWithErase ( VOID );
+INT DM_CountLetters ( CHAR string[], INT index );
+VOID DM_ParseShortDate ( VOID );
+VOID DM_ParseTime ( VOID );
+
+INT DM_StartSkipOpen ( CHK_OPEN TryOpen, UINT32 parm ) ;
+INT DM_StartSkipNo ( VOID );
+INT DM_StartErase ( VOID );
+INT DM_StartFormat ( VOID );
+INT DM_StartVerifyBackupSet ( VOID );
+INT DM_StartRestoreBackupSet ( VOID );
+VOID DM_StartNextSet ( VOID );
+
+BOOL DM_AttachToServer ( LPSTR, LPSTR, INT, LPSTR, INT ); // I - length of password
+
+// Prototype for displaying a 'Browse to Path' dialog based on the
+// common dialog: GetSaveFileName (see commdlg.h)
+// Use CommDlgExtendedError() to determine error condition on FALSE return
+
+BOOL DM_GetBrowsePath ( HWND, HINSTANCE, LPSTR, UINT );
+BOOL DM_BrowseForLogFilePath ( HWND, HINSTANCE, LPSTR, UINT );
+
+#endif
diff --git a/private/utils/ntbackup/inc/dialogs.h b/private/utils/ntbackup/inc/dialogs.h
new file mode 100644
index 000000000..feb8ee5f0
--- /dev/null
+++ b/private/utils/ntbackup/inc/dialogs.h
@@ -0,0 +1,363 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: dialogs.h
+
+ Description: Contains dialog control id's for most of the dialogs
+ in MaynStream for Windows ( a.k.a. Winter Park ).
+
+ $Log: G:\UI\LOGFILES\DIALOGS.H_V $
+
+ Rev 1.43.2.0 02 Feb 1994 11:32:36 Glenn
+Added log file browse ID and PROTOTYPE.
+
+ Rev 1.43 05 Aug 1993 20:41:26 CHUCKB
+Fixed define for IDD_WAITDEV_TEXT.
+
+ Rev 1.42 03 Aug 1993 21:02:10 TIMN
+Added hardware dialog id
+
+ Rev 1.41 30 Jul 1993 14:55:12 CHUCKB
+Added an id for the wait-for-drive dialog.
+
+ Rev 1.40 14 Jul 1993 09:21:42 CARLS
+added IDs for skipno dialog
+
+ Rev 1.39 29 Jun 1993 20:09:02 BARRY
+Nostradamus doesn't use abortdlg.h
+
+ Rev 1.38 29 Jun 1993 17:35:06 GLENN
+Added new style about box support.
+
+ Rev 1.37 25 May 1993 14:22:56 chrish
+Added include for new backup/restore dialog box "abortdlg.h".
+
+ Rev 1.36 15 Apr 1993 13:32:14 CLIFF
+Added stuff for the dummy device driver.
+
+ Rev 1.35 18 Feb 1993 13:36:14 BURT
+Change for Cayman
+
+
+ Rev 1.34 26 Oct 1992 10:40:02 STEVEN
+fix bugs for nt
+
+ Rev 1.33 04 Oct 1992 19:46:42 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.32 21 Sep 1992 16:52:00 DARRYLP
+Updates for WFW email.
+
+ Rev 1.31 17 Sep 1992 18:03:28 DARRYLP
+New dialog for WFW email.
+
+ Rev 1.30 19 Aug 1992 14:13:16 CHUCKB
+Added id's for new about dialog controls.
+
+ Rev 1.29 26 Jun 1992 15:56:42 DAVEV
+
+
+ Rev 1.28 09 Apr 1992 11:38:12 GLENN
+Added about box version string ID.
+
+ Rev 1.27 06 Apr 1992 04:34:02 CHUCKB
+Added another include.
+
+ Rev 1.26 06 Apr 1992 04:23:38 CHUCKB
+Added some include files.
+
+ Rev 1.25 06 Apr 1992 04:22:04 CHUCKB
+Fixed some control ids for 3 dialogs.
+
+ Rev 1.24 06 Apr 1992 10:56:48 DAVEV
+added defines for 'Browse to Path' dialog
+
+ Rev 1.23 18 Mar 1992 14:32:46 DAVEV
+Updates for OEM_MSOFT version of dialog
+
+ Rev 1.22 24 Feb 1992 09:36:56 ROBG
+Deleted printlog.h
+
+ Rev 1.21 31 Jan 1992 12:44:10 CHUCKB
+Moved attach-to-server id's to srvlogin.h
+
+ Rev 1.20 30 Jan 1992 16:30:28 GLENN
+Moved the skip/wait on open file stuff to muiconf.c
+
+ Rev 1.19 28 Jan 1992 09:56:28 CARLS
+removed the defines for Tension dialog
+
+ Rev 1.18 27 Jan 1992 12:51:00 GLENN
+Fixed dialog IDs.
+
+ Rev 1.17 27 Jan 1992 00:41:52 CHUCKB
+Updated dialog id's.
+
+ Rev 1.16 25 Jan 1992 21:29:24 CHUCKB
+Fixed some defines.
+
+ Rev 1.15 24 Jan 1992 14:00:54 CHUCKB
+Put more dialogs on net.
+
+ Rev 1.14 10 Jan 1992 11:04:02 CHUCKB
+No change.
+
+ Rev 1.13 09 Jan 1992 14:53:26 JOHNWT
+added confirm new dbpw equates
+
+ Rev 1.12 06 Jan 1992 13:48:28 JOHNWT
+added id for new pw text
+
+ Rev 1.11 23 Dec 1991 15:37:06 GLENN
+Added Settings Options stuff
+
+ Rev 1.10 19 Dec 1991 13:35:22 CHUCKB
+Added new id's for debug settings dialog.
+
+ Rev 1.9 17 Dec 1991 17:39:36 CHUCKB
+Added ids for new backup settings controls.
+
+ Rev 1.8 14 Dec 1991 13:49:34 JOHNWT
+new network settings dialog
+
+ Rev 1.7 13 Dec 1991 16:14:00 JOHNWT
+added defines for loginpw.dlg
+
+ Rev 1.6 10 Dec 1991 13:39:48 CHUCKB
+Added template id for lanstream tape password dialog.
+
+ Rev 1.5 08 Dec 1991 18:48:44 JOHNWT
+changed next set cancel to abort
+
+ Rev 1.4 07 Dec 1991 12:19:26 CARLS
+
+ Rev 1.3 06 Dec 1991 15:53:52 JOHNWT
+added defines for DM_NextSet
+
+ Rev 1.2 05 Dec 1991 16:20:54 CARLS
+changed value of skip open files defines
+
+ Rev 1.1 04 Dec 1991 17:08:12 CHUCKB
+Added new id's for int'l stuff.
+
+ Rev 1.0 20 Nov 1991 19:38:36 SYSTEM
+Initial revision.
+
+*****************************************************/
+
+#ifndef dialogs_h
+#define dialogs_h
+
+#include <dlgs.h> //common dialog ids used by DM_GetBrowsePath dialog
+
+// UNIVERSAL DEFINITIONS FOR ALL DIALOGS
+
+#include "add_icon.h"
+#include "adv_rest.h"
+#include "adv_sel.h"
+#include "adv_serv.h"
+#include "catmaint.h"
+#include "del_sel.h"
+
+#ifdef WFW
+#ifndef OEM_MSOFT
+# include "email.h"
+# include "emllogon.h"
+#endif
+#endif
+
+#include "hwdlg.h"
+
+#include "jobsetup.h"
+#include "job_new.h"
+#include "job_opts.h"
+#include "loginpw.h"
+#include "ltappswd.h"
+#include "msgboxid.h"
+#include "network.h"
+#include "nextset.h"
+#include "save_sel.h"
+#include "sched.h"
+#include "sch_opts.h"
+#include "tsearch.h"
+#include "setback.h"
+#include "set_cat.h"
+#include "set_dbug.h"
+#include "set_log.h"
+#include "set_opts.h"
+#include "set_prt.h"
+#include "set_rest.h"
+#include "srvlogin.h"
+#include "tapepswd.h"
+#include "tension.h"
+#include "use_sel.h"
+
+#define IDD_FILEOPEN ID(290)
+#define IDD_FILENAME 291
+#define IDD_FILES 292
+#define IDD_PATH 293
+#define IDD_DIRS 294
+
+#define IDD_ABOUT ID(300)
+#define IDD_ABOUT_VERSION 301
+#define IDD_ABOUT_RES_STR 302
+#define IDD_ABOUT_RES_SIZ 303
+#define IDD_ABOUT_MEM_STR 304
+#define IDD_ABOUT_MEM_SIZ 305
+#define IDD_ABOUT_MODE_STR 306
+
+#define IDD_ABOUTAPPNAME 301
+#define IDD_ABOUTVERSION 302
+#define IDD_ABOUTOTHERSTUFF 303
+#define IDD_ABOUTUSERNAME 304
+#define IDD_ABOUTCOMPANYNAME 305
+#define IDD_ABOUTSERIALNUM 306
+#define IDD_ABOUTMEMTITLE 307
+#define IDD_ABOUTMEMORY 308
+#define IDD_ABOUTPROCESSORTITLE 309
+#define IDD_ABOUTPROCESSOR 310
+#define IDD_ABOUTICON 311
+#define IDD_ABOUTIDENTTITLE 312
+#define IDD_ABOUTIDENT 313
+#define IDD_ABOUTPRODID 314
+
+#define IDD_FIND ID(400)
+#define IDD_SEARCH 401
+#define IDD_PREV 402
+#define IDD_NEXT IDOK
+#define IDD_CASE 403
+
+#define IDD_SAVEAS ID(500)
+#define IDD_SAVEFROM 501
+#define IDD_SAVETO 502
+
+#define IDD_PRINT ID(600)
+#define IDD_PRINTDEVICE 601
+#define IDD_PRINTPORT 602
+#define IDD_PRINTTITLE 603
+
+#define IDD_FONT ID(700)
+#define IDD_FACES 701
+#define IDD_SIZES 702
+#define IDD_BOLD 703
+#define IDD_ITALIC 704
+#define IDD_FONTTITLE 705
+
+
+/* attribute flags for DlgDirList */ // -- WHY THE HECK IS THIS STUFF HERE?????
+
+#define ATTR_DIRS 0xC010 /* find drives and directories */
+#define ATTR_FILES 0x0000 /* find ordinary files */
+#define PROP_FILENAME szPropertyName /* name of property for dialog */
+
+/* backup/restore/verify target; also Hardware dialog */
+
+#define IDD_DRIVELIST 121
+#define IDD_BSETNAME 122
+#define IDD_CURDRIVE 123
+#define IDD_DEFDRIVE 124
+
+/* restore control */
+
+#define IDD_RAUTOV 105
+
+/* erase operation controls */
+
+#define IDD_TAPENAME 110
+#define IDD_SETSONTAPE 111
+#define IDD_SECERASE 112
+#define IDD_PLABEL 113
+
+/* printer setup */
+
+#define IDD_PRSETUP 107
+
+/* search */
+
+#define IDD_FS_HELP 101
+#define IDD_FS_DIR 102
+#define IDD_FS_TEXT1 103
+#define IDD_FS_TEXT2 104
+#define IDD_FS_FILE 105
+#define IDD_FS_ENTIREDISK 106
+#define IDD_FS_ALLDISKS 107
+#define IDD_FS_ALLTAPES 108
+
+#define IDD_BEFORE_UP 300
+#define IDD_BEFORE_DOWN 302
+#define IDD_AFTER_UP 301
+#define IDD_AFTER_DOWN 303
+#define IDD_NUMDAYS_UP 304
+#define IDD_NUMDAYS_DOWN 305
+
+/* local to the callback table */
+
+#define IDD_TAPELABEL 105
+
+/* reenter password dialog */
+
+#define IDD_PASSWORD_OK 102
+#define IDD_PASSWORD_EDIT 103
+
+/* skipno dialog */
+
+#define IDD_SKIPNO_TEXT 101
+#define IDD_SKIPNO_YES 110
+#define IDD_SKIPNO_ALL 112
+#define IDD_SKIPNO_NO 111
+#define IDD_SKIPNO_CANCEL 114
+#define IDD_SKIPNO_BITMAP 120
+
+/* job/scheduler controls */
+
+#include "jobs.h"
+
+/* backup set dialog */
+#ifdef OEM_MSOFT
+# include "ombkup.h"
+#else
+# include "bkup.h"
+#endif
+
+#include "omxchng.h"
+
+/* runtime dialog */
+
+#include "rt_dlg.h"
+
+/* restore target dialog */
+
+#if defined ( OEM_MSOFT )
+# include "omrset.h"
+#else
+# include "rset.h"
+#endif
+#include "skipopen.h"
+#include "freplace.h"
+#include "erase.h"
+#include "cattape.h"
+#if !defined( OEM_MSOFT)
+#include "abortdlg.h" // chs:05-25-93
+#endif
+
+/* message box defines for msgbox dialog box */
+
+#define IDD_MESSAGE_BOX 280
+
+/* Browse to Path dialog id - Note: this dialog is NOT placed int the */
+/* Dialog Manager table! This dialog is used as a replacement */
+/* to the COMMDLG GetSaveFileName dialog. */
+
+#define IDD_BROWSE ID(800) //an unused dialog id
+#define IDD_LOGFILEBROWSE ID(801) //an unused dialog id
+
+#define IDD_WAITDEV_TEXT 850
+
+/* Dummy device driver dialog */
+
+#ifdef DUMMY_DD
+#include "ddd_dlg.h"
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/inc/dil.h b/private/utils/ntbackup/inc/dil.h
new file mode 100644
index 000000000..4da0898a9
--- /dev/null
+++ b/private/utils/ntbackup/inc/dil.h
@@ -0,0 +1,94 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dil.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the function prototypes for the Device Independent
+ Layer ( DIL ).
+
+ Location: BE_PRIVATE
+
+
+ $Log: T:\logfiles\dil.h_v $
+ *
+ * Rev 1.8 28 Jan 1994 18:25:28 GREGG
+ * Fixed MIPS 16 byte alignment requirement bug.
+ *
+ * Rev 1.7 07 Jan 1994 14:46:40 CLIFF
+ * Added DDD_ChangeTape prototype.
+ *
+ * Rev 1.6 17 May 1993 19:04:50 GREGG
+ * Added prototype for new function TpSpace.
+ *
+ * Rev 1.5 21 Jan 1993 14:56:26 GREGG
+ * Added 'erase type' parameter to TpErase prototype.
+ *
+ * Rev 1.4 25 Aug 1992 13:03:48 NED
+ * Changed dil.h to declare all Tpxxx() calls as TP_TYPE,
+ * which is _far _pascal under OS2, nothing otherwise.
+ * Included dil.h in dil.c for OS/2 as well.
+ * Ansified function definitions.
+ * Changed MAYN_xxx to OS_xxx definitions, checked for usage in dil.h
+ * Now, calls from the application to the loaddrv.c layer are _far _pascal,
+ * as well as the calls from the app to the DLL.
+
+**/
+#ifndef PICKLES
+#define PICKLES
+
+/* paranoia... */
+#if defined( MAYN_WIN ) && !defined( OS_WIN )
+ #error Change your MAYN_WIN define to OS_WIN (or add OS_WIN)!
+#elif defined( MAYN_OS2 ) && !defined( OS_OS2 )
+ #error Change your MAYN_OS2 define to OS_OS2 (or add OS_OS2)!
+#elif defined( MAYN_NLM ) && !defined( OS_NLM )
+ #error Change your MAYN_NLM define to OS_NLM (or add OS_NLM)!
+#endif
+
+#if !defined(TP_TYPE) /* allow override of TP_TYPE */
+ #if defined(OS_OS2)
+ #define TP_TYPE _far _pascal
+ #else
+ /* default to cdecl or whatever */
+ #define TP_TYPE
+ #endif
+#endif
+
+BOOLEAN TP_TYPE TpInit( DIL_HWD_PTR, INT16 ) ;
+BOOLEAN TP_TYPE TpAuto( DIL_HWD_PTR, INT16 ) ;
+VOID TP_TYPE TpRelease( void ) ;
+BOOLEAN TP_TYPE TpReset( INT16 ) ;
+INT16 TP_TYPE TpOpen( DIL_HWD_PTR, INT16 ) ;
+BOOLEAN TP_TYPE TpClose( INT16 ) ;
+BOOLEAN TP_TYPE TpCloseRewind( INT16 ) ;
+BOOLEAN TP_TYPE TpWrite( INT16, UINT8_PTR, UINT32 ) ;
+BOOLEAN TP_TYPE TpRead( INT16, UINT8_PTR, UINT32 ) ;
+BOOLEAN TP_TYPE TpRewind( INT16, BOOLEAN ) ;
+BOOLEAN TP_TYPE TpEject( INT16 ) ;
+BOOLEAN TP_TYPE TpErase( INT16, INT16 ) ;
+BOOLEAN TP_TYPE TpRetension( INT16 ) ;
+BOOLEAN TP_TYPE TpWriteEndSet( INT16 ) ;
+
+// TpSpace is a super set of TpReadEndSet, and will eventually replace
+// it completely.
+
+BOOLEAN TP_TYPE TpReadEndSet( INT16, INT16, INT16 ) ;
+BOOLEAN TP_TYPE TpSpace( INT16, INT16, INT16 ) ;
+
+BOOLEAN TP_TYPE TpReceive( INT16, RET_BUF_PTR ) ;
+BOOLEAN TP_TYPE TpSpecial( INT16, INT16, UINT32 ) ;
+BOOLEAN TP_TYPE TpStatus( INT16 ) ;
+BOOLEAN TP_TYPE TpSeek( INT16, UINT32, BOOLEAN ) ;
+BOOLEAN TP_TYPE TpGetPosition( INT16, BOOLEAN ) ;
+BOOLEAN TP_TYPE TpDismount( INT16 ) ;
+BOOLEAN TP_TYPE TpMount( INT16 ) ;
+BOOLEAN TP_TYPE TpLock( INT8_PTR, INT32_PTR ) ;
+BOOLEAN TP_TYPE TpUnlock( INT32_PTR ) ;
+BOOLEAN TP_TYPE TpGetTapeBuffAlignment( INT_PTR ) ;
+BOOLEAN TP_TYPE DDD_ChangeTape( INT16, INT16, INT16 ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/dilhwd.h b/private/utils/ntbackup/inc/dilhwd.h
new file mode 100644
index 000000000..a5ddb657c
--- /dev/null
+++ b/private/utils/ntbackup/inc/dilhwd.h
@@ -0,0 +1,55 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ndilhwd.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the Generic Hardware description Structure.
+
+ Location: BE_PUBLIC
+
+
+ $log$
+
+**/
+/* $end$ include list */
+
+#ifndef DILHWD
+
+#define DILHWD
+
+typedef struct DIL_HWD {
+ CHAR driver_label[25] ; /* Contains the text description */
+ UINT16 no_attached_drives ; /* The Number of Maynard Drives Attached to this Card */
+ UINT16 card_attribs ; /* The attributes for this card .. defined below */
+ UINT16 init_error ; /* Error Type on Init */
+ UINT32 parameters[20] ; /* Parameter array */
+} DIL_HWD, *DIL_HWD_PTR ;
+
+/* The Possible initialization errors */
+
+#define DD_INIT_ERR_NO_DRIVES 0x01
+#define DD_INIT_ERR_IRQ_CONFLICT 0x02
+#define DD_INIT_ERR_DMA_CONFLICT 0x03
+#define DD_INIT_ERR_NO_CARD_DETECTED 0x04
+#define DD_INIT_ERR_SCCB_POOL 0x05
+#define DD_INIT_ERR_SCBD 0x06 /* SCBD access failure (driver ".sys" probably not installed) */
+#define DD_INIT_ERR_NO_ASPI_MANAGER 0x07
+#define DD_INIT_ERR_NOT_ASPI_DEVICE 0x08
+#define DD_INIT_ERR_MEMALLOC_FAILED 0x09
+#define DD_INIT_ERR_CARD_ALREADY_INIT 0x0A /* dil_hwd/card/device already initialized */
+#define DD_INIT_ERR_INVALID_PARAMETER 0x0B /* invalid value(s) in dil_hwd.parameter[] */
+#define DD_INIT_ERR_INVALID_BASEADDR 0x0C /* invalid base address value in dil_hwd.parameter[] */
+#define DD_INIT_ERR_INVALID_IRQ 0x0D /* invalid IRQ channel value in dil_hwd.parameter[] */
+#define DD_INIT_ERR_INVALID_DMA 0x0E /* invalid DMA channel value in dil_hwd.parameter[] */
+
+#define DD_INIT_ERR_NO_SYS_DETECTED 0x31
+#define DD_INIT_ERR_TCB_ALLOCATION 0x32
+
+/* Card Attributes */
+
+#define DD_CARD_NON_ASYNC 0x01
+
+#endif
diff --git a/private/utils/ntbackup/inc/dilntprv.h b/private/utils/ntbackup/inc/dilntprv.h
new file mode 100644
index 000000000..503a7d2dc
--- /dev/null
+++ b/private/utils/ntbackup/inc/dilntprv.h
@@ -0,0 +1,41 @@
+/**
+Copyright(c) Conner Software Products Group 1993
+
+ Name: dilntprv.h
+
+ Description: Contains defines types and prototypes shared by dilntmsc.c
+ and dilnttp.c.
+
+ $Log: T:/LOGFILES/DILNTPRV.H_V $
+
+ Rev 1.0 17 May 1993 16:49:58 GREGG
+DILNTTP.C, DILNTMSC.C and DILNTPRV.H replace DIL_NT.C at rev. 1.44.
+
+**/
+
+#define NUM_TCBS 30
+#define SIGNALEDSTATE 0x00000000
+
+//
+// Defines for terminating the thread process
+//
+#define FOREVER_FOREVER 1
+#define FOREVER_STOP 2
+
+
+// use as semaphore wait timeout values
+#define WAITFOREVER 0xffffffff
+#define NOWAIT 0x1
+
+typedef struct {
+ Q_ELEM q_stuff ;
+ MSL_REQUEST dil_request ;
+ RET_BUF ret_stuff ;
+} FAKE_TCB, *FAKE_TCB_PTR ;
+
+BOOLEAN CreateCQueue( Q_HEADER_PTR queue, Q_HEADER_PTR outqueue ) ;
+HANDLE CreateAThread( VOID ) ;
+BOOLEAN CEnqueue( Q_HEADER_PTR queue, Q_HEADER_PTR outqueue, FAKE_TCB tmpTCB ) ;
+BOOLEAN COutDequeue( Q_HEADER_PTR outqueue, Q_HEADER_PTR inqueue ) ;
+
+
diff --git a/private/utils/ntbackup/inc/dle.h b/private/utils/ntbackup/inc/dle.h
new file mode 100644
index 000000000..e863de56f
--- /dev/null
+++ b/private/utils/ntbackup/inc/dle.h
@@ -0,0 +1,286 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dle.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This header file provides declarations
+ need to access the FSU for DLE specific functions.
+
+ Location: BE_PUBLIC
+
+
+ $Log: M:/LOGFILES/DLE.H_V $
+ *
+ * Rev 1.26 03 Aug 1993 16:29:18 JOHNES
+ * Added DLE_GetAttachCount macro.
+ *
+ * Rev 1.25 19 Jul 1993 10:25:44 BARRY
+ * Added macro to get the list in which a DLE is contained.
+ *
+ * Rev 1.24 17 Jun 1993 11:38:40 ChuckS
+ * Added DLE_IsNonVolume macro.
+ *
+ * Rev 1.23 14 Jun 1993 18:09:36 BARRY
+ * Fixed error in change to FS_PromptForBindery macro.
+ *
+ * Rev 1.22 11 Jun 1993 14:18:50 BARRY
+ * Changed prompt FS_PromptForBindery to use new special files definitions.
+ *
+ * Rev 1.21 04 Jun 1993 17:35:58 ChuckS
+ * P_CLIENT & OS_DOS only: Added prototype for functional form of
+ * DLE_GetDefaultDrive.
+ *
+ * Rev 1.20 22 Apr 1993 10:12:04 BILLB
+ * Added support for GRFS Device subtypes
+ *
+ * Rev 1.19 18 Mar 1993 15:20:22 ChuckS
+ * Changes for Generic Device Names for VOLB
+ *
+ * Rev 1.18 16 Dec 1992 11:50:44 DON
+ * Changed file system specific Server/Volume macros into functions - dleget.c
+ *
+ * Rev 1.17 09 Dec 1992 11:40:48 DON
+ * Changed function prototype to macro for DLE_
+ *
+ * Rev 1.16 11 Nov 1992 22:09:44 GREGG
+ * Unicodeized literals.
+ *
+ * Rev 1.15 21 Jul 1992 14:04:20 STEVEN
+ * added support for DLE_GetUserName
+ *
+ * Rev 1.14 28 May 1992 09:44:12 BARRY
+ * Move changes on branches back to tip.
+ *
+ * Rev 1.14 28 May 1992 09:43:56 BARRY
+ * Move changes on branches back to tip.
+ *
+ * Rev 1.13 21 May 1992 13:46:54 STEVEN
+ * more long path support
+ *
+ * Rev 1.12 28 Feb 1992 14:42:58 STEVEN
+ * fix bug with display name
+ *
+ * Rev 1.11 13 Feb 1992 11:37:38 STEVEN
+ * fix support stuff
+ *
+ * Rev 1.10 20 Dec 1991 09:31:12 STEVEN
+ * move common files to tables
+ *
+ * Rev 1.9 31 Oct 1991 16:25:42 BARRY
+ * TRICYCLE: Added a DLE features macro and converted SupportChild()
+ * to use this macro.
+ *
+ * Rev 1.8 01 Oct 1991 12:58:18 BARRY
+ * Tag BE_CFG_PTRs passed to DLE functions.
+ *
+ * Rev 1.7 08 Aug 1991 19:09:22 DON
+ * added support for NLM_SERVER_ONLY to DLE_SupportChild macro
+ *
+ * Rev 1.5 30 Jul 1991 10:19:20 DON
+ * ifdef'd macros for accessing info.server/info.nlm_server data
+ *
+ * Rev 1.4 21 Jun 1991 13:23:16 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.3 18 Jun 1991 13:50:32 STEVEN
+ * DEFINE MBS_DEV_TYPE
+ *
+ * Rev 1.2 30 May 1991 13:51:44 BARRY
+ * No longer have selector to DLE_UpdateList().
+ *
+ * Rev 1.1 20 May 1991 16:42:16 STEVEN
+ * queues.h should be in quotes
+ *
+ * Rev 1.0 09 May 1991 13:31:10 HUNTER
+ * Initial revision.
+
+**/
+#ifndef DLE_H
+#define DLE_H 1
+#include "queues.h"
+#include "beconfig.h"
+#include "dle_str.h"
+/* $end$ include list */
+
+/**
+ Defines for DLE parameters
+**/
+
+/* DLE_DeviceDispName() - type */
+#define DISP_LONG_DEV_NAME 0
+#define DISP_SHORT_DEV_NAME 1
+#define MBS_DEV_NAME 2
+#define GEN_LONG_DEV_NAME 3
+
+
+/**
+ Macros used to access the DLE
+**/
+
+#define DLE_DeviceDispName( dle, dev_name, size, disp_type ) \
+ (msassert ( func_tab[ (dle)->type ].DevDispName != NULL),\
+ (func_tab [(dle)->type].DevDispName( dle, dev_name, size, disp_type ) ) )
+
+#define DLE_DeviceName( dle, dev_name, size ) \
+ DLE_DeviceDispName( dle, dev_name, size, GEN_LONG_DEV_NAME )
+
+#define DLE_GetVolName( dle, buffer ) \
+ (msassert ( func_tab[ (dle)->type ].GetVolName != NULL),\
+ (func_tab [(dle)->type].GetVolName( dle, buffer ) ) )
+
+#define DLE_SizeofVolName( dle ) \
+ (msassert ( func_tab[ (dle)->type ].SizeofVolName != NULL),\
+ (func_tab [(dle)->type].SizeofVolName( dle ) ) )
+
+#define DLE_SizeofDevName( dle ) \
+ (msassert( func_tab[ (dle)->type ].SizeofDevName != NULL ), \
+ (func_tab[ (dle)->type ].SizeofDevName( dle ) ) )
+
+#define DLE_ViewUserName( dle ) \
+ ((dle)->user_name)
+
+#define DLE_SizeofUserName( dle ) \
+ ((dle)->user_name_leng)
+
+#define FS_MakePath( buf, bsize, dle, path, psize, fname ) \
+ (msassert ( func_tab[ (dle)->type ].MakePath != NULL),\
+ (func_tab [(dle)->type].MakePath( buf, bsize, dle, path, psize, fname ) ) )
+
+#if defined( P_CLIENT ) && defined( OS_DOS )
+
+GENERIC_DLE_PTR DLE_GetDefaultDrive( DLE_HAND hand ) ;
+
+#else
+
+#define DLE_GetDefaultDrive( hand ) \
+ ((hand)->default_drv)
+#endif
+
+#define DLE_GetOsId( dle ) \
+ ((dle)->os_id)
+
+
+#define DLE_SetDefaultDrive( hand, dle ) \
+ ((hand)->default_drv = (dle))
+
+#define DLE_GetDeviceType( dle ) \
+ ((dle)->type & (~HAND_MADE_MASK))
+
+#define DLE_GetDeviceSubType( dle ) \
+ ((dle)->subtype)
+
+#define DLE_GetDeviceName( dle ) \
+ ( (dle)->device_name)
+
+#define DLE_GetDeviceNameLeng( dle ) \
+ ( (dle)->device_name_leng)
+
+#define DLE_GetPathDelim( dle ) \
+ ( (dle)->path_delim)
+
+#define DLE_GetHandle( dle ) \
+ ( (dle)->handle )
+
+#define DLE_GetParent( dle ) \
+ ( (dle)->parent )
+
+#define DLE_PswdRequired( dle ) \
+ ( (dle)->pswd_required)
+
+#define DLE_PswdSaved( dle ) \
+ ( (dle)->pswd_saved)
+
+#define DLE_UserRequired( dle ) \
+ ( (dle)->name_required)
+
+#define DLE_UserSaved( dle ) \
+ ( (dle)->name_saved)
+
+#define DLE_DriveWriteable( dle ) \
+ ( (dle)->dle_writeable)
+
+#define DLE_GetNumChild( dle ) \
+ (QueueCount( &(dle)->child_q ) )
+
+#define DLE_HasFeatures( dle, mask ) \
+ ( ( ((dle)->feature_bits & (mask)) == (mask) ? TRUE : FALSE ) )
+
+#define DLE_SupportChild( dle ) \
+ ( DLE_HasFeatures( (dle), DLE_FEAT_SUPPORTS_CHILDREN ) )
+
+#define DLE_SupportAccessDate( dle ) \
+ ( DLE_HasFeatures( (dle), DLE_FEAT_ACCESS_DATE ) )
+
+#define DLE_IsNonVolume( dle ) \
+ ( DLE_HasFeatures( dle, DLE_FEAT_NON_VOLUME_OBJECT ) )
+
+#define FS_PromptForBindery( dle ) \
+ ( DLE_HasFeatures( (dle), DLE_FEAT_BKUP_SPECIAL_FILES ) || \
+ DLE_HasFeatures( (dle), DLE_FEAT_REST_SPECIAL_FILES ))
+
+
+#define FS_PromptForSecure( dle ) \
+ ( DLE_HasFeatures( (dle), DLE_FEAT_DATA_SECURITY ) )
+
+#define DLE_IncBSDCount( dle ) \
+ ( (dle)->bsd_use_count++ )
+
+#define DLE_DecBSDCount( dle ) \
+ ( (dle)->bsd_use_count-- )
+
+#define DLE_IsImageDOS( dle ) \
+ ( ((dle)->type == LOCAL_IMAGE) && ((dle)->info.image->drive_char != TEXT('\0') ) )
+
+#define DLE_GetImageDriveNum( dle ) \
+ ((dle)->info.image->drive_num & 0x7f )
+
+#define DLE_GetImagePartNum( dle ) \
+ ((dle)->info.image->partition )
+
+#define DLE_IsTemporary( dle ) \
+ ( (dle)->type & HAND_MADE_MASK )
+
+#define DLE_GetAttachCount( dle ) \
+ ( (dle)->attach_count )
+
+
+/**
+ DLE support functions
+**/
+INT16 DLE_ResetList( DLE_HAND hand );
+
+INT16 DLE_Remove( DLE_HAND hand, GENERIC_DLE_PTR dle ) ;
+
+INT16 DLE_GetFirst( DLE_HAND hand, GENERIC_DLE_PTR *dle );
+
+INT16 DLE_GetFirstChild( GENERIC_DLE_PTR server_dle, GENERIC_DLE_PTR *dle ) ;
+
+INT16 DLE_GetNext( GENERIC_DLE_PTR *dle ) ;
+
+INT16 DLE_GetPrev( GENERIC_DLE_PTR *dle ) ;
+
+INT16 DLE_FindByName( DLE_HAND hand, CHAR_PTR name, INT16 type, GENERIC_DLE_PTR *dle ) ;
+
+INT16 DLE_OSVerToType( UINT8 os_id, UINT8 os_ver ) ;
+
+INT16 DLE_UpdateList( DLE_HAND dle_hand, BE_CFG_PTR cfg ) ;
+
+INT16 DLE_DeleteList( DLE_HAND dle_hand, BE_CFG_PTR cfg, UINT16 dle_selector ) ;
+
+VOID DLE_SetPartName( DLE_HAND dle_hand, UINT16 drive_num, UINT16 part_num, CHAR_PTR name ) ;
+
+INT16 FS_AddTempDLE( DLE_HAND dle_hand, CHAR_PTR name, CHAR_PTR vol_name, INT16 type ) ;
+
+INT16 DLE_ServerLoggedIn( GENERIC_DLE_PTR server_dle ) ;
+
+CHAR_PTR DLE_GetServerPswd( GENERIC_DLE_PTR server_dle ) ;
+
+CHAR_PTR DLE_GetServerUserName( GENERIC_DLE_PTR server_dle ) ;
+
+UINT8 DLE_GetServerNum( GENERIC_DLE_PTR server_dle ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/dle_str.h b/private/utils/ntbackup/inc/dle_str.h
new file mode 100644
index 000000000..9092c0635
--- /dev/null
+++ b/private/utils/ntbackup/inc/dle_str.h
@@ -0,0 +1,662 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dle_str.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the structures for the DLE
+
+ Location: BE_PUBLIC
+
+
+
+ $Log: M:/LOGFILES/DLE_STR.H_V $
+ *
+ * Rev 1.40.1.1 04 Jan 1994 11:02:42 BARRY
+ * Added Unicode name feature bit
+ *
+ * Rev 1.40.1.0 18 Oct 1993 19:22:08 STEVEN
+ * add support for SPACE & PERIOD
+ *
+ * Rev 1.40 26 Jul 1993 17:05:56 STEVEN
+ * fixe restore active file with registry
+ *
+ * Rev 1.39 17 Jun 1993 11:39:12 ChuckS
+ * Added define of DLE_FEAT_NON_VOLUME_OBJECT
+ *
+ * Rev 1.38 11 Jun 1993 14:17:40 BARRY
+ * Separated special files into backup and restore special files.
+ *
+ * Rev 1.37 09 Jun 1993 19:18:58 MIKEP
+ * more c++ changes
+ *
+ * Rev 1.35 09 Jun 1993 10:44:24 BARRY
+ * Added a default security descriptor and its ACL to NTFS dle.
+ *
+ * Rev 1.34 23 Apr 1993 05:31:18 BILLB
+ * Fixed GRFS_MAC_AGENT define (was GRFS_MAX_AGENT. oopsy!)
+ *
+ * Rev 1.33 22 Apr 1993 10:12:14 BILLB
+ * Added support for GRFS Device subtypes
+ *
+ * Rev 1.32 16 Apr 1993 13:55:20 MIKEP
+ * add case preserving option
+ *
+ * Rev 1.31 15 Jan 1993 13:19:10 BARRY
+ * added support for new error messages and backup priviladge
+ *
+ * Rev 1.30 13 Jan 1993 15:04:12 DOUG
+ * Changed FS_RMFS to FS_GRFS
+ *
+ * Rev 1.29 07 Dec 1992 12:16:48 DON
+ * Changes for when to prompt for username/password
+ *
+ * Rev 1.28 11 Nov 1992 22:09:54 GREGG
+ * Unicodeized literals.
+ *
+ * Rev 1.27 04 Nov 1992 17:59:28 BARRY
+ * Added fs_name to NTFS dle.
+ *
+ * Rev 1.26 13 Oct 1992 12:27:30 STEVEN
+ * added case sensitive feature bit
+ *
+ * Rev 1.25 07 Oct 1992 14:50:50 STEVEN
+ * size should be INT
+ *
+ * Rev 1.24 05 Oct 1992 13:03:22 STEVEN
+ * added registry path size to NTFS DLE
+ *
+ * Rev 1.23 05 Oct 1992 11:46:42 STEVEN
+ * added registry path to NTFS DLE
+ *
+ * Rev 1.22 29 Jul 1992 15:34:14 STEVEN
+ * fix warnings
+ *
+ * Rev 1.21 23 Jul 1992 12:36:16 STEVEN
+ * fix mare warnings
+ *
+ * Rev 1.20 23 Jul 1992 11:27:12 STEVEN
+ * user_name_leng is int not char_ptr
+ *
+ * Rev 1.19 23 Jul 1992 11:03:22 BURT
+ * Fixed errant ')'s caused by macro error.
+ *
+ *
+ * Rev 1.18 23 Jul 1992 09:54:16 STEVEN
+ * fix warnings
+ *
+ * Rev 1.17 21 Jul 1992 14:04:32 STEVEN
+ * added support for DLE_GetUserName
+ *
+ * Rev 1.16 09 Jul 1992 14:46:16 STEVEN
+ * BE_Unicode updates
+ *
+ * Rev 1.15 02 Jul 1992 10:23:34 MIKEP
+ * Add feature bit for remote device.
+ *
+ * Rev 1.14 28 May 1992 09:44:16 BARRY
+ * Move changes on branches back to tip.
+ *
+ * Rev 1.13 21 May 1992 13:46:44 STEVEN
+ * more long path support
+ *
+ * Rev 1.12 07 May 1992 08:38:42 STEVEN
+ * moved osid and osver
+ *
+ * Rev 1.11 12 Mar 1992 17:14:08 DOUG
+ * Added changes for RMFS support.
+ *
+ * Rev 1.10 20 Dec 1991 09:31:30 STEVEN
+ * move common files to tables
+ *
+ * Rev 1.9 31 Oct 1991 19:01:56 BARRY
+ * Added another feature definition.
+ *
+ * Rev 1.8 31 Oct 1991 16:27:56 BARRY
+ * TRICYCLE: Added a field in GENERIC_DLE to hold a set of feature bits.
+ * Added some #defines for current "special" features.
+ *
+ * Rev 1.7 03 Oct 1991 09:39:04 BARRY
+ * Add new field for SMS object DLE.
+ *
+ * Rev 1.6 10 Sep 1991 18:17:10 DON
+ * rearranged the order of drive types
+ *
+ * Rev 1.5 10 Sep 1991 17:08:48 BARRY
+ * Added SMS dle structures.
+ *
+ * Rev 1.4 13 Aug 1991 16:51:46 DON
+ * removed server member from NLM dle types
+ *
+ * Rev 1.3 31 Jul 1991 18:41:38 DON
+ * added new dle types for the NLM
+ * NLM_DLE && NLM_AFP_DLE && NLM_SERVER_DLE
+ *
+ * Rev 1.2 30 Jun 1991 16:21:08 BARRY
+ * Added stuff for the Ersatz file system.
+ *
+ * Rev 1.1 23 May 1991 16:50:04 BARRY
+ * DLE types are no longer enumerated based on product #defines.
+ *
+ * Rev 1.0 09 May 1991 13:30:48 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef DLE_STR_H
+#define DLE_STR_H
+#include "queues.h"
+
+
+/**
+ File System constants
+**/
+
+/*
+ text string limits
+*/
+#define NOV_SERV_NAM_SIZE 48 /* server name size */
+#define NOV_VOL_NAM_SIZE 16 /* volume name size */
+#define NOV_MAXDSIZE 512 /* current directory */
+
+/*
+ File system types
+*/
+#define GENERIC_DATA ((UINT8)0) /* g */
+#define NLM_SERVER_ONLY ((UINT8)1) /* v */
+#define NLM_VOLUME ((UINT8)2) /* l */
+#define NLM_AFP_VOLUME ((UINT8)3) /* p */
+#define NOVELL_DRV ((UINT8)4) /* n */
+#define NOVELL_AFP_DRV ((UINT8)5) /* a */
+#define NOVELL_SERVER_ONLY ((UINT8)6) /* s */
+#define LOCAL_DOS_DRV ((UINT8)7) /* d */
+#define REMOTE_DOS_DRV ((UINT8)8) /* r */
+#define LOCAL_IMAGE ((UINT8)9) /* i */
+#define REMOTE_WORK_STAT ((UINT8)10) /* w */
+#define LOCAL_OS2_DRV ((UINT8)11) /* o */
+#define ERSATZ_DRV ((UINT8)12) /* e */
+#define SMS_AGENT ((UINT8)13) /* tsa */
+#define SMS_SERVICE ((UINT8)14) /* ts */
+#define SMS_OBJECT ((UINT8)15) /* m */
+#define LOCAL_NTFS_DRV ((UINT8)16) /* t */
+#define GRFS_SERVER ((UINT8)17) /* gr */
+#define FS_EMS_DRV ((UINT8)18) /* x */
+
+#define MAX_DRV_TYPES ((UINT8)19)
+
+/*
+ GRFS specific device sub types
+*/
+#define GRFS_GENERIC_AGENT ((UINT8)0)
+#define GRFS_DOS_AGENT ((UINT8)1)
+#define GRFS_OS2_AGENT ((UINT8)2)
+#define GRFS_MAC_AGENT ((UINT8)3)
+#define GRFS_UNIX_AGENT ((UINT8)4)
+
+/*
+ EMS specific device sub types
+*/
+#define EMS_ENTERPRISE ((UINT8)1)
+#define EMS_SITE ((UINT8)2)
+#define EMS_SERVER ((UINT8)3)
+#define EMS_BRICK ((UINT8)4)
+#define EMS_MDB ((UINT8)5)
+#define EMS_DSA ((UINT8)6)
+
+
+/* Used by DLE_UpdateList to release specific DLE's */
+
+#define DEL_NOTHING ((UINT16)BIT0)
+#define SERVER_VOLUMES ((UINT16)BIT1)
+#define MAP_NETWORK_DRIVES ((UINT16)BIT2)
+
+#define UNKNOWN_NET 0xff
+
+#define ANY_DRIVE_TYPE ((INT16)-1)
+#define HAND_MADE_MASK 0x80
+
+/* Used to ID Dynamic, Initial, or No login status */
+
+#define NO_LOGIN 0
+#define INIT_LOGIN 1
+#define DYNAMIC_LOGIN 2
+
+
+/* Feature bits for DLEs. (See GENERIC_DLE struct and macros in DLE.H) */
+
+#define DLE_FEAT_REDIRECTED_RESTORE 0x0001 /* can redirect restores */
+#define DLE_FEAT_SUPPORTS_CHILDREN 0x0002 /* DLE_SupportChild should go away */
+#define DLE_FEAT_REMOVABLE_MEDIA 0x0004 /* Device has removable media */
+#define DLE_FEAT_REMOVABLE_MEDIA 0x0004 /* Device has removable media */
+#define DLE_FEAT_ACCESS_DATE 0x0008 /* Device supports access dates */
+#define DLE_FEAT_BKUP_SPECIAL_FILES 0x0010 /* Device supports backup of special files */
+#define DLE_FEAT_REST_SPECIAL_FILES 0x0020 /* Device supports restore of special files */
+#define DLE_FEAT_DATA_SECURITY 0x0040 /* Device supports network security */
+#define DLE_FEAT_REMOTE_DRIVE 0x0080 /* Device is not local */
+#define DLE_FEAT_MAPPED_DRIVE 0x0100 /* Device is mapped to a drive letter */
+#define DLE_FEAT_CASE_SENSITIVE 0x0200 /* Device were FRED.C != fred.c */
+#define DLE_FEAT_CASE_PRESERVING 0x0400 /* Device retains case but FRED==fred */
+#define DLE_FEAT_NON_VOLUME_OBJECT 0x0800 /* Device is non-volume, eg Directory services, bindery */
+#define DLE_FEAT_UNICODE_NAMES 0x1000 /* Device accepts Unicode names */
+#define DLE_FEAT_NON_DISPLAYABLE_CONT 0x2000 /* Device accepts Unicode names */
+
+/**
+ OS specific portions of DLE
+**/
+
+/*
+ IMAGE Specific DLE
+*/
+
+typedef struct LOCAL_IMAGE_DLE_INFO *LOCAL_IMAGE_DLE_INFO_PTR;
+typedef struct LOCAL_IMAGE_DLE_INFO {
+ INT8 drive_num; /* physical drive number */
+ INT8 partition; /* partition to backup for IMAGE */
+ CHAR drive_char; /* DOS drive letter for partition */
+ UINT16 bytes_per_sector; /* number of bytes per sector */
+ INT8 boot; /* boot indicator */
+ UINT8 bhead; /* beginning head number */
+ UINT8 bsect; /* beginning sector number */
+ UINT8 bcyl; /* beginning cylinder number */
+ UINT8 sysi; /* system indicator flag */
+ UINT8 ehead; /* ending head number */
+ UINT8 esect; /* ending sector number */
+ UINT8 ecyl; /* ending cylinder number */
+ UINT32 rsect; /* beginning relative sector */
+ UINT32 nsect; /* number of sectors in partition */
+ UINT16 hhead; /* highest head number on drive */
+ UINT16 hcyl; /* highest cylinder number on drive */
+ UINT16 hsect; /* highest sector number on drive */
+ UINT32 bytes_on_partition; /* nsect * bytes_per_sector */
+} LOCAL_IMAGE_DLE_INFO ;
+
+/*
+ Specific info for HAND_MADE DLE's
+*/
+typedef struct HAND_MADE_DLE_INFO *HAND_MADE_DLE_INFO_PTR;
+typedef struct HAND_MADE_DLE_INFO {
+ CHAR vol_name[2] ; /* variable sized */
+} HAND_MADE_DLE_INFO;
+
+/*
+ DOS Specific DLE
+*/
+typedef struct LOCAL_DOS_DRV_DLE_INFO *LOCAL_DOS_DRV_DLE_INFO_PTR;
+
+typedef struct LOCAL_DOS_DRV_DLE_INFO {
+
+ /* warning: This structure is shared by the FAKE_REMOTE_DOS_DRV_DLE */
+
+ CHAR drive; /* Dos Drive letter */
+ CHAR volume_label[13]; /* volume label */
+ CHAR_PTR base_path; /* points to '\0' for regular DOS, but */
+ /* points to some path for TDEMO fake remotes */
+} LOCAL_DOS_DRV_DLE_INFO;
+
+typedef struct LOCAL_NTFS_DRV_DLE_INFO *LOCAL_NTFS_DRV_DLE_INFO_PTR;
+
+typedef struct LOCAL_NTFS_DRV_DLE_INFO {
+ CHAR drive; /* Dos Drive letter */
+ BOOLEAN mac_name_syntax; /* if true "\\?\" syntax valid */
+ CHAR_PTR volume_label; /* volume label */
+ CHAR_PTR registry_path; /* needed for mapped LANMAN drvs */
+ INT registry_path_size; /* needed for mapped LANMAN drvs */
+ INT16 fname_leng ; /* size of path element */
+ DWORD vol_flags ; /* flags from GetVolInfo() */
+ CHAR_PTR fs_name; /* name of file system */
+ VOID_PTR sd; /* sec. descriptor for create */
+ VOID_PTR sdacl; /* acl for sec descriptor above */
+ CHAR_PTR LastSysRegPath ; /* last system registry path */
+ CHAR_PTR LastSysRegPathNew ; /* new fnme forLastSysRegPath */
+ CHAR user_name[ 2 ] ; /* user name - must be last */
+
+} LOCAL_DOS_NTFS_DLE_INFO;
+
+
+typedef struct EMS_ENTERP_DLE_INFO *EMS_ENTERP_DLE_INFO_PTR;
+
+typedef struct EMS_ENTERP_DLE_INFO {
+ INT type ; /* ems dle type must be first element */
+ CHAR_PTR enterprise_name; /* volume label */
+ CHAR_PTR server_name; /* volume label */
+} EMS_ENTERP_DLE_INFO;
+
+typedef struct EMS_SITE_DLE_INFO *EMS_SITE_DLE_INFO_PTR;
+
+typedef struct EMS_SITE_DLE_INFO {
+ INT type ; /* ems dle type must be first element */
+ CHAR_PTR site_name; /* volume label */
+} EMS_SITE_DLE_INFO;
+
+typedef struct EMS_SERVER_DLE_INFO *EMS_SERVER_DLE_INFO_PTR;
+
+typedef struct EMS_SERVER_DLE_INFO {
+ INT type ; /* ems dle type must be first element */
+ VOID_PTR mail_hand ; /* handle from logon */
+ CHAR_PTR server_name; /* volume label */
+} EMS_SERVER_DLE_INFO;
+
+typedef struct EMS_MDB_DSA_DLE_INFO *EMS_MDB_DSA_DLE_INFO_PTR;
+
+typedef struct EMS_MDB_DSA_DLE_INFO {
+ INT type ; /* ems dle type must be first element */
+ CHAR_PTR server_name; /* volume label */
+} EMS_MDB_DSA_DLE_INFO;
+
+typedef struct EMS_BRICK_DLE_INFO *EMS_BRICK_DLE_INFO_PTR;
+
+typedef struct EMS_BRICK_DLE_INFO {
+ INT type ; /* ems dle type must be first element */
+ VOID_PTR mail_hand ; /* handle from logon */
+ CHAR_PTR server_name; /* volume label */
+
+} EMS_BRICK_DLE_INFO;
+
+typedef struct LOCAL_OS2_DRV_DLE_INFO *LOCAL_OS2_DRV_DLE_INFO_PTR;
+
+typedef struct LOCAL_OS2_DRV_DLE_INFO {
+
+ INT16 fname_fmt; /* max size of file name */
+ CHAR drive; /* Dos Drive letter */
+ CHAR volume_label[13]; /* volume label */
+ CHAR_PTR base_path; /* points to '\0' for regular OS2*/
+
+} LOCAL_OS2_DRV_DLE_INFO;
+/* values for fname_fmt */
+#define FAT_FNAME 0
+#define HPFS_FNAME 1
+
+
+/*
+ Fake published volumes of a Fake Remote workstation
+*/
+typedef struct FAKE_REMOTE_DOS_DRV_DLE * FAKE_REMOTE_DOS_DRV_DLE_PTR ;
+
+typedef struct FAKE_REMOTE_DOS_DRV_DLE {
+ CHAR drive; /* must start out with the */
+ CHAR volume_label[13]; /* entire LOCAL_DOS_DRV_DLE_INFO */
+ CHAR_PTR base_path;
+
+ CHAR_PTR password;
+
+} FAKE_REMOTE_DOS_DRV_DLE ;
+
+/*
+ Remote workstations
+*/
+typedef struct REMOTE_WORK_STAT_DLE *REMOTE_WORK_STAT_DLE_PTR;
+
+typedef struct REMOTE_WORK_STAT_DLE {
+ struct CONNECTION_STRUCT *connect_ptr;
+ struct APPLICATION_STRUCT *application_ptr;
+} REMOTE_WORK_STAT_DLE;
+
+
+/*
+ Fake Remote workstations ( for TDEMO )
+*/
+typedef struct FAKE_REMOTE_WORK_STAT_DLE * FAKE_REMOTE_WORK_STAT_DLE_PTR ;
+
+typedef struct FAKE_REMOTE_WORK_STAT_DLE {
+ INT16 first_alias ;
+ INT16 num_aliases ;
+} FAKE_REMOTE_WORK_STAT_DLE ;
+
+/*
+ Published volumes on remote workstations
+*/
+typedef struct REMOTE_DOS_DRV_DLE *REMOTE_DOS_DRV_DLE_PTR ;
+typedef struct REMOTE_DOS_DRV_DLE {
+ CHAR pswd[9] ; /* Used to login to a remote drv */
+ struct CONNECTION_STRUCT *connect_ptr;
+ struct DEVICE_STRUCT *device_ptr;
+} REMOTE_DOS_DRV_DLE;
+
+
+/*
+ Drives for the Ersatz file system
+*/
+typedef struct ERSATZ_DRV_DLE *ERSATZ_DRV_DLE_PTR ;
+typedef struct ERSATZ_DRV_DLE {
+ CHAR *volume_label ;
+ INT16 block_size ;
+} ERSATZ_DRV_DLE;
+
+
+/*
+ Novell Server
+*/
+
+#define USER_NAME_MAX_SIZE 48 /* User name may be 47 bytes */
+#define USER_PASSWORD_MAX_SIZE 128 /* Password may be 127 bytes */
+
+typedef struct NOVELL_SERVER_DLE *NOVELL_SERVER_DLE_PTR ;
+typedef struct NOVELL_SERVER_DLE {
+ INT16 login_status ; /* 1 if logged in at init time, */
+ /* otherwise 0 */
+ CHAR user_name[USER_NAME_MAX_SIZE] ;
+ CHAR pswd [USER_PASSWORD_MAX_SIZE] ;
+ UINT8 server_num ; /* inited if logged in */
+} NOVELL_SERVER_DLE ;
+
+typedef struct NLM_SERVER_DLE *NLM_SERVER_DLE_PTR ;
+typedef struct NLM_SERVER_DLE {
+ INT16 login_status ; /* 1 if logged in at init time, */
+ /* otherwise 0 */
+ CHAR user_name[USER_NAME_MAX_SIZE] ;
+ CHAR pswd [USER_PASSWORD_MAX_SIZE] ;
+ UINT8 server_num ; /* inited if logged in */
+} NLM_SERVER_DLE ;
+
+/*
+ NOVELL < 2.15 Specific DLE
+*/
+typedef struct NOV_DRV_DLE {
+
+ /* !!!!!! SEE AFP DLE below !!!!!! */
+
+ UINT8 drive_handle; /* network path num */
+ CHAR drive; /* Dos Drive letter */
+ UINT8 vol_num ; /* volume number */
+ UINT8 server_num ; /* server number */
+ UINT8 server_support ; /* TTS, etc support */
+ CHAR_PTR ser_name; /* Server name */
+ CHAR_PTR volume ; /* volume name */
+ CHAR_PTR base_path; /* path name, not incl final '\' */
+ INT8 num_bind_close; /* # of apps who closed bindery */
+ NOVELL_SERVER_DLE_PTR server; /* points to server data */
+} *NOV_DRV_DLE_PTR;
+
+/*
+ NOVELL NLM Specific DLE
+*/
+typedef struct NLM_DLE {
+
+ /* !!!!!! SEE NLM AFP DLE below !!!!!! */
+
+ UINT8 vol_num ; /* volume number */
+ UINT8 server_num ; /* server number */
+ UINT8 server_support ; /* TTS, etc support */
+ CHAR_PTR ser_name; /* Server name */
+ CHAR_PTR volume ; /* volume name */
+ INT8 num_bind_close; /* # of apps who closed bindery */
+} *NLM_DLE_PTR;
+
+/*
+ NOVELL NLM AFP Specific DLE
+*/
+typedef struct NLM_AFP_DLE {
+ UINT8 vol_num ; /* --------------------------- */
+ UINT8 server_num ; /* !!! MUST BE The SAME !!! */
+ UINT8 server_support ; /* as */
+ CHAR_PTR ser_name; /* */
+ CHAR_PTR volume; /* !! NLM_DLE !! */
+ INT8 num_bind_close; /* ---------------------------- */
+ UINT32 base_entry_id; /* entry ID of base directory */
+} *NLM_AFP_DLE_PTR;
+
+/*
+ NOVELL >= 2.15 Specific DLE
+*/
+typedef struct NOV_AFP_DRV_DLE {
+ UINT8 drive_handle; /* --------------------------- */
+ CHAR drive; /* */
+ UINT8 vol_num ; /* !!! MUST BE The SAME !!! */
+ UINT8 server_num ; /* */
+ UINT8 server_support ; /* as */
+ CHAR_PTR ser_name; /* */
+ CHAR_PTR volume; /* !! NOV_DRV_DLE !! */
+ CHAR_PTR base_path; /* */
+ INT8 num_bind_close; /* */
+ NOVELL_SERVER_DLE_PTR server; /* ---------------------------- */
+ UINT32 base_entry_id; /* entry ID of base directory */
+} *NOV_AFP_DRV_DLE_PTR;
+
+
+/*
+ Other Netowrk Specific DLE
+*/
+typedef struct IBM_PC_LAN_DRV_DLE{
+ CHAR drive; /* Dos Drive letter */
+ CHAR volume_label[13]; /* volume label */
+} *IBM_PC_LAN_DRV_DLE_PTR;
+
+
+/*
+ * Novell's SMS Target Service Agent DLE
+ */
+typedef struct SMS_TSA_DLE *SMS_TSA_DLE_PTR;
+typedef struct SMS_TSA_DLE {
+ CHAR_PTR tsa_name; /* name of the TSA */
+ UINT32 connection; /* Connection established with TSA */
+} SMS_TSA_DLE;
+
+/*
+ * Novell's SMS Target Service DLE
+ */
+typedef struct SMS_TS_DLE *SMS_TS_DLE_PTR;
+typedef struct SMS_TS_DLE {
+ CHAR_PTR ts_name; /* service's name (same as dev name) */
+ CHAR_PTR user_name; /* User name specified at attach time */
+ CHAR_PTR password; /* Password specified at attach time */
+} SMS_TS_DLE;
+
+/*
+ * Novell's SMS Target Service Object DLE
+ */
+typedef struct SMS_TSO_DLE *SMS_TSO_DLE_PTR;
+typedef struct SMS_TSO_DLE {
+ CHAR_PTR object_name; /* object's name (same as device name) */
+ BOOLEAN superset_object; /* object is superset of its siblings? */
+ BOOLEAN objectIsVolume; /* object is a "volume" */
+} SMS_TSO_DLE;
+
+
+/*
+ GRFS workstations
+*/
+
+#define GRFS_MAX_DLE_NAME_LEN 128
+
+typedef struct GRFS_SERVER_DLE *GRFS_SERVER_DLE_PTR;
+typedef struct GRFS_SERVER_DLE {
+ CHAR user_name[USER_NAME_MAX_SIZE];
+ CHAR password[USER_PASSWORD_MAX_SIZE];
+ CHAR device_name[GRFS_MAX_DLE_NAME_LEN+1];
+ UINT16 type;
+ UINT32 dle_id;
+ VOID_PTR res_ptr;
+ VOID_PTR connect_ptr;
+ BOOLEAN obj_find_more;
+ BOOLEAN spec_enum_more;
+ CHAR_PTR spec_space;
+ UINT16 spec_space_size;
+ UINT16 spec_space_pos;
+ BOOLEAN shadow_attach;
+} GRFS_SERVER_DLE;
+
+
+
+typedef union {
+ VOID_PTR any; /* generic reference to any of the following pointers */
+ LOCAL_IMAGE_DLE_INFO_PTR image;
+ LOCAL_DOS_DRV_DLE_INFO_PTR dos;
+ EMS_ENTERP_DLE_INFO_PTR xenterp ;
+ EMS_SITE_DLE_INFO_PTR xsite;
+ EMS_SERVER_DLE_INFO_PTR xserv;
+ EMS_MDB_DSA_DLE_INFO_PTR xmono;
+ EMS_BRICK_DLE_INFO_PTR xbrick;
+ LOCAL_NTFS_DRV_DLE_INFO_PTR ntfs;
+ LOCAL_OS2_DRV_DLE_INFO_PTR os2;
+ REMOTE_WORK_STAT_DLE_PTR work_stat;
+ REMOTE_DOS_DRV_DLE_PTR remote;
+ NOV_DRV_DLE_PTR nov;
+ NOV_AFP_DRV_DLE_PTR afp;
+ NOVELL_SERVER_DLE_PTR server;
+ IBM_PC_LAN_DRV_DLE_PTR pclan;
+ HAND_MADE_DLE_INFO_PTR user ;
+ FAKE_REMOTE_WORK_STAT_DLE_PTR fake_work_stat ;
+ FAKE_REMOTE_DOS_DRV_DLE_PTR fake_remote ;
+ ERSATZ_DRV_DLE_PTR ersatz ;
+ NLM_DLE_PTR nlm ;
+ NLM_AFP_DLE_PTR nlm_afp ;
+ NLM_SERVER_DLE_PTR nlm_server ;
+ SMS_TSA_DLE_PTR sms_tsa ;
+ SMS_TS_DLE_PTR sms_ts ;
+ SMS_TSO_DLE_PTR sms_tso ;
+ GRFS_SERVER_DLE_PTR grfs ;
+} DRIVE_INFO_PTR ;
+
+/**
+ Generic Drive List Element
+**/
+typedef struct HEAD_DLE *DLE_HEAD_PTR;
+typedef struct HEAD_DLE *DLE_HAND;
+
+typedef struct GENERIC_DLE *GENERIC_DLE_PTR;
+typedef struct GENERIC_DLE {
+ Q_ELEM q; /* Queue list element */
+ DLE_HEAD_PTR handle; /* pointer to the DLE queue head */
+ GENERIC_DLE_PTR parent ; /* pointer to parent DLE */
+ Q_HEADER child_q; /* queue of children DLEs */
+ UINT8 type; /* type of dle */
+ UINT8 subtype; /* a dle subtype, for those who want it*/
+ CHAR_PTR device_name; /* device label used in drive select */
+ INT16 device_name_leng ; /* length of device name */
+ CHAR_PTR user_name ; /* pointer to user name in specif info */
+ UINT16 user_name_leng ;/* length of user name in specif info */
+ CHAR path_delim ; /* Character used between dir names */
+ UINT8 pswd_required ; /* size of password required */
+ UINT8 name_required ; /* size of login name is required */
+ BOOLEAN pswd_saved ; /* TRUE if password is already saved */
+ BOOLEAN name_saved ; /* TRUE if name is already saved */
+ BOOLEAN dle_writeable; /* FALSE if drive is write protected */
+ UINT16 os_version ; /* verson of operating system */
+ INT16 attach_count ; /* number of attachments to me */
+ INT16 bsd_use_count; /* number of BSD's pointing to me */
+ BOOLEAN dynamic_info ; /* TRUE if the following pointer should be freed before freeing this structure. */
+ DRIVE_INFO_PTR info; /* pointer to Non Generic portion */
+ UINT16 feature_bits ; /* tells features/capabilities of DLE */
+ UINT8 os_id ;
+ UINT8 os_ver ;
+} GENERIC_DLE;
+
+/**
+ Handle for Drive List
+**/
+
+typedef struct HEAD_DLE {
+ Q_HEADER q_hdr ;
+ GENERIC_DLE_PTR default_drv ; /* used to return to default drive */
+ Q_HEADER fsh_queue ; /* Q of all allocated FS handles */
+ UINT32 file_sys_mask ;
+ INT16 (*crit_err)() ; /* pointer to UI critical err hand */
+ INT16 fs_initialized ; /* bit_mask specifies whats inited */
+ UINT16 remote_filter ; /* bit_mask specifies visible remote reource types */
+
+} HEAD_DLE ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/dlg_ids.h b/private/utils/ntbackup/inc/dlg_ids.h
new file mode 100644
index 000000000..a27bc6d65
--- /dev/null
+++ b/private/utils/ntbackup/inc/dlg_ids.h
@@ -0,0 +1,140 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: dlg_ids.h
+
+ Description: Dialog ID file.
+
+ $Log: G:\ui\logfiles\dlg_ids.h_v $
+
+ Rev 1.11 01 Aug 1993 13:12:38 MIKEP
+add idd_waitdevice
+
+ Rev 1.10 27 Jul 1993 13:22:10 chrish
+CAYMAN EPR 0638: Added new define IDD_PMDUMMYABORT for print aborting.
+
+ Rev 1.9 14 Jul 1993 09:22:56 CARLS
+added ID for skipno dialog
+
+ Rev 1.8 25 May 1993 14:24:00 chrish
+Added new define IDD_ABORT_BOX for backup/restore abort dialog box.
+
+ Rev 1.7 31 Oct 1992 14:56:50 MIKEP
+continue adding small catalog dialog
+
+ Rev 1.6 04 Oct 1992 19:46:44 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.5 21 Sep 1992 16:51:08 DARRYLP
+Updates for WFW email routines.
+
+ Rev 1.4 17 Sep 1992 18:04:24 DARRYLP
+New Dialog ID for WFW email.
+
+ Rev 1.3 02 Sep 1992 15:07:22 GLENN
+Added the choose font dialog ID.
+
+ Rev 1.2 06 Apr 1992 09:54:06 CHUCKB
+Added define for translation.
+
+ Rev 1.1 24 Feb 1992 09:38:52 ROBG
+Added IDD_PMABORT for print manager.
+
+ Rev 1.0 27 Jan 1992 10:14:48 GLENN
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef DLG_IDS_H
+#define DLG_IDS_H
+
+// UNIVERSAL DEFINITIONS FOR ALL DIALOGS
+
+#undef IDHELP
+#define IDHELP 100
+
+#define IDD_HELPABOUTWINTERPARK 1
+
+#define IDD_OPERATIONSERASE 2
+
+#define IDD_SELECTADVANCED 3
+#define IDD_SELECTSAVE 4
+#define IDD_SELECTUSE 5
+#define IDD_SELECTDELETE 6
+#define IDD_ADVRESTORE 7
+
+#define IDD_JOBNEW 8
+#define IDD_JOBMAINTENANCE 9
+#define IDD_JOBOPTS 10
+#define IDD_JOBSCHEDULE 11
+#define IDD_SCHEDOPTS 12
+
+#define IDD_SETTINGSOPTIONS 13
+#define IDD_SETTINGSBACKUP 14
+#define IDD_SETTINGSRESTORE 15
+#define IDD_SETTINGSLOGGING 16
+#define IDD_SETTINGSNETWORK 17
+#define IDD_SETTINGSCATALOG 18
+#define IDD_SETTINGSHARDWARE 19
+#define IDD_SETTINGSDEBUGWINDOW 20
+
+#define IDD_PSWD 21
+#define IDD_RESTORE 22
+#define IDD_VERIFY 23
+#define IDD_SEARCHTAPE 24
+
+#define IDD_FILESETUP 25
+#define IDD_FILEPRINT 26
+
+#define IDD_OPERATIONSCATMAINT 27
+#define IDD_CATBSET 28
+#define IDD_CATTAPE 29
+#define IDD_TAPEPSWD 30
+#define IDD_LANTAPEPSWD 31
+
+#define IDD_JOBPROGMANITEM 32
+
+#define IDD_BACKUPSET 33
+#define IDD_RESTORESET 34
+#define IDD_VERIFYSET 35
+#define IDD_REENTER_PASSWORD 36
+#define IDD_SKIPOPEN 37
+#define IDD_FILEREPLACE 38
+#define IDD_ERASE 39
+#define IDD_RUNTIME 40
+#define IDD_TENSION 41
+#define IDD_NEXT_SET 42
+#define IDD_PWDB_PASSWORD 43
+#define IDD_EMAIL 44
+#define IDD_EMAILLOGON 45
+
+
+// This define doesn't happen to be used by any menus.
+
+#define IDD_MESSAGE_BOX 280
+
+// Not in dialog manager. Used as modeless in print manager.
+
+#define IDD_PMABORT 46
+
+// FONT
+
+#define IDD_CHOOSEFONT 47
+
+
+#define IDD_CATALOG 48
+
+#define IDD_ABORT_BOX 49 // chs:05-25-93
+
+#define IDD_SKIPNO 50
+
+#define IDD_PMDUMMYABORT 51 // chs:07-27-93
+
+#define IDD_WAITDEVICE 52
+
+#define IDD_CONNECT_XCHNG 53
+
+#define IDD_XCHG_RECOVER 54
+
+#endif
diff --git a/private/utils/ntbackup/inc/dlm.h b/private/utils/ntbackup/inc/dlm.h
new file mode 100644
index 000000000..0327d2849
--- /dev/null
+++ b/private/utils/ntbackup/inc/dlm.h
@@ -0,0 +1,469 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: DLM.H
+
+ Description: This header file contains prototypes for the
+ display list manager.
+
+ $Log: G:/UI/LOGFILES/DLM.H_V $
+
+ Rev 1.24 15 Jun 1993 09:58:08 MIKEP
+enable c++
+
+ Rev 1.23 28 Apr 1993 15:36:00 GLENN
+Added DLM_GetPixelStringWidth() for column width calculations.
+
+ Rev 1.22 02 Apr 1993 15:53:14 ROBG
+Changed FocusItem to be UINT for both NT and WINDOWS.
+
+ Rev 1.21 10 Feb 1993 13:09:18 ROBG
+Added conditional OS_WIN32 to definition of szText buffer.
+This static buffer is used by application code to pass
+text strings to the DLM. One buffer per object.
+
+ Rev 1.20 21 Dec 1992 12:28:58 DAVEV
+Enabled for Unicode - IT WORKS!!
+
+ Rev 1.19 11 Dec 1992 18:31:08 GLENN
+Fixed horizontal spelling and ColWidth spelling.
+
+ Rev 1.18 14 Oct 1992 15:49:10 GLENN
+Added Selection Framing Support for List Boxes without the FOCUS.
+
+ Rev 1.17 04 Oct 1992 19:46:48 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.16 08 Sep 1992 09:24:36 ROBG
+Changed the x and y positional variables to short from USHORT.
+
+ Rev 1.15 20 Aug 1992 11:50:00 ROBG
+Added function DLM_SetFont to support the modification of fonts in the
+listboxes.
+
+ Rev 1.14 19 Mar 1992 09:12:04 ROBG
+Added new routine prototype for DLM_SetHorizontalExt.
+
+ Rev 1.13 10 Feb 1992 09:17:52 GLENN
+Changed DLM_KeyUp to receive a pointer to the key.
+
+ Rev 1.12 26 Dec 1991 16:01:10 ROBG
+Removed reference to DLM_ROW_VECTOR.
+
+ Rev 1.11 26 Dec 1991 10:20:34 ROBG
+Removed define for DLM_LARGEBITMTAPSSTEXT.
+
+ Rev 1.10 19 Dec 1991 08:52:00 ROBG
+Added prototype for DLM_Deinit.
+
+ Rev 1.9 17 Dec 1991 18:03:00 ROBG
+Corrected misspellings in DLM_Get, SetCheckboxWidth/Height.
+
+ Rev 1.8 17 Dec 1991 15:08:52 ROBG
+Changed usDummy field to a define field of 'usTrkPtFailure'.
+
+ Rev 1.7 17 Dec 1991 14:01:20 ROBG
+Moved from private header file DLM_GetDispHdr.
+
+ Rev 1.6 16 Dec 1991 09:42:02 ROBG
+Added routine DLM_GetObjectList.
+
+ Rev 1.5 12 Dec 1991 17:11:58 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.4 10 Dec 1991 14:19:34 GLENN
+Added DLM_MULTICOLUMN same as DLM_COLUMN_VECTOR
+
+ Rev 1.3 03 Dec 1991 16:13:54 GLENN
+Added DLM_CharToItem() prototype.
+
+ Rev 1.2 02 Dec 1991 13:13:18 ROBG
+Added some new style macros.
+
+ Rev 1.1 27 Nov 1991 10:33:46 ROBG
+Changed dlm_displistterm prototype.
+
+ Rev 1.0 20 Nov 1991 19:34:04 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef dlm_h
+#define dlm_h
+
+#define DLM_SINGLECOLUMN 1
+#define DLM_MULTICOLUMN 2
+#define DLM_COLUMN_VECTOR DLM_MULTICOLUMN
+#define DLM_HIERARCHICAL 4
+
+#define DLM_LARGEBITMAPSLTEXT 1 /* Text to the right of bitmap */
+#define DLM_SMALL_BITMAPS 3
+#define DLM_ICONS 4
+
+#define DLM_CHECKBOX 1
+#define DLM_BITMAP 2
+#define DLM_ICON 3
+#define DLM_TEXT_ONLY 4
+
+#define DLM_TREELISTBOX 1
+#define DLM_FLATLISTBOX 2
+ /* bTextMode bits */
+#define DLM_TEXT_RIGHT_OF_ITEM BIT0
+#define DLM_ITALIC BIT1
+#define DLM_UNDERLINE BIT2
+#define DLM_BOLD BIT3
+#define DLM_RIGHT_JUSTIFY BIT4
+#define DLM_LEFT_JUSTIFY BIT5
+
+
+#define DLM_ANSI_FIXED_FONT 0
+#define DLM_ANSI_VAR_FONT 1
+#define DLM_DEVICEDEFAULT_FONT 2
+#define DLM_OEM_FIXED_FONT 3
+#define DLM_SYSTEM_FONT 4
+
+// LIST BOX SCROLL TYPES -- OTHERS CAN BE ADDED AS NEEDED
+
+#define DLM_SCROLLTOP SB_TOP
+#define DLM_SCROLLBOTTOM SB_BOTTOM
+
+#define DLMERR_OUT_OF_MEMORY 1
+#define DLMERR_TERMINATE_FAILED 2
+#define DLMERR_PROCESS_FAILED 3
+#define DLMERR_LIST_NOT_FOUND 4
+#define DLMERR_INIT_FAILED 5
+
+
+typedef struct _DLM_ITEM {
+ BYTE cbNum ; /* Number of item in sequential list. */
+ BYTE bType; /* Type of object to display. */
+ /* Not Used fdor parent list items. */
+ /* For Parent list items: */
+ /* BIT0 Displayed status. */
+ /* 1 if displayed, else 0. */
+ /* BIT1 Tagged status. */
+ /* 1 if tagged, else 0. */
+ WORD wId ; /* Id of a bitmap or icon */
+ BYTE bTextMode ; /* Where to place the text and style */
+ BYTE bMaxTextLen; /* Maximum Length in characters of text. */
+ /* This length is used to determine */
+ /* row or column sizes so that high- */
+ /* lighting may occur for a fixed region.*/
+ BYTE bLevel ; /* In a hierarchical list, the entry */
+ /* will help identify the indentation */
+ /* of the item. */
+ BYTE bTag ; /* Tag state 0:no 1:yes */
+
+#if defined( OS_WIN32 )
+ BYTE szText[600] ; /* Allow for very long name with NT */
+#else
+ BYTE szText[133] ;
+#endif
+
+ } DLM_ITEM, *DLM_ITEM_PTR ;
+
+
+typedef USHORT (*GET_COUNT_PTR) ( LMHANDLE dhListHdr ) ;
+typedef PVOID (*GET_FIRST_PTR) ( LMHANDLE dhListHdr ) ;
+typedef PVOID (*GET_NEXT_PTR) ( LMHANDLE dhListItem ) ;
+typedef PVOID (*GET_PREV_PTR) ( LMHANDLE dhListItem ) ;
+typedef BYTE (*GET_TAG_PTR) ( LMHANDLE dhListItem ) ;
+typedef PVOID (*SET_TAG_PTR) ( LMHANDLE dhListItem, BYTE fTag ) ;
+typedef BYTE (*GET_SELECT_PTR) ( LMHANDLE dhListItem ) ;
+typedef PVOID (*SET_SELECT_PTR) ( LMHANDLE dhListItem, BYTE fSelect ) ;
+typedef PVOID (*GET_OBJECTS_PTR) ( LMHANDLE dhListItem ) ;
+typedef BOOL (*SET_OBJECTS_PTR) ( LMHANDLE dhListItem, WORD bOperation, WORD bObjectNum ) ;
+typedef PVOID (*SET_FOCUS_PTR) ( LMHANDLE dhListItem ) ;
+
+
+typedef struct _DLM_HEADER {
+ BYTE bMode ;
+ BYTE bDisplay ;
+ BYTE bListBoxType ;
+ VOID_PTR lpdsListHdr ;
+ WORD nTextFont ;
+ GET_COUNT_PTR pfnGetItemCount ;
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_NEXT_PTR pfnGetNext ;
+ GET_PREV_PTR pfnGetPrev ;
+ GET_TAG_PTR pfnGetTag ;
+ SET_TAG_PTR pfnSetTag ;
+ GET_SELECT_PTR pfnGetSelect ;
+ SET_SELECT_PTR pfnSetSelect ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ SET_OBJECTS_PTR pfnSetObjects ;
+ SET_FOCUS_PTR pfnSetItemFocus ;
+ BYTE bMaxNumObjects ;
+
+ USHORT cxColWidth ;
+ USHORT cyColHeight ;
+
+ USHORT cxCheckBoxWidth ;
+ USHORT cyCheckBoxHeight ;
+ USHORT cxBitMapWidth ;
+ USHORT cyBitMapHeight ;
+ USHORT cxTextWidth ;
+ USHORT cyTextHeight ;
+
+ short cxBeforeCheckBox ;
+ short cxBeforeBitMap ;
+ short cxBeforeText ;
+
+ short cyBeforeCheckBox ;
+ short cyBeforeBitMap ;
+ short cyBeforeText ;
+
+ USHORT cxHierTab ;
+ USHORT cxHierHorzLine ;
+ USHORT cxHierHorzLen ;
+ USHORT cLastTreeSelect ;
+
+ USHORT usItemCount ;
+
+ UINT unFocusItem ;
+ USHORT usTrkPtFailure ;
+
+ short nMaxWidth ;
+
+ LMHANDLE dhAnchorItem ;
+ USHORT iAnchorItem ;
+
+ BYTE fKeyDown ;
+ BYTE fKeyUp ;
+ WORD wKeyValue ;
+
+ WORD wHorizontalExtent ;
+ WORD xOrigin ;
+
+ WORD fFocus ;
+ WORD hWndFocus ;
+ PVOID pGetObjBuffer;
+
+} DLM_HEADER, *DLM_HEADER_PTR ;
+
+typedef struct _DLM_INIT {
+ BYTE bMode ;
+ BYTE bDisplay ;
+ BYTE bListBoxType ;
+ VOID_PTR lpdsListHdr ;
+ WORD nTextFont ;
+ GET_COUNT_PTR pfnGetItemCount ;
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_NEXT_PTR pfnGetNext ;
+ GET_PREV_PTR pfnGetPrev ;
+ GET_TAG_PTR pfnGetTag ;
+ SET_TAG_PTR pfnSetTag ;
+ GET_SELECT_PTR pfnGetSelect ;
+ SET_SELECT_PTR pfnSetSelect ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ SET_OBJECTS_PTR pfnSetObjects ;
+ SET_FOCUS_PTR pfnSetItemFocus ;
+ BYTE bMaxNumObjects ;
+} DLM_INIT, *DLM_INIT_PTR ;
+
+
+#define DLM_Mode( p, x ) ( (p)->bMode = x )
+#define DLM_Display( p, x ) ( (p)->bDisplay = x )
+#define DLM_ListBoxType( p, x ) ( (p)->bListBoxType = x )
+#define DLM_DispHdr( p, x ) ( (p)->lpdsListHdr = (VOID_PTR) x )
+#define DLM_TextFont( p, x ) ( (p)->nTextFont = (WORD) x )
+#define DLM_GetItemCount( p, x ) ( (p)->pfnGetItemCount = (GET_COUNT_PTR) x )
+#define DLM_GetFirstItem( p, x ) ( (p)->pfnGetFirstItem = (GET_FIRST_PTR) x )
+#define DLM_GetNext( p, x ) ( (p)->pfnGetNext = (GET_NEXT_PTR) x )
+#define DLM_GetPrev( p, x ) ( (p)->pfnGetPrev = (GET_PREV_PTR) x )
+#define DLM_GetTag( p, x ) ( (p)->pfnGetTag = (GET_TAG_PTR) x )
+#define DLM_SetTag( p, x ) ( (p)->pfnSetTag = (SET_TAG_PTR) x )
+#define DLM_GetSelect( p, x ) ( (p)->pfnGetSelect = (GET_SELECT_PTR) x )
+#define DLM_SetSelect( p, x ) ( (p)->pfnSetSelect = (SET_SELECT_PTR) x )
+#define DLM_GetObjects( p, x ) ( (p)->pfnGetObjects = (GET_OBJECTS_PTR) x )
+#define DLM_SetObjects( p, x ) ( (p)->pfnSetObjects = (SET_OBJECTS_PTR) x )
+#define DLM_SSetItemFocus( p, x ) ( (p)->pfnSetItemFocus = (SET_FOCUS_PTR) x )
+#define DLM_MaxNumObjects( p, x ) ( (p)->bMaxNumObjects = x )
+#define DLM_GetObjBuffer( p, x ) ( (p)->pGetObjBuffer = (VOID_PTR x )
+
+#define DLM_GMode( p ) (p)->bMode
+#define DLM_GDisplay( p ) (p)->bDisplay
+#define DLM_GListBoxType( p ) (p)->bListBoxType
+#define DLM_GDispHdr( p ) (p)->lpdsListHdr
+#define DLM_GTextFont( p ) (p)->nTextFont
+#define DLM_GGetItemCount( p ) (p)->pfnGetItemCount
+#define DLM_GGetFirstItem( p ) (p)->pfnGetFirstItem
+#define DLM_GGetNext( p ) (p)->pfnGetNext
+#define DLM_GGetPrev( p ) (p)->pfnGetPrev
+#define DLM_GGetTag( p ) (p)->pfnGetTag
+#define DLM_GSetTag( p ) (p)->pfnSetTag
+#define DLM_GGetSelect( p ) (p)->pfnGetSelect
+#define DLM_GSetSelect( p ) (p)->pfnSetSelect
+#define DLM_GGetObjects( p ) (p)->pfnGetObjects
+#define DLM_GSetObjects( p ) (p)->pfnSetObjects
+#define DLM_GSetItemFocus( p ) (p)->pfnSetItemFocus
+#define DLM_GMaxNumObjects( p ) (p)->bMaxNumObjects
+#define DLM_GGetObjBuffer( p ) (p)->pGetObjBuffer
+
+// New macros for accessing the fields in DLM_ITEM and DLM_HEADER.
+
+#define DLM_GetMode( x ) ( (x)->bMode )
+#define DLM_SetMode( x, y ) ( (x)->bMode = (y) )
+
+#define DLM_GetDisplay( x ) ( (x)->bDisplay )
+#define DLM_SetDisplay( x, y ) ( (x)->bDisplay = (y) )
+
+#define DLM_GetListBoxType( x ) ( (x)->bListBoxType )
+#define DLM_SetListBoxType( x, y ) ( (x)->bListBoxType = (y) )
+
+#define DLM_GetDisplayHdr( x ) ( (x)->lpdsListHdr )
+#define DLM_SetDisplayHdr( x, y ) ( (x)->lpdsListHdr = (PVOID) (y) )
+
+#define DLM_GetTextFont( x ) ( (x)->nTextFont )
+#define DLM_SetTextFont( x, y ) ( (x)->nTextFont = (WORD) (y) )
+
+#define DLM_GetFnGetItemCount( x ) ( (x)->pfnGetItemCount )
+#define DLM_SetFnGetItemCount( x, y ) ( (x)->pfnGetItemCount = (GET_COUNT_PTR) (y) )
+
+#define DLM_GetFnGetFirstItem( x ) ( (x)->pfnGetFirstItem )
+#define DLM_SetFnGetFirstItem( x, y ) ( (x)->pfnGetFirstItem = (GET_FIRST_PTR) (y) )
+
+#define DLM_GetFnGetNext( x ) ( (x)->pfnGetNext )
+#define DLM_SetFnGetNext( x, y ) ( (x)->pfnGetNext = (GET_NEXT_PTR (y) )
+
+#define DLM_GetFnGetPrev( x ) ( (x)->pfnGetPrev )
+#define DLM_SetFnGetPrev( x, y ) ( (x)->pfnGetPrev = (GET_PREV_PTR (y) )
+
+#define DLM_GetFnGetTag( x ) ( (x)->pfnGetTag )
+#define DLM_SetFnGetTag( x, y ) ( (x)->pfnGetTag = (GET_TAG_PTR (y) )
+
+#define DLM_GetFnSetTag( x ) ( (x)->pfnSetTag )
+#define DLM_SetFnSetTag( x, y ) ( (x)->pfnSetTag = (SET_TAG_PTR (y) )
+
+#define DLM_GetFnGetSelect( x ) ( (x)->pfnGetSelect )
+#define DLM_SetFnGetSelect( x, y ) ( (x)->pfnGetSelect = (GET_SELECT_PTR (y) )
+
+#define DLM_GetFnSetSelect( x ) ( (x)->pfnSetSelect )
+#define DLM_SetFnSetSelect( x, y ) ( (x)->pfnSetSelect = (SET_SELECT_PTR (y) )
+
+#define DLM_GetFnGetObjects( x ) ( (x)->pfnGetObjects )
+#define DLM_SetFnGetObjects( x, y ) ( (x)->pfnGetObjects = (GET_OBJECTS_PTR (y) )
+
+#define DLM_GetFnSetObjects( x ) ( (x)->pfnSetObjects )
+#define DLM_SetFnSetObjects( x, y ) ( (x)->pfnSetObjects = (SET_OBJECTS_PTR (y) )
+
+#define DLM_GetFnSetItemFocus( x ) ( (x)->pfnSetItemFocus )
+#define DLM_SetFnSetItemFocus( x, y ) ( (x)->pfnSetItemFocus = (SET_FOCUS_PTR (y) )
+
+#define DLM_GetMaxNumObjects( x ) ( (x)->bMaxNumObjects )
+#define DLM_SetMaxNumObjects( x, y ) ( (x)->bMaxNumObjects = (y) )
+
+#define DLM_GetBufferForObjects( x ) ( (x)->pGetObjBuffer )
+#define DLM_SetBufferForObjects( x, y ) ( (x)->pGetObjBuffer = (PVOID) (y) )
+
+#define DLM_GetColWidth( x ) ( (x)->cxColWidth )
+#define DLM_SetColWidth( x, y ) ( (x)->cxColWidth = (USHORT) (y) )
+
+#define DLM_GetColHeight( x ) ( (x)->cyColHeight )
+#define DLM_SetColHeight( x, y ) ( (x)->cyColHeight = (USHORT) (y) )
+
+#define DLM_GetCheckBoxWidth( x ) ( (x)->cxCheckBoxWidth )
+#define DLM_SetCheckBoxWidth( x, y ) ( (x)->cxCheckBoxWidth = (USHORT) (y) )
+
+#define DLM_GetCheckBoxHeight( x ) ( (x)->cyCheckBoxHeight )
+#define DLM_SetCheckBoxHeight( x, y ) ( (x)->cyCheckBoxHeight = (USHORT) (y) )
+
+#define DLM_GetBitMapWidth( x ) ( (x)->cxBitMapWidth )
+#define DLM_SetBitMapWidth( x, y ) ( (x)->cxBitMapWidth = (USHORT) (y) )
+
+#define DLM_GetBitMapHeight( x ) ( (x)->cyBitMapHeight )
+#define DLM_SetBitMapHeight( x, y ) ( (x)->cyBitMapHeight = (USHORT) (y) )
+
+#define DLM_GetTextWidth( x ) ( (x)->cxTextWidth )
+#define DLM_SetTextWidth( x, y ) ( (x)->cxTextWidth = (USHORT) (y) )
+
+#define DLM_GetTextHeight( x ) ( (x)->cyTextHeight )
+#define DLM_SetTextHeight( x, y ) ( (x)->cyTextHeight = (USHORT) (y) )
+
+#define DLM_GetTrkPtFailure( x ) ( (x)->usTrkPtFailure )
+#define DLM_SetTrkPtFailure( x, y ) ( (x)->usTrkPtFailure = (USHORT) (y) )
+
+// Used by DLM only. Relates to the DLM_HEADER structure.
+
+#define DLM_HdrFirstItem( p ) (p)->dhFirstItem
+#define DLM_HdrLastItem( p ) (p)->dhLastItem
+#define DLM_HdrFirstDisp( p ) (p)->dhFirstDisp
+#define DLM_HdrLastDisp( p ) (p)->dhLastDisp
+#define DLM_HdrAnchorItem p ) (p)->dhAnchorItem
+
+
+// Used to access DLM_ITEM */
+
+#define DLM_ItemcbNum( p ) (p)->cbNum
+#define DLM_ItembType( p ) (p)->bType
+#define DLM_ItemwId( p ) (p)->wId
+#define DLM_ItembTextMode( p ) (p)->bTextMode
+#define DLM_ItembMaxTextLen( p ) (p)->bMaxTextLen
+#define DLM_ItembLevel( p ) (p)->bLevel
+#define DLM_ItembTag( p ) (p)->bTag
+#define DLM_ItemqszString( p ) (p)->szText
+
+// New macros for accessing the fields in DLM_ITEM
+
+#define DLM_GetItemNumber( x ) ( (x)->cbNum )
+#define DLM_SetItemNumber( x, y ) ( (x)->cbNum = (y) )
+
+#define DLM_GetItemType( x ) ( (x)->bType )
+#define DLM_SetItemType( x, y ) ( (x)->bType = (y) )
+
+#define DLM_GetItemId( x ) ( (x)->wId )
+#define DLM_SetItemId( x, y ) ( (x)->wId = (y) )
+
+#define DLM_GetItemTextMode( x ) ( (x)->bTextMode )
+#define DLM_SetItemTextMode( x, y ) ( (x)->bTextMode = (y) )
+
+#define DLM_GetItemMaxTextLen( x ) ( (x)->bMaxTextLen )
+#define DLM_SetItemMaxTextLen( x, y ) ( (x)->bMaxTextLen = (y) )
+
+#define DLM_GetItemLevel( x ) ( (x)->bLevel )
+#define DLM_SetItemLevel( x, y ) ( (x)->bLevel = (y) )
+
+#define DLM_GetItemTag( x ) ( (x)->bTag )
+#define DLM_SetItemTag( x, y ) ( (x)->bTag = (y) )
+
+#define DLM_GetItemText( x ) ( (x)->szText )
+#define DLM_SetItemText( x, y ) ( lstrcpy ( (x)->szText, (y) ) )
+
+VOID DLM_Deinit ( VOID ) ;
+WORD DLM_Init ( HWND hWnd ) ;
+WORD DLM_DispListInit ( PVOID pWinInfo, DLM_INIT_PTR pdsInit ) ;
+WORD DLM_DispListTerm ( PVOID pWinInfo, HWND hWndCtl ) ;
+WORD DLM_DispListProc ( HWND hWndCtl, WORD iAnchorIndex, LMHANDLE dhAnchorHandle ) ;
+WORD DLM_DispListModeGet ( HWND hWnd, BYTE bType, LPBYTE lpbMode ) ;
+WORD DLM_DispListModeSet ( HWND hWnd, BYTE bType, BYTE bMode ) ;
+WORD DLM_SetAnchor ( HWND hWndCtl, WORD iAnchorItem, LMHANDLE dhAnchorAddr ) ;
+WORD DLM_Update ( HWND hWnd, BYTE bType, WORD wMsg, LMHANDLE dhStartItem, USHORT usCnt ) ;
+WORD DLM_UpdateFocus ( HWND hWndLB, BOOL fSetFocus ) ;
+WORD DLM_UpdateTags ( HWND hWnd, BYTE bType ) ;
+
+WORD DLM_WMSize ( HWND hWnd, MP1 mp1, MP2 mp2 ) ;
+WORD DLM_WMDestroy ( HWND hWnd ) ;
+WORD DLM_WMLButton ( HWND hWnd, WORD wMsg, MP1 mp1, MP2 mp2 ) ;
+WORD DLM_WMDrawItem ( HWND hWnd, LPDRAWITEMSTRUCT lpdis ) ;
+WORD DLM_WMMeasureItem ( HWND hWnd, LPMEASUREITEMSTRUCT lParam ) ;
+WORD DLM_WMDeleteItem ( HWND hWnd, LPDELETEITEMSTRUCT lParam ) ;
+WORD DLM_LBNmessages ( HWND hWnd, MP1 mp1, MP2 mp2 ) ;
+BOOL DLM_KeyDown ( HWND hWnd, LPWORD pwKey, MP2 mp2 ) ;
+BOOL DLM_KeyUp ( HWND hWnd, LPWORD pwKey, MP2 mp2 ) ;
+WORD DLM_WMTrackPoint ( HWND hWnd, MP1 mp1, MP2 mp2 ) ;
+BOOL DLM_CursorInCheckBox ( HWND hWnd, POINT pt ) ;
+PVOID DLM_GetObjectsBuffer ( HWND hWndCtl ) ;
+VOID DLM_ScrollListBox ( HWND hWnd, WORD wType ) ;
+PVOID DLM_GetFocusItem ( HWND hWndCtl ) ;
+VOID DLM_SetFocusItem ( LPDRAWITEMSTRUCT lpdis, LPRECT prcItem ) ;
+BOOL DLM_CharToItem ( HWND hWndListBox, DLM_HEADER_PTR pHdr, LPWORD pwKey ) ;
+VOID DLM_SetHorizontalExt ( HWND hWndCtl, DLM_HEADER_PTR pHdr , PVOID pListItem ) ;
+VOID DLM_SetFont ( HWND hWnd ) ;
+
+INT DLM_GetPixelStringWidth ( HWND hWndLB, LPSTR lpString, INT nStringLen );
+
+DLM_ITEM_PTR DLM_GetFirstObject( LPBYTE lpObjLst , LPBYTE bpObjCnt ) ;
+DLM_HEADER_PTR DLM_GetDispHdr( HWND hWndCtl ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/dlm_prv.h b/private/utils/ntbackup/inc/dlm_prv.h
new file mode 100644
index 000000000..7859c9d22
--- /dev/null
+++ b/private/utils/ntbackup/inc/dlm_prv.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: DLM_PRV.H
+
+ Description: This header file contains private defines, prototypes,
+ and variables for the display list manager.
+
+ $Log: G:/UI/LOGFILES/DLM_PRV.H_V $
+
+ Rev 1.10 01 Nov 1992 16:30:40 DAVEV
+Unicode changes
+
+ Rev 1.9 04 Oct 1992 19:46:50 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.8 08 Sep 1992 10:37:22 ROBG
+Changed the x and y positions to short versus USHORT.
+
+ Rev 1.7 15 Jan 1992 15:22:52 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.6 26 Dec 1991 10:22:00 ROBG
+Removed prototype for DLM_DrawLMapSText.
+
+ Rev 1.5 19 Dec 1991 09:40:10 ROBG
+Fixed bug.
+
+ Rev 1.4 19 Dec 1991 09:38:28 ROBG
+Added DLM_GetWidth
+
+
+ Rev 1.3 19 Dec 1991 08:43:12 ROBG
+Added mwpTempObjBuff.
+
+ Rev 1.2 17 Dec 1991 17:34:42 ROBG
+Added two fields to remember the maximum width of a character font.
+
+ Rev 1.1 17 Dec 1991 14:02:28 ROBG
+Move out the definition DLM_GetDispHdr.
+
+ Rev 1.0 20 Nov 1991 19:33:48 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef dlm_prv_h
+#define dlm_prv_h
+
+VOID DLM_GetRect ( HWND hWndCtl, DLM_HEADER_PTR pHdr,
+// LPSHORT pcxPos, short cyPos,
+ SHORT *pcxPos, short cyPos,
+ LPRECT lpRect, DLM_ITEM_PTR lpDispItem ) ;
+
+VOID DLM_GetWidth ( HWND hWndCtl, DLM_HEADER_PTR pHdr,
+ SHORT * pcxPos, DLM_ITEM_PTR lpDispItem ) ;
+// LPSHORT pcxPos, DLM_ITEM_PTR lpDispItem ) ;
+
+WORD DLM_ProcessButton ( HWND hWnd , DLM_HEADER_PTR pHdr, WORD msg,
+ LPRECT lpRect, USHORT wCurSel,
+ LMHANDLE dhListItem,DLM_ITEM_PTR lpDispItem ) ;
+WORD DLM_DrawLMapLText ( HWND hWnd, LPDRAWITEMSTRUCT lpdis ) ;
+WORD DLM_DrawSMapLText ( HWND hWnd, LPDRAWITEMSTRUCT lpdis ) ;
+WORD DLM_DrawTree ( HWND hWnd, LPDRAWITEMSTRUCT lpdis ) ;
+BOOL DLM_IsFocusInWindow( HWND hWnd,HWND hWndCtl ) ;
+
+VOID DLM_InitScrnValues ( DLM_HEADER_PTR pHdr ) ;
+WORD DLM_LBNflatmsgs ( HWND hWnd, MP1 mp1, MP2 mp2 ) ;
+VOID DLM_SpaceBarPressed ( HWND hWndListBox, DLM_HEADER_PTR pHdr, LPWORD pwKey ) ;
+
+
+// Module wide variables
+
+INT16 mwDLMInflate ;
+
+USHORT mwcxDLMFontFilesMaxWidth ;
+USHORT mwcxDLMFontFilesWidth ;
+USHORT mwcyDLMFontFilesHeight ;
+
+USHORT mwcxDLMIconLabelsMaxWidth ;
+USHORT mwcxDLMIconLabelsWidth ;
+USHORT mwcyDLMIconLabelsHeight ;
+
+USHORT mwcxDLMFontLogMaxWidth ;
+USHORT mwcxDLMFontLogWidth ;
+USHORT mwcyDLMFontLogHeight ;
+
+BYTE mwfFontSizesSet ;
+LPSTR mwpTempObjBuff ;
+#endif
+
+
+
diff --git a/private/utils/ntbackup/inc/do_misc.h b/private/utils/ntbackup/inc/do_misc.h
new file mode 100644
index 000000000..dbe6dc880
--- /dev/null
+++ b/private/utils/ntbackup/inc/do_misc.h
@@ -0,0 +1,62 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: do_misc.h
+
+ Description: Miscellaneous functions used prior to calling loops engines
+
+
+ $Log: G:/UI/LOGFILES/DO_MISC.H_V $
+
+ Rev 1.5 04 Oct 1992 19:46:52 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 22 Jan 1992 16:58:00 JOHNWT
+removed UI_RequestTape
+
+ Rev 1.3 10 Jan 1992 12:39:38 JOHNWT
+added UI_DisplayBSDVCB
+
+ Rev 1.2 12 Dec 1991 11:07:34 JOHNWT
+removed UI_GetPasswordsAndLabels
+
+ Rev 1.1 03 Dec 1991 18:15:32 JOHNWT
+added UI_RequestTape
+
+ Rev 1.0 20 Nov 1991 19:41:38 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _do_misc_h_
+#define _do_misc_h_
+
+#include "tpos.h"
+
+/* return values for do_*( ) */
+
+#define ABNORMAL_TERMINATION 1
+#define FILES_SKIPPED 2
+#define FILES_DIFFERENT 3
+
+INT16 UI_ExcludeInternalFiles( INT16 operation ) ;
+UINT16 UI_CheckOldTapePassword( struct DBLK *cur_vcb ) ;
+UINT16 UI_UpdateTpos( TPOS_PTR tpos, DBLK_PTR cur_vcb, BOOLEAN next_set_desired ) ;
+VOID UI_DisplayVCB( struct DBLK * vcb_ptr ) ;
+VOID UI_DisplayBSDVCB( BSD_PTR ) ;
+INT16 UI_ReplaceTape( CHAR_PTR drive_name ) ;
+INT16 UI_ReplaceBlankTape( CHAR_PTR drive_name ) ;
+INT16 UI_ReplaceForeignTape( CHAR_PTR drive_name ) ;
+INT16 UI_InsertTape( CHAR_PTR drive_name ) ;
+BOOLEAN UI_CheckUserAbort( UINT16 message ) ;
+VOID UI_CheckContinueDots( BOOLEAN_PTR dot_dot_mode, UINT16_PTR dot_dot_msg, UINT16 message ) ;
+INT16 UI_ProcessVCBatEOD( TPOS_PTR tpos, CHAR_PTR drive_name ) ;
+INT16 UI_PromptNextTape( TPOS_PTR tpos, DBLK_PTR cur_vcb, BOOLEAN valid_vcb_flag, UINT16 mode, CHAR_PTR tape_name, CHAR_PTR drive_name ) ;
+BOOLEAN UI_ReturnToTOC( UINT16 channel, BOOLEAN check_tape_change ) ;
+INT16 UI_HandleTapeReadError( CHAR_PTR drive_name ) ;
+INT16 TryToCreateFFRQueue( struct LIS *, INT16 ) ;
+VOID UI_ChkDispGlobalError ( VOID ) ;
+VOID UI_AddSpecialIncOrExc( BSD_PTR bsd, BOOLEAN IsInclude ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/dos_fs.h b/private/utils/ntbackup/inc/dos_fs.h
new file mode 100644
index 000000000..12fd061cf
--- /dev/null
+++ b/private/utils/ntbackup/inc/dos_fs.h
@@ -0,0 +1,279 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dos_fs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the prototypes for the DOS
+ file system functions.
+
+ $Log: O:/LOGFILES/DOS_FS.H_V $
+ *
+ * Rev 1.10 03 Nov 1992 16:29:58 TIMN
+ * Added macros for processing streams
+ *
+ * Rev 1.9 21 Oct 1992 13:09:06 CARLS
+ * changed DOS_SetHandObjSizeLo to DOS_SetHandObjSize because size is now UINT64
+ *
+ * Rev 1.8 29 Sep 1992 17:47:28 CHUCKB
+ * Added s_info to prototype for DOSCompleteBlk().
+ *
+ * Rev 1.7 24 Sep 1992 12:00:48 TIMN
+ * Deleted references to f(x) FS_GetTotalSizeDBLK()
+ *
+ * Rev 1.6 24 Sep 1992 11:58:04 TIMN
+ * Updated DOS FileSys to support MTF v4.0 format (stream info structs in data streams)
+ *
+ * Rev 1.5 14 May 1992 17:03:24 STEVEN
+ * 40 format
+ *
+ * Rev 1.4 13 May 1992 16:50:02 STEVEN
+ * 40 FORMAT update
+ *
+ * Rev 1.3 13 Dec 1991 09:30:44 STEVEN
+ * move common functions to tabels
+ *
+ * Rev 1.2 10 Jul 1991 13:09:54 STEVEN
+ * Added DOS_GetSpecDBLKS().
+ *
+ * Rev 1.1 23 May 1991 16:46:12 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:32:58 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+#ifndef _dos_fs_h_
+#define _dos_fs_h_
+
+#include "fsys.h"
+
+
+typedef struct DOS_RESERVED_SH_STRUCT {
+ INT16 fhdl ; /* DOS file handle */
+ INT16 active ; /* is stream being processed */
+ STREAM_INFO sh ; /* DOS reserved stream info */
+} DOS_RESERVED_SH, *DOS_RESERVED_SH_PTR ;
+
+ /* sizeof FILE_HAND plus dos reserved struct */
+#define FS_SIZEOF_RESERVED_FILE_HAND \
+ ( sizeof(FILE_HAND_STRUCT) + sizeof(DOS_RESERVED_SH) )
+
+
+#define _DEREF_HandObjHandPtr(hand) ( (DOS_RESERVED_SH_PTR)((hand)->obj_hand.ptr) )
+
+#define _DOS_GetHandObjFileHandle(hand) ( (_DEREF_HandObjHandPtr(hand)->fhdl ) )
+#define _DOS_GetHandObjSize(hand) ( (_DEREF_HandObjHandPtr(hand)->sh.size ) )
+
+#define _DOS_SetHandObjFileHandle(hand,h) ( (_DEREF_HandObjHandPtr(hand)->fhdl ) = (h) )
+#define _DOS_SetHandObjSize(hand,v) ( (_DEREF_HandObjHandPtr(hand)->sh.size = (v) ) )
+
+#define _DOS_IsStrmBeingProcessed(hand) ( (_DEREF_HandObjHandPtr(hand)->active ) )
+#define _DOS_SetStrmProcessState(hand,v) ( (_DEREF_HandObjHandPtr(hand)->active ) = (v) )
+
+#define _DOS_WriteStrmInfo(hand) ( (_DEREF_HandObjHandPtr(hand)->active ) == FALSE )
+#define _DOS_ProcessData(hand) ( (_DEREF_HandObjHandPtr(hand)->active ) == FALSE )
+#define _DOS_SetProcessData(hand,v) ( (_DEREF_HandObjHandPtr(hand)->active ) = !(v) )
+
+
+INT16 DOS_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd); /* I - passowrd NOT USED */
+
+INT16 DOS_DetachDLE( FSYS_HAND fsh ); /* I - */
+
+INT16 DOS_AllocFileHand( FILE_HAND *file_hand ) ; /* I/O - */
+VOID DOS_MemsetFileHand( FILE_HAND *file_hand ) ; /* I/O - */
+
+INT16 DOS_CreateObj( FSYS_HAND fsh, /* I - File system to create object one */
+ DBLK_PTR dblk); /* I - Describes object to create */
+
+INT16 DOS_OpenObj( FSYS_HAND fsh, /* I - file system that the file is opened on */
+ FILE_HAND *hand, /* O - allocated handle */
+ DBLK_PTR dblk, /*I/O- describes the file to be opened */
+ OPEN_MODE mode); /* I - open mode */
+
+INT16 DOS_ReadObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info ) ; /*I/O- struct to place stream header info */
+
+
+INT16 DOS_WriteObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size need for next read */
+ STREAM_INFO_PTR s_info ) ; /*I/O- struct to place stream header info */
+
+INT16 DOS_VerObj( FILE_HAND hand, /* I - file handle to verify data with */
+ CHAR_PTR buf, /* I - buffer needed to perform verify */
+ CHAR_PTR data, /* I - data to verify against */
+ UINT16 *size, /*I/O- size of buffers / amount verified */
+ UINT16 *blk_size, /* O - minum size of block for next call */
+ STREAM_INFO_PTR s_info ) ; /*I/O- struct to place stream header info */
+
+
+INT16 DOS_CloseObj( FILE_HAND hand ); /* I - handle of object to close */
+
+INT16 DOS_DeleteObj( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 DOS_FindFirst( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+ CHAR_PTR sname, /* I - search name */
+ UINT16 obj_type); /* I - object type (all objs, dirs, etc.) */
+
+INT16 DOS_FindNext( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* O - Discriptor block */
+
+INT16 DOS_GetObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /*I/O- On entry it is minimal on exit Complete */
+
+INT16 DOS_VerObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to compare OS against */
+
+INT16 DOS_ChangeDir( FSYS_HAND fsh, /* I - file system to changing directories on */
+ CHAR_PTR path, /* I - describes the path of the new directory */
+ INT16 psize); /* I - specifies the length of the path */
+
+INT16 DOS_UpDir( FSYS_HAND fsh ); /* I - file system to change directories in */
+
+INT16 DOS_GetCurrentPath( FSYS_HAND fsh, /* I - file system to get current path from */
+ CHAR_PTR path, /* O - buffer to place this path */
+ INT16 *size); /*I/O- size of buffer on entry & on exit */
+
+INT16 DOS_SeekObj( FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ); /*I/O- Offset to seek; Number of bytes actualy seeked */
+
+INT16 DOS_GetMaxSizeDBLK( FSYS_HAND fsh /* not used */ );
+
+INT16 DOS_GetBasePath( FSYS_HAND fsh, /* I - file system to get base path from */
+ CHAR_PTR full_path, /* O - buffer to place this path */
+ INT16 *size ); /*I/O- size of buffer on entry & on exit */
+
+INT16 DOS_GetCurrentDDB( FSYS_HAND fsh, /* I - file system to get DDB from */
+ DBLK_PTR dblk ); /* O - place to put the DDB data */
+
+INT16 DOS_SetObjInfo( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk); /* I - data to write to disk */
+
+INT16 DOS_ModFnameFDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it, /* I - TRUE if setting file name, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get file name from */
+ CHAR_PTR buf, /*I/O- file name to read (or to write) */
+ INT16 *size ) ; /*I/O- size buffer on entry and exit */
+
+INT16 DOS_ModPathDDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it , /* I - TRUE if setting path, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get path from */
+ CHAR_PTR buf, /*I/O- path to read (or to write) */
+ INT16 *size ); /*I/O- size of buffer on entry and exit */
+
+INT16 DOS_GetOSFnameFDB( DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 DOS_GetOSPathDDB(
+ FSYS_HAND fsh, /* I - File System handle */
+ DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 DOS_GetFileVerFDB( DBLK_PTR dblk ,
+ UINT32 *version ) ;
+
+INT16 DOS_GetCdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ); /*I/O- createion date to read (or to write) */
+
+INT16 DOS_GetMdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /* O - modify date to write */
+
+INT16 DOS_ModBdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 DOS_ModAdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+UINT64 DOS_GetDisplaySizeDBLK( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+INT16 DOS_GetOS_InfoDBLK( DBLK_PTR dblk, /* I - DBLK to get the info from */
+ CHAR_PTR os_info, /* O - Buffer to place data */
+ INT16 *size ); /*I/O- Buffer size / data length */
+
+
+INT16 DOS_ModAttribDBLK( BOOLEAN set_it ,
+ DBLK_PTR dblk ,
+ UINT32_PTR attr );
+
+
+INT16 DOS_GetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE *type );
+
+
+INT16 DOS_GetActualSizeDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 DOS_SizeofFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ); /* I - dblk to get fname from */
+
+INT16 DOS_SizeofOSFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ) ; /* I - dblk to get fname from */
+
+INT16 DOS_SizeofPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 DOS_SizeofOSPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 DOS_SizeofOSInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to get size of OS info for */
+
+
+INT16 DOS_PushMinDDB( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 DOS_PopMinDDB( FSYS_HAND fsh ,
+ DBLK_PTR dblk );
+
+INT16 DOS_CreateFDB( FSYS_HAND fsh,
+ GEN_FDB_DATA_PTR dat ) ;
+
+INT16 DOS_CreateDDB( FSYS_HAND fsh,
+ GEN_DDB_DATA_PTR dat ) ;
+
+INT16 DOS_CreateIDB( FSYS_HAND fsh,
+ GEN_IDB_DATA_PTR dat ) ;
+
+VOID DOS_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+BOOLEAN DOS_ProcessDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 DOS_ChangeIntoDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+VOID DOS_GetRealBasePath( FSYS_HAND fsh, CHAR_PTR path ) ;
+
+
+INT16 DOS_GetSpecDBLKS(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ INT32 *index );
+
+INT16 DOS_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask );
+
+VOID DOS_GetVolName( GENERIC_DLE_PTR dle, CHAR_PTR buffer ) ;
+
+INT16 DOS_SizeofVolName( GENERIC_DLE_PTR dle ) ;
+
+BOOLEAN DOS_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+INT16 DOS_CompleteBlk( FSYS_HAND fsh, DBLK_PTR dblk, CHAR_PTR buffer, UINT16 *size, STREAM_INFO_PTR sinfo ) ;
+VOID DOS_ReleaseBlk( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+VOID DOS_InitMakeData( FSYS_HAND fsh, INT16 blk_type, CREATE_DBLK_PTR data ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/doscom.h b/private/utils/ntbackup/inc/doscom.h
new file mode 100644
index 000000000..407eb6f30
--- /dev/null
+++ b/private/utils/ntbackup/inc/doscom.h
@@ -0,0 +1,170 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: doscom.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: DOS utility functions.
+
+
+ $Log: M:/LOGFILES/DOSCOM.H_V $
+ *
+ * Rev 1.6 08 Jul 1992 15:19:20 BARRY
+ * Added extended error stuff.
+ *
+ * Rev 1.5 24 Feb 1992 17:06:54 BARRY
+ * Fixed MakePath overflow problem.
+ *
+ * Rev 1.4 20 Dec 1991 09:12:54 STEVEN
+ * move common functions into tables
+ *
+ * Rev 1.3 25 Nov 1991 15:47:10 STEVEN
+ * need to reset DTA
+ *
+ * Rev 1.2 10 Sep 1991 18:18:56 DON
+ * types needed to be declared the same as WATCOM
+ *
+ * Rev 1.1 23 May 1991 16:46:32 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:33:38 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _doscom_h_
+#define _doscom_h_
+
+#define DOS_MAX_DSIZE 128
+#define DOS_MAX_FSIZE 13
+
+typedef struct DOS_DTA {
+ CHAR reserved[21];
+ UINT8 attr;
+ UINT16 time;
+ UINT16 date;
+ UINT32 size;
+ CHAR name[ DOS_MAX_FSIZE + 1 ];
+} DOS_DTA;
+
+
+
+/* The following macros convert a dos format date or time UINT16 into */
+/* a UINT16 suitable for placing in a DATE_TIME structure. */
+
+#define GET_DOS_YEAR( dos_date ) ( 1980 + ( (UINT16)(dos_date) >> 9 ) )
+#define GET_DOS_MONTH( dos_date ) (((dos_date) & 0x1ff) >> 5)
+#define GET_DOS_DAY( dos_date ) ( (dos_date) & 0x1f )
+#define GET_DOS_HOUR( dos_time ) ( ((UINT16)(dos_time)) >> 11 )
+#define GET_DOS_MINUTE( dos_time ) ( ( (dos_time) & 0x7e0 ) >> 5 )
+#define GET_DOS_SECOND( dos_time ) ( ( (dos_time) & 0x1f ) << 1 )
+
+
+#define DA_READONLY 0x01
+#define DA_HIDDEN 0x02
+#define DA_SYSTEM 0x04
+#define DA_DIRECTORY 0x10
+#define DA_MODIFIED 0x20
+
+#define DENY_NONE_MODE 0x40
+#define DENY_WRITE_MODE 0x20
+#define COMPATIBLE_MODE 0x00
+
+#define READ_ACCESS 0x00
+#define WRITE_ACCESS 0x01
+
+
+enum {
+ DOS_LOCUS_UNKNOWN = 1,
+ DOS_LOCUS_BLOCK_DEVICE,
+ DOS_LOCUS_NETWORK,
+ DOS_LOCUS_SERIAL,
+ DOS_LOCUS_MEMORY
+};
+
+enum {
+ DOS_ACTION_RETRY = 1,
+ DOS_ACTION_DELAY_RETRY,
+ DOS_ACTION_USER_INPUT,
+ DOS_ACTION_QUIT,
+ DOS_ACTION_EXIT,
+ DOS_ACTION_IGNORE,
+ DOS_ACTION_RETRY_USER
+};
+
+enum {
+ DOS_CLASS_OUT_OF_RESOURCE = 1,
+ DOS_CLASS_TEMP_SITUATION,
+ DOS_CLASS_AUTHORIZATION,
+ DOS_CLASS_INTERNAL,
+ DOS_CLASS_HARDWARE,
+ DOS_CLASS_SYSTEM,
+ DOS_CLASS_APP_ERROR,
+ DOS_CLASS_NOT_FOUND,
+ DOS_CLASS_BAD_FORMAT,
+ DOS_CLASS_LOCKED,
+ DOS_CLASS_MEDIA,
+ DOS_CLASS_ALREADY_EXISTS,
+ DOS_CLASS_UNKNOWN
+};
+
+INT16 GetExtendErrDOS( VOID ) ;
+
+VOID GetErrorClassDOS( UINT16 *extended_err,
+ UINT8 *error_class,
+ UINT8 *locus,
+ UINT8 *action );
+
+INT16 CreateFileDOS( CHAR_PTR path, UINT16 *hand ) ;
+
+INT16 CreateDirDOS( CHAR_PTR path );
+
+INT16 SetAttribDOS( CHAR_PTR path, INT16 attrib );
+
+INT16 DeleteFileDOS( CHAR_PTR path ) ;
+
+INT16 DeleteDirDOS( CHAR_PTR path );
+
+UINT16 ClusterAvailDOS( CHAR drive );
+
+INT16 FindFirstDOS( CHAR_PTR path, struct DOS_DTA * dta, UINT16 obj_type ) ;
+
+INT16 FindNextDOS( struct DOS_DTA * dta, UINT16 obj_type ) ;
+
+VOID * SetDTA( struct DOS_DTA * dta ) ;
+
+INT16 OpenFileDOS( CHAR_PTR path, UINT16 open_mode, UINT16 *hand, UINT32 *size ) ;
+
+INT16 CloseFileDOS( UINT16 hand ) ;
+
+INT16 LockFileDOS( UINT16 hand );
+
+INT16 UnlockFileDOS( UINT16 hand );
+
+INT16 GetExtendErrDOS( VOID ) ;
+
+INT16 ReadFileDOS( UINT16 hand, UINT32 pos, CHAR_PTR buf, UINT16 *size ) ;
+
+INT16 WriteFileDOS( UINT16 hand, CHAR_PTR buf, UINT16 *size ) ;
+
+INT16 SeekFileDOS( UINT16 hand, INT32 offset, INT16 mode );
+
+INT16 SetFileDateTimeDOS( UINT16 hand, UINT16 date, UINT16 time );
+
+UINT16 DOS_ValidFileName( CHAR_PTR name );
+
+VOID DOS_MakeName( CHAR_PTR dest, CHAR_PTR source, UINT8 os_id, UINT8 os_ver ) ;
+
+VOID DOS_MakePath( CHAR_PTR dest, INT16 destsize, CHAR_PTR source, INT16 leng, UINT8 os_id, UINT8 os_ver ) ;
+
+INT16 MatchFname( CHAR_PTR name1, CHAR_PTR name2 );
+
+BOOLEAN IsMappedDrive( CHAR drive ) ;
+
+BOOLEAN IsNetDrive( CHAR drive ) ;
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/dosdblk.h b/private/utils/ntbackup/inc/dosdblk.h
new file mode 100644
index 000000000..8c1f49aca
--- /dev/null
+++ b/private/utils/ntbackup/inc/dosdblk.h
@@ -0,0 +1,74 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dosdblk.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the definition of the DOS
+ file and directory control blocks.
+
+
+ $Log: G:/LOGFILES/DOSDBLK.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:31:12 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+
+#ifndef dosdblk_h
+#define dosdblk_h
+
+
+#include "queues.h"
+#include "doscom.h"
+
+
+typedef struct DOS_FDB_INFO *DOS_FDB_INFO_PTR;
+
+typedef struct DOS_FDB_INFO {
+ BOOLEAN inuse_attrib ;
+ UINT16 handle ; /* set: DOS_CreateFile */
+ UINT16 os_name ;
+} DOS_FDB_INFO ;
+
+
+typedef struct DOS_DDB_INFO *DOS_DDB_INFO_PTR;
+
+typedef struct DOS_DDB_INFO {
+ BOOLEAN empty_attrib ;
+ CHAR path[ DOS_MAX_DSIZE ] ; /* build from "name" and current dir */
+ UINT16 os_path ;
+ UINT16 os_path_leng ;
+} DOS_DDB_INFO;
+
+
+
+typedef struct DOS_DBLK *DOS_DBLK_PTR;
+
+typedef struct DOS_DBLK {
+ UINT8 blk_type; /* values: DDB_ID, FDB_ID set: DOS */
+ COM_DBLK fs_reserved ;
+ DOS_DTA dta;
+ BOOLEAN os_info_complete; /* TRUE if GetObjInfo doesn't have to do anything */
+ UINT16 tape_attribs ;
+ union {
+ DOS_DDB_INFO d;
+ DOS_FDB_INFO f;
+ } b;
+} DOS_DBLK;
+
+
+typedef struct DOS_MIN_DDB *DOS_MIN_DDB_PTR;
+
+typedef struct DOS_MIN_DDB {
+ Q_ELEM q ;
+ UINT8 reserved[ 21 ] ; /* reserved for dos */
+ UINT16 psize ; /* size of path string */
+ CHAR_PTR path; /* build from "name" and current dir */
+} DOS_MIN_DDB;
+
+#endif
diff --git a/private/utils/ntbackup/inc/drive.h b/private/utils/ntbackup/inc/drive.h
new file mode 100644
index 000000000..8e3187d42
--- /dev/null
+++ b/private/utils/ntbackup/inc/drive.h
@@ -0,0 +1,135 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: drive.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This contains the internal drive definition structure. This
+ is a superset of the THW structure that is used by the
+ upper layers.
+
+
+ $Log: G:/LOGFILES/DRIVE.H_V $
+ *
+ * Rev 1.11 17 Mar 1993 14:57:34 GREGG
+ * This is Terri Lynn. Added Gregg's changes to switch a tape drive's block mode
+ * to match the block size of the current tape
+ *
+ * Rev 1.10 09 Nov 1992 10:49:14 GREGG
+ * Added macro for checking Fast EOD drive feature.
+ *
+ * Rev 1.9 05 Apr 1992 19:15:46 GREGG
+ * Added macro to check for TDI_REV_FMK drive feature.
+ *
+ * Rev 1.8 08 Feb 1992 14:37:06 GREGG
+ * Changed INT16 lst_oper element in drive structure to BOOLEAN force_rewind,
+ * since this is what the lst_oper field had been reduced to anyway.
+ *
+ * Rev 1.7 17 Oct 1991 01:17:02 GREGG
+ * BIGWHEEL - 8200SX - Added support macros.
+ *
+ * Rev 1.6 14 Oct 1991 10:58:14 GREGG
+ * Added TF_PollDrive state st_BSTAT (busy statusing).
+ *
+ * Rev 1.5 28 Sep 1991 21:45:24 GREGG
+ * Added two booleans to poll_stuff.
+ *
+ * Rev 1.4 09 Sep 1991 21:19:24 GREGG
+ * Added elements to drive structure for TF_PollDrive.
+ *
+ * Rev 1.3 15 Jul 1991 14:54:58 NED
+ * Removed unnecessary include.
+ *
+ * Rev 1.2 05 Jun 1991 19:15:48 NED
+ * changed include list
+ *
+ * Rev 1.1 10 May 1991 17:09:54 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:04 GREGG
+Initial revision.
+
+**/
+#ifndef _DRIVE_STUFF
+#define _DRIVE_STUFF
+
+#include "thw.h"
+#include "dblks.h"
+#include "tloc.h"
+#include "buffman.h"
+#include "tflstats.h"
+/* $end$ include list */
+
+typedef struct {
+ VOID_PTR channel ;
+ INT16 state ;
+ BOOLEAN no_tape_reported ;
+ BOOLEAN reentered ;
+ BOOLEAN first_status ;
+ INT blk_size_idx ;
+ UINT16 def_blk_size ;
+} POLL_STUFF ;
+
+
+typedef struct {
+ THW thw_inf ; /* Tape Hardware Structure */
+ Q_HEADER inproc_q ; /* Buffers that have been sent to the drive */
+ BOOLEAN trans_started ;/* Transfer was started */
+ BOOLEAN vcb_valid ; /* Is the DBLK VCB below valid */
+ BOOLEAN tape_mounted ; /* Is the tape mounted */
+ DBLK cur_vcb ; /* Current VCB */
+ BUF_PTR hold_buff ; /* For watches */
+ UINT32 pos_inf ; /* current tape position */
+ TLOC cur_pos ; /* Current Tape Location */
+ INT16 drv_hdl ; /* Drive handle ( TFL's ) */
+ UINT16 drv_no ; /* Drive Number ( TFL's ) */
+ BOOLEAN force_rewind ; /* force rewind of current tape */
+ TF_STATS cur_stats ; /* Current Statistics */
+ UINT16 last_cur_fmt ; /* save index into Current format (r/w) */
+ VOID_PTR last_fmt_env ; /* save Current Environment Pointer for Channel */
+ POLL_STUFF poll_stuff ; /* stuff for TF_PollDrive */
+} DRIVE, *DRIVE_PTR ;
+
+/* Position Stuff */
+#define SupportBlkPos( x ) ( (x)->thw_inf.drv_info.drv_features & TDI_FAST_NBLK )
+#define SupportRevFmk( x ) ( (x)->thw_inf.drv_info.drv_features & TDI_REV_FMK )
+#define SupportFastEOD( x ) ( (x)->thw_inf.drv_info.drv_features & TDI_FAST_EOD )
+#define SupportSXShowBlk( x ) ( (x)->thw_inf.drv_info.drv_features & TDI_SHOW_BLK )
+#define SupportSXFindBlk( x ) ( (x)->thw_inf.drv_info.drv_features & TDI_FIND_BLK )
+#define CurPBAofVCB( x ) ( (x)->cur_pos.pba_vcb )
+#define DriveAttributes( x ) ( (x)->thw_inf.drv_info.drv_features )
+
+/* State Definitions for TF_PollDrive */
+/* Note: These are listed here because they are referenced in MountTape */
+
+#define st_SSDC 0 /* Same Status, Different Call */
+#define st_BSTAT 1 /* Busy STATusing */
+#define st_BMNT 2 /* Busy MouNTing */
+#define st_BREW 3 /* Busy REWinding */
+#define st_BREAD 4 /* Busy READing */
+#define st_HOSED 5 /* Guess */
+#define st_CLOSED 6 /* Drive not being polled */
+
+/* Current Position Information */
+#define AT_EOD 0x00000001 /* At End of Data */
+#define AT_EOS 0x00000002 /* At End of A Set */
+#define AT_EOM 0x00000004 /* At End of Media */
+#define AT_BOT 0x00000008 /* Beginning of Tape */
+#define AT_FMK 0x00000010 /* At A FileMark */
+#define NO_STAT 0x00000020 /* Don't Status this drive */
+#define REW_CLOSE 0x00000040 /* Rewind on Close */
+#define DONT_CLOSE 0x00000080 /* Don't Close this drive */
+#define AT_MOS 0x00000100 /* In the Middle of Set */
+#define TAPE_FULL 0x00000200 /* The current tape in the drive is full */
+#define WATCHED 0x00000400 /* The driver was watched */
+#define TAPE_ERR 0x00000800 /* There was an error on this tape */
+#define SHORT_SET 0x00001000 /* This Set occupies Less than a buffer */
+
+/* Usage Macros */
+#define SetPosBit( x, b ) ( (x)->pos_inf |= (b) )
+#define ClrPosBit( x, b ) ( (x)->pos_inf &= ~(b) )
+#define IsPosBitSet( x, b ) ( (x)->pos_inf & (b) )
+
+#endif
diff --git a/private/utils/ntbackup/inc/drvinf.h b/private/utils/ntbackup/inc/drvinf.h
new file mode 100644
index 000000000..9109a37a5
--- /dev/null
+++ b/private/utils/ntbackup/inc/drvinf.h
@@ -0,0 +1,113 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+ Name: drvinf.h
+
+ Description: Structure that describes a drives features.
+
+ $Log: Q:/LOGFILES/DRVINF.H_V $
+
+ Rev 1.12 16 Apr 1993 14:22:04 chrish
+Added define for HW compression.
+
+ Rev 1.11 17 Mar 1993 15:06:02 TERRI
+Added change block size define
+
+ Rev 1.10 24 Feb 1993 15:26:26 GREGG
+Added TDI_SHORT_ERASE and TDI_LONG_ERASE feature bits.
+
+ Rev 1.9 12 Feb 1993 09:00:12 STEVEN
+added TID_FORMAT
+
+ Rev 1.8 08 Dec 1992 08:16:10 IAN
+Added defines for DRV_??? structure elements.
+
+ Rev 1.7 29 Sep 1992 14:11:00 DON
+added TDI_LOADER feature bit
+
+ Rev 1.6 14 Mar 1992 17:41:54 CLIFF
+Moved controller id to the dil hardware structure.
+
+ Rev 1.5 12 Mar 1992 21:02:46 CLIFF
+Added a controller id field.
+
+ Rev 1.4 15 Jan 1992 16:08:02 CLIFF
+Added a second firmware number
+
+ Rev 1.3 10 Jan 1992 14:43:38 CLIFF
+Added field for vendor specified id field
+
+ Rev 1.2 10 Oct 1991 11:36:34 STEVEN
+added retension type
+
+ Rev 1.1 17 Jul 1991 13:55:46 JOHNS
+Updated to current source from ENG3:SYS3.
+
+**/
+
+#ifndef DRVINF
+
+#define DRVINF
+
+#define DRV_VENDOR_LEN 8
+#define DRV_PRODUCT_LEN 16
+#define DRV_FIRMREV_LEN 4
+#define DRV_FIRMNUM_LEN 5
+#define DRV_SPEC_ID_LEN 16
+
+
+typedef struct {
+ CHAR drv_vendor[DRV_VENDOR_LEN+1] ; /* contains the vendor information */
+ CHAR drv_product[DRV_PRODUCT_LEN+1] ; /* contains the product description */
+ CHAR drv_firmnum[DRV_FIRMNUM_LEN+1] ; /* contains the firmware/product number */
+ CHAR drv_firmrev[DRV_FIRMREV_LEN+1] ; /* contains the firmware revision number */
+ CHAR drv_spec_id[DRV_SPEC_ID_LEN+1] ; /* vendor specified unique id */
+ UINT16 drv_media ; /* media type for this drive */
+ UINT16 drv_bsize ; /* contains the block size */
+ UINT32 drv_features ; /* what this drive supports */
+ UINT16 drv_addr ; /* The address of the tape */
+} DRV_INF, *DRV_INF_PTR ;
+
+
+/* The following define the attributes of the given drive */
+
+#define TDI_FAST_FMK 0x00000001 /* Fast filemark search */
+#define TDI_FAST_NBLK 0x00000002 /* Position to any block on tape */
+#define TDI_FAST_EOD 0x00000004 /* Fast position to End of Data */
+#define TDI_REV_FMK 0x00000008 /* Forward search for end of data */
+#define TDI_OVERWRITE 0x00000010 /* Overwrite */
+#define TDI_DIR_TRACK 0x00000020 /* Directory Track Support */
+#define TDI_BLK_POS 0x00000040 /* Returns Block Position */
+#define TDI_FMK 0x00000080 /* Filemarks supported */
+#define TDI_NODATA 0x00000100 /* No Data exceptions supported */
+#define TDI_NODATA_FMK 0x00000200 /* No Data exceptions supported when
+ spacing to filemark */
+#define TDI_RETENSION 0x00000800 /* the drive support retension */
+#define TDI_UNLOAD 0x00000400 /* Load unload command support */
+#define TDI_REAL_BLK_POS 0x00001000 /* Real Block Positioning required - drive does
+ not auto compensate for ECC, etc. */
+#define TDI_SHOW_BLK 0x00002000 /* SHOW Special Block capability */
+#define TDI_FIND_BLK 0x00004000 /* FIND Special Block capability */
+#define TDI_MODE_CHANGE 0x00008000 /* Supports FFR mode changing between
+ FFR and non FFR modes */
+#define TDI_LOADER 0x00010000 /* Loader Device Capability */
+#define TDI_FORMAT 0x00020000 /* Format Tape Capability (DC2000) */
+
+#define TDI_SHORT_ERASE 0x00040000 /* Supports Short Erase */
+#define TDI_LONG_ERASE 0x00080000 /* Supports Long (Secure) Erase */
+
+#define TDI_CHNG_BLK_SIZE 0x00100000 /* Supports multiple block sizes */
+
+#define TDI_DRV_COMPRESSION 0x00200000 /* chs:04-16-93 Supports hardware compression */
+#define TDI_DRV_COMPRESS_ON 0x00400000 /* chs:04-16-93 compression currently turned on */
+#define TDI_DRV_COMPRES_INIT 0x00800000 /* chs:04-16-93 compression on at init */
+
+/* Media Types */
+
+#define CARTRIDGE 0
+#define CASSETTE 1
+#define T8MM 2 /* formerly EXABYTE */
+#define T4MM 3 /* formerly DAT */
+#define UNKNOWN 0xffff
+
+#endif
diff --git a/private/utils/ntbackup/inc/ems.h b/private/utils/ntbackup/inc/ems.h
new file mode 100644
index 000000000..3483ba4cd
--- /dev/null
+++ b/private/utils/ntbackup/inc/ems.h
@@ -0,0 +1,45 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ems.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Defines all EMS constants and function prototypes
+
+ Location:
+
+
+ $Log: G:/LOGFILES/EMS.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:32:42 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+#ifndef EMS_H
+
+#define EMS_H
+
+#include "StdTypes.H"
+/*
+ Define EMS functions
+*/
+#define EMS_INIT 0x40
+#define EMS_GET_FRAME_ADDRESS 0x41
+#define EMS_GET_PAGE_COUNT 0x42
+#define EMS_ALLOCATE_PAGES 0x43
+#define EMS_MAP_PAGE 0x44
+#define EMS_DEALLOCATE_PAGES 0x45
+#define EMS_GET_EMM_VERSION 0x46
+#define EMS_SAVE_PAGE_MAP 0x47
+#define EMS_RESTORE_PAGE_MAP 0x48
+
+#define EMS_VECTOR 0x67
+
+#define EMS_PAGE_SIZE ( 1024 * 16 )
+
+UINT16 EMSFunction( UINT8, UINT16, UINT16, UINT16_PTR, UINT16 ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/ems_fs.h b/private/utils/ntbackup/inc/ems_fs.h
new file mode 100644
index 000000000..d3813d0eb
--- /dev/null
+++ b/private/utils/ntbackup/inc/ems_fs.h
@@ -0,0 +1,471 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ems_fs.h
+
+ Description: This file contains the prototypes for the NTFS
+ file system functions.
+
+ $Log: M:/LOGFILES/NTFS_FS.H_V $
+
+
+**/
+
+#include "fsys.h"
+#include "queues.h"
+
+
+//EMS String Aray
+extern CHAR_PTR gszEmsStringList[] ;
+#define EMS_String( id ) gszEmsStringList[id]
+#define MDB_Bricked 0
+#define MDB_Monolithic 1
+#define DSA 2
+#define Mailboxes 3
+#define Public_Folders 4
+
+
+typedef struct _EMS_FSYS_RESERVED {
+ UINT16 file_scan_mode ;
+ CHAR_PTR work_buf ;
+ UINT16 work_buf_size ;
+ BOOLEAN work_buf_in_use ;
+ XCHANGE_PATHS paths;
+ CHAR CheckpointFilePath[256];
+ CHAR LogPath[256];
+ CHAR jet_rstmap[256 * 3 * 2];
+ INT map_size ;
+ CHAR BackupLogPath[256];
+ ULONG low_log;
+ ULONG high_log;
+ VOID_PTR service_restart_list ;
+ INT service_restart_list_size ;
+ BOOLEAN attach_failed ;
+ PVOID restore_context ;
+
+} EMS_FSYS_RESERVED, *EMS_FSYS_RESERVED_PTR ;
+
+
+#define REG_SUBKEY_MDB_PRIVATE TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeIS\\ParametersPrivate")
+#define REG_SUBKEY_MDB_BASE TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeIS")
+#define REG_SUBKEY_MDB_RIP TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeIS\\Restore in Progress")
+#define REG_VALUE_MDB_PRIVATE TEXT("DB Path")
+#define REG_SUBKEY_MDB_PUBLIC TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeIS\\ParametersPublic")
+#define REG_VALUE_MDB_PUBLIC TEXT("DB Path")
+#define REG_SUBKEY_MDB_SYSTEM TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeIS\\ParametersSystem")
+#define REG_VALUE_MDB_SYSTEM TEXT("DB System Path")
+#define REG_VALUE_MDB_LOGDIR TEXT("DB Log Path")
+#define REG_VALUE_DISSALOW TEXT("Disallow diff/inc backup")
+#define REG_VALUE_CIRCULAR TEXT("Circular Logging")
+#define REG_SUBKEY_DSA TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeDS\\Parameters")
+#define REG_SUBKEY_DSA_BASE TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeDS")
+#define REG_SUBKEY_DSA_RIP TEXT("SYSTEM\\CurrentControlSet\\Services\\MSExchangeDS\\Restore in Progress")
+#define REG_SUBKEY_RIP TEXT("Restore in Progress")
+#define REG_VALUE_DB_PATH TEXT("DSA Database file")
+#define REG_VALUE_DSA_LOGDIR TEXT("Database log files path")
+#define REG_VALUE_DSA_SYSTEM TEXT("EDB system file")
+#define REG_VALUE_RIP_CPFILE TEXT("CheckpointFilePath")
+#define REG_VALUE_RIP_LOG_PATH TEXT("LogPath")
+#define REG_VALUE_RIP_RSTMAP TEXT("JET_RstMap")
+#define REG_VALUE_RIP_MAPSIZE TEXT("JET_RstMap Size")
+#define REG_VALUE_RIP_BKUPLOG TEXT("BackupLogPath")
+#define REG_VALUE_RIP_LOGLOW TEXT("LowLog Number")
+#define REG_VALUE_RIP_LOGHIGH TEXT("HighLog Number")
+#define SERVICE_MESSAGE_DB TEXT("MSExchangeIS")
+#define SERVICE_MAD TEXT("MSExchangeSA")
+#define SERVICE_DIRECTORY_SYNC TEXT("MSExchangeDXA")
+#define SERVICE_MESSAGE_TRANS TEXT("MSExchangeMTA")
+#define SERVICE_DIRECTORY TEXT("MSExchangeDS")
+
+
+CHAR_PTR EMS_BuildMungedName( FSYS_HAND fsh, CHAR_PTR new_path, CHAR_PTR fname ) ;
+
+INT16 EMS_ConvertJetError( INT status ) ;
+
+INT16 EMS_LoadRIP( CHAR_PTR server_name,
+ INT type,
+ CHAR_PTR CheckpointFilePath,
+ CHAR_PTR LogPath,
+ CHAR_PTR jet_rstmap,
+ INT_PTR map_size,
+ CHAR_PTR BackupLogPath,
+ INT_PTR low_log,
+ INT_PTR high_log ) ;
+
+INT16 EMS_SaveRIP( CHAR_PTR server_name,
+ INT type,
+ CHAR_PTR CheckpointFilePath,
+ CHAR_PTR LogPath,
+ CHAR_PTR jet_rstmap,
+ INT_PTR map_size,
+ CHAR_PTR BackupLogPath,
+ INT_PTR low_log,
+ INT_PTR high_log ) ;
+
+INT16 EMS_DeleteRIP( CHAR_PTR server_name,
+ INT type ) ;
+
+INT EMS_GetValFromReg(
+CHAR_PTR machine,
+CHAR_PTR key_name,
+CHAR_PTR value_name,
+CHAR_PTR buffer,
+INT buf_size ) ;
+
+INT EMS_SetValFromReg(
+CHAR_PTR machine,
+CHAR_PTR key_name,
+CHAR_PTR value_name,
+CHAR_PTR buffer );
+
+BOOLEAN EMS_IsServiceRunning( CHAR_PTR server_name, CHAR_PTR servic_name ) ;
+
+VOID EMS_ZeroCheckSum( FILE_HAND hand ) ;
+VOID EMS_CalcCheckSum( FILE_HAND hand, BYTE_PTR buf, INT size ) ;
+INT16 EMS_LoadNameList( FSYS_HAND fsh, FILE_HAND hand, INT list_type );
+
+INT16 EMS_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd); /* I - passowrd NOT USED */
+
+INT16 EMS_DetachDLE( FSYS_HAND fsh ); /* I - */
+
+INT32 EMS_EndOperationOnDLE( FSYS_HAND fsh ); /* I - */
+
+INT16 EMS_CreateObj( FSYS_HAND fsh, /* I - File system to create object one */
+ DBLK_PTR dblk); /* I - Describes object to create */
+
+INT16 EMS_OpenObj( FSYS_HAND fsh, /* I - file system that the file is opened on */
+ FILE_HAND *hand, /* O - allocated handle */
+ DBLK_PTR dblk, /*I/O- describes the file to be opened */
+ OPEN_MODE mode); /* I - open mode */
+
+INT16 EMS_ReadObj( FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info); /* O - Stream information for the data returned */
+
+
+INT16 EMS_WriteObj( FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size need for next read */
+ STREAM_INFO_PTR s_info); /* I - Stream information for the data passed in */
+
+INT16 EMS_VerObj( FILE_HAND hand, /* I - file handle to verify data with */
+ BYTE_PTR buf, /* I - buffer needed to perform verify */
+ BYTE_PTR data, /* I - data to verify against */
+ UINT16 *size, /*I/O- size of buffers / amount verified */
+ UINT16 *blk_size, /* O - minum size of block for next call */
+ STREAM_INFO_PTR s_info); /* I - Stream information for the data passed in */
+
+
+INT16 EMS_CloseObj( FILE_HAND hand ); /* I - handle of object to close */
+
+INT16 EMS_DeleteObj( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 EMS_FindFirst( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+ CHAR_PTR sname, /* I - search name */
+ UINT16 obj_type); /* I - object type (all objs, dirs, etc.) */
+
+INT16 EMS_FindNext( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* O - Discriptor block */
+
+INT16 EMS_GetObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /*I/O- On entry it is minimal on exit Complete */
+
+INT16 EMS_VerObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to compare OS against */
+
+INT16 EMS_ChangeDir( FSYS_HAND fsh, /* I - file system to changing directories on */
+ CHAR_PTR path, /* I - describes the path of the new directory */
+ INT16 psize); /* I - specifies the length of the path */
+
+INT16 EMS_UpDir( FSYS_HAND fsh ); /* I - file system to change directories in */
+
+INT16 EMS_GetCurrentPath( FSYS_HAND fsh, /* I - file system to get current path from */
+ CHAR_PTR path, /* O - buffer to place this path */
+ INT16 *size); /*I/O- size of buffer on entry & on exit */
+
+INT16 EMS_SeekObj( FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ); /*I/O- Offset to seek; Number of bytes actualy seeked */
+
+INT16 EMS_GetMaxSizeDBLK( FSYS_HAND fsh /* not used */ );
+
+INT16 EMS_GetCurrentDDB( FSYS_HAND fsh, /* I - file system to get DDB from */
+ DBLK_PTR dblk ); /* O - place to put the DDB data */
+
+INT16 EMS_SetObjInfo( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk); /* I - data to write to disk */
+
+INT16 EMS_ModFnameFDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it, /* I - TRUE if setting file name, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get file name from */
+ CHAR_PTR buf, /*I/O- file name to read (or to write) */
+ INT16 *size ) ; /*I/O- size buffer on entry and exit */
+
+INT16 EMS_ModPathDDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it , /* I - TRUE if setting path, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get path from */
+ CHAR_PTR buf, /*I/O- path to read (or to write) */
+ INT16 *size ); /*I/O- size of buffer on entry and exit */
+
+INT16 EMS_GetOSFnameFDB( DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 EMS_GetOSPathDDB(
+ FSYS_HAND fsh, /* I - File System handle */
+ DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 EMS_GetFileVerFDB( DBLK_PTR dblk ,
+ UINT32 *version ) ;
+
+INT16 EMS_GetCdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ); /*I/O- createion date to read (or to write) */
+
+INT16 EMS_GetMdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /* O - modify date to write */
+
+INT16 EMS_ModBdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 EMS_ModAdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+UINT64 EMS_GetDisplaySizeDBLK( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+INT16 EMS_GetOS_InfoDBLK( DBLK_PTR dblk, /* I - DBLK to get the info from */
+ BYTE_PTR os_info, /* O - Buffer to place data */
+ INT16 *size ); /*I/O- Buffer size / data length */
+
+
+INT16 EMS_ModAttribDBLK( BOOLEAN set_it ,
+ DBLK_PTR dblk ,
+ UINT32_PTR attr );
+
+
+INT16 EMS_GetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE *type );
+
+
+INT16 EMS_GetActualSizeDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 EMS_SizeofFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ); /* I - dblk to get fname from */
+
+INT16 EMS_SizeofOSFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ) ; /* I - dblk to get fname from */
+
+INT16 EMS_SizeofPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 EMS_SizeofOSPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 EMS_SizeofOSInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to get size of OS info for */
+
+
+INT16 EMS_PushMinDDB( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 EMS_PopMinDDB( FSYS_HAND fsh ,
+ DBLK_PTR dblk );
+
+INT16 EMS_CreateFDB( FSYS_HAND fsh,
+ GEN_FDB_DATA_PTR dat ) ;
+
+INT16 EMS_CreateDDB( FSYS_HAND fsh,
+ GEN_DDB_DATA_PTR dat ) ;
+
+INT16 EMS_CreateIDB( FSYS_HAND fsh,
+ GEN_IDB_DATA_PTR dat ) ;
+
+VOID EMS_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+BOOLEAN EMS_ProcessDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 EMS_ChangeIntoDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 EMS_FindClose( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 EMS_GetSpecDBLKS(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ INT32 *index );
+
+INT16 EMS_DeviceDispName(
+GENERIC_DLE_PTR dle,
+CHAR_PTR dev_name,
+INT16 size,
+INT16 type ) ;
+
+INT16 EMS_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask );
+
+VOID EMS_RemoveDLE( GENERIC_DLE_PTR dle ) ;
+
+VOID EMS_GetVolName( GENERIC_DLE_PTR dle, CHAR_PTR buffer ) ;
+
+INT16 EMS_SizeofVolName( GENERIC_DLE_PTR dle ) ;
+
+VOID EMS_EmptyFindHandQ( FSYS_HAND fsh ) ;
+
+INT16 EMS_EnumSpecFiles(
+ GENERIC_DLE_PTR dle,
+ UINT16 *index,
+ CHAR_PTR *path,
+ INT16 *psize,
+ CHAR_PTR *fname ) ;
+
+INT16 EMS_GetSpecDBLKS(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ INT32 *index );
+
+VOID EMS_InitMakeData( FSYS_HAND fsh, INT16 blk_type, CREATE_DBLK_PTR data ) ;
+BOOLEAN EMS_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+INT16 EMS_CompleteBlk( FSYS_HAND fsh, DBLK_PTR dblk, BYTE_PTR buffer, UINT16 *size, STREAM_INFO *sinfo ) ;
+VOID EMS_ReleaseBlk( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 EMS_DupBlk( FSYS_HAND fsh, DBLK_PTR db_org, DBLK_PTR db_dup );
+
+INT16 EMS_SpecExcludeObj( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ DBLK_PTR fdb ) ; /* I - Descriptor block of fdb */
+
+
+INT16 EMS_SetupPathInDDB(
+ FSYS_HAND fsh,
+ DBLK_PTR ddblk,
+ CHAR_PTR cur_dir,
+ CHAR_PTR sub_dir_name,
+ UINT16 buf_req_size ) ;
+
+INT16 EMS_SetupFileNameInFDB( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ CHAR_PTR fname,
+ UINT16 bufMinSize );
+
+INT16 EMS_SetupWorkPath(
+ FSYS_HAND fsh,
+ CHAR_PTR cur_dir,
+ CHAR_PTR sname,
+ CHAR_PTR *path_string ) ;
+
+VOID EMS_ReleaseWorkPath( FSYS_HAND fsh ) ;
+
+VOID EMS_FixPath( CHAR_PTR path, INT16_PTR size, INT16 fname_size ) ;
+
+//
+// Private Registry API functions
+//
+
+// Call backup for backup operations and both for restore operations.
+
+INT REG_AssertBackupPrivilege( VOID );
+INT REG_AssertRestorePrivilege( VOID );
+
+// Given a drive, path, and file name I'll tell you if it
+// is an active registry file.
+
+INT REG_IsRegistryFile(
+ GENERIC_DLE_PTR dle,
+ CHAR_PTR FileSpec );
+
+INT REG_IsEventFile(
+ GENERIC_DLE_PTR dle,
+ CHAR_PTR FileSpec,
+ CHAR_PTR buffer );
+
+// Called by the file system to determine if/where the
+// registry is for each drive.
+// Everyone else can get the info from the DLE's.
+
+INT REG_GetRegistryPath(
+CHAR *Machine,
+CHAR Drive,
+CHAR_PTR Path,
+INT *PathSize );
+
+// Try to backup up an active registry file.
+
+INT REG_BackupRegistryFile(
+GENERIC_DLE_PTR dle,
+CHAR_PTR RegFileSpec,
+CHAR_PTR TempFileSpec );
+
+// Most dangerous of all. Try to restore an active registry file.
+
+INT REG_RestoreRegistryFile(
+GENERIC_DLE_PTR dle,
+CHAR_PTR RegFileSpec,
+CHAR_PTR NewFileSpec,
+CHAR_PTR OldFileSpec );
+
+INT REG_IsCurDirRegistryPath(
+IN FSYS_HAND fsh ) ;
+
+VOID REG_MoveActiveRenameKey(
+GENERIC_DLE_PTR dle,
+CHAR_PTR RegFileSpec ) ;
+
+
+#define EMS_GetRegistryPath( dle ) ((dle)->info.ntfs->registry_path )
+#define EMS_GetRegistryPathSize( dle ) ((dle)->info.ntfs->registry_path_size )
+
+
+UINT32 EMS_MSoftToMayn( UINT32 msoftID );
+UINT32 EMS_MaynToMSoft( UINT32 maynID );
+
+INT16 EMS_FillOutDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ WIN32_FIND_DATA *find_data );
+
+CHAR_PTR EMS_MakeTempName( CHAR_PTR path,
+ CHAR_PTR prefix) ;
+
+
+INT16 EMS_TranslateBackupError( DWORD backupError );
+
+/*
+ * Init/Deinit for one-time work in TINITFS.C
+ */
+INT16 EMS_InitFileSys( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask );
+VOID EMS_DeInitFileSys( DLE_HAND hand );
+
+/*
+ * Operations on temporary file names (for active restores)
+ */
+VOID EMS_InitTemp( VOID );
+VOID EMS_DeinitTemp( VOID );
+BOOLEAN EMS_SaveTempName( CHAR_PTR tapeName, CHAR_PTR diskName );
+CHAR_PTR EMS_GetTempName( CHAR_PTR tapeName );
+
+
+/*
+ * Utility and debug functions
+ */
+
+#if defined( FS_DEBUG )
+#define EMS_DebugPrint EMS_DebugPrintFunction
+#else
+#define EMS_DebugPrint
+#endif
+
+VOID EMS_DebugPrintFunction( CHAR *fmt, ... );
+CHAR_PTR EMS_DuplicateString( CHAR_PTR src );
+
+
+
+
diff --git a/private/utils/ntbackup/inc/ems_jet.h b/private/utils/ntbackup/inc/ems_jet.h
new file mode 100644
index 000000000..0bfba59b2
--- /dev/null
+++ b/private/utils/ntbackup/inc/ems_jet.h
@@ -0,0 +1,21 @@
+
+
+typedef long EC;
+typedef void *HBC;
+
+EC EMS_BackupPrepare(LPSTR a,LPSTR b, unsigned long c, INT d, HBC *e) ;
+EC EMS_BackupGetAttachmentInfo( PVOID a, LPSTR *b, LPDWORD c);
+EC EMS_BackupRead(PVOID a, PVOID b, DWORD c, PDWORD d );
+EC EMS_BackupClose(PVOID a) ;
+EC EMS_BackupOpen(PVOID a, LPSTR b, DWORD c, LARGE_INTEGER *d);
+EC EMS_GetBackupLogs( PVOID a, LPSTR *b, LPDWORD c);
+EC EMS_TruncateLogs(PVOID a) ;
+EC EMS_BackupEnd(PVOID a) ;
+VOID EMS_BackupFree(PVOID a) ;
+EC EMS_RestoreEnd(PVOID a ) ;
+EC EMS_RestorePrepare( PVOID a, PVOID b, PVOID *c ) ;
+EC EMS_RestoreRegister( PVOID a, PVOID b, PVOID c, PVOID d, INT e, PVOID f, INT g, INT h) ;
+EC EMS_RestoreLocations( PVOID a, PVOID b, INT *c) ;
+EC EMS_RestoreComplete( PVOID a, INT b) ;
+
+
diff --git a/private/utils/ntbackup/inc/emsdblk.h b/private/utils/ntbackup/inc/emsdblk.h
new file mode 100644
index 000000000..c5f983007
--- /dev/null
+++ b/private/utils/ntbackup/inc/emsdblk.h
@@ -0,0 +1,106 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: emsdblk.h
+
+ Description: This file contains the definition of the DOS
+ file and directory control blocks.
+
+
+ $Log: M:/LOGFILES/EMSDBLK.H_V $
+
+**/
+/* $end$ include list */
+
+#ifndef emsdblk_h
+#define emssdblk_h
+
+#include "queues.h"
+
+#define EMS_MDB_PRI_FILE_DATA 0x00010001
+#define EMS_MDB_PUB_FILE_DATA 0x00010002
+#define EMS_MDB_OTH_FILE_DATA 0x00010003
+#define EMS_DSA_FILE_DATA 0x00010004
+#define EMS_FOLDER_DATA 0x00010005
+
+/* Matches bottom portion of NT stream headers */
+
+typedef struct{
+ CHAR FnameSystem[256];
+ CHAR FnamePrivate[256];
+ CHAR FnamePublic[256];
+ CHAR LogDir[256];
+} MDB_PATHS ;
+
+typedef struct {
+ CHAR DbPath[256] ;
+ CHAR SystemPath[256];
+ CHAR LogDir[256] ;
+} DSA_PATHS ;
+
+
+typedef union {
+ DSA_PATHS dsa;
+ MDB_PATHS mdb;
+} XCHANGE_PATHS ;
+
+#define EMS_MAX_STREAM_NAME_LENG 512
+typedef struct _EMS_STREAM_NAME {
+ UINT32 name_leng ;
+ UINT8 name[ EMS_MAX_STREAM_NAME_LENG ] ;
+} EMS_STREAM_NAME, *EMS_STREAM_NAME_PTR;
+
+#define EMS_DOING_LOGS 1
+#define EMS_DOING_DB 0
+typedef struct _EMS_OBJ_HAND {
+ HANDLE fhand;
+ VOID_PTR context;
+ UINT32 currentStreamId ;
+ EMS_STREAM_NAME strm_name;
+ UINT64 nextStreamHeaderPos;
+ UINT64 curPos;
+ BOOLEAN needPathList ;
+ INT pathListSize ;
+ BOOLEAN needStreamHeader; /* Ready for SH on backup */
+ BOOLEAN db_restored ;
+ UINT32 check_sum ;
+ UINT32 residule_byte_count ;
+ INT time_for_checksum ;
+ BOOLEAN nameComplete;
+ INT db_or_log; //EMS_DOING_LOG or EMS_DOING_DB
+ INT name_list_offset ;
+ CHAR_PTR name_list;
+ XCHANGE_PATHS org_paths;
+ BOOLEAN skip_data ;
+ INT open_ret_val ;
+} EMS_OBJ_HAND, *EMS_OBJ_HAND_PTR;
+
+
+typedef struct _EMS_DBLK *EMS_DBLK_PTR;
+
+typedef struct _EMS_DBLK {
+ UINT8 blk_type; /* values: DDB_ID, FDB_ID set: DOS */
+ COM_DBLK fs_reserved ;
+ INT ems_type ;
+ UINT64 display_size ;
+ BOOLEAN os_info_complete; /* TRUE if GetObjInfo doesn't have to do anything */
+ BOOLEAN name_complete; /* TRUE if name/path is restored to DBLK */
+ BOOLEAN backup_completed ;
+ UINT32 context ;
+ FS_NAME_Q_ELEM_PTR full_name_ptr ;
+} EMS_DBLK;
+
+
+typedef struct _EMS_MIN_DDB *EMS_MIN_DDB_PTR;
+
+typedef struct _EMS_MIN_DDB {
+ Q_ELEM q ;
+ HANDLE scan_hand; /* windows handle for scan */
+ BOOLEAN path_in_stream ;
+ UINT16 psize ; /* size of path string */
+ CHAR_PTR path; /* build from "name" and current dir */
+} EMS_MIN_DDB;
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/enc_priv.h b/private/utils/ntbackup/inc/enc_priv.h
new file mode 100644
index 000000000..c6ae1795f
--- /dev/null
+++ b/private/utils/ntbackup/inc/enc_priv.h
@@ -0,0 +1,67 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: enc_priv.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PRIVATE
+
+
+ $Log: Q:/LOGFILES/ENC_PRIV.H_V $
+ *
+ * Rev 1.1 08 Oct 1992 12:47:08 DAVEV
+ * fixes for handling Unicode passwords
+ *
+ * Rev 1.0 09 May 1991 13:32:36 HUNTER
+ * Initial revision.
+
+**/
+
+/*
+** Define pointer sizes for CodeRunner version if they aren't already
+*/
+#ifndef PTR_SIZE
+#ifdef CODERUNNER
+#define PTR_SIZE far
+#else
+#define PTR_SIZE
+#endif
+#endif
+
+#ifndef ENCRYPTS
+
+#define ENCRYPTS
+
+#include "StdTypes.H"
+/* $end$ include list */
+
+
+/* Encryption Algorithms */
+
+typedef struct MAYXOR_ALGOR {
+ INT8 PTR_SIZE *key ;
+ INT16 ksize ;
+ UINT8 feedback ;
+ INT16 block_size ;
+ INT32 bytes_processed ;
+} MAYXOR_ALGOR ;
+
+typedef struct MAYHDW_ALGOR {
+ INT16 temp ;
+} MAYHDW_ALGOR ;
+
+/* Encryption Unit Handle for each algorithm */
+typedef struct EU_HAND {
+ INT16 algor ;
+ INT16 mode ;
+ union {
+ struct MAYHDW_ALGOR hdwr;
+ struct MAYXOR_ALGOR exor;
+ } algors ;
+} EU_HAND;
+
+#endif
diff --git a/private/utils/ntbackup/inc/enc_pub.h b/private/utils/ntbackup/inc/enc_pub.h
new file mode 100644
index 000000000..c6ce78053
--- /dev/null
+++ b/private/utils/ntbackup/inc/enc_pub.h
@@ -0,0 +1,69 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: enc_pub.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+
+ $Log: Q:/LOGFILES/ENC_PUB.H_V $
+ *
+ * Rev 1.2 08 Oct 1992 12:47:08 DAVEV
+ * fixes for handling Unicode passwords
+ *
+ * Rev 1.1 14 May 1991 12:01:02 JOHNW
+ * Added #define for a do-nothing encryption algorithm.
+ *
+ * Rev 1.0 09 May 1991 13:30:40 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef ENCRYPES
+
+#define ENCRYPES
+
+#include "stdtypes.h"
+/* $end$ include list */
+
+#ifndef PTR_SIZE
+#ifdef CODERUNNER
+#define PTR_SIZE far
+#else
+#define PTR_SIZE
+#endif
+#endif
+
+/* Algorithm type defined */
+#define ENC_ALGOR_0 0 /* Do nothing. ie Encrypt( "John" ) == "John" */
+#define ENC_ALGOR_1 1 /* Maynard's 2.0 password encryption algorithm */
+#define ENC_ALGOR_2 2 /* to become Maynards's hardware encryption algorithm */
+#define ENC_ALGOR_3 3 /* Maynard Encryption Standard */
+
+/* Mode type defined */
+#define ENCRYPT 100 /* set mode to encrypt code */
+#define DECRYPT 500 /* set mode to decrypt code */
+
+/* Error values defined */
+#define EU_NO_ERROR 0
+#define EU_ALGORITHM_UNKNOWN -600
+#define EU_MEMORY_ERROR -601
+#define EU_ENCRYPTION_ERROR -602
+
+typedef struct EU_HAND PTR_SIZE *EU_HAND_PTR ;
+
+/* Encryption Unit Interface prototypes */
+/* EU_Open, EU_Encrypt, EU_ResetHand, EU_Close */
+
+EU_HAND_PTR EU_Open( INT16 algor, INT16 mode, INT8_PTR key, INT16 ksize,
+ INT16_PTR block_size, INT16_PTR error ) ;
+INT16 EU_Encrypt( EU_HAND_PTR en_un_hn, INT8_PTR data, INT16 dsize ) ;
+INT16 EU_ResetHand( EU_HAND_PTR en_un_hn ) ;
+VOID EU_Close( EU_HAND_PTR en_un_hn ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/eng_dbug.h b/private/utils/ntbackup/inc/eng_dbug.h
new file mode 100644
index 000000000..0ea8b624f
--- /dev/null
+++ b/private/utils/ntbackup/inc/eng_dbug.h
@@ -0,0 +1,110 @@
+#ifndef ENG_DBUG_SH
+
+#define ENG_DBUG_SH
+
+//DEBUG ERROR MESSAGE
+
+#define RES_DBUG_MESSAGE 3800
+
+#define RES_CONFIG_REMOTE RES_DBUG_MESSAGE + 0
+#define RES_CONFIG_NRL_DOS_VECTOR RES_DBUG_MESSAGE + 1
+#define RES_SMB_INITIALIZE RES_DBUG_MESSAGE + 2
+#define RES_REMOTE_BUFFERS RES_DBUG_MESSAGE + 3
+#define RES_NO_NRL_FUNCTION_TABLE RES_DBUG_MESSAGE + 4
+#define RES_REWIND_DRIVE_HDL RES_DBUG_MESSAGE + 5
+#define RES_DRV_RET RES_DBUG_MESSAGE + 6
+#define RES_RET_VAL_EQUALS RES_DBUG_MESSAGE + 7
+#define RES_ERASE_EXABYTE_SECURITY RES_DBUG_MESSAGE + 8
+#define RES_CALLING_ERASE RES_DBUG_MESSAGE + 9
+#define RES_CALLING_WRITE_END_SET RES_DBUG_MESSAGE + 10
+#define RES_READ_NEXT_SET RES_DBUG_MESSAGE + 11
+#define RES_READ_END_SET RES_DBUG_MESSAGE + 12
+#define RES_END_OF_SET RES_DBUG_MESSAGE + 13
+#define RES_END_OF_MEDIA RES_DBUG_MESSAGE + 14
+#define RES_TP_READ RES_DBUG_MESSAGE + 15
+#define RES_DRV_ERROR_BYTES_RCVD RES_DBUG_MESSAGE + 16
+#define RES_READ_NEXT_SET_RETVAL RES_DBUG_MESSAGE + 17
+#define RES_GOTO_BCKUP_SET RES_DBUG_MESSAGE + 18
+#define RES_OPEN_DRIVE_CARD_NO RES_DBUG_MESSAGE + 19
+#define RES_CLOSE_DRIVE RES_DBUG_MESSAGE + 20
+#define RES_REWIND RES_DBUG_MESSAGE + 21
+#define RES_NO_REWIND RES_DBUG_MESSAGE + 22
+#define RES_BADDR_IRQ_DMA_NO_DRIVES RES_DBUG_MESSAGE + 23
+#define RES_UPDATE_DRIVE_STATUS RES_DBUG_MESSAGE + 24
+#define RES_VAL_CHANGED RES_DBUG_MESSAGE + 25
+#define RES_VAL_UNCHANGED RES_DBUG_MESSAGE + 26
+#define RES_CATALOG_TIME RES_DBUG_MESSAGE + 27
+#define RES_UI_TPOS_TAPE_SET RES_DBUG_MESSAGE + 28
+#define RES_IMAGE_DIFFERENCE RES_DBUG_MESSAGE + 29
+#define RES_HEX_BYTE RES_DBUG_MESSAGE + 30
+#define RES_DISK_CONTENTS RES_DBUG_MESSAGE + 31
+#define RES_NEW_LINE RES_DBUG_MESSAGE + 32
+#define RES_TAPE_PARTITION_SPECS RES_DBUG_MESSAGE + 33
+#define RES_DISK_PARTITION_SPECS RES_DBUG_MESSAGE + 34
+#define RES_REM_ATTACH_TO_DLE RES_DBUG_MESSAGE + 35
+#define RES_SMB_CONNECT_APPLICATION RES_DBUG_MESSAGE + 36
+#define RES_FOUND_REMOTE_DEVICE RES_DBUG_MESSAGE + 37
+#define RES_REMOTE_BINDING RES_DBUG_MESSAGE + 38
+#define RES_FAILED RES_DBUG_MESSAGE + 39
+#define RES_OKAY RES_DBUG_MESSAGE + 40
+#define RES_SMB_RELEASE RES_DBUG_MESSAGE + 41
+#define RES_REM_SMB_DISCONNECT RES_DBUG_MESSAGE + 42
+#define RES_HEX_INT RES_DBUG_MESSAGE + 43
+#define RES_RWS_ATTACH_TO_DLE RES_DBUG_MESSAGE + 44
+#define RES_DLE_GET_CHILD RES_DBUG_MESSAGE + 45
+#define RES_RWS_SMB_DISCONNECT RES_DBUG_MESSAGE + 46
+#define RES_SOFT_ERRORS_UNDERRUNS RES_DBUG_MESSAGE + 47
+#define RES_REQUESTED_SET RES_DBUG_MESSAGE + 48
+#define RES_RESIDUAL_READ_BUFFER RES_DBUG_MESSAGE + 49
+#define RES_ATTEMPTING_TO_VCB RES_DBUG_MESSAGE + 50
+#define RES_CURRENT_VCB RES_DBUG_MESSAGE + 51
+#define RES_POSITION_AT_SET RES_DBUG_MESSAGE + 52
+#define RES_UI_MSG RES_DBUG_MESSAGE + 53
+#define RES_TF_CLOSE_SET RES_DBUG_MESSAGE + 54
+#define RES_FATAL_ERROR_DETECTED RES_DBUG_MESSAGE + 55
+#define RES_READ_BUFFER_LEFT_OVER RES_DBUG_MESSAGE + 56
+#define RES_TF_OPEN_SET RES_DBUG_MESSAGE + 57
+#define RES_HOLD_BUFFER RES_DBUG_MESSAGE + 58
+#define RES_DESTROY_HOLD_BUFFER RES_DBUG_MESSAGE + 59
+#define RES_OPEN_REQUESTED_REWIND RES_DBUG_MESSAGE + 60
+#define RES_END_OF_TFOPEN_SET RES_DBUG_MESSAGE + 61
+#define RES_TF_ALLOCATE_BUFFERS RES_DBUG_MESSAGE + 62
+#define RES_END_ALLOCATE RES_DBUG_MESSAGE + 63
+#define RES_TF_FREE_BUFFERS RES_DBUG_MESSAGE + 64
+#define RES_END_EQUALS RES_DBUG_MESSAGE + 65
+#define RES_TF_GETNEXT_TAPE_REQUEST RES_DBUG_MESSAGE + 66
+#define RES_TF_GETNEXT_ERROR RES_DBUG_MESSAGE + 67
+#define RES_ABORT_READ RES_DBUG_MESSAGE + 68
+#define RES_INITIATE_WATCH RES_DBUG_MESSAGE + 69
+#define RES_WATCH_REWIND RES_DBUG_MESSAGE + 70
+#define RES_DEVICE_ERROR RES_DBUG_MESSAGE + 71
+#define RES_GOTO_LBA RES_DBUG_MESSAGE + 72
+#define RES_DRIVER_TO_LOAD RES_DBUG_MESSAGE + 73
+#define RES_LOADING_DRIVER RES_DBUG_MESSAGE + 74
+#define RES_TPINIT_FAILURE RES_DBUG_MESSAGE + 75
+#define RES_WATCH_DRIVE_CALLED RES_DBUG_MESSAGE + 76
+#define RES_WATCH_DRIVE_STATUS RES_DBUG_MESSAGE + 77
+#define RES_WATCH_DRIVE_EXIT RES_DBUG_MESSAGE + 78
+#define RES_WATCH_DRIVE_END RES_DBUG_MESSAGE + 79
+#define RES_GET_CURRENT_POS_STAT RES_DBUG_MESSAGE + 80
+#define RES_UI_PURGE_CATALOG RES_DBUG_MESSAGE + 81
+#define RES_UNFORMATED_STRING RES_DBUG_MESSAGE + 82
+#define RES_IMAGE_BAD_VERIFY RES_DBUG_MESSAGE + 83
+#define RES_IMAGE_BAD_BLOCK RES_DBUG_MESSAGE + 84
+#define RES_IMAGE_BAD_READ RES_DBUG_MESSAGE + 85
+#define RES_IMAGE_BAD_WRITE RES_DBUG_MESSAGE + 86
+#define RES_CLOSE_BINDERY RES_DBUG_MESSAGE + 87
+#define RES_AL_RESULT RES_DBUG_MESSAGE + 88
+#define RES_OPEN_BINDERY RES_DBUG_MESSAGE + 89
+#define RES_PARM_BLK_DESCR RES_DBUG_MESSAGE + 90
+#define RES_PARM_BLK RES_DBUG_MESSAGE + 91
+#define RES_CRIT_ADDRS RES_DBUG_MESSAGE + 92
+#define RES_ATTACH_TO_DLE RES_DBUG_MESSAGE + 93
+#define RES_DETACH_FROM_DLE RES_DBUG_MESSAGE + 94
+#define RES_NOVELL_SERVER_INFO RES_DBUG_MESSAGE + 95
+#define RES_DLE_BASE_PATH RES_DBUG_MESSAGE + 96
+#define RES_NO_ATTACHED_DRIVES RES_DBUG_MESSAGE + 97
+#define RES_INIT_ERROR RES_DBUG_MESSAGE + 98
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/eng_err.h b/private/utils/ntbackup/inc/eng_err.h
new file mode 100644
index 000000000..f83bf080b
--- /dev/null
+++ b/private/utils/ntbackup/inc/eng_err.h
@@ -0,0 +1,116 @@
+#ifndef ENG_ERR_SH
+
+#define ENG_ERR_SH
+
+//BACKUP ENGINE ERROR MESSAGE
+
+#define RES_ERR_MESSAGE 3500
+
+#define RES_OUT_OF_MEMORY RES_ERR_MESSAGE + 0
+#define RES_RESOURCE_FILE_ERROR RES_ERR_MESSAGE + 1
+#define RES_INVALID_DATE RES_ERR_MESSAGE + 2
+#define RES_SAVE_CONFIG_ERROR RES_ERR_MESSAGE + 3
+#define RES_ALL_PARTITIONS_KNOWN RES_ERR_MESSAGE + 4
+#define RES_SCRIPT_DELETE_ERROR RES_ERR_MESSAGE + 5
+#define RES_SCRIPT_NOTHING_SELECTED RES_ERR_MESSAGE + 6
+#define RES_ERROR_WRITING_SCRIPT RES_ERR_MESSAGE + 7
+#define RES_USER_TAPE_ABORT RES_ERR_MESSAGE + 8
+#define RES_END_CHANNEL RES_ERR_MESSAGE + 9
+#define RES_ERROR_CONTINUE RES_ERR_MESSAGE + 10
+#define RES_WRITE_PROT RES_ERR_MESSAGE + 11
+#define RES_UNKNOWN_TF_MSG RES_ERR_MESSAGE + 12
+#define RES_UNKNOWN_MSG_HNDLR_MSG RES_ERR_MESSAGE + 13
+#define RES_UNKNOWN_LOOPS_ERR RES_ERR_MESSAGE + 14
+#define RES_OPEN_LOG_ERROR RES_ERR_MESSAGE + 15
+#define RES_PRINTER_INIT_ERROR RES_ERR_MESSAGE + 16
+#define RES_UNKNOWN_LOG_MSG RES_ERR_MESSAGE + 17
+#define RES_ERROR_OPENING_PWDBASE RES_ERR_MESSAGE + 18
+#define RES_COMMAND_SYNTAX_ERROR RES_ERR_MESSAGE + 19
+#define RES_SCRIPT_SYNTAX_ERROR RES_ERR_MESSAGE + 20
+#define RES_SCRIPT_OPEN_ERROR RES_ERR_MESSAGE + 21
+#define RES_SCRIPT_NESTING_ERROR RES_ERR_MESSAGE + 22
+#define RES_DRIVE_MATCH_ERROR RES_ERR_MESSAGE + 23
+#define RES_FILE_RENAME_ERROR RES_ERR_MESSAGE + 24
+#define RES_INVALID_SOURCE RES_ERR_MESSAGE + 25
+#define RES_INVALID_TARGET RES_ERR_MESSAGE + 26
+#define RES_INVALID_PARAMETER RES_ERR_MESSAGE + 27
+#define RES_ERROR_UPDATING_PDBASE RES_ERR_MESSAGE + 28
+#define RES_ERROR_READING_PDBASE RES_ERR_MESSAGE + 29
+#define RES_PDBASE_FULL RES_ERR_MESSAGE + 30
+#define RES_REMOTE_DENIED_READ RES_ERR_MESSAGE + 31
+#define RES_REMOTE_DENIED_DELETE RES_ERR_MESSAGE + 32
+#define RES_UNKNOWN_PDBASE_ERROR RES_ERR_MESSAGE + 33
+#define RES_CANT_DETERMINE_DOS_PART RES_ERR_MESSAGE + 34
+#define RES_MISMATCHED_PASSWORD RES_ERR_MESSAGE + 35
+#define RES_ERROR_DURING_ATTACH RES_ERR_MESSAGE + 36
+#define RES_CAT_DELETE_ERROR_MSG RES_ERR_MESSAGE + 37
+#define RES_ERROR_POSITIONING_TAPE RES_ERR_MESSAGE + 38
+#define RES_NO_FILE_IN_DIR RES_ERR_MESSAGE + 39
+#define RES_EU_ERROR RES_ERR_MESSAGE + 40
+#define RES_BACKUP_NO_SELECTIONS RES_ERR_MESSAGE + 41
+#define RES_VERIFY_NO_SELECTIONS RES_ERR_MESSAGE + 42
+#define RES_INVALID_WILDCARDS RES_ERR_MESSAGE + 43
+#define RES_INVALID_DOS_FNAME RES_ERR_MESSAGE + 44
+#define RES_INVALID_FSPEC RES_ERR_MESSAGE + 45
+#define RES_INVALID_DRIVE_SPEC RES_ERR_MESSAGE + 46
+#define RES_INVALID_PATH_SPEC RES_ERR_MESSAGE + 47
+#define RES_DONT_SPECIFY_DRIVE RES_ERR_MESSAGE + 48
+#define RES_DONT_SPECIFY_PATH RES_ERR_MESSAGE + 49
+#define RES_DONT_SPECIFY_FNAME RES_ERR_MESSAGE + 50
+#define RES_EOM_TAPE_ABORT RES_ERR_MESSAGE + 51
+#define RES_FATAL_CAT_ERROR RES_ERR_MESSAGE + 52
+#define RES_UNKNOWN_CAT_ERR RES_ERR_MESSAGE + 53
+#define RES_USER_CAT_ABORT RES_ERR_MESSAGE + 54
+#define RES_ERROR_TITLE RES_ERR_MESSAGE + 55
+#define RES_NO_MORE_CONNECTIONS RES_ERR_MESSAGE + 56
+#define RES_NO_HELP_AVAIL RES_ERR_MESSAGE + 57
+#define RES_TEMP_CAT_OPEN_ERR RES_ERR_MESSAGE + 58
+#define RES_TEMP_CAT_SEEK_ERR RES_ERR_MESSAGE + 59
+#define RES_TEMP_CAT_READ_ERR RES_ERR_MESSAGE + 60
+#define RES_TEMP_CAT_WRITE_ERR RES_ERR_MESSAGE + 61
+#define RES_TEMP_CAT_UNLINK_ERR RES_ERR_MESSAGE + 62
+#define RES_TEMP_CAT_UNKNOWN_ERR RES_ERR_MESSAGE + 63
+#define RES_EMBEDDED_PW_MISMATCH RES_ERR_MESSAGE + 64
+#define RES_CAT_ERASE_ERROR_MSG RES_ERR_MESSAGE + 65
+#define RES_UNKNOWN_LOOPS_PROMPT RES_ERR_MESSAGE + 66
+#define RES_EMPTY_DRIVE_ERROR RES_ERR_MESSAGE + 67
+#define RES_DIR_ERROR_MSG RES_ERR_MESSAGE + 68
+#define RES_VMEM_CRIT_ERR RES_ERR_MESSAGE + 69
+#define RES_REST_PARTITION_ERR RES_ERR_MESSAGE + 70
+#define RES_VER_PARTITION_ERR RES_ERR_MESSAGE + 71
+#define RES_TEMP_CAT_LEVEL_ZERO_ERR RES_ERR_MESSAGE + 72
+#define RES_CAT_LEVEL_ZERO_ERR RES_ERR_MESSAGE + 73
+#define RES_RESTORE_NO_SELECTIONS RES_ERR_MESSAGE + 74
+#define RES_INSUFFICIENT_DISK_SPACE_ERR RES_ERR_MESSAGE + 75
+#define RES_CATALOG_UNUSABLE RES_ERR_MESSAGE + 76
+#define RES_DEVICE_DEAD RES_ERR_MESSAGE + 77
+#define RES_REST_IMAGE_SEQUENCE_ERR RES_ERR_MESSAGE + 78
+#define RES_VER_IMAGE_SEQUENCE_ERR RES_ERR_MESSAGE + 79
+#define RES_ARCHIVE_NO_SELECTIONS RES_ERR_MESSAGE + 80
+#define RES_UNEXPECTED_EOS RES_ERR_MESSAGE + 81
+#define RES_FOREIGN_TAPE_ERROR RES_ERR_MESSAGE + 82
+#define RES_FATAL_TAPE_READ_ERR RES_ERR_MESSAGE + 83
+#define RES_FATAL_TAPE_WRITE_ERR RES_ERR_MESSAGE + 84
+#define RES_FATAL_TAPE_FMT_ERR RES_ERR_MESSAGE + 85
+#define RES_FATAL_TAPE_TRANS_ERR RES_ERR_MESSAGE + 86
+#define RES_FATAL_TAPE_ERR RES_ERR_MESSAGE + 87
+#define RES_FATAL_TAPE_DRIVE_ERR RES_ERR_MESSAGE + 88
+#define RES_INVALID_NUMERAL RES_ERR_MESSAGE + 89
+#define RES_DLE_HAS_NO_CHILDREN RES_ERR_MESSAGE + 90
+#define RES_SERVER_ADDR_NOT_FOUND RES_ERR_MESSAGE + 91
+#define RES_BAD_ATTACH_TO_SERVER RES_ERR_MESSAGE + 92
+#define RES_BAD_SERVER_LOGIN RES_ERR_MESSAGE + 93
+#define RES_MISSING_HW_RESOURCE RES_ERR_MESSAGE + 94
+#define RES_INCONSISTENT_HW_PARMS RES_ERR_MESSAGE + 95
+#define RES_UNKNOWN_HW_ERR RES_ERR_MESSAGE + 96
+#define RES_BENGINE_IN_USE RES_ERR_MESSAGE + 97
+#define RES_ERROR_DURING_LOGOUT RES_ERR_MESSAGE + 98
+#define RES_NO_DRIVERS_FOUND RES_ERR_MESSAGE + 99
+#define RES_NET_OPTIONS_NOT_AVAIL RES_ERR_MESSAGE + 100
+#define RES_CONTROL_OPTIONS_NOT_AVAIL RES_ERR_MESSAGE + 101
+#define RES_FATAL_TAPE_FMT_NO_APPEND RES_ERR_MESSAGE + 102
+#define RES_FATAL_TAPE_FMT_NO_APPEND RES_ERR_MESSAGE + 102
+#define RES_ERROR_EMS_RESTART RES_ERR_MESSAGE + 103
+#define RES_ERROR_COMPRESS_FILE_FAIL RES_ERR_MESSAGE + 104
+
+#endif
diff --git a/private/utils/ntbackup/inc/eng_fmt.h b/private/utils/ntbackup/inc/eng_fmt.h
new file mode 100644
index 000000000..a51eaad7b
--- /dev/null
+++ b/private/utils/ntbackup/inc/eng_fmt.h
@@ -0,0 +1,15 @@
+#ifndef ENG_FMT_SH
+
+#define ENG_FMT_SH
+
+#define RES_MY40_TRANS 0
+#define RES_MY31_TRANS 1
+#define RES_MY30_TRANS 2
+#define RES_MY25_TRANS 3
+#define RES_QS19_TRANS 4
+#define RES_SY31_TRANS 5
+#define RES_UTF_TRANS 6
+#define RES_SYPL10_TRANS 7
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/eng_mq.h b/private/utils/ntbackup/inc/eng_mq.h
new file mode 100644
index 000000000..8df97889e
--- /dev/null
+++ b/private/utils/ntbackup/inc/eng_mq.h
@@ -0,0 +1,13 @@
+#ifndef ENG_MQ_SH
+
+#define ENG_MQ_SH
+
+#define RES_DD_HLP_RES_01 0
+#define RES_DOUBLE_BORDER 1
+#define RES_HW_BORDER 2
+#define RES_DOUBLE_TOP_BORDER 3
+#define RES_ERROR_LIST 4
+#define RES_CARD_LIST 5
+#define RES_DD_CONF 6
+
+#endif
diff --git a/private/utils/ntbackup/inc/eng_msg.h b/private/utils/ntbackup/inc/eng_msg.h
new file mode 100644
index 000000000..c0b8a335f
--- /dev/null
+++ b/private/utils/ntbackup/inc/eng_msg.h
@@ -0,0 +1,462 @@
+#ifndef ENG_MSG_SH
+
+#define ENG_MSG_SH
+
+#define RES_MESSAGE 3000
+
+#define RES_YES_KEY RES_MESSAGE + 0
+#define RES_NO_KEY RES_MESSAGE + 1
+#define RES_YES_STRING RES_MESSAGE + 2
+#define RES_NO_STRING RES_MESSAGE + 3
+#define RES_PRE_NOON RES_MESSAGE + 4
+#define RES_AFTER_NOON RES_MESSAGE + 5
+#define RES_SAVED_CONFIG RES_MESSAGE + 6
+#define RES_BACKUP_STATUS_LABEL RES_MESSAGE + 7
+#define RES_ARCHIVE_STATUS_LABEL RES_MESSAGE + 8
+#define RES_RESTORE_STATUS_LABEL RES_MESSAGE + 9
+#define RES_VERIFY_STATUS_LABEL RES_MESSAGE + 10
+#define RES_DIRECTORY_STATUS_LABEL RES_MESSAGE + 11
+#define RES_INSERT_NEW_TAPE RES_MESSAGE + 12
+#define RES_REPLACE_OLD_TAPE RES_MESSAGE + 13
+#define RES_CONTINUE RES_MESSAGE + 14
+#define RES_TAPE_NOT_INSERTED RES_MESSAGE + 15
+#define RES_DISPLAY_VCB RES_MESSAGE + 16
+#define RES_APPEND_QUEST RES_MESSAGE + 17
+#define RES_REPLACE_WARNING RES_MESSAGE + 18
+#define RES_REPLACE_TAPE RES_MESSAGE + 19
+#define RES_RESTORE_QUEST RES_MESSAGE + 20
+#define RES_VERIFY_QUEST RES_MESSAGE + 21
+#define RES_DIRECTORY_QUEST RES_MESSAGE + 22
+#define RES_SEARCH_QUEST RES_MESSAGE + 23
+#define RES_CONTINUE_QUEST RES_MESSAGE + 24
+#define RES_FOREIGN_TAPE_MSG RES_MESSAGE + 25
+#define RES_BLANK_TAPE RES_MESSAGE + 26
+#define RES_NO_MORE_TAPE_INFO RES_MESSAGE + 27
+#define RES_SEARCHING RES_MESSAGE + 28
+#define RES_REWINDING RES_MESSAGE + 29
+#define RES_WAITING RES_MESSAGE + 30
+#define RES_BACKUP_STARTED RES_MESSAGE + 31
+#define RES_RESTORE_STARTED RES_MESSAGE + 32
+#define RES_VERIFY_STARTED RES_MESSAGE + 33
+#define RES_DIRECTORY RES_MESSAGE + 34
+#define RES_FILE_SKIPPED RES_MESSAGE + 35
+#define RES_BACKUP_COMPLETED RES_MESSAGE + 36
+#define RES_RESTORE_COMPLETED RES_MESSAGE + 37
+#define RES_VERIFY_COMPLETED RES_MESSAGE + 38
+#define RES_BACKED_UP_DIR_FILE RES_MESSAGE + 39
+#define RES_BACKED_UP_DIR_FILES RES_MESSAGE + 40
+#define RES_BACKED_UP_DIRS_FILES RES_MESSAGE + 41
+#define RES_BACKED_UP_MAC RES_MESSAGE + 42
+#define RES_BACKED_UP_MACS RES_MESSAGE + 43
+#define RES_BACKED_UP_CORRUPT_WARNING RES_MESSAGE + 44
+#define RES_BACKED_UP_CORRUPT RES_MESSAGE + 45
+#define RES_BACKED_UP_CORRUPTS RES_MESSAGE + 46
+#define RES_BACKED_UP_IN_USE_WARNING RES_MESSAGE + 47
+#define RES_BACKED_UP_IN_USE RES_MESSAGE + 48
+#define RES_BACKED_UP_IN_USES RES_MESSAGE + 49
+#define RES_FILE_SKIPPED_STAT RES_MESSAGE + 50
+#define RES_FILE_SKIPPEDS_STAT RES_MESSAGE + 51
+#define RES_RESTORED_DIR_FILE RES_MESSAGE + 52
+#define RES_RESTORED_DIR_FILES RES_MESSAGE + 53
+#define RES_RESTORED_DIRS_FILES RES_MESSAGE + 54
+#define RES_RESTORED_MAC RES_MESSAGE + 55
+#define RES_RESTORED_MACS RES_MESSAGE + 56
+#define RES_RESTORED_CORRUPT RES_MESSAGE + 57
+#define RES_RESTORED_CORRUPTS RES_MESSAGE + 58
+#define RES_RESTORED_CORRUPT_WARNING RES_MESSAGE + 59
+#define RES_RESTORED_IN_USE RES_MESSAGE + 60
+#define RES_RESTORED_IN_USES RES_MESSAGE + 61
+#define RES_RESTORED_IN_USE_WARNING RES_MESSAGE + 62
+#define RES_VERIFIED_DIR_FILE RES_MESSAGE + 63
+#define RES_VERIFIED_DIR_FILES RES_MESSAGE + 64
+#define RES_VERIFIED_DIRS_FILES RES_MESSAGE + 65
+#define RES_VERIFIED_MAC RES_MESSAGE + 66
+#define RES_VERIFIED_MACS RES_MESSAGE + 67
+#define RES_FILE_IS_DIFFERENT RES_MESSAGE + 68
+#define RES_FILES_DIFFERENT RES_MESSAGE + 69
+#define RES_FILE_NOT_FOUND_ON_DISK RES_MESSAGE + 70
+#define RES_PROCESSED_BYTES RES_MESSAGE + 71
+#define RES_PROCESSED_BYTES_MIN RES_MESSAGE + 72
+#define RES_PROCESSED_BYTES_SEC RES_MESSAGE + 73
+#define RES_PROCESS_RATE RES_MESSAGE + 74
+#define RES_VERIFIED_DIRS_FILE RES_MESSAGE + 75
+#define RES_RESTORE_TITLE RES_MESSAGE + 76 /* open for use */
+#define RES_TENSION_TITLE RES_MESSAGE + 77 /* open for use */
+#define RES_ERASE_TITLE RES_MESSAGE + 78 /* open for use */
+#define RES_FILE_READ_ERROR RES_MESSAGE + 79
+#define RES_FILE_WRITE_ERROR RES_MESSAGE + 80
+#define RES_DIR_STARTED RES_MESSAGE + 81
+#define RES_DIR_COMPLETED RES_MESSAGE + 82
+#define RES_DIR_DIR_FILE RES_MESSAGE + 83
+#define RES_DIR_DIR_FILES RES_MESSAGE + 84
+#define RES_DIR_DIRS_FILES RES_MESSAGE + 85
+#define RES_DIR_MAC RES_MESSAGE + 86
+#define RES_DIR_MACS RES_MESSAGE + 87
+#define RES_DIR_CORRUPT_WARNING RES_MESSAGE + 88
+#define RES_DIR_CORRUPT RES_MESSAGE + 89
+#define RES_DIR_CORRUPTS RES_MESSAGE + 90
+#define RES_DIR_IN_USE_WARNING RES_MESSAGE + 91
+#define RES_DIR_IN_USE RES_MESSAGE + 92
+#define RES_DIR_IN_USES RES_MESSAGE + 93
+#define RES_WRITE_PROTECTED RES_MESSAGE + 94
+#define RES_UNKNOWN_DEVICE RES_MESSAGE + 95
+#define RES_DRIVE_NOT_READY RES_MESSAGE + 96
+#define RES_SEEK_ERROR RES_MESSAGE + 97
+#define RES_SECTOR_NOT_FOUND RES_MESSAGE + 98
+#define RES_PRINTER_ERROR RES_MESSAGE + 99
+#define RES_WRITE_ERROR RES_MESSAGE + 100
+#define RES_READ_ERROR RES_MESSAGE + 101
+#define RES_GENERAL_FAILURE RES_MESSAGE + 102
+#define RES_UNRECOVERABLE_DISK_ERROR RES_MESSAGE + 103
+#define RES_SKIPPED_SCRIPT_HEADER RES_MESSAGE + 104
+#define RES_SKIPPED_SCRIPT_ERROR RES_MESSAGE + 105
+#define RES_WAITING_FOR_OPEN RES_MESSAGE + 106
+#define RES_DISPLAY_VOLUME RES_MESSAGE + 107
+#define RES_CORRUPT_HEADER RES_MESSAGE + 108
+#define RES_CATALOG_MAINTENANCE_STATUS RES_MESSAGE + 109
+#define RES_CATALOG_DIRECTORY_STATUS RES_MESSAGE + 110
+#define RES_CATALOG_TAPE_SUCCESS_MSG RES_MESSAGE + 111
+#define RES_CATALOG_TAPE_ERROR_MSG RES_MESSAGE + 112
+#define RES_CATALOG_CONTINUATION_MSG RES_MESSAGE + 113
+#define RES_INSERT_CONTINUATION_MSG RES_MESSAGE + 114
+#define RES_INSERT_TAPE_TO_CATALOG_MSG RES_MESSAGE + 115
+#define RES_CAT_DELETE_SUCCESS_MSG RES_MESSAGE + 116
+#define RES_CAT_NO_ITEMS_MSG RES_MESSAGE + 117
+#define RES_FILE_DIFFERENT RES_MESSAGE + 118
+#define RES_ON_TAPE RES_MESSAGE + 119
+#define RES_ON_DISK RES_MESSAGE + 120
+#define RES_VERIFY_SCRIPT_HEADER RES_MESSAGE + 121
+#define RES_VERIFY_DATA_DIFFERENCE RES_MESSAGE + 122
+#define RES_VERIFY_OPEN_ERROR RES_MESSAGE + 123
+#define RES_VERIFY_DATA_VERIFIED RES_MESSAGE + 124
+#define RES_SKIPPING_REMOTE RES_MESSAGE + 125
+#define RES_CANT_SEARCH RES_MESSAGE + 126
+#define RES_DELETE_STARTED RES_MESSAGE + 127
+#define RES_DELETE_COMPLETED RES_MESSAGE + 128
+#define RES_DELETE_DIR_FILE RES_MESSAGE + 129
+#define RES_DELETE_DIR_FILES RES_MESSAGE + 130
+#define RES_DELETE_DIRS_FILES RES_MESSAGE + 131
+#define RES_DELETE_MAC RES_MESSAGE + 132
+#define RES_DELETE_MACS RES_MESSAGE + 133
+#define RES_RESTORE_FILE_PROMPT RES_MESSAGE + 134
+#define RES_ENTER_TAPE_PASSWORD RES_MESSAGE + 135
+#define RES_NO_TAPE_PASSWORD RES_MESSAGE + 136
+#define RES_CONFIRM_TAPE_PASSWORD RES_MESSAGE + 137
+#define RES_TAPE_PASSWORD_MISMATCH RES_MESSAGE + 138
+#define RES_TAPE_PASSWORD_MATCH RES_MESSAGE + 139
+#define RES_VERIFY_TAPE_PASSWORD RES_MESSAGE + 140
+#define RES_VERIFY_PASSWORD_MISMATCH RES_MESSAGE + 141
+#define RES_NO_PREVIOUS_MATCH RES_MESSAGE + 142
+#define RES_NO_NEXT_MATCH RES_MESSAGE + 143
+#define RES_TAPE_CREATED RES_MESSAGE + 144
+#define RES_TAPE_REQUEST RES_MESSAGE + 145
+#define RES_TAPE_FAMILY_CONTINUES_MSG RES_MESSAGE + 146
+#define RES_DIR_EMPTY_MSG RES_MESSAGE + 147
+#define RES_DIR_SUCCESS_MSG RES_MESSAGE + 148
+#define RES_CATALOG_A_TAPE_STATUS RES_MESSAGE + 149
+#define RES_FILE_NOT_FOUND RES_MESSAGE + 150
+#define RES_FILES_NOT_FOUND RES_MESSAGE + 151
+#define RES_DIRECTORY_NOT_FOUND RES_MESSAGE + 152
+#define RES_DIRECTORYS_NOT_FOUND RES_MESSAGE + 153
+#define RES_DIRECTORY_NOT_FOUND_ON_DISK RES_MESSAGE + 154
+#define RES_FULL_TAPE RES_MESSAGE + 155
+#define RES_TAPE_WEAR RES_MESSAGE + 156
+#define RES_INSERT_NEXT_TAPE RES_MESSAGE + 157
+#define RES_WRONG_TAPE RES_MESSAGE + 158
+#define RES_ARCHIVE_REPLACE_WARNING RES_MESSAGE + 159
+#define RES_CORRUPT_RESTORE_WARNING RES_MESSAGE + 160
+#define RES_OUT_OF_SEQUENCE_WARNING RES_MESSAGE + 161
+#define RES_RESTORE_SHORTER_WARNING RES_MESSAGE + 162
+#define RES_IMAGE_PERC_COMPLETE RES_MESSAGE + 163
+#define RES_IMAGE_BACKED_UP RES_MESSAGE + 164
+#define RES_IMAGE_RESTORED RES_MESSAGE + 165
+#define RES_IMAGE_VERIFIED RES_MESSAGE + 166
+#define RES_IMAGE_DIFFERENT RES_MESSAGE + 167
+#define RES_IMAGE_RESTORE_ERROR RES_MESSAGE + 168
+#define RES_ABORT_RETRY_FAIL RES_MESSAGE + 169
+#define RES_FAIL_KEY RES_MESSAGE + 170
+#define RES_FAIL_STRING RES_MESSAGE + 171
+#define RES_ABORT_KEY RES_MESSAGE + 172
+#define RES_ABORT_STRING RES_MESSAGE + 173
+#define RES_RETRY_KEY RES_MESSAGE + 174
+#define RES_RETRY_STRING RES_MESSAGE + 175
+#define RES_MISSING_NKS RES_MESSAGE + 176
+#define RES_MISSING_RSS RES_MESSAGE + 177
+#define RES_RESTORE_BINDERY RES_MESSAGE + 178
+#define RES_RESTORE_SECURITY RES_MESSAGE + 179
+#define RES_RESTORE_RECOVER RES_MESSAGE + 180
+#define RES_RECOVERED_FILE RES_MESSAGE + 181
+#define RES_RECOVERED_DIR RES_MESSAGE + 182
+#define RES_DATA_LOST RES_MESSAGE + 183
+#define RES_TENSION_STATUS_LABEL RES_MESSAGE + 184
+#define RES_ERASE_STATUS_LABEL RES_MESSAGE + 185
+#define RES_ERASE_QUEST RES_MESSAGE + 186
+#define RES_TENSION_STARTED RES_MESSAGE + 187
+#define RES_TENSION_COMPLETED RES_MESSAGE + 188
+#define RES_ERASE_STARTED RES_MESSAGE + 189
+#define RES_ERASE_COMPLETED RES_MESSAGE + 190
+#define RES_SEC_ERASE_STARTED RES_MESSAGE + 191
+#define RES_SEC_ERASE_COMPLETED RES_MESSAGE + 192
+#define RES_CATALOG_STARTED RES_MESSAGE + 193
+#define RES_CATALOG_COMPLETED RES_MESSAGE + 194
+#define RES_DISPLAY_TAPE RES_MESSAGE + 195
+#define RES_UNCATALOGED_TAPE RES_MESSAGE + 196
+#define RES_CATALOGED_SET RES_MESSAGE + 197
+#define RES_CATALOGED_SETS RES_MESSAGE + 198
+#define RES_CATALOG_QUEST RES_MESSAGE + 199
+#define RES_ALREADY_CATALOGED_SET RES_MESSAGE + 200
+#define RES_CATALOGING_ITEMS RES_MESSAGE + 201
+#define RES_CATALOG_NO_ITEMS RES_MESSAGE + 202
+#define RES_CATALOG_COMPACT_LABEL RES_MESSAGE + 203
+#define RES_CATALOG_COMPACT_PROMPT RES_MESSAGE + 204
+#define RES_CATALOG_INFO RES_MESSAGE + 205
+#define RES_CATALOG_SIZE RES_MESSAGE + 206
+#define RES_CATALOG_COMPACT_STARTED RES_MESSAGE + 207
+#define RES_CATALOG_COMPACT_COMPLETED RES_MESSAGE + 208
+#define RES_AVAILABLE_DISK_SPACE RES_MESSAGE + 209
+#define RES_CATALOG_TAPE_FAMILY RES_MESSAGE + 210
+#define RES_CATALOG_BSET RES_MESSAGE + 211
+#define RES_DELETE_QUEST RES_MESSAGE + 212
+#define RES_PROMPT_VERIFY_BACKUP RES_MESSAGE + 213
+#define RES_PROMPT_VERIFY_RESTORE RES_MESSAGE + 214
+#define RES_MESSAGE_TITLE RES_MESSAGE + 215
+#define RES_NEWLY_CATALOGED_SET RES_MESSAGE + 216
+#define RES_CAT_NO_TAPES_MSG RES_MESSAGE + 217
+#define RES_IMAGE_FOUND RES_MESSAGE + 218
+#define RES_NUM_IMAGE_FOUND RES_MESSAGE + 219
+#define RES_PAGE_UP_ONLY RES_MESSAGE + 220
+#define RES_PAGE_DOWN_ONLY RES_MESSAGE + 221
+#define RES_PAGE_UP_AND_DOWN RES_MESSAGE + 222
+#define RES_NONE_SOME_ALL RES_MESSAGE + 223
+#define RES_DRIVE_TYPES RES_MESSAGE + 224
+#define RES_COMPACTION_OUT_OF_SPACE RES_MESSAGE + 225
+#define RES_CATALOG_CLEANUP_STARTED RES_MESSAGE + 226
+#define RES_CATALOG_CLEANUP_COMPLETED RES_MESSAGE + 227
+#define RES_CATALOGING_IN_PROGRESS RES_MESSAGE + 228
+#define RES_CATALOGING_COMPLETE RES_MESSAGE + 229
+#define RES_TAPE_SELECTION_STATUS RES_MESSAGE + 230
+#define RES_TARGET_DRIVE_WINDOW RES_MESSAGE + 231
+#define RES_ALL_FILES_SELECTED RES_MESSAGE + 232
+#define RES_NO_FILES_SELECTED RES_MESSAGE + 233
+#define RES_SOME_FILES_SELECTED RES_MESSAGE + 234
+#define RES_SEARCHING_FILES RES_MESSAGE + 235
+#define RES_SEARCH_NO_ITEMS_FOUND RES_MESSAGE + 236
+#define RES_CHECKING_DRIVE RES_MESSAGE + 237
+#define RES_POSITION_TAPE RES_MESSAGE + 238
+#define RES_CATALOG_ERASED_TAPE RES_MESSAGE + 239
+#define RES_CATALOG_NO_INFORMATION RES_MESSAGE + 240
+#define RES_TAPE_FILE_SELECT_TAPE RES_MESSAGE + 241
+#define RES_TAPE_FILE_SELECT_LINE2 RES_MESSAGE + 242
+#define RES_FILE_OPEN_ERROR RES_MESSAGE + 243
+#define RES_NOTICES_TITLE RES_MESSAGE + 244
+#define RES_BUILDING_DIRECTORY RES_MESSAGE + 245
+#define RES_VM_CRITICAL_ERROR RES_MESSAGE + 246
+#define RES_EMPTY_TREE_WARNING RES_MESSAGE + 247
+#define RES_ERASE_CAT_WARNING RES_MESSAGE + 248
+#define RES_CONTINU_FILE_WARNING RES_MESSAGE + 249
+#define RES_CONTINU_FILE_PROMPT RES_MESSAGE + 250
+#define RES_CONTINU_IMAGE_WARNING RES_MESSAGE + 251
+#define RES_CATALOG_REPAIR_LABEL RES_MESSAGE + 252
+#define RES_CATALOG_REPAIR_STARTED RES_MESSAGE + 253
+#define RES_CATALOG_REPAIR_COMPLETE RES_MESSAGE + 254
+#define RES_CATALOG_RECREATE_PROMPT RES_MESSAGE + 255
+#define RES_CATALOG_REPAIR_OUT_OF_SPACE RES_MESSAGE + 256
+#define RES_INSERT_MULTI_TAPES RES_MESSAGE + 257
+#define RES_TAPE_DRIVE_NAME RES_MESSAGE + 258
+#define RES_PRODUCT_DESCRIPT RES_MESSAGE + 259
+#define RES_WAIT_AND_REPLACE_TAPE RES_MESSAGE + 260
+#define RES_MAKE_ANOTHER_COPY RES_MESSAGE + 261
+#define RES_ANY_KEY_ESC RES_MESSAGE + 262
+#define RES_DIRECTORY_DIFFERENT RES_MESSAGE + 263
+#define RES_IMAGE_LOGING_WARNING RES_MESSAGE + 264
+#define RES_CATALOG_LEVEL_ZERO RES_MESSAGE + 265
+#define RES_SECURITY_DIFFERENCE RES_MESSAGE + 266
+#define RES_SECURITY_DIFFERENCES RES_MESSAGE + 267
+#define RES_INSUFFICIENT_PRIVILEGE RES_MESSAGE + 268
+#define RES_INSUFFICIENT_DISK_SPACE RES_MESSAGE + 269
+#define RES_ERROR_CREATING_FILE RES_MESSAGE + 270
+#define RES_ERROR_CREATING_DIR RES_MESSAGE + 271
+#define RES_ERROR_RESTORING_AFP_FILE RES_MESSAGE + 272
+#define RES_ERROR_RESTORING_FILE RES_MESSAGE + 273
+#define RES_ERROR_RESTORING_DIR RES_MESSAGE + 274
+#define RES_ERROR_RESTORING_FILE_SEC RES_MESSAGE + 275
+#define RES_ERROR_RESTORING_DIR_SEC RES_MESSAGE + 276
+#define RES_ERROR_RESTORING_TRUSTEE_SEC RES_MESSAGE + 277
+#define RES_EMPTY_DIRECTORY_MESSAGE RES_MESSAGE + 278
+#define RES_CATALOGING_AT_LEVEL_ZERO RES_MESSAGE + 279
+#define RES_CATALOG_DELETE_COMPLETE RES_MESSAGE + 280
+#define RES_CATALOGING_TERMINATED RES_MESSAGE + 281
+#define RES_SEARCHING_NEXT_FILE RES_MESSAGE + 282
+#define RES_MENU_CONTINUE RES_MESSAGE + 283
+#define RES_TEMP_CAT_WARNING RES_MESSAGE + 284
+#define RES_SKIP_CONTINUE RES_MESSAGE + 285
+#define RES_OS_FILE_INFO_DIFFERENT RES_MESSAGE + 286
+#define RES_FULLY_CATALOGED_TAPE RES_MESSAGE + 287
+#define RES_TAPE_FILE_SELECT_BSET RES_MESSAGE + 288
+#define RES_BACKUP_SET_BYTES RES_MESSAGE + 289
+#define RES_NOT_CATALOGING_WARNING RES_MESSAGE + 290
+#define RES_MORE RES_MESSAGE + 291
+#define RES_CONVERT_MAC_BSET RES_MESSAGE + 292
+#define RES_SCRIPT_MARKER RES_MESSAGE + 293
+#define RES_NO_DRIVER_LOADED RES_MESSAGE + 294
+#define RES_SERVER_LOGOUT_DENIED RES_MESSAGE + 295
+#define RES_BAD_ATTR_READ RES_MESSAGE + 296
+#define RES_DISPLAY_BSD_VCB RES_MESSAGE + 297
+#define RES_DETERMINING_LBAS RES_MESSAGE + 298
+#define RES_SKIPPED_DEVICE RES_MESSAGE + 299
+#define RES_ERROR_DURING_OPERATION RES_MESSAGE + 300
+#define RES_ERROR_FILE_TO_EXAMINE RES_MESSAGE + 301
+#define RES_FILE_SECURITY_DIFF RES_MESSAGE + 302
+#define RES_FILE_EA_DIFF RES_MESSAGE + 303
+#define RES_FILE_RES_DIFF RES_MESSAGE + 304
+#define RES_SET_LAD_STARTED RES_MESSAGE + 305
+#define RES_SET_LAD_COMPLETED RES_MESSAGE + 306
+#define RES_ERROR_SETTING_LAD RES_MESSAGE + 307
+#define RES_NOERROR_DURING_OPERATION RES_MESSAGE + 308
+#define RES_NO_TRANSFER_APPEND RES_MESSAGE + 309
+#define RES_MKT_VER_MAJ RES_MESSAGE + 310
+#define RES_MKT_VER_MIN RES_MESSAGE + 311
+#define RES_ENG_VER_MAJ RES_MESSAGE + 312
+#define RES_ENG_VER_MIN RES_MESSAGE + 313
+#define RES_EMPTY_DIR_WARNING RES_MESSAGE + 314
+#define RES_BACKUP_BINDERY RES_MESSAGE + 315
+#define RES_RECOVERY_PROMPT RES_MESSAGE + 316
+#define RES_USER_INPUT RES_MESSAGE + 317
+#define RES_CONNECTION_PASSWORD RES_MESSAGE + 318
+#define RES_REPLACE_SCRIPT RES_MESSAGE + 319
+#define RES_TAPE_NAME RES_MESSAGE + 320
+#define RES_BACKUP_SET_NAME RES_MESSAGE + 321
+#define RES_BACKUP_SET_DESCR RES_MESSAGE + 322
+#define RES_DISPLAY_VERIFY_INFO RES_MESSAGE + 323
+#define RES_CATALOG_TITLE RES_MESSAGE + 324 /* open for use */
+#define RES_DELETE_TITLE RES_MESSAGE + 325 /* open for use */
+#define RES_ERASE_BAD_TAPE RES_MESSAGE + 326
+#define RES_TARGET_TRANSFER_TITLE RES_MESSAGE + 327
+#define RES_ERASE_FOREIGN_TAPE RES_MESSAGE + 328
+#define RES_ERASE_BLANK_TAPE RES_MESSAGE + 329
+#define RES_ERASE_NO_TAPE RES_MESSAGE + 330
+#define RES_ERASE_TAPE_INFO1 RES_MESSAGE + 331
+#define RES_ERASE_TAPE_INFO2 RES_MESSAGE + 332
+#define RES_ABORT_QUESTION RES_MESSAGE + 333
+#define RES_PROCESS_ABORTED RES_MESSAGE + 334
+#define RES_ERASE_DRIVE_BUSY RES_MESSAGE + 335
+#define RES_NEED_NEXT_TAPE RES_MESSAGE + 336
+#define RES_TAPE_FULL RES_MESSAGE + 337
+#define RES_RESTORE_DESC_1 RES_MESSAGE + 338
+#define RES_RETENSION_MESSAGE RES_MESSAGE + 339
+#define RES_TITLE_NEW_LINE RES_MESSAGE + 340
+#define RES_NEXT_SET RES_MESSAGE + 341
+#define RES_NO_NEXT_SET RES_MESSAGE + 342
+#define RES_FOUND_BSET RES_MESSAGE + 343
+#define RES_ERASE_POLL_DRIVE_DISABLED RES_MESSAGE + 344
+#define RES_POLL_DRIVE_BAD_TAPE RES_MESSAGE + 345
+#define RES_POLL_DRIVE_GOOFY_TAPE RES_MESSAGE + 346
+#define RES_KEEP_CURRENT_SETTINGS RES_MESSAGE + 347
+#define RES_ERASE_PWDB RES_MESSAGE + 348
+#define RES_PWDB_DISABLED RES_MESSAGE + 349
+#define RES_PWDB_BAD_CONFIRM RES_MESSAGE + 350
+#define RES_INIT_FILE_SYSTEM RES_MESSAGE + 351
+#define RES_INIT_HARDWARE RES_MESSAGE + 352
+#define RES_INIT_APPLICATION RES_MESSAGE + 353
+#define RES_APPLICATION_INIT RES_MESSAGE + 354
+#define RES_INIT_VLM RES_MESSAGE + 355
+#define RES_OPENING_LOG_NAME RES_MESSAGE + 356
+#define RES_ERROR_ATTACHING RES_MESSAGE + 357
+#define RES_CLOSING_LOG_NAME RES_MESSAGE + 358
+#define RES_ALREADY_FULLY_CATALOGED RES_MESSAGE + 359
+#define RES_VLM_BLANK_TAPE RES_MESSAGE + 360
+#define RES_VLM_FOREIGN_TAPE RES_MESSAGE + 361
+#define RES_VLM_BAD_TAPE RES_MESSAGE + 362
+#define RES_FILE_WAS_SKIPPED RES_MESSAGE + 363
+#define RES_FILE_WAS_SKIPPED_USER RES_MESSAGE + 364
+#define RES_IMAGE_BACKUP RES_MESSAGE + 365
+#define RES_VLM_NO_TAPE RES_MESSAGE + 366
+#define RES_VLM_BUSY_DRIVE RES_MESSAGE + 367
+#define RES_VLM_UNFORMATED_TAPE RES_MESSAGE + 368
+#define RES_FILE_DETAIL RES_MESSAGE + 369
+#define RES_BACKED_UP_DIRS_FILE RES_MESSAGE + 370
+#define RES_CONTINUE_BACKUP_ABORT RES_MESSAGE + 371 // chs:02-08-93
+#define RES_NEW_PROCESSED_BYTES RES_MESSAGE + 372
+#define RES_BYTES_PROCESSED RES_MESSAGE + 373
+#define RES_BYTES_PROCESSED_HOUR RES_MESSAGE + 374
+#define RES_BYTES_PROCESSED_HOURS RES_MESSAGE + 375
+#define RES_BYTES_PROCESSED_MINUTE1 RES_MESSAGE + 376
+#define RES_BYTES_PROCESSED_MINUTES1 RES_MESSAGE + 377
+#define RES_BYTES_PROCESSED_MINUTE2 RES_MESSAGE + 378
+#define RES_BYTES_PROCESSED_MINUTES2 RES_MESSAGE + 379
+#define RES_BYTES_PROCESSED_SECOND RES_MESSAGE + 380
+#define RES_BYTES_PROCESSED_SECONDS RES_MESSAGE + 381
+#define RES_DISPLAY_VOLUME_1 RES_MESSAGE + 382
+#define RES_CONTINUE_RESTORE_ABORT RES_MESSAGE + 383 // chs:02-08-93
+
+//
+// ABORT ERROR STRING
+//
+
+#define RES_CURRENT_FILE RES_MESSAGE + 384
+#define RES_UNUSED RES_MESSAGE + 385
+#define RES_BACKUP_ABORT_EOF RES_MESSAGE + 386
+#define RES_RESTORE_ABORT_EOF RES_MESSAGE + 387
+
+#define RES_RESTORED_DIRS_FILE RES_MESSAGE + 388 // chs:02-11-93
+
+#define RES_FORMAT_TAPE_WARNING RES_MESSAGE + 389
+#define RES_FORMAT_DIALOG_TITLE RES_MESSAGE + 390
+
+#define RES_FORMAT_STARTED RES_MESSAGE + 391
+#define RES_FORMAT_COMPLETED RES_MESSAGE + 392
+#define RES_ABORT_OPERATION RES_MESSAGE + 393
+
+#define RES_SEARCHING_FOR_EOD RES_MESSAGE + 394
+#define RES_DRIVE_ERROR_DETECTED RES_MESSAGE + 395
+#define RES_OPERATION_COMPLETED RES_MESSAGE + 396 // chs:04-30-93
+#define RES_TAPE_FULL_REWOUND RES_MESSAGE + 397 // chs:05-03-93
+#define RES_NEED_NEXT_TAPE_REWOUND RES_MESSAGE + 398 // chs:05-10-93
+#define RES_INSERT_NEXT_TAPE_REWOUND RES_MESSAGE + 399 // chs:05-10-93
+#define RES_ACTIVE_FILES_RESTORED RES_MESSAGE + 400
+#define RES_SAME_TAPE_FAMILY RES_MESSAGE + 401 // chs:05-20-93
+#define RES_FOREIGN_TAPE_MSG2 RES_MESSAGE + 402
+
+#define RES_BACKUP_ABORT_PART2 RES_MESSAGE + 403 // chs:05-25-93
+#define RES_RESTORE_ABORT_PART2 RES_MESSAGE + 404 // chs:05-25-93
+#define RES_DELETE_DIRS_FILE RES_MESSAGE + 405 // chs:05-26-93
+
+#define RES_HW_COMP_FAILURE RES_MESSAGE + 406 // chs:06-01-93
+#define RES_HW_UNCOMP_FAILURE RES_MESSAGE + 407 // chs:06-01-93
+#define RES_RESUME_PROCESS RES_MESSAGE + 408 // chs:07-13-93
+
+#define RES_USE_TAPE_CATALOGS RES_MESSAGE + 409
+#define RES_VLM_ECC_TAPE RES_MESSAGE + 410
+#define RES_VLM_FUTURE_TAPE RES_MESSAGE + 411
+
+#define RES_NOAPPEND RES_MESSAGE + 412
+#define RES_NODISKSPACE RES_MESSAGE + 413
+
+#define RES_COMM_FAILURE RES_MESSAGE + 414
+#define RES_FILE_NOT_DELETED RES_MESSAGE + 415
+#define RES_DIRECTORY_NOT_DELETED RES_MESSAGE + 416
+#define RES_VLM_GOOFY_TAPE RES_MESSAGE + 417
+#define RES_USESYPLFLAG RES_MESSAGE + 418
+#define RES_VLM_SQL_TAPE RES_MESSAGE + 419
+
+// LOADER
+#define RES_LDR_DUPLICATE_MAG_NAME RES_MESSAGE + 420
+#define RES_LDR_INVALID_MAG_SIZE RES_MESSAGE + 421
+#define RES_LDR_GROUP_NAME_NOT_FOUND RES_MESSAGE + 422
+#define RES_LDR_DUPLICATE_GROUP_NAME RES_MESSAGE + 423
+#define RES_LDR_INVALID_STATING_SLOT RES_MESSAGE + 424
+#define RES_LDR_INVALID_NUMBER_SLOTS RES_MESSAGE + 425
+#define RES_LDR_SLOT_IN_USE RES_MESSAGE + 426
+#define RES_LDR_BAD_MAG_NAME RES_MESSAGE + 427
+#define RES_LDR_WRONG_CONF RES_MESSAGE + 428
+#define RES_LDR_ERASING_GROUP RES_MESSAGE + 429
+#define RES_LDR_OPERATION_ABORTED RES_MESSAGE + 430
+#define RES_LDR_STARTING_TAPE_GROUP RES_MESSAGE + 431
+#define RES_LDR_DEFAULT_SLOTS RES_MESSAGE + 432
+#define RES_LDR_DEFAULT_SLOT RES_MESSAGE + 433
+#define RES_LDR_NO_SELECTION RES_MESSAGE + 434
+// LOADER
+
+#define RES_RESTOREWRITEERROR RES_MESSAGE + 435
+
+#endif
diff --git a/private/utils/ntbackup/inc/entrydat.h b/private/utils/ntbackup/inc/entrydat.h
new file mode 100644
index 000000000..906f25735
--- /dev/null
+++ b/private/utils/ntbackup/inc/entrydat.h
@@ -0,0 +1,57 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: entrydat.h
+
+ Description: Defines and prototypes for entry validation routines
+
+
+ $Log: G:/UI/LOGFILES/ENTRYDAT.H_V $
+
+ Rev 1.1 04 Oct 1992 19:47:04 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:36:46 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef ENTRYDAT_H
+#define ENTRYDAT_H
+
+/* begin include list */
+#include "dw.h"
+/* $end$ include list */
+
+#define OUTPUT_ALL_ITEMS 13
+#define OUTPUT_PRT_ITEMS 9
+#define OUTPUT_NO_ITEMS 3
+
+
+INT16 chk_output_level( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_file_no_wild( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_output_mode( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_net_num( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_date( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_path( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_generic_path( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_generic_file( WDATA_PNTR, CHAR_PTR ) ;
+
+INT16 chk_valid_device_path( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_device_file( WDATA_PNTR, CHAR_PTR ) ;
+
+INT16 chk_valid_file( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_file_name( WDATA_PNTR, CHAR_PTR, BOOLEAN ) ;
+INT16 chk_f_or_p_option( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_output_level( WDATA_PNTR, CHAR_PTR ) ;
+INT16 all_strings_valid( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_yes_no( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_yes_no_prompt( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_catalog_level( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_unknown_bset( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_numeral( WDATA_PNTR, CHAR_PTR ) ;
+INT16 chk_valid_yes_no_autodetermine( WDATA_PNTR, CHAR_PTR ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/erase.h b/private/utils/ntbackup/inc/erase.h
new file mode 100644
index 000000000..9dece1a8f
--- /dev/null
+++ b/private/utils/ntbackup/inc/erase.h
@@ -0,0 +1,52 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: erase.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/ERASE.H_V $
+
+ Rev 1.4 13 Nov 1992 17:45:24 chrish
+Added some stuff for formatting a tape radio button in the erase.
+
+ Rev 1.3 04 Oct 1992 19:47:04 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 06 Apr 1992 09:53:28 CHUCKB
+Added define for translation.
+
+ Rev 1.1 27 Mar 1992 10:29:52 DAVEV
+OEM_MSOFT: add id for Quick Erase button
+
+ Rev 1.0 20 Nov 1991 19:37:02 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_ERASE 39
+#else
+#include "dlg_ids.h"
+#endif
+
+#ifndef ERASE_H
+#define ERASE_H
+
+#define IDM_ERASE 322
+#define IDD_ERASE_LINE1 130
+#define IDD_ERASE_LINE2 131
+#define IDD_ERASE_LINE3 132
+#define IDD_ERASE_CONTINUE_BUTTON 101
+#define IDD_ERASE_CANCEL_BUTTON 102
+#define IDD_ERASE_HELP_BUTTON 103
+#define IDD_ERASE_FORMAT_BUTTON 104
+#define IDD_ERASE_QUICK_BUTTON 105 //OEM_MSOFT use only
+#define IDD_ERASE_SECURE_BUTTON 106
+#define IDD_ERASE_EXCLAMATION_BITMAP 107
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/err_stgs.h b/private/utils/ntbackup/inc/err_stgs.h
new file mode 100644
index 000000000..bf3840ae0
--- /dev/null
+++ b/private/utils/ntbackup/inc/err_stgs.h
@@ -0,0 +1,11 @@
+
+// defines for error messages
+
+#define IDS_JOBIOERR 2000 // is this the highest prime?
+#define IDS_SCHEDULEIOERR (IDS_JOBIOERR+1)
+#define IDS_FOPENERR (IDS_SCHEDULEIOERR+1)
+#define IDS_FREADERR (IDS_FOPENERR+1)
+#define IDS_FWRITEERR (IDS_FREADERR+1)
+#define IDS_FCLOSEERR (IDS_FWRITEERR+1)
+
+
diff --git a/private/utils/ntbackup/inc/error.h b/private/utils/ntbackup/inc/error.h
new file mode 100644
index 000000000..bce5806b6
--- /dev/null
+++ b/private/utils/ntbackup/inc/error.h
@@ -0,0 +1,31 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: error.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/ERROR.H_V $
+
+ Rev 1.2 04 Oct 1992 19:47:06 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 28 Jul 1992 14:55:06 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.0 20 Nov 1991 19:39:22 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _error_h_
+#define _error_h_
+
+VOID eprintf( CHAR_PTR, ... ) ;
+VOID eresprintf( INT, ... ) ;
+
+BOOLEAN eresprintf_cancel( INT, ... ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/esa.h b/private/utils/ntbackup/inc/esa.h
new file mode 100644
index 000000000..595f0b248
--- /dev/null
+++ b/private/utils/ntbackup/inc/esa.h
@@ -0,0 +1,124 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: esa.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Extanded Status Array (ESA)
+ The value of byte zero in the Extended Status Array
+ determines the type of data contained within bytes one
+ through seven. ESA_STATUS_TYPE_IDX is used as an index to
+ byte zero. Note that the high bit of byte zero identifies
+ the array as being either four or eight bytes as shown
+ below.
+
+
+ Location: RET_BUF, CHANNEL, and TPOS
+
+
+ $Log: O:/LOGFILES/ESA.H_V $
+
+ Rev 1.2 25 Jan 1993 10:08:38 TIMN
+Fixed MOVE_ESA macro
+
+**/
+/* $end$ include list */
+
+#ifndef _ESA
+#define _ESA
+
+/*------------------------------------------------------------------------------------------------------|
+| Status Type | E x t e n d e d S t a t u s A r r a y |
+| Discription | |
+|---------------|---------------------------------------------------------------------------------------|
+| |Byte 0 |Byte 1 |Byte 2 |Byte 3 |Byte 4 |Byte 5 |Byte 6 |Byte 7 |
+|-------------------------------------------------------------------------------------------------------|
+|QIC 02 |0x00 |0x00 |Execption |Execption | |
+| | | |Status |Status | |
+| | | |(Byte 0) |(Byte 1) | |
+|------------------------------------------------------------ |
+|SCSI 1 |0x01 |Sense Key |0x00 |0x00 | |
+| | |(Byte 2) | | | |
+|------------------------------------------------------------ |
+|SCSI 2 |0x02 |Sense Key |ASC |ASCQ | |
+| | |(Byte 2) |(Byte 12) |(Byte 13) | |
+|------------------------------------------------------------ |
+|Reserved |0x03-0x0E | | | | |
+|(Standard) | | | | | |
+|------------------------------------------------------------ |
+|SCSI 2 |0x0F |Sense Key |ASC |ASCQ | |
+|Translation | | | | | |
+|------------------------------------------------------------ |
+|Exabyte 8500 |0x10 |Sense Key |ASC |ASCQ | |
+| | |(Byte 2) | | | |
+|------------------------------------------------------------ |
+|Reserved |0x11-0x7F | | | | |
+|(Vendor Unique)| | | | | |
+|-------------------------------------------------------------------------------------------------------|
+|QIC 02 |0x80 |0x00 |Execption |Execption |Execption |Execption |Execption |Execption |
+| | | |Status |Status |Status |Status |Status |Status |
+| | | |(Byte 0) |(Byte 1) |(Byte 2) |(Byte 3) |(Byte 4) |(Byte 5) |
+|-------------------------------------------------------------------------------------------------------|
+|SCSI 1 |0x81 |Sense Key |0x00 |0x00 |0x00 |0x00 |0x00 |0x00 |
+| | |(Byte 2) | | | | | | |
+|-------------------------------------------------------------------------------------------------------|
+|SCSI 2 |0x82 |Sense Key |ASC |ASCQ |0x00 |0x00 |0x00 |0x00 |
+| | |(Byte 2) |(Byte 12) |(Byte 13) | | | | |
+|-------------------------------------------------------------------------------------------------------|
+|Reserved |0x83-0x8E | |
+|(Standard) | | |
+|-------------------------------------------------------------------------------------------------------|
+|SCSI 2 |0x8F |Sense Key |ASC |ASCQ |0x00 |0x00 |0x00 |0x00 |
+|Translation | | | | | | | | |
+|-------------------------------------------------------------------------------------------------------|
+|VP525 |0x90 |Sense Key |0x00 |0x00 |Extended |Extended |0x00 |0x00 |
+| | |(Byte 2) | | |Sense |Sense | | |
+| | | | | |(Byte 10) |(Byte 11) | | |
+|-------------------------------------------------------------------------------------------------------|
+|Exabyte |0x91 |Sense Key |ASC |ASCQ |Extended |Extended |Extended |0x00 |
+| | |(Byte 2) |(Byte 12) |(Byte 13) |Sense |Sense |Sense | |
+| | | | | |(Byte 19) |(Byte 20) |(Byte 21) | |
+|-------------------------------------------------------------------------------------------------------|
+|Reserved |0x92-0xFF | |
+|(Vendor Unique)| | |
+|------------------------------------------------------------------------------------------------------*/
+
+#define ESA_ARRAY_LENGTH 8
+#define ESA_STATUS_TYPE_IDX 0
+ /* Use when QIC 02 | See comment above for use */
+#define ESA_SENSE_KEY_IDX 1 /* ------------------------|-------------------------------------- */
+#define ESA_EXC0_OR_ASC_IDX 2 /* EXC0 = Exception Status | ASC = Additonal Sense Code */
+#define ESA_EXC1_OR_ASCQ_IDX 3 /* EXC1 | ASCQ = Additonal Sense Code Qualifier */
+#define ESA_EXC2_OR_EXT0_IDX 4 /* EXC2 | EXT0 = Extended Sence */
+#define ESA_EXC3_OR_EXT1_IDX 5 /* EXC3 | EXT1 */
+#define ESA_EXC4_OR_EXT2_IDX 6 /* EXC4 | EXT2 */
+#define ESA_EXC5_IDX 7 /* EXC5 | */
+
+
+typedef struct {
+ UINT16 esa_valid ;
+ UINT8 esa[ ESA_ARRAY_LENGTH ]; /* Extended Status Array */
+} ESA ;
+
+#define ESA_VALIDITY 0xFACE
+
+/**
+ Macro Definitions
+**/
+
+#define VALID_ESA(ESAfrom) ((ESAfrom).esa_valid == ESA_VALIDITY)
+
+#define MAKE_ESA_VALID(esa) ((esa).esa_valid = ESA_VALIDITY)
+
+#define MAKE_ESA_INVALID(esa) ((esa).esa_valid = 0)
+
+#ifdef MS_DEBUG
+# define MOVE_ESA(to,from) \
+ if ( VALID_ESA( from ) ) { (to) = (from) ; }
+#else
+# define MOVE_ESA(to,from)
+#endif
+
+#endif /* end file */
diff --git a/private/utils/ntbackup/inc/f31proto.h b/private/utils/ntbackup/inc/f31proto.h
new file mode 100644
index 000000000..50f604e8e
--- /dev/null
+++ b/private/utils/ntbackup/inc/f31proto.h
@@ -0,0 +1,50 @@
+/*
+ $Log: T:/LOGFILES/F31PROTO.H_V $
+ *
+ * Rev 1.7 18 Nov 1992 10:39:46 HUNTER
+ * Bug Fixes
+ *
+ *
+ * Rev 1.6 11 Nov 1992 09:50:06 HUNTER
+ * Deleted write prototypes and modified other prototypes.
+ *
+ * Rev 1.5 19 Nov 1991 08:56:16 GREGG
+ * VBLK - Corrected prototype misspelling.
+ *
+ * Rev 1.4 18 Nov 1991 19:59:18 GREGG
+ * Added BOOLEAN abort parameter to F31_WtCloseSet and F31_WtVCB.
+ *
+ * Rev 1.3 07 Nov 1991 15:25:44 unknown
+ * VBLK - Added support for MaynStream v3.1
+ *
+ *
+ * Rev 1.2 16 Sep 1991 20:08:20 GREGG
+ * Changed prototype for SetupFormatEnv to return TFLE_xxx.
+ *
+ * Rev 1.1 03 Jun 1991 10:36:30 NED
+ * added parameter to MoveToVCB()
+ *
+ * Rev 1.0 10 May 1991 15:33:02 GREGG
+ * Initial revision.
+
+*/
+
+#ifndef _F31_PROTOS
+#define _F31_PROTOS
+
+INT16 F31_Initialize( CHANNEL_PTR ) ;
+VOID F31_DeInitialize( VOID_PTR * ) ;
+BOOLEAN F31_Determiner( VOID_PTR ) ;
+UINT16 F31_SizeofTBLK( VOID_PTR ) ;
+INT16 F31_DetBlkType( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+UINT16 F31_RdException( CHANNEL_PTR, INT16 ) ;
+UINT16 F31_CalculatePad( UINT16, UINT32, UINT16 ) ;
+INT16 F31_RdVCB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F31_RdDDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F31_RdFDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F31_RdCFDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F31_RdUDB( CHANNEL_PTR, BUF_PTR ) ;
+BOOLEAN F31_RdContTape( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F31_MoveToVCB( CHANNEL_PTR, INT16, BOOLEAN_PTR, BOOLEAN ) ;
+INT16 F31_RdStream( CHANNEL_PTR, BUF_PTR ) ;
+#endif
diff --git a/private/utils/ntbackup/inc/f40proto.h b/private/utils/ntbackup/inc/f40proto.h
new file mode 100644
index 000000000..de8f24ddd
--- /dev/null
+++ b/private/utils/ntbackup/inc/f40proto.h
@@ -0,0 +1,242 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: mayn40.h
+
+ Description: Maynard's 4.0 Format prototypes. See the Document for
+ complete details.
+
+
+ $Log: T:/LOGFILES/F40PROTO.H_V $
+
+ Rev 1.32 20 Oct 1993 19:37:04 GREGG
+Added string type conversion of tape name password if THDR type != SSET type.
+
+ Rev 1.31 08 Sep 1993 13:26:46 GREGG
+Changed proto of F40_InitTape to match version 1.27 of mtf10wdb.c.
+
+ Rev 1.30 17 Jul 1993 17:56:54 GREGG
+Changed write translator functions to return INT16 TFLE_xxx errors instead
+of BOOLEAN TRUE/FALSE. Files changed:
+ MTF10WDB.C 1.23, TRANSLAT.H 1.22, F40PROTO.H 1.30, FMTENG.H 1.23,
+ TRANSLAT.C 1.43, TFWRITE.C 1.68, MTF10WT.C 1.18
+
+ Rev 1.29 22 Jun 1993 10:53:30 GREGG
+Added API to change the catalog directory path.
+
+ Rev 1.28 08 Jun 1993 00:05:38 GREGG
+Fix for bug in the way we were handling EOM and continuation OTC entries.
+Files modified for fix: mtf10wt.c, otc40wt.c, otc40msc.c f40proto.h mayn40.h
+
+ Rev 1.27 29 Apr 1993 22:26:54 GREGG
+Added proto for F40_StartRead (new in mayn40rd.c).
+
+ Rev 1.26 25 Apr 1993 17:36:04 GREGG
+Fourth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Parse the device name and volume name out of the FS supplied "volume
+ name", and write it to tape as separate fields.
+ - Generate the "volume name" the FS and UI expect out of the device
+ name and volume name on tape.
+ - Write all strings without NULL terminater, and translate them back
+ to NULL terminated strings on the read side.
+
+Matches: MTF10WDB.C 1.8, F40PROTO.H 1.26, OTC40WT.C 1.24, MAYN40.H 1.33,
+ MAYN40RD.C 1.57, OTC40RD.C 1.25
+
+ Rev 1.25 18 Apr 1993 00:48:46 GREGG
+First in a series of incremental changes to bring the translator in line
+with the MTF spec:
+ - Changed prototype for F40_SaveLclName (CHAR_PTRs are now UINT8_PTRs).
+
+Matches: MTF10WDB.C 1.6, MTF10WT.C 1.6, MAYN40RD.C 1.53 and MAYN40.H 1.31
+
+ Rev 1.24 09 Mar 1993 18:14:48 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.23 27 Jan 1993 14:42:56 GREGG
+Added prototypes of formerly static function due to the split of mayn40wt.c.
+
+ Rev 1.22 26 Jan 1993 01:30:58 GREGG
+Added Fast Append functionality.
+
+ Rev 1.21 07 Dec 1992 23:36:16 GREGG
+Removed proto for OTC_GetDataSize (it no longer exists).
+
+ Rev 1.20 02 Dec 1992 13:49:12 GREGG
+Changed proto for F40_GetBlkType (unicode fix).
+
+ Rev 1.19 24 Nov 1992 18:18:30 GREGG
+Updates to match MTF document.
+
+ Rev 1.18 23 Nov 1992 12:17:44 GREGG
+Fixed Prototype for F40_ParseEOM().
+
+ Rev 1.17 23 Nov 1992 10:59:58 HUNTER
+Changed Prototype for F40_ParseEOM().
+
+ Rev 1.16 23 Nov 1992 10:20:18 HUNTER
+Added prototype for F40_ParseEOM().
+
+ Rev 1.15 23 Nov 1992 10:05:46 GREGG
+Changes for path in stream.
+
+ Rev 1.14 09 Nov 1992 10:49:20 GREGG
+Added and altered prototypes for new OTC method.
+
+ Rev 1.13 03 Nov 1992 09:37:02 HUNTER
+Changes for Stream Stuff
+
+ Rev 1.12 22 Oct 1992 10:51:14 HUNTER
+changes for new stream header stuff
+
+ Rev 1.11 25 Sep 1992 09:30:32 GREGG
+Added F40_RdEOSPadBlk prototype.
+
+ Rev 1.10 22 Sep 1992 09:01:42 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.9 30 Jul 1992 16:48:54 GREGG
+Added protos for formerly static functions.
+
+ Rev 1.8 01 Jul 1992 18:34:46 GREGG
+Added protos for date conversion routines.
+
+ Rev 1.7 09 Jun 1992 16:03:52 GREGG
+Added proto for F40_CalcChecksum.
+
+ Rev 1.6 08 Jun 1992 16:56:22 GREGG
+Changed return type for F40_SaveLclName.
+
+ Rev 1.5 01 Jun 1992 15:49:56 GREGG
+Changed last param of F40_SaveLclName from INT16 to UINT16.
+
+ Rev 1.4 20 May 1992 18:16:20 GREGG
+Changes to support OTC read.
+
+ Rev 1.3 05 May 1992 11:29:48 GREGG
+Changed protos to a bunch of function which now need the environment.
+
+ Rev 1.2 29 Apr 1992 13:01:56 GREGG
+Added/Removed/Changed prototypes.
+
+ Rev 1.1 05 Apr 1992 17:57:02 GREGG
+ROLLER BLADES - Initial OTC integration.
+
+ Rev 1.0 25 Mar 1992 20:52:22 GREGG
+Initial revision.
+
+**/
+
+
+#ifndef _F40_PROTOS
+#define _F40_PROTOS
+#include "mayn40.h"
+
+INT16 F40_Initialize( CHANNEL_PTR ) ;
+VOID F40_DeInitialize( VOID_PTR * ) ;
+BOOLEAN F40_Determiner( VOID_PTR ) ;
+UINT16 F40_SizeofTBLK( VOID_PTR ) ;
+INT16 F40_DetBlkType( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+UINT16 F40_RdException( CHANNEL_PTR, INT16 ) ;
+INT16 F40_StartRead( CHANNEL_PTR ) ;
+
+/***** These have been added for the start of OTC support
+ NOTE that these have changes that may be removed or
+ altered when the translator no longer needs to use
+ smoke and mirrors to process TAPE and VOLB blocks.
+******/
+INT16 F40_RdVOLB( BUF_PTR buffer, VOID_PTR env_ptr, BOOLEAN_PTR cont_volb, UINT8_PTR str_type ) ;
+INT16 F40_NewTape( CHANNEL_PTR channel, BUF_PTR buffer, BOOLEAN_PTR need_read ) ;
+
+INT16 F40_WtVOLB( CHANNEL_PTR channel, BUF_PTR buffer, BOOLEAN continuation, UINT16_PTR offset ) ;
+INT16 F40_WriteInit( CHANNEL_PTR channel, UINT16 otc_level, BUF_PTR buffer ) ;
+INT16 F40_InitTape( CHANNEL_PTR channel, BOOLEAN continuation, BUF_PTR tmpBUF ) ;
+
+/* Set the 4 char block type name in the current header */
+VOID F40_SetBlkType( MTF_DB_HDR_PTR cur_hdr, UINT8_PTR block_type ) ;
+/* Get a UINT16 value that represents the current block type name */
+UINT16 F40_GetBlkType( MTF_DB_HDR_PTR cur_hdr ) ;
+
+INT16 F40_RdSSET( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_RdDIRB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_RdFILE( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_RdIMAG( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_RdCFIL( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_RdUDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_RdMDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_RdStream( CHANNEL_PTR, BUF_PTR ) ;
+BOOLEAN F40_Recall( CHANNEL_PTR, BUF_PTR ) ;
+BOOLEAN F40_RdContTape( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_WtSSET( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+INT16 F40_WtDIRB( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+INT16 F40_WtDBDB( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+INT16 F40_WtFILE( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+INT16 F40_WtESET( CHANNEL_PTR, BUF_PTR, BOOLEAN, BOOLEAN ) ;
+INT16 F40_WtStream( CHANNEL_PTR, BUF_PTR, STREAM_INFO_PTR ) ;
+INT16 F40_EndData( CHANNEL_PTR, BUF_PTR ) ;
+INT16 F40_WtCFIL( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+INT16 F40_WtIMAG( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+INT16 F40_WtContVStream( CHANNEL_PTR, BUF_PTR ) ;
+VOID F40_WtEndVStream( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+INT16 F40_WtCloseSet( CHANNEL_PTR, BOOLEAN ) ;
+VOID F40_ParseWrittenBuffer( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+INT16 F40_WtCloseTape( CHANNEL_PTR ) ;
+INT16 F40_WtContTape( CHANNEL_PTR ) ;
+VOID F40_WtEOSPadBlk( CHANNEL_PTR ) ;
+INT16 F40_MoveToVCB( CHANNEL_PTR, INT16, BOOLEAN_PTR, BOOLEAN ) ;
+INT16 F40_SeekEOD( CHANNEL_PTR ) ;
+
+INT16 F40_SaveLclName( UINT8_PTR *dest_string, UINT8_PTR source_string,
+ UINT16_PTR dest_length, UINT16_PTR last_alloc_size,
+ UINT16 source_length ) ;
+UINT16 F40_CopyAndTerminate( UINT8_PTR *, UINT8_PTR, UINT16, UINT8, UINT8 ) ;
+UINT16 F40_CalcChecksum( UINT16_PTR StartPtr, UINT16 Length ) ;
+VOID TapeDateToDate( DATE_TIME_PTR date, MTF_DATE_TIME_PTR tape_date ) ;
+VOID DateToTapeDate( MTF_DATE_TIME_PTR tape_date, DATE_TIME_PTR date ) ;
+UINT16 SetupDBHeader( UINT8_PTR block_type, CHANNEL_PTR channel,
+ DBLK_PTR cur_dblk, MTF_DB_HDR_PTR cur_hdr,
+ UINT16 offset, BOOLEAN data_to_follow,
+ BOOLEAN continuation ) ;
+UINT32 F40_CalcRunningLBA( F40_ENV_PTR ) ;
+VOID F40_SetBlkType( MTF_DB_HDR_PTR, UINT8_PTR ) ;
+
+/* On Tape Catalog APIs in MYN40OTC.C */
+
+INT F40_LoadSM( CHANNEL_PTR channel, BOOLEAN_PTR complete, BOOLEAN get_best ) ;
+INT F40_LoadFDD( CHANNEL_PTR channel ) ;
+INT F40_GetNextSMEntry( CHANNEL_PTR channel ) ;
+INT F40_GetNextFDDEntry( CHANNEL_PTR channel ) ;
+VOID F40_CloseCatalogs( VOID_PTR env_ptr ) ;
+
+/* On Tape Catalog Protos (for modules OTC40RD.C, OTC40MSC.C & OTC40WT.C) */
+
+INT16 OTC_GetPrevSM( CHANNEL_PTR channel, BUF_PTR buffer, BOOLEAN get_best, BOOLEAN expect_sm ) ;
+INT16 OTC_GenSMHeader( CHANNEL_PTR channel ) ;
+INT16 OTC_OpenSM( F40_ENV_PTR cur_env, BOOLEAN appending, BOOLEAN_PTR sm_exists ) ;
+INT16 OTC_OpenFDD(F40_ENV_PTR cur_env ) ;
+VOID OTC_Close( F40_ENV_PTR cur_env, UINT16 otc_files, BOOLEAN delete_after ) ;
+INT16 OTC_WriteCat( CHANNEL_PTR channel, MTF_ESET_PTR cur_eset ) ;
+INT16 OTC_GenVolEntry( F40_ENV_PTR cur_env, MTF_VOL_PTR cur_volb, INT16 seq_num ) ;
+INT16 OTC_GenDirEntry( CHANNEL_PTR channel, MTF_DIR_PTR cur_dir, INT16 seq_num ) ;
+INT16 OTC_GenDBDBEntry( CHANNEL_PTR channel, F40_DBDB_PTR cur_dir, INT16 seq_num ) ;
+INT16 OTC_GenFileEntry( F40_ENV_PTR cur_env, MTF_FILE_PTR cur_file, INT16 seq_num ) ;
+INT16 OTC_GenEndEntry( CHANNEL_PTR channel ) ;
+INT16 OTC_GenSMEntry( MTF_SSET_PTR cur_sset, CHANNEL_PTR channel, BOOLEAN continuation ) ;
+INT16 OTC_MarkLastEntryCorrupt( F40_ENV_PTR cur_env ) ;
+INT16 OTC_RdSSET( CHANNEL_PTR channel ) ;
+INT16 OTC_RdDIR( CHANNEL_PTR channel ) ;
+INT16 OTC_RdFILE( CHANNEL_PTR channel ) ;
+INT16 OTC_FDDtoFile( CHANNEL_PTR channel ) ;
+INT16 OTC_ReadABuff( F40_ENV_PTR cur_env, UINT16 length ) ;
+INT16 OTC_GetFDDType( CHANNEL_PTR channel, UINT16_PTR blk_type ) ;
+INT16 OTC_SkipFDDEntry( CHANNEL_PTR channel ) ;
+INT16 OTC_SkipFDDContEntries( CHANNEL_PTR channel ) ;
+INT16 OTC_UpdateSMEntry( F40_ENV_PTR cur_env ) ;
+INT16 OTC_PreprocessEOM( F40_ENV_PTR cur_env, UINT32 cross_lba ) ;
+INT16 OTC_PostprocessEOM( CHANNEL_PTR channel, UINT32 sset_lba ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/fake_fs.h b/private/utils/ntbackup/inc/fake_fs.h
new file mode 100644
index 000000000..d051bbc0f
--- /dev/null
+++ b/private/utils/ntbackup/inc/fake_fs.h
@@ -0,0 +1,31 @@
+#ifndef _fake_fs_h_
+#define _fake_fs_h_
+
+INT16 FAKE_REM_AttachToDLE( FSYS_HAND fsh , /* I - File system handle */
+ GENERIC_DLE_PTR dle , /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd ); /* I - passowrd */
+
+
+INT16 FAKE_REM_DetachDLE( FSYS_HAND fsh ) ;
+
+
+
+INT16 FAKE_RWS_AttachToDLE( FSYS_HAND fsh , /* I - File system handle */
+ GENERIC_DLE_PTR dle , /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name , /* I - user name NOT USED */
+ CHAR_PTR pswd ); /* I - passowrd NOT USED */
+
+
+
+INT16 FAKE_RWS_DetachDLE( FSYS_HAND fsh ) ;
+UINT16 AddRemoteDriveDLEs( GENERIC_DLE_PTR parent_dle ) ;
+
+INT16 FREM_Initialize(
+DLE_HAND dle_hand,
+BE_CFG_PTR cfg,
+UINT32 file_sys_mask ) ;
+
+VOID FREM_Deinit( DLE_HAND dle_hand ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/farlib.h b/private/utils/ntbackup/inc/farlib.h
new file mode 100644
index 000000000..83a6abe60
--- /dev/null
+++ b/private/utils/ntbackup/inc/farlib.h
@@ -0,0 +1,152 @@
+/*
+** Stuff to glue together code written for MSC to the CR libraries
+*/
+
+/*
+** Functions that operate on large data pointers, since we MUST
+** compile in small model.
+*/
+
+#include "stdtypes.h"
+#include "fartypes.h"
+
+#ifndef _farlib_
+#define _farlib_
+
+INT8 memfcmp( VOID_FAR_PTR arg1,VOID_FAR_PTR arg2,UINT16 cnt );
+INT8 memficmp( VOID_FAR_PTR arg1,VOID_FAR_PTR arg2,UINT16 cnt );
+VOID memfcpy( VOID_FAR_PTR dest,VOID_FAR_PTR src,UINT16 cnt );
+VOID memfset( VOID_FAR_PTR dest,CHAR c,UINT16 cnt );
+VOID strfcpy( CHAR_FAR_PTR dest,CHAR_FAR_PTR src );
+VOID strnfcpy( CHAR_FAR_PTR dest,CHAR_FAR_PTR src,UINT16 max );
+INT16 strnfcmp( CHAR_FAR_PTR str1,CHAR_FAR_PTR str2,UINT16 max );
+INT16 strfcmp( CHAR_FAR_PTR str1,CHAR_FAR_PTR str2 );
+VOID strnfcat( CHAR_FAR_PTR str1,CHAR_FAR_PTR str2,UINT16 max );
+
+typedef VOID ( _interrupt far * INT_HANDLER )( VOID ) ;
+
+INT_HANDLER getvect( UINT8 vector ) ;
+VOID setvect( UINT8 vector,INT_HANDLER newhandler ) ;
+
+/*
+** Make sure our routines are available if needed
+*/
+#undef memcmp
+#undef memicmp
+#undef memcpy
+#undef memset
+#undef strcpy
+#undef strncpy
+#undef strcmp
+#undef strncmp
+#undef strcat
+#undef strncat
+#undef malloc
+#undef free
+#undef calloc
+#undef realloc
+
+#define memcmp(a1,a2,n) memfcmp(a1,a2,n)
+#define memicmp(a1,a2,n) memficmp(a1,a2,n)
+#define memcpy(d,s,n) memfcpy(d,s,n)
+#define memset(d,c,n) memfset(d,c,n)
+#define strcpy(d,s) strfcpy(d,s)
+#define strncpy(d,s,n) strnfcpy(d,s,n)
+#define strcmp(s1,s2) strfcmp(s1,s2)
+#define strncmp(s1,s2,n) strnfcmp(s1,s2,n)
+#define strncat(s1,s2,n) strnfcat(s1,s2,n)
+
+/*
+** String functions needed in native model but not included in CodeRunner
+*/
+
+CHAR_PTR strrev( CHAR_PTR str );
+CHAR_PTR strcat( CHAR_PTR str1,CHAR_PTR str2 );
+CHAR_PTR strchr( CHAR_PTR str,CHAR c );
+
+/*
+** Replacement for the standard library memory management
+*/
+
+#define FP_SEG(fp) ((UINT16) ((UINT32)(VOID_FAR_PTR)(fp)>>16))
+#define FP_OFF(fp) ((UINT16) (fp))
+
+#define MK_FP(seg,off) \
+ ((VOID_FAR_PTR) (((UINT32)seg<<16)|off))
+
+VOID_FAR_PTR tsrmalloc( UINT16 amount );
+VOID (* tsrheapbreak( VOID ))( VOID );
+VOID_FAR_PTR strdup( char *s );
+
+
+#define malloc(x) tsrmalloc(x)
+#define free(x)
+#define calloc(x,y) NULL
+#define realloc(x) NULL
+
+/*
+** Often used macros from the std libraries
+*/
+
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+
+/*
+** Map the int86 and int86x functions to the CodeRunner equivalents
+*/
+
+#ifndef _REGS_DEFINED
+
+/* word registers */
+
+struct WORDREGS {
+ unsigned int ax;
+ unsigned int bx;
+ unsigned int cx;
+ unsigned int dx;
+ unsigned int si;
+ unsigned int di;
+ unsigned int cflag;
+ };
+
+
+/* byte registers */
+
+struct BYTEREGS {
+ unsigned char al, ah;
+ unsigned char bl, bh;
+ unsigned char cl, ch;
+ unsigned char dl, dh;
+ };
+
+
+/* general purpose registers union -
+ * overlays the corresponding word and byte registers.
+ */
+
+union REGS {
+ struct WORDREGS x;
+ struct BYTEREGS h;
+ };
+
+
+/* segment registers */
+
+struct SREGS {
+ unsigned int es;
+ unsigned int cs;
+ unsigned int ss;
+ unsigned int ds;
+ };
+
+#define _REGS_DEFINED
+
+#endif
+
+INT16 int86(INT8, union REGS *, union REGS *);
+INT16 int86x(INT8, union REGS *, union REGS *, struct SREGS *);
+VOID dosver( CHAR_PTR major,CHAR_PTR minor );
+
+extern int _doserrno;
+#endif
+
diff --git a/private/utils/ntbackup/inc/fartypes.h b/private/utils/ntbackup/inc/fartypes.h
new file mode 100644
index 000000000..833846773
--- /dev/null
+++ b/private/utils/ntbackup/inc/fartypes.h
@@ -0,0 +1,36 @@
+/*
+** Far pointers to various types
+*/
+
+#ifndef _far_types_
+#define _far_types_
+
+#ifndef MK_FP
+#define MK_FP(seg,off) \
+ ((VOID_FAR_PTR) (((UINT32)seg<<16)|off))
+#endif
+
+/*
+** The Watcom C compiler has no idea what far pointers are, so just
+** define them out. (Watcom predefines 'far' to '__far', so actually
+** need to define that one out.)
+*/
+
+#ifdef __WATCOMC__
+#define __far
+#endif
+
+typedef VOID far *VOID_FAR_PTR;
+
+typedef CHAR far *CHAR_FAR_PTR;
+typedef INT8 far *INT8_FAR_PTR;
+typedef UINT8 far *UINT8_FAR_PTR;
+typedef INT16 far *INT16_FAR_PTR;
+typedef UINT16 far *UINT16_FAR_PTR;
+typedef INT32 far *INT32_FAR_PTR;
+typedef UINT32 far *UINT32_FAR_PTR;
+typedef BOOLEAN far *BOOLEAN_FAR_PTR;
+
+typedef VOID (far *VOID_FAR_PF)();
+
+#endif
diff --git a/private/utils/ntbackup/inc/filerepl.h b/private/utils/ntbackup/inc/filerepl.h
new file mode 100644
index 000000000..ec4f6c891
--- /dev/null
+++ b/private/utils/ntbackup/inc/filerepl.h
@@ -0,0 +1,68 @@
+/***************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: filerepl.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the FREPLACE code.
+
+ $Log: G:/UI/LOGFILES/FILEREPL.H_V $
+
+ Rev 1.2 04 Oct 1992 19:47:08 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 12 Aug 1992 18:28:34 STEVEN
+fix warinings
+
+ Rev 1.0 20 Nov 1991 19:39:48 SYSTEM
+Initial revision.
+
+****************************************************/
+
+#ifndef FILEREPL_H
+#define FILEREPL_H
+
+#define FILE_REPLACE_YES_BUTTON 1
+#define FILE_REPLACE_YES_TO_ALL_BUTTON 2
+#define FILE_REPLACE_NO_BUTTON 3
+#define FILE_REPLACE_CANCEL_BUTTON 4
+
+#define FILE_REPLACE_ATTRIBUTES_LEN 80
+#define FILE_REPLACE_ATTRIBUTES_SIZE ( FILE_REPLACE_ATTRIBUTES_LEN + 1 )
+
+#define DRIVE_LEN 3
+#define DRIVE_SIZE ( DRIVE_LEN + 1 )
+
+#define SERVER_NAME_LEN 48
+#define SERVER_NAME_SIZE ( SERVER_NAME_LEN + 1 )
+
+#define VOLUME_NAME_LEN 16
+#define VOLUME_NAME_SIZE ( VOLUME_NAME_LEN + 1 )
+
+#define FILE_REPLACE_VOLUME_NAME_LEN ( DRIVE_LEN + SERVER_NAME_LEN + VOLUME_NAME_LEN )
+#define FILE_REPLACE_VOLUME_NAME_SIZE ( FILE_REPLACE_VOLUME_NAME_LEN + 1 )
+
+
+
+
+typedef struct file_replace_temp {
+ WORD dialog_return_status ;
+ CHAR source_volume[ FILE_REPLACE_VOLUME_NAME_SIZE ] ;
+ CHAR destination_volume[ FILE_REPLACE_VOLUME_NAME_SIZE ] ;
+ CHAR source_path[ MAX_UI_PATH_SIZE ] ;
+ CHAR destination_path[ MAX_UI_PATH_SIZE ] ;
+ CHAR line_1[ FILE_REPLACE_VOLUME_NAME_LEN + MAX_UI_PATH_SIZE ] ;
+ CHAR line_2[ FILE_REPLACE_ATTRIBUTES_SIZE ] ;
+ CHAR line_3[ FILE_REPLACE_VOLUME_NAME_LEN + MAX_UI_PATH_SIZE ] ;
+ CHAR line_4[ FILE_REPLACE_ATTRIBUTES_SIZE ] ;
+}FILE_REPLACE_TEMP, *FILE_REPLACE_TEMP_PTR ;
+
+
+/*
+// Call back functions for the display manager
+*/
+
+INT16 DM_StartConfirmFileReplace( FILE_REPLACE_TEMP_PTR ) ;
+VOID DisplayDirectory( HWND, LPSTR, WORD ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/finitfs.h b/private/utils/ntbackup/inc/finitfs.h
new file mode 100644
index 000000000..fa52028ce
--- /dev/null
+++ b/private/utils/ntbackup/inc/finitfs.h
@@ -0,0 +1,31 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: finitfs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: N:/LOGFILES/FINITFS.H_V $
+ *
+ * Rev 1.1 21 Jun 1991 13:20:58 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.0 09 May 1991 13:33:00 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+INT16 AddFakeRemoteWorkStationDLEs( DLE_HAND hand );
+
+INT16 InitializeFakeRemote( DLE_HAND dle_hand, struct BE_CFG *cfg ) ;
+
+VOID RemoveFakeRemote( DLE_HAND dle_hand ) ;
+
+
diff --git a/private/utils/ntbackup/inc/fmteng.h b/private/utils/ntbackup/inc/fmteng.h
new file mode 100644
index 000000000..fc0750da5
--- /dev/null
+++ b/private/utils/ntbackup/inc/fmteng.h
@@ -0,0 +1,215 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fmteng.h
+
+ Date Updated: $./FDT$ $./FTM$
+ 7/21/1989 14:4:121
+
+ Description: The functions and structs defined by this guy are used
+ to determine, setup and free environments that are format
+ and operation specific.
+
+
+ $Log: T:/LOGFILES/FMTENG.H_V $
+ *
+ * Rev 1.24 08 Sep 1993 18:15:46 GREGG
+ * Changed proto of init_tape to match f40proto.h r1.31 and mtf10wdb.c r1.27.
+ *
+ * Rev 1.23 17 Jul 1993 17:56:58 GREGG
+ * Changed write translator functions to return INT16 TFLE_xxx errors instead
+ * of BOOLEAN TRUE/FALSE. Files changed:
+ * MTF10WDB.C 1.23, TRANSLAT.H 1.22, F40PROTO.H 1.30, FMTENG.H 1.23,
+ * TRANSLAT.C 1.43, TFWRITE.C 1.68, MTF10WT.C 1.18
+ *
+ * Rev 1.22 22 Jun 1993 10:53:28 GREGG
+ * Added API to change the catalog directory path.
+ *
+ * Rev 1.21 09 Mar 1993 18:14:38 GREGG
+ * Initial changes for new stream and EOM processing.
+ *
+ * Rev 1.20 26 Jan 1993 01:30:54 GREGG
+ * Added Fast Append functionality.
+ *
+ * Rev 1.19 23 Nov 1992 10:59:28 HUNTER
+ * Changed prototype for EOM parse function.
+ *
+ * Rev 1.18 09 Nov 1992 10:49:00 GREGG
+ * Added tape catalog entry points.
+ *
+ * Rev 1.17 03 Nov 1992 09:36:46 HUNTER
+ * Changes for stream stuff
+ *
+ * Rev 1.16 22 Oct 1992 10:53:04 HUNTER
+ * Changes for new stream headers
+ *
+ * Rev 1.15 22 Sep 1992 09:01:56 GREGG
+ * Initial changes to handle physical block sizes greater than 1K.
+ *
+ * Rev 1.14 14 Aug 1992 16:19:56 GREGG
+ * Removed size fields in function table.
+ *
+ * Rev 1.13 20 May 1992 18:16:38 GREGG
+ * Changes to support OTC read.
+ *
+ * Rev 1.12 29 Apr 1992 12:59:26 GREGG
+ * Added parameter to init_tape function entry.
+ *
+ * Rev 1.11 05 Apr 1992 17:55:18 GREGG
+ * ROLLER BLADES - Initial OTC integration.
+ *
+ * Rev 1.10 25 Mar 1992 20:46:10 GREGG
+ * ROLLER BLADES - Added eom_lba_size.
+ *
+ * Rev 1.9 04 Feb 1992 21:24:38 NED
+ * Changes to Buffer Management translator hooks.
+ *
+ * Rev 1.8 16 Jan 1992 18:31:38 ZEIR
+ * Latest BufferMan solution no longer requires StartReadHook.
+ *
+ *
+ * Rev 1.7 02 Jan 1992 14:49:26 NED
+ * Buffer Manager/UTF translator integration.
+ *
+ * Rev 1.6 05 Dec 1991 14:05:56 GREGG
+ * SKATEBOARD - New Buff Mgt - Initial Integration.
+ *
+ * Rev 1.5 18 Nov 1991 19:59:56 GREGG
+ * Added BOOLEAN abort parameter to wt_mk_vcb and wt_close_set.
+ *
+ * Rev 1.4 07 Nov 1991 15:24:14 HUNTER
+ * VBLK - Added functions for Variable Blocks
+ *
+ * Rev 1.3 16 Sep 1991 20:09:48 GREGG
+ * Changed prototype for SetupFormatEnv to return TFLE_xxx.
+ *
+ * Rev 1.2 03 Jun 1991 10:55:48 GREGG
+ * Changed protos for deinitializer and move_to_vcb.
+ *
+ * Rev 1.1 10 May 1991 14:26:24 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:17:50 GREGG
+Initial revision.
+
+**/
+
+#ifndef _FMT_ENG
+#define _FMT_ENG
+
+#include "buffman.h"
+#include "channel.h"
+#include "fmtinf.h"
+#include "translat.h"
+#include "fsys.h"
+
+/* $end$ */
+/* private data structure used by access routines in translat.c */
+
+typedef struct {
+
+ /* return TRUE if this format recognizes the given data */
+ BOOLEAN (*determiner)( VOID_PTR ) ;
+
+ /* set up translator-specific environment, allocate memory, etc. */
+ INT16 (*initializer)( CHANNEL_PTR ) ;
+
+ /* undo initialization */
+ VOID (*deinitializer)( VOID_PTR * ) ;
+
+ /* see buffman.h for these two */
+ BM_TR_GET_VCB_REQ_FUNC_PTR set_buffer_requirements ;
+ BM_TR_GET_PREF_FUNC_PTR get_preferred_space ;
+
+ /* to be called upon receiving a buffer full during read */
+ VOID (*read_buffer_hook)( CHANNEL_PTR, BUF_PTR ) ;
+
+ /* given a buffer, return block type BT_xxx */
+ INT16 (*parser)( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+
+ UINT16 (*sizeof_tblk)( VOID_PTR ) ;
+
+ /* called when read returns an exception */
+ UINT16 (*exception_action)( CHANNEL_PTR, INT16 ) ;
+
+ /* called upon first examining a new tape. This may do special
+ per-tape things for the translator.
+ */
+ INT16 (*new_tape)( CHANNEL_PTR, BUF_PTR, BOOLEAN_PTR ) ;
+
+ /* Initialize OTC temporary files */
+ INT16 (*write_init)( CHANNEL_PTR, UINT16, BUF_PTR ) ;
+
+ /* Write a TAPE header block */
+ INT16 (*init_tape)( CHANNEL_PTR, BOOLEAN, BUF_PTR ) ;
+
+ /* Move to OTC */
+ INT16 (*start_read)( CHANNEL_PTR ) ;
+
+ /* Move to next/prior/current VCB position */
+ INT16 (*move_to_vcb)( CHANNEL_PTR, INT16, BOOLEAN_PTR, BOOLEAN ) ;
+
+ /* Move to End of Data (for fast append) */
+ INT16 (*seek_eod)( CHANNEL_PTR ) ;
+
+ /* Get the current VCB */
+ INT16 (*get_current_vcb)( CHANNEL_PTR, BUF_PTR ) ;
+
+ /* Call to check validity of VCB or NULL if no append of other
+ formats is possible
+ */
+ BOOLEAN (*verify_vcb)( VOID_PTR ) ;
+
+ BOOLEAN (*rd_cont_tape)( CHANNEL_PTR, BUF_PTR ) ;
+
+ BOOLEAN (*rd_recall)( CHANNEL_PTR, BUF_PTR ) ;
+
+ /* Read conversion routines: */
+ INT16 (*rd_mk_vcb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_ddb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_fdb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_idb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_cfdb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_bsdb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_osudb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_mdb)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*rd_mk_stream) ( CHANNEL_PTR, BUF_PTR ) ;
+
+ /* Write conversion routines: */
+ INT16 (*wt_mk_vcb)( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+ INT16 (*wt_mk_ddb)( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+ INT16 (*wt_mk_fdb)( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+ INT16 (*wt_mk_stream)( CHANNEL_PTR, BUF_PTR, STREAM_INFO_PTR ) ;
+ INT16 (*wt_mk_enddata)( CHANNEL_PTR, BUF_PTR ) ;
+ INT16 (*wt_mk_idb)( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+ INT16 (*wt_mk_cfdb)( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+ INT16 (*wt_cont_vstrm)( CHANNEL_PTR, BUF_PTR ) ;
+ VOID (*wt_end_vstrm)( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+ VOID (*wt_parse_written)( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+ INT16 (*wt_close_tape)( CHANNEL_PTR ) ;
+
+ INT16 (*wt_cont_set)( CHANNEL_PTR ) ;
+
+ INT16 (*wt_close_set)( CHANNEL_PTR, BOOLEAN ) ;
+
+ VOID (*wt_eos_pad_blk)( CHANNEL_PTR ) ;
+
+ /* On Tape Catalog Routines: */
+ INT (*load_set_map)( CHANNEL_PTR, BOOLEAN_PTR, BOOLEAN ) ;
+
+ INT (*load_set_cat)( CHANNEL_PTR ) ;
+
+ INT (*get_next_sm_entry)( CHANNEL_PTR ) ;
+
+ INT (*get_next_sc_entry)( CHANNEL_PTR ) ;
+
+ VOID (*close_catalogs)( VOID_PTR ) ;
+
+} FMT, *FMT_PTR ;
+
+/* The external tape format table (see fmttab.c) */
+
+extern FMT supported_fmts[] ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/fmtinf.h b/private/utils/ntbackup/inc/fmtinf.h
new file mode 100644
index 000000000..4b000a598
--- /dev/null
+++ b/private/utils/ntbackup/inc/fmtinf.h
@@ -0,0 +1,121 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\fmtinf.h
+subsystem\TAPE FORMAT\fmtinf.h
+$0$
+
+ Name: fmtinf.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Describes a support format entry.
+
+ Location: BE_PUBLIC
+
+$Header: T:/LOGFILES/FMTINF.H_V 1.11 22 Apr 1993 03:31:24 GREGG $
+
+$Log: T:/LOGFILES/FMTINF.H_V $
+ *
+ * Rev 1.11 22 Apr 1993 03:31:24 GREGG
+ * Third in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * - Removed all references to the DBLK element 'string_storage_offset',
+ * which no longer exists.
+ * - Check for incompatable versions of the Tape Format and OTC and deals
+ * with them the best it can, or reports tape as foreign if they're too
+ * far out. Includes ignoring the OTC and not allowing append if the
+ * OTC on tape is a future rev, different type, or on an alternate
+ * partition.
+ * - Updated OTC "location" attribute bits, and changed definition of
+ * CFIL to store stream number instead of stream ID.
+ *
+ * Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ * OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ * DETFMT.C 1.13, MTF.H 1.4
+ *
+ * Rev 1.10 22 Jan 1993 13:55:30 unknown
+ * Add the min_size_for_tblk field that was added in rev 1.8.1.0. This revision
+ * should work with the rev 1.11 of the lwtfinf.c.
+ *
+ *
+ * Rev 1.9 30 Apr 1992 16:47:58 CHARLIE
+ * Eliminated MAXFORMATNAME
+ *
+ * Eliminated format_name in TFINF
+ *
+ * format_id in TFINF is a resource index specified in eng_fmt.h to allow
+ * the UI to control the string associated with each format
+ *
+ * Rev 1.8 31 Mar 1992 14:22:18 NED
+ * added indication that translators could read from VCB buffer
+ *
+ * Rev 1.7 22 Jul 1991 12:41:14 GREGG
+ * Added format attribute bit to indicate we must write a continuation tape if
+ * EOS coincides with EOM.
+ *
+ * Rev 1.6 07 Jun 1991 01:21:46 GREGG
+ * Changed proto from TF_GetTapeFormatIndex to TF_GetTapeFormatID
+ *
+ * Rev 1.5 06 Jun 1991 11:30:00 GREGG
+ * added format_id field
+ *
+ * Rev 1.4 05 Jun 1991 15:23:20 NED
+ * added TF_GetTapeFormatIndex() and TF_GetTapeFormatFromIndex() calls,
+ * TAPES_FIRST_TO_LAST attribute bit, and define for UNKNOWN_FORMAT
+ *
+ * Rev 1.3 21 May 1991 17:00:56 NED
+ * added max_password_size field to structure,
+ * moved function declarations to this module.
+ *
+ * Rev 1.2 17 May 1991 08:57:02 DAVIDH
+ * Cleared up errors found by Watcom compiler.
+ *
+ * Rev 1.1 10 May 1991 17:25:54 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:36 GREGG
+Initial revision.
+
+$-4$
+**/
+#ifndef _FMT_INF
+#define _FMT_INF
+
+/* $end$ include list */
+
+#define TFGT_UNKNOWN_FORMAT 0xffff /* what you'll get if you ask for an index and we don't know yet */
+
+/* Define format attribute bits */
+
+#define RD_FORMAT_BIT BIT0 /* We can read this type */
+#define WT_FORMAT_BIT BIT1 /* We can write this type */
+#define INDEX_SUPPORTED BIT2 /* Indexes are supported */
+#define POS_INF_AVAIL BIT3 /* Tape Contains positional information */
+#define APPEND_SUPPORTED BIT4 /* we can append our own sets after these */
+#define TAPES_FIRST_TO_LAST BIT5 /* we've got to see our family in order. */
+#define MUST_WRITE_CONT BIT6 /* We have to write a continuation tape, at
+ EOM even if we hit EOS at the same time. */
+#define CAN_READ_FROM_VCB_BUFF BIT7 /* we can start reading using the data
+ contained in the VCB buffer */
+
+typedef struct {
+ UINT16 attributes ;
+ UINT16 max_password_size ; /* length of max password + 1 */
+ UINT16 format_id ;
+ UINT16 min_size_for_tblk ;
+} TFINF, *TFINF_PTR ;
+
+TFINF_PTR TF_GetTapeFormatInfo( UINT16_PTR num_formats ) ;
+TFINF_PTR TF_GetTapeFormat( UINT16 channel_no ) ;
+UINT16 TF_GetTapeFormatID( UINT16 channel_no ) ;
+TFINF_PTR TF_GetTapeFormatFromID( UINT16 format_id ) ;
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/freplace.h b/private/utils/ntbackup/inc/freplace.h
new file mode 100644
index 000000000..51792e509
--- /dev/null
+++ b/private/utils/ntbackup/inc/freplace.h
@@ -0,0 +1,44 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: freplace.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/FREPLACE.H_V $
+
+ Rev 1.2 04 Oct 1992 19:47:10 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 06 Apr 1992 09:53:46 CHUCKB
+Added define for translation.
+
+ Rev 1.0 20 Nov 1991 19:41:14 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_FILEREPLACE 38
+#else
+#include "dlg_ids.h"
+#endif
+
+#ifndef FREPLACE_H
+#define FREPLACE_H
+
+#define IDD_FILE_REPLACE_LINE1 101
+#define IDD_FILE_REPLACE_LINE2 102
+#define IDD_FILE_REPLACE_LINE3 103
+#define IDD_FILE_REPLACE_LINE4 104
+#define IDD_FILE_REPLACE_YES 110
+#define IDD_FILE_REPLACE_ALL 112
+#define IDD_FILE_REPLACE_NO 111
+#define IDD_FILE_REPLACE_CANCEL 114
+#define IDD_FILE_REPLACE_HELP 105
+#define IDD_FILE_REPLACE_BITMAP 120
+
+#endif
diff --git a/private/utils/ntbackup/inc/fsstream.h b/private/utils/ntbackup/inc/fsstream.h
new file mode 100644
index 000000000..e4006ed11
--- /dev/null
+++ b/private/utils/ntbackup/inc/fsstream.h
@@ -0,0 +1,149 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fsstream.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains stream info structure and related
+ definitions for the file system internals.
+
+ Location: BE_PUBLIC
+
+
+ $Log: M:/LOGFILES/FSSTREAM.H_V $
+
+ Rev 1.14 06 Dec 1993 11:44:30 BARRY
+Corrected stream headers for path/file names
+
+ Rev 1.13 09 Jun 1993 15:35:50 MIKEP
+enable c++
+
+ Rev 1.12 31 Mar 1993 08:51:00 MARILYN
+changed the CRCD checksum stream it to CSUM
+
+ Rev 1.11 01 Mar 1993 17:33:12 MARILYN
+added a CRCD stream header id for checksum streams
+
+ Rev 1.10 17 Nov 1992 16:04:34 BARRY
+Changed ULNK to LINK.
+
+ Rev 1.9 17 Nov 1992 14:15:26 GREGG
+Added PAD stream type.
+
+ Rev 1.8 13 Nov 1992 16:46:00 DON
+Added SMS Stream Header IDs
+
+ Rev 1.7 11 Nov 1992 10:33:02 TIMN
+Changed macro names due to OS2 compiler confusion
+
+ Rev 1.6 26 Oct 1992 17:58:46 BARRY
+Changed NTFS link id.
+
+ Rev 1.5 21 Oct 1992 19:37:54 BARRY
+Added LINK stream header type for NTFS linked files.
+
+ Rev 1.4 16 Oct 1992 15:42:04 STEVEN
+fix stream size problem
+
+ Rev 1.3 16 Oct 1992 10:49:50 STEVEN
+make stream header with uint64 instead of two 32
+
+ Rev 1.2 14 Oct 1992 12:38:10 TIMN
+Moved macros for stream infos from fsys_prv.h
+
+ Rev 1.1 06 Oct 1992 13:33:08 TIMN
+Added fs stream attrib normal
+
+**/
+
+#ifndef _fsstream_h_
+#define _fsstream_h_
+
+
+/* begin include list */
+
+/** are the tf_attrib defines included **/
+#ifndef STREAM_VARIABLE
+# include "tfldefs.h"
+#endif
+
+/* $end$ include list */
+
+
+typedef struct STREAM_INFO *STREAM_INFO_PTR;
+typedef struct STREAM_INFO {
+ UINT32 id ;
+ UINT16 fs_attrib ;
+ UINT16 tf_attrib ;
+ UINT64 size ;
+} STREAM_INFO;
+
+
+/** stream id values **/
+
+#define STRM_INVALID 0
+#define STRM_GENERIC_DATA 0x4e415453 /* 'STAN' */
+#define STRM_PAD 0x44415053 /* 'SPAD' */
+
+#define STRM_PATH_NAME 0x4d414e50 /* 'PNAM' */
+#define STRM_FILE_NAME 0x4d414e46 /* 'FNAM' */
+
+#define STRM_OTC_SM 0x504d5354 /* 'TSMP' On Tape Catalog Set Map */
+#define STRM_OTC_FDD 0x44444654 /* 'TFDD' On Tape Catalog File/Directory Detail */
+
+#define STRM_OS2_EA 0x4145324f /* 'O2EA' */
+#define STRM_OS2_ACL 0x4c43414f /* 'OACL' */
+
+#define STRM_NT_EA 0x4145544e /* 'NTEA' */
+#define STRM_NT_ACL 0x4c43414e /* 'NACL' */
+
+#define STRM_MAC_RESOURCE 0x4353524d /* 'MRSC' */
+#define STRM_NOV_TRUST_286 0x3638324e /* 'N286' */
+#define STRM_NOV_TRUST_386 0x3638334e /* 'N386' */
+#define STRM_NTFS_ALT_DATA 0x54414441 /* 'ADAT' */
+
+#define STRM_NTFS_LINK 0x4b4e494c /* 'LINK' */
+
+#define STRM_SMS_DATA 0x44534d53 /* 'SMSD' */
+#define STRM_CHECKSUM_DATA 0x4d555343 /* 'CSUM' */
+
+#define STRM_EMS_MONO_DB 0x42444d58 /* 'XMDB' */
+#define STRM_EMS_MONO_LOG 0x474c4f58 /* 'XLOG' */
+#define STRM_EMS_MONO_PATHS 0x48545058 /* 'XPTH' */
+
+/** stream attrib values (fs) **/
+
+#define STRM_ATTRIB_NORMAL 0x0000
+#define STRM_ATTRIB_MODIFIED_ON_READ 0x0001
+#define STRM_ATTRIB_CONTAINS_SECURITY 0x0002
+
+
+/** stream macros **/
+
+#define FS_InvalidateStrmId(s_info) ( (s_info)->id = STRM_INVALID )
+
+#define FS_IsStrmGeneric(s_info) ( (s_info)->id == STRM_GENERIC_DATA )
+#define FS_IsStrmIdInvalid(s_info) ( (s_info)->id == STRM_INVALID )
+
+#define FS_IsStrmVariableLength(s_info) \
+ ( (s_info)->tf_attrib & STREAM_VARIABLE )
+
+#define FS_IsStrmModifiedDuringRead(s_info) \
+ ( (s_info)->fs_attrib & STRM_ATTRIB_MODIFIED_ON_READ )
+
+#define FS_IsStreamChecksumed(s_info) \
+ ( (s_info)->tf_attrib & STREAM_CHECKSUMED )
+
+#define FS_GetStrmId(s_info) ( (s_info)->id )
+#define FS_GetStrmAttrib(s_info) ( (s_info)->fs_attrib )
+#define FS_GetStrmSizeLo(s_info) ( (s_info)->size.lsw )
+#define FS_GetStrmSizeHi(s_info) ( (s_info)->size.msw )
+
+#define FS_SetStrmId(s_info,Id) ( (s_info)->id = Id )
+#define FS_SetStrmAttrib(s_info,fsAttrib) ( (s_info)->fs_attrib = fsAttrib )
+#define FS_SetStrmSizeLo(s_info,sizelo) ( (s_info)->size.lsw = sizelo )
+#define FS_SetStrmSizeHi(s_info,sizehi) ( (s_info)->size.msw = sizehi )
+
+#endif
diff --git a/private/utils/ntbackup/inc/fsys.h b/private/utils/ntbackup/inc/fsys.h
new file mode 100644
index 000000000..f6b58d560
--- /dev/null
+++ b/private/utils/ntbackup/inc/fsys.h
@@ -0,0 +1,798 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fsys.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This header file provides necessary declarations
+ for the File System Unit (FSU).
+
+ Location: BE_PUBLIC
+
+
+ $Log: Q:\logfiles\fsys.h_v $
+ *
+ * Rev 1.44 02 Feb 1994 17:46:16 chrish
+ * Added FS_ViewStringTypeInDBLK macro - tells if tape is ANSI or
+ * UNICODE.
+ *
+ * Rev 1.43 10 Jan 1994 16:41:28 ZEIR
+ * ad'd FS_SetCompressedBlock() macro
+ *
+ * Rev 1.42 24 Nov 1993 14:55:18 BARRY
+ * Changed CHAR_PTRs in I/O functions to BYTE_PTRs; fixed silly macros
+ *
+ * Rev 1.41 20 Sep 1993 17:22:00 DON
+ * Added prototype FS_GeneratedErrorLog() which is currently only supported by
+ * the SMS File System. If table entry is NULL the FALSE else return value
+ * from fsh->tab_ptr->GeneratedErrorLog. Requires fsys_str.h and corresponding
+ * entry added to OS specific tables.
+
+ Rev 1.0 20 Sep 1993 17:20:50 DON
+Added new table entry GeneratedErrorLog
+ *
+ * Rev 1.40 06 Aug 1993 16:33:52 DON
+ * Added macros to access new fields in vcb
+ *
+ * Rev 1.39 30 Jul 1993 13:20:30 STEVEN
+ * if dir too deep make new one
+ *
+ * Rev 1.38 16 Jul 1993 08:50:18 DON
+ * Added Macros to Set/Get name space element in either the FSYS_HAND or COM_DBLK. Also, per Gregg, removed macros for compressed, encrypted and future!
+ *
+ * Rev 1.37 13 Jul 1993 19:07:50 GREGG
+ * Added access macros for info on compression, encryption and future rev sets.
+ *
+ * Rev 1.36 26 May 1993 15:19:04 BARRY
+ * Put back Chris's double-null empty strings.
+ *
+ * Rev 1.35 23 May 1993 21:03:42 BARRY
+ * Integrate Steve's unicode changes, got rid of // comments.
+ *
+ * Rev 1.34 18 May 1993 13:56:00 chrish
+ * NOSTRADAMUS EPR 0069 - Modified these macros below to check the string lengths
+ * before returning back the content of the vcb else if zreo return a null string.
+ *
+ * #define FS_ViewTapeNameInVCB( vcb )
+ * #define FS_ViewSetNameInVCB( vcb )
+ * #define FS_ViewSetDescriptInVCB( vcb )
+ * #define FS_ViewUserNameInVCB( vcb )
+ * #define FS_ViewMachNameInVCB( vcb )
+ * #define FS_ViewShortMachNameInVCB( vcb )
+ * #define FS_ViewTapePasswordInVCB( vcb )
+ * #define FS_ViewSetPswdInVCB( vcb )
+ * #define FS_ViewVolNameInVCB( vcb )
+ * #define FS_ViewDevNameInVCB( vcb )
+ *
+ * Rev 1.33 25 Apr 1993 20:12:28 GREGG
+ * Fifth in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * - Store the corrupt stream number in the CFIL tape struct and the CFDB.
+ *
+ * Matches: MTF10WDB.C 1.9, FSYS.H 1.33, FSYS_STR.H 1.47, MAKECFDB.C 1.2,
+ * BACK_OBJ.C 1.36, MAYN40RD.C 1.58
+ *
+ * Rev 1.32 19 Apr 1993 18:01:52 GREGG
+ * Second in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * Changes to write version 2 of OTC, and to read both versions.
+ *
+ * Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ * makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ * mayn40.h 1.32, mtf.h 1.3.
+ *
+ * NOTE: There are additional changes to the catalogs needed to save the OTC
+ * version and put it in the tpos structure before loading the OTC
+ * File/Directory Detail. These changes are NOT listed above!
+ *
+ * Rev 1.31 18 Mar 1993 15:20:16 ChuckS
+ * Additional macros for Device Name in VCB
+ *
+ * Rev 1.30 27 Jan 1993 16:07:28 GREGG
+ * Added Set macros for Tape Catalog Level and Set Catalog Valid boolean in VCB.
+ *
+ * Rev 1.29 22 Dec 1992 09:09:18 TIMN
+ * Added size parameter to FS_InitStrmInfo f(x)
+ *
+ * Rev 1.28 16 Dec 1992 10:06:54 STEVEN
+ * fix macro for MIPS
+ *
+ * Rev 1.27 14 Dec 1992 12:37:16 DAVEV
+ * Enabled for Unicode compile
+ *
+ * Rev 1.26 07 Dec 1992 16:28:46 STEVEN
+ * various fixes for NT
+ *
+ * Rev 1.25 11 Nov 1992 22:09:58 GREGG
+ * Unicodeized literals.
+ *
+ * Rev 1.24 23 Oct 1992 13:10:26 STEVEN
+ * fix typos
+ *
+ * Rev 1.23 21 Oct 1992 10:39:48 GREGG
+ * Changed 'set_catalog_level' to 'on_tape_cat_level'.
+ *
+ * Rev 1.22 20 Oct 1992 19:37:38 GREGG
+ * Fixed typo in last change.
+ *
+ * Rev 1.21 20 Oct 1992 15:00:56 STEVEN
+ * added otc stuff for qtc/otc communication
+ *
+ * Rev 1.20 14 Oct 1992 12:37:36 TIMN
+ * Moved macros for stream infos from fsys_prv.h
+ *
+ * Rev 1.19 06 Oct 1992 12:51:42 BARRY
+ * CompleteBLK gets s_info too.
+ *
+ * Rev 1.18 05 Oct 1992 11:24:00 STEVEN
+ * moved stream stuff to fsstream.h
+ *
+ * Rev 1.17 23 Sep 1992 09:47:06 BARRY
+ * Removed FS_GetRemainSizeDBLK and FS_SetRemainSizeDBLK macros.
+ *
+ * Rev 1.16 22 Sep 1992 15:29:22 BARRY
+ * Removed FS_GetTotalSizeFromDBLK.
+ *
+ * Rev 1.15 01 Sep 1992 16:13:08 STEVEN
+ * added stream headers to fsys API
+ *
+ * Rev 1.14 23 Jul 1992 12:39:46 STEVEN
+ * fix warnings
+ *
+ * Rev 1.13 09 Jul 1992 14:45:28 STEVEN
+ * BE_Unicode updates
+ *
+ * Rev 1.12 09 Jun 1992 13:56:42 BURT
+ * added is block continued macro
+ *
+ * Rev 1.11 13 May 1992 12:02:24 STEVEN
+ * 40 format changes
+ *
+ * Rev 1.10 10 May 1992 10:40:32 STEVEN
+ * fix typos
+ *
+ * Rev 1.9 12 Mar 1992 15:53:16 STEVEN
+ * 64 bit changes
+ *
+ * Rev 1.8 03 Mar 1992 16:11:02 STEVEN
+ * added functions for long paths
+ *
+ * Rev 1.7 13 Feb 1992 11:37:36 STEVEN
+ * fix support stuff
+ *
+ * Rev 1.6 20 Dec 1991 09:32:06 STEVEN
+ * move common files to tables
+ *
+ * Rev 1.5 25 Nov 1991 16:25:50 BARRY
+ * Added fsh to GetOSPathDDB.
+ *
+ * Rev 1.4 24 Oct 1991 15:03:38 BARRY
+ * TRICYCLE: Added the file system bit-mask selector to proto
+ * for FS_InitFileSys().
+ *
+ * Rev 1.3 14 Aug 1991 12:50:44 STEVEN
+ * add FindObjClose
+ *
+ * Rev 1.2 21 Jun 1991 13:23:36 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.1 23 May 1991 16:54:08 BARRY
+ * Changed macro for FindFirstObj to pass new paramter; added FindFirstDir().
+ *
+ * Rev 1.0 09 May 1991 13:33:12 HUNTER
+ * Initial revision.
+
+**/
+#ifndef FSYS_H
+#define FSYS_H
+
+#include "msassert.h"
+#include "queues.h"
+#include "datetime.h"
+#include "fsys_err.h"
+#include "dle.h"
+#include "dblks.h"
+#include "fsstream.h"
+#include "fsys_str.h"
+
+
+/* $end$ include list */
+
+/**
+ critical error defines
+**/
+#define WRITE_PROTECT 0
+#define UNKNOWN_DEVICE 1
+#define DRIVE_NOT_READY 2
+#define SEEK_ERROR 6
+#define SECTOR_NOT_FOUND 8
+#define PRINTER_ERROR 9
+#define WRITE_ERROR 0xa
+#define READ_ERROR 0xb
+#define GENERAL_FAILURE 0xc
+#define DEVICE_DEAD 0xd /* No possible way to recover */
+
+#define CRIT_NO_RETRY 0
+#define CRIT_RETRY 1
+#define CRIT_ABORT 2
+
+
+#define OBJECT_ALL 0
+#define OBJECT_DIR 1
+
+
+/**
+ Return values for File system Functions
+**/
+#define FS_NORMAL_FILE 0
+#define FS_SPECIAL_DIR 1
+#define FS_SPECIAL_FILE 2
+#define FS_EXCLUDE_FILE 3
+
+/**
+ Macros for accessing the file system table
+**/
+
+#define FS_FindDrives( dle_type, hand, cfg, fsys_mask ) \
+ (msassert ( func_tab[ dle_type ].FindDrives != NULL),\
+ (func_tab [(dle_type)].FindDrives( hand, cfg, fsys_mask ) ) )
+
+
+#define FS_ProcessDDB( fsh, ddb )\
+ (msassert( fsh->tab_ptr->ProcessDDB != NULL ), \
+ (fsh->tab_ptr->ProcessDDB( fsh, ddb ) ) )
+
+#define FS_GetCurrentDDB( fsh, ddb )\
+ (msassert( fsh->tab_ptr->GetCurrentDDB != NULL ), \
+ (fsh->tab_ptr->GetCurrentDDB( fsh, ddb ) ) )
+
+#define FS_GetCurrentPath( fsh, path, size )\
+ (msassert( fsh->tab_ptr->GetCurrentPath != NULL ), \
+ (fsh->tab_ptr->GetCurrentPath( fsh, path, size ) ) )
+
+#define FS_ChangeDir( fsh, path, size ) \
+ (msassert( fsh->tab_ptr->ChangeDir != NULL ), \
+ (fsh->tab_ptr->ChangeDir( fsh, path, size ) ) )
+
+#define FS_ChangeIntoDDB( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->ChangeIntoDDB != NULL ), \
+ (fsh->tab_ptr->ChangeIntoDDB( fsh, dblk ) ) )
+
+#define FS_UpDir( fsh ) \
+ (msassert( fsh->tab_ptr->ChangeDirUp != NULL ), \
+ (fsh->tab_ptr->ChangeDirUp( fsh ) ) )
+
+#define FS_CreateObj( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->CreateObj != NULL ), \
+ (fsh->tab_ptr->CreateObj( fsh, dblk ) ) )
+
+#define FS_OpenObj( fsh, f_hand, dblk, mode ) \
+ (msassert( fsh->tab_ptr->OpenObj != NULL ), \
+ (fsh->tab_ptr->OpenObj( fsh, f_hand, dblk, mode ) ) )
+
+#define FS_SeekObj( f_hand, offset ) \
+ (msassert( (f_hand)->fsh->tab_ptr->SeekObj != NULL ), \
+ ((f_hand)->fsh->tab_ptr->SeekObj( f_hand, offset ) ) )
+
+#define FS_ReadObj( f_hand, buf, size, blk_size, s_info )\
+ (msassert( (f_hand)->fsh->tab_ptr->ReadObj != NULL ), \
+ ((f_hand)->fsh->tab_ptr->ReadObj( f_hand, buf, size, blk_size, s_info ) ) )
+
+#define FS_VerifyObj( f_hand, buf, data, size, blk_size, s_info )\
+ (msassert( (f_hand)->fsh->tab_ptr->VerifyObj != NULL ), \
+ ((f_hand)->fsh->tab_ptr->VerifyObj( f_hand, buf, data, size, blk_size, s_info ) ) )
+
+#define FS_WriteObj( f_hand, buf, size, blk_size, s_info )\
+ (msassert( (f_hand)->fsh->tab_ptr->WriteObj != NULL ), \
+ ((f_hand)->fsh->tab_ptr->WriteObj( f_hand, buf, size, blk_size, s_info ) ) )
+
+#define FS_CloseObj( f_hand )\
+ (msassert( (f_hand)->fsh->tab_ptr->CloseObj != NULL ), \
+ ((f_hand)->fsh->tab_ptr->CloseObj( f_hand ) ) )
+
+#define FS_DeleteObj( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->DeleteObj != NULL ), \
+ (fsh->tab_ptr->DeleteObj( fsh, dblk ) ) )
+
+#define FS_GetObjPosition( f_hand )\
+ ( (f_hand)->obj_pos )
+
+#define FS_GetObjInfo( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->GetObjInfo != NULL ), \
+ (fsh->tab_ptr->GetObjInfo( fsh, dblk ) ) )
+
+#define FS_SetObjInfo( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->SetObjInfo != NULL ), \
+ (fsh->tab_ptr->SetObjInfo( fsh, dblk ) ) )
+
+#define FS_VerObjInfo( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->VerObjInfo != NULL ), \
+ (fsh->tab_ptr->VerObjInfo( fsh, dblk ) ) )
+
+#define FS_FindFirstObj( fsh, fdb, fname ) \
+ (msassert( fsh->tab_ptr->FindFirstObj != NULL ), \
+ (fsh->tab_ptr->FindFirstObj( fsh, fdb, fname, OBJECT_ALL ) ) )
+
+#define FS_FindFirstDir( fsh, fdb, dname ) \
+ (msassert( fsh->tab_ptr->FindFirstObj != NULL ), \
+ (fsh->tab_ptr->FindFirstObj( fsh, fdb, dname, OBJECT_DIR ) ) )
+
+#define FS_FindNextObj( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->FindNextObj != NULL ), \
+ (fsh->tab_ptr->FindNextObj( fsh, dblk ) ) )
+
+#define FS_FindObjClose( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->FindObjClose != NULL ), \
+ (fsh->tab_ptr->FindObjClose( fsh, dblk ) ) )
+
+#define FS_PushMinDDB( fsh, ddb ) \
+ (msassert( fsh->tab_ptr->PushMinDDB != NULL ), \
+ (fsh->tab_ptr->PushMinDDB( fsh, ddb ) ) )
+
+#define FS_PopMinDDB( fsh, ddb ) \
+ (msassert( fsh->tab_ptr->PopMinDDB != NULL ), \
+ (fsh->tab_ptr->PopMinDDB( fsh, ddb ) ) )
+
+#define FS_GetSpecialDBLKS( fsh, dblk, index ) \
+ (msassert( fsh->tab_ptr->GetSpecialDBLKS != NULL ), \
+ (fsh->tab_ptr->GetSpecialDBLKS( fsh, dblk, index ) ) )
+
+#define FS_EnumSpecialFiles( dle, index, path, psize, fname )\
+ (msassert ( func_tab[ (dle)->type ].EnumSpecialFiles != NULL),\
+ (func_tab [(dle)->type].EnumSpecialFiles( dle, index, path, psize, fname ) ) )
+
+#define FS_GetObjTypeDBLK( fsh, ddb, type ) \
+ (msassert( fsh->tab_ptr->GetObjTypeDBLK != NULL ), \
+ (fsh->tab_ptr->GetObjTypeDBLK( ddb, type ) ) )
+
+#define FS_SetObjTypeDBLK( fsh, ddb, type ) \
+ (msassert( fsh->tab_ptr->SetObjTypeDBLK != NULL ), \
+ (fsh->tab_ptr->SetObjTypeDBLK( ddb, type ) ) )
+
+#define FS_EndOperationOnDLE( fsh )\
+ (msassert( fsh->tab_ptr->EndOperationOnDLE != NULL ), \
+ (fsh->tab_ptr->EndOperationOnDLE( fsh ) ) )
+
+/**
+ Macros used to access the translation routines in the FSU table.
+ The first parameter to the File System Table functions is
+ a flag specifying whether the access is to GET or SET the memory.
+ The flag is TRUE for SET and FALSE for GET.
+**/
+
+/*
+ Names
+*/
+#define FS_GetFnameFromFDB( fsh, fdb, buf ) \
+ (msassert( fsh->tab_ptr->ModFnameFDB != NULL ), \
+ (fsh->tab_ptr->ModFnameFDB( fsh, FALSE, fdb, buf, NULL )) )
+#define FS_GetPathFromDDB( fsh, ddb, buf ) \
+ (msassert( fsh->tab_ptr->ModPathDDB != NULL ), \
+ (fsh->tab_ptr->ModPathDDB( fsh, FALSE, ddb, buf, NULL ) ) )
+#define FS_GetOSFnameFromFDB( fsh, fdb, buf ) \
+ (msassert( fsh->tab_ptr->GetOSFnameFDB != NULL ), \
+ (fsh->tab_ptr->GetOSFnameFDB( fdb, buf )) )
+#define FS_GetOSPathFromDDB( fsh, ddb, buf ) \
+ (msassert( fsh->tab_ptr->GetOSPathDDB != NULL ), \
+ (fsh->tab_ptr->GetOSPathDDB( fsh, ddb, buf ) ) )
+
+#define FS_SetFnameInFDB( fsh, fdb, buf, max ) \
+ (msassert( fsh->tab_ptr->ModFnameFDB != NULL ), \
+ (fsh->tab_ptr->ModFnameFDB( fsh, TRUE, fdb, buf, max )) )
+#define FS_SetPathInDDB( fsh, ddb, buf, max ) \
+ (msassert( fsh->tab_ptr->ModPathDDB != NULL ), \
+ (fsh->tab_ptr->ModPathDDB( fsh, TRUE, ddb, buf, max ) ) )
+#define FS_GetPnameIDB( fsh, idb, pname )\
+ (msassert( fsh->tab_ptr->GetPnameIDB != NULL ), \
+ (fsh->tab_ptr->GetPnameIDB( fsh, idb, pname ) ) )
+
+/*
+ Generic Dates
+*/
+#define FS_GetCDateFromDBLK( fsh, dblk, buf ) \
+ (msassert( fsh->tab_ptr->GetCDateDBLK != NULL ), \
+ (fsh->tab_ptr->GetCDateDBLK( dblk, buf ) ) )
+#define FS_GetMDateFromDBLK( fsh, dblk, buf ) \
+ (msassert( fsh->tab_ptr->GetMDateDBLK != NULL ), \
+ (fsh->tab_ptr->GetMDateDBLK( dblk, buf ) ) )
+#define FS_GetBDateFromDBLK( fsh, dblk, buf ) \
+ (msassert( fsh->tab_ptr->ModBDateDBLK != NULL ), \
+ (fsh->tab_ptr->ModBDateDBLK( FALSE, dblk, buf ) ) )
+
+#define FS_SetBDateInDBLK( fsh, dblk, buf ) \
+ (msassert( fsh->tab_ptr->ModBDateDBLK != NULL ), \
+ (fsh->tab_ptr->ModBDateDBLK( TRUE, dblk, buf ) ) )
+
+
+/*
+ Other FDB/DDB/IDB generic data
+*/
+#define FS_GetFileVerFromFDB( fsh, fdb, ver ) \
+ (msassert( fsh->tab_ptr->GetFileVerFDB != NULL ), \
+ (fsh->tab_ptr->GetFileVerFDB( fdb, ver ) ) )
+
+#define FS_SetOwnerIDinFDB( fsh, fdb, id ) \
+ (msassert( fsh->tab_ptr->SetOwnerId != NULL ), \
+ (fsh->tab_ptr->SetOwnerId( fsh, fdb, id ) ) )
+
+#define FS_SpecExcludeObj( fsh, ddb, fdb ) \
+ (msassert( fsh->tab_ptr->SpecExcludeObj != NULL ), \
+ (fsh->tab_ptr->SpecExcludeObj( fsh, ddb ,fdb ) ) )
+
+#define FS_SetDataSizeInDBLK( fsh, ddb, size ) \
+ (msassert( fsh->tab_ptr->SetDataSize != NULL ), \
+ (fsh->tab_ptr->SetDataSize( fsh, ddb ,size ) ) )
+
+UINT16 FS_ViewDriveSecSizeIDB( FSYS_HAND fsh, DBLK_PTR idb );
+UINT16 FS_ViewDriveNumSecIDB( FSYS_HAND fsh, DBLK_PTR idb );
+UINT16 FS_ViewDriveNumHeadsIDB( FSYS_HAND fsh, DBLK_PTR idb );
+UINT32 FS_ViewPartRelSecIDB( FSYS_HAND fsh, DBLK_PTR idb );
+UINT32 FS_ViewPartNumSecIDB( FSYS_HAND fsh, DBLK_PTR idb );
+UINT16 FS_ViewPartSysIndIDB( FSYS_HAND fsh, DBLK_PTR idb );
+#define FS_ViewPartBadBlkFlagIDB( fsh, idb ) FALSE
+
+/*
+ Other FDB/DDB OS specific data used for backup
+*/
+#define FS_GetADateFromDBLK( fsh, dblk, buf ) \
+ (msassert( fsh->tab_ptr->ModADateDBLK != NULL ), \
+ (fsh->tab_ptr->ModADateDBLK( FALSE, dblk, buf ) ) )
+
+#define FS_SetADateInDBLK( fsh, dblk, buf ) \
+ (msassert( fsh->tab_ptr->ModADateDBLK != NULL ), \
+ (fsh->tab_ptr->ModADateDBLK( TRUE, dblk, buf ) ) )
+
+/*
+ Other FDB/DDB OS specific data used for restore
+*/
+#define FS_SetOwnerId( fsh, dblk, owner ) \
+ (SUCCESS)
+
+/**
+ Routines used to create OS specific DBLKS from generic data
+**/
+#define FS_GetMaxSizeDBLK( fsh )\
+ ( 900 ) ;
+
+#define FS_InitializeGOS( fsh, gos ) \
+ (msassert( fsh->tab_ptr->InitializeGOS != NULL ), \
+ ( (fsh)->tab_ptr->InitializeGOS( (fsh), (gos) ) ) )
+
+#define FS_CreateGenFDB( fsh, data )\
+ (msassert( fsh->tab_ptr->CreateGenFDB != NULL ), \
+ ( (fsh)->tab_ptr->CreateGenFDB( (fsh), (data) ) ) )
+#define FS_CreateGenIDB( fsh, data )\
+ (msassert( fsh->tab_ptr->CreateGenIDB != NULL ), \
+ ( (fsh)->tab_ptr->CreateGenIDB( (fsh), (data) ) ) )
+
+#define FS_CreateGenDDB( fsh, data )\
+ (msassert( fsh->tab_ptr->CreateGenDDB != NULL ), \
+ ( (fsh)->tab_ptr->CreateGenDDB( (fsh), (data) ) ) )
+
+/**
+ General purpose macros and CFDB/VCB macros
+**/
+
+#define FS_GetCorruptOffsetInCFDB( cfdb ) ( ((CFDB_PTR)cfdb)->corrupt_offset )
+#define FS_GetCorruptStrmNumInCFDB( cfdb ) ( ((CFDB_PTR)cfdb)->stream_number )
+#define FS_GetBlockType( dblk ) ((dblk)->blk_type)
+#define FS_ViewStringTypeinDBLK( dblk ) ((dblk)->com.string_type) // chs:02-01-94
+#define FS_ViewBLKIDinDBLK( dblk ) ((dblk)->com.blkid)
+#define FS_ViewDIDinDBLK( dblk ) ((dblk)->com.f_d.did)
+#define FS_ViewLBAinDBLK( dblk ) ((dblk)->com.ba.lba)
+#define FS_SetLBAinDBLK( dblk, lbai ) ((dblk)->com.ba.lba = (lbai))
+#define FS_ViewPBAinVCB( dblk ) ((dblk)->com.ba.pba)
+#define FS_SetPBAinVCB( dblk, pbai ) ((dblk)->com.ba.pba = (pbai))
+#define FS_ViewFMARKinVCB( dblk ) ((dblk)->com.f_d.f_mark)
+#define FS_ViewTFMajorVerInVCB( vcb ) ( ((VCB_PTR)(vcb))->tf_major_ver )
+#define FS_ViewTFMinorVerInVCB( vcb ) ( ((VCB_PTR)(vcb))->tf_minor_ver )
+#define FS_ViewSWMajorVerInVCB( vcb ) ( ((VCB_PTR)(vcb))->sw_major_ver )
+#define FS_ViewSWMinorVerInVCB( vcb ) ( ((VCB_PTR)(vcb))->sw_minor_ver )
+#define FS_ViewTapeIDInVCB( vcb ) ( ((VCB_PTR)(vcb))->tape_id )
+#define FS_ViewTSNumInVCB( vcb ) ( ((VCB_PTR)(vcb))->tape_seq_num )
+#define FS_ViewBSNumInVCB( vcb ) ( ((VCB_PTR)(vcb))->backup_set_num )
+#define FS_ViewPswdEncryptInVCB( vcb ) ( ((VCB_PTR)(vcb))->password_encrypt_alg )
+#define FS_ViewDataEncryptInVCB( vcb ) ( ((VCB_PTR)(vcb))->data_encrypt_alg )
+#define FS_GetSetCatPbaInVCB( vcb ) ( ((VCB_PTR)(vcb))->set_cat_pba )
+#define FS_GetSetCatSeqNumberInVCB( vcb ) ( ((VCB_PTR)(vcb))->set_cat_tape_seq_num )
+#define FS_GetOnTapeCatLevel( vcb ) ( ((VCB_PTR)(vcb))->on_tape_cat_level )
+#define FS_IsSetCatInfoValid( vcb ) ( ((VCB_PTR)(vcb))->set_cat_info_valid )
+#define FS_GetOnTapeCatVer( vcb ) ( ((VCB_PTR)(vcb))->on_tape_cat_ver )
+#define FS_ViewVendorIdInVCB( vcb ) ( ((VCB_PTR)(vcb))->vendor_id )
+
+#define FS_IsNoRedirectRestore( vcb ) ( ((VCB_PTR)(vcb))->no_redirect_restore )
+#define FS_IsNonVolume( vcb ) ( ((VCB_PTR)(vcb))->non_volume )
+#define FS_ViewNumFiles( vcb ) ( ((VCB_PTR)(vcb))->set_cat_num_files )
+#define FS_ViewNumDirs( vcb ) ( ((VCB_PTR)(vcb))->set_cat_num_dirs )
+#define FS_ViewNumCorrupt( vcb ) ( ((VCB_PTR)(vcb))->set_cat_num_corrupt )
+
+#define FS_ViewTapeNameInVCB( vcb ) ( ( ((VCB_PTR )vcb)->tape_name_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->tape_name) ) \
+ : TEXT("") )
+
+#define FS_ViewSetNameInVCB( vcb ) ( ( ((VCB_PTR)vcb)->backup_set_name_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->backup_set_name) ) \
+ : TEXT("") )
+
+#define FS_ViewSetDescriptInVCB( vcb ) ( ( ((VCB_PTR)vcb)->backup_set_descript_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->backup_set_descript) ) \
+ : TEXT("") )
+
+#define FS_ViewUserNameInVCB( vcb ) ( ( ((VCB_PTR)vcb)->user_name_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->user_name) ) \
+ : TEXT("") )
+
+#define FS_ViewMachNameInVCB( vcb ) ( ( ((VCB_PTR)vcb)->machine_name_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->machine_name) ) \
+ : TEXT("") )
+
+#define FS_ViewShortMachNameInVCB( vcb ) ( ( ((VCB_PTR)vcb)->short_machine_name_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->short_machine_name) ) \
+ : TEXT("") )
+
+#define FS_ViewTapePasswordInVCB( vcb ) ( ( ((VCB_PTR)vcb)->tape_password_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->tape_password) ) \
+ : TEXT("") )
+
+#define FS_ViewSetPswdInVCB( vcb ) ( ( ((VCB_PTR)vcb)->backup_set_password_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->backup_set_password) ) \
+ : TEXT("") )
+
+#define FS_ViewVolNameInVCB( vcb ) ( ( ((VCB_PTR)vcb)->vol_name_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->vol_name) ) \
+ : TEXT("") )
+
+#define FS_ViewDevNameInVCB( vcb ) ( ( ((VCB_PTR)vcb)->dev_name_leng) \
+ ? ( (CHAR_PTR)((INT8_PTR)(vcb) + ((VCB_PTR)(vcb))->dev_name) ) \
+ : TEXT("") )
+
+#define FS_ViewBackupDateInVCB( vcb ) (&( ((VCB_PTR)(vcb))->backup_date ))
+
+
+/* set macros */
+#define FS_SetTapeIDInVCB( vcb, val ) ( ((VCB_PTR)(vcb))->tape_id = (val) )
+#define FS_SetTSNumInVCB( vcb, val ) ( ((VCB_PTR)(vcb))->tape_seq_num = (val) )
+#define FS_SetBSNumInVCB( vcb, val ) ( ((VCB_PTR)(vcb))->backup_set_num = (val) )
+#define FS_SetBackupDateInVCB( vcb, val ) ( (((VCB_PTR)(vcb))->backup_date) = *(val) )
+
+#define FS_SetTFMajorVerInVCB( vcb, val ) ( ((VCB_PTR)(vcb))->tf_major_ver = (CHAR)(val) )
+#define FS_SetTFMinorVerInVCB( vcb, val ) ( ((VCB_PTR)(vcb))->tf_minor_ver = (CHAR)(val) )
+#define FS_SetSWMajorVerInVCB( vcb, val ) ( ((VCB_PTR)(vcb))->sw_major_ver = (CHAR)(val) )
+#define FS_SetSWMinorVerInVCB( vcb, val ) ( ((VCB_PTR)(vcb))->sw_minor_ver = (CHAR)(val) )
+
+#define FS_SetOnTapeCatLevel( vcb, val ) ( ((VCB_PTR)(vcb))->on_tape_cat_level = (val) )
+#define FS_SetSetCatInfoValid( vcb, val ) ( ((VCB_PTR)(vcb))->set_cat_info_valid = (val) )
+#define FS_SetOnTapeCatVer( vcb, val ) ( ((VCB_PTR)(vcb))->on_tape_cat_ver = (val) )
+
+/* get macros */
+#define FS_GetVolNameInVCB( vcb, dest ) \
+ ( memcpy( (dest), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->vol_name, ((VCB_PTR)(vcb))->vol_name_leng ) )
+#define FS_GetDevNameInVCB( vcb, dest ) \
+ ( memcpy( (dest), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->dev_name, ((VCB_PTR)(vcb))->dev_name_leng ) )
+
+#define FS_GetTapeNameInVCB( vcb, t_name )\
+ ( memcpy((t_name), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->tape_name, ((VCB_PTR)(vcb))->tape_name_leng ) )
+#define FS_GetSetNameInVCB( vcb, set_name ) \
+ ( memcpy((set_name), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->backup_set_name, ((VCB_PTR)(vcb))->backup_set_name_leng ) )
+#define FS_GetSetDescrInVCB( vcb, set_name ) \
+ ( memcpy((set_name), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->backup_set_descript, ((VCB_PTR)(vcb))->backup_set_descript_leng ) )
+#define FS_GetUserNameInVCB( vcb, u_name )\
+ ( memcpy((u_name), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->user_name, ((VCB_PTR)(vcb))->user_name_leng ) )
+#define FS_GetMachNameInVCB( vcb, long_machine )\
+ ( memcpy( (long_machine), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->machine_name, ((VCB_PTR)(vcb))->machine_name_leng ) )
+#define FS_GetShortMachNameInVCB( vcb, short_machine )\
+ ( memcpy((short_machine), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->short_machine_name, ((VCB_PTR)(vcb))->short_machine_name_leng ) )
+#define FS_GetTapePswdInVCB( vcb, tp_pswd )\
+ ( memcpy( (tp_pswd), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->tape_password, \
+ ((VCB_PTR)(vcb))->tape_password_leng ) )
+#define FS_GetSetPswdInVCB( vcb, set_pswd )\
+ ( memcpy( (set_pswd), ((INT8_PTR)(vcb)) + ((VCB_PTR)(vcb))->backup_set_password, \
+ ((VCB_PTR)(vcb))->backup_set_password_leng ) )
+
+#define FS_GetBackupDateInVCB( vcb, b_date )\
+ ( *(b_date) = ((VCB_PTR)(vcb))->backup_date )
+
+#define FS_IsBlockContinued( dblk ) \
+ ( (dblk)->com.continue_obj )
+
+#define FS_IsBlockCompressed( dblk ) ( (dblk)->com.compressed_obj )
+#define FS_SetCompressedBlock( dblk ) ( (dblk)->com.compressed_obj = TRUE )
+
+#define FS_GetBlockTapeSeqNumber( dblk ) \
+ ( (dblk)->com.tape_seq_num )
+
+/**
+ size macros
+**/
+
+/*
+ sizes of FDB/DDB/IDB text fields
+*/
+#define FS_SizeofFnameInFDB( fsh, fdb ) \
+ (INT16)(msassert( fsh->tab_ptr->SizeofFnameInFDB != NULL ), \
+ (fsh->tab_ptr->SizeofFnameInFDB( fsh, fdb ) ) )
+
+#define FS_SizeofPnameInIDB( fsh, idb )\
+ (msassert( fsh->tab_ptr->SizeofPnameInIDB != NULL ), \
+ (fsh->tab_ptr->SizeofPnameInIDB( fsh, idb ) ) )
+
+#define FS_SizeofPathInDDB( fsh, ddb ) \
+ (INT16)(msassert( fsh->tab_ptr->SizeofPathInDDB != NULL ), \
+ (fsh->tab_ptr->SizeofPathInDDB( fsh, ddb ) ) )
+
+#define FS_SizeofOSFnameInFDB( fsh, fdb ) \
+ (INT16)(msassert( fsh->tab_ptr->SizeofOSFnameInFDB != NULL ), \
+ (fsh->tab_ptr->SizeofOSFnameInFDB( fsh, fdb ) ) )
+
+#define FS_SizeofOSPathInDDB( fsh, ddb ) \
+ (INT16)(msassert( fsh->tab_ptr->SizeofOSPathInDDB != NULL ), \
+ (fsh->tab_ptr->SizeofOSPathInDDB( fsh, ddb ) ) )
+
+#define FS_IsBlkComplete( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->IsBlkComplete != NULL ), \
+ (fsh->tab_ptr->IsBlkComplete( fsh, dblk ) ) )
+
+#define FS_CompleteBlk( fsh, dblk, buffer, size, sinfo ) \
+ (msassert( fsh->tab_ptr->CompleteBlk != NULL ), \
+ (fsh->tab_ptr->CompleteBlk( fsh, dblk, buffer, size, sinfo ) ) )
+
+#define FS_ReleaseDBLK( fsh, dblk ) \
+ (msassert( fsh->tab_ptr->ReleaseBlk != NULL ), \
+ (fsh->tab_ptr->ReleaseBlk( fsh, dblk ) ) )
+
+#define FS_DuplicateDBLK( fsh, dblk_org, dblk_dup ) \
+ (msassert( fsh->tab_ptr->DupBlk != NULL ), \
+ (fsh->tab_ptr->DupBlk( fsh, dblk_org, dblk_dup ) ) )
+
+
+#define FS_GetDisplaySizeFromDBLK( fsh, dblk ) \
+ (fsh->tab_ptr->GetDisplaySizeDBLK( fsh, dblk ) )
+
+
+/*
+ size of VCB text fields
+*/
+#define FS_SizeofVolNameInVCB( vcb ) ( ((VCB_PTR)vcb)->vol_name_leng)
+#define FS_SizeofDevNameInVCB( vcb ) ( ((VCB_PTR)vcb)->dev_name_leng)
+#define FS_SizeofTapeNameInVCB( vcb ) ( ((VCB_PTR)vcb)->tape_name_leng)
+#define FS_SizeofBackupSetNameInVCB( vcb ) ( ((VCB_PTR)vcb)->backup_set_name_leng)
+#define FS_SizeofSetDescriptInVCB( vcb ) ( ((VCB_PTR)vcb)->backup_set_descript_leng)
+#define FS_SizeofUserNameInVCB( vcb ) ( ((VCB_PTR)vcb)->user_name_leng)
+#define FS_SizeofMachNameInVCB( vcb ) ( ((VCB_PTR)vcb)->machine_name_leng)
+#define FS_SizeofShortMachNameInVCB( vcb ) ( ((VCB_PTR)vcb)->short_machine_name_leng)
+#define FS_SizeofTapePswdInVCB( vcb ) ( ((VCB_PTR)vcb)->tape_password_leng)
+#define FS_SizeofSetPswdInVCB( vcb ) ( ((VCB_PTR)vcb)->backup_set_password_leng)
+
+
+/**
+ FSU initialization & support functions
+**/
+INT16 FS_InitFileSys( DLE_HAND *dle_ptr, BOOLEAN(*crit_err)(CHAR_PTR, UINT16),
+ struct BE_CFG *cfg, UINT16 remote_filter, UINT32 file_systems ) ;
+
+VOID FS_RemoveFileSys( DLE_HAND dle_hand ) ;
+
+INT16 FS_ParsePath( DLE_HAND dle_hand,
+ CHAR_PTR input_text,
+ GENERIC_DLE_PTR *dle,
+ CHAR_PTR path,
+ INT16 *psize,
+ CHAR_PTR *file,
+ BOOLEAN *star_star ) ;
+
+#define FS_GuessDelimFromPath( path ) \
+ ( (*path == TEXT(':')) ? TEXT(':') : TEXT('\\') )
+
+/* values for fs_initialized */
+#define NRL_INITIALIZED 1
+#define SMB_INITIALIZED 2
+#define DOS_INITIALIZED 4
+#define IMAG_INITIALIZED 8
+#define NOV_INITIALIZED 16
+#define AFP_INITIALIZED 32
+#define FS_InitStatus( dle_hand ) \
+ ((dle_hand)->fs_initialized)
+
+INT16 FS_OpenFileSys( FSYS_HAND *fsh, INT16 type,
+ struct BE_CFG *cfg ) ;
+
+INT16 FS_ReOpenFileSys( FSYS_HAND fsh, INT16 type,
+ struct BE_CFG *cfg ) ;
+
+INT16 FS_CloseFileSys( FSYS_HAND fsh ) ;
+
+INT16 FS_AttachToDLE( FSYS_HAND *fsh, GENERIC_DLE_PTR dle, struct BE_CFG *cfg,
+ CHAR_PTR user_name, CHAR_PTR password ) ;
+
+INT16 FS_DetachDLE( FSYS_HAND fsh ) ;
+
+UINT16 FS_GetActualSizeDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+UINT16 FS_GetStringTypes( FSYS_HAND fsh ) ;
+
+
+/*
+ Translation functions
+*/
+
+VOID FS_SetDefaultDBLK( FSYS_HAND fsh, INT8 blk_type, CREATE_DBLK_PTR data ) ;
+
+INT16 FS_GetOSid_verFromDBLK( FSYS_HAND fsh, DBLK_PTR dblk, UINT16 *id, UINT16 *ver ) ;
+
+#define FS_GetOSid_verFromVCB( dblk, id, ver ) \
+ (FS_GetOSid_verFromDBLK( NULL, (dblk), (id), (ver) ) )
+
+UINT32 FS_GetAttribFromDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+#define FS_GetAttribFromVCB( dblk ) \
+ (FS_GetAttribFromDBLK( NULL, (dblk) ) )
+
+UINT32 FS_SetAttribFromDBLK( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 attrib ) ;
+
+INT16 FS_GetOS_InfoFromDBLK( FSYS_HAND fsh, DBLK_PTR dblk, VOID_PTR os_info ) ;
+
+INT16 FS_SizeofOS_InfoInDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 FS_CreateGenVCB( FSYS_HAND fsh, GEN_VCB_DATA_PTR data ) ;
+
+INT16 FS_CreateGenCFDB( FSYS_HAND fsh, GEN_CFDB_DATA_PTR data ) ;
+
+INT16 FS_CreateGenUDB( FSYS_HAND fsh, GEN_UDB_DATA_PTR data ) ;
+
+/*
+ Misc functions needed for User interface
+*/
+
+CHAR FS_GetDelimiterFromOSID( UINT16 id, UINT16 ver ) ;
+
+#define DLE_LogoutDevice( dle ) \
+ (msassert ( func_tab[ (dle)->type ].LogoutDevice != NULL),\
+ (func_tab [(dle)->type].LogoutDevice( dle ) ) )
+
+ // Currently only supported in the SMS File System
+#define FS_GeneratedErrorLog( fsh, fhand ) \
+ ( ( (fsh)->tab_ptr->GeneratedErrorLog ) \
+ ? (fsh)->tab_ptr->GeneratedErrorLog( fsh, fhand ) \
+ : FALSE )
+
+/**
+ macro and proto for stream info (fsys\common\)
+**/
+
+#define FS_CopyStrmInfo( s_info_dst_ptr, s_info_src_ptr ) \
+ ( memmove( s_info_dst_ptr, s_info_src_ptr, sizeof( *s_info_src_ptr ) ) )
+
+VOID FS_InitStrmInfo( STREAM_INFO_PTR s_info, UINT32 id, UINT16 fs_attrib, UINT32 size_lo ) ;
+
+#define FS_GetNameSpace( fsh ) ((fsh)->cur_dir_info.con)
+#define FS_SetNameSpace( fsh, ns ) ((fsh)->cur_dir_info.con = (ns))
+
+#define FS_GetNameSpaceFromDBLK( dblk ) ((dblk)->com.name_space)
+#define FS_SetNameSpaceInDBLK( dblk, ns ) ((dblk)->com.name_space = (ns))
+
+// The following is a layer violation
+#define EMS_PCT_CONTINUE 0xffffffff
+#ifdef FS_EMS
+INT EMS_AddToServerList( DLE_HAND dle_list, CHAR_PTR server_name ) ;
+INT EMS_RemoveFromServerList( CHAR_PTR server_name ) ;
+
+VOID
+EMS_GetStreamName(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size ); /*I/O- Entry: size of buf; Exit: number of bytes read */
+
+CHAR_PTR EMS_EnumSvrInList( INT *index );
+
+#else
+#define EMS_AddToServerList( x, y ) (FALSE)
+#define EMS_EnumSvrInList( x ) ( NULL )
+#define EMS_GetStreamName( x,y,z) (NULL)
+#define EMS_RemoveFromServerList( server_name ) (FALSE)
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/inc/fsys_err.h b/private/utils/ntbackup/inc/fsys_err.h
new file mode 100644
index 000000000..452776a83
--- /dev/null
+++ b/private/utils/ntbackup/inc/fsys_err.h
@@ -0,0 +1,148 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fsys_err.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: File system error values
+
+ Location: BE_PUBLIC
+
+
+ $Log: L:/LOGFILES/FSYS_ERR.H_V $
+ *
+ * Rev 1.14 30 Jul 1993 13:20:22 STEVEN
+ * if dir too deep make new one
+ *
+ * Rev 1.13 29 Jun 1993 17:09:02 BARRY
+ * Added FS_SKIP_OBJECT
+ *
+ * Rev 1.12 13 May 1993 13:37:30 BARRY
+ * Added FS_RESTORED_ACTIVE for NT.
+ *
+ * Rev 1.11 31 Mar 1993 08:57:08 MARILYN
+ * defined the error FS_NO_CHECKSUM
+ *
+ * Rev 1.10 01 Mar 1993 17:37:26 MARILYN
+ * added checksum verification errors
+ *
+ * Rev 1.9 15 Jan 1993 13:19:14 BARRY
+ * added support for new error messages and backup priviladge
+ *
+ * Rev 1.8 13 Jan 1993 10:30:14 STEVEN
+ * added unable to lock
+ *
+ * Rev 1.7 07 Dec 1992 12:18:14 DON
+ * Added a new error code for CRC Failure
+ *
+ * Rev 1.6 04 Sep 1992 09:20:04 BILLB
+ * Added FS_WARN_BASE and FS_DONT_WANT_STREAM so that we can refuse a particular
+ * substream in FS_WriteObject() and FS_VerifyObject().
+ *
+ * Rev 1.5 21 May 1992 13:46:20 STEVEN
+ * more long path support
+ *
+ * Rev 1.4 13 May 1992 15:24:08 BARRY
+ * Added FS_NET_DEV_ERROR.
+ *
+ * Rev 1.3 03 Mar 1992 15:17:24 DOUG
+ * Added FS_CHILDREN_NOT_COMPLETE, and FS_COMM_FAILURE
+ *
+ * Rev 1.2 30 Oct 1991 11:01:42 LORIB
+ * Changes for ACL. Added file system error for ACL data difference.
+ *
+ * Rev 1.1 29 Oct 1991 13:28:12 BARRY
+ * TRICYCLE: New file system read error.
+ *
+ * Rev 1.0 09 May 1991 13:30:44 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef FSYS_ERR_H
+#define FSYS_ERR_H
+
+#define FS_WARN_BASE (-0x150)
+
+#define FS_ERR_BASE (-0x200)
+
+#define FS_NEVER_ATTACHED (FS_ERR_BASE +1)
+#define FS_BAD_DBLK (FS_ERR_BASE +2)
+#define FS_DLE_NOT_ATTACHED (FS_ERR_BASE +3)
+#define FS_STACK_EMPTY (FS_ERR_BASE +4)
+#define FS_ACCESS_DENIED (FS_ERR_BASE +5)
+#define FS_OUT_OF_SPACE (FS_ERR_BASE +6)
+#define FS_NO_MORE (FS_ERR_BASE +7)
+#define FS_NOT_FOUND (FS_ERR_BASE +8)
+#define FS_INVALID_DIR (FS_ERR_BASE +9)
+#define FS_AT_ROOT (FS_ERR_BASE +10)
+#define FS_OBJECT_NOT_OPENED (FS_ERR_BASE +11)
+#define FS_EOF_REACHED (FS_ERR_BASE +12)
+#define FS_DEVICE_ERROR (FS_ERR_BASE +13)
+#define FS_GDATA_DIFFERENT (FS_ERR_BASE +14)
+#define FS_SECURITY_DIFFERENT (FS_ERR_BASE +15)
+#define FS_OPENED_INUSE (FS_ERR_BASE +16)
+#define FS_IN_USE_ERROR (FS_ERR_BASE +17)
+#define FS_INFO_DIFFERENT (FS_ERR_BASE +18)
+#define FS_BUFFER_TO_SMALL (FS_ERR_BASE +19)
+#define FS_DEFAULT_SPECIFIED (FS_ERR_BASE +20)
+#define FS_RESDATA_DIFFERENT (FS_ERR_BASE +21)
+#define FS_INCOMPATIBLE_OBJECT (FS_ERR_BASE +22)
+#define FS_NOT_INITIALIZED (FS_ERR_BASE +23)
+#define FS_UNDEFINED_TYPE (FS_ERR_BASE +24)
+#define FS_NOT_OPEN (FS_ERR_BASE +25)
+#define FS_INVALID_DLE (FS_ERR_BASE +26)
+#define FS_NO_MORE_DLE (FS_ERR_BASE +27)
+#define FS_BAD_DLE_HAND (FS_ERR_BASE +28)
+#define FS_DRIVE_LIST_ERROR (FS_ERR_BASE +29)
+#define FS_ATTACH_TO_PARENT (FS_ERR_BASE +30)
+#define FS_DEVICE_NOT_FOUND (FS_ERR_BASE +31)
+#define FS_BAD_INPUT_DATA (FS_ERR_BASE +32)
+#define FS_OS_ATTRIB_DIFFER (FS_ERR_BASE +37)
+
+#define INVALID_PATH_DESCRIPTOR (FS_ERR_BASE +33)
+#define INVALID_FILE_DESCRIPTOR (FS_ERR_BASE +34)
+#define DRIVE_DESCRIPTOR_ERROR (FS_ERR_BASE +35)
+#define FS_NO_MORE_CONNECTIONS (FS_ERR_BASE +36)
+
+#define FS_SERVER_ADDR_NOT_FOUND (FS_ERR_BASE +38)
+#define FS_MAX_SERVER_CONNECTIONS (FS_ERR_BASE +39)
+#define FS_BAD_ATTACH_TO_SERVER (FS_ERR_BASE +40)
+#define FS_BAD_SERVER_LOGIN (FS_ERR_BASE +41)
+#define FS_SERVER_LOGOUT_DENIED (FS_ERR_BASE +42)
+#define FS_BAD_ATTR_READ (FS_ERR_BASE +43)
+#define FS_EADATA_DIFFERENT (FS_ERR_BASE +44)
+#define FS_OBJECT_CORRUPT (FS_ERR_BASE +45) /* Read failed and can no longer be read */
+#define FS_ACLDATA_DIFFERENT (FS_ERR_BASE +46)
+#define FS_CHILDREN_NOT_COMPLETE (FS_ERR_BASE +47)
+#define FS_COMM_FAILURE (FS_ERR_BASE +48)
+#define FS_NET_DEV_ERROR (FS_ERR_BASE +49) /* Error on net drive */
+#define FS_STREAM_NOT_FOUND (FS_ERR_BASE +50)
+#define FS_STREAM_COMPLETE (FS_ERR_BASE +51)
+
+#define FS_CRC_FAILURE (FS_ERR_BASE +52) /* CRC failed to match */
+
+#define FS_UNABLE_TO_LOCK (FS_ERR_BASE +53) /* cannot lock data stream */
+#define FS_STREAM_CORRUPT (FS_ERR_BASE +54) /* one stream is hosed, others may be OK */
+
+#define FS_NO_CHECKSUM (FS_ERR_BASE +55) /* this data does not contain a checksum stream */
+#define FS_SKIP_OBJECT (FS_ERR_BASE +56) /* Don't process this object */
+#define FS_PATH_TOO_LONG (FS_ERR_BASE +57) /* Cannot create object because path is too deep */
+
+#define FS_EMS_CIRC_LOG (FS_ERR_BASE +58)
+#define FS_EMS_NO_LOG_BKUP (FS_ERR_BASE +59)
+#define FS_EMS_NO_PUBLIC (FS_ERR_BASE +60)
+#define FS_EMS_NO_PRIVATE (FS_ERR_BASE +61)
+
+/* File System warnings */
+
+#define FS_DONT_WANT_STREAM (FS_WARN_BASE + 1) /* Skip a particular data substream */
+#define FS_BUSY (FS_WARN_BASE + 2) /* Can't do something now, worth a retry */
+#define FS_NO_SECURITY (FS_WARN_BASE + 3) /* Expected to get security info but didn't */
+#define FS_RESTORED_ACTIVE (FS_WARN_BASE + 4) /* Restored over an active (running) file */
+#define FS_COMPRES_RESET_FAIL (FS_WARN_BASE + 5) /* failed to reset compression mode */
+
+#endif
diff --git a/private/utils/ntbackup/inc/fsys_prv.h b/private/utils/ntbackup/inc/fsys_prv.h
new file mode 100644
index 000000000..4416a5cbf
--- /dev/null
+++ b/private/utils/ntbackup/inc/fsys_prv.h
@@ -0,0 +1,240 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fsys_prv.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: M:/LOGFILES/FSYS_PRV.H_V $
+ *
+ * Rev 1.23 15 Jan 1994 19:16:30 BARRY
+ * Change CHAR_PTR name parameter in FS_SetupOSPathOrNameInDBLK to
+ * BYTE_PTR since it takes data in either ANSI/Unicode at run-time.
+ *
+ * Rev 1.22 24 Nov 1993 14:54:30 BARRY
+ * Changed CHAR_PTRs in I/O functions to BYTE_PTRs
+ *
+ * Rev 1.21 14 Oct 1993 17:49:52 STEVEN
+ * fix unicode bugs
+ *
+ * Rev 1.20 07 Sep 1993 14:44:10 MARINA
+ * Barry's MSNET changes
+ *
+ * Rev 1.19 13 Jan 1993 15:05:42 DOUG
+ * Changed FS_RMFS to FS_GRFS
+ *
+ * Rev 1.18 07 Dec 1992 16:30:56 STEVEN
+ * fixes from microsoft
+ *
+ * Rev 1.17 10 Nov 1992 08:12:46 STEVEN
+ * move os path to common part of dblk
+ *
+ * Rev 1.16 14 Oct 1992 12:39:16 TIMN
+ * Removed macros for stream infos
+ *
+ * Rev 1.15 07 Oct 1992 16:31:38 TIMN
+ * Updated FS_InitStrmInfo with fs_attrib parameter
+ *
+ * Rev 1.14 25 Sep 1992 12:52:26 CARLS
+ * added FS_InitStrmInfo
+ *
+ * Rev 1.13 21 Sep 1992 16:11:50 BARRY
+ * Updated stream helper functions for new stream design.
+ *
+ * Rev 1.12 18 Sep 1992 15:49:22 BARRY
+ * No longer support FS_GetStreamInfo and FS_WriteStreamHeader functions.
+ *
+ * Rev 1.11 21 May 1992 15:20:46 STEVEN
+ * added stream helper functions
+ *
+ * Rev 1.10 01 Mar 1992 12:39:20 DOUG
+ * Added support for RMFS.
+ *
+ * Rev 1.9 22 Jan 1992 10:24:06 STEVEN
+ * fix warnings for WIN32
+ *
+ * Rev 1.8 20 Dec 1991 09:11:52 STEVEN
+ * move common functions into tables
+ *
+ * Rev 1.7 24 Oct 1991 15:00:28 BARRY
+ * TRICYCLE: Added SMS function table pointers.
+ *
+ * Rev 1.6 06 Aug 1991 18:23:46 DON
+ * added nlm server volume func_list's
+ *
+ * Rev 1.5 26 Jun 1991 11:03:28 BARRY
+ * Cahnged prototype for Ersatz.
+ *
+ * Rev 1.4 22 Jun 1991 14:14:22 BARRY
+ * Added stuff for Ersatz file system.
+ *
+ * Rev 1.3 21 Jun 1991 13:21:24 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.2 04 Jun 1991 19:35:14 BARRY
+ * Change last MAYN_OS2 ifdef to FS_OS2.
+ *
+ * Rev 1.1 23 May 1991 16:47:16 BARRY
+ * Changed FSYSs to be conditional on FS_XXX defines instead of product defines.
+ *
+ * Rev 1.0 09 May 1991 13:30:48 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _fsys_prv_h_
+#define _fsys_prv_h_
+
+#define CUR_DIR_CHUNK 64
+
+UINT16 FindAllMappedDrives( DLE_HAND hand, struct BE_CFG *cfg, BOOLEAN delete_old ) ;
+VOID DLE_QueueInsert( DLE_HAND dle_hand, GENERIC_DLE_PTR new_dle ) ;
+
+INT16 FS_SavePath( FSYS_HAND fsh, UINT8_PTR path, UINT16 path_len );
+INT16 FS_AppendPath( FSYS_HAND fsh, UINT8_PTR path, UINT16 path_len );
+
+INT16 memver( BYTE_PTR buf1, BYTE_PTR buf2, UINT16 *size );
+
+INT16 DUMMY_CreateIDB( FSYS_HAND fsh, GEN_IDB_DATA_PTR data ) ;
+INT16 DUMMY_EnumSpecFiles( GENERIC_DLE_PTR dle, UINT16 *index, CHAR_PTR *path, INT16 *psize, CHAR_PTR *fname ) ;
+INT16 DUMMY_GetSpecDBLKS( FSYS_HAND fsh, DBLK_PTR dblk, INT32 *index );
+
+INT16 DUMMY_InitGOS( FSYS_HAND fsh, GOS_PTR gos ) ;
+
+INT16 DUMMY_LogoutDevice( GENERIC_DLE_PTR dle ) ;
+
+VOID DLE_RemoveRecurse(
+GENERIC_DLE_PTR dle,
+BOOLEAN ignore_use ) ;
+
+INT16 FS_FillBufferWithStream( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ VOID_PTR buffer,
+ UINT16 *size,
+ STREAM_INFO *stream_id );
+
+VOID FS_GetStreamInfo( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ STREAM_INFO_PTR *stream_info,
+ BYTE_PTR *stream_data );
+
+INT16 FS_SetupOSPathOrNameInDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ BYTE_PTR name_ptr,
+ INT16 name_size ) ;
+
+VOID FS_ReleaseOSPathOrNameInDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+FS_NAME_Q_ELEM_PTR FS_AllocPathOrName( FSYS_HAND fsh,
+ INT16 name_size ) ;
+
+VOID FS_FreeOSPathOrNameQueueInHand( FSYS_HAND fsh ) ;
+
+
+#if defined( FS_OS2 )
+INT16 AddOS2_DLE( DLE_HAND hand, CHAR drive, GENERIC_DLE_PTR *dle ) ;
+extern FUNC_LIST OS2FuncTab ;
+extern INT16 uw_os_version ;
+#define OS2_VER_1_1 0xa0a
+#define OS2_VER_1_2 0xa14
+#endif
+
+#if defined( FS_DOS )
+INT16 AddDOS_DLE( DLE_HAND hand, CHAR drive, GENERIC_DLE_PTR *dle ) ;
+extern FUNC_LIST DOSFuncTab ;
+#endif
+
+#if defined( FS_NTFS )
+VOID AddDLEsForNTFS( DLE_HAND hand ) ;
+extern FUNC_LIST NTFSFuncTab ;
+#endif
+
+#if defined( FS_EMS )
+VOID AddDLEsForEMS( DLE_HAND hand ) ;
+extern FUNC_LIST EMSFuncTab ;
+#endif
+
+#if defined( FS_ERSATZ )
+INT16 InitializeErsatzFS( DLE_HAND dle_hand ) ;
+extern FUNC_LIST ErsatzFuncTab ;
+#endif
+
+#if defined( FS_IMAGE )
+extern FUNC_LIST ImageTab ;
+#endif
+
+#if defined( FS_NONAFP )
+INT16 AddNOV_DLE( DLE_HAND hand, CHAR drive, UINT16 version, GENERIC_DLE_PTR *dle ) ;
+extern FUNC_LIST NovellFuncTab ;
+#endif
+
+#if defined( FS_AFP )
+INT16 AddAFP_DLE( DLE_HAND hand, CHAR drive, UINT16 version, GENERIC_DLE_PTR *dle ) ;
+extern FUNC_LIST AFP_NovellFuncTab ;
+#endif
+
+#if defined( FS_NOV_SERVER )
+extern FUNC_LIST ServerVolFuncTab ;
+#endif
+
+#if defined( FS_NLMNOV )
+extern FUNC_LIST NLMNovellFuncTab ;
+#endif
+
+#if defined( FS_NLMAFP )
+extern FUNC_LIST NLMAFPNovellFuncTab ;
+#endif
+
+#if defined( FS_NLMSERVER )
+extern FUNC_LIST NLMServerVolFuncTab ;
+#endif
+
+#if defined( FS_AFP ) || defined( FS_NONAFP )
+#define NOVELL_ADVANCED 1
+#define NOVELL_4_6 2
+#define IBM_PC_NET 3
+
+INT16 IdentifyNet( CHAR drive, struct BE_CFG *cfg, UINT16 *version ) ;
+#endif
+
+
+#if defined( FS_REMOTE )
+extern FUNC_LIST RemoteFuncTab ;
+extern FUNC_LIST RemoteWSFuncTab ;
+
+#elif defined( FS_FAKEREM )
+extern FUNC_LIST FakeRemoteFuncTab ;
+extern FUNC_LIST FakeRemoteWSFuncTab ;
+#endif
+
+extern FUNC_LIST GENFuncTab ;
+
+#if defined( SET_LAD )
+extern FUNC_LIST NullFuncTab ; /* GRH 10/13/90 - For Set_LAD */
+#endif
+
+#if defined( FS_SMS )
+extern FUNC_LIST TSAFuncTab ;
+extern FUNC_LIST TSFuncTab ;
+extern FUNC_LIST SMSFuncTab ;
+
+INT16 AddSmsTsaDLEs( DLE_HAND hand );
+#endif
+
+#if defined( FS_GRFS )
+extern FUNC_LIST GRFSFuncTab ;
+#endif
+
+#if defined( FS_MSNET )
+extern FUNC_LIST MSNetFuncTab ;
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/inc/fsys_str.h b/private/utils/ntbackup/inc/fsys_str.h
new file mode 100644
index 000000000..cb9a51d3e
--- /dev/null
+++ b/private/utils/ntbackup/inc/fsys_str.h
@@ -0,0 +1,873 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fsys_str.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains structure definitions for
+ The file system internals.
+
+ Location: BE_PUBLIC
+
+
+ $Log: M:/LOGFILES/FSYS_STR.H_V $
+ *
+ * Rev 1.56 24 Nov 1993 14:54:32 BARRY
+ * Changed CHAR_PTRs in I/O functions to BYTE_PTRs
+ *
+ * Rev 1.55 29 Sep 1993 20:28:40 GREGG
+ * Removed the dummy function from the table since it was only there to shut
+ * the compiler up. The compiler was complaining because the last initializer
+ * was followed by a comma, so I also removed the last comma, and in some
+ * cases, added NULLs for new functions which had been added to the bottom of
+ * the table since the last update.
+ * Files Modified: GEN_TAB.C, GR_TAB.C, TSA_TAB.C, TS_TAB.C, MNET_TAB.C,
+ * SMS_TAB.C, NTFS_TAB.C and FSYS_STR.H
+ *
+ * Rev 1.54 20 Sep 1993 17:25:02 DON
+ * Added new func table entry GeneratedErrorLog() which is currently only
+ * supported by the SMS File System. Requires prototype in fsys.h and
+ * corresponding entries added to OS specific tables.
+ * Modules updated include: gen_tab, gr_tab, sms_tab, tsa_tab, and ts_tab.
+
+ Rev 1.0 20 Sep 1993 17:20:54 DON
+Added new table entry GeneratedErrorLog
+ *
+ * Rev 1.53 13 Sep 1993 14:58:42 DOUG
+ * Added id values for GRFS Unix and Mac Agents
+ *
+ * Rev 1.52 11 Aug 1993 13:21:36 DON
+ * ***
+ * *** NOTE ***
+ *
+ * Addition of OFFSETS to ALLOCATED DATA in the VCB structure require
+ * a corresponding change to dblksize.c to account for the additional
+ * length!
+ *
+ * ***
+ *
+ * Rev 1.51 06 Aug 1993 16:34:52 DON
+ * Added booleans no_redirect_restore and non_volume to VCB and VCB_DATA structures
+ *
+ * Rev 1.50 30 Jul 1993 13:20:54 STEVEN
+ * if dir too deep make new one
+ *
+ * Rev 1.49 15 Jul 1993 19:19:42 GREGG
+ * Added compressed_obj and vendor_id; Removed compression_alg.
+ *
+ * Rev 1.48 09 Jun 1993 15:40:32 MIKEP
+ * enable c++
+ *
+ * Rev 1.47 25 Apr 1993 20:12:28 GREGG
+ * Fifth in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * - Store the corrupt stream number in the CFIL tape struct and the CFDB.
+ *
+ * Matches: MTF10WDB.C 1.9, FSYS.H 1.33, FSYS_STR.H 1.47, MAKECFDB.C 1.2,
+ * BACK_OBJ.C 1.36, MAYN40RD.C 1.58
+ *
+ * Rev 1.46 19 Apr 1993 18:01:52 GREGG
+ * Second in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * Changes to write version 2 of OTC, and to read both versions.
+ *
+ * Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ * makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ * mayn40.h 1.32, mtf.h 1.3.
+ *
+ * NOTE: There are additional changes to the catalogs needed to save the OTC
+ * version and put it in the tpos structure before loading the OTC
+ * File/Directory Detail. These changes are NOT listed above!
+ *
+ * Rev 1.45 18 Mar 1993 15:20:18 ChuckS
+ * Additional fields for Device Name in VCB
+ *
+ * Rev 1.44 16 Mar 1993 09:56:32 BARRY
+ * Added bit for initialization of MS network file system.
+ *
+ * Rev 1.43 10 Nov 1992 08:12:22 STEVEN
+ * move os path to common part of dblk
+ *
+ * Rev 1.42 21 Oct 1992 10:39:46 GREGG
+ * Changed 'set_catalog_level' to 'on_tape_cat_level'.
+ *
+ * Rev 1.41 20 Oct 1992 15:32:22 STEVEN
+ * added tape sequence number to standard structure
+ *
+ * Rev 1.40 20 Oct 1992 15:01:00 STEVEN
+ * added otc stuff for qtc/otc communication
+ *
+ * Rev 1.39 05 Oct 1992 11:24:04 STEVEN
+ * moved stream stuff to fsstream.h
+ *
+ * Rev 1.38 23 Sep 1992 13:49:40 BARRY
+ * Eliminated total_size from STD_DBLK_DATA.
+ *
+ * Rev 1.37 23 Sep 1992 09:47:38 BARRY
+ * Removed rem_size from STD_DBLK_DATA.
+ *
+ * Rev 1.36 22 Sep 1992 18:20:08 BARRY
+ * Updated CompleteBlk function for new STREAM_INFO parameter.
+ *
+ * Rev 1.35 22 Sep 1992 15:29:24 BARRY
+ * Removed FS_GetTotalSizeFromDBLK.
+ *
+ * Rev 1.34 21 Sep 1992 16:12:24 BARRY
+ * Added stream_info to fsh.
+ *
+ * Rev 1.33 18 Sep 1992 15:48:42 BARRY
+ * Removed FS_STREAM_HEADER and associated definitions.
+ *
+ * Rev 1.32 03 Sep 1992 16:28:36 BARRY
+ * Changed stream header IDs. Removed hasStreamHeaders from std_dat.
+ *
+ * Rev 1.31 01 Sep 1992 16:37:48 STEVEN
+ * fix typo
+ *
+ * Rev 1.30 01 Sep 1992 16:13:12 STEVEN
+ * added stream headers to fsys API
+ *
+ * Rev 1.29 14 Aug 1992 10:51:36 BARRY
+ * Added hasStreamHeaders field to standard dblk.
+ *
+ * Rev 1.28 12 Aug 1992 13:06:12 BARRY
+ * Removed SMS fields from GOS.
+ *
+ * Rev 1.27 11 Aug 1992 17:20:52 BARRY
+ * Added stream id STRM_UNKNOWN.
+ *
+ * Rev 1.26 24 Jul 1992 14:30:10 NED
+ * Incorporated Skateboard and BigWheel changed into Graceful Red code,
+ * including MTF4.0 translator support, adding 3.1 file-system structures
+ * support to the 3.1 translator, additions to GOS to support non-4.0 translators.
+ *
+ * Rev 1.25 24 Jul 1992 13:59:42 BARRY
+ * Added some stream IDs and names.
+ *
+ * Rev 1.24 22 Jul 1992 13:38:32 CHUCKB
+ * In function table structure, changed return type of Get Volume Name function to VOID.
+ *
+ * Rev 1.23 22 Jul 1992 13:20:14 GREGG
+ * Changed stream header struct to match Microsoft spec, and added three new
+ * stream types for OTC.
+ *
+ * Rev 1.22 09 Jul 1992 14:45:32 STEVEN
+ * BE_Unicode updates
+ *
+ * Rev 1.21 21 May 1992 13:47:06 STEVEN
+ * more long path support
+ *
+ * Rev 1.20 04 May 1992 09:41:40 LORIB
+ * Fixed error in structure member name.
+ *
+ * Rev 1.19 16 Mar 1992 11:57:48 STEVEN
+ * added stream header for 4.0 format
+ *
+ * Rev 1.18 13 Mar 1992 09:18:32 LORIB
+ * Changes for Tape Format 4.0 and variable path length support.
+ *
+ * Rev 1.17 03 Mar 1992 16:10:48 STEVEN
+ * added functions for long paths
+ *
+ * Rev 1.16 28 Feb 1992 13:05:44 STEVEN
+ * step one for varible length paths
+ *
+ * Rev 1.15 07 Feb 1992 16:11:34 STEVEN
+ * added object types
+ *
+ * Rev 1.14 13 Jan 1992 18:42:32 STEVEN
+ * added NTFS_ID and NTFS_VER
+ *
+ * Rev 1.13 20 Dec 1991 09:31:48 STEVEN
+ * move common files to tables
+ *
+ * Rev 1.12 25 Nov 1991 16:54:02 BRYAN
+ * Forgot to update fsys_str.h for parameter change to GetOSPathDDB().
+ *
+ * Rev 1.11 14 Nov 1991 09:16:38 BARRY
+ * Moved file system init specifiers from be_init.h to fsys_str.h.
+ *
+ * Rev 1.10 06 Nov 1991 08:50:48 BARRY
+ * Removed path changes.
+ *
+ * Rev 1.9 31 Oct 1991 18:48:10 BARRY
+ * Added info field for cur_dir to FSH.
+ *
+ * Rev 1.8 31 Oct 1991 16:32:00 BARRY
+ * TRICYCLE: Added support for supplemental path info to FS entry points.
+ * Added new os_ver change for LoriB's ACL additions to OS/2 file system.
+ *
+ * Rev 1.7 22 Aug 1991 16:50:02 BARRY
+ * Added Novell SMS id and ver.
+ *
+ * Rev 1.6 14 Aug 1991 12:50:22 STEVEN
+ * add FindObjClose
+ *
+ * Rev 1.5 07 Aug 1991 11:47:32 DAVIDH
+ * Added FS_AFP_NLM_VER define.
+ *
+ * Rev 1.4 30 Jun 1991 16:20:56 BARRY
+ * Added stuff for the Ersatz file system.
+ *
+ * Rev 1.3 21 Jun 1991 13:42:40 STEVEN
+ * software versions should be unsigned
+ *
+ * Rev 1.2 21 Jun 1991 13:23:06 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.1 23 May 1991 16:51:44 BARRY
+ * Changed queues.h include to double quotes.
+ *
+ * Rev 1.0 09 May 1991 13:31:30 HUNTER
+ * Initial revision.
+
+**/
+/* begin include list */
+#ifndef FSYS_STR_H
+#define FSYS_STR_H 1
+
+#include "queues.h"
+
+/* $end$ include list */
+
+
+/**
+ OS_ID definitions
+**/
+#define FS_PC_DOS 0
+#define FS_PC_DOS_VER 0
+#define FS_NON_AFP_NOV 1
+#define FS_NON_AFP_NOV_VER 0
+#define FS_PC_OS2 2
+#define FS_PC_OS2_VER 0
+#define FS_PC_OS2_ACL_VER 1 /* For LAN Manager ACL support */
+#define FS_MAC_FINDER 3
+#define FS_MAC_FINDER_VER 0
+#define FS_MAC_TOPS 4
+#define FS_MAC_TOPS_VER 0
+#define FS_MAC_APPLESHARE 5
+#define FS_MAC_APPLESHARE_VER 0
+#define FS_A_UX 6
+#define FS_A_UX_VER 0
+#define FS_PC_IMAGE 7
+#define FS_PC_IMAGE_VER 0
+#define FS_AFP_NOVELL 8
+#define FS_AFP_NOVELL_VER 0
+#define FS_AFP_NOVELL31 9 /* AFP dirs for MaynStream 3.1+ */
+#define FS_AFP_NOVELL31_VER 1 /* For files and dirs under 3.1+ */
+#define FS_AFP_NLM_VER 2 /* For NLM files and dirs */
+
+#define FS_NON_AFP_NOV31 10 /* NONAFP dirs for MaynStream 3.1+ */
+#define FS_NON_AFP_NOV31_VER 1 /* For files and dirs under 3.1+ */
+
+#define FS_ERSATZ 11 /* The phony file system */
+#define FS_ERSATZ_VER 0
+
+#define FS_NLM_AFP_NOVELL31 12 /* NLM AFP system */
+#define FS_NLM_AFP_NOVELL31_VER 1 /* for files and dirs under 3.1 */
+
+#define FS_NOV_SMS 13 /* Novell SMS file system */
+#define FS_NOV_SMS_VER 0
+
+#define FS_NTFS_ID 14 /* Windows32 NT file system */
+#define FS_NTFS_VER 0
+
+#define FS_GOS 0xff
+#define FS_UNKNOWN_OS -1
+#define FS_GOS_UTF_VER 1
+
+/* OS IDs and VERs for older FSs writing the MTF 4.0 format */
+#define FS_PC_OS2_40 16
+#define FS_PC_OS2_40_VER 0
+
+#define FS_NONAFP_NOV_40 17
+#define FS_NONAFP_NOV_40_VER 0
+
+#define FS_AFP_NOVELL_40 18
+#define FS_AFP_NOVELL_40_VER 0
+
+#define FS_GRFS_UNIX 20
+#define FS_GRFS_UNIX_VER 0
+
+#define FS_GRFS_MAC 21
+#define FS_GRFS_MAC_VER 0
+
+#define FS_EMS_MDB_ID 30
+#define FS_EMS_MDB_VER 0
+
+#define FS_EMS_DSA_ID 31
+#define FS_EMS_DSA_VER 0
+
+//#define FS_EMS_BRICK_ID 32
+//#define FS_EMS_BRICK_VER 0
+//
+//#define FS_EMS_SERVER_ID 33
+//#define FS_EMS_SERVER_VER 0
+
+#define FS_UNKNOWN_VER -1
+
+
+/*
+ * Bit values for selected file systems to init.
+ */
+#define FS_INIT_GENERIC BIT0 /* Generic FS -- required */
+#define FS_INIT_NLM_NOV BIT1 /* NLM AFP and NONAFP */
+#define FS_INIT_NLM_SERVER BIT3 /* NLM server only */
+#define FS_INIT_NOVELL BIT4 /* DOS AFP and NONAFP */
+#define FS_INIT_NOVELL_SERVER BIT6 /* DOS server only */
+#define FS_INIT_IBM_PC_LAN BIT7 /* PC lan */
+#define FS_INIT_DOS_REMOTE BIT8 /* REMOTE and REMOTE WS */
+#define FS_INIT_IMAGE BIT9 /* DOS images */
+#define FS_INIT_OS2 BIT10 /* OS2 FAT and HPFS */
+#define FS_INIT_ERSATZ BIT11 /* Dummy file system */
+#define FS_INIT_SMS BIT12 /* Novell SMS */
+#define FS_INIT_MSNET BIT13 /* MSoft Network File Sys */
+#define FS_INIT_ALL 0xffffffff /* Enable all compiled FSs */
+
+
+/**
+ support structures for File System Functions
+**/
+
+typedef union {
+ UINT32 con;
+ VOID_PTR ptr;
+} SPACE32 ;
+
+/*
+ File system handle structure.
+*/
+typedef struct FSYS_HAND_STRUCT {
+ DLE_HAND dle_hand ; /* pointer to active DLE list */
+ GENERIC_DLE_PTR attached_dle; /* pointer to attached DLE */
+ INT16 leng_dir ; /* length of directory */
+ CHAR_PTR cur_dir; /* needed to build DDB path text */
+ SPACE32 cur_dir_info ; /* optional info about current dir */
+ struct BE_CFG *cfg; /* pointer to configuration */
+ INT16 f_type ; /* type of file system */
+ struct FUNC_LIST *tab_ptr ; /* pointer to function table */
+ Q_HEADER min_ddb_stk ; /* PushMinDDB() stack */
+ SPACE32 reserved ; /* used internally .. OS depend */
+ BOOLEAN hand_in_use ; /* TRUE of the file handle is used */
+ struct FILE_HAND_STRUCT *file_hand ;
+ Q_HEADER in_use_name_q ; /* path buffer queue */
+ Q_HEADER avail_name_q ; /* path buffer queue */
+ BYTE_PTR stream_ptr ; /* pointer to path stream read in */
+ UINT16 stream_buf_size ; /* size of above buffer */
+ STREAM_INFO stream_info; /* info for path/file name stream */
+} *FSYS_HAND;
+
+
+/*
+ Open modes for the FS_OpenFile() function
+*/
+typedef enum {
+ FS_READ,
+ FS_WRITE,
+ FS_VERIFY
+} OPEN_MODE ;
+
+typedef enum {
+ FROM_START,
+ FROM_END,
+ FROM_CURRENT
+} SEEK_MODE ;
+
+typedef enum {
+ DOS_OBJECT,
+ NOV_OBJECT,
+ AFP_OBJECT,
+ IMAGE_OBJECT,
+ OS2_OBJECT,
+ NOV_SMS_OBJECT,
+ NTFS_OBJECT,
+ UNKNOWN_OBJECT
+} OBJECT_TYPE ;
+
+/*
+ FSU file handle
+*/
+
+typedef struct FILE_HAND_STRUCT *FILE_HAND;
+typedef struct FILE_HAND_STRUCT {
+ FSYS_HAND fsh ; /* file system handle */
+ INT16 mode; /* mode for opening */
+ BOOLEAN opened_in_use; /* TRUE if file opened in use */
+ UINT32 size ; /* size of opened file/dir data */
+ UINT32 obj_pos; /* file pointer possition */
+ SPACE32 obj_hand ; /* OS specific object handle */
+ DBLK_PTR dblk ; /* used to close the object */
+} FILE_HAND_STRUCT;
+
+
+/*
+ Request structure standard elements
+*/
+typedef struct STD_DBLK_DATA *STD_DBLK_DATA_PTR;
+typedef struct STD_DBLK_DATA {
+ DBLK_PTR dblk; /* points to requesters memory */
+ UINT8 os_id; /* the ID of the OS_INFO below */
+ UINT8 os_ver; /* the version of the OS_INFO below */
+ /* data. ( offset from start of data) */
+ UINT64 disp_size; /* size to display to user */
+ BOOLEAN continue_obj ; /* true if object is a continuation */
+ /* of a split DBLK */
+ UINT32 attrib ; /* Gen common attributes TFLDEFS.H */
+ UINT32 blkid ; /* tape format block ID */
+ UINT32 did ; /* tape format directory ID */
+ UINT32 lba; /* logical block address */
+ UINT16 string_type ; /* type of strings UNICODE/ASCII */
+ UINT16 tape_seq_num ; /* tape # where block exists */
+ BYTE_PTR os_info; /* pointer to OS info structure */
+ UINT16 os_info_size; /* size of OS info structure */
+ BOOLEAN compressed_obj ; /* data associated w/ DBLK is compressed */
+} STD_DBLK_DATA ;
+
+/*
+ * These bits have been added in NetWare 386 and reside in the new additional
+ * 16-bits of attributes kept for '386 files and directories. (Stored in the
+ * "attributes_386" field of the NetWare 386 info for FDBs and DDBs.)
+ */
+#define NOV_IMM_PURGE 0x0001 /* Purge immediate */
+#define NOV_REN_INHIBIT 0x0002 /* Rename inhibit */
+#define NOV_DEL_INHIBIT 0x0004 /* Delete inhibit */
+#define NOV_CPY_INHIBIT 0x0008 /* Copy inhibit */
+
+/*
+ * Additional information kept by NetWare 386 for directories that
+ * we'll add to the DDB.
+ */
+typedef struct NOVELL_386_DIR {
+ BOOLEAN info_valid ; /* TRUE when info below is valid */
+ UINT32 maximum_space ; /* Max disk space allowed for dir */
+ UINT16 attributes_386 ; /* Most sig 16 bits of 32-bit attr */
+ UINT8 extend_attr ; /* Most sig byte of low 16 bits */
+ UINT8 inherited_rights ; /* Most sig byte of rights mask */
+} NOVELL_386_DIR ;
+
+/*
+ * Additional information kept by NetWare 386 for files that we'll keep
+ * in the FDB.
+ */
+typedef struct NOVELL_386_FILE {
+ BOOLEAN info_valid ; /* TRUE when info below is valid */
+ UINT16 creation_time ;
+ UINT32 archiver_id ;
+ UINT16 attributes_386 ; /* Most sig 16 bits of 32-bit attr */
+ UINT32 last_modifier_id ;
+ UINT32 trust_fork_size ; /* Trustee info */
+ UINT32 trust_fork_offset ;
+ UINT8 trust_fork_format ; /* See NOVCOM.H for trust formats */
+ UINT16 inherited_rights ; /* Rights mask--new for files */
+} NOVELL_386_FILE ;
+
+/*
+ Global OS-info structure
+*/
+typedef struct GOS *GOS_PTR;
+typedef struct GOS{
+ UINT32 nov_owner_id;
+ UINT8 max_rights ; /* NOV max rights */
+ UINT8 finder[32]; /* MAC finder data */
+ ACHAR long_name[32] ; /* MAC long name */
+ UINT32 data_fork_size ; /* size of the generic data fork */
+ UINT32 data_fork_offset ; /* offset to start of generic data fork */
+ UINT32 res_fork_size ; /* size of MAC resource data */
+ UINT32 res_fork_offset ; /* offset to start of MAC resource data */
+ UINT32 trust_fork_size ; /* size of novell trustee data */
+ UINT32 trust_fork_offset; /* offset to start of novell trustee data */
+ INT16 long_path_leng ; /* MAC long path length */
+ ACHAR_PTR long_path ; /* MAC long path in format -> :fred:sue */
+ UINT8 trust_fork_format ;/* format type of trustee information */
+
+ /* NK 7/7/92 added for translators: */
+ /* the following bit definitions are the same as used by Novell */
+
+ /* Novell directory max rights */
+ UINT novell_directory_max_rights;
+
+ #define NOVA_DIR_READ_RIGHTS BIT0
+ #define NOVA_DIR_WRITE_RIGHTS BIT1
+ #define NOVA_DIR_OPEN_FILE_RIGHTS BIT2
+ #define NOVA_DIR_CREATE_FILE_RIGHTS BIT3
+ #define NOVA_DIR_DELETE_FILE_RIGHTS BIT4
+ #define NOVA_DIR_PARENTAL_RIGHTS BIT5
+ #define NOVA_DIR_SEARCH_RIGHTS BIT6
+ #define NOVA_DIR_MOD_FILE_ATTRIBS BIT7
+
+ /* Novell file attributes */
+ UINT novell_file_attributes;
+ #define NOVA_FILE_READ_ONLY BIT0
+ #define NOVA_FILE_HIDDEN BIT1
+ #define NOVA_FILE_SYSTEM BIT2
+ #define NOVA_FILE_EXECUTE_ONLY BIT3
+ #define NOVA_FILE_MODIFIED BIT5
+ #define NOVA_FILE_SHAREABLE BIT7
+
+ /* Novell file extended attributes */
+ UINT novell_extended_attributes;
+ #define NOVA_FILE_TRANSACTIONAL BIT4
+ #define NOVA_FILE_INDEXING BIT5
+
+ /* OS/2 file and directory fields */
+ DATE_TIME access_date ;
+ UINT32 ea_fork_size ;
+ UINT32 ea_fork_offset;
+ UINT32 acl_fork_size ;
+ UINT32 acl_fork_offset;
+ UINT32 alloc_size ;
+
+ /* AFP fields */
+ NOVELL_386_DIR dir_info_386 ;
+ NOVELL_386_FILE file_info_386 ;
+ BYTE proDosInfo[6] ; /* Added in version 1. */
+
+ /* non-AFP fields */
+ UINT16 access_date16;
+
+} GOS;
+
+/* Novell trustee fork data formats */
+#define TRUSTEE_FMT_286 1 /* NetWare 286 formatted trustees */
+#define TRUSTEE_FMT_386 2 /* NetWare 386 formatted trustees */
+#define TRUSTEE_FMT_UTF 3 /* 6 byte format for gos.trust_fork_format */
+
+
+/*
+ Request structure for FS_CreateVCB() function
+*/
+/*
+ NOTE:Addition of OFFSETS to ALLOCATED DATA in this structure require
+ a change to dblksize.c to account for the additional length!
+*/
+typedef struct GEN_VCB_DATA *GEN_VCB_DATA_PTR;
+typedef struct GEN_VCB_DATA {
+
+ STD_DBLK_DATA std_data;
+
+ UINT32 f_mark ; /* tape format - number of file marks */
+ UINT32 tape_id ; /* tape format - tape ID */
+ UINT16 tape_seq_num ; /* which tape in a tape family */
+ CHAR_PTR tape_name ; /* text tape name */
+ UINT16 tape_name_size ; /* size of the above name */
+ UINT16 bset_num ; /* backup set number in tape family */
+ CHAR_PTR bset_name ; /* text backup set name */
+ UINT16 bset_name_size ; /* size of the above name */
+ CHAR_PTR bset_descript ; /* text description of backup set */
+ UINT16 bset_descript_size ; /* size of the above description */
+ CHAR tf_major_ver ; /* tape format version - major */
+ CHAR tf_minor_ver ; /* tape format version - minor */
+ CHAR sw_major_ver ; /* application version - major */
+ CHAR sw_minor_ver ; /* application version - minor */
+ CHAR_PTR machine_name ; /* text name of source machine */
+ UINT16 machine_name_size ; /* size of the above name */
+ CHAR_PTR short_m_name ; /* short name for the machine */
+ UINT16 short_m_name_size ; /* size of the above name */
+ CHAR_PTR volume_name ; /* text name of the Disk volume */
+ UINT16 volume_name_size ; /* size of the above name */
+ CHAR_PTR user_name ; /* name of the user who backed up */
+ UINT16 user_name_size ; /* size of the above name */
+ UINT16 password_encrypt_alg; /* algorithm used to encrypt the password*/
+ UINT16 data_encrypt_alg ; /* algorithm used to encrypt the data */
+ CHAR_PTR bset_password ; /* backup set password */
+ UINT16 bset_password_size ; /* size of the above password */
+ CHAR_PTR tape_password ; /* tape password */
+ UINT16 tape_password_size ; /* size of the above password */
+ UINT32 pba ; /* physical block address */
+ UINT32 set_cat_pba ; /* oba if set catatalog */
+ UINT16 set_cat_tape_seq_num ;/* sequence number of tape where cat is */
+ UINT16 set_cat_num_files ; /* number of files */
+ UINT16 set_cat_num_dirs ; /* numbers of directores in set */
+ UINT16 set_cat_num_corrupt ; /* number of corrupt objects */
+ UINT16 on_tape_cat_level ; /* catalog level FULL - PARTIAL- NONE */
+ BOOLEAN set_cat_info_valid ; /* TRUE if the set catalog info is valid */
+ UINT8 on_tape_cat_ver ; /* OTC version */
+ DATE_TIME_PTR date ; /* backup date and time */
+ CHAR_PTR device_name ; /* points to full device name */
+ UINT16 dev_name_size ; /* Size of the device name */
+ UINT16 vendor_id ;
+ BOOLEAN no_redirect_restore ; /* set can not be redirected */
+ BOOLEAN non_volume ; /* set can only be restored to non volume */
+
+} GEN_VCB_DATA;
+
+/*
+ Request structure for FS_CreateFDB() function
+*/
+typedef struct GEN_FDB_DATA *GEN_FDB_DATA_PTR;
+typedef struct GEN_FDB_DATA {
+
+ STD_DBLK_DATA std_data;
+
+ CHAR_PTR fname; /* text file name */
+ UINT16 fname_size ; /* name of above file */
+ DATE_TIME_PTR creat_date; /* date of creation */
+ DATE_TIME_PTR mod_date; /* date of last write */
+ DATE_TIME_PTR backup_date; /* date of last backup*/
+ DATE_TIME_PTR access_date; /* date of last access*/
+ UINT32 file_ver; /* file verison */
+} GEN_FDB_DATA;
+
+/*
+ Request structure for FS_CreateCFDB() function
+*/
+typedef struct GEN_CFDB_DATA *GEN_CFDB_DATA_PTR;
+typedef struct GEN_CFDB_DATA {
+
+ STD_DBLK_DATA std_data;
+
+ UINT32 corrupt_offset; /* offset to first corrupt byte */
+ UINT16 stream_number ; /* sequence number of first corrupt stream */
+
+} GEN_CFDB_DATA;
+
+/*
+ Request structure for FS_CreateUDB() function
+*/
+typedef struct GEN_UDB_DATA *GEN_UDB_DATA_PTR ;
+typedef struct GEN_UDB_DATA {
+
+ STD_DBLK_DATA std_data;
+
+} GEN_UDB_DATA;
+
+/*
+ Request structure for FS_CreateIDB() function
+*/
+
+typedef struct GEN_IDB_DATA *GEN_IDB_DATA_PTR;
+typedef struct GEN_IDB_DATA {
+
+ STD_DBLK_DATA std_data;
+
+ CHAR_PTR pname ; /* partion name */
+ UINT16 pname_size ; /* size of the above name */
+ UINT16 byte_per_sector ; /* number of bytes per sector */
+ UINT16 hsect ; /* sectors per track */
+ UINT16 hhead ; /* number of heads */
+ UINT32 rsect ; /* starting relative sector number */
+ UINT32 num_sect ; /* total num of sectors in partition */
+ UINT16 sys_ind ; /* OS indicatior - see DOS Tec-Ref */
+ BOOLEAN has_bad_blk_map ; /* TRUE if data contains bad blk maps*/
+
+} GEN_IDB_DATA;
+
+/*
+ Request structure for FS_CreateDDB() function
+*/
+typedef struct GEN_DDB_DATA *GEN_DDB_DATA_PTR;
+typedef struct GEN_DDB_DATA {
+
+ STD_DBLK_DATA std_data;
+
+ CHAR_PTR path_name ; /* path name in generic format */
+ INT16 path_size ; /* size of the above name */
+ DATE_TIME_PTR creat_date; /* creation date */
+ DATE_TIME_PTR mod_date; /* date of last modification */
+ DATE_TIME_PTR backup_date; /* date of last backup */
+ DATE_TIME_PTR access_date; /* date of last access */
+} GEN_DDB_DATA;
+
+
+typedef union CREATE_DBLK *CREATE_DBLK_PTR;
+typedef union CREATE_DBLK {
+ GEN_UDB_DATA u;
+ GEN_VCB_DATA v;
+ GEN_FDB_DATA f;
+ GEN_CFDB_DATA c;
+ GEN_IDB_DATA i;
+ GEN_DDB_DATA d;
+} CREATE_DBLK ;
+
+/**
+ File system functions
+**/
+typedef struct FUNC_LIST *FUNC_LIST_PTR;
+typedef struct FUNC_LIST {
+
+ INT16 ( *InitFsys )( DLE_HAND hand, struct BE_CFG *cfg, UINT32 fsys_mask ) ;
+ INT16 ( *FindDrives )( DLE_HAND hand, struct BE_CFG *cfg, UINT32 fsys_mask ) ;
+ VOID ( *RemoveDrive )( GENERIC_DLE_PTR dle ) ;
+ VOID ( *DeInit )( DLE_HAND hand ) ;
+
+ INT16 ( *DevDispName)(GENERIC_DLE_PTR dle, CHAR_PTR name, INT16 size, INT16 type ) ;
+ VOID ( *GetVolName)(GENERIC_DLE_PTR dle, CHAR_PTR name ) ;
+ INT16 ( *SizeofVolName)(GENERIC_DLE_PTR dle ) ;
+ INT16 ( *MakePath)( CHAR_PTR buf, INT16 bsize, GENERIC_DLE_PTR dle, CHAR_PTR path, INT16 psize, CHAR_PTR fname ) ;
+ VOID ( *InitMakeData)( FSYS_HAND fsh, INT16 blk_type, CREATE_DBLK_PTR data ) ;
+
+ BOOLEAN ( *IsBlkComplete)( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+ INT16 ( *CompleteBlk )( FSYS_HAND fsh, DBLK_PTR dblk, BYTE_PTR buffer, UINT16 *size, STREAM_INFO_PTR sinfo ) ;
+ INT16 ( *DupBlk)( FSYS_HAND fsh, DBLK_PTR dblk_org, DBLK_PTR dblk_dup ) ;
+ VOID ( *ReleaseBlk)( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+ INT16 ( *AttachToDLE )( FSYS_HAND fsh, GENERIC_DLE_PTR dle, CHAR_PTR uname, CHAR_PTR pswd ) ;
+ INT16 ( *DetachDLE )( FSYS_HAND fsh ) ;
+ INT32 ( *EndOperationOnDLE )( FSYS_HAND fsh ) ;
+
+ BOOLEAN ( *ProcessDDB )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+ INT16 ( *GetCurrentDDB )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+ INT16 ( *GetCurrentPath )( FSYS_HAND fsh, CHAR_PTR path, INT16 *size ) ;
+ INT16 ( *GetDirIDinDDB )( DBLK_PTR ddb, CHAR_PTR buf ) ;
+ INT16 ( *SizeofDirIDinDDB )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+ INT16 ( *GetBasePath )( FSYS_HAND fsh, CHAR_PTR path, INT16 *size ) ;
+ INT16 ( *ChangeDir )( FSYS_HAND fsh, CHAR_PTR path, INT16 psize ) ;
+ INT16 ( *ChangeDirUp )( FSYS_HAND fsh ) ;
+
+ INT16 ( *CreateObj )( FSYS_HAND fsh, DBLK_PTR dblk );
+ INT16 ( *OpenObj )( FSYS_HAND fsh, FILE_HAND *hand, DBLK_PTR dblk, OPEN_MODE Mode ) ;
+ INT16 ( *SeekObj )( FILE_HAND hand, UINT32 *offset ) ;
+ INT16 ( *ReadObj )( FILE_HAND hand, BYTE_PTR buffer, UINT16 *size, UINT16 *blk_size, STREAM_INFO_PTR s_info ) ;
+ INT16 ( *WriteObj )( FILE_HAND hand, BYTE_PTR buffer, UINT16 *size, UINT16 *blk_size, STREAM_INFO_PTR s_info ) ;
+ INT16 ( *VerifyObj )( FILE_HAND hand, BYTE_PTR buffer, BYTE_PTR data, UINT16 *size, UINT16 *blk_size, STREAM_INFO_PTR s_info ) ;
+ INT16 ( *CloseObj )( FILE_HAND hand ) ;
+ INT16 ( *DeleteObj )( FSYS_HAND fsh, DBLK_PTR dblk );
+
+ INT16 ( *GetObjInfo )( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+ INT16 ( *SetObjInfo )( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+ INT16 ( *VerObjInfo )( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+ INT16 ( *FindFirstObj )( FSYS_HAND fsh, DBLK_PTR ddb, CHAR_PTR os_name, UINT16 obj_type ) ;
+ INT16 ( *FindNextObj )( FSYS_HAND fsh, DBLK_PTR Info ) ;
+ INT16 ( *PushMinDDB )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+ INT16 ( *PopMinDDB )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+ INT16 ( *GetSpecialDBLKS )( FSYS_HAND fsh, DBLK_PTR cblock, INT32 *index );
+ INT16 ( *EnumSpecialFiles )( GENERIC_DLE_PTR dle, UINT16 *index, CHAR_PTR *path, INT16 *psize, CHAR_PTR *fname ) ;
+
+ /* get_set is TRUE for SET and FALSE for get */
+ INT16 ( *ModFnameFDB )( FSYS_HAND fsh, BOOLEAN get_set, DBLK_PTR fdb, CHAR_PTR buf, INT16_PTR max ) ;
+ INT16 ( *ModPathDDB )( FSYS_HAND fsh, BOOLEAN get_set, DBLK_PTR ddb, CHAR_PTR buf, INT16_PTR max ) ;
+ INT16 ( *GetOSFnameFDB )( DBLK_PTR fdb, CHAR_PTR buf ) ;
+ INT16 ( *GetPnameIDB )( FSYS_HAND fsh, DBLK_PTR fdb, CHAR_PTR buf ) ;
+ INT16 ( *GetOSPathDDB )( FSYS_HAND fsh, DBLK_PTR ddb, CHAR_PTR buf ) ;
+ INT16 ( *GetCDateDBLK )( DBLK_PTR dblk, DATE_TIME *buf ) ;
+ INT16 ( *GetMDateDBLK )( DBLK_PTR dblk, DATE_TIME *buf ) ;
+ INT16 ( *ModBDateDBLK )( BOOLEAN get_set, DBLK_PTR dblk, DATE_TIME *buf ) ;
+ INT16 ( *ModADateDBLK )( BOOLEAN get_set, DBLK_PTR dblk, DATE_TIME *buf ) ;
+ UINT64 ( *GetDisplaySizeDBLK )( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+ INT16 ( *ModAttribDBLK )( BOOLEAN get_set, DBLK_PTR dblk, UINT32 *attrib ) ;
+ INT16 ( *GetFileVerFDB )( DBLK_PTR fdb, UINT32_PTR ver ) ;
+ VOID ( *SetOwnerId )( FSYS_HAND fsh, DBLK_PTR fdb, UINT32 id ) ;
+
+ INT16 ( *GetObjTypeDBLK )( DBLK_PTR dblk, OBJECT_TYPE *type ) ;
+
+ INT16 ( *SizeofFnameInFDB )( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+ INT16 ( *SizeofPathInDDB )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+ INT16 ( *SizeofOSFnameInFDB )( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+ INT16 ( *SizeofPnameInIDB )( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+ INT16 ( *SizeofOSPathInDDB )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+ INT16 ( *SizeofOSInfo )( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+ INT16 ( *GetOS_InfoDBLK )( DBLK_PTR dblk, BYTE_PTR os_info, INT16_PTR size ) ;
+ INT16 ( *GetActualSizeDBLK )( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+ INT16 ( *InitializeGOS )( FSYS_HAND fsh, GOS_PTR gos ) ;
+
+ INT16 ( *CreateGenFDB )( FSYS_HAND fsh, GEN_FDB_DATA_PTR data ) ;
+ INT16 ( *CreateGenIDB )( FSYS_HAND fsh, GEN_IDB_DATA_PTR data ) ;
+ INT16 ( *CreateGenDDB )( FSYS_HAND fsh, GEN_DDB_DATA_PTR data ) ;
+
+ INT16 ( *ChangeIntoDDB )( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+ INT16 ( *SpecExcludeObj )( FSYS_HAND fsh, DBLK_PTR ddb, DBLK_PTR fdb ) ;
+
+ INT16 ( *SetDataSize )( FSYS_HAND fsh, DBLK_PTR ddb, UINT32 size ) ;
+
+ INT16 ( *SetObjTypeDBLK )( DBLK_PTR dblk, OBJECT_TYPE type ) ;
+
+ INT16 ( *LogoutDevice) ( GENERIC_DLE_PTR dle ) ;
+
+ INT16 ( *FindObjClose )( FSYS_HAND fsh, DBLK_PTR Info ) ;
+
+ INT16 ( *SizeofDevName )( GENERIC_DLE_PTR dle ) ;
+
+ BOOLEAN ( *GeneratedErrorLog )( FSYS_HAND fsh, INT fhand );
+
+} FUNC_LIST;
+
+extern FUNC_LIST func_tab[ MAX_DRV_TYPES ] ;
+
+/* VCB structure */
+/*
+ NOTE:Addition of OFFSETS to ALLOCATED DATA in this structure require
+ a change to dblksize.c to account for the additional length!
+*/
+typedef struct VCB *VCB_PTR;
+typedef struct VCB {
+ UINT8 blk_type ; /* block type - VCB */
+ COM_DBLK fs_reserved ; /* generic DBLK information */
+ UINT32 vcb_attributes ; /* generic VCB attribute */
+ UINT32 tape_id ; /* tape identifyer */
+ UINT16 tape_seq_num ; /* which tape in the a tape family */
+
+ /* this MUST remain INT16, we use -1 as a backup set number */
+ INT16 backup_set_num ; /* backup set number in a family */
+
+ /* this information is for On Tape Catalogs */
+ UINT32 set_cat_pba ; /* oba if set catatalog */
+ UINT16 set_cat_tape_seq_num ;/* sequence number of tape where cat is */
+ UINT16 set_cat_num_files ; /* number of files */
+ UINT16 set_cat_num_dirs ; /* numbers of directores in set */
+ UINT16 set_cat_num_corrupt ; /* number of corrupt objects */
+ UINT16 on_tape_cat_level ; /* catalog level FULL - PARTIAL- NONE */
+ BOOLEAN set_cat_info_valid ; /* TRUE if the set catalog info is valid */
+ UINT8 on_tape_cat_ver ; /* OTC version */
+
+ UINT32 size ; /* size of VCB data - should be 0 */
+ UCHAR tf_major_ver; /* tape format version - major */
+ UCHAR tf_minor_ver; /* tape format version - minor */
+ UCHAR sw_major_ver; /* application version - major */
+ UCHAR sw_minor_ver; /* application version - minor */
+ UINT8 os_id ; /* OS id of device backed up */
+ UINT8 os_ver ; /* OS version of device backed up */
+ DATE_TIME backup_date ; /* date and time of backup */
+ UINT16 password_encrypt_alg; /* password encryption algorithm */
+ UINT16 data_encrypt_alg ; /* data encryption algorithm */
+
+ UINT16 tape_name ; /* text tape name offset */
+ INT16 tape_name_leng ; /* size of the above name */
+ UINT16 backup_set_name ; /* text backup set name offset */
+ INT16 backup_set_name_leng; /* size of the above name */
+ UINT16 backup_set_descript ; /* backup set description offset */
+ INT16 backup_set_descript_leng; /* size of the above */
+ UINT16 user_name ; /* text user name who backed up */
+ INT16 user_name_leng ; /* size of the above name */
+ UINT16 tape_password ; /* tape password offset */
+ INT16 tape_password_leng ; /* size of the password */
+ UINT16 backup_set_password ; /* backup set password offset */
+ INT16 backup_set_password_leng; /* size of the password */
+ UINT16 machine_name ; /* machine name offset */
+ INT16 machine_name_leng ; /* length of the above name */
+ UINT16 short_machine_name ; /* short machine name offset */
+ INT16 short_machine_name_leng ; /* length of the above name */
+ UINT16 vol_name ; /* source volume name offset */
+ INT16 vol_name_leng ; /* name length */
+ UINT16 dev_name ; /* source device name offset */
+ INT16 dev_name_leng ; /* sizeof device name */
+ UINT16 vendor_id ;
+ BOOLEAN no_redirect_restore ; /* set can not be redirected */
+ BOOLEAN non_volume ; /* set can only be restored to non volume */
+
+} VCB ;
+
+/* corruption attributes */
+#define LENGTH_ERROR BIT16
+#define IO_ERROR BIT17
+#define DEADLOCK_ERROR BIT18
+
+typedef struct CFDB *CFDB_PTR;
+typedef struct CFDB {
+ UINT8 blk_type ; /* block type - CVDB */
+ COM_DBLK fs_reserved ; /* generic DBLK data */
+ UINT32 corrupt_offset; /* offset to first corrupt byte */
+ UINT32 attributes; /* type of corruption */
+ UINT16 stream_number ; /* sequence number of first corrupt stream */
+}CFDB ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/gen_fs.h b/private/utils/ntbackup/inc/gen_fs.h
new file mode 100644
index 000000000..258197023
--- /dev/null
+++ b/private/utils/ntbackup/inc/gen_fs.h
@@ -0,0 +1,187 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dos_fs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the prototypes for the GEN
+ file system functions.
+
+ $Log: M:/LOGFILES/GEN_FS.H_V $
+ *
+ * Rev 1.12 24 Nov 1993 14:55:56 BARRY
+ * Changed CHAR_PTRs in I/O functions to BYTE_PTRs
+ *
+ * Rev 1.11 30 Jul 1993 13:20:46 STEVEN
+ * if dir too deep make new one
+ *
+ * Rev 1.10 11 May 1993 08:19:50 BRYAN
+ * Fixed signed/unsigned and type mismatch warnings.
+ *
+ * Rev 1.9 08 May 1993 14:25:38 DOUG
+ * Added prototype for GEN_FlushDLEs(), found in dleupdat.c
+ *
+ * Rev 1.8 25 Sep 1992 10:23:44 CHUCKB
+ * Added sinfo to prototype for GEN_CompleteBLK().
+ *
+ * Rev 1.7 22 Sep 1992 17:15:12 CHUCKB
+ * Removed references to fs_GetTotalSizeDBLK().
+ *
+ * Rev 1.6 17 Aug 1992 16:34:18 BURT
+ * Updated at MSoft to prevent warnings during NT app build.
+ *
+ *
+ * Rev 1.5 04 May 1992 09:38:10 LORIB
+ * Fixes for function prototype definitions.
+ *
+ * Rev 1.4 03 Mar 1992 16:16:06 STEVEN
+ * added functions for long paths
+ *
+ * Rev 1.3 13 Dec 1991 09:30:20 STEVEN
+ * move common functions to tabels
+ *
+ * Rev 1.2 27 Nov 1991 10:35:24 BARRY
+ * Fixed GEN_GetOSPath parameters.
+ *
+ * Rev 1.1 14 Aug 1991 13:02:00 STEVEN
+ * added FindClose
+ *
+ * Rev 1.0 09 May 1991 13:31:38 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+#include "fsys.h"
+
+
+INT16 GEN_GetOSFnameFDB( DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 GEN_GetPartName( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 GEN_GetOSPathDDB(
+ FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 GEN_GetFileVerFDB( DBLK_PTR dblk ,
+ UINT32 *version ) ;
+
+INT16 GEN_GetCdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ); /*I/O- createion date to read (or to write) */
+
+INT16 GEN_GetMdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /* O - modify date to write */
+
+INT16 GEN_ModBdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 GEN_ModAdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 GEN_GetOS_InfoDBLK( DBLK_PTR dblk, /* I - DBLK to get the info from */
+ CHAR_PTR os_info, /* O - Buffer to place data */
+ INT16 *size ); /*I/O- Buffer size / data length */
+
+
+INT16 GEN_ModAttribDBLK( BOOLEAN set_it ,
+ DBLK_PTR dblk ,
+ UINT32_PTR attr );
+
+
+INT16 GEN_GetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE *type );
+
+
+INT16 GEN_GetActualSizeDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 GEN_SizeofOSFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ) ; /* I - dblk to get fname from */
+
+INT16 GEN_SizeofPartName( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ) ; /* I - dblk to get fname from */
+
+INT16 GEN_SizeofOSPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 GEN_SizeofOSInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to get size of OS info for */
+
+INT16 GEN_CreateFDB( FSYS_HAND fsh,
+ GEN_FDB_DATA_PTR dat ) ;
+
+INT16 GEN_CreateDDB( FSYS_HAND fsh,
+ GEN_DDB_DATA_PTR dat ) ;
+
+INT16 GEN_CreateIDB( FSYS_HAND fsh,
+ GEN_IDB_DATA_PTR dat ) ;
+
+VOID GEN_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+BOOLEAN GEN_ProcessDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+// UINT64 GEN_GetTotalSizeDBLK( FSYS_HAND fsh, /* I - File system handle */
+// DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+UINT64 GEN_GetDisplaySizeDBLK( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+INT16 GEN_SpecExcludeObj( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ DBLK_PTR fdb ) ; /* I - Descriptor block of fdb */
+
+INT16 GEN_SetDataSize( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ UINT32 size ) ; /* I - new size */
+
+INT16 GEN_SetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE type );
+
+INT16 GEN_FindClose( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 GEN_DeviceDispName(
+GENERIC_DLE_PTR dle,
+CHAR_PTR dev_name,
+INT16 size,
+INT16 type ) ;
+
+VOID GEN_GetVolName( GENERIC_DLE_PTR dle, CHAR_PTR buffer ) ;
+
+INT16 GEN_SizeofVolName( GENERIC_DLE_PTR dle ) ;
+
+INT16 GEN_MakePath(
+CHAR_PTR buf, /* O - buffer to place path string into */
+INT16 bsize , /* I - size of above buffer */
+GENERIC_DLE_PTR dle , /* I - Drive the selection is from */
+CHAR_PTR path , /* I - path string in generic format */
+INT16 psize , /* I - size of above path */
+CHAR_PTR fname ) ;/* I - null terminated file name */
+
+INT16 GEN_InitFileSys(
+DLE_HAND hand,
+BE_CFG_PTR cfg,
+UINT32 fsys_mask ) ;
+
+VOID GEN_DeInitFileSys( DLE_HAND hand ) ;
+
+INT16 GEN_FindDrives( DLE_HAND dle_hand, BE_CFG_PTR cfg, UINT32 fsys_mask ) ;
+
+VOID GEN_RemoveDLE( GENERIC_DLE_PTR dle ) ;
+
+VOID GEN_InitMakeData( FSYS_HAND fsh, INT16 blk_type, CREATE_DBLK_PTR data ) ;
+BOOLEAN GEN_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+INT16 GEN_CompleteBlk( FSYS_HAND fsh, DBLK_PTR dblk, BYTE_PTR buffer, UINT16 *size, STREAM_INFO_PTR sinfo ) ;
+VOID GEN_ReleaseBlk( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 GEN_DupBlk( FSYS_HAND fsh, DBLK_PTR db_org, DBLK_PTR db_dup ) ;
+
+void GEN_FlushDLEs( DLE_HAND dle_hand, UINT8 flush_dle_type );
diff --git a/private/utils/ntbackup/inc/gendblk.h b/private/utils/ntbackup/inc/gendblk.h
new file mode 100644
index 000000000..51502c2ba
--- /dev/null
+++ b/private/utils/ntbackup/inc/gendblk.h
@@ -0,0 +1,54 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dosdblk.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the definition of the GEN
+ file and directory control blocks.
+
+
+ $Log: N:/LOGFILES/GENDBLK.H_V $
+ *
+ * Rev 1.3 11 Nov 1992 10:44:16 STEVEN
+ * fix os_name for gen_fs
+ *
+ * Rev 1.2 17 Mar 1992 09:05:44 STEVEN
+ * format 40 - added 64 bit support
+ *
+ * Rev 1.1 21 Jan 1992 14:28:12 BARRY
+ * Added gen_size field to DBLK.
+ *
+ * Rev 1.0 09 May 1991 13:30:46 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+
+#ifndef gendblk_h
+#define gendblk_h
+
+
+#include "queues.h"
+
+typedef struct GEN_DBLK *GEN_DBLK_PTR;
+
+typedef struct GEN_DBLK {
+ UINT8 blk_type; /* values: DDB_ID, FDB_ID set: GEN */
+ COM_DBLK fs_reserved ;
+ OBJECT_TYPE obj_type ;
+ UINT64 size ;
+ UINT64 disp_size ;
+ UINT32 tape_attribs ;
+ DATE_TIME bdate ;
+ DATE_TIME cdate ;
+ DATE_TIME mdate ;
+ DATE_TIME adate ;
+ UINT16 os_part_name ;
+} GEN_DBLK;
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/generr.h b/private/utils/ntbackup/inc/generr.h
new file mode 100644
index 000000000..70d55c4eb
--- /dev/null
+++ b/private/utils/ntbackup/inc/generr.h
@@ -0,0 +1,72 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: generr.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the generic error codes.
+
+ Location: BE_PRIVATE
+
+
+$Log: T:/LOGFILES/GENERR.H_V $
+ *
+ * Rev 1.4 23 Mar 1993 21:53:06 GREGG
+ * Added VCS log to header.
+ *
+ * Rev 1.3 22 Mar 1993 17:09:18 chrish
+ * Added define for GEN_ERR_UNRECOGNIZED_MEDIA.
+ *
+ * Rev 1.2 17 Mar 1993 15:01:14 GREGG
+ * This is Terri Lynn. Added Gregg's changes to switch the tape drive's block mode
+ * to match the block size of the current tape.
+ *
+ * Rev 1.1 12 Aug 1992 15:13:22 DON
+ * added Loader error support
+ *
+ * Rev 1.0 15 May 1991 10:32:24 STEVEN
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+#ifndef GENERRS
+
+#define GENERRS
+
+#define GEN_NO_ERR 0 /* no error code */
+#define GEN_ERR_TIMEOUT 1 /* timeout error */
+#define GEN_ERR_EOM 2 /* end of media */
+#define GEN_ERR_BAD_DATA 3 /* bad read */
+#define GEN_ERR_NO_MEDIA 4 /* put the tape in */
+#define GEN_ERR_ENDSET 5 /* filemark detected */
+#define GEN_ERR_NO_DATA 6 /* no data */
+#define GEN_ERR_INVALID_CMD 7 /* invalid command */
+#define GEN_ERR_RESET 8 /* reset */
+#define GEN_ERR_WRT_PROTECT 9 /* cartridge write protect */
+#define GEN_ERR_HARDWARE 10 /* hardware error */
+#define GEN_ERR_UNDETERMINED 11 /* you are really screwed !! */
+#define GEN_ERR_EOM_OVERFLOW 12 /* physical end of media */
+
+#define GEN_ERR_DOOR_AJAR 13 /* door open condition prevents further operation */
+#define GEN_ERR_NO_CARTRIDGE 14 /* no multi media holder installed */
+#define GEN_ERR_WRONG_MODE 15 /* the target was manually setup in a mode that */
+#define GEN_ERR_FORMAT 16 /* Media not formatted */
+#define GEN_ERR_SW_REJECT_CMD 17 /* S/W Command rejection by driver */
+#define GEN_ERR_MEMORY 18 /* A memory problem detected by driver */
+#define GEN_ERR_LOAD_UNLOAD 19 /* Load/Insert media failure */
+#define GEN_ERR_DEST_FULL 20 /* Cannot return tape to original cartridge position */
+#define GEN_ERR_EMPTY_SRC 21 /* Selected source was empty */
+#define GEN_ERR_DRIVE_CLOSED 22 /* Automated access to drive restricted by closed door */
+#define GEN_ERR_ARM_FULL 23 /* Attemp to get new tape with arm full */
+#define GEN_ERR_DRIVE_FULL 24 /* Cannot put the requested tape in the drive because drive is full */
+#define GEN_ERR_UNEXPECTED_TAPE 25 /* Encountered a tape in the drive when the driver thought it was empty */
+
+#define GEN_ERR_WRONG_BLOCK_SIZE 26 /* Current drive block size setting doesn't match tape */
+
+#define GEN_ERR_UNRECOGNIZED_MEDIA 27 // DC2000 drives to detect if tape is // chs:03-22-93
+ // unformatted // chs:03-22-93
+
+#endif
diff --git a/private/utils/ntbackup/inc/genfuncs.h b/private/utils/ntbackup/inc/genfuncs.h
new file mode 100644
index 000000000..31473afa7
--- /dev/null
+++ b/private/utils/ntbackup/inc/genfuncs.h
@@ -0,0 +1,73 @@
+
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: genfuncs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the generic function codes.
+ NOTE: In the event a new command is added to this
+ function list, the symbols GEN_LSTCMD_QIC and/or
+ GEN_LSTCMD must be updated to reflect that fact.
+ GEN_LSTCMD_QIC only applies to the Maynard QIC driver.
+
+ Location: BE_PRIVATE
+
+
+ $Log: T:/LOGFILES/GENFUNCS.H_V $
+ *
+ * Rev 1.3 17 May 1993 19:08:02 GREGG
+ * Added define for GEN_SPACE. Note that it has the same value as
+ * GEN_READ_ENDSET, and will EVENTUALY replace it.
+ *
+ * Rev 1.2 22 Jan 1992 13:59:24 ED
+ * SKATEBOARD: added #defines (GEN_LSTCMD_QIC,GEN_LSTCMD) to denote the end of the function list. Re
+ * stored GEN_SPECIAL to place QIC driver expects it. Added comments. Fixed bad $log$ token.
+
+**/
+/* $end$ include list */
+
+#ifndef GENFUNCS
+
+#define GENFUNCS
+
+#define GEN_INIT 0 /* Initialise the tape device */
+#define GEN_OPEN 1 /* open the tape device */
+#define GEN_NRCLOSE 2 /* close the tape device no rewind */
+#define GEN_RCLOSE 3 /* close the tape device w/ rewind */
+#define GEN_READ 4 /* read from tape device */
+#define GEN_WRITE 5 /* write to tape device */
+#define GEN_WRITE_ENDSET 6 /* write filemark to tape */
+
+// The next two have the same value on purpose! GEN_SPACE will eventually
+// replace GEN_READ_ENDSET.
+
+#define GEN_READ_ENDSET 7 /* read to filemark */
+#define GEN_SPACE 7 /* space forward or backward by blocks or */
+ /* filemarks, or to end of data. */
+
+#define GEN_ERASE 8 /* erase the tape */
+#define GEN_REWIND 9 /* rewind the tape */
+#define GEN_REWINDI 10 /* rewind the tape, immediate */
+#define GEN_RETEN 11 /* retension the tape */
+#define GEN_STATUS 12 /* get status from tape device */
+#define GEN_RESET 13 /* reset tape drive */
+#define GEN_RELEASE 14 /* Unload the driver */
+#define GEN_READBLK 15 /* Read Block */
+#define GEN_SEEK 16 /* Seek to a position */
+#define GEN_GETPOS 17 /* Get the position */
+#define GEN_AUTO_TEL 18 /* device enquiry */
+#define GEN_MOUNT 19 /* Mount */
+#define GEN_DISMOUNT 20 /* DisMount */
+#define GEN_SPECIAL 21 /* special code */
+#define GEN_EJECT 22 /* eject the tape */
+#define GEN_LOCK 0xf0
+#define GEN_UNLOCK 0xf1
+#define GEN_LSTCMD_QIC GEN_SPECIAL /* end of func table for QIC driver */
+#define GEN_LSTCMD GEN_EJECT /* end of func table for everyone else */
+
+/* note -1, -2 are reserved by the new SCSI Driver, TP */
+
+#endif
diff --git a/private/utils/ntbackup/inc/genstat.h b/private/utils/ntbackup/inc/genstat.h
new file mode 100644
index 000000000..a25f2235d
--- /dev/null
+++ b/private/utils/ntbackup/inc/genstat.h
@@ -0,0 +1,44 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+ Name: genstat.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the Generic Status definitions for the tape
+ drives.
+
+ Location: BE_PUBLIC
+
+ $Log: J:/LOGFILES/GENSTAT.H_V $
+ *
+ * Rev 1.1 13 Oct 1992 12:56:42 CHARLIE
+ * Added TPS_NON_NATIVE_FORMAT & enabled PVCS logging
+
+**/
+
+#ifndef _STATUS_BITS
+#define _STATUS_BITS
+
+#include <stdtypes.h>
+
+/* $end$ include list */
+
+#define TPS_NO_TAPE 0x1
+#define TPS_WRITE_PROTECT 0x2
+#define TPS_NEW_TAPE 0x4
+#define TPS_RESET 0x8
+#define TPS_BOT 0x10
+#define TPS_EOM 0x20
+#define TPS_ILL_CMD 0x40
+#define TPS_NO_DATA 0x80
+#define TPS_FMK 0x100
+#define TPS_STREAM 0x200
+#define TPS_RUN 0x400
+#define TPS_NOT_READY 0x800
+#define TPS_EOM_OVERFLOW 0x1000
+#define TPS_NON_NATIVE_FORMAT 0x2000
+#define TPS_DRV_FAILURE 0x80000000
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/get_next.h b/private/utils/ntbackup/inc/get_next.h
new file mode 100644
index 000000000..62a71ce17
--- /dev/null
+++ b/private/utils/ntbackup/inc/get_next.h
@@ -0,0 +1,33 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: get_next.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: header for get next routines to be used entirely by the loops
+
+
+ $Log: N:/LOGFILES/GET_NEXT.H_V $
+ *
+ * Rev 1.1 24 May 1991 14:58:06 STEVEN
+ * fixes for new Getnext
+ *
+ * Rev 1.0 09 May 1991 13:31:28 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _get_next_h_
+#define _get_next_h_
+
+/* getnext prototypes */
+INT16 LP_GetNextDLEBlock( LP_ENV_PTR lp_env_ptr, DBLK_PTR *dblk_ptr ) ;
+INT16 LP_GetNextTPEBlock( LP_ENV_PTR lp_env_ptr, DBLK_PTR *dblk_ptr ) ;
+VOID LP_ClearPDL( LP_ENV_PTR lp ) ;
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/global.h b/private/utils/ntbackup/inc/global.h
new file mode 100644
index 000000000..ca2b06e20
--- /dev/null
+++ b/private/utils/ntbackup/inc/global.h
@@ -0,0 +1,422 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: ss_globl.h
+
+ Description: This file contains references to all of the global
+ variables used by the GUI project.
+
+ $Log: G:/UI/LOGFILES/GLOBAL.H_V $
+
+ Rev 1.59 26 Jan 1994 13:23:16 STEVEN
+protected ansi tapes read with unicode app
+
+ Rev 1.58 24 Jan 1994 14:47:44 GREGG
+Added option to log mem_debug consistancy checks but not raise an exception.
+
+ Rev 1.57 12 Jan 1994 10:20:00 MikeP
+add abort in middle of file flag
+
+ Rev 1.56 07 Jan 1994 13:44:32 CARLS
+added loader default record name
+
+ Rev 1.55 20 Dec 1993 15:08:28 GLENN
+Changed global app strings to be LPSTR instead of CHAR [].
+
+ Rev 1.54 20 Dec 1993 09:29:40 CARLS
+removed LOADER ifdef
+
+ Rev 1.53 14 Dec 1993 11:13:36 BARRY
+Changed print buffer to dynamic memory on Unicode
+
+ Rev 1.52 13 Dec 1993 14:56:48 CARLS
+loader changes
+
+ Rev 1.51 06 Dec 1993 16:12:08 chrish
+Removed reference to gb_swcompression. Backed out previous software
+compression support change.
+
+ Rev 1.50 06 Dec 1993 15:48:32 CARLS
+removed loader prototype
+
+ Rev 1.49 01 Dec 1993 17:30:12 CARLS
+Added loader support
+
+ Rev 1.48 19 Oct 1993 14:57:20 MIKEP
+add lastopertotalbytes for gas guage
+
+ Rev 1.47 11 Oct 1993 09:22:58 MIKEP
+add gfNoCATS
+
+ Rev 1.46 24 Sep 1993 14:36:44 MARINA
+added network view globals
+
+ Rev 1.45 10 Sep 1993 17:49:10 chrish
+Added code for software compression support.
+
+ Rev 1.44 03 Aug 1993 20:57:48 CHUCKB
+Added extern reference to global job name string.
+
+ Rev 1.43 15 Jun 1993 18:21:20 GLENN
+Readded gfDummyDriver flag.
+
+ Rev 1.42 15 Jun 1993 13:17:58 DARRYLP
+More status monitor features
+
+ Rev 1.41 15 Jun 1993 11:27:26 MIKEP
+enable c++
+
+ Rev 1.40 14 Jun 1993 20:58:02 MIKEP
+enable c++
+
+ Rev 1.39 11 Jun 1993 15:51:16 GLENN
+Added gfDummyDriver flag. Rearranged status block global.
+
+ Rev 1.38 14 May 1993 14:04:02 TIMN
+Removed extern refernce for global variable TapeDevice for multiple
+instances. Also need global.c.
+
+
+ Rev 1.37 14 May 1993 09:41:06 DARRYLP
+Moved SetStatusBlock to resolve compile warnings.
+
+ Rev 1.36 27 Apr 1993 16:24:58 DARRYLP
+Status monitor enhancements.
+
+ Rev 1.35 19 Apr 1993 15:20:48 GLENN
+Added tape name global.
+
+ Rev 1.34 13 Apr 1993 17:09:36 CHUCKB
+Added declaration for gfIsJobRunning.
+
+ Rev 1.33 09 Apr 1993 15:41:02 GLENN
+Ifdef'd the DDE status globals for not OEM_MSOFT so that they are included in future releases.
+
+ Rev 1.32 09 Apr 1993 14:18:44 GLENN
+Added gnReturnCode. Moved ddemang.h to ss_gui.h.
+
+ Rev 1.31 08 Apr 1993 13:41:16 DARRYLP
+Changes for STAT_SetStatus call.
+
+ Rev 1.30 24 Mar 1993 14:54:08 DARRYLP
+Added help for Font viewer/common dialogs.
+
+ Rev 1.29 22 Mar 1993 10:05:56 DARRYLP
+Added new DDE manager window.
+
+ Rev 1.28 12 Mar 1993 14:45:36 MIKEP
+add auto format call
+
+ Rev 1.27 12 Mar 1993 14:34:16 MIKEP
+auto call erase if foreign tape
+
+ Rev 1.26 07 Mar 1993 12:34:48 MIKEP
+add missing tape option
+
+ Rev 1.25 20 Oct 1992 14:27:04 MIKEP
+abort at EOF
+
+ Rev 1.24 20 Oct 1992 14:20:24 MIKEP
+add support for getcurrentoperation
+
+ Rev 1.23 04 Oct 1992 19:47:14 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.22 04 Sep 1992 10:36:30 MIKEP
+add tapedevice for nt
+
+ Rev 1.21 02 Sep 1992 10:16:24 GLENN
+Added the highlight color stuff.
+
+ Rev 1.20 07 Aug 1992 13:29:48 MIKEP
+add global dil for nt
+
+ Rev 1.19 04 Aug 1992 10:05:20 MIKEP
+no cats flag
+
+ Rev 1.18 10 Jun 1992 16:12:56 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.17 31 May 1992 11:14:10 MIKEP
+auto catalog changes
+
+ Rev 1.16 20 Apr 1992 13:51:18 GLENN
+Remove hard coded status line text size.
+
+ Rev 1.15 07 Apr 1992 15:45:44 GLENN
+Added APP exe name, exe version, res version, eng release globals.
+
+ Rev 1.14 24 Mar 1992 11:46:36 DAVEV
+OEM_MSOFT: removed ghWndLogFiles and ghWndLogFileView & all references
+
+ Rev 1.13 25 Feb 1992 12:08:38 MIKEP
+multidrive
+
+ Rev 1.12 23 Feb 1992 14:00:58 GLENN
+Updated frame client rect var.
+
+ Rev 1.11 19 Feb 1992 11:20:18 MIKEP
+free drive handles
+
+ Rev 1.10 11 Feb 1992 17:33:14 GLENN
+Added mdi client subclass globals.
+
+ Rev 1.9 20 Jan 1992 13:11:00 MIKEP
+epr fixes
+
+ Rev 1.8 23 Dec 1991 11:42:06 JOHNWT
+forgot to change the type
+
+ Rev 1.7 23 Dec 1991 11:40:40 JOHNWT
+changed gfPWForPWDBVerfified to ...State
+
+ Rev 1.6 20 Dec 1991 17:02:34 JOHNWT
+removed ghRuntimeDialog!
+
+ Rev 1.5 18 Dec 1991 11:43:46 JOHNWT
+added ghRuntimeDialog
+
+ Rev 1.4 14 Dec 1991 13:47:34 JOHNWT
+added gfPWForPWDBVerified
+
+ Rev 1.3 12 Dec 1991 17:12:26 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.2 06 Dec 1991 17:41:22 GLENN
+Added gnMainRibbonWidth
+
+ Rev 1.1 04 Dec 1991 18:06:34 GLENN
+Added terminat app flag.
+
+ Rev 1.0 20 Nov 1991 19:40:10 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#ifndef SS_GLOBAL_H
+
+#define SS_GLOBAL_H
+
+
+#include "appdefs.h"
+
+// MODULE GLOBAL VARIABLES for the GUI
+
+#ifdef SS_GUI
+
+extern INT gnReturnCode;
+
+extern HINSTANCE ghInst;
+extern HINSTANCE ghResInst;
+extern HANDLE ghAccel;
+extern HWND ghWndFrame;
+extern HWND ghWndMDIClient;
+extern HWND ghWndActiveDoc;
+extern HWND ghWndMainRibbon;
+extern HWND ghWndDocRibbon;
+extern HWND ghWndCommonDlg;
+extern HWND ghWndDebug;
+extern HWND ghWndDiskVols; // TEMP
+extern HWND ghWndTapeVols; // TEMP
+extern HWND ghWndJobs; // TEMP
+extern HWND ghModelessDialog;
+
+extern HMENU ghMenuJobs;
+
+extern LPSTR glpCmdLine;
+extern CHAR gszStatusLine[];
+extern CHAR gszTapeName[];
+
+extern RECT gRectFrameClient; // Frame's client area rectangle.
+extern RECT gpStatusRect; // Status line rectangle.
+extern HPEN ghPenBlack; // Black pen.
+extern HPEN ghPenWhite; // White pen.
+extern HPEN ghPenGray; // Gray pen.
+extern HPEN ghPenBackGnd; // Background pen.
+extern HPEN ghPenForeGnd; // Foreground pen.
+extern HPEN ghPenBtnText; // Button text pen.
+extern HPEN ghPenLtGray; // Button face pen.
+extern HPEN ghPenDkGray; // Button shadow pen.
+extern HBRUSH ghBrushLtGray; // Light Gray brush.
+extern HBRUSH ghBrushGray; // Gray brush.
+extern HBRUSH ghBrushBlack; // Black brush.
+extern HBRUSH ghBrushDkGray; // Dark Gray brush.
+extern HBRUSH ghBrushWhite; // White brush.
+extern HBRUSH ghBrushHighLight; // High Light brush.
+
+extern HFONT ghFontStatus; // Status Line Font.
+extern HFONT ghFontMsgBox; // Message Box Font.
+extern HFONT ghFontRibbon; // Ribbon Button Font.
+extern HFONT ghFontFiles; // File Font.
+extern HFONT ghFontLog; // Log File Font.
+extern HFONT ghFontIconLabels; // Icon Label Font.
+
+extern COLORREF gColorForeGnd; // Foreground Color
+extern COLORREF gColorBackGnd; // Background Color
+
+extern COLORREF gColorHighLight;
+extern COLORREF gColorHighLightText;
+
+extern ULONG gulFiles;
+extern ULONG gulBytes;
+extern ULONG gulDirectories;
+
+extern INT gnBorderWidth;
+extern INT gnMainRibbonHeight;
+
+extern INT16 gnNumJobs ;
+extern BOOL gfEditJob ;
+extern WORD gwCurrentJobIndex ;
+extern CHAR_PTR gpszJobName ;
+
+extern INT16 gnNumScheds ;
+extern INT16 gnEditSched ;
+
+extern BOOL gfDeleteCatalogs;
+extern BOOL gfShowStatusLine;
+extern BOOL gfShowMainRibbon;
+extern BOOL gfShowDocRibbon;
+extern BOOL gfDebug;
+extern BOOL gfPollDrive;
+extern BOOL gfAppInitialized;
+extern BOOL gfTerminateApp;
+extern BOOL gfIsJobRunning;
+
+extern HCURSOR ghCursorPen;
+extern BOOL gfOperation;
+extern BOOL gfHWInitialized;
+
+extern HRIBBON ghRibbonMain;
+extern HRIBBON ghRibbonDoc;
+
+extern WNDPROC glpfnNewListProc;
+extern WNDPROC glpfnOldListProc;
+extern WNDPROC glpfnNewMDIClientProc;
+extern WNDPROC glpfnOldMDIClientProc;
+
+extern POINT gDLMpt;
+
+extern BOOL gfDummyDriver;
+extern BOOL gfIndicators;
+extern BOOL gfReplace;
+extern BOOL gfServers;
+extern BOOL gfNetworks;
+extern BOOL gfEnhanced;
+
+#ifdef OEM_EMS
+extern BOOL gfExchange;
+#endif
+
+extern INT16 gCatMaintChoice;
+extern INT16 gCatBsetChoice;
+extern INT16 gCatTapeChoice;
+
+extern INT16 gViewNetChoices;
+
+#ifdef OEM_EMS
+extern INT16 gViewXchgChoices;
+#endif
+
+extern INT gfPWForPWDBState;
+
+extern INT gfAbortInMiddleOfFile;
+extern INT gfNoCATS;
+extern INT gfIgnoreOTC;
+extern INT gfCallEraseTape;
+extern INT gfCallFormatTape;
+
+extern INT gb_last_operation;
+extern INT gbCurrentOperation;
+extern INT gbAbortAtEOF;
+
+#if defined( UNICODE )
+extern CHAR_PTR gszTprintfBuffer;
+#else
+extern CHAR gszTprintfBuffer[];
+#endif
+
+extern LPSTR gszAppName;
+extern LPSTR gszExeVer;
+extern LPSTR gszResVer;
+extern LPSTR gszEngRel;
+
+
+extern UINT64 gn64LastOperTotalBytes;
+
+extern void SetStatusBlock(INT, DWORD);
+
+#ifndef OEM_MSOFT // NOT for MSOFT
+
+ extern HWND ghWndLogFiles;
+ extern HWND ghWndLogFileView;
+ extern PSTAT_SETSTATUSBLOCK pSTAT_SetStatusBlock;
+ extern ULONG (FAR PASCAL *glpfnSetStatus)(PSTAT_SETSTATUSBLOCK);
+ extern void SendStatusMsg(PSTAT_SETSTATUSBLOCK pStatusBlk);
+ extern void CALLBACK StatusTimerProc(void);
+ extern LPSTR glpOffsetTapeDriveName;
+ extern LPSTR glpOffsetCurrentTapeName;
+ extern LPSTR glpOffsetServerVolume;
+ extern LPSTR glpOffsetTapeDriveIdentifier;
+ extern LPSTR glpOffsetTapeNeededName;
+ extern LPSTR glpOffsetDiskName;
+ extern LPSTR glpOffsetActiveFile;
+ extern LPSTR glpOffsetErrorMsg;
+ extern LPSTR glpOffsetActiveDir;
+
+#endif // ! OEM_MSOFT
+
+#endif
+
+// LOADER
+extern BOOL gfLoaderEnabled ;
+extern CHAR gLDR_DefaultMagName[] ;
+
+
+typedef struct _AUTO_PASSWORD {
+ CHAR signature[ PASSWORD_SIGNATURE_SIZE ];
+ CHAR string[ MAX_TAPE_PASSWORD_LEN + 1 ];
+} AUTO_PASSWORD;
+
+extern AUTO_PASSWORD gb_auto_password;
+extern INT8 gb_encryption_key[];
+extern INT8 gb_abort_flag ;
+extern CHAR gb_exe_path[];
+extern CHAR gb_exe_fname[];
+extern CHAR gb_tmp_string[];
+extern INT16 gb_logging;
+extern INT gb_logging_error;
+extern BOOLEAN gb_error_during_operation;
+extern INT gb_new_tape_flag;
+
+
+#ifdef DLE_H
+extern DLE_HAND dle_list;
+#endif
+
+#ifdef BSDU_h
+extern BSD_HAND bsd_list;
+extern BSD_HAND tape_bsd_list;
+
+#endif
+
+#ifdef THW_STUFF
+#include "dilhwd.h"
+extern THW_PTR thw_list;
+extern DIL_HWD_PTR gb_dhw_ptr;
+
+#ifdef OS_WIN32
+extern DIL_HWD gb_NTDIL;
+# ifdef OEM_MSOFT
+ extern INT TapeDevice; // Multi-instance doesn't use this
+# endif
+#endif
+
+#endif
+
+#ifdef MEM_DEBUG
+extern BOOLEAN gb_no_abort_on_mem_check;
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/inc/helpids.h b/private/utils/ntbackup/inc/helpids.h
new file mode 100644
index 000000000..681331ea7
--- /dev/null
+++ b/private/utils/ntbackup/inc/helpids.h
@@ -0,0 +1,231 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: HELPIDS.H
+
+ Description: This header file contains helpids for the
+ help manager.
+
+ $Log: G:/UI/LOGFILES/HELPIDS.H_V $
+
+ Rev 1.17 07 Jul 1993 16:39:42 TIMN
+Added id for Abort box
+
+ Rev 1.16 22 Apr 1993 16:02:16 GLENN
+Added file SORT option support.
+
+ Rev 1.15 20 Apr 1993 10:57:08 DARRYLP
+Added patch for help ids for Hardware settings dialog.
+
+ Rev 1.14 02 Apr 1993 13:50:54 GLENN
+Changed to new help IDs. Added OPERATIONSINFO.
+
+ Rev 1.13 24 Mar 1993 10:16:30 DARRYLP
+Removed unused HELPID_VIEWFONT, it has been replaced.
+
+ Rev 1.12 24 Mar 1993 10:04:48 DARRYLP
+Added help for Fonts and Formatting.
+
+ Rev 1.11 10 Mar 1993 12:51:16 CARLS
+Changes to move Format tape to the Operations menu
+
+ Rev 1.10 06 Oct 1992 13:11:06 DARRYLP
+Changed values, adding email and login screens
+
+ Rev 1.9 06 Oct 1992 09:21:04 DARRYLP
+Added Email and Emllogon ids.
+
+ Rev 1.8 08 Sep 1992 15:47:46 DARRYLP
+Added defines for Connect, Disconnect and Fonts
+
+ Rev 1.7 17 Mar 1992 11:55:46 ROBG
+changed
+
+ Rev 1.6 17 Mar 1992 10:54:46 ROBG
+changed
+
+ Rev 1.5 17 Mar 1992 09:59:56 ROBG
+changed
+
+ Rev 1.4 10 Feb 1992 09:13:04 GLENN
+Updated.
+
+ Rev 1.3 13 Jan 1992 15:25:32 ROBG
+Added HELPID_DIALOGTRANSFER
+
+ Rev 1.2 10 Jan 1992 17:38:06 ROBG
+Changes.
+
+ Rev 1.1 11 Dec 1991 13:41:12 ROBG
+Added helpids for the launcher.
+
+ Rev 1.0 20 Nov 1991 19:33:28 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef helpids_h
+#define helpids_h
+
+
+#define HELPID_MINIMIZE_ICON 1
+#define HELPID_MAXIMIZE_ICON 2
+#define HELPID_SYSTEM_MENU 3
+#define HELPID_TITLE_BAR 4
+#define HELPID_SIZING_BORDER 5
+#define HELPID_FRAME_WINDOW 6
+#define HELPID_STATUSLINE 7
+#define HELPID_CLIENT_WINDOW 8
+#define HELPID_DOC_WINDOW 9
+#define HELPID_RIBBON_WINDOW 10
+
+#define HELPID_DISKS 11
+#define HELPID_TAPES 12
+#define HELPID_MACROS 13
+#define HELPID_JOBS 14
+#define HELPID_DISKTREE 15
+#define HELPID_TAPETREE 16
+#define HELPID_SERVERS 17
+#define HELPID_LOGFILES 18
+#define HELPID_DEBUG 19
+#define HELPID_SEARCH 20
+#define HELPID_LOGVIEW 21
+#define HELPID_JOBSELECT 22
+#define HELPID_MDISELECT 23
+
+// These processed on a "listbox" control.
+// begin
+
+#define HELPID_DISKTREELEFT 30
+#define HELPID_DISKTREERIGHT 31
+#define HELPID_TAPETREELEFT 32
+#define HELPID_TAPETREERIGHT 33
+#define HELPID_SERVERLEFT 34
+#define HELPID_SERVERRIGHT 35
+
+// end
+
+#define HELPID_FILEPRINT 100
+#define HELPID_FILESETUP 101
+#define HELPID_FILEEXIT 102
+
+#define HELPID_JOBMAINTENANCE 204
+
+#define HELPID_TREEEXPANDONE 300
+#define HELPID_TREEEXPANDBRANCH 301
+#define HELPID_TREEEXPANDALL 302
+#define HELPID_TREECOLLAPSEBRANCH 303
+
+#define HELPID_VIEWTREEANDDIR 400
+#define HELPID_VIEWTREEONLY 401
+#define HELPID_VIEWDIRONLY 402
+#define HELPID_VIEWSPLIT 403
+#define HELPID_VIEWALLFILEDETAILS 404
+#define HELPID_VIEWSORTNAME 405
+#define HELPID_VIEWSORTTYPE 406
+#define HELPID_VIEWSORTSIZE 407
+#define HELPID_VIEWSORTDATE 408
+#define HELPID_VIEWFONTS 409
+
+#define HELPID_OPERATIONSBACKUP 500
+#define HELPID_OPERATIONSRESTORE 501
+#define HELPID_OPERATIONSTRANSFER 502
+#define HELPID_OPERATIONSVERIFY 503
+#define HELPID_OPERATIONSINFO 504
+#define HELPID_OPERATIONSCATALOG 505
+#define HELPID_OPERATIONSCATMAINT 506
+#define HELPID_OPERATIONSSEARCH 507
+#define HELPID_OPERATIONSNEXTSET 508
+#define HELPID_OPERATIONSEJECT 509
+#define HELPID_OPERATIONSERASE 510
+#define HELPID_OPERATIONSRETENSION 511
+#define HELPID_OPERATIONSCONNECT 512
+#define HELPID_OPERATIONSDISCON 513
+#define HELPID_OPERATIONSFORMAT 514
+
+#define HELPID_SELECTCHECK 600
+#define HELPID_SELECTUNCHECK 601
+#define HELPID_SELECTADVANCED 603
+#define HELPID_SELECTSUBDIRS 604
+#define HELPID_SELECTSAVE 605
+#define HELPID_SELECTUSE 606
+#define HELPID_SELECTDELETE 607
+#define HELPID_SELECTCLEAR 608
+
+#define HELPID_SETTINGSBACKUP 700
+#define HELPID_SETTINGSRESTORE 701
+#define HELPID_SETTINGSLOGGING 702
+#define HELPID_SETTINGSNETWORK 703
+#define HELPID_SETTINGSCATALOG 704
+#define HELPID_SETTINGSHARDWARE 705
+#define HELPID_SETTINGSDEBUGWINDOW 706
+#define HELPID_SETTINGSGENERAL 707
+
+#define HELPID_WINDOWSCASCADE 800
+#define HELPID_WINDOWSTILE 801
+#define HELPID_WINDOWSREFRESH 802
+#define HELPID_WINDOWSCLOSEALL 803
+#define HELPID_WINDOWSARRANGEICONS 804
+
+#define HELPID_HELPINDEX 900
+#define HELPID_HELPSEARCH 901
+#define HELPID_HELPUSINGHELP 902
+#define HELPID_HELPABOUTWINTERPARK 903
+
+#define HELPID_DIALOGABOUT 2000
+#define HELPID_DIALOGSELECTADVANCED 2010
+#define HELPID_DIALOGSELECTSAVE 2020
+#define HELPID_DIALOGSELECTUSE 2030
+#define HELPID_DIALOGSELECTDELETE 2040
+#define HELPID_DIALOGADVRESTORE 2050
+#define HELPID_DIALOGJOBEDIT 2060
+#define HELPID_DIALOGJOBNEW 2070
+#define HELPID_DIALOGJOBMAINTENANCE 2080
+#define HELPID_DIALOGJOBOPTS 2090
+#define HELPID_DIALOGJOBSCHEDULE 2100
+#define HELPID_DIALOGSCHEDOPTS 2110
+#define HELPID_DIALOGEMAIL 2120
+#define HELPID_DIALOGLOGON 2130
+#define HELPID_DIALOGSETTINGSOPTIONS 2140
+#define HELPID_DIALOGSETTINGSBACKUP 2150
+#define HELPID_DIALOGSETTINGSRESTORE 2160
+#define HELPID_DIALOGSETTINGSLOGGING 2170
+#define HELPID_DIALOGSETTINGSNETWORK 2180
+#define HELPID_DIALOGSETTINGSCATALOG 2190
+
+// Note: The following two ID's need to be the same for now.
+#define HELPID_DIALOGSETTINGSHARDWARE 2200
+#define HELPID_OPERATIONSHARDWARE 2200
+
+#define HELPID_DIALOGSETTINGSDEBUG 2210
+#define HELPID_DIALOGLOGINPSWD 2220
+#define HELPID_DIALOGSEARCHTAPE 2230
+#define HELPID_DIALOGPRINTERSETUP 2240
+#define HELPID_DIALOGPRINT 2250
+#define HELPID_DIALOGCATMAINT 2260
+#define HELPID_DIALOGCATTAPE 2270
+#define HELPID_DIALOGTAPEPSWD 2280
+#define HELPID_DIALOGLANTAPEPSWD 2290
+#define HELPID_DIALOGJOBPROGRAMITEM 2300
+#define HELPID_DIALOGBACKUPSET 2310
+#define HELPID_DIALOGRESTORESET 2320
+#define HELPID_DIALOGVERIFYSET 2330
+#define HELPID_DIALOGREENTERPASSWORD 2340
+#define HELPID_DIALOGSKIPOPEN 2350
+#define HELPID_DIALOGFILEREPLACE 2360
+#define HELPID_DIALOGERASE 2370
+#define HELPID_DIALOGRUNTIME 2380
+#define HELPID_DIALOGTENSION 2390
+#define HELPID_DIALOGNEXTSET 2400
+#define HELPID_DIALOGPWDBPASSWORD 2410
+#define HELPID_DIALOGTRANSFER 2420
+#define HELPID_DIALOGFORMAT 2430
+#define HELPID_DIALOGABORT 2440
+
+// Defines for the three topics for the launcher.
+
+#define HELPID_LAUNCHMAINSCREEN 2460
+#define HELPID_LAUNCHRUNDELAY 2470
+#define HELPID_LAUNCHSCHEDDELAY 2480
+
+#endif
diff --git a/private/utils/ntbackup/inc/helpmang.h b/private/utils/ntbackup/inc/helpmang.h
new file mode 100644
index 000000000..66c4f76db
--- /dev/null
+++ b/private/utils/ntbackup/inc/helpmang.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: helpmang.h
+
+ Description: This file contains prototypes for the Help Manager.
+
+ $Log: G:/UI/LOGFILES/HELPMANG.H_V $
+
+ Rev 1.11 19 Jul 1993 19:22:12 MARINA
+move mw* vars into source
+
+ Rev 1.10 18 Jan 1993 14:49:26 GLENN
+Changed HM_EnterIdle() return type.
+
+ Rev 1.9 01 Nov 1992 16:30:54 DAVEV
+Unicode changes
+
+ Rev 1.8 04 Oct 1992 19:47:16 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.7 23 Apr 1992 14:23:52 ROBG
+Changed prototype of HM_EnterIdle.
+
+ Rev 1.6 05 Feb 1992 18:08:04 GLENN
+Replaced dialog string lookup table and supporting code with IDHELP call to specific dialog.
+
+ Rev 1.6 05 Feb 1992 17:54:42 GLENN
+Replaced dialog string lookup table and supporting code with IDHELP call to specific dialog.
+
+ Rev 1.5 24 Jan 1992 10:11:52 GLENN
+Matched the deinit call with it's prototype.
+
+ Rev 1.4 18 Dec 1991 15:52:46 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.3 12 Dec 1991 17:13:42 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.2 10 Dec 1991 16:27:52 GLENN
+Fixed changes added for NT
+
+ Rev 1.1 05 Dec 1991 11:34:56 DAVEV
+16/32 bit Windows port changes - 1st pass
+
+ Rev 1.0 20 Nov 1991 19:34:32 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+
+#ifndef HELPMANG_H
+#define HELPMANG_H
+
+
+typedef struct {
+
+ WORD wMenuId ;
+ WORD wHelpId ;
+
+} HELPID_MENUID_TABLE, far * LPHELPID_MENUID_TABLE ;
+
+
+#define NAME_MAX_SIZE 128
+
+INT APIENTRY HM_DialogFilter( INT nCode, MP1 mp1, MP2 mp2 ) ;
+VOID HM_Init( VOID ) ;
+VOID HM_Deinit( VOID ) ;
+WORD HM_FindHelpId( WORD wMenuId ) ;
+VOID HM_MakeHelpPathName( LPSTR szFileName ) ;
+BOOL HM_WMCommandProcessing( HWND hWnd, WORD wId ) ;
+VOID HM_WinHelp( HWND hWnd, WORD wCommand, DWORD dwData ) ;
+VOID HM_MenuCommands( HWND hWnd, WORD wId ) ;
+BOOL HM_ContextLbuttonDown ( HWND hWnd, MP1 mp1, MP2 mp2 ) ;
+BOOL HM_KeyDown( HWND hWnd, MP1 mp1 ) ;
+BOOL HM_SetCursor( HWND hWnd ) ;
+VOID HM_InitMenu( VOID ) ;
+BOOL HM_EnterIdle( HWND hWnd, MP1 mp1, WORD mwLastMenuID, WORD mwLastMenuState ) ;
+VOID HM_CloseHelpWindow ( HWND hWnd ) ;
+VOID HM_GetWindowClassHelpId ( HWND hWnd ,LPDWORD pdwNewContextId , LPSTR szClass ) ;
+
+// MACROS
+
+#define HM_DialogHelp( id ) HM_WinHelp( ghWndFrame, HELP_CONTEXT, (DWORD) (id) )
+
+#endif
diff --git a/private/utils/ntbackup/inc/hwcheck.h b/private/utils/ntbackup/inc/hwcheck.h
new file mode 100644
index 000000000..0717b92d6
--- /dev/null
+++ b/private/utils/ntbackup/inc/hwcheck.h
@@ -0,0 +1,30 @@
+
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: hwcheck.h
+
+ Description: Prototypes and defines for checking tape hardware status
+
+ Location:
+
+
+ $Log: G:/UI/LOGFILES/HWCHECK.H_V $
+
+ Rev 1.1 04 Oct 1992 19:47:16 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 31 Jan 1992 16:19:04 GLENN
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef CHECK_TAPE_HW
+
+#define CHECK_TAPE_HW
+
+BOOL HWC_TapeHWProblem ( BSD_HAND );
+VOID HWC_ReportDiagError ( BE_INIT_STR_PTR, INT16, INT16_PTR ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/hwconf.h b/private/utils/ntbackup/inc/hwconf.h
new file mode 100644
index 000000000..3061fd22b
--- /dev/null
+++ b/private/utils/ntbackup/inc/hwconf.h
@@ -0,0 +1,217 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: hwconf.h
+
+ Description: Include file for generic hardware configuration
+
+
+ $Log: G:\ui\logfiles\hwconf.h_v $
+
+ Rev 1.15 30 Nov 1993 19:18:56 TIMN
+Added cmdline /tape:x option to NTJ
+
+ Rev 1.14 06 Aug 1993 13:57:50 TIMN
+Corrected timer parameter type
+
+ Rev 1.12 05 Aug 1993 19:36:06 TIMN
+Added f(x) proto for wait dialog timer
+
+ Rev 1.11 03 Aug 1993 20:59:18 TIMN
+Cleaned up protos
+
+ Rev 1.10 09 Jun 1993 15:07:52 MIKEP
+enable c++
+
+ Rev 1.9 04 Jun 1993 10:57:18 GLENN
+Added HWC_HasDeviceChanged().
+
+ Rev 1.8 21 May 1993 16:33:38 Aaron
+Removed OS_WIN32 conditional
+
+ Rev 1.7 19 May 1993 09:16:30 TIMN
+Added f(x) prototype for NT to get special features for a tape device.
+
+ Rev 1.6 14 May 1993 14:07:34 TIMN
+Added f(x) prototypes for multiple instances. No other files required.
+
+ Rev 1.5 03 May 1993 15:44:24 TIMN
+Added f(x) protos for checking if a device is claimed or not (for NT).
+Changes are part of the multiple instance support.
+
+ Rev 1.4 04 Oct 1992 19:47:18 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 28 Sep 1992 17:07:16 GLENN
+MikeP changes ( Added HWC_GetTapeDevice() )
+
+ Rev 1.2 19 Mar 1992 16:46:48 GLENN
+Added enhanced status support.
+
+ Rev 1.1 17 Mar 1992 15:37:24 GLENN
+Added HWC_GetLastErrorString() function.
+
+ Rev 1.0 20 Nov 1991 19:33:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _hwconf_h_
+
+#define _hwconf_h_
+
+#define HW_NO_ERROR 0
+#define HW_INVALID_PARM 1
+#define HW_ERROR_DISPLAYED 2
+#define HW_ERROR_NO_RES_FILE 3
+#define HW_UNKNOWN_ERROR 4
+#define HW_ERROR_DETECTED 5
+#define HW_CHANGE_SUCCESS 6
+
+/* process flags for ProcessDILHWD() */
+#define HW_DISP_ERROR 0
+#define HW_RET_ERROR 1
+#define HW_DISP_WARNING 2
+
+#define HW_NUM_FIXED_PARMS 3
+#define HW_CTYPE_PARM 1
+
+/* DIL_HWD error definitions */
+#define HW_JUMPER_WARNING 1000
+#define HW_NUM_DRIVES_MISMATCH 1001
+#define HW_NO_TARGET_IDS 1002
+#define HW_CONTROLLER_DISABLED 1003
+#define HW_TEST_SUCCESSFUL 1004
+
+/**********************************************************************
+* MACHINE TYPE MASKS *
+* These defines relate directly to identical defines in the hardware *
+* resource files. If these change, identical changes must be made to *
+* the resource files. *
+**********************************************************************/
+
+#define PC_ISA_BUS 1 /* 8 bit bus */
+#define AT_ISA_BUS 2 /* 16 bit bus */
+#define AT_EISA_BUS 4 /* 32 bit bus */
+#define MICRO_CHANNEL_BUS 8 /* micro channel bus */
+#define ISA_BUS_GROUP 3 /* 8 and 16 bit busses */
+#define EISA_BUS_GROUP 7 /* 8, 16, and 32 bit busses */
+
+
+typedef struct ERROR_ELEM *ERROR_ELEM_PTR;
+typedef struct ERROR_ELEM {
+ UINT16 num_errors ; /* number of error numbers */
+ UINT16 *errnum ; /* pointer to error number list */
+ UINT16 num_loci ; /* number of loci */
+ UINT16 *locus ; /* pointer to loci number list */
+ BOOLEAN no_card_error ; /* is this a card not found error? */
+ struct HELP_STRUCT *error ; /* pointer to error structure */
+} ERROR_ELEM ;
+
+typedef struct ERROR_LIST *ERROR_LIST_PTR;
+typedef struct ERROR_LIST {
+ UINT16 num_elems ; /* number of error items in list */
+ ERROR_ELEM_PTR err_elem ; /* pointer to error items list */
+} ERROR_LIST ;
+
+typedef struct CARD_Q_ELEM *CARD_Q_ELEM_PTR;
+typedef struct CARD_Q_ELEM {
+ CHAR_PTR desc ; /* the verbal description of the card */
+ CHAR_PTR dll_name ; /* the dll file name */
+ CHAR_PTR sys_name ; /* the system file name */
+ BOOLEAN sys_required ; /* is a loadable system required */
+ BOOLEAN prev_used ; /* was this driver previously used */
+ INT16 num_parms ; /* number of default parms */
+ UINT16 dflt_parms[20] ; /* default parameters */
+} CARD_Q_ELEM ;
+
+typedef struct CARD_ELEM *CARD_ELEM_PTR;
+typedef struct CARD_ELEM {
+ UINT32 machine_mask ; /* machine mask */
+ UINT16 num_parm_indexes ; /* number of default parm indexes */
+ UINT16 *default_indexes ; /* default index list pointer */
+ INT16 priority ; /* the queueing priority */
+ CHAR_PTR desc ; /* the verbal description of the card */
+ CHAR_PTR dll_name ; /* the dll file name */
+ CHAR_PTR sys_name ; /* the system file name */
+ BOOLEAN sys_required ; /* is a loadable system required? */
+} CARD_ELEM ;
+
+typedef struct CARD_LIST *CARD_LIST_PTR;
+typedef struct CARD_LIST {
+ UINT16 num_elems ; /* number of cards in resource */
+ CARD_ELEM_PTR card_elem ; /* pointer to the card element list */
+} CARD_LIST;
+
+typedef struct OPTION_ELEM *OPTION_ELEM_PTR;
+typedef struct OPTION_ELEM {
+ CHAR_PTR name ; /* the verbose name of the element */
+ UINT32 value ; /* the actual value of the element */
+ UINT32 mask ; /* the mask to match card types */
+ BOOLEAN override_unique ; /* is this not so unique? */
+} OPTION_ELEM;
+
+typedef struct OPTION_LIST *OPTION_LIST_PTR ;
+typedef struct OPTION_LIST {
+ INT16 parm_number ; /* parm number in driver struct array */
+ BOOLEAN controller_type ; /* is this a controller type? */
+ BOOLEAN must_be_unique ; /* are options in this list unique? */
+ UINT32 jumper_switch ; /* mask: is ctlr option a jmpr/switch */
+ UINT32 changeable ; /* mask: is ctlr option changeable? */
+ INT16 num_options ; /* number of options in list */
+ OPTION_ELEM_PTR options_ptr ; /* pointer to options list elements */
+} OPTION_LIST ;
+
+/* list of item flags & indexes into the controller list array */
+typedef struct CTRL_ITEM *CTRL_ITEM_PTR ;
+typedef struct CTRL_ITEM {
+ UINT32 ctype_mask ; /* mask for valid controller card */
+ INT16 olist_index ; /* which option list is active FIXED */
+ INT16 option_index ; /* what is the selected option in list */
+ INT16 conflict_item ; /* dw item for conflict marker */
+ INT16 card_next_item ; /* index of next item for controller card */
+ INT16 controller_num ; /* controller number for the config file */
+} CTRL_ITEM ;
+
+typedef struct DD_CONFIG *DD_CONFIG_PTR ;
+typedef struct DD_CONFIG {
+ CHAR_PTR dd_description ; /* device driver description */
+ INT16 max_cards ; /* maximum number of configurable cards */
+ UINT16 *card_list_ptr ;
+ INT16 num_option_lists ; /* number of option lists */
+ OPTION_LIST_PTR option_list_ptr ;
+ INT16 num_ctrl_items ; /* redundant because in dw struct */
+ CTRL_ITEM_PTR item_list_ptr ;
+} DD_CONFIG ;
+
+
+/* function prototypes */
+
+INT HWC_InitDILHWD( DIL_HWD_PTR *, INT * ) ;
+INT HWC_ProcessDILHWD( INT, DIL_HWD_PTR ) ;
+INT HWC_ProcessError( WORD, WORD, WORD, WORD, CDS_PTR ) ;
+LPSTR HWC_GetLastErrorString( VOID ) ;
+VOID HWC_SetLastErrorString( LPSTR ) ;
+INT HWC_GetTapeDevice( VOID ) ;
+
+INT HWC_InitTapeDevice( VOID ) ;
+INT HWC_DeInitTapeDevice( VOID ) ;
+INT HWC_SelectTapeDevice( INT nTapeDevice ) ;
+
+BOOL HWC_IsDeviceNoDevice( VOID ) ;
+BOOL HWC_HasDeviceChanged( VOID ) ;
+VOID HWC_BuildJobDeviceComboBox( HWND hDlg, INT idControl ) ;
+LPSTR HWC_GetDeviceNameForStatusLine( LPSTR, INT ) ;
+VOID HWC_GetDeviceSpecialFeatures( INT device, UINT32_PTR pFeatures, BOOL fOption ) ;
+
+BOOL HWC_IsDeviceAvailable( INT ) ;
+HANDLE HWC_ClaimDevice( INT ) ;
+BOOL HWC_UnClaimDevice( HANDLE *hClaimedDevice ) ;
+
+VOID HWC_DeviceConflictTimer( INT nDeviceNumber, HANDLE *hDevice ) ;
+
+INT HWC_ClaimJobsDevice( CHAR_PTR pszTapeDriveName ) ;
+INT HWC_UnClaimJobsDevice( CHAR_PTR pszTapeDriveName ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/hwctext.h b/private/utils/ntbackup/inc/hwctext.h
new file mode 100644
index 000000000..74af37d7b
--- /dev/null
+++ b/private/utils/ntbackup/inc/hwctext.h
@@ -0,0 +1,198 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: hwctext.h
+
+ Description: This file contains the STRING IDs for the Maynstream GUI
+ project HARDWARE CONFIGURATION.
+
+ $Log: G:/UI/LOGFILES/HWCTEXT.H_V $
+
+ Rev 1.15 05 Aug 1993 19:33:44 TIMN
+Removed unused ids
+
+ Rev 1.14 03 Aug 1993 21:05:00 TIMN
+Removed unused hardware settings id
+
+ Rev 1.13 30 Jul 1993 19:01:50 TIMN
+Removed unused ids and added new ones
+
+ Rev 1.12 26 Jul 1993 17:15:18 GLENN
+Added strings to support new list box style dialog. Now supports device status.
+
+ Rev 1.11 21 Jun 1993 13:15:54 CHUCKB
+Added define for current device string.
+
+ Rev 1.10 15 Jun 1993 12:09:02 GLENN
+Added support for the NT dummy device driver.
+
+ Rev 1.9 04 Jun 1993 10:58:00 GLENN
+Added new strings for HWC.
+
+ Rev 1.8 30 Nov 1992 16:08:40 GLENN
+Added IBM PS/2 SCSI hardware support.
+
+ Rev 1.7 04 Oct 1992 19:47:20 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.6 02 Oct 1992 16:27:00 STEVEN
+Added polldrive failure ID.
+
+ Rev 1.5 04 May 1992 16:41:22 GLENN
+Added PS/2 QIC and SCSI stuff.
+
+ Rev 1.4 19 Mar 1992 16:46:56 GLENN
+Added enhanced status support.
+
+ Rev 1.3 17 Mar 1992 15:34:56 GLENN
+Moved POLLDRIVE IDs from STRINGS.H to HWCTEXT.H
+
+ Rev 1.2 10 Feb 1992 09:16:12 GLENN
+Added warning text ID.
+
+ Rev 1.1 29 Jan 1992 17:55:14 GLENN
+Added Testing hardware ID.
+
+ Rev 1.0 24 Jan 1992 19:05:16 GLENN
+Initial revision.
+
+******************************************************************************/
+
+#ifndef HWCTEXT_H
+#define HWCTEXT_H
+
+// hardware settings dialog control text
+
+#define IDS_HWC_START 5000
+
+
+#define IDS_HWC_DRIVER_MS_SCSI (IDS_HWC_START+0)
+#define IDS_HWC_CARD_0_MS_SCSI (IDS_HWC_START+1)
+#define IDS_HWC_CARD_1_MS_SCSI (IDS_HWC_START+2)
+#define IDS_HWC_CARD_2_MS_SCSI (IDS_HWC_START+3)
+
+#define IDS_HWC_DRIVER_MS_QIC (IDS_HWC_START+4)
+#define IDS_HWC_CARD_0_MS_QIC (IDS_HWC_START+5)
+#define IDS_HWC_CARD_1_MS_QIC (IDS_HWC_START+6)
+
+#define IDS_HWC_DRIVER_AD_SCSI (IDS_HWC_START+7)
+#define IDS_HWC_CARD_0_AD_SCSI (IDS_HWC_START+8)
+#define IDS_HWC_CARD_1_AD_SCSI (IDS_HWC_START+9)
+
+#define IDS_HWC_DRIVER_MS_DUMMY (IDS_HWC_START+10)
+#define IDS_HWC_CARD_0_MS_DUMMY (IDS_HWC_START+11)
+
+#define IDS_HWC_DRIVER_IBM_SCSI (IDS_HWC_START+12)
+#define IDS_HWC_CARD_0_IBM_SCSI (IDS_HWC_START+13)
+
+
+#define IDS_HWC_ATTACHED (IDS_HWC_START+31)
+#define IDS_HWC_IOADDRESS (IDS_HWC_START+32)
+#define IDS_HWC_IRQNUM (IDS_HWC_START+33)
+#define IDS_HWC_DMACHANNEL (IDS_HWC_START+34)
+
+#define IDS_HWC_AUTO (IDS_HWC_START+35)
+#define IDS_HWC_NONDMA (IDS_HWC_START+36)
+
+#define IDS_HWC_IO_360 (IDS_HWC_START+40)
+#define IDS_HWC_IO_370 (IDS_HWC_START+41)
+#define IDS_HWC_IO_FF60 (IDS_HWC_START+42)
+#define IDS_HWC_IO_FF70 (IDS_HWC_START+43)
+
+#define IDS_HWC_NUMBERS (IDS_HWC_START+50)
+#define IDS_HWC_0 (IDS_HWC_NUMBERS+0)
+#define IDS_HWC_1 (IDS_HWC_NUMBERS+1)
+#define IDS_HWC_2 (IDS_HWC_NUMBERS+2)
+#define IDS_HWC_3 (IDS_HWC_NUMBERS+3)
+#define IDS_HWC_4 (IDS_HWC_NUMBERS+4)
+#define IDS_HWC_5 (IDS_HWC_NUMBERS+5)
+#define IDS_HWC_6 (IDS_HWC_NUMBERS+6)
+#define IDS_HWC_7 (IDS_HWC_NUMBERS+7)
+#define IDS_HWC_8 (IDS_HWC_NUMBERS+8)
+#define IDS_HWC_9 (IDS_HWC_NUMBERS+9)
+#define IDS_HWC_10 (IDS_HWC_NUMBERS+10)
+#define IDS_HWC_11 (IDS_HWC_NUMBERS+11)
+#define IDS_HWC_12 (IDS_HWC_NUMBERS+12)
+#define IDS_HWC_13 (IDS_HWC_NUMBERS+13)
+#define IDS_HWC_14 (IDS_HWC_NUMBERS+14)
+#define IDS_HWC_15 (IDS_HWC_NUMBERS+15)
+
+#define IDS_HWC_STATUS_ACTIVE (IDS_HWC_START+80)
+#define IDS_HWC_STATUS_MAYBEINUSE (IDS_HWC_START+81)
+#define IDS_HWC_STATUS_AVAILABLE (IDS_HWC_START+82)
+#define IDS_HWC_STATUS_INUSE (IDS_HWC_START+83)
+#define IDS_HWC_STATUS_INVALIDDRIVE (IDS_HWC_START+84)
+
+#define IDS_HWC_TESTRESULTSTITLE (IDS_HWC_START+100)
+
+#define IDS_HWC_TESTED_NOT (IDS_HWC_START+101)
+#define IDS_HWC_TESTED_GOOD (IDS_HWC_START+102)
+#define IDS_HWC_TESTED_BAD (IDS_HWC_START+103)
+#define IDS_HWC_TESTED_INIT (IDS_HWC_START+104)
+
+#define IDS_HWC_NOCONFIG (IDS_HWC_START+105)
+
+#define IDS_HWC_INIT_SUCCESS (IDS_HWC_START+110)
+
+#define IDS_HWC_JUMPER_CHANGE (IDS_HWC_START+111)
+
+#define IDS_HWC_NO_DRIVE (IDS_HWC_START+112)
+#define IDS_HWC_INTERRUPT_CONFLICT (IDS_HWC_START+113)
+#define IDS_HWC_DMA_CONFLICT (IDS_HWC_START+114)
+#define IDS_HWC_NO_CARD (IDS_HWC_START+115)
+#define IDS_HWC_INVALID_BASE_ADDR (IDS_HWC_START+116)
+#define IDS_HWC_INVALID_INTERRUPT (IDS_HWC_START+117)
+#define IDS_HWC_INVALID_DMA (IDS_HWC_START+118)
+#define IDS_HWC_ATTACHED_DRIVES (IDS_HWC_START+119)
+#define IDS_HWC_NO_TARGET_ID (IDS_HWC_START+120)
+#define IDS_HWC_CARD_DISABLED (IDS_HWC_START+121)
+#define IDS_HWC_NO_DRIVE_LOADED (IDS_HWC_START+122)
+#define IDS_HWC_ERROR_NUMBER (IDS_HWC_START+123)
+
+#define IDS_HWC_WARNING_TITLE (IDS_HWC_START+124)
+#define IDS_HWC_NO_CONFIG (IDS_HWC_START+125)
+
+#define IDS_HWC_INVALID_DEVICE_TITLE (IDS_HWC_START+126)
+#define IDS_HWC_INVALID_DEVICE_MSG (IDS_HWC_START+127)
+#define IDS_HWC_NOINST_DEVICE_TITLE (IDS_HWC_START+128)
+#define IDS_HWC_NOINST_DEVICE_MSG (IDS_HWC_START+129)
+#define IDS_HWC_NOSEL_DEVICE_TITLE (IDS_HWC_START+130)
+#define IDS_HWC_NOSEL_DEVICE_MSG (IDS_HWC_START+131)
+
+#define IDS_HWC_NO_DEVICE_TEXT (IDS_HWC_START+134)
+
+#define IDS_HWC_DEV_CONFLICT_TITLE (IDS_HWC_START+136)
+#define IDS_HWC_DEV_CONFLICT_MSG (IDS_HWC_START+137)
+#define IDS_HWC_DEV_CONFLICT2_MSG (IDS_HWC_START+138)
+
+#define IDS_HWC_DEV_UNASSIGNED (IDS_HWC_START+139)
+#define IDS_HWC_DEV_NODEVICE (IDS_HWC_START+140)
+
+#define IDS_HWC_DUMMY_DEVICE_TEXT (IDS_HWC_START+141)
+#define IDS_HWC_DUMMY_DEVICE_DLL (IDS_HWC_START+142)
+
+#define IDS_HWC_DEV_CURRENTDEVICE (IDS_HWC_START+143)
+
+// MI and NO DEVICE STUFF
+
+
+// POLL DRIVE STRING DEFINES
+
+#define IDS_POLLDRIVESTART (IDS_HWC_START+150)
+#define IDS_POLLDRIVE_MESSAGE (IDS_POLLDRIVESTART+0)
+#define IDS_POLLDRIVE_BIGPROBLEM (IDS_POLLDRIVESTART+1)
+#define IDS_POLLDRIVE_SMALLPROBLEM (IDS_POLLDRIVESTART+2)
+#define IDS_POLLDRIVE_INIT (IDS_POLLDRIVESTART+3)
+#define IDS_POLLDRIVE_INIT_FAILED (IDS_POLLDRIVESTART+4)
+#define IDS_POLLDRIVE_START (IDS_POLLDRIVESTART+5)
+#define IDS_POLLDRIVE_POLL (IDS_POLLDRIVESTART+6)
+#define IDS_POLLDRIVE_STOP (IDS_POLLDRIVESTART+7)
+#define IDS_POLLDRIVE_START_REENT (IDS_POLLDRIVESTART+8)
+#define IDS_POLLDRIVE_POLL_REENT (IDS_POLLDRIVESTART+9)
+#define IDS_POLLDRIVE_STOP_REENT (IDS_POLLDRIVESTART+10)
+#define IDS_POLLDRIVE_FAILED_MINOR (IDS_POLLDRIVESTART+11)
+#define IDS_POLLDRIVE_FAILED_SEVERE (IDS_POLLDRIVESTART+12)
+#define IDS_POLLDRIVE_TAPE_EJECT (IDS_POLLDRIVESTART+13)
+#define IDS_POLLDRIVE_DRIVE_FAILURE (IDS_POLLDRIVESTART+14)
+
+#endif
diff --git a/private/utils/ntbackup/inc/hwdlg.h b/private/utils/ntbackup/inc/hwdlg.h
new file mode 100644
index 000000000..63f04e74a
--- /dev/null
+++ b/private/utils/ntbackup/inc/hwdlg.h
@@ -0,0 +1,79 @@
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSHARDWARE 19
+#else
+#include "dlg_ids.h"
+#endif
+
+// hardware settings
+
+#define IDD_H_TEST 105
+
+#define IDD_H_CONTROLLER 106
+
+
+#define IDD_H_CSTATUSBOX 110
+#define IDD_H_ENABLED 111
+#define IDD_H_DISABLED 112
+#define IDD_H_UNABLETOUSE 113
+#define IDD_H_CARDSTATUS 114
+
+#define IDD_H_SCSITARGET 120
+#define IDD_H_TARGET0 121
+#define IDD_H_TARGET1 122
+#define IDD_H_TARGET2 123
+#define IDD_H_TARGET3 124
+#define IDD_H_TARGET4 125
+#define IDD_H_TARGET5 126
+#define IDD_H_TARGET6 127
+#define IDD_H_TARGET7 128
+
+#define IDD_H_SETTINGSBOX 130
+
+
+
+#define HWC_MAXLISTBOXES 4
+
+#define HWC_FIRSTLISTBOX 0
+#define HWC_SECONDLISTBOX 1
+#define HWC_THIRDLISTBOX 2
+#define HWC_FOURTHLISTBOX 3
+
+#define HWC_LISTBOXNAMES 140
+
+#define HWC_LISTBOXES 150
+
+#define IDD_H_FIRSTSTRING (HWC_LISTBOXNAMES+HWC_FIRSTLISTBOX)
+#define IDD_H_SECONDSTRING (HWC_LISTBOXNAMES+HWC_SECONDLISTBOX)
+#define IDD_H_THIRDSTRING (HWC_LISTBOXNAMES+HWC_THIRDLISTBOX)
+#define IDD_H_FOURTHSTRING (HWC_LISTBOXNAMES+HWC_FOURTHLISTBOX)
+
+#define IDD_H_FIRSTBOX (HWC_LISTBOXES+HWC_FIRSTLISTBOX)
+#define IDD_H_SECONDBOX (HWC_LISTBOXES+HWC_SECONDLISTBOX)
+#define IDD_H_THIRDBOX (HWC_LISTBOXES+HWC_THIRDLISTBOX)
+#define IDD_H_FOURTHBOX (HWC_LISTBOXES+HWC_FOURTHLISTBOX)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/private/utils/ntbackup/inc/iblock.h b/private/utils/ntbackup/inc/iblock.h
new file mode 100644
index 000000000..b5e3ce973
--- /dev/null
+++ b/private/utils/ntbackup/inc/iblock.h
@@ -0,0 +1,29 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: iblock.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: G:/LOGFILES/IBLOCK.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:33:16 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _iblock_h_
+#define _iblock_h_
+
+VOID MarkBlockBad( CHAR_PTR buf, UINT16 block_size );
+UINT16 ImageBlockType( FILE_HAND hand, CHAR_PTR buf, UINT16 block_size );
+VOID AdvanceImageHandle( FILE_HAND hand, UINT16 distance );
+
+#endif
diff --git a/private/utils/ntbackup/inc/ibm_scsi.h b/private/utils/ntbackup/inc/ibm_scsi.h
new file mode 100644
index 000000000..9153a81d0
--- /dev/null
+++ b/private/utils/ntbackup/inc/ibm_scsi.h
@@ -0,0 +1,7 @@
+#ifndef IBM_SCSI_RH
+
+#define IBM_SCSI_RH
+
+#define SES_ENG_IS 0
+
+#endif
diff --git a/private/utils/ntbackup/inc/icons.h b/private/utils/ntbackup/inc/icons.h
new file mode 100644
index 000000000..a05e1a773
--- /dev/null
+++ b/private/utils/ntbackup/inc/icons.h
@@ -0,0 +1,62 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: icons.h
+
+ Description: This file contains the ICON IDs for the Maynstream GUI
+ project.
+
+ $Log: G:/UI/LOGFILES/ICONS.H_V $
+
+ Rev 1.3 04 Oct 1992 19:47:24 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Mar 1992 18:18:18 GLENN
+Added done icon.
+
+ Rev 1.1 22 Jan 1992 12:22:26 GLENN
+Added animated icons
+
+ Rev 1.0 20 Nov 1991 19:41:30 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+// ICON RESOURCE IDs -- RANGE: 1 - 20
+
+#define IDRI_WNTRPARK ID(1)
+#define IDRI_SETUP ID(2)
+#define IDRI_DISKS ID(3)
+#define IDRI_TAPES ID(4)
+#define IDRI_JOBS ID(5)
+#define IDRI_JOBS1 ID(6)
+#define IDRI_JOBS2 ID(7)
+#define IDRI_TREE ID(8)
+#define IDRI_FILES ID(9)
+#define IDRI_TREEFILE ID(10)
+#define IDRI_DEBUG ID(11)
+#define IDRI_SERVERS ID(12)
+#define IDRI_LOGFILES ID(13)
+#define IDRI_SEARCH ID(14)
+#define IDRI_BACKUP ID(15)
+#define IDRI_RESTORE ID(16)
+#define IDRI_TRANSFER ID(17)
+#define IDRI_DONE ID(18)
+#define IDRI_EXCHANGE ID(19)
+
+#define IDRI_BKUP0 ID(20)
+#define IDRI_BKUP1 ID(21)
+#define IDRI_BKUP2 ID(22)
+#define IDRI_BKUP3 ID(23)
+#define IDRI_BKUP4 ID(24)
+#define IDRI_BKUP5 ID(25)
+#define IDRI_BKUP6 ID(26)
+#define IDRI_BKUP7 ID(27)
+#define IDRI_BKUP8 ID(28)
+
+#define IDRI_SPIN0 ID(30)
+#define IDRI_SPIN1 ID(31)
+#define IDRI_SPIN2 ID(32)
+#define IDRI_SPIN3 ID(33)
diff --git a/private/utils/ntbackup/inc/image_fs.h b/private/utils/ntbackup/inc/image_fs.h
new file mode 100644
index 000000000..612a49197
--- /dev/null
+++ b/private/utils/ntbackup/inc/image_fs.h
@@ -0,0 +1,165 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: image_fs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the prototypes for the IMAGE
+ file system functions.
+
+ $Log: N:/LOGFILES/IMAGE_FS.H_V $
+ *
+ * Rev 1.3 22 Sep 1992 17:15:26 CHUCKB
+ * Removed references to fs_GetTotalSizeDBLK().
+ *
+ * Rev 1.2 16 Dec 1991 18:12:26 STEVEN
+ * move common functions into table
+ *
+ * Rev 1.1 23 May 1991 16:46:00 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:31:36 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef _image_fs_h_
+#define _image_fs_h_
+
+#include "fsys.h"
+
+
+INT16 IM_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd); /* I - passowrd NOT USED */
+
+INT16 IM_DetachDLE( FSYS_HAND fsh ); /* I - */
+
+INT16 IM_CreateObj( FSYS_HAND fsh, /* I - File system to create object one */
+ DBLK_PTR dblk); /* I - Describes object to create */
+
+INT16 IM_OpenObj( FSYS_HAND fsh, /* I - file system that the file is opened on */
+ FILE_HAND *hand, /* O - allocated handle */
+ DBLK_PTR dblk, /*I/O- describes the file to be opened */
+ OPEN_MODE mode); /* I - open mode */
+
+INT16 IM_ReadObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size); /* O - Block size needed for next read */
+
+
+INT16 IM_WriteObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* I - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size); /* O - Block size need for next read */
+
+INT16 IM_VerifyObj( FILE_HAND hand, /* I - file handle to verify data with */
+ CHAR_PTR buf, /* I - buffer needed to perform verify */
+ CHAR_PTR data, /* I - data to verify against */
+ UINT16 *size, /*I/O- size of buffers / amount verified */
+ UINT16 *blk_size); /* O - minum size of block for next call */
+
+
+INT16 IM_CloseObj( FILE_HAND hand ); /* I - handle of object to close */
+
+IM_ReturnInfoSucces( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+
+INT16 IM_FindFirst( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+ CHAR_PTR sname, /* I - serach name */
+ UINT16 find_type ) ; /* I - type of search */
+
+INT16 IM_FindNext( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* O - Discriptor block */
+
+
+INT16 IM_GetCurrentPath( FSYS_HAND fsh, /* I - file system to get current path from */
+ CHAR_PTR path, /* O - buffer to place this path */
+ INT16 *size); /*I/O- size of buffer on entry & on exit */
+
+INT16 IM_SeekObj( FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ); /*I/O- Offset to seek; Number of bytes actualy seeked */
+
+INT16 IM_GetMaxSizeDBLK( FSYS_HAND fsh /* not used */ );
+
+INT16 IM_GetBasePath( FSYS_HAND fsh, /* I - file system to get base path from */
+ CHAR_PTR full_path, /* O - buffer to place this path */
+ INT16 *size ); /*I/O- size of buffer on entry & on exit */
+
+INT16 IM_ReturnInfoSuccess( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk ); /* I - data to write to disk */
+
+INT16 IM_GetNoDateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ); /*I/O- createion date to read (or to write) */
+
+INT16 IM_ModNoDateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+UINT32 IM_GetGenSizeDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 IM_ModAttribDBLK( BOOLEAN set_it ,
+ DBLK_PTR dblk ,
+ UINT32_PTR attr );
+
+
+INT16 IM_GetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE *type );
+
+
+// UINT32 IM_GetTotalSizeDBLK( FSYS_HAND fsh,
+// DBLK_PTR dblk );
+
+VOID IM_SetOwnerId( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk, /* O - DBLK to modify */
+ UINT32 id ); /* I - value to set it to */
+
+UINT32 IM_GetGenOffsetDBLK( FSYS_HAND fsh , /* I - File system handle - not used */
+ DBLK_PTR dblk ); /* I - Descriptor block to get generic data size for */
+
+INT16 IM_SizeofOSInfo( FSYS_HAND fsh , /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to get size of OS info for */
+
+INT16 IM_GetOS_InfoDBLK( DBLK_PTR dblk , /* I - DBLK to get the info from */
+ CHAR_PTR os_info , /* O - Buffer to place data */
+ INT16 *size ); /*I/O- Buffer size / data length */
+
+INT16 IM_GetActualSizeDBLK( FSYS_HAND fsh ,
+ DBLK_PTR dblk );
+
+INT16 IM_CreateIDB( FSYS_HAND fsh, GEN_IDB_DATA_PTR dat );
+
+
+INT16 IM_UpDir( FSYS_HAND fsh ) ;
+
+
+INT16 IM_ChangeDir( FSYS_HAND fsh, CHAR_PTR path, INT16 psize ) ;
+
+INT16 IM_GetCurrentDDB( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 IM_GetPname( FSYS_HAND fsh,
+ DBLK_PTR dblk, /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 IM_SizeofPname( FSYS_HAND fsh,
+ DBLK_PTR dblk ); /* I - Descriptor block to get path from */
+
+INT16 IM_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg ) ;
+
+INT16 IM_MakePath(
+CHAR_PTR buf,
+INT16 bsize,
+GENERIC_DLE_PTR dle,
+CHAR_PTR path,
+INT16 psize,
+CHAR_PTR fname ) ;
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/imdblk.h b/private/utils/ntbackup/inc/imdblk.h
new file mode 100644
index 000000000..6e9fd4530
--- /dev/null
+++ b/private/utils/ntbackup/inc/imdblk.h
@@ -0,0 +1,56 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: imdblk.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the definition of the IMAGE
+ descriptor block for the IMAGE file system.
+
+
+
+ $Log: G:/LOGFILES/IMDBLK.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:32:34 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+
+
+#ifndef imdblk_h
+#define imdblk_h
+
+
+typedef struct IMAGE_DBLK *IMAGE_DBLK_PTR;
+
+typedef struct IMAGE_DBLK {
+ UINT8 blk_type; /* IDB_ID */
+ COM_DBLK fs_reserved ;
+ UINT8_PTR allocated_buff;
+ UINT8_PTR dma_buff;
+
+ UINT16 bytes_per_sector;
+ UINT16 bytes_per_track;
+ UINT16 hsect; /* number of sectors per track */
+ UINT16 hhead; /* number of heads */
+ UINT32 rsect; /* relative sector number of partition's first sector */
+ UINT32 num_sect; /* number of sectors in partition */
+ UINT16 sys_ind; /* partition's system indicator */
+ BOOLEAN has_bad_blk_maps; /* TRUE if dblks may contain the < 2.6 bad block maps */
+ UINT32 dist_to_bad_block_map;
+ UINT8_PTR saved_bad_block_map;
+ UINT16 size_of_bad_block_map; /* size needed for saved_bad_block_map ( on tape their may be a */
+ /* whole sector worth, however only the first n bytes are significant) */
+
+ UINT16 part_name ;
+
+} IMAGE_DBLK;
+
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/install.h b/private/utils/ntbackup/inc/install.h
new file mode 100644
index 000000000..7a385f4e3
--- /dev/null
+++ b/private/utils/ntbackup/inc/install.h
@@ -0,0 +1,148 @@
+/******************************************************************************
+Copyright (c) Glenn Hansen. 1993
+GSH
+
+ Name: install.h
+
+ Description: This file contains the headers and definitions for a
+ Generic Installation program for Windows and Windows NT.
+
+ $Log: G:\ui\logfiles\install.h_v $
+
+ Rev 1.0 17 Aug 1993 16:38:16 GLENN
+Initial revision.
+
+******************************************************************************/
+
+
+// Include the common product definition file.
+
+#ifndef _install_h_
+#define _install_h_
+
+#include "proddefs.h"
+
+#define ID(x) MAKEINTRESOURCE(x)
+
+// DEFINITIONS and IDs
+
+#define IDC_NTINSTC 1
+
+#define IDD_QUESTION 1
+#define IDD_NLS 2
+
+#define IDDC_PATH 200
+#define IDDC_SPECIFYTARGET 201
+#define IDDC_ADDLAUNCHER 202
+
+#define IDDC_LANGUAGESTART 1000
+
+#define IDDC_LANGUAGE1 (IDDC_LANGUAGESTART+1)
+#define IDDC_LANGUAGE2 (IDDC_LANGUAGESTART+2)
+#define IDDC_LANGUAGE3 (IDDC_LANGUAGESTART+3)
+#define IDDC_LANGUAGE4 (IDDC_LANGUAGESTART+4)
+#define IDDC_LANGUAGE5 (IDDC_LANGUAGESTART+5)
+#define IDDC_LANGUAGE6 (IDDC_LANGUAGESTART+6)
+#define IDDC_LANGUAGE7 (IDDC_LANGUAGESTART+7)
+#define IDDC_LANGUAGE8 (IDDC_LANGUAGESTART+8)
+
+#define IDRBM_TITLEBOX 100
+#define IDRBM_APPLOGO 101
+#define IDRBM_PERCDONE 102
+#define IDRBM_GRANITE 103
+
+#define IDD_BLACK 0
+#define IDD_BLUE 1
+#define IDD_GREEN 2
+#define IDD_CYAN 3
+#define IDD_RED 4
+#define IDD_MAGENTA 5
+#define IDD_YELLOW 6
+#define IDD_WHITE 7
+#define IDD_GRAY 8
+#define IDD_DKBLUE 9
+#define IDD_DKGRAY 10
+#define IDD_DKGREEN 11
+
+#define IDD_RECT 20
+#define IDD_ELL 21
+
+#define IDD_PAINT 30
+
+#define BM_OFFSET 100
+
+#define DEST_PATH_LEN 128
+#define DEST_PATH_SIZE (DEST_PATH_LEN + 1)
+
+#define INFOWIN_WIDTH 340
+#define INFOWIN_HEIGHT 200
+
+#define PERCWIN_WIDTH 356
+#define PERCWIN_HEIGHT 170
+#define PERCWIN_BAR_WIDTH 300
+#define PERCWIN_BAR_HEIGHT 28
+
+#define WM_INITAPPLICATION (WM_USER+201)
+
+// STRING TABLE IDs
+
+#include "inststr.h"
+
+// GLOBALS
+
+extern HINSTANCE ghInst;
+extern HINSTANCE ghResInst;
+extern BOOL gfCmdLine;
+extern HWND ghWndFrame;
+extern HWND ghWndClient;
+extern HWND ghWndInfo;
+extern HWND ghWndInfoText;
+extern HWND ghWndPerc;
+extern HWND ghWndPercButton;
+extern INT gnTitleBitmapBottom;
+extern CHAR gszAppDestPath[DEST_PATH_SIZE];
+extern CHAR gszWelcomeText[120];
+extern BOOL gfCancel;
+extern INT gnLanguageID;
+extern BOOL gfWaiting;
+
+// MACROS
+
+#define RSM_StringCopy( x, y, z ) RSM_StringLoad( x, y, z )
+
+// FUNCTION PROTOTYPES
+
+WINRESULT WINAPI _export FrameWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT WINAPI _export ClientWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT WINAPI _export InfoWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT WINAPI _export PercentWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT WINAPI _export ButtonWndProc ( HWND, MSGID, MP1, MP2 );
+DLGRESULT WINAPI _export DM_NLSDlg ( HWND, MSGID, MP1, MP2 );
+DLGRESULT WINAPI _export DM_TargetDlg ( HWND, MSGID, MP1, MP2 );
+WINRESULT WINAPI _export WM_DDEClientWndProc ( HWND, MSGID, MP1, MP2 );
+
+BOOL EnablePercentDone ( BOOL );
+BOOL SetPercentDone ( INT );
+BOOL SetPercentText ( INT );
+BOOL EnableInfo ( BOOL );
+BOOL SetInfoBox ( UINT );
+BOOL CheckForCancel ( VOID );
+BOOL DM_ShowNLSDlg ( HWND );
+BOOL DM_ShowTargetDlg ( HWND, LPSTR );
+INT WM_MsgBox ( LPSTR, LPSTR, WORD, WORD );
+VOID WM_MultiTask ( VOID );
+INT RSM_StringLoad ( UINT, LPSTR, INT );
+INT RSM_Sprintf ( LPSTR, LPSTR, ... );
+BOOL RSM_BitmapDraw ( WORD, INT, INT, INT, INT, HDC );
+HBITMAP RSM_BitmapLoad ( WORD );
+BOOL RSM_GetBitmapSize ( WORD, LPINT, LPINT );
+VOID DrawBorder ( HDC, LPRECT, HPEN, HPEN );
+VOID DrawButtonUpBorder ( HDC, LPRECT );
+VOID DrawGroupBorder ( HDC, LPRECT );
+VOID DrawStatusBorder ( HDC, LPRECT );
+VOID DrawStatusRaisedBorder ( HDC, LPRECT );
+VOID DrawTileBorder ( HDC, LPRECT );
+INT ChiselText ( HDC, LPSTR, INT, LPRECT, UINT );
+VOID STM_Recessed3D ( HDC, LPRECT );
+
+#endif
diff --git a/private/utils/ntbackup/inc/int21.h b/private/utils/ntbackup/inc/int21.h
new file mode 100644
index 000000000..130eb2317
--- /dev/null
+++ b/private/utils/ntbackup/inc/int21.h
@@ -0,0 +1,23 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: int21.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This header file has the prototype for the INT21 handler
+ entry points.
+
+
+ $Log: G:/LOGFILES/INT21.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:31:34 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+INT16 GetFuncNum( VOID );
+VOID Init_INT21( VOID ) ;
+VOID Remove_INT21( VOID ) ;
diff --git a/private/utils/ntbackup/inc/ipx.h b/private/utils/ntbackup/inc/ipx.h
new file mode 100644
index 000000000..572fae356
--- /dev/null
+++ b/private/utils/ntbackup/inc/ipx.h
@@ -0,0 +1,125 @@
+/** :IH1: Copyright (C) Maynard Electronics, Inc. 1984-89
+
+ :Name: IPX.H
+
+ :Description: Header file for all IPX functions.
+
+
+ $Log: G:/LOGFILES/IPX.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:33:16 HUNTER
+ * Initial revision.
+
+
+$Log$
+
+ Rev 2.2 16 Jan 1991 08:53:22 JIMG
+ Use ScheduleIPXEvent
+
+ Rev 2.1 17 Dec 1990 10:19:30 JIMG
+ Fixed spelling error in function name
+
+ Rev 2.0 21 May 1990 14:02:22 PAT
+ Baseline Maynstream 3.1
+
+ Initial revision.
+**/
+
+#ifndef IPX
+#define IPX
+
+#pragma pack(1) /* force byte allignment */
+
+typedef struct IPX_NETWORK { UINT8 digits[4]; } IPX_NETWORK;
+typedef struct IPX_NODE { UINT8 digits[6]; } IPX_NODE;
+typedef struct IPX_SOCKET { UINT8 digits[2]; } IPX_SOCKET;
+
+typedef IPX_NETWORK far *IPX_NETWORK_PTR;
+
+typedef struct IPXAddress
+{
+ IPX_NETWORK network; /* high-low */
+ IPX_NODE node; /* high-low */
+ IPX_SOCKET socket; /* high-low */
+} IPXAddress;
+
+typedef IPXAddress far *IPXAddress_PTR;
+
+typedef struct IPXHeader
+{
+ UINT16 checkSum; /* high-low */
+ UINT16 length; /* high-low */
+ UINT8 transportControl;
+ UINT8 packetType; /* must initialize for send */
+ IPXAddress destination; /* must initialize for send */
+ IPXAddress source; /* ??? */
+} IPXHeader;
+
+typedef IPXHeader far *IPXHeader_PTR;
+
+typedef struct ECBFragment
+{
+ VOID far *address;
+ UINT16 size; /* low-high */
+} ECBFragment;
+
+typedef VOID (far *FAR_PF_VOID)();
+
+typedef struct ECB
+{
+ VOID far *linkAddress;
+ FAR_PF_VOID ESRAddress; /* must initialize */
+ UINT8 inUseFlag;
+ UINT8 completionCode;
+ UINT16 socketNumber; /* high-low, must initialize */
+ UINT8 IPXWorkspace[4];
+ UINT8 driverWorkspace[12];
+ IPX_NODE immediateAddress; /* high-low, must initialize for send */
+ UINT16 fragmentCount; /* low-high, must initialize */
+ ECBFragment fragmentDescriptor[1]; /* must initialize */
+} ECB;
+
+typedef ECB far *ECB_PTR;
+
+/* You must have at least one fragment for the IPXHeader. If you want */
+/* to break up the data into more fragments then you must declare an */
+/* ECB and as many additional fragments as you need in a single */
+/* structure. */
+/* */
+/* Example: typedef struct ECB3 { */
+/* ECB ecb; */
+/* ECBFragment fragmentDescriptor[2]; */
+/* } ECB3; */
+/* ECB3 foo; */
+/* You should refer to the last two fragments as */
+/* foo.ecb.fragmentDescriptor[1] and foo.ecb.fragmentDescriptor[2]. */
+
+BOOLEAN IPXInitialize( VOID );
+UINT8 IPXOpenSocket( UINT16 *socketNumber_ptr, UINT16 socketLongevity );
+VOID IPXSendPacket( ECB far *eventControlBlock_ptr );
+VOID IPXListenForPacket( ECB far *eventControlBlock_ptr );
+VOID IPXCloseSocket( UINT16 socketNumber );
+UINT8 IPXGetLocalTarget( IPXAddress far *networkAddress_ptr, VOID far *immediateAddress_ptr,
+ UINT16 far *transportTime_ptr );
+VOID IPXGetInternetworkAddress( IPXAddress far *networkAddress_ptr );
+VOID IPXScheduleIPXEvent( ECB far *eventControlBlock_ptr, UINT16 delay_time );
+UINT8 IPXCancelEvent( ECB far *eventControlBlock_ptr );
+UINT16 IPXGetIntervalMarker( VOID );
+VOID IPXRelinquishControl( VOID ) ;
+VOID LogIPXCall( UINT16 CallerID,ECB far *ecb_ptr ) ;
+
+#ifdef MSDEBUG
+#define IPXLog(x,y) LogIPXCall(x,y)
+#else
+#define IPXLog(x,y)
+#endif
+
+#define Hi(x) ((UINT8) ((x) >> 8 ))
+#define Lo(x) ((UINT8) ((x) & 0x00FF))
+#define Int16Swap(x) ( ( Lo(x) << 8 ) | Hi(x) )
+
+#define IPX_MAX_DATA_SIZE (576 - sizeof( IPXHeader ))
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/islecfg.h b/private/utils/ntbackup/inc/islecfg.h
new file mode 100644
index 000000000..a72c624ff
--- /dev/null
+++ b/private/utils/ntbackup/inc/islecfg.h
@@ -0,0 +1,7 @@
+#ifndef ISLECFG_RH
+
+#define ISLECFG_RH
+
+#define SES_ENG_ISLE 0
+
+#endif
diff --git a/private/utils/ntbackup/inc/job_new.h b/private/utils/ntbackup/inc/job_new.h
new file mode 100644
index 000000000..98d74c53d
--- /dev/null
+++ b/private/utils/ntbackup/inc/job_new.h
@@ -0,0 +1,15 @@
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_JOBNEW 8
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_J_COPTIONS 0x006A
+#define IDD_J_CJOBNAME 0x006C
+#define IDD_J_CSELECT 0x006E
+#define IDD_J_COPERATION 0x0070
+#define IDD_J_CADDTOPM 0x0071
+#define IDD_J_CMINIMIZE 0x0072
+
diff --git a/private/utils/ntbackup/inc/job_opts.h b/private/utils/ntbackup/inc/job_opts.h
new file mode 100644
index 000000000..7ace8dc58
--- /dev/null
+++ b/private/utils/ntbackup/inc/job_opts.h
@@ -0,0 +1,76 @@
+
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: job_opts.h
+
+ Description: Job options dialog ID header file.
+
+ $Log: G:/UI/LOGFILES/JOB_OPTS.H_V $
+
+ Rev 1.8 06 Jul 1993 09:48:44 chrish
+Cayman EPR 0452: Added the id IDD_J_JOBOPT_HWCOMP for supporting hardware
+compression
+
+ Rev 1.7 21 Jun 1993 11:00:40 CHUCKB
+Added define for drive name control.
+
+ Rev 1.6 04 Oct 1992 19:47:34 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.5 06 Apr 1992 09:53:52 CHUCKB
+Added define for translation.
+
+ Rev 1.4 19 Mar 1992 16:34:14 CHUCKB
+Added id for bindery checkbox.
+
+ Rev 1.3 27 Jan 1992 14:55:34 CHUCKB
+Updated id's.
+
+ Rev 1.2 27 Jan 1992 13:48:24 GLENN
+Fixed IDs
+
+ Rev 1.1 27 Jan 1992 12:50:38 GLENN
+Fixed dialog IDs.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_JOBOPTS 10
+#else
+#include "dlg_ids.h"
+#endif
+
+#ifndef _job_opts_h_
+
+#define _job_opts_h_
+
+#define IDD_J_JOBOPT_AUTOVERIFY 301
+#define IDD_J_JOBOPT_BACKFLAG 302
+#define IDD_J_JOBOPT_INCCATS 303
+#define IDD_J_JOBOPT_SKIPOPEN 304
+#define IDD_J_JOBOPT_LOGPRT 305
+#define IDD_J_JOBOPT_APPEND 307
+#define IDD_J_JOBOPT_REPLACE 308
+#define IDD_J_JOBOPT_USEPSWD 309
+#define IDD_J_JOBOPT_PSWD 310
+#define IDD_J_JOBOPT_TAPENAME 311
+#define IDD_J_JOBOPT_DESC 312
+#define IDD_J_JOBOPT_TAPEPROMPT 313
+#define IDD_J_JOBOPT_METHOD 314
+#define IDD_J_JOBOPT_DRIVENAME 315
+
+#define IDD_J_JOBOPT_NUMSECSBOX 0x0067
+#define IDD_J_JOBOPT_EJECT 0x0069
+#define IDD_J_JOBOPT_BINDERY 0x006A
+#define IDD_J_JOBOPT_SKIPYES 0x0076
+#define IDD_J_JOBOPT_SKIPNO 0x0077
+#define IDD_J_JOBOPT_SKIPWAIT 0x0078
+#define IDD_J_JOBOPT_NUMSECS 0x0079
+#define IDD_J_JOBOPT_PARTCAT 0x007A
+#define IDD_J_JOBOPT_FULLCAT 0x007B
+#define IDD_J_JOBOPT_HWCOMP 0x007C // chs:07-06-93
+
+#endif
diff --git a/private/utils/ntbackup/inc/jobs.h b/private/utils/ntbackup/inc/jobs.h
new file mode 100644
index 000000000..450585ae2
--- /dev/null
+++ b/private/utils/ntbackup/inc/jobs.h
@@ -0,0 +1,337 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: JOBS.H
+
+ Description: This header file contains prototypes for the
+ processing of JOB related operations.
+
+ $Log: G:\ui\logfiles\jobs.h_v $
+
+ Rev 1.26 10 Aug 1993 11:11:54 CHUCKB
+Took out prototype for JOB_GetDevice because we don't need it any more.
+
+ Rev 1.25 10 Aug 1993 10:35:08 TIMN
+Added disable wait define
+
+ Rev 1.24 05 Aug 1993 18:55:26 CHUCKB
+Added fields to struct for waiting for a device.
+
+ Rev 1.23 03 Aug 1993 21:06:50 CHUCKB
+Added prototype for JOB_GetDevice.
+
+ Rev 1.22 03 Aug 1993 16:38:08 CHUCKB
+Moved prototype for JOB_LogJob from job_strt.c to here.
+
+ Rev 1.21 02 Aug 1993 17:52:38 CHUCKB
+Added new struct and defines for wait-device dialog.
+
+ Rev 1.20 30 Jul 1993 10:48:50 CHUCKB
+Changed macro for SetTapePassword to use a length.
+
+ Rev 1.19 27 Jul 1993 22:15:40 CHUCKB
+Added field and macros for password length.
+
+ Rev 1.18 06 Jul 1993 09:49:30 chrish
+Cayman EPR 0452: Added two additional macros to support hardware compression
+for running a job.
+ Macros:
+ 1. JOB_GetHWCompression
+ 2. JOB_SetHWCompression
+
+ Added fhwcompression field to JOBREC structure to support hardware
+compression for running a job.
+
+
+
+ Rev 1.17 21 Jun 1993 10:47:26 CHUCKB
+Added field for device name, along with size defines and macros.
+
+ Rev 1.16 04 Oct 1992 19:47:28 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.15 22 Sep 1992 10:57:50 GLENN
+Added Job name ID, file name ID, method, append, verify, support to JOB_MakeAutoJob ().
+
+ Rev 1.14 18 Sep 1992 17:31:18 GLENN
+Changed the make auto jobs header.
+
+ Rev 1.13 06 Apr 1992 09:56:18 CHUCKB
+Added define for translation.
+
+ Rev 1.12 19 Mar 1992 16:33:46 CHUCKB
+Added bindery field to job structure and incremented job version number.
+
+ Rev 1.11 21 Feb 1992 16:10:08 CHUCKB
+Changed job record structure and macros for NT/MIPS.
+
+ Rev 1.10 12 Feb 1992 09:19:06 CHUCKB
+Changed job version number because job record structure changed (max file name len).
+
+ Rev 1.9 05 Feb 1992 09:00:02 CHUCKB
+Took out JOB_Error; it is no longer needed.
+
+ Rev 1.8 03 Feb 1992 16:58:48 CHUCKB
+Added prototype for JOB_Error().
+
+ Rev 1.7 24 Jan 1992 14:01:30 CHUCKB
+Put more dialogs on net.
+
+ Rev 1.6 15 Jan 1992 09:28:24 ROBG
+Added define for JOB_VER_NUM.
+
+ Rev 1.5 10 Jan 1992 19:19:32 CHUCKB
+Put in field/macros for eject tape option.
+
+ Rev 1.4 17 Dec 1991 17:49:24 CHUCKB
+No change.
+
+ Rev 1.3 10 Dec 1991 09:48:40 CHUCKB
+Fixed prototype for makeautojob.
+
+ Rev 1.2 09 Dec 1991 17:03:08 CHUCKB
+Added prototype for MakeAutoJob.
+
+ Rev 1.1 21 Nov 1991 17:30:16 DAVEV
+Changed function prototype of JOB_EnumPMGroupWindows for new portable
+definition of a callback procedure (must be APIENTRY and second parameter
+is a LONG).
+
+ Rev 1.0 20 Nov 1991 19:35:38 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef jobs_h
+
+#define jobs_h
+
+// defines for run jobs dialog
+
+#include "jobsetup.h"
+
+// defines for new jobs dialog
+
+#include "job_new.h"
+
+#define IDD_J_CSELTXT 204
+#define IDD_J_CUNATTEND 207
+
+// defines for job options dialog
+
+#include "job_opts.h"
+
+#define IDD_J_JOBOPT_UP 318
+#define IDD_J_JOBOPT_DOWN 319
+
+// defines for schedule jobs dialog
+
+#include "sch_opts.h"
+
+#define IDD_J_SQUEUE 401
+
+// defines for job schedule options
+
+#define IDD_NUMHOURS_UP 526
+#define IDD_NUMHOURS_DOWN 527
+#define IDD_NUMDATE_UP 528
+#define IDD_NUMDATE_DOWN 529
+
+#define IDD_J_SLAST 555
+
+#define IDD_J_SSHOWWKS 560
+#define IDD_J_SFIRST 561
+#define IDD_J_SSECOND 562
+#define IDD_J_STHIRD 563
+#define IDD_J_SFOURTH 564
+#define IDD_J_SNUMBER 573
+
+// Version of job records
+
+#define JOB_VER_NUM 4
+
+// job type/method defines
+
+#define JOBBACKUP 100
+#define JOBRESTORE 101
+#define JOBTRANSFER 102
+
+#define MAX_JOBNAME_LEN 32
+#define MAX_JOBNAME_SIZE 33
+#define MAX_DESC_LEN 60
+#define MAX_DESC_SIZE 61
+#define MAX_DEVICE_NAME_LEN 255
+#define MAX_DEVICE_NAME_SIZE MAX_DEVICE_NAME_LEN + 1
+#define JOB_NOTSCHEDULED (-1)
+
+/* Defines used when accessing the JOB and SCHEDULE files */
+
+#define FOPEN_ERR -1
+#define FREAD_ERR -2
+#define FWRITE_ERR -3
+#define FCLOSE_ERR -4
+
+// JOB STRUCTURE -- optimized for NT on MIPS
+
+typedef struct {
+
+ INT32 nOperType ; // Backup, transfer, etc.
+ INT32 fAddToPm ; // Add job to PM
+ INT32 fRunMinimized ; // Minimize on use
+ INT32 fAutoVerify ; // Autoverify oper
+ INT32 fSetArchiveBit ; // Set backup flag
+ INT32 fIncCats ; // Include cats in operations
+ INT32 fSkipOpen ; // Skip files in use
+ INT32 nWaitTime ; // # of seconds to wait for open files
+ INT32 fPrintLog ; // Print the log when done
+ INT32 fCatalogLevel ; // Enable full cataloging
+ INT32 fAppend ; // Append or overwrite tape
+ INT32 fPassword ; // Password protect tapes
+ INT32 nMethod ; // backup method (inc., dif., norm., copy)
+ INT32 fEjectTape ; // True if eject tape on exit
+ INT32 fBackupBindery ; // True if bindery files are to be backed up
+ INT32 fhwcompression; // chs: 07-06-93 True if to enable HW compression
+ INT32 nPasswordLen ; // Length of password (it might have nulls in it)
+
+ // Name of the tape to create
+ TCHAR szTapeName[MAX_TAPE_NAME_SIZE+4-((MAX_TAPE_NAME_SIZE)%4)] ;
+ // Password for the tape
+ TCHAR szTapePassword[MAX_TAPE_PASSWORD_SIZE+4-((MAX_TAPE_PASSWORD_SIZE)%4)] ;
+ // Name of this job
+ TCHAR szJobName[MAX_JOBNAME_SIZE+4-((MAX_JOBNAME_SIZE)%4)];
+ // Name of selection file
+ TCHAR szSelectName[MAX_UI_FILENAME_SIZE+4-((MAX_UI_FILENAME_SIZE)%4)] ;
+ // Name of tape device
+ TCHAR szDeviceName[MAX_DEVICE_NAME_SIZE*sizeof(TCHAR)] ;
+
+ Q_ELEM pQElem ;
+
+} JOBREC, *JOBREC_PTR ;
+
+// The following structure is used by the error dialog for the case when
+// a drive is requested, but either doesn't exist any more or is already
+// in use.
+
+#ifdef OS_WIN32
+
+typedef struct {
+
+ LPSTR lpszDriveName; // Name of a drive to wait for
+ INT nDlgType ; // Type of dialog (see below)
+ PF_VOID pfnCallBack ; // Pointer to function to claim drive
+ INT nWaitTime ; // Num of seconds to wait between tries
+ INT nDevNum ; // Device number (lun) from registry
+ HANDLE hDrive ; // Handle for nDevNum (returned from pfnCallBack)
+
+} WAITDEV, *WAITDEV_PTR ;
+
+// WaitDevice dialog types
+
+#define WAITDEV_INVALID_JOB 1 // not used
+#define WAITDEV_INVALID_NOTJOB 2 // device name is invalid
+#define WAITDEV_NOTAVAIL_WAIT 3 // device conflict; wait to claim it
+#define WAITDEV_NOTAVAIL 4 // device conflict; just notify user
+
+#define WAITDEV_DISABLEWAIT -1 // stored in nWaitTime to display msg
+ // without waiting
+
+#endif
+
+// JOB MACROS
+
+#define JOB_GetJobName( x ) ( (x)->szJobName )
+#define JOB_SetJobName( x, y ) ( lstrcpy ( (x)->szJobName, (y) ) )
+
+#define JOB_GetSelectName( x ) ( (x)->szSelectName )
+#define JOB_SetSelectName( x, y ) ( lstrcpy ( (x)->szSelectName, (y) ) )
+
+#define JOB_GetOperType( x ) ( (INT)(x)->nOperType )
+#define JOB_SetOperType( x, y ) ( (x)->nOperType = (INT32)(y) )
+
+#define JOB_GetAddToPm( x ) ( (BOOL)(x)->fAddToPm )
+#define JOB_SetAddToPm( x, y ) ( (x)->fAddToPm = (INT32)(y) )
+
+#define JOB_GetRunMinimized( x ) ( (BOOL)(x)->fRunMinimized )
+#define JOB_SetRunMinimized( x, y ) ( (x)->fRunMinimized = (INT32)(y) )
+
+#define JOB_GetAutoVerify( x ) ( (BOOL)(x)->fAutoVerify )
+#define JOB_SetAutoVerify( x, y ) ( (x)->fAutoVerify = (INT32)(y) )
+
+#define JOB_GetSetArchiveBit( x ) ( (BOOL)(x)->fSetArchiveBit )
+#define JOB_SetSetArchiveBit( x, y ) ( (x)->fSetArchiveBit = (INT32)(y) )
+
+#define JOB_GetIncCats( x ) ( (BOOL)(x)->fIncCats )
+#define JOB_SetIncCats( x, y ) ( (x)->fIncCats = (INT32)(y) )
+
+#define JOB_GetSkipOpen( x ) ( (BOOL)(x)->fSkipOpen )
+#define JOB_SetSkipOpen( x, y ) ( (x)->fSkipOpen = (INT32)(y) )
+
+#define JOB_GetWaitTime( x ) ( (INT)(x)->nWaitTime )
+#define JOB_SetWaitTime( x, y ) ( (x)->nWaitTime = (INT32)(y) )
+
+#define JOB_GetPrintLog( x ) ( (BOOL)(x)->fPrintLog )
+#define JOB_SetPrintLog( x, y ) ( (x)->fPrintLog = (INT32)(y) )
+
+#define JOB_GetCatalogLevel( x ) ( (BOOL)(x)->fCatalogLevel )
+#define JOB_SetCatalogLevel( x, y ) ( (x)->fCatalogLevel = (INT32)(y) )
+
+#define JOB_GetAppend( x ) ( (BOOL)(x)->fAppend )
+#define JOB_SetAppend( x, y ) ( (x)->fAppend = (INT32)(y) )
+
+#define JOB_GetPassword( x ) ( (BOOL)(x)->fPassword )
+#define JOB_SetPassword( x, y ) ( (x)->fPassword = (INT32)(y) )
+
+#define JOB_GetMethod( x ) ( (INT)(x)->nMethod )
+#define JOB_SetMethod( x, y ) ( (x)->nMethod = (INT32)(y) )
+
+#define JOB_GetTapeName( x ) ( (x)->szTapeName )
+#define JOB_SetTapeName( x, y ) ( lstrcpy ( (x)->szTapeName, (y) ) )
+
+#define JOB_GetTapePassword( x ) ( (x)->szTapePassword )
+#define JOB_SetTapePassword( x, y, z) ( memmove ( (x)->szTapePassword, (y), (z) ) )
+
+#define JOB_GetEjectTape( x ) ( (BOOL)(x)->fEjectTape )
+#define JOB_SetEjectTape( x, y ) ( (x)->fEjectTape = (INT32)(y) )
+
+#define JOB_GetBackupBindery( x ) ( (BOOL)(x)->fBackupBindery )
+#define JOB_SetBackupBindery( x, y ) ( (x)->fBackupBindery = (INT32)(y) )
+
+#define JOB_GetDeviceName( x ) ( (x)->szDeviceName )
+#define JOB_SetDeviceName( x, y ) ( lstrcpy ( (x)->szDeviceName, (y) ) )
+
+#define JOB_GetHWCompression( x ) ( (BOOL)(x)->fhwcompression ) // chs:07-06-93
+#define JOB_SetHWCompression( x, y ) ( (x)->fhwcompression = (INT32)(y) ) // chs:07-06-93
+
+#define JOB_GetPasswordLen( x ) ( (x)->nPasswordLen )
+#define JOB_SetPasswordLen( x, y ) ( (x)->nPasswordLen = (INT32)(y) )
+
+
+// JOB PROTOTYPES
+
+BOOL JOB_AnyJobFiles ( VOID ) ;
+VOID JOB_DeInitQueue ( VOID ) ;
+VOID JOB_EnQueueJob ( JOBREC_PTR ) ;
+JOBREC_PTR JOB_FindByIndex ( INT ) ;
+JOBREC_PTR JOB_FindJob ( LPSTR ) ;
+INT JOB_GetCount ( VOID ) ;
+VOID_PTR JOB_GetFirstItem ( Q_HEADER_PTR ) ;
+VOID_PTR JOB_GetNext ( VOID_PTR, LPSTR ) ;
+VOID_PTR JOB_GetNextItem ( JOBREC_PTR ) ;
+JOBREC_PTR JOB_GetNextJob ( JOBREC_PTR ) ;
+JOBREC_PTR JOB_InitJob ( VOID ) ;
+VOID JOB_InitQueue ( VOID ) ;
+BOOL JOB_IsIconic ( LPSTR ) ;
+VOID JOB_LogJob ( LPSTR, WORD ); // FALSE if end of execution
+VOID JOB_MakeAutoJob ( INT, INT, INT, INT, BOOL, BOOL ) ;
+INT JOB_ReadList ( VOID ) ;
+VOID JOB_Refresh ( VOID ) ;
+VOID JOB_Remove ( LPSTR ) ;
+INT JOB_SaveList ( VOID ) ;
+BOOL JOB_StartJob ( LPSTR, INT ) ;
+
+BOOL APIENTRY JOB_EnumPMGroupWindows ( HWND, LONG ) ;
+BOOL JOB_AddToProgmanWindow ( HWND, LPSTR, LPSTR ) ;
+BOOL JOB_BuildJobQueue ( Q_HEADER_PTR ) ;
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/jobsetup.h b/private/utils/ntbackup/inc/jobsetup.h
new file mode 100644
index 000000000..cd3418d1c
--- /dev/null
+++ b/private/utils/ntbackup/inc/jobsetup.h
@@ -0,0 +1,15 @@
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_JOBMAINTENANCE 9
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_J_JOBLIST 0x0065
+#define IDD_J_NEW 0x0067
+#define IDD_J_EDIT 0x0068
+#define IDD_J_DEL 0x0069
+#define IDD_J_RUN 0x006A
+#define IDD_J_SCH 0x006C
+
diff --git a/private/utils/ntbackup/inc/jobstat.h b/private/utils/ntbackup/inc/jobstat.h
new file mode 100644
index 000000000..1c47239b4
--- /dev/null
+++ b/private/utils/ntbackup/inc/jobstat.h
@@ -0,0 +1,108 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: jobstat.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/JOBSTAT.H_V $
+
+ Rev 1.12 10 May 1993 18:22:50 GLENN
+Added JS_OkToClose() prototype to see if the Runtime Status Dialog is OK to close.
+
+ Rev 1.11 18 Jan 1993 14:48:26 GLENN
+Added JS_ReportStreamError.
+
+ Rev 1.10 30 Oct 1992 17:56:24 MIKEP
+started small catalog window
+
+ Rev 1.9 04 Oct 1992 19:47:32 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.8 30 Jul 1992 09:50:50 STEVEN
+fix warnings
+
+ Rev 1.7 20 Jul 1992 10:01:48 JOHNWT
+added gas gauge display
+
+ Rev 1.6 17 Mar 1992 16:53:36 CARLS
+added ID for ABORT_CHECK
+
+ Rev 1.5 20 Feb 1992 14:45:50 CARLS
+added IDs for new abort function
+
+ Rev 1.4 20 Dec 1991 17:05:24 JOHNWT
+returned CREATE_DIALOG
+
+ Rev 1.3 19 Dec 1991 09:59:18 JOHNWT
+Changes for app-modal RTD
+
+ Rev 1.2 09 Dec 1991 17:45:46 JOHNWT
+removed yprompt, YesNoDialogText, RunTimeMessageBox prototypes
+
+ Rev 1.1 06 Dec 1991 09:37:56 CARLS
+added define for catalog title
+
+ Rev 1.0 20 Nov 1991 19:35:28 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _jobstat_h_
+#define _jobstat_h_
+
+#define JOB_STATUS_CREATE_DIALOG ((WORD)1)
+#define JOB_STATUS_DESTROY_DIALOG ((WORD)2)
+#define JOB_STATUS_DIRECTORY_NAMES ((WORD)3)
+#define JOB_STATUS_ELAPSED_TIME ((WORD)4)
+#define JOB_STATUS_FILES_PROCESSED ((WORD)5)
+#define JOB_STATUS_BYTES_PROCESSED ((WORD)6)
+#define JOB_STATUS_VOLUMN_NAME ((WORD)7)
+#define JOB_STATUS_VOLUME_NAME ((WORD)7)
+#define JOB_STATUS_EXCEPTION_WINDOW ((WORD)8)
+#define JOB_STATUS_DIRECTORIES_PROCESS ((WORD)9)
+#define JOB_STATUS_SKIPPED_FILES ((WORD)10)
+#define JOB_STATUS_CORRUPT_FILES ((WORD)11)
+#define JOB_STATUS_FILE_NAMES ((WORD)12)
+#define JOB_STATUS_LISTBOX ((WORD)13)
+#define JOB_STATUS_ABORT_OFF ((WORD)14)
+#define JOB_STATUS_ABORT_ON ((WORD)15)
+#define JOB_STATUS_BACKUP_TITLE ((WORD)16)
+#define JOB_STATUS_RESTORE_TITLE ((WORD)17)
+#define JOB_STATUS_VERIFY_TITLE ((WORD)18)
+#define JOB_STATUS_VOLUME_HARDDRIVE ((WORD)19)
+#define JOB_STATUS_VOLUME_NETDRIVE ((WORD)20)
+#define JOB_STATUS_VOLUME_TAPE ((WORD)21)
+#define JOB_STATUS_SOURCE_NAME ((WORD)22)
+#define JOB_STATUS_DEST_NAME ((WORD)23)
+#define JOB_STATUS_N_OF_N ((WORD)24)
+#define JOB_STATUS_ABORT ((WORD)25)
+#define JOB_STATUS_CATALOG_TITLE ((WORD)26)
+#define JOB_STATUS_ABORT_ENABLE ((WORD)27)
+#define JOB_STATUS_ABORT_DISABLE ((WORD)28)
+#define JOB_STATUS_ABORT_CHECK ((WORD)29)
+#define JOB_STATUS_CREATE_SMALL_DIALOG ((WORD)30)
+#define JOB_STATUS_FS_TYPE ((WORD)31)
+
+#define JOB_TENSION_CREATE_DIALOG ((WORD)1)
+#define JOB_TENSION_DESTROY_DIALOG ((WORD)2)
+#define JOB_TENSION_LISTBOX ((WORD)3)
+#define JOB_TENSION_ABORT_OFF ((WORD)4)
+#define JOB_TENSION_ABORT_ON ((WORD)5)
+#define JOB_TENSION_DRAW_BITMAP ((WORD)6)
+#define JOB_TENSION_ERASE_TITLE ((WORD)7)
+#define JOB_TENSION_TENSION_TITLE ((WORD)8)
+
+/*
+ Prototypes
+*/
+VOID JobStatusTension(WORD);
+VOID JobStatusBackupRestore(WORD);
+VOID JobStatusAbort(VOID *);
+VOID JobStatusStats(UINT64);
+BOOL JS_OkToClose ( VOID );
+VOID JS_ReportStreamError ( FSYS_HAND, GENERIC_DLE_PTR, UINT32, WORD, INT16, DBLK_PTR, DBLK_PTR );
+
+#endif
diff --git a/private/utils/ntbackup/inc/keys.h b/private/utils/ntbackup/inc/keys.h
new file mode 100644
index 000000000..35b7412f3
--- /dev/null
+++ b/private/utils/ntbackup/inc/keys.h
@@ -0,0 +1,37 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: keys.h
+
+ Description: This file contains the ACCELERATOR KEY IDs and
+ miscellaneous key IDs for the Maynstream GUI project.
+
+ $Log: G:/UI/LOGFILES/KEYS.H_V $
+
+ Rev 1.2 04 Oct 1992 19:47:36 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 03 Dec 1991 16:04:52 GLENN
+Remove old ribbon accel keys - no longer used. Added some Virtual Keys.
+
+ Rev 1.0 20 Nov 1991 19:37:06 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef _KEYS_H
+#define _KEYS_H
+
+// WINDOWS ACCELERATOR KEY ID's
+
+#define IDRA_ACCKEYS ID(1)
+
+
+#define VK_8 0x38
+#define VK_OEM_PLUS 0xBB
+#define VK_OEM_MINUS 0xBD
+
+#endif
diff --git a/private/utils/ntbackup/inc/launcher.h b/private/utils/ntbackup/inc/launcher.h
new file mode 100644
index 000000000..5c911308b
--- /dev/null
+++ b/private/utils/ntbackup/inc/launcher.h
@@ -0,0 +1,197 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+RCG
+ Name: LAUNCHER.H
+
+ Description: This header file contains prototypes for the
+ launcher.
+
+ $Log: G:/UI/LOGFILES/LAUNCHER.H_V $
+
+ Rev 1.18 30 Jul 1993 15:16:28 chrish
+Made change such that there is a maximum and minimum delay time for launcher.
+
+ Rev 1.17 16 Jun 1993 15:08:12 MIKEP
+change types to match global.c again
+
+ Rev 1.16 18 Feb 1993 15:14:38 chrish
+Added stuff for CAYMAN.
+
+ Rev 1.15 04 Oct 1992 19:47:38 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.14 06 Apr 1992 12:26:04 JOHNWT
+added gfTerminateApp
+
+ Rev 1.13 23 Mar 1992 12:33:22 JOHNWT
+added RSM_Sprintf prototype
+
+ Rev 1.12 16 Mar 1992 15:37:50 JOHNWT
+various changes
+
+ Rev 1.11 20 Feb 1992 16:19:40 JOHNWT
+added TempCDS
+
+ Rev 1.10 13 Feb 1992 08:15:42 JOHNWT
+globals change
+
+ Rev 1.9 07 Feb 1992 16:54:22 ROBG
+Changes.
+
+ Rev 1.8 07 Feb 1992 10:15:56 ROBG
+Release after Code Review.
+
+ Rev 1.7 30 Jan 1992 15:55:26 ROBG
+Final Release.
+
+ Rev 1.6 29 Jan 1992 14:59:06 ROBG
+Added logic to support scheduled delays.
+
+ Rev 1.5 23 Jan 1992 11:02:02 ROBG
+chkin for Rob
+
+ Rev 1.4 03 Jan 1992 15:19:54 ROBG
+Final Release before alpha.
+
+ Rev 1.3 30 Dec 1991 16:03:26 ROBG
+minor changes.
+
+ Rev 1.2 13 Dec 1991 10:43:18 ROBG
+Modified to relect JOB and SCHEDULE queues.
+
+ Rev 1.0 14 Oct 1991 14:15:26 ROBG
+Initial revision.
+
+****************************************************************************/
+
+#ifndef LAUNCHER_H
+
+#include <time.h>
+
+#define LAUNCHER_H
+
+// Configuration defines found only in muiconf.c
+
+//#define CDS_SkipBlanks(x) ( for( ; *x == ' '; x ++ ) )
+
+#define WM_ASKTORUN (WM_USER+209) // Used by Launcher only
+#define WM_ASKTOSCHEDULE (WM_USER+210) // Used by Launcher only
+
+// Launcher error codes
+
+#define LCH_ERRREGCLASS 100
+#define LCH_ERRTIMERINIT 101
+
+// Size of file mapped object shared between the Launcher and the
+// backup application.
+
+#define MAPOBJECTSIZE 255
+
+// Timeout value in the delay and run dialogs is LOBYTE of CMS_LAUNCHERFLAG.
+// chs:07-30-93 #define WAIT_FOR_X_SECONDS ( gwLauncherFlag & 0x00ff )
+
+#define LCH_MAX_WAIT_TIME 999
+#define LCH_MIN_WAIT_TIME 0
+
+#define WAIT_FOR_X_SECONDS ( ( gwLauncherFlag > LCH_MAX_WAIT_TIME ) || ( gwLauncherFlag < LCH_MIN_WAIT_TIME ) ? LCH_MAX_WAIT_TIME : gwLauncherFlag ) // chs:07-30-93
+
+
+// Globals
+
+extern Q_HEADER_PTR mwSchedQueue ; // Queue header of the launcher's list
+ // of jobs scheduled.
+
+extern CHAR gb_data_path [ MAX_UI_PATH_SIZE + MAX_UI_FILENAME_SIZE ] ; // Data Path directory.
+extern CHAR gb_exe_path [ MAX_UI_PATH_SIZE + MAX_UI_FILENAME_SIZE ] ; // Executable directory.
+extern CHAR gszWindowName [ MAX_UI_RESOURCE_SIZE ] ;
+extern CHAR gszClassName [ MAX_UI_RESOURCE_SIZE ] ;
+extern CHAR gszHelpFileName [ MAX_UI_PATH_SIZE + MAX_UI_FILENAME_SIZE ] ;
+extern CHAR gszRunningJobName [ MAX_UI_RESOURCE_SIZE ] ;
+
+extern INT16 gwLauncherFlag ; // Launcher Flag found in MAYNARD.INI.
+extern INT16 gnNumScheds ; // Number of current scheduled jobs.
+extern INT16 gnNumJobs; // Number of current jobs.
+extern HINSTANCE ghInst ; // Instance handle.
+extern HINSTANCE ghResInst ; // Instance handle of resources. (same as ghInst )
+extern HWND ghModelessDialog ; // Handle used to show a dialog.
+extern HANDLE ghAccel; // define it to resolve muiutil ref
+extern HWND ghWndMDIClient; // define it to resolve muiutil ref
+extern HWND ghWndFrame ; // Handle of main window handle. (Set to hidden ).
+extern HWND ghDlg ; // Handle of main dialog.
+extern HWND ghwndLastFocus ; // Handle of control with focus
+extern BOOL gfDlgProcComplete ; // Flag used to check if processing in a dialog is occurring.
+extern BOOL gfTimerProcessing ; // Flag used to keep timer processing in sync.
+extern INT16 gnModalDlgTimerValue ; // Value of the main timer.
+extern INT16 gnRunSchedIndex ; // Index into schedule table of running job.
+extern LONG glRunSchedKey ; // Key of running job.
+extern INT16 gnDelayJobIndex ; // Index into schedule table of delayed job.
+extern BYTE gbDelayMinutes ; // Delay Minutes.
+extern BYTE gbDelayHours ; // Delay Hours.
+
+#ifndef CAYMAN
+ extern HANDLE ghMainTimer ; // Handle of main watchdog timer.
+#else
+ extern HTIMER ghMainTimer ; // Handle of main watchdog timer.
+#endif
+
+extern INT gnRunJobIndex ; // Index of running job.
+extern BOOL gfMissedJobs ; // Flag indicating whether jobs were missed.
+extern BOOL gfAskedOnce ; // Flag indicating whether the user has been asked
+ // about closing Winback to run a scheduled job.
+extern BOOL gfDebug; // if /Z was specified
+extern BOOL gfCodeView; // if /CV was specified
+extern BOOL gfCVTwoMonitors; // if /2 was specified
+
+extern LONG glStartTime ; // Time the launcher began in time_t form.
+extern struct tm gtmStartTime ; // Time the launcher began in tm form.
+extern LONG glEndTimeOfJob ; // Time when last job terminated in time_t form.
+
+extern BOOL gfTerminateApp ; // Needed to resolve external ref
+extern CDS PermCDS ; // Needed to resolve external references and structures.
+extern CDS TempCDS ; // Needed to resolve external references and structures.
+extern BE_CFG PermBEC ; // Needed to resolve external references and structures.
+
+#ifdef CAYMAN
+ extern CHAR_PTR gbMappedObjName; // Name of mapping object
+ extern LPVOID gbMappedObjBuffer; // Global mapped object buffer
+#endif
+
+// Prototypes
+
+WINRESULT APIENTRY LauncherWndProc (HWND hWnd, MSGID wMsg, MP1 wParam, MP2 lParam ) ; // chs: 02-18-93
+DLGRESULT APIENTRY LCH_LaunchDlg (HWND hdlg, MSGID wMsg, MP1 wParam, MP2 lParam ) ; // chs: 02-18-93
+DLGRESULT APIENTRY LCH_DelayValuesDlg (HWND hdlg, MSGID wMsg, MP1 wParam, MP2 lParam ) ; // chs: 02-18-93
+WINRESULT APIENTRY LCH_SetFocus (HWND hWnd, MSGID wMsg, MP1 wParam, MP2 lParam ) ; // chs: 02-18-93
+
+WORD LCH_Init ( void ) ;
+VOID LCH_Deinit ( void ) ;
+VOID LCH_SetMaynFolder ( void ) ;
+VOID LCH_GetTimeDateString( TIME_PTR time_struct , CHAR_PTR buffer , INT16 show_Wday ) ;
+
+
+BOOLEAN LCH_TimeToRun ( SCHEDREC_PTR pRec , BOOLEAN bInit ) ;
+VOID LCH_ProcessQueue( void ) ;
+VOID LCH_UpdateQueue ( HWND hdlg ) ;
+VOID LCH_BuildDisplayString ( CHAR_PTR buffer, SCHEDREC_PTR pSchedRec, INT nIndex ) ;
+VOID LCH_LaunchJob ( WORD wIndex ) ;
+BOOL LCH_IsWinterParkRunning( void ) ;
+VOID LCH_InitCDS ( VOID ) ;
+VOID LCH_DeInitCDS ( VOID ) ;
+VOID LCH_TimerForModalDlgs ( VOID ) ;
+VOID LCH_UpdateDialogTime ( void ) ;
+VOID LCH_LookAtQueue( void ) ;
+VOID LCH_SetNoJobsRunning( void ) ;
+BOOL LCH_AJobIsRunning( void ) ;
+VOID LCH_SortScheduleQueue ( void ) ;
+INT16 LCH_ItemCompare( Q_ELEM_PTR pLogElem1, Q_ELEM_PTR pLogElem2 ) ;
+VOID LCH_ProcessSkip( SCHEDREC_PTR pSchedRec ) ;
+VOID LCH_ProcessHold( SCHEDREC_PTR pSchedRec ) ;
+VOID LCH_EnableCorrectButtons ( VOID ) ;
+
+INT WM_MsgBox ( LPSTR lpszTitle, LPSTR lpszMessage, WORD wType, WORD wIcon );
+INT RSM_StringLoad ( VOID_PTR pID, LPSTR lpBuffer, INT nBufferMax ) ;
+VOID HH_WinHelp ( HWND hWnd, WORD wCommand, DWORD dwData ) ;
+INT RSM_Sprintf ( LPSTR, LPSTR, ... );
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/ld_dvr.h b/private/utils/ntbackup/inc/ld_dvr.h
new file mode 100644
index 000000000..ff90d83dd
--- /dev/null
+++ b/private/utils/ntbackup/inc/ld_dvr.h
@@ -0,0 +1,26 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ld_dvr.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Function prototypes for load driver unit
+
+ Location: BE_PRIVATE
+
+
+ $log$
+
+**/
+
+#ifndef _lddvr_
+#define _lddvr_
+
+typedef UINT16 (*DRIVERHANDLE)() ;
+
+UINT8_PTR DriverLoad( CHAR_PTR,DRIVERHANDLE *,VOID_PTR,UINT16 ) ;
+VOID DriverUnLoad( UINT8_PTR ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/ldialogs.h b/private/utils/ntbackup/inc/ldialogs.h
new file mode 100644
index 000000000..39b874b7e
--- /dev/null
+++ b/private/utils/ntbackup/inc/ldialogs.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: LDIALOGS.H
+
+ Description: This header file contains the dialog and icons
+ IDs for the launcher's dialogs.
+
+ $Log: G:/UI/LOGFILES/LDIALOGS.H_V $
+
+ Rev 1.6 03 Mar 1993 10:21:16 chrish
+Put back #define launcher 114 and #ifdef for CAYMAN NT.
+
+ Rev 1.5 18 Feb 1993 15:18:34 chrish
+Added #define IDRI_LAUNCHER for CAYMAN
+
+ Rev 1.4 04 Oct 1992 19:47:40 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 30 Mar 1992 15:19:04 JOHNWT
+DLL res conversion
+
+ Rev 1.2 12 Feb 1992 13:31:44 ROBG
+Deleted IDD_LCH_ACTIVEJOB and IDD_LCH_LB1RIGHT.
+
+ Rev 1.1 13 Dec 1991 10:44:38 ROBG
+Modified to reflect JOB and SCHEDULE queues.
+
+ Rev 1.0 14 Oct 1991 14:14:56 ROBG
+Initial revision.
+
+
+****************************************************************************/
+
+#ifndef ldialogs_h
+#define ldialogs_h
+
+#define IDD_LCHRUNJOB 90
+#define IDD_LCHSCHEDULE 91
+
+#define IDD_LCH_SCHEDULE 101
+
+#define IDD_LCH_JOBNAME 110
+#define IDD_LCH_HOURS 111
+#define IDD_LCH_MINUTES 112
+
+#define IDD_LCH_TIMECNT 118
+
+#define IDD_LCH_NODELAY 130
+#define IDD_LCH_SCHDELAY 131
+#define IDD_LCH_PUTONHOLD 132
+
+#define IDD_LCH_HOLDBUTTON 108
+#define IDD_LCH_UNHOLDBUTTON 115
+#define IDD_LCH_EMPTYQUEUE 102
+#define IDD_LCH_LABELSTATUS 140
+#define IDD_LCH_LABELSCRIPT 104
+#define IDD_LCH_LABELNEXTDATE 142
+#define IDD_LCH_HELPBUTTON 106
+#define IDD_LCH_SKIPBUTTON 107
+
+#ifdef CAYMAN // chs: 03-03-93
+ #define IDRI_LAUNCHER 114 // chs: 03-03-93
+#else // chs: 03-03-93
+ #define launcher 114 // chs: 03-03-93
+#endif // chs: 03-03-93
+
+#define IDD_LCHCURTIME 116
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/lis.h b/private/utils/ntbackup/inc/lis.h
new file mode 100644
index 000000000..ef6099e00
--- /dev/null
+++ b/private/utils/ntbackup/inc/lis.h
@@ -0,0 +1,94 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lis.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+
+ $Log: N:/LOGFILES/LIS.H_V $
+ *
+ * Rev 1.7 09 Jun 1993 15:22:40 MIKEP
+ * enable c++
+ *
+ * Rev 1.6 23 Mar 1992 14:25:52 GREGG
+ * Added BOOLEAN rewind_sdrv to GETVCB structure.
+ *
+ * Rev 1.5 07 Nov 1991 14:14:36 GREGG
+ * BIGWHEEL - 8200sx - Removed cat_enabled boolean from lis struct.
+ * Note: A re-design eliminated the need for the 1.4 change. However, v1.4
+ * was released for public consumption (first release of BigWheel) a.d must,
+ * therefore, remain in the logfile.
+ *
+ * Rev 1.4 07 Nov 1991 14:08:12 GREGG
+ * BIGWHEEL - 8200sx - Added cat_enabled boolean to lis struct.
+ *
+ * Rev 1.3 21 Jun 1991 08:43:42 STEVEN
+ * new config unit
+ *
+ * Rev 1.2 07 Jun 1991 09:01:34 JOHNW
+ * Moved typedef of TPOS_HANDLER to tpos.h
+ *
+ * Rev 1.1 24 May 1991 14:59:46 STEVEN
+ * removed un-necessary entries from the lis structure
+ *
+ * Rev 1.0 09 May 1991 13:31:52 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _lis_h_
+#define _lis_h_
+
+#include "fsys.h"
+#include "bsdu.h"
+#include "tpos.h"
+#include "abort.h"
+
+typedef INT16 ( *MSG_HANDLER )( UINT16 msg, INT32 pid, BSD_PTR bsd_ptr, FSYS_HAND fsh, TPOS_PTR tpos, ... ) ;
+
+/* Macros for Abort Flag */
+
+#define LP_GetAbortFlag( lis_ptr ) ( *((lis_ptr)->abort_flag_ptr) )
+#define LP_SetAbortFlag( lis_ptr , v ) ( *((lis_ptr)->abort_flag_ptr) = v )
+#define LP_AbortFlagIsSet( lis_ptr ) ( *((lis_ptr)->abort_flag_ptr) != CONTINUE_PROCESSING )
+
+typedef struct LIS *LIS_PTR;
+typedef struct LIS {
+ TPOS_HANDLER tape_pos_handler ;
+ MSG_HANDLER message_handler ;
+ VOID_PTR ui_cfg_ptr ; /* user interface config */
+ INT16 oper_type ; /* current operation type */
+ INT16 mode ; /* this is passed back to the message handler */
+ UINT32 pid ; /* this is passed back to the message handler */
+ BOOLEAN auto_det_sdrv ; /* indicator for whether to auto-determine starting tape drive */
+
+ BSD_PTR curr_bsd_ptr ; /* set by the loops for the user interface tape positioning routine */
+ INT8_PTR abort_flag_ptr ; /* address of the global abort flag */
+ struct VM_STR *vmem_hand ; /* space for temporary file. e.g. Virtual Memory */
+ struct BSD_LIST *bsd_list; /* copy of bsd_list for tools to use */
+} LIS ;
+
+
+/*
+ LP_GetVCB interface structure
+*/
+
+
+typedef struct GETVCB *GETVCB_PTR;
+typedef struct GETVCB {
+ UINT32 tape_fid ; /* input */
+ UINT16 tape_seq_num ; /* input */
+ UINT16 backup_set_num ; /* input */
+ struct BE_CFG *cfg ; /* input */
+ FSYS_HAND fsys_handle ;
+ BOOLEAN rewind_sdrv ;
+} GETVCB;
+
+#endif
diff --git a/private/utils/ntbackup/inc/log.h b/private/utils/ntbackup/inc/log.h
new file mode 100644
index 000000000..ccc8ddef6
--- /dev/null
+++ b/private/utils/ntbackup/inc/log.h
@@ -0,0 +1,335 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: log.h
+
+ Description: This file contains the structures, definitions, macros,
+ and function prototypes for the Maynstream GUI
+ Log File Manager (LOG).
+
+ $Log: G:/UI/LOGFILES/LOG.H_V $
+
+ Rev 1.18 04 Jun 1993 10:16:46 DARRYLP
+Upped our viewable log limit to 65530.
+
+ Rev 1.17 02 May 1993 16:55:08 MIKEP
+add call to support log files base name changing.
+
+ Rev 1.16 29 Mar 1993 11:03:02 TIMN
+Added protos for getting only the catalog path or filename
+
+ Rev 1.15 14 Jan 1993 16:23:22 DAVEV
+chg LPLONG to INT32_PTR
+
+ Rev 1.14 01 Nov 1992 16:31:08 DAVEV
+Unicode changes
+
+ Rev 1.13 04 Oct 1992 19:47:42 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.12 28 Jul 1992 14:56:48 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.11 09 Mar 1992 14:08:10 ROBG
+changed
+
+ Rev 1.10 09 Mar 1992 13:49:46 ROBG
+changed
+
+ Rev 1.9 09 Mar 1992 10:46:06 ROBG
+added LOG_NUMHEADERLINES
+
+ Rev 1.8 09 Mar 1992 09:12:42 ROBG
+added LOG_Clearblocks
+
+ Rev 1.7 06 Mar 1992 16:32:14 ROBG
+changed
+
+ Rev 1.6 02 Mar 1992 10:46:36 ROBG
+changed
+
+ Rev 1.5 02 Mar 1992 10:44:14 ROBG
+unchanged
+
+ Rev 1.4 25 Feb 1992 21:47:54 GLENN
+Added LOG_SetCurrentLogName().
+
+ Rev 1.3 21 Feb 1992 15:02:36 ROBG
+More changes
+
+ Rev 1.2 13 Jan 1992 09:51:54 ROBG
+Deleted LOG_PREFIX and LOG_EXTENSION.
+
+ Rev 1.1 05 Dec 1991 17:33:34 GLENN
+Added deinit code
+
+ Rev 1.0 20 Nov 1991 19:38:26 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef _LOG_H
+
+#define _LOG_H
+
+#define NUM_DEST_TYPES 5
+
+#define LOG_MAXLOGFILES 100
+#define LOG_FILEEXISTS 0
+#define LOG_NUMHEADERLINES 4
+#define LOG_MAXRECS 65530
+
+#define MAX_LOGNAME_LEN 256
+
+#define LOG_FILENAMELENGTH (MAX_UI_FILENAME_SIZE )
+#define LOG_DATETIMELENGTH 50 // 50 to leave room for additional text.
+
+#define LINE_PRINTER TEXT("LPT1")
+#define VERIFY_LOG TEXT("VERIFY")
+#define SKIPPED_LOG TEXT("SKIPPED")
+#define EXCLUDE_LOG TEXT("EXCLUDE")
+#define CORRUPT_LOG TEXT("CORRUPT")
+#define DEBUG_LOG TEXT("DEBUG")
+#define BKS_EXT TEXT(".BKS")
+#define TKS_EXT TEXT(".TKS")
+#define RSS_EXT TEXT(".RSS")
+#define LST_EXT TEXT(".LST")
+#define LOG_EXT TEXT(".LOG")
+
+/* Output file destinations */
+
+enum{
+ LOGGING_FILE, /* log file type */
+ CORRUPT_FILE, /* log file type */ /* <-- maintain these contiguous */
+ DEBUG_LOG_FILE, /* log file type */
+ SKIPPED_FILE, /* script file type */
+ VERIFY_FILE /* script file type */
+} LOG_DESTS ;
+
+
+/* Message types passed to lresprintf */
+enum{
+ LOG_START,
+ LOG_MSG,
+ LOG_ERROR,
+ LOG_WARNING,
+ LOG_DIRECTORY,
+ LOG_FILE,
+ LOG_STREAM,
+ LOG_END
+} LOG_MESSAGES ;
+
+typedef struct log_dest {
+ FILE *fh; /* associated file handle */
+ INT16 mode ; /* open mode for file, -1=config determine,1=overwrite mode, 2=append */
+} LOG_DEST, *LOG_DEST_PTR ;
+
+extern LOG_DEST output_dest[] ;
+
+// DATA STRUCTURES
+
+typedef struct {
+
+ UCHAR szFileName[ LOG_FILENAMELENGTH ] ;
+ UCHAR szDateTime[ LOG_DATETIMELENGTH ] ;
+ BYTE bTag ;
+ LONG lSize ;
+ UINT16 iDate ;
+ UINT16 iTime ;
+ Q_ELEM pQElem ;
+
+} DS_LOGITEM, *PDS_LOGITEM, *LOGITEM_PTR ;
+
+typedef struct {
+
+ INT16 nLineNo ;
+ LPSTR szLine ; // Dynamically allocated from global heap.
+ BYTE bTag ;
+ Q_ELEM pQElem ;
+
+} DS_LOGVIEWITEM, *PDS_LOGVIEWITEM, *LOGVIEWITEM_PTR ;
+
+
+// Macros for list of log files.
+
+#define LOG_GetFileName( x ) ( (x)->szFileName )
+#define LOG_SetFileName( x, y ) ( lstrcpy ( (x)->szFileName, (y) ) )
+
+#define LOG_GetDateTime( x ) ( (x)->szDateTime )
+#define LOG_SetDateTime( x, y ) ( lstrcpy ( (x)->szDateTime, (y) ) )
+
+#define LOG_GetItemSize( x ) ( (x)->lSize )
+#define LOG_SetItemSize( x, y ) ( (x)->lSize = (y) )
+
+#define LOG_GetItemDate( x ) ( (x)->iDate )
+#define LOG_SetItemDate( x, y ) ( (x)->iDate = (y) )
+
+#define LOG_GetItemTime( x ) ( (x)->iTime )
+#define LOG_SetItemTime( x, y ) ( (x)->iTime = (y) )
+
+// Macros for viewing a log file.
+
+#define LOG_GetViewLineNo( x ) ( (x)->nLineNo )
+#define LOG_SetViewLineNo( x, y ) ( (x)->nLineNo = (y) )
+
+#define LOG_GetViewLine( x ) ( (x)->szLine )
+#define LOG_SetViewLine( x, y ) ( lstrcpy ( (x)->szLine, (y) ) )
+
+// Macros for both lists.
+
+#define LOG_GetTagField( x ) ( (x)->bTag )
+#define LOG_SetTagField( x, y ) ( (x)->bTag = (y) )
+
+#define LOG_GetQElem( x ) ( (x)->pQElem )
+#define LOG_SetQElem( x, y ) ( (x)->pQElem = (y) )
+
+// Log View window
+
+typedef struct {
+
+ LPSTR pszBuffer ;
+ HFONT hFont ;
+ FILE *fp ;
+ INT cxChar ;
+ INT cxCaps ;
+ INT cyChar ;
+ INT cxClient ;
+ INT cyClient ;
+ INT nMaxWidth ;
+ INT nVscrollPos ;
+ INT nVscrollMax ;
+ INT nHscrollPos ;
+ INT nHscrollMax ;
+ INT nLines ;
+ INT nBlocksMax ;
+ INT nBlocksUsed ;
+ INT nRecsPerBlock ;
+ INT nMaxStringLen ;
+ INT nPaintBeg ;
+ INT nPaintEnd ;
+ INT nRecsPerTrack ;
+ INT nTrackMax ;
+ LONG lTotalLines ;
+ LONG lTopLine ;
+ INT32_PTR pLogArray ;
+ CHAR szFileName [ MAX_UI_FULLPATH_SIZE ] ;
+
+} DLM_LOGITEM, far *DLM_LOGITEM_PTR ;
+
+#define L_GetVisibleTopLine( x ) ( (x)->lTopLine )
+#define L_SetVisibleTopLine( x, y ) ( (x)->lTopLine = (y) )
+
+#define L_GetTotalLines( x ) ( (x)->lTotalLines )
+#define L_SetTotalLines( x, y ) ( (x)->lTotalLines = (y) )
+
+#define L_GetTrackMax( x ) ( (x)->nTrackMax )
+#define L_SetTrackMax( x, y ) ( (x)->nTrackMax = (y) )
+
+#define L_GetRecsPerTrack( x ) ( (x)->nRecsPerTrack )
+#define L_SetRecsPerTrack( x, y ) ( (x)->nRecsPerTrack = (y) )
+
+#define L_GetPaintBeg( x ) ( (x)->nPaintBeg )
+#define L_SetPaintBeg( x, y ) ( (x)->nPaintBeg = (y) )
+
+#define L_GetPaintEnd( x ) ( (x)->nPaintEnd )
+#define L_SetPaintEnd( x, y ) ( (x)->nPaintEnd = (y) )
+
+#define L_GetCharWidth( x ) ( (x)->cxChar )
+#define L_SetCharWidth( x, y ) ( (x)->cxChar = (y) )
+
+#define L_GetBuffer( x ) ( (x)->pszBuffer )
+#define L_SetBuffer( x, y ) ( lstrcpy ( (x)->pszBuffer, (y) ) )
+
+#define L_GetFont( x ) ( (x)->hFont )
+#define L_SetFont( x, y ) ( (x)->hFont = (y) )
+
+#define L_GetFileName( x ) ( (x)->szFileName )
+#define L_SetFileName( x, y ) ( lstrcpy ( (x)->szFileName, (y) ) )
+
+#define L_GetFilePtr( x ) ( (x)->fp )
+#define L_SetFilePtr( x, y ) ( (x)->fp = (y) )
+
+#define L_GetCharWidth( x ) ( (x)->cxChar )
+#define L_SetCharWidth( x, y ) ( (x)->cxChar = (y) )
+
+#define L_GetCharWidthCaps( x ) ( (x)->cxCaps )
+#define L_SetCharWidthCaps( x, y ) ( (x)->cxCaps = (y) )
+
+#define L_GetCharHeight( x ) ( (x)->cyChar )
+#define L_SetCharHeight( x, y ) ( (x)->cyChar = (y) )
+
+#define L_GetClientWidth( x ) ( (x)->cxClient )
+#define L_SetClientWidth( x, y ) ( (x)->cxClient = (y) )
+
+#define L_GetClientHeight( x ) ( (x)->cyClient )
+#define L_SetClientHeight( x, y ) ( (x)->cyClient = (y) )
+
+#define L_GetMaxWidth( x ) ( (x)->nMaxWidth )
+#define L_SetMaxWidth( x, y ) ( (x)->nMaxWidth = (y) )
+
+#define L_GetVscrollPos( x ) ( (x)->nVscrollPos )
+#define L_SetVscrollPos( x, y ) ( (x)->nVscrollPos = (y) )
+
+#define L_GetVscrollMax( x ) ( (x)->nVscrollMax )
+#define L_SetVscrollMax( x, y ) ( (x)->nVscrollMax = (y) )
+
+#define L_GetHscrollPos( x ) ( (x)->nHscrollPos )
+#define L_SetHscrollPos( x, y ) ( (x)->nHscrollPos = (y) )
+
+#define L_GetHscrollMax( x ) ( (x)->nHscrollMax )
+#define L_SetHscrollMax( x, y ) ( (x)->nHscrollMax = (y) )
+
+#define L_GetNumOfLines( x ) ( (x)->nLines )
+#define L_SetNumOfLines( x, y ) ( (x)->nLines = (LONG) (y) )
+
+#define L_GetNumOfUsedBlocks( x ) ( (x)->nBlocksUsed )
+#define L_SetNumOfUsedBlocks( x, y ) ( (x)->nBlocksUsed = (y) )
+
+#define L_GetMaxNumOfBlocks( x ) ( (x)->nBlocksMax )
+#define L_SetMaxNumOfBlocks( x, y ) ( (x)->nBlocksMax = (y) )
+
+#define L_GetArrayPtr( x ) ( (x)->pLogArray )
+#define L_SetArrayPtr( x, y ) ( (x)->pLogArray = (INT32_PTR) (y) )
+
+#define L_GetBlockPtr( x, i ) ( (INT32_PTR) ( (x)->pLogArray[ i ] ) )
+#define L_SetBlockPtr( x, i, y ) ( (x)->pLogArray[i] = (y) )
+
+#define L_GetRecsPerBlock( x ) ( (x)->nRecsPerBlock )
+#define L_SetRecsPerBlock( x, y ) ( (x)->nRecsPerBlock = (y) )
+
+#define L_RecNumber( x ) ( L_GetTotalLines( x ) % L_GetRecsPerBlock( x ) )
+#define L_NewBlock( x ) ( L_RecNumber( x ) == 0 )
+
+#define L_GetMaxStringLen( x ) ( (x)->nMaxStringLen )
+#define L_SetMaxStringLen( x, y ) ( (x)->nMaxStringLen = (y) )
+
+
+// FUNCTION PROTOTYPES
+
+VOID LOG_BaseNameChanged ( VOID );
+VOID LOG_Init ( VOID );
+VOID LOG_Deinit ( VOID );
+VOID_PTR LOG_GetLogFileName ( VOID_PTR, LPSTR );
+VOID LOG_Refresh ( VOID );
+VOID LOG_GenerateLogFileName ( LPSTR pDest ) ;
+VOID LOG_GetCurrentLogPathOnly ( CHAR_PTR path ) ;
+LPSTR LOG_GetCurrentLogNameOnly ( VOID ) ;
+LPSTR LOG_GetCurrentLogName ( VOID ) ;
+LPSTR LOG_GetCurrentViewLogName ( VOID ) ;
+VOID LOG_GetCurrentTime ( LPSTR szDate, LPSTR szTime ) ;
+VOID LOG_SetCurrentLogName ( LPSTR );
+VOID LOG_ClearBlocks ( DLM_LOGITEM_PTR pDlm ) ;
+VOID LOG_GetViewHdrLine ( DLM_LOGITEM_PTR pDlm , INT i , LPSTR pszResult ) ;
+
+// OLD LOG FUNCTION PROTOTYPES
+
+VOID lprintf ( INT file, CHAR_PTR fmt, ... ) ;
+VOID lresprintf( INT file, INT message, ... ) ;
+VOID lvprintf ( INT file, CHAR_PTR fmt, va_list arg_ptr) ;
+BOOLEAN LogFileExists( INT index ) ;
+
+#define UI_LoggingActive( log_num ) ( output_dest[ log_num ].fh )
+
+#endif
diff --git a/private/utils/ntbackup/inc/loginpw.h b/private/utils/ntbackup/inc/loginpw.h
new file mode 100644
index 000000000..01698bcff
--- /dev/null
+++ b/private/utils/ntbackup/inc/loginpw.h
@@ -0,0 +1,35 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1992
+
+ Name: loginpw.h
+
+ Description: Contains control ids for items in password database dialog
+
+ $Log: G:/UI/LOGFILES/LOGINPW.H_V $
+
+ Rev 1.1 04 Oct 1992 19:47:44 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 06 Apr 1992 04:05:02 CHUCKB
+Initial revision.
+
+*****************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_PWDB_PASSWORD 43
+#else
+#include "dlg_ids.h"
+#endif
+
+
+/* login pw for pwdb */
+
+#define IDD_PWDB_PWTEXT 287
+#define IDD_PWDB_NEWPW 288
+#define IDD_PWDB_PW 289
+#define IDD_PWDB_NEWPWTEXT 291
+#define IDD_PWDB_CONFIRM 290
+#define IDD_PWDB_CONFTEXT 293
+
diff --git a/private/utils/ntbackup/inc/loop_prv.h b/private/utils/ntbackup/inc/loop_prv.h
new file mode 100644
index 000000000..2ff315370
--- /dev/null
+++ b/private/utils/ntbackup/inc/loop_prv.h
@@ -0,0 +1,368 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: loop_prv.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: private loops header file
+
+ Location:
+
+
+ $Log: T:\logfiles\loop_prv.h_v $
+ *
+ * Rev 1.23.1.0 28 Jan 1994 11:14:04 GREGG
+ * More Warning Fixes
+ *
+ * Rev 1.23 26 Jul 1993 14:52:12 CARLS
+ * added LP_MsgNotDeleted & LP_MsgCommFailure macros
+ *
+ * Rev 1.22 13 May 1993 13:45:40 BARRY
+ * Added macro for LP_MsgRestoredActive for NT.
+ *
+ * Rev 1.21 31 Mar 1993 08:57:34 MARILYN
+ * added the prototype for LP_MsgNoChecksum
+ *
+ * Rev 1.20 01 Mar 1993 17:40:14 MARILYN
+ * added a prototype for LP_TapeVerifyOBJ
+ *
+ * Rev 1.19 18 Jan 1993 12:36:34 STEVEN
+ * added stuff for locked files
+ *
+ * Rev 1.18 20 Nov 1992 10:38:28 STEVEN
+ * added suport for continue VCB message
+ *
+ * Rev 1.17 04 Nov 1992 09:28:10 STEVEN
+ * fix initial receive
+ *
+ * Rev 1.16 03 Nov 1992 10:08:56 STEVEN
+ * change the way we skip data
+ *
+ * Rev 1.15 13 Oct 1992 17:20:20 STEVEN
+ * save old tf message
+ *
+ * Rev 1.14 16 Sep 1992 16:54:46 STEVEN
+ * added support for stream info struct for Tpfmt
+ *
+ * Rev 1.13 10 Jul 1992 16:33:00 STEVEN
+ * Added temp path buffer ptr.
+ *
+ * Rev 1.12 10 Jun 1992 15:53:32 TIMN
+ * Changed CHAR data to INT8 for UNIC
+ *
+ * Rev 1.11 30 Mar 1992 14:44:00 NED
+ * added Large Directory message to trunk
+ *
+ * Rev 1.10 11 Mar 1992 10:07:28 STEVEN
+ * added member to PDL q head for GTNXTDLE
+ *
+ * Rev 1.9 28 Feb 1992 10:32:06 GREGG
+ * Added struct elem set_opened and changed some protos.
+ *
+ * Rev 1.8 06 Nov 1991 18:27:26 GREGG
+ * BIGWHEEL - 8200sx - Added cat_enabled to lp structure.
+ *
+ * Rev 1.7 18 Oct 1991 13:41:20 STEVEN
+ * TRICYCLE-added function for end of varible length file
+ *
+ * Rev 1.6 18 Oct 1991 13:38:56 STEVEN
+ * BIGWHEEL-added disk block to prompt for restore over exist
+ *
+ * Rev 1.5 27 Jun 1991 13:03:40 STEVEN
+ * unnecessary parm to ReceiveData
+ *
+ * Rev 1.4 24 Jun 1991 17:10:36 STEVEN
+ * remove date time from StartBS
+ *
+ * Rev 1.3 17 Jun 1991 15:24:10 CARLS
+ * LP_PadData is called from lptools.c
+ *
+ * Rev 1.2 13 Jun 1991 14:55:28 STEVEN
+ * LBA now in virtual memory
+ *
+ * Rev 1.1 24 May 1991 14:58:18 STEVEN
+ * fixes for new Getnext
+ *
+ * Rev 1.0 09 May 1991 13:32:16 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _loop_prv_h_
+#define _loop_prv_h_
+
+#include "tfldefs.h"
+#include "bsdu_str.h"
+
+/* loop environment structure */
+
+typedef struct {
+ UINT16 memory_allocated ;
+ UINT16 buffer_size ;
+ UINT16 buffer_used ;
+ INT8_PTR buffer ;
+} DATA_FRAGMENT, *DATA_FRAGMENT_PTR ;
+
+typedef struct {
+ struct VM_STR *vm_hdl ;
+ VOID_PTR pdl_head ;
+ VOID_PTR vm_last_elem ;
+} PDL_Q_HEAD, *PDL_HAND ;
+
+
+typedef struct {
+ LIS_PTR lis_ptr ; /* pointer to loop interface structure */
+ GENERIC_DLE_PTR curr_dle ;
+ FSYS_HAND curr_fsys ; /* current fsys_hand */
+ BOOLEAN blk_is_empty ;
+ INT16 last_tape_message ;
+ INT16 initial_tape_buf_used ;
+ BOOLEAN ignore_data_for_ddb ;
+ DBLK_PTR empty_blk ;
+ DBLK_PTR curr_blk ;
+ DBLK_PTR curr_ddb ;
+ DBLK dblk1 ; /* these three blocks are */
+ DBLK dblk2 ; /* pointed to by the above */
+ DBLK dblk3 ; /* three pointers. */
+ FILE_HAND *f_hand ;
+ RR rr ;
+ TPOS tpos ;
+ UINT16 channel ;
+ DATE_TIME backup_dt ;
+ INT8_PTR very_buff ; /* verify buffer */
+ BOOLEAN set_opened ; /* see lp_tdir.c for usage */
+
+ /* get next special variables */
+ INT32 seq_num ;
+ BOOLEAN get_spcl ;
+ BOOLEAN after_bs ;
+ BOOLEAN start_new_dir ;
+ BOOLEAN get_next_first_time ;
+ BOOLEAN get_first_file ;
+ BOOLEAN proc_curr_dir ;
+ BOOLEAN send_saved_block ;
+ PDL_HAND pdl_q ;
+ BOOLEAN tape_rd_error ; /* If this is true, check the error locus in the rr struct */
+
+ /* during restore and verify operations indicates whether or not to process FDBs from tape */
+ INT16 ddb_create_error ;
+
+ /* used for fast file restore */
+ BOOLEAN ffr_inited;
+ INT16 ffr_state;
+ struct FSE *ffr_last_fse;
+ LBA_ELEM ffr_last_lba;
+ struct FSE *tgt_info ;
+ DBLK_PTR saved_ddb ;
+
+ BOOLEAN cat_enabled ;
+
+ INT8_PTR newpath_buf ; /* internaly used by gtnxttpe for target path */
+ UINT16 newpath_buf_sz ; /* internaly used by gtnxttpe for target path */
+
+ UINT32 current_stream_id ;
+ UINT64 current_stream_size ;
+ FILE_HAND file_hand ;
+ INT8_PTR buf_start ;
+ UINT16 read_size ;
+ UINT16 blk_size ;
+ BOOLEAN corrupt_file ;
+
+} LP_ENV, *LP_ENV_PTR ;
+
+/* defines for path comparison */
+#define PATH_BEFORE -1
+#define PATH_AFTER 1
+#define PATH_EQUAL 0
+
+/* dpath structure */
+typedef struct {
+ INT16 path_size ;
+ CHAR_PTR path_ptr ;
+} DPATH, *DPATH_PTR ;
+
+/* tape dir structure */
+typedef struct t_dir {
+ struct t_dir *next_dir ;
+ struct t_item *first_item ;
+ struct t_item *last_item ;
+ DPATH dir_name ;
+} T_DIR, *T_DIR_PTR ;
+
+/* tape file structure */
+typedef struct t_item {
+ struct t_item *next_item ;
+ DBLK_PTR blk ;
+} T_ITEM, *T_ITEM_PTR ;
+
+/* defines for verify */
+#define LOOP_VERIFY_BUFFER 1024*10
+
+/* Macros */
+
+#define LP_SkipData( lp ) ( ( lp )->rr.filter_to_use = TF_SKIP_ALL_DATA )
+#define LP_SkipStream( lp ) ( ( lp )->rr.filter_to_use = TF_SKIP_DATA_STREAM )
+
+/* Macros for calling message handler */
+
+/* general messages */
+#define LP_MsgStartOP( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_START_OPERATION, pid, bsd_ptr, fsys, tpos ) )
+
+#define LP_MsgEndOP( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_END_OPERATION, pid, bsd_ptr, fsys, tpos ) )
+
+#define LP_MsgStartBS( pid, bsd_ptr, fsys, tpos, vcb )\
+ ( lp->lis_ptr->message_handler( MSG_START_BACKUP_SET, pid, bsd_ptr, fsys, tpos, vcb ) )
+
+#define LP_MsgEndBS( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_END_BACKUP_SET, pid, bsd_ptr, fsys, tpos ) )
+
+/* logging messages */
+#define LP_MsgLogBlock( pid, bsd_ptr, fsys, tpos, dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_LOG_BLOCK, pid, bsd_ptr, fsys, tpos, dblk_ptr ) )
+
+#define LP_MsgLogStream( pid, bsd_ptr, fsys, tpos, string )\
+ ( lp->lis_ptr->message_handler( MSG_LOG_STREAM_NAME, pid, bsd_ptr, fsys, tpos, string ) )
+
+
+#define LP_MsgContinueVCB( pid, bsd_ptr, fsys, tpos, dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_CONT_VCB, pid, bsd_ptr, fsys, tpos, dblk_ptr ) )
+
+/* statistics messages */
+#define LP_MsgBlockProcessed( pid, bsd_ptr, fsys, tpos, dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_BLOCK_PROCESSED, pid, bsd_ptr, fsys, tpos, dblk_ptr ) )
+
+#define LP_MsgBytesProcessed( pid, bsd_ptr, fsys, tpos, byte_count )\
+ ( lp->lis_ptr->message_handler( MSG_BYTES_PROCESSED, pid, bsd_ptr, fsys, tpos, byte_count ) )
+
+#define LP_MsgBlockInuse( pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_BLOCK_INUSE, pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr ) )
+
+#define LP_MsgBlockSkipped( pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_BLOCK_SKIPPED, pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr ) )
+
+#define LP_MsgBytesSkipped( pid, bsd_ptr, fsys, tpos, byte_count )\
+ ( lp->lis_ptr->message_handler( MSG_BYTES_SKIPPED, pid, bsd_ptr, fsys, tpos, byte_count ) )
+
+#define LP_MsgBlockBad( pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_BLOCK_BAD, pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr ) )
+
+#define LP_MsgBytesBad( pid, bsd_ptr, fsys, tpos, byte_count )\
+ ( lp->lis_ptr->message_handler( MSG_BYTES_BAD, pid, bsd_ptr, fsys, tpos, byte_count ) )
+
+#define LP_MsgBlockDeleted( pid, bsd_ptr, fsys, tpos, dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_BLOCK_DELETED, pid, bsd_ptr, fsys, tpos, dblk_ptr ) )
+
+#define LP_MsgBytesDeleted( pid, bsd_ptr, fsys, tpos, byte_count )\
+ ( lp->lis_ptr->message_handler( MSG_BYTES_DELETED, pid, bsd_ptr, fsys, tpos, byte_count ) )
+
+#define LP_MsgTapeStats( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_TAPE_STATS, pid, bsd_ptr, fsys, tpos ) )
+
+#define LP_MsgStartClock( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_START_CLOCK, pid, bsd_ptr, fsys, tpos ) )
+
+#define LP_MsgStopClock( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_STOP_CLOCK, pid, bsd_ptr, fsys, tpos ) )
+
+#define LP_MsgRestoredActive( pid, bsd_ptr, fsys, tpos, ddb_dblk_ptr, dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_RESTORED_ACTIVE, pid, bsd_ptr, fsys, tpos, ddb_dblk_ptr, dblk_ptr ) )
+
+/* error message */
+#define LP_MsgError( pid, bsd_ptr, fsys, tpos, error, ddb_dblk_ptr, dblk_ptr, strm_id )\
+ ( lp->lis_ptr->message_handler( MSG_TBE_ERROR, pid, bsd_ptr, fsys, tpos, error, ddb_dblk_ptr, dblk_ptr, strm_id ) )
+
+/* error message for Attribute Read Error */
+#define LP_MsgAttrReadError( pid, bsd_ptr, fsys, tpos, blk_ptr)\
+ (lp->lis_ptr->message_handler(MSG_ATTR_READ_ERROR, pid, bsd_ptr, fsys, tpos, blk_ptr) )
+
+/* verify messages */
+#define LP_MsgBlkNotFound( pid, bsd_ptr, fsys, tpos, tape_dblk_ptr, ddb_dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_BLK_NOT_FOUND, pid, bsd_ptr, fsys, tpos, tape_dblk_ptr, ddb_dblk_ptr ) )
+#define LP_MsgBlkDifferent( pid, bsd_ptr, fsys, tpos, tape_dblk_ptr, disk_dblk_ptr, os_flag, os_err )\
+ ( lp->lis_ptr->message_handler( MSG_BLK_DIFFERENT, pid, bsd_ptr, fsys, tpos,\
+ tape_dblk_ptr, disk_dblk_ptr, os_flag, os_err ) )
+#define LP_MsgLogDifference( pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr, strm_id, os_err )\
+ ( lp->lis_ptr->message_handler( MSG_LOG_DIFFERENCE, pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr, strm_id, os_err ) )
+
+/* misc message */
+#define LP_MsgIdle( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_IDLE, pid, bsd_ptr, fsys, tpos ) )
+#define LP_MsgOpenedInUse( pid, bsd_ptr, fsys, tpos, dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_IN_USE, pid, bsd_ptr, fsys, tpos, dblk_ptr ) )
+#define LP_MsgObjectInUse( pid, bsd_ptr, fsys, tpos, dblk_ptr, TryOpen, parm )\
+ ( lp->lis_ptr->message_handler( MSG_IN_USE_WAIT, pid, bsd_ptr, fsys, tpos, dblk_ptr, TryOpen, parm ) )
+#define LP_MsgPrompt( pid, bsd_ptr, fsys, tpos, type, dblk, ddblk )\
+ ( lp->lis_ptr->message_handler( MSG_PROMPT, pid, bsd_ptr, fsys, tpos, type, dblk, ddblk ) )
+#define LP_MsgEOM( pid, bsd_ptr, fsys, tpos, vcb_ptr, ddb_ptr, fdb_ptr, idb_ptr ) \
+ ( lp->lis_ptr->message_handler( MSG_EOM, pid, bsd_ptr, fsys, tpos, vcb_ptr, ddb_ptr, fdb_ptr, idb_ptr ) )
+#define LP_MsgRecDDB( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_ACK_DDB_RECOVERED, pid, bsd_ptr, fsys, tpos ) )
+#define LP_MsgRecFDB( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_ACK_FDB_RECOVERED, pid, bsd_ptr, fsys, tpos ) )
+#define LP_MsgDataLost( pid, bsd_ptr, fsys, tpos, file_offset, data_loss )\
+ ( lp->lis_ptr->message_handler( MSG_DATA_LOST, pid, bsd_ptr, fsys, tpos, file_offset, data_loss ) )
+#define LP_MsgLargeDirectory( pid, bsd_ptr, fsys, tpos )\
+ ( lp->lis_ptr->message_handler( MSG_LARGE_DIRECTORY, pid, bsd_ptr, fsys, tpos ) )
+#define LP_MsgNoChecksum( pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr, os_err )\
+ ( lp->lis_ptr->message_handler( MSG_NO_CHECKSUM, pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr, os_err ) )
+
+#define LP_MsgNotDeleted( pid, bsd_ptr, fsys, tpos, dblk_ptr )\
+ ( lp->lis_ptr->message_handler( MSG_NOT_DELETED, pid, bsd_ptr, fsys, tpos, dblk_ptr ) )
+
+#define LP_MsgCommFailure( pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr, os_err )\
+ ( lp->lis_ptr->message_handler( MSG_COMM_FAILURE, pid, bsd_ptr, fsys, tpos, dblk_ptr, ddb_dblk_ptr, os_err ) )
+
+/* Tension Message handler interface */
+#define LP_MsgEndTens( oper_type )\
+ ( lp->lis_ptr->message_handler( MSG_END_BACKUP_SET, 0L, NULL, NULL, &lp->tpos, oper_type ) )
+
+/* routines to get the environment structure and initialize it */
+LP_ENV_PTR LP_GetLoopEnvironment( VOID ) ;
+VOID LP_DisposeLoopEnvironment( LP_ENV_PTR ) ;
+
+/* Backup private definitions */
+INT16 LP_BackupDLE( BSD_PTR bsd_ptr, LP_ENV_PTR lp_env_ptr,
+ UINT16 tfl_open_mode, INT16 channel_no, THW_PTR sdrv ) ;
+INT16 LP_BackupVCB( BSD_PTR bsd_ptr, LP_ENV_PTR lp_env_ptr ) ;
+INT16 LP_BackupOBJ( LP_ENV_PTR lp_env_ptr, DBLK_PTR blk_ptr, DATA_FRAGMENT_PTR frag_ptr ) ;
+
+/* Restore private definitions */
+INT16 LP_RestoreDLE( BSD_PTR bsd_ptr, LP_ENV_PTR lp_env_ptr,
+ BOOLEAN reuse_bsd, INT16 channel_no, THW_PTR sdrv ) ;
+INT16 LP_RestoreOBJ( LP_ENV_PTR lp_env_ptr, DBLK_PTR blk_ptr, DATA_FRAGMENT_PTR frag_ptr ) ;
+
+/* Verify private definitions */
+INT16 LP_VerifyDLE( BSD_PTR bsd_ptr, LP_ENV_PTR lp_env_ptr,
+ BOOLEAN reuse_bsd, INT16 channel_no, THW_PTR sdrv ) ;
+INT16 LP_VerifyOBJ( LP_ENV_PTR lp_env_ptr, DBLK_PTR blk_ptr, DATA_FRAGMENT_PTR frag_ptr ) ;
+
+/* Tape directory */
+INT16 LP_AddDirToTree( TAPE_DIR_PTR tape_dir_ptr, DPATH_PTR dir_ptr ) ;
+INT16 LP_AddBlockToTree( TAPE_DIR_PTR tape_dir_ptr, DBLK_PTR blk_ptr ) ;
+T_DIR_PTR LP_FindDir( TAPE_DIR_PTR tape_dir_ptr,
+ T_DIR_PTR start_dir_ptr, DPATH_PTR dir_ptr, INT16 num_levels ) ;
+
+/* Checksum verification of a tape */
+INT16 LP_TapeVerifyOBJ( LP_ENV_PTR lp, DBLK_PTR tape_dblk_ptr ) ;
+
+/* loop tools */
+INT16 LP_StartTPEDialogue( LP_ENV_PTR lp, BOOLEAN write ) ;
+INT16 LP_Send( LP_ENV_PTR lp, BOOLEAN data_flag ) ;
+INT16 LP_SendDataEnd( LP_ENV_PTR lp ) ;
+INT16 LP_FinishedOper( LP_ENV_PTR lp ) ;
+INT16 LP_ReceiveDBLK( LP_ENV_PTR lp ) ;
+INT16 LP_ReceiveData( LP_ENV_PTR lp, UINT32 amount_used ) ;
+INT16 LP_ProcessEOM( LP_ENV_PTR lp, UINT16 tf_message ) ;
+
+VOID LP_PadData( INT8_PTR buf, UINT32 count ) ;
+
+INT16 LP_CheckForOpen( UINT32 ) ;
+
+INT16 LP_CheckForReadLock( UINT32 ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/loops.h b/private/utils/ntbackup/inc/loops.h
new file mode 100644
index 000000000..0578f8d41
--- /dev/null
+++ b/private/utils/ntbackup/inc/loops.h
@@ -0,0 +1,85 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: loops.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+
+ $Log: J:/LOGFILES/LOOPS.H_V $
+ *
+ * Rev 1.6 01 Mar 1993 17:39:54 MARILYN
+ * added a prototype for LP_Tape_Verify_Engine
+ *
+ * Rev 1.5 05 Feb 1993 22:32:06 MARILYN
+ * removed copy/move functionality
+ *
+ * Rev 1.4 09 Nov 1992 10:49:18 GREGG
+ * Added proto for LP_Tape_Cat_Engine.
+ *
+ * Rev 1.3 03 Nov 1992 19:32:20 DON
+ * incorporated marilyns changes for copy function
+ *
+ * Rev 1.2 05 Oct 1992 12:27:00 DON
+ * added macro for LOADER to get a lw_last_tpdrv
+ *
+ * Rev 1.1 16 Jul 1991 15:07:32 BARRY
+ * Removed prototype for LP_GetLBAList(). (This has been moved to the UI.)
+ *
+ * Rev 1.0 09 May 1991 13:32:12 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _loops_h_
+#define _loops_h_
+
+#include "lis.h"
+#include "lp_msg.h"
+#include "fsys.h"
+#include "bsdu.h"
+#include "thw.h"
+
+typedef struct {
+ VOID_PTR lp ;
+ FSYS_HAND curr_fsys ;
+ BOOLEAN first_time ;
+ BOOLEAN last_time ;
+ BOOLEAN valid_save_block ;
+} TAPE_DIR, *TAPE_DIR_PTR ;
+
+extern THW_PTR lw_toc_tpdrv ;
+extern THW_PTR lw_last_tpdrv ;
+#define LP_LastTapeDrive() (THW_PTR)lw_last_tpdrv
+
+INT16 LP_Backup_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Restore_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Verify_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Delete_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Archive_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Tension_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Erase_Engine( LIS_PTR lis_ptr, BOOLEAN security_erase_flag ) ;
+INT16 LP_Format_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_List_Tape_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Tape_Cat_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Tension_Tape_Engine( LIS_PTR lis_ptr ) ;
+INT16 LP_Tape_Verify_Engine( LIS_PTR lis_ptr ) ;
+
+INT16 LP_GetVCB( GETVCB_PTR get_vcb_ptr, TPOS_HANDLER tpos_rout, THW_PTR tdrv_list, VOID_PTR ref ) ;
+INT16 LP_StartTapeDirectory( TAPE_DIR_PTR tape_dir_ptr, LIS_PTR lis_ptr, INT32 tape_id, INT16 tape_no, INT16 bno,
+ THW_PTR tdrv_list ) ;
+INT16 LP_EndTapeDirectory( TAPE_DIR_PTR tape_dir_ptr, BOOLEAN premature_user_end ) ;
+INT16 LP_ReadTape( TAPE_DIR_PTR tape_dir_ptr, BOOLEAN *valid_blk, DBLK_PTR dblk_ptr ) ;
+
+THW_PTR LP_DetermineStartingTPDrv( INT16 oper_type, BSD_PTR bsd_ptr, TPOS_PTR tpos, BOOLEAN auto_determine_sdrv ) ;
+VOID LP_DetermineCurrentTPDrv( BSD_PTR bsd_ptr, INT16 channel ) ;
+VOID LP_CloseSet( INT16 channel ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/lp_msg.h b/private/utils/ntbackup/inc/lp_msg.h
new file mode 100644
index 000000000..f2f021be0
--- /dev/null
+++ b/private/utils/ntbackup/inc/lp_msg.h
@@ -0,0 +1,183 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lp_msg.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+
+ $Log: N:\logfiles\lp_msg.h_v $
+ *
+ * Rev 1.9.1.0 04 Mar 1994 16:53:00 STEVEN
+ *
+ * Rev 1.9 26 Jul 1993 14:50:00 CARLS
+ * added MSG_NOT_DELETED & MSG_COMM_FAILURE
+ *
+ * Rev 1.8 13 May 1993 13:40:32 BARRY
+ * Added MSG_RESTORED_ACTIVE.
+ *
+ * Rev 1.7 31 Mar 1993 08:56:30 MARILYN
+ * added the msg MSG_NO_CHECKSUM
+ *
+ * Rev 1.6 05 Feb 1993 22:34:36 MARILYN
+ * removed copy/move functionality
+ *
+ * Rev 1.5 20 Nov 1992 10:39:58 STEVEN
+ * added suport for continue VCB message
+ *
+ * Rev 1.4 13 Nov 1992 18:16:50 ZEIR
+ * Ad'd LP_OPEN_SRC&DST_ERROR s
+ *
+ * Rev 1.3 06 Nov 1992 18:01:04 MARILYN
+ * Added new LP_ msg for source and destination the same for copy/move
+ *
+ * Rev 1.2 27 Mar 1992 15:56:12 NED
+ * Added Large Directory message
+ *
+ * Rev 1.1 22 May 1991 11:40:56 DAVIDH
+ * Converted enum's to typedefs and added dummy value of 256 at the end
+ * to force the size under Watcom to 2 bytes.
+ *
+ * Rev 1.0 09 May 1991 13:32:18 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+
+#ifndef _lp_msg_h_
+#define _lp_msg_h_
+
+#define LP_ERROR_BASE ( -0x2048 )
+
+#define LP_DATA_VERIFIED ( -1L )
+#define LP_OPEN_ERROR ( -2L )
+
+typedef enum LOOP_MESSAGES {
+
+/* general messages */
+ MSG_START_OPERATION,
+ MSG_END_OPERATION,
+ MSG_START_BACKUP_SET,
+ MSG_END_BACKUP_SET,
+
+/* logging messages */
+ MSG_LOG_BLOCK,
+ MSG_LOG_STREAM_NAME,
+
+/* statistics messages */
+ MSG_BLOCK_PROCESSED,
+ MSG_BYTES_PROCESSED,
+ MSG_BLOCK_SKIPPED,
+ MSG_BYTES_SKIPPED,
+ MSG_BLOCK_BAD,
+ MSG_BYTES_BAD,
+ MSG_BLOCK_DELETED,
+ MSG_BYTES_DELETED,
+ MSG_TAPE_STATS,
+ MSG_STOP_CLOCK,
+ MSG_START_CLOCK,
+
+/* Error messages */
+ MSG_TBE_ERROR,
+
+/* verify messages */
+ MSG_BLK_NOT_FOUND,
+ MSG_BLK_DIFFERENT,
+ MSG_LOG_DIFFERENCE,
+
+/* misc messages */
+ MSG_IDLE,
+ MSG_IN_USE,
+ MSG_IN_USE_WAIT,
+ MSG_PROMPT,
+ MSG_EOM,
+ MSG_ACK_FDB_RECOVERED,
+ MSG_ACK_DDB_RECOVERED,
+ MSG_DATA_LOST,
+ MSG_ACCIDENTAL_VCB,
+ MSG_BLOCK_INUSE,
+ MSG_ATTR_READ_ERROR,
+ MSG_LARGE_DIRECTORY, /* over 35 whatevers in directory */
+ MSG_CONT_VCB,
+ MSG_NO_CHECKSUM,
+ MSG_RESTORED_ACTIVE,
+ MSG_NOT_DELETED,
+ MSG_COMM_FAILURE,
+
+ /* Force Watcom to allocate two bytes. */
+ MSG__FORCE_WATCOM_SIZE=256
+} LOOP_MESSAGES ;
+
+/* prompt message codes */
+typedef enum PROMPT_MESSAGE_CODES {
+ CORRUPT_BLOCK_PROMPT,
+ ASK_TO_REPLACE_MODIFIED,
+ ASK_TO_REPLACE_EXISTING,
+ ASK_TO_RESTORE_CONTINUE,
+ ASK_DISK_FULL,
+ /* Force Watcom to allocate two bytes. */
+ ASK__FORCE_WATCOM_SIZE=256
+} PROMPT_MESSAGE_CODES ;
+
+/* return values from message hander */
+typedef enum HANDLER_RESPONSES {
+ MSG_ACK=0,
+ SKIP_TO_NEXT_ITEM=0,
+ ABORT_OPERATION,
+ SKIP_BLOCK,
+ OBJECT_OPENED_SUCCESSFULLY,
+ OBJECT_OPENED_INUSE,
+ RETRY,
+ SKIP_OBJECT,
+ SKIP_TO_NEXT_BSET,
+ OPERATION_COMPLETE,
+ AUXILARY_ERROR,
+ /* Force Watcom to allocate two bytes. */
+ HR__FORCE_WATCOM_SIZE=256
+ } HANDLER_RESPONSES ;
+
+/* parameter to ObjectInUse message */
+typedef INT16 ( *CHK_OPEN )( UINT32 lp ) ;
+
+/* object skipped causes */
+typedef enum SKIPPED_CAUSES {
+ OBJECT_IN_USE,
+ ERROR_CONDITION,
+ /* Force Watcom to allocate two bytes. */
+ SC__FORCE_WATCOM_SIZE=256
+}SKIPPED_CAUSES ;
+
+/* errors for MSG_TBE_ERROR */
+typedef enum ERROR_MESSAGES {
+ LP_OUT_OF_MEMORY_ERROR = LP_ERROR_BASE,
+ LP_FILE_READ_ERROR,
+ LP_FILE_NOT_FOUND_ERROR,
+ LP_TAPE_WRITE_ERROR,
+ LP_TAPE_READ_ERROR,
+ LP_FILE_IN_USE_ERROR,
+ LP_USER_ABORT_ERROR,
+ LP_TAPE_POS_ERROR,
+ LP_ACCESS_DENIED_ERROR,
+ LP_FILE_OPEN_ERROR,
+ LP_FILE_WRITE_ERROR,
+ LP_FILE_CREATION_ERROR,
+ LP_DRIVE_ATTACH_ERROR,
+ LP_CHANGE_DIRECTORY_ERROR,
+ LP_PRIVILEGE_ERROR,
+ LP_OUT_OF_SPACE_ERROR,
+ LP_INVALID_DRIVE_ERROR,
+ LP_END_OPER_FAILED,
+
+ /* Force Watcom to allocate two bytes. */
+ LP__FORCE_WATCOM_SIZE=256
+ }ERROR_MESSAGES ;
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/lstdres.h b/private/utils/ntbackup/inc/lstdres.h
new file mode 100644
index 000000000..6513506e3
--- /dev/null
+++ b/private/utils/ntbackup/inc/lstdres.h
@@ -0,0 +1,116 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lstdres.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the function prototypes for the standard
+ resources.
+
+ Location: BE_PRIVATE
+
+
+ $Log: N:/LOGFILES/LSTDRES.H_V $
+ *
+ * Rev 1.5 12 Aug 1992 17:47:22 STEVEN
+ * fixed bugs at microsoft
+ *
+ * Rev 1.4 24 Jul 1992 16:00:50 STEVEN
+ * fix warnings
+ *
+ * Rev 1.3 27 May 1992 18:52:42 STEVEN
+ * switches need to match tfinit.c
+ *
+ * Rev 1.2 28 Aug 1991 09:40:24 ED
+ * Roll in Bonoman's changes (Panther). Fiexed bad log token.
+
+**/
+/* $end$ */
+
+#ifndef _LMSLRES
+#define _LMSLRES
+
+#include "detdrive.h"
+
+/* Resources from the MSC libraries that everyone uses */
+
+#if ( !defined( OS_OS2 ) && !defined( OS_WIN32 ) )
+typedef INT16 ( * PF_intdosx )( union REGS *, union REGS *, struct SREGS * );
+typedef VOID ( * PF_free )( VOID_PTR ) ;
+typedef VOID ( * PF_memset )( VOID_PTR,INT16,UINT16 ) ;
+typedef INT16 ( * PF_inp )( UINT16 ) ;
+typedef UINT16 ( * PF_inpw )( UINT16 ) ;
+typedef INT16 ( * PF_outp )( UINT16,INT16 ) ;
+typedef UINT16 ( * PF_outpw )( UINT16,UINT16 ) ;
+typedef VOID_PTR ( * PF_calloc )( size_t,size_t ) ;
+typedef INT16 ( * PF_int86 )( INT16, union REGS *, union REGS * ) ;
+typedef INT16 ( * PF_int86x )( INT16, union REGS *, union REGS *,struct SREGS * ) ;
+#endif
+typedef UINT8_PTR ( * PF_DriverLoad )( CHAR_PTR,DRIVERHANDLE *,VOID_PTR,UINT16 ) ;
+typedef CHAR_PTR ( * PF_CDS_GetMaynFolder )( VOID ) ;
+
+/* The structure we'll have at the top of our header */
+
+typedef struct {
+#if ( !defined( OS_OS2 ) && !defined( OS_WIN32 ) )
+ PF_intdosx intdosx ;
+ PF_free free ;
+ PF_memset memset ;
+ PF_inp inp ;
+ PF_inpw inpw ;
+ PF_outp outp ;
+ PF_outpw outpw ;
+ PF_calloc calloc ;
+ PF_int86 int86 ;
+ PF_int86x int86x ;
+#endif
+ PF_DriverLoad DriverLoad ;
+ PF_CDS_GetMaynFolder CDS_GetMaynFolder ;
+} STD_RESOURCES_INIT ;
+
+#define STD_BUILD_TCB 0
+#define STD_DEBUILD_TCB 1
+
+typedef BOOLEAN (* PF_STDENTRY)( UINT16,INT16,VOID_PTR ) ;
+
+typedef BOOLEAN (* PF_DDRENTRY)( DET_DRIVER_PTR, INT16 ) ;
+
+/*
+** SetCurrentMSL is used to give the handle of the currently loaded MSL to
+** the interface layer so the DIL can call it.
+*/
+
+extern VOID SetActiveMSL( DRIVERHANDLE ) ;
+
+typedef struct {
+ PF_STDENTRY STDENTRY ;
+ UINT16 rmtseg ;
+ STD_RESOURCES_INIT rsrc ;
+} STD_RESOURCES ;
+
+/*
+** This is defined in d_main.asm, the prefix code that makes
+** this module loadable. Note that we only include this code
+** if TDHRES.H has not been loaded; e.g. they don't have the
+** real functions already linked in. (We also keep them from
+** including TDGRES.H after this)
+*/
+
+
+extern STD_RESOURCES funs_tbl ;
+
+#define _intdosx(a,b,c) ( funs_tbl.rsrc.intdosx( a,b,c ) )
+#define _MemFree(a) ( funs_tbl.rsrc.free( a ) )
+#define _MemFill(a,b,c) ( funs_tbl.rsrc.memset( a,b,c ) )
+#define _InByte(a) ( funs_tbl.rsrc.inp( a ) )
+#define _InWord(a) ( funs_tbl.rsrc.inpw( a ) )
+#define _OutByte(a,b) ( funs_tbl.rsrc.outp( a,b ) )
+#define _OutWord(a,b) ( funs_tbl.rsrc.outpw( a,b ) )
+#define _MemAlloc(a,b) ( funs_tbl.rsrc.calloc( a,b ) )
+#define _int86(a,b,c) ( funs_tbl.rsrc.int86( a,b,c ) )
+#define _int86x(a,b,c,d) ( funs_tbl.rsrc.int86x( a,b,c,d ) )
+#define _DriverLoad(a,b,c,d) ( funs_tbl.rsrc.DriverLoad( a,b,c,d ) )
+#define _CDS_GetMaynFolder() ( funs_tbl.rsrc.CDS_GetMaynFolder( ) )
+#endif
diff --git a/private/utils/ntbackup/inc/ltappswd.h b/private/utils/ntbackup/inc/ltappswd.h
new file mode 100644
index 000000000..6586c04e0
--- /dev/null
+++ b/private/utils/ntbackup/inc/ltappswd.h
@@ -0,0 +1,41 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: ltappswd.h
+
+ Description: LAN Tape Password dialog ID header file.
+
+ $Log: G:/UI/LOGFILES/LTAPPSWD.H_V $
+
+ Rev 1.5 04 Oct 1992 19:47:46 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 03 Apr 1992 11:07:44 CHUCKB
+Added defines for translation.
+
+ Rev 1.3 27 Jan 1992 12:50:30 GLENN
+Fixed dialog IDs.
+
+*******************************************************************************/
+
+#ifndef _ltappswd_h_
+#define _ltappswd_h_
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_LANTAPEPSWD 31
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_T_TAPESTR 0x0065
+#define IDD_T_BKSTR 0x0066
+#define IDD_T_USTR 0x0067
+#define IDD_T_PSWD 0x006B
+#define IDD_T_TAPENAME 0x006C
+#define IDD_T_BSNAME 0x006D
+#define IDD_T_UNAME 0x006E
+#define IDD_T_PSWDSTR 0x006A
+
+#endif
diff --git a/private/utils/ntbackup/inc/lw_cntl.h b/private/utils/ntbackup/inc/lw_cntl.h
new file mode 100644
index 000000000..3ff7efe58
--- /dev/null
+++ b/private/utils/ntbackup/inc/lw_cntl.h
@@ -0,0 +1,43 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lw_cntl.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the main control struct for the tape format layer.
+
+
+ $Log: N:/LOGFILES/LW_CNTL.H_V $
+ *
+ * Rev 1.2 10 Dec 1991 16:41:38 GREGG
+ * SKATEBOARD - New Buf. Mgr. - Initial integration.
+ *
+ * Rev 1.1 10 May 1991 17:09:04 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:12 GREGG
+Initial revision.
+
+**/
+#ifndef _MAIN_CNTL_JUNK
+#define _MAIN_CNTL_JUNK
+
+#include "dilhwd.h"
+
+/* $end$ include list */
+
+
+typedef struct _LW_CNTL {
+ BOOLEAN drives_active ; /* Are Drives active */
+ BOOLEAN driver_inited ; /* Is the drive inited */
+ DIL_HWD_PTR cntl_cards ; /* The controller cards for the system */
+ VOID_PTR driver_addr ; /* The driver load address */
+ UINT16 no_channels ; /* The number of channels */
+ UINT16 no_chans_open ; /* The number of Channels Opened */
+ BOOLEAN use_fast_file ; /* FALSE if UI wants to suppress FF */
+} LW_CNTL, *LW_CNTL_PTR ;
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/lw_data.h b/private/utils/ntbackup/inc/lw_data.h
new file mode 100644
index 000000000..bf29ed3d2
--- /dev/null
+++ b/private/utils/ntbackup/inc/lw_data.h
@@ -0,0 +1,116 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lw_data.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the extern definitions for all layer wide data
+ structures for the Tape Format.
+
+
+ $Log: T:\logfiles\lw_data.h_v $
+ *
+ * Rev 1.12 30 Aug 1993 18:47:46 GREGG
+ * Modified the way we control hardware compression from software to work around
+ * a bug in Archive DAT DC firmware rev. 3.58 (we shipped a lot of them).
+ * Files Modified: lw_data.c, lw_data.h, tfstuff.c, mtf10wdb.c, mtf10wt.c and
+ * drives.c
+ *
+ * Rev 1.11 22 Jul 1993 12:11:32 ZEIR
+ * add'd lw_software_name & _len
+ *
+ * Rev 1.10 11 May 1993 21:55:34 GREGG
+ * Moved Sytos translator stuff from layer-wide area to translator.
+ *
+ * Rev 1.9 10 May 1993 15:13:14 Terri_Lynn
+ * Added Steve's changes and My changes for EOM processing
+ *
+ * Rev 1.8 17 Mar 1993 15:10:34 GREGG
+ * This is Terri Lynn. Added external declarations for Sytos Plus and Gregg's
+ * block mode changes.
+ *
+ *
+ * Rev 1.7 24 Jul 1992 14:32:08 NED
+ * added 64-bit constants lw_UINT64_ZERO and lw_UINT64_MAX
+ *
+ * Rev 1.6 05 Apr 1992 19:14:30 GREGG
+ * ROLLER BLADES - Changed lw_sx_file_path to lw_cat_file_path.
+ *
+ * Rev 1.5 16 Jan 1992 18:36:52 NED
+ * Skateboard: buffer manager changes
+ *
+ * Rev 1.4 02 Jan 1992 15:07:00 NED
+ * Buffer Manager/UTF translator integration.
+ *
+ * Rev 1.3 10 Dec 1991 16:41:08 GREGG
+ * SKATEBOARD - New Buf. Mgr. - Initial integration.
+ *
+ * Rev 1.2 17 Oct 1991 01:20:52 GREGG
+ * BIGWHEEL - 8200sx - Added sx file path pointers.
+ *
+ * Rev 1.1 10 May 1991 17:08:54 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:10 GREGG
+Initial revision.
+
+**/
+#ifndef _LW_DATA_JUNK
+#define _LW_DATA_JUNK
+
+#include "tfldefs.h"
+#include "drive.h"
+#include "channel.h"
+#include "lw_cntl.h"
+#include "fmtinf.h"
+#include "buffman.h"
+
+/* $end$ include list */
+
+/* The Channel Array */
+extern CHANNEL_PTR lw_channels ;
+
+/* The Drive List */
+extern DRIVE_PTR lw_drives ;
+
+/* The Drive linked list */
+extern Q_HEADER lw_drive_list ;
+
+/* The TFL Control structure */
+extern LW_CNTL lw_tfl_control ;
+
+/* The current byte format indicator */
+extern UINT16 lw_byte_fmt ;
+
+/* The Tape Format descriptions */
+extern TFINF lw_fmtdescr[] ;
+extern UINT16 lw_num_supported_fmts ;
+
+/* The directory where catalog type files should be written */
+extern CHAR_PTR lw_cat_file_path ;
+extern CHAR_PTR lw_cat_file_path_end ;
+
+/* The name of this software - who's creating sets for MTF */
+extern CHAR_PTR lw_software_name ;
+extern UINT16 lw_software_name_len ;
+
+/* Our default requirements */
+extern BUF_REQ lw_default_bm_requirements ;
+extern BUF_REQ lw_default_vcb_requirements ;
+extern UINT16 lw_buff_size ; /* KLUDGE! */
+
+/* 64 bit constants to avoid calling U64_Init all the time. */
+extern const UINT64 lw_UINT64_ZERO ;
+extern const UINT64 lw_UINT64_MAX ;
+
+/* List of valid tape drive physical block sizes. */
+extern UINT32 lw_blk_size_list[] ;
+extern INT lw_num_blk_sizes ;
+
+/* TRUE if we want the next set to be backed up with hardware compression */
+extern BOOLEAN lw_hw_comp ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/lwdefs.h b/private/utils/ntbackup/inc/lwdefs.h
new file mode 100644
index 000000000..00beeaffd
--- /dev/null
+++ b/private/utils/ntbackup/inc/lwdefs.h
@@ -0,0 +1,37 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lwdefs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the internal Layer Wide Defines.
+
+
+ $Log: L:/LOGFILES/LWDEFS.H_V $
+ *
+ * Rev 1.3 13 Apr 1992 10:22:02 BURT
+ * Increased default buffer size to 4096 to accomodate 4.0 tape format
+ * needs.
+ *
+ *
+ * Rev 1.2 16 Jan 1992 18:37:18 NED
+ * Skateboard: buffer manager changes
+ *
+ * Rev 1.1 10 May 1991 17:09:28 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:08 GREGG
+Initial revision.
+
+**/
+#ifndef _LW_DEFS
+#define _LW_DEFS
+
+/* size used at a minimum for VCB buffers
+ * for those translators which don't care */
+#define TF_DEFAULT_VCB_SIZE (32*1024)
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/lwprotos.h b/private/utils/ntbackup/inc/lwprotos.h
new file mode 100644
index 000000000..5ef0c2205
--- /dev/null
+++ b/private/utils/ntbackup/inc/lwprotos.h
@@ -0,0 +1,133 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lwprotos.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the layer wide function prototypes.
+
+
+ $Log: G:/LOGFILES/LWPROTOS.H_V $
+ *
+ * Rev 1.16 17 Mar 1993 14:55:52 GREGG
+ * This is Terri Lynn. Added Gregg's change to switch a tape drive's block mode
+ * to match the block size of the current tape.
+ *
+ * Rev 1.15 09 Mar 1993 18:14:08 GREGG
+ * Initial changes for new stream and EOM processing.
+ *
+ * Rev 1.14 18 Jan 1993 14:09:58 GREGG
+ * Changes to allow format command passed to driver through TpErase.
+ *
+ * Rev 1.13 11 Nov 1992 22:10:02 GREGG
+ * Changed proto for EraseDrive.
+ *
+ * Rev 1.12 22 Sep 1992 09:15:50 GREGG
+ * Initial changes to handle physical block sizes greater than 1K.
+ *
+ * Rev 1.11 17 Aug 1992 09:09:14 GREGG
+ * Changes to deal with block sizeing scheme.
+ *
+ * Rev 1.10 29 Apr 1992 13:11:44 GREGG
+ * ROLLER BLADES - Added prototype for ReadABuff.
+ *
+ * Rev 1.9 25 Mar 1992 18:27:50 GREGG
+ * ROLLER BLADES - Changed GotoBlock prototype.
+ *
+ * Rev 1.8 15 Jan 1992 01:51:50 GREGG
+ * Added BOOLEAN vcb_only parameter to PositionAtSet.
+ *
+ * Rev 1.7 03 Jan 1992 11:23:52 NED
+ * Added prototype for DumpDebug()
+ *
+ * Rev 1.6 10 Dec 1991 16:42:02 GREGG
+ * SKATEBOARD - New Buf. Mgr. - Initial integration.
+ *
+ * Rev 1.5 14 Oct 1991 10:56:36 GREGG
+ * Changed return type for UpdateDriveStatus.
+ *
+ * Rev 1.4 21 Aug 1991 14:45:06 GREGG
+ * Added prototype for new function 'RewindDriveImmediate'.
+ *
+ * Rev 1.3 09 Jul 1991 16:48:28 NED
+ * Changed prototype for GotoBckUpSet.
+ *
+ * Rev 1.2 05 Jun 1991 19:16:08 NED
+ * added prototype for FormatIndexFromID()
+ *
+ * Rev 1.1 10 May 1991 17:10:08 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:06 GREGG
+Initial revision.
+
+**/
+#ifndef _LW_PROTOPLASM
+#define _LW_PROTOPLASM
+
+#include "reqrep.h"
+#include "channel.h"
+#include "tpos.h"
+
+/* For the device driver */
+#include "retbuf.h"
+#include "dilhwd.h"
+
+/* $end$ include list */
+
+INT16 PositionAtSet( CHANNEL_PTR channel, TPOS_PTR position, BOOLEAN vcb_only ) ;
+
+INT16 UpdateDriveStatus( DRIVE_PTR drive ) ;
+INT16 SetupDriveList( DIL_HWD_PTR cards, INT16 no_cards ) ;
+
+INT16 OpenDrive( DRIVE_PTR, TPOS_PTR ) ;
+INT16 CloseDrive( DRIVE_PTR, TPOS_PTR, UINT16, BOOLEAN ) ;
+
+INT16 MountTape( DRIVE_PTR, TPOS_PTR, BOOLEAN_PTR ) ;
+INT16 DisMountTape( DRIVE_PTR, TPOS_PTR, BOOLEAN ) ;
+
+INT16 ResetChannelList( CHANNEL_PTR channel, BOOLEAN rew_cur_drv ) ;
+INT16 NextDriveInChannel( CHANNEL_PTR channel, BOOLEAN rew_cur_drv ) ;
+INT16 PrevDriveInChannel( CHANNEL_PTR channel, BOOLEAN rew_cur_drv ) ;
+
+INT16 RewindDrive( DRIVE_PTR curDRV, TPOS_PTR ui_tpos, BOOLEAN call_ui, BOOLEAN reset_flg, UINT16 mode ) ;
+INT16 EraseDrive( CHANNEL_PTR channel, BOOLEAN security, BOOLEAN format ) ;
+INT16 RetensionDrive( CHANNEL_PTR ) ;
+INT16 WriteEndSet( DRIVE_PTR ) ;
+INT16 MapGenErr2UIMesg( INT16 gen_error ) ;
+INT16 GotoBckUpSet( CHANNEL_PTR channel, INT16_PTR desired_set_ptr, TPOS_PTR ui_tpos ) ;
+VOID ResetDrivePosition( DRIVE_PTR ) ;
+INT16 GotoBlock( CHANNEL_PTR, UINT32, TPOS_PTR, UINT16_PTR ) ;
+INT16 GetCurrentPosition( DRIVE_PTR ) ;
+INT16 MoveFileMarks( CHANNEL_PTR channel, INT16 number, INT16 direction ) ;
+VOID RewindDriveImmediate( DRIVE_PTR curDRV ) ;
+VOID DumpDebug( INT16 drv_hdl );
+
+/* routines in drives.c */
+
+INT16 ReadABuff( CHANNEL_PTR channel, BOOLEAN try_resize, BOOLEAN_PTR resized_buff ) ;
+INT16 SetDrvBlkSize( CHANNEL_PTR channel, BUF_PTR buffer, UINT32 size, BOOLEAN_PTR resized_buff ) ;
+INT16 MoveNextSet( CHANNEL_PTR channel, TPOS_PTR ui_tpos ) ;
+INT16 ReadThisSet( CHANNEL_PTR channel ) ;
+INT16 ReadNewTape( CHANNEL_PTR channel, TPOS_PTR ui_tpos, BOOLEAN read_tape ) ;
+
+
+/* Buffer Engineering */
+INT16 GetDBLKMapStorage( CHANNEL_PTR channel, BUF_PTR buffer ) ;
+UINT8_PTR GetDATAStorage( CHANNEL_PTR, UINT16_PTR ) ;
+BUF_PTR SnagBuffer( CHANNEL_PTR ) ;
+VOID PuntBuffer( CHANNEL_PTR ) ;
+UINT16 FormatIndexFromID( UINT16 format_id ) ;
+
+/* IO Functions */
+INT16 DoWrite( CHANNEL_PTR, RR_PTR ) ;
+INT16 DoRead( CHANNEL_PTR, RR_PTR ) ;
+
+/* This determines if a return value is a TFLE_xxx error code (as opposed
+ to a TF_xxx message.
+*/
+#define IsTFLE( x ) ( ((INT16) (x) ) < 0 )
+
+#endif
diff --git a/private/utils/ntbackup/inc/machine.h b/private/utils/ntbackup/inc/machine.h
new file mode 100644
index 000000000..e290a79f0
--- /dev/null
+++ b/private/utils/ntbackup/inc/machine.h
@@ -0,0 +1,43 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: machine.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Header for machine.c
+
+ Location: BE_PUBLIC
+
+
+ $Log: T:/LOGFILES/MACHINE.H_V $
+ *
+ * Rev 1.1 28 Feb 1992 13:44:04 NED
+ * added prototype for IsIRQ()
+ *
+ * Rev 1.0 09 May 1991 13:32:56 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _machine_h_
+#define _machine_h_
+
+/* machine types */
+#define UNKNOWN_MACHINE ( 0x0 )
+#define IBM_PS2 ( 0x1 )
+#define IBM_PC ( 0x2 )
+#define IBM_XT_OR_PC_PORTABLE ( 0x3 )
+#define IBM_PC_JR ( 0x4 )
+#define IBM_AT ( 0x5 )
+
+#define MACHINE_ID_SEGMENT ( 0xf000 )
+#define MACHINE_ID_OFFSET ( 0xfffe )
+
+INT16 GetMachineType( VOID ) ;
+
+BOOLEAN IsIRQ( UINT8 IRQ_number, UINT16 base );
+
+#endif
diff --git a/private/utils/ntbackup/inc/mayn31.h b/private/utils/ntbackup/inc/mayn31.h
new file mode 100644
index 000000000..2091cc562
--- /dev/null
+++ b/private/utils/ntbackup/inc/mayn31.h
@@ -0,0 +1,512 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: mayn31.h
+
+ Date Updated: $./FDT$ $./FTM$
+ 8/17/1989 10:4:121
+
+ Description: Maynard's 3.1 Format... See the Document for
+ complete details.
+
+
+ $Log: T:/LOGFILES/MAYN31.H_V $
+ *
+ * Rev 1.15 10 Jan 1995 14:27:14 GREGG
+ * Added code to deal with continuation bits wrongly set in DDBs.
+ *
+ * Rev 1.14 01 Aug 1994 21:56:42 GREGG
+ * Added replaced internal structures in the Novell OS Info with packed
+ * versions. The unpacked versions made the structure size different than
+ * the size on tape! MAYN31RD.C rev 1.54 is needed with this change.
+ *
+ * Rev 1.13 17 Jan 1994 14:56:56 GREGG
+ * Unicode fixes.
+ *
+ * Rev 1.12 12 Jan 1993 11:10:50 GREGG
+ * Fixed problem with not recognizing we had repositioned and needed a new DBLK.
+ *
+ * Rev 1.11 06 Jan 1993 17:20:28 GREGG
+ * Added pad stream to skip the pad data.
+ *
+ * Rev 1.10 18 Nov 1992 10:39:30 HUNTER
+ * Bug fixes
+ *
+ * Rev 1.9 11 Nov 1992 09:48:54 HUNTER
+ * Changes for Streams.
+ *
+ * Rev 1.8 24 Jul 1992 14:41:10 NED
+ * Incorporated Skateboard and BigWheel changed into Graceful Red code,
+ * including MTF4.0 translator support, adding 3.1 file-system structures
+ * support to the 3.1 translator, additions to GOS to support non-4.0 translators.
+ * Also did Unicode and 64-bit filesize changes.
+ *
+ * Rev 1.7 28 Apr 1992 09:35:54 HUNTER
+ * Added "vblk_scan" variable to 3.1 environment.
+ *
+ * Rev 1.6 12 Dec 1991 10:49:36 HUNTER
+ * Changed VBLK identifier defines.
+ *
+ * Rev 1.5 17 Nov 1991 17:38:50 GREGG
+ * Changed value of DB_VAR_BLKS_BIT (it was stepping on ARCHIVE_BIT).
+ *
+ * Rev 1.4 07 Nov 1991 15:23:36 HUNTER
+ * VBLK - Further Variable Block support
+ *
+ * Rev 1.3 29 Oct 1991 10:12:50 HUNTER
+ * VBLK - Added VBLK structure and new bits to support Variable length blocks.
+ *
+ * Rev 1.2 22 Jul 1991 11:50:50 GREGG
+ * Added EOS_AT_EOM attribute bit.
+ *
+ * Rev 1.1 10 May 1991 14:25:46 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:17:38 GREGG
+Initial revision.
+
+**/
+
+#ifndef _MAYN31_FMT
+#define _MAYN31_FMT
+
+
+
+#include "datetime.h"
+#include "fsys_str.h"
+
+#define F31_MAX_STREAMS 5
+
+typedef struct {
+ UINT32 nxt_id ;
+ UINT16 os_id ;
+ UINT16 os_ver ;
+ UINT16 next_dir_id ;
+ UINT16 next_file_id ;
+ UINT16 pellet_offset ;
+ BOOLEAN vblk_scan ;
+ UINT16 no_streams ;
+ UINT16 cur_stream ;
+ STREAM_INFO streams[F31_MAX_STREAMS] ;
+ UINT32 pad_size ;
+ BOOLEAN stream_mode ;
+ UINT32 curr_lba ;
+ BOOLEAN in_streams ;
+ BOOLEAN cont_vcb ;
+} F31_ENV, *F31_ENV_PTR ;
+
+
+#pragma pack(1)
+
+
+/* Version Defines */
+#define FORMAT_MAJOR 3
+#define FORMAT_MINOR 1
+
+
+/* Minimum number of bytes buffered for a proper determination
+*/
+
+#define F31_MIN_BYTES_FOR_ID 1024L
+
+/* The DB attribute bit fields defined are the same for all logical tape
+ blocks. If any bit is set in the upper word of the attribute field
+ then the data has been altered. The currently defined attributes are:
+*/
+
+#define F31_DB_CONT_BIT BIT0
+#define F31_DB_EOS_AT_EOM_BIT BIT8
+#define F31_DB_VAR_BLKS BIT19
+#define F31_DB_ENCRYPT_BIT BIT24
+#define F31_DB_COMPRESS_BIT BIT25
+
+/* This is the Attribute Mask for changing DBLK attributes into tape attributes */
+
+#define F31_ATTRIB_MASK 0xff000001L
+
+/* The "hdr_chksm" refers to the checksum of the first nine fields of the
+ block header, these fields are always in INTEL format. The following
+ define specifies the length of this first checksum.
+*/
+
+/* In UINT16s */
+#define F31_HDR_CHKSUM_LEN 14
+
+/* The block types for the 3.1 types are defined as below */
+
+#define F31_VCB_ID 1 /* Volume Control Block */
+#define F31_CVCB_ID 2 /* Closing Volume Control Block */
+#define F31_BSDB_ID 3 /* Backup Summary Descriptor Block */
+#define F31_DDB_ID 8 /* Directory Descriptor Block */
+#define F31_FDB_ID 9 /* File Descriptor Block */
+#define F31_IDB_ID 10 /* Image Descriptor Block */
+#define F31_CFDB_ID 11 /* Corrupt File Descriptor Block */
+
+
+/* The "block header" is common to all logical tape blocks. The software
+ need only analyze the block header to determine the type of tape block
+ it is and whether the software understands this particular tape block
+ or not.
+*/
+
+typedef struct {
+ /* This initial portion is always in INTEL format */
+ UINT16 type ; /* Unique identifier, see above */
+ UINT32 length ; /* Length in 1/2K (512byte) units */
+ UINT32 pba_vcb ; /* Physical block address of the sets VCB */
+ UINT32 fmks ; /* Number of file marks till next DB */
+ UINT32 lba ; /* Logical block addrs, relative to the VCB */
+ UINT32 blk_id ; /* This is the Control Block ID */
+ UINT16 format ; /* Intel/Motorola, see above */
+ UINT16 os_id ; /* Originators machine/OS, see above */
+ UINT16 os_ver ; /* Originators OS version number */
+ UINT16 hdr_chksm ; /* Checksum of the block header. The algorithm
+ is: XOR each word preceeding this one and
+ store the result here. (When the checksum
+ is varified the 'block_type' checked for
+ a non_zero value also. */
+ /* From this point on everything is in 'format' byte order */
+ UINT16 reserved[16] ; /* Never checksumed, for internal use... */
+ UINT16 blk_chksm ; /* The XOR sum for 'the rest of the BD' */
+ UINT16 chksm_len ; /* The length of 'the rest of the BD' */
+ UINT32 blk_attribs ; /* Addition DB information, see above */
+ UINT16 var_len_off ; /* Offset to strings... */
+ UINT16 non_gen_off ; /* Offset to non_generic DB specifics */
+ UINT16 non_gen_siz ; /* its Size (Bytes, padded to word boundry) */
+ UINT16 data_off ; /* Offset to data */
+ UINT32 tot_data_siz ; /* Total data size */
+ UINT32 rem_data_siz ; /* Remaining data size */
+ UINT32 gen_data_siz ; /* Generic data size */
+ UINT32 gen_data_off ; /* Generic data offset */
+} DB_HDR, * DB_HDR_PTR ;
+
+/* Generic 3.1 VCB defines and structs */
+
+typedef struct {
+ DB_HDR hdr ;
+ UINT32 vcb_attribs ;
+ DATE_TIME backup_date ;
+ UINT16 tf_mjr_ver ;
+ UINT16 tf_mnr_ver ;
+ UINT16 sw_mjr_ver ;
+ UINT16 sw_mnr_ver ;
+ INT32 id ;
+ INT16 ts_num ;
+ INT16 bs_num ;
+ UINT16 pass_encrypt_algm ;
+ UINT16 data_encrypt_algm ;
+ UINT16 data_compress_algm ;
+ UINT16 t_name_len ;
+ UINT16 t_name_off ;
+ UINT16 bs_name_len ;
+ UINT16 bs_name_off ;
+ UINT16 bs_desc_len ;
+ UINT16 bs_desc_off ;
+ UINT16 vol_name_len ;
+ UINT16 vol_name_off ;
+ UINT16 t_pass_len ;
+ UINT16 t_pass_off ;
+ UINT16 bs_pass_len ;
+ UINT16 bs_pass_off ;
+ UINT16 username_len ;
+ UINT16 username_off ;
+ UINT16 mach_name_len ;
+ UINT16 mach_name_off ;
+ UINT16 shrt_mach_name_len ;
+ UINT16 shrt_mach_name_off ;
+} F31_VCB, *F31_VCB_PTR ;
+
+
+/* Generic 3.1 ClosingVCB (CVCB) defines and structs */
+
+typedef struct {
+ DB_HDR hdr ;
+} F31_CVCB, * F31_CVCB_PTR ;
+
+
+/* Generic 3.1 BSDB defines and structs */
+
+typedef F31_VCB F31_BSDB, * F31_BSDB_PTR ;
+
+
+/* Generic 3.1 DDB defines and structs */
+
+typedef struct {
+ DB_HDR hdr ;
+ UINT32 dir_attribs ;
+ DATE_TIME mod_date ;
+ DATE_TIME create_date ;
+ DATE_TIME backup_date ;
+ UINT32 dir_id ;
+ UINT16 dir_name_len ;
+ UINT16 dir_name_off ;
+} F31_DDB, * F31_DDB_PTR ;
+
+
+/* Generic 3.1 FDB defines and structs */
+
+typedef struct {
+ DB_HDR hdr ;
+ UINT32 file_attribs ;
+ UINT32 file_version ;
+ DATE_TIME mod_date ;
+ DATE_TIME create_date ;
+ DATE_TIME backup_date ;
+ UINT32 dir_id ;
+ UINT16 file_name_len ;
+ UINT16 file_name_off ;
+} F31_FDB, * F31_FDB_PTR ;
+
+
+/* Generic 3.1 IDB defines and structs */
+
+typedef struct {
+ DB_HDR hdr ;
+ UINT32 image_attribs ;
+ UINT32 partition_siz ;
+ UINT32 bytes_in_sector ;
+ UINT32 no_of_sectors ;
+ UINT16 no_of_heads ;
+ UINT32 relative_sector ;
+ UINT32 part_no_of_sector ;
+ UINT16 part_sys_ind ;
+ UINT16 partition_name_len ;
+ UINT16 partition_name_off ;
+} F31_IDB, * F31_IDB_PTR ;
+
+
+/* Generic 3.1 CFDB defines and structs */
+
+typedef struct {
+ DB_HDR hdr ;
+ UINT32 crupt_file_attribs ;
+ UINT32 file_id ;
+ UINT32 dir_id ;
+ UINT32 file_offset ;
+} F31_CFDB, * F31_CFDB_PTR ;
+
+
+/* Generic 3.1 Undefined Descriptor Block (UDB) defines and structs */
+
+typedef struct {
+ DB_HDR hdr ;
+} F31_UDB, * F31_UDB_PTR ;
+
+
+/* The Defines for the Variable Length Block */
+#define F31_VBLK_CONT 0xCF0
+#define F31_VBLK_END 0xCFF
+
+
+typedef struct {
+ UINT16 vblk_type ; /* The type of variable length blocks */
+ UINT32 no_blks ; /* The number of tape blocks */
+ UINT32 dead_space ; /* Space to skip */
+ UINT32 amt_data ; /* The amount of file data */
+} PELLET, * PELLET_PTR ;
+
+
+#define F31_VCB_CONT_BIT BIT0 /* Continuation Tape */
+#define F31_VCB_ARCHIVE_BIT BIT1 /* This is an Transfer set */
+#define F31_VCB_PASSWORD_BIT BIT2 /* Set has a password */
+#define F31_VCB_DIR_TRK_NDX_BIT BIT3 /* Directory track utilized */
+#define F31_VCB_END_NDX_BIT BIT4
+#define F31_VCB_PBA_BIT BIT5 /* Physical Block address is valid */
+#define F31_VCB_LBA_BIT BIT6 /* Logical Block Address is valid */
+#define F31_VCB_PREPARED_TAPE BIT7 /* This is an MBS Prepared tape ( a NULL set ) */
+#define F31_VCB_EOS_AT_EOM BIT8 /* Special case: EOS hit at EOM. */
+#define F31_VCB_COPY_SET BIT9 /* backup all do not reset modified flag */
+#define F31_VCB_NORMAL_SET BIT10 /* backup all and reset modified flag */
+#define F31_VCB_DIFFERENTIAL_SET BIT11 /* backup modified files and do NOT reset */
+#define F31_VCB_INCREMENTAL_SET BIT12 /* backup modified files and reset modified flag */
+#define F31_VCB_NOT_START_CONTINUE BIT13 /* if set VCB can't be used to start with continue set */
+#define F31_VCB_VAR_BLKS_BIT BIT19 /* This block is variable length */
+#define F31_VCB_UNSUPPORTED_BIT BIT23 /* We can't do any operations on this set */
+#define F31_VCB_ENCRYPT_BIT BIT24 /* The data is encrypted */
+#define F31_VCB_COMPRESS_BIT BIT25 /* The data is compressed */
+
+/* BSDB attribute defines */
+
+#define F31_BSDB_CONT_BIT BIT0
+#define F31_BSDB_ACHIVE_BIT BIT1
+#define F31_BSDB_PASSWORD_BIT BIT2
+#define F31_BSDB_DIR_TRK_NDX_BIT BIT3
+#define F31_BSDB_END_NDX_BIT BIT4
+#define F31_BSDB_PBA_BIT BIT5
+#define F31_BSDB_LBA_BIT BIT6
+#define F31_BSDB_VAR_BLKS_BIT BIT19 /* This block is variable length */
+#define F31_BSDB_ABORTED_SET_BIT BIT22 /* Aborted Backup Set */
+#define F31_BSDB_ENCRYPT_BIT BIT24
+#define F31_BSDB_COMPRESS_BIT BIT25
+
+/* DDB attribute defines */
+
+#define F31_DDB_CONT_BIT BIT0
+#define F31_DDB_EMPTY_BIT BIT7
+#define F31_DDB_READ_ACCESS_BIT BIT8
+#define F31_DDB_WRITE_ACCESS_BIT BIT9
+#define F31_DDB_OPEN_FILE_RIGHTS_BIT BIT10
+#define F31_DDB_CREATE_FILE_RIGHTS_BIT BIT11
+#define F31_DDB_DELETE_FILE_RIGHTS_BIT BIT12
+#define F31_DDB_PARENTAL_RIGHTS_BIT BIT13
+#define F31_DDB_SEARCH_RIGHTS_BIT BIT14
+#define F31_DDB_MOD_FILE_ATTRIBS_BIT BIT15
+#define F31_DDB_HIDDEN_BIT BIT16
+#define F31_DDB_SYSTEM_BIT BIT17
+#define F31_DDB_VAR_BLKS_BIT BIT19 /* This block is variable length */
+#define F31_DDB_ENCRYPT_BIT BIT24
+#define F31_DDB_COMPRESS_BIT BIT25
+
+
+/* FDB attribute defines */
+
+#define F31_FDB_CONT_BIT BIT0
+#define F31_FDB_CORRUPT_FILE BIT6
+#define F31_FDB_IN_USE_BIT BIT7
+#define F31_FDB_READ_ONLY_BIT BIT8
+#define F31_FDB_HIDDEN_BIT BIT9
+#define F31_FDB_SYSTEM_BIT BIT10
+#define F31_FDB_EXECUTE_ONLY_BIT BIT11
+#define F31_FDB_MODIFIED_BIT BIT13
+#define F31_FDB_SHAREABLE_BIT BIT15
+#define F31_FDB_VAR_BLKS_BIT BIT19 /* This block is variable length */
+#define F31_FDB_TRANSACTIONAL_BIT BIT20
+#define F31_FDB_INDEXING_BIT BIT21
+#define F31_FDB_ENCRYPT_BIT BIT24
+#define F31_FDB_COMPRESS_BIT BIT25
+
+
+/* CFDB attribute defines */
+
+#define F31_CFDB_CONT_BIT BIT0
+#define F31_CFDB_LENGTH_CHANGE_BIT BIT16
+#define F31_CFDB_UNREADABLE_BLK_BIT BIT17
+#define F31_CFDB_DEADLOCK_BIT BIT18
+#define F31_CFDB_ENCRYPT_BIT BIT24
+#define F31_CFDB_COMPRESS_BIT BIT25
+
+/* IDB attribute defines */
+
+#define F31_IDB_CONT_BIT BIT0
+#define F31_IDB_ENCRYPT_BIT BIT24
+#define F31_IDB_COMPRESS_BIT BIT25
+
+typedef struct F31_NOVELL_386_DIR {
+ BOOLEAN info_valid ; /* TRUE when info below is valid */
+ UINT32 maximum_space ; /* Max disk space allowed for dir */
+ UINT16 attributes_386 ; /* Most sig 16 bits of 32-bit attr */
+ UINT8 extend_attr ; /* Most sig byte of low 16 bits */
+ UINT8 inherited_rights ; /* Most sig byte of rights mask */
+} F31_NOVELL_386_DIR ;
+
+typedef struct F31_NOVELL_386_FILE {
+ BOOLEAN info_valid ; /* TRUE when info below is valid */
+ UINT16 creation_time ;
+ UINT32 archiver_id ;
+ UINT16 attributes_386 ; /* Most sig 16 bits of 32-bit attr */
+ UINT32 last_modifier_id ;
+ UINT32 trust_fork_size ; /* Trustee info */
+ UINT32 trust_fork_offset ;
+ UINT8 trust_fork_format ; /* See NOVCOM.H for trust formats */
+ UINT16 inherited_rights ;
+} F31_NOVELL_386_FILE ;
+
+typedef struct F31_NOV_FILE_OS_INFO {
+ UINT32 owner_id;
+ UINT16 access_date ;
+ F31_NOVELL_386_FILE info_386 ;
+ UINT32 data_fork_offset ;
+} F31_NOV_FILE_OS_INFO, *F31_NOV_FILE_OS_INFO_PTR;
+
+
+typedef struct F31_NOV_DIR_OS_INFO {
+ UINT32 owner_id;
+ UINT32 trust_fork_size ;
+ UINT32 trust_fork_offset;
+ UINT8 trust_fork_format ;
+ F31_NOVELL_386_DIR info_386 ;
+} F31_NOV_DIR_OS_INFO, *F31_NOV_DIR_OS_INFO_PTR;
+
+
+typedef struct F31_AFP_FILE_OS_INFO {
+ UINT8 finder[32];
+ ACHAR long_name[32] ;
+ UINT32 data_fork_size ;
+ UINT32 data_fork_offset ;
+ UINT32 res_fork_size ;
+ UINT32 res_fork_offset ;
+ UINT32 owner_id ;
+ UINT16 access_date ;
+ F31_NOVELL_386_FILE info_386 ;
+ UINT8 proDosInfo[6] ; /* Added in version 1. */
+} F31_AFP_FILE_OS_INFO, *F31_AFP_FILE_OS_INFO_PTR;
+
+typedef struct F31_OLD_AFP_DIR_OS_INFO {
+ UINT8 finder[32];
+ UINT32 owner_id;
+ UINT32 trust_fork_size ;
+ UINT32 trust_fork_offset;
+ INT16 path_leng ;
+ ACHAR long_path[2] ; /* :fred:sue */
+} F31_OLD_AFP_DIR_OS_INFO, *F31_OLD_AFP_DIR_OS_INFO_PTR;
+
+
+typedef struct F31_AFP_DIR_OS_INFO {
+ UINT8 finder[32];
+ UINT32 owner_id;
+ UINT32 trust_fork_size ;
+ UINT32 trust_fork_offset;
+ UINT8 trust_fork_format ;
+ UINT16 lpath_leng ;
+ UINT16 long_path ; /* :fred:sue */
+ F31_NOVELL_386_DIR info_386 ;
+ UINT8 proDosInfo[6] ; /* Added in version 1. */
+} F31_AFP_DIR_OS_INFO, *F31_AFP_DIR_OS_INFO_PTR;
+
+
+/* OS2's File system info */
+typedef struct F31_OS2_FILE_OS_INFO {
+ UINT32 alloc_size ;
+ UINT32 data_fork_size ;
+ UINT32 data_fork_offset ;
+ UINT32 ea_fork_size ;
+ UINT32 ea_fork_offset ;
+ DATE_TIME access_date ;
+ UINT16 lname_leng ;
+ UINT16 long_name ;
+ UINT32 acl_fork_size ;
+ UINT32 acl_fork_offset ;
+} F31_OS2_FILE_OS_INFO, *F31_OS2_FILE_OS_INFO_PTR;
+
+
+typedef struct F31_OS2_DIR_OS_INFO {
+ DATE_TIME access_date ;
+ UINT32 ea_fork_size ;
+ UINT32 ea_fork_offset;
+ UINT16 path_leng ;
+ UINT16 path ;
+ UINT32 acl_fork_size ;
+ UINT32 acl_fork_offset;
+} F31_OS2_DIR_OS_INFO, *F31_OS2_DIR_OS_INFO_PTR;
+
+
+/*
+ * Info for SMS FDBs and DDBs.
+ */
+typedef struct F31_SMS_OS_INFO {
+ UINT32 attrib; /* SMS attributes (these can't be mapped) */
+ DATE_TIME access_date;
+ BOOLEAN is_object; /* Is this DDB / FDB a major object? */
+ UINT32 name_space; /* SMS's value for the generic name */
+ UINT32 creator_name_space; /* SMS's value for the creator name */
+ UINT16 creator_name; /* Path/name in the creator's name space */
+ UINT16 creator_name_length;
+} F31_SMS_OS_INFO, *F31_SMS_OS_INFO_PTR;
+
+#pragma pack()
+
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/mayn40.h b/private/utils/ntbackup/inc/mayn40.h
new file mode 100644
index 000000000..1f3fbee30
--- /dev/null
+++ b/private/utils/ntbackup/inc/mayn40.h
@@ -0,0 +1,463 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: mayn40.h
+
+ Description: Maynard's 4.0 Format. See the Document for
+ complete details.
+
+
+ $Log: T:/LOGFILES/MAYN40.H_V $
+
+ Rev 1.38.1.3 12 Jan 1995 11:13:22 GREGG
+Calculate OTC addrs from fmk instead of always asking (fixes Wangtek bug).
+
+ Rev 1.38.1.2 08 Jan 1995 22:08:20 GREGG
+Added database type DBLK.
+
+ Rev 1.38.1.1 26 Oct 1993 21:34:04 GREGG
+Increased size of OTC temp file name strings in environment.
+
+ Rev 1.38.1.0 15 Sep 1993 21:43:58 GREGG
+Added otc file name strings to the environment structure.
+
+ Rev 1.38 04 Jul 1993 03:37:34 GREGG
+Added eom_file_id and eom_dir_id to environment.
+
+ Rev 1.37 08 Jun 1993 00:08:24 GREGG
+Fix for bug in the way we were handling EOM and continuation OTC entries.
+Files modified for fix: mtf10wt.c, otc40wt.c, otc40msc.c f40proto.h mayn40.h
+
+ Rev 1.36 19 May 1993 14:17:14 ZEIR
+ad'd #def for conner_software_vendor_id as 0x0CBE
+
+ Rev 1.35 29 Apr 1993 23:38:32 GREGG
+Rearranged environment structure to avoid bug in MIPS compiler.
+
+ Rev 1.34 26 Apr 1993 02:43:38 GREGG
+Sixth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Redefined attribute bits to match the spec.
+ - Eliminated unused/undocumented bits.
+ - Added code to translate bits on tapes that were written wrong.
+
+Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+
+ Rev 1.33 25 Apr 1993 17:36:08 GREGG
+Fourth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Parse the device name and volume name out of the FS supplied "volume
+ name", and write it to tape as separate fields.
+ - Generate the "volume name" the FS and UI expect out of the device
+ name and volume name on tape.
+ - Write all strings without NULL terminater, and translate them back
+ to NULL terminated strings on the read side.
+
+Matches: MTF10WDB.C 1.8, F40PROTO.H 1.26, OTC40WT.C 1.24, MAYN40.H 1.33,
+ MAYN40RD.C 1.57, OTC40RD.C 1.25
+
+ Rev 1.32 19 Apr 1993 18:02:32 GREGG
+Second in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ Changes to write version 2 of OTC, and to read both versions.
+
+Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ mayn40.h 1.32, mtf.h 1.3.
+
+NOTE: There are additional changes to the catalogs needed to save the OTC
+ version and put it in the tpos structure before loading the OTC
+ File/Directory Detail. These changes are NOT listed above!
+
+ Rev 1.31 18 Apr 1993 00:44:16 GREGG
+First in a series of incremental changes to bring the translator in line
+with the MTF spec:
+ - Change string storage pointers in environment from CHAR_PTRs
+ to UINT8_PTRs.
+ - Added define for software vendor id.
+
+Matches: MTF10WT.C 1.6, MTF10WDB.C 1.6, MAYN40RD.C 1.53 and F40PROTO.H 1.25
+
+ Rev 1.30 14 Apr 1993 02:00:52 GREGG
+Fixes to deal with non-ffr tapes in ffr drives (i.e. EXB2200 in EXB5000).
+
+ Rev 1.29 07 Apr 1993 16:28:16 GREGG
+Added boolean 'unaligned_stream' to environment.
+
+ Rev 1.28 24 Mar 1993 10:22:16 ChuckS
+Added fields for device_name to F40_ENV
+
+ Rev 1.27 09 Mar 1993 18:14:44 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.26 21 Dec 1992 12:28:12 DAVEV
+Enabled for Unicode - IT WORKS!!
+
+ Rev 1.25 07 Dec 1992 10:18:32 GREGG
+Added fields to the format environment for code to put links in the FDD.
+
+ Rev 1.24 24 Nov 1992 18:18:26 GREGG
+Updates to match MTF document.
+
+ Rev 1.23 23 Nov 1992 10:06:30 GREGG
+Changes for path in stream.
+
+ Rev 1.22 19 Nov 1992 10:14:14 GREGG
+Added eom_stream to environment.
+
+ Rev 1.21 17 Nov 1992 14:18:36 GREGG
+Fixed stream definition, and updated OTC structures.
+
+ Rev 1.20 12 Nov 1992 16:41:16 HUNTER
+Added stuff for frag buffer.
+
+ Rev 1.19 09 Nov 1992 10:49:06 GREGG
+Removed unused elements in environment structure.
+
+ Rev 1.18 03 Nov 1992 10:31:36 HUNTER
+Added pad size.
+
+ Rev 1.17 22 Oct 1992 10:55:44 HUNTER
+New stream changes
+
+ Rev 1.16 25 Sep 1992 09:31:42 GREGG
+Changed define for ESPB value to BT_MDB.
+
+ Rev 1.15 22 Sep 1992 09:23:54 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.14 22 Sep 1992 09:04:56 HUNTER
+Revised stream header structure
+
+ Rev 1.13 06 Aug 1992 12:10:26 BURT
+Changed members of PELLET struct back to UINT32s.
+
+
+ Rev 1.12 04 Aug 1992 16:51:10 GREGG
+Burt's fixes for variable length block support.
+
+ Rev 1.11 04 Aug 1992 16:37:10 GREGG
+Added define for unique chksum each time the format is changed.
+
+ Rev 1.10 30 Jul 1992 16:46:46 GREGG
+Added 'end_set_continuing' BOOLEAN to environment.
+
+ Rev 1.9 01 Jul 1992 19:29:02 GREGG
+Defined new date/time structure for storing dates on tape, replaced existing
+date/time structure with new one in tape headers and OTC, and rearranged
+structures to align on 4 byte boundaries with the new date stuctures.
+
+ Rev 1.8 09 Jun 1992 19:31:24 GREGG
+Rearranged header and OTC structures to allign them on 4 byte boundries
+(MIPS needs this). Also removed filemark_count elements, and added some
+new defines and cleaned up the file.
+
+ Rev 1.7 29 May 1992 15:11:20 GREGG
+Added last access date field to DIR block and FDD DIR entry.
+
+ Rev 1.6 22 May 1992 15:29:22 GREGG
+Removed defines that are now defined elsewhere.
+
+ Rev 1.5 20 May 1992 18:16:00 GREGG
+Changes to support OTC read.
+
+ Rev 1.4 05 May 1992 11:27:46 GREGG
+Folded 'local_tape' global into environment.
+
+ Rev 1.3 29 Apr 1992 12:41:26 GREGG
+Changes for new EOM handling.
+
+ Rev 1.2 05 Apr 1992 18:13:42 GREGG
+ROLLER BLADES - Initial OTC integration.
+
+ Rev 1.1 02 Apr 1992 15:12:34 BURT
+Added pragmas to turn packing on and put it back to what is was
+before. This is just for the structures that will be written to
+tape.
+
+
+ Rev 1.0 25 Mar 1992 20:52:24 GREGG
+Initial revision.
+
+**/
+
+#ifndef _MAYN40_FMT
+#define _MAYN40_FMT
+
+/*#include <stdio.h> -- this include violates UNICODE support! */
+ /* (actually, so do the following 2 also, but */
+ /* they are not causing any problem -- YET!) */
+#include "datetime.h" /* Unicode violation - get this include outahere!*/
+#include "stdmath.h" /* Unicode violation - get this include outahere!*/
+#include "mtf.h"
+
+#define CONNER_SOFTWARE_VENDOR_ID 0x0CBE
+
+#define INTERIM_CHECKSUM_BASE 0x0U
+
+/* Auxiliary buffer requirements */
+
+#define F40_DEFAULT_AUX_BUFFER_SIZE 256
+#define F40_AUX_BUFFER_INCR_SIZE 128
+
+/* Logical Block Size for the tapes we write. */
+#define F40_LB_SIZE 1024L
+
+/* Stream header Check Sum Length */
+#define F40_STREAM_CHKSUM_LEN (((sizeof(MTF_STREAM) - sizeof(UINT16)) / 2))
+
+/* 16 bit ID's for the internal use of determining what block type we have */
+#define F40_SSET_IDI BT_VCB /* Volume Control Block */
+#define F40_EOTM_IDI BT_CVCB /* Closing Volume Control Block */
+#define F40_ESET_IDI BT_BSDB /* Backup Summary Descriptor Block */
+#define F40_DIRB_IDI BT_DDB /* Directory Descriptor Block */
+#define F40_FILE_IDI BT_FDB /* File Descriptor Block */
+#define F40_IMAG_IDI BT_IDB /* Image Descriptor Block */
+#define F40_CFIL_IDI BT_CFDB /* Corrupt File Descriptor Block */
+#define F40_VOLB_IDI 13 /* Volume Descriptor Block */
+#define F40_DBDB_IDI BT_DDB /* Database Descriptor Block */
+#define F40_ESPB_IDI BT_MDB /* End of Set Pad Block */
+#define F40_TAPE_IDI 100 /* For tape header id */
+
+/*
+ The header checksum length will now be the full size of the DBLK header
+ minus the size of the header checksum field itself. NOTE: This is the
+ size in 16 bit (2 byte) words.
+*/
+
+#define F40_HDR_CHKSUM_LEN (((sizeof(MTF_DB_HDR) - sizeof(UINT16)) / 2))
+
+
+#pragma pack(1)
+
+/**/
+/*
+ Generic 4.0 IMAG struct
+*/
+
+#define F40_IMAG_N "IMAG" /* Image Descriptor Block ID */
+
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 image_attribs ;
+ UINT32 partition_size ;
+ UINT32 bytes_in_sector ;
+ UINT32 no_of_sectors ;
+ UINT32 relative_sector_no ;
+ UINT32 partition_no_of_sector ;
+ UINT16 partition_sys_ind ;
+ UINT16 no_of_heads ;
+ MTF_TAPE_ADDRESS partition_name ;
+} F40_IMAG, * F40_IMAG_PTR ;
+
+
+/**/
+/*
+ Generic 4.0 Undefined Descriptor Block (UDB) struct
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+} F40_UDB, * F40_UDB_PTR ;
+
+
+/**/
+/*
+ Database DBLK and FDD Entry (DBDB)
+*/
+
+#define F40_DBDB_N "DBDB" /* Image Descriptor Block ID */
+
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 database_attribs ;
+ MTF_DATE_TIME backup_date ;
+ MTF_TAPE_ADDRESS database_name ;
+} F40_DBDB, * F40_DBDB_PTR ;
+
+typedef struct {
+ MTF_DATE_TIME backup_date ;
+ UINT32 database_attribs ;
+ MTF_TAPE_ADDRESS database_name ;
+ MTF_TAPE_ADDRESS os_info ;
+} F40_FDD_DBDB, * F40_FDD_DBDB_PTR ;
+
+#pragma pack()
+
+typedef struct {
+
+ /* NOTE: These first three fields have to stay in this position until
+ the MIPS compiler is fixed!!! (Alignment problems)
+ */
+ MTF_STREAM cur_stream ;
+ UINT16 sm_count ;
+ MTF_STREAM eom_stream ;
+
+ UINT32 corrupt_obj_count ;
+ UINT64 used_so_far ;
+ MTF_TAPE tape_hdr ;
+ UINT8_PTR tape_name ;
+ UINT16 tape_name_size ;
+ UINT16 tape_name_alloc ;
+ UINT8_PTR tape_password ;
+ UINT16 tape_password_size ;
+ UINT16 tape_password_alloc ;
+ UINT8_PTR vol_name ;
+ UINT16 vol_name_size ;
+ UINT16 vol_name_alloc ;
+ UINT8_PTR machine_name ;
+ UINT16 machine_name_size ;
+ UINT16 machine_name_alloc ;
+ UINT8_PTR device_name ;
+ UINT16 device_name_size ;
+ UINT16 device_name_alloc ;
+ UINT16 max_otc_level ;
+ UINT16 cur_otc_level ;
+ BOOLEAN fdd_aborted ;
+ BOOLEAN sm_aborted ;
+ BOOLEAN fdd_completed ;
+ BOOLEAN fdd_continuing ;
+ BOOLEAN sm_continuing ;
+ UINT32 fdd_pba ;
+ UINT16 fdd_seq_num ;
+ UINT32 eset_pba ;
+ BOOLEAN sm_adjusted ;
+ FILE * otc_fdd_fptr ;
+ FILE * otc_eom_fptr ;
+ FILE * otc_sm_fptr ;
+ CHAR sm_fname[14] ;
+ CHAR fdd_fname[14] ;
+ CHAR eom_fname[14] ;
+ long last_fdd_offset ;
+ UINT16 last_fdd_type ;
+ long last_sm_offset ;
+ long cont_sm_offset ;
+ UINT32 dir_count ;
+ UINT32 file_count ;
+ BOOLEAN eotm_no_first_fmk ;
+ BOOLEAN sm_at_eom ;
+ BOOLEAN end_set_continuing ;
+ BOOLEAN make_streams_invisible ;
+ UINT8 frag[512] ;
+ UINT16 frag_cnt ;
+ UINT32 var_stream_offset ;
+ BOOLEAN stream_crosses ;
+ UINT16 stream_offset ;
+ UINT16 pad_size ;
+ BOOLEAN stream_at_eom ;
+ BOOLEAN pstream_crosses ;
+ UINT16 pstream_offset ;
+ BOOLEAN unaligned_stream ;
+ UINT8_PTR util_buff ;
+ UINT16 util_buff_size ;
+ UINT8_PTR otc_buff ;
+ UINT16 otc_buff_size ;
+ UINT8_PTR otc_buff_ptr ;
+ UINT16 otc_buff_remaining ;
+ long * dir_links ;
+ UINT16 dir_level ;
+ UINT16 max_dir_level ;
+ UINT16 dir_links_size ;
+ long last_volb ;
+ UINT32 last_sset_pba ;
+ UINT8 otc_ver ;
+ BOOLEAN old_tape ;
+ UINT32 eom_file_id ;
+ UINT32 eom_dir_id ;
+ UINT32 eset_base_addr ;
+
+} F40_ENV, *F40_ENV_PTR ;
+
+/**/
+
+#define F40_INIT_UTIL_BUFF_SIZE 2048
+#define F40_UTIL_BUFF_INC 512
+
+#define F40_INIT_OTC_BUFF_SIZE 2048
+#define F40_OTC_BUFF_INC 512
+
+#define F40_INIT_DIR_LINKS_SIZE 100
+#define F40_DIR_LINKS_INC 25
+
+/* For first parameter to OTC_Close function if F40_OTC.C */
+#define OTC_CLOSE_FDD 0
+#define OTC_CLOSE_SM 1
+#define OTC_CLOSE_ALL 2
+
+/* Returns from FDD block determiner (also used to store type of last
+ FDD entry written in case we need to go back and mark it corrupt).
+*/
+#define FDD_UNKNOWN_BLK 0
+#define FDD_VOL_BLK 1
+#define FDD_DIR_BLK 2
+#define FDD_FILE_BLK 3
+#define FDD_END_BLK 4
+#define FDD_DBDB_BLK 5
+
+/* For translating old MTF tapes where the attribute bits were screwed up. */
+
+#define OLD_VCB_COPY_SET BIT9 // new: BIT1
+#define OLD_VCB_NORMAL_SET BIT10 // new: BIT2
+#define OLD_VCB_DIFFERENTIAL_SET BIT11 // new: BIT3
+#define OLD_VCB_INCREMENTAL_SET BIT12 // new: BIT4
+#define OLD_VCB_DAILY_SET BIT13 // new: BIT5
+#define OLD_VCB_ARCHIVE_BIT BIT1 // new: BIT0
+#define OLD_DIR_EMPTY_BIT BIT1 // new: BIT16
+#define OLD_DIR_PATH_IN_STREAM_BIT BIT2 // new: BIT17
+#define OLD_FILE_IN_USE_BIT BIT1 // new: BIT16
+#define OLD_FILE_NAME_IN_STREAM_BIT BIT2 // new: BIT17
+#define OLD_OBJ_CORRUPT_BIT BIT15 // new: BIT18
+#define OLD_CFDB_LENGTH_CHANGE_BIT BIT0 // new: BIT16
+#define OLD_CFDB_UNREADABLE_BLK_BIT BIT1 // new: BIT17
+#define OLD_CFDB_DEADLOCK_BIT BIT2 // new: BIT18
+
+
+/**
+ Driver call macro:
+
+ Input : 1. Drive handle
+ 2. Function call (with parameters)
+ 3. Driver call return buffer (RET_BUF)
+ 4. Expected error return from driver call
+ 5. Expected error return from driver call
+ 6. Statement or block of statements to be
+ executed on failure
+
+ This macro makes the requested driver call, does the TpReceive
+ if necessary, and handles any error which you do not indicate
+ is expected.
+
+ The function using the macro MUST be of type INT16 since TFLE_xxx
+ will be automatically returned on error.
+
+ If you have only one allowable error, you must supply it as
+ exp1 and exp2. If you have more allowable, this macro will
+ not work for you.
+
+ NOTE: This macro is NOT intended or appropriate for all driver
+ calls. It is used mostly for OTC code to clean up and
+ simplify functions which made several driver calls.
+**/
+
+#define DRIVER_CALL( hndl, func, rb, exp1, exp2, cleanup ) \
+ \
+ if( func == SUCCESS ) { \
+ while( TpReceive( hndl, &rb ) == FAILURE ) { \
+ ThreadSwitch( ) ; \
+ } \
+ if( rb.gen_error != exp1 && rb.gen_error != exp2 ) { \
+ cleanup ; \
+ return( TFLE_DRIVE_FAILURE ) ; \
+ } \
+ } else { \
+ cleanup ; \
+ return( TFLE_DRIVER_FAILURE ) ; \
+ }
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/mem.h b/private/utils/ntbackup/inc/mem.h
new file mode 100644
index 000000000..92ed619ce
--- /dev/null
+++ b/private/utils/ntbackup/inc/mem.h
@@ -0,0 +1,113 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: mem_prv.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file describes all the data structures internal kept
+ by the MaynStream memory functions.
+
+ Note: All addresses are saved as paragraphs.
+
+ Location:
+
+
+ $Log: P:/LOGFILES/MEM.H_V $
+ *
+ * Rev 1.2 20 Dec 1991 13:27:08 STEVEN
+ * far not necessary because we do everything in LARG model
+ *
+ * Rev 1.1 25 Jun 1991 17:13:20 BARRY
+ * Made bit-field declarations shorts instead of ints.
+ *
+ * Rev 1.0 09 May 1991 13:33:18 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+#ifndef MEM_H
+
+#define MEM_H
+
+#define MEM_ALLOCATED_BLK 0
+#define MEM_FREE_BLK 1
+
+#define MEM_THRESHOLD ( 8 * 1024 )
+
+typedef struct {
+ unsigned short blk_type:1 ;
+ unsigned short size:15 ;
+} BLK_DEF, *BLK_DEF_PTR ;
+
+typedef struct {
+ BLK_DEF blk_def ;
+ UINT16 next_larger_blk ; /* paragraph containing the location of the
+ next larger block */
+ UINT16 next_smaller_blk ; /* paragraph containing the location of the
+ next smaller block */
+ UINT16 next_same_blk ; /* paragraph containing the location of a
+ block of the same size */
+} FREE_BLK, *FREE_BLK_PTR ;
+
+typedef struct {
+ BLK_DEF blk_def ;
+ CHAR data[1] ; /* data area for the allocated block */
+} ALLOC_BLK, *ALLOC_BLK_PTR ;
+
+typedef struct {
+ CHAR data[14] ;
+ unsigned short blk_type:1 ;
+ unsigned short size:15 ;
+} TOP_BLK, *TOP_BLK_PTR ;
+
+typedef struct {
+ UINT32 num_allocs ;
+ UINT16 pool_size ; /* Size of the pool in paragraphs */
+ UINT16 pool_left ; /* size of the pool remaining */
+ UINT16 pool_ptr ; /* first paragraph of requested block */
+ UINT16 buf_size_threshold ; /* Size specifying whether buffers are allocated
+ from the top or bottom of the pool */
+ FREE_BLK_PTR first_free ;
+ FREE_BLK_PTR last_free ;
+} MEM_STR, *MEM_STR_PTR ;
+
+/* This structure is used for debugging purposes */
+#ifdef MEM_DEBUG
+typedef struct {
+ CHAR fname[10] ;
+ INT16 line_num ;
+} DBG_ALLOC, *DBG_ALLOC_PTR ;
+#endif
+
+/* Define external global memory structure */
+extern MEM_STR gb_dos_pool ;
+extern MEM_STR gb_ems_pool ;
+extern BOOLEAN gb_ems_avail ;
+
+/* Define Function Prototypes */
+UINT16 MemDOSInit( UINT16 ) ;
+VOID InsertFreeBlock( MEM_STR_PTR, FREE_BLK_PTR, UINT16 ) ;
+VOID RemoveFreeBlock( MEM_STR_PTR, FREE_BLK_PTR ) ;
+
+/* Define DOS memory macros */
+#define MemAvail( ) ( ( UINT32 ) gb_dos_pool.pool_left << 4 )
+#define MemMax( ) ( ( UINT32 ) gb_dos_pool.last_free->blk_def.size << 4 )
+
+/* Define EMS memory support routines */
+UINT16 MemEMSInit( UINT16 ) ;
+VOID MemEMSDeInit( VOID ) ;
+VOID_PTR EMSmalloc( size_t ) ;
+VOID_PTR EMScalloc( size_t, size_t ) ;
+VOID EMSfree( VOID_PTR ) ;
+
+/* Define EMS memory macros */
+#define EMSMemAvail( ) ( ( UINT32 ) gb_ems_pool.pool_left << 4 )
+#define EMSMemMax( ) ( ( UINT32 ) gb_ems_pool.last_free->blk_def.size << 4 )
+
+/* Definition to convert paragraphs to pointers and vice versa */
+#define MakePtrFromPgraph( paragraph ) ( ( ( VOID_PTR ) ( ( UINT32 ) ( paragraph ) << 16 ) ) )
+#define MakePgraphFromPtr( ptr ) ( ( UINT16 ) ( ( UINT32 ) ( ( UINT32 ) ( ptr ) ) >> 16 ) )
+
+#endif
diff --git a/private/utils/ntbackup/inc/memmang.h b/private/utils/ntbackup/inc/memmang.h
new file mode 100644
index 000000000..4b63de641
--- /dev/null
+++ b/private/utils/ntbackup/inc/memmang.h
@@ -0,0 +1,125 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: memmang.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the MaynStream GUI Memory Manger (MEM).
+
+ $Log: J:\ui\logfiles\memmang.h_v $
+
+ Rev 1.6.1.0 24 Jan 1994 15:14:24 GREGG
+Added file name and line number to debug alloc functions.
+
+ Rev 1.6 20 Jan 1993 19:55:16 MIKEP
+add nt memory display
+
+ Rev 1.5 04 Oct 1992 19:47:48 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 01 Apr 1992 11:51:38 STEVEN
+added memmory manager for WIN32
+
+ Rev 1.3 04 Feb 1992 16:06:26 STEVEN
+MEM_Init should be stubed out with a SUCCESS
+
+ Rev 1.2 31 Jan 1992 16:06:18 DAVEV
+added include <malloc.h> if compiling for NT version only
+
+ Rev 1.1 15 Jan 1992 15:22:30 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.0 20 Nov 1991 19:38:46 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#ifndef SS_MEM_H
+
+#define SS_MEM_H
+
+// Global Variables -- put in appropriate header file.
+
+extern UINT gunSegCount;
+extern ULONG gulMemAvail;
+extern ULONG gulMemUsed;
+extern BOOL gfShowMemory;
+
+
+/*=======================================================================*/
+#ifdef OS_WIN32 /* 32-bit Windows/NT ONLY */
+/*=======================================================================*/
+
+# include <malloc.h>
+ // No memory management routines needed for NT - just use std C functions
+
+ INT MEM_StartShowMemory( VOID );
+ INT MEM_StopShowMemory( VOID );
+
+#ifdef MEM_DEBUG
+
+ PVOID MEM_Malloc( UINT, ACHAR_PTR, INT );
+ PVOID MEM_Calloc( UINT, UINT, ACHAR_PTR, INT );
+ VOID MEM_Free( PVOID, ACHAR_PTR, INT );
+ PVOID MEM_ReAlloc( PVOID, UINT, ACHAR_PTR, INT );
+
+# define malloc( x ) MEM_Malloc( x, __FILE__, __LINE__ )
+# define calloc( x, y ) MEM_Calloc( x, y, __FILE__, __LINE__ )
+# define free( x ) MEM_Free( x, __FILE__, __LINE__ )
+# define realloc( x, y ) MEM_ReAlloc( x, y, __FILE__, __LINE__ )
+
+#else
+
+ PVOID MEM_Malloc( UINT );
+ PVOID MEM_Calloc( UINT, UINT );
+ VOID MEM_Free( PVOID );
+ PVOID MEM_ReAlloc( PVOID, UINT );
+
+# define malloc( x ) MEM_Malloc( x )
+# define calloc( x, y ) MEM_Calloc( x, y )
+# define free( x ) MEM_Free( x )
+# define realloc( x, y ) MEM_ReAlloc( x, y )
+
+#endif
+
+# define MEM_Init() (SUCCESS)
+# define MEM_Deinit() (SUCCESS)
+
+ //Note: MEM_TapeBufAlloc/Free only used in MEMMANG.C
+
+/*=======================================================================*/
+#else /* 16-bit Windows/DOS ONLY */
+/*=======================================================================*/
+
+ // GUI Function Prototypes
+
+
+ BOOL MEM_Init( VOID );
+ BOOL MEM_Deinit( VOID );
+ PVOID MEM_Malloc( UINT );
+ PVOID MEM_Calloc( UINT, UINT );
+ BOOL MEM_Free( PVOID );
+ PVOID MEM_ReAlloc( PVOID, UINT );
+
+ PVOID MEM_TapeBufAlloc( UINT );
+ VOID MEM_TapeBufFree( PVOID );
+
+# ifdef malloc
+# undef malloc
+# undef calloc
+# undef free
+# undef realloc
+# endif
+
+# define malloc( x ) MEM_Malloc( x )
+# define calloc( x, y ) MEM_Calloc( x, y )
+# define free( x ) MEM_Free( x )
+# define realloc( x, y ) MEM_ReAlloc( x, y )
+
+/*=======================================================================*/
+#endif /* END 16-bit Windows/DOS ONLY */
+/*=======================================================================*/
+
+#endif
diff --git a/private/utils/ntbackup/inc/menumang.h b/private/utils/ntbackup/inc/menumang.h
new file mode 100644
index 000000000..08ab9ab97
--- /dev/null
+++ b/private/utils/ntbackup/inc/menumang.h
@@ -0,0 +1,107 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: menumang.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the MaynStream GUI Menu Manager (MM).
+
+ $Log: G:/UI/LOGFILES/MENUMANG.H_V $
+
+ Rev 1.10 14 May 1993 16:12:32 GLENN
+Fixed MM_IS_MENU_CLOSED for NT. The original NT documentation was wrong - online menu is right.
+
+ Rev 1.9 22 Apr 1993 16:01:54 GLENN
+Added file SORT option support.
+
+ Rev 1.8 09 Apr 1993 14:16:36 GLENN
+Added MM_MENUCLOSED for NT.
+
+ Rev 1.7 04 Oct 1992 19:47:48 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.6 15 Apr 1992 16:48:58 GLENN
+Added MM_ShowMenuStatusHelp() call to show status help only for valid menu IDs.
+
+ Rev 1.5 25 Feb 1992 17:10:12 DAVEV
+changed ntmenus.h to ommenus.h to reflect OEM_MSOFT purpose of file
+
+ Rev 1.4 25 Feb 1992 14:14:18 DAVEV
+Conditionally include 'ntmenus.h' for Win32/NT instead of 'menus.h'
+
+ Rev 1.3 12 Dec 1991 17:13:16 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.2 10 Dec 1991 15:52:10 STEVEN
+fix bug in pragma
+
+ Rev 1.1 02 Dec 1991 18:01:08 DAVEV
+16/32 bit Windows port changes
+
+ Rev 1.0 20 Nov 1991 19:38:30 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#ifndef SS_MM_H
+
+#define SS_MM_H
+
+#ifdef OEM_MSOFT
+# include "omMenus.h"
+#else
+# include "menus.h"
+#endif
+
+//NOTE: the definition of this macro will have to be changed for
+// WIN32! I'm not quite sure what the proper definition should be
+// right now, but this will work for now.
+
+#ifndef OS_WIN32
+
+#define MM_MENUCLOSED 0x0000FFFF
+#define MM_IS_MENU_CLOSED(mp1,mp2) (mp2==MM_MENUCLOSED)
+
+#else //case for WIN32 needed!
+
+#define MM_MENUCLOSED 0xFFFF
+#define MM_IS_MENU_CLOSED(mp1,mp2) (((mp2)==0)&&(HIWORD(mp1)==(WORD)MM_MENUCLOSED))
+
+#endif
+
+// MENU ITEM ENABLE BIT MASKS - for use with WinInfo.dwMenuState.
+
+#define MMDOC_TREEGROUP 0x0000000F
+#define MMDOC_FILEGROUP 0x000000F0
+#define MMDOC_SORTGROUP 0x00000F00
+
+#define MMDOC_TREEANDDIR 0x00000001
+#define MMDOC_TREEONLY 0x00000002
+#define MMDOC_DIRONLY 0x00000004
+
+#define MMDOC_NAMEONLY 0x00000010
+#define MMDOC_FILEDETAILS 0x00000020
+
+#define MMDOC_SORTNAME 0x00000100
+#define MMDOC_SORTTYPE 0x00000200
+#define MMDOC_SORTSIZE 0x00000400
+#define MMDOC_SORTDATE 0x00000800
+
+// MACROS
+
+#define MM_HasTreeMenu( x ) ( x & MMDOC_TREEGROUP )
+#define MM_HasViewMenu( x ) ( x & MMDOC_TREEGROUP )
+
+
+// FUNCTION PROTOTYPES
+
+VOID MM_Init ( HMENU );
+LPSTR MM_GetJobNameFromMenu ( WORD, LPSTR );
+BOOL MM_MenuCmdHandler ( HWND, WORD );
+VOID MM_ShowMenuStatusHelp ( WORD );
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/menus.h b/private/utils/ntbackup/inc/menus.h
new file mode 100644
index 000000000..91010075f
--- /dev/null
+++ b/private/utils/ntbackup/inc/menus.h
@@ -0,0 +1,141 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: menus.h
+
+ Description: This file contains the MENU IDs for the Maynstream GUI
+ project.
+
+ $Log: G:/UI/LOGFILES/MENUS.H_V $
+
+ Rev 1.8 22 Apr 1993 16:02:04 GLENN
+Added file SORT option support.
+
+ Rev 1.7 02 Apr 1993 14:00:08 GLENN
+Overhauled the numbering -- it really needed it.
+
+ Rev 1.6 10 Mar 1993 12:52:12 CARLS
+Changes to move Format tape to the Operations menu
+
+ Rev 1.5 04 Oct 1992 19:47:50 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 08 Sep 1992 15:51:12 DARRYLP
+Added Connect, Disconnect and Fonts items.
+
+ Rev 1.3 02 Mar 1992 11:29:08 DAVEV
+Added checking to disallow multiple inclusions of this file
+
+ Rev 1.2 10 Feb 1992 09:13:34 GLENN
+Changed Settings - Options to Settings - General.
+
+ Rev 1.1 07 Jan 1992 17:23:48 GLENN
+Added MDI split/slider support
+
+ Rev 1.0 20 Nov 1991 19:37:58 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#ifndef MENUS_H_INCL // Do not allow multiple inclusions of this file
+#define MENUS_H_INCL
+
+
+#define WINDOWSMENUPOSITION 7 // position of window menu.
+#define JOBSMENUPOSITION 5 // position of the jobs menu
+#define JOBSMENUSEPARATORPOS 1 // position of the jobs menu job names separator
+
+// MENU ID RANGES
+
+#define MM_ID_MIN 1000
+#define MM_ID_MAX 2999
+
+#define IDM_WINDOWSFIRSTCHILD 2000 // menu ID of the first MDI Child
+#define IDM_JOBSFIRSTJOB 2100 // menu ID of the first JOB
+#define IDM_JOBSLASTJOB 2199 // menu ID of the last JOB
+
+// MENU ID's
+
+#define IDRM_MAINMENU ID(1)
+
+#define IDM_FILE 1000
+#define IDM_FILEPRINT 1001
+#define IDM_FILESETUP 1002
+#define IDM_FILEEXIT 1003
+
+#define IDM_TREE 1100
+#define IDM_TREEEXPANDONE 1101
+#define IDM_TREEEXPANDBRANCH 1102
+#define IDM_TREEEXPANDALL 1103
+#define IDM_TREECOLLAPSEBRANCH 1104
+
+#define IDM_VIEW 1200
+#define IDM_VIEWTREEANDDIR 1201
+#define IDM_VIEWTREEONLY 1202
+#define IDM_VIEWDIRONLY 1203
+#define IDM_VIEWSPLIT 1204
+#define IDM_VIEWALLFILEDETAILS 1205
+#define IDM_VIEWSORTNAME 1206
+#define IDM_VIEWSORTTYPE 1207
+#define IDM_VIEWSORTSIZE 1208
+#define IDM_VIEWSORTDATE 1209
+#define IDM_VIEWFONT 1210
+
+#define IDM_OPERATIONS 1300
+#define IDM_OPERATIONSBACKUP 1301
+#define IDM_OPERATIONSRESTORE 1302
+#define IDM_OPERATIONSTRANSFER 1303
+#define IDM_OPERATIONSVERIFY 1304
+#define IDM_OPERATIONSINFO 1305
+#define IDM_OPERATIONSCATALOG 1306
+#define IDM_OPERATIONSCATMAINT 1307
+#define IDM_OPERATIONSSEARCH 1308
+#define IDM_OPERATIONSNEXTSET 1309
+#define IDM_OPERATIONSEJECT 1310
+#define IDM_OPERATIONSERASE 1311
+#define IDM_OPERATIONSRETENSION 1312
+#define IDM_OPERATIONSFORMAT 1313
+#define IDM_OPERATIONSCONNECT 1314
+#define IDM_OPERATIONSDISCON 1315
+
+#define IDM_SELECT 1400
+#define IDM_SELECTCHECK 1401
+#define IDM_SELECTUNCHECK 1402
+#define IDM_SELECTADVANCED 1403
+#define IDM_SELECTSUBDIRS 1404
+#define IDM_SELECTSAVE 1405
+#define IDM_SELECTUSE 1406
+#define IDM_SELECTDELETE 1407
+#define IDM_SELECTCLEAR 1408
+
+#define IDM_JOBS 1500
+#define IDM_JOBMAINTENANCE 1501
+
+#define IDM_SETTINGS 1600
+#define IDM_SETTINGSBACKUP 1601
+#define IDM_SETTINGSRESTORE 1602
+#define IDM_SETTINGSLOGGING 1603
+#define IDM_SETTINGSNETWORK 1604
+#define IDM_SETTINGSCATALOG 1605
+#define IDM_SETTINGSHARDWARE 1606
+#define IDM_SETTINGSDEBUGWINDOW 1607
+#define IDM_SETTINGSGENERAL 1608
+
+#define IDM_WINDOW 1700
+#define IDM_WINDOWSCASCADE 1701
+#define IDM_WINDOWSTILE 1702
+#define IDM_WINDOWSREFRESH 1703
+#define IDM_WINDOWSCLOSEALL 1704
+#define IDM_WINDOWSARRANGEICONS 1705
+
+#define IDM_HELP 1800
+#define IDM_HELPINDEX 1801
+#define IDM_HELPSEARCH 1802
+#define IDM_HELPUSINGHELP 1803
+#define IDM_HELPABOUTWINTERPARK 1804
+
+
+#endif // MENUS_H_INCL
+
diff --git a/private/utils/ntbackup/inc/message.h b/private/utils/ntbackup/inc/message.h
new file mode 100644
index 000000000..91a91c91b
--- /dev/null
+++ b/private/utils/ntbackup/inc/message.h
@@ -0,0 +1,16 @@
+#define IDD_JS_ABORT 123
+#define IDD_JS_BP 119
+#define IDD_JS_CF 136
+#define IDD_JS_DP 139
+#define IDD_JS_DRIVE 127
+#define IDD_JS_ET 121
+#define IDD_JS_FILE 141
+#define IDD_JS_FOLDER 138
+#define IDD_JS_FP 122
+#define IDD_JS_LINE1 125
+#define IDD_JS_LINE2 126
+#define IDD_JS_LISTBOX 131
+#define IDD_JS_NET_NAME 130
+#define IDD_JS_OK 120
+#define IDD_JS_SF 137
+
diff --git a/private/utils/ntbackup/inc/minmax.h b/private/utils/ntbackup/inc/minmax.h
new file mode 100644
index 000000000..1a8a6ffd6
--- /dev/null
+++ b/private/utils/ntbackup/inc/minmax.h
@@ -0,0 +1,27 @@
+/**
+
+ Unit: Tape Format
+
+ Name: minmax.h
+
+ Description: "Inline" functions (macros) for min, max
+
+ $Log: N:/LOGFILES/MINMAX.H_V $
+
+ Rev 1.0 10 Dec 1991 16:59:56 GREGG
+Initial revision.
+
+**/
+
+#if !defined( _MINMAX_H )
+#define _MINMAX_H
+
+#if !defined( MIN )
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+
+#if !defined( MAX )
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+#endif /* _MINMAX_H */
diff --git a/private/utils/ntbackup/inc/misc.h b/private/utils/ntbackup/inc/misc.h
new file mode 100644
index 000000000..90f4242fb
--- /dev/null
+++ b/private/utils/ntbackup/inc/misc.h
@@ -0,0 +1,27 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: misc.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/MISC.H_V $
+
+ Rev 1.1 04 Oct 1992 19:47:54 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:40:26 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _misc_h_
+#define _misc_h_
+
+CHAR g_disk( VOID ) ;
+INT16 s_disk( CHAR disk_letter ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/ms_qic.h b/private/utils/ntbackup/inc/ms_qic.h
new file mode 100644
index 000000000..5f54f85ee
--- /dev/null
+++ b/private/utils/ntbackup/inc/ms_qic.h
@@ -0,0 +1,7 @@
+#ifndef MS_QIC_RH
+
+#define MS_QIC_RH
+
+#define SES_ENG_MQ 0
+
+#endif
diff --git a/private/utils/ntbackup/inc/ms_scsi.h b/private/utils/ntbackup/inc/ms_scsi.h
new file mode 100644
index 000000000..f1ca30135
--- /dev/null
+++ b/private/utils/ntbackup/inc/ms_scsi.h
@@ -0,0 +1,7 @@
+#ifndef MS_SCSI_RH
+
+#define MS_SCSI_RH
+
+#define SES_ENG_MS 0
+
+#endif
diff --git a/private/utils/ntbackup/inc/msassert.h b/private/utils/ntbackup/inc/msassert.h
new file mode 100644
index 000000000..f90b73f3a
--- /dev/null
+++ b/private/utils/ntbackup/inc/msassert.h
@@ -0,0 +1,84 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: msassert.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: M:/LOGFILES/MSASSERT.H_V $
+ *
+ * Rev 1.8 04 Jan 1994 10:55:06 BARRY
+ * Don't pass expression to function
+ *
+ * Rev 1.7 16 Nov 1993 15:42:04 BARRY
+ * String pointers to assert functions are not CHAR_PTR, they are char *
+ *
+ * Rev 1.6 05 Mar 1993 09:57:10 MIKEP
+ * fix warning for cayman
+ *
+ * Rev 1.5 11 Nov 1992 22:09:46 GREGG
+ * Unicodeized literals.
+ *
+ * Rev 1.4 29 Jul 1992 15:26:20 STEVEN
+ * fix warnings
+ *
+ * Rev 1.3 23 Jul 1992 08:32:20 STEVEN
+ * fix warnings
+ *
+ * Rev 1.2 02 Dec 1991 12:42:58 STEVEN
+ * expresion is 32 bits in 32bit model, should be int not INT16
+ *
+ * Rev 1.1 16 May 1991 09:41:38 DAVIDH
+ * Cast no-op in msassert with a VOID -- clears up Watcom warnings.
+ *
+ * Rev 1.0 09 May 1991 13:32:30 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#if !defined( _msassert_h_ )
+#define _msassert_h_
+
+#if defined(MS_RELEASE)
+
+#if !defined(OS_WIN32)
+# pragma message( "Warning: No msassert code." )
+#endif
+
+/* define macros to no op */
+
+#define msassert(exp) (VOID) 0
+#define mscassert(exp) (VOID) 0
+
+#else
+
+/* Prototypes to the msassert functions */
+VOID msassert_func( char *exp_string, char *file_name, int line );
+VOID mscassert_func( char *exp_string, char *file_name );
+
+#if defined(MSDEBUG)
+
+
+#define msassert(exp) (VOID)((exp) || (msassert_func( #exp, __FILE__, __LINE__ ),0))
+#define mscassert(exp) (VOID)((exp) || (mscassert_func( #exp, __FILE__ ),0))
+
+#else
+#if !defined(OS_WIN32)
+# pragma message( "Warning: no expression strings in msassert code." )
+#endif
+
+#define msassert(exp) (VOID)((exp) || (msassert_func( "", __FILE__, __LINE__ ),0))
+#define mscassert(exp) (VOID)((exp) || (mscassert_func( "", __FILE__ ),0))
+
+#endif
+#endif
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/msg.h b/private/utils/ntbackup/inc/msg.h
new file mode 100644
index 000000000..3b236bb09
--- /dev/null
+++ b/private/utils/ntbackup/inc/msg.h
@@ -0,0 +1,30 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: msg.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/MSG.H_V $
+
+ Rev 1.1 04 Oct 1992 19:47:54 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:41:44 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _msg_h_
+#define _msg_h_
+
+VOID mprintf( CHAR_PTR, ... ) ;
+VOID mresprintf( INT16, ... ) ;
+
+VOID open_res_message( INT16 res_id, ... ) ;
+VOID open_message( CHAR_PTR fmt, ... ) ;
+VOID close_message( VOID ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/msgbox.h b/private/utils/ntbackup/inc/msgbox.h
new file mode 100644
index 000000000..9a037f2e4
--- /dev/null
+++ b/private/utils/ntbackup/inc/msgbox.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+JPW
+
+ Name: msgbox.h
+
+ Description: This header file contains defines and structure for
+ message box processing.
+
+ $Log: G:/UI/LOGFILES/MSGBOX.H_V $
+
+ Rev 1.8 04 Mar 1994 16:58:08 STEVEN
+prompt if disk is full
+
+ Rev 1.7 04 Oct 1992 19:47:56 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.6 23 Mar 1992 16:11:26 JOHNWT
+added WMMB_BUT2DEFAULT
+
+ Rev 1.5 22 Mar 1992 12:53:24 JOHNWT
+added WMMB_OKDISABLE
+
+ Rev 1.4 30 Jan 1992 11:41:32 JOHNWT
+moved WMMB_SYSMODAL from msgbox.c
+
+ Rev 1.3 21 Jan 1992 16:52:16 JOHNWT
+changed checkyy to noyycheck flag
+
+ Rev 1.2 24 Nov 1991 13:04:32 JOHNWT
+removed large font on inst line
+
+ Rev 1.1 21 Nov 1991 18:12:10 JOHNWT
+added yy flag check
+
+ Rev 1.0 20 Nov 1991 19:34:26 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef msgbox_h
+#define msgbox_h
+
+/* constants for the wType parameter */
+
+#define WMMB_OK 0x0001
+#define WMMB_RETRYCANCEL 0x0002
+#define WMMB_YESNO 0x0004
+#define WMMB_OKCANCEL 0x0008
+#define WMMB_CONTABORT 0x0010
+#define WMMB_CONTCANCEL 0x0020
+#define WMMB_OKDISABLE 0x0040
+#define WMMB_ABORTRETRYIGNOR 0x0080
+
+#define WMMB_BUT2DEFAULT 0x0400 /* make button 2 the default */
+#define WMMB_NOYYCHECK 0x0800 /* skip check of YY flag */
+#define WMMB_INSTBIG 0x1000 /* use big font for inst text */
+#define WMMB_MSGBIG 0x2000 /* use big font for message text */
+#define WMMB_MSGBIGBOLD 0x4000 /* use big/bold font for msg text */
+#define WMMB_SYSMODAL 0x8000 /* make system modal msg box */
+
+/* constants for the wIcon parameter */
+
+#define WMMB_ICONQUESTION 1
+#define WMMB_ICONSTOP 2
+#define WMMB_ICONINFORMATION 3
+#define WMMB_ICONEXCLAMATION 4
+
+/* constants for the return value from WM_MessageBox */
+
+#define WMMB_IDOK 1 /* affirmative answers */
+#define WMMB_IDRETRY 1
+#define WMMB_IDYES 1
+#define WMMB_IDCONTINUE 1
+
+#define WMMB_IDCANCEL 0 /* negative answers */
+#define WMMB_IDNO 0
+#define WMMB_IDABORT 0
+#define WMMB_IDDISABLE 0
+
+#define WMMB_IDIGNOR 2
+
+/* Function prototypes */
+
+INT WM_MsgBox ( LPSTR, LPSTR, WORD, WORD );
+INT WM_MessageBox ( CHAR_PTR, CHAR_PTR, WORD, WORD, CHAR_PTR, WORD, WORD );
+
+#endif
diff --git a/private/utils/ntbackup/inc/msgboxid.h b/private/utils/ntbackup/inc/msgboxid.h
new file mode 100644
index 000000000..510e369bf
--- /dev/null
+++ b/private/utils/ntbackup/inc/msgboxid.h
@@ -0,0 +1,31 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1992
+
+ Name:
+
+ Description: Contains dialog control id's for the generic message box
+
+ $Log: G:/UI/LOGFILES/MSGBOXID.H_V $
+
+ Rev 1.1 04 Oct 1992 19:47:58 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 07 Apr 1992 09:38:10 CHUCKB
+Initial revision.
+
+
+*****************************************************/
+
+#ifdef TRANSLATE
+#define IDD_MESSAGE_BOX 280
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_MSG_ICON 100
+#define IDD_MSG_TEXT 101
+#define IDD_MSG_INST 103
+#define IDD_MSG_BUT1 104
+#define IDD_MSG_BUT2 105
+#define IDD_MSG_BUT3 106
diff --git a/private/utils/ntbackup/inc/msii.h b/private/utils/ntbackup/inc/msii.h
new file mode 100644
index 000000000..1bcb61aca
--- /dev/null
+++ b/private/utils/ntbackup/inc/msii.h
@@ -0,0 +1,9 @@
+#ifndef MSII_RH
+
+#define MSII_RH
+
+#define SES_ENG_ERR 0
+#define SES_ENG_MSG 1
+#define SES_ENG_DBUG 2
+
+#endif
diff --git a/private/utils/ntbackup/inc/msinstal.h b/private/utils/ntbackup/inc/msinstal.h
new file mode 100644
index 000000000..4b9c9d712
--- /dev/null
+++ b/private/utils/ntbackup/inc/msinstal.h
@@ -0,0 +1,134 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: msinstal.h
+
+ Description: Include file for INSTALL.c
+
+ Location:
+
+
+ $Log: G:/UI/LOGFILES/MSINSTAL.H_V $
+
+ Rev 1.1 04 Oct 1992 19:48:00 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:38:10 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef MSINSTAL_H
+#define MSINSTAL_H
+
+/*
+ Define the subfunctions of install, and various types and
+ defines as required.
+*/
+
+#define MAXILINES 17
+#define MAXSLINES 8
+#define MAXELINES 8
+
+#define PARAGRAPHS_REQUESTED 5000
+
+#ifdef MAYN_OS2
+#define MAX_DISKETTES 5
+#else
+#define MAX_DISKETTES 6
+#endif
+
+#define LOOP 0
+#define NOT_DONE 1
+#define ERROR 2
+#define DONE 3
+
+#define FOUND 0
+#define NOT_FOUND 1
+#define ALREADY_INSTALLED 2
+
+#define NUM_LANG 7 /* Number of different languages supported */
+#define MAX_FILES_TO_COPY 50 /* somewhat arbitrary value */
+
+struct FILE_LIST_T
+{
+ CHAR_PTR name ;
+ INT16 found ;
+} ;
+
+/* operation values for oper and critcial error handler */
+
+VOID build_def_path( CHAR_PTR ) ;
+INT16 process_path( CHAR_PTR ) ;
+INT16 build_batch_files( CHAR_PTR , CHAR ) ;
+INT16 build_save_diskette( CHAR ) ;
+INT16 display_screen( WINDOW * wp, INT16 id, INT16 ( * get_input_func) ( WINDOW * ) ) ;
+INT16 process_screen( WINDOW *, CHAR_PTR [], INT16, INT16 ( * ) ( WINDOW * ) ) ;
+VOID write_window( WINDOW *, CHAR_PTR [], INT16 ) ;
+INT16 any_key_press( WINDOW * ) ;
+INT16 get_continue( WINDOW * ) ;
+BOOLEAN ask_y_n( WINDOW * ) ;
+BOOLEAN get_right_vol( CHAR_PTR first_file) ;
+INT16 copy_all_files( CHAR_PTR ) ;
+INT16 update_flist( struct FILE_LIST_T [], CHAR_PTR , INT16_PTR ) ;
+BOOLEAN flist_done( struct FILE_LIST_T [] ) ;
+VOID copy_config( FILE * from, FILE * to, INT16_PTR num_buff_ptr, INT16_PTR num_files_ptr ) ;
+INT16 await_exit( WINDOW_PTR wp ) ;
+INT16 get_drive( WINDOW * ) ;
+INT16 await_disk_change( WINDOW *) ;
+INT16 copy_to_diskette( CHAR_PTR ) ;
+BOOLEAN build_config_file( VOID ) ;
+INT16 build_save_autoexec( VOID ) ;
+INT16 await_output_disk( WINDOW *) ;
+VOID terminate( INT16, INT16 ) ;
+INT16 cbrk_handler( VOID ) ;
+INT16 get_retry( WINDOW * ) ;
+INT16 disk_err_handler( INT16, INT16, INT16, INT16 ) ;
+INT16 char_err_handler( INT16, CHAR_PTR ) ;
+VOID file_copy_error( INT16 ) ;
+INT16 get_install_opt2( WINDOW * ) ;
+INT16 get_install_opt3( WINDOW * ) ;
+/* INT16 help( CHAR_PTR, INT16, CHAR [] ) ; */
+INT16 get_backup_server_name( WINDOW_PTR wp ) ;
+/* VOID menu_help( INT16 i[], INT16 j ) ; */
+INT16 confirm_path( WINDOW * ) ;
+VOID append_ps2_list( VOID ) ;
+VOID printmes( INT16 ) ;
+VOID wprintmes( WINDOW *, INT16 ) ;
+BOOLEAN build_flist_for_copy( VOID ) ;
+VOID clean_screen( BOOLEAN error ) ;
+
+
+/*
+ Data defintions
+*/
+
+extern WINDOW *instruction_window ;
+extern WINDOW *status_window ;
+extern WINDOW *error_window ;
+
+extern struct FILE_LIST_T flist[] ;
+extern CHAR msii_path[] ; /* target path */
+extern CHAR bw_help_attr[] ;
+
+
+
+
+/* screen attributes */
+
+extern CHAR error_border[] ;
+extern CHAR menu_border[] ;
+extern INT16 misc_help_session[] ;
+
+/*
+#define NOMEM (-10)
+#define FRMBD (-11)
+#define NFILE (-12)
+#define NOTO (-13)
+#define NODISK (-14)
+#define FRMRD (-15)
+*/
+#define PASSWORD_OPTION 2
+
+#endif
diff --git a/private/utils/ntbackup/inc/mslreq.h b/private/utils/ntbackup/inc/mslreq.h
new file mode 100644
index 000000000..23a4ebf3e
--- /dev/null
+++ b/private/utils/ntbackup/inc/mslreq.h
@@ -0,0 +1,26 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+ Name: mslreq.h
+
+ Description: This contains the structure definition for the MSL request
+ structure. This is passed, filled in, to BuildTCB.
+
+ $Log: Q:/LOGFILES/MSLREQ.H_V $
+
+ Rev 1.0 17 Jul 1991 14:51:40 ED
+Initial revision.
+**/
+
+#include "stdtypes.h"
+
+typedef struct {
+ INT16 gen_func_code ; /* generic function code */
+ UINT8_PTR baddr ; /* buffer address */
+ UINT32 length ; /* length of buffer */
+ INT16 misc ; /* miscellaneous */
+ UINT32 parm1 ; /* misc param. */
+} MSL_REQUEST, *MSL_REQUEST_PTR ;
+
+
+
diff --git a/private/utils/ntbackup/inc/msmktemp.h b/private/utils/ntbackup/inc/msmktemp.h
new file mode 100644
index 000000000..771d22bc7
--- /dev/null
+++ b/private/utils/ntbackup/inc/msmktemp.h
@@ -0,0 +1,10 @@
+/*
+
+ $Log: T:/LOGFILES/MSMKTEMP.H_V $
+
+ Rev 1.0 14 Oct 1993 18:20:16 GREGG
+Initial revision.
+
+*/
+
+CHAR_PTR msmktemp( CHAR_PTR template ) ;
diff --git a/private/utils/ntbackup/inc/mtf.h b/private/utils/ntbackup/inc/mtf.h
new file mode 100644
index 000000000..29516a0fe
--- /dev/null
+++ b/private/utils/ntbackup/inc/mtf.h
@@ -0,0 +1,512 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: mtf.h
+
+ Description: Microsoft Tape Format v1.0 tape structure definitions
+ and attribute bit definitions.
+
+
+ $Log: T:/LOGFILES/MTF.H_V $
+
+ Rev 1.6 20 Jun 1993 16:19:56 GREGG
+Changed data encrypt bit def and replaced compr algor with vendor id in SSET.
+
+ Rev 1.5 26 Apr 1993 11:45:48 GREGG
+Seventh in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Changed handling of EOM processing during non-OTC EOS processing.
+
+Matches CHANNEL.H 1.17, MAYN40RD.C 1.60, TFWRITE.C 1.63, MTF.H 1.5,
+ TFLUTILS.C 1.44, MTF10WDB.C 1.10, MTF10WT.C 1.9
+
+ Rev 1.4 22 Apr 1993 03:31:38 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.3 19 Apr 1993 18:02:30 GREGG
+Second in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ Changes to write version 2 of OTC, and to read both versions.
+
+Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ mayn40.h 1.32, mtf.h 1.3.
+
+NOTE: There are additional changes to the catalogs needed to save the OTC
+ version and put it in the tpos structure before loading the OTC
+ File/Directory Detail. These changes are NOT listed above!
+
+ Rev 1.2 07 Dec 1992 10:20:26 GREGG
+Changes for tf ver moved to SSET, otc ver added to SSET and links added to FDD.
+
+ Rev 1.1 24 Nov 1992 18:18:50 GREGG
+Updates to match MTF document.
+
+ Rev 1.0 23 Nov 1992 14:25:14 GREGG
+Initial revision.
+
+**/
+
+#ifndef _MTF_H_
+#define _MTF_H_
+
+/**/
+/*
+ MTF Constants
+*/
+
+#define FORMAT_VER_MAJOR 1
+#define FORMAT_VER_MINOR 0
+
+#define TAPE_CATALOG_VER 2
+
+#define PW_ENCRYPT_NONE 0
+#define DATA_ENCRYPT_NONE 0
+#define COMPRESS_NONE 0
+#define ECC_NONE 0
+
+#define MTF10_OTC 1
+
+#define LOCAL_TZ 127
+
+
+/*
+ MTF Block Types
+*/
+
+#define MTF_TAPE_N "TAPE" /* Tape Header ID */
+#define MTF_VOLB_N "VOLB" /* Volume Control Block ID */
+#define MTF_SSET_N "SSET" /* Start of Backup Set Description Block ID */
+#define MTF_ESET_N "ESET" /* End of Backup Set Description Block ID */
+#define MTF_EOTM_N "EOTM" /* End of tape, continuation Block ID */
+#define MTF_DIRB_N "DIRB" /* Directory Descriptor Block ID */
+#define MTF_FILE_N "FILE" /* File Descriptor Block ID */
+#define MTF_CFIL_N "CFIL" /* Corrupt File Descriptor Block ID */
+#define MTF_ESPB_N "ESPB" /* End of Set Pad Block */
+#define MTF_SSES_N "SSES"
+#define MTF_ESES_N "ESES"
+
+
+/*
+ DBLK Block Attributes
+
+ The lower 16 bits are reserved for general attribute bits (those
+ which may appear in more than one type of DBLK), the upper 16 are
+ for attributes which are specific to one type of DBLK.
+
+ Note that the block specific bit definitions overlap, and the block
+ type is used to determine the meaning of a given bit.
+*/
+
+/* General : */
+#define MTF_DB_CONT_BIT 0x00000001UL
+#define MTF_DB_COMPRESS_BIT 0x00000004UL
+#define MTF_DB_EOS_AT_EOM_BIT 0x00000008UL
+#define MTF_DB_VAR_BLKS_BIT 0x00000010UL
+#define MTF_DB_SESSION_BIT 0x00000020UL
+
+/* THDR : */
+#define MTF_DB_SM_EXISTS 0x00010000UL
+#define MTF_DB_FDD_ALLOWED 0x00020000UL
+#define MTF_DB_SM_ALT_OVERWRITE 0x00040000UL
+#define MTF_DB_FDD_ALT_PART 0x00080000UL
+#define MTF_DB_SM_ALT_APPEND 0x00200000UL
+
+/* SSET : */
+#define MTF_DB_FDD_EXISTS 0x00010000UL
+#define MTF_DB_ENCRYPT_BIT 0x00020000UL
+
+/* ESET : */
+#define MTF_DB_FDD_ABORTED_BIT 0x00010000UL
+#define MTF_DB_END_OF_FAMILY_BIT 0x00020000UL
+#define MTF_DB_ABORTED_SET_BIT 0x00040000UL
+#define MTF_DB_SET_VERIFIED_BIT 0x00080000UL
+
+/* EOTM : */
+#define MTF_DB_NO_ESET_PBA 0x00010000UL
+#define MTF_DB_INVALID_ESET_PBA 0x00020000UL
+
+
+/* Turn on packing here. Need to be sure that date is packed. */
+#pragma pack(1)
+
+/**/
+/*
+ Compressed date structure for storing dates in minimal space on tape:
+
+ BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4
+ 76543210 76543210 76543210 76543210 76543210
+ yyyyyyyy yyyyyymm mmdddddh hhhhmmmm mmssssss
+*/
+typedef struct {
+ UINT8 dt_field[5] ;
+} MTF_DATE_TIME, * MTF_DATE_TIME_PTR ;
+
+
+/**/
+/*
+ Tape Address
+*/
+typedef struct {
+ UINT16 data_size; /* Size of the data */
+ UINT16 data_offset; /* Offset to the data */
+} MTF_TAPE_ADDRESS, * MTF_TAPE_ADDRESS_PTR;
+
+
+/**/
+/*
+ Stream Header
+*/
+typedef struct {
+ UINT32 id ; /* Identifier for stream */
+ UINT16 fs_attribs ; /* FileSystem Attribute */
+ UINT16 tf_attribs ; /* TapeFormat Attributes */
+ UINT64 data_length ; /* Offset to stream */
+ UINT16 encr_algor ; /* Data encryption algorithm */
+ UINT16 comp_algor ; /* Data compression algorithm */
+ UINT16 chksum ; /* Checksum */
+} MTF_STREAM, * MTF_STREAM_PTR ;
+
+
+/**/
+/*
+ Common DBLK Header
+*/
+typedef struct {
+ UINT8 block_type[4] ; /* Unique identifier, see above */
+ UINT32 block_attribs ; /* Common attributes for this block */
+ UINT16 offset_to_data ; /* Offset to data associated with this
+ DBLK, or offset to next DBLK or
+ filemark if there is no associated
+ data.
+ */
+ UINT8 machine_os_id ; /* Machine/OS id where written, low byte */
+ UINT8 machine_os_version ; /* Machine/OS id where written, high byte */
+ UINT64 displayable_size ; /* Displayable data size */
+ UINT64 logical_block_address ; /* Logical blk address relative to SSET */
+ UINT64 session_id ; /* For interleaved streams */
+ UINT32 control_block_id ; /* Used for error recovery */
+
+ UINT8 reserved[4] ; /* Was offset to string storage */
+ MTF_TAPE_ADDRESS os_specific_data ; /* Size and offset of OS specific stuff */
+ UINT8 string_type ; /* ASCII, Unicode, etc. */
+ UINT8 pad ; /* For alignment purposes */
+ UINT16 hdr_chksm ; /* Checksum of the block header. The
+ algorithm is: XOR each word preceeding
+ this one and store the result here.
+ (When the checksum is verified the
+ 'block_type' is also checked for a
+ non-zero value.
+ */
+} MTF_DB_HDR, * MTF_DB_HDR_PTR ;
+
+
+/**/
+/*
+ Tape Header DBLK (TAPE)
+*/
+typedef struct {
+ MTF_DB_HDR block_header;
+ UINT32 tape_id_number ;
+ UINT32 tape_attributes ;
+ UINT16 tape_seq_number ;
+ UINT16 password_encryption_algor;
+ UINT16 ecc_algorithm ;
+ UINT16 tape_catalog_type ;
+ MTF_TAPE_ADDRESS tape_name ;
+ MTF_TAPE_ADDRESS tape_description ;
+ MTF_TAPE_ADDRESS tape_password ;
+ MTF_TAPE_ADDRESS software_name ;
+ UINT16 logical_block_size ;
+ UINT16 software_vendor_id ;
+ MTF_DATE_TIME tape_date ;
+ UINT8 tf_major_ver ;
+} MTF_TAPE, * MTF_TAPE_PTR;
+
+
+/**/
+/*
+ Start of Set DBLK (SSET)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 sset_attribs ;
+ UINT16 password_encryption_algor ;
+ UINT16 data_encryption_algor ;
+ UINT16 software_vendor_id ;
+ UINT16 backup_set_number ;
+ MTF_TAPE_ADDRESS backup_set_name ;
+ MTF_TAPE_ADDRESS backup_set_description ;
+ MTF_TAPE_ADDRESS backup_set_password ;
+ MTF_TAPE_ADDRESS user_name ;
+ UINT64 physical_block_address ;
+ MTF_DATE_TIME backup_date ;
+ UINT8 software_ver_mjr ;
+ UINT8 software_ver_mnr ;
+ INT8 time_zone ;
+ UINT8 tf_minor_ver ;
+ UINT8 tape_cat_ver ;
+} MTF_SSET, * MTF_SSET_PTR ;
+
+
+/**/
+/*
+ Volume DBLK (VOLB)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 volume_attribs ;
+ MTF_TAPE_ADDRESS device_name ;
+ MTF_TAPE_ADDRESS volume_name ;
+ MTF_TAPE_ADDRESS machine_name ;
+ MTF_DATE_TIME backup_date ;
+} MTF_VOL, * MTF_VOL_PTR ;
+
+
+/**/
+/*
+ Directory DBLK (DIRB)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 directory_attribs ;
+ MTF_DATE_TIME last_mod_date ;
+ MTF_DATE_TIME create_date ;
+ MTF_DATE_TIME backup_date ;
+ MTF_DATE_TIME last_access_date ;
+ UINT32 directory_id ;
+ MTF_TAPE_ADDRESS directory_name ;
+} MTF_DIR, * MTF_DIR_PTR ;
+
+
+/**/
+/*
+ File DBLK (FILE)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 file_attributes ;
+ MTF_DATE_TIME last_mod_date ;
+ MTF_DATE_TIME create_date ;
+ MTF_DATE_TIME backup_date ;
+ MTF_DATE_TIME last_access_date ;
+ UINT32 directory_id ;
+ UINT32 file_id ;
+ MTF_TAPE_ADDRESS file_name ;
+} MTF_FILE, * MTF_FILE_PTR ;
+
+
+/**/
+/*
+ Corrupt File DBLK (CFIL)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 corrupt_file_attribs ;
+ UINT32 file_id ;
+ UINT32 directory_id ;
+ UINT64 stream_offset ;
+ UINT16 corrupt_stream_number ;
+} MTF_CFIL, * MTF_CFIL_PTR ;
+
+
+/**/
+/*
+ Start of Set DBLK (ESET)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+ UINT32 eset_attribs ;
+ UINT32 corrupt_file_count ;
+ UINT64 set_map_phys_blk_adr ;
+ UINT64 fdd_phys_blk_adr ;
+ UINT16 fdd_tape_seq_number ;
+ UINT16 backup_set_number ;
+ MTF_DATE_TIME backup_date ;
+} MTF_ESET, * MTF_ESET_PTR ;
+
+
+/**/
+/*
+ End of Tape DBLK (EOTM)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr;
+ UINT64 eset_phys_blk_adr ;
+} MTF_EOTM, * MTF_EOTM_PTR;
+
+
+/**/
+/*
+ End of Set Pad DBLK (ESPB)
+*/
+typedef struct {
+ MTF_DB_HDR block_hdr ;
+} MTF_ESPB, * MTF_ESPB_PTR ;
+
+
+
+/***************************************************************************\
+
+ MTF On Tape Catalog Structures
+
+\***************************************************************************/
+
+/**/
+/*
+ Set Map Header
+*/
+typedef struct {
+ UINT32 family_id ;
+ UINT16 num_set_recs ;
+ UINT8 pad[2] ;
+} MTF_SM_HDR, * MTF_SM_HDR_PTR ;
+
+
+/**/
+/*
+ Set Map Entry
+*/
+typedef struct {
+ UINT16 length ;
+ UINT16 seq_num ;
+ UINT32 blk_attribs ;
+ UINT32 set_attribs ;
+ UINT64 sset_pba ;
+ UINT64 fdd_pba ;
+ UINT16 fdd_seq_num ;
+ UINT16 set_num ;
+ UINT64 lba ;
+ UINT32 num_dirs ;
+ UINT32 num_files ;
+ UINT32 num_corrupt_files ;
+ UINT64 disp_size ;
+ UINT16 num_volumes ;
+ UINT16 pswd_encr_algor ;
+ MTF_TAPE_ADDRESS set_name ;
+ MTF_TAPE_ADDRESS password ;
+ MTF_TAPE_ADDRESS set_descr ;
+ MTF_TAPE_ADDRESS user_name ;
+ MTF_DATE_TIME backup_date ;
+ INT8 time_zone ;
+ UINT8 os_id ;
+ UINT8 os_ver ;
+ UINT8 string_type ;
+ UINT8 tf_minor_ver ;
+ UINT8 tape_cat_ver ;
+} MTF_SM_ENTRY, * MTF_SM_ENTRY_PTR ;
+
+
+/**/
+/*
+ File / Directory Detail Common Header
+*/
+typedef struct {
+ UINT16 length ;
+ UINT8 type[4] ;
+ UINT16 seq_num ;
+ UINT32 blk_attribs ;
+ UINT64 lba ;
+ UINT64 disp_size ;
+ INT32 link ;
+ UINT8 os_id ;
+ UINT8 os_ver ;
+ UINT8 string_type ;
+ UINT8 pad ;
+} MTF_FDD_HDR, * MTF_FDD_HDR_PTR ;
+
+
+/**/
+/*
+ File / Directory Detail and Set Map Volume Entry
+*/
+typedef struct {
+ UINT32 vol_attribs ;
+ MTF_TAPE_ADDRESS device_name ;
+ MTF_TAPE_ADDRESS vol_name ;
+ MTF_TAPE_ADDRESS machine_name ;
+ MTF_DATE_TIME backup_date ;
+} MTF_FDD_VOL_V1, * MTF_FDD_VOL_V1_PTR ;
+
+typedef struct {
+ UINT32 vol_attribs ;
+ MTF_TAPE_ADDRESS device_name ;
+ MTF_TAPE_ADDRESS vol_name ;
+ MTF_TAPE_ADDRESS machine_name ;
+ MTF_TAPE_ADDRESS os_info ;
+ MTF_DATE_TIME backup_date ;
+} MTF_FDD_VOL_V2, * MTF_FDD_VOL_V2_PTR ;
+
+
+/**/
+/*
+ File / Directory Detail Directory Entry
+*/
+typedef struct {
+ MTF_DATE_TIME last_mod_date ;
+ MTF_DATE_TIME create_date ;
+ MTF_DATE_TIME backup_date ;
+ MTF_DATE_TIME last_access_date ;
+ UINT32 dir_attribs ;
+ MTF_TAPE_ADDRESS dir_name ;
+} MTF_FDD_DIR_V1, * MTF_FDD_DIR_V1_PTR ;
+
+typedef struct {
+ MTF_DATE_TIME last_mod_date ;
+ MTF_DATE_TIME create_date ;
+ MTF_DATE_TIME backup_date ;
+ MTF_DATE_TIME last_access_date ;
+ UINT32 dir_attribs ;
+ MTF_TAPE_ADDRESS dir_name ;
+ MTF_TAPE_ADDRESS os_info ;
+} MTF_FDD_DIR_V2, * MTF_FDD_DIR_V2_PTR ;
+
+
+/**/
+/*
+ File / Directory Detail File Entry
+*/
+typedef struct {
+ MTF_DATE_TIME last_mod_date ;
+ MTF_DATE_TIME create_date ;
+ MTF_DATE_TIME backup_date ;
+ MTF_DATE_TIME last_access_date ;
+ UINT32 file_attribs ;
+ MTF_TAPE_ADDRESS file_name ;
+} MTF_FDD_FILE_V1, * MTF_FDD_FILE_V1_PTR ;
+
+typedef struct {
+ MTF_DATE_TIME last_mod_date ;
+ MTF_DATE_TIME create_date ;
+ MTF_DATE_TIME backup_date ;
+ MTF_DATE_TIME last_access_date ;
+ UINT32 file_attribs ;
+ MTF_TAPE_ADDRESS file_name ;
+ MTF_TAPE_ADDRESS os_info ;
+} MTF_FDD_FILE_V2, * MTF_FDD_FILE_V2_PTR ;
+
+
+/* Turn packing back to what was specified on command line, or default
+ packing.
+*/
+#pragma pack()
+
+#endif
diff --git a/private/utils/ntbackup/inc/mui.h b/private/utils/ntbackup/inc/mui.h
new file mode 100644
index 000000000..d56996795
--- /dev/null
+++ b/private/utils/ntbackup/inc/mui.h
@@ -0,0 +1,154 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: mui.h
+
+ Description: This file describes all the APIs and data structures
+ kept by the MaynStream User Interface (MUI) functions.
+
+ $Log: G:\ui\logfiles\mui.h_v $
+
+ Rev 1.22 21 Jul 1993 16:55:24 GLENN
+Added operation queing support.
+
+ Rev 1.21 15 Jul 1993 14:47:26 CARLS
+added skipno.h
+
+ Rev 1.20 30 Apr 1993 17:59:20 Aaron
+Removed OS_WIN32 condition on inclusion of ombatch.h
+
+ Rev 1.19 02 Apr 1993 13:52:24 GLENN
+Added MUI_IsInfoAvailable() and MUI_SetInfoAvailable().
+
+ Rev 1.18 11 Mar 1993 13:27:38 STEVEN
+add batch
+
+ Rev 1.17 20 Oct 1992 14:20:22 MIKEP
+add support for getcurrentoperation
+
+ Rev 1.16 04 Oct 1992 19:48:04 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.15 10 Sep 1992 17:21:20 GLENN
+Added MUI_IsTapeValid().
+
+ Rev 1.14 27 Jun 1992 10:49:14 MIKEP
+ move qtc.h to bengine.h
+
+ Rev 1.13 29 May 1992 16:05:20 JOHNWT
+PCH updates
+
+ Rev 1.12 19 May 1992 09:27:34 MIKEP
+mo changes
+
+ Rev 1.11 15 May 1992 13:38:30 MIKEP
+nt pass 2
+
+ Rev 1.10 14 May 1992 17:39:54 MIKEP
+nt pass2
+
+ Rev 1.9 11 May 1992 14:27:40 DAVEV
+OEM_MSOFT: modifications for batch command line support
+
+ Rev 1.8 07 Apr 1992 10:37:02 GLENN
+Added a call back when there is a system change. (future)
+
+ Rev 1.7 20 Mar 1992 17:24:50 GLENN
+Split out selection bar/ribbon stuff into muibar.c/h
+
+ Rev 1.6 03 Mar 1992 17:26:12 GLENN
+Added return type to MUI_StartOperation().
+
+ Rev 1.5 06 Feb 1992 11:38:28 CHUCKB
+No change.
+
+ Rev 1.4 06 Feb 1992 11:32:36 CHUCKB
+No change.
+
+ Rev 1.3 31 Jan 1992 12:54:42 GLENN
+Changed chkwh.h to hwcheck.h.
+
+ Rev 1.2 07 Jan 1992 17:22:00 GLENN
+Added header
+
+ Rev 1.1 04 Dec 1991 18:14:04 GLENN
+
+ Rev 1.0 20 Nov 1991 19:40:36 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef MUI_H
+#define MUI_H
+
+#include "stats.h"
+#include "tape.h"
+#include "muiconf.h"
+#include "muiutil.h"
+#include "muibar.h"
+#include "rm.h"
+#include "res_io.h"
+#include "script.h"
+#include "log.h"
+#include "script_p.h"
+#include "scriperr.h"
+#include "error.h"
+#include "tbe_defs.h"
+#include "hwcheck.h"
+#include "details.h"
+#include "do_misc.h"
+#include "status.h"
+#include "global.h"
+#include "vlm.h"
+#include "std_err.h"
+#include "msii.h"
+#include "eng_msg.h"
+#include "eng_err.h"
+#include "do_misc.h"
+#include "be_init.h"
+#include "debug.h"
+#include "genstat.h"
+#include "jobstat.h"
+#include "polldrv.h"
+#include "password.h"
+#include "pdtypes.h"
+#include "vlm_find.h"
+#include "schedule.h"
+#include "d_o_bkup.h"
+#include "d_o_rset.h"
+#include "filerepl.h"
+#include "skipno.h"
+#include "ld_dvr.h"
+#include "lstdres.h"
+#include "hwconf.h"
+#include "dlm_prv.h"
+#include "dateutil.h"
+#include "jobs.h"
+#include "ombatch.h"
+
+BOOL MUI_Init ( VOID );
+VOID MUI_Deinit ( VOID );
+BOOL MUI_DisableOperations ( WORD );
+BOOL MUI_EnableOperations ( WORD );
+BOOL MUI_StartOperation ( WORD, BOOL );
+VOID MUI_ActivateDocument ( WORD );
+BOOL MUI_ProcessCommandLine ( LPSTR, INT * );
+VOID MUI_TapeInDrive ( BOOL );
+BOOL MUI_IsTapeInDrive ( VOID );
+BOOL MUI_IsTapeValid ( VOID );
+BOOL MUI_IsEjectSupported ( VOID );
+BOOL MUI_IsRetensionSupported ( VOID );
+BOOL MUI_IsInfoAvailable ( VOID );
+VOID MUI_SetInfoAvailable ( BOOL );
+VOID MUI_AdvancedSelections ( VOID );
+VOID MUI_UISystemChange ( VOID );
+
+BOOL MUI_QueueOperation ( UINT );
+VOID MUI_ReleaseQueuedOperation ( VOID );
+BOOL MUI_AnyQueuedOperations ( VOID );
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/muibar.h b/private/utils/ntbackup/inc/muibar.h
new file mode 100644
index 000000000..13abb38f6
--- /dev/null
+++ b/private/utils/ntbackup/inc/muibar.h
@@ -0,0 +1,31 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: muibar.h
+
+ Description: This file describes all the APIs and data structures
+ kept by the MaynStream User Interface (MUI) selection
+ bar functions.
+
+ $Log: G:/UI/LOGFILES/MUIBAR.H_V $
+
+ Rev 1.1 04 Oct 1992 19:48:06 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Mar 1992 17:25:06 GLENN
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef MUIBAR_H
+#define MUIBAR_H
+
+HRIBBON MUI_MakeMainRibbon ( VOID );
+VOID MUI_SetOperationButtons ( WORD );
+VOID MUI_SetActionButtons ( WORD );
+VOID MUI_SetButtonState ( WORD, WORD );
+
+#endif
diff --git a/private/utils/ntbackup/inc/muiconf.h b/private/utils/ntbackup/inc/muiconf.h
new file mode 100644
index 000000000..c1a4ff55e
--- /dev/null
+++ b/private/utils/ntbackup/inc/muiconf.h
@@ -0,0 +1,1376 @@
+/******************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: muiconf.h
+
+ Description:
+
+ $Log: J:\ui\logfiles\muiconf.h_v $
+
+ Rev 1.52.1.2 28 Jan 1994 11:17:20 GREGG
+More warning fixes.
+
+ Rev 1.52.1.1 24 Nov 1993 14:58:00 BARRY
+Fixed Unicode bugs; made font names bigger
+
+ Rev 1.52.1.0 04 Nov 1993 15:44:56 STEVEN
+japanese changes
+
+ Rev 1.52 23 Jul 1993 15:54:20 GLENN
+Added Flag to the ECC read and write macros.
+
+ Rev 1.51 23 Jul 1993 12:20:12 GLENN
+Added Sytron ECC and Drive Settling Time support.
+
+ Rev 1.50 22 Jul 1993 19:11:48 MARINA
+enable c++
+
+ Rev 1.49 21 Jul 1993 17:03:56 GLENN
+Changed the poll drive default frequency from 2 to 1.
+
+ Rev 1.48 19 Jul 1993 09:54:24 CARLS
+change for UseTapeCatalogs
+
+ Rev 1.47 16 Jul 1993 10:40:56 GLENN
+Added UseTapeCatalog and SortOptions support.
+
+ Rev 1.46 30 Jun 1993 16:01:38 CARLS
+added things for UseTapeCatalogs
+
+ Rev 1.45 09 Jun 1993 15:10:00 MIKEP
+enable c++
+
+ Rev 1.44 07 Jun 1993 10:11:12 chrish
+Nostradamus EPR 0490 - Added source to fix command line /r switch.
+
+Added "cmd_line_restrict_access" to the CDS structure, flag set when the /r
+is passed on the command line backup.
+
+Added the two macros below for the /r switch on the command line backup.
+ #define CDS_GetCmdLineRestrictAccess( x )
+ #define CDS_SetCmdLineRestrictAccess( x, v )
+
+ Rev 1.43 07 Jun 1993 10:05:54 GLENN
+Set User and Catalog data paths default to null strings.
+
+ Rev 1.42 18 May 1993 15:05:08 GLENN
+Added tape settling time to hardware data structure.
+
+ Rev 1.41 06 May 1993 17:53:06 KEVINS
+Added s/w, h/w compression, and fixes.
+
+ Rev 1.40 30 Apr 1993 15:56:38 GLENN
+Added INI command line support. Added Data Path setting support.
+
+ Rev 1.39 27 Apr 1993 11:25:08 GLENN
+Added Search tapes with password, Search subdirs, log file prefix.
+
+ Rev 1.38 19 Apr 1993 15:14:34 GLENN
+Fixed FontCaseFAT default, RestoreExistingFiles default.
+
+ Rev 1.37 05 Apr 1993 13:35:04 GLENN
+Changed debug msgs kept from 35 to 150 for MikeP.
+
+ Rev 1.36 28 Jan 1993 16:02:16 STEVEN
+added erase_format
+
+ Rev 1.35 06 Jan 1993 10:19:44 GLENN
+Changed prototype name.
+
+ Rev 1.34 04 Jan 1993 14:40:04 GLENN
+Added File Details and Search Limit items.
+
+ Rev 1.33 23 Dec 1992 15:42:38 GLENN
+Added all file details, runtime dlg pos saving, search limit, FAT drive lower case display.
+
+ Rev 1.32 18 Nov 1992 13:28:12 GLENN
+Changed the INT16 in WINSIZE to INT.
+
+ Rev 1.31 01 Nov 1992 16:31:30 DAVEV
+Unicode changes
+
+ Rev 1.30 30 Oct 1992 15:48:30 GLENN
+Added Frame and MDI Doc window size and position saving and restoring.
+
+ Rev 1.29 14 Oct 1992 15:54:50 GLENN
+Added Font selection to Config and INI.
+
+ Rev 1.28 04 Oct 1992 19:48:10 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.27 02 Oct 1992 16:27:42 STEVEN
+Added BACKUP_DAILY ID.
+
+ Rev 1.26 06 Aug 1992 22:00:30 MIKEP
+add support for tape drive name for nt
+
+ Rev 1.25 29 Jul 1992 14:25:38 GLENN
+ChuckB checked in after NT fixes.
+
+ Rev 1.24 30 Jun 1992 13:01:58 JOHNWT
+added Enable Statistics
+
+ Rev 1.23 19 May 1992 09:27:36 MIKEP
+mo changes
+
+ Rev 1.22 17 Apr 1992 09:20:20 JOHNWT
+added set of BE catalog level
+
+ Rev 1.21 23 Mar 1992 11:54:34 GLENN
+Added bad data and catalog path warning support.
+
+ Rev 1.20 20 Mar 1992 17:21:52 GLENN
+Added std mode warning config option.
+
+ Rev 1.19 27 Feb 1992 11:17:38 JOHNWT
+wait/skip files change
+
+ Rev 1.18 27 Feb 1992 08:15:16 GLENN
+Added SetupExePath and ChangeToExeDir.
+
+ Rev 1.17 23 Feb 1992 14:02:22 GLENN
+Converted GetString/SaveString macros to functions.
+
+ Rev 1.16 18 Feb 1992 18:49:44 GLENN
+Added support routines for auto min/max/restore of MDI docs before/after an operation/
+
+ Rev 1.15 11 Feb 1992 17:35:46 GLENN
+Rearranged variables in conf stuct - to make more sense.
+
+ Rev 1.14 03 Feb 1992 14:35:30 GLENN
+Removed debug flag min/max range limits. It is amask of flags.
+
+ Rev 1.13 03 Feb 1992 14:12:12 JOHNWT
+corrected skip min/max
+
+ Rev 1.12 31 Jan 1992 15:05:26 GLENN
+In process of changing to consolidate skipped files/wait time.
+
+ Rev 1.11 24 Jan 1992 13:48:20 JOHNWT
+changed def launcher timeout to 60
+
+ Rev 1.10 20 Jan 1992 09:43:20 GLENN
+Moved some defines to appdefs.h.
+
+ Rev 1.9 16 Jan 1992 16:48:40 JOHNWT
+added min/max macros
+
+ Rev 1.8 16 Jan 1992 14:59:38 GLENN
+Added restore types.
+
+ Rev 1.7 14 Jan 1992 08:14:00 GLENN
+Added Sort BSD support.
+
+ Rev 1.6 07 Jan 1992 17:27:04 GLENN
+Added catalog data path support
+
+ Rev 1.5 04 Dec 1991 18:17:12 GLENN
+Added machine type macros.
+
+ Rev 1.4 03 Dec 1991 16:32:30 JOHNWT
+added CDS_GetFastFileRestore
+
+ Rev 1.3 22 Nov 1991 13:35:38 DAVEV
+Removed 16-32 bit changes for now - there is a problem with the order in which files are included
+
+ Rev 1.2 22 Nov 1991 11:29:22 DAVEV
+removed $end from muiconf.h
+
+ Rev 1.1 22 Nov 1991 09:42:46 DAVEV
+Added prototype for CDS_SaveCDS. Also changes for 16-32-bit Windows port.
+
+ Rev 1.0 20 Nov 1991 19:40:22 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef _muiconf_h_
+#define _muiconf_h_
+
+#include <stdio.h>
+
+#include "appdefs.h"
+#include "proddefs.h"
+#include "beconfig.h"
+
+// Since some systems define max and min as functions instead of macros,
+// define a macro for our own max and min macros here.
+
+#define CDS_MIN(x,y) ((x) < (y) ? (x) : (y))
+#define CDS_MAX(x,y) ((x) > (y) ? (x) : (y))
+
+#define DLL_EXTENSION TEXT(".DLL")
+
+// SKIP open files IDs
+
+#define SKIP_NO 0
+#define SKIP_YES 1
+#define SKIP_NO_TIMED 2
+
+#define CDS_STRLEN 255
+
+
+#define MAXTAPEDRIVENAME 80
+
+#define MAXFILENAME 14
+#define MAXDIRNAME 64
+#define MAX_MAYN_FOLDER_SIZE 84
+
+/* enable/disable values */
+#define CDS_DISABLE 0
+#define CDS_ENABLE 1
+#define CDS_UNKNOWN -1
+
+/* erase flag values */
+#define ERASE_OFF 0
+#define ERASE_ON 1
+#define ERASE_LONG 2
+#define ERASE_FMARK 3
+#define ERASE_FORMAT 4
+
+/* log mode options */
+#define LOG_OVERWRITE 0
+#define LOG_APPEND 1
+
+/* output dest */
+#define LOG_NOWHERE 0
+#define LOG_TO_PRINTER 1
+#define LOG_TO_FILE 2
+
+/* log print options */
+#define LOG_PRINT_OFF 0
+#define LOG_PRINT_ON 1
+#define LOG_PRINT_PROMPT 2
+
+/* Log levels */
+#define LOG_DISABLED 0
+#define LOG_ERRORS 1
+#define LOG_DIRS 2
+#define LOG_FILES 3
+#define LOG_DETAIL 4
+
+/* Hardware compression type */ // chs:05-04-93
+#define HW_COMP_DISABLE 0 // chs:05-04-93
+#define HW_COMP_ENABLE 1 // chs:05-04-93
+
+/* Software compression type */ // chs:05-04-93
+#define SW_COMP_DISABLE 0 // chs:05-04-93
+#define SW_COMP_ENABLE 1 // chs:05-04-93
+
+/* Number of sessions to keep */
+#define LOG_DEF_LOGFILES 5
+#define LOG_MIN_LOGFILES 0
+#define LOG_MAX_LOGFILES 100
+
+/* yes flags */
+#define NO_FLAG 0
+#define YES_FLAG 1
+#define YESYES_FLAG 2
+
+/* Auto verify types */
+#define NO_VERIFY_AFTER 0
+#define DO_VERIFY_AFTER 1
+#define PROMPT_VERIFY_AFTER 2
+
+/* command line values */
+#define TMENU_COMMAND_LINE_PROCESSED 0
+#define TMENU_SAVE_MODE 1
+
+/* cataloging levels */
+#define CATALOGS_NONE 0
+#define CATALOGS_PARTIAL 1
+#define CATALOGS_FULL 2
+
+/* network types */
+#define NO_NETWORK 0
+#define NOVELL_NET 1
+#define THREE_COM_NET 2
+#define IBM_PC_NET 3
+#define SOME_NET 4
+
+/* restore types */
+#define RESTORE_OVER_EXISTING 0
+#define NO_RESTORE_OVER_EXISTING 1
+#define PROMPT_RESTORE_OVER_EXISTING 2
+#define NO_RESTORE_OVER_RECENT 3
+#define PROMPT_RESTORE_OVER_RECENT 4
+
+/* backup types */
+#define BACKUP_NORMAL 1
+#define BACKUP_COPY 2
+#define BACKUP_DIFF 3
+#define BACKUP_INCR 4
+#define BACKUP_DAILY 5
+
+/* pwdb min/default */
+#define PWDB_MIN_ENTRIES 5
+#define PWDB_DEF_ENTRIES 50
+
+/* skip wait time min/def */
+#define SKIP_MIN_TIME 0
+#define SKIP_DEF_TIME 30
+
+/* launcher min/def time-out */
+#define LAUNCHER_MIN_TIME 30
+#define LAUNCHER_DEF_TIME 60
+
+/* Poll drive min frequency */
+#define POLL_MIN_FREQ 1
+#define POLL_DEF_FREQ 1
+
+#define MIN_DRIVE_SETTLING_TIME 1
+#define MAX_DRIVE_SETTLING_TIME 300
+#define DEF_DRIVE_SETTLING_TIME 60
+
+
+/* tape defaults */
+#define TAPE_BUFS_DEFAULT 9
+#define TAPE_FORMAT_DEFAULT 0
+
+/* Definition of Special Word values */
+#define NOTHING_SPECIAL 0x0000
+#define CREATE_FLOPPY_DLES 0x0002
+#define IGNORE_MAYNARD_ID 0x0020
+#define FAST_TDEMO 0x4000
+
+#define MAX_CONTRLS 5
+#define MAX_DEF 2
+
+/* DEVICE DRIVER BUFFER SIZE */
+
+#define DRIVER_SIZE 9
+
+/* BUFFER SIZE DEFAULTS */
+
+#define BUFF_SIZE_TFL 9216
+#define BUFF_SIZE_SMB 512
+
+/* debug window */
+#define DEBUG_DEF_LINES 150
+#define DEBUG_FILE TEXT("debug.log")
+
+/* DISPLAY DEFAULTS - RANGES */
+
+#define MIN_FONT_SIZE 5
+#define MAX_FONT_SIZE 100
+#define MIN_FONT_WEIGHT 0
+#define MAX_FONT_WEIGHT 1200
+#define MIN_FONT_CASE 0
+#define MAX_FONT_CASE 0x0008
+
+BOOLEAN IS_JAPAN( void ) ;
+
+#define FONT_NAME (IS_JAPAN()?TEXT("SYSTEM"):TEXT("MS Sans Serif"))
+#define FONT_SIZE (IS_JAPAN()?10:8)
+
+#define FONT_WEIGHT 400
+#define FONT_LOWERCASE 0x0001
+#define FONT_ITALICS 0x0005
+
+// SORT OPTIONS
+
+#define ID_SORTMIN ID_SORTNAME
+#define ID_SORTMAX ID_SORTDATE
+
+// SEARCH LIMIT DEFINES
+
+#define SEARCH_MIN 1
+#define SEARCH_AVG 250
+#define SEARCH_MAX 5000
+
+// Hardware Parameters Structure
+
+typedef struct HWPARMS *HWPARMS_PTR;
+typedef struct HWPARMS {
+
+ WORD wStatus;
+ WORD wCardID;
+ WORD wDrives;
+ WORD wSlot;
+ WORD wTargets;
+ ULONG ulAddr;
+ ULONG ulIRQ;
+ ULONG ulDMA;
+ ULONG ulSettlingTime;
+ INT16 nNumParms;
+ ULONG ulParms[10];
+ struct HWPARMS *pNext;
+
+} HWPARMS;
+
+// Special Structure for Default Drive Definition
+
+typedef struct DEF_DRIVE_ENTRY {
+ struct DEF_DRIVE_ENTRY *next ;
+ CHAR_PTR drive_name ;
+} DEF_DRIVE_ENTRY, *DEF_DRIVE_ENTRY_PTR ;
+
+
+// WINDOW POSITION AND SHOW STYLE STRUCTURE
+
+typedef struct WINSIZE *PWINSIZE;
+typedef struct WINSIZE {
+
+ INT x; // x-coordinate of upper-left corner
+ INT y; // y-coordinate of upper-left corner
+ INT cx; // width
+ INT cy; // height
+ INT nSize; // minimized, maximized, or normal
+ INT nSliderPos; // the slider position
+
+} WINSIZE ;
+
+
+// Configuration Data Structure
+
+typedef struct CDS *CDS_PTR;
+typedef struct CDS {
+
+#ifdef OS_WIN32
+
+ CHAR drive_name[MAXTAPEDRIVENAME + 1]; // tape drive name
+#endif
+ INT16 hardware_compress_mode; // 0/1 - disable/enable hardware compression // chs:05-04-93
+ INT16 software_compress_mode; // 0/1 - disable/enable software compression // chs:05-04-93
+ INT drive_settling_time; // number of seconds until tape drive settles
+
+ CHAR data_path[MAX_UI_PATH_SIZE] ; // users data path
+ CHAR cat_path[MAX_UI_PATH_SIZE]; // catalog data path
+ CHAR group_name[MAX_GROUPNAME_SIZE]; // program manager group name
+
+ INT16 output_dest ; // 0=monitor, 1=printer or 2=file
+ INT16 files_flg ; // list filename as processed
+ INT16 password_flg ; // password on flag
+
+ CHAR log_file_root[MAX_UI_LOGFILEROOT_SIZE];
+ // max log file root name
+ INT16 log_mode ; // log file open mode
+ INT16 log_level ; // logging level 0-4
+ INT16 num_log_sessions ; // number of log sessions to keep
+ BOOL print_log_session ; // print log session
+ CHAR active_driver[DRIVER_SIZE] ; // root portion of driver name
+
+ INT16 create_skipped ; // create skipped script?
+ INT16 show_netware_servers ; // flag for mapped drive vs. server
+ DEF_DRIVE_ENTRY *default_drives ; // default backup drives
+ INT16 auto_verify_backup ; // auto verify on backup
+ INT16 auto_verify_restore ; // auto verify on restore
+
+ INT16 enable_password_dbase ; // Enable password data base
+ INT16 max_pwdbase_recs ; // maximum #of pwdbase records
+
+ INT16 catalog_level ; // Catalog level, 0=none, 1=partial, 2=full
+ BOOL backup_catalogs ; // backup catalogs
+ BOOL use_tape_catalogs ; // backup catalogs
+
+ INT16 std_mode_warning ; // display standard mode warning
+ INT16 wait_time ; // in seconds
+
+ INT16 restore_existing_files ; // restore over existing files
+
+ UINT32 debug_flg ; // debug flag
+ BOOL debug_to_file ; // save debug info to a file
+ CHAR debug_file_name[MAX_UI_FILENAME_SIZE]; // debug info file name
+ BOOL debug_to_window ; // display debug info in a window
+ BOOL debug_window_show_all ; // keep all debug info in the window
+ INT16 debug_window_num_lines ; // keep most recent # of debug lines
+
+ BOOL show_main_ribbon ; // display the ribbon bar
+ BOOL show_status_line ; // display the status line
+
+ WINSIZE frame_info ; // frame window size and position
+ WINSIZE disk_info ; // disk window size and position
+ WINSIZE tape_info ; // tape window size and position
+ WINSIZE server_info ; // server window size and position
+ WINSIZE log_info ; // log window size and position
+ WINSIZE debug_info ; // debug window size and position
+ WINSIZE runtime_info ; // debug window size and position
+
+#ifdef OEM_EMS
+ WINSIZE exchange_info ; // exchange window size and position
+ INT16 show_exchange ; // flag for showing exchange window.
+#endif
+
+ UINT16 launcher_flag ; // launcher settings flag
+ BOOL include_subdirs_flag ; // include subdirs in selections
+ UINT16 backup_type ; // default backup type - incremental, etc...
+ BOOL eject_tape_flag ; // eject tape on exit flag
+ BOOL enable_stats_flag ; // enable statistics flag
+ INT search_limit; // number of records to limit search to
+ BOOL search_pwd_tapes; // skip passworded tapes in search
+ BOOL search_subdirs; // include subdirectories in search
+ INT poll_frequency; // poll drive frequency
+
+ BYTE font_name[LF_FULLFACESIZE]; // font face name
+ INT font_size; // font face size
+ INT font_weight; // font face weight
+ BOOL font_case; // lower/upper for ALL drives
+ BOOL font_case_fat; // lower/upper for FAT drives
+ BOOL font_italics; // normal/italic
+
+ INT file_details ; // file details or file name or future...
+ INT sort_options ; // sort options or file characteristics
+
+ HWPARMS_PTR pHWParms; // ptr to hardware parameters list
+
+ // The following elements are not specified within the config file
+ // but are used either internally or at run time only
+
+ BOOLEAN changed_config ; // altered config, but not saved
+ INT16 append_flg ; // append flag
+ INT16 yes_flag ; // yes and yesyes flag
+ INT16 erase_flg ; // erase flag, can be OFF, ERASE, or LONG_ERASE
+ CHAR pwdbase_fname[MAX_UI_FILENAME_SIZE] ; // password database filename
+ INT16 transfer_flag ; // true if TBACKUP transfer opper
+ INT16 advance_to_config ; // true if TMENU is to startup at config menu
+ INT16 cmd_line_restrict_access; // true if passed on the command line /R to // chs:06-07-93
+ // restrict access to user // chs:06-07-93
+
+ // The backup engine configuration pointer.
+
+ BE_CFG_PTR pPermBEC; // ptr to permanent Backup Engine Config
+
+ UINT32 temp1 ;
+ UINT32 temp2 ;
+
+} CDS;
+
+
+
+// FUNCTION PROTOTYPES
+
+VOID CDS_Init( VOID ) ;
+VOID CDS_Deinit ( VOID );
+CDS_PTR CDS_GetPerm( VOID ) ;
+BE_CFG_PTR CDS_GetPermBEC( VOID );
+CDS_PTR CDS_GetCopy( VOID ) ;
+VOID CDS_SetPerm( CDS_PTR ) ;
+VOID CDS_UpdateCopy( VOID ) ;
+CHAR_PTR CDS_GetDefaultDrive( CDS_PTR conf_ptr, INT16 device_num ) ;
+
+VOID CDS_LoadIniFileName ( VOID );
+VOID CDS_GetIniFileName ( LPSTR, INT );
+VOID CDS_SetIniFileName ( LPSTR );
+BOOL CDS_UsingCmdLineINI ( VOID );
+
+CHAR_PTR CDS_GetMaynFolder( VOID ) ;
+VOID CDS_SetMaynFolder( CHAR_PTR ) ;
+
+CHAR_PTR CDS_GetUserDataPath ( VOID );
+VOID CDS_SetUserDataPath ( CHAR_PTR );
+BOOL CDS_ValidateUserDataPath ( CHAR_PTR );
+
+CHAR_PTR CDS_GetCatDataPath ( VOID );
+VOID CDS_SetCatDataPath ( CHAR_PTR );
+BOOL CDS_ValidateCatDataPath ( CHAR_PTR );
+
+CHAR_PTR CDS_GetExePath ( VOID );
+VOID CDS_SetExePath ( CHAR_PTR );
+VOID CDS_SetupExePath ( VOID );
+VOID CDS_ChangeToExeDir ( VOID );
+
+VOID CDS_SaveLoggingConfig ( VOID );
+VOID CDS_SaveDebugConfig ( VOID );
+
+BOOL CDS_GetHardwareConfig ( LPSTR, HWPARMS_PTR );
+VOID CDS_SaveHardwareConfig ( LPSTR, HWPARMS_PTR, LPSTR );
+
+VOID CDS_SaveCDS ( VOID );
+
+DWORD CDS_GetLongInt ( LPSTR, LPSTR, DWORD );
+BOOL CDS_SaveInt ( LPSTR, LPSTR, DWORD );
+BOOL CDS_SaveHexInt ( LPSTR, LPSTR, DWORD );
+
+INT CDS_GetString ( LPSTR, LPSTR, LPSTR, LPSTR, INT );
+BOOL CDS_SaveString ( LPSTR, LPSTR, LPSTR );
+
+
+BOOL CDS_GetWinSize ( LPSTR, PWINSIZE );
+VOID CDS_SaveWinSize ( LPSTR, HWND );
+VOID CDS_SaveDlgWinSize ( LPSTR, HWND );
+VOID CDS_SaveMDIWinSize ( LPSTR, HWND );
+
+VOID CDS_CheckForBadPaths ( VOID );
+VOID CDS_SaveDisplayConfig ( VOID );
+
+// FUNCTION MACROS
+
+#define CDS_GetInt( x, y, z ) ( (WORD)CDS_GetLongInt( x, y, (DWORD)z ) )
+#define CDS_SkipBlanks(x) for( ; *x == TEXT(' '); x ++ )
+
+// CONFIG USER INTERFACE MACROS
+
+#define CDS_GetTapeDriveName( x ) ( (x)->drive_name )
+#define CDS_SetTapeDriveName( x, name ) ( strncpy( (x)->drive_name, name, MAXTAPEDRIVENAME ), \
+ (x)->drive_name[ MAXTAPEDRIVENAME ] = 0 )
+
+#define CDS_GetTapeDriveSettlingTime( x ) ( (x)->drive_settling_time )
+#define CDS_SetTapeDriveSettlingTime( x, v ) ( (x)->drive_settling_time = CDS_MAX( CDS_MIN( (v), MAX_DRIVE_SETTLING_TIME ), MIN_DRIVE_SETTLING_TIME ) )
+
+#define CDS_GetOutputDest( x ) ( (x)->output_dest )
+#define CDS_SetOutputDest( x, v ) ( (x)->output_dest = CDS_MAX( CDS_MIN( (v), LOG_TO_FILE ), LOG_NOWHERE ) )
+
+#define CDS_GetFilesFlag( x ) ( (x)->files_flg )
+#define CDS_SetFilesFlag( x, v ) ( (x)->files_flg = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetPasswordFlag( x ) ( (x)->password_flg )
+#define CDS_SetPasswordFlag( x, v ) ( (x)->password_flg = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetDebugFlag( x ) ( (x)->debug_flg )
+#define CDS_SetDebugFlag( x, v ) ( (x)->debug_flg = ( v ) )
+
+#define CDS_GetLogFileRoot( x ) ( (x)->log_file_root )
+#define CDS_SetLogFileRoot( x, name ) ( strncpy( (x)->log_file_root, name, MAX_UI_LOGFILEROOT_LEN ), \
+ (x)->log_file_root[ MAX_UI_LOGFILEROOT_LEN ] = TEXT('\0') )
+
+#define CDS_GetLogMode( x ) ( (x)->log_mode )
+#define CDS_SetLogMode( x, v ) ( (x)->log_mode = CDS_MAX( CDS_MIN( (v), LOG_APPEND ), LOG_OVERWRITE ) )
+
+#define CDS_GetLogLevel( x ) ( (x)->log_level )
+#define CDS_SetLogLevel( x, v ) ( (x)->log_level = CDS_MAX( CDS_MIN( (v), LOG_DETAIL ), LOG_DISABLED ) )
+
+#define CDS_GetHWCompMode( x ) ( (x)->hardware_compress_mode ) // chs:05-04-93
+#define CDS_SetHWCompMode( x, v ) ( (x)->hardware_compress_mode = CDS_MAX( CDS_MIN( (v), HW_COMP_ENABLE ), HW_COMP_DISABLE ) ) // chs:05-04-93
+
+#define CDS_GetSWCompMode( x ) ( (x)->software_compress_mode ) // chs:05-04-93
+#define CDS_SetSWCompMode( x, v ) ( (x)->software_compress_mode = CDS_MAX( CDS_MIN( (v), SW_COMP_ENABLE ), SW_COMP_DISABLE ) ) // chs:05-04-93
+
+#define CDS_GetNumLogSessions( x ) ( (x)->num_log_sessions )
+#define CDS_SetNumLogSessions( x, v ) ( (x)->num_log_sessions = CDS_MAX( CDS_MIN( (v), LOG_MAX_LOGFILES ), LOG_MIN_LOGFILES ) )
+
+#define CDS_GetPrintLogSession( x ) ( (x)->print_log_session )
+#define CDS_SetPrintLogSession( x, v ) ( (x)->print_log_session = CDS_MAX( CDS_MIN( (v), LOG_PRINT_PROMPT ), LOG_PRINT_OFF ) )
+
+#define CDS_GetActiveDriver( x ) ( (x)->active_driver )
+#define CDS_SetActiveDriver( x, name ) ( strncpy( (x)->active_driver, name, 8 ), \
+ (x)->active_driver[8] = TEXT('\0') )
+
+#define CDS_GetDosDriveList( x ) ( (x)->dos_drive_list )
+#define CDS_SetDosDriveList( x, v ) ( (x)->dos_drive_list = ( v ) )
+
+#define CDS_GetCreateSkipped( x ) ( (x)->create_skipped )
+#define CDS_SetCreateSkipped( x, v ) ( (x)->create_skipped = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetDisplayNetwareServers( x ) ( (x)->show_netware_servers )
+#define CDS_SetDisplayNetwareServers( x, v ) ( (x)->show_netware_servers = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetDefaultDriveList( x ) ( (x)->default_drives )
+#define CDS_SetDefaultDriveList( x, v ) ( (x)->default_drives = (v) )
+
+#define CDS_GetAutoVerifyBackup( x ) ( (x)->auto_verify_backup )
+#define CDS_SetAutoVerifyBackup( x, v ) ( (x)->auto_verify_backup = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetCmdLineRestrictAccess( x ) ( (x)->cmd_line_restrict_access ) // chs:06-07-93
+#define CDS_SetCmdLineRestrictAccess( x, v ) ( (x)->cmd_line_restrict_access = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) ) // chs:06-07-93
+
+#define CDS_GetAutoVerifyRestore( x ) ( (x)->auto_verify_restore )
+#define CDS_SetAutoVerifyRestore( x, v ) ( (x)->auto_verify_restore = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetEnablePasswordDbase( x ) ( (x)->enable_password_dbase )
+#define CDS_SetEnablePasswordDbase( x, v ) ( (x)->enable_password_dbase = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetMaxPwDbaseSize( x ) ( (x)->max_pwdbase_recs )
+#define CDS_SetMaxPwDbaseSize( x, v ) ( (x)->max_pwdbase_recs = CDS_MAX( (v), PWDB_MIN_ENTRIES ) )
+
+#define CDS_GetCatalogLevel( x ) ( (x)->catalog_level )
+#define CDS_SetCatalogLevel( x, v ) ( ( (x)->catalog_level = CDS_MAX( CDS_MIN( (v), CATALOGS_FULL ), CATALOGS_PARTIAL ) ) , \
+ ( BEC_SetCatalogLevel( (x)->pPermBEC, CDS_MAX( CDS_MIN( (v), CATALOGS_FULL ), CATALOGS_PARTIAL ) ) ) )
+
+#define CDS_GetBackupCatalogs( x ) ( (x)->backup_catalogs )
+#define CDS_SetBackupCatalogs( x, v ) ( (x)->backup_catalogs = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetUseTapeCatalogs( x ) ( (x)->use_tape_catalogs )
+#define CDS_SetUseTapeCatalogs( x, v ) ( (x)->use_tape_catalogs = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetWaitTime( x ) ( (x)->wait_time )
+#define CDS_SetWaitTime( x, v ) ( (x)->wait_time = CDS_MAX( (v), SKIP_MIN_TIME ) )
+
+#define CDS_GetStdModeWarning( x ) ( (x)->std_mode_warning )
+#define CDS_SetStdModeWarning( x, v ) ( (x)->std_mode_warning = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetRestoreExistingFiles( x ) ( (x)->restore_existing_files )
+#define CDS_SetRestoreExistingFiles( x, v ) ( (x)->restore_existing_files = CDS_MAX( CDS_MIN( (v), PROMPT_RESTORE_OVER_RECENT ), RESTORE_OVER_EXISTING ) )
+
+#define CDS_GetShowMainRibbon( x ) ( (x)->show_main_ribbon )
+#define CDS_SetShowMainRibbon( x, v ) ( (x)->show_main_ribbon = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetShowStatusLine( x ) ( (x)->show_status_line )
+#define CDS_SetShowStatusLine( x, v ) ( (x)->show_status_line = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetFontFace( x ) ( (CHAR_PTR)(x)->font_name )
+#define CDS_SetFontFace( x, v ) ( strcpy( (CHAR_PTR)((x)->font_name), (v) ) )
+
+#define CDS_GetFontSize( x ) ( (x)->font_size )
+#define CDS_SetFontSize( x, v ) ( (x)->font_size = CDS_MAX( CDS_MIN( (v), MAX_FONT_SIZE ), MIN_FONT_SIZE ) )
+
+#define CDS_GetFontWeight( x ) ( (x)->font_weight )
+#define CDS_SetFontWeight( x, v ) ( (x)->font_weight = CDS_MAX( CDS_MIN( (v), MAX_FONT_WEIGHT ), MIN_FONT_WEIGHT ) )
+
+#define CDS_GetFontCase( x ) ( (x)->font_case )
+#define CDS_SetFontCase( x, v ) ( (x)->font_case = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetFontCaseFAT( x ) ( (x)->font_case_fat )
+#define CDS_SetFontCaseFAT( x, v ) ( (x)->font_case_fat = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetFontItalics( x ) ( (x)->font_italics )
+#define CDS_SetFontItalics( x, v ) ( (x)->font_italics = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetFileDetails( x ) ( (x)->file_details )
+#define CDS_SetFileDetails( x, v ) ( (x)->file_details = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetSortOptions( x ) ( (x)->sort_options )
+#define CDS_SetSortOptions( x, v ) ( (x)->sort_options = CDS_MAX( CDS_MIN( (v), ID_SORTMAX ), ID_SORTMIN ) )
+
+#define CDS_GetDebugToFile( x ) ( (x)->debug_to_file )
+#define CDS_SetDebugToFile( x, v ) ( (x)->debug_to_file = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetDebugFileName( x ) ( (CHAR_PTR)(x)->debug_file_name )
+#define CDS_SetDebugFileName( x, v ) ( strcpy( (CHAR_PTR)(x)->debug_file_name, (v) ) )
+
+#define CDS_GetDebugToWindow( x ) ( (x)->debug_to_window )
+#define CDS_SetDebugToWindow( x, v ) ( (x)->debug_to_window = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetDebugWindowShowAll( x ) ( (x)->debug_window_show_all )
+#define CDS_SetDebugWindowShowAll( x, v ) ( (x)->debug_window_show_all = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetDebugWindowNumLines( x ) ( (x)->debug_window_num_lines )
+#define CDS_SetDebugWindowNumLines( x, v ) ( (x)->debug_window_num_lines = ( v ) )
+
+#define CDS_GetFrameInfo( x ) ( (x)->frame_info )
+#define CDS_SetFrameInfo( x, v ) ( (x)->frame_info = ( v ) )
+#define CDS_GetFrameSize( x ) ( (x)->frame_info.nSize )
+#define CDS_SetFrameSize( x, v ) ( (x)->frame_info.nSize = ( v ) )
+
+#define CDS_GetDiskInfo( x ) ( (x)->disk_info )
+#define CDS_SetDiskInfo( x, v ) ( (x)->disk_info = ( v ) )
+#define CDS_GetDiskSize( x ) ( (x)->disk_info.nSize )
+#define CDS_SetDiskSize( x, v ) ( (x)->disk_info.nSize = ( v ) )
+
+#define CDS_GetTapeInfo( x ) ( (x)->tape_info )
+#define CDS_SetTapeInfo( x, v ) ( (x)->tape_info = ( v ) )
+#define CDS_GetTapeSize( x ) ( (x)->tape_info.nSize )
+#define CDS_SetTapeSize( x, v ) ( (x)->tape_info.nSize = ( v ) )
+
+#define CDS_GetServerInfo( x ) ( (x)->server_info )
+#define CDS_SetServerInfo( x, v ) ( (x)->server_info = ( v ) )
+#define CDS_GetServerSize( x ) ( (x)->server_info.nSize )
+#define CDS_SetServerSize( x, v ) ( (x)->server_info.nSize = ( v ) )
+
+#ifdef OEM_EMS
+#define CDS_GetDisplayExchange( x ) ( (x)->show_exchange )
+#define CDS_SetDisplayExchange( x, v ) ( (x)->show_exchange = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetExchangeInfo( x ) ( (x)->exchange_info )
+#define CDS_SetExchangeInfo( x, v ) ( (x)->exchange_info = ( v ) )
+#define CDS_GetExchangeSize( x ) ( (x)->exchange_info.nSize )
+#define CDS_SetExchangeSize( x, v ) ( (x)->exchange_info.nSize = ( v ) )
+#endif
+
+#define CDS_GetLogInfo( x ) ( (x)->log_info )
+#define CDS_SetLogInfo( x, v ) ( (x)->log_info = ( v ) )
+#define CDS_GetLogSize( x ) ( (x)->log_info.nSize )
+#define CDS_SetLogSize( x, v ) ( (x)->log_info.nSize = ( v ) )
+
+#define CDS_GetDebugInfo( x ) ( (x)->debug_info )
+#define CDS_SetDebugInfo( x, v ) ( (x)->debug_info = ( v ) )
+#define CDS_GetDebugSize( x ) ( (x)->debug_info.nSize )
+#define CDS_SetDebugSize( x, v ) ( (x)->debug_info.nSize = ( v ) )
+
+#define CDS_GetRuntimeInfo( x ) ( (x)->runtime_info )
+#define CDS_SetRuntimeInfo( x, v ) ( (x)->runtime_info = ( v ) )
+#define CDS_GetRuntimeSize( x ) ( (x)->runtime_info.nSize )
+#define CDS_SetRuntimeSize( x, v ) ( (x)->runtime_info.nSize = ( v ) )
+
+#define CDS_GetGroupName( x ) ( (CHAR_PTR)(x)->group_name )
+#define CDS_SetGroupName( x, v ) ( strcpy( (CHAR_PTR)(x)->group_name, (v) ) )
+
+#define CDS_GetLauncherFlag( x ) ( (x)->launcher_flag )
+#define CDS_SetLauncherFlag( x, v ) ( (x)->launcher_flag = CDS_MAX( (v), LAUNCHER_MIN_TIME ) )
+
+#define CDS_GetIncludeSubdirs( x ) ( (x)->include_subdirs_flag )
+#define CDS_SetIncludeSubdirs( x, v ) ( (x)->include_subdirs_flag = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetDefaultBackupType( x ) ( (x)->backup_type )
+#define CDS_SetDefaultBackupType( x, v ) ( (x)->backup_type = CDS_MAX( CDS_MIN( (v), BACKUP_INCR ), BACKUP_NORMAL ) )
+
+#define CDS_GetHWParms( x ) ( (x)->pHWParms )
+#define CDS_SetHWParms( x, v ) ( (x)->pHWParms = (v) )
+
+#define CDS_GetEjectTapeFlag( x ) ( (x)->eject_tape_flag )
+#define CDS_SetEjectTapeFlag( x, v ) ( (x)->eject_tape_flag = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetEnableStatsFlag( x ) ( (x)->enable_stats_flag )
+#define CDS_SetEnableStatsFlag( x, v ) ( (x)->enable_stats_flag = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#ifdef OEM_EMS
+#define CDS_GetUsrShareFlag( x ) ( (x)->usr_share_flag )
+#define CDS_GetSysShareFlag( x ) ( (x)->sys_share_flag )
+#endif
+
+#define CDS_GetSearchLimit( x ) ( (x)->search_limit )
+#define CDS_SetSearchLimit( x, v ) ( (x)->search_limit = CDS_MAX( CDS_MIN( (v), SEARCH_MAX ), SEARCH_MIN ) )
+
+#define CDS_GetSearchPwdTapes( x ) ( (x)->search_pwd_tapes )
+#define CDS_SetSearchPwdTapes( x, v ) ( (x)->search_pwd_tapes = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetSearchSubdirs( x ) ( (x)->search_subdirs )
+#define CDS_SetSearchSubdirs( x, v ) ( (x)->search_subdirs = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetPollFrequency( x ) ( (x)->poll_frequency )
+#define CDS_SetPollFrequency( x, v ) ( (x)->poll_frequency = CDS_MAX( (v), POLL_MIN_FREQ ) )
+
+#define CDS_GetAppendFlag( x ) ( (x)->append_flg )
+#define CDS_SetAppendFlag( x, v ) ( (x)->append_flg = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+
+// RUN TIME MACROS
+
+#define CDS_GetChangedConfig( x ) ( (x)->changed_config )
+#define CDS_SetChangedConfig( x, v ) ( (x)->changed_config = (v) )
+
+#define CDS_GetYesFlag( x ) ( (x)->yes_flag )
+#define CDS_SetYesFlag( x, v ) ( (x)->yes_flag = CDS_MAX( CDS_MIN( (v), YESYES_FLAG ), NO_FLAG ) )
+
+#define CDS_GetEraseFlag( x ) ( (x)->erase_flg )
+#define CDS_SetEraseFlag( x, v ) ( (x)->erase_flg = CDS_MAX( CDS_MIN( (v), ERASE_FORMAT ), ERASE_OFF ) )
+
+#define CDS_GetPwDbaseFname( x ) ( (CHAR_PTR)(x)->pwdbase_fname )
+#define CDS_SetPwDbaseFname( x, v ) ( strcpy ( (CHAR_PTR)(x)->pwdbase_fname, (v) ) )
+
+#define CDS_GetTransferFlag( x ) ( (x)->transfer_flag )
+#define CDS_SetTransferFlag( x, v ) ( (x)->transfer_flag = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+#define CDS_GetAdvToConfig( x ) ( (x)->advance_to_config )
+#define CDS_SetAdvToConfig( x, v ) ( (x)->advance_to_config = CDS_MAX( CDS_MIN( (v), CDS_ENABLE ), CDS_DISABLE ) )
+
+
+// CONFIG to BACKUP ENGINE CONFIG MACROS
+
+#define CDS_GetSkipOpenFiles( x ) BEC_GetSkipOpenFiles( (x)->pPermBEC )
+#define CDS_SetSkipOpenFiles( x, v ) BEC_SetSkipOpenFiles( (x)->pPermBEC, v )
+
+#define CDS_GetBackupFilesInUse( x ) BEC_GetBackupFilesInUse( (x)->pPermBEC )
+#define CDS_SetBackupFilesInUse( x, v ) BEC_SetBackupFilesInUse( (x)->pPermBEC, v )
+
+#define CDS_GetHiddenFlag( x ) BEC_GetHiddenFlag( (x)->pPermBEC )
+#define CDS_SetHiddenFlag( x, v ) BEC_SetHiddenFlag( (x)->pPermBEC, v )
+
+#define CDS_GetSpecialFlag( x ) BEC_GetSpecialFlag( (x)->pPermBEC )
+#define CDS_SetSpecialFlag( x, v ) BEC_SetSpecialFlag( (x)->pPermBEC, v )
+
+#define CDS_GetSetArchiveFlag( x ) BEC_GetSetArchiveFlag( (x)->pPermBEC )
+#define CDS_SetSetArchiveFlag( x, v ) BEC_SetSetArchiveFlag( (x)->pPermBEC, v )
+
+#define CDS_GetExistFlag( x ) BEC_GetExistFlag( (x)->pPermBEC )
+#define CDS_SetExistFlag( x, v ) BEC_SetExistFlag( (x)->pPermBEC, v )
+
+#define CDS_GetPromptFlag( x ) BEC_GetPromptFlag( (x)->pPermBEC )
+#define CDS_SetPromptFlag( x, v ) BEC_SetPromptFlag( (x)->pPermBEC, v )
+
+#define CDS_GetTFLBuffSize( x ) BEC_GetTFLBuffSize( (x)->pPermBEC )
+#define CDS_SetTFLBuffSize( x, v ) BEC_SetTFLBuffSize( (x)->pPermBEC, v )
+
+#define CDS_GetAFPSupport( x ) BEC_GetAFPSupport( (x)->pPermBEC )
+#define CDS_SetAFPSupport( x, v ) BEC_SetAFPSupport( (x)->pPermBEC, v )
+
+#define CDS_GetExtendedDateSupport( x ) BEC_GetExtendedDateSupport( (x)->pPermBEC )
+#define CDS_SetExtendedDateSupport( x, v ) BEC_SetExtendedDateSupport( (x)->pPermBEC, v )
+
+#define CDS_GetProcEmptyFlag( x ) BEC_GetProcEmptyFlag( (x)->pPermBEC )
+#define CDS_SetProcEmptyFlag( x, v ) BEC_SetProcEmptyFlag( (x)->pPermBEC, v )
+
+#define CDS_GetFastFileRestore( x ) BEC_GetFastFileRestore( (x)->pPermBEC )
+#define CDS_SetFastFileRestore( x, v ) BEC_SetFastFileRestore( (x)->pPermBEC, v )
+
+#define CDS_GetConfiguredMachineType( x ) BEC_GetConfiguredMachineType( (x)->pPermBEC )
+#define CDS_SetConfiguredMachineType( x, v ) BEC_SetConfiguredMachineType( (x)->pPermBEC, v )
+
+#define CDS_GetSpecialWord( x ) BEC_GetSpecialWord( (x)->pPermBEC )
+#define CDS_SetSpecialWord( x, v ) BEC_SetSpecialWord( (x)->pPermBEC, v )
+
+#define CDS_GetMaxTapeBuffers( x ) BEC_GetMaxTapeBuffers( (x)->pPermBEC )
+#define CDS_SetMaxTapeBuffers( x, v ) BEC_SetMaxTapeBuffers( (x)->pPermBEC, v )
+
+#define CDS_GetMaxBufferSize( x ) BEC_GetMaxBufferSize( (x)->pPermBEC )
+#define CDS_SetMaxBufferSize( x, v ) BEC_SetMaxBufferSize( (x)->pPermBEC, v )
+
+#define CDS_GetNetNum( x ) BEC_GetNetNum( (x)->pPermBEC )
+#define CDS_SetNetNum( x, v ) BEC_SetNetNum( (x)->pPermBEC, v )
+
+#define CDS_GetSortBSD( x ) BEC_GetSortBSD( (x)->pPermBEC )
+#define CDS_SetSortBSD( x, v ) BEC_SetSortBSD( (x)->pPermBEC, v )
+
+#define CDS_GetRestoreSecurity( x ) BEC_GetRestoreSecurity( (x)->pPermBEC )
+#define CDS_SetRestoreSecurity( x, v ) BEC_SetRestoreSecurity( (x)->pPermBEC, v )
+
+#define CDS_GetRemoteDriveBackup( x ) BEC_GetRemoteDriveBackup( (x)->pPermBEC )
+#define CDS_SetRemoteDriveBackup( x, v ) BEC_SetRemoteDriveBackup( (x)->pPermBEC, v )
+
+#define CDS_GetWriteFormat( x ) BEC_GetWriteFormat( (x)->pPermBEC )
+#define CDS_SetWriteFormat( x, v ) BEC_SetWriteFormat( (x)->pPermBEC, v )
+
+#define CDS_GetNRLDosVector( x ) BEC_GetNRLDosVector( (x)->pPermBEC )
+#define CDS_SetNRLDosVector( x, v ) BEC_SetNRLDosVector( (x)->pPermBEC, v )
+
+#define CDS_GetReserveMem( x ) BEC_GetReserveMem( (x)->pPermBEC )
+#define CDS_SetReserveMem( x, v ) BEC_SetReserveMem( (x)->pPermBEC, v )
+
+#define CDS_GetPartList( x ) BEC_GetPartList( (x)->pPermBEC )
+#define CDS_SetPartList( x, v ) BEC_SetPartList( (x)->pPermBEC, v )
+
+// ENABLE THIS WHEN THE BENGINE SUPPORTS IT
+
+//#define CDS_GetOTCLevel( x ) BEC_GetOTCLevel( (x)->pPermBEC )
+//#define CDS_SetOTCLevel( x, v ) BEC_SetOTCLevel( (x)->pPermBEC, v )
+
+#define CDS_GetOTCLevel( x ) ( (x)==(x) )
+#define CDS_SetOTCLevel( x, v ) ( (x)==(x) && (v)==(v) )
+
+#define CDS_GetProcessSytronECCFlag( x ) BEC_GetProcessSytronECCFlag( (x)->pPermBEC )
+#define CDS_SetProcessSytronECCFlag( x, v ) BEC_SetProcessSytronECCFlag( (x)->pPermBEC, v )
+
+
+/******************************************************************************/
+
+
+// MAYNARD.INI CONFIGURATION STRINGS
+
+// USER INTERFACE
+
+#define CMS_UI TEXT("User Interface")
+
+#define CMS_DATAPATH TEXT("Data Path")
+#define CMS_CATALOGPATH TEXT("Catalog Path")
+#define CMS_OUTPUT TEXT("Output Dest")
+#define CMS_LISTFILES TEXT("List Files")
+#define CMS_PWDFLAG TEXT("Use Password")
+#define CMS_PASSWORD TEXT("Backup Password")
+#define CMS_SKIPPED TEXT("Create Skipped")
+#define CMS_SHOWSERVERS TEXT("Display NetWare Servers")
+#define CMS_DEFDRIVES TEXT("Default Drive List")
+#define CMS_AUTOVBACKUP TEXT("Auto Verify Backup")
+#define CMS_AUTOVRESTORE TEXT("Auto Verify Restore")
+#define CMS_PWDDBASE TEXT("Use Server PDBase")
+#define CMS_PWDDBASERECS TEXT("Max PDBase Entries")
+#define CMS_APPENDFLAG TEXT("Append Flag")
+#define CMS_CATALOGLEVEL TEXT("Catalog Level")
+#define CMS_SKIP_OPEN_FILES TEXT("Skip open files")
+#define CMS_WAITTIME TEXT("Wait time")
+#define CMS_STDMODEWARNING TEXT("Show Mode Warning")
+#define CMS_RESTOREEXIST TEXT("Restore existing files")
+#define CMS_BACKUPCAT TEXT("Backup Catalogs")
+#define CMS_GROUPNAME TEXT("Group Name")
+#define CMS_LAUNCHERFLAG TEXT("Launcher Flag")
+#define CMS_SUBDIRS TEXT("Include Subdirs")
+#define CMS_BACKUPTYPE TEXT("Backup Type")
+#define CMS_EJECTTAPE TEXT("Eject Tape Flag")
+#define CMS_ENABLESTATS TEXT("Enable Statistics")
+#define CMS_SEARCHLIMIT TEXT("Search Limit")
+#define CMS_SEARCHPWDTAPES TEXT("Search Tapes With Password")
+#define CMS_SEARCHSUBDIRS TEXT("Search Subdirectories")
+#define CMS_USETAPECAT TEXT("Use Tape Catalogs")
+
+
+// DISPLAY
+
+#define CMS_DISPLAY TEXT("Display")
+
+#define CMS_MAINRIB TEXT("Selection Bar")
+#define CMS_STATLINE TEXT("Status line")
+#define CMS_FONTFACE TEXT("Font Face")
+#define CMS_FONTSIZE TEXT("Font Size")
+#define CMS_FONTWEIGHT TEXT("Font Weight")
+#define CMS_FONTCASE TEXT("Font Case")
+#define CMS_FONTCASEFAT TEXT("Font Case FAT")
+#define CMS_FONTITALICS TEXT("Font Italics")
+#define CMS_FILEDETAILS TEXT("File Details")
+#define CMS_SORTOPTIONS TEXT("Sort Options")
+#define CMS_FRAMEWINDOW TEXT("Frame Window")
+#define CMS_DISKWINDOW TEXT("Disk Window")
+#define CMS_TAPEWINDOW TEXT("Tape Window")
+#define CMS_SERVERWINDOW TEXT("Server Window")
+#define CMS_LOGWINDOW TEXT("Log Window")
+#define CMS_DEBUGWINDOW TEXT("Debug Window")
+#define CMS_RUNTIMEDLG TEXT("Run Time Dialog")
+
+// LOGGING
+
+#define CMS_LOGGING TEXT("Logging")
+
+#define CMS_LOGFILEROOT TEXT("Log File Root")
+#define CMS_NUMSESSIONS TEXT("Number of sessions")
+#define CMS_LOGLEVEL TEXT("Log Level")
+#define CMS_LOGMODE TEXT("Log Mode")
+#define CMS_PRINTLEVEL TEXT("Print Level")
+#define CMS_PRINTSESSION TEXT("Print log session")
+
+// HARDWARE
+
+#define CMS_AUTO TEXT("")
+
+#define CMS_HARDWARE TEXT("Hardware")
+
+#define CMS_TAPEDRIVE TEXT("Tape Drive")
+#define CMS_DRIVER TEXT("Driver")
+#define CMS_CONTROLLER TEXT("Controller")
+#define CMS_POLLFREQ TEXT("Poll Frequency")
+#define CMS_HWCOMPMODE TEXT("Hardware Compression") // chs:05-04-93
+#define CMS_SWCOMPMODE TEXT("Software Compression") // chs:05-04-93
+#define CMS_SETTLINGTIME TEXT("Drive Settling Time")
+
+
+#define CMS_STATUS TEXT("Status")
+#define CMS_CARDID TEXT("Card ID")
+#define CMS_DRIVES TEXT("Drives")
+#define CMS_SLOT TEXT("Slot")
+#define CMS_TARGETS TEXT("Target_IDs")
+#define CMS_ADDR TEXT("IO_Address")
+#define CMS_IRQ TEXT("IRQ_Number")
+#define CMS_DMA TEXT("DMA_Channel")
+
+// NT HARDWARE
+
+//#define CMS_CARD "Card"
+//#define CMS_TARGET "Target"
+//#define CMS_BUS "Bus"
+//#define CMS_LUN "LUN"
+
+// DEBUG
+
+#define CMS_DEBUG TEXT("Debug")
+
+#define CMS_DEBUGFLAG TEXT("Flag")
+#define CMS_TOFILE TEXT("To File")
+#define CMS_DEBUGFILE TEXT("File Name")
+#define CMS_TOWINDOW TEXT("To Window")
+#define CMS_SHOWALL TEXT("Show All")
+#define CMS_DEBUGLINES TEXT("Num Debug Lines")
+
+// BENGINE
+
+#define CMS_BENGINE TEXT("Backup Engine")
+
+#define CMS_SPECIAL_WORD TEXT("Special word")
+#define CMS_MAX_NUM_TAPE_BUFS TEXT("Max Num Tape Buffers")
+#define CMS_TFL_BUFF_SIZE TEXT("Tape Buffer Size")
+#define CMS_MAX_BUFFER_SIZE TEXT("Max Buffer Size")
+#define CMS_BACKUP_FILES_INUSE TEXT("Backup files inuse")
+#define CMS_SUPPORT_AFP_SERVER TEXT("Process Macintosh files")
+#define CMS_EXTENDED_DATE_SUPPORT TEXT("Extended Date Support")
+#define CMS_HIDDEN_FLAG TEXT("Hidden files")
+#define CMS_SPECIAL_FLAG TEXT("Special files")
+#define CMS_SET_ARCHIVE_FLAG TEXT("Set archive")
+#define CMS_PROC_EMPTY_FLAG TEXT("Process empty dirs")
+#define CMS_EXIST_FLAG TEXT("Restore existing files")
+#define CMS_PROMPT_FLAG TEXT("Prompt mode")
+#define CMS_NET_NUM TEXT("Network ID")
+#define CMS_SORT_BSD TEXT("Sort BSD List")
+#define CMS_REMOTE_DRIVE_BACKUP TEXT("Remote Drive Backup")
+#define CMS_USE_FFR TEXT("Use fast file restore")
+#define CMS_WRITE_FORMAT TEXT("Tape Format")
+#define CMS_NRL_DOS_VECTOR TEXT("NRL dos vector")
+#define CMS_MACHINE_TYPE TEXT("Machine Type")
+#define CMS_OTC_LEVEL TEXT("OTC Level")
+
+
+// TRANSLATORS
+
+#define CMS_TRANSLATORS TEXT("Translators")
+
+#ifdef OEM_MSOFT
+#define CMS_PROC_SYTRON_ECC TEXT("Sytos Plus ECC Flag")
+#else
+#define CMS_PROC_SYTRON_ECC TEXT("SYPL ECC Flag")
+#endif
+
+// CDS UI READ/WRITE MACROS
+
+#define CDS_ReadUserDataPath( x ) CDS_GetString( CMS_UI, CMS_DATAPATH, TEXT(""), (x)->data_path, MAX_UI_PATH_SIZE )
+#define CDS_WriteUserDataPath( x ) CDS_SaveString( CMS_UI, CMS_DATAPATH, (x)->data_path )
+
+#define CDS_ReadCatDataPath( x ) CDS_GetString( CMS_UI, CMS_CATALOGPATH, TEXT(""), (x)->cat_path, MAX_UI_PATH_SIZE )
+#define CDS_WriteCatDataPath( x ) CDS_SaveString( CMS_UI, CMS_CATALOGPATH, (x)->cat_path )
+
+#define CDS_ReadGroupName( x ) CDS_GetString( CMS_UI, CMS_GROUPNAME, TEXT(""), CDS_GetGroupName( x ), MAX_GROUPNAME_SIZE )
+#define CDS_WriteGroupName( x ) CDS_SaveString( CMS_UI, CMS_GROUPNAME, CDS_GetGroupName( x ) )
+
+#define CDS_ReadOutputDest( x ) CDS_SetOutputDest( x, CDS_GetInt( CMS_UI, CMS_OUTPUT, LOG_TO_FILE ) )
+#define CDS_WriteOutputDest( x ) CDS_SaveInt( CMS_UI, CMS_OUTPUT, CDS_GetOutputDest( x ) )
+
+#define CDS_ReadFilesFlag( x ) CDS_SetFilesFlag( x, CDS_GetInt( CMS_UI, CMS_LISTFILES, CDS_ENABLE ) )
+#define CDS_WriteFilesFlag( x ) CDS_SaveInt( CMS_UI, CMS_LISTFILES, CDS_GetFilesFlag( x ) )
+
+#define CDS_ReadCreateSkipped( x ) CDS_SetCreateSkipped( x, CDS_GetInt ( CMS_UI, CMS_SKIPPED, CDS_ENABLE ) )
+#define CDS_WriteCreateSkipped( x ) CDS_SaveInt( CMS_UI, CMS_SKIPPED, CDS_GetCreateSkipped( x ) )
+
+#define CDS_ReadDisplayNetwareServers( x ) CDS_SetDisplayNetwareServers( x, CDS_GetInt ( CMS_UI, CMS_SHOWSERVERS, CDS_ENABLE ) )
+#define CDS_WriteDisplayNetwareServers( x ) CDS_SaveInt( CMS_UI, CMS_SHOWSERVERS, CDS_GetDisplayNetwareServers( x ) )
+
+#define CDS_ReadAutoVerifyBackup( x ) CDS_SetAutoVerifyBackup( x, CDS_GetInt ( CMS_UI, CMS_AUTOVBACKUP, CDS_DISABLE ) )
+#define CDS_WriteAutoVerifyBackup( x ) CDS_SaveInt( CMS_UI, CMS_AUTOVBACKUP, CDS_GetAutoVerifyBackup( x ) )
+
+#define CDS_ReadAutoVerifyRestore( x ) CDS_SetAutoVerifyRestore( x, CDS_GetInt ( CMS_UI, CMS_AUTOVRESTORE, CDS_DISABLE ) )
+#define CDS_WriteAutoVerifyRestore( x ) CDS_SaveInt( CMS_UI, CMS_AUTOVRESTORE, CDS_GetAutoVerifyRestore( x ) )
+
+
+#define CDS_ReadPasswordFlag( x ) CDS_SetPasswordFlag( x, CDS_GetInt( CMS_UI, CMS_PWDFLAG, CDS_DISABLE ) )
+#define CDS_WritePasswordFlag( x ) CDS_SaveInt( CMS_UI, CMS_PWDFLAG, CDS_GetPasswordFlag( x ) )
+
+#define CDS_ReadEnablePasswordDbase( x ) CDS_SetEnablePasswordDbase( x, CDS_GetInt ( CMS_UI, CMS_PWDDBASE, CDS_DISABLE ) )
+#define CDS_WriteEnablePasswordDbase( x ) CDS_SaveInt( CMS_UI, CMS_PWDDBASE, CDS_GetEnablePasswordDbase( x ) )
+
+#define CDS_ReadMaxPwDbaseSize( x ) CDS_SetMaxPwDbaseSize( x, CDS_GetInt ( CMS_UI, CMS_PWDDBASERECS, PWDB_DEF_ENTRIES ) )
+#define CDS_WriteMaxPwDbaseSize( x ) CDS_SaveInt( CMS_UI, CMS_PWDDBASERECS, CDS_GetMaxPwDbaseSize( x ) )
+
+
+#define CDS_ReadAppendFlag( x ) CDS_SetAppendFlag( x, CDS_GetInt( CMS_UI, CMS_APPENDFLAG, CDS_DISABLE ) )
+#define CDS_WriteAppendFlag( x ) CDS_SaveInt( CMS_UI, CMS_APPENDFLAG, CDS_GetAppendFlag( x ) )
+
+#define CDS_ReadCatalogLevel( x ) CDS_SetCatalogLevel( x, CDS_GetInt ( CMS_UI, CMS_CATALOGLEVEL, CATALOGS_FULL ) )
+#define CDS_WriteCatalogLevel( x ) CDS_SaveInt( CMS_UI, CMS_CATALOGLEVEL, CDS_GetCatalogLevel( x ) )
+
+#define CDS_ReadBackupCatalogs( x ) CDS_SetBackupCatalogs( x, CDS_GetInt ( CMS_UI, CMS_BACKUPCAT, CDS_DISABLE ) )
+#define CDS_WriteBackupCatalogs( x ) CDS_SaveInt( CMS_UI, CMS_BACKUPCAT, CDS_GetBackupCatalogs( x ) )
+
+#define CDS_ReadUseTapeCatalogs( x ) CDS_SetUseTapeCatalogs( x, CDS_GetInt ( CMS_UI, CMS_USETAPECAT, CDS_ENABLE ) )
+#define CDS_WriteUseTapeCatalogs( x ) CDS_SaveInt( CMS_UI, CMS_USETAPECAT, CDS_GetUseTapeCatalogs( x ) )
+
+#define CDS_ReadWaitTime( x ) CDS_SetWaitTime( x, CDS_GetInt ( CMS_UI, CMS_WAITTIME, SKIP_DEF_TIME ) )
+#define CDS_WriteWaitTime( x ) CDS_SaveInt( CMS_UI, CMS_WAITTIME, CDS_GetWaitTime( x ) )
+
+#define CDS_ReadStdModeWarning( x ) CDS_SetStdModeWarning( x, CDS_GetInt ( CMS_UI, CMS_STDMODEWARNING, CDS_ENABLE ) )
+#define CDS_WriteStdModeWarning( x ) CDS_SaveInt( CMS_UI, CMS_STDMODEWARNING, CDS_GetStdModeWarning( x ) )
+
+#define CDS_ReadRestoreExistingFiles( x ) CDS_SetRestoreExistingFiles( x, CDS_GetInt ( CMS_UI, CMS_RESTOREEXIST, PROMPT_RESTORE_OVER_RECENT ) )
+#define CDS_WriteRestoreExistingFiles( x ) CDS_SaveInt( CMS_UI, CMS_RESTOREEXIST, CDS_GetRestoreExistingFiles( x ) )
+
+#define CDS_ReadLauncherFlag( x ) CDS_SetLauncherFlag( x, CDS_GetInt ( CMS_UI, CMS_LAUNCHERFLAG, LAUNCHER_DEF_TIME ) )
+#define CDS_WriteLauncherFlag( x ) CDS_SaveInt( CMS_UI, CMS_LAUNCHERFLAG, CDS_GetLauncherFlag( x ) )
+
+#define CDS_ReadIncludeSubdirs( x ) CDS_SetIncludeSubdirs( x, CDS_GetInt ( CMS_UI, CMS_SUBDIRS, CDS_ENABLE ) )
+#define CDS_WriteIncludeSubdirs( x ) CDS_SaveInt( CMS_UI, CMS_SUBDIRS, CDS_GetIncludeSubdirs( x ) )
+
+#define CDS_ReadDefaultBackupType( x ) CDS_SetDefaultBackupType( x, CDS_GetInt ( CMS_UI, CMS_BACKUPTYPE, BACKUP_NORMAL ) )
+#define CDS_WriteDefaultBackupType( x ) CDS_SaveInt( CMS_UI, CMS_BACKUPTYPE, CDS_GetDefaultBackupType( x ) )
+
+#define CDS_ReadEjectTapeFlag( x ) CDS_SetEjectTapeFlag( x, CDS_GetInt ( CMS_UI, CMS_EJECTTAPE, CDS_DISABLE ) )
+#define CDS_WriteEjectTapeFlag( x ) CDS_SaveInt( CMS_UI, CMS_EJECTTAPE, CDS_GetEjectTapeFlag( x ) )
+
+#define CDS_ReadEnableStatsFlag( x ) CDS_SetEnableStatsFlag( x, CDS_GetInt ( CMS_UI, CMS_ENABLESTATS, CDS_DISABLE ) )
+#define CDS_WriteEnableStatsFlag( x ) CDS_SaveInt( CMS_UI, CMS_ENABLESTATS, CDS_GetEnableStatsFlag( x ) )
+
+#define CDS_ReadSearchLimit( x ) CDS_SetSearchLimit( x, CDS_GetInt ( CMS_UI, CMS_SEARCHLIMIT, SEARCH_AVG ) )
+#define CDS_WriteSearchLimit( x ) CDS_SaveInt( CMS_UI, CMS_SEARCHLIMIT, CDS_GetSearchLimit( x ) )
+
+#define CDS_ReadSearchPwdTapes( x ) CDS_SetSearchPwdTapes( x, CDS_GetInt ( CMS_UI, CMS_SEARCHPWDTAPES, CDS_DISABLE ) )
+#define CDS_WriteSearchPwdTapes( x ) CDS_SaveInt( CMS_UI, CMS_SEARCHPWDTAPES, CDS_GetSearchPwdTapes( x ) )
+
+#define CDS_ReadSearchSubdirs( x ) CDS_SetSearchSubdirs( x, CDS_GetInt ( CMS_UI, CMS_SEARCHSUBDIRS, CDS_ENABLE ) )
+#define CDS_WriteSearchSubdirs( x ) CDS_SaveInt( CMS_UI, CMS_SEARCHSUBDIRS, CDS_GetSearchSubdirs( x ) )
+
+
+// CDS DEBUG READ/WRITE MACROS
+
+#define CDS_ReadDebugFlag( x ) CDS_SetDebugFlag( x, CDS_GetInt ( CMS_DEBUG, CMS_DEBUGFLAG, CDS_DISABLE ) )
+#define CDS_WriteDebugFlag( x ) CDS_SaveHexInt( CMS_DEBUG, CMS_DEBUGFLAG, CDS_GetDebugFlag( x ) )
+
+#define CDS_ReadDebugToFile( x ) CDS_SetDebugToFile( x, CDS_GetInt ( CMS_DEBUG, CMS_TOFILE, CDS_DISABLE ) )
+#define CDS_WriteDebugToFile( x ) CDS_SaveInt( CMS_DEBUG, CMS_TOFILE, CDS_GetDebugToFile( x ) )
+
+#define CDS_ReadDebugFileName( x ) CDS_GetString( CMS_DEBUG, CMS_DEBUGFILE, DEBUG_FILE, CDS_GetDebugFileName( x ), MAX_UI_FILENAME_SIZE )
+#define CDS_WriteDebugFileName( x ) CDS_SaveString( CMS_DEBUG, CMS_DEBUGFILE, CDS_GetDebugFileName( x ) )
+
+#define CDS_ReadDebugToWindow( x ) CDS_SetDebugToWindow( x, CDS_GetInt ( CMS_DEBUG, CMS_TOWINDOW, CDS_ENABLE ) )
+#define CDS_WriteDebugToWindow( x ) CDS_SaveInt( CMS_DEBUG, CMS_TOWINDOW, CDS_GetDebugToWindow( x ) )
+
+#define CDS_ReadDebugWindowShowAll( x ) CDS_SetDebugWindowShowAll( x, CDS_GetInt ( CMS_DEBUG, CMS_SHOWALL, CDS_DISABLE ) )
+#define CDS_WriteDebugWindowShowAll( x ) CDS_SaveInt( CMS_DEBUG, CMS_SHOWALL, CDS_GetDebugWindowShowAll( x ) )
+
+#define CDS_ReadDebugWindowNumLines( x ) CDS_SetDebugWindowNumLines( x, CDS_GetInt ( CMS_DEBUG, CMS_DEBUGLINES, DEBUG_DEF_LINES ) )
+#define CDS_WriteDebugWindowNumLines( x ) CDS_SaveInt( CMS_DEBUG, CMS_DEBUGLINES, CDS_GetDebugWindowNumLines( x ) )
+
+#define CDS_ReadPollFrequency( x ) CDS_SetPollFrequency( x, CDS_GetInt ( CMS_DEBUG, CMS_POLLFREQ, POLL_DEF_FREQ ) )
+#define CDS_WritePollFrequency( x ) CDS_SaveInt( CMS_DEBUG, CMS_POLLFREQ, CDS_GetPollFrequency( x ) )
+
+
+// CDS DISPLAY READ/WRITE MACROS
+
+#define CDS_ReadShowMainRibbon( x ) CDS_SetShowMainRibbon( x, CDS_GetInt ( CMS_DISPLAY, CMS_MAINRIB, CDS_ENABLE ) )
+#define CDS_WriteShowMainRibbon( x ) CDS_SaveInt( CMS_DISPLAY, CMS_MAINRIB, CDS_GetShowMainRibbon( x ) )
+
+#define CDS_ReadShowStatusLine( x ) CDS_SetShowStatusLine( x, CDS_GetInt ( CMS_DISPLAY, CMS_STATLINE, CDS_ENABLE ) )
+#define CDS_WriteShowStatusLine( x ) CDS_SaveInt( CMS_DISPLAY, CMS_STATLINE, CDS_GetShowStatusLine( x ) )
+
+#define CDS_ReadFontFace( x ) CDS_GetString( CMS_DISPLAY, CMS_FONTFACE, FONT_NAME, CDS_GetFontFace( x ), LF_FULLFACESIZE )
+#define CDS_WriteFontFace( x ) CDS_SaveString( CMS_DISPLAY, CMS_FONTFACE, CDS_GetFontFace( x ) )
+
+#define CDS_ReadFontSize( x ) CDS_SetFontSize( x, CDS_GetInt ( CMS_DISPLAY, CMS_FONTSIZE, FONT_SIZE ) )
+#define CDS_WriteFontSize( x ) CDS_SaveInt( CMS_DISPLAY, CMS_FONTSIZE, CDS_GetFontSize( x ) )
+
+#define CDS_ReadFontWeight( x ) CDS_SetFontWeight( x, CDS_GetInt ( CMS_DISPLAY, CMS_FONTWEIGHT, FONT_WEIGHT ) )
+#define CDS_WriteFontWeight( x ) CDS_SaveInt( CMS_DISPLAY, CMS_FONTWEIGHT, CDS_GetFontWeight( x ) )
+
+#define CDS_ReadFontCase( x ) CDS_SetFontCase( x, CDS_GetInt ( CMS_DISPLAY, CMS_FONTCASE, CDS_DISABLE ) )
+#define CDS_WriteFontCase( x ) CDS_SaveInt( CMS_DISPLAY, CMS_FONTCASE, CDS_GetFontCase( x ) )
+
+#define CDS_ReadFontCaseFAT( x ) CDS_SetFontCaseFAT( x, CDS_GetInt ( CMS_DISPLAY, CMS_FONTCASEFAT, CDS_ENABLE ) )
+#define CDS_WriteFontCaseFAT( x ) CDS_SaveInt( CMS_DISPLAY, CMS_FONTCASEFAT, CDS_GetFontCaseFAT( x ) )
+
+#define CDS_ReadFontItalics( x ) CDS_SetFontItalics( x, CDS_GetInt ( CMS_DISPLAY, CMS_FONTITALICS, CDS_DISABLE ) )
+#define CDS_WriteFontItalics( x ) CDS_SaveInt( CMS_DISPLAY, CMS_FONTITALICS, CDS_GetFontItalics( x ) )
+
+#define CDS_ReadFileDetails( x ) CDS_SetFileDetails( x, CDS_GetInt ( CMS_DISPLAY, CMS_FILEDETAILS, CDS_DISABLE ) )
+#define CDS_WriteFileDetails( x ) CDS_SaveInt( CMS_DISPLAY, CMS_FILEDETAILS, CDS_GetFileDetails( x ) )
+
+#define CDS_ReadSortOptions( x ) CDS_SetSortOptions( x, CDS_GetInt ( CMS_DISPLAY, CMS_SORTOPTIONS, ID_SORTNAME ) )
+#define CDS_WriteSortOptions( x ) CDS_SaveInt( CMS_DISPLAY, CMS_SORTOPTIONS, CDS_GetSortOptions( x ) )
+
+#define CDS_ReadWindowSize( x, y ) CDS_GetString( CMS_DISPLAY, x, TEXT(""), y, MAX_UI_RESOURCE_SIZE )
+#define CDS_WriteWindowSize( x, y ) CDS_SaveString( CMS_DISPLAY, x, y )
+
+#define CDS_ReadFrameWinSize( x ) CDS_GetWinSize( CMS_FRAMEWINDOW, &(x)->frame_info )
+#define CDS_WriteFrameWinSize( x ) CDS_SaveWinSize( CMS_FRAMEWINDOW, x )
+
+#define CDS_ReadDiskWinSize( x ) CDS_GetWinSize( CMS_DISKWINDOW, &(x)->disk_info )
+#define CDS_WriteDiskWinSize( x ) CDS_SaveMDIWinSize( CMS_DISKWINDOW, x )
+
+#define CDS_ReadServerWinSize( x ) CDS_GetWinSize( CMS_SERVERWINDOW, &(x)->server_info )
+#define CDS_WriteServerWinSize( x ) CDS_SaveMDIWinSize( CMS_SERVERWINDOW, x )
+
+#define CDS_ReadTapeWinSize( x ) CDS_GetWinSize( CMS_TAPEWINDOW, &(x)->tape_info )
+#define CDS_WriteTapeWinSize( x ) CDS_SaveMDIWinSize( CMS_TAPEWINDOW, x )
+
+#define CDS_ReadLogWinSize( x ) CDS_GetWinSize( CMS_LOGWINDOW, &(x)->log_info )
+#define CDS_WriteLogWinSize( x ) CDS_SaveMDIWinSize( CMS_LOGWINDOW, x )
+
+#define CDS_ReadDebugWinSize( x ) CDS_GetWinSize( CMS_DEBUGWINDOW, &(x)->debug_info )
+#define CDS_WriteDebugWinSize( x ) CDS_SaveMDIWinSize( CMS_DEBUGWINDOW, x )
+
+#define CDS_ReadRuntimeWinSize( x ) CDS_GetWinSize( CMS_RUNTIMEDLG, &(x)->runtime_info )
+#define CDS_WriteRuntimeWinSize( x ) CDS_SaveDlgWinSize( CMS_RUNTIMEDLG, x )
+
+// CDS LOG READ/WRITE MACROS
+
+#define CDS_ReadLogFileRoot( x ) CDS_GetString( CMS_LOGGING, CMS_LOGFILEROOT, SHORTAPPNAME, CDS_GetLogFileRoot( x ), MAX_UI_LOGFILEROOT_SIZE )
+#define CDS_WriteLogFileRoot( x ) CDS_SaveString( CMS_LOGGING, CMS_LOGFILEROOT, CDS_GetLogFileRoot( x ) )
+
+#define CDS_ReadLogMode( x ) CDS_SetLogMode( x, CDS_GetInt ( CMS_LOGGING, CMS_LOGMODE, LOG_TO_FILE ) )
+#define CDS_WriteLogMode( x ) CDS_SaveInt( CMS_LOGGING, CMS_LOGMODE, CDS_GetLogMode( x ) )
+
+#define CDS_ReadLogLevel( x ) CDS_SetLogLevel( x, CDS_GetInt ( CMS_LOGGING, CMS_LOGLEVEL, LOG_ERRORS ) )
+#define CDS_WriteLogLevel( x ) CDS_SaveInt( CMS_LOGGING, CMS_LOGLEVEL, CDS_GetLogLevel( x ) )
+
+#define CDS_ReadHWCompMode( x ) CDS_SetHWCompMode( x, CDS_GetInt ( CMS_HARDWARE, CMS_HWCOMPMODE, HW_COMP_DISABLE ) ) // chs:05-04-93
+#define CDS_WriteHWCompMode( x ) CDS_SaveInt( CMS_HARDWARE, CMS_HWCOMPMODE, CDS_GetHWCompMode( x ) ) // chs:05-04-93
+
+#define CDS_ReadSWCompMode( x ) CDS_SetSWCompMode( x, CDS_GetInt ( CMS_HARDWARE, CMS_SWCOMPMODE, SW_COMP_DISABLE ) ) // chs:05-04-93
+#define CDS_WriteSWCompMode( x ) CDS_SaveInt( CMS_HARDWARE, CMS_SWCOMPMODE, CDS_GetSWCompMode( x ) ) // chs:05-04-93
+
+#define CDS_ReadNumLogSessions( x ) CDS_SetNumLogSessions( x, CDS_GetInt ( CMS_LOGGING, CMS_NUMSESSIONS, LOG_DEF_LOGFILES ) )
+#define CDS_WriteNumLogSessions( x ) CDS_SaveInt( CMS_LOGGING, CMS_NUMSESSIONS, CDS_GetNumLogSessions( x ) )
+
+#define CDS_ReadPrintLogSession( x ) CDS_SetPrintLogSession( x, CDS_GetInt ( CMS_LOGGING, CMS_PRINTSESSION, LOG_PRINT_OFF ) )
+#define CDS_WritePrintLogSession( x ) CDS_SaveInt( CMS_LOGGING, CMS_PRINTSESSION, CDS_GetPrintLogSession( x ) )
+
+
+// CDS HARDWARE READ/WRITE MACROS
+
+#define CDS_ReadActiveDriver( x ) CDS_GetString( CMS_HARDWARE, CMS_DRIVER, CMS_AUTO, CDS_GetActiveDriver( x ), DRIVER_SIZE )
+#define CDS_WriteActiveDriver( x ) CDS_SaveString( CMS_HARDWARE, CMS_DRIVER, CDS_GetActiveDriver( x ) )
+
+#define CDS_ReadTapeDriveName( x ) CDS_GetString( CMS_HARDWARE, CMS_TAPEDRIVE, CMS_AUTO, CDS_GetTapeDriveName( x ), MAXTAPEDRIVENAME )
+#define CDS_WriteTapeDriveName( x ) CDS_SaveString( CMS_HARDWARE, CMS_TAPEDRIVE, CDS_GetTapeDriveName( x ) )
+
+#define CDS_ReadTapeDriveSettlingTime( x ) CDS_SetTapeDriveSettlingTime( x, CDS_GetInt ( CMS_HARDWARE, CMS_SETTLINGTIME, DEF_DRIVE_SETTLING_TIME ) )
+#define CDS_WriteTapeDriveSettlingTime( x ) CDS_SaveInt( CMS_HARDWARE, CMS_SETTLINGTIME, CDS_GetTapeDriveSettlingTime( x ) )
+
+// CDS NT HARDWARE READ/WRITE MACROS
+
+// #define CDS_ReadTapeDriveCard( ) CDS_GetInt( CMS_HARDWARE, CMS_CARD, CDS_UNKNOWN )
+// #define CDS_WriteTapeDriveCard( x ) CDS_SaveInt( CMS_HARDWARE, CMS_CARD, ( x ) )
+//
+// #define CDS_ReadTapeDriveBus( ) CDS_GetInt( CMS_HARDWARE, CMS_BUS, CDS_UNKNOWN )
+// #define CDS_WriteTapeDriveBus( x ) CDS_SaveInt( CMS_HARDWARE, CMS_BUS, ( x ) )
+//
+// #define CDS_ReadTapeDriveTarget( ) CDS_GetInt( CMS_HARDWARE, CMS_TARGET, CDS_UNKNOWN )
+// #define CDS_WriteTapeDriveTarget( x ) CDS_SaveInt( CMS_HARDWARE, CMS_TARGET, ( x ) )
+//
+// #define CDS_ReadTapeDriveLUN( ) CDS_GetInt( CMS_HARDWARE, CMS_LUN, CDS_UNKNOWN )
+// #define CDS_WriteTapeDriveLUN( x ) CDS_SaveInt( CMS_HARDWARE, CMS_LUN, ( x ) )
+
+// CDS BACKUP ENGINE READ/WRITE MACROS
+
+#define CDS_ReadSkipOpenFiles( x ) CDS_SetSkipOpenFiles( x, (INT16)CDS_GetInt( CMS_UI, CMS_SKIP_OPEN_FILES, CDS_DISABLE ) )
+#define CDS_WriteSkipOpenFiles( x ) CDS_SaveInt( CMS_UI, CMS_SKIP_OPEN_FILES, CDS_GetSkipOpenFiles( x ) )
+
+#define CDS_ReadBackupFilesInUse( x ) CDS_SetBackupFilesInUse( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_BACKUP_FILES_INUSE, CDS_DISABLE ) )
+#define CDS_WriteBackupFilesInUse( x ) CDS_SaveInt( CMS_BENGINE, CMS_BACKUP_FILES_INUSE, CDS_GetBackupFilesInUse( x ) )
+
+#define CDS_ReadHiddenFlag( x ) CDS_SetHiddenFlag( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_HIDDEN_FLAG, CDS_ENABLE ) )
+#define CDS_WriteHiddenFlag( x ) CDS_SaveInt( CMS_BENGINE, CMS_HIDDEN_FLAG, CDS_GetHiddenFlag( x ) )
+
+#define CDS_ReadSpecialFlag( x ) CDS_SetSpecialFlag( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_SPECIAL_FLAG, CDS_ENABLE ) )
+#define CDS_WriteSpecialFlag( x ) CDS_SaveInt( CMS_BENGINE, CMS_SPECIAL_FLAG, CDS_GetSpecialFlag( x ) )
+
+#define CDS_ReadSetArchiveFlag( x ) CDS_SetSetArchiveFlag( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_SET_ARCHIVE_FLAG, CMI_ARCBIT ) )
+#define CDS_WriteSetArchiveFlag( x ) CDS_SaveInt( CMS_BENGINE, CMS_SET_ARCHIVE_FLAG, CDS_GetSetArchiveFlag( x ) )
+
+#define CDS_ReadExistFlag( x ) CDS_SetExistFlag( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_EXIST_FLAG, CDS_ENABLE ) )
+#define CDS_WriteExistFlag( x ) CDS_SaveInt( CMS_BENGINE, CMS_EXIST_FLAG, CDS_GetExistFlag( x ) )
+
+#define CDS_ReadPromptFlag( x ) CDS_SetPromptFlag( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_PROMPT_FLAG, CDS_DISABLE ) )
+#define CDS_WritePromptFlag( x ) CDS_SaveInt( CMS_BENGINE, CMS_PROMPT_FLAG, CDS_GetPromptFlag( x ) )
+
+#define CDS_ReadTFLBuffSize( x ) CDS_SetTFLBuffSize( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_TFL_BUFF_SIZE, BUFF_SIZE_TFL ) )
+#define CDS_WriteTFLBuffSize( x ) CDS_SaveInt( CMS_BENGINE, CMS_TFL_BUFF_SIZE, CDS_GetTFLBuffSize( x ) )
+
+#define CDS_ReadAFPSupport( x ) CDS_SetAFPSupport( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_SUPPORT_AFP_SERVER, CDS_ENABLE ) )
+#define CDS_WriteAFPSupport( x ) CDS_SaveInt( CMS_BENGINE, CMS_SUPPORT_AFP_SERVER, CDS_GetAFPSupport( x ) )
+
+#define CDS_ReadExtendedDateSupport( x ) CDS_SetExtendedDateSupport( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_EXTENDED_DATE_SUPPORT, CDS_ENABLE ) )
+#define CDS_WriteExtendedDateSupport( x ) CDS_SaveInt( CMS_BENGINE, CMS_EXTENDED_DATE_SUPPORT, CDS_GetExtendedDateSupport( x ) )
+
+#define CDS_ReadProcEmptyFlag( x ) CDS_SetProcEmptyFlag( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_PROC_EMPTY_FLAG, CDS_ENABLE ) )
+#define CDS_WriteProcEmptyFlag( x ) CDS_SaveInt( CMS_BENGINE, CMS_PROC_EMPTY_FLAG, CDS_GetProcEmptyFlag( x ) )
+
+#define CDS_ReadFastFileRestore( x ) CDS_SetFastFileRestore( x, (BOOLEAN)CDS_GetInt( CMS_BENGINE, CMS_USE_FFR, CDS_ENABLE ) )
+#define CDS_WriteFastFileRestore( x ) CDS_SaveInt( CMS_BENGINE, CMS_USE_FFR, CDS_GetFastFileRestore( x ) )
+
+#define CDS_ReadConfiguredMachineType( x ) CDS_SetConfiguredMachineType( x, (UINT16)CDS_GetInt( CMS_BENGINE, CMS_MACHINE_TYPE, UNKNOWN_MACHINE ) )
+#define CDS_WriteConfiguredMachineType( x ) CDS_SaveInt( CMS_BENGINE, CMS_MACHINE_TYPE, CDS_GetConfiguredMachineType( x ) )
+
+
+#define CDS_ReadSpecialWord( x ) CDS_SetSpecialWord( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_SPECIAL_WORD, NOTHING_SPECIAL ) )
+#define CDS_WriteSpecialWord( x ) CDS_SaveHexInt( CMS_BENGINE, CMS_SPECIAL_WORD, CDS_GetSpecialWord( x ) )
+
+#define CDS_ReadMaxTapeBuffers( x ) CDS_SetMaxTapeBuffers( x, (UINT16)CDS_GetLongInt( CMS_BENGINE, CMS_MAX_NUM_TAPE_BUFS, TAPE_BUFS_DEFAULT ) )
+#define CDS_WriteMaxTapeBuffers( x ) CDS_SaveInt( CMS_BENGINE, CMS_MAX_NUM_TAPE_BUFS, CDS_GetMaxTapeBuffers( x ) )
+
+#define CDS_ReadMaxBufferSize( x ) CDS_SetMaxBufferSize( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_MAX_BUFFER_SIZE, BUFF_SIZE_SMB ) )
+#define CDS_WriteMaxBufferSize( x ) CDS_SaveInt( CMS_BENGINE, CMS_MAX_BUFFER_SIZE, CDS_GetMaxBufferSize( x ) )
+
+#define CDS_ReadNetNum( x ) CDS_SetNetNum( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_NET_NUM, NO_NETWORK ) )
+#define CDS_WriteNetNum( x ) CDS_SaveInt( CMS_BENGINE, CMS_NET_NUM, CDS_GetNetNum( x ) )
+
+#define CDS_ReadSortBSD( x ) CDS_SetSortBSD( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_SORT_BSD, CDS_ENABLE ) )
+#define CDS_WriteSortBSD( x ) CDS_SaveInt( CMS_BENGINE, CMS_SORT_BSD, CDS_GetSortBSD( x ) )
+
+#define CDS_ReadRemoteDriveBackup( x ) CDS_SetRemoteDriveBackup( x, (INT16)CDS_GetInt( CMS_BENGINE, CMS_REMOTE_DRIVE_BACKUP, CMI_REMOTE ) )
+#define CDS_WriteRemoteDriveBackup( x ) CDS_SaveInt( CMS_BENGINE, CMS_REMOTE_DRIVE_BACKUP, CDS_GetRemoteDriveBackup( x ) )
+
+#define CDS_ReadWriteFormat( x ) CDS_SetWriteFormat( x, (UINT16)CDS_GetInt( CMS_BENGINE, CMS_WRITE_FORMAT, TAPE_FORMAT_DEFAULT ) )
+#define CDS_WriteWriteFormat( x ) CDS_SaveInt( CMS_BENGINE, CMS_WRITE_FORMAT, CDS_GetWriteFormat( x ) )
+
+#define CDS_ReadNRLDosVector( x ) CDS_SetNRLDosVector( x, (UINT16)CDS_GetInt( CMS_BENGINE, CMS_NRL_DOS_VECTOR, 0x60 ) )
+#define CDS_WriteNRLDosVector( x ) CDS_SaveHexInt( CMS_BENGINE, CMS_NRL_DOS_VECTOR, CDS_GetNRLDosVector( x ) )
+
+#define CDS_ReadOTCLevel( x ) CDS_SetOTCLevel( x, (UINT16)CDS_GetInt( CMS_BENGINE, CMS_OTC_LEVEL, CATALOGS_FULL ) )
+#define CDS_WriteOTCLevel( x ) CDS_SaveInt( CMS_BENGINE, CMS_OTC_LEVEL, CDS_GetNRLDosVector( x ) )
+
+#define CDS_ReadProcessSytronECCFlag( x ) CDS_SetProcessSytronECCFlag( x, (INT16)CDS_GetInt( CMS_TRANSLATORS, CMS_PROC_SYTRON_ECC, SYPL_ECC_AUTO ) )
+#define CDS_WriteProcessSytronECCFlag( x ) CDS_SaveInt( CMS_TRANSLATORS, CMS_PROC_SYTRON_ECC, CDS_GetProcessSytronECCFlag( x ) )
+
+#endif // end _muiconf_h_
+
diff --git a/private/utils/ntbackup/inc/muiutil.h b/private/utils/ntbackup/inc/muiutil.h
new file mode 100644
index 000000000..45f0ef2c6
--- /dev/null
+++ b/private/utils/ntbackup/inc/muiutil.h
@@ -0,0 +1,136 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: muiutil.h
+
+ Description: header file for mui utilities
+
+ $Log: G:\ui\logfiles\muiutil.h_v $
+
+ Rev 1.11 24 Jun 1993 17:06:50 CARLS
+added UI_CurrentDateLeadingZero and UI_CurrentTimeLeadingZero prototypes
+
+ Rev 1.10 23 Jun 1993 09:21:32 GLENN
+Added WM_IsMultiTaskBusy().
+
+ Rev 1.9 01 Nov 1992 16:31:52 DAVEV
+Unicode changes
+
+ Rev 1.8 04 Oct 1992 19:48:16 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.7 12 Feb 1992 18:04:40 CHUCKB
+Removed prototype for ValidatePath.
+
+ Rev 1.6 12 Feb 1992 16:29:58 CHUCKB
+Added prototype for ValidatePath.
+
+ Rev 1.5 10 Feb 1992 10:39:32 CHUCKB
+Moved prototype for BuildNumeralWithCommas from details.h to muiutil.h.
+
+ Rev 1.4 03 Jan 1992 17:53:54 CHUCKB
+Added prototype for UI_MakeShortTimeString.
+
+ Rev 1.3 10 Dec 1991 09:45:14 CHUCKB
+Changed prototype for makeautojobs.
+
+ Rev 1.2 09 Dec 1991 17:04:16 CHUCKB
+Added prototype for MakeAutoJobs.
+
+ Rev 1.1 03 Dec 1991 16:01:28 GLENN
+Changed UI_ParseShortDate and UI_ParseTime to UI_InitDate and UI_InitTime.
+
+ Rev 1.0 20 Nov 1991 19:42:02 SYSTEM
+Initial revision.
+
+*****************************************************/
+
+#ifndef MUIUTIL_H
+#define MUIUTIL_H
+
+// defines for string conversions
+
+#ifdef UNICODE
+# undef AnsiLower
+# undef AnsiLowerBuff
+# undef AnsiUpper
+# undef AnsiUpperBuff
+
+# define AnsiLower CharLowerW
+# define AnsiLowerBuff CharLowerBuffW
+# define AnsiUpper CharUpperW
+# define AnsiUpperBuff CharUpperBuffW
+#endif
+
+#ifdef tolower
+#undef tolower
+#define tolower(x) UI_AnsiLowerChar(x)
+#endif
+
+#ifdef toupper
+#undef toupper
+#define toupper(x) UI_AnsiUpperChar(x)
+#endif
+
+#ifdef strlwr
+#undef strlwr
+#define strlwr(x) UI_AnsiLowerString(x)
+#endif
+
+#ifdef strupr
+#undef strupr
+#define strupr(x) UI_AnsiUpperString(x)
+#endif
+
+#define ThreadSwitch() WM_MultiTask()
+
+// defines for short date formats
+
+#define MDY 1
+#define DMY 2
+#define YMD 3
+
+#define UI_COMMA_SPACING ( 3 )
+
+// international date/time function prototypes
+
+INT16 UI_AnsiLowerChar ( INT16 ) ;
+CHAR_PTR UI_AnsiLowerString ( CHAR_PTR ) ;
+INT16 UI_AnsiUpperChar ( INT16 ) ;
+CHAR_PTR UI_AnsiUpperString ( CHAR_PTR ) ;
+VOID UI_BuildNumeralWithCommas ( CHAR_PTR ) ;
+VOID UI_CurrentDateLeadingZero ( LPSTR ) ;
+VOID UI_CurrentDate ( LPSTR ) ;
+VOID UI_CurrentTimeLeadingZero ( LPSTR ) ;
+VOID UI_CurrentTime ( LPSTR ) ;
+VOID UI_GetAMString ( LPSTR ) ;
+INT UI_GetDateFormat ( VOID ) ;
+CHAR UI_GetDateSeparator ( VOID ) ;
+VOID UI_GetPMString ( LPSTR ) ;
+CHAR UI_GetTimeSeparator ( VOID ) ;
+
+VOID UI_IntToDate ( LPSTR, UINT16 ) ;
+VOID UI_IntToTime ( LPSTR, UINT16 ) ;
+VOID UI_LongToDate ( LPSTR, LONG ) ;
+VOID UI_LongToTime ( LPSTR, LONG ) ;
+
+VOID UI_MakeDateString ( LPSTR, INT, INT, INT ) ;
+VOID UI_MakeShortTimeString ( LPSTR, INT, INT ) ;
+VOID UI_MakeTimeString ( LPSTR, INT, INT, INT ) ;
+VOID UI_MakeAutoJobs ( INT ) ;
+VOID UI_InitIntl ( VOID ) ;
+VOID UI_InitDate ( VOID ) ;
+VOID UI_InitThousandsChar ( VOID ) ;
+VOID UI_InitTime ( VOID ) ;
+
+BOOL UI_UseLeadCentury ( VOID ) ;
+BOOL UI_UseLeadDays ( VOID ) ;
+BOOL UI_UseLeadMonth ( VOID ) ;
+BOOL UI_UseLeadTime ( VOID ) ;
+BOOL UI_Use24Hour ( VOID ) ;
+
+VOID WM_MultiTask ( VOID ) ;
+BOOL WM_IsMultiTaskBusy ( VOID ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/nets.h b/private/utils/ntbackup/inc/nets.h
new file mode 100644
index 000000000..ed4d5e968
--- /dev/null
+++ b/private/utils/ntbackup/inc/nets.h
@@ -0,0 +1,40 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: nets.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: N:/LOGFILES/NETS.H_V $
+ *
+ * Rev 1.1 11 Sep 1991 09:58:44 DON
+ * changed 'far' to PTR_SIZE - defined in stdtypes.h for portability
+ *
+ * Rev 1.0 09 May 1991 13:31:54 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _nets_h_
+#define _nets_h_
+
+typedef struct NET_TABLE PTR_SIZE *NET_TABLE_PTR;
+typedef struct NET_ROUTE PTR_SIZE *NET_ROUTE_PTR;
+
+extern NET_TABLE_PTR NETS_AllocateTable( UINT16 max_nets );
+
+extern INT16 NETS_Initialize( VOID ) ;
+extern VOID NETS_DeInitialize( VOID );
+
+extern VOID NETS_LoadInternetwork( NET_TABLE_PTR cur_table, PF_VOID func );
+
+extern NET_ROUTE_PTR NETS_AddNetwork( NET_TABLE_PTR net_table, UINT32 new_net_num );
+
+#endif
diff --git a/private/utils/ntbackup/inc/network.h b/private/utils/ntbackup/inc/network.h
new file mode 100644
index 000000000..b1b2fcb80
--- /dev/null
+++ b/private/utils/ntbackup/inc/network.h
@@ -0,0 +1,35 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1992
+
+ Name: network.h
+
+ Description: Contains dialog control id's for the network settings dialog
+
+ $Log: G:/UI/LOGFILES/NETWORK.H_V $
+
+ Rev 1.1 04 Oct 1992 19:48:16 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 06 Apr 1992 04:05:00 CHUCKB
+Initial revision.
+
+*****************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSNETWORK 17
+#else
+#include "dlg_ids.h"
+#endif
+
+
+/* network controls */
+
+#define IDD_NET_MAPPED 101
+#define IDD_NET_SERVVOL 102
+#define IDD_NET_DBGROUPBOX 103
+#define IDD_NET_USEDB 104
+#define IDD_NET_ENTERPW 105
+#define IDD_NET_HELP 106
+#define IDD_NET_REMOVEPW 107
diff --git a/private/utils/ntbackup/inc/nextset.h b/private/utils/ntbackup/inc/nextset.h
new file mode 100644
index 000000000..c889eb91c
--- /dev/null
+++ b/private/utils/ntbackup/inc/nextset.h
@@ -0,0 +1,37 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1992
+
+ Name: nextset.h
+
+ Description: Contains dialog control id's for the next set dialog,
+ which starts a search to the next set on a cataloged tape
+
+ $Log: G:/UI/LOGFILES/NEXTSET.H_V $
+
+ Rev 1.2 04 Oct 1992 19:48:18 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 07 Apr 1992 08:57:48 CARLS
+removed HELP ID for translate
+
+ Rev 1.0 06 Apr 1992 04:05:00 CHUCKB
+Initial revision.
+
+
+*****************************************************/
+
+
+#ifdef TRANSLATE
+#define IDD_NEXT_SET 42
+#else
+#include "dlg_ids.h"
+#endif
+
+
+/* next set dialog box defines */
+
+#define IDD_NEXT_TEXT 100
+#define IDD_NEXT_OK 101
+#define IDD_NEXT_ABORT 102
+#define IDD_NEXT_HELP 103
diff --git a/private/utils/ntbackup/inc/nonafp.h b/private/utils/ntbackup/inc/nonafp.h
new file mode 100644
index 000000000..f444ac0ed
--- /dev/null
+++ b/private/utils/ntbackup/inc/nonafp.h
@@ -0,0 +1,179 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: nonafp.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Prototypes for the NON AFP novell file system support
+ functions.
+
+
+ $Log: N:/LOGFILES/NONAFP.H_V $
+ *
+ * Rev 1.8 03 Dec 1992 13:30:22 CARLS
+ * added NOV_IsBlkComplete
+ *
+ * Rev 1.7 15 Oct 1992 13:21:48 CARLS
+ * added active_stream_id to NOV_FILE_HAND for MTF 4.0
+ *
+ * Rev 1.6 22 Sep 1992 17:14:46 CHUCKB
+ * Removed references to fs_GetTotalSizeDBLK().
+ *
+ * Rev 1.5 15 Sep 1992 10:17:20 CARLS
+ * updated read,write,verifyObj prototypes
+ *
+ * Rev 1.4 28 Aug 1992 16:26:00 BARRY
+ * Updated prototypes for formerly common functions.
+ *
+ * Rev 1.3 08 Jul 1992 15:20:02 BARRY
+ * Added NOV_SetTempHandle prototype.
+ *
+ * Rev 1.2 20 Dec 1991 09:12:08 STEVEN
+ * move common functions into tables
+ *
+ * Rev 1.1 23 May 1991 16:46:06 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:32:32 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef NONAFP_H
+#define NONAFP_H
+
+
+typedef struct NOV_FILE_HAND_STRUCT {
+ INT16 dos_data_hand ; /* DOS handle for the file */
+ UINT32 data_size ; /* Number of bytes needed for file data */
+ UINT32 data_offset ; /* Offset to normal file data */
+ UINT32 trust_size ; /* Number of bytes needed for trustees */
+ UINT32 trust_offset ; /* Offset to trustee info */
+ UINT8 trust_format ; /* Format specifier for trustee fork */
+ UINT16 trust_index ; /* Holds trust read index between calls */
+ CHAR file_name[14] ; /* File name for subsequent trust calls */
+ UINT32 active_stream_id ; /* ID of stream being processed */
+} NOV_FILE_HAND_STRUCT, *NOV_FILE_HAND;
+
+
+INT16 NOV_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 mask );
+
+INT16 NOV_AttachToDLE( FSYS_HAND fsh, GENERIC_DLE_PTR dle,
+ CHAR_PTR uname, CHAR_PTR pswd ) ;
+
+INT16 NOV_DetachDLE( FSYS_HAND fsh ) ;
+
+INT16 NOV_MatchDBLK( FSYS_HAND fsh, DBLK_PTR ddb1, DBLK_PTR fdb1,
+ BOOLEAN disp_flag, struct FSE *fse ) ;
+
+INT16 NOV_GetCurrentDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NOV_GetCurrentPath( FSYS_HAND fsh, CHAR_PTR path, INT16 *size ) ;
+
+INT16 NOV_GetBasePath( FSYS_HAND fsh, CHAR_PTR path, INT16 *size ) ;
+
+INT16 NOV_ChangeDir( FSYS_HAND fsh, CHAR_PTR path, INT16 psize ) ;
+
+INT16 NOV_UpDir( FSYS_HAND fsh ) ;
+
+
+INT16 NOV_CreateObj( FSYS_HAND fsh, DBLK_PTR dblk );
+
+INT16 NOV_OpenObj( FSYS_HAND fsh, FILE_HAND *hand, DBLK_PTR dblk,
+ OPEN_MODE Mode ) ;
+
+INT16 NOV_SeekObj( FILE_HAND hand, UINT32 *offset ) ;
+
+INT16 NOV_ReadObj( FILE_HAND hand, CHAR_PTR buffer, UINT16 *size, UINT16 *blk_size, STREAM_INFO_PTR s_info ) ;
+
+INT16 NOV_WriteObj( FILE_HAND hand, CHAR_PTR buffer, UINT16 *size, UINT16 *blk_size, STREAM_INFO_PTR s_info ) ;
+
+INT16 NOV_VerObj( FILE_HAND hand, CHAR_PTR buffer, CHAR_PTR data,
+ UINT16 *size, UINT16 *blk_size, STREAM_INFO_PTR s_info ) ;
+
+INT16 NOV_CloseObj( FILE_HAND hand ) ;
+
+INT16 NOV_DeleteObj( FSYS_HAND fsh, DBLK_PTR dblk );
+
+INT16 NOV_GetObjInfo( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 NOV_SetObjInfo( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 NOV_VerObjInfo( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 NOV_FindFirst( FSYS_HAND fsh, DBLK_PTR ddb, CHAR_PTR os_name, UINT16 find_type ) ;
+
+INT16 NOV_FindNext( FSYS_HAND fsh, DBLK_PTR Info ) ;
+
+INT16 NOV_PushMinDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NOV_PopMinDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NOV_GetSpecDBLKS( FSYS_HAND fsh, DBLK_PTR cblock, INT32 *index );
+
+INT16 NOV_ModFnameFDB( FSYS_HAND fsh, BOOLEAN set_it, DBLK_PTR fdb, CHAR_PTR buf, INT16 *size );
+
+INT16 NOV_ModPathDDB( FSYS_HAND fsh, BOOLEAN set_it, DBLK_PTR fdb, CHAR_PTR buf, INT16 *size );
+
+INT16 NOV_GetOSFnameFDB( DBLK_PTR fdb, CHAR_PTR buf );
+
+INT16 NOV_GetOSPathDDB( FSYS_HAND fsh, DBLK_PTR fdb, CHAR_PTR buf );
+
+INT16 NOV_GetCdateDBLK( DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+INT16 NOV_ModBdateDBLK( BOOLEAN set_it, DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+INT16 NOV_GetMdateDBLK( DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+INT16 NOV_ModAdateDBLK( BOOLEAN set_it, DBLK_PTR dblk, DATE_TIME *buf ) ;
+
+UINT64 NOV_GetDispSizeDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+// UINT64 NOV_GetTotalSizeDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 NOV_ModAttribDBLK( BOOLEAN get_set, DBLK_PTR dblk, UINT32 *attrib) ;
+
+INT16 NOV_GetFileVerFDB( DBLK_PTR dblk, UINT32 *ver ) ;
+
+INT16 NOV_GetObjTypeDBLK( DBLK_PTR dblk, OBJECT_TYPE *type ) ;
+
+INT16 NOV_GetOS_InfoDBLK( DBLK_PTR dblk, CHAR_PTR os_info, INT16 *size ) ;
+
+INT16 NOV_GetActualSizeDBLK( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 NOV_SizeofFname( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+INT16 NOV_SizeofOSFname( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+INT16 NOV_SizeofOSPath( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NOV_SizeofPath( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NOV_SizeofOSInfo( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NOV_CreateFDB( FSYS_HAND fsh, GEN_FDB_DATA_PTR data ) ;
+
+INT16 NOV_CreateDDB( FSYS_HAND fsh, GEN_DDB_DATA_PTR data ) ;
+
+VOID NOV_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+INT16 NOV_ChangeIntoDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+UINT16 NOV_SpecExcludeObj( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ DBLK_PTR fdb ) ; /* I - Descriptor block of fdb */
+
+UINT16 NOV_SetDataSize( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ UINT32 size ) ; /* I - new size */
+
+VOID NOV_CheckBindClose( FSYS_HAND fsh, DBLK_PTR fdb ) ;
+
+INT16 NOV_SetTempHandle( FSYS_HAND fsh );
+
+BOOLEAN NOV_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/nov386.h b/private/utils/ntbackup/inc/nov386.h
new file mode 100644
index 000000000..8eaf642f5
--- /dev/null
+++ b/private/utils/ntbackup/inc/nov386.h
@@ -0,0 +1,67 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: nov386.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Definitions/macros for NetWare 386.
+
+
+
+ $Log: G:/LOGFILES/NOV386.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:32:26 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef nov386_h
+#define nov386_h
+
+
+/*
+ * These bits have been added in NetWare 386 and reside in the new additional
+ * 16-bits of attributes kept for '386 files and directories. (Stored in the
+ * "attributes_386" field of the NetWare 386 info for FDBs and DDBs.)
+ */
+#define NOV_IMM_PURGE 0x0001 /* Purge immediate */
+#define NOV_REN_INHIBIT 0x0002 /* Rename inhibit */
+#define NOV_DEL_INHIBIT 0x0004 /* Delete inhibit */
+#define NOV_CPY_INHIBIT 0x0008 /* Copy inhibit */
+
+
+/*
+ * Additional information kept by NetWare 386 for directories that
+ * we'll add to the DDB.
+ */
+typedef struct NOVELL_386_DIR {
+ BOOLEAN info_valid ; /* TRUE when info below is valid */
+ UINT32 maximum_space ; /* Max disk space allowed for dir */
+ UINT16 attributes_386 ; /* Most sig 16 bits of 32-bit attr */
+ UINT8 extend_attr ; /* Most sig byte of low 16 bits */
+ UINT8 inherited_rights ; /* Most sig byte of rights mask */
+} NOVELL_386_DIR ;
+
+
+/*
+ * Additional information kept by NetWare 386 for files that we'll keep
+ * in the FDB.
+ */
+typedef struct NOVELL_386_FILE {
+ BOOLEAN info_valid ; /* TRUE when info below is valid */
+ UINT16 creation_time ;
+ UINT32 archiver_id ;
+ UINT16 attributes_386 ; /* Most sig 16 bits of 32-bit attr */
+ UINT32 last_modifier_id ;
+ UINT32 trust_fork_size ; /* Trustee info */
+ UINT32 trust_fork_offset ;
+ UINT8 trust_fork_format ; /* See NOVCOM.H for trust formats */
+ UINT16 inherited_rights ; /* Rights mask--new for files */
+} NOVELL_386_FILE ;
+
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/novcom.h b/private/utils/ntbackup/inc/novcom.h
new file mode 100644
index 000000000..a879a0998
--- /dev/null
+++ b/private/utils/ntbackup/inc/novcom.h
@@ -0,0 +1,315 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: novcom.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This header file contians prototypes for internal
+ common novell funcitons.
+
+
+ $Log: N:/LOGFILES/NOVCOM.H_V $
+ *
+ * Rev 1.11 15 Oct 1992 13:20:48 CARLS
+ * added active_stream_id to DIR_HAND for MTF 4.0
+ *
+ * Rev 1.10 25 Sep 1992 15:13:56 CARLS
+ * spelling error
+ *
+ * Rev 1.9 28 Aug 1992 16:27:06 BARRY
+ * Added prototypes for new functions.
+ *
+ * Rev 1.8 14 Aug 1992 09:52:18 BARRY
+ * Fixed error in prototype.
+ *
+ * Rev 1.7 08 Jul 1992 15:20:50 BARRY
+ * Fold branched fixes for UTF back to trunk.
+ *
+ * Rev 1.6 21 May 1992 15:31:18 BARRY
+ * Added max volumes/server info structs/protos.
+ *
+ * Rev 1.5 19 Dec 1991 15:13:24 STEVEN
+ * move common functions to bables
+ *
+ * Rev 1.4 17 Dec 1991 10:19:42 BARRY
+ * Added defines and structures to support the UTF tape format translator.
+ *
+ * Rev 1.3 20 Aug 1991 09:31:12 STEVEN
+ * minor code review changes
+ *
+ * Rev 1.2 23 May 1991 18:20:20 BARRY
+ * Lose access_date & create_date from the private area.
+ *
+ * Rev 1.1 23 May 1991 16:46:28 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:32:24 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef novcom_h
+#define novcom_h
+
+#define SUPERVISOR 1
+#define TTS_SUPPORTED 2
+#define SUPPORT_386 4
+
+#define NORMAL_FILE 0
+#define NET286_BIND 1
+#define NET386_BIND 2
+
+
+/* Attribute bit definitions */
+#define ATTR_READ_ONLY 0x01 /* DOS attributes */
+#define ATTR_HIDDEN 0x02
+#define ATTR_SYSTEM 0x04
+#define ATTR_EXEC_ONLY 0x08
+#define ATTR_SUB_DIR 0x10
+#define ATTR_ARCHIVE 0x20
+#define ATTR_SHAREABLE 0x80
+
+#define ATTR_TRANSACTION 0x10 /* NetWare extended attributes */
+#define ATTR_INDEXED 0x20
+#define ATTR_READ_AUDIT 0x40
+#define ATTR_WRITE_AUDIT 0x80
+
+
+/* NetWare 386 Trustee rights */
+#define TR_386_READ 0x01
+#define TR_386_WRITE 0x02
+#define TR_386_CREATE 0x08
+#define TR_386_ERASE 0x10
+#define TR_386_ACCESS 0x20
+#define TR_386_FILE 0x40
+#define TR_386_MODIFY 0x80
+#define TR_386_NORMAL 0xff
+
+#define TR_386_SUPERVISOR 0x01
+
+
+/* NONAFP-specific reserved info */
+
+typedef struct {
+ UINT16 find_type ; /* type of FindFirst/Next scan */
+} NOV_RES_INFO ;
+
+
+/* AFP-specific reserved info */
+
+typedef struct {
+ UINT8 dir_hand ; /* AFP temporary directory handle */
+ UINT32 entry_id ; /* Entry id of current file/dir */
+ UINT16 path_size ; /* Size of long_path below */
+ CHAR_PTR long_path ; /* Current long path */
+ UINT16 find_type ; /* type of FindFirst/Next scan */
+} AFP_RES_INFO ;
+
+
+/*
+ * Reserved information (referenced by the reserved field in the file
+ * system handle) for AFP and non-AFP file systems.
+ */
+
+typedef struct {
+ UINT16 bindery_flags ; /* Status of bindery */
+ UINT8 temp_dir_handle ; /* Handle for NetWare 386 */
+ UINT32 user_object_id ; /* Bindery object id of user */
+ union {
+ NOV_RES_INFO nov ; /* NONAFP reserved info */
+ AFP_RES_INFO afp ; /* AFP reserved info */
+ } info ;
+} NOVELL_RES, *NOVELL_RES_PTR ;
+
+
+typedef struct DIR_HAND_STRUCT {
+ INT16 index ;
+ UINT32 trust_fork_offset ;
+ UINT32 trust_fork_size ;
+ UINT8 trust_fork_format ;
+ CHAR path[ 256 ] ;
+ UINT32 active_stream_id ;
+} DIR_HAND_STRUCT, *DIR_HAND;
+
+typedef struct TRUSTEE286 {
+ UINT32 object_id ;
+ UINT8 rights ;
+} TRUSTEE286, *TRUSTEE286_PTR ;
+
+typedef struct TRUST386 {
+ UINT32 object_id ;
+ UINT16 rights ;
+} TRUST386, *TRUST386_PTR ;
+
+typedef struct TRUST286_UTF {
+ UINT32 object_id ;
+ UINT8 rights ;
+ UINT8 reserved ; /* Unused on UTF 286 tapes */
+} TRUST286_UTF, *TRUST286_UTF_PTR ;
+
+
+#define TRUSTEES286_PER_CALL 5 /* Number of trustees returned per call */
+#define TRUSTEE286_SIZE 5 /* Size of a NetWare 286 trustee entry */
+#define TRUSTEE286_BLOCK_SIZE 25 /* Size needed for 1 call for trustees */
+
+#define TRUST386_PER_CALL 20 /* Number of trustees returned per call */
+#define TRUST386_SIZE 6 /* Size of a NetWare 386 trustee entry */
+#define TRUST386_BLOCK_SIZE 120 /* Size needed for 1 call for trustees */
+
+#define TRUST286_UTF_SIZE 6 /* Size of Netware 286 trustee from UTF */
+#define TRUST286_UTF_BLOCK_SIZE 30 /* Size of block of UTF 286 trustees */
+
+#define TRUST286_BLOCK 500 /* size of 100 TRUSTEEs in bytes */
+#define TRUST_BLOCK_386 600 /* size of 100 TRUST386s in bytes */
+#define TRUST_BLOCK_286_UTF 600 /* size of 100 TRUST386s in bytes */
+
+
+typedef struct {
+ UINT16 length;
+ CHAR serverName[48];
+ UINT8 verMajor;
+ UINT8 verMinor;
+ UINT16 maxConnect;
+ UINT16 usedConnect;
+ UINT16 maxVolumes;
+ UINT8 osRevision;
+ UINT8 sftLevel;
+ UINT8 ttsLevel;
+ UINT16 peakConnectUsed;
+ UINT8 accountVer;
+ UINT8 vapVer;
+ UINT8 queueVer;
+ UINT8 printVer;
+ UINT8 consoleVer;
+ UINT8 securityLevel;
+ UINT8 bridgeVer;
+ UINT8 reserved[60];
+} NOVELL_SERVER_INFO, *NOVELL_SERVER_INFO_PTR;
+
+
+UINT8 GetDirHand( CHAR drive ) ;
+
+UINT8 GetServSupp( UINT16 os_version ) ;
+
+VOID GetNovNetPath( UINT8 drive_hand, CHAR_PTR vol, CHAR_PTR path ) ;
+
+VOID GetNovServ( CHAR drive, CHAR_PTR serv_name, UINT8 *serv_num ) ;
+
+VOID SetPreferredServer( UINT8 server_num ) ;
+
+UINT8 GetPreferredServer( VOID ) ;
+
+INT16 GetFileServerInformation( NOVELL_SERVER_INFO_PTR info );
+
+INT16 NOV_GetMaxVolumes( VOID );
+
+VOID GetVolNum( CHAR_PTR vol_name, UINT8 *vol_num ) ;
+
+VOID CloseBind( UINT8 server_num ) ;
+
+VOID OpenBind( UINT8 server_num ) ;
+
+VOID DeAllocateDirHand( UINT8 dir_hand ) ;
+
+INT16 ScanTrustee( UINT8 drive_handle, CHAR_PTR path, INT16 index,
+ TRUSTEE286 *trust_list ) ;
+
+INT16 ScanTrustee386( UINT8 drive_handle, CHAR_PTR path, INT16 index,
+ TRUST386 *trust_list, INT16 *count ) ;
+
+INT16 AddTrustee( UINT16 hand, CHAR_PTR path, TRUSTEE286_PTR trust_data ) ;
+
+INT16 AddTrustee386( UINT16 hand, CHAR_PTR path, TRUST386_PTR trust_data ) ;
+
+INT16 CountTrustee( UINT8 drive_handle, CHAR_PTR path, INT16 *count ) ;
+
+INT16 CountTrustee386( UINT8 drive_handle, CHAR_PTR path, INT16 *count ) ;
+
+INT16 ReadTrustees( FILE_HAND hand, UINT8 dir_handle, CHAR *path,
+ INT16 *index, CHAR *buf, UINT16 *size,
+ UINT16 *blk_size ) ;
+
+INT16 ReadTrustees386( FILE_HAND hand, UINT8 dir_handle,
+ CHAR *path, INT16 *index, CHAR *buf,
+ UINT16 *size, UINT16 *blk_size ) ;
+
+INT16 WriteTrustees( FILE_HAND hand, UINT8 drive_hand, CHAR_PTR path,
+ UINT8 format, CHAR_PTR buf, UINT16 *size,
+ UINT16 *blk_size ) ;
+
+INT16 CompareTrust( FILE_HAND hand, UINT8 dir_handle, CHAR_PTR data, INT16 size, INT16 fmt) ;
+
+INT16 CompareTrust386( FILE_HAND hand, UINT8 dir_hand, CHAR_PTR path,
+ CHAR_PTR data, INT16 size) ;
+
+INT16 NOV_GetNumEntries( UINT8 nov_dir_hand ) ;
+
+VOID NOV_MakePath( CHAR_PTR dest, INT16 dest_size, CHAR_PTR source, INT16 leng, UINT8 os_id, UINT8 os_ver ) ;
+
+BOOLEAN NOV_ProcessDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NOV_DetBindAction( GENERIC_DLE_PTR dle, CHAR_PTR name ) ;
+
+INT16 CreateDirNOV( CHAR_PTR path, UINT8 drive_hand ) ;
+
+INT16 SRV_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name */
+ CHAR_PTR pswd); /* I - passowrd */
+
+INT16 SRV_DetachDLE( FSYS_HAND fsh ) ;
+
+INT16 SRV_LoginToServer( CHAR_PTR s_name, CHAR_PTR u_name, CHAR_PTR password,
+ UINT8_PTR server_num ) ;
+
+INT16 SRV_LogoutFromServer( GENERIC_DLE_PTR dle_ptr ) ;
+
+INT16 SRV_DetachFromServer( UINT8 server_num ) ;
+
+INT16 GetConnectionInfo( UINT8 server_num ) ;
+
+UINT32 GetUserObjectID( VOID ) ;
+
+UINT8 GetTemporaryDirectoryHandle( CHAR_PTR volume, UINT8 current_drive,
+ CHAR *mapped_drive ) ;
+
+UINT16 SetDirHandle( UINT8 dst_hand, UINT8 src_hand, CHAR_PTR src_path ) ;
+
+INT16 NOV_EnumSpecFiles( GENERIC_DLE_PTR del, UINT16 *index, CHAR_PTR *path, INT16 *psize, CHAR_PTR *fname ) ;
+
+UINT16 NOV_CalcForkDelta( UINT32 current_pos, INT16 num_args, UINT32 offsets, ... ) ;
+
+INT16 NOV_DeviceDispName(
+GENERIC_DLE_PTR dle,
+CHAR_PTR dev_name,
+INT16 size,
+INT16 type ) ;
+
+VOID NOV_GetVolName( GENERIC_DLE_PTR dle,CHAR_PTR buffer ) ;
+
+INT16 NOV_SizeofVolName( GENERIC_DLE_PTR dle ) ;
+
+INT16 NOV_MakeParsablePath(
+CHAR_PTR buf,
+INT16 bsize,
+GENERIC_DLE_PTR dle,
+CHAR_PTR path,
+INT16 psize,
+CHAR_PTR fname ) ;
+
+BOOLEAN NOV_NetworkError( VOID );
+
+BOOLEAN NOV_IsNetworkDrive( CHAR drive );
+INT16 NOV_IdentifyDrive( CHAR drive, BE_CFG_PTR cfg, UINT16 *version );
+
+INT16 CheckNovell( CHAR drive_num, UINT16 *version );
+
+INT16 NOV_DeviceDispName( GENERIC_DLE_PTR dle,
+ CHAR_PTR dev_name,
+ INT16 size,
+ INT16 type );
+
+#endif
diff --git a/private/utils/ntbackup/inc/novdblk.h b/private/utils/ntbackup/inc/novdblk.h
new file mode 100644
index 000000000..be294937d
--- /dev/null
+++ b/private/utils/ntbackup/inc/novdblk.h
@@ -0,0 +1,150 @@
+/** :IH1: Copyright (C) Maynard Electronics, Inc 1984-89
+
+:Name: novcblk.h
+
+:Description: This file contains the definition of the Novell
+ file and directory control blocks.
+
+:Units: Novell < 2.15 File System
+
+
+ $Log: N:/LOGFILES/NOVDBLK.H_V $
+ *
+ * Rev 1.2 11 Dec 1992 11:00:38 CARLS
+ * removed tape_attribs for MTF 4.0
+ *
+ * Rev 1.1 28 Aug 1992 16:27:32 BARRY
+ * No longer need nov386.h.
+ *
+ * Rev 1.0 09 May 1991 13:32:22 HUNTER
+ * Initial revision.
+
+
+
+**/
+
+#ifndef novdblk_h
+#define novdblk_h
+
+/* miximum Novell string lengths */
+#define NOV_MAX_FSIZE 16
+#define NOV_MAX_DSIZE (255 - NOV_MAX_FSIZE)
+
+
+#define NOV_READ_ONLY 1
+#define NOV_HIDDEN 2
+#define NOV_SYSTEM 4
+#define NOV_EXECUTE 8
+#define NOV_SUBDIR 0x10
+#define NOV_ARCHIVE 0x20
+#define NOV_SHARE 0x80
+#define NOV_TRANS 0x10
+#define NOV_INDEX 0x20
+
+#define CONVERT_DOS_ATTRIB( atrib ) ((UINT32)(attrib) << 16 )
+
+/* defines used for FSYS_HAND reserved space */
+#define BIND_CLOSED 0x80
+#define BIND_FILE1 0x01 /* NET$BIND or NET$OBJ */
+#define BIND_FILE2 0x02 /* NET$BVAL or NET$VAL */
+#define BIND_FILE3 0x04 /* NET$PROP */
+#define BIND_ALL_286 0x03
+#define BIND_ALL_386 0x07
+
+
+/* defines used for find first/next */
+typedef enum {
+ NORM_DOS,
+ DIR_14_FOUND,
+ NOV_14_DIR
+} SCAN_STATE;
+
+
+typedef struct NOVELL_COMMON {
+/*
+ standard DOS DTA
+*/
+ UINT8 reserved[ 21 ] ; /* reserved for dos */
+ UINT8 attrib ; /* file attribute */
+ UINT16 time ; /* file update time */
+ UINT16 date ; /* file date */
+ UINT32 size ; /* file size */
+ CHAR name[NOV_MAX_FSIZE] ; /* file name */
+
+ SCAN_STATE scan ; /* flag used to determin if novell */
+
+ BOOLEAN min_dblk ; /* TRUE if DBLK not completly initialized */
+
+/*
+ additional space for novell calls required to support the above flag
+*/
+ UINT16 seq_num ; /* info for novell's scan dir info */
+ CHAR filespec[NOV_MAX_FSIZE] ; /* search path */
+
+} NOVELL_COMMON ;
+
+typedef struct NOV_FDB {
+ UINT8 blk_type ; /* block id = FDB_ID */
+ COM_DBLK fs_reserved ;
+
+ NOVELL_COMMON com ;
+
+ UINT16 handle ; /* DOS file handle of created file */
+
+/*
+ OS specific file information
+*/
+ UINT8 extend_attr ;
+ UINT16 creat_date ;
+ UINT16 backup_date ;
+ UINT16 backup_time ;
+
+ UINT32 owner ;
+ UINT16 access_date ;
+
+ UINT16 os_name ;
+
+ UINT32 data_fork_offset ;
+ NOVELL_386_FILE info_386;
+
+} NOV_FDB, *NOV_FDB_PTR ;
+
+
+
+typedef struct NOV_DDB {
+ UINT8 blk_type ; /* block id = DDB_ID */
+ COM_DBLK fs_reserved ;
+
+ NOVELL_COMMON com ;
+
+/*
+ OS specific file information
+*/
+ CHAR path[ NOV_MAX_DSIZE ] ; /* \Fred\sue */
+ UINT8 max_rights ;
+
+ UINT16 os_path;
+ INT16 os_path_leng ;
+ UINT32 owner ;
+ UINT32 trust_fork_offset ;
+ UINT32 trust_fork_size ;
+ UINT8 trust_fork_format ;
+
+ NOVELL_386_DIR info_386;
+
+} NOV_DDB, *NOV_DDB_PTR;
+
+/*
+ Minimal DDB
+*/
+typedef struct NOV_MIN_DDB {
+ Q_ELEM q ;
+ UINT8 reserved[ 21 ] ; /* reserved for dos */
+ UINT16 seq_num ; /* info for novell's scan dir info */
+ SCAN_STATE scan ; /* flag used to determin if novell */
+ CHAR filespec[ NOV_MAX_FSIZE ] ; /* search path */
+ UINT16 psize ; /* size of path string */
+ CHAR_PTR path; /* build from "name" and current dir */
+} NOV_MIN_DDB, *NOV_MIN_DDB_PTR;
+
+#endif
diff --git a/private/utils/ntbackup/inc/novinit.h b/private/utils/ntbackup/inc/novinit.h
new file mode 100644
index 000000000..213566c06
--- /dev/null
+++ b/private/utils/ntbackup/inc/novinit.h
@@ -0,0 +1,60 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: novinit.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Include file for Novell Server/Volume DLE init
+
+ Location: BE_PRIVATE
+
+
+ $Log: M:/LOGFILES/NOVINIT.H_V $
+ *
+ * Rev 1.3 08 Jul 1992 15:21:50 BARRY
+ * Removed temp mapped drive #defines.
+ *
+ * Rev 1.2 20 Dec 1991 09:12:40 STEVEN
+ * move common functions into tables
+ *
+ * Rev 1.1 31 Jul 1991 18:49:46 DON
+ * added new prototype for NLMSRV_AddNovellServerDLEs
+ *
+ * Rev 1.0 09 May 1991 13:31:14 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef novinit_h
+#define novinit_h
+
+/*
+ Defines for server/volume support
+*/
+#define BINDERY_GET_SERVER_NAMES 0x04
+
+#define BINDERY_READ_SUCCESS 0x00
+#define BINDERY_NO_MORE_OBJECTS 0xFC
+#define VOLUME_DOES_NOT_EXIST 0x98
+
+INT16 AddNovellServerDLEs(
+DLE_HAND hand,
+BE_CFG_PTR cfg,
+UINT32 fsys_mask ) ;
+
+INT16 NLMSRV_AddNovellServerDLEs( DLE_HEAD_PTR hand ) ;
+
+INT16 GetConnectionInfo( UINT8 server_num ) ;
+
+VOID DeallocateLoginMapping( UINT8 server_num ) ;
+
+BOOLEAN IsMaynstreamDirOnServer( UINT8 server_num ) ;
+
+INT16 AsmLoginToFileServer ( CHAR_PTR u_name, UINT16 type , CHAR_PTR pswd ) ;
+
+extern UINT8 lw_preferred_server ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/nrl.h b/private/utils/ntbackup/inc/nrl.h
new file mode 100644
index 000000000..d3cf4a2fa
--- /dev/null
+++ b/private/utils/ntbackup/inc/nrl.h
@@ -0,0 +1,588 @@
+/**
+ :IH1: Copyright (C) Maynard Electronics, Inc. 1984-89
+
+ :Name: nrl.h
+
+ :Description: Public header file for nrl module
+
+$Header: O:/LOGFILES/NRL.H_V 1.3 24 Feb 1992 09:44:22 DOUG $
+
+$Log: O:/LOGFILES/NRL.H_V $
+ *
+ * Rev 1.3 24 Feb 1992 09:44:22 DOUG
+ * Added standard NRL resource type for RMFS servers NRL_RMFS_SERVER 0x20
+ *
+ *
+ * Rev 1.2 23 Feb 1992 16:57:56 DOUG
+ * The typedefs of functions with no parameters needed an explicit
+ * VOID added to their definitions. IE instead of:
+ * typedef UINT16 ( EXPORT_DLL *PF_function ) ( )
+ * the correct thing was:
+ * typedef UINT16 ( EXPORT_DLL *PF_function ) ( VOID )
+ *
+ *
+ *
+ *
+ * Rev 1.1 21 Feb 1992 16:26:34 DOUG
+ * This version is the initial version which is used for the SPX versions
+ * of the NRL.
+ *
+
+**/
+
+/*****************************************************************************
+** **
+** Note: This module contains the prototypes and macros for applications to **
+** use the NRL entry points through the TSR. For documentation on how to **
+** add NRL entry points to this list, please see the header comments on **
+** module NRLSTUBS.ASM, which handles the actual entry conditions. **
+** **
+*****************************************************************************/
+
+#ifndef NRL
+#define NRL
+
+#if defined( OS_WIN )
+#define EXPORT_DLL FAR PASCAL _loadds
+#elif defined( OS_OS2 )
+#define EXPORT_DLL far _export _loadds
+#else
+#define EXPORT_DLL far
+#endif
+
+#define NRL_MAX_RSRC_INFO 20
+#define NRL_MAX_MACHINE_NAME 21
+#define NRL_MAX_RESOURCE_NAME 21
+#define NRL_MAX_SIGNATURE 10
+#define NRL_ALLOC_DATA_SIZE 512
+#define NRL_SIGNATURE_VALUE "NRL TABLE\0"
+
+typedef VOID *(NRL_PF_ERROR)(VOID) ;
+
+/* A structure of the following type must be completely initialized and */
+/* passed to the NRLInitialize. */
+
+typedef struct NRL_DEFINITION {
+ BOOLEAN tsr; /* 1 if the application will terminate and stay resident */
+ UINT8 dos_vector; /* dos interrupt vector used for function table address */
+ VOID far *network_table; /* defined in nets.h */
+ UINT16 socket; /* dedicated socket number */
+ BOOLEAN check_summing;
+ UINT16 max_local_resources; /* maximum value of resources added minus resources removed */
+ UINT16 max_remote_resources; /* cumulative sum of all remote resource buffers added */
+ UINT8 max_concurrent_sessions; /* maximum value of sessions allocated minus sessions deallocated */
+ UINT16 max_packet_retries; /* Number of times to have the nvl retry sending a packet and wait for an ack */
+ VOID far * error_func; /* function to call when a NRL critical error occurs such as duplicat resource names */
+ BOOLEAN display_msgs ; /* Display incoming text messages? */
+ UINT16 broadcast_interval ; /* How many seconds between beacons */
+} NRL_DEFINITION;
+
+/* Macros to extract the configuration values from the pointer returned by */
+/* M_NRLConfigPointer(). For example, */
+/* cfg = M_NRLConfigPointer() */
+/* local = NRLMaxLocalRsrcs( cfg ) */
+
+#define NRLDosVector(x) ( (x)->dos_vector )
+#define NRLNetworkTable(x) ( (x)->network_table )
+#define NRLSocket(x) ( (x)->socket )
+#define NRLChecksumming(x) ( (x)->check_summing )
+#define NRLMaxLocalRsrcs(x) ( (x)->max_local_resources )
+#define NRLMaxRemoveRsrcs(x) ( (x)->max_remote_resources )
+#define NRLMaxConcurrentSess(x) ( (x)->max_concurrent_sessions )
+#define NRLMaxPacketRetries(x) ( (x)->max_packet_retries )
+
+#ifdef OS_DOS
+typedef struct NRL_RESOURCE far *NRL_RESOURCE_PTR;
+typedef NRL_RESOURCE_PTR far *NRL_RESOURCE_PTR_PTR;
+typedef struct NRL_SESSION far *NRL_SESSION_PTR;
+typedef struct NRL_RESOURCE far *NRL_REMOTE_RESOURCE_ARRAY;
+typedef struct NRL_RESOURCE far *NRL_LOCAL_RESOURCE_PTR;
+#else
+typedef struct RES_Q_ELEM NRL_RESOURCE;
+typedef struct RES_Q_ELEM far * NRL_RESOURCE_PTR;
+typedef struct SES_Q_ELEM far * NRL_SESSION_PTR;
+typedef NRL_RESOURCE NRL_LOCAL_RESOURCE;
+typedef NRL_RESOURCE_PTR NRL_LOCAL_RESOURCE_PTR;
+typedef NRL_RESOURCE far * NRL_REMOTE_RESOURCE_ARRAY;
+#endif
+
+typedef NRL_DEFINITION far *NRL_DEFINITION_PTR ;
+
+
+/***********************************************/
+/* TYPEDEFS OF THE NRL COMPLETION ROUTINES */
+/***********************************************/
+
+typedef VOID (far * NRL_PF_NOTIFY_DEALLOC)(
+ NRL_SESSION_PTR dying_session_ptr,
+ UINT16 reason );
+
+
+typedef UINT16 (far * NRL_PF_NOTIFY_ALLOC)(
+ NRL_RESOURCE_PTR rsrc_ptr,
+ NRL_SESSION_PTR new_session_ptr,
+ UINT8 far * alloc_data_ptr,
+ UINT8 far * far *alloc_complete_data_ptr_ptr,
+ NRL_PF_NOTIFY_DEALLOC far *dealloc_func_ptr_ptr );
+
+typedef VOID (far * NRL_PF_ALLOC_COMPLETE)(
+ NRL_RESOURCE_PTR resource_ptr,
+ UINT8 far * alloc_complete_data_ptr,
+ NRL_SESSION_PTR new_session_ptr,
+ UINT16 reason,
+ NRL_PF_NOTIFY_DEALLOC far *dealloc_func_ptr_ptr );
+
+typedef VOID (far * NRL_PF_DEALLOC_COMPLETE)(
+ NRL_SESSION_PTR dying_session_ptr,
+ UINT16 completion_code );
+
+
+typedef VOID (far *NRL_PF_SND_COMPLETE)( NRL_SESSION_PTR s_ptr, UINT16 reason,
+ UINT8 far *data_ptr, UINT16 bytes_not_sent);
+
+
+typedef VOID (far *NRL_PF_RCV_COMPLETE)( NRL_SESSION_PTR s_ptr, UINT16 reason,
+ UINT8 far *buffer_ptr, UINT16 bytes_rcvd);
+
+typedef VOID (far *NRL_PF_RECEIVE_BROADCAST)( UINT16 message_type,
+ VOID far * data_ptr,
+ UINT16 data_size );
+
+
+/***************************************************/
+/* PROTOTYPES OF THE NRL ENTRY POINT FUNCTIONS */
+/***************************************************/
+
+UINT16 EXPORT_DLL NRLInitialize( NRL_DEFINITION *nrl_def_ptr );
+
+UINT16 EXPORT_DLL NRLResourceSize( VOID );
+
+UINT16 EXPORT_DLL NRLSessionSize( VOID );
+
+UINT16 EXPORT_DLL NRLAddRemoteResourceBuffers( UINT16 numbuffers,
+ NRL_REMOTE_RESOURCE_ARRAY resource_buffers,
+ UINT16 buf_filter );
+
+UINT16 EXPORT_DLL NRLRemoveRemoteResourceBuffers( UINT16 numbuffers,
+ NRL_REMOTE_RESOURCE_ARRAY resource_buffers );
+
+UINT16 EXPORT_DLL NRLUnUsedResourceBuffers( VOID );
+UINT16 EXPORT_DLL NRLAvailResourceBufferSlots( VOID );
+
+UINT16 EXPORT_DLL NRLRemove( VOID );
+
+UINT16 EXPORT_DLL NRLAddResource( NRL_LOCAL_RESOURCE_PTR resource_ptr,
+ CHAR_FAR_PTR machine_name,
+ CHAR_FAR_PTR resource_name,
+ UINT16 resource_type,
+ NRL_PF_NOTIFY_ALLOC RcvdAllocSessionRoutine );
+
+UINT16 EXPORT_DLL NRLRemoveResource( NRL_LOCAL_RESOURCE_PTR resource_ptr );
+
+UINT16 EXPORT_DLL NRLRequestRemoteRsrcNames( VOID );
+
+NRL_RESOURCE_PTR EXPORT_DLL NRLScanResourceList( UINT32 far * sequence_ptr );
+
+BOOLEAN EXPORT_DLL NRLRsrcLocal( NRL_RESOURCE_PTR rsrc_ptr );
+
+CHAR_FAR_PTR EXPORT_DLL NRLRsrcMachineName( NRL_RESOURCE_PTR rsrc_ptr );
+
+CHAR_FAR_PTR EXPORT_DLL NRLRsrcName( NRL_RESOURCE_PTR rsrc_ptr );
+
+UINT16 EXPORT_DLL NRLRsrcType( NRL_RESOURCE_PTR rsrc_ptr );
+
+VOID EXPORT_DLL NRLSetSessionApplicationPtr( NRL_SESSION_PTR session_ptr,
+ VOID far * new_application_ptr );
+
+VOID_FAR_PTR EXPORT_DLL NRLGetSessionApplicationPtr( NRL_SESSION_PTR session_ptr );
+
+VOID EXPORT_DLL NRLSetResourceApplicationPtr( NRL_RESOURCE_PTR resource_ptr,
+ VOID far * new_application_ptr );
+
+VOID_FAR_PTR EXPORT_DLL NRLGetResourceApplicationPtr( NRL_RESOURCE_PTR resource_ptr );
+
+UINT16 EXPORT_DLL NRLAllocSession( NRL_RESOURCE_PTR resource_ptr,
+ UINT8_FAR_PTR alloc_data_ptr,
+ NRL_PF_ALLOC_COMPLETE AllocSessionCompleteRoutine,
+ BOOLEAN sequenced
+ );
+
+UINT16 EXPORT_DLL NRLDeAllocSession( NRL_SESSION_PTR session_ptr,
+ UINT16 reason,
+ NRL_PF_DEALLOC_COMPLETE DeAllocComplete_ptr );
+
+UINT16 EXPORT_DLL NRLSendMessage( NRL_SESSION_PTR session_ptr,
+ BOOLEAN error_falg,
+ UINT8_FAR_PTR data_ptr,
+ UINT16 data_size,
+ NRL_PF_SND_COMPLETE complete_ptr );
+
+UINT16 EXPORT_DLL NRLReceiveMessage( NRL_SESSION_PTR session_ptr,
+ UINT8_FAR_PTR data_buf_ptr,
+ UINT16 buffer_size,
+ UINT32 timeout_length,
+ NRL_PF_RCV_COMPLETE complete_ptr );
+
+INT16 EXPORT_DLL NRLSendBroadcastMessage( UINT16 message_type,
+ VOID_FAR_PTR data_ptr,
+ UINT16 data_size,
+ BOOLEAN_FAR_PTR sending_msg);
+
+VOID EXPORT_DLL NRLReceiveBroadcastMessages( struct Q_ELEM far * control,
+ NRL_PF_RECEIVE_BROADCAST notify_broadcast_rcvd,
+ UINT16 message_types );
+
+VOID EXPORT_DLL NRLCancelReceiveBroadcast( struct Q_ELEM far * control );
+
+INT16 EXPORT_DLL NRLSendTextMessage( CHAR_FAR_PTR msg,
+ NRL_RESOURCE_PTR resource,
+ BOOLEAN_FAR_PTR sending_msg ) ;
+
+INT16 EXPORT_DLL NRLBroadcastTextMessage( CHAR_FAR_PTR msg,
+ UINT16 resource_type,
+ BOOLEAN_FAR_PTR sending_msg ) ;
+
+// VOID EXPORT_DLL NRLSetErrorHandler( NRL_PF_ERROR errfun ) ;
+
+NRL_DEFINITION_PTR EXPORT_DLL NRLConfigPointer( VOID ) ;
+
+VOID EXPORT_DLL NRLSetExternalInfo( VOID_FAR_PTR info ) ;
+
+VOID_FAR_PTR EXPORT_DLL NRLGetExternalInfo( VOID ) ;
+
+UINT16 EXPORT_DLL NRLAddRemoteResource(
+ CHAR_FAR_PTR resource_name,
+ UINT16 resource_type ) ;
+
+VOID EXPORT_DLL NRLSetDisplayMsgFlag( BOOLEAN ) ;
+
+BOOLEAN EXPORT_DLL NRLGetDisplayMsgFlag( VOID ) ;
+
+VOID EXPORT_DLL NRLLockResource( NRL_RESOURCE_PTR rsrc_ptr );
+
+VOID EXPORT_DLL NRLUnlockResource( NRL_RESOURCE_PTR rsrc_ptr );
+
+/**************************************************/
+/* TYPEDEFS FOR EACH NRL ENTRY POINT FUNCTION */
+/**************************************************/
+
+typedef CHAR NRL_SIGNATURE[ NRL_MAX_SIGNATURE ] ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLInitialize )
+( NRL_DEFINITION *nrl_def_ptr ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLAddRemoteResourceBuffers )
+( UINT16 numbuffers,
+ NRL_REMOTE_RESOURCE_ARRAY resource_buffers,
+ UINT16 buf_filter ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLRemoveRemResourceBuffers )
+( UINT16 numbuffers,
+ NRL_REMOTE_RESOURCE_ARRAY resource_buffers ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLUnUsedResourceBuffers )
+( VOID ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLAvailResourceBufferSlots )
+( VOID );
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLRemove )
+( VOID );
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLAddResource )
+( NRL_LOCAL_RESOURCE_PTR resource_ptr,
+ CHAR_FAR_PTR machine_name,
+ CHAR_FAR_PTR resource_name,
+ UINT16 resource_type,
+ NRL_PF_NOTIFY_ALLOC RcvdAllocSessionRoutine ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLRemoveResource )
+( NRL_LOCAL_RESOURCE_PTR resource_ptr ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLRequestRemoteRsrcNames )
+( VOID ) ;
+
+typedef NRL_RESOURCE_PTR ( EXPORT_DLL *PF_NRLScanResourceList )
+( UINT32 far * sequence_ptr ) ;
+
+typedef BOOLEAN ( EXPORT_DLL *PF_NRLRsrcLocal )
+( NRL_RESOURCE_PTR rsrc_ptr ) ;
+
+typedef CHAR far * ( EXPORT_DLL *PF_NRLRsrcMachineName )
+( NRL_RESOURCE_PTR rsrc_ptr ) ;
+
+typedef CHAR far * ( EXPORT_DLL *PF_NRLRsrcName )
+( NRL_RESOURCE_PTR rsrc_ptr ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLRsrcType )
+( NRL_RESOURCE_PTR rsrc_ptr ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLSetSessionApplicationPtr )
+( NRL_SESSION_PTR session_ptr,
+ VOID far * new_application_ptr ) ;
+
+typedef VOID far * ( EXPORT_DLL *PF_NRLGetSessionApplicationPtr )
+( NRL_SESSION_PTR session_ptr ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLSetResourceApplicationPtr )
+( NRL_RESOURCE_PTR resource_ptr,
+ VOID far * new_application_ptr ) ;
+
+typedef VOID far * ( EXPORT_DLL *PF_NRLGetResourceApplicationPtr )
+( NRL_RESOURCE_PTR resource_ptr ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLAllocSession )
+( NRL_RESOURCE_PTR resource_ptr,
+ UINT8_FAR_PTR alloc_data_ptr,
+ NRL_PF_ALLOC_COMPLETE AllocSessionCompleteRoutine,
+ BOOLEAN sequenced ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLDeAllocSession )
+( NRL_SESSION_PTR session_ptr,
+ UINT16 reason,
+ NRL_PF_DEALLOC_COMPLETE DeAllocComplete_ptr ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLSendMessage )
+( NRL_SESSION_PTR session_ptr,
+ BOOLEAN error_flag,
+ UINT8_FAR_PTR data_ptr,
+ UINT16 data_size,
+ NRL_PF_SND_COMPLETE complete_ptr ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLReceiveMessage )
+( NRL_SESSION_PTR session_ptr,
+ UINT8_FAR_PTR data_buf_ptr,
+ UINT16 buffer_size,
+ UINT32 timeout_length,
+ NRL_PF_RCV_COMPLETE complete_ptr ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLResourceSize )
+( VOID ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLSessionSize )
+( VOID ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLSendBroadcastMessage )
+( UINT16 message_type,
+ VOID_FAR_PTR data_ptr,
+ UINT16 data_size,
+ BOOLEAN_FAR_PTR sending_msg ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLReceiveBroadcastMessages )
+( struct Q_ELEM far * control,
+ NRL_PF_RECEIVE_BROADCAST notify_broadcast_rcvd,
+ UINT16 message_types ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLCancelReceiveBroadcast )
+( struct Q_ELEM far * control ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLFreeInvalidResources )
+( VOID ) ;
+
+
+typedef INT16 ( EXPORT_DLL *PF_NRLSendTextMessage )
+( CHAR_FAR_PTR msg,
+ NRL_RESOURCE_PTR resource,
+ BOOLEAN_FAR_PTR sending_msg ) ;
+
+typedef INT16 ( EXPORT_DLL *PF_NRLBroadcastTextMessage )
+( CHAR_FAR_PTR msg,
+ UINT16 resource_type,
+ BOOLEAN_FAR_PTR sending_msg ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLSetErrorHandler )
+( NRL_PF_ERROR errfun ) ;
+
+typedef NRL_DEFINITION_PTR ( EXPORT_DLL *PF_NRLConfigPointer )
+( VOID ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLSetExternalInfo )
+( VOID_FAR_PTR info ) ;
+
+typedef VOID_FAR_PTR ( EXPORT_DLL *PF_NRLGetExternalInfo )
+( VOID ) ;
+
+typedef UINT16 ( EXPORT_DLL *PF_NRLAddRemoteResource )
+ ( CHAR_FAR_PTR resource_name,
+ UINT16 resource_type ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLSetDisplayMsgFlag )
+ ( BOOLEAN flag ) ;
+
+typedef BOOLEAN ( EXPORT_DLL *PF_NRLGetDisplayMsgFlag )
+ ( VOID ) ;
+
+typedef VOID ( EXPORT_DLL *PF_NRLLockResource )
+ ( NRL_RESOURCE_PTR rsrc_ptr );
+
+typedef VOID ( EXPORT_DLL *PF_NRLUnlockResource )
+ ( NRL_RESOURCE_PTR rsrc_ptr );
+
+
+/*************************************************/
+/* FUNCTION TABLE OF ENTRY POINTS TO THE NRL */
+/*************************************************/
+
+typedef struct NRL_FUNCTION_TABLE_STRUCT {
+
+ NRL_SIGNATURE signature ;
+
+ PF_NRLInitialize T_NRLInitialize ;
+ PF_NRLAddRemoteResourceBuffers T_NRLAddRemoteResourceBuffers ;
+ PF_NRLRemoveRemResourceBuffers T_NRLRemoveRemResourceBuffers ;
+ PF_NRLUnUsedResourceBuffers T_NRLUnUsedResourceBuffers ;
+ PF_NRLRemove T_NRLRemove ;
+ PF_NRLAddResource T_NRLAddResource ;
+ PF_NRLRemoveResource T_NRLRemoveResource ;
+ PF_NRLRequestRemoteRsrcNames T_NRLRequestRemoteRsrcNames;
+ PF_NRLScanResourceList T_NRLScanResourceList ;
+ PF_NRLRsrcLocal T_NRLRsrcLocal ;
+ PF_NRLRsrcMachineName T_NRLRsrcMachineName ;
+ PF_NRLRsrcName T_NRLRsrcName ;
+ PF_NRLRsrcType T_NRLRsrcType ;
+ PF_NRLSetSessionApplicationPtr T_NRLSetSessionApplicationPtr ;
+ PF_NRLGetSessionApplicationPtr T_NRLGetSessionApplicationPtr ;
+ PF_NRLSetResourceApplicationPtr T_NRLSetResourceApplicationPtr ;
+ PF_NRLGetResourceApplicationPtr T_NRLGetResourceApplicationPtr ;
+ PF_NRLAllocSession T_NRLAllocSession ;
+ PF_NRLDeAllocSession T_NRLDeAllocSession ;
+ PF_NRLSendMessage T_NRLSendMessage ;
+ PF_NRLReceiveMessage T_NRLReceiveMessage ;
+ PF_NRLResourceSize T_NRLResourceSize ;
+ PF_NRLSessionSize T_NRLSessionSize ;
+ PF_NRLAvailResourceBufferSlots T_NRLAvailResourceBufferSlots;
+ PF_NRLSendBroadcastMessage T_NRLSendBroadcastMessage ;
+ PF_NRLReceiveBroadcastMessages T_NRLReceiveBroadcastMessages ;
+ PF_NRLCancelReceiveBroadcast T_NRLCancelReceiveBroadcast ;
+ PF_NRLFreeInvalidResources T_NRLFreeInvalidResources ;
+ PF_NRLSendTextMessage T_NRLSendTextMessage ;
+ PF_NRLBroadcastTextMessage T_NRLBroadcastTextMessage ;
+ PF_NRLSetErrorHandler T_NRLSetErrorHandler ;
+ PF_NRLConfigPointer T_NRLConfigPointer ;
+ PF_NRLSetExternalInfo T_NRLSetExternalInfo ;
+ PF_NRLGetExternalInfo T_NRLGetExternalInfo ;
+ PF_NRLAddRemoteResource T_NRLAddRemoteResource ;
+ PF_NRLSetDisplayMsgFlag T_NRLSetDisplayMsgFlag ;
+ PF_NRLGetDisplayMsgFlag T_NRLGetDisplayMsgFlag ;
+ PF_NRLLockResource T_NRLLockResource ;
+ PF_NRLUnlockResource T_NRLUnlockResource ;
+} NRL_FUNCTION_TABLE,
+far *NRL_FUNCTION_TABLE_PTR ;
+
+NRL_FUNCTION_TABLE_PTR NRLGetFunctionTablePtr( UINT8 dos_vector ) ;
+
+/**********************************************/
+/* The global NRL function table */
+/**********************************************/
+
+extern NRL_FUNCTION_TABLE_PTR gb_NRL_function_table_ptr ; /* set by NRLInitialize. reset by NRLRemove */
+
+
+/**********************************************/
+/* MACRO REFERENCES TO NRL FUNCTION TABLE */
+/**********************************************/
+
+#define M_NRLAddRemoteResourceBuffers ( gb_NRL_function_table_ptr -> T_NRLAddRemoteResourceBuffers )
+#define M_NRLRemoveRemResourceBuffers ( gb_NRL_function_table_ptr -> T_NRLRemoveRemResourceBuffers )
+#define M_NRLUnUsedResourceBuffers ( gb_NRL_function_table_ptr -> T_NRLUnUsedResourceBuffers )
+#ifdef OS_OS2
+#define M_NRLRemove NRLRemove
+#else
+#define M_NRLRemove ( gb_NRL_function_table_ptr -> T_NRLRemove )
+#endif
+#define M_NRLAddResource ( gb_NRL_function_table_ptr -> T_NRLAddResource )
+#define M_NRLRemoveResource ( gb_NRL_function_table_ptr -> T_NRLRemoveResource )
+#define M_NRLRequestRemoteRsrcNames ( gb_NRL_function_table_ptr -> T_NRLRequestRemoteRsrcNames )
+#define M_NRLScanResourceList ( gb_NRL_function_table_ptr -> T_NRLScanResourceList )
+#define M_NRLRsrcLocal ( gb_NRL_function_table_ptr -> T_NRLRsrcLocal )
+#define M_NRLRsrcMachineName ( gb_NRL_function_table_ptr -> T_NRLRsrcMachineName )
+#define M_NRLRsrcName ( gb_NRL_function_table_ptr -> T_NRLRsrcName )
+#define M_NRLRsrcType ( gb_NRL_function_table_ptr -> T_NRLRsrcType )
+#define M_NRLSetSessionApplicationPtr ( gb_NRL_function_table_ptr -> T_NRLSetSessionApplicationPtr )
+#define M_NRLGetSessionApplicationPtr ( gb_NRL_function_table_ptr -> T_NRLGetSessionApplicationPtr )
+#define M_NRLSetResourceApplicationPtr ( gb_NRL_function_table_ptr -> T_NRLSetResourceApplicationPtr )
+#define M_NRLGetResourceApplicationPtr ( gb_NRL_function_table_ptr -> T_NRLGetResourceApplicationPtr )
+#define M_NRLAllocSession ( gb_NRL_function_table_ptr -> T_NRLAllocSession )
+#define M_NRLDeAllocSession ( gb_NRL_function_table_ptr -> T_NRLDeAllocSession )
+#define M_NRLSendMessage ( gb_NRL_function_table_ptr -> T_NRLSendMessage )
+#define M_NRLReceiveMessage ( gb_NRL_function_table_ptr -> T_NRLReceiveMessage )
+#define M_NRLResourceSize ( gb_NRL_function_table_ptr -> T_NRLResourceSize )
+#define M_NRLSessionSize ( gb_NRL_function_table_ptr -> T_NRLSessionSize )
+#define M_NRLAvailResourceBufferSlots ( gb_NRL_function_table_ptr -> T_NRLAvailResourceBufferSlots )
+#define M_NRLSendBroadcastMessage ( gb_NRL_function_table_ptr -> T_NRLSendBroadcastMessage )
+#define M_NRLReceiveBroadcastMessages ( gb_NRL_function_table_ptr -> T_NRLReceiveBroadcastMessages )
+#define M_NRLCancelReceiveBroadcast ( gb_NRL_function_table_ptr -> T_NRLCancelReceiveBroadcast )
+#define M_NRLFreeInvalidResources ( gb_NRL_function_table_ptr -> T_NRLFreeInvalidResources )
+#define M_NRLSendTextMessage ( gb_NRL_function_table_ptr -> T_NRLSendTextMessage )
+#define M_NRLBroadcastTextMessage ( gb_NRL_function_table_ptr -> T_NRLBroadcastTextMessage )
+#define M_NRLSetErrorHandler ( gb_NRL_function_table_ptr -> T_NRLSetErrorHandler )
+#define M_NRLConfigPointer ( gb_NRL_function_table_ptr -> T_NRLConfigPointer )
+#define M_NRLSetExternalInfo ( gb_NRL_function_table_ptr -> T_NRLSetExternalInfo )
+#define M_NRLGetExternalInfo ( gb_NRL_function_table_ptr -> T_NRLGetExternalInfo )
+#define M_NRLAddRemoteResource ( gb_NRL_function_table_ptr -> T_NRLAddRemoteResource )
+#define M_NRLSetDisplayMsgFlag ( gb_NRL_function_table_ptr -> T_NRLSetDisplayMsgFlag )
+#define M_NRLGetDisplayMsgFlag ( gb_NRL_function_table_ptr -> T_NRLGetDisplayMsgFlag )
+#define M_NRLLockResource ( gb_NRL_function_table_ptr -> T_NRLLockResource )
+#define M_NRLUnlockResource ( gb_NRL_function_table_ptr -> T_NRLUnlockResource )
+
+#define NRL_BASE_ERROR (-1024)
+#define NRL_ALREADY_INSTALLED (NRL_BASE_ERROR - 0)
+#define NRL_NOT_INSTALLED (NRL_BASE_ERROR - 1)
+#define NRL_NO_MORE_SESSIONS (NRL_BASE_ERROR - 2)
+#define NRL_COMMUNICATION_FAILURE (NRL_BASE_ERROR - 3)
+#define NRL_RESOURCE_REMOVED (NRL_BASE_ERROR - 4)
+#define NRL_PEER_RESOURCE_REMOVED (NRL_BASE_ERROR - 5)
+#define NRL_LAYER_REMOVED (NRL_BASE_ERROR - 6)
+#define NRL_PEER_LAYER_REMOVED (NRL_BASE_ERROR - 7)
+#define NRL_SESSION_DEALLOCATED (NRL_BASE_ERROR - 8)
+#define NRL_DUPLICATE_RSRC_ID (NRL_BASE_ERROR - 9)
+#define NRL_RESOURCE_FILTERED (NRL_BASE_ERROR - 10)
+#define NRL_VECTOR_IN_USE (NRL_BASE_ERROR - 11)
+#define NRL_NO_IPX (NRL_BASE_ERROR - 12)
+#define NRL_OUT_OF_MEMORY (NRL_BASE_ERROR - 13)
+#define NRL_NO_FREE_RECEIVE_BUFFS (NRL_BASE_ERROR - 14)
+#define NRL_RESOURCE_LOCKED (NRL_BASE_ERROR - 15)
+
+/*** These return codes are supported by the OS2 NRL ***/
+#define NRL_INVALID_NAME (NRL_BASE_ERROR - 16)
+#define NRL_NO_SPX (NRL_BASE_ERROR - 17)
+#define NRL_NOMORE_THREADS (NRL_BASE_ERROR - 18)
+#define NRL_INVALID_PARAM (NRL_BASE_ERROR - 19)
+
+
+/**
+ completion routine reasons
+**/
+#define NRL_TRANSMIT_ERROR 1
+#define NRL_TIME_OUT_ERROR 2
+#define NRL_DATA_OVERFLOW 3
+#define NRL_IMPOSSIBLE 4
+#define NRL_ERROR_MESSAGE 5
+#define NRL_DEAD_SESSION 6
+
+
+/**
+ registered resource types
+**/
+#define NRL_ALL_RESOURCES 0xFFFF
+#define NRL_LANBACK_DRIVE 0x01
+#define NRL_MBS_DRIVE 0x02
+#define NRL_MBS_SERVER 0x04
+#define NRL_MBS_ADMINISTRATOR 0x08
+#define NRL_TMENU 0x10
+#define NRL_RMFS_SERVER 0x20
+
+
+/**
+ registered broadcast message types
+**/
+#define NRL_ALL_MESSAGES 0xFFFF
+#define NRL_MBS_WS_BC 1
+#define NRL_MBS_BS_BC 2
+#define NRL_MBS_ADMIN_BC 4
+
+
+#endif
+
+
+
diff --git a/private/utils/ntbackup/inc/ntfs_fs.h b/private/utils/ntbackup/inc/ntfs_fs.h
new file mode 100644
index 000000000..b90c969e9
--- /dev/null
+++ b/private/utils/ntbackup/inc/ntfs_fs.h
@@ -0,0 +1,495 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ntfs_fs.h
+
+ Description: This file contains the prototypes for the NTFS
+ file system functions.
+
+ $Log: M:/LOGFILES/NTFS_FS.H_V $
+
+ Rev 1.30.1.2 23 Jan 1994 14:26:02 BARRY
+Added debug and utility functions
+
+ Rev 1.30.1.1 19 Jan 1994 12:51:40 BARRY
+Supress warnings
+
+ Rev 1.30.1.0 04 Jan 1994 10:59:24 BARRY
+Added init entry points and temp-name function prototypes
+
+ Rev 1.30 30 Jul 1993 13:20:38 STEVEN
+if dir too deep make new one
+
+ Rev 1.29 26 Jul 1993 17:05:26 STEVEN
+fixe restore active file with registry
+
+ Rev 1.28 15 Jun 1993 09:18:32 MIKEP
+warning fixes
+
+ Rev 1.27 11 Mar 1993 12:10:42 BARRY
+Changes to stream structures for alternate data streams.
+
+ Rev 1.26 18 Jan 1993 13:17:18 BARRY
+Added proto for error translation function.
+
+ Rev 1.25 07 Dec 1992 16:30:42 STEVEN
+fixes from microsoft
+
+ Rev 1.24 23 Nov 1992 09:33:20 STEVEN
+fix support for event log
+
+ Rev 1.23 09 Nov 1992 17:41:22 BARRY
+Add stream ID vector to reserved info (for use in Verify).
+
+ Rev 1.22 22 Oct 1992 13:35:52 STEVEN
+added excludeSpecial
+
+ Rev 1.21 21 Oct 1992 19:38:52 BARRY
+Added queue of linked files to NTFS reserved area.
+Added protos for NTFS linked file queue functions.
+
+ Rev 1.20 19 Oct 1992 15:10:50 MIKEP
+fix REG_Restore
+
+ Rev 1.19 16 Oct 1992 14:59:06 STEVEN
+added support for backing up registry
+
+ Rev 1.18 15 Oct 1992 10:38:46 BARRY
+Got rid of my stupid struct on a windows pointer.
+
+ Rev 1.17 07 Oct 1992 14:47:46 STEVEN
+fix typo in macro
+
+ Rev 1.16 07 Oct 1992 14:39:42 BARRY
+Added NTFS_FillOutDBLK proto; got rid of IN specifiers.
+
+ Rev 1.15 06 Oct 1992 10:53:00 BARRY
+Added stream header ID translation functions.
+
+ Rev 1.14 05 Oct 1992 13:36:10 STEVEN
+added registry stuff
+
+ Rev 1.13 23 Sep 1992 10:35:54 BARRY
+Added NTFS_SetupFileNameInFDB.
+
+ Rev 1.12 22 Sep 1992 15:35:50 BARRY
+Got rid of GetTotalSizeDBLK.
+
+ Rev 1.11 21 Sep 1992 16:49:14 BARRY
+Updated NTFS_CompleteBlk prototype.
+
+ Rev 1.10 04 Sep 1992 17:15:56 STEVEN
+fix warnings
+
+ Rev 1.9 03 Sep 1992 17:07:28 STEVEN
+add support for volume name
+
+ Rev 1.7 29 Jul 1992 15:34:52 STEVEN
+fix warnings
+
+ Rev 1.6 22 May 1992 16:28:58 STEVEN
+
+
+ Rev 1.5 21 May 1992 13:38:46 STEVEN
+added more long path support
+
+ Rev 1.4 04 May 1992 09:39:22 LORIB
+Changes for variable length paths and fixes for prototype definitions.
+
+ Rev 1.3 03 Mar 1992 16:17:56 STEVEN
+added functions for long paths
+
+ Rev 1.2 28 Feb 1992 13:04:38 STEVEN
+step one for varible length paths
+
+ Rev 1.1 23 Jan 1992 13:18:14 STEVEN
+
+ Rev 1.0 17 Jan 1992 17:51:06 STEVEN
+Initial revision.
+
+**/
+
+#include "fsys.h"
+#include "queues.h"
+#include "ntfsdblk.h"
+
+#define REG_FNAME "<REGISTRY>"
+
+typedef struct _NTFS_STREAM_ID {
+ UINT32 streamID;
+ UINT32 nameLength;
+ UINT8 name[ NT_MAX_STREAM_NAME_LENG ];
+} NTFS_STREAM_ID;
+
+typedef struct _NTFS_FSYS_RESERVED {
+ UINT16 file_scan_mode ;
+ Q_HEADER scan_q;
+ Q_HEADER linkq; /* q of linked files */
+ CHAR_PTR work_buf ;
+ UINT16 work_buf_size ;
+ BOOLEAN work_buf_in_use ;
+ NTFS_STREAM_ID *streamIDs; /* Vector of visited stream IDs */
+ UINT16 streamIDBufferSize;
+ INT16 streamIDCount;
+} NTFS_FSYS_RESERVED, *NTFS_FSYS_RESERVED_PTR ;
+
+
+INT16 NTFS_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd); /* I - passowrd NOT USED */
+
+INT16 NTFS_DetachDLE( FSYS_HAND fsh ); /* I - */
+
+INT32 NTFS_EndOperationOnDLE( FSYS_HAND fsh ); /* I - */
+
+INT16 NTFS_CreateObj( FSYS_HAND fsh, /* I - File system to create object one */
+ DBLK_PTR dblk); /* I - Describes object to create */
+
+INT16 NTFS_OpenObj( FSYS_HAND fsh, /* I - file system that the file is opened on */
+ FILE_HAND *hand, /* O - allocated handle */
+ DBLK_PTR dblk, /*I/O- describes the file to be opened */
+ OPEN_MODE mode); /* I - open mode */
+
+INT16 NTFS_ReadObj( FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info); /* O - Stream information for the data returned */
+
+
+INT16 NTFS_WriteObj( FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size need for next read */
+ STREAM_INFO_PTR s_info); /* I - Stream information for the data passed in */
+
+INT16 NTFS_VerObj( FILE_HAND hand, /* I - file handle to verify data with */
+ BYTE_PTR buf, /* I - buffer needed to perform verify */
+ BYTE_PTR data, /* I - data to verify against */
+ UINT16 *size, /*I/O- size of buffers / amount verified */
+ UINT16 *blk_size, /* O - minum size of block for next call */
+ STREAM_INFO_PTR s_info); /* I - Stream information for the data passed in */
+
+
+INT16 NTFS_CloseObj( FILE_HAND hand ); /* I - handle of object to close */
+
+INT16 NTFS_DeleteObj( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 NTFS_FindFirst( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+ CHAR_PTR sname, /* I - search name */
+ UINT16 obj_type); /* I - object type (all objs, dirs, etc.) */
+
+INT16 NTFS_FindNext( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* O - Discriptor block */
+
+INT16 NTFS_GetObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /*I/O- On entry it is minimal on exit Complete */
+
+INT16 NTFS_VerObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to compare OS against */
+
+INT16 NTFS_ChangeDir( FSYS_HAND fsh, /* I - file system to changing directories on */
+ CHAR_PTR path, /* I - describes the path of the new directory */
+ INT16 psize); /* I - specifies the length of the path */
+
+INT16 NTFS_UpDir( FSYS_HAND fsh ); /* I - file system to change directories in */
+
+INT16 NTFS_GetCurrentPath( FSYS_HAND fsh, /* I - file system to get current path from */
+ CHAR_PTR path, /* O - buffer to place this path */
+ INT16 *size); /*I/O- size of buffer on entry & on exit */
+
+INT16 NTFS_SeekObj( FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ); /*I/O- Offset to seek; Number of bytes actualy seeked */
+
+INT16 NTFS_GetMaxSizeDBLK( FSYS_HAND fsh /* not used */ );
+
+INT16 NTFS_GetBasePath( FSYS_HAND fsh, /* I - file system to get base path from */
+ CHAR_PTR full_path, /* O - buffer to place this path */
+ INT16 *size ); /*I/O- size of buffer on entry & on exit */
+
+INT16 NTFS_GetCurrentDDB( FSYS_HAND fsh, /* I - file system to get DDB from */
+ DBLK_PTR dblk ); /* O - place to put the DDB data */
+
+INT16 NTFS_SetObjInfo( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk); /* I - data to write to disk */
+
+INT16 NTFS_ModFnameFDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it, /* I - TRUE if setting file name, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get file name from */
+ CHAR_PTR buf, /*I/O- file name to read (or to write) */
+ INT16 *size ) ; /*I/O- size buffer on entry and exit */
+
+INT16 NTFS_ModPathDDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it , /* I - TRUE if setting path, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get path from */
+ CHAR_PTR buf, /*I/O- path to read (or to write) */
+ INT16 *size ); /*I/O- size of buffer on entry and exit */
+
+INT16 NTFS_GetOSFnameFDB( DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 NTFS_GetOSPathDDB(
+ FSYS_HAND fsh, /* I - File System handle */
+ DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 NTFS_GetFileVerFDB( DBLK_PTR dblk ,
+ UINT32 *version ) ;
+
+INT16 NTFS_GetCdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ); /*I/O- createion date to read (or to write) */
+
+INT16 NTFS_GetMdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /* O - modify date to write */
+
+INT16 NTFS_ModBdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 NTFS_ModAdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+UINT64 NTFS_GetDisplaySizeDBLK( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+INT16 NTFS_GetOS_InfoDBLK( DBLK_PTR dblk, /* I - DBLK to get the info from */
+ BYTE_PTR os_info, /* O - Buffer to place data */
+ INT16 *size ); /*I/O- Buffer size / data length */
+
+
+INT16 NTFS_ModAttribDBLK( BOOLEAN set_it ,
+ DBLK_PTR dblk ,
+ UINT32_PTR attr );
+
+
+INT16 NTFS_GetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE *type );
+
+
+INT16 NTFS_GetActualSizeDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 NTFS_SizeofFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ); /* I - dblk to get fname from */
+
+INT16 NTFS_SizeofOSFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ) ; /* I - dblk to get fname from */
+
+INT16 NTFS_SizeofPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 NTFS_SizeofOSPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 NTFS_SizeofOSInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to get size of OS info for */
+
+
+INT16 NTFS_PushMinDDB( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 NTFS_PopMinDDB( FSYS_HAND fsh ,
+ DBLK_PTR dblk );
+
+INT16 NTFS_CreateFDB( FSYS_HAND fsh,
+ GEN_FDB_DATA_PTR dat ) ;
+
+INT16 NTFS_CreateDDB( FSYS_HAND fsh,
+ GEN_DDB_DATA_PTR dat ) ;
+
+INT16 NTFS_CreateIDB( FSYS_HAND fsh,
+ GEN_IDB_DATA_PTR dat ) ;
+
+VOID NTFS_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+BOOLEAN NTFS_ProcessDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 NTFS_ChangeIntoDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+VOID NTFS_GetRealBasePath( FSYS_HAND fsh, CHAR_PTR path ) ;
+
+INT16 NTFS_FindClose( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 NTFS_GetSpecDBLKS(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ INT32 *index );
+
+INT16 NTFS_DeviceDispName(
+GENERIC_DLE_PTR dle,
+CHAR_PTR dev_name,
+INT16 size,
+INT16 type ) ;
+
+INT16 NTFS_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask );
+
+VOID NTFS_RemoveDLE( GENERIC_DLE_PTR dle ) ;
+
+VOID NTFS_GetVolName( GENERIC_DLE_PTR dle, CHAR_PTR buffer ) ;
+
+INT16 NTFS_SizeofVolName( GENERIC_DLE_PTR dle ) ;
+
+VOID NTFS_EmptyFindHandQ( FSYS_HAND fsh ) ;
+
+INT16 NTFS_EnumSpecFiles(
+ GENERIC_DLE_PTR dle,
+ UINT16 *index,
+ CHAR_PTR *path,
+ INT16 *psize,
+ CHAR_PTR *fname ) ;
+
+INT16 NTFS_GetSpecDBLKS(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ INT32 *index );
+
+VOID NTFS_InitMakeData( FSYS_HAND fsh, INT16 blk_type, CREATE_DBLK_PTR data ) ;
+BOOLEAN NTFS_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+INT16 NTFS_CompleteBlk( FSYS_HAND fsh, DBLK_PTR dblk, BYTE_PTR buffer, UINT16 *size, STREAM_INFO *sinfo ) ;
+VOID NTFS_ReleaseBlk( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+INT16 NTFS_DupBlk( FSYS_HAND fsh, DBLK_PTR db_org, DBLK_PTR db_dup );
+
+INT16 NTFS_SpecExcludeObj( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb, /* I - Descriptor block of ddb */
+ DBLK_PTR fdb ) ; /* I - Descriptor block of fdb */
+
+
+INT16 NTFS_SetupPathInDDB(
+ FSYS_HAND fsh,
+ DBLK_PTR ddblk,
+ CHAR_PTR cur_dir,
+ CHAR_PTR sub_dir_name,
+ UINT16 buf_req_size ) ;
+
+INT16 NTFS_SetupFileNameInFDB( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ CHAR_PTR fname,
+ UINT16 bufMinSize );
+
+INT16 NTFS_SetupWorkPath(
+ FSYS_HAND fsh,
+ CHAR_PTR cur_dir,
+ CHAR_PTR sname,
+ CHAR_PTR *path_string ) ;
+
+VOID NTFS_ReleaseWorkPath( FSYS_HAND fsh ) ;
+
+VOID NTFS_FixPath( CHAR_PTR path, INT16_PTR size, INT16 fname_size ) ;
+
+//
+// Private Registry API functions
+//
+
+// Call backup for backup operations and both for restore operations.
+
+INT REG_AssertBackupPrivilege( VOID );
+INT REG_AssertRestorePrivilege( VOID );
+
+// Given a drive, path, and file name I'll tell you if it
+// is an active registry file.
+
+INT REG_IsRegistryFile(
+ GENERIC_DLE_PTR dle,
+ CHAR_PTR FileSpec );
+
+INT REG_IsEventFile(
+ GENERIC_DLE_PTR dle,
+ CHAR_PTR FileSpec,
+ CHAR_PTR buffer );
+
+// Called by the file system to determine if/where the
+// registry is for each drive.
+// Everyone else can get the info from the DLE's.
+
+INT REG_GetRegistryPath(
+CHAR *Machine,
+CHAR Drive,
+CHAR_PTR Path,
+INT *PathSize );
+
+// Try to backup up an active registry file.
+
+INT REG_BackupRegistryFile(
+GENERIC_DLE_PTR dle,
+CHAR_PTR RegFileSpec,
+CHAR_PTR TempFileSpec );
+
+// Most dangerous of all. Try to restore an active registry file.
+
+INT REG_RestoreRegistryFile(
+GENERIC_DLE_PTR dle,
+CHAR_PTR RegFileSpec,
+CHAR_PTR NewFileSpec,
+CHAR_PTR OldFileSpec );
+
+INT REG_IsCurDirRegistryPath(
+IN FSYS_HAND fsh ) ;
+
+VOID REG_MoveActiveRenameKey(
+GENERIC_DLE_PTR dle,
+CHAR_PTR RegFileSpec ) ;
+
+
+#define NTFS_GetRegistryPath( dle ) ((dle)->info.ntfs->registry_path )
+#define NTFS_GetRegistryPathSize( dle ) ((dle)->info.ntfs->registry_path_size )
+
+
+UINT32 NTFS_MSoftToMayn( UINT32 msoftID );
+UINT32 NTFS_MaynToMSoft( UINT32 maynID );
+
+INT16 NTFS_FillOutDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ WIN32_FIND_DATA *find_data );
+
+CHAR_PTR NTFS_MakeTempName( CHAR_PTR path,
+ CHAR_PTR prefix) ;
+
+NTFS_LINK_Q_ELEM_PTR NTFS_SearchLinkQueue( FSYS_HAND fsh,
+ DWORD idHi,
+ DWORD idLo );
+
+INT16 NTFS_EnqueueLinkInfo( FSYS_HAND fsh,
+ DWORD idHi,
+ DWORD idLo,
+ CHAR_PTR path,
+ CHAR_PTR name );
+
+INT16 NTFS_LinkFileToFDB( FILE_HAND hand ) ;
+
+INT16 NTFS_TranslateBackupError( DWORD backupError );
+
+/*
+ * Init/Deinit for one-time work in TINITFS.C
+ */
+INT16 NTFS_InitFileSys( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask );
+VOID NTFS_DeInitFileSys( DLE_HAND hand );
+
+/*
+ * Operations on temporary file names (for active restores)
+ */
+VOID NTFS_InitTemp( VOID );
+VOID NTFS_DeinitTemp( VOID );
+BOOLEAN NTFS_SaveTempName( CHAR_PTR tapeName, CHAR_PTR diskName );
+CHAR_PTR NTFS_GetTempName( CHAR_PTR tapeName );
+
+
+/*
+ * Utility and debug functions
+ */
+
+#if defined( FS_DEBUG )
+#define NTFS_DebugPrint NTFS_DebugPrintFunction
+#else
+#define NTFS_DebugPrint
+#endif
+
+VOID NTFS_DebugPrintFunction( CHAR *fmt, ... );
+CHAR_PTR NTFS_DuplicateString( CHAR_PTR src );
+
diff --git a/private/utils/ntbackup/inc/ntfsdblk.h b/private/utils/ntbackup/inc/ntfsdblk.h
new file mode 100644
index 000000000..f9f5096a1
--- /dev/null
+++ b/private/utils/ntbackup/inc/ntfsdblk.h
@@ -0,0 +1,235 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ntfsdblk.h
+
+ Description: This file contains the definition of the DOS
+ file and directory control blocks.
+
+
+ $Log: M:/LOGFILES/NTFSDBLK.H_V $
+
+ Rev 1.26.1.0 24 Mar 1994 20:20:56 BARRY
+Added a flag for alt streams names being complete
+
+ Rev 1.26 01 Dec 1993 13:05:00 STEVEN
+Path in strem should start at 600
+
+ Rev 1.25 15 Jun 1993 09:17:28 MIKEP
+warning fixes
+
+ Rev 1.24 19 May 1993 13:58:18 BARRY
+Added Steve's changes for OS/2 EA support.
+
+ Rev 1.23 11 Mar 1993 12:10:44 BARRY
+Changes to stream structures for alternate data streams.
+
+ Rev 1.22 24 Feb 1993 15:38:08 BARRY
+Fixed restore of active files when write errors occur.
+
+ Rev 1.21 15 Jan 1993 13:18:30 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.20 07 Dec 1992 16:31:56 STEVEN
+added support for posix
+
+ Rev 1.19 24 Nov 1992 11:02:34 BARRY
+Changes to make LINK streams null-impregnated.
+
+ Rev 1.18 10 Nov 1992 08:12:38 STEVEN
+move os path to common part of dblk
+
+ Rev 1.17 09 Nov 1992 09:55:04 BARRY
+Added stuff for verify.
+
+ Rev 1.16 29 Oct 1992 16:55:04 BARRY
+Added a buffer for link data to obj_hand.
+
+ Rev 1.15 22 Oct 1992 13:40:48 BARRY
+Added link q goodies.
+
+ Rev 1.14 19 Oct 1992 17:57:12 BARRY
+Added the needStreamHeader flag for backup.
+
+ Rev 1.13 16 Oct 1992 14:59:10 STEVEN
+added support for backing up registry
+
+ Rev 1.12 09 Oct 1992 16:10:42 BARRY
+Corrected name of structure member.
+
+ Rev 1.11 24 Sep 1992 13:45:40 BARRY
+Changes for huge file name support.
+
+ Rev 1.10 23 Sep 1992 10:37:06 BARRY
+Changed name of PATH_Q_ELEM structure to NAME_Q_ELEM, added this structure to FDBs.
+
+ Rev 1.9 21 Sep 1992 16:50:16 BARRY
+Removed path_complete from DDB_INFO and added common name_complete field.
+
+ Rev 1.8 18 Sep 1992 15:52:02 BARRY
+Added NT_STREAM_HEADER structure; updated NTFS_OBJ_HAND for
+Stream Header redesign.
+
+ Rev 1.7 20 Aug 1992 14:07:16 BURT
+fix warnings
+
+ Rev 1.6 23 Jul 1992 10:08:28 STEVEN
+added short filename to osinfo
+
+ Rev 1.5 21 May 1992 13:38:44 STEVEN
+added more long path support
+
+ Rev 1.4 04 May 1992 09:35:18 LORIB
+Changes for variable length paths.
+
+ Rev 1.3 28 Feb 1992 13:04:40 STEVEN
+step one for varible length paths
+
+ Rev 1.2 07 Feb 1992 16:42:06 STEVEN
+changed dta structure for attribute
+
+ Rev 1.1 28 Jan 1992 14:46:50 STEVEN
+fix min ddb for NTFS
+
+ Rev 1.0 17 Jan 1992 17:51:04 STEVEN
+Initial revision.
+
+**/
+/* $end$ include list */
+
+#ifndef ntfsdblk_h
+#define ntfsdblk_h
+
+#include "queues.h"
+
+#define NTFS_MAX_DSIZE ( 600 )
+#define NTFS_MAX_FSIZE ( 600 )
+#define DA_DIRECTORY 0x10
+
+/* CBN -- These are temporary until the definitions are in MSoft headers */
+#if !defined( BACKUP_DATA )
+#define BACKUP_DATA 0x00000001
+#define BACKUP_EA_DATA 0x00000002
+#define BACKUP_SECURITY_DATA 0x00000003
+#define BACKUP_ALTERNATE_DATA 0x00000004
+#define BACKUP_LINK 0x00000005
+#endif
+
+/* Backup API stream headers */
+#define NT_MAX_STREAM_NAME_LENG 524
+
+typedef struct _NT_STREAM_HEADER {
+ UINT32 id ;
+ UINT32 attrib ;
+ UINT32 size_lo ;
+ UINT32 size_hi ;
+ UINT32 name_leng ;
+ UINT8 name[ NT_MAX_STREAM_NAME_LENG ] ;
+} NT_STREAM_HEADER, *NT_STREAM_HEADER_PTR ;
+
+/* Matches bottom portion of NT stream headers */
+typedef struct _NT_STREAM_NAME {
+ UINT32 name_leng ;
+ UINT8 name[ NT_MAX_STREAM_NAME_LENG ] ;
+} NT_STREAM_NAME, *NT_STREAM_NAME_PTR;
+
+#define NT_SIZEOF_NAMELESS_STREAM_HEAD \
+ (sizeof(NT_STREAM_HEADER) - NT_MAX_STREAM_NAME_LENG)
+
+typedef struct _NTFS_LINK_Q_ELEM {
+ Q_ELEM q; /* queue element structure for Q calls */
+ DWORD idHi; /* file's unique ID -- hi 32 bits */
+ DWORD idLo; /* file's unique ID -- low 32 bits */
+ UINT16 linkNameLen; /* length of string below */
+ CHAR_PTR linkName; /* path and name of "original" file */
+} NTFS_LINK_Q_ELEM, *NTFS_LINK_Q_ELEM_PTR ;
+
+
+typedef struct _NTFS_OBJ_HAND {
+ HANDLE fhand;
+ VOID_PTR context;
+ NT_STREAM_HEADER streamHeader;
+ UINT64 nextStreamHeaderPos;
+ UINT64 curPos;
+ BOOLEAN needStreamHeader; /* Ready for SH on backup */
+ NTFS_LINK_Q_ELEM_PTR linkPtr;
+ BOOLEAN nameComplete;
+ BOOLEAN registry_file ;
+ CHAR_PTR temp_file;
+ UINT16 linkBufferSize;
+ CHAR_PTR linkBuffer;
+ UINT16 linkNameLen;
+ BOOLEAN streamsAllVisited;
+ BOOLEAN altNameComplete; /* TRUE if on verify alt name complete */
+ INT16 verifyStreamPos;
+ BYTE_PTR os2_ea_buffer ;
+ BOOLEAN processing_os2_ea ;
+ BOOLEAN sawSecurity; /* NACL stream seen on backup */
+ BOOLEAN writeError; /* True if we had write error */
+} NTFS_OBJ_HAND, *NTFS_OBJ_HAND_PTR;
+
+
+typedef struct _NTFS_FDB_INFO *NTFS_FDB_INFO_PTR;
+
+typedef struct _NTFS_DTA {
+ HANDLE scan_hand ;
+ UINT64 size ;
+ UINT32 os_attr ;
+ FILETIME create_time ;
+ FILETIME access_time ;
+ FILETIME modify_time ;
+} NTFS_DTA, *NTFS_DTA_PTR ;
+
+
+typedef struct _NTFS_FDB_INFO {
+ HANDLE handle ; /* set: NTFS_CreateFile */
+ CHAR_PTR hand_temp_name ;
+ BOOLEAN hand_registry ;
+ UINT32 fdb_attrib ;
+ CHAR alt_name[14] ;
+ DWORD idHi;
+ DWORD idLo;
+ DWORD linkCount;
+ BOOLEAN linkOnly; /* Already backed up */
+ BOOLEAN PosixFile ;
+} NTFS_FDB_INFO ;
+
+
+typedef struct _NTFS_DDB_INFO {
+ UINT32 ddb_attrib ;
+} NTFS_DDB_INFO, *NTFS_DDB_INFO_PTR ;
+
+
+typedef struct _NTFS_DBLK *NTFS_DBLK_PTR;
+
+typedef struct _NTFS_DBLK {
+ UINT8 blk_type; /* values: DDB_ID, FDB_ID set: DOS */
+ COM_DBLK fs_reserved ;
+ NTFS_DTA dta;
+ BOOLEAN os_info_complete; /* TRUE if GetObjInfo doesn't have to do anything */
+ BOOLEAN name_complete; /* TRUE if name/path is restored to DBLK */
+ FS_NAME_Q_ELEM_PTR full_name_ptr ;
+ union {
+ NTFS_DDB_INFO d;
+ NTFS_FDB_INFO f; /* last member in structure */
+ } b;
+} NTFS_DBLK;
+
+
+typedef struct _NTFS_MIN_DDB *NTFS_MIN_DDB_PTR;
+
+typedef struct _NTFS_MIN_DDB {
+ Q_ELEM q ;
+ HANDLE scan_hand; /* windows handle for scan */
+ BOOLEAN path_in_stream ;
+ UINT16 psize ; /* size of path string */
+ CHAR_PTR path; /* build from "name" and current dir */
+} NTFS_MIN_DDB;
+
+typedef struct _NTFS_SCAN_Q_ELEM {
+ Q_ELEM q ;
+ HANDLE scan_hand ;
+} NTFS_SCAN_Q_ELEM, *NTFS_SCAN_Q_ELEM_PTR ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/nw386.h b/private/utils/ntbackup/inc/nw386.h
new file mode 100644
index 000000000..073cbd479
--- /dev/null
+++ b/private/utils/ntbackup/inc/nw386.h
@@ -0,0 +1,257 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: nw386.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains prototypes and defines for the NetWare
+ 386 specific functions. Most of the information in this file
+ was obtained by examining the source to the preliminary
+ NetWare 386 C interface functions. Each of these functions was
+ designed to impliment only one API. The Novell library tries to
+ releive the developer of some of the complexity of these functions
+ by combining APIs into a single function. However, this is not
+ desirable when trying to maximize performance.
+
+
+ Location:
+
+
+ $Log: G:/LOGFILES/NW386.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:31:56 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _nw386_h_
+#define _nw386_h_
+
+
+#define DOS_NAME_SPACE 0
+#define MAC_NAME_SPACE 1
+
+#define NW_MAX_NAME_SPACE_ENTRY_SIZE 127 /* @@@ ??? */
+#define NW_MAX_NCP_PATH 255
+#define NW_MAX_DIR_RESTRICTIONS 33
+#define NW_MAX_VOL_NAME 48
+
+
+#define NW_CHANGE_DOS_NAME 0x0001
+#define NW_CHANGE_DOS_ATTRIBUTES 0x0002
+#define NW_CHANGE_DOS_CREATE_DATE 0x0004
+#define NW_CHANGE_DOS_CREATE_TIME 0x0008
+#define NW_CHANGE_DOS_OWNER 0x0010
+#define NW_CHANGE_DOS_ARCHIVE_DATE 0x0020
+#define NW_CHANGE_DOS_ARCHIVE_TIME 0x0040
+#define NW_CHANGE_DOS_ARCHIVER_ID 0x0080
+#define NW_CHANGE_DOS_MODIFY_DATE 0x0100
+#define NW_CHANGE_DOS_MODIFY_TIME 0x0200
+#define NW_CHANGE_DOS_MODIFIER_ID 0x0400 /* for files only */
+#define NW_CHANGE_DOS_NEXT_TRUSTEE 0x0400 /* for directories only */
+#define NW_CHANGE_DOS_ACCESS_DATE 0x0800 /* for files only */
+#define NW_CHANGE_DOS_INHERITED_RIGHTS 0x1000
+#define NW_CHANGE_DOS_MAXIMUM_SPACE 0x2000 /* for dirs only */
+
+#define NW_CHANGE_MAC_NAME 0x0001
+#define NW_CHANGE_MAC_FINDER_INFO 0x0002
+#define NW_CHANGE_MAC_PRODOS_INFO 0x0004
+
+#define NW_CHANGE_EVERYTHING 0xFFFFFFFF
+
+#define NW_NORMAL_ATTR 0x00000000L
+#define NW_READ_ONLY_ATTR 0x00000001L
+#define NW_HIDDEN_ATTR 0x00000002L
+#define NW_SYSTEM_ATTR 0x00000004L
+#define NW_EXECUTE_ONLY_ATTR 0x00000008L
+#define NW_DIRECTORY_ATTR 0x00000010L
+#define NW_NEEDS_ARCHIVED_ATTR 0x00000020L
+#define NW_EXECUTE_CONFIRM_ATTR 0X00000040L
+#define NW_SHAREABLE_ATTR 0x00000080L
+
+#define NW_LOW_SEARCH_ATTR 0x00000100L
+#define NW_MID_SEARCH_ATTR 0x00000200L
+#define NW_HI_SEARCH_ATTR 0x00000400L
+#define NW_PRIVATE_ATTR 0x00000800L
+#define NW_TRANSACTIONAL_ATTR 0x00001000L
+#define NW_INDEXED_ATTR 0x00002000L
+#define NW_READ_AUDIT_ATTR 0x00004000L
+#define NW_WRITE_AUDIT_ATTR 0x00008000L
+
+#define NW_PURGE_ATTR 0x000010000L
+#define NW_RENAME_INHIBIT_ATTR 0x000020000L
+#define NW_DELETE_INHIBIT_ATTR 0x000040000L
+#define NW_COPY_INHIBIT_ATTR 0x000080000L
+
+
+typedef struct DOS_NAME_SPACE_FILE_INFO {
+ UINT32 last_modifier_id ; /* 57 */
+ UINT32 data_fork_size ; /* 61 */
+ UINT8 reserved1[44]; /* 65 */
+ UINT16 inherited_rights_mask; /* 109 */
+ UINT16 last_access_date ; /* 111 */
+ UINT8 reserved2[20]; /* 113 */
+ UINT32 primary_entry; /* 133 */
+ UINT32 name_list ; /* 137 */
+ } DOS_NAME_SPACE_FILE_INFO ;
+
+
+typedef struct DOS_NAME_SPACE_DIR_INFO {
+ UINT32 next_trustee_entry; /* 57 */
+ UINT8 reserved1[48]; /* 61 */
+ UINT32 maximum_space; /* 109 */
+ UINT16 inherited_rights_mask; /* 113 */
+ } DOS_NAME_SPACE_DIR_INFO ;
+
+
+
+typedef struct DOS_NAME_SPACE_INFO {
+ UINT8 name_length;
+ CHAR name[12]; /* no '\0' */
+ UINT16 creation_time;
+ UINT16 creation_date;
+ UINT32 owner_id;
+ UINT16 archive_time;
+ UINT16 archive_date;
+ UINT32 archiver_id;
+ UINT16 modify_time;
+ UINT16 modify_date;
+ union {
+ DOS_NAME_SPACE_DIR_INFO dir ;
+ DOS_NAME_SPACE_FILE_INFO file ;
+ } info ;
+ } DOS_NAME_SPACE_INFO ;
+
+typedef struct MAC_NAME_SPACE_INFO {
+ UINT8 name_length;
+ CHAR name[32];
+ UINT32 resource_fork;
+ UINT32 resource_fork_size;
+ UINT8 finder_info[32];
+ UINT8 pro_dos_info[6];
+ } MAC_NAME_SPACE_INFO ;
+
+
+typedef struct UNKNOWN_NAME_SPACE_INFO {
+ UINT8 unknown[ NW_MAX_NAME_SPACE_ENTRY_SIZE ];
+ } UNKNOWN_NAME_SPACE_INFO ;
+
+
+typedef struct NAME_SPACE_ENTRY * NAME_SPACE_ENTRY_PTR ;
+
+typedef struct NAME_SPACE_ENTRY {
+ UINT8 unknown1[1];
+ UINT32 sub_directory;
+ UINT32 attributes;
+ INT32 entry_id; /* This field is dynamically created each time the file */
+ /* server is brought up. Do NOT back up this field. */
+ UINT8 flags;
+ UINT8 name_space_type;
+ union {
+ DOS_NAME_SPACE_INFO dos;
+ MAC_NAME_SPACE_INFO mac;
+ UNKNOWN_NAME_SPACE_INFO unknown;
+ } info;
+ } NAME_SPACE_ENTRY ;
+
+
+typedef struct TRUSTEE_REPLY * TRUSTEE_REPLY_PTR ;
+
+typedef struct TRUSTEE_REPLY {
+ UINT8 num_trustees_returned ;
+ UINT32 trustee_id[ 20 ];
+ UINT16 trustee_rights[ 20 ];
+ } TRUSTEE_REPLY ;
+
+typedef struct DIR_RESTRICTION {
+ UINT8 level;
+ UINT32 max;
+ UINT32 current;
+ } DIR_RESTRICTION ;
+
+
+typedef struct DIR_RESTRICTION_LIST * DIR_RESTRICTION_LIST_PTR ;
+
+typedef struct DIR_RESTRICTION_LIST {
+ UINT8 num_restrictions;
+ DIR_RESTRICTION restriction[ NW_MAX_DIR_RESTRICTIONS ] ; /* array of restrictions */
+ } DIR_RESTRICTION_LIST ;
+
+
+typedef struct DIR_INFO_REPLY * DIR_INFO_REPLY_PTR ;
+
+typedef struct DIR_INFO_REPLY {
+ UINT32 total_blocks;
+ UINT32 avail_blocks;
+ UINT32 total_dir_entries;
+ UINT32 avail_dir_entries;
+ UINT32 flags;
+ UINT8 sectors_per_block;
+ UINT8 vol_name_length;
+ CHAR vol_name[ NW_MAX_VOL_NAME ];
+ } DIR_INFO_REPLY;
+
+
+typedef struct DIR_ENTRY * DIR_ENTRY_PTR ;
+
+typedef struct DIR_ENTRY {
+ UINT32 sub_directory;
+ UINT32 attributes;
+ UINT8 unique_id;
+ UINT8 flags;
+ UINT8 name_space_type;
+ DOS_NAME_SPACE_INFO dinfo ;
+ } DIR_ENTRY ;
+
+
+typedef struct DIR_ENTRY_SCAN * DIR_ENTRY_SCAN_PTR ;
+
+typedef struct DIR_ENTRY_SCAN {
+ INT32 entry_id; /* This field is dynamically created each time the file */
+ /* server is brought up. Do NOT back up this field. */
+ DIR_ENTRY entry;
+ } DIR_ENTRY_SCAN ;
+
+
+
+INT16 GetNameSpaceEntry( UINT8 volume_number, INT32 sequence, UINT8 name_space_type,
+ NAME_SPACE_ENTRY_PTR entry_info_ptr ) ;
+
+INT16 FillNameSpaceBuffer( UINT8 volumeNum, NAME_SPACE_ENTRY_PTR ns_buf_ptr ) ;
+
+
+
+INT16 ScanEntryForTrustees386( UINT8 directory_handle, CHAR_PTR directory_path,
+ UINT8 seq_number, TRUSTEE_REPLY_PTR trustee_reply_buf ) ;
+
+INT16 GetDirRestrictions386( UINT8 dir_handle, DIR_RESTRICTION_LIST_PTR res_list ) ;
+
+
+INT16 GetDirInfo386( UINT8 dir_handle, DIR_INFO_REPLY_PTR dir_info_buf ) ;
+
+
+INT16 SetTrustee386( UINT8 directory_handle, CHAR_PTR directory_path,
+ UINT32 trustee_object_id, UINT16 trustee_rights_mask ) ;
+
+
+INT16 SetDirRestriction386( UINT8 dir_handle, INT32 restriction ) ;
+
+
+UINT16 ScanDirEntry386( UINT8 directory_handle, CHAR_PTR search_path,
+ UINT8 search_attributes, UINT32 prev_entry_id,
+ DIR_ENTRY_SCAN_PTR dir_entry_buf ) ;
+
+
+INT16 GetDirEntry386( UINT8 dir_handle, DIR_ENTRY_PTR dir_entry_ptr ) ;
+
+
+INT16 SetDirEntry386( UINT8 dir_handle, UINT8 search_attribute,
+ UINT32 entry_id, UINT32 change_bits,
+ DIR_ENTRY_PTR dir_entry_ptr ) ;
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/oem.h b/private/utils/ntbackup/inc/oem.h
new file mode 100644
index 000000000..2e4ec552a
--- /dev/null
+++ b/private/utils/ntbackup/inc/oem.h
@@ -0,0 +1,23 @@
+#ifndef _oem_h_
+#define _oem_h_
+
+
+
+#ifdef DO_OEM
+
+VOID show_oem_title( VOID );
+VOID set_oem_title_addition( CHAR_PTR addition );
+#define clear_oem_title_addition() set_oem_title_addition( NULL )
+
+#else
+
+#define show_oem_title() /* do nothing */
+#define set_oem_title_addition( x ) /* do nothing */
+#define clear_oem_title_addition() /* do nothing */
+
+#endif
+
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/ombatch.h b/private/utils/ntbackup/inc/ombatch.h
new file mode 100644
index 000000000..bbb825cae
--- /dev/null
+++ b/private/utils/ntbackup/inc/ombatch.h
@@ -0,0 +1,154 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: ombatch.h
+
+ Description: This file contains the definitions for the Microsoft
+ OEM version of Maynstream for Windows & Win32/NT to
+ support Command Line batch processing.
+
+ The following support is implemented for batch mode
+ processing (see the NT Backup/Restore Utility
+ Specification for more information.)
+
+ The batch command has the following parameters:
+
+ APPNAME [OPERATION PATHNAMES [OPTIONS]]
+
+ where:
+
+ OPERATION = "Backup"
+
+ PATHNAMES = [[drive:][path]filespec] ...
+
+ OPTIONS = {Mode, Verify, RestrictAccess,
+ Description, BackupType, Logfile,
+ Logmode }...
+
+ Mode = /A[ppend]
+ Verify = /V[erify]
+ Access = /R[estrict]
+ Description = /D[escription] "text"
+ BackupType = /T[ype] {Normal, Incremental,
+ Differential, Copy,
+ Incremental_Copy}
+ Logfile = /L[ogfile] "filename"
+ Logmode = /E[xceptions]
+
+ Note: In this implementation, options may appear
+ anywhere in the command line following the
+ 'Backup' operation key word - they are not
+ restricted to just following the list of
+ path names.
+
+ $Log: G:/UI/LOGFILES/OMBATCH.H_V $
+
+ Rev 1.5.1.0 26 Oct 1993 18:07:20 BARRY
+Added backupRegistry flag to options.
+
+ Rev 1.5 26 Jul 1993 17:40:48 MARINA
+enable c++
+
+ Rev 1.4 07 Dec 1992 16:36:14 STEVEN
+msoft fix
+
+ Rev 1.3 15 Oct 1992 13:04:02 DAVEV
+fix problem with batch mode /T option
+
+ Rev 1.2 04 Oct 1992 19:48:22 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 25 Sep 1992 15:23:18 DARRYLP
+Spelling fix - mismatch on BSD_BACKUP_DIFFERENTIAL
+
+ Rev 1.0 11 May 1992 14:28:50 DAVEV
+Initial revision.
+
+******************************************************************************/
+#ifndef OEMBATCH_H_INCL
+#define OEMBATCH_H_INCL
+
+typedef enum {
+ OEM_TYPE_UNKNOWN = -1,
+ OEM_TYPE_COMPATIBLE = BSD_BACKUP_COMPATIBLE,
+ OEM_TYPE_NORMAL = BSD_BACKUP_NORMAL,
+ OEM_TYPE_COPY = BSD_BACKUP_COPY,
+ OEM_TYPE_DIFFERENTIAL= BSD_BACKUP_DIFFERENTIAL,
+ OEM_TYPE_INCREMENTAL = BSD_BACKUP_INCREMENTAL,
+ OEM_TYPE_DAILY = BSD_BACKUP_DAILY
+
+ } OEMTYPE ;
+
+typedef enum {
+ OEM_MODE_OVERWRITE,
+ OEM_MODE_APPEND
+
+ } OEMMODE ;
+
+typedef enum {
+ OEM_VERIFY_OFF,
+ OEM_VERIFY_ON
+
+ } OEMVERIFY ;
+
+typedef enum {
+ OEM_ACCESS_NO_RESTRICT,
+ OEM_ACCESS_RESTRICTED
+
+ } OEMACCESS ;
+
+typedef enum {
+ OEM_LOG_FULLDETAIL,
+ OEM_LOG_SUMMARY_ONLY
+
+ } OEMLOGOPT ;
+
+typedef struct OEMOPTS_STRUCT {
+
+ OEMMODE eMode;
+ OEMVERIFY eVerify;
+ OEMACCESS eAccess;
+ OEMTYPE eType;
+ OEMLOGOPT eLogOpt;
+ LPSTR pszLogName;
+ LPSTR pszDescription;
+ BOOLEAN backupRegistry;
+
+} OEMOPTS, FAR * OEMOPTS_PTR;
+
+OEMOPTS_PTR OEM_DefaultBatchOptions ( VOID );
+VOID OEM_UpdateBatchBSDOptions ( BSD_HAND hbsd, OEMOPTS_PTR pOpts );
+VOID OEM_DeleteBatchOptions ( OEMOPTS_PTR * pOpts );
+OEMTYPE OEM_LookupTypeOption ( LPSTR pszType );
+INT OEM_ProcessBatchCmdOption (
+ OEMOPTS_PTR pOpts, //IO - Pointer to the options buffer to update
+ LPSTR pszOption, //I - Pointer to option string
+ LPSTR pszTokens, //I - Token seperators between cmd line options
+ LPSTR pszCmdLine); //IO - Pointer to partially tokenized command line
+ // ( not really needed, but may be modified
+ // as a side effect of strtok () )
+INT OEM_LookupBatchOption (
+ LPSTR pszOption ); //I - Targe option string to look for
+BOOL OEM_AddPathToBackupSets (
+ BSD_HAND hbsd, //IO - list of backup sets to update
+ DLE_HAND hdle, //I - list of drives
+ LPSTR pszPath ); //I - Path to insert into backup set
+
+BOOL OEM_AddEMSServerToBackupSets (
+ BSD_HAND hbsd, //IO - list of backup sets to update
+ DLE_HAND hdle, //I - list of drives
+ LPSTR pszPath, //I - Path to insert into backup set
+ UINT8 uType ); //I - FS_EMS_MDB_ID (Monolithic) or
+ // FS_EMS_DSA_ID (DSA)
+
+INT OEM_CharInSet ( CHAR chTarg, LPSTR pszSet );
+
+INT16 DLE_FindByEMSServerName (
+ DLE_HAND hand, /* I - DLE list handle */
+ LPSTR name, /* I - name to search for */
+ UINT8 uType, /* I - type of dle to search for */
+ GENERIC_DLE_PTR *dle ); /* O - pointer to matched DLE */
+
+
+#endif //OEMBATCH_H_INCL
diff --git a/private/utils/ntbackup/inc/ombkup.h b/private/utils/ntbackup/inc/ombkup.h
new file mode 100644
index 000000000..56fd48a3e
--- /dev/null
+++ b/private/utils/ntbackup/inc/ombkup.h
@@ -0,0 +1,80 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: ombkup.h
+
+ Description: OEM Microsoft version of bkup.h
+
+
+ $Log: J:\ui\logfiles\ombkup.h_v $
+
+ Rev 1.6 24 Nov 1993 19:25:08 GLENN
+Added hardware compression option to backup dialog and config.
+
+ Rev 1.5 04 Oct 1992 19:48:24 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 19 Aug 1992 14:21:50 CHUCKB
+Added id's for new controls.
+
+ Rev 1.3 10 Aug 1992 14:18:20 CHUCKB
+Added id's for new fields in NT utility.
+
+ Rev 1.2 24 Mar 1992 16:35:38 DAVEV
+Minor changes
+
+
+ Rev 1.1 20 Mar 1992 12:41:46 DAVEV
+Changes for OEM_MSOFT product alternate functionality
+
+ Rev 1.0 18 Mar 1992 14:39:56 DAVEV
+Initial revision.
+
+ Rev 1.0 18 Mar 1992 14:37:50 DAVEV
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef BKUP_H
+#define BKUP_H
+
+#define IDM_BACKUPSET 228
+
+#define IDD_BKUP_INFO_TITLE 101
+#define IDD_BKUP_OK_BUTTON 102
+#define IDD_BKUP_SCROLLBAR 103
+#define IDD_BKUP_CANCEL_BUTTON 104
+#define IDD_BKUP_DESCRIPTION 106
+#define IDD_BKUP_HELP_BUTTON 107
+#define IDD_BKUP_APPEND 108
+#define IDD_BKUP_REPLACE 109
+#define IDD_BKUP_NEXT_BUTTON 110
+#define IDD_BKUP_DRIVE_NAME 111
+#define IDD_BKUP_AUTO_VERIFY 112
+#define IDD_BKUP_TAPE_NAME 113
+//#define IDD_BKUP_PASSWORD 114
+#define IDD_BKUP_RESTRICT_ACCESS 115 //DLGDVC
+#define IDD_BKUP_CREATION_DATE 116
+#define IDD_BKUP_OWNER 117
+#define IDD_BKUP_REGISTRY 118
+#define IDD_XCHG_BKUP_METHOD 215
+#define IDD_BKUP_METHOD 216
+#define IDD_BKUP_TAPE_TEXT 217
+#define IDD_BKUP_TAPE_NAME_TEXT 218
+#define IDD_BKUP_CURRENT_TAPE_NAME 219
+#define IDD_BKUP_LOG_FILENAME 220 //DLGDVC
+#define IDD_BKUP_LOG_BROWSE 221 //DLGDVC
+/* The following radio button ids MUST BE CONSECUTIVE ! */
+#define IDD_BKUP_LOG_FULL 222 //DLGDVC
+#define IDD_BKUP_LOG_SUMMARY 223 //DLGDVC
+#define IDD_BKUP_LOG_NONE 224 //DLGDVC
+
+#define IDD_BKUP_HARDCOMP 242
+#define IDD_BKUP_DRIVE_NAME_TEXT 243
+#define IDD_BKUP_DESC_TEXT 244
+#define IDD_BKUP_TYPE_TEXT 245
+#define IDD_BKUP_XCHG_NAME_TEXT 246
+#define IDD_BKUP_XCHG_NAME 247
+
+#endif
diff --git a/private/utils/ntbackup/inc/omevent.h b/private/utils/ntbackup/inc/omevent.h
new file mode 100644
index 000000000..fc6a86c1c
--- /dev/null
+++ b/private/utils/ntbackup/inc/omevent.h
@@ -0,0 +1,39 @@
+
+void OMEVENT_LogEvent ( DWORD dwEventId, //id of event message
+ WORD wEventType, //type of event
+ INT cStrings, //number of replement strings
+ ... ); //replacement strings
+
+void OMEVENT_LogBeginBackup (
+ CHAR_PTR szDrive, //Drive name
+ INT16 verify, //VERIFY ON or OFF
+ INT16 mode, //APPEND or REPLACE
+ INT16 type ); //NORMAL, COPY, etc.
+void OMEVENT_LogEndBackup (
+ BOOL bError );//Did an error occur?
+void OMEVENT_LogBeginRestore (
+ CHAR_PTR szDrive, //Drive name
+ INT16 verify ); //VERIFY ON or OFF
+void OMEVENT_LogEndRestore (
+ BOOL bError );//Did an error occur?
+void OMEVENT_LogBeginErase ( VOID );
+void OMEVENT_LogEndErase (
+ BOOL bError );//Did an error occur?
+void OMEVENT_LogBeginRetension ( VOID );
+void OMEVENT_LogEndRetension (
+ BOOL bError );//Did an error occur?
+void OMEVENT_LogBeginVerify ( LPSTR );
+void OMEVENT_LogEndVerify ( LPSTR,
+ BOOL bError );//Did an error occur?
+void OMEVENT_LogEMSError (
+ CHAR_PTR function_name,
+ INT status,
+ CHAR_PTR additional_info ); //Did an error occur?
+void OMEVENT_LogEMSErrorText (
+ CHAR_PTR function_name,
+ CHAR_PTR status,
+ CHAR_PTR additional_info ); //Did an error occur?
+void OMEVENT_LogEMSToFewDbError (
+ INT num_found,
+ INT num_needed ) ;
+
diff --git a/private/utils/ntbackup/inc/omhelpid.h b/private/utils/ntbackup/inc/omhelpid.h
new file mode 100644
index 000000000..75aa947ff
--- /dev/null
+++ b/private/utils/ntbackup/inc/omhelpid.h
@@ -0,0 +1,339 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: OMHELPIDS.H
+
+ Description: This header file contains helpids for the
+ help manager.
+
+ $Log: G:/UI/LOGFILES/OMHELPID.H_V $
+
+ Rev 1.13 26 Mar 1993 13:36:06 DARRYLP
+New IDS for Font, Format.
+
+ Rev 1.12 25 Mar 1993 15:49:38 ROBG
+Added IDH_MENU_OPERATIONSFORMAT to list to support the help
+with the new menu option.
+
+ Rev 1.9 12 Mar 1993 13:48:32 ROBG
+Changes to support font, split catalog, and drive tape windows.
+
+ Rev 1.7 22 Oct 1992 09:39:22 GLENN
+Found another incomplete ID change.
+
+ Rev 1.6 20 Oct 1992 16:54:00 GLENN
+You gotta change ribbon to toolbar in both places, Steve.
+
+ Rev 1.5 05 Oct 1992 10:36:08 STEVEN
+additions from peggy
+
+ Rev 1.4 04 Oct 1992 19:48:26 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 03 Sep 1992 16:15:52 ROBG
+Added OPERATIONSCATALOG for Peggy at Microsoft.
+
+ Rev 1.2 11 Jun 1992 11:00:04 GLENN
+Removed MEMORYTRACE references.
+
+ Rev 1.1 10 Jun 1992 16:12:48 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.0 03 Mar 1992 12:25:28 DAVEV
+Initial revision.
+****************************************************************************/
+
+#ifndef helpids_h // Do not allow multiple inclusions of this file
+#define helpids_h
+
+
+#define IDH_MINIMIZE_ICON 1 // Minimize button on frame
+#define IDH_MAXIMIZE_ICON 2 // Maximize button on frame
+#define IDH_SYSTEM_MENU 3 // System menu frame
+#define IDH_TITLE_BAR 4 // Title bar on frame
+#define IDH_SIZING_BORDER 5 // Frame Border
+#define IDH_FRAME_WINDOW 6 // Frame Window
+#define IDH_STATUSLINE 7 // Status Bar
+#define IDH_CLIENT_WINDOW 8 // MDI Client Window
+#define IDH_DOC_WINDOW 9 // MDI Document Window
+#define IDH_RIBBON_WINDOW 10 // Tool Bar
+
+// MDI DOCUMENTS
+
+#define IDH_MDI_DISKS 20
+#define IDH_MDI_TAPES 21
+#define IDH_MDI_DISKTREE 22
+#define IDH_MDI_TAPETREE 23
+
+// These processed on a "listbox" control.
+// begin
+
+#define IDH_LB_DISKTREELEFT 50
+#define IDH_LB_DISKTREERIGHT 51
+#define IDH_LB_TAPETREELEFT 52
+#define IDH_LB_TAPETREERIGHT 53
+
+// end
+
+#define IDH_MENU_OPERATIONSBACKUP 100
+#define IDH_MENU_OPERATIONSRESTORE 102
+#define IDH_MENU_OPERATIONSERASE 103
+#define IDH_MENU_OPERATIONSRETENSION 104
+#define IDH_MENU_OPERATIONSEJECT 105
+#define IDH_MENU_OPERATIONSHARDWARE 106
+#define IDH_MENU_OPERATIONSEXIT 107
+#define IDH_MENU_OPERATIONSCATALOG 108
+#define IDH_MENU_OPERATIONSFORMAT 109
+#ifdef OEM_EMS
+#define IDH_MENU_OPERATIONSEXCHANGE 110
+#endif
+
+#define IDH_MENU_TREEEXPANDONE 200
+#define IDH_MENU_TREEEXPANDBRANCH 201
+#define IDH_MENU_TREEEXPANDALL 202
+#define IDH_MENU_TREECOLLAPSEBRANCH 203
+
+#define IDH_MENU_VIEWTREEANDDIR 300
+#define IDH_MENU_VIEWTREEONLY 301
+#define IDH_MENU_VIEWDIRONLY 302
+#define IDH_MENU_VIEWNAMEONLY 303
+#define IDH_MENU_VIEWALLFILEDETAILS 304
+#define IDH_MENU_VIEWSTATUS 305
+#define IDH_MENU_VIEWTOOLBAR 306
+#define IDH_MENU_VIEWFONT 2410 // Was 307. Microsoft wants the dialog
+#define IDH_MENU_VIEWSPLIT 308
+
+#define IDH_MENU_SELECTCHECK 400
+#define IDH_MENU_SELECTUNCHECK 401
+
+#define IDH_MENU_WINDOWSCASCADE 500
+#define IDH_MENU_WINDOWSTILE 501
+#define IDH_MENU_WINDOWSARRANGEICONS 502
+#define IDH_MENU_WINDOWSREFRESH 503
+#define IDH_MENU_WINDOWSCLOSEALL 504
+
+#define IDH_MENU_HELPINDEX 900
+#define IDH_MENU_HELPKEYBOARD 901
+#define IDH_MENU_HELPSEARCH 902
+#define IDH_MENU_HELPCOMMANDS 903
+#define IDH_MENU_HELPPROCEDURES 904
+#define IDH_MENU_HELPUSINGHELP 905
+#define IDH_MENU_HELPABOUTNOSTRADOMUS 906
+
+#define IDH_MENU_WINDOWSNAMES 505 // Generic for 1. drives and 2. tapes
+#define IDH_SYSMENU 800 // generic for move, restore, ...
+
+#define IDH_DB_BACKUPSET 3000 // Backup setup
+#define IDH_DB_RESTORESET 3010 // Restore setup
+#define IDH_DB_ERASE 3020 // Erase
+#define IDH_DB_TENSION 2030 // Retension
+#define IDH_DB_STATUS 2040 // Runtime status for BU and RS
+#define IDH_DB_INSERTTAPE 2050 // Insert the specified tape'
+#define IDH_DB_INSERTNEXTTAPE 2051 // Insert the next tape in seq.
+#define IDH_DB_ABORT 2060 // Tape operation aborted
+#define IDH_DB_TAPEREWOUND 2070 // Tape is rewound
+#define IDH_DB_CATNOTAVAILABLE 2080 // Catalog not available
+#define IDH_DB_HARDWARESETUP 2090 // Hardware config.
+#define IDH_DB_VIEWFONT 2410 // Font dialog.
+#define IDH_DB_FORMAT 2415 // Font dialog.
+#define IDH_DB_BATCHHELP 2420 // batch command help
+
+#ifdef OEM_EMS
+#define IDH_DB_XCHG_BACKUPSET 3001 // Exchange Backup set
+#define IDH_DB_XCHG_RESTORESET 3011 // Exchange Restore set
+#define IDH_DB_XCHG_CONNECT 2430 // Exchange Connect dialog
+#define IDH_DB_XCHG_BROWSE 2431 // Exchange connect browse
+#endif
+
+
+// THE FOLLOWING HELP IDs ARE NOT USED IN THE MICROSOFT NT BACKUP.EXE
+// IGNORE THESE.
+
+#define IDH_MDI_MACROS 23
+#define IDH_MDI_JOBS 24
+#define IDH_MDI_SERVERS 27
+#define IDH_MDI_LOGFILES 28
+#define IDH_MDI_DEBUG 29
+#define IDH_MDI_SEARCH 30
+
+#define IDH_LB_SERVERLEFT 54
+#define IDH_LB_SERVERRIGHT 55
+
+#define IDH_DB_ABOUT 2000
+#define IDH_DB_SELECTADVANCED 2010
+#define IDH_DB_SELECTSAVE 2020
+#define IDH_DB_SELECTUSE 2030
+#define IDH_DB_SELECTDELETE 2040
+#define IDH_DB_ADVRESTORE 2050
+#define IDH_DB_JOBEDIT 2060
+#define IDH_DB_JOBNEW 2070
+#define IDH_DB_JOBMAINTENANCE 2080
+#define IDH_DB_JOBOPTS 2090
+#define IDH_DB_JOBSCHEDULE 2100
+#define IDH_DB_SCHEDOPTS 2110
+#define IDH_DB_SETTINGSOPTIONS 2120
+#define IDH_DB_SETTINGSBACKUP 2130
+#define IDH_DB_SETTINGSRESTORE 2140
+#define IDH_DB_SETTINGSLOGGING 2150
+#define IDH_DB_SETTINGSNETWORK 2160
+#define IDH_DB_SETTINGSCATALOG 2170
+#define IDH_DB_SETTINGSHARDWARE 2180
+#define IDH_DB_SETTINGSDEBUG 2190
+#define IDH_DB_LOGINPSWD 2200
+#define IDH_DB_SEARCHTAPE 2210
+#define IDH_DB_PRINTERSETUP 2220
+#define IDH_DB_PRINT 2230
+#define IDH_DB_CATMAINT 2240
+#define IDH_DB_CATTAPE 2250
+#define IDH_DB_TAPEPSWD 2260
+#define IDH_DB_LANTAPEPSWD 2270
+#define IDH_DB_JOBPROGRAMITEM 2280
+#define IDH_DB_VERIFYSET 2310
+#define IDH_DB_REENTERPASSWORD 2320
+#define IDH_DB_SKIPOPEN 2330
+#define IDH_DB_FILEREPLACE 2340
+#define IDH_DB_NEXTSET 2380
+#define IDH_DB_PWDBPASSWORD 2390
+#define IDH_DB_TRANSFER 2400
+
+// Defines for the three topics for the launcher.
+
+#define IDH_LAUNCHMAINSCREEN 2460
+#define IDH_LAUNCHRUNDELAY 2470
+#define IDH_LAUNCHSCHEDDELAY 2480
+
+
+//
+// THESE ARE THE OLD STYLE DEFINES -- THEY SHOULD HAVE STARTED WITH IDH
+//
+
+
+#define HELPID_MINIMIZE_ICON IDH_MINIMIZE_ICON
+#define HELPID_MAXIMIZE_ICON IDH_MAXIMIZE_ICON
+#define HELPID_SYSTEM_MENU IDH_SYSTEM_MENU
+#define HELPID_TITLE_BAR IDH_TITLE_BAR
+#define HELPID_SIZING_BORDER IDH_SIZING_BORDER
+#define HELPID_FRAME_WINDOW IDH_FRAME_WINDOW
+#define HELPID_STATUSLINE IDH_STATUSLINE
+#define HELPID_CLIENT_WINDOW IDH_CLIENT_WINDOW
+#define HELPID_DOC_WINDOW IDH_DOC_WINDOW
+#define HELPID_RIBBON_WINDOW IDH_RIBBON_WINDOW
+
+#define HELPID_DISKS IDH_MDI_DISKS
+#define HELPID_TAPES IDH_MDI_TAPES
+#define HELPID_MACROS IDH_MDI_MACROS
+#define HELPID_JOBS IDH_MDI_JOBS
+#define HELPID_DISKTREE IDH_MDI_DISKTREE
+#define HELPID_TAPETREE IDH_MDI_TAPETREE
+#define HELPID_SERVERS IDH_MDI_SERVERS
+#define HELPID_LOGFILES IDH_MDI_LOGFILES
+#define HELPID_DEBUG IDH_MDI_DEBUG
+#define HELPID_SEARCH IDH_MDI_SEARCH
+
+// These processed on a "listbox" control.
+// begin
+
+#define HELPID_DISKTREELEFT IDH_LB_DISKTREELEFT
+#define HELPID_DISKTREERIGHT IDH_LB_DISKTREERIGHT
+#define HELPID_TAPETREELEFT IDH_LB_TAPETREELEFT
+#define HELPID_TAPETREERIGHT IDH_LB_TAPETREERIGHT
+#define HELPID_SERVERLEFT IDH_LB_SERVERLEFT
+#define HELPID_SERVERRIGHT IDH_LB_SERVERRIGHT
+
+// end
+
+#define HELPID_OPERATIONSBACKUP IDH_MENU_OPERATIONSBACKUP
+#define HELPID_OPERATIONSRESTORE IDH_MENU_OPERATIONSRESTORE
+#define HELPID_OPERATIONSCATALOG IDH_MENU_OPERATIONSCATALOG
+#define HELPID_OPERATIONSERASE IDH_MENU_OPERATIONSERASE
+#define HELPID_OPERATIONSRETENSION IDH_MENU_OPERATIONSRETENSION
+#define HELPID_OPERATIONSEJECT IDH_MENU_OPERATIONSEJECT
+#define HELPID_OPERATIONSHARDWARE IDH_MENU_OPERATIONSHARDWARE
+#define HELPID_OPERATIONSEXIT IDH_MENU_OPERATIONSEXIT
+#define HELPID_OPERATIONSFORMAT IDH_MENU_OPERATIONSFORMAT
+#ifdef OEM_EMS
+#define HELPID_OPERATIONSEXCHANGE IDH_MENU_OPERATIONSEXCHANGE
+#endif
+
+#define HELPID_TREEEXPANDONE IDH_MENU_TREEEXPANDONE
+#define HELPID_TREEEXPANDBRANCH IDH_MENU_TREEEXPANDBRANCH
+#define HELPID_TREEEXPANDALL IDH_MENU_TREEEXPANDALL
+#define HELPID_TREECOLLAPSEBRANCH IDH_MENU_TREECOLLAPSEBRANCH
+
+#define HELPID_VIEWTREEANDDIR IDH_MENU_VIEWTREEANDDIR
+#define HELPID_VIEWTREEONLY IDH_MENU_VIEWTREEONLY
+#define HELPID_VIEWDIRONLY IDH_MENU_VIEWDIRONLY
+#define HELPID_VIEWNAMEONLY IDH_MENU_VIEWNAMEONLY
+#define HELPID_VIEWALLFILEDETAILS IDH_MENU_VIEWALLFILEDETAILS
+#define HELPID_VIEWSTATUS IDH_MENU_VIEWSTATUS
+#define HELPID_VIEWURIBBON IDH_MENU_VIEWTOOLBAR
+#define HELPID_VIEWFONTS IDH_MENU_VIEWFONT
+#define HELPID_VIEWSPLIT IDH_MENU_VIEWSPLIT
+
+#define HELPID_SELECTCHECK IDH_MENU_SELECTCHECK
+#define HELPID_SELECTUNCHECK IDH_MENU_SELECTUNCHECK
+
+#define HELPID_WINDOWSCASCADE IDH_MENU_WINDOWSCASCADE
+#define HELPID_WINDOWSTILE IDH_MENU_WINDOWSTILE
+#define HELPID_WINDOWSARRANGEICONS IDH_MENU_WINDOWSARRANGEICONS
+#define HELPID_WINDOWSREFRESH IDH_MENU_WINDOWSREFRESH
+#define HELPID_WINDOWSCLOSEALL IDH_MENU_WINDOWSCLOSEALL
+
+#define HELPID_HELPINDEX IDH_MENU_HELPINDEX
+#define HELPID_HELPKEYBOARD IDH_MENU_HELPKEYBOARD
+#define HELPID_HELPSEARCH IDH_MENU_HELPSEARCH
+#define HELPID_HELPCOMMANDS IDH_MENU_HELPCOMMANDS
+#define HELPID_HELPPROCEDURES IDH_MENU_HELPPROCEDURES
+#define HELPID_HELPUSINGHELP IDH_MENU_HELPUSINGHELP
+#define HELPID_HELPABOUTNOSTRADOMUS IDH_MENU_HELPABOUTNOSTRADOMUS
+
+#define HELPID_DIALOGABOUT IDH_DB_ABOUT
+#define HELPID_DIALOGSELECTADVANCED IDH_DB_SELECTADVANCED
+#define HELPID_DIALOGSELECTSAVE IDH_DB_SELECTSAVE
+#define HELPID_DIALOGSELECTUSE IDH_DB_SELECTUSE
+#define HELPID_DIALOGSELECTDELETE IDH_DB_SELECTDELETE
+#define HELPID_DIALOGADVRESTORE IDH_DB_ADVRESTORE
+#define HELPID_DIALOGJOBEDIT IDH_DB_JOBEDIT
+#define HELPID_DIALOGJOBNEW IDH_DB_JOBNEW
+#define HELPID_DIALOGJOBMAINTENANCE IDH_DB_JOBMAINTENANCE
+#define HELPID_DIALOGJOBOPTS IDH_DB_JOBOPTS
+#define HELPID_DIALOGJOBSCHEDULE IDH_DB_JOBSCHEDULE
+#define HELPID_DIALOGSCHEDOPTS IDH_DB_SCHEDOPTS
+#define HELPID_DIALOGSETTINGSOPTIONS IDH_DB_SETTINGSOPTIONS
+#define HELPID_DIALOGSETTINGSBACKUP IDH_DB_SETTINGSBACKUP
+#define HELPID_DIALOGSETTINGSRESTORE IDH_DB_SETTINGSRESTORE
+#define HELPID_DIALOGSETTINGSLOGGING IDH_DB_SETTINGSLOGGING
+#define HELPID_DIALOGSETTINGSNETWORK IDH_DB_SETTINGSNETWORK
+#define HELPID_DIALOGSETTINGSCATALOG IDH_DB_SETTINGSCATALOG
+#define HELPID_DIALOGSETTINGSHARDWARE IDH_DB_SETTINGSHARDWARE
+#define HELPID_DIALOGSETTINGSDEBUG IDH_DB_SETTINGSDEBUG
+#define HELPID_DIALOGLOGINPSWD IDH_DB_LOGINPSWD
+#define HELPID_DIALOGSEARCHTAPE IDH_DB_SEARCHTAPE
+#define HELPID_DIALOGPRINTERSETUP IDH_DB_PRINTERSETUP
+#define HELPID_DIALOGPRINT IDH_DB_PRINT
+#define HELPID_DIALOGCATMAINT IDH_DB_CATMAINT
+#define HELPID_DIALOGCATTAPE IDH_DB_CATTAPE
+#define HELPID_DIALOGTAPEPSWD IDH_DB_TAPEPSWD
+#define HELPID_DIALOGLANTAPEPSWD IDH_DB_LANTAPEPSWD
+#define HELPID_DIALOGJOBPROGRAMITEM IDH_DB_JOBPROGRAMITEM
+#define HELPID_DIALOGBACKUPSET IDH_DB_BACKUPSET
+#define HELPID_DIALOGRESTORESET IDH_DB_RESTORESET
+#define HELPID_DIALOGVERIFYSET IDH_DB_VERIFYSET
+#define HELPID_DIALOGREENTERPASSWORD IDH_DB_REENTERPASSWORD
+#define HELPID_DIALOGSKIPOPEN IDH_DB_SKIPOPEN
+#define HELPID_DIALOGFILEREPLACE IDH_DB_FILEREPLACE
+#define HELPID_DIALOGERASE IDH_DB_ERASE
+#define HELPID_DIALOGRUNTIME IDH_DB_STATUS
+#define HELPID_DIALOGTENSION IDH_DB_TENSION
+#define HELPID_DIALOGNEXTSET IDH_DB_NEXTSET
+#define HELPID_DIALOGPWDBPASSWORD IDH_DB_PWDBPASSWORD
+#define HELPID_DIALOGTRANSFER IDH_DB_TRANSFER
+#define HELPID_DIALOGFORMAT IDH_DB_FORMAT
+
+// Defines for the three topics for the launcher.
+
+#define HELPID_LAUNCHMAINSCREEN IDH_LAUNCHMAINSCREEN
+#define HELPID_LAUNCHRUNDELAY IDH_LAUNCHRUNDELAY
+#define HELPID_LAUNCHSCHEDDELAY IDH_LAUNCHSCHEDDELAY
+
+#endif
diff --git a/private/utils/ntbackup/inc/ommenus.h b/private/utils/ntbackup/inc/ommenus.h
new file mode 100644
index 000000000..5e4b5e8d4
--- /dev/null
+++ b/private/utils/ntbackup/inc/ommenus.h
@@ -0,0 +1,105 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: ommenus.h
+
+ Description: This file contains the MENU IDs for the OEM Microsoft
+ version of the Maynstream GUI project.
+
+ $Log: G:/UI/LOGFILES/OMMENUS.H_V $
+
+ Rev 1.6 27 Apr 1993 11:49:36 GLENN
+Added SORT defines to prevent compiler error in VLM and DOCPROC.
+
+ Rev 1.5 10 Mar 1993 13:49:18 CARLS
+Changes for Format tape
+
+ Rev 1.4 04 Oct 1992 19:48:28 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 20 Aug 1992 08:58:10 GLENN
+Added operations catalog support.
+
+ Rev 1.2 10 Jun 1992 16:12:36 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.1 30 Apr 1992 14:40:50 DAVEV
+OEM_MSOFT: Fix View-All File Details
+
+ Rev 1.0 03 Mar 1992 12:25:30 DAVEV
+Initial revision.
+
+******************************************************************************/
+
+#ifndef MENUS_H_INCL // Do not allow multiple inclusions of this file
+#define MENUS_H_INCL
+
+
+#define WINDOWSMENUPOSITION 4 // position of Nostradamus window menu.
+#define JOBSMENUPOSITION 5 // position of the jobs menu
+#define JOBSMENUSEPARATORPOS 1 // position of the jobs menu job names separator
+
+// MENU ID RANGES
+
+#define MM_ID_MIN 1000
+#define MM_ID_MAX 2999
+
+#define IDM_WINDOWSFIRSTCHILD 2000 // menu ID of the first MDI Child
+
+// MENU ID's
+
+#define IDRM_MAINMENU ID(1)
+
+
+#define IDM_OPERATIONSBACKUP 1001
+#define IDM_OPERATIONSRESTORE 1002
+#define IDM_OPERATIONSCATALOG 1003
+#define IDM_OPERATIONSERASE 1004
+#define IDM_OPERATIONSRETENSION 1005
+#define IDM_OPERATIONSEJECT 1006
+#define IDM_OPERATIONSHARDWARE 1007
+#define IDM_OPERATIONSEXIT 1008
+#define IDM_OPERATIONSFORMAT 1009
+#define IDM_OPERATIONSEXCHANGE 1010
+
+#define IDM_TREEEXPANDONE 1020
+#define IDM_TREEEXPANDBRANCH 1021
+#define IDM_TREEEXPANDALL 1022
+#define IDM_TREECOLLAPSEBRANCH 1023
+
+#define IDM_VIEWTREEANDDIR 1030
+#define IDM_VIEWTREEONLY 1031
+#define IDM_VIEWDIRONLY 1032
+#define IDM_VIEWNAMEONLY 1033
+#define IDM_VIEWALLFILEDETAILS 1034
+#define IDM_VIEWSTATUS 1035
+#define IDM_VIEWURIBBON 1036
+#define IDM_VIEWFONT 1037
+#define IDM_VIEWSPLIT 1038
+#define IDM_VIEWSORTNAME 1039
+#define IDM_VIEWSORTTYPE 1040
+#define IDM_VIEWSORTSIZE 1041
+#define IDM_VIEWSORTDATE 1042
+
+#define IDM_SELECTCHECK 1050
+#define IDM_SELECTUNCHECK 1051
+
+#define IDM_WINDOWSCASCADE 1080
+#define IDM_WINDOWSTILE 1081
+#define IDM_WINDOWSARRANGEICONS 1082
+#define IDM_WINDOWSREFRESH 1083
+#define IDM_WINDOWSCLOSEALL 1084
+
+#define IDM_HELPINDEX 1090
+#define IDM_HELPSEARCH 1091
+#define IDM_HELPKEYBOARD 1092
+#define IDM_HELPCOMMANDS 1093
+#define IDM_HELPPROCEDURES 1094
+#define IDM_HELPUSINGHELP 1095
+#define IDM_HELPABOUTNOSTRADOMUS 1096
+
+
+#endif // MENUS_H_INCL
+
diff --git a/private/utils/ntbackup/inc/omrset.h b/private/utils/ntbackup/inc/omrset.h
new file mode 100644
index 000000000..6a3a74b3f
--- /dev/null
+++ b/private/utils/ntbackup/inc/omrset.h
@@ -0,0 +1,97 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: rset.h
+
+ Description: include file for the rset.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/OMRSET.H_V $
+
+ Rev 1.5 08 Mar 1993 15:49:22 DARRYLP
+Brought the IDD_RSET_BINDERY define back in.
+
+ Rev 1.4 04 Oct 1992 19:48:30 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 03 Sep 1992 10:51:12 CHUCKB
+Added IDD_RSET_REGISTRY.
+
+ Rev 1.2 19 Aug 1992 14:21:44 CHUCKB
+Added id's for new controls.
+
+ Rev 1.1 20 Mar 1992 12:41:48 DAVEV
+Changes for OEM_MSOFT product alternate functionality
+
+ Rev 1.0 18 Mar 1992 14:39:04 DAVEV
+Initial revision.
+
+ Rev 1.0 18 Mar 1992 14:37:44 DAVEV
+alternate OEM_MSOFT dialog header
+
+ Rev 1.1 06 Feb 1992 10:10:52 CARLS
+added ID for security info
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef RSET_H
+#define RSET_H
+
+#define IDM_RESTORESET 303
+#define IDM_VERIFYSET 304
+#define IDD_RSET_INFO_TAPE 305
+
+#define IDD_RSET_INFO_TITLE 101
+#define IDD_RSET_NEXT_BUTTON 102
+#define IDD_RSET_TAPE_NAME 103
+#define IDD_RSET_PREV_BUTTON 104
+#define IDD_RSET_DRIVE_BOX 105
+#define IDD_RSET_RESTORE_PATH 110
+#define IDD_RSET_VERIFY_AFTER 106
+#define IDD_RSET_BINDERY 107
+#define IDD_RSET_CANCEL_BUTTON 109
+#define IDD_RSET_DRIVE_TEXT 111
+#define IDD_RSET_SET_TEXT 112
+#define IDD_RSET_PATH_TEXT 113
+#define IDD_RSET_TAPE_NAME_TEXT 114
+#define IDD_RSET_SCROLLBAR 115
+#define IDD_RSET_SET_LINE_1 116
+#define IDD_RSET_SET_LINE_2 117
+#define IDD_RSET_SET_LINE_3 118
+#define IDD_RSET_OK_BUTTON 119
+#define IDD_RSET_SET_INFO 120
+#define IDD_RSET_HELP_BUTTON 121
+#define IDD_RSET_BROWSE_BUTTON 122
+#define IDD_RSET_SECURITY_INFO 123
+#define IDD_RSET_LOG_FILENAME 124
+#define IDD_RSET_LOG_BROWSE 125
+/* Note: the following radio button id's MUST BE CONSECUTIVE! */
+#define IDD_RSET_LOG_FULL 126
+#define IDD_RSET_LOG_SUMMARY 127
+#define IDD_RSET_LOG_NONE 128
+
+#define IDD_RSET_REGISTRY 129
+
+#define IDD_RSET_CREATION_DATE 130
+#define IDD_RSET_OWNERS_NAME 131
+
+/* The following controls are for Exchange backups */
+#define IDD_RSET_DEST_NAME 132
+#define IDD_RSET_DEST_TEXT 133
+
+/* These have to be consecutive */
+#define IDD_RSET_ORG_TEXT 134
+#define IDD_RSET_WIPE_DATA 135
+
+#define IDD_RSET_PRIV_IS 136
+#define IDD_RSET_PUB_IS 137
+#define IDD_RSET_ORG_NAME 138
+#define IDD_RSET_DSA_DEST_NAME 139
+#define IDD_RSET_START_EMS 140
+
+#define IDD_RSET_DS_DEST_TEXT 141
+#endif
diff --git a/private/utils/ntbackup/inc/omstring.h b/private/utils/ntbackup/inc/omstring.h
new file mode 100644
index 000000000..0013bbb2b
--- /dev/null
+++ b/private/utils/ntbackup/inc/omstring.h
@@ -0,0 +1,1033 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: omstring.h
+
+ Description: This file contains the STRING IDs for the Microsoft OEM
+ GUI project for NT.
+
+ This file was created by copying and modifying
+ STRINGS.H from the standard Maynstream GUI project.
+
+ $Log: G:/UI/LOGFILES/OMSTRING.H_V $
+
+ Rev 1.42 04 Mar 1994 17:36:02 STEVEN
+prompt if disk full
+
+ Rev 1.41 06 Jan 1994 16:12:12 GREGG
+Added extended error reporting string defines.
+
+ Rev 1.40 01 Dec 1993 14:13:36 mikep
+add SQL recognition support to poll drive
+
+ Rev 1.39 26 Oct 1993 18:09:42 BARRY
+Added backupRegistry option
+
+ Rev 1.38 16 Aug 1993 13:47:56 BARRY
+Added new strings to bring Nostradamus to UI tips.
+
+ Rev 1.37 29 Jun 1993 17:34:48 GLENN
+Added new style about box support.
+
+ Rev 1.36 25 May 1993 14:57:08 GLENN
+Added IDS_VLMDRIVESMSG.
+
+ Rev 1.35 21 May 1993 18:13:00 KEVINS
+Added browse strings.
+
+ Rev 1.34 05 May 1993 10:44:40 MIKEP
+cd ..\res
+add message for trying to catalog with full hard drive.
+
+ Rev 1.33 16 Apr 1993 14:33:42 MIKEP
+add tape drive name
+
+ Rev 1.32 16 Apr 1993 09:47:58 MIKEP
+add stings for cataloging
+
+ Rev 1.31 13 Mar 1993 16:26:28 MIKEP
+foreign tape prompt
+
+ Rev 1.30 12 Mar 1993 14:46:50 CARLS
+changes for format tape
+
+ Rev 1.29 10 Mar 1993 12:53:12 CARLS
+Changes to move Format tape to the Operations menu
+
+ Rev 1.28 03 Mar 1993 14:15:14 DARRYLP
+Added read only drive strings.
+
+ Rev 1.27 18 Feb 1993 13:32:20 BURT
+Changes for Cayman
+
+
+ Rev 1.26 09 Feb 1993 09:37:28 chrish
+Added string for abort title during backup and restore operation.
+
+ Rev 1.25 18 Jan 1993 14:46:04 GLENN
+Added Stream Error Reporting Strings and IDs.
+
+ Rev 1.24 06 Jan 1993 15:10:16 chrish
+Added constants for new security strings.
+
+ Rev 1.23 17 Nov 1992 20:02:04 MIKEP
+add unformat display
+
+ Rev 1.22 13 Nov 1992 17:43:46 chrish
+Added some stuff for Tape Security - NT.
+
+ Rev 1.21 15 Oct 1992 13:03:52 DAVEV
+fix problem with batch mode /T option
+
+ Rev 1.20 09 Oct 1992 13:20:48 MIKEP
+add daily copy
+
+ Rev 1.19 04 Oct 1992 19:48:34 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.18 18 Sep 1992 08:15:38 STEVEN
+fix IDs from steve's last change
+
+ Rev 1.17 17 Sep 1992 16:52:38 STEVEN
+added support for daily backup
+
+ Rev 1.16 04 Sep 1992 18:09:44 CHUCKB
+Added new id's, etc., for sales pitch string.
+
+ Rev 1.15 26 Aug 1992 14:58:38 DAVEV
+Event Logging
+
+ Rev 1.14 24 Aug 1992 15:36:10 DAVEV
+string ids for event logging
+
+ Rev 1.13 20 Aug 1992 08:27:36 GLENN
+Added catalog and about box string support.
+
+ Rev 1.12 23 Jun 1992 17:36:34 DAVEV
+added ids from strings.h
+
+ Rev 1.11 11 Jun 1992 13:36:10 STEVEN
+fix define for OMEVENT... to OEMEVENT...
+
+ Rev 1.10 11 Jun 1992 11:00:14 GLENN
+Removed MEMORYTRACE references.
+
+ Rev 1.9 05 Jun 1992 12:49:12 DAVEV
+Added default log file name strings
+
+ Rev 1.8 28 May 1992 11:17:30 DAVEV
+added IDS_OEMEVENT_SOURCE_NAME
+
+ Rev 1.7 15 May 1992 13:37:40 MIKEP
+added conglomerate
+
+ Rev 1.6 11 May 1992 14:27:00 DAVEV
+Batch command line option strings added
+
+ Rev 1.5 23 Apr 1992 10:12:20 DAVEV
+added strings from strings.h
+
+ Rev 1.4 27 Mar 1992 11:57:34 DAVEV
+Added new ids from WinterPark.
+
+ Rev 1.3 25 Mar 1992 17:01:26 chrish
+Added new strings id's from WinterPark strings.h
+
+ Rev 1.2 20 Mar 1992 12:40:54 DAVEV
+Changes for OEM_MSOFT product alternate functionality
+
+ Rev 1.1 11 Mar 1992 17:04:54 DAVEV
+integrated winterpark strings.h changes
+
+ Rev 1.0 03 Mar 1992 12:25:32 DAVEV
+Initial revision.
+
+******************************************************************************/
+
+#ifndef STRINGS_H_INCL // Do not allow multiple inclusions of this file
+#define STRINGS_H_INCL
+
+
+// STRING RESOURCE IDs -- RANGE: 1 - 32000
+
+#define IDS_APPNAME 1
+#define IDS_EXEFILENAME 2
+#define IDS_INIFILENAME 3
+#define IDS_PWDFILENAME 4
+
+#define IDS_CANTOPEN 5
+#define IDS_CANTREAD 6
+#define IDS_CANTCREATE 7
+#define IDS_CANTWRITE 8
+#define IDS_ILLFNM 9
+#define IDS_ADDEXT 10
+#define IDS_CLOSESAVE 11
+#define IDS_CANTFIND 12
+#define IDS_HELPNOTAVAIL 13
+#define IDS_CANTCLOSE 14
+#define IDS_CLIENTTITLE 16
+#define IDS_UNTITLED 17
+#define IDS_STDMODEWARNING 18
+#define IDS_APPVERSION 19
+#define IDS_STARTUPTEXT 20
+#define IDS_COPYRIGHT 21
+#define IDS_COMPANY 22
+#define IDS_APPMSGNAME 23
+#define IDS_APPEXEVER 24
+#define IDS_APPRESVER 25
+#define IDS_APPENGREL 26
+#define IDS_CONGLOMERATE 27
+#define IDS_SALESPITCH 28
+#define IDS_LONGAPPNAME 29
+
+#define IDS_BADUSERDATAPATH 30
+#define IDS_BADCATDATAPATH 31
+
+#define IDS_UNDERSCOREMARKER 32
+#define IDS_FONTHELV 33
+#define IDS_FONTSYSTEM 34
+#define IDS_FONTCOURIER 35
+
+#define IDS_BADRESVER 40
+#define IDS_NORESFILE 41
+
+
+// STATUS LINE TEXT RANGE IS 50 to 99
+
+#define IDS_READY 50 // STATUS LINE text IDs
+#define IDS_INITIALIZING 51
+#define IDS_BACKINGUP 52
+#define IDS_TRANSFERRING 53
+#define IDS_RESTORING 54
+#define IDS_VERIFYING 55
+#define IDS_RETENSIONING 56
+#define IDS_ERASING 57
+#define IDS_CATALOGING 58
+#define IDS_REWINDING 59
+#define IDS_EJECTING 60
+#define IDS_INITFILESYS 61
+#define IDS_INITHARDWARE 62
+#define IDS_DIRSCANNED 63
+#define IDS_CATMAINT 64
+#define IDS_NEXTSETTING 65
+#define IDS_INITCATALOGS 66
+#define IDS_INITUI 67
+#define IDS_FORMATING 68
+
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//
+// DO NOT EVER CHANGE THE ID NUMBERING BELOW 100.
+// BELOW 100 CONTAINS STRINGS THAT WILL NEVER CHANGE FROM VERSION
+// TO VERSION, THIS IS WHERE ALL VERSION STAMPS ARE KEPT FOR ALL
+// FUTURE RELEASES.
+//
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+// RIBBON TEXT RANGE IS 300 to 399
+
+#define IDS_RIB_BACKUP 300 // RIBBON text IDs
+#define IDS_RIB_RESTORE 301
+#define IDS_RIB_ERASE 302
+#define IDS_RIB_RETENSION 303
+#define IDS_RIB_JOBSTATUS 304
+#define IDS_RIB_CHECK 305
+#define IDS_RIB_UNCHECK 306
+#define IDS_RIB_MODIFIED 307
+#define IDS_RIB_ADVANCED 308
+#define IDS_RIB_UNDO 309
+#define IDS_RIB_INCLUDE 310
+#define IDS_RIB_EXCLUDE 311
+#define IDS_RIB_TRANSFER 312
+#define IDS_RIB_VERIFY 313
+#define IDS_RIB_CATALOG 314
+#define IDS_RIB_SEARCH 315
+#define IDS_RIB_NEXTSET 316
+#define IDS_RIB_EJECT 317
+#define IDS_RIB_REWIND 318
+#define IDS_RIB_EXIT 319
+
+#define IDS_RIB_MEMDEBUG 350
+#define IDS_RIB_STATLINE 351
+
+/* BUTTON TEXT RANGE IS 400 to 410 */
+
+#define IDS_BUT_OK 400
+#define IDS_BUT_CANCEL (IDS_BUT_OK+1)
+#define IDS_BUT_RETRY (IDS_BUT_CANCEL+1)
+#define IDS_BUT_YES (IDS_BUT_RETRY+1)
+#define IDS_BUT_NO (IDS_BUT_YES+1)
+#define IDS_BUT_CONTINUE (IDS_BUT_NO+1)
+#define IDS_BUT_ABORT (IDS_BUT_CONTINUE+1)
+#define IDS_BUT_HELP (IDS_BUT_ABORT+1)
+#define IDS_BUT_DISABLE (IDS_BUT_HELP+1)
+#define IDS_BUT_IGNORE (IDS_BUT_DISABLE+1)
+
+// MENU STRING RANGE is 1000 to 2999
+
+#define IDS_OPERATIONSBACKUP (IDM_OPERATIONSBACKUP)
+#define IDS_OPERATIONSRESTORE (IDM_OPERATIONSRESTORE)
+#define IDS_OPERATIONSCATALOG (IDM_OPERATIONSCATALOG)
+#define IDS_OPERATIONSERASE (IDM_OPERATIONSERASE)
+#define IDS_OPERATIONSRETENSION (IDM_OPERATIONSRETENSION)
+#define IDS_OPERATIONSEJECT (IDM_OPERATIONSEJECT)
+#define IDS_OPERATIONSHARDWARE (IDM_OPERATIONSHARDWARE)
+#define IDS_OPERATIONSEXIT (IDM_OPERATIONSEXIT)
+#define IDS_OPERATIONSFORMAT (IDM_OPERATIONSFORMAT)
+#define IDS_OPERATIONSEXCHANGE (IDM_OPERATIONSEXCHANGE)
+
+#define IDS_TREEEXPANDONE (IDM_TREEEXPANDONE)
+#define IDS_TREEEXPANDBRANCH (IDM_TREEEXPANDBRANCH)
+#define IDS_TREEEXPANDALL (IDM_TREEEXPANDALL)
+#define IDS_TREECOLLAPSEBRANCH (IDM_TREECOLLAPSEBRANCH)
+
+#define IDS_VIEWTREEANDDIR (IDM_VIEWTREEANDDIR)
+#define IDS_VIEWTREEONLY (IDM_VIEWTREEONLY)
+#define IDS_VIEWDIRONLY (IDM_VIEWDIRONLY)
+#define IDS_VIEWALLFILEDETAILS (IDM_VIEWALLFILEDETAILS)
+#define IDS_VIEWSTATUS (IDM_VIEWSTATUS)
+#define IDS_VIEWURIBBON (IDM_VIEWURIBBON)
+#define IDS_VIEWSPLIT (IDM_VIEWSPLIT)
+#define IDS_VIEWFONT (IDM_VIEWFONT)
+
+#define IDS_SELECTCHECK (IDM_SELECTCHECK)
+#define IDS_SELECTUNCHECK (IDM_SELECTUNCHECK)
+#define IDS_SELECTADVANCED (IDM_SELECTADVANCED)
+
+#define IDS_WINDOWSCASCADE (IDM_WINDOWSCASCADE)
+#define IDS_WINDOWSTILE (IDM_WINDOWSTILE)
+#define IDS_WINDOWSREFRESH (IDM_WINDOWSREFRESH)
+#define IDS_WINDOWSCLOSEALL (IDM_WINDOWSCLOSEALL)
+#define IDS_WINDOWSARRANGEICONS (IDM_WINDOWSARRANGEICONS)
+
+#define IDS_HELPINDEX (IDM_HELPINDEX)
+#define IDS_HELPSEARCH (IDM_HELPSEARCH)
+#define IDS_HELPKEYBOARD (IDM_HELPKEYBOARD)
+#define IDS_HELPCOMMANDS (IDM_HELPCOMMANDS)
+#define IDS_HELPPROCEDURES (IDM_HELPPROCEDURES)
+#define IDS_HELPUSINGHELP (IDM_HELPUSINGHELP)
+#define IDS_HELPABOUTNOSTRADOMUS (IDM_HELPABOUTNOSTRADOMUS)
+
+// DEFINES for the RUNTIME DIALOGS
+
+#define IDS_DLGTITLESTART 500
+#define IDS_DLGTITLEJOBSTATBACKUP (IDS_DLGTITLESTART+0)
+#define IDS_DLGTITLEJOBSTATRESTORE (IDS_DLGTITLESTART+1)
+#define IDS_DLGTITLEJOBSTATTRANSFER (IDS_DLGTITLESTART+2)
+#define IDS_DLGTITLEJOBSTATVERIFY (IDS_DLGTITLESTART+3)
+#define IDS_DLGTITLEJOBSTATCATALOG (IDS_DLGTITLESTART+4)
+#define IDS_DLGTITLEJOBSTATTENSION (IDS_DLGTITLESTART+5)
+#define IDS_DLGTITLEJOBSTATERASE (IDS_DLGTITLESTART+6)
+#define IDS_DLGTITLEJOBSTATDELETE (IDS_DLGTITLESTART+7)
+#define IDS_DLGTITLEJOBSTATFORMAT (IDS_DLGTITLESTART+8)
+
+// DEFINES for the HELP MANAGER
+
+#define IDS_HMSTART 510
+#define IDS_HMHELPFILENAME (IDS_HMSTART+0)
+#define IDS_HMKEYWORDKEYS (IDS_HMSTART+1)
+#define IDS_HMKEYWORDCOMMANDS (IDS_HMSTART+2)
+#define IDS_HMKEYWORDPROCS (IDS_HMSTART+3)
+#define IDS_HMUSINGHELPFILENAME (IDS_HMSTART+4)
+#define IDS_HMNOHELPFILE (IDS_HMSTART+5)
+
+// Defines for About
+
+#define IDS_ABOUT_ENHANCED_MODE 520
+#define IDS_ABOUT_STANDARD_MODE (IDS_ABOUT_ENHANCED_MODE+1)
+#define IDS_ABOUT_MEMORY (IDS_ABOUT_ENHANCED_MODE+2)
+#define IDS_ABOUT_MEM_FORMAT (IDS_ABOUT_ENHANCED_MODE+3)
+#define IDS_ABOUT_RESOURCES (IDS_ABOUT_ENHANCED_MODE+4)
+#define IDS_ABOUT_RES_FORMAT (IDS_ABOUT_ENHANCED_MODE+5)
+#define IDS_APPTEXTSTRING (IDS_ABOUT_ENHANCED_MODE+6)
+#define IDS_LICENSEINFOKEY (IDS_ABOUT_ENHANCED_MODE+7)
+#define IDS_CURRENTVERSION (IDS_ABOUT_ENHANCED_MODE+8)
+#define IDS_REGUSER (IDS_ABOUT_ENHANCED_MODE+9)
+#define IDS_REGORGANIZATION (IDS_ABOUT_ENHANCED_MODE+10)
+#define IDS_VERSIONMSG (IDS_ABOUT_ENHANCED_MODE+11)
+#define IDS_DEBUG (IDS_ABOUT_ENHANCED_MODE+12)
+#define IDS_PROCESSORINFOKEY (IDS_ABOUT_ENHANCED_MODE+13)
+#define IDS_PROCESSORIDENTIFIER (IDS_ABOUT_ENHANCED_MODE+14)
+#define IDS_IDENTIFIERIDENTIFIER (IDS_ABOUT_ENHANCED_MODE+15)
+#define IDS_PRODUCTIDINFOKEY (IDS_ABOUT_ENHANCED_MODE+16)
+#define IDS_PRODUCTIDENTIFIER (IDS_ABOUT_ENHANCED_MODE+17)
+
+// defines for launcher
+
+#define IDS_LCHAPPNAME 540
+#define IDS_LCHEXITAPP (IDS_LCHAPPNAME+1)
+#define IDS_LCHDELAYTITLE (IDS_LCHEXITAPP+1)
+#define IDS_LCHEXECUTIONERROR (IDS_LCHDELAYTITLE+1)
+#define IDS_LCHCANNOTEXECUTE (IDS_LCHEXECUTIONERROR+1)
+#define IDS_LCHONHOLD (IDS_LCHCANNOTEXECUTE+1)
+#define IDS_LCHACTIVE (IDS_LCHONHOLD+1)
+#define IDS_LCHTOOMANYCLOCKS (IDS_LCHACTIVE+1)
+#define IDS_LCHRUNNING (IDS_LCHTOOMANYCLOCKS+1)
+#define IDS_LCHABORTED (IDS_LCHRUNNING+1)
+#define IDS_LCHDELAYED (IDS_LCHABORTED+1)
+#define IDS_LCHMISSED (IDS_LCHDELAYED+1)
+#define IDS_LCHSKIPMSG (IDS_LCHMISSED+1)
+
+#define IDS_RESTOREPATHINVALID 560
+#define IDS_DONT_SPECIFY_DRIVE (IDS_RESTOREPATHINVALID+1)
+#define IDS_DONT_SPECIFY_FNAME (IDS_DONT_SPECIFY_DRIVE+1)
+#define IDS_RESTOREEMSSERVERINVALID (IDS_DONT_SPECIFY_FNAME+1)
+#define IDS_RESTOREEMSNOWIPE (IDS_RESTOREEMSSERVERINVALID +1)
+#define IDS_RESTOREEMSWARNING (IDS_RESTOREEMSNOWIPE +1)
+#define IDS_RESTORESTOPEXCHANGE (IDS_RESTOREEMSWARNING +1)
+#define IDS_RESTORESTARTEXCHANGE (IDS_RESTORESTOPEXCHANGE +1)
+#define IDS_STARTEXCHANGE (IDS_RESTORESTARTEXCHANGE +1)
+#define IDS_RESTOREBEGINEXCHANGE (IDS_STARTEXCHANGE+1)
+#define RES_EMS_COMM_FAILURE (IDS_RESTOREBEGINEXCHANGE+1)
+#define RES_EMS_BKU_ACCESS_FAILURE (RES_EMS_COMM_FAILURE+1)
+#define RES_EMS_RST_ACCESS_FAILURE (RES_EMS_BKU_ACCESS_FAILURE+1)
+#define IDS_EMS_MUST_PUB_OR_PRI ( RES_EMS_RST_ACCESS_FAILURE +1)
+#define IDS_EMS_NO_DEST_DRIVE ( IDS_EMS_MUST_PUB_OR_PRI +1)
+#define IDS_EMS_CIRC_LOGS_DS ( IDS_EMS_NO_DEST_DRIVE +1)
+#define IDS_EMS_CIRC_LOGS_IS ( IDS_EMS_CIRC_LOGS_DS +1)
+#define IDS_EMS_NO_INC_DS_BACKUP ( IDS_EMS_CIRC_LOGS_IS +1)
+#define IDS_EMS_NO_INC_IS_BACKUP ( IDS_EMS_NO_INC_DS_BACKUP +1)
+#define IDS_EMS_NOT_RESPONDING_DS ( IDS_EMS_NO_INC_IS_BACKUP +1)
+#define IDS_EMS_NOT_RESPONDING_IS ( IDS_EMS_NOT_RESPONDING_DS +1)
+
+#define IDS_BACKUP_TYPE ( IDS_EMS_NOT_RESPONDING_IS +1)
+#define IDS_WIPE_SPECIFIED ( IDS_BACKUP_TYPE +1)
+#define IDS_RESTOREEMSMUSTWIPE ( IDS_WIPE_SPECIFIED +1)
+#define IDS_EMS_NO_PUBLIC_SERVICE ( IDS_RESTOREEMSMUSTWIPE +1)
+#define IDS_EMS_NO_PRIVATE_SERVICE ( IDS_EMS_NO_PUBLIC_SERVICE +1)
+
+// DEFINES FOR CREATING/EDITING/SCHEDULING JOBS
+
+#define IDS_JOBS_START 600
+
+#define IDS_JOBWARNING (IDS_JOBS_START+0)
+#define IDS_SCHWARNING (IDS_JOBS_START+1)
+#define IDS_JOBAREYOUSURE (IDS_JOBS_START+2)
+#define IDS_SCHAREYOUSURE (IDS_JOBS_START+3)
+#define IDS_NOJOBSELECTED (IDS_JOBS_START+4)
+#define IDS_PLSSELECTJOBRUN (IDS_JOBS_START+5)
+#define IDS_PLSSELECTJOBEDIT (IDS_JOBS_START+6)
+#define IDS_NEWJOBCAPTION (IDS_JOBS_START+7)
+#define IDS_JOBNAMEINUSE (IDS_JOBS_START+8)
+#define IDS_NOMORESPACE (IDS_JOBS_START+9)
+#define IDS_JOBNOTINLIST (IDS_JOBS_START+10)
+#define IDS_JOBNAMENOTVALID (IDS_JOBS_START+11)
+#define IDS_PLSSELECTVALIDJOB (IDS_JOBS_START+12)
+#define IDS_PLSENTERVALIDJOB (IDS_JOBS_START+13)
+#define IDS_EDITJOB (IDS_JOBS_START+14)
+
+// DEFINES FOR JOB OPERATIONS
+
+#define IDS_OPERATIONBACKUP (IDS_JOBS_START+15)
+#define IDS_OPERATIONTRANSFER (IDS_JOBS_START+16)
+
+// DEFINES FOR JOB PROCESSING
+
+#define IDS_JOBPROGMAN 620
+#define IDS_JOBPMGROUP (IDS_JOBPROGMAN+1)
+#define IDS_JOBDEFAULTGROUP (IDS_JOBPMGROUP+1)
+#define IDS_JOBNOPROGMAN (IDS_JOBDEFAULTGROUP+1)
+#define IDS_JOBPROGMANTITLE (IDS_JOBNOPROGMAN+1)
+#define IDS_JOBPROGMANCONFIRM (IDS_JOBPROGMANTITLE+1)
+#define IDS_JOBPROGMANFORMATLINE (IDS_JOBPROGMANCONFIRM+1)
+#define IDS_JOBFILENAME (IDS_JOBPROGMANFORMATLINE+1)
+#define IDS_JOBPROGMANCREATEGROUP (IDS_JOBFILENAME+1)
+#define IDS_JOBBACKUPICONVALUE (IDS_JOBPROGMANCREATEGROUP+1)
+#define IDS_JOBTRANSFERICONVALUE (IDS_JOBBACKUPICONVALUE+1)
+#define IDS_JOBRESTOREICONVALUE (IDS_JOBTRANSFERICONVALUE+1)
+#define IDS_JOBCOMMANDLINE (IDS_JOBRESTOREICONVALUE+1)
+#define IDS_JOBSTARTEDLOGMSG (IDS_JOBCOMMANDLINE+1)
+#define IDS_JOBFINISHEDLOGMSG (IDS_JOBSTARTEDLOGMSG+1)
+#define IDS_JOBNOTFOUNDLOGMSG (IDS_JOBFINISHEDLOGMSG+1)
+#define IDS_JOBMOREJOBS (IDS_JOBNOTFOUNDLOGMSG+1)
+#define IDS_JOBSCHEDULEDJOB (IDS_JOBMOREJOBS+1)
+#define IDS_JOBEXECERROR (IDS_JOBSCHEDULEDJOB+1)
+#define IDS_JOBWRONGMETHOD (IDS_JOBEXECERROR+1)
+
+// defines for automatic jobs (to go with verify.bks and skipped.bks)
+
+#define IDS_VERIFY_JOBNAME 640
+#define IDS_SKIPPED_JOBNAME (IDS_VERIFY_JOBNAME+1)
+
+#ifdef CAYMAN
+#define IDS_FULLBACKUP_JOBNAME (IDS_VERIFY_JOBNAME+2)
+#define IDS_INCBACKUP_JOBNAME (IDS_VERIFY_JOBNAME+3)
+#define IDS_DIFFBACKUP_JOBNAME (IDS_VERIFY_JOBNAME+4)
+#define IDS_FM_SCRIPTNAME (IDS_VERIFY_JOBNAME+5)
+#define IDS_FM_APPEND_JOBNAME (IDS_VERIFY_JOBNAME+6)
+#define IDS_FM_REPLACE_JOBNAME (IDS_VERIFY_JOBNAME+7)
+#endif
+
+// define for selection file not found/valid by job
+
+#define IDS_JOB_SELNOTFOUNDLOGMSG (IDS_SKIPPED_JOBNAME+1)
+#define IDS_JOB_SELNOTVALIDLOGMSG (IDS_JOB_SELNOTFOUNDLOGMSG+1)
+
+// defines for Schedule processing
+
+#define IDS_SCHEXTENSION 650
+#define IDS_SCHFILENAME (IDS_SCHEXTENSION+1)
+#define IDS_SCHCOMMANDLINE (IDS_SCHFILENAME+1)
+#define IDS_SCHUNIQUEKEY (IDS_SCHCOMMANDLINE+1)
+
+// defines for Job/Schedule error messages
+
+#define IDS_JOBIOERR 700
+#define IDS_SCHEDULEIOERR (IDS_JOBIOERR+1)
+#define IDS_JOBISSCHEDULED (IDS_JOBIOERR+2)
+
+// SCHEDULER Errors with days/times/time intervals
+
+#define IDS_SCH_ERRORS_START 710
+
+#define IDS_NODAYCHECKED (IDS_SCH_ERRORS_START+0)
+#define IDS_PLSSELECTDAY (IDS_SCH_ERRORS_START+1)
+#define IDS_NOWEEKCHECKED (IDS_SCH_ERRORS_START+2)
+#define IDS_PLSSELECTWEEK (IDS_SCH_ERRORS_START+3)
+#define IDS_FILENAMENOTVALID (IDS_SCH_ERRORS_START+4)
+#define IDS_INTERVALNOTVALID (IDS_SCH_ERRORS_START+5)
+
+
+// defines for days of the week
+
+#define IDS_MONDAY 750
+#define IDS_TUESDAY (IDS_MONDAY+1)
+#define IDS_WEDNESDAY (IDS_TUESDAY+1)
+#define IDS_THURSDAY (IDS_WEDNESDAY+1)
+#define IDS_FRIDAY (IDS_THURSDAY+1)
+#define IDS_SATURDAY (IDS_FRIDAY+1)
+#define IDS_SUNDAY (IDS_SATURDAY+1)
+#define IDS_DAYOFTHEWEEK (IDS_SUNDAY+1)
+
+// and defines for days of the week hot keys
+
+#define IDS_MONDAYKEY (IDS_DAYOFTHEWEEK+1)
+#define IDS_TUESDAYKEY (IDS_DAYOFTHEWEEK+2)
+#define IDS_WEDNESDAYKEY (IDS_DAYOFTHEWEEK+3)
+#define IDS_THURSDAYKEY (IDS_DAYOFTHEWEEK+4)
+#define IDS_FRIDAYKEY (IDS_DAYOFTHEWEEK+5)
+#define IDS_SATURDAYKEY (IDS_DAYOFTHEWEEK+6)
+#define IDS_SUNDAYKEY (IDS_DAYOFTHEWEEK+7)
+
+// Weeks of the month
+
+#define IDS_FIRSTWEEK (IDS_SUNDAYKEY+1)
+#define IDS_SECONDWEEK (IDS_SUNDAYKEY+2)
+#define IDS_THIRDWEEK (IDS_SUNDAYKEY+3)
+#define IDS_FOURTHWEEK (IDS_SUNDAYKEY+4)
+#define IDS_LASTWEEK (IDS_SUNDAYKEY+5)
+#define IDS_WEEKOFTHEMONTH (IDS_SUNDAYKEY+6)
+
+// Backup set description dialog method text
+
+#define IDS_METHOD_NORMAL 780
+#define IDS_METHOD_COPY (IDS_METHOD_NORMAL+1)
+#define IDS_METHOD_INCREMENTAL (IDS_METHOD_NORMAL+2)
+#define IDS_METHOD_DIFFERENTIAL (IDS_METHOD_NORMAL+3)
+#define IDS_METHOD_DAILY (IDS_METHOD_NORMAL+4)
+
+#define IDS_DEFAULT_TAPE_NAME (IDS_METHOD_NORMAL+5)
+#define IDS_BKUP_PASSWORD_ERROR (IDS_METHOD_NORMAL+6)
+#define IDS_BKUP_SHORT_PASSWORD_ERROR (IDS_METHOD_NORMAL+7)
+#define IDS_BKUP_PASSWORD_ERROR_TITLE (IDS_METHOD_NORMAL+8)
+#define IDS_SET_INFORMATION (IDS_METHOD_NORMAL+9)
+#define IDS_NO_BSET_NAME (IDS_METHOD_NORMAL+10)
+
+// Erase dialog defines
+
+#define IDS_TAPE_PASSWORD_PROTECTED (IDS_METHOD_NORMAL+11)
+
+//
+// Tape Security for NT
+//
+
+#define IDS_BKUP_TAPE_SECURITY (IDS_METHOD_NORMAL+12)
+#define IDS_REST_TAPE_SECURITY (IDS_METHOD_NORMAL+13)
+#define IDS_TAPE_SECURITY_TITLE (IDS_METHOD_NORMAL+14)
+#define IDS_GENERAL_TAPE_SECURITY (IDS_METHOD_NORMAL+15)
+#define IDS_ERASE_TAPE_SECURITY (IDS_METHOD_NORMAL+16)
+#define IDS_XCHG_BKUP_NAME (IDS_METHOD_NORMAL+17)
+
+// Catalog defines
+
+#define IDS_TAPEOUTOFSEQUENCE 800
+#define IDS_ALLTAPES (IDS_TAPEOUTOFSEQUENCE+1)
+#define IDS_ALLFILES (IDS_TAPEOUTOFSEQUENCE+2)
+#define IDS_CATALOGSETNAME (IDS_TAPEOUTOFSEQUENCE+3)
+#define IDS_CANTDELTAPEINDRIVECAPTION (IDS_TAPEOUTOFSEQUENCE+4)
+#define IDS_CANTDELTAPEINDRIVE (IDS_TAPEOUTOFSEQUENCE+5)
+#define IDS_CATINFOTITLE (IDS_TAPEOUTOFSEQUENCE+6)
+#define IDS_NOSETSADDED (IDS_TAPEOUTOFSEQUENCE+7)
+#define IDS_CHANGETOPARTIAL (IDS_TAPEOUTOFSEQUENCE+8)
+#define IDS_REALLYCHANGETOPARTIAL (IDS_TAPEOUTOFSEQUENCE+9)
+#define IDS_DELETEFROMCATALOG (IDS_TAPEOUTOFSEQUENCE+10)
+#define IDS_REALLYDELETEFROMCATALOG (IDS_TAPEOUTOFSEQUENCE+11)
+#define IDS_CATLOADERROR (IDS_TAPEOUTOFSEQUENCE+12)
+#define IDS_BACKUPERRORTITLE (IDS_TAPEOUTOFSEQUENCE+13)
+#define IDS_BACKUPWRONGFAMILY (IDS_TAPEOUTOFSEQUENCE+14)
+#define IDS_DISKFULL_TITLE (IDS_TAPEOUTOFSEQUENCE+15)
+#define IDS_DISKFULL (IDS_TAPEOUTOFSEQUENCE+16)
+#define IDS_DISKFULL_INSTR (IDS_TAPEOUTOFSEQUENCE+17)
+
+
+// Attach-to-server defines
+
+#define IDS_LOGINTOSERVERCAPTION 830
+
+// SELECTION FILE DEFINES
+
+#define IDS_SELECTION_START 831
+
+#define IDS_ALLSELECTIONFILES (IDS_SELECTION_START+0)
+#define IDS_SELECTIONEXTENSION (IDS_SELECTION_START+1)
+#define IDS_NETWORKERRORCAPTION (IDS_SELECTION_START+2)
+#define IDS_MAPPEDFOUND (IDS_SELECTION_START+3)
+#define IDS_SERVERSFOUND (IDS_SELECTION_START+4)
+#define IDS_SERVOLUMES (IDS_SELECTION_START+5)
+#define IDS_MAPPEDDRIVES (IDS_SELECTION_START+6)
+#define IDS_SELECTCAPTION (IDS_SELECTION_START+7)
+#define IDS_NOSERVERSFOUND (IDS_SELECTION_START+8)
+#define IDS_NOFILESSELECTED (IDS_SELECTION_START+9)
+#define IDS_SELECTWARNING (IDS_SELECTION_START+10)
+#define IDS_SELECTAREYOUSURE (IDS_SELECTION_START+11)
+#define IDS_SELECTUSEDBYJOB (IDS_SELECTION_START+12)
+#define IDS_SELECTNAMEINUSE (IDS_SELECTION_START+13)
+#define IDS_SELECTREPLACE (IDS_SELECTION_START+14)
+#define IDS_SELECTNAMENOTVALID (IDS_SELECTION_START+15)
+#define IDS_SELECTENTERVALID (IDS_SELECTION_START+16)
+
+// ADVANCED SELECTION STRINGS
+
+#define IDS_ADVANCEDDATESCAPTION (IDS_SELECTION_START+18)
+#define IDS_ADVANCEDDATESMESSAGE (IDS_SELECTION_START+19)
+#define IDS_ADVNOTAPESCATALOGED (IDS_SELECTION_START+20)
+#define IDS_ADVNOTAPESCATALOGEDCAPTION (IDS_SELECTION_START+21)
+#define IDS_SELECTNOTFOUND (IDS_SELECTION_START+22)
+#define IDS_NONETWORKFOUND (IDS_SELECTION_START+23)
+
+// EXCHANGE SERVER SELECTION STRINGS
+#define IDS_XCHNG_NO_CONNECT (IDS_SELECTION_START+24)
+#define IDS_XCHNG_STOP_RECOVER (IDS_SELECTION_START+25)
+#define IDS_XCHNG_RECOVER_TITLE (IDS_SELECTION_START+26)
+#define IDS_XCHNG_DIR (IDS_SELECTION_START+27)
+#define IDS_XCHNG_INFO_STORE (IDS_SELECTION_START+28)
+#define IDS_XCHNG_NO_SERVICE (IDS_SELECTION_START+29)
+#define IDS_XCHNG_NO_SERVER (IDS_SELECTION_START+30)
+#define IDS_XCHNG_NO_SERVICE_RUNNING (IDS_SELECTION_START+31)
+#define IDS_XCHNG_BKUP_IN_PROG (IDS_SELECTION_START+32)
+#define IDS_XCHNG_NO_SERVICE_ACCESS (IDS_SELECTION_START+33)
+#define IDS_XCHNG_SERVICE_NO_START (IDS_SELECTION_START+34)
+#define IDS_XCHNG_SERVICE_RUNNING (IDS_SELECTION_START+35)
+
+// selection error messages
+
+#define IDS_SELECT_WRITE_ERROR 870
+
+
+// dates/times for advanced backup
+
+#define IDS_NEXTTIMEINVALID 880
+#define IDS_CHECKMINUTES (IDS_NEXTTIMEINVALID+2)
+#define IDS_CHECKHOURS (IDS_NEXTTIMEINVALID+3)
+#define IDS_CHECKAMPM (IDS_NEXTTIMEINVALID+4)
+#define IDS_CHECKDAY (IDS_NEXTTIMEINVALID+5)
+#define IDS_CHECKMONTH (IDS_NEXTTIMEINVALID+6)
+#define IDS_CHECKYEAR (IDS_NEXTTIMEINVALID+7)
+
+#define IDS_ALLBSETS (IDS_NEXTTIMEINVALID+8)
+
+// DEBUG MANAGER STRING DEFINES
+
+#define IDS_DEBUGSTART 890
+#define IDS_DEBUGWARNING (IDS_DEBUGSTART+0)
+#define IDS_DEBUGMESSAGESTOOLOW (IDS_DEBUGSTART+1)
+#define IDS_DEBUGMESSAGESTOOHIGH (IDS_DEBUGSTART+2)
+#define IDS_DEBUGBADFILENAME (IDS_DEBUGSTART+3)
+
+// LOG FILE MANAGER STRING DEFINES
+
+#define IDS_LOGFILESWINDOWNAME 900
+#define IDS_LOGVIEWMINWINDOWNAME (IDS_LOGFILESWINDOWNAME+1)
+#define IDS_LOGHEADERFILENAME (IDS_LOGFILESWINDOWNAME+2)
+#define IDS_LOGHEADERDATE (IDS_LOGFILESWINDOWNAME+3)
+#define IDS_LOGHEADERTIME (IDS_LOGFILESWINDOWNAME+4)
+#define IDS_LOGLOGGEDON (IDS_LOGFILESWINDOWNAME+7)
+#define IDS_LOG_BKS (IDS_LOGFILESWINDOWNAME+8)
+#define IDS_LOG_TKS (IDS_LOGFILESWINDOWNAME+9)
+#define IDS_LOG_RSS (IDS_LOGFILESWINDOWNAME+10)
+#define IDS_LOG_LST (IDS_LOGFILESWINDOWNAME+11)
+#define IDS_LOGSTRINGAT (IDS_LOGFILESWINDOWNAME+12)
+#define IDS_LOGLENGTHOFFILE (IDS_LOGFILESWINDOWNAME+13)
+#define IDS_LOGFILENAMEPREFIX (IDS_LOGFILESWINDOWNAME+14)
+#define IDS_LOGPREFIX (IDS_LOGFILESWINDOWNAME+15)
+#define IDS_LOGEXTENSION (IDS_LOGFILESWINDOWNAME+16)
+#define IDS_LOGSCANNINGFILE (IDS_LOGFILESWINDOWNAME+17)
+#define IDS_LOGMAXLINES (IDS_LOGFILESWINDOWNAME+18)
+#define IDS_LOGMAXSUPPORT (IDS_LOGFILESWINDOWNAME+19)
+
+
+
+// PRINT MANAGER STRINGS
+
+#define IDS_PRTHEADERFORMAT 970
+#define IDS_PRTSESSIONLOGQUESTION (IDS_PRTHEADERFORMAT+1)
+#define IDS_PRTSETUPALREADYOPEN (IDS_PRTHEADERFORMAT+2)
+#define IDS_PRTPMTITLE (IDS_PRTHEADERFORMAT+3)
+#define IDS_PRTDEFAULT (IDS_PRTHEADERFORMAT+4)
+#define IDS_PRTNOLOGSSELECTED (IDS_PRTHEADERFORMAT+5)
+#define IDS_PRTPRINTINGABORTED (IDS_PRTHEADERFORMAT+6)
+#define IDS_PRTPRINTINGCOMPLETE (IDS_PRTHEADERFORMAT+7)
+#define IDS_PRTNUMOFLOGFILES (IDS_PRTHEADERFORMAT+8)
+#define IDS_PRTONELOGFILE (IDS_PRTHEADERFORMAT+9)
+#define IDS_PRTSTARTERROR (IDS_PRTHEADERFORMAT+10)
+#define IDS_PRTDRIVERNOTFOUND (IDS_PRTHEADERFORMAT+11)
+#define IDS_PRTCANNOTACCESSDRIVER (IDS_PRTHEADERFORMAT+12)
+#define IDS_PRTPRINTSTATUS (IDS_PRTHEADERFORMAT+13)
+#define IDS_PRTPRINTCOMPLETE (IDS_PRTHEADERFORMAT+14)
+#define IDS_PRTPRINTERDRIVERERROR (IDS_PRTHEADERFORMAT+15)
+#define IDS_PRTNOPRINTERSAVAILABLE (IDS_PRTHEADERFORMAT+16)
+#define IDS_PRTONSTRING (IDS_PRTHEADERFORMAT+17)
+#define IDS_PRTUNACCESSABLE (IDS_PRTHEADERFORMAT+18)
+
+
+// EJECT STRING DEFINES
+
+#define IDS_EJECTTAPESTART 938
+#define IDS_EJECTTAPEMESSAGE (IDS_EJECTTAPESTART+0)
+#define IDS_EJECTTAPEMANUALEJECT (IDS_EJECTTAPESTART+1)
+#define IDS_EJECTTAPENOTAPE (IDS_EJECTTAPESTART+2)
+#define IDS_EJECTTAPEBIGPROBLEM (IDS_EJECTTAPESTART+3)
+
+// MEMORY MANAGER STRING DEFINES
+
+#define IDS_MEMSTART 957
+#define IDS_MEMNORUNAPP (IDS_MEMSTART+0)
+#define IDS_MEMRETRY (IDS_MEMSTART+1)
+#define IDS_MEMFAILED (IDS_MEMSTART+2)
+
+// Browse string defines
+
+#define IDS_BROWSESTART 10100
+#define IDS_BROWSETITLE (IDS_BROWSESTART+0)
+#define IDS_BROWSELOGFILES (IDS_BROWSESTART+1)
+#define IDS_BROWSELOGFILESEXT (IDS_BROWSESTART+2)
+#define IDS_BROWSEALLFILES (IDS_BROWSESTART+3)
+#define IDS_BROWSEALLFILESEXT (IDS_BROWSESTART+4)
+
+
+
+#define IDS_GENERR_TIMEOUT 10200
+#define IDS_GENERR_EOM (IDS_GENERR_TIMEOUT+1)
+#define IDS_GENERR_BAD_DATA (IDS_GENERR_TIMEOUT+2)
+#define IDS_GENERR_NO_MEDIA (IDS_GENERR_TIMEOUT+3)
+#define IDS_GENERR_ENDSET (IDS_GENERR_TIMEOUT+4)
+#define IDS_GENERR_NO_DATA (IDS_GENERR_TIMEOUT+5)
+#define IDS_GENERR_INVALID_CMD (IDS_GENERR_TIMEOUT+6)
+#define IDS_GENERR_RESET (IDS_GENERR_TIMEOUT+7)
+#define IDS_GENERR_WRT_PROTECT (IDS_GENERR_TIMEOUT+8)
+#define IDS_GENERR_HARDWARE (IDS_GENERR_TIMEOUT+9)
+#define IDS_GENERR_UNDETERMINED (IDS_GENERR_TIMEOUT+10)
+#define IDS_GENERR_EOM_OVERFLOW (IDS_GENERR_TIMEOUT+11)
+#define IDS_GENERR_WRONG_BLOCK_SIZE (IDS_GENERR_TIMEOUT+12)
+#define IDS_GENERR_UNRECOGNIZED_MEDIA (IDS_GENERR_TIMEOUT+13)
+#define IDS_GENFUNC_INIT (IDS_GENERR_TIMEOUT+14)
+#define IDS_GENFUNC_OPEN (IDS_GENERR_TIMEOUT+15)
+#define IDS_GENFUNC_NRCLOSE (IDS_GENERR_TIMEOUT+16)
+#define IDS_GENFUNC_RCLOSE (IDS_GENERR_TIMEOUT+17)
+#define IDS_GENFUNC_READ (IDS_GENERR_TIMEOUT+18)
+#define IDS_GENFUNC_WRITE (IDS_GENERR_TIMEOUT+19)
+#define IDS_GENFUNC_WRITE_ENDSET (IDS_GENERR_TIMEOUT+20)
+#define IDS_GENFUNC_SPACE_FWD_FMK (IDS_GENERR_TIMEOUT+21)
+#define IDS_GENFUNC_SPACE_BKWD_FMK (IDS_GENERR_TIMEOUT+22)
+#define IDS_GENFUNC_SPACE_EOD (IDS_GENERR_TIMEOUT+23)
+#define IDS_GENFUNC_SPACE_FWD_BLK (IDS_GENERR_TIMEOUT+24)
+#define IDS_GENFUNC_SPACE_BKWD_BLK (IDS_GENERR_TIMEOUT+25)
+#define IDS_GENFUNC_ERASE (IDS_GENERR_TIMEOUT+26)
+#define IDS_GENFUNC_REWIND (IDS_GENERR_TIMEOUT+27)
+#define IDS_GENFUNC_REWINDI (IDS_GENERR_TIMEOUT+28)
+#define IDS_GENFUNC_RETEN (IDS_GENERR_TIMEOUT+29)
+#define IDS_GENFUNC_STATUS (IDS_GENERR_TIMEOUT+30)
+#define IDS_GENFUNC_RELEASE (IDS_GENERR_TIMEOUT+31)
+#define IDS_GENFUNC_SEEK (IDS_GENERR_TIMEOUT+32)
+#define IDS_GENFUNC_GETPOS (IDS_GENERR_TIMEOUT+33)
+#define IDS_GENFUNC_MOUNT (IDS_GENERR_TIMEOUT+34)
+#define IDS_GENFUNC_DISMOUNT (IDS_GENERR_TIMEOUT+35)
+#define IDS_GENFUNC_SPECIAL_GET_INFO (IDS_GENERR_TIMEOUT+36)
+#define IDS_GENFUNC_SPECIAL_CHNG_BLK_SIZE (IDS_GENERR_TIMEOUT+37)
+#define IDS_GENFUNC_SPECIAL_SET_COMPRESS (IDS_GENERR_TIMEOUT+38)
+#define IDS_GENFUNC_EJECT (IDS_GENERR_TIMEOUT+39)
+#define IDS_GENERR_DRIVER_FAIL1 (IDS_GENERR_TIMEOUT+40)
+#define IDS_GENERR_DRIVER_FAIL2 (IDS_GENERR_TIMEOUT+41)
+#define IDS_GENERR_DRIVE_FAILED (IDS_GENERR_TIMEOUT+42)
+#define IDS_GENERR_ERROR_REPORTED (IDS_GENERR_TIMEOUT+43)
+#define IDS_GENERR_TITLE (IDS_GENERR_TIMEOUT+44)
+
+
+// VLM string defines
+
+#define IDS_VLMSTART 10960
+#define IDS_VLMDISKTITLE (IDS_VLMSTART+0)
+#define IDS_VLMSERVERTITLE (IDS_VLMSTART+1)
+#define IDS_VLMTAPETITLE (IDS_VLMSTART+2)
+#define IDS_VLMSEARCHTITLE (IDS_VLMSTART+3)
+#define IDS_VLMSRCHOOPS (IDS_VLMSTART+4)
+#define IDS_VLMSRCHNOFILESFOUND (IDS_VLMSTART+5)
+#define IDS_VLMSRCHNOMATCHINGSETS (IDS_VLMSTART+6)
+#define IDS_VLMSRCHTOOMANY (IDS_VLMSTART+7)
+#define IDS_VLMSRCHNOCATALOGS (IDS_VLMSTART+8)
+#define IDS_VLMSRCHBADFILENAME (IDS_VLMSTART+9)
+#define IDS_VLMSRCHINGWHAT (IDS_VLMSTART+10)
+#define IDS_VLMFILESSCANNED (IDS_VLMSTART+11)
+#define IDS_VLMCATWARNING (IDS_VLMSTART+12)
+#define IDS_VLMSETINCOMPLETE (IDS_VLMSTART+13)
+#define IDS_VLMSETPARTIAL (IDS_VLMSTART+14)
+#define IDS_LOOPSOUTOFSEQUENCE (IDS_VLMSTART+15)
+#define IDS_VLMSETIMAGE (IDS_VLMSTART+16)
+#define IDS_VLMCATERROR (IDS_VLMSTART+17)
+#define IDS_VLMCATREADERROR (IDS_VLMSTART+18)
+#define IDS_VLMCATWRITEERROR (IDS_VLMSTART+19)
+#define IDS_VLMCATOPENERROR (IDS_VLMSTART+20)
+#define IDS_VLMCATHANDLEERROR (IDS_VLMSTART+21)
+#define IDS_VLMCATSEEKERROR (IDS_VLMSTART+22)
+#define IDS_VLMCATMEMERROR (IDS_VLMSTART+23)
+#define IDS_VLMCATFULLERROR (IDS_VLMSTART+24)
+#define IDS_VLMCATUNKNOWNERROR (IDS_VLMSTART+25)
+#define IDS_VLMLOGERROR (IDS_VLMSTART+26)
+#define IDS_VLMLOGFULLERROR (IDS_VLMSTART+27)
+#define IDS_VLMDEVICEERRORTITLE (IDS_VLMSTART+28)
+#define IDS_VLMDEVICEERRORMSG (IDS_VLMSTART+29)
+#define IDS_VLMSETNUMBER (IDS_VLMSTART+30)
+#define IDS_VLMNORM (IDS_VLMSTART+31)
+#define IDS_VLMDIFF (IDS_VLMSTART+32)
+#define IDS_VLMINCR (IDS_VLMSTART+33)
+#define IDS_VLMIMAGE (IDS_VLMSTART+34)
+#define IDS_VLMCOPY (IDS_VLMSTART+35)
+#define IDS_VLMSERVERNOTLOGGEDIN (IDS_VLMSTART+36)
+#define IDS_VLMSTARTUPBKS (IDS_VLMSTART+37)
+#define IDS_VLMTAPENAME (IDS_VLMSTART+38)
+#define IDS_VLMAFPTITLE (IDS_VLMSTART+39)
+#define IDS_VLMAFPTEXT (IDS_VLMSTART+40)
+#define IDS_TITLEERASEWARNING (IDS_VLMSTART+41)
+#define IDS_TEXTERASEWARNING (IDS_VLMSTART+42)
+#define IDS_VLMDAILY (IDS_VLMSTART+43)
+#define IDS_VLMONTAPES (IDS_VLMSTART+44)
+#define IDS_VLMONTAPE (IDS_VLMSTART+45)
+#define IDS_VLMFOREIGNTITLE (IDS_VLMSTART+46)
+#define IDS_VLMFOREIGNTEXT (IDS_VLMSTART+47)
+#define IDS_VLMUNFORMATEDTITLE (IDS_VLMSTART+48)
+#define IDS_VLMUNFORMATEDTEXT (IDS_VLMSTART+49)
+#define IDS_VLMDRIVEMSG (IDS_VLMSTART+50)
+#define IDS_VLMGOOFYTITLE (IDS_VLMSTART+51)
+#define IDS_VLMGOOFYTEXT (IDS_VLMSTART+52)
+#define IDS_VLMSETCOMPRESSED (IDS_VLMSTART+53)
+#define IDS_VLMSETENCRYPT (IDS_VLMSTART+54)
+#define IDS_VLMSETFUTURE (IDS_VLMSTART+55)
+#define IDS_VLMSETSMS (IDS_VLMSTART+56)
+#define IDS_VLMECCTEXT (IDS_VLMSTART+57)
+#define IDS_VLMFUTURETEXT (IDS_VLMSTART+58)
+#define IDS_VLMACCESSDENIEDMSG (IDS_VLMSTART+59)
+#define IDS_VLMSQLTEXT (IDS_VLMSTART+60)
+#define IDS_VLMNAME_EXCHANGE (IDS_VLMSTART+61)
+#define IDS_VLMEMSTITLE (IDS_VLMSTART+62)
+#define IDS_VLMEMSMINTITLE IDS_VLMEMSTITLE
+#define IDS_VLMMSG_SELECTVOLSFAILED (IDS_VLMSTART+63)
+#define IDS_VLMMSG_SELECTVOLFAILED (IDS_VLMSTART+64)
+#define IDS_VLMSCANNETWORK (IDS_VLMSTART+65)
+#define IDS_VLMSCANDEVICE (IDS_VLMSTART+66)
+#define IDS_VLMSCANSTATUS (IDS_VLMSTART+67)
+#define IDS_VLMMSG_SCANCANCEL (IDS_VLMSTART+68)
+#define IDS_VLMSCANEXPAND (IDS_VLMSTART+69)
+#define IDS_VLMSCANSELECT (IDS_VLMSTART+70)
+#define IDS_VLMMSG_SELECTNOVOLS (IDS_VLMSTART+71)
+
+
+/* RES_ strings start at 3000 (eng_msg.h) */
+/* 3500 (eng_err.h) */
+/* 3800 (eng_dbug.h) */
+
+/* MessageBox titles */
+
+#define IDS_MSGTITLE_VERIFY 4000
+#define IDS_MSGTITLE_INSERT (IDS_MSGTITLE_VERIFY + 1)
+#define IDS_MSGTITLE_REPLACE (IDS_MSGTITLE_INSERT + 1)
+#define IDS_MSGTITLE_APPEND (IDS_MSGTITLE_REPLACE + 1)
+#define IDS_MSGTITLE_INUSE (IDS_MSGTITLE_APPEND + 1)
+#define IDS_MSGTITLE_CONTINUE (IDS_MSGTITLE_INUSE + 1)
+#define IDS_MSGTITLE_COPY (IDS_MSGTITLE_CONTINUE + 1)
+#define IDS_MSGTITLE_ERASE (IDS_MSGTITLE_COPY + 1)
+#define IDS_MSGTITLE_CORRUPT (IDS_MSGTITLE_ERASE + 1)
+#define IDS_MSGTITLE_RESTORE (IDS_MSGTITLE_CORRUPT + 1)
+#define IDS_MSGTITLE_MACNAMES (IDS_MSGTITLE_RESTORE + 1)
+#define IDS_MSGTITLE_BINDFILES (IDS_MSGTITLE_MACNAMES + 1)
+#define IDS_MSGTITLE_SECURITY (IDS_MSGTITLE_BINDFILES + 1)
+#define IDS_MSGTITLE_ERROR (IDS_MSGTITLE_SECURITY + 1)
+#define IDS_MSGTITLE_NEXT (IDS_MSGTITLE_ERROR + 1)
+#define IDS_MSGTITLE_RETENSION (IDS_MSGTITLE_NEXT + 1)
+#define IDS_MSGTITLE_KEEP_SETTINGS (IDS_MSGTITLE_RETENSION + 1)
+#define IDS_MSGTITLE_WARNING (IDS_MSGTITLE_KEEP_SETTINGS + 1)
+#define IDS_MSGTITLE_TAPEPSWD (IDS_MSGTITLE_WARNING + 1)
+#define IDS_MSGTITLE_XFERMETHOD (IDS_MSGTITLE_TAPEPSWD + 1)
+#define IDS_MSGTITLE_ABORT (IDS_MSGTITLE_XFERMETHOD + 1) // chs:02-05-93
+#define IDS_MSGTITLE_BADEXCHNG (IDS_MSGTITLE_ABORT + 1) // kmw:09-21-94
+#define IDS_MSGTITLE_SELECT (IDS_MSGTITLE_BADEXCHNG + 1) // kmw:09-22-94
+#define IDS_MSGTITLE_EXPANDBRANCH (IDS_MSGTITLE_SELECT + 1) // kmw:09-23-94
+
+// International defaults
+
+#define IDS_DEFAULT_SHORTDATE 4200
+#define IDS_DEFAULT_TIME (IDS_DEFAULT_SHORTDATE + 1)
+#define IDS_DEFAULT_1159 (IDS_DEFAULT_TIME + 1)
+#define IDS_DEFAULT_2359 (IDS_DEFAULT_1159 + 1)
+#define IDS_DEFAULT_THOUSAND (IDS_DEFAULT_2359 + 1)
+
+
+// Tape strings, do_*.c files
+
+#define IDS_CAT_LOADING_SM 4400
+#define IDS_CAT_LOADING_FDD (IDS_CAT_LOADING_SM + 1)
+#define IDS_CAT_TAPENAME (IDS_CAT_LOADING_SM + 2)
+#define IDS_TAPEDRIVENAME (IDS_CAT_LOADING_SM + 3)
+
+
+
+// Hardware Configuration Strings start at 5000
+
+#include "hwctext.h"
+
+// Microsoft OEM Batch Mode Command Line strings start at 6000
+// Reserve 100 id's for OEM Batch support (next available id is 6100)
+// Each of these strings may be no longer than IDS_OEM_MAX_LEN - 1
+// See OMBATCH.C and MUI_ProcessCommandLine in MUI.C for more information.
+
+#define IDS_OEM_MAX_LEN 32 //max length of a res string including
+ // NULL terminator
+
+#define IDS_OEMBATCH_FIRST 6000
+#define IDS_OEMBATCH_RESERVED 100 //100 ids reserved for Batch
+
+ // Batch mode operation - the only operation allowed is 'Backup'.
+
+#define IDS_OEMBATCH_BACKUP IDS_OEMBATCH_FIRST
+#define IDS_OEMBATCH_EJECT (IDS_OEMBATCH_FIRST+1)
+
+ // This string holds the list of prefix chars which must be used to
+ // to mark an option (eg. the slash and dash in /APPEND and -D).
+
+#define IDS_OEMOPT_PREFIXES (IDS_OEMBATCH_FIRST+2)
+
+ // This string holds the list of tokens (characters) which seperate
+ // one command line item from another - eg. spaces, tabs, commas, etc.
+
+#define IDS_OEMOPT_TOKENSEPS (IDS_OEMBATCH_FIRST+3)
+
+ // These strings specify DSA or Monolithic backup of Exchange servers.
+
+#define IDS_OEMOPT_DSA (IDS_OEMBATCH_FIRST+4)
+#define IDS_OEMOPT_MONOLITHIC (IDS_OEMBATCH_FIRST+5)
+
+ // Batch mode command options. NOTE: These must be consecutive and
+ // there must be *exactly* IDS_OEMOPT_COUNT number of them.
+
+#define IDS_OEMOPT_FIRST (IDS_OEMBATCH_FIRST + 10)
+#define IDS_OEMOPT_COUNT 8
+
+#define IDS_OEMOPT_UNKNOWN -1 //special id - NOT A STRING!
+#define IDS_OEMOPT_NOTANOPTION -2 //special id - NOT A STRING!
+#define IDS_OEMOPT_VALIDGUIOPTION -3 //special id - NOT A STRING!
+#define IDS_OEMOPT_USAGE -4 //special id - NOT A STRING!
+#define IDS_OEMOPT_NOPOLLOPTION -5 //special id - NOT A STRING!
+
+#define IDS_OEMOPT_APPEND (IDS_OEMOPT_FIRST+0)
+#define IDS_OEMOPT_VERIFY (IDS_OEMOPT_FIRST+1)
+#define IDS_OEMOPT_RESTRICT (IDS_OEMOPT_FIRST+2)
+#define IDS_OEMOPT_DESCRIPTION (IDS_OEMOPT_FIRST+3)
+#define IDS_OEMOPT_TYPE (IDS_OEMOPT_FIRST+4)
+#define IDS_OEMOPT_LOGFILENAME (IDS_OEMOPT_FIRST+5)
+#define IDS_OEMOPT_LOGEXCEPTIONS (IDS_OEMOPT_FIRST+6)
+#define IDS_OEMOPT_BACKUP_REGISTRY (IDS_OEMOPT_FIRST+7)
+
+ // Allowable types given with the IDS_OEMOPT_TYPE option
+ // These must be consecutive and there must be exactly IDS_OEMTYPE_COUNT
+ // number of them.
+
+#define IDS_OEMTYPE_FIRST (IDS_OEMOPT_FIRST + IDS_OEMOPT_COUNT)
+#define IDS_OEMTYPE_COUNT 5
+
+#define IDS_OEMTYPE_UNKNOWN -1 //special id - NOT A STRING!
+
+#define IDS_OEMTYPE_NORMAL (IDS_OEMTYPE_FIRST+0)
+#define IDS_OEMTYPE_COPY (IDS_OEMTYPE_FIRST+1)
+#define IDS_OEMTYPE_DIFFERENTIAL (IDS_OEMTYPE_FIRST+2)
+#define IDS_OEMTYPE_INCREMENTAL (IDS_OEMTYPE_FIRST+3)
+#define IDS_OEMTYPE_DAILY (IDS_OEMTYPE_FIRST+4)
+#define IDS_OEMTYPE_COMPATIBLE (IDS_OEMTYPE_FIRST+5)
+
+// Microsoft OEM NT Event Logging strings.
+#ifdef OS_WIN32
+
+# define IDS_OEMEVENT_FIRST (IDS_OEMBATCH_FIRST+IDS_OEMBATCH_RESERVED)
+# define IDS_OEMEVENT_RESERVED 10 //10 ids reserved for Event Logging
+
+# define IDS_OEMEVENT_MAX_SOURCE_LEN 80
+
+# define IDS_OEMEVENT_SOURCE_NAME (IDS_OEMEVENT_FIRST+0)
+
+#endif //OS_WIN32
+
+// Read Only drive titles
+
+#define IDS_RDONLY_DRV_ENCOUNTER 4220
+
+// Read Only drive warnings
+
+#define IDS_RDONLY_COPY 4225
+#define IDS_RDONLY_DIFFERENTIAL 4226
+
+// Microsoft OEM Backup and Restore Log file default names, etc.
+
+#ifdef IDS_OEMEVENT_FIRST
+# define IDS_OEMLOG_FIRST (IDS_OEMEVENT_FIRST+IDS_OEMEVENT_RESERVED)
+#else
+# define IDS_OEMLOG_FIRST (IDS_OEMBATCH_FIRST+IDS_OEMBATCH_RESERVED)
+#endif
+
+#define IDS_OEMLOG_RESERVED 10 //reserve 10 ids for log files
+
+#define IDS_OEMLOG_BACKUP_DEF_NAME (IDS_OEMLOG_FIRST+0)
+#define IDS_OEMLOG_RESTORE_DEF_NAME (IDS_OEMLOG_FIRST+1)
+#define IDS_OEMLOG_ERROR_REPORTEVENT (IDS_OEMLOG_FIRST+2)
+#define IDS_OEMLOG_ERROR_EVENTSTRING (IDS_OEMLOG_FIRST+3)
+
+
+#define IDS_RTD_START 9000
+
+#define IDS_RTD_ACCESSDENIED_FILE (IDS_RTD_START+0)
+#define IDS_RTD_ACCESSDENIED_DIR (IDS_RTD_START+1)
+
+#define IDS_RTD_WRITEERROR_FILE (IDS_RTD_START+2)
+#define IDS_RTD_WRITEERROR_DIR (IDS_RTD_START+3)
+
+#define IDS_RTD_READERROR_STREAM (IDS_RTD_START+4)
+#define IDS_RTD_WRITEERROR_STREAM (IDS_RTD_START+5)
+
+#define IDS_RTD_READERROR_SECURITYSTREAM (IDS_RTD_START+6)
+#define IDS_RTD_WRITEERROR_SECURITYSTREAM (IDS_RTD_START+7)
+
+#define IDS_RTD_READERROR_EA (IDS_RTD_START+8)
+#define IDS_RTD_WRITEERROR_EA (IDS_RTD_START+9)
+#define IDS_RTD_VERIFYERROR_EA (IDS_RTD_START+10)
+
+#define IDS_RTD_READERROR_ALTSTREAM (IDS_RTD_START+11)
+#define IDS_RTD_WRITEERROR_ALTSTREAM (IDS_RTD_START+12)
+
+#define IDS_RTD_READERROR_LINK (IDS_RTD_START+13)
+#define IDS_RTD_CREATEERROR_LINK (IDS_RTD_START+14)
+
+#define IDS_RTD_VERIFYERROR_DATA (IDS_RTD_START+15)
+#define IDS_RTD_VERIFYERROR_SECURITYSTREAM (IDS_RTD_START+16)
+#define IDS_RTD_VERIFYERROR_ALTSTREAM (IDS_RTD_START+17)
+
+#endif //STRINGS_H_INCL
+
diff --git a/private/utils/ntbackup/inc/omxchng.h b/private/utils/ntbackup/inc/omxchng.h
new file mode 100644
index 000000000..fd0beffb0
--- /dev/null
+++ b/private/utils/ntbackup/inc/omxchng.h
@@ -0,0 +1,33 @@
+#ifndef XCHG_H
+#define XCHG_H
+
+#define MAX_EMS_SERVER_LEN 32
+
+// Exchange Connect dialog
+
+#define IDD_XCNCT_OK 101
+#define IDD_XCNCT_CANCEL 102
+#define IDD_XCNCT_SVR_NAME 103
+#define IDD_XCNCT_PICKER 104
+
+/* These have to be together in this order */
+#define IDD_XCNCT_CONNECT 105
+#define IDD_XCNCT_ONLINE 106
+
+#define IDD_XCNCT_SERVICE 107
+#define IDD_XCNCT_HELP 108
+
+// Exchange Recovery Status dialog
+#define IDD_XCHG_RCVR_TEXT 101
+#define IDD_XCHG_RCVR_PCT 102
+#define IDD_XCHG_RCVR_CANCEL 103
+#define IDD_XCHG_RCVR_STATUS 104
+#define IDD_XCHG_RCVR_PHASE 105
+#define IDD_XCHG_RCVR_STATUS_BORDER 106
+
+/* Resources storing the number of phases for the IS and DS.
+ Look in omxchng.dlg for the actual values. */
+#define IDR_XCHG_RCVR_IS_PHASE 201
+#define IDR_XCHG_RCVR_DS_PHASE 202
+
+#endif
diff --git a/private/utils/ntbackup/inc/os2_fs.h b/private/utils/ntbackup/inc/os2_fs.h
new file mode 100644
index 000000000..20165afd9
--- /dev/null
+++ b/private/utils/ntbackup/inc/os2_fs.h
@@ -0,0 +1,377 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: os2_fs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the prototypes for the OS2
+ file system functions.
+
+ $Log: O:/LOGFILES/OS2_FS.H_V $
+ *
+ * Rev 1.5 15 Jan 1993 17:31:46 TIMN
+ * Added support to OS2 FSYS for MTF
+ *
+ * Rev 1.4 26 Feb 1992 13:15:54 DOUG
+ * Added FSYS_HAND parameter to OS2_GetOSPathDDB() prototype
+ *
+ *
+ * Rev 1.3 16 Dec 1991 18:11:36 STEVEN
+ * move common functions into table
+ *
+ * Rev 1.2 21 Jun 1991 13:21:16 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.1 23 May 1991 16:46:22 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:31:24 HUNTER
+ * Initial revision.
+
+**/
+#ifndef _os2_fs_h_
+#define _os2_fs_h_
+
+/* $begin$ include list */
+
+#include "fsys.h"
+#include "os2dblk.h"
+
+/* $end$ include list */
+
+#define OS2_MAX_PSIZE 264
+#define OS2_MAX_DSIZE 256
+#define OS2_MAX_FSIZE 256
+
+
+#define MAX_REALLOC_SIZE 65536L /* largest block of mem to alloc */
+
+#define GENERIC2OS_ATTRIB_OFFSET 8 /* attrib offset between GENERIC & OS */
+
+
+ /* EA specific defines */
+#define SIZEOF_GEALIST_CBLIST_SIZE sizeof( ULONG ) /* sizeof( eaop.fpGEAList->cbList ) */
+#define SIZEOF_GEALIST ( sizeof( GEA ) + SIZEOF_GEALIST_CBLIST_SIZE )
+#define SIZEOF_FEALIST_CBLIST_SIZE sizeof( ULONG ) /* sizeof( eaop.fpFEAList->cbList ) */
+#define SIZEOF_FEALIST ( sizeof( FEA ) + SIZEOF_FEALIST_CBLIST_SIZE )
+#define EA_BUFF_SIZE 300 /* gea_data buffer size */
+
+enum {
+ REALLOC_EA, /* indicate EA stream for realloc */
+ REALLOC_ACL /* indicate ACL stream for realloc */
+} ;
+
+
+ /* used for RESTORE/VERIFY to indicate what stream is being processed */
+#define ENDOF_FORK STRM_INVALID /* end of current stream */
+#define DATA_FORK STRM_GENERIC_DATA /* data stream, not ea's or acl's */
+#define EA_FORK STRM_OS2_EA /* ea stream */
+#define ACL_FORK STRM_OS2_ACL /* acl stream */
+
+
+typedef struct OS2_FSYS_HAND {
+ HDIR hdir ;
+ INT16 lpath_allocated ;
+ CHAR_PTR long_path ;
+ UINT16 find_type ; /* type of FindFirst/Next scan */
+} *OS2_FSYS_HAND_PTR ;
+
+typedef struct OS2_EA_HAND_STRUCT {
+ HFILE data_hand ;
+ UINT16 ea_space_size ;
+ VOID_PTR ea_space ;
+ UINT32 space_pos ;
+ BOOLEAN skip_flag ;
+ UINT32 next_ea_offset ;
+ UINT32 ea_size ;
+ UINT32 ea_offset ;
+ CHAR_PTR long_name ; /* pascall format string */
+ UINT32 data_size ;
+ UINT32 data_offset ;
+ CHAR path[ OS2_MAX_PSIZE ] ;
+ UINT16 acl_space_size ;
+ VOID_PTR acl_space ;
+ UINT32 acl_space_pos ;
+ UINT32 acl_size ;
+ UINT32 acl_offset ;
+ UINT32 stream_active ; /* is stream being processed */
+} OS2_EA_HAND_STRUCT, *OS2_EA_HAND;
+
+#define OS2_SIZEOF_FILE_HAND ( sizeof(FILE_HAND_STRUCT) + sizeof(OS2_EA_HAND_STRUCT) )
+#define OS2_FILE_HAND_EA_OFFSET ( sizeof(FILE_HAND_STRUCT) )
+
+#define _OS2_GetEAHandPtr(hand) ( (OS2_EA_HAND)((CHAR_PTR)(hand) + OS2_FILE_HAND_EA_OFFSET ) )
+
+ /* for msasserts, are s_info id's correct */
+ /*
+ when s_info->id identifies the stream, the active Id must be INVALID
+ when s_info->id is INVALID, the active Id identifies the stream
+ being processed. Therefore, s_info->id != active id whenever
+ a stream is being received correctly. Since there are many
+ s_info->id's possible, we need to convert !0 values to 1 to
+ properly determine if a new stream is being sent at the right time.
+ ( STRM_OS2_EA != STRM_OS2_ACL is True, but not correct.)
+ */
+#define _OS2_dblNegate(v) ( (v) ? 1 : 0 ) /* 1 if !0, else 0; avoid !!v - compiler dependant values */
+#define _OS2_GetActiveId(hand) ( (_OS2_GetEAHandPtr( hand ))->stream_active )
+
+#define _OS2_GotStrmWhenExpected(sinfoId, activeId) \
+ ( _OS2_dblNegate( sinfoId ) != _OS2_dblNegate( activeId ) )
+
+
+ /* process the s_info id or s_info's data during BACKUP */
+#define _OS2_ExpectStrm(ea_hand) ( (ea_hand)->stream_active == ENDOF_FORK )
+#define _OS2_ExpectData(ea_hand) ( _OS2_ExpectStrm(ea_hand) )
+#define _OS2_SetExpectStrmOff(ea_hand) ( (ea_hand)->stream_active = !ENDOF_FORK )
+#define _OS2_SetExpectDataOn(ea_hand) ( (ea_hand)->stream_active = ENDOF_FORK )
+
+
+ /* type of stream being processed during RESTORE/VERIFY */
+#define _OS2_GetEAHandActiveStrm(ea_hand) ( (ea_hand)->stream_active )
+#define _OS2_SetEAHandActiveStrm(ea_hand,v) ( (ea_hand)->stream_active = (v) )
+
+
+INT16 OS2_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd); /* I - passowrd NOT USED */
+
+INT16 OS2_DetachDLE( FSYS_HAND fsh ); /* I - */
+
+INT16 OS2_AllocFileHand( FILE_HAND *file_hand ) ; /* I/O - */
+VOID OS2_MemsetFileHand( FILE_HAND *file_hand ) ; /* I/O - */
+
+INT16 OS2_CreateObj( FSYS_HAND fsh, /* I - File system to create object one */
+ DBLK_PTR dblk); /* I - Describes object to create */
+
+INT16 OS2_OpenObj( FSYS_HAND fsh, /* I - file system that the file is opened on */
+ FILE_HAND *hand, /* O - allocated handle */
+ DBLK_PTR dblk, /*I/O- describes the file to be opened */
+ OPEN_MODE mode); /* I - open mode */
+
+INT16 OS2_ReadObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info ) ; /*I/O- struct to place stream header info */
+
+
+INT16 OS2_WriteObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size need for next read */
+ STREAM_INFO_PTR s_info ) ; /*I/O- struct to place stream header info */
+
+INT16 OS2_VerObj( FILE_HAND hand, /* I - file handle to verify data with */
+ CHAR_PTR buf, /* I - buffer needed to perform verify */
+ CHAR_PTR data, /* I - data to verify against */
+ UINT16 *size, /*I/O- size of buffers / amount verified */
+ UINT16 *blk_size, /* O - minum size of block for next call */
+ STREAM_INFO_PTR s_info ) ; /*I/O- struct to place stream header info */
+
+
+INT16 OS2_CloseObj( FILE_HAND hand ); /* I - handle of object to close */
+
+INT16 OS2_DeleteObj( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 OS2_FindFirst( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+ CHAR_PTR sname, /* I - serach name */
+ UINT16 find_type);/* I - objects to search for (dirs, all, etc)*/
+
+INT16 OS2_FindNext( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* O - Discriptor block */
+
+INT16 OS2_GetObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /*I/O- On entry it is minimal on exit Complete */
+
+INT16 OS2_VerObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to compare OS against */
+
+INT16 OS2_ChangeDir( FSYS_HAND fsh, /* I - file system to changing directories on */
+ CHAR_PTR path, /* I - describes the path of the new directory */
+ INT16 psize); /* I - specifies the length of the path */
+
+INT16 OS2_UpDir( FSYS_HAND fsh ); /* I - file system to change directories in */
+
+INT16 OS2_GetCurrentPath( FSYS_HAND fsh, /* I - file system to get current path from */
+ CHAR_PTR path, /* O - buffer to place this path */
+ INT16 *size); /*I/O- size of buffer on entry & on exit */
+
+INT16 OS2_SeekObj( FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ); /*I/O- Offset to seek; Number of bytes actualy seeked */
+
+INT16 OS2_GetMaxSizeDBLK( FSYS_HAND fsh /* not used */ );
+
+INT16 OS2_GetBasePath( FSYS_HAND fsh, /* I - file system to get base path from */
+ CHAR_PTR full_path, /* O - buffer to place this path */
+ INT16 *size ); /*I/O- size of buffer on entry & on exit */
+
+INT16 OS2_GetCurrentDDB( FSYS_HAND fsh, /* I - file system to get DDB from */
+ DBLK_PTR dblk ); /* O - place to put the DDB data */
+
+INT16 OS2_SetObjInfo( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk); /* I - data to write to disk */
+
+
+INT16 OS2_ModFnameFDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it, /* I - TRUE if setting file name, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get file name from */
+ CHAR_PTR buf, /*I/O- file name to read (or to write) */
+ INT16 *size ) ; /*I/O- size buffer on entry and exit */
+
+INT16 OS2_ModPathDDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it , /* I - TRUE if setting path, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get path from */
+ CHAR_PTR buf, /*I/O- path to read (or to write) */
+ INT16 *size ); /*I/O- size of buffer on entry and exit */
+
+INT16 OS2_GetOSFnameFDB( DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 OS2_GetOSPathDDB( FSYS_HAND fsh, /* I - File System Handle */
+ DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ); /*I/O- path to read (or to write) */
+
+INT16 OS2_GetFileVerFDB( DBLK_PTR dblk ,
+ UINT32 *version ) ;
+
+INT16 OS2_GetCdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ); /*I/O- createion date to read (or to write) */
+
+INT16 OS2_GetMdateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /* O - modify date to write */
+
+INT16 OS2_ModBdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 OS2_ModAdateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+UINT64 OS2_DisplaySizeDBLK( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+INT16 OS2_GetOS_InfoDBLK( DBLK_PTR dblk, /* I - DBLK to get the info from */
+ CHAR_PTR os_info, /* O - Buffer to place data */
+ INT16 *size ); /*I/O- Buffer size / data length */
+
+
+INT16 OS2_ModAttribDBLK( BOOLEAN set_it ,
+ DBLK_PTR dblk ,
+ UINT32_PTR attr );
+
+
+INT16 OS2_GetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE *type );
+
+
+INT16 OS2_GetActualSizeDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 OS2_SizeofFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ); /* I - dblk to get fname from */
+
+INT16 OS2_SizeofOSFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ) ; /* I - dblk to get fname from */
+
+INT16 OS2_SizeofPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 OS2_SizeofOSPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 OS2_SizeofOSInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to get size of OS info for */
+
+
+INT16 OS2_MatchDBLK( FSYS_HAND fsh , /* I - file system used to do comparison */
+ DBLK_PTR dblk1, /* I - DDB, IDB, or UDB just not FDB */
+ DBLK_PTR dblk2, /* I - FDB if above is DDB else unused */
+ BOOLEAN disp_flag,/* I - TRUE if match DIR for display purpose */
+ struct FSE *fse ); /* I - FSE to compare against */
+
+INT16 OS2_PushMinDDB( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 OS2_PopMinDDB( FSYS_HAND fsh ,
+ DBLK_PTR dblk );
+
+INT16 OS2_CreateFDB( FSYS_HAND fsh,
+ GEN_FDB_DATA_PTR dat ) ;
+
+INT16 OS2_CreateDDB( FSYS_HAND fsh,
+ GEN_DDB_DATA_PTR dat ) ;
+
+INT16 OS2_CreateIDB( FSYS_HAND fsh,
+ GEN_IDB_DATA_PTR dat ) ;
+
+VOID OS2_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+BOOLEAN OS2_ProcessDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 OS2_ChangeIntoDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+VOID OS2_GetRealBasePath( FSYS_HAND fsh, CHAR_PTR path ) ;
+
+INT16 OS2_SaveLongPath( FSYS_HAND fsh, CHAR_PTR path, INT16 path_len ) ;
+
+INT16 OS2_AppendLongPath( FSYS_HAND fsh, CHAR_PTR path, INT16 path_len ) ;
+
+UINT16 OS2_SetDataSize( FSYS_HAND fsh, DBLK_PTR ddb, UINT32 size ) ;
+
+INT16 OS2_DeviceDispName(
+GENERIC_DLE_PTR dle,
+CHAR_PTR dev_name,
+INT16 size,
+INT16 type );
+
+VOID OS2_GetVolName( GENERIC_DLE_PTR dle, CHAR_PTR buffer ) ;
+
+INT16 OS2_SizeofVolName( GENERIC_DLE_PTR dle ) ;
+
+INT16 OS2_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask ) ;
+
+UINT16 OS2_CalcForkDelta( UINT32, INT16, UINT32, ... ) ;
+
+BOOLEAN OS2_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+INT16 OS2_CompleteBlk( FSYS_HAND fsh, DBLK_PTR dblk, CHAR_PTR buffer, UINT16 *size, STREAM_INFO_PTR sinfo ) ;
+VOID OS2_ReleaseBlk( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+
+
+INT16 OS2_OpenEA(
+ FILE_HAND hand,
+ OS2_DBLK_PTR fdb
+) ;
+
+INT16 OS2_OpenACL(
+ FSYS_HAND fsh,
+ FILE_HAND hand,
+ OS2_DBLK_PTR fdb,
+ UINT16 size
+) ;
+
+INT16 OS2_OpenEAforVerifyDir(
+ FILE_HAND hand, /* O - allocated handle */
+ STREAM_INFO_PTR s_info /* I - stream info */
+) ;
+
+INT16 OS2_OpenACLforVerifyDir(
+ FILE_HAND hand, /* O - allocated handle */
+ STREAM_INFO_PTR s_info /* I - stream info */
+) ;
+
+INT16 OS2_ReallocSpace(
+ FILE_HAND hand, /* I/O - allocated handle */
+ UINT32 size, /* I - number of bytes to alloc */
+ INT16 spaceType /* I - type of buffer to alloc (EA or ACL) */
+) ;
+
+#define _ReallocEA(hand,v) ( OS2_ReallocSpace( hand, v, REALLOC_EA ) )
+#define _ReallocACL(hand,v) ( OS2_ReallocSpace( hand, v, REALLOC_ACL ) )
+
+#endif
diff --git a/private/utils/ntbackup/inc/os2com.h b/private/utils/ntbackup/inc/os2com.h
new file mode 100644
index 000000000..90b1e6566
--- /dev/null
+++ b/private/utils/ntbackup/inc/os2com.h
@@ -0,0 +1,142 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: os2com.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: OS2 utility functions.
+
+
+ $Log: Q:/LOGFILES/OS2COM.H_V $
+ *
+ * Rev 1.2 14 Jan 1993 16:22:54 DAVEV
+ * chg PULONG to UINT32_PTR
+ *
+ * Rev 1.1 30 Oct 1991 10:56:34 LORIB
+ * Changes for ACL.
+ *
+ * Rev 1.0 09 May 1991 13:32:26 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _os2com_h_
+#define _os2com_h_
+
+/* The following macros convert a dos format date or time UINT16 into */
+/* a UINT16 suitable for placing in a DATE_TIME structure. */
+
+#define GET_OS2_YEAR( os2_date ) ( 1980 + ( (UINT16)(os2_date) >> 9 ) )
+#define GET_OS2_MONTH( os2_date ) (((os2_date) & 0x1ff) >> 5)
+#define GET_OS2_DAY( os2_date ) ( (os2_date) & 0x1f )
+#define GET_OS2_HOUR( os2_time ) ( ((UINT16)(os2_time)) >> 11 )
+#define GET_OS2_MINUTE( os2_time ) ( ( (os2_time) & 0x7e0 ) >> 5 )
+#define GET_OS2_SECOND( os2_time ) ( ( (os2_time) & 0x1f ) << 1 )
+
+
+#define DA_READONLY 0x01
+#define DA_HIDDEN 0x02
+#define DA_SYSTEM 0x04
+#define DA_DIRECTORY 0x10
+#define DA_MODIFIED 0x20
+
+#define SET_INFO_MODE 0x80
+#define DENY_NONE_MODE 0x40
+#define DENY_WRITE_MODE 0x20
+#define DENY_ALL_MODE 0
+#define SHARE_MODE 0xF0
+
+#define READ_ACCESS 0
+#define WRITE_ACCESS 1
+#define ACCESS_MODE 0xf
+
+
+/* defines for ordinals of functions for OS/2 1.2 */
+#define DOS_OPEN2 "#95"
+#define DOS_QPATHINFO "#98"
+#define DOS_SETPATHINFO "#104"
+#define DOS_QFSATTACH "#182"
+#define DOS_FINDFIRST2 "#184"
+#define DOS_MKDIR2 "#185"
+#define DOS_ENUMATTRIB "#204"
+
+extern UINT16 ( APIENTRY *Dos_Open2 )( CHAR_PTR, PHFILE, UINT16 *, UINT32, UINT16, UINT16, UINT32, PEAOP, UINT32 );
+extern UINT16 ( APIENTRY *Dos_QPathInfo )( CHAR_PTR, UINT16, UINT8 *, UINT16, UINT32);
+extern UINT16 ( APIENTRY *Dos_SetPathInfo )( CHAR_PTR, UINT16, UINT8 *, UINT16, UINT16, UINT32);
+extern UINT16 ( APIENTRY *Dos_QFSAttach )( CHAR_PTR, UINT16, UINT16, UINT8 *, UINT16 *, UINT32);
+extern UINT16 ( APIENTRY *Dos_FindFirst2 )( CHAR_PTR, PHDIR, UINT16, VOID_PTR, UINT16, UINT16 *, UINT16, UINT32 ) ;
+extern UINT16 ( APIENTRY *Dos_MkDir2 )( CHAR_PTR, PEAOP, UINT32 ) ;
+extern UINT16 ( APIENTRY *Dos_EnumAttribute )( UINT16, VOID_PTR, UINT32, VOID_PTR, UINT32, UINT32 *, UINT32, UINT32 ) ;
+
+extern UINT16 ( APIENTRY *Net_AccessAdd )( CHAR_PTR, INT16, CHAR_PTR, UINT16 ) ;
+extern UINT16 ( APIENTRY *Net_AccessGetInfo )( CHAR_PTR, CHAR_PTR, INT16, CHAR_PTR, UINT16, UINT16 * ) ;
+extern UINT16 ( APIENTRY *Net_AccessSetInfo )( CHAR_PTR, CHAR_PTR, INT16, CHAR_PTR, UINT16, INT16 ) ;
+
+/* internal functions for OS/2 Tmenu File system */
+
+INT16 DeleteFileOS2( CHAR_PTR path ) ;
+
+INT16 DeleteDirOS2( CHAR_PTR path );
+
+INT16 SetAttribOS2( CHAR_PTR path, INT16 attrib );
+
+INT16 SetFileInfoOS2( CHAR_PTR drive, HFILE hand, FILESTATUS *finfo ) ;
+
+INT16 SetPathInfoOS2( CHAR_PTR path, FILESTATUS *finfo ) ;
+
+INT16 GetVolumeLabel( UCHAR drive_number, CHAR_PTR volume_name ) ;
+
+INT16 FindFirstOS2( PHDIR hdir, CHAR_PTR path, FILEFINDBUF2 *dta ) ;
+
+INT16 FindNextOS2( CHAR_PTR device_name, HDIR hdir, FILEFINDBUF2 *dta ) ;
+
+VOID OS2_MakeName( CHAR_PTR dest, CHAR_PTR source, INT16 fmt ) ;
+
+VOID OS2_MakePath( CHAR_PTR dest, CHAR_PTR source, INT16 leng, INT16 fmt ) ;
+
+INT16 OpenFileOS2( CHAR_PTR path, UINT16 open_mode, HFILE *hand, UINT32 *dsize, UINT32 *asize ) ;
+
+INT16 CloseFileOS2( CHAR_PTR device_name, HFILE hand ) ;
+
+INT16 LockFileOS2( CHAR_PTR device_name, HFILE hand );
+
+INT16 UnlockFileOS2( CHAR_PTR device_name, HFILE hand );
+
+INT16 CreateDirOS2( CHAR_PTR path );
+
+INT16 WriteFileOS2( CHAR_PTR dev_name, HFILE hand, CHAR_PTR buf, UINT16 *size ) ;
+
+INT16 ReadFileOS2( CHAR_PTR dev_name, HFILE hand, UINT32 pos, CHAR_PTR buf, UINT16 *size ) ;
+
+UINT16 OS2_LoadEAbuffer( FILE_HAND hand ) ;
+
+UINT16 OS2_FlushEAsForDir( CHAR_PTR path );
+
+VOID OS2_GetLongName( FSYS_HAND fsh, CHAR_PTR path, CHAR_PTR long_name ) ;
+
+/* APIs replaced for Critical error support */
+UINT16 CE_DosEnumAttribute( CHAR_PTR, USHORT, PVOID, ULONG, PVOID,
+ ULONG, UINT32_PTR, ULONG, ULONG);
+
+UINT16 CE_DosQFileInfo(CHAR_PTR dev_name, HFILE hf, USHORT usInfoLevel,
+ PVOID pInfoBuf, USHORT cbInfoBuf);
+
+UINT16 CE_DosQPathInfo(PSZ pszPath, USHORT usInfoLevel, PBYTE pInfoBuf,
+ USHORT cbInfoBuf, ULONG ulReserved);
+
+UINT16 CE_DosSetPathInfo(PSZ pszPath, USHORT usInfoLevel, PBYTE pInfoBuf,
+ USHORT cbInfoBuf, USHORT usFlags,
+ ULONG ulReserved);
+
+UINT16 CE_DosSetFileInfo(CHAR_PTR dev_name, HFILE hand, USHORT usInfoLevel,
+ PBYTE pInfoBuf, USHORT cbInfoBuf ) ;
+
+VOID OS2_SetupPath( struct OS2_DBLK *ddblk, CHAR_PTR path, UINT16 leng, UINT16 fmt ) ;
+
+VOID OS2_InitFS( VOID ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/os2dblk.h b/private/utils/ntbackup/inc/os2dblk.h
new file mode 100644
index 000000000..27cb3db94
--- /dev/null
+++ b/private/utils/ntbackup/inc/os2dblk.h
@@ -0,0 +1,97 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: os2dblk.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the definition of the OS2
+ file and directory control blocks.
+
+
+ $Log: O:/LOGFILES/OS2DBLK.H_V $
+ *
+ * Rev 1.3 15 Jan 1993 17:31:28 TIMN
+ * Added support to OS2 FSYS for MTF
+ *
+ * Rev 1.2 30 Jan 1992 17:56:42 BARRY
+ * Added acl_info_complete so os info calls could be separated from ACL calls.
+ * (Purely a performance change.)
+ *
+ * Rev 1.1 30 Oct 1991 10:57:58 LORIB
+ * Changes for ACL.
+ *
+ * Rev 1.0 09 May 1991 13:31:32 HUNTER
+ * Initial revision.
+
+**/
+#ifndef os2dblk_h
+#define os2dblk_h
+#include "queues.h"
+#include "os2com.h"
+/* $end$ include list */
+
+#define EA_LONG_NAME ".LONGNAME"
+
+typedef struct STD_OBJ_INFO {
+ FDATE cdate ;
+ FTIME ctime ;
+ FDATE adate ;
+ FTIME atime ;
+ FDATE date ;
+ FTIME time ;
+ UINT32 size ;
+ UINT32 alloc_size ;
+ UINT16 attr;
+ UINT16 ea_size ;
+ UINT16 acl_size ;
+ } STD_OBJ_INFO;
+
+
+typedef struct OS2_FDB_INFO {
+ BOOLEAN inuse_attrib ;
+ HFILE handle ; /* set by: OS2_CreateFile */
+ UINT16 lname_leng ;
+ UINT16 long_name ; /* used for backup only */
+ UINT16 os_name ;
+ UINT16 name ;
+} OS2_FDB_INFO, *OS2_FDB_INFO_PTR;
+
+
+typedef struct OS2_DDB_INFO {
+ BOOLEAN empty_attrib ;
+ UINT16 os_path ;
+ UINT16 os_path_leng ;
+ UINT16 path_leng ; /* does not count \0 */
+ UINT16 path ;
+ UINT16 lpath_leng ; /* only used for backup */
+ UINT16 long_path ; /* */
+} OS2_DDB_INFO, *OS2_DDB_INFO_PTR;
+
+
+
+typedef struct OS2_DBLK {
+ UINT8 blk_type; /* values: DDB_ID, FDB_ID */
+ COM_DBLK fs_reserved ;
+ STD_OBJ_INFO dta;
+ BOOLEAN os_info_complete; /* TRUE if GetObjInfo doesn't have to do anything */
+ BOOLEAN acl_info_complete; /* TRUE if GetObjInfo doesn't have to call ACL code */
+ UINT32 data_fork_offset ;
+ UINT32 ea_fork_offset ;
+ UINT32 acl_fork_offset ;
+ union {
+ OS2_DDB_INFO d;
+ OS2_FDB_INFO f;
+ } b;
+} OS2_DBLK, *OS2_DBLK_PTR;
+
+
+typedef struct OS2_MIN_DDB {
+ Q_ELEM q ;
+ HDIR handle ;
+ UINT16 psize ; /* size of path string */
+ CHAR_PTR path; /* build from "name" and current dir */
+} OS2_MIN_DDB, *OS2_MIN_DDB_PTR;
+
+#endif
diff --git a/private/utils/ntbackup/inc/osinfo.h b/private/utils/ntbackup/inc/osinfo.h
new file mode 100644
index 000000000..90a244fd0
--- /dev/null
+++ b/private/utils/ntbackup/inc/osinfo.h
@@ -0,0 +1,157 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: osinfo.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the OS info structures for all of
+ the file systems.
+
+ Location:
+
+
+ $Log: J:/LOGFILES/OSINFO.H_V $
+ *
+ * Rev 1.15 01 Oct 1993 12:43:16 DON
+ * Changed the typedef struct for SMS_OS_INFO
+ *
+ * Rev 1.14 21 Jul 1993 10:27:20 DON
+ * Forgot the volume name requires an extra byte for the ':'
+ *
+ * Rev 1.13 16 Jul 1993 08:51:18 DON
+ * Removed #ifdef's for SMS
+ *
+ * Rev 1.12 17 May 1993 12:21:30 DON
+ * Second checkin for Creator Path updates. Only MAC isn't working
+ *
+ * Rev 1.11 29 Oct 1992 16:55:24 BARRY
+ * Added linkOnly BOOLEAN to NTFS osinfo.
+ *
+ * Rev 1.10 14 Aug 1992 11:42:34 BARRY
+ * Changes for MTF 4.0.
+ *
+ * Rev 1.9 23 Jul 1992 10:08:40 STEVEN
+ * added short filename to osinfo
+ *
+ * Rev 1.8 08 Jul 1992 15:22:46 BARRY
+ * Updated SMS OS info for encapsulated 4.0 support.
+ *
+ * Rev 1.7 28 Feb 1992 13:04:42 STEVEN
+ * step one for varible length paths
+ *
+ * Rev 1.6 06 Feb 1992 09:36:22 BARRY
+ * Don't need to always include SMSCONST.H and always define SMS os info.
+ *
+ * Rev 1.5 29 Jan 1992 13:44:38 BARRY
+ * Added volume name to SMS os info.
+ *
+ * Rev 1.4 12 Dec 1991 16:14:26 BARRY
+ * Update SMS OS info structure.
+ *
+ * Rev 1.3 13 Nov 1991 15:29:30 BARRY
+ * SMS OS info changes.
+ *
+ * Rev 1.2 31 Oct 1991 16:29:32 BARRY
+ * TRICYCLE: Added SMS OS info and LoriB's changes to OS/2 OS info for ACL.
+ *
+ * Rev 1.1 14 Aug 1991 14:20:52 DAVIDH
+ * Added proDosInfo to AFP file and directory structure.
+ *
+ * Rev 1.0 09 May 1991 13:31:16 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef osinfo_h
+#define osinfo_h
+
+typedef struct NOV_FILE_OS_INFO {
+ UINT32 ownerID; /* File owner, default = 0 */
+ UINT32 fileAttribs; /* All attribs in one long word */
+ UINT32 lastModifierID; /* Bindery ID of last file writer */
+ UINT32 archiverID; /* Bindery ID of backup operator */
+ UINT16 inheritedRights; /* Inherited rights, default=ffff */
+} NOV_FILE_OS_INFO, *NOV_FILE_OS_INFO_PTR;
+
+
+typedef struct NOV_DIR_OS_INFO {
+ UINT32 owner_id; /* Dir owner, default = 0 */
+ UINT32 dirAttribs; /* All attribs in one long word */
+ UINT32 maxSpace; /* Max dir space, default = 0 */
+ UINT16 inheritedRights; /* Inherited rights, default=ffff */
+} NOV_DIR_OS_INFO, *NOV_DIR_OS_INFO_PTR;
+
+
+typedef struct AFP_FILE_OS_INFO {
+ UINT8 finder[32]; /* Finder info, default=all zeros */
+ CHAR longName[32]; /* Mac name (Pascal-style string) */
+ UINT32 ownerID; /* Bindery ID of file owner */
+ UINT32 fileAttribs; /* All attribs in one long word */
+ CHAR proDosInfo[6]; /* ProDos info, default=all zeros */
+ UINT32 lastModifierID; /* Bindery ID of last file writer */
+ UINT32 archiverID; /* Bindery ID of backup operator */
+ UINT16 inheritedRights; /* Inherited rights, default=ffff */
+} AFP_FILE_OS_INFO, *AFP_FILE_OS_INFO_PTR;
+
+
+typedef struct AFP_DIR_OS_INFO {
+ UINT8 finder[32]; /* Finder info, default=all zeros */
+ UINT32 ownerID; /* Bindery ID of directory owner */
+ UINT16 longPath; /* Mac path */
+ UINT16 longPathLength; /* Length of Mac path */
+ CHAR proDosInfo[6]; /* ProDos info, default=all zeros */
+ UINT32 maxSpace; /* Max dir space, default = 0 */
+ UINT32 dirAttribs; /* All attribs in one long word */
+ UINT16 inheritedRights; /* Inherited rights, default=ffff */
+} AFP_DIR_OS_INFO, *AFP_DIR_OS_INFO_PTR;
+
+
+/* OS2's File system info */
+typedef struct OS2_FILE_OS_INFO {
+ UINT16 fileAttributes; /* OS/2 attributes */
+ UINT32 allocSize; /* Disk space allocated for file */
+ UINT16 longName; /* HPFS or other long name */
+ UINT16 longNameLength; /* Length of above */
+}OS2_FILE_OS_INFO, *OS2_FILE_OS_INFO_PTR;
+
+
+typedef struct OS2_DIR_OS_INFO {
+ UINT16 dirAttributes; /* OS/2 attributes */
+ UINT16 path; /* HPFS or other long path */
+ UINT16 pathLength; /* length of above */
+} OS2_DIR_OS_INFO, *OS2_DIR_OS_INFO_PTR;
+
+
+/*
+ * Info for SMS FDBs and DDBs.
+ */
+typedef struct _SMS_OS_INFO *SMS_OS_INFO_PTR;
+typedef struct _SMS_OS_INFO {
+ UINT32 attrib; /* SMS attributes (can't be mapped) */
+ BOOLEAN modified; /* Is the object's modified bit set? */
+ UINT32 creator_name_space; /* SMS value for the creator name space */
+ /* Novell's imposed max volume length */
+ CHAR volume[ 17 ]; /* (the extra character is for the ':') */
+} SMS_OS_INFO;
+
+
+/* NT's File system info */
+typedef struct NT_FILE_OS_INFO {
+ UINT32 file_attributes;
+ UINT16 short_name_offset;
+ UINT16 short_name_size;
+ BOOLEAN linkOnly;
+}NT_FILE_OS_INFO, *NT_FILE_OS_INFO_PTR;
+
+
+typedef struct NT_DIR_OS_INFO {
+ UINT32 dir_attributes ;
+} NT_DIR_OS_INFO, *NT_DIR_OS_INFO_PTR;
+
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/overwrit.h b/private/utils/ntbackup/inc/overwrit.h
new file mode 100644
index 000000000..db39d509d
--- /dev/null
+++ b/private/utils/ntbackup/inc/overwrit.h
@@ -0,0 +1,29 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: overwrit.h
+
+ Description:
+
+ Location:
+
+
+ $Log: G:/UI/LOGFILES/OVERWRIT.H_V $
+
+ Rev 1.1 04 Oct 1992 19:48:38 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:36:50 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _overwrit_h_
+#define _overwrit_h_
+
+VOID UI_OverwriteTape(
+ DBLK_PTR vcb_ptr ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/parstab.h b/private/utils/ntbackup/inc/parstab.h
new file mode 100644
index 000000000..72d7eb457
--- /dev/null
+++ b/private/utils/ntbackup/inc/parstab.h
@@ -0,0 +1,333 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: parstab.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: J:/LOGFILES/PARSTAB.H_V $
+ *
+ * Rev 1.4 23 Sep 1993 14:08:44 DON
+ * Define the '[' character as IMAGE_START only if FS_IMAGE is defined else ANY_CHAR
+ *
+ * Rev 1.3 13 Aug 1993 15:01:34 TIMN
+ * Changed ALPHA define to ALETTER due to DECs ALPHA machine conflicts
+ *
+ * Rev 1.2 09 Feb 1993 13:54:18 MARILYN
+ * for the nlm, '=' must be an alpha for the directory services path to
+ * parse correctly.
+ *
+ * Rev 1.1 02 Apr 1992 10:58:06 CARLS
+ * changed SPACE from ANY_CHAR to GRAPHIC
+ *
+ * Rev 1.0 09 May 1991 13:31:18 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+
+/* states */
+#define INITIAL 0
+#define DRV_REL 1
+#define MAC_SPC 2
+#define DOS 3
+#define IM_NAME 4
+#define OS2 5
+#define IM_DONE 6
+#define DRVDONE 7
+#define FILEDON 8
+#define ALLDON 9
+#define ERROR 10
+#define REM_DRV 11
+#define UNKNOWN 12
+
+#define COLEN 0
+#define PERIOD 1
+#define BK_SLASH 2
+#define END_OS 3
+#define ALETTER 4
+#define NUMERIC 5
+#define SPECIAL 6
+#define GRAPHIC 7
+#define ANY_CHAR 8
+#define REMOT_CHAR 9
+#define IMAGE_START 10
+#define DRV_DONE 11
+
+static CHAR ascii[] = {
+/* 0 */ END_OS ,
+/* 1 */ GRAPHIC,
+/* 2 */ GRAPHIC,
+/* 3 */ GRAPHIC,
+/* 4 */ GRAPHIC,
+/* 5 */ GRAPHIC,
+/* 6 */ GRAPHIC,
+/* 7 */ GRAPHIC,
+/* 8 */ GRAPHIC,
+/* 9 */ GRAPHIC,
+/* 10 */ GRAPHIC,
+/* 11 */ GRAPHIC,
+/* 12 */ GRAPHIC,
+/* 13 */ GRAPHIC,
+/* 14 */ GRAPHIC,
+/* 15 */ GRAPHIC,
+/* 16 */ GRAPHIC,
+/* 17 */ GRAPHIC,
+/* 18 */ GRAPHIC,
+/* 19 */ GRAPHIC,
+/* 20 */ GRAPHIC,
+/* 21 */ GRAPHIC,
+/* 22 */ GRAPHIC,
+/* 23 */ GRAPHIC,
+/* 24 */ GRAPHIC,
+/* 25 */ GRAPHIC,
+/* 26 */ GRAPHIC,
+/* 27 */ GRAPHIC,
+/* 28 */ GRAPHIC,
+/* 29 */ GRAPHIC,
+/* 30 */ GRAPHIC,
+/* 31 */ GRAPHIC,
+/* SPACE*/ GRAPHIC,
+/* ! */ SPECIAL,
+/* " */ ANY_CHAR,
+/* # */ SPECIAL,
+/* $ */ SPECIAL,
+/* % */ SPECIAL,
+/* & */ SPECIAL,
+/* ' */ SPECIAL,
+/* ( */ SPECIAL,
+/* ) */ SPECIAL,
+/* * */ SPECIAL, /* removed after token grabed */
+/* + */ REMOT_CHAR,
+/* , */ ANY_CHAR,
+/* - */ SPECIAL,
+/* . */ PERIOD,
+/* / */ ANY_CHAR ,
+/* 0 */ NUMERIC ,
+/* 1 */ NUMERIC ,
+/* 2 */ NUMERIC ,
+/* 3 */ NUMERIC ,
+/* 4 */ NUMERIC ,
+/* 5 */ NUMERIC ,
+/* 6 */ NUMERIC ,
+/* 7 */ NUMERIC ,
+/* 8 */ NUMERIC ,
+/* 9 */ NUMERIC ,
+/* : */ COLEN,
+/* ; */ ANY_CHAR,
+/* < */ ANY_CHAR,
+#ifdef OS_NLM
+/* = */ ALETTER,
+#else
+/* = */ ANY_CHAR,
+#endif
+/* > */ ANY_CHAR,
+/* ? */ SPECIAL, /* removed after token grabbed */
+/* @ */ SPECIAL,
+/* A */ ALETTER,
+/* B */ ALETTER,
+/* C */ ALETTER,
+/* D */ ALETTER,
+/* E */ ALETTER,
+/* F */ ALETTER,
+/* G */ ALETTER,
+/* H */ ALETTER,
+/* I */ ALETTER,
+/* J */ ALETTER,
+/* K */ ALETTER,
+/* L */ ALETTER,
+/* M */ ALETTER,
+/* N */ ALETTER,
+/* O */ ALETTER,
+/* P */ ALETTER,
+/* Q */ ALETTER,
+/* R */ ALETTER,
+/* S */ ALETTER,
+/* T */ ALETTER,
+/* U */ ALETTER,
+/* V */ ALETTER,
+/* W */ ALETTER,
+/* X */ ALETTER,
+/* Y */ ALETTER,
+/* Z */ ALETTER,
+#if defined(FS_IMAGE)
+/* [ */ IMAGE_START,
+#else
+/* [ */ ANY_CHAR,
+#endif
+/* \ */ BK_SLASH,
+/* ] */ ANY_CHAR,
+/* ^ */ SPECIAL,
+/* _ */ SPECIAL,
+/* ` */ SPECIAL,
+/* a */ ALETTER,
+/* b */ ALETTER,
+/* c */ ALETTER,
+/* d */ ALETTER,
+/* e */ ALETTER,
+/* f */ ALETTER,
+/* g */ ALETTER,
+/* h */ ALETTER,
+/* i */ ALETTER,
+/* j */ ALETTER,
+/* k */ ALETTER,
+/* l */ ALETTER,
+/* m */ ALETTER,
+/* n */ ALETTER,
+/* o */ ALETTER,
+/* p */ ALETTER,
+/* q */ ALETTER,
+/* r */ ALETTER,
+/* s */ ALETTER,
+/* t */ ALETTER,
+/* u */ ALETTER,
+/* v */ ALETTER,
+/* w */ ALETTER,
+/* x */ ALETTER,
+/* y */ ALETTER,
+/* z */ ALETTER,
+/* { */ SPECIAL,
+/* | */ ANY_CHAR,
+/* } */ SPECIAL,
+/* ~ */ SPECIAL,
+/* 127 */ ALETTER,
+/* 128 */ ALETTER,
+/* 129 */ ALETTER,
+/* 130 */ ALETTER,
+/* 131 */ ALETTER,
+/* 132 */ ALETTER,
+/* 133 */ ALETTER,
+/* 134 */ ALETTER,
+/* 135 */ ALETTER,
+/* 136 */ ALETTER,
+/* 137 */ ALETTER,
+/* 138 */ ALETTER,
+/* 139 */ ALETTER,
+/* 140 */ ALETTER,
+/* 141 */ ALETTER,
+/* 142 */ ALETTER,
+/* 143 */ ALETTER,
+/* 144 */ ALETTER,
+/* 145 */ ALETTER,
+/* 146 */ ALETTER,
+/* 147 */ ALETTER,
+/* 148 */ ALETTER,
+/* 149 */ ALETTER,
+/* 150 */ ALETTER,
+/* 151 */ ALETTER,
+/* 152 */ ALETTER,
+/* 153 */ ALETTER,
+/* 154 */ ALETTER,
+/* 155 */ ALETTER,
+/* 156 */ ALETTER,
+/* 157 */ ALETTER,
+/* 158 */ ALETTER,
+/* 159 */ ALETTER,
+/* 160 */ ALETTER,
+/* 161 */ ALETTER,
+/* 162 */ ALETTER,
+/* 163 */ ALETTER,
+/* 164 */ ALETTER,
+/* 165 */ ALETTER,
+/* 166 */ ALETTER,
+/* 167 */ ALETTER,
+/* 168 */ ALETTER,
+/* 169 */ ALETTER,
+/* 170 */ ALETTER,
+/* 171 */ ALETTER,
+/* 172 */ ALETTER,
+/* 173 */ ALETTER,
+/* 174 */ ALETTER,
+/* 175 */ ALETTER,
+/* 176 */ ALETTER,
+/* 177 */ ALETTER,
+/* 178 */ ALETTER,
+/* 179 */ ALETTER,
+/* 180 */ ALETTER,
+/* 181 */ ALETTER,
+/* 182 */ ALETTER,
+/* 183 */ ALETTER,
+/* 184 */ ALETTER,
+/* 185 */ ALETTER,
+/* 186 */ ALETTER,
+/* 187 */ ALETTER,
+/* 188 */ ALETTER,
+/* 189 */ ALETTER,
+/* 190 */ ALETTER,
+/* 191 */ ALETTER,
+/* 192 */ ALETTER,
+/* 193 */ ALETTER,
+/* 194 */ ALETTER,
+/* 195 */ ALETTER,
+/* 196 */ ALETTER,
+/* 197 */ ALETTER,
+/* 198 */ ALETTER,
+/* 199 */ ALETTER,
+/* 200 */ ALETTER,
+/* 201 */ ALETTER,
+/* 202 */ ALETTER,
+/* 203 */ ALETTER,
+/* 204 */ ALETTER,
+/* 205 */ ALETTER,
+/* 206 */ ALETTER,
+/* 207 */ ALETTER,
+/* 208 */ ALETTER,
+/* 209 */ ALETTER,
+/* 210 */ ALETTER,
+/* 211 */ ALETTER,
+/* 212 */ ALETTER,
+/* 213 */ ALETTER,
+/* 214 */ ALETTER,
+/* 215 */ ALETTER,
+/* 216 */ ALETTER,
+/* 217 */ ALETTER,
+/* 218 */ ALETTER,
+/* 219 */ ALETTER,
+/* 220 */ ALETTER,
+/* 221 */ ALETTER,
+/* 222 */ ALETTER,
+/* 223 */ ALETTER,
+/* 224 */ ALETTER,
+/* 225 */ ALETTER,
+/* 226 */ ALETTER,
+/* 227 */ ALETTER,
+/* 228 */ ALETTER,
+/* 229 */ ALETTER,
+/* 230 */ ALETTER,
+/* 231 */ ALETTER,
+/* 232 */ ALETTER,
+/* 233 */ ALETTER,
+/* 234 */ ALETTER,
+/* 235 */ ALETTER,
+/* 236 */ ALETTER,
+/* 237 */ ALETTER,
+/* 238 */ ALETTER,
+/* 239 */ ALETTER,
+/* 240 */ ALETTER,
+/* 241 */ ALETTER,
+/* 242 */ ALETTER,
+/* 243 */ ALETTER,
+/* 244 */ ALETTER,
+/* 245 */ ALETTER,
+/* 246 */ ALETTER,
+/* 247 */ ALETTER,
+/* 248 */ ALETTER,
+/* 249 */ ALETTER,
+/* 250 */ ALETTER,
+/* 251 */ ALETTER,
+/* 252 */ ALETTER,
+/* 253 */ ALETTER,
+/* 254 */ ALETTER,
+/* 255 */ ALETTER
+};
+
+
+
+
diff --git a/private/utils/ntbackup/inc/part.h b/private/utils/ntbackup/inc/part.h
new file mode 100644
index 000000000..cfd7398a6
--- /dev/null
+++ b/private/utils/ntbackup/inc/part.h
@@ -0,0 +1,75 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: part.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: G:/LOGFILES/PART.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:32:22 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _part_h_
+#define _part_h_
+
+
+#define BAD_SECTOR_PATTERN_SIZE 16
+#define PART_NAME_SIZE 16
+
+extern CHAR bad_sector_pattern[];
+
+INT16 PartitionOperation( INT16 mode,
+ INT16 drive,
+ LOCAL_IMAGE_DLE_INFO_PTR part_info,
+ UINT32 offset, /* from the start of the partition */
+ UINT8_PTR buff,
+ UINT8_PTR split_buf,
+ UINT16 length,
+ UINT16_PTR bytes_done );
+
+#define READ_PARTITION_MODE 0
+#define WRITE_PARTITION_MODE 1
+
+
+typedef struct PART_TAB {
+ UINT8 boot ;
+ UINT8 head_start ;
+ UINT8 sec_start ;
+ UINT8 cyl_start ;
+ UINT8 sys_ind ;
+ UINT8 head_end ;
+ UINT8 sec_end ;
+ UINT8 cyl_end ;
+ UINT32 start_rel ;
+ UINT32 num_sectors ;
+} PART_TAB, *PART_TAB_PTR;
+
+#define MAX_BUF_SIZE (4*1024)
+#define SMALLEST_SECTOR_SIZE 128
+
+CHAR d_info( INT16 *no_flop, INT16 *no_hard, INT16 *no_dos ) ;
+INT16 GetPartitionTable( CHAR drive, UINT16 *sector_size, PART_TAB_PTR part_tab ) ;
+VOID GetDriveParm( CHAR drive, INT16 *num_heads, INT16 *num_cyl, INT16 *num_sect ) ;
+UINT16 Find64KBound( CHAR_PTR buf, UINT16 size );
+UINT16 OffsetLocation( UINT32 offset,
+ LOCAL_IMAGE_DLE_INFO_PTR part_info,
+ UINT16_PTR sector,
+ UINT16_PTR head,
+ UINT16_PTR cyl );
+
+#define BAD_BLOCK_MAP 1
+#define GOOD_BLOCK 2
+#define BAD_BLOCK 3
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/password.h b/private/utils/ntbackup/inc/password.h
new file mode 100644
index 000000000..d712857b7
--- /dev/null
+++ b/private/utils/ntbackup/inc/password.h
@@ -0,0 +1,84 @@
+/************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: password.h
+
+ Description: This file contains the definitions, macros, and function
+ for passwords for tapes and backup sets.
+
+ $Log: G:/UI/LOGFILES/PASSWORD.H_V $
+
+ Rev 1.10 20 Jan 1993 19:55:38 MIKEP
+fix nt warning
+
+ Rev 1.9 04 Oct 1992 19:48:38 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.8 30 Sep 1992 10:46:52 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.7 06 Feb 1992 17:43:40 JOHNWT
+moved pwdb things to appdefs.h
+
+ Rev 1.6 06 Jan 1992 13:50:16 JOHNWT
+changes for remove pw protecton
+
+ Rev 1.5 23 Dec 1991 15:50:34 JOHNWT
+PW for PWDB II
+
+ Rev 1.4 16 Dec 1991 15:54:22 JOHNWT
+added parent window to EnterDBPassword
+
+ Rev 1.3 14 Dec 1991 13:48:30 JOHNWT
+changes for pw to enable pwdb
+
+ Rev 1.2 04 Dec 1991 17:54:50 MIKEP
+add fid to password queue
+
+**************************/
+
+#ifndef PSWD_H
+#define PSWD_H
+
+// defines login password database
+
+#define DBPW_NOT_VERIFIED 0 /* PWDB lock pw has not been verified */
+#define DBPW_VERIFIED 1 /* PWDB lock pw verified or no lock */
+#define DBPW_LOCKOUT 2 /* exceeded max attempts at lock pw */
+
+#define DBPW_ALLOW_NEW 0 /* allow input of new lock password */
+#define DBPW_NO_NEW 1 /* do not allow new lock password */
+
+#define MAX_ATTEMPTS 3 /* allow max of 3 bad entries */
+
+// The structure for tape passwords.
+
+typedef struct pswd_object {
+ Q_ELEM q_elem;
+ UINT32 tape_fid;
+ UINT16 encrypt_algor;
+ UINT16 cbPasswordSize; /* byte length of password w/o NULL term*/
+ CHAR achPassword[ MAX_TAPE_PASSWORD_LEN ]; /* NOT NULL TERMINATED!*/
+} PSWD_OBJECT, *PSWD_OBJECT_PTR;
+
+PSWD_OBJECT_PTR PSWD_GetFirstPSWD( VOID );
+PSWD_OBJECT_PTR PSWD_GetNextPSWD( PSWD_OBJECT_PTR );
+
+INT16 PSWD_CheckForPassword( UINT32, INT16 );
+
+INT16 PSWD_AddPassword( INT8_PTR, INT16, UINT16, UINT32 );
+INT16 PSWD_InitPSWDList( VOID );
+INT16 PSWD_FreePSWDList( VOID );
+
+VOID SaveDLEPassword( CDS_PTR, GENERIC_DLE_PTR, CHAR_PTR, CHAR_PTR ) ;
+INT16 CheckThePWDBase( CDS_PTR, GENERIC_DLE_PTR );
+INT16 EnterDBPassword( CDS_PTR, HWND, INT );
+BOOLEAN IsThereADBPassword( VOID );
+INT16 SavePassword( CDS_PTR, CHAR_PTR, CHAR_PTR );
+
+BOOLEAN CollectTapePassword( INT8_PTR, INT16_PTR, UINT16, INT8_PTR, INT16 ) ;
+BOOLEAN VerifyTapePassword( CHAR_PTR, CHAR_PTR, CHAR_PTR, UINT16, INT8_PTR, INT16, INT8_PTR, INT16, UINT32 ) ;
+VOID CryptPassword( INT16, UINT16, INT8_PTR, INT16 ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/pchstop.h b/private/utils/ntbackup/inc/pchstop.h
new file mode 100644
index 000000000..aede1d3d9
--- /dev/null
+++ b/private/utils/ntbackup/inc/pchstop.h
@@ -0,0 +1,25 @@
+
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: pchstop.h
+
+ Description: Precompiled Header terminator
+
+ $Log: G:/UI/LOGFILES/PCHSTOP.H_V $
+
+ Rev 1.0 20 Oct 1992 14:21:04 GLENN
+Initial revision.
+
+******************************************************************************/
+
+
+
+#ifndef PCHSTOP_H
+
+#define PCHSTOP_H
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/pdtypes.h b/private/utils/ntbackup/inc/pdtypes.h
new file mode 100644
index 000000000..65ebca5b8
--- /dev/null
+++ b/private/utils/ntbackup/inc/pdtypes.h
@@ -0,0 +1,79 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: pdtypes.h
+
+ Description: Defines and prototypes for Password Database Unit
+
+
+ $Log: G:/UI/LOGFILES/PDTYPES.H_V $
+
+ Rev 1.2 04 Oct 1992 19:48:40 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 18 Mar 1992 16:58:58 JOHNWT
+changes for new passdb.c
+
+ Rev 1.0 20 Nov 1991 19:37:34 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef PDTYPES
+
+#define PDTYPES
+
+#include "StdTypes.H"
+
+
+/* Define Maximum sizes */
+
+#define MINIMUM_RECORD_LEN 4
+#define MAX_KEY_LEN 96
+#define MAX_PSWD_LEN 176
+#define MAX_KEY_SIZE MAX_KEY_LEN +1
+#define MAX_PSWD_SIZE MAX_PSWD_LEN +1
+#define MAX_PSWD_RECORD_SIZE MAX_KEY_SIZE + MAX_PSWD_SIZE +1
+
+
+/* The Password Database Record format */
+/*
+** key_name'\0'password_sizepassword_namepadding to max_pswd_record_size
+*/
+
+/* Define error codes returned by the Password Database Interface */
+
+#define PD_NO_ERROR 0
+#define PD_FILE_OPEN_ERROR -300
+#define PD_READ_ERROR -301
+#define PD_NOT_FOUND -302
+#define PD_FULL -303
+#define PD_NULL_HANDLE -304
+#define PD_CLOSE_ERROR -305
+#define PD_WRITE_ERROR -306
+#define PD_MEMORY_ERROR -307
+#define PD_EXCEEDED_RECORD_LENGTH -308
+
+
+/* Structures for the Password Database Interface */
+typedef struct {
+ FILE *fhand ; /* file handle for PWD file */
+ INT32 record_number ; /* record number to seek */
+ CHAR buffer[MAX_PSWD_RECORD_SIZE] ; /* current buffer */
+} DB_HAND, *DB_HAND_PTR ;
+
+
+/* The following prototypes are for the entry points to the Password Database */
+
+/* Open and Close the password database */
+UINT16 PD_Open( DB_HAND_PTR fhand, CHAR_PTR db_name ) ;
+UINT16 PD_Close( DB_HAND_PTR fhand ) ;
+
+/* Read a password from the database and pass it back to the caller */
+INT16 PD_Read( DB_HAND_PTR fhand, CHAR_PTR key, CHAR_PTR pswd ) ;
+
+/* Update the database with a new password */
+UINT16 PD_Write( DB_HAND_PTR fhand, CHAR_PTR key, CHAR_PTR pswd ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/polldrv.h b/private/utils/ntbackup/inc/polldrv.h
new file mode 100644
index 000000000..99e3680ce
--- /dev/null
+++ b/private/utils/ntbackup/inc/polldrv.h
@@ -0,0 +1,71 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: polldrv.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the poll drive manager (PD).
+
+ $Log: G:/UI/LOGFILES/POLLDRV.H_V $
+
+ Rev 1.6 23 Sep 1993 15:49:52 GLENN
+Changed return type on stop polling.
+
+ Rev 1.5 21 Jul 1993 17:02:50 GLENN
+Added PD_WaitUntilSettled () function to wait until poll drive is in a settled state.
+
+ Rev 1.4 16 Jun 1993 16:37:58 GLENN
+Added PD_IsPollDriveBusy().
+
+ Rev 1.3 05 Nov 1992 15:32:36 GLENN
+Changed the default timer delay to 1 second.
+
+ Rev 1.2 04 Oct 1992 19:48:42 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 31 Jan 1992 12:53:54 GLENN
+Added polldrive and eject retry stuff.
+
+ Rev 1.0 20 Nov 1991 19:37:54 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef _POLLDRIVE_H
+#define _POLLDRIVE_H
+
+
+
+#define PD_TIMERDELAY 1 // 1 second
+#define PD_MAX_EJECT_ATTEMPTS 5
+#define PD_MAX_RESTART_ATTEMPTS 2
+
+#define PD_SETTLE_NOCALLBACK 0
+#define PD_SETTLE_NOWAIT 0
+
+#define PD_SETTLE_OK 0
+#define PD_SETTLE_TIMEOUT 1
+#define PD_SETTLE_ERROR 2
+#define PD_SETTLE_NOTINITIALIZED 3
+#define PD_SETTLE_ALREADYWAITING 4
+#define PD_SETTLE_UNKNOWN 5
+
+// FUNCTION PROTOTYPES
+
+BOOL PD_Init ( VOID );
+BOOL PD_Deinit ( VOID );
+BOOL PD_StartPolling ( VOID );
+VOID PD_PollDrive ( VOID );
+BOOL PD_StopPolling ( VOID );
+BOOL PD_AttemptRestart ( VOID );
+VOID PD_EjectTape ( VOID );
+INT PD_SetFrequency ( INT );
+BOOL PD_AttemptRestart ( VOID );
+BOOL PD_IsPollDriveBusy ( VOID );
+INT PD_WaitUntilSettled ( PF_VOID, INT );
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/portdefs.h b/private/utils/ntbackup/inc/portdefs.h
new file mode 100644
index 000000000..1bcc97f27
--- /dev/null
+++ b/private/utils/ntbackup/inc/portdefs.h
@@ -0,0 +1,478 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: portdefs.h
+
+ Description: This file contains common types, etc., necessary for
+ modules to compile with the GUI sub-system
+ in a maner portable between 16 and 32 bit versions
+ of MS-Windows. It is included by the header file:
+ ss_gui.h.
+
+ This file will include the following header files:
+
+ stdtypes.h - Maynard's standard type defines
+
+ *** win3216 has been removed for Einstein ***
+
+ win3216.h - Microsoft's declarations for using
+ 32-bit Windows compatible functions,
+ etc., in a 16-bit application. Only
+ included for 16-bit compiles.
+
+ Note: Much of the definitions in this file are expected
+ to be included in a later release of WIN3216.H or in
+ the next release of the Windows 3.1 beta by Microsoft.
+ If this is the case, all duplicate definitions should
+ be removed from this file to avoid compiler warnings or
+ incorrect definitions.
+
+ $Log: G:/UI/LOGFILES/PORTDEFS.H_V $
+
+ Rev 1.24 05 Mar 1993 09:18:38 MIKEP
+remove macros now defined in NT
+
+ Rev 1.23 12 Feb 1993 15:35:44 STEVEN
+fix the last fix
+
+ Rev 1.22 09 Feb 1993 09:23:52 STEVEN
+remove extra define for MENUSELECT_FLAG
+
+ Rev 1.21 17 Nov 1992 21:42:34 DAVEV
+unicode changes
+
+ Rev 1.20 10 Nov 1992 09:31:42 STEVEN
+fix warnings
+
+ Rev 1.19 01 Nov 1992 16:32:08 DAVEV
+Unicode changes
+
+ Rev 1.18 26 Oct 1992 13:39:10 DAVEV
+fixes for typedefs
+
+ Rev 1.17 15 May 1992 09:00:38 MIKEP
+byte_ptr addition
+
+ Rev 1.16 14 May 1992 18:39:04 STEVEN
+moved _PTR type to stdtypes.h
+
+ Rev 1.15 04 May 1992 15:22:28 JOHNWT
+removed win3216.h for Einstein
+
+ Rev 1.14 28 Apr 1992 14:30:46 MIKEP
+_PTR additions
+
+ Rev 1.13 23 Apr 1992 10:13:22 DAVEV
+Added add'l Unicode/ASCII transparent types
+
+ Rev 1.12 29 Jan 1992 17:58:16 GLENN
+Fixed SET_WM_COMMAND... macro for windows.
+
+ Rev 1.11 15 Jan 1992 15:21:42 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.10 14 Jan 1992 11:37:28 DAVEV
+removed hacks of dos_findfirst,etc.
+
+ Rev 1.9 08 Jan 1992 12:21:32 CHUCKB
+Took out include for win3216.h.
+
+ Rev 1.8 23 Dec 1991 16:34:36 DAVEV
+Latest NT changes
+
+ Rev 1.7 18 Dec 1991 12:01:50 DAVEV
+Added HACK dummy macros for _dos_findfirst/next
+
+ Rev 1.6 12 Dec 1991 17:11:30 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.5 12 Dec 1991 11:37:02 DAVEV
+fixed WM_MDIACTIVATE macros
+
+ Rev 1.4 05 Dec 1991 17:39:38 GLENN
+Added VSCROLL and HSCROLL send messages
+
+ Rev 1.3 02 Dec 1991 17:58:06 DAVEV
+added WM_* msg macros
+
+ Rev 1.2 26 Nov 1991 09:26:22 DAVEV
+Added SEND_EM_SETSET_MSG & SEND_EM_LINESCROLL_MSG macros
+
+ Rev 1.1 22 Nov 1991 13:17:58 DAVEV
+Added MP1 & MP2 types for convience - less typing
+
+ Rev 1.6 20 Nov 1991 17:09:40 DAVEV
+Added definition of WNDPROC (FARPROC)
+
+ Rev 1.5 20 Nov 1991 15:08:08 DAVEV
+Added PM-style macros for packing MPARAM2 parameter values.
+
+ Rev 1.4 19 Nov 1991 12:50:20 DAVEV
+First revision.
+
+******************************************************************************/
+#ifndef PORTDEFS_INCL
+#define PORTDEFS_INCL
+
+/***************************************************************************/
+/* 16-BIT APPLICATION DEFINITIONS */
+/*-------------------------------------------------------------------------*/
+/* The following code is included ONLY if compiling 16-bit */
+/* application version. */
+/***************************************************************************/
+
+#ifndef OS_WIN32 //start of non-OS_WIN32 stuff -----------------------------
+
+//
+// Macros used to eliminate compiler warning generated when formal
+// parameters or local variables are not declared.
+//
+// Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet
+// referenced but will be once the module is completely developed.
+//
+// Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet
+// referenced but will be once the module is completely developed.
+//
+// Use UNREFERENCED_PARAMETER() if a parameter will never be referenced.
+//
+// DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will
+// eventually be made into a null macro to help determine whether there
+// is unfinished work.
+//
+
+#define UNREFERENCED_PARAMETER(p) ((p)=(p))
+#define DBG_UNREFERENCED_PARAMETER(p) ((p)=(p))
+#define DBG_UNREFERENCED_LOCAL_VARIABLE(p) ((p)=(p))
+
+#include "stdtypes.h"
+
+
+
+//---------------------------------------------------------
+// The following are new type defines to simplify porting
+//---------------------------------------------------------
+
+//Window and Dialog procedure parameter and return types
+
+#define MSGID UINT //Message identifier
+#define MPARAM1 UINT //First parameter (previously a WORD type param)
+#define MPARAM2 LONG //Second parameter (previously a LONG type param)
+#define WINRESULT LONG //Window proc return value
+#define DLGRESULT INT //Dialog proc return value
+
+#define MP1 MPARAM1 //Convience type - less typing
+#define MP2 MPARAM2 //Convience type - less typing
+
+
+// Macros for stuffing data into window message parameters...
+
+// Only macros for MP2 are supported for Win 3.x
+
+#define MP2FROMPVOID(p) ((MP2)(p))
+#define MP2FROMHWND(p) ((MP2)(p))
+#define MP2FROMLONG(l) (l)
+#define MP2FROMSHORT(s) ((MP2)(s))
+#define MP2FROM2SHORT(s1,s2) MAKELONG(s1,s2)
+//
+// Macros used to access message parameters for messages which
+// use different parameter packing between 32-bit and 16-bit versions
+// of Windows.
+// These will (hopefully) be provided by future releases of Win32 &
+// Win 3.1. However, the macro name may be different since only the
+// names of the WM_COMMAND macros where explicitly stated in the
+// Microsoft Win 3.0 to Win32 porting document.
+//
+#define GET_WM_ACTIVE_STATE(mp1,mp2) LOWORD(mp1)
+#define GET_WM_ACTIVE_FMINIMIZED(mp1,mp2) LOWORD(mp2)
+#define GET_WM_ACTIVE_HWND(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_CHARTOITEM_CHAR(mp1,mp2) LOWORD(mp1)
+#define GET_WM_CHARTOITEM_POS(mp1,mp2) LOWORD(mp2)
+#define GET_WM_CHARTOITEM_HWND(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_COMMAND_ID(mp1,mp2) LOWORD(mp1)
+#define GET_WM_COMMAND_CMD(mp1,mp2) HIWORD(mp2)
+#define GET_WM_COMMAND_HWND(mp1,mp2) LOWORD(mp2)
+
+#define SET_WM_COMMAND_PARAMS(id,cmd,hwnd,mp1,mp2) ((mp1=(MP1)(id)),(mp2=(MP2)MAKELONG(hwnd,cmd)))
+
+#define GET_WM_MENUSELECT_ID(mp1,mp2) LOWORD(mp1)
+#define GET_WM_MENUSELECT_FLAGS(mp1,mp2) LOWORD(mp2)
+
+#define GET_WM_MDISETMENU_HMENUFRAME(mp1,mp2) LOWORD(mp2)
+#define GET_WM_MDISETMENU_HMENUWINDOW(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_MENUCHAR_CHAR(mp1,mp2) LOWORD(mp1)
+#define GET_WM_MENUCHAR_HMENU(mp1,mp2) LOWORD(mp2)
+#define GET_WM_MENUCHAR_FMENU(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_PARENTNOTIFY_MSG(mp1,mp2) LOWORD(mp1)
+// The following 2 are only used if msg is WM_CREATE or WM_DESTROY
+#define GET_WM_PARENTNOTIFY_ID(mp1,mp2) LOWORD(mp2)
+#define GET_WM_PARENTNOTIFY_HWNDCHILD(mp1,mp2) HIWORD(mp2)
+// otherwise use these 2 macros to extract x & y cursor coords.
+#define GET_WM_PARENTNOTIFY_X(mp1,mp2) LOWORD(mp2)
+#define GET_WM_PARENTNOTIFY_Y(mp1,mp2) HIWORD(mp2)
+
+
+#define GET_WM_VKEYTOITEM_CODE(mp1,mp2) LOWORD(mp1)
+#define GET_WM_VKEYTOITEM_ITEM(mp1,mp2) LOWORD(mp2)
+#define GET_WM_VKEYTOITEM_HWND(mp1,mp2) HIWORD(mp2)
+
+//Note: Under Windows 3.x, WM_GETSEL both of the following
+// parameters will always be NULL. Under NT, these may
+// be NULL or valid pointers to double word (LONG) values
+#define GET_WM_GETSEL_PSTART(mp1,mp2) NULL
+#define GET_WM_GETSEL_PEND(mp1,mp2) NULL
+
+#define GET_WM_LINESCROLL_NLINESVERT(mp1,mp2) LOWORD(mp2)
+#define GET_WM_LINESCROLL_NLINESHORZ(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_SETSEL_START(mp1,mp2) LOWORD(mp2)
+#define GET_WM_SETSEL_END(mp1,mp2) HIWORD(mp2)
+
+
+#define GET_WM_HSCROLL_CODE(mp1,mp2) LOWORD(mp1)
+#define GET_WM_HSCROLL_POS(mp1,mp2) LOWORD(mp2)
+#define GET_WM_HSCROLL_HWND(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_VSCROLL_CODE(mp1,mp2) LOWORD(mp1)
+#define GET_WM_VSCROLL_POS(mp1,mp2) LOWORD(mp2)
+#define GET_WM_VSCROLL_HWND(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_MDIACTIVATE_DEACTIVATE(mp1,mp2) HIWORD(mp2)
+#define GET_WM_MDIACTIVATE_ACTIVATE(mp1,mp2) LOWORD(mp2)
+
+// DDE message parameters - NOTE: DDE is not supported in the current
+// release of NT. Therefore, these macros may be coded but should not
+// be allowed to executed in the NT version until a DDE supporting
+// release is recieved.
+
+#define GET_WM_DDE_ACK_HWND(mp1,mp2) LOWORD(mp1)
+//TOPIC and APPL are recieved as a response to a WM_DDE_INITIATE only.
+#define GET_WM_DDE_ACK_APPL(mp1,mp2) LOWORD(mp2)
+#define GET_WM_DDE_ACK_TOPIC(mp1,mp2) HIWORD(mp2)
+
+//STATUS is recieved as a response to all other messages
+#define GET_WM_DDE_ACK_STATUS(mp1,mp2) LOWORD(mp2)
+
+//COMMANDS is recieved as a response to WM_DDE_EXECUTE only.
+#define GET_WM_DDE_ACK_COMMANDS(mp1,mp2) HIWORD(mp2)
+
+//ITEM is recieved as a response to all other messages
+#define GET_WM_DDE_ACK_ITEM(mp1,mp2) HIWORD(mp2)
+//---------------------------------------------------------------
+
+#define GET_WM_DDE_ADVISE_HWND(mp1,mp2) LOWORD(mp1)
+#define GET_WM_DDE_ADVISE_OPTIONS(mp1,mp2) LOWORD(mp2)
+#define GET_WM_DDE_ADVISE_ITEM(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_DDE_DATA_HWND(mp1,mp2) LOWORD(mp1)
+#define GET_WM_DDE_DATA_DATA(mp1,mp2) LOWORD(mp2)
+#define GET_WM_DDE_DATA_ITEM(mp1,mp2) HIWORD(mp2)
+
+#define GET_WM_DDE_POKE_HWND(mp1,mp2) LOWORD(mp1)
+#define GET_WM_DDE_POKE_DATA(mp1,mp2) LOWORD(mp2)
+#define GET_WM_DDE_POKE_ITEM(mp1,mp2) HIWORD(mp2)
+
+
+// Use these macros to send or post the appropriate message:
+// Example:
+//
+// Old 16-bit code:
+// SendDlgItemMessage( hDlg, id, EM_SETSEL, 0, MAKELONG ( start,end ));
+//
+// New portable code:
+// SEND_EM_SETSEL_MSG( hDlg, id, start, end );
+//
+
+#define SEND_EM_SETSEL_MSG(hDlg,id,nStart,nEnd) \
+ SendDlgItemMessage(hDlg,id,EM_SETSEL,0,MAKELONG(nStart,nEnd))
+
+#define SEND_EM_LINESCROLL_MSG(hDlg,id,nLinesVert,nLinesHorz) \
+ SendDlgItemMessage(hDlg,id,EM_LINESCROLL,0,MAKELONG(nLinesVert,nLinesHorz))
+
+#define SEND_WM_MENUSELECT_MSG(hwnd,item,flags,hMenu) \
+ SendMessage (hwnd,WM_MENUSELECT,item,MAKELONG (flags,hMenu))
+
+#define POST_WM_COMMAND_MSG(hwndTo,idFrom,hwndFrom,cmd) \
+ PostMessage (hwndTo,WM_COMMAND,idFrom,MAKELONG(hwndFrom,cmd))
+
+#define SEND_WM_VSCROLL_MSG(hwndTo,code,pos,hwndFrom) \
+ SendMessage (hwndTo,WM_VSCROLL,code,MAKELONG(pos,hwndFrom))
+
+#define SEND_WM_HSCROLL_MSG(hwndTo,code,pos,hwndFrom) \
+ SendMessage (hwndTo,WM_HSCROLL,code,MAKELONG(pos,hwndFrom))
+
+/***************************************************************************/
+/* 32-BIT APPLICATION DEFINITIONS */
+/*-------------------------------------------------------------------------*/
+/* The following code is included ONLY if compiling 32-bit */
+/* application version. (Win32 or NT) */
+/***************************************************************************/
+
+// NOTE: the following marcos are now available in PTYPES32.H
+// - which is now being included - and are now commented out below:
+/*
+ GET_WM_CHARTOITEM_CHAR
+ GET_WM_CHARTOITEM_HWND
+ GET_WM_COMMAND_HWND
+ GET_WM_MENUCHAR_CHAR
+ GET_WM_MENUCHAR_HMENU
+ GET_WM_MENUCHAR_FMENU
+ GET_WM_PARENTNOTIFY_MSG
+ GET_WM_PARENTNOTIFY_ID
+ GET_WM_PARENTNOTIFY_HWNDCHILD
+ GET_WM_PARENTNOTIFY_X
+ GET_WM_PARENTNOTIFY_Y
+ GET_WM_VKEYTOITEM_CODE
+ GET_WM_VKEYTOITEM_HWND
+ GET_WM_HSCROLL_HWND
+ GET_WM_VSCROLL_HWND
+ GET_WM_DDE_ACK_STATUS
+ GET_WM_DDE_ACK_ITEM
+ GET_WM_DDE_ADVISE_ITEM
+ GET_WM_DDE_DATA_ITEM
+ GET_WM_DDE_POKE_ITEM
+*/
+
+#else //OS_WIN32
+
+#include "stdtypes.h"
+
+
+//---------------------------------------------------------
+// The following are new type defines to simplify porting
+//---------------------------------------------------------
+
+//Window and Dialog procedure parameter and return types
+
+#define MSGID UINT //Message identifier
+#define MPARAM1 WPARAM //First parameter (previously a WORD type param)
+#define MPARAM2 LPARAM //Second parameter (previously a LONG type param)
+#define WINRESULT LRESULT //Window proc return value
+#define DLGRESULT INT //Dialog proc return value
+
+#define MP1 MPARAM1 //Convience type - less typing
+#define MP2 MPARAM2 //Convience type - less typing
+
+
+// Macros for stuffing data into window message parameters...
+
+#define MP1FROM2SHORT(a,b) \
+ ((MP1)(((WORD)(a)) | ((UINT)((WORD)(b))) << 16))
+
+#define MP2FROMPVOID(p) ((MP2)(p))
+#define MP2FROMHWND(p) ((MP2)(p))
+#define MP2FROMLONG(l) (l)
+#define MP2FROMSHORT(s) ((MP2)(s))
+#define MP2FROM2SHORT(s1,s2) MAKELONG(s1,s2)
+//
+// Macros used to access message parameters for messages which
+// use different parameter packing between 32-bit and 16-bit versions
+// of Windows.
+// These will (hopefully) be provided by future releases of Win32 &
+// Win 3.1. However, the macro name may be different since only the
+// names of the WM_COMMAND macros where explicitly stated in the
+// Microsoft Win 3.0 to Win32 porting document.
+//
+#define GET_WM_ACTIVE_STATE(mp1,mp2) LOWORD(mp1)
+#define GET_WM_ACTIVE_FMINIMIZED(mp1,mp2) HIWORD(mp1)
+#define GET_WM_ACTIVE_HWND(mp1,mp2) ((HWND)(mp2))
+
+#define SET_WM_COMMAND_PARAMS(id,cmd,hwnd,mp1,mp2) (mp1=(MP1)(id|cmd<<16),mp2=(MP2)hwnd)
+
+#define GET_WM_MENUSELECT_ID(mp1,mp2) LOWORD(mp1)
+
+#define GET_WM_MDIACTIVATE_DEACTIVATE(mp1,mp2) ((HWND)(mp1))
+#define GET_WM_MDIACTIVATE_ACTIVATE(mp1,mp2) ((HWND)(mp2))
+
+#define GET_WM_MDISETMENU_HMENUFRAME(mp1,mp2) ((HWND)(mp1))
+#define GET_WM_MDISETMENU_HMENUWINDOW(mp1,mp2) ((HWND)(mp2))
+
+//Note: Under Windows 3.x, WM_GETSEL both of the following
+// parameters will always be NULL. Under NT, these may
+// be NULL or valid pointers to double word (LONG) values
+#define GET_WM_GETSEL_PSTART(mp1,mp2) ((LPLONG)(mp1))
+#define GET_WM_GETSEL_PEND(mp1,mp2) ((LPLONG)(mp2))
+
+#define GET_WM_LINESCROLL_NLINESVERT(mp1,mp2) ((INT)(mp1))
+#define GET_WM_LINESCROLL_NLINESHORZ(mp1,mp2) ((INT)(mp2))
+
+#define GET_WM_SETSEL_START(mp1,mp2) ((INT)(mp1))
+#define GET_WM_SETSEL_END(mp1,mp2) ((INT)(mp2))
+
+
+// DDE message parameters - NOTE: DDE is not supported in the current
+// release of NT. Therefore, these macros may be coded but should not
+// be allowed to executed in the NT version until a DDE supporting
+// release is recieved.
+
+#define GET_WM_DDE_ACK_HWND(mp1,mp2) ((HWND)(mp1))
+//TOPIC and APPL are recieved as a response to a WM_DDE_INITIATE only.
+#define GET_WM_DDE_ACK_APPL(mp1,mp2) LOWORD(mp2)
+#define GET_WM_DDE_ACK_TOPIC(mp1,mp2) HIWORD(mp2)
+
+//STATUS is recieved as a response to all other messages
+/*#define GET_WM_DDE_ACK_STATUS(mp1,mp2) \
+ ((PDDEACKSTRUCT)(mp2)->wStatus)*/
+
+//COMMANDS is recieved as a response to WM_DDE_EXECUTE only.
+#define GET_WM_DDE_ACK_COMMANDS(mp1,mp2) \
+ ((PDDEACKSTRUCT)(mp2)->aItemORhCommands)
+
+//ITEM is recieved as a response to all other messages
+/*#define GET_WM_DDE_ACK_ITEM(mp1,mp2) \
+ ((PDDEACKSTRUCT)(mp2)->aItemORhCommands)*/
+//---------------------------------------------------------------
+
+#define GET_WM_DDE_ADVISE_HWND(mp1,mp2) ((HWND)(mp1))
+#define GET_WM_DDE_ADVISE_OPTIONS(mp1,mp2) \
+ ((PDDEADVISESTRUCT)(mp2)->hOptions)
+/*#define GET_WM_DDE_ADVISE_ITEM(mp1,mp2) \
+ ((PDDEADVISESTRUCT)(mp2)->aItem)*/
+
+#define GET_WM_DDE_DATA_HWND(mp1,mp2) ((HWND)(mp1))
+#define GET_WM_DDE_DATA_DATA(mp1,mp2) \
+ ((PDDEDATASTRUCT)(mp2)->hData)
+/*#define GET_WM_DDE_DATA_ITEM(mp1,mp2) \
+ ((PDDEDATASTRUCT)(mp2)->hItem)*/
+
+#define GET_WM_DDE_POKE_HWND(mp1,mp2) ((HWND)(mp1))
+#define GET_WM_DDE_POKE_DATA(mp1,mp2) \
+ ((PDDEPOKESTRUCT)(mp2)->hData)
+/*#define GET_WM_DDE_POKE_ITEM(mp1,mp2) \
+ ((PDDEPOKESTRUCT)(mp2)->hItem)*/
+
+
+// Use these macros to send or post the appropriate message:
+// Example:
+//
+// Old 16-bit code:
+// SendDlgItemMessage( hDlg, id, EM_SETSEL, 0, MAKELONG ( start,end ));
+//
+// New portable code:
+// SEND_EM_SETSEL_MSG( hDlg, id, start, end );
+//
+#define SEND_EM_SETSEL_MSG(hDlg,id,nStart,nEnd) \
+ SendDlgItemMessage(hDlg,id,EM_SETSEL,(MP1)(nStart),(MP2)(nEnd))
+
+#define SEND_EM_LINESCROLL_MSG(hDlg,id,nLinesVert,nLinesHorz) \
+ SendDlgItemMessage(hDlg,id,EM_LINESCROLL,(MP1)(nLinesVert),(MP2)(nLinesHorz))
+
+#define SEND_WM_MENUSELECT_MSG(hwnd,item,flags,hMenu) \
+ SendMessage (hwnd,WM_MENUSELECT,MP1FROM2SHORT (item,flags),(MP2)(hMenu))
+
+#define POST_WM_COMMAND_MSG(hwndTo,idFrom,hwndFrom,cmd) \
+ PostMessage (hwndTo,WM_COMMAND,MP1FROM2SHORT(idFrom,cmd),(MP2)(hwndFrom))
+
+#define SEND_WM_VSCROLL_MSG(hwndTo,code,pos,hwndFrom) \
+ SendMessage (hwndTo,WM_VSCROLL,MP1FROM2SHORT(code,pos),(MP2)(hwndFrom))
+
+#define SEND_WM_HSCROLL_MSG(hwndTo,code,pos,hwndFrom) \
+ SendMessage (hwndTo,WM_HSCROLL,MP1FROM2SHORT(code,pos),(MP2)(hwndFrom))
+
+#endif //OS_WIN32
+
+#endif //PORTDEFS_INCL
diff --git a/private/utils/ntbackup/inc/proddefs.h b/private/utils/ntbackup/inc/proddefs.h
new file mode 100644
index 000000000..ca15c1264
--- /dev/null
+++ b/private/utils/ntbackup/inc/proddefs.h
@@ -0,0 +1,368 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: PRODDEFS.h
+
+ Description: This file includes PRODUCT SPECIFIC definitions.
+
+ $Log: G:\UI\LOGFILES\PRODDEFS.H_V $
+
+ Rev 1.68 14 Jan 1994 14:42:20 Glenn
+Name changes once again.
+
+ Rev 1.67 07 Jan 1994 11:00:06 mikep
+change CAYMAN ifdef to os_win32
+
+ Rev 1.66 22 Dec 1993 15:11:42 GLENN
+The names were changed to protect the innocent.
+
+ Rev 1.65 17 Dec 1993 15:31:28 KEVINS
+Added the loader DLL.
+
+ Rev 1.64 22 Nov 1993 11:42:34 BARRY
+Unicode fixes: added TEXT macros around all literals
+
+ Rev 1.63 22 Aug 1993 20:26:28 MIKEP
+fix WFW redef warning
+
+ Rev 1.62 16 Aug 1993 13:57:08 BARRY
+Don't turn on WFW unconditionally (and for the lack of a better way now,
+made it based on OEM_MSOFT). Added long app name for NTBackup.
+
+
+ Rev 1.61 11 Aug 1993 11:39:44 Aaron
+Moved Bimini version info to separate "version.h"
+
+ Rev 1.60 22 Jul 1993 17:48:02 GLENN
+Added LONGAPPNAME, RESFILENAME, READMEFILENAME, LCHFILENAME for support of INSTALL and TAPE SOFTWARE ID.
+
+ Rev 1.59 08 Jun 1993 09:10:02 DARRYLP
+Added email support.
+
+ Rev 1.58 10 May 1993 14:06:08 MIKEP
+chnage ntbackup.hlp to backup.hlp because microsoft is lazy.
+
+ Rev 1.57 29 Apr 1993 18:19:26 Aaron
+Cleaned up
+
+ Rev 1.56 27 Apr 1993 16:31:30 CHUCKB
+Changed occurrances of ntbackup back to backup (except for file names).
+
+ Rev 1.55 27 Apr 1993 14:59:14 CHUCKB
+1. Made name of applet NTBackup
+2. Took out all references to the word 'beta'
+3. Changed any file names in the form BACKUP.xxx to NTBACKUP.xxx
+
+ Rev 1.54 09 Apr 1993 14:13:40 GLENN
+Added BETA to the title, menu, aboutbox strings.
+
+ Rev 1.53 05 Apr 1993 16:19:54 GLENN
+Added elipses to all about menu item strings.
+
+ Rev 1.52 01 Apr 1993 17:00:22 GLENN
+Changed the name to Conner Backup Exec. Updated the copyright stuff.
+
+ Rev 1.51 25 Mar 1993 13:04:12 chrish
+Made changes for the new naming convention for bewinnt.
+
+ Rev 1.50 25 Feb 1993 13:44:40 STEVEN
+fix copyright for nost
+
+ Rev 1.49 22 Feb 1993 11:35:02 chrish
+Added stuff for CAYMAN NT. Also added a minor change received from MikeP (
+Added the "..." to the menu item for "About backup", so it reads
+"About backup ...".
+
+ Rev 1.48 18 Feb 1993 13:48:14 BURT
+Changes for Cayman
+
+
+ Rev 1.47 11 Dec 1992 17:34:30 GLENN
+Changed Tape Backup to just Backup for NT.
+
+ Rev 1.46 19 Nov 1992 14:40:42 GLENN
+Removed sales pitch stuff.
+
+ Rev 1.45 12 Nov 1992 15:00:58 MIKEP
+remove text macro
+
+ Rev 1.44 05 Nov 1992 17:23:58 DAVEV
+fix ts
+
+ Rev 1.42 30 Oct 1992 15:50:42 GLENN
+Fixed the WFW problem. NOTE: add defines only to the product section. (BIMINI, CAYMAN, etc...)
+
+ Rev 1.41 28 Oct 1992 10:12:36 DARRYLP
+Added WFW define.
+
+ Rev 1.40 16 Oct 1992 15:59:48 GLENN
+Changed ER to Rev.
+
+ Rev 1.39 06 Oct 1992 15:50:54 DARRYLP
+Added WFW define.
+
+ Rev 1.38 04 Oct 1992 19:48:46 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.37 30 Sep 1992 10:50:44 GLENN
+Updated
+
+ Rev 1.36 29 Sep 1992 11:04:12 GLENN
+Split out the version stuff for Microsoft and Archive.
+
+ Rev 1.35 22 Sep 1992 10:56:54 GLENN
+Removed the .BKS extension from FM_SCRIPT. The extension is now pulled from the common resources.
+
+ Rev 1.34 18 Sep 1992 17:28:44 GLENN
+Added file manager text support.
+
+ Rev 1.33 04 Sep 1992 18:09:34 CHUCKB
+Added new id's, etc., for sales pitch string.
+
+ Rev 1.32 06 Jul 1992 12:53:10 JOHNWT
+changed default name to Bimini
+
+ Rev 1.31 21 May 1992 15:04:36 MIKEP
+name changes
+
+ Rev 1.30 04 May 1992 15:21:24 JOHNWT
+update res ver
+
+ Rev 1.29 04 May 1992 13:09:50 JOHNWT
+update for Einstein
+
+ Rev 1.28 27 Apr 1992 16:21:00 JOHNWT
+added conglomerate
+
+ Rev 1.27 22 Apr 1992 17:58:14 GLENN
+Updated rev and took out BETA.
+
+ Rev 1.26 15 Apr 1992 16:48:08 GLENN
+Updated rev.
+
+ Rev 1.25 09 Apr 1992 11:35:52 GLENN
+Added support for exe/resource version stamping.
+
+ Rev 1.24 07 Apr 1992 15:47:10 GLENN
+Separated APP exe version, res version, eng release strings.
+
+ Rev 1.23 06 Apr 1992 13:55:32 GLENN
+Updated.
+
+ Rev 1.22 06 Apr 1992 12:36:44 CHUCKB
+Fixed company name per tech pubs.
+
+ Rev 1.21 02 Apr 1992 16:56:36 GLENN
+Updated.
+
+ Rev 1.20 30 Mar 1992 17:16:16 GLENN
+Updated.
+
+ Rev 1.19 25 Mar 1992 17:44:26 DAVEV
+OEM_MSOFT: Added product specific defines section
+
+ Rev 1.18 24 Mar 1992 09:43:40 GLENN
+Updated
+
+ Rev 1.17 23 Mar 1992 14:04:00 GLENN
+Updated rev.
+
+ Rev 1.16 22 Mar 1992 12:54:46 JOHNWT
+added APPMSGNAME
+
+ Rev 1.15 19 Mar 1992 15:45:20 GLENN
+Updated ER and added copyright and version defs.
+
+ Rev 1.14 16 Mar 1992 14:01:58 GLENN
+Upped rev.
+
+ Rev 1.13 10 Mar 1992 15:21:08 JOHNWT
+removed prebeta
+
+ Rev 1.12 10 Mar 1992 14:01:52 JOHNWT
+added TAPEPSWDTITLE
+
+ Rev 1.11 04 Mar 1992 11:43:54 GLENN
+Updated.
+
+ Rev 1.10 03 Mar 1992 16:14:42 JOHNWT
+added LCHDELAYTITLE
+
+ Rev 1.9 26 Feb 1992 17:29:58 JOHNWT
+add APPGROUP
+
+ Rev 1.8 25 Feb 1992 21:35:36 GLENN
+Updated.
+
+ Rev 1.7 23 Feb 1992 14:00:12 GLENN
+Overhauled.
+
+ Rev 1.6 18 Feb 1992 20:38:28 GLENN
+Updated.
+
+ Rev 1.5 10 Feb 1992 09:10:18 GLENN
+Updated.
+
+ Rev 1.4 02 Feb 1992 15:53:06 GLENN
+Updated.
+
+ Rev 1.3 31 Jan 1992 12:52:22 GLENN
+Update.
+
+ Rev 1.2 27 Jan 1992 12:51:40 GLENN
+Updated rev.
+
+ Rev 1.1 22 Jan 1992 12:21:38 GLENN
+Updated revision.
+
+ Rev 1.0 17 Jan 1992 15:04:06 GLENN
+Initial revision.
+
+******************************************************************************/
+
+#if !defined( PRODDEFS_H )
+
+#define PRODDEFS_H
+
+// Product specific definitions
+
+#if !defined( OEM_MSOFT )
+#if !defined( WFW )
+#define WFW
+#endif
+#endif
+
+
+// THIS FILE CONTAINS TEXT THAT MUST BE TRANSLATED!!!!!
+// The following is a list of RELEASE specific Text definitions.
+
+#define ABOUTVERSION TEXT("Version %s Rev. %s")
+
+#if defined( OEM_MSOFT )
+ #define COPYRIGHT TEXT("Copyright © 1993-1994 Arcada Software, Inc.\012All Rights Reserved")
+ #define COMPANY TEXT("\012")
+ #define CONGLOMERATE TEXT("Call Arcada Software's 1-800 number for\012additional information on software products.")
+#else
+ #define COPYRIGHT TEXT("Copyright © 1993-1994")
+ #define COMPANY TEXT("Arcada Software, Inc.")
+ #define CONGLOMERATE TEXT("All Rights Reserved")
+#endif
+
+#define SALESPITCH TEXT("")
+#define FM_JOBAPPEND TEXT("File Manager-Append")
+#define FM_JOBREPLACE TEXT("File Manager-Replace")
+#define FM_SCRIPT TEXT("WINFILE")
+
+#if defined( OEM_MSOFT )
+
+ // MICROSOFT STUFF - NOSTRADAMUS
+
+ #define APP_EXEVER TEXT("1.0")
+ #define APP_RESVER TEXT("1.0")
+ #define APP_ENGREL TEXT("3.41")
+
+#elif defined( BIMINI )
+
+ // Version info in separate private file
+ #include "version.h"
+
+#else
+
+ // OUR COMPANY STUFF - FIJI
+
+ #define APP_EXEVER TEXT("5.0")
+ #define APP_RESVER TEXT("2.0")
+ #define APP_ENGREL TEXT("3.41")
+
+#endif
+
+
+#if defined ( OEM_MSOFT ) //OEM Microsoft version
+
+ #define SHORTAPPNAME TEXT("BKUP")
+ #define EXEFILENAME TEXT("NTBACKUP.EXE")
+ #define INIFILENAME TEXT("NTBACKUP.INI")
+ #define HLPFILENAME TEXT("BACKUP.HLP")
+ #define JOBFILENAME TEXT("NTBACKUP.JOB") //?? need this?
+ #define SCHFILENAME TEXT("NTBACKUP.SCH") //?? need this?
+
+ #if defined( OS_WIN32 )
+ #define APPMSGNAME TEXT("NTBackup")
+ #else
+ #define APPMSGNAME TEXT("Windows Backup") //?? right name?
+ #endif
+
+ #define APPERROR TEXT("Backup Error")
+ #define APPABORT TEXT("Backup Abort")
+ #define APPGROUP TEXT("Backup")
+
+ #if defined( MAYN_REL ) && defined( MAYN_DEMO )
+
+ #define APPLICATIONNAME TEXT("Backup Demo")
+ #define ABOUTAPPLICATIONNAME TEXT("About Backup Demo")
+ #define AABOUTAPPLICATIONNAME TEXT("&About Backup Demo...")
+
+ #else
+ #define APPLICATIONNAME TEXT("Backup")
+ #define ABOUTAPPLICATIONNAME TEXT("About Backup")
+ #define AABOUTAPPLICATIONNAME TEXT("&About Backup...")
+ #define LONGAPPNAME TEXT("Microsoft Windows NT Backup")
+
+ #endif
+
+#else // not OEM Microsoft
+
+ #if defined( OS_WIN32 )
+ #define SHORTAPPNAME TEXT("BEX") // chs:03-25-93
+ #define EXEFILENAME TEXT("BEWINNT.EXE") // chs:03-25-93
+ #define INIFILENAME TEXT("BEWINNT.INI") // chs:03-25-93
+ #define PWDFILENAME TEXT("BEWINNT.PWD") // chs:03-25-93
+ #define HLPFILENAME TEXT("BEWINNT.HLP") // chs:03-25-93
+ #define JOBFILENAME TEXT("BEWINNT.JOB") // chs:03-25-93
+ #define SCHFILENAME TEXT("BEWINNT.SCH") // chs:03-25-93
+ #define LCHFILENAME TEXT("LAUNCHNT.EXE") // GSH:07-22-93
+ #define RESFILENAME TEXT("BERESNT.DLL") // GSH:07-22-93
+ #define READMEFILENAME TEXT("READMENT.TXT") // GSH:07-22-93
+ #define LONGAPPNAME TEXT("Backup Exec for Windows NT")
+ #define LOADERFILENAME "LDRDLL.DLL"
+ #else
+ #define SHORTAPPNAME TEXT("BE")
+ #define EXEFILENAME TEXT("BEWINS.EXE")
+ #define INIFILENAME TEXT("BEWINS.INI")
+ #define PWDFILENAME TEXT("BEWINS.PWD")
+ #define HLPFILENAME TEXT("BEWINS.HLP")
+ #define JOBFILENAME TEXT("BEWINS.JOB")
+ #define SCHFILENAME TEXT("BEWINS.SCH")
+ #define LCHFILENAME TEXT("LAUNCHWN.EXE") // GSH:07-22-93
+ #define RESFILENAME TEXT("BERESWN.DLL") // GSH:07-22-93
+ #define READMEFILENAME TEXT("READMEWN.TXT") // GSH:07-22-93
+ #define LONGAPPNAME TEXT("Backup Exec for Windows")
+ #endif
+
+ #define APPMSGNAME TEXT("Backup Exec") // GSH:07-22-93
+ #define APPERROR TEXT("Backup Exec Error") // GSH:07-22-93
+ #define APPABORT TEXT("Backup Exec Abort") // GSH:07-22-93
+ #define APPGROUP TEXT("Backup Exec") // GSH:07-22-93
+
+ #if defined( MAYN_DEMO )
+
+ #define APPLICATIONNAME TEXT("Backup Exec Demo")
+ #define LCHAPPLICATIONNAME TEXT("Backup Exec Launcher Demo")
+ #define ABOUTAPPLICATIONNAME TEXT("About Backup Exec Demo")
+ #define AABOUTAPPLICATIONNAME TEXT("&About Backup Exec Demo...")
+
+ #else
+
+ #define APPLICATIONNAME TEXT("Backup Exec") // GSH:04-08-93
+ #define LCHAPPLICATIONNAME TEXT("Backup Exec Launcher") // GSH:04-08-93
+ #define ABOUTAPPLICATIONNAME TEXT("About Backup Exec") // chs:02-18-93
+ #define AABOUTAPPLICATIONNAME TEXT("&About Backup Exec...") // chs:02-18-93
+
+ #endif
+
+#endif
+
+
+
+#endif /* end PRODDEFS_H */
diff --git a/private/utils/ntbackup/inc/prtmang.h b/private/utils/ntbackup/inc/prtmang.h
new file mode 100644
index 000000000..3ba0ace4b
--- /dev/null
+++ b/private/utils/ntbackup/inc/prtmang.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: prtmang.h
+
+ Description: This header file contains prototypes for print manager.
+
+ $Log: G:/UI/LOGFILES/PRTMANG.H_V $
+
+ Rev 1.3 04 Oct 1992 19:48:48 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 13 May 1992 16:32:08 MIKEP
+fixes for NT
+
+ Rev 1.1 04 Dec 1991 16:36:06 DAVEV
+16/32 bit Windows port changes-1st pass
+
+ Rev 1.0 20 Nov 1991 19:41:04 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef prtmang_h
+#define prtmang_h
+
+
+VOID PM_FilePrint ( VOID ) ;
+VOID PM_FileSetup ( VOID ) ;
+VOID PM_SendFileToPrinter( LPSTR szFileName, BOOLEAN fPrompt ) ;
+BOOLEAN PM_PrinterExists ( VOID ) ;
+VOID PM_CheckSessionLogPrint ( VOID ) ;
+DLGRESULT APIENTRY PM_SetupWndProc (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY PM_PrintWndProc (HWND, MSGID, MP1, MP2);
+DLGRESULT APIENTRY PM_SearchWndProc (HWND, MSGID, MP1, MP2);
+
+#endif
+
+
+
diff --git a/private/utils/ntbackup/inc/pwinstal.h b/private/utils/ntbackup/inc/pwinstal.h
new file mode 100644
index 000000000..9c6eef297
--- /dev/null
+++ b/private/utils/ntbackup/inc/pwinstal.h
@@ -0,0 +1,33 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: pwinstal.h
+
+ Description:
+
+ Location:
+
+
+ $Log: G:/UI/LOGFILES/PWINSTAL.H_V $
+
+ Rev 1.1 04 Oct 1992 19:48:50 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:35:54 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef PWINSTAL_H
+#define PWINSTAL_H
+
+/*
+ Define the subfunctions of password installation
+*/
+
+#define EXE_LRL 8092 /* password function defines */
+
+INT16 install_password( VOID ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/qtc.h b/private/utils/ntbackup/inc/qtc.h
new file mode 100644
index 000000000..a04495f96
--- /dev/null
+++ b/private/utils/ntbackup/inc/qtc.h
@@ -0,0 +1,915 @@
+
+/************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: qtc.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the Quick Tape Catalogs (QTC).
+
+ $Log: N:\LOGFILES\QTC.H_V $
+
+ Rev 1.34 06 Dec 1993 09:47:20 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.33 02 Nov 1993 17:48:46 MIKEP
+delete unused parameter
+
+ Rev 1.32 02 Nov 1993 17:14:00 MIKEP
+add fsys.h for non dll builds
+
+ Rev 1.31 28 Oct 1993 17:32:34 MIKEP
+qtc dll
+
+ Rev 1.30 19 Jul 1993 21:21:06 MIKEP
+add new status bits for ecc tapes
+
+ Rev 1.29 17 Jun 1993 09:08:46 Stefan
+Added ifdef around function that used FSYS_HAND and DBLKS.
+
+ Rev 1.28 15 Jun 1993 11:22:02 ChuckS
+Added new QTC errors QTC_TAPE_TAGGED_DELETED and QTC_CATALOG_FILE_IN_USE for
+Endeavour client/server environment. Added QTC_NON_VOLUME and QTC_TAPE_DELETED
+status-bit defines for QTC_HEADER statuses.
+
+P_CLINET || OS_NLM only: Added prototype for QTC_TagTapeForDeletion.
+
+
+ Rev 1.27 09 Jun 1993 19:29:30 MIKEP
+enable c++
+
+ Rev 1.26 01 Jun 1993 18:17:14 DON
+Added status bit for bset doesn't support redirected restore
+
+ Rev 1.25 20 May 1993 19:48:18 ChuckS
+Enclosed prototype for QTC_LookForFiles with #if defined( BECONFIG_H ),
+so including qtc.h doesn't force include of beconfig.h also
+
+ Rev 1.24 19 May 1993 16:08:02 ChuckS
+OS_NLM only: made cat_user stuff available for the NLM as well
+
+ Rev 1.23 18 May 1993 17:01:36 ChuckS
+P_CLIENT only: Added cat_user field to QTC_CATALOG structure and prototype
+of function to set the cat_user.
+
+ Rev 1.22 13 May 1993 13:25:00 ChuckS
+Changes for revamped QTC usage of virtual memory. Changed Q_ELEM's to
+VQ_ELEM's and moved to start of QTC_BSET and QTC_TAPE structures; changed
+Q_HEADER to VQ_HEADER. Changed arguments to QTC_NewBset and QTC_RemoveBset
+to take VQ_HDL instead of QTC_BSET_PTR for the bset to act upon.
+
+
+ Rev 1.21 01 May 1993 19:13:18 MIKEP
+add fatdrive bit to status
+
+ Rev 1.20 29 Apr 1993 11:30:52 MIKEP
+add call to get on tape cat ver
+
+ Rev 1.19 27 Apr 1993 16:08:00 ChuckS
+Added prototype for function QTC_ForgetTape, which is just part of
+QTC_RemoveTape moved to a seperate function so the client(s) can
+discard the memory allocated for a tape without attempting to remove
+a file. Also added prototype for QTC_FindTape, which is in the new
+file qtc_ftap.c
+
+
+
+ Rev 1.18 23 Apr 1993 10:35:38 MIKEP
+Add new on tape catalog version parameter to catalogs.
+Add prototype for new call in qtc_util.c to delete
+entries if files can't be accessed anymore.
+
+ Rev 1.17 14 Apr 1993 13:03:44 Stefan
+Changed if !defined( P_CLIENT ) by adding "|| defined(OS_WIN) because
+the windows client needs this code.
+
+ Rev 1.16 24 Mar 1993 11:11:54 ChuckS
+Added enclosing #ifndef _qtc_h_. Changed use of obsolete MAYN_DOS to OS_DOS.
+Enclosed typedef of QTC_BUILD, QTC_ZOMBIE within #if !defined( P_CLIENT ).
+Same for prototypes referencing QTC_BUILD and QTC_ZOMBIE. Enclosed protos
+using FSYS_HAND with #if defined( FSYS_H ), and those using DBLK_PTR with
+#if defined( DBLKS_H ).
+
+ Rev 1.15 23 Mar 1993 18:00:58 ChuckS
+Added arg to QTC_OpenFile indicating if need to open for writes
+
+ Rev 1.14 23 Mar 1993 10:32:32 BRYAN
+Changed return type for GetFileNameOnly.
+
+ Rev 1.13 19 Mar 1993 11:34:42 ChuckS
+Fixed syntax error in prototype for QTC_GetFileNameOnly.
+
+ Rev 1.12 18 Mar 1993 11:35:44 TIMN
+Added two f(x)s to get catalog info: get data path and get filename only
+
+ Rev 1.11 26 Jan 1993 17:10:04 MIKEP
+vcb changes
+
+ Rev 1.10 20 Jan 1993 19:21:18 MIKEP
+add floppy flag
+
+ Rev 1.9 04 Jan 1993 09:41:14 MIKEP
+unicode support changes
+
+ Rev 1.8 14 Dec 1992 12:37:06 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.7 25 Nov 1992 16:13:38 ChuckS
+P_CLIENT only: Added field to QTC_BSET for volume ref, mod time for QTC_TAPE
+
+ Rev 1.6 23 Nov 1992 14:20:56 MIKEP
+fix continuation vcb for MTF only
+
+ Rev 1.5 20 Nov 1992 13:52:16 CHARLIE
+JAGUAR: Move to SRM based QTC code
+
+ENDEAVOR: Modified QTC_AbortCataloging prototype to include BOOLEAN keep_items
+
+ENDEAVOR: Modified QTC_Init prototype to include VM_HDL vm_hdl
+
+ Rev 1.4 22 Oct 1992 16:51:54 MIKEP
+otc fixes
+
+ Rev 1.3 22 Oct 1992 09:27:44 MIKEP
+second pass otc changes
+
+ Rev 1.2 22 Oct 1992 08:46:22 MIKEP
+add otc status bits
+
+ Rev 1.1 14 Oct 1992 10:19:50 MIKEP
+add OTC fields to QTC VCB
+
+ Rev 1.0 03 Sep 1992 16:56:12 STEVEN
+Initial revision.
+
+ Rev 1.33 01 Sep 1992 11:14:06 MIKEP
+added UNALIGNED for NT compiling on x86 machines
+
+ Rev 1.32 18 Aug 1992 14:52:40 DAVEV
+MikeP's changes from Microsoft
+
+ Rev 1.31 04 Aug 1992 10:08:20 MIKEP
+delete cats flag
+
+ Rev 1.30 29 Jul 1992 09:54:58 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.29 10 Jul 1992 10:05:44 MIKEP
+add getfirstitem
+
+ Rev 1.28 09 Jul 1992 10:25:46 MIKEP
+standard product changes
+
+
+**************************/
+
+#ifndef _qtc_h_
+#define _qtc_h_
+
+// *************************************
+// CATALOG INCLUDES
+// *************************************
+
+#include "vm.h"
+#include "vqueue.h"
+
+// *************************************
+// CATALOG GLOBAL DATA EXTERNS
+// *************************************
+
+extern VM_HDL qtc_vmem_hand;
+extern VM_PTR v_bset_item;
+extern VM_PTR v_tape_item;
+
+
+// *************************************
+// CATALOG DEFINES
+// *************************************
+
+#ifndef UNALIGNED
+#define UNALIGNED
+#endif
+
+
+// magic number is used to tell if we have inited properly
+
+#define QTC_MAGIC_NUMBER 6942
+
+
+#define NO_CARE_FID 0xffffffff
+#define NO_CARE_BSET 0xffff
+#define NO_CARE_SEQNO 0xffff
+
+
+// used in the status fields for record entries
+
+#define QTC_FILE 0x0001 // is entry a file
+#define QTC_DIRECTORY 0x0002 // is entry a directory
+#define QTC_AFP 0x0004 // is entry an apple file
+#define QTC_EMPTY 0x0008 // is this directory empty
+#define QTC_CORRUPT 0x0010 // is this entry corrupt
+#define QTC_SPLIT 0x0020 // does this entry continue on next tape
+#define QTC_CONTINUATION 0x0040 // did this entry start on a previous tape
+#define QTC_MANUFACTURED 0x0080 // entry was created
+
+// End of record item status defines
+// Bset defines continue ...
+
+#define QTC_ERASED 0x00000100 // if bset was erased or recat'd
+#define QTC_INCOMPLETE 0x00000200 // is this bset incompletely cataloged
+#define QTC_PARTIAL 0x00000400 // is this a partially cat'd bset
+#define QTC_IMAGE 0x00000800 // set is an image backup
+#define QTC_UNICODE 0x00001000 // is this set in unicode
+#define QTC_FDDEXISTS 0x00002000 // does this set have FDD on tape
+#define QTC_SMEXISTS 0x00004000 // does this tape have an SM
+#define QTC_OTCVALID 0x00008000 // are our OTC bits valid
+#define QTC_FLOPPY 0x00010000 // a backup to floppies, not tape
+#define QTC_FATDRIVE 0x00020000 // a backup of a FAT drive
+#define QTC_NO_REDIRECT 0x00040000 // if bset does NOT support redirected restore
+#define QTC_NON_VOLUME 0x00080000 // if bset is a non-volume object (eg, SMS Bindery or Directory Services)
+#define QTC_TAPE_DELETED 0x00100000 // if tape is tagged for deletion
+#define QTC_COMPRESSED 0x00200000 // a compressed data set
+#define QTC_ENCRYPTED 0x00400000 // an encrypted data set
+#define QTC_FUTURE_VER 0x00800000 // a future version data set
+
+
+// Catalog building state defines
+
+#define QTC_WAITING_STATE 3 // waiting on a continuation tape
+#define QTC_ERROR_STATE 2 // something bad happened
+#define QTC_ACTIVE_STATE 1 // Is a backup/catalog a tape in progress
+#define QTC_IDLE_STATE 0 // Are we not building/cataloging a tape
+
+// Backup types
+
+#define QTC_COPY_BACKUP 1
+#define QTC_DIFF_BACKUP 2
+#define QTC_INCR_BACKUP 3
+#define QTC_NORM_BACKUP 4
+#define QTC_DAIL_BACKUP 5
+
+// The internal buffer size used by the catalogs. Increasing the size
+// will directly improve catalog performance. Adding disk caching will
+// improve performance the best.
+
+// Suggested buffer sizes are:
+
+// DOS 512
+// All others 1024
+
+#if defined( OS_DOS )
+ #define QTC_BUF_SIZE 512
+#else
+ #define QTC_BUF_SIZE 1024
+#endif
+
+
+#ifdef UNICODE
+ #define QTC_FILE_SPEC "????????.U??"
+#else
+ #define QTC_FILE_SPEC "????????.D??"
+#endif
+
+// We keep an offset to the parent directory during builds, if the depth
+// goes deeper, we bump this value by another 10 levels.
+
+#define QTC_START_DEPTH 10
+
+
+#define QTC_MAX_FILE_SIZE 256
+#define QTC_MAX_PATH_SIZE 256
+
+
+#define QTC_NO_MORE 1
+#define QTC_SUCCESS 0
+#define QTC_FAILURE -1
+
+#define QTC_DISK_FULL -2
+#define QTC_TAPE_NOT_FOUND -3
+#define QTC_BSET_NOT_FOUND -4
+#define QTC_NO_INIT -5
+#define QTC_OPEN_FAILED -6
+#define QTC_WRITE_FAILED -7
+#define QTC_READ_FAILED -8
+#define QTC_SEEK_FAILED -9
+#define QTC_NO_MEMORY -10
+#define QTC_NO_FILE_HANDLES -11
+#define QTC_NO_HEADER -12
+#define QTC_INVALID_FILE -13
+#define QTC_TAPE_TAGGED_DELETED -14
+#define QTC_CATALOG_FILE_IN_USE -15 // returned by Client/Server "wrapper" for QTC_RemoveTape
+
+// Any catalog files created with a different version will be ignored.
+
+#define QTC_MAJOR_VERSION 2 // Version control for catalogs
+#define QTC_MINOR_VERSION 0 // Version control for catalogs
+
+
+#define QTC_SKIP_TO_NEXT_ITEM 1
+#define QTC_SKIP_TO_NEXT_BSET 2
+#define QTC_OPERATION_COMPLETE 3
+
+
+/*******************************************
+
+ XTRA BYTE DEFINES
+
+ There are ( 255 / 5 ) extra byte fields that can be in the catalogs
+ appended to any file or directory item. Each field is 5 bytes long.
+ It starts with a 1 byte code word, followed by 4 data bytes. If it
+ ain't defined here, it better not be in the extra bytes.
+
+********************************************/
+
+
+#define QTC_MAX_XTRA_BYTES 255
+
+// The only ones currently defined.
+
+#define QTC_XTRA_64BIT_SIZE 0 // Top 32 bits of 64 bit file size
+
+// This info is saved on directories only.
+
+#define QTC_FILE_COUNT 1 // files in this dir
+#define QTC_BYTE_COUNT_MSW 2 // bytes in this dir
+#define QTC_BYTE_COUNT_LSW 3 // bytes in this dir
+
+// The combo count saves space over the three above.
+
+#define QTC_COMBO_COUNT 4 // 8 bit file count, 24 bit bytes count
+
+
+// *****************************************
+// CATALOG STRUCTURES
+// *****************************************
+
+#define QTC_SIGNATURE "CONNER SOFTWARE - CATALOG FILE"
+
+typedef struct _QTC_TAPE_HEADER *QTC_TAPE_HEADER_PTR;
+typedef struct _QTC_TAPE_HEADER {
+
+ INT32 major_version; // catalog version
+ INT32 minor_version;
+ BYTE signature[ 52 ]; // must be longer than signature
+
+} QTC_TAPE_HEADER;
+
+
+// the info we keep live on each backup set
+
+typedef struct _QTC_BSET *QTC_BSET_PTR;
+typedef struct _QTC_BSET {
+
+ VQ_ELEM q_elem ;
+
+ UINT32 tape_fid; // who is it
+ INT32 tape_seq_num;
+ INT32 bset_num;
+
+ UINT32 offset; // where is it
+
+ UINT32 status; // what is it
+
+ VOID_PTR v_volume ; // reference to volume record
+
+} QTC_BSET;
+
+
+// information we keep on disk for each bset.
+
+typedef struct _QTC_HEADER *QTC_HEADER_PTR;
+typedef struct _QTC_HEADER {
+
+ UINT32 header_size; // num bytes on disk, probably 512
+ UINT32 string_offset; // offset in bytes to string data
+ UINT32 catalog_version; // of this backup set
+ UINT32 backup_type; // normal, copy, inc, diff
+ UINT32 OS_id; // type of OS the bset is from
+ UINT32 OS_ver; // version of OS the bset is from
+ UINT32 tape_fid; // tape family id
+ INT32 bset_num; // 1, 2, ...
+ INT32 tape_seq_num; // 1, 2, ...
+ UINT32 offset; // where in data file is this guy
+ UINT32 next_bset; // where is next bset in data file
+ UINT32 status; // partial, image, unicode, etc.
+ UINT32 status2; // even more status bits
+ UINT32 dir_start; // offset in data file of directory info
+ UINT32 dir_size; // bytes of directory info
+ UINT32 fil_start; // offset in data file of file info
+ UINT32 fil_size; // bytes of file info
+ UINT32 rec_start; // offset in data file of records
+ UINT32 rec_size; // bytes of record info
+ UINT32 num_dirs; // number of dirs
+ UINT32 num_files; // number of files
+ UINT32 num_bytes; // 64 bit number of bytes low
+ UINT32 num_bytes_msw; // 64 bit number of bytes high
+ UINT32 num_corrupt_files; // number of corrupt files
+ UINT32 num_files_in_use; // number of files that were in use
+ UINT32 backup_date; // when this backup actually started
+ UINT32 backup_time;
+ UINT32 PBA_VCB; // physical block address of the volume control block
+ UINT32 LBA; // logical block address 0,1
+ UINT32 VCB_attributes;
+ UINT32 compress_algor;
+ UINT32 encrypt_algor; // encryption algorithm for passwords
+ UINT32 FDD_SeqNum; // Seq Num that FDD resides on.
+ UINT32 FDD_PBA; // PBA of FDD stuff
+
+ UINT32 loader_id; // loader stuff
+ UINT32 slot_number;
+ UINT32 loader_stuff1;
+ UINT32 loader_stuff2;
+
+ UINT32 FDD_Version; // OTC Version Number
+
+ UINT32 spare2; // spare space all init'd to 0.
+ UINT32 spare3;
+ UINT32 spare4;
+ UINT32 spare5;
+ UINT32 spare6;
+ UINT32 spare7;
+ UINT32 spare8;
+ UINT32 spare9;
+ UINT32 spare10;
+ UINT32 spare11;
+ UINT32 spare12;
+ UINT32 spare13;
+ UINT32 spare14;
+ UINT32 spare15;
+ UINT32 spare16;
+ UINT32 spare17;
+ UINT32 spare18;
+ UINT32 spare19;
+ UINT32 spare20;
+
+ // String Sizes
+
+ UINT32 tape_password_size; // non zero if there is one
+ UINT32 bset_password_size; // non zero if there is one
+ UINT32 bset_description_size;
+ UINT32 bset_name_size;
+ UINT32 tape_name_size;
+ UINT32 volume_name_size;
+ UINT32 user_name_size;
+
+ // String Pointers
+
+ CHAR_PTR tape_name;
+ CHAR_PTR bset_name;
+ CHAR_PTR volume_name;
+ CHAR_PTR user_name;
+ CHAR_PTR bset_description;
+ CHAR_PTR tape_password;
+ CHAR_PTR bset_password;
+
+} QTC_HEADER;
+
+// The info we keep on each tape
+
+typedef struct _QTC_TAPE *QTC_TAPE_PTR;
+typedef struct _QTC_TAPE {
+
+ VQ_ELEM q_elem;
+
+ UINT32 status;
+
+ UINT32 tape_fid;
+ INT16 tape_seq_num;
+
+ VQ_HEADER bset_list;
+
+ UINT32 wr_time ; // tape-file's modified date as of last refresh of in-memory tape queue
+
+} QTC_TAPE;
+
+
+// This is what is kept in the records file.
+
+typedef struct _QTC_RECORD *QTC_RECORD_PTR;
+typedef struct _QTC_RECORD {
+
+ UINT32 date:16; // dos format date and time
+ UINT32 time:16;
+ union {
+ UINT32 size; // file size
+ struct {
+ UINT32 file_start:24; // start offset of file names for this dir
+ UINT32 height:8; // 0 = root, ...
+ } common;
+ } common;
+ UINT32 lba; // logical block address on tape
+ UINT32 status:8; // file or directory
+ UINT32 name_offset:24; // offset in name file
+ UINT32 attribute; // maynard FS_ attribute field
+
+} QTC_RECORD;
+
+
+// This is what is kept in the name files. After each structure is a null
+// terminated name. The structures are packed togather in the files.
+
+typedef struct _QTC_NAME *QTC_NAME_PTR;
+typedef struct _QTC_NAME {
+
+ INT32 size; // size of QTC_NAME + name string + xtra bytes
+ UINT32 xtra_size:8; // size of xtra bytes
+ UINT32 mom_offset:24; // parent directory name file offset
+ UINT32 record; // data record number
+
+ // CHAR name[?]; // item name with no terminating zero
+ // CHAR xtra_bytes[?]; // xtra bytes with no terminating zero
+
+} QTC_NAME;
+
+
+#if !defined( P_CLIENT ) || defined( OS_WIN )
+
+/*
+ Used for doing builds.
+*/
+
+typedef struct _QTC_BUILD *QTC_BUILD_PTR;
+typedef struct _QTC_BUILD {
+
+ INT error; // has error occurred
+
+ UCHAR state; // state of catalogs
+
+ INT files_in_dir; // files in last dir processed
+ UINT64 bytes_in_dir; // bytes in files in last dir
+
+ QTC_HEADER_PTR header; // current building bset
+
+ QTC_HEADER_PTR old_header; // used when partially cataloging
+ // and you cross tapes, to go back
+ // and adjust the flags.
+
+ CHAR_PTR rec_file; // file names + paths
+ CHAR_PTR dir_file; // 256 should be enough
+ CHAR_PTR fil_file; // for anybody
+
+ BOOLEAN continuation_tape;
+
+ BOOLEAN fake_root_added; // do we need to patch his lba
+
+ BOOLEAN do_full_cataloging; // else do partial
+
+ INT fh_dir; // file handles
+ INT fh_rec;
+ INT fh_fil;
+
+ INT files_open; // are the temp files open ?
+
+ INT dir_offset; // current index into buffer
+ UINT32 curr_dir_off; // current length of file
+
+ INT fil_offset;
+ UINT32 curr_fil_off;
+
+ INT rec_offset;
+ UINT32 curr_rec_off;
+
+ INT current_level; // depth in tree we are processing
+
+ // offsets to all subdirs in current path
+
+ UINT32 *mom_offset; // saves pointers to all active parents
+ INT mom_depth; // how deep can we go with current allocation
+
+ UINT32 last_mom_offset; // offset of last mom
+
+ UINT32 record_cnt; // number of records in catalog
+
+ INT last_record; // last record processed - file/dir ?
+
+ BYTE fil_buffer[ QTC_BUF_SIZE ]; // used during building
+ BYTE dir_buffer[ QTC_BUF_SIZE ];
+ BYTE rec_buffer[ QTC_BUF_SIZE ];
+
+ CHAR *curr_build_path;
+
+ INT curr_build_path_size; // bytes allocated
+
+ INT build_path_len; // number of characters in use
+
+ QTC_RECORD record; // used during building
+
+ BOOLEAN end_of_media; // did we hit end of media
+
+ UINT32 num_dirs; // number of dirs
+ UINT32 num_files; // number of files
+ UINT32 num_corrupt_files; // number of corrupt files
+
+} QTC_BUILD;
+
+#endif
+
+
+// This structure is used to access the catalogs.
+
+typedef struct _QTC_QUERY *QTC_QUERY_PTR;
+typedef struct _QTC_QUERY {
+
+ // USER FIELDS
+
+ UINT32 tape_fid; // where I should look, cannot be -1
+ INT16 tape_seq_num; // may be -1
+ INT16 bset_num; // cannot be -1
+
+ BOOLEAN subdirs; // traverse subdirs in search
+
+ UINT16 predate; // non-zero if active
+ UINT16 postdate;
+
+ // Where the file/dir results are found
+
+ CHAR_PTR path; // with embedded 0's
+ INT path_size; // in bytes and including last zero
+ CHAR_PTR item; // file or dir name found
+
+ // Also you can check empty bit in status word for file count.
+
+ INT file_count; // files located in this dir
+ UINT64 byte_count; // bytes in files in this dir
+
+ UINT32 attrib; // characteristics of found item
+ UINT16 date;
+ UINT16 time;
+ UINT64 size;
+ UINT32 lba;
+
+ INT xtra_size;
+ BYTE xtra_bytes[ QTC_MAX_XTRA_BYTES ];
+
+ UINT8 status; // FIL_TYPE, DIR_TYPE, etc.
+ // see QTC_* above for defines
+
+ INT return_code; // why was the request unsuccessful
+
+ // QTC PRIVATE FIELDS, UI CODE SHOULD NOT ACCESS THESE DIRECTLY
+
+ CHAR_PTR search_path; // where to look
+
+ CHAR_PTR search_name; // what to look for
+
+ INT search_path_size; // in bytes
+
+ BOOLEAN error; // has a major error occurred
+
+ INT size_of_path; // bytes allocated for path, private qtc use
+ INT size_of_item; // bytes allocated for name, private qtc use
+
+ BOOLEAN file_open; // Is there an active file handle
+
+ UINT16 search_size;
+
+ UINT32 search_start;
+ UINT32 search_stop;
+ UINT16 search_index; // used by QTC_FastFindFile
+
+ UINT16 search_max;
+ UINT32 search_base;
+
+ BYTE buff1[ QTC_BUF_SIZE ]; // processed data
+ BYTE buff2[ QTC_BUF_SIZE ]; // straight out of file
+
+ QTC_HEADER_PTR header; // current working header
+ QTC_BSET_PTR bset; // current working bset
+
+ UINT32 curr_mom_offset; // current active parent dir
+ UINT32 fil_dir_offset; // current child dir for GetNextFile
+
+ INT fh; // data file handle
+
+ UINT32 dir_offset; // current offsets
+ UINT32 rec_offset;
+ UINT32 fil_offset;
+
+ // GetNextDir( ) buffer current index and size
+ // GetNextObj( )
+
+ INT data_index;
+ INT data_max;
+
+ // GetNextItem( ) record number
+
+ UINT32 record_number;
+
+ CHAR_PTR last_path; // with embedded 0's
+ INT last_path_size; // in bytes and including zero
+ INT size_of_last_path; // bytes allocated
+
+} QTC_QUERY;
+
+
+
+// There is ONE of these, it is THE catalog.
+
+typedef struct _QTC_CATALOG *QTC_CATALOG_PTR;
+typedef struct _QTC_CATALOG {
+
+ BOOLEAN unicode; // are we compiled for unicode
+
+ INT inited; // see if init was successful
+
+ CHAR_PTR data_path;
+
+ VQ_HEADER tape_list; // list of tapes known about
+
+ CHAR_PTR cat_user ;
+
+} QTC_CATALOG;
+
+
+extern QTC_CATALOG gb_QTC; // Definition of global catalog
+
+
+// **********************************
+// USER APPLICATION CALLS & QUERY MACROS
+// **********************************
+
+#define QTC_SetTapeFID( q, x ) ( (q)->tape_fid = ( x ) )
+#define QTC_SetTapeSeq( q, x ) ( (q)->tape_seq_num = ( x ) )
+#define QTC_SetBsetNum( q, x ) ( (q)->bset_num = ( x ) )
+#define QTC_SetSubdirs( q, x ) ( (q)->subdirs = ( x ) )
+#define QTC_SetPreDate( q, x ) ( (q)->predate = ( x ) )
+#define QTC_SetPostDate( q, x ) ( (q)->postdate = ( x ) )
+#define QTC_SetBuildHandle( q, x ) ( (q)->build = ( x ) )
+
+// QTC_SetSearchName() is a function listed below
+// QTC_SetSearchPath() is a function listed below
+// QTC_GetSearchPathLength() is a function listed below
+// QTC_GetSearchPath() is a function listed below
+
+#define QTC_GetPreDate( q ) ( (q)->predate )
+#define QTC_GetPostDate( q ) ( (q)->postdate )
+#define QTC_GetSubdirs( q ) ( (q)->subdirs )
+#define QTC_GetPath( q ) ( (q)->path )
+#define QTC_GetPathLength( q ) ( (q)->path_size )
+#define QTC_GetItemName( q ) ( (q)->item )
+#define QTC_GetItemDate( q ) ( (q)->date )
+#define QTC_GetItemTime( q ) ( (q)->time )
+#define QTC_GetItemSize( q ) ( (q)->size )
+#define QTC_GetItemAttrib( q ) ( (q)->attrib )
+#define QTC_GetItemLBA( q ) ( (q)->lba )
+#define QTC_GetItemStatus( q ) ( (q)->status )
+#define QTC_GetSizeExtraBytes( q ) ( (q)->xtra_size )
+#define QTC_GetExtraBytes( q ) ( (q)->xtra_bytes )
+#define QTC_GetTapeFID( q ) ( (q)->bset->tape_fid )
+#define QTC_GetTapeSeq( q ) ( (q)->bset->tape_seq_num )
+#define QTC_GetBsetNum( q ) ( (q)->bset->bset_num )
+#define QTC_GetPBAVCB( q ) ( (q)->bset->PBA_VCB )
+#define QTC_GetBset( q ) ( (q)->bset )
+#define QTC_GetReturnCode( q ) ( (q)->return_code )
+#define QTC_GetFileCount( q ) ( (q)->file_count )
+#define QTC_GetByteCount( q ) ( (q)->byte_count )
+
+#define QTC_DoFullCataloging( q, flag ) ( (q)->do_full_cataloging = ( flag ) )
+#define QTC_ContinuationTape( q ) ( (q)->continuation_tape = ( TRUE ) )
+#define QTC_GetErrorCondition( q ) ( (q)->error )
+
+QTC_TAPE *QTC_GetFirstTape( VOID );
+QTC_TAPE *QTC_GetNextTape( QTC_TAPE_PTR );
+QTC_TAPE *QTC_GetPrevTape( QTC_TAPE_PTR );
+
+QTC_BSET *QTC_GetFirstBset( QTC_TAPE_PTR );
+QTC_BSET *QTC_GetLastBset( QTC_TAPE_PTR );
+QTC_BSET *QTC_GetNextBset( QTC_BSET_PTR );
+QTC_BSET *QTC_GetPrevBset( QTC_BSET_PTR );
+
+QTC_QUERY_PTR QTC_InitQuery( VOID );
+INT QTC_CloseQuery( QTC_QUERY_PTR );
+
+// get a list of just the directories
+
+INT QTC_GetFirstDir( QTC_QUERY_PTR );
+INT QTC_GetNextDir( QTC_QUERY_PTR );
+
+// get a list of the files and dirs for one directory
+
+INT QTC_GetFirstObj( QTC_QUERY_PTR );
+INT QTC_GetNextObj( QTC_QUERY_PTR );
+
+// get a list of items ordered as they were backed up
+
+INT QTC_GetFirstItem( QTC_QUERY_PTR );
+INT QTC_GetNextItem( QTC_QUERY_PTR );
+
+// get items based on search criteria
+
+INT QTC_SearchFirstItem( QTC_QUERY_PTR );
+INT QTC_SearchNextItem( QTC_QUERY_PTR );
+
+
+// OTHER CATALOG CALLS
+
+#if !defined( P_CLIENT ) || defined( OS_WIN )
+
+ // Comment out anything related to building catalogs, clients don't do that.
+
+ VOID QTC_AbortCataloging( QTC_BUILD_PTR, BOOLEAN );
+ VOID QTC_AbortBackup( QTC_BUILD_PTR );
+ VOID QTC_AddDirectoryToCatalog( QTC_BUILD_PTR, UINT64, CHAR_PTR, INT, UINT16, UINT16, UINT32, UINT32, BYTE_PTR, UINT );
+ VOID QTC_AddFileToCatalog( QTC_BUILD_PTR, UINT64, CHAR_PTR, UINT16, UINT16, UINT32, UINT32, UINT32, BYTE_PTR, UINT );
+ VOID QTC_EndOfTapeReached( QTC_BUILD_PTR, CHAR_PTR, CHAR_PTR, INT );
+ VOID QTC_PatchVCB( QTC_BUILD_PTR, UINT32, UINT32 );
+ INT QTC_StartNewBackup( QTC_BUILD_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR,
+ INT, INT, UINT32, UINT16, UINT16, UINT32, UINT32, UINT32, INT, INT, INT,
+ UINT32, UINT32, INT, INT, INT, INT,
+ INT, INT, INT, INT, INT, INT, INT, UINT16, UINT16, INT );
+ INT QTC_BlockBad( QTC_BUILD_PTR );
+ INT QTC_FinishBackup( QTC_BUILD_PTR );
+ INT QTC_FreeBuildHandle( QTC_BUILD_PTR );
+ QTC_BUILD_PTR QTC_GetBuildHandle( VOID );
+ INT QTC_ImageScrewUp( QTC_BUILD_PTR );
+ VOID QTC_AddDir( QTC_BUILD_PTR, CHAR_PTR, INT, BYTE_PTR, INT );
+ VOID QTC_AddFile( QTC_BUILD_PTR, CHAR_PTR, BYTE_PTR, INT );
+ VOID QTC_AddRecord( QTC_BUILD_PTR );
+ INT QTC_BuildNewPath( QTC_BUILD_PTR, UINT32 );
+ INT QTC_ErrorCleanup( QTC_BUILD_PTR );
+ INT QTC_FlushInternalBuffers( QTC_BUILD_PTR );
+ INT QTC_GetLastRecordEntered( QTC_BUILD_PTR, QTC_RECORD_PTR, BYTE_PTR, BYTE_PTR, INT * );
+ INT QTC_IsThisBsetKnown( QTC_BUILD_PTR, QTC_HEADER_PTR );
+ INT QTC_OpenTempFiles( QTC_BUILD_PTR );
+ INT QTC_RestartBackup( QTC_BUILD_PTR, QTC_HEADER_PTR, Q_HEADER_PTR );
+ VOID QTC_SaveDirRecord( QTC_BUILD_PTR, CHAR_PTR, INT, UINT32, BYTE_PTR, INT );
+ INT QTC_SetCountsForLastDir( QTC_BUILD_PTR );
+
+#endif
+
+BOOLEAN QTC_AnyCatalogFiles( VOID );
+INT QTC_AnySearchableBsets( VOID );
+INT QTC_TagTapeForDeletion( UINT32, INT16 );
+INT QTC_CloseFile( INT );
+INT QTC_Open( CHAR_PTR, INT, INT, INT * );
+INT QTC_ReadFile( INT, BYTE_PTR, INT, INT * );
+INT QTC_WriteFile( INT, BYTE_PTR, INT, INT * );
+INT QTC_SeekFile( INT, INT );
+INT QTC_CheckFilesAccess( VOID );
+INT QTC_CompressFile( UINT32, INT16 );
+INT QTC_CouldThisSetCrossTapes( UINT32, INT16, INT16 );
+VOID QTC_Deinit( INT );
+INT QTC_DumpBsetInfo( QTC_TAPE_PTR );
+QTC_BSET_PTR QTC_FindBset( UINT32, INT16, INT16 );
+UINT32 QTC_GetKiloBytesWasted( UINT32, UINT16 );
+BOOLEAN QTC_GetDataPath( CHAR_PTR path, INT16 pathSize );
+VOID QTC_GetFileName( UINT32, INT16, CHAR_PTR );
+CHAR_PTR QTC_GetFileNameOnly( UINT32, INT16, CHAR_PTR );
+INT32 QTC_GetMeTheVCBPBA( UINT32, INT16, INT16 );
+UINT8 QTC_GetMeTheTapeCatVer( UINT32, INT16, INT16 );
+INT QTC_GetSearchPathLength( QTC_QUERY_PTR );
+INT QTC_GetSearchPath( QTC_QUERY_PTR, CHAR_PTR );
+INT QTC_Init( CHAR_PTR, VM_HDL );
+VOID QTC_SetCatUserName( CHAR_PTR ) ;
+INT QTC_LoadBsetInfo( CHAR_PTR, QTC_TAPE_PTR );
+QTC_HEADER_PTR QTC_LoadHeader( QTC_BSET_PTR );
+INT QTC_Partialize( UINT32, INT16, INT16 );
+INT QTC_PurgeAllFiles( VOID );
+INT QTC_SetSearchPath( QTC_QUERY_PTR, CHAR_PTR, INT );
+INT QTC_SetSearchName( QTC_QUERY_PTR, CHAR_PTR );
+INT QTC_LoadDLL( CHAR_PTR );
+INT QTC_UnLoadDLL( VOID );
+
+// Semi private stuff
+
+INT QTC_AdjustFlagsOnOtherPieces( UINT32, INT16, INT16 );
+INT QTC_BuildWholePath( QTC_QUERY_PTR, UINT32 );
+INT QTC_ChangeBsetFlags( QTC_HEADER_PTR, INT );
+INT QTC_CopyFile( INT, INT, UINT32, BYTE_PTR );
+INT QTC_CompAsciiNames( ACHAR_PTR srch_name, ACHAR_PTR file_name );
+INT QTC_CompNormalNames( CHAR_PTR srch_name, CHAR_PTR file_name );
+INT QTC_CompUnicodeNames( WCHAR_PTR srch_name, WCHAR_PTR file_name );
+INT QTC_FastSearchForDir( QTC_QUERY_PTR, UINT32_PTR, UINT32, INT, INT );
+INT QTC_FastSearchForFile( QTC_QUERY_PTR );
+INT QTC_FindDirRec( QTC_QUERY_PTR, QTC_RECORD_PTR );
+INT QTC_FindNextDirRec( QTC_QUERY_PTR, QTC_RECORD_PTR );
+INT QTC_FindStoppingOffset( QTC_QUERY_PTR, QTC_RECORD_PTR );
+INT QTC_GetNameFromBuff( BYTE_PTR, QTC_NAME UNALIGNED *, INT );
+QTC_NAME UNALIGNED * QTC_GetNextItemFromBuffer( QTC_QUERY_PTR, QTC_RECORD_PTR, INT );
+QTC_BSET_PTR QTC_GetLowerTapeBset( UINT32, INT16, INT16 );
+QTC_BSET_PTR QTC_GetHigherTapeBset( UINT32, INT16, INT16 );
+INT QTC_IsThereAnotherBset( QTC_BSET_PTR );
+INT QTC_LookForChildDirs( QTC_QUERY_PTR );
+INT QTC_MoveToNextTapeInFamily( QTC_QUERY_PTR );
+INT QTC_NewBset( VQ_HDL ) ;
+INT QTC_OpenFile( UINT32, INT16, INT, INT );
+VOID QTC_RemoveBset( QTC_TAPE_PTR, VQ_HDL ) ;
+VOID QTC_ReadInBsetInfo( CHAR_PTR );
+VOID QTC_RemoveTape( UINT32, INT16 );
+QTC_HEADER_PTR QTC_SetUpStrings( QTC_HEADER_PTR );
+INT QTC_TryToLocateFile( QTC_QUERY_PTR );
+INT QTC_TryToMatchFile( QTC_QUERY_PTR, BYTE_PTR );
+INT QTC_UnlinkFile( UINT32, INT16 );
+INT QTC_UpdateOTCInfo( QTC_HEADER_PTR );
+VOID QTC_ForgetTape( QTC_TAPE_PTR ) ;
+QTC_TAPE_PTR QTC_FindTape( UINT32 fid, INT16 seq_no ) ;
+
+// If not building as a DLL then include the rest of the prototypes.
+
+#ifndef QTCDLL
+#include "FSYS.H"
+#include "QTCXFACE.H"
+#endif
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/qtcxface.h b/private/utils/ntbackup/inc/qtcxface.h
new file mode 100644
index 000000000..a3d8c2111
--- /dev/null
+++ b/private/utils/ntbackup/inc/qtcxface.h
@@ -0,0 +1,37 @@
+/***************************************************
+Copyright (C) Conner Software 1994
+
+ Name: QTCXFACE.H
+
+ Description:
+
+ This file contains all of the interface functions to the catalog unit. It prevents the
+ catalog unit froming having to understand tape format, file systems, or loops. It also
+ contains the function interfaces to the catalog dll.
+
+ $Log: N:\logfiles\qtcxface.h_v $
+
+ Rev 1.0 28 Oct 1993 14:49:46 MIKEP
+Initial revision.
+
+ Rev 1.0 28 Oct 1993 14:46:20 MIKEP
+Initial revision.
+
+****************************************************/
+
+//
+// QTCXFACE.H
+//
+
+#ifndef _qtcxface_h_
+
+#define _qtcxface_h_
+
+// Prototypes that require other header files.
+
+VOID QTC_AddToCatalog( QTC_BUILD_PTR, DBLK_PTR, FSYS_HAND, BOOLEAN, BYTE_PTR, UINT );
+VOID QTC_EndOfTape( QTC_BUILD_PTR, DBLK_PTR, DBLK_PTR, DBLK_PTR, FSYS_HAND );
+VOID QTC_PatchContinuationVCB( QTC_BUILD_PTR, DBLK_PTR );
+INT QTC_StartBackup( QTC_BUILD_PTR, DBLK_PTR );
+
+#endif
diff --git a/private/utils/ntbackup/inc/queues.h b/private/utils/ntbackup/inc/queues.h
new file mode 100644
index 000000000..1121ed510
--- /dev/null
+++ b/private/utils/ntbackup/inc/queues.h
@@ -0,0 +1,157 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: queues.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the fabulous queues routines ( actually these are
+ linked lists ) written by the Gods of DD.
+
+
+ $Log: M:/LOGFILES/QUEUES.H_V $
+ *
+ * Rev 1.5 24 Nov 1993 14:51:58 BARRY
+ * Unicode fixes
+ *
+ * Rev 1.4 07 Sep 1993 12:35:32 JOHNES
+ * Added prototype for TopOfStack_with_0_values.
+ *
+ *
+ * Rev 1.3 09 Jun 1993 08:15:08 Stefan
+ * Add back in a typedef for STACK_ELEM that was removed in the previous fix.
+ *
+ *
+ * Rev 1.2 08 Jun 1993 13:58:50 MIKEP
+ * Enable C++ compile.
+ *
+ * Rev 1.1 17 Jul 1991 11:21:38 STEVEN
+ * changed FAR references to use env var FAR_Q_POINTERS
+ *
+ * Rev 1.0 09 May 1991 13:32:32 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+#ifndef QUEUES
+#define QUEUES
+
+#ifdef FAR_Q_POINTERS
+#define Q_PTR_SIZE far
+#endif
+
+#ifndef Q_PTR_SIZE
+#define Q_PTR_SIZE
+#endif
+
+/** This structure is for a single queue element. All structures that
+ you wish to enqueue must have this structure contained in it.
+*/
+
+typedef struct Q_ELEM Q_PTR_SIZE *Q_ELEM_PTR ;
+typedef struct Q_ELEM {
+ Q_ELEM_PTR q_prev ; /* previous queue element */
+ Q_ELEM_PTR q_next ; /* next element */
+ INT32 q_priority ; /* priority of queue */
+ INT16 q_element ; /* element number */
+ VOID Q_PTR_SIZE * q_ptr ; /* a ptr to something */
+} Q_ELEM;
+
+
+/** This is the header of a queue. There needs to be one of these allocated
+ for every queue you wish to use.
+*/
+
+typedef struct Q_HEADER Q_PTR_SIZE *Q_HEADER_PTR;
+typedef struct Q_HEADER {
+ Q_ELEM_PTR q_head ; /* head element of the queue */
+ Q_ELEM_PTR q_tail ; /* tail element of the queue */
+ INT16 q_count ; /* count of elements */
+ BOOLEAN q_active ; /* Is this queue active */
+ INT16 q_magic ; /* for q_element number */
+} Q_HEADER ;
+
+#define BEFORE 0
+#define AFTER 1
+
+/** Here are some useful macros for the queues
+*/
+
+/* Returns the head element of the queue */
+#define QueueHead( queue ) ( (queue)->q_head )
+
+/* Returns the tail element of the queue */
+#define QueueTail( queue ) ( (queue)->q_tail )
+
+/* Returns the number of elements in the queue */
+#define QueueCount( queue ) ( (queue)->q_count )
+
+/* Returns the queue element number for an element */
+#define QueueElemNo( element ) ( (element)->q_element )
+
+/* Returns the next queue element in the chain */
+#define QueueNext( element ) ( (element)->q_next )
+
+/* Returns the previous queue element in the chain */
+#define QueuePrev( element ) ( (element)->q_prev )
+
+/* Returns the queue ptr field */
+#define QueuePtr( element ) ( (element)->q_ptr )
+
+#define GetQueueElemPriority( elem_ptr ) ( (elem_ptr)->q_priority )
+#define SetQueueElemPriority( elem_ptr, value ) ( ( (elem_ptr)->q_priority ) = (value) )
+
+#define GetQueueElemPtr( elem_ptr ) ( (elem_ptr)->q_ptr )
+#define SetQueueElemPtr( elem_ptr, value ) ( ( (elem_ptr)->q_ptr ) = (value) )
+
+
+/* Function Prototypes for the Queue Functions */
+
+VOID InitQueue( Q_HEADER_PTR ) ;
+VOID InitQElem( Q_ELEM_PTR ) ;
+Q_ELEM_PTR EnQueueElem( Q_HEADER_PTR queue, Q_ELEM_PTR element, BOOLEAN wpriority ) ;
+Q_ELEM_PTR DeQueueElem( Q_HEADER_PTR queue ) ;
+Q_ELEM_PTR InsertElem( Q_HEADER_PTR queue, Q_ELEM_PTR cur_elem, Q_ELEM_PTR ins_elem , UINT16 boa ) ;
+BOOLEAN RemoveQueueElem( Q_HEADER_PTR queue, Q_ELEM_PTR element ) ;
+VOID RemoveElem( Q_HEADER_PTR queue, Q_ELEM_PTR element ) ;
+Q_ELEM_PTR FindQueueElem( Q_HEADER_PTR queue, Q_ELEM_PTR element ) ;
+VOID PushElem( Q_HEADER_PTR queue, Q_ELEM_PTR element ) ;
+Q_ELEM_PTR PopElem( Q_HEADER_PTR queue ) ;
+VOID SortQueue( Q_HEADER_PTR , INT16 ( * )( Q_ELEM_PTR, Q_ELEM_PTR ) ) ;
+
+Q_ELEM_PTR SearchQueue( Q_HEADER_PTR,
+ BOOLEAN ( * )( VOID_PTR, VOID_PTR ),
+ VOID_PTR,
+ BOOLEAN );
+
+VOID MoveQueue( Q_HEADER_PTR from_queue, Q_HEADER_PTR to_queue ) ;
+Q_HEADER_PTR SplitQueue( Q_HEADER_PTR old_Q, Q_ELEM_PTR split, Q_HEADER_PTR new_Q ) ;
+
+/* Stacks ? */
+
+/*
+ Define Stack Definitions
+*/
+
+typedef struct STACK_ELEM Q_PTR_SIZE *STACK_ELEM_PTR;
+typedef struct STACK_ELEM {
+ Q_ELEM link ;
+ UINT32 item ;
+} STACK_ELEM ;
+
+typedef Q_HEADER STACK_HDR;
+typedef Q_HEADER_PTR STACK_HDR_PTR;
+
+VOID InitStack( STACK_HDR_PTR ) ;
+UINT16 Push( STACK_HDR_PTR, UINT32 ) ;
+UINT32 Pop( STACK_HDR_PTR ) ;
+UINT32 TopOfStack( STACK_HDR_PTR ) ;
+
+UINT16 TopOfStack_with_0_values(
+ STACK_HDR_PTR stk_ptr ,
+ UINT32_PTR stk_elem
+) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/rem_fs.h b/private/utils/ntbackup/inc/rem_fs.h
new file mode 100644
index 000000000..9a9d50acd
--- /dev/null
+++ b/private/utils/ntbackup/inc/rem_fs.h
@@ -0,0 +1,246 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: rem_fs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the prototypes for the REMOTE
+ file system functions.
+
+ $Log: P:/LOGFILES/REM_FS.H_V $
+ *
+ * Rev 1.2 16 Dec 1991 18:11:12 STEVEN
+ * move common functions into table
+ *
+ * Rev 1.1 23 May 1991 16:45:54 BARRY
+ * Changes for FindFirst/Next to scan for dirs only
+ *
+ * Rev 1.0 09 May 1991 13:32:16 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+#include "fsys.h"
+
+/* Functions for the tiny file system to handle remote workstation/drive hierchy */
+
+INT16 RWS_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd); /* I - passowrd NOT USED */
+
+INT16 RWS_DetachDLE( FSYS_HAND fsh ); /* I - */
+
+
+
+
+INT16 REM_AttachToDLE( FSYS_HAND fsh, /* I - File system handle */
+ GENERIC_DLE_PTR dle, /*I/O- drive to attach to. list element expanded */
+ CHAR_PTR u_name, /* I - user name NOT USED */
+ CHAR_PTR pswd); /* I - passowrd NOT USED */
+
+INT16 REM_DetachDLE( FSYS_HAND fsh ); /* I - */
+
+INT16 REM_CreateObj( FSYS_HAND fsh, /* I - File system to create object one */
+ DBLK_PTR dblk); /* I - Describes object to create */
+
+INT16 REM_OpenObj( FSYS_HAND fsh, /* I - file system that the file is opened on */
+ FILE_HAND *hand, /* O - allocated handle */
+ DBLK_PTR dblk, /*I/O- describes the file to be opened */
+ OPEN_MODE mode); /* I - open mode */
+
+INT16 REM_ReadObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size); /* O - Block size needed for next read */
+
+
+INT16 REM_WriteObj( FILE_HAND hand, /* I - handle of object to read from */
+ CHAR_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size); /* O - Block size need for next read */
+
+INT16 REM_VerObj( FILE_HAND hand, /* I - file handle to verify data with */
+ CHAR_PTR buf, /* I - buffer needed to perform verify */
+ CHAR_PTR data, /* I - data to verify against */
+ UINT16 *size, /*I/O- size of buffers / amount verified */
+ UINT16 *blk_size); /* O - minum size of block for next call */
+
+
+INT16 REM_CloseObj( FILE_HAND hand ); /* I - handle of object to close */
+
+INT16 REM_DeleteObj( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 REM_FindFirst( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+ CHAR_PTR sname, /* I - serach name */
+ UINT16 find_type); /* I - type of find (dirs only, all, etc.) */
+
+INT16 REM_FindNext( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* O - Discriptor block */
+
+INT16 REM_GetObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /*I/O- On entry it is minimal on exit Complete */
+
+INT16 REM_VerObjInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - On entry it is minimal on exit Complete */
+
+INT16 REM_ChangeDir( FSYS_HAND fsh, /* I - file system to changing directories on */
+ CHAR_PTR path, /* I - describes the path of the new directory */
+ INT16 psize); /* I - specifies the length of the path */
+
+INT16 REM_UpDir( FSYS_HAND fsh ); /* I - file system to change directories in */
+
+INT16 REM_GetCurrentPath( FSYS_HAND fsh, /* I - file system to get current path from */
+ CHAR_PTR path, /* O - buffer to place this path */
+ INT16 *size); /*I/O- size of buffer on entry & on exit */
+
+INT16 REM_SeekObj( FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ); /*I/O- Offset to seek; Number of bytes actualy seeked */
+
+INT16 REM_GetMaxSizeDBLK( FSYS_HAND fsh /* not used */ );
+
+INT16 REM_GetBasePath( FSYS_HAND fsh, /* I - file system to get base path from */
+ CHAR_PTR full_path, /* O - buffer to place this path */
+ INT16 *size ); /*I/O- size of buffer on entry & on exit */
+
+INT16 REM_GetCurrentDDB( FSYS_HAND fsh, /* I - file system to get DDB from */
+ DBLK_PTR dblk ); /* O - place to put the DDB data */
+
+INT16 REM_SetObjInfo( FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk); /* I - data to write to disk */
+
+INT16 REM_ModFnameFDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it, /* I - TRUE if setting file name, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get file name from */
+ CHAR_PTR buf, /*I/O- file name to read (or to write) */
+ INT16 *size ) ; /*I/O- size buffer on entry and exit */
+
+INT16 REM_ModPathDDB( FSYS_HAND fsh, /* I - File system handle */
+ BOOLEAN set_it , /* I - TRUE if setting path, FALSE if getting */
+ DBLK_PTR dblk, /* I - Descriptor block to get path from */
+ CHAR_PTR buf, /*I/O- path to read (or to write) */
+ INT16 *size ); /*I/O- size of buffer on entry and exit */
+
+INT16 REM_GetOSFnameFDB( DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ) ; /*I/O- path to read (or to write) */
+
+INT16 REM_GetOSPathDDB(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk , /* I - Descriptor block to get path from */
+ CHAR_PTR buf ) ; /*I/O- path to read (or to write) */
+
+INT16 REM_GetFileVerFDB( DBLK_PTR dblk ,
+ UINT32 *version ) ;
+
+INT16 REM_GetCDateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ); /*I/O- createion date to read (or to write) */
+
+INT16 REM_GetMDateDBLK( DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /* O - modify date to write */
+
+INT16 REM_ModBDateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 REM_ModADateDBLK( BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+ DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+ DATE_TIME_PTR buf ) ; /*I/O- createion date to read (or to write) */
+
+INT16 REM_ModAttribDBLK( BOOLEAN set_it ,
+ DBLK_PTR dblk ,
+ UINT32_PTR attr );
+
+
+INT16 REM_GetObjTypeDBLK( DBLK_PTR dblk,
+ OBJECT_TYPE *type );
+
+
+UINT32 REM_GetGenSizeDBLK( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+
+UINT32 REM_GetGenOffsetDBLK( FSYS_HAND fsh, /* I - File system handle - not used */
+ DBLK_PTR dblk ) ; /* I - Descriptor block to get generic data size for */
+
+INT16 REM_GetOS_InfoDBLK( DBLK_PTR dblk, /* I - DBLK to get the info from */
+ CHAR_PTR os_info, /* O - Buffer to place data */
+ INT16 *size ); /*I/O- Buffer size / data length */
+
+INT16 REM_GetActualSizeDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk ) ;
+
+INT16 REM_SizeofFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ); /* I - dblk to get fname from */
+
+INT16 REM_SizeofOSFname( FSYS_HAND fsh, /* I - file system in use */
+ DBLK_PTR fdb ) ; /* I - dblk to get fname from */
+
+INT16 REM_SizeofPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 REM_SizeofOSPath( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR ddb ) ; /* I - DBLK to get path size from */
+
+INT16 REM_SizeofOSInfo( FSYS_HAND fsh, /* I - File system handle */
+ DBLK_PTR dblk ); /* I - DBLK to get size of OS info for */
+
+
+INT16 REM_MatchDBLK( FSYS_HAND fsh , /* I - file system used to do comparison */
+ DBLK_PTR dblk1, /* I - DDB, IDB, or UDB just not FDB */
+ DBLK_PTR dblk2, /* I - FDB if above is DDB else unused */
+ BOOLEAN disp_flag,/* I - TRUE if match DIR for display purpose */
+ struct FSE *fse ); /* I - FSE to compare against */
+
+INT16 REM_PushMinDDB( FSYS_HAND fsh,
+ DBLK_PTR dblk );
+
+INT16 REM_PopMinDDB( FSYS_HAND fsh ,
+ DBLK_PTR dblk );
+
+
+INT16 REM_CreateFDB( FSYS_HAND fsh,
+ GEN_FDB_DATA_PTR dat ) ;
+
+INT16 REM_CreateDDB( FSYS_HAND fsh,
+ GEN_DDB_DATA_PTR dat ) ;
+
+VOID REM_SetOwnerId( FSYS_HAND fsh, DBLK_PTR dblk, UINT32 id ) ;
+
+UINT16 AddRemoteDriveDLEs( GENERIC_DLE_PTR parent_dle ) ;
+
+BOOLEAN REM_ProcessDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 REM_ChangeIntoDDB( FSYS_HAND fsh, DBLK_PTR ddb ) ;
+
+INT16 REM_Initialize(
+DLE_HAND dle_hand,
+BE_CFG_PTR cfg,
+UINT32 file_sys_mask ) ;
+
+VOID REM_DeInit( DLE_HAND dle_hand ) ;
+
+INT16 AddRemoteWorkStationDLEs(
+DLE_HAND hand,
+BE_CFG_PTR cfg,
+UINT32 file_sys_mask ) ;
+
+INT16 REM_DeviceDispName(
+GENERIC_DLE_PTR dle,
+CHAR_PTR dev_name,
+INT16 size ,
+INT16 type ) ;
+
+INT16 REM_MakePath(
+CHAR_PTR buf,
+INT16 bsize,
+GENERIC_DLE_PTR dle,
+CHAR_PTR path,
+INT16 psize,
+CHAR_PTR fname ) ;
+
+
diff --git a/private/utils/ntbackup/inc/remdblk.h b/private/utils/ntbackup/inc/remdblk.h
new file mode 100644
index 000000000..7c8482a7f
--- /dev/null
+++ b/private/utils/ntbackup/inc/remdblk.h
@@ -0,0 +1,76 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: remdblk.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the definition of the Remote DOS
+ file systems' file and directory control blocks.
+
+
+ $Log: G:/LOGFILES/REMDBLK.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:33:02 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+
+#ifndef remdblk_h
+#define remdblk_h
+
+
+#include "queues.h"
+#include "doscom.h"
+#include "smb.h"
+
+
+typedef struct REM_FDB_INFO *REM_FDB_INFO_PTR;
+
+typedef struct REM_FDB_INFO {
+ BOOLEAN inuse_attrib ;
+ UINT16 handle ;
+ UINT16 os_name ;
+} REM_FDB_INFO ;
+
+
+typedef struct REM_DDB_INFO *REM_DDB_INFO_PTR;
+
+typedef struct REM_DDB_INFO {
+ BOOLEAN empty_attrib ;
+ CHAR path[ DOS_MAX_DSIZE ] ; /* build from "name" and current dir */
+ UINT16 os_path ;
+ UINT16 os_path_leng ;
+} REM_DDB_INFO;
+
+
+
+typedef struct REM_DBLK *REM_DBLK_PTR;
+
+typedef struct REM_DBLK {
+ UINT8 blk_type; /* values: DDB_ID, FDB_ID set: DOS */
+ COM_DBLK fs_reserved ;
+ SMB_DTA dta;
+ UINT16 tape_attribs ;
+ BOOLEAN os_info_complete; /* TRUE if GetObjInfo doesn't have to do anything */
+ union {
+ REM_DDB_INFO d;
+ REM_FDB_INFO f;
+ } b;
+} REM_DBLK;
+
+
+typedef struct REM_MIN_DDB *REM_MIN_DDB_PTR;
+
+typedef struct REM_MIN_DDB {
+ Q_ELEM q ;
+ UINT8 reserved[ 21 ] ; /* reserved for dos */
+ UINT16 psize ; /* size of path string */
+ CHAR_PTR path; /* build from "name" and current dir */
+} REM_MIN_DDB;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/reqrep.h b/private/utils/ntbackup/inc/reqrep.h
new file mode 100644
index 000000000..07bcab044
--- /dev/null
+++ b/private/utils/ntbackup/inc/reqrep.h
@@ -0,0 +1,159 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\reqrep.h
+subsystem\TAPE FORMAT\reqrep.h
+$0$
+
+ Name: reqrep.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the interface structure between the TFL and the
+ Loops. Called the Request/Reply Structure.
+
+ Location: BE_PRIVATE
+
+$Header: T:/LOGFILES/REQREP.H_V 1.5 19 Oct 1992 14:15:56 HUNTER $
+
+$Log: T:/LOGFILES/REQREP.H_V $
+ *
+ * Rev 1.5 19 Oct 1992 14:15:56 HUNTER
+ * Corrected Steve's typo in the defines ...
+ *
+ * Rev 1.4 15 Oct 1992 09:45:06 HUNTER
+ * Added new stream messages
+ *
+ * Rev 1.3 16 Sep 1992 14:08:18 HUNTER
+ * Added STREAM element and add LRR_SKIP_STREAM message.
+ *
+ * Rev 1.2 15 Oct 1991 14:53:24 STEVEN
+ * added end data message for variable length files
+ *
+ * Rev 1.1 10 May 1991 17:22:44 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:48 GREGG
+Initial revision.
+
+ Rev 2.1 19 Jun 1990 16:06:16 HUNTER
+ Fast File Retrieval
+
+ Rev 2.0 21 May 1990 14:19:44 PAT
+ Baseline Maynstream 3.1
+
+$-4$
+**/
+#ifndef REQREP_JUNK
+#define REQREP_JUNK
+
+#include "fsys.h" /* The FileSystem Standard Interface */
+#include "tflstats.h" /* Statistics structure */
+#include "tloc.h" /* Tape Location Structure */
+
+/* $end$ include list */
+
+typedef struct {
+ UINT16 channel ;
+ UINT16 lp_message ; /* Loops Messages */
+ UINT16 tf_message ; /* Tape Format Message */
+ DBLK_PTR cur_dblk ; /* For loops to store dblk */
+ UINT8_PTR buff_ptr ; /* Buffer Pointer */
+ UINT16 buff_size ; /* Size of Buffer */
+ UINT16 buff_used ; /* How much was used */
+ UINT16 requested_size ; /* The Loops demands this much buffer space */
+ TLOC tape_loc ; /* The tape location position */
+ UINT16 filter_to_use ; /* Apply this filter */
+ UINT32 attributes ; /* Attributes to apply */
+ DBLK_PTR vcb_ptr ; /* Last VCB */
+ DBLK_PTR ddb_ptr ; /* Last DDB */
+ DBLK_PTR fdb_ptr ; /* Last FDB */
+ DBLK_PTR idb_ptr ; /* Last IDB */
+ TF_STATS eov_stats ; /* Statistics for this tape */
+ INT16 error_locus ; /* What the error was */
+ UINT32 error_file_offset ; /* Where in the file the error occurred */
+ UINT16 error_data_loss ; /* How much data was lost */
+ DBLK_PTR cfdb_ptr ; /* CFDB used during backup */
+ GEN_CFDB_DATA_PTR cfdb_data_ptr ; /* CFDB data used during backup */
+ STREAM_INFO stream ; /* Stream info */
+} RR, *RR_PTR ;
+
+/* Loops WRITE Messages */
+
+#define LRW_START 0x0001
+#define LRW_ABORT 0x0002
+#define LRW_VCB 0x0003
+#define LRW_DDB 0x0004
+#define LRW_FDB 0x0005
+#define LRW_IDB 0x0006
+#define LRW_CFDB 0x0007
+#define LRW_NEW_STREAM 0x0008
+#define LRW_DATA 0x0009
+#define LRW_CATALOG 0x000a
+#define LRW_EOM_ACK 0x000b
+#define LRW_END 0x000c
+#define LRW_DATA_END 0x000d
+
+/* Loops READ Messages */
+
+#define LRR_START 0x8001
+#define LRR_CATALOG 0x8002
+#define LRR_GOTO_LBA 0x8003
+#define LRR_STUFF 0x8004
+#define LRR_ABORT 0x8005
+#define LRR_SKIP 0x8006
+#define LRR_SKIP_STREAM 0x8007
+#define LRR_RETRY 0x8008
+#define LRR_EOM_ACK 0x8009
+#define LRR_FINISHED 0x800A
+
+/* TFL WRITE Messages */
+
+#define TRW_DB 0x0001
+#define TRW_DATA 0x0002
+#define TRW_FATAL_ERR 0x0003
+#define TRW_DONE 0x0004
+#define TRW_EOM 0x0005
+#define TRW_CATALOG 0x0006
+#define TRW_CALL_AGAIN 0x0007
+
+/* TLF READ Messages */
+
+#define TRR_VCB 0x8001
+#define TRR_DDB 0x8002
+#define TRR_FDB 0x8003
+#define TRR_IDB 0x8004
+#define TRR_CFDB 0x8005
+#define TRR_UDB 0x8006
+#define TRR_NEW_STREAM 0x8007
+#define TRR_CATALOG 0x8008
+#define TRR_DATA 0x8009
+#define TRR_CALL_AGAIN 0x800a
+#define TRR_DATA_END 0x800b
+
+/* Can't Recover */
+#define TRR_FATAL_ERR 0x800c
+/* Possible To Recover */
+#define TRR_RECV_ERR 0x800d
+/* Hit an EOM */
+#define TRR_EOM 0x800e
+/* All Done */
+#define TRR_END 0x800f
+
+/* Error Locus Field */
+#define TF_ERROR_IN_DATA_PORTION 0x1
+#define TF_ERROR_IN_DBLK 0x2
+#define TF_ERROR_BLK_WAS_FDB 0x3
+#define TF_ERROR_BLK_WAS_DDB 0x4
+#define TF_ERROR_IN_UNKNOWN_AREA 0x5
+
+#endif
+
+
+
+
+
diff --git a/private/utils/ntbackup/inc/res_io.h b/private/utils/ntbackup/inc/res_io.h
new file mode 100644
index 000000000..475a91898
--- /dev/null
+++ b/private/utils/ntbackup/inc/res_io.h
@@ -0,0 +1,5 @@
+#ifdef MBS
+#include "mbs_res.h"
+#else
+#include "msii.h"
+#endif
diff --git a/private/utils/ntbackup/inc/resmang.h b/private/utils/ntbackup/inc/resmang.h
new file mode 100644
index 000000000..1f23136da
--- /dev/null
+++ b/private/utils/ntbackup/inc/resmang.h
@@ -0,0 +1,130 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: resmang.h
+
+ Description: This file contains the definitions, macros and function
+ prototypes for the Maynstream GUI Resource Manager (RSM).
+
+ $Log: G:/UI/LOGFILES/RESMANG.H_V $
+
+ Rev 1.15 03 Aug 1993 19:44:32 MARINA
+RSM_GetBitmapSize(), RSM_GetFontSize(): changed params to LPINT
+
+ Rev 1.14 27 Jul 1993 10:37:14 GLENN
+Now using the resource file defined in proddefs.h
+
+ Rev 1.13 24 Feb 1993 13:57:36 chrish
+Changed for CAYMAN NT.
+
+ Rev 1.12 18 Feb 1993 13:48:04 BURT
+Changes for Cayman
+
+
+ Rev 1.11 01 Nov 1992 16:32:38 DAVEV
+Unicode changes
+
+ Rev 1.10 04 Oct 1992 19:48:54 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.9 25 Jun 1992 12:24:12 STEVEN
+LPCSTR was not defined
+
+ Rev 1.8 30 Mar 1992 18:05:22 GLENN
+Added support for pulling resources from .DLL
+
+ Rev 1.7 27 Mar 1992 17:34:38 GLENN
+Changed cursor and icon load macros to functions.
+
+ Rev 1.6 02 Mar 1992 17:21:22 DAVEV
+Rev 1.3 was somehow lost. Put it back in
+
+ Rev 1.5 02 Mar 1992 17:10:36 DAVEV
+fixed mistake in previous rev. change
+
+ Rev 1.4 02 Mar 1992 11:32:14 DAVEV
+Conditionally include OMSTRING.H instead of STRINGS.H if OEM_MSOFT defined
+
+ Rev 1.3 25 Feb 1992 21:35:06 GLENN
+Created RSM_Sprintf().
+
+ Rev 1.2 22 Jan 1992 12:23:38 GLENN
+Added RSM_IsResourceID() macro.
+
+ Rev 1.1 10 Dec 1991 13:49:54 GLENN
+Added prototypes for get bitmap, font, font string sizes
+
+ Rev 1.0 20 Nov 1991 19:38:52 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+
+#ifndef SS_RSM_H
+
+#define SS_RSM_H
+
+
+// Windows internal CURSOR and ICON resources are between
+// WIN_RES_MIN and WIN_RES_MAX.
+
+#define WIN_RES_MIN ID(32000)
+#define WIN_RES_MAX ID(33000)
+
+#define ID_NOTDEFINED 0x7FFF
+
+#define RSM_MAGICCOLOR 0x000000FF // PURE BLUE - DIB FORMAT
+
+#define RSM_RESFILE RESFILENAME
+
+// ICON, CURSOR, BITMAP, STRING, RIBBON KEY definitions are included here.
+
+#include "icons.h"
+#include "cursors.h"
+#include "bitmaps.h"
+#include "ctl3d.h"
+
+#if defined ( OEM_MSOFT ) // include product specific files // chs: 02-24-93
+# include "omstring.h"
+#else // Include standard Maynstream product files
+# include "strings.h"
+#endif
+
+#include "keys.h"
+
+
+// STRUCTURE DEFINITIONS
+
+// MACROS
+
+#define BTNFACE_BACKGND ((WORD)200 )
+
+#define RSM_CursorSet( x ) SetCursor( x )
+#define RSM_IconDraw( w, x, y, z ) DrawIcon( z, x, y, w )
+#define RSM_IsResourceID( x ) (BOOL)( ( x ) && ! HIWORD( x ) )
+#define RSM_StringCopy( x, y, z ) RSM_StringLoad( ((VOID_PTR)((DWORD)(x))), y, z )
+
+
+// FUNCTION PROTOTYPES
+
+BOOL RSM_BitmapDraw ( WORD, INT, INT, INT, INT, HDC );
+BOOL RSM_BitmapDrawCentered ( WORD, INT, INT, INT, INT, HDC );
+BOOL RSM_BitmapFree ( WORD );
+VOID RSM_BitmapFreeAll ( VOID );
+VOID RSM_BitmapInit ( VOID );
+HBITMAP RSM_BitmapLoad ( WORD, COLORREF );
+VOID RSM_BitmapStretch ( HDC, WORD, INT, INT );
+HCURSOR RSM_CursorLoad ( LPSTR );
+BOOL RSM_GetBitmapSize ( WORD, LPINT, LPINT );
+BOOL RSM_GetFontSize ( HFONT, LPINT, LPINT, LPINT );
+BOOL RSM_GetFontStringWidth ( HFONT, LPSTR, INT );
+HICON RSM_IconLoad ( LPSTR );
+INT RSM_StringLoad ( VOID_PTR, LPSTR, INT );
+INT RSM_Sprintf ( LPSTR, LPSTR, ... );
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/resource.h b/private/utils/ntbackup/inc/resource.h
new file mode 100644
index 000000000..ccae66a0c
--- /dev/null
+++ b/private/utils/ntbackup/inc/resource.h
@@ -0,0 +1,114 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+ Name: resource.h
+
+ Description: Contains the function prototypes for the resource layer.
+
+ $Log: J:/LOGFILES/RESOURCE.H_V $
+
+ Rev 1.6 27 Aug 1992 10:31:32 CLIFF
+Changed MAYN_OS2 to OS_OS2.
+
+ Rev 1.5 02 Mar 1992 09:22:48 NED
+finally got MemFill prototype right (!)
+
+ Rev 1.4 02 Mar 1992 09:08:58 NED
+re-added OS2_DMA_xfer() prototype for OS/2
+
+ Rev 1.3 28 Feb 1992 19:28:14 CHARLIE
+Did a VDEL on the previous Rev 1.3
+
+Added prototype for SetIntVectors
+
+Cannot add prototype for OS2_DMA_xfer because TDD_PTR is not yet defined
+when this file is included
+
+ Rev 1.2 28 Feb 1992 11:17:04 NED
+fixed prototype for MemFill()
+
+ Rev 1.1 25 Feb 1992 14:27:04 NED
+fixed prototype
+
+ Rev 1.0 17 Jul 1991 15:33:06 ED
+Initial revision.
+**/
+
+#ifndef RESOURCES
+
+#define RESOURCES
+
+
+/* Memory Prototypes ( Memory.c )
+*/
+
+VOID_PTR MemAlloc( UINT16, UINT16 ) ;
+VOID MemFree( VOID_PTR ) ;
+VOID_PTR MemFill( VOID_PTR, UINT16, UINT32 ) ;
+
+/* Port IO prototypes ( InOuts.c )
+*/
+
+UINT8 InByte( UINT16 ) ;
+UINT16 InWord( UINT16 ) ;
+VOID OutByte( UINT16, UINT8 ) ;
+VOID OutWord( UINT16, UINT16 ) ;
+
+#ifdef DEBUG_IO
+#include <stdio.h>
+VOID DumpIOTable( FILE * ) ;
+VOID DumpIOTraceSTD( void ) ;
+VOID DumpIOTraceFile( void ) ;
+#endif
+
+PF_VOID SetIntVec( UINT8, PF_VOID ) ;
+BOOLEAN UnMaskHwInt( INT16 ) ;
+VOID MaskHwInt( INT16 ) ;
+INT16 intstat( INT16 ) ;
+VOID int_proc( void ) ;
+VOID TestIntHandler( void );
+VOID Cli( void );
+VOID Sti( void );
+
+/* EOI Functions */
+VOID SendEOI( void ) ;
+
+/* The string prototypes */
+INT16 StringLength( CHAR_PTR ) ;
+VOID StringCopy( CHAR_PTR, CHAR_PTR ) ;
+VOID StringNCopy( CHAR_PTR, CHAR_PTR, INT16 ) ;
+INT16 StringNCompare( CHAR_PTR, CHAR_PTR, INT16 ) ;
+
+/* The dma routines */
+
+BOOLEAN DMA_Transfer( INT16, XBLK_PTR, INT16, UINT16 ) ;
+UINT8_PTR DMA_Calculate( XBLK_PTR ) ;
+VOID DMA_Disable( INT16 ) ;
+UINT16 DMA_Bytes_Left( INT16 ) ;
+BOOLEAN DMA_TerminalCount( INT16 ) ;
+VOID DMA2_Setup( void ) ;
+VOID DMA2_Reset( void ) ;
+
+#if defined(OS_OS2)
+
+struct TDD;
+struct TCB;
+BOOLEAN OS2_DMA_xfer( struct TCB *curTCB, struct TDD *curTDD ) ;
+
+#endif
+
+/* determine machine */
+INT16 DetermineMachine( void ) ;
+
+/*
+** Where to get driver files from
+*/
+
+extern CHAR_PTR GetDriverPath( VOID ) ;
+
+/* PS/2 info */
+UINT16 get_ps2_info( UINT16, UINT8_PTR ) ;
+
+PF_VOID SetIntVectors( UINT16 drive, UINT16 install ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/retbuf.h b/private/utils/ntbackup/inc/retbuf.h
new file mode 100644
index 000000000..f20748bba
--- /dev/null
+++ b/private/utils/ntbackup/inc/retbuf.h
@@ -0,0 +1,44 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: retbuf.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: The return buffer. Contains the definition for the return
+ information buffer.
+
+ Location: BE_PUBLIC
+
+
+ $Log: T:/LOGFILES/RETBUF.H_V $
+ *
+ * Rev 1.2 18 Jan 1993 16:15:42 BobR
+ * Deleted ESA info that is now found in "esa.h"
+
+**/
+/* $end$ include list */
+
+#include "esa.h"
+
+#ifndef _RETBUF
+
+#define _RETBUF
+
+
+typedef struct {
+ UINT8_PTR buffer ; /* The pointer to the buffer ( if applicable ) */
+ UINT32 len_req ; /* The transfer requested length */
+ UINT32 len_got ; /* What the driver actually got */
+ INT16 gen_error ; /* If non-zero, the GENERIC ERROR */
+ INT16 call_type ; /* The GENERIC FUNCTION CODE */
+ UINT32 status ; /* The Status Word, valid if "call_type" is GEN_STATUS or if "gen_error is set" */
+ UINT32 misc ; /* Miscellaneous Field -- see DIL functions for values */
+ UINT16 readerrs ; /* The number of read errors */
+ UINT16 underruns ; /* The number of underruns */
+ ESA the ; /* The Extended Status Array */
+} RET_BUF, *RET_BUF_PTR ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/ribmang.h b/private/utils/ntbackup/inc/ribmang.h
new file mode 100644
index 000000000..eb84feee6
--- /dev/null
+++ b/private/utils/ntbackup/inc/ribmang.h
@@ -0,0 +1,222 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: ribmang.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the Maynstream GUI Ribbon Manager (RIB).
+
+ $Log: G:\ui\logfiles\ribmang.h_v $
+
+ Rev 1.11 29 Jun 1993 13:26:46 KEVINS
+Decreased RIB_TIMERDELAY from 150 ms. to 50 ms.
+
+ Rev 1.10 09 Apr 1993 14:14:18 GLENN
+Added RIB_ItemEnable, RIB_Init, RIB_Deinit, RIB_IsItemEnabled routines.
+
+ Rev 1.9 03 Mar 1993 16:40:02 ROBG
+Added function prototype for RIB_ItemEnableState
+
+ Rev 1.8 02 Mar 1993 15:19:58 ROBG
+Added function RIB_UpPosition to support WIN32 applications.
+
+ Rev 1.7 18 Nov 1992 13:33:52 GLENN
+Added microsoft 3D button enhancement.
+
+ Rev 1.6 04 Oct 1992 19:48:56 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.5 02 Apr 1992 15:38:06 GLENN
+Added bitmap and text rectangles for buttons - drawing is faster. Supports NT better now.
+
+ Rev 1.4 12 Dec 1991 17:11:02 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.3 10 Dec 1991 13:57:20 GLENN
+Added RIB_AutoCalcSize() stuff
+
+ Rev 1.2 05 Dec 1991 17:37:10 GLENN
+Fixed RIB_IsDownMessage() macro NT changes
+
+ Rev 1.1 04 Dec 1991 16:36:28 DAVEV
+16/32 bit Windows port changes-1st pass
+
+ Rev 1.0 20 Nov 1991 19:39:30 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef SS_RIB_H
+
+#define SS_RIB_H
+
+
+// SEE BITMAPS.H FOR BITMAP RESOURCE DEFINITIONS.
+// SEE SS_RSM.H -- RESOURCE HEADER FILE -- FOR BITMAP RESOURCE ID's.
+
+#define RIB_AUTOCALCSIZE 0x7FFF
+#define RIB_ITEMUNKNOWN 0x7FFF
+#define RIB_KEYUSED TRUE
+
+#define RIB_DOWNMESSAGE 0x01
+#define RIB_DOWNREPEAT 0x02
+#define RIB_DOWNNOSTATUSTEXT 0x04
+
+#define RIB_ITEM_STYLECHICKLET 0x01
+
+#define RIB_TIMERID 1
+#define RIB_TIMERDELAY 50 // In milliseconds.
+
+#define RIB_ITEM_BORDER_WIDTH 4
+
+#define RIB_ITEM_UP 0x01
+#define RIB_ITEM_DOWN 0x00
+#define RIB_ITEM_ENABLED 0x02
+#define RIB_ITEM_DISABLED 0x00
+#define RIB_ITEM_POSITIONAL 0x04
+#define RIB_ITEM_MOMEMTARY 0x00
+#define RIB_ITEM_NOMENUITEM 0x08
+#define RIB_ITEM_MENUITEM 0x00
+
+#define RIB_RIBBON_HORIZONTAL 0x01
+#define RIB_RIBBON_VERTICAL 0x00
+#define RIB_RIBBON_ENABLED 0x02
+#define RIB_RIBBON_DISABLED 0x00
+
+#define RIB_APPEND 0xF000
+#define RIB_KEYBOARD 1
+#define RIB_MOUSE 2
+
+#define MAIN_RIBBON 1
+#define DOC_RIBBON 2
+
+#define MAIN_RIBBON_MAXITEMS 16
+#define MAIN_RIBBON_ITEMWIDTH 60
+#define MAIN_RIBBON_HEIGHT 40
+#define DOC_RIBBON_MAXITEMS 10
+#define DOC_RIBBON_ITEMWIDTH 70
+#define DOC_RIBBON_HEIGHT 24
+
+#define RIB_ITEM_TEXT_SIZE 30
+
+#define RIB_TEXT_TOP 0x0001
+#define RIB_TEXT_BOTTOM 0x0002
+#define RIB_TEXT_LEFT 0x0004
+#define RIB_TEXT_RIGHT 0x0008
+#define RIB_TEXT_HLEFT 0x0010
+#define RIB_TEXT_HRIGHT 0x0020
+#define RIB_TEXT_HCENTER 0x0040
+#define RIB_TEXT_VTOP 0x0100
+#define RIB_TEXT_VBOTTOM 0x0200
+#define RIB_TEXT_VCENTER 0x0400
+
+// STRUCTURE DEFINITIONS
+
+typedef struct {
+
+ RECT Rect; // Item rectangle.
+ RECT rcBM; // Bitmap rectangle.
+ RECT rcText; // Text rectangle.
+ WORD wStyle; // Style of displaying the item (3D, etc...)
+ WORD wEnabledID; // Enabled bitmap ID.
+ WORD wDisabledID; // Disabled bitmap ID.
+ WORD wStringID; // Item text or string ID.
+ WORD wAccelKey; // Item accelerator key.
+ WORD wState; // Current item state:
+ // bit 0, 0/1 = button DOWN/UP
+ // bit 1, 0/1 = button DISABLED/ENABLED
+ // bit 2, 0/1 = button MOMENTARY/POSITIONAL
+ // bit 3, 0/1 = button MENUITEM/NO MENUITEM
+ WORD wMessage; // Message to send to the current owner.
+ HFONT hFont; // Font handle for text.
+ WORD wTextStyle; // Text Style:
+ // bit 0, 0/1 = text on top
+ // bit 1, 0/1 = text on bottom
+ // bit 2, 0/1 = text on left
+ // bit 3, 0/1 = text on right
+ // bit 4, 0/1 = text left justified
+ // bit 5, 0/1 = text right justified
+ // bit 6, 0/1 = text horizontally centered
+ // bit 7, 0/1 = text vertically centered
+
+} DS_RIBITEMINFO, far *PDS_RIBITEMINFO;
+
+typedef struct {
+
+ HWND hWnd; // Ribbon window handle.
+ WORD wStatus; // Status:
+ // bit 0, 0/1 = ribbon VERTICAL/HORIZONTAL
+ // bit 1, 0/1 = ribbon DISABLED/ENABLED
+ WORD wType; // Type of ribbon:
+ // bit 0, 0/1 = BUTTON DOWN MESSAGE SENT
+ // bit 1, 0/1 = BUTTON DOWN WITH REPEATING DOWN
+ // bit 2, 0/1 = BUTTON DOWN WITH NO STATUS LINE MESSAGE
+ // bit 3, 0/1 = MICROSOFT TYPE 3-D
+ INT nItemWidth; // Item or button width.
+ INT nItemHeight; // Item or button height.
+ HWND hWndCurOwner; // Current window to send resulting messages to.
+ INT nMaxItems; // Maximum number of items in the ribbon.
+ INT nNumItems; // Current number of items in the ribbon.
+ INT nCurItem; // Current number of action item in the ribbon.
+ PDS_RIBITEMINFO pdsItemList; // Pointer to the ribbon item list.
+
+} DS_RIBINFO, far *PDS_RIBINFO, far *HRIBBON;
+
+typedef struct {
+
+ HRIBBON hRib; // handle to a spinner ribbon
+ WORD wIncrementMsg; // spinner increment message
+ WORD wDecrementMsg; // spinner decrement message
+
+} DS_SPINNER, far *HSPINNER;
+
+
+// MACROS
+
+#define RIB_Draw( x ) InvalidateRect( (x)->hWnd, NULL, TRUE )
+#define RIB_ItemAppend( x, y ) RIB_ItemInsert( x, RIB_APPEND, y )
+#define RIB_SetOwner( x, y ) ( (x)->hWndCurOwner = y )
+#define RIB_IsDownMessage( mp1, mp2 ) ( GET_WM_COMMAND_CMD ( mp1, mp2 ) == RIB_ITEM_DOWN )
+
+// FUNCTION PROTOTYPES
+
+WINRESULT APIENTRY WM_RibbonWndProc (HWND, MSGID, MP1, MP2);
+
+BOOL RIB_Init ( HANDLE, HANDLE );
+VOID RIB_Deinit ( VOID );
+VOID RIB_SystemChange ( VOID );
+
+BOOL RIB_Activate ( HRIBBON );
+INT RIB_AutoCalcSize ( HRIBBON );
+HRIBBON RIB_Create( HWND, WORD, INT, INT, INT );
+BOOL RIB_Deactivate ( HRIBBON );
+BOOL RIB_Destroy( HRIBBON );
+BOOL RIB_Disable( HRIBBON, LPSTR );
+BOOL RIB_Enable( HRIBBON, LPSTR );
+BOOL RIB_GetInfo( HRIBBON, PDS_RIBINFO );
+HWND RIB_GetOwner( HRIBBON );
+BOOL RIB_GetState( HRIBBON, LPSTR );
+HRIBBON RIB_Load( WORD );
+BOOL RIB_SetState ( HRIBBON, LPSTR );
+BOOL RIB_KeyUp ( HWND, WORD, MP1, MP2 );
+BOOL RIB_KeyDown ( HWND, WORD, MP1, MP2 );
+VOID RIB_UpPosition ( HRIBBON );
+
+BOOL RIB_ItemDelete ( HRIBBON, UINT );
+VOID RIB_ItemDraw ( HRIBBON, HDC, PDS_RIBITEMINFO );
+BOOL RIB_ItemEnable ( HRIBBON, WORD, BOOL );
+BOOL RIB_ItemInsert ( HRIBBON, UINT, PDS_RIBITEMINFO );
+BOOL RIB_ItemGetState ( HRIBBON, UINT, PDS_RIBITEMINFO );
+BOOL RIB_ItemReplace ( HRIBBON, WORD, PDS_RIBITEMINFO );
+BOOL RIB_ItemSetState ( HRIBBON, WORD, WORD );
+
+BOOL RIB_IsItemEnabled ( HRIBBON, WORD );
+
+HSPINNER RIB_CreateSpinner ( HWND, WORD, INT, INT, WORD, WORD );
+VOID RIB_DestroySpinner ( HSPINNER );
+BOOL RIB_EnableSpinner ( HSPINNER, BOOL );
+
+#endif
diff --git a/private/utils/ntbackup/inc/rinitfs.h b/private/utils/ntbackup/inc/rinitfs.h
new file mode 100644
index 000000000..c00ffeab0
--- /dev/null
+++ b/private/utils/ntbackup/inc/rinitfs.h
@@ -0,0 +1,30 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: rinitfs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: N:/LOGFILES/RINITFS.H_V $
+ *
+ * Rev 1.1 21 Jun 1991 13:21:06 BARRY
+ * Changes for new config.
+ *
+ * Rev 1.0 09 May 1991 13:33:32 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+INT16 AddRemoteWorkStationDLEs( DLE_HAND hand );
+
+INT16 InitializeRemote( DLE_HAND dle_hand, struct BE_CFG *cfg ) ;
+
+VOID RemoveRemote( DLE_HAND dle_hand ) ;
+
diff --git a/private/utils/ntbackup/inc/rm.h b/private/utils/ntbackup/inc/rm.h
new file mode 100644
index 000000000..da11c2a99
--- /dev/null
+++ b/private/utils/ntbackup/inc/rm.h
@@ -0,0 +1,101 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: rm.h
+
+ Description: RM.H contains the return error codes and the five entry
+ points/prototypes for the Resource Manager.
+
+ Location: RM_PUBLIC
+
+
+ $Log: G:/UI/LOGFILES/RM.H_V $
+
+ Rev 1.5 09 Jun 1993 15:06:00 MIKEP
+enable c++
+
+ Rev 1.4 01 Nov 1992 16:32:52 DAVEV
+Unicode changes
+
+ Rev 1.3 04 Oct 1992 19:48:58 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 28 Jul 1992 14:55:22 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.1 27 Jul 1992 14:53:16 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.0 20 Nov 1991 19:41:58 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _rm_h_
+
+#define _rm_h_
+
+/* definitions */
+typedef struct RES_MAP *RES_MAP_PTR;
+typedef struct RES_MAP {
+ UINT16 resource_offset ; /* offset to start of data information */
+ UINT16 resource_size ; /* size of resource data within session */
+ UINT16 num_items_in_resource ; /* number of items within a given resource */
+ UINT16 offset_to_first_fixup ; /* offset to first indirect address to TEXT("fixup") */
+} RES_MAP ;
+
+typedef struct SES_INFO SES_INFO_PTR;
+typedef struct SES_INFO {
+ UINT32 session_offset ; /* offset from top of resource file */
+ UINT16 session_size ; /* size of entire session, data and map included */
+ UINT16 resource_map_offset ; /* offset to resource map from top of session */
+ UINT16 num_of_resources ; /* number of resources for this session */
+ UINT16 application_flags ; /* not used by manager at this time... */
+ RES_MAP_PTR res_map ; /* pointer to calloced array of resource map info */
+ UINT32_PTR res_data ; /* pointer to calloced block of resource data */
+} SES_INFO ;
+
+typedef struct RM_HDL *RM_HDL_PTR;
+typedef struct RM_HDL {
+ FILE *res_file_hdl ; /* source resource file handle */
+ UINT16 num_sessions ; /* number of session contained w/in Resource file */
+ SES_INFO_PTR sessions ; /* pointer to malloced array of session hdr info */
+} RM_HDL;
+
+
+/*
+ Define the error codes returned by the Resource Manager
+*/
+#define RM_NO_ERROR 0 /* need to check w/Bryan on error# ranges */
+#define RM_ERROR 200
+#define RM_FILE_NOT_FOUND 201
+#define RM_ERROR_OPENING_FILE 202
+#define RM_INSUFFICIENT_MEMORY 203
+#define RM_NULL_HDL 204
+#define RM_SESSION_NOT_FOUND 205
+#define RM_SESSION_ALREADY_OPEN 206
+#define RM_CORRUPT_SESSION 207
+#define RM_RESOURCE_NOT_FOUND 208
+
+/*
+ Open and close Resource prototypes
+*/
+RM_HDL_PTR RM_OpenResourceFile( CHAR_PTR filename, UINT16_PTR error ) ;
+VOID RM_CloseResourceFile( RM_HDL_PTR res_mgr_hdl ) ;
+
+/*
+ Load and unload Sessions prototypes
+*/
+UINT16 RM_OpenResourceSession( RM_HDL_PTR res_mgr_hdl, UINT16 session ) ;
+UINT16 RM_CloseResourceSession( RM_HDL_PTR res_mgr_hdl, UINT16 session ) ;
+
+/*
+ Return pointer to a Resource within a Loaded Session
+*/
+VOID_PTR RM_GetResource( RM_HDL_PTR res_mgr_hdl, UINT session, UINT resource,
+ UINT16_PTR num_items, UINT16_PTR error ) ;
+
+extern RM_HDL_PTR rm ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/rset.h b/private/utils/ntbackup/inc/rset.h
new file mode 100644
index 000000000..7e5b884e5
--- /dev/null
+++ b/private/utils/ntbackup/inc/rset.h
@@ -0,0 +1,71 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: rset.h
+
+ Description: include file for the rset.dlg and vset.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/RSET.H_V $
+
+ Rev 1.6 26 Feb 1993 17:18:08 STEVEN
+add registry
+
+ Rev 1.5 04 Oct 1992 19:49:00 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 24 Jun 1992 09:13:26 DAVEV
+added 'browse to path' button to dialog
+
+ Rev 1.3 03 Apr 1992 14:01:24 CARLS
+added vset dialog define for translate
+
+ Rev 1.2 03 Apr 1992 13:06:18 CARLS
+added translate defines
+
+ Rev 1.1 06 Feb 1992 10:10:52 CARLS
+added ID for security info
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_RESTORESET 34
+#define IDD_VERIFYSET 35
+#endif
+
+#ifndef RSET_H
+#define RSET_H
+
+#define IDM_RESTORESET 303
+#define IDM_VERIFYSET 304
+#define IDD_RSET_INFO_TITLE 101
+#define IDD_RSET_INFO_TAPE 305
+#define IDD_RSET_NEXT_BUTTON 102
+#define IDD_RSET_TAPE_NAME 103
+#define IDD_RSET_PREV_BUTTON 104
+#define IDD_RSET_DRIVE_BOX 105
+#define IDD_RSET_RESTORE_PATH 110
+#define IDD_RSET_VERIFY_AFTER 106
+#define IDD_RSET_BINDERY 107
+#define IDD_RSET_REGISTRY 107
+#define IDD_RSET_OK_BUTTON 119
+#define IDD_RSET_CANCEL_BUTTON 109
+#define IDD_RSET_DRIVE_TEXT 111
+#define IDD_RSET_SET_TEXT 112
+#define IDD_RSET_PATH_TEXT 113
+#define IDD_RSET_TAPE_NAME_TEXT 114
+#define IDD_RSET_SET_LINE_1 116
+#define IDD_RSET_SET_LINE_2 117
+#define IDD_RSET_SET_LINE_3 118
+#define IDD_RSET_SCROLLBAR 115
+#define IDD_RSET_SET_INFO 120
+#define IDD_RSET_HELP_BUTTON 121
+#define IDD_RSET_BROWSE_BUTTON 122
+#define IDD_RSET_SECURITY_INFO 123
+
+#endif
diff --git a/private/utils/ntbackup/inc/rt_dlg.h b/private/utils/ntbackup/inc/rt_dlg.h
new file mode 100644
index 000000000..ffff99ebc
--- /dev/null
+++ b/private/utils/ntbackup/inc/rt_dlg.h
@@ -0,0 +1,69 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: rt_dlg.h
+
+ Description: include file for the runtime.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/RT_DLG.H_V $
+
+ Rev 1.7 04 Oct 1992 19:49:02 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.6 20 Jul 1992 10:01:30 JOHNWT
+added gas gauge display
+
+ Rev 1.5 06 Apr 1992 13:21:58 CARLS
+removed unused IDs
+
+ Rev 1.4 03 Apr 1992 13:12:06 CARLS
+didn't change the dialog ID
+
+ Rev 1.3 03 Apr 1992 13:09:50 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_RUNTIME 40
+#endif
+
+#ifndef RT_DLG_H
+#define RT_DLG_H
+
+
+#define IDD_JS_DP 139
+#define IDD_JS_DP_LABEL 301
+#define IDD_JS_FP 122
+#define IDD_JS_FP_LABEL 115
+#define IDD_JS_BP 119
+#define IDD_JS_BP_LABEL 114
+#define IDD_JS_ET 121
+#define IDD_JS_ET_LABEL 113
+#define IDD_JS_CF 136
+#define IDD_JS_CF_LABEL 133
+#define IDD_JS_SF 137
+#define IDD_JS_SF_LABEL 135
+#define IDD_JS_OK 120
+#define IDD_JS_ABORT 123
+#define IDD_JS_LISTBOX 131
+#define IDD_JS_FOLDER 138
+#define IDD_JS_FILE 141
+#define IDD_JS_LINE1 125
+#define IDD_JS_LINE2 126
+#define IDD_JS_SOURCE_DRIVE 127
+#define IDD_JS_DEST_DRIVE 310
+#define IDD_JS_ARROW 312
+#define IDD_JS_SOURCE_NAME 130
+#define IDD_JS_DEST_NAME 311
+#define IDD_JS_HELP 116
+#define IDD_JS_N_OF_N 303
+#define IDD_JS_SUMMARY 305
+#define IDD_STATUS_BAR 201
+
+#endif
diff --git a/private/utils/ntbackup/inc/save_sel.h b/private/utils/ntbackup/inc/save_sel.h
new file mode 100644
index 000000000..679ea8ba3
--- /dev/null
+++ b/private/utils/ntbackup/inc/save_sel.h
@@ -0,0 +1,35 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: save_sel.h
+
+ Description: include file for the save_sel.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SAVE_SEL.H_V $
+
+ Rev 1.3 04 Oct 1992 19:49:04 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Apr 1992 13:15:16 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SELECTSAVE 4
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_DS_LIST 0x0065
+#define IDD_SS_FILENAME 0x0068
+#define IDD_SS_LIST 0x006A
+#define IDD_SAVE_FNAME 0x006B
+#define IDD_SAVE_FLIST 0x006C
+
diff --git a/private/utils/ntbackup/inc/sch_opts.h b/private/utils/ntbackup/inc/sch_opts.h
new file mode 100644
index 000000000..e448aae58
--- /dev/null
+++ b/private/utils/ntbackup/inc/sch_opts.h
@@ -0,0 +1,93 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: sch_opts.h
+
+ Description: include file for the sch_opts.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SCH_OPTS.H_V $
+
+ Rev 1.5 04 Oct 1992 19:49:10 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 08 Sep 1992 15:39:16 DARRYLP
+Added new IDs for Email - Windows for Workgroups...
+
+ Rev 1.3 03 Apr 1992 13:38:12 CARLS
+wrong dialog ID for translate
+
+ Rev 1.2 03 Apr 1992 13:20:22 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SCHEDOPTS 12
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_J_SNAME 501
+#define IDD_J_SMONTH 502
+#define IDD_J_SDAY 503
+#define IDD_J_SYEAR 504
+#define IDD_J_SHOUR 505
+#define IDD_J_SMINUTE 506
+#define IDD_J_SDATEL 507
+#define IDD_J_SDATER 508
+#define IDD_J_STIME 509
+#define IDD_J_SINTERVAL 510
+#define IDD_J_SEVERY 511
+#define IDD_J_SREPEAT 512
+#define IDD_J_SACTIVE 513
+#define IDD_J_SCURTIME 514
+#define IDD_J_SJOBLIST 515
+#define IDD_J_SDATEBOX 516
+#define IDD_J_STIMEBOX 517
+
+#define IDD_DATE_UP 520
+#define IDD_DATE_DOWN 521
+#define IDD_TIME_UP 522
+#define IDD_TIME_DOWN 523
+#define IDD_NUMBER_UP 524
+#define IDD_NUMBER_DOWN 525
+
+#define IDD_J_SMON 531
+#define IDD_J_STUE 532
+#define IDD_J_SWED 533
+#define IDD_J_STHU 534
+#define IDD_J_SFRI 535
+#define IDD_J_SSAT 536
+#define IDD_J_SSUN 537
+#define IDD_J_SRONCE 539
+#define IDD_J_SRHOURS 540
+#define IDD_J_SRDAYSOFWEEK 541
+#define IDD_J_SRWEEKSOFMONTH 542
+#define IDD_J_SRDAYSOFMONTH 543
+#define IDD_J_SNEXT 544
+
+#define IDD_J_SWEEKDAYS 555
+#define IDD_J_SDAYOFWEEKSTRING 556
+#define IDD_J_SDAYOFWEEK 557
+#define IDD_J_SDAYOFMONTH 558
+#define IDD_J_SSHOWWEEKORMONTH 559
+#define IDD_J_SDAYOFMONTHSTRING 561
+#define IDD_J_GEMAIL 562
+#define IDD_J_EMAILENABLE 563
+#define IDD_J_EMAILSETUP 564
+
+#define IDD_J_SDATEOFMONTH 0x0068
+#define IDD_J_SNUMHOURS 0x0089
+#define IDD_J_DATEOFMONTHBOX 0x008A
+#define IDD_J_NUMHOURSBOX 0x0081
+#define IDD_J_AM 0x1112
+#define IDD_J_PM 0x1113
+#define IDD_J_SSHOWDAYS 0x021A
+#define IDD_J_RIGHTEDGE 0x1114
+#define IDD_J_BOTTOMEDGE 0x1115
diff --git a/private/utils/ntbackup/inc/sched.h b/private/utils/ntbackup/inc/sched.h
new file mode 100644
index 000000000..10738010f
--- /dev/null
+++ b/private/utils/ntbackup/inc/sched.h
@@ -0,0 +1,44 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: sched.h
+
+ Description: Dialog item IDs for scheduling.
+
+ $Log: G:/UI/LOGFILES/SCHED.H_V $
+
+ Rev 1.4 04 Oct 1992 19:49:04 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 06 Apr 1992 04:14:40 CHUCKB
+Fixed job list id.
+
+ Rev 1.2 06 Apr 1992 09:56:38 CHUCKB
+Added define for translation.
+
+ Rev 1.1 03 Apr 1992 13:17:26 CARLS
+added translate defines
+
+ Rev 1.0 27 Jan 1992 13:41:32 GLENN
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _sched_h_
+
+#define _sched_h_
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_JOBSCHEDULE 11
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_J_SLIST 0x1116
+#define IDD_J_SADD 0x1118
+#define IDD_J_SREMOVE 0x1119
+#define IDD_J_SUPDATE 0x111A
+
+#endif
diff --git a/private/utils/ntbackup/inc/schedule.h b/private/utils/ntbackup/inc/schedule.h
new file mode 100644
index 000000000..dea336310
--- /dev/null
+++ b/private/utils/ntbackup/inc/schedule.h
@@ -0,0 +1,374 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: SS_DM.H
+
+ Description: This header file contains prototypes for the
+ SCHEDULE related operations.
+
+ $Log: G:/UI/LOGFILES/SCHEDULE.H_V $
+
+ Rev 1.25 01 Nov 1992 16:33:08 DAVEV
+Unicode changes
+
+ Rev 1.24 12 Oct 1992 17:33:04 DARRYLP
+Increased the size of the name field.
+
+ Rev 1.23 12 Oct 1992 17:31:58 DARRYLP
+Update to allow for multiple addressees.
+
+ Rev 1.22 09 Oct 1992 10:31:54 DARRYLP
+upgraded email password handling.
+
+ Rev 1.21 04 Oct 1992 19:49:08 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.20 28 Sep 1992 17:10:12 DARRYLP
+Additional defines for WFW email.
+
+ Rev 1.19 22 Sep 1992 15:10:40 DARRYLP
+Added prototypes for email functions.
+
+ Rev 1.18 21 Sep 1992 16:50:44 DARRYLP
+Updates to WFW email routines.
+
+ Rev 1.17 17 Sep 1992 18:04:58 DARRYLP
+New additions for WFW email.
+
+ Rev 1.16 08 Sep 1992 15:42:18 DARRYLP
+Added new structure items and associated Macros for WFW email.
+
+ Rev 1.15 08 Apr 1992 11:37:44 JOHNWT
+changed SCH_GetLongTime params
+
+ Rev 1.14 26 Mar 1992 15:20:52 JOHNWT
+fixed defs
+
+ Rev 1.13 20 Feb 1992 14:08:54 ROBG
+Changed for NT disk format.
+
+ Rev 1.12 29 Jan 1992 12:33:14 ROBG
+Added two #defines to support launcher.
+
+ Rev 1.11 25 Jan 1992 19:15:00 GLENN
+Updated
+
+ Rev 1.10 22 Jan 1992 09:31:06 ROBG
+Added parameter to SCH_StartJob.
+
+ Rev 1.9 17 Jan 1992 17:06:18 ROBG
+Added more macros.
+
+ Rev 1.8 17 Jan 1992 16:35:50 ROBG
+Added more macros.
+
+ Rev 1.7 16 Jan 1992 14:16:18 ROBG
+Changes to support new launcher.
+
+ Rev 1.6 16 Jan 1992 11:59:46 ROBG
+Added some macros and changed field 'fAbort' to 'fStatus'.
+This field will hold up to 8 status bits.
+
+ Rev 1.5 15 Jan 1992 09:35:04 ROBG
+Added define for SCH_VER_NUM and a new field to schedule record.
+
+ Rev 1.4 14 Jan 1992 15:42:32 ROBG
+Added fAborted field in schedule record.
+
+ Rev 1.3 14 Jan 1992 12:21:44 ROBG
+Added fields to support delaying the running of an instance of a job.
+
+ Rev 1.2 10 Jan 1992 17:27:42 ROBG
+Added SCH_IsLauncherRunning.
+
+ Rev 1.1 04 Dec 1991 17:12:38 CHUCKB
+Added new id's for int'l stuff.
+
+ Rev 1.0 20 Nov 1991 19:40:32 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef SCHEDULE_H
+
+#define SCHEDULE_H
+
+#include "jobs.h"
+
+// Structure for Schedule Database
+
+// Email Send Codes
+
+#define SCH_EMAIL_ALWAYS 0x0001
+#define SCH_EMAIL_NEVER 0x0002
+#define SCH_EMAIL_ERROR 0x0004
+
+// Email bit fields
+
+#define SCH_EMAIL_ACTIVE 0x01
+#define SCH_EMAIL_INC_LOG 0x02
+
+// Repeat Modes
+
+#define SCH_ONCEONLY 0x01
+#define SCH_HOURS 0x02
+#define SCH_DAYS 0x04
+#define SCH_MONTHS_BY_WEEK 0x08
+#define SCH_MONTHS_BY_DAY 0x10
+
+// Interval values for SCH_DAYS
+
+#define SCH_MONDAY 0x01
+#define SCH_TUESDAY 0x02
+#define SCH_WEDNESDAY 0x04
+#define SCH_THURSDAY 0x08
+#define SCH_FRIDAY 0x10
+#define SCH_SATURDAY 0x20
+#define SCH_SUNDAY 0x40
+
+// Interval values for week in month
+
+#define SCH_FIRSTWEEK 0x01
+#define SCH_SECONDWEEK 0x02
+#define SCH_THIRDWEEK 0x04
+#define SCH_FOURTHWEEK 0x08
+#define SCH_LASTWEEK 0x10
+
+// Internal values for wDelayValue.
+
+#define SCH_JOBONHOLD 0xffff
+#define SCH_JOBACTIVE 0
+
+// Bit positions of the status byte.
+
+#define SCH_ABORTSTATUS 0x80
+#define SCH_MISSEDSTATUS 0x40
+#define SCH_RUNSTATUS 0x20
+#define SCH_DELAYEDSTATUS 0x10
+#define SCH_HOLDSTATUS 0x08
+
+// Values to pass in WM_PUBLISHRUNNINGJOBS message in the unique key field
+// to indicate ( no jobs or job just completed ) .
+
+#define SCH_NOJOBSFOUND 0L
+#define SCH_JOBCOMPLETE 1L
+
+
+#define SCH_NAME_SIZE 41
+#define SCH_NAME_LEN 40
+#define SCH_PASSWORD_SIZE 41
+#define SCH_PASSWORD_LEN 40
+#define SCH_ADDRESSEES_SIZE 101
+#define SCH_ADDRESSEES_LEN 100
+#define SCH_SUBJECT_SIZE 53
+#define SCH_SUBJECT_LEN 52
+#define SCH_MESSAGE_SIZE 257
+#define SCH_MESSAGE_LEN 256
+
+typedef struct {
+ // Internal
+ // Definition
+
+ INT32 fActive; // BOOL -- Tells if job is active or not.
+ INT32 bMinute; // BYTE -- Minute of next execution.
+ INT32 bHour; // BYTE -- Hour of next execution
+ INT32 bDay; // BYTE -- Day of next execution.
+ INT32 bMonth; // BYTE -- Month of next execution.
+ UINT32 wYear; // WORD -- Year of next execution.
+
+ INT32 lDateKey ; // LONG -- Creation date used as unique key.
+ INT32 fStatus ; // BYTE -- Holds status flags.
+ INT32 fInstTime; // BYTE -- Tells whether this time is to be used.
+ INT32 bInstMinute; // BYTE -- Minute of next execution for job instance.
+ INT32 bInstHour; // BYTE -- Hour of next execution for job instance.
+ INT32 bInstDay; // BYTE -- Day of next execution for job instance.
+ INT32 bInstMonth; // BYTE -- Month of next execution for job instance.
+ UINT32 wInstYear; // WORD -- Year of next execution for job instance.
+
+ INT32 bRepeatMode; // BYTE -- Repeat mode to determine next time.
+ INT32 bPrimaryInterval ; // BYTE -- Primary interval.
+ INT32 bSecondaryInterval ;// BYTE -- Used only for SCH_MONTHS_BY_WEEK.
+ // -- (day of the week of the month)
+ UINT32 wDelayValue ; // WORD -- Delay value, Hours, minutes
+
+ // Name of job. Allocated on a 4 byte boundary.
+
+ CHAR szJobname[MAX_JOBNAME_SIZE + 4-( (MAX_JOBNAME_SIZE)%4 ) ];
+
+ ULONG fEmailMisc; // Miscellaneous bit fields
+ ULONG bEmailSend; // Email setup: Always, On Err, Never
+ CHAR szName[SCH_MESSAGE_SIZE]; // Addressee names
+ CHAR szSubject[SCH_SUBJECT_SIZE]; // 52 CHAR subject
+ CHAR szMessage[SCH_MESSAGE_SIZE]; // In addition to the log file - extra message
+
+ Q_ELEM dsQElem ;
+
+} SCHEDREC, *SCHEDREC_PTR ;
+
+// Version of schedule records
+
+#define SCH_VER_NUM 3
+
+
+// macros for schedules
+
+#define SCH_SetEmailMisc( x, y ) ( (x)->fEmailMisc |= y )
+#define SCH_UnSetEmailMisc( x, y ) ( (x)->fEmailMisc &= !y )
+
+#define SCH_GetEmailActive( x ) ( (x)->fEmailMisc & SCH_EMAIL_ACTIVE )
+#define SCH_GetEmailIncLog( x ) ( (x)->fEmailMisc & SCH_EMAIL_INC_LOG )
+
+#define SCH_SetEmailAlways( x ) ( (x)->bEmailSend = SCH_EMAIL_ALWAYS )
+#define SCH_SetEmailNever( x ) ( (x)->bEmailSend = SCH_EMAIL_NEVER )
+#define SCH_SetEmailError( x ) ( (x)->bEmailSend = SCH_EMAIL_ERROR )
+#define SCH_GetEmailType( x ) ( (x)->bEmailSend )
+
+#define SCH_GetAddNames( x ) ( (x)->szName )
+#define SCH_SetAddNames( x, y ) ( lstrcpy( (x)->szName, (y) ) )
+
+#define SCH_GetMessage( x ) ( (x)->szMessage )
+#define SCH_SetMessage( x,y ) ( lstrcpy( (x)->szMessage, (y) ) )
+
+#define SCH_GetSubject( x ) ( (x)->szSubject )
+#define SCH_SetSubject( x, y ) ( lstrcpy( (x)->szSubject, (y) ) )
+
+#define SCH_GetQElem( x ) ( (x)->dsQElem )
+#define SCH_SetQElem( x, y ) ( (x)->dsQElem = (y) )
+
+#define SCH_GetActive( x ) ( (BOOL)(x)->fActive )
+#define SCH_SetActive( x, y ) ( (x)->fActive = (INT32)(y) )
+
+#define SCH_GetMinute( x ) ( (BYTE)(x)->bMinute )
+#define SCH_SetMinute( x, y ) ( (x)->bMinute = (INT32)(y) )
+
+#define SCH_GetHour( x ) ( (BYTE)(x)->bHour )
+#define SCH_SetHour( x, y ) ( (x)->bHour = (INT32)(y) )
+
+#define SCH_GetDay( x ) ( (BYTE)(x)->bDay )
+#define SCH_SetDay( x, y ) ( (x)->bDay = (INT32)(y) )
+
+#define SCH_GetMonth( x ) ( (BYTE)(x)->bMonth )
+#define SCH_SetMonth( x, y ) ( (x)->bMonth = (INT32)(y) )
+
+#define SCH_GetYear( x ) ( (WORD)(x)->wYear )
+#define SCH_SetYear( x, y ) ( (x)->wYear = (UINT32)(y) )
+
+#define SCH_GetDateKey( x ) ( (LONG)(x)->lDateKey )
+#define SCH_SetDateKey( x, y ) ( (x)->lDateKey = (INT32)(y) )
+
+#define SCH_GetStatusByte( x ) ( (BYTE)(x)->fStatus )
+#define SCH_SetStatusByte( x, y ) ( (x)->fStatus = (INT32)(y) )
+
+#define SCH_GetAbortFlag( x ) ( ((BYTE)(x)->fStatus) & SCH_ABORTSTATUS )
+#define SCH_SetAbortFlagOn( x ) ( (x)->fStatus |= SCH_ABORTSTATUS )
+#define SCH_SetAbortFlagOff( x ) ( (x)->fStatus &= ~((INT32)SCH_ABORTSTATUS) )
+
+#define SCH_GetMissedFlag( x ) ( ((BYTE)(x)->fStatus) & SCH_MISSEDSTATUS )
+#define SCH_SetMissedFlagOn( x ) ( (x)->fStatus |= SCH_MISSEDSTATUS )
+#define SCH_SetMissedFlagOff( x ) ( (x)->fStatus &= ~((INT32)SCH_MISSEDSTATUS) )
+
+#define SCH_GetRunFlag( x ) ( ((BYTE)(x)->fStatus) & SCH_RUNSTATUS )
+#define SCH_SetRunFlagOn( x ) ( (x)->fStatus |= SCH_RUNSTATUS )
+#define SCH_SetRunFlagOff( x ) ( (x)->fStatus &= ~((INT32)SCH_RUNSTATUS) )
+
+#define SCH_GetDelayedFlag( x ) ( ((BYTE)(x)->fStatus) & SCH_DELAYEDSTATUS )
+#define SCH_SetDelayedFlagOn( x ) ( (x)->fStatus |= SCH_DELAYEDSTATUS )
+#define SCH_SetDelayedFlagOff( x ) ( (x)->fStatus &= ~((INT32)SCH_DELAYEDSTATUS) )
+
+#define SCH_GetHoldFlag( x ) ( ((BYTE)(x)->fStatus) & SCH_HOLDSTATUS )
+#define SCH_SetHoldFlagOn( x ) ( (x)->fStatus |= SCH_HOLDSTATUS )
+#define SCH_SetHoldFlagOff( x ) ( (x)->fStatus &= ~((INT32)SCH_HOLDSTATUS) )
+
+#define SCH_GetUseInstTime( x ) ( (BYTE)(x)->fInstTime )
+#define SCH_SetUseInstTime( x, y ) ( (x)->fInstTime = (INT32)(y) )
+
+#define SCH_GetInstMinute( x ) ( (BYTE)(x)->bInstMinute )
+#define SCH_SetInstMinute( x, y ) ( (x)->bInstMinute = (INT32)(y) )
+
+#define SCH_GetInstHour( x ) ( (BYTE)(x)->bInstHour )
+#define SCH_SetInstHour( x, y ) ( (x)->bInstHour = (INT32)(y) )
+
+#define SCH_GetInstDay( x ) ( (BYTE)(x)->bInstDay )
+#define SCH_SetInstDay( x, y ) ( (x)->bInstDay = (INT32)(y) )
+
+#define SCH_GetInstMonth( x ) ( (BYTE)(x)->bInstMonth )
+#define SCH_SetInstMonth( x, y ) ( (x)->bInstMonth = (INT32)(y) )
+
+#define SCH_GetInstYear( x ) ( (WORD)(x)->wInstYear )
+#define SCH_SetInstYear( x, y ) ( (x)->wInstYear = (UINT32)(y) )
+
+#define SCH_GetRepeatMode( x ) ( (BYTE)(x)->bRepeatMode )
+#define SCH_SetRepeatMode( x, y ) ( (x)->bRepeatMode = (INT32)(y) )
+
+#define SCH_GetPrimaryInterval( x ) ( (BYTE)(x)->bPrimaryInterval )
+#define SCH_SetPrimaryInterval( x, y ) ( (x)->bPrimaryInterval = (INT32)(y) )
+
+#define SCH_GetSecondaryInterval( x ) ( (BYTE)(x)->bSecondaryInterval )
+#define SCH_SetSecondaryInterval( x, y ) ( (x)->bSecondaryInterval = (INT32)(y) )
+
+#define SCH_GetJobname( x ) ( (x)->szJobname )
+#define SCH_SetJobname( x, y ) ( lstrcpy ( (x)->szJobname, (y) ) )
+
+#define SCH_GetDelayValue( x ) ( (WORD)(x)->wDelayValue )
+#define SCH_SetDelayValue( x, y ) ( (x)->wDelayValue = (UINT32)(y) )
+
+/* Defines used when accessing the JOB and SCHEDULE files */
+
+#define FOPEN_ERR -1
+#define FREAD_ERR -2
+#define FWRITE_ERR -3
+#define FCLOSE_ERR -4
+
+// schedule function prototypes
+
+BOOL SCH_AnySchedFiles ( VOID ) ;
+INT SCH_Compare ( SCHEDREC_PTR, SCHEDREC_PTR ) ;
+VOID SCH_DeInitQueue ( VOID ) ;
+VOID SCH_EnQueueJob ( SCHEDREC_PTR ) ;
+SCHEDREC_PTR SCH_FindSched ( INT ) ;
+INT SCH_GetCount ( VOID ) ;
+SCHEDREC_PTR SCH_GetNextJob ( SCHEDREC_PTR ) ;
+VOID SCH_InitQueue ( VOID ) ;
+SCHEDREC_PTR SCH_InitSched ( VOID ) ;
+BOOL SCH_IsJobIconic ( INT ) ;
+INT SCH_ReadList ( VOID ) ;
+VOID SCH_Refresh ( VOID ) ;
+VOID SCH_Remove ( SCHEDREC_PTR ) ;
+INT SCH_SaveList ( VOID ) ;
+
+void SCH_AskForRunningJob ( HWND hWnd ) ;
+void SCH_NotifyLauncher ( void ) ;
+void SCH_RegisterJob ( LPSTR szJobName, INT nSchedIndex ) ;
+void SCH_StartJob ( WORD , LONG ) ;
+void SCH_UnRegisterJob ( LPSTR szJobName ) ;
+
+VOID SCH_GetTimeDateStruct ( TIME_PTR time_struct ) ;
+LONG SCH_GetLongTime ( SCHEDREC_PTR pSchedRec ) ;
+void SCH_UpdateTime ( SCHEDREC_PTR pSchedRec, TIME_PTR ptmNewTime ) ;
+BOOL SCH_IsLeapYear ( UINT usYear ) ;
+void SCH_BuildMonthCalendar ( TIME_PTR ptmDate, SCHEDREC_PTR pSchedRec ) ;
+BOOL SCH_FindNextDate ( TIME_PTR ptmStartTime, TIME_PTR ptmNewTime ) ;
+void SCH_UpdateAfterRun ( SCHEDREC_PTR ) ;
+BOOL SCH_IsLauncherRunning ( void ) ;
+VOID SCH_PublishRunningJob ( void ) ;
+SCHEDREC_PTR SCH_FindSchedByKey ( LONG lDateKey, LPINT nIndex ) ;
+
+// Email functions
+
+BOOL EM_GetUserFromINI(LPSTR lpUserName);
+BOOL EM_IsMailAvailable(void);
+BOOL EM_IsMAPIAvailable(void);
+void EM_SetMAPIAvailable(BOOL);
+BOOL EM_SendEmail(SCHEDREC_PTR, UINT);
+LPSTR EM_GetPswd(void);
+BOOL EM_SavePswd(LPSTR lpPassword);
+
+
+INT iTime ; // indicators for international date field positions
+INT iDate ;
+INT cyChildHeight ;
+CHAR sDate[2] ;
+CHAR sTime[2] ;
+CHAR sAMPM[2][5] ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/screen.h b/private/utils/ntbackup/inc/screen.h
new file mode 100644
index 000000000..44d140843
--- /dev/null
+++ b/private/utils/ntbackup/inc/screen.h
@@ -0,0 +1,74 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: screen.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+
+ $Log: W:/LOGFILES/SCREEN.H_V $
+ *
+ * Rev 1.4 24 Jun 1992 15:00:52 JOHNW
+ * Changed prototype for DebugChar
+ *
+ * Rev 1.4 23 Jun 1992 15:44:18 JOHNW
+ * Changed DebugChar prototype.
+ *
+ * Rev 1.3 07 May 1992 18:38:02 CHARLIE
+ * No change.
+ *
+ * Rev 1.2 20 Dec 1991 13:23:44 STEVEN
+ * screen macros invalid for NT also
+ *
+ * Rev 1.1 26 Jul 1991 15:03:08 STEVEN
+ * change MAYN_OS2 to OS_OS2
+ *
+ * Rev 1.0 09 May 1991 13:32:14 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _screen_h_
+#define _screen_h_
+
+#if ( ! defined(MS_RELEASE) && defined(OS_DOS) )
+
+typedef int far *FAR_PTR;
+#define monomem ((FAR_PTR) 0xB0000000L)
+#define scrnmem ((FAR_PTR) 0xB8000000L)
+#define vid_typ_flag ((FAR_PTR) 0x400063L)
+
+#define ReadScreen( offset, ptr ) (*(ptr) = scrnmem[(offset)])
+#define WriteScreen(offset, value) \
+ ( *vid_typ_flag == 0x3b4 ? (monomem[(offset)] = (value)) : (scrnmem[(offset)] = (value)) )
+#define WriteChar( offset, ch ) WriteScreen( offset, (0x0F<<8) + ch )
+void Pulse( void );
+void DebugString( int line, char * message );
+void DebugNum( int line, unsigned long num );
+void DebugMem( int line, void * data, int size );
+void DebugSetCursor( int line, int column );
+void DebugHexNum( int ln, unsigned long num );
+void DebugChar( int ln, int ch ) ;
+
+#else
+
+#define Pulse()
+#define DebugString( l, m )
+#define DebugNum( l, n )
+#define DebugMem( l, d, s )
+#define DebugSetCursor( l, c )
+#define DebugHexNum( l, n )
+#define WriteChar( o, c)
+#define DebugChar( l, c )
+
+#endif
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/scriperr.h b/private/utils/ntbackup/inc/scriperr.h
new file mode 100644
index 000000000..6099af6e9
--- /dev/null
+++ b/private/utils/ntbackup/inc/scriperr.h
@@ -0,0 +1,51 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: scriperr.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/SCRIPERR.H_V $
+
+ Rev 1.1 04 Oct 1992 19:49:12 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:33:54 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _scriperr_h_
+#define _scriperr_h_
+
+#define SCRIPT_ERR_BASE -0x7f00
+
+#define SCR_INVALID_SWITCH ( SCRIPT_ERR_BASE + 1 )
+#define SCR_TOO_MANY_PARMS ( SCRIPT_ERR_BASE + 2 )
+#define SCR_BAD_LIST_DIR ( SCRIPT_ERR_BASE + 3 )
+#define SCR_BAD_LOG_LEVEL ( SCRIPT_ERR_BASE + 4 )
+#define SCR_BAD_SWITCH_FLAG ( SCRIPT_ERR_BASE + 5 )
+#define SCR_BAD_DATE ( SCRIPT_ERR_BASE + 6 )
+#define SCR_CANNOT_CREATE_FSE ( SCRIPT_ERR_BASE + 7 )
+#define SCR_NO_IMAGE_FOR_DRIVE ( SCRIPT_ERR_BASE + 8 )
+#define SCR_BAD_IO_CHAN ( SCRIPT_ERR_BASE + 9 )
+#define SCR_BAD_IO_ADDR ( SCRIPT_ERR_BASE + 10 )
+#define SCR_BAD_SET_LABEL ( SCRIPT_ERR_BASE + 11 )
+#define SCR_BAD_NUM_TAPE ( SCRIPT_ERR_BASE + 12 )
+
+#define SCR_ERROR_IN_SCRIPT ( SCRIPT_ERR_BASE + 13 )
+#define SCR_ERROR_IN_CMD_LINE ( SCRIPT_ERR_BASE + 14 )
+#define SCR_CANNOT_OPEN_SCRIPT ( SCRIPT_ERR_BASE + 15 )
+#define SCR_NEST_TOO_DEEP ( SCRIPT_ERR_BASE + 16 )
+#define SCR_INVALID_PATH ( SCRIPT_ERR_BASE + 17 )
+#define SCR_INVALID_TARGET_PATH ( SCRIPT_ERR_BASE + 19 )
+#define SCR_ERROR_PRINTED ( SCRIPT_ERR_BASE + 20 )
+
+#define SCR_SCRIPT_FILE_EXISTS ( SCRIPT_ERR_BASE + 21 )
+#define SCR_ERROR_WRITING_SCRIPT ( SCRIPT_ERR_BASE + 22 )
+
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/script.h b/private/utils/ntbackup/inc/script.h
new file mode 100644
index 000000000..f0487de3c
--- /dev/null
+++ b/private/utils/ntbackup/inc/script.h
@@ -0,0 +1,94 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: script.h
+
+ Description:
+
+
+ $Log: G:\ui\logfiles\script.h_v $
+
+ Rev 1.5 21 Jul 1993 17:13:16 CARLS
+added bsd_ptr parameter to tbrparse function
+
+ Rev 1.4 04 Oct 1992 19:49:12 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 11 Sep 1992 11:17:34 DAVEV
+MikeP's changes from Microsoft
+
+ Rev 1.2 12 Aug 1992 18:25:14 STEVEN
+fix warnings
+
+ Rev 1.1 28 Jul 1992 14:55:16 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.0 20 Nov 1991 19:39:16 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _script_h_
+#define _script_h_
+
+/*
+ Define the operations to be performed
+*/
+
+#define TBACKUP 0
+#define TRESTORE 1
+#define TVERIFY 2
+#define TDIR 3
+#define TARCHIVE 4
+#define TENSION 5
+#define TERASE 6
+#define TBACKUP_CONT 7
+#define TARCHIVE_VERIFY 8
+#define TVERIFY_LAST 9
+#define TARCHIVE_DELETE 10
+#define TBACKUP_MAC 11
+
+#define MAX_SCRIPTS 12
+
+VOID build_script_menu(
+ UINT16 menu_type ) ;
+
+VOID add_script_item_to_backup(
+ CHAR_PTR script_name,
+ UINT16 menu_type ) ;
+
+#ifndef OS_WIN32
+ struct M_POSITION ;
+
+ VOID del_script_item_from_backup(
+ struct M_POSITION *select_ptr,
+ UINT16_PTR menu_item ) ;
+
+ VOID execute_script(
+ struct M_POSITION *select_ptr,
+ UINT16_PTR menu_item ) ;
+#endif
+
+VOID end_script_process(
+ INT16 error ) ;
+
+BOOLEAN script_file_exists(
+ CHAR_PTR script_name,
+ CHAR_PTR script_ext ) ;
+
+INT tbrparse(
+ struct CDS **cfg,
+ struct HEAD_DLE *dle_hand,
+ struct BSD_LIST *bsd_hand,
+ CHAR_PTR src_string,
+ INT mode,
+ BSD_PTR bsd_ptr ) ;
+
+INT16 WriteScriptFile(
+ struct BSD_LIST *bsd_hand,
+ CHAR_PTR fname ) ;
+
+INT16 SCR_ProcessBSD( FILE *fptr, struct BSD *bsd ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/script_p.h b/private/utils/ntbackup/inc/script_p.h
new file mode 100644
index 000000000..03b64e849
--- /dev/null
+++ b/private/utils/ntbackup/inc/script_p.h
@@ -0,0 +1,241 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\script_p.h
+subsystem\USER INTERFACE\script_p.h
+$0$
+
+ Name: script_p.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location:
+
+$Header: G:\ui\logfiles\script_p.h_v 1.5 21 Jul 1993 17:13:42 CARLS $
+
+$Log: G:\ui\logfiles\script_p.h_v $
+
+ Rev 1.5 21 Jul 1993 17:13:42 CARLS
+added bsd_ptr parameter to tbparse function
+
+ Rev 1.4 01 Nov 1992 16:33:22 DAVEV
+Unicode changes
+
+ Rev 1.3 04 Oct 1992 19:49:14 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 28 Jul 1992 14:56:56 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.1 15 May 1992 13:38:34 MIKEP
+nt pass 2
+
+ Rev 1.0 20 Nov 1991 19:35:58 SYSTEM
+Initial revision.
+
+**/
+/* $end$ */
+
+
+#ifndef SCRIPT_P_H
+#define SCRIPT_P_H
+
+#include "script_s.h"
+
+/*
+ Define the switch actions for backup
+*/
+
+#define SW_MINUS_A 0
+#define SW_APPEND 1
+#define SW_CSR 2
+#define SW_DATE 3
+#define SW_EMPTY 4
+#define SW_FILES 5
+#define SW_IOCHAN 6
+#define SW_IRQ 7
+#define SW_LABEL 8
+#define SW_MODIFIED 9
+#define SW_NONDOS 10
+#define SW_PASSWORD 11
+#define SW_STDIN 12
+#define SW_SUBDIR 13
+#define SW_EXCLUDE 14
+#define SW_YES 15
+#define SW_DEBUG 16
+#define SW_MINUS_H 17
+#define SW_MINUS_S 18
+#define SW_DOS_IMAGE 19
+#define SW_WIDE 20
+#define SW_PAUSE 21
+#define SW_P 22
+#define SW_Q 23
+#define SW_SETNO 24
+#define SW_LIST 25
+#define SW_ERASE_TAPE 26
+#define SW_ENTIRE 27
+#define SW_3270 28
+#define SW_REV 29
+#define SW_NTAPE 30
+#define SW_B_INUSE 31
+#define SW_LOG_LEVEL 32
+#define SW_AFP 33
+#define SW_NDATE 34
+#define SW_LONG 35
+#define SW_AUTO_VER 36
+#define SW_BACK_NAME 37
+#define SW_TAPE_NAME 38
+
+#ifdef MBS
+
+#define SW_ALL_VERSIONS 39
+#define SW_DELETED_ONLY 40
+#define SW_NON_DELETED_ONLY 41
+#define SW_BKUP_DATE 42
+
+#endif
+
+#define SW_ACCESS_DATE 43
+#define SW_FMARK 44
+#define SW_TRANSFER 45
+#define SW_TPNUM 46
+#define SW_BSNUM 47
+#define SW_TPSEQ 48
+
+
+/**
+ Inputs for tbsyntab FSM tbrparse
+**/
+
+#define T_AT_SIGN 0
+#define T_BAD_TOKEN 1
+#define T_EARLY_EOF1 2
+#define T_EARLY_EOF2 3
+#define T_EOF 4
+#define T_EQUALS 5
+#define T_FILESPEC 6
+#define T_NONDOS 7
+#define T_SWITCH 8
+#define T_TOKEN_TOO_LONG 9
+
+/**/
+/**
+ Actions for tbsyntab FSM
+**/
+
+#define SYN_ERROR 0
+#define TB_DO_NOTHING 1
+#define TB_ERROR_EXIT 2
+#define TB_NORMAL_RETURN 3
+#define TB_PROCESS_INCLUDE 4
+#define TB_PROCESS_NONDOS 5
+#define TB_PROCESS_SOURCE 6
+#define TB_PROCESS_SWITCH 7
+#define TB_PROCESS_TARGET 8
+
+/**/
+/**
+ States for tbsyntab FSM
+**/
+
+#define TB_EXPECT_INC1 0
+#define TB_EXPECT_INC2 1
+#define TB_EXPECT_SOURCE 2
+#define TB_READY1 3
+#define TB_READY2 4
+
+#define TBSYNTAB_N_INPUTS 10
+#define TBSYNTAB_N_STATES 5
+
+/**/
+/**
+ States for tblextab FSM
+**/
+
+#define EMBEDDED_SLASH1 0
+#define EMBEDDED_SLASH2 1
+#define IN_COMMENT 2
+#define IN_LITERAL1 3
+#define IN_LITERAL2 4
+#define IN_NONDOS 5
+#define IN_NONDOS2 6
+#define IN_OP1 7
+#define IN_OP2 8
+#define IN_SWITCH 9
+#define IN_WHITESPACE 10
+#define PATH_NAME 11
+#define PATH_OR_NDOS 12
+
+typedef enum {
+ DEFAULT_EARLY_MORNING,
+ DEFAULT_LATE_NIGHT
+} DATE_DEFAULT ;
+
+
+INT16 GetNumBkuSwitches( VOID ) ;
+INT16 GetNumDirSwitches( VOID ) ;
+INT16 GetNumRestSwitches( VOID ) ;
+INT16 GetNumVerSwitches( VOID ) ;
+INT16 GetNumTenSwitches( VOID ) ;
+
+
+VOID rlstok( TOKEN_PTR *tok_ptr );
+VOID rlsmem( CHAR_PTR *mem_ptr ) ;
+
+CHAR filgetc( CHAR *fin, INT16 *kludge ) ;
+VOID filpushc( CHAR c, CHAR *fin, INT16 *kludge);
+CHAR strgetc( CHAR *s, INT16 *i );
+VOID strpushc( CHAR c, CHAR *src_ptr, INT16 *i );
+TOKEN_PTR nexttok(
+ CHAR ( * nextc ) ( CHAR_PTR , INT16_PTR ),
+ VOID ( * prevc ) ( CHAR, CHAR_PTR , INT16_PTR ) ,
+ INT16_PTR curr_state,
+ INT16_PTR curr_line,
+ INT16_PTR curr_col,
+ CHAR_PTR src_ptr,
+ INT16_PTR cmd_i ) ;
+
+INT16 tbdpars( CHAR_PTR , struct DATE_TIME *, DATE_DEFAULT ) ;
+
+INT16 process_switch(
+ struct CDS **cfg, /* configuration stucture */
+ struct HEAD_DLE *dle_hand, /* Drive list handle */
+ struct BSD_LIST *bsd_hand, /* BSD list */
+ CUR_DEF_PTR cur_def, /* current FSE and BSD */
+ SW_TAB_PTR sw_tab, /* switch table */
+ INT16 n_switches, /* number of elements in sw_tab */
+ CHAR_PTR sw_name, /* switch label */
+ CHAR_PTR sw_op1, /* 1st operand or NULL */
+ CHAR_PTR sw_op2 ) ; /* 2nd operand or NULL */
+
+
+INT16 tbbuild_def_drives(
+ struct HEAD_DLE *dle_hand,
+ struct BSD_LIST *bsd_hand,
+ CHAR_PTR path,
+ INT16 path_size,
+ CHAR_PTR fspec,
+ struct CDS *cfg,
+ CUR_DEF_PTR *cur_def ) ;
+
+INT tbparse(
+ struct CDS **cfg,
+ struct HEAD_DLE *dle_hand,
+ struct BSD_LIST *bsd_hand ,
+ CHAR ( *inchar ) ( CHAR_PTR , INT16_PTR ) ,
+ VOID ( *pushchar ) ( CHAR, CHAR_PTR , INT16_PTR ),
+ CHAR_PTR src_ptr ,
+ INT16_PTR cmd_i ,
+ SW_TAB_PTR sw_tab ,
+ INT n_switches,
+ INT init_state,
+ BSD_PTR bsd_ptr ) ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/script_s.h b/private/utils/ntbackup/inc/script_s.h
new file mode 100644
index 000000000..6440d6135
--- /dev/null
+++ b/private/utils/ntbackup/inc/script_s.h
@@ -0,0 +1,94 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: script_s.h
+
+ Description:
+
+ Location:
+
+
+ $Log: G:/UI/LOGFILES/SCRIPT_S.H_V $
+
+ Rev 1.2 09 Jun 1993 15:10:52 MIKEP
+enable c++
+
+ Rev 1.1 04 Oct 1992 19:49:16 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.0 20 Nov 1991 19:38:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+
+#ifndef SCRIPT_S_H
+#define SCRIPT_S_H
+/**
+ Define the structures used by the tbackup parser
+**/
+
+/*
+ Equates
+*/
+#define MAX_DRIVE_SIZE 8 /* maximum length of drive name */
+
+/* maximum length of a single token */
+#define MAX_TOKEN_LEN ( 270 ) /* 270 = Max HPFS full-path (and then some */
+
+#define MAX_MSG_LEN 256 /* maximum length of an error message */
+#define MAX_NESTING 4 /* maximum depth of include file nesting */
+
+
+typedef struct TOKEN *TOKEN_PTR;
+typedef struct TOKEN {
+ INT16 tok_typ ; /* type of token */
+ CHAR tok_spelling[MAX_TOKEN_LEN + 1] ; /* token as given in source */
+ INT16 src_line_no ; /* line in the source file where it began */
+ INT16 src_col_no ; /* column in the source file where it began */
+ CHAR_PTR op_ptrs[2] ; /* pointers to spelling of operands in switches */
+} TOKEN;
+
+/*
+ Define what each element of a state table contains
+*/
+typedef struct STATE_TAB_TYPE *STATE_TAB_PTR;
+typedef struct STATE_TAB_TYPE {
+ UCHAR action ;
+ UCHAR next_state ;
+} STATE_TAB_TYPE;
+
+/*
+ Define a switch table
+*/
+typedef struct SW_TAB_TYPE *SW_TAB_PTR;
+typedef struct SW_TAB_TYPE {
+ CHAR_PTR sw_label ;
+ INT16 sw_action ;
+ INT16 sw_min_len ;
+ INT16 sw_num_ops ;
+} SW_TAB_TYPE;
+
+typedef struct CUR_DEF *CUR_DEF_PTR;
+typedef struct CUR_DEF{
+ BOOLEAN unused ;
+ struct FSE *cur_fse ;
+ struct BSD *cur_bsd ;
+ struct CUR_DEF *next_def ;
+} CUR_DEF;
+
+typedef
+INT16 ( * PR_FUNC ) ( ) ; /* used to indirectly invoke display routine */
+
+typedef
+CHAR ( * PFC ) ( ) ;
+
+/*
+ Define allocation functions
+*/
+
+#define allop( x ) malloc( x )
+#define alltok( ) ( TOKEN_PTR ) malloc( sizeof( TOKEN ) ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/set_cat.h b/private/utils/ntbackup/inc/set_cat.h
new file mode 100644
index 000000000..b43409f2d
--- /dev/null
+++ b/private/utils/ntbackup/inc/set_cat.h
@@ -0,0 +1,41 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: set_cat.h
+
+ Description: include file for the set_cat.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SET_CAT.H_V $
+
+ Rev 1.5 06 May 1993 17:50:56 KEVINS
+Added catalog drive and path option.
+
+ Rev 1.4 31 Mar 1993 13:01:32 CHUCKB
+Added id for ignore OTC.
+
+ Rev 1.3 04 Oct 1992 19:49:18 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Apr 1992 13:25:52 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSCATALOG 18
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_CFULL 0x0068
+#define IDD_CIGNOREOTC 0x0069
+#define IDD_CPATH 0x006C
+#define IDD_CDRIVE 0x006A
+#define IDD_CBROWSE 0x006B
+#define IDD_CCURRENT 0x006D
diff --git a/private/utils/ntbackup/inc/set_dbug.h b/private/utils/ntbackup/inc/set_dbug.h
new file mode 100644
index 000000000..c491a733a
--- /dev/null
+++ b/private/utils/ntbackup/inc/set_dbug.h
@@ -0,0 +1,43 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: set_dbug.h
+
+ Description: include file for the set_dbug.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SET_DBUG.H_V $
+
+ Rev 1.3 04 Oct 1992 19:49:20 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Apr 1992 13:28:46 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSDEBUGWINDOW 20
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_DB_TOWIN 0x0067
+#define IDD_DB_TOFILE 0x0068
+#define IDD_DB_RALL 0x006A
+#define IDD_DB_RFILE 0x006E
+#define IDD_DB_RNUM 0x006F
+#define IDD_DB_M 0x0070
+#define IDD_DB_WMSGS 0x0071
+#define IDD_DB_FMSGS 0x0072
+#define IDD_DB_FNAMELABEL 0x0073
+#define IDD_DB_FNAME 0x0074
+#define IDD_DB_MEMTRACE 0x0079
+#define IDD_DB_POLLDRIVEON 0x007A
+#define IDD_DB_RMEM 0x007F
+#define IDD_DB_RLAST 0x0069
diff --git a/private/utils/ntbackup/inc/set_log.h b/private/utils/ntbackup/inc/set_log.h
new file mode 100644
index 000000000..779375968
--- /dev/null
+++ b/private/utils/ntbackup/inc/set_log.h
@@ -0,0 +1,40 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: set_log.h
+
+ Description: include file for the set_log.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SET_LOG.H_V $
+
+ Rev 1.4 10 May 1993 17:13:42 KEVINS
+Allow user to specify log file base name.
+
+ Rev 1.3 04 Oct 1992 19:49:22 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Apr 1992 13:31:10 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSLOGGING 16
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_LSUMONLY 0x006B
+#define IDD_LSUMFIL 0x006C
+#define IDD_LDETAIL 0x006D
+#define IDD_LYES 0x006F
+#define IDD_LNO 0x0070
+#define IDD_LPROMPT 0x0071
+#define IDD_LNUMKEEP 0x0069
+#define IDD_LBASENAME 0x0060
diff --git a/private/utils/ntbackup/inc/set_opts.h b/private/utils/ntbackup/inc/set_opts.h
new file mode 100644
index 000000000..cc0b288b8
--- /dev/null
+++ b/private/utils/ntbackup/inc/set_opts.h
@@ -0,0 +1,32 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: set_opts.h
+
+ Description: include file for the set_opts.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SET_OPTS.H_V $
+
+ Rev 1.3 04 Oct 1992 19:49:22 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Apr 1992 13:36:26 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSOPTIONS 13
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_O_EJECT 0x0066
+#define IDD_O_DISPSTATUS 0x0067
+#define IDD_O_DISPSELECT 0x0068
diff --git a/private/utils/ntbackup/inc/set_prt.h b/private/utils/ntbackup/inc/set_prt.h
new file mode 100644
index 000000000..bb19cb67b
--- /dev/null
+++ b/private/utils/ntbackup/inc/set_prt.h
@@ -0,0 +1,32 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: set_prt.h
+
+ Description: include file for the set_prt.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SET_PRT.H_V $
+
+ Rev 1.4 04 Oct 1992 19:49:24 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 03 Apr 1992 13:41:08 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDD_FILESETUP 25
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_TEXT1 0x0065
+#define IDD_PRINTERS 0x0066
+#define IDD_SETUP 0x0069
+#define IDHELP 100
diff --git a/private/utils/ntbackup/inc/set_rest.h b/private/utils/ntbackup/inc/set_rest.h
new file mode 100644
index 000000000..16bacc939
--- /dev/null
+++ b/private/utils/ntbackup/inc/set_rest.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: set_rest.h
+
+ Description: include file for the set_rest.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SET_REST.H_V $
+
+ Rev 1.4 04 Oct 1992 19:49:26 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 06 Apr 1992 09:56:26 CHUCKB
+Added define for translation.
+
+ Rev 1.2 03 Apr 1992 13:45:08 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSRESTORE 15
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_RAUTOV 105
+#define IDD_RYES 0x006A
+#define IDD_RNO 0x006B
+#define IDD_RPROMPT 0x006C
+#define IDD_RNMREC 0x006D
+#define IDD_RPMREC 0x006E
diff --git a/private/utils/ntbackup/inc/setback.h b/private/utils/ntbackup/inc/setback.h
new file mode 100644
index 000000000..7328ffdf3
--- /dev/null
+++ b/private/utils/ntbackup/inc/setback.h
@@ -0,0 +1,44 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: setback.h
+
+ Description: include file for the setback.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/SETBACK.H_V $
+
+ Rev 1.4 06 May 1993 17:52:16 KEVINS
+Added h/w compression check box.
+
+ Rev 1.3 04 Oct 1992 19:49:18 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Apr 1992 13:23:10 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SETTINGSBACKUP 14
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_BAUTOV 0x0065
+#define IDD_BINCLCAT 0x0066
+#define IDD_BREPLACE 0x0067
+#define IDD_BAPPEND 0x0068
+#define IDD_BSKIPYES 0x006F
+#define IDD_BSKIPNO 0x0070
+#define IDD_BSKIPWAIT 0x0071
+#define IDD_BNUMSECS 0x0075
+#define IDD_BMETHOD 0x0069
+#define IDD_BSPINNERBOX 0x0076
+#define IDD_BCOMPHW 0x0078
+#define IDD_BCOMPSW 0x0079
diff --git a/private/utils/ntbackup/inc/sio.h b/private/utils/ntbackup/inc/sio.h
new file mode 100644
index 000000000..fd7ca91f2
--- /dev/null
+++ b/private/utils/ntbackup/inc/sio.h
@@ -0,0 +1,80 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+ Name: sio.h
+
+ Description: Additional compatibility functions
+
+ $Log: J:/LOGFILES/SIO.H_V $
+ *
+ * Rev 1.1 11 Dec 1992 14:39:46 CHARLIE
+ * Eliminated warning when building NRL for NB
+
+**/
+
+int _putch(int c);
+int _putchar(int c);
+int _puts(char *str);
+int _printf(char *fmt,...);
+int _sprintf(char *out_str,char *fmt,...);
+void _gotoxy(int x,int y);
+int _getx(void);
+int _gety(void);
+void _textattr(int newattr);
+int _bioskey(int cmd);
+char * _strcat(char *str1, char *str2);
+int _strnicmp(char *str1, char *str2, size_t length);
+
+#undef putch
+#undef putchar
+#undef puts
+#undef cputs
+#undef printf
+#undef cprintf
+#undef sprintf
+#undef gotoxy
+#undef getx
+#undef gety
+#undef textattr
+#undef bioskey
+#undef strlen
+
+#undef strcat
+#undef strncat
+#undef strcpy
+#undef strncpy
+#undef strcmp
+#undef strncmp
+#undef stricmp
+#undef strnicmp
+#undef strcmpi
+#undef strncmpi
+#undef clrscr
+
+#define putch _putch
+#define putchar _putchar
+#define puts _puts
+#define cputs _puts
+#define printf _printf
+#define cprintf _printf
+#define sprintf _sprintf
+#define gotoxy _gotoxy
+#define getx _getx
+#define gety _gety
+#define textattr _textattr
+#define bioskey _bioskey
+#define strlen str_len
+#define clrscr() clr_scr();crs_x=crs_y=0;
+
+#define strcat _strcat
+#define strncat _strncat
+#define strcpy _strcpy
+#define strncpy _strncpy
+#define strcmp _strcmp
+#define strncmp _strncmp
+#define stricmp _stricmp
+#define strnicmp _strnicmp
+#define strcmpi _stricmp
+#define strncmpi _strnicmp
+
+
diff --git a/private/utils/ntbackup/inc/skipno.h b/private/utils/ntbackup/inc/skipno.h
new file mode 100644
index 000000000..48691ddab
--- /dev/null
+++ b/private/utils/ntbackup/inc/skipno.h
@@ -0,0 +1,25 @@
+/***************************************************
+Copyright (c) Maynard, an Archive Company. 1993
+
+ Name: skipno.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the SKIPNO code.
+
+ $Log: G:\ui\logfiles\skipno.h_v $
+
+ Rev 1.0 13 Jul 1993 17:04:40 CARLS
+Initial revision
+
+****************************************************/
+
+#ifndef skipno_h
+#define skipno_h
+
+#define SKIPNO_YES_BUTTON 1
+#define SKIPNO_YES_TO_ALL_BUTTON 2
+#define SKIPNO_NO_BUTTON 3
+#define SKIPNO_CANCEL_BUTTON 4
+#define SKIPNO_ABORT 5
+
+#endif
diff --git a/private/utils/ntbackup/inc/skipopen.h b/private/utils/ntbackup/inc/skipopen.h
new file mode 100644
index 000000000..8ebc14a14
--- /dev/null
+++ b/private/utils/ntbackup/inc/skipopen.h
@@ -0,0 +1,37 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: skipopen.h
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/SKIPOPEN.H_V $
+
+ Rev 1.3 04 Oct 1992 19:49:26 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 06 Apr 1992 08:38:14 CARLS
+removed unused ID
+
+ Rev 1.1 03 Apr 1992 13:47:14 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:39:06 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef SKIPOPEN_H
+#define SKIPOPEN_H
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SKIPOPEN 37
+#endif
+
+#define IDD_SKIP_OPEN_WAIT_TIME 120
+#define IDD_SKIP_CANCEL_BUTTON 103
+#define IDD_SKIP_FILE_NAME 104
+
+#endif
diff --git a/private/utils/ntbackup/inc/sleep.h b/private/utils/ntbackup/inc/sleep.h
new file mode 100644
index 000000000..b8e1d3692
--- /dev/null
+++ b/private/utils/ntbackup/inc/sleep.h
@@ -0,0 +1,29 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: sleep.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains prototypes for
+ the functions in sleep.c
+
+ Location:
+
+
+ $Log: G:/LOGFILES/SLEEP.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:33:04 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+
+#ifndef _sleep_h_
+#define _sleep_h_
+
+VOID sleep( UINT32 thousandths ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/smb.h b/private/utils/ntbackup/inc/smb.h
new file mode 100644
index 000000000..7dfdf8dd6
--- /dev/null
+++ b/private/utils/ntbackup/inc/smb.h
@@ -0,0 +1,191 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: smb.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Public header file for the SMB workstation.
+
+ Location: SMB_PUBLIC
+
+
+ $Log: J:/LOGFILES/SMB.H_V $
+ *
+ * Rev 1.1 25 Sep 1992 16:47:32 DOUG
+ * Fixes found during REMSPX integration
+ *
+ * Rev 1.0 09 May 1991 13:32:00 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef SMB
+#define SMB
+
+/*********************/
+/* SMB CONSTANTS */
+/*********************/
+
+/* begin include list */
+
+#include "smb_c.h" /* common public header for the SMB workstation and server */
+#include "smb_s.h" /* public header file of structures for the SMB workstation */
+
+/* $end$ include list */
+
+/*******************************************/
+/* SMB Entry Point Function Prototypes */
+/*******************************************/
+
+SMB_APPLICATION_PTR SMB_GetConnectedApplication(
+ SMB_CONNECTION_PTR connection_ptr ) ;
+
+INT16 SMB_GetCriticalErrorValue(
+ SMB_CONNECTION_PTR connection_ptr ) ;
+
+SMB_DEVICE_PTR SMB_GetBoundDevice(
+ SMB_CONNECTION_PTR connection_ptr ) ;
+
+SMB_APPLICATION_PTR SMB_ScanPublishedApplications(
+ UINT16_PTR sequence_ptr ) ;
+
+CHAR_PTR SMB_GetPublishedApplicationName(
+ SMB_APPLICATION_PTR application_ptr ) ;
+
+VOID SMB_GetPublishedApplicationType(
+ SMB_APPLICATION_PTR application_ptr,
+ UINT16_PTR status_type ) ;
+
+BOOLEAN SMB_ApplicationPublishedLocally(
+ SMB_APPLICATION_PTR application_ptr ) ;
+
+SMB_CONNECTION_PTR SMB_ConnectApplication(
+ SMB_APPLICATION_PTR application_ptr ) ;
+
+SMB_DEVICE_PTR SMB_ScanDeclaredDevices(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16_PTR sequence_ptr ) ;
+
+CHAR_PTR SMB_GetDeclaredDeviceName(
+ SMB_CONNECTION_PTR connection_ptr,
+ SMB_DEVICE_PTR device_ptr ) ;
+
+VOID SMB_GetDeclaredDeviceType(
+ SMB_CONNECTION_PTR connection_ptr,
+ SMB_DEVICE_PTR device_ptr,
+ UINT16_PTR type_ptr ) ;
+
+BOOLEAN SMB_DeclaredDeviceWriteEnabled(
+ SMB_CONNECTION_PTR connection_ptr,
+ SMB_DEVICE_PTR device_ptr ) ;
+
+BOOLEAN SMB_DeclaredDeviceVerified(
+ SMB_CONNECTION_PTR connection_ptr,
+ SMB_DEVICE_PTR device_ptr ) ;
+
+SMB_DEVICE_PTR SMB_GetCurrentBoundDevice(
+ SMB_CONNECTION_PTR connection_ptr ) ;
+
+UINT16 SMB_BindDevice(
+ SMB_CONNECTION_PTR connection_ptr,
+ SMB_DEVICE_PTR device_ptr,
+ CHAR_PTR password ) ;
+
+UINT16 SMB_ReleaseDevice(
+ SMB_CONNECTION_PTR connection_ptr ) ;
+
+UINT16 SMB_DisconnectApplication(
+ SMB_CONNECTION_PTR connection_ptr ) ;
+
+INT16 SMB_GetDiskFreeSpace(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16_PTR available_clusters_ptr ) ;
+
+INT16 SMB_CreateSubdirectory(
+ SMB_CONNECTION_PTR connection_ptr,
+ CHAR_PTR subdirectory ) ;
+
+INT16 SMB_RemoveSubdirectory(
+ SMB_CONNECTION_PTR connection_ptr,
+ CHAR_PTR subdirectory ) ;
+
+INT16 SMB_CreateFileHandle(
+ SMB_CONNECTION_PTR connection_ptr,
+ CHAR_PTR file_name,
+ CHAR mode,
+ UINT16 attribute,
+ UINT16_PTR file_handle_ptr ) ;
+
+INT16 SMB_OpenFileHandle(
+ SMB_CONNECTION_PTR connection_ptr,
+ CHAR_PTR file_name,
+ CHAR mode,
+ UINT16_PTR file_handle_ptr,
+ UINT32_PTR file_size_ptr ) ;
+
+INT16 SMB_CloseFileHandle(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16 file_handle ) ;
+
+INT16 SMB_ReadFile(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16 file_handle,
+ CHAR_PTR buffer,
+ UINT16_PTR length_ptr ) ;
+
+INT16 SMB_WriteFile(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16 file_handle,
+ CHAR_PTR buffer,
+ UINT16_PTR length_ptr ) ;
+
+INT16 SMB_DeleteFile(
+ SMB_CONNECTION_PTR connection_ptr,
+ CHAR_PTR file_name ) ;
+
+INT16 SMB_MoveFilePointer(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16 file_handle,
+ CHAR mode,
+ UINT32 position ) ;
+
+INT16 SMB_FindFirstMatchingFile(
+ SMB_CONNECTION_PTR connection_ptr,
+ SMB_DTA_PTR dta_ptr,
+ CHAR_PTR file_name,
+ UINT16 attribute ) ;
+
+INT16 SMB_FindNextMatchingFile(
+ SMB_CONNECTION_PTR connection_ptr,
+ SMB_DTA_PTR dta_ptr ) ;
+
+INT16 SMB_FileAttribute(
+ SMB_CONNECTION_PTR connection_ptr,
+ CHAR_PTR file_name,
+ CHAR mode,
+ UINT8_PTR attribute_ptr ) ;
+
+INT16 SMB_RenameFile(
+ SMB_CONNECTION_PTR connection_ptr,
+ CHAR_PTR file_name,
+ CHAR_PTR file_rename ) ;
+
+INT16 SMB_FileDateTime(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16 file_handle,
+ CHAR mode,
+ UINT16_PTR date_ptr,
+ UINT16_PTR time_ptr ) ;
+
+INT16 SMB_FileAccessControl(
+ SMB_CONNECTION_PTR connection_ptr,
+ UINT16 file_handle,
+ CHAR mode,
+ UINT32 offset,
+ UINT32 length ) ;
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/smb_c.h b/private/utils/ntbackup/inc/smb_c.h
new file mode 100644
index 000000000..23e78edd1
--- /dev/null
+++ b/private/utils/ntbackup/inc/smb_c.h
@@ -0,0 +1,67 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: smb_c.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Common public header file for the SMB workstation and server.
+
+ Location: SMB_PUBLIC
+
+
+ $Log: W:/LOGFILES/SMB_C.H_V $
+ *
+ * Rev 1.1 23 Jun 1992 15:33:48 JOHNW
+ * Added LOST_CONNECTION define.
+ *
+ * Rev 1.0 09 May 1991 13:32:02 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef SMB_C
+#define SMB_C
+
+/* begin include list */
+
+#include "smb_cs.h" /* public header file of structures for the SMB server */
+#include "fartypes.h"
+
+/* $end$ include list */
+
+#ifdef DEDICATED
+VOID SMB_FinalInitialize( VOID ) ;
+
+UINT16 SMB_Remove(
+ VOID ) ;
+#endif
+
+VOID SMB_SetMachineNamePtr(
+ CHAR_PTR machine_name_ptr ) ;
+
+UINT16 SMB_Initialize(
+ SMB_DEFINITION_PTR SMB_definition_ptr ) ;
+
+UINT16 SMB_MemoryRequired(
+ VOID ) ;
+
+UINT16 SMB_PublishApplication(
+ CHAR_FAR_PTR application_name,
+ UINT16 type ) ;
+
+UINT16 SMB_WithdrawApplication(
+ SMB_APPLICATION_PTR application_ptr ) ;
+
+INT16 SMB_ApplicationSize(
+ VOID ) ;
+
+INT16 SMB_ConnectionSize(
+ VOID ) ;
+
+#define SMB_LOST_CONNECTION ( 0xfffd )
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/smb_cs.h b/private/utils/ntbackup/inc/smb_cs.h
new file mode 100644
index 000000000..1036bd199
--- /dev/null
+++ b/private/utils/ntbackup/inc/smb_cs.h
@@ -0,0 +1,138 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: smb_cs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Common public header file of structures for the SMB workstation and server.
+
+ Location: SMB_PUBLIC
+
+
+ $Log: W:/LOGFILES/SMB_CS.H_V $
+ *
+ * Rev 1.1 30 Jul 1992 12:21:38 JOHNW
+ * Added dos_busy_timeout field to SMB_DEFINITION structure.
+ *
+ * Rev 1.0 09 May 1991 13:33:30 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef SMB_CS
+#define SMB_CS
+
+/* begin include list */
+#include "fartypes.h"
+/* $end$ include list */
+
+#define SMB_VALUE_BASE ( 0x1000 )
+#define SMB_ERROR_BASE ( 0 - SMB_VALUE_BASE )
+
+enum SMB_ERROR_VALUES {
+
+ INVALID = ( SMB_ERROR_BASE ),
+ INSTALLED,
+ NRL_NOT_FOUND,
+ DISABLED,
+ OUT_OF_NRL_RESOURCES,
+ OUT_OF_CONNECTIONS,
+ OUT_OF_APPLICATIONS,
+ INCOMPATIBLE_DOS
+ } ;
+
+enum SMB_VALUES {
+
+ PRISTINE = ( SMB_VALUE_BASE ),
+ WAITING,
+ IN_USE,
+
+ IDLE,
+ WRITING_BLOCK,
+ DISCONNECTING,
+ } ;
+
+#define SERVER ( 0x1 )
+#define WORKSTATION ( 0x2 )
+
+#define GETTING ( 0x0 )
+#define SETTING ( 0x1 )
+
+#define LOCKING ( 0x0 )
+#define UNLOCKING ( 0x1 )
+
+#define SEEK_FROM_BOF ( 0x0 )
+#define SEEK_FROM_CURRENT_LOCATION ( 0x1 )
+#define SEEK_FROM_EOF ( 0x2 )
+
+#define MAX_SIGNATURE_NAME ( 13 )
+
+#define ALL_AVAILABLE_BUFFERS ( 65535U )
+
+typedef struct CONNECTION_STRUCT
+SMB_CONNECTION,
+far *SMB_CONNECTION_PTR,
+far * far *SMB_CONNECTION_TABLE ;
+
+typedef struct APPLICATION_STRUCT
+SMB_APPLICATION,
+far *SMB_APPLICATION_PTR,
+far * far *SMB_APPLICATION_TABLE ;
+
+typedef struct DEVICE_STRUCT
+SMB_DEVICE,
+far *SMB_DEVICE_PTR,
+far * far *SMB_DEVICE_TABLE ;
+
+typedef BOOLEAN ( *SMB_PF_ERROR_HANDLER )
+( INT16 crit_err_code,
+ SMB_CONNECTION_PTR connect_ptr ) ;
+
+typedef struct SMB_DEFINITION_STRUCT {
+
+ CHAR_FAR_PTR signature_name ;
+ UINT16 type ;
+ UINT16 max_local_applications ;
+ UINT16 max_remote_applications ;
+ UINT16 max_local_devices ;
+ UINT16 max_remote_devices ;
+ UINT16 max_concurrent_connections ;
+ UINT16 max_buffer_size ;
+ UINT16 preread_buffers ;
+ UINT32 max_receive_timeout ;
+ SMB_PF_ERROR_HANDLER error_handler ;
+ UINT16 remote_resource_filter ;
+ UINT16 dos_busy_timeout ;
+
+} far *SMB_DEFINITION_PTR,
+SMB_DEFINITION ;
+
+/* Macros to extract the configuration values from a pointer to an SMB */
+/* defintion ( as from NRL ) */
+
+#define SMBType(x) ( (x)->type )
+#define SMBMaxLocalApps(x) ( (x)->max_local_applications )
+#define SMBMaxRemoteApps(x) ( (x)->max_remote_applications )
+#define SMBMaxLocalDevices(x) ( (x)->max_local_devices )
+#define SMBMaxRemoteDevices(x) ( (x)->max_remote_devices )
+#define SMBMaxConcurrentConns(x) ( (x)->max_concurrent_connections )
+#define SMBMaxBufferSize(x) ( (x)->max_buffer_size )
+#define SMBPrereadBuffers(x) ( (x)->preread_buffers )
+#define SMBMaxReceiveTimeout(x) ( (x)->max_receive_timeout )
+#define SMBRemoteRsrcFilter(x) ( (x)->remote_resource_filter )
+
+typedef struct SMB_DTA_STRUCT {
+
+ CHAR DOS_reserved[ 21 ] ;
+ UINT8 attribute ;
+ UINT16 time ;
+ UINT16 date ;
+ UINT32 length ;
+ CHAR name[ 13 ] ;
+
+} *SMB_DTA_PTR,
+SMB_DTA ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/smb_s.h b/private/utils/ntbackup/inc/smb_s.h
new file mode 100644
index 000000000..cf4bd7f87
--- /dev/null
+++ b/private/utils/ntbackup/inc/smb_s.h
@@ -0,0 +1,37 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: smb_s.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Public header file of structures for the SMB workstation.
+
+ Location: SMB_PUBLIC
+
+
+ $Log: W:/LOGFILES/SMB_S.H_V $
+ *
+ * Rev 1.1 23 Jun 1992 15:35:28 JOHNW
+ * Moved LOST_CONNECTION define to smb_c.h
+ *
+ * Rev 1.0 09 May 1991 13:33:34 HUNTER
+ * Initial revision.
+
+**/
+
+#ifndef SMB_S
+#define SMB_S
+
+/* begin include list */
+
+#include "smb_cs.h" /* common public header file of structures for the SMB workstation and server */
+
+/* $end$ include list */
+
+#define CREATING_CLOSED_FILE ( 0x0 )
+#define CREATING_OPENED_FILE ( 0x1 )
+
+#define SMB_CRITICAL_ERROR ( 0xfffe )
+#endif
diff --git a/private/utils/ntbackup/inc/some.h b/private/utils/ntbackup/inc/some.h
new file mode 100644
index 000000000..2b6fb89d0
--- /dev/null
+++ b/private/utils/ntbackup/inc/some.h
@@ -0,0 +1,3 @@
+#include "ss_gui.h"
+#include "mui.h"
+
diff --git a/private/utils/ntbackup/inc/special.h b/private/utils/ntbackup/inc/special.h
new file mode 100644
index 000000000..c9576b16d
--- /dev/null
+++ b/private/utils/ntbackup/inc/special.h
@@ -0,0 +1,61 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: special.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the special function definitions.
+
+ Location: BE_PUBLIC
+
+
+ $Log: T:\logfiles\special.h_v $
+ *
+ * Rev 1.4 17 Dec 1993 16:40:10 GREGG
+ * Extended error reporting.
+ *
+ * Rev 1.3 16 Apr 1993 14:22:54 chrish
+ * Added define for HW compression.
+ *
+ * Rev 1.2 17 Mar 1993 14:59:40 GREGG
+ * This is Terri Lynn. Added Gregg's changes to switch the tape drive's block mode
+ * to match the block size of the current tape.
+ *
+ * Rev 1.1 28 Aug 1991 09:59:44 ED
+ * Roll in Bonoman's changes (Panther). Fixed log token.
+
+**/
+/* $end$ include list */
+
+#ifndef SPECIALS
+
+#define SPECIALS
+
+
+#define SS_ERROR_RESTORE 1
+#define SS_FLUSH_BUFFER 2
+#define SS_KILL_DEVICE 3
+#define SS_KILL_ERROR_Q 4
+#define SS_KILL_IN_Q 5
+#define SS_SET_STEP 6
+#define SS_CLR_STEP 7
+#define SS_LAST_STATUS 8
+#define SS_GET_DRV_INF 9
+#define SS_IS_ERROR 10
+#define SS_POP_ERROR_Q 11
+#define SS_IS_INQ_EMPTY 12
+#define SS_LOAD_UNLOAD 13
+#define SS_NO_MAY_ID 14
+#define SS_NO_1ST_REQ 15
+#define SS_DUMP_DVR_DATA 16
+#define SS_FIND_BLOCK 17
+#define SS_SHOW_BLOCK 18
+#define SS_PHYS_BLOCK 19
+#define SS_FORCE_MACHINE_TYPE 20
+#define SS_CHANGE_BLOCK_SIZE 21
+#define SS_SET_DRV_COMPRESSION 22
+#define SS_GET_LAST_ERROR 23
+
+#endif
diff --git a/private/utils/ntbackup/inc/srvlogin.h b/private/utils/ntbackup/inc/srvlogin.h
new file mode 100644
index 000000000..f86944b1e
--- /dev/null
+++ b/private/utils/ntbackup/inc/srvlogin.h
@@ -0,0 +1,39 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1992
+
+ Name: srvlogin.h
+
+ Description: Contains dialog control id's for attach-to-server
+ dialog.
+
+ $Log: G:/UI/LOGFILES/SRVLOGIN.H_V $
+
+ Rev 1.2 04 Oct 1992 19:49:28 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.1 03 Apr 1992 13:48:54 CARLS
+added translate defines
+
+ Rev 1.0 29 Jan 1992 11:58:50 CHUCKB
+Initial revision.
+
+*****************************************************/
+
+#ifndef srvlogin_h
+#define srvlogin_h
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_PSWD 21
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_SERVERNAME 101
+#define IDD_USERNAME 102
+#define IDD_PASSWORD 103
+#define IDD_LOGIN_TIMEBOX 104
+#define IDD_LOGIN_TIMEOUT 105
+#define IDD_LOGIN_HELP 106
+
+#endif
diff --git a/private/utils/ntbackup/inc/ss_gui.h b/private/utils/ntbackup/inc/ss_gui.h
new file mode 100644
index 000000000..206d3c863
--- /dev/null
+++ b/private/utils/ntbackup/inc/ss_gui.h
@@ -0,0 +1,103 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: ss_gui.h
+
+ Description: This file includes the header files necessary for
+ other modules to compile with the GUI sub-system.
+ It also contains the function prototypes for
+ initializing and deinitializing the GUI sub-system.
+
+ $Log: G:/UI/LOGFILES/SS_GUI.H_V $
+
+ Rev 1.9 27 Apr 1993 21:43:50 DARRYLP
+Removed ifdef's Glenn put around CBEMON.H to eliminate unresolved externals in Nostradamus.
+
+ Rev 1.8 27 Apr 1993 16:26:40 DARRYLP
+Changed DDEMANG.H to CBEMON.H
+
+ Rev 1.7 09 Apr 1993 15:42:02 GLENN
+Ifdef'd the include of DDEMANG.H to not include it in OEM_MSOFT.
+
+ Rev 1.6 09 Apr 1993 14:12:08 GLENN
+Added ddemang.h
+
+ Rev 1.5 04 Oct 1992 19:49:30 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 07 Jan 1992 17:42:58 GLENN
+Added muiutil.h
+
+ Rev 1.3 03 Dec 1991 16:12:32 GLENN
+Changed the ID() macro not to use the MAKEINTRESOURCE supplied with windows
+3.1 -- temporary.
+
+ Rev 1.2 03 Dec 1991 09:54:34 GLENN
+Removed CDECL def.
+
+ Rev 1.1 27 Nov 1991 13:37:32 GLENN
+Added resource compiler dependent ifdef.
+
+ Rev 1.0 20 Nov 1991 19:41:34 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#ifndef SS_GUI
+
+#define SS_GUI
+
+#include <windows.h>
+#include <drivinit.h>
+
+#ifdef RC_INVOKED
+
+// IF INVOKED BY THE RESOURCE COMPILER SKIP THE FUNCTION HEADERS
+
+#define ID(id) id
+
+#else
+
+// IF NOT INVOKED BY THE RESOURCE COMPILER INCLUDE THE FUNCTION HEADERS
+
+// #define ID(id) MAKEINTRESOURCE(id) // ????? took out for winstric.h
+
+#define ID(id) (LPSTR)((DWORD)((WORD)(id)))
+
+#include "portdefs.h"
+#include "stdtypes.h"
+#include "appdefs.h"
+#include "queues.h"
+#include "timers.h"
+#include "muiconf.h"
+#include "muiutil.h"
+#include "memmang.h"
+#include "menumang.h"
+#include "ribmang.h"
+#include "dialmang.h"
+#include "resmang.h"
+#include "statline.h"
+#include "dlm.h"
+#include "winmang.h"
+#include "debug.h"
+#include "prtmang.h"
+#include "helpmang.h"
+#include "msgbox.h"
+
+#include "cbemon.h"
+
+#include "global.h"
+
+#include "ctl3d.h"
+
+
+// FUNCTION PROTOTYPES
+
+BOOL GUI_Init ( LPSTR, INT );
+BOOL GUI_InitGlobals ( VOID );
+VOID GUI_Deinit ( VOID );
+
+#endif // RC_INVOKED
+
+#endif // SS_GUI
diff --git a/private/utils/ntbackup/inc/statline.h b/private/utils/ntbackup/inc/statline.h
new file mode 100644
index 000000000..dbb27981b
--- /dev/null
+++ b/private/utils/ntbackup/inc/statline.h
@@ -0,0 +1,55 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: statline.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the Maynstream GUI Status Line Manager (STM).
+
+ $Log: G:/UI/LOGFILES/STATLINE.H_V $
+
+ Rev 1.4 04 Oct 1992 19:49:32 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 10 Jul 1992 10:29:24 GLENN
+Changed the status line to be identical to the new file manager.
+
+ Rev 1.2 10 Jun 1992 16:12:42 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.1 20 Apr 1992 13:52:40 GLENN
+Added status line get/set capability.
+
+ Rev 1.0 20 Nov 1991 19:35:14 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef SS_STM_H
+
+#define SS_STM_H
+
+#define STATUS_LINE_HEIGHT 23
+#define STATUS_BORDER 2
+#define STATUS_INDENT 6
+#define STATUS_TEXT 500
+#define STATUS_TEXT_MARGIN 8
+#define STATUS_HIGHLIGHT_WIDTH 1
+
+// MACROS
+
+#define STM_DrawIdle( ) STM_DrawText ( gszStatusLine )
+
+// FUNCTION PROTOTYPES
+
+VOID STM_DrawBorder( VOID );
+VOID STM_DrawMemory( VOID );
+VOID STM_DrawText( LPSTR );
+VOID STM_SetIdleText( WORD );
+LPSTR STM_GetStatusLineText( VOID );
+VOID STM_SetStatusLineText( LPSTR );
+
+#endif
diff --git a/private/utils/ntbackup/inc/stats.h b/private/utils/ntbackup/inc/stats.h
new file mode 100644
index 000000000..fe95f836c
--- /dev/null
+++ b/private/utils/ntbackup/inc/stats.h
@@ -0,0 +1,299 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: stats.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/STATS.H_V $
+
+ Rev 1.7 09 Jun 1993 15:06:38 MIKEP
+enable c++
+
+ Rev 1.6 20 Oct 1992 14:20:26 MIKEP
+add support for getcurrentoperation
+
+ Rev 1.5 04 Oct 1992 19:49:34 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 29 Jun 1992 10:38:42 MIKEP
+add hours to time display
+
+ Rev 1.3 21 May 1992 19:25:26 MIKEP
+fixes
+
+ Rev 1.2 11 May 1992 10:05:08 STEVEN
+added 64 bit support
+
+ Rev 1.1 18 Dec 1991 11:57:48 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.0 20 Nov 1991 19:42:18 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _stats_h_
+#define _stats_h_
+
+#include "datetime.h"
+
+#ifndef max
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
+typedef struct BS_STATS *BS_STATS_PTR;
+typedef struct BS_STATS {
+
+ /* These stats are for a single backup set */
+ /* Example: The operation is backing up several volumes, */
+ /* BS_STATS apply to each volume one at a time */
+
+ /* Overview stats */
+ UINT64 bs_bytes_to_be_processed ;
+ UINT32 bs_files_to_be_processed ;
+ UINT32 bs_dirs_to_be_processed ;
+
+ /* Loops stats ( does not include tape format overhead such as padding etc. ) */
+ UINT64 bs_bytes_processed ;
+ UINT32 bs_files_processed ;
+ UINT32 bs_dirs_processed ;
+
+ /* Skipped stats */
+ UINT64 bs_bytes_skipped ;
+ UINT32 bs_files_skipped ;
+ UINT32 bs_dirs_skipped ;
+
+ /* Bad stats */
+ UINT64 bs_bytes_bad ;
+ UINT32 bs_files_bad ;
+ UINT32 bs_dirs_bad ;
+
+ /* AFP stats */
+ UINT32 bs_afp_files_processed ;
+
+ /* In-use stats */
+ UINT32 bs_in_use_files_processed ;
+
+ /* Deleted stats */
+ UINT64 bs_bytes_deleted ;
+ UINT32 bs_files_deleted ;
+ UINT32 bs_dirs_deleted ;
+
+ /* Time stats */
+ UINT32 bs_start_time ;
+ UINT32 bs_end_time ;
+ UINT32 bs_start_idle ;
+ UINT32 bs_total_idle ;
+ UINT16 bs_idle_level ;
+
+ /* Verify statistics */
+ UINT32 num_security_differences ;
+ UINT32 files_different ;
+ UINT32 files_not_found ;
+ UINT32 directories_different ;
+ UINT32 directories_not_found ;
+
+ /* Tape Format Layer Statistics */
+ UINT32 soft_errs ;
+ UINT64 raw_bytes ;
+ UINT32 raw_fdbs ;
+ UINT32 raw_ddbs ;
+ UINT32 raw_idbs ;
+
+} BS_STATS;
+
+typedef struct STATS *STATS_PTR;
+typedef struct STATS {
+
+ /* backup set stats */
+ BS_STATS bs_stats ;
+
+ /* U64 space */
+ UINT64 U64space;
+ BOOLEAN U64stat;
+
+ UINT64 current_file_size; // num bytes in file
+ UINT64 current_file_done; // num bytes of file processed
+
+ /* Time stats */
+ UINT32 op_start_time ;
+ UINT32 op_end_time ;
+ UINT32 op_start_idle ;
+ UINT32 op_total_idle ;
+ UINT16 op_idle_level ;
+
+} STATS ;
+
+/*
+ Prototypes
+*/
+VOID ST_StartOperation( STATS_PTR ) ;
+VOID ST_EndOperation( STATS_PTR ) ;
+VOID ST_StartOperationIdle( STATS_PTR ) ;
+VOID ST_EndOperationIdle( STATS_PTR ) ;
+VOID ST_StartBackupSet( STATS_PTR ) ;
+VOID ST_EndBackupSet( STATS_PTR ) ;
+VOID ST_StartBackupSetIdle( STATS_PTR ) ;
+VOID ST_EndBackupSetIdle( STATS_PTR ) ;
+
+/*
+ Set Macros
+*/
+#define ST_SetBSStartTime( s, v ) ( ( VOID )( ( s )->bs_stats.bs_start_time = v ) )
+#define ST_SetBSEndTime( s, v ) ( ( VOID )( ( s )->bs_stats.bs_end_time = v ) )
+#define ST_SetBSStartIdle( s, v ) ( ( VOID )( ( s )->bs_stats.bs_start_idle = v ) )
+
+#define ST_SetOPStartTime( s, v ) ( ( VOID )( ( s )->op_start_time = v ) )
+#define ST_SetOPEndTime( s, v ) ( ( VOID )( ( s )->op_end_time = v ) )
+#define ST_SetOPStartIdle( s, v ) ( ( VOID )( ( s )->op_start_idle = v ) )
+
+#define ST_SetCFSize( s, v ) ( ( s )->current_file_size = ( v ) )
+#define ST_SetCFDone( s, v ) ( ( s )->current_file_done = ( v ) )
+
+/*
+ Get Macros
+*/
+
+#define ST_GetBSStartIdle( s ) ( ( s )->bs_stats.bs_start_idle )
+#define ST_GetOPStartIdle( s ) ( ( s )->op_start_idle )
+
+#define ST_BSIdleLevel( s ) ( ( s )->bs_stats.bs_idle_level )
+#define ST_OPIdleLevel( s ) ( ( s )->op_idle_level )
+
+#define ST_GetBSBytesToBeProcessed( s ) ( ( s )->bs_stats.bs_bytes_to_be_processed )
+#define ST_GetBSFilesToBeProcessed( s ) ( ( s )->bs_stats.bs_files_to_be_processed )
+#define ST_GetBSDirsToBeProcessed( s ) ( ( s )->bs_stats.bs_dirs_to_be_processed )
+
+#define ST_GetBSBytesProcessed( s ) ( ( s )->bs_stats.bs_bytes_processed )
+#define ST_GetBSFilesProcessed( s ) ( ( s )->bs_stats.bs_files_processed )
+#define ST_GetBSDirsProcessed( s ) ( ( s )->bs_stats.bs_dirs_processed )
+
+#define ST_GetBSBytesSkipped( s ) ( ( s )->bs_stats.bs_bytes_skipped )
+#define ST_GetBSFilesSkipped( s ) ( ( s )->bs_stats.bs_files_skipped )
+#define ST_GetBSDirsSkipped( s ) ( ( s )->bs_stats.bs_dirs_skipped )
+
+#define ST_GetBSBytesBad( s ) ( ( s )->bs_stats.bs_bytes_bad )
+#define ST_GetBSFilesBad( s ) ( ( s )->bs_stats.bs_files_bad )
+#define ST_GetBSDirsBad( s ) ( ( s )->bs_stats.bs_dirs_bad )
+
+#define ST_GetBSAFPFilesProcessed( s ) ( ( s )->bs_stats.bs_afp_files_processed )
+
+#define ST_GetBSInUseFilesProcessed( s ) ( ( s )->bs_stats.bs_in_use_files_processed )
+
+#define ST_GetBSBytesDeleted( s ) ( ( s )->bs_stats.bs_bytes_deleted )
+#define ST_GetBSFilesDeleted( s ) ( ( s )->bs_stats.bs_files_deleted )
+#define ST_GetBSDirsDeleted( s ) ( ( s )->bs_stats.bs_dirs_deleted )
+
+#define ST_GetBSStartTime( s ) ( ( s )->bs_stats.bs_start_time )
+#define ST_GetBSEndTime( s ) ( ( s )->bs_stats.bs_end_time )
+
+#define ST_GetBSElapsedHours( s ) ( ( INT16 )( ( ( ( s )->bs_stats.bs_end_time ) - ( ( s )->bs_stats.bs_start_time + \
+ ( s )->bs_stats.bs_total_idle ) ) / 3600 ) )
+#define ST_GetBSElapsedMinutes( s ) ( ( INT16 )( ( ( ( ( s )->bs_stats.bs_end_time ) - ( ( s )->bs_stats.bs_start_time + \
+ ( s )->bs_stats.bs_total_idle ) ) % 3600 ) / 60 ) )
+#define ST_GetBSElapsedSeconds( s ) ( ( INT16 )( ( ( ( s )->bs_stats.bs_end_time ) - ( ( s )->bs_stats.bs_start_time + \
+ ( s )->bs_stats.bs_total_idle ) ) % 60 ) )
+
+#define ST_GetNumSecurityDifferences( s ) ( ( s )->bs_stats.num_security_differences )
+#define ST_GetFilesDifferent( s ) ( ( s )->bs_stats.files_different )
+#define ST_GetFilesNotFound( s ) ( ( s )->bs_stats.files_not_found )
+#define ST_GetDirectoriesDifferent( s ) ( ( s )->bs_stats.directories_different )
+#define ST_GetDirectoriesNotFound( s ) ( ( s )->bs_stats.directories_not_found )
+
+#define ST_GetFilesVerified( s ) ( ( ( s )->bs_stats.bs_files_processed ) - \
+ ( ( ( s )->bs_stats.files_different ) + ( ( s )->bs_stats.files_not_found ) ) )
+
+#define ST_GetBSRate( s ) U64_Div( ( ( s )->bs_stats.bs_bytes_processed ), \
+ U64_Init(( ( max( 1L,( ( s )->bs_stats.bs_end_time ) - ( ( s )->bs_stats.bs_start_time + ( s )->bs_stats.bs_total_idle ) ) ) ),0), \
+ &((s)->U64space), &((s)->U64stat) )
+
+#define ST_GetCFSize( s ) ( ( s )->current_file_size )
+#define ST_GetCFDone( s ) ( ( s )->current_file_done )
+
+#define ST_GetSoftErrs( s ) ( ( s )->bs_stats.soft_errs )
+#define ST_GetRawBytes( s ) ( ( s )->bs_stats.raw_bytes )
+#define ST_GetRawFDBs( s ) ( ( s )->bs_stats.raw_fdbs )
+#define ST_GetRawDDBs( s ) ( ( s )->bs_stats.raw_ddbs )
+#define ST_GetRawIDBs( s ) ( ( s )->bs_stats.raw_idbs )
+
+#define ST_GetOPStartTime( s ) ( ( s )->op_start_time )
+#define ST_GetOPEndTime( s ) ( ( s )->op_end_time )
+
+#define ST_GetOPElapsedMinutes( s ) ( ( INT16 )( ( ( ( s )->op_end_time ) - ( ( s )->op_start_time + \
+ ( s )->op_total_idle ) ) / 60 ) )
+#define ST_GetOPElapsedSeconds( s ) ( ( INT16 )( ( ( ( s )->op_end_time ) - ( ( s )->op_start_time + \
+ ( s )->op_total_idle ) ) % 60 ) )
+/*
+ Add Macros
+*/
+#define ST_AddBSIdle( s, v ) ( ( VOID )( ( s )->bs_stats.bs_total_idle += v ) )
+#define ST_AddOPIdle( s, v ) ( ( VOID )( ( s )->op_total_idle += v ) )
+
+#define ST_AddBSBytesToBeProcessed( s, v ) ( ( s )->bs_stats.bs_bytes_to_be_processed = \
+ U64_Add( ( ( s )->bs_stats.bs_bytes_to_be_processed, \
+ ( v ), &((s)->U64stat ) ) )
+#define ST_AddBSFilesToBeProcessed( s, v ) ( ( VOID )( ( s )->bs_stats.bs_files_to_be_processed += v ) )
+#define ST_AddBSDirsToBeProcessed( s, v ) ( ( VOID )( ( s )->bs_stats.bs_dirs_to_be_processed += v ) )
+
+#define ST_AddBSBytesProcessed( s, v ) ( ( s )->bs_stats.bs_bytes_processed = \
+ U64_Add( ( s )->bs_stats.bs_bytes_processed, \
+ ( v ), &((s)->U64stat) ) )
+
+#define ST_AddBSFilesProcessed( s, v ) ( ( VOID )( ( s )->bs_stats.bs_files_processed += v ) )
+#define ST_AddBSDirsProcessed( s, v ) ( ( VOID )( ( s )->bs_stats.bs_dirs_processed += v ) )
+
+#define ST_AddBSBytesSkipped( s, v ) ( ( s )->bs_stats.bs_bytes_skipped = \
+ U64_Add( ( s )->bs_stats.bs_bytes_skipped, \
+ ( v ), &((s)->U64stat )) )
+
+#define ST_AddBSFilesSkipped( s, v ) ( ( VOID )( ( s )->bs_stats.bs_files_skipped += v ) )
+#define ST_AddBSDirsSkipped( s, v ) ( ( VOID )( ( s )->bs_stats.bs_dirs_skipped += v ) )
+
+#define ST_AddBSBytesBad( s, v ) ( ( s )->bs_stats.bs_bytes_bad = \
+ U64_Add( ( s )->bs_stats.bs_bytes_bad, \
+ ( v ), &((s)->U64stat ) ) )
+
+#define ST_AddBSFilesBad( s, v ) ( ( VOID )( ( s )->bs_stats.bs_files_bad += v ) )
+#define ST_AddBSDirsBad( s, v ) ( ( VOID )( ( s )->bs_stats.bs_dirs_bad += v ) )
+
+#define ST_AddBSAFPFilesProcessed( s, v ) ( ( VOID )( ( s )->bs_stats.bs_afp_files_processed += v ) )
+
+#define ST_AddBSInUseFilesProcessed( s, v ) ( ( VOID )( ( s )->bs_stats.bs_in_use_files_processed += v ) )
+
+#define ST_AddBSBytesDeleted( s, v ) ( ( s )->bs_stats.bs_bytes_deleted = \
+ U64_Add( ( s )->bs_stats.bs_bytes_deleted, \
+ ( v ), &((s)->U64stat ) ) )
+
+#define ST_AddBSFilesDeleted( s, v ) ( ( VOID )( ( s )->bs_stats.bs_files_deleted += v ) )
+#define ST_AddBSDirsDeleted( s, v ) ( ( VOID )( ( s )->bs_stats.bs_dirs_deleted += v ) )
+
+#define ST_AddBSSecondsWasted( s, v ) ( ( VOID )( ( s )->bs_stats.bs_seconds_wasted += v ) )
+#define ST_AddBSStartSecondsWasted( s, v ) ( ( VOID )( ( s )->bs_stats.bs_start_seconds_wasted += v ) )
+
+#define ST_AddNumSecurityDifferences( s, v ) ( ( VOID )( ( s )->bs_stats.num_security_differences += v ) )
+#define ST_AddFilesDifferent( s, v ) ( ( VOID )( ( s )->bs_stats.files_different += v ) )
+#define ST_AddFilesNotFound( s, v ) ( ( VOID )( ( s )->bs_stats.files_not_found += v ) )
+#define ST_AddDirectoriesDifferent( s, v ) ( ( VOID )( ( s )->bs_stats.directories_different += v ) )
+#define ST_AddDirectoriesNotFound( s, v ) ( ( VOID )( ( s )->bs_stats.directories_not_found += v ) )
+
+#define ST_AddSoftErrs( s, v ) ( ( VOID )( ( s )->bs_stats.soft_errs += v ) )
+#define ST_AddRawBytes( s, v ) ( ( s )->bs_stats.bs_raw_bytes = \
+ U64_Add( ( s )->bs_stats.bs_raw_bytes, \
+ ( v ), &((s)->U64stat ) ) )
+#define ST_AddRawFDBs( s, v ) ( ( VOID )( ( s )->bs_stats.raw_fdbs += v ) )
+#define ST_AddRawDDBs( s, v ) ( ( VOID )( ( s )->bs_stats.raw_ddbs += v ) )
+#define ST_AddRawIDBs( s, v ) ( ( VOID )( ( s )->bs_stats.raw_idbs += v ) )
+
+#define ST_AddCFDone( s, v ) ( ( s )->current_file_done = \
+ U64_Add( ( s )->current_file_done, \
+ ( v ), &((s)->U64stat ) ) )
+
+#define ST_PushBSIdleLevel( s ) ( ( ( s )->bs_stats.bs_idle_level ) ++ )
+#define ST_PopBSIdleLevel( s ) ( ( ( s )->bs_stats.bs_idle_level ) -- )
+#define ST_PushOPIdleLevel( s ) ( ( ( s )->op_idle_level ) ++ )
+#define ST_PopOPIdleLevel( s ) ( ( ( s )->op_idle_level ) -- )
+
+#endif
diff --git a/private/utils/ntbackup/inc/status.h b/private/utils/ntbackup/inc/status.h
new file mode 100644
index 000000000..16e414f12
--- /dev/null
+++ b/private/utils/ntbackup/inc/status.h
@@ -0,0 +1,43 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: status.h
+
+ Description:
+
+
+ $Log: G:/UI/LOGFILES/STATUS.H_V $
+
+ Rev 1.4 04 Oct 1992 19:49:36 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 28 Jul 1992 14:55:28 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.2 09 Dec 1991 17:46:32 JOHNWT
+removed yprompt
+
+ Rev 1.1 09 Dec 1991 17:09:04 DAVEV
+fixed prototype of yprompt()
+
+ Rev 1.0 20 Nov 1991 19:40:50 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef _status_h_
+#define _status_h_
+
+#include <stdarg.h>
+
+VOID yresprintf( INT res_id, ... ) ;
+VOID yprintf( CHAR_PTR fmt, ... ) ;
+VOID yvprintf( CHAR_PTR fmt, va_list arg_ptr ) ;
+VOID tprintf( CHAR_PTR fmt, va_list arg_ptr ) ;
+VOID typrintf( CHAR_PTR fmt, ... ) ;
+UINT16 tstatus( BOOLEAN wrap_flag ) ;
+VOID ysave_cursor_position( VOID ) ;
+VOID yrestore_cursor_position( VOID ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/std_err.h b/private/utils/ntbackup/inc/std_err.h
new file mode 100644
index 000000000..7e14ceec6
--- /dev/null
+++ b/private/utils/ntbackup/inc/std_err.h
@@ -0,0 +1,30 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: std_err.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: this file contains the standard error
+
+
+ $Log: G:/LOGFILES/STD_ERR.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:32:10 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _std_err_h_
+#define _std_err_h_
+
+#define NO_ERR 0
+
+/* standard errors: range -1 to -255 */
+
+#define OUT_OF_MEMORY -1
+#define USER_ABORT -2
+
+#endif
diff --git a/private/utils/ntbackup/inc/stdhooks.h b/private/utils/ntbackup/inc/stdhooks.h
new file mode 100644
index 000000000..ec45c6eca
--- /dev/null
+++ b/private/utils/ntbackup/inc/stdhooks.h
@@ -0,0 +1,48 @@
+
+/******************************************************************************
+
+Copyright(c) Maynard, an Archive Company 1991
+GSH
+
+ Name: stdhooks.h
+
+ Description: Contains the GUI standard hooks definitions.
+
+
+ $Log: P:/GUIWIN4/VCS/STDHOOKS.H_V $
+ *
+ * Rev 1.0 28 Jan 1993 10:47:26 STEVEN
+ * Initial revision.
+ *
+ * Rev 1.6 16 Nov 1992 15:27:00 GREGG
+ * Conditionally include unic_io.h.
+ *
+ * Rev 1.5 11 Nov 1992 18:27:34 DAVEV
+ * unicode fixes
+ *
+ * Rev 1.3 07 Oct 1992 13:57:40 STEVEN
+ * added stdwcs.h
+ *
+ * Rev 1.2 01 Sep 1992 13:10:52 STEVEN
+ * fix unaligned problem
+ *
+ * Rev 1.1 12 Aug 1992 17:50:42 STEVEN
+ * fixes at MSOFT
+ *
+ * Rev 1.0 10 Jun 1992 17:17:44 STEVEN
+ * Initial revision.
+******************************************************************************/
+
+#ifndef STDHOOKS
+#define STDHOOKS
+
+#include "memmang.h"
+#include "stdwcs.h"
+
+#ifdef UNICODE
+ #include "unic_io.h"
+#endif
+
+#include "muiutil.h"
+
+#endif
diff --git a/private/utils/ntbackup/inc/stdmacro.h b/private/utils/ntbackup/inc/stdmacro.h
new file mode 100644
index 000000000..fdff3c913
--- /dev/null
+++ b/private/utils/ntbackup/inc/stdmacro.h
@@ -0,0 +1,53 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: stdmacro.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the standard macro definitions.
+
+
+ $Log: P:/LOGFILES/STDMACRO.H_V $
+ *
+ * Rev 1.1 23 Jan 1992 17:37:42 STEVEN
+ * fix swap long
+ *
+ * Rev 1.0 09 May 1991 13:31:58 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+
+#ifndef _stdmacro_h_
+#define _stdmacro_h_
+
+#define BSwapWord( x ) \
+ (0xffff & ( ((x) << 8) | (0xff & ((x) >> 8) ) ) )
+
+#define BSwapLong( x ) \
+ ( ( ( (UINT32)(BSwapWord(x) ) ) << 16L ) | \
+ ( (UINT32)(BSwapWord( (UINT16)((x) >> 16L) )) ) )
+
+/* Pointer & Address Manipulation Functions */
+
+#define ToSeg(fp) (*((unsigned *)&(fp) + 1))
+#define ToOff(fp) (*((unsigned *)&(fp)))
+
+#define MakePtr( seg, off ) (( CHAR_PTR ) (((( UINT32 ) (seg) ) << 16 ) | (( UINT32 ) (off) )))
+#define PtrToAddr(x) (( ( UINT32 ) ToSeg( (x) ) << 4 ) + (( UINT32 ) ToOff( (x) )))
+#define PtrToPage(x) ( PtrToAddr( (x) ) >> 16 )
+#define GetEnd( p, l ) ( (p) + (l) )
+#define AddrToPtr( p ) ( MakePtr( ( ( ( UINT32 ) (p) ) >> 4 ), ( ( ( UINT32 ) (p) ) & 0x0000f ) ) )
+
+
+#define UpDiv( x, y ) \
+ ( ((x)+(y)-1L) / (y) )
+
+#define WordSizeEquivalent( siz ) \
+ UpDiv( (siz), 2L )
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/stdmath.h b/private/utils/ntbackup/inc/stdmath.h
new file mode 100644
index 000000000..a7ec5dfd6
--- /dev/null
+++ b/private/utils/ntbackup/inc/stdmath.h
@@ -0,0 +1,229 @@
+/**
+$Header: T:/LOGFILES/STDMATH.H_V 1.9 05 Mar 1993 17:23:38 GREGG $
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+ Name: stdmath.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: To provide a common header for extended number numbers.
+ Currently only 64 bit manipulation functions are supported.
+ $Log: T:/LOGFILES/STDMATH.H_V $
+
+ Rev 1.9 05 Mar 1993 17:23:38 GREGG
+Removed prototypes for functions which are now macros.
+
+ Rev 1.8 27 Oct 1992 17:51:06 GREGG
+Added macros for many of the trivial functions.
+
+ Rev 1.7 12 Aug 1992 17:57:14 BARRY
+Added max and min functions. Fixed U64_Btop prototype.
+
+ Rev 1.6 23 Jul 1992 12:20:30 STEVEN
+fix warnings
+
+ Rev 1.5 29 May 1992 13:03:30 BURT
+Fixed Octal conversion from UINT64 to ASCII string for greater than 32 bit
+numbers. Added U64_Commas() function to allow commas to be placed in the
+converted ASCII string for decimal conversions.
+
+
+ Rev 1.4 28 May 1992 11:58:42 BURT
+Additions for true 64 bit division and multiplication.
+
+
+ Rev 1.3 18 Mar 1992 10:28:34 BURT
+Changed INT and INT_PTR to INT16 and INT16_PTR to ease porting to NT
+
+
+ Rev 1.2 25 Feb 1992 09:40:00 BURT
+Oops, just noticed that there's no Header and Log in this file.
+
+ Rev 1.0 02 Feb 1992 16:52:00 BURT
+ Initial revision.
+**/
+
+#ifndef STDMATH
+#define STDMATH
+
+
+/* Stuff for the true 64 bit division and multiplication operations */
+#include <stddef.h>
+
+
+#ifndef SItype
+#define SItype long int
+#endif
+
+#ifdef BIG_ENDIAN
+
+ struct long64 {
+ long high ;
+ long low ;
+} ;
+#else
+ struct long64 {
+ long low ;
+ long high ;
+} ;
+#endif
+
+/* This union is used to unpack/pack 64 bit numbers.
+ * Incoming 64 bit parameters are stored into the big_long field,
+ * and the unpacked result is read from the structure long64.
+*/
+
+typedef union
+{
+ struct long64 s ;
+ UINT64 big_long ;
+ SItype i[2] ;
+ unsigned SItype ui[2] ;
+} long_64 ;
+
+/*
+ * Internally, 64 bit ints are structures of unsigned shorts in the
+ * order determined by BIG_ENDIAN.
+*/
+
+/*
+ * Some constants for masking.
+*/
+#define B 0x10000
+#define mask_low16 (B - 1)
+
+#ifdef BIG_ENDIAN
+
+/* Note that HIGH and LOW do not describe the order
+ of words in a 64 bit number. They describe the order of words
+ in vectors ordered according to the byte order. */
+
+#define HIGH 0
+#define LOW 1
+
+#define big_end(n) 0
+#define little_end(n) ((n) - 1)
+#define next_msd(i) ((i) - 1)
+#define next_lsd(i) ((i) + 1)
+#define not_msd(i,n) ((i) >= 0)
+#define not_lsd(i,n) ((i) < (n))
+
+#else
+
+/* Intel ordering */
+#define LOW 0
+#define HIGH 1
+
+#define big_end(n) ((n) - 1)
+#define little_end(n) 0
+#define next_msd(i) ((i) + 1)
+#define next_lsd(i) ((i) - 1)
+#define not_msd(i,n) ((i) < (n))
+#define not_lsd(i,n) ((i) >= 0)
+
+#endif
+
+
+/* Function prototypes for stdmath.c */
+
+UINT64 U64_Atoli( CHAR_PTR arg, BOOLEAN_PTR status );
+CHAR_PTR U64_Litoa( UINT64 arg, CHAR_PTR string, INT16 base, BOOLEAN_PTR status );
+UINT64 U64_Add( UINT64 arg1, UINT64 arg2, BOOLEAN_PTR status );
+UINT64 U64_Sub(UINT64 arg1, UINT64 arg2, BOOLEAN_PTR status );
+UINT64 U64_Init( UINT32 lsw, UINT32 msw );
+BOOLEAN U64_To_32Bit( UINT64 arg1, UINT32_PTR lsw, UINT32_PTR msw );
+UINT64 U32_To_U64( UINT32 arg );
+UINT32 U64_Test( UINT64 arg, UINT32 lsw_mask, UINT32 msw_mask );
+UINT32 U64_Stest( UINT64 arg, CHAR_PTR mask );
+UINT64 U64_Div(UINT64 arg1, UINT64 arg2, UINT64_PTR remainder, INT16_PTR status );
+UINT64 U64_Mod(UINT64 arg1, UINT64 arg2, INT16_PTR status );
+UINT64 U64_Mult(UINT64 arg1, UINT64 arg2 ) ;
+VOID U64_Commas( BOOLEAN action ) ;
+
+/* Macros for external use */
+#define U64_Lsw( arg ) ( (arg).lsw )
+
+#define U64_Msw( arg ) ( (arg).msw )
+
+#define U64_EQ( arg1, arg2 ) ( (arg1).msw == (arg2).msw && \
+ (arg1).lsw == (arg2).lsw )
+
+#define U64_NE( arg1, arg2 ) ( ! U64_EQ( (arg1), (arg2) ) )
+
+#define U64_GT( arg1, arg2 ) ( ( (arg1).msw > (arg2).msw ) || \
+ ( (arg1).msw == (arg2).msw && \
+ (arg1).lsw > (arg2).lsw ) )
+
+#define U64_LT( arg1, arg2 ) U64_GT( (arg2), (arg1) )
+
+#define U64_GE( arg1, arg2 ) ( U64_GT( (arg1), (arg2) ) || \
+ U64_EQ( (arg1), (arg2) ) )
+
+#define U64_LE( arg1, arg2 ) ( U64_LT( (arg1), (arg2) ) || \
+ U64_EQ( (arg1), (arg2) ) )
+
+#define U64_Min( arg1, arg2 ) ( U64_GT( (arg1), (arg2) ) ? (arg2) : (arg1) )
+
+#define U64_Max( arg1, arg2 ) ( U64_GT( (arg1), (arg2) ) ? (arg1) : (arg2) )
+
+
+
+/* Defines for bitwise operations used by U64_Btop() but are hidden
+ from the user by the various macros.
+*/
+#define CLR_64BIT 0
+#define SET_64BIT 1
+#define XOR_64BIT 2
+#define OR_64BIT 3
+#define AND_64BIT 4
+#define NOT_64BIT 5
+/* Shift operations */
+#define SHL_64BIT 6
+#define SHR_64BIT 7
+
+UINT64 U64_Btop( UINT64 arg, UINT32 lsw_mask, UINT32 msw_mask,
+ INT operation, INT shift_count );
+
+/* Some macros to make life easier for the different bit wise functions.
+ All of these macros use U64_btop() to do the real work.
+*/
+#define U64_CLR( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), CLR_64BIT, 0 )
+
+#define U64_SET( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), SET_64BIT, 0 )
+
+#define U64_XOR( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), XOR_64BIT, 0 )
+
+#define U64_OR( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), OR_64BIT, 0 )
+
+#define U64_AND( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), AND_64BIT, 0 )
+
+#define U64_NOT( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), NOT_64BIT, 0 )
+
+
+/* Shift operations */
+/* Shift left the specified number of bits */
+#define U64_SHL( arg, shift_count ) \
+ U64_Btop( (arg), 0L, 0L, SHL_64BIT, (shift_count) )
+
+/* Shift right the specified number of bits */
+#define U64_SHR( arg, shift_count ) \
+ U64_Btop( (arg), 0L, 0L, SHR_64BIT, (shift_count) )
+
+
+/* Defines for math errors (specifically division) */
+#define U64_OK 0 /* No errors, everything's fine */
+#define U64_BAD_DIV 1 /* Attempted to divide by other than power of 2,
+ or one of the other supported cases.
+ */
+#define U64_OVRFL 2 /* Overflow error */
+#define U64_UNDFL 3 /* Underflow error */
+#define U64_DIVZ 4 /* Tried to divide by 0 */
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/stdstruc.h b/private/utils/ntbackup/inc/stdstruc.h
new file mode 100644
index 000000000..9b4428720
--- /dev/null
+++ b/private/utils/ntbackup/inc/stdstruc.h
@@ -0,0 +1,25 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: stdstruc.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the universally used structures for Maynard
+ Electronics.
+
+
+ $Log: G:/LOGFILES/STDSTRUC.H_V $
+ *
+ * Rev 1.0 09 May 1991 13:32:38 HUNTER
+ * Initial revision.
+
+**/
+#ifndef _STD_STRUCT_JUNK
+#define _STD_STRUCT_JUNK
+
+/* $end$ include list */
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/stdtypes.h b/private/utils/ntbackup/inc/stdtypes.h
new file mode 100644
index 000000000..2ccd9b284
--- /dev/null
+++ b/private/utils/ntbackup/inc/stdtypes.h
@@ -0,0 +1,351 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: stdtypes.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the standard type definitions.
+
+
+ $Log: P:/GUIWIN4/VCS/STDTYPES.H_V $
+ *
+ * Rev 1.1 09 Feb 1993 09:32:42 STEVEN
+ * fixed text macro it was defined twice
+ *
+ * Rev 1.0 28 Jan 1993 10:47:24 STEVEN
+ * Initial revision.
+ *
+/* $end$ include list */
+
+
+#ifndef STDTYPES
+#define STDTYPES
+
+#include <stddef.h> /* include the ANSI standard definition file */
+
+#ifdef FAR_POINTERS
+# define PTR_SIZE
+#endif
+
+#ifdef OS_WIN32
+
+# undef NEAR
+# undef FAR
+# define far
+# define near
+# define _near
+# define _far
+# define FAR
+# define NEAR
+
+# if defined(_MIPS_) || defined(_ALPHA_) || defined(_PPC_)
+# define UNALIGNED __unaligned
+# else
+# define UNALIGNED
+# endif
+
+#else
+
+# define UNALIGNED
+
+# ifndef FAR
+# define FAR far
+# endif
+
+# ifndef NEAR
+# define NEAR near
+# endif
+
+#endif
+
+#ifndef PASCAL
+# define PASCAL pascal
+#endif
+
+#ifndef CDECL
+# define CDECL cdecl
+#endif
+
+#ifndef APIENTRY
+# define APIENTRY FAR PASCAL
+#endif
+
+
+#ifndef PTR_SIZE
+#define PTR_SIZE
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Added LOCALFN to allow easy debugging of NT applications.
+ If a function is declared to be static the NT debugger doesn't
+ show local data. Oops.., Argh..., Braindeath is a terrible thing.
+ I typedef'd LOCALFN (yech!#$!) and then to compound the felony I
+ didn't test the "simple" change for the addition of LOCALFN.
+ Oh well, LABATYD. (BBB)
+*/
+
+#define LOCALFN static
+
+/* LOCALVAR is only to be used for module wide static variables.
+ It is NOT to be used for variables that are to be declared static
+ within a function. If you should use this for static vars within
+ a function the great Kahuna of bugs will descend upon on you
+ and cause much grief in your life.
+*/
+#define LOCALVAR static
+
+
+
+/** Begin ANSI/UNICODE support **/
+/*
+ UNICODE (wide character) types
+*/
+
+#define VOID void
+
+typedef VOID PTR_SIZE * VOID_PTR ;
+#define PVOID VOID_PTR
+typedef VOID ( PTR_SIZE *PF_VOID )() ;
+
+typedef char INT8 ;
+typedef char PTR_SIZE * INT8_PTR ;
+typedef INT8 ( PTR_SIZE *PF_INT8 )() ;
+typedef INT8_PTR ( PTR_SIZE *PF_INT8_PTR )() ;
+
+#define BYTE UINT8
+typedef unsigned char UINT8 ;
+typedef unsigned char PTR_SIZE * UINT8_PTR ;
+typedef UINT8 ( PTR_SIZE *PF_UINT8 )() ;
+typedef UINT8_PTR ( PTR_SIZE *PF_UINT8_PTR )() ;
+
+/* Added a generic INT type that eases porting to new platforms
+ This type should be used for all integers that do not require
+ a specific size. NOTE: The test for INT being defined was added
+ because of a conflict with os2def.h which already defines INT.
+*/
+#ifndef _WINDEF_
+typedef int INT ;
+#endif
+
+typedef int PTR_SIZE * INT_PTR ;
+typedef INT ( PTR_SIZE *PF_INT )() ;
+typedef INT_PTR ( PTR_SIZE *PF_INT_PTR )() ;
+
+#ifndef _WINDEF_
+typedef unsigned int UINT;
+#endif
+
+typedef unsigned int PTR_SIZE * UINT_PTR ;
+typedef UINT ( PTR_SIZE *PF_UINT )() ;
+typedef UINT_PTR ( PTR_SIZE *PF_UINT_PTR )() ;
+
+
+typedef short int INT16 ;
+#define SHORT INT16
+typedef short int PTR_SIZE * INT16_PTR ;
+typedef INT16 ( PTR_SIZE *PF_INT16 )() ;
+typedef INT16_PTR ( PTR_SIZE *PF_INT16_PTR )() ;
+#define PSHORT INT16_PTR
+#define NPSHORT INT16_PTR
+#define LPSHORT INT16_PTR
+
+typedef unsigned short UINT16 ;
+#define WORD UINT16
+#define USHORT UINT16
+typedef unsigned short PTR_SIZE * UINT16_PTR ;
+typedef UINT16 ( PTR_SIZE *PF_UINT16 )() ;
+typedef UINT16_PTR ( PTR_SIZE *PF_UINT16_PTR )() ;
+#define PUSHORT UINT16_PTR
+#define NPUSHORT UINT16_PTR
+#define LPUSHORT UINT16_PTR
+
+typedef long int INT32 ;
+typedef long int PTR_SIZE * INT32_PTR ;
+typedef INT32 ( PTR_SIZE *PF_INT32 )() ;
+typedef INT32_PTR ( PTR_SIZE *PF_INT32_PTR )() ;
+#define PLONG INT32_PTR
+#define NPLONG INT32_PTR
+#define LPLONG INT32_PTR
+
+typedef unsigned long UINT32 ;
+#define DWORD UINT32
+#define ULONG UINT32
+typedef unsigned long PTR_SIZE * UINT32_PTR ;
+typedef UINT32 ( PTR_SIZE *PF_UINT32 )() ;
+typedef UINT32_PTR ( PTR_SIZE *PF_UINT32_PTR )() ;
+#define PULONG UINT32_PTR
+#define NPULONG UINT32_PTR
+#define LPULONG UINT32_PTR
+
+typedef INT16 BOOLDUDE ;
+typedef INT16_PTR BOOLEAN_PTR ;
+typedef BOOLDUDE ( PTR_SIZE *PF_BOOLEAN )() ;
+typedef BOOLEAN_PTR ( PTR_SIZE *PF_BOOLEAN_PTR )() ;
+#define BOOLEAN BOOLDUDE
+#define BOOL int
+
+
+#ifndef LONG
+# define LONG INT32
+#endif
+
+
+#ifndef WNDPROC
+#define WNDPROC FARPROC
+#endif
+
+
+#define BYTE_PTR UINT8_PTR
+#define LPBYTE BYTE_PTR
+#define NPBYTE BYTE_PTR
+
+#define ACHAR BYTE
+#define ACH BYTE
+#define ACHAR_PTR BYTE_PTR
+#define PACH BYTE_PTR
+#define LPACH BYTE_PTR
+#define NPACH BYTE_PTR
+#define PACHAR BYTE_PTR
+#define LPACHAR BYTE_PTR
+#define NPACHAR BYTE_PTR
+#define PASTR BYTE_PTR
+#define LPASTR BYTE_PTR
+#define NPASTR BYTE_PTR
+
+
+#if defined ( OS_WIN32 )
+ typedef wchar_t * WCHAR_PTR;
+# define WCHAR wchar_t
+#else
+# define WCHAR UINT16
+# define WCHAR_PTR UINT16_PTR
+#endif
+
+
+#define WCH WCHAR
+#define PWCH WCHAR_PTR
+#define LPWCH WCHAR_PTR
+#define NPWCH WCHAR_PTR
+#define PWCHAR WCHAR_PTR
+#define LPWCHAR WCHAR_PTR
+#define NPWCHAR WCHAR_PTR
+#define PWSTR WCHAR_PTR
+#define LPWSTR WCHAR_PTR
+#define NPWSTR WCHAR_PTR
+
+
+
+#if defined( UNICODE )
+# if !defined( TEXT )
+# define TEXT(quote) L##quote
+# endif
+
+# define CHAR WCHAR
+# define CHAR_PTR WCHAR_PTR
+# define UCHAR UINT16
+# define UCHAR_PTR UINT16_PTR
+#else
+# if !defined( TEXT )
+# define TEXT(quote) quote
+# endif
+
+# define CHAR INT8
+# define CHAR_PTR INT8_PTR
+# define UCHAR UINT8
+# define UCHAR_PTR UINT8_PTR
+
+#endif
+
+#define CH CHAR
+#define PCHAR CHAR_PTR
+#define LPCHAR CHAR_PTR
+#define NPCHAR CHAR_PTR
+#define PCH CHAR_PTR
+#define LPCH CHAR_PTR
+#define NPCH CHAR_PTR
+
+#define TCH CHAR
+#define TCHAR CHAR
+#define PTCHAR CHAR_PTR
+#define LPTCHAR CHAR_PTR
+#define NPTCHAR CHAR_PTR
+#define PTCH CHAR_PTR
+#define LPTCH CHAR_PTR
+#define NPTCH CHAR_PTR
+
+#define PSTR CHAR_PTR
+#define LPSTR CHAR_PTR
+#define NPSTR CHAR_PTR
+
+#undef FALSE
+#define FALSE ((BOOLEAN)(0))
+#undef TRUE
+#define TRUE ((BOOLEAN)(!FALSE))
+
+#undef SUCCESS
+#define SUCCESS ((BOOLEAN)(0))
+#undef FAILURE
+#define FAILURE ((BOOLEAN)(!SUCCESS))
+
+
+
+/* Structure definition for unsigned 64 bit integers */
+typedef struct {
+ UINT32 lsw; /* Least significant 32 bits */
+ UINT32 msw; /* Most significnant 32 bits */
+} UINT64, *UINT64_PTR;
+
+
+#define BIT0 0x00000001L
+#define BIT1 0x00000002L
+#define BIT2 0x00000004L
+#define BIT3 0x00000008L
+#define BIT4 0x00000010L
+#define BIT5 0x00000020L
+#define BIT6 0x00000040L
+#define BIT7 0x00000080L
+#define BIT8 0x00000100L
+#define BIT9 0x00000200L
+#define BIT10 0x00000400L
+#define BIT11 0x00000800L
+#define BIT12 0x00001000L
+#define BIT13 0x00002000L
+#define BIT14 0x00004000L
+#define BIT15 0x00008000L
+#define BIT16 0x00010000L
+#define BIT17 0x00020000L
+#define BIT18 0x00040000L
+#define BIT19 0x00080000L
+#define BIT20 0x00100000L
+#define BIT21 0x00200000L
+#define BIT22 0x00400000L
+#define BIT23 0x00800000L
+#define BIT24 0x01000000L
+#define BIT25 0x02000000L
+#define BIT26 0x04000000L
+#define BIT27 0x08000000L
+#define BIT28 0x10000000L
+#define BIT29 0x20000000L
+#define BIT30 0x40000000L
+#define BIT31 0x80000000L
+
+UINT16 nothing( VOID ) ;
+
+#if !defined(_SIZE_T_DEFINED) && !defined(_SIZE_T_DEFINED_)
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#define _SIZE_T_DEFINED_
+#endif
+
+#ifndef NO_STD_HOOKS
+#include "stdhooks.h"
+#endif
+
+
+#endif /* STDTYPES */
+
diff --git a/private/utils/ntbackup/inc/stdwcs.h b/private/utils/ntbackup/inc/stdwcs.h
new file mode 100644
index 000000000..9101efde3
--- /dev/null
+++ b/private/utils/ntbackup/inc/stdwcs.h
@@ -0,0 +1,219 @@
+/** Copyright (C) Maynard Electronics, An Archive Company. 1992
+
+ Name: STDWCS.H
+
+ Description:
+
+ Contains header information for wide strings, unicode mapping,
+ unicode comparison and memory functions. The file
+ is divided into the sections as outline here.
+
+ MIKEP - note,
+ Wide string functions for using unicode strings under MSC 6.0
+ and not having a library to use. If you add a function, add
+ it to STDWCS.C, STDWCS.H, and MAPPINGS.H
+
+
+ $Log: M:/LOGFILES/STDWCS.H_V $
+
+ Rev 1.11 15 Jan 1994 19:15:12 BARRY
+Change memorycmp functions to take VOID_PTR args
+
+ Rev 1.10 18 Aug 1993 18:19:26 BARRY
+Added strcspn/wcscspn
+
+ Rev 1.9 12 Aug 1993 16:24:50 DON
+Put back DEBBIEs change in Rev 1.7 which got lost with STEVEs change in Rev 1.8
+
+ Rev 1.8 11 Aug 1993 18:01:20 STEVEN
+fix read of unicode tape with ansi app
+
+ Rev 1.6 25 Nov 1992 14:22:20 STEVEN
+
+
+ Rev 1.5 17 Nov 1992 22:30:56 DAVEV
+unicode fixes
+
+ Rev 1.4 12 Nov 1992 10:59:18 DAVEV
+comment out strlwr & strupr
+
+ Rev 1.3 11 Nov 1992 18:17:50 DAVEV
+UNICODE changes
+
+ Rev 1.2 17 Jul 1992 14:58:42 STEVEN
+fix NT bugs
+
+ Rev 1.0 10 Jun 1992 16:11:26 TIMN
+Initial Revision (UNICODE)
+
+
+
+**/
+
+#ifndef _stdwcs_h_
+#define _stdwcs_h_
+
+/* remap str functions to wide string functions */
+
+
+#if defined( UNICODE ) && !defined( NO_STRING_REMAPPING )
+
+# define strlen(x) wcslen( (x) )
+# define strcpy(x,y) wcscpy( (x), (y) )
+# define strncpy(x,y,z) wcsncpy( (x), (y), (z) )
+# define strcat(x,y) wcscat( (x), (y) )
+# define strncat(x,y,z) wcsncat( (x), (y), (z) )
+# define strcmp(x,y) wcscmp( (x), (y) )
+# define strncmp(x,y,z) wcsncmp( (x), (y), (z) )
+# define strrchr(x,y) wcsrchr( (x), (y) )
+# define strchr(x,y) wcschr( (x), (y) )
+# define strpbrk(x,y) wcspbrk( (x), (y) )
+# define strstr(x,y) wcsstr( (x), (y) )
+# define strcspn(x,y) wcscspn( (x), (y) )
+
+# define strtok(x,y) wcstok( (x), (y) )
+# define sscanf swscanf
+# define sprintf swprintf
+# define vsprintf vswprintf
+
+# define fprintf fwprintf
+# define vfprintf vfwprintf
+
+//# if !__STDC__
+# define _strrev(x) wcsrev( (x) )
+# define _stricmp(x,y) wcsicmp( (x), (y) )
+# define _strnicmp(x,y,z) wcsnicmp( (x), (y), (z) )
+# define _strlwr(x) wcslwr( (x) )
+# define _strupr(x) wcsupr( (x) )
+# define _strcmpi stricmp
+//# else
+# define strrev(x) wcsrev( (x) )
+# define stricmp(x,y) wcsicmp( (x), (y) )
+# define strnicmp(x,y,z) wcsnicmp( (x), (y), (z) )
+# define strlwr(x) wcslwr( (x) )
+# define strupr(x) wcsupr( (x) )
+# define strcmpi stricmp
+//# endif //__STDC__
+
+#endif //STRING REMAPPING
+
+
+/* Unicode string functions. */
+#if !defined( OS_WIN32 )
+
+INT wcslen( WCHAR_PTR s );
+WCHAR_PTR wcscpy( WCHAR_PTR s, WCHAR_PTR t );
+WCHAR_PTR wcsncpy( WCHAR_PTR s, WCHAR_PTR t, INT i );
+WCHAR_PTR wcscat( WCHAR_PTR s, WCHAR_PTR t );
+WCHAR_PTR wcsncat( WCHAR_PTR s, WCHAR_PTR t, INT i );
+INT wcscmp( WCHAR_PTR s, WCHAR_PTR t );
+INT wcsncmp( WCHAR_PTR s, WCHAR_PTR t, INT i );
+INT wcsicmp( WCHAR_PTR s, WCHAR_PTR t );
+INT wcsnicmp( WCHAR_PTR s, WCHAR_PTR t, INT i );
+WCHAR_PTR wcsrchr( WCHAR_PTR s, INT c );
+WCHAR_PTR wcschr( WCHAR_PTR s, INT c );
+WCHAR_PTR wcspbrk( WCHAR_PTR s, WCHAR_PTR t );
+WCHAR_PTR wcslwr( WCHAR_PTR s );
+WCHAR_PTR wcsupr( WCHAR_PTR s );
+WCHAR_PTR wcsstr( WCHAR_PTR s, WCHAR_PTR t );
+size_t wcscspn( WCHAR_PTR s, WCHAR_PTR t );
+
+
+#endif
+
+/* ANSI Strings for use if UNICODE is defined. */
+
+#if defined (UNICODE)
+
+INT strlenA( ACHAR_PTR s );
+ACHAR_PTR strcpyA( ACHAR_PTR s, ACHAR_PTR t );
+ACHAR_PTR strncpyA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+ACHAR_PTR strcatA( ACHAR_PTR s, ACHAR_PTR t );
+ACHAR_PTR strncatA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+INT strcmpA( ACHAR_PTR s, ACHAR_PTR t );
+INT strncmpA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+INT stricmpA( ACHAR_PTR s, ACHAR_PTR t );
+INT strnicmpA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+ACHAR_PTR strrchrA( ACHAR_PTR s, INT c );
+ACHAR_PTR strchrA( ACHAR_PTR s, INT c );
+ACHAR_PTR strpbrkA( ACHAR_PTR s, ACHAR_PTR t );
+//ACHAR_PTR strlwrA( ACHAR_PTR s );
+//ACHAR_PTR struprA( ACHAR_PTR s );
+ACHAR_PTR strstrA( ACHAR_PTR s, ACHAR_PTR t );
+
+#else // !defined (UNICODE) -- map to standard string routines
+
+#define strlenA strlen
+#define strcpyA strcpy
+#define strncpyA strncpy
+#define strcatA strcat
+#define strncatA strncat
+#define strcmpA strcmp
+#define strncmpA strncmp
+#define stricmpA stricmp
+#define strnicmpA strnicmp
+#define strrchrA strrchr
+#define strchrA strchr
+#define strpbrkA strpbrk
+//#define strlwrA strlwr
+//#define struprA strupr
+#define strstrA strstr
+
+#endif //defined(UNICODE)
+
+/**
+ begin unicode mapping stuff *****
+**/
+
+
+/* mapping function error return values */
+
+#define MAP_NULL_SRCSTR 1 /* NULL src string to map */
+#define MAP_DST_OVERFLOW -1 /* to small of a destination size */
+
+INT mapAnsiToUnic( ACHAR_PTR src, WCHAR_PTR dst, INT *dstStrSize ) ;
+INT mapUnicToAnsi( WCHAR_PTR src, ACHAR_PTR dst, const ACHAR rplCh, INT *dstStrSize ) ;
+INT mapAnsiToUnicNoNull( ACHAR_PTR src, WCHAR_PTR dst, INT srcStrSize, INT *dstStrSize ) ;
+INT mapUnicToAnsiNoNull( WCHAR_PTR src, ACHAR_PTR dst, const ACHAR rplCh, INT srcStrSize, INT *dstStrSize ) ;
+
+
+
+
+/**
+ begin unicode comparison stuff *****
+**/
+
+#define CMP_TO_CASE_OFFSET 0x0020 /* case offset to ANSI mappable chars */
+
+
+ /* upper case ANSI mappable characters */
+#define _isUpperW(ch) ( \
+ (( (ch) > 0x0040 ) && ( (ch) < 0x005B )) || (( (ch) > 0x00C3 ) && ( (ch) < 0x00C8 )) || \
+ ( (ch) == 0x00C9 ) || ( (ch) == 0x00D1 ) || ( (ch) == 0x00D6 ) || \
+ ( (ch) == 0x00DC ) || ( (ch) == 0x0393 ) || ( (ch) == 0x0398 ) || \
+ ( (ch) == 0x03A3 ) || ( (ch) == 0x03A6 ) || ( (ch) == 0x03A9 ) )
+
+ /* lower case ANSI mappable characters */
+#define _isLowerW(ch) ( \
+ (( (ch) > 0x0060 ) && ( (ch) < 0x007B )) || (( (ch) > 0x00E3 ) && ( (ch) < 0x00E8 )) || \
+ ( (ch) == 0x00E9 ) || ( (ch) == 0x00F1 ) || ( (ch) == 0x00F6 ) || \
+ ( (ch) == 0x00FC ) || ( (ch) == 0x03B3 ) || ( (ch) == 0x03B8 ) || \
+ ( (ch) == 0x03C3 ) || ( (ch) == 0x03C6 ) || ( (ch) == 0x03C9 ) )
+
+#define _toUpperW(ch) ( _isLowerW(ch) ? ((ch) - CMP_TO_CASE_OFFSET) : (ch) )
+#define _toLowerW(ch) ( _isUpperW(ch) ? ((ch) + CMP_TO_CASE_OFFSET) : (ch) )
+
+INT cmpiUnicToUnic( WCHAR_PTR ws1, WCHAR_PTR ws2 ) ;
+
+
+
+
+/**
+ begin memory stuff *****
+**/
+
+INT memorycmp( const VOID_PTR s1, const INT s1len, const VOID_PTR s2, const INT s2len ) ;
+INT memoryicmp( const VOID_PTR s1, const INT s1len, const VOID_PTR s2, const INT s2len ) ;
+#define strsize( x ) ((strlen(x) + 1) * sizeof(CHAR))
+#define strlength( x ) (strlen(x) * sizeof(CHAR))
+#endif /* end header file */
diff --git a/private/utils/ntbackup/inc/sx.h b/private/utils/ntbackup/inc/sx.h
new file mode 100644
index 000000000..ce7b92dae
--- /dev/null
+++ b/private/utils/ntbackup/inc/sx.h
@@ -0,0 +1,230 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+ Name: sx.h
+
+ Date Updated:
+
+ Description: Contains the constants, typedefs, structures and entry points to functions
+ specific to the EXABYTE 8200SX - MaynStream 2200+
+
+
+ $Log: Q:/LOGFILES/SX.H_V $
+
+ Rev 1.4 17 Nov 1992 22:30:52 DAVEV
+unicode fixes
+
+ Rev 1.3 11 Nov 1992 18:17:54 DAVEV
+UNICODE changes
+
+ Rev 1.2 17 Aug 1992 09:09:10 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.1 23 Apr 1992 08:09:02 IAN
+Changed prototype for SX_FindBlock() to match changes made in sx.c by NED.
+
+ Rev 1.0 30 Sep 1991 11:03:28 HUNTER
+Initial revision.
+
+**/
+
+#ifndef _SX_H
+#define _SX_H
+
+#include <fcntl.h>
+#include <sys\types.h>
+#include <sys\stat.h>
+//#include <io.h>
+
+#include "tbe_defs.h"
+#include "sxtf.h"
+#include "channel.h"
+
+
+/*
+ * CONSTANTS
+ */
+
+#define SX_TMP_FILE ( 0 )
+#define SX_FILE ( 1 )
+
+#define SX_FINDING_SET ( 0 )
+#define SX_CHECKING_FOR_SET ( 1 )
+
+#define SX_TMP_FILE_NAME TEXT ("_PLUS_._")
+
+#define SX_WRITE_FLAG ( O_CREAT | O_RDWR | O_BINARY )
+#define SX_WRITE_PMODE ( S_IREAD | S_IWRITE )
+
+#define SX_READ_FLAG ( O_RDONLY | O_BINARY )
+#define SX_READ_PMODE ( S_IREAD )
+
+#define SX_TMP_FLAG ( O_TRUNC | SX_WRITE_FLAG )
+#define SX_TMP_PMODE ( SX_WRITE_PMODE )
+
+#define SX_SAMPLE_RATE ( 0x2000 ) /* 1 MByte == 0x800 */
+#define SX_NEARBY ( 0x2000 ) /* 1 MByte == 0x800 */
+#define SX_DO_NOT_MOVE ( 0 )
+#define SX_INITIALIZER ( -1 )
+#define SX_FIRST_LBA ( 0L )
+#define SX_LAST_LBA ( 0xffffffff )
+
+/*
+ * FUNCTION PROTOTYPES
+ */
+
+VOID SX_Begin( /* called by: TFOPEN TF_OpenSet() */
+ CHANNEL_PTR channel,
+ UINT16 tf_mode
+) ;
+
+VOID SX_End( /* called by: TFCLOSE TF_CloseSet() */
+ CHANNEL_PTR channel
+) ;
+
+BOOLEAN SX_OpenFile( /* called by: POSATSET PositionAtSet() */
+ CHANNEL_PTR channel, /* READ StartRead() */
+ UINT32 tape_id,
+ UINT16 ts_num
+) ;
+
+BOOLEAN SX_CloseFile( /* called by: POSATSET PositionAtSet() */
+ CHANNEL_PTR channel /* READ StartRead() */
+) ; /* SX SX_OpenFile() */
+ /* SX SX_End() */
+ /* SX SX_EndSampling() */
+
+INT16 SX_DeleteFile( /* called by: POSATSET PositionAtSet() */
+ UINT32 tape_id, /* TFERASE TF_EraseChannel() */
+ UINT16 ts_num
+) ;
+
+BOOLEAN SX_WriteTmpFile( /* called by: READ AcquireReadBuffer() */
+ CHANNEL_PTR channel /* READ CleanUpDriverQ() */
+) ; /* WRITE AcquireWriteBuffer() */
+ /* WRITE FinishWrite() */
+ /* SX SX_ShowBlock() */
+ /* SX SX_StartSampling() */
+
+BOOLEAN SX_SeekSetInFile( /* called by: POSATSET PositionAtSet() */
+ CHANNEL_PTR channel, /* READ StartRead() */
+ INT16 set,
+ INT16 mode
+) ;
+
+INT16 SX_FindBlock( /* called by: READ StartRead() */
+ CHANNEL_PTR channel, /* READ DoRead() */
+ UINT32 lba,
+ TPOS_PTR ui_tpos,
+ INT16 tf_message
+) ;
+
+INT16 SX_ShowBlock( /* called by: DRIVES ReadNextSet() */
+ CHANNEL_PTR channel, /* SX SX_SamplingProcessing() */
+ UINT16 mode /* SX SX_EndSampling() */
+) ;
+
+VOID SX_StartSampling( /* called by: READ StartRead() */
+ CHANNEL_PTR channel /* WRITE WriteDBLK() */
+) ; /* WRITE EOM_Write() */
+
+VOID SX_SamplingProcessing( /* called by: READ ReadRequest() */
+ CHANNEL_PTR channel, /* WRITE WriteRequest() */
+ UINT32 bytes
+) ;
+
+VOID SX_EndSampling( /* called by: READ AcquireReadBuffer() */
+ CHANNEL_PTR channel /* WRITE FinishWrite() */
+) ; /* WRITE EOMWrite() */
+
+#ifdef SX_DEBUG
+VOID SX_InfoDump(
+ CHANNEL_PTR channel,
+ CHAR_PTR message
+) ;
+#endif
+
+/*
+ * STATUS BITS -
+ */
+
+#define SX_OPEN_FOR_READ ( 0x0001 ) /* open for read */
+#define SX_OPEN_FOR_WRITE ( 0x0002 ) /* open for write */
+#define SX_TMP_OPEN_FOR_WRITE ( 0x0004 ) /* tmp open for write */
+#define SX_OPEN ( 0x0007 ) /* open mask */
+#define SX_AT_BOF ( 0x0010 ) /* at beginning of file */
+#define SX_AT_EOF ( 0x0020 ) /* at end of file */
+#define SX_AT_SET ( 0x0040 ) /* at the first record in a set */
+#define SX_AT ( 0x0070 ) /* at mask */
+#define SX_VCB_PENDING ( 0x0100 ) /* could be at BOT, VCB etc */
+#define SX_VCB_CONFIRMED ( 0x0200 ) /* at VCB */
+#define SX_TYPE ( 0x0300 ) /* type mask */
+#define SX_FOUND_BLOCK ( 0x0400 ) /* found block */
+#define SX_SCAN_ACTIVE ( 0x1000 ) /* scanning tape for positioning info */
+#define SX_SCAN_INOPERATIVE ( 0x2000 ) /* not scanning tape for positioning info */
+#define SX_SCAN ( 0x3000 ) /* scanning tape mask */
+#define SX_LIST_TAPE_IN_PROGRESS ( 0x4000 ) /* doing a list tape operation */
+#define SX_ERROR ( 0x8000 ) /* something's wrong */
+#define SX_STATUS ( 0xffff ) /* status mask */
+
+/*
+ * SHOW BLOCK MODES
+ */
+
+#define SX_SHOW_QUEUED ( 0x0001 ) /* call to TpReceive will be made elsewhere */
+#define SX_SHOW_IMMEDIATE ( 0x0002 ) /* call to TpReceive should follow immediately */
+#define SX_SHOW_WRITE ( 0x0004 ) /* update the SX tmp file now */
+#define SX_SHOW_VCB_PENDING ( 0x0008 ) /* we think this could be a VCB */
+
+/*
+ * STATUS MACROS
+ */
+
+#define SX_SetStatus( c, x ) ( ( c )->sx_info.status |= ( x ) )
+#define SX_ClearStatus( c, x ) ( ( c )->sx_info.status &= ~( x ) )
+#define SX_IsStatusSet( c, x ) ( ( c )->sx_info.status & ( x ) )
+
+#define SX_ClearAt( c ) SX_ClearStatus( ( c ), SX_AT )
+#define SX_SetAt( c, x ) SX_ClearAt( ( c ) ) ; SX_SetStatus( ( c ), x )
+#define SX_ClearType( c ) SX_ClearStatus( ( c ), SX_TYPE )
+#define SX_SetType( c, x ) SX_ClearType( ( c ) ) ; SX_SetStatus( ( c ), x )
+
+/*
+ * FUNCTION MACROS
+ */
+
+#define SX_Drive( c ) ( ( CurDrvAttribs( ( c ) ) & TDI_SHOW_BLK ) || ( CurDrvAttribs( ( c ) ) & TDI_FIND_BLK ) )
+#define SX_IsOK( c ) SX_Drive( ( c ) ) && !( SX_IsStatusSet( ( c ), SX_ERROR ) )
+#define SX_FileIsOpen( c ) ( SX_IsStatusSet( ( c ), SX_OPEN_FOR_READ | SX_OPEN_FOR_WRITE ) )
+#define SX_TmpFileIsOpen( c ) ( SX_IsStatusSet( ( c ), SX_TMP_OPEN_FOR_WRITE ) )
+#define SX_FileIsOK( c ) ( SX_FileIsOpen( ( c ) ) && SX_IsOK( ( c ) ) )
+#define SX_TmpFileIsOK( c ) ( SX_TmpFileIsOpen( ( c ) ) && SX_IsOK( ( c ) ) )
+#define SX_AbleToFindBlock( c ) SX_FileIsOK( ( c ) ) && SX_IsStatusSet( ( c ), SX_AT_SET )
+#define SX_IsNotAlreadyAtLBA( c, x ) ( ( ( x ) - SX_GetLBANow( ( c ) ) ) != 0 )
+#define SX_IsNearbyLBA( c, x ) ( SX_IsStatusSet( channel, SX_FOUND_BLOCK ) && ( ( ( x ) - SX_GetLBANow( ( c ) ) ) < SX_NEARBY ) )
+
+#define SX_GetBackupSetNumber( c ) ( c )->sx_info.sx_record.set
+#define SX_SetBackupSetNumber( c ) SX_GetBackupSetNumber( ( c ) ) = ( c )->bs_num
+#define SX_GetRecord( c ) ( c )->sx_info.sx_record
+#define SX_SetRecord( c, x ) SX_GetRecord( ( c ) ) = ( x )
+#define SX_GetPosition( c ) ( c )->sx_info.sx_record.sx_position
+#define SX_FileHandle( c ) ( c )->sx_info.sx_hdl
+#define SX_TmpFileHandle( c ) ( c )->sx_info.sx_tmp
+#define SX_GetLBANow( c ) ( c )->sx_info.lba_now
+#define SX_SetLBANow( c, x ) SX_GetLBANow( ( c ) ) = ( UINT32 )( x )
+#define SX_AdjustLBANow( c, x ) SX_GetLBANow( ( c ) ) += ( UINT32 )( ( x ) / c->lb_size )
+#define SX_GetLBA( c ) ( c )->sx_info.sx_record.lba
+#define SX_SetLBA( c ) SX_GetLBA( ( c ) ) = SX_GetLBANow( ( c ) )
+#define SX_GetMisc( c ) ( c )->sx_info.misc
+#define SX_SetMisc( c, x ) SX_GetMisc( ( c ) ) = ( UINT32 )( x )
+#define SX_SampleNeeded( c ) SX_TmpFileIsOK( ( c ) ) && ( SX_GetLBANow( ( c ) ) >= SX_GetMisc( c ) )
+#define SX_NextSample( c ) SX_GetMisc( c ) += SX_SAMPLE_RATE
+#define SX_OffsetFile( c ) SX_SeekFile( ( c ), SX_GetMisc( c ), SEEK_SET, SX_FILE )
+
+#if defined( MAYN_OS2 )
+#define SX_GetLock( c ) ( c )->sx_info.lock
+#endif
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/sxdd.h b/private/utils/ntbackup/inc/sxdd.h
new file mode 100644
index 000000000..d6a1160b7
--- /dev/null
+++ b/private/utils/ntbackup/inc/sxdd.h
@@ -0,0 +1,39 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+ Name: sxdd.h
+
+ Description: Structures and constants unique to the EXABYTE 8200SX - MaynStream 2200+ at the device driver level
+
+ $Log: Q:/LOGFILES/SXDD.H_V $
+
+ Rev 1.0 17 Jul 1991 15:35:12 ED
+Initial revision.
+**/
+
+#ifndef _SXDD_H
+#define _SXDD_H
+
+
+/*
+ * TYPEDEFS & STRUCTURES
+ */
+
+typedef struct {
+
+ UINT8 data[ 10 ] ; /* we never look into this data so it is not broken down
+ into any component fields such as tach count, pba, lba etc ...
+ Essentially, this is a 10 byte "block address" */
+} SX_POSITION, *SX_POSITION_PTR ;
+
+typedef struct {
+
+ SX_POSITION sx_position ; /* set by SHOW BLOCK & used by FIND BLOCK */
+ UINT32 lba ; /* related "block address" in application software */
+ INT16 set ; /* set number in application software */
+
+} SX_RECORD, *SX_RECORD_PTR ; /* record format of the SX file */
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/sxtf.h b/private/utils/ntbackup/inc/sxtf.h
new file mode 100644
index 000000000..e7979295f
--- /dev/null
+++ b/private/utils/ntbackup/inc/sxtf.h
@@ -0,0 +1,63 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\sxtf.h
+subsystem\TAPE FORMAT\sxtf.h
+$0$
+
+ Name: sxtf.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the typedefs and structures specific to the EXABYTE 8200SX - MaynStream 2200+ for
+ Tape Format
+
+$Header: N:/LOGFILES/SXTF.H_V 1.2 20 Jan 1992 18:57:28 GREGG $
+
+$Log: N:/LOGFILES/SXTF.H_V $
+
+ Rev 1.2 20 Jan 1992 18:57:28 GREGG
+Changed INT16 file handles to int (Watcom strikes again!)
+
+ Rev 1.1 17 Oct 1991 01:08:44 GREGG
+Added cat_enabled to SX_INFO.
+
+ Rev 1.0 10 Oct 1991 08:55:10 GREGG
+Initial revision.
+
+$-1$
+**/
+
+#ifndef _SXTF_H
+#define _SXTF_H
+
+#include "sxdd.h"
+/* $end$ include list */
+
+/*
+ * TYPEDEFS & STRUCTURES
+ */
+
+typedef struct {
+
+ SX_RECORD sx_record ; /* record read/written to/from SX file */
+ int sx_hdl ; /* file handle of SX file opened for read/write */
+ int sx_tmp ; /* file handle of temp file opened for write */
+ UINT32 misc ; /* next sample for SHOW when writing SX file and
+ and desired "block address" for FIND during searches */
+ UINT32 lba_now ; /* running lba for next call of SX_SamplingProcessing */
+ UINT16 status ; /* indicates various things */
+ BOOLEAN cat_enabled ; /* true if catalog level is full or partial */
+
+#if defined( MAYN_OS2 )
+ UINT32 lock ; /* lock for device driver access */
+#endif
+
+} SX_INFO, *SX_INFO_PTR ;
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/sypl10.h b/private/utils/ntbackup/inc/sypl10.h
new file mode 100644
index 000000000..c7fc5e649
--- /dev/null
+++ b/private/utils/ntbackup/inc/sypl10.h
@@ -0,0 +1,248 @@
+/**
+Copyright(c) Archive Software Division 1984-89
+
+
+ Name: sypl10.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Defines the environment structures for the Sytos Plus Format
+
+ $Log: T:\logfiles\sypl10.h_v $
+
+ Rev 1.10 16 Jan 1994 14:32:04 GREGG
+Unicode bug fixes.
+
+ Rev 1.9 22 Nov 1993 18:09:10 BARRY
+Unicode fixes; got rid of tabs
+
+ Rev 1.8 15 Jul 1993 14:21:10 STEVEN
+fix volume header
+
+ Rev 1.6 19 May 1993 13:13:52 TerriLynn
+Steve got the correct location of the ECC flag
+
+ Rev 1.5 11 May 1993 21:55:30 GREGG
+Moved Sytos translator stuff from layer-wide area to translator.
+
+ Rev 1.4 10 May 1993 15:12:56 Terri_Lynn
+Added Steve's changes and My changes for EOM processing
+
+ Rev 1.3 03 May 1993 16:22:10 TERRI
+General clean up
+Moved pragma pack statement to shorten effect
+
+ Rev 1.2 26 Apr 1993 11:30:22 GREGG
+Sixth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Redefined attribute bits to match the spec.
+ - Eliminated unused/undocumented bits.
+ - Added code to translate bits on tapes that were written wrong.
+
+Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+
+ Rev 1.1 17 Mar 1993 14:28:32 TERRI
+Initial CAYMAN beta release
+**
+*/
+
+#if !defined SYPL10_H
+#define SYPL10_H
+
+#include "fsstream.h"
+#include "osinfo.h"
+
+#define UNQ_HDR_ID_LEN 9
+#define MAX_ACL_INFO_LEN 0x980
+#define MAX_EA_DATA_LEN 0x10000
+#define SHORT_NAME_LEN 20
+#define LONG_NAME_LEN 261
+#define DESCRPT_LEN 256
+
+#define FAT_FILE_SYSTEM 0xa000
+#define PWD_CRYPT_CHAR 0x0069 /* password encryption character */
+
+#define DRIVEROOT_TYPE 0x003c /* set in drive indicator for drive/root */
+#define DIRECTORY_TYPE 0x0041 /* set in drive indicator for directory */
+
+#define SYPL_MAX_STREAMS 4
+
+#define S10_UNIQ_ID { 0xa2, 0x2a, 0x2a, 0xa2, 0xa2, 0x2a, 0x2a, 0xa2, 0x00 }
+
+typedef struct sypl_vcb SYPL_VCB, *SYPL_VCB_PTR ;
+
+
+struct sypl_vcb {
+ UINT16 bset_num ;
+ DATE_TIME backup_date_time ; /* from first block */
+ ACHAR drive[4] ;
+ UINT32 attrib ;
+} ;
+
+typedef struct sypl_env {
+ UINT8 volname[SHORT_NAME_LEN+1]; /* null terminated */
+ UINT8 password[SHORT_NAME_LEN+1] ; /* tape password null terminated */
+ UINT32 family_id ; /* from tape header UINT32 date */
+ UINT16 tape_seq_num ; /* sequence number */
+ DATE_TIME tape_date ; /* tape creation date */
+ INT8 tape_descrpt[DESCRPT_LEN+1] ; /* tape description */
+ INT8 bset_name[SHORT_NAME_LEN+1] ; /* backup set name */
+ INT8 bset_descrpt[DESCRPT_LEN+1] ; /* backup set description */
+ DATE_TIME bset_date ; /* backup set date */
+ UINT16 dir_attribs ; /* directory attributes */
+ DATE_TIME dir_date ; /* directory date */
+ UINT16 path_len ; /* length of path */
+ INT8 path_name[LONG_NAME_LEN+1] ; /* path name */
+ UINT16 file_attribs ; /* file attributes */
+ UINT32 file_size ; /* size of file */
+ UINT16 file_name_len ; /* length of file name */
+ INT8 file_name[LONG_NAME_LEN+1] ; /* file name */
+ DATE_TIME file_create_date ; /* file creation date */
+ DATE_TIME last_access_date ; /* file last access date */
+ DATE_TIME last_modified_date ; /* file last modified date */
+ SYPL_VCB current_vcb ; /* current vcb */
+ UINT16 block_size ; /* block size */
+ BOOLEAN bytes_left ; /* of header or ECC */
+ UINT32 prior_blocks_used ; /* copied from CHANNEL::blocks_used */
+ BOOLEAN continuing; /* TRUE if continuing */
+ UINT16 destination_tape_seq_num; /* sequence number */
+ BOOLEAN using_ecc ; /* TRUE if current tape has ECC */
+ BOOLEAN in_ecc ; /* TRUE if still processing ECC */
+ BOOLEAN processed_ddb ; /* TRUE if the drive root directory header has been processed */
+ UINT16 no_streams ; /* number of streams */
+ UINT16 currentStream ; /* current stream */
+ STREAM_INFO streams[SYPL_MAX_STREAMS] ; /* array of streams for this block type */
+ UINT32 pad_size ; /* pad */
+ BOOLEAN streamMode ; /* yeah or nay */
+ INT32 next_retrans_size ;
+} S10_ENV, *S10_ENV_PTR ;
+
+typedef enum s10_header_types {
+ tape_header_type = 0x00,
+ file_header_type = 0x02,
+ ecc_header_type = 0x04,
+ backup_set_header_type = 0x05,
+ unknown_header_type = 0x08,
+ directory_header_type = 0x15,
+} s10_header_types ;
+
+#pragma pack(1)
+
+typedef struct hdr_common {
+ UINT16 drive_indicator; /* 0 drive or sub directory indicated */
+ UINT8 uniq_tape_id[UNQ_HDR_ID_LEN]; /* 2 unique header id defined above */
+ UINT8 type; /* 10 type of header */
+} S10_COMMON_HEADER, *S10_COMMON_HEADER_PTR ;
+
+typedef struct tape_header_ts {
+ S10_COMMON_HEADER common; /* 0 common to all headers */
+ INT8 tape_name[SHORT_NAME_LEN]; /* 12 null terminated */
+ INT8 tape_descrpt[DESCRPT_LEN]; /* 32 tape description */
+ INT8 password[SHORT_NAME_LEN]; /* 288 tape password */
+ UINT32 tape_date; /* 308 date of tape creation */
+ UINT16 tape_seq_num; /* 312 Tape number 1 based */
+ UINT16 exp_date ;
+ UINT16 MaVevnum ;
+ UINT16 MiVevnum ;
+ UINT16 qfa_flag; /* 322 Quick File Access */
+ UINT16 ecc_flag; /* 323 if 1 HARDWARE ECC present, 0 otherwise */
+ UINT8 unkown2[186]; /* 323 unkown */
+} S10_TAPE_HEADER, *S10_TAPE_HEADER_PTR ;
+
+typedef struct unknown_header_u {
+ S10_COMMON_HEADER common; /* 0 common to all headers */
+ UINT8 unknown[500]; /* 12 usually zeros or junk */
+} S10_UNKOWN_HEADER, *S10_UNKOWN_HEADER_PTR ;
+
+typedef struct backup_set_header_b {
+ S10_COMMON_HEADER common; /* 0 common to all headers */
+ UINT16 end_of_backup; /* 12 if 1 this is end of set 0 for start */
+ INT8 bset_name[SHORT_NAME_LEN]; /* 14 backup set name */
+ INT8 bset_descrpt[DESCRPT_LEN]; /* 34 backup set description */
+ UINT32 bset_date; /* 290 backup set date */
+ UINT8 unkown1[2]; /* 294 unkown */
+ UINT8 compression; /* 296 1=compressed, 0=no compression */
+ UINT8 unkown[31]; /* 297 unknown */
+ UINT8 eom_identifier[16]; /* 328 EOM identifier */
+ UINT8 unkown2[168]; /* 344 unkown */
+} S10_BACKUP_SET_HEADER, *S10_BACKUP_SET_HEADER_PTR ;
+
+typedef struct directory_header_d {
+ S10_COMMON_HEADER common; /* 0 common to all headers */
+ UINT16 dir_attribs; /* 12 attributes of the directory */
+ UINT8 unkown1[6]; /* 14 unkown */
+ UINT32 dir_date; /* 20 41 = date of sub directory; 3C = backup date */
+ UINT8 unkown2[2]; /* 24 unkown */
+ UINT16 ea_data_len; /* 26 length of extended attrib data */
+ UINT8 unkown3[4]; /* 28 unkown */
+ INT16 acl_info_len; /* 32 length of acl info */
+ UINT8 unkown4[22]; /* 34 unkown */
+ UINT16 path_len; /* 56 length of path */
+ INT8 path_name[261]; /* 58 path name */
+ UINT8 unkown5[193]; /* 319 unkown */
+} S10_DIRECTORY_HEADER, *S10_DIRECTORY_HEADER_PTR ;
+
+typedef struct file_header_f {
+ S10_COMMON_HEADER common; /* 0 common to all headers */
+ UINT16 file_attribs; /* 12 attributes of the file */
+ UINT8 unkown[2]; /* 14 unkown */
+ UINT16 ea_data_len; /* 16 length of ea data */
+ UINT8 unkown1[4]; /* 18 unkown */
+ UINT32 file_size; /* 22 size of file */
+ UINT8 unkown2[12]; /* 26 unkown */
+ UINT32 file_create_date; /* 38 file creation date - HPFS */
+ UINT32 last_access_date; /* 42 last access date - HPFS */
+ UINT32 last_modified_date; /* 46 last modified date - HPFS */
+ UINT32 file_last_access; /* 50 same as file_last access - HPFS */
+ UINT8 unkown3[6]; /* 54 unkown */
+ INT16 acl_info_len; /* 60 length of ACL info */
+ UINT8 unkown4[24]; /* 62 unkown */
+ UINT16 filename_len; /* 86 length of file name */
+ INT8 filename[261]; /* 88 path and file name */
+ UINT8 unkown5[163]; /* 349 unkown */
+} S10_FILE_HEADER, *S10_FILE_HEADER_PTR ;
+
+typedef struct ecc_header_e {
+ S10_COMMON_HEADER common; /* 0 common to all headers */
+ UINT8 unkown1[500]; /* 12 unkown */
+} S10_ECC_HEADER, *S10_ECC_HEADER_PTR;
+
+typedef struct acl_info_a {
+ UINT8 far *resource_name; /* 0 not used contains garbarge */
+ UINT16 audit_attribs; /* 1 audit attributes none if 0 */
+ UINT16 num_of_structs; /* 3 count of acl info structs to follow */
+} S10_ACL_INFO, *S10_ACL_INFO_PTR;
+
+typedef struct acl_data_a {
+ INT8 usergrp_name[22]; /* User or Group name, null terminated */
+ UINT16 access_rights; /* bits that define the user/goup access rights */
+} S10_ACL_DATA, *S10_ACL_DATA_PTR;
+
+typedef struct os2_dir_info_m {
+ OS2_DIR_OS_INFO os2_dir_info ; /* Inorder to handoff the dir name */
+ INT8 string[261] ; /* as well as the ea, or acl info */
+} OS2_DIR_INFO, *OS2_DIR_INFO_PTR ; /* to the file system */
+
+typedef struct os2_file_info_m {
+ OS2_FILE_OS_INFO os2_file_info ; /* Inorder to handoff the file name */
+ INT8 string[261] ; /* as well as the ea, acl and data */
+} OS2_FILE_INFO, *OS2_FILE_INFO_PTR ; /* info to the file system */
+
+typedef struct date_field_d {
+ unsigned day : 5 ; /* Extracts the correct number of */
+ unsigned month : 4 ; /* bits for the "Motorola" type */
+ unsigned year : 7 ; /* DOS date/time */
+} S10_DATE_FIELD, *S10_DATE_FIELD_PTR ;
+
+typedef struct time_field_t {
+ unsigned second : 5 ; /* Extracts the correct number of */
+ unsigned minute : 6 ; /* bits for the "Motorola" type */
+ unsigned hour : 5 ; /* DOS date/time */
+} S10_TIME_FIELD, *S10_TIME_FIELD_PTR ;
+
+#pragma pack()
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/syplpto.h b/private/utils/ntbackup/inc/syplpto.h
new file mode 100644
index 000000000..ae44fb592
--- /dev/null
+++ b/private/utils/ntbackup/inc/syplpto.h
@@ -0,0 +1,37 @@
+/**
+Copyright(c) Archive Software Division 1984-89
+
+
+ Name: syplpto.h
+
+ Description: Prototypes for Sytos Plus' Translator Entry Points
+
+ $Log: T:/LOGFILES/SYPLPTO.H_V $
+
+ Rev 1.2 16 Feb 1994 19:16:56 GREGG
+Changed prototypes to match translator function table.
+
+ Rev 1.1 17 Mar 1993 14:28:42 TERRI
+Initial CAYMAN beta release
+**
+*/
+#if !defined SYPLPTO_H
+#define SYPLPTO_H
+
+BOOLEAN SYPL_DetermineFormat( VOID_PTR ) ;
+INT16 SYPL_Initialize( CHANNEL_PTR ) ;
+VOID SYPL_DeInitialize( VOID_PTR * ) ;
+INT16 SYPL_Parse( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+UINT16 SYPL_RdException( CHANNEL_PTR, INT16 ) ;
+INT16 SYPL_NewTape( CHANNEL_PTR, BUF_PTR, BOOLEAN_PTR ) ;
+INT16 SYPL_MoveToVCB( CHANNEL_PTR, INT16, BOOLEAN_PTR, BOOLEAN ) ;
+INT16 SYPL_GetCurrentVCB( CHANNEL_PTR, BUF_PTR ) ;
+BOOLEAN SYPL_ReTranslate( CHANNEL_PTR, BUF_PTR ) ;
+INT16 SYPL_ReadMakeDDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 SYPL_ReadMakeFDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 SYPL_ReadMakeUDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 SYPL_ReadMakeMDB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 SYPL_ReadMakeStreams( CHANNEL_PTR, BUF_PTR ) ;
+
+#endif /* SYPLPTO_H */
+
diff --git a/private/utils/ntbackup/inc/tape.h b/private/utils/ntbackup/inc/tape.h
new file mode 100644
index 000000000..559b2ea76
--- /dev/null
+++ b/private/utils/ntbackup/inc/tape.h
@@ -0,0 +1,107 @@
+
+
+/************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: tape.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the tape operation code.
+
+ $Log: G:/UI/LOGFILES/TAPE.H_V $
+
+ Rev 1.5 08 Jun 1993 11:10:44 CARLS
+added prototype for IsTransferTape
+
+ Rev 1.4 08 Apr 1993 17:32:44 chrish
+Added function prototype WhoPasswordedTape.
+
+ Rev 1.3 22 Mar 1993 13:43:26 chrish
+Added prototype for catalog password check.
+
+ Rev 1.2 15 Dec 1992 11:24:24 chrish
+Modified IsUserValid prototype.
+
+ Rev 1.1 13 Nov 1992 17:42:04 chrish
+Added prototype for function used in Tape Securit for NT.
+
+ Rev 1.0 20 Oct 1992 17:01:48 MIKEP
+Initial revision.
+
+
+
+**************************/
+
+#ifndef TAPE_H
+#define TAPE_H
+
+// defines for gbCurrentOperation
+
+#define OPERATION_NONE 0
+#define OPERATION_BACKUP 1
+#define OPERATION_RESTORE 2
+#define OPERATION_VERIFY 3
+#define OPERATION_CATALOG 4
+#define OPERATION_TENSION 5
+#define OPERATION_ERASE 6
+#define OPERATION_NEXTSET 7
+
+
+//
+// Defines to tell what type of password we have
+// NOSTRADAMOUS_APP - Tape secured by Nostradamous app
+// OTHER_APP - Tape passworded by some other app
+// NO_APP - Tape is neither secured or passworded
+//
+
+#define NOSTRADAMOUS_APP 1 // chs: 04-08-93
+#define OTHER_APP 2 // chs: 04-08-93
+#define NO_APP 3 // chs: 04-08-93
+
+
+// Do Commands, I don't know why these are here ?
+
+INT do_backup( INT16 );
+INT do_restore( INT16 );
+INT do_verify( INT16 );
+INT do_catalog( UINT32, INT16, INT16 );
+INT do_tension( INT16 );
+INT do_delete( INT16 );
+INT do_nextset( VOID );
+
+// Returns the current status of the operation.
+
+INT UI_GetCurrentStatus(
+INT *Operation,
+STATS *Stats,
+CHAR *Path,
+INT PathSize );
+
+
+INT UI_GetBackupCurrentStatus ( STATS *,CHAR *,INT );
+INT UI_GetRestoreCurrentStatus( STATS *,CHAR *,INT );
+INT UI_GetVerifyCurrentStatus ( STATS *,CHAR *,INT );
+INT UI_GetCatalogCurrentStatus( STATS *,CHAR *,INT );
+
+// Tells the current operation to abort after current file is done.
+
+INT UI_AbortAtEndOfFile( VOID );
+
+
+CHAR_PTR GetCurrentMachineNameUserName( VOID );
+BOOLEAN DoesUserHaveThisPrivilege( CHAR_PTR );
+BOOLEAN IsCurrentTapeSecured( DBLK_PTR vcb_ptr );
+BOOLEAN IsUserValid ( DBLK_PTR vcb_ptr, // current VCB
+ INT8_PTR inputtapepasswd, // tape password
+ INT16 inputtapepasswdlength // length of password
+ );
+
+BOOLEAN CatalogPasswordCheck ( DBLK_PTR ) ; // chs:03-22-93
+
+INT16 WhoPasswordedTape ( INT8_PTR tape_password, // chs:04-08-93
+ INT16 tape_password_size ); // chs:04-08-93
+
+
+BOOLEAN IsTransferTape( UINT32 TapeInDriveFID ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/tapepswd.h b/private/utils/ntbackup/inc/tapepswd.h
new file mode 100644
index 000000000..47349e4de
--- /dev/null
+++ b/private/utils/ntbackup/inc/tapepswd.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: TAPEPSWD.H
+
+ Description: This header file contains defines and structure for
+ tape password processing.
+
+ $Log: G:/UI/LOGFILES/TAPEPSWD.H_V $
+
+ Rev 1.8 09 Jun 1993 15:05:22 MIKEP
+enable c++.
+
+ Rev 1.7 04 Oct 1992 19:49:44 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.6 06 Apr 1992 14:30:24 CARLS
+ID error for translate
+
+ Rev 1.5 03 Apr 1992 13:50:46 CARLS
+added translate defines
+
+ Rev 1.4 27 Jan 1992 00:42:02 CHUCKB
+Updated dialog id's.
+
+ Rev 1.3 10 Dec 1991 13:36:22 CHUCKB
+Fixed control id's.
+
+ Rev 1.2 10 Dec 1991 11:35:00 CHUCKB
+No change.
+
+ Rev 1.1 03 Dec 1991 20:43:48 CHUCKB
+Nothing changed.
+
+ Rev 1.0 20 Nov 1991 19:36:14 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#ifndef tapepswd_h
+#define tapepswd_h
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_TAPEPSWD 30
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_T_TAPESTR 0x0065
+#define IDD_T_BKSTR 0x0066
+#define IDD_T_USTR 0x0067
+#define IDD_T_PSWDSTR 0x006A
+#define IDD_T_PSWD 0x006B
+#define IDD_T_TAPENAME 0x006C
+#define IDD_T_BSNAME 0x006D
+#define IDD_T_UNAME 0x006E
+
+typedef struct DS_TAPE_PSWD *DS_TAPE_PSWD_PTR;
+typedef struct DS_TAPE_PSWD {
+
+ LPSTR lpszTapeName ;
+ LPSTR lpszBsetName ;
+ LPSTR lpszUserName ;
+ LPSTR lpszTapePswd ;
+ BOOL fValid ;
+
+} DS_TAPE_PSWD;
+
+#endif
diff --git a/private/utils/ntbackup/inc/tbe_defs.h b/private/utils/ntbackup/inc/tbe_defs.h
new file mode 100644
index 000000000..43bf1c5fb
--- /dev/null
+++ b/private/utils/ntbackup/inc/tbe_defs.h
@@ -0,0 +1,124 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tbe_defs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+
+ $Log: J:/LOGFILES/TBE_DEFS.H_V $
+ *
+ * Rev 1.8 05 Feb 1993 22:32:18 MARILYN
+ * removed copy/move functionality
+ *
+ * Rev 1.7 18 Jan 1993 14:11:00 GREGG
+ * Changes to allow format command passed to driver through TpErase.
+ *
+ * Rev 1.6 04 Jan 1993 15:27:02 ANDY
+ * Added CATALOG_BSET_OPER for Graceful Red
+ *
+ * Rev 1.5 07 Dec 1992 16:49:36 DON
+ * added Marilyns operation types for copy/move
+ *
+ * Rev 1.4 11 Nov 1992 22:09:50 GREGG
+ * Unicodeized literals.
+ *
+ * Rev 1.3 29 Jul 1992 15:28:46 STEVEN
+ * fix warnings
+ *
+ * Rev 1.2 19 Sep 1991 14:32:08 HUNTER
+ * 8200SX - Added new defines for SX Fast File.
+ *
+ * Rev 1.1 17 Sep 1991 14:22:36 GREGG
+ * Added TENSION_NO_READ_OPER.
+ *
+ * Rev 1.0 09 May 1991 13:32:48 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _tbe_defs_h_
+#define _tbe_defs_h_
+
+/* Revision Numbers */
+#define BE_MAJ_VERSION 1
+#ifdef MBS
+#define MBS_VERSION_INDICATOR 0x80
+#endif
+#define BE_MIN_VERSION 0
+
+
+/* constants for the SX file for EXABYTE 8200SX - MaynStream 2200+ support */
+#define SX_FILE_FORMAT TEXT("%08lx.%03x")
+#define SX_FILE_NAME_LENGTH 13
+
+/* indicate fast file support for EXABYTE 8200SX - MaynStream 2200+ drives */
+#define MANUFACTURED_PBA ( 0xffffffff )
+
+
+/* These are the maximum lengths of the name fields in the vcb */
+
+#define TAPE_NAME 32 /* WARNING: $$$ some of these same constants */
+#define BACKUPSET_NAME 32 /* are defined in the user interface ui_defs.h */
+#define VOLUME_NAME 16 /* using different names. If you change */
+#define MACHINE_NAME 20 /* any of these defines, please check those */
+#define SHORT_MACHINE_NAME 4 /* defines. */
+#define USER_NAME 10
+#define TAPE_PASSWORD 8
+#define BACKUP_SET_PASSWORD 8
+#define SERVER_NAME 48
+
+/* These are the buffer sizes for the field listed above */
+/* They account for the null byte at the end of the string */
+/* when declaring a buffer using one of the above fields, */
+/* these sizes should be used */
+#define TAPE_NAME_BUF_LEN TAPE_NAME + 1
+#define BACKUPSET_NAME_BUF_LEN BACKUPSET_NAME + 1
+#define VOLUME_NAME_BUF_LEN VOLUME_NAME + 1
+#define MACHINE_NAME_BUF_LEN MACHINE_NAME + 1
+#define SHORT_MACHINE_NAME_BUF_LEN SHORT_MACHINE_NAME + 1
+#define USER_NAME_BUF_LEN USER_NAME + 1
+#define SERVER_NAME_BUF_LEN SERVER_NAME + 1
+
+/* define operation types to set in LIS */
+#define BACKUP_OPER (UINT16)1
+#define ARCHIVE_BACKUP_OPER (UINT16)2
+#define ARCHIVE_VERIFY_OPER (UINT16)3
+#define ARCHIVE_DELETE_OPER (UINT16)4
+#define RESTORE_OPER (UINT16)5
+#define VERIFY_OPER (UINT16)6
+#define VERIFY_LAST_BACKUP_OPER (UINT16)7
+#define VERIFY_LAST_RESTORE_OPER (UINT16)8
+#define TDIR_OPER (UINT16)9
+#define TENSION_OPER (UINT16)10
+#define TENSION_NO_READ_OPER (UINT16)11
+#define ERASE_OPER (UINT16)12
+#define ERASE_NO_READ_OPER (UINT16)13
+#define SECURITY_ERASE_OPER (UINT16)14
+#define SEC_ERASE_NO_READ_OPER (UINT16)15
+#define ERASE_FMARK_ONLY (UINT16)16
+#define PREPARE_OPER (UINT16)17
+#define CATALOG_TAPE_OPER (UINT16)18
+#define CATALOG_COMPACT_OPER (UINT16)19
+#define CATALOG_CLEANUP_OPER (UINT16)20
+#define RETIRE_OPER (UINT16)21
+#define ROTATE_OPER (UINT16)22
+#define CATALOG_BSET_OPER (UINT16)28
+#define FORMAT_OPER (UINT16)29
+
+/* Encryption algorithm types */
+#define NO_ENCRYPTION 0
+#define MAYNARD 1
+#define DES 2
+
+/* Compression algorithm types */
+#define NO_COMPRESSION 0
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/tbe_err.h b/private/utils/ntbackup/inc/tbe_err.h
new file mode 100644
index 000000000..b6e6c4e27
--- /dev/null
+++ b/private/utils/ntbackup/inc/tbe_err.h
@@ -0,0 +1,38 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tbe_err.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+
+ $Log: N:/LOGFILES/TBE_ERR.H_V $
+ *
+ * Rev 1.1 30 May 1991 11:59:18 STEVEN
+ * bsdu_err.h no longer exists
+ *
+ * Rev 1.0 09 May 1991 13:33:20 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _tbe_err_h_
+#define _tbe_err_h_
+
+/* general -1 -255 */
+/* file system -256 -511 */
+/* tape format -512 -767 */
+/* loops -768 -1023 */
+/* bsdu 0xfbff 0xfb00*/
+
+#include <std_err.h>
+#include "fsys_err.h"
+#include "tfl_err.h"
+
+#endif
diff --git a/private/utils/ntbackup/inc/tble_prv.h b/private/utils/ntbackup/inc/tble_prv.h
new file mode 100644
index 000000000..3bd06e0d0
--- /dev/null
+++ b/private/utils/ntbackup/inc/tble_prv.h
@@ -0,0 +1,35 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tble_prv.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PRIVATE
+
+
+ $Log: Q:/LOGFILES/TBLE_PRV.H_V $
+ *
+ * Rev 1.1 18 Jun 1993 09:24:32 MIKEP
+ * enable C++
+ *
+ * Rev 1.0 09 May 1991 13:30:56 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ include list */
+
+#ifndef ENC_TABLES
+
+#define ENC_TABLES
+
+#include "StdTypes.H"
+
+/* Arrays are now filled in ENC_TAB.CPP */
+extern UINT8 enc_table[256] ;
+extern UINT8 dec_table[256] ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/tdemo.h b/private/utils/ntbackup/inc/tdemo.h
new file mode 100644
index 000000000..1ac71155a
--- /dev/null
+++ b/private/utils/ntbackup/inc/tdemo.h
@@ -0,0 +1,52 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tdemo.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This function contains the prototypes for the functions in
+ devdrv\tdemo\tdemdd.c
+
+ Location: BE_PUBLIC
+
+
+ $log$
+
+**/
+/* $end$ */
+
+#ifndef _tdemo_h_
+#define _tdemo_h_
+
+
+
+#ifdef TDEMO
+
+VOID TdemoNewTape( UINT32 new_tape_id ) ;
+
+UINT32 TdemoGeneratedTapeId( VOID ) ;
+
+BOOLEAN TdemoInit( CHAR_PTR demo_directory,
+ INT16 num_tapes,
+ VOID_PTR workstation_resource,
+ VOID_PTR alias_resource,
+ BOOLEAN fast );
+
+/* used by the UI DO_*.C routines to request the correct tape
+ to be inserted for the demo driver */
+VOID NtDemoChangeTape( UINT16 tape_number ) ;
+
+#else
+
+#define TdemoNewTape( n ) /* do nothing */
+#define TdemoInit( d, n, w, a, f) FALSE
+#define NtDemoChangeTape( t ) /* do nothing */
+
+#endif
+
+
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/tension.h b/private/utils/ntbackup/inc/tension.h
new file mode 100644
index 000000000..7e3a7bf76
--- /dev/null
+++ b/private/utils/ntbackup/inc/tension.h
@@ -0,0 +1,30 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: tension.h
+
+ Description: include file for the tension.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/TENSION.H_V $
+
+ Rev 1.3 04 Oct 1992 19:49:46 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 03 Apr 1992 13:52:44 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_TENSION 41
+#endif
+
+#define IDD_JST_LISTBOX 67
+#define IDD_JST_OK 220
+
diff --git a/private/utils/ntbackup/inc/text.h b/private/utils/ntbackup/inc/text.h
new file mode 100644
index 000000000..9fc6e3371
--- /dev/null
+++ b/private/utils/ntbackup/inc/text.h
@@ -0,0 +1,45 @@
+
+/**************************************************
+Copyright (C) Maynard, An Archive Company. 1992
+
+ Name: text.h
+
+ Description:
+
+ Unicode mappings for the string functions. Should have no
+ effect on winter park, only NT.
+
+ $Log: G:/UI/LOGFILES/TEXT.H_V $
+
+ Rev 1.0 04 May 1992 13:33:32 MIKEP
+Initial revision.
+
+
+****************************************************/
+
+
+#ifndef TEXT_MAPPINGS
+
+#define TEXT_MAPPINGS
+
+#ifdef UNICODE
+
+# define strlen( (x) ) wcslen( (x) )
+# define strcpy( (x), (y) ) wcscpy( (x) )
+# define strncpy( (x), (y), (z) ) wcsncpy( (x), (y), (z) )
+# define strcat( (x), (y) ) wcscat( (x), (y) )
+# define strncat( (x), (y), (z) ) wcsncat( (x), (y), (z) )
+# define strcmp( (x), (y) ) wcscmp( (x), (y) )
+# define strncmp( (x), (y), (z) ) wcsncmp( (x), (y), (z) )
+# define stricmp( (x), (y) ) wcsicmp( (x), (y) )
+# define strnicmp( (x), (y), (z) ) wcsnicmp( (x), (y), (z) )
+# define strrchr( (x), (y) ) wcsrchr( (x), (y) )
+# define strchr( (x), (y) ) wcschr( (x), (y) )
+# define strpbrk( (x), (y) ) wcspbrk( (x), (y) )
+# define strlwr( (x) ) wcslwr( (x) )
+# define strupr( (x) ) wcsupr( (x) )
+# define strstr( (x), (y) ) wcsstr( (x), (y) )
+
+#endif
+
+#endif
diff --git a/private/utils/ntbackup/inc/tfl_err.h b/private/utils/ntbackup/inc/tfl_err.h
new file mode 100644
index 000000000..6ed2a77c5
--- /dev/null
+++ b/private/utils/ntbackup/inc/tfl_err.h
@@ -0,0 +1,126 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tfl_err.h
+subsystem\TAPE FORMAT\tfl_err.h
+$0$
+
+ Name: tfl_err.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the Tape Format Layer error codes.
+
+ Location: BE_PUBLIC
+
+$Header: Q:/LOGFILES/TFL_ERR.H_V 1.10 02 Aug 1993 17:11:00 TerriLynn $
+
+$Log: Q:/LOGFILES/TFL_ERR.H_V $
+ *
+ * Rev 1.10 02 Aug 1993 17:11:00 TerriLynn
+ * Added Use SYPL ECC FLAG for Sytos Plus
+ * ECC translation error
+ *
+ * Rev 1.9 22 Apr 1993 03:31:18 GREGG
+ * Third in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * - Removed all references to the DBLK element 'string_storage_offset',
+ * which no longer exists.
+ * - Check for incompatable versions of the Tape Format and OTC and deals
+ * with them the best it can, or reports tape as foreign if they're too
+ * far out. Includes ignoring the OTC and not allowing append if the
+ * OTC on tape is a future rev, different type, or on an alternate
+ * partition.
+ * - Updated OTC "location" attribute bits, and changed definition of
+ * CFIL to store stream number instead of stream ID.
+ *
+ * Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ * OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ * DETFMT.C 1.13, MTF.H 1.4
+ *
+ * Rev 1.8 30 Mar 1993 16:19:10 GREGG
+ * Handle Unrecognized Media error (unformatted DC2000).
+ *
+ * Rev 1.7 04 Feb 1993 14:58:00 ZEIR
+ * Brought forward Loader errors from Mama Cass revision (1.4.1.0)
+ *
+ * Rev 1.6 09 Nov 1992 10:48:52 GREGG
+ * Added TFLE_BAD_SET_MAP.
+ *
+ * Rev 1.5 05 Apr 1992 17:51:58 GREGG
+ * ROLLER BLADES - Initial OTC integration.
+ *
+ * Rev 1.4 17 Sep 1991 14:17:36 GREGG
+ * Added TFLE_INCOMPATIBLE_DRIVE.
+ *
+ * Rev 1.3 05 Aug 1991 16:43:48 GREGG
+ * Added TFLE_CHANNEL_IN_USE error definition for TF_RewindAllDrives.
+ *
+ * Rev 1.2 05 Jun 1991 18:16:28 NED
+ * added TFLE_UNEXPECTED_EOM
+ *
+ * Rev 1.1 10 May 1991 17:26:32 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:40 GREGG
+Initial revision.
+
+$-4$
+**/
+#ifndef _TFL_ERRORS
+#define _TFL_ERRORS
+
+
+/* $end$ include list */
+
+
+#define TFLE_NO_ERR 0 /* Everything Hunkie-Dorie */
+#define TFLE_UNKNOWN_FMT -512 /* We don't understand this format */
+#define TFLE_DRIVER_FAILURE -513 /* The driver won't Init */
+#define TFLE_NO_CONTROLLERS -514 /* No Controllers present */
+#define TFLE_NO_DRIVES -515 /* No Drives detected */
+#define TFLE_NO_MEMORY -516 /* Can't Allocate Memory */
+#define TFLE_NO_FREE_CHANNELS -517 /* There are no free channels */
+#define TFLE_CANNOT_OPEN_DRIVE -518 /* Can't open the drive */
+#define TFLE_BAD_TAPE -519 /* The tape is hosed -- physically */
+#define TFLE_DRIVE_FAILURE -520 /* The drive failed */
+#define TFLE_USER_ABORT -521 /* The user told us quit */
+#define TFLE_TAPE_INCONSISTENCY -522 /* The format is understood, but the layout is screwed up */
+#define TFLE_NO_MORE_DRIVES -523 /* No More Drives in a Channel */
+#define TFLE_NO_FREE_BUFFERS -524 /* No more free buffers */
+#define TFLE_TRANSLATION_FAILURE -525 /* I can't translate a dblk */
+#define TFLE_NO_TAPE -526 /* No Tape in drive */
+#define TFLE_UI_HAPPY_ABORT -527 /* The User Interface Happy Aborted */
+#define TFLE_HW_CONFIG_PROBLEM -528 /* Some error occurred with Board Setup */
+#define TFLE_BAD_SET_MAP -529 /* EOD encountered with no Set Map */
+#define TFLE_WRITE_PROTECT -530 /* The tape is write protected */
+#define TFLE_DRIVER_LOAD_FAILURE -531 /* We could't load driver */
+#define TFLE_UNEXPECTED_EOS -532 /* We have encounted an unExpected End of Set */
+#define TFLE_PROGRAMMER_ERROR1 -533 /* Instead of an assert... */
+#define TFLE_UNEXPECTED_EOM -534 /* tried to MoveFileMarks past BOT/EOM */
+#define TFLE_CHANNEL_IN_USE -535 /* Call to RewindAllDrives while a channel was in use */
+#define TFLE_INCOMPATIBLE_DRIVE -536 /* Drive doesn't have capabilities required to support translator */
+#define TFLE_OTC_FAILURE -537 /* On Tape Catalog Failure */
+
+#define TFLE_DOOR_AJAR -538 /* The Loader door has been opened when the CHM was not in motion */
+#define TFLE_NO_CARTRIDGE -539 /* No cartridge was detected in the loader */
+#define TFLE_WRONG_MODE -540 /* The loader was manually placed in sequential mode */
+#define TFLE_LOAD_UNLOAD -541 /* An error occured during a load CHM movement (tape may still be in CHM) */
+#define TFLE_DEST_FULL -542 /* Cannot return tape to original cartridge position */
+#define TFLE_EMPTY_SRC -543 /* The source selected for a tape is empty */
+#define TFLE_DRIVE_CLOSED -544 /* The drive door is closed and must be manually opened */
+#define TFLE_ARM_FULL -545 /* Attempt to get new tape with arm full */
+#define TFLE_DRIVE_FULL -546 /* Cannot put the requested tape in the drive because drive is full */
+#define TFLE_UNEXPECTED_TAPE -547 /* Encountered a tape in the drive when the driver thought it was empty */
+
+#define TFLE_UNRECOGNIZED_MEDIA -548 /* DC2000 unformatted or unrecognized format tape */
+#define TFLE_APPEND_NOT_ALLOWED -549 /* Cannot read catalogs on tape */
+#define TFLE_USE_SYPL_ECC_FLAG -550 /* Cannot read catalogs on tape */
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/tfldefs.h b/private/utils/ntbackup/inc/tfldefs.h
new file mode 100644
index 000000000..df91ebec8
--- /dev/null
+++ b/private/utils/ntbackup/inc/tfldefs.h
@@ -0,0 +1,204 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tfldefs.h
+subsystem\TAPE FORMAT\tfldefs.h
+$0$
+
+ Name: tfldefs.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ Location: BE_PUBLIC
+
+$Header: J:/LOGFILES/TFLDEFS.H_V 1.21 31 Mar 1993 08:51:30 MARILYN $
+
+$Log: J:/LOGFILES/TFLDEFS.H_V $
+ *
+ * Rev 1.21 31 Mar 1993 08:51:30 MARILYN
+ * added a definition for STREAM_CHECKSUMED
+ *
+ * Rev 1.20 18 Jan 1993 14:10:56 GREGG
+ * Changes to allow format command passed to driver through TpErase.
+ *
+ * Rev 1.19 09 Nov 1992 10:48:56 GREGG
+ * Added tape catalog level defines.
+ *
+ * Rev 1.18 13 Oct 1992 11:55:14 HUNTER
+ * Added defines for Stream Stuff
+ *
+ * Rev 1.17 16 Sep 1992 16:51:24 HUNTER
+ * Added TF_SKIP_DATA_STREAM
+ *
+ *
+ * Rev 1.16 17 Aug 1992 09:22:04 GREGG
+ * Removed defines for TF_SKIP_TO_NEXT_DIRECTORY and TF_KEEP_GEN_DATA_ONLY.
+ *
+ * Rev 1.15 27 Jul 1992 14:06:14 GREGG
+ * Fixed more warnings...
+ *
+ * Rev 1.14 27 Jul 1992 12:28:34 GREGG
+ * Cast constants.
+ *
+ * Rev 1.13 09 Jun 1992 19:34:10 GREGG
+ * Removed a bunch of defines which are no longer needed or moved elsewhere.
+ *
+ * Rev 1.12 22 May 1992 12:53:12 GREGG
+ * Added TF_SCAN_OPERATION and TF_SCAN_CONTINUE.
+ *
+ * Rev 1.11 15 May 1992 08:55:48 STEVEN
+ * added VCB_LBA_BIT
+ *
+ * Rev 1.10 12 Mar 1992 15:53:14 STEVEN
+ * 64 bit changes
+ *
+ * Rev 1.9 28 Feb 1992 13:06:46 STEVEN
+ * step one for 4.0 tape format
+ *
+ * Rev 1.8 17 Nov 1991 17:11:02 GREGG
+ * TRICYCLE - VBLK - Added VAR_BLKS_BIT for VCB BSDB DDB and FDB.
+ *
+ * Rev 1.7 17 Nov 1991 16:37:28 GREGG
+ * Added BSDB_ABORTED_SET_BIT.
+ *
+ * Rev 1.6 06 Nov 1991 13:19:30 STEVEN
+ * TRYCYCLE added support for notifying APP to not use a continuation set
+ *
+ * Rev 1.5 19 Sep 1991 10:06:50 HUNTER
+ * 8200SX - Added defines for "TF_LIST_TAPE_OPERATION" and "TF_OPERATION_MASK".
+ *
+ * Rev 1.4 17 Sep 1991 14:21:10 GREGG
+ * I modified the definitions of the Erase and Retension types and added a
+ * Retension with no read option. Steve added four new VCB bits for GUI.
+ *
+ * Rev 1.3 22 Jul 1991 11:51:32 GREGG
+ * Added EOS_AT_EOM attribute bit.
+ *
+ * Rev 1.2 21 May 1991 10:24:48 NED
+ * Added VCB_UNSUPPORTED_BIT for QicStream 1.9x and Sy-TOS sets
+ * which we can't (or won't) restore, directory, etc.
+ *
+ * Rev 1.1 10 May 1991 17:26:46 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:40 GREGG
+Initial revision.
+
+$-1$
+**/
+/* $end$ */
+
+#ifndef _TFL_DEFS
+#define _TFL_DEFS
+
+/* The valid operation modes for TF_OpenSet() */
+#define TF_READ_OPERATION 0x1
+#define TF_WRITE_OPERATION 0x2
+#define TF_WRITE_APPEND 0x3 /* This is only for multiple sequential sets */
+#define TF_DESTROY_OPERATION 0x4
+#define TF_WATCHING 0x5
+#define TF_SCAN_OPERATION 0x6
+
+#define TF_READ_CONTINUE 0x8001
+#define TF_WRITE_CONTINUE 0x8002
+#define TF_DESTROY_CONTINUE 0x8003
+#define TF_SCAN_CONTINUE 0x8006
+
+/* to be set in LOOPS and masked out in TF_OpenSet() */
+#define TF_LIST_TAPE_OPERATION 0x0100
+#define TF_OPERATION_MASK 0x0f00 /* NOTE: 0x0f00 will support 4 bit defined operations */
+
+
+/* These are the valid filters for all operations */
+#define TF_KEEP_ALL_DATA 0x0 /* FS, LOOPS, PERM */
+#define TF_SKIP_ALL_DATA 0x1 /* FS, LOOPS, PERM */
+#define TF_SKIP_TO_NEXT_DIRECTORY 0x2 /* LOOPS */
+#define TF_SKIP_DATA_STREAM 0x3 /* FS, LOOPS */
+
+/* Tension and Erase Values */
+
+#define TF_NO_RD 0x1
+
+#define TF_ER 0x0
+#define TF_S_ER 0x2
+#define TF_F_ER 0x4
+#define TF_RET 0x8
+#define TF_FMT 0x10
+
+#define TF_ERASE_READ (TF_ER) /* Erase with read */
+#define TF_ERASE_NO_READ (TF_ER|TF_NO_RD) /* Don't read normal erase */
+#define TF_ERASE_SECURITY (TF_S_ER) /* Security erase with read */
+#define TF_ERASE_SEC_NO_READ (TF_S_ER|TF_NO_RD) /* Security erase no read */
+#define TF_RETENSION_READ (TF_RET) /* Retension with read */
+#define TF_RETENSION_NO_READ (TF_RET|TF_NO_RD) /* Retension no read */
+#define TF_FORMAT_READ (TF_FMT) /* Format (DC 2000) */
+
+/* This case is used for Maynard production facility as is specified
+ via the /FM undocumented switch for tension */
+#define TF_ERASE_FMARK (TF_F_ER) /* Write filemark to erase with read */
+
+
+
+/* The following 'block_type's are defined.
+*/
+
+#define BT_UDB ((UINT8)0)
+#define BT_VCB ((UINT8)1)
+#define BT_CVCB ((UINT8)2)
+#define BT_BSDB ((UINT8)3)
+#define BT_DDB ((UINT8)8)
+#define BT_FDB ((UINT8)9)
+#define BT_IDB ((UINT8)10)
+#define BT_CFDB ((UINT8)11)
+#define BT_STREAM ((UINT8)39)
+
+
+
+/* Tape format Stream Attributes */
+
+#define STREAM_CONTINUE BIT0 /* This is a continuation Stream */
+#define STREAM_VARIABLE BIT1 /* The data size for this stream is variable */
+#define STREAM_VAR_END BIT2 /* Last piece of this Variable length data */
+#define STREAM_CHECKSUMED BIT5 /* A standard MTF checksum stream follows */
+
+
+/* WARNING: The value "256" decimal cannot be defined as a block type
+ This is is used inside the Tape Format Layer.
+*/
+
+#define BT_HOSED ((UINT16)0xffff)
+
+/* Process Type Defines */
+
+#define INTEL 0x0000
+#define MOTOROLA 0xffff
+
+#define CUR_PROCESSOR INTEL
+
+/* The following constitute the set of known OS ID's.
+ OS versions belong to the file system, with the exception of th
+ generic one (See GOS.h).
+*/
+
+#define MOS_PC_DOS 0
+#define MOS_PC_NOVELL 1
+#define MOS_OS2 2
+#define MOS_MAC_FINDER 3
+#define MOS_MAC_TOPS 4
+#define MOS_MAC_APPLESHARE 5
+#define MOS_MAC_AUX 6
+#define MOS_GENERIC -1 /* GOS be with you brother... */
+
+/* Tape Catalog Level Defines */
+#define TCL_FULL 2
+#define TCL_PARTIAL 1
+#define TCL_NONE 0
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/tflopen.h b/private/utils/ntbackup/inc/tflopen.h
new file mode 100644
index 000000000..89b722bf0
--- /dev/null
+++ b/private/utils/ntbackup/inc/tflopen.h
@@ -0,0 +1,63 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tflopen.h
+subsystem\TAPE FORMAT\tflopen.h
+$0$
+
+ Name: tflopen.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the parameter block for the TF_OpenSet() call.
+
+ Location: BE_PRIVATE
+
+$Header: N:/LOGFILES/TFLOPEN.H_V 1.2 17 Oct 1991 01:42:58 ED $
+
+$Log: N:/LOGFILES/TFLOPEN.H_V $
+ *
+ * Rev 1.2 17 Oct 1991 01:42:58 ED
+ * BIGWHEEL - 8200sx - Added cat_enabled boolean to open struct.
+ *
+ * Rev 1.1 10 May 1991 17:22:30 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:52 GREGG
+Initial revision.
+
+ Rev 2.0 21 May 1990 14:19:46 PAT
+ Baseline Maynstream 3.1
+
+$-4$
+**/
+#ifndef _PB_OPENSET
+#define _PB_OPENSET
+
+#include "thw.h"
+#include "fsys.h"
+#include "tpos.h"
+
+/* $end$ include list */
+
+typedef struct {
+ THW_PTR sdrv ; /* Starting Drive */
+ BOOLEAN ignore_clink ; /* Ignore Channel list */
+ BOOLEAN rewind_sdrv ; /* Rewind the Starting drive */
+ INT16 channel ; /* the channel number */
+ UINT16 mode ; /* the operation mode */
+ FSYS_HAND fsh ; /* The filesystem pointer */
+ UINT16 perm_filter ; /* The permanent filter */
+ UINT32 attributes ; /* Open Attributes */
+ TPOS_PTR tape_position ; /* For a specified position */
+ UINT16 wrt_format ; /* For writes, what format */
+ BOOLEAN (*idle_call)( UINT32 ) ; /* function I'll call while I'm idling */
+ UINT32 reference ; /* To pass to the idle call */
+ BOOLEAN cat_enabled ; /* Catalog Eanbled? From LIS */
+} TFL_OPBLK, *TFL_OPBLK_PTR ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/tflproto.h b/private/utils/ntbackup/inc/tflproto.h
new file mode 100644
index 000000000..364fecff4
--- /dev/null
+++ b/private/utils/ntbackup/inc/tflproto.h
@@ -0,0 +1,134 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tflproto.h
+subsystem\TAPE FORMAT\tflproto.h
+$0$
+
+ Name: tflproto.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the prototypes for the Tape Format Layer entry
+ points.
+
+ Location: BE_PRIVATE
+
+$Header: T:\logfiles\tflproto.h_v 1.18 17 Dec 1993 16:40:08 GREGG $
+
+$Log: T:\logfiles\tflproto.h_v $
+ *
+ * Rev 1.18 17 Dec 1993 16:40:08 GREGG
+ * Extended error reporting.
+ *
+ * Rev 1.17 22 Jul 1993 12:09:46 ZEIR
+ * add'd software_name param to OpenTapeFormat
+ *
+ * Rev 1.16 22 Jun 1993 18:28:34 GREGG
+ * Added prototype for TF_SetHWCompression.
+ *
+ * Rev 1.15 22 Jun 1993 10:53:30 GREGG
+ * Added API to change the catalog directory path.
+ *
+ * Rev 1.14 06 Jun 1993 21:11:44 GREGG
+ * Added abort flag parameter to protos for TF_CloseSetMap and TF_CloseSetCat.
+ *
+ * Rev 1.13 09 Nov 1992 10:49:10 GREGG
+ * Added tape catalog API prototypes.
+ *
+ * Rev 1.12 24 Feb 1992 15:09:52 GREGG
+ * Added protos for TF_OpenTape and TF_CloseTape.
+ *
+ * Rev 1.11 19 Feb 1992 16:04:32 GREGG
+ * Added vcb_only parameter to prototype for TF_OpenSet.
+ *
+ * Rev 1.10 04 Feb 1992 21:38:06 GREGG
+ * Changed protos for TF_OpenTapeFormat and TF_AllocateTapeBuffers.
+ *
+ * Rev 1.9 07 Jan 1992 14:21:54 NED
+ * added is_write parameter to TF_AllocateTapeBuffers and TF_FreeTapeBuffers
+ *
+ * Rev 1.8 17 Oct 1991 01:34:26 GREGG
+ * BIGWHEEL - -8200sx - Added catalog_directory parameter to TF_OpenTapeFormat.
+ *
+ * Rev 1.7 02 Oct 1991 14:10:36 GREGG
+ * BigW - Soft Eject - Added prototype for TF_EjectTape.
+ *
+ * Rev 1.6 19 Sep 1991 14:51:06 HUNTER
+ * 8200SX - Added parameter for Forced machine type.
+ *
+ * Rev 1.5 17 Sep 1991 14:14:14 GREGG
+ * Changed proto for TF_Reten to include mode, and removed proto for TF_EraseChannel.
+ *
+ * Rev 1.4 05 Aug 1991 16:48:48 GREGG
+ * Added prototype for new API: TF_RewindAllDrives.
+ *
+ * Rev 1.3 27 Jun 1991 16:29:58 NED
+ * added parameter to TF_OpenTapeFormat() declaration.
+ *
+ * Rev 1.2 21 May 1991 16:59:30 NED
+ * moved declarations of TF_GetTapeFormatInfo(), etc. to
+ * bengine/xface/fmtinf.h where they probably belong.
+ *
+ * Rev 1.1 10 May 1991 17:22:56 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:42 GREGG
+Initial revision.
+
+$-4$
+**/
+#ifndef TFL_PROTOS
+#define TFL_PROTOS
+
+#include "thw.h"
+#include "tpos.h"
+#include "reqrep.h"
+#include "tflopen.h"
+#include "fmtinf.h"
+#include "dilhwd.h"
+
+/* $end$ include list */
+
+INT16 TF_OpenTapeFormat(
+ CHAR_PTR drv_file , /* The device driver file to load */
+ DIL_HWD_PTR cards , /* The array of cards */
+ UINT16 no_cards , /* The number of cards */
+ THW_PTR *thw_ptr , /* Where to build the THW list */
+ INT16 max_channels , /* The maximum number of channels */
+ BOOLEAN use_fast_file, /* FALSE if FF to be suppressed */
+ BOOLEAN ignore_id , /* Operate on non Maynard Drives */
+ CHAR_PTR directory_name, /* for TDH */
+ INT16 forced_machine_type, /* 8200SX stuff */
+ CHAR_PTR catalog_directory, /* for SX files */
+ UINT16 initial_buff_alloc, /* DOS memory allocated at init */
+ CHAR_PTR software_name ) ; /* Name of software we're running */
+
+INT16 TF_SetHWCompression( THW_PTR thw, BOOLEAN enable ) ;
+VOID TF_CloseTapeFormat( VOID ) ;
+INT16 TF_AllocateTapeBuffers( UINT16 mem_save, UINT16 max_buffs, UINT16 buff_size ) ;
+INT16 TF_FreeTapeBuffers( VOID ) ;
+INT16 TF_OpenSet( TFL_OPBLK_PTR open_info, BOOLEAN vcb_only ) ;
+VOID TF_CloseSet( UINT16 channel_no, TF_STATS_PTR setstats ) ;
+INT16 TF_OpenTape( INT16_PTR channel_no, THW_PTR sdrv, TPOS_PTR tape_position ) ;
+VOID TF_CloseTape( UINT16 channel_no ) ;
+INT16 TF_GetNextTapeRequest( RR_PTR req ) ;
+THW_PTR TF_GetCurrentDevice( UINT16 channel_no ) ;
+INT16 TF_RetensionChannel( TFL_OPBLK_PTR open_blk, UINT16 mode ) ;
+INT16 TF_RewindAllDrives( VOID ) ;
+INT16 TF_EjectTape( THW_PTR thw, TPOS_HANDLER ui_tpos ) ;
+INT TF_OpenSetMap( THW_PTR thw, FSYS_HAND fsh, TPOS_PTR tpos,
+ BOOLEAN_PTR complete, BOOLEAN get_best ) ;
+INT TF_OpenSetCat( THW_PTR thw, FSYS_HAND fsh, TPOS_PTR tpos ) ;
+VOID TF_CloseSetMap( BOOLEAN abort ) ;
+VOID TF_CloseSetCat( BOOLEAN abort ) ;
+INT TF_GetNextSMEntry( FSYS_HAND fsh, DBLK_PTR vcb ) ;
+INT TF_GetNextSCEntry( FSYS_HAND fsh, DBLK_PTR dblk ) ;
+INT TF_ChangeCatPath( CHAR_PTR new_path ) ;
+BOOLEAN TF_GetLastDriveError( THW_PTR thw, INT16_PTR gen_func, INT16_PTR gen_err, INT32_PTR gen_misc ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/tflstats.h b/private/utils/ntbackup/inc/tflstats.h
new file mode 100644
index 000000000..2b8138b1f
--- /dev/null
+++ b/private/utils/ntbackup/inc/tflstats.h
@@ -0,0 +1,48 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tflstats.h
+subsystem\TAPE FORMAT\tflstats.h
+$0$
+
+ Name: tflstats.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Defines the Statistics structure for the TFL.
+
+ Location: BE_PRIVATE
+
+$Header: W:/LOGFILES/TFLSTATS.H_V 1.1 10 May 1991 17:22:16 GREGG $
+
+$Log: W:/LOGFILES/TFLSTATS.H_V $
+ *
+ * Rev 1.1 10 May 1991 17:22:16 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:44 GREGG
+Initial revision.
+
+ Rev 2.0 21 May 1990 14:19:46 PAT
+ Baseline Maynstream 3.1
+
+$-4$
+**/
+#ifndef _STATS_STUFF
+#define _STATS_STUFF
+
+/* $end$ include list */
+
+typedef struct {
+ UINT32 underruns ; /* Number of Underruns */
+ UINT32 dataerrs ; /* Number of Data Errors */
+ UINT32 bytes_processed ; /* Number of bytes processed */
+} TF_STATS, *TF_STATS_PTR ;
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/tflwatch.h b/private/utils/ntbackup/inc/tflwatch.h
new file mode 100644
index 000000000..0f6e4935e
--- /dev/null
+++ b/private/utils/ntbackup/inc/tflwatch.h
@@ -0,0 +1,60 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tflwatch.h
+subsystem\TAPE FORMAT\tflwatch.h
+$0$
+
+ Name: tflwatch.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the Prototypes for the Watch stuff.
+
+ Location: BE_PUBLIC
+
+$Header: W:/LOGFILES/TFLWATCH.H_V 1.1 10 May 1991 17:26:06 GREGG $
+
+$Log: W:/LOGFILES/TFLWATCH.H_V $
+ *
+ * Rev 1.1 10 May 1991 17:26:06 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:46 GREGG
+Initial revision.
+
+ Rev 2.1 01 Oct 1990 17:29:34 STEVEN
+ Watch needs file system handle
+
+ Rev 2.0 21 May 1990 14:19:50 PAT
+ Baseline Maynstream 3.1
+
+$-4$
+**/
+#ifndef _WATCH_DRIVE
+#define _WATCH_DRIVE
+
+#include "thw.h"
+
+/* $end$ include list */
+
+
+#define TFL_WATCH_SUCCESS 0
+#define TFL_WATCH_UNCHANGED 1
+#define TFL_WATCH_NOTAPE 2
+#define TFL_WATCH_FORIEGN_TAPE 3
+#define TFL_BLANK_TAPE 4
+#define TFL_BUSY_DRIVE 5
+#define TFL_WATCH_DRIVE_FAILURE 6
+
+INT16 TF_InitiateWatch( THW_PTR drive, FSYS_HAND fsh, DBLK_PTR vcb_dblk, BOOLEAN rewind ) ;
+INT16 TF_WatchDrive( INT16 watch_handle ) ;
+INT16 TF_EndWatch( INT16 watch_handle) ;
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/tfpoll.h b/private/utils/ntbackup/inc/tfpoll.h
new file mode 100644
index 000000000..aca7e6506
--- /dev/null
+++ b/private/utils/ntbackup/inc/tfpoll.h
@@ -0,0 +1,76 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+
+ Name: tfpoll.h
+
+ Description: API for TF_PollDrive.
+
+ $Log: T:\logfiles\tfpoll.h_v $
+
+ Rev 1.7.1.1 17 Dec 1993 16:39:56 GREGG
+Extended error reporting.
+
+ Rev 1.7.1.0 30 Nov 1993 18:27:42 GREGG
+Added message PD_SQL_TAPE.
+
+ Rev 1.7 13 Jul 1993 19:13:06 GREGG
+Added new PD messages to report future rev and ECC tapes.
+
+ Rev 1.6 27 Mar 1993 17:34:08 GREGG
+Removed PD_UNFORMATTED_TAPE.
+
+ Rev 1.5 22 Mar 1993 17:10:12 chrish
+Added define for PD_UNRECOGNIZED_MEDIA
+
+ Rev 1.4 12 Mar 1993 14:59:08 MIKEP
+add unformated msg
+
+ Rev 1.3 27 Jul 1992 12:23:16 GREGG
+Cast constants.
+
+ Rev 1.2 25 Nov 1991 14:33:10 GREGG
+Added PD_BAD_TAPE message.
+
+ Rev 1.1 17 Sep 1991 14:24:42 GREGG
+Changed TPOS_PTR parameter to TPOS_HANDLER.
+
+ Rev 1.0 09 Sep 1991 21:09:32 GREGG
+Initial revision.
+
+**/
+
+/* Return Codes: */
+
+#define PD_NO_CHANGE ((UINT16)0x00)
+#define PD_BLANK_TAPE ((UINT16)0x01)
+#define PD_NO_TAPE ((UINT16)0x02)
+#define PD_FOREIGN_TAPE ((UINT16)0x03)
+#define PD_BUSY ((UINT16)0x04)
+#define PD_NEW_TAPE ((UINT16)0x05)
+#define PD_VALID_VCB ((UINT16)0x06)
+#define PD_FUBAR ((UINT16)0x07)
+#define PD_NO_FREE_CHANNELS ((UINT16)0x08)
+#define PD_OUT_OF_MEMORY ((UINT16)0x09)
+#define PD_DRIVE_FAILURE ((UINT16)0x0a)
+#define PD_OUT_OF_SEQUENCE ((UINT16)0x0b)
+#define PD_BAD_TAPE ((UINT16)0x0c)
+#define PD_UNRECOGNIZED_MEDIA ((UINT16)0x0d)
+#define PD_FUTURE_REV_MTF ((UINT16)0x0e)
+#define PD_MTF_ECC_TAPE ((UINT16)0x0f)
+#define PD_SQL_TAPE ((UINT16)0x10)
+#define PD_DRIVER_FAILURE ((UINT16)0x11)
+
+/* Input Messages: */
+
+#define PDMSG_CONTINUE ((UINT16)0)
+#define PDMSG_START ((UINT16)1)
+#define PDMSG_END ((UINT16)2)
+
+/* Prototype: */
+
+INT16 TF_PollDrive( THW_PTR thw, /* Target Drive */
+ DBLK_PTR vcb, /* Pointer to ALLOCATED DBLK */
+ FSYS_HAND fsh, /* File System Handle */
+ TPOS_HANDLER ui_tpos, /* Tape Positioning Routine */
+ INT16 msg ) ; /* Input Message */
diff --git a/private/utils/ntbackup/inc/thw.h b/private/utils/ntbackup/inc/thw.h
new file mode 100644
index 000000000..b364fdd38
--- /dev/null
+++ b/private/utils/ntbackup/inc/thw.h
@@ -0,0 +1,80 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\thw.h
+subsystem\TAPE FORMAT\thw.h
+$0$
+
+ Name: thw.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the drive description structure used by the
+ upper layers. A list of these structus is returned on
+ TF_OpenTapeLayer( ).
+
+ Location: BE_PUBLIC
+
+$Header: T:/LOGFILES/THW.H_V 1.4 18 Jan 1993 16:18:28 BobR $
+
+$Log: T:/LOGFILES/THW.H_V $
+ *
+ * Rev 1.4 18 Jan 1993 16:18:28 BobR
+ * Added ESA structure to THW
+ *
+ * Rev 1.3 29 Sep 1992 14:07:10 DON
+ * LOADER - Added Macro to determine whether or not the drive supports a
+ * LOADER device - requires updated 'drvinf.h'.
+ *
+ * Rev 1.2 19 Sep 1991 10:08:02 HUNTER
+ * 8200SX - Added Macro to determine whether or not the drive supports SX
+ * FIND command.
+ *
+ * Rev 1.1 10 May 1991 17:25:40 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:46 GREGG
+Initial revision.
+
+ Rev 2.1 08 Oct 1990 15:03:54 HUNTER
+ Added macro for fast file.
+
+ Rev 2.0 21 May 1990 14:19:44 PAT
+ Baseline Maynstream 3.1
+
+$-4$
+**/
+#ifndef THW_STUFF
+#define THW_STUFF
+
+#include <queues.h>
+
+#include "drvinf.h"
+#include "esa.h"
+
+/* $end$ include list */
+
+#define MAX_DRV_NAME 15
+
+typedef struct THW {
+ Q_ELEM link ; /* Defines the linked list */
+ Q_ELEM channel_link ; /* User Configurable Channel links */
+ BOOLEAN status_changed ; /* Has the Status Changed */
+ UINT32 drv_status ; /* Current drive status */
+ UINT16 card_no ; /* Index into controller array */
+ DRV_INF drv_info ; /* Information about the drive */
+ CHAR drv_name[MAX_DRV_NAME] ; /* The Drive Name */
+ ESA the ; /* Extended Status Array */
+} THW, *THW_PTR ;
+
+#define SupportFastFile( x ) ( x->drv_info.drv_features & TDI_FAST_NBLK )
+#define SupportSXFastFile( x ) ( x->drv_info.drv_features & TDI_FIND_BLK )
+#define SupportLoaderDevice( x ) ( x->drv_info.drv_features & TDI_LOADER )
+
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/timers.h b/private/utils/ntbackup/inc/timers.h
new file mode 100644
index 000000000..cb68675d9
--- /dev/null
+++ b/private/utils/ntbackup/inc/timers.h
@@ -0,0 +1,66 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: timers.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the timers manager.
+
+ $Log: G:/UI/LOGFILES/TIMERS.H_V $
+
+ Rev 1.4 18 Nov 1992 13:27:06 GLENN
+Increased the speed as an enhancement for the callers.
+
+ Rev 1.3 04 Oct 1992 19:49:48 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.2 12 May 1992 21:23:00 MIKEP
+NT pass 1
+
+ Rev 1.1 12 Dec 1991 17:12:50 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.0 20 Nov 1991 19:33:58 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#ifndef _TIMERS_H
+#define _TIMERS_H
+
+#ifndef OS_WIN32
+#define HTIMER WORD
+#else
+#define HTIMER UINT
+#endif
+
+#define INVALID_TIMER_HANDLE 0xFFFF // All timers IN USE bitmask
+
+#define TIMER_BASE 1000
+#define TIMER_FREQUENCY 100
+#define TIMER_RESOLUTION (TIMER_BASE/TIMER_FREQUENCY)
+
+#define ONE_SECOND ( 1 * TIMER_RESOLUTION )
+#define TWO_SECONDS ( 2 * TIMER_RESOLUTION )
+#define THREE_SECONDS ( 3 * TIMER_RESOLUTION )
+#define FOUR_SECONDS ( 4 * TIMER_RESOLUTION )
+#define FIVE_SECONDS ( 5 * TIMER_RESOLUTION )
+#define SIX_SECONDS ( 6 * TIMER_RESOLUTION )
+#define SEVEN_SECONDS ( 7 * TIMER_RESOLUTION )
+#define EIGHT_SECONDS ( 8 * TIMER_RESOLUTION )
+#define NINE_SECONDS ( 9 * TIMER_RESOLUTION )
+#define TEN_SECONDS (10 * TIMER_RESOLUTION )
+
+// FUNCTION PROTOTYPES
+
+BOOL WM_InitTimer ( VOID );
+BOOL WM_DeinitTimer ( VOID );
+HTIMER WM_HookTimer ( PF_VOID, INT );
+BOOL WM_UnhookTimer ( HTIMER );
+INT WM_SetTimerFrequency ( HTIMER, INT );
+
+
+#endif
diff --git a/private/utils/ntbackup/inc/tloc.h b/private/utils/ntbackup/inc/tloc.h
new file mode 100644
index 000000000..b9f7e1b4a
--- /dev/null
+++ b/private/utils/ntbackup/inc/tloc.h
@@ -0,0 +1,57 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tloc.h
+subsystem\TAPE FORMAT\tloc.h
+$0$
+
+ Name: tloc.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the definition for the Tape Location Descriptor.
+
+ Location: BE_PUBLIC
+
+$Header: W:/LOGFILES/TLOC.H_V 1.1 10 May 1991 17:26:58 GREGG $
+
+$Log: W:/LOGFILES/TLOC.H_V $
+ *
+ * Rev 1.1 10 May 1991 17:26:58 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:52 GREGG
+Initial revision.
+
+ Rev 2.1 19 Jun 1990 16:05:36 HUNTER
+ Fast File Retrieval additions.
+
+ Rev 2.0 21 May 1990 14:19:50 PAT
+ Baseline Maynstream 3.1
+
+$-4$
+**/
+#ifndef _TLOC_STUFF
+#define _TLOC_STUFF
+
+
+/* $end$ include list */
+
+
+
+typedef struct {
+ INT16 tape_seq ; /* The Tape Sequeunce number */
+ UINT32 pba_vcb ; /* physical block address of the VCB for this set */
+ UINT32 lba_vcb ; /* The LOGICAL BLOCK ADDRESS of the current VCB */
+ UINT32 fmks ; /* number of filemarks */
+ UINT32 lba ; /* logical block address */
+} TLOC, *TLOC_PTR ;
+
+#endif
+
+
+
diff --git a/private/utils/ntbackup/inc/tpos.h b/private/utils/ntbackup/inc/tpos.h
new file mode 100644
index 000000000..67ff3921a
--- /dev/null
+++ b/private/utils/ntbackup/inc/tpos.h
@@ -0,0 +1,189 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+$name$
+.module information
+
+$paths$
+headers\tpos.h
+subsystem\TAPE FORMAT\tpos.h
+$0$
+
+ Name: tpos.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the communication structure between the User
+ interface Tape positioning routine and the the TFL tape
+ positioning unit.
+
+ Location: BE_PUBLIC
+
+$Header: T:/LOGFILES/TPOS.H_V 1.19 30 Nov 1993 19:00:40 GREGG $
+
+$Log: T:/LOGFILES/TPOS.H_V $
+ *
+ * Rev 1.19 30 Nov 1993 19:00:40 GREGG
+ * Added new message TF_SQL_TAPE.
+ *
+ * Rev 1.18 13 Jul 1993 19:04:04 GREGG
+ * Added new TF messages to report future rev and ECC tapes.
+ *
+ * Rev 1.17 19 May 1993 12:48:14 GREGG
+ * Added logic to prevent using tape with same family id to continue a backup.
+ *
+ * Rev 1.16 19 Apr 1993 18:01:54 GREGG
+ * Second in a series of incremental changes to bring the translator in line
+ * with the MTF spec:
+ *
+ * Changes to write version 2 of OTC, and to read both versions.
+ *
+ * Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ * makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ * mayn40.h 1.32, mtf.h 1.3.
+ *
+ * NOTE: There are additional changes to the catalogs needed to save the OTC
+ * version and put it in the tpos structure before loading the OTC
+ * File/Directory Detail. These changes are NOT listed above!
+ *
+ * Rev 1.15 30 Mar 1993 16:19:04 GREGG
+ * Handle Unrecognized Media error (unformatted DC2000).
+ *
+ * Rev 1.14 12 Mar 1993 14:07:30 DON
+ * Added new tape format message, TF_FAST_SEEK_EOD
+ *
+ * Rev 1.13 26 Jan 1993 18:27:22 GREGG
+ * Added Fast Append functionality.
+ *
+ * Rev 1.12 18 Jan 1993 16:18:04 BobR
+ * Added ESA structure to TPOS.
+ *
+ * Rev 1.11 09 Nov 1992 10:49:24 GREGG
+ * Added location of set catalog to tpos structure and defined new TF_ messages.
+ *
+ * Rev 1.10 04 Aug 1992 17:18:14 GREGG
+ * Added define UI_NON_OTC_SCAN.
+ *
+ * Rev 1.9 23 Jul 1992 10:10:00 GREGG
+ * Fixed warning.
+ *
+ * Rev 1.8 13 May 1992 12:32:42 TIMN
+ * Deleted tapename and backup_set_name for TPOS_STRUCT. Not used.
+ *
+ * Rev 1.7 05 Apr 1992 17:43:14 GREGG
+ * ROLLER BLADES - Initial OTC integration.
+ *
+ * Rev 1.6 17 Sep 1991 14:15:26 GREGG
+ * Added TF_MOUNTING message.
+ *
+ * Rev 1.5 24 Jul 1991 11:31:38 DAVIDH
+ * Changed TPOS_HANDLER to UNIT16. (Don)
+ *
+ * Rev 1.4 12 Jun 1991 14:38:08 JOHNW
+ * Added some TF_ msgs.
+ *
+ * Rev 1.3 06 Jun 1991 17:55:10 JOHNW
+ * Moved typedef for TPOS_HANDLER from lis.h to this file.
+ *
+ * Rev 1.2 05 Jun 1991 19:11:40 NED
+ * added TF_NEED_REWIND_FIRST
+ *
+ * Rev 1.1 10 May 1991 17:26:20 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:15:50 GREGG
+Initial revision.
+
+$-4$
+**/
+#ifndef TPOS_JUNK
+#define TPOS_JUNK
+
+#include "tbe_defs.h" /* The Global Defines */
+#include "fsys.h" /* File System Stuff */
+#include "tloc.h"
+#include "esa.h"
+
+/* $end$ include list */
+
+struct TPOS_STRUCT ;
+
+typedef UINT16 ( *TPOS_HANDLER )( UINT16 message, struct TPOS_STRUCT * tpos, BOOLEAN curr_valid_vcb, DBLK_PTR cur_vcb, UINT16 mode ) ;
+
+typedef struct TPOS_STRUCT {
+ INT32 tape_id ; /* Tape ID number */
+ INT16 tape_seq_num ; /* Sequeunce number */
+ INT16 backup_set_num ; /* Set Number */
+ INT16 set_cat_seq_num ; /* Seq num where set catalog starts */
+ INT32 set_cat_pba ; /* PBA of start of set catalog */
+ UINT8 tape_cat_ver ; /* Version of OTC */
+ TLOC tape_loc ; /* Address on Tape */
+ INT16 channel ; /* Channel ID */
+ UINT32 reference ; /* Temp Storage */
+ UINT16 format ; /* Tape Format Type */
+ BOOLEAN write_protect ; /* Is the tape write protected */
+ BOOLEAN encryption_supported ;
+ UINT16 (*TF_PassWordMatch)( CHAR_PTR, DBLK_PTR ) ; /* TFL match the pass word */
+ TPOS_HANDLER UI_TapePosRoutine ; /* The UI entry point */
+ ESA the ; /* Extended Status Array */
+} TPOS, *TPOS_PTR ;
+
+/* The tape format messages */
+
+#define TF_VCB_BOT 0x0001 /* at VCB and at BOT */
+#define TF_VCB_EOD 0x0002 /* at EOD and returning last VCB */
+#define TF_POSITIONED_AT_A_VCB 0x0003 /* at a VCB but not the requested one */
+#define TF_REQUESTED_VCB_FOUND 0x0004 /* found the right VCB */
+#define TF_ACCIDENTAL_VCB 0x0005 /* found a VCB but not the right one */
+#define TF_NO_MORE_DATA 0x0006 /* at EOD */
+#define TF_EMPTY_TAPE 0x0007 /* tape is empty */
+#define TF_AT_EOT 0x0008 /* at EOT */
+#define TF_NO_TAPE_PRESENT 0x0009
+#define TF_INVALID_VCB 0x000a
+#define TF_POSITIONED_FOR_WRITE 0x000b /* response to TPOS_OVERWRITE */
+#define TF_REWINDING 0x000c /* busy with rewind */
+#define TF_SEARCHING 0x000d /* busy with spacing */
+#define TF_ERASING 0x000e /* busy with erasing */
+#define TF_RETENSIONING 0x000f /* busy with retension */
+#define TF_IDLE 0x0010 /* still doing whatever it was */
+#define TF_DRIVE_BUSY 0x0011 /* busy with some other operation */
+#define TF_NEED_NEW_TAPE 0x0012 /* needs a new tape in current drive */
+#define TF_END_CHANNEL 0x0013 /* hit head or tail of drive list */
+#define TF_IDLE_NOBREAK 0x0014
+#define TF_READ_ERROR 0x0015
+#define TF_WRONG_TAPE 0x0016 /* wanted new tape, got wrong one */
+#define TF_NEED_REWIND_FIRST 0x0017 /* have to handle this motion forward */
+#define TF_TAPE_OUT_OF_ORDER 0x0018 /* tapes cannot be read in this order */
+#define TF_SKIPPING_DATA 0x0019 /* busy with skipping data */
+#define TF_MOUNTING 0x001a /* busy mounting the tape */
+#define TF_NO_SM_ON_TAPE 0x001b /* no set map on current tape */
+#define TF_NO_SC_FOR_SET 0x001c /* no set cat for current set */
+#define TF_NO_SM_FOR_FAMILY 0x001d /* no set map for current tape family */
+#define TF_NO_MORE_ENTRIES 0x001e /* end of tape catalog encountered */
+#define TF_END_POSITIONING 0x001f /* stop positioning, but don't abort operation */
+#define TF_FAST_SEEK_EOD 0x0020 /* fast seek to EOD because UI_FAST_APPEND */
+#define TF_UNRECOGNIZED_MEDIA 0x0021 /* DC2000 tape is unformatted or written in unrecognized format */
+#define TF_CONT_TAPE_IN_FAMILY 0x0022 /* Cont backup requested on a tape with the same family id */
+#define TF_FUTURE_REV_MTF 0x0023
+#define TF_MTF_ECC_TAPE 0x0024
+#define TF_SQL_TAPE 0x0025
+
+/* The user interface messages */
+
+#define UI_ACKNOWLEDGED 0x8001 /* acknowledged ACCIDENTAL_VCB */
+#define UI_END_POSITIONING 0x8002 /* enough already */
+#define UI_OVERWRITE 0x8003 /* overwrite set */
+#define UI_BOT 0x8004 /* rewind to BOT */
+#define UI_EOD 0x8005 /* append at EOD */
+#define UI_CONTINUE_POSITIONING 0x8006 /* not at the right one yet */
+#define UI_ABORT_POSITIONING 0x8007 /* quit */
+#define UI_NEW_TAPE_INSERTED 0x8008 /* we got a new tape */
+#define UI_NEW_POSITION_REQUESTED 0x8009 /* destination position has changed */
+#define UI_SEARCH_CHANNEL 0x800a
+#define UI_NEXT_DRIVE 0x800b
+#define UI_PREVIOUS_DRIVE 0x800c
+#define UI_HAPPY_ABORT 0x800d
+#define UI_BEGINNING_OF_CHANNEL 0x800e
+#define UI_FAST_APPEND 0x800f
+
+#endif
diff --git a/private/utils/ntbackup/inc/translat.h b/private/utils/ntbackup/inc/translat.h
new file mode 100644
index 000000000..3767cc742
--- /dev/null
+++ b/private/utils/ntbackup/inc/translat.h
@@ -0,0 +1,176 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: translat.h
+
+ Date Updated: $./FDT$ $./FTM$
+ 7/21/1989 14:4:121
+
+ Description: Contains the entry points to Translators.
+
+
+ $Log: T:/LOGFILES/TRANSLAT.H_V $
+ *
+ * Rev 1.22 17 Jul 1993 17:56:52 GREGG
+ * Changed write translator functions to return INT16 TFLE_xxx errors instead
+ * of BOOLEAN TRUE/FALSE. Files changed:
+ * MTF10WDB.C 1.23, TRANSLAT.H 1.22, F40PROTO.H 1.30, FMTENG.H 1.23,
+ * TRANSLAT.C 1.43, TFWRITE.C 1.68, MTF10WT.C 1.18
+ *
+ * Rev 1.21 22 Jun 1993 10:53:28 GREGG
+ * Added API to change the catalog directory path.
+ *
+ * Rev 1.20 09 Mar 1993 18:13:58 GREGG
+ * Initial changes for new stream and EOM processing.
+ *
+ * Rev 1.19 26 Jan 1993 01:30:44 GREGG
+ * Added Fast Append functionality.
+ *
+ * Rev 1.18 09 Nov 1992 10:49:02 GREGG
+ * Added tape catalog entry points.
+ *
+ * Rev 1.17 03 Nov 1992 09:26:18 HUNTER
+ * Added prototype for end data stream.
+ *
+ * Rev 1.16 22 Oct 1992 10:54:56 HUNTER
+ * Changes for new streams
+ *
+ * Rev 1.15 22 Sep 1992 09:15:32 GREGG
+ * Initial changes to handle physical block sizes greater than 1K.
+ *
+ * Rev 1.14 17 Aug 1992 09:09:00 GREGG
+ * Changes to deal with block sizeing scheme.
+ *
+ * Rev 1.13 21 May 1992 16:31:14 GREGG
+ * Changed protos for GetCurrentVCB, RD_TranslateDBLK and DetBlockType. Added proto for StartRead.
+ *
+ * Rev 1.12 29 Apr 1992 13:10:48 GREGG
+ * ROLLER BLADES - Added prototype for DetBlockType.
+ *
+ * Rev 1.11 25 Mar 1992 18:29:24 GREGG
+ * ROLLER BLADES - Added prototype for SizeForTapeEomBlk().
+ *
+ * Rev 1.10 11 Feb 1992 17:10:14 NED
+ * changed types of parameters in buffman interface
+ *
+ * Rev 1.9 04 Feb 1992 20:59:00 NED
+ * Changes to Buffer Management translator hooks.
+ *
+ * Rev 1.8 16 Jan 1992 18:37:42 NED
+ * Skateboard: buffer manager changes
+ *
+ * Rev 1.7 02 Jan 1992 15:06:40 NED
+ * Buffer Manager/UTF translator integration.
+ *
+ * Rev 1.6 10 Dec 1991 16:40:10 GREGG
+ * SKATEBOARD - New Buf. Mgr. - Initial integration.
+ *
+ * Rev 1.5 18 Nov 1991 20:03:40 GREGG
+ * Added BOOLEAN abort parameter to WT_EndSet.
+ *
+ * Rev 1.4 09 Nov 1991 10:44:44 HUNTER
+ * VBLK - Changes for Variable length block.
+ *
+ * Rev 1.3 17 Sep 1991 13:55:32 GREGG
+ * Changed prototype for SetupFormatEnv to return INT16.
+ *
+ * Rev 1.2 03 Jun 1991 10:31:22 NED
+ * Changed declarations of FreeFormatEnv()
+ *
+ * Rev 1.1 10 May 1991 17:09:16 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:13:02 GREGG
+Initial revision.
+
+**/
+
+#ifndef _TRANSLATOR_ENT
+#define _TRANSLATOR_ENT
+
+#include "buffman.h"
+#include "channel.h"
+
+/* routines in translat.c */
+
+UINT16 DetermineFormat( VOID_PTR, UINT32 ) ; /* returns format */
+INT16 SetupFormatEnv( CHANNEL_PTR ) ;
+VOID FreeFormatEnv( UINT16_PTR, VOID_PTR * ) ;
+INT16 MoveToVCB( CHANNEL_PTR, INT16, BOOLEAN_PTR, BOOLEAN ) ;
+INT16 SeekEOD( CHANNEL_PTR ) ;
+INT16 NewTape( CHANNEL_PTR, BOOLEAN_PTR ) ;
+INT16 GetCurrentVCB( CHANNEL_PTR, BUF_PTR ) ;
+BOOLEAN VerifyVCB( CHANNEL_PTR, BUF_PTR ) ;
+INT16 StartRead( CHANNEL_PTR channel ) ;
+
+BOOLEAN RD_ReTranslateDBLK( CHANNEL_PTR, BUF_PTR ) ;
+BOOLEAN RD_ContinuationTape( CHANNEL_PTR, BUF_PTR ) ;
+
+/* buffer manager type stuff */
+
+VOID TF_GetVCBBufferRequirements(
+ BUF_REQ_PTR reqs, /* O - destination structure */
+ Q_ELEM_PTR drive_list, /* I - master drive list */
+ UINT16 suggested_buff_size ) ; /* I - size from config */
+
+VOID TF_GetPreferredBufferSpace(
+ Q_ELEM_PTR drive_list, /* I - master drive list */
+ UINT16 suggested_number_of_buffers, /* I -- from config */
+ UINT32 suggested_buffer_size, /* I -- from config */
+ UINT32_PTR preferred_memory ) ; /* O - preferred total memory size */
+
+VOID TF_ReadBufferHook( CHANNEL_PTR, BUF_PTR ) ;
+
+/* these return block types */
+INT16 RD_TranslateDBLK( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+INT16 DetBlockType( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+INT16 RD_Exception( CHANNEL_PTR, INT16, UINT16_PTR ) ;
+
+INT16 WT_WriteInit( CHANNEL_PTR, UINT16, BUF_PTR ) ;
+INT16 WT_TranslateDBLK( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+
+/* Stream Header processing functions */
+
+#define NEED_NEW_BUFFER 1
+
+INT16 WT_NewDataStream( CHANNEL_PTR, BUF_PTR, STREAM_INFO_PTR ) ;
+INT16 WT_EndData( CHANNEL_PTR, BUF_PTR ) ;
+INT16 WT_ContVarStream( CHANNEL_PTR, BUF_PTR ) ;
+VOID WT_EndVarStream( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+
+VOID WT_EOSPadBlk( CHANNEL_PTR ) ;
+INT16 WT_EndSet( CHANNEL_PTR, BOOLEAN ) ;
+INT16 WT_EndTape( CHANNEL_PTR ) ;
+INT16 WT_ContinueSet( CHANNEL_PTR ) ;
+
+VOID WT_ParseWrittenBuffer( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+
+/* these two take the format id as their first argument */
+
+UINT16 SizeofTapeBlock( UINT16, VOID_PTR ) ;
+
+#define MinSizeForTapeBlk( fmt ) lw_fmtdescr[ ( fmt ) ].min_size_for_tblk
+#define MinSizeForStream( fmt ) lw_fmtdescr[ ( fmt ) ].min_size_for_stream
+
+/* Tape Based Catalog APIs */
+
+INT LoadSetMap( CHANNEL_PTR channel, BOOLEAN_PTR complete, BOOLEAN get_best ) ;
+INT LoadSetCat( CHANNEL_PTR channel ) ;
+
+INT GetNextSMEntry( CHANNEL_PTR channel ) ;
+INT GetNextSCEntry( CHANNEL_PTR channel ) ;
+
+VOID CloseTapeCatalogs( INT16 cur_fmt, VOID_PTR env_ptr ) ;
+
+#define UNKNOWN_FORMAT 0xFFFF
+
+#define BT_MDB 256
+
+/* Return Codes for Exception Actions */
+#define FMT_EXC_EOS 0x01
+#define FMT_EXC_EOM 0x02
+#define FMT_EXC_IGNORE 0x03
+#define FMT_EXC_HOSED 0xff
+
+#endif
diff --git a/private/utils/ntbackup/inc/transprt.h b/private/utils/ntbackup/inc/transprt.h
new file mode 100644
index 000000000..170955edd
--- /dev/null
+++ b/private/utils/ntbackup/inc/transprt.h
@@ -0,0 +1,74 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: transprt.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the prototypes for the stupid translators
+
+ Location:
+
+
+ $Log: G:/LOGFILES/TRANSPRT.H_V $
+ *
+ * Rev 1.5 17 Mar 1993 15:32:32 TERRI
+ * Added Prototype include file for Sytos Plus.
+ *
+ * Rev 1.4 24 Jul 1992 13:54:52 GREGG
+ * Defined out inclusion of prototype headers for unsupported translators.
+ *
+ * Rev 1.3 25 Mar 1992 20:45:04 GREGG
+ * ROLLER BLADES - Included f40proto.h.
+ *
+ * Rev 1.2 06 Jan 1992 17:28:58 ZEIR
+ * Added UTF support.
+ *
+ * Rev 1.1 10 May 1991 14:24:28 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:17:44 GREGG
+Initial revision.
+
+**/
+/* $end$ include list */
+
+
+#ifndef _TRANS_PROTOS
+#define _TRANS_PROTOS
+
+#ifdef MY40_TRANS
+#include "f40proto.h"
+#endif
+
+#ifdef MY31_TRANS
+#include "f31proto.h"
+#endif
+
+#ifdef MY30_TRANS
+#include "f30proto.h"
+#endif
+
+#ifdef MY25_TRANS
+#include "f25proto.h"
+#endif
+
+#ifdef QS19_TRANS
+#include "fqproto.h"
+#endif
+
+#ifdef SY31_TRANS
+#include "fsyproto.h"
+#endif
+
+#ifdef SYPL10_TRANS
+#include "syplpto.h"
+#endif
+
+#ifdef UTF_TRANS
+#include "utfproto.h"
+#endif
+
+#endif
+
diff --git a/private/utils/ntbackup/inc/transutl.h b/private/utils/ntbackup/inc/transutl.h
new file mode 100644
index 000000000..49cc2b749
--- /dev/null
+++ b/private/utils/ntbackup/inc/transutl.h
@@ -0,0 +1,69 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: util.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: T:/LOGFILES/TRANSUTL.H_V $
+ *
+ * Rev 1.5 22 Sep 1992 09:01:32 GREGG
+ * Initial changes to handle physical block sizes greater than 1K.
+ *
+ * Rev 1.4 14 Aug 1992 16:22:32 GREGG
+ * Added prototype for AllocChannelTmpBlks.
+ *
+ * Rev 1.3 24 Jul 1992 14:36:46 NED
+ * Incorporated Skateboard and BigWheel changed into Graceful Red code,
+ * including MTF4.0 translator support, adding 3.1 file-system structures
+ * support to the 3.1 translator, additions to GOS to support non-4.0 translators.
+ *
+ * Rev 1.2 25 Mar 1992 20:47:24 GREGG
+ * ROLLER BLADES - Changed prototype for ProcessDataFilter.
+ *
+ * Rev 1.1 10 May 1991 14:25:26 GREGG
+ * Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:17:46 GREGG
+Initial revision.
+
+**/
+
+#ifndef FMT_UTILS
+#define FMT_UTILS
+
+/* A Useful Macro */
+
+/* Size required to pad the size x to the boundary bnd */
+#define PadToBoundary( x, bnd ) ( ( (bnd) - ( (x) % (bnd) ) ) % (bnd) )
+
+/* Define constants used in block conversion */
+#define NO_MORE_CNV 0
+#define CNV 0x8000
+
+#define SIZE_WORD 0x4000
+#define SIZE_DWORD 0x2000
+#define SIZE_DATE_TIME 0x1000
+#define MASK_UNUSED ( CNV | SIZE_WORD | SIZE_DWORD | SIZE_DATE_TIME )
+
+/* Prototypes for the Translate Utilities */
+
+UINT16 CalcChecksum( UINT16_PTR start_ptr, UINT16 length ) ;
+VOID SwapBlock( UINT16_PTR fmt_blk, UINT8_PTR data_blk ) ;
+VOID ProcessDataFilter( CHANNEL_PTR, UINT16 ) ;
+UINT16 F25_Chksm( CHAR_PTR ptr, UINT16 siz ) ;
+INT16 AllocChannelTmpBlks( CHANNEL_PTR channel, UINT size ) ;
+
+/* string replacement routines */
+INT16 cstrcmp( UINT8_PTR, UINT8_PTR );
+UINT8_PTR cstrcpy( UINT8_PTR, UINT8_PTR );
+UINT16 cstrlen( UINT8_PTR );
+UINT8_PTR cstrncat( UINT8_PTR, UINT8_PTR, UINT16 );
+INT16 cstrncmp( UINT8_PTR, UINT8_PTR, UINT16 );
+UINT8_PTR cstrncpy( UINT8_PTR, UINT8_PTR, UINT16 );
+
+#endif
diff --git a/private/utils/ntbackup/inc/tsearch.h b/private/utils/ntbackup/inc/tsearch.h
new file mode 100644
index 000000000..3d4f06224
--- /dev/null
+++ b/private/utils/ntbackup/inc/tsearch.h
@@ -0,0 +1,44 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: tsearch.h
+
+ Description: include file for the tsearch.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/TSEARCH.H_V $
+
+ Rev 1.5 27 Apr 1993 18:04:04 KEVINS
+Enhanced catalog searching with password, subdirectories, and max number of hits.
+
+ Rev 1.4 04 Oct 1992 19:49:48 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.3 06 Apr 1992 09:53:40 CHUCKB
+Added define for translation.
+
+ Rev 1.2 03 Apr 1992 13:56:42 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SEARCHTAPE 24
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_ST_TAPE 0x00C9
+#define IDD_ST_PATH 0x006B
+#define IDD_ST_FILE 0x006C
+#define IDD_ST_PROMPT_PASSW 0x006E
+#define IDD_ST_MAX_RESULTS 0x006D
+#define IDD_ST_SPINNERBOX 0x0076
+#define IDD_ST_SKIP_PASSW_PROT_TAPES 0x001A
+#define IDD_ST_SRCH_SUBDIRS 0x001C
+#define IDD_ST_SRCH_PASSW_PROT_TAPES 0x001D
diff --git a/private/utils/ntbackup/inc/unic_io.h b/private/utils/ntbackup/inc/unic_io.h
new file mode 100644
index 000000000..ef1f49218
--- /dev/null
+++ b/private/utils/ntbackup/inc/unic_io.h
@@ -0,0 +1,883 @@
+/***
+*unic_io.h - Function prototypes for unicode-supporting io functions
+*
+* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
+* Copyright (c) 1992, Archive Software Division. All rights reserved.
+*
+*Purpose:
+* This file contains the funtion prototypes for unicode versions of various
+* MS C library file io routines. Each of these functions works identially
+* to thier MS library counterpart with the only exception that all char
+* and char * parameters and return values have been changed to wchar_t
+* and wchar_t *, respectively, except as otherwise noted.
+*
+* Also, if the UNICODE flag is set for transparent unicode support,
+* then for each of the function prototyped in this file, a mapping
+* macro is defined to map the standard ascii io routines to these
+* unicode versions. Eg.:
+*
+* #define fopen fopenW
+*
+* The following routines are prototyped in this file:
+*
+* _fsopenW
+* fopenW
+* _openfileW
+* _openW
+* _sopenW
+* _tempnamW
+* _chdir
+* _accessW
+* removeW
+* _unlinkW
+* _getcwdW
+* _getdcwdW
+* _getdcwdW_lk
+* _chmodW
+* _mkdirW
+* fgetsW
+* renameW
+* OpenFileW
+*
+*Revision History:
+* 10-12-92 DVC Archive Sofware Division. Created this file.
+*
+ $Log: N:/LOGFILES/UNIC_IO.H_V $
+
+ Rev 1.10 11 Jan 1993 08:48:48 STEVEN
+fix bugs from microsoft
+
+ Rev 1.9 21 Dec 1992 12:28:22 DAVEV
+Enabled for Unicode - IT WORKS!!
+
+ Rev 1.8 14 Dec 1992 12:37:22 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.7 15 Nov 1992 17:42:46 MIKEP
+fixes
+
+ Rev 1.0 15 Nov 1992 17:42:36 MIKEP
+fixes
+
+ Rev 1.6 13 Nov 1992 16:36:14 DAVEV
+fixes, remove dependency on MS internal headers
+
+ Rev 1.5 12 Nov 1992 12:17:16 DAVEV
+added mapping macro for OpenFile
+
+ Rev 1.4 12 Nov 1992 12:10:02 DAVEV
+only define OpenFileW if WINBASE.H is included
+
+ Rev 1.3 12 Nov 1992 10:13:10 DAVEV
+added OpenFileW
+
+ Rev 1.2 12 Nov 1992 09:58:14 DAVEV
+added removeW
+
+ Rev 1.1 11 Nov 1992 18:18:00 DAVEV
+UNICODE changes
+
+ Rev 1.0 16 Oct 1992 16:33:26 DAVEV
+Initial revision.
+
+*******************************************************************************/
+
+#ifndef UNIC_IO_INCL
+#define UNIC_IO_INCL
+
+#ifndef _CRTAPI1
+#define _CRTAPI1
+#endif
+
+#ifndef _CRTAPI2
+#define _CRTAPI2
+#endif
+
+#if !defined( WCHAR_T_DEFINED ) && !defined( OS_WIN32 )
+typedef unsigned short wchar_t;
+#define WCHAR_T_DEFINED
+#endif
+
+/***
+*FILE *_fsopenW(file, mode, shflag) - open a file
+*
+*Purpose:
+* Opens the file specified as a stream. mode determines file mode:
+* "r": read "w": write "a": append
+* "r+": read/write "w+": open empty for read/write
+* "a+": read/append
+* Append "t" or "b" for text and binary mode. shflag determines the
+* sharing mode. Values are the same as for sopen().
+*
+*Entry:
+* wchar_t *file - file name to open
+* wchar_t *mode - mode of file access
+*
+*Exit:
+* returns pointer to stream
+* returns NULL if fails
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+#ifdef _INC_STDIO
+
+FILE * _CRTAPI1 _fsopenW (
+ const wchar_t *file,
+ const wchar_t *mode
+#ifndef _POSIX_
+ ,int shflag
+#endif
+ );
+
+#endif //_INC_STDIO
+
+/***
+*FILE *fopenW(file, mode) - open a file
+*
+*Purpose:
+* Opens the file specified as a stream. mode determines file mode:
+* "r": read "w": write "a": append
+* "r+": read/write "w+": open empty for read/write
+* "a+": read/append
+* Append "t" or "b" for text and binary mode
+*
+*Entry:
+* wchar_t *file - file name to open
+* wchar_t *mode - mode of file access
+*
+*Exit:
+* returns pointer to stream
+* returns NULL if fails
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+#ifdef _INC_STDIO
+FILE * UNI_fopen( wchar_t *fname, unsigned long flags ) ;
+#endif // _INC_STDIO
+
+/***
+*FILE *_openfileW(filename, mode, shflag, stream) - open a file with string
+* mode and file sharing flag.
+*
+*Purpose:
+* parse the string, looking for exactly one of {rwa}, at most one '+',
+* at most one of {tb} and at most one of {cn}. pass the result on as
+* an int containing flags of what was found. open a file with proper
+* mode if permissions allow. buffer not allocated until first i/o call
+* is issued. intended for use inside library only
+*
+*Entry:
+* wchar_t *filename - file to open
+* wchar_t *mode - mode to use (see above)
+* int shflag - file sharing flag
+* FILE *stream - stream to use for file
+*
+*Exit:
+* set stream's fields, and causes system file management by system calls
+* returns stream or NULL if fails
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+#ifdef _INC_STDIO
+
+FILE * _CRTAPI1 _openfileW (
+ const wchar_t *filename,
+ const wchar_t *mode,
+#ifndef _POSIX_
+ int shflag,
+#endif
+ FILE *str
+ );
+#endif // _INC_STDIO
+
+/***
+*int _openW(path, flag, pmode) - open or create a file
+*
+*Purpose:
+* Opens the file and prepares for subsequent reading or writing.
+* the flag argument specifies how to open the file:
+* _O_APPEND - reposition file ptr to end before every write
+* _O_BINARY - open in binary mode
+* _O_CREAT - create a new file* no effect if file already exists
+* _O_EXCL - return error if file exists, only use with O_CREAT
+* _O_RDONLY - open for reading only
+* _O_RDWR - open for reading and writing
+* _O_TEXT - open in text mode
+* _O_TRUNC - open and truncate to 0 length (must have write permission)
+* _O_WRONLY - open for writing only
+* _O_NOINHERIT -handle will not be inherited by child processes.
+* exactly one of _O_RDONLY, _O_WRONLY, _O_RDWR must be given
+*
+* The pmode argument is only required when _O_CREAT is specified. Its
+* flag settings:
+* _S_IWRITE - writing permitted
+* _S_IREAD - reading permitted
+* _S_IREAD | _S_IWRITE - both reading and writing permitted
+* The current file-permission maks is applied to pmode before
+* setting the permission (see umask).
+*
+* The oflag and mode parameter have different meanings under DOS. See
+* the A_xxx attributes in msdos.inc
+*
+* Note, the _creat() function also uses this function but setting up the
+* correct arguments and calling _openW(). _creat() sets the __creat_flag
+* to 1 prior to calling _openW() so _openW() can return correctly. _openW()
+* returns the file handle in eax in this case.
+*
+*Entry:
+* wchar_t *path - file name
+* int flag - flags for _openW()
+* int pmode - permission mode for new files
+*
+*Exit:
+* returns file handle of open file if successful
+* returns -1 (and sets errno) if fails
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CRTAPI2 _openW (
+ const wchar_t *path,
+ int oflag,
+ ...
+ );
+
+/***
+*int _sopenW(path, oflag, shflag, pmode) - opne a file with sharing
+*
+*Purpose:
+* Opens the file with possible file sharing.
+* shflag defines the sharing flags:
+* _SH_COMPAT - set compatability mode
+* _SH_DENYRW - deny read and write access to the file
+* _SH_DENYWR - deny write access to the file
+* _SH_DENYRD - deny read access to the file
+* _SH_DENYNO - permit read and write access
+*
+* Other flags are the same as _openW().
+*
+* SOPEN is the routine used when file sharing is desired.
+*
+*Entry:
+* wchar_t *path - file to open
+* int oflag - open flag
+* int shflag - sharing flag
+* int pmode - permission mode (needed only when creating file)
+*
+*Exit:
+* returns file handle for the opened file
+* returns -1 and sets errno if fails.
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CRTAPI2 _sopenW (
+ const wchar_t *path,
+ int oflag,
+ int shflag,
+ ...
+ );
+
+
+/***
+*wchar_t *_tempnamW(dir, prefix) - create unique file name using Unicode strings
+*
+*Purpose:
+* Create a file name that is unique in the specified directory.
+* The semantics of directory specification is as follows:
+* Use the directory specified by the TMP environment variable
+* if that exists, else use the dir argument if non-NULL, else
+* use _P_tmpdir if that directory exists, else use the current
+* working directory), else return NULL.
+*
+*Entry:
+* wchar_t *dir - directory to be used for temp file if TMP env var
+* not set
+* wchar_t *prefix - user provided prefix for temp file name
+*
+*Exit:
+* returns ptr to constructed file name if successful
+* returns NULL if unsuccessful
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+wchar_t * _CRTAPI1 _tempnamW (
+ wchar_t *dir,
+ wchar_t *pfx
+ );
+/***
+*int _chdirW(path) - change current directory
+*
+*Purpose:
+* Changes the current working directory to that given in path.
+*
+*Entry:
+* wchar_t *path - directory to change to
+*
+*Exit:
+* returns 0 if successful,
+* returns -1 and sets errno if unsuccessful
+*
+*Exceptions:
+* This function updates the environment with a MBCS string rather than a
+* unicode string because the C environ[] does not support unicode. This
+* needs to be fixed in the future
+*
+*******************************************************************************/
+
+int _CRTAPI1 _chdirW(
+ const wchar_t *path
+ );
+
+/***
+*int _accessW(path, amode) - check whether file can be accessed under mode
+*
+*Purpose:
+* Checks to see if the specified file exists and can be accessed
+* in the given mode.
+*
+*Entry:
+* wchar_t *path - pathname
+* int amode - access mode
+* (0 = exist only, 2 = write, 4 = read, 6 = read/write)
+*
+*Exit:
+* returns 0 if file has given mode
+* returns -1 and sets errno if file does not have given mode or
+* does not exist
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CRTAPI1 _accessW (
+ const wchar_t *path,
+ int amode
+ );
+
+/***
+*int _unlinkW(path) - unlink(delete) the given file
+*
+*Purpose:
+* This version deletes the given file because there are no
+* links under OS/2.
+*
+* NOTE: removeW() is an alternative entry point to the _unlinkW()
+* routine* interface is identical.
+*
+*Entry:
+* wchar_t *path - file to unlink/delete
+*
+*Exit:
+* returns 0 if successful
+* returns -1 and sets errno if unsuccessful
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CRTAPI1 removeW (
+ const wchar_t *path
+ );
+
+int _CRTAPI1 _unlinkW (
+ const wchar_t *path
+ );
+
+
+/***
+*wchar_t *_getcwdW(pnbuf, maxlen) - get current working directory of default drive
+*
+*Purpose:
+* _getcwdW gets the current working directory for the user,
+* placing it in the buffer pointed to by pnbuf. It returns
+* the length of the string put in the buffer. If the length
+* of the string exceeds the length of the buffer, maxlen,
+* then NULL is returned. If pnbuf = NULL, maxlen is ignored.
+* An entry point "_getdcwd()" is defined with takes the above
+* parameters, plus a drive number. "_getcwd()" is implemented
+* as a call to "_getcwd()" with the default drive (0).
+*
+* If pnbuf = NULL, maxlen is ignored, and a buffer is automatically
+* allocated using malloc() -- a pointer to which is returned by
+* _getcwd().
+*
+* side effects: no global data is used or affected
+*
+*Entry:
+* wchar_t *pnbuf = pointer to a buffer maintained by the user;
+* int maxlen = character length of the buffer pointed to by pnbuf;
+*
+*Exit:
+* Returns pointer to the buffer containing the c.w.d. name
+* (same as pnbuf if non-NULL; otherwise, malloc is
+* used to allocate a buffer)
+* or NULL and set errno if not sucessfull
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+
+wchar_t * _CRTAPI1 _getcwdW (
+ wchar_t *pnbuf,
+ int maxlen
+ );
+
+/***
+*wchar_t *_getdcwdW(drive, pnbuf, maxlen) - get c.w.d. for given drive
+*
+*Purpose:
+* _getdcwdW gets the current working directory for the user,
+* placing it in the buffer pointed to by pnbuf. It returns
+* the length of the string put in the buffer. If the length
+* of the string exceeds the length of the buffer, maxlen,
+* then NULL is returned. If pnbuf = NULL, maxlen is ignored,
+* and a buffer is automatically allocated using malloc() --
+* a pointer to which is returned by _getdcwdW().
+*
+* side effects: no global data is used or affected
+*
+*Entry:
+* int drive - number of the drive being inquired about
+* 0 = default, 1 = 'a:', 2 = 'b:', etc.
+* wchar_t *pnbuf - pointer to a buffer maintained by the user;
+* int maxlen - length in characters of the buffer pointed to by pnbuf;
+*
+*Exit:
+* Returns pointer to the buffer containing the c.w.d. name
+* (same as pnbuf if non-NULL; otherwise, malloc is
+* used to allocate a buffer)
+* or NULL and set errno if not sucessfull
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+
+wchar_t * _CRTAPI1 _getdcwdW (
+ int drive,
+ wchar_t *pnbuf,
+ int maxlen
+ );
+
+#ifdef MTHREAD
+
+wchar_t * _CRTAPI1 _getdcwdW_lk (
+ int drive,
+ wchar_t *pnbuf,
+ int maxlen
+ );
+
+#else
+
+#define _getdcwdW_lk _getdcwdW
+
+#endif //MTHREAD
+/***
+*int _chmodW(path, mode) - change file mode
+*
+*Purpose:
+* Changes file mode permission setting to that specified in
+* mode. The only XENIX mode bit supported is user write.
+*
+*Entry:
+* wchar_t *path - file name
+* int mode - mode to change to
+*
+*Exit:
+* returns 0 if successful
+* returns -1 and sets errno if not successful
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CRTAPI1 _chmodW (
+ const wchar_t *path,
+ int mode
+ );
+
+/***
+*int _mkdirW(path) - make a directory
+*
+*Purpose:
+* creates a new directory with the specified name
+*
+*Entry:
+* wchar_t *path - name of new directory
+*
+*Exit:
+* returns 0 if successful
+* returns -1 and sets errno if unsuccessful
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CRTAPI1 _mkdirW (
+ const wchar_t *path
+ );
+
+/***
+*long atolW(wchar_t *nptr) - Convert a unicode string to long
+*
+*Purpose:
+* Converts Unicode string pointed to by nptr to binary.
+* Overflow is not detected.
+* Only works with Latin digits
+*
+*Entry:
+* nptr = ptr to string to convert
+*
+*Exit:
+* return long int value of the string
+*
+*Exceptions:
+* None - overflow is not detected.
+*
+*******************************************************************************/
+
+long _CRTAPI1 atolW(
+ const wchar_t *nptr
+ );
+
+/***
+*int atoiW(wchar_t *nptr) - Convert a Unicode string to long
+*
+*Purpose:
+* Converts Unicode string pointed to by nptr to binary.
+* Overflow is not detected. Because of this, we can just use
+* atolW().
+*
+*Entry:
+* nptr = ptr to string to convert
+*
+*Exit:
+* return int value of the string
+*
+*Exceptions:
+* None - overflow is not detected.
+*
+*******************************************************************************/
+
+int _CRTAPI1 atoiW(
+ const wchar_t *nptr
+ );
+
+/***
+*wchar_t *fgetsW(string, count, stream) - input string from a stream
+*
+*Purpose:
+* get a string, up to count-1 chars or '\n', whichever comes first,
+* append '\0' and put the whole thing into string. the '\n' IS included
+* in the string. if count<=1 no input is requested. if WEOF is found
+* immediately, return NULL. if WEOF found after chars read, let WEOF
+* finish the string as '\n' would.
+*
+*Entry:
+* wchar_t *string - pointer to place to store string
+* int count - max characters to place at string (include \0)
+* FILE *stream - stream to read from
+*
+*Exit:
+* returns string with text read from file in it.
+* if count <= 0 return NULL
+* if count == 1 put null string in string
+* returns NULL if error or end-of-file found immediately
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+#ifdef _INC_STDIO
+
+wchar_t * _CRTAPI1 fgetsW (
+ wchar_t *string,
+ int count,
+ FILE *str
+ );
+
+#endif // _INC_STDIO
+
+/***
+*int renameW(oldname, newname) - rename a file
+*
+*Purpose:
+* Renames a file to a new name -- no file with new name must
+* currently exist.
+*
+*Entry:
+* wchar_t *oldname - name of file to rename
+* wchar_t *newname - new name for file
+*
+*Exit:
+* returns 0 if successful
+* returns not 0 and sets errno if not successful
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CRTAPI1 renameW (
+ const wchar_t *oldname,
+ const wchar_t *newname
+ );
+
+/***
+*HFILE OpenFileW ( lpFileName, lpReOpenBuff, uStyle )
+*
+*Purpose:
+* Kludged Unicode version of OpenFile. Do not use unless necessary.
+*
+*Entry:
+* LPCWSTR lpFileName - name of file to open
+* LPOPSTRUCT lpReOpenBuff - open file info buffer
+* UINT uStyle - style flags - See docs on OpenFile for more info
+*
+*Exit:
+* returns NULL if not successful. Use GetLastError for error code.
+* returns HFILE file handle on success.
+*
+*Exceptions:
+*
+* Will not handle all unicode characters properly due to mapping
+* problems between ANSI multibyte chars and Unicode. Use CreateFile,
+* fopenW(), etc., instead of this function if at all possible.
+*
+*******************************************************************************/
+#ifdef _WINBASE_ //already integrated into version control!!
+HFILE WINAPI OpenFileW(
+ LPCWSTR lpFileName,
+ LPOFSTRUCT lpReOpenBuff,
+ UINT uStyle
+ );
+#endif
+
+/***
+*char *_itoax, *_ltoax, *_ultoax(val, buf, radix) - convert binary int to Unicode
+* string
+*
+*Purpose:
+* Converts an int to a character string.
+*
+*Entry:
+* val - number to be converted (int, long or unsigned long)
+* int radix - base to convert into
+* wchar_t *buf - ptr to buffer to place result
+*
+*Exit:
+* fills in space pointed to by buf with string result
+* returns a pointer to this buffer
+*
+*Exceptions:
+*
+*******************************************************************************/
+wchar_t * _CRTAPI1 _itoaW (
+ int val,
+ wchar_t *buf,
+ int radix
+ );
+
+wchar_t * _CRTAPI1 _ltoaW (
+ long val,
+ wchar_t *buf,
+ int radix
+ );
+
+wchar_t * _CRTAPI1 _ultoaW (
+ unsigned long val,
+ wchar_t *buf,
+ int radix
+ );
+
+/*********************************************************************/
+/* TRANSPARENT UNICODE I/O FUNCTION MAPPINGS */
+/*********************************************************************/
+
+#if defined( UNICODE ) && !defined( NO_STRING_REMAPPING )
+
+#define atoi atoiW
+#define atol atolW
+#define _fsopen _fsopenW
+#define fopen fopenW
+#define fgets fgetsW
+#define _openfile _openfileW
+#define _open _openW
+#define _sopen _sopenW
+#define _tempnam _tempnamW
+#define _chdir _chdirW
+#define _access _accessW
+#define remove removeW
+#define _unlink _unlinkW
+#define _getcwd _getcwdW
+#define _getdcwd _getdcwdW
+#define _getdcwd_lk _getdcwdW_lk
+#define _chmod _chmodW
+#define _mkdir _mkdirW
+#define rename renameW
+#define OpenFile OpenFileW // already integrated to vcs
+#define _itoa _itoaW
+#define _ltoa _ltoaW
+#define _ultoa _ultoaW
+
+#define openfile _openfileW
+#define open _openW
+#define sopen _sopenW
+#define tempnam _tempnamW
+#define chdir _chdirW
+#define access _accessW
+#define remove removeW
+#define unlink _unlinkW
+#define getcwd _getcwdW
+#define getdcwd _getdcwdW
+#define getdcwd_lk _getdcwdW_lk
+#define chmod _chmodW
+#define mkdir _mkdirW
+#define itoa _itoaW
+#define ltoa _ltoaW
+#define ultoa _ultoaW
+
+#endif // UNICODE
+
+/*********************************************************************/
+/* DEFINES FROM MS INTERNAL HEADERS WHICH WE REQUIRE */
+/*********************************************************************/
+
+#ifdef INCL_MS_INTERNALS
+
+// from MS's internal version of IO.H....
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+int _CRTAPI1 _chsize_lk(int,long); /* _MTHREAD_ONLY */
+int _CRTAPI1 _close_lk(int); /* _MTHREAD_ONLY */
+long _CRTAPI1 _lseek_lk(int, long, int); /* _MTHREAD_ONLY */
+int _CRTAPI1 _setmode_lk(int, int); /* _MTHREAD_ONLY */
+int _CRTAPI1 _read_lk(int, void *, unsigned int); /* _MTHREAD_ONLY */
+int _CRTAPI1 _write_lk(int, const void *, unsigned int); /* _MTHREAD_ONLY */
+#else /* not MTHREAD */ /* _MTHREAD_ONLY */
+#define _chsize_lk(fh,size) _chsize(fh,size) /* _MTHREAD_ONLY */
+#define _close_lk(fh) _close(fh) /* _MTHREAD_ONLY */
+#define _lseek_lk(fh,offset,origin) _lseek(fh,offset,origin) /* _MTHREAD_ONLY */
+#define _setmode_lk(fh,mode) _setmode(fh,mode) /* _MTHREAD_ONLY */
+#define _read_lk(fh,buff,count) _read(fh,buff,count) /* _MTHREAD_ONLY */
+#define _write_lk(fh,buff,count) _write(fh,buff,count) /* _MTHREAD_ONLY */
+#endif /* _MTHREAD_ONLY */
+
+// from MS's internal version of STDIO.H...
+#define _getc_lk(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) /* _MTHREAD_ONLY */
+
+/// from MS's internal version of STDLIB.H
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+char * _CRTAPI1 _getenv_lk(const char *); /* _MTHREAD_ONLY */
+int _CRTAPI1 _putenv_lk(const char *); /* _MTHREAD_ONLY */
+#else /* _MTHREAD_ONLY */
+#define _getenv_lk(envvar) getenv(envvar) /* _MTHREAD_ONLY */
+#define _putenv_lk(envvar) _putenv(envvar) /* _MTHREAD_ONLY */
+#endif
+
+// from OS2DLL.H...
+#define _ENV_LOCK 12 /* lock for environment variables */
+#define _TMPNAM_LOCK 3 /* lock global tempnam variables */
+
+#ifdef MTHREAD
+void _CRTAPI2 _lock(int);
+void _CRTAPI2 _unlock_stream(int);
+#define _STREAM_LOCKS 29 /* Table of stream locks */
+#define _lock_str(s) _lock(s+_STREAM_LOCKS)
+#define _unlock_str(s) _unlock_stream(s)
+#define _mlock(l) _lock(l)
+#define _munlock(l) _unlock(l)
+#define _lock_fh(fh) _lock(fh+_FH_LOCKS)
+#define _unlock_fh(fh) _unlock(fh+_FH_LOCKS)
+#else
+#define _lock_str(s)
+#define _unlock_str(s)
+#define _mlock(l)
+#define _munlock(l)
+#define _lock_fh(fh)
+#define _unlock_fh(fh)
+#endif
+
+
+// from FILE2.H...
+#define _IOCOMMIT 0x4000
+
+// from INTERNAL.H...
+#ifdef _DLL
+#define _commode (*_commode_dll)
+extern int * _commode_dll;
+#else
+#ifdef CRTDLL
+#define _commode _commode_dll
+#endif
+extern int _commode;
+#endif
+extern int _cflush;
+extern int _umaskval; /* the umask value */
+extern char _osfile[];
+extern unsigned int _old_pfxlen;
+extern unsigned int _tempoff;
+extern void _CRTAPI1 _dosmaperr(unsigned long);
+
+#ifdef _INC_STDIO
+FILE * _CRTAPI1 _getstream(void);
+#endif //_INC_STDIO
+
+extern int _CRTAPI1 _ValidDrive(unsigned);
+int _CRTAPI1 _alloc_osfhnd(void);
+int _CRTAPI1 _free_osfhnd(int);
+int _CRTAPI1 _set_osfhnd(int,long);
+
+// from MSDOS.H...
+#define FOPEN 0x01 /* file handle open */
+#define FEOFLAG 0x02 /* end of file has been encountered */
+#define FCRLF 0x04 /* CR-LF across read buffer (in text mode) */
+#define FPIPE 0x08 /* file handle refers to a pipe */
+
+#ifndef _WIN32_
+#define FRDONLY 0x10 /* file handle associated with read only file */
+#endif
+
+#define FAPPEND 0x20 /* file handle opened O_APPEND */
+#define FDEV 0x40 /* file handle refers to device */
+#define FTEXT 0x80 /* file handle is in text mode */
+
+/* DOS errno values for setting __doserrno in C routines */
+
+#define E_ifunc 1 /* invalid function code */
+#define E_nofile 2 /* file not found */
+#define E_nopath 3 /* path not found */
+#define E_toomany 4 /* too many open files */
+#define E_access 5 /* access denied */
+#define E_ihandle 6 /* invalid handle */
+#define E_arena 7 /* arena trashed */
+#define E_nomem 8 /* not enough memory */
+#define E_iblock 9 /* invalid block */
+#define E_badenv 10 /* bad environment */
+#define E_badfmt 11 /* bad format */
+#define E_iaccess 12 /* invalid access code */
+#define E_idata 13 /* invalid data */
+#define E_unknown 14 /* ??? unknown error ??? */
+#define E_idrive 15 /* invalid drive */
+#define E_curdir 16 /* current directory */
+#define E_difdev 17 /* not same device */
+#define E_nomore 18 /* no more files */
+#define E_maxerr2 19 /* unknown error - Version 2.0 */
+#define E_sharerr 32 /* sharing violation */
+#define E_lockerr 33 /* locking violation */
+#define E_maxerr3 34 /* unknown error - Version 3.0 */
+
+#endif // INCL_MS_INTERNALS
+#endif //UNIC_IO_INCL
diff --git a/private/utils/ntbackup/inc/use_sel.h b/private/utils/ntbackup/inc/use_sel.h
new file mode 100644
index 000000000..a7e725c8d
--- /dev/null
+++ b/private/utils/ntbackup/inc/use_sel.h
@@ -0,0 +1,30 @@
+/*******************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+
+ Name: use_sel.h
+
+ Description: include file for the use_sel.dlg dialog
+
+
+ $Log: G:/UI/LOGFILES/USE_SEL.H_V $
+
+ Rev 1.5 04 Oct 1992 19:49:50 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.4 03 Apr 1992 13:58:38 CARLS
+added translate defines
+
+ Rev 1.0 20 Nov 1991 19:34:42 SYSTEM
+Initial revision.
+
+*******************************************************************************/
+
+#ifdef TRANSLATE
+#define IDHELP 100
+#define IDD_SELECTUSE 5
+#else
+#include "dlg_ids.h"
+#endif
+
+#define IDD_SAVE_FLIST 0x006C
diff --git a/private/utils/ntbackup/inc/vlm.h b/private/utils/ntbackup/inc/vlm.h
new file mode 100644
index 000000000..6697bbe0c
--- /dev/null
+++ b/private/utils/ntbackup/inc/vlm.h
@@ -0,0 +1,805 @@
+/************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: vlm.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the VLM code.
+
+ $Log: G:\UI\LOGFILES\VLM.H_V $
+
+ Rev 1.73.1.1 08 Dec 1993 10:48:32 MikeP
+very deep path support
+
+ Rev 1.73.1.0 01 Dec 1993 14:11:20 mikep
+add SQL recognition support to poll drive
+
+ Rev 1.73 29 Jul 1993 15:02:24 MIKEP
+add sms bit
+
+ Rev 1.72 23 Jul 1993 15:34:32 MIKEP
+
+ Rev 1.71 19 Jul 1993 21:07:20 MIKEP
+
+ Rev 1.70 08 Jun 1993 11:13:34 CARLS
+removed prototype for VLM_GetFirstSSETAttribute
+
+ Rev 1.69 27 May 1993 15:37:40 CARLS
+Added prototype for VLM_GetFirstSSETonTapeAttribute
+called by DO_BACK.C
+
+ Rev 1.68 20 May 1993 17:22:18 KEVINS
+Removed VLM_RefreshDLE. Use VLM_Refresh which already existed.
+
+ Rev 1.67 12 May 1993 17:58:52 KEVINS
+Added VLM_RefreshDLE.
+
+ Rev 1.66 12 May 1993 08:25:26 MIKEP
+Add a tape macro.
+
+ Rev 1.65 03 May 1993 16:12:22 MIKEP
+Put focus on tape that is currently in drive.
+
+ Rev 1.64 02 May 1993 17:37:10 MIKEP
+add call to support catalog data path changing.
+
+ Rev 1.63 01 May 1993 16:27:56 MIKEP
+Fix case support for trees. Add SLM_GetOriginalName() macros. Goes with
+vlm_refr.c and vlm_tree.c
+
+ Rev 1.62 28 Apr 1993 16:27:26 CARLS
+added VLM_DRIVE_FAILURE
+
+ Rev 1.61 26 Apr 1993 08:33:50 MIKEP
+Changed calls and added new ones to support the refresh tapes window
+stuff needed for cayman. These changes require you to pick up the
+following files: vlm_bset, vlm_cat, vlm_menu, vlm_poll, vlm_strt,
+d_cmaint, ..., you get the idea.
+
+ Rev 1.59 23 Apr 1993 10:21:08 MIKEP
+Add call prototype for refreshing sort of files window.
+
+ Rev 1.58 05 Apr 1993 13:57:14 DARRYLP
+Initial prep work to add Email into Cayman.
+
+ Rev 1.57 01 Apr 1993 17:59:40 GLENN
+Added VLM_IsInfoAvailable().
+
+ Rev 1.56 01 Apr 1993 16:12:40 MIKEP
+add display info call
+
+ Rev 1.55 10 Mar 1993 12:54:52 CARLS
+Changes to move Format tape to the Operations menu
+
+
+**************************/
+
+#ifndef VLM_H
+#define VLM_H
+
+
+
+#define VLM_MAX_VOL_LABEL 50
+
+// NOT the file name size, refers to the length of the string that the
+// file size number is stored in.
+
+#define FLM_MAX_FILE_SIZE 15
+
+// max string for storing the bset number in.
+
+#define BSET_MAX_NUM_SIZE 10
+
+// Create typedefs I can spell
+
+#define WININFO_PTR PDS_WMINFO
+#define WININFO DS_WMINFO
+
+// Used for path and title construction
+
+#define VLM_BUFFER_SIZE 512
+
+// GetDriveStatus defines
+
+#define VLM_VALID_TAPE 0
+#define VLM_DRIVE_BUSY 1
+#define VLM_FOREIGN_TAPE 2
+#define VLM_BLANK_TAPE 3
+#define VLM_NO_TAPE 4
+#define VLM_BUSY 5
+#define VLM_BAD_TAPE 6
+#define VLM_GOOFY_TAPE 7 // QicStream tape, info at end of data
+#define VLM_DISABLED 8
+#define VLM_UNFORMATED 9 // DC2000 tape
+#define VLM_DRIVE_FAILURE 10
+#define VLM_FUTURE_VER 11
+#define VLM_ECC_TAPE 12
+#define VLM_SQL_TAPE 13
+
+
+// VLM status bytes defines
+
+#define INFO_VALID 0x00000001 // have we checked for subdirectories
+#define INFO_EXPAND 0x00000002 // is it expanded
+#define INFO_TAGGED 0x00000004 // is it tagged
+#define INFO_SELECT 0x00000008 // is it selected
+#define INFO_DISPLAY 0x00000010 // is it displayed
+#define INFO_SUBS 0x00000020 // does he have subdirectories
+#define INFO_PARTIAL 0x00000040 // partially selected
+#define INFO_OPEN 0x00000080 // current open directory
+#define INFO_ISADIR 0x00000100 // is a directory
+#define INFO_EXEFILE 0x00000200 // icon type for flm
+#define INFO_TAPE 0x00000400 // flm/slm is from a tape
+#define INFO_CORRUPT 0x00000800 // it's corrupt
+#define INFO_IMAGE 0x00008000 // image backup set
+#define INFO_OLD 0x00004000 // used during refresh call only
+#define INFO_NEW 0x00002000 // used during refresh call only
+#define INFO_EMPTY 0x00001000 // no files in this directory
+#define INFO_FLOPPY 0x00010000 // a floppy backup
+#define INFO_FATDRIVE 0x00020000 // set is from a FAT drive
+#define INFO_FUTURE_VER 0x00040000 // set is from future version of software
+#define INFO_ENCRYPTED 0x00080000 // set is encrypted on tape
+#define INFO_COMPRESSED 0x00100000 // set is compressed on tape
+#define INFO_SMS 0x00200000 // set is from SMS
+
+
+
+// Drive definitions
+
+#define DRIVE_NOT_THERE 0
+#define DRIVE_GONE 1
+#define DRIVE_THERE 2
+#define DRIVE_READONLY 3
+#define DRIVE_WRITEABLE 4
+
+// Network shared drive error list...
+
+#define VLM_NET_GOOD 0x01 // Good, consistent connection
+#define VLM_NOT_ALL_THERE 0x02 // Not all connections were available at initiation
+#define VLM_DROPPED_LINE 0x04 // Connections were dropped during a backup
+#define VLM_NET_READONLY 0x08 // One or more of the connections is readonly
+#define VLM_BACKUP_ABORTED 0x10 // The backup was aborted prior to completion
+
+#ifdef OEM_EMS
+// ... MSNET specific
+
+#define NET_NONE 0x0000
+
+#define MAIL_TYPE_UNKNOWN 0x0000
+
+#define VLM_XCHG_ROOT 0x0001
+#define VLM_XCHG_ENTERPRISE 0x0002
+#define VLM_XCHG_SITE 0x0003
+#define VLM_XCHG_SERVER 0x0004
+#define VLM_XCHG_DSA 0x0005
+#define VLM_XCHG_MDB 0x0006
+
+// Mail family values
+
+#define VIEWXCHG_UNKNOWN 0
+#define VIEWXCHG_EXCHANGE 1
+
+#endif
+
+// A fast way to get at the Primary windows
+
+extern HWND gb_tapes_win;
+extern HWND gb_disks_win;
+extern HWND gb_servers_win;
+extern HWND gb_search_win;
+
+#ifdef OEM_EMS
+extern Q_HEADER gq_exchange_win;
+#endif
+
+// VLM Macros
+
+#define VLM_GetLabel( x ) ( ( x )->label )
+#define VLM_GetName( x ) ( ( x )->name )
+#define VLM_GetStatus( x ) ( ( x )->status )
+#define VLM_GetParent( x ) ( ( x )->parent )
+#define VLM_GetChildren( x ) ( ( x )->children )
+#define VLM_GetXtraBytes( x ) ( ( x )->XtraBytes )
+
+#define VLM_SetLabel( x, y ) ( strcpy( ( x )->label, ( y ) ) )
+#define VLM_SetName( x, y ) ( strcpy( ( x )->name, ( y ) ) )
+#define VLM_SetStatus( x, y ) ( ( x )->status = ( y ) )
+#define VLM_SetParent( x, y ) ( ( x )->parent = ( y ) )
+#define VLM_SetXtraBytes( x, y ) ( ( x )->XtraBytes = ( y ) )
+
+// SLM Macros
+
+#define SLM_GetName( x ) ( ( x )->name )
+#define SLM_GetOriginalName( x ) ( ( x )->original_name )
+#define SLM_GetStatus( x ) ( ( x )->status )
+#define SLM_GetDate( x ) ( ( x )->date )
+#define SLM_GetTime( x ) ( ( x )->time )
+#define SLM_GetLevel( x ) ( ( x )->level )
+#define SLM_GetAttribute( x ) ( ( x )->attrib )
+#define SLM_GetXtraBytes( x ) ( ( x )->XtraBytes )
+#define SLM_GetBrothers( x ) ( ( x )->brothers )
+#define SLM_GetNextBrother( x ) ( ( x )->next_brother )
+
+#define SLM_SetName( x, y ) ( strcpy( ( x )->name, ( y ) ) )
+#define SLM_SetOriginalName( x, y ) ( strcpy( ( x )->original_name, ( y ) ) )
+#define SLM_SetStatus( x, y ) ( ( x )->status = ( y ) )
+#define SLM_SetDate( x, y ) ( ( x )->date = ( y ) )
+#define SLM_SetTime( x, y ) ( ( x )->time = ( y ) )
+#define SLM_SetLevel( x, y ) ( ( x )->level = ( y ) )
+#define SLM_SetAttribute( x, y ) ( ( x )->attrib = ( y ) )
+#define SLM_SetXtraBytes( x, y ) ( ( x )->XtraBytes = ( y ) )
+#define SLM_SetBrothers( x, y, n ) ( memcpy( ( x )->brothers, ( y ), ( n ) )
+#define SLM_SetNextBrother( x, y ) ( ( x )->next_brother = ( y ) )
+
+#ifdef OEM_EMS
+
+// Added to support the Exchange hierarchical window.
+
+#define SLM_GetFlags( x ) ( ( x )->flags )
+#define SLM_GetMailType( x ) ( ( x )->type )
+#define SLM_GetLabel( x ) ( ( x )->label )
+#define SLM_GetParent( x ) ( ( x )->parent )
+#define SLM_GetChildren( x ) ( ( x )->children )
+#define SLM_GetDle( x ) ( ( x )->dle )
+
+#define SLM_SetFlags( x, y ) ( ( x )->flags = ( y ) )
+#define SLM_SetMailType( x, y ) ( ( x )->type = ( y ) )
+#define SLM_SetLabel( x, y ) ( strcpy( ( x )->label, ( y ) ) )
+#define SLM_SetParent( x, y ) ( ( x )->parent = ( y ) )
+#define SLM_SetChildren( x, y ) ( ( x )->children = ( y ) )
+#define SLM_SetDle( x, y ) ( ( x )->dle = ( y ) )
+
+#endif // OEM_EMS
+
+// FLM Macros
+
+#define FLM_GetName( x ) ( ( x )->name )
+#define FLM_GetStatus( x ) ( ( x )->status )
+#define FLM_GetModDate( x ) ( ( x )->mod_date )
+#define FLM_GetModTime( x ) ( ( x )->mod_time )
+#define FLM_GetAccDate( x ) ( ( x )->acc_date )
+#define FLM_GetAccTime( x ) ( ( x )->acc_time )
+#define FLM_GetLevel( x ) ( ( x )->level )
+#define FLM_GetSize( x ) ( ( x )->size )
+#define FLM_GetAttribute( x ) ( ( x )->attrib )
+#define FLM_GetXtraBytes( x ) ( ( x )->XtraBytes )
+#define FLM_GetSizeString( x ) ( ( x )->size_str )
+#define FLM_GetAttribString( x ) ( ( x )->attrib_str )
+#define FLM_GetTimeString( x ) ( ( x )->time_str )
+#define FLM_GetDateString( x ) ( ( x )->date_str )
+#define FLM_GetMaxName( x ) ( ( x )->max_name )
+#define FLM_GetMaxDate( x ) ( ( x )->max_time )
+#define FLM_GetMaxTime( x ) ( ( x )->max_date )
+#define FLM_GetMaxAttr( x ) ( ( x )->max_attr )
+#define FLM_GetMaxSize( x ) ( ( x )->max_size )
+
+
+#define FLM_SetName( x, y ) ( strcpy( ( x )->name, ( y ) ) )
+#define FLM_SetStatus( x, y ) ( ( x )->status = ( y ) )
+#define FLM_SetModDate( x, y ) ( ( x )->mod_date = ( y ) )
+#define FLM_SetModTime( x, y ) ( ( x )->mod_time = ( y ) )
+#define FLM_SetAccDate( x, y ) ( ( x )->acc_date = ( y ) )
+#define FLM_SetAccTime( x, y ) ( ( x )->acc_time = ( y ) )
+#define FLM_SetLevel( x, y ) ( ( x )->level = ( y ) )
+#define FLM_SetSize( x, y ) ( ( x )->size = ( y ) )
+#define FLM_SetAttribute( x, y ) ( ( x )->attrib = ( y ) )
+#define FLM_SetXtraBytes( x, y ) ( ( x )->XtraBytes = ( y ) )
+#define FLM_SetSizeString( x, y ) ( strcpy( ( x )->size_str, ( y ) ) )
+#define FLM_SetAttribString( x, y ) ( strcpy( ( x )->attrib_str, ( y ) ) )
+#define FLM_SetDateString( x, y ) ( strcpy( ( x )->date_str, ( y ) ) )
+#define FLM_SetTimeString( x, y ) ( strcpy( ( x )->time_str, ( y ) ) )
+#define FLM_SetMaxName( x, y ) ( ( x )->max_name = ( y ) )
+#define FLM_SetMaxAttr( x, y ) ( ( x )->max_attr = ( y ) )
+#define FLM_SetMaxTime( x, y ) ( ( x )->max_time = ( y ) )
+#define FLM_SetMaxDate( x, y ) ( ( x )->max_date = ( y ) )
+#define FLM_SetMaxSize( x, y ) ( ( x )->max_size = ( y ) )
+
+// Tape Macros
+
+#define TAPE_GetBsetQueue( x ) ( ( x )->bset_list )
+#define TAPE_GetName( x ) ( ( x )->name )
+#define TAPE_GetFake( x ) ( ( x )->fake_tape )
+#define TAPE_GetCurrent( x ) ( ( x )->current )
+#define TAPE_GetStatus( x ) ( ( x )->status )
+#define TAPE_GetFID( x ) ( ( x )->tape_fid )
+#define TAPE_GetXtraBytes( x ) ( ( x )->XtraBytes )
+#define TAPE_GetMultiTape( x ) ( ( x )->multitape )
+#define TAPE_GetIsFloppy( x ) ( ( x )->status & INFO_FLOPPY )
+
+
+#define TAPE_SetName( x, y ) ( strcpy( ( x )->name, ( y ) ) )
+#define TAPE_SetFake( x, y ) ( ( x )->fake_tape = ( y ) )
+#define TAPE_SetCurrent( x, y ) ( ( x )->current = ( y ) )
+#define TAPE_SetStatus( x, y ) ( ( x )->status = ( y ) )
+#define TAPE_SetFID( x, y ) ( ( x )->tape_fid = ( y ) )
+#define TAPE_SetTapeNum( x, y ) ( ( x )->tape_num = ( y ) )
+#define TAPE_SetXtraBytes( x, y ) ( ( x )->XtraBytes = ( y ) )
+#define TAPE_SetMultiTape( x, y ) ( ( x )->multitape = ( y ) )
+
+
+// Bset Macros
+
+#define BSET_GetName( x ) ( ( x )->name )
+#define BSET_GetUserName( x ) ( ( x )->user_name )
+#define BSET_GetVolName( x ) ( ( x )->volume_name )
+#define BSET_GetTapeNumStr( x ) ( ( x )->tape_num_str )
+#define BSET_GetDateStr( x ) ( ( x )->date_str )
+#define BSET_GetTimeStr( x ) ( ( x )->time_str )
+#define BSET_GetBsetNumStr( x ) ( ( x )->bset_num_str )
+#define BSET_GetPassword( x ) ( ( x )->password )
+#define BSET_GetStatus( x ) ( ( x )->status )
+#define BSET_GetDate( x ) ( ( x )->backup_date )
+#define BSET_GetTime( x ) ( ( x )->backup_time )
+#define BSET_GetIncomplete( x ) ( ( x )->incomplete )
+#define BSET_GetFull( x ) ( ( x )->full )
+#define BSET_GetMissing( x ) ( ( x )->missing )
+#define BSET_GetBsetPswd( x ) ( ( x )->bset_password )
+#define BSET_GetBackupType( x ) ( ( x )->backup_type )
+#define BSET_GetPswdSize( x ) ( ( x )->password_size )
+#define BSET_GetEncryptAlgor( x ) ( ( x )->encrypt_algor )
+#define BSET_GetBsetNum( x ) ( ( x )->bset_num )
+#define BSET_GetTapeNum( x ) ( ( x )->tape_num )
+#define BSET_GetBaseTape( x ) ( ( x )->base_tape )
+#define BSET_GetFID( x ) ( ( x )->tape_fid )
+#define BSET_GetXtraBytes( x ) ( ( x )->XtraBytes )
+#define BSET_GetMaxName( x ) ( ( x )->max_name )
+#define BSET_GetMaxUser( x ) ( ( x )->max_user )
+#define BSET_GetMaxDate( x ) ( ( x )->max_date )
+#define BSET_GetMaxTime( x ) ( ( x )->max_time )
+#define BSET_GetMaxSet( x ) ( ( x )->max_set )
+#define BSET_GetMaxVolName( x ) ( ( x )->max_volume )
+#define BSET_GetTapeMask( x ) ( ( x )->tape_mask )
+#define BSET_GetFullMask( x ) ( ( x )->full_mask )
+#define BSET_GetIncoMask( x ) ( ( x )->inco_mask )
+#define BSET_GetNumTapes( x ) ( ( x )->num_tapes )
+#define BSET_GetOTC( x ) ( ( x )->otc )
+
+#define BSET_SetName( x, y ) ( strcpy( ( x )->name, ( y ) ) )
+#define BSET_SetUserName( x, y ) ( strcpy( ( x )->user_name, ( y ) ) )
+#define BSET_SetVolName( x, y ) ( strcpy( ( x )->volume_name, ( y ) ) )
+#define BSET_SetTapeNumStr( x, y ) ( strcpy( ( x )->tape_num_str, ( y ) ) )
+#define BSET_SetDateStr( x, y ) ( strcpy( ( x )->date_str, ( y ) ) )
+#define BSET_SetTimeStr( x, y ) ( strcpy( ( x )->time_str, ( y ) ) )
+#define BSET_SetPassword( x, y, z ) ( memcpy( ( x )->password, ( y ), ( z ) )
+#define BSET_SetBsetNumStr( x, y ) ( strcpy( ( x )->bset_num_str, ( y ) ) )
+#define BSET_SetStatus( x, y ) ( ( x )->status = ( y ) )
+#define BSET_SetDate( x, y ) ( ( x )->backup_date = ( y ) )
+#define BSET_SetTime( x, y ) ( ( x )->backup_time = ( y ) )
+#define BSET_SetIncomplete( x, y ) ( ( x )->incomplete = ( y ) )
+#define BSET_SetFull( x, y ) ( ( x )->full = ( y ) )
+#define BSET_SetMissing( x, y ) ( ( x )->missing = ( y ) )
+#define BSET_SetBsetPswd( x, y ) ( ( x )->bset_password = ( y ) )
+#define BSET_SetBackupType( x, y ) ( ( x )->backup_type = ( y ) )
+#define BSET_SetPswdSize( x, y ) ( ( x )->password_size = ( y ) )
+#define BSET_SetEncryptAlgor( x, y ) ( ( x )->encrypt_algor = ( y ) )
+#define BSET_SetBsetNum( x, y ) ( ( x )->bset_num = ( y ) )
+#define BSET_SetTapeNum( x, y ) ( ( x )->tape_num = ( y ) )
+#define BSET_SetBaseTape( x, y ) ( ( x )->base_tape = ( y ) )
+#define BSET_SetFID( x, y ) ( ( x )->tape_fid = ( y ) )
+#define BSET_SetXtraBytes( x, y ) ( ( x )->XtraBytes = ( y ) )
+#define BSET_SetMaxName( x, y ) ( ( x )->max_name = ( y ) )
+#define BSET_SetMaxUser( x, y ) ( ( x )->max_user = ( y ) )
+#define BSET_SetMaxDate( x, y ) ( ( x )->max_date = ( y ) )
+#define BSET_SetMaxTime( x, y ) ( ( x )->max_time = ( y ) )
+#define BSET_SetMaxSet( x, y ) ( ( x )->max_set = ( y ) )
+#define BSET_SetMaxVolName( x, y ) ( ( x )->max_volume = ( y ) )
+#define BSET_SetTapeMask( x, y ) ( ( x )->tape_mask = ( y ) )
+#define BSET_SetFullMask( x, y ) ( ( x )->full_mask = ( y ) )
+#define BSET_SetIncoMask( x, y ) ( ( x )->inco_mask = ( y ) )
+#define BSET_SetNumTapes( x, y ) ( ( x )->num_tapes = ( y ) )
+#define BSET_SetOTC( x, y ) ( ( x )->otc = ( y ) )
+
+
+// VLM_CatalogSync() defines
+
+#define VLM_SYNCMORE 0x01 // sets may have been added to the catalogs
+#define VLM_SYNCLESS 0x02 // sets may have been removed from the catalogs
+
+
+// Selection defines
+
+#define SLM_SEL_ALL 1
+#define SLM_SEL_NONE 2
+
+#define FLM_SEL_ALL 1
+#define FLM_SEL_NONE 2
+
+
+// The structure for servers/volumes/disks
+
+typedef struct vlm_object {
+
+ Q_ELEM q_elem; // queue stuff
+ Q_HEADER children;
+ CHAR_PTR name; // drive name C:
+ CHAR_PTR label; // G: [ENG1/SYS2] or \\mickey\public
+ UINT32 status; // Uses INFO_??? defines above
+ WININFO_PTR XtraBytes; // pointer to xtrabytes
+ struct vlm_object *parent;
+
+} VLM_OBJECT, *VLM_OBJECT_PTR;
+
+
+//
+// The structure for a subdirectory in the hierarchical tree
+//
+
+typedef struct slm_object {
+
+ Q_ELEM q_elem; // queue stuff
+ CHAR_PTR name; // directory name
+ CHAR_PTR original_name; // directory name in original case
+ UINT16 date; // date & time
+ UINT16 time;
+ UINT32 status; // Uses INFO_???? defines above
+ INT level; // hieght in tree
+ UINT32 attrib; // attributes
+ BYTE_PTR brothers;
+ WININFO_PTR XtraBytes; // pointer to xtrabytes
+
+ struct slm_object *next_brother;
+
+#ifdef OEM_EMS // Info used by Exchange
+ UINT16 type; // Type of exchange object.
+ UINT16 flags; // Attribute bits of network object.
+ struct slm_object *parent;
+ GENERIC_DLE_PTR dle ;
+#endif // OEM_EMS
+
+} SLM_OBJECT, *SLM_OBJECT_PTR;
+
+//
+// The structure for a file in the flat list
+//
+
+typedef struct flm_object {
+
+ Q_ELEM q_elem; // queue stuff
+ CHAR_PTR name; // name
+ UINT32 status; // Uses INFO_???? defines above
+ UINT32 attrib; // attributes
+ UINT16 mod_date; // modified date & time
+ UINT16 mod_time;
+ UINT16 acc_date; // accessed date & time
+ UINT16 acc_time;
+ UINT64 size; // size in bytes
+ CHAR size_str[ FLM_MAX_FILE_SIZE ]; // size in text
+ CHAR_PTR attrib_str; // time, date, attr text
+ CHAR_PTR date_str; // time, date, attr text
+ CHAR_PTR time_str; // time, date, attr text
+ INT level; // height in tree
+ WININFO_PTR XtraBytes; // pointer to xtrabytes
+
+ // This is really wasteful of space and I wish someone would move this
+ // info to the appinfo structure so it is not repeated a million times
+ // in memory.
+
+ INT max_name; // max file name length in list
+ INT max_attr; // etc.
+ INT max_date;
+ INT max_time;
+ INT max_size;
+
+} FLM_OBJECT, *FLM_OBJECT_PTR;
+
+//
+// The structure for a tape in the TAPES window
+//
+
+typedef struct tape_object {
+ Q_ELEM q_elem; // queue stuff
+ Q_HEADER bset_list; // queue of bsets on this tape
+ CHAR_PTR name; // name
+ INT fake_tape:1; // blank or foreign
+ INT current:1; // is it in the drive ?
+ UINT32 status; // Uses INFO_???? defines above
+ INT tape_num; // tape sequence number 1,2,3,...
+ UINT32 tape_fid; // tape family id
+ WININFO_PTR XtraBytes; // pointer to xtrabytes
+ INT cataloged; // have we read in all the sets on tape
+ INT multitape; // is there > 1 tapes in this family
+} TAPE_OBJECT, *TAPE_OBJECT_PTR;
+
+// The structure for a BSET in the TAPES window
+
+typedef struct bset_object {
+
+ Q_ELEM q_elem; // queue stuff
+
+ CHAR_PTR name; // name
+ CHAR_PTR user_name; // MIKEP
+ CHAR_PTR volume_name; // C: SICK CAT'S
+ CHAR_PTR password; // ????
+ CHAR_PTR tape_num_str; // Tapes 1..2
+ CHAR_PTR time_str; // 12:24:56pm
+ CHAR_PTR date_str; // 10/16/61
+ CHAR_PTR kbytes_str; // size string
+
+ UINT32 status; // Uses INFO_???? defines above
+ INT16 backup_date; // dos format date
+ INT16 backup_time; // dos format time
+
+ INT incomplete:1; // everything known but something partial
+ INT full:1; // nothing cataloged
+ INT missing:1; // all present are full, but some missing
+ INT bset_password:1; // password for bset or tape ?
+ INT backup_type:4;
+
+ INT password_size; // 0 = no password
+ INT encrypt_algor;
+
+ INT num_tapes; // how many tapes is bset on
+
+ INT16 bset_num; // exactly which bset is this
+ INT16 tape_num;
+ UINT32 tape_fid;
+
+ WININFO_PTR XtraBytes; // pointer to xtrabytes
+
+ // This is also very wasteful of memory and
+ // should be moved to the tape structure.
+
+ INT max_name; // max string sizes for column alignment
+ INT max_date;
+ INT max_time;
+ INT max_user;
+ INT max_volume;
+ INT max_set;
+ INT max_tapes;
+ INT max_kbytes;
+
+ UINT32 tape_mask; // is piece present
+ UINT32 full_mask; // is piece fully cataloged
+ UINT32 inco_mask; // is piece incompletely cataloged
+ INT16 base_tape; // guess at first tape in this set
+
+ INT selected_dirs;
+ INT selected_files;
+ UINT64 selected_bytes;
+
+ CHAR bset_num_str[ BSET_MAX_NUM_SIZE ];
+
+ INT otc; // Is OTC available for this set
+
+ INT os_id;
+ INT os_ver ;
+ INT num_files ;
+ INT num_corrupt ;
+ INT num_dirs ;
+
+ UINT64 total_bytes; // bytes in set
+
+} BSET_OBJECT, *BSET_OBJECT_PTR;
+
+//
+// The user application area associated with each window. This structure
+// contains many fields. Only some of which are used for each window type.
+//
+
+typedef struct appinfo {
+
+ HWND win; // this window
+ HWND parent; // parent primary window
+
+ SLM_OBJECT_PTR open_slm; // current open slm
+ TAPE_OBJECT_PTR open_tape; // current open tape
+
+ GENERIC_DLE_PTR dle; // dle for this window
+
+ // Used if it's a tape selection window
+
+ UINT32 tape_fid; // tape this window is from
+ INT16 bset_num; // bset this window is from
+ INT16 tape_num;
+
+ // Used if it's a disk selection window
+
+ FSYS_HAND fsh; // file system handle
+
+ // Used if it's a server/volume selection
+
+ FSYS_HAND server_fsh; // file system handle for servers
+
+ BOOLEAN fFatDrive; // Is this a FAT drive or
+ // a backup of a FAT drive ?
+
+} APPINFO, *APPINFO_PTR;
+
+//
+// General functions for processing the endless queues in the VLM
+//
+
+VLM_OBJECT_PTR VLM_GetFirstVLM( Q_HEADER_PTR );
+VLM_OBJECT_PTR VLM_GetNextVLM( VLM_OBJECT_PTR );
+VLM_OBJECT_PTR VLM_GetPrevVLM( VLM_OBJECT_PTR );
+
+SLM_OBJECT_PTR VLM_GetFirstSLM( Q_HEADER_PTR );
+SLM_OBJECT_PTR VLM_GetLastSLM( Q_HEADER_PTR );
+SLM_OBJECT_PTR VLM_GetNextSLM( SLM_OBJECT_PTR );
+SLM_OBJECT_PTR VLM_GetPrevSLM( SLM_OBJECT_PTR );
+SLM_OBJECT_PTR VLM_GetNextBrotherSLM( SLM_OBJECT_PTR );
+SLM_OBJECT_PTR VLM_GetParentSLM( SLM_OBJECT_PTR );
+
+FLM_OBJECT_PTR VLM_GetFirstFLM( Q_HEADER_PTR );
+FLM_OBJECT_PTR VLM_GetLastFLM( Q_HEADER_PTR );
+FLM_OBJECT_PTR VLM_GetNextFLM( FLM_OBJECT_PTR );
+FLM_OBJECT_PTR VLM_GetPrevFLM( FLM_OBJECT_PTR );
+
+TAPE_OBJECT_PTR VLM_GetFirstTAPE( VOID );
+TAPE_OBJECT_PTR VLM_GetNextTAPE( TAPE_OBJECT_PTR );
+TAPE_OBJECT_PTR VLM_GetPrevTAPE( TAPE_OBJECT_PTR );
+
+BSET_OBJECT_PTR VLM_GetFirstBSET( Q_HEADER_PTR );
+BSET_OBJECT_PTR VLM_GetLastBSET( Q_HEADER_PTR );
+BSET_OBJECT_PTR VLM_GetNextBSET( BSET_OBJECT_PTR );
+BSET_OBJECT_PTR VLM_GetPrevBSET( BSET_OBJECT_PTR );
+
+// Misc. Functions in Alphabetical order, sort of ...
+
+VOID VLM_AddAdvancedSelection( HWND, DS_ADVANCED_PTR );
+VOID VLM_AddBset( UINT32, INT16, INT16, VOID_PTR, BOOLEAN );
+INT VLM_AddFileForInclude( UINT32, INT16, BOOLEAN );
+VOID VLM_AddInServerChildren( VLM_OBJECT_PTR );
+INT VLM_AddPartials( CHAR_PTR, INT16, BSD_PTR, UINT32, INT16, INT_PTR, UINT64_PTR );
+INT VLM_AnySelFiles( VOID );
+INT VLM_AnyDiskSelections( VOID );
+INT VLM_AnyTapeSelections( VOID );
+VOID VLM_BlowOutDir( SLM_OBJECT_PTR );
+VOID VLM_BsetFillInDLM( VOID_PTR );
+VOID_PTR VLM_BsetSetSelect( BSET_OBJECT_PTR, BYTE );
+BOOLEAN VLM_BsetSetObjects( BSET_OBJECT_PTR, WORD, WORD );
+INT VLM_BuildFileList( FSYS_HAND, CHAR_PTR, Q_HEADER_PTR, WININFO_PTR );
+CHAR_PTR VLM_BuildPath( SLM_OBJECT_PTR );
+VOID VLM_BuildVolumeList( Q_HEADER_PTR, WININFO_PTR );
+VOID VLM_BuildServerList( Q_HEADER_PTR, WININFO_PTR );
+INT VLM_BuildTapeFileList( CHAR_PTR, Q_HEADER_PTR, UINT32, INT16, WININFO_PTR );
+VOID VLM_CatalogMaintenance( VOID );
+INT VLM_CatalogDataPathChanged( VOID );
+INT VLM_CatalogSet( UINT32, INT16, INT16 );
+VOID VLM_CatalogSync( INT );
+INT VLM_CheckForCatalogError( QTC_BUILD_PTR );
+INT VLM_CheckForChildren( Q_HEADER_PTR, SLM_OBJECT_PTR, CHAR_PTR, INT, BOOLEAN );
+VOID VLM_ClearAllSelections( VOID );
+VOID VLM_ClearAllDiskSelections( VOID );
+VOID VLM_ClearAllTapeSelections( VOID );
+VOID VLM_ClearAllSearchSelections( VOID );
+VOID VLM_ClearAllServerSelections( VOID );
+VOID VLM_ClearAllTreeSelections( VOID );
+VOID VLM_ClearCurrentTape( UINT32, BOOLEAN );
+VOID VLM_CloseAll( VOID );
+VOID VLM_CloseWin( HWND );
+VOID VLM_ChangeSettings( INT16, INT32 );
+TAPE_OBJECT_PTR VLM_CreateTAPE( INT16 );
+VLM_OBJECT_PTR VLM_CreateVLM( INT16, INT16 );
+VOID VLM_CollapseBranch( HWND );
+VOID VLM_Deinit( VOID );
+VOID VLM_DeselectAll( WININFO_PTR, BOOLEAN );
+BOOLEAN VLM_DisksListCreate( VOID );
+VOID VLM_DisksSync( VOID );
+INT VLM_DisplayInfo( VOID );
+VOID VLM_DownOneDir( HWND );
+VOID VLM_ExpandTree( HWND );
+VOID VLM_ExpandOne( HWND );
+VOID VLM_ExpandBranch( HWND );
+INT VLM_FileListReuse( HWND, CHAR_PTR );
+VOID VLM_FileListManager( HWND, WORD );
+VOID VLM_FillInBSD( BSD_PTR );
+INT16 VLM_FindScannedBset( GENERIC_DLE_PTR );
+BSET_OBJECT_PTR VLM_FindBset( UINT32, INT16 );
+INT VLM_FindServerChildren( VLM_OBJECT_PTR );
+SLM_OBJECT_PTR VLM_FindSLM( Q_HEADER_PTR, CHAR_PTR, INT );
+VLM_OBJECT_PTR VLM_FindVLMByName( Q_HEADER_PTR, CHAR_PTR );
+VOID VLM_FlmFillInDLM( VOID_PTR );
+VOID VLM_FontCaseChange( VOID );
+VOID VLM_FreeVLMList( Q_HEADER_PTR );
+#ifdef OEM_EMS
+VOID SLM_EMSFreeSLMList( Q_HEADER_PTR );
+#endif
+INT VLM_GetDriveLabel( GENERIC_DLE_PTR, CHAR_PTR, INT );
+INT VLM_GetDriveStatus( DBLK_PTR * );
+VOID VLM_AddTapeIfUnknown( BOOLEAN );
+BOOLEAN VLM_GetTapeCreationDate( UINT32, INT16 *, INT16 * );
+BOOLEAN VLM_GetSetCreationDate( UINT32, INT16, INT16 *, INT16 * );
+BOOLEAN VLM_GetTapeOwnersName( UINT32, CHAR_PTR );
+BOOLEAN VLM_GetSetOwnersName( UINT32, INT16, CHAR_PTR );
+CHAR_PTR VLM_GetVolumeName( UINT32, INT16 );
+CHAR_PTR VLM_GetBsetName( UINT32, INT16 );
+CHAR_PTR VLM_GetTapeName( UINT32 );
+CHAR_PTR VLM_GetUserName( UINT32, INT16 );
+UINT16 VLM_GetBackupDate( UINT32, INT16 );
+UINT16 VLM_GetBackupTime( UINT32, INT16 );
+INT VLM_GetBackupType( UINT32, INT16 );
+VOID VLM_GetSortDate( UINT32, INT16, DATE_TIME_PTR );
+INT VLM_HandleFSError( INT );
+INT VLM_IncludeCatalogs( VOID );
+BOOL VLM_Init( BOOL );
+INT VLM_InsertTapeInQueue( Q_HEADER_PTR, TAPE_OBJECT_PTR );
+BOOL VLM_IsInfoAvailable ( VOID );
+VOID VLM_LoadDefaultSelections( VOID );
+VOID VLM_LookForCatalogFiles( VOID );
+VOID VLM_MarkAllSLMChildren( SLM_OBJECT_PTR, INT16, INT_PTR, INT_PTR, UINT64_PTR );
+VOID VLM_MakeSLMActive( SLM_OBJECT_PTR );
+VOID VLM_MakeAllParentsPartial( SLM_OBJECT_PTR );
+VOID VLM_MatchSLMList( WININFO_PTR, BSD_PTR, BOOLEAN );
+VOID VLM_NetConnect ( VOID );
+VOID VLM_NetDisconnect ( VOID );
+INT VLM_NewTapeInserted( VOID );
+VOID VLM_NextBrotherDir( HWND );
+VOID VLM_PartializeTape( UINT32 );
+VOID VLM_PrevBrotherDir( HWND );
+VOID VLM_Refresh( VOID );
+INT VLM_RefreshTapesWindow( VOID );
+VOID VLM_RematchAllLists( VOID );
+VOID VLM_RematchList( HWND );
+VOID VLM_RemoveBset( UINT32, INT16, INT16, BOOLEAN );
+VOID VLM_RemoveTape( UINT32, INT16, BOOLEAN );
+VOID VLM_RemoveUnusedBSDs( BSD_HAND ) ;
+INT VLM_ResortFileList( HWND );
+SLM_OBJECT_PTR VLM_RetrieveSLM( CHAR_PTR, HWND );
+INT16 VLM_ScanDrive( GENERIC_DLE_PTR );
+INT VLM_SearchRemoveSet( UINT32, INT16 );
+VOID VLM_SelectDisks( BYTE );
+VOID VLM_SelectVolumes( BYTE );
+VOID VLM_SelectBsets( BYTE );
+VOID VLM_SelectTree( HWND, BYTE );
+VOID VLM_SelectFiles( HWND, BYTE );
+VOID VLM_SelectSearch( BYTE );
+VOID VLM_ServerListCreate( VOID );
+VOID VLM_ServersSync( VOID );
+VOID VLM_SetMaxVolumeLabelLength( Q_HEADER_PTR );
+BOOLEAN VLM_ShowServers( BOOLEAN );
+VOID VLM_SortServers( VOID );
+INT VLM_StartBackup( VOID );
+INT VLM_StartTransfer( VOID );
+INT VLM_StartCatalog( VOID );
+INT VLM_StartVerify( VOID );
+VOID VLM_StartErase( VOID );
+VOID VLM_StartFormat( VOID );
+INT VLM_StartRestore( VOID );
+VOID VLM_StartTension( VOID );
+VOID VLM_StartSearch( CHAR_PTR );
+INT VLM_SubdirListCreate( GENERIC_DLE_PTR, UINT32, INT16, INT16, HWND );
+VOID VLM_SubdirListManager( HWND, WORD );
+VOID VLM_TapeChanged( INT16, DBLK_PTR, FSYS_HAND );
+BOOLEAN VLM_TapesListCreate( VOID );
+BOOLEAN VLM_TapeSetObjects( TAPE_OBJECT_PTR, WORD, WORD );
+VOID_PTR VLM_TapeSetSelect( TAPE_OBJECT_PTR, BYTE );
+VOID VLM_UpdateRoot( HWND );
+VOID VLM_UpdateBrothers( Q_HEADER_PTR );
+VOID VLM_UpdateDisks( VOID );
+VOID VLM_UpdateDiskStatus( VLM_OBJECT_PTR );
+VOID VLM_UpdateFLMItem( HWND, SLM_OBJECT_PTR );
+VOID VLM_UpdateSearchSelections( UINT32, INT16 );
+VOID VLM_UpdateServers( VOID );
+VOID VLM_UpdateServerStatus( VLM_OBJECT_PTR );
+VOID VLM_UpdateTapes( VOID );
+VOID VLM_UpdateTapeStatus( TAPE_OBJECT_PTR, BOOLEAN );
+VOID VLM_UpOneDir( HWND );
+INT VLM_ValidatePath( CHAR_PTR, BOOLEAN, BOOLEAN );
+INT16 VLM_VlmCompare( Q_ELEM_PTR, Q_ELEM_PTR );
+
+#ifdef OEM_EMS
+VOID SLM_EMSExpandTree( HWND );
+VOID SLM_EMSExpandOne( HWND );
+VOID SLM_EMSExpandBranch( HWND );
+VOID SLM_EMSCollapseBranch( HWND );
+VOID SLM_EMSPrevBrotherDir( HWND );
+VOID SLM_EMSNextBrotherDir( HWND win ) ;
+VOID SLM_EMSDownOneDir( HWND win ) ;
+VOID SLM_EMSUpOneDir( HWND );
+
+BOOLEAN VLM_ExchangeInit ( VOID );
+VOID VLM_ExchangeSync( VOID );
+VOID VLM_UpdateExchange( HWND );
+VOID VLM_ClearAllExchangeSelections( VOID );
+BOOLEAN VLM_ExchangeListCreate( CHAR_PTR );
+BOOLEAN SLM_DisplayExchangeDLE( GENERIC_DLE_PTR );
+VOID VLM_SelectExchangeShares( BYTE, WININFO_PTR );
+GENERIC_DLE_PTR DLE_GetEnterpriseDLE( GENERIC_DLE_PTR );
+#endif //OEM_EMS
+
+// General functions for processing the endless queues in the SLM
+
+SLM_OBJECT_PTR VLM_CreateSlm( INT, INT, BOOLEAN, BOOLEAN );
+
+#endif
diff --git a/private/utils/ntbackup/inc/vlm_find.h b/private/utils/ntbackup/inc/vlm_find.h
new file mode 100644
index 000000000..1f21491df
--- /dev/null
+++ b/private/utils/ntbackup/inc/vlm_find.h
@@ -0,0 +1,344 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_FIND.H
+
+ Description:
+
+ This file contains file find routines which use the file
+ manager for searching directories.
+
+ The following public functions are implemented in this file:
+
+ VLM_FindFirst - Find first matching file or subdirectory
+ VLM_FindNext - Find next file in set
+ VLM_FindClose - Terminate a FindFirst/FindNext sequence
+
+ $Log: G:/UI/LOGFILES/VLM_FIND.H_V $
+
+ Rev 1.9 18 Feb 1993 13:28:58 BURT
+Change for Cayman
+
+
+ Rev 1.8 01 Nov 1992 16:33:36 DAVEV
+Unicode changes
+
+ Rev 1.7 04 Oct 1992 19:49:58 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.6 06 May 1992 14:44:32 MIKEP
+unicode pass 2
+
+ Rev 1.5 04 May 1992 14:39:28 MIKEP
+unicode pass 1
+
+ Rev 1.4 04 Feb 1992 16:11:58 STEVEN
+added support for NT
+
+ Rev 1.3 15 Jan 1992 15:22:06 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.2 08 Jan 1992 11:16:44 DAVEV
+minor bug fix
+
+ Rev 1.1 07 Jan 1992 15:36:40 DAVEV
+bug fixes
+
+ Rev 1.0 23 Dec 1991 14:10:02 DAVEV
+first revision
+
+
+*****************************************************/
+/**********************
+
+ NAME : VLM_FindFirst, VLM_FindNext, VLM_FindClose
+
+ PROTOTYPE:
+
+ #include <stdtypes.h>
+ #include <vlm.h> - or - #include <vlm_find.h>
+
+ VLM_FIND_PTR VLM_FindFirst (
+ LPSTR pszFile, // I - name of file or subdirectory
+ // may contain (OS specific) wildcards
+ VLM_FINDATTR findAttr, // I - search criteria flags
+ LPSTR pszFirst); // O - First matching file name found
+ // (without drive or path)
+
+ BOOL VLM_FindNext (
+ VLM_FIND_PTR pFind, // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+ LPSTR pszNext); // O - File name of next file found
+
+ VOID VLM_FindClose (
+ VLM_FIND_PTR FAR * pFind); // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+
+ DESCRIPTION :
+
+ Find all files or subdirectories in a set specified using
+ an Operating Sysytem specific file name path which may contain any wild
+ cards normally allowed by the operating system.
+
+ VLM_FindFirst must be called first to get the first file found in
+ the set. VLM_FindNext may then be repeatedly called to obtain all
+ subsequent files in the set. The order of the file names returned
+ may be arbitrary.
+
+ VLM_FindClose MUST be called to free system resources after the program
+ has finished.
+
+ VLM_FindFirst RETURNS :
+
+ NULL - if an error occurred, otherwise
+ VLM_FIND_PTR - pointer to an internal data structure required for
+ subsequent calls to VLM_FindNext and VLM_FindClose.
+
+ NOTE: This pointer should never be accessed by the
+ calling program!
+
+ pszFile - The buffer provided by the caller is filled with the
+ file name (sans path or drive) of the first file
+ found matching the specifications.
+
+ VLM_FindNext RETURNS:
+
+ TRUE - A matching file was found and placed in the pszNext
+ buffer.
+ FALSE - The list of matching files is exhausted. VLM_FindClose
+ should now be called to free system resources.
+
+ pszNext - The buffer provided by the caller is filled with the
+ next file found in the set specified by the initial
+ VLM_FindFirst call.
+
+ VLM_FindClose RETURNS:
+
+ Nothing. The VLM_FIND_PTR pointed to in the function parameter is
+ set to NULL.
+
+ NOTES:
+
+ pszFile - The form used to specify the filename pattern is
+ operating system dependant.
+ For DOS, OS/2 and NT, it is a standard drive, path and
+ file name string:
+ [d:][path]fname
+
+ The path must utilize backslashes as unit seperators,
+ like normal. The file name may contain ? and * wildcards
+ in the normal maner.
+
+ findAttr - This parameter may contain one or more of the following
+ flags logically or'd together:
+
+ VLMFIND_NORMAL - Include matching files
+ VLMFIND_SUBDIR - Include matching subdirs
+
+ VLMFIND_NORDONLY - Exclude read-only files/subdirs
+ VLMFIND_NOARCH - Exclude archived files/subdirs
+
+ VLMFIND_HIDDEN - Include hidden files/subdirs
+ VLMFIND_SYSTEM - Include system files/subdirs
+
+ Notice that these flags are divided into three groups.
+ The first group (NORMAL and SUBDIR) determine whether
+ (normal) files, subdirectories or both are to be
+ retrieved. If neither of these flags are specified,
+ VLMFIND_NORMAL is presumed (only files will be
+ retrieved - no subdirectories.)
+
+ The second group specifies whether read-only and/or
+ archive files or subdirectories should be excluded from
+ the retrieved list. These types will be included
+ unless otherwise specified.
+
+ Finally, the last group determines whether hidden or
+ system files or subdirectories are to be included.
+ These types will be excluded unless specified.
+
+ Examples:
+ VLMFIND_NORMAL | VLMFIND_SUBDIR
+ This will find all files and subdirectories which
+ do not have thier hidden or system flags set.
+
+ VLMFIND_NORMAL | VLMFIND_NORDONLY | VLMFIND_NOARCH
+ This will find only those files (no subdirectories)
+ which have no flags set at all.
+
+
+ VLMFIND_SUBDIR
+ This will only find subdirectories (no files)
+ which are neither hidden nor system.
+
+ pszFirst - These must point to a character buffer which MUST be
+ long enough to hold the largest possible returned
+ pszNext file name. This length is defined by VLM_MAXFNAME
+ in VLM_FIND.H. The following declaration is
+ recommended:
+
+ CHAR szName [VLM_MAXFNAME];
+
+**********************/
+#ifndef VLM_FIND_INCL //Avoid multiple includes
+#define VLM_FIND_INCL
+
+#ifdef OS_WIN32
+# define VLM_MAXFNAME MAX_PATH /*max length of a file name */
+ #define VLM_MAXPATH MAX_PATH /*max length of full path name */
+#else
+# define VLM_MAXFNAME _MAX_FNAME /*max length of a file name */
+# define VLM_MAXPATH _MAX_PATH /*max length of full path name */
+#endif
+
+
+// Note: we use our own file matching flags because we need a slot for
+// specifying what types of files are desired.
+
+typedef enum {
+
+ VLMFIND_NORMAL = 0x01, // Include non-hidden, non-system files
+ VLMFIND_SUBDIR = 0x02, // Include non-hidden/system subdirectories
+ VLMFIND_NORDONLY = 0x04, // Exclude read-only files or subdirs
+ VLMFIND_NOARCH = 0x08, // Exclude archived files or subdirs
+ VLMFIND_HIDDEN = 0x10, // Include hidden files or subdirectories
+ VLMFIND_SYSTEM = 0x20 // Include system files or subdirectories
+
+} VLM_FINDATTR;
+
+typedef struct VLM_FIND_STRUC {
+
+ VLM_FINDATTR attr;
+
+# ifdef OS_WIN32 // NT specific data elements
+
+ HANDLE hFind;
+ WIN32_FIND_DATA nt_findbuf;
+
+# else //MS-DOS specific data elements
+
+ struct find_t dos_findbuf;
+
+# endif
+
+} VLM_FIND, FAR * VLM_FIND_PTR;
+
+
+/************************************************************************/
+/* VLM_FIND_PTR DATA ACCESS MACROS */
+/************************************************************************/
+#ifdef OS_WIN32 //32 bit Windows/NT versions of macros
+
+# define VLM_FindName(pVlm) TEXT("")
+
+ // Get File size - NOTE: under DOS (and, presumably, OS/2 & UNIX) this is
+ // a LONG. Under NT, however, file size is 2 LONG's (8 BYTES)!!
+ // We have a PORTING PROBLEM HERE!!!
+
+// Defined for now 11/10/92 BBB to use low 4 bytes. Need to enhance
+// structures and code to support 64-bit UINT64 stuff later
+# define VLM_FindSize(pVlm) \
+ (pVlm->nt_findbuf.nFileSizeLow)
+
+ USHORT VLM_FindDosTime(FILETIME ft);
+# define VLM_FindWriteTime(pVlm) \
+ VLM_FindDosTime((pVlm)->nt_findbuf.ftLastWriteTime)
+# define VLM_FindWriteHour(pVlm) \
+ (VLM_FindWriteTime(pVlm) >> 11) //24 hour time
+# define VLM_FindWriteMinute(pVlm) \
+ ((VLM_FindWriteTime(pVlm) & 0x07e0)>>5)
+
+ USHORT VLM_FindDosDate(FILETIME ft);
+# define VLM_FindWriteDate(pVlm) \
+ VLM_FindDosDate((pVlm)->nt_findbuf.ftLastWriteTime)
+# define VLM_FindWriteMonth(pVlm) \
+ ((VLM_FindWriteDate(pVlm) & 0x01e0)>>5)
+# define VLM_FindWriteDay(pVlm) \
+ (VLM_FindWriteDate(pVlm) & 0x001f)
+# define VLM_FindWriteYear(pVlm) \
+ ((VLM_FindWriteDate(pVlm) >> 9) + 1980)
+
+ // File creation date & time: not available under DOS so return last write
+ // time & date info instead
+ // Note: this info may be available under NT - these macros need to be
+ // changed to return the proper values when available.
+
+# define VLM_FindCreatTime(pVlm) VLM_FindWriteTime(pVlm)
+# define VLM_FindCreatHour(pVlm) VLM_FindWriteHour(pVlm)
+# define VLM_FindCreatMinute(pVlm) VLM_FindWriteMinute(pVlm)
+
+# define VLM_FindCreatDate(pVlm) VLM_FindWriteDate(pVlm)
+# define VLM_FindCreatMonth(pVlm) VLM_FindWriteMonth(pVlm)
+# define VLM_FindCreatDay(pVlm) VLM_FindWriteDay(pVlm)
+# define VLM_FindCreatYear(pVlm) VLM_FindWriteYear(pVlm)
+
+ // The following macro really should return the appropriate VLMFILE_* flags
+ // this implementation is NOT PORTABLE!!
+
+# define VLM_FindAttr(pVlm) ((pVlm)->dwFileAttributes)
+
+
+#else // 16-bit Windows/DOS versions of macros:
+
+
+# define VLM_FindName(pVlm) ((pVlm)->dos_findbuf.name)
+
+ // Get File size - NOTE: under DOS (and, presumably, OS/2 & UNIX) this is
+ // a LONG. Under NT, however, file size is 2 LONG's (8 BYTES)!!
+ // We have a PORTING PROBLEM HERE!!!
+
+# define VLM_FindSize(pVlm) ((pVlm)->dos_findbuf.size)
+
+# define VLM_FindWriteTime(pVlm) ((pVlm)->dos_findbuf.wr_time)
+# define VLM_FindWriteHour(pVlm) \
+ (VLM_FindWriteTime(pVlm) >> 11) //24 hour time
+# define VLM_FindWriteMinute(pVlm) \
+ ((VLM_FindWriteTime(pVlm) & 0x07e0)>>5)
+
+# define VLM_FindWriteDate(pVlm) ((pVlm)->dos_findbuf.wr_date)
+# define VLM_FindWriteMonth(pVlm) \
+ ((VLM_FindWriteDate(pVlm) & 0x01e0)>>5)
+# define VLM_FindWriteDay(pVlm) \
+ (VLM_FindWriteDate(pVlm) & 0x001f)
+# define VLM_FindWriteYear(pVlm) \
+ ((VLM_FindWriteDate(pVlm) >> 9) + 1980)
+
+ // File creation date & time: not available under DOS so return last write
+ // time & date info instead
+
+# define VLM_FindCreatTime(pVlm) VLM_FindWriteTime(pVlm)
+# define VLM_FindCreatHour(pVlm) VLM_FindWriteHour(pVlm)
+# define VLM_FindCreatMinute(pVlm) VLM_FindWriteMinute(pVlm)
+
+# define VLM_FindCreatDate(pVlm) VLM_FindWriteDate(pVlm)
+# define VLM_FindCreatMonth(pVlm) VLM_FindWriteMonth(pVlm)
+# define VLM_FindCreatDay(pVlm) VLM_FindWriteDay(pVlm)
+# define VLM_FindCreatYear(pVlm) VLM_FindWriteYear(pVlm)
+
+ // The following macro really should return the appropriate VLMFILE_* flags
+ // this implementation is NOT PORTABLE!!
+
+# define VLM_FindAttr(pVlm) ((pVlm)->dos_findbuf.attrib)
+
+#endif
+
+/************************************************************************/
+/* PUBLIC FUNCTION PROTOTYPES */
+/************************************************************************/
+VLM_FIND_PTR VLM_FindFirst (
+ CHAR_PTR pszFile, // I - name of file or subdirectory
+ // may contain (OS specific) wildcards
+ VLM_FINDATTR findAttr, // I - search criteria flags
+ CHAR_PTR pszFirst); // O - First matching file name found
+ // (without drive or path)
+
+BOOLEAN VLM_FindNext (
+ VLM_FIND_PTR pFind, // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+ CHAR_PTR pszNext); // O - File name of next file found
+
+VOID VLM_FindClose (
+ VLM_FIND_PTR FAR * pFind); // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+
+#endif //VLM_FIND_INCL
diff --git a/private/utils/ntbackup/inc/vm.h b/private/utils/ntbackup/inc/vm.h
new file mode 100644
index 000000000..ffb270584
--- /dev/null
+++ b/private/utils/ntbackup/inc/vm.h
@@ -0,0 +1,117 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: vm.h
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains all the necessary constant definitions,
+ and prototypes required to use the Virtual Memory Manager.
+
+ There are six routines provided. These include:
+ VM_InitVM - Initialize Virtual Memory Manager
+ VM_RemoveVM - Terminate Virtual Memory Manager
+ VM_Alloc - Allocate Virtual Memory Block
+ VM_Free - Release Virtual Memory Block
+ VM_MemLock - Lock VM block in memory
+ VM_MemUnLock - Unlock VM block in memory
+
+
+ $Log: J:/LOGFILES/VM.H_V $
+ *
+ * Rev 1.2 19 Nov 1992 16:29:50 CHARLIE
+ * Changed PSIZE to PAGESIZE to avoid NT conflict
+ *
+ * Rev 1.1 23 Jul 1992 08:47:08 STEVEN
+ * fix warnings
+ *
+ * Rev 1.0 09 May 1991 13:33:26 HUNTER
+ * Initial revision.
+
+**/
+/* $end$ */
+
+#ifndef _VM_H
+
+#define _VM_H
+
+/*
+ The following critical errors are defined
+*/
+#define VM_ERRORS 1000
+
+#define VM_READ_ERROR VM_ERRORS + 1
+#define VM_SEEK_ERROR VM_ERRORS + 2
+#define VM_WRITE_ERROR VM_ERRORS + 3
+#define VM_ALL_PAGES_LOCKED VM_ERRORS + 4
+#define VM_UNABLE_TO_LOAD_PAGE VM_ERRORS + 5
+#define VM_UNBALANCED_LOCKS VM_ERRORS + 6
+#define VM_EMS_ERROR VM_ERRORS + 7
+
+/* define vm handle */
+typedef struct VM_STR *VM_HDL ;
+
+/*
+ Virtual Memory Function & Definitions
+*/
+typedef UINT32 VM_PTR ;
+
+/*
+ You can change the number of pages of Virtual Memory available by
+ changing the size of the PAGE field. Current Maximum is 32K pages.
+
+ You can change the maximum size of the page by changing the PAGESIZE field.
+ Current maximum is a 32K page. Although pages can be any size, they
+ must be at least as big as the largest structure + sizeof( PAGESIZE ).
+ Memory will not be allocated across page boundaries.
+
+*/
+typedef INT16 PAGE ;
+typedef INT16 PAGESIZE ;
+
+
+/* Define function prototype for critical error routine */
+typedef VOID ( *VM_PF_CERR ) ( VOID_PTR, INT16 ) ;
+
+/*
+ To create a Virtual Memory session call VM_InitVM(). To terminate a
+ Virtual Memory session call VM_RemoveVM().
+*/
+VM_HDL VM_InitVM( PAGE num_pages, PAGESIZE page_size, PAGE num_pages_in_mem,
+ CHAR_PTR vm_filename, VM_PF_CERR critical_error,
+ VOID_PTR app_ptr ) ;
+
+VOID VM_RemoveVM( VM_HDL vm_hdl ) ;
+/*
+ Note: When a critical error occurs, the "critical_error" routine
+ shall be called (See VM_InitVM()). The critical error routine shall
+ not call "VM_RemoveVM()" unless it will not return from the "critical_
+ error" routine. There may be multiple "critical_error" messages
+ when an error is detected. When a critical error occurs, the
+ VM manager is in an unstable state. The application should either
+ abort, or, once the call to the VM Manager that caused the error has
+ returned close the VM Manager.
+
+ To allocate a block of virtual memory the user calls VM_Alloc(). To
+ free the block call VM_Free.
+*/
+VM_PTR VM_Alloc( VM_HDL vm_hdl, UINT16 size ) ;
+
+VOID VM_Free( VM_HDL vm_hdl, VM_PTR vm_buf ) ;
+
+/*
+ Before accessing the data block, the user must call "VM_MemLock". Once
+ the user has finished using the block call "VM_MemUnLock()".
+
+ There are two different VM_MemLock() modes. If you are writing to the
+ memory after it is locked, then use "VM_READ_WRITE". If you will
+ only be reading from the locked block use "VM_READ_ONLY".
+*/
+#define VM_READ_ONLY ((UINT16)0)
+#define VM_READ_WRITE ((UINT16)1)
+
+VOID_PTR VM_MemLock( VM_HDL vm_hdl, VM_PTR vm_buf, INT16 mode ) ;
+VOID VM_MemUnLock( VM_HDL vm_hdl, VM_PTR vm_buf ) ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/vqueue.h b/private/utils/ntbackup/inc/vqueue.h
new file mode 100644
index 000000000..e3bf1064d
--- /dev/null
+++ b/private/utils/ntbackup/inc/vqueue.h
@@ -0,0 +1,119 @@
+/************************
+Copyright(c) 1993, Conner Software Products Group. All Rights Reserved.
+
+
+ Name: vqueue.h
+
+ Description: Under OS_DOS, these routines perform queue operations
+ on queues where: the Q_HEADER is in conventional
+ memory ( or locked virtual ), and the queue itself
+ consists of virtual memory objects.
+
+ For any other OS, where VM stuff is stubbed out,
+ all vm- calls actually map to the corresponding regular
+ queue calls (with casts out the wazoo to prevent
+ compiler warnings)
+
+ It is VERY, VERY, VERY important that the VQ_HEADER keep
+ 'in-synch' with Q_HEADER, and likewise with VQ_ELEM and
+ Q_ELEM. Field names should be the same, and must be in
+ the same position and the same size (although not the
+ same type).
+
+ $Log: M:/LOGFILES/VQUEUE.H_V $
+
+ Rev 1.5 03 Aug 1993 09:13:08 JOHNES
+Got rid of a ; that was causing Watcomm errors. Got rid of type casts in
+some #defines.
+
+ Rev 1.4 21 Jul 1993 09:04:32 DON
+Cast fake define to avoid compiler noise
+
+ Rev 1.3 08 Jul 1993 10:47:36 ChuckS
+Added prototypes for vmLockVQueuePtr and vmUnlockVQueuePtr. Also
+added Q_PTR_SIZE modifier to typedef for VQ_ELEM_PTR.
+
+ Rev 1.2 09 Jun 1993 15:57:06 MIKEP
+enable c++
+
+ Rev 1.1 13 May 1993 18:24:42 Stefan
+Fixup the IFDEFs for the strangeness that is OS_WIN.
+
+ Rev 1.0 13 May 1993 14:10:40 ChuckS
+Initial revision
+
+**************************/
+
+#ifndef _vqueue_h_
+#define _vqueue_h_
+
+#ifndef QUEUES
+#include "queues.h"
+#endif
+
+#ifndef _VM_H
+#include "vm.h"
+#endif
+
+typedef VM_PTR VQ_HDL ;
+
+typedef struct VQ_HEADER Q_PTR_SIZE *VQ_HEADER_PTR;
+typedef struct VQ_HEADER {
+ VQ_HDL q_head ; /* head element of the queue */
+ VQ_HDL q_tail ; /* tail element of the queue */
+ INT16 q_count ; /* count of elements */
+ BOOLEAN q_active ; /* Is this queue active */
+ INT16 q_magic ; /* for q_element number */
+} VQ_HEADER ;
+
+
+typedef struct VQ_ELEM Q_PTR_SIZE *VQ_ELEM_PTR;
+typedef struct VQ_ELEM {
+ VQ_HDL q_prev ; /* previous queue element */
+ VQ_HDL q_next ; /* next element */
+ INT32 q_priority ; /* priority of queue */
+ INT16 q_element ; /* element number */
+ VQ_HDL q_ptr ; /* VM handle of current element */
+} VQ_ELEM ;
+
+#if defined( OS_DOS ) && !defined( OS_WIN )
+
+
+VM_PTR vmEnQueueElem( VQ_HEADER_PTR queue, VM_PTR element, BOOLEAN wpriority ) ;
+VM_PTR vmDeQueueElem( VQ_HEADER_PTR queue ) ;
+VM_PTR vmInsertElem( VQ_HEADER_PTR queue, VM_PTR cur_elem, VM_PTR ins_elem , UINT16 boa ) ;
+BOOLEAN vmRemoveQueueElem( VQ_HEADER_PTR queue, VM_PTR element ) ;
+VOID vmSetVMHandle( VM_HDL vm_hdl ) ;
+VOID vmInitQueue( VQ_HEADER_PTR queue ) ;
+VOID vmInitQElem( VQ_ELEM_PTR elem ) ;
+INT vmLockVQueuePtr( VQ_ELEM_PTR pElem, BOOLEAN for_write ) ;
+VOID vmUnlockVQueuePtr( VQ_ELEM_PTR pElem ) ;
+
+#else
+
+#define vmEnQueueElem( queue, elem, wpriority ) ( (VQ_HDL) EnQueueElem( (Q_HEADER_PTR) queue, (Q_ELEM_PTR) elem, wpriority ) )
+#define vmDeQueueElem( queue ) ( (VQ_HDL) DeQueueElem( (Q_HEADER_PTR) queue ) )
+#define vmInsertElem( queue, cur_el, new_el, boa ) ( (VQ_HDL) InsertElem( (Q_HEADER_PTR) queue, (Q_ELEM_PTR) cur_el, (Q_ELEM_PTR) new_el, boa ) )
+#define vmRemoveQueueElem( queue, elem ) RemoveQueueElem( (Q_HEADER_PTR) queue, (Q_ELEM_PTR) elem )
+#define vmSetVMHandle( vm_hdl ) /* -- this space intentionally blank -- */
+#define vmInitQueue( queue ) InitQueue( (Q_HEADER_PTR) queue )
+#define vmInitQElem( elem ) InitQElem( (Q_ELEM_PTR) elem )
+#define vmLockVQueuePtr( pElem, for_write ) (VOID)( SUCCESS ) // fake return SUCCESS from function
+#define vmUnlockVQueuePtr( pElem ) /* -- this space intentionally blank -- */
+
+#endif
+
+#define vmQueueHead( queue ) ( (VQ_HDL) QueueHead( (Q_HEADER_PTR) queue ) )
+#define vmQueueTail( queue ) ( (VQ_HDL) QueueTail( (Q_HEADER_PTR) queue ) )
+#define vmQueueNext( element ) ( (VQ_HDL) QueueNext( (Q_ELEM_PTR) element ) )
+#define vmQueuePrev( element ) ( (VQ_HDL) QueuePrev( (Q_ELEM_PTR) element ) )
+#define vmQueuePtr( element ) ( (VQ_HDL) QueuePtr( (Q_ELEM_PTR) element ) )
+#define vmQueueCount( queue ) ( QueueCount( (Q_HEADER_PTR) queue ) )
+#define vmQueueElemNo( element ) ( QueueElemNo( (Q_ELEM_PTR) element ) )
+
+#define vmGetQueueElemPriority( elem_ptr ) GetQueueElemPriority( (Q_ELEM_PTR) elem_ptr )
+#define vmSetQueueElemPriority( elem_ptr, value ) SetQueueElemPriority( (Q_ELEM_PTR) elem_ptr, (VQ_HDL) value )
+#define vmGetQueueElemPtr( elem_ptr ) GetQueueElemPtr( (Q_ELEM_PTR) elem_ptr )
+#define vmSetQueueElemPtr( elem_ptr, value ) SetQueueElemPtr( (Q_ELEM_PTR) elem_ptr, (VQ_HDL) value )
+
+#endif
diff --git a/private/utils/ntbackup/inc/wcs.h b/private/utils/ntbackup/inc/wcs.h
new file mode 100644
index 000000000..cbcf4a5e1
--- /dev/null
+++ b/private/utils/ntbackup/inc/wcs.h
@@ -0,0 +1,63 @@
+/**************************************************
+Copyright (C) Maynard, An Archive Company. 1992
+
+ Name: WCS.H
+
+ Description:
+
+ Wide string functions for using unicode strings under MSC 6.0
+ and not having a library to use. If you add a function, add
+ it to WCS.C, WCS.H, and MAPPINGS.H
+
+ $Log: G:/UI/LOGFILES/WCS.H_V $
+
+ Rev 1.1 10 Jun 1992 17:52:14 STEVEN
+not needed for win32
+
+ Rev 1.0 04 May 1992 13:33:40 MIKEP
+Initial revision.
+
+
+****************************************************/
+
+// Unicode string functions.
+
+#ifndef OS_WIN32
+
+INT wcslen( WCHAR_PTR s );
+WCHAR_PTR wcscpy( WCHAR_PTR s, WCHAR_PTR t );
+WCHAR_PTR wcsncpy( WCHAR_PTR s, WCHAR_PTR t, INT i );
+WCHAR_PTR wcscat( WCHAR_PTR s, WCHAR_PTR t );
+WCHAR_PTR wcsncat( WCHAR_PTR s, WCHAR_PTR t, INT i );
+INT wcscmp( WCHAR_PTR s, WCHAR_PTR t );
+INT wcsncmp( WCHAR_PTR s, WCHAR_PTR t, INT i );
+INT wcsicmp( WCHAR_PTR s, WCHAR_PTR t );
+INT wcsnicmp( WCHAR_PTR s, WCHAR_PTR t, INT i );
+WCHAR_PTR wcsrchr( WCHAR_PTR s, INT c );
+WCHAR_PTR wcschr( WCHAR_PTR s, INT c );
+WCHAR_PTR wcspbrk( WCHAR_PTR s, WCHAR_PTR t );
+WCHAR_PTR wcslwr( WCHAR_PTR s );
+WCHAR_PTR wcsupr( WCHAR_PTR s );
+WCHAR_PTR wcsstr( WCHAR_PTR s, WCHAR_PTR t );
+
+// ANSI Strings for use if UNICODE is defined.
+
+INT strlenA( ACHAR_PTR s );
+ACHAR_PTR strcpyA( ACHAR_PTR s, ACHAR_PTR t );
+ACHAR_PTR strncpyA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+ACHAR_PTR strcatA( ACHAR_PTR s, ACHAR_PTR t );
+ACHAR_PTR strncatA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+INT strcmpA( ACHAR_PTR s, ACHAR_PTR t );
+INT strncmpA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+INT stricmpA( ACHAR_PTR s, ACHAR_PTR t );
+INT strnicmpA( ACHAR_PTR s, ACHAR_PTR t, INT i );
+ACHAR_PTR strrchrA( ACHAR_PTR s, INT c );
+ACHAR_PTR strchrA( ACHAR_PTR s, INT c );
+ACHAR_PTR strpbrkA( ACHAR_PTR s, ACHAR_PTR t );
+ACHAR_PTR strlwrA( ACHAR_PTR s );
+ACHAR_PTR struprA( ACHAR_PTR s );
+ACHAR_PTR strstrA( ACHAR_PTR s, ACHAR_PTR t );
+
+#endif
+
+
diff --git a/private/utils/ntbackup/inc/win3216.h b/private/utils/ntbackup/inc/win3216.h
new file mode 100644
index 000000000..42cfaea51
--- /dev/null
+++ b/private/utils/ntbackup/inc/win3216.h
@@ -0,0 +1,54 @@
+/* NOTE: The SIZE type is new to 16 bit Windows and will soon be incorporated
+ into the distributed Windows 3.1 header file. You must include this
+ typedef in your code until this change is made.
+*/
+typedef struct tagSIZE
+ {
+ int cx;
+ int cy;
+ } SIZE;
+typedef SIZE *PSIZE;
+typedef SIZE NEAR *NPSIZE;
+typedef SIZE FAR *LPSIZE;
+
+// MACROS
+
+
+#if (WINVER < 0x030a)
+
+#ifdef RectVisible
+
+#undef RectVisible
+#undef RectVisibleOld
+#define RectVisible RectVisible
+#define RectVisibleOld RectVisible
+
+#endif
+
+BOOL WINAPI RectVisible(HDC, RECT FAR*);
+
+#endif
+
+// FUNCTION PROTOTYPES
+
+BOOL FAR PASCAL DlgDirSelectEx(HWND, LPSTR, int, int);
+BOOL FAR PASCAL DlgDirSelectComboBoxEx(HWND, LPSTR, int, int);
+BOOL FAR PASCAL GetAspectRatioFilterEx(HDC, LPSIZE);
+BOOL FAR PASCAL GetBitmapDimensionEx(HBITMAP, LPSIZE);
+BOOL FAR PASCAL GetBrushOrgEx(HDC, LPPOINT);
+BOOL FAR PASCAL GetCurrentPositionEx(HDC, LPPOINT);
+BOOL FAR PASCAL GetTextExtentPoint(HDC, LPSTR, int, LPSIZE);
+BOOL FAR PASCAL GetViewportExtEx(HDC, LPSIZE);
+BOOL FAR PASCAL GetViewportOrgEx(HDC, LPPOINT);
+BOOL FAR PASCAL GetWindowExtEx(HDC, LPSIZE);
+BOOL FAR PASCAL GetWindowOrgEx(HDC, LPPOINT);
+BOOL FAR PASCAL OffsetViewportOrgEx(HDC, int, int, LPPOINT);
+BOOL FAR PASCAL OffsetWindowOrgEx(HDC, int, int, LPPOINT);
+BOOL FAR PASCAL MoveToEx(HDC, int, int, LPPOINT);
+BOOL FAR PASCAL ScaleViewportExtEx(HDC, int, int, int, int, LPSIZE);
+BOOL FAR PASCAL ScaleWindowExtEx(HDC, int, int, int, int, LPSIZE);
+BOOL FAR PASCAL SetBitmapDimensionEx(HBITMAP, int, int, LPSIZE);
+BOOL FAR PASCAL SetViewportExtEx(HDC, int, int, LPSIZE);
+BOOL FAR PASCAL SetViewportOrgEx(HDC, int, int, LPPOINT);
+BOOL FAR PASCAL SetWindowExtEx(HDC, int, int, LPSIZE);
+BOOL FAR PASCAL SetWindowOrgEx(HDC, int, int, LPPOINT);
diff --git a/private/utils/ntbackup/inc/winmang.h b/private/utils/ntbackup/inc/winmang.h
new file mode 100644
index 000000000..242a7f0a9
--- /dev/null
+++ b/private/utils/ntbackup/inc/winmang.h
@@ -0,0 +1,550 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: winmang.h
+
+ Description: This file contains the definitions, macros, and function
+ prototypes for the Maynstream GUI Window Manager (WM).
+
+ $Log: G:/UI/LOGFILES/WINMANG.H_V $
+
+ Rev 1.33 23 Sep 1993 15:52:46 GLENN
+Added poll drive user message ID.
+
+ Rev 1.32 13 Aug 1993 15:22:20 GLENN
+Removed ifdef around sort IDs.
+
+ Rev 1.31 09 Jun 1993 15:09:22 MIKEP
+enable c++
+
+
+ Rev 1.30 07 May 1993 14:23:26 DARRYLP
+Added Rob's changes for delete key trappings
+
+ Rev 1.29 26 Apr 1993 08:36:30 MIKEP
+Added ID_VIEWFONT to call vlm_changesettings with. This allows
+the vlm area to refresh all windows in case the font changed case
+for FAT drives.
+
+ Rev 1.28 22 Apr 1993 16:01:10 GLENN
+Added file SORT option support.
+
+ Rev 1.27 21 Apr 1993 16:07:06 GLENN
+Changed window classes to be unique for Nostradamus and Cayman.
+
+ Rev 1.26 07 Apr 1993 16:28:30 GLENN
+Changed APP specific class names to have a prefix of CBE - Conner Backup Exec.
+
+ Rev 1.25 01 Nov 1992 16:33:52 DAVEV
+Unicode changes
+
+ Rev 1.24 14 Oct 1992 15:56:44 GLENN
+Added Wait Cursor HIDE, SHOW, PAUSE, RESUME, features to guarantee Hourglass when our App is busy.
+
+ Rev 1.23 04 Oct 1992 19:50:04 DAVEV
+UNICODE AWK PASS
+
+ Rev 1.22 02 Oct 1992 16:51:32 GLENN
+Added WM_SetCursor().
+
+ Rev 1.21 10 Jul 1992 10:14:24 GLENN
+In process of adding font selection support.
+
+ Rev 1.20 19 Mar 1992 11:45:12 JOHNWT
+added WM_MakeAppActive
+
+ Rev 1.19 16 Mar 1992 15:37:22 JOHNWT
+fixed WM_TerminateApp
+
+ Rev 1.18 10 Mar 1992 16:39:50 GLENN
+Added WM_MoveWindow().
+
+ Rev 1.17 09 Mar 1992 09:20:52 GLENN
+Added logo bitmap support.
+
+ Rev 1.16 03 Mar 1992 17:27:48 GLENN
+Added new view window support.
+
+ Rev 1.15 20 Feb 1992 11:21:24 GLENN
+Removed WM_IsActiveDocMax... different way of doing it now to support NT.
+
+ Rev 1.14 18 Feb 1992 20:48:40 GLENN
+Changed WMSIZE types.
+
+ Rev 1.13 18 Feb 1992 18:48:44 GLENN
+Added support routines for auto min/max/restore of MDI docs before/after an operation/
+
+ Rev 1.12 11 Feb 1992 17:32:16 GLENN
+Added support for MDI client subclassing.
+
+ Rev 1.11 10 Feb 1992 09:15:10 GLENN
+Moved the WM_USER IDs to a common location.
+
+ Rev 1.10 04 Feb 1992 15:01:28 STEVEN
+added macro for point conversion
+
+ Rev 1.9 29 Jan 1992 17:57:08 GLENN
+DLM command ID.
+
+ Rev 1.8 21 Jan 1992 13:34:02 GLENN
+Added WM_AnimateAppIcon() proto.
+
+ Rev 1.7 07 Jan 1992 17:24:02 GLENN
+Added MDI split/slider support
+
+ Rev 1.6 10 Dec 1991 13:55:44 GLENN
+Added defines for the creation of single column flat list boxes
+
+ Rev 1.5 05 Dec 1991 17:43:54 GLENN
+Changed get active doc macro
+
+ Rev 1.4 05 Dec 1991 11:25:18 DAVEV
+16/32 bit Windows port changes - 1st pass
+
+ Rev 1.3 04 Dec 1991 18:15:46 GLENN
+Added terminate app macro.
+
+ Rev 1.2 03 Dec 1991 16:03:00 GLENN
+Added a bunch of IDs for Keyboard character support.
+
+ Rev 1.1 27 Nov 1991 13:36:22 GLENN
+Added macros for filling out the window manager data structure.
+
+ Rev 1.0 20 Nov 1991 19:40:16 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+
+#ifndef WINMANG_H
+
+#define WINMANG_H
+
+
+// Window Creation Types
+
+#define WM_TYPE_BITS 0x00FF
+#define WM_MINMAX_BITS 0x0300
+#define WM_STYLE_BITS 0x3C00
+#define WM_MENU_BITS 0xC000
+
+#define WM_FRAME 0
+#define WM_CLIENT 1
+#define WM_RIBBON 2
+#define WM_MDIPRIMARY 3
+#define WM_MDISECONDARY 4
+#define WM_DDECLIENT 5
+#define WM_DDESERVER 6
+#define WM_SERVER 7
+#define WM_DEBUG 8
+#define WM_DUMB 9
+
+#define WM_MIN 0x0100
+#define WM_MAX 0x0200
+
+#define WM_VIEWWIN 0x0000
+#define WM_FLATLISTMC 0x1000 // FLAT LIST MULTI-COLUMN
+#define WM_TREELISTSC 0x2000 // TREE LIST SINGLE-COLUMN
+#define WM_FLATLISTSC 0x0400 // FLAT LIST SINGLE-COLUMN -- ODD TYPES
+#define WM_TREELISTMC 0x0800 // TREE LIST MULTI-COLUMN -- ODD TYPES
+#define WM_FLATLIST WM_FLATLISTMC
+#define WM_TREELIST WM_TREELISTSC
+#define WM_TREEANDFLATMC ( WM_TREELISTSC | WM_FLATLISTMC )
+#define WM_TREEANDFLATSC ( WM_TREELISTSC | WM_FLATLISTSC )
+
+#define WM_MENUS 0x4000
+
+// Undocumented Windows Messages
+
+#define WM_LBTRACKPOINT 0x0131
+
+// Window Sizes
+
+#define WMSIZE_NORMAL 0
+#define WMSIZE_MIN 1
+#define WMSIZE_MAX 2
+#define WMSIZE_IGNORE 3
+#define WMSIZE_UNKNOWN -1
+
+// Application Window Types
+
+#define WMTYPE_DISKS 0
+#define WMTYPE_TAPES 1
+#define WMTYPE_MACROS 2
+#define WMTYPE_JOBS 3
+#define WMTYPE_DISKTREE 4
+#define WMTYPE_TAPETREE 5
+#define WMTYPE_DISKFILES 6
+#define WMTYPE_TAPEFILES 7
+#define WMTYPE_SERVERS 8
+#define WMTYPE_LOGFILES 9
+#define WMTYPE_DEBUG 10
+#define WMTYPE_SEARCH 11
+#define WMTYPE_LOGVIEW 12
+#ifdef OEM_EMS
+#define WMTYPE_EXCHANGE 13
+#endif
+
+// Application message IDs
+
+#define ID_FLATONLY IDM_VIEWDIRONLY
+#define ID_TREEONLY IDM_VIEWTREEONLY
+#define ID_TREEANDFLAT IDM_VIEWTREEANDDIR
+#define ID_FILEDETAILS IDM_VIEWALLFILEDETAILS
+#define ID_EXPANDALL IDM_TREEEXPANDALL
+#define ID_EXPANDBRANCH IDM_TREEEXPANDBRANCH
+#define ID_EXPANDONE IDM_TREEEXPANDONE
+#define ID_COLLAPSEBRANCH IDM_TREECOLLAPSEBRANCH
+#define ID_INDICATORS IDM_TREESHOWINDICATORS
+#define ID_SELECT IDM_SELECTCHECK
+#define ID_DESELECT IDM_SELECTUNCHECK
+#define ID_MODIFIED IDM_SELECTMODIFIEDFILES
+#define ID_ADVANCED IDM_SELECTADVANCED
+#define ID_REFRESH IDM_WINDOWSREFRESH
+#define ID_CLOSEALL IDM_WINDOWSCLOSEALL
+#define ID_VIEWFONT IDM_VIEWFONT
+#define ID_SORTNAME IDM_VIEWSORTNAME
+#define ID_SORTTYPE IDM_VIEWSORTTYPE
+#define ID_SORTSIZE IDM_VIEWSORTSIZE
+#define ID_SORTDATE IDM_VIEWSORTDATE
+
+#define ID_SERVERS 1
+#define ID_RESTORETODRIVE 2
+#define ID_CTRLARROWUP 3
+#define ID_CTRLARROWDOWN 4
+#define ID_ARROWLEFT 5
+#define ID_ARROWRIGHT 6
+#define ID_NAMEONLY 7
+#define ID_FONTCASECHANGE 8
+#define ID_DELETE 9
+
+#define WM_CLIENT_ID 0xCAC // The Client Window ID.
+
+#define WM_DEFAULT CW_USEDEFAULT // Use default window size.
+#define GWL_PDSWININFO 0 // The offset of the Window Info struct.
+#define GWW_HWNDEDIT 0
+#define GWW_CHANGED 2
+#define GWW_WORDWRAP 4
+#define GWW_UNTITLED 6
+#define DEBUG_EXTRA 8
+
+// APPLICATION DEFINED CLASS NAMES
+
+#ifdef OEM_MSOFT
+
+ #define WMCLASS_FRAME TEXT("NTBframe") // Class name for the frame window.
+ #define WMCLASS_DOC TEXT("NTBdoc") // Class name for MDI document windows.
+ #define WMCLASS_RIBBON TEXT("NTBribbon") // Class name for the ribbon windows.
+ #define WMCLASS_DDECLIENT TEXT("NTBddeclient") // Class name for the ddeclient windows.
+ #define WMCLASS_LAUNCHER TEXT("NTBlauncher") // Class name for the launcher window.
+ #define WMCLASS_VIEWWIN TEXT("NTBviewwin") // Class name for the dumb window.
+ #define WMCLASS_LOGO TEXT("NTBlogo") // Class name for the logo window.
+
+#else
+
+ #define WMCLASS_FRAME TEXT("CBEframe") // Class name for the frame window.
+ #define WMCLASS_DOC TEXT("CBEdoc") // Class name for MDI document windows.
+ #define WMCLASS_RIBBON TEXT("CBEribbon") // Class name for the ribbon windows.
+ #define WMCLASS_DDECLIENT TEXT("CBEddeclient") // Class name for the ddeclient windows.
+ #define WMCLASS_LAUNCHER TEXT("CBElauncher") // Class name for the launcher window.
+ #define WMCLASS_VIEWWIN TEXT("CBEviewwin") // Class name for the dumb window.
+ #define WMCLASS_LOGO TEXT("CBElogo") // Class name for the logo window.
+
+#endif
+
+// WINDOWS INTERNAL CLASS NAMES
+
+#define WMCLASS_CLIENT TEXT("mdiclient") // Class name for the MDI client window.
+#define WMCLASS_LISTBOX TEXT("listbox") // Class name for the list box windows.
+
+
+#define WMIDC_TREELISTBOX 1
+#define WMIDC_FLATLISTBOX 2
+
+#define WM_TREELISTBOX ( WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_BORDER | \
+ LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | \
+ WS_VSCROLL )
+#define WM_FLATLISTBOXMC ( WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_BORDER | \
+ LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | \
+ LBS_EXTENDEDSEL | LBS_MULTICOLUMN )
+#define WM_FLATLISTBOXSC ( WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_BORDER | \
+ LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | \
+ LBS_EXTENDEDSEL )
+
+#define WMSTYLE_VIEWWIN ( WS_CHILD | WS_BORDER | WS_VISIBLE | CS_HREDRAW | CS_VREDRAW )
+#define WMSTYLE_LOGO ( WS_POPUP | WS_BORDER | WS_VISIBLE )
+
+// DOC WINDOW AND LIST BOX BIT MASKS
+
+#define WMDOC_VIEWWIN 0x0000
+#define WMDOC_TREEANDFLAT 0x0001
+#define WMDOC_TREESC 0x0002
+#define WMDOC_TREEMC 0x0020
+#define WMDOC_FLATMC 0x0004
+#define WMDOC_FLATSC 0x0040
+#define WMDOC_SLIDER 0x0008
+#define WMDOC_TREE WMDOC_TREESC
+#define WMDOC_FLAT WMDOC_FLATMC
+
+#define WM_SLIDERUNKNOWN 0x7FF0
+#define WM_SLIDERMAX 0x7FF1
+#define WM_SLIDERMIN 0x7FF2
+
+// DOC SLIDER DEFINITIONS
+
+#define WMDOC_SLIDERON 0x0001
+#define WMDOC_SLIDERMOVE 0x0002
+#define WMDOC_SLIDEROFF 0x0004
+#define WMDOC_SLIDERCANCEL 0x0008
+
+#define DOC_N_STATUS_HEIGHT (DOC_RIBBON_HEIGHT+STATUS_LINE_HEIGHT)
+#define NONMDICLIENT_HEIGHT (DOC_N_STATUS_HEIGHT+MAIN_RIBBON_HEIGHT)
+
+// SHOW WAIT CURSOR IDs
+
+#define SWC_HIDE FALSE
+#define SWC_SHOW TRUE
+#define SWC_PAUSE ((BOOL)2)
+#define SWC_RESUME ((BOOL)3)
+
+// EXTRA WINDOWS FRAME MESSAGE IDs -- WM_USER+200 through WM_USER+209
+
+#define WM_SETTINGSCHANGED (WM_USER+201)
+#define WM_INITAPPLICATION (WM_USER+203)
+#define WM_DEVICEDRIVERMSG (WM_USER+204)
+
+#define WM_PUBLISHRUNNINGJOB (WM_USER+206) // Used by Winter Park to
+ // tell the launcher which
+ // job is running.
+#define WM_SCHEDULESUPDATED (WM_USER+207) // Used by Winter Park to
+ // tell the launcher to update
+ // it's list of scheduled jobs.
+#define WM_QUERYRUNNINGJOB (WM_USER+208) // Used by Launcher only
+#define WM_POLLDRIVEMSG (WM_USER+209) // Used when poll drive exits
+ // timer callback.
+
+#define WM_DLMDBCLK (WM_USER+300)
+#define WM_DLMDOWN (WM_USER+301)
+#define WM_DLMCLICK (WM_USER+302)
+#define WM_DLMUPDATEITEM (WM_USER+303)
+#define WM_DLMUPDATELIST (WM_USER+304)
+#define WM_DLMDELETEITEMS (WM_USER+305)
+#define WM_DLMADDITEMS (WM_USER+306)
+#define WM_DLMCHAR (WM_USER+307)
+
+#ifdef NTKLUG
+#define WM_DLMGETTEXT (WM_USER+399)
+#endif
+
+#define WM_MSGBOXDRAWTXT (WM_USER+400)
+
+
+typedef struct DS_WMINFO far *DS_WMINFO_PTR;
+typedef struct DS_WMINFO far *PDS_WMINFO;
+typedef struct DS_WMINFO {
+
+ WORD wType;
+ HWND hWnd;
+ HWND hWndTreeList;
+ HWND hWndFlatList;
+ HWND hWndActiveList;
+ HRIBBON hRibbon;
+ HCURSOR hCursor;
+ HCURSOR hDragCursor;
+ HICON hIcon;
+ DWORD dwRibbonState;
+ DWORD dwMenuState;
+ DWORD dwWindowState;
+ INT nSliderPos;
+ DLM_HEADER_PTR pTreeDisp;
+ DLM_HEADER_PTR pFlatDisp;
+ Q_HEADER_PTR pTreeList;
+ Q_HEADER_PTR pFlatList;
+ PVOID pAppInfo;
+ WORD wClosable;
+ BOOL fChanged;
+ WORD wHelpID;
+ WORD wStatusLineID;
+ CHAR_PTR pTitle;
+ CHAR_PTR pMinTitle;
+ INT nSize;
+
+} DS_WMINFO;
+
+// WINDOW MANAGER DATA STRUCTURE GET AND SET MACROS
+
+
+#define WMDS_GetWinType( x ) ( (x)->wType )
+#define WMDS_SetWinType( x, v ) ( (x)->wType = ( v ) )
+
+#define WMDS_GetWin( x ) ( (x)->hWnd )
+#define WMDS_SetWin( x, v ) ( (x)->hWnd = ( v ) )
+
+#define WMDS_GetWinTreeList( x ) ( (x)->hWndTreeList )
+#define WMDS_SetWinTreeList( x, v ) ( (x)->hWndTreeList = ( v ) )
+
+#define WMDS_GetWinFlatList( x ) ( (x)->hWndFlatList )
+#define WMDS_SetWinFlatList( x, v ) ( (x)->hWndFlatList = ( v ) )
+
+#define WMDS_GetWinActiveList( x ) ( (x)->hWndActiveList )
+#define WMDS_SetWinActiveList( x, v ) ( (x)->hWndActiveList = ( v ) )
+
+#define WMDS_GetRibbon( x ) ( (x)->hRibbon )
+#define WMDS_SetRibbon( x, v ) ( (x)->hRibbon = ( v ) )
+
+#define WMDS_GetCursor( x ) ( (x)->hCursor )
+#define WMDS_SetCursor( x, v ) ( (x)->hCursor = ( v ) )
+
+#define WMDS_GetDragCursor( x ) ( (x)->hDragCursor )
+#define WMDS_SetDragCursor( x, v ) ( (x)->hDragCursor = ( v ) )
+
+#define WMDS_GetIcon( x ) ( (x)->hIcon )
+#define WMDS_SetIcon( x, v ) ( (x)->hIcon = ( v ) )
+
+#define WMDS_GetRibbonState( x ) ( (x)->dwRibbonState )
+#define WMDS_SetRibbonState( x, v ) ( (x)->dwRibbonState = ( v ) )
+
+#define WMDS_GetMenuState( x ) ( (x)->dwMenuState )
+#define WMDS_SetMenuState( x, v ) ( (x)->dwMenuState = ( v ) )
+
+#define WMDS_GetWindowState( x ) ( (x)->dwWindowState )
+#define WMDS_SetWindowState( x, v ) ( (x)->dwWindowState = ( v ) )
+
+#define WMDS_GetSliderPos( x ) ( (x)->nSliderPos )
+#define WMDS_SetSliderPos( x, v ) ( (x)->nSliderPos = ( v ) )
+
+#define WMDS_GetTreeDisp( x ) ( (x)->pTreeDisp )
+#define WMDS_SetTreeDisp( x, v ) ( (x)->pTreeDisp = ( v ) )
+
+#define WMDS_GetFlatDisp( x ) ( (x)->pFlatDisp )
+#define WMDS_SetFlatDisp( x, v ) ( (x)->pFlatDisp = ( v ) )
+
+#define WMDS_GetTreeList( x ) ( (x)->pTreeList )
+#define WMDS_SetTreeList( x, v ) ( (x)->pTreeList = ( v ) )
+
+#define WMDS_GetFlatList( x ) ( (x)->pFlatList )
+#define WMDS_SetFlatList( x, v ) ( (x)->pFlatList = ( v ) )
+
+#define WMDS_GetAppInfo( x ) ( (x)->pAppInfo )
+#define WMDS_SetAppInfo( x, v ) ( (x)->pAppInfo = ( v ) )
+
+#define WMDS_GetWinClosable( x ) ( (x)->wClosable )
+#define WMDS_SetWinClosable( x, v ) ( (x)->wClosable = ( v ) )
+
+#define WMDS_GetWinChanged( x ) ( (x)->fChanged )
+#define WMDS_SetWinChanged( x, v ) ( (x)->fChanged = ( v ) )
+
+#define WMDS_GetWinHelpID( x ) ( (x)->wHelpID )
+#define WMDS_SetWinHelpID( x, v ) ( (x)->wHelpID = ( v ) )
+
+#define WMDS_GetStatusLineID( x ) ( (x)->wStatusLineID )
+#define WMDS_SetStatusLineID( x, v ) ( (x)->wStatusLineID = ( v ) )
+
+#define WMDS_GetWinTitle( x ) ( (x)->pTitle )
+
+#define WMDS_GetWinMinTitle( x ) ( (x)->pMinTitle )
+
+#define WMDS_GetSize( x ) ( (x)->nSize )
+#define WMDS_SetSize( x, v ) ( (x)->nSize = ( v ) )
+
+
+// MACROS
+
+#define WM_Destroy( x ) (BOOL)SendMessage( ghWndMDIClient, WM_MDIDESTROY, (MP1)x, (MP2)0 )
+#define WM_GetActive( ) ( GetActiveWindow( ) )
+#define WM_GetActiveDoc( ) ( ( ghWndActiveDoc ) ? ghWndActiveDoc : (HWND)SendMessage( ghWndMDIClient, WM_MDIGETACTIVE, (MP1)0, (MP2)0 ) )
+#define WM_GetAppPtr( x ) ( (PDS_WMINFO)GetWindowLong( x, GWL_PDSWININFO ) )->pAppInfo
+#define WM_GetDC( x ) GetDC( x )
+#define WM_GetInfoPtr( x ) (PDS_WMINFO)GetWindowLong( x, GWL_PDSWININFO )
+#define WM_Hide( x ) ShowWindow( x, SW_HIDE )
+#define WM_IsActive( x ) ( x == GetActiveWindow () )
+#define WM_IsActiveDoc( x ) ( x == WM_GetActiveDoc () )
+#define WM_IsChildOf( x, y ) (BOOL)( IsChild( x, y ) )
+#define WM_IsFlatActive( x ) ( (x)->hWndFlatList == (x)->hWndActiveList )
+#define WM_IsMaximized( x ) (BOOL)( IsZoomed( x ) )
+#define WM_IsMinimized( x ) (BOOL)( IsIconic( x ) )
+#define WM_IsTreeActive( x ) ( (x)->hWndTreeList == (x)->hWndActiveList )
+#define WM_MaximizeDoc( x ) SendMessage( ghWndMDIClient, WM_MDIMAXIMIZE, (MP1)x, (MP2)0 )
+#define WM_MinimizeDoc( x ) ShowWindow( x, SW_SHOWMINNOACTIVE )
+#define WM_Minimize( x ) ShowWindow( x, SW_SHOWMINNOACTIVE )
+#define WM_Notify( x, y ) PostMessage( ghWndFrame, WM_SETTINGSCHANGED, (MP1)x, (MP2)y )
+#define WM_Restore( x ) ShowWindow( x, SW_SHOWNORMAL )
+#define WM_RestoreDoc( x ) SendMessage( ghWndMDIClient, WM_MDIRESTORE, (MP1)x, (MP2)0 )
+#define WM_SetActive( x ) SetActiveWindow( x )
+#define WM_SetActiveDoc( x ) SendMessage( ghWndMDIClient, WM_MDIACTIVATE, (MP1)x, (MP2)0 )
+#define WM_SetInfoPtr( x, y ) SetWindowLong( x, GWL_PDSWININFO, (DWORD)y )
+#define WM_Show( x ) ShowWindow( x, SW_SHOW )
+#define WM_TerminateApp( ) DestroyWindow( ghWndFrame )
+#define WM_Update( x ) UpdateWindow( x )
+
+#define WM_FromMP2toPOINT( a, b ) \
+ ( (a.y = (int)((b) >> 16)), (a.x = (int)((b) & 0xffff)) )
+
+// MACROS FOR PORTING
+
+#ifndef OS_WIN32
+#define EXTRACT_RIBBON_PARENT_HWND( x ) (LOWORD((DWORD)(x)))
+#define WM_GetClassCursor( x ) (HCURSOR)GetClassWord( x, GCW_HCURSOR )
+#define WM_GetClassIcon( x ) (HICON)GetClassWord( x, GCW_HICON )
+#define WM_SetClassCursor( x, y ) (HCURSOR)SetClassWord( x, GCW_HCURSOR, (WORD) y )
+#define WM_SetClassIcon( x, y ) (HICON)SetClassWord( x, GCW_HICON, (WORD) y )
+#else
+#define EXTRACT_RIBBON_PARENT_HWND( x ) ((HWND)(x))
+#define WM_GetClassCursor( x ) (HCURSOR)GetClassLong( x, GCL_HCURSOR )
+#define WM_GetClassIcon( x ) (HICON)GetClassLong( x, GCL_HICON )
+#define WM_SetClassCursor( x, y ) (HCURSOR)SetClassLong( x, GCL_HCURSOR,(LONG) y )
+#define WM_SetClassIcon( x, y ) (HICON)SetClassLong( x, GCL_HICON, (LONG) y )
+#endif
+
+
+
+// FUNCTION PROTOTYPES
+
+BOOL WM_AnimateAppIcon ( WORD, BOOL );
+VOID WM_CloseAllDocs ( VOID );
+BOOL WM_ChangeFont ( VOID );
+HWND WM_Create ( WORD, LPSTR, LPSTR, INT, INT, INT, INT, PDS_WMINFO );
+BOOL WM_CreateObjects ( VOID );
+VOID WM_CreatePrimDocs ( VOID );
+VOID WM_Deinit ( VOID );
+VOID WM_DeleteObjects ( VOID );
+VOID WM_DocActivate ( HWND );
+WORD WM_DocIsMenuChange ( HWND, WORD );
+BOOL WM_DocKeyDown ( HWND hWnd, WORD wKey );
+VOID WM_DocSetSliderMode ( HWND, WORD );
+VOID WM_FrameUpdate ( VOID );
+HICON WM_GetAppIcon ( VOID );
+HWND WM_GetNext ( HWND );
+BOOL WM_GetRect ( HWND );
+INT WM_GetTitle ( HWND, LPSTR, INT );
+BOOL WM_Init ( LPSTR, INT );
+VOID WM_LogoShow ( VOID );
+VOID WM_LogoDestroy ( VOID );
+VOID WM_MinimizeDocs ( VOID );
+VOID WM_MoveWindow ( HWND, INT, INT, INT, INT, BOOL );
+BOOL WM_QueryCloseAllDocs ( VOID );
+VOID WM_RestoreDocs ( VOID );
+HICON WM_SetAppIcon ( HICON );
+BOOL WM_SetCursor ( HWND );
+VOID WM_SetDocSizes ( VOID );
+VOID WM_SetMinTitle ( HWND, LPSTR );
+VOID WM_SetTitle ( HWND, LPSTR );
+VOID WM_SubClassListBox ( HWND );
+VOID WM_SubClassMDIClient ( HWND );
+VOID WM_ShowWaitCursor ( BOOL );
+VOID WM_MakeAppActive( VOID );
+
+// EXPORTED FUNCTIONS
+
+WINRESULT APIENTRY WM_FrameWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT APIENTRY WM_MDIDocWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT APIENTRY WM_RibbonWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT APIENTRY WM_MDIClientWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT APIENTRY WM_DocListWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT APIENTRY WM_DDEClientWndProc ( HWND, MSGID, MP1, MP2 );
+WINRESULT APIENTRY WM_ViewWndProc ( HWND, MSGID, MP1, MP2 );
+
+#endif
diff --git a/private/utils/ntbackup/inc/xferblk.h b/private/utils/ntbackup/inc/xferblk.h
new file mode 100644
index 000000000..7995c8d01
--- /dev/null
+++ b/private/utils/ntbackup/inc/xferblk.h
@@ -0,0 +1,26 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+ Name: xferblk.h
+
+ Description: Contains the global description for a transfer block
+
+ $Log: Q:/LOGFILES/XFERBLK.H_V $
+
+ Rev 1.0 17 Jul 1991 15:39:04 ED
+Initial revision.
+**/
+
+#ifndef XFERB
+
+#define XFERB
+
+typedef struct {
+ UINT8_PTR buffer ; /* buffer address */
+ UINT32 tcount ; /* total count */
+ UINT32 acount ; /* already transfered */
+ UINT16 count ; /* this transfer's req. count */
+ UINT16 xcount ; /* the amount transfered */
+} XBLK, *XBLK_PTR ;
+
+#endif
diff --git a/private/utils/ntbackup/inc/yes_no.h b/private/utils/ntbackup/inc/yes_no.h
new file mode 100644
index 000000000..15fe4c51c
--- /dev/null
+++ b/private/utils/ntbackup/inc/yes_no.h
@@ -0,0 +1,5 @@
+#define ID_YN_LINE_1 105
+#define ID_YN_LINE_2 106
+#define ID_YN_NO 108
+#define ID_YN_YES 107
+
diff --git a/private/utils/ntbackup/src/3dcheck.bmp b/private/utils/ntbackup/src/3dcheck.bmp
new file mode 100644
index 000000000..23d739342
--- /dev/null
+++ b/private/utils/ntbackup/src/3dcheck.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/addbsd.c b/private/utils/ntbackup/src/addbsd.c
new file mode 100644
index 000000000..de5baed6a
--- /dev/null
+++ b/private/utils/ntbackup/src/addbsd.c
@@ -0,0 +1,579 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: addbsd.c
+
+ Description: This file contains code to add and remove a Backup Set
+ Descriptor(BSD) from a BSD list.
+
+
+ $Log: J:/LOGFILES/ADDBSD.C_V $
+
+ Rev 1.26 21 Jul 1993 18:45:20 DON
+If NLM and SMS Object then insert in order presented by the SMDR!
+
+ Rev 1.25 19 Jul 1993 10:30:14 BARRY
+BSD_GetDLE changed to function call -- no longer have ptr to DLE.
+
+ Rev 1.24 08 Jun 1993 13:57:52 MIKEP
+Enable C++ compile.
+
+ Rev 1.23 18 Sep 1992 15:51:26 STEVEN
+fix spelling
+
+ Rev 1.22 17 Sep 1992 11:11:50 STEVEN
+add support for daily backup
+
+ Rev 1.21 09 Jul 1992 14:00:20 STEVEN
+BE_Unicode updates
+
+ Rev 1.20 10 Jun 1992 15:51:54 TIMN
+Changed drive letter length or UNIC
+
+ Rev 1.19 26 May 1992 11:20:40 TIMN
+Cleaned up memory fx calls
+
+ Rev 1.18 21 May 1992 17:05:22 TIMN
+Changed maxByteLen to memorycmp calls
+
+ Rev 1.17 19 May 1992 13:18:04 MIKEP
+mips changes
+
+ Rev 1.16 19 May 1992 12:58:26 TIMN
+Replaced strlen with DeviceNameLeng macro
+
+ Rev 1.15 18 May 1992 16:04:10 TIMN
+Changed str functions to mem
+
+ Rev 1.14 08 May 1992 16:24:18 STEVEN
+added volume label to BSD
+
+ Rev 1.13 16 Apr 1992 10:54:08 HUNTER
+Add new BSDs to tail if not sorting
+
+ Rev 1.12 18 Feb 1992 17:27:06 BARRY
+Fixed destruction of comp_val after volume number comparison.
+
+ Rev 1.11 11 Feb 1992 12:42:46 BARRY
+Fixed problem sorting Novell mapped drives.
+
+ Rev 1.10 05 Feb 1992 15:31:44 BARRY
+Don't sort IMAGE DLEs by drive letters alone.
+
+ Rev 1.9 14 Jan 1992 16:35:18 DON
+needed to sort novell/server dle's by volume if sorting
+
+ Rev 1.8 14 Jan 1992 10:23:34 STEVEN
+fix warnings for WIN32
+
+ Rev 1.7 13 Jan 1992 18:36:34 STEVEN
+added config switch for BSD sort
+
+ Rev 1.6 27 Aug 1991 17:30:28 STEVEN
+added BSD target dir support
+
+ Rev 1.5 23 Aug 1991 17:00:14 STEVEN
+added support for NORMAL/COPY/DIFERENTIAL/INCREMENTAL
+
+ Rev 1.4 21 Jun 1991 08:41:14 STEVEN
+new config unit
+
+ Rev 1.3 12 Jun 1991 16:03:02 STEVEN
+BSDU code review
+
+ Rev 1.2 29 May 1991 17:20:56 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.1 13 May 1991 13:21:16 STEVEN
+If the DLE was NULL the Insert sort would cause a protection exception.
+
+
+ Rev 1.0 09 May 1991 13:41:10 HUNTER
+Initial revision.
+
+**/
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+
+#include "msassert.h"
+#include "std_err.h"
+#include "queues.h"
+#include "stdwcs.h"
+
+#include "fsys.h"
+#include "bsdu.h"
+#include "beconfig.h"
+
+static VOID SortInsertBSD( BSD_HAND bsdh, BSD_PTR bsd ) ;
+
+
+/**/
+/**
+
+ Name: BSD_Add()
+
+ Description: This function allocates memory for a BSD element. It
+ then initializes this element with the data provided. Finally it
+ is added to the current oper QUEUE of the BSD handle.
+
+ Modified: 8/7/1989
+
+ Returns: Error codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: A sort date of NULL is considered 0-0-0 0:0:0
+
+ See also: $/SEE( BSD_Remove() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_Add(
+BSD_HAND bsdh, /* I - BSD List to add the new bsd to */
+BSD_PTR *bsd, /* O - return pointer to new bsd */
+struct BE_CFG *cfg, /* I - configuration to use during oper */
+VOID_PTR stats, /* I - statistics struct to use during oper */
+struct GENERIC_DLE *dle, /* I - Disk drive to process on */
+UINT32 tap_id, /* I - Specifies the tape to process with */
+UINT16 tap_num, /* I - Specifies which tape in family */
+INT16 set_num, /* I - Specifies which set on the tape */
+struct THW *thw, /* I - Specifies which tape drive to process*/
+DATE_TIME_PTR sort_date ) /* I - used to sort the BSDs in the list */
+{
+ INT16 ret_val = SUCCESS ;
+
+ msassert( bsd != NULL );
+
+ *bsd = (BSD_PTR)calloc( 1, sizeof( **bsd ) ) ;
+
+ if ( *bsd != NULL ) {
+
+ (*bsd)->tape_id = tap_id ;
+ (*bsd)->tape_num = tap_num ;
+ (*bsd)->set_num = set_num ;
+ (*bsd)->stats = stats ;
+ (*bsd)->thw = thw ;
+ (*bsd)->cfg = cfg ;
+
+ BSD_SetDLE( *bsd, dle );
+ BEC_UseConfig( cfg ) ;
+
+ SetQueueElemPtr( &((*bsd)->q), bsdh ) ;
+
+ (*bsd)->flags.tp_name_chg = TRUE ;
+ (*bsd)->flags.bs_name_chg = TRUE ;
+ (*bsd)->flags.bs_dscr_chg = TRUE ;
+
+ if ( (sort_date != NULL) && (sort_date->date_valid) ) {
+ (*bsd)->sort_date = *sort_date ;
+ } else {
+ memset( &((*bsd)->sort_date), 0, sizeof( DATE_TIME ) ) ;
+ }
+
+ if( dle != NULL ) {
+ DLE_IncBSDCount( dle ) ;
+ }
+
+ SortInsertBSD( bsdh, *bsd ) ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: BSD_Remove()
+
+ Description: This function releases all FSEs for the BSD specified. It
+ Then releases the memory for the BSD itself.
+
+
+ Modified: 8/7/1989
+
+ Returns: None
+
+ Notes: Released BSDs should not be accessed by application.
+
+ See also: $/SEE( BSD_Add() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_Remove(
+BSD_PTR bsd ) /* I - specific BSD to delete from list */
+{
+ BSD_HAND bsdh ;
+
+ msassert( bsd != NULL );
+
+ bsdh = (BSD_HAND)GetQueueElemPtr( &(bsd->q) ) ;
+
+ if ( RemoveQueueElem( &(bsdh->current_q_hdr), &(bsd->q) ) == SUCCESS ) {
+
+ GENERIC_DLE_PTR dle = BSD_GetDLE( bsd );
+
+ if ( dle != NULL ) {
+ DLE_DecBSDCount( dle ) ;
+ }
+
+ BEC_ReleaseConfig( bsd->cfg ) ;
+ BSD_ClearAllLBA( bsd ) ;
+ BSD_ClearAllFSE( bsd ) ;
+
+ free( bsd->vol_label ) ;
+ free( bsd->tape_label ) ;
+ free( bsd->tape_pswd ) ;
+ free( bsd->set_label ) ;
+ free( bsd->set_descript ) ;
+ free( bsd->set_pswd ) ;
+ free( bsd->user_name ) ;
+ free( bsd->target_path ) ;
+ free( bsd->match_buffer ) ;
+ free( bsd->dle_name );
+
+ free( bsd ) ;
+
+ } else {
+ msassert( NULL == TEXT("bsd not in queue") );
+ }
+}
+/**/
+/**
+
+ Name: SortInsertBSD()
+
+ Description: This function performs an insersion sort on the BSD
+ list. The list is sorted using the following criteria:
+ sort_date,
+ tape_number,
+ set_number,
+ device_type,
+ device_name,
+
+ Modified: 6/11/1991 13:8:51
+
+ Returns: None
+
+ Notes: This function is called only by BSD_Add()
+
+ See also: $/SEE( BSD_Add() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static VOID SortInsertBSD(
+BSD_HAND bsdh, /* I - BSD list to insert the new BSD into */
+BSD_PTR bsd ) /* I - points to the new BSD */
+{
+ INT16 comp_val ;
+ BSD_PTR current_bsd ;
+ UINT8 new_vol_num = 0 ;
+ UINT8 curr_vol_num = 0 ;
+ GENERIC_DLE_PTR dle = BSD_GetDLE( bsd );
+ GENERIC_DLE_PTR currDLE;
+
+ current_bsd = (BSD_PTR)QueueHead( &(bsdh->current_q_hdr) ) ;
+
+ while ( current_bsd != NULL ) {
+
+ currDLE = BSD_GetDLE( current_bsd );
+
+ comp_val = CompDate( &(bsd->sort_date), &(current_bsd->sort_date) ) ;
+
+ if ( comp_val == 0 ) {
+ comp_val = bsd->tape_num - current_bsd->tape_num ;
+ }
+
+ if ( comp_val == 0 ) {
+ comp_val = (INT16)(abs( bsd->set_num ) - abs( current_bsd->set_num )) ;
+ }
+
+ if ( comp_val == 0 ) {
+ if ( !BEC_GetSortBSD( bsd->cfg ) ) {
+ comp_val = 0 ;
+ current_bsd = (BSD_PTR)QueueTail( &(bsdh->current_q_hdr) ) ;
+ currDLE = BSD_GetDLE( current_bsd );
+
+ } else if ( (dle == NULL) && (currDLE == NULL) ) {
+ comp_val = 0;
+ } else if ( (dle != NULL) && (currDLE == NULL) ) {
+ comp_val = 1;
+ } else if ( (dle == NULL) && (currDLE != NULL) ) {
+ comp_val = -1;
+ } else {
+
+ /* Check for inserting BSD for Novell server/volume and handle accordingly */
+#if defined(OS_NLM)
+ if ( DLE_GetDeviceType( dle ) == SMS_OBJECT )
+ {
+ /*
+ If it's SMS then just process them in the order
+ there picked up by the SMDR!
+ */
+ comp_val = 1;
+ }
+ else
+ {
+ if ( ( DLE_GetDeviceType( dle ) == NLM_AFP_VOLUME ) ||
+ ( DLE_GetDeviceType( dle ) == NLM_VOLUME ) ) {
+
+ /* If the current BSD is also a server/volume... */
+ if ( ( DLE_GetDeviceType( currDLE ) == NLM_AFP_VOLUME ) ||
+ ( DLE_GetDeviceType( currDLE ) == NLM_VOLUME ) ) {
+
+ /* Now check to see if these BSDs refer to the same server (same parent) */
+ if( DLE_GetParent( dle ) == DLE_GetParent( currDLE ) ) {
+
+ /* Now let's make sure that we sort by the volume number... */
+ new_vol_num = DLE_GetDeviceType( dle ) == NLM_AFP_VOLUME ?
+ dle->info.nlm_afp->vol_num : dle->info.nlm->vol_num ;
+ curr_vol_num = DLE_GetDeviceType( currDLE ) == NOVELL_AFP_DRV ?
+ currDLE->info.nlm_afp->vol_num : currDLE->info.nlm->vol_num ;
+ comp_val = new_vol_num - curr_vol_num ;
+
+ } else {
+
+ comp_val = memoryicmp( DLE_GetDeviceName( dle ),
+ DLE_GetDeviceNameLeng( dle ),
+ DLE_GetDeviceName( currDLE ),
+ DLE_GetDeviceNameLeng( currDLE ) ) ;
+ }
+ }
+ }
+ }
+#else
+ if ( (DLE_GetParent( dle ) != NULL) &&
+ ((DLE_GetDeviceType( dle ) == NOVELL_AFP_DRV) ||
+ (DLE_GetDeviceType( dle ) == NOVELL_DRV)) ) {
+
+ /* If the current BSD is also a server/volume... */
+ if ( (DLE_GetParent( currDLE ) != NULL) &&
+ ((DLE_GetDeviceType( currDLE ) == NOVELL_AFP_DRV) ||
+ (DLE_GetDeviceType( currDLE ) == NOVELL_DRV)) ) {
+
+ /* Now check to see if these BSDs refer to the same server (same parent) */
+ if( DLE_GetParent( dle ) == DLE_GetParent( currDLE ) ) {
+
+ /* Now let's make sure that we sort by the volume number... */
+ new_vol_num = DLE_GetDeviceType( dle ) == NOVELL_AFP_DRV ?
+ dle->info.afp->vol_num : dle->info.nov->vol_num ;
+ curr_vol_num = DLE_GetDeviceType( currDLE ) == NOVELL_AFP_DRV ?
+ currDLE->info.afp->vol_num : currDLE->info.nov->vol_num ;
+ comp_val = new_vol_num - curr_vol_num ;
+
+ } else {
+
+ comp_val = memoryicmp( DLE_GetDeviceName( dle ),
+ DLE_GetDeviceNameLeng( dle ),
+ DLE_GetDeviceName( currDLE ),
+ DLE_GetDeviceNameLeng( currDLE ) ) ;
+ }
+
+ }
+
+ }
+
+ if ( comp_val == 0 ) {
+ /*
+ * If the DLEs are both named "x:" (where x is some drive
+ * letter) then don't sort on the DLE type unless one
+ * of them is an IMAGE DLE. We don't want these mixed
+ * in with the other drive letters.
+ */
+
+ if ( !DLE_HasFeatures( dle, DLE_FEAT_MAPPED_DRIVE ) ) {
+
+ comp_val = (INT16)(DLE_GetDeviceType( dle )
+ - DLE_GetDeviceType( currDLE ) ) ;
+ }
+ }
+#endif
+ if ( comp_val == 0 ) {
+ comp_val = memoryicmp( DLE_GetDeviceName( dle ),
+ DLE_GetDeviceNameLeng( dle ),
+ DLE_GetDeviceName( currDLE ),
+ DLE_GetDeviceNameLeng( currDLE ) ) ;
+ }
+ }
+
+ }
+
+ if ( comp_val <= 0 ) {
+ break ;
+ }
+
+ current_bsd = (BSD_PTR)QueueNext( &(current_bsd->q) ) ;
+ }
+
+ if ( current_bsd != NULL ) {
+
+ if ( comp_val == 0 ) {
+ InsertElem( &(bsdh->current_q_hdr), &(current_bsd->q), &(bsd->q), AFTER ) ;
+
+ } else {
+
+ InsertElem( &(bsdh->current_q_hdr), &(current_bsd->q), &(bsd->q), BEFORE ) ;
+ }
+
+ } else {
+
+ EnQueueElem( &(bsdh->current_q_hdr), &(bsd->q), FALSE ) ;
+
+ }
+
+}
+
+/**/
+/**
+
+ Name: BSD_SetDLE
+
+ Description: This function sets the DLE in a BSD. It increments
+ the BSD count in the new DLE. If the BSD was attached to an
+ old DLE then the old DLE BSD count is decremented.
+
+ Modified: 11/21/1989
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_SetDLE( BSD_PTR bsd,
+ GENERIC_DLE_PTR newDLE )
+{
+ GENERIC_DLE_PTR oldDLE = BSD_GetDLE( bsd );
+
+ if ( oldDLE != NULL )
+ {
+ DLE_DecBSDCount( oldDLE ) ;
+ }
+
+ bsd->dle_head = NULL;
+ if ( newDLE == NULL )
+ {
+ free( bsd->dle_name );
+ bsd->dle_name = NULL;
+ }
+ else
+ {
+ DLE_IncBSDCount( newDLE ) ;
+ bsd->dle_name = realloc( bsd->dle_name, strsize( DLE_GetDeviceName( newDLE ) ) );
+ if ( bsd->dle_name != NULL )
+ {
+ bsd->dle_head = DLE_GetHandle( newDLE );
+ strcpy( bsd->dle_name, DLE_GetDeviceName( newDLE ) );
+ }
+ }
+}
+
+/**/
+/**
+
+ Name: BSD_GetDLE()
+
+ Description: Returns the DLE for the specified BSD.
+
+ Modified: 18-Jul-93
+
+ Returns: DLE ptr or NULL if DLE has disappeared.
+
+ Notes:
+
+**/
+GENERIC_DLE_PTR BSD_GetDLE( BSD_PTR bsd )
+{
+ GENERIC_DLE_PTR dle = NULL;
+
+ if ( bsd->dle_head != NULL && bsd->dle_name != NULL )
+ {
+ DLE_FindByName( bsd->dle_head,
+ bsd->dle_name,
+ -1,
+ &dle );
+
+ }
+ return dle;
+}
+
+
+/**/
+/**
+
+ Name: BSD_SetBackupType()
+
+ Description: This function sets the backup type for a BSD.
+ The types are defined as follows:
+
+ NORMAL -> backup all selected files & clear modified bit
+ COPY -> backup all selected files & DON'T clear modified bit
+ DIFERENTIAL -> backup modified files & DON't clear modified bit
+ INCREMENTAL -> backup modified files & clear modified bit
+ COMPATIBLE -> look at CFG and FSE for functionality
+
+
+ Modified: 11/21/1989
+
+ Returns: None
+
+**/
+VOID BSD_SetBackupType(
+BSD_PTR bsd,
+INT16 backup_type )
+{
+
+ bsd->flags.backup_type = backup_type ;
+ switch( backup_type ) {
+
+ case BSD_BACKUP_NORMAL:
+ bsd->flags.sup_back_type = TRUE ;
+ bsd->flags.modify_only = FALSE ;
+ bsd->flags.set_mod_flag = TRUE ;
+ break ;
+
+ case BSD_BACKUP_DAILY:
+ case BSD_BACKUP_COPY:
+ bsd->flags.sup_back_type = TRUE ;
+ bsd->flags.modify_only = FALSE ;
+ bsd->flags.set_mod_flag = FALSE ;
+ break ;
+
+ case BSD_BACKUP_DIFFERENTIAL:
+ bsd->flags.sup_back_type = TRUE ;
+ bsd->flags.modify_only = TRUE ;
+ bsd->flags.set_mod_flag = FALSE ;
+ break ;
+
+ case BSD_BACKUP_INCREMENTAL:
+ bsd->flags.sup_back_type = TRUE ;
+ bsd->flags.modify_only = TRUE ;
+ bsd->flags.set_mod_flag = TRUE ;
+ break ;
+
+ case BSD_BACKUP_COMPATIBLE :
+ default:
+ bsd->flags.sup_back_type = FALSE ;
+ bsd->flags.modify_only = FALSE ;
+ bsd->flags.set_mod_flag = FALSE ;
+ break ;
+ }
+}
+
+
+
diff --git a/private/utils/ntbackup/src/addfse.c b/private/utils/ntbackup/src/addfse.c
new file mode 100644
index 000000000..5535438ab
--- /dev/null
+++ b/private/utils/ntbackup/src/addfse.c
@@ -0,0 +1,633 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: addfse.c
+
+ Description: This file contains code to add and remove FSEs from
+ a BSD
+
+ $Log: N:\LOGFILES\ADDFSE.C_V $
+
+ Rev 1.22 24 Mar 1994 13:21:24 MIKEP
+change 1 to sizeof(CHAR)
+
+ Rev 1.21 10 Mar 1994 17:37:08 MARINA
+FSE_UpdateMark/unicode: change 1 to sizeof(CHAR)
+
+ Rev 1.20 17 Jan 1994 17:17:44 BARRY
+Got rid of TEXT macros in msasserts
+
+ Rev 1.19 16 Dec 1993 10:20:10 BARRY
+Change INT8_PTRs to VOID_PTRs
+
+ Rev 1.18 04 Aug 1993 15:26:16 JOHNES
+803EPR0592 - When in FSE_CompareForSub, if one FSE has complex data and the
+other doesn't, if the complex data is empty, pretend it doesn't exist.
+
+This will fix the particular way this problem showed up. There are still
+ways it could happen. A better fix would require more complexity in
+FSE_CompareForSub and how it deals with include/exclude complex info. This
+is more than I can do right now.
+
+
+
+ Rev 1.17 27 Jul 1993 14:42:16 MARILYN
+changed || to && in FSE_CheckForSub
+
+ Rev 1.16 09 Jun 1993 19:21:28 MIKEP
+enable c++ build
+
+ Rev 1.15 09 Oct 1992 11:44:02 DAVEV
+Unicode (CHAR_PTR) pointer cast validation
+
+ Rev 1.14 10 Jun 1992 15:49:18 TIMN
+changed header name
+
+ Rev 1.13 26 May 1992 11:19:24 TIMN
+Cleaned up memory fx calls
+
+ Rev 1.12 21 May 1992 17:03:26 TIMN
+Changed maxByteLen to memoryCMP
+
+ Rev 1.11 19 May 1992 15:18:56 TIMN
+Changed asterisks to define's
+
+ Rev 1.10 18 May 1992 16:03:00 TIMN
+Changed str functions to mem
+
+ Rev 1.9 14 May 1992 12:13:06 TIMN
+Changed CHARs to INT8, strcpy to memcpy
+
+ Rev 1.8 13 May 1992 11:41:12 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.7 28 Feb 1992 09:22:40 STEVEN
+partial excludes being full excludes
+
+ Rev 1.6 14 Jan 1992 10:23:48 STEVEN
+fix warnings for WIN32
+
+ Rev 1.5 02 Oct 1991 15:32:06 STEVEN
+selection type ENTIRE DIR when should be PARTIAL
+
+ Rev 1.4 30 Sep 1991 09:36:38 STEVEN
+Needed to update status when removing an FSE
+
+ Rev 1.3 23 Aug 1991 16:58:56 STEVEN
+now checks to see if in queue before it removes it
+
+ Rev 1.2 12 Jun 1991 16:02:14 STEVEN
+BSDU code review
+
+ Rev 1.1 29 May 1991 17:21:34 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:41:12 HUNTER
+Initial revision.
+
+**/
+#include <malloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+
+#include "std_err.h"
+#include "queues.h"
+#include "stdwcs.h"
+
+#include "bsdu.h"
+
+#define DateAfter( date1, date2 ) (-DateBefore( (date1), (date2) ))
+
+static VOID FSE_UpdateMark( FSE_PTR fse ) ;
+static BOOLEAN FSE_CompareForSub( FSE_PTR fse1, FSE_PTR fse2 );
+static BOOLEAN DateBefore( DATE_TIME_PTR date1, DATE_TIME_PTR date2 ) ;
+static BOOLEAN DateEqual( DATE_TIME_PTR date1, DATE_TIME_PTR date2 ) ;
+static BOOLEAN FSE_ComplexDataEmpty( FSE_COMPLEX_PTR cplx );
+/**/
+/**
+
+ Name: BSD_RemoveFSE()
+
+ Description: This function removes an FSE from the specified
+ BSD.
+
+ Modified: 5/17/1991 14:43:52
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_RemoveFSE(
+FSE_PTR fse ) /* I - specifies which FSE to remove */
+{
+ BSD_PTR bsd ;
+ INT16 ret_val = SUCCESS ;
+
+ msassert( fse != NULL );
+
+ bsd = (BSD_PTR)GetQueueElemPtr( &(fse->q) ) ;
+
+ if ( bsd != NULL ) {
+
+ ret_val = RemoveQueueElem( &(bsd->fse_q_hdr), &(fse->q) ) ;
+ }
+
+ if ( ret_val == SUCCESS ) {
+
+ if( fse->tgt != NULL ) {
+ bsd->tgt_fse_exist-- ;
+ free( fse->tgt ) ;
+ }
+
+ if( fse->cplx != NULL ) {
+ free( fse->cplx->pre_m_date ) ;
+ free( fse->cplx->post_m_date ) ;
+ free( fse->cplx->access_date ) ;
+ free( fse->cplx->backup_date ) ;
+ free( fse->cplx ) ;
+ }
+
+ free( fse ) ;
+
+ } else {
+ msassert( ("FSE NOT found in BSD", 0) );
+ }
+
+ if ( bsd != NULL ) {
+ fse = BSD_GetFirstFSE( bsd ) ;
+ if ( fse == NULL ) {
+ bsd->select_status = NONE_SELECTED ;
+ }
+ }
+}
+/**/
+/**
+
+ Name: BSD_CreateFSE()
+
+ Description: This function allocates memory for an FSE. It then
+ initializes the allocated memory with the data provided. This
+ function only initializes the simple selection data. To set
+ the complex selection data( dates & attributes) other FSE
+ function calls must be made.
+
+ Modified: 8/9/1989
+
+ Returns: Error codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE(), FSE_SetComplexInfo() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_CreatFSE(
+FSE_PTR *fse, /* O - The FSE which is craeted */
+INT16 oper, /* I - The operation type .i.e INCLUDE/EXCLUDE */
+VOID_PTR dname, /* I - The directory name (NULL impregnated) */
+INT16 dsize, /* I - The size of the directory name */
+VOID_PTR fname, /* I - The file name */
+INT16 fnsize, /* I - size of file name */
+BOOLEAN wilds, /* I - TRUE if the '?' and '*' are wildcards */
+BOOLEAN subs ) /* I - TRUE if selection should include subdirectories */
+{
+ INT16 ret_val ;
+
+ msassert( fse != NULL ) ;
+ msassert( dsize > 0 ) ;
+ msassert( fnsize > 0 ) ;
+
+ *fse = (FSE_PTR)calloc( 1, sizeof( **fse ) + dsize + fnsize ) ;
+
+ if ( *fse != NULL ) {
+
+ (*fse)->flgs.inc_exc = oper ;
+
+ FSE_SetIncSubFlag( *fse, subs ) ;
+ FSE_SetWildFlag( *fse, wilds ) ;
+
+ (*fse)->dir = (*fse + 1);
+ (*fse)->dir_leng = dsize ;
+ (*fse)->fname = (BYTE_PTR)(*fse)->dir + dsize ;
+ (*fse)->fname_leng = fnsize ;
+ (*fse)->flgs.del_files = NON_DELETED_FILES_ONLY ;
+ memcpy( (*fse)->dir, dname, dsize ) ;
+ memcpy( (*fse)->fname, fname, fnsize ) ;
+
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: BSD_AddFSE()
+
+ Description: This function adds an fse to the queue of FSE. Before
+ the element is added to the QUEUE, a check is made to see if
+ this fse is a subset or superset of an element already in the
+ FSL. If it is, then the queue is optimized by removing the
+ the appropriate element.
+
+
+ Modified: 8/9/1989
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_RemoveFSE(), BSD_CreatFSE() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_AddFSE(
+BSD_PTR bsd, /* I - What BSD to add the FSE to */
+FSE_PTR fse ) /* I - The FSE to add */
+{
+ FSE_PTR node ;
+ FSE_PTR node2;
+ BOOLEAN include_found = FALSE ;
+
+ msassert( fse != NULL );
+ msassert( bsd != NULL );
+
+ /* make sure the FSE is not already enqueued */
+ msassert( GetQueueElemPtr( &(fse->q) ) == NULL ) ;
+
+ node = (FSE_PTR)QueueHead( &(bsd->fse_q_hdr) ) ;
+
+ while ( node != NULL ) {
+
+ if ( FSE_CompareForSub( fse, node ) ) {
+ /* the new FSE supersedes the older FSE */
+
+ node2 = (FSE_PTR)QueueNext( &(node->q) ) ;
+
+ BSD_RemoveFSE( node ) ;
+ node = node2 ;
+
+ } else {
+
+ if ( FSE_GetOperType( node ) == INCLUDE ) {
+ include_found = TRUE ;
+ }
+ node = (FSE_PTR)QueueNext( &(node->q) ) ;
+
+ }
+ }
+
+ if ( !include_found ) {
+ BSD_ClearAllFSE( bsd ) ;
+ }
+
+ if ( FSE_HasTargetInfo( fse ) ) {
+ bsd->tgt_fse_exist ++ ;
+ }
+
+ SetQueueElemPtr( &(fse->q), bsd ) ;
+
+ EnQueueElem( &(bsd->fse_q_hdr), &(fse->q), FALSE ) ;
+
+ FSE_UpdateMark( fse ) ;
+
+}
+/**/
+/**
+
+ Name: FSE_UpdateMark()
+
+ Description: This function updates the mark status of the fse and the
+ bsd which contains the fse.
+
+
+ Modified: 8/10/1989
+
+ Returns: none
+
+ Notes: This function is only called by BSD_AddFSE()
+
+ See also: $/SEE( BSD_AddFSE() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static VOID FSE_UpdateMark(
+FSE_PTR fse ) /*I - Fse to update the mark status in */
+{
+ BSD_PTR bsd ;
+ FSE_COMPLEX_PTR cplx ;
+ FSE_PTR temp_fse ;
+
+ bsd = (BSD_PTR)GetQueueElemPtr( &(fse->q) ) ;
+ cplx = fse->cplx ;
+
+ if ( FSE_GetOperType( fse ) == INCLUDE ) {
+
+ fse->flgs.select_type = PARTIAL_SELECTION ;
+ bsd->select_status = SOME_SELECTED ;
+
+ if( FSE_GetIncSubFlag( fse ) && ( fse->dir_leng == sizeof( CHAR ) ) ) {
+ bsd->select_status = ALL_SELECTED ;
+ }
+
+ if ( ( !memorycmp( fse->fname, fse->fname_leng, ALL_FILES, ALL_FILES_LENG ) ||
+ !memorycmp( fse->fname, fse->fname_leng, ALL_FILES2, ALL_FILES2_LENG ) ) &&
+ FSE_GetWildFlag( fse ) &&
+ ( cplx == NULL ) &&
+ FSE_GetIncSubFlag( fse ) &&
+ (FSE_GetDeletedVersionFlg( fse ) != DELETED_FILES_ONLY) ) {
+
+ fse->flgs.select_type = ENTIRE_DIR_SELECTION ;
+
+ } else {
+ fse->flgs.select_type = PARTIAL_SELECTION ;
+ bsd->select_status = SOME_SELECTED ;
+ }
+
+ if ( !FSE_GetIncSubFlag( fse ) ) {
+
+ if ( !FSE_GetWildFlag( fse ) ||
+ (!strchr(fse->fname, TEXT('?')) && !strchr(fse->fname, TEXT('*')) ) ) {
+
+ fse->flgs.select_type = SINGLE_FILE_SELECTION ;
+ }
+ }
+
+ } else { /* fse is an exclude */
+
+ fse->flgs.select_type = PARTIAL_SELECTION ;
+
+ if ( !FSE_GetIncSubFlag( fse ) ) {
+
+ if ( !FSE_GetWildFlag( fse ) ||
+ (!strchr(fse->fname, TEXT('?')) && !strchr(fse->fname, TEXT('*')) ) ) {
+
+ fse->flgs.select_type = SINGLE_FILE_SELECTION ;
+ }
+ }
+
+ if ( FSE_GetIncSubFlag( fse ) && ( fse->dir_leng == sizeof(CHAR) ) &&
+ ( !memorycmp( fse->fname, fse->fname_leng, ALL_FILES, ALL_FILES_LENG ) ||
+ !memorycmp( fse->fname, fse->fname_leng, ALL_FILES2, ALL_FILES2_LENG ) ) &&
+ FSE_GetWildFlag( fse ) && (fse->cplx == NULL) ) {
+
+ bsd->select_status = NONE_SELECTED ;
+
+ } else if ( bsd->select_status == ALL_SELECTED ) {
+
+ bsd->select_status = SOME_SELECTED ;
+
+ }
+
+ temp_fse = BSD_GetFirstFSE( bsd ) ;
+
+ while ( temp_fse != NULL ) {
+
+ if ( temp_fse->flgs.select_type == ENTIRE_DIR_SELECTION ) {
+ if ( (fse->dir_leng >= temp_fse->dir_leng) &&
+ !memicmp( fse->dir, temp_fse->dir, temp_fse->dir_leng ) ) {
+
+ temp_fse->flgs.select_type = PARTIAL_SELECTION ;
+
+ } else if ( (fse->dir_leng < temp_fse->dir_leng) &&
+ FSE_GetIncSubFlag( fse ) &&
+ !memicmp( fse->dir, temp_fse->dir, fse->dir_leng ) ) {
+
+ temp_fse->flgs.select_type = PARTIAL_SELECTION ;
+ }
+ }
+
+ temp_fse = BSD_GetNextFSE( fse ) ;
+ }
+ }
+}
+/**/
+/**
+
+ Name: FSE_CompareForSub()
+
+ Description: This function compares two FSEs to see if one is a
+ subset of the other. The possibilities are fse1 < fse2,
+ fse1 > fse2, fse1 = fse2, no comparison.
+
+
+ Modified: 8/10/1989
+
+ Returns: TRUE if FSE2 <= FSE1
+
+ Notes: This function is only called by BSD_AddFSE() for
+ optimization purposes.
+
+ See also: $/SEE( BSD_AddFSE() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static BOOLEAN FSE_CompareForSub(
+FSE_PTR fse1, /* I - File Selection Element to compare */
+FSE_PTR fse2 ) /* I - File Selection Element to compare */
+{
+ INT16 ret_val = FALSE ;
+ FSE_COMPLEX_PTR cplx1;
+ FSE_COMPLEX_PTR cplx2;
+ FSE_TGT_INFO_PTR tgt1 ;
+ FSE_TGT_INFO_PTR tgt2 ;
+
+ cplx1 = fse1->cplx ;
+ cplx2 = fse2->cplx ;
+ tgt1 = fse1->tgt ;
+ tgt2 = fse2->tgt ;
+
+ if( fse1->dir_leng <= fse2->dir_leng ) {
+ /* fse2 could be a subset of fse1 */
+ ret_val = TRUE ;
+
+ if( memicmp( fse1->dir, fse2->dir, fse1->dir_leng ) ) {
+ ret_val = FALSE ;
+
+ } else if( !FSE_GetIncSubFlag( fse1 ) && ( fse1->dir_leng != fse2->dir_leng ) ) {
+ ret_val = FALSE ;
+
+ } else if( FSE_GetIncSubFlag( fse2 ) && !FSE_GetIncSubFlag( fse1 ) ) {
+ ret_val = FALSE ;
+
+ /* If we made it this far then The directory matches */
+
+ } else if( memorycmp( fse1->fname, fse1->fname_leng, fse2->fname, fse2->fname_leng ) &&
+ ( memorycmp( fse1->fname, fse1->fname_leng, ALL_FILES, ALL_FILES_LENG ) &&
+ memorycmp( fse1->fname, fse1->fname_leng, ALL_FILES2, ALL_FILES2_LENG ) ) ||
+ !FSE_GetWildFlag(fse1) ) {
+ ret_val = FALSE ;
+
+ } else if ( (cplx2 != NULL) || (cplx1 != NULL) ) {
+ if ( cplx2 == NULL ) {
+ /* if the complex data struture isn't empty then */
+ /* these two FSE's can't be equal. */
+ if ( FSE_ComplexDataEmpty( cplx1 ) == FALSE ) {
+ ret_val = FALSE ;
+
+ }
+ } else if ( cplx1 == NULL ) {
+ /* if the complex data struture isn't empty then */
+ /* these two FSE's can't be equal. */
+ if ( FSE_ComplexDataEmpty( cplx2 ) == FALSE ) {
+ ret_val = FALSE ;
+
+ }
+ } else {
+
+ if( DateAfter( cplx2->pre_m_date, cplx1->pre_m_date ) ) {
+ ret_val = FALSE ;
+
+ } else if( DateBefore( cplx2->post_m_date, cplx1->post_m_date ) ) {
+ ret_val = FALSE ;
+
+ } else if( DateBefore( cplx2->access_date, cplx1->access_date ) ) {
+ ret_val = FALSE ;
+
+ } else if( !DateEqual( cplx2->backup_date, cplx1->backup_date ) ) {
+ ret_val = FALSE ;
+
+ /* more bits means less files */
+ } else if( ( (cplx1->attr_on_mask | cplx2->attr_on_mask) != cplx2->attr_on_mask ) ||
+ ( (cplx1->attr_off_mask & cplx2->attr_off_mask) != cplx2->attr_off_mask ) ) {
+ ret_val = FALSE ;
+ }
+ }
+ }
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: FSE_ComplexDataEmpty()
+
+ Description: This function checks to see if all parts of an FSE's
+ complex data structure are EMPTY. By EMPTY, I mean not
+ effecting the files selections.
+
+ This comes in handy when comparing a simple FSE and
+ a complex FSE. If there is no data in the complex field
+ of the one, then you might as well ignore it.
+
+
+ Modified: 8/4/1993 (JES)
+
+ Returns: TRUE - the structure is empty.
+ FALSE - the structure isn't empty.
+
+
+ Notes: This function is only called by BSD_AddFSE() for
+ optimization purposes.
+
+ See also:
+
+ Declaration:
+
+**/
+static BOOLEAN FSE_ComplexDataEmpty( FSE_COMPLEX_PTR cplx )
+{
+
+ BOOLEAN ret_val = TRUE ;
+
+ msassert( cplx != NULL ) ;
+
+ if ( cplx->pre_m_date != NULL ) {
+ ret_val = FALSE ;
+ }
+
+ if ( cplx->post_m_date != NULL ) {
+ ret_val = FALSE ;
+ }
+
+ if ( cplx->access_date != NULL ) {
+ ret_val = FALSE ;
+ }
+
+ if ( cplx->backup_date != NULL ) {
+ ret_val = FALSE ;
+ }
+
+ if ( cplx->attr_on_mask != 0 ) {
+ ret_val = FALSE ;
+ }
+
+ if ( cplx->attr_off_mask != 0 ) {
+ ret_val = FALSE ;
+ }
+
+ return ret_val ;
+
+} /* FSE_ComplexDataEmpty */
+
+
+
+static BOOLEAN DateBefore(
+DATE_TIME_PTR date1,
+DATE_TIME_PTR date2 )
+{
+ INT16 ret_val ;
+
+ if ( ( date1 == NULL ) || ( !date1->date_valid ) ) {
+ ret_val = FALSE ;
+
+ } else if ( ( date2 == NULL ) || ( !date2->date_valid ) ) {
+ ret_val = TRUE ;
+
+ } else {
+ ret_val = (INT16)( CompDate( date1, date2 ) < 0 ) ;
+ }
+
+ return ( ret_val ) ;
+}
+
+static BOOLEAN DateEqual(
+DATE_TIME_PTR date1,
+DATE_TIME_PTR date2 )
+{
+ INT16 ret_val ;
+
+ if ( ( date1 == NULL ) || ( !date1->date_valid ) ) {
+
+ if ( ( date2 == NULL ) || ( !date2->date_valid ) ) {
+ ret_val = TRUE ;
+ } else {
+ ret_val = FALSE ;
+ }
+
+ } else if ( ( date2 == NULL ) || ( !date2->date_valid ) ) {
+ ret_val = FALSE ;
+
+ } else {
+ ret_val = (INT16)( !memcmp( date1, date2, sizeof( DATE_TIME ) ) ) ;
+ }
+
+ return ( ret_val ) ;
+
+}
diff --git a/private/utils/ntbackup/src/addlba.c b/private/utils/ntbackup/src/addlba.c
new file mode 100644
index 000000000..b112b5873
--- /dev/null
+++ b/private/utils/ntbackup/src/addlba.c
@@ -0,0 +1,308 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: addlba.c
+
+ Description: This file contains the functions for accessing the
+ LBA Queue.
+
+
+ $Log: J:/LOGFILES/ADDLBA.C_V $
+
+ Rev 1.9 30 Jan 1993 11:10:16 DON
+ifdef'd out static function not used
+
+ Rev 1.8 25 Oct 1991 10:37:22 STEVEN
+was unlocking a mem pointer again -- fixed
+
+ Rev 1.7 16 Oct 1991 08:51:24 STEVEN
+was ulocking wrong pointer
+
+ Rev 1.6 10 Oct 1991 15:16:28 STEVEN
+was not updateing tail pointer
+
+ Rev 1.5 04 Sep 1991 16:51:10 STEVEN
+fix VM queue insert to be ordered by LBA #
+
+ Rev 1.4 20 Aug 1991 16:04:24 BRYAN
+refrencing unallocated space
+
+ Rev 1.3 13 Jun 1991 14:01:30 STEVEN
+need version # in LBA for FFR
+
+ Rev 1.2 12 Jun 1991 16:05:36 STEVEN
+added virtual memory for LBAs
+
+ Rev 1.1 29 May 1991 17:21:00 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:41:14 HUNTER
+Initial revision.
+
+**/
+#include <malloc.h>
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "vm.h"
+#include "std_err.h"
+#include "bsdu.h"
+
+#if defined(OBSOLETE_CODE)
+static INT16 BSD_GetLastLBA( BSD_PTR bsd, LBA_ELEM_PTR lba ) ;
+#endif
+
+/**/
+/**
+
+ Name: BSD_AddLBAElem()
+
+ Description: This function Adds an LBA to the LBA Queue.
+ If the LBA is already in the Queue then no net change
+ occurs and we return SUCCESS
+
+ Modified: 5/17/1991 13:48:46
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes: Comments provided by Mike Payne.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_AddLBAElem(
+BSD_PTR bsd, /* I - BSD to add the LBA structure to */
+UINT32 lba, /* I - The logical block address */
+UINT16 tape_num, /* I - The Tape Number of the block */
+UINT16 lba_type, /* I - The type of LBA element */
+UINT16 file_ver ) /* I - The file version for AllVersions */
+{
+ BSD_HAND bsdh = (BSD_HAND)GetQueueElemPtr( &bsd->q ) ;
+ VM_HDL vm_hand = bsdh->vm_hand ;
+ INT16 ret_val = SUCCESS ;
+ LBA_ELEM tmp1_lba;
+ LBA_ELEM tmp2_lba;
+ LBA_ELEM tmp3_lba;
+ LBA_ELEM_PTR new_lba ;
+ LBA_ELEM_PTR old_lba ;
+ VM_PTR new_vm_lba ;
+ LBA_ELEM_PTR tail_lba ;
+ LBA_ELEM_PTR head_lba ;
+ BOOLEAN tmp1_null ;
+ BOOLEAN tmp2_null = TRUE;
+
+
+ /* It's a singly linked list so travel two pointers */
+
+
+ if ( BSD_GetFirstLBA( bsd, &tmp1_lba ) == SUCCESS ) {
+ tmp1_null = FALSE;
+ } else {
+ tmp1_null = TRUE;
+ }
+
+ while ( !tmp1_null ) {
+ if ( lba <= LBA_GetLBA( &tmp1_lba ) ) {
+ break ;
+ }
+ tmp2_null = FALSE;
+ tmp2_lba = tmp1_lba;
+
+ if ( BSD_GetNextLBA( bsd, &tmp1_lba ) == SUCCESS ) {
+ tmp1_null = FALSE;
+ } else {
+ tmp1_null = TRUE;
+ }
+ }
+
+ if ( ( !tmp1_null ) &&
+ ( lba == LBA_GetLBA( &tmp1_lba ) ) ) {
+
+ /* We found one that has the same LBA # already in the queue */
+
+ if ( (lba_type == LBA_BEGIN_POSITION) &&
+ (tmp1_lba.type != LBA_BEGIN_POSITION) ) {
+
+ /* The current one was a SINGLE_OBJECT so make */
+ /* it a BEGIN_POSITION and don't insert the new one. */
+
+ new_lba = (LBA_ELEM_PTR)VM_MemLock( vm_hand, (VM_PTR)tmp1_lba.vm_ptr, VM_READ_WRITE ) ;
+
+ if ( new_lba != NULL ) {
+
+ new_lba->type = LBA_BEGIN_POSITION ;
+ VM_MemUnLock( vm_hand, (VM_PTR)tmp1_lba.vm_ptr ) ;
+
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+ }
+
+ } else {
+
+ new_vm_lba = VM_Alloc( vm_hand, sizeof( LBA_ELEM ) ) ;
+
+ if ( new_vm_lba == 0 ) {
+
+ ret_val = OUT_OF_MEMORY ;
+
+ } else {
+
+ new_lba = (LBA_ELEM_PTR)VM_MemLock( vm_hand, new_vm_lba, VM_READ_WRITE ) ;
+ if ( new_lba != NULL ) {
+ new_lba->lba_val = lba ;
+ new_lba->next = 0L ;
+ new_lba->vm_ptr = new_vm_lba ;
+ new_lba->tape_num = (UINT8)tape_num ;
+ new_lba->type = (UINT8)lba_type ;
+ new_lba->file_ver_num = (UINT8)file_ver ;
+ VM_MemUnLock( vm_hand, new_vm_lba ) ;
+
+ /* empty queue install as head & tail */
+ /* tmp1 is NULL install as tail */
+ /* tmp2 is NULL install as head */
+ /* else install after tmp2 no head/tail changes */
+
+ ret_val = OUT_OF_MEMORY ;
+
+ if ( BSD_GetFirstLBA( bsd, &tmp3_lba ) != SUCCESS ) {
+ bsd->lba_vm_q_head = new_vm_lba ;
+ bsd->lba_vm_q_tail = new_vm_lba ;
+ ret_val = SUCCESS ;
+
+ } else if ( tmp1_null ) {
+ tail_lba = (LBA_ELEM_PTR)VM_MemLock( vm_hand, (VM_PTR)bsd->lba_vm_q_tail, VM_READ_WRITE ) ;
+
+ if ( tail_lba != NULL ) {
+
+ tail_lba->next = new_vm_lba ;
+ VM_MemUnLock( vm_hand, (VM_PTR)bsd->lba_vm_q_tail ) ;
+ bsd->lba_vm_q_tail = new_vm_lba ;
+
+ ret_val = SUCCESS ;
+ }
+
+ } else if ( tmp2_null ) {
+ head_lba = (LBA_ELEM_PTR)VM_MemLock( vm_hand, (VM_PTR)new_vm_lba, VM_READ_WRITE ) ;
+ if ( head_lba != NULL ) {
+ head_lba->next = bsd->lba_vm_q_head;
+ bsd->lba_vm_q_head = new_vm_lba ;
+ VM_MemUnLock( vm_hand, (VM_PTR)new_vm_lba ) ;
+ ret_val = SUCCESS ;
+ }
+ } else {
+ old_lba = (LBA_ELEM_PTR)VM_MemLock( vm_hand, (VM_PTR)tmp2_lba.vm_ptr, VM_READ_WRITE ) ;
+ if ( old_lba != NULL ) {
+
+ new_lba = (LBA_ELEM_PTR)VM_MemLock( vm_hand, (VM_PTR)new_vm_lba, VM_READ_WRITE ) ;
+ if ( new_lba != NULL ) {
+
+ old_lba->next = new_vm_lba ;
+ new_lba->next = tmp1_lba.vm_ptr;
+ VM_MemUnLock( vm_hand, (VM_PTR)new_vm_lba ) ;
+ ret_val = SUCCESS ;
+
+ }
+ VM_MemUnLock( vm_hand, (VM_PTR)tmp2_lba.vm_ptr ) ;
+ }
+ }
+
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+ }
+ }
+
+ return ret_val ;
+}
+
+
+INT16 BSD_GetFirstLBA(
+BSD_PTR bsd, /* I - BSD to process off of */
+LBA_ELEM_PTR lba ) /* O - The first LBA in the Queue */
+{
+ BSD_HAND bsdh = (BSD_HAND)GetQueueElemPtr( &bsd->q ) ;
+ VM_HDL vmem_hand = bsdh->vm_hand ;
+ LBA_ELEM_PTR tmp_lba ;
+ VM_PTR vm_lba_ptr ;
+
+ vm_lba_ptr = (VM_PTR)bsd->lba_vm_q_head ;
+
+ if ( vm_lba_ptr != 0 ) {
+
+ tmp_lba = (LBA_ELEM_PTR)VM_MemLock( vmem_hand, vm_lba_ptr, VM_READ_ONLY ) ;
+
+ if ( tmp_lba != NULL ) {
+
+ *lba = *tmp_lba ;
+ VM_MemUnLock( vmem_hand, vm_lba_ptr ) ;
+
+ return SUCCESS ;
+ }
+
+ }
+ return FAILURE ;
+}
+
+
+#if defined(OBSOLETE_CODE)
+static INT16 BSD_GetLastLBA(
+BSD_PTR bsd, /* I - BSD to process off of */
+LBA_ELEM_PTR lba ) /* O - The first LBA in the Queue */
+{
+ BSD_HAND bsdh = (BSD_HAND)GetQueueElemPtr( &bsd->q ) ;
+ VM_HDL vmem_hand = bsdh->vm_hand ;
+ LBA_ELEM_PTR tmp_lba ;
+ VM_PTR vm_lba_ptr ;
+
+ vm_lba_ptr = (VM_PTR)bsd->lba_vm_q_tail ;
+
+ if ( vm_lba_ptr != 0 ) {
+
+ tmp_lba = (LBA_ELEM_PTR)VM_MemLock( vmem_hand, vm_lba_ptr, VM_READ_ONLY ) ;
+
+ if ( tmp_lba != NULL ) {
+
+ *lba = *tmp_lba ;
+ VM_MemUnLock( vmem_hand, vm_lba_ptr ) ;
+
+ return SUCCESS ;
+ }
+
+ }
+ return FAILURE ;
+}
+#endif
+
+
+INT16 BSD_GetNextLBA( BSD_PTR bsd, LBA_ELEM_PTR lba )
+{
+ BSD_HAND bsdh = (BSD_HAND)GetQueueElemPtr( &bsd->q ) ;
+ VM_HDL vmem_hand = bsdh->vm_hand ;
+ LBA_ELEM_PTR tmp_lba ;
+ VM_PTR vm_lba_ptr ;
+
+ vm_lba_ptr = (VM_PTR)lba->next ;
+
+ if ( vm_lba_ptr != 0 ) {
+
+ tmp_lba = (LBA_ELEM_PTR)VM_MemLock( vmem_hand, vm_lba_ptr, VM_READ_ONLY ) ;
+
+ if ( tmp_lba != NULL ) {
+
+ *lba = *tmp_lba ;
+ VM_MemUnLock( vmem_hand, vm_lba_ptr ) ;
+
+ return SUCCESS ;
+ }
+
+ }
+ return FAILURE ;
+}
+
+
diff --git a/private/utils/ntbackup/src/atachdle.c b/private/utils/ntbackup/src/atachdle.c
new file mode 100644
index 000000000..e52403c8a
--- /dev/null
+++ b/private/utils/ntbackup/src/atachdle.c
@@ -0,0 +1,237 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: atachdle.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file changes the default drive to the
+ specified drive.
+
+
+ $Log: Q:/LOGFILES/ATACHDLE.C_V $
+
+ Rev 1.9 18 Jun 1993 09:28:06 MIKEP
+enable C++
+
+ Rev 1.8 11 Nov 1992 09:52:26 GREGG
+Unicodeized literals.
+
+ Rev 1.7 10 Nov 1992 08:17:48 STEVEN
+move os path and os name into common part of dblk
+
+ Rev 1.6 16 Mar 1992 10:07:28 LORIB
+Added InitQueue() for path_q.
+
+ Rev 1.5 09 Jan 1992 09:27:38 STEVEN
+remove detnet.h from header list -- NOT USED
+
+ Rev 1.4 18 Aug 1991 15:55:40 BARRY
+ret_val not initialized in FS_DetachDLE().
+
+ Rev 1.3 06 Aug 1991 18:26:36 DON
+added NLM File System support
+
+ Rev 1.2 21 Jun 1991 13:34:04 BARRY
+Changes for new config.
+
+ Rev 1.1 03 Jun 1991 13:26:22 BARRY
+Remove product defines from conditional compilation.
+
+ Rev 1.0 09 May 1991 13:41:44 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+#include "std_err.h"
+
+#include "fsys.h"
+#include "beconfig.h"
+#include "be_debug.h"
+/* $end$ include list */
+/**/
+/**
+
+ Name: FS_AttachToDLE()
+
+ Description: This function makes the default drive for the specified
+ file system handle the drive specified by dle. If the file system
+ is not opened, then this routine will open it. If the provided
+ file system handle is currently attached to a different drive, then
+ this routine will detach it and re-use the handle for the new type of
+ drive.
+
+
+ Modified: 7/17/1989
+
+ Returns: Error Codes:
+ ACCESS_DENIED
+ OUT_OF_MEMORY
+ INVALID_DLE
+ SUCCESS
+
+ Notes: It is considered good practice to Detach from one
+ DLE prior to attaching to another.
+
+ See also: $/SEE( FS_DetachDLE(), FS_OpenFileSys() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_AttachToDLE(
+FSYS_HAND *fsh, /*I/O- file system handle */
+GENERIC_DLE_PTR dle, /* I - Drive to attach to */
+BE_CFG_PTR cfg, /* I - confuration struct to use */
+CHAR_PTR user_name, /* I - user name for login */
+CHAR_PTR pswd) /* I - password for login */
+{
+ INT16 fs_error = SUCCESS ;
+ UINT8 type ;
+#if ( defined(FS_AFP) || defined(FS_NONAFP) )
+ NOV_DRV_DLE_PTR nov_dle;
+#elif ( defined(FS_NLMAFP) || defined(FS_NLMNOV) )
+ NLM_DLE_PTR nlm_dle;
+#endif
+
+/* if ( (dle->type < MAX_DRV_TYPES) && (dle->type >= 0) ) { */
+
+ if ( dle->type < MAX_DRV_TYPES ) {
+
+ fs_error = FS_OpenFileSys( fsh, dle->type, cfg );
+
+ if ( fs_error == SUCCESS ) {
+
+ (*fsh)->attached_dle = dle ;
+ (*fsh)->dle_hand = dle->handle ;
+ (*fsh)->cur_dir[0] = TEXT('\\') ;
+ (*fsh)->cur_dir[1] = TEXT('\0') ;
+ (*fsh)->cfg = cfg ;
+
+ type = dle->type;
+
+ #if ( defined(FS_AFP) && defined(FS_NONAFP) )
+ if ( ( type == NOVELL_AFP_DRV ) && !BEC_GetAFPSupport( cfg ) ) {
+ type = NOVELL_DRV ;
+ }
+ #endif
+
+ #if ( defined(FS_NLMAFP) && defined(FS_NLMNOV) )
+ if ( ( type == NLM_AFP_VOLUME ) && !BEC_GetAFPSupport( cfg ) ) {
+ type = NLM_VOLUME ;
+ }
+ #endif
+
+ (*fsh)->f_type = type ;
+
+ (*fsh)->tab_ptr = &func_tab[ (*fsh)->f_type ] ;
+
+ InitQueue( &((*fsh)->min_ddb_stk) ) ;
+
+ InitQueue( &((*fsh)->in_use_name_q) ) ;
+
+ InitQueue( &((*fsh)->avail_name_q) ) ;
+
+ fs_error = (*fsh)->tab_ptr->AttachToDLE( *fsh, dle, user_name, pswd );
+
+ if ( fs_error ) {
+ (*fsh)->attached_dle = NULL ;
+ FS_CloseFileSys( *fsh );
+ *fsh = NULL ;
+ } else {
+
+ /* Print out some debug stuff */
+
+ BE_Zprintf( DEBUG_FILE_SYSTEM, RES_ATTACH_TO_DLE, dle->device_name ) ;
+
+ #if ( defined(FS_AFP) || defined(FS_NONAFP) )
+ if ( (type == NOVELL_DRV) || (type == NOVELL_AFP_DRV) ) {
+ nov_dle = dle->info.nov ;
+ BE_Zprintf( DEBUG_FILE_SYSTEM, RES_NOVELL_SERVER_INFO,
+ ( (type == NOVELL_AFP_DRV) ? 1 : 0 ),
+ nov_dle->ser_name,
+ nov_dle->volume,
+ nov_dle->server_support ) ;
+ BE_Zprintf( DEBUG_FILE_SYSTEM, RES_DLE_BASE_PATH, nov_dle->base_path ) ;
+ }
+ #endif
+
+ #if ( defined(FS_NLMAFP) || defined(FS_NLMNOV) )
+ if ( (type == NLM_VOLUME) || (type == NLM_AFP_VOLUME) ) {
+ nlm_dle = dle->info.nlm ;
+ BE_Zprintf( DEBUG_FILE_SYSTEM, RES_NOVELL_SERVER_INFO,
+ ( (type == NLM_AFP_VOLUME) ? 1 : 0 ),
+ nlm_dle->ser_name,
+ nlm_dle->volume,
+ nlm_dle->server_support ) ;
+ }
+ #endif
+ }
+ }
+
+ if ( fs_error == SUCCESS ) {
+ dle->attach_count ++ ;
+ }
+
+ } else {
+ fs_error = FS_INVALID_DLE ;
+ }
+
+ return fs_error ;
+}
+/**/
+/**
+
+ Name: FS_DetachDLE()
+
+ Description: This function releases the attachment between a fse and
+ it's DLE. This must be done in order to do a DLE_ResetList( )
+ function.
+
+ Modified: 7/19/1989
+
+ Returns: none
+
+ Notes: It is considered good practice to Detach from one
+ DLE prior to attaching to another.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_DetachDLE( FSYS_HAND fsh )
+{
+ GENERIC_DLE_PTR dle;
+ INT16 ret_val = SUCCESS;
+
+ if ( fsh == NULL ) {
+ return FS_DLE_NOT_ATTACHED ;
+ }
+
+ dle = fsh->attached_dle ;
+ if ( dle != NULL ) {
+
+ BE_Zprintf( DEBUG_FILE_SYSTEM, RES_DETACH_FROM_DLE, dle->device_name ) ;
+
+ fsh->tab_ptr->DetachDLE( fsh ) ;
+
+ dle->attach_count -- ;
+
+ fsh->attached_dle = NULL ;
+
+ }
+ else {
+ ret_val = FS_DLE_NOT_ATTACHED ;
+ }
+
+ FS_CloseFileSys( fsh );
+
+ return ret_val ;
+}
+
+
+
diff --git a/private/utils/ntbackup/src/att_drv.c b/private/utils/ntbackup/src/att_drv.c
new file mode 100644
index 000000000..ace55f8c6
--- /dev/null
+++ b/private/utils/ntbackup/src/att_drv.c
@@ -0,0 +1,318 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+ Name: att_drv.c
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/ATT_DRV.C_V $
+
+ Rev 1.16 09 Jun 1993 19:30:58 MIKEP
+enable c++
+
+ Rev 1.15 07 Oct 1992 14:53:48 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.14 04 Oct 1992 19:32:20 DAVEV
+Unicode Awk pass
+
+ Rev 1.13 06 Aug 1992 13:20:48 CHUCKB
+Changes for NT.
+
+ Rev 1.12 14 May 1992 17:23:52 MIKEP
+nt pass 2
+
+ Rev 1.11 24 Mar 1992 14:45:34 DAVEV
+OEM_MSOFT: Removed Servers windows and associated code
+
+ Rev 1.10 17 Mar 1992 11:53:44 MIKEP
+add silently but deadly feature
+
+ Rev 1.9 12 Mar 1992 09:55:46 MIKEP
+refresh fixes
+
+ Rev 1.8 20 Feb 1992 16:51:04 MIKEP
+no handles error
+
+ Rev 1.7 12 Jan 1992 18:23:48 MIKEP
+error message for attach failure
+
+ Rev 1.6 20 Dec 1991 09:32:22 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.5 18 Dec 1991 14:08:00 GLENN
+Added windows.h
+
+ Rev 1.4 14 Dec 1991 13:44:56 JOHNWT
+changes for pw to enable db
+
+ Rev 1.3 12 Dec 1991 11:05:30 JOHNWT
+added pwdb support
+
+ Rev 1.2 02 Dec 1991 14:07:30 MIKEP
+fix attach problem
+
+ Rev 1.1 01 Dec 1991 16:01:40 MIKEP
+check if password was saved
+
+ Rev 1.0 20 Nov 1991 19:16:56 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define NONE_SUPPLIED 0 /* no password supplied */
+#define FROM_PWDB 1 /* password came from password data base */
+#define FROM_USER 2 /* password came from user prompt */
+
+/*****************************************************************************
+
+ Name: UI_AttachDrive
+
+ Description: This function will attach the mapped drive specified
+ by the DLE specified. If a user name or password
+ is required, a pop up window will prompt the user
+ for the appropiate information.
+
+ Returns: One of the following statuses :
+
+ SUCCESS
+ FS_ACCESS_DENIED
+ FS_NO_MORE_CONNECTIONS
+ RES_ERROR_DURING_ATTACH ( error codes )
+ USER_ABORT
+ FS_SERVER_ADDR_NOT_FOUND
+ FS_MAX_SERVER_CONNECTIONS
+ FS_BAD_ATTACH_TO_SERVER
+ FS_BAD_SERVER_LOGIN
+*****************************************************************************/
+
+INT16 UI_AttachDrive(
+FSYS_HAND *tmp_fsh,
+GENERIC_DLE_PTR dle_ptr,
+BOOLEAN silent_login_only )
+{
+ CHAR_PTR name_buf = NULL;
+ CHAR_PTR pswd_buf = NULL;
+ INT16 name_len;
+ INT16 pswd_len;
+ BOOLEAN passwd_source = NONE_SUPPLIED;
+ BOOLEAN attempt_attach = TRUE;
+ INT16 result = USER_ABORT;
+ Q_HEADER_PTR srv_list;
+ WININFO_PTR wininfo;
+ VLM_OBJECT_PTR server_vlm;
+
+
+ *tmp_fsh = NULL;
+
+ // If silent mode, only login if no password required, password has
+ // already been entered or password database is active and contains
+ // a matching entry for this dle.
+
+ if ( silent_login_only ) {
+
+ if ( DLE_PswdRequired( dle_ptr ) ) {
+
+ if ( DLE_PswdSaved( dle_ptr ) ) {
+ // go ahead with login
+ }
+ else {
+ if ( CheckThePWDBase( CDS_GetPerm(), dle_ptr ) == SUCCESS ) {
+ // go ahead with login
+ }
+ else {
+ return( FAILURE );
+ }
+ }
+ }
+ }
+
+ /* First check to see if this DLE requires a user name or a password.
+ If so, allocate the space for them (required in FS_AttachToDLE). */
+
+ name_len = DLE_UserRequired( dle_ptr );
+ pswd_len = DLE_PswdRequired( dle_ptr );
+
+ if ( name_len != 0 ) {
+ name_buf = (CHAR_PTR)malloc( name_len );
+ if ( name_buf == NULL ) {
+ return FAILURE;
+ }
+ }
+
+ if ( pswd_len != 0 ) {
+ pswd_buf = (CHAR_PTR)malloc( pswd_len );
+ if ( pswd_buf == NULL ) {
+ if ( name_buf != NULL ) {
+ free( name_buf );
+ }
+ return FAILURE;
+ }
+ }
+
+ /* check to see if we need to get the username/pswd for a server,
+ right now, all we support are Novell server logins */
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ if ( DLE_GetDeviceType( dle_ptr ) == NOVELL_SERVER_ONLY ) {
+
+ /* If we are not alreay logged into the server and we do not already
+ have the password, first check the pwdb and then prompt the user
+ for the attach info. */
+
+ if ( ! DLE_ServerLoggedIn( dle_ptr ) &&
+ ( ! DLE_PswdSaved( dle_ptr ) && DLE_PswdRequired( dle_ptr ) ) ) {
+
+ if ( CheckThePWDBase( CDS_GetPerm(), dle_ptr ) == SUCCESS ) {
+
+ passwd_source = FROM_PWDB;
+
+ } else {
+
+ if ( DM_AttachToServer( DLE_GetDeviceName( dle_ptr ),
+ name_buf, name_len,
+ pswd_buf, pswd_len ) == SUCCESS ) {
+
+ passwd_source = FROM_USER;
+
+ } else {
+
+ attempt_attach = FALSE;
+ }
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* if we have not failed to get a password from the user, attempt to
+ attach to the DLE */
+
+ while ( attempt_attach ) {
+
+ WM_ShowWaitCursor( TRUE );
+
+ result = FS_AttachToDLE( tmp_fsh, dle_ptr,
+ CDS_GetPermBEC( ), name_buf,
+ pswd_buf );
+
+ WM_ShowWaitCursor( FALSE );
+
+ attempt_attach = FALSE;
+
+ switch ( result ) {
+
+ case SUCCESS:
+
+ /* if there is currently a servers window displayed, add the
+ children (volumes) to the window */
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if ( gb_servers_win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ srv_list = WMDS_GetTreeList( wininfo );
+ server_vlm = VLM_FindVLMByName( srv_list,
+ DLE_GetDeviceName( dle_ptr ) );
+
+ if ( server_vlm != NULL ) {
+
+ // If we already know about some children don't do this.
+ // It screws up the refresh calls kludges for the backup
+ // engines call to dle_update().
+
+ if ( QueueCount( &server_vlm->children ) == 0 ) {
+ VLM_AddInServerChildren( server_vlm );
+ }
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* if the user was prompted for the name/pswd, save it in pwdbase */
+
+ if ( passwd_source == FROM_USER ) {
+ SaveDLEPassword( CDS_GetPerm(), dle_ptr, pswd_buf, name_buf );
+ }
+
+ break;
+
+ case FS_MAX_SERVER_CONNECTIONS:
+ case FS_NO_MORE_CONNECTIONS:
+ if ( ! silent_login_only ) {
+ eresprintf( RES_NO_MORE_CONNECTIONS );
+ }
+ break;
+
+ case FS_SERVER_ADDR_NOT_FOUND:
+ if ( ! silent_login_only ) {
+ eresprintf( RES_SERVER_ADDR_NOT_FOUND, DLE_GetDeviceName ( dle_ptr ) );
+ }
+ break;
+
+ case FS_BAD_ATTACH_TO_SERVER:
+ if ( ! silent_login_only ) {
+ eresprintf( RES_BAD_ATTACH_TO_SERVER, DLE_GetDeviceName ( dle_ptr ) );
+ }
+ break;
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ case FS_ACCESS_DENIED:
+ case FS_BAD_SERVER_LOGIN:
+
+ if ( ! silent_login_only ) {
+ /* we had a bad login, so let the user try again */
+
+ if ( passwd_source != NONE_SUPPLIED ) {
+
+ eresprintf( RES_BAD_SERVER_LOGIN, DLE_GetDeviceName ( dle_ptr ) );
+
+ if ( DM_AttachToServer( DLE_GetDeviceName( dle_ptr ),
+ name_buf, name_len,
+ pswd_buf, pswd_len ) == SUCCESS ) {
+
+ passwd_source = FROM_USER;
+ attempt_attach = TRUE;
+ }
+
+ break;
+ }
+ else {
+
+ if ( result == FS_ACCESS_DENIED ) {
+ eresprintf( RES_ERROR_ATTACHING, DLE_GetDeviceName( dle_ptr ) );
+ break;
+ }
+ }
+ }
+ /* FALL THROUGH TO GENERAL ERROR MESSAGE */
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ default:
+ if ( ! silent_login_only ) {
+ eresprintf( RES_ERROR_DURING_ATTACH, result,
+ DLE_GetDeviceName( dle_ptr ) );
+ }
+ break;
+ }
+
+ } /* end while */
+
+ /* free any allocated memory */
+
+ if ( name_buf != NULL ) {
+ free( name_buf );
+ }
+ if ( pswd_buf != NULL ) {
+ free( pswd_buf );
+ }
+
+ return result;
+}
+
diff --git a/private/utils/ntbackup/src/back_dle.c b/private/utils/ntbackup/src/back_dle.c
new file mode 100644
index 000000000..2c3e6e0ea
--- /dev/null
+++ b/private/utils/ntbackup/src/back_dle.c
@@ -0,0 +1,231 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: back_dle.c
+
+ Description: this file contains the routines responsible for backing up a single volume.
+
+ $Log: N:\logfiles\back_dle.c_v $
+
+ Rev 1.15.1.0 26 Apr 1994 18:59:38 STEVEN
+fix dissconect bug
+
+ Rev 1.15 14 Jan 1993 13:33:28 STEVEN
+added stream_id to error message
+
+ Rev 1.14 24 Feb 1992 09:54:54 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.13 19 Feb 1992 15:59:42 GREGG
+Added vcb_only parameter to call to TF_OpenSet.
+
+ Rev 1.12 31 Jan 1992 14:55:44 STEVEN
+do not send message if did not backup VCB
+
+ Rev 1.11 06 Nov 1991 18:24:56 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from lp instead of lis.
+
+ Rev 1.10 17 Oct 1991 01:50:16 ED
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.9 25 Jul 1991 11:32:48 GREGG
+Added logic to handle EOM encountered during close-out of write operation.
+
+ Rev 1.8 22 Jul 1991 10:20:10 DAVIDH
+Corrected type mismatch warnings.
+
+ Rev 1.7 24 Jun 1991 17:20:40 STEVEN
+remove date time from StartBS
+
+ Rev 1.6 21 Jun 1991 09:28:28 STEVEN
+new config unit
+
+ Rev 1.5 30 May 1991 09:12:34 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.4 24 May 1991 14:42:48 STEVEN
+complete changes for new getnext
+
+ Rev 1.3 23 May 1991 16:34:02 STEVEN
+backup date should be set by messager handler
+
+ Rev 1.2 23 May 1991 16:18:54 STEVEN
+update for BSD redesign
+
+ Rev 1.1 14 May 1991 13:32:06 DAVIDH
+Resolved pointer mismatch warnings under Watcom compiler
+
+ Rev 1.0 09 May 1991 13:39:14 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "get_next.h"
+#include "tfldefs.h"
+#include "tfl_err.h"
+#include "msassert.h"
+
+/**/
+/**
+
+ Name: LP_BackupDLE()
+
+ Description: this routine backs up all selections on a single dle.
+
+ Modified: 5/23/1991 16:2:28
+
+ Returns: tape backup engine error
+
+ Notes: na
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_BackupDLE(
+BSD_PTR bsd_ptr, /* I - Backup selections */
+register LP_ENV_PTR lp, /* I - Loop Environment structure */
+UINT16 tfl_open_mode, /* I - what mode, WRITE or APPEND */
+INT16 channel_no, /* I - channel we're using */
+THW_PTR sdrv ) /* I - strating tape drive */
+{
+ INT16 return_status = SUCCESS ;
+ DBLK_PTR curr_blk ;
+ TFL_OPBLK pb ;
+ DATA_FRAGMENT data_frag ;
+
+ /* set up for tape positioning */
+
+ pb.tape_position = &lp->tpos ;
+ pb.rewind_sdrv = FALSE ;
+ pb.sdrv = sdrv ;
+ pb.perm_filter = TF_KEEP_ALL_DATA ;
+ pb.attributes = 0L ;
+ pb.fsh = lp->curr_fsys ;
+ pb.mode = tfl_open_mode ;
+ pb.ignore_clink = FALSE ;
+ pb.wrt_format = 0 ;
+ pb.idle_call = NULL ;
+ pb.cat_enabled = lp->cat_enabled ;
+ pb.channel = channel_no ;
+ data_frag.buffer_used = 0 ;
+ data_frag.buffer_size = 0 ;
+ data_frag.memory_allocated = 0 ;
+ data_frag.buffer = NULL ;
+
+ /* Now open the backup set */
+ if( ( return_status = TF_OpenSet( &pb, FALSE ) ) == SUCCESS ) {
+
+ /* Set current channel in LP, and update BSD for this THW */
+ lp->channel = pb.channel ;
+ LP_DetermineCurrentTPDrv( bsd_ptr, pb.channel ) ;
+
+ GetCurrentDate( &lp->backup_dt ) ;
+
+ /* Init operation and send vcb down the wire */
+ return_status = LP_BackupVCB( bsd_ptr, lp ) ;
+
+ /* log start of backup set */
+ if ( return_status == SUCCESS ) {
+ LP_MsgStartBS( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, lp->curr_blk ) ;
+ }
+
+ /* Now we have the GetNextItemLoop */
+ while( return_status == SUCCESS ) {
+
+ if( ( return_status = LP_GetNextDLEBlock( lp, &curr_blk ) ) == SUCCESS ) {
+
+ if ( curr_blk != NULL ) {
+ return_status = LP_BackupOBJ( lp, curr_blk, &data_frag ) ;
+ } else {
+ break ;
+ }
+
+ } else {
+ if ( return_status != FS_NO_MORE ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ /* falling through */
+
+ case ABORT_PROCESSED:
+ return_status = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ return_status = USER_ABORT ;
+ break ;
+ }
+ }
+
+ /* Process last tape format request as long as no fatal error occurred */
+ switch( return_status ) {
+
+ case SUCCESS:
+ case USER_ABORT:
+ case FS_COMM_FAILURE:
+ if( return_status == SUCCESS ) {
+ lp->rr.lp_message = LRW_END ;
+ } else {
+ lp->rr.lp_message = LRW_ABORT ;
+ }
+ if( LP_GetAbortFlag( lp->lis_ptr ) != ABORT_AT_EOM ) {
+ if( ( return_status = TF_GetNextTapeRequest( &lp->rr ) ) != SUCCESS ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ } else {
+ if( lp->rr.tf_message == TRW_EOM ) {
+ return_status = LP_ProcessEOM( lp, TRW_EOM ) ;
+ }
+ }
+ }
+ break ;
+
+ default:
+ /* don't care about these conditions */
+ break ;
+
+ }
+
+ /* Log end of backup set (being optimistic that the last buffer goes to tape) */
+ LP_MsgEndBS( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ /* Close set, save current tape device and post tape stats */
+ LP_CloseSet( pb.channel ) ;
+
+ }
+ else {
+ TF_CloseSet( pb.channel, NULL ) ;
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+
+ free( data_frag.buffer ) ;
+
+ return( return_status ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/back_obj.c b/private/utils/ntbackup/src/back_obj.c
new file mode 100644
index 000000000..b2a3bdab5
--- /dev/null
+++ b/private/utils/ntbackup/src/back_obj.c
@@ -0,0 +1,847 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: back_obj.c
+
+ Description: this module contains the backup obj
+ routine.
+
+
+ $Log: N:\logfiles\back_obj.c_v $
+
+ Rev 1.44.1.4 26 Apr 1994 19:00:08 STEVEN
+fix dissconnect bug
+
+ Rev 1.44.1.3 28 Mar 1994 14:28:24 GREGG
+Pass STRM_INVALID instead of -1 on ACCESS_DENIED_ERROR.
+
+ Rev 1.44.1.2 28 Jan 1994 11:06:44 GREGG
+More Warning Fixes
+
+ Rev 1.44.1.1 19 Jan 1994 12:51:14 BARRY
+Supress warnings
+
+ Rev 1.44.1.0 16 Nov 1993 19:33:18 STEVEN
+move message for corrupt to top of pad code
+
+ Rev 1.44 17 Aug 1993 03:38:22 GREGG
+Fixed handling of corrupt streams.
+
+ Rev 1.43 12 Aug 1993 15:57:38 BARRY
+Only log bad block once on mult bad streams.
+
+ Rev 1.42 05 Aug 1993 20:09:34 BARRY
+Needed to log bad block on corrupt stream and send stream number to
+LP_PadToEndEndOfStream so CFIL is made correctly.
+
+ Rev 1.41 19 Jul 1993 13:44:58 BARRY
+Log bad blocks for corrupt files.
+
+ Rev 1.40 17 Jul 1993 14:58:58 GREGG
+Set buff_used in LP_PadToEndOfStream.
+
+ Rev 1.39 09 Jun 1993 19:38:14 MIKEP
+enable c++ compile
+
+ Rev 1.38 11 May 1993 13:08:04 DON
+Need to check for COMM_FAILURE during read/write operations. May lose attachment!
+
+ Rev 1.37 28 Apr 1993 12:57:16 MARILYN
+fixed per Steve D. Should not have been updated amount_read with
+the amount in the frag buffer since we haven't actually processed
+it.
+
+ Rev 1.36 25 Apr 1993 20:13:48 GREGG
+Fifth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Store the corrupt stream number in the CFIL tape struct and the CFDB.
+
+Matches: MTF10WDB.C 1.9, FSYS.H 1.33, FSYS_STR.H 1.47, MAKECFDB.C 1.2,
+ BACK_OBJ.C 1.36, MAYN40RD.C 1.58
+
+ Rev 1.35 31 Mar 1993 08:54:30 MARILYN
+changed over to MTF checksums. If we are generating a checksum for a
+data stream, we now update the stream header to say so.
+
+ Rev 1.34 25 Mar 1993 17:52:12 CHUCKB
+No longer treat the skip files flag as a boolean. Only skip if the user has asked to skip; if he
+wants to wait before he skips, let him.
+
+ Rev 1.33 16 Mar 1993 13:37:00 MARILYN
+The checksum for a buffer needed to be computed before the LP_Send
+because once TF got it's grubby little hands on it the data was no
+good.
+
+ Rev 1.32 13 Mar 1993 17:10:48 GREGG
+Back to calling LP_Send before LP_SendDataEnd.
+
+ Rev 1.31 11 Mar 1993 12:43:54 STEVEN
+fix bugs found by GREGG
+
+ Rev 1.30 01 Mar 1993 17:33:52 MARILYN
+If BEC_GetProcChecksumStrms is true, write a checksum stream to tape
+each object.
+
+ Rev 1.29 13 Feb 1993 14:03:30 MARILYN
+amount_read was not being updated properly
+
+ Rev 1.28 01 Feb 1993 19:46:28 STEVEN
+bug fixes
+
+ Rev 1.27 30 Jan 1993 14:36:10 MARILYN
+It is now acceptable for read to send back data with FS_EOF_REACHED.
+
+ Rev 1.26 27 Jan 1993 13:50:42 STEVEN
+updates from msoft
+
+ Rev 1.25 18 Jan 1993 16:46:48 STEVEN
+fix bug, we did not save the file handle in LP
+
+ Rev 1.24 14 Jan 1993 16:40:08 STEVEN
+fix bugs in last checkin
+
+ Rev 1.23 14 Jan 1993 13:34:06 STEVEN
+added stream_id to error message
+
+ Rev 1.22 28 Oct 1992 16:41:10 STEVEN
+send end for CFDB
+
+ Rev 1.21 26 Oct 1992 10:53:40 STEVEN
+allways read even if buffer size= 0
+
+ Rev 1.20 05 Oct 1992 10:29:18 STEVEN
+remove TotalSize
+
+ Rev 1.19 16 Sep 1992 16:55:02 STEVEN
+added support for stream info struct for Tpfmt
+
+ Rev 1.18 01 Sep 1992 16:11:56 STEVEN
+added stream headers to fsys API
+
+ Rev 1.17 23 Jul 1992 09:06:24 STEVEN
+fix warnings
+
+ Rev 1.16 29 May 1992 13:57:40 STEVEN
+if EOF on var length then SUCCESS
+
+ Rev 1.15 28 May 1992 16:36:06 TIMN
+Changed CHAR to INT8
+
+ Rev 1.14 05 May 1992 17:19:18 STEVEN
+fixed typos and misc bugs
+
+ Rev 1.13 16 Mar 1992 16:48:08 STEVEN
+more 64 bit support for format 40
+
+ Rev 1.12 13 Mar 1992 09:23:34 STEVEN
+4.0 tape format 64 bit
+
+ Rev 1.11 16 Jan 1992 15:45:18 STEVEN
+fix warnings for WIN32
+
+ Rev 1.10 12 Dec 1991 10:00:42 STEVEN
+change read to FS_READ
+
+ Rev 1.9 21 Nov 1991 19:17:14 BARRY
+Got rid of Steve's temporary FS_OBJECT_CORRUPT #define.
+
+ Rev 1.8 07 Nov 1991 12:42:30 STEVEN
+TRYCYCLE - added support for varible length files
+
+ Rev 1.7 21 Jun 1991 09:28:10 STEVEN
+new config unit
+
+ Rev 1.6 17 Jun 1991 16:28:08 STEVEN
+LP_PadData is called from lptools.c so it was moved to there
+
+ Rev 1.5 30 May 1991 09:11:58 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.4 29 May 1991 14:55:04 DAVIDH
+Corrected assignment statement using '==' instead of '='.
+
+ Rev 1.3 24 May 1991 14:42:18 STEVEN
+complete changes for new getnext
+
+ Rev 1.2 23 May 1991 16:19:14 STEVEN
+update for BSD redesign
+
+ Rev 1.1 23 May 1991 16:03:02 BARRY
+Cleaned up code per first LOOPS code review.
+
+ Rev 1.0 09 May 1991 13:39:16 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "datetime.h"
+#include "tflproto.h"
+#include "loops.h"
+#include "tfldefs.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "checksum.h"
+
+
+
+INT16 LP_PadToEndOfStream( LP_ENV_PTR lp, UINT32 attrib, UINT16 streamNumber ) ;
+
+/**/
+/**
+
+ Name: LP_BackupOBJ()
+
+ Description: this routine processes a single object,
+ by calling the appropriate file system
+ and tape format layer routines.
+
+ Modified: 5/23/1991 16:6:52
+
+ Returns: tape backup engine error.
+
+ Notes: na
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_BackupOBJ(
+LP_ENV_PTR lp,
+DBLK_PTR blk_ptr,
+DATA_FRAGMENT_PTR frag_ptr )
+{
+ UINT32 space_fwd ;
+ INT16 return_status = SUCCESS ;
+ BOOLEAN opened_in_use = FALSE ;
+ UINT16 amount_read ;
+ UINT64 bytes_skipped ;
+ UINT32 file_offset ;
+ BSD_PTR bsd_ptr;
+ FSYS_HAND fsh ;
+ UINT32 pid ;
+ BE_CFG_PTR cfg ;
+ BOOLEAN math_stat ;
+ INT16 close_status ;
+ UINT32 checksum ;
+ BOOLEAN insertChecksum = FALSE ;
+ UINT16 streamNumber = 0;
+
+ lp->corrupt_file = FALSE ;
+
+ fsh = lp->curr_fsys ;
+ bsd_ptr = lp->lis_ptr->curr_bsd_ptr ;
+ pid = lp->lis_ptr->pid ;
+ cfg = BSD_GetConfigData( lp->lis_ptr->curr_bsd_ptr ) ;
+
+ /* Opening files in use, now check for this case */
+ lp->f_hand = &lp->file_hand ;
+ switch( ( return_status = FS_OpenObj( fsh, &lp->file_hand, blk_ptr, FS_READ ) ) ) {
+
+ case FS_OPENED_INUSE:
+ opened_in_use = TRUE ;
+ break;
+
+ case FS_BAD_ATTACH_TO_SERVER:
+ case FS_ACCESS_DENIED:
+
+ if ( return_status == FS_ACCESS_DENIED ) {
+ return_status = LP_ACCESS_DENIED_ERROR ;
+ }
+
+ LP_MsgError( lp->lis_ptr->pid,
+ lp->lis_ptr->curr_bsd_ptr,
+ lp->curr_fsys,
+ &lp->tpos,
+ return_status,
+ lp->curr_ddb,
+ blk_ptr,
+ STRM_INVALID ) ;
+
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ bytes_skipped = FS_GetDisplaySizeFromDBLK( fsh, blk_ptr ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, bytes_skipped ) ;
+
+ return SUCCESS ;
+
+ case SUCCESS: /* Nothing special */
+ break ;
+
+ case FS_IN_USE_ERROR:
+ if( BEC_GetSkipOpenFiles( cfg ) == BEC_SKIP_OPEN_FILES ) {
+
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ bytes_skipped = FS_GetDisplaySizeFromDBLK( fsh, blk_ptr ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, bytes_skipped ) ;
+
+ return SUCCESS ;
+
+ } else {
+ switch( LP_MsgObjectInUse( pid, bsd_ptr, fsh, &lp->tpos,
+ blk_ptr, LP_CheckForOpen, ( UINT32 )lp ) ) {
+
+ case OBJECT_OPENED_INUSE:
+ opened_in_use = TRUE ;
+
+ /* falling through */
+
+ case OBJECT_OPENED_SUCCESSFULLY:
+ LP_MsgBlockProcessed( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr ) ;
+ break ;
+
+ case SKIP_OBJECT:
+ LP_MsgBlockInuse( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ bytes_skipped = FS_GetDisplaySizeFromDBLK( fsh, blk_ptr ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, bytes_skipped ) ;
+
+ return SUCCESS ;
+
+ }
+ }
+ break ;
+
+ case FS_COMM_FAILURE:
+
+ if ( DLE_GetDeviceType( BSD_GetDLE( bsd_ptr) ) == FS_EMS_DRV ) {
+ LP_MsgError( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ FS_COMM_FAILURE,
+ lp->curr_ddb,
+ blk_ptr,
+ 0L ) ;
+ return SUCCESS ;
+
+ } else {
+
+ LP_MsgCommFailure( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ lp->curr_ddb,
+ blk_ptr,
+ 0L );
+
+
+ return (return_status) ;
+ }
+
+
+ case FS_NOT_FOUND:
+ case FS_NO_MORE:
+
+ return SUCCESS ;
+
+ break ;
+
+ default: /* skipped */
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ bytes_skipped = FS_GetDisplaySizeFromDBLK( fsh, blk_ptr ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, bytes_skipped ) ;
+
+ return SUCCESS ;
+
+ }
+
+ /* Now do tape format loop */
+ lp->rr.cur_dblk = blk_ptr ; /* set up current DBLK */
+ return_status = LP_Send( lp , FALSE ) ; /* data_flag FALSE to send DBLK */
+
+ /* Log the block after tape format set the LBA */
+ opened_in_use ? LP_MsgOpenedInUse( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr ) :
+ LP_MsgLogBlock( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr ) ;
+
+ file_offset = 0 ;
+
+ /* if checksum processing is enabled, initialize */
+ /* the checksum for this object */
+ if ( BEC_GetProcChecksumStrm( cfg ) ) {
+ Checksum_Init( &checksum ) ;
+ }
+
+ while ( !return_status && lp->rr.tf_message == TRW_DATA ) {
+
+ amount_read = 0 ;
+ lp->read_size = lp->rr.buff_size ;
+ lp->buf_start = (INT8_PTR)lp->rr.buff_ptr ;
+
+ if( frag_ptr->buffer_used != 0 ) {
+
+ if( lp->read_size < (UINT16)(frag_ptr->buffer_size - frag_ptr->buffer_used) ) {
+ memcpy( lp->buf_start,
+ frag_ptr->buffer + frag_ptr->buffer_used,
+ lp->read_size ) ;
+
+ lp->buf_start += lp->read_size ;
+ amount_read = lp->read_size ;
+ frag_ptr->buffer_used += lp->read_size ;
+ lp->read_size = 0 ;
+ } else {
+ memcpy( lp->buf_start,
+ frag_ptr->buffer + frag_ptr->buffer_used,
+ frag_ptr->buffer_size - frag_ptr->buffer_used ) ;
+
+ lp->buf_start += ( frag_ptr->buffer_size - frag_ptr->buffer_used ) ;
+ lp->read_size -= ( frag_ptr->buffer_size - frag_ptr->buffer_used ) ;
+ amount_read = ( frag_ptr->buffer_size - frag_ptr->buffer_used ) ;
+ frag_ptr->buffer_used = 0 ;
+ }
+ return_status = SUCCESS ;
+ lp->read_size = 0 ;
+ } else {
+
+ return_status = FS_ReadObj( lp->file_hand, lp->buf_start, &lp->read_size, &lp->blk_size, &lp->rr.stream ) ;
+ }
+
+ if ( lp->rr.stream.id != STRM_INVALID ) {
+
+ streamNumber++;
+
+ if ( BEC_GetProcChecksumStrm( cfg ) ) {
+ insertChecksum = TRUE ;
+ lp->rr.stream.tf_attrib |= STREAM_CHECKSUMED ;
+ }
+
+ // lets log the stream header name
+ switch( lp->rr.stream.id ) {
+ case STRM_EMS_MONO_DB:
+ case STRM_EMS_MONO_LOG:
+ {
+ CHAR strm_name[256] ;
+ UINT16 size = (UINT16)sizeof(strm_name) ;
+
+ EMS_GetStreamName( lp->file_hand, (BYTE_PTR)strm_name, &size ) ;
+ LP_MsgLogStream( pid, bsd_ptr, fsh, &lp->tpos, strm_name ) ;
+
+ break ;
+ }
+ }
+ }
+
+ /* update the amount_read to reflect that which was just read in */
+ amount_read += lp->read_size ;
+
+ if ( return_status == SUCCESS ) {
+
+ if( ( lp->rr.buff_size - amount_read != 0 ) &&
+ ( (UINT16)(lp->rr.buff_size - amount_read) < lp->blk_size ) ) {
+
+ if( frag_ptr->memory_allocated < lp->blk_size ) {
+
+ if( frag_ptr->buffer != NULL ) {
+ free( frag_ptr->buffer ) ;
+ }
+
+ frag_ptr->buffer = calloc( 1, lp->blk_size ) ;
+ if( frag_ptr->buffer == NULL ) {
+
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ FS_CloseObj( lp->file_hand ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ frag_ptr->memory_allocated = lp->blk_size ;
+ }
+
+ frag_ptr->buffer_size = lp->blk_size ;
+ frag_ptr->buffer_used = lp->blk_size ;
+
+
+ return_status = FS_ReadObj( lp->file_hand, frag_ptr->buffer, &frag_ptr->buffer_used, &lp->blk_size, &lp->rr.stream ) ;
+
+ if ( return_status == FS_EOF_REACHED ) {
+
+ /* we need to handle any data that was sent */
+ /* back from the read */
+ frag_ptr->buffer_used = lp->rr.buff_size - amount_read ;
+
+ memcpy( lp->rr.buff_ptr + amount_read,
+ frag_ptr->buffer,
+ frag_ptr->buffer_used ) ;
+
+ amount_read += frag_ptr->buffer_used ;
+ frag_ptr->buffer_used = 0 ;
+
+ lp->current_stream_size = U64_Sub( lp->current_stream_size, U32_To_U64( lp->read_size ), &math_stat ) ;
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, U64_Init((INT32)amount_read, 0 ) ) ;
+
+ /* if checksum processing is enabled, */
+ /* compute the checksum for this object */
+ if ( insertChecksum ) {
+ Checksum_Block( &checksum, lp->buf_start, amount_read ) ;
+ }
+
+ file_offset += amount_read ;
+ lp->rr.buff_used = amount_read ;
+ if( ( return_status = LP_Send( lp, TRUE ) ) != SUCCESS ) {
+ amount_read = 0 ;
+ break ;
+ }
+
+ /* if a checksum stream is to follow the */
+ /* current data stream write it */
+ if ( insertChecksum ) {
+
+ if( ( return_status = LP_InsertChecksumStream( checksum, lp ) ) != SUCCESS ) {
+ amount_read = 0 ;
+ break ;
+ }
+ }
+
+ amount_read = 0 ;
+
+ /* we are all done with this object, tell TF */
+ return_status = LP_SendDataEnd( lp ) ;
+ break;
+
+ } else if ( ( return_status == FS_OBJECT_CORRUPT ) ||
+ ( return_status == FS_COMM_FAILURE ) ) {
+ LP_SendDataEnd( lp ) ;
+ if ( lp->corrupt_file == FALSE ) {
+ FS_SetDefaultDBLK( fsh, CFDB_ID, ( CREATE_DBLK_PTR )lp->rr.cfdb_data_ptr ) ;
+ lp->rr.cfdb_data_ptr->std_data.dblk = lp->rr.cfdb_ptr ;
+ lp->rr.cfdb_data_ptr->corrupt_offset = file_offset ;
+ lp->rr.cfdb_data_ptr->stream_number = streamNumber ;
+ FS_CreateGenCFDB( fsh, lp->rr.cfdb_data_ptr ) ;
+ lp->corrupt_file = TRUE ;
+ LP_MsgBlockBad( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ }
+ return_status = SUCCESS ;
+
+ } else if ( return_status != SUCCESS ) {
+
+ space_fwd = frag_ptr->buffer_size - frag_ptr->buffer_used ;
+
+ LP_PadData( frag_ptr->buffer + frag_ptr->buffer_used, space_fwd );
+ FS_SeekObj( lp->file_hand, &space_fwd );
+ amount_read += (UINT16)space_fwd ;
+ if ( lp->corrupt_file == FALSE ) {
+ FS_SetDefaultDBLK( fsh, CFDB_ID, ( CREATE_DBLK_PTR )lp->rr.cfdb_data_ptr ) ;
+ lp->rr.cfdb_data_ptr->std_data.dblk = lp->rr.cfdb_ptr ;
+ lp->rr.cfdb_data_ptr->corrupt_offset = file_offset ;
+ FS_CreateGenCFDB( fsh, lp->rr.cfdb_data_ptr ) ;
+ lp->corrupt_file = TRUE ;
+ LP_MsgBlockBad( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ }
+ frag_ptr->buffer_used += (UINT16)space_fwd ;
+ }
+
+
+ if( !return_status && ( frag_ptr->buffer_used == frag_ptr->buffer_size ) ) {
+
+ frag_ptr->buffer_used = lp->rr.buff_size - amount_read ;
+
+ memcpy( lp->rr.buff_ptr + amount_read,
+ frag_ptr->buffer,
+ frag_ptr->buffer_used ) ;
+
+ amount_read += frag_ptr->buffer_used ;
+ }
+ }
+ }
+
+
+ if ( return_status == FS_EOF_REACHED ) {
+
+ /* we need to handle any data that was sent */
+ /* back from the read */
+ lp->current_stream_size = U64_Sub( lp->current_stream_size, U32_To_U64( lp->read_size ), &math_stat ) ;
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, U64_Init((INT32)amount_read, 0 ) ) ;
+
+ /* if a checksum stream is to follow the current data */
+ /* stream, compute the checksum for the object */
+ if ( insertChecksum ) {
+ Checksum_Block( &checksum, lp->buf_start, amount_read ) ;
+ }
+
+ file_offset += amount_read ;
+ lp->rr.buff_used = amount_read ;
+ if( ( return_status = LP_Send( lp, TRUE ) ) != SUCCESS ) {
+ amount_read = 0 ;
+ break ;
+ }
+
+ /* if a checksum stream is to follow the */
+ /* current stream, we had better write it */
+ if ( insertChecksum ) {
+
+ if( ( return_status = LP_InsertChecksumStream( checksum, lp ) ) != SUCCESS ) {
+ amount_read = 0 ;
+ break ;
+ }
+ }
+
+ amount_read = 0 ;
+
+ /* we are all done with this object, tell TF */
+ return_status = LP_SendDataEnd( lp ) ;
+ break ;
+
+ } else if ( return_status == FS_STREAM_CORRUPT ) {
+
+ return_status = LP_PadToEndOfStream( lp, CFDB_UNREADABLE_BLK_BIT, streamNumber ) ;
+ continue ;
+
+ } else if ( return_status == FS_UNABLE_TO_LOCK ) {
+
+ switch( LP_MsgObjectInUse( pid, bsd_ptr, fsh, &lp->tpos,
+ blk_ptr, LP_CheckForReadLock, ( UINT32 )lp ) ) {
+
+ case SKIP_OBJECT:
+// LP_MsgBlockInuse( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+
+ /* skip the whole stream */
+ return_status = LP_PadToEndOfStream( lp, CFDB_DEADLOCK_BIT, streamNumber ) ;
+ continue ;
+
+ default:
+ return_status = SUCCESS ;
+
+ }
+
+ } else if( ( return_status == FS_OBJECT_CORRUPT ) ||
+ ( return_status == FS_IN_USE_ERROR ) ||
+ ( return_status == FS_COMM_FAILURE ) ) {
+
+
+ LP_SendDataEnd( lp ) ;
+ if( lp->corrupt_file == FALSE ) {
+ FS_SetDefaultDBLK( fsh, CFDB_ID, ( CREATE_DBLK_PTR )lp->rr.cfdb_data_ptr ) ;
+ lp->rr.cfdb_data_ptr->std_data.dblk = lp->rr.cfdb_ptr ;
+ lp->rr.cfdb_data_ptr->corrupt_offset = file_offset ;
+ FS_CreateGenCFDB( fsh, lp->rr.cfdb_data_ptr ) ;
+ if ( return_status == FS_IN_USE_ERROR ) {
+ LP_MsgBlockInuse( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ } else {
+ LP_MsgBlockBad( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ }
+ }
+
+ return_status = SUCCESS ;
+ lp->corrupt_file = TRUE ;
+
+
+ } else if( ((return_status == FS_ACCESS_DENIED) || (return_status == FS_BAD_ATTACH_TO_SERVER)) &&
+ (DLE_GetDeviceType( BSD_GetDLE( bsd_ptr) ) == FS_EMS_DRV ) ) {
+
+ if ( return_status == FS_ACCESS_DENIED ) {
+ return_status = LP_ACCESS_DENIED_ERROR ;
+ }
+
+ LP_SendDataEnd( lp ) ;
+ if( lp->corrupt_file == FALSE ) {
+ LP_MsgError( lp->lis_ptr->pid,
+ lp->lis_ptr->curr_bsd_ptr,
+ lp->curr_fsys,
+ &lp->tpos,
+ return_status,
+ lp->curr_ddb,
+ blk_ptr,
+ STRM_INVALID ) ;
+
+ FS_SetDefaultDBLK( fsh, CFDB_ID, ( CREATE_DBLK_PTR )lp->rr.cfdb_data_ptr ) ;
+ lp->rr.cfdb_data_ptr->std_data.dblk = lp->rr.cfdb_ptr ;
+ lp->rr.cfdb_data_ptr->corrupt_offset = file_offset ;
+ FS_CreateGenCFDB( fsh, lp->rr.cfdb_data_ptr ) ;
+ LP_MsgBlockBad( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ }
+
+ return_status = SUCCESS ;
+ lp->corrupt_file = TRUE ;
+
+
+ } else if( return_status != SUCCESS ) {
+
+ space_fwd = min( 512, lp->rr.buff_size - amount_read ) ;
+ FS_SeekObj( lp->file_hand, &space_fwd ) ;
+
+ LP_PadData( (INT8_PTR)(lp->rr.buff_ptr + amount_read), space_fwd ) ;
+ amount_read += ( UINT16 )space_fwd ;
+
+ if( lp->corrupt_file == FALSE ) {
+ FS_SetDefaultDBLK( fsh, CFDB_ID, ( CREATE_DBLK_PTR )lp->rr.cfdb_data_ptr ) ;
+ lp->rr.cfdb_data_ptr->std_data.dblk = lp->rr.cfdb_ptr ;
+ lp->rr.cfdb_data_ptr->corrupt_offset = file_offset ;
+ FS_CreateGenCFDB( fsh, lp->rr.cfdb_data_ptr ) ;
+ LP_MsgBlockBad( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr, lp->curr_ddb ) ;
+ }
+
+ lp->corrupt_file = TRUE ;
+ return_status = SUCCESS ;
+ }
+
+ lp->current_stream_size = U64_Sub( lp->current_stream_size, U32_To_U64( amount_read ), &math_stat ) ;
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, U64_Init((INT32)amount_read, 0 ) ) ;
+
+ /* if a checksum stream is to follow the current */
+ /* data stream we need to compute the checksum */
+ if ( insertChecksum ) {
+ Checksum_Block( &checksum, lp->buf_start, amount_read ) ;
+ }
+
+ file_offset += amount_read ;
+ lp->rr.buff_used = amount_read ;
+ return_status = LP_Send( lp, TRUE ) ; /* data_flag TRUE to send data */
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ /* falling through */
+
+ case ABORT_PROCESSED:
+ return_status = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ return_status = USER_ABORT ;
+ break ;
+ }
+ }
+
+ /* If there was no problem, set the backup date before closing */
+ if( (return_status == SUCCESS ) &&
+ (FS_GetBlockType( blk_ptr ) == FDB_ID) &&
+ (BEC_GetSetArchiveFlag( cfg )) ) {
+
+ FS_SetBDateInDBLK( fsh, blk_ptr, &lp->backup_dt ) ;
+ }
+
+ /* Problems on close for backup aren't expected--ignore return value. */
+
+ close_status = FS_CloseObj( lp->file_hand ) ;
+
+ if( return_status == SUCCESS ) {
+
+ if ( close_status == FS_NO_SECURITY ) {
+ LP_MsgError( lp->lis_ptr->pid,
+ lp->lis_ptr->curr_bsd_ptr,
+ lp->curr_fsys,
+ &lp->tpos,
+ LP_ACCESS_DENIED_ERROR,
+ lp->curr_ddb,
+ blk_ptr,
+ STRM_NT_ACL ) ;
+ }
+
+ LP_MsgBlockProcessed( pid, bsd_ptr, fsh, &lp->tpos, blk_ptr ) ;
+
+ /* If it was a corrupt file, then handle as normal */
+ if( lp->corrupt_file ) {
+ lp->rr.cur_dblk = lp->rr.cfdb_ptr ; /* Send the cfdb */
+ return_status = LP_Send( lp , FALSE ) ; /* data_flag FALSE to send DBLK */
+ lp->rr.buff_used = 0 ;
+ LP_SendDataEnd( lp ) ;
+
+ }
+
+ }
+
+ return( return_status ) ;
+
+}
+
+INT16 LP_PadToEndOfStream(
+ LP_ENV_PTR lp,
+ UINT32 attrib,
+ UINT16 streamNumber )
+{
+ UINT64 amount_to_skip = lp->current_stream_size ;
+ UINT32 space_fwd;
+ INT16 return_status = SUCCESS ;
+ BOOLEAN math_stat ;
+
+
+ if( (return_status == SUCCESS) && (lp->corrupt_file == FALSE) ) {
+ FS_SetDefaultDBLK( lp->curr_fsys, CFDB_ID, ( CREATE_DBLK_PTR )lp->rr.cfdb_data_ptr ) ;
+ lp->rr.cfdb_data_ptr->std_data.dblk = lp->rr.cfdb_ptr ;
+ lp->rr.cfdb_data_ptr->corrupt_offset = 0 ;
+ lp->rr.cfdb_data_ptr->std_data.attrib = attrib ;
+ lp->rr.cfdb_data_ptr->stream_number = streamNumber ;
+ FS_CreateGenCFDB( lp->curr_fsys, lp->rr.cfdb_data_ptr ) ;
+ LP_MsgBlockBad( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, lp->rr.cur_dblk, lp->curr_ddb ) ;
+ }
+
+ while( (return_status == SUCCESS) &&
+ !U64_EQ( amount_to_skip, U32_To_U64( 0L ) ) ) {
+
+ space_fwd = U64_Lsw( amount_to_skip ) ;
+
+ if ( U64_Lsw( amount_to_skip ) == 0 ) {
+ space_fwd = 0x7ffffff ;
+ }
+
+ if ( (UINT32)((UINT16)lp->rr.buff_size) < space_fwd ) {
+ space_fwd = lp->rr.buff_size ;
+ }
+
+ lp->rr.buff_used = (UINT16)space_fwd ;
+
+ amount_to_skip = U64_Sub( amount_to_skip, U32_To_U64( space_fwd ), &math_stat ) ;
+
+ FS_SeekObj( lp->file_hand, &space_fwd ) ;
+ LP_PadData( (INT8_PTR)lp->rr.buff_ptr, space_fwd ) ;
+ LP_MsgBytesProcessed( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, U32_To_U64( space_fwd ) ) ;
+ lp->current_stream_size = U64_Sub( lp->current_stream_size, U32_To_U64( space_fwd ), &math_stat ) ;
+
+ return_status = LP_Send( lp, TRUE ) ; /* data_flag TRUE to send data */
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( lp->lis_ptr->pid,
+ lp->lis_ptr->curr_bsd_ptr,
+ lp->curr_fsys, &lp->tpos,
+ LP_USER_ABORT_ERROR,
+ NULL,
+ NULL,
+ 0L ) ;
+
+ /* falling through */
+
+ case ABORT_PROCESSED:
+ return_status = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ return_status = USER_ABORT ;
+ break ;
+ }
+ }
+
+ lp->read_size = 0 ;
+
+// This assert will not be true if user aborts....
+// msassert( U64_EQ( lp->current_stream_size, U64_Init( 0L, 0L ) ) ) ;
+
+ lp->corrupt_file = TRUE ;
+
+ return return_status ;
+
+}
diff --git a/private/utils/ntbackup/src/back_vcb.c b/private/utils/ntbackup/src/back_vcb.c
new file mode 100644
index 000000000..c5d55fa22
--- /dev/null
+++ b/private/utils/ntbackup/src/back_vcb.c
@@ -0,0 +1,240 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: back_vcb.c
+
+ Description: Function to backup the VCB
+
+ $Log: T:/LOGFILES/BACK_VCB.C_V $
+
+ Rev 1.17 26 Apr 1993 02:43:44 GREGG
+Sixth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Redefined attribute bits to match the spec.
+ - Eliminated unused/undocumented bits.
+ - Added code to translate bits on tapes that were written wrong.
+
+Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+
+ Rev 1.16 04 Nov 1992 10:17:08 STEVEN
+fix typeo
+
+ Rev 1.15 03 Nov 1992 10:34:54 STEVEN
+fix typo
+
+ Rev 1.14 02 Nov 1992 17:13:10 STEVEN
+fix string types
+
+ Rev 1.13 09 Oct 1992 15:57:40 STEVEN
+added Daily backup set support
+
+ Rev 1.12 18 Sep 1992 15:52:50 STEVEN
+fix spelling
+
+ Rev 1.11 23 Jul 1992 09:23:14 STEVEN
+fix warnings
+
+ Rev 1.10 21 Jul 1992 14:25:44 STEVEN
+added support for user name in VCB
+
+ Rev 1.9 09 Jul 1992 14:00:08 STEVEN
+BE_Unicode updates
+
+ Rev 1.8 16 Jan 1992 15:45:42 STEVEN
+fix warnings for WIN32
+
+ Rev 1.7 06 Nov 1991 18:25:28 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from lp instead of lis.
+
+ Rev 1.6 17 Oct 1991 01:50:44 ED
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.5 20 Sep 1991 16:43:02 STEVEN
+added vcb attribute for backup type
+
+ Rev 1.4 26 Aug 1991 13:19:14 STEVEN
+BE should not mess with the FullyCataloged attribute of a BSD
+
+ Rev 1.3 21 Jun 1991 09:27:50 STEVEN
+new config unit
+
+ Rev 1.2 30 May 1991 09:12:50 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.1 23 May 1991 16:34:24 STEVEN
+changes for new bsdu
+
+ Rev 1.0 09 May 1991 13:39:18 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "enc_pub.h"
+/**/
+/**
+
+ Name: LP_BackupVCB()
+
+ Description: Function to backup the VCB
+
+ Modified: 7/20/1989
+
+ Returns: any lower layer errors
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_BackupVCB(
+BSD_PTR bsd_ptr,
+register LP_ENV_PTR lp )
+{
+ GEN_VCB_DATA vcb_data ;
+ INT16 return_status ;
+ GENERIC_DLE_PTR dle;
+
+ if( ( return_status = LP_StartTPEDialogue( lp, TRUE ) ) != NO_ERR ) {
+
+ return( return_status ) ;
+
+ }
+
+ /* build the vcb and send it to the tape format layer */
+
+ vcb_data.date = &lp->backup_dt ;
+
+ /* set labels fields */
+ FS_SetDefaultDBLK( lp->curr_fsys, VCB_ID, (CREATE_DBLK_PTR)&vcb_data ) ;
+
+ vcb_data.std_data.dblk = lp->curr_blk ;
+
+ dle = BSD_GetDLE( bsd_ptr ) ;
+ vcb_data.user_name = DLE_ViewUserName( dle ) ;
+ vcb_data.user_name_size = DLE_SizeofUserName( dle ) ;
+
+
+ if ( BSD_GetTapeLabel( bsd_ptr ) != NULL ) {
+ vcb_data.tape_name = BSD_GetTapeLabel( bsd_ptr ) ;
+ vcb_data.tape_name_size = BSD_SizeofTapeLabel( bsd_ptr ) ;
+ }
+ else {
+ vcb_data.tape_name_size = 0 ;
+ }
+
+ if ( BSD_GetBackupLabel( bsd_ptr ) != NULL ) {
+ vcb_data.bset_name = BSD_GetBackupLabel( bsd_ptr ) ;
+ vcb_data.bset_name_size = BSD_SizeofBackupLabel( bsd_ptr ) ;
+ }
+ else {
+ vcb_data.bset_name_size = 0 ;
+ }
+
+
+ if ( BSD_GetBackupDescript( bsd_ptr ) != NULL ) {
+ vcb_data.bset_descript = BSD_GetBackupDescript( bsd_ptr ) ;
+ vcb_data.bset_descript_size = BSD_SizeofBackupDescript( bsd_ptr ) ;
+ }
+ else {
+ vcb_data.bset_descript_size = 0 ;
+ }
+
+
+ /* set password fields */
+
+ if ( BSD_GetBackupPswd( bsd_ptr ) != NULL ) {
+ vcb_data.bset_password = BSD_GetBackupPswd( bsd_ptr );
+ vcb_data.bset_password_size = BSD_GetBackupPswdSize( bsd_ptr );
+ }
+ else {
+ vcb_data.bset_password_size = 0 ;
+ }
+
+ if ( BSD_GetTapePswd( bsd_ptr ) != NULL ) {
+ vcb_data.tape_password = BSD_GetTapePswd( bsd_ptr ) ;
+ vcb_data.tape_password_size = BSD_GetTapePswdSize( bsd_ptr ) ;
+ }
+ else {
+ vcb_data.tape_password_size = 0 ;
+ }
+
+ if( vcb_data.tape_password_size || vcb_data.bset_password_size ) {
+ vcb_data.password_encrypt_alg = ENC_ALGOR_3 ;
+ }
+
+ if( lp->lis_ptr->oper_type == ARCHIVE_BACKUP_OPER ) {
+ vcb_data.std_data.attrib |= VCB_ARCHIVE_BIT ;
+ }
+
+ switch( BSD_GetBackupType( bsd_ptr ) ) {
+ case BSD_BACKUP_NORMAL :
+ vcb_data.std_data.attrib |= VCB_NORMAL_SET ;
+ break ;
+ case BSD_BACKUP_COPY :
+ vcb_data.std_data.attrib |= VCB_COPY_SET ;
+ break ;
+ case BSD_BACKUP_DIFFERENTIAL :
+ vcb_data.std_data.attrib |= VCB_DIFFERENTIAL_SET ;
+ break ;
+ case BSD_BACKUP_INCREMENTAL :
+ vcb_data.std_data.attrib |= VCB_INCREMENTAL_SET ;
+ break ;
+ case BSD_BACKUP_DAILY :
+ vcb_data.std_data.attrib |= VCB_DAILY_SET ;
+ break ;
+ default:
+ break ;
+ }
+
+ vcb_data.std_data.string_type = BEC_GetStringTypes( BSD_GetConfigData( bsd_ptr ) ) ;
+
+ FS_CreateGenVCB( lp->curr_fsys, &vcb_data ) ;
+
+ /* set tape ID, tape sequence number and backup set number */
+ FS_SetTapeIDInVCB( lp->curr_blk, BSD_GetTapeID( bsd_ptr ) ) ;
+ FS_SetTSNumInVCB( lp->curr_blk, BSD_GetTapeNum( bsd_ptr ) ) ;
+ FS_SetBSNumInVCB( lp->curr_blk, BSD_GetSetNum( bsd_ptr ) ) ;
+
+ /* send DBLK to tape format layer */
+ lp->rr.cur_dblk = lp->curr_blk ; /* Send the DBLK */
+
+ if( ( return_status = LP_Send( lp, FALSE ) ) == NO_ERR ) { /* data_flag FALSE to send DBLK */
+
+ /* Set backup set tape position info, backup set date and fully catalog indicator */
+
+ BSD_SetTapePos( bsd_ptr, FS_ViewTapeIDInVCB( lp->curr_blk ),
+ FS_ViewTSNumInVCB( lp->curr_blk ),
+ FS_ViewBSNumInVCB( lp->curr_blk ) ) ;
+ BSD_SetDate( bsd_ptr, FS_ViewBackupDateInVCB( lp->curr_blk ) );
+
+ /* Set PBA in current BSD if this drive supports FFR -OR- is an SX and we are cataloguing so that
+ verify last will block seek straight to VCB */
+ if( SupportFastFile( BSD_GetTHW( bsd_ptr ) ) ) {
+ BSD_SetPBA( bsd_ptr, FS_ViewPBAinVCB( lp->curr_blk ) ) ;
+ } else if( SupportSXFastFile( BSD_GetTHW( bsd_ptr ) ) &&
+ lp->cat_enabled ) {
+ BSD_SetPBA( bsd_ptr, MANUFACTURED_PBA ) ;
+ }
+ }
+ return( return_status ) ;
+}
+
diff --git a/private/utils/ntbackup/src/be_debug.c b/private/utils/ntbackup/src/be_debug.c
new file mode 100644
index 000000000..7cc519833
--- /dev/null
+++ b/private/utils/ntbackup/src/be_debug.c
@@ -0,0 +1,65 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: be_debug.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to call the debug printf
+
+
+ $Log: N:/LOGFILES/BE_DEBUG.C_V $
+
+ Rev 1.1 19 May 1992 13:09:00 MIKEP
+mips changes
+
+ Rev 1.0 09 May 1991 13:39:18 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <process.h>
+#include <stdarg.h>
+
+#include "stdtypes.h"
+#include "be_debug.h"
+
+VOID (*z_printf)( UINT16, va_list ) = NULL ;
+
+/* $end$ include list */
+/**/
+/**
+
+ Name: debug_printf()
+
+ Description: This function alls the user interface
+ to print debug data.
+
+ Modified: 1/5/1990
+
+ Returns: none
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BE_Zprintf( UINT16 mask_bits, ... )
+{
+ va_list arg_ptr ;
+
+ if ( z_printf != NULL ) {
+ va_start( arg_ptr, mask_bits ) ;
+ z_printf( mask_bits, arg_ptr ) ;
+ va_end( arg_ptr ) ;
+ }
+
+}
diff --git a/private/utils/ntbackup/src/be_dinit.c b/private/utils/ntbackup/src/be_dinit.c
new file mode 100644
index 000000000..a59cf558a
--- /dev/null
+++ b/private/utils/ntbackup/src/be_dinit.c
@@ -0,0 +1,105 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: be_dinit.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the deinitialization routine and the
+ control break handler.
+
+
+ $Log: Q:/LOGFILES/BE_DINIT.C_V $
+
+ Rev 1.8 18 Jun 1993 08:52:24 MIKEP
+C++ enable
+
+ Rev 1.7 17 May 1993 17:38:22 TIMN
+Added prototype to avoid warning message.
+Added NT conditional to fix compiling for non-Windows projects.
+
+ Rev 1.6 14 May 1993 14:40:14 TIMN
+Added multiple instance support for releasing the device claimed during
+startup via HWC_InitTapeDevice. No impact to NOST to take change. Cayman
+requires dil_nt.c hwconfnt.c mui.c global.c global.h hwconf.h backup.c
+
+ Rev 1.5 16 Mar 1993 14:55:14 MARILYN
+Clients do not need to deinit the tape format layer since they
+don't ever init it.
+
+ Rev 1.4 21 Jun 1991 13:24:56 BARRY
+Changes for new config.
+
+ Rev 1.3 04 Jun 1991 19:11:56 BARRY
+Removed ControlBreak stuff. Now resides in os-specific modules.
+
+ Rev 1.2 30 May 1991 09:15:42 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.1 17 May 1991 08:49:52 DAVIDH
+No control-break handling in NLM.
+
+ Rev 1.0 09 May 1991 13:39:20 HUNTER
+Initial revision.
+
+**/
+
+#include "stdtypes.h"
+#include "fsys.h"
+#include "bsdu.h"
+#include "lis.h"
+#include "tflproto.h"
+#include "tfl_err.h"
+#include "be_init.h"
+#include "ld_dvr.h"
+
+
+#if defined( OS_WIN32 ) && !defined( OEM_MSOFT )
+/**
+ Need a prototype from hwconf.h for HWC_. Including only the prototype
+ because the header file would require many other header files. Used
+ with multiple instance support which was added to CAYMAN.
+**/
+ INT HWC_DeInitTapeDevice( VOID ) ;
+#endif
+
+
+/**/
+
+/**
+
+ Name: BE_Deinit()
+
+ Description:
+
+ Modified: 11/14/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BE_Deinit( DLE_HAND dle_list )
+{
+
+#if !defined( P_CLIENT )
+
+ TF_CloseTapeFormat( ) ;
+
+# if defined( OS_WIN32 ) && !defined( OEM_MSOFT )
+ HWC_DeInitTapeDevice() ; // release claimed device
+# endif
+
+#endif
+
+ FS_RemoveFileSys( dle_list ) ;
+
+ BE_RemoveCtrlBreakHandler( ) ;
+
+}
diff --git a/private/utils/ntbackup/src/be_init.c b/private/utils/ntbackup/src/be_init.c
new file mode 100644
index 000000000..cab85bb2e
--- /dev/null
+++ b/private/utils/ntbackup/src/be_init.c
@@ -0,0 +1,232 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: be_init.c
+
+ Description: Primary entry point provided is BE_Init which is called
+ from the user interface to initialize various parts of
+ the backup engine (File Systems, BSDU, or Tape Format).
+
+
+ $Log: Q:/LOGFILES/BE_INIT.C_V $
+
+ Rev 1.16 26 Jul 1993 14:47:28 TerriLynn
+Added global for Sytron ECC. Unable to keep it
+hidden because the Enterprise team needs it to
+compile
+
+ Rev 1.15 23 Jul 1993 11:54:48 GLENN
+Added the setting of the gnProcessSytronECC flag.
+
+ Rev 1.14 22 Jul 1993 11:38:40 ZEIR
+Add'd software_name arg to OpenTapeFormat
+
+ Rev 1.13 18 Jun 1993 08:52:34 MIKEP
+C++ enable
+
+ Rev 1.12 16 Mar 1993 14:54:06 MARILYN
+Client applications don't need to initialize the tape format layer.
+
+ Rev 1.11 04 Feb 1992 21:43:40 GREGG
+Changed parameters in call to TF_OpenTapeFormat.
+
+ Rev 1.10 23 Jan 1992 15:21:50 CLIFF
+Added BE_InitLW function
+
+ Rev 1.9 17 Jan 1992 17:21:40 STEVEN
+fix warnings for WIN32
+
+ Rev 1.8 24 Oct 1991 14:59:24 BARRY
+TRICYCLE: Pass new bit-mask field of BE_INIT_STR to FS_InitFileSys()
+to support dynamically selectable file systems.
+
+ Rev 1.7 17 Oct 1991 01:44:44 ED
+BIGWHEEL -8200sx - Added catalog_directory parameter to TF_OpenTapeFormat call.
+
+ Rev 1.6 23 Sep 1991 13:37:14 GREGG
+8200SX - TF_OpenTapeFormat now is passed the machine type.
+
+ Rev 1.5 27 Jun 1991 15:40:56 JOHNW
+Pass driver directory to OpenTapeFormat
+
+ Rev 1.4 21 Jun 1991 13:24:46 BARRY
+Changes for new config.
+
+ Rev 1.3 04 Jun 1991 19:10:56 BARRY
+Removed ControlBreak handler stuff. Now resides in os-specific modules.
+
+ Rev 1.2 30 May 1991 09:15:26 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.1 17 May 1991 08:49:08 DAVIDH
+No control-break handling in NLM.
+
+ Rev 1.0 09 May 1991 13:39:22 HUNTER
+Initial revision.
+
+**/
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "beconfig.h"
+#include "fsys.h"
+#include "bsdu.h"
+#include "lis.h"
+#include "tflproto.h"
+#include "tfl_err.h"
+#include "be_init.h"
+#include "loops.h"
+
+extern VOID (*z_printf)( UINT16, CHAR_PTR, va_list ) ;
+
+/* Global for Sytos */
+INT16 gnProcessSytronECC ;
+
+/**/
+
+/**
+
+ Name: BE_Init()
+
+ Description: BE_Init is called from the user interface to initialize
+ the various backup engine units, namely, File Systems,
+ BSDU and Tape Format. This 3.1 backup engine version
+ of this entry point is not responsible for loading the
+ device driver as in the 3.0 version. That responsibility
+ is handled by Tape Format proper (since for the DOS
+ application device drivers can be unloaded and loaded
+ while within the application).
+
+ A control break handler is installed at this time if one
+ has not already be installed. In addition, the debug
+ printf function pointer is initialized so that debug
+ printf calls can be performed from within the backup
+ engine.
+
+ Modified: 11/14/1989
+
+ Returns: various backup engine errors (see BE_INIT.h)
+
+ Notes:
+
+ See also: $/SEE(be_init.h)$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BE_Init(
+BE_INIT_STR_PTR be_ptr,
+BE_CFG_PTR conf_ptr )
+{
+ INT16 error ;
+
+ /*
+ * define debug print function for backup engine to call,
+ * if one has not already been defined
+ */
+
+ if ( z_printf == NULL ) {
+ z_printf = be_ptr->debug_print ;
+ }
+
+ // Set up the Process Sytron ECC global.
+
+ gnProcessSytronECC = BEC_GetProcessSytronECCFlag ( conf_ptr );
+
+ BE_InstallCtrlBreakHandler( );
+
+ /* Now open the file system */
+ if( be_ptr->units_to_init & BE_INIT_FSYS ) {
+ if( error = FS_InitFileSys( be_ptr->dle_list_ptr,
+ be_ptr->critical_error_handler,
+ conf_ptr,
+ be_ptr->remote_filter,
+ be_ptr->file_systems ) ) {
+
+ msassert( error == OUT_OF_MEMORY );
+ return BE_FILE_SYS_FAIL ;
+
+ }
+ }
+
+ /* Init the BSD Unit */
+ if( be_ptr->units_to_init & BE_INIT_BSDU ) {
+ if( error = BSD_OpenList( be_ptr->bsd_list_ptr, be_ptr->vm_hand ) ) {
+ FS_RemoveFileSys( *be_ptr->dle_list_ptr ) ;
+ msassert( error == OUT_OF_MEMORY );
+ return BE_BSDU_FAIL ;
+ }
+ }
+
+
+ /* Init the Tape Format Layer */
+#if !defined( P_CLIENT )
+ if( be_ptr->units_to_init & BE_INIT_TFL ) {
+
+ /* continue with Tape Format Layer init */
+ if( ( error = TF_OpenTapeFormat( be_ptr->driver_name,
+ be_ptr->dhwd_ptr,
+ be_ptr->number_of_cards,
+ be_ptr->thw_list_ptr,
+ be_ptr->max_channels,
+ BEC_GetFastFileRestore( conf_ptr ),
+ (BOOLEAN)( ( BEC_GetSpecialWord( conf_ptr ) & IGNORE_MAYNARD_ID ) ? TRUE : FALSE ),
+ be_ptr->driver_directory,
+ BEC_GetConfiguredMachineType( conf_ptr ),
+ be_ptr->catalog_directory,
+ BEC_GetInitialBuffAlloc( conf_ptr ),
+ be_ptr->software_name
+
+ ) ) != TFLE_NO_ERR ) {
+ return( error ) ;
+
+ } else {
+
+ /* Init Layer wide global thw pointers */
+ lw_toc_tpdrv = *be_ptr->thw_list_ptr ;
+ lw_last_tpdrv = *be_ptr->thw_list_ptr ;
+
+ }
+ }
+#endif
+
+ return BE_INIT_SUCCESS ;
+}
+
+
+
+
+/**/
+
+/**
+
+ Name: BE_InitLW()
+
+ Description: BE_InitLW is called from the user interface to initialize
+ the layer wide variables that define the channel. The call
+ is made after the call BE_Init or BE_ReinitTFLayer after
+ the UI validates the channel list.
+
+ Modified: 2/22/92
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE(be_init.h)$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BE_InitLW( BE_INIT_STR_PTR be_ptr )
+{
+
+ /* Init Layer wide global thw pointers */
+ lw_toc_tpdrv = *be_ptr->thw_list_ptr ;
+ lw_last_tpdrv = *be_ptr->thw_list_ptr ;
+ return ;
+}
+
diff --git a/private/utils/ntbackup/src/be_tfutl.c b/private/utils/ntbackup/src/be_tfutl.c
new file mode 100644
index 000000000..e62ad2239
--- /dev/null
+++ b/private/utils/ntbackup/src/be_tfutl.c
@@ -0,0 +1,277 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: be_tfutl.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This module contains entry points to be used by the
+ user interface to re-init the tape format with new
+ controller configuration information, get current tape
+ device from tape format layer and get current tape format
+ type from tape format layer.
+
+
+ $Log: Q:/LOGFILES/BE_TFUTL.C_V $
+
+ Rev 1.11 22 Jul 1993 11:40:50 ZEIR
+Add'd software_name arg to OpenTapeFormat
+
+ Rev 1.10 17 Jun 1993 17:49:46 MIKEP
+C++ enable
+
+ Rev 1.9 28 Jan 1993 09:25:38 DON
+Removed BE_EjectTape function
+
+ Rev 1.8 09 Nov 1992 15:25:10 DON
+Added a function to allow UI to eject a tape and brought forward charlies 1.6.1.0 changes
+
+ Rev 1.7 18 Aug 1992 09:48:58 BURT
+fix warnings
+
+ Rev 1.6 04 Feb 1992 21:44:10 GREGG
+Changed parameters in call to TF_OpenTapeFormat.
+
+ Rev 1.5 17 Jan 1992 17:21:08 STEVEN
+fix warnings for WIN32
+
+ Rev 1.4 17 Oct 1991 01:36:24 GREGG
+BIGWHEEL -8200sx - Added catalog_directory parameter to TF_OpenTapeFormat call.
+
+ Rev 1.3 23 Sep 1991 13:38:54 GREGG
+8200SX - TF_OpenTapeFormat now is passed the machine type.
+
+ Rev 1.2 28 Jun 1991 12:08:22 JOHNW
+Changes for new TPFMT unit
+
+ Rev 1.1 27 Jun 1991 08:42:20 STEVEN
+new config unit
+
+ Rev 1.0 09 May 1991 13:39:22 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "tflproto.h"
+#include "tfl_err.h"
+#include "loops.h"
+#include "be_tfutl.h"
+#include "genstat.h"
+#include "beconfig.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: BE_GetCurrentDeviceName
+
+ Description: Used to get a CHAR_PTR to the device name in the THW
+ structure. This is called by the user interface since
+ it doesn't know have access to TF_CheckDeviceStatus.
+
+ Modified: 2/14/1990
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+CHAR_PTR BE_GetCurrentDeviceName( UINT16 channel )
+{
+ THW_PTR thw_ptr ;
+
+ thw_ptr = TF_GetCurrentDevice( channel ) ;
+ return( thw_ptr->drv_name ) ;
+}
+/**/
+/**
+
+ Name: BE_GetCurrentDevice
+
+ Description: Used to get a THW_PTR for the current active drive in
+ the channel
+
+ Modified: 4/19/1990
+
+ Returns: THW_PTR
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+THW_PTR BE_GetCurrentDevice( UINT16 channel )
+{
+ return( TF_GetCurrentDevice( channel ) ) ;
+}
+/**/
+/**
+
+ Name: BE_ReinitTFLayer
+
+ Description: Entry point in Backup Engine for User Interface to
+ force a reinitialization of the Tape Format Layer. This
+ is likely used if the user makes a run-time change to
+ the hardware configuration information which requires
+ the Tape Format to be re-initialized
+
+ Modified: 8/15/1990
+
+ Returns: various be_init errors (see be_init.h)
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BE_ReinitTFLayer(
+BE_INIT_STR_PTR be_ptr,
+BE_CFG_PTR conf_ptr )
+{
+ INT16 tfl_error ;
+
+ TF_CloseTapeFormat( ) ;
+
+ if( ( tfl_error = TF_OpenTapeFormat( be_ptr->driver_name,
+ be_ptr->dhwd_ptr,
+ be_ptr->number_of_cards,
+ be_ptr->thw_list_ptr,
+ be_ptr->max_channels,
+ BEC_GetFastFileRestore( conf_ptr ),
+ (BOOLEAN)( ( BEC_GetSpecialWord( conf_ptr ) & IGNORE_MAYNARD_ID ) ? TRUE : FALSE ),
+ be_ptr->driver_directory,
+ BEC_GetConfiguredMachineType( conf_ptr ),
+ be_ptr->catalog_directory,
+ BEC_GetInitialBuffAlloc( conf_ptr ),
+ be_ptr->software_name
+
+ ) ) == TFLE_NO_ERR ) {
+
+ /* Init Layer wide global thw pointers */
+ lw_toc_tpdrv = *be_ptr->thw_list_ptr ;
+ lw_last_tpdrv = *be_ptr->thw_list_ptr ;
+
+ }
+
+ return( tfl_error ) ;
+}
+/**/
+/**
+
+ Name: BE_CheckMultiDrive
+
+ Description: Given the current channel specification, this function
+ returns an indicator of where the current drive is
+ located within the channel. This function is called
+ by the User Interface Tape Positioner and Message
+ Handler in order to determine what user interaction
+ is necessary for multi-tape drive environments.
+
+ Modified: 2/6/1990
+
+ Returns: BE_NO_MULTI_DRIVE for N/A multi-drive channel
+ BE_END_OF_CHANNEL when positioned at end of channel in
+ multi-drive environment
+ BE_MULTI_DRIVE when positioned within the channel
+ of a multi-drive environment but not
+ located at the end
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+UINT8 BE_CheckMultiDrive( UINT16 channel )
+{
+ THW_PTR thw_ptr ;
+ UINT8 status ;
+
+ thw_ptr = TF_GetCurrentDevice( channel ) ;
+ if( ( thw_ptr->channel_link.q_next == NULL ) && ( thw_ptr->link.q_prev == NULL ) ) {
+ status = BE_NO_MULTI_DRIVE ;
+ } else if( thw_ptr->channel_link.q_next == NULL ) {
+ status = BE_END_OF_CHANNEL ;
+ } else {
+ status = BE_MULTI_DRIVE ;
+ }
+ return( status ) ;
+
+}
+/**/
+/**
+
+ Name: BE_DeviceWriteProtected
+
+ Description: Return BOOLEAN indication of whether current device is
+ write protected or not.
+
+ Modified: 2/14/1990
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+BOOLEAN BE_DeviceWriteProtected( UINT16 channel )
+{
+ THW_PTR thw_ptr ;
+
+ thw_ptr = TF_GetCurrentDevice( channel ) ;
+ return( (BOOLEAN)(thw_ptr->drv_status & TPS_WRITE_PROTECT) ) ;
+}
+
+
+/**/
+/**
+
+ Name: BE_NonNativeFormat
+
+ Description: Return BOOLEAN indication of whether current device is
+ contains a tape which is non native format or native.
+
+ Modified: 2/14/1990
+
+ Returns: TRUE - non-native format
+ FALSE - native format
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+BOOLEAN BE_NonNativeFormat( UINT16 channel )
+{
+ THW_PTR thw_ptr ;
+
+ thw_ptr = TF_GetCurrentDevice( channel ) ;
+ return( (BOOLEAN)(thw_ptr->drv_status & TPS_NON_NATIVE_FORMAT) ) ;
+}
+
+
diff --git a/private/utils/ntbackup/src/bec_init.c b/private/utils/ntbackup/src/bec_init.c
new file mode 100644
index 000000000..a667544c0
--- /dev/null
+++ b/private/utils/ntbackup/src/bec_init.c
@@ -0,0 +1,360 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bec_init.c
+
+ Date Updated: 14-Jun-91
+
+ Description: Code to initialize and close the Backup Engine
+ configuration unit.
+
+ $Log: Q:/LOGFILES/BEC_INIT.C_V $
+
+ Rev 1.41 12 Aug 1993 17:22:26 TerriLynn
+Changed Min Sytron ECC to SYPL_ECC_OFF
+
+ Rev 1.40 27 Jul 1993 15:05:50 TerriLynn
+Changed hard coded values to defined values.
+
+ Rev 1.39 23 Jul 1993 12:14:38 TerriLynn
+Updated SYPL ECC default value per
+LANMAN upgrade requirements.
+
+ Rev 1.38 22 Jul 1993 10:30:20 DON
+Increased the maximum value for max_buffers to 16
+
+ Rev 1.37 21 Jul 1993 17:29:04 TerriLynn
+Added Process Sytron ECC flag
+
+ Rev 1.36 30 Jun 1993 15:27:20 BARRY
+Add process_special_files
+
+ Rev 1.35 30 Jun 1993 15:22:34 DOUG
+Changed nrl_max_spx_ipx_packet_size to 0x5B4 (1460)
+
+ Rev 1.34 17 Jun 1993 16:43:56 DEBBIE
+Changed backup compressed files without expanding to backup compressed files
+as expanded files.
+
+ Rev 1.33 10 May 1993 15:52:20 MARILYN
+different GRFS & NRL default values for windows
+
+ Rev 1.32 05 May 1993 16:31:10 BRYAN
+Valid range for nrl_dos_vector is now 60-ff.
+
+ Rev 1.31 03 May 1993 15:26:46 Aaron
+Changed #ifdefs on last three items in BE_CFG structures from P_CLIENT to
+OS_NLM (as per declaration in BECONFIG.H).
+
+ Rev 1.30 30 Apr 1993 16:42:46 DOUG
+Moved NRL_SPX_MaxIpxPacketSize out of CLient only #ifdef
+
+ Rev 1.29 19 Apr 1993 16:58:36 DOUG
+Added new NRL/TLI fields
+
+ Rev 1.28 30 Mar 1993 18:07:32 DON
+Changed migrated/compressed stuff!
+
+ Rev 1.27 24 Mar 1993 15:45:50 DEBBIE
+added fields to min & max configs for migrated files and for uncompressing files
+
+ Rev 1.26 22 Mar 1993 16:46:34 JOHNES
+Ifdef'ed out initializations not needed in P_CLIENT.
+
+ Rev 1.25 19 Mar 1993 11:31:54 JOHNES
+Ifdef'ed backup_server_name out of P_CLIENT.
+
+ Rev 1.24 16 Mar 1993 14:26:14 JOHNES
+If def'ed OUT initializations for keep_drive_list (for P_CLIENT only).
+
+ Rev 1.23 11 Mar 1993 20:29:22 BRYAN
+(added needed commas)
+
+ Rev 1.22 11 Mar 1993 11:37:02 ANDY
+Added GRFS and NRL parameters for ENDEAVOUR
+
+ Rev 1.21 01 Mar 1993 17:39:28 MARILYN
+set min and max values for the process checksum streams option
+
+ Rev 1.20 09 Feb 1993 10:00:54 DOUG
+Added Client supervisor mode flag
+
+ Rev 1.19 07 Feb 1993 11:50:18 DON
+Removed references to copy/move
+
+ Rev 1.18 11 Jan 1993 16:59:52 DON
+Made the minimum value for string_type BEC_ANSI_STR
+
+ Rev 1.17 08 Dec 1992 14:24:10 DON
+Integrated Move/Copy into tips
+
+ Rev 1.16 08 Dec 1992 11:45:34 DOUG
+Added new GRFS and NRL parameters
+
+ Rev 1.15 14 Oct 1992 16:33:24 STEVEN
+fix typos
+
+ Rev 1.14 13 Oct 1992 12:34:14 STEVEN
+added otc level
+
+ Rev 1.13 04 May 1992 12:25:42 STEVEN
+NT_STUFF added string types
+
+ Rev 1.12 02 Feb 1992 15:52:32 GREGG
+Removed utf_supported boolean from config, and added UINT16 initial_buff_alloc.
+
+ Rev 1.11 27 Jan 1992 18:14:32 GREGG
+Changes for new config element: utf_supported.
+
+ Rev 1.10 13 Jan 1992 18:36:28 STEVEN
+added config switch for BSD sort
+
+ Rev 1.9 19 Nov 1991 13:10:06 STEVEN
+allow a value of 2 for skip_open_files
+
+ Rev 1.8 14 Nov 1991 10:19:06 BARRY
+TRICYCLE: Added restore_security.
+
+ Rev 1.7 06 Nov 1991 18:52:54 GREGG
+BIGWHEEL - 8200sx - Added catalog_level to BE config.
+
+ Rev 1.6 24 Oct 1991 11:19:32 BARRY
+Free memory after dequeue.
+
+ Rev 1.5 16 Oct 1991 14:12:24 STEVEN
+need to allow for 2 in exist flag
+
+ Rev 1.4 19 Sep 1991 13:03:46 STEVEN
+added Machine type to config
+
+ Rev 1.3 12 Aug 1991 15:57:34 BARRY
+DisplayNetwareServers no longer in config.
+
+ Rev 1.2 01 Jul 1991 17:34:56 STEVEN
+added min and max
+
+ Rev 1.1 19 Jun 1991 17:27:52 BARRY
+Forgot to include (of all things) stdlib.h.
+
+ Rev 1.0 19 Jun 1991 10:38:06 BARRY
+Initial revision.
+
+**/
+
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+
+#include "beconfig.h"
+#include "bec_prv.h"
+
+/* Global queue of active configuration elements */
+
+Q_HEADER uw_config_queue ;
+BE_CFG uw_min_cfg = {
+ 0, /* special_word */
+ 2, /* max_buffers */
+ 0, /* reserve_mem */
+ 2, /* tfl_buff_size */
+ 512, /* max_buffer_size */
+ 0, /* skip_open_files */
+ 0, /* backup_files_inuse */
+ 0, /* support_afp_server */
+ 0, /* extended_date_support */
+ 0, /* hidden_flg */
+ 0, /* special_flg */
+ 0, /* set_archive_flg */
+ 0, /* modified_only_flg */
+ 0, /* proc_empty_flg */
+ 0, /* exist_flg */
+ 0, /* prompt_flg */
+ NULL, /* part_list */
+#if !defined(P_CLIENT)
+ {0}, /* keep_drive_list*/
+#endif /* !P_CLIENT */
+ 0, /* net_num */
+ 0, /* remote_drive_backup */
+ 0, /* use_ffr */
+ 0, /* write_format */
+ 0x60, /* nrl_dos_vector */
+ 0, /* lock */
+ 0, /* machine type */
+ 0, /* catalog level */
+ FALSE, /* Restore security info */
+ FALSE, /* bsd sort */
+ 0, /* initial_buff_alloc */
+ BEC_ANSI_STR, /* string types ASCII */
+ 0, /* otc catalog level */
+ 0x10, /* 16 max remote resources */
+#if !defined(P_CLIENT)
+ {0}, /* backup_server_name */
+#endif /* !P_CLIENT */
+ 0, /* NRL type: 0=SPX, 1=NetBIOS */
+ 0, /* GRFS timeout seconds: 0=wait forever */
+ 0x240, /* NRL max allowable packet size */
+#if !defined(P_CLIENT)
+ 200, /* NRL callback stack size */
+ 1, /* NRL cumulative local resources */
+ 1, /* NRL maximum allowed connections */
+#endif /* !P_CLIENT */
+ {0}, /* NRL string of backup servers space delimited */
+#if !defined(P_CLIENT)
+ 1, /* NRL number of listen ecbs per session */
+ 0, /* NRL spx number of times to retry a packet */
+ 0, /* NRL NetBios number of times to retry a packet */
+#endif /* !P_CLIENT */
+ 0, /* NRL adapter number for LAN */
+ {0}, /* NRL name of LAN device */
+#if !defined(P_CLIENT)
+ 1, /* GRFS maximum number of agents allowed */
+#endif /* !P_CLIENT */
+ FALSE, /* Client supervisor mode */
+ FALSE, /* Process checksum streams */
+#if !defined(P_CLIENT)
+ FALSE, /* Backup migrated files */
+ FALSE, /* Backup compressed files as expanded files */
+#endif /* !P_CLIENT */
+#if defined(OS_NLM)
+ 0, /* NRL Protocols supported (None) */
+ 5, /* TCP Resource cleaner interval (seconds) */
+ 0, /* TCP port for resource listener thread */
+#endif /* OS_NLM */
+ FALSE, /* Process special files */
+SYPL_ECC_OFF, /* Process Sytron ECC */
+ FALSE, /* ems public private */
+ FALSE, /* EMS kick restore */
+ FALSE /* ems clean restore */
+ } ;
+
+BE_CFG uw_max_cfg = {
+ 0xffff, /* special_word */
+ 16, /* max_buffers */
+ 0x3000, /* reserve_mem */
+ 32, /* tfl_buff_size */
+#if defined( OS_DOS ) && !defined( OS_WIN )
+ 4096, /* max_buffer_size */
+#else
+ 32768, /* max_buffer_size */
+#endif
+ 2, /* skip_open_files */
+ 1, /* backup_files_inuse */
+ 1, /* support_afp_server */
+ 1, /* extended_date_support */
+ 1, /* hidden_flg */
+ 1, /* special_flg */
+ 1, /* set_archive_flg */
+ 1, /* modified_only_flg */
+ 1, /* proc_empty_flg */
+ 2, /* exist_flg */
+ 1, /* prompt_flg */
+ NULL, /* part_list */
+#if !defined(P_CLIENT)
+ {0}, /* keep_drive_list*/
+#endif /* !P_CLIENT */
+ 4, /* net_num */
+ 1, /* remote_drive_backup */
+ 1, /* use_ffr */
+ 1, /* write_format */
+ 0xff, /* nrl_dos_vector */
+ 1, /* lock */
+ 0xffff, /* machine type */
+ 2, /* catalog level */
+ TRUE, /* Restore security info */
+ TRUE, /* bsd sort */
+ 32, /* initial_buff_alloc */
+ 0xffff, /* string types ASCII */
+ 2, /* otc catalog level */
+#ifdef OS_NLM
+ 0xfa, /* 250 max remote resources */
+#else
+#if defined( OS_WIN )
+ 0xffff, /* max remote resources */
+#else
+ 0x40, /* max remote resources */
+#endif
+#endif
+#if !defined(P_CLIENT)
+ {0}, /* backup_server_name */
+#endif /* !P_CLIENT */
+ 1, /* NRL type: 0=SPX, 1=NetBios */
+ 32768, /* GRFS timeout seconds: == 9.1 days */
+ 0x5B4, /* NRL max allowable packet size */
+#if !defined(P_CLIENT)
+ 0x3fff, /* NRL callback stack size */
+ 8, /* NRL cumulative local resources */
+ 0x10, /* NRL maximum allowed connections */
+#endif /* !P_CLIENT */
+ {0}, /* NRL string of backup servers space delimited */
+#if !defined(P_CLIENT)
+ 0xff, /* NRL number of listen ecbs per session */
+ 0xff, /* NRL spx number of times to retry a packet */
+ 255, /* NRL NetBios number of times to retry a packet */
+#endif /* !P_CLIENT */
+ 15, /* NRL adapter number for LAN */
+ {0}, /* NRL name of LAN device */
+#if !defined(P_CLIENT)
+ 4, /* GRFS maximum number of agents allowed */
+#endif /* !P_CLIENT */
+ TRUE, /* Client supervisor mode */
+ TRUE, /* Process checksum streams */
+#if !defined(P_CLIENT)
+ TRUE, /* Backup migrated files */
+ TRUE, /* Backup compressed files as expanded files */
+#endif /* !P_CLIENT */
+#if defined(OS_NLM)
+ 7, /* NRL Protocols supported (SPX,TCP,ADSP) */
+ 60, /* TCP Resource cleaner interval (seconds) */
+ 0xffff, /* TCP port for resource listener thread */
+#endif /* OS_NLM */
+ TRUE, /* Process special files */
+SYPL_ECC_AUTO, /* Process Sytron ECC */
+BEC_EMS_BOTH, /* ems PUBLIC private */
+ TRUE, /* ems Kick restore */
+ TRUE /* clean restore */
+ } ;
+
+/**/
+
+/**
+
+ Name: BEC_Init
+
+ Description: Initialize the Backup Engine configuration unit.
+
+ Modified: 14-Jun-91
+
+ Returns: Nothing
+
+**/
+VOID BEC_Init( VOID )
+{
+ InitQueue( &uw_config_queue ) ;
+}
+
+
+
+/**
+
+ Name: BEC_Close
+
+ Description: Close the configuration unit by freeing the queue.
+
+ Modified: 14-Jun-91
+
+ Returns: Nothing
+
+**/
+VOID BEC_Close( VOID )
+{
+ Q_ELEM_PTR qelem ;
+
+ while ( (qelem = QueueHead(&uw_config_queue)) != NULL ) {
+ RemoveQueueElem( &uw_config_queue, qelem ) ;
+ free( GetQueueElemPtr( qelem ) ) ;
+ }
+}
+
+
diff --git a/private/utils/ntbackup/src/bec_mem.c b/private/utils/ntbackup/src/bec_mem.c
new file mode 100644
index 000000000..0b4730002
--- /dev/null
+++ b/private/utils/ntbackup/src/bec_mem.c
@@ -0,0 +1,514 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: becmem.c
+
+ Date Updated: 17-Jun-91
+
+ Description: Code to clone/free Backup Engine config structures.
+
+ $Log: M:/LOGFILES/BEC_MEM.C_V $
+
+ Rev 1.34 09 Jul 1993 14:38:56 ChuckS
+Made CompareConfigPtrs non-static BEC_CompareConfigPtrs, because it is
+passed as a function pointer to function SearchQueue in another module.
+Aside from being a semi-sleazoid programming practice, handing other
+modules function pointers to static functions is hazardous for the
+health of overlaid DOS programs.
+
+ Rev 1.33 30 Jun 1993 15:25:28 BARRY
+Add process_special_files
+
+ Rev 1.32 10 Jun 1993 07:46:38 MIKEP
+enable c++
+
+ Rev 1.31 19 May 1993 09:25:44 DON
+Fixed Nested Comment for NRL default packet size
+
+ Rev 1.30 14 May 1993 15:42:58 MARILYN
+NRL_spx_max_ipx_packet_size not initialized. Corrected grfs values for windows
+
+ Rev 1.29 20 Apr 1993 09:46:36 ChuckS
+Dougie added several fields to the BE_CFG, and ifdefed the definitions
+in "#if defined(OS_NLM)..." It would probably be a good idea to ifdef
+references to the fields as well. Just a thought....
+
+ Rev 1.28 19 Apr 1993 16:58:38 DOUG
+Added new NRL/TLI fields
+
+ Rev 1.27 19 Mar 1993 11:32:44 JOHNES
+Ifdef'ed backup_server_name out of P_CLIENT.
+
+ Rev 1.26 16 Mar 1993 14:53:56 JOHNES
+Ifdef'ed OUT set default for keep_drive_list for P_CLIENT.
+
+ Rev 1.25 01 Mar 1993 17:38:56 MARILYN
+set process checksum streams option off by default
+
+ Rev 1.24 09 Feb 1993 10:24:56 DOUG
+Changed supervisor_mode to TRUE by default.
+
+ Rev 1.23 09 Feb 1993 10:00:54 DOUG
+Added Client supervisor mode flag
+
+ Rev 1.22 05 Feb 1993 22:23:10 MARILYN
+removed copy/move functionality
+
+ Rev 1.21 08 Dec 1992 14:24:12 DON
+Integrated Move/Copy into tips
+
+ Rev 1.20 08 Dec 1992 11:45:36 DOUG
+Added new GRFS and NRL parameters
+
+ Rev 1.19 02 Nov 1992 17:15:06 STEVEN
+added init of string type
+
+ Rev 1.18 13 Oct 1992 12:34:22 STEVEN
+added otc level
+
+ Rev 1.17 14 May 1992 12:46:04 TIMN
+Changed compareConfigPtr CHAR's to INT8
+
+ Rev 1.16 13 May 1992 12:46:58 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.15 04 May 1992 12:32:42 STEVEN
+NT_STUFF added string types
+
+ Rev 1.14 02 Feb 1992 15:52:54 GREGG
+Removed utf_supported boolean from config, and added UINT16 initial_buff_alloc.
+
+ Rev 1.13 27 Jan 1992 18:14:58 GREGG
+Changes for new config element: utf_supported.
+
+ Rev 1.12 13 Jan 1992 18:36:30 STEVEN
+added config switch for BSD sort
+
+ Rev 1.11 14 Nov 1991 10:19:16 BARRY
+TRICYCLE: Added restore_security.
+
+ Rev 1.10 06 Nov 1991 18:53:24 GREGG
+BIGWHEEL - 8200sx - Added catalog_level to BE config.
+
+ Rev 1.9 24 Oct 1991 11:20:08 BARRY
+CloneConfig() was cloning xlock flag as well--not good.
+
+ Rev 1.8 18 Oct 1991 14:23:32 BARRY
+Wasn't freeing all memory.
+
+ Rev 1.7 10 Sep 1991 18:19:16 DON
+got rid of pointer type mismatches
+
+ Rev 1.6 12 Aug 1991 15:54:16 BARRY
+DisplayNetwareServers() doesn't belong any more.
+
+ Rev 1.5 23 Jul 1991 18:09:20 BARRY
+Made the "reasonable" config defaults a little more reasonable.
+
+ Rev 1.4 23 Jul 1991 16:22:16 BARRY
+Added BEC_UpdateConfig functions.
+
+ Rev 1.3 01 Jul 1991 19:20:50 BARRY
+Initialize ret_val.
+
+ Rev 1.2 01 Jul 1991 19:03:56 BARRY
+Added code for exclusive lock on config structures.
+
+ Rev 1.1 30 Jun 1991 14:47:24 BARRY
+Got rid of default drive stuff.
+
+ Rev 1.0 19 Jun 1991 10:38:08 BARRY
+Initial revision.
+
+**/
+
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+#include "msassert.h"
+
+#include "beconfig.h"
+#include "bec_prv.h"
+
+
+extern Q_HEADER uw_config_queue ;
+
+BOOLEAN BEC_CompareConfigPtrs( INT8_PTR p1, INT8_PTR p2 ) ;
+
+/* Prototypes for static functions */
+static INT16 ClonePartList( PART_ENTRY *src, PART_ENTRY **dst ) ;
+static VOID FreeConfigStructure( BE_CFG_PTR cfg ) ;
+static VOID FreePartList( PART_ENTRY *p ) ;
+static VOID SetConfigDefaults( BE_CFG_PTR cfg ) ;
+
+/**/
+
+/**
+
+ Name: BEC_UseConfig
+
+ Description: Increments counting semaphore for the config.
+
+ Note: If the config structure is not already in the queue,
+ it is enqueued here.
+
+ Modified: 14-Jun-91
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+
+**/
+INT16 BEC_UseConfig( BE_CFG_PTR cfg )
+{
+ BE_CFG_QITEM_PTR item ;
+ Q_ELEM_PTR qelem ;
+ INT16 ret_val = SUCCESS ;
+
+ msassert( cfg != NULL ) ;
+
+ qelem = SearchQueue( &uw_config_queue, BEC_CompareConfigPtrs, (INT8_PTR)cfg, FALSE ) ;
+
+ if ( qelem != NULL ) {
+
+ item = (BE_CFG_QITEM_PTR)qelem->q_ptr ;
+ item->use_count++;
+
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ if ( (item = (BE_CFG_QITEM_PTR)malloc(sizeof(Q_ELEM) + sizeof(BE_CFG_QITEM))) != NULL ) {
+ qelem = (Q_ELEM_PTR)(item + 1);
+ item->cfg = cfg ;
+ item->use_count = 1 ;
+ InitQElem( qelem ) ;
+ SetQueueElemPtr( qelem, item ) ;
+ EnQueueElem( &uw_config_queue, qelem, FALSE );
+ ret_val = SUCCESS ;
+ }
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+
+/**
+
+ Name: BEC_ReleaseConfig
+
+ Description: Decrements counting semaphore for the config. If
+ the count falls to zero, the config structure is
+ removed from the queue and freed.
+ If the config is not in the queue, it is freed
+ anyway.
+
+ Modified: 17-Jun-91
+
+ Returns: SUCCESS
+ BEC_NOT_IN_QUEUE
+
+**/
+INT16 BEC_ReleaseConfig( BE_CFG_PTR cfg )
+{
+ BE_CFG_QITEM_PTR item ;
+ Q_ELEM_PTR qelem ;
+ INT16 ret_val = SUCCESS ;
+
+ msassert( cfg != NULL ) ;
+
+ qelem = SearchQueue( &uw_config_queue, BEC_CompareConfigPtrs, (INT8_PTR)cfg, FALSE ) ;
+
+ if ( qelem != NULL ) {
+
+ item = (BE_CFG_QITEM_PTR)GetQueueElemPtr( qelem );
+ msassert( item != NULL );
+
+ item->use_count--;
+
+ if ( (cfg->xlock == FALSE) && (item->use_count <= 0) ) {
+ RemoveQueueElem( &uw_config_queue, qelem ) ;
+ FreeConfigStructure( cfg );
+ free( item ) ;
+ }
+
+ } else {
+
+ ret_val = (INT16)BEC_NOT_IN_QUEUE ;
+
+ if ( cfg->xlock == FALSE ) {
+ FreeConfigStructure( cfg );
+ }
+ }
+
+ return( ret_val ) ;
+
+}
+
+/**/
+
+/**
+
+ Name: BEC_CloneConfig
+
+ Description: Creates an new config structure and copies all
+ of the values from the source config to it.
+ The copy is not enqueued here: it will only get
+ enqueued if it is "used."
+
+ Modified: 14-Jun-91
+
+ Returns: Pointer to new config, or
+ NULL if any of the allocations fail.
+
+**/
+BE_CFG_PTR BEC_CloneConfig( BE_CFG_PTR cfg )
+{
+ BE_CFG_PTR new_cfg ;
+ INT16 status ;
+
+ if ( (new_cfg = (BE_CFG_PTR)malloc(sizeof(BE_CFG))) != NULL ) {
+
+ if ( cfg == NULL ) {
+
+ SetConfigDefaults( new_cfg ) ;
+
+ } else {
+
+ *new_cfg = *cfg ;
+ new_cfg->part_list = NULL ;
+ new_cfg->xlock = FALSE ;
+
+ status = ClonePartList( cfg->part_list, &new_cfg->part_list ) ;
+
+ if ( status != SUCCESS ) {
+ FreeConfigStructure( new_cfg ) ;
+ new_cfg = NULL ;
+ }
+ }
+ }
+ return( new_cfg );
+}
+
+
+/**
+
+ Name: BEC_UpdateConfig()
+
+ Description: Copies one config's values to another.
+
+ Modified: 23-Jul-91
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+
+ Notes: Mainly for use by the BSD's RefreshConfig function.
+
+**/
+INT16 BEC_UpdateConfig( BE_CFG_PTR dst, BE_CFG_PTR src )
+{
+ *dst = *src ;
+
+ return( ClonePartList( src->part_list, &dst->part_list ) );
+
+}
+
+
+/**
+
+ Name: ClonePartList
+
+ Description: Makes a copy of a partition list
+
+ Modified: 14-Jun-91
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+
+**/
+static INT16 ClonePartList( PART_ENTRY *src, PART_ENTRY **dst )
+{
+ PART_ENTRY *new_head = NULL ; /* head of new list */
+ PART_ENTRY *cur_part = NULL ; /* walks down new list */
+ PART_ENTRY *tmp_part ;
+ INT16 ret_val = SUCCESS ;
+
+ while ( (src != NULL) && (ret_val == SUCCESS) ) {
+ if ( (tmp_part = (PART_ENTRY *)malloc(sizeof(PART_ENTRY))) != NULL ) {
+ *tmp_part = *src;
+ tmp_part->next = NULL ;
+
+ if ( new_head == NULL ) {
+ new_head = tmp_part ;
+ } else {
+ cur_part->next = tmp_part ;
+ }
+ cur_part = tmp_part ;
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+ src = src->next ;
+ }
+
+ *dst = new_head ;
+ return( ret_val );
+}
+
+
+/**
+
+ Name: FreeConfigStructure
+
+ Description: Frees a config structure after freeing its elements
+
+ Modified: 14-Jun-91
+
+ Returns: Nothing
+
+**/
+static VOID FreeConfigStructure( BE_CFG_PTR cfg )
+{
+ if ( cfg != NULL ) {
+ FreePartList( cfg->part_list ) ;
+ free( cfg );
+ }
+}
+
+
+/**
+
+ Name: FreePartList
+
+ Description: Frees a partition list
+
+ Modified: 14-Jun-91
+
+ Returns: Nothing
+
+**/
+static VOID FreePartList( PART_ENTRY *p )
+{
+ PART_ENTRY *tmp ;
+
+ while ( p != NULL ) {
+ tmp = p ;
+ p = p->next ;
+ free( tmp ) ;
+ }
+}
+
+
+/**
+
+ Name: CompareConfigPointers
+
+ Description: Called by QueueSearch to find a particular config
+ in the config queue.
+
+ Modified: 14-Jun-91
+
+ Returns: TRUE if pointers match
+
+**/
+BOOLEAN BEC_CompareConfigPtrs( INT8_PTR p1, INT8_PTR p2 )
+{
+ BE_CFG_QITEM_PTR qcfg ;
+
+ qcfg = (BE_CFG_QITEM_PTR)GetQueueElemPtr((Q_ELEM_PTR)p1) ;
+
+ return( (INT8_PTR)(qcfg->cfg) == p2 ) ;
+}
+
+
+/**
+
+ Name: SetConfigDefaults
+
+ Description: Initializes a config structure with reasonable
+ default values. Probably shouldn't be used much
+ since the UI should initialize a config.
+
+ Modified: 18-Jun-91
+
+ Returns: Nothing
+
+**/
+static VOID SetConfigDefaults( BE_CFG_PTR cfg )
+{
+ msassert( cfg != NULL );
+
+ cfg->special_word = 0 ; /* special flags */
+ cfg->max_buffers = 3 ; /* max # of TF buffers */
+ cfg->reserve_mem = 0 ; /* after getting TF buffs */
+ cfg->tfl_buff_size = 9216 ; /* size of TF buffers */
+#ifdef OS_NLM
+ cfg->max_buffer_size = 32768 ; /* NLMs default SMB max buffer size */
+#else
+#if defined( OS_WIN )
+ cfg->max_buffer_size = 4096 ; /* Window's def. SMB max buff size */
+#else
+ cfg->max_buffer_size = 512 ; /* SMB max buffer size */
+#endif
+#endif
+ cfg->skip_open_files = FALSE ; /* if true, skip; false, wait */
+ cfg->backup_files_inuse = TRUE ; /* ignore sharing problems? */
+ cfg->support_afp_server = TRUE ; /* backup Mac resource info? */
+ cfg->extended_date_support = TRUE ; /* reset last access dates? */
+ cfg->hidden_flg = TRUE ; /* don't process hidden files */
+ cfg->special_flg = FALSE ; /* don't process special files*/
+ cfg->set_archive_flg = TRUE ; /* clear the modified bit? */
+ cfg->proc_empty_flg = TRUE ; /* process empty subdirs */
+ cfg->exist_flg = TRUE ; /* replace existing files */
+ cfg->prompt_flg = FALSE ; /* prompt before replace files*/
+ cfg->part_list = NULL ; /* partition list */
+ cfg->net_num = 0 ; /* network type */
+#if !defined(P_CLIENT)
+ cfg->keep_drive_list[0] = TEXT('\0') ; /* drives to keep */
+#endif /* !P_CLIENT */
+ cfg->remote_drive_backup = FALSE ; /* backup remote WS drives? */
+ cfg->use_ffr = TRUE ; /* use FFR for restore/verify?*/
+ cfg->write_format = 0 ; /* format which TF is to write*/
+ cfg->nrl_dos_vector = 0x60 ;
+ cfg->xlock = FALSE ; /* Config locked--don't free */
+ cfg->catalog_level = 0 ; /* NONE */
+ cfg->restore_security = TRUE ; /* Restore security info */
+ cfg->sort_bsd_by_dle = TRUE ; /* sort bsds by DLE as default*/
+ cfg->initial_buff_alloc = 32 ; /* mem allocated for tape buffers at init */
+#ifdef UNICODE
+ cfg->string_types = 0 ; /* work with ASCII by default */
+ cfg->string_types = BEC_UNIC_STR ; /* work with ASCII by default */
+#else
+ cfg->string_types = BEC_ANSI_STR ; /* work with ASCII by default */
+#endif
+ cfg->otc_cat_level = 0 ; /* on tape catalog default level */
+#ifdef OS_NLM
+ cfg->max_remote_resources = 0x64 ; /* max remote resources */
+#else
+#if defined( OS_WIN )
+ cfg->max_remote_resources = 0x20 ;
+#else
+ cfg->max_remote_resources = 0x10 ; /* max remote resources */
+#endif
+#endif
+#if !defined(P_CLIENT)
+ cfg->backup_server_name[0] ='\0'; /* no name by default */
+#endif /* !P_CLIENT */
+ cfg->NRL_transport_type = 0 ; /* default to NRL SPX */
+ cfg->GRFS_timeout_seconds = 30 ; /* default 30 seconds */
+ cfg->NRL_spx_max_ipx_packet = 0x240 ; /* default packet size */
+ cfg->supervisor_mode = TRUE ; /* in supervisor mode */
+ cfg->process_checksum_streams = FALSE ; /* don't process checksum strms */
+
+#ifdef OS_NLM
+ cfg->NRL_protocols = NRL_PROT_SPX ; /* SPX protocol by default */
+ cfg->TCP_cleanup_interval = 30 ; /* tcp resource cleaner interval (secs) */
+ cfg->TCP_listen_port = 6101 ; /* tcp resource listener port */
+#endif
+ cfg->process_special_files = FALSE ; /* don't process special files */
+ cfg->ems_pub_pri = BEC_EMS_BOTH ;
+ cfg->ems_rip_kick = FALSE ;
+ cfg->ems_wipe_clean = FALSE ;
+}
+
+
diff --git a/private/utils/ntbackup/src/bec_misc.c b/private/utils/ntbackup/src/bec_misc.c
new file mode 100644
index 000000000..4fc3eff75
--- /dev/null
+++ b/private/utils/ntbackup/src/bec_misc.c
@@ -0,0 +1,320 @@
+
+
+
+
+
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bec_misc.c
+
+ Date Updated: 18-Jun-91
+
+ Description: Miscellaneous functions for the Backup Engine
+ configuration unit.
+
+ $Log: N:/LOGFILES/BEC_MISC.C_V $
+
+ Rev 1.9 10 Jun 1993 07:47:44 MIKEP
+enable c++
+
+ Rev 1.8 06 Oct 1992 13:25:04 DAVEV
+Unicode strlen verification
+
+ Rev 1.7 20 May 1992 15:02:34 TIMN
+Fixed syntax error.
+
+ Rev 1.6 19 May 1992 12:33:14 TIMN
+Changed str's to mem calls
+Changed part_name type
+Introduced part_name_size
+
+ Rev 1.5 13 May 1992 12:47:26 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.4 13 Aug 1991 10:15:42 DON
+added include CTYPE.H to prototype TOUPPER
+
+ Rev 1.3 30 Jun 1991 12:36:00 BARRY
+Added parition routines, clean up removal of default drive stuff.
+
+ Rev 1.2 28 Jun 1991 16:52:06 BARRY
+Added BEC_AddKeepDrive().
+
+ Rev 1.1 26 Jun 1991 10:59:44 BARRY
+Made KeepDrive case-insensitive.
+
+ Rev 1.0 19 Jun 1991 10:38:10 BARRY
+Initial revision.
+
+**/
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "msassert.h"
+#include "beconfig.h"
+#include "bec_prv.h"
+
+/**/
+
+/**
+
+ Name: BEC_GetPartitionName()
+
+ Description: Get name of a specific partition from a given drive
+
+ Modified: 18-Jun-91
+
+ Returns: Pointer to partition name
+
+**/
+INT8_PTR BEC_GetPartitionName( BE_CFG_PTR cfg, INT16 drv_num, INT16 part_num )
+{
+ PART_ENTRY *part_entry ;
+
+ msassert( cfg != NULL ) ;
+
+ part_entry = BEC_GetPartList( cfg );
+
+ while ( part_entry != NULL ) {
+ if ( part_entry->drv_num == drv_num && part_entry->partition_num == part_num ) {
+ break;
+ }
+ part_entry = part_entry->next ;
+ }
+
+ if ( part_entry == NULL ) {
+ return( NULL ) ;
+ } else {
+ return( part_entry->partition_name ) ;
+ }
+}
+
+/**/
+
+/**
+
+ Name: BEC_GetFirstPartition
+
+ Description: Returns the first partition from the config's partition
+ list
+
+ Modified: 30-Jun-91
+
+ Returns: Pointer to partition -or- NULL
+
+**/
+PART_ENTRY *BEC_GetFirstPartition( BE_CFG_PTR cfg )
+{
+ msassert( cfg != NULL ) ;
+
+ return( cfg->part_list ) ;
+}
+
+/**
+
+ Name: BEC_GetNextPartition
+
+ Description: Returns the first partition from the config's partition
+ list.
+
+ Modified: 30-Jun-91
+
+ Returns: Pointer to partition -or- NULL
+
+**/
+PART_ENTRY *BEC_GetNextPartition( BE_CFG_PTR cfg, PART_ENTRY *curr_part )
+{
+ (VOID) cfg ;
+
+ msassert( cfg != NULL ) ;
+ msassert( curr_part != NULL ) ;
+
+ return( curr_part->next ) ;
+}
+
+
+/**
+
+ Name: BEC_AddPartition
+
+ Description: Adds a partition the the config's partition list.
+
+ Modified: 30-Jun-91
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+**/
+INT16 BEC_AddPartition( BE_CFG_PTR cfg, INT16 drv_num, INT16 part_num, INT8_PTR name, INT16 name_size )
+{
+ INT16 ret_val = OUT_OF_MEMORY ;
+ PART_ENTRY *p ;
+ PART_ENTRY *new_part ;
+
+ msassert( cfg != NULL ) ;
+ msassert( ( name_size > 0 ) && ( name_size < 13 * sizeof (CHAR) ) ) ;
+
+ p = cfg->part_list ;
+
+ if ( p != NULL ) {
+ while ( p->next != NULL ) {
+ p = p->next ;
+ }
+ }
+
+ if ( (new_part = (PART_ENTRY *)malloc(sizeof(PART_ENTRY))) != NULL ) {
+ new_part->next = NULL ;
+ new_part->drv_num = drv_num ;
+ new_part->partition_num = part_num ;
+ new_part->partition_name_size = name_size ;
+ memcpy( new_part->partition_name, name, name_size ) ;
+ if ( p != NULL ) {
+ p->next = new_part ;
+ }
+ ret_val = SUCCESS ;
+ }
+ return( ret_val ) ;
+}
+
+
+/**
+
+ Name: BEC_SetPartitionName()
+
+ Description: Return name of a specific partition from a given drive
+
+ Modified: 18-Jun-91
+
+ Returns: SUCCESS
+ FAILURE
+ OUT_OF_MEMORY
+
+**/
+INT16 BEC_SetPartitionName(
+ BE_CFG_PTR cfg, /* configuration to use */
+ INT16 drv_num, /* desired source drive */
+ INT16 part_num, /* partition table entry to use */
+ INT8_PTR part_name, /* place to put name */
+ INT16 part_name_size ) /* length of part_name */
+{
+ INT16 ret_val = FAILURE ;
+ PART_ENTRY *new_part ;
+ PART_ENTRY *last_part = NULL ;
+ PART_ENTRY *next_part ;
+
+ msassert( cfg != NULL ) ;
+ msassert( ( part_name_size > 0 ) && ( part_name_size < 13 * sizeof (CHAR) ) ) ;
+
+ next_part = BEC_GetPartList( cfg );
+
+ while( ( next_part != NULL ) && ( ret_val == FAILURE ) ) {
+ if( ( next_part->drv_num == drv_num ) && ( next_part->partition_num == part_num ) ) {
+ memcpy( next_part->partition_name, part_name, part_name_size ) ;
+ next_part->partition_name_size = part_name_size ;
+ ret_val = SUCCESS ;
+ }
+ last_part = next_part ;
+ next_part = next_part->next ;
+ }
+
+ if ( ret_val != SUCCESS ) {
+
+ new_part = (PART_ENTRY *)malloc( sizeof( PART_ENTRY ) ) ;
+
+ if ( new_part != NULL ) {
+
+ memcpy( new_part->partition_name, part_name, part_name_size ) ;
+ next_part->partition_name_size = part_name_size ;
+
+ new_part->drv_num = drv_num ;
+ new_part->partition_num = part_num ;
+
+ new_part->next = cfg->part_list ;
+ cfg->part_list = new_part ;
+
+ ret_val = SUCCESS ;
+
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+
+/**
+
+ Name: BEC_KeepDrive()
+
+ Description: Examines the configuration's "keep drive list" (that
+ is not normally part of the configuration file) to
+ determine if the user has blocked out the display
+ of a certain drive.
+
+ Modified: 18-Jun-91
+
+ Returns: TRUE if drive should be in DLE list (or "kept")
+
+**/
+BOOLEAN BEC_KeepDrive( BE_CFG_PTR cfg, CHAR drv_letter )
+{
+ BOOLEAN result ;
+ CHAR_PTR p ;
+
+ msassert( cfg != NULL ) ;
+
+ if ( (cfg->keep_drive_list != NULL) && (*(cfg->keep_drive_list) != TEXT('\0') ) ) {
+
+ result = FALSE ;
+ drv_letter = (CHAR)toupper( drv_letter ) ;
+ p = cfg->keep_drive_list ;
+ while ( *p ) {
+ if ( toupper( *p ) == drv_letter ) {
+ result = TRUE ;
+ break ;
+ }
+ p++ ;
+ }
+ } else {
+ result = TRUE ;
+ }
+
+ return( result ) ;
+}
+
+/**/
+
+/**
+
+ Name: BEC_AddKeepDrive()
+
+ Description: Adds a drive to the keep drive list.
+
+ Modified: 27-Jun-91
+
+ Returns: SUCCESS
+ FAILURE
+
+**/
+BOOLEAN BEC_AddKeepDrive( BE_CFG_PTR cfg, CHAR_PTR drive )
+{
+ BOOLEAN result = FAILURE ;
+
+ msassert( cfg != NULL ) ;
+ msassert( strlen( drive ) <= sizeof (CHAR) ) ;
+
+ if ( strlen( cfg->keep_drive_list ) < 25*sizeof (CHAR) ) {
+ strcat( cfg->keep_drive_list, drive ) ;
+ result = SUCCESS ;
+ }
+ return( result ) ;
+}
+
+
diff --git a/private/utils/ntbackup/src/bitmaps.rc b/private/utils/ntbackup/src/bitmaps.rc
new file mode 100644
index 000000000..e7aa332a5
--- /dev/null
+++ b/private/utils/ntbackup/src/bitmaps.rc
@@ -0,0 +1,218 @@
+/******************************************************************************
+Copyright (c) Conner Software Products Group, 1993
+GSH
+
+ Name: wntrpark.rc
+
+ Description: This file contains the references to bitmap resources for
+ the Windows GUI Project Resource File.
+
+ $Log: G:\ui\logfiles\bitmaps.rcv $
+
+ Rev 1.16 12 Jul 1993 09:25:12 GLENN
+ Said goodbye to the diver and shark.
+
+ Rev 1.15 29 Apr 1993 15:49:36 Aaron
+ Changed startup logo for non-Cayman app
+
+ Rev 1.14 02 Apr 1993 14:02:12 GLENN
+ Added info and gray info bitmaps.
+
+ Rev 1.13 18 Feb 1993 12:57:52 chrish
+ Added bitmap logo caymlogo.bmp for CAYMAN.
+
+ Rev 1.12 20 Jan 1993 20:57:16 MIKEP
+ floppy
+
+ Rev 1.11 10 Sep 1992 17:22:06 GLENN
+ Updated to support common disk bitmaps.
+
+ Rev 1.10 09 Sep 1992 17:08:52 GLENN
+ Updated for NEW LOOK BIMINI.
+
+ Rev 1.9 03 Sep 1992 15:57:50 GLENN
+ Updated the NT disk bitmaps.
+
+ Rev 1.8 20 Aug 1992 08:45:26 GLENN
+ Added TAPES and TAPESINDRIVE bitmap stuff.
+
+ Rev 1.7 06 Jul 1992 10:32:18 MIKEP
+ added ram and cdrom bitmaps
+
+ Rev 1.6 10 Jun 1992 16:11:02 GLENN
+ Updated according to NT SPEC.
+
+ Rev 1.5 22 Apr 1992 17:58:46 GLENN
+ Added shark and diver bitmap stuff.
+
+ Rev 1.4 09 Mar 1992 09:19:08 GLENN
+ Added logo bitmap support.
+
+ Rev 1.3 03 Mar 1992 18:03:32 GLENN
+ Changed red checkmark bitmaps to black checkmarks.
+
+ Rev 1.2 16 Dec 1991 17:06:58 GLENN
+ Added exit button stuff.
+
+ Rev 1.1 15 Dec 1991 10:21:48 MIKEP
+ hidden files
+
+ Rev 1.0 20 Nov 1991 19:16:46 SYSTEM
+ Initial revision.
+
+******************************************************************************/
+
+// BITMAPS -- ID's are defined in the Resource Manager header file 'ss_rsm.h'
+
+ IDRBM_BACKUP BITMAP ombackup.bmp // CHS:03-27-92 Backup bitmap.
+ IDRBM_BACKUP_GRAY BITMAP omgbacku.bmp // CHS:03-27-92 Backup bitmap - gray.
+ IDRBM_RESTORE BITMAP omrestor.bmp // CHS:03-27-92 Restore bitmap.
+ IDRBM_RESTORE_GRAY BITMAP omgresto.bmp // CHS:03-27-92 Restore bitmap - gray.
+ IDRBM_ERASE BITMAP omerase.bmp // CHS:03-27-92 Erase bitmap.
+ IDRBM_ERASE_GRAY BITMAP omgerase.bmp // CHS:03-27-92 Erase bitmap - gray.
+ IDRBM_RETENSION BITMAP omtensio.bmp // CHS:03-27-92 Retension bitmap.
+ IDRBM_RETENSION_GRAY BITMAP omgtensi.bmp // CHS:03-27-92 Retension bitmap - gray.
+ IDRBM_EJECT BITMAP omeject.bmp // CHS:03-27-92 Eject ribbon item bitmap.
+ IDRBM_EJECT_GRAY BITMAP omgeject.bmp // CHS:03-27-92 Eject ribbon item bitmap - gray.
+ IDRBM_CATALOG BITMAP omcat.bmp // Catalog ribbon item bitmap.
+ IDRBM_CATALOG_GRAY BITMAP omgcat.bmp // Catalog ribbon item bitmap - gray.
+ IDRBM_CHECK BITMAP omcheck.bmp // CHS:03-27-92 Check ribbon item bitmap.
+ IDRBM_CHECK_GRAY BITMAP omgcheck.bmp // CHS:03-27-92 Check ribbon item bitmap - gray.
+ IDRBM_UNCHECK BITMAP omunchec.bmp // CHS:03-27-92 Uncheck ribbon item bitmap.
+ IDRBM_UNCHECK_GRAY BITMAP omgunche.bmp // CHS:03-27-92 Uncheck ribbon item bitmap - gray.
+ IDRBM_SEL_NONE BITMAP omselnon.bmp // Not selected bitmap.
+ IDRBM_SEL_PART BITMAP omselpar.bmp // Partial selected bitmap.
+ IDRBM_SEL_ALL BITMAP omselall.bmp // All selected bitmap.
+
+ IDRBM_FLOPPYDRIVE BITMAP omfdisk.bmp // Floppy drive bitmap.
+ IDRBM_HARDDRIVE BITMAP omhdisk.bmp // Hard drive bitmap.
+ IDRBM_NETDRIVE BITMAP omndisk.bmp // Network drive bitmap.
+ IDRBM_RAMDRIVE BITMAP omrdisk.bmp // RAM drive bitmap.
+ IDRBM_CDROM BITMAP omcdisk.bmp // CD ROM drive bitmap.
+
+# if !defined ( OEM_MSOFT )
+
+// IDRBM_CHECK BITMAP check3.bmp // Check ribbon item bitmap.
+// IDRBM_CHECK_GRAY BITMAP gcheck.bmp // Check ribbon item bitmap - gray.
+// IDRBM_UNCHECK BITMAP uncheck3.bmp // Uncheck ribbon item bitmap.
+// IDRBM_UNCHECK_GRAY BITMAP guncheck.bmp // Uncheck ribbon item bitmap - gray.
+// IDRBM_SEL_NONE BITMAP sel_none.bmp // Not selected bitmap.
+// IDRBM_SEL_PART BITMAP sel_part.bmp // Partial selected bitmap.
+// IDRBM_SEL_ALL BITMAP sel_all3.bmp // All selected bitmap.
+// IDRBM_FLOPPYDRIVE BITMAP floppy.bmp // Floppy drive bitmap.
+// IDRBM_HARDDRIVE BITMAP hard.bmp // Hard drive bitmap.
+// IDRBM_RAMDRIVE BITMAP ram.bmp // ram drive bitmap.
+// IDRBM_CDROM BITMAP cdrom.bmp // cdrom drive bitmap.
+// IDRBM_NETDRIVE BITMAP netdrv.bmp // Network drive bitmap.
+
+ IDRBM_NETCONNECT BITMAP netcon.bmp
+ IDRBM_NETCONNECT_GRAY BITMAP gnetcon.bmp
+ IDRBM_NETDISCON BITMAP netdcon.bmp
+ IDRBM_NETDISCON_GRAY BITMAP gnetdcon.bmp
+
+ IDRBM_INFO BITMAP info.bmp
+ IDRBM_INFO_GRAY BITMAP ginfo.bmp
+
+ IDRBM_FOLDER_EN BITMAP fol_en.bmp //folder - empty
+ IDRBM_FOLDER_EM BITMAP fol_em.bmp //folder - empty, minus
+ IDRBM_FOLDER_EP BITMAP fol_ep.bmp //folder - empty, plus
+ IDRBM_FOLDER_EON BITMAP fol_eon.bmp //folder - empty, open
+ IDRBM_FOLDER_EOM BITMAP fol_eom.bmp //folder - empty, open, minus
+ IDRBM_FOLDER_EOP BITMAP fol_eop.bmp //folder - empty, open, plus
+ IDRBM_FOLDER_ECN BITMAP fol_ecn.bmp //folder - empty, corrupt
+ IDRBM_FOLDER_ECM BITMAP fol_ecm.bmp //folder - empty, corrupt, minus
+ IDRBM_FOLDER_ECP BITMAP fol_ecp.bmp //folder - empty, corrupt, plus
+ IDRBM_FOLDER_EOCN BITMAP fol_eocn.bmp //folder - empty, open, corrupt
+ IDRBM_FOLDER_EOCM BITMAP fol_eocm.bmp //folder - empty, open, corrupt, minus
+ IDRBM_FOLDER_EOCP BITMAP fol_eocp.bmp //folder - empty, open, corrupt, plus
+
+ IDRBM_TRANSFER BITMAP omtrans.bmp // Transfer bitmap.
+ IDRBM_TRANSFER_GRAY BITMAP omgtrans.bmp // Transfer bitmap - gray.
+ IDRBM_MODIFIED BITMAP mod3.bmp // Modified ribbon item bitmap.
+ IDRBM_MODIFIED_GRAY BITMAP gmod.bmp // Modified ribbon item bitmap - gray.
+ IDRBM_ADVANCED BITMAP adv3.bmp // Advanced ribbon item bitmap.
+ IDRBM_ADVANCED_GRAY BITMAP gadv3.bmp // Advanced ribbon item bitmap - gray.
+ IDRBM_MEMORY BITMAP memory.bmp // Memory trace ribbon item bitmap.
+ IDRBM_LOGFILE BITMAP logfile.bmp // Log File bitmap.
+ IDRBM_UPARROW BITMAP uparrow.bmp // Up arrow bitmap.
+ IDRBM_UPARROW_GRAY BITMAP guparrow.bmp // Up arrow bitmap. - gray
+ IDRBM_DNARROW BITMAP dnarrow.bmp // Down arrow bitmap.
+ IDRBM_DOWNARROW_GRAY BITMAP gdnarrow.bmp // Down arrow bitmap. - gray
+ IDRBM_VERIFY BITMAP verify.bmp // Verify ribbon item bitmap.
+ IDRBM_VERIFY_GRAY BITMAP gverify.bmp // Verify ribbon item bitmap - gray.
+ IDRBM_EXIT BITMAP exit.bmp // Exit ribbon item bitmap.
+ IDRBM_EXIT_GRAY BITMAP gexit.bmp // Exit ribbon item bitmap - gray.
+ IDRBM_SERVER BITMAP server.bmp // Server bitmap.
+ IDRBM_SERVERDETACHED BITMAP serverd.bmp // Detached server bitmap.
+ IDRBM_SEARCH BITMAP search.bmp // Search ribbon item bitmap.
+ IDRBM_SEARCH_GRAY BITMAP gsearch.bmp // Search ribbon item bitmap - gray.
+ IDRBM_NEXTSET BITMAP nextset.bmp // Next Set ribbon item bitmap.
+ IDRBM_NEXTSET_GRAY BITMAP gnextset.bmp // Next Set ribbon item bitmap - gray.
+ IDRBM_REWIND BITMAP rewind.bmp // REWIND ribbon item bitmap.
+ IDRBM_REWIND_GRAY BITMAP grewind.bmp // REWIND ribbon item bitmap - gray.
+ IDRBM_RT_ARROW BITMAP rt_arrow.bmp // Destination arrow for job status box.
+
+ IDRBM_SEL_ALL_RED BITMAP sel_all2.bmp // Red select all
+ IDRBM_CHECK_RED BITMAP check2.bmp // Red check button
+ IDRBM_UNCHECK_RED BITMAP uncheck2.bmp // Red uncheck button
+ IDRBM_ADVANCED_RED BITMAP adv2.bmp // Red advanced button
+
+ // Define appropriate logo bitmap
+ #ifdef CAYMAN
+ IDRBM_LOGO BITMAP caymlogo.bmp
+ #else
+ IDRBM_LOGO BITMAP start.bmp
+ #endif
+
+# else // defined ( OEM_MSOFT )
+ IDRBM_EMS_SERVER BITMAP om_servs.bmp // Server bitmap.
+ IDRBM_EMS_ENTERPRISE BITMAP om_entrs.bmp // Exchange Enterprise bitmap
+ IDRBM_EMS_SITE BITMAP om_sites.bmp // Exchange site bitmap
+ IDRBM_EMS_MDB BITMAP om_mdbs.bmp // Exchange MDB volume
+ IDRBM_EMS_DSA BITMAP om_dsas.bmp // Exchange DSA volume
+ IDRBM_EMS_MDBX BITMAP om_mdbx.bmp // Exchange MDB volume bad
+ IDRBM_EMS_DSAX BITMAP om_dsax.bmp // Exchange DSA volume bad
+ IDRBM_EMS_DSAP BITMAP om_dsap.bmp // Exchange DSA volume bad
+ IDRBM_EMS_MDBP BITMAP om_mdbp.bmp // Exchange MDB volume bad
+ IDRBM_RCVR_STATUS BITMAP om_stats.bmp // Recover status bar brush pattern
+
+/* The ID for this control is defined in ctl3d.h as 26567 */
+ CTL3D_3DCHECK BITMAP 3dcheck.bmp // 3-D Check box for 3-D dialogs
+
+# endif // defined ( OEM_MSOFT ) // CHS:03-27-92
+
+// COMMON BITMAPS
+
+IDRBM_BLANK16x16 BITMAP om_blank.bmp // blank 16x16 bit map
+IDRBM_EXE BITMAP exe.bmp // Executable bitmap.
+IDRBM_FILE BITMAP file.bmp // File bitmap.
+IDRBM_FOLDER BITMAP folder.bmp // Folder bitmap.
+IDRBM_FOLDERPLUS BITMAP folder_p.bmp // Folder with plus bitmap.
+IDRBM_FOLDERMINUS BITMAP folder_m.bmp // Folder with minus bitmap.
+IDRBM_FOLDEROPEN BITMAP fold_on.bmp // Open Folder bitmap.
+IDRBM_FOLDERPLUSOPEN BITMAP fold_op.bmp // Open Folder with plus bitmap.
+IDRBM_FOLDERMINUSOPEN BITMAP fold_om.bmp // Open Folder with minus bitmap.
+IDRBM_FOLDERC BITMAP fol_cn.bmp // Corrupt Folder bitmap.
+IDRBM_FOLDERPLUSC BITMAP fol_cp.bmp // Corrupt Folder with plus bitmap.
+IDRBM_FOLDERMINUSC BITMAP fol_cm.bmp // Corrupt Folder with minus bitmap.
+IDRBM_FOLDEROPENC BITMAP fol_ocn.bmp // Corrupt Open Folder bitmap.
+IDRBM_FOLDERPLUSOPENC BITMAP fol_ocp.bmp // Corrupt Open Folder with plus bitmap.
+IDRBM_FOLDERMINUSOPENC BITMAP fol_ocm.bmp // Corrupt Open Folder with minus bitmap.
+IDRBM_PARENTDIR BITMAP pdir2.bmp // Parent directory bitmap.
+IDRBM_TAPE BITMAP tape2.bmp // Tape bitmap.
+IDRBM_TAPEINDRIVE BITMAP tapein2.bmp // Tape in drive bitmap.
+IDRBM_TAPES BITMAP tapes2.bmp // Tape bitmap.
+IDRBM_TAPESINDRIVE BITMAP tapesin2.bmp // Tape in drive bitmap.
+IDRBM_SDISK BITMAP sdisk.bmp // Small disk bitmap.
+IDRBM_BSET BITMAP bset.bmp // Backup set bitmap.
+IDRBM_BSETPART BITMAP bsetpart.bmp // Partial backup set bitmap.
+IDRBM_LTAPE BITMAP ltape.bmp // Large tape bitmap.
+IDRBM_CORRUPTFILE BITMAP crptfile.bmp // corrupt file.
+IDRBM_HCRPTFILE BITMAP hcrpfile.bmp // hidden corrupt file
+IDRBM_HFILE BITMAP hfile.bmp // hidden normal file
+IDRBM_HEXEFILE BITMAP hexefile.bmp // hidden exe file
+IDRBM_FLOPPY BITMAP floppy1.bmp // floppy bitmap.
+IDRBM_FLOPPYINDRIVE BITMAP floppy2.bmp // floppy in drive bitmap.
+IDRBM_FLOPPYS BITMAP floppy3.bmp // floppys bitmap.
+IDRBM_FLOPPYSINDRIVE BITMAP floppy4.bmp // floppys in drive bitmap.
+
diff --git a/private/utils/ntbackup/src/bkuevent.mc b/private/utils/ntbackup/src/bkuevent.mc
new file mode 100644
index 000000000..fb4ab8bb4
--- /dev/null
+++ b/private/utils/ntbackup/src/bkuevent.mc
@@ -0,0 +1,99 @@
+;/*
+;Copyright (c) 1992 Maynard Electrionics, Inc.
+;
+;Module Name:
+;
+; bkuevent.h
+;
+;Abstract:
+;
+; Definitions for ntbackup events.
+;
+;Author:
+;
+; David Van Camp
+;
+;Revision History:
+;
+;Notes:
+;
+; This file is generated by the MC tool from the bkuevent.mc file.
+;
+;--*/
+;
+;#ifndef _BKUEVENT_
+;#define _BKUEVENT_
+;
+
+;
+;
+;/////////////////////////////////////////////////////////////////////////
+;//
+;// NT Backup Events
+;//
+;// Codes 8000 - 8008
+;//
+;/////////////////////////////////////////////////////////////////////////
+;
+;
+;
+MessageId=8000 SymbolicName=EVENT_BKUP_BEGINBACKUP
+Language=English
+Begin Backup of '%1'
+ Verify: %2
+ Mode: %3
+ Type: %4
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_ENDBACKUP
+Language=English
+End Backup of '%1'
+ Verify: %2
+ Mode: %3
+ Type: %4
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_BEGINRESTORE
+Language=English
+Begin Restore to '%1'
+ Verify: %2
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_ENDRESTORE
+Language=English
+End Restore to '%1'
+ Verify: %2
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_BEGINERASE
+Language=English
+Begin Erase
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_ENDERASE
+Language=English
+End Erase
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_BEGINRETENSION
+Language=English
+Begin Retension
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_ENDRETENSION
+Language=English
+End Retension
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_BEGINVERIFY
+Language=English
+Begin Verify to '%1'
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_ENDVERIFY
+Language=English
+End Verify to '%1'
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_EMS_ERROR
+Language=English
+Microsoft Exchange services returned '%1' from a call to '%2' additional data '%3'
+.
+MessageId=+1 SymbolicName=EVENT_BKUP_EMS_DB_ERROR
+Language=English
+Microsoft Exchange services returned too few databases for backup
+Only %1 databases was retured but Backup expected %2
+.
+
+;#endif // _BKUEVENT_
+
diff --git a/private/utils/ntbackup/src/bsdlasto.c b/private/utils/ntbackup/src/bsdlasto.c
new file mode 100644
index 000000000..1753a3b90
--- /dev/null
+++ b/private/utils/ntbackup/src/bsdlasto.c
@@ -0,0 +1,290 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bsdlasto.c
+
+ Description: This file contains code to save / restore / clear the
+ BSD for the last operation. This can be used for Verify Last Backup
+ and Verify Last Restore.
+
+
+ $Log: Q:/LOGFILES/BSDLASTO.C_V $
+
+ Rev 1.5 18 Jun 1993 08:58:10 MIKEP
+enable C++
+
+ Rev 1.4 25 Mar 1993 15:57:36 JOHNES
+Added some msasserts to make sure a BSD handle is being passed in.
+
+ Rev 1.3 18 Aug 1992 10:10:22 STEVEN
+fix warnings
+
+ Rev 1.2 12 Jun 1991 16:01:44 STEVEN
+BSDU code review
+
+ Rev 1.1 29 May 1991 17:21:20 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:36:46 HUNTER
+Initial revision.
+
+**/
+#include "stdtypes.h"
+
+#include "msassert.h"
+#include "bsdu.h"
+
+/**/
+/**
+
+ Name: BSD_SaveLastOper()
+
+ Description: This function goes clears the 'old' Last Oper BSD list.
+ It then goes thru the current BSD list and unmarks all "deleted"
+ FSEs. It then copy's the queue header to the last oper queue
+ header and re-initializes the current queue header.
+
+
+ Modified: 5/17/1991 14:10:51
+
+ Returns: VOID
+
+ Notes:
+
+ See also: $/SEE( BSD_ClearLastOper(), BSD_ProcLastOper() )$
+
+ Declaration:
+
+**/
+VOID BSD_SaveLastOper(
+BSD_HAND bsdh ) /* I - The BSD handle to save the last operation for */
+{
+ BSD_PTR bsd ;
+
+ msassert( bsdh != NULL ) ;
+
+ BSD_ClearLastOper( bsdh ) ;
+
+ bsd = (BSD_PTR)QueueHead( &(bsdh->current_q_hdr) ) ;
+
+ while( bsd != NULL ) {
+
+ BSD_ClearDelete( bsd ) ;
+
+ bsd = (BSD_PTR)QueueNext( &(bsd->q) ) ;
+
+ }
+
+ BSD_SwapOper ( bsdh ) ;
+
+}
+/**/
+/**
+
+ Name: BSD_ClearLastOper()
+
+ Description: This function release all resources held by the last
+ operation BSD queue.
+
+
+ Modified: 5/17/1991 14:12:26
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_SaveLastOper(), BSD_ProcLastOper() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_ClearLastOper(
+BSD_HAND bsdh )
+{
+ msassert( bsdh != NULL ) ;
+
+ BSD_SwapOper ( bsdh ) ;
+ BSD_ClearCurrOper( bsdh ) ;
+ BSD_SwapOper ( bsdh ) ;
+}
+/**/
+/**
+
+ Name: BSD_ClearCurrOper()
+
+ Description: This function release all resources held by the current
+ operation BSD queue.
+
+
+ Modified: 8/8/1989
+
+ Returns: Error code:
+ BAD_BSD_HAND
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( BSD_SaveLastOper(), BSD_ProcLastOper() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_ClearCurrOper(
+BSD_HAND bsdh )
+{
+ BSD_PTR bsd ;
+
+ msassert( bsdh != NULL ) ;
+
+ bsd = (BSD_PTR)QueueHead( &(bsdh->current_q_hdr) ) ;
+
+ while( bsd != NULL ) {
+
+ BSD_Remove( bsd ) ;
+
+ bsd = (BSD_PTR)QueueHead( &(bsdh->current_q_hdr) ) ;
+ }
+}
+
+/**/
+/**
+
+ Name: BSD_ProcLastOper()
+
+ Description: This function releases any resources held by the current
+ BSD and makes the last oper BSD the current BSD.
+
+
+ Modified: 5/17/1991 14:14:6
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_SaveLastOper(), BSD_ClearLastOper() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_ProcLastOper(
+BSD_HAND bsdh )
+{
+ msassert( bsdh != NULL ) ;
+
+ BSD_ClearCurrOper( bsdh ) ;
+ BSD_SwapOper ( bsdh ) ;
+ bsdh->function_code = BSD_ANY_FUNC ;
+
+}
+/**/
+/**
+
+ Name: BSD_ClearDelete()
+
+ Description: This function scans the FSE list and clears the deleted
+ flag on all elements.
+
+ Modified: 5/29/1991 12:56:8
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_SaveLastOper() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_ClearDelete( BSD_PTR bsd )
+{
+ FSE_PTR fse ;
+
+ msassert( bsd != NULL ) ;
+
+ fse = (FSE_PTR)QueueHead( &(bsd->fse_q_hdr) );
+
+ while( fse != NULL ) {
+
+ msassert( (BSD_PTR)GetQueueElemPtr( &(fse->q)) == bsd ) ;
+
+ fse->flgs.proced_fse = FALSE ;
+
+ fse = (FSE_PTR)QueueNext( &(fse->q) ) ;
+ }
+
+}
+
+/**/
+/**
+
+ Name: BSD_SwapOper()
+
+ Description: This function swaps the the last oper BSD queue and
+ the BSD current queue.
+
+
+ Modified: 5/29/1991 12:56:25
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_SaveLastOper(), BSD_ClearLastOper() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_SwapOper(
+BSD_HAND bsdh )
+{
+ Q_HEADER temp ;
+
+ msassert( bsdh != NULL ) ;
+
+ temp = bsdh->last_q_hdr ;
+
+ bsdh->last_q_hdr = bsdh->current_q_hdr ;
+ bsdh->current_q_hdr = temp ;
+
+}
+
+
+/**/
+/**
+
+ Name: BSD_BeginFunction()
+
+ Description: This funciton clears the BSD list if the old BSD function
+ does not equal the new function
+
+ Modified: 5/17/1991 14:26:59
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_BeginFunction(
+BSD_HAND bsdh, /* I - head of the BSD list */
+INT16 function ) /* I - Function to begin */
+{
+ msassert( bsdh != NULL ) ;
+
+ if ( ( bsdh->function_code != function ) && ( bsdh->function_code != BSD_ANY_FUNC ) ) {
+
+ BSD_ClearCurrOper( bsdh ) ;
+ }
+
+ bsdh->function_code = function ;
+}
diff --git a/private/utils/ntbackup/src/bsdmatch.c b/private/utils/ntbackup/src/bsdmatch.c
new file mode 100644
index 000000000..bda5a0c51
--- /dev/null
+++ b/private/utils/ntbackup/src/bsdmatch.c
@@ -0,0 +1,889 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bsdmatch.c
+
+ Description: This file contains code to match a single file with
+ The FSEs in the BSD list.
+
+
+ $Log: T:/LOGFILES/BSDMATCH.C_V $
+
+ Rev 1.36 11 Feb 1994 16:38:54 GREGG
+Allow for separator character in match buffer allocation.
+
+ Rev 1.35 17 Jan 1994 17:17:20 BARRY
+Got rid of TEXT macros in msasserts
+
+ Rev 1.34 16 Dec 1993 10:20:12 BARRY
+Change INT8_PTRs to VOID_PTRs
+
+ Rev 1.33 06 Dec 1993 11:35:42 BARRY
+Unicode fixes
+
+ Rev 1.32 16 Jul 1993 11:42:00 BARRY
+Changed MatchFname to use allocated memory on really large file names.
+
+ Rev 1.31 15 Jul 1993 10:38:06 BARRY
+Steve's changes to match fred.* with fred
+
+ Rev 1.30 10 Jun 1993 07:48:44 MIKEP
+enable c++
+
+ Rev 1.29 16 Mar 1993 10:57:14 STEVEN
+was munging memory
+
+ Rev 1.28 30 Jan 1993 11:14:40 DON
+Removed compiler warnings
+
+ Rev 1.27 04 Jan 1993 09:39:48 MIKEP
+temporary unicode fix
+
+ Rev 1.26 06 Oct 1992 13:24:06 DAVEV
+Unicode strlen verification
+
+ Rev 1.25 18 Sep 1992 15:21:38 STEVEN
+fix compiler error
+
+ Rev 1.24 17 Sep 1992 11:12:08 STEVEN
+add support for daily backup
+
+ Rev 1.23 30 Jul 1992 19:15:26 STEVEN
+fix bugg a boo
+
+ Rev 1.22 09 Jul 1992 13:59:08 STEVEN
+BE_Unicode updates
+
+ Rev 1.21 26 May 1992 11:24:18 TIMN
+Added text macro of msassert
+
+ Rev 1.20 22 May 1992 14:06:44 STEVEN
+would crash if FSL_EMPTY returned
+
+ Rev 1.19 21 May 1992 09:41:10 STEVEN
+do not match parrent dir if target info is present
+
+ Rev 1.18 13 May 1992 11:39:38 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.17 13 May 1992 10:27:16 STEVEN
+changes in attributes
+
+ Rev 1.16 28 Feb 1992 09:22:28 STEVEN
+partial excludes being full excludes
+
+ Rev 1.15 16 Jan 1992 08:44:02 STEVEN
+fix bug for partial dir selection
+
+ Rev 1.14 14 Jan 1992 10:24:06 STEVEN
+fix warnings for WIN32
+
+ Rev 1.13 18 Oct 1991 14:23:04 STEVEN
+BIGWHEEL-fix bug in entire dir support
+
+ Rev 1.12 07 Oct 1991 10:47:34 STEVEN
+was not properly matching directories
+
+ Rev 1.11 23 Aug 1991 17:00:56 STEVEN
+added support for NORMAL/COPY/DIFERENTIAL/INCREMENTAL
+
+ Rev 1.10 24 Jul 1991 09:05:04 DAVIDH
+Corrected compiler warnings under Watcom.
+
+ Rev 1.9 15 Jul 1991 17:17:36 STEVEN
+was not matching root dir
+
+ Rev 1.8 02 Jul 1991 11:01:10 STEVEN
+FnameMatch was borken
+
+ Rev 1.7 02 Jul 1991 09:54:24 STEVEN
+fix date stuff
+
+ Rev 1.6 21 Jun 1991 15:58:52 STEVEN
+compairing invalid dates
+
+ Rev 1.5 21 Jun 1991 08:40:54 STEVEN
+new config unit
+
+ Rev 1.4 20 Jun 1991 10:59:00 STEVEN
+modifications for matching directories
+
+ Rev 1.3 13 Jun 1991 10:17:32 STEVEN
+Match code was looking at DLE which could be NULL
+
+ Rev 1.2 12 Jun 1991 16:03:30 STEVEN
+BSDU code review
+
+ Rev 1.1 29 May 1991 17:21:24 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:36:46 HUNTER
+Initial revision.
+
+**/
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+
+#include "msassert.h"
+
+#include "tfldefs.h"
+#include "beconfig.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "bsdu.h"
+
+#define BSD_PROCESS_PARENT 10
+
+static BOOLEAN FSE_ListIsEmpty( BSD_PTR bsd ) ;
+
+static INT16 MatchSelectData( CHAR_PTR fname,
+ CHAR_PTR path,
+ INT16 psize,
+ UINT32 attrib,
+ DATE_TIME_PTR date,
+ DATE_TIME_PTR adate,
+ DATE_TIME_PTR bdate,
+ BOOLEAN del_flag,
+ BOOLEAN disp_flag,
+ FSE_PTR fse1,
+ BOOLEAN *entireable ) ;
+
+static BOOLEAN BSD_MatchForParent(
+ BSD_PTR bsd,
+ FSE_PTR fse,
+ CHAR_PTR ipath,
+ INT16 isize ) ;
+
+static INT16 MatchFname(
+ CHAR_PTR name1, /* I - file name (with wildcards) */
+ CHAR_PTR name2 ); /* I - file name (without wildcards ) */
+
+/**/
+/**
+
+ Name: BSD_MatchFile()
+
+ Description: This function returns SUCCESS if a specified file is
+ included by a BSD. All FSEs in the BSD are compared agains a
+ DDB and a FDB pair. A pointer to the last FSE which includes
+ this file is also returned.
+
+
+ Modified: 5/17/1991 15:59:9
+
+ Returns: FSE_EMPTY
+ BSD_SKIP_OBJECT
+ BSD_PROCESS_OBJECT
+ BSD_PROCESS_ELEMENTS
+
+ Notes: If the DBLK is a single block (i.e. no associated FDB)
+ then the DBLK should be passed as the DDB parameter.
+
+ For DDBs we will look for the most powerfull FSE which matches.
+ If Target names exist then we will check for TARGET FSES
+
+ See also: $/SEE( FS_DBLKMatch() )$
+
+ Declaration:
+
+**/
+INT16 BSD_MatchObj(
+BSD_PTR bsd, /* I - BSD to scan for matching FSE */
+FSE_PTR *fse, /* O - Last matching INCLUDE FSE in list */
+FSYS_HAND fsh, /* I - File system Handle needed to call FS */
+DBLK_PTR ddb, /* I - DBLK to match DDB, IDB, UDB or other */
+DBLK_PTR fdb, /* I - File Descriptor Block if ddb is DDB */
+BOOLEAN disp_flag ) /* I - True if Parent directories match */
+{
+ INT16 ret_val = BSD_SKIP_OBJECT ;
+ CHAR_PTR temp_buf = bsd->match_buffer ;
+ CHAR_PTR path = NULL ;
+ CHAR_PTR fname = NULL;
+ INT16 cb_size; //string buffer size in bytes incl NULL term
+ DATE_TIME date ;
+ DATE_TIME a_date ;
+ UINT32 attrib = 0;
+ INT16 spec_file ;
+ INT16 cb_alloc_size ; //string buffer size in bytes incl NULL term
+
+ *fse = NULL ;
+ date.date_valid = FALSE ;
+
+ switch( FS_GetBlockType( ddb ) ) {
+
+ case UDB_ID:
+ ret_val = BSD_SKIP_OBJECT ;
+ break;
+
+ case CFDB_ID:
+ case IDB_ID:
+ ret_val = BSD_PROCESS_OBJECT ;
+ break ;
+
+ case DDB_ID:
+
+ spec_file = FS_SpecExcludeObj ( fsh, ddb, fdb ) ;
+
+ if ( spec_file == FS_EXCLUDE_FILE ) {
+ ret_val = BSD_SKIP_OBJECT ;
+
+ } else if ( spec_file == FS_SPECIAL_FILE ) {
+ ret_val = BSD_SPECIAL_OBJECT ;
+
+ } else {
+
+
+ cb_alloc_size = cb_size = FS_SizeofOSPathInDDB( fsh, ddb ) ;
+ cb_alloc_size += sizeof( CHAR ) ;
+
+ if ( fdb != NULL ) {
+ msassert( FS_GetBlockType(fdb) == FDB_ID ) ;
+
+ cb_alloc_size += FS_SizeofOSFnameInFDB( fsh, fdb ) ;
+
+ }
+
+ if ( cb_alloc_size > bsd->match_buffer_size ) {
+ bsd->match_buffer_size = (UINT16)(cb_alloc_size + (64 * sizeof(CHAR)) ) ;
+ bsd->match_buffer = realloc( bsd->match_buffer, bsd->match_buffer_size ) ;
+ temp_buf = bsd->match_buffer ;
+ }
+
+ if ( temp_buf == NULL ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ path = temp_buf ;
+
+ FS_GetOSPathFromDDB( fsh, ddb, path ) ;
+
+ if ( fdb !=NULL ) {
+
+ fname = path + cb_size / sizeof (CHAR) ;
+
+ FS_GetOSFnameFromFDB( fsh, fdb, fname ) ;
+
+ attrib = FS_GetAttribFromDBLK( fsh, fdb ) ;
+
+ FS_GetMDateFromDBLK( fsh, fdb, &date ) ;
+ FS_GetADateFromDBLK( fsh, fdb, &a_date ) ;
+ }
+
+ ret_val = BSD_MatchPathAndFile( bsd, fse, fname, path,
+ cb_size, attrib, &date, &a_date, NULL, FALSE,
+ disp_flag ) ;
+
+
+ if ( (*fse != NULL) &&
+ BSD_MatchForParent( bsd, *fse, path, cb_size ) &&
+ ( (*fse)->tgt != NULL ) ) {
+
+ ret_val = BSD_SKIP_OBJECT ;
+ }
+
+ if ( ( ret_val == BSD_SKIP_OBJECT ) &&
+ ( spec_file == FS_SPECIAL_DIR ) ) {
+
+ ret_val = BSD_SPECIAL_OBJECT ;
+
+ }
+
+ if ( ( fdb == NULL ) && ( ret_val != BSD_SKIP_OBJECT) ) {
+
+ if ( BSD_GetProcElemOnlyFlg( bsd ) || !FS_ProcessDDB( fsh, ddb ) ) {
+ ret_val = BSD_PROCESS_ELEMENTS ;
+ }
+ }
+ }
+
+ break;
+
+ default:
+ msassert( ("INVALID BLOCK type", 0) ) ;
+ break;
+
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: BSD_MatchPathAndFile()
+
+ Description: This function scans through the FSE list looking
+ for a match with the provided data. The scan is from tail
+ to head. The return value specifies how the data should be
+ handled.
+
+
+ Modified: 5/17/1991 16:12:49
+
+ Returns: FSE_EMPTY
+ BSD_SKIP_OBJECT
+ BSD_PROCESS_OBJECT
+
+ Notes: If the the caller wishes to match the directory only
+ then the file name input parameter should be NULL.
+
+ See also: $/SEE( BSD_MatchObj() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_MatchPathAndFile(
+BSD_PTR bsd, /* I - BSD to scan for matching FSE */
+FSE_PTR *fse, /* O - Last matching INCLUDE FSE in list */
+CHAR_PTR fname, /* I - file name to match */
+CHAR_PTR path, /* I - path name to match - generic format */
+INT16 psize, /* I - size of path string */
+UINT32 attr, /* I - attribute to match - generic format */
+DATE_TIME_PTR date, /* I - date to match - generic format */
+DATE_TIME_PTR a_date, /* I - date of last access */
+DATE_TIME_PTR b_date, /* I - date of last backup */
+BOOLEAN del_flag, /* I - True if the object has been deleted */
+BOOLEAN disp_flag ) /* I - True if Parent directories should match */
+{
+ FSE_PTR fse1 ;
+ INT16 ret_val = BSD_SKIP_OBJECT ;
+ INT16 match ;
+ INT16 looking_for_more = FALSE ;
+ BOOLEAN entireable = TRUE ;
+
+ *fse = NULL;
+
+ fse1 = BSD_GetLastFSE( bsd ) ;
+
+ while ( fse1 != NULL ) {
+
+ if ( !FSE_GetDeleteMark( fse1 ) ) {
+
+ match = MatchSelectData( fname, path, psize, attr, date,
+ a_date, b_date, del_flag, disp_flag, fse1, &entireable ) ;
+
+ if ( match != BSD_SKIP_OBJECT ) {
+
+ if( FSE_GetOperType( fse1 ) == INCLUDE ) {
+
+ if ( !looking_for_more ) {
+ *fse = fse1 ;
+ }
+
+ if ( match == BSD_PROCESS_PARENT ) {
+ looking_for_more = TRUE ;
+ ret_val = BSD_PROCESS_OBJECT ;
+
+ } else {
+
+ ret_val = BSD_PROCESS_OBJECT ;
+
+ if ( (fname == NULL) && disp_flag &&
+ (fse1->flgs.select_type != ENTIRE_DIR_SELECTION) ) {
+ looking_for_more = TRUE ;
+
+ } else {
+
+ *fse = fse1 ;
+ if ( entireable && disp_flag &&
+ (fname == NULL) &&
+ (fse1->flgs.select_type == ENTIRE_DIR_SELECTION) ) {
+
+ ret_val = BSD_PROCESS_ENTIRE_DIR ;
+ }
+ break ;
+ }
+ }
+
+ } else {
+ if ( !looking_for_more ) {
+ *fse = NULL ;
+ }
+ break ;
+ }
+ }
+ }
+
+ fse1 = BSD_GetPrevFSE( fse1 ) ;
+
+ }
+ if ( *fse == NULL ) {
+ if ( FSE_ListIsEmpty( bsd ) ) {
+ ret_val = FSL_EMPTY ;
+
+ } else {
+ ret_val = BSD_SKIP_OBJECT ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: FSE_ListIsEmpty()
+
+ Description: This function returns TRUE if the FSE list is empty.
+
+ Modified: 5/20/1991 9:5:6
+
+ Returns: TRUE if list is empty
+
+ See also: $/SEE( BSD_MatcjObj() NSD_MatchPathAndFile() )$
+
+**/
+/* begin declaration */
+static BOOLEAN FSE_ListIsEmpty(
+BSD_PTR bsd )
+{
+ FSE_PTR fse ;
+
+ fse = BSD_GetFirstFSE( bsd ) ;
+
+ while( fse != NULL ) {
+
+ if ( !FSE_GetDeleteMark( fse ) && ( FSE_GetOperType( fse ) == INCLUDE ) ) {
+ return FALSE ;
+ }
+
+ fse = BSD_GetNextFSE( fse ) ;
+ }
+
+ return TRUE ;
+}
+
+/**/
+/**
+
+ Name: MatchSelectData()
+
+ Description: This function matches an FSE with a file name, path, attribute, and
+ modify date.
+
+ Modified: 9/21/1989
+
+ Returns: BSD_SKIP_OBJECT or BSD_PROCESS_OBJECT ;
+
+ Notes:
+
+ See also: $/SEE( BSD_MatcjObj() NSD_MatchPathAndFile() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 MatchSelectData(
+CHAR_PTR ofname, /* I - file name to match */
+CHAR_PTR opath, /* I - path name to match */
+INT16 opsize, /* I - size of above path */
+UINT32 attrib, /* I - attribute to match */
+DATE_TIME_PTR odate, /* I - date to match */
+DATE_TIME_PTR adate, /* I - access date to match */
+DATE_TIME_PTR bdate, /* I - backup date to match */
+BOOLEAN del_flag, /* I - True if object is deleted */
+BOOLEAN disp_flag, /* I - True if match parrent dir requested */
+FSE_PTR fse, /* I - The fse to compare against */
+BOOLEAN *entireable ) /* O - Set to false if we run into an exclude */
+{
+ INT16 ret_val = FAILURE ;
+ BOOLEAN path_match = FALSE ;
+ BOOLEAN name_match = FALSE ;
+ CHAR_PTR fname;
+ CHAR_PTR path ;
+ INT16 cb_psize ;
+ DATE_TIME_PTR date_pre ;
+ DATE_TIME_PTR date_post ;
+ DATE_TIME today_date ;
+ UINT32 a_on ;
+ UINT32 a_off ;
+ BE_CFG_PTR cfg ;
+ BSD_PTR bsd ;
+
+ /* reference parameter to prevent compiler warnings */
+ (VOID) disp_flag ;
+
+ bsd = (BSD_PTR)GetQueueElemPtr( &(fse->q) ) ;
+ cfg = bsd->cfg ;
+/*
+** match the directory
+*/
+
+ FSE_GetPath( fse, &path, &cb_psize ) ;
+
+ if ( ( cb_psize > opsize ) &&
+ ( ofname == NULL ) &&
+ ( FSE_GetOperType( fse ) == INCLUDE ) &&
+ ( ( opsize == sizeof (CHAR) ) || !memicmp( path, opath, opsize ) ) ) {
+
+
+ return BSD_PROCESS_PARENT ;
+
+
+ } else if ( ( cb_psize >=opsize ) &&
+ ( FSE_GetOperType( fse ) == EXCLUDE ) &&
+ ( ( opsize == sizeof (CHAR) ) || !memicmp( path, opath, opsize ) ) ) {
+
+ *entireable = FALSE ;
+
+ }
+
+ if ( (cb_psize == sizeof (CHAR) ) && FSE_GetIncSubFlag( fse ) ) {
+ path_match = TRUE ;
+
+ } else if ( (cb_psize == opsize) && !memicmp( path, opath, cb_psize ) ) {
+ path_match = TRUE ;
+
+ } else if ( (cb_psize < opsize) && FSE_GetIncSubFlag( fse ) &&
+ !memicmp( path, opath, cb_psize ) ) {
+
+ path_match = TRUE ;
+
+ }
+
+ if( path_match ) {
+
+ ret_val = SUCCESS ;
+
+ fname = FSE_GetFname( fse ) ;
+
+ if ( ofname == NULL ) { /* just matching the directory */
+
+ if ( FSE_GetOperType( fse ) == EXCLUDE ) {
+ ret_val = FAILURE ;
+
+ if ( FSE_GetIncSubFlag( fse ) && ( cb_psize <= opsize ) ) {
+ *entireable = FALSE ;
+
+ if ( !strcmp( fname, ALL_FILES ) && FSE_GetWildFlag( fse ) &&
+ ( fse->cplx == NULL ) ) {
+ ret_val = SUCCESS ;
+ }
+ }
+ }
+
+ } else {
+/*
+** match the file
+*/
+ if ( FSE_GetWildFlag( fse ) ) {
+ if ( !MatchFname( fname, ofname ) ) { /* success if match */
+ name_match = TRUE ;
+ }
+ } else {
+ if ( !stricmp( fname, ofname ) ) {
+ name_match = TRUE ;
+ }
+ }
+
+ if ( !name_match ) {
+ ret_val = FAILURE ;
+
+ } else if ( del_flag && (fse->flgs.del_files == NON_DELETED_FILES_ONLY) ) {
+ ret_val = FAILURE ;
+
+ } else if ( !del_flag && (fse->flgs.del_files == DELETED_FILES_ONLY) ) {
+ ret_val = FAILURE ;
+
+ } else if ( fse->flgs.select_type != SINGLE_FILE_SELECTION ) {
+
+ /* ... if NOT processing hidden files AND it is hidden then return */
+
+ if( ( !BEC_GetHiddenFlag( cfg ) ) && ( attrib & OBJ_HIDDEN_BIT ) ) {
+
+ ret_val = FAILURE ;
+ }
+
+ if( !BEC_GetSpecialFlag( cfg ) &&
+ ( ( attrib & OBJ_READONLY_BIT) || ( attrib & OBJ_SYSTEM_BIT) ) ) {
+
+ ret_val = FAILURE ;
+ }
+ }
+
+
+ if ( ret_val != SUCCESS ) {
+ ret_val = FAILURE ; /* redundant but reads better */
+
+ } else if ( (fse->cplx == NULL) &&
+ (BSD_CompatibleBackup(bsd) || !BSD_ModFilesOnly(bsd)) ) {
+
+ ret_val = SUCCESS ;
+
+ if ( BSD_GetBackupType( bsd ) == BSD_BACKUP_DAILY ) {
+
+ today_date = bsd->sort_date ;
+ today_date.hour = 0 ;
+ today_date.minute = 0 ;
+ today_date.second = 0 ;
+
+ if ( CompDate( odate, &today_date ) < 0 ) {
+ ret_val = FAILURE ;
+ }
+ }
+
+ } else {
+
+ if ( BSD_GetBackupType( bsd ) != BSD_BACKUP_DAILY ) {
+
+ FSE_GetModDate( fse, &date_pre, &date_post ) ;
+
+ if ( date_pre != NULL ) {
+
+ if ( CompDate( odate, date_pre ) < 0 ) {
+ ret_val = FAILURE ;
+ }
+ }
+
+ if ( date_post != NULL ) {
+ if ( CompDate( odate, date_post ) > 0 ) {
+ ret_val = FAILURE ;
+ }
+ }
+ }
+
+ FSE_GetAccDate( fse, &date_pre ) ;
+
+ if ( date_pre != NULL ) {
+
+ /* if no access date specified then do not match */
+ if ( ( adate == NULL ) || ( !adate->date_valid ) ) {
+ ret_val = FAILURE ;
+
+ } else if ( CompDate( adate, date_pre ) > 0 ) {
+ ret_val = FAILURE ;
+ }
+ }
+
+
+ FSE_GetBakDate( fse, &date_pre ) ;
+
+ if ( date_pre != NULL ) {
+
+ /* if no backup date specified then do not compare dates */
+ if ( ( bdate != NULL ) && ( bdate->date_valid ) ) {
+ if ( CompDate( bdate, date_pre ) != 0 ) {
+ ret_val = FAILURE ;
+ }
+ }
+ }
+
+ FSE_GetAttribInfo( fse, &a_on, &a_off ) ;
+
+ if ( !BSD_CompatibleBackup( bsd ) &&
+ BSD_ModFilesOnly( bsd ) ) {
+
+ a_on |= OBJ_MODIFIED_BIT ;
+ }
+ if( (attrib & a_on) != a_on ) {
+
+ ret_val = FAILURE ;
+ }
+
+ if( ((~attrib) & a_off) != a_off ) {
+ ret_val = FAILURE ;
+ }
+
+ }
+
+ }
+ }
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = BSD_PROCESS_OBJECT;
+ } else {
+ ret_val = BSD_SKIP_OBJECT ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: MatchName()
+
+ Description: This function matches a wildcard file name with
+ a normal (non wildcard) file name.
+
+ Modified: 8/2/1989
+
+ Returns: SUCCESS if names are the same. Otherwise FAILURE
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 MatchFname(
+CHAR_PTR wild_name, /* I - file name (with wildcards) */
+CHAR_PTR file_name ) /* I - file name (without wildcards ) */
+{
+ INT16 pos ; /* index for file_name */
+ INT16 i ; /* index for wild_name */
+ INT16 ret_val = SUCCESS;
+ CHAR_PTR p ;
+ CHAR save_char ;
+ INT16 ptrn_len ;
+ CHAR sname_buff[256]; /* static temp name buffer */
+ CHAR_PTR aname_buff = NULL; /* allocated temp name buffer */
+ CHAR_PTR temp_fname; /* pointer to one of the above */
+
+ pos = 0 ;
+
+ if( strcmp( wild_name, ALL_FILES ) ) {
+
+ BOOLEAN try_with_dot = FALSE ;
+
+ do {
+
+ if ( try_with_dot ) {
+
+ /*
+ * Size of name_buff minus a null, minus a dot for the
+ * "try_with_dot" code below. If the name is longer than the
+ * static buffer, allocate one from the heap.
+ */
+ if ( (strsize(file_name) + sizeof(CHAR)) > sizeof(sname_buff) )
+ {
+ aname_buff = malloc( strsize( file_name ) +
+ sizeof( CHAR ) );
+ temp_fname = aname_buff;
+ }
+ else
+ {
+ temp_fname = sname_buff;
+ }
+
+ if ( temp_fname != NULL ) {
+ strcpy( temp_fname, file_name ) ;
+ strcat( temp_fname, TEXT(".") ) ;
+ file_name = temp_fname ;
+ pos = 0 ;
+ ret_val = SUCCESS ;
+ }
+ try_with_dot = FALSE ;
+
+ } else if ( strchr( file_name, TEXT('.') ) == NULL ) {
+ try_with_dot = TRUE ;
+ }
+
+ for( i = 0; (wild_name[i] != 0) && (ret_val == SUCCESS) ; i++ ) {
+
+ switch( wild_name[i] ) {
+
+ case TEXT('*'):
+
+ while( wild_name[i+1] != TEXT('\0') ) {
+
+ if ( wild_name[i+1] == TEXT('?') ) {
+ if ( file_name[ ++pos ] == TEXT('\0') ) {
+ break ;
+ }
+
+ } else if ( wild_name[i+1] != TEXT('*') ) {
+ break ;
+ }
+ i++ ;
+ }
+
+ p = strpbrk( &wild_name[i+1], TEXT("*?") ) ;
+
+ if ( p != NULL ) {
+ save_char = *p ;
+ *p = TEXT('\0') ;
+
+ ptrn_len = (INT16)strlen( &wild_name[i+1] ) ;
+
+ while ( file_name[pos] &&
+ strnicmp( &file_name[pos], &wild_name[i+1], ptrn_len ) ) {
+ pos++;
+ }
+
+ i += ptrn_len ;
+
+ *p = save_char ;
+
+ if ( file_name[pos] == TEXT('\0') ) {
+ ret_val = FAILURE ;
+ } else {
+ pos++ ;
+ }
+ } else {
+ if (wild_name[i+1] == TEXT('\0') ) {
+ pos = (INT16)strlen( file_name ) ;
+ break ;
+ } else {
+ p = strchr( &file_name[pos], wild_name[i+1] ) ;
+ if ( p != NULL ) {
+ pos += p - &file_name[pos];
+ } else {
+ ret_val = FAILURE ;
+ }
+ }
+ }
+ break;
+
+ case TEXT('?') :
+ if ( file_name[pos] != TEXT('\0') ) {
+ pos++ ;
+ }
+ break;
+
+ default:
+ if( ( file_name[pos] == TEXT('\0') ) || ( toupper(file_name[pos]) != toupper(wild_name[i]) ) ){
+ ret_val = FAILURE;
+ } else {
+ pos++ ;
+ }
+ }
+ }
+
+ if ( file_name[pos] != TEXT('\0') ) {
+ ret_val = FAILURE ;
+ }
+
+ } while( (ret_val == FAILURE) && (try_with_dot) ) ;
+ }
+
+ if ( aname_buff != NULL ) {
+ free( aname_buff );
+ }
+ return( ret_val ) ;
+}
+static BOOLEAN BSD_MatchForParent(
+ BSD_PTR bsd,
+ FSE_PTR fse,
+ CHAR_PTR ipath,
+ INT16 isize ) //size of path buffer in bytes incl NULL term
+{
+ CHAR_PTR path ;
+ INT16 cb_psize ; //size of path buffer in bytes incl NULL term
+
+/*
+** match the directory
+*/
+
+ FSE_GetPath( fse, &path, &cb_psize ) ;
+
+ if ( ( cb_psize > isize ) &&
+ ( FSE_GetOperType( fse ) == INCLUDE ) &&
+ ( ( isize == sizeof (CHAR) ) || !memicmp( path, ipath, isize ) ) ) {
+
+ return TRUE ;
+ }
+
+ return FALSE ;
+ (VOID)bsd;
+}
diff --git a/private/utils/ntbackup/src/bsdsinfo.c b/private/utils/ntbackup/src/bsdsinfo.c
new file mode 100644
index 000000000..675b99a5c
--- /dev/null
+++ b/private/utils/ntbackup/src/bsdsinfo.c
@@ -0,0 +1,417 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bsdsinfo.c
+
+ Description: This file contains a "bunch" of functions used
+ to initialize the fields of a BSD.
+
+
+ $Log: O:/LOGFILES/BSDSINFO.C_V $
+
+ Rev 1.4 14 May 1992 08:57:26 TIMN
+Converted CHAR byte data types to INT8.
+
+ Rev 1.3 13 May 1992 19:12:40 TIMN
+Added size parameter for tape,vol and backup label functions.
+Added size parameter for userName function
+Converted strcpy calls to memcpy calls
+
+ Rev 1.2 08 May 1992 16:24:20 STEVEN
+added volume label to BSD
+
+ Rev 1.1 29 May 1991 17:21:04 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:36:50 HUNTER
+Initial revision.
+
+**/
+#include <malloc.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+
+#include "bsdu.h"
+#include "msassert.h"
+
+/**/
+/**
+
+ Name: BSD_SetTapeLabel()
+
+ Description: This function allocates memory for the tape
+ label and coppies the passed label into this memory. This
+ memory is then pointed to by the bsd ;
+
+ Modified: 5/17/1991 14:58:19
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetBackupLabel() )$
+
+ Declaration:
+
+**/
+INT16 BSD_SetTapeLabel(
+BSD_PTR bsd, /* I - BSD to modify */
+INT8_PTR label, /* I - string to place in BSD */
+INT16 size ) /* I - size of label */
+{
+ INT8_PTR name ;
+ INT16 ret_val ;
+
+ msassert( bsd != NULL );
+
+ name = (INT8_PTR) malloc( size ) ;
+
+ if ( name != NULL ) {
+ free( bsd->tape_label ) ;
+
+ memcpy( name, label, size ) ;
+ bsd->tape_label = name ;
+ bsd->tape_label_size = size ;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSD_SetVolumeLabel()
+
+ Description: This function allocates memory for the tape
+ label and coppies the passed label into this memory. This
+ memory is then pointed to by the bsd ;
+
+ Modified: 5/17/1991 14:58:19
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetBackupLabel() )$
+
+ Declaration:
+
+**/
+INT16 BSD_SetVolumeLabel(
+BSD_PTR bsd, /* I - BSD to modify */
+INT8_PTR label, /* I - string to place in BSD */
+INT16 size ) /* I - size of label */
+{
+ INT8_PTR name ;
+ INT16 ret_val ;
+
+ msassert( bsd != NULL );
+
+ name = (INT8_PTR) malloc( size ) ;
+
+ if ( name != NULL ) {
+ free( bsd->vol_label ) ;
+
+ memcpy( name, label, size ) ;
+ bsd->vol_label = name ;
+ bsd->vol_label_size = size ;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSD_SetBackupLabel()
+
+ Description: This function allocates memory for the backup set
+ label and coppies the passed label into this memory. This
+ memory is then pointed to by the bsd ;
+
+ Modified: 5/17/1991 14:58:25
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetBackupLabel() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_SetBackupLabel(
+BSD_PTR bsd, /* I - BSD to modify */
+INT8_PTR label, /* I - string to place in BSD */
+INT16 size ) /* I - size of label */
+{
+ INT8_PTR name ;
+ INT16 ret_val ;
+
+ name = (INT8_PTR) malloc( size ) ;
+
+ if ( name != NULL ) {
+
+ free( bsd->set_label ) ;
+ memcpy( name, label, size ) ;
+ bsd->set_label = name ;
+ bsd->set_label_size = size ;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSD_SetBackupDescript()
+
+ Description: This function allocates memory for the backup set
+ description and coppies the passed descriptoin into this memory.
+ This memory is then pointed to by the bsd ;
+
+ Modified: 5/17/1991 14:58:31
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetBackupLabel() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_SetBackupDescript(
+BSD_PTR bsd, /* I - BSD to modify */
+INT8_PTR descript, /* I - string to place in BSD */
+INT16 size ) /* I - size of label */
+{
+ INT8_PTR name ;
+ INT16 ret_val ;
+
+ name = (INT8_PTR) malloc( size ) ;
+
+ if ( name != NULL ) {
+
+ free( bsd->set_descript ) ;
+ memcpy( name, descript, size ) ;
+ bsd->set_descript = name ;
+ bsd->set_descript_size = size ;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSD_SetTapePswd()
+
+ Description: This function allocates memory for the tape password
+ and coppies the passed password into this memory.
+ This memory is then pointed to by the bsd ;
+
+ Modified: 5/17/1991 14:58:36
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetBackupLabel() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_SetTapePswd(
+BSD_PTR bsd, /* I - BSD to modify */
+INT8_PTR pswd, /* I - string to place in BSD */
+INT16 leng ) /* I - size of passowrd */
+{
+ INT8_PTR name ;
+ INT16 ret_val ;
+
+ name = (INT8_PTR) malloc( leng ) ;
+
+ if ( name != NULL ) {
+
+ free( bsd->tape_pswd ) ;
+ memcpy( name, pswd, leng ) ;
+ bsd->tape_pswd = name ;
+ bsd->tape_pswd_size = leng ;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSD_SetBackupPswd()
+
+ Description: This function allocates memory for the backp set
+ password and coppies the passed password into this memory.
+ This memory is then pointed to by the bsd ;
+
+ Modified: 5/17/1991 14:58:41
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetBackupLabel() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_SetBackupPswd(
+BSD_PTR bsd, /* I - BSD to modify */
+INT8_PTR pswd, /* I - string to place in BSD */
+INT16 leng ) /* I - size of set password */
+{
+ INT8_PTR name ;
+ INT16 ret_val ;
+
+ name = (INT8_PTR) malloc( leng ) ;
+
+ if ( name != NULL ) {
+
+ free( bsd->set_pswd ) ;
+ memcpy( name, pswd, leng ) ;
+ bsd->set_pswd = name ;
+ bsd->set_pswd_size = leng ;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSD_SetUserName()
+
+ Description: This function allocates memory for the user name
+ and coppies the passed name into this memory.
+ This memory is then pointed to by the bsd ;
+
+ Modified: 5/17/1991 14:58:45
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetBackupLabel() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 BSD_SetUserName(
+BSD_PTR bsd, /* I - BSD to modify */
+INT8_PTR user_name, /* I - string to place in BSD */
+INT16 size ) /* I - size of user name */
+{
+ INT8_PTR name ;
+ INT16 ret_val ;
+
+ name = (INT8_PTR) malloc( size ) ;
+
+ if ( name != NULL ) {
+
+ free( bsd->user_name ) ;
+ memcpy( name, user_name, size ) ;
+ bsd->user_name = name ;
+ bsd->user_name_size = size ;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSD_SetTapePos()
+
+ Description: This function initilizes the tape id, tape number,
+ and set number fields in the BSD
+
+ Modified: 5/17/1991 14:58:50
+
+ Returns: none
+
+ Notes: If the bsd pointer passed in is garbage then memory
+ will be "klobered".
+
+ See also: $/SEE( BSD_SetTapeLabel() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_SetTapePos(
+BSD_PTR bsd, /* I - BSD to modify */
+UINT32 tape_id, /* I - tape ID to place in BSD */
+UINT16 tape_num, /* I - tape number to place in BSD */
+UINT16 set_num ) /* I - set number to place in BSD */
+{
+ bsd->tape_id = tape_id ;
+ bsd->tape_num = tape_num ;
+ bsd->set_num = set_num ;
+}
+
+
diff --git a/private/utils/ntbackup/src/bsdthw.c b/private/utils/ntbackup/src/bsdthw.c
new file mode 100644
index 000000000..4478abe1b
--- /dev/null
+++ b/private/utils/ntbackup/src/bsdthw.c
@@ -0,0 +1,93 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: bsdthw.c
+
+ Description: This file contains a functions used
+ to reference the hardware specific aspects of a BSD.
+
+
+ $Log: Q:/LOGFILES/BSDTHW.C_V $
+
+ Rev 1.1 18 Jun 1993 09:11:26 MIKEP
+enable C++
+
+ Rev 1.0 19 Sep 1991 11:02:54 STEVEN
+Initial revision.
+
+**/
+#include "stdtypes.h"
+
+#include "bsdu.h"
+#include "thw.h"
+
+/**/
+/**
+
+ Name: BSD_HardwareSupportsFeature()
+
+ Description: This function dtermine if the feature specified is supported by one or more drives in the
+ in the hardware list.
+
+ Modified: 6/3/91
+
+ Returns: TRUE - feature supported somewhere in the channel
+ FALSE - feature not supported at all in the channel
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+BOOLEAN BSD_HardwareSupportsFeature(
+BSD_PTR bsd , /* I - BSD of inquiry */
+UINT32 feature ) /* I - feature */
+{
+ BOOLEAN ret_val = FALSE ;
+ THW_PTR drive ;
+ THW_PTR other ;
+
+ /* dtermine the current drive */
+ drive = BSD_GetTHW( bsd ) ;
+
+ /* see if the current drive supports the feature */
+ if( drive->drv_info.drv_features & feature ) {
+ ret_val = TRUE ;
+ }
+
+ if( !ret_val ) {
+
+ /* start looking with the current drive */
+ other = drive ;
+
+ /* see if any subsequent drives linked in the channel support the feature */
+ while( !ret_val && other->channel_link.q_next ) {
+
+ other = ( THW_PTR )( ( other->channel_link.q_next )->q_ptr ) ;
+
+ if( other->drv_info.drv_features & feature ) {
+ ret_val = TRUE ;
+ }
+ }
+ }
+
+ if( !ret_val ) {
+
+ /* start looking with the current drive */
+ other = drive ;
+
+ /* see if any previous drives linked in the channel support the feature */
+ while( !ret_val && other->channel_link.q_prev ) {
+
+ other = ( THW_PTR )( ( other->channel_link.q_prev )->q_ptr ) ;
+
+ if( other->drv_info.drv_features & feature ) {
+ ret_val = TRUE ;
+ }
+ }
+ }
+
+ return( ret_val ) ;
+
+}
diff --git a/private/utils/ntbackup/src/bset.bmp b/private/utils/ntbackup/src/bset.bmp
new file mode 100644
index 000000000..39f713415
--- /dev/null
+++ b/private/utils/ntbackup/src/bset.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/bsetpart.bmp b/private/utils/ntbackup/src/bsetpart.bmp
new file mode 100644
index 000000000..c1742f27a
--- /dev/null
+++ b/private/utils/ntbackup/src/bsetpart.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/buffman.c b/private/utils/ntbackup/src/buffman.c
new file mode 100644
index 000000000..eaf268bd4
--- /dev/null
+++ b/private/utils/ntbackup/src/buffman.c
@@ -0,0 +1,942 @@
+/**
+
+ Name: buffman.c
+
+ Description: This unit provides the functions needed for
+ allocation, de-allocation, and other manipulations
+ on the buffers used by Tape Format routines for
+ transfers to and from the device drivers.
+
+ $Log: N:/LOGFILES/BUFFMAN.C_V $
+
+ Rev 1.16 10 Jun 1993 08:05:00 MIKEP
+enable c++
+
+ Rev 1.15 19 May 1993 19:02:56 DON
+Actually got the assert in BM_InitBuf. Changed so if buf_ptr is NULL we won't use it!
+
+ Rev 1.14 09 Mar 1993 18:15:28 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.13 26 Feb 1992 08:58:36 STEVEN
+added include for buffnt.h
+
+ Rev 1.12 04 Feb 1992 19:53:40 GREGG
+Changes for dealing with new config parameters.
+
+ Rev 1.11 16 Jan 1992 21:02:40 GREGG
+Changed InitList to return INT16 not UINT16.
+
+ Rev 1.10 14 Jan 1992 19:43:34 NED
+Added call to BM_OS_CleanupListTuesday, January 28, 1992
+
+ Rev 1.9 14 Jan 1992 02:03:44 GREGG
+InitList and OS_InitList now return TFLEs.
+
+ Rev 1.8 13 Jan 1992 19:42:56 NED
+Changed vcb requirements to a uw_ variable
+
+ Rev 1.7 13 Jan 1992 13:44:52 GREGG
+Skateboard - Bug fixes.
+
+ Rev 1.6 03 Jan 1992 11:39:50 GREGG
+Modifications to allow for a special VCB buffer.
+
+ Rev 1.5 05 Dec 1991 13:50:06 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.4 07 Jun 1991 16:20:20 NED
+removed static attribute from definition of uw_bpool
+
+ Rev 1.3 04 Jun 1991 11:21:08 BARRY
+Fix OS-specific memory allocation problems by relocating BM_Alloc() and
+BM_Free() to separate source files. Tuesday, December 17, 1991
+
+ Rev 1.2 03 Jun 1991 15:22:18 CARLS
+added changes for Windows
+
+ Rev 1.1 10 May 1991 16:17:36 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:12:14 GREGG
+Initial revision.
+
+**/
+
+#include <string.h>
+#include "stdtypes.h"
+#include "queues.h"
+#include "buffman.h"
+#include "buff_prv.h"
+#include "minmax.h"
+#include "msassert.h"
+#include "tfl_err.h"
+
+#if defined( OS_NLM )
+#include "buffnlm.h"
+#elif defined( OS_WIN )
+#include "buffwin.h"
+#elif defined( OS_DOS )
+#include "buffdos.h"
+#elif defined( OS_OS2 )
+#include "buffos2.h"
+#elif defined( OS_WIN32 )
+#include "buffnt.h"
+#endif
+
+static BUF_REQ mw_default_reqs; /* to reset requirements to */
+Q_HEADER uw_bm_master_list; /* list of all the lists ??? */
+BUF_REQ_PTR uw_vcb_requirements; /* passed via BM_SetVCBRequirements() */
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_InitList
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Initialize an empty list
+ *
+ * Notes:
+ *
+ * Returns: TFLE_xxx
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** initialize list header
+ **
+ ** add the list to our list of lists
+ **
+ ** Let the OS do it's stuff
+ **
+ **/
+
+INT16 BM_InitList(
+ BUF_LIST_PTR list_ptr,
+ UINT16 initial_buff_alloc )
+{
+/*
+** initialize list header
+*/
+ InitQueue( &list_ptr->list_header );
+ list_ptr->max_memory = 0L;
+ list_ptr->memory_used = 0L;
+ BM_ClearRequirements( &list_ptr->requirements_context );
+/*
+** add the list to our list of lists
+*/
+ InitQElem( &list_ptr->q_elem );
+ SetQueueElemPtr( &list_ptr->q_elem, list_ptr );
+ EnQueueElem( &uw_bm_master_list, &list_ptr->q_elem, FALSE );
+/*
+** Let the OS do it's stuff
+*/
+ return( BM_OS_InitList( list_ptr, initial_buff_alloc ) ) ;
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_DeInitList
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: De-initialize a list: free all the buffers on the list
+ *
+ * Notes: Ignores whether the buffers have been marked as
+ * gotten
+ *
+ * Returns: VOID
+ *
+ * Global Data: removes list from uw_bm_master_list
+ *
+ * Processing:
+ *
+ ** remove the list from our list of lists
+ **
+ ** For each buffer on pool list
+ **
+ ** Free the buffer
+ **
+ ** Free the vcb buffer
+ **
+ ** Let the OS do it's stuff
+ **
+ **/
+
+VOID BM_DeInitList(
+ BUF_LIST_PTR list_ptr ) /* IO - list to de-initialize */
+{
+ BUF_PTR buf_ptr ;
+ Q_ELEM_PTR qe_ptr = QueueHead( &list_ptr->list_header );
+/*
+** remove the list from our list of lists
+*/
+ RemoveQueueElem( &uw_bm_master_list, &list_ptr->q_elem );
+/*
+** For each buffer on pool list
+*/
+ while ( qe_ptr != NULL ) {
+ buf_ptr = (BUF_PTR)QueuePtr( qe_ptr );
+ qe_ptr = QueueNext( qe_ptr ); /* get it before we free it! */
+ msassert( buf_ptr != NULL );
+/*
+** Free the buffer
+*/
+ BM_Free( list_ptr, buf_ptr ) ;
+ }
+
+/*
+** Free the vcb buffer
+*/
+ if( list_ptr->vcb_buff ) {
+ BM_FreeVCB( list_ptr, list_ptr->vcb_buff ) ;
+ }
+/*
+** Let the OS do it's stuff
+*/
+ BM_OS_DeInitList( list_ptr ) ;
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_Init
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Initialize Buffer Manager
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data: initializes uw_bm_master_list
+ * initializes mw_default_reqs
+ *
+ * Processing:
+ *
+ ** initialize our master list
+ **
+ ** set harmless default requirements
+ **
+ **/
+
+VOID BM_Init( VOID )
+{
+/*
+** initialize our master list
+*/
+ InitQueue( &uw_bm_master_list );
+/*
+** set harmless default requirements
+*/
+ mw_default_reqs.a.min_size =
+ mw_default_reqs.a.max_size =
+ mw_default_reqs.b.min_size =
+ mw_default_reqs.b.max_size =
+ mw_default_reqs.b.incr_size =
+ mw_default_reqs.tf_size =
+ mw_default_reqs.rw_size = BR_DONT_CARE ;
+
+ mw_default_reqs.b.align =
+ mw_default_reqs.a.align =
+ mw_default_reqs.b.block =
+ mw_default_reqs.a.block = 1 ;
+
+ uw_vcb_requirements = NULL ;
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_DeInit
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: De-Initialize Buffer manager: free all buffers
+ *
+ * Notes: Ignores whether buffers have been marked as
+ * gotten
+ *
+ * Returns: VOID
+ *
+ * Global Data: removes all lists from uw_bm_master_list
+ *
+ * Processing:
+ *
+ ** for each remaining list on our list of lists
+ **
+ ** free all the buffers on the list
+ **
+ **/
+
+VOID BM_DeInit( VOID )
+{
+ Q_ELEM_PTR qe_ptr ;
+/*
+** for each remaining list on our list of lists
+*/
+ while ( ( qe_ptr = DeQueueElem( &uw_bm_master_list ) ) != NULL ) {
+ BUF_LIST_PTR list_ptr = (BUF_LIST_PTR)QueuePtr( qe_ptr );
+/*
+** free all the buffers on the list
+*/
+ BM_DeInitList( list_ptr );
+ }
+}
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_ClearRequirements
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Set a requirements context to default values
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data: reads mw_default_reqs
+ *
+ * Processing:
+ *
+ ** copy default requirements to given context
+ **
+ **/
+
+VOID BM_ClearRequirements(
+ BUF_REQ_PTR context_ptr ) /* O - context to clear */
+{
+/*
+** copy default requirements to given context
+*/
+ *context_ptr = mw_default_reqs;
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: AddBlockRequirements
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Attempt to add requested requirements to dest
+ *
+ * Notes:
+ *
+ * Returns: BR_ERR
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** Copy dest to temp
+ **
+ ** Check new requirement for consistency
+ **
+ ** Combine alignment requirements (no LCM yet)
+ **
+ ** Combine block size requirements (no LCM yet)
+ **
+ ** Combine minimum sizes: use maximum of old, new
+ **
+ ** Combine maximum sizes: use minimum of old, new
+ **
+ ** Combine realloc increment sizes: use maximum of old, new
+ **
+ ** Check for final size consistency: min_size <= max_size?
+ **
+ ** If all OK, copy to destination
+ **
+ **/
+
+static BR_ERR _near AddBlockRequirements(
+ BLOCK_REQ_PTR dest, /* IO - add requirements to this */
+ BLOCK_REQ_PTR src ) /* I - requirements to add */
+{
+/*
+** Copy dest to temp
+*/
+ BLOCK_REQ old_br = *dest;
+/*
+** Check new requirement for consistency
+*/
+ if ( src->max_size != BR_DONT_CARE
+ && src->min_size != BR_DONT_CARE
+ && src->min_size > src->max_size ) {
+ return BR_ERR_BAD_REQUIREMENT;
+ }
+/*
+** Combine alignment requirements (no LCM yet)
+*/
+ if ( src->align != old_br.align ) {
+ if ( src->align < old_br.align ) {
+ if ( old_br.align % src->align != 0 ) {
+ return BR_ERR_INCOMPATIBLE;
+ }
+ /* else do nothing; alignment already compatible */
+ } else { /* src alignment > dest alignment */
+ if ( src->align % old_br.align != 0 ) {
+ return BR_ERR_INCOMPATIBLE;
+ } else {
+ old_br.align = src->align;
+ }
+ }
+ }
+/*
+** Combine block size requirements (no LCM yet)
+*/
+ if ( src->block != old_br.block ) {
+ if ( src->block < old_br.block ) {
+ if ( old_br.block % src->block != 0 ) {
+ return BR_ERR_INCOMPATIBLE;
+ }
+ /* else do nothing; block size already compatible */
+ } else { /* src block size > dest block size */
+ if ( src->block % old_br.block != 0 ) {
+ return BR_ERR_INCOMPATIBLE;
+ } else {
+ old_br.block = src->block;
+ }
+ }
+ }
+/*
+** Combine minimum sizes: use maximum of old, new
+*/
+ if ( src->min_size != BR_DONT_CARE ) {
+ if ( old_br.min_size == BR_DONT_CARE ) {
+ old_br.min_size = src->min_size;
+ } else {
+ old_br.min_size = MAX( old_br.min_size, src->min_size );
+ }
+ }
+/*
+** Combine maximum sizes: use minimum of old, new
+*/
+ if ( src->max_size != BR_DONT_CARE ) {
+ if ( old_br.max_size == BR_DONT_CARE ) {
+ old_br.max_size = src->max_size;
+ } else {
+ old_br.max_size = MIN( old_br.max_size, src->max_size );
+ }
+ }
+/*
+** Combine realloc increment sizes: use maximum of old, new
+*/
+ if ( src->incr_size != BR_DONT_CARE ) {
+ if ( old_br.incr_size == BR_DONT_CARE ) {
+ old_br.incr_size = src->incr_size;
+ } else {
+ old_br.incr_size = MAX( old_br.incr_size, src->incr_size );
+ }
+ }
+/*
+** Check for final size consistency: min_size <= max_size?
+*/
+ if ( old_br.max_size != BR_DONT_CARE
+ && old_br.min_size != BR_DONT_CARE
+ && old_br.min_size > old_br.max_size ) {
+ return BR_ERR_INCOMPATIBLE;
+ }
+/*
+** If all OK, copy to destination
+*/
+ *dest = old_br;
+ return BR_NO_ERR;
+}
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_AddRequirements
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Add a set of requirements to an existing context
+ *
+ * Notes:
+ *
+ * Returns: BR_ERR
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** Copy context to temp BUF_REQ
+ **
+ ** Add requirements for block "a"
+ **
+ ** If successful
+ **
+ ** add requirements for block "b"
+ **
+ ** If successful
+ **
+ ** combine tf_size
+ **
+ ** combine rw_size
+ **
+ ** update target context from temp
+ **
+ **/
+
+BR_ERR BM_AddRequirements(
+ BUF_REQ_PTR context, /* IO - context to add requirements to */
+ BUF_REQ_PTR newreqs ) /* I - new requirements */
+{
+/*
+** Copy context to temp BUF_REQ
+*/
+ BUF_REQ temp_br = *context;
+/*
+** Add requirements for block "a"
+*/
+ BR_ERR ret_val = AddBlockRequirements( &temp_br.a, &newreqs->a );
+/*
+** If successful
+*/
+ if ( ret_val == BR_NO_ERR ) {
+/*
+** add requirements for block "b"
+*/
+ ret_val = AddBlockRequirements( &temp_br.b, &newreqs->b );
+/*
+** If successful
+*/
+ if ( ret_val == BR_NO_ERR ) {
+/*
+** combine tf_size
+*/
+ if ( temp_br.tf_size != newreqs->tf_size ) {
+ if ( newreqs->tf_size != BR_DONT_CARE ) {
+ if ( temp_br.tf_size != BR_DONT_CARE ) {
+ return BR_ERR_INCOMPATIBLE;
+ } else {
+ temp_br.tf_size = newreqs->tf_size;
+ }
+ }
+ }
+/*
+** combine rw_size
+*/
+ if ( temp_br.rw_size != newreqs->rw_size ) {
+ if ( newreqs->rw_size != BR_DONT_CARE ) {
+ if ( temp_br.rw_size != BR_DONT_CARE ) {
+ return BR_ERR_INCOMPATIBLE;
+ } else {
+ temp_br.rw_size = newreqs->rw_size;
+ }
+ }
+ }
+/*
+** update target context from temp
+*/
+ *context = temp_br;
+ }
+ }
+
+ return ret_val;
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_Get
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Get a buffer from the buffer pool
+ * which meets the pool's current requirements.
+ *
+ * Notes:
+ *
+ * Returns: BUF_PTR
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** For each buffer on pool list
+ **
+ ** If the buffer hasn't been gotten
+ **
+ ** then mark the buffer as gotten and return the buffer
+ **
+ **/
+
+BUF_PTR BM_Get(
+ BUF_LIST_PTR list_ptr ) /* I - describes buffer to Get */
+{
+ BUF_PTR buf_ptr = NULL;
+ Q_ELEM_PTR qe_ptr = QueueHead( &list_ptr->list_header );
+/*
+** For each buffer on pool list
+*/
+ for ( ; qe_ptr != NULL ; qe_ptr = QueueNext( qe_ptr ) ) {
+/*
+** If the buffer hasn't been gotten
+*/
+ if ( !( buf_ptr = (BUF_PTR)QueuePtr( qe_ptr ) )->gotten ) {
+/*
+** then mark the buffer as gotten and return the buffer
+*/
+ BM_InitBuf( buf_ptr );
+ buf_ptr->gotten = TRUE;
+ break;
+ }
+ }
+
+ if ( qe_ptr == NULL ) {
+ return NULL;
+ } else {
+ return buf_ptr;
+ }
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_GetVCBBuff
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Returns a pointer to the lists VCB buffer if has not
+ * already been gotten.
+ *
+ * Notes:
+ *
+ * Returns: BUF_PTR or NULL
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** If the vcb buff hasn't been gotten
+ **
+ ** then mark the buffer as gotten and return the buffer
+ **
+ ** else return NULL
+ **
+ **/
+
+BUF_PTR BM_GetVCBBuff(
+ BUF_LIST_PTR list_ptr ) /* I - describes buffer to Get */
+{
+/*
+** If the vcb buff hasn't been gotten
+*/
+ if ( !list_ptr->vcb_buff->gotten ) {
+/*
+** then mark the buffer as gotten and return the buffer
+*/
+ BM_InitBuf( list_ptr->vcb_buff );
+ list_ptr->vcb_buff->gotten = TRUE;
+ return list_ptr->vcb_buff;
+ } else {
+/*
+** else return NULL
+*/
+ msassert( FALSE );
+ return NULL;
+ }
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_InitBuf
+ *
+ * Modified: Monday, October 7, 1991
+ *
+ * Description: clear out the TF fields (counts and offsets) in a buffer
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID BM_InitBuf(
+ BUF_PTR buf_ptr ) /* I - buffer to initialize */
+{
+ msassert( buf_ptr != NULL );
+
+ if ( buf_ptr != NULL ) {
+
+ BM_SetBytesFree( buf_ptr, BM_TFSize( buf_ptr ) );
+ BM_SetNoDblks( buf_ptr, 0 );
+ BM_SetNextByteOffset( buf_ptr, 0 );
+ BM_SetBeginningLBA( buf_ptr, 0 );
+ BM_SetReadError( buf_ptr, 0 );
+ BM_UnReserve( buf_ptr );
+
+ memset( BM_NextBytePtr( buf_ptr ), '\0', BM_TFSize( buf_ptr ) ) ;
+
+ SetQueueElemPtr( &buf_ptr->tf_qe, buf_ptr );
+ SetQueueElemPtr( &buf_ptr->bm_qe, buf_ptr );
+ }
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_UpdCnts
+ *
+ * Modified: Monday, October 7, 1991
+ *
+ * Description: Use some of the remaining bytes in a buffer.
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID BM_UpdCnts(
+ BUF_PTR buf_ptr , /* (IO) - The current buffer */
+ UINT16 amount ) /* (I) - The amount of space used */
+{
+ if ( buf_ptr ) {
+ buf_ptr->bytes_free -= amount ;
+ buf_ptr->next_byte += amount ;
+ }
+}
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_UseAll
+ *
+ * Modified: Monday, October 7, 1991
+ *
+ * Description: consume all the remaining bytes in a buffer
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID BM_UseAll(
+ BUF_PTR buf_ptr ) /* IO - the buffer to use up */
+{
+ msassert( buf_ptr != NULL );
+
+ if ( buf_ptr != NULL ){
+ BM_UpdCnts( buf_ptr, buf_ptr->bytes_free ) ;
+ }
+}
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_PutAll
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Do a BM_Put on all buffers in a pool
+ *
+ * Notes: This should replace all the many loops in TF where
+ * we put all the buffers.
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** For each buffer on pool list
+ **
+ **/
+
+VOID BM_PutAll(
+ BUF_LIST_PTR list_ptr ) /* I/O - list to Put */
+{
+ BUF_PTR buf_ptr ;
+ Q_ELEM_PTR qe_ptr = QueueHead( &list_ptr->list_header );
+/*
+** For each buffer on pool list
+*/
+ for ( ; qe_ptr != NULL ; qe_ptr = QueueNext( qe_ptr ) ) {
+ buf_ptr = (BUF_PTR)QueuePtr( qe_ptr );
+ msassert( buf_ptr != NULL );
+ BM_Put( buf_ptr ) ;
+ }
+
+ BM_Put( list_ptr->vcb_buff ) ;
+}
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_FreeAll
+ *
+ * Modified: Tuesday, January 28, 1992
+ *
+ * Description: Do a BM_Free on all buffers in a pool;
+ *
+ * Notes: This should replace all the many loops in TF where
+ * we put all the buffers.
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** For each buffer on pool list
+ **
+ ** If the buffer is not reserved
+ **
+ ** Free the buffer
+ **
+ ** call OS-specific (DOS, of course) code to reserve
+ ** any buffers which may be left
+ **
+ **/
+
+VOID BM_FreeAll(
+ BUF_LIST_PTR list_ptr ) /* I/O - list to Free */
+{
+ BUF_PTR buf_ptr ;
+ Q_ELEM_PTR qe_ptr = QueueHead( &list_ptr->list_header );
+/*
+** For each buffer on pool list
+*/
+ while ( qe_ptr != NULL ) {
+ buf_ptr = (BUF_PTR)QueuePtr( qe_ptr );
+ qe_ptr = QueueNext( qe_ptr ); /* get it before we free it! */
+ msassert( buf_ptr != NULL );
+/*
+** If the buffer is not reserved
+*/
+ if ( !buf_ptr->reserved ) {
+/*
+** Free the buffer
+*/
+ BM_Free( list_ptr, buf_ptr ) ;
+
+ }
+ }
+
+/*
+** call OS-specific (DOS, of course) code to reserve
+** any buffers which may be left
+*/
+ BM_OS_CleanupList( list_ptr );
+}
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_SetVCBRequirements
+ *
+ * Modified: Friday, December 20, 1991
+ *
+ * Description: Set the buffer manager's idea of the VCB requirements
+ *
+ * Notes: Argument must point to statically allocated memory
+ * (no copying is done)
+ *
+ * Returns: VOID
+ *
+ * Global Data: sets uw_vcb_requirements
+ *
+ * Processing:
+ *
+ **/
+
+VOID BM_SetVCBRequirements(
+ BUF_REQ_PTR vcb_reqs ) /* I - points to vcb requirements structure */
+{
+ uw_vcb_requirements = vcb_reqs;
+}
+
+
+
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_RequiredSize
+ *
+ * Modified: Friday, October 18, 1991
+ *
+ * Description: Returns the amount of memory required for a buffer
+ * given specific requirements
+ *
+ * Notes:
+ *
+ * Returns: UINT32 (size of allocation)
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+UINT32 BM_RequiredSize(
+ BUF_REQ_PTR br_ptr ) /* I - requirements pointer */
+{
+ return
+ sizeof( BUF )
+ + br_ptr->a.min_size
+ + BM_RESERVED_SIZE
+ + ( ( br_ptr->b.min_size == BR_DONT_CARE ) ? 0 : br_ptr->b.min_size );
+}
+
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_BufferOverhead
+ *
+ * Modified: Friday, October 18, 1991
+ *
+ * Description: Return the amount of memory used by a (hypothetical) buffer
+ * if it has 0 bytes of main and auxiliary allocation.
+ *
+ *
+ * Notes:
+ *
+ * Returns: UINT16 (size of overhead)
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+UINT16 BM_BufferOverhead( VOID )
+{
+ return sizeof( BUF ) + BM_RESERVED_SIZE ;
+}
+
diff --git a/private/utils/ntbackup/src/buffnt.c b/private/utils/ntbackup/src/buffnt.c
new file mode 100644
index 000000000..5389bbdb1
--- /dev/null
+++ b/private/utils/ntbackup/src/buffnt.c
@@ -0,0 +1,569 @@
+/**
+
+ Name: buffnt.c
+
+ Description: This unit provides the operating-system specific
+ functions needed for allocation, de-allocation,
+ and resizing of the buffers used by Tape Format
+ routines for transfers to and from the device drivers.
+
+ $Log: T:\logfiles\buffnt.c_v $
+
+ Rev 1.13 28 Jan 1994 18:25:12 GREGG
+Fixed MIPS 16 byte alignment requirement bug.
+
+ Rev 1.12 25 Jan 1994 14:21:28 STEVEN
+add support for non aligned allocations on mips
+
+ Rev 1.11 10 Jun 1993 08:06:06 MIKEP
+enable c++
+
+ Rev 1.10 17 Mar 1993 14:52:50 GREGG
+This is Terri Lynn. Added Gregg's changes to switch a tape drive's block mode
+to match the block size of the current tape.
+
+ Rev 1.9 09 Mar 1993 18:14:18 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.8 14 Jan 1993 16:21:52 DAVEV
+chg PUSHORT to UINT16_PTR
+
+ Rev 1.7 11 Nov 1992 11:01:06 GREGG
+Removed #error message.
+
+ Rev 1.6 18 Aug 1992 09:51:44 BURT
+fix warnings
+
+ Rev 1.5 23 Jul 1992 09:36:42 STEVEN
+fix warnings.
+
+ Rev 1.4 28 Apr 1992 10:45:52 STEVEN
+parallel buffos2
+
+ Rev 1.3 26 Feb 1992 09:25:26 STEVEN
+fix warnings
+
+ Rev 1.2 26 Feb 1992 09:12:20 STEVEN
+added buffnt.h
+
+ Rev 1.1 23 Jan 1992 13:16:42 STEVEN
+typeo for Unlock
+
+ Rev 1.0 21 Jan 1992 12:25:40 STEVEN
+Initial revision.
+
+**/
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+#include "tfl_err.h"
+#include "buffman.h"
+#include "buff_prv.h"
+#include "buffnt.h"
+#include "msassert.h"
+#include "dilhwd.h"
+#include "retbuf.h"
+#include "dil.h"
+
+
+/* For buffer allignment */
+static INT mw_buffer_alignment ;
+
+
+/**
+ * Name: AllocBufferGuts
+ *
+ * Description: allocate internal chunks of BUF
+ * and lock down primary allocation
+ *
+ * Notes:
+ *
+ * Returns: UINT16 error code
+ *
+ **/
+
+static UINT16 _near AllocBufferGuts(
+ BUF_REQ_PTR br_ptr,
+ BUF_PTR buf_ptr )
+{
+ UINT8 remainder ;
+
+ buf_ptr->ptr2 = buf_ptr->ptr1 = NULL ;
+
+ // allocate chunk "a"
+
+ buf_ptr->alloc_size = (UINT16)( br_ptr->a.min_size +
+ BM_RESERVED_SIZE +
+ mw_buffer_alignment * 2 ) ;
+
+ if( ( buf_ptr->ptr1 = calloc( 1, buf_ptr->alloc_size ) ) == NULL ) {
+ return( (UINT16)OUT_OF_MEMORY ) ;
+ }
+
+ // allocate chunk "b" (if any)
+ if( br_ptr->b.min_size != BR_DONT_CARE ) {
+ buf_ptr->aux_size = br_ptr->b.min_size ;
+ if( ( buf_ptr->ptr2 = calloc( 1, buf_ptr->aux_size ) ) == NULL ) {
+ free( buf_ptr->ptr1 ) ;
+ return( (UINT16)OUT_OF_MEMORY ) ;
+ }
+ } else {
+ buf_ptr->aux_size = 0 ;
+ }
+
+ // align buffer as required
+
+ remainder = (UINT8)( ( (DWORD)buf_ptr->ptr1 ) &
+ ( mw_buffer_alignment - 1 ) ) ;
+ (BYTE_PTR)( buf_ptr->ptr1 ) += mw_buffer_alignment - remainder ;
+ *( (UINT8_PTR)( buf_ptr->ptr1 ) ) = mw_buffer_alignment - remainder ;
+ (BYTE_PTR)( buf_ptr->ptr1 ) += mw_buffer_alignment ;
+
+ return( (UINT16)SUCCESS ) ;
+}
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: FreeBufferGuts
+ *
+ * Description: free chunks of memory lurking
+ * inside BUF and unlock primary allocation
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ **/
+
+static VOID _near FreeBufferGuts( BUF_PTR buf_ptr )
+{
+ // Deallocate chunk "b"
+ if( buf_ptr->ptr2 != NULL ) {
+ free( buf_ptr->ptr2 ) ;
+ }
+
+ // Undo byte alignment and deallocate chunk "a"
+ if( buf_ptr->ptr1 != NULL ) {
+ (BYTE_PTR)( buf_ptr->ptr1 ) -= mw_buffer_alignment ;
+ (BYTE_PTR)( buf_ptr->ptr1 ) -= *( (UINT8_PTR)( buf_ptr->ptr1 ) ) ;
+ free( buf_ptr->ptr1 ) ;
+ }
+}
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: AllocBuffer
+ *
+ * Modified: Monday, January 13, 1992
+ *
+ * Description:
+ *
+ * Notes:
+ *
+ * Returns: BUF_PTR
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** allocate BUF structure
+ **
+ ** allocate internal chunks of BUF and lock down primary allocation
+ **
+ ** Init other fields
+ **
+ **/
+
+static BUF_PTR _near AllocBuffer(
+ BUF_LIST_PTR pool_ptr,
+ BUF_REQ_PTR br_ptr )
+{
+ BUF_PTR buf_ptr = NULL;
+
+/*
+** allocate BUF structure
+*/
+ if ( ( buf_ptr = (BUF_PTR)calloc(1, sizeof(BUF) ) ) == NULL ) {
+ return NULL ;
+ }
+
+/*
+** allocate internal chunks of BUF and lock down primary allocation
+*/
+ if ( AllocBufferGuts( br_ptr, buf_ptr ) != SUCCESS ) {
+ free( buf_ptr ) ;
+ return NULL;
+ }
+/*
+** Init other fields
+*/
+ InitQElem( &buf_ptr->tf_qe );
+ InitQElem( &buf_ptr->bm_qe );
+ BM_InitBuf( buf_ptr );
+ buf_ptr->tf_size = br_ptr->tf_size;
+ buf_ptr->rw_size = br_ptr->rw_size;
+ buf_ptr->gotten = FALSE;
+ buf_ptr->reserved = FALSE;
+ buf_ptr->list_ptr = pool_ptr;
+
+ return buf_ptr;
+}
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_Alloc
+ *
+ * Modified: Monday, January 13, 1992
+ *
+ * Description: Allocate a buffer for the given list
+ *
+ * Notes: there is no attempt here to guarantee
+ * any physical alignment
+ *
+ * Returns: BUF_PTR
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** allocate buffer
+ **
+ ** add new BUF to pool
+ **
+ ** update pool memory count
+ **
+ **/
+
+BUF_PTR BM_Alloc(
+ BUF_LIST_PTR pool_ptr ) /* list we're allocating it for */
+{
+ BUF_REQ_PTR br_ptr = &pool_ptr->requirements_context;
+/*
+** allocate buffer
+*/
+ BUF_PTR buf_ptr = AllocBuffer( pool_ptr, br_ptr );
+/*
+** add new BUF to pool
+*/
+ if ( buf_ptr ) {
+ EnQueueElem( &pool_ptr->list_header, &BM_BMQElem( buf_ptr ), FALSE );
+/*
+** update pool memory count
+*/
+ pool_ptr->memory_used += BM_RequiredSize( br_ptr );
+ }
+
+ return buf_ptr;
+}
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_AllocVCB
+ *
+ * Modified: Monday, January 13, 1992
+ *
+ * Description:
+ *
+ * Notes:
+ *
+ * Returns: BUF_PTR
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** allocate buffer
+ **
+ ** add to list
+ **
+ ** update pool memory count
+ **
+ **/
+
+BUF_PTR BM_AllocVCB(
+ BUF_LIST_PTR pool_ptr ) /* I - list to allocate from */
+{
+ BUF_REQ_PTR br_ptr = uw_vcb_requirements;
+/*
+** allocate buffer
+*/
+ BUF_PTR buf_ptr = AllocBuffer( pool_ptr, br_ptr );
+/*
+** add to list
+*/
+ pool_ptr->vcb_buff = buf_ptr ;
+
+ return buf_ptr;
+}
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_Free
+ *
+ * Modified: Monday, January 13, 1992
+ *
+ * Description: Return a buffer to the OS free pool
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** update pool memory count
+ **
+ ** remove buffer from pool
+ **
+ ** free chunks of memory lurking inside BUF
+ **
+ ** de-allocate BUF structure itself
+ **
+ **/
+
+VOID BM_Free(
+ BUF_LIST_PTR pool_ptr, /* list we're freeing it from */
+ BUF_PTR buf_ptr ) /* the buffer to free */
+{
+/*
+** update pool memory count
+*/
+ pool_ptr->memory_used -= sizeof( BUF )
+ + buf_ptr->alloc_size
+ + buf_ptr->aux_size ;
+/*
+** remove buffer from pool
+*/
+ RemoveQueueElem( &pool_ptr->list_header, &buf_ptr->bm_qe );
+/*
+** free chunks of memory lurking inside BUF
+*/
+ FreeBufferGuts( buf_ptr );
+/*
+** de-allocate BUF structure itself
+*/
+ free( buf_ptr ) ;
+}
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_FreeVCB
+ *
+ * Modified: Monday, January 13, 1992
+ *
+ * Description:
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID BM_FreeVCB(
+ BUF_LIST_PTR pool_ptr,
+ BUF_PTR buf_ptr )
+{
+
+ if ( buf_ptr != NULL ) {
+/*
+** check to see if this is really the VCB buffer
+*/
+ msassert( pool_ptr->vcb_buff == buf_ptr ) ;
+/*
+** update pool memory count
+*/
+ pool_ptr->memory_used -= sizeof( BUF )
+ + buf_ptr->alloc_size
+ + buf_ptr->aux_size ;
+/*
+** remove buffer from pool
+*/
+ pool_ptr->vcb_buff = NULL;
+/*
+** free chunks of memory lurking inside BUF
+*/
+ FreeBufferGuts( buf_ptr );
+/*
+** de-allocate BUF structure itself
+*/
+ free( buf_ptr ) ;
+ }
+}
+
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_ReSizeList
+ *
+ * Modified: Wednesday, November 13, 1991
+ *
+ * Description: Re-sizes every buffer on the given list.
+ *
+ * Notes: This may not have to be OS specific...
+ *
+ * Returns: INT16, TFLE_xxx
+ *
+ * Global Data: Nope!
+ *
+ * Processing:
+ *
+ **/
+
+INT16 BM_ReSizeList(
+ BUF_LIST_PTR pool_ptr ) /* I/O -- list to re-size */
+{
+ BUF_PTR buf_ptr ;
+ Q_ELEM_PTR qe_ptr = QueueHead( &pool_ptr->list_header );
+ UINT32 total_memory = 0L;
+
+ /* free all we can, total memory usage of the rest */
+ while ( qe_ptr != NULL ) {
+ buf_ptr = (BUF_PTR)QueuePtr( qe_ptr );
+ qe_ptr = QueueNext( qe_ptr ); /* get it before we free it! */
+ msassert( buf_ptr != NULL );
+ if ( !buf_ptr->gotten ) {
+ BM_Free( pool_ptr, buf_ptr ) ;
+ } else {
+ total_memory += buf_ptr->alloc_size + buf_ptr->aux_size + sizeof( BUF );
+ }
+ }
+
+ /* correct the memory usage of the list */
+ pool_ptr->memory_used = total_memory;
+
+ /* allocate as many buffers as we can given the memory limits */
+ while ( pool_ptr->memory_used + BM_RequiredSize( &pool_ptr->requirements_context )
+ <= pool_ptr->max_memory ) {
+ if ( ( buf_ptr = BM_Alloc( pool_ptr ) ) == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ }
+
+ return TFLE_NO_ERR;
+}
+
+
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_ReSizeBuffer
+ *
+ * Description: Re-sizes the given buffer.
+ *
+ * Notes: This may not have to be OS specific...
+ *
+ * Returns: INT16, TFLE_xxx
+ *
+ * Global Data: Nope!
+ *
+ * Processing:
+ *
+ **/
+
+INT16 BM_ReSizeBuff(
+ BUF_PTR buf_ptr,
+ BUF_LIST_PTR pool_ptr )
+{
+ if( BM_IsVCBBuff( buf_ptr ) ) {
+ BM_FreeVCB( pool_ptr, buf_ptr ) ;
+ if ( ( buf_ptr = BM_AllocVCB( pool_ptr ) ) == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ } else {
+ BM_Free( pool_ptr, buf_ptr ) ;
+ if ( ( buf_ptr = BM_Alloc( pool_ptr ) ) == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ }
+
+ return TFLE_NO_ERR;
+}
+
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_ReallocAux
+ *
+ * Description: Increases the size of the auxiliary buffer based on an
+ * increment value specified in the requirements context.
+ *
+ * Notes:
+ *
+ * Returns: TFLE_xxx error code.
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+INT16 BM_ReallocAux(
+ BUF_LIST_PTR list_ptr,
+ BUF_PTR buf_ptr )
+{
+ UINT16 incr = list_ptr->requirements_context.b.incr_size ;
+ VOID_PTR temp ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ if( ( temp = realloc( buf_ptr->ptr2, buf_ptr->aux_size + incr ) ) != NULL ) {
+ buf_ptr->aux_size += incr ;
+ buf_ptr->ptr2 = temp ;
+ } else {
+ ret_val = TFLE_NO_MEMORY ;
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+ * Unit: Buffer Manager
+ *
+ * Name: BM_OS_InitList
+ *
+ * Description: OS's shot at initialization
+ *
+ * Notes:
+ *
+ * Returns: TFLE_xxx error code.
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+INT16 BM_OS_InitList(
+ BUF_LIST_PTR list_ptr,
+ UINT16 initial_buff_alloc )
+{
+ // Get data transfer buffer alignment requirements
+
+ if( TpGetTapeBuffAlignment( &mw_buffer_alignment ) == SUCCESS ) {
+ if( mw_buffer_alignment == 0 ) {
+ mw_buffer_alignment = BM_NT_DEFAULT_BUF_ALGN_SZ ;
+ }
+ } else {
+ mw_buffer_alignment = BM_NT_DEFAULT_BUF_ALGN_SZ ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+
+ (void)list_ptr ;
+ (void)initial_buff_alloc ;
+}
+
diff --git a/private/utils/ntbackup/src/checksum.c b/private/utils/ntbackup/src/checksum.c
new file mode 100644
index 000000000..ba4b48275
--- /dev/null
+++ b/private/utils/ntbackup/src/checksum.c
@@ -0,0 +1,269 @@
+/**
+Copyright(c) Connor Software, 1984-1993
+
+ Name: checksum.c
+
+ Date Updated: 08-Feb-93
+
+ Description: MTF checksum algorithm
+
+ $Log: N:/LOGFILES/CHECKSUM.C_V $
+
+ Rev 1.6 10 Jun 1993 08:06:58 MIKEP
+enable c++
+
+ Rev 1.5 26 May 1993 14:41:12 DON
+VDEL'd previous changes! The problem was we were overwriting the buff ptr
+during a InsertChecksum - by as little as 3 bytes. There was no guarantee
+tpfmt would give us a buffer with at least 4 bytes left so implemented a
+type of frag logic to deal with this. Also, changed VerifyChecksum to deal
+with the problem of not receiving all 4 bytes at once. My GOD, this was a
+tough bug to find!
+
+ Rev 1.4 31 Mar 1993 08:50:28 MARILYN
+changed over to the MTF checksum algorithm
+
+ Rev 1.3 17 Mar 1993 16:34:36 MARILYN
+made CHECKSUM_32_BITS an external symbolic constant
+
+ Rev 1.2 13 Mar 1993 17:07:40 GREGG
+Expect error return on ALL calls to LP_Send.
+
+ Rev 1.1 01 Mar 1993 17:30:40 MARILYN
+added functions to insert/consume checksum streams
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "datetime.h"
+#include "assert.h"
+#include "dle_str.h"
+#include "queues.h"
+#include "tflproto.h"
+#include "loops.h"
+#include "fsstream.h"
+#include "loop_prv.h"
+#include "checksum.h"
+
+INT16 mwChecksumBytesNeeded ;
+
+/**/
+/**
+ Name: Checksum_Init( checksum_ptr )
+
+ Description: sets checksum_ptr to a 0 and mwChecksumBytesNeeded to 0
+
+ Modified: 12/11/92 Don C
+
+ Returns: Nothing.
+
+ Notes:
+
+**/
+VOID Checksum_Init ( UINT32_PTR checksum_ptr )
+{
+ *checksum_ptr = 0x00000000;
+ mwChecksumBytesNeeded = 0 ;
+}
+
+
+/**/
+/**
+ Name: Checksum_Block( checksum_ptr, data_ptr, data_len )
+
+ Description: updates checksum_ptr with a running checksum of the data
+ provided by data_ptr.
+
+ Modified: 12/11/92
+
+ Returns: The checksum computed.
+
+ Notes:
+
+**/
+UINT32 Checksum_Block ( UINT32_PTR checksum_optr,
+ VOID_PTR data_ptr,
+ UINT32 data_len )
+{
+ UINT32 UNALIGNED * checksum_ptr = (UINT32 UNALIGNED *)checksum_optr ;
+ UINT32 checksum = *checksum_ptr ;
+ UINT32 UNALIGNED * p ; /* data pointer */
+ UINT8_PTR rp ; /* Remainder pointer */
+ UINT32 len ; /* Number of 4-byte chunks */
+
+ rp = ( UINT8_PTR )data_ptr ;
+
+ while( mwChecksumBytesNeeded && data_len ) {
+
+ p = ( UINT32 UNALIGNED *)rp ;
+
+ checksum ^= (*p & 0xFF) << ( ( 4 - mwChecksumBytesNeeded ) << 3 ) ;
+ mwChecksumBytesNeeded -- ;
+ data_len -- ;
+ rp ++ ;
+ }
+
+ p = ( UINT32 UNALIGNED *)rp ;
+ len = data_len >> 2 ;
+
+ while ( len ) {
+
+ checksum ^= *p ;
+ len -- ;
+ p ++ ;
+ }
+
+ data_len &= 3 ;
+ if ( data_len ) {
+
+ mwChecksumBytesNeeded = 4 ;
+ rp = ( UINT8_PTR )p ;
+
+ while ( data_len ) {
+
+ p = ( UINT32 UNALIGNED *)rp ;
+ checksum ^= (*p & 0xFF) << ( ( 4 - mwChecksumBytesNeeded ) << 3 ) ;
+ mwChecksumBytesNeeded -- ;
+ data_len -- ;
+ rp ++ ;
+
+ }
+ }
+
+ return *checksum_ptr = checksum ;
+
+}
+
+
+/**/
+/**
+ Name: LP_InsertChecksumStream( checksum, lp )
+
+ Description: Puts a stream on the tape with checksum as the only stream
+ data.
+
+ Modified: 02/08/93 Marilyn P.
+
+ Returns: the return value of the LP_Send
+
+ Notes:
+
+**/
+INT16 LP_InsertChecksumStream(
+ UINT32 checksum, /* I - the checksum to be place on tape */
+ LP_ENV_PTR lp ) /* I - the environment struct for the loop */
+{
+ INT16 ret_val;
+ INT16 size_diff ;
+
+ lp->rr.stream.id = STRM_CHECKSUM_DATA ;
+ lp->rr.stream.fs_attrib = 0 ;
+ lp->rr.stream.tf_attrib = 0 ;
+ lp->rr.stream.size = U64_Init( 4, 0 ) ;
+ lp->rr.buff_used = 0 ;
+
+ if ( ( ret_val = LP_Send( lp, TRUE ) ) == SUCCESS ) {
+
+ /* only copy amount left in buffer */
+ memcpy( lp->rr.buff_ptr, (BYTE *)&checksum, lp->rr.buff_size ) ;
+
+ lp->rr.stream.id = STRM_INVALID ;
+ lp->buf_start = (INT8_PTR)lp->rr.buff_ptr ;
+ lp->rr.buff_used = lp->rr.buff_size ;
+
+ /* save difference in case we couldn't write the whole buffer */
+ size_diff = 4 - lp->rr.buff_size;
+
+ ret_val = LP_Send( lp, TRUE ) ;
+
+ /* if we couldn't actually write the whole 4 bytes */
+ if ( size_diff && ( ret_val == SUCCESS ) )
+ {
+ /* insure tpfmt returned what we expected */
+ msassert ( size_diff == lp->rr.buff_size );
+
+ /* copy the remainder into buffer */
+ memcpy( lp->rr.buff_ptr,
+ (BYTE *)&checksum + ( 4 - size_diff ), size_diff ) ;
+
+ lp->rr.stream.id = STRM_INVALID ;
+ lp->buf_start = (INT8_PTR)lp->rr.buff_ptr ;
+ lp->rr.buff_used = size_diff ;
+
+ /* send the rest of the buffer */
+ ret_val = LP_Send( lp, TRUE ) ;
+ }
+ }
+
+ return ret_val ;
+}
+
+
+/**/
+/**
+ Name: LP_VerifyChecksumStream( checksum, lp )
+
+ Description: Consumes a checksum stream off the tape and compares the
+ checksum value stored within it to checksum value passed in.
+
+ Modified: 02/08/93 Marilyn P.
+
+ Returns: FS_CRC_FAILURE
+ FS_STREAM_NOT_FOUND
+
+ Notes:
+
+**/
+INT16 LP_VerifyChecksumStream(
+ UINT32 checksum, /* I - the checksum data to match */
+ LP_ENV_PTR lp ) /* I - the loop environment structure */
+{
+ INT16 ret_val = SUCCESS;
+ UINT32 tapeChecksum = 0;
+ INT16 size_diff;
+ UINT8 frag_buff[4];
+
+ /* if the size of the stream data is larger than the size of the */
+ /* checksum data or if this is not a checksum stream, we have a prob */
+ if ( lp->rr.stream.id != STRM_CHECKSUM_DATA ) {
+ ret_val = FS_STREAM_NOT_FOUND ;
+ } else {
+
+ /* get the checksum data itself */
+ ret_val = LP_ReceiveData( lp, 0L ) ;
+
+ if ( lp->rr.buff_size != 4 ) {
+
+ size_diff = 4 - lp->rr.buff_size;
+ memcpy( frag_buff, lp->rr.buff_ptr, lp->rr.buff_size );
+
+ ret_val = LP_ReceiveData( lp, lp->rr.buff_size );
+
+ msassert( size_diff == lp->rr.buff_size );
+
+ memcpy( &frag_buff[ 4 - size_diff], lp->rr.buff_ptr, size_diff );
+
+ memcpy( (BYTE *)&tapeChecksum, frag_buff, 4 );
+
+ } else {
+
+ /* simply copy the date to the tape checksum */
+ memcpy( (BYTE *)&tapeChecksum, lp->rr.buff_ptr, lp->rr.buff_size ) ;
+
+ }
+ /* compare the two checksums */
+ if ( tapeChecksum != checksum ) {
+ ret_val = FS_CRC_FAILURE ;
+ }
+ }
+
+ return ret_val ;
+}
+
+
+
+/*--- end of file checksum.c ---*/
diff --git a/private/utils/ntbackup/src/clearfsl.c b/private/utils/ntbackup/src/clearfsl.c
new file mode 100644
index 000000000..72d3f957f
--- /dev/null
+++ b/private/utils/ntbackup/src/clearfsl.c
@@ -0,0 +1,136 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: clearfsl.c
+
+ Description: This file contains code to release all FSEs associated
+ resources held by a BSD.
+
+
+ $Log: N:/LOGFILES/CLEARFSL.C_V $
+
+ Rev 1.4 10 Jun 1993 08:07:54 MIKEP
+enable c++
+
+ Rev 1.3 12 Aug 1991 16:00:14 STEVEN
+do not want to VM_Free NULL
+
+ Rev 1.2 12 Jun 1991 16:02:38 STEVEN
+BSDU code review
+
+ Rev 1.1 29 May 1991 17:21:30 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:36:54 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "vm.h"
+
+#include "bsdu.h"
+#include "msassert.h"
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: BSD_ClearALLFSE()
+
+ Description: This function removes all File Selection Elements from
+ a BSD. All memory allocated for every FSE in the list is released.
+
+ Modified: 5/17/1991 14:59:52
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE(), BSD_RemoveFSE() )$
+
+ Declaration:
+
+**/
+VOID BSD_ClearAllFSE(
+BSD_PTR bsd ) /* I - BSD to remove FSEs from */
+{
+ FSE_PTR fse ;
+
+ msassert( bsd != NULL );
+
+ fse = (FSE_PTR)QueueHead( &(bsd->fse_q_hdr) ) ;
+
+ while ( fse != NULL ) {
+
+ BSD_RemoveFSE( fse ) ;
+ fse = (FSE_PTR)QueueHead( &(bsd->fse_q_hdr) ) ;
+
+ }
+
+ bsd->select_status = NONE_SELECTED ;
+
+}
+
+/**/
+/**
+
+ Name: BSD_ClearAllLBA()
+
+ Description: This function removes all File Selection Elements from
+ a BSD. All memory allocated for every FSE in the list is released.
+
+ Modified: 5/17/1991 15:1:58
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE(), BSD_RemoveFSE() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_ClearAllLBA(
+BSD_PTR bsd ) /* I - BSD to remove FSEs from */
+{
+ BSD_HAND bsdh ;
+ VM_HDL vm_hand ;
+ VM_PTR vm_lba ;
+ VM_PTR vm_lba_next ;
+ LBA_ELEM_PTR lba ;
+
+ msassert( bsd != NULL );
+
+ bsdh = (BSD_HAND)GetQueueElemPtr( &bsd->q ) ;
+ vm_hand = bsdh->vm_hand ;
+
+ vm_lba_next = bsd->lba_vm_q_head ;
+
+ while ( vm_lba_next != 0 ) {
+
+ vm_lba = vm_lba_next ;
+
+ lba = (LBA_ELEM_PTR)VM_MemLock( vm_hand, vm_lba, VM_READ_ONLY ) ;
+ if ( lba != 0 ) {
+ vm_lba_next = lba->next ;
+ VM_MemUnLock( vm_hand, vm_lba ) ;
+
+ } else {
+ vm_lba_next = 0 ;
+ }
+
+ VM_Free( vm_hand, vm_lba ) ;
+
+ }
+
+ bsd->lba_vm_q_head = 0 ;
+ bsd->lba_vm_q_tail = 0 ;
+
+}
diff --git a/private/utils/ntbackup/src/cli_stub.c b/private/utils/ntbackup/src/cli_stub.c
new file mode 100644
index 000000000..41fabaa9d
--- /dev/null
+++ b/private/utils/ntbackup/src/cli_stub.c
@@ -0,0 +1,72 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: cli_stub.c
+
+ Description: Functions to handle critical sections
+
+ $Log: P:/LOGFILES/CLI_STUB.C_V $
+
+ Rev 1.0 17 Jan 1992 17:18:00 STEVEN
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+#include "cli.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: EnableInterrupts
+
+ Description: This routine calls DosExitCritSec( )
+
+ Modified: 5/21/1990
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+BOOLEAN EnableInterrupts( )
+{
+
+ return( TRUE ) ;
+
+}
+
+/**/
+/**
+
+ Name: DisableInterrupts
+
+ Description: This routine calls DosEnterCritSec( )
+
+ Modified: 5/21/1990
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+BOOLEAN DisableInterrupts( )
+{
+
+
+ return( TRUE ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/confmisc.c b/private/utils/ntbackup/src/confmisc.c
new file mode 100644
index 000000000..da83a18b2
--- /dev/null
+++ b/private/utils/ntbackup/src/confmisc.c
@@ -0,0 +1,828 @@
+/******************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: confmisc.c
+
+ Description:
+
+ $Log: G:\ui\logfiles\confmisc.c_v $
+
+ Rev 1.19 13 Aug 1993 16:06:52 GLENN
+Ifdef'd out the catalog and data path setting part of validation for Microsoft.
+
+ Rev 1.18 08 Jul 1993 17:59:50 GLENN
+Added auto detection of DATA and CATALOG paths.
+
+ Rev 1.17 10 Jun 1993 08:16:24 MIKEP
+enable c++
+
+ Rev 1.16 07 Jun 1993 10:07:56 GLENN
+Writing out default User and Catalog data paths if none are present in INI file.
+
+ Rev 1.15 18 May 1993 14:58:02 GLENN
+Now initializing the INI file name.
+
+ Rev 1.14 30 Apr 1993 15:40:32 GLENN
+Added CDS_SetUserDataPath(), CDS_SetCatDataPath(),
+CDS_GetIniFileName(), CDS_SetIniFileName(), CDS_UsingCmdLineIni()
+for Command line INI support.
+
+ Rev 1.13 01 Nov 1992 15:44:34 DAVEV
+Unicode changes
+
+ Rev 1.12 07 Oct 1992 14:12:16 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.11 04 Oct 1992 19:32:24 DAVEV
+Unicode Awk pass
+
+ Rev 1.10 10 Sep 1992 17:50:08 DAVEV
+Integrate MikeP's changes from Microsoft
+
+ Rev 1.9 29 May 1992 15:59:16 JOHNWT
+PCH updates
+
+ Rev 1.8 23 Mar 1992 11:53:38 GLENN
+Added bad data and catalog path warning support.
+
+ Rev 1.7 09 Mar 1992 09:31:54 GLENN
+Fixed a bug in change to exe dir.
+
+ Rev 1.6 27 Feb 1992 08:38:26 GLENN
+Added SetupExePath and ChangeToExeDir functions.
+
+ Rev 1.5 23 Feb 1992 13:46:18 GLENN
+Moved INI util functions to confmisc.c
+
+ Rev 1.4 20 Jan 1992 09:28:44 GLENN
+Rewrote Set calls for user and catalog data paths.
+
+ Rev 1.3 10 Jan 1992 11:19:08 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.2 07 Jan 1992 17:29:22 GLENN
+Added catalog data path support
+
+ Rev 1.1 26 Nov 1991 13:28:40 DAVEV
+
+ Rev 1.0 20 Nov 1991 19:19:44 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+extern CDS PermCDS;
+extern CDS TempCDS;
+
+// MODULE-WIDE VARIABLES
+
+static CHAR mwszIniFileName[ MAX_UI_SMALLRES_SIZE ] = { TEXT('\0') };
+static CHAR mwszMaynDir[ MAX_MAYN_FOLDER_SIZE ] = { TEXT('\0') };
+static LPSTR mwpBadUserPath = (LPSTR)NULL;
+static LPSTR mwpBadCatPath = (LPSTR)NULL;
+static BOOL mwfUsingCmdLineINI = FALSE;
+
+
+#define def_drv( ) TEXT('C')
+
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: CDS_LoadIniFileName()
+
+ Description: Load the INI file name from the resource string table.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_LoadIniFileName ( VOID )
+{
+ RSM_StringCopy ( IDS_INIFILENAME, mwszIniFileName, sizeof ( mwszIniFileName ) );
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetIniFileName()
+
+ Description: Get the INI file name from the module wide variable.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_GetIniFileName (
+
+LPSTR pszDestString,
+INT nDestStringLen )
+
+{
+ strncpy ( pszDestString, mwszIniFileName, nDestStringLen );
+}
+
+
+/******************************************************************************
+
+ Name: CDS_SetIniFileName()
+
+ Description: Set the INI file name from the passed string.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_SetIniFileName (
+
+LPSTR pszNewFileName )
+
+{
+ // Validate the file name.
+
+ if ( TRUE ) {
+ mwfUsingCmdLineINI = TRUE;
+ }
+ else {
+ mwfUsingCmdLineINI = FALSE;
+ CDS_LoadIniFileName ();
+ }
+
+ strncpy ( mwszIniFileName, pszNewFileName, sizeof ( mwszIniFileName ) );
+}
+
+
+/******************************************************************************
+
+ Name: CDS_UsingCmdLineINI()
+
+ Description: Says if we are using a command line INI.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+BOOL CDS_UsingCmdLineINI ( VOID )
+
+{
+ return mwfUsingCmdLineINI;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetPerm()
+
+ Description: Returns address of permanent configuration structure
+ to the caller
+
+ Returns: Returns a pointer to the permanent config
+
+******************************************************************************/
+
+CDS_PTR CDS_GetPerm( )
+{
+ return &PermCDS ;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetPermBEC()
+
+ Description: Returns address of permanent configuration structure
+ of the BACKUP ENGINE CONFIGURATION STRUCTURE.
+
+ Returns: Returns a pointer to the permanent BEC.
+
+******************************************************************************/
+
+BE_CFG_PTR CDS_GetPermBEC( )
+{
+ return PermCDS.pPermBEC ;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetCopy()
+
+ Description: Returns a pointer to the config runtime structure
+
+ Returns: Returns a pointer to the config runtime structure
+
+******************************************************************************/
+
+CDS_PTR CDS_GetCopy( )
+{
+ return &TempCDS ;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_UpdateCopy
+
+ Description: Updates the runtime config structure from the permanent
+ config
+
+ Returns: VOID
+
+******************************************************************************/
+
+VOID CDS_UpdateCopy( )
+{
+ TempCDS = PermCDS ;
+ return ;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetDefaultDrive
+
+ Description: Returns character pointer to desired default drive
+ device name from the specified config structure
+
+ Returns: CHAR_PTR to desired device name
+
+******************************************************************************/
+
+CHAR_PTR CDS_GetDefaultDrive(
+
+ CDS_PTR conf_ptr,
+ INT16 device_num )
+
+{
+ DEF_DRIVE_ENTRY *def_drive = CDS_GetDefaultDriveList( conf_ptr ) ;
+ INT16 i = 0 ;
+
+ while ( def_drive != NULL ) {
+
+ if ( i == device_num ) {
+
+ return ( def_drive->drive_name ) ;
+ }
+
+ def_drive = def_drive->next ;
+ i++ ;
+ }
+
+ return NULL;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_SetMaynFolder()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_SetMaynFolder( CHAR_PTR name )
+
+{
+ INT i;
+
+ strcpy( mwszMaynDir, name ) ;
+ i = strlen( name ) ;
+ if ( name[i-1] != TEXT('\\') ) {
+ strcat( mwszMaynDir, TEXT("\\") ) ;
+ }
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetMaynFolder()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+CHAR_PTR CDS_GetMaynFolder( )
+
+{
+ return mwszMaynDir ;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_ValidateUserDataPath ()
+
+ Description:
+
+ Returns: SUCCESS, if the path passed in was valid. Otherwise,
+ FAILURE.
+
+******************************************************************************/
+
+BOOL CDS_ValidateUserDataPath (
+
+CHAR_PTR szPath )
+
+{
+ INT i;
+ CHAR szTempPath[MAX_UI_PATH_SIZE];
+
+
+ if ( strlen ( szPath ) ) {
+ strcpy ( szTempPath, szPath ) ;
+ }
+ else {
+
+ strcpy ( CDS_GetUserDataPath (), CDS_GetExePath () );
+
+# ifndef OEM_MSOFT
+ {
+ RSM_StringCopy ( IDS_DEFDATAPATH, szTempPath, sizeof ( szTempPath ) );
+
+ strcat ( CDS_GetUserDataPath (), szTempPath );
+
+ // If the path is invalid, set the data path to the EXE path.
+
+ if ( _chdir ( CDS_GetUserDataPath () ) ) {
+
+ strcpy ( CDS_GetUserDataPath (), CDS_GetExePath () );
+ }
+
+ CDS_WriteUserDataPath ( &PermCDS );
+ }
+# endif
+
+ strcpy ( szTempPath, CDS_GetUserDataPath () );
+ }
+
+ strupr ( szTempPath );
+
+ i = strlen( szTempPath ) ;
+
+ // Now, slap a backslash on the end of the path, if there isn't one.
+
+ if ( szTempPath[i-1] != TEXT('\\') ) {
+ strcat( szTempPath, TEXT("\\") ) ;
+ }
+
+ strcpy ( CDS_GetUserDataPath (), szTempPath );
+
+ i = strlen ( szTempPath );
+
+ // If need be, temporarily remove the backslash for checking for a valid
+ // path.
+
+ if ( i > 1 && szTempPath[i-1] == TEXT('\\') && szTempPath[i-2] != TEXT(':') ) {
+ szTempPath[i-1] = TEXT('\0');
+ }
+
+ // If the path is invalid, set the data path to the EXE path.
+
+ if ( _chdir ( szTempPath ) ) {
+
+ mwpBadUserPath = (CHAR_PTR)calloc ( sizeof ( CHAR ), strlen ( CDS_GetUserDataPath () ) + 1 );
+ strcpy ( mwpBadUserPath, CDS_GetUserDataPath () );
+ strcpy ( CDS_GetUserDataPath (), CDS_GetExePath () );
+ return FAILURE;
+ }
+
+ return SUCCESS;
+
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetUserDataPath()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+CHAR_PTR CDS_GetUserDataPath ( VOID )
+
+{
+ return PermCDS.data_path;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_SetUserDataPath()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_SetUserDataPath (
+
+CHAR_PTR pszNewPath )
+
+{
+ strncpy ( PermCDS.data_path, pszNewPath, sizeof ( PermCDS.data_path ) );
+}
+
+
+/******************************************************************************
+
+ Name: CDS_ValidateCatDataPath ()
+
+ Description:
+
+ Returns: SUCCESS, if the path passed in was valid. Otherwise,
+ FAILURE.
+
+******************************************************************************/
+
+BOOL CDS_ValidateCatDataPath (
+
+CHAR_PTR szPath )
+
+{
+ INT i;
+ CHAR szTempPath[MAX_UI_PATH_SIZE];
+
+ if ( strlen ( szPath ) ) {
+ strcpy ( szTempPath, szPath ) ;
+ }
+ else {
+
+ strcpy ( CDS_GetCatDataPath (), CDS_GetExePath () );
+
+# ifndef OEM_MSOFT
+ {
+ RSM_StringCopy ( IDS_DEFCATPATH, szTempPath, sizeof ( szTempPath ) );
+
+ strcat ( CDS_GetCatDataPath (), szTempPath );
+
+ // If the path is invalid, set the data path to the DATA path.
+
+ if ( _chdir ( CDS_GetCatDataPath () ) ) {
+
+ strcpy ( CDS_GetCatDataPath (), CDS_GetUserDataPath () );
+ }
+
+ CDS_WriteCatDataPath ( &PermCDS );
+ }
+# endif
+
+ strcpy ( szTempPath, CDS_GetCatDataPath () );
+ }
+
+ strcpy ( szTempPath, szPath ) ;
+ strupr ( szTempPath );
+
+ i = strlen( szTempPath ) ;
+
+ // Now, slap a backslash on the end of the path, if there isn't one.
+
+ if ( szTempPath[i-1] != TEXT('\\') ) {
+ strcat( szTempPath, TEXT("\\") ) ;
+ }
+
+ strcpy ( CDS_GetCatDataPath (), szTempPath );
+
+ i = strlen ( szTempPath );
+
+ // If need be, temporarily remove the backslash for checking for a valid
+ // path.
+
+ if ( i > 1 && szTempPath[i-1] == TEXT('\\') && szTempPath[i-2] != TEXT(':') ) {
+ szTempPath[i-1] = TEXT('\0');
+ }
+
+ // If the path is invalid, set the data path to the User Data path.
+
+ if ( _chdir ( szTempPath ) ) {
+
+ mwpBadCatPath = (CHAR_PTR)calloc ( sizeof ( CHAR ), strlen ( CDS_GetCatDataPath () ) + 1 );
+ strcpy ( mwpBadCatPath, CDS_GetCatDataPath () );
+ strcpy ( CDS_GetCatDataPath (), CDS_GetUserDataPath () );
+ return FAILURE;
+ }
+
+ return SUCCESS;
+
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetCatDataPath()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+CHAR_PTR CDS_GetCatDataPath ( VOID )
+
+{
+ return PermCDS.cat_path;
+}
+
+
+/******************************************************************************
+
+ Name: CDS_SetCatDataPath()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_SetCatDataPath (
+
+CHAR_PTR pszNewPath )
+
+{
+ strncpy ( PermCDS.cat_path, pszNewPath, sizeof ( PermCDS.cat_path ) );
+}
+
+
+/******************************************************************************
+
+ Name: CDS_GetExePath()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+CHAR_PTR CDS_GetExePath ( VOID )
+
+{
+ return gb_exe_path;
+}
+
+
+/*****************************************************************************
+
+ Name: CDS_SetupExePath ()
+
+ Description: This function initializes the global exe path and the
+ gb_exe_fname globals.
+
+ Returns: Nothing.
+
+*****************************************************************************/
+
+VOID CDS_SetupExePath ( VOID )
+
+{
+ LPSTR pIndex ;
+
+ // Get the .EXE path
+
+ GetModuleFileName ( (HMODULE)ghInst, CDS_GetExePath (), MAX_UI_PATH_LEN );
+
+ pIndex = strrchr ( CDS_GetExePath (), TEXT('\\') );
+ pIndex++;
+ strcpy( gb_exe_fname, pIndex ) ;
+ *pIndex = TEXT('\0');
+
+ if (GetTempPath( MAX_UI_PATH_LEN, gb_exe_path ) > MAX_UI_PATH_LEN ) {
+ GetCurrentDirectory( MAX_UI_PATH_LEN, gb_exe_path ) ;
+ }
+
+
+} /* end CDS_SetupExePath() */
+
+
+/*****************************************************************************
+
+ Name: CDS_ChangeToExeDir ()
+
+ Description: This function sets the current directory to the executable
+ directory.
+
+ Returns: Nothing.
+
+*****************************************************************************/
+
+VOID CDS_ChangeToExeDir ( VOID )
+
+{
+ CHAR szTempPath[MAX_UI_PATH_SIZE];
+ LPSTR pIndex ;
+
+
+ // Get the .EXE path
+
+ GetModuleFileName ( (HMODULE)ghInst, szTempPath, sizeof ( szTempPath ) );
+
+ pIndex = strrchr ( szTempPath, TEXT('\\') );
+ *pIndex = TEXT('\0');
+
+ _chdir ( szTempPath );
+
+} /* end CDS_ChangeToExeDir() */
+
+
+/******************************************************************************
+
+ Name: CDS_CheckForBadPaths()
+
+ Description:
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_CheckForBadPaths ( VOID )
+
+{
+ CHAR szMessage[MAX_UI_RESOURCE_SIZE];
+
+
+ if ( mwpBadUserPath ) {
+
+ RSM_Sprintf ( szMessage, ID(IDS_BADUSERDATAPATH), mwpBadUserPath, CDS_GetUserDataPath () );
+ WM_MsgBox ( ID(IDS_APPNAME), szMessage, WMMB_OK, WMMB_ICONEXCLAMATION );
+ free ( mwpBadUserPath );
+ }
+
+ if ( mwpBadCatPath ) {
+
+ RSM_Sprintf ( szMessage, ID(IDS_BADCATDATAPATH), mwpBadCatPath, CDS_GetCatDataPath () );
+ WM_MsgBox ( ID(IDS_APPNAME), szMessage, WMMB_OK, WMMB_ICONEXCLAMATION );
+ free ( mwpBadCatPath );
+ }
+
+} /* end CDS_CheckForBadPaths() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetLongInt ()
+
+ Description: Gets a 32-bit integer or hexidecimal number from the
+ private profile file.
+
+ Returns: The integer or the default value.
+
+******************************************************************************/
+
+DWORD CDS_GetLongInt (
+
+LPSTR pAppName, // I - application name
+LPSTR pKeyName, // I - key name
+DWORD dwDefault ) // I - default value
+
+{
+ CHAR pLine[20];
+ INT nBytes;
+ LPSTR p;
+
+ nBytes = GetPrivateProfileString( pAppName, pKeyName, TEXT(""), pLine, 20, mwszIniFileName );
+
+ if ( nBytes > 0 ) {
+
+ p = strlwr ( pLine );
+
+ CDS_SkipBlanks ( p );
+
+ if ( strstr ( p, TEXT("0x") ) ) {
+ p++;p++;
+ sscanf ( p, TEXT("%lx"), &dwDefault );
+ }
+ else {
+ sscanf ( p, TEXT("%lu"), &dwDefault );
+ }
+ }
+
+ return dwDefault;
+
+
+} /* end CDS_GetLongInt() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveInt ()
+
+ Description: Saves an integer in decimal format to the private
+ profile file.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL CDS_SaveInt (
+
+LPSTR pAppName, // I - application name
+LPSTR pKeyName, // I - key name
+DWORD dwValue ) // I - value to save
+
+{
+ CHAR pLine[20];
+
+ sprintf ( pLine, TEXT("%lu"), dwValue );
+
+ return WritePrivateProfileString( pAppName, pKeyName, pLine, mwszIniFileName );
+
+
+} /* end CDS_SaveHexInt() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveHexInt ()
+
+ Description: Saves an integer in hexadecimal format to the private
+ profile file.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL CDS_SaveHexInt (
+
+LPSTR pAppName, // I - application name
+LPSTR pKeyName, // I - key name
+DWORD dwValue ) // I - value to save
+
+{
+ CHAR pLine[20];
+
+ sprintf ( pLine, TEXT("0x%lx"), dwValue );
+
+ return WritePrivateProfileString( pAppName, pKeyName, pLine, mwszIniFileName );
+
+
+} /* end CDS_SaveHexInt() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetString ()
+
+ Description: Saves an integer in hexadecimal format to the private
+ profile file.
+
+ Returns: The number of characters copied into the buffer.
+
+******************************************************************************/
+
+INT CDS_GetString (
+
+LPSTR pAppName, // I - application name
+LPSTR pKeyName, // I - key name
+LPSTR pDefault, // I - default string
+LPSTR pString, // I - destination string
+INT nSize ) // I - destination string size
+
+{
+ return GetPrivateProfileString ( pAppName,
+ pKeyName,
+ pDefault,
+ pString,
+ nSize,
+ mwszIniFileName
+ );
+
+} /* end CDS_GetString() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveString ()
+
+ Description: Saves an string to the private profile file.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL CDS_SaveString (
+
+LPSTR pAppName, // I - application name
+LPSTR pKeyName, // I - key name
+LPSTR pString ) // I - string to save
+
+{
+ return WritePrivateProfileString ( pAppName,
+ pKeyName,
+ pString,
+ mwszIniFileName
+ );
+
+} /* end CDS_SaveString() */
diff --git a/private/utils/ntbackup/src/critstub.c b/private/utils/ntbackup/src/critstub.c
new file mode 100644
index 000000000..c28a6552a
--- /dev/null
+++ b/private/utils/ntbackup/src/critstub.c
@@ -0,0 +1,65 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: critstub.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Stubs out critical error functions.
+
+ $Log: N:/LOGFILES/CRITSTUB.C_V $
+
+ Rev 1.0 04 Jun 1991 19:19:16 BARRY
+Initial revision.
+
+
+**/
+/* begin include list */
+
+#include "stdtypes.h"
+#include "crit_err.h"
+
+/**
+
+ Name: InitCritErrorHandler()
+
+ Description: Makes any initializations neccessary for the
+ critical error handler.
+
+ Modified:
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+/* begin declaration */
+VOID InitCritErrorHandler( BOOLEAN (*crit_err)( CHAR_PTR, UINT16 ) )
+{
+ uw_crit_err = crit_err ; /* Go ahead and assign UI function ptr */
+ uw_critical_error = FALSE ;
+}
+
+/**/
+
+/**
+
+ Name: DeInitCritErrorHandler()
+
+ Description: Does anything necessary to remove the critical
+ error handler.
+
+ Modified:
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+/* begin declaration */
+VOID DeInitCritErrorHandler( VOID )
+{
+ uw_crit_err = NULL ;
+}
+
diff --git a/private/utils/ntbackup/src/crptfile.bmp b/private/utils/ntbackup/src/crptfile.bmp
new file mode 100644
index 000000000..7683f5a70
--- /dev/null
+++ b/private/utils/ntbackup/src/crptfile.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/ctbrkstb.c b/private/utils/ntbackup/src/ctbrkstb.c
new file mode 100644
index 000000000..a400c35c7
--- /dev/null
+++ b/private/utils/ntbackup/src/ctbrkstb.c
@@ -0,0 +1,69 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ctbrkdos.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Stubbed control-break handler.
+
+ $Log: N:/LOGFILES/CTBRKSTB.C_V $
+
+ Rev 1.0 04 Jun 1991 19:19:20 BARRY
+Initial revision.
+
+
+**/
+/* begin include list */
+
+#include "stdtypes.h"
+
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: BE_InstallCtrlBreakHandler()
+
+ Description: Installs the control-break and control-c handlers.
+
+ Modified:
+
+ Notes:
+
+ See also: $/SEE(be_init.c)$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BE_InstallCtrlBreakHandler( VOID )
+{
+ /* Do nothing */
+}
+
+/**/
+
+/**
+
+ Name: BE_RemoveCtrlBreakHandler()
+
+ Description: Removes the control-break and control-c handlers.
+
+ Modified:
+
+ Notes:
+
+ See also: $/SEE(be_init.c)$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BE_RemoveCtrlBreakHandler( VOID )
+{
+ /* Do nothing */
+}
+
diff --git a/private/utils/ntbackup/src/cursors.rc b/private/utils/ntbackup/src/cursors.rc
new file mode 100644
index 000000000..24ec35ff3
--- /dev/null
+++ b/private/utils/ntbackup/src/cursors.rc
@@ -0,0 +1,40 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: cursors.rc
+
+ Description: This file contains the references to cursor resources for
+ the Windows GUI Project Resource File.
+
+ $Log: G:/UI/LOGFILES/CURSORS.RCV $
+
+ Rev 1.2 20 Aug 1992 08:58:42 GLENN
+ ifdef'd unused NT cursors.
+
+ Rev 1.1 26 Mar 1992 08:52:50 GLENN
+ Added new pen.
+
+ Rev 1.0 20 Nov 1991 19:17:22 SYSTEM
+ Initial revision.
+
+******************************************************************************/
+
+// CURSORS -- ID's are defined in the Resource Manager header file 'ss_rsm.h'
+
+
+# if !defined ( OEM_MSOFT )
+
+ IDRC_PEN CURSOR pen.cur // Pen cursor.
+ IDRC_PEN2 CURSOR pen2.cur // Pen cursor up-side-down.
+ IDRC_HAND CURSOR hand.cur // Hand cursor.
+
+# endif // !defined ( OEM_MSOFT )
+
+// COMMON CURSORS
+
+IDRC_HSLIDER CURSOR hslider.cur // Horizontal slider cursor.
+IDRC_HELP CURSOR help.cur // Help's question mark cursor.
+
+
diff --git a/private/utils/ntbackup/src/d_about.c b/private/utils/ntbackup/src/d_about.c
new file mode 100644
index 000000000..15f372686
--- /dev/null
+++ b/private/utils/ntbackup/src/d_about.c
@@ -0,0 +1,1200 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_about.c
+
+ Description: Contains dialog proc for about box.
+
+ $Log: J:\ui\logfiles\d_about.c_v $
+
+ Rev 1.28.1.3 14 Jan 1994 14:37:26 GREGG
+Changed Conner to Arcada.
+
+ Rev 1.28.1.2 03 Dec 1993 11:36:54 GREGG
+Removed TEXT macro from around string defines which already have TEXT macro.
+
+ Rev 1.28.1.1 17 Sep 1993 16:37:52 BARRY
+Put Unicode/Ascii in our internal builds so we can tell the difference.
+
+ Rev 1.28.1.0 18 Aug 1993 19:36:32 BARRY
+Added our version/er information to about box when we build it.
+
+ Rev 1.28 29 Jun 1993 17:34:02 GLENN
+Added new style about box support.
+
+ Rev 1.27 11 Jun 1993 14:10:00 MIKEP
+c++ enable
+
+ Rev 1.25 09 Apr 1993 14:09:04 GLENN
+Commented out credit scroll.
+
+ Rev 1.24 01 Nov 1992 15:50:50 DAVEV
+Unicode changes
+
+ Rev 1.23 07 Oct 1992 13:31:46 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.22 04 Oct 1992 19:34:54 DAVEV
+Unicode Awk pass
+
+ Rev 1.21 28 Sep 1992 17:06:26 GLENN
+MikeP changes (ifdef stuff).
+
+ Rev 1.20 09 Sep 1992 17:05:44 GLENN
+Commented out sales pitch stuff - NOT yet defined.
+
+ Rev 1.19 04 Sep 1992 18:08:42 CHUCKB
+Added new string (sales pitch).
+
+ Rev 1.18 02 Sep 1992 13:56:48 GLENN
+Added the TDH revision to the about box.
+
+ Rev 1.17 25 Aug 1992 13:12:06 CHUCKB
+Checked in by GLENN for CHUCKB.
+
+ Rev 1.16 19 Aug 1992 14:12:20 CHUCKB
+Added memory/resources/etc. feature.
+
+ Rev 1.15 17 Aug 1992 13:16:34 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.14 10 Jun 1992 10:22:58 JOHNWT
+removed easter egg for oem
+
+ Rev 1.13 29 May 1992 15:47:20 JOHNWT
+PCH update
+
+ Rev 1.12 27 Apr 1992 17:32:06 JOHNWT
+alphabetized names
+
+ Rev 1.11 27 Apr 1992 16:19:14 JOHNWT
+added more names & alt+f4
+
+ Rev 1.10 24 Apr 1992 16:49:36 GLENN
+Maked kooler.
+
+ Rev 1.9 22 Apr 1992 18:02:40 GLENN
+Added shark and diver sprites.
+
+ Rev 1.8 15 Apr 1992 18:50:18 GLENN
+Added Easter Egg.
+
+ Rev 1.7 09 Apr 1992 17:51:56 GLENN
+Using global exe version and eng release versions now.
+
+ Rev 1.6 07 Apr 1992 15:41:14 GLENN
+Added code to show icon in upper left corner.
+
+ Rev 1.5 27 Mar 1992 11:20:34 GLENN
+Updated temp.
+
+ Rev 1.4 26 Mar 1992 17:03:34 GLENN
+Still going...
+
+ Rev 1.3 23 Mar 1992 15:56:12 GLENN
+In process of making kool...
+
+ Rev 1.2 20 Jan 1992 09:38:12 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.1 16 Dec 1991 11:56:58 CHUCKB
+Added include windows.h.
+
+ Rev 1.0 20 Nov 1991 19:26:58 SYSTEM
+Initial revision.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define TRIGGER_PULLED 4
+#define SPIN_FORWARD 1
+#define SPIN_BACKWARD 2
+#define SPIN_CYCLES 4
+#define LINE_HEIGHT 16
+#define NUM_LINES 37
+#define NUM_LINES_TO_SCROLL ( NUM_LINES + 6 )
+#define TAIL_DELAY 3
+#define FEET_HAUL_BUTT 1
+#define FEET_CRUISE 2
+#define FEET_TAKE_IT_EASY 3
+
+#define ICONX 12
+#define ICONY 5
+#define ICONSIZE 42
+
+#define MAX_REG_VALUE 128
+
+// MODULE WIDE VARIABLES
+
+static INT mwnTrigger = 0;
+static BOOL mwfHotMouse = FALSE;
+static BOOL mwfAnimating = FALSE;
+static INT mwnLine = 0;
+static INT mwnVScroll = 0;
+static WORD mwwType = 0;
+static INT mwnLastSlideNumber = 0;
+static INT mwnCycles = 0;
+static CHAR_PTR mwszHackCode = TEXT("SHARK");
+static LPSTR mwpHackChar;
+static RECT mwrcClient;
+static RECT mwrcOcean;
+static RECT mwrcShark;
+static RECT mwrcIcon;
+static INT mwnLastSharkNumber = 0;
+static BOOL mwfMoveShark;
+static BOOL mwfMoveSharkTail;
+static INT mwnSharkPos;
+static INT mwnTailDelay;
+static WORD mwwSharkID = IDRBM_SHARK1;
+
+static INT mwnLastDiverNumber = 0;
+static BOOL mwfMoveDiver;
+static BOOL mwfMoveDiverFeet;
+static INT mwnDiverPos;
+static INT mwnFeetDelay;
+static INT mwnFeetSpeed;
+static WORD mwwDiverID = IDRBM_DIVER1;
+
+static HBRUSH mwhBrushBlue;
+
+// PRIVATE FUNCTIONS
+
+static VOID AB_InitVersionBox ( HWND );
+static VOID AB_AnimateBox ( HWND );
+static VOID AB_KillAnimation ( HWND );
+static VOID AB_SpinIcon ( HWND );
+static BOOL AB_ScrollCredits ( HWND );
+static LPSTR AddCommas ( LPSTR, DWORD );
+static VOID BytesToK ( DWORD * );
+
+
+
+VOID WM_ConvertToDialogRect ( LPRECT );
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+static CHAR_PTR Credits[NUM_LINES] =
+{
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT("* Design *"),
+ TEXT(""),
+ TEXT(""),
+ TEXT("P"),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT("* Software Engineers *"),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT("* Testing and Quality *"),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT("* Help and Documentation *"),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT("* Graphics *"),
+ TEXT(""),
+ TEXT(""),
+ TEXT("* Special Thanks To *"),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT(""),
+ TEXT("")
+};
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+/***************************************************
+
+ Name: DM_AboutWinter ()
+
+ Description: Dialog proc for the About dialog.
+
+ Modified:
+
+ Returns: Boolean true if message was processed.
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+DLGRESULT APIENTRY DM_AboutWinter (
+ HWND hDlg, //I - window handle
+ MSGID wMsg, //I - message id
+ MPARAM1 mp1, //I - message parameter
+ MPARAM2 mp2 ) //I - message paramerer
+{
+
+ switch ( wMsg ) {
+
+ case WM_INITDIALOG: {
+
+ DM_CenterDialog( hDlg );
+
+ mwnTrigger = 0;
+ mwfHotMouse = FALSE;
+ mwnLine = 0;
+ mwnVScroll = 0;
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ RSM_BitmapLoad ( IDRBM_SHARK1, RSM_MAGICCOLOR );
+ RSM_BitmapLoad ( IDRBM_SHARK2, RSM_MAGICCOLOR );
+ RSM_BitmapLoad ( IDRBM_SHARK3, RSM_MAGICCOLOR );
+ RSM_BitmapLoad ( IDRBM_DIVER1, RSM_MAGICCOLOR );
+ RSM_BitmapLoad ( IDRBM_DIVER2, RSM_MAGICCOLOR );
+ RSM_BitmapLoad ( IDRBM_DIVER3, RSM_MAGICCOLOR );
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ mwhBrushBlue = CreateSolidBrush ( RGB(0,0,0xFF) );
+
+ AB_InitVersionBox ( hDlg );
+
+ break;
+ }
+
+ case WM_SETFOCUS:
+
+ if ( mwfHotMouse ) {
+ return 1;
+ }
+
+ SetFocus ( GetDlgItem ( hDlg, IDOK ) );
+
+ break;
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+// case WM_KEYDOWN:
+//
+// // Look for the SHARK.
+//
+// if ( mwfHotMouse ) {
+//
+// if ( LOWORD(mp1) == (WORD)( LOBYTE ( VkKeyScan ( *mwpHackChar ) ) ) ) {
+// mwpHackChar++;
+// }
+// else {
+// mwpHackChar = mwszHackCode;
+// }
+//
+// if ( ! *mwpHackChar ) {
+// mwnTrigger = TRIGGER_PULLED;
+// mwpHackChar = mwszHackCode;
+// }
+// }
+//
+// break;
+//
+// case WM_LBUTTONUP:
+//
+// if ( mwfHotMouse ) {
+//
+// mwpHackChar = mwszHackCode;
+// mwfHotMouse = FALSE;
+// SetFocus ( hDlg );
+// }
+//
+// break;
+//
+// case WM_LBUTTONDOWN: {
+//
+// RECT Rect;
+// POINT Point;
+//
+// Point.x = LOWORD( mp2 );
+// Point.y = HIWORD( mp2 );
+//
+// GetClientRect ( hDlg, &Rect );
+//
+// Rect.top = Rect.bottom - 20;
+// Rect.right = Rect.left + 20;
+//
+// if ( Point.x >= Rect.left && Point.x <= Rect.right &&
+// Point.y >= Rect.top && Point.y <= Rect.bottom ) {
+//
+// mwpHackChar = mwszHackCode;
+// mwfHotMouse = TRUE;
+// SetFocus ( hDlg );
+// }
+//
+// break;
+// }
+//
+// case WM_LBUTTONDBLCLK: {
+//
+// RECT Rect;
+// POINT Point;
+//
+// Point.x = LOWORD( mp2 );
+// Point.y = HIWORD( mp2 );
+//
+// Rect = mwrcIcon;
+//
+// if ( Point.x >= Rect.left && Point.x <= Rect.right &&
+// Point.y >= Rect.top && Point.y <= Rect.bottom ) {
+//
+// if ( TRUE ) { // if ( mwnTrigger == TRIGGER_PULLED ) {
+//
+// AB_AnimateBox ( hDlg );
+// }
+// }
+//
+//
+// break;
+// }
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ case WM_PAINT: {
+
+ HDC hDC;
+ PAINTSTRUCT ps;
+
+ hDC = BeginPaint( hDlg, &ps );
+ // DrawIcon ( hDC, mwrcIcon.left, mwrcIcon.top, RSM_IconLoad ( IDRI_WNTRPARK ) );
+ EndPaint( hDlg, &ps );
+
+ break;
+ }
+
+ case WM_TIMER:
+
+ AB_SpinIcon ( hDlg );
+
+ break;
+
+ case WM_COMMAND:
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDOK:
+ case IDCANCEL:
+
+ AB_KillAnimation ( hDlg );
+ EndDialog ( hDlg, 0 );
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ RSM_BitmapFree ( IDRBM_SHARK1 );
+ RSM_BitmapFree ( IDRBM_SHARK2 );
+ RSM_BitmapFree ( IDRBM_SHARK3 );
+ RSM_BitmapFree ( IDRBM_DIVER1 );
+ RSM_BitmapFree ( IDRBM_DIVER2 );
+ RSM_BitmapFree ( IDRBM_DIVER3 );
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ DeleteObject ( mwhBrushBlue );
+
+ return TRUE;
+ break;
+
+
+ default:
+ return FALSE;
+ }
+
+ break;
+
+ default:
+
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+
+LPSTR AddCommas (
+
+LPSTR szBuf,
+DWORD dw )
+
+{
+ CHAR szTemp[40];
+ LPSTR pTemp;
+ INT count, len;
+ LPSTR p;
+
+ len = wsprintf(szTemp, TEXT("%ld"), dw);
+
+ pTemp = szTemp + len - 1;
+
+ p = szBuf + len + ((len - 1) / 3);
+
+ *p-- = 0;
+
+ count = 1;
+
+ while (pTemp >= szTemp) {
+ *p-- = *pTemp--;
+ if (count == 3) {
+ count = 1;
+ if (p > szBuf)
+ *p-- = TEXT(',');
+ } else
+ count++;
+ }
+
+ return szBuf;
+}
+
+
+VOID BytesToK (
+
+DWORD *pDW )
+
+{
+ *pDW = *pDW / 1024 ;
+// *((WORD *)pDW) = (LOWORD(*pDW) >> 10) + (HIWORD(*pDW) << 6);
+// *(((WORD *)pDW)+1) >>= 10;
+}
+
+
+
+static VOID AB_InitVersionBox (
+
+HWND hDlg )
+
+{
+#ifdef OS_WIN32
+
+
+ CHAR szBuffer[64];
+ CHAR szMessage[128];
+ CHAR szNumBuf1[32];
+ LPSTR lpRegInfoValue = NULL;
+ CHAR szRegInfo[MAX_PATH];
+ DWORD cb;
+ HKEY hkey;
+ DWORD err;
+
+ // Set the icon.
+
+ SendDlgItemMessage ( hDlg, IDD_ABOUTICON, STM_SETICON, (WPARAM)RSM_IconLoad(IDRI_WNTRPARK), 0L );
+
+ // Set the Application Title Text string.
+
+ RSM_StringCopy ( IDS_APPNAME, szBuffer, sizeof ( szBuffer ) );
+ RSM_Sprintf ( szMessage, ID(IDS_APPTEXTSTRING), szBuffer );
+ SetDlgItemText ( hDlg, IDD_ABOUTAPPNAME, szMessage );
+
+ // Get the VERSION and LICENSE information.
+
+ {
+ RSM_StringCopy ( IDS_LICENSEINFOKEY, szRegInfo, sizeof(szRegInfo) );
+
+ if ( ! RegOpenKeyEx ( HKEY_LOCAL_MACHINE, szRegInfo, 0, KEY_READ, &hkey ) ) {
+
+ CHAR szRegItem[16];
+ CHAR szVerPart1[64];
+ CHAR szVerPart2[64];
+
+ RSM_StringCopy ( IDS_VERSIONMSG, szBuffer, sizeof(szBuffer) );
+
+ {
+ // THE MICROSOFT VERSION
+
+ RSM_StringCopy ( IDS_CURRENTVERSION, szRegInfo, sizeof(szRegInfo) );
+
+ if ( hkey ) {
+ cb = sizeof ( szVerPart1 );
+ RegQueryValueEx ( hkey, szRegInfo, 0, 0, (LPBYTE)szVerPart1, &cb );
+ }
+
+ *szVerPart2 = 0;
+
+ if ( GetSystemMetrics ( SM_DEBUG ) ) {
+ RSM_StringCopy ( IDS_DEBUG, szVerPart2, sizeof(szVerPart2) );
+ }
+ }
+
+ wsprintf ( szMessage, szBuffer, (LPSTR)szVerPart1, (LPSTR)szVerPart2 );
+
+
+// If this is the NTBACKUP application and it is an internal build (ie,
+// Microsoft is not building it) then put our version/er in the box.
+
+#if defined( OEM_MSOFT ) && defined( CONNER_SOFTWARE_BUILD )
+ wsprintf( szBuffer,
+ TEXT(" (Arcada %s build %s - %s)"),
+#if defined( UNICODE )
+ TEXT("Unicode"),
+#else
+ TEXT("ASCII"),
+#endif
+ APP_EXEVER,
+ APP_ENGREL );
+ strcat( szMessage, szBuffer );
+#endif
+
+
+ SetDlgItemText ( hDlg, IDD_ABOUTVERSION, szMessage );
+
+ cb = MAX_REG_VALUE;
+
+ if ( lpRegInfoValue = (LPSTR)LocalAlloc(LPTR, cb) ) {
+
+ // Display the User name.
+
+ RSM_StringCopy ( IDS_REGUSER, szRegInfo, sizeof(szRegInfo) );
+
+ err = RegQueryValueEx(hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb);
+
+ if ( err == ERROR_MORE_DATA ) {
+ LocalFree(lpRegInfoValue);
+ lpRegInfoValue = (LPSTR)LocalAlloc(LPTR, cb);
+ err = RegQueryValueEx(hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb);
+ }
+
+ if ( ! err ) {
+ SetDlgItemText ( hDlg, IDD_ABOUTUSERNAME, lpRegInfoValue );
+ }
+
+ // Display the Organization name.
+
+ RSM_StringCopy ( IDS_REGORGANIZATION, szRegInfo, sizeof(szRegInfo));
+
+ err = RegQueryValueEx(hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb);
+
+ if ( err == ERROR_MORE_DATA ) {
+ LocalFree(lpRegInfoValue);
+ lpRegInfoValue = (LPSTR)LocalAlloc(LPTR, cb);
+ err = RegQueryValueEx(hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb);
+ }
+
+ if ( ! err ) {
+ SetDlgItemText ( hDlg, IDD_ABOUTCOMPANYNAME, lpRegInfoValue );
+ }
+
+ LocalFree(lpRegInfoValue);
+ }
+
+ RegCloseKey ( hkey );
+ }
+ }
+
+ // The PROCESSOR stuff.
+
+ RSM_StringCopy ( IDS_PROCESSORINFOKEY, szRegInfo, sizeof(szRegInfo) );
+
+ if ( ! RegOpenKeyEx ( HKEY_LOCAL_MACHINE, szRegInfo, 0, KEY_READ, &hkey ) ) {
+
+ cb = MAX_REG_VALUE;
+
+ if ( lpRegInfoValue = (LPSTR)LocalAlloc ( LPTR, cb ) ) {
+
+ RSM_StringCopy ( IDS_PROCESSORIDENTIFIER, szRegInfo, sizeof(szRegInfo));
+
+ err = RegQueryValueEx ( hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb );
+
+ if ( err == ERROR_MORE_DATA ) {
+ LocalFree ( lpRegInfoValue );
+ lpRegInfoValue = (LPSTR)LocalAlloc ( LPTR, cb );
+ err = RegQueryValueEx ( hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb );
+ }
+
+ if ( ! err ) {
+ SetDlgItemText(hDlg, IDD_ABOUTPROCESSOR, lpRegInfoValue);
+ }
+
+ LocalFree ( lpRegInfoValue );
+ }
+
+ RegCloseKey ( hkey );
+ }
+
+ RSM_StringCopy ( IDS_IDENTIFIERIDENTIFIER, szRegInfo, sizeof(szRegInfo) );
+
+ if ( ! RegOpenKeyEx ( HKEY_LOCAL_MACHINE, szRegInfo, 0, KEY_READ, &hkey ) ) {
+
+ cb = MAX_REG_VALUE;
+
+ if ( lpRegInfoValue = (LPSTR)LocalAlloc ( LPTR, cb ) ) {
+
+ RSM_StringCopy ( IDS_PROCESSORIDENTIFIER, szRegInfo, sizeof(szRegInfo));
+
+ err = RegQueryValueEx ( hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb );
+
+ if ( err == ERROR_MORE_DATA ) {
+ LocalFree ( lpRegInfoValue );
+ lpRegInfoValue = (LPSTR)LocalAlloc ( LPTR, cb );
+ err = RegQueryValueEx ( hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb );
+ }
+
+ if ( ! err ) {
+ SetDlgItemText(hDlg, IDD_ABOUTIDENT, lpRegInfoValue);
+ }
+
+ LocalFree ( lpRegInfoValue );
+ }
+
+ RegCloseKey ( hkey );
+ }
+
+ RSM_StringCopy ( IDS_PRODUCTIDINFOKEY, szRegInfo, sizeof(szRegInfo) );
+
+ if ( ! RegOpenKeyEx ( HKEY_LOCAL_MACHINE, szRegInfo, 0, KEY_READ, &hkey ) ) {
+
+ if ( lpRegInfoValue = (LPSTR)LocalAlloc ( LPTR, cb ) ) {
+
+ RSM_StringCopy ( IDS_PRODUCTIDENTIFIER, szRegInfo, sizeof(szRegInfo));
+
+ err = RegQueryValueEx ( hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb );
+
+ if ( err == ERROR_MORE_DATA ) {
+ LocalFree ( lpRegInfoValue );
+ lpRegInfoValue = (LPSTR)LocalAlloc ( LPTR, cb );
+ err = RegQueryValueEx ( hkey, szRegInfo, 0, 0, (LPBYTE)lpRegInfoValue, &cb );
+ }
+
+ if ( ! err ) {
+ SetDlgItemText(hDlg, IDD_ABOUTPRODID, lpRegInfoValue);
+ }
+
+ LocalFree ( lpRegInfoValue );
+ }
+
+ RegCloseKey ( hkey );
+ }
+
+
+ // The MEMORY stuff.
+
+ {
+ MEMORYSTATUS MemoryStatus;
+ DWORD dwTotalPhys;
+ DWORD dwAvailPhys;
+
+ MemoryStatus.dwLength = sizeof(MemoryStatus);
+ GlobalMemoryStatus(&MemoryStatus);
+ dwTotalPhys = MemoryStatus.dwTotalPhys;
+ dwAvailPhys = MemoryStatus.dwAvailPhys;
+ BytesToK(&dwTotalPhys);
+ BytesToK(&dwAvailPhys);
+
+ GetDlgItemText ( hDlg, IDD_ABOUTMEMORY, szBuffer, sizeof(szBuffer) );
+ wsprintf ( szMessage, szBuffer, AddCommas ( szNumBuf1, dwTotalPhys ) );
+ SetDlgItemText ( hDlg, IDD_ABOUTMEMORY, szMessage );
+ }
+
+#else
+
+ CHAR szString[MAX_UI_RESOURCE_SIZE*2];
+ CHAR szTemp1[MAX_UI_RESOURCE_SIZE];
+ RECT rcScroll;
+ HWND hWndText = GetDlgItem ( hDlg, IDD_ABOUT_VERSION );
+ DWORD dwFlags;
+ DWORD dwFreeMem ;
+ DWORD dwFreeMemB ;
+
+
+ // Determine the Icon location and size.
+
+ mwrcIcon.left = ICONX;
+ mwrcIcon.top = ICONY;
+ mwrcIcon.right = ICONSIZE;
+ mwrcIcon.bottom = ICONSIZE;
+
+ WM_ConvertToDialogRect( &mwrcIcon );
+
+ // Determine the shark's ocean size.
+
+ GetWindowRect ( hDlg, &mwrcClient );
+ GetWindowRect ( hWndText, &rcScroll );
+
+ mwrcOcean.top = rcScroll.bottom - mwrcClient.top - 17;
+ mwrcOcean.bottom = mwrcOcean.top + 25;
+
+ GetClientRect ( hDlg, &mwrcClient );
+
+ mwrcOcean.left = mwrcClient.left;
+ mwrcOcean.right = mwrcClient.right;
+
+ RSM_StringCopy ( ID(IDS_APPNAME), szString, sizeof ( szString ) );
+ strcat ( szString, TEXT("\012") );
+
+ RSM_Sprintf ( szTemp1, ID(IDS_APPVERSION), gszExeVer, gszEngRel );
+ strcat ( szString, szTemp1 );
+ strcat ( szString, TEXT("\012") );
+
+ if ( gb_dhw_ptr ) {
+
+ if ( gb_dhw_ptr[0].driver_label[0] == TEXT(',') ) {
+ strcat ( szString, &gb_dhw_ptr[0].driver_label[1] );
+ }
+ else {
+ strcat ( szString, &gb_dhw_ptr[0].driver_label[0] );
+ }
+
+ strcat ( szString, TEXT("\012") );
+ }
+ else {
+ strcat ( szString, TEXT("\012\012") );
+ }
+
+ strcat ( szString, TEXT("\012") );
+
+ RSM_StringCopy ( ID(IDS_COMPANY), szTemp1, sizeof ( szTemp1 ) );
+ strcat ( szString, szTemp1 );
+ strcat ( szString, TEXT("\012") );
+
+ RSM_StringCopy ( ID(IDS_COPYRIGHT), szTemp1, sizeof ( szTemp1 ) );
+ strcat ( szString, szTemp1 );
+ strcat ( szString, TEXT("\012") );
+
+ RSM_StringCopy ( ID(IDS_CONGLOMERATE), szTemp1, sizeof ( szTemp1 ) );
+ strcat ( szString, szTemp1 );
+ strcat ( szString, TEXT("\012") );
+
+ // Put in the sales pitch
+
+// RSM_StringCopy ( ID(IDS_SALESPITCH), szTemp1, sizeof ( szTemp1 ) );
+// strcat ( szString, szTemp1 );
+// strcat ( szString, "\012" );
+
+ SetDlgItemText ( (HWND)hDlg, IDD_ABOUT_VERSION, szString );
+
+ // Init the mode, memory usage, and system resources strings
+
+ dwFlags = GetWinFlags ();
+ if ( dwFlags & WF_ENHANCED ) {
+
+ RSM_StringCopy ( ID(IDS_ABOUT_ENHANCED_MODE), szTemp1, sizeof ( szTemp1 ) );
+
+ } else {
+
+ RSM_StringCopy ( ID(IDS_ABOUT_STANDARD_MODE), szTemp1, sizeof ( szTemp1 ) );
+ }
+
+ SetDlgItemText ( (HWND)hDlg, IDD_ABOUT_MODE_STR, szTemp1 );
+
+ RSM_StringCopy ( ID(IDS_ABOUT_MEMORY), szTemp1, sizeof ( szTemp1 ) );
+ SetDlgItemText ( (HWND)hDlg, IDD_ABOUT_MEM_STR, szTemp1 );
+
+ dwFreeMem = GetFreeSpace( 0 ) ;
+ dwFreeMemB = dwFreeMem / 1024 ;
+ dwFreeMemB = dwFreeMemB % 1000 ;
+
+ RSM_StringCopy ( ID(IDS_ABOUT_MEM_FORMAT), szTemp1, sizeof ( szTemp1 ) );
+ sprintf ( szString, szTemp1, (INT)(dwFreeMem / 1024000), (INT)(dwFreeMemB) ) ;
+ SetDlgItemText ( (HWND)hDlg, IDD_ABOUT_MEM_SIZ, szString );
+
+ RSM_StringCopy ( ID(IDS_ABOUT_RESOURCES), szTemp1, sizeof ( szTemp1 ) );
+ SetDlgItemText ( (HWND)hDlg, IDD_ABOUT_RES_STR, szTemp1 );
+
+ RSM_StringCopy ( ID(IDS_ABOUT_RES_FORMAT), szTemp1, sizeof ( szTemp1 ) );
+ sprintf ( szString, szTemp1, GetFreeSystemResources ( GFSR_SYSTEMRESOURCES ) ) ;
+ SetDlgItemText ( (HWND)hDlg, IDD_ABOUT_RES_SIZ, szString );
+
+#endif //!defined ( OM_WIN32 ) //unsupported feature
+}
+
+
+static VOID AB_AnimateBox (
+
+HWND hDlg )
+
+{
+ UINT hTimer;
+ HDC hDC;
+
+ if ( ! mwfAnimating ) {
+
+ mwwType = SPIN_FORWARD;
+ mwnLastSlideNumber = 0;
+ mwnCycles = 0;
+ mwnVScroll = 0;
+ mwnLine = 0;
+ mwnLastSharkNumber = 0;
+ mwfMoveShark = FALSE;
+ mwfMoveSharkTail = FALSE;
+ mwnTailDelay = 0;
+ mwnSharkPos = mwrcOcean.right;
+ mwwSharkID = IDRBM_SHARK1;
+ mwnLastDiverNumber = 0;
+ mwfMoveDiver = TRUE;
+ mwfMoveDiverFeet = FALSE;
+ mwnFeetDelay = 0;
+ mwnDiverPos = mwrcOcean.right;
+ mwwDiverID = IDRBM_DIVER1;
+ mwnFeetSpeed = FEET_CRUISE;
+
+ hDC = GetDC ( hDlg );
+ FillRect ( hDC, &mwrcOcean, mwhBrushBlue );
+ ReleaseDC ( hDlg, hDC );
+
+ hTimer = SetTimer( hDlg, (UINT)1, (UINT)80, (TIMERPROC)NULL );
+ mwfAnimating = TRUE;
+ }
+
+}
+
+
+static VOID AB_KillAnimation (
+
+HWND hDlg )
+
+{
+ HDC hDC;
+
+ if ( mwfAnimating ) {
+
+ KillTimer ( hDlg, 1 );
+ mwfAnimating = FALSE;
+
+ hDC = GetDC ( hDlg );
+ FillRect ( hDC, &mwrcOcean, ghBrushWhite );
+ ReleaseDC ( hDlg, hDC );
+
+ AB_InitVersionBox ( hDlg );
+ }
+}
+
+
+
+static VOID AB_SpinIcon (
+
+HWND hDlg )
+
+{
+ LPSTR lpIconID = IDRI_BKUP0;
+ HDC hDC;
+ HWND hWndText = GetDlgItem ( hDlg, IDD_ABOUT_VERSION );
+
+
+ switch ( mwwType ) {
+
+ case SPIN_FORWARD:
+
+ switch ( mwnLastSlideNumber ) {
+
+ case 0:
+
+ lpIconID = IDRI_BKUP0;
+ break;
+
+ case 1:
+ lpIconID = IDRI_BKUP1;
+ break;
+
+ case 2:
+ lpIconID = IDRI_BKUP2;
+ break;
+
+ case 3:
+ lpIconID = IDRI_BKUP3;
+ break;
+
+ case 4:
+ lpIconID = IDRI_BKUP4;
+ break;
+
+ case 5:
+ lpIconID = IDRI_BKUP5;
+ break;
+
+ case 6:
+ lpIconID = IDRI_BKUP6;
+ break;
+
+ case 7:
+ lpIconID = IDRI_BKUP7;
+
+ mwnCycles++;
+
+ if ( mwnCycles >= SPIN_CYCLES ) {
+
+ mwnCycles = 0;
+ mwwType = SPIN_BACKWARD;
+ }
+
+ break;
+
+ }
+
+ break;
+
+ case SPIN_BACKWARD:
+
+ switch ( mwnLastSlideNumber ) {
+
+ case 0:
+
+ lpIconID = IDRI_BKUP0;
+ break;
+
+ case 1:
+ lpIconID = IDRI_BKUP7;
+ break;
+
+ case 2:
+ lpIconID = IDRI_BKUP6;
+ break;
+
+ case 3:
+ lpIconID = IDRI_BKUP5;
+ break;
+
+ case 4:
+ lpIconID = IDRI_BKUP4;
+ break;
+
+ case 5:
+ lpIconID = IDRI_BKUP3;
+ break;
+
+ case 6:
+ lpIconID = IDRI_BKUP2;
+ break;
+
+ case 7:
+ lpIconID = IDRI_BKUP1;
+
+ mwnCycles++;
+
+ if ( mwnCycles >= SPIN_CYCLES ) {
+
+ mwnCycles = 0;
+ mwwType = SPIN_FORWARD;
+ }
+
+ break;
+
+ }
+
+ break;
+
+ }
+
+ mwnLastSlideNumber = ++mwnLastSlideNumber % 8;
+
+ if ( AB_ScrollCredits ( hWndText ) ) {
+
+ AB_KillAnimation ( hDlg );
+ lpIconID = IDRI_WNTRPARK;
+ }
+
+
+ hDC = GetDC ( hDlg );
+
+
+ // Do the Shark Thing.
+
+ if ( mwfMoveShark ) {
+
+ mwnSharkPos--;
+
+ if ( mwnSharkPos < mwrcOcean.left + 20 ) {
+// mwnSharkPos--;
+ }
+ }
+
+ if ( mwfMoveSharkTail ) {
+
+ switch ( mwnLastSharkNumber ) {
+ case 0:
+ mwwSharkID = IDRBM_SHARK1;
+ break;
+
+ case 1:
+ mwwSharkID = IDRBM_SHARK2;
+ break;
+
+ case 2:
+ mwwSharkID = IDRBM_SHARK3;
+ break;
+
+ case 3:
+ mwwSharkID = IDRBM_SHARK2;
+ break;
+
+ }
+
+ mwnLastSharkNumber = ++mwnLastSharkNumber % 4;
+
+ mwfMoveSharkTail = FALSE;
+ }
+
+
+
+ mwnTailDelay = ++mwnTailDelay % TAIL_DELAY;
+
+ if ( ! mwnTailDelay ) {
+
+ mwfMoveSharkTail = TRUE;
+ }
+
+ if ( mwnSharkPos < ( mwrcOcean.right - 100 ) ) {
+ mwfMoveDiver = TRUE;
+ mwnFeetSpeed = FEET_HAUL_BUTT;
+ mwnDiverPos--;
+ }
+
+ if ( mwfMoveShark || mwfMoveSharkTail ) {
+ RSM_BitmapDraw ( mwwSharkID, mwnSharkPos, mwrcOcean.top, 0, 0, hDC );
+ }
+
+
+ // Do the Diver Thing.
+
+ if ( mwfMoveDiver ) {
+ mwnDiverPos--;
+ }
+
+ if ( mwfMoveDiverFeet ) {
+
+ switch ( mwnLastDiverNumber ) {
+ case 0:
+ mwwDiverID = IDRBM_DIVER1;
+ break;
+
+ case 1:
+ mwwDiverID = IDRBM_DIVER2;
+ break;
+
+ case 2:
+ mwwDiverID = IDRBM_DIVER3;
+ break;
+
+ case 3:
+ mwwDiverID = IDRBM_DIVER2;
+ break;
+
+ }
+
+ mwnLastDiverNumber = ++mwnLastDiverNumber % 4;
+
+ mwfMoveDiverFeet = FALSE;
+ }
+
+ mwnFeetDelay = ++mwnFeetDelay % mwnFeetSpeed;
+
+ if ( ! mwnFeetDelay ) {
+
+ mwfMoveDiverFeet = TRUE;
+ }
+
+ if ( mwfMoveDiver || mwfMoveDiverFeet ) {
+ RSM_BitmapDraw ( mwwDiverID, mwnDiverPos, mwrcOcean.top, 0, 0, hDC );
+ }
+
+ if ( mwnDiverPos < ( mwrcOcean.right / 2 ) ) {
+ mwfMoveShark = TRUE;
+ mwfMoveDiver = FALSE;
+ mwnFeetSpeed = FEET_TAKE_IT_EASY;
+ }
+
+
+
+
+
+ FillRect ( hDC, &mwrcIcon, ghBrushWhite );
+// FillRect ( hDC, &mwrcOcean, ghBrushWhite );
+
+ DrawIcon ( hDC, mwrcIcon.left, mwrcIcon.top, RSM_IconLoad ( lpIconID ) );
+
+ ReleaseDC ( hDlg, hDC );
+ hDC = GetDC ( hDlg );
+ ReleaseDC ( hDlg, hDC );
+
+
+} /* end AB_SpinIcon() */
+
+
+static BOOL AB_ScrollCredits (
+
+HWND hWndText )
+
+{
+ RECT rcText;
+ HDC hDC;
+
+ GetClientRect ( hWndText, &rcText );
+
+ ScrollWindow ( hWndText, 0, -1, &rcText, &rcText );
+
+ mwnVScroll++;
+
+ if ( mwnVScroll == LINE_HEIGHT ) {
+
+ if ( mwnLine < NUM_LINES ) {
+
+ INT nOldBkMode;
+
+ rcText.bottom -= 5;
+ rcText.top = rcText.bottom - LINE_HEIGHT;
+
+
+ hDC = GetDC ( hWndText );
+
+ nOldBkMode = SetBkMode( hDC, TRANSPARENT );
+ SetTextColor( hDC, gColorForeGnd );
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ DrawText ( hDC,
+ Credits[mwnLine],
+ -1,
+ &rcText,
+ DT_SINGLELINE | DT_VCENTER | DT_CENTER | DT_NOCLIP
+ );
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ SetBkMode( hDC, nOldBkMode );
+
+ ReleaseDC ( hWndText, hDC );
+
+ }
+
+ mwnVScroll = 0;
+ mwnLine++;
+ }
+
+
+ return ( ( mwnLine >= NUM_LINES_TO_SCROLL ) ? TRUE : FALSE );
+
+} /* end AB_ScrollCredits() */
+
+
+VOID WM_ConvertToDialogRect (
+
+LPRECT pRect )
+
+{
+ LONG lDlgBaseUnits = GetDialogBaseUnits ();
+
+ if ( ! pRect ) {
+ return;
+ }
+
+ pRect->left = ( ( pRect->left * LOWORD(lDlgBaseUnits) ) / 4 );
+ pRect->top = ( ( pRect->top * HIWORD(lDlgBaseUnits) ) / 8 );
+
+ pRect->right = ( ( pRect->right * LOWORD(lDlgBaseUnits) ) / 4 ) + 10;
+ pRect->bottom = ( ( pRect->bottom * HIWORD(lDlgBaseUnits) ) / 8 ) + 18;
+
+} /* end WM_ConvertToDialogRect() */
+
diff --git a/private/utils/ntbackup/src/d_adv_us.c b/private/utils/ntbackup/src/d_adv_us.c
new file mode 100644
index 000000000..0043f195a
--- /dev/null
+++ b/private/utils/ntbackup/src/d_adv_us.c
@@ -0,0 +1,393 @@
+
+/***************************************************
+
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_adv_us.c
+
+ Description: Contains dialog proc for using file selections.
+
+ $Log: G:\ui\logfiles\d_adv_us.c_v $
+
+ Rev 1.22 21 Jul 1993 17:09:46 CARLS
+change to tbrparse call
+
+ Rev 1.21 07 Jun 1993 15:46:10 DARRYLP
+Added a wait cursor for selection processing.
+
+ Rev 1.20 05 Nov 1992 17:05:18 DAVEV
+fix ts
+
+ Rev 1.18 20 Oct 1992 10:13:42 GLENN
+Removed hardcoded APPLICATIONNAME from message boxes.
+
+ Rev 1.17 07 Oct 1992 13:33:30 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.16 04 Oct 1992 19:35:28 DAVEV
+Unicode Awk pass
+
+ Rev 1.15 15 May 1992 14:53:50 MIKEP
+nt pass 2
+
+ Rev 1.14 14 May 1992 16:42:26 MIKEP
+nt pass 2
+
+ Rev 1.13 14 Apr 1992 11:34:32 CHUCKB
+Fixed selection logging messages.
+
+ Rev 1.12 07 Apr 1992 10:56:20 CHUCKB
+Moved DM_DisplayModesMatch prototype.
+
+ Rev 1.11 23 Mar 1992 15:43:48 CHUCKB
+Fixed mapped drives found warning.
+
+ Rev 1.10 25 Feb 1992 11:35:06 JOHNWT
+handle attach error and serv/map mode
+
+ Rev 1.9 08 Feb 1992 13:38:36 MIKEP
+func name change
+
+ Rev 1.8 05 Feb 1992 09:23:18 CHUCKB
+Removed tabs and EOF's.
+
+ Rev 1.7 20 Jan 1992 10:34:34 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.6 10 Jan 1992 09:29:46 ROBG
+Modified HELPID.
+
+ Rev 1.5 09 Jan 1992 18:08:20 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.4 08 Jan 1992 09:13:06 CHUCKB
+Fixed initialization of list box.
+
+ Rev 1.3 07 Jan 1992 15:08:14 DAVEV
+replace dos_findfirst,etc with VLM_FindFirst,etc.
+
+ Rev 1.2 16 Dec 1991 11:59:18 CHUCKB
+Added include windows.h.
+
+ Rev 1.1 25 Nov 1991 14:55:00 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 18 Sep 1991 11:34:28 ROBG
+Initial revision.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/***************************************************
+
+ Name: DM_AdvUse ()
+
+ Description: Dialog proc for using file selections.
+
+ Modified:
+
+ Returns:
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+#ifndef OEM_MSOFT // The only user of DM_AdvUse is in dialmang.c...
+
+DLGRESULT APIENTRY DM_AdvUse (
+
+ HWND hDlg,
+ MSGID msg,
+ MPARAM1 mp1,
+ MPARAM2 mp2 )
+
+{
+ INT16 i ;
+ DWORD dRetVal ;
+ CHAR szFileName[VLM_MAXFNAME] ;
+ CHAR szPathSpec[VLM_MAXFNAME] ;
+ VLM_FIND_PTR pVlmFind = NULL;
+ CDS_PTR pPermCDS ;
+ PDS_WMINFO wininfo ;
+ HWND hwndTemp ;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+
+ DM_CenterDialog( hDlg ) ;
+
+ wsprintf ( szPathSpec, TEXT("%s%s"),
+ CDS_GetUserDataPath (), TEXT("*.bks") ) ;
+
+ // get the names of all selection files;
+ // We don't use DlgDirList because we want to truncate the file
+ // extensions. It's much easier this way.
+
+ if ( pVlmFind = VLM_FindFirst( szPathSpec, VLMFIND_NORMAL,
+ szFileName ) )
+ {
+ do {
+
+ for ( i = 0; i < 9; ++i )
+ {
+ if ( szFileName[i] == TEXT('.') ) {
+ szFileName[i] = TEXT('\0') ;
+ }
+ }
+ SendDlgItemMessage ( hDlg, IDD_SAVE_FLIST, LB_ADDSTRING,
+ (MPARAM1) 0,
+ MP2FROMPVOID (szFileName) ) ;
+
+ // once we have one, look for the next one
+
+ } while ( VLM_FindNext ( pVlmFind, szFileName ) );
+
+ VLM_FindClose ( &pVlmFind );
+ }
+ SendDlgItemMessage ( hDlg, IDD_SAVE_FLIST, LB_SETCURSEL,
+ (MPARAM1) 0, (MPARAM2) NULL ) ;
+ dRetVal = SendDlgItemMessage ( hDlg, IDD_SAVE_FLIST,
+ LB_GETTEXT,
+ (MPARAM1) 0,
+ MP2FROMPVOID ( szFileName ) ) ;
+
+ return TRUE ;
+ break ;
+
+
+ case WM_COMMAND : {
+
+ WORD wId = GET_WM_COMMAND_ID (mp1, mp2);
+ WORD wCmd = GET_WM_COMMAND_CMD (mp1, mp2);
+
+ switch ( wId ) {
+
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_DIALOGSELECTUSE ) ;
+ return( TRUE ) ;
+
+ case IDD_SAVE_FNAME :
+ return TRUE ;
+
+ case IDD_SAVE_FLIST :
+
+ if ( wCmd != LBN_DBLCLK ) {
+
+ dRetVal = SendDlgItemMessage ( hDlg,
+ IDD_SAVE_FLIST,
+ LB_GETCURSEL,
+ (MPARAM1) NULL,
+ (MPARAM2) NULL ) ;
+ if ( dRetVal != LB_ERR ) {
+
+ dRetVal = SendDlgItemMessage ( hDlg,
+ IDD_SAVE_FLIST,
+ LB_GETTEXT,
+ (MPARAM1) dRetVal,
+ MP2FROMPVOID ( szFileName ) ) ;
+ }
+
+ return TRUE ;
+ }
+
+ case IDOK : {
+ WM_ShowWaitCursor( TRUE );
+ // get the name of the selection file
+
+ dRetVal = SendDlgItemMessage ( hDlg, IDD_SAVE_FLIST,
+ LB_GETCURSEL,
+ (MPARAM1) NULL,
+ (MPARAM2) NULL ) ;
+
+ // if we have a selection, parse it
+
+ if ( dRetVal != LB_ERR ) {
+
+ // get the actual text of the selection
+
+ SendDlgItemMessage ( hDlg, IDD_SAVE_FLIST,
+ LB_GETTEXT,
+ (MPARAM1) dRetVal,
+ MP2FROMPVOID ( szFileName ) ) ;
+
+ // if the user supplied an extension, null it
+
+ i = 0 ;
+ while ( i < 8 ) {
+
+ if ( szFileName[i] == TEXT('.') ) {
+ szFileName[i] = TEXT('\0') ;
+ }
+ i++ ;
+ }
+
+ // create the fully qualified path name
+
+ wsprintf ( szPathSpec, TEXT("@%s%s%s"),
+ CDS_GetUserDataPath(),
+ szFileName, TEXT(".bks") ) ;
+
+ // call the parser to do its thing
+
+ pPermCDS = CDS_GetPerm () ;
+ tbrparse ( &pPermCDS, dle_list, bsd_list, szPathSpec, TBACKUP, NULL ) ;
+
+ // remove any unused bsds and then make sure
+ // we don't have mixed mapped/server selections
+
+ VLM_RemoveUnusedBSDs ( bsd_list ) ;
+ DM_DisplayModesMatch( );
+
+ // now go through the windows to see if one needs
+ // its check marks updated.
+
+ hwndTemp = WM_GetNext ( (HWND) NULL ) ;
+
+ while ( hwndTemp != (HWND) NULL ) {
+ wininfo = WM_GetInfoPtr ( hwndTemp ) ;
+ if ( wininfo->wType == WMTYPE_DISKTREE ) {
+ VLM_RematchList ( hwndTemp ) ;
+ }
+ hwndTemp = WM_GetNext ( hwndTemp ) ;
+ }
+
+ VLM_UpdateDisks () ;
+ VLM_UpdateServers () ;
+
+#ifdef OEM_EMS // Exchange Enterprise View
+// VLM_XchgAdvSelections () ;
+#endif
+ }
+ else {
+
+ // no file selected, inform the confused user
+
+ WM_MsgBox ( NULL, (LPSTR) IDS_NOFILESSELECTED,
+ WMMB_OK, WMMB_ICONEXCLAMATION ) ;
+ }
+ WM_ShowWaitCursor( FALSE );
+ }
+
+
+ case IDCANCEL :
+
+ EndDialog (hDlg, TRUE) ;
+ return TRUE ;
+ break ;
+
+
+ default :
+
+ return FALSE ;
+ }
+ break ;
+ }
+
+ case WM_CLOSE :
+
+ EndDialog ( hDlg, (INT16) NULL ) ;
+ return TRUE ;
+ break ;
+
+ default :
+
+ return FALSE ;
+ }
+}
+
+#endif
+
+/***************************************************
+
+ Name: DM_DisplayModesMatch ( )
+
+ Description: Checks to see if mapped drives were added to the BSD
+ list when we are in server/volume mode. If so, they
+ are removed and the user informed.
+
+ Returns: VOID
+
+ Notes: If we are in mapped mode, and a selection file
+ uses server/volume connections, it is caught in
+ the parser before they log in.
+
+
+*****************************************************/
+
+VOID DM_DisplayModesMatch ( VOID )
+
+{
+ BSD_PTR pBSD ;
+ BSD_PTR pRemove_BSD ;
+ GENERIC_DLE_PTR pDLE ;
+ BOOL fPrompt = FALSE ;
+ CHAR szError[255] ;
+
+
+ // if we are in server mode, make sure no mapped drives are selected
+
+ if ( gfServers ) {
+
+ // look at each BSD and see if it is a mapped drive
+
+ pBSD = BSD_GetFirst ( bsd_list ) ;
+
+ while ( pBSD != NULL ) {
+
+ pDLE = BSD_GetDLE ( pBSD ) ;
+
+ // If it is a Novell server, and it has no parent, then it is
+ // a mapped drive
+
+ if ( ( ( DLE_GetDeviceType ( pDLE ) == NOVELL_DRV ) ||
+ ( DLE_GetDeviceType ( pDLE ) == NOVELL_AFP_DRV ) ) &&
+ ( DLE_GetParent ( pDLE ) == NULL ) ) {
+
+ pRemove_BSD = pBSD;
+ pBSD = BSD_GetNext ( pBSD ) ;
+ BSD_Remove( pRemove_BSD );
+ fPrompt = TRUE;
+
+ } else {
+
+ pBSD = BSD_GetNext ( pBSD ) ;
+
+ }
+
+ } //endwhile
+
+ // if we found a mapped drive, inform the user that those selections
+ // were invalid.
+
+ if ( fPrompt ) {
+
+ CHAR szAppName[50] ;
+
+ RSM_StringCopy( IDS_APPNAME, szAppName, sizeof ( szAppName ) ) ;
+ RSM_Sprintf( szError, ID(IDS_MAPPEDFOUND), szAppName ) ;
+
+ WM_MsgBox ( ID( IDS_NETWORKERRORCAPTION ),
+ szError,
+ WMMB_OK, WMMB_ICONEXCLAMATION ) ;
+
+ // log the error
+
+ lresprintf( LOGGING_FILE, LOG_START, FALSE ) ;
+ lprintf( LOGGING_FILE, szError ) ;
+ lresprintf( LOGGING_FILE, LOG_END ) ;
+ }
+ }
+
+ return;
+}
diff --git a/private/utils/ntbackup/src/d_attach.c b/private/utils/ntbackup/src/d_attach.c
new file mode 100644
index 000000000..eaf4eccdf
--- /dev/null
+++ b/private/utils/ntbackup/src/d_attach.c
@@ -0,0 +1,332 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_attach.c
+
+ Description: Contains entry point and dialog proc for application
+ to attach to a server that is not currently attached.
+ Intended for use with restore operation when specifying
+ target drive.
+
+ $Log: G:/UI/LOGFILES/D_ATTACH.C_V $
+
+ Rev 1.24 01 Nov 1992 15:52:32 DAVEV
+Unicode changes
+
+ Rev 1.23 07 Oct 1992 13:33:44 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.22 04 Oct 1992 19:35:32 DAVEV
+Unicode Awk pass
+
+ Rev 1.21 06 Aug 1992 13:17:48 CHUCKB
+Changes for NT.
+
+ Rev 1.20 07 Jul 1992 15:31:58 MIKEP
+unicode changes
+
+ Rev 1.19 29 May 1992 15:52:32 JOHNWT
+PCH update
+
+ Rev 1.18 14 May 1992 16:40:20 MIKEP
+Nt pass 2
+
+ Rev 1.17 22 Mar 1992 12:56:20 JOHNWT
+added appname to dialog title
+
+ Rev 1.16 03 Feb 1992 14:28:04 JOHNWT
+force username entry
+
+ Rev 1.15 30 Jan 1992 09:53:38 JOHNWT
+disable help during YY
+
+ Rev 1.14 29 Jan 1992 18:22:44 CHUCKB
+Send server name to dialog instead of group box.
+
+ Rev 1.13 29 Jan 1992 11:22:42 MIKEP
+cation string to small
+
+ Rev 1.12 27 Jan 1992 00:29:12 CHUCKB
+Updated dialog id's.
+
+ Rev 1.11 20 Jan 1992 10:13:28 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.10 10 Jan 1992 09:17:42 ROBG
+Modified HELPID.
+
+ Rev 1.9 10 Jan 1992 08:36:00 JOHNWT
+fixed help logic
+
+ Rev 1.8 09 Jan 1992 18:08:46 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.7 06 Jan 1992 11:42:04 CHUCKB
+Added help.
+
+ Rev 1.6 17 Dec 1991 17:55:00 CHUCKB
+Fixed initialization of return code.
+
+ Rev 1.5 16 Dec 1991 15:29:28 JOHNWT
+added YY countdown timer
+
+ Rev 1.4 16 Dec 1991 12:13:28 CHUCKB
+Added include windows.h.
+
+ Rev 1.3 04 Dec 1991 18:24:10 CHUCKB
+Tried to fix blank password.
+
+ Rev 1.2 01 Dec 1991 15:57:56 MIKEP
+make pointer static
+
+ Rev 1.1 25 Nov 1991 14:55:46 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 ?? ??? 1991 ??:??:?? ??????
+Initial revision.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define TIME_OUT_VAL 61 /* time out period for YY ops */
+
+static VOID clock_routine( VOID );
+static DS_LOGIN_PTR pdsLogin;
+
+HTIMER mw_timer_handle; /* timer used when in YY operation */
+HWND mw_hDlg; /* our dialog's handle */
+INT mw_time_out; /* time-out counter */
+
+/****************************************************************************
+
+ Name: DM_AttachToServer
+
+ Description: Entry point for the application to attach to a server
+
+ Modified: 06/10/91
+
+ Returns: 0 if user name and password has been provided and is OK.
+ 1 if password not provided.
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+
+BOOL DM_AttachToServer (
+
+LPSTR szServerName, // I - server name
+LPSTR szUserName, // I - user name
+INT UserNameLen, // I - length of user name
+LPSTR szPswd, // I - passWord
+INT PswdLen ) // I - length of password
+
+{
+ INT nStatus;
+ DS_LOGIN_PTR pLogin;
+
+ // put all of the input args into a structure to pass it to the dialog
+
+ pLogin = (DS_LOGIN_PTR) calloc ( 1, sizeof (struct DS_LOGIN) );
+ if ( pLogin == NULL) {
+ return FALSE;
+ }
+
+ pLogin->Server_Name = szServerName;
+ pLogin->User_Name = szUserName;
+ pLogin->User_Name_Len = UserNameLen;
+ pLogin->Password = szPswd;
+ pLogin->Password_Len = PswdLen;
+ pLogin->Ok = FALSE;
+
+ nStatus = DM_ShowDialog ( ghWndFrame, IDD_PSWD, (PVOID) pLogin );
+
+ free ( pLogin );
+
+ return ( nStatus != DM_SHOWOK ); // return false for success
+}
+
+/****************************************************************************
+
+ Name: DM_Attach
+
+ Description: This Dialog procedure allows the user to attach to
+ a server that is not currently attached
+
+ Modified:
+
+ Returns: TRUE if message was processed.
+ FALSE if message was not processed.
+
+ Notes: If the user hits Enter while the focus is on the username
+ focus gets passed to the password, and the dialog continues
+
+ See also:
+
+****************************************************************************/
+
+
+DLGRESULT APIENTRY DM_Attach (
+
+HWND hDlg , // I - Handle of the dialog.
+MSGID msg , // I - Message Infomation.
+MPARAM1 mp1 , // I - Additional message information.
+MPARAM2 mp2 ) // I - Additional message information.
+
+{
+ CHAR szCaption[ 80 ];
+ HWND hTemp;
+ INT nRetVal = DM_SHOWCANCEL;
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+
+ DM_CenterDialog( hDlg );
+
+ pdsLogin = (DS_LOGIN_PTR) mp2;
+
+ SendDlgItemMessage ( hDlg, IDD_USERNAME, EM_LIMITTEXT,
+ (MPARAM1) pdsLogin->User_Name_Len,
+ (MPARAM2) NULL );
+
+ SendDlgItemMessage ( hDlg, IDD_PASSWORD, EM_LIMITTEXT,
+ (MPARAM1) pdsLogin->Password_Len,
+ (MPARAM2) NULL );
+
+ // set the title of the dialog
+
+ if ( WM_IsMinimized ( ghWndFrame ) ) {
+ RSM_StringCopy ( IDS_APPMSGNAME, szCaption, 80 );
+ strcat ( szCaption, TEXT(": ") );
+ } else {
+ RSM_StringCopy ( IDS_LOGINTOSERVERCAPTION, szCaption, 80 );
+ }
+ strcat ( szCaption, pdsLogin->Server_Name );
+ SendMessage ( hDlg, WM_SETTEXT, 0, (MPARAM2) (LPSTR) szCaption );
+
+ // set username if available
+
+ SetDlgItemText ( hDlg, IDD_USERNAME, pdsLogin->User_Name );
+
+ SetFocus ( GetDlgItem ( hDlg, IDD_USERNAME ) );
+
+ /* if the YY flag is set, set up a time-out timer, disable
+ the help button since we don't monitor the help process */
+
+ if ( CDS_GetYesFlag ( CDS_GetCopy() ) == YESYES_FLAG ) {
+ mw_hDlg = hDlg;
+ mw_time_out = TIME_OUT_VAL;
+ ShowWindow( GetDlgItem( hDlg, IDD_LOGIN_TIMEBOX ), SW_SHOWNOACTIVATE );
+ ShowWindow( GetDlgItem( hDlg, IDD_LOGIN_TIMEOUT ), SW_SHOWNOACTIVATE );
+ mw_timer_handle = WM_HookTimer( clock_routine, 1 );
+ EnableWindow( GetDlgItem( hDlg, IDHELP ), FALSE ) ;
+ }
+
+ return TRUE;
+
+ case WM_COMMAND :
+
+ switch ( GET_WM_COMMAND_ID (mp1, mp2) ) {
+
+ case IDHELP :
+
+ HM_DialogHelp( HELPID_DIALOGLOGINPSWD );
+
+ return( TRUE );
+
+ case IDD_PASSWORD :
+ case IDD_USERNAME :
+
+ return TRUE;
+
+ case IDOK :
+
+ hTemp = GetFocus ( ); // if user hit enter on u-name, get pswd
+
+ if ( hTemp == GetDlgItem ( hDlg, IDD_USERNAME ) ) {
+
+ SetFocus ( GetDlgItem ( hDlg, IDD_PASSWORD ) );
+ return TRUE;
+
+ } else { // this is the 'real' OK case
+
+ // fill in the fields that get passed back to attach
+
+ if ( GetDlgItemText ( hDlg, IDD_USERNAME,
+ pdsLogin->User_Name,
+ pdsLogin->User_Name_Len ) == 0 ) {
+
+ SetFocus ( GetDlgItem ( hDlg, IDD_USERNAME ) );
+ return TRUE;
+
+ }
+
+ GetDlgItemText ( hDlg, IDD_PASSWORD,
+ pdsLogin->Password,
+ pdsLogin->Password_Len );
+
+ nRetVal = DM_SHOWOK;
+ pdsLogin->Ok = TRUE;
+
+ }
+
+ case IDCANCEL :
+
+ if ( CDS_GetYesFlag ( CDS_GetCopy() ) == YESYES_FLAG ) {
+ WM_UnhookTimer( mw_timer_handle );
+ }
+
+ EndDialog ( hDlg, nRetVal );
+ return TRUE;
+
+ default :
+ return FALSE;
+ }
+
+ break;
+ }
+
+ return FALSE;
+}
+
+
+/******************************************************************************
+
+ Name: clock_routine
+
+ Modified: 12/16/91
+
+ Description: This procedure is called to process the count-down timer.
+ The timeout text is updated with the time as it changes.
+ When the time runs out, a cancel message is sent to the
+ dialog.
+
+ Returns: none
+
+******************************************************************************/
+
+VOID clock_routine( VOID )
+{
+
+ CHAR time_remaining[3];
+
+ mw_time_out--;
+
+ if ( mw_time_out == 0 ) {
+ SendMessage( mw_hDlg, WM_COMMAND, IDCANCEL, 0L );
+ } else {
+ sprintf( time_remaining, TEXT("%d"), mw_time_out );
+ SetDlgItemText( mw_hDlg, IDD_LOGIN_TIMEOUT, time_remaining );
+ }
+
+ return;
+}
diff --git a/private/utils/ntbackup/src/d_browse.c b/private/utils/ntbackup/src/d_browse.c
new file mode 100644
index 000000000..7628ddbaa
--- /dev/null
+++ b/private/utils/ntbackup/src/d_browse.c
@@ -0,0 +1,644 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: D_BROWSE.C
+
+ Description:
+
+ $Log: G:\UI\LOGFILES\D_BROWSE.C_V $
+
+ Rev 1.28 02 Feb 1994 11:30:24 Glenn
+Added log file browse support.
+
+ Rev 1.27 17 Jan 1994 15:53:44 MIKEP
+remove unicode warnings
+
+ Rev 1.26 12 Jan 1994 21:20:20 STEVEN
+browse did not have drives that did not have labels
+
+ Rev 1.25 24 Nov 1993 15:33:04 BARRY
+Fix Unicode warning
+
+ Rev 1.24 15 Oct 1993 16:30:42 GLENN
+Eliminated drives that are not in our DLE list from common browse dlg.
+
+ Rev 1.23 21 Jul 1993 16:18:48 KEVINS
+Corrected problem with displaying of browse dialog.
+
+ Rev 1.22 18 Jun 1993 10:24:04 Aaron
+Ifdef'd ofn.Flags setting: OFN_NONETWORKBUTTON only defined for NT
+
+ Rev 1.21 11 Jun 1993 14:12:30 MIKEP
+enable c++
+
+ Rev 1.20 09 Jun 1993 11:49:38 DARRYLP
+Removed network button from browse dialog.
+
+ Rev 1.19 21 May 1993 18:15:46 KEVINS
+Replaced hard coded browse dialog box title with ID_BROWSETITLE usage.
+
+ Rev 1.18 19 May 1993 10:47:56 KEVINS
+Changed name of dialog box to just "Browse".
+
+ Rev 1.17 12 May 1993 17:57:54 KEVINS
+Correct some drive designator logic.
+
+ Rev 1.16 04 May 1993 10:54:10 DARRYLP
+Fixed browsing directory search.
+
+ Rev 1.15 03 May 1993 10:29:36 DARRYLP
+Changed browse path in search dialog to match given path in combobox.
+
+ Rev 1.14 23 Feb 1993 16:41:32 ROBG
+Removed double click exit so double clicking on a directory
+selects it for further browsing, instead of the target.
+
+ Rev 1.13 12 Nov 1992 14:19:00 MIKEP
+fix cast for 16bit brain dead os
+
+ Rev 1.12 01 Nov 1992 15:52:46 DAVEV
+Unicode changes
+
+ Rev 1.11 07 Oct 1992 13:44:28 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.10 04 Oct 1992 19:35:34 DAVEV
+Unicode Awk pass
+
+ Rev 1.9 17 Sep 1992 17:39:34 DAVEV
+minor fix (strsiz->strsize)
+
+ Rev 1.8 17 Sep 1992 15:50:52 DAVEV
+UNICODE modifications: strlen usage check
+
+ Rev 1.7 17 Aug 1992 13:17:00 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.6 30 Jul 1992 09:50:22 STEVEN
+fix warnings
+
+ Rev 1.5 28 Jul 1992 14:45:20 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.4 26 Jun 1992 15:52:08 DAVEV
+
+
+ Rev 1.3 29 May 1992 16:01:04 JOHNWT
+PCH updates
+
+ Rev 1.2 15 May 1992 14:55:30 MIKEP
+changes
+
+ Rev 1.1 23 Apr 1992 10:14:44 DAVEV
+d_browse only compiled if OEM_MSOFT defined
+
+ Rev 1.0 06 Apr 1992 15:19:02 DAVEV
+Initial revision.
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#ifndef LOCALVAR
+# define LOCALVAR static
+#endif
+
+# define DRIVENAMEFORMAT TEXT("%s %s")
+
+#define DUMMY_FILE TEXT("dummy.fil")
+#define DUMMY_DRIVE TEXT("c:\\")
+#define DUMMY_PATH DUMMY_DRIVE DUMMY_FILE
+#define MAX_BROWSE_PATH_LEN 1024
+
+BOOL APIENTRY DM_BrowsePathDialogHook (HWND, MSGID, MP1, MP2);
+BOOL DM_RemoveUnknownVolumes ( HWND, INT );
+BOOL APIENTRY DM_BrowseLogPathDialogHook (HWND, MSGID, MP1, MP2);
+
+/***************************************************
+
+ Name: DM_GetBrowsePath
+
+ Description: Put up a dialog to allow the user
+ to select a drive + directory
+ path.
+
+ Parameters: hWndOwner is the window to use
+ as the owner of the dialog or NULL.
+
+ pszPath contains the initial directory.
+ If pszPath points to an empty string,
+ or contains NULL, the current working
+ directory is used.
+
+ nPathLen is the length of the buffer
+ pointed to by pszPath.
+
+ Returns: TRUE - the user selected Enter
+ If pszPath is not NULL, then the
+ selected drive+path is copied into
+ the provided buffer.
+
+ FALSE - the user selected Cancel or an error
+ occurred. CommDlgExtendedError () may
+ be called to determine the error condition.
+
+ Note: The current working directory will
+ be changed to the user selected drive
+ and directory.
+
+*****************************************************/
+
+BOOL DM_GetBrowsePath (
+
+HWND hWndOwner, // I - handle dialog owner or NULL
+HINSTANCE hInstance, // I - Application Instance handle
+LPSTR pszPath, // I - Initial directory O - User selected directory
+UINT nPathLen ) // I - sizeof of pszPath buffer
+
+{
+ static INT nLenDummyFile = 0;
+ static INT nLenDummyDrive;
+ static INT nLenDummyPath;
+ static CHAR szTitle [128];
+
+ INT nLenPath;
+ INT nCurrentDrive;
+ INT nNewDrive;
+ CHAR pCurrentDir[MAX_BROWSE_PATH_LEN];
+ CHAR pNewDir[MAX_BROWSE_PATH_LEN];
+ CHAR *pTemp;
+ OPENFILENAME ofn; // struct. passed to GetSaveFileName
+ LPSTR pszInitPath = NULL; // Initial path
+
+ FARPROC lpfnFileOpenHook = (FARPROC)MakeProcInstance( DM_BrowsePathDialogHook, hInstance );
+
+ // Dialog box title
+
+ RSM_StringCopy ( IDS_BROWSETITLE, (LPSTR) szTitle, sizeof (szTitle) );
+
+ if ( !nLenDummyFile )
+ {
+ nLenDummyFile = strlen ( DUMMY_FILE );
+ nLenDummyDrive = strlen ( DUMMY_DRIVE );
+ nLenDummyPath = strlen ( DUMMY_PATH );
+ }
+
+ memset (&ofn, 0, sizeof (ofn) );
+
+ if ( pszPath && *pszPath ) //if an initial directory specified...
+ {
+ pszInitPath = (CHAR_PTR)calloc ( sizeof ( CHAR ), strlen ( pszPath ) + 1 ); //make a copy
+ strcpy ( pszInitPath, pszPath );
+
+ // Attempt to set our current drive and path to our log directory
+ // Store current path and drive so that we may reset back when done.
+
+ nCurrentDrive = _getdrive();
+ _getdcwd ( nCurrentDrive, pCurrentDir, MAX_BROWSE_PATH_LEN );
+
+ strcpy(pNewDir, pszInitPath);
+
+ for (pTemp = pNewDir+strlen(pNewDir);
+ ((*pTemp != '\\') && (pTemp > pNewDir));pTemp--);
+
+ *pTemp = 0;
+
+ nNewDrive = (INT)( toupper(*pszInitPath) - 'A' ) + 1 ;
+
+ _chdrive ( nNewDrive );
+ _chdir ( pNewDir );
+
+ //NOTE: May need test to determine if the initial path is valid
+ // If the init path is not valid, we should use the current
+ // directory on the specified drive - if one is specified.
+ // Otherwise, use the current working directory and drive, and
+ // totally ignore the init path.
+ // OpenSaveFileName currently ignores the init path if any part
+ // of it is not valid, which is not quite right.
+ }
+
+ *pszPath = TEXT('\0');
+
+ // Fill in the OPENFILENAME struct. and show dialog box
+
+ ofn.hInstance = ghResInst;
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hWndOwner;
+ ofn.lpstrFile = pszPath;
+ ofn.nMaxFile = nPathLen;
+ ofn.lpstrInitialDir = pszInitPath;
+ ofn.lpstrTitle = szTitle;
+ ofn.lpTemplateName = IDD_BROWSE;
+
+
+# ifdef OS_WIN32
+
+ ofn.Flags = OFN_HIDEREADONLY
+ | OFN_NOREADONLYRETURN
+ | OFN_ENABLETEMPLATE
+ | OFN_NONETWORKBUTTON
+ | OFN_ENABLEHOOK;
+
+ ofn.lpfnHook = (LPOFNHOOKPROC)lpfnFileOpenHook;
+
+# else
+
+ ofn.Flags = OFN_HIDEREADONLY
+ | OFN_NOREADONLYRETURN
+ | OFN_ENABLETEMPLATE
+ | OFN_ENABLEHOOK;
+
+ ofn.lpfnHook = lpfnFileOpenHook;
+
+# endif
+
+
+ if ( GetSaveFileName ((LPOPENFILENAME)&ofn) )
+ {
+ nLenPath = strlen ( pszPath );
+
+ if ( nLenPath == nLenDummyPath )
+ {
+ // Root directory selected, so chop off dummy filename only.
+
+ pszPath [ nLenDummyDrive ] = TEXT('\0');
+ }
+ else
+ {
+ // Path to a subdirectory selected, so chop off the dummy
+ // filename & trailing backslash
+
+ pszPath [ nLenPath - nLenDummyFile - 1 ] = TEXT('\0');
+ }
+
+ // Reset Drive and path.
+
+ _chdrive ( nCurrentDrive );
+
+ if ( pCurrentDir != NULL )
+ {
+ _chdir (pCurrentDir );
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+BOOL APIENTRY DM_BrowsePathDialogHook (
+
+HWND hDlg,
+MSGID msg,
+MP1 mp1,
+MP2 mp2 )
+
+{
+ static BOOL fProcessingUserSelection = FALSE;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ {
+ HWND hWndChild;
+
+ DM_CenterDialog ( hDlg );
+
+ // Set the focus to the drive tree list box
+
+ if ( hWndChild = GetDlgItem ( hDlg, lst2 ) )
+ {
+ SetFocus ( hWndChild );
+ }
+
+ DM_RemoveUnknownVolumes ( hDlg, cmb2 );
+
+ SendMessage ( GetDlgItem ( hDlg, lst2 ), LB_SETHORIZONTALEXTENT, (MP1)600, (MP2)0 );
+
+ }
+ break;
+
+ case WM_COMMAND:
+ {
+ WORD wID = GET_WM_COMMAND_ID ( mp1, mp2 );
+ WORD wCmd = GET_WM_COMMAND_CMD ( mp1, mp2 );
+
+ if ( ( ! fProcessingUserSelection ) && ( wID == IDOK && wCmd == BN_CLICKED ) )
+ {
+ HWND hWndOkButton = GetDlgItem ( hDlg, IDOK );
+ HWND hWndFileEdit = GetDlgItem ( hDlg, edt1 );
+
+ fProcessingUserSelection = TRUE;
+ SET_WM_COMMAND_PARAMS ( IDOK, BN_CLICKED, hWndOkButton, mp1, mp2);
+
+ SendMessage ( hDlg, WM_COMMAND, mp1, mp2 );
+
+ SetWindowText ( hWndFileEdit, (LPSTR)DUMMY_FILE );
+
+ SendMessage ( hDlg, WM_COMMAND, mp1, mp2 );
+
+
+ fProcessingUserSelection = FALSE;
+
+ return TRUE; // We processed the message, so Windows should not
+ }
+
+ if ( wID == cmb2 && wCmd == CBN_SETFOCUS ) {
+ DM_RemoveUnknownVolumes ( hDlg, cmb2 );
+ }
+
+ }
+ break;
+
+ }
+
+ return FALSE; // did not process message, or, for WM_INITDIALOG, we
+ // set the focus, so Windows must not change it.
+}
+
+
+BOOL DM_RemoveUnknownVolumes (
+
+HWND hDlg,
+INT nItemID )
+
+{
+ VLM_OBJECT_PTR pVLM;
+ CHAR szTempBuf[80];
+ VOID_PTR pServerList = NULL;
+ VOID_PTR pDriverList = NULL;
+ PDS_WMINFO pWinInfo;
+ BOOL fReadOnlyDrive;
+ BOOL fDriveInList;
+ GENERIC_DLE_PTR pDLE;
+ INT nNumDrives;
+ INT nCurSel;
+ INT i;
+ INT nLen;
+ LPSTR *pszDrivesList;
+
+ HWND hWndCB = GetDlgItem ( hDlg, nItemID );
+
+ // Get the currently selected drive.
+
+ nCurSel = SendMessage ( GetDlgItem ( hDlg, nItemID ), CB_GETCURSEL, (MP1)0, (MP2)0 );
+
+ // Get the number if drives in the common dialog list.
+
+ nNumDrives = SendMessage ( GetDlgItem ( hDlg, nItemID ), CB_GETCOUNT, (MP1)0, (MP2)0 );
+
+ pszDrivesList = calloc ( nNumDrives, sizeof ( LPSTR ) );
+
+ if ( ! pszDrivesList ) {
+ return FALSE;
+ }
+
+ // Get all of the drives in the restore browse drives list box and
+ // save the drives list in a temporary array.
+
+ for ( i = 0; i < nNumDrives; i++ ) {
+
+ nLen = SendMessage ( GetDlgItem ( hDlg, nItemID ), CB_GETLBTEXTLEN, (MP1)i, (MP2)0 );
+
+ if ( nLen == CB_ERR ) {
+ return FALSE;
+ }
+
+ pszDrivesList[i] = calloc ( nLen+1, sizeof ( CHAR ) );
+
+ if ( ! pszDrivesList[i] ) {
+ return FALSE;
+ }
+
+ SendMessage ( GetDlgItem ( hDlg, nItemID ), CB_GETLBTEXT, (MP1)i, (MP2)pszDrivesList[i] );
+ }
+
+
+ // Throw out any of them that are not in our DLE list - starting
+ // at the bottom of the list - so the indexes can still be used.
+
+ if ( gb_disks_win != (HWND)NULL ) {
+
+ pWinInfo = WM_GetInfoPtr( gb_disks_win );
+ pDriverList = pWinInfo->pFlatList;
+
+ // Toss out the ones in the common dialog that are not in
+ // our list - and get rid of the ones that cannot be written to.
+
+ for ( i = ( nNumDrives - 1 ); i >= 0; i-- ) {
+
+ fReadOnlyDrive = FALSE;
+ fDriveInList = FALSE;
+
+ pVLM = VLM_GetFirstVLM ( (Q_HEADER_PTR) pDriverList );
+
+ while ( pVLM && ! fDriveInList ) {
+
+ // Make our drive string to compare with.
+
+ if ( strlen ( pVLM->label ) && strcmpi(pVLM->label, pVLM->name) ) {
+ sprintf ( szTempBuf, DRIVENAMEFORMAT, pVLM->name, pVLM->label );
+ }
+ else {
+ sprintf ( szTempBuf, DRIVENAMEFORMAT, pVLM->name, TEXT(" ") );
+ }
+
+ if ( ! strcmpi ( szTempBuf, pszDrivesList[i] ) ) {
+
+ fDriveInList = TRUE;
+
+ DLE_FindByName ( dle_list, pVLM->name, (INT16)-1, &pDLE );
+
+ if ( DLE_DriveWriteable(pDLE) == FALSE ) {
+ fReadOnlyDrive = TRUE;
+ } else {
+ fReadOnlyDrive = FALSE;
+ }
+ }
+
+ pVLM = VLM_GetNextVLM ( pVLM );
+ }
+
+ if ( fReadOnlyDrive || ! fDriveInList ) {
+
+ SendDlgItemMessage ( hDlg, nItemID, CB_DELETESTRING, i, (MP2)0 );
+
+ }
+ }
+ }
+
+ // Reselect the previously selected drive.
+
+ SendMessage ( GetDlgItem ( hDlg, nItemID ), CB_SELECTSTRING, (MP1)-1, (MP2)pszDrivesList[nCurSel] );
+
+ for ( i = 0; i < nNumDrives; i++ ) {
+
+ free ( pszDrivesList[i] );
+ }
+
+ free ( pszDrivesList );
+
+ return TRUE;
+
+} /* end DM_RemoveUnknownVolumes () */
+
+
+/******************************************************************************
+
+ Name: DM_BrowseForLogFilePath
+
+ Description: Put up a dialog to allow the user
+ to select a drive + directory
+ path.
+
+******************************************************************************/
+
+BOOL DM_BrowseForLogFilePath (
+
+HWND hWndOwner, // I - handle dialog owner or NULL
+HINSTANCE hInstance, // I - Application Instance handle
+LPSTR pszPath, // I - Initial directory O - User selected directory
+UINT nPathLen ) // I - sizeof of pszPath buffer
+
+{
+ INT nCurrentDrive;
+ INT nNewDrive;
+ UINT nTotal;
+ CHAR pCurrentDir[MAX_BROWSE_PATH_LEN];
+ CHAR pNewDir[MAX_BROWSE_PATH_LEN];
+ CHAR *pTemp;
+ CHAR szTitle[128];
+ CHAR szFilter[128];
+ BOOL fRC = FALSE;
+ OPENFILENAME ofn;
+ FARPROC lpfnFileOpenHook = (FARPROC)MakeProcInstance( DM_BrowseLogPathDialogHook, hInstance );
+
+ // Create the filter list.
+
+ {
+ CHAR szLoad[128];
+
+ RSM_StringCopy ( IDS_BROWSELOGFILES, (LPSTR) szLoad, 128 );
+ strcpy ( szFilter, szLoad );
+ nTotal = strlen(szLoad) + 1;
+
+ RSM_StringCopy ( IDS_BROWSELOGFILESEXT, (LPSTR) szLoad, 128 );
+ strcpy( &szFilter[nTotal], szLoad);
+ nTotal += strlen(szLoad) + 1;
+
+ RSM_StringCopy ( IDS_BROWSEALLFILES, (LPSTR) szLoad, 128 );
+ strcpy( &szFilter[nTotal], szLoad);
+ nTotal += strlen(szLoad) + 1;
+
+ RSM_StringCopy ( IDS_BROWSEALLFILESEXT, (LPSTR) szLoad, 128 );
+ strcpy( &szFilter[nTotal], szLoad);
+ nTotal += strlen(szLoad) + 1;
+
+ // Add the extra NULL at the end of the string for double
+ // NULL terminated string.
+
+ szFilter[nTotal] = 0;
+ }
+
+
+ RSM_StringCopy ( IDS_BROWSETITLE, (LPSTR) szTitle, sizeof (szTitle) / sizeof (CHAR) );
+
+ memset (&ofn, 0, sizeof (ofn) );
+
+ // Attempt to set our current drive and path to our log directory
+ // Store current path and drive so that we may reset back when done.
+
+ nCurrentDrive = _getdrive();
+ _getdcwd(nCurrentDrive, pCurrentDir, MAX_BROWSE_PATH_LEN);
+
+ strcpy ( pNewDir, pszPath );
+
+ pTemp = strrchr ( pNewDir, TEXT('\\') );
+
+ if ( pTemp ) {
+ pTemp++;
+ *pTemp = TEXT('\0');
+ }
+
+ nNewDrive = (INT)(toupper(*pszPath) - 'A') + 1;
+
+ _chdrive ( nNewDrive );
+ _chdir ( pNewDir );
+
+ // Fill in the OPENFILENAME struct. and show dialog box
+
+ ofn.hInstance = ghResInst;
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hWndOwner;
+ ofn.lpstrFilter = (LPSTR)szFilter;
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFile = pszPath;
+ ofn.nMaxFile = BROWSE_MAXPATH;
+ ofn.lpstrTitle = (LPSTR) szTitle;
+ ofn.lpTemplateName = IDD_LOGFILEBROWSE;
+ ofn.lpfnHook = (LPOFNHOOKPROC)lpfnFileOpenHook;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_NOREADONLYRETURN |
+ OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST |
+ OFN_ENABLETEMPLATE | OFN_ENABLEHOOK;
+
+
+ if ( GetSaveFileName ( (LPOPENFILENAME)&ofn ) ) {
+
+ fRC = TRUE;
+ }
+ else {
+ DWORD dwErr = CommDlgExtendedError ();
+ }
+
+ // Need to change drive as well, so reset Drive and path.
+
+ _chdrive ( nCurrentDrive );
+
+ if ( pCurrentDir != NULL ) {
+ _chdir ( pCurrentDir );
+ }
+
+ return fRC;
+}
+
+
+BOOL APIENTRY DM_BrowseLogPathDialogHook (
+
+HWND hDlg,
+MSGID msg,
+MP1 mp1,
+MP2 mp2 )
+
+{
+ UNREFERENCED_PARAMETER ( mp1 );
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch (msg) {
+
+ case WM_INITDIALOG:
+ {
+ DM_CenterDialog ( hDlg );
+
+ SendMessage ( GetDlgItem ( hDlg, lst2 ), LB_SETHORIZONTALEXTENT, (MP1)600, (MP2)0 );
+
+ }
+ break;
+
+ case WM_COMMAND:
+ break;
+
+ }
+
+ return FALSE;
+
+}
+
+
diff --git a/private/utils/ntbackup/src/d_ctape.c b/private/utils/ntbackup/src/d_ctape.c
new file mode 100644
index 000000000..6b205993c
--- /dev/null
+++ b/private/utils/ntbackup/src/d_ctape.c
@@ -0,0 +1,497 @@
+
+/***************************************************
+
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_ctape.c
+
+ Description: dialog proc for dialog for cataloging an entire tape
+
+ $Log: G:\UI\LOGFILES\D_CTAPE.C_V $
+
+ Rev 1.27 01 Dec 1993 14:21:40 mikep
+add SQL recognition support to poll drive
+
+ Rev 1.26 30 Jul 1993 08:55:52 CARLS
+added VLM_ECC_TAPE & VLM_FUTURE_VER
+
+ Rev 1.25 11 Jun 1993 14:13:24 MIKEP
+enable c++
+
+ Rev 1.24 05 Apr 1993 16:57:46 chrish
+Added one line "gbCurrentOperation = OPERATION_CATALOG" for security
+on tape cataloging.
+
+ Rev 1.23 07 Oct 1992 13:34:18 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.22 04 Oct 1992 19:35:40 DAVEV
+Unicode Awk pass
+
+ Rev 1.21 26 Aug 1992 14:12:40 DAVEV
+Fixed NT compile error
+
+ Rev 1.21 26 Aug 1992 14:11:00 DAVEV
+Fixed NT compile error
+
+ Rev 1.20 06 Aug 1992 13:23:58 CHUCKB
+Changes for NT.
+
+ Rev 1.18 15 May 1992 14:53:54 MIKEP
+nt pass 2
+
+ Rev 1.17 14 May 1992 16:38:08 MIKEP
+NT pass 2
+
+ Rev 1.16 12 May 1992 21:21:26 MIKEP
+NT pass 1
+
+ Rev 1.15 27 Mar 1992 10:26:26 DAVEV
+OEM_MSOFT: add user name to tape info string
+
+ Rev 1.14 16 Mar 1992 15:09:06 ROBG
+added help
+
+ Rev 1.13 30 Jan 1992 14:06:30 CARLS
+added a call to check for password
+
+ Rev 1.12 27 Jan 1992 00:29:30 CHUCKB
+Updated dialog id's.
+
+ Rev 1.11 24 Jan 1992 11:55:30 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.10 16 Jan 1992 09:22:24 CARLS
+disabled the continue button for blank tape
+
+ Rev 1.9 13 Jan 1992 09:30:42 CARLS
+added a call to the clock routine at init time
+
+ Rev 1.8 10 Jan 1992 13:38:10 JOHNWT
+internationalization round 2
+
+ Rev 1.7 10 Jan 1992 13:02:26 JOHNWT
+internationalized dates
+
+ Rev 1.6 10 Jan 1992 09:35:04 ROBG
+Modified HELPID.
+
+ Rev 1.5 09 Jan 1992 18:10:34 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.4 06 Jan 1992 15:01:14 CHUCKB
+Added help.
+
+ Rev 1.3 14 Dec 1991 11:20:48 CARLS
+changes for full/partial catalog
+
+ Rev 1.2 07 Dec 1991 12:27:08 CARLS
+added poll drive to dialog
+
+ Rev 1.1 25 Nov 1991 14:57:14 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 24 Sep 1991 13:50:38 CHUCKB
+Initial revision.
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+typedef struct CAT_INFO *CAT_INFO_PTR;
+typedef struct CAT_INFO {
+ TCHAR szTapeName[255];
+ BOOL IsOutOfSeq;
+} CAT_INFO;
+
+struct cattape_temp {
+ WORD dialog_return_status;
+ HTIMER timer_handle;
+ HWND ghDlg; /* window handle of the dialog box */
+ UINT32 tape_id;
+ INT16 bset_num;
+ WORD display_status;
+ INT poll_drive_freq;
+ INT catalog_flag;
+};
+
+static struct cattape_temp *cattape_temp_ptr;
+
+
+static VOID clock_routine( VOID );
+
+/****************************************************************************
+
+ Name: DM_CatTape ()
+
+ Description: Entry point for the application to catalog a tape.
+
+ Modified: 6/17/91
+
+ Returns: INT telling whether the user chose to:
+ cancel the operation,
+ re-read the tape (user swapped the tape in the drive), or
+ catalog the tape
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+
+INT DM_CatTape ( INT * catalog_flag_ptr )
+
+{
+INT status;
+struct cattape_temp temp_data;
+
+ cattape_temp_ptr = &temp_data;
+
+ status = DM_ShowDialog ( ghWndFrame, IDD_CATTAPE, NULL );
+ *catalog_flag_ptr = cattape_temp_ptr->catalog_flag;
+
+ return( status );
+}
+
+/***************************************************
+
+ Name: DM_CatalogTape ()
+
+ Description: dialog proc for dialog for cataloging an entire tape
+
+ Modified:
+
+ Returns: true if message was processed
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+DLGRESULT APIENTRY DM_CatalogTape (
+HWND hDlg , /* window handle of the dialog box */
+MSGID message , /* type of message */
+MP1 mp1 , /* message-specific information */
+MP2 mp2
+)
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+ HDC hDCBitmap;
+ HWND hWnd;
+ HICON hIcon;
+ BOOL button_state;
+ CDS_PTR cds_ptr;
+ WORD catalog_mode;
+ WORD status;
+
+
+ gbCurrentOperation = OPERATION_CATALOG; // chs:04-05-93
+ UNREFERENCED_PARAMETER ( mp2 );
+ switch ( message )
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ cattape_temp_ptr->ghDlg = hDlg;
+ cattape_temp_ptr->tape_id = 0;
+
+ DM_CenterDialog( hDlg );
+
+ /* read POLL DRIVE data */
+ clock_routine( );
+
+ cattape_temp_ptr->poll_drive_freq = PD_SetFrequency( 1 );
+ cattape_temp_ptr->timer_handle = WM_HookTimer( (PF_VOID)clock_routine, 1 );
+
+ cds_ptr = CDS_GetCopy();
+
+ /* Catalog check box */
+ catalog_mode = CDS_GetCatalogLevel( cds_ptr );
+ if( catalog_mode == CATALOGS_FULL ) {
+ CheckRadioButton( hDlg, IDD_CATTAPE_CATALOG_FULL, IDD_CATTAPE_CATALOG_PARTIAL, IDD_CATTAPE_CATALOG_FULL );
+ }
+ else {
+ CheckRadioButton( hDlg, IDD_CATTAPE_CATALOG_FULL, IDD_CATTAPE_CATALOG_PARTIAL, IDD_CATTAPE_CATALOG_PARTIAL );
+ }
+
+ return ( TRUE );
+
+ case WM_PAINT:
+
+ hDC = BeginPaint( hDlg, &ps );
+ EndPaint( hDlg, &ps );
+ UpdateWindow( hDlg ); /* force the dialog to be displayed now */
+
+ /* display the exclamation bitmap in the dialog */
+ hIcon = LoadIcon( 0, IDI_EXCLAMATION );
+ hWnd = GetDlgItem( hDlg, IDD_CATTAPE_EXCLAMATION_BITMAP );
+ hDCBitmap = GetDC( hWnd );
+ DrawIcon( hDCBitmap, 0, 0, hIcon );
+ ReleaseDC( hWnd, hDCBitmap );
+
+ return ( TRUE );
+
+ case WM_COMMAND: /* message: received a command */
+ switch( GET_WM_COMMAND_ID ( mp1, mp2 ) )
+ {
+/****************************************************************************
+ Continue button
+/***************************************************************************/
+ case IDD_CATTAPE_CONTINUE_BUTTON:
+
+ /* save the state of the catalog(full/partial) */
+ button_state = IsDlgButtonChecked( hDlg, IDD_CATTAPE_CATALOG_FULL );
+
+ if( button_state ) {
+ cattape_temp_ptr->catalog_flag = TRUE; /* = full */
+ }
+ else {
+ cattape_temp_ptr->catalog_flag = FALSE; /* = partial */
+ }
+
+ /* check for a password */
+ status = PSWD_CheckForPassword( cattape_temp_ptr->tape_id ,
+ cattape_temp_ptr->bset_num );
+
+ if( status == SUCCESS) /* if passwords matched - set return code to SUCCESS */
+ status = TRUE;
+ else
+ status = FALSE;
+
+ WM_UnhookTimer( cattape_temp_ptr->timer_handle );
+ PD_SetFrequency( cattape_temp_ptr->poll_drive_freq );
+
+ EndDialog( hDlg, status ); /* Exits the dialog box */
+
+ return ( TRUE );
+ break;
+/****************************************************************************
+ Help button
+/***************************************************************************/
+ case IDD_CATTAPE_HELP_BUTTON:
+ case IDHELP :
+
+ HM_DialogHelp( HELPID_DIALOGCATTAPE );
+
+ return ( TRUE );
+ break;
+/****************************************************************************
+ Cancel button
+/***************************************************************************/
+ case IDD_CATTAPE_CANCEL_BUTTON:
+ case IDCANCEL:
+
+ WM_UnhookTimer( cattape_temp_ptr->timer_handle );
+ PD_SetFrequency( cattape_temp_ptr->poll_drive_freq );
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+ return ( TRUE );
+ break;
+
+ }
+ break;
+ }
+ return ( FALSE ); /* Didn't process a message */
+}
+
+
+/***************
+
+ GetDriveStatus
+ possible return values
+ SEE VLM.H
+
+ VLM_VALID_TAPE 0
+ VLM_DRIVE_BUSY 1
+ VLM_FOREIGN_TAPE 2
+ VLM_BLANK_TAPE 3
+ VLM_NO_TAPE 4
+ VLM_BUSY 5
+ VLM_BAD_TAPE 6
+ VLM_GOOFY_TAPE 7
+ VLM_DISABLED 8
+ VLM_UNFORMATED 9
+ VLM_DRIVE_FAILURE 10
+ VLM_FUTURE_VER 11
+ VLM_ECC_TAPE 12
+ VLM_SQL_TAPE 13
+
+
+***************/
+/***************************************************
+
+ Name: clock_routine
+
+ Description: poll drive status routine
+
+ Returns: void
+
+*****************************************************/
+static VOID clock_routine( VOID )
+{
+ DBLK_PTR vcb_ptr;
+ DATE_TIME_PTR dt;
+ INT status;
+ UINT32 current_tape_id;
+ CHAR date_str[MAX_UI_DATE_SIZE];
+ CHAR time_str[MAX_UI_TIME_SIZE];
+
+ status = VLM_GetDriveStatus( &vcb_ptr );
+
+ switch( status ) {
+
+ case VLM_VALID_TAPE:
+
+ /* get this tape ID */
+ current_tape_id = FS_ViewTapeIDInVCB( vcb_ptr );
+
+ /* if this ID not equal to the last ID, then must be a new tape */
+ if( cattape_temp_ptr->tape_id != current_tape_id )
+ {
+ /* save this tape ID */
+ cattape_temp_ptr->tape_id = current_tape_id;
+ cattape_temp_ptr->bset_num = FS_ViewBSNumInVCB( vcb_ptr );
+
+ /* display name, date and time of this tape */
+ dt = FS_ViewBackupDateInVCB( vcb_ptr );
+ UI_MakeDateString( date_str, dt->month, dt->day, dt->year % 100 );
+ UI_MakeShortTimeString( time_str, dt->hour, dt->minute );
+
+# if defined ( OEM_MSOFT ) //alternate feature
+ {
+ yresprintf( (INT16) RES_ERASE_TAPE_INFO1 ,
+ FS_ViewTapeNameInVCB( vcb_ptr ) ,
+ FS_ViewUserNameInVCB( vcb_ptr ) ,
+ date_str ,
+ time_str );
+ }
+# else //if defined ( OEM_MSOFT ) //alternate feature
+ {
+ yresprintf( (INT16) RES_ERASE_TAPE_INFO1 ,
+ FS_ViewTapeNameInVCB( vcb_ptr ) ,
+ date_str ,
+ time_str );
+ }
+# endif //defined ( OEM_MSOFT ) //alternate feature
+
+
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button on */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), TRUE );
+ }
+ break;
+
+ case VLM_FUTURE_VER:
+ case VLM_SQL_TAPE:
+ case VLM_ECC_TAPE:
+ case VLM_FOREIGN_TAPE:
+
+ if(cattape_temp_ptr->display_status != VLM_FOREIGN_TAPE ) {
+
+ cattape_temp_ptr->display_status = VLM_FOREIGN_TAPE;
+ yresprintf( (INT16) RES_ERASE_FOREIGN_TAPE );
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button OFF */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE );
+ cattape_temp_ptr->tape_id = 0;
+ }
+ break;
+
+ case VLM_BLANK_TAPE:
+
+ if(cattape_temp_ptr->display_status != VLM_BLANK_TAPE ) {
+
+ cattape_temp_ptr->display_status = VLM_BLANK_TAPE;
+ yresprintf( (INT16) RES_ERASE_BLANK_TAPE );
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button off for blank tape */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE );
+ cattape_temp_ptr->tape_id = 0;
+ }
+ break;
+
+ case VLM_NO_TAPE:
+
+ if(cattape_temp_ptr->display_status != VLM_NO_TAPE ) {
+
+ cattape_temp_ptr->display_status = VLM_NO_TAPE;
+ yresprintf( (INT16) RES_ERASE_NO_TAPE );
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button OFF for no tape */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE );
+ cattape_temp_ptr->tape_id = 0;
+ }
+ break;
+
+ case VLM_BUSY:
+
+ if(cattape_temp_ptr->display_status != VLM_BUSY ) {
+
+ cattape_temp_ptr->display_status = VLM_BUSY;
+ yresprintf( (INT16) RES_ERASE_DRIVE_BUSY );
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button off when busy */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE );
+ cattape_temp_ptr->tape_id = 0;
+ }
+ break;
+
+ case VLM_DISABLED:
+
+ if(cattape_temp_ptr->display_status != VLM_DISABLED ) {
+
+ cattape_temp_ptr->display_status = VLM_DISABLED;
+ yresprintf( (INT16) RES_ERASE_POLL_DRIVE_DISABLED );
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button OFF */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE );
+ cattape_temp_ptr->tape_id = 0;
+ }
+ break;
+
+ case VLM_BAD_TAPE:
+
+ if(cattape_temp_ptr->display_status != VLM_BAD_TAPE ) {
+
+ cattape_temp_ptr->display_status = VLM_BAD_TAPE;
+ yresprintf( (INT16) RES_POLL_DRIVE_BAD_TAPE );
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button off */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE );
+ cattape_temp_ptr->tape_id = 0;
+ }
+ break;
+
+ case VLM_GOOFY_TAPE:
+
+ if(cattape_temp_ptr->display_status != VLM_GOOFY_TAPE ) {
+
+ cattape_temp_ptr->display_status = VLM_GOOFY_TAPE;
+ yresprintf( (INT16) RES_POLL_DRIVE_GOOFY_TAPE );
+ SetDlgItemText( cattape_temp_ptr->ghDlg, IDD_CATTAPE_MESSAGE, gszTprintfBuffer );
+
+ /* turn the CONTINUE button off */
+ EnableWindow ( GetDlgItem ( cattape_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE );
+ cattape_temp_ptr->tape_id = 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
diff --git a/private/utils/ntbackup/src/d_date.c b/private/utils/ntbackup/src/d_date.c
new file mode 100644
index 000000000..1c1596335
--- /dev/null
+++ b/private/utils/ntbackup/src/d_date.c
@@ -0,0 +1,145 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_date.c
+
+ Description: date utilities for dialogs
+
+ $Log:
+
+ Rev 1.0 ?? ??? 1991 ??:??:?? ??????
+Initial revision.
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/***************************************************
+
+ Name: DM_IsLeapYear ()
+
+ Description:
+
+ Modified:
+
+ Returns: boolean true if message was processed
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+
+BOOL DM_IsLeapYear ( INT year )
+
+{
+ if ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0 )
+ return TRUE ;
+ else
+ return FALSE ;
+}
+
+
+
+/***************************************************
+
+ Name: DM_DaysInMonth ( )
+
+ Description: determines how many days are in the given month
+ in the given year; if year is a leap year Feb changes
+
+ Modified:
+
+ Returns: WORD number of days in the month given
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+INT DM_DaysInMonth ( INT month, INT year )
+
+{
+ switch ( month ) {
+
+ case 1 :
+ case 3 :
+ case 5 :
+ case 7 :
+ case 8 :
+ case 10 :
+ case 12 :
+ return 31 ;
+
+ case 4 :
+ case 6 :
+ case 9 :
+ case 11 :
+ return 30 ;
+
+ case 2 :
+
+ if ( DM_IsLeapYear ( year ) )
+ return 29;
+ else
+ return 28 ;
+
+ default :
+ return 0 ;
+ }
+}
+
+
+/***************************************************
+
+ Name: DM_IsDateValid ( )
+
+ Description: compares two dates that are supposed to come in
+ order; if the one that is supposed to be first is
+ not before the one that is supposed to be second,
+ something is wrong;
+ also checks the number of days in a month
+
+ Modified:
+
+ Returns: BOOL true if the second date is after the first
+ false otherwise
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL DM_IsDateValid ( INT bmonth, INT bday, INT byear,
+ INT amonth, INT aday, INT ayear )
+
+{
+ // first check the numbers of days in the months
+
+ if ( ( bday > DM_DaysInMonth ( bmonth, byear ) ) ||
+ ( aday > DM_DaysInMonth ( amonth, ayear ) ) ) {
+
+ return FALSE ;
+ }
+
+ // the numbers of days are kosher; now see if they are in order
+
+ if ( byear < ayear )
+ return FALSE ;
+ else if ( byear == ayear ) {
+ if ( bmonth < amonth ) return FALSE ;
+ else if ( bmonth == amonth )
+ return ( bday >= aday ) ;
+ }
+ return TRUE ;
+}
+
diff --git a/private/utils/ntbackup/src/d_dbug.c b/private/utils/ntbackup/src/d_dbug.c
new file mode 100644
index 000000000..e1c1f4938
--- /dev/null
+++ b/private/utils/ntbackup/src/d_dbug.c
@@ -0,0 +1,329 @@
+
+/***************************************************
+
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_dbug.c
+
+ Description: dialog proc for debug window settings dialog
+
+ $Log: G:/UI/LOGFILES/D_DBUG.C_V $
+
+ Rev 1.17 01 Nov 1992 15:53:00 DAVEV
+Unicode changes
+
+ Rev 1.16 14 Oct 1992 15:50:28 GLENN
+Added /ZL debug logging command line support.
+
+ Rev 1.15 07 Oct 1992 13:34:48 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.14 04 Oct 1992 19:35:44 DAVEV
+Unicode Awk pass
+
+ Rev 1.13 28 Jul 1992 15:04:46 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.12 07 Jul 1992 15:51:26 MIKEP
+unicode changes
+
+ Rev 1.11 15 May 1992 16:48:04 MIKEP
+incl_cds removal
+
+ Rev 1.10 15 May 1992 14:53:56 MIKEP
+nt pass 2
+
+ Rev 1.9 14 May 1992 16:40:10 MIKEP
+Nt pass 2
+
+ Rev 1.8 19 Mar 1992 09:30:32 MIKEP
+enable debug to file
+
+ Rev 1.7 04 Feb 1992 15:28:22 CHUCKB
+Removed EOF char.
+
+ Rev 1.6 09 Jan 1992 18:11:36 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.5 06 Jan 1992 15:00:52 CHUCKB
+Added help.
+
+ Rev 1.4 03 Jan 1992 19:18:06 CHUCKB
+Put in new CDS calls.
+
+ Rev 1.3 19 Dec 1991 13:37:36 CHUCKB
+Put in display memory and poll drive options.
+
+ Rev 1.2 16 Dec 1991 11:45:04 CHUCKB
+Added include windows.h.
+
+ Rev 1.1 25 Nov 1991 14:58:40 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 07 Aug 1991 14:12:50 CHUCKB
+Initial revision.
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/***************************************************
+
+ Name: DM_SettingsDebug ()
+
+ Description: contains dialog proc for debug window settings dialog
+
+ Modified:
+
+ Returns: true if message was processed
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+DLGRESULT APIENTRY DM_SettingsDebug (
+
+ HWND hDlg,
+ MSGID msg ,
+ MPARAM1 mp1 ,
+ MPARAM2 mp2 )
+
+{
+ CDS_PTR pPermCDS = CDS_GetPerm ();
+
+ INT nNumToKeep ;
+ INT iLoopIndex ;
+ CHAR szFileName[20] ;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+
+ // EnableWindow( GetDlgItem( hDlg, IDD_DB_TOFILE), FALSE ) ;
+
+ CheckDlgButton( hDlg, IDD_DB_POLLDRIVEON, gfPollDrive ) ;
+ CheckDlgButton( hDlg, IDD_DB_MEMTRACE, gfShowMemory ) ;
+
+ CheckRadioButton( hDlg, IDD_DB_RLAST, IDD_DB_RALL,
+ ( CDS_GetDebugWindowShowAll( pPermCDS ) ? IDD_DB_RALL : IDD_DB_RLAST ) ) ;
+
+ SetDlgItemInt ( hDlg, IDD_DB_RNUM, CDS_GetDebugWindowNumLines( pPermCDS ), FALSE ) ;
+
+ strcpy ( szFileName, CDS_GetDebugFileName( pPermCDS ) ) ;
+ SetDlgItemText ( hDlg, IDD_DB_FNAME, szFileName ) ;
+ SendDlgItemMessage ( hDlg, IDD_DB_FNAME, EM_LIMITTEXT,
+ (MPARAM1) 8, (MPARAM2) NULL ) ;
+
+ SetDlgItemInt ( hDlg, IDD_DB_WMSGS, DBM_GetMsgCount ( DBM_WINDOW ), FALSE ) ;
+ SetDlgItemInt ( hDlg, IDD_DB_FMSGS, DBM_GetMsgCount ( DBM_FILE ), FALSE ) ;
+
+ CheckDlgButton ( hDlg, IDD_DB_TOFILE, CDS_GetDebugToFile( pPermCDS ) ) ;
+ CheckDlgButton ( hDlg, IDD_DB_TOWIN, CDS_GetDebugToWindow( pPermCDS ) ) ;
+
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RFILE ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_FNAME ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_FMSGS ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ) ;
+
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RMEM ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RALL ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RLAST ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RNUM ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_WMSGS ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_M ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+
+ return TRUE ;
+
+ case WM_COMMAND :
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_DIALOGSETTINGSDEBUG ) ;
+ return( TRUE ) ;
+
+ case IDD_DB_TOWIN :
+
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RMEM ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RALL ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RLAST ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RNUM ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_WMSGS ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_M ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) ;
+ return TRUE ;
+
+ case IDD_DB_RLAST :
+ case IDD_DB_RALL :
+
+ CheckRadioButton ( hDlg, IDD_DB_RLAST, IDD_DB_RALL,
+ GET_WM_COMMAND_ID ( mp1, mp2 ) ) ;
+ return TRUE ;
+
+ case IDD_DB_RNUM :
+ case IDD_DB_WMSGS :
+ case IDD_DB_FNAME :
+ case IDD_DB_FMSGS :
+ return TRUE ;
+
+ case IDD_DB_RMEM :
+
+ DBM_Reset ( DBM_WINDOW ) ;
+ SetDlgItemInt ( hDlg, IDD_DB_WMSGS, DBM_GetMsgCount ( DBM_WINDOW ), FALSE ) ;
+ return TRUE ;
+
+ case IDD_DB_TOFILE :
+
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_RFILE ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_FNAME ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_DB_FMSGS ),
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ) ;
+ return TRUE ;
+
+ case IDD_DB_RFILE :
+
+ DBM_Reset ( DBM_FILE ) ;
+ SetDlgItemInt ( hDlg, IDD_DB_FMSGS, DBM_GetMsgCount ( DBM_FILE ), FALSE ) ;
+ return TRUE ;
+
+ case IDOK : {
+
+ BOOL fResult ;
+
+ if ( IsDlgButtonChecked ( hDlg, IDD_DB_RLAST ) &&
+ IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ) {
+
+ if ( GetDlgItemInt ( hDlg, IDD_DB_RNUM, NULL, FALSE ) < DBM_MIN_LINES ) {
+ WM_MsgBox ( ID(IDS_DEBUGWARNING),
+ ID(IDS_DEBUGMESSAGESTOOLOW),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION ) ;
+ return TRUE ;
+ }
+
+ if ( GetDlgItemInt ( hDlg, IDD_DB_RNUM, NULL, FALSE ) > DBM_MAX_LINES ) {
+ WM_MsgBox ( ID(IDS_DEBUGWARNING),
+ ID(IDS_DEBUGMESSAGESTOOHIGH),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION ) ;
+ return TRUE ;
+ }
+ }
+
+ if ( IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ) {
+
+ GetDlgItemText ( hDlg, IDD_DB_FNAME, szFileName, 19 ) ;
+
+ for ( iLoopIndex = 0; iLoopIndex < (INT) strlen ( szFileName ); iLoopIndex++ ) {
+ if ( szFileName[iLoopIndex] == TEXT(' ') ) {
+
+ WM_MsgBox ( ID(IDS_DEBUGWARNING),
+ ID(IDS_DEBUGBADFILENAME),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION ) ;
+ return TRUE ;
+ }
+ }
+
+ if ( strlen ( szFileName ) < 1 ) {
+ strcpy ( szFileName, TEXT("debug") ) ;
+ }
+ CDS_SetDebugFileName ( pPermCDS, szFileName ) ;
+ CDS_WriteDebugFileName ( pPermCDS ) ;
+ }
+
+ gfPollDrive = IsDlgButtonChecked( hDlg, IDD_DB_POLLDRIVEON ) ;
+
+ // Turn on or off Poll Drive.
+
+ if ( ! gfOperation ) {
+
+ if ( ! gfPollDrive ) {
+
+ PD_StopPolling ();
+
+ } else {
+
+ PD_StartPolling ();
+ }
+ }
+
+ fResult = IsDlgButtonChecked ( hDlg, IDD_DB_RALL ) ;
+
+ if ( fResult != CDS_GetDebugWindowShowAll ( pPermCDS ) ) {
+ CDS_SetDebugWindowShowAll ( pPermCDS, fResult ) ;
+ CDS_WriteDebugWindowShowAll ( pPermCDS ) ;
+ }
+
+ fResult = IsDlgButtonChecked ( hDlg, IDD_DB_TOFILE ) ;
+
+ if ( fResult != CDS_GetDebugToFile ( pPermCDS ) ) {
+ DBM_SetDebugToFile ( fResult ) ;
+ CDS_SetDebugToFile ( pPermCDS, fResult ) ;
+ CDS_WriteDebugToFile ( pPermCDS ) ;
+ }
+
+ fResult = IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) ;
+
+ if ( fResult != CDS_GetDebugToWindow ( pPermCDS ) ) {
+ CDS_SetDebugToWindow ( pPermCDS, fResult ) ;
+ CDS_WriteDebugToWindow ( pPermCDS ) ;
+ }
+
+ gfShowMemory = IsDlgButtonChecked( hDlg, IDD_DB_MEMTRACE ) ;
+
+ nNumToKeep = GetDlgItemInt ( hDlg, IDD_DB_RNUM, NULL, FALSE ) ;
+
+ if ( IsDlgButtonChecked ( hDlg, IDD_DB_TOWIN ) &&
+ ( nNumToKeep != CDS_GetDebugWindowNumLines ( pPermCDS ) ) ) {
+
+ CDS_SetDebugWindowNumLines ( pPermCDS, (INT16)nNumToKeep ) ;
+ CDS_WriteDebugWindowNumLines ( pPermCDS ) ;
+ }
+
+ }
+
+ case IDCANCEL :
+
+ EndDialog ( hDlg, 0 ) ;
+ return TRUE ;
+
+ default:
+ return FALSE ;
+ }
+ break ;
+
+ case WM_CLOSE :
+ EndDialog ( hDlg, 0 ) ;
+ break ;
+
+ default :
+ return FALSE ;
+ }
+ return TRUE ;
+}
diff --git a/private/utils/ntbackup/src/d_erase.c b/private/utils/ntbackup/src/d_erase.c
new file mode 100644
index 000000000..ef2399e07
--- /dev/null
+++ b/private/utils/ntbackup/src/d_erase.c
@@ -0,0 +1,166 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_erase.c
+
+ Description: dialog proc for erase operation settings
+
+ $Log: G:/UI/LOGFILES/D_ERASE.C_V $
+
+ Rev 1.14 15 Jun 1993 08:30:32 MIKEP
+enable c++
+
+ Rev 1.13 07 Oct 1992 13:35:16 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.12 04 Oct 1992 19:35:50 DAVEV
+Unicode Awk pass
+
+ Rev 1.11 15 May 1992 14:53:58 MIKEP
+nt pass 2
+
+ Rev 1.10 14 May 1992 16:40:18 MIKEP
+Nt pass 2
+
+ Rev 1.9 03 Mar 1992 17:04:24 GLENN
+Removed the dialog table loop call and just used DM_ShowDialog.
+
+ Rev 1.8 04 Feb 1992 15:28:08 CHUCKB
+Removed EOF char.
+
+ Rev 1.7 27 Jan 1992 12:47:42 GLENN
+Changed dialog support calls.
+
+ Rev 1.6 20 Jan 1992 10:36:16 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.5 10 Jan 1992 09:07:40 ROBG
+Changed HELPID
+
+ Rev 1.4 09 Jan 1992 18:12:26 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.3 07 Jan 1992 12:40:44 CHUCKB
+Added help.
+
+ Rev 1.2 16 Dec 1991 11:57:14 CHUCKB
+Added include windows.h.
+
+ Rev 1.1 25 Nov 1991 15:00:02 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 07 Jun 1991 16:22:22 GLENN
+Initial revision.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/***************************************************
+
+ Name: DM_ProceedWithErase ()
+
+ Description: dialog proc for erase operation settings
+
+ Modified:
+
+ Returns: boolean true if user wants to continue
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL DM_ProceedWithErase ( VOID )
+
+{
+ CDS_PTR pTempCDS = CDS_GetCopy() ;
+
+ DM_ShowDialog ( ghWndFrame, IDD_OPERATIONSERASE, (PVOID)0 );
+
+ return ( CDS_GetEraseFlag ( pTempCDS ) != ERASE_OFF ) ;
+}
+
+
+/***************************************************
+
+ Name: DM_EraseTape
+
+ Description: dialog proc for erase operation settings
+
+ Modified:
+
+ Returns: boolean true if message was processed
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+DLGRESULT APIENTRY DM_EraseTape (
+
+ HWND hDlg,
+ MSGID msg ,
+ MPARAM1 mp1 ,
+ MPARAM2 mp2 )
+
+{
+ CDS_PTR pPermCDS = CDS_GetPerm() ;
+ CDS_PTR pTempCDS = CDS_GetCopy() ;
+ INT16 nTemp ;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+
+ DM_CenterDialog( hDlg ) ;
+
+ // fill in the backup sets on the tape, etc.
+
+ // SetDlgItemText ( hDlg, IDD_TAPENAME, "Tape Name" ) ;
+
+ // while there are more sets on the tape
+
+ // SendDlgItemMessage ( hDlg, IDD_SETSONTAPE, LB_ADDSTRING,
+ // 0, (LONG) "A Set on the Tape" ) ;
+
+ nTemp = CDS_GetEraseFlag( pPermCDS ) ;
+ CheckDlgButton ( hDlg, IDD_SECERASE, ( nTemp == ERASE_LONG ) ) ;
+
+ return TRUE ;
+
+ case WM_COMMAND :
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_DIALOGERASE ) ;
+ return( TRUE ) ;
+
+ case IDOK :
+
+ CDS_SetEraseFlag(pTempCDS,ERASE_ON);
+ if ( IsDlgButtonChecked ( hDlg,
+ GET_WM_COMMAND_ID ( mp1, mp2 ) ) ) {
+
+ CDS_SetEraseFlag(pTempCDS,ERASE_LONG);
+ }
+
+ case IDCANCEL :
+
+ EndDialog ( hDlg, 0 ) ;
+ return TRUE ;
+ }
+ break ;
+ }
+ return FALSE;
+}
diff --git a/private/utils/ntbackup/src/d_o_bkup.c b/private/utils/ntbackup/src/d_o_bkup.c
new file mode 100644
index 000000000..3d9003c37
--- /dev/null
+++ b/private/utils/ntbackup/src/d_o_bkup.c
@@ -0,0 +1,2590 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: D_O_BKUP.C
+
+ Description: Runtime backup set description dialog
+
+ $Log: G:\ui\logfiles\d_o_bkup.c_v $
+
+ Rev 1.96.1.15 02 Feb 1994 17:57:44 chrish
+Added changes for UNICODE app to handle ANSI secured created tapes.
+
+ Rev 1.96.1.14 02 Feb 1994 11:28:56 Glenn
+Overhauled log file browse support - now a separate function in d_browse.c.
+
+ Rev 1.96.1.13 25 Jan 1994 08:40:38 MIKEP
+fix warnings for orcas
+
+ Rev 1.96.1.12 17 Jan 1994 15:19:14 MIKEP
+fix more unicoe warnings
+
+ Rev 1.96.1.11 08 Jan 1994 14:58:56 MikeP
+fix string internationalization characteristics
+
+ Rev 1.96.1.10 14 Dec 1993 12:26:00 BARRY
+Don't write to gszTprintfBuffer, use yprintf
+
+ Rev 1.96.1.9 02 Dec 1993 15:58:18 mikep
+add sql tape recognition
+
+ Rev 1.96.1.8 24 Nov 1993 19:14:00 GREGG
+Added hardware compression option to backup dialog and config.
+
+ Rev 1.96.1.7 04 Nov 1993 15:45:22 STEVEN
+japanese changes
+
+ Rev 1.96.1.6 16 Jun 1993 17:08:28 GLENN
+Fixed CANCEL bug while being called in MultiTask.
+
+ Rev 1.96.1.5 11 Jun 1993 14:25:38 BARRY
+Use dle features for backup of special files instead of FS_PromptForBindery.
+
+ Rev 1.96.1.4 02 Jun 1993 15:49:16 KEVINS
+Corrected logic error when calculating new drive to change to during browse.
+
+ Rev 1.96.1.3 26 May 1993 15:12:42 BARRY
+Got rid of hard-coded strings.
+
+ Rev 1.96.1.2 24 May 1993 15:19:24 BARRY
+Unicode fixes.
+
+ Rev 1.96.1.1 22 May 1993 18:41:00 BARRY
+Fixed to compile for MIPs
+
+ Rev 1.96.1.0 22 May 1993 16:11:04 BARRY
+Changed hard-coded strings to IDs.
+
+ Rev 1.96 12 May 1993 09:38:02 DARRYLP
+Cleared owner field when tape is ejected. It needs to be re-read, and
+displayed fresh for a new tape.
+
+ Rev 1.95 07 May 1993 18:36:38 MIKEP
+Check in kludge to allow turning hardware compression off. We will
+do this cleaner later, I promise.
+
+ Rev 1.94 04 May 1993 10:55:40 DARRYLP
+Fixed browse path search.
+
+ Rev 1.93 03 May 1993 11:23:22 CHUCKB
+Update to my last change: took out function InitiallyCheckRegistry that we don't use any more.
+
+ Rev 1.92 03 May 1993 11:18:56 CHUCKB
+Changed the way we evaluate whether or not to check the backup registry box.
+Before, we used a number of things, including defaulting to ON and looking for
+ALL_FILES_SELECTED. Now, we only use the BSD_xxxProcSpecialFlg.
+
+ Rev 1.91 03 May 1993 10:30:26 DARRYLP
+Changed browse path to reflect combobox.
+
+ Rev 1.90 28 Apr 1993 16:58:48 CARLS
+fix for drive failure
+
+ Rev 1.89 23 Apr 1993 16:09:54 CARLS
+fix for drive busy message displayed, but tape window shows a valid tape name
+
+ Rev 1.88 22 Apr 1993 17:40:00 chrish
+Fix for Cayman: EPR 0173 - Made change to the default tape label name
+to append the time. Per MikeP suggestion for giving the default tape name
+some default uniqueness.
+
+ Rev 1.87 13 Apr 1993 17:20:30 CHUCKB
+If running a job that has 'Backup Registry' set, check it.
+
+ Rev 1.86 08 Apr 1993 17:14:28 chrish
+Added change to prevent backup a tape passworded by the CAYMAN app.
+
+ Rev 1.85 08 Apr 1993 13:29:28 MIKEP
+fix for partial catalog button
+
+ Rev 1.84 29 Mar 1993 11:34:38 TIMN
+Expand user supplied log filename to full path
+
+ Rev 1.83 26 Mar 1993 13:15:50 STEVEN
+Ifdef'ed skip files stuff out for Nostro.
+
+ Rev 1.82 25 Mar 1993 17:25:18 CHUCKB
+Dealing with skipped files had been #ifdef'ed out for any 32-bit op. sys. Now it works for Cayman
+.
+
+ Rev 1.81 17 Mar 1993 16:17:38 chrish
+Changed detection of backup privilege to "SeBackupPrivilege".
+
+ Rev 1.80 16 Mar 1993 12:40:12 CARLS
+LOG file changes
+
+ Rev 1.79 11 Mar 1993 17:22:12 CHUCKB
+Gray compression controls for beta.
+
+ Rev 1.78 10 Mar 1993 12:43:40 CARLS
+Changes to move Format tape to the Operations menu
+
+ Rev 1.77 09 Mar 1993 11:17:18 DARRYLP
+Fixed my new bug.
+
+ Rev 1.76 08 Mar 1993 14:41:30 DARRYLP
+Added support for read only drives.
+
+ Rev 1.75 22 Feb 1993 17:07:42 CHUCKB
+Fixed bug: ignore OK message of OK button is grey.
+
+ Rev 1.74 22 Feb 1993 11:29:30 chrish
+Added changes received from MikeP.
+Fixed the password that was put on tape. It was encrypting one copy,
+but putting a nonencrypted copy on tape.
+
+ Rev 1.73 18 Feb 1993 10:50:40 BURT
+Changes for Cayman
+
+
+ Rev 1.72 11 Feb 1993 14:42:42 CARLS
+disable append operation to tape that does not support it
+
+ Rev 1.71 07 Jan 1993 09:46:54 CARLS
+defined out InitiallyActivateRegistryBox for non NT
+
+ Rev 1.70 15 Dec 1992 11:19:50 chrish
+Corrected logic to handle possible NULL returned from
+GetCurrentMachineNameUserName routine.
+
+ Rev 1.69 14 Dec 1992 12:17:00 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.68 16 Nov 1992 15:15:06 chrish
+Minor changes to clean-up warning messages on build.
+
+ Rev 1.68 16 Nov 1992 12:23:46 chrish
+Minor changes to clean-up warning messages on buildin.
+
+ Rev 1.67 13 Nov 1992 17:24:10 chrish
+Added backup for Secure Tape and change for registry check box - NT.
+
+ Rev 1.66 11 Nov 1992 16:32:00 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.65 01 Nov 1992 15:55:02 DAVEV
+Unicode changes
+
+ Rev 1.64 29 Oct 1992 16:41:30 STEVEN
+added rules for default on registry
+
+ Rev 1.63 27 Oct 1992 17:42:14 STEVEN
+enable registry support
+
+ Rev 1.62 21 Oct 1992 17:12:44 MIKEP
+last time
+
+ Rev 1.61 21 Oct 1992 13:42:16 MIKEP
+fix steve changes
+
+ Rev 1.60 21 Oct 1992 13:39:46 MIKEP
+fix steve changes
+
+ Rev 1.59 21 Oct 1992 12:46:38 STEVEN
+added support for registry
+
+ Rev 1.58 07 Oct 1992 13:37:38 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.57 04 Oct 1992 19:36:18 DAVEV
+Unicode Awk pass
+
+ Rev 1.56 30 Sep 1992 10:38:58 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.55 17 Sep 1992 16:54:38 STEVEN
+added support for daily backup
+
+ Rev 1.54 17 Sep 1992 15:49:54 DAVEV
+UNICODE modifications: strlen usage check
+
+ Rev 1.53 09 Sep 1992 10:08:58 CHUCKB
+Changed ifdef's to include browse features used only in Nostrodamus.
+
+ Rev 1.51 03 Sep 1992 10:43:38 CHUCKB
+Took out some unreferenced locals.
+
+ Rev 1.50 19 Aug 1992 14:29:18 CHUCKB
+Added new stuff for NT.
+
+ Rev 1.49 28 Jul 1992 15:04:52 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.48 08 Jul 1992 15:35:46 STEVEN
+Unicode BE changes
+
+ Rev 1.47 29 Jun 1992 09:05:48 CARLS
+added changes for TDEMO
+
+ Rev 1.46 26 Jun 1992 15:52:52 DAVEV
+
+
+ Rev 1.45 18 Jun 1992 11:25:36 DAVEV
+OEM_MSOFT:fixed logging bug
+
+ Rev 1.44 11 Jun 1992 15:22:08 DAVEV
+do not display status message 'Examine <log file> for more info' if not logging
+
+ Rev 1.43 05 Jun 1992 12:42:42 DAVEV
+OEM_MSOFT: Init log file name to default
+
+ Rev 1.42 04 Jun 1992 14:56:56 davev
+OEM_MSOFT: Kludge-disable 'Restrict Access..' checkbox in dialog
+
+ Rev 1.41 14 May 1992 16:37:22 MIKEP
+NT pass 2
+
+ Rev 1.40 12 May 1992 15:52:58 DAVEV
+OEM_MSOFT: fixed problem with tape name not being saved
+
+
+*****************************************************/
+
+#include "all.h"
+#include "ctl3d.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+//
+// Kludged for now to test the HW compression stuff. The proper way is
+// for the compression stuff to be placed in tape format.
+//
+#ifndef OEM_MSOFT
+#include "special.h" // chs:04-23-93
+#include "dddefs.h" // chs:04-23-93
+#endif
+
+#define ON 1
+#define OFF 0
+#define SECONDS_SIZE 2
+#define NO_SHOW 0
+#define SHOW 1
+#define REDRAW 1
+#define NO_REDRAW 0
+
+// Initial security state of the tape
+#define ORIGINALLYUNSECURED 0
+#define ORIGINALLYSECURED 1
+#define ORIGINALLYDONTKNOW 2
+#define MAX_BROWSE_PATH_LEN 1024
+
+WORD RT_BSD_index;
+WORD RT_max_BSD_index;
+#ifdef OEM_EMS
+INT32 RT_BSD_OsId;
+#endif
+
+static BOOL mwfCancelRequestDelayed;
+
+static WORD OriginalTapeSecured; // Tells the original security
+ // state of the tape
+
+static WORD EnableSecurityDlgFlag; // Flag to tell whether to Enable
+ // security dialog
+
+static VOID clock_routine( VOID );
+static VOID ScrollLineDown( VOID );
+static VOID ScrollLineUp( VOID );
+
+static BOOL bTransfer;
+
+struct backup_set_temp {
+ WORD mode_flag;
+ WORD dialog_return_status;
+ WORD BSD_index;
+ WORD max_BSD_index;
+ HTIMER timer_handle;
+ HWND ghDlg; /* global window handle of the dialog box */
+ UINT32 tape_id;
+ WORD display_status;
+ INT poll_drive_freq;
+ INT16 tape_password_leng;
+ CHAR job_password[ MAX_TAPE_PASSWORD_SIZE ];
+};
+
+static struct backup_set_temp *backup_set_temp_ptr;
+static VOID_PTR reenter_password_ptr;
+/***************************************************
+
+ Name: DM_StartBackupSet()
+
+ Description: Starts the Runtime backup set description dialog
+
+ Returns: Returns the status from the
+ Runtime backup set description dialog.
+
+*****************************************************/
+INT DM_StartBackupSet(
+ INT oper_type )
+{
+INT status;
+struct backup_set_temp temp_data;
+
+ backup_set_temp_ptr = &temp_data;
+ backup_set_temp_ptr->mode_flag = oper_type;
+
+ /* set the display_status to a value not returned by VLM_GetDriveStatus */
+ backup_set_temp_ptr->display_status = 0x7fff ;
+ backup_set_temp_ptr->tape_id = 0 ;
+
+ status = DM_ShowDialog( ghWndFrame, IDD_BACKUPSET, NULL );
+
+ return( backup_set_temp_ptr->dialog_return_status );
+}
+/***************************************************
+
+ Name: DM_BackupSet()
+
+ Description: Runtime backup set description dialog.
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_BackupSet(
+ HWND hDlg , /* window handle of the dialog box */
+ MSGID message , /* type of message */
+ MPARAM1 mp1 , /* message-specific information */
+ MPARAM2 mp2 )
+{
+ HWND hScrollbar;
+ WORD thumbposition;
+ WORD button_state;
+ LPSTR generic_str_ptr;
+ BSD_PTR bsd_ptr;
+ CDS_PTR cds_ptr;
+ GENERIC_DLE_PTR dle_ptr;
+ BE_CFG_PTR be_cfg_ptr;
+ CHAR buffer[ MAX_UI_RESOURCE_SIZE ];
+ CHAR buffer2[ MAX_UI_RESOURCE_SIZE ];
+ DBLK_PTR vcb_ptr;
+#if !defined ( OEM_MSOFT ) // unused variables
+ INT16 pswd_size;
+ WORD wait_time;
+ CHAR reenter_password[ MAX_TAPE_PASSWORD_SIZE ];
+#endif // unused variables
+
+#ifdef OEM_EMS
+ static DLG_CTRL_ENTRY DefaultCtrlTable[] = {
+ { IDD_BKUP_XCHG_NAME_TEXT, 0, CM_HIDE },
+ { IDD_BKUP_XCHG_NAME, 0, CM_HIDE },
+ { IDD_XCHG_BKUP_METHOD, 0, CM_HIDE },
+ { IDD_BKUP_DRIVE_NAME_TEXT, 0, CM_ENABLE },
+ { IDD_BKUP_DRIVE_NAME, 0, CM_ENABLE },
+ { IDD_BKUP_METHOD, 0, CM_ENABLE }
+ };
+
+ static DLG_CTRL_ENTRY EMSCtrlTable[] = {
+ { IDD_BKUP_DRIVE_NAME_TEXT, 0, CM_HIDE },
+ { IDD_BKUP_DRIVE_NAME, 0, CM_HIDE },
+ { IDD_BKUP_METHOD, 0, CM_HIDE },
+ { IDD_BKUP_XCHG_NAME_TEXT, 0, CM_ENABLE },
+ { IDD_BKUP_XCHG_NAME, 0, CM_ENABLE },
+ { IDD_XCHG_BKUP_METHOD, 0, CM_ENABLE }
+ };
+
+ // FS_UNKNOWN_OS must be last w/ no other iDispType == FS_UNKNOWN_OS (or its value).
+ static DLG_DISPLAY_ENTRY BkupDispTable[] = {
+ { FS_EMS_MDB_ID, EMSCtrlTable,
+ sizeof(EMSCtrlTable)/sizeof(EMSCtrlTable[0]), IDH_DB_XCHG_BACKUPSET },
+ { FS_EMS_DSA_ID, EMSCtrlTable,
+ sizeof(EMSCtrlTable)/sizeof(EMSCtrlTable[0]), IDH_DB_XCHG_BACKUPSET },
+ { FS_UNKNOWN_OS, DefaultCtrlTable,
+ sizeof(DefaultCtrlTable)/sizeof(DefaultCtrlTable[0]), HELPID_DIALOGBACKUPSET }
+ };
+
+ static DLG_DISPLAY_ENTRY ArchDispTable[] = {
+ { FS_EMS_MDB_ID, EMSCtrlTable,
+ sizeof(EMSCtrlTable)/sizeof(EMSCtrlTable[0]), IDH_DB_XCHG_BACKUPSET },
+ { FS_EMS_DSA_ID, EMSCtrlTable,
+ sizeof(EMSCtrlTable)/sizeof(EMSCtrlTable[0]), IDH_DB_XCHG_BACKUPSET },
+ { FS_UNKNOWN_OS, DefaultCtrlTable,
+ sizeof(DefaultCtrlTable)/sizeof(DefaultCtrlTable[0]), HELPID_DIALOGTRANSFER }
+ };
+
+ static DLG_MODE ModeTable[] = {
+ { ARCHIVE_BACKUP_OPER, ArchDispTable,
+ sizeof(ArchDispTable)/sizeof(ArchDispTable[0]), &(ArchDispTable[2]) },
+ { BACKUP_OPER, BkupDispTable,
+ sizeof(BkupDispTable)/sizeof(BkupDispTable[0]), &(ArchDispTable[2]) },
+ { 0, BkupDispTable,
+ sizeof(BkupDispTable)/sizeof(BkupDispTable[0]), &(ArchDispTable[2]) }
+ };
+
+ static UINT16 cModeTblSize = sizeof( ModeTable ) / sizeof( ModeTable[0] );
+ static DLG_MODE *pCurMode;
+ DWORD help_id;
+
+#endif
+
+ switch ( message )
+ {
+/****************************************************************************
+ INIT THE DIALOG
+/***************************************************************************/
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ // Let's go 3-D!!
+ Ctl3dSubclassDlgEx( hDlg, CTL3D_ALL );
+
+ DM_CenterDialog( hDlg );
+
+ backup_set_temp_ptr->ghDlg = hDlg;
+ backup_set_temp_ptr->tape_id = 0;
+ OriginalTapeSecured = ORIGINALLYDONTKNOW;
+ EnableSecurityDlgFlag = 0;
+ mwfCancelRequestDelayed = FALSE;
+
+#ifdef OEM_EMS
+ pCurMode = DM_InitCtrlTables( hDlg, ModeTable, cModeTblSize,
+ backup_set_temp_ptr->mode_flag );
+#endif
+
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_HARDCOMP ) , // chs: 04-22-93
+ ( thw_list->drv_info.drv_features & TDI_DRV_COMPRESSION ) ? ON : OFF ); // chs: 04-22-93
+ CheckDlgButton ( hDlg, IDD_BKUP_HARDCOMP, CDS_GetHWCompMode ( CDS_GetCopy() ) ) ;
+
+ /* set the length of the text fields */
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ SendDlgItemMessage( hDlg, IDD_BKUP_PASSWORD, EM_LIMITTEXT,
+ MAX_TAPE_PASSWORD_LEN, 0 );
+ }
+# endif
+
+ SendDlgItemMessage( hDlg, IDD_BKUP_TAPE_NAME, EM_LIMITTEXT,
+ MAX_TAPE_NAME_LEN, 0 );
+ SendDlgItemMessage( hDlg, IDD_BKUP_DESCRIPTION, EM_LIMITTEXT,
+ MAX_BSET_NAME_LEN, 0 );
+
+ /* Normal not allowed with Transfer operation */
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ RSM_StringCopy( IDS_METHOD_NORMAL, buffer, sizeof(buffer) );
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#ifdef OEM_EMS
+ SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#endif
+ }
+
+ RSM_StringCopy( IDS_METHOD_COPY, buffer, sizeof(buffer) );
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#ifdef OEM_EMS
+ SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#endif
+
+ /* Differential/Incremental not allowed with Transfer operation */
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ RSM_StringCopy( IDS_METHOD_DIFFERENTIAL, buffer, sizeof(buffer) );
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#ifdef OEM_EMS
+ SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#endif
+
+ RSM_StringCopy( IDS_METHOD_INCREMENTAL, buffer, sizeof(buffer) );
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#ifdef OEM_EMS
+ SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+#endif
+
+ RSM_StringCopy( IDS_METHOD_DAILY, buffer, sizeof(buffer) );
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_ADDSTRING,
+ 0, MP2FROMPVOID ( buffer ) );
+ }
+ else {
+ /* Transfer operation - disable the combo box */
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_METHOD ) , OFF );
+#ifdef OEM_EMS
+ EnableWindow( GetDlgItem( hDlg, IDD_XCHG_BKUP_METHOD ) , OFF );
+#endif
+ }
+
+ /* select the first item in the list */
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_SETCURSEL, 0, 0 );
+#ifdef OEM_EMS
+ SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD, CB_SETCURSEL, 0, 0 );
+#endif
+
+#if defined ( TDEMO )
+
+ /* if a NORMAL backup, only enable the COPY method to prevent */
+ /* the archive bit from being reset */
+
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ /* select copy from the list */
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_SETCURSEL, 1, 0 );
+#ifdef OEM_EMS
+ SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD, CB_SETCURSEL, 1, 0 );
+#endif
+
+ /* tdemo exe - disable the combo box */
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_METHOD ) , OFF );
+#ifdef OEM_EMS
+ EnableWindow( GetDlgItem( hDlg, IDD_XCHG_BKUP_METHOD ) , OFF );
+#endif
+ }
+#endif
+
+ /* start at the first BSD */
+ backup_set_temp_ptr->BSD_index = 0;
+ bsd_ptr = GetBSDPointer( backup_set_temp_ptr->BSD_index );
+
+ BackupSetDefaultSettings( );
+
+ cds_ptr = CDS_GetCopy();
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+
+ /* generate the default names for the tape and description fields */
+ /* return the max number of BSD's for this backup */
+ backup_set_temp_ptr->max_BSD_index = BackupSetDefaultDescription();
+
+
+ /* set the global BSD index used for the "Set information N of N" dialogs title */
+ RT_BSD_index = (WORD)(backup_set_temp_ptr->BSD_index + 1);
+ RT_max_BSD_index = (WORD)(backup_set_temp_ptr->max_BSD_index + 1);
+
+ hScrollbar = GetDlgItem( hDlg, IDD_BKUP_SCROLLBAR );
+
+ /* if only one backup set, turn off the scrollbar */
+ if( backup_set_temp_ptr->max_BSD_index == backup_set_temp_ptr->BSD_index )
+ ShowScrollBar( hScrollbar, SB_CTL, NO_SHOW );
+ else {
+ SetScrollRange( hScrollbar, SB_CTL, backup_set_temp_ptr->BSD_index, backup_set_temp_ptr->max_BSD_index, NO_REDRAW );
+ SetScrollPos( hScrollbar, SB_CTL, backup_set_temp_ptr->BSD_index, NO_REDRAW );
+ }
+
+ /* add "1 of n" to backup set info title */
+ RSM_StringCopy( IDS_SET_INFORMATION, buffer, sizeof(buffer) );
+ wsprintf( buffer2, buffer, backup_set_temp_ptr->BSD_index + 1, backup_set_temp_ptr->max_BSD_index + 1 );
+ SetDlgItemText( hDlg, IDD_BKUP_INFO_TITLE, buffer2 );
+
+ /* display the default tape name */
+ generic_str_ptr = (LPSTR)BSD_GetTapeLabel( bsd_ptr );
+
+ SetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, generic_str_ptr );
+
+ /* display the default tape password */
+# if !defined ( OEM_MSOFT )
+ {
+ generic_str_ptr = BSD_GetTapePswd( bsd_ptr );
+ if( generic_str_ptr) {
+
+ strcpy( buffer, generic_str_ptr );
+ pswd_size = (INT16)(strlen ( generic_str_ptr ) * sizeof (CHAR));
+ if( pswd_size ) {
+
+ CryptPassword( DECRYPT, ENC_ALGOR_3, buffer, pswd_size );
+ }
+ SetDlgItemText( hDlg, IDD_BKUP_PASSWORD, buffer );
+ }
+
+ /* Include catalogs check box */
+ CheckDlgButton( hDlg, IDD_BKUP_INCLUDE_CATALOGS, CDS_GetBackupCatalogs( cds_ptr ) );
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+
+ /* Append/replace radio check box */
+ if( CDS_GetAppendFlag( cds_ptr ) ) {
+
+ /* if append operation, clear the tape name field */
+ /* and the password field */
+ buffer[0] = 0;
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ SetDlgItemText( hDlg, IDD_BKUP_PASSWORD, buffer ); /* clear password field */
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ SetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, buffer ); /* clear tape name field */
+
+ /* disable password & tape name fields */
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_PASSWORD ) , OFF );
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_PASSWORD_TEXT ) , OFF );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_TAPE_NAME ) , OFF );
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_TAPE_NAME_TEXT ) , OFF );
+
+ CheckRadioButton( hDlg, IDD_BKUP_APPEND, IDD_BKUP_REPLACE, IDD_BKUP_APPEND );
+ }
+ else
+ CheckRadioButton( hDlg, IDD_BKUP_APPEND, IDD_BKUP_REPLACE, IDD_BKUP_REPLACE );
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ wait_time = CDS_GetWaitTime( cds_ptr );
+ wsprintf( buffer, TEXT("%d"), wait_time );
+ SetDlgItemText( hDlg, IDD_BKUP_SKIP_TIME, buffer );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* Auto verify check box */
+ /* if this operation is a transfer ? */
+ if( backup_set_temp_ptr->mode_flag == ARCHIVE_BACKUP_OPER ) {
+ yresprintf( (INT16) RES_TARGET_TRANSFER_TITLE );
+ SetWindowText( hDlg, gszTprintfBuffer );
+
+ bTransfer = TRUE;
+
+ /* if transfer, check the auto verify box */
+ CheckDlgButton( hDlg, IDD_BKUP_AUTO_VERIFY, 1 );
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_AUTO_VERIFY ) , OFF );
+ }
+ else {
+ CheckDlgButton( hDlg, IDD_BKUP_AUTO_VERIFY, CDS_GetAutoVerifyBackup( cds_ptr ) );
+ bTransfer = FALSE;
+
+ }
+
+ /* display the state of the first BSD */
+#ifndef OEM_EMS
+ BackupSetRetrieve( hDlg );
+#else
+ BackupSetRetrieve( hDlg, pCurMode );
+#endif
+
+ /* retrieve any password that a job may have passed in */
+ generic_str_ptr = &backup_set_temp_ptr->job_password[0];
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ GetDlgItemText( hDlg, IDD_BKUP_PASSWORD, generic_str_ptr, MAX_TAPE_PASSWORD_SIZE );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* read POLL DRIVE data */
+ clock_routine( );
+
+ backup_set_temp_ptr->poll_drive_freq = PD_SetFrequency( 1 );
+ backup_set_temp_ptr->timer_handle = WM_HookTimer( clock_routine, 1 );
+
+# if defined ( OEM_MSOFT ) // special feature
+ {
+# define OEMLOG_MAX_FILEPATH 512 //NTKLUG
+
+ CHAR szLogFilePath[ OEMLOG_MAX_FILEPATH ];
+ INT len;
+
+ if ( len = GetWindowsDirectory ( szLogFilePath,
+ OEMLOG_MAX_FILEPATH ) )
+ {
+ if ( szLogFilePath[ len-1 ] != TEXT('\\') //NTKLUG
+ && len < OEMLOG_MAX_FILEPATH )
+ {
+ strcat ( szLogFilePath, TEXT("\\") );
+ ++len;
+ }
+ if ( len < OEMLOG_MAX_FILEPATH
+ && RSM_StringCopy( IDS_OEMLOG_BACKUP_DEF_NAME,
+ szLogFilePath+len,
+ OEMLOG_MAX_FILEPATH - len ) > 0 )
+ {
+ SetDlgItemText( hDlg, IDD_BKUP_LOG_FILENAME,
+ szLogFilePath );
+ }
+ }
+ /* Check default log file radio button */
+
+ CheckRadioButton ( hDlg, IDD_BKUP_LOG_FULL,
+ IDD_BKUP_LOG_NONE,
+ IDD_BKUP_LOG_SUMMARY );
+
+// CheckDlgButton( hDlg, IDD_BKUP_LOG_SUMMARY, 1 );
+
+ }
+# endif //defined ( OEM_MSOFT ) // special feature
+
+ return ( TRUE );
+
+ case WM_VSCROLL:
+
+ hScrollbar = GetDlgItem( hDlg, IDD_BKUP_SCROLLBAR );
+ if( GET_WM_VSCROLL_HWND ( mp1, mp2 ) == hScrollbar ) {
+
+ thumbposition = GET_WM_VSCROLL_POS ( mp1,mp2 );
+
+ switch( GET_WM_VSCROLL_CODE ( mp1, mp2 ) )
+ {
+ case SB_THUMBPOSITION:
+
+ SetScrollPos( hScrollbar, SB_CTL, thumbposition, REDRAW );
+ return ( TRUE );
+
+ case SB_THUMBTRACK:
+
+ if(thumbposition > backup_set_temp_ptr->max_BSD_index )
+ thumbposition = backup_set_temp_ptr->max_BSD_index;
+
+ if( thumbposition >= backup_set_temp_ptr->BSD_index ) {
+ BackupSetSave( hDlg );
+ while( thumbposition != backup_set_temp_ptr->BSD_index ) {
+ ScrollLineUp( );
+ }
+#ifndef OEM_EMS
+ BackupSetRetrieve( hDlg );
+#else
+ BackupSetRetrieve( hDlg, pCurMode );
+#endif
+ }
+ else {
+ BackupSetSave( hDlg );
+ while( thumbposition != backup_set_temp_ptr->BSD_index ) {
+ ScrollLineDown( );
+ }
+#ifndef OEM_EMS
+ BackupSetRetrieve( hDlg );
+#else
+ BackupSetRetrieve( hDlg, pCurMode );
+#endif
+ }
+ return ( TRUE );
+
+ case SB_PAGEUP:
+ case SB_LINEUP:
+
+ BackupSetSave( hDlg );
+ ScrollLineDown( );
+#ifndef OEM_EMS
+ BackupSetRetrieve( hDlg );
+#else
+ BackupSetRetrieve( hDlg, pCurMode );
+#endif
+ SetScrollPos( hScrollbar, SB_CTL, backup_set_temp_ptr->BSD_index, REDRAW );
+ return ( TRUE );
+
+ case SB_PAGEDOWN:
+ case SB_LINEDOWN:
+
+ BackupSetSave( hDlg );
+ ScrollLineUp( );
+#ifndef OEM_EMS
+ BackupSetRetrieve( hDlg );
+#else
+ BackupSetRetrieve( hDlg, pCurMode );
+#endif
+ SetScrollPos( hScrollbar, SB_CTL, backup_set_temp_ptr->BSD_index, REDRAW );
+ return ( TRUE );
+
+ default:
+ break;
+ }
+ }
+ break;
+
+#if defined (OEM_MSOFT) // special feature
+ case WM_KEYDOWN:
+ {
+ if ( ( GET_WM_COMMAND_ID( mp1, mp2 ) == VK_DOWN ) &&
+ ( ( GetFocus() == GetDlgItem( hDlg, IDD_BKUP_LOG_FILENAME ) ) ) ) {
+
+ SendMessage( hDlg, WM_COMMAND, IDD_BKUP_LOG_BROWSE, (MPARAM2) NULL ) ;
+ }
+ return(0) ;
+ }
+#endif // special feature
+
+
+/****************************************************************************
+ WM COMMAND
+/***************************************************************************/
+ case WM_COMMAND: /* message: received a command */
+ {
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+ cds_ptr = CDS_GetCopy();
+
+ switch( wId )
+ {
+ case IDD_BKUP_REPLACE:
+
+ /* if the user selects replace operation , */
+ /* place the default name into the field */
+
+ {
+ CHAR tmp_buf1[ MAX_TAPE_NAME_LEN ];
+ CHAR tmp_buf2[ MAX_TAPE_NAME_LEN ];
+ RSM_StringCopy( IDS_DEFAULT_TAPE_NAME, tmp_buf1, MAX_TAPE_NAME_LEN );
+ UI_CurrentDate( tmp_buf2 );
+ wsprintf( buffer, tmp_buf1, tmp_buf2 ) ;
+ }
+
+ bsd_ptr = GetBSDPointer( 0 );
+
+ /* if the Tape name field is blank - set default name */
+ /* else use the name passed in */
+ if( ! BSD_GetTapeLabel( bsd_ptr ) ) {
+
+ SetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, buffer );
+ }
+
+ /* if the dialog tape name field is blank - set default name */
+ GetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, buffer2, MAX_TAPE_NAME_SIZE );
+ if( strlen( buffer2 ) == 0 ) {
+
+ generic_str_ptr = (LPSTR)BSD_GetTapeLabel( bsd_ptr );
+ SetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, generic_str_ptr );
+ }
+
+ /* enable password & tape name fields */
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_TAPE_NAME ) , ON );
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_TAPE_NAME_TEXT ) , ON );
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_PASSWORD ) , ON );
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_PASSWORD_TEXT ) , ON );
+ }
+# else
+ {
+ if ( EnableSecurityDlgFlag ) {
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ ON );
+ } else {
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+ }
+ if ( CDS_GetPasswordFlag( cds_ptr ) ) {
+ CheckDlgButton( hDlg, IDD_BKUP_RESTRICT_ACCESS, 1 );
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* check the REPLACE button */
+ CheckRadioButton( hDlg, IDD_BKUP_APPEND, IDD_BKUP_REPLACE, IDD_BKUP_REPLACE );
+
+ return ( TRUE );
+
+ case IDD_BKUP_APPEND:
+
+ /* if the user selects append operation, clear the tape name field */
+ /* and the password field */
+ buffer[0] = 0;
+
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ SetDlgItemText( hDlg, IDD_BKUP_PASSWORD, buffer ); /* clear password field */
+ }
+# else
+ {
+ if ( OriginalTapeSecured == ORIGINALLYSECURED ) {
+ CheckDlgButton( hDlg, IDD_BKUP_RESTRICT_ACCESS, 1 );
+
+ } else {
+ CheckDlgButton( hDlg, IDD_BKUP_RESTRICT_ACCESS, 0 );
+ }
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+ }
+
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+
+ SetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, buffer ); /* clear tape name field */
+
+ /* disable password & tape name fields */
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_PASSWORD ) , OFF );
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_PASSWORD_TEXT ) , OFF );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_TAPE_NAME ) , OFF );
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_TAPE_NAME_TEXT ) , OFF );
+ return ( TRUE );
+
+#ifdef OEM_MSOFT //special feature
+
+ case IDD_BKUP_LOG_NONE:
+ case IDD_BKUP_LOG_SUMMARY:
+ case IDD_BKUP_LOG_FULL:
+
+ CheckRadioButton ( hDlg, IDD_BKUP_LOG_NONE,
+ IDD_BKUP_LOG_FULL, wId );
+ return TRUE;
+
+ case IDD_BKUP_RESTRICT_ACCESS:
+
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_RESTRICT_ACCESS );
+ CDS_SetPasswordFlag( cds_ptr, button_state );
+
+ return TRUE;
+
+
+#endif //OEM_MSOFT //special feature
+
+/****************************************************************************
+ Cancel button
+/***************************************************************************/
+ case IDD_BKUP_CANCEL_BUTTON:
+ case IDCANCEL:
+
+ EnableWindow ( GetDlgItem ( hDlg, IDD_BKUP_CANCEL_BUTTON ), OFF );
+
+ // If poll drive is busy, we have been called from
+ // within poll drive multi-task - do not kill off the
+ // dialog.
+
+ if ( PD_IsPollDriveBusy () ) {
+
+ mwfCancelRequestDelayed = TRUE;
+ return TRUE;
+ }
+
+ backup_set_temp_ptr->dialog_return_status = TRUE;
+
+ bsd_ptr = GetBSDPointer( 0 );
+ cds_ptr = CDS_GetCopy();
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+
+ /* save the state of "auto verify" */
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_AUTO_VERIFY );
+ CDS_SetAutoVerifyBackup( cds_ptr, button_state );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ /* save the state of "include catalogs" */
+ button_state = (WORD)IsDlgButtonChecked( hDlg,IDD_BKUP_INCLUDE_CATALOGS );
+ CDS_SetBackupCatalogs( cds_ptr, button_state );
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+
+ /* save the state of "append/replace" operation */
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_APPEND );
+ CDS_SetAppendFlag( cds_ptr, button_state );
+
+ /* if replace then save the tape name */
+ if( IsDlgButtonChecked( hDlg, IDD_BKUP_REPLACE ) ) {
+
+ /* save the Tape name */
+ GetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, buffer, MAX_TAPE_NAME_SIZE );
+ BSD_SetTapeLabel( bsd_ptr, (INT8_PTR)buffer,
+ (INT16) strsize( buffer ) );
+ PropagateTapeName();
+
+ }
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ /* save the skip open wait time */
+ GetDlgItemText( hDlg, IDD_BKUP_SKIP_TIME, buffer, 5 );
+ wait_time = (WORD)atoi( buffer );
+ CDS_SetWaitTime( cds_ptr, wait_time );
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+
+ /* save the BSD items for the current BSD */
+ BackupSetSave( hDlg );
+
+ WM_UnhookTimer( backup_set_temp_ptr->timer_handle );
+ PD_SetFrequency( backup_set_temp_ptr->poll_drive_freq );
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+
+ return ( TRUE );
+
+/****************************************************************************
+ OK button
+/***************************************************************************/
+ case IDOK:
+ case IDD_BKUP_OK_BUTTON:
+
+ {
+ INT response;
+
+ if ( thw_list->drv_info.drv_features & TDI_DRV_COMPRESSION ) {
+ if ( IsDlgButtonChecked( hDlg, IDD_BKUP_HARDCOMP ) ) {
+ if( TF_SetHWCompression( thw_list, TRUE ) != TFLE_NO_ERR ) {
+ RSM_StringCopy( RES_HW_COMP_FAILURE, buffer, sizeof(buffer) );
+ response = WM_MsgBox( NULL, buffer, WMMB_YESNO, WMMB_ICONEXCLAMATION );
+ if ( response == WMMB_IDNO )
+ return( TRUE );
+ }
+ } else {
+
+ if( TF_SetHWCompression( thw_list, FALSE ) != TFLE_NO_ERR ) {
+ RSM_StringCopy( RES_HW_UNCOMP_FAILURE, buffer, sizeof(buffer) );
+ response = WM_MsgBox( NULL, buffer, WMMB_YESNO, WMMB_ICONEXCLAMATION );
+ if ( response == WMMB_IDNO )
+ return( TRUE );
+ }
+ }
+ }
+ }
+
+ if ( IsWindowEnabled( GetDlgItem( hDlg, IDD_BKUP_OK_BUTTON ) ) ) {
+ bsd_ptr = GetBSDPointer( 0 );
+ cds_ptr = CDS_GetCopy();
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+ backup_set_temp_ptr->dialog_return_status = FALSE;
+
+// Run through all of our selected drives
+// If any of them are read-only
+// if the operation is full backup, prompt the user of the copy change
+// elseif the operation is incremental, prompt the user of the differential change
+// For all of the selected drives...
+// Do some checking to make sure the readonly drives.
+
+ BackupSetSave( hDlg );
+
+ bsd_ptr = BSD_GetFirst(bsd_list);
+ while(bsd_ptr != NULL)
+ {
+ dle_ptr = BSD_GetDLE(bsd_ptr);
+ if (!DLE_DriveWriteable(dle_ptr))
+ {
+ CHAR szTemp[ MAX_UI_RESOURCE_SIZE ];
+
+ if ( (BSD_GetBackupType(bsd_ptr) == BSD_BACKUP_NORMAL ) ||
+ (BSD_GetBackupType(bsd_ptr) == BSD_BACKUP_INCREMENTAL) )
+ {
+ // Inform user that this bsd will have type COPY
+
+ RSM_StringCopy( IDS_RDONLY_COPY, buffer, 80);
+ wsprintf( szTemp, buffer, DLE_GetDeviceName(dle_ptr) );
+
+ RSM_StringCopy( IDS_RDONLY_DRV_ENCOUNTER, buffer2, 80);
+
+ WM_MsgBox( buffer2, szTemp, WMMB_OK, WMMB_ICONEXCLAMATION ) ;
+ }
+
+ }
+ if ( ((BSD_GetOsId( bsd_ptr )== FS_EMS_DSA_ID) ||
+ (BSD_GetOsId( bsd_ptr )== FS_EMS_MDB_ID)) &&
+ ((BSD_GetBackupType(bsd_ptr) == BSD_BACKUP_DIFFERENTIAL ) ||
+ (BSD_GetBackupType(bsd_ptr) == BSD_BACKUP_INCREMENTAL) ) )
+ {
+ INT16 return_status ;
+ FSYS_HAND fsh ;
+ CHAR buf1[ MAX_UI_RESOURCE_SIZE ];
+ CHAR buf2[ MAX_UI_RESOURCE_SIZE ];
+
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+
+ BEC_SetModifiedOnlyFlag( be_cfg_ptr, TRUE ) ;
+
+ return_status = FS_AttachToDLE( &fsh, dle_ptr, be_cfg_ptr, NULL, NULL ) ;
+
+ BEC_SetModifiedOnlyFlag( be_cfg_ptr, FALSE ) ;
+
+ switch( return_status ) {
+ case SUCCESS:
+ FS_DetachDLE( fsh ) ;
+ break ;
+ case FS_EMS_CIRC_LOG:
+ if (BSD_GetOsId( bsd_ptr )== FS_EMS_DSA_ID ) {
+ RSM_StringCopy( IDS_EMS_CIRC_LOGS_DS, buf1, sizeof(buf1) );
+ } else {
+ RSM_StringCopy( IDS_EMS_CIRC_LOGS_IS, buf1, sizeof(buf1) );
+ }
+
+ wsprintf( buf2, buf1, DLE_GetDeviceName(DLE_GetParent(dle_ptr)));
+ RSM_StringCopy( IDS_BACKUPERRORTITLE, buf1, sizeof(buf1) );
+
+ break;
+
+ case FS_EMS_NO_LOG_BKUP:
+ if (BSD_GetOsId( bsd_ptr )== FS_EMS_DSA_ID ) {
+ RSM_StringCopy( IDS_EMS_NO_INC_DS_BACKUP, buf1, sizeof(buf1) );
+ } else {
+ RSM_StringCopy( IDS_EMS_NO_INC_IS_BACKUP, buf1, sizeof(buf1) );
+ }
+
+ wsprintf( buf2, buf1, DLE_GetDeviceName(DLE_GetParent(dle_ptr)));
+ RSM_StringCopy( IDS_BACKUPERRORTITLE, buf1, sizeof(buf1) );
+
+ break;
+
+ case FS_ACCESS_DENIED:
+
+ RSM_StringCopy( RES_EMS_BKU_ACCESS_FAILURE, buf1, sizeof(buf1) );
+
+ wsprintf( buf2, buf1, DLE_GetDeviceName(DLE_GetParent(dle_ptr)));
+ RSM_StringCopy( IDS_BACKUPERRORTITLE, buf1, sizeof(buf1) );
+
+ break;
+
+ default:
+ if (BSD_GetOsId( bsd_ptr )== FS_EMS_DSA_ID ) {
+ RSM_StringCopy( IDS_EMS_NOT_RESPONDING_DS, buf1, sizeof(buf1) );
+ } else {
+ RSM_StringCopy( IDS_EMS_NOT_RESPONDING_IS, buf1, sizeof(buf1) );
+ }
+
+ wsprintf( buf2, buf1, DLE_GetDeviceName(DLE_GetParent(dle_ptr)));
+ RSM_StringCopy( IDS_BACKUPERRORTITLE, buf1, sizeof(buf1) );
+
+ break;
+ }
+ if ( return_status ) {
+ WM_MsgBox( buf1, buf2, WMMB_OK, WMMB_ICONEXCLAMATION );
+ return ( TRUE );
+ }
+
+ }
+ bsd_ptr = BSD_GetNext(bsd_ptr);
+ }
+
+ VLM_GetDriveStatus( &vcb_ptr );
+ generic_str_ptr = buffer;
+ bsd_ptr = GetBSDPointer( 0 );
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ GetDlgItemText( hDlg, IDD_BKUP_PASSWORD, generic_str_ptr, MAX_TAPE_PASSWORD_SIZE );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* if user entered a password - verify the password */
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if( strlen( buffer ) ) {
+
+ /* convert to upper case */
+ AnsiUpper( buffer );
+
+ /* if job password is unchanged, don't reconfirm password */
+ if(! strcmp( buffer, &backup_set_temp_ptr->job_password[0] ) ) {
+ strcpy( reenter_password, &backup_set_temp_ptr->job_password[0] );
+ }
+ else {
+
+ /* display the reenter password dialog */
+ DM_ShowDialog( hDlg, IDD_REENTER_PASSWORD, reenter_password );
+ }
+
+ if( strlen( reenter_password ) ) {
+ /* convert to upper case */
+ AnsiUpper( reenter_password );
+ }
+
+ if( strcmp( buffer, reenter_password ) ) {
+
+ RSM_StringCopy( IDS_BKUP_SHORT_PASSWORD_ERROR, buffer, sizeof(buffer) );
+ RSM_StringCopy( IDS_BKUP_PASSWORD_ERROR_TITLE, buffer2, sizeof(buffer2) );
+ WM_MsgBox( buffer2, buffer, WMMB_OK, WMMB_ICONEXCLAMATION );
+ buffer[0] = 0;
+ SetDlgItemText( hDlg, IDD_BKUP_PASSWORD, buffer ); /* clear password field */
+ SetFocus( GetDlgItem( hDlg, IDD_BKUP_PASSWORD ) );
+ return ( TRUE );
+ }
+ }
+ }
+# else
+ {
+ CHAR_PTR passwdbuffer1;
+ INT16 passwordlength;
+
+ // Check if original tape was secured
+
+ if ( OriginalTapeSecured ) {
+
+ //
+ // Check to see if is a valid user or not
+ //
+
+ generic_str_ptr = GetCurrentMachineNameUserName( );
+ passwdbuffer1 = ( CHAR_PTR )calloc( 1, ( 3 + strlen( generic_str_ptr ) ) * sizeof( CHAR ) );
+
+ if ( passwdbuffer1 ) {
+ *passwdbuffer1 = NTPASSWORDPREFIX;
+ if ( generic_str_ptr ) {
+ strcat( passwdbuffer1, generic_str_ptr );
+ }
+
+ passwordlength = strlen( passwdbuffer1 ); // chs:03-10-93
+// chs: 02-01-94 CryptPassword( ( INT16 ) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)passwdbuffer1, ( INT16 ) ( passwordlength * sizeof( CHAR ) ) ); // chs:03-10-93
+
+ if( ( WhoPasswordedTape ( (BYTE_PTR)FS_ViewTapePasswordInVCB( vcb_ptr ), FS_SizeofTapePswdInVCB( vcb_ptr ) ) == OTHER_APP) ||
+ ( ! IsUserValid( vcb_ptr, (BYTE *)passwdbuffer1, ( INT16 )( passwordlength * sizeof( CHAR ) ) ) &&
+ ! DoesUserHaveThisPrivilege( TEXT ( "SeBackupPrivilege" ) ) ) ) { // chs:04-08-93
+
+ //
+ // Popup dialog box message if
+ // not a valid user
+ //
+
+ RSM_StringCopy( IDS_BKUP_TAPE_SECURITY, buffer, sizeof(buffer) );
+ RSM_StringCopy( IDS_TAPE_SECURITY_TITLE, buffer2, sizeof(buffer2) );
+ WM_MsgBox( buffer2, buffer, WMMB_OK, WMMB_ICONEXCLAMATION );
+ buffer[0] = 0;
+ free( passwdbuffer1 );
+ return ( TRUE );
+ }
+ free( passwdbuffer1 );
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* save the state of "auto verify" */
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_AUTO_VERIFY );
+ CDS_SetAutoVerifyBackup( cds_ptr, button_state );
+
+
+# if defined ( OEM_MSOFT ) // special feature
+ {
+ CHAR szLogFile[ MAX_UI_FULLPATH_SIZE ];
+ FILE * fpLog = NULL;
+ INT nLogLevel = LOG_DISABLED;
+
+ // Get the log file name from the edit field
+ GetDlgItemText( hDlg, IDD_BKUP_LOG_FILENAME,
+ szLogFile, MAX_UI_FULLPATH_SIZE );
+
+ // if no log file named, cannot log!
+ if (*szLogFile)
+ {
+ if ( IsDlgButtonChecked( hDlg,
+ IDD_BKUP_LOG_SUMMARY ) )
+ {
+ nLogLevel = LOG_ERRORS;
+ }
+ else
+ if ( IsDlgButtonChecked( hDlg,
+ IDD_BKUP_LOG_FULL ) )
+ {
+ nLogLevel = LOG_DETAIL;
+ }
+ }
+ CDS_SetLogLevel ( cds_ptr, nLogLevel );
+
+ if ( nLogLevel != LOG_DISABLED && *szLogFile )
+ {
+ CHAR szFullLogFile[ MAX_UI_FULLPATH_SIZE ] ;
+ DWORD dwFullLogSize = MAX_UI_FULLPATH_SIZE ;
+ CHAR_PTR pLogFname ; // address of log filename
+
+ // expand user supplied log file name to a
+ // complete path and name.
+
+ dwFullLogSize = GetFullPathName( szLogFile,
+ dwFullLogSize, szFullLogFile, &pLogFname ) ;
+
+ // make sure the log file can be opened for
+ // writting.
+
+ if ( fpLog = UNI_fopen ( szFullLogFile, _O_TEXT|_O_APPEND ) )
+ {
+ LOG_SetCurrentLogName ( szFullLogFile );
+ fclose ( fpLog );
+ }
+ else
+ {
+ ShowWindow ( GetDlgItem( hDlg,
+ IDD_BKUP_LOG_FILENAME ),
+ FALSE );
+ MessageBeep ( 0 ); //NTKLUG - Need error message!!
+ ShowWindow ( GetDlgItem( hDlg,
+ IDD_BKUP_LOG_FILENAME ),
+ TRUE );
+ ShowWindow ( GetDlgItem( hDlg,
+ IDD_BKUP_LOG_FILENAME ),
+ FALSE );
+ MessageBeep ( 0 ); //NTKLUG - Need error message!!
+ ShowWindow ( GetDlgItem( hDlg,
+ IDD_BKUP_LOG_FILENAME ),
+ TRUE );
+ SetFocus( GetDlgItem( hDlg,
+ IDD_BKUP_LOG_FILENAME ) );
+
+ return ( TRUE ); // user must re-enter name!
+ }
+ }
+ else // if no file name, then cannot log!
+ {
+ CDS_SetLogLevel ( cds_ptr, LOG_DISABLED );
+ }
+ }
+# endif //defined ( OEM_MSOFT ) // special feature
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ /* save the state of "include catalogs" */
+ button_state = (WORD)IsDlgButtonChecked( hDlg,IDD_BKUP_INCLUDE_CATALOGS );
+ CDS_SetBackupCatalogs( cds_ptr, button_state );
+ /* if including catalogs, add one to count for catalog BSD */
+ if( button_state ) {
+ RT_max_BSD_index++;
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* save the state of "append/replace" operation */
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_APPEND );
+ CDS_SetAppendFlag( cds_ptr, button_state );
+
+ /* if replace then save the password and tape name */
+ if( IsDlgButtonChecked( hDlg, IDD_BKUP_REPLACE ) ) {
+
+ /* save the Tape name */
+ GetDlgItemText( hDlg, IDD_BKUP_TAPE_NAME, buffer, MAX_TAPE_NAME_SIZE );
+ BSD_SetTapeLabel( bsd_ptr, (INT8_PTR)buffer,
+ (INT16) strsize( buffer ) );
+ PropagateTapeName();
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ /* save the Tape password */
+ generic_str_ptr = buffer;
+ GetDlgItemText( hDlg, IDD_BKUP_PASSWORD, generic_str_ptr, MAX_TAPE_PASSWORD_SIZE );
+ pswd_size = (INT16)(strlen( generic_str_ptr ) * sizeof (CHAR));
+ if( pswd_size ) {
+
+ CryptPassword( ENCRYPT, ENC_ALGOR_3, buffer, pswd_size );
+ }
+ BSD_SetTapePswd( bsd_ptr, generic_str_ptr, pswd_size );
+ PropagateTapePassword();
+
+ /* save the skip open wait time */
+ GetDlgItemText( hDlg, IDD_BKUP_SKIP_TIME, buffer, 5 );
+ wait_time = (WORD)atoi( buffer );
+ CDS_SetWaitTime( cds_ptr, wait_time );
+ }
+# else
+ {
+ CHAR_PTR passwdbuffer1;
+ INT16 passwordlength;
+
+ //
+ // If secure box checked
+ //
+
+ if ( CDS_GetPasswordFlag( cds_ptr ) ) {
+ generic_str_ptr = GetCurrentMachineNameUserName( );
+ passwdbuffer1 = ( CHAR_PTR )calloc( 1, ( 3 + strlen( generic_str_ptr ) ) * sizeof( CHAR ) );
+ if ( passwdbuffer1 ) {
+ *passwdbuffer1 = NTPASSWORDPREFIX; // chs:04-08-93
+ if ( generic_str_ptr ) {
+ strcat( passwdbuffer1, generic_str_ptr );
+ }
+ passwordlength = strlen( passwdbuffer1 ); // chs:03-10-93
+ CryptPassword( ( INT16 ) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)passwdbuffer1, ( INT16 ) ( passwordlength * sizeof( CHAR ) ) ); // chs:03-10-93
+ BSD_SetTapePswd( bsd_ptr, (INT8_PTR)passwdbuffer1,( INT16 ) ( passwordlength * sizeof( CHAR ) ) ); // chs:03-10-93
+ PropagateTapePassword();
+ free( passwdbuffer1 );
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+ }
+
+ /* save the BSD items for the current BSD */
+ BackupSetSave( hDlg );
+
+ WM_UnhookTimer( backup_set_temp_ptr->timer_handle );
+ PD_SetFrequency( backup_set_temp_ptr->poll_drive_freq );
+
+ EndDialog( hDlg, TRUE ); /* Exits the dialog box */
+ }
+
+ return ( TRUE );
+
+/****************************************************************************
+ Help button
+/***************************************************************************/
+ case IDD_BKUP_HELP_BUTTON:
+ case IDHELP:
+
+#ifndef OEM_EMS
+ if ( bTransfer ) {
+ HM_DialogHelp( HELPID_DIALOGTRANSFER );
+ } else {
+ HM_DialogHelp( HELPID_DIALOGBACKUPSET );
+ }
+#else
+ help_id = DM_ModeGetHelpId( pCurMode );
+ HM_DialogHelp( help_id );
+#endif
+ return( TRUE );
+
+#ifdef OEM_MSOFT //special feature
+
+ case IDD_BKUP_LOG_BROWSE: //Log file browse button
+ {
+ CHAR szFile[ BROWSE_MAXPATH ] = TEXT("");
+
+ GetDlgItemText ( hDlg, IDD_BKUP_LOG_FILENAME, szFile, BROWSE_MAXPATH );
+
+ if ( DM_BrowseForLogFilePath ( hDlg, ghInst, szFile, strlen ( szFile ) ) ) {
+
+ SetDlgItemText ( hDlg, IDD_BKUP_LOG_FILENAME, szFile );
+ SetFocus ( GetDlgItem ( hDlg, IDD_BKUP_LOG_FILENAME ) );
+ }
+ }
+
+ break;
+
+#endif //OEM_MSOFT //special feature
+
+ default:
+ break;
+
+ } /* switch ( wId ) */
+
+ } /* case WM_COMMAND */
+ break;
+
+ } /* switch ( message ) */
+
+ return ( FALSE ); /* Didn't process a message */
+}
+/***************************************************
+
+ Name: BackupSetSave()
+
+ Description: Saves the state of the dialog
+ backup set information
+ into the current BSD.
+
+ Returns: VOID
+
+*****************************************************/
+VOID BackupSetSave(
+HWND hDlg ) /* window handle of the dialog box */
+{
+ WORD button_state;
+ WORD backup_type;
+ LPSTR generic_str_ptr;
+ BSD_PTR bsd_ptr;
+ CDS_PTR cds_ptr;
+ BE_CFG_PTR be_cfg_ptr;
+ CHAR buffer[ MAX_BSET_NAME_SIZE ];
+
+ bsd_ptr = GetBSDPointer( backup_set_temp_ptr->BSD_index );
+ cds_ptr = CDS_GetCopy();
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+
+ GetDlgItemText( hDlg, IDD_BKUP_DESCRIPTION, buffer, MAX_BSET_NAME_SIZE );
+ generic_str_ptr = (LPSTR)BSD_GetBackupLabel( bsd_ptr );
+
+ if ( !generic_str_ptr ) {
+
+ BSD_SetBackupLabel( bsd_ptr, (INT8_PTR)TEXT(""), (INT16) sizeof(CHAR) );
+
+ } else if( strcmp( generic_str_ptr, buffer ) ) {
+
+ /* if new label different from old label - update label */
+
+ BSD_SetBackupLabel( bsd_ptr, (INT8_PTR)buffer,
+ (INT16) strsize( buffer) );
+ }
+
+#if !defined( OEM_MSOFT )
+ /* save the state of the "Skip open files" flag */
+ button_state = (WORD) IsDlgButtonChecked( hDlg, IDD_BKUP_SKIP_YES );
+ if( button_state ) {
+
+ BEC_SetSkipOpenFiles( be_cfg_ptr, (INT16)SKIP_YES );
+ }
+
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_SKIP_NO );
+ if( button_state ) {
+
+ BEC_SetSkipOpenFiles( be_cfg_ptr, (INT16)SKIP_NO );
+ }
+
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_SKIP_WAIT );
+ if( button_state ) {
+
+ BEC_SetSkipOpenFiles( be_cfg_ptr, (INT16)SKIP_NO_TIMED );
+ }
+
+
+ /* save the state of the catalog(full/partial) */
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_CATALOG_FULL );
+ if( button_state ) {
+
+ BSD_SetFullyCataloged( bsd_ptr, TRUE ); /* = full */
+ }
+ else {
+
+ BSD_SetFullyCataloged( bsd_ptr, FALSE ); /* = partial */
+ }
+
+#endif
+
+# if defined ( OS_WIN32 )
+ {
+ BSD_PTR temp_bsd ;
+
+ /* if this is a normal backup */
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ /* save the state of the bindery flag */
+
+ /* if backup bindery allowed, save the bindery flay for this BSD */
+
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_REGISTRY );
+ temp_bsd = BSD_GetFirst( bsd_list );
+
+ while( temp_bsd != NULL ) {
+
+ if ( DLE_HasFeatures( BSD_GetDLE( bsd_ptr ),
+ DLE_FEAT_BKUP_SPECIAL_FILES ) ) {
+
+ UI_AddSpecialIncOrExc( bsd_ptr, button_state ) ;
+ BSD_SetProcSpecialFlg( bsd_ptr, button_state );
+
+ } else {
+ BSD_SetProcSpecialFlg( bsd_ptr, FALSE );
+
+ }
+ temp_bsd = BSD_GetNext( temp_bsd ) ;
+ }
+ }
+ }
+# else
+ {
+
+
+ /* if this is a normal backup */
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ /* save the state of the bindery flag */
+
+ /* if backup bindery allowed, save the bindery flay for this BSD */
+ if ( DLE_HasFeatures( BSD_GetDLE( bsd_ptr ),
+ DLE_FEAT_BKUP_SPECIAL_FILES ) ) {
+
+ button_state = (WORD)IsDlgButtonChecked( hDlg, IDD_BKUP_BACKUP_BINDERY );
+ BSD_SetProcSpecialFlg( bsd_ptr, button_state );
+ }
+ }
+ }
+# endif //!defined ( OS_WIN32 ) //unsupported feature -- skipped files
+
+
+ /* save the method of backup type */
+ /* defined in BSDU.H */
+ /* methods are: BSD_BACKUP_NORMAL 1 */
+ /* BSD_BACKUP_COPY 2 */
+ /* BSD_BACKUP_DIFFERENTIAL 3 */
+ /* BSD_BACKUP_INCREMENTAL 4 */
+ /* entries in the combo box start at 0 */
+
+ switch( BSD_GetOsId( bsd_ptr ) ) {
+
+#ifdef OEM_EMS
+ case FS_EMS_DSA_ID:
+ case FS_EMS_MDB_ID:
+ backup_type = (WORD)SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD,
+ CB_GETCURSEL, 0, 0 );
+ break;
+#endif
+
+ default:
+
+ backup_type = (WORD)SendDlgItemMessage( hDlg, IDD_BKUP_METHOD,
+ CB_GETCURSEL, 0, 0 );
+ }
+
+ if( backup_set_temp_ptr->mode_flag == ARCHIVE_BACKUP_OPER ) {
+ backup_type += 2;
+ }
+ else {
+ backup_type += 1;
+ }
+ BSD_SetBackupType( bsd_ptr, (INT16)( backup_type ) );
+}
+/***************************************************
+
+ Name: BackupSetRetrieve()
+
+ Description: Retrieves the state of the current BSD
+ backup set information and updates
+ the fields in the dialog.
+
+ Returns: VOID
+
+*****************************************************/
+#ifndef OEM_EMS
+VOID BackupSetRetrieve(
+ HWND hDlg ) /* window handle of the dialog box */
+#else
+VOID BackupSetRetrieve(
+ HWND hDlg,
+ DLG_MODE * pModeTable )
+#endif
+{
+ WORD status;
+ WORD backup_type;
+ LPSTR generic_str_ptr;
+ CHAR buffer[ MAX_UI_RESOURCE_SIZE ];
+ CHAR buffer2[ MAX_UI_RESOURCE_SIZE ];
+ BSD_PTR bsd_ptr;
+ CDS_PTR cds_ptr;
+ BE_CFG_PTR be_cfg_ptr;
+ GENERIC_DLE_PTR dle_ptr;
+ GENERIC_DLE_PTR parent_dle;
+ CHAR szFormat[ MAX_UI_RESOURCE_SIZE ];
+ CHAR szName[ MAX_DEVICE_NAME_SIZE ];
+
+ bsd_ptr = GetBSDPointer( backup_set_temp_ptr->BSD_index );
+ cds_ptr = CDS_GetCopy();
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+ dle_ptr = BSD_GetDLE( bsd_ptr );
+
+ generic_str_ptr = (LPSTR)BSD_GetBackupLabel( bsd_ptr );
+ SetDlgItemText( hDlg, IDD_BKUP_DESCRIPTION, generic_str_ptr );
+
+ DLE_GetVolName( dle_ptr, buffer );
+ SetDlgItemText( hDlg, IDD_BKUP_DRIVE_NAME, buffer );
+
+ // Create the string for the Exchange Component field.
+ DLE_DeviceDispName( dle_ptr, buffer, MAX_DEVICE_NAME_LEN, 0 );
+
+ parent_dle = DLE_GetParent( dle_ptr );
+
+ if ( NULL != parent_dle ) {
+
+ DLE_DeviceDispName( parent_dle, buffer2, MAX_DEVICE_NAME_LEN, 0 );
+
+ } else {
+
+ buffer2[0] = TEXT( '\0' );
+
+ }
+
+ RSM_StringCopy( IDS_XCHG_BKUP_NAME, szFormat, MAX_UI_RESOURCE_LEN );
+ wsprintf( szName, szFormat, buffer, buffer2 );
+
+ SetDlgItemText( hDlg, IDD_BKUP_XCHG_NAME, szName );
+
+# if defined ( OS_WIN32 )
+ {
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_REGISTRY ),
+ DLE_HasFeatures( BSD_GetDLE( bsd_ptr ),
+ DLE_FEAT_BKUP_SPECIAL_FILES ) );
+
+ CheckDlgButton( hDlg, IDD_BKUP_REGISTRY,
+ BSD_GetProcSpecialFlg( bsd_ptr ) || gfIsJobRunning );
+ }
+ else {
+
+ /* transfer operation - disable bindery check box */
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_REGISTRY ), FALSE );
+ }
+ }
+# else
+ {
+
+# if defined ( TDEMO )
+ /* tdemo exe - disable bindery check box */
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_BACKUP_BINDERY ), FALSE );
+# else
+ /* Bindery check box */
+ /* if this is a normal backup */
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ /* enable bindery check box */
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_BACKUP_BINDERY ), TRUE );
+
+ status = BSD_GetProcSpecialFlg( bsd_ptr );
+ CheckDlgButton( hDlg, IDD_BKUP_BACKUP_BINDERY, status );
+
+ /* check for backup bindery, enable/disable the control */
+ status = DLE_HasFeatures( BSD_GetDLE( bsd_ptr ),
+ DLE_FEAT_BKUP_SPECIAL_FILES );
+
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_BACKUP_BINDERY ), status );
+ }
+ else {
+
+ /* transfer operation - disable bindery check box */
+ EnableWindow( GetDlgItem( hDlg, IDD_BKUP_BACKUP_BINDERY ), FALSE );
+ }
+# endif // defined TDEMO
+
+ }
+# endif //defined ( OEM_MSOFT ) //unsupported feature
+
+# if !defined ( OEM_MSOFT )
+ /* Catalog check box */
+ if( BSD_GetFullyCataloged( bsd_ptr ) ) {
+
+ CheckRadioButton( hDlg, IDD_BKUP_CATALOG_FULL, IDD_BKUP_CATALOG_PARTIAL, IDD_BKUP_CATALOG_FULL );
+ }
+ else {
+
+ CheckRadioButton( hDlg, IDD_BKUP_CATALOG_FULL, IDD_BKUP_CATALOG_PARTIAL, IDD_BKUP_CATALOG_PARTIAL );
+ }
+
+ /* Skip open files check box */
+ status = BEC_GetSkipOpenFiles( be_cfg_ptr );
+
+ if( status == SKIP_YES ) {
+
+ CheckRadioButton( hDlg, IDD_BKUP_SKIP_YES, IDD_BKUP_SKIP_WAIT, IDD_BKUP_SKIP_YES );
+ }
+ else if( status == SKIP_NO ) {
+
+ CheckRadioButton( hDlg, IDD_BKUP_SKIP_YES, IDD_BKUP_SKIP_WAIT, IDD_BKUP_SKIP_NO );
+ }
+ else if( status == SKIP_NO_TIMED ) {
+
+ CheckRadioButton( hDlg, IDD_BKUP_SKIP_YES, IDD_BKUP_SKIP_WAIT, IDD_BKUP_SKIP_WAIT );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* add "1 of n" to backup set info title */
+ RSM_StringCopy( IDS_SET_INFORMATION, buffer, sizeof(buffer) );
+ wsprintf( buffer2, buffer, backup_set_temp_ptr->BSD_index + 1, backup_set_temp_ptr->max_BSD_index + 1 );
+ SetDlgItemText( hDlg, IDD_BKUP_INFO_TITLE, buffer2 );
+
+ /* set the method of backup type */
+ /* defined in BSDU.H */
+ /* methods are: BSD_BACKUP_NORMAL 1 */
+ /* BSD_BACKUP_COPY 2 */
+ /* BSD_BACKUP_DIFFERENTIAL 3 */
+ /* BSD_BACKUP_INCREMENTAL 4 */
+ /* entries in the combo box start at 0 */
+
+ backup_type = BSD_GetBackupType( bsd_ptr );
+ if( backup_set_temp_ptr->mode_flag == ARCHIVE_BACKUP_OPER ) {
+ backup_type -= 2;
+ }
+ else {
+ backup_type -= 1;
+ }
+ SendDlgItemMessage( hDlg, IDD_BKUP_METHOD, CB_SETCURSEL,
+ backup_type , 0 );
+
+#ifdef OEM_EMS
+ SendDlgItemMessage( hDlg, IDD_XCHG_BKUP_METHOD, CB_SETCURSEL,
+ backup_type , 0 );
+
+#endif
+
+#ifdef OEM_EMS
+ BSD_SetOsId( bsd_ptr, DLE_GetOsId( dle_ptr ) );
+ DM_DispShowControls( hDlg, pModeTable, (INT)DLE_GetOsId( dle_ptr ) );
+#endif
+
+}
+/***************************************************
+
+ Name: BackupSetDefaultDescription()
+
+ Description: Fills in all of the default data for
+ each BSD of this backup operation.
+
+ Returns: Returns with the max count of BSD's for
+ this backup operation.
+
+*****************************************************/
+INT BackupSetDefaultDescription( VOID )
+{
+ BSD_PTR bsd_ptr;
+ CDS_PTR cds_ptr;
+ GENERIC_DLE_PTR dle_ptr;
+ BE_CFG_PTR be_cfg_ptr;
+ CHAR buffer[MAX_UI_RESOURCE_SIZE];
+ CHAR_PTR s;
+ WORD BSD_index_counter;
+#if !defined ( OEM_MSOFT )
+ INT16 lngth; // chs:04-22-93
+#endif
+
+ cds_ptr = CDS_GetCopy();
+
+ BSD_index_counter = 0;
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while( bsd_ptr != NULL ) {
+
+ /* if tape label equal null, set up the default data for this bsd */
+ if( ! BSD_GetTapeLabel( bsd_ptr ) ) {
+
+ /* get this BSDs config pointer */
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+
+ /* set default tape name */
+
+ {
+ CHAR tmp_buf1[ MAX_TAPE_NAME_LEN ];
+ CHAR tmp_buf2[ MAX_TAPE_NAME_LEN ];
+ RSM_StringCopy( IDS_DEFAULT_TAPE_NAME, tmp_buf1, MAX_TAPE_NAME_LEN );
+ UI_CurrentDate( tmp_buf2 );
+ wsprintf( buffer, tmp_buf1, tmp_buf2 ) ;
+ }
+ //
+ // Append the time to the tape label to give it uniqueness
+ //
+
+# if !defined ( OEM_MSOFT ) // chs:04-22-93
+ { // chs:04-22-93
+ strcat( buffer, TEXT( " at " ) ); // chs:04-22-93
+ lngth = strlen( buffer ); // chs:04-22-93
+ UI_CurrentTime ( &buffer[ lngth ] ); // chs:04-22-93
+ } // chs:04-22-93
+# endif //!defined ( OEM_MSOFT ) // chs:04-22-93
+
+ BSD_SetTapeLabel( bsd_ptr, (INT8_PTR)buffer,
+ (INT16) strsize( buffer ) );
+
+ /* set default backup label */
+ buffer[0] = 0;
+ BSD_SetBackupLabel( bsd_ptr, (INT8_PTR)buffer,
+ (INT16) strsize( buffer) );
+
+ /* set the default description name */
+ dle_ptr = BSD_GetDLE( bsd_ptr );
+
+ DLE_GetVolName( dle_ptr, buffer );
+
+ s = buffer;
+ while ( *s )
+ s++;
+ *s++ = TEXT(' ');
+ UI_CurrentDate( s );
+
+ buffer[ MAX_BSET_DESC_SIZE ] = 0;
+
+ BSD_SetBackupDescript( bsd_ptr, (INT8_PTR)buffer,
+ (INT16) strsize( buffer ) );
+
+ }
+ /* count the total BSD's */
+ BSD_index_counter++;
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+ return( --BSD_index_counter );
+}
+/***************************************************
+
+ Name: BackupSetDefaultSettings()
+
+ Description: Fills in all of the default settings data for
+ each BSD of this backup operation.
+
+ Returns: VOID
+
+*****************************************************/
+VOID BackupSetDefaultSettings( VOID )
+{
+ BSD_PTR bsd_ptr;
+ CDS_PTR cds_ptr;
+ BE_CFG_PTR be_cfg_ptr;
+ WORD backup_type;
+ WORD catalog_mode;
+ INT16 skip_open_files;
+
+ cds_ptr = CDS_GetCopy();
+
+ backup_type = CDS_GetDefaultBackupType( cds_ptr );
+
+ /* Copy is the only method allowed with Transfer operation */
+ if( backup_set_temp_ptr->mode_flag == ARCHIVE_BACKUP_OPER ) {
+ backup_type = BSD_BACKUP_COPY;
+ }
+
+#if defined ( TDEMO )
+
+ /* if a NORMAL backup, only allow the COPY method to prevent */
+ /* the achived bit from beening reset */
+
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+
+ backup_type = BSD_BACKUP_COPY;
+ }
+#endif
+
+ skip_open_files = CDS_GetSkipOpenFiles( cds_ptr );
+
+ catalog_mode = CDS_GetCatalogLevel( cds_ptr );
+ if( catalog_mode == CATALOGS_FULL ) {
+
+ catalog_mode = TRUE;
+ }
+ else {
+
+ catalog_mode = FALSE;
+ }
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while( bsd_ptr != NULL ) {
+
+ /* get this BSDs config pointer */
+ be_cfg_ptr = BSD_GetConfigData( bsd_ptr );
+
+ /*set the default backup type */
+ BSD_SetBackupType( bsd_ptr, backup_type );
+
+ /* set the default catalog mode(full/partial) */
+ BSD_SetFullyCataloged( bsd_ptr, catalog_mode );
+
+ /* set the skip open files for all BSD's */
+ BEC_SetSkipOpenFiles( be_cfg_ptr, skip_open_files );
+
+#ifdef OS_WIN32
+ /* always default not to back up registry files */
+ BSD_SetProcSpecialFlg( bsd_ptr, FALSE ) ;
+#else
+ /* if backup bindery allowed, set the bindery flay on for this BSD */
+
+ if ( DLE_HasFeatures( BSD_GetDLE( bsd_ptr ),
+ DLE_FEAT_BKUP_SPECIAL_FILES ) ) {
+
+
+ /* if this is a normal backup, set the bindery flag */
+ if( backup_set_temp_ptr->mode_flag != ARCHIVE_BACKUP_OPER ) {
+ BSD_SetProcSpecialFlg( bsd_ptr, TRUE );
+ }
+ else {
+ BSD_SetProcSpecialFlg( bsd_ptr, FALSE );
+ }
+ }
+#endif
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+}
+/***************************************************
+
+ Name: GetBSDPointer()
+
+ Description: Finds the current BSD pointer
+
+ Returns: Returns the requested BSD pointer
+
+*****************************************************/
+BSD_PTR GetBSDPointer(
+WORD current_BSD_index ) /* I - current BSD index */
+{
+ BSD_PTR bsd_ptr;
+
+ if( !current_BSD_index ) {
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+ }
+ else {
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+ current_BSD_index--;
+ do {
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ } while( current_BSD_index-- );
+ }
+ return( bsd_ptr );
+}
+/***************************************************
+
+ Name: PropagateTapeName()
+
+ Description: Propagate the tape name to all of ths BSD's
+
+ Returns: VOID
+
+*****************************************************/
+VOID PropagateTapeName( VOID )
+{
+ BSD_PTR bsd_ptr;
+ CHAR buffer[ MAX_TAPE_NAME_SIZE ];
+ LPSTR generic_str_ptr;
+ WORD character_counter = 0;
+ CHAR_PTR s;
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+ generic_str_ptr = (LPSTR)BSD_GetTapeLabel( bsd_ptr );
+ strcpy( buffer, generic_str_ptr );
+
+ generic_str_ptr = buffer;
+ while( *generic_str_ptr ) {
+
+ if( *generic_str_ptr != TEXT(' ') ) {
+
+ character_counter++;
+ break;
+ }
+ *generic_str_ptr++;
+ }
+
+ /* if tape name field blank or all spaces - replace with the default name */
+ if( *generic_str_ptr == 0 && character_counter == 0 ) {
+ CHAR tmp_buf1[ MAX_TAPE_NAME_LEN ];
+ CHAR tmp_buf2[ MAX_TAPE_NAME_LEN ];
+ RSM_StringCopy( IDS_DEFAULT_TAPE_NAME, tmp_buf1, MAX_TAPE_NAME_LEN );
+ UI_CurrentDate( tmp_buf2 );
+ wsprintf( buffer, tmp_buf1, tmp_buf2 ) ;
+ }
+
+ while( bsd_ptr != NULL ) {
+
+ BSD_SetTapeLabel( bsd_ptr, (INT8_PTR)buffer,
+ (INT16) strsize( buffer ) );
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+}
+/***************************************************
+
+ Name: PropagateTapePassword()
+
+ Description: Propagate the tape password to all of ths BSD's
+
+ Returns: VOID
+
+*****************************************************/
+VOID PropagateTapePassword( VOID )
+{
+ BSD_PTR bsd_ptr;
+ LPSTR generic_str_ptr;
+ INT16 pswd_size;
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+ generic_str_ptr = (LPSTR)BSD_GetTapePswd( bsd_ptr );
+ pswd_size = BSD_GetTapePswdSize( bsd_ptr );
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ while( bsd_ptr != NULL ) {
+
+ BSD_SetTapePswd( bsd_ptr, (INT8_PTR)generic_str_ptr, pswd_size );
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+}
+/***************************************************
+
+ Name: DM_ReenterPassword()
+
+ Description: Reenter password dialog
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_ReenterPassword(
+ HWND hDlg , /* window handle of the dialog box */
+ MSGID message , /* type of message */
+ MPARAM1 mp1 , /* message-specific information */
+ MPARAM2 mp2 )
+{
+
+ switch ( message )
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ DM_CenterDialog( hDlg );
+
+ reenter_password_ptr = (VOID_PTR)mp2;
+ SendDlgItemMessage( hDlg, IDD_PASSWORD_EDIT, EM_LIMITTEXT,
+ MAX_TAPE_PASSWORD_LEN, 0 );
+ return ( TRUE );
+
+ case WM_COMMAND: /* message: received a command */
+ {
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+
+ if ( wId == IDOK || wId == IDD_PASSWORD_OK ) { /* System menu close command? */
+
+ GetDlgItemText( hDlg, IDD_PASSWORD_EDIT, (LPSTR)reenter_password_ptr, MAX_TAPE_PASSWORD_SIZE );
+ EndDialog( hDlg, TRUE ); /* Exits the dialog box */
+ return ( TRUE );
+ }
+ }
+ break;
+ }
+ return ( FALSE ); /* Didn't process a message */
+}
+
+/***************************************************
+
+ Name: clock_routine
+
+ Description: poll drive status routine
+
+ Returns: void
+
+*****************************************************/
+static VOID clock_routine( VOID )
+{
+ DBLK_PTR vcb_ptr;
+ WORD status;
+ CDS_PTR cds_ptr;
+ UINT32 current_tape_id;
+ TFINF_PTR fmt_info ;
+#if defined ( OEM_MSOFT )
+ INT16 tape_time;
+ INT16 tape_date;
+ CHAR creation_str[MAX_UI_DATE_SIZE+MAX_UI_TIME_SIZE] ;
+ CHAR creation_time_str[MAX_UI_TIME_SIZE] ;
+#endif
+
+ cds_ptr = CDS_GetCopy();
+
+ // If the user requested that we cancel and the request was delayed,
+ // kill off the dialog.
+
+ if ( mwfCancelRequestDelayed ) {
+
+ SendMessage ( backup_set_temp_ptr->ghDlg, WM_COMMAND, IDCANCEL, (MP2) NULL );
+ mwfCancelRequestDelayed = FALSE;
+ return;
+ }
+
+ status = VLM_GetDriveStatus( &vcb_ptr );
+
+ switch( status ) {
+
+ case VLM_VALID_TAPE:
+
+ /* get tape ID */
+ current_tape_id = FS_ViewTapeIDInVCB( vcb_ptr );
+
+ /* if this ID not equal to the last ID, then must be a new tape */
+ if( backup_set_temp_ptr->tape_id != current_tape_id ) {
+
+ backup_set_temp_ptr->tape_id = current_tape_id;
+
+ /* get the new tape tape name */
+ yprintf( TEXT("%s"), FS_ViewTapeNameInVCB( vcb_ptr ) );
+ backup_set_temp_ptr->tape_password_leng = FS_SizeofTapePswdInVCB( vcb_ptr );
+
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CURRENT_TAPE_NAME, gszTprintfBuffer );
+
+ /* turn the OK button on */
+ EnableWindow ( GetDlgItem ( backup_set_temp_ptr->ghDlg, IDD_BKUP_OK_BUTTON ), ON );
+
+ /* if normal tape and archive operation, or append not allowed
+ to this format ...
+ */
+ fmt_info = TF_GetTapeFormat( 0 ) ;
+ if( ( ! ( FS_GetAttribFromVCB( vcb_ptr ) & VCB_ARCHIVE_BIT ) &&
+ ( backup_set_temp_ptr->mode_flag == ARCHIVE_BACKUP_OPER ) ) ||
+ ( fmt_info == NULL ) ||
+ ( !( fmt_info->attributes & APPEND_SUPPORTED ) ) ) {
+
+ /* change the mode to replace and disable the append button */
+ SendMessage( backup_set_temp_ptr->ghDlg, WM_COMMAND, IDD_BKUP_REPLACE, (LONG)NULL );
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_APPEND ), OFF );
+ }
+ else {
+ /* enable the append button */
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_APPEND ), ON );
+ }
+# if defined ( OEM_MSOFT ) //unsupported feature
+ // Get the creation date of this tape if there is one
+
+ VLM_GetTapeOwnersName( current_tape_id, gszTprintfBuffer );
+
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_OWNER, gszTprintfBuffer );
+
+ VLM_GetTapeCreationDate( current_tape_id, &tape_date, &tape_time );
+
+ UI_IntToDate( creation_str, tape_date ) ;
+ UI_IntToTime( creation_time_str, tape_time ) ;
+
+ strcat( creation_str, TEXT(" ") ) ;
+ strcat( creation_str, creation_time_str ) ;
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, creation_str ) ;
+
+ // Check to see if tape was previously secured, check to
+ // see if Tape has any password.
+ if ( IsCurrentTapeSecured( vcb_ptr ) ) {
+ // check the secure check box
+ CheckDlgButton( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS, 1 );
+ OriginalTapeSecured = ORIGINALLYSECURED;
+ CDS_SetPasswordFlag( cds_ptr, CDS_ENABLE );
+ }
+ else {
+ OriginalTapeSecured = ORIGINALLYUNSECURED;
+ }
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ ON );
+
+ EnableSecurityDlgFlag = 1;
+
+# endif
+ }
+ break;
+
+ case VLM_GOOFY_TAPE:
+ case VLM_FUTURE_VER:
+ case VLM_SQL_TAPE:
+ case VLM_ECC_TAPE:
+ case VLM_BAD_TAPE:
+ case VLM_FOREIGN_TAPE:
+
+ if(backup_set_temp_ptr->display_status != VLM_FOREIGN_TAPE ) {
+
+ backup_set_temp_ptr->display_status = VLM_FOREIGN_TAPE;
+ backup_set_temp_ptr->tape_id = 0;
+ backup_set_temp_ptr->tape_password_leng = 0;
+ yresprintf( (INT16) RES_ERASE_FOREIGN_TAPE );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CURRENT_TAPE_NAME, gszTprintfBuffer );
+
+ /* turn the OK button OFF */
+ EnableWindow ( GetDlgItem ( backup_set_temp_ptr->ghDlg, IDD_BKUP_OK_BUTTON ), OFF );
+ }
+# if defined ( OEM_MSOFT ) //unsupported feature
+ // Blank out the creation date
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, TEXT(" ") ) ;
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+
+ // uncheck the secure box
+ CheckDlgButton( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS, 0 );
+# endif
+ break;
+
+ case VLM_BLANK_TAPE:
+
+ if(backup_set_temp_ptr->display_status != VLM_BLANK_TAPE ) {
+
+ backup_set_temp_ptr->display_status = VLM_BLANK_TAPE;
+ backup_set_temp_ptr->tape_id = 0;
+ backup_set_temp_ptr->tape_password_leng = 0;
+ yresprintf( (INT16) RES_ERASE_BLANK_TAPE );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CURRENT_TAPE_NAME, gszTprintfBuffer );
+
+ /* turn the OK button on */
+ EnableWindow ( GetDlgItem ( backup_set_temp_ptr->ghDlg, IDD_BKUP_OK_BUTTON ), ON );
+
+ /* change the mode to replace and disable the append button */
+ SendMessage( backup_set_temp_ptr->ghDlg, WM_COMMAND, IDD_BKUP_REPLACE, (LONG)NULL );
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_APPEND ), OFF );
+ }
+# if defined ( OEM_MSOFT ) //unsupported feature
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ ON );
+
+ EnableSecurityDlgFlag = 1;
+
+ // Blank out the creation date
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, TEXT(" ") ) ;
+
+ OriginalTapeSecured = ORIGINALLYUNSECURED;
+# endif
+ break;
+
+ case VLM_DRIVE_FAILURE:
+
+ if(backup_set_temp_ptr->display_status != VLM_DRIVE_FAILURE ) {
+
+ backup_set_temp_ptr->display_status = VLM_DRIVE_FAILURE;
+ backup_set_temp_ptr->tape_id = 0;
+ backup_set_temp_ptr->tape_password_leng = 0;
+ yresprintf( (INT16) RES_DRIVE_ERROR_DETECTED );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CURRENT_TAPE_NAME, gszTprintfBuffer );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_TAPE_NAME, TEXT(" ") ) ;
+
+ /* turn the OK button off when no tape */
+ EnableWindow ( GetDlgItem ( backup_set_temp_ptr->ghDlg, IDD_BKUP_OK_BUTTON ), OFF );
+ }
+# if defined ( OEM_MSOFT ) //unsupported feature
+ // Blank out the creation date
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, TEXT(" ") ) ;
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+
+ // uncheck the secure box
+ CheckDlgButton( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS, 0 );
+# endif
+ break;
+
+ case VLM_NO_TAPE:
+
+ if(backup_set_temp_ptr->display_status != VLM_NO_TAPE ) {
+
+ backup_set_temp_ptr->display_status = VLM_NO_TAPE;
+ backup_set_temp_ptr->tape_id = 0;
+ backup_set_temp_ptr->tape_password_leng = 0;
+ yresprintf( (INT16) RES_ERASE_NO_TAPE );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CURRENT_TAPE_NAME, gszTprintfBuffer );
+
+ /* turn the OK button off when no tape */
+ EnableWindow ( GetDlgItem ( backup_set_temp_ptr->ghDlg, IDD_BKUP_OK_BUTTON ), OFF );
+ }
+# if defined ( OEM_MSOFT ) //unsupported feature
+ // Blank out the creation date
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_OWNER, TEXT(" ") );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, TEXT(" ") ) ;
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+
+ // uncheck the secure box
+ CheckDlgButton( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS, 0 );
+# endif
+ break;
+
+#ifdef OS_WIN32
+ case VLM_UNFORMATED:
+
+ if(backup_set_temp_ptr->display_status != VLM_UNFORMATED ) {
+
+ backup_set_temp_ptr->display_status = VLM_UNFORMATED;
+ backup_set_temp_ptr->tape_id = 0;
+ backup_set_temp_ptr->tape_password_leng = 0;
+ yresprintf( (INT16) RES_VLM_UNFORMATED_TAPE );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CURRENT_TAPE_NAME, gszTprintfBuffer );
+
+ /* turn the OK button off when tape not formated */
+ EnableWindow ( GetDlgItem ( backup_set_temp_ptr->ghDlg, IDD_BKUP_OK_BUTTON ), OFF );
+ }
+# if defined ( OEM_MSOFT ) //unsupported feature
+ // Blank out the creation date
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, TEXT(" ") ) ;
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+
+ // uncheck the secure box
+ CheckDlgButton( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS, 0 );
+# endif
+ break;
+#endif // OS_WIN32
+
+ case VLM_BUSY:
+
+ if(backup_set_temp_ptr->display_status != VLM_BUSY ) {
+
+ backup_set_temp_ptr->display_status = VLM_BUSY;
+ backup_set_temp_ptr->tape_id = 0;
+ backup_set_temp_ptr->tape_password_leng = 0;
+ yresprintf( (INT16) RES_ERASE_DRIVE_BUSY );
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CURRENT_TAPE_NAME, gszTprintfBuffer );
+
+ /* turn the OK button off when busy */
+ EnableWindow ( GetDlgItem ( backup_set_temp_ptr->ghDlg, IDD_BKUP_OK_BUTTON ), OFF );
+ }
+# if defined ( OEM_MSOFT ) //unsupported feature
+ // Blank out the creation date
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, TEXT(" ") ) ;
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+
+ // uncheck the secure box
+ CheckDlgButton( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS, 0 );
+# endif
+ break;
+ default:
+# if defined ( OEM_MSOFT ) //unsupported feature
+ // Blank out the creation date
+ SetDlgItemText( backup_set_temp_ptr->ghDlg, IDD_BKUP_CREATION_DATE, TEXT(" ") ) ;
+
+ EnableWindow( GetDlgItem( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS ),
+ OFF );
+
+ // uncheck the secure box
+ CheckDlgButton( backup_set_temp_ptr->ghDlg, IDD_BKUP_RESTRICT_ACCESS, 0 );
+
+# endif
+ break;
+ } /* end switch statment */
+} /* end clock routine */
+
+/***************************************************
+
+ Name: ScrollLineDown
+
+ Description: decrements the index counter
+
+ Returns: void
+
+*****************************************************/
+static VOID ScrollLineDown( VOID )
+{
+ if( backup_set_temp_ptr->BSD_index > 0 ) {
+
+ backup_set_temp_ptr->BSD_index--;
+ }
+}
+
+/***************************************************
+
+ Name: ScrollLineUp
+
+ Description: increments the index counter
+
+ Returns: void
+
+*****************************************************/
+static VOID ScrollLineUp( VOID )
+{
+ if( backup_set_temp_ptr->BSD_index < backup_set_temp_ptr->max_BSD_index ) {
+
+ backup_set_temp_ptr->BSD_index++;
+ }
+}
+
+#ifdef OEM_EMS
+/***************************************************
+ ** These functions are used to display multiple sets
+ ** of controls in the Backup dialog.
+
+/***************************************************
+
+ Name: DM_InitCtrlTables
+
+ Description: sets up the control window handles in the tables
+
+ Returns: A DLG_MODE pointer to the DLG_MODE Table entry that has the
+ matching value to mode. NULL if no entry exists.
+
+*****************************************************/
+DLG_MODE *DM_InitCtrlTables (
+ HWND hDlg,
+ DLG_MODE *ModeTable,
+ UINT16 cModeTblSize,
+ WORD mode )
+{
+
+ DLG_DISPLAY_ENTRY *pDispEntry;
+ DLG_MODE *pMode;
+ UINT16 uModeTable;
+ UINT16 uDispTable;
+ DLG_CTRL_ENTRY *pCtlTable;
+ UINT16 uCtrl;
+ HWND hDlgCtl;
+ DLG_MODE *pCurMode = NULL;
+
+ for ( uModeTable = 0; uModeTable < cModeTblSize; uModeTable++ ) {
+
+ if ( ModeTable[uModeTable].wModeType == mode ) {
+
+ pCurMode = &(ModeTable[uModeTable]);
+ }
+
+ pMode = &(ModeTable[uModeTable]);
+ pDispEntry = pMode->DispTable;
+
+ for (uDispTable = 0; uDispTable < pMode->ucDispTables; uDispTable++) {
+
+ pCtlTable = pDispEntry[uDispTable].CtlTable;
+
+ if ( NULL != pCtlTable ) {
+
+ for ( uCtrl = 0; uCtrl < pDispEntry[uDispTable].ucCtrls; uCtrl++, pCtlTable++ ) {
+
+ hDlgCtl = GetDlgItem( hDlg, pCtlTable->iCtlId );
+
+ pCtlTable->hCtlWnd = hDlgCtl;
+
+ if( hDlgCtl ) {
+
+ ShowWindow( hDlgCtl, SW_HIDE );
+ }
+ }
+ }
+ }
+ }
+
+ return ( pCurMode );
+
+}
+
+
+/***************************************************
+
+ Name: DM_BSDShowControls
+
+ Description: Displays the correct controls based on the Os ID of the BSD
+
+ Returns: void
+
+*****************************************************/
+VOID DM_DispShowControls (
+ HWND hDlg,
+ DLG_MODE * pCurMode,
+ INT iType
+)
+{
+ UINT16 uDispTable;
+ DLG_CTRL_ENTRY *pCtlTable;
+ UINT16 uCtrl;
+ DLG_DISPLAY_ENTRY *pDispTable;
+
+ // Get the right display table for the mode.
+ pDispTable = pCurMode->DispTable;
+
+ // Find the control table for the new BSD.
+
+ for ( uDispTable = 0; uDispTable < pCurMode->ucDispTables; uDispTable++ ) {
+
+ if ( pDispTable[uDispTable].iDispType == iType )
+
+ break;
+ }
+
+ uDispTable = ( uDispTable < pCurMode->ucDispTables ) ? uDispTable : (pCurMode->ucDispTables - 1) ;
+
+ pCurMode->pCurDisp = &(pDispTable[uDispTable]);
+
+ pCtlTable = pDispTable[uDispTable].CtlTable;
+
+ if ( NULL != pCtlTable ) {
+
+ for ( uCtrl = 0; uCtrl < pDispTable[uDispTable].ucCtrls; uCtrl++, pCtlTable++ ) {
+
+ if ( pCtlTable->hCtlWnd ) {
+
+ switch ( pCtlTable->iCtlDispStyle ) {
+
+ case CM_HIDE:
+ ShowWindow( pCtlTable->hCtlWnd, SW_HIDE );
+ break;
+
+ case CM_ENABLE:
+ ShowWindow( pCtlTable->hCtlWnd, SW_SHOW );
+ EnableWindow( pCtlTable->hCtlWnd, TRUE );
+ break;
+
+ case CM_DISABLE:
+ ShowWindow( pCtlTable->hCtlWnd, SW_SHOW );
+ EnableWindow( pCtlTable->hCtlWnd, FALSE );
+ break;
+
+ default:
+ ;
+ }
+ }
+ }
+ }
+}
+
+
+/***************************************************
+
+ Name: DM_ModeGetHelpId
+
+ Description: Returns the correct Help ID for the current mode and BSD
+
+ Returns: DWORD ( Help ID )
+
+*****************************************************/
+DWORD DM_ModeGetHelpId(
+ DLG_MODE * pCurMode
+)
+{
+
+ if ( NULL != pCurMode->pCurDisp ) {
+
+ return pCurMode->pCurDisp->help_id;
+
+ } else {
+
+ return 0;
+ }
+}
+
+#endif OEM_EMS
diff --git a/private/utils/ntbackup/src/d_o_rset.c b/private/utils/ntbackup/src/d_o_rset.c
new file mode 100644
index 000000000..d510319c7
--- /dev/null
+++ b/private/utils/ntbackup/src/d_o_rset.c
@@ -0,0 +1,2742 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: D_O_RSET.C
+
+ Description:
+
+ $Log: G:\ui\logfiles\d_o_rset.c_v $
+
+ Rev 1.83.1.8 16 Jun 1994 15:17:50 STEVEN
+Read-Only are not restore devices
+
+ Rev 1.83.1.7 02 Feb 1994 18:11:06 chrish
+Took out un-need codes dealing with restricted access secured tapes.
+Logic is not needed here, is basically dead codes.
+
+ Rev 1.83.1.6 02 Feb 1994 11:29:10 Glenn
+Overhauled log file browse support - now a separate function in d_browse.c.
+
+ Rev 1.83.1.5 28 Jan 1994 16:35:32 MIKEP
+reset the restore security flag when changing destination drives
+
+ Rev 1.83.1.4 17 Jan 1994 16:00:28 MIKEP
+fix unicode warnings
+
+ Rev 1.83.1.3 16 Dec 1993 19:50:08 STEVEN
+fixed unicode bo bo
+
+ Rev 1.83.1.2 02 Dec 1993 12:52:16 STEVEN
+Fixes bug with target path being garbaged.
+
+ Rev 1.83.1.1 04 Nov 1993 16:16:44 STEVEN
+japanese fixes
+
+ Rev 1.83 20 Jul 1993 16:16:42 KEVINS
+Clear out browse combo box before updating it.
+
+ Rev 1.82 12 Jul 1993 16:04:32 MARINA
+enable c++
+
+ Rev 1.81 29 Jun 1993 16:11:16 BARRY
+Now set ProcessSpecialFiles in config as well as BSD. Requires updated config.
+
+ Rev 1.80 16 Jun 1993 21:36:04 GREGG
+If we're not prompting for security, default to not restoring security, and
+set the process element only flag in the BSD to TRUE.
+
+ Rev 1.79 11 Jun 1993 14:27:46 BARRY
+Use dle features for restore of special files instead of FS_PromptForBindery.
+
+ Rev 1.78 02 Jun 1993 14:19:16 KEVINS
+Correct logic error when calculating new drive to change to in browse.
+
+ Rev 1.77 27 May 1993 08:22:50 CARLS
+fixed tape power off - restore problem
+
+ Rev 1.76 22 May 1993 18:38:44 BARRY
+Fixed to compile for MIPs
+
+ Rev 1.75 21 May 1993 18:15:16 KEVINS
+Replaced hard coded strings with ID's.
+
+ Rev 1.74 14 May 1993 16:34:12 CHUCKB
+See if NO_EXT_KEYS is already defined before defining it. Fixes a warningfrom Microsoft.
+
+ Rev 1.73 12 May 1993 17:56:46 KEVINS
+Refresh DLE when user goes browsing for drives.
+
+ Rev 1.72 12 May 1993 16:51:42 CHUCKB
+Make sure wListIndex is initialized before being used (fixes a warning from
+Microsoft).
+
+ Rev 1.71 04 May 1993 10:54:42 DARRYLP
+Fixed browsing directory search.
+
+ Rev 1.70 03 May 1993 10:32:50 DARRYLP
+Made changes to browse dialog to reflect path given in combobox.
+
+ Rev 1.69 29 Apr 1993 17:27:26 CARLS
+changed strncmp to _strnicmp for mixed case drive letters
+
+ Rev 1.68 21 Apr 1993 18:55:50 CHUCKB
+1. Changed commented-out ifdef's on lines 989 and 1003 to real ifdef's for
+ OS_WIN32, so this change will affect (fix) both Cayman and Nostradamus.
+2. Changed line 999 from
+ nStatus = ( BSD_GetMarkStatus( pBSD ) == ALL_SELECTED ) ;
+ to
+ nStatus = BSD_GetProcSpecialFlg( pBSD ) ;
+to initialize and maintain the Restore Registry checkbox correctly. This
+fixed a C2P2 EPR against Nostradamus.
+
+
+ Rev 1.67 08 Apr 1993 17:30:08 chrish
+Minor change for cleaning up warning message.
+
+ Rev 1.66 22 Mar 1993 12:30:40 chrish
+Changeed "SeSecurityPrivilege" to "SeRestorePrivilege" for checking for tape security.
+
+ Rev 1.65 16 Mar 1993 12:48:20 CARLS
+changed log file name
+
+ Rev 1.64 16 Mar 1993 12:41:16 CARLS
+LOG file changes
+
+ Rev 1.63 08 Mar 1993 14:44:28 DARRYLP
+Added read only drive support.
+
+ Rev 1.62 26 Feb 1993 09:56:06 STEVEN
+we ignored the registry button
+
+ Rev 1.61 11 Feb 1993 09:01:32 CARLS
+remove code to invalidate combobox
+
+ Rev 1.60 09 Feb 1993 17:42:08 STEVEN
+setting the wrong thing
+
+ Rev 1.59 09 Feb 1993 09:23:10 STEVEN
+fix drive pull down windows
+
+ Rev 1.58 27 Jan 1993 14:23:38 STEVEN
+updates from msoft
+
+ Rev 1.57 15 Dec 1992 11:22:10 chrish
+Corrected logic to handle possible NULL returned from
+GetCurrentMachineNameUserName routine.
+
+ Rev 1.56 14 Dec 1992 12:17:22 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.55 07 Dec 1992 15:06:26 STEVEN
+updates from msoft
+
+ Rev 1.54 20 Nov 1992 16:54:20 GLENN
+Completely overhauled so that this code could be readable, also added drive and volume name.
+
+ Rev 1.53 16 Nov 1992 12:21:42 chrish
+Minor changes to clean-up warining messages on building.
+
+ Rev 1.52 13 Nov 1992 17:19:06 chrish
+Changes for restoring Secured Tapes - NT
+
+ Rev 1.51 11 Nov 1992 16:32:28 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.50 01 Nov 1992 15:55:50 DAVEV
+Unicode changes
+
+ Rev 1.49 07 Oct 1992 13:40:00 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.48 04 Oct 1992 19:36:46 DAVEV
+Unicode Awk pass
+
+ Rev 1.47 17 Sep 1992 15:50:30 DAVEV
+UNICODE modifications: strlen usage check
+
+ Rev 1.46 10 Sep 1992 17:45:14 DAVEV
+Integrate MikeP's changes from Microsoft
+
+ Rev 1.45 03 Sep 1992 10:44:18 CHUCKB
+Took out some unreferenced locals.
+
+ Rev 1.44 19 Aug 1992 14:28:54 CHUCKB
+Added new stuff for NT.
+
+ Rev 1.43 28 Jul 1992 15:05:08 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.42 26 Jun 1992 15:51:58 DAVEV
+
+
+ Rev 1.41 24 Jun 1992 09:20:06 DAVEV
+Browse to path is no longer just an OEM_MSOFT feature
+
+ Rev 1.40 18 Jun 1992 11:25:18 DAVEV
+OEM_MSOFT:fixed logging bug
+
+ Rev 1.39 11 Jun 1992 15:22:28 DAVEV
+do not display status message 'Examine <log file> for more info' if not logging
+
+ Rev 1.38 05 Jun 1992 12:43:04 DAVEV
+OEM_MSOFT: Init log file name to default
+
+ Rev 1.37 14 May 1992 16:37:36 MIKEP
+NT pass 2
+
+ Rev 1.36 24 Apr 1992 08:28:00 CARLS
+added Mac delimiter support for SetTargetPath
+
+
+*****************************************************/
+
+#ifndef NO_EXT_KEYS
+#define NO_EXT_KEYS
+#endif
+
+#include "all.h"
+#include "ctl3d.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+
+#define ON 1
+#define OFF 0
+#define NO_SHOW 0
+#define SHOW 1
+#define REDRAW 1
+#define NO_REDRAW 0
+#define RESTORE_MODE 0
+#define VERIFY_MODE 1
+
+#define MAX_BROWSE_PATH_LEN 1024
+
+extern WORD RT_BSD_index;
+extern WORD RT_max_BSD_index;
+
+struct temp {
+ WORD wDlgStatus;
+ WORD BSD_index;
+ WORD max_BSD_index;
+ WORD fMode;
+ HWND ghDlg; /* global window handle of the dialog box */
+ WORD display_status;
+ HTIMER timer_handle;
+ INT poll_drive_freq;
+};
+
+static struct temp *mwpStatus;
+
+
+LOCALFN VOID clock_routine( VOID );
+LOCALFN VOID ScrollLineDown( VOID );
+LOCALFN VOID ScrollLineUp( VOID );
+LOCALFN VOID SetTargetPath( BSD_PTR, CHAR_PTR );
+LOCALFN VOID GetTargetPath( BSD_PTR, CHAR_PTR );
+LOCALFN VOID SeeIfWeCanSilentlyLogin( VOID );
+LOCALFN INT ConfirmXchgBsdServers( WORD * );
+#define EMS_SERVER_NOT_FOUND 1
+#define EMS_XCHG_FOUND 2
+#define EMS_NO_DEST 3
+#define EMS_NO_STORE 4
+#define EMS_MUST_WIPE_TO_ALT 5
+#define EMS_NO_WIPE_IF_NOT_BOTH 6
+
+/***************************************************
+
+ Name: DM_StartRestoreBackupSet
+
+ Description: Start the restore target dialog
+
+ Returns:
+
+*****************************************************/
+INT DM_StartRestoreBackupSet(VOID)
+{
+ struct temp temp_data;
+
+ mwpStatus = &temp_data;
+
+ mwpStatus->fMode = RESTORE_MODE;
+
+ DM_ShowDialog( ghWndFrame, IDD_RESTORESET, NULL );
+
+ return( mwpStatus->wDlgStatus );
+}
+/***************************************************
+
+ Name: DM_StartVerifyBackupSet
+
+ Description: Start the verify target dialog
+
+ Returns:
+
+*****************************************************/
+INT DM_StartVerifyBackupSet(VOID)
+{
+ struct temp temp_data;
+
+ mwpStatus = &temp_data;
+
+ mwpStatus->fMode = VERIFY_MODE;
+
+ DM_ShowDialog( ghWndFrame, IDD_VERIFYSET, NULL );
+
+ return( mwpStatus->wDlgStatus );
+}
+/***************************************************
+
+ Name: DM_RestoreSet
+
+ Description: Restore dialog procedure
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_RestoreSet (
+
+HWND hDlg, /* window handle of the dialog box */
+MSGID message, /* type of message */
+MP1 mp1, /* message-specific information */
+MP2 mp2 )
+
+{
+ HWND hWndScrollBar;
+ WORD wThumbPosition;
+ INT nButtonState;
+ CHAR_PTR pszTemp;
+ BSD_PTR pBSD;
+ CDS_PTR pCDS;
+ BE_CFG_PTR pBEConfig;
+ CHAR szBuffer1[80];
+ CHAR szBuffer2[80];
+ HDC hDC;
+ HWND hComboWnd;
+ WORD wIndex;
+ TEXTMETRIC tm;
+ CHAR szText[80];
+ COLORREF crColor;
+ LPDRAWITEMSTRUCT lpDIS;
+ LPMEASUREITEMSTRUCT lpMIS;
+ BSD_PTR bsd_ptr ;
+#ifdef OEM_EMS
+
+ static DLG_CTRL_ENTRY DefaultCtrlTable[] = {
+ { IDD_RSET_DEST_NAME, 0, CM_HIDE },
+ { IDD_RSET_DSA_DEST_NAME, 0, CM_HIDE },
+ { IDD_RSET_DEST_TEXT, 0, CM_HIDE },
+ { IDD_RSET_DS_DEST_TEXT, 0, CM_HIDE },
+ { IDD_RSET_ORG_TEXT, 0, CM_HIDE },
+ { IDD_RSET_WIPE_DATA, 0, CM_HIDE },
+ { IDD_RSET_PRIV_IS, 0, CM_HIDE },
+ { IDD_RSET_PUB_IS, 0, CM_HIDE },
+ { IDD_RSET_ORG_NAME, 0, CM_HIDE },
+ { IDD_RSET_START_EMS, 0, CM_HIDE },
+ { IDD_RSET_DRIVE_TEXT, 0, CM_ENABLE },
+ { IDD_RSET_DRIVE_BOX, 0, CM_ENABLE },
+ { IDD_RSET_PATH_TEXT, 0, CM_ENABLE },
+ { IDD_RSET_RESTORE_PATH, 0, CM_ENABLE },
+ { IDD_RSET_BROWSE_BUTTON, 0, CM_ENABLE },
+ { IDD_RSET_REGISTRY, 0, CM_ENABLE },
+ { IDD_RSET_SECURITY_INFO, 0, CM_ENABLE }
+ };
+
+ static DLG_CTRL_ENTRY EMS_MDBCtrlTable[] = {
+ { IDD_RSET_DRIVE_TEXT, 0, CM_HIDE },
+ { IDD_RSET_DRIVE_BOX, 0, CM_HIDE },
+ { IDD_RSET_PATH_TEXT, 0, CM_HIDE },
+ { IDD_RSET_RESTORE_PATH, 0, CM_HIDE },
+ { IDD_RSET_BROWSE_BUTTON, 0, CM_HIDE },
+ { IDD_RSET_REGISTRY, 0, CM_HIDE },
+ { IDD_RSET_SECURITY_INFO, 0, CM_HIDE },
+ { IDD_RSET_DSA_DEST_NAME, 0, CM_HIDE },
+ { IDD_RSET_DS_DEST_TEXT, 0, CM_HIDE },
+ { IDD_RSET_DEST_NAME, 0, CM_ENABLE },
+ { IDD_RSET_DEST_TEXT, 0, CM_ENABLE },
+ { IDD_RSET_ORG_TEXT, 0, CM_ENABLE },
+ { IDD_RSET_WIPE_DATA, 0, CM_ENABLE },
+ { IDD_RSET_PRIV_IS, 0, CM_ENABLE },
+ { IDD_RSET_PUB_IS, 0, CM_ENABLE },
+ { IDD_RSET_START_EMS, 0, CM_ENABLE },
+ { IDD_RSET_ORG_NAME, 0, CM_ENABLE }
+ };
+
+ static DLG_CTRL_ENTRY EMS_DSACtrlTable[] = {
+ { IDD_RSET_DRIVE_TEXT, 0, CM_HIDE },
+ { IDD_RSET_DRIVE_BOX, 0, CM_HIDE },
+ { IDD_RSET_PATH_TEXT, 0, CM_HIDE },
+ { IDD_RSET_RESTORE_PATH, 0, CM_HIDE },
+ { IDD_RSET_BROWSE_BUTTON, 0, CM_HIDE },
+ { IDD_RSET_REGISTRY, 0, CM_HIDE },
+ { IDD_RSET_SECURITY_INFO, 0, CM_HIDE },
+ { IDD_RSET_PRIV_IS, 0, CM_HIDE },
+ { IDD_RSET_PUB_IS, 0, CM_HIDE },
+ { IDD_RSET_DEST_NAME, 0, CM_HIDE },
+ { IDD_RSET_DEST_TEXT, 0, CM_HIDE },
+ { IDD_RSET_ORG_TEXT, 0, CM_ENABLE },
+ { IDD_RSET_DSA_DEST_NAME, 0, CM_ENABLE },
+ { IDD_RSET_DS_DEST_TEXT, 0, CM_ENABLE },
+ { IDD_RSET_WIPE_DATA, 0, CM_ENABLE },
+ { IDD_RSET_START_EMS, 0, CM_ENABLE },
+ { IDD_RSET_ORG_NAME, 0, CM_ENABLE }
+ };
+
+
+ // GENERIC_DATA must be last w/ no other iBsdType == GENERIC_DATA (or its value).
+ static DLG_DISPLAY_ENTRY RestBsdTable[] = {
+ { FS_EMS_MDB_ID, EMS_MDBCtrlTable,
+ sizeof(EMS_MDBCtrlTable)/sizeof(EMS_MDBCtrlTable[0]), IDH_DB_XCHG_RESTORESET },
+ { FS_EMS_DSA_ID, EMS_DSACtrlTable,
+ sizeof(EMS_DSACtrlTable)/sizeof(EMS_DSACtrlTable[0]), IDH_DB_XCHG_RESTORESET },
+ { FS_UNKNOWN_OS, DefaultCtrlTable,
+ sizeof(DefaultCtrlTable)/sizeof(DefaultCtrlTable[0]), IDH_DB_RESTORESET }
+ };
+
+ static DLG_DISPLAY_ENTRY VerifyBsdTable[] = {
+ { FS_EMS_MDB_ID, EMS_MDBCtrlTable,
+ sizeof(EMS_MDBCtrlTable)/sizeof(EMS_MDBCtrlTable[0]), IDH_DB_XCHG_RESTORESET },
+ { FS_EMS_DSA_ID, EMS_DSACtrlTable,
+ sizeof(EMS_DSACtrlTable)/sizeof(EMS_DSACtrlTable[0]), IDH_DB_XCHG_RESTORESET },
+ { FS_UNKNOWN_OS, DefaultCtrlTable,
+ sizeof(DefaultCtrlTable)/sizeof(DefaultCtrlTable[0]), IDH_DB_VERIFYSET }
+ };
+
+ static DLG_MODE ModeTable[] = {
+ { VERIFY_MODE, VerifyBsdTable,
+ sizeof(VerifyBsdTable)/sizeof(VerifyBsdTable[0]), &(VerifyBsdTable[2]) },
+ { RESTORE_MODE, RestBsdTable,
+ sizeof(RestBsdTable)/sizeof(RestBsdTable[0]), &(VerifyBsdTable[2]) },
+ };
+
+ static UINT16 cModeTblSize = sizeof( ModeTable ) / sizeof( ModeTable[0] );
+ static DLG_MODE *pCurMode;
+ DWORD help_id;
+
+#endif
+
+ switch ( message ) {
+
+ case WM_DRAWITEM:
+ lpDIS = (LPDRAWITEMSTRUCT)mp2;
+ if (lpDIS->CtlID == IDD_RSET_DRIVE_BOX)
+ {
+ hComboWnd = lpDIS->hwndItem;
+ hDC = lpDIS->hDC;
+ switch(lpDIS->itemAction)
+ {
+ case ODA_DRAWENTIRE:
+ SendMessage(hComboWnd,
+ CB_GETLBTEXT,
+ lpDIS->itemID,
+ (LONG)(LPSTR)szText);
+
+ if (lpDIS->itemData == TRUE)
+ {
+ // Text should be gray, read only drive...
+ crColor = GetSysColor(COLOR_GRAYTEXT);
+ } else
+ {
+ // Text should be normal, read/write drive...
+ crColor = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ SetTextColor(hDC, crColor);
+ DrawText(hDC,
+ szText,
+ strlen(szText),
+ (LPRECT)&lpDIS->rcItem,
+ DT_LEFT|DT_SINGLELINE);
+ switch(lpDIS->itemState)
+ {
+ case ODS_FOCUS:
+ DrawFocusRect(hDC, &lpDIS->rcItem);
+ break;
+
+ case ODS_SELECTED:
+ InvertRect(hDC, &lpDIS->rcItem);
+ break;
+ }
+ break;
+
+ case ODA_FOCUS:
+ DrawFocusRect(hDC, &lpDIS->rcItem);
+ break;
+
+ case ODA_SELECT:
+ InvertRect(hDC, &lpDIS->rcItem);
+ break;
+ }
+ }
+ break;
+
+ case WM_MEASUREITEM:
+ lpMIS = (LPMEASUREITEMSTRUCT)mp2;
+ if (lpMIS->CtlID == IDD_RSET_DRIVE_BOX)
+ {
+ hComboWnd = GetDlgItem(hDlg, IDD_RSET_DRIVE_BOX);
+ hDC = GetDC(hComboWnd);
+ GetTextMetrics(hDC, &tm);
+ lpMIS->itemHeight = tm.tmHeight;
+ ReleaseDC(hComboWnd, hDC);
+ }
+ break;
+
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ // Let's go 3-D!!
+ Ctl3dSubclassDlgEx( hDlg, CTL3D_ALL );
+
+#ifdef OEM_EMS
+ pCurMode = DM_InitCtrlTables( hDlg, ModeTable, cModeTblSize,
+ mwpStatus->fMode );
+#endif
+
+ DM_CenterDialog( hDlg );
+
+ /* set the length of the text fields */
+ SendDlgItemMessage( hDlg, IDD_RSET_TAPE_NAME, EM_LIMITTEXT, MAX_TAPE_NAME_LEN, 0 );
+
+ SendDlgItemMessage( hDlg, IDD_RSET_SET_LINE_1, EM_LIMITTEXT, MAX_UI_PATH_LEN, 0 );
+
+ /* return the max number of BSD's for this backup */
+ mwpStatus->max_BSD_index = GetMaxBSDCount();
+
+ /* start at the first BSD */
+ mwpStatus->BSD_index = 0;
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+
+ /* get the backup engine config for this BSD */
+ pBEConfig = BSD_GetConfigData( pBSD );
+
+ /* set the global BSD index used for the "Set information N of N" dialogs title */
+ RT_BSD_index = (WORD) (mwpStatus->BSD_index + 1);
+ RT_max_BSD_index = (WORD) (mwpStatus->max_BSD_index + 1);
+
+ hWndScrollBar = GetDlgItem( hDlg, IDD_RSET_SCROLLBAR );
+
+ /* if only one backup set, turn off the scrollbar */
+ if ( mwpStatus->max_BSD_index == mwpStatus->BSD_index ) {
+ ShowScrollBar( hWndScrollBar, SB_CTL, NO_SHOW );
+ }
+ /* show the scrollbar and set the max range for the scrollbar */
+ else {
+ SetScrollRange( hWndScrollBar, SB_CTL, mwpStatus->BSD_index, mwpStatus->max_BSD_index, NO_REDRAW );
+ SetScrollPos( hWndScrollBar, SB_CTL, mwpStatus->BSD_index, NO_REDRAW );
+ }
+
+ /* add "1 of n" to backup set info title */
+ RSM_StringCopy( IDS_SET_INFORMATION, szBuffer1, 80 );
+ wsprintf( szBuffer2, szBuffer1, mwpStatus->BSD_index + 1, mwpStatus->max_BSD_index + 1 );
+
+ /* show the "Set information n of n" */
+ SetDlgItemText( hDlg, IDD_RSET_INFO_TITLE, szBuffer2 );
+
+
+ /* display the default tape name */
+ pszTemp = (LPSTR)BSD_GetTapeLabel( pBSD );
+ SetDlgItemText( hDlg, IDD_RSET_TAPE_NAME, pszTemp );
+
+ /* see if we can add a few more restore destinations */
+ SeeIfWeCanSilentlyLogin( );
+
+ /* get the drive list */
+ GetCurrentRestoreDriveList( hDlg );
+
+ /* set all BSD's DLEs to the default drive */
+ SetDefaultDLE( hDlg );
+
+
+ pCDS = CDS_GetCopy();
+ /* Auto verify check box */
+ if ( mwpStatus->fMode == RESTORE_MODE ) {
+ CheckDlgButton( hDlg, IDD_RSET_VERIFY_AFTER, CDS_GetAutoVerifyRestore( pCDS ) );
+ }
+
+ /* display the state of the first BSD */
+#ifndef OEM_EMS
+ RestoreSetRetrieve( hDlg );
+#else
+ RestoreSetRetrieve( hDlg, pCurMode );
+#endif
+
+# if defined ( OEM_MSOFT ) // special feature
+ {
+# define OEMLOG_MAX_FILEPATH 512 //NTKLUG
+
+ CHAR szLogFilePath[ OEMLOG_MAX_FILEPATH ];
+ INT nLen;
+
+ if ( nLen = GetWindowsDirectory ( szLogFilePath, OEMLOG_MAX_FILEPATH ) ) {
+
+ // NT KLUDGE
+
+ if ( szLogFilePath[ nLen-1 ] != TEXT('\\') && nLen < OEMLOG_MAX_FILEPATH ) {
+
+ strcat ( szLogFilePath, TEXT("\\") );
+ nLen++;
+ }
+
+ if ( nLen < OEMLOG_MAX_FILEPATH &&
+ RSM_StringCopy( IDS_OEMLOG_BACKUP_DEF_NAME,
+ szLogFilePath + nLen,
+ OEMLOG_MAX_FILEPATH - nLen ) > 0 ) {
+
+ SetDlgItemText ( hDlg, IDD_RSET_LOG_FILENAME, szLogFilePath ) ;
+ }
+
+ }
+
+ /* Check default log file radio button */
+ CheckRadioButton ( hDlg, IDD_RSET_LOG_FULL,
+ IDD_RSET_LOG_NONE,
+ IDD_RSET_LOG_SUMMARY );
+
+// CheckDlgButton( hDlg, IDD_RSET_LOG_SUMMARY, 1 ) ;
+ }
+# endif //defined ( OEM_MSOFT ) // special feature
+
+ mwpStatus->ghDlg = hDlg;
+ /* set the display_status to a value not returned by VLM_GetDriveStatus */
+ mwpStatus->display_status = 0x7fff ;
+ clock_routine( );
+ mwpStatus->poll_drive_freq = PD_SetFrequency( 1 );
+ mwpStatus->timer_handle = WM_HookTimer( clock_routine, 1 );
+
+ return ( TRUE );
+
+
+ case WM_VSCROLL:
+
+ hWndScrollBar = GetDlgItem( hDlg, IDD_RSET_SCROLLBAR );
+
+ if ( GET_WM_VSCROLL_HWND ( mp1, mp2 ) == hWndScrollBar ) {
+
+ wThumbPosition = GET_WM_VSCROLL_POS ( mp1, mp2 );
+
+ switch ( GET_WM_VSCROLL_CODE ( mp1, mp2 ) ) {
+
+ case SB_THUMBPOSITION:
+
+ SetScrollPos( hWndScrollBar, SB_CTL, wThumbPosition, REDRAW );
+ return ( TRUE );
+
+ case SB_THUMBTRACK:
+
+ if ( wThumbPosition > mwpStatus->max_BSD_index ) {
+ wThumbPosition = mwpStatus->max_BSD_index;
+ }
+
+ if ( wThumbPosition >= mwpStatus->BSD_index ) {
+
+ /* save this BSDs information */
+ if ( !RestoreSetSave( hDlg ) ) {
+
+ // something was wrong, so don't do anything
+ // put up a message box and return
+
+#ifdef OEM_EMS
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ switch ( BSD_GetOsId( pBSD ) ) {
+
+ case FS_EMS_MDB_ID:
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DEST_NAME ) );
+ break;
+
+ case FS_EMS_DSA_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DSA_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DSA_DEST_NAME ) );
+ break;
+
+ default:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_RESTORE_PATH, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_RESTORE_PATH ) );
+ }
+#else
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+#endif
+
+ return ( TRUE );
+ }
+
+ while ( wThumbPosition != mwpStatus->BSD_index ) {
+ ScrollLineUp( );
+ }
+
+ /* restore the next BSDs information */
+#ifndef OEM_EMS
+ RestoreSetRetrieve( hDlg );
+#else
+ RestoreSetRetrieve( hDlg, pCurMode );
+#endif
+ }
+ else {
+
+ // save this BSDs information
+
+ if ( ! RestoreSetSave( hDlg ) ) {
+
+ // put up message box & split
+
+#ifdef OEM_EMS
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ switch ( BSD_GetOsId( pBSD ) ) {
+
+ case FS_EMS_MDB_ID:
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DEST_NAME ) );
+ break;
+
+
+ case FS_EMS_DSA_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DSA_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DSA_DEST_NAME ) );
+ break;
+
+ default:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_RESTORE_PATH, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_RESTORE_PATH ) );
+ }
+#else
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+#endif
+
+ return( TRUE );
+ }
+
+ while ( wThumbPosition != mwpStatus->BSD_index ) {
+ ScrollLineDown( );
+ }
+
+ /* restore the next BSDs information */
+#ifndef OEM_EMS
+ RestoreSetRetrieve( hDlg );
+#else
+ RestoreSetRetrieve( hDlg, pCurMode );
+#endif
+ }
+
+ return ( TRUE );
+
+ case SB_PAGEUP:
+ case SB_LINEUP:
+
+ // save this BSDs information
+
+ if ( ! RestoreSetSave( hDlg ) ) {
+
+ // put up message box and leave town
+
+#ifdef OEM_EMS
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ switch ( BSD_GetOsId( pBSD ) ) {
+
+ case FS_EMS_MDB_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DEST_NAME ) );
+ break;
+
+ case FS_EMS_DSA_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DSA_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DSA_DEST_NAME ) );
+ break;
+
+ default:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_RESTORE_PATH, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_RESTORE_PATH ) );
+ }
+#else
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+#endif
+
+ return( TRUE );
+ }
+
+ ScrollLineDown( );
+
+ /* restore the next BSDs information */
+#ifndef OEM_EMS
+ RestoreSetRetrieve( hDlg );
+#else
+ RestoreSetRetrieve( hDlg, pCurMode );
+#endif
+
+ SetScrollPos( hWndScrollBar, SB_CTL, mwpStatus->BSD_index, REDRAW );
+ return ( TRUE );
+
+ case SB_PAGEDOWN:
+ case SB_LINEDOWN:
+
+ // save this BSDs information
+
+ if ( ! RestoreSetSave( hDlg ) ) {
+
+ // put up message box and quit
+
+#ifdef OEM_EMS
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ switch ( BSD_GetOsId( pBSD ) ) {
+
+ case FS_EMS_MDB_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DEST_NAME ) );
+ break;
+
+ case FS_EMS_DSA_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DSA_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DSA_DEST_NAME ) );
+ break;
+
+ default:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_RESTORE_PATH, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_RESTORE_PATH ) );
+ }
+#else
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+#endif
+
+ return( TRUE );
+ }
+
+ ScrollLineUp( );
+
+ /* restore the next BSDs information */
+#ifndef OEM_EMS
+ RestoreSetRetrieve( hDlg );
+#else
+ RestoreSetRetrieve( hDlg, pCurMode );
+#endif
+
+ SetScrollPos( hWndScrollBar, SB_CTL, mwpStatus->BSD_index, REDRAW );
+ return ( TRUE );
+
+ case SB_BOTTOM:
+
+ return ( TRUE );
+
+ case SB_ENDSCROLL:
+
+ return ( TRUE );
+
+ case SB_TOP:
+
+ return ( TRUE );
+
+ default:
+ break;
+ }
+ }
+
+ return ( FALSE );
+ break;
+
+ case WM_COMMAND: { /* message: received a command */
+
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+ WORD wCmd = GET_WM_COMMAND_CMD ( mp1, mp2 );
+
+ switch( wId ) {
+
+# ifdef OEM_MSOFT //special feature
+
+ case IDD_RSET_LOG_NONE:
+ case IDD_RSET_LOG_SUMMARY:
+ case IDD_RSET_LOG_FULL:
+
+ CheckRadioButton ( hDlg, IDD_RSET_LOG_NONE, IDD_RSET_LOG_FULL, wId ) ;
+ return TRUE ;
+
+# endif //OEM_MSOFT //special feature
+
+ case IDD_RSET_DRIVE_BOX : {
+
+ if ( wCmd == CBN_SELCHANGE ) {
+
+ /* get the defaults for the drive that's highlighted */
+
+ SetRestoreDrive( hDlg ) ;
+#ifndef OEM_EMS
+ RestoreSetRetrieve( hDlg );
+#else
+ RestoreSetRetrieve( hDlg, pCurMode );
+#endif
+
+ return TRUE;
+ }
+
+ return( FALSE ) ;
+ }
+
+ case IDD_RSET_CANCEL_BUTTON:
+ case IDCANCEL:
+
+ pBSD = GetTapeBSDPointer( (INT16) 0 );
+ pCDS = CDS_GetCopy();
+
+ mwpStatus->wDlgStatus = TRUE;
+
+ WM_UnhookTimer( mwpStatus->timer_handle );
+ PD_SetFrequency( mwpStatus->poll_drive_freq );
+
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+ return ( TRUE );
+
+ case IDOK:
+ case IDD_RSET_OK_BUTTON:
+ hComboWnd = GetDlgItem(hDlg, IDD_RSET_OK_BUTTON);
+ wIndex = (WORD)SendMessage(hComboWnd,
+ CB_GETCURSEL,
+ 0,
+ 0L);
+
+ if (SendMessage(hComboWnd,
+ CB_GETITEMDATA,
+ wIndex,
+ 0L) == TRUE)
+ {
+ CHAR szBuffer[80];
+ CHAR szBuffer2[80];
+ CHAR szTemp[80];
+
+ // Drive is read only, warn user that this is not possible
+
+ SendDlgItemMessage(hDlg,
+ IDD_RSET_DRIVE_BOX,
+ CB_GETLBTEXT,
+ wIndex,
+ (MP2)szBuffer2 );
+
+ RSM_StringCopy( IDS_RTD_ACCESSDENIED_DIR, szBuffer, 80);
+ wsprintf(szTemp, szBuffer, szBuffer2);
+ RSM_StringCopy( IDS_RDONLY_DRV_ENCOUNTER, szBuffer2, 80);
+ WM_MsgBox( szBuffer2, szTemp, WMMB_OK, WMMB_ICONEXCLAMATION ) ;
+ return FALSE;
+ }
+
+ pBSD = GetTapeBSDPointer( (INT16) 0 );
+ pCDS = CDS_GetCopy();
+
+ /* save the state of "auto verify" */
+ if ( mwpStatus->fMode == RESTORE_MODE ) {
+
+ nButtonState = IsDlgButtonChecked( hDlg,IDD_RSET_VERIFY_AFTER );
+ CDS_SetAutoVerifyRestore( pCDS, (INT16)nButtonState );
+ }
+
+# if defined ( OEM_MSOFT ) // special feature
+ {
+ CHAR szLogFile[ MAX_UI_FULLPATH_SIZE ];
+ FILE * fpLog = NULL;
+ INT nLogLevel = LOG_DISABLED;
+
+ // Get the log file name from the edit field
+ GetDlgItemText( hDlg, IDD_RSET_LOG_FILENAME, szLogFile, MAX_UI_FULLPATH_SIZE ) ;
+
+ // can only log if a log file name provided!
+ if ( *szLogFile ) {
+
+ if ( IsDlgButtonChecked( hDlg,IDD_RSET_LOG_SUMMARY ) ) {
+ nLogLevel = LOG_ERRORS;
+ }
+ else if ( IsDlgButtonChecked( hDlg,IDD_RSET_LOG_FULL ) ) {
+ nLogLevel = LOG_DETAIL;
+ }
+ }
+
+ CDS_SetLogLevel ( pCDS, nLogLevel ) ;
+
+ if ( nLogLevel != LOG_DISABLED && *szLogFile ) {
+
+ // make sure the log file can be opened for
+ // writting.
+
+ if ( fpLog = UNI_fopen ( szLogFile, _O_TEXT|_O_APPEND ) ) {
+
+ LOG_SetCurrentLogName ( szLogFile );
+ fclose ( fpLog );
+ }
+ else {
+
+ ShowWindow ( GetDlgItem( hDlg, IDD_RSET_LOG_FILENAME ), FALSE );
+ MessageBeep ( 0 ); //NTKLUG - Need error message!!
+ ShowWindow ( GetDlgItem( hDlg, IDD_RSET_LOG_FILENAME ), TRUE );
+ ShowWindow ( GetDlgItem( hDlg, IDD_RSET_LOG_FILENAME ), FALSE );
+ MessageBeep ( 0 ); //NTKLUG - Need error message!!
+ ShowWindow ( GetDlgItem( hDlg, IDD_RSET_LOG_FILENAME ), TRUE );
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_LOG_FILENAME ) );
+
+ return ( TRUE ) ; // user must re-enter name!
+ }
+ }
+ else // if no file name, then cannot log!
+ {
+ CDS_SetLogLevel ( pCDS, LOG_DISABLED ) ;
+ }
+ }
+# endif //defined ( OEM_MSOFT ) // special feature
+
+ /* save this BSDs information */
+
+ if ( ! RestoreSetSave( hDlg ) ) {
+
+ // set focus on the path
+
+#ifdef OEM_EMS
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ switch ( BSD_GetOsId( pBSD ) ) {
+
+ case FS_EMS_MDB_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DEST_NAME ) );
+ break;
+
+ case FS_EMS_DSA_ID:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DSA_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DSA_DEST_NAME ) );
+ break;
+
+ default:
+
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_RESTORE_PATH, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_RESTORE_PATH ) );
+ }
+#else
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREPATHINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_RESTORE_PATH, 0, 32767);
+#endif
+
+ return( TRUE );
+ }
+
+ /* save the info for the registry and security */
+
+ /* get the backup engine config for this BSD */
+ pBEConfig = BSD_GetConfigData( pBSD );
+
+ BEC_SetRestoreSecurity( pBEConfig,
+ IsDlgButtonChecked( hDlg, IDD_RSET_SECURITY_INFO ) );
+
+ UI_AddSpecialIncOrExc( pBSD,
+ IsDlgButtonChecked( hDlg, IDD_RSET_REGISTRY ) ) ;
+
+ BSD_SetProcSpecialFlg( pBSD,
+ IsDlgButtonChecked( hDlg, IDD_RSET_REGISTRY ) ) ;
+
+ BEC_SetProcSpecialFiles( pBEConfig,
+ IsDlgButtonChecked( hDlg, IDD_RSET_REGISTRY ) ) ;
+
+ mwpStatus->wDlgStatus = FALSE;
+
+ WM_UnhookTimer( mwpStatus->timer_handle );
+ PD_SetFrequency( mwpStatus->poll_drive_freq );
+#ifdef OEM_EMS
+ wThumbPosition = mwpStatus->BSD_index ;
+ switch ( ConfirmXchgBsdServers( &wThumbPosition ) ) {
+
+ case EMS_SERVER_NOT_FOUND :
+
+ mwpStatus->BSD_index = wThumbPosition ;
+ RestoreSetRetrieve( hDlg, pCurMode );
+
+ SetScrollPos( hDlg, SB_CTL, (INT)wThumbPosition, TRUE );
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSSERVERINVALID),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DEST_NAME ) );
+
+ return( TRUE );
+
+
+ case EMS_NO_WIPE_IF_NOT_BOTH :
+
+ mwpStatus->BSD_index = wThumbPosition ;
+ RestoreSetRetrieve( hDlg, pCurMode );
+
+ SetScrollPos( hDlg, SB_CTL, (INT)wThumbPosition, TRUE );
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSNOWIPE),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_WIPE_DATA ) );
+
+ return( TRUE );
+
+ case EMS_MUST_WIPE_TO_ALT:
+
+ mwpStatus->BSD_index = wThumbPosition ;
+ RestoreSetRetrieve( hDlg, pCurMode );
+
+ SetScrollPos( hDlg, SB_CTL, (INT)wThumbPosition, TRUE );
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSMUSTWIPE),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_WIPE_DATA ) );
+
+ return( TRUE );
+ case EMS_XCHG_FOUND:
+ mwpStatus->BSD_index = wThumbPosition ;
+ RestoreSetRetrieve( hDlg, pCurMode );
+
+ if( WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_RESTOREEMSWARNING),
+ WMMB_OKCANCEL, WMMB_ICONEXCLAMATION ) == WMMB_IDCANCEL ) {
+
+ return( TRUE );
+ }
+ break ;
+
+ case EMS_NO_DEST:
+ mwpStatus->BSD_index = wThumbPosition ;
+ RestoreSetRetrieve( hDlg, pCurMode );
+
+ SetScrollPos( hDlg, SB_CTL, (INT)wThumbPosition, TRUE );
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_EMS_NO_DEST_DRIVE),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_DEST_NAME ) );
+
+ return( TRUE );
+
+ case EMS_NO_STORE:
+
+ mwpStatus->BSD_index = wThumbPosition ;
+ RestoreSetRetrieve( hDlg, pCurMode );
+
+ SetScrollPos( hDlg, SB_CTL, (INT)wThumbPosition, TRUE );
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE), ID(IDS_EMS_MUST_PUB_OR_PRI),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ SEND_EM_SETSEL_MSG (hDlg, IDD_RSET_DEST_NAME, 0, 32767);
+ SetFocus( GetDlgItem( hDlg, IDD_RSET_PUB_IS ) );
+
+ return( TRUE );
+ }
+
+#endif
+
+ EndDialog( hDlg, TRUE ); /* Exits the dialog box */
+ return ( TRUE );
+
+
+ case IDD_RSET_HELP_BUTTON:
+ case IDHELP :
+
+#ifndef OEM_EMS
+ if (mwpStatus->fMode == RESTORE_MODE ) {
+ HM_DialogHelp( HELPID_DIALOGRESTORESET );
+ } else {
+ HM_DialogHelp( HELPID_DIALOGVERIFYSET );
+ }
+#else
+ help_id = DM_ModeGetHelpId( pCurMode );
+ HM_DialogHelp( help_id );
+#endif
+
+ return( TRUE );
+
+# ifdef OEM_MSOFT //special feature
+
+ case IDD_RSET_LOG_BROWSE: //Log file browse button
+
+ {
+ CHAR szFile[ BROWSE_MAXPATH ] = TEXT("");
+
+ GetDlgItemText ( hDlg, IDD_RSET_LOG_FILENAME, szFile, BROWSE_MAXPATH );
+
+ if ( DM_BrowseForLogFilePath ( hDlg, ghInst, szFile, strlen ( szFile ) ) ) {
+
+ SetDlgItemText ( hDlg, IDD_RSET_LOG_FILENAME, szFile );
+ SetFocus ( GetDlgItem ( hDlg, IDD_RSET_LOG_FILENAME ) );
+ }
+ }
+
+ break;
+
+# endif //OEM_MSOFT //special feature
+
+ case IDD_RSET_BROWSE_BUTTON:
+ {
+ CHAR szPath[ BROWSE_MAXPATH ];
+ CHAR szDrive[ BROWSE_MAXPATH ];
+ DWORD dwErr;
+
+ GetDlgItemText( hDlg, IDD_RSET_RESTORE_PATH,
+ szPath, BROWSE_MAXPATH );
+
+ hComboWnd = GetDlgItem(hDlg, IDD_RSET_DRIVE_BOX);
+
+ wIndex = (WORD)SendMessage(hComboWnd,
+ CB_GETCURSEL,
+ 0,
+ 0L);
+ SendDlgItemMessage(hDlg,
+ IDD_RSET_DRIVE_BOX,
+ CB_GETLBTEXT,
+ wIndex,
+ (MP2)szDrive);
+ szDrive [2] = TEXT ('\0');
+
+ // If no path is specified, but a drive is selected...
+
+ if ( !szPath[ 0 ] && szDrive[ 0 ] ) {
+
+ // Get the current directory of the selected drive
+
+ _getdcwd ( ( toupper( szDrive[ 0 ] ) - TEXT('A') + 1), szPath, BROWSE_MAXPATH );
+ }
+
+ // else, use the current drive and path by default
+
+ EnableWindow ( hDlg, FALSE );
+
+ if ( DM_GetBrowsePath ( hDlg, ghInst, szPath, BROWSE_MAXPATH ) ) {
+
+ LPSTR psz = szPath;
+
+ //Note: Would it be safer for NT to use _splitpath()
+ // and _makepath() rather than just stripping
+ // the drive specifier out like this ?NTKLUG?
+
+ if ( strlen ( szPath ) >= BROWSE_MAXDRIVE-1 && szPath[ 1 ] == TEXT(':') ) {
+
+ // Strip the drive specifier out of the path and
+ // place it in a seperate buffer.
+
+ psz = &szPath[ 2 ]; //point to the path sans drive
+ strncpy ( szDrive, szPath, BROWSE_MAXDRIVE-1 );
+ szDrive[ BROWSE_MAXDRIVE-1 ] = TEXT('\0');
+
+ // perform a refresh just in case user connected to a
+ // network drive
+
+ VLM_Refresh ();
+
+ /* get the drive list */
+ GetCurrentRestoreDriveList( hDlg );
+
+ // Find this drive entry in the Drives combobox
+ // and make it the current selected item.
+ SendDlgItemMessage ( hDlg,
+ IDD_RSET_DRIVE_BOX,
+ CB_SELECTSTRING,
+ (MP1) -1,
+ (MP2) szDrive );
+ }
+
+ //place the selected path in the restore path edit field
+ SetDlgItemText( hDlg, IDD_RSET_RESTORE_PATH, psz );
+ }
+ else if ( dwErr = CommDlgExtendedError () ) {
+
+ dwErr;// NTKLUG : if an error occurred handle it here
+ }
+
+ EnableWindow ( hDlg, TRUE );
+ SetFocus ( GetDlgItem ( hDlg, IDD_RSET_RESTORE_PATH ) );
+
+ return TRUE;
+ }
+
+ default:
+
+ return FALSE;
+
+ } /* end switch for Command ID */
+
+ } /* end WM_COMMAND case */
+
+ break;
+
+ case WM_SETCURSOR:
+
+ if ( WM_SetCursor ( hDlg ) ) {
+ return 1;
+ }
+
+ break;
+
+ default:
+
+ return FALSE; /* Didn't process a message */
+ }
+
+ return TRUE;
+}
+
+/***************************************************
+
+ Name: RestoreSetSave
+
+ Description: Save the current BSDs information
+
+ Returns:
+
+*****************************************************/
+BOOL RestoreSetSave(
+
+HWND hDlg ) /* window handle of the dialog box */
+
+{
+ INT nButtonState;
+ CHAR szTargetPath[ MAX_UI_PATH_SIZE ];
+ BSD_PTR pBSD;
+ BSD_PTR bsd_ptr ;
+ CDS_PTR pCDS;
+ BE_CFG_PTR pBEConfig;
+
+ /******************************************************** */
+ /* Retrieve the current BSD data */
+ /******************************************************** */
+
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ pCDS = CDS_GetCopy();
+ pBEConfig = BSD_GetConfigData( pBSD );
+
+
+ switch ( BSD_GetOsId( pBSD ) ){
+
+ case FS_EMS_MDB_ID:
+ case FS_EMS_DSA_ID:
+
+ nButtonState = 0;
+
+ nButtonState |= (IsDlgButtonChecked( hDlg, IDD_RSET_PRIV_IS )) ? BEC_EMS_PRIVATE:0;
+ nButtonState |= (IsDlgButtonChecked( hDlg, IDD_RSET_PUB_IS )) ? BEC_EMS_PUBLIC:0;
+
+ BEC_SetEmsPubPri( pBEConfig, nButtonState );
+
+ BEC_SetEmsRipKick( pBEConfig, FALSE );
+
+ if ( BSD_GetOsId( pBSD ) == FS_EMS_DSA_ID ) {
+ GetDlgItemText( hDlg, IDD_RSET_DSA_DEST_NAME, (CHAR_PTR)szTargetPath, MAX_UI_PATH_LEN );
+ } else {
+ GetDlgItemText( hDlg, IDD_RSET_DEST_NAME, (CHAR_PTR)szTargetPath, MAX_UI_PATH_LEN );
+ }
+
+ if ( BSD_GetOsId(pBSD) == FS_EMS_MDB_ID ) {
+ CHAR_PTR vol_name ;
+
+ vol_name = calloc( strsize( szTargetPath ), 1 ) ;
+ if ( vol_name ) {
+ strcpy( vol_name, szTargetPath ) ;
+
+ free( BSD_GetLogicalSourceDevice( pBSD ) ) ;
+
+ BSD_SetLogicalSourceDevice( pBSD, vol_name ) ;
+ }
+ }
+
+ if ( !IsDlgButtonChecked( hDlg, IDD_RSET_WIPE_DATA ) ) {
+ BEC_SetEmsWipeClean( pBEConfig, FALSE );
+ } else {
+ BEC_SetEmsWipeClean( pBEConfig, TRUE );
+ }
+
+ if ( !IsDlgButtonChecked( hDlg, IDD_RSET_START_EMS ) ) {
+ BEC_SetEmsRipKick( pBEConfig, FALSE );
+ } else {
+ BEC_SetEmsRipKick( pBEConfig, TRUE );
+ }
+
+ // copy the dest and start bit to every BSD with the same
+ // source.
+
+ bsd_ptr = BSD_GetFirst( tape_bsd_list );
+ while (bsd_ptr ) {
+ CHAR_PTR dest_name ;
+ CHAR_PTR dest_name1 ;
+ CHAR_PTR new_dest_name ;
+ CHAR_PTR src_name ;
+ CHAR_PTR src_name1 ;
+ BOOLEAN kick_it ;
+
+ src_name = BSD_GetVolumeLabel( pBSD ) ;
+ src_name1 = BSD_GetVolumeLabel( bsd_ptr ) ;
+
+ if ( (bsd_ptr != pBSD ) &&
+ (BSD_GetOsId( bsd_ptr ) == FS_EMS_MDB_ID ) &&
+ src_name1 && src_name &&
+ !stricmp( src_name1, src_name) ) {
+
+ dest_name = BSD_GetLogicalSourceDevice( pBSD ) ;
+ if (dest_name && (*dest_name != TEXT('\0') ) ) {
+
+ new_dest_name = calloc( strsize( dest_name ), 1 ) ;
+ strcpy( new_dest_name, dest_name ) ;
+
+ dest_name = BSD_GetLogicalSourceDevice( bsd_ptr ) ;
+ free( dest_name ) ;
+ BSD_SetLogicalSourceDevice( bsd_ptr, new_dest_name ) ;
+ }
+
+ }
+
+ dest_name = BSD_GetLogicalSourceDevice( pBSD ) ;
+ if ( ( dest_name== NULL ) || (*dest_name == TEXT('\0') ) ) {
+ dest_name = src_name ;
+ }
+ dest_name1 = BSD_GetLogicalSourceDevice( bsd_ptr ) ;
+ if ( ( dest_name1== NULL ) || (*dest_name1 == TEXT('\0') ) ) {
+ dest_name1 = src_name1 ;
+ }
+
+ if ( dest_name1 && dest_name &&
+ !stricmp( dest_name1, dest_name) ) {
+
+ kick_it = BEC_GetEmsRipKick(pBEConfig) ;
+ BEC_SetEmsRipKick( BSD_GetConfigData( bsd_ptr ) , kick_it ) ;
+
+ }
+
+ bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+ }
+
+ break;
+
+ default:
+
+ /* Get the path and make sure it's valid. If it isn't, let him try again. */
+
+ GetDlgItemText( hDlg, IDD_RSET_RESTORE_PATH, (CHAR_PTR)szTargetPath, MAX_UI_PATH_LEN );
+
+ if ( !VLM_ValidatePath( szTargetPath, FALSE, TRUE ) ) {
+
+ return( FALSE ) ; // the path was not valid
+ }
+
+ SetTargetPath( pBSD, szTargetPath );
+
+ // if the mode is restore - save the state of the bindery flag
+
+ if ( mwpStatus->fMode == RESTORE_MODE ) {
+
+ /* save the state of the bindery flag */
+ /* if backup bindery allowed, save the bindery flay for this BSD */
+
+ if ( DLE_HasFeatures( BSD_GetDLE( pBSD ),
+ DLE_FEAT_REST_SPECIAL_FILES ) ) {
+
+# if defined ( OS_WIN32 ) //unsupported feature
+ nButtonState = IsDlgButtonChecked( hDlg, IDD_RSET_REGISTRY );
+ BSD_SetProcSpecialFlg( pBSD, (INT16)nButtonState );
+ BEC_SetProcSpecialFiles( pBEConfig, nButtonState );
+ UI_AddSpecialIncOrExc( pBSD, nButtonState ) ;
+# else
+ nButtonState = IsDlgButtonChecked( hDlg, IDD_RSET_BINDERY );
+ BSD_SetProcSpecialFlg( pBSD, (INT16)nButtonState );
+ BEC_SetProcSpecialFiles( pBEConfig, nButtonState );
+# endif
+ }
+
+ /* if restore security information allowed, save the flay for this BSD */
+ if ( FS_PromptForSecure( BSD_GetDLE( pBSD ) ) ) {
+
+ nButtonState = IsDlgButtonChecked( hDlg, IDD_RSET_SECURITY_INFO );
+ BEC_SetRestoreSecurity( pBEConfig, nButtonState );
+ BSD_SetProcElemOnlyFlg( pBSD, !nButtonState ) ;
+ } else {
+ BEC_SetRestoreSecurity( pBEConfig, FALSE );
+ BSD_SetProcElemOnlyFlg( pBSD, TRUE ) ;
+ }
+ }
+# ifdef OS_WIN32
+ BSD_SetProcElemOnlyFlg( pBSD, FALSE ) ;
+# endif
+ // save the target drive
+
+ SetRestoreDrive( hDlg );
+
+ break;
+
+ } // switch ( BSD_GetOsId( pBSD ) )
+
+ return( TRUE );
+}
+/***************************************************
+
+ Name: RestoreSetRetrieve
+
+ Description: Retrieve this BSDs information
+
+ Returns:
+
+*****************************************************/
+VOID RestoreSetRetrieve (
+#ifndef OEM_EMS
+ HWND hDlg ) /* window handle of the dialog box */
+#else
+ HWND hDlg,
+ DLG_MODE * pModeTable )
+#endif
+
+{
+ INT16 nStatus;
+ UINT32 unTapeID;
+ INT16 nTapeSetNum;
+ CHAR_PTR pszTemp;
+ CHAR szBuffer1[ 80 ];
+ CHAR szBuffer2[ 80 ];
+ CHAR szTime[ 20 ];
+ CHAR szDate[ 20 ];
+ BSD_PTR pBSD;
+ CDS_PTR pCDS;
+ BE_CFG_PTR pBEConfig;
+#ifdef OEM_EMS
+ GENERIC_DLE_PTR pDLE;
+ INT16 nButtonState;
+#endif // OEM_EMS
+ INT16 nTapeType;
+ INT16 nTapeDate;
+ INT16 nTapeTime;
+ CHAR szTargetPath[ MAX_UI_PATH_SIZE ];
+ CHAR szTempBuf[ MAX_UI_RESOURCE_SIZE ];
+
+
+ /******************************************************** */
+ /* Set the current BSD data */
+ /******************************************************** */
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ pCDS = CDS_GetCopy();
+ pBEConfig = BSD_GetConfigData( pBSD );
+#ifdef OEM_EMS
+ pDLE = BSD_GetDLE( pBSD );
+#endif
+
+ pszTemp = (LPSTR)BSD_GetBackupDescript( pBSD );
+ SetDlgItemText( hDlg, IDD_RSET_SET_LINE_1, pszTemp );
+
+ /* display the default tape name */
+ pszTemp = (LPSTR)BSD_GetTapeLabel( pBSD );
+ SetDlgItemText( hDlg, IDD_RSET_TAPE_NAME, pszTemp );
+
+
+ switch ( BSD_GetOsId ( pBSD ) ) {
+
+#ifdef OEM_EMS
+ case FS_EMS_MDB_ID:
+ case FS_EMS_DSA_ID:
+
+ nButtonState = BEC_GetEmsPubPri( pBEConfig );
+
+ if ( BEC_EMS_PRIVATE & nButtonState ) {
+ CheckDlgButton( hDlg, IDD_RSET_PRIV_IS, TRUE );
+ } else {
+ CheckDlgButton( hDlg, IDD_RSET_PRIV_IS, FALSE);
+ }
+
+ if ( BEC_EMS_PUBLIC & nButtonState ) {
+ CheckDlgButton( hDlg, IDD_RSET_PUB_IS, TRUE );
+ } else {
+ CheckDlgButton( hDlg, IDD_RSET_PUB_IS, FALSE );
+ }
+
+
+ if ( BEC_GetEmsWipeClean( pBEConfig ) ) {
+ CheckDlgButton( hDlg, IDD_RSET_WIPE_DATA, TRUE );
+
+ } else {
+ CheckDlgButton( hDlg, IDD_RSET_WIPE_DATA, FALSE );
+ }
+
+ if ( BEC_GetEmsRipKick( pBEConfig ) ) {
+ CheckDlgButton( hDlg, IDD_RSET_START_EMS, TRUE );
+
+ } else {
+ CheckDlgButton( hDlg, IDD_RSET_START_EMS, FALSE );
+ }
+
+ if ( ( BSD_GetOsId(pBSD) == FS_EMS_MDB_ID ) &&
+ ( BSD_GetLogicalSourceDevice( pBSD ) == NULL ) ) {
+
+ CHAR_PTR vol_name ;
+
+ vol_name = calloc( sizeof(CHAR),1 ) ;
+ BSD_SetLogicalSourceDevice( pBSD, vol_name ) ;
+
+ }
+
+ SetDlgItemText( hDlg, IDD_RSET_DEST_NAME, BSD_GetLogicalSourceDevice( pBSD ) );
+ SetDlgItemText( hDlg, IDD_RSET_ORG_NAME, BSD_GetVolumeLabel( pBSD ) );
+ SetDlgItemText( hDlg, IDD_RSET_DSA_DEST_NAME, BSD_GetVolumeLabel( pBSD ) );
+
+ break;
+#endif //OEM_EMS
+ default:
+
+ /* get this restore path information */
+ szTargetPath[0] = 0;
+ GetTargetPath( pBSD, szTargetPath );
+ SetDlgItemText( hDlg, IDD_RSET_RESTORE_PATH, (CHAR_PTR)szTargetPath );
+
+ /* if the mode flag is set for a restore then get the Bindery check box */
+ if ( mwpStatus->fMode == RESTORE_MODE ) {
+
+# ifdef OS_WIN32
+ {
+ CheckDlgButton(hDlg, IDD_RSET_REGISTRY, FALSE );
+
+ /* check for backup bindery, enable/disable the control */
+ nStatus = DLE_HasFeatures( BSD_GetDLE( pBSD ),
+ DLE_FEAT_REST_SPECIAL_FILES );
+
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_REGISTRY ), nStatus );
+
+ if ( nStatus ) {
+ /* set the state of the bindery flag */
+ nStatus = BSD_GetProcSpecialFlg( pBSD ) ;
+ CheckDlgButton(hDlg, IDD_RSET_REGISTRY, nStatus );
+ }
+ }
+# endif
+
+ /* check for restore security information, enable/disable the control */
+
+ nStatus = FS_PromptForSecure( BSD_GetDLE( pBSD ) );
+
+ if ( ! nStatus ) {
+ BEC_SetRestoreSecurity( pBEConfig, nStatus );
+ }
+
+ // Turn checkbox off before we disable the window.
+
+ if ( ! nStatus ) {
+ CheckDlgButton(hDlg, IDD_RSET_SECURITY_INFO, nStatus );
+ }
+
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_SECURITY_INFO ), nStatus );
+
+ if ( nStatus ) {
+ /* restore security allowed, get the state of flag */
+ nStatus = BEC_GetRestoreSecurity( pBEConfig );
+ CheckDlgButton(hDlg, IDD_RSET_SECURITY_INFO, nStatus );
+ }
+
+ }
+
+ /* get the current drive selected */
+ GetRestoreDrive ( hDlg );
+
+ break;
+
+ } // switch ( BSD_GetOsId ( pBSD ) )
+
+
+ /* add "1 of n" to backup set info title */
+ RSM_StringCopy( IDS_SET_INFORMATION, szBuffer1, 80 );
+ wsprintf( szBuffer2, szBuffer1,mwpStatus->BSD_index + 1, mwpStatus->max_BSD_index + 1 );
+ SetDlgItemText( hDlg, IDD_RSET_INFO_TITLE, szBuffer2 );
+
+ /* display the backup set name */
+ pszTemp = VLM_GetBsetName( BSD_GetTapeID( pBSD ), BSD_GetSetNum( pBSD ) );
+
+ if ( !strlen( pszTemp ) ) {
+ RSM_StringCopy( IDS_NO_BSET_NAME, szBuffer1, 80 );
+ pszTemp = szBuffer1;
+ }
+ SetDlgItemText( hDlg, IDD_RSET_SET_LINE_1, pszTemp );
+
+ unTapeID = BSD_GetTapeID( pBSD );
+ nTapeSetNum = BSD_GetSetNum( pBSD );
+
+ /* get the backup method */
+ nTapeType = VLM_GetBackupType( unTapeID, nTapeSetNum );
+
+ switch( nTapeType ) {
+
+ case QTC_NORM_BACKUP:
+ RSM_StringCopy( IDS_METHOD_NORMAL, szBuffer1, 80 );
+ break;
+ case QTC_COPY_BACKUP:
+ RSM_StringCopy( IDS_METHOD_COPY, szBuffer1, 80 );
+ break;
+ case QTC_DIFF_BACKUP:
+ RSM_StringCopy( IDS_METHOD_DIFFERENTIAL, szBuffer1, 80 );
+ BEC_SetEmsWipeClean( pBEConfig, FALSE );
+ BEC_SetEmsPubPri( pBEConfig, BEC_EMS_PUBLIC | BEC_EMS_PRIVATE );
+ break;
+ case QTC_INCR_BACKUP:
+ RSM_StringCopy( IDS_METHOD_INCREMENTAL, szBuffer1, 80 );
+ BEC_SetEmsWipeClean( pBEConfig, FALSE );
+ BEC_SetEmsPubPri( pBEConfig, BEC_EMS_PUBLIC | BEC_EMS_PRIVATE );
+ break;
+
+ }
+
+ /* get the volume name */
+ pszTemp = VLM_GetVolumeName( unTapeID, nTapeSetNum );
+
+ /* get the backup date */
+ nTapeDate = VLM_GetBackupDate( unTapeID, nTapeSetNum );
+
+ /* get the backup time */
+ nTapeTime = VLM_GetBackupTime( unTapeID, nTapeSetNum );
+
+ /* convert date & time to international form */
+ UI_IntToTime( szTime, nTapeTime );
+ UI_IntToDate( szDate, nTapeDate );
+
+ /* display the backup set description information */
+
+//??????? inconsistant
+# if defined ( OEM_MSOFT ) //alternate feature
+ {
+ RSM_Sprintf ( szTempBuf,
+ ID(RES_RESTORE_DESC_1),
+ szBuffer1,
+ pszTemp,
+ szDate,
+ szTime,
+ BSD_GetUserName ( pBSD )
+ );
+
+// yresprintf( (INT16) RES_RESTORE_DESC_1,
+// szBuffer1,
+// pszTemp,
+// szDate,
+// szTime,
+// BSD_GetUserName ( pBSD ) );
+ }
+# else // if defined ( OEM_MSOFT ) //alternate feature
+ {
+
+ RSM_Sprintf ( szTempBuf,
+ ID(RES_RESTORE_DESC_1),
+ szBuffer1,
+ pszTemp,
+ szDate,
+ szTime
+ );
+
+// yresprintf( RES_RESTORE_DESC_1,
+// szBuffer1,
+// pszTemp,
+// szDate,
+// szTime );
+ }
+# endif //defined ( OEM_MSOFT ) //alternate feature
+
+ SetDlgItemText( hDlg, IDD_RSET_SET_LINE_2, szTempBuf );
+
+
+#ifdef OEM_MSOFT
+
+
+ VLM_GetSetCreationDate( unTapeID, nTapeSetNum, &nTapeDate, &nTapeTime );
+
+ UI_IntToTime ( szTime, nTapeTime );
+ UI_IntToDate ( szDate, nTapeDate );
+
+ strcpy ( szTempBuf, szDate );
+ strcat ( szTempBuf, TEXT(" ") );
+ strcat ( szTempBuf, szTime );
+
+ SetDlgItemText ( hDlg, IDD_RSET_CREATION_DATE, szTempBuf );
+
+ VLM_GetSetOwnersName( unTapeID, nTapeSetNum, szTempBuf );
+
+ SetDlgItemText ( hDlg, IDD_RSET_OWNERS_NAME, szTempBuf );
+
+#endif
+
+
+#ifdef OEM_EMS
+ DM_DispShowControls( hDlg, pModeTable, BSD_GetOsId( pBSD ) );
+#endif
+
+ nTapeType = VLM_GetBackupType( unTapeID, nTapeSetNum );
+
+ switch( nTapeType ) {
+
+ case QTC_NORM_BACKUP:
+ case QTC_COPY_BACKUP:
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_PUB_IS ), TRUE );
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_PRIV_IS ), TRUE );
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_WIPE_DATA ), TRUE );
+ break;
+ case QTC_DIFF_BACKUP:
+ case QTC_INCR_BACKUP:
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_PUB_IS ), FALSE );
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_PRIV_IS ), FALSE );
+ EnableWindow( GetDlgItem( hDlg, IDD_RSET_WIPE_DATA ), FALSE );
+ break;
+
+ }
+
+
+// pszTemp = BSD_GetLogicalSourceDevice( pBSD ) ;
+// if ( (BSD_GetOsId( pBSD )== FS_EMS_MDB_ID ) &&
+// ( ( pszTemp == NULL ) ||
+// ( *pszTemp == TEXT('\0') ) ) ) {
+//
+// EnableWindow( GetDlgItem( hDlg, IDD_RSET_START_EMS ), FALSE );
+// } else {
+// EnableWindow( GetDlgItem( hDlg, IDD_RSET_START_EMS ), TRUE );
+// }
+//
+
+}
+/***************************************************
+
+ Name: GetMaxBSDCount
+
+ Description: Get the max number of BSD's for this operation
+
+ Returns: max BSD count
+
+*****************************************************/
+INT GetMaxBSDCount( VOID )
+{
+ BSD_PTR pBSD;
+ INT nBSDCounter;
+
+ nBSDCounter = 0;
+ pBSD = BSD_GetFirst( tape_bsd_list );
+
+ while ( pBSD != NULL ) {
+
+ nBSDCounter++;
+ pBSD = BSD_GetNext( pBSD );
+ }
+ return( --nBSDCounter );
+}
+/***************************************************
+
+ Name: GetTapeBSDPointer
+
+ Description: Return the current BSD pointer
+
+ Returns: Returns a pointer to the requested BSD
+
+*****************************************************/
+BSD_PTR GetTapeBSDPointer(
+INT index )
+{
+ BSD_PTR pBSD;
+
+ if ( !index )
+ pBSD = BSD_GetFirst( tape_bsd_list );
+ else {
+
+ pBSD = BSD_GetFirst( tape_bsd_list );
+ index--;
+ do
+ pBSD = BSD_GetNext( pBSD );
+ while ( index-- );
+ }
+ return( pBSD );
+}
+/***************************************************
+
+ Name: GetCurrentRestoreDriveList
+
+ Description:
+
+ Returns: void
+
+*****************************************************/
+VOID GetCurrentRestoreDriveList (
+
+HWND hDlg ) /* window handle of the dialog box */
+
+{
+ VLM_OBJECT_PTR pVLM;
+ CHAR szTempBuf[80];
+ VOID_PTR pServerList = NULL;
+ VOID_PTR pDriverList = NULL;
+ PDS_WMINFO pWinInfo;
+ WORD wListBoxCount;
+ LONG ListIndex;
+ GENERIC_DLE_PTR pDLE;
+
+# if !defined ( OEM_MSOFT ) // unused variable
+ BOOL bIsGrayed;
+ VLM_OBJECT_PTR pServerVLM;
+# endif // unused variable
+
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_RESETCONTENT, (MPARAM1)0, (MPARAM2) 0 ) ;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ if ( gb_servers_win != (HWND)NULL ) {
+
+ pWinInfo = WM_GetInfoPtr( gb_servers_win );
+ pServerList = pWinInfo->pTreeList;
+ pServerVLM = VLM_GetFirstVLM( (Q_HEADER_PTR) pServerList );
+
+ while ( pServerVLM != NULL ) {
+
+ pVLM = VLM_GetFirstVLM ( &pServerVLM->children );
+
+ while ( pVLM != NULL ) {
+
+ sprintf ( szTempBuf, TEXT("%s"), pVLM->name );
+
+ ListIndex = SendDlgItemMessage(hDlg,
+ IDD_RSET_DRIVE_BOX,
+ CB_ADDSTRING,
+ (MP1)0,
+ (MP2)szTempBuf );
+ DLE_FindByName(dle_list,
+ pVLM->name,
+ (INT16)-1,
+ &pDLE);
+ if (DLE_DriveWriteable(pDLE) == FALSE)
+ {
+ bIsGrayed = TRUE;
+ } else
+ {
+ bIsGrayed = FALSE;
+ }
+ SendDlgItemMessage(hDlg,
+ IDD_RSET_DRIVE_BOX,
+ CB_SETITEMDATA,
+ ListIndex,
+ (MP2)bIsGrayed);
+
+ pVLM = VLM_GetNextVLM ( pVLM );
+ }
+
+ pServerVLM = VLM_GetNextVLM ( pServerVLM );
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+
+ if ( gb_disks_win != (HWND)NULL ) {
+
+ pWinInfo = WM_GetInfoPtr( gb_disks_win );
+ pDriverList = pWinInfo->pFlatList;
+ pVLM = VLM_GetFirstVLM( (Q_HEADER_PTR) pDriverList );
+
+ while ( pVLM != NULL ) {
+
+ if ( strlen ( pVLM->label ) ) {
+ sprintf ( szTempBuf, TEXT("%s [%s]"), pVLM->name, pVLM->label );
+ }
+ else {
+ strcpy ( szTempBuf, pVLM->name );
+ }
+
+ DLE_FindByName(dle_list,
+ pVLM->name,
+ (INT16)-1,
+ &pDLE);
+ if (DLE_DriveWriteable(pDLE) )
+ {
+ ListIndex = SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_ADDSTRING, (MP1)0, (MP2)szTempBuf );
+ SendDlgItemMessage(hDlg,
+ IDD_RSET_DRIVE_BOX,
+ CB_SETITEMDATA,
+ ListIndex,
+ (MP2)FALSE);
+
+ }
+
+ pVLM = VLM_GetNextVLM ( pVLM );
+ }
+ }
+
+ wListBoxCount = (WORD)SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETCOUNT, 0, (MP2) 0 );
+
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_SETCURSEL, wListBoxCount - 1, (MP2) 0 );
+
+}
+/***************************************************
+
+ Name: SetRestoreDrive
+
+ Description:
+
+ Returns: void
+
+*****************************************************/
+VOID SetRestoreDrive(
+
+HWND hDlg ) /* window handle of the dialog box */
+
+{
+ WORD wListboxIndex;
+ BSD_PTR pBSD;
+ CHAR szTempBuf[80];
+ CHAR szTempBuf2[80];
+ CHAR_PTR pszTemp;
+ BOOL fDone = FALSE;
+ VLM_OBJECT_PTR pVLM;
+ VOID_PTR pServerList = NULL;
+ VOID_PTR pDriverList = NULL;
+ PDS_WMINFO pWinInfo;
+ GENERIC_DLE_PTR pDLE;
+
+# if !defined ( OEM_MSOFT ) // unused variable
+ VLM_OBJECT_PTR pServerVLM;
+ CHAR_PTR pszDriveName;
+# endif // unused variable
+
+
+ wListboxIndex = (WORD)SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETCURSEL, 0, (MP2) 0 );
+
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETLBTEXT, wListboxIndex, (MP2) szTempBuf2 );
+
+ pszTemp = szTempBuf2;
+
+ if ( gb_disks_win != (HWND)NULL ) {
+
+ pWinInfo = WM_GetInfoPtr( gb_disks_win );
+ pDriverList = pWinInfo->pFlatList;
+ pVLM = VLM_GetFirstVLM( (Q_HEADER_PTR) pDriverList );
+
+ while ( pVLM != NULL ) {
+
+ if ( strlen ( pVLM->label ) ) {
+ sprintf ( szTempBuf, TEXT("%s [%s]"), pVLM->name, pVLM->label );
+ }
+ else {
+ strcpy ( szTempBuf, pVLM->name );
+ }
+
+
+ if ( ! stricmp( szTempBuf, pszTemp ) ) {
+ break;
+ }
+
+ pVLM = VLM_GetNextVLM( pVLM );
+ }
+ }
+
+ if ( pVLM == NULL ) {
+
+ fDone = FALSE;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ if ( gb_servers_win != (HWND)NULL ) {
+
+ pWinInfo = WM_GetInfoPtr ( gb_servers_win );
+ pServerList = pWinInfo->pTreeList;
+ pServerVLM = VLM_GetFirstVLM ( (Q_HEADER_PTR) pServerList );
+
+ while ( pServerVLM != NULL && !fDone) {
+
+ pVLM = VLM_GetFirstVLM ( &pServerVLM->children );
+
+ while ( pVLM != NULL && !fDone ) {
+
+ pszDriveName = pVLM->name;
+
+ if ( ! stricmp( pszDriveName, pszTemp ) ) {
+ fDone = TRUE;
+ }
+ else {
+ pVLM = VLM_GetNextVLM ( pVLM );
+ }
+ }
+
+ pServerVLM = VLM_GetNextVLM ( pServerVLM );
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+ }
+
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+
+ if ( ! pVLM ) {
+ pVLM = VLM_GetFirstVLM( (Q_HEADER_PTR) pDriverList );
+ }
+
+ /* if we found a VLM for this selection, set the BSD's DLE */
+ if ( pVLM ) {
+
+ DLE_FindByName( dle_list, pVLM->name, (INT16) -1, &pDLE );
+ BSD_SetDLE( pBSD, pDLE );
+ BSD_SetTHW( pBSD, thw_list );
+ }
+
+}
+/***************************************************
+
+ Name: GetRestoreDrive
+
+ Description:
+
+ Returns: void
+
+*****************************************************/
+VOID GetRestoreDrive(
+
+HWND hDlg ) /* window handle of the dialog box */
+
+{
+ WORD wListboxIndex;
+ WORD wMaxListboxIndex;
+ BSD_PTR pBSD;
+ CHAR szBuffer1[80];
+ CHAR szBuffer2[80];
+ CHAR_PTR pszTemp;
+ GENERIC_DLE_PTR pDLE;
+ CHAR_PTR pszDriveName;
+ INT nSize;
+
+
+ wListboxIndex = 0;
+ wMaxListboxIndex = (WORD)SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETCOUNT, 0, (MP2) 0 );
+
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ pDLE = BSD_GetDLE( pBSD );
+
+ /* if device name has been set, retrieve it */
+ if ( pDLE ) {
+
+ /* get the current selected name */
+ pszDriveName = DLE_GetDeviceName( pDLE );
+ nSize = strlen( pszDriveName );
+
+ while ( wListboxIndex <= wMaxListboxIndex ) {
+
+ pszTemp = szBuffer1;
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETLBTEXT, wListboxIndex,(MP2) pszTemp );
+ if ( !strnicmp( pszDriveName, pszTemp, nSize ) ) {
+
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_SETCURSEL, wListboxIndex, (MP2) 0 );
+ break;
+ }
+ wListboxIndex++;
+ }
+ }
+ else { /* show the default drive from the tape */
+
+ pszTemp = VLM_GetVolumeName( BSD_GetTapeID( pBSD), BSD_GetSetNum( pBSD ) );
+ strcpy( szBuffer2, pszTemp );
+ szBuffer2[2] = 0;
+ nSize = strlen( szBuffer2 );
+ while ( wListboxIndex <= wMaxListboxIndex ) {
+
+ pszTemp = szBuffer1;
+ pszDriveName = szBuffer2;
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETLBTEXT, wListboxIndex,(MP2) pszTemp );
+ if ( !strnicmp( pszDriveName, pszTemp, nSize ) ) {
+
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_SETCURSEL, wListboxIndex, (MP2) 0 );
+ break;
+ }
+ wListboxIndex++;
+ }
+ }
+}
+/***************************************************
+
+ Name: SetTargetPath
+
+ Description:
+
+ Returns: void
+
+*****************************************************/
+static VOID SetTargetPath (
+BSD_PTR pBSD,
+CHAR_PTR p )
+{
+ CHAR szBuffer1[ MAX_UI_PATH_SIZE ];
+ CHAR_PTR p1;
+ CHAR_PTR p2;
+ INT16 nSize1;
+ INT16 nSize2;
+
+ nSize1 = (INT16) strlen( p ) ;
+
+ if ( nSize1 ) {
+ strcpy( szBuffer1, p ) ;
+
+
+ p1 = szBuffer1;
+
+ while ( *p1 == TEXT(' ') ) /* remove leading spaces */
+ *p1++;
+
+ if ( *p1 == 0x5c || *p1 == TEXT(':')) /* remove leading '\' or TEXT(':') CHAR */
+ *p1++;
+
+ p2 = p1; /* start of the path name */
+
+ nSize1 = 0;
+ while ( *p2 ) { /* find end of line */
+ *p2++;
+ nSize1++ ;
+ }
+
+ /* don't remove leading '\' */
+ if ( nSize1 > 1 ) {
+
+ *p2--;
+ if ( *p2 == 0x5c || *p2 == TEXT(':') ) /* remove ending '\' or TEXT(':') character */
+ *p2 = 0 ;
+
+ }
+
+ p2 = p1; /* save the start of the path name for a later compare */
+
+ nSize1 = 0;
+
+ /* change any '\' or ':' characters to '0' */
+ while ( *p1 ) {
+
+ if ( *p1 == 0x5c || *p1 == TEXT(':'))
+ *p1 = 0;
+
+ nSize1++;
+ *p1++;
+ }
+
+ nSize1++; /* count the ending zero */
+ nSize1 *= sizeof (CHAR); /* cvt to byte count */
+
+ BSD_GetTargetInfo( pBSD, (INT8_PTR *)&p1, &nSize2 );
+
+ /* if the sizes are the same, compare the path strings */
+ if ( nSize1 == nSize2 ) {
+
+ if ( memcmp( p2, p1, nSize2) ) {
+
+ /* the strings are different, save the string */
+ BSD_SetTargetInfo( pBSD, (INT8_PTR)p2, nSize1 ) ;
+ }
+ }
+ else {
+
+ /* the sizes are different, so the strings must be different */
+ BSD_SetTargetInfo( pBSD, (INT8_PTR)p2, nSize1 ) ;
+ }
+
+ } else { // the user wants a blank path, so give it to him
+
+ BSD_SetTargetInfo( pBSD, NULL, (INT16) NULL ) ;
+ }
+}
+/***************************************************
+
+ Name: GetTargetPath
+
+ Description:
+
+ Returns: void
+
+*****************************************************/
+static VOID GetTargetPath(
+BSD_PTR pBSD ,
+CHAR_PTR p )
+{
+ CHAR szBuffer1[ MAX_UI_PATH_SIZE ];
+ CHAR_PTR p1;
+ INT16 nSize1;
+ INT16 nSize2;
+
+ BSD_GetTargetInfo( pBSD, (INT8_PTR *)&p1, &nSize1 );
+
+ if ( nSize1 ) {
+ nSize2 = nSize1;
+ nSize1 /= sizeof(CHAR) ;
+ szBuffer1[0] = 0x5c;
+ memcpy( &szBuffer1[1], p1, nSize2 );
+
+ p1 = szBuffer1;
+ while ( nSize1-- ) {
+
+ if ( *p1 == 0 )
+ *p1 = 0x5c;
+ *p1++;
+ }
+ *p1++ = 0;
+ memcpy( p, szBuffer1, (nSize2 + sizeof(CHAR) ) );
+ }
+}
+/***************************************************
+
+ Name: SetDefaultDLE
+
+ Description: This functon will set up any default data
+ that is required for the restore/verify operation.
+ It will search the volume list box to find a match for
+ the volume name of the BSD. If a match is found, the
+ BSDs DLE will be set to that volume, else the default
+ drive (C:) will be used.
+
+ Returns: void
+
+*****************************************************/
+VOID SetDefaultDLE (
+
+HWND hDlg ) /* window handle of the dialog box */
+
+{
+ INT16 fRestoreExistingFiles;
+ WORD wDefaultDrive = 0;
+ WORD wListboxIndex;
+ WORD wMaxListboxIndex;
+ WORD nSize;
+ BSD_PTR pBSD;
+ CHAR szBuffer1[280];
+ CHAR szBuffer2[280];
+ CHAR_PTR pszListboxString;
+ CDS_PTR pCDS;
+ BE_CFG_PTR pBEConfig;
+ CHAR_PTR pszVolumeName;
+ CHAR_PTR p;
+
+ mwpStatus->BSD_index = 0;
+
+ wMaxListboxIndex = (WORD)SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETCOUNT, 0, (MP2) 0 );
+
+ pCDS = CDS_GetCopy();
+
+ fRestoreExistingFiles = CDS_GetRestoreExistingFiles( pCDS );
+
+ switch ( fRestoreExistingFiles ) {
+
+ case RESTORE_OVER_EXISTING :
+
+ fRestoreExistingFiles = BEC_REST_OVER_EXIST;
+ break;
+
+ case NO_RESTORE_OVER_EXISTING :
+
+ fRestoreExistingFiles = BEC_PROMPT_REST_OVER_EXIST;
+ break;
+
+ case PROMPT_RESTORE_OVER_EXISTING :
+ case NO_RESTORE_OVER_RECENT :
+ case PROMPT_RESTORE_OVER_RECENT :
+
+ fRestoreExistingFiles = BEC_PROMPT_REST_OVER_EXIST;
+ break;
+
+ default:
+
+ fRestoreExistingFiles = BEC_NO_REST_OVER_EXIST;
+ break;
+ }
+
+
+ /* look for the default drive - the 'C:' drive */
+ szBuffer2[0] = TEXT('C');
+ szBuffer2[1] = TEXT(':');
+ szBuffer2[2] = 0;
+
+ /* buffer is setup for 'C:' */
+ pszVolumeName = szBuffer2;
+ nSize = strlen( szBuffer2 );
+
+ pszListboxString = szBuffer1;
+
+ wListboxIndex = 0;
+ while ( wListboxIndex <= wMaxListboxIndex ) {
+
+ /* read the selection from the list box */
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETLBTEXT, wListboxIndex, (MP2) pszListboxString );
+
+ /* does list box entry match the search name? */
+ if ( !strnicmp( pszVolumeName, pszListboxString, nSize ) ) {
+
+ /* a match was found */
+ wDefaultDrive = wListboxIndex;
+ break;
+ }
+
+ wListboxIndex++;
+ }
+
+ /* try to match a volume name in the list box for each volume name */
+ /* of the BSDs */
+
+ while ( mwpStatus->BSD_index <= mwpStatus->max_BSD_index ) {
+
+ pBSD = GetTapeBSDPointer( mwpStatus->BSD_index );
+ pBEConfig = BSD_GetConfigData( pBSD );
+
+ /* Set the restore extisting files flag for this BSD */
+ BEC_SetExistFlag( pBEConfig, fRestoreExistingFiles );
+
+ /* set the default drive for no match */
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_SETCURSEL, wDefaultDrive, (MP2) 0 );
+
+ /* get the volume name for this BSD */
+ pszVolumeName = VLM_GetVolumeName( BSD_GetTapeID( pBSD), BSD_GetSetNum( pBSD ) );
+ strcpy( szBuffer2, pszVolumeName );
+
+ /* volume name on tape */
+ pszVolumeName = szBuffer2;
+ p = strchr( szBuffer2, TEXT(':') );
+
+ if ( p ) {
+ nSize = (INT16)(( p + 1 ) - pszVolumeName); /* used by the strnicmp call later */
+ }
+ else {
+ nSize = 0;
+ }
+
+ wListboxIndex = 0;
+
+ while ( wListboxIndex <= wMaxListboxIndex ) {
+
+ /* read the volume from the list box for comparison */
+ pszListboxString = szBuffer1;
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_GETLBTEXT, wListboxIndex, (MP2) pszListboxString );
+
+ if ( nSize ) {
+
+ if ( !strnicmp( pszVolumeName, pszListboxString, nSize ) ) {
+
+ SendDlgItemMessage ( hDlg, IDD_RSET_DRIVE_BOX, CB_SETCURSEL, wListboxIndex, (MP2) 0 );
+ break;
+ }
+ }
+
+ wListboxIndex++;
+ }
+
+ /* this function will set up the DLE for this BSD */
+ /* it uses the current selection in the list box for this purpose */
+ SetRestoreDrive( hDlg );
+
+ mwpStatus->BSD_index++;
+ }
+
+ mwpStatus->BSD_index = 0;
+}
+
+/***************************************************
+
+ Name: ScrollLineDown
+
+ Description: decrements the index counter
+
+ Returns: void
+
+*****************************************************/
+static VOID ScrollLineDown( VOID )
+{
+ if ( mwpStatus->BSD_index > 0 )
+ {
+ mwpStatus->BSD_index--;
+ }
+}
+
+/***************************************************
+
+ Name: ScrollLineUp
+
+ Description: increments the index counter
+
+ Returns: void
+
+*****************************************************/
+static VOID ScrollLineUp( VOID )
+{
+ if ( mwpStatus->BSD_index < mwpStatus->max_BSD_index ) {
+
+ mwpStatus->BSD_index++;
+ }
+}
+
+
+
+
+/***************************************************
+
+ Name: SeeIfWeCanSilentlyLogin
+
+ Description:
+
+ The dialog only lets us restore/verify to server volumes that we
+ know about. If we haven't attached we don't know about them. So
+ if we see one that it looks like it should be the one to use and
+ we can attach silently, then do it.
+
+ Returns: void
+
+*****************************************************/
+VOID SeeIfWeCanSilentlyLogin( )
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ BSD_PTR pBSD;
+ VLM_OBJECT_PTR pVLM;
+ FSYS_HAND fsh;
+ GENERIC_DLE_PTR pDLE;
+ WININFO_PTR pWinInfo;
+ CHAR_PTR pszVolumeName;
+
+ // look through tape_bsd_list at every bsd
+ if ( gb_servers_win == (HWND)NULL ) {
+ return;
+ }
+ pWinInfo = WM_GetInfoPtr( gb_servers_win );
+
+ pBSD = BSD_GetFirst( tape_bsd_list );
+
+ while ( pBSD != NULL ) {
+
+ pszVolumeName = VLM_GetVolumeName( BSD_GetTapeID( pBSD), BSD_GetSetNum( pBSD ) );
+
+ pVLM = VLM_GetFirstVLM( (Q_HEADER_PTR)pWinInfo->pTreeList );
+
+ while ( pVLM != NULL ) {
+
+ if ( ! strnicmp( pszVolumeName, pVLM->name, strlen( pVLM->name ) ) ) {
+
+ if ( QueueCount( &pVLM->children ) == 0 ) {
+
+ DLE_FindByName( dle_list, pVLM->name, -1, &pDLE );
+
+ if ( ! UI_AttachDrive( &fsh, pDLE, TRUE ) ) {
+ VLM_AddInServerChildren( pVLM );
+ FS_DetachDLE( fsh );
+ }
+ }
+ }
+
+ pVLM = VLM_GetNextVLM( pVLM );
+ }
+
+ pBSD = BSD_GetNext( pBSD );
+ }
+ }
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+}
+
+/***************************************************
+
+ Name: clock_routine
+
+ Description: poll drive status routine
+
+ Returns: void
+
+*****************************************************/
+LOCALFN VOID clock_routine( VOID )
+{
+ DBLK_PTR vcb_ptr;
+ WORD status;
+
+ status = VLM_GetDriveStatus( &vcb_ptr );
+
+ switch( status ) {
+
+ case VLM_VALID_TAPE:
+
+ if(mwpStatus->display_status != VLM_VALID_TAPE ) {
+
+ mwpStatus->display_status = VLM_VALID_TAPE;
+
+ /* turn the OK button ON */
+ EnableWindow ( GetDlgItem ( mwpStatus->ghDlg, IDD_RSET_OK_BUTTON ), ON ) ;
+ }
+ break;
+
+ case VLM_DRIVE_FAILURE:
+
+ if(mwpStatus->display_status != VLM_DRIVE_FAILURE ) {
+
+ mwpStatus->display_status = VLM_DRIVE_FAILURE;
+
+ /* turn the OK button off when no tape */
+ EnableWindow ( GetDlgItem ( mwpStatus->ghDlg, IDD_RSET_OK_BUTTON ), OFF ) ;
+ }
+ break;
+
+ } /* end switch statment */
+
+} /* end clock routine */
+
+#ifdef OEM_EMS
+
+/***************************************************
+
+ Name: ConfirmXchgBsdServers
+
+ Description: Confirms and sets DLEs for Exchange servers
+
+ Returns: BOOLEAN
+
+*****************************************************/
+LOCALFN INT ConfirmXchgBsdServers(
+ WORD * pwPosition
+)
+{
+
+ WORD wIndex;
+ BSD_PTR pBSD;
+ BE_CFG_PTR pBEConfig;
+ CHAR_PTR pszTemp;
+ GENERIC_DLE_PTR pDLE;
+ GENERIC_DLE_PTR pChildDLE;
+ BOOLEAN xchg_found = FALSE ;
+
+ for( wIndex = 0; wIndex <= mwpStatus->max_BSD_index; wIndex++ ) {
+
+ pBSD = GetTapeBSDPointer( wIndex );
+
+ if ( ( BSD_GetOsId( pBSD ) != FS_EMS_MDB_ID ) &&
+ ( BSD_GetOsId( pBSD ) != FS_EMS_DSA_ID ) ) {
+ continue;
+ }
+
+ pBEConfig = BSD_GetConfigData( pBSD );
+
+ if ( BSD_GetOsId( pBSD ) == FS_EMS_MDB_ID ) {
+
+ pszTemp = BSD_GetLogicalSourceDevice(pBSD) ;
+ if ( (BEC_GetEmsPubPri( pBEConfig ) != (BEC_EMS_PUBLIC | BEC_EMS_PRIVATE)) ) {
+ if ( BEC_GetEmsWipeClean( pBEConfig ) ) {
+ *pwPosition = wIndex;
+ return EMS_NO_WIPE_IF_NOT_BOTH ;
+ }
+ }
+
+ } else {
+
+ pszTemp = BSD_GetVolumeLabel( pBSD ); // We're using the volume label to store the server name
+ }
+
+ if ( ( pszTemp == NULL ) || ( *pszTemp == TEXT('\0') ) ) {
+ *pwPosition = wIndex;
+ return EMS_NO_DEST ;
+ }
+
+ if ( ( BSD_GetOsId( pBSD ) == FS_EMS_MDB_ID ) &&
+ !BEC_GetEmsWipeClean(pBEConfig) &&
+ stricmp( BSD_GetLogicalSourceDevice(pBSD),
+ BSD_GetVolumeLabel(pBSD)) ) {
+
+ UINT32 unTapeID;
+ INT16 nTapeSetNum;
+ INT16 nTapeType;
+
+ unTapeID = BSD_GetTapeID( pBSD );
+ nTapeSetNum = BSD_GetSetNum( pBSD );
+
+
+ /* get the backup method */
+ nTapeType = VLM_GetBackupType( unTapeID, nTapeSetNum );
+
+ switch( nTapeType ) {
+
+ case QTC_NORM_BACKUP:
+ case QTC_COPY_BACKUP:
+ *pwPosition = wIndex;
+ return EMS_MUST_WIPE_TO_ALT ;
+ }
+ }
+
+ // Extract off the leading '\'s from the server name.
+ while ( TEXT ('\\') == *pszTemp ) pszTemp++;
+
+ if ( ( !pszTemp ) || ( TEXT ( '\0' ) == *pszTemp ) ) {
+ *pwPosition = wIndex;
+ return EMS_SERVER_NOT_FOUND;
+ }
+
+ if ( BEC_GetEmsPubPri( pBEConfig ) == 0 ) {
+ *pwPosition = wIndex;
+ return EMS_NO_STORE;
+ }
+
+ WM_ShowWaitCursor( TRUE );
+
+ // Things that have to happen in order. First, add name to EMS server list.
+ if ( SUCCESS == EMS_AddToServerList ( dle_list, pszTemp ) ) {
+
+ if ( SUCCESS != FS_FindDrives( FS_EMS_DRV, dle_list, pBEConfig, 0 ) ) {
+ *pwPosition = wIndex;
+ WM_ShowWaitCursor( FALSE );
+ return EMS_SERVER_NOT_FOUND;
+
+ }
+ }
+
+ WM_ShowWaitCursor( FALSE );
+
+ // Next, find the DLE for the server name and type.
+ if ( SUCCESS != DLE_FindByName( dle_list, pszTemp, FS_EMS_DRV, &pDLE ) ) {
+ *pwPosition = wIndex;
+ return EMS_SERVER_NOT_FOUND;
+ }
+
+ DLE_GetFirstChild( pDLE, &pChildDLE );
+
+ while( pChildDLE ) {
+
+ if ( DLE_GetOsId( pChildDLE ) == BSD_GetOsId( pBSD ) ) {
+
+ xchg_found = TRUE ;
+
+ BSD_SetDLE ( pBSD, pChildDLE );
+
+// free( BSD_GetLogicalSourceDevice(pBSD) );
+// BSD_SetLogicalSourceDevice(pBSD, NULL) ;
+
+ break;
+ }
+
+ DLE_GetNext( &pChildDLE );
+ }
+
+ if ( NULL == pChildDLE ) {
+ *pwPosition = wIndex;
+ return EMS_SERVER_NOT_FOUND;
+ }
+
+ }
+
+ if ( xchg_found ) {
+ return EMS_XCHG_FOUND ;
+ } else {
+ return SUCCESS;
+ }
+}
+
+#endif
diff --git a/private/utils/ntbackup/src/d_o_xchg.c b/private/utils/ntbackup/src/d_o_xchg.c
new file mode 100644
index 000000000..74dd61430
--- /dev/null
+++ b/private/utils/ntbackup/src/d_o_xchg.c
@@ -0,0 +1,732 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: D_O_BKUP.C
+
+ Description: Exchange server backup dialogs
+
+ $Log: $
+
+
+*****************************************************/
+
+#ifdef OEM_EMS //For entire file
+
+#include "all.h"
+#include "uiexport.h"
+#include "ctl3d.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define ON TRUE
+#define OFF FALSE
+
+typedef long EC;
+typedef EC (*GET_PCT_PTR) ( PVOID Instance, INT * piCur, INT * piTotal );
+
+INT DLG_StartEmsService( CHAR_PTR pszTemp, UINT8 uService ) ;
+
+typedef struct XCHG_RECOVER {
+
+ PVOID Instance;
+ GENERIC_DLE_PTR dle;
+ GET_PCT_PTR pfnPct;
+ INT *status ;
+
+} XCHG_RECOVER, *XCHG_RECOVER_PTR;
+
+/***************************************************
+
+ Name: DM_XchngConnect()
+
+ Description: Runtime Connect to Microsoft Exchange dialog.
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_ExchgConnect(
+ HWND hDlg , /* window handle of the dialog box */
+ MSGID message , /* type of message */
+ MPARAM1 mp1 , /* message-specific information */
+ MPARAM2 mp2 )
+{
+ static CHAR szDir[ MAX_EMS_SERVER_LEN + 1 ];
+ static CHAR szIS[ MAX_EMS_SERVER_LEN + 1 ];
+ CHAR szTitle[ MAX_UI_WIN_TITLE_SIZE ];
+ CHAR szMsg[ MAX_UI_RESOURCE_SIZE ];
+ CHAR szBuffer[ MAX_UI_RESOURCE_SIZE ];
+ CHAR szServer[ MAX_EMS_SERVER_LEN + 1 ];
+ CHAR_PTR pszTemp;
+ GENERIC_DLE_PTR dle ;
+ BE_CFG_PTR pbeConfig;
+ BOOL bOkPressed ;
+ BOOL iDleExists;
+ FSYS_HAND fsh;
+ UINT8 uService;
+ INT16 iResult;
+
+ switch ( message )
+ {
+ /****************************************************************************
+ INIT THE DIALOG
+ /***************************************************************************/
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ /* Let's go 3-D! */
+ Ctl3dSubclassDlgEx( hDlg, CTL3D_ALL );
+
+ DM_CenterDialog( hDlg );
+
+ /* set the length of the text field */
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, EM_LIMITTEXT,
+ MAX_EMS_SERVER_LEN, 0 );
+
+ /* Add the elements to the list box. */
+ RSM_StringCopy( IDS_XCHNG_DIR, szDir, sizeof( szBuffer ) );
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SERVICE, CB_ADDSTRING,
+ 0, MP2FROMPVOID( szDir ) );
+
+ RSM_StringCopy( IDS_XCHNG_INFO_STORE, szIS, sizeof( szBuffer ) );
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SERVICE, CB_ADDSTRING,
+ 0, MP2FROMPVOID( szIS ) );
+
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SERVICE, CB_SETCURSEL, 0, 0 );
+
+ /* Make Connect the default option */
+ CheckRadioButton( hDlg, IDD_XCNCT_CONNECT, IDD_XCNCT_ONLINE, IDD_XCNCT_CONNECT );
+ EnableWindow( GetDlgItem( hDlg, IDD_XCNCT_SERVICE ), OFF );
+
+ EnableWindow( GetDlgItem( hDlg, IDD_XCNCT_OK ) , OFF );
+
+ return ( TRUE ) ;
+
+ /* Messages for setting the background color.
+ case WM_CTLCOLORSTATIC:
+ SetBkMode( (HDC)mp1, TRANSPARENT ) ;
+
+ case WM_CTLCOLORDLG:
+ case WM_CTLCOLORBTN:
+ case WM_CTLCOLORMSGBOX:
+
+ return ( (DLGRESULT)hBkgdBrush ) ; */
+
+
+ /****************************************************************************
+ WM COMMAND
+ /***************************************************************************/
+ case WM_COMMAND: /* message: received a command */
+ {
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+
+ switch( wId )
+ {
+ case IDD_XCNCT_CONNECT:
+ EnableWindow( GetDlgItem( hDlg, IDD_XCNCT_SERVICE ), OFF );
+ return ( TRUE );
+
+ case IDD_XCNCT_ONLINE:
+ EnableWindow( GetDlgItem( hDlg, IDD_XCNCT_SERVICE ), ON );
+ return ( TRUE );
+
+ case IDD_XCNCT_PICKER:
+ {
+ CHAR *szFname[NAME_MAX_SIZE+1] ;
+
+ HM_MakeHelpPathName( szFname ) ;
+
+ EnableWindow( GetDlgItem( hDlg, IDD_XCNCT_OK ) , ON );
+ I_SystemFocusDialog( hDlg,
+ FOCUSDLG_SERVERS_ONLY | FOCUSDLG_BROWSE_ALL_DOMAINS ,
+ (LPTSTR)&szServer ,
+ MAX_EMS_SERVER_LEN ,
+ &bOkPressed ,
+ szFname ,
+ IDH_DB_XCHG_BROWSE );
+
+ if ( bOkPressed ) {
+
+ SetDlgItemText( hDlg, IDD_XCNCT_SVR_NAME, (LPTSTR)&szServer );
+ }
+
+ SendMessage( hDlg, DM_SETDEFID, IDD_XCNCT_OK, 0 );
+ SetFocus ( GetDlgItem ( hDlg, IDD_XCNCT_SVR_NAME ) );
+
+ return ( TRUE );
+ }
+
+/****************************************************************************
+ Help button
+/***************************************************************************/
+ case IDD_XCNCT_HELP:
+ case IDHELP:
+
+ HM_DialogHelp( IDH_DB_XCHG_CONNECT );
+
+ return( TRUE );
+
+ case IDD_XCNCT_SVR_NAME:
+
+ switch ( HIWORD( mp1 ) )
+ {
+ case EN_CHANGE:
+
+ /* Turn on OK if there is anything in the only edit field. */
+ if ( 0 == SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, WM_GETTEXTLENGTH, 0, 0 ) ) {
+ EnableWindow( GetDlgItem( hDlg, IDD_XCNCT_OK ), OFF );
+
+ } else {
+ EnableWindow( GetDlgItem( hDlg, IDD_XCNCT_OK ), ON );
+ }
+
+ return ( TRUE );
+ }
+
+ return ( FALSE ); // Didn't process notification
+
+/****************************************************************************
+ Cancel button
+/***************************************************************************/
+ case IDD_XCNCT_CANCEL:
+ case IDCANCEL:
+
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+
+ return ( TRUE );
+
+/****************************************************************************
+ OK button
+/***************************************************************************/
+ case IDOK:
+ case IDD_XCNCT_OK:
+
+ WM_ShowWaitCursor( TRUE );
+
+ SetFocus ( GetDlgItem ( hDlg, IDD_XCNCT_OK ) );
+
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, EM_SETREADONLY, (MP1) TRUE, (MP2) 0 );
+
+ GetDlgItemText( hDlg, IDD_XCNCT_SVR_NAME, (LPTSTR)&szServer, MAX_EMS_SERVER_LEN );
+ GetDlgItemText( hDlg, IDD_XCNCT_SERVICE, (LPTSTR)&szBuffer, MAX_UI_RESOURCE_LEN );
+
+ uService = stricmp( szBuffer, szDir ) ? FS_EMS_MDB_ID : FS_EMS_DSA_ID;
+
+ pszTemp = (CHAR_PTR)&szServer;
+ dle = NULL;
+
+ // Remove leading '\'s
+ while ( TEXT ('\\') == *pszTemp ) pszTemp++;
+
+ if ( IsDlgButtonChecked( hDlg, IDD_XCNCT_ONLINE ) ) {
+
+ INT status ;
+
+ status = DLG_StartEmsService( pszTemp, uService ) ;
+
+ WM_ShowWaitCursor( FALSE );
+ if ( status == SUCCESS ) {
+
+ WM_MsgBox( ID(IDS_XCHNG_RECOVER_TITLE), ID( IDS_STARTEXCHANGE),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+
+ EndDialog( hDlg, TRUE ); /* Exits the dialog box */
+ }
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, EM_SETREADONLY, (MP1) FALSE, (MP2) 0 );
+ return TRUE; // Window was created and new server added.
+ break;
+ }
+
+ // from here down this case only deals with conecting
+
+ // See if server already exists in dle list and add it if it doesn't
+ if ( SUCCESS != (iDleExists = DLE_FindByEMSServerName( dle_list, pszTemp, uService, &dle ) ) ||
+ (NULL == DLE_GetParent(dle)) ||
+ (NULL == DLE_GetParent(DLE_GetParent(dle))) ) {
+
+ EMS_AddToServerList( dle_list, pszTemp );
+
+ if ( SUCCESS == FS_FindDrives( FS_EMS_DRV, dle_list, CDS_GetPermBEC(), 0 ) ) {
+
+ // if it doesn't exist now then show an error to the user.
+ iResult = DLE_FindByEMSServerName( dle_list, pszTemp, uService, &dle );
+ if ( SUCCESS != iResult ) {
+ CHAR machine[256];
+ SC_HANDLE mach_hand ;
+
+ WM_ShowWaitCursor( FALSE );
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, EM_SETREADONLY, (MP1) FALSE, (MP2) 0 );
+ RSM_StringCopy ( IDS_MSGTITLE_BADEXCHNG, szTitle, sizeof ( szTitle ) );
+
+ strcpy(machine, TEXT("\\\\") ) ;
+ strcat( machine, pszTemp ) ;
+
+ mach_hand = OpenSCManager( machine, NULL, SC_MANAGER_ENUMERATE_SERVICE ) ;
+ if (mach_hand == NULL ) {
+
+ RSM_StringCopy ( IDS_XCHNG_NO_SERVER, szMsg, sizeof ( szMsg ) );
+ } else {
+ CloseHandle( mach_hand ) ;
+ RSM_StringCopy ( IDS_XCHNG_NO_CONNECT, szMsg, sizeof ( szMsg ) );
+
+ }
+ wsprintf ( (LPTSTR)&szBuffer, szMsg, pszTemp );
+ MessageBox( hDlg, szBuffer, szTitle, MB_ICONASTERISK | MB_OK );
+
+ // Remove the name from the server list.
+ EMS_RemoveFromServerList( pszTemp );
+
+ SetFocus ( GetDlgItem ( hDlg, IDD_XCNCT_SVR_NAME ) );
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, EM_SETSEL, 0, -1 ) ;
+
+ return ( TRUE );
+ }
+ }
+
+ }
+
+
+ if ( NULL == DLE_GetEnterpriseDLE( dle ) ) {
+
+ // The server dle has no enterprise dle and shouldn't be handled.
+
+ WM_ShowWaitCursor( FALSE );
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, EM_SETREADONLY, (MP1) FALSE, (MP2) 0 );
+ RSM_StringCopy ( IDS_MSGTITLE_BADEXCHNG, szTitle, sizeof ( szTitle ) );
+
+ RSM_StringCopy ( IDS_XCHNG_NO_CONNECT, szMsg, sizeof ( szMsg ) );
+
+ wsprintf ( (LPTSTR)&szBuffer, szMsg, pszTemp );
+ MessageBox( hDlg, szBuffer, szTitle, MB_ICONASTERISK | MB_OK );
+
+ // Remove the name from the server list.
+ EMS_RemoveFromServerList( pszTemp );
+
+ SetFocus ( GetDlgItem ( hDlg, IDD_XCNCT_SVR_NAME ) );
+ SendDlgItemMessage( hDlg, IDD_XCNCT_SVR_NAME, EM_SETSEL, 0, -1 ) ;
+
+ return ( TRUE );
+ }
+
+ if ( iDleExists != SUCCESS ) {
+
+ // Create a window for a new connection or add the server to an existing one.
+ VLM_ExchangeListCreate( pszTemp );
+
+ } else {
+
+ // DLE already existed in a tree and must be in a window somewhere.
+ // Let's find it and set the anchor to it.
+ if ( !SLM_DisplayExchangeDLE( DLE_GetParent( dle ) ) ) {
+
+ // DLE exists but doesn't have a window so create the window.
+ VLM_ExchangeListCreate( pszTemp );
+ }
+ }
+
+
+ WM_ShowWaitCursor( FALSE );
+ EndDialog( hDlg, TRUE ); /* Exits the dialog box */
+
+ return TRUE; // Window was created and new server added.
+ break;
+
+ default:
+
+ return( FALSE );
+ break;
+
+ } /* switch ( wId ) */
+
+ } /* case WM_COMMAND */
+ break;
+
+ } /* switch ( message ) */
+
+ return ( FALSE ); /* Didn't process a message */
+}
+
+
+/***************************************************
+
+ Name: XchgKickPct ()
+
+ Description: Displays the Exchange Recovering Dialog.
+
+ Returns:
+
+*****************************************************/
+
+VOID XchgKickPct(
+ VOID_PTR pVoid,
+ GENERIC_DLE_PTR dle,
+ EC (* pfnPct)( PVOID, INT *, INT * ),
+ INT *status )
+{
+ XCHG_RECOVER EMSRecover;
+
+ EMSRecover.Instance = pVoid;
+ EMSRecover.dle = dle;
+ EMSRecover.pfnPct = pfnPct;
+ EMSRecover.status = status;
+
+}
+
+/***************************************************
+
+ Name: DM_ExchgRecover()
+
+ Description: Runtime Connect to Microsoft Exchange dialog.
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_ExchgRecover(
+ HWND hDlg , /* window handle of the dialog box */
+ MSGID message , /* type of message */
+ MPARAM1 mp1 , /* message-specific information */
+ MPARAM2 mp2 )
+{
+ static HANDLE hBkgdBrush; // Background brush for dialog.
+ static HBRUSH hStatusBrush; // Brush for filling in status window.
+ static XCHG_RECOVER_PTR recoverdata; // Passed in during WM_INITDIALOG
+ static CHAR szPctComplete[ MAX_UI_RESOURCE_SIZE ];
+ static CHAR szPhase[ MAX_UI_RESOURCE_SIZE ];
+ static GET_PCT_PTR pfnGetPct;
+ static PVOID pInstance;
+ static UINT uTimer;
+ static INT iCur;
+ static INT iTotal;
+ static INT iStatus;
+ static INT fPct;
+ static HPEN hPenBevel;
+ static HWND hStatusBar;
+ static RECT rcFrame;
+ static RECT rcStatus;
+ static INT iPhase;
+ static HFONT hFont;
+ static INT iPct = 0;
+ static UINT16 ucPhases;
+
+ HWND hStatusText;
+ LOGFONT logfont;
+ CHAR szTitle[ MAX_UI_WIN_TITLE_SIZE ];
+ CHAR szMsg[ MAX_UI_RESOURCE_SIZE ];
+ CHAR szBuffer[ MAX_UI_RESOURCE_SIZE ];
+ CHAR szComponent[ MAX_DEVICE_NAME_LEN + 1 ];
+ GENERIC_DLE_PTR dle = NULL ;
+ LPDRAWITEMSTRUCT lpdis;
+ HDC hDC;
+ POINT ptStatus;
+ INT iNewPct;
+ HANDLE hResource;
+ HGLOBAL hMem;
+
+ switch ( message )
+ {
+ /****************************************************************************
+ INIT THE DIALOG
+ /***************************************************************************/
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ // Let's go 3-D!!
+ Ctl3dSubclassDlgEx( hDlg, CTL3D_ALL );
+
+ recoverdata = (XCHG_RECOVER_PTR)mp2;
+ dle = recoverdata->dle;
+ pfnGetPct = recoverdata->pfnPct;
+ pInstance = recoverdata->Instance;
+
+ GetDlgItemText( hDlg, IDD_XCHG_RCVR_TEXT, (LPTSTR)szBuffer, MAX_UI_RESOURCE_LEN );
+
+ // Set up a resource ID value in case there's no dle.
+ ucPhases = IDR_XCHG_RCVR_DS_PHASE;
+
+ if ( NULL != dle ) {
+ DLE_DeviceDispName( dle, szComponent, MAX_DEVICE_NAME_LEN, 0 );
+ dle = DLE_GetParent( dle );
+
+ // Use the correct Resource ID based on the Os type.
+ switch ( DLE_GetOsId( dle ) ) {
+ case EMS_MDB:
+ ucPhases = IDR_XCHG_RCVR_IS_PHASE;
+ case EMS_DSA:
+ ucPhases = IDR_XCHG_RCVR_DS_PHASE;
+ }
+
+ }
+ wsprintf( szMsg, szBuffer, szComponent );
+ SetDlgItemText( hDlg, IDD_XCHG_RCVR_TEXT, (LPTSTR)szMsg );
+
+ /* Create the brush for status bar. */
+ hStatusBrush = CreatePatternBrush( RSM_BitmapLoad( IDRBM_RCVR_STATUS, RSM_MAGICCOLOR ) );
+
+ /* Get the format string for percent complete text from the control */
+ GetDlgItemText( hDlg, IDD_XCHG_RCVR_PCT, (LPTSTR)szPctComplete, MAX_UI_RESOURCE_LEN );
+ SetDlgItemText( hDlg, IDD_XCHG_RCVR_PCT, TEXT( "\0") );
+
+ /* Get the format string for phase text from the control */
+ GetDlgItemText( hDlg, IDD_XCHG_RCVR_PHASE, (LPTSTR)szPhase, MAX_UI_RESOURCE_LEN );
+ SetDlgItemText( hDlg, IDD_XCHG_RCVR_PHASE, TEXT( "\0") );
+
+ /* Get window handles for controls that will be dynamically updated. */
+ hStatusBar = GetDlgItem( hDlg, IDD_XCHG_RCVR_STATUS );
+ hStatusText = GetDlgItem( hDlg, IDD_XCHG_RCVR_PCT );
+
+ /* Set the font of the Percent text to a lighter font of the same type */
+ hFont = (HFONT)SendMessage( hStatusText, WM_GETFONT, 0, 0 );
+ GetObject( hFont, sizeof( LOGFONT ), &logfont );
+ logfont.lfWeight >>= 1;
+ hFont = CreateFontIndirect ( &logfont );
+ SendMessage( hStatusText, WM_SETFONT, (MPARAM1)hFont, (MPARAM2)FALSE );
+
+ // Now set the Phase text to the same font
+ hStatusText = GetDlgItem( hDlg, IDD_XCHG_RCVR_PHASE );
+ SendMessage( hStatusText, WM_SETFONT, (MPARAM1)hFont, (MPARAM2)FALSE );
+
+ // Load the values for the number of phases
+ hResource = FindResource( ghResInst, MAKEINTRESOURCE( ucPhases ), RT_RCDATA );
+ hMem = LoadResource( ghResInst, hResource );
+ ucPhases = ( hMem ) ? *((UINT16*)LockResource( hMem )) : 1;
+
+ /* Resize the status frame to be 13 units high. */
+ GetWindowRect( GetDlgItem( hDlg, IDD_XCHG_RCVR_STATUS_BORDER ), &rcFrame );
+ ptStatus.x = rcFrame.left;
+ ptStatus.y = rcFrame.top;
+ ScreenToClient( hDlg, &ptStatus );
+ MoveWindow( GetDlgItem( hDlg, IDD_XCHG_RCVR_STATUS_BORDER ),
+ ptStatus.x, ptStatus.y, rcFrame.right - rcFrame.left, 13, TRUE );
+
+ /* Resize the window for the status bar to fit inside the status frame. */
+ MoveWindow( hStatusBar, ptStatus.x + 1, ptStatus.y + 1,
+ rcFrame.right - rcFrame.left - 2, 11, TRUE );
+ rcStatus.top = rcFrame.top = 0;
+ rcStatus.bottom = rcFrame.bottom = 11;
+ rcFrame.right = rcFrame.right - rcFrame.left;
+ rcStatus.left = 0;
+
+ /* Create the timer for updating the status. */
+ uTimer = SetTimer( hDlg, 1, 100, NULL );
+
+ DM_CenterDialog( hDlg );
+
+ // First Phase
+ iPhase = 1;
+
+ return ( TRUE ) ;
+
+ case WM_TIMER:
+
+ // This call will update recoverdata->status also
+ (* pfnGetPct)( recoverdata->Instance, &iTotal, &iCur );
+
+ switch ( *(recoverdata->status) ) {
+
+ case EMS_PCT_CONTINUE:
+
+ fPct = ( (iCur*100) / iTotal );
+ iNewPct = fPct ;
+
+ if ( iPct > iNewPct + 10 ) {
+
+ iPhase++;
+ iPct = iNewPct;
+ InvalidateRect( hStatusBar, NULL, TRUE );
+
+ } else if ( iPct < iNewPct ) {
+
+ iPct = iNewPct;
+ InvalidateRect( hStatusBar, NULL, FALSE );
+ }
+
+ wsprintf( szBuffer, szPctComplete, iPct );
+ SetDlgItemText( hDlg, IDD_XCHG_RCVR_PCT, szBuffer );
+
+ wsprintf( szBuffer, szPhase, iPhase,
+ ( ucPhases >= iPhase) ? ucPhases : iPhase );
+ SetDlgItemText( hDlg, IDD_XCHG_RCVR_PHASE, szBuffer );
+
+ break;
+
+ default:
+ SendMessage( hDlg, WM_COMMAND, (MPARAM1)IDOK, (MPARAM2)NULL );
+
+ }
+
+ return ( 0 );
+
+ case WM_DRAWITEM:
+
+ lpdis = (LPDRAWITEMSTRUCT)mp2;
+ hDC = lpdis->hDC;
+
+ switch ( lpdis->CtlID )
+ {
+ case IDD_XCHG_RCVR_STATUS:
+
+ SetBkColor( hDC, GetSysColor( COLOR_BTNFACE ) ) ;
+
+ // Fill in the status part.
+ rcStatus.right = rcStatus.left + (INT)( lpdis->rcItem.right * fPct/100 );
+ FillRect( hDC, &rcStatus, hStatusBrush );
+
+ // Fill the rest in background color
+ rcFrame.left = rcStatus.right + 1;
+ FillRect( hDC, &rcFrame, Ctl3dCtlColorEx( WM_CTLCOLORBTN,
+ (MPARAM1) hDC,
+ (MPARAM2) lpdis->hwndItem ) );
+
+ return TRUE;
+ }
+
+
+ /****************************************************************************
+ WM COMMAND
+ /***************************************************************************/
+ case WM_COMMAND: /* message: received a command */
+ {
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+
+ switch( wId )
+ {
+
+ /****************************************************************************
+ Cancel button
+ /***************************************************************************/
+ case IDOK:
+
+ if ( uTimer ) KillTimer( hDlg, uTimer );
+
+ DeleteObject( hStatusBrush );
+ DeleteObject( hFont );
+
+ EndDialog( hDlg, TRUE );
+
+ return ( TRUE );
+
+ case IDD_XCHG_RCVR_CANCEL:
+ case IDCANCEL:
+
+// RSM_StringCopy( IDS_XCHNG_STOP_RECOVER, szBuffer, MAX_UI_RESOURCE_LEN );
+// RSM_StringCopy( IDS_XCHNG_STOP_RECOVER_TITLE, szTitle, MAX_UI_WIN_TITLE_LEN );
+
+// if ( WMMB_IDOK == WM_MsgBox( szTitle,
+// szBuffer,
+// WMMB_OKCANCEL,
+// WMMB_ICONINFORMATION ) ) {
+//
+// if ( uTimer ) KillTimer( hDlg, uTimer );
+
+// DeleteObject( hStatusBrush );
+// DeleteObject( hFont );
+
+// EndDialog( hDlg, TRUE ); /* Exits the dialog box */
+
+// }
+
+ return ( TRUE );
+
+ default:
+ break;
+
+ } /* switch ( wId ) */
+
+ } /* case WM_COMMAND */
+ break;
+
+ } /* switch ( message ) */
+
+ return ( FALSE ); /* Didn't process a message */
+}
+
+INT DLG_StartEmsService( CHAR_PTR server_name, UINT8 uService )
+{
+ SC_HANDLE mach_hand ;
+ SC_HANDLE serv_hand ;
+ SERVICE_STATUS serv_status ;
+ INT last_error = 0 ;
+ CHAR machine[256];
+ LPSTR msg_title ;
+ LPSTR msg_text ;
+ INT ret_val = SUCCESS ;
+
+ msg_title = ID(IDS_XCHNG_RECOVER_TITLE) ;
+
+ strcpy( machine, TEXT("\\\\") ) ;
+ strcat( machine, server_name ) ;
+
+
+ mach_hand = OpenSCManager( machine, NULL, SC_MANAGER_ALL_ACCESS ) ;
+ if ( mach_hand == NULL ) {
+
+ last_error = GetLastError();
+ switch( last_error ) {
+ case ERROR_ACCESS_DENIED:
+ msg_text = ID( IDS_XCHNG_NO_SERVICE_ACCESS ) ;
+ break ;
+ default:
+ msg_text = ID( IDS_XCHNG_NO_SERVER ) ;
+ break ;
+ }
+ WM_MsgBox( msg_title, msg_text,
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ return FAILURE ;
+ }
+
+ if ( uService == FS_EMS_MDB_ID ) {
+ serv_hand = OpenService( mach_hand, TEXT("MSExchangeIS"),
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ } else {
+ serv_hand = OpenService( mach_hand, TEXT("MSExchangeDS"),
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ }
+ if ( serv_hand == NULL ) {
+
+ CloseHandle( mach_hand ) ;
+
+ last_error = GetLastError();
+ switch( last_error ) {
+ case ERROR_SERVICE_NOT_FOUND:
+ case ERROR_INVALID_HANDLE:
+ msg_text = ID( IDS_XCHNG_NO_SERVICE ) ;
+ break;
+ case ERROR_ACCESS_DENIED:
+ msg_text = ID( IDS_XCHNG_NO_SERVICE_ACCESS ) ;
+ break ;
+ default:
+ msg_text = ID( IDS_XCHNG_SERVICE_NO_START ) ;
+ break ;
+ }
+ WM_MsgBox( msg_title, msg_text,
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ return FAILURE ;
+ }
+
+ if ( !StartService( serv_hand, 0, NULL ) ) {
+ last_error = GetLastError();
+ switch( last_error ) {
+ case ERROR_SERVICE_ALREADY_RUNNING:
+ msg_text = ID( IDS_XCHNG_SERVICE_RUNNING ) ;
+ break ;
+ case ERROR_ACCESS_DENIED:
+ msg_text = ID( IDS_XCHNG_NO_SERVICE_ACCESS ) ;
+ break ;
+ default:
+ msg_text = ID( IDS_XCHNG_SERVICE_NO_START ) ;
+ break ;
+ }
+ WM_MsgBox( msg_title, msg_text,
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+
+ ret_val = FAILURE ;
+ }
+
+ CloseHandle( serv_hand ) ;
+ CloseHandle( mach_hand ) ;
+
+ return ret_val ;
+
+}
+
+
+#endif OEM_EMS
diff --git a/private/utils/ntbackup/src/d_r_path.c b/private/utils/ntbackup/src/d_r_path.c
new file mode 100644
index 000000000..5d15509d5
--- /dev/null
+++ b/private/utils/ntbackup/src/d_r_path.c
@@ -0,0 +1,240 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_r_path.c
+
+ Description: contains dialog proc to specify restore target drive
+
+ $Log: G:/UI/LOGFILES/D_R_PATH.C_V $
+
+ Rev 1.13 11 Jun 1993 14:17:40 MIKEP
+enable c++
+
+ Rev 1.12 01 Nov 1992 15:56:10 DAVEV
+Unicode changes
+
+ Rev 1.11 07 Oct 1992 13:41:36 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.10 04 Oct 1992 19:36:54 DAVEV
+Unicode Awk pass
+
+ Rev 1.9 28 Jul 1992 14:49:14 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.8 14 May 1992 16:40:08 MIKEP
+Nt pass 2
+
+ Rev 1.7 12 May 1992 21:21:16 MIKEP
+NT pass 1
+
+ Rev 1.6 27 Jan 1992 00:30:50 CHUCKB
+Updated dialog id's.
+
+ Rev 1.5 20 Jan 1992 10:02:52 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.4 10 Jan 1992 09:33:20 ROBG
+Modified HELPIDs.
+
+ Rev 1.3 07 Jan 1992 12:40:26 CHUCKB
+Added help.
+
+ Rev 1.2 16 Dec 1991 11:45:44 CHUCKB
+Added include windows.h.
+
+ Rev 1.1 25 Nov 1991 15:04:48 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 ?? ??? 1991 ??:??:?? ??????
+Initial revision.
+
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+#define DRIVENAME_CALLOC_SIZE 37 //NOTE: this should NOT be hard coded!!!
+
+/****************************************************************************
+
+ Name: DM_GetRestoreDestination
+
+ Description: Entry point for the application to request a
+ restore target drive. That drive may be a
+ server/volume or a mapped drive.
+
+ Modified:
+
+ Returns: A pointer to a DLE.
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+
+PVOID DM_GetRestoreDestination (
+
+LPSTR lpszBackupSetName, // I - Pointer to the backup set name.
+PVOID vlpServerList, // I - Pointer to server list.
+PVOID vlpDriveList ) // I - Pointer to drive list.
+
+{
+ static DS_RESTORE dsRestore ;
+
+ dsRestore.lpszBackupSetName = lpszBackupSetName ;
+ dsRestore.vlpServerList = vlpServerList ;
+ dsRestore.vlpDriveList = vlpDriveList ;
+
+ if ( DM_ShowDialog ( ghWndFrame, IDD_RESTORE, (PVOID) &dsRestore ) == DM_SHOWOK ) {
+
+ return ( dsRestore.dle ) ;
+
+ } else {
+
+ return NULL ;
+ }
+}
+
+/***************************************************
+
+ Name: DM_RestoreTarget ()
+
+ Description: dialog proc to specify restore target drive
+
+ Modified:
+
+ Returns: boolean true if message was processed
+
+ Notes:
+
+ See also: Windows SDK
+
+*****************************************************/
+
+DLGRESULT APIENTRY DM_RestoreTarget (
+
+ HWND hDlg,
+ MSGID msg,
+ MPARAM1 mp1,
+ MPARAM2 mp2 )
+
+{
+ static DS_RESTORE_PTR pdsRestore ;
+ DWORD dResult ;
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR server_vlm;
+ LPSTR lpszDriveName ;
+ BOOL bIsNull = TRUE ;
+ INT nRetCode ;
+ GENERIC_DLE_PTR dle;
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+
+ DM_CenterDialog( hDlg ) ;
+
+ nRetCode = DM_SHOWCANCEL ;
+
+ pdsRestore = (DS_RESTORE_PTR) mp2 ;
+
+ // put the backup set name and list of disk drives in
+
+ SetDlgItemText ( hDlg, IDD_BSETNAME, (pdsRestore->lpszBackupSetName) ) ;
+
+ vlm = VLM_GetFirstVLM( (Q_HEADER_PTR) pdsRestore->vlpDriveList ) ;
+ while ( vlm != NULL ) {
+
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_ADDSTRING,
+ (MP1) 0, (MP2) vlm->name ) ;
+ vlm = VLM_GetNextVLM( vlm ) ;
+ }
+
+ server_vlm = VLM_GetFirstVLM( (Q_HEADER_PTR) pdsRestore->vlpServerList );
+ while ( server_vlm != NULL ) {
+
+ vlm = VLM_GetFirstVLM ( &server_vlm->children ) ;
+ while ( vlm != NULL ) {
+
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_ADDSTRING,
+ (MP1) 0, (MP2)vlm->name ) ;
+ vlm = VLM_GetNextVLM ( vlm ) ;
+ }
+ server_vlm = VLM_GetNextVLM ( server_vlm ) ;
+ }
+
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_SETCURSEL,
+ (MP1) 0, (MP2) 0 ) ;
+
+ lpszDriveName = (LPSTR) calloc ( DRIVENAME_CALLOC_SIZE, sizeof ( CHAR ) ) ;
+ dResult = SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETCURSEL, 0, (MP2) 0 ) ;
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETTEXT, (MP1) dResult, (MP2) lpszDriveName ) ;
+ SetDlgItemText ( hDlg, IDD_CURDRIVE, lpszDriveName ) ;
+
+ free ( lpszDriveName ) ;
+
+ return FALSE ;
+
+ case WM_COMMAND :
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_DIALOGRESTORESET ) ;
+ return( TRUE ) ;
+
+ case IDD_DRIVELIST :
+
+ lpszDriveName = (LPSTR) calloc ( DRIVENAME_CALLOC_SIZE, sizeof ( CHAR ) ) ;
+
+ dResult = SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETCURSEL, 0, (MP2) 0 ) ;
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETTEXT, (MP1) dResult, (MP2) lpszDriveName ) ;
+ SetDlgItemText ( hDlg, IDD_CURDRIVE, lpszDriveName ) ;
+
+ free ( lpszDriveName ) ;
+
+ return TRUE ;
+ break;
+
+ case IDOK : {
+
+ BOOL done = FALSE ;
+
+ nRetCode = DM_SHOWOK ;
+
+ // search the VLM list for one with a dle device name that matches the
+ // string in IDD_CURDRIVE and return a pointer to that dle
+
+ lpszDriveName = (LPSTR) calloc ( DRIVENAME_CALLOC_SIZE, sizeof ( CHAR ) ) ;
+
+ GetDlgItemText ( hDlg, IDD_CURDRIVE, lpszDriveName, 50 ) ;
+
+ DLE_FindByName( dle_list, lpszDriveName, (INT16) -1, &dle );
+
+ pdsRestore->dle = (VOID_PTR)dle ;
+ bIsNull = FALSE ;
+
+ free ( lpszDriveName ) ;
+ }
+
+ case IDCANCEL :
+
+ if ( bIsNull ) {
+ pdsRestore->dle = (VOID_PTR) NULL ;
+ }
+ EndDialog ( hDlg, nRetCode ) ;
+ return TRUE ;
+ }
+ break ;
+ }
+ return FALSE ;
+}
diff --git a/private/utils/ntbackup/src/d_t_pswd.c b/private/utils/ntbackup/src/d_t_pswd.c
new file mode 100644
index 000000000..087f5bc69
--- /dev/null
+++ b/private/utils/ntbackup/src/d_t_pswd.c
@@ -0,0 +1,355 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_t_pswd.c
+
+ Description: Contains dialog proc and related function for
+ obtaining a password for a tape
+
+ $Log: G:/UI/LOGFILES/D_T_PSWD.C_V $
+
+ Rev 1.31 06 Aug 1993 18:13:48 chrish
+Made fix such that Cayman can read tape secured by Nostradamus under the same
+user logged in.
+
+ Rev 1.30 15 Jul 1993 10:31:20 KEVINS
+Corrected wait cursor problem when user entered wrong password.
+
+ Rev 1.29 28 Jun 1993 15:11:00 KEVINS
+Temporarily disable displaying of wait cursor when displaying password dialog box.
+
+ Rev 1.28 06 Apr 1993 17:37:36 chrish
+Added fix to TestForAlternatePassword routine to skip check
+for YY flag when calling WM_MsgBox routine.
+
+ Rev 1.28 06 Apr 1993 17:34:24 chrish
+
+ Rev 1.27 22 Mar 1993 13:45:08 chrish
+Added detection of gbCurrentOperation flag in TestForAlternatePassword routine.
+
+ Rev 1.26 19 Mar 1993 16:39:44 chrish
+Deleted decrypting password line in dm_gettapepswd routine.
+
+ Rev 1.25 10 Mar 1993 17:22:08 chrish
+Added stuff for CAYMAN NT to detect tapes secured by the Nostradamous backup
+app.
+
+ Rev 1.24 01 Nov 1992 15:57:12 DAVEV
+Unicode changes
+
+ Rev 1.23 07 Oct 1992 13:43:06 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.22 04 Oct 1992 19:37:16 DAVEV
+Unicode Awk pass
+
+ Rev 1.21 14 May 1992 16:40:22 MIKEP
+Nt pass 2
+
+ Rev 1.20 15 Apr 1992 17:38:00 CHUCKB
+Fixed LANStream tape info bug.
+
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static DS_TAPE_PSWD_PTR pdsPswd ;
+
+#ifdef CAYMAN // chs:03-22-93
+ static BOOL TestForAlternatePassword ( CHAR_PTR, INT16 ); // chs:03-22-93
+#endif // chs:03-22-93
+
+static BOOL TestForAlternatePassword ( CHAR_PTR, INT16 );
+
+/***************************************************
+
+ Name: DM_TapePswd ()
+
+ Description: dialog proc for obtaining a tape password
+
+ Modified: 9-11-91
+
+ Returns: BOOL: TRUE if a valid password was entered;
+ FALSE otherwise
+
+ Notes: called by DM_GetTapePswd
+
+ See also:
+
+*****************************************************/
+
+DLGRESULT APIENTRY DM_TapePswd (
+ HWND hdlg, // I - handle to the dialog
+ MSGID msg, // I - message to be examined
+ MP1 mp1, // I - word parameter of message
+ MP2 mp2 ) // I - long parameter of message
+{
+ CHAR szUserPswd[MAX_TAPE_PASSWORD_SIZE] ;
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+ {
+
+ CHAR szDlgTitle[MAX_UI_WIN_TITLE_SIZE];
+ CHAR szTemp[ MAX_UI_WIN_TITLE_SIZE ] ;
+
+ DM_CenterDialog( hdlg ) ;
+
+ pdsPswd = ( DS_TAPE_PSWD_PTR ) mp2 ;
+ pdsPswd->fValid = FALSE ;
+
+ // set the dialog title
+
+ RSM_StringCopy( IDS_APPMSGNAME, szDlgTitle, MAX_UI_WIN_TITLE_SIZE ) ;
+ RSM_StringCopy( IDS_MSGTITLE_TAPEPSWD, szTemp, MAX_UI_WIN_TITLE_LEN ) ;
+
+ lstrcat( szDlgTitle, TEXT(" ") );
+ lstrcat( szDlgTitle, szTemp );
+
+ SetWindowText( hdlg, szDlgTitle );
+
+ SetDlgItemText ( hdlg, IDD_T_TAPENAME, pdsPswd->lpszTapeName ) ;
+ SetDlgItemText ( hdlg, IDD_T_BSNAME, pdsPswd->lpszBsetName ) ;
+ SetDlgItemText ( hdlg, IDD_T_UNAME, pdsPswd->lpszUserName ) ;
+
+ SendDlgItemMessage( hdlg, IDD_T_PSWD, EM_LIMITTEXT, MAX_TAPE_PASSWORD_LEN, 0 ) ;
+
+ SetFocus( GetDlgItem( hdlg, IDD_T_PSWD ) ) ;
+
+ }
+
+ return TRUE ;
+
+ case WM_COMMAND : {
+
+ INT nRetVal = DM_SHOWCANCEL ;
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp1) ) {
+
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_DIALOGTAPEPSWD ) ;
+ return( TRUE ) ;
+
+ case IDOK :
+
+ GetDlgItemText ( hdlg, IDD_T_PSWD, szUserPswd, MAX_TAPE_PASSWORD_SIZE ) ;
+
+ if ( !stricmp ( szUserPswd, pdsPswd->lpszTapePswd ) ) {
+
+ pdsPswd->fValid = TRUE ;
+ nRetVal = DM_SHOWOK ;
+ }
+ else { // let him try again
+
+ if ( WM_MsgBox ( ID( IDS_BKUP_PASSWORD_ERROR_TITLE ),
+ ID( IDS_BKUP_PASSWORD_ERROR ),
+ ( WMMB_YESNO | WMMB_NOYYCHECK ),
+ WMMB_ICONQUESTION ) == WMMB_IDYES ) {
+
+ SetDlgItemText ( hdlg, IDD_T_PSWD, TEXT("") ) ;
+ SetFocus ( GetDlgItem ( hdlg, IDD_T_PSWD ) ) ;
+ WM_ShowWaitCursor ( SWC_PAUSE );
+
+ return TRUE ;
+ }
+ }
+
+ // On OK, fall through to cancel case to clean up/end the dialog
+
+ case IDCANCEL :
+
+ EndDialog ( hdlg, nRetVal ) ;
+ return TRUE ;
+ }
+ }
+
+ default :
+
+ return FALSE ;
+ break ;
+ }
+}
+
+/***************************************************
+
+ Name: DM_GetTapePswd
+
+ Description: Entry point for the app to get a tape password;
+ decides if the tape is a LANStream tape or not,
+ and chooses which dialog to display to get the
+ password for that tape. If the tape is a LANStream
+ tape, the user name and backup set name will need
+ to be displayed; if not, don't leave huge and
+ unsightly empty spaces on the screen.
+
+ Modified: 12-10-91
+
+ Returns: BOOL TRUE if the user hit the OK button;
+ FALSE otherwise
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL DM_GetTapePswd ( LPSTR lpszName, // I - name of the tape
+ LPSTR lpszBset, // I - name of a backup set
+ LPSTR lpszUser, // I - user name for this password
+ LPSTR lpszPswd, // I - the real password for this tape
+ INT16 passwdlength ) // I - length of password
+
+{
+ BOOL fRetVal ;
+ DS_TAPE_PSWD_PTR pdsTapePswd ;
+ INT nFound = FALSE ;
+ CHAR passwdbuffer[2]; // chs: 03-09-93
+
+
+ // allocate and initialize the data structure for the dialog
+
+ pdsTapePswd = (DS_TAPE_PSWD_PTR) calloc ( 1, sizeof ( DS_TAPE_PSWD ) ) ;
+ pdsTapePswd->lpszBsetName = lpszBset ;
+ pdsTapePswd->lpszUserName = lpszUser ;
+ pdsTapePswd->lpszTapeName = lpszName ;
+ pdsTapePswd->lpszTapePswd = lpszPswd ;
+
+ //
+ // Check the first character of the password for that special character
+ // to see if it was backed up by the MicroSoft backup app.
+ //
+
+#ifdef CAYMAN
+ passwdbuffer[0] = *lpszPswd; // chs: 03-10-93
+ passwdbuffer[1] = 0; // chs: 03-10-93
+
+ if ( passwdbuffer[0] == ( CHAR ) NTPASSWORDPREFIX ) {
+ return( TestForAlternatePassword ( lpszPswd, passwdlength ) );
+ }
+#endif
+
+ WM_ShowWaitCursor ( SWC_PAUSE );
+
+ // identify the entry for this dialog in the dialog callback table, then
+ // start the dialog to get the password from the user, and
+ // save the result of his attempt
+
+ if ( lpszBset ) { // this is a LANStream tape
+
+ nFound = DM_ShowDialog ( ghWndFrame, IDD_LANTAPEPSWD, pdsTapePswd ) ;
+
+ } else {
+
+ nFound = DM_ShowDialog ( ghWndFrame, IDD_TAPEPSWD, pdsTapePswd ) ;
+ }
+
+ WM_ShowWaitCursor ( SWC_RESUME );
+
+ fRetVal = ( nFound == DM_SHOWOK ) ;
+
+ // clean up and exit
+
+ free ( pdsTapePswd ) ;
+ return fRetVal ;
+}
+
+
+
+#ifdef CAYMAN
+/***************************************************************************
+
+ Name: TestForAlternatePassword
+
+ Description: The password created by the Nostradamous app. always
+ has a prefix character at the beginning of the tape
+ password. If this encountered we must check for the
+ appropriate tape password.
+
+ Returns: BOOL TRUE - password OK
+ FALSE - Password failed
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+BOOL TestForAlternatePassword ( CHAR_PTR tapepswd,
+ INT16 passwdlength ) // password length from tape selected
+
+{
+ CHAR passwdbuffer1[MAX_TAPE_PASSWORD_LEN + 1];
+ CHAR passwdbuffer2[MAX_TAPE_PASSWORD_LEN + 1];
+ LPSTR generic_str_ptr;
+ DBLK_PTR vcb_ptr;
+ INT16 currentpswdlength;
+ CHAR buffer[ MAX_UI_RESOURCE_SIZE ];
+ CHAR buffer2[ MAX_UI_RESOURCE_SIZE ];
+
+ switch ( gbCurrentOperation ) {
+
+ case OPERATION_BACKUP:
+
+ if ( DoesUserHaveThisPrivilege( TEXT( "SeBackupPrivilege" ) ) ) {
+ return( TRUE );
+ }
+ break;
+
+ case OPERATION_RESTORE:
+ case OPERATION_CATALOG:
+ if ( DoesUserHaveThisPrivilege( TEXT( "SeRestorePrivilege" ) ) ) {
+ return( TRUE );
+ }
+ break;
+
+ default:
+ return( TRUE );
+ break;
+
+ }
+
+ generic_str_ptr = GetCurrentMachineNameUserName( );
+ currentpswdlength = ( INT16 ) strlen( generic_str_ptr ) + 1;
+
+ passwdbuffer1[0] = ( CHAR ) NTPASSWORDPREFIX;
+ passwdbuffer1[1] = 0;
+ strcat( passwdbuffer1, generic_str_ptr ); // don't forget to add that
+ // special prefix character
+
+ //
+ // If password length is not equal to the length of the machine name
+ // user name, then we know right away that they are no the same
+ //
+
+ if ( passwdlength != currentpswdlength ) {
+ RSM_StringCopy( IDS_GENERAL_TAPE_SECURITY, buffer, sizeof(buffer) );
+ RSM_StringCopy( IDS_TAPE_SECURITY_TITLE, buffer2, sizeof(buffer2) );
+ WM_MsgBox( buffer2, buffer, WMMB_OK | WMMB_NOYYCHECK, WMMB_ICONEXCLAMATION ); // chs:04-06-93
+ return( FALSE ); // lengths are not equalled, thus passwords
+ // are not equalled.
+ }
+
+// chs:08-06-93 CryptPassword( ( INT16 ) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)passwdbuffer1, passwdlength );
+
+ if ( ! memcmp( passwdbuffer1, tapepswd, passwdlength ) ) {
+ return( TRUE ); // match found
+ }
+
+ //
+ // Popup dialog box message if
+ // not a valid user
+ //
+
+ RSM_StringCopy( IDS_GENERAL_TAPE_SECURITY, buffer, sizeof(buffer) );
+ RSM_StringCopy( IDS_TAPE_SECURITY_TITLE, buffer2, sizeof(buffer2) );
+ WM_MsgBox( buffer2, buffer, WMMB_OK | WMMB_NOYYCHECK, WMMB_ICONEXCLAMATION ); // chs:04-06-93
+ return ( FALSE );
+
+}
+#endif
diff --git a/private/utils/ntbackup/src/d_v_path.c b/private/utils/ntbackup/src/d_v_path.c
new file mode 100644
index 000000000..5346c92e2
--- /dev/null
+++ b/private/utils/ntbackup/src/d_v_path.c
@@ -0,0 +1,239 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: d_v_path.c
+
+ Description: contains dialog proc to specify restore target drive
+
+ $Log: G:/UI/LOGFILES/D_V_PATH.C_V $
+
+ Rev 1.14 11 Jun 1993 14:18:22 MIKEP
+enable c++
+
+ Rev 1.13 01 Nov 1992 15:57:38 DAVEV
+Unicode changes
+
+ Rev 1.12 07 Oct 1992 13:41:48 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.11 04 Oct 1992 19:37:20 DAVEV
+Unicode Awk pass
+
+ Rev 1.10 14 Sep 1992 14:26:22 DAVEV
+Transparent Unicode changes (AWK pass and strlen check)
+
+ Rev 1.9 28 Jul 1992 14:43:22 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.8 14 May 1992 16:40:16 MIKEP
+Nt pass 2
+
+ Rev 1.7 12 May 1992 21:20:52 MIKEP
+NT pass 1
+
+ Rev 1.6 27 Jan 1992 00:31:02 CHUCKB
+Updated dialog id's.
+
+ Rev 1.5 20 Jan 1992 13:55:54 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.4 10 Jan 1992 09:13:44 ROBG
+Modified HELPID.
+
+ Rev 1.3 07 Jan 1992 12:41:02 CHUCKB
+Added help.
+
+ Rev 1.2 16 Dec 1991 11:45:26 CHUCKB
+Added include windows.h.
+
+ Rev 1.1 25 Nov 1991 15:06:24 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 ?? ??? 1991 ??:??:?? ??????
+Initial revision.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/****************************************************************************
+
+ Name: DM_GetVerifyDestination
+
+ Description: Entry point for the application to request a
+ verify target drive. That drive may be a
+ server/volume or a mapped drive.
+
+ Modified:
+
+ Returns: A pointer to a DLE.
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+
+PVOID DM_GetVerifyDestination (
+
+LPSTR lpszBackupSetName, // I - Pointer to the backup set name.
+PVOID vlpServerList, // I - Pointer to server list.
+PVOID vlpDriveList ) // I - Pointer to drive list.
+
+{
+ INT16 i = 0;
+ BOOL fFound = FALSE;
+static DS_RESTORE lTemp;
+
+ lTemp.lpszBackupSetName = lpszBackupSetName;
+ lTemp.vlpServerList = vlpServerList;
+ lTemp.vlpDriveList = vlpDriveList;
+
+ if ( DM_ShowDialog ( ghWndFrame, IDD_VERIFY, (PVOID) &lTemp ) == DM_SHOWOK ) {
+
+ return ( lTemp.dle );
+
+ } else {
+
+ return NULL;
+ }
+}
+
+/***************************************************
+
+ Name: DM_VerifyTarget ()
+
+ Description: dialog proc to specify verify target drive
+
+ Modified:
+
+ Returns: boolean true if message was processed
+
+ Notes:
+
+ See also: Windows SDK
+
+*****************************************************/
+
+DLGRESULT APIENTRY DM_VerifyTarget (
+
+ HWND hDlg,
+ MSGID msg,
+ MP1 mp1,
+ MP2 mp2 )
+
+{
+ static DS_RESTORE_PTR pdsRestore;
+ DWORD dResult;
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR server_vlm;
+ LPSTR lpszDriveName;
+ BOOL bIsNull = TRUE;
+ INT nRetCode;
+ GENERIC_DLE_PTR dle;
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+
+ pdsRestore = (DS_RESTORE_PTR) mp2;
+
+ nRetCode = DM_SHOWCANCEL;
+
+ DM_CenterDialog( hDlg );
+
+ // put the backup set name and list of disk drives in
+
+ SetDlgItemText ( hDlg, IDD_BSETNAME, (pdsRestore->lpszBackupSetName) );
+
+ vlm = VLM_GetFirstVLM( (Q_HEADER_PTR) pdsRestore->vlpDriveList );
+ while ( vlm != NULL ) {
+
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_ADDSTRING,
+ 0, (MP2)vlm->name );
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+ server_vlm = VLM_GetFirstVLM( (Q_HEADER_PTR) pdsRestore->vlpServerList );
+ while ( server_vlm != NULL ) {
+
+ vlm = VLM_GetFirstVLM ( &server_vlm->children );
+ while ( vlm != NULL ) {
+
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_ADDSTRING,
+ 0, (MP2)vlm->name );
+ vlm = VLM_GetNextVLM ( vlm );
+ }
+ server_vlm = VLM_GetNextVLM ( server_vlm );
+ }
+
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_SETCURSEL, 0, (MP2) 0 );
+
+ lpszDriveName = (LPSTR) calloc ( 37, sizeof ( CHAR ) );
+
+ dResult = SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETCURSEL, 0, (MP2) 0 );
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETTEXT, (MP1) dResult, (MP2) lpszDriveName );
+ SetDlgItemText ( hDlg, IDD_CURDRIVE, lpszDriveName );
+
+ free ( lpszDriveName );
+
+ return FALSE;
+
+ case WM_COMMAND :
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_DIALOGVERIFYSET );
+ return( TRUE );
+
+ case IDD_DRIVELIST :
+
+ lpszDriveName = (LPSTR) calloc ( 37, sizeof ( CHAR ) );
+
+ dResult = SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETCURSEL, 0, (MP2) 0 );
+ SendDlgItemMessage ( hDlg, IDD_DRIVELIST, LB_GETTEXT, (MP1) dResult, (MP2) lpszDriveName );
+ SetDlgItemText ( hDlg, IDD_CURDRIVE, lpszDriveName );
+
+ free ( lpszDriveName );
+
+ return TRUE;
+ break;
+
+ case IDOK : {
+
+ BOOL done = FALSE;
+
+ nRetCode = DM_SHOWOK;
+
+ // search the VLM list for one with a dle device name that matches the
+ // string in IDD_CURDRIVE and return a pointer to that dle
+
+ lpszDriveName = (LPSTR) calloc ( 37, sizeof ( CHAR ) );
+
+ GetDlgItemText ( hDlg, IDD_CURDRIVE, lpszDriveName, 50 );
+ DLE_FindByName( dle_list, lpszDriveName, (INT16) -1, &dle );
+ pdsRestore->dle = (VOID_PTR)dle;
+ bIsNull = FALSE;
+
+ free ( lpszDriveName );
+ }
+
+ case IDCANCEL :
+
+ if ( bIsNull ) pdsRestore->dle = (VOID_PTR) NULL;
+
+ EndDialog ( hDlg, nRetCode );
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
diff --git a/private/utils/ntbackup/src/datetime.c b/private/utils/ntbackup/src/datetime.c
new file mode 100644
index 000000000..7041acef1
--- /dev/null
+++ b/private/utils/ntbackup/src/datetime.c
@@ -0,0 +1,383 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: datetime.c
+
+ Description: This file contains date time utilities.
+
+
+ $Log: M:/LOGFILES/DATETIME.C_V $
+
+ Rev 1.9 21 Jul 1993 16:08:46 BARRY
+Check for NULL return from localtime; use Win32 API for on NT in GetCurrentDate
+
+ Rev 1.8 17 Jun 1993 17:49:26 MIKEP
+C++ enable
+
+ Rev 1.7 11 Nov 1992 22:27:28 GREGG
+Removed string to date and date to string functions which are no longer used.
+
+ Rev 1.6 18 Aug 1992 09:52:54 BURT
+fix warnings
+
+ Rev 1.5 14 May 1992 12:53:20 TIMN
+msassert for dead functions, StringToDateTime CurrentDateTimetoString remove later
+
+ Rev 1.4 17 Jan 1992 17:20:56 STEVEN
+fix warnings for WIN32
+
+ Rev 1.3 06 Jan 1992 09:07:34 STEVEN
+if a date is invalid then they compare to equal
+
+ Rev 1.2 26 Jul 1991 16:14:42 STEVEN
+remove bios_time_of_day
+
+ Rev 1.1 23 Jul 1991 16:34:40 DAVIDH
+Removed warnings found by Watcom compiler.
+
+ Rev 1.0 09 May 1991 13:34:54 HUNTER
+Initial revision.
+
+**/
+#include <time.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dos.h>
+
+#if defined( OS_WIN32 )
+#include <windows.h>
+#endif
+
+#include "stdtypes.h"
+#include "datetime.h"
+#include "msassert.h"
+#include "stdmacro.h"
+
+/**/
+/**
+
+ Name: GetCurrentDate()
+
+ Description: This function gets the current date and time
+ and places it in the provided DATETIME structure.
+
+ Modified: 8/23/1989
+
+ Returns: none
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID GetCurrentDate( DATE_TIME_PTR date_time )
+{
+#if !defined( OS_WIN32 )
+ time_t ztime ;
+ struct tm *ltime;
+
+ time( &ztime ) ;
+
+ ltime = localtime( &ztime ) ;
+ if ( ltime != NULL )
+ {
+ date_time->year = (INT16)(1900 + ltime->tm_year) ;
+ date_time->month = (INT16)(ltime->tm_mon + 1 );
+ date_time->day = (INT16)(ltime->tm_mday) ;
+ date_time->hour = (INT16)(ltime->tm_hour) ;
+ date_time->minute = (INT16)(ltime->tm_min) ;
+ date_time->second = (INT16)(ltime->tm_sec) ;
+ date_time->day_of_week = (INT16)(ltime->tm_wday + 1) ;
+ date_time->date_valid = (BOOLEAN)TRUE ;
+ }
+ else
+ {
+ /*
+ * localtime() was confused by current date and time.
+ * We'll take the cheap way out and call the date 1/1/80.
+ */
+ date_time->year = 1980;
+ date_time->month = 1;
+ date_time->day = 1;
+ date_time->hour = 0;
+ date_time->minute = 0;
+ date_time->second = 0;
+ date_time->day_of_week = 3; /* 1/1/80 was a Tuesday */
+ date_time->date_valid = TRUE ;
+ }
+#else /* !defined( OS_WIN32 ) */
+
+ SYSTEMTIME localTime;
+
+ GetLocalTime( &localTime ); /* No error return */
+
+ date_time->year = (INT16)localTime.wYear;
+ date_time->month = (INT16)localTime.wMonth;
+ date_time->day = (INT16)localTime.wDay;
+ date_time->hour = (INT16)localTime.wHour;
+ date_time->minute = (INT16)localTime.wMinute;
+ date_time->second = (INT16)localTime.wSecond;
+ date_time->day_of_week = (INT16)(localTime.wDayOfWeek + 1);
+ date_time->date_valid = (BOOLEAN)TRUE ;
+
+#endif
+}
+
+
+
+/**/
+/**
+
+ Name: DOSDateTime()
+
+ Description: This function converts a DATETIME structure to DOS's
+ DTA date and time structures.
+
+ Modified: 8/23/1989
+
+ Returns: none
+
+ Notes: added -1980, ccs
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID DOSDateTime( DATE_TIME_PTR date_time, UINT16_PTR date, UINT16_PTR time )
+{
+ msassert( date != NULL );
+ msassert( time != NULL );
+
+ * date = (UINT16)(((date_time->year-1980) << 9) |
+ (date_time->month << 5) |
+ date_time->day);
+
+ * time = (UINT16)((date_time->hour << 11) |
+ (date_time->minute << 5) |
+ (date_time->second >> 1) ) ;
+}
+
+
+
+/**/
+/**
+
+ Name: datecmp()
+
+ Description: This function compares two DATE_TIME structures and returns:
+
+ zero if they are the same
+ < 0 if date_time1 < date_time2
+ > 0 if date_time1 > date_time2
+
+ Modified: 8/23/1989
+
+ Returns: none
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT32 datecmp(
+DATE_TIME_PTR dt1,
+DATE_TIME_PTR dt2 )
+{
+ INT32 diff;
+
+ diff = ( ( (INT32) dt1->year << 12) | (dt1->month << 8) | dt1->day ) -
+ ( ( (INT32) dt2->year << 12) | (dt2->month << 8) | dt2->day ) ;
+
+ if ( diff == 0 ) {
+ diff = ( ( (INT32) dt1->hour << 16) | (dt1->minute << 8) | dt1->second ) -
+ ( ( (INT32) dt2->hour << 16) | (dt2->minute << 8) | dt2->second ) ;
+ }
+
+ return diff ;
+}
+
+
+
+/**/
+/**
+
+ Name: ConvertDateDOS()
+
+ Description: Converts a DATE_TIME structure date into
+ a DOS style date.
+
+ Modified: 9/12/1989
+
+ Returns: DOS format DATE
+
+ Notes:
+
+ See also: $/SEE( ConvertTimeDOS() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+UINT16 ConvertDateDOS( DATE_TIME_PTR date )
+{
+ UINT16 ret_val ;
+
+ if (date->date_valid) {
+
+ ret_val = (UINT16)((date->year - 1980) << 9) ;
+ ret_val |= (UINT16)(date->month << 5) ;
+ ret_val |= date->day ;
+
+ } else {
+
+ ret_val = (1 << 5) | 1 ;
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: ConvertTimeDOS
+
+ Description: Converts a DATE_TIME structure time into a
+ DOS style time.
+
+ Modified: 9/12/1989
+
+ Returns: DOS format Time
+
+ Notes:
+
+ See also: $/SEE( ConvertDateDOS() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+UINT16 ConvertTimeDOS( DATE_TIME_PTR date )
+{
+ UINT16 ret_val ;
+
+ if (date->date_valid) {
+
+ ret_val = date->hour << 11 ;
+ ret_val |= date->minute << 5 ;
+ ret_val |= date->second >> 1 ;
+
+ } else {
+
+ ret_val = 0;
+ }
+
+ return ret_val ;
+}
+
+
+
+
+
+
+
+/**/
+/**
+
+ Name: DateTimeDOS()
+
+ Description:
+ Convert DOS date to DATE_TIME structure.
+
+ Modified: 9/21/1989
+
+ Returns:
+
+ Notes:
+ The DATE_TIME.day_of_week field is not calculated.
+
+ See also: $/SEE( DOSDateTime() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+VOID DateTimeDOS(
+ UINT16 DOS_date,
+ UINT16 DOS_time,
+ DATE_TIME_PTR date_time )
+
+{
+ date_time -> year = (INT16)(( DOS_date >> 9 ) + 1980) ;
+ date_time -> month = (INT16)(( DOS_date >> 5 ) & 0x000f) ;
+ date_time -> day = (INT16)(DOS_date & 0x001f) ;
+
+ date_time -> hour = (INT16)(DOS_time >> 11) ;
+ date_time -> minute = (INT16)(( DOS_time >> 5 ) & 0x003f) ;
+ date_time -> second = (INT16)(( DOS_time & 0x001f ) << 1) ;
+
+ date_time -> day_of_week = 0 ;
+ date_time -> date_valid = TRUE ;
+}
+
+
+/**/
+/**
+
+ Name: CompDate()
+
+ Description: This function compares two date.
+
+ Modified: 2/7/1990
+
+ Returns: simular to strcmp. i.e ret_val = d1 - d2
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 CompDate( DATE_TIME_PTR d1, DATE_TIME_PTR d2 )
+{
+ INT16 ret_val = 0 ;
+
+ if ( !d1->date_valid || !d2->date_valid ) {
+ ret_val = 0 ;
+
+ } else {
+
+ ret_val = d1->year - d2->year ;
+
+ if ( !ret_val ) {
+ ret_val = d1->month - d2->month ;
+ }
+ if ( !ret_val ) {
+ ret_val = d1->day - d2->day ;
+ }
+ if ( !ret_val ) {
+ ret_val = d1->hour - d2->hour ;
+ }
+ if ( !ret_val ) {
+ ret_val = d1->minute - d2->minute ;
+ }
+ if ( !ret_val ) {
+ ret_val = d1->second - d2->second ;
+ }
+ }
+
+ return ret_val;
+}
+
+
diff --git a/private/utils/ntbackup/src/dateutil.c b/private/utils/ntbackup/src/dateutil.c
new file mode 100644
index 000000000..40a80ea0b
--- /dev/null
+++ b/private/utils/ntbackup/src/dateutil.c
@@ -0,0 +1,506 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: dateutil.c
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/DATEUTIL.C_V $
+
+ Rev 1.5 07 Oct 1992 14:51:12 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.4 04 Oct 1992 19:32:28 DAVEV
+Unicode Awk pass
+
+ Rev 1.3 17 Aug 1992 13:03:48 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.2 18 May 1992 09:06:46 MIKEP
+header
+
+ Rev 1.1 19 Dec 1991 17:42:00 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.0 20 Nov 1991 19:26:14 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: DU_IsLeapYear()
+
+ Description: This routine accepts a year and determines if it is a leap year.
+
+*****************************************************************************/
+BOOLEAN DU_IsLeapYear( INT16 year )
+{
+ BOOLEAN leap_year = FALSE ;
+
+ if ( ! ( year % 100 )) {
+ if ( ! ( year % 400 )) { /* if the year is the turn of the century and it is */
+ /* is divisible by 400 then it is a leap year. */
+ leap_year = TRUE ;
+ }
+ }
+ else if ( ! ( year % 4 )) { /* if not divisible by 100 then is it divisible by 4 */
+ leap_year = TRUE ;
+ }
+ return ( leap_year ) ;
+}
+/*****************************************************************************
+
+ Name: DU_TmToDateTime()
+
+ Description: This routine will accept a tm structure and build the DATE_TIME structure.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_TmToDateTime(
+struct tm *ms_date_ptr , /* I - structure to be used to fill the new structure */
+DATE_TIME_PTR start_date ) /* IO - structure to receive the new date */
+{
+ INT16 ret_val = FAILURE ;
+
+ if ( ms_date_ptr != NULL ) {
+ ret_val = SUCCESS ;
+ start_date->date_valid = TRUE ;
+ start_date->second = ( UINT16 ) ms_date_ptr->tm_sec ;
+ start_date->minute = ( UINT16 ) ms_date_ptr->tm_min ;
+ start_date->hour = ( UINT16 ) ms_date_ptr->tm_hour ;
+ start_date->day_of_week = ( UINT16 ) (ms_date_ptr->tm_wday + 1);
+ start_date->day = ( UINT16 ) ms_date_ptr->tm_mday ;
+ start_date->month = ( UINT16 ) (ms_date_ptr->tm_mon + 1);
+ start_date->year = ( UINT16 ) ms_date_ptr->tm_year ;
+ }
+ return ( ret_val ) ;
+}
+/*****************************************************************************
+
+ Name: DU_DateTimeToTm()
+
+ Description: This routine will accept the DATE_TIME structure and build a tm structure.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_DateTimeToTm(
+struct tm *ms_date_ptr , /* IO - structure to receive the new date */
+DATE_TIME_PTR start_date ) /* I - structure to be used to fill the new structure */
+{
+ INT16 ret_val = FAILURE ;
+ INT32 rc ;
+
+ memset( ms_date_ptr, 0 , sizeof( struct tm ) );
+ ms_date_ptr->tm_sec = ( int ) start_date->second ;
+ ms_date_ptr->tm_min = ( int ) start_date->minute ;
+ ms_date_ptr->tm_hour = ( int ) start_date->hour ;
+ ms_date_ptr->tm_wday = ( int ) start_date->day_of_week -1 ;
+ ms_date_ptr->tm_mday = ( int ) start_date->day ;
+ ms_date_ptr->tm_mon = ( int ) start_date->month - 1 ;
+ ms_date_ptr->tm_year = ( int ) start_date->year ;
+ rc = mktime( ms_date_ptr ) ;
+ if ( rc != -1 ) {
+ ret_val = SUCCESS ;
+ }
+ return ( ret_val ) ;
+}
+/*****************************************************************************
+
+ Name: DU_DateTimeToTime_T()
+
+ Description: This routine takes a pointer to a structure of type DATE_TIME
+ and converts it to the number of seconds passed since 00:00:00
+ Jan 1, 1970 (GMT) and assigns that value to the time_t pointer.
+
+ Notes: MS-DOS does not understand dates prior to Jan 1, 1980.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_DateTimeToTime_T(
+time_t *timet , /* O - returns the converted value of date_time struct */
+DATE_TIME_PTR datetime ) /* I - contains the value to be converted */
+{
+ struct tm temptime ;
+ INT16 ret_val = FAILURE ;
+ INT32 rc ;
+
+
+ if ( !( rc= DU_DateTimeToTm( &temptime, datetime ))) {
+ if ( ( *timet = mktime( &temptime )) != -1 ) {
+ ret_val = SUCCESS ;
+ }
+ }
+ return ( ret_val ) ;
+}
+/*****************************************************************************
+
+ Name: DU_Time_TToDateTime()
+
+ Description: This routine takes a time_t pointer which contains a date and time
+ represented as the number of seconds passed since 00:00:00 Jan 1, 1970 (GMT),
+ and converts it to a structure of type DATE_TIME pointed to by datetime.
+ .
+ Notes: MS-DOS does not understand dates prior to Jan 1, 1980.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_Time_TToDateTime(
+time_t *timet , /* O - returns the converted value of date_time struct */
+DATE_TIME_PTR datetime ) /* I - contains the value to be converted */
+{
+ struct tm *temptime_ptr ;
+ INT16 ret_val = FAILURE ;
+ INT16 rc ;
+
+ if ( ( temptime_ptr = localtime( timet )) != NULL ) {
+
+ if ( !( rc= DU_TmToDateTime( temptime_ptr, datetime ))) {
+ ret_val = SUCCESS ;
+ }
+ }
+ return ( ret_val ) ;
+
+}
+/*****************************************************************************
+
+ Name: DU_CalcTargetDateBackwd()
+
+ Description: This routine when passed a date_time structure by reference, and the
+ number of days to go back, it will accordingly update the date_time
+ Notes: structure.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_CalcTargetDateBackwd(
+DATE_TIME_PTR start_date , /* IO - DATE_TIME structure containing start date, updated to target date */
+INT16 days_to_go_back ) /* I - integer containing number of days to go back (to calc target date) */
+{
+
+ struct tm ms_date ;
+ INT16 j_date ;
+ INT16 ret_val = FAILURE ;
+ INT16 year ;
+ INT16 rc ;
+ BOOLEAN leap_year ;
+
+
+/*
+** convert the target date to the standard day of the year ( i.e. the 232 nd day of the year )
+*/
+ if ( !( rc= DU_DateTimeToTm( &ms_date, start_date ))) {
+
+ j_date = (INT16) ms_date.tm_yday ;
+ year = start_date->year ;
+ leap_year = DU_IsLeapYear( year ) ;
+ j_date -= days_to_go_back;
+
+
+/*
+** while ( the new julian date > days in the year )
+*/
+
+ while ( j_date < 1 ) {
+
+/*
+** subtract 1 from the year
+*/
+
+ year--;
+ leap_year = DU_IsLeapYear( year ) ;
+
+/*
+** j_date += days in year
+*/
+
+ j_date += ( leap_year ? 366 : 365 ) ;
+
+
+ } /* while */
+
+
+
+ if ( !( rc= DU_JulianToDateTime( j_date, year, start_date ))) {
+ ret_val = SUCCESS ;
+ }
+
+/*
+** end if
+*/
+
+ }
+
+
+
+ return ( ret_val ) ;
+/*
+** end
+*/
+
+
+}
+/*****************************************************************************
+
+ Name: DU_CalcTargetDateFwd()
+
+ Description: This routine when passed a date_time structure by reference, and the
+ number of days to go forward, it will accordingly update the date_time
+ Notes: structure.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_CalcTargetDateFwd(
+DATE_TIME_PTR start_date , // IO - DATE_TIME structure containing start date, updated to target date
+INT16 days_to_go_fwd ) // I - integer containing number of days to go fwd (to calc target date)
+{
+
+ struct tm ms_date ;
+ INT16 j_date ;
+ INT16 ret_val = FAILURE ;
+ INT16 year ;
+ INT16 rc ;
+ BOOLEAN leap_year ;
+
+/*
+** convert the target date to the standard day of the year ( i.e. the 232 nd day of the year )
+*/
+ if ( !( rc= DU_DateTimeToTm( &ms_date, start_date ))) {
+
+ j_date = (INT16) ms_date.tm_yday ;
+ year = start_date->year ;
+ leap_year = DU_IsLeapYear( year ) ;
+ j_date += days_to_go_fwd;
+
+
+/*
+** while ( the new julian date > days in the year )
+*/
+
+ while ( j_date > (INT16) ( leap_year ? 366 : 365 )) {
+
+/*
+** j_date -= days in year
+*/
+
+ j_date -= ( leap_year ? 366 : 365 ) ;
+
+/*
+** add 1 to the year
+*/
+
+ year++ ;
+ leap_year = DU_IsLeapYear( year ) ;
+
+ } /* while */
+
+
+
+ if ( !( rc= DU_JulianToDateTime( j_date, year, start_date ))) {
+ ret_val = SUCCESS ;
+ }
+
+/*
+** end if
+*/
+
+ }
+
+
+
+ return ( ret_val ) ;
+/*
+** end
+*/
+
+}
+/*****************************************************************************
+
+ Name: DU_JuliantoDateTime()
+
+ Description: This routine takes a julian date [0-365] and a year and updates
+ the DATE_TIME structure.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_JulianToDateTime(
+INT16 j_date , /* I - contains the julian date */
+INT16 year , /* I - contains the current year */
+DATE_TIME_PTR dt ) /* O - the DATE_TIME structue to be updated */
+{
+ INT8 x ;
+ INT16 ret_val = FAILURE ;
+ struct tm temp_tm;
+ time_t tt;
+ /* J F M A M J J A S O N D */
+ static INT8 month_list[12] = {31,28,31,30,31,30,31,31,30,31,30,31} ;
+
+ if ( dt->hour > 23) {
+ dt->hour = 0;
+ }
+ if ( dt->minute > 59) {
+ dt->minute = 0;
+ }
+ if ( dt->second > 59) {
+ dt->second = 0;
+ }
+
+ if ( j_date <= 366 ) {
+ ret_val = SUCCESS ;
+
+ if ( DU_IsLeapYear( year ) ) {
+ month_list [1] = 29 ; /* if leap year, the second month (February) has 29 days */
+ }
+ for ( x=0 ; x<12 ; x++ ) {
+ if ( ( j_date - month_list [x] ) < 0 ) {
+ break ;
+ }
+ else {
+ j_date -= month_list [x] ;
+ }
+ } /* for */
+
+ dt->date_valid = TRUE ;
+ dt->year = year ;
+ dt->day = (UINT16) (j_date + 1);
+ dt->month = (UINT16) (x + 1);
+
+ DU_DateTimeToTm( &temp_tm, dt );
+
+ tt = mktime( &temp_tm );
+
+ DU_Time_TToDateTime( &tt, dt );
+
+ } /* if */
+ else {
+ dt->date_valid = FALSE ;
+ }
+ return( ret_val ) ;
+}
+/*****************************************************************************
+
+ Name: DU_CalcNumDaysFromToday()
+
+ Description: The given DATE_TIME structure is converted into a time_t
+ value. Then the current time_t is read from the system
+ clock. This routine will then calculate the difference
+ in days between the current date and the given date.
+
+ Notes: This routine will return FAILURE if the given date occurs
+ sometime in the future from the current date.
+
+ Returns: SUCCESS, FAILURE.
+
+*****************************************************************************/
+INT16 DU_CalcNumDaysFromToday(
+DATE_TIME date_time , /* I - date time to be subtracted from today's date */
+INT16_PTR days_from_today ) /* O - difference in days from given date and today's date */
+{
+ INT16 ret = FAILURE ;
+ DATE_TIME current_dt ;
+ time_t todays_time_t, tmp_time_t ;
+ INT32 seconds ;
+/*
+** Get today's date and time from the system clock and subtract 1900 from
+** the number of years.
+*/
+ GetCurrentDate( &current_dt ) ;
+ current_dt.year -= 1900 ;
+/*
+** make sure that both date_time structures are valid
+*/
+ if( date_time.date_valid && current_dt.date_valid ) {
+/*
+** get the time_t values for both DATE_TIME stuctures
+*/
+ if( DU_DateTimeToTime_T( &todays_time_t, &current_dt ) ) {
+ return FAILURE ;
+ } else {
+ if( DU_DateTimeToTime_T( &tmp_time_t, &date_time ) ) {
+ return FAILURE ;
+ }
+ }
+/*
+** calculate the number of days in the difference
+*/
+ seconds = ( INT32 ) ( todays_time_t - tmp_time_t ) ;
+ if( seconds > -1 ) {
+
+ /* 60 seconds/minute and 60 minutes/hour and 24 hours/day
+ thus 60*60*24 = the number of seconds/day or 86400 */
+ *days_from_today = (INT16 ) ((INT32 )seconds / 86400L ) ;
+ ret = SUCCESS ;
+ }
+ }
+/*
+** return SUCCESS/FAILURE
+*/
+ return ret ;
+}
+/*****************************************************************************
+
+ Name: DU_CalcNumberDaysBackwd()
+
+ Description: This routine when passed a date_time structure by reference, will calculate the
+ number of days that date is back from the current date. It will not update the
+ date_time structure at all.
+
+ Returns: SUCCESS / FAILURE
+
+*****************************************************************************/
+INT16 DU_CalcNumberDaysBackwd(
+DATE_TIME_PTR input_date , /* I - DATE_TIME structure containing input date */
+INT16_PTR days_back_ptr ) /* O - integer containing number of days back (from input date) */
+{
+ time_t input_timet ;
+ time_t today_timet ;
+ INT32 difference ;
+ INT16 ret_val = FAILURE ;
+
+ if( input_date->date_valid ) { ;
+
+/*
+** convert the input date to t_time
+*/
+ DU_DateTimeToTime_T( &input_timet, input_date ) ;
+
+/*
+** convert today's date to t_time
+*/
+ time( &today_timet ) ;
+
+/*
+** calculate the difference
+*/
+ difference = ( INT32 )( today_timet - input_timet ) ;
+
+/*
+** convert the difference to a number of days
+*/
+ *days_back_ptr = ( INT16 )( difference / 86400L ) ;
+
+ ret_val = SUCCESS ;
+
+ }
+
+ return ( ret_val ) ;
+
+
+/*
+** end
+*/
+
+
+}
diff --git a/private/utils/ntbackup/src/dblksize.c b/private/utils/ntbackup/src/dblksize.c
new file mode 100644
index 000000000..12d0e0b9f
--- /dev/null
+++ b/private/utils/ntbackup/src/dblksize.c
@@ -0,0 +1,89 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dblksize.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to determine the size of a DBLK
+
+
+ $Log: T:/LOGFILES/DBLKSIZE.C_V $
+
+ Rev 1.3 26 Oct 1993 21:07:16 GREGG
+Got rid of problematic VCB actual size calculation since no one cares what
+the "actual" size is (or even calls this function any more). It's a
+leftover from DOS days when memory was in short supply. If anyone does
+decide to call it again, be aware that it returns sizeof( DBLK ) for VCBs.
+
+ Rev 1.2 11 Aug 1993 15:07:28 DON
+Someone forgot to add the dev_name_leng to the size of the VCB!
+
+ Rev 1.1 18 Jun 1993 09:29:50 MIKEP
+enable C++
+
+ Rev 1.0 09 May 1991 13:34:58 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+#include "msassert.h"
+
+#include "fsys.h"
+/* $end$ include list */
+/**/
+/**
+
+ Name: FS_GetActualSizeDBLK()
+
+ Description: This function returns the actual size of a DBLK
+
+ Modified: 11/1/1989
+
+ Returns: the size ;
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+UINT16 FS_GetActualSizeDBLK(
+FSYS_HAND fsh , /* I - File system handle */
+DBLK_PTR dblk ) /* I - block to get size from */
+{
+ UINT16 size ;
+
+ switch( dblk->blk_type ) {
+
+ case UDB_ID:
+ case VCB_ID:
+ size = sizeof( DBLK ) ;
+ break ;
+
+ case DDB_ID:
+ case FDB_ID:
+ case IDB_ID:
+ size = fsh->tab_ptr->GetActualSizeDBLK( fsh, dblk ) ;
+ break ;
+
+ case CFDB_ID:
+ size = sizeof( CFDB ) ;
+ break ;
+
+ default :
+ msassert( FALSE ) ;
+ size = sizeof( DBLK ) ;
+ break ;
+
+ }
+
+ return size ;
+}
+
+
+
diff --git a/private/utils/ntbackup/src/ddeproc.c b/private/utils/ntbackup/src/ddeproc.c
new file mode 100644
index 000000000..97b9fec72
--- /dev/null
+++ b/private/utils/ntbackup/src/ddeproc.c
@@ -0,0 +1,142 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+RCG
+
+ Name: ddeproc.c
+
+ Description: This file contains the functions for processing messages
+ sent by Windows to a DDE Client windows.
+
+ The following routines are in this module:
+
+ WM_DDEClientWndProc
+
+ $Log: G:/UI/LOGFILES/DDEPROC.C_V $
+
+ Rev 1.9 07 Oct 1992 15:11:50 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.8 04 Oct 1992 19:32:30 DAVEV
+Unicode Awk pass
+
+ Rev 1.7 07 Jul 1992 15:52:54 MIKEP
+unicode changes
+
+ Rev 1.6 29 May 1992 15:59:30 JOHNWT
+PCH updates
+
+ Rev 1.5 29 Jan 1992 18:13:18 DAVEV
+fixed mistake
+
+ Rev 1.4 29 Jan 1992 18:00:20 DAVEV
+
+
+ * No changes
+
+ Rev 1.3 19 Dec 1991 15:24:58 GLENN
+Added windows.h
+
+ Rev 1.2 12 Dec 1991 17:09:34 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.1 02 Dec 1991 17:48:28 DAVEV
+16/32 bit Windows port changes
+
+ Rev 1.0 20 Nov 1991 19:27:22 SYSTEM
+Initial revision.
+
+**************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/****************************************************************************
+
+ Name: WM_DDEClientWndProc
+
+ Description: This function will handle the DDE processing
+ to and from the Program Manager
+
+ Modified: 8/02/1991
+
+ Returns: none
+
+ Notes: The DDEACK structure is defined as follows:
+
+ See also: d_j_prog.c
+
+****************************************************************************/
+
+BOOL mwbInInitiate ; // All there are used in d_j_prog.c
+HANDLE mwhWndServerDDE ;
+LPSTR mwszProgMan ;
+
+WINRESULT APIENTRY WM_DDEClientWndProc(
+
+ HWND hWnd, // I - Handle to window
+ MSGID message, // I - Message
+ MP1 mp1, // I - Additional Information
+ MP2 mp2 ) // I - Additional Information
+{
+
+ HWND hWndClientDDE ;
+ HWND hWndServerDDE ;
+ LPSTR pszAtom ;
+ LPSTR pszApplication ;
+
+ hWndClientDDE = hWnd ;
+
+ switch (message) {
+
+ case WM_DDE_ACK:
+ // Processing from a WM_DDE_INITIATE
+
+ hWndServerDDE = GET_WM_DDE_ACK_HWND ( mp1, mp2 );
+
+ if ( mwbInInitiate ) {
+
+ // Verify that the atom names are correct.
+
+ // mwhWndServerDDE will be checked by function
+ // 'AddJobToProgManWindow'.
+
+ pszAtom = (LPSTR) calloc ( 256, sizeof ( CHAR ) ) ;
+ pszApplication = (LPSTR) calloc ( 256, sizeof ( CHAR ) ) ;
+
+ GlobalGetAtomName( GET_WM_DDE_ACK_APPL( mp1, mp2 ),
+ pszApplication, 255 ) ;
+ GlobalGetAtomName( GET_WM_DDE_ACK_TOPIC ( mp1, mp2 ),
+ pszAtom, 255 ) ;
+
+ if ( ( strcmpi( pszAtom, mwszProgMan ) == 0 ) &&
+ ( strcmpi( pszApplication, mwszProgMan) == 0 ) ) {
+ mwhWndServerDDE = hWndServerDDE ;
+ }
+ }
+
+ return (0L);
+ break ;
+
+ case WM_DDE_TERMINATE:
+
+ hWndServerDDE = (HWND) mp1;
+
+ // Server has requested terminate: respond with a terminate
+ // when hWndClientDDE exists.
+
+ if ( IsWindow( hWndClientDDE ) ) {
+ PostMessage( hWndServerDDE, WM_DDE_TERMINATE, (MP1)hWndClientDDE, (MP2)0 ) ;
+ }
+
+ return (0L);
+ break ;
+
+ default:
+ return (DefWindowProc(hWnd, message, mp1, mp2 ) );
+ }
+}
+
+
diff --git a/private/utils/ntbackup/src/debug.c b/private/utils/ntbackup/src/debug.c
new file mode 100644
index 000000000..2e1b09458
--- /dev/null
+++ b/private/utils/ntbackup/src/debug.c
@@ -0,0 +1,754 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: debug.c
+
+ Description: This file contains the functions for the GUI Debug
+ Manager (DBM). The functions handle displaying the debug
+ window. The Debug Manager uses the Display List Manager
+ to list and display the debug messages.
+
+ $Log: G:/UI/LOGFILES/DEBUG.C_V $
+
+ Rev 1.23 11 Jun 1993 14:19:14 MIKEP
+enable c++
+
+ Rev 1.22 06 Jan 1993 10:18:58 GLENN
+Miscellaneous window validations.
+
+ Rev 1.21 14 Dec 1992 12:17:38 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.20 11 Nov 1992 16:29:44 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.19 05 Nov 1992 16:56:34 DAVEV
+fix ts
+
+ Rev 1.18 01 Nov 1992 15:44:52 DAVEV
+Unicode changes
+
+ Rev 1.17 30 Oct 1992 15:46:36 GLENN
+Added Frame and MDI Doc window size and position saving and restoring.
+
+ Rev 1.16 14 Oct 1992 15:50:22 GLENN
+Added /ZL debug logging command line support.
+
+ Rev 1.15 07 Oct 1992 15:09:30 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.14 04 Oct 1992 19:32:32 DAVEV
+Unicode Awk pass
+
+ Rev 1.13 28 Jul 1992 14:41:46 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.12 19 May 1992 11:58:40 MIKEP
+mips changes
+
+ Rev 1.11 15 May 1992 13:35:40 MIKEP
+nt pass 2
+
+ Rev 1.10 01 Apr 1992 14:37:10 ROBG
+Fixed problem with resetting the debug window.
+
+ Rev 1.9 30 Mar 1992 11:12:58 MIKEP
+change debug log to append
+
+ Rev 1.8 20 Mar 1992 14:48:32 GLENN
+Fixed debug to file problems.
+
+ Rev 1.7 19 Mar 1992 09:30:00 MIKEP
+debug to file
+
+ Rev 1.6 11 Feb 1992 17:26:24 GLENN
+Removed multitask call.
+
+ Rev 1.5 27 Jan 1992 00:30:24 CHUCKB
+Updated dialog id's.
+
+ Rev 1.4 19 Dec 1991 15:26:10 GLENN
+Added windows.h
+
+ Rev 1.3 12 Dec 1991 17:08:38 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.2 10 Dec 1991 14:24:48 GLENN
+Changed the WM_Create to create a listbox with a single column
+
+ Rev 1.1 04 Dec 1991 18:45:38 GLENN
+Added window create macros
+
+ Rev 1.0 20 Nov 1991 19:24:58 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// MODULE WIDE VARIABLES
+
+Q_HEADER_PTR mwpDebugQueue;
+
+FILE *mwhDebugFile = NULL;
+
+// PRIVATE FUNCTION PROTOTYPES
+
+VOID DBM_InsertStartMsg ( VOID );
+BOOL DBM_DeleteItem ( VOID );
+VOID_PTR DBM_SetTag ( DEBUGITEM_PTR, BYTE );
+BYTE DBM_GetTag ( DEBUGITEM_PTR );
+UINT DBM_GetItemCount ( Q_HEADER_PTR );
+VOID_PTR DBM_GetFirstItem ( Q_HEADER_PTR );
+VOID_PTR DBM_GetPrevItem ( DEBUGITEM_PTR );
+VOID_PTR DBM_GetNextItem ( DEBUGITEM_PTR );
+VOID_PTR DBM_GetObjects ( DEBUGITEM_PTR );
+VOID_PTR DBM_SetObjects ( DEBUGITEM_PTR, WORD, BYTE );
+
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: DBM_Init()
+
+ Description: This function initializes and creates the debug window.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL DBM_Init ( VOID )
+
+{
+ WININFO_PTR pWinInfo;
+ DLM_INIT dsDLM;
+ CDS_PTR pCDS = CDS_GetPerm ();
+ CHAR szBuffer[ 100 ];
+
+ // If the debug config stuff is not initialized, set it to the defaults.
+
+ if ( ! CDS_GetDebugWindowShowAll ( pCDS ) ) {
+
+ if ( ! CDS_GetDebugWindowNumLines ( pCDS ) ) {
+ CDS_SetDebugWindowNumLines ( pCDS, DBM_NUM_LINES );
+ }
+ else if ( CDS_GetDebugWindowNumLines ( pCDS ) < DBM_MIN_LINES ) {
+ CDS_SetDebugWindowNumLines ( pCDS, DBM_MIN_LINES );
+ }
+ else if ( CDS_GetDebugWindowNumLines ( pCDS ) > DBM_MAX_LINES ) {
+ CDS_SetDebugWindowNumLines ( pCDS, DBM_MAX_LINES );
+ }
+
+ }
+
+ // Open debug file
+
+ if ( CDS_GetDebugToFile ( pCDS ) ) {
+
+ strcpy( szBuffer, pCDS->data_path );
+ strcat( szBuffer, pCDS->debug_file_name );
+
+ mwhDebugFile = UNI_fopen( szBuffer, _O_TEXT|_O_APPEND );
+ }
+
+ mwpDebugQueue = (Q_HEADER_PTR)calloc ( 1, sizeof ( Q_HEADER ) );
+
+ InitQueue( mwpDebugQueue );
+
+ // Insert the start message into the debug queue.
+
+ DBM_InsertStartMsg ();
+
+ // Create the debug window.
+
+ pWinInfo = (WININFO_PTR)calloc ( 1, sizeof ( DS_WMINFO ) );
+
+ WMDS_SetWinType ( pWinInfo, WMTYPE_DEBUG );
+ WMDS_SetWinClosable ( pWinInfo, FALSE );
+ WMDS_SetCursor ( pWinInfo, RSM_CursorLoad ( ID(IDRC_ARROW) ) );
+ WMDS_SetIcon ( pWinInfo, RSM_IconLoad ( IDRI_DEBUG ) );
+ WMDS_SetRibbon ( pWinInfo, ghRibbonMain );
+ WMDS_SetFlatList ( pWinInfo, mwpDebugQueue );
+
+ DLM_ListBoxType ( &dsDLM, DLM_FLATLISTBOX );
+ DLM_Mode ( &dsDLM, DLM_SINGLECOLUMN );
+ DLM_Display ( &dsDLM, DLM_SMALL_BITMAPS );
+ DLM_DispHdr ( &dsDLM, mwpDebugQueue );
+ DLM_TextFont ( &dsDLM, DLM_SYSTEM_FONT );
+ DLM_GetItemCount ( &dsDLM, DBM_GetItemCount );
+ DLM_GetFirstItem ( &dsDLM, DBM_GetFirstItem );
+ DLM_GetNext ( &dsDLM, DBM_GetNextItem );
+ DLM_GetPrev ( &dsDLM, DBM_GetPrevItem );
+ DLM_GetObjects ( &dsDLM, DBM_GetObjects );
+ DLM_SetObjects ( &dsDLM, DBM_SetObjects );
+ DLM_GetTag ( &dsDLM, DBM_GetTag );
+ DLM_SetTag ( &dsDLM, DBM_SetTag );
+ DLM_GetSelect ( &dsDLM, NULL );
+ DLM_SetSelect ( &dsDLM, NULL );
+ DLM_SSetItemFocus ( &dsDLM, NULL );
+ DLM_MaxNumObjects ( &dsDLM, 6 );
+
+ DLM_DispListInit ( pWinInfo, &dsDLM );
+
+ ghWndDebug = WM_Create( (WORD)(WM_MDIPRIMARY | WM_FLATLISTSC | CDS_GetDebugInfo ( pCDS ).nSize),
+ TEXT("Debug Window"),
+ (LPSTR)NULL,
+ (INT)CDS_GetDebugInfo ( pCDS ).x,
+ (INT)CDS_GetDebugInfo ( pCDS ).y,
+ (INT)CDS_GetDebugInfo ( pCDS ).cx,
+ (INT)CDS_GetDebugInfo ( pCDS ).cy,
+ pWinInfo );
+
+ DLM_DispListProc( pWinInfo->hWndFlatList, 0, NULL );
+
+ WM_Show( ghWndDebug );
+
+ return( SUCCESS );
+
+} /* DBM_Init() */
+
+
+/******************************************************************************
+
+ Name: DBM_InsertStartMsg()
+
+ Description: This function inserts a start message in the debug window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID DBM_InsertStartMsg( VOID )
+
+{
+ DEBUGITEM_PTR pDebugItem;
+
+ pDebugItem = (DEBUGITEM_PTR) malloc ( sizeof ( DS_DEBUGITEM ) );
+ pDebugItem->pQElem.q_ptr = pDebugItem;
+ strncpy ( (CHAR_PTR)pDebugItem->szMsg, TEXT("Start of Debug Messages..."), DBM_LINELENGTH );
+ EnQueueElem ( mwpDebugQueue, &pDebugItem->pQElem, FALSE );
+
+ if ( mwhDebugFile ) {
+ fprintf( mwhDebugFile, TEXT("%s\n"), pDebugItem->szMsg );
+ }
+
+} /* end DBM_InsertStartMsg() */
+
+
+/******************************************************************************
+
+ Name: DBM_InsertItem()
+
+ Description: This function inserts a message in the debug window.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL DBM_InsertItem (
+
+CHAR_PTR szMsg ) // I - pointer to a message string
+
+{
+ DEBUGITEM_PTR pDebugItem;
+ Q_ELEM_PTR q;
+ HWND hWnd;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ if ( ! gfDebug || ! CDS_GetDebugToWindow ( pCDS ) || ! ghWndDebug ) {
+ return SUCCESS;
+ }
+
+ if ( mwhDebugFile ) {
+ fprintf( mwhDebugFile, TEXT("%s\n"), szMsg );
+ }
+
+ // If there is a limit on the number of messages and the limit has been
+ // reached, just recycle the queue element, then tell the Display List
+ // Manager to delete the first item in the list. Otherwise, add the new
+ // item.
+
+ if ( ! CDS_GetDebugWindowShowAll ( pCDS ) &&
+ QueueCount ( mwpDebugQueue ) >= CDS_GetDebugWindowNumLines ( pCDS ) ) {
+
+ q = DeQueueElem ( mwpDebugQueue );
+ pDebugItem = (DEBUGITEM_PTR)QueuePtr ( q );
+ DLM_Update ( ghWndDebug, DLM_FLATLISTBOX, WM_DLMDELETEITEMS, (LMHANDLE)NULL, 1 ) ;
+ }
+ else {
+ // Create the item structure.
+
+ pDebugItem = (DEBUGITEM_PTR) calloc ( 1, sizeof ( DS_DEBUGITEM ) );
+
+ if ( ! pDebugItem ) {
+ return SUCCESS;
+ }
+
+ pDebugItem->pQElem.q_ptr = pDebugItem;
+ }
+
+ strncpy ( (CHAR_PTR)pDebugItem->szMsg, szMsg, DBM_LINELENGTH );
+
+ // Insert message into the debug queue.
+
+ EnQueueElem ( mwpDebugQueue, &pDebugItem->pQElem, FALSE );
+
+ q = QueuePrev ( &(pDebugItem->pQElem) );
+
+ DLM_Update ( ghWndDebug, DLM_FLATLISTBOX, WM_DLMADDITEMS, (LMHANDLE)QueuePtr( q ), 1 ) ;
+
+ // Now set the anchor to the newly inserted item.
+
+ hWnd = (WM_GetInfoPtr ( ghWndDebug ))->hWndFlatList ;
+
+ DLM_ScrollListBox ( hWnd, DLM_SCROLLBOTTOM );
+
+ return( SUCCESS );
+
+} /* end DBM_InsertItem() */
+
+/******************************************************************************
+
+ Name: DBM_Deinit()
+
+ Description: This function closes the debug file if open.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL DBM_Deinit( )
+{
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ gfDebug = FALSE;
+
+ if ( mwhDebugFile ) {
+ fclose( mwhDebugFile );
+ }
+
+ mwhDebugFile = NULL;
+
+ if ( IsWindow ( ghWndDebug ) ) {
+ CDS_WriteDebugWinSize ( ghWndDebug );
+ }
+
+ return SUCCESS;
+}
+
+
+/******************************************************************************
+
+ Name: DBM_Reset()
+
+ Description: This function clears out all messages in the debug window
+ or the debug file.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL DBM_Reset (
+
+WORD wType ) // I - Type of reset
+
+{
+ Q_ELEM_PTR pQElem;
+ CHAR szBuffer[ 100 ];
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ switch ( wType ) {
+
+ case DBM_WINDOW: // Clear all the messages in the debug window.
+
+ pQElem = DeQueueElem( mwpDebugQueue );
+
+ while ( pQElem != NULL ) {
+
+ free ( QueuePtr ( pQElem ) );
+ pQElem = DeQueueElem( mwpDebugQueue ); // get next item
+ }
+
+ DBM_InsertStartMsg ();
+
+ DLM_Update ( ghWndDebug, DLM_FLATLISTBOX, WM_DLMUPDATELIST, (LMHANDLE)NULL, 0 );
+
+ break;
+
+ case DBM_FILE: // Rewind the debug recording file.
+
+ if ( mwhDebugFile ) {
+ fclose( mwhDebugFile );
+
+ strcpy( szBuffer, pCDS->data_path );
+ strcat( szBuffer, pCDS->debug_file_name );
+
+ mwhDebugFile = UNI_fopen( szBuffer, _O_TEXT );
+ }
+
+ break;
+ }
+
+ return SUCCESS;
+
+} /* end DBM_Reset() */
+
+
+/******************************************************************************
+
+ Name: DBM_SetDebugToFile()
+
+ Description: This function turns debugging to file on and off.
+
+ Returns: TRUE if turned on, otherwise FALSE.
+
+******************************************************************************/
+
+BOOL DBM_SetDebugToFile (
+
+BOOL fOn ) // I - on or off
+
+{
+ CHAR szBuffer[ 100 ];
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ // Turn debugging off only if it is on and we are told to do so.
+
+ if ( ! fOn && mwhDebugFile ) {
+
+ fclose ( mwhDebugFile );
+ mwhDebugFile = NULL;
+ }
+ else if ( fOn && ! mwhDebugFile ) {
+
+ strcpy ( szBuffer, pCDS->data_path );
+ strcat ( szBuffer, pCDS->debug_file_name );
+
+ mwhDebugFile = UNI_fopen ( szBuffer, _O_TEXT|_O_APPEND );
+ }
+
+ return (BOOL) ( mwhDebugFile != NULL );
+
+} /* end DBM_SetDebugToFile() */
+
+
+/******************************************************************************
+
+ Name: DBM_GetMsgCount()
+
+ Description: This function gets the number of window or file messages
+ depending on the type specified.
+
+ Returns: The number of messages.
+
+******************************************************************************/
+
+INT DBM_GetMsgCount (
+
+WORD wType ) // I - Type of messages to count
+
+{
+ switch ( wType ) {
+
+ case DBM_WINDOW: // Get the number of messages in the debug window.
+
+ return( QueueCount( mwpDebugQueue ) );
+
+ break;
+
+ case DBM_FILE:
+
+ break;
+ }
+
+
+ return 0;
+
+} /* end DBM_GetMsgCount () */
+
+
+/******************************************************************************
+
+ Name: DBM_SetMsgCount()
+
+ Description: This function sets the number of window or file messages
+ depending on the type specified.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL DBM_SetMsgCount (
+
+WORD wType, // I - Type of message to set the max count for
+INT count ) // I - Number of messages to keep
+
+{
+ CDS_PTR pCDS = CDS_GetCopy ();
+
+ switch ( wType ) {
+
+ case DBM_WINDOW: // Set the number of messages in the debug window.
+
+ // Save count to configuration.
+
+ CDS_SetDebugWindowNumLines ( pCDS, (INT16)count );
+
+
+ break;
+
+ case DBM_FILE:
+
+ break;
+ }
+
+
+ return SUCCESS;
+
+} /* end DBM_SetMsgCount() */
+
+
+/******************************************************************************
+
+ Name: DBM_DeleteItem()
+
+ Description: This function deletes something. UNDETERMINED
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL DBM_DeleteItem ( VOID )
+
+{
+ // Get the number of log files to keep.
+
+ // How many log files do we have?
+
+ // Delete any extra log files starting with the oldest, etc...
+
+ return SUCCESS;
+
+} /* end DBM_DeleteItem() */
+
+
+// DISPLAY LIST MANAGER CALL BACK FUNCTIONS.
+
+
+/******************************************************************************
+
+ Name: DBM_SetTag()
+
+ Description: This function sets the tag status of an item structure.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID_PTR DBM_SetTag (
+
+DEBUGITEM_PTR pDebugItem, // I - pointer to a list item
+BYTE bState ) // I - state to set the item to
+
+{
+ pDebugItem->bTag = bState;
+ return( (VOID_PTR)NULL );
+}
+
+
+/******************************************************************************
+
+ Name: DBM_GetTag()
+
+ Description: This function gets the tag status for the
+ Display List Manager.
+
+ Returns: The tag status of the item.
+
+******************************************************************************/
+
+BYTE DBM_GetTag (
+
+DEBUGITEM_PTR pDebugItem ) // I - pointer to a list item
+
+{
+ return( pDebugItem->bTag );
+}
+
+
+/******************************************************************************
+
+ Name: DBM_GetItemCount()
+
+ Description: This function gets the item count in our list for the
+ Display List Manager.
+
+ Returns: The number of items in the list.
+
+******************************************************************************/
+
+UINT DBM_GetItemCount (
+
+Q_HEADER_PTR queue ) // I - pointer to a debug queue.
+
+{
+ return( QueueCount( queue ) );
+}
+
+
+/******************************************************************************
+
+ Name: DBM_GetFirstItem()
+
+ Description: This function returns the first item for the
+ Display List Manager.
+
+ Returns: The first item in the list.
+
+******************************************************************************/
+
+VOID_PTR DBM_GetFirstItem (
+
+Q_HEADER_PTR queue ) // I - pointer to a debug queue.
+
+{
+ Q_ELEM_PTR q;
+
+ q = QueueHead( queue );
+
+ return( (q) ? (VOID_PTR)QueuePtr(q) : (VOID_PTR)NULL );
+}
+
+
+/******************************************************************************
+
+ Name: DBM_GetPrevItem()
+
+ Description: This function returns the previous list item for the
+ Display List Manager.
+
+ Returns: The previous item in the list.
+
+******************************************************************************/
+
+VOID_PTR DBM_GetPrevItem (
+
+DEBUGITEM_PTR pDebugItem ) // I - pointer to a list item
+
+{
+ Q_ELEM_PTR q;
+
+ q = QueuePrev( &(pDebugItem->pQElem) );
+
+ return( (q) ? (VOID_PTR)QueuePtr(q) : (VOID_PTR)NULL );
+}
+
+
+/******************************************************************************
+
+ Name: DBM_GetNextItem()
+
+ Description: This function returns the next list item for the
+ Display List Manager.
+
+ Returns: The next item in the list.
+
+******************************************************************************/
+
+VOID_PTR DBM_GetNextItem (
+
+DEBUGITEM_PTR pDebugItem ) // I - pointer to a list item
+
+{
+ Q_ELEM_PTR q;
+
+ q = QueueNext( &(pDebugItem->pQElem) );
+
+ return( (q) ? (VOID_PTR)QueuePtr(q) : (VOID_PTR)NULL );
+}
+
+
+/******************************************************************************
+
+ Name: DBM_GetObjects()
+
+ Description: This function returns a given object and gets the
+ information that needs to be displayed by Display List
+ Manager.
+
+ Returns: The list of objects to be displayed.
+
+******************************************************************************/
+
+VOID_PTR DBM_GetObjects (
+
+DEBUGITEM_PTR pDebugItem ) // I - pointer to a list item
+
+{
+ INT8_PTR memblk;
+ DLM_ITEM_PTR pItem;
+ WININFO_PTR pWinInfo;
+
+ pWinInfo = WM_GetInfoPtr( ghWndDebug );
+ memblk = (INT8_PTR)DLM_GetObjectsBuffer( pWinInfo->hWndFlatList );
+
+ // Store the number of items in the first two bytes.
+
+ *memblk = 1;
+
+ pItem = (DLM_ITEM_PTR)( memblk + 6 );
+
+ // Set up the text string to be displayed.
+
+ DLM_ItemcbNum( pItem ) = 1;
+ DLM_ItembType( pItem ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( pItem ) = 0;
+ DLM_ItembMaxTextLen( pItem ) = DBM_LINELENGTH;
+ DLM_ItembLevel( pItem ) = 0;
+ DLM_ItembTag( pItem ) = 0;
+ strncpy( (CHAR_PTR)DLM_ItemqszString( pItem ), (CHAR_PTR)pDebugItem->szMsg, DBM_LINELENGTH );
+
+ return memblk;
+}
+
+
+/******************************************************************************
+
+ Name: DBM_SetObjects()
+
+ Description: This function performs an action based on a click or
+ double-click on an item that is in the list.
+
+ Returns: NULL.
+
+******************************************************************************/
+
+VOID_PTR DBM_SetObjects (
+
+DEBUGITEM_PTR pDebugItem, // I - pointer to a list item
+WORD wEvent, // I - type of event
+BYTE bSubItem ) // I - sub item
+
+{
+ DBG_UNREFERENCED_PARAMETER ( pDebugItem ); // dvc - I presume these will
+ DBG_UNREFERENCED_PARAMETER ( bSubItem ); // be used in the future
+
+ // Let's show the debug settings dialog if the user double clicks on
+ // a debug message.
+
+ if ( wEvent == WM_DLMDBCLK ) {
+ DM_ShowDialog ( ghWndDebug, IDD_SETTINGSDEBUGWINDOW, (VOID_PTR)0 );
+ }
+
+ return (VOID_PTR)NULL;
+
+} /* end DBM_SetObjects() */
+
+
diff --git a/private/utils/ntbackup/src/debug.ico b/private/utils/ntbackup/src/debug.ico
new file mode 100644
index 000000000..b3c663b78
--- /dev/null
+++ b/private/utils/ntbackup/src/debug.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/defchan.c b/private/utils/ntbackup/src/defchan.c
new file mode 100644
index 000000000..ec8537f91
--- /dev/null
+++ b/private/utils/ntbackup/src/defchan.c
@@ -0,0 +1,63 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: defchan.c
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/DEFCHAN.C_V $
+
+ Rev 1.7 26 Jul 1993 18:01:32 MARINA
+enable c++
+
+ Rev 1.6 07 Oct 1992 14:51:24 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.5 04 Oct 1992 19:32:36 DAVEV
+Unicode Awk pass
+
+ Rev 1.4 17 Aug 1992 13:04:12 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.3 28 Jul 1992 14:43:38 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.2 18 May 1992 09:06:48 MIKEP
+header
+
+ Rev 1.1 18 Dec 1991 14:07:18 GLENN
+Added windows.h
+
+ Rev 1.0 20 Nov 1991 19:24:42 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+VOID DefineChannel(
+BE_INIT_STR_PTR be_ptr )
+{
+ THW_PTR cur_thw ;
+ INT16 i ;
+ UINT16 num_resources ;/* number of items in resource */
+ UINT16 error ; /* resource manager error */
+ Q_HEADER tmp_q ;
+
+ /* Set Up the Head of the list */
+ cur_thw = *be_ptr->thw_list_ptr ;
+ i = 1 ;
+
+ InitQueue( &tmp_q ) ;
+
+ while( cur_thw != NULL ) {
+ EnQueueElem( &tmp_q, ( Q_ELEM_PTR ) &cur_thw->channel_link, FALSE ) ;
+ sprintf( &cur_thw->drv_name[0], (LPSTR)RM_GetResource( rm, (UINT)SES_ENG_MSG, (UINT)RES_TAPE_DRIVE_NAME, &num_resources, &error ), i++ ) ;
+ cur_thw = ( THW_PTR ) QueueNext( &cur_thw->link ) ;
+ }
+ return ;
+}
diff --git a/private/utils/ntbackup/src/defltblk.c b/private/utils/ntbackup/src/defltblk.c
new file mode 100644
index 000000000..72dcccfc7
--- /dev/null
+++ b/private/utils/ntbackup/src/defltblk.c
@@ -0,0 +1,167 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: defltblk.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to set the defaults
+ for the Create request structures.
+
+
+ $Log: J:/LOGFILES/DEFLTBLK.C_V $
+
+ Rev 1.12 21 Jan 1993 18:41:50 DON
+Added access_date to fix read page fault
+
+ Rev 1.11 11 Nov 1992 09:52:30 GREGG
+Unicodeized literals.
+
+ Rev 1.10 18 Aug 1992 10:12:00 STEVEN
+fix warnings
+
+ Rev 1.9 12 Mar 1992 15:51:08 STEVEN
+64 bit changes
+
+ Rev 1.8 24 Feb 1992 17:37:16 STEVEN
+added support for NTFS
+
+ Rev 1.7 05 Dec 1991 15:30:06 BARRY
+Added SMS object to FS_CreateDefaultDBLK().
+
+ Rev 1.6 30 Oct 1991 10:26:22 LORIB
+Changes for ACL. Changed the OS version for OS/2 to FS_PC_OS2_ACL_VER.
+
+ Rev 1.5 01 Oct 1991 11:14:42 BARRY
+Include standard headers.
+
+ Rev 1.4 12 Aug 1991 13:40:18 DON
+fixes for NLM
+
+ Rev 1.3 24 Jul 1991 09:11:46 DAVIDH
+Corrected warning found by Watcom.
+
+ Rev 1.2 27 Jun 1991 09:42:16 STEVEN
+fix typeo
+
+ Rev 1.1 24 Jun 1991 09:19:10 STEVEN
+need to initialize version
+
+ Rev 1.0 09 May 1991 13:39:56 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+
+#include "msassert.h"
+#include "fsys.h"
+#include "novcom.h"
+#include "tbe_defs.h"
+
+/* $end$ include list */
+
+static DATE_TIME today_date = { 0, 1980, 1, 1, 1, 0, 0 } ;
+static DATE_TIME dummy_date = { 1, 1980, 1, 1, 1, 0, 0 } ;
+
+static CHAR dummy_fname[] = TEXT("NO_NAME") ;
+static INT16 dummy_fname_size = sizeof( dummy_fname ) ;
+
+static CHAR dummy_path[] = TEXT("") ;
+static INT16 dummy_path_size = sizeof( dummy_path ) ;
+
+static CHAR dummy_part_name[] = TEXT("PARTITION") ;
+static INT16 dummy_part_name_size = sizeof( dummy_part_name ) ;
+
+/**/
+/**
+
+ Name: FS_SetDefaultDBLK()
+
+ Description: This function initializes the structure passed to the
+ DBLK create routines.
+
+ Modified: 9/13/1989
+
+ Returns: none
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID FS_SetDefaultDBLK(
+FSYS_HAND fsh, /* I - file system handle */
+INT8 blk_type, /* I - type of block to create */
+CREATE_DBLK_PTR data ) /* O - structure to initialize */
+{
+
+ (VOID) fsh ;
+
+ msassert( fsh != NULL ) ;
+
+ if( !today_date.date_valid ) {
+ GetCurrentDate( &today_date ) ;
+ }
+
+ switch ( blk_type ) {
+
+ case UDB_ID:
+ memset( &(data->u), 0, sizeof(data->u) ) ;
+ break ;
+
+ case VCB_ID:
+ memset( &(data->v), 0, sizeof(data->v) ) ;
+ data->v.date = &today_date ;
+ data->v.sw_major_ver = BE_MAJ_VERSION ;
+ data->v.sw_minor_ver = BE_MIN_VERSION ;
+ break ;
+
+ case DDB_ID:
+ memset( &(data->d), 0, sizeof(data->d) ) ;
+ data->d.path_name = dummy_path ;
+ data->d.path_size = dummy_path_size ;
+ data->d.creat_date = &today_date ;
+ data->d.mod_date = &today_date ;
+ data->d.backup_date = &dummy_date ;
+ data->d.access_date = &dummy_date ;
+ break ;
+
+ case FDB_ID:
+ memset( &(data->f), 0, sizeof(data->f) ) ;
+ data->f.fname = dummy_fname ;
+ data->f.fname_size = dummy_fname_size ;
+ data->f.creat_date = &dummy_date ;
+ data->f.mod_date = &today_date ;
+ data->f.backup_date = &dummy_date ;
+ data->f.access_date = &dummy_date ;
+ break ;
+
+ case IDB_ID:
+ memset( &(data->i), 0, sizeof(data->i) ) ;
+ data->i.pname = dummy_part_name;
+ data->i.pname_size = dummy_part_name_size ;
+
+ break ;
+
+ case CFDB_ID:
+ memset( &(data->c), 0, sizeof(data->c) ) ;
+ break ;
+
+ default:
+ msassert( ("Bad block type ", FALSE) ) ;
+ break ;
+ }
+
+ if ( fsh->tab_ptr->InitMakeData != NULL ) {
+ fsh->tab_ptr->InitMakeData( fsh, blk_type, data ) ;
+ }
+
+ return ;
+}
diff --git a/private/utils/ntbackup/src/details.c b/private/utils/ntbackup/src/details.c
new file mode 100644
index 000000000..71c3c0cdc
--- /dev/null
+++ b/private/utils/ntbackup/src/details.c
@@ -0,0 +1,1756 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: details.c
+
+ Description: This module contains miscellaneous functions within the USER INTERFACE for displaying information.
+ Most of the functions found here were at one time in-line code which needed to be shared by several
+ functions/modules.
+
+ $Log: J:/UI/LOGFILES/DETAILS.C_V $
+
+ Rev 1.44.1.5 06 Jul 1994 18:30:14 GREGG
+Fixed routine that checks for write protect and write protect error handling.
+
+ Rev 1.44.1.4 20 Feb 1994 10:51:44 MIKEP
+make extended error reportin cleaner in logfile
+
+ Rev 1.44.1.3 07 Feb 1994 02:06:32 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.44.1.2 28 Jan 1994 18:09:32 MIKEP
+Display extended error messages in the logfile
+
+ Rev 1.44.1.1 24 Jan 1994 14:02:58 GREGG
+Fixed GEN_ERR_UNDETERMINED string.
+
+ Rev 1.44.1.0 17 Jan 1994 15:22:26 MIKEP
+fix warnings
+
+ Rev 1.44 05 Jan 1994 20:19:50 GREGG
+Changed string defines for extended error reporting.
+
+ Rev 1.43 05 Jan 1994 11:35:36 GREGG
+Added support for extended error reporting.
+
+ Rev 1.42 15 Dec 1993 16:57:52 GREGG
+Fixed buffer overflow problem.
+
+ Rev 1.41 29 Sep 1993 17:10:20 MIKEP
+handle LP_ACCESS_DENIED better
+
+ Rev 1.40 15 Sep 1993 13:49:42 CARLS
+added UI_BuildFullPathFromDDB2 to build the full path for Log files
+
+ Rev 1.39 03 Aug 1993 14:52:46 MIKEP
+add sypl flag
+
+ Rev 1.38 23 Jul 1993 13:07:52 MIKEP
+
+ Rev 1.37 14 Jun 1993 20:37:36 MIKEP
+enable c++
+
+ Rev 1.36 02 Jun 1993 16:00:38 CARLS
+set BOOLEAN trunc_last to FALSE at start up in routine UI_FixPath
+
+ Rev 1.35 14 May 1993 15:09:58 MIKEP
+Change the num seconds operation took to 1 if it was 0.
+
+ Rev 1.34 02 Apr 1993 15:51:50 CARLS
+changes for DC2000 unformatted tape
+
+ Rev 1.33 18 Mar 1993 11:11:32 chrish
+Added change to routines StripLastItem and UI_FixPath ... was causing an
+infinite loop problem.
+
+ Rev 1.32 31 Dec 1992 12:15:42 MIKEP
+use resources for strings
+
+ Rev 1.31 23 Dec 1992 12:42:18 MIKEP
+half done fix
+
+ Rev 1.30 14 Dec 1992 12:17:48 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.29 17 Nov 1992 21:21:26 DAVEV
+unicode fixes
+
+ Rev 1.28 05 Nov 1992 16:59:48 DAVEV
+fix ts
+
+ Rev 1.26 07 Oct 1992 14:52:06 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.25 04 Oct 1992 19:32:40 DAVEV
+Unicode Awk pass
+
+ Rev 1.24 17 Aug 1992 13:04:44 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.23 28 Jul 1992 14:50:32 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.22 29 May 1992 10:14:28 MIKEP
+total to display change
+
+ Rev 1.21 21 May 1992 19:25:10 MIKEP
+fixes
+
+ Rev 1.20 19 May 1992 09:26:20 MIKEP
+mo changes
+
+ Rev 1.19 14 May 1992 17:23:58 MIKEP
+nt pass 2
+
+ Rev 1.18 11 May 1992 19:45:02 STEVEN
+64bit and large path sizes
+
+
+*****************************************************************************/
+
+#include "all.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "special.h"
+#include "dddefs.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static CHAR mw_tape_created[ MAX_TAPE_NAME_LEN + 1 ];
+static INT16 mw_spaces;
+static INT16 mw_dots;
+static UINT32 mw_ticks;
+static UINT32 mw_search_ticks;
+
+extern BOOLEAN lw_search_first_time = TRUE;
+
+static BOOLEAN StripLastItem( CHAR_PTR buffer, CHAR delim ); // chs:03-18-93
+static CHAR_PTR LoadGenErrStr( INT16 gen_err ) ;
+static CHAR_PTR LoadGenFuncStr( INT16 gen_func, INT32 gen_misc ) ;
+
+/*****************************************************************************
+
+ Name: UI_SetResources
+
+ Description: Sets the mw variables
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_SetResources( )
+{
+ UINT16 num_resources; /* number of items in resource */
+ UINT16 error; /* resource manager error */
+
+ /* establish any module wide references to the resources */
+
+ strcpy( mw_tape_created, (CHAR_PTR)RM_GetResource( rm, (UINT)SES_ENG_MSG, (UINT)RES_TAPE_CREATED, &num_resources, &error ) );
+}
+/*****************************************************************************
+
+ Name: UI_BuildDelimitedPathFromDDB
+
+ Description: Builds a properly delimited path from a NULL-impregnated path
+ truncates/inserts ... into long paths
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_BuildDelimitedPathFromDDB(
+CHAR_PTR *buffer, /* O - buffer in which to build the path */
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR ddb_dblk_ptr, /* I - dblk for the specified directory */
+CHAR delimiter, /* I - delimiter to be used */
+BOOLEAN OS_flag ) /* I - flag to determine whether or not to use OS Path */
+{
+
+ UI_BuildFullPathFromDDB( buffer, fsh, ddb_dblk_ptr, delimiter, OS_flag );
+
+ /* truncate/insert ... into long paths */
+ UI_FixPath( *buffer, UI_MaxDirectoryLength( ), delimiter );
+
+ return;
+
+}
+
+/*****************************************************************************
+
+ Name: UI_AllocPathBuffer
+
+ Description: Allocates a block of memory to be used as a path container
+
+ Returns: VOID
+
+*****************************************************************************/
+CHAR_PTR UI_AllocPathBuffer( CHAR_PTR *buffer, UINT16 leng )
+{
+ UINT16_PTR buf_size ;
+ CHAR_PTR real_buf_ptr ;
+
+ if ( *buffer == NULL ) {
+ *buffer = (CHAR_PTR)calloc( 1024, 1 ) ;
+ if ( *buffer != NULL ) {
+ buf_size = (UINT16_PTR)(*buffer) ;
+ *buf_size++ = 1024 - sizeof( UINT16 ) ;
+ *buffer = (CHAR_PTR)buf_size;
+ }
+ }
+ if ( *buffer != NULL ) {
+ real_buf_ptr = (CHAR_PTR)((INT8_PTR)(*buffer) - sizeof( UINT16 ));
+ buf_size = (UINT16_PTR)(real_buf_ptr) ;
+ if ( *buf_size < leng + sizeof( CHAR ) ) {
+ leng += 64 ;
+ *buffer = (CHAR_PTR)realloc( real_buf_ptr, leng ) ;
+ if ( *buffer != NULL ) {
+ buf_size = (UINT16_PTR)(*buffer) ;
+ *buf_size++ = leng - sizeof( UINT16 ) ;
+ *buffer = (CHAR_PTR)buf_size;
+ }
+ }
+ }
+ return( *buffer ) ;
+}
+/*****************************************************************************
+
+ Name: UI_FreePathBuffer
+
+ Description: Allocates a block of memory to be used as a path container
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_FreePathBuffer( CHAR_PTR *buffer )
+{
+ CHAR_PTR real_buf_ptr ;
+
+ if ( *buffer != NULL ) {
+ real_buf_ptr = (CHAR_PTR)((INT8_PTR)(*buffer) - sizeof( UINT16 ));
+ free( real_buf_ptr ) ;
+ *buffer = NULL ;
+ }
+}
+/*****************************************************************************
+
+ Name: UI_BuildFullPathFromDDB
+
+ Description: Builds a properly delimited path from a NULL-impregnated path,
+ and fixes up the path length by inserting "..."
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_BuildFullPathFromDDB(
+CHAR_PTR *buffer, /* O - buffer in which to build the path */
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR ddb_dblk_ptr, /* I - dblk for the specified directory */
+CHAR delimiter, /* I - delimiter to be used */
+BOOLEAN OS_flag ) /* I - flag to determine whether or not to use OS Path */
+{
+
+ UI_BuildFullPathFromDDB2( buffer, fsh, ddb_dblk_ptr, delimiter, OS_flag );
+ if ( *buffer != NULL ) {
+
+ /* truncate/insert ... into long paths */
+ UI_FixPath( *buffer, UI_MaxDirectoryLength( ), delimiter );
+
+ }
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_BuildFullPathFromDDB2
+
+ Description: Builds a properly delimited path from a NULL-impregnated path.
+ This function is called by the DO routines to display the full
+ path for Log file detail.
+
+ Returns: VOID
+
+*****************************************************************************/
+//FULL DETAIL
+VOID UI_BuildFullPathFromDDB2(
+CHAR_PTR *buffer, /* O - buffer in which to build the path */
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR ddb_dblk_ptr, /* I - dblk for the specified directory */
+CHAR delimiter, /* I - delimiter to be used */
+BOOLEAN OS_flag ) /* I - flag to determine whether or not to use OS Path */
+{
+ CHAR_PTR p;
+ INT16 size;
+
+
+ if( OS_flag ) {
+ size = FS_SizeofOSPathInDDB( fsh, ddb_dblk_ptr );
+ if ( UI_AllocPathBuffer( buffer, size ) != NULL ) {
+ FS_GetOSPathFromDDB( fsh, ddb_dblk_ptr, &((*buffer)[1]) );
+ }
+ }
+ else {
+ size = FS_SizeofPathInDDB( fsh, ddb_dblk_ptr );
+ if ( UI_AllocPathBuffer( buffer, size ) != NULL ) {
+ FS_GetPathFromDDB( fsh, ddb_dblk_ptr, &((*buffer)[1]) );
+ }
+ }
+
+ if ( *buffer != NULL ) {
+ UINT idx;
+ **buffer = TEXT('\\');
+ /* substitute the delimiter */
+ for ( idx=0, p=*buffer; idx < size/sizeof (CHAR); ++idx )
+ {
+ if ( p [idx] == TEXT ('\0') )
+ {
+ p [idx] = delimiter;
+ }
+ }
+ /* UNICODE NOTE: the above for loop replaces the following */
+ /* while loop, which is no longer allowed for Unicode */
+ /* since memchr looks at one BYTE at a time. */
+ /*while( p = memchr( *buffer, TEXT('\0'), size ) ) { */
+ /* *p = delimiter; */
+ /*} */
+
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_AppendDelimiter
+
+ Description: Ensures a properly terminated delimited path
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_AppendDelimiter(
+CHAR_PTR buffer, /* I/O - buffer in which to build the path */
+CHAR delimiter ) /* I - delimiter to be used */
+{
+ CHAR_PTR p = &buffer[ strlen( buffer ) - 1 ];
+
+ if( *p++ != delimiter ) {
+ *p++ = delimiter;
+ *p = TEXT('\0');
+ }
+
+ return;
+}
+/*****************************************************************************
+
+ Name: UI_BuildFileDetail
+
+ Description: Builds file detail information for display purposes
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_BuildFileDetail(
+CHAR_PTR buffer, /* O - buffer in which to build the detail */
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR fdb_dblk_ptr, /* I - dblk for the specified file */
+BOOLEAN OS_flag ) /* I - flag to determine whether or not to use OS Name */
+{
+ CHAR fname[ UI_MAX_FILENAME_LENGTH ]; /* temporary filename */
+ UINT64 fsize; /* filesize */
+ DATE_TIME fdate; /* file date / time */
+ UINT32 attribs; /* file attributes */
+ OBJECT_TYPE fdb_type; /* Object type e.g. AFP */
+
+ buffer[ 0 ] = TEXT('\0');
+ fsize = FS_GetDisplaySizeFromDBLK( fsh, fdb_dblk_ptr );
+
+ if( OS_flag ) {
+ FS_GetOSFnameFromFDB( fsh, fdb_dblk_ptr, fname );
+ } else {
+ FS_GetFnameFromFDB( fsh, fdb_dblk_ptr, fname );
+ }
+
+ FS_GetMDateFromDBLK( fsh, fdb_dblk_ptr, &fdate );
+
+ FS_GetObjTypeDBLK( fsh, fdb_dblk_ptr, &fdb_type );
+
+ attribs = FS_GetAttribFromDBLK( fsh, fdb_dblk_ptr );
+
+ UI_BuildFileSelectLine( buffer, fname, (INT16) UI_MAX_FILE_DISPLAY, FALSE,
+ attribs, fdb_type, fsize, &fdate );
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_BuildFileSelectLine
+
+ Description: This routine will format a line for file selection
+
+ Returns: Nothing. Will set "buffer" to the formated line.
+
+*****************************************************************************/
+VOID UI_BuildFileSelectLine(
+CHAR_PTR buffer, /* O - resultant formatted line */
+CHAR_PTR name, /* I - File file or directory name */
+/* O - File/Dir name truncated */
+INT16 name_len, /* I - Length of name to be displayed */
+BOOLEAN dir, /* I - TRUE if name is directory */
+UINT32 attr, /* I - File System attributes */
+OBJECT_TYPE obj_type, /* I - File System object */
+UINT64 size, /* I - size of file */
+DATE_TIME *date) /* I - pointer to date/time struct */
+{
+ CHAR numeral[40] ;
+ BOOLEAN stat ;
+ CHAR attrib_buf[UI_MAX_ATTRIBS_LENGTH]; /* attribs to display */
+ CHAR date_str[MAX_UI_DATE_SIZE];
+ CHAR time_str[MAX_UI_TIME_SIZE];
+
+ /* truncate filename (and insert ...) if name too long */
+ UI_TruncateString( name, name_len, FALSE );
+
+ /* Build attributes string */
+ if( dir ) {
+ strlwr( name );
+ UI_BuildDirAttribs( attrib_buf, attr, obj_type );
+ } else {
+ UI_BuildFileAttribs( attrib_buf, attr, obj_type );
+ }
+
+ /* Format display string */
+ if( dir ) {
+ sprintf( buffer, TEXT("%-*s %s\n"),
+ name_len,
+ name,
+ attrib_buf );
+ } else {
+
+ UI_MakeDateString( date_str, date->month, date->day,
+ date->year % 100 );
+ UI_MakeShortTimeString( time_str, date->hour, date->minute );
+
+ if ( U64_Msw( size ) == 0 ) {
+ sprintf( buffer, TEXT("%-*s %s %10lu %11s %11s\n"),
+ name_len,
+ name,
+ attrib_buf,
+ U64_Lsw( size ),
+ date_str,
+ time_str );
+
+ } else {
+
+ U64_Litoa( size, numeral, (INT16) 10, &stat ) ;
+ sprintf( buffer, TEXT("%-*s %s %s %11s %11s\n"),
+ name_len,
+ name,
+ attrib_buf,
+ numeral,
+ date_str,
+ time_str );
+
+ }
+ }
+
+
+
+ return;
+}
+/*****************************************************************************
+
+ Name: UI_BuildFileAttribs
+
+ Description: Builds file attribute information for display purposes
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_BuildFileAttribs(
+CHAR_PTR buffer, /* O - buffer in which to build the attribute */
+UINT32 attribs, /* I - file attributes */
+OBJECT_TYPE fdb_type) /* I - Object type e.g. AFP */
+{
+ INT16 len; /* used to pad fill buffer with spaces */
+
+ buffer[ 0 ] = TEXT('\0');
+
+ if( attribs & OBJ_READONLY_BIT ||
+ attribs & OBJ_HIDDEN_BIT ||
+ attribs & OBJ_SYSTEM_BIT ||
+ attribs & OBJ_MODIFIED_BIT ||
+ attribs & OBJ_CORRUPT_BIT ||
+ ( fdb_type == AFP_OBJECT ) ) {
+
+ len = UI_ATTRIBS_PADDING;
+
+ strcat( buffer, TEXT("<") );
+
+ if( attribs & OBJ_READONLY_BIT ) {
+ strcat( buffer, TEXT("R") );
+ len--;
+ }
+
+ if( attribs & OBJ_HIDDEN_BIT ) {
+ strcat( buffer, TEXT("H") );
+ len--;
+ }
+
+ if( attribs & OBJ_SYSTEM_BIT ) {
+ strcat( buffer, TEXT("S") );
+ len--;
+ }
+ if( attribs & OBJ_MODIFIED_BIT ) {
+ strcat( buffer, TEXT("A") );
+ len--;
+ }
+ if( attribs & OBJ_CORRUPT_BIT ) {
+ strcat( buffer, TEXT("C") );
+ len--;
+ }
+ if( fdb_type == AFP_OBJECT ) {
+ if( len != UI_ATTRIBS_PADDING ) {
+ strcat( buffer, TEXT("><") );
+ len -= 2;
+ }
+ strcat( buffer, TEXT("AFP") );
+ len -= 3;
+ }
+ strcat( buffer, TEXT(">") );
+ if( len ) {
+ strncat( buffer, TEXT(" "), len );
+ }
+
+ } else {
+ strcat( buffer, TEXT(" ") );
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_BuildDirAttribs
+
+ Description: Builds file attribute information for display purposes
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_BuildDirAttribs(
+CHAR_PTR buffer, /* O - buffer in which to build the attribute */
+UINT32 attribs, /* I - file attributes */
+OBJECT_TYPE fdb_type) /* I - Object type e.g. AFP */
+{
+ INT16 len; /* used to pad fill buffer with spaces */
+
+ buffer[ 0 ] = TEXT('\0');
+
+ strcat( buffer, TEXT("<DIR>") );
+ if( attribs & OBJ_HIDDEN_BIT ||
+ attribs & OBJ_SYSTEM_BIT ||
+ attribs & OBJ_READONLY_BIT ||
+ attribs & OBJ_CORRUPT_BIT ||
+ ( fdb_type == AFP_OBJECT ) ) {
+
+ len = UI_ATTRIBS_PADDING;
+
+ strcat( buffer, TEXT("<") );
+
+ if( attribs & OBJ_HIDDEN_BIT ) {
+ strcat( buffer, TEXT("H") );
+ len--;
+ }
+ if( attribs & OBJ_READONLY_BIT ) {
+ strcat( buffer, TEXT("R") );
+ len--;
+ }
+ if( attribs & OBJ_SYSTEM_BIT ) {
+ strcat( buffer, TEXT("S") );
+ len--;
+ }
+ if( attribs & OBJ_CORRUPT_BIT ) {
+ strcat( buffer, TEXT("C") );
+ len--;
+ }
+ if( fdb_type == AFP_OBJECT ) {
+ if( len != UI_ATTRIBS_PADDING ) {
+ strcat( buffer, TEXT("><") );
+ len -= 2;
+ }
+ strcat( buffer, TEXT("AFP") );
+ len -= 3;
+ }
+ strcat( buffer, TEXT(">") );
+ if( len ) {
+ strncat( buffer, TEXT(" "), ( len - 5 ) ); /* to account for <dir> */
+ }
+
+ } else {
+ strcat( buffer, TEXT(" ") );
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_BytesProcessed
+
+ Description: Processes the display/log of bytes processed for an operation
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_BytesProcessed(
+STATS_PTR op_stats_ptr ) /* I - operation level statistics */
+{
+
+ INT16 num_minutes = 0 ;
+ INT16 num_seconds = 0 ;
+ INT16 num_hours = 0;
+ UINT64 num_bytes;
+ BOOLEAN stat ;
+ CHAR *p;
+ CHAR numeral[ UI_MAX_NUMERAL_LENGTH ];
+ CHAR buffer[ 256 ];
+ CHAR temp[ 256 ];
+
+ /************
+
+ options:
+
+ processed X bytes in X hours, X minutes, and X seconds.
+ processed X bytes in 1 hour, X minutes, and X seconds.
+ processed X bytes in X hours, 1 minute, and X seconds.
+ processed X bytes in X hours, X minutes, and 1 second.
+ processed X bytes in 1 hour, 1 minute, and 1 second.
+ processed X bytes in X minutes and X seconds.
+ processed X bytes in X seconds.
+ etc.
+
+ *************/
+
+ num_bytes = ST_GetBSBytesProcessed( op_stats_ptr );
+
+ U64_Litoa( num_bytes, numeral, (INT16) 10, &stat );
+
+ UI_BuildNumeralWithCommas( numeral );
+
+ if ( ST_GetBSStartTime( op_stats_ptr ) ) {
+ num_minutes = ST_GetBSElapsedMinutes( op_stats_ptr );
+ num_seconds = ST_GetBSElapsedSeconds( op_stats_ptr );
+ num_hours = ST_GetBSElapsedHours( op_stats_ptr );
+ }
+
+
+ // Make tony happy by displaying 1 second, rather than 0.
+
+ if ( ( num_hours == 0 ) && ( num_minutes == 0 ) && ( num_seconds == 0 ) ) {
+ num_seconds = 1;
+ }
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED, NULL, NULL );
+ sprintf( buffer, p, numeral );
+
+ // Really long operation, took hours to complete.
+
+ if ( num_hours > 0 ) {
+
+ if ( num_hours == 1 ) {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_HOUR, NULL, NULL );
+ sprintf( temp, p, num_hours );
+ }
+ else {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_HOURS, NULL, NULL );
+ sprintf( temp, p, num_hours );
+ }
+ strcat( buffer, temp );
+ }
+
+ // Display minutes
+
+ if ( num_hours > 0 || num_minutes > 0 ) {
+
+ if ( num_hours > 0 ) {
+
+ // With comma's
+
+ if ( num_minutes == 1 ) {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_MINUTE1, NULL, NULL );
+ sprintf( temp, p, num_minutes );
+ }
+ else {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_MINUTES1, NULL, NULL );
+ sprintf( temp, p, num_minutes );
+ }
+ }
+ else {
+
+ // With out comma's
+
+ if ( num_minutes == 1 ) {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_MINUTE2, NULL, NULL );
+ sprintf( temp, p, num_minutes );
+ }
+ else {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_MINUTES2, NULL, NULL );
+ sprintf( temp, p, num_minutes );
+ }
+ }
+
+ strcat( buffer, temp );
+ }
+
+ if ( num_seconds == 1 ) {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_SECOND, NULL, NULL );
+ sprintf( temp, p, num_seconds );
+ }
+ else {
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_BYTES_PROCESSED_SECONDS, NULL, NULL );
+ sprintf( temp, p, num_seconds );
+ }
+
+ strcat( buffer, temp );
+
+ yresprintf( (INT16) RES_NEW_PROCESSED_BYTES, buffer );
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( (INT16)LOGGING_FILE,
+ (INT16)LOG_MSG,
+ SES_ENG_MSG,
+ RES_NEW_PROCESSED_BYTES,
+ buffer );
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_RateProcessed
+
+ Description: Processes the display/log of the rate of an operation
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_RateProcessed(
+STATS_PTR op_stats_ptr ) /* I - operation level statistics */
+{
+
+ UINT32 rate ;
+
+ if( CDS_GetDebugFlag( CDS_GetCopy( ) ) & DEBUG_USER_INTERFACE ) {
+
+ rate = U64_Lsw( ST_GetBSRate ( op_stats_ptr ) ) ;
+ yresprintf( (INT16) RES_PROCESS_RATE, rate );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ }
+
+ return;
+
+}
+
+/*****************************************************************************
+
+ Name: UI_Time
+
+ Description: Processes the display/log of a crucial time for an operation
+
+ Returns: VOID
+
+*****************************************************************************/
+
+VOID UI_Time(
+STATS_PTR op_stats_ptr, /* I - operation level statistics */
+INT res_id, /* I - resource to be displayed/logged */
+UI_TYPE type) /* I - type of crucial time */
+{
+ time_t t_time;
+ CHAR date_str[MAX_UI_DATE_SIZE];
+ CHAR time_str[MAX_UI_TIME_SIZE];
+
+ if( type == UI_START ) {
+ t_time = ST_GetBSStartTime( op_stats_ptr );
+ }
+ else if( type == UI_END ) {
+ t_time = ST_GetBSEndTime( op_stats_ptr );
+ }
+
+ UI_LongToDate( date_str, t_time );
+ UI_LongToTime( time_str, t_time );
+
+
+ yresprintf( (INT16)res_id, date_str, time_str );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( (INT16) LOGGING_FILE, (INT16) LOG_MSG, SES_ENG_MSG, res_id, date_str,
+ time_str );
+
+ return;
+
+}
+
+
+static INT last_file_length;
+
+VOID UI_DisplayFile( CHAR_PTR filename )
+{
+ CHAR buffer[ UI_MAX_FILENAME_LENGTH ];
+ INT cur_file_length;
+ INT i;
+ INT wind_width;
+
+ wind_width = 50; // Fix this !!!!!!
+
+ strcpy( buffer, filename );
+ if ( strlen( buffer ) >= (size_t)wind_width ) {
+ buffer[ wind_width - 4 ] = TEXT('\0');
+ strcat( buffer, UI_TRUNCATION );
+ }
+
+ cur_file_length = strlen( buffer );
+ for ( i = cur_file_length; ( i < last_file_length ); i++ ) {
+ buffer[i] = TEXT(' ');
+ }
+ buffer[i]=TEXT('\0');
+
+ yprintf( TEXT("%s\r"), buffer );
+
+ last_file_length = cur_file_length;
+}
+
+/*****************************************************************************
+
+ Name: UI_ClearLastDisplayedFile
+
+ Description: Clears last displayed filename from status display, called at end of set, end of media, etc.
+
+ Returns: n/a
+
+*****************************************************************************/
+VOID UI_ClearLastDisplayedFile( )
+{
+ /* eliminate last item displayed on screen */
+ if( CDS_GetFilesFlag( CDS_GetCopy( ) ) ) {
+ UI_DisplayFile( TEXT("") );
+ }
+ return;
+}
+/*****************************************************************************
+
+ Name: UI_ConditionAtEnd
+
+ Description: Displays and Logs any appropriate message regarding the abort condition
+
+ Returns: n/a
+
+*****************************************************************************/
+VOID UI_ConditionAtEnd( )
+{
+ switch( gb_abort_flag ) {
+
+ case CONTINUE_PROCESSING:
+ default:
+ break;
+
+ case ABORT_CTRL_BREAK:
+ UI_DisplayBreakMsg();
+ break;
+
+ case ABORT_AT_EOM:
+ WM_MessageBox( ID( RES_ABORT_STRING ),
+ ID( RES_EOM_TAPE_ABORT ),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION,
+ NULL, 0, 0 );
+ lresprintf( (INT16) LOGGING_FILE, (INT16) LOG_MSG, SES_ENG_MSG, RES_EOM_TAPE_ABORT );
+ break;
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_DisplayBreakMsg
+
+ Description: Displays user abort message
+
+ Returns: n/a
+
+*****************************************************************************/
+VOID UI_DisplayBreakMsg( VOID )
+{
+ if ( gb_abort_flag == ABORT_CTRL_BREAK ) {
+
+ gb_abort_flag = ABORT_PROCESSED;
+
+ WM_MessageBox( ID( RES_ABORT_STRING ),
+ ID( RES_USER_TAPE_ABORT ),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION,
+ NULL, 0, 0 );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_USER_TAPE_ABORT );
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_ProcessErrorCode
+
+ Description: Processes Error Code
+
+ Returns: n/a
+
+*****************************************************************************/
+VOID UI_ProcessErrorCode(
+INT16 error,
+INT16_PTR disposition,
+INT16 channel )
+{
+ INT16 resource_id;
+ INT16 print_err_type = DETAIL_PRINT_VALUE;
+ BOOLEAN call_eresprintf_flag = TRUE;
+ CHAR text[MAX_UI_RESOURCE_SIZE];
+ BOOLEAN call_msgbox_flag = FALSE ;
+
+
+
+ switch ( error ) {
+
+ case LP_USER_ABORT_ERROR:
+ case TFLE_USER_ABORT:
+ UI_DisplayBreakMsg( );
+
+ /* falling through */
+
+ case TFLE_UI_HAPPY_ABORT:
+ call_eresprintf_flag = FALSE;
+ break;
+
+ case LP_OUT_OF_MEMORY_ERROR:
+ case TFLE_NO_MEMORY:
+ case TFLE_NO_FREE_BUFFERS:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_OUT_OF_MEMORY;
+ print_err_type = DETAIL_PRINT_ERR_ONLY;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_USE_SYPL_ECC_FLAG:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_USESYPLFLAG;
+ print_err_type = DETAIL_PRINT_ERR_ONLY;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_APPEND_NOT_ALLOWED:
+ case TFLE_BAD_SET_MAP:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_NOAPPEND;
+ print_err_type = DETAIL_PRINT_ERR_ONLY;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_OTC_FAILURE:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_INSUFFICIENT_DISK_SPACE;
+ print_err_type = DETAIL_PRINT_ERR_ONLY;
+ *disposition = ABORT_OPERATION;
+ break;
+
+
+ case TFLE_UNRECOGNIZED_MEDIA:
+ gb_error_during_operation = TRUE;
+ resource_id = IDS_VLMUNFORMATEDTEXT;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+
+ case TFLE_UNKNOWN_FMT:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_FOREIGN_TAPE_ERROR;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case LP_TAPE_POS_ERROR:
+ msassert( FALSE ) ; // This should be gone for good! GRH 2/5/94
+ gb_error_during_operation = TRUE;
+ resource_id = RES_ERROR_POSITIONING_TAPE;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_NO_TAPE:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_EMPTY_DRIVE_ERROR;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_TAPE_INCONSISTENCY:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_FATAL_TAPE_FMT_ERR;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_TRANSLATION_FAILURE:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_FATAL_TAPE_TRANS_ERR;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_DRIVER_FAILURE:
+ case TFLE_DRIVE_FAILURE:
+ case TFLE_BAD_TAPE:
+ case LP_TAPE_READ_ERROR:
+ case LP_TAPE_WRITE_ERROR:
+ call_eresprintf_flag = FALSE;
+ gb_error_during_operation = TRUE;
+ *disposition = ABORT_OPERATION;
+ if( !UI_GetExtendedErrorString( error, text ) ) {
+ RSM_StringCopy( IDS_GENERR_UNDETERMINED, text, MAX_UI_RESOURCE_LEN );
+ }
+
+ // dump it to the log file.
+
+ lprintf( LOGGING_FILE, TEXT("\n" ) );
+ lprintf( LOGGING_FILE, text );
+ lprintf( LOGGING_FILE, TEXT("\n\n" ) );
+
+ // display it to the user.
+
+ WM_MsgBox( ID(IDS_GENERR_TITLE), text, WMMB_OK, WMMB_ICONSTOP );
+ break;
+
+ case TFLE_NO_CONTROLLERS:
+ case TFLE_NO_DRIVES:
+ case TFLE_NO_FREE_CHANNELS:
+ case TFLE_CANNOT_OPEN_DRIVE:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_UNKNOWN_TF_MSG;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_UNEXPECTED_EOS:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_UNEXPECTED_EOS;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case LP_DRIVE_ATTACH_ERROR:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_ERROR_DURING_ATTACH;
+ print_err_type = DETAIL_PRINT_ERROR_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case LP_END_OPER_FAILED:
+ gb_error_during_operation = TRUE;
+ call_msgbox_flag = TRUE ;
+ call_eresprintf_flag = FALSE ;
+ resource_id = RES_ERROR_EMS_RESTART ;
+ print_err_type = DETAIL_PRINT_ERROR_DEVICE;
+ break;
+
+ case LP_ACCESS_DENIED_ERROR:
+ case FS_BAD_ATTACH_TO_SERVER:
+ call_eresprintf_flag = FALSE;
+ *disposition = SKIP_OBJECT;
+ gb_error_during_operation = TRUE;
+ break;
+
+ case TFLE_WRITE_PROTECT:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_WRITE_PROT;
+ print_err_type = DETAIL_PRINT_DEVICE;
+ *disposition = ABORT_OPERATION;
+ break;
+
+ case TFLE_NO_MORE_DRIVES:
+ case LP_FILE_READ_ERROR:
+ case LP_FILE_NOT_FOUND_ERROR:
+ case LP_FILE_IN_USE_ERROR:
+ case LP_FILE_OPEN_ERROR:
+ case LP_FILE_WRITE_ERROR:
+ case LP_FILE_CREATION_ERROR:
+ case LP_CHANGE_DIRECTORY_ERROR:
+ case LP_PRIVILEGE_ERROR:
+ case LP_OUT_OF_SPACE_ERROR:
+ gb_error_during_operation = TRUE;
+ resource_id = RES_UNKNOWN_LOOPS_ERR;
+ break;
+
+ default:
+
+// Keep customers from seeing -533 error message.
+
+#ifdef MS_RELEASE
+ call_eresprintf_flag = FALSE;
+#endif
+
+ resource_id = RES_UNKNOWN_LOOPS_ERR;
+ break;
+ }
+
+ if ( call_msgbox_flag ) {
+
+ switch( print_err_type ) {
+
+ case DETAIL_PRINT_ERR_ONLY:
+ if ( eresprintf_cancel( resource_id ) ) {
+ *disposition = ABORT_OPERATION;
+ }
+ break;
+
+ case DETAIL_PRINT_VALUE:
+ if ( eresprintf_cancel( resource_id, error ) ) {
+ *disposition = ABORT_OPERATION;
+ }
+ break;
+
+ case DETAIL_PRINT_DEVICE:
+ if( eresprintf_cancel( resource_id, BE_GetCurrentDeviceName( channel ) ) ) {
+ *disposition = ABORT_OPERATION;
+ }
+ break;
+
+ case DETAIL_PRINT_ERROR_DEVICE:
+ if ( eresprintf_cancel( resource_id, error, BE_GetCurrentDeviceName( channel ) ) ) {
+ *disposition = ABORT_OPERATION;
+ }
+ break;
+
+ }
+
+ }
+ if ( call_eresprintf_flag ) {
+
+ switch( print_err_type ) {
+
+ case DETAIL_PRINT_ERR_ONLY:
+ eresprintf( resource_id );
+ break;
+
+ case DETAIL_PRINT_VALUE:
+ eresprintf( resource_id, error );
+ break;
+
+ case DETAIL_PRINT_DEVICE:
+ eresprintf( resource_id, BE_GetCurrentDeviceName( channel ) );
+ break;
+
+ case DETAIL_PRINT_ERROR_DEVICE:
+ eresprintf( resource_id, error, BE_GetCurrentDeviceName( channel ) );
+ break;
+
+ }
+
+ }
+
+ return;
+}
+
+
+static CHAR_PTR LoadGenFuncStr( INT16 gen_func, INT32 gen_misc )
+{
+ CHAR_PTR s;
+
+ s = malloc( 512 * sizeof(CHAR) );
+
+ if ( s != NULL ) {
+
+ switch ( gen_func ) {
+
+ case GEN_INIT:
+ RSM_StringCopy( IDS_GENFUNC_INIT, s, 512 );
+ break;
+
+ case GEN_OPEN:
+ RSM_StringCopy( IDS_GENFUNC_OPEN, s, 512 );
+ break;
+
+ case GEN_NRCLOSE:
+ RSM_StringCopy( IDS_GENFUNC_NRCLOSE, s, 512 );
+ break;
+
+ case GEN_RCLOSE:
+ RSM_StringCopy( IDS_GENFUNC_RCLOSE, s, 512 );
+ break;
+
+ case GEN_READ:
+ RSM_StringCopy( IDS_GENFUNC_READ, s, 512 );
+ break;
+
+ case GEN_WRITE:
+ RSM_StringCopy( IDS_GENFUNC_WRITE, s, 512 );
+ break;
+
+ case GEN_WRITE_ENDSET:
+ RSM_StringCopy( IDS_GENFUNC_WRITE_ENDSET, s, 512 );
+ break;
+
+ case GEN_SPACE:
+
+ switch ( gen_misc ) {
+
+ case SPACE_FWD_FMK:
+ RSM_StringCopy( IDS_GENFUNC_SPACE_FWD_FMK, s, 512 );
+ break;
+
+ case SPACE_BKWD_FMK:
+ RSM_StringCopy( IDS_GENFUNC_SPACE_BKWD_FMK, s, 512 );
+ break;
+
+ case SPACE_EOD:
+ RSM_StringCopy( IDS_GENFUNC_SPACE_EOD, s, 512 );
+ break;
+
+ case SPACE_FWD_BLK:
+ RSM_StringCopy( IDS_GENFUNC_SPACE_FWD_BLK, s, 512 );
+ break;
+
+ case SPACE_BKWD_BLK:
+ RSM_StringCopy( IDS_GENFUNC_SPACE_BKWD_BLK, s, 512 );
+ break;
+
+ default:
+ strcpy( s, TEXT( "" ) );
+ break;
+ }
+ break;
+
+ case GEN_ERASE:
+ RSM_StringCopy( IDS_GENFUNC_ERASE, s, 512 );
+ break;
+
+ case GEN_REWIND:
+ case GEN_REWINDI:
+ RSM_StringCopy( IDS_GENFUNC_REWIND, s, 512 );
+ break;
+
+ case GEN_RETEN:
+ RSM_StringCopy( IDS_GENFUNC_RETEN, s, 512 );
+ break;
+
+ case GEN_STATUS:
+ RSM_StringCopy( IDS_GENFUNC_STATUS, s, 512 );
+ break;
+
+ case GEN_RELEASE:
+ RSM_StringCopy( IDS_GENFUNC_RELEASE, s, 512 );
+ break;
+
+ case GEN_SEEK:
+ RSM_StringCopy( IDS_GENFUNC_SEEK, s, 512 );
+ break;
+
+ case GEN_GETPOS:
+ RSM_StringCopy( IDS_GENFUNC_GETPOS, s, 512 );
+ break;
+
+ case GEN_MOUNT:
+ RSM_StringCopy( IDS_GENFUNC_MOUNT, s, 512 );
+ break;
+
+ case GEN_DISMOUNT:
+ RSM_StringCopy( IDS_GENFUNC_DISMOUNT, s, 512 );
+ break;
+
+ case GEN_SPECIAL:
+ if ( gen_misc == SS_GET_DRV_INF ) {
+ RSM_StringCopy( IDS_GENFUNC_SPECIAL_GET_INFO, s, 512 );
+ }
+ else {
+ if ( gen_misc == SS_CHANGE_BLOCK_SIZE ) {
+ RSM_StringCopy( IDS_GENFUNC_SPECIAL_CHNG_BLK_SIZE, s, 512 );
+ }
+ else {
+ RSM_StringCopy( IDS_GENFUNC_SPECIAL_SET_COMPRESS, s, 512 );
+ }
+ }
+ break;
+
+ case GEN_EJECT:
+ RSM_StringCopy( IDS_GENFUNC_EJECT, s, 512 );
+ break;
+
+ default:
+ strcpy( s, TEXT( "" ) );
+ break;
+
+ }
+ }
+
+ return( s );
+
+}
+
+
+static CHAR_PTR LoadGenErrStr( INT16 gen_err )
+{
+ CHAR_PTR s;
+
+ s = malloc( 512 * sizeof(CHAR) );
+
+ if ( s != NULL ) {
+
+ switch ( gen_err ) {
+
+ case GEN_ERR_TIMEOUT:
+ RSM_StringCopy( IDS_GENERR_TIMEOUT, s, 512 );
+ break;
+
+ case GEN_ERR_EOM:
+ RSM_StringCopy( IDS_GENERR_EOM, s, 512 );
+ break;
+
+ case GEN_ERR_BAD_DATA:
+ RSM_StringCopy( IDS_GENERR_BAD_DATA, s, 512 );
+ break;
+
+ case GEN_ERR_NO_MEDIA:
+ RSM_StringCopy( IDS_GENERR_NO_MEDIA, s, 512 );
+ break;
+
+ case GEN_ERR_ENDSET:
+ RSM_StringCopy( IDS_GENERR_ENDSET, s, 512 );
+ break;
+
+ case GEN_ERR_NO_DATA:
+ RSM_StringCopy( IDS_GENERR_NO_DATA, s, 512 );
+ break;
+
+ case GEN_ERR_INVALID_CMD:
+ RSM_StringCopy( IDS_GENERR_INVALID_CMD, s, 512 );
+ break;
+
+ case GEN_ERR_RESET:
+ RSM_StringCopy( IDS_GENERR_RESET, s, 512 );
+ break;
+
+ case GEN_ERR_WRT_PROTECT:
+ RSM_StringCopy( IDS_GENERR_WRT_PROTECT, s, 512 );
+ break;
+
+ case GEN_ERR_HARDWARE:
+ RSM_StringCopy( IDS_GENERR_HARDWARE, s, 512 );
+ break;
+
+ case GEN_ERR_EOM_OVERFLOW:
+ RSM_StringCopy( IDS_GENERR_EOM_OVERFLOW, s, 512 );
+ break;
+
+ case GEN_ERR_WRONG_BLOCK_SIZE:
+ RSM_StringCopy( IDS_GENERR_WRONG_BLOCK_SIZE, s, 512 );
+ break;
+
+ case GEN_ERR_UNRECOGNIZED_MEDIA:
+ RSM_StringCopy( IDS_GENERR_UNRECOGNIZED_MEDIA, s, 512 );
+ break;
+
+ case GEN_ERR_UNDETERMINED:
+ default:
+ RSM_StringCopy( IDS_GENERR_UNDETERMINED, s, 512 );
+ break;
+
+ }
+ }
+
+ return( s );
+
+}
+
+/*****************************************************************************
+
+ Name: UI_GetExtendedErrorString
+
+ Description: This function attempts to get a more detailed description
+ of tape drive errors from tape format, and fill out 'msg'
+ with an appropriate error message.
+
+ Returns: BOOLEAN - TRUE if successful
+
+ Note: The 'msg' parameter should point to a string of a least
+ MAX_UI_RESOURCE_SIZE in length.
+
+*****************************************************************************/
+BOOLEAN UI_GetExtendedErrorString( INT16 error, CHAR_PTR msg )
+{
+ CHAR format_string[MAX_UI_RESOURCE_SIZE] ;
+ CHAR_PTR func_string ;
+ CHAR_PTR error_string ;
+ INT16 gen_func ;
+ INT16 gen_err ;
+ INT32 gen_misc ;
+ BOOLEAN ret_val = FALSE ;
+
+ if( TF_GetLastDriveError( thw_list, &gen_func, &gen_err, &gen_misc ) ) {
+ if( ( func_string = LoadGenFuncStr( gen_func, gen_misc ) ) != NULL ) {
+ if ( error != TFLE_DRIVER_FAILURE && error != PD_DRIVER_FAILURE ) {
+ if( ( error_string = LoadGenErrStr( gen_err ) ) != NULL ) {
+ RSM_StringCopy( IDS_GENERR_DRIVE_FAILED, format_string, MAX_UI_RESOURCE_LEN ) ;
+ sprintf( msg, format_string, func_string, error_string ) ;
+ ret_val = TRUE ;
+ free( error_string ) ;
+ }
+ } else {
+ if ( gen_func == GEN_SPECIAL ) {
+ RSM_StringCopy( IDS_GENERR_DRIVER_FAIL2, format_string, MAX_UI_RESOURCE_LEN ) ;
+ } else {
+ RSM_StringCopy( IDS_GENERR_DRIVER_FAIL1, format_string, MAX_UI_RESOURCE_LEN ) ;
+ }
+ sprintf( msg, format_string, func_string ) ;
+ ret_val = TRUE ;
+ }
+ free( func_string ) ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+
+/*****************************************************************************
+
+ Name: UI_TapeDriveCount
+
+ Description: This function returns a count of the number of tape
+ drives found within the current channel (global thw_list).
+ This function is used by the backup message handler to prompt
+ the user to insert tapes w-x in tape drives y-z.
+
+ Returns: INT8 count of tape drives
+
+*****************************************************************************/
+INT8 UI_TapeDriveCount( )
+{
+ Q_ELEM_PTR cur_thw = NULL;
+ INT8 num_drives = 0;
+
+ if ( thw_list->channel_link.q_next != NULL ) {
+ num_drives++;
+ cur_thw = (Q_ELEM_PTR) thw_list->channel_link.q_next;
+ }
+
+ while( cur_thw != NULL ) {
+ num_drives++;
+ cur_thw = (Q_ELEM_PTR) cur_thw->q_next;
+ }
+ return( num_drives );
+}
+/*****************************************************************************
+
+ Name: UI_CheckWriteProtectedDevice
+
+ Description: Returns BOOLEAN indication of whether media in current
+ device is write-protected or not. This function is
+ called by backup and tension/erase tape positioners.
+
+ Returns:
+
+*****************************************************************************/
+BOOLEAN UI_CheckWriteProtectedDevice(
+UINT16 tf_message,
+TPOS_PTR tpos,
+CHAR_PTR drive_name)
+{
+ BOOLEAN write_prot = FALSE;
+
+ switch( tf_message ) {
+
+ case TF_VCB_EOD:
+ case TF_VCB_BOT:
+ case TF_INVALID_VCB:
+ case TF_EMPTY_TAPE:
+ case TF_POSITIONED_AT_A_VCB:
+ case TF_REQUESTED_VCB_FOUND:
+ case TF_FUTURE_REV_MTF:
+ case TF_MTF_ECC_TAPE:
+ case TF_SQL_TAPE:
+ case TF_TAPE_OUT_OF_ORDER:
+ case TF_UNRECOGNIZED_MEDIA:
+ /* quality check device for write-protect and produce error if required */
+ if( ( write_prot = BE_DeviceWriteProtected( tpos->channel ) ) ) {
+ eresprintf( RES_WRITE_PROT, drive_name );
+ }
+
+ default:
+ break;
+
+ }
+
+ return( write_prot );
+}
+/*****************************************************************************
+
+ Name: UI_FixPath
+
+ Description: Shortens and inserts ... into path specified
+
+ Returns:
+
+*****************************************************************************/
+VOID UI_FixPath(
+CHAR_PTR path_ptr, /* Path to fix */
+INT16 len, /* What length? */
+CHAR delim) /* Path delimiter character */
+{
+ CHAR_PTR src;
+ CHAR_PTR dst;
+ CHAR last_item[ UI_MAX_FILENAME_LENGTH ];
+ CHAR_PTR begin_path = path_ptr;
+ INT last_item_len;
+ CHAR delimiter[ 2 ];
+ BOOLEAN trunc_last = FALSE ;
+ BOOLEAN leading_dots;
+
+ delimiter[ 1 ] = TEXT('\0');
+ delimiter[ 0 ] = delim;
+
+ if( (INT16)strlen( path_ptr ) >= len ) {
+
+ src = strrchr( path_ptr, delimiter[ 0 ] );
+ dst = last_item;
+
+ // quick kludge for macintosh paths.
+
+ if ( src == NULL ) {
+ path_ptr[ len - 3 ] = 0;
+ strcat( path_ptr, UI_TRUNCATION );
+ return;
+ }
+
+ if ( src == path_ptr ) {
+ leading_dots = FALSE;
+ } else {
+ leading_dots = TRUE;
+ }
+
+ while( *src ) {
+ *dst++ = *src++;
+ }
+
+ *dst = TEXT('\0');
+ last_item_len = strlen( last_item );
+ src = strrchr( path_ptr, delim );
+ *src = TEXT('\0');
+
+ /*
+ * If the last item is itself larger than than the window, we
+ * have to truncate the last_item, not the path...
+ */
+ if ( ( last_item_len + 4 ) >= len ) {
+
+ if ( leading_dots ) {
+ *(last_item + len - 7) = TEXT('\0');
+ } else {
+ *(last_item + len - 4) = TEXT('\0');
+ }
+
+ *path_ptr = TEXT('\0');
+ trunc_last = TRUE;
+
+ } else {
+
+// chs:03-18-93 while( (INT16)strlen( path_ptr ) + 4 + last_item_len >= len ) {
+// chs:03-18-93 StripLastItem( path_ptr, delim );
+// chs:03-18-93 }
+
+ while( ( (INT16)strlen( path_ptr ) + 4 + last_item_len >= len ) && // chs:03-18-93
+ StripLastItem( path_ptr, delim ) ); // chs:03-18-93
+ // chs:03-18-93
+ // // chs:03-18-93
+ // Just incase after stripping the file name is still too long // chs:03-18-93
+ // In NT file name can be 256 char long, this will never fit // chs:03-18-93
+ // in the display dialog box. FOR NOW just chop it-off. // chs:03-18-93
+ // // chs:03-18-93
+ // chs:03-18-93
+ if ( (INT16)strlen( path_ptr ) + 4 + last_item_len >= len ) { // chs:03-18-93
+ if ( last_item_len >= len ) { // chs:03-18-93
+ last_item_len = last_item_len - (INT16)strlen( path_ptr ) - 4 - 1; // chs:03-18-93
+ last_item[ last_item_len] = TEXT('\0'); // chs:03-18-93
+ } else { // chs:03-18-93
+ last_item_len = len - (INT16)strlen( path_ptr ) - 4 - 1; // chs:03-18-93
+ last_item[ len] = TEXT('\0'); // chs:03-18-93
+ } // chs:03-18-93
+ } // chs:03-18-93
+ }
+
+
+ if ( leading_dots ) {
+ strcat( path_ptr, delimiter );
+ strcat( path_ptr, UI_TRUNCATION );
+ }
+
+ strcat( path_ptr, last_item );
+
+ /* Put up trailing ellipses, if necessary */
+ if ( trunc_last ) {
+ strcat( path_ptr, UI_TRUNCATION );
+ }
+
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: StripLastItem
+
+ Description:
+
+ Returns: true - strip was successful
+ false - strip failed.
+
+ chs:03-18-93 - modified to return a boolean value.
+
+*****************************************************************************/
+static BOOLEAN StripLastItem(
+CHAR_PTR buffer,
+CHAR delim)
+{
+ CHAR_PTR src;
+
+ src = strrchr( buffer, delim );
+ if( src != NULL ) {
+ *src = TEXT('\0');
+ } else {
+ return( FALSE );
+ }
+
+ return ( TRUE );
+
+}
+/*****************************************************************************
+
+ Name: UI_TruncateString
+
+ Description: Truncates strings to a specified maximum length possible appending
+ UI_TRUNCATION. Spaces are turned into 0xff if replace_spaces is TRUE.
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_TruncateString(
+CHAR_PTR buffer, /* O - buffer in which to build the truncation */
+INT16 length, /* I - maximum strlen( buffer ) on return */
+BOOLEAN replace_spaces) /* I - replace spaces ? */
+{
+ CHAR_PTR p = buffer;
+
+ if( (INT16)strlen( buffer ) > length ) {
+ buffer[ length - strlen( UI_TRUNCATION ) ] = TEXT('\0');
+ strcat( buffer, UI_TRUNCATION );
+ }
+
+ if( replace_spaces ) {
+ while( *p != TEXT('\0') ) {
+ if( *p == 0x20 ) {
+ *p = (CHAR) 0xff;
+ }
+ p++;
+ }
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: UI_DisplayableTapeName
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+CHAR_PTR UI_DisplayableTapeName(
+CHAR_PTR tape_name,
+DATE_TIME_PTR date)
+{
+ static CHAR return_name[ MAX_TAPE_NAME_LEN + 1 ];
+
+ if ( ( tape_name == NULL ) || ( * tape_name == TEXT('\0') ) ) {
+ strcpy( return_name, mw_tape_created );
+ if ( date != NULL ) {
+ DateTimeToDateString( date, return_name + strlen( mw_tape_created ) );
+ }
+ msassert( strlen( return_name ) <= MAX_TAPE_NAME_LEN );
+
+ return( return_name );
+
+ }
+ else {
+
+ return( tape_name );
+
+ }
+}
+/*****************************************************************************
+
+ Name: UI_MaxDirectoryLength
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+INT16 UI_MaxDirectoryLength( VOID )
+{
+ CHAR_PTR p;
+ CHAR_PTR q;
+
+ p = ( CHAR_PTR )RM_GetResource( rm, SES_ENG_MSG, RES_DIRECTORY, NULL, NULL );
+ q = strstr( p, TEXT("%") );
+
+ return( 80 ); // Fix this too !!!!
+
+}
+
+/*****************************************************************************
+
+ Name: UI_GetTickCount
+
+ Description: gets the current tick count - only for OS/2
+
+ Returns: tick count - UINT32
+
+*****************************************************************************/
+#if defined( MAYN_OS2 )
+
+VOID UI_GetTickCount( UINT32 *tick_count_ptr )
+{
+ SEL global_seg_sel;
+ SEL local_seg_sel;
+ PGINFOSEG global_info_ptr;
+
+
+ DosGetInfoSeg( &global_seg_sel, &local_seg_sel );
+ global_info_ptr = MAKEPGINFOSEG(global_seg_sel );
+ *tick_count_ptr = ( ( global_info_ptr->msecs*18L )/1000L );
+
+ return;
+}
+#endif
diff --git a/private/utils/ntbackup/src/detfmt.c b/private/utils/ntbackup/src/detfmt.c
new file mode 100644
index 000000000..d4700e860
--- /dev/null
+++ b/private/utils/ntbackup/src/detfmt.c
@@ -0,0 +1,391 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: detfmt.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the format determiners.
+
+
+ $Log: T:/LOGFILES/DETFMT.C_V $
+
+ Rev 1.16 13 Jul 1993 19:17:42 GREGG
+Removed reporting of ECC and future rev tapes as foreign in MTF determiner.
+
+ Rev 1.15 04 Jun 1993 18:41:00 GREGG
+If the tape has ECC, report it as foreign.
+
+ Rev 1.14 11 May 1993 21:55:34 GREGG
+Moved Sytos translator stuff from layer-wide area to translator.
+
+ Rev 1.13 22 Apr 1993 03:31:36 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.12 17 Mar 1993 15:18:58 TERRI
+Added changes for the Sytos Plus translator.
+
+ Rev 1.11 24 Nov 1992 18:16:24 GREGG
+Updates to match MTF document.
+
+ Rev 1.10 22 Oct 1992 10:45:34 HUNTER
+Changes for new stream headers
+
+
+ Rev 1.9 22 Sep 1992 08:58:46 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.8 24 Jul 1992 14:00:02 GREGG
+Moved include of translator header inside tranlator's ifdef.
+
+ Rev 1.7 09 Jun 1992 15:51:16 GREGG
+Call F40 specific CalcChecksum.
+
+ Rev 1.6 23 Apr 1992 10:54:08 BURT
+Added determiner for Sytos Plus read translator.
+
+
+ Rev 1.5 13 Apr 1992 15:37:40 BURT
+Standard'ified the code.
+
+
+ Rev 1.4 25 Mar 1992 19:26:42 GREGG
+ROLLER BLADES - Added 4.0 format determiner.
+
+ Rev 1.3 07 Jan 1992 14:00:18 ZEIR
+Added UTF support.
+
+ Rev 1.2 07 Jun 1991 00:09:16 GREGG
+Added compiler directives to allow selective inclusion of translators, and
+inherited the Sytos determiner from fsytrd.c.
+
+ Rev 1.1 10 May 1991 11:57:44 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:18:54 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "stdmacro.h"
+#include "tbe_defs.h"
+#include "datetime.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "fmteng.h"
+#include "transutl.h"
+#include "fsys.h"
+#include "tloc.h"
+#include "lw_data.h"
+#include "tfldefs.h"
+
+#include "transprt.h"
+
+/* $end$ include list */
+
+#ifdef MY40_TRANS
+
+#include "mayn40.h"
+
+/**/
+/**
+
+ Name: F40_Determiner
+
+ Description: This function determines whether or not the buffer
+ contains a valid 4.0 format block
+
+ Returns: TRUE if the block is a valid 4.0 format, and FALSE if
+ it is not.
+
+ Notes: This routine assumes the buffer is at least
+ min_siz_for_dblk bytes long.
+
+**/
+
+BOOLEAN F40_Determiner(
+ VOID_PTR buf_ptr ) /* Current Buffer */
+{
+ BOOLEAN ret_val = FALSE ;
+ MTF_DB_HDR_PTR cur_hdr = (MTF_DB_HDR_PTR)buf_ptr ;
+ MTF_TAPE_PTR cur_tape = (MTF_TAPE_PTR)buf_ptr ;
+
+ /* If it check sums and the type is valid */
+ if( F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN ) == cur_hdr->hdr_chksm ) {
+ if( F40_GetBlkType( cur_hdr ) == F40_TAPE_IDI ) {
+ ret_val = TRUE ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+#endif
+
+
+#ifdef MY31_TRANS
+
+#include "mayn31.h"
+
+/**/
+/**
+
+ Name: F31_Determiner
+
+ Description: This function determines whether or not the buffer
+ contains a valid 3.1 format block
+
+ Returns: TRUE if the block is a valid 3.1 format, and FALSE if
+ it is not.
+
+ Notes: This routine assumes the buffer is at least
+ min_siz_for_dblk bytes long.
+
+**/
+
+BOOLEAN F31_Determiner(
+ VOID_PTR buf_ptr ) /* Current Buffer */
+{
+ BOOLEAN ret_val = FALSE ;
+ DB_HDR_PTR cur_hdr = ( DB_HDR_PTR ) buf_ptr ;
+
+ /* If it check sums and the type is valid */
+ if( cur_hdr->hdr_chksm == ( CalcChecksum( ( UINT16_PTR ) cur_hdr, F31_HDR_CHKSUM_LEN ) ) ) {
+ if( cur_hdr->type == F31_VCB_ID ) {
+ ret_val = TRUE ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+#endif
+
+#ifdef MY30_TRANS
+
+#include "mayn30.h"
+
+/**/
+/**
+
+ Name: F30_Determiner
+
+ Description: Determines if the current buffer contains a valid 3.0
+ format header block
+
+ Returns: TRUE if this is a valid 3.0 format, and FALSE if it is
+ not.
+
+ Notes: NONE
+
+**/
+
+BOOLEAN F30_Determiner(
+ VOID_PTR buffer )
+{
+ DB_HDR_30_PTR cur_hdr = ( DB_HDR_30_PTR ) buffer ;
+ BOOLEAN ret_val = FALSE ;
+
+ /* If the Check Sums match and there is a block type, then this is
+ format 3.1 */
+ if( CalcChecksum( ( UINT16_PTR ) cur_hdr, F30_HDR_CHKSUM_LEN ) == cur_hdr->hdr_chksm && cur_hdr->type == FMT30_VCB ) {
+ ret_val = TRUE ;
+ }
+
+ return( ret_val ) ;
+
+}
+#endif
+
+#ifdef MY25_TRANS
+
+#include "mayn25.h"
+
+/**/
+/**
+
+ Name: F25_Determiner
+
+ Description: Determines if this is a Maynard 2.0 - 2.5 Format tape.
+
+ Returns: TRUE if it is a 2.0 - 2.5 tape, and FALSE if it is not.
+
+ Notes: If the psycho ward isn't guarded closely, someday this
+ could be changed to support even early formats.
+
+**/
+
+BOOLEAN F25_Determiner(
+ VOID_PTR buf_ptr )
+{
+ F25_VCB_PTR v_ptr = (F25_VCB_PTR)buf_ptr ;
+ BOOLEAN ret = FALSE ;
+
+ /* See if format indicator is present */
+ if( ( v_ptr->vblkid == BLK_VCB ) ||
+ ( v_ptr->vblkid == BLK_EOV ) ||
+ ( v_ptr->vblkid == BLK_NEW_VCB ) ||
+ ( v_ptr->vblkid == BLK_NEW_EOV ) ) {
+
+ /* If >= 2.0 format then checksum */
+ if( ( v_ptr->vswlev >= 9 ) || ( v_ptr->vswver == 2 && v_ptr->vswlev == 5 ) ) {
+ if( ( F25_Chksm( (CHAR_PTR)v_ptr, siz_vcbs( *v_ptr ) ) == v_ptr->vcb_chksum ) ) {
+ ret = TRUE ;
+ }
+ }
+ }
+
+ return( ret ) ;
+}
+#endif
+
+#ifdef QS19_TRANS
+
+#include "fq.h"
+
+/**/
+/**
+
+ Name: FQ_DetermineFormat
+
+ Description: look at a buffered tape block (first block read from
+ a tape) and determine if it's QicStream.
+
+ Returns: BOOLEAN -- TRUE if this is QS1.92 or QS1.93 format.
+
+ Notes: NONE
+
+**/
+
+BOOLEAN FQ_DetermineFormat(
+ VOID_PTR buf )
+{
+ register FQ_HEADER_PTR hdr = ( FQ_HEADER_PTR ) buf ;
+
+ /* check for failure */
+ return (! (strncmp( (char *)hdr->signature, FQ_FPR_SIGNATURE, FQ_SIGNATURE_SIZE ) != 0
+ || hdr->format_code != 1
+ || hdr->first_logical_segment != 2
+ || strncmp( (char *)hdr->manufacturer_name, FQ_MFG_NAME, FQ_MFG_NAME_SIZE ) != 0
+ || hdr->manufacturer_name[ FQ_MFG_NAME_SIZE ] > '3'
+ || hdr->manufacturer_name[ FQ_MFG_NAME_SIZE ] < '2' ) ) ;
+}
+#endif
+
+#ifdef SY31_TRANS
+
+#include "fsytos.h"
+
+/**/
+/**
+
+ Name: FSYT_DetermineFormat
+
+ Description: Given a pointer to data from the beginning of a set,
+ determine if this format recognizes the data.
+
+ Returns: TRUE if the block is a valid Sytos 3.11 format, and
+ FALSE if it is not.
+
+ Notes: NONE
+
+**/
+
+BOOLEAN FSYT_DetermineFormat( VOID_PTR buffer )
+{
+ TAPE_HEADER_PTR header = buffer ;
+
+ return ( header->blkid == TAPE_HEADER_MARKER ) ;
+}
+#endif
+
+
+#ifdef SYPL10_TRANS
+
+#include "sypl10.h"
+
+/**/
+/**
+
+ Name: SYPL_DetermineFormat
+
+ Description: Given a pointer to data from the beginning of a set,
+ determine if this format recognizes the data.
+
+ Returns: TRUE if the block is a valid Sytos Plus 1.0 format, and
+ FALSE if it is not.
+
+ Notes: NONE
+
+**/
+
+BOOLEAN SYPL_DetermineFormat( VOID_PTR buffer )
+{
+ S10_COMMON_HEADER_PTR header = buffer ;
+ static UINT8 uniq_id[] = S10_UNIQ_ID ;
+
+ /* compare the unique id with the one on tape */
+ if( memicmp( header->uniq_tape_id, uniq_id, UNQ_HDR_ID_LEN ) ) {
+ return FALSE ;
+ }
+ /* return the results of the tape header check */
+ return( header->type == tape_header_type ) ;
+}
+#endif
+
+#ifdef UTF_TRANS
+
+#include "utf.h"
+
+/**
+ *
+ * Unit: Unit_X
+ *
+ * Name: UTF_Determiner
+ *
+ * Modified: 01/07/92
+ *
+ * Description: Determines whether the given buffer contains a valid UTF
+ * header signature
+ * Notes:
+ *
+ * Returns: TRUE - if buffer contains UTF information
+ * FALSE - otherwise
+ *
+ * Global Data: None
+ *
+**/
+
+
+BOOLEAN UTF_Determiner(
+
+ VOID_PTR buf_ptr
+)
+{
+ SIGNATURE_HEADER_T *shdr = (SIGNATURE_HEADER_T *)buf_ptr ;
+
+ return shdr->id == T_SIGNATURE &&
+ shdr->subtag == TS_TAPE_HEADER_SIGNATURE &&
+ shdr->size == 4 &&
+ !strncmp( shdr->string, "UTF ", 4 ) ;
+}
+#endif
diff --git a/private/utils/ntbackup/src/dettpdrv.c b/private/utils/ntbackup/src/dettpdrv.c
new file mode 100644
index 000000000..371d67ebb
--- /dev/null
+++ b/private/utils/ntbackup/src/dettpdrv.c
@@ -0,0 +1,205 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dettpdrv.c
+
+ Description: Functions to determine starting tape drive for operations and
+ set the last tape drive used at close set time.
+
+ $Log: N:/LOGFILES/DETTPDRV.C_V $
+
+ Rev 1.2 18 Sep 1991 15:59:20 DON
+cast 'future use' tpos parm to void so we don't get warnings
+
+ Rev 1.1 24 May 1991 13:12:24 STEVEN
+changed to ANSI prototypes
+
+ Rev 1.0 09 May 1991 13:40:00 HUNTER
+Initial revision.
+
+**/
+#include "stdtypes.h"
+#include "loops.h"
+#include "bsdu.h"
+#include "tflproto.h"
+#include "tflstats.h"
+#include "genstat.h"
+#include "be_debug.h"
+
+THW_PTR lw_last_tpdrv = NULL ;
+THW_PTR lw_toc_tpdrv = NULL ;
+
+/**/
+/**
+
+ Name: LP_DetermineStartingTPDrv
+
+ Description: Given an operation type, a current BSD pointer and TPOS pointer,
+ this function determine whether to starting drive for the
+ operation should begin on the current drive or the Top Of Channel.
+
+
+ Modified: 3/29/1990
+
+ Returns: THW_PTR to starting device
+
+ Notes: Backup, restore, verify and directory operations will start
+ on the current device unless a specific device has already been
+ specified in the BSD and we are auto-determining the starting drive.
+
+ Tension, erase and catalog a tape operations will always
+ start at TOC.
+
+ MBS should have already set "auto_det_sdrv" in the LIS structure
+ to FALSE indicating that the THW_PTR in the current BSD should
+ ALWAYS be used instead of setting the current drive to the last
+ active drive. Note that MBS continually redefines the drive
+ channel, whereas, MaynStream for DOS specifies the drive channel
+ at init time and does not alter it.
+
+ It should also be noted that although restore and verify operations
+ simply use the last active drive, TF will auto-locate any specific tape
+ requested through specific position information and will set this
+ device to the starting drive. If the specific tape desired is not located
+ within the channel, TF will call the tape positioner requesting a new
+ tape in drive 1.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+THW_PTR LP_DetermineStartingTPDrv(
+INT16 oper_type, /* I - Specifies what operation */
+BSD_PTR bsd_ptr, /* I - Specifies what backup set */
+TPOS_PTR tpos, /* I - Specifies the tape position */
+BOOLEAN auto_determine_sdrv ) /* I - TRUE if we should determine */
+{
+ THW_PTR sdrv ;
+
+ /* future use */
+ (VOID) tpos ;
+
+ /* If we are not to auto-determine starting drive based upon last active drive, and
+ a pre-specified starting device (THW_PTR) has already been defined
+ for this BSD, simply return this device as the starting device */
+ if( !auto_determine_sdrv && ( bsd_ptr != NULL ) && ( BSD_GetTHW( bsd_ptr ) != NULL ) ) {
+ return( BSD_GetTHW( bsd_ptr ) ) ;
+ }
+
+ /* Otherwise, define starting device based upon the operation type... */
+
+ switch( oper_type ) {
+
+ case BACKUP_OPER:
+ case ARCHIVE_BACKUP_OPER:
+ case TDIR_OPER:
+ case RESTORE_OPER:
+ case VERIFY_OPER:
+
+ /* Use last accessed device as starting drive */
+ sdrv = lw_last_tpdrv ;
+
+ /* Update current bsd to reflect starting drive */
+ if( bsd_ptr != NULL ) {
+ BSD_SetTHW( bsd_ptr, sdrv ) ;
+ }
+
+ break ;
+
+ case ARCHIVE_VERIFY_OPER:
+ case VERIFY_LAST_BACKUP_OPER:
+ case VERIFY_LAST_RESTORE_OPER:
+
+ /* Set starting drive to starting drive specified in BSD */
+ if( bsd_ptr != NULL ) {
+ sdrv = BSD_GetTHW( bsd_ptr ) ;
+ }
+ break ;
+
+ case TENSION_OPER:
+ case ERASE_OPER:
+ case ERASE_NO_READ_OPER:
+ case SECURITY_ERASE_OPER:
+ case CATALOG_TAPE_OPER:
+ default:
+
+ /* Always start these operations at the Top Of Channel */
+ sdrv = lw_toc_tpdrv ;
+ break ;
+
+ }
+
+ return( sdrv ) ;
+}
+/**/
+/**
+
+ Name: LP_DetermineCurrentTPDrv
+
+ Description: This function is called by LP_BackupDLE to determine what
+ the current device for the operation is. In this way, the
+ BSD is updated to reflect the actual drive where the write
+ operation started.
+
+ Modified: 3/29/1990
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( LP_BackupDLE() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID LP_DetermineCurrentTPDrv(
+BSD_PTR bsd_ptr, /* I - Specifies what backup set */
+INT16 channel ) /* I - Specifies which drive chain */
+{
+ BSD_SetTHW( bsd_ptr, TF_GetCurrentDevice( channel ) ) ;
+ return ;
+}
+/**/
+/**
+
+ Name: LP_CloseSet
+
+ Description: This function sets the layer wide "lw_last_tpdrv" variable
+ to reflect the last used device, calls TF to close the
+ current set and posts soft error and underrun stats in
+ the debug window.
+
+ Modified: 3/29/1990
+
+ Returns: N/A
+
+ Notes: This function is only called for "normal" close set
+ functionality. The specific loops functions that would
+ call this function will continue to call TF_CloseSet
+ directly in error conditions.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID LP_CloseSet(
+INT16 channel ) /* I - Specifies the which drive chain */
+{
+ TF_STATS close_stats ;
+
+ /* Determine last drive in channel accessed */
+ lw_last_tpdrv = TF_GetCurrentDevice( channel ) ;
+
+ TF_CloseSet( channel, &close_stats ) ;
+ BE_Zprintf( DEBUG_LOOPS, RES_SOFT_ERRORS_UNDERRUNS,
+ close_stats.dataerrs, close_stats.underruns ) ;
+
+ return ;
+}
+
diff --git a/private/utils/ntbackup/src/dialmang.c b/private/utils/ntbackup/src/dialmang.c
new file mode 100644
index 000000000..836cac5d1
--- /dev/null
+++ b/private/utils/ntbackup/src/dialmang.c
@@ -0,0 +1,604 @@
+/****************************************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: dialmang.c
+
+ Description: Contains the Dialog Manager kernel.
+
+ $Log: G:\ui\logfiles\dialmang.c_v $
+
+ Rev 1.36 02 Aug 1993 17:08:24 CHUCKB
+Ifdef wait-for-device dialog for NT only.
+
+ Rev 1.35 30 Jul 1993 16:07:56 CHUCKB
+Added DM_WaitForDevice.
+
+ Rev 1.34 14 Jul 1993 09:23:38 CARLS
+added call for skipno dialog
+
+ Rev 1.33 13 Jul 1993 17:22:26 MARINA
+enable c++, correct DialogCallBackTable decl/init
+
+ Rev 1.32 25 May 1993 14:23:18 chrish
+Added new "DM_Abort" backup/restore abort dialog window procedure.
+
+ Rev 1.31 15 May 1993 13:41:26 MIKEP
+remove next set dialog
+
+ Rev 1.30 07 Mar 1993 10:57:04 MIKEP
+warning fixes for NT
+
+ Rev 1.29 18 Feb 1993 11:32:04 BURT
+Change for Cayman
+
+
+ Rev 1.28 01 Nov 1992 15:45:28 DAVEV
+Unicode changes
+
+ Rev 1.27 31 Oct 1992 14:56:20 MIKEP
+continue adding small catalog dialog
+
+ Rev 1.26 07 Oct 1992 15:37:00 MIKEP
+fix nt warnings
+
+ Rev 1.25 07 Oct 1992 13:43:36 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.24 04 Oct 1992 19:32:44 DAVEV
+Unicode Awk pass
+
+ Rev 1.23 21 Sep 1992 17:18:20 DARRYLP
+Updates for WFW email.
+
+ Rev 1.22 17 Sep 1992 18:20:16 DARRYLP
+New WFW email stuff...
+
+ Rev 1.21 09 Sep 1992 16:13:42 GLENN
+Updated castings for MikeP (NT).
+
+ Rev 1.20 06 Aug 1992 13:20:20 CHUCKB
+Changes for NT.
+
+ Rev 1.19 28 Jul 1992 14:49:20 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.18 29 May 1992 15:58:42 JOHNWT
+PCH updates
+
+ Rev 1.17 12 May 1992 21:20:56 MIKEP
+NT pass 1
+
+ Rev 1.16 30 Mar 1992 18:02:30 GLENN
+Added support for pulling resources from .DLL
+
+ Rev 1.15 09 Mar 1992 09:37:12 GLENN
+Fixed comparison in dialog table.
+
+ Rev 1.14 03 Mar 1992 17:00:06 GLENN
+Changed bad dialog table length to a calculated actual dialog table length.
+
+ Rev 1.13 31 Jan 1992 13:42:46 JOHNWT
+enhanced DM_CenterDialog
+
+ Rev 1.12 27 Jan 1992 00:28:56 CHUCKB
+Updated dialog id's.
+
+ Rev 1.11 24 Jan 1992 16:27:34 CHUCKB
+Took out cbt_job define.
+
+ Rev 1.10 20 Jan 1992 15:00:20 CARLS
+
+ Rev 1.9 09 Jan 1992 18:24:06 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.8 07 Jan 1992 17:33:24 GLENN
+Updated the table
+
+ Rev 1.7 19 Dec 1991 13:36:26 CHUCKB
+Added line for settings/options dialog to callback table.
+
+ Rev 1.6 18 Dec 1991 11:35:20 JOHNWT
+changed RTDs to MODAL
+
+ Rev 1.5 13 Dec 1991 16:09:38 JOHNWT
+added DM_PWDBPassword
+
+ Rev 1.4 10 Dec 1991 13:32:12 CHUCKB
+Added table entry for advanced restore.
+
+ Rev 1.3 06 Dec 1991 15:55:46 JOHNWT
+added DM_NextSet
+
+ Rev 1.2 29 Nov 1991 16:39:18 CHUCKB
+Added dialog callback table entry for DM_AdvRestore.
+
+ Rev 1.1 25 Nov 1991 14:52:30 DAVEV
+Changes for 32-16 bit Windows port
+
+
+ Rev 1.0 07 Jun 1991 16:22:32 GLENN
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#ifndef OEM_MSOFT
+
+DIALOG_TABLE DialogCallBackTable[] = {
+
+ { (FARPROC)DM_Abort, IDD_ABORT_BOX, MODAL }, // chs:05-25-93
+ { (FARPROC)DM_AboutWinter, IDD_HELPABOUTWINTERPARK, MODAL },
+
+ { (FARPROC)DM_EraseTape, IDD_OPERATIONSERASE, MODAL },
+
+ { (FARPROC)DM_AdvBackup, IDD_SELECTADVANCED, MODAL },
+ { (FARPROC)DM_AdvSave, IDD_SELECTSAVE, MODAL },
+ { (FARPROC)DM_AdvUse, IDD_SELECTUSE, MODAL },
+ { (FARPROC)DM_DeleteSelection, IDD_SELECTDELETE, MODAL },
+ { (FARPROC)DM_AdvRestore, IDD_ADVRESTORE, MODAL },
+
+ { (FARPROC)DM_New, IDD_JOBNEW, MODAL },
+ { (FARPROC)DM_Jobs, IDD_JOBMAINTENANCE, MODAL },
+ { (FARPROC)DM_JobOpt, IDD_JOBOPTS, MODAL },
+ { (FARPROC)DM_Schedule, IDD_JOBSCHEDULE, MODAL },
+ { (FARPROC)DM_SchedOpt, IDD_SCHEDOPTS, MODAL },
+#ifdef WFW
+ { (FARPROC)DM_Email, IDD_EMAIL, MODAL },
+ { (FARPROC)DM_EmailLogon, IDD_EMAILLOGON, MODAL },
+#endif
+ { (FARPROC)DM_SettingsOptions, IDD_SETTINGSOPTIONS, MODAL },
+ { (FARPROC)DM_OptionsBackup, IDD_SETTINGSBACKUP, MODAL },
+ { (FARPROC)DM_OptionRestore, IDD_SETTINGSRESTORE, MODAL },
+ { (FARPROC)DM_OptionsLogging, IDD_SETTINGSLOGGING, MODAL },
+ { (FARPROC)DM_OptionsNetwork, IDD_SETTINGSNETWORK, MODAL },
+ { (FARPROC)DM_OptionsCatalog, IDD_SETTINGSCATALOG, MODAL },
+ { (FARPROC)DM_OptionHardware, IDD_SETTINGSHARDWARE, MODAL },
+ { (FARPROC)DM_SettingsDebug, IDD_SETTINGSDEBUGWINDOW, MODAL },
+
+ { (FARPROC)DM_Attach, IDD_PSWD, MODAL },
+ { (FARPROC)DM_RestoreTarget, IDD_RESTORE, MODAL },
+ { (FARPROC)DM_VerifyTarget, IDD_VERIFY, MODAL },
+ { (FARPROC)DM_SearchTape, IDD_SEARCHTAPE, MODAL },
+
+// { (FARPROC)DM_OptionsTransfer, IDD_SETTINGSTRANSFER, MODAL },
+ { (FARPROC)PM_SetupWndProc, IDD_FILESETUP, MODAL },
+ { (FARPROC)PM_PrintWndProc, IDD_FILEPRINT, MODAL },
+
+ { (FARPROC)DM_CatalogMaint, IDD_OPERATIONSCATMAINT, MODAL },
+// { (FARPROC)DM_CatalogBset, IDD_CATBSET, MODAL },
+ { (FARPROC)DM_CatalogTape, IDD_CATTAPE, MODAL },
+ { (FARPROC)DM_TapePswd, IDD_TAPEPSWD, MODAL }, // these use
+ { (FARPROC)DM_TapePswd, IDD_LANTAPEPSWD, MODAL }, // the same proc
+
+ { (FARPROC)DM_ProgManItem, IDD_JOBPROGMANITEM, MODAL },
+
+ { (FARPROC)DM_BackupSet, IDD_BACKUPSET, MODAL },
+ { (FARPROC)DM_RestoreSet, IDD_RESTORESET, MODAL },
+ { (FARPROC)DM_RestoreSet, IDD_VERIFYSET, MODAL },
+ { (FARPROC)DM_ReenterPassword, IDD_REENTER_PASSWORD, MODAL },
+ { (FARPROC)DM_SkipOpen, IDD_SKIPOPEN, MODAL },
+ { (FARPROC)DM_SkipNo, IDD_SKIPNO, MODAL },
+ { (FARPROC)DM_FileReplace, IDD_FILEREPLACE, MODAL },
+ { (FARPROC)DM_Erase, IDD_ERASE, MODAL },
+ { (FARPROC)DM_Runtime, IDD_RUNTIME, MODELESS },
+ { (FARPROC)DM_Tension, IDD_TENSION, MODELESS },
+ { (FARPROC)DM_PWDBPassword, IDD_PWDB_PASSWORD, MODAL },
+#ifdef OS_WIN32
+ { (FARPROC)DM_WaitForDevice, IDD_WAITDEVICE, MODAL },
+#endif
+ { (FARPROC)DM_Runtime, IDD_CATALOG, MODELESS }
+};
+
+#else
+
+DIALOG_TABLE DialogCallBackTable[] = {
+
+ { (FARPROC)DM_AboutWinter, IDD_HELPABOUTWINTERPARK, MODAL },
+
+ { (FARPROC)DM_EraseTape, IDD_OPERATIONSERASE, MODAL },
+
+ { (FARPROC)DM_OptionHardware, IDD_SETTINGSHARDWARE, MODAL },
+ { (FARPROC)DM_SettingsDebug, IDD_SETTINGSDEBUGWINDOW, MODAL },
+
+ { (FARPROC)DM_RestoreTarget, IDD_RESTORE, MODAL },
+ { (FARPROC)DM_VerifyTarget, IDD_VERIFY, MODAL },
+
+ { (FARPROC)DM_BackupSet, IDD_BACKUPSET, MODAL },
+ { (FARPROC)DM_RestoreSet, IDD_RESTORESET, MODAL },
+ { (FARPROC)DM_RestoreSet, IDD_VERIFYSET, MODAL },
+ { (FARPROC)DM_SkipOpen, IDD_SKIPOPEN, MODAL },
+ { (FARPROC)DM_FileReplace, IDD_FILEREPLACE, MODAL },
+ { (FARPROC)DM_Erase, IDD_ERASE, MODAL },
+ { (FARPROC)DM_Runtime, IDD_RUNTIME, MODELESS },
+ { (FARPROC)DM_Tension, IDD_TENSION, MODELESS },
+ { (FARPROC)DM_PWDBPassword, IDD_PWDB_PASSWORD, MODAL },
+#ifdef OEM_EMS
+ { (FARPROC)DM_ExchgConnect, IDD_CONNECT_XCHNG, MODAL },
+ { (FARPROC)DM_ExchgRecover, IDD_XCHG_RECOVER, MODAL },
+#endif
+ { (FARPROC)DM_Runtime, IDD_CATALOG, MODELESS }
+};
+
+#endif
+
+#define NUM_DIALOGS ( sizeof (DialogCallBackTable) / sizeof (DialogCallBackTable[0]) )
+
+/****************************************************************************
+
+ Name: BeginDialogProcess
+
+ Description: Chooses a dialog proc & template, initializes a proc
+ instance, and calls DialogBoxParam().
+
+ Modified: 6/01/91
+
+ Returns: none
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+
+INT APIENTRY DM_BeginDialogProcess (
+
+HWND hWnd, // I - Handle of window.
+HANDLE hInst, // I - Instance of application.
+WORD wDialogNum, // I - Resource number of dialog.
+PVOID pDatain, // I/O - Pointer to data area being passed to dialog.
+PVOID pDataout ) // - Currently not being used.
+
+
+{
+ WNDPROC lpProc;
+ INT nRetCode = DM_SHOWNOTFOUND;
+
+ DBG_UNREFERENCED_PARAMETER ( pDataout );
+
+ // Get information from the dialog procedure callback definition table
+ // to instantiate and begin specified dialog.
+
+ // Is dialog_num in range of valid dialogs ?
+
+ if ( wDialogNum >= NUM_DIALOGS ) {
+
+ return ( nRetCode );
+ }
+
+ lpProc = (WNDPROC)MakeProcInstance ( DialogCallBackTable[ wDialogNum].proc, ghInst );
+
+ switch ( DialogCallBackTable[wDialogNum].type ) {
+
+ case MODAL:
+
+ if ( ghModelessDialog ) {
+
+ hWnd = ghModelessDialog;
+ }
+
+ nRetCode = DialogBoxParam ( ghResInst,
+ MAKEINTRESOURCE ( DialogCallBackTable[wDialogNum].proc_num ) ,
+ hWnd,
+ (DLGPROC)lpProc,
+ MP2FROMPVOID ( pDatain )
+ );
+
+ FreeProcInstance (lpProc);
+
+ break;
+
+ case MODELESS:
+
+ ghModelessDialog = CreateDialogParam ( ghResInst,
+ MAKEINTRESOURCE ( DialogCallBackTable[ wDialogNum ].proc_num ) ,
+ hWnd,
+ (DLGPROC)lpProc,
+ (LONG) pDatain
+ );
+
+ break;
+
+ }
+
+ return ( nRetCode );
+}
+
+
+/****************************************************************************
+
+ Name: DM_IsInDialogTable
+
+ Description: Searches the dialog callback table for a dialog
+ identified by a unique resource number.
+
+ This function provides an entry point to the Dialog
+ Manager for other functions to use.
+
+ Modified: 06/12/91
+
+ Returns: TRUE if dialog was found and processed.
+ FALSE if dialog not found.
+
+ Notes:
+ Uses the global variable 'ghInst' for define instance
+ handle.
+ See also:
+
+****************************************************************************/
+
+
+BOOL APIENTRY DM_IsInDlgTable (
+
+HWND hWnd , // I - Handle to window
+WORD wResNum ) // I - Unique resource number of dialog.
+
+{
+
+ BOOL fFound = FALSE;
+ WORD i = 0;
+
+
+ while ( ( i < NUM_DIALOGS ) && (!fFound) ) {
+
+ if ( wResNum == DialogCallBackTable[i].proc_num ) {
+
+ DM_BeginDialogProcess ( hWnd, ghResInst, i, NULL, NULL );
+ fFound = TRUE;
+ }
+
+ i++;
+ }
+
+ return fFound;
+}
+
+/****************************************************************************
+
+ Name: DM_ShowDialog
+
+ Description: Searches the dialog callback table for a dialog
+ identified by a unique resource number.
+
+
+ Modified: 10/25/91
+
+ Returns: INT DM_SHOWNOTFOUND if the dialog was not found;
+ DM_SHOWCANCEL if the dialog was found,
+ but the user cancelled;
+ DM_SHOWOK if the dialog was found
+ and the user entered valid data
+
+ Notes: Uses the global variable 'ghInst' for define instance
+ handle.
+
+ See also:
+
+****************************************************************************/
+
+
+INT APIENTRY DM_ShowDialog (
+
+HWND hWnd , // I - Handle to window
+WORD wResNum, // I - Unique resource number of dialog.
+PVOID lParam ) // I - Initialization parameter for dialog
+
+{
+ BOOL fFound = FALSE;
+ WORD i = 0;
+ INT nRetCode = DM_SHOWNOTFOUND;
+
+
+ while ( ( i < NUM_DIALOGS ) && (!fFound) ) {
+
+ if ( wResNum == DialogCallBackTable[i].proc_num ) {
+
+ nRetCode = DM_BeginDialogProcess ( hWnd, ghResInst, i, (PVOID) lParam, NULL );
+ fFound = TRUE;
+ }
+
+ i++;
+ }
+
+ return nRetCode;
+}
+
+/***********************************************************************
+
+ Name: DM_DialogOnError
+
+ Description: Displays error message using WM_MsgBox
+ according to error classification
+
+ Modified: 8/6/1991
+
+ Returns: INT Error code given to the function
+
+ Notes:
+ Currently JOBIO, SCHEDULEIO defined types
+
+ See also:
+
+***********************************************************************/
+
+
+INT DM_DialogOnError (
+
+INT nError,
+WORD wType )
+
+{
+ LPSTR szString;
+ LPSTR szTitle ;
+ LPSTR szFormat;
+ LPSTR szFullFileName;
+
+ if ( nError == 0 ) {
+ return ( nError );
+ }
+
+ szString = (LPSTR) calloc ( 256, sizeof ( CHAR ) );
+ szFormat = (LPSTR) calloc ( 256, sizeof ( CHAR ) );
+ szTitle = (LPSTR) calloc ( 256, sizeof ( CHAR ) );
+ szFullFileName = (LPSTR) calloc ( 256, sizeof ( CHAR ) );
+
+ lstrcpy( szFullFileName, CDS_GetUserDataPath () );
+
+ switch( wType ) {
+
+ case JOBIO :
+
+ RSM_StringCopy( IDS_JOBIOERR, (LPSTR) szTitle, 255 );
+ RSM_StringCopy( IDS_JOBFILENAME, (LPSTR) szString, 255 );
+
+ lstrcat( szFullFileName, szString );
+
+ switch ( nError ) {
+
+ case FOPEN_ERR :
+ RSM_StringCopy( IDS_CANTOPEN, (LPSTR) szFormat, 255 );
+ break;
+
+ case FREAD_ERR :
+ RSM_StringCopy( IDS_CANTREAD, (LPSTR) szFormat, 255 );
+ break;
+
+ case FWRITE_ERR :
+ RSM_StringCopy( IDS_CANTWRITE, (LPSTR) szFormat, 255 );
+ break;
+
+ case FCLOSE_ERR :
+ RSM_StringCopy( IDS_CANTCLOSE, (LPSTR) szFormat, 255 );
+ break;
+
+
+ default :
+ RSM_StringCopy( IDS_CANTCREATE, (LPSTR) szFormat, 255 );
+ }
+
+ lstrcpy( szString, TEXT("")); // Clear out szString
+
+ wsprintf ( szString, szFormat, szFullFileName );
+
+ break;
+
+ case SCHEDULEIO :
+
+ RSM_StringCopy( IDS_SCHEDULEIOERR, (LPSTR) szTitle, 255 );
+ RSM_StringCopy( IDS_SCHFILENAME , (LPSTR) szString, 255 );
+
+ lstrcat( szFullFileName, szString );
+
+ switch ( nError ) {
+
+ case FOPEN_ERR :
+ RSM_StringCopy( IDS_CANTOPEN, (LPSTR) szFormat, 255 );
+ break;
+
+ case FREAD_ERR :
+ RSM_StringCopy( IDS_CANTREAD, (LPSTR) szFormat, 255 );
+ break;
+
+ case FWRITE_ERR :
+ RSM_StringCopy( IDS_CANTWRITE, (LPSTR) szFormat, 255 );
+ break;
+
+ case FCLOSE_ERR :
+ RSM_StringCopy( IDS_CANTCLOSE, (LPSTR) szFormat, 255 );
+ break;
+
+ default :
+ RSM_StringCopy( IDS_CANTCREATE,(LPSTR) szFormat, 255 );
+ }
+
+ lstrcpy( szString, TEXT("")); // Clear out szString
+
+ wsprintf ( szString, szFormat, szFullFileName );
+
+ }
+
+ WM_MsgBox( szTitle, szString, WMMB_OK, WMMB_ICONEXCLAMATION );
+
+ free ( szString );
+ free ( szFormat );
+ free ( szTitle );
+ free ( szFullFileName );
+
+ return( nError );
+}
+
+/***********************************************************************
+
+ Name: DM_CenterDialog
+
+ Description: Centers the dialog on the frame window. If the
+ resulting position is off the screen, center it on
+ the screen. If we are still off the screen, set
+ the top/left to 0,0.
+
+ Modified: 1/31/92
+
+ Returns: VOID
+
+***********************************************************************/
+
+VOID DM_CenterDialog( HWND hDlg)
+
+{
+
+ RECT Rect, DlgRect;
+ INT nDlgHigh, nDlgWid, nFrameWid, nFrameHigh;
+
+
+ /* first get the rectangles of the frame window and dialog and then
+ calculate their sizes */
+
+ GetWindowRect( ghWndFrame, &Rect );
+ GetWindowRect( hDlg, &DlgRect );
+
+ nFrameWid = Rect.right - Rect.left;
+ nFrameHigh = Rect.bottom - Rect.top;
+ nDlgWid = DlgRect.right - DlgRect.left;
+ nDlgHigh = DlgRect.bottom - DlgRect.top;
+
+ /* calculate the new top and left positions */
+
+ Rect.left += ( nFrameWid - nDlgWid ) / 2;
+ Rect.top += ( nFrameHigh - nDlgHigh ) / 2;
+
+ /* if any part of the dlg is off the screen, center on the screen */
+
+ if ( ( Rect.left < 0 ) ||
+ ( Rect.top < 0 ) ||
+ ( Rect.left + nDlgWid > GetSystemMetrics( SM_CXSCREEN ) ) ||
+ ( Rect.top + nDlgHigh > GetSystemMetrics( SM_CYSCREEN ) ) ) {
+
+ Rect.left = ( GetSystemMetrics( SM_CXSCREEN ) - nDlgWid ) / 2;
+ Rect.top = ( GetSystemMetrics( SM_CYSCREEN ) - nDlgHigh ) / 2;
+
+ /* if we are on some bizarre monitor and the top of the dialog is
+ not on the screen, make the top/left 0/0 so they can at least
+ move it around with the mouse. */
+
+ if ( Rect.left < 0 ) {
+ Rect.left = 0;
+ }
+
+ if ( Rect.top < 0 ) {
+ Rect.top = 0;
+ }
+
+ }
+
+ /* position the dialog */
+
+ MoveWindow( hDlg, Rect.left, Rect.top, nDlgWid, nDlgHigh, TRUE );
+
+ return;
+}
+
diff --git a/private/utils/ntbackup/src/dialogs.rc b/private/utils/ntbackup/src/dialogs.rc
new file mode 100644
index 000000000..05abcefd3
--- /dev/null
+++ b/private/utils/ntbackup/src/dialogs.rc
@@ -0,0 +1,261 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: dialogs.rc
+
+ Description: This file contains the references to dialog resources for
+ the Windows GUI Project Resource File.
+
+ $Log: G:/UI/LOGFILES/DIALOGS.RCV $
+
+ Rev 1.35 10 Aug 1993 13:52:24 Aaron
+ Moved waitdev.dlg into an OS_WIN32 ifdef
+
+ Rev 1.34 04 Aug 1993 18:00:58 chrish
+ Ifdef dummyad.dlg for CAYMAN.
+
+ Rev 1.33 30 Jul 1993 16:01:12 CHUCKB
+ Added include for waitdev.dlg.
+
+ Rev 1.32 27 Jul 1993 13:21:10 chrish
+ CAYMAN EPR 0638: Added new "dummyab.dlg" for printer aborting.
+
+ Rev 1.31 19 Jul 1993 14:22:58 CARLS
+ added skipno.h & skipno.dlg
+
+ Rev 1.30 12 Jul 1993 11:00:16 MIKEP
+ change it back again.
+
+ Rev 1.29 06 Jul 1993 10:03:04 MIKEP
+ ifdef about box based on oem_msoft rather than os_win32.
+
+ Rev 1.28 30 Jun 1993 16:38:02 Aaron
+ Ifdef'd about box dialog inclusion on OS_WIN32
+
+ Rev 1.27 29 Jun 1993 17:33:58 GLENN
+ Added new style about box support.
+
+ Rev 1.26 25 May 1993 14:22:34 chrish
+ Added new backup/restore abort dialog box.
+
+ Rev 1.25 15 Apr 1993 13:35:26 CLIFF
+ Added dummy device driver stuff.
+
+ Rev 1.24 22 Mar 1993 14:50:16 DARRYLP
+ Added Browse dialog.
+
+ Rev 1.23 16 Mar 1993 15:27:18 ROBG
+ Changed the reference of OM_FONT.DLG in OEM_SOFT to FONT.DLG.
+
+ Rev 1.22 10 Mar 1993 13:42:28 DARRYLP
+ Added Catalog.dlg
+
+ Rev 1.21 17 Feb 1993 09:37:36 BURT
+ Changes to support Cayman
+
+
+ Rev 1.20 18 Dec 1992 11:24:42 chrish
+ Consolidate all the dialogs.
+
+ Rev 1.19 02 Oct 1992 16:56:40 GLENN
+ Added the DLGINCLUDE to the top of the file. Should be removed from all dialogs.
+
+ Rev 1.18 21 Sep 1992 16:54:10 DARRYLP
+ Updates for WFW email.
+
+ Rev 1.17 17 Sep 1992 18:11:38 DARRYLP
+ New dialog for WFW email.
+
+ Rev 1.16 09 Sep 1992 17:58:10 CHUCKB
+ Fixed my backwards ifdefs (oops).
+
+ Rev 1.15 03 Sep 1992 11:08:06 CHUCKB
+ Changed some stuff for Microsoft.
+
+ Rev 1.14 02 Sep 1992 15:03:14 GLENN
+ Added the new font dialog.
+
+ Rev 1.13 19 Aug 1992 14:27:54 CHUCKB
+ #ifdef'ed out unused dialogs.
+
+ Rev 1.12 26 Jun 1992 15:57:08 DAVEV
+
+
+ Rev 1.11 22 Feb 1992 15:33:22 ROBG
+ Added prtabort.dlg for print manager/.
+
+ Rev 1.10 07 Feb 1992 16:07:50 CHUCKB
+ Added ltappswd.dlg.
+
+ Rev 1.9 29 Jan 1992 17:54:08 GLENN
+ Updated dialog IDs.
+
+ Rev 1.8 26 Jan 1992 16:37:46 CHUCKB
+ Fixed some includes.
+
+ Rev 1.7 06 Jan 1992 18:35:24 CHUCKB
+ Put catalog settings dialog in an include file. There should be no more dialogs in this file.
+
+ Rev 1.6 02 Jan 1992 12:49:24 CHUCKB
+ Put dialogs in separate .dlg files.
+
+ Rev 1.5 14 Dec 1991 13:50:38 JOHNWT
+ added network.dlg
+
+ Rev 1.4 13 Dec 1991 16:10:50 JOHNWT
+ added loginpw.dlg
+
+ Rev 1.3 07 Dec 1991 12:23:30 CARLS
+ added include for cattape.dlg
+
+ Rev 1.2 06 Dec 1991 15:54:52 JOHNWT
+ added include for nextset.dlg
+
+ Rev 1.1 04 Dec 1991 16:50:20 CHUCKB
+ Put some hot keys in.
+
+ Rev 1.0 20 Nov 1991 19:17:06 SYSTEM
+ Initial revision.
+
+******************************************************************************/
+
+DLGINCLUDE RCDATA DISCARDABLE
+BEGIN
+ "ADD_ICON.H\0"
+ "ADV_REST.H\0"
+ "ADV_SEL.H\0"
+ "BKUP.H\0"
+ "CATMAINT.H\0"
+ "CATTAPE.H\0"
+ "DEL_SEL.H\0"
+ "DLGS.H\0"
+ "EMAIL.H\0"
+ "EMLLOGON.H\0"
+ "ERASE.H\0"
+ "FREPLACE.H\0"
+ "HWDLG.H\0"
+ "JOB_NEW.H\0"
+ "JOBSETUP.H\0"
+ "JOB_OPTS.H\0"
+ "LTAPPSWD.H\0"
+ "LOGINPW.H\0"
+ "MSGBOXID.H\0"
+ "NEXTSET.H\0"
+ "NETWORK.H\0"
+ "OMBKUP.H\0"
+ "OMRSET.H\0"
+ "RT_DLG.H\0"
+ "RSET.H\0"
+ "RSETNEW.H\0"
+ "SAVE_SEL.H\0"
+ "SCHED.H\0"
+ "SET_CAT.H\0"
+ "SET_DBUG.H\0"
+ "SET_LOG.H\0"
+ "SET_OPTS.H\0"
+ "SET_PRT.H\0"
+ "SET_REST.H\0"
+ "SETBACK.H\0"
+ "SKIPNO.H\0"
+ "SKIPOPEN.H\0"
+ "SRVLOGIN.H\0"
+ "TAPEPSWD.H\0"
+ "TENSION.H\0"
+ "TSEARCH.H\0"
+ "USE_SEL.H\0"
+ "ABORTDLG.H\0" // chs:05-25-93
+ "OMEXCHNG.H\0"
+#ifdef DUMMY_DD
+ "DDD_DLG.H\0"
+#endif
+END
+
+#include "msgbox.dlg"
+#include "set_dbug.dlg"
+#include "skipno.dlg"
+#include "skipopen.dlg"
+#include "tension.dlg"
+#include "vset.dlg"
+
+#if !defined ( OEM_MSOFT )
+#ifdef CAYMAN // chs:08-04-93
+ #include "dummyab.dlg" // chs:07-27-93
+#endif // chs:08-04-93
+ #include "abortdlg.dlg" // chs:05-25-93
+ #include "font.dlg"
+ #include "add_icon.dlg"
+ #include "adv_rest.dlg"
+ #include "adv_sel.dlg"
+ #include "bkup.dlg"
+ #include "catalog.dlg"
+ #include "catmaint.dlg"
+ #include "cattape.dlg"
+ #include "del_sel.dlg"
+ #include "erase.dlg"
+#if defined( WFW )
+ #include "email.dlg"
+ #include "emllogon.dlg"
+#endif
+ #include "freplace.dlg"
+
+#ifdef OS_WIN32
+ #include "omabout.dlg" // yes, we use the OM version now.
+ #include "omhwconf.dlg"
+ #include "waitdev.dlg"
+#else
+ #include "about.dlg" // no, we don't use the OM version yet.
+ #include "hwconf.dlg"
+#endif
+
+ #include "job_new.dlg"
+ #include "d_browse.dlg"
+ #include "job_opts.dlg"
+ #include "jobsetup.dlg"
+ #include "ltappswd.dlg"
+ #include "loginpw.dlg"
+ #include "network.dlg"
+ #include "nextset.dlg"
+ #include "password.dlg"
+ #include "print.dlg"
+ #include "printlog.dlg"
+ #include "rset.dlg"
+ #include "runtime.dlg"
+ #include "save_sel.dlg"
+ #include "sch_opts.dlg"
+ #include "schedule.dlg"
+ #include "tsearch.dlg"
+ #include "set_cat.dlg"
+ #include "set_log.dlg"
+ #include "set_opts.dlg"
+ #include "set_prt.dlg"
+ #include "set_rest.dlg"
+ #include "setback.dlg"
+ #include "srvlogin.dlg"
+ #include "tapepswd.dlg"
+ #include "use_sel.dlg"
+ #include "prtabort.dlg"
+#else
+ #include "omabout.dlg"
+ #include "ombrowse.dlg"
+ #include "omfiler.dlg"
+ #include "ombkup.dlg"
+ #include "omerase.dlg"
+ #include "omxchng.dlg"
+#ifdef OS_WIN32
+ #include "omhwconf.dlg"
+#else
+ #include "hwconf.dlg"
+#endif
+
+ #include "omruntim.dlg"
+ #include "omcatlog.dlg"
+ #include "font.dlg"
+ #include "omrset.dlg"
+#endif
+
+#ifdef DUMMY_DD
+ #include "ddd_dum.dlg"
+#endif
+
diff --git a/private/utils/ntbackup/src/dilntmsc.c b/private/utils/ntbackup/src/dilntmsc.c
new file mode 100644
index 000000000..e5ca71883
--- /dev/null
+++ b/private/utils/ntbackup/src/dilntmsc.c
@@ -0,0 +1,1747 @@
+/**
+Copyright(c) Conner Software Products Group 1993
+
+ Name: dilntmsc.c
+
+ Description: Contains all the async support code for dilnttp.c.
+
+ $Log: T:/LOGFILES/DILNTMSC.C_V $
+
+ Rev 1.3.1.10 12 Aug 1994 14:56:16 GREGG
+If the drive is an Anaconda, issue a rewind before setting the block size.
+
+ Rev 1.3.1.9 16 Mar 1994 19:27:22 GREGG
+Added support for two more DEC DLT drives: tz86 and tz87.
+
+ Rev 1.3.1.8 16 Feb 1994 19:16:42 GREGG
+Report num fmks NOT skipped on SPACE error, and ignore ERROR_FILEMARK.
+
+ Rev 1.3.1.7 14 Feb 1994 16:49:58 GREGG
+Make sure we don't change any other drive parameters when setting HW Comp.
+
+ Rev 1.3.1.6 07 Feb 1994 01:24:30 GREGG
+Only get drive id string once at init (EPR 139).
+
+ Rev 1.3.1.5 28 Jan 1994 18:22:30 GREGG
+Added EXB-5601 to list of drives that don't eject.
+
+ Rev 1.3.1.4 07 Jan 1994 15:34:12 GREGG
+Treat DEC's DLT2000 and DLT2700 the same as the THZ02.
+
+ Rev 1.3.1.3 08 Dec 1993 20:31:02 GREGG
+Merged in all the fixes Orcas needed from past it's branch.
+
+ Rev 1.3.1.2 29 Nov 1993 12:38:40 GREGG
+Check for TAPE_DRIVE_SET_COMPRESSION instead of TAPE_DRIVE_COMPRESSION.
+
+ Rev 1.3.1.1 21 Nov 1993 23:27:16 GREGG
+Make TpSpecial call run on their own thread.
+
+ Rev 1.3.1.0 21 May 1993 11:35:48 GREGG
+Added ERROR_CRC for bug in NT error mapping per Steve.
+
+ Rev 1.3 18 May 1993 13:29:42 TIMN
+Removed extern reference to TapeDevice.
+Changes from rev1.0 to this rev require DIL.h DDDEFS.h GENFUNCS.h
+
+ Rev 1.2 17 May 1993 18:17:26 GREGG
+Added function TpSpace, which is a super set of TpReadEndSet, and will
+eventually replace it, but for now, they map to the same gen func code
+(defined as both GEN_ERR_ENDSET and GEN_SPACE), have identical arguments,
+and have the same value for equivalent defined values for their parameters.
+Also changed the case in ProcessRequest to handle both functions.
+
+ Rev 1.1 17 May 1993 16:53:48 GREGG
+Added ERROR_NOT_DOS_DISK for bug in NT error mapping per Steve.
+
+ Rev 1.0 17 May 1993 16:49:56 GREGG
+DILNTTP.C, DILNTMSC.C and DILNTPRV.H replace DIL_NT.C at rev. 1.44.
+
+**/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "windows.h"
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "dilhwd.h"
+#include "mslreq.h"
+#include "retbuf.h"
+#include "genfuncs.h"
+#include "generr.h"
+#include "drvinf.h"
+#include "special.h"
+#include "genstat.h"
+#include "dddefs.h"
+#include "ld_dvr.h"
+#include "debug.h"
+#include "msassert.h"
+#include "be_debug.h"
+#include "dilntprv.h"
+#include "muiconf.h"
+
+#ifndef MS_RELEASE
+#define DEBUG_DIL 1
+#endif
+
+// ------------------------------------
+
+LARGE_INTEGER gb_drv_features ;
+
+// In this circular queue implementation one node is wasted, thus actually
+// use N-1 nodes.
+
+static FAKE_TCB tcbs[NUM_TCBS + 1] = { NULL } ;
+
+
+/*------------------------------------------------------------------------
+ Circular queue header
+------------------------------------------------------------------------*/
+// Physicall there is only one circular queue. Logically it appears like
+// two queues. The CQueue pointer is used as an in queue and also keep
+// track of the last request executed. The OutCQueue pointer is used
+// as an out queue pointer. The TpReceives uses this pointer to get
+// requests that have been executed and waiting to be retrieved.
+
+Q_HEADER DILNT_CQueue = { NULL } ; // Circular queue (in and process)
+Q_HEADER DILNT_OutCQueue = { NULL } ; // Pointer into the circular queue
+ // this is used by the TpReceive
+ // proc to pop the element off.
+
+/*------------------------------------------------------------------------
+ Some globals declarations
+------------------------------------------------------------------------*/
+
+INT DILNT_ProcessErrorFlag; // Flag to notify Tp calls that an error
+ // was encountered. Flag is set in
+ // the ProcessRequest proc and reset
+ // int the TpReceive proc.
+
+INT DILNT_FOREVER = FOREVER_FOREVER;
+
+HANDLE DILNT_deviceHandle = INVALID_HANDLE_VALUE ;
+
+HANDLE DILNT_OKToProcessSemaphore; // global semaphore to release
+ // the thread for processing
+HANDLE DILNT_QThread_0 = NULL; // global thread handle for
+ // the queue manager
+HANDLE DILNT_CQueueSemaphore; // Semaphore to control the
+ // circular queue
+
+// Globals for TpSpecial Thread
+
+CRITICAL_SECTION DILNT_SpecialCriticalSection ;
+INT16 DILNT_SpecialCode ;
+UINT32 DILNT_SpecialMisc ;
+BOOLEAN DILNT_SpecialDone ;
+BOOLEAN DILNT_SpecialEnd ;
+BOOLEAN DILNT_SpecialReturn ;
+CHAR DILNT_SpecialDriveName[81] ;
+HANDLE DILNT_SpecialThread = NULL ;
+
+// For storing drive registry string
+CHAR DILNT_DriveName[81] ;
+
+
+/*------------------------------------------------------------------------
+ Function Declaration
+------------------------------------------------------------------------*/
+
+VOID InitializeTapeBlockSize( void ) ;
+
+static BOOLEAN IsCQueueFull( Q_HEADER_PTR queue,
+ Q_HEADER_PTR outqueue
+);
+
+static BOOLEAN
+IsCOutQueueEmpty( Q_HEADER_PTR outqueue,
+ Q_HEADER_PTR CQueue
+);
+
+static BOOLEAN
+CDequeue( Q_HEADER_PTR queue,
+ FAKE_TCB_PTR tmpTCB
+);
+
+static BOOLEAN
+IsCQueueEmpty( Q_HEADER_PTR queue
+);
+
+static VOID
+ProcessRequest(); // Thread to process request
+
+static VOID StoreRetBufInfo( IN FAKE_TCB_PTR tmpTCB,
+ IN DWORD status
+);
+
+static VOID ProcessSpecial( VOID ) ;
+
+
+/**/
+VOID StoreRetBufInfo( FAKE_TCB_PTR tmpTCB,
+ DWORD status
+)
+{
+ TAPE_GET_MEDIA_PARAMETERS parms ;
+ DWORD buffsize;
+ DWORD lst_err ;
+
+ tmpTCB->ret_stuff.call_type = tmpTCB->dil_request.gen_func_code ;
+ tmpTCB->ret_stuff.gen_error = GEN_NO_ERR ;
+ tmpTCB->ret_stuff.status = 0L ;
+
+ switch ( tmpTCB->ret_stuff.call_type ) {
+ case GEN_READ:
+ case GEN_WRITE:
+ if ( status == TRUE ) {
+ return ;
+ }
+ break ;
+
+ default:
+ if ( status == NO_ERROR ) {
+ return ;
+ }
+ break ;
+ }
+
+ switch( ( lst_err = GetLastError( ) ) ) {
+
+ case ERROR_FILEMARK_DETECTED: // 1101
+ case ERROR_SETMARK_DETECTED: // 1103
+ case ERROR_END_OF_MEDIA: // 1100
+ case ERROR_NO_MEDIA_IN_DRIVE: // 1112
+ case ERROR_NO_DATA: // 0232
+ case ERROR_NO_DATA_DETECTED: // 1104
+ case ERROR_BEGINNING_OF_MEDIA: // 1102
+
+ buffsize = sizeof( TAPE_GET_MEDIA_PARAMETERS ) ;
+ if( GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_MEDIA_INFORMATION,
+ &buffsize, &parms ) == SUCCESS ) {
+
+ if( parms.WriteProtected == TRUE) {
+ tmpTCB->ret_stuff.status |= TPS_WRITE_PROTECT ;
+ }
+ }
+ break ;
+
+ default:
+ break ;
+ }
+
+ switch( lst_err ) {
+ case ERROR_FILEMARK_DETECTED: // 1101
+ case ERROR_SETMARK_DETECTED: // 1103
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_ENDSET ;
+ tmpTCB->ret_stuff.status |= TPS_FMK ;
+ break ;
+
+ case ERROR_END_OF_MEDIA: // 1100
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_EOM ;
+ tmpTCB->ret_stuff.status |= TPS_EOM ;
+ break ;
+
+ case ERROR_SUCCESS: // 0000
+ break ;
+
+ case ERROR_NO_MEDIA_IN_DRIVE: // 1112
+ if( tmpTCB->ret_stuff.call_type != GEN_STATUS ) {
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_NO_MEDIA ;
+ }
+ tmpTCB->ret_stuff.status |= TPS_NO_TAPE ;
+ break ;
+
+ case ERROR_BAD_LENGTH: // 0024
+ case ERROR_CRC: // 0023
+ case ERROR_NOT_DOS_DISK: // 0026
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_BAD_DATA ;
+ tmpTCB->ret_stuff.status |= TPS_DRV_FAILURE ;
+ break ;
+
+ case ERROR_IO_DEVICE: // 1117
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_HARDWARE ;
+ tmpTCB->ret_stuff.status |= TPS_DRV_FAILURE ;
+ break ;
+
+ case ERROR_INVALID_FUNCTION: // 0001
+ case ERROR_FILE_NOT_FOUND: // 0002
+ case ERROR_SECTOR_NOT_FOUND: // 0027
+ case ERROR_INVALID_PARAMETER: // 0087
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_INVALID_CMD ;
+ tmpTCB->ret_stuff.status |= TPS_ILL_CMD ;
+ break ;
+
+ case ERROR_WRITE_PROTECT: // 0019
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_WRT_PROTECT ;
+ tmpTCB->ret_stuff.status |= TPS_WRITE_PROTECT ;
+ break;
+
+ case ERROR_NO_DATA: // 0232
+ case ERROR_NO_DATA_DETECTED: // 1104
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_NO_DATA ;
+ tmpTCB->ret_stuff.status |= TPS_NO_DATA ;
+ break;
+
+ case ERROR_SEM_TIMEOUT: // 0121
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_TIMEOUT ;
+ tmpTCB->ret_stuff.status |= TPS_DRV_FAILURE ;
+ break;
+
+ case ERROR_MEDIA_CHANGED: // 1110
+ if ( tmpTCB->ret_stuff.call_type != GEN_MOUNT &&
+ tmpTCB->ret_stuff.call_type != GEN_OPEN ) {
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_RESET ;
+ }
+ tmpTCB->ret_stuff.status |= TPS_NEW_TAPE ;
+ break ;
+
+ case ERROR_BUS_RESET: // 1129
+ if ( tmpTCB->ret_stuff.call_type != GEN_MOUNT &&
+ tmpTCB->ret_stuff.call_type != GEN_OPEN ) {
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_RESET ;
+ }
+ tmpTCB->ret_stuff.status |= TPS_RESET ;
+ break ;
+
+ case ERROR_BEGINNING_OF_MEDIA: // 1102
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_EOM ;
+ tmpTCB->ret_stuff.status |= TPS_BOT ;
+ break ;
+
+ case ERROR_EOM_OVERFLOW: // 1130
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_EOM_OVERFLOW ;
+ tmpTCB->ret_stuff.status |= TPS_EOM ;
+ break ;
+
+ case ERROR_NOT_READY: // 0021
+ if( tmpTCB->ret_stuff.call_type != GEN_STATUS ) {
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_NO_MEDIA ;
+ }
+ tmpTCB->ret_stuff.status |= TPS_NO_TAPE | TPS_NOT_READY ;
+ break ;
+
+ case ERROR_UNRECOGNIZED_MEDIA:
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_UNRECOGNIZED_MEDIA ;
+ break ;
+
+ case ERROR_INVALID_BLOCK_LENGTH:
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_WRONG_BLOCK_SIZE ;
+ break ;
+
+ default:
+ tmpTCB->ret_stuff.gen_error = GEN_ERR_UNDETERMINED ;
+ tmpTCB->ret_stuff.status |= TPS_DRV_FAILURE ;
+ break ;
+ }
+
+ return ;
+}
+
+/**
+
+ Name: ProcessRequest
+
+ Description: This function is threaded and acts as a queue manager.
+ Monitors the in_q, if request found then performs the
+ request and places the result in the out_q
+
+ Parameters : None
+
+ Returns:
+
+**/
+
+VOID ProcessRequest ( )
+{
+ FAKE_TCB_PTR tmpTCB;
+ FAKE_TCB dummyTCB;
+ Q_ELEM_PTR element;
+ BOOLEAN dretcode;
+
+ while ( DILNT_FOREVER == FOREVER_FOREVER) {
+
+ // check to see if anything request is in the in_q to process
+
+ while ( WaitForSingleObject( DILNT_OKToProcessSemaphore, NOWAIT ) ) {
+ if ( DILNT_FOREVER == FOREVER_STOP ) {
+ ExitThread( FOREVER_STOP );
+ }
+ ThreadSwitch( ) ;
+ }
+
+ // ---------------------------------------------------------------
+ // Check to make sure that the TpReceive did not clear the queue
+ // out when it got an error from a request
+ // ---------------------------------------------------------------
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ if ( DILNT_FOREVER == FOREVER_STOP ) {
+ ExitThread( FOREVER_STOP );
+ }
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag || IsCQueueEmpty( &DILNT_CQueue ) ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ continue;
+ }
+ // ---------------------------------------------------------------
+
+ element = ( Q_ELEM_PTR )DILNT_CQueue.q_head->q_next;
+ tmpTCB = (FAKE_TCB_PTR) element;
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ switch( tmpTCB->dil_request.gen_func_code ) {
+
+ // TpClose
+ case GEN_NRCLOSE:
+ {
+ DWORD status = NO_ERROR ;
+
+ /* This is a kludge for the DLT drive. The drive won't
+ write a directory track on the tape until an unload
+ is done, so we do an unload before we exit the app.
+ This will also cause a rewind, which isn't the
+ desired effect when calling NR_CLOSE, but we have to
+ do it in this case. The call is made to return
+ immediately (last param TRUE) rather than waiting
+ for the rewind to complete, so there won't be any
+ noticeable delay in the app exit.
+ */
+ if( strstr( DILNT_DriveName, TEXT( "cipher" ) ) != NULL ||
+ ( strstr( DILNT_DriveName, TEXT( "dec" ) ) != NULL &&
+ ( strstr( DILNT_DriveName, TEXT( "thz02" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "tz86" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "tz87" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "dlt2700" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "dlt2000" ) ) != NULL ) ) ) {
+
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOAD,
+ TRUE ) ;
+ }
+ StoreRetBufInfo( tmpTCB, status ) ;
+ CloseHandle( DILNT_deviceHandle ) ;
+ DILNT_deviceHandle = INVALID_HANDLE_VALUE ;
+ break ;
+ }
+
+ // TpCloseRewind
+ case GEN_RCLOSE:
+ {
+ DWORD status = NO_ERROR ;
+
+ /* This is a kludge for the DLT drive. The drive won't
+ write a directory track on the tape until an unload
+ is done, so we do an unload before we exit the app.
+ This will also rewind the drive, and it is called
+ for immediate return (last param TRUE) so the outward
+ effect is the same as the rewind immediate called for
+ all other drives.
+ */
+ if( strstr( DILNT_DriveName, TEXT( "cipher" ) ) != NULL ||
+ ( strstr( DILNT_DriveName, TEXT( "dec" ) ) != NULL &&
+ ( strstr( DILNT_DriveName, TEXT( "thz02" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "tz86" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "tz87" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "dlt2700" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "dlt2000" ) ) != NULL ) ) ) {
+
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOAD,
+ TRUE ) ;
+ } else {
+
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_REWIND,
+ 0,
+ 0,
+ 0,
+ TRUE ) ;
+ }
+ StoreRetBufInfo( tmpTCB, status ) ;
+ CloseHandle( DILNT_deviceHandle ) ;
+ DILNT_deviceHandle = INVALID_HANDLE_VALUE ;
+ break ;
+ }
+
+ // TpRead
+ case GEN_READ:
+ {
+ DWORD amount_read = 0L ;
+ BOOLEAN status ;
+ UINT8_PTR baddr = tmpTCB->dil_request.baddr;
+ UINT32 length = tmpTCB->dil_request.length;
+
+ status = ReadFile( DILNT_deviceHandle,
+ (PVOID)baddr,
+ (DWORD)length,
+ &amount_read,
+ NULL ) ;
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ tmpTCB->ret_stuff.len_req = length ;
+ tmpTCB->ret_stuff.buffer = baddr ;
+ tmpTCB->ret_stuff.len_got = amount_read ;
+ break;
+ }
+
+ // TpRelease
+ case GEN_RELEASE:
+ {
+ StoreRetBufInfo( tmpTCB, NO_ERROR ) ;
+ break;
+ }
+
+ // TpReset
+ case GEN_RESET:
+ {
+ StoreRetBufInfo( tmpTCB, NO_ERROR ) ;
+ break;
+ }
+
+ // TpWrite
+ case GEN_WRITE:
+ {
+ BOOLEAN status ;
+ DWORD written ;
+ UINT8_PTR baddr = tmpTCB->dil_request.baddr;
+ UINT32 length = tmpTCB->dil_request.length;
+
+ status = WriteFile( DILNT_deviceHandle,
+ (PVOID)baddr,
+ (DWORD)length,
+ &written,
+ NULL ) ;
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ tmpTCB->ret_stuff.len_req = length ;
+ tmpTCB->ret_stuff.buffer = baddr ;
+ tmpTCB->ret_stuff.len_got = written ;
+ break;
+ }
+
+ // TpRewind
+ case GEN_REWIND:
+ {
+ DWORD status ;
+ BOOLEAN immediate = (BOOLEAN)tmpTCB->dil_request.parm1;
+
+ if (immediate) {
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_REWIND,
+ 0,
+ 0,
+ 0,
+ TRUE ) ;
+ } else {
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_REWIND,
+ 0,
+ 0,
+ 0,
+ FALSE ) ;
+ }
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ break;
+ }
+
+ // TpRetension
+ case GEN_RETEN:
+ {
+ DWORD status ;
+
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_TENSION,
+ FALSE ) ;
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ break;
+ }
+
+ // TpErase
+ case GEN_ERASE:
+ {
+ DWORD status ;
+ ULONG lowpart = gb_drv_features.LowPart;
+
+ switch( tmpTCB->dil_request.misc ) {
+
+ case ERASE_TYPE_FORMAT:
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_FORMAT,
+ FALSE ) ;
+ break;
+
+ default:
+ if ( lowpart & TAPE_DRIVE_ERASE_LONG ) {
+ status = EraseTape( DILNT_deviceHandle,
+ TAPE_ERASE_LONG,
+ FALSE ) ;
+ } else {
+
+ status = EraseTape( DILNT_deviceHandle,
+ TAPE_ERASE_SHORT,
+ FALSE ) ;
+ }
+ break;
+ }
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ break;
+ }
+
+ // TpWriteEndSet
+ case GEN_WRITE_ENDSET:
+ {
+ DWORD status ;
+ LONG highpart = gb_drv_features.HighPart;
+
+ if ( highpart & TAPE_DRIVE_WRITE_FILEMARKS ) {
+ status = WriteTapemark( DILNT_deviceHandle,
+ TAPE_FILEMARKS,
+ 1,
+ FALSE ) ;
+ } else if ( highpart & TAPE_DRIVE_WRITE_SHORT_FMKS ) {
+ status = WriteTapemark( DILNT_deviceHandle,
+ TAPE_SHORT_FILEMARKS,
+ 1,
+ FALSE ) ;
+ } else {
+ status = WriteTapemark( DILNT_deviceHandle,
+ TAPE_LONG_FILEMARKS,
+ 1,
+ FALSE ) ;
+ }
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ break;
+ }
+
+ // TpReadEndSet and TpSpace
+
+ // Note: TpSpace is a super set of TpReadEndSet, and will
+ // eventually replace it all together. The following
+ // code uses the new defines, but the values match
+ // those of the old defines so both are supported.
+
+ case GEN_SPACE: // Was GEN_READ_ENDSET
+ {
+ DWORD status = NO_ERROR ;
+ DWORD offset_hi ;
+ DWORD lst_err ;
+ INT16 incr ;
+ INT16 count = tmpTCB->dil_request.misc;
+ INT16 type = (INT16)tmpTCB->dil_request.parm1;
+
+ if ( type == SPACE_BKWD_FMK || type == SPACE_BKWD_BLK ) {
+ offset_hi = 0xffffffff ;
+ count = -count ;
+ incr = -1 ;
+ } else {
+ offset_hi = 0 ;
+ incr = 1 ;
+ }
+
+ switch( type ) {
+
+ case SPACE_EOD: // Was TO_EOD
+
+ /* The following is a kludge to deal with the fact
+ that the Wangtek 5150ES has to be at BOT when
+ you issue a seek to EOD, or it will crawl up and
+ down the whole tape looking for it.
+ */
+ if( strstr( DILNT_DriveName, TEXT( "wangtek" ) ) != NULL &&
+ strstr( DILNT_DriveName, TEXT( "5150es" ) ) != NULL ) {
+
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_REWIND,
+ 0,
+ 0,
+ 0,
+ FALSE ) ;
+ }
+
+ if( status == NO_ERROR ) {
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_SPACE_END_OF_DATA,
+ 0,
+ 0,
+ 0,
+ FALSE ) ;
+ }
+ break ;
+
+ case SPACE_BKWD_FMK: // Was BACKWARD
+ case SPACE_FWD_FMK: // Was FORWARD
+
+ do {
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_SPACE_FILEMARKS,
+ 0,
+ incr,
+ offset_hi,
+ FALSE ) ;
+
+ if( status != NO_ERROR ) {
+ lst_err = GetLastError( ) ;
+ if( lst_err == ERROR_FILEMARK_DETECTED ||
+ lst_err == ERROR_SETMARK_DETECTED ) {
+
+ status = NO_ERROR ;
+ count -= incr ;
+ }
+ } else {
+ count -= incr ;
+ }
+ } while( count != 0 && status == NO_ERROR ) ;
+
+ if( count < 0 ) {
+ tmpTCB->ret_stuff.misc = -count ;
+ } else {
+ tmpTCB->ret_stuff.misc = count ;
+ }
+ break ;
+
+ case SPACE_BKWD_BLK: // New
+ case SPACE_FWD_BLK: // New
+
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_SPACE_RELATIVE_BLOCKS,
+ 0,
+ count,
+ offset_hi,
+ FALSE ) ;
+ break ;
+
+ }
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ break;
+ }
+
+ // TpStatus
+ case GEN_STATUS:
+ {
+ DWORD status ;
+ TAPE_GET_MEDIA_PARAMETERS parms ;
+ DWORD buffsize;
+
+ status = GetTapeStatus( DILNT_deviceHandle );
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+
+ buffsize = sizeof( TAPE_GET_MEDIA_PARAMETERS );
+
+ status = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_MEDIA_INFORMATION,
+ &buffsize,
+ &parms ) ;
+
+ if ( status == SUCCESS && parms.WriteProtected == TRUE) {
+ tmpTCB->ret_stuff.status |= TPS_WRITE_PROTECT ;
+ }
+
+ break;
+ }
+
+ // TpSeek
+ case GEN_SEEK:
+ {
+ DWORD status ;
+ UINT32 block = tmpTCB->dil_request.parm1;
+
+ // Make it zero relative
+ block-- ;
+
+ status = SetTapePosition( DILNT_deviceHandle,
+ TAPE_LOGICAL_BLOCK,
+ 0,
+ block,
+ 0,
+ FALSE ) ;
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ break;
+ }
+
+ case GEN_GETPOS:
+ {
+ DWORD partition = 0 ;
+ DWORD block = 0 ;
+ DWORD block_hi = 0 ;
+ DWORD status ;
+
+ status = GetTapePosition( DILNT_deviceHandle,
+ TAPE_LOGICAL_POSITION,
+ &partition,
+ &block,
+ &block_hi ) ;
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+
+ // Increment block address to make it 1 based
+ block++ ;
+ tmpTCB->ret_stuff.misc = block ;
+ break;
+ }
+
+ // TpMount
+ case GEN_MOUNT:
+ {
+ DWORD status;
+ TAPE_GET_MEDIA_PARAMETERS parms ;
+ DWORD buffsize;
+ TAPE_GET_DRIVE_PARAMETERS drivebuff;
+ TAPE_SET_MEDIA_PARAMETERS mediabuff;
+
+ if ( gb_drv_features.HighPart & TAPE_DRIVE_LOCK_UNLOCK ) {
+ PrepareTape( DILNT_deviceHandle,
+ TAPE_LOCK,
+ FALSE ) ;
+ }
+
+ status = GetTapeStatus( DILNT_deviceHandle );
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+
+ if ( tmpTCB->ret_stuff.gen_error != GEN_NO_ERR) {
+ if (gb_drv_features.HighPart & TAPE_DRIVE_LOCK_UNLOCK) {
+
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOCK,
+ FALSE ) ;
+ }
+
+ break ;
+ }
+
+
+ buffsize = sizeof( TAPE_GET_MEDIA_PARAMETERS );
+
+ status = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_MEDIA_INFORMATION,
+ &buffsize,
+ &parms ) ;
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+
+ if ( status != NO_ERROR ) {
+ if ( ( tmpTCB->ret_stuff.gen_error != GEN_NO_ERR) &&
+ (gb_drv_features.HighPart & TAPE_DRIVE_LOCK_UNLOCK) ) {
+
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOCK,
+ FALSE ) ;
+ }
+ break ;
+ }
+
+
+ if (parms.WriteProtected == TRUE) {
+ tmpTCB->ret_stuff.status |= TPS_WRITE_PROTECT ;
+ }
+
+ buffsize = sizeof( TAPE_GET_DRIVE_PARAMETERS );
+
+ status = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_DRIVE_INFORMATION,
+ &buffsize,
+ &drivebuff );
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+
+ if (status != NO_ERROR) {
+ if ( ( tmpTCB->ret_stuff.gen_error != GEN_NO_ERR) &&
+ (gb_drv_features.HighPart & TAPE_DRIVE_LOCK_UNLOCK) ) {
+
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOCK,
+ FALSE ) ;
+ }
+ break ;
+ }
+
+
+ // Store drive features
+ gb_drv_features.LowPart = drivebuff.FeaturesLow;
+ gb_drv_features.HighPart = drivebuff.FeaturesHigh;
+
+ if (parms.BlockSize == 0) {
+ mediabuff.BlockSize = drivebuff.DefaultBlockSize;
+
+ SetTapeParameters( DILNT_deviceHandle,
+ SET_TAPE_MEDIA_INFORMATION,
+ &mediabuff );
+ }
+
+ break;
+ }
+
+ case GEN_DISMOUNT:
+ {
+ DWORD status;
+
+ if ( gb_drv_features.HighPart & TAPE_DRIVE_LOCK_UNLOCK ) {
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOCK,
+ FALSE ) ;
+ StoreRetBufInfo( tmpTCB, status ) ;
+ } else {
+ StoreRetBufInfo( tmpTCB, NO_ERROR ) ;
+ }
+
+ break;
+ }
+
+ case GEN_EJECT:
+ {
+ DWORD status = NO_ERROR;
+
+
+ if ( gb_drv_features.HighPart & TAPE_DRIVE_LOCK_UNLOCK ) {
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOCK,
+ FALSE ) ;
+ }
+
+ if ( status == NO_ERROR ) {
+ status = PrepareTape( DILNT_deviceHandle,
+ TAPE_UNLOAD,
+ FALSE );
+ }
+
+ StoreRetBufInfo( tmpTCB, status ) ;
+ break;
+ }
+
+ default:
+ continue;
+
+ } // END - switch( tmpTCB->dil_request.gen_func_code )
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+ dretcode = CDequeue( &DILNT_CQueue, &dummyTCB );
+ if ( dummyTCB.ret_stuff.gen_error ) {
+
+ // Reset the queue to empty, EXCEPT the OutCQueue pointer,
+ // the TpReceive must have a chance to let the app get the
+ // last processed request in error
+ DILNT_CQueue.q_tail = DILNT_CQueue.q_head;
+ DILNT_ProcessErrorFlag = 1;
+
+ // reset the DILNT_OKToProcessSemaphore to non-signaled state
+ while ( WaitForSingleObject( DILNT_OKToProcessSemaphore, 0L ) == SIGNALEDSTATE ) ;
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+
+ } // END - while ( FOREVER_FOREVER )
+
+ ExitThread( FOREVER_STOP );
+
+}
+
+/**
+
+ Name: CreateAThread
+
+ Description: Creates a thread
+
+ Returns: HANDLE to the thread created
+
+**/
+
+HANDLE CreateAThread( VOID )
+{
+ HANDLE hthread;
+ DWORD pdword;
+
+ hthread = CreateThread( NULL, // security descriptor
+ (DWORD) 0, // stack size
+ (LPVOID)ProcessRequest, // ptr to a function
+ NULL, // ptr to argument
+ 0, // creation flag
+ &pdword ); // thread id
+ return ( hthread ) ;
+}
+
+
+/**
+
+ Name: InitSpecialThread
+
+ Description: Creates the TpSpecial Thread
+
+ Returns: HANDLE to the thread created
+
+**/
+
+HANDLE InitSpecialThread( VOID )
+{
+ HANDLE hthread;
+ DWORD pdword;
+
+ InitializeCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ DILNT_SpecialCode = 0 ;
+ DILNT_SpecialDone = TRUE ;
+ DILNT_SpecialEnd = FALSE ;
+
+ hthread = CreateThread( NULL, // security descriptor
+ (DWORD) 0, // stack size
+ (LPVOID)ProcessSpecial, // ptr to a function
+ NULL, // ptr to argument
+ 0, // creation flag
+ &pdword ); // thread id
+ return ( hthread ) ;
+}
+
+/**/
+/**
+
+ Name: ProcessSpecial
+
+ Description: This function runs on a separate thread and processes
+ TpSpecial commands.
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+
+static VOID ProcessSpecial( VOID )
+{
+ DRV_INF_PTR drvinf ;
+ UINT16 ret_val ;
+ TAPE_GET_DRIVE_PARAMETERS getdrive ;
+ TAPE_GET_MEDIA_PARAMETERS getmedia ;
+ TAPE_SET_MEDIA_PARAMETERS setmedia ;
+ TAPE_SET_DRIVE_PARAMETERS setdrive ;
+ DWORD buffsize ;
+ DWORD reply ;
+ INT16 i ;
+ INT16 j ;
+ INT16 sp_serv ;
+ UINT32 misc ;
+ BOOLEAN kill_myself = FALSE ;
+ BOOLEAN done ;
+
+ while( 1 + 1 == 2 ) {
+
+ sp_serv = 0 ;
+
+ while( !sp_serv ) {
+ EnterCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ if( DILNT_SpecialEnd ) {
+ kill_myself = TRUE ;
+ }
+ else if( sp_serv = DILNT_SpecialCode ) {
+ DILNT_SpecialCode = 0 ;
+ misc = DILNT_SpecialMisc ;
+ }
+ LeaveCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ if( kill_myself ) {
+ ExitThread( 0 ) ;
+ }
+ Sleep( 5 ) ;
+ }
+
+ ret_val = SUCCESS ;
+
+ switch( sp_serv ) {
+
+ case SS_GET_DRV_INF:
+ buffsize = sizeof( TAPE_GET_DRIVE_PARAMETERS ) ;
+ for( i = 0, reply = !NO_ERROR; reply != NO_ERROR && i < 8; i++ ) {
+ reply = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_DRIVE_INFORMATION,
+ &buffsize,
+ &getdrive ) ;
+ }
+ if( reply != NO_ERROR ) {
+ ret_val = FAILURE ;
+ break ;
+ }
+
+ // Store drive features
+ gb_drv_features.LowPart = getdrive.FeaturesLow;
+ gb_drv_features.HighPart = getdrive.FeaturesHigh;
+
+ buffsize = sizeof( TAPE_GET_MEDIA_PARAMETERS );
+
+ getmedia.BlockSize = 0;
+ reply = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_MEDIA_INFORMATION,
+ &buffsize,
+ &getmedia );
+
+ if( reply != NO_ERROR ) {
+ getmedia.BlockSize = getdrive.DefaultBlockSize ;
+ }
+
+ if( getmedia.BlockSize == 0 ) {
+ setmedia.BlockSize = getmedia.BlockSize = getdrive.DefaultBlockSize ;
+
+ if ( SetTapeParameters( DILNT_deviceHandle,
+ SET_TAPE_MEDIA_INFORMATION,
+ &setmedia ) ) {
+
+ setmedia.BlockSize = getmedia.BlockSize = 0x200 ;
+
+ if ( SetTapeParameters( DILNT_deviceHandle,
+ SET_TAPE_MEDIA_INFORMATION,
+ &setmedia ) ) {
+ getmedia.BlockSize = 0;
+ }
+ }
+
+ }
+
+
+ drvinf = (DRV_INF_PTR)misc ;
+
+ strcpy( drvinf->drv_vendor, TEXT("") ) ;
+ strcpy( drvinf->drv_product, TEXT("") ) ;
+ strcpy( drvinf->drv_firmrev, TEXT("") ) ;
+
+ drvinf->drv_media = UNKNOWN ;
+ drvinf->drv_bsize = (UINT16)getmedia.BlockSize ;
+ drvinf->drv_features &= TDI_DRV_COMPRES_INIT ;
+ drvinf->drv_features |= TDI_NODATA | TDI_NODATA_FMK ;
+
+ if ( getdrive.Compression ) {
+ drvinf->drv_features |= TDI_DRV_COMPRESS_ON ;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_SET_COMPRESSION ) {
+ drvinf->drv_features |= TDI_DRV_COMPRESSION ;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_FILEMARKS ) {
+ drvinf->drv_features |= TDI_FAST_FMK ;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_LOGICAL_BLK ) {
+ drvinf->drv_features |= TDI_FAST_NBLK ;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_END_OF_DATA ) {
+ drvinf->drv_features |= TDI_FAST_EOD ;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_REVERSE_POSITION ) {
+
+ if ( gb_drv_features.HighPart & TAPE_DRIVE_RELATIVE_BLKS ) {
+ drvinf->drv_features |= TDI_REV_FMK ;
+ }
+ }
+
+ if( ( gb_drv_features.LowPart & TAPE_DRIVE_FIXED ) ||
+ ( gb_drv_features.LowPart & TAPE_DRIVE_SELECT ) ||
+ ( gb_drv_features.LowPart & TAPE_DRIVE_INITIATOR ) ) {
+
+ drvinf->drv_features |= TDI_DIR_TRACK ;
+ }
+
+ if( gb_drv_features.LowPart & TAPE_DRIVE_GET_LOGICAL_BLK ) {
+ drvinf->drv_features |= TDI_BLK_POS ;
+ }
+
+ if( gb_drv_features.LowPart & TAPE_DRIVE_ERASE_SHORT ) {
+ drvinf->drv_features |= TDI_SHORT_ERASE ;
+ }
+
+ if( gb_drv_features.LowPart & TAPE_DRIVE_ERASE_LONG ) {
+ drvinf->drv_features |= TDI_LONG_ERASE ;
+ }
+
+ if( ( gb_drv_features.HighPart & TAPE_DRIVE_WRITE_FILEMARKS ) ||
+ ( gb_drv_features.HighPart & TAPE_DRIVE_WRITE_SHORT_FMKS ) ||
+ ( gb_drv_features.HighPart & TAPE_DRIVE_WRITE_LONG_FMKS ) ) {
+
+ drvinf->drv_features |= TDI_FMK;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_TENSION ) {
+ drvinf->drv_features |= TDI_RETENSION;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_FORMAT ) {
+ drvinf->drv_features |= TDI_FORMAT;
+ }
+
+ if( gb_drv_features.HighPart & TAPE_DRIVE_SET_BLOCK_SIZE ) {
+ drvinf->drv_features |= TDI_CHNG_BLK_SIZE ;
+ }
+
+ /* The following is a kludge to deal with the fact that many
+ drives support "Load/Unload" commands, but we only want to
+ set the TDI_ feature bit on those drives which actually
+ eject the tape from the drive automatically. In future
+ versions of NT, the drivers will have a separate feature
+ bit for this, and this kludge can and should be removed.
+ */
+ if( strstr( DILNT_SpecialDriveName, TEXT( "scsi" ) ) != NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( "exb-2501" ) ) == NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( "wangtek" ) ) == NULL &&
+ ( strstr( DILNT_SpecialDriveName, TEXT( "tandberg" ) ) == NULL ||
+ ( strstr( DILNT_SpecialDriveName, TEXT( " TDC 3500" ) ) == NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( " TDC 3700" ) ) == NULL ) ) &&
+
+ strstr( DILNT_SpecialDriveName, TEXT( "cipher" ) ) == NULL &&
+ ( strstr( DILNT_SpecialDriveName, TEXT( "dec" ) ) == NULL ||
+ ( strstr( DILNT_SpecialDriveName, TEXT( "thz02" ) ) == NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( "tz86" ) ) == NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( "tz87" ) ) == NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( "dlt2000" ) ) == NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( "dlt2700" ) ) == NULL ) ) &&
+ strstr( DILNT_SpecialDriveName, TEXT( "viper" ) ) == NULL ) {
+
+ }
+ if( gb_drv_features.HighPart & TAPE_DRIVE_LOAD_UNLOAD ) {
+ if ( gb_drv_features.HighPart & TAPE_DRIVE_EJECT_MEDIA) {
+ drvinf->drv_features |= TDI_UNLOAD ;
+ }
+ }
+ break ;
+
+
+ case SS_SET_DRV_COMPRESSION:
+
+ // Get drive info to see if it supports hardware compression
+
+ buffsize = sizeof( TAPE_GET_DRIVE_PARAMETERS ) ;
+
+ for( i = 0, reply = !NO_ERROR; reply != NO_ERROR && i < 8; i++ ) {
+ reply = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_DRIVE_INFORMATION,
+ &buffsize,
+ &getdrive ) ;
+ }
+
+ if( reply != NO_ERROR ) {
+ ret_val = FAILURE ;
+ break ;
+ }
+
+ // If the doesn't support hardware compression, get out.
+
+ if( !( getdrive.FeaturesHigh & TAPE_DRIVE_SET_COMPRESSION ) ) {
+ ret_val = FAILURE ;
+ break ;
+ }
+
+ // Set up setdrive buffer
+
+ setdrive.ECC = getdrive.ECC ;
+ setdrive.DataPadding = getdrive.DataPadding ;
+ setdrive.ReportSetmarks = getdrive.ReportSetmarks ;
+ setdrive.EOTWarningZoneSize = getdrive.EOTWarningZoneSize ;
+
+ switch ( misc ) {
+
+ case ENABLE_DRV_COMPRESSION:
+ setdrive.Compression = TRUE ;
+ break ;
+
+ case DISABLE_DRV_COMPRESSION:
+ setdrive.Compression = FALSE ;
+ break ;
+
+ default:
+ msassert( FALSE ) ;
+ ret_val = FAILURE ;
+ break ;
+ }
+
+ if( ret_val == FAILURE ) {
+ break ;
+ }
+
+ // If we're already in the requested mode, we're done.
+
+ if( ( getdrive.Compression && setdrive.Compression ) ||
+ ( !getdrive.Compression && !setdrive.Compression ) ) {
+
+ break ;
+ }
+
+ // Request the mode change
+
+ reply = SetTapeParameters( DILNT_deviceHandle,
+ SET_TAPE_DRIVE_INFORMATION,
+ &setdrive ) ;
+
+ if( reply != NO_ERROR ) {
+ ret_val = FAILURE ;
+ break ;
+ }
+
+ /* Here we're going to try five times to get the tape
+ parameters and verify that we're in the right mode.
+ If after 5 trys we're still not in the requested mode,
+ we're going to quit and call it a failure.
+ */
+ buffsize = sizeof( TAPE_GET_DRIVE_PARAMETERS ) ;
+ done = FALSE ;
+
+ for( j = 0; !done && j < 5; j++ ) {
+ reply = !NO_ERROR ;
+
+ for( i = 0; reply != NO_ERROR && i < 8; i++ ) {
+ reply = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_DRIVE_INFORMATION,
+ &buffsize,
+ &getdrive ) ;
+ }
+
+ if( reply != NO_ERROR ) {
+ ret_val = FAILURE ;
+ done = TRUE ;
+ } else {
+ if( misc == ENABLE_DRV_COMPRESSION ) {
+ if( getdrive.Compression ) {
+ done = TRUE ;
+ }
+ } else {
+ if( !getdrive.Compression ) {
+ done = TRUE ;
+ }
+ }
+ }
+ }
+
+ // Finally, we check to see if we did it
+
+ if( !done ) {
+ ret_val = FAILURE ;
+ }
+ break ;
+
+
+ case SS_CHANGE_BLOCK_SIZE:
+ /* Check if tape format wants to set drive to its default
+ block size, or set drive to the value passed in thru misc. */
+ if( misc == DEFAULT_BLOCK_SIZE ) {
+ buffsize = sizeof( TAPE_GET_DRIVE_PARAMETERS ) ;
+
+ reply = GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_DRIVE_INFORMATION,
+ &buffsize,
+ &getdrive ) ;
+
+ if ( reply ) {
+ switch( reply ) {
+ case ERROR_BUS_RESET:
+ case ERROR_MEDIA_CHANGED:
+ if ( GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_DRIVE_INFORMATION,
+ &buffsize,
+ &getdrive ) ) {
+ ret_val = FAILURE ;
+ }
+ break;
+
+ default:
+ ret_val = FAILURE ;
+ }
+ }
+ setmedia.BlockSize = getdrive.DefaultBlockSize ;
+
+ } else {
+ setmedia.BlockSize = (ULONG) misc ;
+ }
+
+ if( ret_val == SUCCESS ) {
+ if( strstr( DILNT_SpecialDriveName, TEXT( "archive" ) ) != NULL &&
+ strstr( DILNT_SpecialDriveName, TEXT( "ancda" ) ) != NULL ) {
+
+ /* This is a kludge for the stupid Anaconda drive
+ because you can't set the block size unless
+ you're at BOT.
+ */
+
+ if( SetTapePosition( DILNT_deviceHandle,
+ TAPE_REWIND,
+ 0,
+ 0,
+ 0,
+ FALSE ) != NO_ERROR ) {
+ ret_val = FAILURE ;
+ }
+ }
+
+ if( ret_val == SUCCESS ) {
+ /* Change the block size */
+ if( SetTapeParameters( DILNT_deviceHandle,
+ SET_TAPE_MEDIA_INFORMATION,
+ &setmedia ) ) {
+
+ if( misc == DEFAULT_BLOCK_SIZE ) {
+
+ /* this is a kludge for a stupid 1/4 in
+ drive that won't except its default
+ blk size */
+
+ setmedia.BlockSize = 0x200 ;
+
+ if( SetTapeParameters( DILNT_deviceHandle,
+ SET_TAPE_MEDIA_INFORMATION,
+ &setmedia ) ) {
+
+ ret_val = FAILURE ;
+ }
+ }
+ }
+ }
+ }
+ break ;
+
+
+ default:
+ ret_val = FAILURE ;
+ break ;
+ }
+
+ EnterCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ DILNT_SpecialReturn = (BOOLEAN)ret_val ;
+ DILNT_SpecialDone = TRUE ;
+ LeaveCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ }
+}
+
+
+
+/*------------------------------------------------------------------------
+
+ NOTES on implemetation of a circular queue
+
+ Below routines pertains to a singular linked circular queue.
+ The previous data structures have been used unmodified.
+
+ To enqueue an element, move the tail pointer one position clockwise
+ and write the element in that position.
+
+ To dequeue an element, move the head pointer one position clockwise.
+
+ An empty queue is detected by the head equalling the tail. The queue
+ is full if the tail->next is equalled to the head.
+
+ The queue does not ever get filled. There is always one unused node
+ in the circular queue. Thus if you want N number of nodes to hold
+ elements, you should have N+1 number of linked list nodes.
+
+------------------------------------------------------------------------*/
+
+/**
+
+ Name: IsCQueueEmpty
+
+ Description: Test to see if the circular queue is empty
+
+ Returns:
+ FAILURE - if queue is empty
+ SUCCESS - if queue is not empty
+
+**/
+
+BOOLEAN IsCQueueEmpty( Q_HEADER_PTR queue )
+{
+ if ( queue->q_tail == queue->q_head ) {
+ return( FAILURE );
+ }
+
+ return( SUCCESS );
+
+}
+
+/**
+
+ Name: IsCOutQueueEmpty
+
+ Description: Test to see if the circular out queue is empty
+
+ Returns:
+ FAILURE - if queue is empty
+ SUCCESS - if queue is not empty
+
+**/
+
+BOOLEAN IsCOutQueueEmpty( Q_HEADER_PTR outqueue,
+ Q_HEADER_PTR CQueue
+)
+{
+
+ if ( outqueue->q_head == CQueue->q_head ) {
+ return( FAILURE );
+ }
+
+ return( SUCCESS );
+
+}
+
+
+/**
+
+ Name: IsCQueueFull
+
+ Description: Test to see if the circular queue is full
+
+ Returns:
+ FAILURE - if queue is full
+ SUCCESS - if queue is not not full
+
+**/
+
+BOOLEAN IsCQueueFull( Q_HEADER_PTR queue,
+ Q_HEADER_PTR outqueue
+)
+{
+
+ Q_ELEM_PTR element;
+ Q_ELEM_PTR outelement;
+
+ outelement = (Q_ELEM_PTR) outqueue->q_head;
+ element = (Q_ELEM_PTR) queue->q_tail->q_next;
+
+ if ( element == outelement ) {
+ return( FAILURE );
+ }
+
+ return( SUCCESS );
+
+}
+
+/**
+
+ Name: CEnqueue
+
+ Description: Place an element to the circular queue.
+
+ Advance the rear pointer one position and add the
+ element.
+
+ Returns:
+ SUCCESS - if queue is empty
+ FAILURE - if queue is not empty
+
+**/
+BOOLEAN CEnqueue( Q_HEADER_PTR queue,
+ Q_HEADER_PTR outqueue,
+ FAKE_TCB tmpTCB
+)
+{
+
+ BOOLEAN retcode;
+ Q_ELEM_PTR element;
+ FAKE_TCB_PTR loadTCB;
+
+ retcode = IsCQueueFull( queue, outqueue );
+ if ( retcode ) { // queue is full
+ return( FAILURE );
+ }
+
+ element = (Q_ELEM_PTR) queue->q_tail;
+ element = element->q_next;
+
+ loadTCB = (FAKE_TCB_PTR)element;
+ queue->q_tail = (Q_ELEM_PTR)element;
+
+ memcpy( &(loadTCB->dil_request), &(tmpTCB.dil_request), sizeof(MSL_REQUEST) );
+ memcpy( &(loadTCB->ret_stuff), &( tmpTCB.ret_stuff ), sizeof( RET_BUF ) );
+ queue->q_count++; // number of elements in the queue
+
+ return( SUCCESS ); // queue was not full
+}
+
+/**
+
+ Name: CDequeue
+
+ Description: remove an element from the circular queue.
+ Advance the front pointer one position
+ element.
+
+ Returns:
+ SUCCESS - Queue dequeued successful
+ FAILURE - Queue dequeued failed
+
+**/
+
+BOOLEAN CDequeue( Q_HEADER_PTR queue,
+ FAKE_TCB_PTR tmpTCB
+)
+{
+
+ BOOLEAN retcode;
+ FAKE_TCB_PTR loadTCB;
+ Q_ELEM_PTR element;
+
+ retcode = IsCQueueEmpty( queue );
+ if ( retcode ) { // queue is empty
+ return( FAILURE );
+ }
+
+ element = (Q_ELEM_PTR) queue->q_head;
+ element = element->q_next;
+
+ queue->q_head = ( Q_ELEM_PTR ) element;
+ loadTCB = (FAKE_TCB_PTR)queue->q_head;
+ memcpy( tmpTCB, loadTCB, sizeof( FAKE_TCB ) );
+
+ return( SUCCESS ); // queue was not empty
+}
+
+/**
+
+ Name: COutDequeue
+
+ Description: remove an element from the circular out queue.
+ Advance the front pointer one position.
+
+ Returns: SUCCESS - Queue dequeued successful
+ FAILURE - Queue dequeued failed
+
+**/
+
+BOOLEAN COutDequeue( Q_HEADER_PTR outqueue,
+ Q_HEADER_PTR CQueue
+)
+{
+
+ BOOLEAN retcode;
+ Q_ELEM_PTR element;
+
+ retcode = IsCOutQueueEmpty( outqueue, CQueue );
+ if ( retcode ) { // queue is empty
+ return( FAILURE );
+ }
+
+ element = (Q_ELEM_PTR) outqueue->q_head;
+ element = element->q_next;
+
+ outqueue->q_head = ( Q_ELEM_PTR ) element;
+ CQueue->q_count--;
+
+ return( SUCCESS ); // queue was not empty
+}
+
+
+/**
+
+ Name: CreateCQueue
+
+ Description: Create a circular queue. The number of elements in
+ a circular is always one more than needed. Because
+ one element is always left unused.
+
+ Returns:
+
+**/
+
+BOOLEAN CreateCQueue( Q_HEADER_PTR queue,
+ Q_HEADER_PTR outqueue // out queue
+)
+{
+ INT16 i ;
+ Q_ELEM_PTR elementptr;
+
+ if ( NUM_TCBS <= 0 ) {
+ queue->q_head = queue->q_tail = NULL;
+ return( FAILURE );
+ }
+
+ // initialize the contents to NULLs
+ for( i = 0 ; i < NUM_TCBS + 1; i++ ) {
+ memset( &tcbs[i], 0, sizeof( FAKE_TCB ) );
+ }
+
+ queue->q_count = 0;
+
+ // set up the single linked circular queue
+ for( i = 0 ; i < NUM_TCBS ; i++ ) {
+ elementptr = ( Q_ELEM_PTR )( &tcbs[i] );
+ elementptr->q_element = i; // number the elements in the queue
+ // used for debugging aid
+ elementptr->q_next = ( Q_ELEM_PTR )( &tcbs[i + 1] );
+ }
+
+ elementptr = ( Q_ELEM_PTR )( &tcbs[NUM_TCBS] );
+ elementptr->q_element = NUM_TCBS;
+ elementptr->q_next = ( Q_ELEM_PTR )( &tcbs[0] );
+
+ // start with an empty circular queue
+ // let the head equal the tail
+ queue->q_head = queue->q_tail = elementptr;
+
+ // Start with an empty out queue for the TpReceive calls
+ // let the out queue equal the head
+ outqueue->q_head = elementptr;
+
+ return( SUCCESS );
+}
+
+VOID InitializeTapeBlockSize( )
+{
+ static DWORD TapeBlockSize = 0 ;
+ if ( TapeBlockSize == 0 ) {
+ // read the block size from the registry
+ HKEY key ;
+
+ if ( !RegOpenKeyEx( HKEY_CURRENT_USER,
+ TEXT("Software\\Microsoft\\Ntbackup\\Backup Engine"),
+ 0,
+ KEY_QUERY_VALUE,
+ &key ) ) {
+
+ DWORD type ;
+ CHAR buffer[20] ;
+ DWORD num_bytes = sizeof(buffer) ;
+ if ( RegQueryValueEx( key, TEXT("Tape Block Size"),
+ NULL, &type,
+ (char *)buffer,
+ &num_bytes ) ) {
+ TapeBlockSize = 1 ;
+ } else {
+ TapeBlockSize = atoi(buffer) ;
+ }
+ RegCloseKey( key ) ;
+ }
+
+ }
+
+ if ( TapeBlockSize < 512 ) {
+ TAPE_GET_DRIVE_PARAMETERS drivebuff;
+ DWORD buffsize ;
+
+ buffsize = sizeof( TAPE_GET_DRIVE_PARAMETERS );
+
+ if (!GetTapeParameters( DILNT_deviceHandle,
+ GET_TAPE_DRIVE_INFORMATION,
+ &buffsize,
+ &drivebuff ) ) {
+
+ TapeBlockSize = drivebuff.DefaultBlockSize;
+ }
+ }
+
+
+ if ( TapeBlockSize >= 512 ) {
+ TAPE_SET_MEDIA_PARAMETERS mediabuff;
+
+ mediabuff.BlockSize = TapeBlockSize ;
+
+ SetTapeParameters( DILNT_deviceHandle,
+ SET_TAPE_MEDIA_INFORMATION,
+ &mediabuff );
+ }
+}
+
diff --git a/private/utils/ntbackup/src/dilnttp.c b/private/utils/ntbackup/src/dilnttp.c
new file mode 100644
index 000000000..600919d24
--- /dev/null
+++ b/private/utils/ntbackup/src/dilnttp.c
@@ -0,0 +1,1621 @@
+/**
+Copyright(c) Conner Software Products Group 1993
+
+ Name: dilnttp.c
+
+ Description: Contains all the Tp... device independent layer functions.
+
+ $Log: T:/LOGFILES/DILNTTP.C_V $
+
+ Rev 1.1.1.10 16 Mar 1994 19:27:06 GREGG
+Added support for two more DEC DLT drives: tz86 and tz87.
+
+ Rev 1.1.1.9 01 Mar 1994 15:24:20 GREGG
+Store last error on failed TpSpecial calls.
+
+ Rev 1.1.1.8 07 Feb 1994 01:24:10 GREGG
+Only get drive id string once at init (EPR 139).
+
+ Rev 1.1.1.7 01 Feb 1994 15:12:08 GREGG
+Put TEXT macros debug print format strings.
+
+ Rev 1.1.1.6 28 Jan 1994 18:25:20 GREGG
+Fixed MIPS 16 byte alignment requirement bug.
+
+ Rev 1.1.1.5 07 Jan 1994 15:34:02 GREGG
+Treat DEC's DLT2000 and DLT2700 the same as the THZ02.
+
+ Rev 1.1.1.4 05 Jan 1994 20:42:22 GREGG
+Handle some TpSpecial requests as no-ops instead of errors.
+
+ Rev 1.1.1.3 17 Dec 1993 16:40:04 GREGG
+Extended error reporting.
+
+ Rev 1.1.1.2 08 Dec 1993 20:30:38 GREGG
+Merged in all the fixes Orcas needed from past it's branch.
+
+ Rev 1.1.1.1 29 Nov 1993 12:35:12 GREGG
+Don't de-init the special thread if it wasn't inited.
+
+ Rev 1.1.1.0 21 Nov 1993 23:27:18 GREGG
+Make TpSpecial call run on their own thread.
+
+ Rev 1.1 17 May 1993 18:17:24 GREGG
+Added function TpSpace, which is a super set of TpReadEndSet, and will
+eventually replace it, but for now, they map to the same gen func code
+(defined as both GEN_ERR_ENDSET and GEN_SPACE), have identical arguments,
+and have the same value for equivalent defined values for their parameters.
+Also changed the case in ProcessRequest to handle both functions.
+
+ Rev 1.0 17 May 1993 17:16:24 GREGG
+DILNTTP.C, DILNTMSC.C and DILNTPRV.H replace DIL_NT.C at rev. 1.44.
+
+**/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "windows.h"
+#include "winioctl.h"
+#include "ntddscsi.h"
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "dilhwd.h"
+#include "mslreq.h"
+#include "retbuf.h"
+#include "genfuncs.h"
+#include "generr.h"
+#include "drvinf.h"
+#include "special.h"
+#include "genstat.h"
+#include "dddefs.h"
+#include "ld_dvr.h"
+#include "debug.h"
+#include "muiconf.h"
+#include "msassert.h"
+#include "be_debug.h"
+#include "dilntprv.h"
+
+#ifndef MS_RELEASE
+#define DEBUG_DIL 1
+#endif
+
+extern INT DILNT_ProcessErrorFlag ; // Flag to notify Tp calls that an error
+ // was encountered. Flag is set in
+ // the ProcessRequest proc and reset
+ // int the TpReceive proc.
+
+extern LARGE_INTEGER gb_drv_features ;
+extern INT TapeDevice ;
+extern HANDLE DILNT_deviceHandle ;
+extern HANDLE DILNT_CQueueSemaphore ; // Semaphore to control the
+ // circular queue
+extern HANDLE DILNT_OKToProcessSemaphore ; // global semaphore to release
+ // the thread for processing
+extern HANDLE DILNT_QThread_0 ; // global thread handle for
+ // the queue manager
+
+extern Q_HEADER DILNT_CQueue ; // Circular queue (in and process)
+extern Q_HEADER DILNT_OutCQueue ; // Pointer into the circular queue
+ // this is used by the TpReceive
+ // proc to pop the element off.
+
+extern INT DILNT_FOREVER ;
+
+
+// Externed Globals and Init Prototype for TpSpecial Thread
+
+extern INT16 DILNT_SpecialCode ;
+extern UINT32 DILNT_SpecialMisc ;
+extern BOOLEAN DILNT_SpecialDone ;
+extern BOOLEAN DILNT_SpecialEnd ;
+extern BOOLEAN DILNT_SpecialReturn ;
+extern HANDLE DILNT_SpecialThread ;
+extern CHAR DILNT_SpecialDriveName[] ;
+extern CRITICAL_SECTION DILNT_SpecialCriticalSection ;
+
+HANDLE InitSpecialThread( VOID ) ;
+
+// For storing drive registry string
+extern CHAR DILNT_DriveName[] ;
+
+// For SS_GET_LAST_ERROR
+
+static RET_BUF last_error_info ;
+static BOOLEAN last_error_valid ;
+
+
+/**/
+/**
+
+ Name: TpInit
+
+ Description: Initializes the driver
+
+ Returns: SUCCESS if the driver was initialized successfully, or
+ FAILURE if it wasn't.
+
+ Notes: THIS MUST BE CALLED BEFORE ANYTHING ELSE.
+
+**/
+
+BOOLEAN TpInit( DIL_HWD_PTR tapedevs,
+ INT16 no_cntls
+)
+{
+ CHAR buffer[50] ;
+ BOOLEAN retcode ;
+
+ // initialize flag to no error
+ DILNT_ProcessErrorFlag = 0;
+ last_error_valid = FALSE ;
+
+ sprintf( buffer, TEXT("\\\\.\\Tape%d"), TapeDevice );
+
+ DILNT_deviceHandle = CreateFile( buffer,
+ GENERIC_READ|GENERIC_WRITE,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL ) ;
+
+ // Check to see if there is a tape drive present
+ // If not, then fail the TpInit() call
+ if ( DILNT_deviceHandle != INVALID_HANDLE_VALUE ) {
+ retcode = CloseHandle( DILNT_deviceHandle ) ;
+
+ strcpy( tapedevs->driver_label, TEXT("SCSI Tape 1.0") ) ;
+ tapedevs->no_attached_drives = 1 ;
+ tapedevs->init_error = 0 ;
+
+ // Create the TpSpecial Thread
+ if( DILNT_SpecialThread == NULL ) {
+ if( ( DILNT_SpecialThread = InitSpecialThread( ) ) == NULL ) {
+ return( FAILURE ) ;
+ }
+ }
+
+ // Create the semaphore for managing the queue
+ DILNT_CQueueSemaphore = CreateSemaphore( NULL, 1L, 1L, NULL );
+ if ( !DILNT_CQueueSemaphore ) {
+ return( FAILURE );
+ }
+
+ // Create semaphore to be used as a counter of the number of
+ // requests in the queue to be processed. This is used by the
+ // thread to determine if there is anything in the queue to
+ // process. Counter is incremented whenever any requests have been
+ // queued successfully.
+ DILNT_OKToProcessSemaphore = CreateSemaphore( NULL, 0L, (LONG) NUM_TCBS , NULL );
+ if ( !DILNT_OKToProcessSemaphore ) {
+ CloseHandle( DILNT_CQueueSemaphore );
+ return( FAILURE );
+ }
+
+ // Create and initialize the queue elements into a single linked
+ // circular queue.
+ retcode = CreateCQueue( &DILNT_CQueue, &DILNT_OutCQueue ); // Create the Circular queue
+ if ( retcode ) {
+ CloseHandle( DILNT_CQueueSemaphore );
+ CloseHandle( DILNT_OKToProcessSemaphore );
+ return( FAILURE );
+ }
+
+
+ // Create the thread to process request
+ if ( DILNT_QThread_0 == NULL ) {
+ DILNT_QThread_0 = CreateAThread( ) ;
+ }
+
+ if ( !DILNT_QThread_0 ) {
+ CloseHandle( DILNT_CQueueSemaphore );
+ CloseHandle( DILNT_OKToProcessSemaphore );
+ return( FAILURE );
+ }
+
+ } else {
+ tapedevs->no_attached_drives = 0 ;
+ tapedevs->init_error = DD_INIT_ERR_NO_DRIVES;
+ }
+
+#ifdef DEBUG_DIL
+ zprintf( DEBUG_TEMPORARY, TEXT("TpInit(): Drives found = %d\n"),
+ tapedevs->no_attached_drives ) ;
+#endif
+
+ return( SUCCESS );
+}
+
+/**/
+/**
+
+ Name: TpAuto
+
+ Description: Determines hardware information
+
+ Returns: SUCCESS if function complete
+ FAILURE if it wasn't.
+
+ Notes:
+
+**/
+
+BOOLEAN TpAuto( DIL_HWD_PTR tapedevs,
+ INT16 no_cntls
+)
+{
+ return( SUCCESS ) ;
+}
+
+/**/
+/**
+
+ Name: TpRelease
+
+ Description: Release the driver and frees its memory.
+
+ Returns: Nothing
+
+ Notes: MAKE SURE THERE ARE NO PENDING REQUESTS BEFORE RELEASING,
+ AS TpRelease() DOES NO CHECKING.
+
+**/
+
+VOID TpRelease( )
+{
+
+ DWORD retstatus;
+
+ // Tell the TpSpecial thread to kill itself.
+ if( DILNT_SpecialThread != NULL ) {
+ EnterCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ DILNT_SpecialEnd = TRUE ;
+ LeaveCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ do {
+ ThreadSwitch( ) ;
+ if( !GetExitCodeThread( DILNT_SpecialThread, &retstatus ) ) break ;
+ Sleep( 5 ) ;
+ } while ( retstatus == STILL_ACTIVE ) ;
+
+ DILNT_SpecialThread = NULL ;
+ }
+
+ DILNT_FOREVER = FOREVER_STOP;
+
+ do {
+ ThreadSwitch( ) ;
+ if ( !GetExitCodeThread( DILNT_QThread_0, &retstatus ) ) break;
+ Sleep( 5 ) ;
+ } while ( retstatus == STILL_ACTIVE );
+
+ //
+ // Kill the thread, semaphores and close the tape device
+ //
+
+// retcode = CloseHandle( DILNT_QThread_0 );
+// generalerror = GetLastError( );
+
+ CloseHandle( DILNT_CQueueSemaphore );
+
+ CloseHandle( DILNT_OKToProcessSemaphore );
+
+ CloseHandle( DILNT_deviceHandle ) ;
+
+ if ( retstatus == FOREVER_STOP ) {
+ DILNT_QThread_0 = NULL;
+ }
+
+ DILNT_FOREVER = FOREVER_FOREVER;
+
+ return;
+}
+
+/**/
+/**
+
+ Name: TpReset
+
+ Description: Resets the specified drive, aborting all requests on
+ the queue, and physically resetting the drive.
+
+ Returns: SUCCESS if function complete
+ FAILURE if it wasn't.
+
+ Notes:
+
+**/
+
+BOOLEAN TpReset( INT16 tape_hdl
+)
+{
+ if ( DILNT_ProcessErrorFlag ) {
+ return( FAILURE );
+ }
+
+ return( SUCCESS ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpOpen
+
+ Description: Opens the drive specified by the hardware controller, and
+ the drive number.
+
+ Returns: An INT16. 0 if the drive was not opened, a positive value
+ if it was successfully opened.
+
+ Notes:
+
+**/
+
+INT16 TpOpen( DIL_HWD_PTR hwd,
+ INT16 drvno
+)
+{
+ INT16 status ;
+ CHAR buffer[50] ;
+ CHAR_PTR tstr ;
+
+ sprintf( buffer, TEXT("\\\\.\\Tape%d"), TapeDevice );
+
+ DILNT_deviceHandle = CreateFile( buffer,
+ GENERIC_READ|GENERIC_WRITE,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL ) ;
+
+ if ( DILNT_deviceHandle == INVALID_HANDLE_VALUE ) {
+ status = FALSE ;
+ } else {
+ status = TRUE ;
+
+ /* This is a kludge for the DLT drive. The drive won't write a
+ directory track on the tape until an unload is done, so we do
+ an unload before we exit the app. As a result, we need to
+ attempt to reload the tape when we start the app. The call is
+ made to return immediately (last param TRUE) rather than
+ waiting for the rewind to complete, so there won't be any
+ noticeable delay in the app startup, but TpStatus will report
+ that there isn't a tape in the drive until the load completes
+ (about 1-2 minutes). We don't check this call for an error,
+ because we just inited the drive a few milliseconds ago so
+ the only possible error is a load failure because the tape
+ is already loaded or there is no tape (either way we don't
+ care).
+ */
+ tstr = (CHAR_PTR)CDS_GetTapeDriveName( CDS_GetPerm( ) ) ;
+ if( tstr != NULL ) {
+ strncpy( DILNT_DriveName, tstr, 80 ) ;
+ DILNT_DriveName[80] = TEXT( '\0' ) ;
+ strlwr( DILNT_DriveName ) ;
+ strcpy( DILNT_SpecialDriveName, DILNT_DriveName ) ;
+ if( strstr( DILNT_DriveName, TEXT( "cipher" ) ) != NULL ||
+ ( strstr( DILNT_DriveName, TEXT( "dec" ) ) != NULL &&
+ ( strstr( DILNT_DriveName, TEXT( "thz02" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "tz86" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "tz87" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "dlt2700" ) ) != NULL ||
+ strstr( DILNT_DriveName, TEXT( "dlt2000" ) ) != NULL ) ) ) {
+
+ PrepareTape( DILNT_deviceHandle, TAPE_LOAD, TRUE ) ;
+ }
+ } else {
+ DILNT_DriveName[0] = TEXT( '\0' ) ;
+ DILNT_SpecialDriveName[0] = TEXT( '\0' ) ;
+ }
+ }
+
+#ifdef DEBUG_DIL
+ zprintf( DEBUG_TEMPORARY, TEXT("TpOpen(): %s\n"), ( status ) ? TEXT("Success") : TEXT("Failed") ) ;
+#endif
+
+ return( status ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpClose
+
+ Description: Close the specifed handle.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes:
+
+**/
+
+
+BOOLEAN TpClose( INT16 tape_hdl )
+{
+
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_NRCLOSE ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_NRCLOSE ;
+ }
+
+ return( retcode ) ;
+}
+
+
+/**/
+/**
+
+ Name: TpCloseRewind
+
+ Description: Closes the specified handle, and rewinds the tape in
+ the drive.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpCloseRewind( INT16 tape_hdl )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_RCLOSE ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_RCLOSE ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpWrite
+
+ Description: Writes the specified number of bytes from the specified
+ buffer to the specified drive.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes: The requested number of bytes MUST ALWAYS BE A MULTIPLE
+ of the BLOCK SIZE OF the device.
+
+**/
+
+BOOLEAN TpWrite( INT16 tape_hdl,
+ UINT8_PTR baddr,
+ UINT32 length
+)
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_WRITE ;
+ tmpTCB.dil_request.baddr = baddr ;
+ tmpTCB.dil_request.length = length ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_WRITE ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpRead
+
+ Description: Reads the specified number of bytes from the tape.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes: The requested number of bytes MUST ALWAYS BE A MULTIPLE
+ of the BLOCK SIZE OF the device.
+
+**/
+
+BOOLEAN TpRead( INT16 tape_hdl,
+ UINT8_PTR baddr,
+ UINT32 length
+)
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_READ ;
+ tmpTCB.dil_request.baddr = baddr ;
+ tmpTCB.dil_request.length = length ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_READ ;
+ }
+
+ return( retcode ) ;
+}
+
+/**/
+/**
+
+ Name: TpRewind
+
+ Description: Rewinds the Tape in the specified drive.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpRewind( INT16 tape_hdl,
+ BOOLEAN immediate
+)
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_REWIND ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = ( UINT32 ) immediate ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_REWIND ;
+ }
+
+ return( retcode ) ;
+}
+
+/**/
+/**
+
+ Name: TpRetension
+
+ Description: Retensions a tape in the specified tape drive.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpRetension( INT16 tape_hdl )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_RETEN ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_RETEN ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpErase
+
+ Description: Erase the tape in the specified drive.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpErase( INT16 tape_hdl, INT16 type )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_ERASE ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = type ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_ERASE ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpWriteEndSet
+
+ Description: Writes a filemark to the specified tape.
+
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpWriteEndSet( INT16 tape_hdl )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_WRITE_ENDSET ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_WRITE_ENDSET ;
+ }
+
+ return( retcode ) ;
+}
+
+/**/
+/**
+
+ Name: TpReadEndSet
+
+ Description: This function spaces to the specified number of filemarks,
+ in the specified direction. If it cannot space the full number
+ of filemarks, the misc field in the return buffer will contain
+ the number of filemarks it didn't space.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes: IT IS THE CALLER'S RESPONSIBLITY TO MAKE SURE THE REQUESTED
+ DRIVE SUPPORTS BACKWARD SPACING.
+
+**/
+
+BOOLEAN TpReadEndSet( INT16 tape_hdl, // The drive handle
+ INT16 fmks, // The number of filemarks to space
+ INT16 dir // the direction to space
+)
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_READ_ENDSET ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0L ;
+ tmpTCB.dil_request.parm1 = ( UINT32 ) dir ;
+ tmpTCB.dil_request.misc = fmks ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_READ_ENDSET ;
+ }
+
+ return( retcode ) ;
+}
+
+/**/
+/**
+
+ Name: TpSpace
+
+ Description: This function spaces the specified number of filemarks or
+ blocks in the specified direction, or to End Of Data,
+ depending on the 'space_type' parameter. In the case of
+ spacing filemarks, if it cannot space the full number
+ of filemarks, the misc field in the return buffer will
+ contain the number of filemarks it didn't space.
+
+ Returns: A SUCCESS if the request was enqueue'd and a FAILURE if
+ it was not.
+
+ Notes: It is the caller's responsiblity to make sure the drive
+ supports the type of spacing requested.
+
+ This function is a super set of TpReadEndSet! The
+ function code is defined to the same value, and it will
+ eventually replace TpReadEndSet completely.
+
+**/
+
+BOOLEAN TpSpace( INT16 tape_hdl, // The drive handle
+ INT16 count, // The number to space
+ INT16 space_type // What to space past, and which direction
+)
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_SPACE ; // Same as GEN_READ_ENDSET
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0L ;
+ tmpTCB.dil_request.parm1 = (UINT32)space_type ;
+ tmpTCB.dil_request.misc = count ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_SPACE ;
+ }
+
+ return( retcode ) ;
+}
+
+/**/
+/**
+
+ Name: TpReceive
+
+ Description: Gets the return information for the drive.
+
+ Returns: A SUCCESS if the return buffer is valid and filled, and
+ FAILURE if there was nothing on the return buffer.
+
+ Notes:
+
+**/
+BOOLEAN TpReceive( INT16 tape_hdl,
+ RET_BUF_PTR retpck
+)
+{
+ BOOLEAN retcode;
+ FAKE_TCB_PTR tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+ retcode = COutDequeue( &DILNT_OutCQueue, &DILNT_CQueue );
+
+ if ( retcode ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+
+ ThreadSwitch();
+ Sleep( 5 ) ;
+
+ return( retcode );
+ }
+
+ tmpTCB = (FAKE_TCB_PTR) DILNT_OutCQueue.q_head;
+ *retpck = tmpTCB->ret_stuff;
+
+ if ( tmpTCB->ret_stuff.gen_error ) {
+ last_error_valid = TRUE ;
+ last_error_info = tmpTCB->ret_stuff ;
+ DILNT_CQueue.q_count = 0; // reset queue counter to 0
+ DILNT_ProcessErrorFlag = 0; // reset error flag to 0
+ BE_Zprintf( 0, TEXT("TpRecieve Exception: gen_error = %d call_type = %d len_req = %d\n"),
+ retpck->gen_error, retpck->call_type, retpck->len_req ) ;
+ BE_Zprintf( 0, TEXT(" len_got = %d status = 0x%04X\n"),
+ retpck->len_got, retpck->status ) ;
+ }
+
+ memset( &tmpTCB->dil_request, 0, sizeof( MSL_REQUEST ) );
+ memset( &tmpTCB->ret_stuff, 0, sizeof( RET_BUF ) );
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpSpecial
+
+ Description: This function is the back door ( War Games ? ) to the
+ device driver.
+
+ Returns: Various Things for Various Calls.
+
+ Notes:
+
+**/
+
+BOOLEAN TpSpecial( INT16 tape_hdl,
+ INT16 sp_serv,
+ UINT32 misc
+)
+{
+ BOOLEAN done = FALSE ;
+ BOOLEAN ret_val = SUCCESS ;
+
+ /* Take care of some quick stuff we don't want to ask the
+ TpSpecial thread to do.
+ */
+ switch( sp_serv ) {
+
+ case SS_ERROR_RESTORE :
+ case SS_FLUSH_BUFFER :
+ case SS_KILL_DEVICE :
+ case SS_KILL_ERROR_Q :
+ case SS_KILL_IN_Q :
+ case SS_SET_STEP :
+ case SS_CLR_STEP :
+ case SS_POP_ERROR_Q :
+ case SS_LOAD_UNLOAD :
+ case SS_DUMP_DVR_DATA :
+ case SS_FIND_BLOCK :
+ case SS_SHOW_BLOCK :
+ case SS_PHYS_BLOCK :
+ case SS_FORCE_MACHINE_TYPE :
+ /* We don't currently get any of these. This is just here
+ to keep the app sane if someone decides to send one down.
+ */
+ msassert( FALSE ) ;
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_SPECIAL ;
+ last_error_info.gen_error = 0 ; // Field not valid for TpSpecial
+ last_error_info.misc = sp_serv ;
+ ret_val = FAILURE ;
+ break ;
+
+ case SS_GET_LAST_ERROR :
+ if( !last_error_valid ) {
+ ret_val = FAILURE ;
+ } else {
+ last_error_valid = FALSE ;
+ *((RET_BUF_PTR)misc) = last_error_info ;
+ ret_val = SUCCESS ;
+ }
+ break ;
+
+ case SS_NO_MAY_ID :
+ case SS_NO_1ST_REQ :
+ case SS_LAST_STATUS :
+ /* These are no-ops under NT */
+ ret_val = SUCCESS ;
+ break ;
+
+ case SS_IS_ERROR :
+ ret_val = FALSE ;
+ break ;
+
+ case SS_IS_INQ_EMPTY :
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+ ret_val = DILNT_CQueue.q_count ;
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL ) ;
+ ret_val = ret_val ;
+ break ;
+
+ case SS_GET_DRV_INF :
+ case SS_CHANGE_BLOCK_SIZE :
+ case SS_SET_DRV_COMPRESSION :
+
+ // These go to the thread.
+
+ // Make sure we have our thread.
+
+ if( DILNT_SpecialThread == NULL ) {
+ BE_Zprintf( 0, TEXT("TpSpecial: DILNT_SpecialThread == NULL\n") ) ;
+ msassert( DILNT_SpecialThread != NULL ) ;
+ ret_val = FAILURE ;
+ } else {
+
+ /* If the threads in the middle of processing a command
+ alreay, this is a BAD thing. Otherwise set the global
+ to tell him what to do.
+ */
+ EnterCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ if( DILNT_SpecialDone == FALSE ) {
+ BE_Zprintf( 0, TEXT("TpSpecial called while active!!!\n") ) ;
+ msassert( DILNT_SpecialThread != NULL ) ;
+ ret_val = FAILURE ;
+ } else {
+ DILNT_SpecialCode = sp_serv ;
+ DILNT_SpecialMisc = misc ;
+ DILNT_SpecialDone = FALSE ;
+ }
+ LeaveCriticalSection( &DILNT_SpecialCriticalSection ) ;
+
+ // Wait for the TpSpecial to finish.
+
+ if( ret_val == SUCCESS ) {
+ while( !done ) {
+ EnterCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ if( done = DILNT_SpecialDone ) {
+ ret_val = DILNT_SpecialReturn ;
+ }
+ LeaveCriticalSection( &DILNT_SpecialCriticalSection ) ;
+ ThreadSwitch( ) ;
+ Sleep( 5 ) ;
+ }
+ }
+ }
+
+ if( ret_val == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_SPECIAL ;
+ last_error_info.gen_error = 0 ; // Field not valid for TpSpecial
+ last_error_info.misc = sp_serv ;
+ }
+
+ break ;
+
+ default:
+ msassert( FALSE ) ;
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_SPECIAL ;
+ last_error_info.gen_error = 0 ; // Field not valid for TpSpecial
+ last_error_info.misc = sp_serv ;
+ ret_val = FAILURE ;
+ break ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: TpStatus
+
+ Description: Gets the current status of drive and returns it via a
+ return buffer.
+
+ Returns: A SUCCESS if the request was enqueue'd, and a FAILURE
+ if the request was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpStatus( INT16 hdl )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_STATUS ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_STATUS ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpSeek
+
+ Description: Seeks to the specified block on Tape. The first block
+ on any tape device is 1. Only the first 24 bits are
+ significant of the "block" parameter.
+
+ Returns: A SUCCESS if the request was enqueue'd, and a FAILURE
+ if the request was not.
+
+ Notes: IT IS THE PROGRAMMER'S RESPONSIBILITY TO DETERMINE
+ WHETHER OR NOT THE DRIVE SUPPORTS BLOCK POSITIONING.
+ USE THE drive information call TO FIND OUT.
+
+ DON'T CALL THIS IF THE DRIVE DOESN'T SUPPORT IT.
+
+ PHYSICAL boolean in parameter list means to go to the
+ physical block position on tape. This should only be set
+ TRUE to seek to a true physical location. For example, in
+ the QicStream 1.92 tape format, the header at the end of the
+ tape set contains the actual block position of the volume
+ table. A physical block seek must be performed to assure
+ correct positioning on all drives.
+
+**/
+
+BOOLEAN TpSeek( INT16 hdl, // The drive handle
+ UINT32 block, // The desired position
+ BOOLEAN physical // Seek to a physical tape position
+)
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_SEEK ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = block ;
+ tmpTCB.dil_request.misc = (INT16) physical ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_SEEK ;
+ }
+
+ return( retcode ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: TpGetPosition
+
+ Description: Gets the current block position on tape. The block numbering
+ starts at 1. The block position is returned in the misc field
+ of the return buffer.
+
+ Returns: A SUCCESS if the request was enqueue'd, and a FAILURE
+ if the request was not.
+
+ Notes: IT IS THE PROGRAMMER'S RESPONSIBILITY TO DETERMINE
+ WHETHER OR NOT THE DRIVE SUPPORTS BLOCK POSITIONING.
+ USE THE drive information call TO FIND OUT.
+
+ PHYSICAL boolean in parameter list means to return the
+ physical block position on tape. This should only be set
+ TRUE to get the true physical location.
+
+**/
+
+BOOLEAN TpGetPosition(
+ INT16 hdl,
+ BOOLEAN physical ) // Seek to a physical tape position
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_GETPOS ;
+ tmpTCB.dil_request.baddr = NULL ;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = 0L ;
+ tmpTCB.dil_request.misc = (INT16) physical ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_GETPOS ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpMount
+
+ Description: Performs a mount of the tape media, testing to be sure
+ that the tape drive is ready for media access .
+
+ Returns: A SUCCESS if the request was enqueue'd, and a FAILURE
+ if the request was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpMount( INT16 tape_handle )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_MOUNT ;
+ tmpTCB.dil_request.baddr = NULL;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = (UINT32) 0 ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_MOUNT ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpDismount
+
+ Description: Performs a dismount of the tape media.
+
+ Returns: A SUCCESS if the request was enqueue'd, and a FAILURE
+ if the request was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpDismount( INT16 tape_handle )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_DISMOUNT ;
+ tmpTCB.dil_request.baddr = NULL;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = (UINT32) 0 ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_DISMOUNT ;
+ }
+
+ return( retcode ) ;
+
+}
+
+/**/
+/**
+
+ Name: TpEject
+
+ Description: Performs an eject of the tape media.
+
+ Returns: A SUCCESS if the request was enqueue'd, and a FAILURE
+ if the request was not.
+
+ Notes:
+
+**/
+
+BOOLEAN TpEject( INT16 unused )
+{
+ BOOLEAN retcode;
+ FAKE_TCB tmpTCB;
+
+ while ( WaitForSingleObject( DILNT_CQueueSemaphore, NOWAIT ) ) {
+ ThreadSwitch( ) ;
+ }
+
+ if ( DILNT_ProcessErrorFlag ) {
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ retcode = FAILURE ;
+ } else {
+
+ // set up function to perform
+ tmpTCB.dil_request.gen_func_code = GEN_EJECT ;
+ tmpTCB.dil_request.baddr = NULL;
+ tmpTCB.dil_request.length = 0 ;
+ tmpTCB.dil_request.parm1 = (UINT32) 0 ;
+ tmpTCB.dil_request.misc = 0 ;
+
+ retcode = CEnqueue( &DILNT_CQueue, &DILNT_OutCQueue, tmpTCB );
+ if ( retcode == SUCCESS ) {
+ ReleaseSemaphore( DILNT_OKToProcessSemaphore, 1L, NULL );
+ }
+
+ ReleaseSemaphore( DILNT_CQueueSemaphore, 1L, NULL );
+ }
+
+ if( retcode == FAILURE ) {
+ last_error_valid = TRUE ;
+ last_error_info.call_type = GEN_EJECT ;
+ }
+
+ return( retcode );
+}
+
+/**/
+/**
+
+ Name: TpGetTapeBuffAlignment
+
+ Description: NT only. Makes an IOCTL call to get the byte alignment
+ requirements (if any) of data transfer buffers.
+
+ Returns: SUCCESS or FAILURE
+
+ Notes:
+
+**/
+
+BOOLEAN TpGetTapeBuffAlignment( INT_PTR alignment )
+{
+ IO_SCSI_CAPABILITIES scsi_stuff ;
+ INT bytes_out ;
+ BOOLEAN retcode = FAILURE ;
+
+ *alignment = 0 ;
+
+ if ( DILNT_deviceHandle != INVALID_HANDLE_VALUE ) {
+ if( DeviceIoControl( DILNT_deviceHandle,
+ IOCTL_SCSI_GET_CAPABILITIES,
+ NULL,
+ 0,
+ &scsi_stuff,
+ sizeof( scsi_stuff ),
+ &bytes_out,
+ NULL ) ) {
+
+ retcode = SUCCESS ;
+ if( scsi_stuff.AlignmentMask ) {
+ *alignment = scsi_stuff.AlignmentMask + 1 ;
+ }
+ }
+ }
+
+ return( retcode ) ;
+}
+
+/**/
+/**
+
+ Name: TpLock
+
+ Description: OS/2 only code for "locking" the DMA data buffer for all
+ data transfers with the installed device driver.
+
+ Returns: SUCCESS or FAILURE
+
+ Notes:
+
+**/
+
+BOOLEAN TpLock( INT8_PTR unused1,
+ INT32_PTR unused2
+)
+{
+ return( SUCCESS );
+}
+
+/**/
+/**
+
+ Name: TpUnlock
+
+ Description: OS/2 specific code for unlocking a locked data buffer
+
+ Returns: SUCCESS or FAILURE
+
+ Notes:
+
+**/
+
+BOOLEAN TpUnlock( INT32_PTR unused )
+{
+ return( SUCCESS );
+}
+
+
+/**/
+VOID SetActiveMSL( DRIVERHANDLE unused )
+{
+ return ;
+}
+
+
+/**/
+UINT8_PTR DriverLoad( CHAR_PTR library_name, DRIVERHANDLE *driver_handle, VOID_PTR unused_ptr, UINT16 unused_int )
+{
+
+ return (UINT8_PTR)1 ;
+
+}
+
+
+/**/
+VOID DriverUnLoad( UINT8_PTR unused_ptr )
+{
+
+ return ;
+}
+
diff --git a/private/utils/ntbackup/src/disks.ico b/private/utils/ntbackup/src/disks.ico
new file mode 100644
index 000000000..fde70ef8e
--- /dev/null
+++ b/private/utils/ntbackup/src/disks.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/dledelet.c b/private/utils/ntbackup/src/dledelet.c
new file mode 100644
index 000000000..e6fd923ae
--- /dev/null
+++ b/private/utils/ntbackup/src/dledelet.c
@@ -0,0 +1,84 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dledelete.c
+
+ Description: This file contains code used to delete specified DLEs
+ from the DLE list. The children of the DLEs will be
+ also be released as well, including those that are
+ pointed by BSD's and are attached. All OS specific data
+ for DLEs is also released.
+
+
+ $Log: Q:/LOGFILES/DLEDELET.C_V $
+
+ Rev 1.7 18 Jun 1993 09:35:34 MIKEP
+enable C++
+
+ Rev 1.6 18 Aug 1992 10:14:18 STEVEN
+fix warnings
+
+ Rev 1.5 13 Jan 1992 18:45:34 STEVEN
+changes for WIN32 compile
+
+ Rev 1.4 20 Dec 1991 10:42:02 STEVEN
+redesign function for common functions into tables
+
+ Rev 1.3 01 Oct 1991 11:14:52 BARRY
+Include standard headers.
+
+ Rev 1.2 14 Jun 1991 17:13:26 STEVEN
+DLE_DeleteList() is no longer supported
+
+ Rev 1.1 30 May 1991 08:46:32 STEVEN
+changes to support new BSDU
+
+ Rev 1.0 09 May 1991 13:40:10 HUNTER
+Initial revision.
+
+**/
+#include <stdlib.h>
+
+#include "stdtypes.h"
+
+#include "fsys.h"
+#include "fsys_err.h"
+#include "dle.h"
+#include "dle_str.h"
+#include "fsys_prv.h"
+
+INT16 DLE_Remove(
+DLE_HAND hand , /* I - Handle to DLE list */
+GENERIC_DLE_PTR dle ) /* I - pointer to dle to remove */
+{
+ (VOID)hand ;
+
+ DLE_RemoveRecurse( dle, FALSE ) ;
+
+ return SUCCESS ;
+}
+
+
+VOID DLE_RemoveRecurse(
+GENERIC_DLE_PTR dle, /* I - dle to remove */
+BOOLEAN ignore_use ) /* I - TRUE if we should ignore use counts */
+{
+ GENERIC_DLE_PTR child_dle ;
+
+ if ( ignore_use || (!dle->attach_count && !dle->bsd_use_count) ) {
+
+ DLE_GetFirstChild( dle, &child_dle ) ;
+
+ while ( child_dle != NULL ) {
+
+ DLE_RemoveRecurse( child_dle, ignore_use ) ;
+ DLE_GetFirstChild( dle, &child_dle ) ;
+ }
+
+ func_tab[dle->type].RemoveDrive( dle ) ;
+
+ } /* if */
+
+}
+
diff --git a/private/utils/ntbackup/src/dleget.c b/private/utils/ntbackup/src/dleget.c
new file mode 100644
index 000000000..63208e209
--- /dev/null
+++ b/private/utils/ntbackup/src/dleget.c
@@ -0,0 +1,499 @@
+/**/
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dleget.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file defines functions used to scan the Drive List.
+ Functions are provide to get the first element, then all the next
+ elements. Also functions are provided to get the first child
+ element under a specified element. And a function is provided
+ to return the number of children.
+
+
+
+ $Log: Q:/LOGFILES/DLEGET.C_V $
+
+ Rev 1.14 18 Jun 1993 09:41:42 MIKEP
+enable C++
+
+ Rev 1.13 09 Jun 1993 13:28:20 ChuckS
+Changed RecurseSearchName to match a GRFS dle if the supplied name to match
+doesn't have the flag characters. A slightly more generic solution, but
+not used because of the overhead, would be to call DLE_DeviceDispName and
+do a strcmp against that.
+
+ Rev 1.12 04 Jun 1993 17:35:02 ChuckS
+P_CLIENT & OS_DOS only: added functional form of DLE_GetDefaultDrive which
+returns the first non-remote GRFS dle as the default drive (if one exists),
+or the first dle in the list if otherwise.
+
+ Rev 1.11 26 Apr 1993 20:00:02 DON
+needed SMS_OBJECT in addition to SMS_SERVICE for getting user names/passwords
+
+ Rev 1.10 13 Apr 1993 17:07:20 JOHNES
+Put switch statements into DLE_ServerPswd and DLE_ServerUserName so that
+these would properly handle GRFS DLE types.
+
+Threw in a few msasserts to make sure we were'nt working with DLE types
+we don't support or a NULL pointer.
+
+ Rev 1.9 16 Dec 1992 11:52:40 DON
+Changed file system specific Server/Volume macros into functions - dle.h
+
+ Rev 1.8 11 Nov 1992 22:27:10 GREGG
+Unicodeized literals.
+
+ Rev 1.7 18 Aug 1992 10:16:20 STEVEN
+fix warnings
+
+ Rev 1.6 13 Jan 1992 18:46:50 STEVEN
+changes for WIN32 compile
+
+ Rev 1.5 11 Dec 1991 14:32:48 BARRY
+SMS devices have access date support.
+
+ Rev 1.4 06 Aug 1991 18:27:52 DON
+added NLM File System support
+
+ Rev 1.3 24 Jul 1991 09:41:44 DAVIDH
+Corrected warnings under Watcom compiler.
+
+ Rev 1.2 22 Jul 1991 08:33:24 BARRY
+Change strcmpi to stricmp.
+
+ Rev 1.1 03 Jun 1991 13:26:28 BARRY
+Remove product defines from conditional compilation.
+
+ Rev 1.0 09 May 1991 13:40:10 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "part.h"
+/* $end$ include list */
+
+/* File System specific functions which were macros in dle.h */
+
+INT16 DLE_ServerLoggedIn( GENERIC_DLE_PTR server_dle )
+{
+#if defined(FS_NLMSERVER)
+ return( server_dle->info.nlm_server->login_status );
+#elif defined( FS_SMS ) || defined( FS_GRFS )
+
+ msassert( server_dle != NULL ) ;
+
+ return( 0 );
+ (void)server_dle;
+#else
+ return( server_dle->info.server->login_status );
+#endif
+}
+
+CHAR_PTR DLE_GetServerPswd( GENERIC_DLE_PTR server_dle )
+{
+#if defined(FS_NLMSERVER)
+ return( server_dle->info.nlm_server->pswd );
+#elif defined( FS_SMS ) || defined( FS_GRFS )
+ CHAR_PTR ret_ptr=NULL ;
+
+ msassert( server_dle != NULL ) ;
+
+ /* send back a pointer to the field appropriate for this DLE type */
+ switch( DLE_GetDeviceType( server_dle ) ) {
+ case GRFS_SERVER:
+ ret_ptr = server_dle->info.grfs->password ;
+ break ;
+ case SMS_SERVICE:
+ case SMS_OBJECT:
+ ret_ptr = server_dle->info.sms_ts->password ;
+ break ;
+ default:
+ /* We're not set up for this type of DLE, yet */
+ msassert( FALSE ) ;
+ break ;
+ } /* end switch */
+
+ return( ret_ptr ) ;
+#else
+ return( server_dle->info.server->pswd );
+#endif
+}
+
+CHAR_PTR DLE_GetServerUserName( GENERIC_DLE_PTR server_dle )
+{
+#if defined(FS_NLMSERVER)
+ return( server_dle->info.nlm_server->user_name );
+#elif defined( FS_SMS ) || defined( FS_GRFS )
+ CHAR_PTR ret_ptr=NULL ;
+
+ msassert( server_dle != NULL ) ;
+
+ /* send back a pointer to the field appropriate for this DLE type */
+ switch( DLE_GetDeviceType( server_dle ) ) {
+ case GRFS_SERVER:
+ ret_ptr = server_dle->info.grfs->user_name ;
+ break ;
+ case SMS_SERVICE:
+ case SMS_OBJECT:
+ ret_ptr = server_dle->info.sms_ts->user_name ;
+ break ;
+ default:
+ /* We're not set up for this type of DLE, yet */
+ msassert( FALSE ) ;
+ break ;
+ } /* end switch */
+
+ return( ret_ptr ) ;
+#else
+ return( server_dle->info.server->user_name );
+#endif
+}
+
+UINT8 DLE_GetServerNum( GENERIC_DLE_PTR server_dle )
+{
+#if defined(FS_NLMSERVER)
+ return( server_dle->info.nlm_server->server_num );
+#elif defined( FS_SMS ) || defined( FS_GRFS )
+
+ msassert( server_dle != NULL ) ;
+
+ return( 0 );
+ (void)server_dle;
+#else
+ return( server_dle->info.server->server_num );
+#endif
+}
+
+static VOID RecurseSearchName ( GENERIC_DLE_PTR, GENERIC_DLE_PTR *, CHAR_PTR, INT16 ) ;
+
+/**/
+/**
+
+ Name: DLE_GetFirst()
+
+ Description: This function modifies the dle pointer passed in to
+ point to the first DLE in the list pointed to by the DLE handle.
+
+
+ Modified: 7-12-1989
+
+ Returns: Error codes:
+ BAD_DLE_HAND
+ NO_MORE_DLE
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( DLE_GetNext() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DLE_GetFirst(
+DLE_HAND hand,
+GENERIC_DLE_PTR *dle )
+{
+ *dle = (GENERIC_DLE_PTR) QueueHead( &(hand->q_hdr) ) ;
+
+ if ( *dle !=NULL ) {
+ return SUCCESS ;
+ } else {
+ return FS_NO_MORE_DLE ;
+ }
+}
+/**/
+/**
+
+ Name: DLE_GetNext()
+
+ Description: This function get the next DLE in the list. It must be
+ passed a pointer to a valid DLE. On exit the pointer is modified
+ to point to the next DLE in the list.
+
+ Modified: 7/12/1989
+
+ Returns: Error code:
+ NO_MORE_DLE
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( DLE_GetFirst(), DLE_GetFirstChild() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DLE_GetNext( GENERIC_DLE_PTR *dle )
+{
+ *dle = (GENERIC_DLE_PTR)QueueNext( &((*dle)->q) ) ;
+
+ if ( *dle != NULL ) {
+ return SUCCESS ;
+
+ } else {
+ return FS_NO_MORE_DLE ;
+
+ }
+}
+/**/
+/**
+
+ Name: DLE_GetPrev()
+
+ Description: This function get the previous DLE in the list. It
+ must be passed a pointer to a valid DLE. On exit the pointer
+ is modified to point to the next DLE in the list.
+
+ Modified: 7/12/1989
+
+ Returns: Error code:
+ NO_MORE_DLE
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( DLE_GetFirst(), DLE_GetFirstChild() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DLE_GetPrev( GENERIC_DLE_PTR *dle )
+{
+ GENERIC_DLE_PTR temp ;
+
+ temp = (GENERIC_DLE_PTR)QueuePrev( &((*dle)->q) ) ;
+
+ if ( temp != NULL ) {
+ *dle = temp ;
+
+ return SUCCESS ;
+
+ } else {
+
+ return FS_NO_MORE_DLE ;
+
+ }
+}
+/**/
+/**
+
+ Name: DLE_GetFirstChild()
+
+ Description: This function returns the first sub DLE under a
+ specified DLE. For example, Novell servers have children DLEs,
+ which are the volumes. These DLEs are created when an attachment
+ is made to the DLE. This function can be used to get a list of
+ volumes for the purpose of drive select.
+
+ Modified: 7/12/1989
+
+ Returns: An error code:
+ NO_MORE_DLE
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( DLE_GetFirst(), DLE_GetNext() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DLE_GetFirstChild(
+GENERIC_DLE_PTR parent_dle ,
+GENERIC_DLE_PTR *child_dle )
+{
+ *child_dle = (GENERIC_DLE_PTR)QueueHead( &(parent_dle->child_q) ) ;
+
+ if ( *child_dle == NULL ) {
+ return FS_NO_MORE_DLE ;
+ } else {
+ return SUCCESS ;
+ }
+}
+/**/
+/**
+
+ Name: DLE_FindByName()
+
+ Description: This function scans through the DLE tree looking for the
+ DLE with the spcified device name. If the specified device name is
+ NULL then this function will return the DLE for the default drive.
+
+ Modified: 7/14/1989
+
+ Returns: NOT_FOUND
+ SUCCESS
+
+ Notes: If no dle can be found then NULL is returned as the
+ DLE pointer.
+
+ A wild card for the type is -1.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DLE_FindByName(
+DLE_HAND hand, /* I - DLE list handle */
+CHAR_PTR name, /* I - name to search for */
+INT16 type, /* I - type of dle to search for */
+GENERIC_DLE_PTR *dle ) /* O - pointer to matched DLE */
+{
+ GENERIC_DLE_PTR temp_dle ;
+ GENERIC_DLE_PTR found_dle ;
+
+ if ( dle != NULL ) {
+ *dle = NULL ;
+ }
+
+ if ( (name == NULL) && (dle != NULL) ) {
+ *dle = hand->default_drv ;
+ } else {
+
+ temp_dle = (GENERIC_DLE_PTR)QueueHead( &(hand->q_hdr) ) ;
+
+ found_dle = NULL ;
+
+ RecurseSearchName( temp_dle, &found_dle, name, type ) ;
+
+ if ( (found_dle != NULL) && (dle != NULL) ) {
+ *dle = found_dle ;
+ }
+
+ if ( found_dle == NULL ) {
+ return FS_NOT_FOUND ;
+ }
+ }
+ return SUCCESS ;
+}
+
+#define TMP_XCH_DLE( dle ) ( ((dle)->type == FS_EMS_DRV)&&\
+ (((dle)->subtype==EMS_MDB)||((dle)->subtype==EMS_DSA))&&\
+ (((dle)->parent == NULL) || ((dle)->parent->parent == NULL)) )
+
+static VOID RecurseSearchName (
+GENERIC_DLE_PTR dle_tree,
+GENERIC_DLE_PTR *dle,
+CHAR_PTR name,
+INT16 type )
+{
+ while ( (dle_tree != NULL) &&
+ ((*dle == NULL) || TMP_XCH_DLE( *dle ) ) ) {
+
+ if ( QueueCount( &(dle_tree->child_q) ) != 0 ) {
+ RecurseSearchName ( (GENERIC_DLE_PTR)QueueHead( &(dle_tree->child_q) ) ,
+ dle, name, type ) ;
+ }
+
+ if ( ( *dle == NULL ) || TMP_XCH_DLE( *dle ) ) {
+
+ if ( !stricmp( name, dle_tree->device_name ) ) {
+ if ( ( type == ANY_DRIVE_TYPE ) || ( (UINT16)type == dle_tree->type ) ) {
+ *dle = dle_tree ;
+ }
+
+#if defined( FS_GRFS )
+ } else if ( ( type == ANY_DRIVE_TYPE || (UINT16)type == dle_tree->type )
+ && dle_tree->type == GRFS_SERVER && !stricmp( name, dle_tree->device_name + 4 * sizeof( CHAR ) ) ) {
+ *dle = dle_tree ;
+ }
+#else
+ } // matches first if ( !stricmp... ) if FS_GRFS not defined
+#endif
+ }
+ dle_tree = (GENERIC_DLE_PTR)QueueNext( &(dle_tree->q) ) ;
+ }
+}
+
+
+
+#if defined( FS_IMAGE )
+/**/
+/**
+
+ Name: DLE_SetPartName()
+
+ Description: This function sets the partition name in the specified
+ DLE.
+
+ Modified: 7/14/1989
+
+ Returns: NONE
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID DLE_SetPartName(
+DLE_HAND dle_hand , /* I - pointer to DLE list */
+UINT16 drive_num , /* I - drive number */
+UINT16 part_num , /* I - partition number */
+CHAR_PTR name ) /* I - New name */
+{
+ GENERIC_DLE_PTR dle ;
+
+ dle = (GENERIC_DLE_PTR) QueueHead( &(dle_hand->q_hdr) ) ;
+
+ while( dle != NULL ) {
+
+ if ( dle->type == LOCAL_IMAGE ) {
+
+ if ( ( (dle->info.image->drive_num & 0x7f) == (INT8)drive_num ) &&
+ ( dle->info.image->partition == (INT8)part_num ) ) {
+
+ strncpy( dle->device_name, name, PART_NAME_SIZE - 1 ) ;
+ dle->device_name[ PART_NAME_SIZE - 1 ] = TEXT('\0') ;
+ strupr( dle->device_name ) ;
+ break ;
+ }
+
+ }
+
+ dle = (GENERIC_DLE_PTR)QueueNext( &(dle->q) ) ;
+ }
+
+}
+#endif
+
+
+
+#if defined( P_CLIENT ) && defined( OS_DOS )
+
+GENERIC_DLE_PTR DLE_GetDefaultDrive( DLE_HAND dle_hand )
+{
+ GENERIC_DLE_PTR dle ;
+
+ dle = (GENERIC_DLE_PTR) QueueHead( &(dle_hand->q_hdr) ) ;
+
+ while ( dle != NULL ) {
+ if ( dle->type == GRFS_SERVER && !DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+ return dle ;
+ }
+
+ dle = (GENERIC_DLE_PTR)QueueNext( &(dle->q) ) ;
+ }
+ return (GENERIC_DLE_PTR) QueueHead( &(dle_hand->q_hdr ) ) ;
+}
+
+#endif
diff --git a/private/utils/ntbackup/src/dlereset.c b/private/utils/ntbackup/src/dlereset.c
new file mode 100644
index 000000000..5714c7638
--- /dev/null
+++ b/private/utils/ntbackup/src/dlereset.c
@@ -0,0 +1,153 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dlereset.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code used to reset the DLE list to
+ it's minimum state. The children of all DLEs which are not pointed
+ to by BSD's and are not attaced are released. All OS specific data
+ for DLEs which are not pointed to by BSD's or attached is released.
+
+
+ $Log: Q:/LOGFILES/DLERESET.C_V $
+
+ Rev 1.2 18 Jun 1993 09:44:08 MIKEP
+enable C++
+
+ Rev 1.1 01 Oct 1991 11:15:02 BARRY
+Include standard headers.
+
+ Rev 1.0 09 May 1991 13:39:02 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdlib.h>
+
+#include "stdtypes.h"
+
+#include "fsys.h"
+#include "fsys_err.h"
+/* $end$ include list */
+
+static INT16 RemoveChildren( GENERIC_DLE_PTR dle );
+
+/**/
+/**
+
+ Name: DLE_ResetList()
+
+ Description: This function scans through the DLE list. For every
+ DLE which is not pointed to by any BSD's, this function will
+ remove the children and OS specific information contained in
+ the DLE. This function can be used after a TMENU selections
+ or after TMENU operations to release any unused memory.
+
+
+ Modified: 7/14/1989
+
+ Returns: Error codes as follows:
+ BAD_DLE_HAND
+ DRIVE_LIST_ERROR
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( RemoveChildren(), DLE_GetFirst(), DLE_GetNext() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DLE_ResetList( DLE_HAND hand )
+{
+ GENERIC_DLE_PTR dle ;
+
+ if ( DLE_GetFirst( hand, &dle ) ) {
+ return ( FS_BAD_DLE_HAND ) ;
+ }
+
+ while ( dle != NULL ) {
+
+ if ( QueueCount( &(dle->child_q) ) > 0 ) {
+ RemoveChildren( dle );
+ }
+
+ if ( dle->dynamic_info &&
+ (dle->bsd_use_count == 0) &&
+ (dle->attach_count == 0 ) &&
+ (QueueCount ( &(dle->child_q) ) == 0 ) ) {
+
+ free( dle->info.dos ) ;
+ }
+
+ if ( DLE_GetNext( &dle ) != SUCCESS ) {
+ return FS_DRIVE_LIST_ERROR ;
+ }
+
+ }
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: RemoveChildren()
+
+ Description: This function releases all children DLSs which do not
+ have a BSD which points to them.
+
+ Modified: 7/17/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 RemoveChildren( GENERIC_DLE_PTR dle )
+{
+ GENERIC_DLE_PTR child_dle, old_dle ;
+ INT16 err_code ;
+
+ DLE_GetFirstChild ( dle, &child_dle ) ;
+
+ while ( child_dle != NULL ) {
+
+ if ( (dle->attach_count == 0) &&
+ (child_dle->bsd_use_count == 0) ) {
+
+ if ( QueueCount( &(child_dle->child_q) ) > 0 ) {
+ RemoveChildren( child_dle ) ;
+ }
+ if ( child_dle->dynamic_info &&
+ (QueueCount( &(child_dle->child_q) ) == 0 ) ) {
+
+ free( child_dle->info.dos ) ;
+
+ old_dle = child_dle ;
+
+ err_code = DLE_GetNext( &child_dle ) ;
+
+ free( old_dle ) ;
+
+ } else {
+
+ err_code = DLE_GetNext( &child_dle ) ;
+ }
+ }
+
+ if ( (err_code != SUCCESS) && (err_code != FS_NO_MORE) ) {
+ return FS_DRIVE_LIST_ERROR ;
+ }
+ }
+
+ return SUCCESS ;
+}
+
diff --git a/private/utils/ntbackup/src/dleupdat.c b/private/utils/ntbackup/src/dleupdat.c
new file mode 100644
index 000000000..269a7f1c3
--- /dev/null
+++ b/private/utils/ntbackup/src/dleupdat.c
@@ -0,0 +1,180 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dleupdat.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains functions to update the list of
+ DLEs. Some DLEs may be dynamic in nature. For example
+ file servers and remote workstations may come and go as
+ these machines are turned on and off. These functions
+ should update the drive list to reflect the current state
+ of accessible drives.
+
+
+ $Log: M:/LOGFILES/DLEUPDAT.C_V $
+
+ Rev 1.18 04 Jan 1994 14:30:14 BARRY
+Now call fs init entry points from FS_InitFileSys, not DLE_UpdateList
+
+ Rev 1.17 03 Aug 1993 13:34:14 DOUG
+Don't flush child DLEs unless all sibling DLEs will be flushed.
+
+ Rev 1.16 18 Jun 1993 09:46:24 MIKEP
+enable C++
+
+ Rev 1.15 11 May 1993 08:19:50 BRYAN
+Fixed signed/unsigned and type mismatch warnings.
+
+ Rev 1.14 08 May 1993 14:27:58 DOUG
+Added GEN_FlushDLEs()
+
+ Rev 1.13 13 Jan 1992 18:45:24 STEVEN
+changes for WIN32 compile
+
+ Rev 1.12 07 Jan 1992 11:58:52 STEVEN
+move common routines to tables
+
+ Rev 1.11 11 Dec 1991 17:55:14 JOHNB
+Remove DLE's for Novell servers that are no longer on the NET
+
+
+ Rev 1.10 11 Dec 1991 14:37:32 BARRY
+Need to update SMS TSAs.
+
+ Rev 1.9 01 Oct 1991 11:15:12 BARRY
+Include standard headers.
+
+ Rev 1.8 06 Aug 1991 18:28:34 DON
+added NLM File System support
+
+ Rev 1.7 24 Jul 1991 09:53:20 DAVIDH
+Corrected warnings under Watcom compiler.
+
+ Rev 1.6 25 Jun 1991 09:34:44 BARRY
+Changes for new config.
+
+ Rev 1.5 18 Jun 1991 13:00:34 STEVEN
+should be defined not define
+
+ Rev 1.4 04 Jun 1991 19:39:36 BARRY
+No longer call SMB_Init() for MBS. InitializeRemote() will be
+changed to work properly for both MaynStream and LanStream.
+
+ Rev 1.3 04 Jun 1991 12:25:24 BARRY
+Forgot to remove dle_selector parameter.
+
+ Rev 1.2 30 May 1991 13:52:18 BARRY
+No longer delete DLEs in update; it will be up to the UI to pick and choose.
+
+ Rev 1.1 23 May 1991 16:40:12 BARRY
+Changed FSYSs to be conditional on FS_XXX defines instead of product defines.
+
+ Rev 1.0 09 May 1991 13:37:14 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdlib.h>
+#include "stdtypes.h"
+#include "queues.h"
+#include "fsys.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "dle.h"
+#include "fsys_prv.h"
+#include "gen_fs.h"
+/* $end$ include list */
+
+
+INT16 DLE_UpdateList(
+DLE_HAND hand, /* I - Drive list to modify */
+BE_CFG_PTR cfg ) /* I - config to use to modify drive list */
+{
+ INT16 i ;
+ INT16 ret_val ;
+ UINT32 file_sys_mask ;
+
+ file_sys_mask = hand->file_sys_mask ;
+
+/*
+ Find all drives ;
+*/
+
+ for( i = 0; i < MAX_DRV_TYPES; i++ ) {
+ if ( func_tab[i].FindDrives != NULL ) {
+ ret_val = func_tab[i].FindDrives( hand, cfg, file_sys_mask ) ;
+
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+ }
+ }
+
+
+ return ret_val ;
+}
+
+
+void GEN_FlushDLEs( DLE_HAND dle_hand, UINT8 flush_dle_type )
+{
+ GENERIC_DLE_PTR dle;
+ GENERIC_DLE_PTR next_dle;
+ GENERIC_DLE_PTR child_dle;
+ GENERIC_DLE_PTR next_child;
+ BOOLEAN ChildrenStay;
+
+ dle = (GENERIC_DLE_PTR) QueueHead( &dle_hand->q_hdr );
+
+ while ( dle != NULL )
+ {
+ next_dle = (GENERIC_DLE_PTR) QueueNext( &dle->q );
+
+ if ( dle->type == flush_dle_type )
+ {
+ ChildrenStay = FALSE;
+
+ if ( DLE_GetNumChild( dle ) != 0 )
+ {
+ DLE_GetFirstChild( dle, &child_dle );
+ while ( child_dle != NULL )
+ {
+ if ( ( child_dle->bsd_use_count != 0 ) ||
+ ( child_dle->attach_count != 0 ) )
+ {
+ ChildrenStay = TRUE;
+ }
+ child_dle = (GENERIC_DLE_PTR) QueueNext( &child_dle->q );
+ }
+
+ if ( ChildrenStay == FALSE )
+ {
+ DLE_GetFirstChild( dle, &child_dle );
+ while ( child_dle != NULL )
+ {
+ next_child = (GENERIC_DLE_PTR) QueueNext( &child_dle->q );
+
+ RemoveQueueElem( &dle->child_q, &child_dle->q );
+ free( child_dle );
+
+ child_dle = next_child;
+ }
+ }
+ }
+
+ if ( ( ChildrenStay == FALSE ) &&
+ ( dle->bsd_use_count == 0 ) &&
+ ( dle->attach_count == 0 ) )
+ {
+ RemoveQueueElem( &dle_hand->q_hdr, &dle->q );
+ free( dle );
+ }
+ }
+
+ dle = next_dle;
+ }
+
+ return;
+}
diff --git a/private/utils/ntbackup/src/dlg_util.c b/private/utils/ntbackup/src/dlg_util.c
new file mode 100644
index 000000000..9ea5a2796
--- /dev/null
+++ b/private/utils/ntbackup/src/dlg_util.c
@@ -0,0 +1,295 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: dlg_util.c
+
+ Description: contains functions that the dialog procs use,
+ but these are not dialog procs
+
+ this file includes
+
+ DM_ParseShortDate()
+ DM_CountLetters()
+ DM_ParseTime()
+ $Log: G:/UI/LOGFILES/DLG_UTIL.C_V $
+
+ Rev 1.7 14 Jun 1993 21:01:32 MIKEP
+enable c++
+
+ Rev 1.6 01 Nov 1992 15:45:42 DAVEV
+Unicode changes
+
+ Rev 1.5 07 Oct 1992 13:43:22 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.4 04 Oct 1992 19:32:48 DAVEV
+Unicode Awk pass
+
+ Rev 1.3 28 Jul 1992 14:41:12 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.2 29 May 1992 15:58:34 JOHNWT
+PCH updates
+
+ Rev 1.1 09 Jan 1992 18:23:40 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.0 20 Nov 1991 19:26:48 SYSTEM
+Initial revision.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// globals that are not global yet
+
+INT16 gnOrder ;
+BOOL gfLeadMonth ;
+BOOL gfLeadDay ;
+BOOL gfLeadYear ;
+BOOL glpszFormat ;
+
+BOOL gfIs24Hour ;
+CHAR glpszAMString[6] ;
+CHAR glpszPMString[9] ;
+BOOL gfLeadTime ;
+CHAR gcSeparator ;
+
+
+/***************************************************
+
+ Name: DM_ParseShortDate
+
+ Description: Parses the short date key field in win.ini
+ determines the date format, separator character,
+ whether or not the month and day have leading 0's,
+ and whether or not the year has a leading century
+
+ Modified:
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID DM_ParseShortDate ( )
+
+{
+ CHAR lpszDateBuffer[11] ;
+ INT nTemp, nTemp2 ;
+
+ GetProfileString ( TEXT("Intl"), TEXT("sShortDate"), NULL, lpszDateBuffer, 11 ) ;
+
+ // the year field will tell us the separator,
+ // because it must have either 2 or 4 y's;
+ // there cannot be 3 or 5 y's in a valid year
+ // the year is either the first or last field in the string
+
+ if ( lpszDateBuffer[0] == TEXT('y') ) {
+
+ // this is ymd format, so the y's are first, followed by the separator
+
+ gnOrder = YMD ;
+ gfLeadYear = FALSE ;
+
+ if ( lpszDateBuffer[2] != TEXT('y') ) {
+
+ gcSeparator = lpszDateBuffer[2] ;
+
+ } else {
+
+ if ( lpszDateBuffer[3] == TEXT('y') ) { // buffer[4] is the separator;
+ // it may be a y
+ gfLeadYear = TRUE ;
+
+ } else { // the separator is a y (dirty trick)
+
+ gcSeparator = TEXT('y') ;
+ }
+ }
+
+ } else {
+
+ // the year is not the first field, so it is the last field
+ // count backward from the end to find the separator
+
+ nTemp = lstrlen ( lpszDateBuffer ) ;
+ nTemp2 = 0 ;
+ while ( lpszDateBuffer[nTemp] == TEXT('y') ) {
+
+ nTemp-- ;
+ nTemp2++ ;
+ }
+
+ if ( nTemp2 > 4 ) {
+
+ gcSeparator = lpszDateBuffer[nTemp] ;
+
+ } else {
+
+ gcSeparator = TEXT('y') ;
+ }
+ }
+
+ //
+ // after the separator has been identified, parse the d's and M's
+ //
+
+ if ( lpszDateBuffer[0] == TEXT('d') ) { // the order is DMY
+
+ gnOrder = DMY ;
+
+ // days are followed by months so count d's first
+ // count the d's
+
+ nTemp = DM_CountLetters ( lpszDateBuffer, 0 ) ;
+ gfLeadDay = ( ( nTemp == 3 ) ||
+ ( ( gcSeparator != TEXT('d') ) &&
+ ( nTemp > 1 ) ) ) ;
+
+ // followed by either 1 or 2 M's, followed by one separator,
+
+ if ( gcSeparator != TEXT('d') ) {
+
+ nTemp++ ;
+ }
+
+ gfLeadMonth = ( (INT)DM_CountLetters ( lpszDateBuffer, (INT16)nTemp ) == 2 ) ;
+
+ nTemp++ ;
+ if ( gfLeadMonth ) {
+
+ nTemp++ ;
+ }
+
+ // followed by either 2 or 4 y's
+
+ gfLeadYear = ( (INT)DM_CountLetters ( lpszDateBuffer, (INT16)nTemp ) == 4 ) ;
+
+ } else {
+
+ // see what the order is: if it isn't YMD it is MDY
+
+ if ( gnOrder != YMD ) {
+
+ gnOrder = MDY ;
+ }
+
+ // find the first M
+
+ nTemp = 2 ;
+ if ( gfLeadYear ) {
+
+ nTemp += 2 ;
+ }
+
+ nTemp = DM_CountLetters ( lpszDateBuffer, (INT16)nTemp ) ;
+ gfLeadMonth = ( ( nTemp == 3 ) ||
+ ( ( gcSeparator != TEXT('M') ) &&
+ ( nTemp > 1 ) ) ) ;
+
+ // followed by either 1 or 2 d's, followed by one separator
+
+ if ( gcSeparator != TEXT('d') ) {
+
+ nTemp++ ;
+ }
+
+ gfLeadDay = ( DM_CountLetters ( lpszDateBuffer, (INT16)nTemp ) == 2 ) ;
+
+ // if the order is MDY, count the y's
+
+ if ( gnOrder == MDY ) {
+
+ nTemp++ ;
+ if ( gfLeadDay ) {
+
+ nTemp++ ;
+ }
+ // followed by either 2 or 4 y's
+
+ gfLeadYear = ( (INT)DM_CountLetters ( lpszDateBuffer, (INT16)nTemp ) == 4 ) ;
+ }
+ }
+}
+
+/***************************************************
+
+ Name: DM_CountLetters
+
+ Description: counts the number of consecutive occurences
+ of a given letter in a given string;
+ the letter is specified by its index in the string
+
+ Modified:
+
+ Returns: INT16 the number of consecutive occurrences of the letter
+ at the given position of the given string starting
+ at the given position
+
+ Notes: index is not passed in as a pointer, so changing it here
+ does not affect the calling function's value
+
+ See also:
+
+*****************************************************/
+
+INT DM_CountLetters ( CHAR string[], INT index )
+
+{
+ INT nCount = 1 ; // the character at least matches itself
+
+ while ( string[index] == string[index+1] ) {
+
+ index++ ;
+ nCount++ ;
+ }
+
+ return ( nCount ) ;
+}
+
+
+/***************************************************
+
+ Name: DM_ParseTime
+
+ Description: Determines important international things about the
+ Windows time settings.
+
+ Modified:
+
+ Returns:
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID DM_ParseTime ( )
+
+{
+ // This guy is much easier to parse than the bloody date
+
+ CHAR lpszBuffer[2] ;
+
+ gfIs24Hour = (BOOL) GetProfileInt ( TEXT("Intl"), TEXT("iTime"), 0 ) ;
+
+ GetProfileString ( TEXT("Intl"), TEXT("s1159"), NULL, glpszAMString, 6 ) ;
+ GetProfileString ( TEXT("Intl"), TEXT("s2359"), NULL, glpszPMString, 9 ) ;
+
+ gfLeadTime = (BOOL) GetProfileInt ( TEXT("Intl"), TEXT("iTLZero"), 0 ) ;
+
+ GetProfileString ( TEXT("Intl"), TEXT("sTime"), NULL, lpszBuffer, 2 ) ;
+ gcSeparator = lpszBuffer[0] ;
+}
+
+
diff --git a/private/utils/ntbackup/src/dlm_draw.c b/private/utils/ntbackup/src/dlm_draw.c
new file mode 100644
index 000000000..8cde1912f
--- /dev/null
+++ b/private/utils/ntbackup/src/dlm_draw.c
@@ -0,0 +1,1605 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: dlm_draw.c
+
+ Description: This file contains routines for display list manager.
+
+ The following routines are in this module:
+
+
+ DLM_WMDrawItem
+ DLM_DrawLMapLText
+ DLM_DrawSMapLText
+ DLM_DrawTree
+ DLM_SetFont
+
+ $Log: G:/UI/LOGFILES/DLM_DRAW.C_V $
+
+ Rev 1.44.1.0 26 Jan 1994 15:20:22 Glenn
+Fixed text clobbering problem in file list box.
+
+ Rev 1.44 02 Aug 1993 15:09:28 GLENN
+Returning NULL pointer in DLM_GetFocusItem() if an error has occurred.
+
+ Rev 1.43 15 Jun 1993 09:59:06 MIKEP
+enable c++
+
+ Rev 1.42 14 Jun 1993 20:16:42 MIKEP
+enable c++
+
+ Rev 1.41 18 May 1993 15:20:26 GLENN
+Added check for valid display list in DLM_SetFont().
+
+ Rev 1.40 28 Apr 1993 15:36:42 GLENN
+Added DLM_GetPixelStringWidth() for column width calculations.
+
+ Rev 1.39 06 Apr 1993 17:53:12 GLENN
+Now restoring old bitmap widths and heights when there is a font change.
+
+ Rev 1.38 02 Apr 1993 15:54:26 ROBG
+Changed FocusItem to be UINT for both NT and WINDOWS.
+
+ Rev 1.37 03 Mar 1993 17:27:30 ROBG
+Fixed problem with drawing focus bars around items in a multicolumn
+list.
+
+ Rev 1.36 22 Feb 1993 13:45:40 ROBG
+Corrected the focus box by computing the horizontal extent for a flat list.
+
+ Rev 1.35 18 Jan 1993 14:24:06 GLENN
+Added DLM_DrawBorderOnItem() to draw border on all selected objects in a window without focus.
+
+ Rev 1.34 04 Jan 1993 09:26:36 MIKEP
+unicode fix LPSTR->BYTE_PTR
+
+ Rev 1.33 11 Dec 1992 18:25:36 GLENN
+Added selection frame rectangle support based on horizontal extent of a list box.
+
+ Rev 1.32 18 Nov 1992 13:19:42 GLENN
+Fixed highlight and emply list focus problems.
+
+ Rev 1.31 01 Nov 1992 15:46:02 DAVEV
+Unicode changes
+
+ Rev 1.30 14 Oct 1992 15:48:40 GLENN
+Added Selection Framing Support for List Boxes without the FOCUS.
+
+ Rev 1.29 07 Oct 1992 13:48:54 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.28 04 Oct 1992 19:32:52 DAVEV
+Unicode Awk pass
+
+ Rev 1.27 08 Sep 1992 10:12:30 ROBG
+Changed the logic in the volume window to highlight all text fields
+in the highlight color. Special logic to cut down on column width.
+
+ Rev 1.26 08 Sep 1992 09:58:00 ROBG
+Fixed problem with cyBeforeCheckBox and cyBeforeBitMap.
+
+ Rev 1.25 03 Sep 1992 15:28:34 ROBG
+Added conditional for OS_WIN32.
+
+ Rev 1.24 03 Sep 1992 13:32:28 ROBG
+Add defines to limit scope of drive description.
+
+ Rev 1.23 25 Aug 1992 09:17:46 ROBG
+Fixed the problem of setting the height of a checkbox and
+bitmaps to be the height of the column.
+
+ Rev 1.22 21 Aug 1992 16:02:10 ROBG
+Changes to support font changes.
+
+ Rev 1.21 20 Aug 1992 15:51:58 ROBG
+Added support to use Window highlight colors for selected items in the
+listboxes.
+
+ Rev 1.20 19 Aug 1992 14:33:52 ROBG
+Modified to properly handle the more compact listboxes.
+
+ Rev 1.19 07 Jul 1992 16:03:52 MIKEP
+unicode changes
+
+ Rev 1.18 12 Jun 1992 11:37:18 STEVEN
+another unaligned brother
+
+ Rev 1.17 10 Jun 1992 10:50:14 STEVEN
+added UNALIGNED for Mips build
+
+ Rev 1.16 15 May 1992 13:35:36 MIKEP
+nt pass 2
+
+ Rev 1.15 20 Mar 1992 09:07:30 ROBG
+Took out the setting of the horizontal extent when drawing flat lists.
+
+ Rev 1.14 20 Mar 1992 09:05:20 ROBG
+
+ Rev 1.13 18 Mar 1992 13:35:36 ROBG
+Made to use full rect item when multicolumn
+
+ Rev 1.12 18 Mar 1992 09:50:38 GLENN
+Fixed tree list focus problems.
+
+ Rev 1.11 17 Mar 1992 16:10:42 ROBG
+no change
+
+ Rev 1.10 10 Mar 1992 17:00:10 GLENN
+Remove tabs.
+
+ Rev 1.9 25 Jan 1992 12:43:38 MIKEP
+fix deep directories again
+
+ Rev 1.8 24 Jan 1992 16:18:00 MIKEP
+bump brothers pointer correctly
+
+ Rev 1.7 10 Jan 1992 13:58:08 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.6 09 Jan 1992 14:26:20 ROBG
+Added logic to pad length of strings 1-3 to length of 4 in flat list boxes.
+
+ Rev 1.5 26 Dec 1991 17:23:16 ROBG
+New and Improved.
+
+ Rev 1.4 06 Dec 1991 17:37:18 GLENN
+Added code to call the APP set focus when item gets the focus, and not looses it
+
+ Rev 1.3 03 Dec 1991 13:20:48 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.2 26 Nov 1991 15:21:54 ROBG
+Added validity checks for the window handle, info structure, and the
+dlm display header.
+
+ Rev 1.1 25 Nov 1991 13:44:52 ROBG
+Added check for valid window handle in DLM_DrawItem.
+
+ Rev 1.0 20 Nov 1991 19:17:50 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static UINT32 LevelMaskTbl[ 32 ] = {
+ 0x80000000, 0x40000000, 0x20000000, 0x10000000,
+ 0x08000000, 0x04000000, 0x02000000, 0x01000000,
+ 0x00800000, 0x00400000, 0x00200000, 0x00100000,
+ 0x00080000, 0x00040000, 0x00020000, 0x00010000,
+ 0x00008000, 0x00004000, 0x00002000, 0x00001000,
+ 0x00000800, 0x00000400, 0x00000200, 0x00000100,
+ 0x00000080, 0x00000040, 0x00000020, 0x00000010,
+ 0x00000008, 0x00000004, 0x00000002, 0x00000001,
+ };
+
+static VOID DLM_DrawBorderOnItem ( HWND hWnd, DLM_HEADER_PTR pHdr, LPDRAWITEMSTRUCT lpdis );
+
+
+/****************************************************************************
+
+ Name: DLM_WMDrawItem
+
+ Description: Function handles Draw_item messages from the list box
+ control.
+
+ Modified: 6/1/1991
+
+
+ Returns: Always zero.
+
+ Notes: Called by docproc.c
+
+****************************************************************************/
+
+
+
+WORD DLM_WMDrawItem (
+
+HWND hWnd , // I - Handle to Parent Window of list box.
+LPDRAWITEMSTRUCT lpdis ) // I - Pointer to information about item.
+
+
+{
+ DLM_HEADER_PTR pHdr ;
+
+ // lpdis->hwndItem must be a valid window.
+
+ if ( ! IsWindow( lpdis->hwndItem ) ) {
+ return(0);
+ }
+
+ // Parent window must exist.
+
+ if ( ! IsWindow( hWnd ) ) {
+ return(0);
+ }
+
+ pHdr = DLM_GetDispHdr( lpdis->hwndItem );
+
+ // DLM display header must be defined.
+
+ if ( ! pHdr ) {
+ return ( 0 );
+ }
+
+ switch ( DLM_GDisplay( pHdr ) ) {
+
+ case DLM_LARGEBITMAPSLTEXT :
+ return( DLM_DrawLMapLText ( hWnd, lpdis ) );
+
+ case DLM_SMALL_BITMAPS :
+ default:
+
+ if ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) {
+
+ return( DLM_DrawTree ( hWnd, lpdis ) );
+ } else {
+ return( DLM_DrawSMapLText ( hWnd, lpdis ) );
+ }
+
+ break ;
+ }
+
+}
+
+
+/****************************************************************************
+
+ Name: DLM_DrawLMapLText
+
+ Description: This function will draw Large Bitmaps with
+ large text to the right side of bitmap.
+
+ Modified: 3/25/1991
+
+ Returns: Always zero
+
+ Notes: WM_DrawItem has validated hWnd and lpdis.
+
+****************************************************************************/
+
+WORD DLM_DrawLMapLText(
+
+HWND hWnd, // I - Handle to Parent Window of list box.
+LPDRAWITEMSTRUCT lpdis ) // I - Pointer to information about item.
+
+{
+
+ short cxPos, cyPos ;
+ RECT rc ;
+ RECT rcNew ;
+ BOOL fHighLightText ;
+ BOOL fFirstTextItem = TRUE;
+ BOOL fFocusChange ;
+
+ DLM_HEADER_PTR pHdr ;
+ PDS_WMINFO pWinInfo ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+
+ LPBYTE lpObjLst;
+ LMHANDLE dhListItem ;
+ DLM_ITEM_PTR lpDispItem ;
+ BYTE bObjCnt ;
+
+ short height ;
+ LONG lLen ;
+
+ DWORD OldBkColor ;
+ DWORD OldTextColor ;
+
+ HANDLE hSaveObject ;
+
+
+ switch ( lpdis->itemAction ) {
+
+ case ODA_DRAWENTIRE:
+ case ODA_SELECT:
+
+ fFocusChange = FALSE;
+ break;
+
+ case ODA_FOCUS:
+ fFocusChange = TRUE;
+ break;
+
+ }
+
+ pHdr = DLM_GetDispHdr( lpdis->hwndItem );
+
+ if ( ! fFocusChange ) {
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWnd );
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr );
+
+ dhListItem = (LMHANDLE) lpdis->itemData ;
+
+ rc = lpdis->rcItem;
+
+ // Wipe out any old focus stuff.
+
+ FrameRect ( lpdis->hDC, &rc, ghBrushWhite );
+
+ InflateRect( (LPRECT) &rc, mwDLMInflate, mwDLMInflate );
+
+ fHighLightText = FALSE;
+
+ if ( DLM_IsFocusInWindow ( hWnd, lpdis->hwndItem ) ) {
+
+ if ( lpdis->itemState & ODS_SELECTED ) {
+
+ fHighLightText = TRUE ;
+ }
+ }
+
+ /* Ready now to display item */
+
+ lpObjLst = (LPBYTE) ( (*pfnGetObjects) (dhListItem) );
+ lpDispItem = DLM_GetFirstObject( (LPBYTE)lpObjLst, &bObjCnt ) ;
+
+ cxPos = (short)rc.left ;
+ cyPos = (short)rc.top ;
+
+ height = (short)(rc.bottom - rc.top + 1);
+
+ while ( bObjCnt ) {
+
+ switch ( DLM_ItembType ( lpDispItem ) ) {
+
+ case DLM_CHECKBOX:
+
+ cxPos += pHdr->cxBeforeCheckBox ;
+ RSM_BitmapDraw( DLM_ItemwId ( lpDispItem ), cxPos, cyPos+pHdr->cyBeforeCheckBox,
+ pHdr->cxCheckBoxWidth, pHdr->cyCheckBoxHeight, lpdis->hDC );
+ cxPos += pHdr->cxCheckBoxWidth;
+ break;
+
+ case DLM_BITMAP:
+
+ cxPos += pHdr->cxBeforeBitMap ;
+ RSM_BitmapDraw( DLM_ItemwId ( lpDispItem ), cxPos, cyPos+pHdr->cyBeforeBitMap,
+ pHdr->cxBitMapWidth, pHdr->cyBitMapHeight, lpdis->hDC );
+ cxPos += pHdr->cxBitMapWidth;
+ break;
+
+
+ case DLM_TEXT_ONLY:
+
+ cxPos += pHdr->cxBeforeText ;
+
+ rcNew.top = rc.top ;
+ rcNew.bottom= rc.bottom ;
+
+ rcNew.left = cxPos ;
+ rcNew.right = rc.right ;
+
+ // If this is the first text item, fill in the
+ // remaining region with the proper color,
+ // all the way to the end.
+
+ if ( fFirstTextItem ) {
+
+ RECT rcTemp = lpdis->rcItem;
+
+ rcTemp.left = cxPos;
+
+ if ( fHighLightText ) {
+ FillRect( lpdis->hDC, &rcTemp, ghBrushHighLight );
+ } else {
+ FillRect( lpdis->hDC, &rcTemp, ghBrushWhite );
+ }
+
+ fFirstTextItem = FALSE;
+ }
+
+ if (fHighLightText ) {
+ OldBkColor = SetBkColor ( lpdis->hDC, gColorHighLight ) ;
+ OldTextColor = SetTextColor( lpdis->hDC, gColorHighLightText ) ;
+ } else {
+ OldBkColor = SetBkColor ( lpdis->hDC, gColorBackGnd ) ;
+ OldTextColor = SetTextColor( lpdis->hDC, gColorForeGnd ) ;
+ }
+
+
+
+ hSaveObject = SelectObject( lpdis->hDC, ghFontFiles );
+
+ // Fill in background between fields.
+ // Assume text fields are next to one another.
+
+ if ( bObjCnt != 1 ) {
+ rcNew.right = rcNew.left +
+ ( DLM_ItembMaxTextLen( lpDispItem ) * pHdr->cxTextWidth );
+ rcNew.right += pHdr->cxBeforeText ;
+
+ if ( fHighLightText ) {
+ FillRect( lpdis->hDC, &rcNew, ghBrushHighLight );
+ } else {
+ FillRect( lpdis->hDC, &rcNew, ghBrushWhite );
+ }
+ }
+
+ lLen = strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) );
+
+ TextOut ( lpdis->hDC, cxPos, cyPos+pHdr->cyBeforeText,
+ (CHAR_PTR)DLM_ItemqszString( lpDispItem ), (int) lLen );
+
+ SelectObject( lpdis->hDC, hSaveObject );
+
+ cxPos += ( DLM_ItembMaxTextLen( lpDispItem ) * pHdr->cxTextWidth );
+
+ break ;
+ }
+
+ bObjCnt-- ;
+ lpDispItem++ ;
+ }
+
+ }
+// else {
+//
+// if ( lpdis->itemState & ODS_FOCUS ) {
+//
+// zprintf ( 0, "FOCUS-ON - Item: %d", lpdis->itemID );
+// }
+// else {
+// zprintf ( 0, "FOCUS-OFF - Item: %d", lpdis->itemID );
+// }
+// }
+
+
+ DLM_DrawBorderOnItem ( hWnd, pHdr, lpdis );
+
+ DLM_SetFocusItem ( lpdis, &lpdis->rcItem );
+
+ return ( 0 );
+
+}
+
+
+/****************************************************************************
+
+ Name: DLM_DrawSMapLText
+
+ Description: This function will draw small Bitmaps with
+ large text to the right side of bitmap.
+
+ Modified: 3/25/1991
+
+ Returns: none
+
+ Notes: WM_DrawItem has validated hWnd and lpdis.
+
+ The column width is calculated by the cxTextWidth *
+ maximum length of string in column.
+
+ The cxTextWidth is an approximation of the text width,
+ based on the maximum width of a character in the font and
+ the average font width.
+
+****************************************************************************/
+
+WORD DLM_DrawSMapLText(
+
+HWND hWnd, // I - Handle to Parent Window of list box.
+LPDRAWITEMSTRUCT lpdis ) // I - Pointer to information about item.
+
+{
+
+ short cxPos, cyPos ;
+ RECT rc ;
+ RECT rcAll ;
+ RECT rcNew ;
+ WORD fHighLightText ;
+ BOOL fFocusChange ;
+
+ DLM_HEADER_PTR pHdr ;
+ PDS_WMINFO pWinInfo ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+
+ LPBYTE lpObjLst;
+ LMHANDLE dhListItem ;
+ DLM_ITEM_PTR lpDispItem ;
+ BYTE bObjCnt ;
+ HANDLE hSaveObject ;
+
+ USHORT unHeight ;
+ POINT pt; //dvc - GetWindowOrgEx return value
+
+
+
+ switch ( lpdis->itemAction ) {
+
+ case ODA_DRAWENTIRE:
+ case ODA_SELECT:
+
+ fFocusChange = FALSE;
+ break;
+
+ case ODA_FOCUS:
+ fFocusChange = TRUE;
+ break;
+
+ }
+
+
+ pHdr = DLM_GetDispHdr( lpdis->hwndItem );
+
+ if ( ! fFocusChange ) {
+
+ BOOL fTextBkGndErased = FALSE;
+
+ GetWindowOrgEx( lpdis->hDC, &pt );
+ pHdr->xOrigin = (WORD)pt.x;
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWnd );
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr );
+
+ dhListItem = (LMHANDLE) lpdis->itemData ;
+
+ rc = lpdis->rcItem;
+ rcAll = lpdis->rcItem;
+
+
+ // Wipe out any old focus stuff.
+
+// FrameRect ( lpdis->hDC, &rc, ghBrushWhite );
+
+ // Blow away anything that was there.
+
+ FillRect ( lpdis->hDC, &rc, ghBrushWhite );
+
+ InflateRect( (LPRECT) &rc, mwDLMInflate, mwDLMInflate );
+
+ fHighLightText = FALSE;
+
+ if ( DLM_IsFocusInWindow ( hWnd, lpdis->hwndItem ) ) {
+
+ if ( lpdis->itemState & ODS_SELECTED ) {
+
+ fHighLightText = TRUE ;
+ }
+ }
+
+ /* Ready now to display item */
+
+ lpObjLst = (LPBYTE)( (*pfnGetObjects) (dhListItem) );
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ cxPos = (short)rc.left ;
+ cyPos = (short)rc.top ;
+
+ unHeight = (short)(rc.bottom - rc.top + 1);
+
+ while ( bObjCnt ) {
+
+ switch ( DLM_ItembType ( lpDispItem ) ) {
+
+ case DLM_CHECKBOX:
+
+ cxPos += pHdr->cxBeforeCheckBox ;
+
+ if ( DLM_ItemwId( lpDispItem ) ) {
+ RSM_BitmapDraw( DLM_ItemwId ( lpDispItem ), cxPos, cyPos+pHdr->cyBeforeCheckBox,
+ pHdr->cxCheckBoxWidth, pHdr->cyCheckBoxHeight, lpdis->hDC );
+ }
+
+ cxPos += pHdr->cxCheckBoxWidth;
+ break;
+
+ case DLM_BITMAP:
+
+ cxPos += pHdr->cxBeforeBitMap ;
+
+ RSM_BitmapDraw( DLM_ItemwId ( lpDispItem ), cxPos, cyPos+pHdr->cyBeforeBitMap,
+ pHdr->cxBitMapWidth, pHdr->cyBitMapHeight, lpdis->hDC );
+
+ cxPos += pHdr->cxBitMapWidth;
+ break;
+
+
+ case DLM_TEXT_ONLY:
+
+ rcNew = rcAll;
+
+ cxPos += pHdr->cxBeforeText ;
+
+ rcNew.left = cxPos ;
+
+ if ( ! fTextBkGndErased ) {
+
+ if ( fHighLightText ) {
+
+ FillRect( lpdis->hDC, &rcNew, ghBrushHighLight );
+ SetBkColor ( lpdis->hDC, gColorHighLight ) ;
+ SetTextColor( lpdis->hDC, gColorHighLightText ) ;
+
+ }
+ else {
+
+ FillRect( lpdis->hDC, &rcNew, ghBrushWhite );
+ SetBkColor ( lpdis->hDC, gColorBackGnd ) ;
+ SetTextColor( lpdis->hDC, gColorForeGnd ) ;
+ }
+
+ SetBkMode ( lpdis->hDC, TRANSPARENT );
+
+ fTextBkGndErased = TRUE;
+ }
+
+ // If the font is DLM_ANSI_FIXED_FONT, select ghFontLog.
+ // is DLM_SYSTEM_FONT, select ghFontIconLabels
+
+ if ( DLM_GTextFont( pHdr ) == DLM_ANSI_FIXED_FONT ) {
+
+ hSaveObject = SelectObject( lpdis->hDC, ghFontLog );
+ }
+ else {
+
+ hSaveObject = SelectObject( lpdis->hDC, ghFontIconLabels );
+ }
+
+ rcNew.top = cyPos ;
+
+ rcNew.left++;
+
+ if ( DLM_ItembTextMode( lpDispItem ) == DLM_RIGHT_JUSTIFY ) {
+
+ rcNew.right = rcNew.left + ( DLM_ItembMaxTextLen( lpDispItem ) * pHdr->cxTextWidth );
+
+// FrameRect ( lpdis->hDC, &rcNew, ghBrushBlack );
+
+ DrawText ( lpdis->hDC,
+ (CHAR_PTR)DLM_ItemqszString( lpDispItem ),
+ strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) ),
+ &rcNew,
+ DT_NOCLIP | DT_RIGHT | DT_NOPREFIX | DT_SINGLELINE );
+
+// cxPos += pHdr->cxTextWidth ;
+ rcNew.right += pHdr->cxTextWidth ;
+
+ }
+ else {
+
+ // If it is not a Multicolumn listbox,
+ // then do not use the default right.
+
+ if ( DLM_GMode( pHdr ) != DLM_MULTICOLUMN ) {
+ rcNew.right = rcNew.left + ( DLM_ItembMaxTextLen( lpDispItem ) * pHdr->cxTextWidth );
+ }
+
+// FrameRect ( lpdis->hDC, &rcNew, ghBrushBlack );
+
+ DrawText ( lpdis->hDC,
+ (CHAR_PTR)DLM_ItemqszString( lpDispItem ),
+ strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) ),
+ &rcNew,
+ DT_NOCLIP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE );
+ }
+
+ SelectObject( lpdis->hDC, hSaveObject );
+
+// cxPos += ( DLM_ItembMaxTextLen( lpDispItem ) * pHdr->cxTextWidth );
+ cxPos = (short)rcNew.right;
+
+ // Create a little more space for strings less than 5 characters long.
+
+ if ( ( (int) DLM_ItembMaxTextLen( lpDispItem ) > 0 ) &&
+ ( (int) DLM_ItembMaxTextLen( lpDispItem ) < 5 ) ) {
+
+ cxPos += pHdr->cxTextWidth ;
+ }
+
+ // Need to set the horizontal extent.
+
+ if ( cxPos > (short) pHdr->wHorizontalExtent ) {
+
+ pHdr->wHorizontalExtent = cxPos ;
+ SendMessage ( lpdis->hwndItem, LB_SETHORIZONTALEXTENT,
+ cxPos + 4*mwcxDLMIconLabelsWidth , 0L );
+ }
+
+ }
+
+ bObjCnt-- ;
+ lpDispItem++ ;
+
+ } /* end while */
+
+ } /* end if */
+
+ DLM_DrawBorderOnItem ( hWnd, pHdr, lpdis );
+
+ DLM_SetFocusItem ( lpdis, &lpdis->rcItem );
+
+ return ( 0 );
+}
+
+
+/****************************************************************************
+
+ Name: DLM_DrawTree
+
+ Description: This function will draw small Bitmaps with
+ large text to the right side of bitmap in a
+ tree fashion.
+
+ Modified: 3/25/1991
+
+ Returns: Always 0
+
+ Notes: WM_DrawItem has validated hWnd and lpdis.
+
+****************************************************************************/
+
+WORD DLM_DrawTree(
+
+HWND hWnd , // I - Handle to Parent Window of list box.
+LPDRAWITEMSTRUCT lpdis ) // I - Pointer to information about item.
+
+{
+ INT cxPos, cyPos ;
+ short cxString ;
+ RECT rc ;
+ RECT rcAll ;
+ RECT rcNew ;
+
+ WORD fHighLightText ;
+
+ DLM_HEADER_PTR pHdr ;
+ PDS_WMINFO pWinInfo ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ SET_TAG_PTR pfnSetTag ;
+
+ BYTE *lpObjLst;
+ LMHANDLE dhListItem ;
+ DLM_ITEM_PTR lpDispItem ;
+ BYTE bObjCnt ;
+ BYTE bLevel ;
+ DWORD dwBrothers ;
+ LPDWORD pFirstDword ;
+ USHORT unHeight ;
+ BYTE i ;
+ HANDLE hSaveObject ;
+ POINT pt; //dvc - GetWindowOrgEx return value
+ SIZE sizeRect ; //dvc - GetTextExtentPoint return val
+
+
+ if ( (lpdis->itemAction == ODA_SELECT ) ||
+ (lpdis->itemAction == ODA_DRAWENTIRE ) )
+ {
+ pHdr = DLM_GetDispHdr( lpdis->hwndItem );
+
+ GetWindowOrgEx( lpdis->hDC, &pt );
+ pHdr->xOrigin = (WORD)pt.x;
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWnd );
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr );
+ pfnSetTag = (SET_TAG_PTR) DLM_GSetTag ( pHdr );
+
+ dhListItem = (LMHANDLE) lpdis->itemData ;
+
+ CopyRect ( (LPRECT)&rc, (LPRECT) &lpdis->rcItem );
+ CopyRect ( (LPRECT)&rcAll, (LPRECT) &lpdis->rcItem );
+
+ InflateRect( (LPRECT) &rc, mwDLMInflate, mwDLMInflate );
+
+ if ( lpdis->itemState & ODS_SELECTED )
+ {
+ (*pfnSetTag) (dhListItem, 1 );
+ fHighLightText = TRUE ;
+
+ }
+ else
+ {
+ (*pfnSetTag) (dhListItem, 0 );
+ fHighLightText = FALSE ;
+ }
+
+ /* Ready now to display item */
+
+ lpObjLst = (BYTE *) ( (*pfnGetObjects) (dhListItem) );
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+
+ /* Draw lines before checkbox */
+
+ cxPos = (short)rc.left ;
+ cyPos = (short)rc.top ;
+ unHeight = (short)(rc.bottom - rc.top + 1);
+ bLevel = DLM_ItembLevel( lpDispItem );
+
+ hSaveObject = SelectObject( lpdis->hDC, ghPenForeGnd );
+
+ pFirstDword = (LPDWORD) ( lpObjLst + 2 ) ;
+
+ for( i=1; i<bLevel; i++ ) {
+
+ // Index to the appropiate DWORD that describes the levels
+ // First DWORD is for levels 0-31, Second DWORD is for levels 32-63 ...
+
+ dwBrothers = *( (DWORD UNALIGNED *) ( pFirstDword + (i/32) ) ) ;
+
+ if ( dwBrothers & LevelMaskTbl[ i % 32 ] ) {
+ cxPos += pHdr->cxHierHorzLine ;
+ MoveToEx ( lpdis->hDC, cxPos, (INT)rcAll.top, NULL );
+ LineTo ( lpdis->hDC, cxPos, (INT)rcAll.bottom );
+ cxPos -= pHdr->cxHierHorzLine ;
+ }
+ cxPos += pHdr->cxHierTab;
+ }
+
+ /* Draw full length line directly before the checkbox
+ if a brother exists right after */
+
+ if ( bLevel ) {
+
+ // Index to the appropiate DWORD that describes the levels
+ // First DWORD is for levels 0-31, Second DWORD is for levels 32-63 ...
+
+ dwBrothers = *( (DWORD UNALIGNED *) ( pFirstDword + (bLevel/32) ) ) ;
+
+ if ( dwBrothers & LevelMaskTbl [bLevel % 32] ) {
+
+ cxPos += pHdr->cxHierHorzLine ;
+ MoveToEx ( lpdis->hDC, cxPos, (INT)rcAll.top, NULL);
+ LineTo ( lpdis->hDC, cxPos, (INT)rcAll.bottom );
+
+ // rcAll.top_height/2+1 will place line to point to middle of checkbox
+
+ MoveToEx ( lpdis->hDC, cxPos, (INT)(rcAll.top+unHeight/2+1), NULL );
+ LineTo ( lpdis->hDC, cxPos + pHdr->cxHierHorzLen,
+ (INT)(rcAll.top+unHeight/2+1) );
+ } else {
+
+ // rcAll.top_height/2+1 will place line to point to middle of checkbox
+
+ cxPos += pHdr->cxHierHorzLine ;
+ MoveToEx ( lpdis->hDC, cxPos, (INT)rcAll.top, NULL );
+ LineTo ( lpdis->hDC, cxPos, (INT)rcAll.top+unHeight/2+1 );
+ LineTo ( lpdis->hDC, cxPos + pHdr->cxHierHorzLen,
+ (INT)(rcAll.top+unHeight/2+1) );
+ }
+ }
+
+ SelectObject( lpdis->hDC, hSaveObject );
+
+ cxPos = (short)rc.left ;
+ cxPos += (short)( DLM_ItembLevel( lpDispItem ) * pHdr->cxHierTab );
+ cyPos = (short)rc.top ;
+
+ while ( bObjCnt ) {
+
+ switch ( DLM_ItembType ( lpDispItem ) ) {
+
+ case DLM_CHECKBOX:
+
+ cxPos += pHdr->cxBeforeCheckBox ;
+
+ RSM_BitmapDraw( DLM_ItemwId ( lpDispItem ),
+ cxPos,
+ cyPos+pHdr->cyBeforeCheckBox,
+ pHdr->cxCheckBoxWidth,
+ pHdr->cyCheckBoxHeight,
+ lpdis->hDC );
+ cxPos += pHdr->cxCheckBoxWidth;
+ break;
+
+ case DLM_BITMAP:
+
+ cxPos += pHdr->cxBeforeBitMap ;
+
+ rcNew.left = cxPos ;
+ rcNew.top = rcAll.top ;
+ rcNew.right= cxPos+pHdr->cxBitMapWidth+pHdr->cxBeforeBitMap;
+ rcNew.bottom= rcAll.bottom ;
+
+ RSM_BitmapDraw( DLM_ItemwId ( lpDispItem ),
+ cxPos,
+ cyPos+pHdr->cyBeforeBitMap,
+ pHdr->cxBitMapWidth,
+ pHdr->cyBitMapHeight,
+ lpdis->hDC );
+ cxPos += pHdr->cxBitMapWidth;
+ break;
+
+
+ case DLM_TEXT_ONLY:
+
+ /* Assume bitmap before text */
+
+ cxPos += pHdr->cxBeforeText ;
+
+ hSaveObject = SelectObject( lpdis->hDC, ghFontIconLabels );
+
+ GetTextExtentPoint ( lpdis->hDC,
+ (CHAR_PTR)DLM_ItemqszString ( lpDispItem ),
+ strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) ),
+ &sizeRect);
+
+ cxString = (short)sizeRect.cx;
+ rcNew.left = cxPos ;
+ rcNew.right = rcNew.left + cxString ;
+
+ if ( fHighLightText ) {
+
+ FillRect( lpdis->hDC, &rcNew, ghBrushHighLight );
+
+ } else {
+ // Increment right of region by 2 to clear out the
+ // previous high light brush.
+
+ rcNew.right += 3 ;
+ FillRect( lpdis->hDC, &rcNew, ghBrushWhite );
+
+ }
+
+ if (fHighLightText ) {
+
+ SetBkColor ( lpdis->hDC, gColorHighLight ) ;
+ SetTextColor( lpdis->hDC, gColorHighLightText ) ;
+
+ } else {
+
+ SetBkColor ( lpdis->hDC, gColorBackGnd ) ;
+ SetTextColor( lpdis->hDC, gColorForeGnd ) ;
+ }
+
+ TextOut ( lpdis->hDC, cxPos+1, cyPos+pHdr->cyBeforeText,
+ (CHAR_PTR)DLM_ItemqszString( lpDispItem ),
+ strlen( (CHAR_PTR)DLM_ItemqszString ( lpDispItem ) ) );
+
+ SelectObject( lpdis->hDC, hSaveObject );
+
+
+ cxPos += cxString ;
+
+ if ( cxPos > (short) pHdr->wHorizontalExtent ) {
+
+ pHdr->wHorizontalExtent = cxPos ;
+ SendMessage ( lpdis->hwndItem, LB_SETHORIZONTALEXTENT,
+ cxPos + 4*mwcxDLMIconLabelsWidth , 0L );
+ }
+
+ if ( ! DLM_IsFocusInWindow ( hWnd, lpdis->hwndItem ) ) {
+
+ if ( fHighLightText ) {
+ lpdis->itemAction = ODA_FOCUS ;
+ }
+ }
+
+ break ;
+
+ } //switch
+
+ bObjCnt-- ;
+ lpDispItem++ ;
+
+ } //while
+
+ } //if select or draw item
+
+ if ( lpdis->itemAction == ODA_FOCUS ) { /* Put box around item */
+
+ pHdr = DLM_GetDispHdr( lpdis->hwndItem );
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWnd );
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr );
+
+ dhListItem = (LMHANDLE) lpdis->itemData ;
+
+ CopyRect ( (LPRECT)&rc, (LPRECT) &lpdis->rcItem );
+ CopyRect ( (LPRECT)&rcAll, (LPRECT) &lpdis->rcItem );
+
+ InflateRect( (LPRECT) &rc, mwDLMInflate, mwDLMInflate );
+
+ /* Ready now to display item */
+
+ if ( dhListItem == NULL ) /* It is possible that list box is empty */
+ {
+ return ( 0 ); /* Return OK since the list box is probably empty */
+ }
+
+ lpObjLst = (BYTE *) ( (*pfnGetObjects) (dhListItem) );
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ cxPos = (short)rc.left ;
+ cxPos += ( DLM_ItembLevel( lpDispItem ) * pHdr->cxHierTab );
+
+ cyPos = (short)rc.top ;
+
+ while ( bObjCnt )
+ {
+ switch ( DLM_ItembType ( lpDispItem ) )
+ {
+ case DLM_CHECKBOX:
+
+ cxPos += pHdr->cxBeforeCheckBox ;
+ cxPos += pHdr->cxCheckBoxWidth ;
+ break;
+
+ case DLM_BITMAP:
+
+ cxPos += pHdr->cxBeforeBitMap ;
+ cxPos += pHdr->cxBitMapWidth ;
+
+ rcNew.left = cxPos ;
+ rcNew.top = rcAll.top ;
+ rcNew.right= cxPos+pHdr->cxBitMapWidth+pHdr->cxBeforeBitMap;
+ rcNew.bottom= rcAll.bottom ;
+
+ break;
+
+
+ case DLM_TEXT_ONLY:
+
+
+ cxPos += pHdr->cxBeforeText ;
+
+ /* Assume bitmap before text */
+
+ hSaveObject = SelectObject( lpdis->hDC, ghFontIconLabels );
+
+ GetTextExtentPoint( lpdis->hDC,
+ (CHAR_PTR)DLM_ItemqszString ( lpDispItem ),
+ strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) ),
+ &sizeRect );
+
+ cxString = (short)sizeRect.cx;
+
+ SelectObject( lpdis->hDC, hSaveObject );
+
+ if ( ! DLM_IsFocusInWindow ( hWnd, lpdis->hwndItem ) ) {
+
+ /* Repaint text with normal background */
+
+ rcNew.left = cxPos ;
+ rcNew.right = rcNew.left + cxString + 3;
+
+ FillRect( lpdis->hDC, &rcNew, ghBrushWhite );
+
+ hSaveObject = SelectObject( lpdis->hDC, ghFontIconLabels );
+
+ SetBkColor ( lpdis->hDC, gColorBackGnd ) ;
+ SetTextColor( lpdis->hDC, gColorForeGnd ) ;
+
+ TextOut ( lpdis->hDC, cxPos+1, cyPos,
+ (CHAR_PTR)DLM_ItemqszString( lpDispItem ),
+ strlen( (CHAR_PTR)DLM_ItemqszString ( lpDispItem ) ) );
+
+ SelectObject( lpdis->hDC, hSaveObject );
+
+ } else {
+
+ /* Repaint text with high light background */
+
+ rcNew.left = cxPos ;
+ rcNew.right = rcNew.left + cxString + 3;
+
+
+ FillRect( lpdis->hDC, &rcNew, ghBrushHighLight );
+
+ hSaveObject = SelectObject( lpdis->hDC, ghFontIconLabels );
+
+ SetBkColor ( lpdis->hDC, gColorHighLight ) ;
+ SetTextColor ( lpdis->hDC, gColorHighLightText ) ;
+
+ TextOut ( lpdis->hDC, cxPos+1, cyPos,
+ (CHAR_PTR)DLM_ItemqszString( lpDispItem ),
+ strlen( (CHAR_PTR)DLM_ItemqszString ( lpDispItem ) ) );
+
+ SelectObject( lpdis->hDC, hSaveObject );
+
+ }
+
+ rcNew.left = cxPos ;
+ rcNew.top = rcAll.top ;
+ rcNew.bottom = rcAll.bottom ;
+ rcNew.right = rcNew.left + cxString + 3;
+
+
+ if ( ! DLM_IsFocusInWindow ( hWnd, lpdis->hwndItem ) ) {
+
+ FrameRect( lpdis->hDC, &rcNew, ghBrushHighLight );
+ }
+ else if ( ( lpdis->itemAction & ODA_FOCUS ) && ( lpdis->itemState & ODS_FOCUS ) ) {
+
+ SetBkColor ( lpdis->hDC, gColorHighLight ) ;
+ SetTextColor ( lpdis->hDC, gColorHighLightText ) ;
+ DLM_SetFocusItem ( lpdis, &rcNew );
+ }
+
+ break ;
+
+ } //switch
+
+ bObjCnt-- ;
+ lpDispItem++ ;
+ }
+
+ }
+
+ return ( 0 );
+}
+
+
+/****************************************************************************
+
+ Name: DLM_IsFocusOnWindow
+
+ Description: This function will check to see if current focus
+ is on either of the listboxes in the window.
+
+ Modified: 5/13/1991
+
+ Returns: TRUE if current focus is on one of the listboxes
+ in the window.s.
+
+ FALSE if not.
+
+****************************************************************************/
+
+BOOL DLM_IsFocusInWindow(
+
+HWND hWnd , //I - Handle to Parent window of list box.
+HWND hWndLB ) //I - Handle to list box.
+
+{
+
+ WORD wStatus ;
+ HWND hWndFocus ;
+ PDS_WMINFO pWinInfo ;
+
+ // Must be valid windows.
+
+ if ( ! IsWindow ( hWnd ) || ! IsWindow ( hWndLB ) ) {
+ return FALSE;
+ }
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWnd );
+
+ if ( ! pWinInfo ) {
+ return FALSE;
+ }
+
+ hWndFocus = GetFocus();
+
+ wStatus = FALSE ;
+
+ // If this list box is the active list box and the list box has the focus,
+ // then we have focus on the window.
+
+ if ( hWndLB == WMDS_GetWinActiveList ( pWinInfo ) && hWndLB == hWndFocus ) {
+
+ wStatus = TRUE;
+ }
+
+// What is this??? I think that the previous if statement will do the same thing.
+
+// if ( ( pWinInfo->hWndTreeList == hWndFocus ) ||
+// ( pWinInfo->hWndFlatList == hWndFocus ) ) {
+//
+// if ( hWndFocus != hWndLB ) {
+// wStatus = FALSE ;
+// } else {
+// wStatus = TRUE ;
+// }
+// } else {
+// if (pWinInfo->hWndActiveList == hWndLB ) {
+// wStatus = TRUE ;
+// } else {
+// wStatus = FALSE ;
+// }
+// }
+
+ return wStatus;
+}
+
+
+/****************************************************************************
+
+ Name: DLM_GetFocusItem
+
+ Description: This function will return an address of
+ the item that has the focus box.
+ tree fashion.
+
+ Modified: 10/08/1991
+
+ Returns: Pointer to the application's item as registered
+ by the list box.
+
+ Notes:
+
+****************************************************************************/
+
+PVOID DLM_GetFocusItem(
+
+HWND hWndLB ) // I - Handle to control list box.
+
+{
+
+ DLM_HEADER_PTR pHdr ;
+ PVOID lpResult = NULL ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndLB ) ) {
+ return( NULL );
+ }
+
+ if ( hWndLB ) {
+
+ pHdr = DLM_GetDispHdr( hWndLB );
+
+ // Attempt to return the address the of unFocusItem item
+ // in the list box.
+
+ // The header must exist and the list must have at least one
+ // item ( hence unFocusItem = -1 if list is empty ) .
+
+ if ( pHdr ) {
+
+ if ( pHdr->unFocusItem != -1 ) {
+
+ lpResult = (PVOID) SendMessage( hWndLB,
+ LB_GETITEMDATA,
+ pHdr->unFocusItem,
+ 0L );
+
+ if ( lpResult == (PVOID)LB_ERR ) {
+ lpResult = NULL;
+ }
+ }
+ }
+ }
+
+ return lpResult;
+}
+
+
+/****************************************************************************
+GSH
+ Name: DLM_SetFocusItem
+
+ Description: This function draw the focus box around an item.
+
+ Modified: 11/11/1991
+
+ Returns: Nothing.
+
+ Notes:
+
+****************************************************************************/
+
+VOID DLM_SetFocusItem (
+
+LPDRAWITEMSTRUCT lpdis, // I - Pointer to information about item.
+LPRECT prcItem ) // I - pointer to item rectangle to draw focus around.
+
+{
+ // Put the focus around the item if the control gains the focus and
+ // the item has the input focus. (it doesn't work that way, but it should)
+
+
+ if ( ( lpdis->itemAction & ODA_FOCUS ) ) {
+
+ DLM_HEADER_PTR pHdr = DLM_GetDispHdr( lpdis->hwndItem );
+
+ if ( pHdr ) {
+
+ // Put the focus box around the item.
+
+ DrawFocusRect ( lpdis->hDC, prcItem );
+
+ pHdr->unFocusItem = lpdis->itemID ;
+
+ // Now, call back the function that the application may have set
+ // up for us to call when the focus changes.
+
+ if ( DLM_GSetItemFocus ( pHdr ) && ( lpdis->itemState & ODS_FOCUS ) ) {
+
+ SET_FOCUS_PTR pfnSetItemFocus = (SET_FOCUS_PTR) DLM_GSetItemFocus ( pHdr );
+
+ (*pfnSetItemFocus) ( (LMHANDLE)lpdis->itemData );
+ }
+ }
+ }
+
+} /* end DLM_SetFocusItem() */
+
+
+/****************************************************************************
+GSH
+ Name: DLM_SetBorderOnItem ()
+
+ Description: This function draws the plain rectangle around an item.
+
+ Modified: 1/13/1992
+
+ Returns: Nothing.
+
+ Notes:
+
+****************************************************************************/
+
+static VOID DLM_DrawBorderOnItem (
+
+HWND hWnd,
+DLM_HEADER_PTR pHdr,
+LPDRAWITEMSTRUCT lpdis )
+
+{
+ RECT rcAll;
+ INT nPrevSelect;
+
+ // If the focus is not in this window and this item is selected and there
+ // is actually data for this item, just draw a rectangle around the item.
+
+ if ( ! DLM_IsFocusInWindow ( hWnd, lpdis->hwndItem ) &&
+ ( lpdis->itemState & ODS_SELECTED ) &&
+ ( lpdis->itemData ) ) {
+
+ CopyRect ( (LPRECT)&rcAll, (LPRECT) &lpdis->rcItem );
+
+ nPrevSelect = (INT)SendMessage ( lpdis->hwndItem, LB_GETSEL, (MP1)(lpdis->itemID - 1), (MP2)0 );
+
+ if ( rcAll.top > 0 && lpdis->itemID > 0 && nPrevSelect > 0 ) {
+ rcAll.top--;
+ }
+
+ // If the listbox is in the singlecolumn mode, then include
+ // the pHdr->wHorizonalExtent.
+
+ if ( DLM_GMode( pHdr ) == DLM_SINGLECOLUMN ) {
+ rcAll.right = rcAll.left + pHdr->wHorizontalExtent - 1 ;
+ } else {
+ rcAll.right -= 1 ;
+ }
+
+ FrameRect ( lpdis->hDC, &rcAll, ghBrushHighLight );
+ }
+
+} /* end DLM_DrawBorderOnItem() */
+
+
+/****************************************************************************
+
+ Name: DLM_SetFont
+
+ Description: This function will change the font for child list boxes
+ of a given DOC window.
+
+ Modified: 08/20/1992
+
+ Returns: none
+
+ Notes: The DOC windows' listboxes, both the tree and flat
+ will be rescaled to support the new font.
+
+****************************************************************************/
+
+VOID DLM_SetFont(
+
+HWND hWndParent ) // I - Handle to DOC window.
+
+{
+
+ DLM_HEADER_PTR pdsHdr;
+ PVOID lpResult = NULL;
+ PDS_WMINFO pWinInfo;
+
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndParent ) ) {
+ return;
+ }
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWndParent );
+
+ if ( !pWinInfo ) {
+ return;
+ }
+
+
+ // ghFontFiles and ghFontIconLabels have changed.
+
+
+ // Reset the module variables that effect fonts in listboxes.
+
+
+ {
+
+ BOOL fResult;
+ INT maxwidth;
+ INT width;
+ INT unHeight;
+
+ fResult = RSM_GetFontSize( ghFontFiles,
+ &maxwidth,
+ &width,
+ &unHeight );
+
+ mwcxDLMFontFilesMaxWidth = (USHORT) maxwidth;
+ mwcxDLMFontFilesWidth = (USHORT) width;
+ mwcyDLMFontFilesHeight = (USHORT) unHeight;
+
+ fResult = RSM_GetFontSize( ghFontIconLabels,
+ &maxwidth,
+ &width,
+ &unHeight );
+
+ mwcxDLMIconLabelsMaxWidth = (USHORT) maxwidth;
+ mwcxDLMIconLabelsWidth = (USHORT) width;
+ mwcyDLMIconLabelsHeight = (USHORT) unHeight;
+
+ }
+
+ // Redo the hierarchical window if it exists.
+
+ if ( pWinInfo->hWndTreeList && pWinInfo->pTreeDisp ) {
+
+ USHORT unOldWidthCB;
+ USHORT unOldHeightCB;
+ USHORT unOldWidthBM;
+ USHORT unOldHeightBM;
+ LPARAM lpmHeight;
+
+ pdsHdr = pWinInfo->pTreeDisp;
+
+ // With Windows 3.1 set the height of every row by
+ // sending LB_SETITEMHEIGHT with the appropiate height.
+
+ // BUT, we DON'T want to screw up the old bitmap sizes.
+ // So save the old ones and put them back.
+
+ unOldWidthCB = DLM_GetCheckBoxWidth ( pdsHdr );
+ unOldHeightCB = DLM_GetCheckBoxHeight ( pdsHdr );
+ unOldWidthBM = DLM_GetBitMapWidth ( pdsHdr );
+ unOldHeightBM = DLM_GetBitMapHeight ( pdsHdr );
+
+ DLM_InitScrnValues( pdsHdr );
+
+ DLM_SetCheckBoxWidth ( pdsHdr, (USHORT) unOldWidthCB );
+ DLM_SetCheckBoxHeight ( pdsHdr, (USHORT) unOldHeightCB );
+ DLM_SetBitMapWidth ( pdsHdr, (USHORT) unOldWidthBM );
+ DLM_SetBitMapHeight ( pdsHdr, (USHORT) unOldHeightBM );
+
+ lpmHeight = MAKELPARAM( pdsHdr->cyColHeight, 0 );
+ SendMessage( pWinInfo->hWndTreeList, LB_SETITEMHEIGHT, 0, lpmHeight );
+ InvalidateRect( pWinInfo->hWndTreeList, NULL, TRUE );
+
+ }
+
+ if ( pWinInfo->hWndFlatList && pWinInfo->pFlatDisp ) {
+
+ USHORT unOldWidthCB;
+ USHORT unOldHeightCB;
+ USHORT unOldWidthBM;
+ USHORT unOldHeightBM;
+ LPARAM lpmHeight;
+ MEASUREITEMSTRUCT dsMeasureItem;
+
+ pdsHdr = pWinInfo->pFlatDisp;
+
+ // With Windows 3.1 set the height of every row by
+ // sending LB_SETITEMHEIGHT with the appropiate height.
+
+ // BUT, we DON'T want to screw up the old bitmap sizes.
+ // So save the old ones and put them back.
+
+ unOldWidthCB = DLM_GetCheckBoxWidth ( pdsHdr );
+ unOldHeightCB = DLM_GetCheckBoxHeight ( pdsHdr );
+ unOldWidthBM = DLM_GetBitMapWidth ( pdsHdr );
+ unOldHeightBM = DLM_GetBitMapHeight ( pdsHdr );
+
+ DLM_InitScrnValues( pdsHdr );
+
+ DLM_SetCheckBoxWidth ( pdsHdr, (USHORT) unOldWidthCB );
+ DLM_SetCheckBoxHeight ( pdsHdr, (USHORT) unOldHeightCB );
+ DLM_SetBitMapWidth ( pdsHdr, (USHORT) unOldWidthBM );
+ DLM_SetBitMapHeight ( pdsHdr, (USHORT) unOldHeightBM );
+
+ lpmHeight = MAKELPARAM( pdsHdr->cyColHeight, 0 );
+ SendMessage( pWinInfo->hWndFlatList, LB_SETITEMHEIGHT, 0, lpmHeight );
+
+
+ // Need to recalculate a new column width if multiple-column.
+
+ // If the mode is multicolumn, then switch to single-column and
+ // then back to multicolumn.
+
+ dsMeasureItem.CtlID = WMIDC_FLATLISTBOX;
+ DLM_WMMeasureItem( hWndParent, &dsMeasureItem );
+
+ SendMessage( pWinInfo->hWndFlatList, LB_SETCOLUMNWIDTH, pdsHdr->cxColWidth, 0L );
+
+ InvalidateRect( pWinInfo->hWndFlatList, NULL, TRUE );
+
+ }
+
+ // Update the document window once again.
+
+ InvalidateRect( hWndParent, NULL, TRUE );
+
+}
+
+
+/******************************************************************************
+
+ Name: DLM_GetPixelStringWidth()
+
+ Description: This function gets the pixel width of a string based on
+ the font associated with the window handle passed.
+
+ Returns: The width of the string in pixels.
+
+******************************************************************************/
+
+INT DLM_GetPixelStringWidth (
+
+HWND hWndLB, // I - handle to a list box window
+LPSTR lpString, // I - string ID or a pointer to the string
+INT nStringLen ) // I - string length
+
+{
+ HFONT hFont;
+ DLM_HEADER_PTR pHdr;
+
+ // The list box window must exist.
+
+ if ( ! IsWindow ( hWndLB ) ) {
+ return 0;
+ }
+
+ pHdr = DLM_GetDispHdr ( hWndLB );
+
+ // DLM display header must be defined.
+
+ if ( ! pHdr ) {
+ return 0;
+ }
+
+ switch ( DLM_GDisplay( pHdr ) ) {
+
+ case DLM_LARGEBITMAPSLTEXT:
+
+ hFont = ghFontFiles;
+ break;
+
+ case DLM_SMALL_BITMAPS:
+ default:
+
+ if ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) {
+ hFont = ghFontIconLabels;
+ }
+ else {
+
+ // If the font is DLM_ANSI_FIXED_FONT, select ghFontLog.
+ // is DLM_SYSTEM_FONT, select ghFontIconLabels
+
+ if ( DLM_GTextFont( pHdr ) == DLM_ANSI_FIXED_FONT ) {
+ hFont = ghFontLog;
+ }
+ else {
+ hFont = ghFontIconLabels;
+ }
+ }
+
+ break;
+ }
+
+ return RSM_GetFontStringWidth ( hFont, lpString, nStringLen );
+
+} /* end DLM_GetPixelStringWidth() */
+
+
diff --git a/private/utils/ntbackup/src/dlm_init.c b/private/utils/ntbackup/src/dlm_init.c
new file mode 100644
index 000000000..83b2c28aa
--- /dev/null
+++ b/private/utils/ntbackup/src/dlm_init.c
@@ -0,0 +1,937 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: DLM_INIT.C
+
+ Description: This file contains routines for display list manager.
+
+ The following routines are in this module:
+
+
+ DLM_Deinit
+ DLM_DispListInit
+ DLM_GetDispHdr
+ DLM_InitScrnValues
+ DLM_GetObjectsBuffer
+ DLM_Init
+ DLM_DispListTerm
+ DLM_WMDeleteItem
+ DLM_WMMeasureItem
+
+ $Log: G:/UI/LOGFILES/DLM_INIT.C_V $
+
+ Rev 1.26 15 Jun 1993 11:06:04 MIKEP
+enable c++
+
+ Rev 1.25 14 Jun 1993 20:17:48 MIKEP
+enable c++
+
+ Rev 1.24 23 Feb 1993 15:23:36 ROBG
+Added setting wHorizontalExtent to 0 to support the redefinition
+of a font for a listbox.
+
+ Rev 1.23 01 Nov 1992 15:46:38 DAVEV
+Unicode changes
+
+ Rev 1.21 16 Oct 1992 15:53:44 GLENN
+Changed default small bitmap back to IDRBM_EXE - closer to the text now. Also naming cleanup.
+
+ Rev 1.20 07 Oct 1992 13:47:32 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.19 04 Oct 1992 19:32:58 DAVEV
+Unicode Awk pass
+
+ Rev 1.18 28 Sep 1992 17:02:32 GLENN
+MikeP changes - casting stuff.
+
+ Rev 1.17 09 Sep 1992 10:28:10 GLENN
+Updated the max size of the folder bitmap.
+
+ Rev 1.16 08 Sep 1992 11:46:52 ROBG
+Changed cxPos from USHORT to short.
+
+ Rev 1.15 08 Sep 1992 10:08:18 ROBG
+Modified to solve the clipping bitmap problem.
+
+ Rev 1.14 04 Sep 1992 17:48:16 GLENN
+Fixed bitmap display clipping.
+
+ Rev 1.13 03 Sep 1992 15:30:48 ROBG
+Added conditionals for OS_WIN32.
+
+ Rev 1.12 21 Aug 1992 16:00:36 ROBG
+Changes to support change of font.
+
+ Rev 1.11 19 Aug 1992 14:32:34 ROBG
+Make modifications to use actual bitmap sizes and for the listboxes
+to be shorter and more compact.
+
+ Rev 1.10 21 May 1992 10:53:42 MIKEP
+fix my typo
+
+ Rev 1.9 19 May 1992 13:01:50 MIKEP
+mips changes
+
+ Rev 1.8 15 May 1992 13:35:28 MIKEP
+nt pass 2
+
+ Rev 1.7 14 May 1992 18:37:02 STEVEN
+40Format changes
+
+ Rev 1.6 29 Jan 1992 18:01:14 DAVEV
+
+
+ * No changes
+
+ Rev 1.5 10 Jan 1992 13:58:40 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.4 26 Dec 1991 17:24:22 ROBG
+New and Improved.
+
+ Rev 1.3 27 Nov 1991 12:09:54 ROBG
+Modified parameters to DLM_DispListTerm and logic as well.
+
+ Rev 1.2 27 Nov 1991 09:27:46 ROBG
+Modified DLM_DispListTerm to support validity checks and
+deallocating the memory in the display list header and buffer.
+
+ Rev 1.1 26 Nov 1991 13:31:36 ROBG
+Added validity checks for the window handle, info structure, and the
+dlm display header.
+
+ Rev 1.0 20 Nov 1991 19:16:34 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/****************************************************************************
+
+ Name: DLM_Deinit
+
+ Description: This function will deinitialize the display list manager.
+
+ Modified: 12/19/1991
+
+ Returns: none.
+
+****************************************************************************/
+
+VOID DLM_Deinit( void )
+
+{
+ // Deallocate the temporary object buffer used when creating
+ // multi-column listboxes.
+
+ if ( mwpTempObjBuff ) {
+ free( mwpTempObjBuff ) ;
+ }
+}
+
+/****************************************************************************
+
+ Name: DLM_DispListInit
+
+ Description: This function will initialize the display list for a
+ window.
+
+ Modified: 2/07/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_OUT_OF_MEMORY
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+WORD DLM_DispListInit(
+
+PVOID void_ptr, // I - Pointer to extra-bytes of a window
+DLM_INIT_PTR pdsInit ) // I - Pointer to initialization values
+
+{
+ WORD wStatus ;
+ DLM_HEADER_PTR pdsHdr ;
+ LMHANDLE pdsListHdr ;
+ PDS_WMINFO pWinInfo;
+ GET_COUNT_PTR pfnGetItemCount ;
+
+ pWinInfo = (PDS_WMINFO)void_ptr;
+
+ wStatus = 0 ;
+
+ switch ( pdsInit->bListBoxType ) {
+
+ case DLM_FLATLISTBOX :
+ pWinInfo->pFlatDisp = ( DLM_HEADER_PTR) calloc( 1, sizeof( DLM_HEADER) ) ;
+ if ( pWinInfo->pFlatDisp == NULL ) {
+ return( DLMERR_OUT_OF_MEMORY ) ;
+ }
+
+ memcpy( (LPSTR) (pWinInfo->pFlatDisp), pdsInit, sizeof( DLM_INIT ) ) ;
+ pdsHdr = pWinInfo->pFlatDisp ;
+ break ;
+
+ case DLM_TREELISTBOX :
+
+ pWinInfo->pTreeDisp = ( DLM_HEADER_PTR) calloc( 1, sizeof( DLM_HEADER) ) ;
+ if ( pWinInfo->pTreeDisp == NULL ) {
+ return( DLMERR_OUT_OF_MEMORY ) ;
+ }
+
+ memcpy( (LPSTR) (pWinInfo->pTreeDisp), pdsInit, sizeof( DLM_INIT ) ) ;
+ pdsHdr = pWinInfo->pTreeDisp ;
+ break ;
+
+ default :
+ return ( DLMERR_INIT_FAILED ) ;
+ break ;
+ }
+
+ pdsListHdr = ( LMHANDLE ) DLM_GDispHdr ( pdsHdr ) ;
+
+ pfnGetItemCount = (GET_COUNT_PTR) DLM_GGetItemCount( pdsHdr ) ;
+ pdsHdr->usItemCount = (USHORT) ( (*pfnGetItemCount) (pdsListHdr) ) ;
+
+ pdsHdr->fFocus = FALSE ;
+
+ DLM_InitScrnValues ( pdsHdr ) ;
+
+ /* Allocate DLM_ITEM area for list */
+
+ if ( DLM_GMaxNumObjects( pdsHdr ) == 0 ) {
+ DLM_GMaxNumObjects( pdsHdr ) = 6 ;
+ }
+
+ // Supports up to 159 levels deep.
+
+ pdsHdr->pGetObjBuffer = calloc( 1, 2 + 5*sizeof(DWORD) +
+ DLM_GMaxNumObjects(pdsHdr)*(sizeof(DLM_ITEM)) );
+
+ return ( 0 ) ;
+ }
+
+
+/****************************************************************************
+
+ Name: DLM_InitScrnValues
+
+ Description: This function will set the screen values for
+ displaying objects in the display manager's list
+ boxes.
+
+ Modified: 3/25/1991
+
+ Returns: none
+
+ Notes: A call to DLM_Init must have done before this routine
+ to set up the following variables:
+
+ mwcxDLMFontFilesWidth
+ mwcyDLMFontFilesHeight
+ mwcxDLMIconLabelsWidth
+ mwcyDLMIconLabelsHeight
+ See also:
+
+****************************************************************************/
+
+void DLM_InitScrnValues(
+
+DLM_HEADER_PTR pdsHdr ) //I - Pointer to DLM header values
+
+{
+
+ BOOL fResult ;
+ INT nWidth ;
+ INT nHeight ;
+
+ // There are currently two possibilities
+ //
+ // DLM_SMALL_BITMAPS
+ // DLM_LARGEBITMAPSLTEXT with text right of item.
+
+
+ switch ( DLM_GDisplay( pdsHdr ) ) {
+
+ case DLM_LARGEBITMAPSLTEXT :
+
+
+ fResult = RSM_GetBitmapSize( IDRBM_SEL_NONE, &nWidth, &nHeight ) ;
+
+ DLM_SetCheckBoxWidth ( pdsHdr, (USHORT) nWidth ) ;
+ DLM_SetCheckBoxHeight( pdsHdr, (USHORT) nHeight ) ;
+
+
+ fResult = RSM_GetBitmapSize( IDRBM_HARDDRIVE, &nWidth, &nHeight ) ;
+
+ DLM_SetBitMapWidth ( pdsHdr , (USHORT) nWidth ) ;
+ DLM_SetBitMapHeight( pdsHdr, (USHORT) nHeight ) ;
+
+
+ // Current checkbox is 12 wide.
+ // Current harddrive is 24 wide.
+
+ pdsHdr->cyTextHeight = mwcyDLMFontFilesHeight ;
+
+ pdsHdr->cxTextWidth = (USHORT)(mwcxDLMFontFilesWidth +
+ ( mwcxDLMFontFilesMaxWidth -
+ mwcxDLMFontFilesWidth)/2 );
+
+
+ pdsHdr->cxTextWidth = mwcxDLMFontFilesMaxWidth ;
+
+ // Offsets to place the objects horizontally. Magic numbers.
+
+ pdsHdr->cxBeforeCheckBox = 3 ; // Leave space before checkbox
+ pdsHdr->cxBeforeBitMap = 7 ; // Leave space before bitmap
+ pdsHdr->cxBeforeText = 6 ; // Leave space before text
+
+ pdsHdr->cxColWidth = 60 ; /* Calculated */
+
+ pdsHdr->cyColHeight = (USHORT)(mwcyDLMFontFilesHeight+4 );
+
+ // Offsets to place the objects vertically.
+
+ pdsHdr->cyBeforeText = 0 ;
+ pdsHdr->cyBeforeCheckBox = 1 ;
+ pdsHdr->cyBeforeBitMap = 1 ; // Adjust downwards 1
+
+ // The minimum height of an item is 20 pixels.
+ // This is the initial font with mwcyDLMFontFilesHeight(16) + 4
+
+ if ( pdsHdr->cyColHeight < 20 ) {
+ pdsHdr->cyColHeight = 20 ;
+ }
+
+ // If height of item is larger than 20, offset objects vertically.
+
+ if ( pdsHdr->cyColHeight > 20 ) {
+ pdsHdr->cyBeforeCheckBox += ( (pdsHdr->cyColHeight-21)/2 + 1 ) ;
+ pdsHdr->cyBeforeBitMap += ( (pdsHdr->cyColHeight-21)/2 + 1 ) ;
+
+ }
+
+ break ;
+
+
+ case DLM_SMALL_BITMAPS :
+ default :
+
+ fResult = RSM_GetBitmapSize( IDRBM_SEL_NONE, &nWidth, &nHeight ) ;
+
+ DLM_SetCheckBoxWidth ( pdsHdr, (USHORT) nWidth ) ;
+ DLM_SetCheckBoxHeight( pdsHdr, (USHORT) nHeight ) ;
+
+
+ fResult = RSM_GetBitmapSize( IDRBM_EXE, &nWidth, &nHeight ) ;
+
+ DLM_SetBitMapWidth ( pdsHdr, (USHORT) nWidth ) ;
+ DLM_SetBitMapHeight( pdsHdr, (USHORT) nHeight ) ;
+
+ // Current checkbox is 12 wide.
+ // Current folders are 16 wide.
+
+
+ pdsHdr->cyTextHeight = mwcyDLMIconLabelsHeight ;
+
+ pdsHdr->cxTextWidth = (USHORT)(mwcxDLMIconLabelsWidth +
+ ( mwcxDLMIconLabelsMaxWidth -
+ mwcxDLMIconLabelsWidth )/2 );
+
+ // Offsets to place the objects Horizontally.
+
+ pdsHdr->cxBeforeCheckBox = 3 ; // Leave space before checkbox
+ pdsHdr->cxBeforeBitMap = 2 ; // Leave space before bitmap
+ pdsHdr->cxBeforeText = 6 ; // Leave space before text
+
+
+ pdsHdr->cxColWidth = 60 ; /* Calculated */
+
+
+ pdsHdr->cyColHeight = (USHORT)(mwcyDLMIconLabelsHeight+3 );
+
+ /* These used by hierarchical only */
+
+ pdsHdr->cxHierHorzLine = pdsHdr->cxBeforeCheckBox +
+ (USHORT)(pdsHdr->cxCheckBoxWidth +
+ pdsHdr->cxBeforeBitMap + pdsHdr->cxBitMapWidth/2);
+
+ pdsHdr->cxHierHorzLen = (USHORT)(pdsHdr->cyTextHeight - 4) ;
+
+ pdsHdr->cxHierTab = pdsHdr->cxHierHorzLine +
+ pdsHdr->cxHierHorzLen ;
+
+ // Offsets to place the objects vertically.
+
+ pdsHdr->cyBeforeCheckBox = 0 ; // wrong for now, but works.
+ // Problem with short, ushort, int
+ pdsHdr->cyBeforeBitMap = -1 ;
+ pdsHdr->cyBeforeText = 0 ;
+
+ // Offset the CheckBox and Bitmap accordingly.
+
+ // The minimum height of an item is 16 pixels.
+ // This is the initial font with mwcyDLMIconLabelsHeight(13) + 3.
+
+ if ( pdsHdr->cyColHeight < 16 ) {
+ pdsHdr->cyColHeight = 16 ;
+ }
+
+ // If height of item is larger than 16, offset objects vertically.
+
+ if ( pdsHdr->cyColHeight > 16 ) {
+ pdsHdr->cyBeforeCheckBox += ( (pdsHdr->cyColHeight-17)/2 + 1 ) ;
+ pdsHdr->cyBeforeBitMap += ( (pdsHdr->cyColHeight-17)/2 + 1 ) ;
+
+ }
+
+ break ;
+ }
+
+ // Reset the Horizontal Extent
+
+ pdsHdr->wHorizontalExtent = 0 ;
+}
+
+
+
+/****************************************************************************
+
+ Name: DLM_GetDispHdr
+
+ Description: This function will select the appropiate DLM_HEADER
+ area specified by the handle to the control .
+
+ Modified: 3/22/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_LIST_NOT_FOUND
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+DLM_HEADER_PTR DLM_GetDispHdr(
+
+HWND hWndCtl ) //I - Handle of a list box
+
+{
+
+ HWND hParentWnd ;
+ PDS_WMINFO pWinInfo ;
+ DLM_HEADER_PTR pdsHdr ;
+
+ // Check validity of window handle.
+
+ if ( !IsWindow( hWndCtl ) ) {
+ return ( NULL ) ;
+ }
+
+ hParentWnd = GetParent( hWndCtl ) ;
+
+ // Check validity of window handle.
+
+ if ( !IsWindow( hParentWnd ) ) {
+ return( NULL ) ;
+ }
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hParentWnd ) ;
+
+ pdsHdr = NULL ;
+
+ // Check to see which control box it is by comparing handles */
+
+ if ( !pWinInfo ) {
+ return ( pdsHdr ) ;
+ }
+
+ if ( pWinInfo->hWndTreeList == hWndCtl ) {
+
+ pdsHdr = pWinInfo->pTreeDisp ;
+
+ } else {
+ if ( pWinInfo->hWndFlatList == hWndCtl ) {
+
+ pdsHdr = pWinInfo->pFlatDisp ;
+ }
+ }
+
+ return( pdsHdr ) ;
+}
+
+
+
+/****************************************************************************
+
+ Name: DLM_GetObjectsBuffer
+
+ Description: This function returns the buffer reserved for
+ the list box specified. It will initialize the
+ buffer to zero.
+
+ Modified: 11/19/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_LIST_NOT_FOUND
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+PVOID DLM_GetObjectsBuffer(
+
+HWND hWndCtl ) //I - Handle of a list box
+
+{
+ DLM_HEADER_PTR pHdr ;
+
+ // Check validity of window handle.
+
+ if ( !IsWindow( hWndCtl ) ) {
+
+ // Since the hWndCtl is invalid, it is most likely the application
+ // is responding to a GetObjects call during the creation
+ // of a multi-column listbox. Use the special temporary buffer.
+
+ if ( mwpTempObjBuff ) {
+ return( mwpTempObjBuff ) ;
+ } else {
+ return( NULL ) ;
+ }
+ }
+
+ pHdr = DLM_GetDispHdr( hWndCtl ) ;
+
+ if ( pHdr ) {
+
+ return ( (PVOID) DLM_GGetObjBuffer( pHdr ) ) ;
+ }
+
+ return ( NULL ) ;
+
+}
+
+
+/****************************************************************************
+
+ Name: DLM_Init
+
+ Description: This function will initialize the display list for
+ the system.
+
+ Modified: 3/27/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_OUT_OF_MEMORY
+
+****************************************************************************/
+
+WORD DLM_Init(
+
+HWND hWnd ) //I - Handle to a Window
+
+{
+
+ BOOL fResult ;
+ INT nMaxWidth ;
+ INT nWidth ;
+ INT nHeight ;
+
+ if ( !mwfFontSizesSet ) {
+
+ fResult = RSM_GetFontSize( ghFontFiles,
+ &nMaxWidth,
+ &nWidth,
+ &nHeight ) ;
+
+ mwcxDLMFontFilesMaxWidth = (USHORT) nMaxWidth ;
+ mwcxDLMFontFilesWidth = (USHORT) nWidth ;
+ mwcyDLMFontFilesHeight = (USHORT) nHeight ;
+
+ {
+
+ HDC hDC ;
+ int temp ;
+ HFONT hOldFont;
+ WORD wHeight ;
+ WORD wWidth ;
+
+ hDC = GetDC( hWnd ) ;
+ hOldFont = (HFONT)SelectObject ( hDC, ghFontFiles );
+
+ temp = GetTextCharacterExtra ( hDC ) ;
+ {
+ SIZE size;
+ GetTextExtentPoint( hDC, TEXT("C:"), 2, &size ) ;
+ wWidth = (WORD)size.cx;
+ wHeight = (WORD)size.cy;
+ }
+
+ // Put back the old font.
+
+ SelectObject ( hDC, hOldFont );
+ ReleaseDC ( hWnd, hDC );
+
+ }
+
+ fResult = RSM_GetFontSize( ghFontIconLabels,
+ &nMaxWidth,
+ &nWidth,
+ &nHeight ) ;
+
+ mwcxDLMIconLabelsMaxWidth = (USHORT) nMaxWidth ;
+ mwcxDLMIconLabelsWidth = (USHORT) nWidth ;
+ mwcyDLMIconLabelsHeight = (USHORT) nHeight ;
+
+ fResult = RSM_GetFontSize( ghFontLog,
+ &nMaxWidth,
+ &nWidth,
+ &nHeight ) ;
+
+ mwcxDLMFontLogMaxWidth = (USHORT) nMaxWidth ;
+ mwcxDLMFontLogWidth = (USHORT) nWidth ;
+ mwcyDLMFontLogHeight = (USHORT) nHeight ;
+
+
+ mwfFontSizesSet = 1;
+
+ mwDLMInflate = -2 ;
+
+ // Allocate temporary object buffer used when any listbox
+ // is created with multi-columns specified.
+ // The WM_MeasureItem message needs to do a GetObjects
+ // during the creation of the window and and the application
+ // hasn't yet returned from the WM_Create call.
+
+ // Supports up to 10 objects and 159 levels deep.
+
+ mwpTempObjBuff = (CHAR_PTR)calloc( 1, 2 + 5*sizeof(DWORD) +
+ 10*(sizeof(DLM_ITEM)) );
+
+ }
+
+ return ( 0 ) ;
+}
+
+
+/****************************************************************************
+
+ Name: DLM_DispListTerm
+
+ Description: De-initializes the display list for a control window. This
+ function is called by the application when all references
+ to the display information are to be discarded and freed.
+
+ Modified: 2/07/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_TERMINATE_FAILED
+
+****************************************************************************/
+
+WORD DLM_DispListTerm(
+
+PVOID void_ptr, // I - Pointer to WinInfo of parent.
+HWND hWndCtl ) // I - Handle to a listbox.
+
+{
+ DLM_HEADER_PTR pHdr ;
+ WORD wStatus ;
+ PDS_WMINFO pWinInfo;
+
+ pWinInfo = (PDS_WMINFO)void_ptr;
+
+ wStatus = 0 ;
+
+ // Check to see which control box it is by comparing handles */
+
+ pHdr = NULL ;
+
+ if ( pWinInfo ) {
+
+ if ( pWinInfo->hWndTreeList == hWndCtl ) {
+
+ pHdr = pWinInfo->pTreeDisp ;
+ }
+
+ if ( pWinInfo->hWndFlatList == hWndCtl ) {
+
+ pHdr = pWinInfo->pFlatDisp ;
+ }
+ }
+
+ if( pHdr ) {
+
+ if ( DLM_GGetObjBuffer (pHdr) ) {
+ free( DLM_GGetObjBuffer (pHdr) ) ;
+ }
+
+ free( pHdr ) ;
+ } else {
+
+ return ( DLMERR_TERMINATE_FAILED ) ;
+ }
+
+
+ return( wStatus ) ;
+
+}
+
+/****************************************************************************
+
+ Name: DLM_WMDeleteItem
+
+ Description: Not Used any more. Called by DOCPROC.C
+
+ Modified: 2/07/1991
+
+ Returns: Always TRUE.
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+
+WORD DLM_WMDeleteItem(
+
+HWND hWnd , // I - Handle to a window
+LPDELETEITEMSTRUCT lParam ) // I - Additional Information
+
+{
+ DBG_UNREFERENCED_PARAMETER ( hWnd );
+ DBG_UNREFERENCED_PARAMETER ( lParam );
+
+ return TRUE;
+}
+
+
+/****************************************************************************
+
+ Name: DLM_WMMeasureItem()
+
+ Description: This function returns the height and width of an item
+ in a list box.
+
+ Modified: 2/15/1991
+
+ Returns: 0 if successful.
+
+
+****************************************************************************/
+
+
+WORD DLM_WMMeasureItem(
+
+HWND hWnd , // I - Handle of parent window of a listbox.
+LPMEASUREITEMSTRUCT lParam ) // I/O - Pointer to data structure to return
+ // measurement values to Windows 3.0.
+
+{
+ PDS_WMINFO pWinInfo ;
+ DLM_HEADER_PTR pdsHdr ;
+ WORD wCtlID ;
+ LPMEASUREITEMSTRUCT pMeasItem ;
+ GET_COUNT_PTR pfnGetItemCount ;
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ WORD wType ;
+
+ LMHANDLE pdsListHdr ;
+ LMHANDLE dhListItem = (LMHANDLE)0;
+ DLM_ITEM_PTR lpDispItem ;
+ BYTE_PTR lpObjLst ;
+ BOOL fSetZeroValues ;
+ USHORT usCnt ;
+ BYTE bObjCnt ;
+ short cxPos ;
+
+ pMeasItem = (LPMEASUREITEMSTRUCT) lParam ;
+
+ wCtlID = (WORD)pMeasItem->CtlID ;
+
+ if ( !IsWindow( hWnd ) ) {
+
+ // Set the width and height to 0 to indicate error.
+ // This should never happen.
+
+ pMeasItem->itemWidth = 0 ;
+ pMeasItem->itemHeight = 0 ;
+
+ return(0) ;
+ }
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+
+ msassert( pWinInfo != (VOID_PTR) NULL ) ;
+
+ switch ( wCtlID ) {
+
+ case WMIDC_TREELISTBOX :
+
+ pdsHdr = pWinInfo->pTreeDisp ;
+
+ if ( pdsHdr ) {
+
+ pMeasItem->itemWidth = pdsHdr->cxColWidth ;
+ pMeasItem->itemHeight = pdsHdr->cyColHeight ;
+
+ } else {
+
+ // Set the width and height to 0 to indicate error.
+ // This should never happen.
+
+ pMeasItem->itemWidth = 0 ;
+ pMeasItem->itemHeight = 0 ;
+
+ }
+
+ // Do not attempt to appropiately set the values for
+ // width and height because tree list boxes are
+ // immediately switched to single column listboxes.
+
+ break ;
+
+ case WMIDC_FLATLISTBOX :
+ default :
+
+ pdsHdr = pWinInfo->pFlatDisp ;
+ pdsListHdr = ( LMHANDLE ) WMDS_GetFlatList ( pWinInfo );
+
+ wType = WMDS_GetWinType( pWinInfo ) ;
+
+ /* The following steps are taken to set up the appropiate
+ ** width and height.
+ **
+ ** IF pdsHdr exists and pdsListHdr exists and count > 0
+ ** BEGIN
+ ** Get the first item on the queue.
+ ** IF item exists
+ ** BEGIN
+ ** . Get the objects of the item.
+ ** . Calculate the width and height based on the objects found.
+ ** END
+ ** END
+ ** ELSE
+ ** set width and height to defaults ;
+ */
+
+ pMeasItem->itemWidth = pdsHdr->cxColWidth ;
+ pMeasItem->itemHeight = pdsHdr->cyColHeight ;
+
+ fSetZeroValues = TRUE ;
+
+ // Some window type are never multi-column
+ // Just reset the global reference of window handle.
+
+ switch ( wType ) {
+
+ case WMTYPE_JOBS :
+ case WMTYPE_MACROS :
+ case WMTYPE_TAPES :
+ case WMTYPE_DEBUG :
+ case WMTYPE_LOGFILES :
+ case WMTYPE_SERVERS :
+ case WMTYPE_LOGVIEW :
+ case WMTYPE_SEARCH :
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE :
+#endif
+ pdsHdr = NULL ;
+ break ;
+ }
+
+ if ( pdsHdr ) {
+ pfnGetItemCount = (GET_COUNT_PTR) DLM_GGetItemCount( pdsHdr ) ;
+ pfnGetFirstItem = (GET_FIRST_PTR) DLM_GGetFirstItem( pdsHdr ) ;
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects ( pdsHdr ) ;
+
+ if ( pdsListHdr ) {
+ usCnt = (USHORT) ( (*pfnGetItemCount) (pdsListHdr) );
+ if ( usCnt ) {
+ dhListItem = (LMHANDLE) ( (*pfnGetFirstItem) (pdsListHdr) ) ;
+ if ( dhListItem ) {
+ lpObjLst = (BYTE_PTR) ( (*pfnGetObjects) (dhListItem) ) ;
+ lpDispItem = DLM_GetFirstObject( (BYTE_PTR)lpObjLst, &bObjCnt ) ;
+
+ // Calculate the width by spanning
+ // the object list, adding up the widths
+ // of the objects.
+
+ cxPos = 0 ;
+
+ while (bObjCnt) {
+
+ DLM_GetWidth ( hWnd, pdsHdr, &cxPos, lpDispItem ) ;
+
+ // Special Logic for long strings.
+ // If the string is greater than 5, then take off 33%.
+
+
+ if ( ( DLM_ItembType ( lpDispItem ) == DLM_TEXT_ONLY ) &&
+ ( DLM_GDisplay( pdsHdr ) == DLM_LARGEBITMAPSLTEXT ) ){
+
+ LONG lLen ;
+ lLen = strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) );
+
+ if ( lLen > 5 ) {
+ cxPos -= ( pdsHdr->cxBeforeText +
+ ( DLM_ItembMaxTextLen( lpDispItem )*( pdsHdr->cxTextWidth ) ) ) / 3 ;
+ }
+ }
+
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+ fSetZeroValues = TRUE ;
+
+ // Added left and right 2 pixel area for focus and add 5 for right margin
+
+ pMeasItem->itemWidth = (int) ( cxPos + 2*(-mwDLMInflate ) + 5 ) ;
+
+ pdsHdr->cxColWidth = (USHORT)pMeasItem->itemWidth ;
+ }
+
+ }
+ }
+ }
+
+ break ;
+
+ }
+
+ return ( TRUE ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/dlm_lbn.c b/private/utils/ntbackup/src/dlm_lbn.c
new file mode 100644
index 000000000..4701376d2
--- /dev/null
+++ b/private/utils/ntbackup/src/dlm_lbn.c
@@ -0,0 +1,843 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: DLM_LBN.C
+
+ Description: This file contains routines for display list manager.
+
+ The following routines are in this module:
+
+
+ DLM_LBNmessages
+ DLM_LBNflatmsgs
+ DLM_ProcessButton
+ DLM_GetFirstObject
+
+ $Log: G:/UI/LOGFILES/DLM_LBN.C_V $
+
+ Rev 1.20 15 Jun 1993 10:57:08 MIKEP
+enable c++
+
+ Rev 1.19 14 Jun 1993 20:20:10 MIKEP
+enable c++
+
+ Rev 1.18 25 Feb 1993 13:24:56 STEVEN
+fixes from mikep and MSOFT
+
+ Rev 1.17 21 Dec 1992 12:25:18 DAVEV
+Enabled for Unicode - IT WORKS!!
+
+ Rev 1.16 07 Oct 1992 13:46:52 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.15 04 Oct 1992 19:33:04 DAVEV
+Unicode Awk pass
+
+ Rev 1.14 09 Sep 1992 16:13:34 GLENN
+Updated castings for MikeP (NT).
+
+ Rev 1.13 08 Sep 1992 11:48:58 ROBG
+Changed cxPos, cyPos from USHORT to short.
+
+ Rev 1.12 10 Jun 1992 10:57:24 STEVEN
+NULL would not compile for mips
+
+ Rev 1.11 15 May 1992 13:32:22 MIKEP
+nt pass 2
+
+ Rev 1.10 20 Mar 1992 17:22:32 GLENN
+Fixed VK_RETURN to work on key down instead of key up.
+
+ Rev 1.9 17 Mar 1992 18:27:46 GLENN
+Removed unnecessary invalidate rects.
+
+ Rev 1.8 09 Mar 1992 10:48:56 GLENN
+Added VK_RETURN checking for keyboard processing.
+
+ Rev 1.7 03 Mar 1992 18:22:02 GLENN
+Put in error handling.
+
+ Rev 1.6 11 Feb 1992 12:19:36 DAVEV
+steve is brain-dead fix bug in NT_KLUG
+
+ Rev 1.5 04 Feb 1992 16:07:26 STEVEN
+various bug fixes for NT
+
+ Rev 1.4 15 Jan 1992 15:16:36 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.3 26 Dec 1991 17:22:10 ROBG
+New and Improved.
+
+ Rev 1.2 03 Dec 1991 13:21:20 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+ Rev 1.1 26 Nov 1991 13:21:28 ROBG
+Added validity checks for the window handle, info structure, and the
+dlm display header.
+
+ Rev 1.0 20 Nov 1991 19:18:10 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/****************************************************************************
+
+ Name: DLM_LBNmessages
+
+ Description: This function will process a mouse button.
+
+ Modified: 2/15/1991
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+****************************************************************************/
+
+
+WORD DLM_LBNmessages(
+
+ HWND hWnd, // I - Handle of parent window of a listbox.
+ MP1 mp1, // I - Additional information
+ MP2 mp2 ) // I - Additional information
+
+{
+ RECT rectItem ;
+ RECT rectTest ;
+ LMHANDLE pListItem ;
+ WORD wCurSel, wTopSel ;
+ LRESULT Error;
+ DLM_HEADER_PTR pHdr ;
+ PDS_WMINFO pWinInfo ;
+ short cxPos, cyPos ;
+ DLM_ITEM_PTR lpDispItem ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ BYTE bObjCnt ;
+ BYTE_PTR lpObjLst ;
+ POINT pt ;
+ WORD wLbnValue ;
+ BYTE fButtonProcessed = FALSE ;
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+ WORD wCmd = GET_WM_COMMAND_CMD ( mp1, mp2 );
+ HWND hwndLB = GET_WM_COMMAND_HWND ( mp1, mp2 );
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return FAILURE;
+ }
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+
+ // Extra Bytes for window must be defined.
+
+ if ( !pWinInfo ) {
+ return FAILURE;
+ }
+
+ switch (wId) {
+
+ case WMIDC_TREELISTBOX :
+
+ pHdr = pWinInfo->pTreeDisp ;
+ break ;
+
+ case WMIDC_FLATLISTBOX :
+ default :
+
+ pHdr = pWinInfo->pFlatDisp ;
+ break ;
+ }
+
+ // DLM display header must be defined.
+
+ if ( !pHdr ) {
+ return FAILURE;
+ }
+
+ if ( ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) &&
+ ( DLM_GDisplay( pHdr ) == DLM_SMALL_BITMAPS ) ) {
+
+ /* Hierarchical, small bitmaps, large text */
+
+ switch ( wCmd ) {
+
+ case LBN_SELCHANGE :
+ case LBN_DBLCLK :
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+ pHdr = (WM_GetInfoPtr( hWnd ))->pTreeDisp ;
+
+ /* Look at gDLMpt for current mouse position */
+
+ wCurSel = (WORD) SendMessage (hwndLB,
+ LB_GETCURSEL, 0L, 0L ) ;
+
+ Error = SendMessage (hwndLB, LB_GETITEMRECT, wCurSel,
+ (LONG) ( LPRECT ) &rectItem ) ;
+
+# ifdef NTKLUG
+ Error = SendMessage (hwndLB, WM_DLMGETTEXT, wCurSel,
+ (LONG) &pListItem ) ;
+# else
+ Error = SendMessage (hwndLB, LB_GETTEXT, wCurSel,
+ (LONG) &pListItem ) ;
+# endif
+
+
+ // ERROR CHECKING
+
+ if ( Error == LB_ERR ) {
+ return FAILURE;
+ }
+
+
+ wTopSel = (WORD) SendMessage (hwndLB, LB_GETTOPINDEX, 0,
+ (LONG) 0L ) ;
+
+
+ /* Origin of control */
+
+ /* It is known that x,y is in the rectangle */
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr ) ;
+
+ lpObjLst = (BYTE_PTR) ( (*pfnGetObjects) (pListItem) ) ;
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ cxPos = (short) rectItem.left ;
+ cyPos = (short) rectItem.top ;
+
+ cxPos += ( ( DLM_ItembLevel( lpDispItem ) )* pHdr->cxHierTab ) ;
+
+ pt = gDLMpt ;
+ pt.x = gDLMpt.x + pHdr->xOrigin ;
+
+
+ while (bObjCnt) {
+
+ DLM_GetRect( pWinInfo->hWndTreeList, pHdr, (LPSHORT)&cxPos, cyPos, &rectTest, lpDispItem ) ;
+
+ if ( pHdr->fKeyDown == TRUE ) { /* When a key down occurs, wait until */
+ /* a key up sequence is encountered. */
+ if ( pHdr->fKeyUp == TRUE ) {
+
+ /* Initiated by key stroke. Signal last object in string */
+
+ pHdr->cLastTreeSelect = wCurSel ;
+
+ lpDispItem += bObjCnt-1 ;
+
+
+// if ( pHdr->wKeyValue == VK_RETURN ) {
+// wLbnValue = LBN_DBLCLK ;
+// } else {
+// wLbnValue = LBN_SELCHANGE ;
+// }
+
+ wLbnValue = wCmd ;
+
+ DLM_ProcessButton ( pWinInfo->hWndTreeList,
+ pHdr,
+ wLbnValue,
+ &rectTest,
+ wCurSel,
+ pListItem,
+ lpDispItem
+ ) ;
+
+ fButtonProcessed = TRUE ;
+
+ }
+
+ break ;
+ }
+
+ if ( PtInRect ( &rectTest, pt ) ) {
+ pHdr->cLastTreeSelect = wCurSel ;
+
+ DLM_ProcessButton( pWinInfo->hWndTreeList, pHdr, wCmd, &rectTest,
+ wCurSel, pListItem, lpDispItem ) ;
+ fButtonProcessed = TRUE ;
+
+ break ;
+ }
+
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+ /* The following section of logic has been added to handle the case
+ when the user drags the mouse when making a selection and
+ does not release the button over an object.
+
+ Under normal conditions the processing of button would be
+ ignored. In this case, however, the application needs to
+ know that a new selection in the list has been selected.
+
+ If a LBN_SELCHANGE ( single click ) message occurs
+ If the button has not been processed and
+ the item selected was initiated by the mouse and
+ the listbox's current selection has changed
+ then process button for last object.
+
+
+ Note: When a user double-clicks in the hierarchical listbox,
+ a LBN_SELCHANGE message is sent before a LBN_DBLCLK.
+ However, since the current selection has not changed
+ ( pHdr->cLastTreeSelect = wCurSel ), the button
+ is not processed.
+ */
+
+
+ if ( ( wCmd == LBN_SELCHANGE ) &&
+ ( fButtonProcessed == FALSE ) &&
+ ( pHdr->fKeyDown == FALSE ) &&
+ ( pHdr->cLastTreeSelect != wCurSel ) ) {
+
+ lpDispItem -- ;
+
+ pHdr->cLastTreeSelect = wCurSel ;
+
+ DLM_ProcessButton( pWinInfo->hWndTreeList, pHdr, wCmd, &rectTest,
+ wCurSel, pListItem, lpDispItem ) ;
+ }
+
+
+ return SUCCESS;
+ break ;
+
+ case LBN_SETFOCUS :
+
+ pHdr->fFocus = TRUE ;
+
+// InvalidateRect( hwndLB , NULL, FALSE ) ;
+
+ break ;
+
+ case LBN_KILLFOCUS :
+
+ pHdr->fFocus = FALSE ;
+
+// InvalidateRect( hwndLB , NULL, FALSE ) ;
+
+ break ;
+ }
+
+ } else {
+
+ return( (WORD) DLM_LBNflatmsgs( hWnd, mp1, mp2 ) ) ;
+ }
+
+ return SUCCESS;
+}
+
+/****************************************************************************
+
+ Name: DLM_LBNflatmsgs
+
+ Description: This function will process button operations on a
+ listbox with a flat list type.
+ in the list.
+
+ Modified: 2/15/1991
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+****************************************************************************/
+
+
+WORD DLM_LBNflatmsgs(
+
+ HWND hWnd , // I - Handle of parent window of a listbox.
+ MP1 mp1 , // I - Additional information
+ MP2 mp2 ) // I - Additional information
+
+{
+
+ RECT rectItem ;
+ RECT rectTest ;
+ LMHANDLE pListItem ;
+ WORD wCurSel;
+ LRESULT Error;
+ DLM_HEADER_PTR pHdr ;
+ PDS_WMINFO pWinInfo ;
+ short cxPos, cyPos ;
+ DLM_ITEM_PTR lpDispItem ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ BYTE bObjCnt ;
+ LPBYTE lpObjLst ;
+ POINT pt ;
+ WORD wLbnValue ;
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+ WORD wCmd = GET_WM_COMMAND_CMD ( mp1, mp2 );
+ HWND hwndLB = GET_WM_COMMAND_HWND ( mp1, mp2 );
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return FAILURE;
+ }
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+
+ // Extra Bytes for window must be defined.
+
+ if ( !pWinInfo ) {
+ return FAILURE;
+ }
+
+ switch (wId ) {
+
+ case WMIDC_TREELISTBOX :
+
+ pHdr = pWinInfo->pTreeDisp ;
+ break ;
+
+ case WMIDC_FLATLISTBOX :
+ default :
+
+ pHdr = pWinInfo->pFlatDisp ;
+ break ;
+ }
+
+ // DLM display header must be defined.
+
+ if ( !pHdr ) {
+ return FAILURE;
+ }
+
+ switch ( DLM_GDisplay( pHdr ) ) {
+
+ case DLM_LARGEBITMAPSLTEXT :
+
+ switch ( wCmd ) {
+
+ case LBN_SELCHANGE :
+ case LBN_DBLCLK :
+
+ /* Look at gDLMpt for current mouse position */
+
+ wCurSel = (WORD) SendMessage (hwndLB,
+ LB_GETCURSEL, 0L, 0L ) ;
+
+ Error = SendMessage (hwndLB, LB_GETITEMRECT, wCurSel,
+ (LONG) ( LPRECT ) &rectItem ) ;
+
+# ifdef NTKLUG
+ Error = SendMessage (hwndLB, WM_DLMGETTEXT, wCurSel,
+ (LONG) &pListItem ) ;
+# else
+ Error = SendMessage (hwndLB, LB_GETTEXT, wCurSel,
+ (LONG) &pListItem ) ;
+# endif
+
+ // ERROR CHECKING
+
+ if ( Error == LB_ERR ) {
+ return FAILURE;
+ }
+
+
+ // Ignore messages when the user initiates a double click and
+ // the mouse is not in the current selection rectangle.
+
+ pt = gDLMpt ;
+ pt.x = gDLMpt.x + pHdr->xOrigin ;
+
+ if ( pHdr->fKeyDown == FALSE ) {
+
+ if ( !PtInRect ( &rectItem, pt ) ) {
+ return SUCCESS;
+ }
+
+ }
+
+ /* Origin of control */
+
+ /* It is known that x,y is in the rectangle */
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr ) ;
+
+ lpObjLst = (BYTE_PTR) ( (*pfnGetObjects) (pListItem) ) ;
+ bObjCnt = *lpObjLst ;
+ lpDispItem = (DLM_ITEM_PTR) ( lpObjLst + 2 + sizeof( DWORD ) );
+
+ cxPos = (WORD) rectItem.left ;
+ cyPos = (WORD) rectItem.top ;
+
+ while (bObjCnt) {
+
+ DLM_GetRect( pWinInfo->hWndFlatList, pHdr, (LPSHORT)&cxPos, cyPos, &rectTest, lpDispItem ) ;
+
+ if ( pHdr->fKeyDown == TRUE ) {
+
+ /* Initiated by key stroke. Signal last object in string */
+
+ lpDispItem += bObjCnt-1 ;
+
+// if ( pHdr->fKeyUp == TRUE && pHdr->wKeyValue == VK_RETURN ) {
+// wLbnValue = LBN_DBLCLK ;
+// } else {
+// wLbnValue = LBN_SELCHANGE ;
+// }
+
+ wLbnValue = wCmd ;
+
+ DLM_ProcessButton ( pWinInfo->hWndFlatList,
+ pHdr,
+ wLbnValue,
+ &rectTest,
+ wCurSel,
+ pListItem,
+ lpDispItem
+ ) ;
+ break ;
+
+ }
+
+
+ if ( !( ( DLM_ItemwId ( lpDispItem ) == 0 ) && /* Skip if checkbox is ignored */
+ ( DLM_ItembType( lpDispItem ) == DLM_CHECKBOX ) ) ) {
+
+ if ( PtInRect ( &rectTest, pt ) ) {
+ DLM_ProcessButton( pWinInfo->hWndFlatList, pHdr, wCmd, &rectTest,
+ wCurSel, pListItem, lpDispItem ) ;
+ break ;
+ }
+ }
+
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+ return SUCCESS;
+ break ;
+
+
+ case LBN_SETFOCUS :
+ pHdr->fFocus = TRUE ;
+
+ break ;
+
+ case LBN_KILLFOCUS :
+ pHdr->fFocus = FALSE ;
+
+ break ;
+
+ }
+
+
+ break ;
+
+
+ case DLM_SMALL_BITMAPS :
+
+ switch ( wCmd ) {
+
+ case LBN_SELCHANGE :
+ case LBN_DBLCLK :
+
+ /* Look at gDLMpt for current mouse position */
+
+ wCurSel = (WORD) SendMessage (hwndLB,
+ LB_GETCURSEL, 0L, 0L ) ;
+
+ Error = SendMessage (hwndLB, LB_GETITEMRECT, wCurSel,
+ (LONG) ( LPRECT ) &rectItem ) ;
+
+# ifdef NTKLUG
+ Error = SendMessage (hwndLB, WM_DLMGETTEXT, wCurSel,
+ (LONG) &pListItem ) ;
+# else
+ Error = SendMessage (hwndLB, LB_GETTEXT, wCurSel,
+ (LONG) &pListItem ) ;
+# endif
+
+ // ERROR CHECKING
+
+ if ( Error == LB_ERR ) {
+ return FAILURE;
+ }
+
+
+ // Ignore messages when the user initiates a double click and
+ // the mouse is not in the current selection rectangle.
+
+ pt = gDLMpt ;
+ pt.x = gDLMpt.x + pHdr->xOrigin ;
+
+ if ( pHdr->fKeyDown == FALSE ) {
+
+ if ( !PtInRect ( &rectItem, pt ) ) {
+ return SUCCESS;
+ }
+ }
+
+ /* Origin of control */
+
+ /* It is known that x,y is in the rectangle */
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr ) ;
+
+ lpObjLst = (BYTE_PTR) ( (*pfnGetObjects) (pListItem) ) ;
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ cxPos = (short) rectItem.left ;
+ cyPos = (short) rectItem.top ;
+
+ while (bObjCnt) {
+
+ DLM_GetRect( pWinInfo->hWndFlatList, pHdr, (LPSHORT)&cxPos, cyPos, &rectTest, lpDispItem ) ;
+
+ if ( pHdr->fKeyDown == TRUE ) {
+
+ /* Initiated by key stroke. Signal last object in string */
+
+ lpDispItem += bObjCnt-1 ;
+
+// if ( pHdr->fKeyUp == TRUE && pHdr->wKeyValue == VK_RETURN ) {
+// wLbnValue = LBN_DBLCLK ;
+// } else {
+// wLbnValue = LBN_SELCHANGE ;
+// }
+
+ wLbnValue = wCmd ;
+
+ DLM_ProcessButton( pWinInfo->hWndFlatList,
+ pHdr,
+ wLbnValue,
+ &rectTest,
+ wCurSel,
+ pListItem,
+ lpDispItem
+ ) ;
+ break ;
+ }
+
+ if ( PtInRect ( &rectTest, pt ) ) {
+ DLM_ProcessButton( pWinInfo->hWndFlatList, pHdr, wCmd, &rectTest,
+ wCurSel, pListItem, lpDispItem ) ;
+ break ;
+ }
+
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+ return SUCCESS;
+ break ;
+
+ case LBN_SETFOCUS :
+
+ pHdr->fFocus = TRUE ;
+
+ break ;
+
+ case LBN_KILLFOCUS :
+
+ pHdr->fFocus = FALSE ;
+
+ break ;
+
+ }
+ }
+
+ return TRUE ;
+}
+
+
+/****************************************************************************
+
+ Name: DLM_ProcessButton
+
+ Description: This function will process a mouse action.
+ in the list.
+
+ Modified: 2/15/1991
+
+ Returns: Always 0.
+
+****************************************************************************/
+
+WORD DLM_ProcessButton(
+
+HWND hWnd , // I - Handle of listbox.
+DLM_HEADER_PTR pHdr , // I - Pointer to DLM header of listbox.
+WORD msg , // I - Windows Message
+LPRECT lpRect , // I - Pointer to rectangle on screen.
+USHORT wCurSel , // I - Listbox's current selection.
+LMHANDLE pListItem , // I - Pointer to the item.
+DLM_ITEM_PTR lpDispItem ) // I - Information on how to display item.
+
+{
+ BYTE fSelect ;
+ RECT rect ;
+ WORD wStatus ;
+
+ GET_SELECT_PTR pfnGetSelect ;
+ SET_SELECT_PTR pfnSetSelect ;
+ SET_OBJECTS_PTR pfnSetObjects ;
+
+ DBG_UNREFERENCED_PARAMETER ( wCurSel );
+
+ wStatus = 0 ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return SUCCESS;
+ }
+
+ // DLM display header must be defined.
+
+ if ( !pHdr ) {
+ return SUCCESS;
+ }
+
+
+ switch( msg ) {
+
+ case LBN_SELCHANGE:
+
+ switch ( DLM_ItembType( lpDispItem) ) {
+
+ case DLM_CHECKBOX:
+
+ /* Toggle the select status by:
+
+ Reset the select status of item.
+ Invalidate the item's region on screen.
+ */
+
+ pfnGetSelect = DLM_GGetSelect( pHdr ) ;
+
+ fSelect = (BYTE) ( (*pfnGetSelect) (pListItem ) ) ;
+ if (fSelect) fSelect = 0 ;
+ else fSelect = 1 ;
+
+ pfnSetSelect = DLM_GSetSelect( pHdr ) ;
+ wStatus = (WORD) ( (*pfnSetSelect) (pListItem, fSelect ) ) ;
+
+ memcpy( &rect, lpRect, sizeof ( RECT ) ) ;
+
+ rect.left -= pHdr->xOrigin ;
+
+ InvalidateRect ( hWnd, &rect, FALSE ) ;
+
+ wStatus = 1 ;
+
+ break ;
+
+ case DLM_BITMAP:
+ case DLM_TEXT_ONLY:
+ default:
+ wStatus = 1 ;
+ break ;
+ }
+
+ if (wStatus) {
+ pfnSetObjects = DLM_GSetObjects( pHdr ) ;
+
+ (*pfnSetObjects) (pListItem, (WORD) WM_DLMDOWN,
+ (BYTE) lpDispItem->cbNum ) ;
+ }
+
+ break ;
+
+
+ case LBN_DBLCLK :
+
+
+ switch ( DLM_ItembType( lpDispItem) ) {
+
+ case DLM_CHECKBOX:
+
+ break ;
+
+
+ case DLM_BITMAP :
+ case DLM_TEXT_ONLY :
+ default :
+
+ pfnSetObjects = DLM_GSetObjects( pHdr ) ;
+
+ (*pfnSetObjects) (pListItem, (WORD) WM_DLMDBCLK,
+ (BYTE) lpDispItem->cbNum ) ;
+
+ break ;
+ }
+
+
+ }
+
+ return SUCCESS;
+}
+
+
+
+/******************************************************************************
+
+ Name: DLM_GetFirstObject
+
+ Description: This function will return the address of the first object
+ associated with an item in a list box.
+ in the list.
+
+ Modified: 12/16/1991
+
+ Notes: The user provides an array of objects in the following
+ format:
+
+ Number of objects: 1 byte.
+ Number of DWORDs to
+ describe level detail 1 byte.
+ DWORDS .......
+ Object definition # 1 .......
+ Object definition # 2 .......
+ .......
+ Object definition # n .......
+
+
+
+
+ Returns: Pointer to Object definition #1.
+
+****************************************************************************/
+
+
+DLM_ITEM_PTR DLM_GetFirstObject(
+
+LPBYTE lpObjLst , // Pointer to array
+LPBYTE bpObjCnt ) // Pointer to object counter.
+
+{
+ BYTE bNumDwords ;
+ DLM_ITEM_PTR lpDispItem ;
+
+ // Set the Count of objects.
+
+ *bpObjCnt = *lpObjLst ;
+
+ bNumDwords = *(lpObjLst+1) ;
+
+ // The number of DWORDS must never be 0. It is an error if so.
+
+ if ( bNumDwords == 0 ) {
+ bNumDwords++ ;
+ }
+
+ if ( bNumDwords == 2 ) {
+ bNumDwords++ ;
+ bNumDwords-- ;
+ }
+
+ lpDispItem = (DLM_ITEM_PTR) ( lpObjLst + 2 + (bNumDwords) * sizeof( DWORD ) );
+
+ return( lpDispItem ) ;
+}
diff --git a/private/utils/ntbackup/src/dlm_proc.c b/private/utils/ntbackup/src/dlm_proc.c
new file mode 100644
index 000000000..fc895f21e
--- /dev/null
+++ b/private/utils/ntbackup/src/dlm_proc.c
@@ -0,0 +1,969 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: wmupdate.c
+
+ Description: This file contains routines for display list manager.
+
+ The following routines are in this module:
+
+
+ DLM_DispListModeSet
+ DLM_DispListModeGet
+ DLM_DispListProc
+ DLM_WMTrackPoint
+ DLM_CursorInCheckBox
+ DLM_SetHorizontalExt
+
+ $Log: G:/UI/LOGFILES/DLM_PROC.C_V $
+
+ Rev 1.28 25 Oct 1993 10:54:38 GLENN
+Changed calloc casting - LPWORD to LPINT.
+
+ Rev 1.27 20 Aug 1993 08:56:10 GLENN
+Fixed multi to single column selection restoring problem for NT.
+
+ Rev 1.26 02 Aug 1993 15:07:42 GLENN
+Putting old items into new list box only if there were any.
+
+ Rev 1.25 13 Jul 1993 11:06:54 MIKEP
+fix item count on init.
+
+ Rev 1.24 15 Jun 1993 10:56:10 MIKEP
+enable c++
+
+ Rev 1.23 14 Jun 1993 20:19:22 MIKEP
+enable c++
+
+ Rev 1.22 25 Feb 1993 13:24:46 STEVEN
+fixes from mikep and MSOFT
+
+ Rev 1.21 11 Dec 1992 18:25:00 GLENN
+Added selection frame rectangle support based on horizontal extent of a list box.
+
+ Rev 1.20 07 Oct 1992 13:47:10 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.19 04 Oct 1992 19:33:08 DAVEV
+Unicode Awk pass
+
+ Rev 1.18 09 Sep 1992 16:13:26 GLENN
+Updated castings for MikeP (NT).
+
+ Rev 1.17 08 Sep 1992 11:52:28 ROBG
+Changed cxPos, cyPos from USHORT to short.
+
+ Rev 1.16 29 Jul 1992 14:14:00 GLENN
+ChuckB checked in after NT fixes.
+
+ Rev 1.15 10 Jun 1992 11:02:16 STEVEN
+NULL would not compile for mips
+
+ Rev 1.14 15 May 1992 13:32:44 MIKEP
+nt pass 2
+
+ Rev 1.13 20 Mar 1992 09:30:34 ROBG
+Added logic in DLM_SetHorizontalExtent to set maximum extent value in
+DLM header area.
+
+ Rev 1.12 19 Mar 1992 09:21:32 ROBG
+Added DLM_SetHorizontalExt to set Horz scroll bar
+
+ Rev 1.11 03 Mar 1992 18:21:16 GLENN
+Put in error handling.
+
+ Rev 1.10 07 Feb 1992 16:09:36 STEVEN
+fix casting of errors from sendmessage to WORD
+
+ Rev 1.9 06 Feb 1992 12:53:16 STEVEN
+fix typo in NT ifdef"
+
+ Rev 1.8 04 Feb 1992 16:07:36 STEVEN
+various bug fixes for NT
+
+ Rev 1.7 15 Jan 1992 15:16:10 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.6 26 Dec 1991 17:21:04 ROBG
+New and Improved.
+
+ Rev 1.5 10 Dec 1991 12:58:24 GLENN
+Added window manager macros. msasserts(). Fixed DLM_DispListModeSet() to
+set the active window on creation of new window and eliminated unnecessary
+check for a non-null application pointer.
+
+ Rev 1.4 03 Dec 1991 13:21:50 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.3 02 Dec 1991 11:09:14 ROBG
+Modified error returns in DLM_CursorInCheckBox to be 0 for FALSE.
+
+ Rev 1.2 26 Nov 1991 17:36:48 ROBG
+Fixed problem with cursor in checkbox.
+
+ Rev 1.1 26 Nov 1991 15:56:08 ROBG
+Added validity checks for the window handle, info structure, and the
+dlm display header.
+
+ Rev 1.0 20 Nov 1991 19:25:36 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/****************************************************************************
+
+ Name: DLM_DispListProc
+
+ Description: This function activates the display list manager working
+ on a window.
+
+ Modified: 2/07/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_PROCESS_FAILED
+
+ Notes:
+
+****************************************************************************/
+
+WORD DLM_DispListProc(
+HWND hWndLB , // I - Handle of listbox.
+WORD iAnchorIndex , // I - Integer index to identify anchor.
+LMHANDLE dhAnchorAddr ) // I - Address of item that is to be the anchor.
+
+{
+ DLM_HEADER_PTR pHdr ;
+ LMHANDLE pdsListHdr ;
+ PDS_WMINFO pWinInfo ;
+
+ USHORT usCnt ;
+ LMHANDLE pListItem = (LMHANDLE)0;
+
+ GET_COUNT_PTR pfnGetItemCount ;
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_NEXT_PTR pfnGetNext ;
+
+ DWORD dwStatus ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndLB ) ) {
+ return( 0 ) ;
+ }
+
+ pHdr = DLM_GetDispHdr( hWndLB ) ;
+
+ // DLM display header must be defined.
+
+ msassert ( pHdr != (VOID_PTR)NULL );
+
+ if ( DLM_GMode( pHdr ) == DLM_MULTICOLUMN ) {
+
+ dwStatus = SendMessage (hWndLB, LB_SETCOLUMNWIDTH, pHdr->cxColWidth, 0L ) ;
+ }
+
+ pWinInfo = WM_GetInfoPtr( GetParent( hWndLB ) ) ;
+
+ // Extra Bytes for window must be defined.
+
+ msassert ( pWinInfo != (VOID_PTR)NULL );
+
+ switch ( DLM_GMode( pHdr ) ) {
+
+ case DLM_HIERARCHICAL :
+ pdsListHdr = ( LMHANDLE ) WMDS_GetTreeList ( pWinInfo );
+ break ;
+
+ default :
+
+ pdsListHdr = ( LMHANDLE ) WMDS_GetFlatList ( pWinInfo );
+ break ;
+ }
+
+ pfnGetItemCount = (GET_COUNT_PTR) DLM_GGetItemCount( pHdr ) ;
+ pfnGetFirstItem = (GET_FIRST_PTR) DLM_GGetFirstItem( pHdr ) ;
+ pfnGetNext = (GET_NEXT_PTR) DLM_GGetNext ( pHdr ) ;
+
+ usCnt = (USHORT) ( (*pfnGetItemCount) (pdsListHdr) );
+
+ pHdr->usItemCount = usCnt ; // update item count.
+
+ if ( usCnt ) {
+ pListItem = (LMHANDLE) ( (*pfnGetFirstItem) (pdsListHdr) ) ;
+ }
+
+ dwStatus = SendMessage ( hWndLB, WM_SETREDRAW, FALSE, 0L ) ;
+
+ DLM_SetHorizontalExt( hWndLB, pHdr, pListItem ) ;
+
+ while ( pListItem && ( usCnt > 0 ) ) {
+
+ dwStatus = SendMessage( hWndLB, LB_ADDSTRING, 0, (LONG) pListItem ) ;
+
+ if ( !dwStatus ) {
+ dwStatus = 0 ;
+ }
+
+ pListItem = (LMHANDLE) ( (*pfnGetNext) (pListItem) ) ;
+ usCnt--;
+ }
+
+ dwStatus = SendMessage ( hWndLB, WM_SETREDRAW, TRUE, 0L ) ;
+
+ InvalidateRect ( hWndLB, NULL, TRUE ) ;
+
+ UpdateWindow ( hWndLB ) ;
+ SetFocus ( hWndLB ) ;
+ DLM_SetAnchor( hWndLB, iAnchorIndex, dhAnchorAddr ) ;
+ SendMessage( hWndLB, LB_SETTOPINDEX, 0, 0L ) ;
+
+ return( 0 ) ;
+}
+
+/****************************************************************************
+
+ Name: DLM_SetHorizontalExt
+
+ Description: This function gets the horizontal extent for
+ a single column listbox with items, based on
+ the first item.
+
+ Modified: 3/18/1992
+
+ Returns: VOID
+
+****************************************************************************/
+
+VOID DLM_SetHorizontalExt(
+
+HWND hWndCtl , // I - Handle of listbox.
+DLM_HEADER_PTR pHdr , // I - Pointer to DLM header.
+PVOID pListItem ) // I - Address of item.
+
+{
+ // If there is no window handle, header or list item, bug out.
+
+ if ( ! hWndCtl || ! pHdr || ! pListItem ) {
+ return;
+ }
+
+ if ( DLM_GMode( pHdr ) == DLM_SINGLECOLUMN ) {
+
+ BYTE_PTR lpObjLst ;
+ DLM_ITEM_PTR lpDispItem ;
+ BYTE bObjCnt ;
+ short cxPos ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ INT iStatus ;
+
+ pfnGetObjects = DLM_GGetObjects ( pHdr ) ;
+ lpObjLst = (BYTE_PTR) ( (*pfnGetObjects) ( (LMHANDLE) pListItem ) ) ;
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ // Calculate the width by spanning
+ // the object list, adding up the widths
+ // of the objects.
+
+ cxPos = 0 ;
+
+ while ( bObjCnt ) {
+
+ DLM_GetWidth ( hWndCtl, pHdr, (LPSHORT)&cxPos, lpDispItem ) ;
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+ // Added left and right 2 pixel area for focus and add 5 for right margin
+
+ if ( cxPos > (short) pHdr->wHorizontalExtent ) {
+
+ pHdr->wHorizontalExtent = cxPos ;
+ iStatus = (INT) SendMessage( hWndCtl, LB_SETHORIZONTALEXTENT, cxPos+4+5, 0L ) ;
+ }
+ }
+ else {
+
+ pHdr->wHorizontalExtent = pHdr->cxColWidth;
+ }
+
+}
+
+
+/****************************************************************************
+
+ Name: DLM_DispListModeGet
+
+ Description: This function gets the mode that the display list is in.
+
+ Modified: 2/07/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_LIST_NOT_FOUND
+
+ Notes:
+
+ See also: DLM_DispListModeSet()
+
+****************************************************************************/
+
+WORD DLM_DispListModeGet(
+
+HWND hWnd , // I - Handle of parent window of listbox.
+BYTE bType , // I - Type of list ( Tree or Flat ).
+LPBYTE lpbMode ) // I - Mode of list.
+
+{
+ WORD wStatus ;
+ DLM_HEADER_PTR pHdr ;
+ PDS_WMINFO pWinInfo ;
+
+ wStatus = 0 ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return( DLMERR_LIST_NOT_FOUND ) ;
+ }
+
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+
+ // Extra Bytes for window must be defined.
+
+ msassert ( pWinInfo != (VOID_PTR)NULL );
+
+ switch ( bType ) {
+
+ case DLM_TREELISTBOX :
+
+ pHdr = WMDS_GetTreeDisp ( pWinInfo );
+ break ;
+
+ case DLM_FLATLISTBOX :
+ default :
+
+ pHdr = WMDS_GetFlatDisp ( pWinInfo );
+ break ;
+
+ }
+
+ if ( pHdr ) {
+ *lpbMode = DLM_GMode( pHdr ) ;
+ } else {
+ wStatus = DLMERR_LIST_NOT_FOUND ;
+ }
+
+ return( wStatus ) ;
+
+}
+
+
+
+/****************************************************************************
+
+ Name: DLM_DispListModeSet
+
+ Description: This function sets the mode that the display list is in.
+
+ Modes can be one of the following:
+
+ DLM_SINGLECOLUMN
+ DLM_MULTICOLUMN
+ DLM_HIERARCHICAL
+
+
+ Modified: 2/07/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_LIST_NOT_FOUND
+
+ Notes:
+ This function only supports DLM_SMALL_BITMAPS displays.
+
+ If the new mode is DLM_SINGLECOLUMN and the existing
+ mode is DLM_MULTICOLUMN, then
+ the listbox is switched to a single column list box.
+
+ If the new mode is DLM_MULTICOLUMN and
+ the existing mode is DLM_SINGLECOLUMN, then
+ the listbox is switched to a multicolumn list box.
+
+ if the old mode or new mode is DLM_HIERARCHICAL, nothing
+ is done.
+
+
+
+ See also:
+
+****************************************************************************/
+
+WORD DLM_DispListModeSet(
+
+HWND hWnd , // I - Handle of parent window of listbox.
+BYTE bType , // I - Type of list ( Tree or Flat ).
+BYTE bMode ) // I - Mode of list.
+
+{
+
+ WORD wStatus ;
+ INT i ;
+ RECT ChildRect ;
+ INT nSelCnt ;
+ WORD wTopIndex ;
+ LPINT pnSelArray ;
+ DLM_HEADER_PTR pHdr ;
+ BYTE fMultiCol ;
+ BYTE fTreeList ;
+ PDS_WMINFO pWinInfo ;
+ HWND hWndNewList ;
+ LMHANDLE pdsListHdr ;
+ BYTE bControlID ;
+ USHORT usCnt ;
+ LMHANDLE pListItem ;
+ HWND hWndLB ;
+ HWND hWndFocus ;
+ HWND hWndActive ;
+
+ GET_COUNT_PTR pfnGetItemCount ;
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_NEXT_PTR pfnGetNext ;
+ MP2 mp2 ;
+ POINT Point;
+
+ wStatus = 0 ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return( DLMERR_LIST_NOT_FOUND ) ;
+ }
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+
+ // Extra Bytes for window must be defined.
+
+ msassert ( pWinInfo != (VOID_PTR)NULL );
+
+ switch ( bType ) {
+
+ case DLM_TREELISTBOX :
+
+ pHdr = WMDS_GetTreeDisp ( pWinInfo );
+ hWndLB = WMDS_GetWinTreeList ( pWinInfo );
+ bControlID = WMIDC_TREELISTBOX ;
+ fTreeList = TRUE ;
+ pdsListHdr = ( LMHANDLE ) WMDS_GetTreeList ( pWinInfo );
+
+ break ;
+
+ case DLM_FLATLISTBOX :
+ default :
+
+ pHdr = WMDS_GetFlatDisp ( pWinInfo );
+ hWndLB = WMDS_GetWinFlatList ( pWinInfo );
+ bControlID = WMIDC_FLATLISTBOX ;
+ fTreeList = FALSE ;
+ pdsListHdr = ( LMHANDLE ) WMDS_GetFlatList ( pWinInfo );
+ break ;
+
+ }
+
+ /* Exception Handling */
+
+ msassert ( pHdr != (VOID_PTR)NULL );
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndLB ) ) {
+ return( DLMERR_LIST_NOT_FOUND ) ;
+ }
+
+ if ( DLM_GDisplay( pHdr ) != DLM_SMALL_BITMAPS ) {
+ return ( 0 ) ;
+ }
+
+ if ( DLM_GMode( pHdr ) == bMode ) {
+ return( 0 ) ;
+ }
+
+ if ( ( DLM_GMode( pHdr ) != DLM_SINGLECOLUMN ) &&
+ ( DLM_GMode( pHdr ) != DLM_MULTICOLUMN ) &&
+ ( bMode != DLM_SINGLECOLUMN ) &&
+ ( bMode != DLM_MULTICOLUMN ) ) {
+ return( 0 ) ;
+ }
+
+ if ( bMode == DLM_SINGLECOLUMN ) {
+ fMultiCol = FALSE ;
+ } else {
+ fMultiCol = TRUE ;
+ }
+
+ wTopIndex = (WORD) SendMessage (hWndLB, LB_GETTOPINDEX, (MP1)0, (MP2)0 ) ;
+ nSelCnt = (INT) SendMessage (hWndLB, LB_GETSELCOUNT, (MP1)0, (MP2)0 ) ;
+
+ // Make sure that pnSelArray has at least been allocated 1 entry.
+
+ pnSelArray = (LPINT)calloc( nSelCnt+1, sizeof ( INT ) ) ;
+
+ if ( ! pnSelArray ) {
+ return FAILURE;
+ }
+
+ SendMessage ( hWndLB, LB_GETSELITEMS, (MP1)nSelCnt, (MP2) &pnSelArray[0] ) ;
+// SendMessage ( hWndLB, LB_RESETCONTENT, (MP1)0, (MP2)0 ) ;
+
+ hWndFocus = GetFocus() ;
+ hWndActive = WMDS_GetWinActiveList( pWinInfo ) ;
+
+ // Get the rectangle size of the old list box window.
+ // Adjust for the border.
+
+ GetWindowRect ( hWndLB, &ChildRect );
+
+ Point.x = ChildRect.left + 1;
+ Point.y = ChildRect.top + 1;
+
+ ScreenToClient ( hWnd, &Point );
+
+ // Trash the old window and make a new one.
+
+ DestroyWindow( hWndLB ) ;
+
+ hWndNewList = CreateWindow ( WMCLASS_LISTBOX,
+ NULL,
+ WS_BORDER |
+ ( fMultiCol ) ? WM_FLATLISTBOXMC : WM_FLATLISTBOXSC,
+ Point.x,
+ Point.y,
+ ChildRect.right - ChildRect.left - 2,
+ ChildRect.bottom - ChildRect.top - 2,
+ hWnd,
+ (HMENU)bControlID,
+ ghInst,
+ (LPSTR)NULL
+ );
+
+ if ( fMultiCol ) {
+ SendMessage ( hWndNewList, LB_SETCOLUMNWIDTH, pHdr->cxColWidth, 0L ) ;
+ }
+
+ DLM_Mode( pHdr, bMode ) ;
+
+ if ( fTreeList == TRUE ) {
+ WMDS_SetWinTreeList ( pWinInfo, hWndNewList );
+ } else {
+ WMDS_SetWinFlatList ( pWinInfo, hWndNewList );
+ }
+
+ if ( hWndActive == hWndLB ) {
+ WMDS_SetWinActiveList ( pWinInfo, hWndNewList ) ;
+ }
+
+ // Subclass the new list box for keyboard and mouse capturing.
+
+ WM_SubClassListBox ( hWndNewList );
+
+ if ( hWndFocus == hWndLB ) {
+ SetFocus( hWndNewList) ;
+ }
+
+ pHdr->wHorizontalExtent = 0 ;
+
+ pfnGetItemCount = (GET_COUNT_PTR) DLM_GGetItemCount( pHdr ) ;
+ pfnGetFirstItem = (GET_FIRST_PTR) DLM_GGetFirstItem( pHdr ) ;
+ pfnGetNext = (GET_NEXT_PTR) DLM_GGetNext ( pHdr ) ;
+
+ usCnt = (USHORT) ( (*pfnGetItemCount) (pdsListHdr) );
+
+ // Place the old items into the new list, if there were any.
+
+ if ( usCnt ) {
+
+ SendMessage ( hWndNewList, WM_SETREDRAW, FALSE, 0L ) ;
+
+ pListItem = (LMHANDLE) ( (*pfnGetFirstItem) (pdsListHdr) ) ;
+
+ DLM_SetHorizontalExt( hWndNewList, pHdr, pListItem ) ;
+
+ while ( ( pListItem ) && ( usCnt > 0 ) ) {
+
+ wStatus = (WORD) SendMessage( hWndNewList, LB_ADDSTRING, 0, (LONG) pListItem ) ;
+ pListItem = (LMHANDLE) ( (*pfnGetNext) (pListItem) ) ;
+ usCnt--;
+ }
+
+ // Process array of items to select.
+
+ for ( i = 0; i < nSelCnt; i++ ) {
+ wStatus = (WORD) SendMessage ( hWndNewList, LB_SETSEL, TRUE,
+ (MP2)pnSelArray[i] );
+ }
+
+ wStatus = (WORD) SendMessage (hWndNewList, LB_SETTOPINDEX, wTopIndex, (MP2)0 ) ;
+
+ SendMessage ( hWndNewList, WM_SETREDRAW, TRUE, 0L ) ;
+
+ InvalidateRect ( hWndNewList, NULL, TRUE ) ;
+ UpdateWindow ( hWndNewList ) ;
+ }
+
+ if ( pnSelArray ) {
+ free( pnSelArray ) ;
+ }
+
+ return SUCCESS;
+
+}
+
+/****************************************************************************
+
+ Name: DLM_WMTrackPoint
+
+ Description: This function test to see if mouse is within a validate
+ object on an item in a list box when the left button
+ is down.
+
+ Modified: 4/24/1991
+
+ Returns: 0 if mouse is over a valid object.
+ 1 if mouse is not over a valid object and the list box
+ should abort further processing.
+
+****************************************************************************/
+
+WORD DLM_WMTrackPoint(
+
+HWND hWnd , // I - Handle of parent window of listbox.
+MP1 mp1 , // I - Current selection.
+MP2 mp2 ) // I - Mouse position.
+
+{
+
+ PDS_WMINFO pWinInfo ;
+ DLM_HEADER_PTR pHdr ;
+ INT iCurSel, iOldSel, iError, iTopSel ;
+ RECT rectItem ;
+ RECT rectTest ;
+ LMHANDLE pListItem ;
+
+ short cxPos, cyPos ;
+ DLM_ITEM_PTR lpDispItem ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ SET_TAG_PTR pfnSetTag ;
+ BYTE bObjCnt ;
+ BYTE_PTR lpObjLst ;
+ POINT pt ;
+ HWND hWndLB ;
+ HWND hWndFocus = GetFocus ();
+
+ // Must be valid window.
+
+ if ( ! IsWindow ( hWnd ) ) {
+ return FAILURE;
+ }
+
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWnd ) ;
+
+ // Extra Bytes for window must be defined.
+
+ msassert ( pWinInfo != (VOID_PTR)NULL );
+
+
+ // If we're not in the tree list box, we don't care about this point.
+
+ if ( hWndFocus != WMDS_GetWinTreeList ( pWinInfo ) ) {
+ return SUCCESS;
+ }
+
+ hWndLB = WMDS_GetWinActiveList ( pWinInfo );
+
+ if ( hWndLB != hWndFocus ) {
+
+ // THIS SHOULD NEVER HAPPEN.
+
+ WMDS_SetWinActiveList ( pWinInfo, hWndFocus );
+ hWndLB = hWndFocus;
+ }
+
+
+ pHdr = DLM_GetDispHdr( hWndLB ) ;
+
+ // DLM display header must be defined.
+
+ msassert ( pHdr != (VOID_PTR)NULL );
+
+ /* if mouse is not over an object in the hierarchical tree, then
+ don't do anything */
+
+ // WHY DOESN'T THE CODE REFLECT THE ABOVE COMMENT.
+
+
+ iCurSel = (INT) mp1 ;
+
+ iError = (INT) SendMessage ( hWndLB, LB_GETITEMRECT, iCurSel,
+ (LONG) ( LPRECT ) &rectItem ) ;
+
+# ifdef NTKLUG
+ iError = (INT) SendMessage ( hWndLB, WM_DLMGETTEXT, iCurSel,
+ (LONG) &pListItem ) ;
+# else
+ iError = (INT) SendMessage ( hWndLB, LB_GETTEXT, iCurSel,
+ (LONG) &pListItem ) ;
+# endif
+
+ // ERROR CHECKING
+
+ if ( iError == LB_ERR ) {
+ return FAILURE;
+ }
+
+ iTopSel = (INT) SendMessage ( hWndLB, LB_GETTOPINDEX, 0,
+ (LONG) 0L ) ;
+
+ /* Origin of control */
+
+ /* It is known that x,y is in the rectangle */
+
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects( pHdr ) ;
+
+ lpObjLst = (BYTE_PTR) ( (*pfnGetObjects) (pListItem) ) ;
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ cxPos = (short) rectItem.left ;
+ cyPos = (short) rectItem.top ;
+
+ cxPos += ( ( DLM_ItembLevel( lpDispItem ) )* pHdr->cxHierTab ) ;
+
+ //pt = gDLMpt ;
+ //pt.x = gDLMpt.x + pHdr->xOrigin ;
+
+ pt.x = LOWORD( mp2 ) ; /* Has xOrigin added already */
+ pt.y = HIWORD( mp2 ) ;
+
+
+ iError = 1 ;
+
+ while (bObjCnt) {
+
+ DLM_GetRect( hWndLB, pHdr, (LPSHORT)&cxPos, cyPos, &rectTest, lpDispItem ) ;
+
+ if ( PtInRect ( &rectTest, pt ) ) {
+
+ // If the object is the check box, then
+ // process the checkbox without selecting the item.
+
+ if ( DLM_ItembType( lpDispItem) == DLM_CHECKBOX ) {
+
+ DLM_ProcessButton( hWndLB,
+ pHdr,
+ LBN_SELCHANGE,
+ &rectItem,
+ (WORD)iCurSel,
+ pListItem,
+ lpDispItem ) ;
+
+ iError = 1; // Do Not process the selection.
+ break ;
+ }
+
+ // If the list is hierarchical, then unselect tag of
+ // current selection.
+
+
+ if ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) {
+
+ iOldSel = (INT) SendMessage ( hWndLB, LB_GETCURSEL, 0, 0L ) ;
+
+ if ( iOldSel != LB_ERR ) {
+
+ pfnSetTag = (SET_TAG_PTR) DLM_GSetTag ( pHdr ) ;
+# ifdef NTKLUG
+ iError = SendMessage ( hWndLB, WM_DLMGETTEXT, iOldSel,
+ (LONG) &pListItem ) ;
+# else
+ iError = SendMessage ( hWndLB, LB_GETTEXT, iOldSel,
+ (LONG) &pListItem ) ;
+# endif
+ (*pfnSetTag) (pListItem, 0 ) ;
+ }
+ }
+
+ iError = 0 ;
+ break ;
+ }
+
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+
+ if ( iError ) {
+ iTopSel = (INT) SendMessage ( hWndLB, LB_SETTOPINDEX, iTopSel,
+ (LONG) 0L ) ;
+ }
+
+ DLM_SetTrkPtFailure( pHdr, iError ) ;
+
+ return( (WORD)iError ) ;
+}
+
+/****************************************************************************
+
+ Name: DLM_CursorInCheckBox
+
+ Description: This function test to see if mouse is within the checkbox
+ in a list box
+
+ Modified: 5/01/1991
+
+ Returns: 1 if mouse is within the checkbox.
+ 0 if mouse is not within the checkbox
+
+
+****************************************************************************/
+
+BOOL DLM_CursorInCheckBox(
+
+HWND hWndLB, // I - Handle of a listbox.
+POINT pt ) // I - Point where the mouse is currently at.
+
+{
+
+ INT wStatus ;
+ PDS_WMINFO pWinInfo ;
+ DLM_HEADER_PTR pHdr ;
+ RECT rcTest ;
+ LMHANDLE pListItem ;
+ WORD wTopIndex, wSel;
+ LRESULT SelCnt;
+ INT iError ;
+ short cxPos, cyPos ;
+ DLM_ITEM_PTR lpDispItem ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+ BYTE bObjCnt ;
+ BYTE_PTR lpObjLst ;
+ POINT pt1 ;
+ RECT rcList ;
+
+ wStatus = 0 ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndLB ) ) {
+ return FALSE;
+ }
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( GetParent( hWndLB ) ) ;
+
+ // Extra Bytes for window must be defined.
+
+ msassert ( pWinInfo != (VOID_PTR)NULL );
+
+ pHdr = DLM_GetDispHdr( hWndLB ) ;
+
+ msassert ( pHdr != (VOID_PTR)NULL );
+
+ // Get the count of items in the LB.
+
+ SelCnt = SendMessage (hWndLB, LB_GETCOUNT, (MP1)0, (MP2)0 ) ;
+
+ if ( ! SelCnt || SelCnt == LB_ERR ) {
+
+ return FALSE;
+ }
+
+ wTopIndex = (WORD) SendMessage (hWndLB, LB_GETTOPINDEX, (MP1)0, (MP2)0 ) ;
+
+ GetClientRect ( hWndLB, &rcList ) ; /* Need listbox's bottom y position. */
+
+ pt1 = pt ;
+
+ pt1.x += (pHdr->xOrigin) ;
+
+ wSel = wTopIndex ;
+
+ while ( wSel < SelCnt ) {
+
+ iError = (INT) SendMessage ( hWndLB, LB_GETITEMRECT, wSel,
+ (LONG) ( LPRECT ) &rcTest ) ;
+
+ if ( iError == LB_ERR) {
+ break ;
+ }
+
+ if ( rcTest.top >= rcList.bottom ) {
+ break ;
+ }
+
+ if ( PtInRect ( &rcTest, pt1 ) ) {
+
+# ifdef NTKLUG
+ iError = (INT) SendMessage ( hWndLB, WM_DLMGETTEXT, wSel, (LONG) &pListItem ) ;
+# else
+ iError = (INT) SendMessage ( hWndLB, LB_GETTEXT, wSel, (LONG) &pListItem ) ;
+# endif
+
+ if ( iError == LB_ERR) {
+ break ;
+ }
+
+ /* Origin of control */
+
+ pfnGetObjects = DLM_GGetObjects( pHdr ) ;
+
+ lpObjLst = (BYTE_PTR) ( (*pfnGetObjects) (pListItem) ) ;
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ cxPos = (short) rcTest.left ;
+ cyPos = (short) rcTest.top ;
+
+ if ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) {
+ cxPos += ( ( DLM_ItembLevel( lpDispItem ) )* pHdr->cxHierTab ) ;
+ }
+
+ while (bObjCnt) {
+
+ DLM_GetRect( hWndLB, pHdr, (LPSHORT)&cxPos, cyPos, &rcTest, lpDispItem ) ;
+
+ if ( DLM_ItembType( lpDispItem ) == DLM_CHECKBOX ) {
+ if ( DLM_ItemwId( lpDispItem ) ) {
+ if ( PtInRect ( &rcTest, pt1 ) ) {
+ wStatus = TRUE ;
+ break ;
+ }
+ }
+ }
+
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+ break ;
+ }
+
+ wSel++;
+
+ } /* end while */
+
+ return (BOOL)wStatus;
+
+}
diff --git a/private/utils/ntbackup/src/dlm_scrn.c b/private/utils/ntbackup/src/dlm_scrn.c
new file mode 100644
index 000000000..7d384a98c
--- /dev/null
+++ b/private/utils/ntbackup/src/dlm_scrn.c
@@ -0,0 +1,868 @@
+/****************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+
+ Name: dlm_scrn.c
+
+ Creator: Rob Griffis
+
+ Description: This file contains routines for display list manager.
+
+ The following routines are in this module:
+
+
+ DLM_WMMeasureItem
+ DLM_GetRect
+ DLM_GetWidth
+ DLM_KeyDown
+ DLM_KeyUp
+
+ $Log: G:/UI/LOGFILES/DLM_SCRN.C_V $
+
+ Rev 1.26 15 Jun 1993 10:56:30 MIKEP
+enable c++
+
+ Rev 1.25 14 Jun 1993 20:15:12 MIKEP
+enable c++
+
+ Rev 1.24 02 Apr 1993 15:54:32 ROBG
+Changed FocusItem to be UINT for both NT and WINDOWS.
+
+ Rev 1.23 01 Nov 1992 15:46:56 DAVEV
+Unicode changes
+
+ Rev 1.22 07 Oct 1992 13:48:00 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.21 04 Oct 1992 19:33:14 DAVEV
+Unicode Awk pass
+
+ Rev 1.20 08 Sep 1992 10:39:02 ROBG
+
+ Rev 1.19 21 Aug 1992 16:01:18 ROBG
+Change to support change of font.
+
+ Rev 1.18 29 Jul 1992 14:23:44 GLENN
+ChuckB checked in after NT fixes.
+
+ Rev 1.17 07 Jul 1992 15:52:32 MIKEP
+unicode changes
+
+ Rev 1.16 15 May 1992 13:35:50 MIKEP
+nt pass 2
+
+ Rev 1.15 20 Mar 1992 17:22:54 GLENN
+Fixed VK_RETURN to work on key down instead of key up.
+
+ Rev 1.14 19 Mar 1992 15:50:30 GLENN
+Removed tabs.
+
+ Rev 1.13 09 Mar 1992 09:39:48 GLENN
+Fixed single click turning into a double click after a CR in list boxes.
+
+ Rev 1.12 03 Mar 1992 18:21:30 GLENN
+Put in error handling.
+
+ Rev 1.11 23 Feb 1992 13:50:30 GLENN
+Added check for valid list item to key char processing function.
+
+ Rev 1.10 11 Feb 1992 17:29:04 GLENN
+Changed return cast from SendMessage() from WORD to INT for NT.
+
+ Rev 1.9 06 Feb 1992 15:15:16 ROBG
+Added logic in DLM_GetWidth to add 3* average width to any
+column character count less than 5.
+
+ Rev 1.8 04 Feb 1992 16:07:46 STEVEN
+various bug fixes for NT
+
+ Rev 1.7 15 Jan 1992 15:15:16 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.6 07 Jan 1992 17:27:46 GLENN
+Updated DLM_KeyDown().
+
+ Rev 1.5 26 Dec 1991 17:22:42 ROBG
+New and Improved.
+
+ Rev 1.4 05 Dec 1991 17:58:54 GLENN
+Changed stuff in the default case of key down.
+
+ Rev 1.3 04 Dec 1991 15:13:44 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.2 03 Dec 1991 16:21:22 GLENN
+Added DLM_CharToItem function.
+
+ Rev 1.1 26 Nov 1991 16:12:12 ROBG
+Added validity checks for the window handles, info structure, and the
+dlm display header.
+
+ Rev 1.0 20 Nov 1991 19:31:56 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+VOID DLM_ReturnKeyPressed ( HWND, DLM_HEADER_PTR, LPWORD );
+
+/****************************************************************************
+
+ Name: DLM_GetRect
+
+ Description: This function will return the rectangle of an object
+ in the list.
+
+ Modified: 2/15/1991
+
+ Returns: none
+
+****************************************************************************/
+
+void DLM_GetRect(
+
+HWND hWndCtl, // I - Handle to list box.
+DLM_HEADER_PTR pHdr , // I - Handle to DLM header for list box.
+LPSHORT pcxPos , // IO - Starting and ending of X position.
+short cyPos , // I - starting Y position.
+LPRECT lpRect , // O - Pointer to rectangle.
+DLM_ITEM_PTR lpDispItem ) // I - Pointer to display item.
+
+{
+ HDC hdc ;
+ LONG lLen ;
+ SIZE sizeRect; //dvc - for GetTextExtentEx return value
+ HANDLE hSaveObject ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndCtl ) ) {
+ return ;
+ }
+
+ // DLM display header must be defined.
+
+ if ( !pHdr ) {
+ return ;
+ }
+
+ switch ( DLM_ItembType( lpDispItem) ) {
+
+ case DLM_CHECKBOX:
+
+ *pcxPos += pHdr->cxBeforeCheckBox ;
+ lpRect->left = *pcxPos ;
+ lpRect->top = cyPos + pHdr->cyBeforeCheckBox ;
+ lpRect->right = lpRect->left + pHdr->cxCheckBoxWidth-1 ;
+ lpRect->bottom = lpRect->top + pHdr->cyCheckBoxHeight-1 ;
+ *pcxPos += pHdr->cxCheckBoxWidth ;
+
+ break;
+
+ case DLM_BITMAP:
+
+ *pcxPos += pHdr->cxBeforeBitMap ;
+ lpRect->left = *pcxPos ;
+ lpRect->top = cyPos + pHdr->cyBeforeBitMap ;
+ lpRect->right = lpRect->left + pHdr->cxBitMapWidth-1 ;
+ lpRect->bottom = lpRect->top + pHdr->cyBitMapHeight-1 ;
+ *pcxPos += pHdr->cxBitMapWidth ;
+
+ break ;
+
+ case DLM_TEXT_ONLY:
+ default :
+ /* If the list is not hierarchical, then assume text
+ is the last object item and return a match */
+
+ if ( DLM_GMode ( pHdr ) != DLM_HIERARCHICAL ) {
+
+ lpRect->left = 0 ;
+ lpRect->top = 0 ;
+ lpRect->right = 10000 ;
+ lpRect->bottom = 10000 ;
+
+ } else {
+
+
+ *pcxPos += pHdr->cxBeforeText ;
+ lpRect->left = *pcxPos ;
+ lpRect->top = cyPos + pHdr->cyBeforeText ;
+ *pcxPos += pHdr->cxTextWidth ; /* zero for now */
+
+ lLen = strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) ) ;
+
+ hdc = GetDC( hWndCtl ) ;
+
+ hSaveObject = SelectObject( hdc, ghFontIconLabels ) ;
+
+ GetTextExtentPoint( hdc, (CHAR_PTR)DLM_ItemqszString (lpDispItem ),
+ (INT) lLen, &sizeRect ) ;
+
+ hSaveObject = SelectObject ( hdc, hSaveObject ) ;
+
+ ReleaseDC( hWndCtl, hdc ) ;
+
+ lpRect->right = lpRect->left + sizeRect.cx + 1 ;
+
+ lpRect->bottom = lpRect->top + pHdr->cyTextHeight-1 ;
+
+ *pcxPos += pHdr->cxTextWidth ;
+
+ if ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) {
+ lpRect->top += (mwDLMInflate);
+ lpRect->top += (mwDLMInflate);
+ lpRect->bottom += -(mwDLMInflate);
+ lpRect->bottom += -(mwDLMInflate);
+ }
+
+
+ }
+ }
+
+
+ lpRect->left += -(mwDLMInflate); /* Offset by 2 - look at wmdraw.c */
+ lpRect->top += -(mwDLMInflate); /* Offset by 2 - look at wmdraw.c */
+ lpRect->right += -(mwDLMInflate); /* Offset by 2 - look at wmdraw.c */
+ lpRect->bottom += -(mwDLMInflate); /* Offset by 2 - look at wmdraw.c */
+
+
+}
+
+/****************************************************************************
+
+ Name: DLM_GetWidth
+
+ Description: This function will return the width of an object
+ in the list.
+
+ Modified: 12/19/1991
+
+ Returns: The contents of pcxPos is updated.
+
+****************************************************************************/
+
+void DLM_GetWidth (
+
+HWND hWndCtl, // I - Handle to list box.
+DLM_HEADER_PTR pHdr , // I - Handle to DLM header for list box.
+LPSHORT pcxPos , // I/O - Starting and ending of X position.
+DLM_ITEM_PTR lpDispItem ) // I - Pointer to display item.
+
+{
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndCtl ) ) {
+ return ;
+ }
+
+ // DLM display header must be defined.
+
+ if ( !pHdr ) {
+ return ;
+ }
+
+ switch ( DLM_ItembType( lpDispItem) ) {
+
+ case DLM_CHECKBOX:
+
+ *pcxPos += ( pHdr->cxBeforeCheckBox +
+ pHdr->cxCheckBoxWidth ) ;
+
+ break;
+
+ case DLM_BITMAP:
+
+ *pcxPos += ( pHdr->cxBeforeBitMap +
+ pHdr->cxBitMapWidth ) ;
+ break ;
+
+ case DLM_TEXT_ONLY:
+ default :
+
+ // Create a little more space for strings less than 5 characters long.
+ // Same logic in dlm_draw.c when the items are drawn.
+
+ if ( ( (int) DLM_ItembMaxTextLen( lpDispItem ) > 0 ) &&
+ ( (int) DLM_ItembMaxTextLen( lpDispItem ) < 5 ) &&
+ ( DLM_GDisplay( pHdr) == DLM_SMALL_BITMAPS ) ) {
+
+ *pcxPos += pHdr->cxTextWidth ;
+ }
+
+ *pcxPos += ( pHdr->cxBeforeText +
+ ( DLM_ItembMaxTextLen( lpDispItem )*( pHdr->cxTextWidth ) ) ) ;
+
+ }
+
+}
+
+
+
+/****************************************************************************
+
+ Name: DLM_SetAnchor
+
+ Description: This function set the anchor point in a listbox.
+
+ Modified: 2/07/1991
+
+ Returns: TRUE if processed key.
+
+****************************************************************************/
+
+
+WORD DLM_SetAnchor (
+
+HWND hWndCtl , // I - Handle of a listbox.
+WORD iAnchorItem , // I - Integer value of item to be anchor pt.
+LMHANDLE dhAnchorItem ) // I - Address of item to be anchor pt.
+
+{
+ INT nStatus ;
+ INT nCurSel, nOldSel, nError ;
+ DLM_HEADER_PTR pdsHdr ;
+ SET_TAG_PTR pfnSetTag ;
+ LMHANDLE pListItem ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndCtl ) ) {
+ return TRUE ;
+ }
+
+ pdsHdr = DLM_GetDispHdr ( hWndCtl ) ;
+
+ // DLM display header must be defined.
+
+ if ( !pdsHdr ) {
+ return TRUE ;
+ }
+
+
+ pdsHdr->dhAnchorItem = dhAnchorItem ;
+ pdsHdr->iAnchorItem = iAnchorItem ;
+
+ /* Find it in the list. Usually the first item. */
+
+ if ( pdsHdr->dhAnchorItem ) {
+
+ nCurSel = (INT) SendMessage ( hWndCtl, LB_FINDSTRING, (MP1)-1, (LONG) dhAnchorItem ) ;
+
+ if ( nCurSel != LB_ERR ) {
+
+ if ( DLM_GMode( pdsHdr ) != DLM_HIERARCHICAL ) {
+
+ /* Check to see if item is displayed on the screen
+ ** If entire item is not found on the display, then
+ ** make it the top of the list displayed.
+ */
+
+ HDC hDC ;
+ RECT dsRect ;
+ POINT pt1 ;
+ POINT pt2 ;
+
+ hDC = GetDC( hWndCtl ) ;
+
+ nStatus = (INT) SendMessage ( hWndCtl, LB_GETITEMRECT, nCurSel, (LONG) &dsRect ) ;
+
+ pt1.x = dsRect.left ;
+ pt1.y = dsRect.top ;
+ pt2.x = dsRect.right ;
+ pt2.y = dsRect.bottom ;
+
+ if ( !PtVisible ( hDC, pt1.x, pt1.y ) ||
+ !PtVisible ( hDC, pt2.x, pt2.y ) ) {
+
+ // Set the item to top selection.
+
+ nStatus = (INT) SendMessage( hWndCtl, LB_SETTOPINDEX, nCurSel, 0 ) ;
+
+ }
+
+ ReleaseDC( hWndCtl, hDC ) ;
+
+ nStatus = (INT) SendMessage ( hWndCtl, LB_SETSEL, 0, -1 );
+ nStatus = (INT) SendMessage ( hWndCtl, LB_SETSEL, 1, nCurSel );
+
+ } else {
+
+ /* Reset tag field if new selection */
+
+ nOldSel = (INT) SendMessage ( hWndCtl, LB_GETCURSEL, 0, 0L ) ;
+
+ if ( ( nOldSel != LB_ERR ) && (nOldSel != nCurSel) ) {
+
+ pfnSetTag = (SET_TAG_PTR) DLM_GSetTag ( pdsHdr ) ;
+# ifdef NTKLUG
+ nError = (INT) SendMessage ( hWndCtl, WM_DLMGETTEXT, nOldSel,
+ (LONG) &pListItem ) ;
+# else
+ nError = (INT) SendMessage ( hWndCtl, LB_GETTEXT, nOldSel,
+ (LONG) &pListItem ) ;
+# endif
+ (*pfnSetTag) (pListItem, 0 ) ;
+ }
+
+ pdsHdr->cLastTreeSelect = (USHORT) nCurSel ;
+
+ nStatus = (INT) SendMessage( hWndCtl, LB_SETCURSEL, nCurSel, 0L ) ;
+ }
+
+ } else {
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+
+ } else {
+
+ /* iAnchorItem must be between 0 and the count in listbox */
+
+ if ( DLM_GMode( pdsHdr ) == DLM_COLUMN_VECTOR ) {
+
+ nStatus = (INT) SendMessage (hWndCtl, LB_SETSEL, 1, iAnchorItem );
+
+ } else {
+
+ if ( DLM_GMode( pdsHdr ) == DLM_HIERARCHICAL ) {
+ pdsHdr->cLastTreeSelect = iAnchorItem ;
+ }
+
+ nStatus = (INT) SendMessage( hWndCtl, LB_SETCURSEL, iAnchorItem, 0L ) ;
+ }
+
+ }
+
+}
+
+
+/****************************************************************************
+
+ Name: DLM_KeyDown
+
+ Description: This function processes the tab key
+ key.
+
+ Modified: 2/07/1991
+
+ Returns: TRUE if processed key.
+
+
+****************************************************************************/
+
+BOOL DLM_KeyDown(
+
+HWND hWndCtl , // I - Handle of Listbox.
+LPWORD pwKey , // IO - Value of key
+MP2 mp2 ) // I - Ignored at this time.
+
+{
+
+ WORD fKeyUsed ;
+ HWND hParentWnd ;
+ PDS_WMINFO pWinInfo ;
+ DLM_HEADER_PTR pHdr ;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ fKeyUsed = FALSE ;
+
+
+ hParentWnd = GetParent( hWndCtl ) ;
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hParentWnd ) ;
+ pHdr = DLM_GetDispHdr( hWndCtl ) ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndCtl ) ) {
+ return TRUE ;
+ }
+
+ // Extra Bytes for window must be defined.
+
+ if ( !pWinInfo ) {
+ return TRUE ;
+ }
+
+ // DLM display header must be defined.
+
+ if ( !pHdr ) {
+ return TRUE ;
+ }
+
+
+ switch ( *pwKey ) {
+
+ case VK_TAB :
+
+ /* If both exists, then reset focus */
+
+ if ( (pWinInfo->hWndTreeList ) && (pWinInfo->hWndFlatList) &&
+ (pWinInfo->pTreeDisp ) && (pWinInfo->pFlatDisp ) ) {
+
+ if (hWndCtl == pWinInfo->hWndTreeList) {
+ SetFocus ( pWinInfo->hWndFlatList ) ;
+ } else {
+ SetFocus ( pWinInfo->hWndTreeList ) ;
+ }
+ }
+
+ fKeyUsed = TRUE ;
+ break ;
+
+ case VK_RETURN :
+
+ DLM_ReturnKeyPressed ( hWndCtl, pHdr, pwKey );
+ break ;
+
+ case VK_SPACE :
+
+ DLM_SpaceBarPressed ( hWndCtl, pHdr, pwKey ) ;
+ break;
+
+ case VK_HOME :
+ case VK_END :
+ case VK_NEXT :
+ case VK_LEFT :
+ case VK_RIGHT :
+ case VK_UP :
+ case VK_DOWN :
+ case VK_PRIOR :
+ case VK_CONTROL :
+ case VK_SHIFT :
+ pHdr->wKeyValue = *pwKey ;
+ pHdr->fKeyDown = TRUE ;
+ break ;
+
+ default:
+
+ if ( DLM_CharToItem ( hWndCtl, pHdr, pwKey ) ) {
+ pHdr->wKeyValue = *pwKey ;
+ pHdr->fKeyDown = TRUE ;
+ fKeyUsed = TRUE ;
+ }
+
+ break ;
+
+ } /* end switch */
+
+ return ( fKeyUsed ) ;
+
+}
+
+
+/****************************************************************************
+
+ Name: DLM_KeyUp
+
+ Description: This function processes the WM_KEYUP messages
+
+ Modified: 2/07/1991
+
+ Returns: TRUE if processed key.
+
+****************************************************************************/
+
+BOOL DLM_KeyUp(
+
+HWND hWndCtl, // I - Handle of Listbox.
+LPWORD pwKey , // IO - Value of key
+MP2 mp2 ) // I - Ignored at this time.
+
+{
+ DLM_HEADER_PTR pHdr;
+ MP1 mpSend1;
+ MP2 mpSend2;
+ BOOL fKeyUsed = FALSE;
+ static BOOL fSemProcessing = FALSE; // sem to eliminate recursion.
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ // THIS IS THE WRONG WAY TO DO IT, BUT, HEY, IT'S TOO LATE TO DO IT RIGHT.
+ // THE VLM IS CALLING A DIALOG IN THE MIDDLE OF THIS CALL TO TRY TO
+ // ATTACH TO A FILE SERVER. THIS TYPE OF PROCESSING SHOULD BE DONE
+ // WITH A POST MESSAGE OR SIMILAR -- BY THE VLM.
+
+ if ( fSemProcessing ) {
+ return TRUE;
+ }
+
+ // Must be valid window.
+
+ if ( ! IsWindow( hWndCtl ) ) {
+ return TRUE;
+ }
+
+ pHdr = DLM_GetDispHdr( hWndCtl );
+
+ // DLM display header must be defined and the key must be down.
+
+ if ( ( ! pHdr ) || ( ! pHdr->fKeyDown ) ) {
+ return TRUE;
+ }
+
+ fSemProcessing = TRUE;
+
+ // If this is a tree list box, we want to send the list box the key
+ // up message directly and not let the default list box process the
+ // message.
+
+ if ( pHdr->wKeyValue == *pwKey ) {
+
+ PDS_WMINFO pWinInfo;
+ WORD wListBoxIDC;
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr ( GetParent ( hWndCtl ) );
+
+ if ( WMDS_GetWinActiveList ( pWinInfo ) == WMDS_GetWinTreeList ( pWinInfo ) ) {
+ wListBoxIDC = WMIDC_TREELISTBOX;
+ }
+ else {
+ wListBoxIDC = WMIDC_FLATLISTBOX;
+ }
+
+ pHdr->fKeyUp = TRUE;
+
+ SET_WM_COMMAND_PARAMS( wListBoxIDC, LBN_SELCHANGE, hWndCtl, mpSend1, mpSend2 );
+
+ DLM_LBNmessages ( GetParent ( hWndCtl), mpSend1, mpSend2 );
+
+ pHdr->fKeyDown = FALSE;
+ pHdr->fKeyUp = FALSE;
+ pHdr->wKeyValue = 0;
+
+ fKeyUsed = TRUE;
+
+ }
+
+ // Translate the return key to back to a space for the list box.
+
+ if ( *pwKey == VK_RETURN ) {
+
+ *pwKey = (WORD) VK_SPACE;
+ fKeyUsed = FALSE;
+ }
+
+ fSemProcessing = FALSE;
+
+ return fKeyUsed;
+
+}
+
+
+/****************************************************************************
+
+ Name: DLM_ScrollListBox()
+
+ Description: This function scrolls a list box using the type of scroll
+ specified.
+
+ SCROLL TYPE
+ -----------
+ DBM_SCROLLTOP Scrolls to the top of the list box
+ DBM_SCROLLBOTTOM Scrolls to the bottom of the list box
+
+ Returns: Nothing.
+
+****************************************************************************/
+
+VOID DLM_ScrollListBox (
+
+HWND hWnd, // I - handle of the list box window to scroll
+WORD wType ) // I - the type of scrolling to be done
+
+{
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return;
+ }
+
+ SEND_WM_VSCROLL_MSG ( hWnd, wType, 0, NULL );
+ SEND_WM_VSCROLL_MSG ( hWnd, SB_ENDSCROLL, 1, NULL );
+
+} /* end DLM_ScrollListBox() */
+
+
+/****************************************************************************
+GSH
+ Name: DLM_SpaceBarPressed()
+
+ Description: This function processes the space bar by checking or
+ unchecking the item in focus, then tagging and setting
+ the focus of the next item in the list.
+
+ Returns: Nothing.
+
+****************************************************************************/
+
+VOID DLM_SpaceBarPressed (
+
+HWND hWndListBox, // I - handle to the list box window.
+DLM_HEADER_PTR pHdr, // I - pointer to the header of the list to use.
+LPWORD pwKey ) // IO - pointer to the key value.
+
+{
+ BYTE fSelect;
+ RECT rcTemp;
+ GET_SELECT_PTR pfnGetSelect;
+ SET_SELECT_PTR pfnSetSelect;
+ LMHANDLE pListItem;
+
+
+ // Set the key information being careful to change the space key to
+ // to a down-arrow key to the list box so that the next item in the
+ // list gets highlighted (tagged).
+
+ pHdr->wKeyValue = *pwKey;
+ pHdr->fKeyDown = TRUE;
+ *pwKey = VK_DOWN;
+
+ // Get the list item handle.
+
+ pListItem = (LMHANDLE)SendMessage ( hWndListBox,
+ LB_GETITEMDATA,
+ pHdr->unFocusItem,
+ 0L
+ );
+
+ // Get the select callback functions.
+
+ pfnGetSelect = DLM_GGetSelect ( pHdr );
+ pfnSetSelect = DLM_GSetSelect( pHdr );
+
+ // If there are valid call back functions and the item is valid,
+ // toggle the selection status of the item.
+
+ if ( pfnGetSelect && pfnSetSelect && ( pListItem != (LMHANDLE)LB_ERR ) ) {
+
+ fSelect = (BYTE)( ! ( (*pfnGetSelect) ( pListItem ) ) );
+
+ (*pfnSetSelect) ( pListItem, fSelect );
+
+ // Now, grab the items rectangle and invalidate it.
+
+ SendMessage ( hWndListBox, LB_GETITEMRECT, pHdr->unFocusItem, (LONG)&rcTemp );
+ InvalidateRect ( hWndListBox, &rcTemp, FALSE );
+ }
+
+
+} /* end DLM_SpaceBarPressed() */
+
+
+/****************************************************************************
+GSH
+ Name: DLM_ReturnKeyPressed()
+
+ Description: This function processes the space bar by checking or
+ unchecking the item in focus, then tagging and setting
+ the focus of the next item in the list.
+
+ Returns: Nothing.
+
+****************************************************************************/
+
+VOID DLM_ReturnKeyPressed (
+
+HWND hWndListBox, // I - handle to the list box window.
+DLM_HEADER_PTR pHdr, // I - pointer to the header of the list to use.
+LPWORD pwKey ) // IO - pointer to the key value.
+
+{
+ WORD wListBoxIDC;
+ PDS_WMINFO pWinInfo;
+ MP1 mpSend1;
+ MP2 mpSend2;
+
+ // Set the key information being careful to change the return key to
+ // to a space key to the list box so that this item in the list is the
+ // only tagged item.
+
+ pHdr->wKeyValue = *pwKey;
+ pHdr->fKeyDown = TRUE ;
+ *pwKey = VK_SPACE ;
+
+ // Determine the list box to send the double-click message to.
+
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr ( GetParent ( hWndListBox ) );
+
+ if ( WMDS_GetWinActiveList ( pWinInfo ) == WMDS_GetWinTreeList ( pWinInfo ) ) {
+ wListBoxIDC = WMIDC_TREELISTBOX;
+ }
+ else {
+ wListBoxIDC = WMIDC_FLATLISTBOX;
+ }
+
+ pHdr->fKeyUp = TRUE;
+
+ SET_WM_COMMAND_PARAMS( wListBoxIDC, LBN_DBLCLK, hWndListBox, mpSend1, mpSend2 );
+
+// DLM_LBNmessages ( GetParent ( hWndListBox ), mpSend1, mpSend2 );
+
+ PostMessage ( GetParent ( hWndListBox ), WM_COMMAND, mpSend1, mpSend2 );
+
+} /* end DLM_ReturnKeyPressed() */
+
+
+/****************************************************************************
+GSH
+ Name: DLM_CharToItem()
+
+ Description: Passes the character to a callback function to see if
+ an item can be selected based on that character.
+
+ Modified: 12-2-91
+
+ Returns: TRUE if the char was used to select an item in the list
+ box, otherwise, FALSE.
+
+****************************************************************************/
+
+BOOL DLM_CharToItem (
+
+HWND hWndListBox, // I - handle to the list box window.
+DLM_HEADER_PTR pHdr, // I - pointer to the header of the list to use.
+LPWORD pwKey ) // IO - pointer to the key value.
+
+{
+ BOOL rc;
+ SET_OBJECTS_PTR pfnSetObjects;
+ LMHANDLE pListItem;
+ WORD wAsciiKey;
+
+ // Determine the ASCII key code from the Virtual key code.
+
+ wAsciiKey = (WORD) MapVirtualKey ( *pwKey, 2 );
+
+ // Get the list item handle.
+
+ pListItem = (LMHANDLE)SendMessage ( hWndListBox,
+ LB_GETITEMDATA,
+ pHdr->unFocusItem,
+ 0L
+ );
+
+ if ( pListItem != (LMHANDLE)LB_ERR ) {
+
+ pfnSetObjects = (SET_OBJECTS_PTR) DLM_GSetObjects( pHdr );
+
+ // CALL BACK the application.
+
+ rc = (BOOL)( (*pfnSetObjects) ( pListItem, (WORD)WM_DLMCHAR, wAsciiKey ) );
+ }
+ else {
+ rc = FALSE;
+ }
+
+ return rc;
+
+} /* end DLM_WMCharToItem() */
diff --git a/private/utils/ntbackup/src/dlm_updt.c b/private/utils/ntbackup/src/dlm_updt.c
new file mode 100644
index 000000000..ff4f465e8
--- /dev/null
+++ b/private/utils/ntbackup/src/dlm_updt.c
@@ -0,0 +1,1014 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: wmupdate.c
+
+ Description: This file contains routines for display list manager.
+
+ The following routines are in this module:
+
+
+ DLM_Update
+ DLM_UpdateTags
+
+ $Log: J:\ui\logfiles\dlm_updt.c_v $
+
+ Rev 1.29.1.0 21 Jan 1994 08:57:10 GREGG
+Changed MEM_Free calls to free.
+
+ Rev 1.29 15 Jun 1993 10:56:48 MIKEP
+enable c++
+
+ Rev 1.28 14 Jun 1993 20:13:12 MIKEP
+enable c++
+
+ Rev 1.27 14 May 1993 16:22:24 GLENN
+Removed if statement using bogus dhListItem.
+
+ Rev 1.26 06 May 1993 13:16:26 MIKEP
+Fix directories in right window blowing up. Rob Griffis fixed
+the file. I just checked it in.
+
+ Rev 1.25 11 Dec 1992 18:28:46 GLENN
+Added selection frame rectangle support based on horizontal extent of a list box.
+
+ Rev 1.24 11 Nov 1992 16:30:00 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.23 01 Nov 1992 15:47:14 DAVEV
+Unicode changes
+
+ Rev 1.22 14 Oct 1992 15:48:28 GLENN
+Added Selection Framing Support for List Boxes without the FOCUS.
+
+ Rev 1.21 07 Oct 1992 13:48:34 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.20 04 Oct 1992 19:33:18 DAVEV
+Unicode Awk pass
+
+ Rev 1.19 29 Jul 1992 14:14:14 GLENN
+ChuckB checked in after NT fixes.
+
+ Rev 1.18 11 Jun 1992 10:19:52 JOHNWT
+fixed syntax error
+
+ Rev 1.17 10 Jun 1992 11:05:10 STEVEN
+NULL would not compile for mips
+
+ Rev 1.16 15 May 1992 13:32:12 MIKEP
+nt pass 2
+
+ Rev 1.15 19 Mar 1992 11:08:56 ROBG
+Added logic when adding an item to call DLM_SetHorizontalExt.
+
+ Rev 1.14 19 Mar 1992 10:44:00 ROBG
+Corrected problem with dhListItem to be initialized to NULL.
+
+ Rev 1.13 17 Mar 1992 16:19:42 ROBG
+Added logic to send out a HORIZONTALEXTENT
+
+ Rev 1.12 03 Mar 1992 18:21:44 GLENN
+Put in error handling.
+
+ Rev 1.11 07 Feb 1992 16:09:58 STEVEN
+fix casting of errors from sendmessage to WORD
+
+ Rev 1.10 06 Feb 1992 18:34:28 STEVEN
+wStatus should be INT not WORD
+
+ Rev 1.9 06 Feb 1992 11:00:50 ROBG
+Changed DLM_UPDATELIST to use RectVisible call to find the bottom
+item displayed in the listbox.
+
+ Rev 1.8 04 Feb 1992 16:08:08 STEVEN
+various bug fixes for NT
+
+ Rev 1.7 22 Jan 1992 12:29:56 GLENN
+Clean up.
+
+ Rev 1.6 15 Jan 1992 15:15:44 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.5 07 Jan 1992 10:11:24 ROBG
+Changes to support variable-width multicolumn listboxes.
+
+ Rev 1.4 26 Dec 1991 17:23:48 ROBG
+New and Improved.
+
+ Rev 1.3 06 Dec 1991 17:31:02 GLENN
+Added code to allow adding a list item with a NULL dhStartItem passed
+
+ Rev 1.2 02 Dec 1991 10:40:38 ROBG
+Added logic to clear out a flat listbox in a DLM_WMUPDATELIST message.
+
+ Rev 1.1 26 Nov 1991 16:26:32 ROBG
+Added validity checks for the window handles, info structure, and the
+dlm display header.
+
+ Rev 1.0 20 Nov 1991 19:24:04 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static VOID DLM_ResetWidth( PDS_WMINFO pWinInfo ) ;
+
+/****************************************************************************
+
+ Name: DLM_Update
+
+ Description: This function will update the list according
+ to incoming parameters.
+
+ Modified: 4/30/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_PROCESS_FAILED
+ DLMERR_OUT_OF_MEMORY
+
+****************************************************************************/
+
+WORD DLM_Update(
+
+HWND hWnd , // I - Handle of parent window
+BYTE bType , // I - Type of list ( Hierarchical or Flat )
+WORD wMsg , // I - Type of update operation
+LMHANDLE dhStartItem , // I - Address of item to start with
+USHORT unNumToUpdate ) // I - Number of items to update
+
+{
+
+ INT iStatus ;
+ DLM_HEADER_PTR pHdr ;
+ GET_COUNT_PTR pfnGetItemCount ;
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_NEXT_PTR pfnGetNext ;
+
+ LMHANDLE pdsListHdr ;
+ PDS_WMINFO pWinInfo ;
+ HWND hWndLB ;
+ LMHANDLE dhListItem ;
+ INT iCurSel ;
+ INT iTstSel ;
+ INT iTopIndex ;
+ INT iBotIndex ;
+ INT iError ;
+ INT iCnt ;
+ RECT rect ;
+ RECT listrect ;
+ USHORT usIndex ;
+ WORD xNewOrigin ;
+ WORD wScrollPos ;
+ POINT Point ;
+ RECT ChildRect ;
+ HWND hWndNewList ;
+ HWND hWndFocus ;
+ HWND hWndActive ;
+ HDC hDC ;
+
+ iStatus = 0 ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return( DLMERR_PROCESS_FAILED ) ;
+ }
+
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+
+ // Extra Bytes for window must be defined.
+
+ if ( !pWinInfo ) {
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+
+ switch ( bType ) {
+
+ case DLM_TREELISTBOX :
+
+ pHdr = pWinInfo->pTreeDisp ;
+ hWndLB = pWinInfo->hWndTreeList ;
+ pdsListHdr = ( LMHANDLE ) pWinInfo->pTreeList ;
+ break ;
+
+ case DLM_FLATLISTBOX :
+ default :
+
+ pHdr = pWinInfo->pFlatDisp ;
+ hWndLB = pWinInfo->hWndFlatList ;
+ pdsListHdr = ( LMHANDLE ) pWinInfo->pFlatList ;
+
+ break ;
+
+ }
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndLB ) ) {
+ return( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ // List header must be defined.
+
+ if ( !pdsListHdr ) {
+
+ // If the message is WM_DLMUPDATELIST and its the flat list, then
+ // initialize the list to having no items.
+
+ if ( ( wMsg == WM_DLMUPDATELIST ) && ( bType == DLM_FLATLISTBOX) ) {
+
+ pHdr->usItemCount = 0 ;
+ pHdr->wHorizontalExtent = 0 ;
+ SendMessage ( hWndLB, WM_SETREDRAW, FALSE, 0L ) ;
+ SendMessage ( hWndLB, LB_RESETCONTENT, (MP1)0, (MP2)0 ) ;
+ SendMessage ( hWndLB, WM_SETREDRAW, TRUE, 0L ) ;
+ return( 0 ) ;
+ }
+
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+
+ switch ( wMsg ) {
+
+ case WM_DLMUPDATEITEM:
+
+ iCurSel = (INT) SendMessage ( hWndLB, LB_FINDSTRING, (MP1)-1, (LONG) dhStartItem ) ;
+
+ if ( iCurSel != LB_ERR ) {
+
+ iStatus = (INT) SendMessage ( hWndLB, LB_GETITEMRECT, iCurSel, (LONG) &rect ) ;
+
+ if (iStatus != LB_ERR) {
+ InvalidateRect( hWndLB, &rect, FALSE ) ;
+ UpdateWindow ( hWndLB ) ;
+
+ }
+
+ } else {
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ break ;
+
+ case WM_DLMUPDATELIST:
+
+
+ // This is only good for hierarchical lists because only
+ // the current selection is saved.
+
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, FALSE, 0L ) ;
+
+ wScrollPos = (WORD) GetScrollPos( hWndLB, SB_HORZ ) ;
+
+ iCurSel = (INT) SendMessage( hWndLB, LB_GETCURSEL, 0, 0L ) ;
+ iTopIndex = (INT) SendMessage( hWndLB, LB_GETTOPINDEX, 0, 0L ) ;
+
+ {
+
+ /* Find last displayed line in listbox.*/
+
+ GetClientRect ( hWndLB, &listrect ) ;
+
+ iBotIndex = iTopIndex ;
+ iError = (WORD) SendMessage ( hWndLB, LB_GETITEMRECT, iBotIndex,
+ (LONG) ( LPRECT ) &rect ) ;
+
+ // Get the Device Context for the window.
+
+ hDC = GetDC( hWndLB ) ;
+
+ while( iError != LB_ERR ) {
+
+ // Find the last item's rectangle that is visible.
+
+ if ( !RectVisible ( hDC, &rect ) ) {
+
+ // Break out of the loop when an item is not displayed.
+
+ break ;
+ }
+
+ iError = (INT) SendMessage ( hWndLB, LB_GETITEMRECT, ++iBotIndex,
+ (LONG) ( LPRECT ) &rect ) ;
+ }
+
+ ReleaseDC( hWndLB, hDC ) ;
+
+ iBotIndex-- ;
+ }
+
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, FALSE, 0L ) ;
+
+
+ SendMessage ( hWndLB, LB_RESETCONTENT, (MP1)0, (MP2)0 ) ;
+
+ // If the window is a DLM_FLATLISTBOX and the
+ // mode is multicolumn, then destroy the window and
+ // recreate it so the column width can be recalculated.
+
+ if ( ( bType == DLM_FLATLISTBOX ) &&
+ ( DLM_GMode( pHdr ) == DLM_MULTICOLUMN ) ) {
+
+ // We want to reset the width.
+
+ DLM_ResetWidth( pWinInfo ) ;
+ SendMessage( hWndLB, LB_SETCOLUMNWIDTH, pHdr->cxColWidth , 0L ) ;
+ }
+
+ pfnGetItemCount = (GET_COUNT_PTR) DLM_GGetItemCount( pHdr ) ;
+ pfnGetFirstItem = (GET_FIRST_PTR) DLM_GGetFirstItem( pHdr ) ;
+ pfnGetNext = (GET_NEXT_PTR) DLM_GGetNext ( pHdr ) ;
+
+ pHdr->usItemCount = (USHORT) ( (*pfnGetItemCount) (pdsListHdr) ) ;
+
+ pHdr->wHorizontalExtent = 0 ;
+
+ xNewOrigin = pHdr->xOrigin ;
+
+ usIndex = pHdr->usItemCount ;
+
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, FALSE, 0L ) ;
+
+ if (usIndex) {
+ dhListItem = (LMHANDLE) ( (*pfnGetFirstItem) (pdsListHdr) ) ;
+ } else {
+ dhListItem = NULL ;
+ }
+
+ // Set the horizontal extent for the first object.
+
+ if ( bType == DLM_FLATLISTBOX ) {
+ DLM_SetHorizontalExt( hWndLB, pHdr, dhListItem ) ;
+ }
+
+ while( (dhListItem ) && ( usIndex > 0 ) ) {
+
+ iStatus = (INT) SendMessage( hWndLB, LB_ADDSTRING, 0, (LONG) dhListItem ) ;
+ dhListItem = (LMHANDLE) ( (*pfnGetNext) (dhListItem) ) ;
+ usIndex--;
+
+ }
+
+ if ( dhStartItem ) {
+
+ /* Redefine the CurSel if possible */
+
+ iTstSel = (INT) SendMessage ( hWndLB, LB_FINDSTRING, (MP1)-1, (LONG) dhStartItem ) ;
+ if ( iTstSel != LB_ERR ) {
+ iCurSel = iTstSel ;
+ }
+ }
+
+ if ( DLM_GMode( pHdr ) == DLM_COLUMN_VECTOR ) {
+
+ iStatus = (INT) SendMessage (hWndLB, LB_SETSEL, 1 , 0L );
+
+ } else {
+
+ if ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) {
+ if ( iCurSel != LB_ERR ) {
+ pHdr->cLastTreeSelect = (WORD)iCurSel ;
+ }
+ }
+
+ if ( iCurSel != LB_ERR) {
+
+ iStatus = (INT) SendMessage( hWndLB, LB_SETCURSEL, iCurSel, 0L ) ;
+ }
+ }
+
+ // If the new current selection is less than the topindex,
+ // then set the top of the list to the cursel + iCnt/2.
+ // This logic should really put the current selection in
+ // middle of display list.
+
+ if ( iCurSel < iTopIndex ) {
+
+ iCnt = (INT) (iBotIndex - iTopIndex + 1);
+ iTopIndex = (INT) (iCurSel - iCnt/2);
+
+ iStatus = (INT) SendMessage( hWndLB, LB_SETTOPINDEX, iTopIndex, 0L ) ;
+
+ }
+
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, TRUE, 0L ) ;
+
+ InvalidateRect ( hWndLB, NULL, TRUE ) ;
+ UpdateWindow ( hWndLB ) ;
+
+ break ;
+
+ case WM_DLMDELETEITEMS:
+
+ usIndex = unNumToUpdate ;
+
+ if ( usIndex ) {
+
+ if ( dhStartItem ) {
+
+ iCurSel = (INT) SendMessage ( hWndLB, LB_FINDSTRING, (MP1)-1, (LONG) dhStartItem ) ;
+
+ if ( iCurSel == LB_ERR ) {
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ iCurSel++ ;
+ }
+ else {
+ iCurSel = 0;
+ }
+
+ iCnt = (INT) SendMessage ( hWndLB, LB_GETCOUNT, (MP1)0, (MP2)0 ) ;
+
+ // If this is the last item, decrease the iCurSel by one so
+ // that the last item is deleted.
+
+ if ( iCurSel == iCnt ) iCurSel-- ;
+
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, FALSE, 0L ) ;
+
+ while ( usIndex ) {
+
+ if ( usIndex == 1 ) {
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, TRUE, 0L ) ;
+ }
+
+ iStatus = (INT) SendMessage ( hWndLB, LB_DELETESTRING, iCurSel, (MP2)0 ) ;
+
+ if ( iStatus == LB_ERR ) {
+ return( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ usIndex--;
+ }
+
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, TRUE, 0L ) ;
+ pHdr->usItemCount -= unNumToUpdate ; /* Trust the count */
+
+ }
+
+ break ;
+
+ case WM_DLMADDITEMS:
+
+ if ( unNumToUpdate ) {
+
+ // Get the GetFirstItem() and GetNext() function pointers
+ // to the app area.
+
+ pfnGetFirstItem = (GET_FIRST_PTR) DLM_GGetFirstItem( pHdr ) ;
+ pfnGetNext = (GET_NEXT_PTR) DLM_GGetNext ( pHdr ) ;
+
+ if ( ! dhStartItem ) {
+
+ // A NULL start item was passed.
+
+ dhListItem = (LMHANDLE) ( (*pfnGetFirstItem) (pdsListHdr) ) ;
+ iCurSel = 0 ;
+ }
+ else {
+
+ // A potentially valid item was passed.
+
+ iCurSel = (INT) SendMessage ( hWndLB, LB_FINDSTRING, (MP1)-1, (LONG) dhStartItem ) ;
+
+ if ( iCurSel == LB_ERR ) {
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ dhListItem = (LMHANDLE) ( (*pfnGetNext) (dhStartItem) ) ;
+ iCurSel++ ;
+ }
+
+ // Turn off the redraw. Don't forget to turn it back on
+ // right before inserting the last item.
+
+ if ( unNumToUpdate > 1 ) {
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, FALSE, 0L ) ;
+ }
+
+ // If the current selection is at the end of the list,
+ // APPEND the item(s) to the end of the list. Otherwise,
+ // INSERT it in where it is supposed to go.
+
+ iCnt = (INT) SendMessage ( hWndLB, LB_GETCOUNT, (MP1)0, (MP2)0 ) ;
+
+ if ( iCurSel == iCnt ) {
+
+ // APPEND to end of list.
+
+ // Set the horizontal extent for an object.
+
+ if ( bType == DLM_FLATLISTBOX ) {
+ DLM_SetHorizontalExt( hWndLB, pHdr, dhListItem ) ;
+ }
+
+ for ( usIndex = 0; usIndex < unNumToUpdate; usIndex++ ) {
+
+ if ( ! dhListItem ) {
+ return( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ iStatus = (INT) SendMessage ( hWndLB, LB_INSERTSTRING, (MP1)-1, (LONG) dhListItem ) ;
+ dhListItem = (LMHANDLE) ( (*pfnGetNext) (dhListItem) ) ;
+ }
+ }
+ else {
+
+ // INSERT in the list.
+
+ // Set the horizontal extent for an object.
+
+ if ( bType == DLM_FLATLISTBOX ) {
+ DLM_SetHorizontalExt( hWndLB, pHdr, dhListItem ) ;
+ }
+
+ for ( usIndex = 0; usIndex < unNumToUpdate; usIndex++ ) {
+
+ if ( ! dhListItem ) {
+ return( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ iStatus = (INT) SendMessage ( hWndLB, LB_INSERTSTRING, iCurSel++, (LONG) dhListItem ) ;
+ dhListItem = (LMHANDLE) ( (*pfnGetNext) (dhListItem) ) ;
+ }
+ }
+
+ if ( unNumToUpdate > 1 ) {
+ iStatus = (INT) SendMessage ( hWndLB, WM_SETREDRAW, TRUE, 0L ) ;
+ InvalidateRect ( hWndLB, (LPRECT)NULL, TRUE );
+ }
+
+ pHdr->usItemCount += unNumToUpdate ;
+
+ }
+
+ break ;
+ }
+
+ return(0) ;
+}
+
+
+/****************************************************************************
+
+ Name: DLM_ResetWidth
+
+ Description: This function will reset the width of a multicolumn
+ flat list.
+
+ Modified: 5/06/1993
+
+ Returns: none
+
+ Notes:
+
+ See also:
+
+ Declaration:
+
+****************************************************************************/
+
+VOID DLM_ResetWidth(
+
+PDS_WMINFO pWinInfo )
+
+{
+
+ INT itemWidth ;
+ DLM_HEADER_PTR pdsHdr ;
+
+ GET_COUNT_PTR pfnGetItemCount ;
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_OBJECTS_PTR pfnGetObjects ;
+
+ LMHANDLE pdsListHdr ;
+ LMHANDLE dhListItem = (LMHANDLE)0;
+ DLM_ITEM_PTR lpDispItem ;
+ LPBYTE lpObjLst ;
+ USHORT usCnt ;
+ BYTE bObjCnt ;
+ short cxPos ;
+ HWND hWndLB ;
+ HWND hWndParent ;
+ WORD wType ;
+
+ pdsHdr = pWinInfo->pFlatDisp ;
+ hWndLB = pWinInfo->hWndFlatList ;
+
+ hWndParent = GetParent( hWndLB ) ;
+
+ pdsListHdr = ( LMHANDLE ) WMDS_GetFlatList ( pWinInfo );
+
+ wType = WMDS_GetWinType( pWinInfo ) ;
+
+ /* The following steps are taken to set up the appropiate
+ ** width and height.
+ **
+ ** IF pdsHdr exists and pdsListHdr exists and count > 0
+ ** BEGIN
+ ** Get the first item on the queue.
+ ** IF item exists
+ ** BEGIN
+ ** . Get the objects of the item.
+ ** . Calculate the width and height based on the objects found.
+ ** END
+ ** END
+ ** ELSE
+ ** set width and height to defaults ;
+ */
+
+ // Some window type are never multi-column
+ // Just reset the global reference of window handle.
+
+ switch ( wType ) {
+
+ case WMTYPE_JOBS :
+ case WMTYPE_MACROS :
+ case WMTYPE_TAPES :
+ case WMTYPE_DEBUG :
+ case WMTYPE_LOGFILES :
+ case WMTYPE_SERVERS :
+ case WMTYPE_LOGVIEW :
+ case WMTYPE_SEARCH :
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE :
+#endif
+
+ pdsHdr = NULL ;
+ break ;
+ }
+
+ if ( pdsHdr ) {
+ pfnGetItemCount = (GET_COUNT_PTR) DLM_GGetItemCount( pdsHdr ) ;
+ pfnGetFirstItem = (GET_FIRST_PTR) DLM_GGetFirstItem( pdsHdr ) ;
+ pfnGetObjects = (GET_OBJECTS_PTR) DLM_GGetObjects ( pdsHdr ) ;
+
+ if ( pdsListHdr ) {
+ usCnt = (USHORT) ( (*pfnGetItemCount) (pdsListHdr) );
+ if ( usCnt ) {
+ dhListItem = (LMHANDLE) ( (*pfnGetFirstItem) (pdsListHdr) ) ;
+ if ( dhListItem ) {
+ lpObjLst = (LPBYTE) ( (*pfnGetObjects) (dhListItem) ) ;
+ lpDispItem = DLM_GetFirstObject( lpObjLst, &bObjCnt ) ;
+
+ // Calculate the width by spanning
+ // the object list, adding up the widths
+ // of the objects.
+
+ cxPos = 0 ;
+
+ while (bObjCnt) {
+
+ DLM_GetWidth ( hWndParent, pdsHdr,
+ &cxPos, lpDispItem ) ;
+
+ // Special Logic for long strings.
+ // If the string is greater than 5, then take off 33%.
+
+
+ if ( ( DLM_ItembType ( lpDispItem ) == DLM_TEXT_ONLY ) &&
+ ( DLM_GDisplay( pdsHdr ) == DLM_LARGEBITMAPSLTEXT ) ){
+
+ LONG lLen ;
+ lLen = strlen( (CHAR_PTR)DLM_ItemqszString( lpDispItem ) );
+
+ if ( lLen > 5 ) {
+ cxPos -= ( pdsHdr->cxBeforeText +
+ ( DLM_ItembMaxTextLen( lpDispItem )*( pdsHdr->cxTextWidth ) ) ) / 3 ;
+ }
+ }
+
+ lpDispItem++;
+ bObjCnt--;
+ }
+
+ // Added left and right 2 pixel area for focus and add 5 for right margin
+
+ itemWidth = (int) ( cxPos + 2*(-mwDLMInflate ) + 5 ) ;
+
+ pdsHdr->cxColWidth = (USHORT) itemWidth ;
+ }
+
+ }
+ }
+ }
+
+ }
+
+/****************************************************************************
+
+ Name: DLM_UpdateTags
+
+ Description: This function will set the tag field of all the items
+ in the list.
+
+ Modified: 4/30/1991
+
+ Returns: 0 if successful.
+
+ Valid error returns:
+
+ DLMERR_OUT_OF_MEMORY
+ DLMERR_LIST_NOT_FOUND
+ Notes:
+
+ See also:
+
+ Declaration:
+
+****************************************************************************/
+
+WORD DLM_UpdateTags(
+
+HWND hWnd , // I - Handle of parent window of listbox.
+BYTE bType ) // I - Type of listbox ( Hierarchical or Flat )
+
+{
+
+ INT iStatus ;
+ WORD wSelCnt ;
+ LPINT pSelArray ;
+ DLM_HEADER_PTR pHdr ;
+ PDS_WMINFO pWinInfo ;
+ LMHANDLE pdsListHdr ;
+ USHORT usCnt ;
+ LMHANDLE dhListItem ;
+ HWND hWndLB ;
+ WORD wIndex ;
+
+ GET_FIRST_PTR pfnGetFirstItem ;
+ GET_NEXT_PTR pfnGetNext ;
+ SET_TAG_PTR pfnSetTag ;
+
+
+ iStatus = 0 ;
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWnd ) ) {
+ return( DLMERR_PROCESS_FAILED ) ;
+ }
+
+
+ pWinInfo = WM_GetInfoPtr( hWnd ) ;
+
+ // Extra Bytes for window must be defined.
+
+ if ( !pWinInfo ) {
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+
+ switch ( bType ) {
+
+ case DLM_TREELISTBOX :
+
+ pHdr = pWinInfo->pTreeDisp ;
+ hWndLB = pWinInfo->hWndTreeList ;
+ pdsListHdr = ( LMHANDLE ) pWinInfo->pTreeList ;
+
+ break ;
+
+ case DLM_FLATLISTBOX :
+ default :
+
+ pHdr = pWinInfo->pFlatDisp ;
+ hWndLB = pWinInfo->hWndFlatList ;
+ pdsListHdr = ( LMHANDLE ) pWinInfo->pFlatList ;
+
+ break ;
+
+ }
+
+ /* Exception Handling */
+
+ // Must be valid window.
+
+ if ( !IsWindow( hWndLB ) ) {
+ return( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ if ( !pHdr ) {
+ return ( DLMERR_LIST_NOT_FOUND ) ;
+ }
+
+ // List header must be defined.
+
+ if ( !pdsListHdr ) {
+ return ( DLMERR_PROCESS_FAILED ) ;
+ }
+
+ if ( pHdr->usItemCount == 0 ) {
+ return (0) ;
+ }
+
+ /* Only multiselection lists are supported.
+ Only Hierarchical lists are single selection */
+
+
+ if ( DLM_GMode( pHdr ) == DLM_HIERARCHICAL ) {
+ return( 0 ) ;
+ }
+
+ wSelCnt = (WORD) SendMessage (hWndLB, LB_GETSELCOUNT, (MP1)0, (MP2)0 ) ;
+
+ if ( wSelCnt > 0 ) {
+ pSelArray = (LPINT)calloc( wSelCnt, sizeof( int ) ) ;
+ if ( pSelArray ) {
+
+ iStatus = (INT) SendMessage (hWndLB, LB_GETSELITEMS, wSelCnt, (LONG) &pSelArray[0] ) ;
+ } else {
+
+ return ( DLMERR_OUT_OF_MEMORY ) ;
+ }
+
+ } else {
+ pSelArray = NULL ;
+ }
+
+
+ /* Walk through the list and set all the tags to 0 */
+
+ pfnGetFirstItem = (GET_FIRST_PTR) DLM_GGetFirstItem( pHdr ) ;
+ pfnGetNext = (GET_NEXT_PTR) DLM_GGetNext ( pHdr ) ;
+ pfnSetTag = (SET_TAG_PTR) DLM_GSetTag ( pHdr ) ;
+
+ usCnt = pHdr->usItemCount ;
+
+ dhListItem = (LMHANDLE) ( (*pfnGetFirstItem) ( pdsListHdr ) ) ;
+
+ while( (dhListItem ) && ( usCnt > 0 ) ) {
+ (*pfnSetTag) (dhListItem, 0 ) ;
+ dhListItem = (LMHANDLE) ( (*pfnGetNext) (dhListItem) ) ;
+ usCnt--;
+
+ }
+
+
+ /* Now set the tags that are set */
+
+ for(wIndex=0; wIndex<wSelCnt; wIndex++ ) {
+
+ dhListItem = (LMHANDLE) SendMessage ( hWndLB, LB_GETITEMDATA,
+ (WORD) *(pSelArray+wIndex), 0L ) ;
+
+ if ( (LONG) dhListItem != LB_ERR ) {
+ (*pfnSetTag) (dhListItem, 1 ) ;
+ }
+ }
+
+ if( pSelArray ) {
+ free( pSelArray ) ;
+ }
+
+ return( 0 ) ;
+
+}
+
+
+/****************************************************************************
+GSH
+ Name: DLM_UpdateFocus
+
+ Description: This function will update the list box with the proper
+ selection and focus displays.
+
+ Returns: 0 if successful.
+
+****************************************************************************/
+
+WORD DLM_UpdateFocus (
+
+HWND hWndLB, // I - Handle of the listbox window.
+BOOL fSetFocus ) // I - Set the focus or Kill the focus.
+
+{
+
+ INT nStatus;
+ INT nSelCnt;
+ LPINT pSelArray;
+ DLM_HEADER_PTR pHdr;
+ PDS_WMINFO pWinInfo;
+ PVOID pdsListHdr;
+ INT nIndex;
+ RECT Rect;
+ BYTE bType;
+
+
+ nStatus = 0;
+ pWinInfo = WM_GetInfoPtr ( GetParent ( hWndLB ) );
+ pHdr = DLM_GetDispHdr ( hWndLB );
+
+
+ if ( ! pWinInfo || ! pHdr ) {
+ return DLMERR_PROCESS_FAILED;
+ }
+
+ bType = DLM_GMode ( pHdr );
+
+ if ( fSetFocus ) {
+
+ // Set the currently active list window.
+
+ WMDS_SetWinActiveList ( pWinInfo, hWndLB );
+ }
+ else {
+
+ pHdr->fKeyUp = FALSE;
+ pHdr->fKeyDown = FALSE;
+
+// WMDS_SetWinActiveList ( pWinInfo, (HWND)NULL );
+
+ }
+
+ switch ( bType ) {
+
+ case DLM_TREELISTBOX :
+
+ pdsListHdr = ( PVOID ) pWinInfo->pTreeList;
+
+ break;
+
+ case DLM_FLATLISTBOX :
+ default :
+
+ pdsListHdr = ( PVOID ) pWinInfo->pFlatList;
+
+ break;
+
+ }
+
+ /* Exception Handling */
+
+ if ( pHdr->usItemCount == 0 ) {
+ return 0;
+ }
+
+ // Only multiselection lists are supported.
+ // Only Hierarchical lists are single selection.
+
+
+ if ( DLM_GMode ( pHdr ) == DLM_HIERARCHICAL ) {
+ return 0;
+ }
+
+ nSelCnt = (INT) SendMessage ( hWndLB, LB_GETSELCOUNT, (MP1)0, (MP2)0 );
+
+ if ( nSelCnt <= 0 ) {
+
+ return 0;
+ }
+
+ pSelArray = (LPINT)calloc ( nSelCnt, sizeof( INT ) );
+
+ if ( ! pSelArray ) {
+
+ return DLMERR_OUT_OF_MEMORY;
+ }
+
+ nStatus = (INT) SendMessage ( hWndLB, LB_GETSELITEMS, nSelCnt, (LONG) &pSelArray[0] );
+
+ // Invalidate the rectangles of the selected items.
+
+ for ( nIndex = 0; nIndex < nSelCnt; nIndex++ ) {
+
+ nStatus = (INT) SendMessage ( hWndLB,
+ LB_GETITEMRECT,
+ (WORD) *(pSelArray+nIndex),
+ (LONG) (LPRECT) &Rect
+ );
+
+ if ( nStatus != LB_ERR ) {
+
+ // Make sure that the one just above this one gets repainted also.
+
+ if ( Rect.top > 0 ) {
+ Rect.top--;
+ }
+
+ InvalidateRect ( hWndLB, &Rect, FALSE );
+ }
+ }
+
+ if ( pSelArray ) {
+ free( pSelArray );
+ }
+
+ return 0;
+
+} /* end DLM_UpdateFocus() */
+
+
diff --git a/private/utils/ntbackup/src/do_back.c b/private/utils/ntbackup/src/do_back.c
new file mode 100644
index 000000000..9a2923e60
--- /dev/null
+++ b/private/utils/ntbackup/src/do_back.c
@@ -0,0 +1,3457 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_back.c
+
+ Description:
+
+ $Log: J:/UI/LOGFILES/DO_BACK.C_V $
+
+ Rev 1.144.1.17 16 Jun 1994 17:43:50 GREGG
+Fixed setting and clearing of YESYES flag.
+
+ Rev 1.144.1.16 24 May 1994 20:07:04 GREGG
+Improved handling of ECC, SQL, FUTURE_VER and OUT_OF_SEQUENCE tapes.
+
+ Rev 1.144.1.15 04 May 1994 14:13:22 STEVEN
+fix dlt settling time
+
+ Rev 1.144.1.14 28 Mar 1994 14:33:56 GREGG
+In MSG_TBE_ERROR, compare strm_id to STRM_INVALID instead of 0.
+
+ Rev 1.144.1.13 16 Mar 1994 15:42:06 chrish
+Fixed EPR# 0279 - During append operation a replace instead of an append
+mode was written to the event log.
+
+ Rev 1.144.1.12 23 Feb 1994 14:55:10 STEVEN
+remove corrupt.lst support from ntbackup
+
+ Rev 1.144.1.11 22 Feb 1994 17:38:56 GREGG
+From Mike P. : Disable abort during EOM processing.
+
+ Rev 1.144.1.10 01 Feb 1994 14:44:10 chrish
+Added another fix for EPR 0214 ( /R command line process ). Previous
+fix did not handle the case for an empty tape or an erased tape.
+
+ Rev 1.144.1.9 28 Jan 1994 14:04:18 MIKEP
+fix wait on file if file goes away
+
+ Rev 1.144.1.8 18 Jan 1994 18:08:26 chrish
+Added fix for EPR 0214. Added logic to handle command-line backup
+/R option (restrict access to owner ...). The flag was being set but
+no logic to handle the /R option.
+
+ Rev 1.144.1.7 17 Jan 1994 15:36:42 MIKEP
+fix unicode warnings
+
+ Rev 1.144.1.6 12 Jan 1994 10:23:00 MikeP
+add abort in middle of file handling
+
+ Rev 1.144.1.5 14 Dec 1993 12:19:48 BARRY
+Don't write to gszTprintfBuffer, use yprintf
+
+ Rev 1.144.1.4 01 Dec 1993 17:33:04 mikep
+added VLM_SQL_TAPE support
+
+ Rev 1.144.1.3 24 Nov 1993 19:12:28 GREGG
+Added hardware compression option to backup dialog and config.
+
+ Rev 1.144.1.2 04 Nov 1993 15:46:46 STEVEN
+japanese changes
+
+ Rev 1.144.1.1 29 Sep 1993 18:31:34 BARRY
+Handle access denied
+
+ Rev 1.144.1.0 15 Sep 1993 13:53:50 CARLS
+changes for displaying full path/file name detail if Log files
+
+ Rev 1.144 11 Aug 1993 15:57:18 GLENN
+Auto terminating runtime window only if there was an abnormal termination before auto verify.
+
+ Rev 1.143 05 Aug 1993 18:27:14 ZEIR
+fix .141, look at tpos if not -1, else look at cur_vcb
+
+ Rev 1.142 05 Aug 1993 17:21:02 CARLS
+added DidItOnce at TF_NEED_NEW_TAPE for append problem
+
+ Rev 1.141 03 Aug 1993 21:30:26 GREGG
+use tpos vs. vcb for seq req in NEED_NEW_TAPE
+
+ Rev 1.140 30 Jul 1993 14:21:40 CARLS
+fixed TF_WRONG_TAPE to check tape IDs before display message
+
+ Rev 1.139 30 Jul 1993 09:03:34 CARLS
+added VLM_ECC_TAPE & VLM_FUTURE_VER
+
+ Rev 1.138 26 Jul 1993 14:55:38 CARLS
+added code for MSG_COMM_FAILURE
+
+ Rev 1.137 22 Jul 1993 18:35:10 KEVINS
+Corrected macro name.
+
+ Rev 1.136 22 Jul 1993 18:28:16 KEVINS
+Added support for tape drive settling time.
+
+ Rev 1.135 14 Jul 1993 14:57:50 chrish
+Correction to the below fix for Rev 1.133:
+Cayman EPR 0542: added code to support hardware compression while running
+a batch mode job.
+
+Placed the code in wrong place.
+
+ Rev 1.134 14 Jul 1993 09:25:08 CARLS
+changed code to call skipno dialog for file open
+
+ Rev 1.133 06 Jul 1993 09:50:58 chrish
+Cayman EPR 0542: added code to support hardware compression while running
+a batch mode job.
+
+ Rev 1.132 28 Jun 1993 16:26:08 CARLS
+added call to VLM_RemoveUnusedBSDs
+
+ Rev 1.131 27 Jun 1993 14:06:22 MIKEP
+continue work on status monitor stuff
+
+ Rev 1.130 21 Jun 1993 17:14:30 Aaron
+Put ifdef around call to NtDemoChangeTape (for OS_WIN32)
+
+ Rev 1.129 19 Jun 1993 13:53:32 MIKEP
+add wrong tape family msg box
+
+ Rev 1.128 18 Jun 1993 17:34:50 Aaron
+Retry for tape-not-inserted only for OS_WIN32
+
+ Rev 1.127 18 Jun 1993 16:47:26 CARLS
+added NtDemoChangeTape calls for NtDemo
+
+ Rev 1.126 15 Jun 1993 13:15:40 DARRYLP
+More status monitor features
+
+ Rev 1.125 14 Jun 1993 20:22:42 MIKEP
+enable c++
+
+ Rev 1.124 10 Jun 1993 13:48:12 CARLS
+added WMMB_NOYYCHECK to insert new tape after write-prot message
+
+ Rev 1.123 09 Jun 1993 19:05:48 MIKEP
+support wrong tape message from gregg.
+
+ Rev 1.122 09 Jun 1993 09:01:42 chrish
+Backup logging information, added more info such as the drive where the
+files are located.
+
+ Rev 1.121 08 Jun 1993 11:06:24 CARLS
+added code to look in the catalogs to see if tape has a transfer set
+
+ Rev 1.120 07 Jun 1993 15:46:28 GLENN
+Moved the VLM_CloseAll to beginning of command line job section and after dialog section.
+
+ Rev 1.119 07 Jun 1993 08:22:22 MIKEP
+fix warnings.
+
+ Rev 1.118 03 Jun 1993 14:30:08 DARRYLP
+Removed excess \ from backup and restore directory field upon abort
+
+ Rev 1.117 03 Jun 1993 12:40:46 DARRYLP
+Fix for event logging erroneous text - replace only occurs for the first
+backup set - subsequent sets (in the same backup operation) are appended.
+
+ Rev 1.116 27 May 1993 15:41:34 CARLS
+added calls to VLM_GetSSETonTapeAttribute for Transfer problem
+
+ Rev 1.115 26 May 1993 17:49:48 MIKEP
+Fix directory and file names updating.
+
+ Rev 1.114 26 May 1993 15:43:48 BARRY
+Retry for no-tape situations.
+
+ Rev 1.113 23 May 1993 14:15:52 MIKEP
+Try to fix 294-507 ntfs error displaying the time. Also fix
+typo in last checkin.
+
+ Rev 1.112 23 May 1993 13:43:04 MIKEP
+fix epr 294-489, adjust foreign tape as continaution tape msg.
+
+ Rev 1.111 22 May 1993 14:24:48 MIKEP
+fix dangerous code when getting stats ptr and no backup in progress.
+
+ Rev 1.110 22 May 1993 13:44:04 MIKEP
+Fix nostradamus epr #504, update the status windows the same for
+all tape operations.
+
+ Rev 1.109 21 May 1993 10:30:52 chrish
+This fix is for both CAYMAN and NOSTRADAMUS.
+
+NOSTRADAMUS EPR 0407: Fixed problem when backing up across tape, it would
+allow backing up onto the same tape. Fixed it such that it will not backup
+across tape of the same family.
+
+Also fixed a problem when using a command line backing, that on the second
+tape it would not warn user if he was overwriting a good tape. Thus fixed
+it such that it does check the second tape and warn the user that he is going
+to replace over a good tape. This problem is also encountered in CAYMAN.
+
+ Rev 1.108 17 May 1993 13:59:10 CARLS
+change to DM_StartSkipOpen call
+
+ Rev 1.107 12 May 1993 12:03:14 DARRYLP
+The runtime status listbox now displays the number of files skipped in
+each backup set - this information is also included in the log file.
+Prior to this fix, only the last backup set information remained on the
+screen.
+
+ Rev 1.106 10 May 1993 09:10:48 chrish
+CAYMAN EPR 0247: Added fix to report the drive being backed-up in the log
+files.
+
+ Rev 1.105 03 May 1993 11:38:20 chrish
+Nostradamous EPR 0172 and 0400. Added fix to display proper message when
+spanning tape. Current message gives impression that tape is rewinding
+when in effect tape has completed rewinding.
+
+ Rev 1.104 30 Apr 1993 14:38:58 chrish
+NOSTRADAMOUS EPR 0021 - When tape is rewindind and you trigger a command
+line backup ... you get a "No tape in drive" message even though a tape is
+in the drive (but is rewinding). Solution was to increase the loop count
+from 5 to 10 for getting a no tape in drive status before determining
+that a tape is really not in the drive. Also we by passes the message, it
+appears that message "No tape in drive" is really not necessary, because
+poll drive will also display a pop up message depending on the drive
+status.
+
+ Rev 1.103 27 Apr 1993 18:02:26 DARRYLP
+
+ Rev 1.102 27 Apr 1993 17:35:06 DARRYLP
+Fixed missing decl.
+
+ Rev 1.101 27 Apr 1993 16:01:50 DARRYLP
+Added Status monitor "stuff".
+
+ Rev 1.100 26 Apr 1993 17:00:30 CARLS
+fixed abort problem I put in
+
+ Rev 1.99 26 Apr 1993 10:11:42 MIKEP
+Add support for trefreshing tapes window.
+
+ Rev 1.98 22 Apr 1993 13:31:18 chrish
+Nostradamous fix: EPR 0116 - Suspend the elapse time counter when
+user presses the abort button during a backup.
+
+Cayman fix: EPR 0094 - When launcher triggers a backup that spans across
+two tapes the app will now terminate and go back to the launcher. Before
+the fix the app would require user intervention after the backup was done,
+now it will terminate automatically and return back to the launcher.
+
+ Rev 1.97 21 Apr 1993 13:31:48 CARLS
+don't call Job_Status - Abort_off if doing a verify after backup
+
+ Rev 1.96 13 Apr 1993 16:27:14 GLENN
+Now clearing the directory buffer between sets.
+
+ Rev 1.95 07 Apr 1993 17:54:00 CARLS
+
+ Rev 1.94 02 Apr 1993 15:47:18 CARLS
+changes for DC2000 unformatted tape
+
+ Rev 1.93 13 Mar 1993 21:03:32 MIKEP
+speed up clock
+
+ Rev 1.91 09 Mar 1993 10:57:28 MIKEP
+update clock stats at end of set
+
+ Rev 1.90 07 Mar 1993 16:33:30 GREGG
+Call _sleep for OS_WIN32 only.
+
+ Rev 1.89 07 Mar 1993 16:10:28 MIKEP
+change display to change with clock
+
+ Rev 1.88 19 Feb 1993 11:00:44 TIMN
+Fixed display of proper in-use filename EPR(0222)
+
+ Rev 1.87 18 Feb 1993 09:53:38 STEVEN
+fix typo
+
+ Rev 1.86 17 Feb 1993 10:36:20 STEVEN
+changes from mikep
+
+ Rev 1.85 11 Feb 1993 14:40:54 CARLS
+don't allow append operation to a tape that does not support it
+
+ Rev 1.84 18 Jan 1993 16:05:04 STEVEN
+add support for stream id error message
+
+ Rev 1.83 08 Jan 1993 14:27:58 chrish
+Deleted one line ... ("... //chs")
+
+ Rev 1.82 29 Dec 1992 13:33:48 DAVEV
+unicode fixes (3)
+
+ Rev 1.81 23 Dec 1992 15:24:34 chrish
+Change focus point to abort & "Tape Name:" string in log file
+
+ Rev 1.80 15 Dec 1992 11:16:54 chrish
+Corrected SKIP OPEN WAITING DIALOG to display proper
+FULL-filename.
+
+
+
+ Rev 1.79 23 Nov 1992 14:30:14 MIKEP
+add call to patch continuation vcb
+
+ Rev 1.78 11 Nov 1992 16:30:24 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.77 05 Nov 1992 17:00:30 DAVEV
+fix ts
+
+ Rev 1.75 27 Oct 1992 17:08:34 MIKEP
+add drive name to status call
+
+ Rev 1.74 23 Oct 1992 10:45:36 MIKEP
+abort stuff
+
+ Rev 1.73 20 Oct 1992 17:00:36 MIKEP
+getstatus calls
+
+ Rev 1.72 20 Oct 1992 16:27:52 MIKEP
+changes for abort
+
+ Rev 1.71 07 Oct 1992 14:47:50 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.70 04 Oct 1992 19:33:36 DAVEV
+Unicode Awk pass
+
+ Rev 1.69 02 Sep 1992 20:12:24 MIKEP
+timed wait for microsoft open files
+
+ Rev 1.68 24 Aug 1992 15:22:14 DAVEV
+NT Event Logging
+
+ Rev 1.67 20 Aug 1992 09:03:00 GLENN
+Added RTD bitmap update at init time.
+
+ Rev 1.66 28 Jul 1992 14:49:48 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.65 27 Jul 1992 14:51:02 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.64 27 Jul 1992 11:09:04 JOHNWT
+ChuckB checked in for John Wright, who is no longer with us.
+
+ Rev 1.63 20 Jul 1992 10:00:18 JOHNWT
+gas gauge display work
+
+ Rev 1.62 07 Jul 1992 16:04:30 MIKEP
+unicode changes
+
+ Rev 1.61 29 Jun 1992 10:39:00 MIKEP
+add hours to time display
+
+ Rev 1.60 25 Jun 1992 14:19:26 STEVEN
+used LOCAL_DOS to determin if not network
+
+ Rev 1.59 10 Jun 1992 11:12:22 DAVEV
+OS_WIN32:Start of changes for NT Event Logging-currently commented out
+
+ Rev 1.58 01 Jun 1992 15:26:54 GLENN
+Added tape name logging as done in 1.52.1.0 QIC release.
+
+ Rev 1.57 21 May 1992 19:24:56 MIKEP
+fixes
+
+ Rev 1.56 19 May 1992 13:01:36 MIKEP
+mips changes
+
+ Rev 1.55 14 May 1992 17:39:08 MIKEP
+nt pass 2
+
+ Rev 1.54 11 May 1992 19:32:08 STEVEN
+64bit and large path sizes
+
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define MAX_DISPLAY_FULL_FILENAME_LENGTH 20
+#define TRAN_START 0x01
+#define TRAN_CONT 0x02
+#define TRAN_END 0x00
+
+static UINT16 tpos_rout( UINT16, TPOS_PTR, BOOLEAN, DBLK_PTR, UINT16 );
+static UINT16 backup_msg_hndlr( UINT16, INT32, BSD_PTR, FSYS_HAND, TPOS_PTR, ... );
+static UINT16 WriteAbortOperation( CHAR_PTR drive_name );
+static UINT16 GetPasswordAndTapeName( BSD_PTR, DBLK_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR );
+static VOID CarryForwardPasswordTapeName( BSD_PTR, DBLK_PTR );
+static INT16 BlowOutBSDs( VOID );
+static VOID clock_routine( VOID );
+static VOID poll_drive_clock_routine( VOID );
+static VOID do_backup_init( VOID );
+static VOID do_backup_process( VOID );
+
+static BOOLEAN clock_ready_flag;
+static INT16 mwnTransaction;
+static HTIMER timer_handle;
+static STATS op_stats;
+static INT mw_oper_type;
+static INT16 mw_ret_val;
+static INT mw_rewind;
+static UINT16 mwTapeDriveStatus;
+static UINT16 mwPollDriveWaitTimer;
+static UINT16 mwNoTapeStatusCounter;
+static UINT16 mwReplaceTapeCount;
+static INT16 mwReplaceModeFlag;
+static INT16 mwSkipNoFlag;
+
+static CHAR mwCurrentDrive[ 512 ];
+static CHAR mwCurrentPath[ 512 ];
+static CHAR mwCurrentFile[ 512 ];
+static CHAR DrivePathFileName[ 512 ];
+
+static UINT16 mwTapeSettlingCount;
+
+static BOOLEAN mw_yes_flag_was_set = FALSE ;
+
+static INT mwfAbortDisabledForEOM;
+
+static QTC_BUILD_PTR mw_qtc_ptr;
+static INT DidItOnce = 0; // chs:05-20-93
+
+#ifdef OEM_EMS
+extern INT32 RT_BSD_OsId ;
+#endif
+
+#ifdef OS_WIN32
+
+ #define VLM_RETRY_COUNTER 10 // chs:04-29-93
+ static BOOL mwErrorDuringBackupSet = FALSE;
+
+#else
+
+ #define VLM_RETRY_COUNTER 5 // chs:04-29-93
+
+#endif
+
+/*****************************************************************************
+
+ Name: do_backup
+
+ Description: Main entry point to perform a backup operation. The
+ start backup dialog is first displayed to get the
+ user options. If successful, the runtime dialog is
+ displayed.
+
+ Returns: SUCCESS
+ ABNORMAL_TERMINATION
+
+ Notes: mw_ret_val is set in do_backup_process
+
+*****************************************************************************/
+
+INT do_backup( INT16 oper_type )
+{
+
+ gfAbortInMiddleOfFile = FALSE;
+ mwfAbortDisabledForEOM = FALSE;
+
+ mw_qtc_ptr = NULL;
+ mwnTransaction = TRAN_START;
+ mw_ret_val = SUCCESS;
+ mw_oper_type = oper_type;
+ mw_rewind = TRUE;
+ mwSkipNoFlag = 0 ;
+
+ mwCurrentPath[ 0 ] = TEXT( '\0' );
+ mwCurrentFile[ 0 ] = TEXT( '\0' );
+
+ gbAbortAtEOF = FALSE;
+ gbCurrentOperation = OPERATION_BACKUP;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_BACKUP);
+
+ /* we will check for tape every 3 seconds, but prompt user by interval
+ specified in INI file */
+ mwTapeSettlingCount = CDS_GetTapeDriveSettlingTime ( CDS_GetPerm () ) / 3;
+
+ if ( CDS_GetTapeDriveName( CDS_GetPerm( ) ) ) {
+
+ CHAR DriveName[80] ;
+
+ strncpy( DriveName, (CHAR_PTR)CDS_GetTapeDriveName( CDS_GetPerm( ) ), 80 ) ;
+ DriveName[79] = '\0' ;
+ strlwr( DriveName ) ;
+ if( strstr( DriveName, TEXT( "cipher" ) ) != NULL ||
+ ( strstr( DriveName, TEXT( "dec" ) ) != NULL &&
+ ( strstr( DriveName, TEXT( "thz02" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz86" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz87" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2700" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2000" ) ) != NULL ) ) ) {
+ mwTapeSettlingCount *= 2 ;
+ }
+ }
+
+ /* display the first backup dialog */
+
+ if ( CDS_GetYesFlag ( CDS_GetCopy() ) != YESYES_FLAG ) {
+
+ if( DM_StartBackupSet( oper_type ) ) {
+ mw_ret_val = ABNORMAL_TERMINATION;
+ }
+ else {
+
+ VLM_CloseAll();
+ }
+
+ }
+ else {
+
+ //
+ // Hardware compression support
+ //
+ if ( thw_list->drv_info.drv_features & TDI_DRV_COMPRESSION ) {
+ if ( CDS_GetHWCompMode( CDS_GetCopy() ) ) {
+ TF_SetHWCompression( thw_list, TRUE ) ;
+ } else {
+ TF_SetHWCompression( thw_list, FALSE ) ;
+ }
+ }
+
+ VLM_CloseAll();
+
+ /* if running a minimized job, wait for poll drive */
+ /* to report the status of the drive */
+
+ mwTapeDriveStatus = VLM_BUSY;
+ mwNoTapeStatusCounter = 0 ;
+ mwPollDriveWaitTimer = 60 * 5; /* wait for 5 minutes */
+
+ timer_handle = WM_HookTimer( poll_drive_clock_routine, 1 );
+
+ while( mwPollDriveWaitTimer && !gfTerminateApp ) {
+
+ WM_MultiTask ( );
+
+ if( mwTapeDriveStatus == VLM_VALID_TAPE ||
+ mwTapeDriveStatus == VLM_NO_TAPE ||
+ mwTapeDriveStatus == VLM_FOREIGN_TAPE ||
+ mwTapeDriveStatus == VLM_FUTURE_VER ||
+ mwTapeDriveStatus == VLM_SQL_TAPE ||
+ mwTapeDriveStatus == VLM_ECC_TAPE ||
+ mwTapeDriveStatus == VLM_GOOFY_TAPE ||
+ mwTapeDriveStatus == VLM_BLANK_TAPE ) {
+
+ break;
+ }
+ }
+
+ // if the app was terminated, exit
+
+ if ( gfTerminateApp ) {
+
+ mw_ret_val = ABNORMAL_TERMINATION;
+
+ } else if( !mwPollDriveWaitTimer ||
+ mwTapeDriveStatus == VLM_NO_TAPE ||
+ mwTapeDriveStatus == VLM_FUTURE_VER ||
+ mwTapeDriveStatus == VLM_SQL_TAPE ||
+ mwTapeDriveStatus == VLM_ECC_TAPE ||
+ mwTapeDriveStatus == VLM_GOOFY_TAPE ||
+ mwTapeDriveStatus == VLM_FOREIGN_TAPE ) {
+
+ /* if timer elapsed or status = no or foreign tape */
+ /* display dialog with status message */
+
+ WORD MessageID = 0;
+
+ if( mwTapeDriveStatus == VLM_FOREIGN_TAPE ||
+ mwTapeDriveStatus == VLM_SQL_TAPE ||
+ mwTapeDriveStatus == VLM_FUTURE_VER ||
+ mwTapeDriveStatus == VLM_GOOFY_TAPE ||
+ mwTapeDriveStatus == VLM_ECC_TAPE ) {
+
+ MessageID = RES_ERASE_FOREIGN_TAPE ;
+#ifdef OS_WIN32
+ WM_MessageBox( ID( IDS_MSGTITLE_WARNING ), // chs:04-29-93
+ ID( MessageID ), // chs:04-29-93
+ WMMB_OK | WMMB_NOYYCHECK, // chs:04-29-93
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 ); // chs:04-29-93
+#endif
+ }
+ else if( mwTapeDriveStatus == VLM_NO_TAPE ) {
+
+ MessageID = RES_ERASE_NO_TAPE ;
+ }
+ /* do we have a valid error to display? */
+ if( MessageID ) {
+
+ /* display the error message */
+
+#ifndef OS_WIN32
+ WM_MessageBox( ID( IDS_MSGTITLE_WARNING ),
+ ID( MessageID ),
+ WMMB_OK | WMMB_NOYYCHECK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+#endif
+ }
+ else {
+ /* no - terminate the operation */
+ mw_ret_val = ABNORMAL_TERMINATION;
+ }
+ }
+
+ WM_UnhookTimer( timer_handle );
+ }
+
+ /* if the user said continue, display the runtime dialog and
+ kick off the backup. */
+
+ if ( mw_ret_val == SUCCESS ) {
+
+ do_backup_init();
+ do_backup_process();
+
+ }
+
+ QTC_FreeBuildHandle( mw_qtc_ptr );
+
+ gbCurrentOperation = OPERATION_NONE;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_IDLE);
+ mwnTransaction = TRAN_END;
+ return( mw_ret_val );
+
+}
+
+
+/*****************************************************************************
+
+ Name: do_backup_init
+
+ Description: This function is called to display the runtime dialog.
+ It sets up the text based on the operation type.
+
+ Returns: void
+
+*****************************************************************************/
+
+VOID do_backup_init( VOID )
+{
+ JobStatusBackupRestore( (WORD) JOB_STATUS_CREATE_DIALOG );
+
+ if( mw_oper_type == ARCHIVE_BACKUP_OPER ) {
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATTRANSFER );
+ }
+ else {
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATBACKUP );
+ }
+ JobStatusBackupRestore( (WORD) JOB_STATUS_BACKUP_TITLE );
+
+ /* display "Set information n of n " */
+ JobStatusBackupRestore( (WORD) JOB_STATUS_N_OF_N );
+
+ // display the disk drive bitmap
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_HARDDRIVE );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATBACKUP );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: do_backup_process
+
+ Description: Does the actual backup process.
+
+ Returns: void
+
+ Notes: if error, mw_ret_val is set to ABNORMAL_TERMINATION
+
+*****************************************************************************/
+
+VOID do_backup_process( VOID )
+{
+ LIS lis;
+ BSD_PTR bsd_ptr;
+ CDS_PTR cds_ptr = CDS_GetCopy();
+
+ lis.bsd_list = bsd_list;
+ lis.curr_bsd_ptr = BSD_GetFirst( bsd_list );
+ lis.tape_pos_handler = tpos_rout; /* set tape positioner to call */
+ lis.message_handler = (MSG_HANDLER)backup_msg_hndlr; /* set message handler to call */
+ lis.oper_type = (INT16)mw_oper_type; /* set operation type */
+ lis.abort_flag_ptr = &gb_abort_flag; /* set abort flag address */
+ lis.pid = 0L;
+
+ // Only restart on last drive used if append and last operation
+ // was also a backup operation.
+
+ if ( ( gb_last_operation == mw_oper_type ) &&
+ ( CDS_GetAppendFlag( cds_ptr ) ) ) {
+ lis.auto_det_sdrv = TRUE;
+ }
+ else {
+ lis.auto_det_sdrv = FALSE;
+ }
+ gb_last_operation = mw_oper_type;
+ lis.vmem_hand = NULL;
+ if( CDS_GetAppendFlag( cds_ptr ) ) {
+ mwReplaceModeFlag = FALSE;
+ }
+ else {
+ mwReplaceModeFlag = TRUE;
+ mwReplaceTapeCount = 1;
+ }
+
+ UI_ExcludeInternalFiles( (INT16)mw_oper_type );
+
+ /* remove the unwanted BSD added by the parser */
+ VLM_RemoveUnusedBSDs( bsd_list ) ;
+
+ LP_SetAbortFlag( &lis, CONTINUE_PROCESSING );
+
+ /* clear the statistics before the operation starts */
+ ST_StartOperation( &op_stats );
+
+ /* set the Runtime abort flag pointer */
+ JobStatusAbort( lis.abort_flag_ptr );
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( (WORD) JOB_STATUS_ABORT_ENABLE );
+
+ if ( CDS_GetBackupCatalogs( CDS_GetCopy() ) ) {
+ VLM_IncludeCatalogs();
+ }
+
+ clock_ready_flag = FALSE; /* Wait on bset to start */
+
+ timer_handle = WM_HookTimer( clock_routine, 1 );
+
+ /* call backup engine */
+
+ PD_StopPolling();
+
+ if ( LP_Backup_Engine( &lis ) ) {
+
+ /* indicate which bsd had the problem for cataloging purposes */
+
+ BSD_SetOperStatus( lis.curr_bsd_ptr, ABNORMAL_TERMINATION );
+ }
+
+ PD_StartPolling();
+
+ WM_UnhookTimer( timer_handle );
+
+ /* set return value of success or failure of entire operation */
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while ( bsd_ptr != NULL ) {
+ mw_ret_val = BSD_GetOperStatus( bsd_ptr );
+ if ( mw_ret_val != SUCCESS ) {
+ break;
+ }
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ /* prompt for verify after if necessary */
+
+ if ( ( mw_ret_val == SUCCESS ) &&
+ ( CDS_GetAutoVerifyBackup( cds_ptr ) == PROMPT_VERIFY_AFTER ) &&
+ ( mw_oper_type != ARCHIVE_BACKUP_OPER ) ) {
+
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_VERIFY ),
+ ID( RES_PROMPT_VERIFY_BACKUP ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION, NULL, 0, 0 ) ) {
+ CDS_SetAutoVerifyBackup( cds_ptr, DO_VERIFY_AFTER );
+ }
+ else {
+ CDS_SetAutoVerifyBackup( cds_ptr, NO_VERIFY_AFTER );
+ }
+ }
+
+ /* If we are doing a verify after backup, don't disable the abort button */
+ /* If we are running batch mode, JOB_STATUS_ABORT_OFF will destroy the runtime */
+ /* status window, so why call it */
+ /* If the user aborts turn the abort button off */
+
+ if ( ! CDS_GetAutoVerifyBackup( cds_ptr ) || mw_ret_val == ABNORMAL_TERMINATION ) {
+ JobStatusBackupRestore( (WORD) JOB_STATUS_ABORT_OFF );
+ }
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: tpos_rout
+
+ Description: Tape positioning routine passed to the Tape Format Layer.
+
+ Returns:
+
+*****************************************************************************/
+static UINT16 tpos_rout(
+UINT16 message,
+TPOS_PTR tpos,
+BOOLEAN curr_valid_vcb,
+DBLK_PTR cur_vcb,
+UINT16 mode )
+{
+ UINT16 response = UI_ACKNOWLEDGED;
+ LIS_PTR lis_ptr = (LIS_PTR)tpos->reference;
+ BSD_PTR bsd_ptr = (BSD_PTR)lis_ptr->curr_bsd_ptr;
+ CDS_PTR cds_ptr;
+ CHAR_PTR drive_name;
+ CHAR buffer[ UI_MAX_TAPENAME_LENGTH + 1 ];
+ CHAR password[ MAX_TAPE_PASSWORD_LEN + 1 ];
+ INT16 password_size = 0;
+ BOOLEAN pass_status;
+ static UINT32 old_tape_id;
+ static UINT16 old_seq_num;
+ static INT16 no_tape_retry = 0 ;
+ BOOLEAN archive_tape = FALSE;
+ INT16 msgresp;
+ INT8 num_drives;
+ TFINF_PTR fmt_info ;
+
+ cds_ptr = CDS_GetCopy();
+
+ if ( curr_valid_vcb ) {
+
+ old_tape_id = FS_ViewTapeIDInVCB( cur_vcb );
+ old_seq_num = FS_ViewTSNumInVCB( cur_vcb );
+
+ }
+
+ /* Check for needing to return to Top Of Channel in multi-drive channel */
+ if ( ( mode == TF_WRITE_OPERATION ) &&
+ ( UI_ReturnToTOC( tpos->channel, TRUE ) ) ) {
+ return UI_BEGINNING_OF_CHANNEL;
+ }
+
+ /* get a pointer to the name of the current tape device */
+ drive_name = BE_GetCurrentDeviceName( tpos->channel );
+
+ /* check for writing to write-protected tape */
+ if ( UI_CheckWriteProtectedDevice( message, tpos, drive_name ) ) {
+
+ /* instruct user to insert a new tape */
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ yresprintf( (INT16) RES_INSERT_NEW_TAPE, drive_name );
+
+ /* display the message and get a response */
+
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ WMMB_YESNO | WMMB_NOYYCHECK, WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ no_tape_retry = 0 ;
+ return UI_NEW_TAPE_INSERTED;
+ }
+ else {
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ QTC_BlockBad( mw_qtc_ptr );
+ QTC_AbortBackup( mw_qtc_ptr );
+ return UI_HAPPY_ABORT;
+ }
+
+ }
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_ABORT_CHECK );
+
+ /* Check for user abort */
+ if ( UI_CheckUserAbort( message ) ) {
+
+ if ( gfAbortInMiddleOfFile ) {
+
+ QTC_BlockBad( mw_qtc_ptr );
+ }
+ QTC_AbortBackup( mw_qtc_ptr);
+ return UI_ABORT_POSITIONING;
+ }
+
+ switch ( message ) {
+
+ case TF_IDLE_NOBREAK:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ WM_MultiTask();
+ break;
+
+ case TF_IDLE:
+ case TF_SKIPPING_DATA:
+ case TF_MOUNTING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ //
+ // User inserted a tape that is of the same tape family. Do not allow
+ // the user to over write this tape.
+ //
+
+ case TF_CONT_TAPE_IN_FAMILY: // chs:05-19-93
+ // chs:05-19-93
+ /* display the message and get a response */ // chs:05-19-93
+ // chs:05-19-93
+ response = (INT16)WM_MessageBox( ID( IDS_MSGTITLE_INSERT ), // chs:05-19-93
+ ID( RES_SAME_TAPE_FAMILY ), // chs:05-19-93
+ (WORD)( WMMB_OKCANCEL | WMMB_NOYYCHECK ), // chs:05-19-93
+ (WORD)WMMB_ICONQUESTION, // chs:05-19-93
+ NULL, 0, 0 ); // chs:05-19-93
+ // chs:05-19-93
+ // chs:05-19-93
+ if ( response ) { // chs:05-19-93
+ no_tape_retry = 0 ;
+ response = UI_NEW_TAPE_INSERTED; // chs:05-19-93
+ } // chs:05-19-93
+ else { // chs:05-19-93
+ QTC_AbortBackup( mw_qtc_ptr ); // chs:05-19-93
+ response = UI_HAPPY_ABORT; // chs:05-19-93
+ } // chs:05-19-93
+ // chs:05-19-93
+ break; // chs:05-19-93
+
+ case TF_VCB_EOD:
+
+ /* The tape in the current drive is positioned at NO DATE, */
+ /* and has a valid last read or last written VCB */
+ /* ( either way the VCB obtained will be the VCB */
+ /* of the last backup set on the tape). */
+
+ case TF_POSITIONED_AT_A_VCB:
+
+ WM_MultiTask();
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+ mw_rewind = TRUE;
+
+ /* The tape in the current drive is positioned somewhere */
+ /* in the middle of the tape, and is at a valid VCB. */
+
+ /* save old tape name to use as default
+ new tape name if they choose to replace */
+ strcpy( buffer, (CHAR_PTR)FS_ViewTapeNameInVCB( cur_vcb ) );
+
+ archive_tape = IsTransferTape( FS_ViewTapeIDInVCB( cur_vcb ) );
+
+ /* If performing multi-set simultaneous backup,
+ carry forward VCB data and return to Tape Format */
+
+ /* Check for append mode */
+ if ( mode == TF_WRITE_APPEND || CDS_GetAppendFlag( cds_ptr ) ) {
+
+ /* if normal tape */
+ if ( ! archive_tape ) {
+
+ /* and this is not an archive operation */
+ if( lis_ptr->oper_type != ARCHIVE_BACKUP_OPER ) {
+ CarryForwardPasswordTapeName( bsd_ptr, cur_vcb );
+#ifdef OEM_MSOFT
+ response = (INT16)(( message == TF_VCB_EOD ) ? UI_END_POSITIONING : UI_EOD);
+#else
+ response = (INT16)(( message == TF_VCB_EOD ) ? UI_END_POSITIONING : UI_FAST_APPEND);
+#endif
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ }
+ /* archive tape */
+ else {
+
+ CarryForwardPasswordTapeName( bsd_ptr, cur_vcb );
+#ifdef OEM_MSOFT
+ response = (INT16)(( message == TF_VCB_EOD ) ? UI_END_POSITIONING : UI_EOD);
+#else
+ response = (INT16)(( message == TF_VCB_EOD ) ? UI_END_POSITIONING : UI_FAST_APPEND);
+#endif
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ }
+
+ /* Check for attempting to append an archive set to a "normal" backup */
+ /* Only allow user to OVERWRITE "normal" backups, no append allowed */
+
+ /* if normal tape and this is an archive operation */
+ /* and we are trying to append to this tape */
+ if ( ! archive_tape &&
+ ( lis_ptr->oper_type == ARCHIVE_BACKUP_OPER )
+ && CDS_GetAppendFlag( cds_ptr ) ) {
+
+ UI_DisplayVCB( cur_vcb );
+
+ /* tell user they can not append an archive set to a normal set */
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ yresprintf( (INT16) RES_NO_TRANSFER_APPEND );
+ if( WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ),
+ gszTprintfBuffer,
+ (WORD)(WMMB_YESNO),
+ (WORD)WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+
+ /* if they want to continue, prompt for new tape */
+ yresprintf( (INT16) RES_INSERT_NEW_TAPE, drive_name );
+ WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+ no_tape_retry = 0 ;
+ response = UI_NEW_TAPE_INSERTED;
+ }
+ else {
+ /* they did not want to continue */
+ response = UI_ABORT_POSITIONING;
+ }
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ }
+
+ /* replace mode */
+ /* Otherwise, process as usual for write operation */
+ if ( mode != TF_WRITE_CONTINUE ) {
+
+ UI_DisplayVCB( cur_vcb );
+
+ /* if the abort flag is set, don't display any more messages */
+ if ( gb_abort_flag ) {
+ response = UI_ABORT_POSITIONING;
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ else {
+ /* ask do you want to replace this tape */
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ yresprintf( (INT16) RES_REPLACE_WARNING,
+ drive_name,
+ FS_ViewTapeNameInVCB( cur_vcb ),
+ FS_ViewTSNumInVCB( cur_vcb ),
+ FS_ViewBSNumInVCB( cur_vcb ),
+ FS_ViewSetNameInVCB( cur_vcb ) );
+
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ),
+ gszTprintfBuffer,
+ WMMB_YESNO, WMMB_ICONQUESTION,
+ NULL, 0, 0 ) ) {
+
+ /* Check if restarting to TOC is required */
+ if ( UI_ReturnToTOC( tpos->channel, FALSE ) ) {
+ response = UI_BEGINNING_OF_CHANNEL;
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+
+ /* display warning if attempt to replace an archive tape */
+ if ( archive_tape ) {
+ if ( ! WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ),
+ ID( RES_ARCHIVE_REPLACE_WARNING ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+
+ /* user said no to replace tape */
+ /* if this is a normal tape - display can't append to a normal tape */
+ if ( ! archive_tape ) {
+ yresprintf( (INT16) RES_NO_TRANSFER_APPEND );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ }
+ response = UI_ABORT_POSITIONING;
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ }
+
+ /* Collect tape password and tape name */
+
+ response = GetPasswordAndTapeName( bsd_ptr, cur_vcb,
+ password, buffer,
+ drive_name );
+
+ if ( response == UI_OVERWRITE ) {
+ QTC_RemoveTape( old_tape_id, old_seq_num );
+ VLM_RemoveTape( old_tape_id, old_seq_num, TRUE );
+ }
+ }
+ else {
+ /* if normal tape and this is an archive operation */
+ /* don't ask the append question, prompt for a new tape */
+ if ( ! archive_tape &&
+ ( lis_ptr->oper_type == ARCHIVE_BACKUP_OPER ) ) {
+
+ response = WriteAbortOperation( drive_name );
+ }
+ else {
+ /* ask do you want to append to this tape */
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_APPEND ),
+ ID( RES_APPEND_QUEST ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ NULL, 0, 0 ) ) {
+
+ CarryForwardPasswordTapeName( bsd_ptr, cur_vcb );
+#ifdef OEM_MSOFT
+ response = (INT16)(( message == TF_VCB_EOD ) ? UI_END_POSITIONING : UI_EOD);
+#else
+ response = (INT16)(( message == TF_VCB_EOD ) ? UI_END_POSITIONING : UI_FAST_APPEND);
+#endif
+
+ }
+ else {
+ response = WriteAbortOperation( drive_name );
+ }
+ }
+ }
+ }
+ }
+ else {
+
+ response = UI_BOT;
+ }
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ break; /* end case TF_POSITIONED_AT_A_VCB: */
+
+ case TF_VCB_BOT:
+
+ /* The tape in the current drive is positioned at */
+ /* beginning of media, and has a valid VCB */
+
+ case TF_INVALID_VCB:
+ case TF_FUTURE_REV_MTF:
+ case TF_MTF_ECC_TAPE:
+ case TF_SQL_TAPE:
+ case TF_TAPE_OUT_OF_ORDER:
+
+ mw_rewind = TRUE;
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ /* The tape in the current drive is a foreign tape, */
+ /* and cannot be read. If you want you can erase the tape */
+ /* or simply overwrite it. The tape will be at the beginning */
+ /* of the tape at this point. */
+
+ buffer[0] = TEXT('\0');
+
+ if ( message == TF_VCB_BOT ) {
+
+ archive_tape = IsTransferTape( FS_ViewTapeIDInVCB( cur_vcb ) );
+
+ if ( FS_SizeofTapeNameInVCB( cur_vcb ) != 0 ) {
+ /* save old tape name to use as default new tape name if they choose to replace */
+ strcpy( buffer, (CHAR_PTR)FS_ViewTapeNameInVCB( cur_vcb ) );
+ }
+
+ UI_DisplayVCB( cur_vcb );
+
+ /* Check for append mode */
+ if ( CDS_GetAppendFlag( cds_ptr ) ) {
+
+ /* if there is a password prompt user */
+ if( FS_SizeofTapePswdInVCB( cur_vcb ) ) {
+
+ pass_status = VerifyTapePassword( (CHAR_PTR)FS_ViewTapeNameInVCB( cur_vcb ),
+ (CHAR_PTR)FS_ViewSetDescriptInVCB( cur_vcb ),
+ (CHAR_PTR)FS_ViewUserNameInVCB( cur_vcb ),
+ FS_ViewPswdEncryptInVCB( cur_vcb ),
+ (INT8_PTR)FS_ViewTapePasswordInVCB( cur_vcb ),
+ FS_SizeofTapePswdInVCB( cur_vcb ),
+ (INT8_PTR)FS_ViewSetPswdInVCB( cur_vcb ),
+ FS_SizeofSetPswdInVCB( cur_vcb ),
+ FS_ViewTapeIDInVCB( cur_vcb ) );
+
+ if ( pass_status == FALSE ) {
+ /* password was canceled */
+ response = WriteAbortOperation( drive_name );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ }
+
+ /* Before proceeding, check for attempting to append a
+ transfer backup to a non-transfer backup tape */
+
+ if ( ! archive_tape &&
+ lis_ptr->oper_type == ARCHIVE_BACKUP_OPER ) {
+
+ /* tell user they can not append an archive set to a normal set */
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ yresprintf( (INT16) RES_NO_TRANSFER_APPEND );
+ if( WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ),
+ gszTprintfBuffer,
+ (WORD)( WMMB_NOYYCHECK | WMMB_YESNO ),
+ (WORD)WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+
+ /* if they want to continue, prompt for new tape */
+
+ yresprintf( (INT16) RES_INSERT_NEW_TAPE, drive_name );
+ WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ (WORD)(WMMB_OK | WMMB_NOYYCHECK ),
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+ no_tape_retry = 0 ;
+ response = UI_NEW_TAPE_INSERTED;
+ }
+ else {
+ /* they did not want to continue */
+ response = UI_ABORT_POSITIONING;
+ }
+ }
+ else {
+
+ CarryForwardPasswordTapeName( bsd_ptr, cur_vcb );
+#ifdef OEM_MSOFT
+ response = UI_EOD ;
+#else
+ response = UI_FAST_APPEND ;
+#endif
+ }
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ else {
+
+ /* if the abort flag is set, don't display any more messages */
+ if ( gb_abort_flag ) {
+ response = UI_ABORT_POSITIONING;
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ else {
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+
+ yresprintf( (INT16) RES_REPLACE_WARNING,
+ drive_name,
+ FS_ViewTapeNameInVCB( cur_vcb ),
+ FS_ViewTSNumInVCB( cur_vcb ),
+ FS_ViewBSNumInVCB( cur_vcb ),
+ FS_ViewSetNameInVCB( cur_vcb ) );
+
+
+ if ( DidItOnce && CDS_GetYesFlag( cds_ptr ) == YESYES_FLAG ) { // chs:05-20-93
+ msgresp = (INT16)WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ), // chs:05-20-93
+ gszTprintfBuffer, // chs:05-20-93
+ (WORD)WMMB_YESNO | WMMB_NOYYCHECK, // chs:05-20-93
+ (WORD)WMMB_ICONQUESTION, // chs:05-20-93
+ NULL, 0, 0 ); // chs:05-20-93
+ } else { // chs:05-20-93
+ msgresp = (INT16)WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ),
+ gszTprintfBuffer,
+ (WORD)WMMB_YESNO,
+ (WORD)WMMB_ICONQUESTION,
+ NULL, 0, 0 );
+ DidItOnce = 1; // chs:05-20-93
+ } // chs:05-20-93
+ }
+ }
+ }
+ else {
+
+ /* display message that this is foreign tape format */
+ /* and disable "Yes" flag in config */
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ yresprintf( (INT16) RES_FOREIGN_TAPE_MSG2, drive_name );
+ CDS_SetYesFlag( cds_ptr, NO_FLAG );
+ msgresp = (INT16)WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ),
+ gszTprintfBuffer,
+ (WORD)WMMB_YESNO,
+ (WORD)WMMB_ICONQUESTION,
+ ID( RES_REPLACE_TAPE ), 0, 0 );
+ }
+
+ /* prompt user if they wish to replace tape's contents */
+
+ if ( msgresp ) {
+
+ if ( message == TF_VCB_BOT ) {
+
+ /* display warning if attempt to replace an archive tape */
+
+ if ( archive_tape ) {
+
+ /* always prompt the user if trying to replace an archive tape */
+
+ if ( ! WM_MessageBox( ID( IDS_MSGTITLE_REPLACE ),
+ ID( RES_ARCHIVE_REPLACE_WARNING ),
+ WMMB_YESNO | WMMB_NOYYCHECK,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+
+ /* user said no to replace tape */
+ /* if this is a normal tape - display can't append to a normal tape */
+ if ( ! archive_tape ) {
+ yresprintf( (INT16) RES_NO_TRANSFER_APPEND );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ }
+ response = WriteAbortOperation( drive_name );
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ }
+ }
+
+ if ( mode != TF_WRITE_CONTINUE ) {
+
+ /* Check if restarting to TOC is required */
+ if ( UI_ReturnToTOC( tpos->channel, FALSE ) ) {
+ response = UI_BEGINNING_OF_CHANNEL;
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+
+ /* if starting a new tape, collect password and tape name */
+ response = GetPasswordAndTapeName( bsd_ptr, cur_vcb,
+ password, buffer,
+ drive_name );
+ if ( response == UI_OVERWRITE ) {
+#if defined ( OEM_MSOFT )
+{
+ INT16 passwordlength;
+ CDS_PTR cds_ptr = CDS_GetCopy();
+ CHAR passwdbuffer1[MAX_TAPE_PASSWORD_LEN + 1];
+ LPSTR generic_str_ptr;
+
+
+ if ( CDS_GetYesFlag ( CDS_GetCopy() ) == YESYES_FLAG ) {
+ if ( CDS_GetCmdLineRestrictAccess( cds_ptr ) ) {
+ generic_str_ptr = GetCurrentMachineNameUserName( );
+ passwdbuffer1[0] = NTPASSWORDPREFIX;
+ passwdbuffer1[1] = 0;
+ if ( generic_str_ptr ) {
+ strcat( passwdbuffer1, generic_str_ptr );
+ }
+ passwordlength = strlen( passwdbuffer1 ); // chs:03-10-93
+ CryptPassword( ( INT16 ) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)passwdbuffer1, ( INT16 ) ( passwordlength * sizeof( CHAR ) ) ); // chs:03-10-93
+ BSD_SetTapePswd( bsd_ptr, (INT8_PTR)passwdbuffer1,( INT16 ) ( passwordlength * sizeof( CHAR ) ) ); // chs:03-10-93
+ PropagateTapePassword();
+ }
+ }
+}
+#endif
+ QTC_RemoveTape( old_tape_id, old_seq_num );
+ VLM_RemoveTape( old_tape_id, old_seq_num, TRUE );
+ }
+ }
+ else {
+
+ response = UI_OVERWRITE;
+ QTC_RemoveTape( old_tape_id, old_seq_num );
+ VLM_RemoveTape( old_tape_id, old_seq_num, TRUE );
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+
+ }
+ /* user decided to not replace the tape */
+ else if( mode != TF_WRITE_CONTINUE ) {
+
+ /* user can't append to foreign tape */
+
+ if ( message != TF_VCB_BOT ) {
+
+ response = WriteAbortOperation( drive_name );
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+
+ /* user not allowed to append an archive set
+ to a non-archive tape */
+
+ if ( ! archive_tape &&
+ lis_ptr->oper_type == ARCHIVE_BACKUP_OPER ) {
+
+ response = WriteAbortOperation( drive_name );
+
+// yresprintf( (INT16) RES_NO_TRANSFER_APPEND );
+// JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+// response = UI_ABORT_POSITIONING;
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+
+ fmt_info = TF_GetTapeFormat( 0 ) ;
+
+ /* if append allowed to this tape, prompt user */
+
+ if( ( fmt_info != NULL ) &&
+ ( fmt_info->attributes & APPEND_SUPPORTED ) ) {
+
+ /* prompt for append */
+
+ /* if writing to tape #1, continue to append question */
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_APPEND ),
+ ID( RES_APPEND_QUEST ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ NULL, 0, 0 ) ) {
+
+ //
+ // set append flag on
+ //
+
+ CDS_PTR cds_ptr = CDS_GetCopy();
+ CDS_SetAppendFlag( cds_ptr, 1 );
+
+ if ( FS_SizeofTapePswdInVCB( cur_vcb ) != 0 ) {
+ pass_status = VerifyTapePassword( (CHAR_PTR)FS_ViewTapeNameInVCB( cur_vcb ),
+ (CHAR_PTR)FS_ViewSetDescriptInVCB( cur_vcb ),
+ (CHAR_PTR)FS_ViewUserNameInVCB( cur_vcb ),
+ FS_ViewPswdEncryptInVCB( cur_vcb ),
+ (INT8_PTR)FS_ViewTapePasswordInVCB( cur_vcb ),
+ FS_SizeofTapePswdInVCB( cur_vcb ),
+ (INT8_PTR)FS_ViewSetPswdInVCB( cur_vcb ),
+ FS_SizeofSetPswdInVCB( cur_vcb ),
+ FS_ViewTapeIDInVCB( cur_vcb ) );
+
+ if ( pass_status == FALSE ) {
+ /* password was canceled */
+ response = WriteAbortOperation( drive_name );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ }
+
+ CarryForwardPasswordTapeName( bsd_ptr, cur_vcb );
+
+#ifdef OEM_MSOFT
+ response = UI_EOD ;
+#else
+ response = UI_FAST_APPEND ;
+#endif
+ }
+ else {
+ response = WriteAbortOperation( drive_name );
+ }
+ }
+ else {
+ response = WriteAbortOperation( drive_name );
+ }
+ }
+ /* user does not wish to replace tape,
+ prompt for insert a new tape and continue */
+ else {
+
+ /* Check if restarting to TOC is required */
+
+ if ( UI_ReturnToTOC( tpos->channel, FALSE ) ) {
+ response = UI_BEGINNING_OF_CHANNEL;
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ yresprintf( (INT16) RES_INSERT_NEW_TAPE, drive_name );
+
+ if ( ! WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ WMMB_YESNO | WMMB_NOYYCHECK, // chs:05-20-93
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+ response = WriteAbortOperation( drive_name );
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+ no_tape_retry = 0 ;
+ response = UI_NEW_TAPE_INSERTED;
+ }
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case TF_ACCIDENTAL_VCB:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ mw_rewind = TRUE;
+
+ /* This message is a side effect of the the UI routine */
+ /* requesting a UI_BOT, UI_EOD, UI_NEW_POSITION_REQUESTED, */
+ /* and is just a way of saying to the UI routine, "Hey, we just */
+ /* passed a VCB, and I just thought that I would tell you about it!" */
+
+ UI_DisplayVCB( cur_vcb );
+
+ /* catalog it partial, if we've never seen it. */
+
+ if ( QTC_FindBset( FS_ViewTapeIDInVCB( cur_vcb ),
+ FS_ViewTSNumInVCB( cur_vcb ),
+ FS_ViewBSNumInVCB( cur_vcb ) ) == NULL ) {
+
+ mw_qtc_ptr = QTC_GetBuildHandle( );
+ QTC_DoFullCataloging( mw_qtc_ptr, FALSE );
+ QTC_StartBackup( mw_qtc_ptr, cur_vcb );
+ QTC_FreeBuildHandle( mw_qtc_ptr );
+ mw_qtc_ptr = NULL;
+ }
+ break;
+
+ case TF_WRONG_TAPE:
+
+ // Once we start an append they are not allowed to switch tape
+ // families on us. They did that, inserted a blank tape or used
+ // a tape of the same family, but wrong sequence number
+
+ // if tape IDs differ, display wrong family message,
+ // else ask for the next tape
+
+ // Note: when we Dismounted the tape, curr_valid_vcb became FALSE,
+ // but we can't NOT look at the last vcb if we want to make the
+ // following test
+
+ // One more thing: if we have a blank tape here, the vcb looked at
+ // belonged to whatever was in the drive prior to the blank tape.
+ // the test will pass or fail accordingly (ugh!)
+
+ if( FS_ViewTapeIDInVCB( cur_vcb ) != (UINT32)tpos->tape_id ) {
+
+ WM_MsgBox( ID( IDS_BACKUPERRORTITLE ),
+ ID( IDS_BACKUPWRONGFAMILY),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+ }
+
+ // falling through ...
+
+ case TF_NEED_NEW_TAPE:
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+ mw_rewind = TRUE;
+
+ /* This message is used to request that the UI routine prompt, or cause */
+ /* a new tape to be inserted in the tape drive. This message is sent */
+ /* as a side effect of UI_EOD, or UI_NEW_POSITION_REQUESTED. */
+
+ /* display user prompt as needed */
+
+ if( CDS_GetYesFlag( cds_ptr ) == YESYES_FLAG ) {
+ mw_yes_flag_was_set = TRUE ;
+ CDS_SetYesFlag( cds_ptr, NO_FLAG ) ;
+ }
+
+ if ( ( mode != TF_WRITE_OPERATION ) &&
+ ( BE_CheckMultiDrive( tpos->channel ) == BE_END_OF_CHANNEL ) ) {
+
+ num_drives = UI_TapeDriveCount( );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ yresprintf( (INT16) RES_INSERT_MULTI_TAPES,
+ FS_ViewTSNumInVCB( cur_vcb ) + 1,
+ FS_ViewTSNumInVCB( cur_vcb ) + num_drives,
+ 1,
+ num_drives );
+
+ response = (INT16)WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ (WORD)WMMB_YESNO,
+ (WORD)WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 );
+
+ } else {
+
+ if( mwReplaceModeFlag ) {
+ yresprintf( (INT16) RES_INSERT_NEXT_TAPE,
+ mwReplaceTapeCount += 1,
+ BE_GetCurrentDeviceName( tpos->channel ) );
+ }
+ else {
+ // if PositionAtSet knows what it wants, be sure to advertise
+ // what's in tpos (as with UI_FAST_APPEND & UI_EOD)
+ // otherwise, use the cur_vcb (as with overwrite)
+
+ INT16 tape_sequence = ( tpos->tape_seq_num != -1 ) ?
+ tpos->tape_seq_num :
+ (FS_ViewTSNumInVCB( cur_vcb ) + 1) ;
+
+
+ yresprintf( (INT16) RES_INSERT_NEXT_TAPE,
+ tape_sequence,
+ BE_GetCurrentDeviceName( tpos->channel ) );
+ }
+
+ //
+ // Just a note: at this point the tape in the current
+ // drive has already been rewound to the beginning
+ // of the tape. So we do not need to tell user to wait
+ // for tape to finish rewinding
+ //
+
+ response = (INT16)WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ ID( RES_TAPE_FULL_REWOUND ), // chs:05-03-93
+ (WORD)WMMB_OKCANCEL,
+ (WORD)WMMB_ICONQUESTION,
+ gszTprintfBuffer,
+ IDRBM_LTAPE, 0 );
+ }
+
+ if ( response ) {
+ no_tape_retry = 0 ;
+ response = UI_NEW_TAPE_INSERTED;
+ DidItOnce = 1; // chs:05-20-93
+
+#ifdef OS_WIN32
+ if( mwReplaceModeFlag ) {
+ NtDemoChangeTape( mwReplaceTapeCount ) ;
+ } else {
+ NtDemoChangeTape( (UINT16)(FS_ViewTSNumInVCB( cur_vcb ) + 1u ) ) ;
+ }
+#endif
+ }
+ else {
+
+ QTC_AbortBackup( mw_qtc_ptr );
+ response = UI_HAPPY_ABORT;
+ }
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case TF_NO_TAPE_PRESENT:
+
+ mw_rewind = TRUE;
+
+#ifdef OS_WIN32
+ if ( no_tape_retry <= mwTapeSettlingCount ) {
+ Sleep( 3000 ) ;
+ response = UI_NEW_TAPE_INSERTED ;
+ no_tape_retry ++ ;
+ break ;
+ }
+#endif
+
+ /* There is no tape present in the current drive */
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_EMPTY);
+ response = UI_InsertTape( drive_name );
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case TF_UNRECOGNIZED_MEDIA:
+
+ mw_rewind = TRUE;
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN);
+ yresprintf( (INT16) IDS_VLMUNFORMATEDTEXT ) ;
+ WM_MessageBox( ID( IDS_VLMUNFORMATEDTITLE ) ,
+ gszTprintfBuffer ,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 ) ;
+
+ /* instruct user to insert a new tape */
+ /* display the message and get a response */
+
+ yresprintf( (INT16) RES_INSERT_NEW_TAPE, drive_name );
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ WMMB_YESNO, WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+
+ no_tape_retry = 0 ;
+ return UI_NEW_TAPE_INSERTED;
+ }
+ else {
+
+ QTC_AbortBackup( mw_qtc_ptr );
+ return UI_HAPPY_ABORT;
+ }
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case TF_NO_MORE_DATA:
+
+ /* This is sent to the UI rountine as a result of doing a UI_EOD. */
+
+ case TF_POSITIONED_FOR_WRITE:
+
+ /* This message is returned in response to a UI_OVERWRITE message. */
+ /* when the tape pos routine has successfully positioned for overwrite */
+ /* of the requested backup set. */
+
+ case TF_EMPTY_TAPE:
+
+
+#if defined ( OEM_MSOFT )
+{
+ //
+ // Allows /R restrict access to owner on a blank tape when doing
+ // a batch command line backup
+ //
+
+ INT16 passwordlength;
+ CDS_PTR cds_ptr = CDS_GetCopy();
+ CHAR passwdbuffer1[MAX_TAPE_PASSWORD_LEN + 1];
+ LPSTR generic_str_ptr;
+
+
+ if ( CDS_GetYesFlag ( CDS_GetCopy() ) == YESYES_FLAG ) {
+ if ( CDS_GetCmdLineRestrictAccess( cds_ptr ) ) {
+ generic_str_ptr = GetCurrentMachineNameUserName( );
+ passwdbuffer1[0] = NTPASSWORDPREFIX;
+ passwdbuffer1[1] = 0;
+ if ( generic_str_ptr ) {
+ strcat( passwdbuffer1, generic_str_ptr );
+ }
+ passwordlength = strlen( passwdbuffer1 );
+ CryptPassword( ( INT16 ) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)passwdbuffer1, ( INT16 ) ( passwordlength * sizeof( CHAR ) ) );
+ BSD_SetTapePswd( bsd_ptr, (INT8_PTR)passwdbuffer1,( INT16 ) ( passwordlength * sizeof( CHAR ) ) );
+ PropagateTapePassword();
+ }
+ }
+}
+#endif
+
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_EMPTY);
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ mw_rewind = TRUE;
+
+ /* The tape in the current drive is empty. */
+
+ response = UI_END_POSITIONING;
+ break;
+
+ case TF_READ_ERROR:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ mw_rewind = TRUE;
+ response = UI_HandleTapeReadError( drive_name );
+
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case TF_SEARCHING:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ mw_rewind = TRUE;
+
+ /* This message is sent to the UI routine to inform it that it is spacing */
+ /* the tape on the current drive. This message will only be sent once during */
+ /* the space operation. */
+
+ yresprintf( (INT16) RES_SEARCHING );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ break;
+
+ case TF_REWINDING:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* This message is sent to the UI routine to inform it that it is rewinding */
+ /* the tape on the current drive. This message will only be sent once during */
+ /* the rewind operation. */
+
+ if ( mw_rewind ) {
+ yresprintf( (INT16) RES_REWINDING );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ mw_rewind = FALSE;
+ }
+ break;
+
+ case TF_DRIVE_BUSY:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_BUSY);
+ break;
+
+ case TF_FAST_SEEK_EOD:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+#ifndef OEM_MSOFT
+ yresprintf( (INT16) RES_SEARCHING_FOR_EOD );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+#endif
+
+ break;
+
+ case TF_END_CHANNEL:
+
+ mw_rewind = TRUE;
+ eresprintf( RES_END_CHANNEL );
+ response = UI_ABORT_POSITIONING;
+ break;
+
+ default:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ mw_rewind = TRUE;
+ eresprintf( RES_UNKNOWN_TF_MSG, message );
+ QTC_BlockBad( mw_qtc_ptr );
+ QTC_AbortBackup( mw_qtc_ptr );
+ response = UI_ABORT_POSITIONING;
+ break;
+ }
+
+ if( mw_yes_flag_was_set &&
+ ( response == UI_HAPPY_ABORT ||
+ response == UI_OVERWRITE ||
+ response == UI_END_POSITIONING ||
+ response == UI_ABORT_POSITIONING ) ) {
+
+ mw_yes_flag_was_set = FALSE ;
+ CDS_SetYesFlag( cds_ptr, YESYES_FLAG ) ;
+ }
+
+ return( response );
+}
+
+/*****************************************************************************
+
+ Name: backup_msg_hndlr
+
+ Description: Backup message handler called by the loops
+
+ Returns:
+
+*****************************************************************************/
+
+static UINT16 backup_msg_hndlr(
+UINT16 msg,
+INT32 pid,
+BSD_PTR bsd_ptr,
+FSYS_HAND fsh,
+TPOS_PTR tpos,
+... )
+{
+ static CHAR delimiter = TEXT('#'); /* = # for debug */
+ INT16 response = MSG_ACK;
+ va_list arg_ptr;
+ static CHAR_PTR buffer ;
+ CHAR_PTR buffer1; // chs:06-09-93
+ static CHAR_PTR file_buf ;
+ CHAR volume[ UI_MAX_VOLUME_LENGTH ];
+ INT16 size;
+ time_t t_time;
+ CHAR date_str[MAX_UI_DATE_SIZE];
+ CHAR time_str[MAX_UI_TIME_SIZE];
+ CHAR backup_method[MAX_UI_RESOURCE_SIZE] ;
+ DBLK_PTR dblk_ptr;
+ OBJECT_TYPE object_type;
+ UINT64 count;
+ GENERIC_DLE_PTR dle;
+ INT16 res_id;
+ INT16 error;
+ DBLK_PTR vcb_dblk_ptr;
+ DBLK_PTR ddb_dblk_ptr;
+ DBLK_PTR fdb_dblk_ptr;
+ CHK_OPEN TryOpen;
+ UINT32 parm;
+ CDS_PTR cds_ptr;
+ INT16 skip_open_files;
+ UINT64 num_bytes;
+ CHAR numeral[ UI_MAX_NUMERAL_LENGTH ];
+ BOOLEAN stat ;
+ UINT32 strm_id ;
+
+ DBG_UNREFERENCED_PARAMETER ( pid );
+
+ /* set up first argument */
+ cds_ptr = CDS_GetCopy();
+
+ va_start( arg_ptr, tpos );
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_ABORT_CHECK );
+
+ switch ( (INT16)msg ) {
+
+
+#ifdef MS_RELEASE
+ case -533:
+ // We are talking kludge city here. Keep the error
+ // message from being displayed to the user.
+ zprintf( DEBUG_TEMPORARY, TEXT("** -533 LOOPS ERROR **") );
+ break;
+#endif
+
+
+ case MSG_CONT_VCB:
+ // This message was added to support 4.0 tape format. The
+ // continuation vcb PBA & LBA cannot be assumed to be 0
+ // because a tape header is placed on the tape. The backup
+ // engine does not know them until it gets the next tape and
+ // writes them on it. This call allows you to go back and
+ // patch the catalogs.
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ QTC_PatchContinuationVCB( mw_qtc_ptr, dblk_ptr );
+ break;
+
+
+ case MSG_LOG_STREAM_NAME:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ buffer1 = va_arg( arg_ptr, CHAR_PTR );
+
+ lresprintf( LOGGING_FILE, LOG_STREAM, fsh, buffer1 );
+
+ break;
+
+ case MSG_LOG_BLOCK:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_VCB:
+ break;
+
+ case BT_DDB:
+
+ QTC_AddToCatalog( mw_qtc_ptr, dblk_ptr, fsh, FALSE, NULL, 0 );
+
+ /* clear last displayed filename from status display */
+
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+
+ if ( buffer != NULL ) {
+
+ strcpy( mwCurrentPath, buffer );
+ strcpy( mwCurrentFile, TEXT( "" ) );
+
+ if ( DLE_GetDeviceType(BSD_GetDLE( bsd_ptr) ) == FS_EMS_DRV ) {
+
+ yprintf( TEXT("%s"), mwCurrentPath+1 );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORY_NAMES );
+ } else {
+ yprintf( TEXT("%s"), mwCurrentPath );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORY_NAMES );
+
+ yprintf( TEXT("%s"), mwCurrentFile );
+ JobStatusBackupRestore( JOB_STATUS_FILE_NAMES );
+ }
+
+ SetStatusBlock(IDSM_OFFSETACTIVEDIR, (LONG)(LPSTR)mwCurrentPath);
+
+ // build the full path with no "..." inserted
+ UI_BuildFullPathFromDDB2( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+
+ yprintf( TEXT("%s"), buffer );
+
+ ST_EndBackupSet( &op_stats );
+
+ dle = BSD_GetDLE( bsd_ptr ); // chs:06-09-93
+ if ( (DLE_GetDeviceType(BSD_GetDLE( bsd_ptr) ) != FS_EMS_DRV ) &&
+ ( dle->device_name_leng ) ) {
+ buffer1 = (CHAR_PTR)calloc( 1, ( strlen( buffer ) * sizeof( CHAR ) ) + ( ( dle->device_name_leng ) * sizeof( CHAR ) ) + sizeof( CHAR ) ); // chs:06-09-93
+ if ( buffer1 ) { // chs:06-09-93
+ strcpy( buffer1, dle->device_name ); // chs:06-09-93
+ strcat( buffer1, buffer ); // chs:06-09-93
+ // chs:06-09-93
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer1 ); // chs:06-09-93
+ free( buffer1 ); // chs:06-09-93
+ } else { // chs:06-09-93
+ // chs:06-09-93
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer ); // chs:06-09-93
+ } // chs:06-09-93
+ } else if (DLE_GetDeviceType(BSD_GetDLE( bsd_ptr) ) != FS_EMS_DRV ) {
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer ); // chs:06-09-93
+ } // chs:06-09-93
+ }
+ break;
+
+ case BT_FDB:
+
+ QTC_AddToCatalog( mw_qtc_ptr, dblk_ptr, fsh, FALSE, NULL, 0 );
+
+ ST_SetCFSize( &op_stats, FS_GetDisplaySizeFromDBLK( fsh, dblk_ptr ) );
+ ST_SetCFDone( &op_stats, U64_Init( 0L, 0L ) );
+
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+
+ // copy the full file name for the Log file
+ yprintf( TEXT("%s"), buffer );
+ lresprintf( LOGGING_FILE, LOG_FILE, fsh, dblk_ptr );
+
+ SetStatusBlock(IDSM_OFFSETACTIVEFILE, (DWORD)buffer );
+
+ // truncate the file name, if needed, for Runtime display
+ UI_DisplayFile( buffer );
+
+ strcpy( mwCurrentFile, gszTprintfBuffer );
+ JobStatusBackupRestore( JOB_STATUS_FILE_NAMES );
+
+ ST_EndBackupSet( &op_stats );
+ }
+ }
+ break;
+
+ /* statistics messages */
+ case MSG_BLOCK_PROCESSED:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ yprintf(TEXT("%ld\r"), ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_DIRECTORIES_PROCESS );
+
+ break;
+
+ case BT_FDB:
+
+ // Should we stop at the end of this file.
+
+ if ( gbAbortAtEOF ) {
+ gb_abort_flag = ABORT_PROCESSED;
+ }
+
+ // commented out because it screws up the file name
+ // display if timer goes off between files. mikep
+
+ // strcpy( mwCurrentFile, TEXT( "" ) );
+
+ ST_SetCFSize( &op_stats, U64_Init( 0L, 0L ) );
+ ST_SetCFDone( &op_stats, U64_Init( 0L, 0L ) );
+
+ ST_AddBSFilesProcessed( &op_stats, 1 );
+
+ yprintf(TEXT("%ld\r"), ST_GetBSFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_FILES_PROCESSED );
+
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+ if ( object_type == AFP_OBJECT ) {
+ ST_AddBSAFPFilesProcessed( &op_stats, 1 );
+ }
+ break;
+ }
+ break;
+
+ case MSG_BYTES_PROCESSED:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ count = va_arg( arg_ptr, UINT64 );
+
+
+ if ( mwfAbortDisabledForEOM ) {
+
+ mwfAbortDisabledForEOM = FALSE;
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( (WORD) JOB_STATUS_ABORT_ENABLE );
+ }
+
+ ST_AddBSBytesProcessed( &op_stats, count );
+ ST_AddCFDone( &op_stats, count );
+
+ /* perform percentage completion calcs */
+
+ ST_EndBackupSet( &op_stats );
+ break;
+
+ case MSG_START_OPERATION:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ lresprintf( LOGGING_FILE, LOG_START, FALSE );
+
+ /* display operation title in log file */
+
+ if( mw_oper_type == ARCHIVE_BACKUP_OPER ) {
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_DLGTITLEJOBSTATTRANSFER ) ;
+ }
+ else {
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_DLGTITLEJOBSTATBACKUP ) ;
+ }
+
+ break;
+
+ case MSG_END_OPERATION:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ // See if an error occurred in the catalogs.
+
+ UI_FreePathBuffer( &buffer ) ;
+ UI_FreePathBuffer( &file_buf ) ;
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+ VLM_CheckForCatalogError( mw_qtc_ptr );
+ ST_EndBackupSetIdle( &op_stats );
+
+ lresprintf( LOGGING_FILE, LOG_END );
+ UI_ChkDispGlobalError( );
+ break;
+
+ case MSG_START_BACKUP_SET:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ dle = BSD_GetDLE( bsd_ptr );
+
+ strcpy( mwCurrentDrive, DLE_GetDeviceName( dle ) );
+ mwCurrentPath[ 0 ] = TEXT( '\0' );
+ mwCurrentFile[ 0 ] = TEXT( '\0' );
+
+ mw_qtc_ptr = QTC_GetBuildHandle( );
+ QTC_DoFullCataloging( mw_qtc_ptr, BSD_GetFullyCataloged( bsd_ptr ) );
+ QTC_StartBackup( mw_qtc_ptr, dblk_ptr );
+
+#ifdef OEM_EMS
+ RT_BSD_OsId = DLE_GetOsId( dle );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_FS_TYPE );
+#endif OEM_EMS
+
+ BSD_SetOperStatus( bsd_ptr, SUCCESS );
+
+ if ( DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+ JobStatusBackupRestore( (WORD) JOB_STATUS_VOLUME_NETDRIVE );
+ }
+ else {
+ JobStatusBackupRestore( (WORD) JOB_STATUS_VOLUME_HARDDRIVE );
+ }
+
+ yprintf(TEXT("%s\r"), FS_ViewVolNameInVCB( dblk_ptr ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_SOURCE_NAME );
+
+ yprintf(TEXT("%s\r"), BSD_GetTapeLabel( bsd_ptr) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_DEST_NAME );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_TAPE,
+ BSD_GetTapeLabel ( bsd_ptr) );
+
+ yresprintf( (INT16) RES_DISPLAY_VOLUME,
+ FS_ViewVolNameInVCB( dblk_ptr ),
+ FS_ViewBSNumInVCB( dblk_ptr ),
+ FS_ViewTSNumInVCB( dblk_ptr ),
+ FS_ViewSetNameInVCB( dblk_ptr ) );
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+#ifdef OEM_MSOFT // chs:05-06-93
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_VOLUME_1, // chs:05-06-93
+#else // chs:05-06-93
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_VOLUME, // chs:05-06-93
+#endif // chs:05-06-93
+ FS_ViewVolNameInVCB( dblk_ptr ),
+ FS_ViewBSNumInVCB( dblk_ptr ),
+ FS_ViewTSNumInVCB( dblk_ptr ),
+ FS_ViewSetNameInVCB( dblk_ptr ) );
+
+ res_id = 0 ;
+
+ switch (BSD_GetBackupType( bsd_ptr) ) {
+ case BSD_BACKUP_NORMAL:
+ res_id = 0 ;
+ break;
+ case BSD_BACKUP_COPY:
+ res_id = 1 ;
+ break;
+ case BSD_BACKUP_DIFFERENTIAL:
+ res_id = 3 ;
+ break;
+ case BSD_BACKUP_INCREMENTAL:
+ res_id = 2 ;
+ break;
+ case BSD_BACKUP_DAILY:
+ res_id = 4 ;
+ break;
+ }
+
+ RSM_StringCopy( IDS_METHOD_NORMAL + res_id,
+ backup_method, 255 );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_BACKUP_TYPE, backup_method) ;
+
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)FS_ViewTapeIDInVCB( dblk_ptr ) );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)FS_ViewTSNumInVCB( dblk_ptr ) );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)FS_ViewBSNumInVCB( dblk_ptr ) );
+
+ SetStatusBlock( IDSM_OFFSETDISKNAME, (DWORD)FS_ViewVolNameInVCB( dblk_ptr ) );
+
+# if defined ( OS_WIN32 ) //special feature-EventLogging
+ {
+ INT16 nAppendFlag;
+ cds_ptr = CDS_GetCopy();
+ mwErrorDuringBackupSet = FALSE;
+
+ if (mwnTransaction != TRAN_START)
+ {
+ nAppendFlag = 1;
+ } else
+ {
+ nAppendFlag = CDS_GetAppendFlag(cds_ptr);
+ mwnTransaction = TRAN_CONT;
+ }
+
+ OMEVENT_LogBeginBackup (
+ (CHAR_PTR)FS_ViewVolNameInVCB( dblk_ptr ),
+ CDS_GetAutoVerifyBackup ( cds_ptr ),
+ nAppendFlag,
+ BSD_GetBackupType ( bsd_ptr ) );
+ }
+# endif //defined ( OS_WIN32 ) //special feature-EventLogging
+
+ delimiter = (CHAR)DLE_GetPathDelim( dle );
+
+ /* If we are backing up the catalogs and this is a new tape */
+ /* family, add the QTC filename to the catalog include list. */
+
+ if ( CDS_GetBackupCatalogs( cds_ptr ) &&
+ ( BSD_GetTapeNum( bsd_ptr ) == 1 ) &&
+ ( BSD_GetSetNum( bsd_ptr ) == 1 ) ) {
+
+ VLM_AddFileForInclude( BSD_GetTapeID( bsd_ptr ), (UINT16)1,
+ USE_WILD_CARD );
+ }
+
+ ST_StartBackupSet( &op_stats );
+
+ UI_Time( &op_stats, RES_BACKUP_STARTED, UI_START );
+
+ clock_ready_flag = TRUE;
+
+ // Call the clock routine to clear out his directory buffers.
+
+ clock_routine();
+
+ break;
+
+
+ case MSG_END_BACKUP_SET:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ // update stats
+ clock_routine();
+
+ mwCurrentPath[ 0 ] = TEXT( '\0' );
+ mwCurrentFile[ 0 ] = TEXT( '\0' );
+
+ /* turn off the real time clock */
+ clock_ready_flag = FALSE;
+
+ /* record the time that we finished */
+ ST_EndBackupSet( &op_stats );
+
+ SetStatusBlock(IDSM_DIRCOUNT, (DWORD)0 );
+ SetStatusBlock(IDSM_FILECOUNT, (DWORD)0 );
+ SetStatusBlock(IDSM_BYTECOUNTLO, (DWORD)0 );
+ SetStatusBlock(IDSM_BYTECOUNTHI, (DWORD)0 );
+ SetStatusBlock(IDSM_ELAPSEDSECONDS, (DWORD)0 );
+ SetStatusBlock(IDSM_CORRUPTFILECOUNT, (DWORD)0 );
+ SetStatusBlock(IDSM_SKIPPEDFILECOUNT, (DWORD)0 );
+
+ SetStatusBlock(IDSM_OFFSETACTIVEFILE, (DWORD)TEXT( "" ) );
+ SetStatusBlock(IDSM_OFFSETACTIVEDIR, (DWORD)TEXT("" ) );
+ SetStatusBlock(IDSM_OFFSETDISKNAME, (DWORD)TEXT("" ) );
+
+ /* force an update to the bytes counter */
+ num_bytes = ST_GetBSBytesProcessed ( &op_stats );
+
+ U64_Litoa( num_bytes, numeral, (UINT16)10, &stat ) ;
+ UI_BuildNumeralWithCommas( numeral );
+ yprintf(TEXT("%s\r"),numeral );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_BYTES_PROCESSED );
+
+ /* did the user abort or finish normal */
+
+ if ( gb_abort_flag ) {
+ if ( gfAbortInMiddleOfFile ) {
+ QTC_BlockBad( mw_qtc_ptr );
+ }
+ QTC_AbortBackup( mw_qtc_ptr );
+ }
+ else {
+ QTC_FinishBackup( mw_qtc_ptr );
+ }
+ QTC_FreeBuildHandle( mw_qtc_ptr );
+ mw_qtc_ptr = NULL;
+
+ if ( ST_GetBSFilesBad( &op_stats ) ||
+ ST_GetBSDirsBad( &op_stats ) ||
+ ST_GetBSFilesSkipped( &op_stats ) ||
+ ST_GetBSDirsSkipped( &op_stats ) ) {
+ BSD_SetOperStatus( bsd_ptr, FILES_SKIPPED );
+ }
+
+ /* display and log any abort conditions */
+ UI_ConditionAtEnd( );
+
+ UI_Time( &op_stats, RES_BACKUP_COMPLETED, UI_END );
+
+ /* produce stats for dirs & files */
+ /* display number of files / number of dirs */
+
+ dle = BSD_GetDLE( bsd_ptr );
+ if ( DLE_GetDeviceType( dle ) != FS_EMS_DRV ) {
+ if( ST_GetBSFilesProcessed( &op_stats ) == 1 &&
+ ST_GetBSDirsProcessed( &op_stats ) == 1) {
+ res_id = RES_BACKED_UP_DIR_FILE;
+ }
+ else if( ST_GetBSFilesProcessed( &op_stats ) == 1 &&
+ ST_GetBSDirsProcessed( &op_stats ) > 1) {
+ res_id = RES_BACKED_UP_DIRS_FILE;
+ }
+ else if( ST_GetBSDirsProcessed( &op_stats ) == 1 &&
+ ST_GetBSFilesProcessed( &op_stats ) > 1) {
+ res_id = RES_BACKED_UP_DIR_FILES;
+ }
+ else {
+ res_id = RES_BACKED_UP_DIRS_FILES;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSFilesProcessed( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSFilesProcessed( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+ }
+
+# if defined ( OS_WIN32 ) //special feature-EventLogging
+ {
+ OMEVENT_LogEndBackup (
+ mwErrorDuringBackupSet );
+ }
+# endif //defined ( OS_WIN32 ) //special feature-EventLogging
+
+
+ /* display number of mac files backed up */
+ if ( ST_GetBSAFPFilesProcessed( &op_stats ) > 0 ) {
+
+ if ( ST_GetBSAFPFilesProcessed( &op_stats ) == 1 ) {
+ res_id = RES_BACKED_UP_MAC;
+ }
+ else {
+ res_id = RES_BACKED_UP_MACS;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+ }
+
+ /* display number of corrupt files backed up */
+ if ( ST_GetBSFilesBad( &op_stats ) > 0 ) {
+
+// Remove this functionality (no-one liked it)
+ /* close the corrupt log file since it was used */
+// lresprintf( CORRUPT_FILE, LOG_END );
+
+ if ( ST_GetBSFilesBad( &op_stats ) == 1 ) {
+ res_id = RES_BACKED_UP_CORRUPT;
+ }
+ else {
+ res_id = RES_BACKED_UP_CORRUPTS;
+ }
+
+ yresprintf( res_id, ST_GetBSFilesBad( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSFilesBad( &op_stats ) );
+ }
+
+ /* display number of in-use files backed up */
+ if ( ST_GetBSInUseFilesProcessed( &op_stats ) > 0 ) {
+
+ if( ST_GetBSInUseFilesProcessed( &op_stats ) == 1 ) {
+ res_id = RES_BACKED_UP_IN_USE;
+ }
+ else {
+ res_id = RES_BACKED_UP_IN_USES;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSInUseFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSInUseFilesProcessed( &op_stats ) );
+ }
+
+ /* display number of files skipped backed up */
+ if ( ST_GetBSFilesSkipped( &op_stats ) > 0 ) {
+
+ /* close the skipped script log file if required since it was used */
+ if( CDS_GetCreateSkipped( cds_ptr ) ) {
+ lresprintf( SKIPPED_FILE, LOG_END );
+ }
+
+ if( ST_GetBSFilesSkipped( &op_stats ) == 1 ) {
+ res_id = RES_FILE_SKIPPED_STAT;
+ }
+ else {
+ res_id = RES_FILE_SKIPPEDS_STAT;
+ }
+
+ yresprintf( res_id, ST_GetBSFilesSkipped( &op_stats ) );
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSFilesSkipped( &op_stats ) );
+ }
+
+ /* display number of bytes processed */
+ UI_BytesProcessed( &op_stats );
+
+ /* display backup rate */
+ UI_RateProcessed( &op_stats );
+
+ delimiter = TEXT('#'); /* = # for debug */
+
+ break;
+
+ case MSG_BLOCK_SKIPPED:
+ case MSG_BLOCK_INUSE:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ ddb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ if ( (msg == MSG_BLOCK_INUSE ) &&
+ ( DLE_GetDeviceType(BSD_GetDLE( bsd_ptr) ) == FS_EMS_DRV ) ) {
+
+ QTC_BlockBad( mw_qtc_ptr );
+ yresprintf( (INT16)IDS_XCHNG_BKUP_IN_PROG );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lprintf( LOGGING_FILE, gszTprintfBuffer );
+ lprintf( LOGGING_FILE, TEXT("\n") );
+
+ return(response);
+
+ }
+
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+
+ ST_AddBSDirsSkipped( &op_stats, 1 );
+ break;
+
+ case BT_FDB:
+
+ /* if this is the first entry for this backup set AND if required then set up the file ... */
+ if ( ( ST_GetBSFilesSkipped( &op_stats ) == 0 ) &&
+ ( CDS_GetCreateSkipped( cds_ptr ) ) ) {
+ lresprintf( SKIPPED_FILE, LOG_START, FALSE );
+ size = DLE_SizeofVolName ( BSD_GetDLE( bsd_ptr ) );
+ DLE_GetVolName( BSD_GetDLE( bsd_ptr ), volume );
+
+ t_time = ST_GetBSStartTime( &op_stats );
+ UI_LongToDate( date_str, t_time );
+ UI_LongToTime( time_str, t_time );
+
+ lresprintf( SKIPPED_FILE, LOG_MSG, SES_ENG_MSG,
+ RES_SKIPPED_SCRIPT_HEADER,
+ volume,
+ DLE_GetDeviceName( BSD_GetDLE( bsd_ptr ) ),
+ date_str,
+ time_str );
+ }
+
+ ST_AddBSFilesSkipped( &op_stats, (UINT32) 1 );
+ UI_AllocPathBuffer( &file_buf, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ;
+ UI_AllocPathBuffer( &buffer, (UINT16)(FS_SizeofFnameInFDB( fsh, dblk_ptr ) +
+ FS_SizeofPathInDDB( fsh, ddb_dblk_ptr ) + 5 ) ) ;
+
+ if ( buffer && file_buf ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, file_buf );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, ddb_dblk_ptr,
+ delimiter, FALSE );
+
+ UI_AppendDelimiter( buffer, delimiter );
+ strcat( buffer, file_buf );
+
+ if ( msg == MSG_BLOCK_INUSE ) {
+ yresprintf( (INT16) RES_FILE_SKIPPED, buffer );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG,
+ RES_FILE_SKIPPED, buffer );
+ }
+ else {
+
+#if defined ( OS_WIN32 )
+ mwErrorDuringBackupSet = TRUE;
+#endif
+
+ gb_error_during_operation = TRUE;
+ yresprintf( (INT16) RES_FILE_OPEN_ERROR, buffer );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG,
+ RES_FILE_OPEN_ERROR, buffer );
+ }
+
+ /* add the entry into the skipped script ... */
+
+ if ( CDS_GetCreateSkipped( cds_ptr ) ) {
+
+ CHAR szPlusPlus[3];
+
+ UI_BuildFullPathFromDDB( &buffer, fsh, ddb_dblk_ptr,
+ delimiter, FALSE );
+ UI_AppendDelimiter( buffer, delimiter );
+ strcat( buffer, file_buf );
+
+ /* if this bsd's dle is a Novell server, prefix the script line with ++ */
+
+ szPlusPlus[0] = TEXT('\0');
+ if ( ( ( DLE_GetDeviceType( BSD_GetDLE( bsd_ptr ) ) == NOVELL_DRV ) ||
+ ( DLE_GetDeviceType( BSD_GetDLE( bsd_ptr ) ) == NOVELL_AFP_DRV ) ) &&
+ ( DLE_GetParent( BSD_GetDLE( bsd_ptr ) ) != NULL ) ) {
+
+ strcpy( szPlusPlus, TEXT("++") );
+ }
+
+ lprintf( SKIPPED_FILE, TEXT("%s%s%s\n"),
+ szPlusPlus,
+ DLE_GetDeviceName( BSD_GetDLE( bsd_ptr ) ),
+ buffer );
+ }
+ }
+ break;
+ }
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesSkipped( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_SKIPPED_FILES );
+ break;
+
+ case MSG_BYTES_SKIPPED:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ count = va_arg( arg_ptr, UINT64 );
+ ST_AddBSBytesSkipped( &op_stats, count );
+ break;
+
+ case MSG_BLOCK_BAD:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ gb_error_during_operation = TRUE;
+
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ ddb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ QTC_BlockBad( mw_qtc_ptr );
+
+ dle = BSD_GetDLE( bsd_ptr ) ;
+
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+
+ if (!mwErrorDuringBackupSet ) {
+ CHAR_PTR name;
+
+ name = mwCurrentDrive ;
+ if ( DLE_GetParent( dle ) ) {
+ name = DLE_GetDeviceName( DLE_GetParent(dle)) ;
+ }
+
+ yresprintf( (INT16) RES_EMS_COMM_FAILURE, name );
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_EMS_COMM_FAILURE, mwCurrentDrive );
+
+ }
+
+ } else {
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+
+ ST_AddBSDirsBad( &op_stats, 1 );
+
+ UI_AllocPathBuffer( &buffer, (UINT16)(FS_SizeofPathInDDB( fsh, dblk_ptr ) + 5 ) ) ;
+
+ if ( buffer ) {
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ yresprintf( (INT16) RES_BACKED_UP_CORRUPT_WARNING, buffer );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_BACKED_UP_CORRUPT_WARNING, buffer );
+
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesBad( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_CORRUPT_FILES );
+ }
+ break;
+
+ case BT_FDB:
+
+ ST_AddBSFilesBad( &op_stats, (UINT32) 1 );
+
+ UI_AllocPathBuffer( &file_buf, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ;
+ UI_AllocPathBuffer( &buffer, (UINT16)(FS_SizeofFnameInFDB( fsh, dblk_ptr ) +
+ FS_SizeofPathInDDB( fsh, ddb_dblk_ptr ) + 5 ) ) ;
+
+ if ( buffer && file_buf ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, file_buf );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, ddb_dblk_ptr, delimiter, FALSE );
+ UI_AppendDelimiter( buffer, delimiter );
+ strcat( buffer, file_buf );
+ yresprintf( (INT16) RES_BACKED_UP_CORRUPT_WARNING, buffer );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_BACKED_UP_CORRUPT_WARNING, buffer );
+
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesBad( &op_stats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_CORRUPT_FILES );
+ }
+ }
+ }
+
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ break;
+
+ case MSG_BYTES_BAD:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ count = va_arg( arg_ptr, UINT64 );
+
+ ST_AddBSBytesBad( &op_stats, count );
+
+ break;
+
+ case MSG_IN_USE:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ ST_AddBSInUseFilesProcessed( &op_stats, 1 );
+
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+
+ yresprintf( (INT16) RES_BACKED_UP_IN_USE_WARNING, buffer );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG,
+ RES_BACKED_UP_IN_USE_WARNING, buffer );
+ }
+ break;
+
+ case MSG_IN_USE_WAIT:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ TryOpen = va_arg( arg_ptr, CHK_OPEN );
+ parm = va_arg( arg_ptr, UINT32 );
+
+ if ( DLE_GetDeviceType(BSD_GetDLE( bsd_ptr) ) == FS_EMS_DRV ) {
+
+ return SKIP_OBJECT;
+
+ }
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ skip_open_files = BEC_GetSkipOpenFiles( BSD_GetConfigData( bsd_ptr ) );
+ /* check for wait on open file */
+
+#ifdef OEM_MSOFT
+ skip_open_files = SKIP_NO_TIMED;
+#endif
+
+ response = SKIP_OBJECT ;
+
+ // Make sure we have enough space to at least store the fname
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+
+ // ...+ 1 is for a delimiter between the path and filename
+ if ( ( (( strlen( mwCurrentPath ) + strlen( mwCurrentDrive ) + 1 ) * sizeof( CHAR ) ) +
+ FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) < sizeof( DrivePathFileName ) ) {
+
+ //
+ // Display full filename - drive:\path\filename
+ //
+ strcpy( DrivePathFileName, mwCurrentDrive ) ;
+ strcat( DrivePathFileName, mwCurrentPath ) ;
+ UI_AppendDelimiter( DrivePathFileName, delimiter ) ;
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer ) ;
+ strcat( DrivePathFileName, buffer ) ;
+ UI_FixPath( DrivePathFileName, MAX_DISPLAY_FULL_FILENAME_LENGTH, TEXT('\\') ) ;
+ yresprintf( (INT16) RES_WAITING_FOR_OPEN, DrivePathFileName ) ;
+ }
+ else {
+ //
+ // Display filename only - filename
+ //
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer ) ;
+ yresprintf( (INT16) RES_WAITING_FOR_OPEN, buffer ) ;
+ }
+
+ if ( skip_open_files == SKIP_NO_TIMED ) {
+
+ error = DM_StartSkipOpen( TryOpen, parm ) ;
+
+ if ( error == SUCCESS ) {
+ response = OBJECT_OPENED_SUCCESSFULLY ;
+ }
+ } else {
+
+ while( 1 ) {
+
+ if( mwSkipNoFlag == SKIPNO_YES_TO_ALL_BUTTON ) {
+ response = SKIP_OBJECT ;
+ break ;
+ }
+
+ // ask if they what to skip this file
+ mwSkipNoFlag = DM_StartSkipNo( ) ;
+
+ if( mwSkipNoFlag == SKIPNO_YES_BUTTON ) {
+ response = SKIP_OBJECT ;
+ break ;
+ }
+
+ if( mwSkipNoFlag == SKIPNO_CANCEL_BUTTON ) {
+ gb_abort_flag = ABORT_PROCESSED;
+ response = SKIP_OBJECT ;
+ break ;
+ }
+
+ // they answered No, try to open the file
+ error = TryOpen( parm ) ;
+
+ if ( error == SUCCESS ) {
+ response = OBJECT_OPENED_SUCCESSFULLY ;
+ break ;
+ }
+
+ if ( error == FS_OPENED_INUSE ) {
+ response = OBJECT_OPENED_INUSE ;
+ break ;
+ }
+
+ if ( error == FS_NOT_FOUND ) {
+ response = SKIP_OBJECT;
+ break;
+ }
+ }
+ }
+ }
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats ) ;
+
+ break ;
+
+
+ case MSG_TBE_ERROR:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ error = va_arg( arg_ptr, INT16 );
+ ddb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ strm_id = va_arg( arg_ptr, UINT32 ) ;
+
+ dle = BSD_GetDLE( bsd_ptr ) ;
+ if (( error == FS_COMM_FAILURE) &&
+ (DLE_GetDeviceType( dle) ) == FS_EMS_DRV) {
+
+ yresprintf( (INT16) RES_EMS_COMM_FAILURE, DLE_GetDeviceName( dle ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_EMS_COMM_FAILURE, DLE_GetDeviceName( dle ) );
+ QTC_BlockBad( mw_qtc_ptr );
+ QTC_AbortBackup( mw_qtc_ptr );
+ break ;
+ }
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ /* special case for backup/transfer operation */
+ if( error == TFLE_TAPE_INCONSISTENCY ) {
+ QTC_BlockBad( mw_qtc_ptr );
+ QTC_AbortBackup( mw_qtc_ptr );
+
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+ response = ABORT_OPERATION;
+ eresprintf( RES_FATAL_TAPE_FMT_NO_APPEND, BE_GetCurrentDeviceName( tpos->channel ) );
+
+ } else if ( strm_id == STRM_INVALID ) {
+
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ if ( ( error == LP_DRIVE_ATTACH_ERROR ) &&
+ ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) ) {
+ yresprintf( (INT16) RES_EMS_COMM_FAILURE, DLE_GetDeviceName( dle ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_COMM_FAILURE, mwCurrentDrive );
+
+ } else {
+ UI_ProcessErrorCode( error, &response, tpos->channel );
+ }
+
+ if ( response == SKIP_OBJECT ) {
+
+ JS_ReportStreamError( fsh, dle, strm_id, OPERATION_BACKUP, error, ddb_dblk_ptr, dblk_ptr ) ;
+ } else {
+
+ if ( gfAbortInMiddleOfFile ) {
+ QTC_BlockBad( mw_qtc_ptr );
+ }
+ QTC_AbortBackup( mw_qtc_ptr );
+ }
+
+ } else {
+ JS_ReportStreamError( fsh, dle, strm_id, OPERATION_BACKUP, error, ddb_dblk_ptr, dblk_ptr ) ;
+ if ( gfAbortInMiddleOfFile ) {
+ QTC_BlockBad( mw_qtc_ptr );
+ }
+ QTC_AbortBackup( mw_qtc_ptr );
+ }
+
+ /* Special case for handling device attach errors since we wish
+ to add this to the skipped script file */
+
+ if ( error == LP_DRIVE_ATTACH_ERROR ) {
+
+ /* Open skipped script and call write script funtion */
+
+ lresprintf( SKIPPED_FILE, LOG_START, FALSE );
+ DLE_GetVolName( BSD_GetDLE( bsd_ptr ), volume );
+
+ t_time = ST_GetBSStartTime( &op_stats );
+ UI_LongToDate( date_str, t_time );
+ UI_LongToTime( time_str, t_time );
+
+ lresprintf( SKIPPED_FILE, LOG_MSG, SES_ENG_MSG, RES_SKIPPED_DEVICE,
+ volume,
+ DLE_GetDeviceName( BSD_GetDLE( bsd_ptr ) ),
+ date_str,
+ time_str );
+
+ /* Write "script-like" selections to script file */
+ if ( output_dest[SKIPPED_FILE].fh &&
+ ( SCR_ProcessBSD( output_dest[ SKIPPED_FILE ].fh, bsd_ptr )!= SUCCESS) ) {
+
+ if ( UI_AllocPathBuffer( &buffer, UI_MAX_FILENAME_LENGTH * sizeof(CHAR) ) ) {
+ strcpy( buffer, SKIPPED_LOG );
+ strcat( buffer, BKS_EXT );
+ eresprintf( RES_ERROR_WRITING_SCRIPT, buffer );
+ }
+ }
+
+ lresprintf( SKIPPED_FILE, LOG_END );
+
+ }
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ break;
+
+ case MSG_EOM:
+
+ mwfAbortDisabledForEOM = TRUE;
+
+ /* disable the abort button for the runtime dialog */
+ JobStatusBackupRestore( (WORD) JOB_STATUS_ABORT_DISABLE );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ vcb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ ddb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ fdb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ QTC_EndOfTape( mw_qtc_ptr, vcb_dblk_ptr, ddb_dblk_ptr, fdb_dblk_ptr, fsh );
+
+ /* Clear current append mode flag */
+ CDS_SetAppendFlag( cds_ptr, 0 );
+
+ /* Prompt for new tape will be performed during TF_NEED_NEW_TAPE */
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case MSG_STOP_CLOCK:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+ break;
+
+ case MSG_START_CLOCK:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case MSG_ACCIDENTAL_VCB:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ break;
+
+ case MSG_ATTR_READ_ERROR:
+
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+
+ yresprintf( (INT16) RES_BAD_ATTR_READ, buffer );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_BAD_ATTR_READ, buffer );
+ }
+ break;
+
+ case MSG_COMM_FAILURE:
+ dle = BSD_GetDLE( bsd_ptr ); // chs:06-09-93
+
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+ yresprintf( (INT16) RES_EMS_COMM_FAILURE, mwCurrentDrive );
+ } else {
+ yresprintf( (INT16) RES_COMM_FAILURE, mwCurrentDrive );
+ }
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_COMM_FAILURE, mwCurrentDrive );
+ break;
+
+ /* ignore these messages */
+ case MSG_NOT_DELETED:
+ case MSG_IDLE:
+ case MSG_PROMPT:
+ case MSG_BLOCK_DELETED:
+ case MSG_BYTES_DELETED:
+ case MSG_TAPE_STATS:
+ case MSG_BLK_NOT_FOUND:
+ case MSG_BLK_DIFFERENT:
+ case MSG_LOG_DIFFERENCE:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ default:
+
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ QTC_BlockBad( mw_qtc_ptr );
+ QTC_AbortBackup( mw_qtc_ptr );
+
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ eresprintf( RES_UNKNOWN_MSG_HNDLR_MSG, msg );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ break;
+ }
+
+ return( response );
+}
+
+/*****************************************************************************
+
+ Name: WriteAbortOperation
+
+ Description: Ask the user if they want to continue the operation.
+ If the answer is yes, prompt for a new tape to be inserted.
+
+ Returns: (UINT16)response that is returned to Tape Positioning routine
+
+*****************************************************************************/
+UINT16 WriteAbortOperation( drive_name )
+CHAR_PTR drive_name;
+{
+ CHAR WarningTitle[255];
+
+ while ( TRUE ) {
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ if ( CDS_GetYesFlag ( CDS_GetCopy() ) != YESYES_FLAG ) {
+
+ RSM_StringCopy( IDS_MSGTITLE_CONTINUE, WarningTitle, 255 );
+
+ } else {
+
+ RSM_StringCopy( IDS_APPNAME, WarningTitle, 255 );
+ }
+
+ if ( WM_MessageBox( WarningTitle,
+ ID( RES_CONTINUE_QUEST ),
+ WMMB_YESNO | WMMB_NOYYCHECK,
+ WMMB_ICONQUESTION, NULL, 0, 0 ) ) {
+
+ yresprintf( (INT16) RES_INSERT_NEW_TAPE, drive_name );
+
+ if ( ! WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ WMMB_OK | WMMB_NOYYCHECK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 ) ) {
+ continue;
+ }
+
+#if defined( OS_WIN32 )
+ NtDemoChangeTape( 1 ) ; /* start with tape # 1 */
+#endif
+
+ return UI_NEW_TAPE_INSERTED;
+ }
+ else {
+ return UI_ABORT_POSITIONING;
+ }
+ }
+}
+
+/*****************************************************************************
+
+ Name: GetPasswordAndTapeName
+
+ Description: Common function to match/collect tape passwords and
+ new tape name in cases where a given tape is being
+ overwritten
+
+ Returns: (UINT16)response that is returned to Tape Format
+
+ Notes: Any operations that require calling the Message Handler
+ to update the catalog must be performed by the caller
+
+*****************************************************************************/
+UINT16 GetPasswordAndTapeName( bsd_ptr, cur_vcb, password, buffer, drive_name )
+BSD_PTR bsd_ptr;
+DBLK_PTR cur_vcb;
+CHAR_PTR password;
+CHAR_PTR buffer;
+CHAR_PTR drive_name;
+{
+ BOOLEAN pass_status;
+ INT16 password_size;
+ UINT16 response;
+
+ DBG_UNREFERENCED_PARAMETER ( bsd_ptr );
+ DBG_UNREFERENCED_PARAMETER ( buffer );
+
+ pass_status = CollectTapePassword( (INT8_PTR)password, &password_size,
+ FS_ViewPswdEncryptInVCB( cur_vcb ),
+ (INT8_PTR)FS_ViewTapePasswordInVCB( cur_vcb ),
+ FS_SizeofTapePswdInVCB( cur_vcb ) );
+ if ( pass_status == TRUE ) { /* password matched */
+ response = UI_OVERWRITE; /* overwrite this tape */
+ }
+ else { /* password mismatch
+ /* ask user if they want to continue with a new tape */
+ response = WriteAbortOperation( drive_name );
+ }
+ return( response );
+}
+/*****************************************************************************
+
+ Name: CarryForwardPasswordTapeName
+
+ Description: "Carries forward" to the current bsd the tape password
+ and tape name from the current vcb
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID CarryForwardPasswordTapeName( bsd_ptr, vcb_ptr )
+BSD_PTR bsd_ptr;
+DBLK_PTR vcb_ptr;
+{
+ if ( FS_SizeofTapeNameInVCB( vcb_ptr ) != 0 ) {
+ BSD_SetTapeLabel( bsd_ptr, (INT8_PTR)FS_ViewTapeNameInVCB( vcb_ptr ),
+ FS_SizeofTapeNameInVCB( vcb_ptr ) );
+ }
+
+ if ( FS_SizeofTapePswdInVCB( vcb_ptr ) != 0 ) {
+ BSD_SetTapePswd( bsd_ptr,
+ (INT8_PTR)FS_ViewTapePasswordInVCB( vcb_ptr ),
+ FS_SizeofTapePswdInVCB( vcb_ptr ) );
+ }
+ else {
+ BSD_SetTapePswd( bsd_ptr, (INT8_PTR)TEXT(""), (UINT16)0 ) ;
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: poll_drive_clock_routine
+
+ Description: one second timer to check for VLM_VALID_TAPE
+ status from poll drive
+
+ Returns: void
+
+*****************************************************************************/
+
+static VOID poll_drive_clock_routine( VOID )
+{
+
+ DBLK_PTR vcb_ptr;
+
+ mwTapeDriveStatus = VLM_GetDriveStatus( &vcb_ptr ) ;
+
+ /* Some drives report NO_TAPE to poll drive when there is a tape */
+ /* in the drive, then on the next poll they report BUSY. Count VLM_RETRY_COUNTER */
+ /* consecutive NO_TAPE status before reporting a true NO_TAPE. */
+
+ if( mwTapeDriveStatus == VLM_NO_TAPE ) {
+
+ mwNoTapeStatusCounter++ ;
+ if( mwNoTapeStatusCounter > VLM_RETRY_COUNTER ) { // chs:04-29-93
+ mwTapeDriveStatus = VLM_NO_TAPE ;
+ }
+ else {
+ mwTapeDriveStatus = VLM_BUSY ;
+ }
+ }
+ else {
+ /* reset the counter */
+ mwNoTapeStatusCounter = 0 ;
+ }
+
+
+ if( mwTapeDriveStatus == VLM_VALID_TAPE ||
+ mwTapeDriveStatus == VLM_FOREIGN_TAPE ||
+ mwTapeDriveStatus == VLM_FUTURE_VER ||
+ mwTapeDriveStatus == VLM_SQL_TAPE ||
+ mwTapeDriveStatus == VLM_ECC_TAPE ||
+ mwTapeDriveStatus == VLM_GOOFY_TAPE ||
+ mwTapeDriveStatus == VLM_BLANK_TAPE ) {
+
+ mwPollDriveWaitTimer++;
+ }
+ else {
+ /* decrement the wait timer */
+ if( mwPollDriveWaitTimer ) {
+ mwPollDriveWaitTimer--;
+ }
+ }
+}
+
+
+/*****************************************************************************
+
+ Name: clock_routine
+
+ Description: one second timer to update the Runtime status
+ elapsed time.
+
+ Note: You must have a matched set of ST_StartBackupSetIdle and
+ ST_EndBackupSetIdle calls to start and stop the clock.
+
+ Returns: void
+
+*****************************************************************************/
+
+static VOID clock_routine( VOID )
+{
+ INT16 num_hours, num_minutes, num_seconds;
+ UINT64 num_bytes;
+ BOOLEAN stat ;
+ CHAR numeral[ 40 ];
+ static INT16 last_num_hours;
+ static INT16 last_num_minutes;
+ static INT16 last_num_seconds;
+ static UINT64 total_bytes;
+ static INT animate = 0;
+
+
+ if ( clock_ready_flag && ( ST_BSIdleLevel( &op_stats ) == 0 ) ) {
+
+
+ num_bytes = ST_GetBSBytesProcessed ( &op_stats );
+ if ( ! U64_EQ( num_bytes, total_bytes) ) {
+ total_bytes = num_bytes;
+ U64_Litoa( num_bytes, numeral, (UINT16)10, &stat ) ;
+ UI_BuildNumeralWithCommas( numeral );
+
+ yprintf(TEXT("%s\r"),numeral );
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_BYTES_PROCESSED );
+
+#ifndef OEM_MSOFT
+ JobStatusStats( num_bytes );
+#endif
+
+ }
+
+ WM_AnimateAppIcon ( IDM_OPERATIONSBACKUP, FALSE );
+
+ ST_EndBackupSet( &op_stats );
+
+ SetStatusBlock(IDSM_FILECOUNT, ST_GetBSFilesProcessed( &op_stats ));
+ SetStatusBlock(IDSM_DIRCOUNT, ST_GetBSDirsProcessed( &op_stats ));
+ SetStatusBlock(IDSM_CORRUPTFILECOUNT, ST_GetBSFilesBad( &op_stats ));
+ SetStatusBlock(IDSM_SKIPPEDFILECOUNT, ST_GetBSFilesSkipped( &op_stats ));
+ SetStatusBlock(IDSM_BYTECOUNTLO, U64_Lsw(num_bytes));
+ SetStatusBlock(IDSM_BYTECOUNTHI, U64_Msw(num_bytes));
+ SetStatusBlock(IDSM_ELAPSEDSECONDS, (ST_GetBSEndTime( &op_stats ) -
+ ST_GetBSStartTime( &op_stats ) -
+ op_stats.bs_stats.bs_total_idle));
+
+ num_hours = ST_GetBSElapsedHours( &op_stats );
+ num_minutes = ST_GetBSElapsedMinutes( &op_stats );
+ num_seconds = ST_GetBSElapsedSeconds( &op_stats );
+
+ if ( ( last_num_hours != num_hours ) ||
+ ( last_num_minutes != num_minutes ) ||
+ ( last_num_seconds != num_seconds ) ) {
+
+ last_num_hours = num_hours;
+ last_num_minutes = num_minutes;
+ last_num_seconds = num_seconds;
+
+ if ( num_hours ) {
+
+ yprintf( TEXT("%d%c%2.2d%c%2.2d\r"), num_hours, UI_GetTimeSeparator(),
+ num_minutes, UI_GetTimeSeparator(), num_seconds );
+
+
+ }
+ else {
+
+ yprintf( TEXT("%2.2d%c%2.2d\r"), num_minutes, UI_GetTimeSeparator(), num_seconds );
+
+ }
+
+ JobStatusBackupRestore( (WORD) JOB_STATUS_ELAPSED_TIME );
+
+ }
+
+
+
+ }
+}
+
+/**************************************************
+ Returns the current stats structure and path/file
+ name being processed.
+***************************************************/
+INT UI_GetBackupCurrentStatus(
+STATS *Stats,
+CHAR *Path,
+INT PathSize )
+{
+ INT SpaceNeeded = 2;
+
+
+ if ( gbCurrentOperation != OPERATION_BACKUP ) {
+ return( FAILURE );
+ }
+
+ if ( Stats != NULL ) {
+ memcpy( Stats, &op_stats, sizeof( STATS ) );
+ }
+
+ SpaceNeeded += strlen( mwCurrentDrive );
+ SpaceNeeded += strlen( mwCurrentPath );
+ SpaceNeeded += strlen( mwCurrentFile );
+
+ if ( Path == NULL || PathSize < 0 ) {
+ return( FAILURE );
+ }
+
+ strcpy( Path, TEXT( "" ) );
+
+ if ( (INT)SpaceNeeded < PathSize ) {
+ strcpy( Path, mwCurrentDrive );
+ strcat( Path, mwCurrentPath );
+ if (strcmp(mwCurrentPath, TEXT("\\")) != 0)
+ {
+ strcat( Path, TEXT( "\\" ) );
+ }
+ strcat( Path, mwCurrentFile );
+ }
+ else {
+ if ( (INT)strlen( mwCurrentFile ) < PathSize ) {
+ strcpy( Path, mwCurrentFile );
+ }
+ else {
+ return( FAILURE );
+ }
+ }
+
+ return( SUCCESS );
+}
+
+/**************************************************
+ Procedure: UI_GetBackupCopyOfStatsStructure
+ Purpose: Pass the actual pointer of the STATS
+ structure.
+ return pointer o the curent STATS structure.
+***************************************************/
+STATS_PTR UI_GetBackupPtrToStatsStructure ( )
+{
+ return( &op_stats );
+}
+/**************************************************
+
+ Procedure: IsTransferTape
+
+ Purpose: Tries to find the catalog for this tape ID
+ and looks at each backup set to determine
+ if the tape is a Transfer tape.
+
+ return TRUE = transfer tape
+ FALSE = not a tansfer tape
+
+***************************************************/
+BOOLEAN IsTransferTape(
+UINT32 TapeInDriveFID )
+{
+ BOOLEAN transfer_tape = FALSE ;
+ BOOLEAN done_flag = FALSE ;
+ QTC_TAPE_PTR tape ;
+ QTC_BSET_PTR bset ;
+ QTC_HEADER_PTR header ;
+
+ tape = QTC_GetFirstTape() ;
+
+ while ( tape ) {
+
+ if ( tape->tape_fid == TapeInDriveFID ) {
+
+ bset = QTC_GetFirstBset( tape ) ;
+
+ while ( bset && !transfer_tape ) {
+
+ header = QTC_LoadHeader( bset ) ;
+
+ if( header ) {
+
+ /* Check for a transfer tape */
+ if ( header->VCB_attributes & VCB_ARCHIVE_BIT ) {
+ transfer_tape = TRUE ;
+ }
+ free( header ) ;
+ }
+
+ /* On a transfer tape, the first backup set has to be
+ a transfer set. If a transfer continuation tape, then
+ look at all of the backup sets */
+ if ( bset->bset_num == 1 ) {
+ done_flag = TRUE ;
+ break ;
+ }
+
+ bset = QTC_GetNextBset( bset ) ;
+ }
+ }
+ if ( done_flag || transfer_tape ) {
+ break ;
+ }
+
+ tape = QTC_GetNextTape( tape ) ;
+ }
+ return( transfer_tape ) ;
+}
+
diff --git a/private/utils/ntbackup/src/do_cat.c b/private/utils/ntbackup/src/do_cat.c
new file mode 100644
index 000000000..dcec5259b
--- /dev/null
+++ b/private/utils/ntbackup/src/do_cat.c
@@ -0,0 +1,2948 @@
+
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-95
+
+ Name: do_cat.c
+
+ Description: Code to catalog a tape or a set. Handles a mixture of OTC
+ tapes/sets and non-OTC tapes/sets.
+
+ $Log: G:\ui\logfiles\do_cat.c_v $
+
+ Rev 1.141.1.8 16 Jun 1994 15:46:16 STEVEN
+forgot to sleep on retry
+
+ Rev 1.141.1.7 24 May 1994 20:09:10 GREGG
+Improved handling of ECC, SQL, FUTURE_VER and OUT_OF_SEQUENCE tapes.
+
+ Rev 1.141.1.6 04 May 1994 15:09:36 STEVEN
+fix dlt settling time
+
+ Rev 1.141.1.5 21 Apr 1994 10:17:16 GREGG
+Fixed memory leak.
+
+ Rev 1.141.1.4 02 Feb 1994 18:08:34 chrish
+Added change for UNICODE app to handle ANSI secured created tape.
+
+ Rev 1.141.1.3 25 Jan 1994 08:42:04 MIKEP
+fix warnings in orcas
+
+ Rev 1.141.1.2 17 Jan 1994 15:47:22 MIKEP
+fix unicode warnings
+
+ Rev 1.141.1.1 13 Jan 1994 18:13:22 STEVEN
+dirctory count bkup caused exception
+
+ Rev 1.141.1.0 14 Dec 1993 12:11:54 BARRY
+Don't write to gszTprintfBuffer, use yprintf
+
+ Rev 1.141 24 Nov 1993 15:26:30 BARRY
+Fix Unicode warning
+
+ Rev 1.140 11 Oct 1993 18:19:06 GREGG
+Mike Payne's fix for catalogging a continuation VCB.
+
+ Rev 1.139 29 Sep 1993 17:17:40 BARRY
+Unicode fix
+
+ Rev 1.138 10 Sep 1993 13:16:24 MIKEP
+Undo zeir's last check in. It caused the catalog operation
+to stop after set 1 if on tape catalogs were not being used.
+
+ Rev 1.137 17 Aug 1993 18:18:18 ZEIR
+Set BSD PBA for non-FDD sets
+
+ Rev 1.136 17 Aug 1993 16:55:44 MIKEP
+fix sytos plus error msg
+
+ Rev 1.135 22 Jul 1993 18:36:20 KEVINS
+Corrected macro name.
+
+ Rev 1.134 22 Jul 1993 18:30:00 KEVINS
+Added support for tape drive settling time.
+
+ Rev 1.133 12 Jul 1993 09:25:58 KEVINS
+Added support for status monitor.
+
+ Rev 1.132 07 Jul 1993 08:52:34 MIKEP
+fix epr 357-461. EOM statistics bug.
+
+ Rev 1.131 25 Jun 1993 09:39:48 GLENN
+fix bug when fully cataloging a tape and the crossing set is
+already fully cataloged. It use to stop and not continue on to
+the sets on the next tape.
+
+ Rev 1.130 25 Jun 1993 08:33:04 GLENN
+fix problem with asking for tape N+2, rather than N+1, if slow mode.
+
+ Rev 1.129 24 Jun 1993 14:18:36 GREGG
+Fixed conditional for returning aux error in MSG_TBE_ERROR case in msg handler.
+
+ Rev 1.128 19 Jun 1993 13:16:18 MIKEP
+try to fix logfile bug again.
+
+ Rev 1.127 19 Jun 1993 12:11:16 GLENN
+fix catalog message box bug 294-0549. trivial bug.
+
+ Rev 1.126 18 Jun 1993 16:48:34 CARLS
+added NtDemoChangeTape calls for NtDemo
+
+ Rev 1.125 14 Jun 1993 20:33:58 MIKEP
+fix eom catalog on 8200
+
+ Rev 1.124 11 Jun 1993 10:44:28 chrish
+Nostradamus EPR 0503 - Fixed display description during a catalog operation.
+Wrong information was being displayed in the description field.
+
+ Rev 1.123 08 Jun 1993 13:20:10 chrish
+Nostradamus EPR 0533 - Corrected incorrect string display when user tried
+to catalog a secured tape. The string was reversed ... text for title and
+title for text. Corrected by reversing the above.
+
+ Rev 1.122 07 Jun 1993 09:58:26 MIKEP
+warning fixes
+
+ Rev 1.121 07 Jun 1993 08:16:44 MIKEP
+Fix epr asking for tape 3 when there is no tape 3. Fix occasional blow
+up when changing tapes.
+
+ Rev 1.120 06 Jun 1993 02:08:14 GREGG
+Pass flag to SetMap and SetCat Close indicating if the operation was aborted.
+
+ Rev 1.119 26 May 1993 17:48:30 MIKEP
+fix directory and file display.
+
+ Rev 1.118 25 May 1993 12:55:22 MIKEP
+Fix user abort between tapes and full tape catalog problem.
+
+ Rev 1.116 22 May 1993 13:42:58 MIKEP
+Fix nostradamus epr #504, update displays the same for all
+tape operations.
+
+ Rev 1.115 17 May 1993 13:37:36 MIKEP
+Fix full catalog of non-otc tape.
+
+ Rev 1.114 14 May 1993 17:32:50 MIKEP
+fix full cataloging across multiple tapes
+
+ Rev 1.113 07 May 1993 17:47:22 MIKEP
+fix abort bug
+
+ Rev 1.112 06 May 1993 09:42:56 MIKEP
+Fix numerous abort bugs.
+Add more detection of full hard drive errors.
+Don't mark last file corrupt if user aborts.
+Mark set as incoomplete if user aborts.
+
+
+ Rev 1.111 05 May 1993 10:47:30 MIKEP
+add message to handle cataloging with full hard drive.
+
+ Rev 1.110 28 Apr 1993 16:31:06 MIKEP
+warning fixes only
+
+ Rev 1.109 23 Apr 1993 10:22:02 MIKEP
+Add greg's new on tape catalog version number support.
+
+ Rev 1.108 16 Apr 1993 16:12:46 MIKEP
+put strings in resources
+
+ Rev 1.107 14 Apr 1993 16:42:50 MIKEP
+fix start backup message
+
+ Rev 1.104 12 Apr 1993 22:09:58 MIKEP
+fix missingtape again
+
+ Rev 1.103 12 Apr 1993 09:52:32 MIKEP
+fix for end of catalog full
+
+ Rev 1.100 08 Apr 1993 17:21:38 chrish
+Made change to prevent Nostradamous from cataloging a tape secured by Cayman.
+
+ Rev 1.99 05 Apr 1993 18:50:54 MIKEP
+lots of fixes
+
+ Rev 1.98 04 Apr 1993 17:49:50 MIKEP
+fix set map loading during catalog full tape &&
+abort operation if failure or user aborts.
+
+ Rev 1.97 02 Apr 1993 15:50:46 CARLS
+changes for DC2000 unformatted tape
+
+ Rev 1.96 30 Mar 1993 22:31:20 MIKEP
+fixes
+
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+
+// SUPPORTED OPERATIONS
+
+#define OPER_NONE 0 // its being terminated
+#define OPER_TAPE_PART 1 // partially catalog whole tape
+#define OPER_TAPE_FULL 2 // fully catalog whole tape
+#define OPER_BSET_FULL 3 // fully catalog single set
+
+// LoadTheSetMap returns
+
+#define LSM_NO_TAPE 0 // user lost tape
+#define LSM_NO_SM_FID 1 // no set map this tape family
+#define LSM_NO_SM_TAPE 2 // no set map this tape
+#define LSM_SM_LOADED 3 // set map loaded ok
+#define LSM_USER_ABORT 4 // user aborted
+#define LSM_BIG_ERROR 5 // tape drive error
+#define LSM_OTC_FAILURE 6 // probably hard drive full
+
+
+// LoadFDD returns
+
+#define LFDD_NO_FDD 0 // No FDD on tape
+#define LFDD_LOADED 1 // FDD loaded ok
+#define LFDD_ERROR 2 // error loading FDD
+
+// Prompt for tape options
+
+#define ASK_NEXTTAPE 0
+#define ASK_FORTAPE 1
+
+// Runtime display style
+
+#define RUNTIME_NONE 0 // none displayed yet.
+#define RUNTIME_SMALL 1 // fast cataloging
+#define RUNTIME_LARGE 2 // slow cataloging
+
+
+
+// Module Wide Globals
+
+QTC_BUILD_PTR mwQTC = NULL;
+INT mwBeenHereBefore;
+INT16 mwTapeNum;
+INT16 mwSetNum;
+UINT32 mwTapeFID;
+INT mwOperation;
+INT mwRuntime;
+INT mwEnableClock;
+INT mwEOM;
+INT mwEOD;
+BOOLEAN mwEODSetMapRead;
+INT mwDisplayRewind;
+STATS mwOpStats;
+FSYS_HAND mwFsh = (FSYS_HAND)NULL;
+HTIMER mwTimerHandle;
+INT mwLoadSetMapCalled;
+INT mwOpenSetMapActive;
+INT mwOTCFailure;
+INT mwUserAbort;
+INT mwSetMapLoaded;
+INT mwAbortAtEOM;
+
+INT mwRetryCount = 0;
+
+INT mwSkipThisSet;
+INT mwSkipThisTape;
+
+CHAR mwDriveName[ MAX_UI_RESOURCE_SIZE ]; // Tape drive name
+
+static UINT16 mwTapeSettlingCount;
+
+// Local Function Prototypes
+
+INT CallLoops( INT FDD );
+VOID ClockRoutine( VOID );
+BSD_PTR CreateAndAddTempBSD( INT FDD, BSD_HAND TempBsdList );
+INT CreateVCBFromQTC( UINT32 TapeFID, INT16 TapeSeq, INT16 SetNum, DBLK_PTR dblk, FSYS_HAND fsh );
+INT DetermineNextSet( INT OTC, INT FDD );
+INT DetermineFirstSet( );
+INT DisplayRuntime( INT style );
+INT EndOfOperation( VOID );
+INT GetBestOTCFlags(UINT32 TapeFID, INT16 TapeNum, INT16 SetNum, UINT32 *flags );
+INT GetBestFDDInfo(UINT32 TapeFID, INT16 TapeNum, INT16 SetNum, INT16 *FDDSeqNum, UINT32 *FDDPBA, UINT8 *FDDVersion );
+INT16 GetLowestSetOnTape( UINT32 TapeFID, INT16 TapeSeq );
+INT16 GetLowestTapeWithSet( UINT32 TapeFID, INT16 TapeSeq, INT16 SetNum );
+INT LoadFDD( INT *LoadFDDCalled );
+INT LoadTheSetMap( VOID );
+INT16 PromptForTape(INT WhatToAsk, INT16 TapeNum, CHAR_PTR TapeName, CHAR_PTR DriveName );
+INT ReCheckSet( );
+INT ShouldWeLoadSetMap( INT *OTC );
+INT ShouldWeLoadFDD( VOID );
+UINT16 TapePositioner( UINT16, TPOS_PTR, BOOLEAN, DBLK_PTR, UINT16 );
+INT16 TapeMsgHandler( UINT16 msg, INT32 pid, BSD_PTR bsd_ptr, FSYS_HAND fsh, TPOS_PTR tpos, ... );
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT do_catalog(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+INT16 bset_num )
+{
+ DBLK vcb;
+ DBLK_PTR vcb_ptr;
+ UINT32 TempFID;
+ INT16 TempSeq;
+ INT16 TempSet;
+ INT OTC = FALSE;
+ INT FDD = FALSE;
+ INT SetsAdded;
+ INT SetsChanged;
+ INT Status;
+ INT LoadFDDCalled;
+ INT CatalogFlag = TRUE ;
+
+ // Set global error flag, used at end of operation
+
+ gb_error_during_operation = FALSE;
+ gbAbortAtEOF = FALSE;
+
+ gb_abort_flag = CONTINUE_PROCESSING;
+
+ mwBeenHereBefore = FALSE;
+ mwDisplayRewind = TRUE;
+ mwEnableClock = FALSE;
+ mwRuntime = RUNTIME_NONE;
+ mwEOD = FALSE;
+ mwEOM = FALSE;
+ mwEODSetMapRead = FALSE;
+ mwQTC = NULL;
+ mwOTCFailure = FALSE;
+ mwUserAbort = FALSE;
+ mwOpenSetMapActive = FALSE;
+ mwSetMapLoaded = FALSE;
+ mwAbortAtEOM = FALSE;
+
+ /* we will check for tape every 3 seconds, but prompt user by interval
+ specified in INI file */
+ mwTapeSettlingCount = CDS_GetTapeDriveSettlingTime ( CDS_GetPerm () ) / 3;
+
+ if ( CDS_GetTapeDriveName( CDS_GetPerm( ) ) ) {
+
+ CHAR DriveName[80] ;
+
+ strncpy( DriveName, (CHAR_PTR)CDS_GetTapeDriveName( CDS_GetPerm( ) ), 80 ) ;
+ DriveName[79] = '\0' ;
+ strlwr( DriveName ) ;
+ if( strstr( DriveName, TEXT( "cipher" ) ) != NULL ||
+ ( strstr( DriveName, TEXT( "dec" ) ) != NULL &&
+ ( strstr( DriveName, TEXT( "thz02" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz86" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz87" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2700" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2000" ) ) != NULL ) ) ) {
+ mwTapeSettlingCount *= 2 ;
+ }
+ }
+
+
+ // Load tape drive name
+
+ RSM_StringCopy( IDS_TAPEDRIVENAME, mwDriveName, sizeof( mwDriveName ) );
+
+
+ if ( bset_num != -1 ) {
+
+ if ( gfIgnoreOTC ) {
+
+ // Use lowest tape sequence number that has been seen.
+
+ tape_seq_num = GetLowestTapeWithSet( tape_fid, tape_seq_num, bset_num );
+ }
+
+ mwOperation = OPER_BSET_FULL;
+ mwSetNum = bset_num;
+ mwTapeNum = tape_seq_num;
+ mwTapeFID = tape_fid;
+
+#ifdef OEM_MSOFT // chs:03-17-93
+ // // chs:03-17-93
+ // Test to see if user has rights to catalog the tape // chs:03-17-93
+ // // chs:03-17-93
+ // chs:03-17-93
+ if ( PSWD_CheckForPassword( tape_fid, bset_num ) ) { // chs:03-17-93
+ return( SUCCESS ); // password check failed // chs:03-17-93
+ } // chs:03-17-93
+#endif
+ }
+ else {
+
+ mwOperation = OPER_TAPE_PART;
+
+#ifndef OEM_MSOFT
+ if ( ! DM_CatTape( &CatalogFlag ) ) {
+ return( FAILURE );
+ }
+ if ( CatalogFlag == TRUE ) {
+ mwOperation = OPER_TAPE_FULL;
+ }
+#endif
+
+ // Try getting the fid from the vlm area so we can get the tape name.
+
+ if ( VLM_GetDriveStatus( &vcb_ptr ) == VLM_VALID_TAPE ) {
+
+#ifdef OEM_MSOFT
+
+ //
+ // Test to see if user has rights to catalog the tape
+ //
+
+ if ( !CatalogPasswordCheck ( vcb_ptr ) || // chs:04-08-93
+ ( WhoPasswordedTape ( (BYTE_PTR)FS_ViewTapePasswordInVCB( vcb_ptr ), FS_SizeofTapePswdInVCB( vcb_ptr ) ) == OTHER_APP) ) { // chs:04-08-93
+
+ // Popup dialog box message if
+ // not a valid user
+ //
+
+ WM_MsgBox( ID( IDS_TAPE_SECURITY_TITLE ),
+ ID( IDS_GENERAL_TAPE_SECURITY ), WMMB_OK, WMMB_ICONEXCLAMATION );
+ return( SUCCESS ); // return no rights to catalog
+ }
+#endif
+
+ // Start with the lowest numbered set on this tape.
+
+ mwTapeFID = FS_ViewTapeIDInVCB( vcb_ptr );
+ mwTapeNum = FS_ViewTSNumInVCB( vcb_ptr );
+ mwSetNum = GetLowestSetOnTape( mwTapeFID, mwTapeNum );
+ }
+ else {
+
+ // need error msg box here ?????
+
+ return( FAILURE );
+ }
+ }
+
+ if ( FS_OpenFileSys( &mwFsh, GENERIC_DATA, CDS_GetPermBEC() ) ) {
+ // need error msg box here ?????
+ return( FAILURE );
+ }
+
+ gbCurrentOperation = OPERATION_CATALOG;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_CATALOG);
+
+ mwTimerHandle = WM_HookTimer( ClockRoutine, 1 );
+ PD_StopPolling();
+
+ // start logging and display operation title in log file.
+ lresprintf( LOGGING_FILE, LOG_START, TRUE );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_DLGTITLEJOBSTATCATALOG ) ;
+
+ // Determine starting tape to ask for.
+
+ mwOperation = DetermineFirstSet( );
+
+ do {
+
+ mwSkipThisTape = FALSE;
+ mwLoadSetMapCalled = FALSE;
+
+ if ( ShouldWeLoadSetMap( &OTC ) ) {
+
+ OTC = FALSE;
+
+ Status = LoadTheSetMap( );
+
+ // Indicate we have tried.
+
+ mwSetMapLoaded = TRUE;
+
+ switch ( Status ) {
+
+ case LSM_NO_TAPE:
+ // End operation, user refused to supply correct tape.
+ mwOperation = OPER_NONE;
+ break;
+
+ case LSM_NO_SM_FID:
+ // No SM format used on tape.
+ mwOTCFailure = TRUE;
+ break ;
+
+ case LSM_NO_SM_TAPE:
+ // This tape has no SM, but next one might.
+ break;
+
+ case LSM_SM_LOADED:
+ OTC = TRUE;
+ break;
+
+ case LSM_USER_ABORT:
+ mwOperation = OPER_NONE;
+ break;
+
+ case LSM_OTC_FAILURE:
+
+ // Need message box. Failed to load OTC,
+ // hard drive may be full.
+
+ WM_MsgBox( ID( IDS_CATINFOTITLE ),
+ ID( IDS_CATLOADERROR ),
+ WMMB_OK,
+ WMMB_ICONINFORMATION );
+ break;
+
+ case LSM_BIG_ERROR:
+ mwOperation = OPER_NONE;
+
+ WM_MsgBox( ID(IDS_POLLDRIVE_MESSAGE ),
+ ID(IDS_POLLDRIVE_MESSAGE ),
+ WMMB_OK,
+ WMMB_ICONINFORMATION );
+
+ break;
+
+ }
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+ /* Check for user abort */
+
+ if ( UI_CheckUserAbort( 0 ) ) {
+ mwUserAbort = TRUE;
+ mwOperation = OPER_NONE;
+ }
+
+ if ( OTC && ! mwUserAbort && ( mwOperation != OPER_NONE ) ) {
+
+ // Set Map was loaded.
+ // Feed all the sets into the catalogs. The catalogs will
+ // ignore any it already has.
+
+ SetsChanged = FALSE;
+ SetsAdded = FALSE;
+
+ while ( TF_GetNextSMEntry( mwFsh, &vcb ) == TFLE_NO_ERR ) {
+
+ SetsChanged = TRUE;
+ UI_DisplayVCB( &vcb );
+
+ if ( mwOperation == OPER_TAPE_PART ) {
+
+ TempFID = FS_ViewTapeIDInVCB( &vcb );
+ TempSeq = FS_ViewTSNumInVCB( &vcb );
+ TempSet = FS_ViewBSNumInVCB( &vcb );
+
+ if ( VLM_FindBset( TempFID, TempSet ) == NULL ) {
+ SetsAdded = TRUE;
+ }
+ }
+
+ mwQTC = QTC_GetBuildHandle( );
+ QTC_DoFullCataloging( mwQTC, FALSE );
+ QTC_StartBackup( mwQTC, &vcb );
+ if ( VLM_CheckForCatalogError( mwQTC ) != SUCCESS ) {
+ QTC_FreeBuildHandle( mwQTC );
+ mwQTC = NULL;
+ mwUserAbort = TRUE;
+ mwOperation = OPER_NONE;
+ break;
+ }
+ QTC_FreeBuildHandle( mwQTC );
+ mwQTC = NULL;
+ }
+
+
+ if ( ! SetsAdded && mwOperation == OPER_TAPE_PART ) {
+
+ // Display message no new sets found.
+
+ WM_MsgBox( ID( IDS_CATINFOTITLE ),
+ ID( IDS_NOSETSADDED ),
+ WMMB_OK, WMMB_ICONINFORMATION );
+
+ }
+
+ if ( SetsChanged ) {
+ VLM_CatalogSync( VLM_SYNCMORE );
+ }
+
+ if ( mwOperation == OPER_TAPE_PART ) {
+ mwOperation = OPER_NONE;
+ }
+
+ mwOperation = ReCheckSet( );
+ }
+ }
+
+
+ if ( mwLoadSetMapCalled ) {
+ TF_CloseSetMap( (BOOLEAN)mwUserAbort );
+ mwLoadSetMapCalled = FALSE;
+ }
+
+ // Can we adjust the TapeNum field now ?
+
+ FDD = FALSE; // Assume worst.
+ mwSkipThisSet = FALSE; // Used if already fully cataloged.
+ LoadFDDCalled = FALSE;
+
+ if ( ShouldWeLoadFDD( ) && ( mwOperation != OPER_NONE ) ) {
+
+ // load fdd for a specific set
+
+ Status = LoadFDD( &LoadFDDCalled );
+
+ switch ( Status ) {
+
+ case LFDD_NO_FDD:
+ break;
+
+ case LFDD_LOADED:
+ FDD = TRUE;
+ break;
+
+ case LFDD_ERROR:
+ mwOperation = OPER_NONE;
+
+ WM_MsgBox( ID( IDS_CATINFOTITLE ),
+ ID( IDS_CATLOADERROR ),
+ WMMB_OK, WMMB_ICONINFORMATION );
+
+ break;
+ }
+ }
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+ /* Check for user abort */
+
+ if ( UI_CheckUserAbort( 0 ) ) {
+ mwUserAbort = TRUE;
+ mwOperation = OPER_NONE;
+ }
+
+ if ( ! mwSkipThisSet && mwOperation != OPER_NONE ) {
+ CallLoops( FDD );
+ }
+
+ mwSkipThisSet = FALSE;
+
+ if ( LoadFDDCalled ) {
+ TF_CloseSetCat( (BOOLEAN)mwUserAbort );
+ }
+
+ if ( mwUserAbort ) {
+ mwOperation = OPER_NONE;
+ }
+
+ mwOperation = DetermineNextSet( OTC, FDD );
+
+ } while ( mwOperation != OPER_NONE );
+
+ EndOfOperation( );
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT ShouldWeLoadFDD( )
+{
+ UINT32 flags;
+ BSET_OBJECT_PTR bset;
+
+ if ( gfIgnoreOTC || mwOTCFailure ) {
+ return( FALSE );
+ }
+
+
+ switch ( mwOperation ) {
+
+ case OPER_NONE:
+ break;
+
+ case OPER_TAPE_FULL:
+
+ // See if we have hit the end of the sets. Ie. we have loaded
+ // the set map for this tape and yet the one we want is unknown.
+
+ if ( mwSetMapLoaded ) {
+ if ( QTC_FindBset( mwTapeFID, mwTapeNum, mwSetNum ) == NULL ) {
+ mwTapeNum++; // bump the tape number.
+ if ( QTC_FindBset( mwTapeFID, mwTapeNum, mwSetNum ) == NULL ) {
+ mwOperation = OPER_NONE;
+ return( FALSE );
+ }
+ }
+ }
+
+ // See if this set is already cataloged full.
+
+ bset = VLM_FindBset( mwTapeFID, mwSetNum );
+ if ( bset != NULL ) {
+ if ( bset->full && ! bset->missing && ! bset->incomplete ) {
+ mwSkipThisSet = TRUE;
+ return( FALSE );
+ }
+ }
+
+ if ( GetBestOTCFlags( mwTapeFID, -1, mwSetNum, &flags ) == SUCCESS ) {
+ if ( flags & QTC_OTCVALID ) {
+ if ( flags & QTC_FDDEXISTS ) {
+ return( TRUE );
+ }
+ }
+ }
+ break;
+
+ case OPER_BSET_FULL:
+
+ bset = VLM_FindBset( mwTapeFID, mwSetNum );
+ if ( bset != NULL ) {
+ if ( bset->full && ! bset->incomplete && ! bset->missing ) {
+ return( FALSE );
+ }
+ }
+
+ if ( GetBestOTCFlags( mwTapeFID, -1, mwSetNum, &flags ) == SUCCESS ) {
+ if ( flags & QTC_OTCVALID ) {
+ if ( flags & QTC_FDDEXISTS ) {
+ return( TRUE );
+ }
+ }
+ }
+ break;
+
+ case OPER_TAPE_PART:
+ break;
+ }
+
+ return( FALSE );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT ShouldWeLoadSetMap( INT *OTC )
+{
+ UINT32 flags;
+
+ *OTC = FALSE;
+
+
+ if ( gfIgnoreOTC || mwOTCFailure ) {
+ return( FALSE );
+ }
+
+
+ switch ( mwOperation ) {
+
+ case OPER_NONE:
+ break;
+
+ case OPER_TAPE_PART:
+
+ // See if the sets on this tape have a setmap.
+
+ if ( GetBestOTCFlags( mwTapeFID, mwTapeNum, -1, &flags ) == SUCCESS ) {
+ if ( ! ( flags & QTC_SMEXISTS ) ) {
+ mwOTCFailure = TRUE;
+ return( FALSE );
+ }
+ }
+ return( TRUE );
+ break;
+
+
+ case OPER_TAPE_FULL:
+
+ // See if we have hit the end of the sets. Ie. we have loaded
+ // the set map for this tape and yet the one we want is unknown.
+
+ if ( mwSetMapLoaded ) {
+ if ( QTC_FindBset( mwTapeFID, mwTapeNum, mwSetNum ) == NULL ) {
+ mwTapeNum++; // bump tape number.
+ if ( QTC_FindBset( mwTapeFID, mwTapeNum, mwSetNum ) == NULL ) {
+ mwOperation = OPER_NONE;
+ }
+ }
+ return( FALSE );
+ }
+
+
+ // Set map has NOT been loaded.
+ // See if the sets on this tape have a setmap.
+
+ if ( GetBestOTCFlags( mwTapeFID, mwTapeNum, -1, &flags ) == SUCCESS ) {
+ if ( ! ( flags & QTC_SMEXISTS ) ) {
+ mwOTCFailure = TRUE;
+ return( FALSE );
+ }
+ else {
+ return( TRUE );
+ }
+ }
+ else {
+
+ // Some serious error occurred if we could not get
+ // BestOTCFlags()
+
+ return( FALSE );
+
+ }
+
+ break;
+
+
+ case OPER_BSET_FULL:
+
+
+ // See if we have a valid setmap vcb for this set.
+
+ if ( GetBestOTCFlags( mwTapeFID, mwTapeNum, mwSetNum, &flags ) == SUCCESS ) {
+ if ( flags & QTC_SMEXISTS ) {
+ if ( flags & QTC_OTCVALID ) {
+ *OTC = TRUE;
+ return( FALSE );
+ }
+ else {
+ return( TRUE );
+ }
+ }
+ else {
+
+ mwOTCFailure = TRUE;
+ }
+ }
+ break;
+ }
+
+ return( FALSE );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT DetermineFirstSet( )
+{
+ BSET_OBJECT_PTR VlmBsetPtr;
+ UINT32 flags;
+
+ // If we are fully cataloging a set with OTC and FDD
+ // Then use the TapeNum it ends on.
+ // But how do we know for sure until we load the SetMap ?
+
+ if ( ( mwOperation == OPER_BSET_FULL ) && ! (gfIgnoreOTC || mwOTCFailure) ) {
+
+ VlmBsetPtr = VLM_FindBset( mwTapeFID, mwSetNum );
+
+ if ( VlmBsetPtr != NULL ) {
+
+ mwTapeNum = VlmBsetPtr->base_tape;
+
+ if ( GetBestOTCFlags( mwTapeFID, mwTapeNum, mwSetNum, &flags ) == SUCCESS ) {
+
+ if ( flags & QTC_SMEXISTS ) {
+
+ mwTapeNum = VlmBsetPtr->base_tape + VlmBsetPtr->num_tapes - 1;
+ }
+ }
+ }
+ }
+
+ if ( ( mwOperation == OPER_TAPE_FULL ) && ! (gfIgnoreOTC||mwOTCFailure) ) {
+
+ // Always start with set 1, tape 1.
+
+ mwTapeNum = 1;
+ mwSetNum = 1;
+ }
+
+ return( mwOperation );
+}
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT DetermineNextSet(
+INT OTC,
+INT FDD )
+{
+ BSET_OBJECT_PTR bset;
+
+ if ( mwEOD ) {
+ return( OPER_NONE );
+ }
+
+ if ( mwEOM && ! (gfIgnoreOTC || mwOTCFailure) ) {
+ mwTapeNum++;
+ return( mwOperation );
+ }
+
+ switch ( mwOperation ) {
+
+ case OPER_BSET_FULL:
+ if ( FDD ) return( OPER_NONE );
+ else {
+ bset = VLM_FindBset( mwTapeFID, mwSetNum );
+ if ( mwTapeNum < bset->base_tape + bset->num_tapes - 1 ) {
+ mwTapeNum++;
+ }
+ else {
+ return( OPER_NONE );
+ }
+ }
+ break;
+
+ case OPER_TAPE_FULL:
+ mwSetNum++;
+ break;
+
+ case OPER_TAPE_PART:
+ mwSetNum++;
+ break;
+
+ default:
+ break;
+ }
+
+ return( mwOperation );
+}
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT ReCheckSet( )
+{
+ BSET_OBJECT_PTR VlmBsetPtr;
+ UINT32 flags;
+
+ if ( ! (gfIgnoreOTC || mwOTCFailure) ) {
+
+ if ( mwOperation == OPER_BSET_FULL || mwOperation == OPER_TAPE_FULL ) {
+
+ GetBestOTCFlags( mwTapeFID, mwTapeNum, mwSetNum, &flags );
+ VlmBsetPtr = VLM_FindBset( mwTapeFID, mwSetNum );
+
+ // Need to cover crossing sets. BUGBUG
+
+ if ( VlmBsetPtr != NULL ) {
+
+ mwTapeNum = VlmBsetPtr->base_tape;
+
+ if ( GetBestOTCFlags( mwTapeFID, mwTapeNum, mwSetNum, &flags ) == SUCCESS ) {
+
+ if ( ( flags & QTC_SMEXISTS ) && ( flags & QTC_OTCVALID ) ) {
+
+ mwTapeNum = VlmBsetPtr->base_tape + VlmBsetPtr->num_tapes - 1;
+ }
+ }
+ }
+ }
+ }
+
+ return( mwOperation );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT CallLoops(
+INT FDD )
+{
+ LIS lis;
+ BSD_HAND TempBsdList;
+ CHAR MsgBoxTitle[ MAX_UI_RESOURCE_SIZE ];
+ CHAR MsgBoxText[ MAX_UI_RESOURCE_SIZE ];
+
+ TempBsdList = (BSD_HAND)malloc( sizeof( BSD_LIST ) );
+
+ if ( TempBsdList == NULL ) {
+ return( FAILURE );
+ }
+
+ InitQueue( &(TempBsdList->current_q_hdr) );
+ InitQueue( &(TempBsdList->last_q_hdr) );
+
+ lis.curr_bsd_ptr = CreateAndAddTempBSD( FDD, TempBsdList );
+
+ if ( lis.curr_bsd_ptr == NULL ) {
+ return( FAILURE );
+ }
+
+ lis.vmem_hand = NULL;
+ lis.bsd_list = TempBsdList;
+ lis.tape_pos_handler = TapePositioner; /* set tape positioner to call */
+ lis.message_handler = TapeMsgHandler; /* set message handler to call */
+ lis.oper_type = CATALOG_TAPE_OPER; /* set operation type */
+ lis.abort_flag_ptr = &gb_abort_flag; /* set abort flag address */
+ lis.auto_det_sdrv = FALSE;
+ gb_last_operation = CATALOG_TAPE_OPER;
+
+ LP_SetAbortFlag( &lis, CONTINUE_PROCESSING );
+
+ /* set the Runtime abort flag pointer */
+ JobStatusAbort( lis.abort_flag_ptr );
+
+ if ( FDD ) {
+
+ if ( mwRuntime == RUNTIME_NONE ) {
+ DisplayRuntime( RUNTIME_SMALL );
+ }
+
+ if ( mwRuntime != RUNTIME_NONE ) {
+ mwDisplayRewind = FALSE;
+
+ RSM_StringCopy( IDS_CATINFOTITLE, MsgBoxTitle, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_NOSETSADDED, MsgBoxText, MAX_UI_RESOURCE_LEN );
+
+ yresprintf( IDS_CAT_LOADING_FDD );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE ) ;
+
+ LP_Tape_Cat_Engine( &lis );
+ }
+ else {
+
+ if ( mwRuntime != RUNTIME_LARGE ) {
+ DisplayRuntime( RUNTIME_LARGE );
+ }
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE ) ;
+
+ LP_List_Tape_Engine( &lis );
+ }
+
+ if ( mwUserAbort ) {
+
+ mwOperation = OPER_NONE;
+ }
+
+ BSD_Remove( lis.curr_bsd_ptr );
+
+ free( TempBsdList );
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+ Do one of:
+ 1. load the EOD SM.
+ { possibly prompting for and receiving continuation tapes }
+ 2. load the SM and any continuation sets on the tape .
+ { possibly prompting for and receiving continuation tapes }
+ 3. position the tape at the requested VCB for a slow operation.
+ { possibly prompting for and receiving continuation tapes }
+ 4. fail and abort the operation.
+
+ RETURNS :
+ LSM_NO_TAPE - user refused to supply desired tape.
+ LSM_NO_SM_FID - there is no setmap on this tape family.
+ LSM_NO_SM_TAPE - there is no set map on this tape of the family.
+ LSM_SM_LOADED - we loaded the desired set map, life is swell.
+ LSM_USER_ABORT - user aborted.
+ LSM_BIG_ERROR - tape drive error.
+ LSM_OTC_FAILURE - failed to load otc, hard drive may be full.
+
+**********************/
+
+INT LoadTheSetMap( )
+{
+ INT PromptNextTape = TRUE; // ask for continuation tapes.
+ INT Status = LSM_NO_SM_FID; // assume 3.1 tape.
+ TPOS Tpos;
+ UINT32 flags;
+
+ // Get VCB of tape and check to see if this tape has a SM.
+
+ if ( GetBestOTCFlags( mwTapeFID, -1, -1, &flags ) == SUCCESS ) {
+ if ( ! ( flags & QTC_SMEXISTS ) ) {
+ mwOTCFailure = TRUE;
+ return( LSM_NO_SM_FID );
+ }
+ }
+
+ // Display window to the user. Tell him we are busy loading the setmap.
+
+ if ( mwRuntime == RUNTIME_NONE ) {
+ DisplayRuntime( RUNTIME_SMALL );
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE ) ;
+ }
+
+ if ( mwRuntime != RUNTIME_NONE ) {
+ mwDisplayRewind = FALSE;
+ yresprintf( IDS_CAT_LOADING_SM );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+
+ // Initialize Tpos structure.
+
+ Tpos.tape_id = mwTapeFID;
+ Tpos.tape_seq_num = mwTapeNum;
+ Tpos.backup_set_num = mwSetNum;
+ Tpos.reference = 0L;
+ Tpos.UI_TapePosRoutine = TapePositioner;
+
+ gb_last_operation = CATALOG_TAPE_OPER;
+ gb_abort_flag = CONTINUE_PROCESSING;
+
+ /* set the Runtime abort flag pointer */
+ JobStatusAbort( &gb_abort_flag );
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE ) ;
+
+ mwLoadSetMapCalled = TRUE;
+ mwOpenSetMapActive = TRUE;
+
+
+ Status = TF_OpenSetMap( thw_list, mwFsh, &Tpos,
+ (BOOLEAN *)&mwEODSetMapRead,
+ (BOOLEAN)PromptNextTape );
+
+ mwOpenSetMapActive = FALSE;
+
+ // Set Status
+
+ switch ( Status ) {
+
+ case TF_NO_SM_ON_TAPE :
+ case TFLE_OTC_FAILURE:
+ Status = LSM_NO_SM_TAPE ;
+ break ;
+
+ // case TFLE_OTC_FAILURE:
+ // mwOTCFailure = TRUE;
+ // Status = LSM_OTC_FAILURE;
+ // break;
+
+ case TFLE_BAD_SET_MAP:
+ mwOTCFailure = TRUE;
+ Status = LSM_NO_SM_FID;
+ break;
+
+ case TF_NO_SM_FOR_FAMILY:
+ Status = LSM_NO_SM_FID;
+ break;
+
+ case TFLE_NO_ERR:
+ Status = LSM_SM_LOADED;
+ break;
+
+ case TF_END_POSITIONING:
+ case TFLE_UI_HAPPY_ABORT:
+ Status = LSM_USER_ABORT;
+ mwUserAbort = TRUE;
+ break;
+
+
+ default:
+ Status = LSM_BIG_ERROR;
+ break;
+ }
+
+ return( Status );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+ Do one of:
+ 1. load the complete FDD for the requested set.
+ { possibly prompting for and receiving continuation tapes }
+ 2. position the tape at the requested VCB for a slow operation.
+ { possibly prompting for and receiving continuation tapes }
+ 3. fail and abort the operation.
+
+ RETURNS :
+ LFDD_NO_FDD - No FDD on tape for requested set.
+ LFDD_LOADED - FDD loaded correctly.
+ LFDD_ERROR - Error occurred, No FDD loaded.
+
+**********************/
+
+INT LoadFDD( INT *LoadFDDCalled )
+{
+
+ INT Status = LFDD_NO_FDD; // assume 3.1 tape.
+ TPOS Tpos;
+ INT PromptNextTape = TRUE;
+ INT16 FddSeqNum;
+ UINT8 FddVersion;
+ UINT32 FddPBA;
+
+ UINT32 flags;
+
+ *LoadFDDCalled = FALSE;
+
+ // Get VCB of tape and check to see if this tape has a SM.
+
+ flags = 0;
+
+ if ( GetBestOTCFlags( mwTapeFID, (INT16)-1, mwSetNum, &flags ) == SUCCESS ) {
+ if ( ! ( flags & QTC_SMEXISTS ) ) {
+ mwOTCFailure = TRUE;
+ return( LFDD_NO_FDD );
+ }
+ }
+
+ // Set mwTapeNum to highest numbered set.
+
+ if ( GetBestFDDInfo( mwTapeFID, (INT16)-1, mwSetNum, &FddSeqNum, &FddPBA, &FddVersion ) != SUCCESS ) {
+ return( LFDD_NO_FDD );
+ }
+
+ mwTapeNum = FddSeqNum;
+
+ // Display window to the user. Tell him we are busy loading the setmap.
+
+ if ( mwRuntime == RUNTIME_NONE ) {
+ mwDisplayRewind = FALSE;
+ DisplayRuntime( RUNTIME_SMALL );
+ }
+
+ if ( mwRuntime != RUNTIME_NONE ) {
+ yresprintf( IDS_CAT_LOADING_FDD );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+
+ // Initialize Tpos structure.
+
+ Tpos.tape_id = mwTapeFID;
+ Tpos.tape_seq_num = FddSeqNum;
+ Tpos.backup_set_num = mwSetNum;
+ Tpos.reference = 0L;
+ Tpos.set_cat_seq_num = (INT16)FddSeqNum;
+ Tpos.set_cat_pba = FddPBA;
+ Tpos.tape_cat_ver = FddVersion;
+
+ Tpos.UI_TapePosRoutine = TapePositioner;
+
+ // If mwOperation is fully catalog tape, do not prompt for
+ // continuation tapes.
+
+ if ( mwOperation == OPER_TAPE_FULL ) {
+ PromptNextTape = FALSE;
+ }
+
+ gb_last_operation = CATALOG_TAPE_OPER;
+ gb_abort_flag = CONTINUE_PROCESSING;
+
+ /* set the Runtime abort flag pointer */
+ JobStatusAbort( &gb_abort_flag );
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE ) ;
+
+ *LoadFDDCalled = TRUE;
+
+ Status = TF_OpenSetCat( thw_list, mwFsh, &Tpos );
+
+ // adjust status
+
+ if ( Status == TFLE_NO_ERR ) {
+ Status = LFDD_LOADED;
+ }
+ else {
+ Status = LFDD_ERROR;
+ mwOTCFailure = TRUE;
+ }
+
+
+ if ( gb_abort_flag != CONTINUE_PROCESSING ) {
+
+ mwUserAbort = TRUE;
+ }
+
+ return( Status );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT DisplayRuntime( INT Style )
+{
+ CHAR *s;
+
+ // If its not already up, then display it.
+
+ if ( mwRuntime == RUNTIME_SMALL && Style == RUNTIME_LARGE ) {
+
+ // close small dialog
+
+ JobStatusBackupRestore( JOB_STATUS_DESTROY_DIALOG );
+ mwRuntime = RUNTIME_NONE;
+ }
+
+ if ( mwRuntime == RUNTIME_NONE ) {
+
+ mwRuntime = Style;
+
+ VLM_CloseAll();
+
+ if ( Style == RUNTIME_LARGE ) {
+ JobStatusBackupRestore( JOB_STATUS_CREATE_DIALOG );
+ }
+ else {
+ JobStatusBackupRestore( JOB_STATUS_CREATE_SMALL_DIALOG );
+ }
+
+ // display the restore title for the dialog
+ yresprintf( IDS_DLGTITLEJOBSTATCATALOG );
+ JobStatusBackupRestore( JOB_STATUS_CATALOG_TITLE );
+
+ // display the volume tape bitmap
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_TAPE );
+
+ yresprintf( RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( IDS_DLGTITLEJOBSTATCATALOG );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yprintf(TEXT("%s\r"), CDS_GetCatDataPath ( ) );
+ JobStatusBackupRestore( JOB_STATUS_DEST_NAME );
+
+ s = VLM_GetTapeName( mwTapeFID );
+
+ if ( s != NULL ) {
+ yprintf( TEXT("%s"), s );
+ JobStatusBackupRestore( JOB_STATUS_SOURCE_NAME ) ;
+ }
+
+ /* set the Runtime abort flag pointer */
+ JobStatusAbort( &gb_abort_flag );
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE ) ;
+
+ }
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT EndOfOperation()
+{
+ // Mark end of operation in log file.
+
+ lresprintf( LOGGING_FILE, LOG_END );
+
+ // See if any errors occurred.
+
+ UI_ChkDispGlobalError( );
+
+ // Unhook our clock timer.
+
+ WM_UnhookTimer( mwTimerHandle );
+
+ // Close the generic file system using the stored file system handle.
+
+ if ( mwFsh ) {
+ FS_CloseFileSys( mwFsh );
+ }
+
+ // Tell the world we are doing nothing.
+
+ gbCurrentOperation = OPERATION_NONE;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_IDLE);
+
+ // Auto close dialog if simple, error free, single set catalog w/ otc.
+
+ if ( ( ! gb_error_during_operation ) &&
+ mwRuntime == RUNTIME_SMALL ) {
+
+ JobStatusBackupRestore( JOB_STATUS_DESTROY_DIALOG );
+ mwRuntime = RUNTIME_NONE;
+ }
+
+ if ( mwRuntime != RUNTIME_NONE ) {
+ JobStatusBackupRestore( JOB_STATUS_ABORT_OFF );
+ mwRuntime = RUNTIME_NONE;
+ }
+
+ // Restart poll drive.
+
+ PD_StartPolling( );
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+BSD_PTR CreateAndAddTempBSD(
+INT FDD,
+BSD_HAND TempBsdList )
+{
+ CHAR_PTR s;
+ FSE_PTR fse_ptr;
+ BE_CFG_PTR bec_config;
+ DATE_TIME date;
+ BSD_PTR bsd_ptr;
+
+ /* check for a valid bsd first, set to search for first set if needed */
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+
+ if ( ( gfIgnoreOTC || mwOTCFailure ) &&
+ ( ( mwOperation == OPER_TAPE_FULL ) ||
+ ( mwOperation == OPER_TAPE_PART ) ) ) {
+
+ // We'll catalog the entire tape family if they will provide it.
+
+ if ( BSD_Add( TempBsdList, &bsd_ptr,
+ bec_config,
+ NULL, NULL, (UINT32)-1, (UINT16)-1, (INT16)-1,
+ thw_list, NULL ) == OUT_OF_MEMORY ) {
+
+ return( NULL );
+ }
+
+ }
+ else {
+
+ if ( BSD_Add( TempBsdList, &bsd_ptr,
+ bec_config,
+ NULL, NULL, mwTapeFID, mwTapeNum, mwSetNum,
+ thw_list, NULL ) == OUT_OF_MEMORY ) {
+
+ return( NULL );
+ }
+ }
+
+ if ( VLM_GetTapeName( mwTapeFID ) ) {
+ s = VLM_GetTapeName( mwTapeFID );
+ BSD_SetTapeLabel( bsd_ptr, (INT8_PTR)s, (INT16)strsize( s ));
+ }
+
+ s = VLM_GetBsetName( mwTapeFID, mwSetNum );
+
+ if ( s != NULL ) {
+ BSD_SetBackupLabel( bsd_ptr,
+ (INT8_PTR)s,
+ (INT16)strsize( s ) );
+
+ BSD_SetBackupDescript( bsd_ptr,
+ (INT8_PTR)s,
+ (INT16)strsize( s ) );
+ }
+
+ DateTimeDOS( VLM_GetBackupDate( mwTapeFID, mwSetNum ),
+ VLM_GetBackupTime( mwTapeFID, mwSetNum ),
+ &date );
+
+ BSD_SetDate( bsd_ptr, &date );
+
+ // Jump to right set if we know it is all on one tape.
+ // set bsd pba only if non-otc tape
+
+ if ( ! FDD ) {
+
+
+ // If we set the pba for OPER_TAPE_FULL then it will catalog set 1
+ // and then stop. mikep
+
+ if ( mwOperation == OPER_BSET_FULL ) {
+ BSD_SetPBA( bsd_ptr, QTC_GetMeTheVCBPBA( mwTapeFID, mwTapeNum, mwSetNum ) );
+ }
+ }
+
+ if ( BSD_CreatFSE( &fse_ptr, INCLUDE, (INT8_PTR)TEXT("\0"), (UINT16)sizeof(CHAR),
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ USE_WILD_CARD, TRUE ) != SUCCESS ) {
+
+ return( NULL );
+ }
+
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+
+ if ( ( gfIgnoreOTC || mwOTCFailure ) &&
+ ( ( mwOperation == OPER_TAPE_FULL ) ||
+ ( mwOperation == OPER_TAPE_PART ) ) ) {
+ BSD_SetTapePos( bsd_ptr, (UINT32)-1, (UINT16)-1, (UINT16)-1 );
+ }
+ else {
+ BSD_SetTapePos( bsd_ptr, mwTapeFID, mwTapeNum, mwSetNum );
+ }
+
+ return( bsd_ptr );
+}
+
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+UINT16 TapePositioner(
+UINT16 message,
+TPOS_PTR tpos,
+BOOLEAN curr_valid_vcb,
+DBLK_PTR cur_vcb,
+UINT16 mode )
+{
+ UINT16 response = UI_ACKNOWLEDGED;
+ LIS_PTR lis_ptr = ( LIS_PTR )tpos->reference;
+ BSD_PTR bsd_ptr = NULL;
+ CHAR_PTR TapeName;
+ CHAR Buffer[ MAX_UI_RESOURCE_SIZE ];
+
+ if ( lis_ptr != NULL ) {
+ bsd_ptr = (BSD_PTR)lis_ptr->curr_bsd_ptr;
+ }
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+ /* Check for user abort */
+
+ if ( UI_CheckUserAbort( message ) ) {
+ QTC_AbortCataloging( mwQTC, TRUE );
+ mwUserAbort = TRUE;
+ mwOperation = OPER_NONE;
+ return( UI_ABORT_POSITIONING );
+ }
+
+ switch ( message ) {
+
+ case TF_VCB_BOT:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ // if we've been here before
+ if ( ( gfIgnoreOTC || mwOTCFailure ) &&
+ ( ! mwBeenHereBefore ) ) {
+
+ mwBeenHereBefore = TRUE;
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+
+ }
+ else {
+ response = UI_HAPPY_ABORT;
+ }
+ break;
+
+ case TF_POSITIONED_AT_A_VCB:
+ case TF_ACCIDENTAL_VCB:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ if ( ( gfIgnoreOTC || mwOTCFailure ) &&
+ ( ( mwOperation == OPER_TAPE_FULL ) ||
+ ( mwOperation == OPER_TAPE_PART ) ) ) {
+
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+
+ }
+ else {
+ UI_DisplayVCB( cur_vcb );
+ response = UI_CONTINUE_POSITIONING;
+ }
+ break;
+
+ case TF_REQUESTED_VCB_FOUND:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ // Just do one set
+
+ if ( ( gfIgnoreOTC || mwOTCFailure ) &&
+ ( ( mwOperation == OPER_TAPE_FULL ) ||
+ ( mwOperation == OPER_TAPE_PART ) ) ) {
+
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+
+ }
+ else {
+ if ( ( FS_ViewBSNumInVCB( cur_vcb ) == BSD_GetSetNum( bsd_ptr ) ) &&
+ ( FS_ViewTapeIDInVCB( cur_vcb ) == BSD_GetTapeID( bsd_ptr ) ) ) {
+
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+ }
+ else {
+ response = UI_ABORT_POSITIONING;
+ }
+ }
+ break;
+
+ case TF_VCB_EOD:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ // They just finished an append, and we are sitting at the EOD
+ // and TF was nice enough to send us the VCB for the last set.
+ mwDisplayRewind = TRUE;
+ response = UI_BOT;
+ break;
+
+ case TF_UNRECOGNIZED_MEDIA:
+
+ // display the unrecognizable tape - unformatted tape message
+ yresprintf( (INT16) IDS_VLMUNFORMATEDTEXT ) ;
+ WM_MessageBox( ID( IDS_VLMUNFORMATEDTITLE ) ,
+ gszTprintfBuffer ,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 ) ;
+
+ // Note: allow this case to drop into the TF_NO_TAPE_PRESENT,
+ // to prompt for the tape again
+
+ case TF_NO_TAPE_PRESENT:
+
+ case TF_NEED_NEW_TAPE:
+ case TF_WRONG_TAPE:
+ case TF_INVALID_VCB:
+ case TF_EMPTY_TAPE:
+ case TF_FUTURE_REV_MTF:
+ case TF_MTF_ECC_TAPE:
+ case TF_SQL_TAPE:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN);
+
+ if ( message == TF_NO_TAPE_PRESENT ) {
+ mwRetryCount++;
+ }
+ else {
+
+ mwRetryCount = 0;
+
+ // See if we can correct the sequence number we want.
+ if ( tpos->tape_seq_num != -1 ) {
+ mwTapeNum = tpos->tape_seq_num;
+ }
+ else {
+ if ( ( gfIgnoreOTC || mwOTCFailure ) &&
+ ( ( mwOperation == OPER_TAPE_PART ) ||
+ ( mwOperation == OPER_TAPE_FULL ) ) ) {
+
+ mwTapeNum++;
+ }
+ }
+ }
+
+ if ( ( mwRetryCount == 0 ) || ( mwRetryCount > mwTapeSettlingCount ) ) {
+
+ ST_StartBackupSetIdle( &mwOpStats );
+
+ // Try several things to get the right tape name.
+
+ TapeName = NULL;
+
+ if ( bsd_ptr != NULL ) {
+ TapeName = UI_DisplayableTapeName( (LPSTR)BSD_GetTapeLabel( bsd_ptr ),
+ BSD_ViewDate( bsd_ptr ) );
+
+ // Kludge on next line.
+ bsd_ptr->tape_num = tpos->tape_seq_num;
+ }
+ if ( TapeName == NULL && tpos->tape_id != (UINT32)-1 ) {
+ TapeName = VLM_GetTapeName( tpos->tape_id );
+ }
+
+ // Give up and just ask for "the tape".
+ if ( TapeName == NULL ) {
+ RSM_StringCopy( IDS_CAT_TAPENAME, Buffer, sizeof( Buffer ) );
+ TapeName = Buffer;
+ }
+
+ mwRetryCount = 0;
+ response = PromptForTape( ASK_FORTAPE,
+ mwTapeNum,
+ TapeName, mwDriveName );
+
+ ST_EndBackupSetIdle( &mwOpStats );
+ }
+ else {
+#ifdef OS_WIN32
+ NtDemoChangeTape( (UINT16)mwTapeNum ) ;
+#endif
+ Sleep( (DWORD)3000 );
+ response = UI_NEW_TAPE_INSERTED;
+ }
+
+ if ( response != UI_NEW_TAPE_INSERTED ) {
+ mwRetryCount = 0;
+ mwOperation = OPER_NONE;
+ mwUserAbort = TRUE;
+ mwAbortAtEOM = TRUE;
+ }
+ else {
+ mwBeenHereBefore = FALSE;
+ }
+
+ break;
+
+ case TF_NO_MORE_DATA:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ mwEOD = TRUE;
+ mwDisplayRewind = TRUE;
+ response = UI_HAPPY_ABORT;
+ break;
+
+
+ case TF_READ_ERROR:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ response = UI_HandleTapeReadError( mwDriveName );
+ mwOperation = OPER_NONE;
+ break;
+
+ case TF_SEARCHING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ yresprintf( RES_SEARCHING );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ break;
+
+ case TF_REWINDING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ if ( mwDisplayRewind ) {
+ mwDisplayRewind = FALSE;
+ yresprintf( RES_REWINDING );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+ break;
+
+ case TF_DRIVE_BUSY:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_BUSY);
+ yresprintf( RES_WAITING );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ break;
+
+ case TF_IDLE_NOBREAK:
+ case TF_IDLE:
+ case TF_SKIPPING_DATA:
+ case TF_MOUNTING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ WM_MultiTask();
+ break;
+
+ // Should only happen with Sytos + tapes. User left tape >= 2
+ // in the drive. We can't continue.
+
+ case TF_TAPE_OUT_OF_ORDER:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ eresprintf( RES_POLL_DRIVE_GOOFY_TAPE, message );
+ response = UI_ABORT_POSITIONING;
+ mwOperation = OPER_NONE;
+ QTC_AbortCataloging( mwQTC, TRUE );
+ break;
+
+ default:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ eresprintf( RES_UNKNOWN_TF_MSG, message );
+ response = UI_ABORT_POSITIONING;
+ mwOperation = OPER_NONE;
+ QTC_AbortCataloging( mwQTC, TRUE );
+ break;
+ }
+
+ return( response );
+}
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT16 TapeMsgHandler(
+UINT16 msg,
+INT32 pid,
+BSD_PTR bsd_ptr,
+FSYS_HAND fsh,
+TPOS_PTR tpos,
+... )
+{
+ va_list arg_ptr;
+ DBLK_PTR dblk_ptr;
+ INT16 response = MSG_ACK;
+ BOOLEAN AlreadyCataloged;
+ OBJECT_TYPE object_type;
+ UINT64 count;
+ UINT16 os_id;
+ UINT16 os_ver;
+ INT16 error;
+
+ QTC_BSET_PTR qtc_bset_ptr; // handle for doing catalogs
+
+ static CHAR_PTR path = NULL; // pointer to space
+ static INT path_length; // bytes in use
+ static INT root_counted; // have we counted the root yet ?
+ static CHAR_PTR buffer = NULL;
+ static CHAR delimiter = TEXT('\\');
+ static DBLK SavedVCB;
+ static UINT NumTapesCrossed;
+
+ va_start( arg_ptr, tpos );
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+
+ if ( gb_abort_flag != CONTINUE_PROCESSING ) {
+
+ mwUserAbort = TRUE;
+ }
+
+ switch ( (INT16)msg ) {
+
+// You know it !
+// We are talking kludge city here. Keep the error
+// message from being displayed to the user.
+
+#ifdef MS_RELEASE
+ case -533:
+ zprintf( DEBUG_TEMPORARY, TEXT("** -533 LOOPS ERROR **") );
+ break;
+#endif
+
+
+ case MSG_CONT_VCB:
+ // This message was added to support 4.0 tape format. The
+ // continuation vcb PBA & LBA cannot be assumed to be 0
+ // because a tape header is placed on the tape. The backup
+ // engine does not know them until it gets the next tape and
+ // writes them on it. This call allows you to go back and
+ // patch the catalogs.
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ QTC_PatchContinuationVCB( mwQTC, dblk_ptr );
+ break;
+
+
+ case MSG_LOG_BLOCK:
+
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+
+
+ if ( ! gfIgnoreOTC && ! mwOTCFailure ) {
+
+ // We must check the tape number of the dblk and if it is different
+ // then we must fake an eom operation and a restart operation in
+ // the catalogs. Its OTC and feeding us the whole thing.
+
+ // Make sure in QTC that we save the PBA of the VCB we had prviously.
+ // We won't be sending a QTC_PatchContinuationVCB Msg.
+
+ if ( (UINT)FS_GetBlockTapeSeqNumber( dblk_ptr ) !=
+ FS_ViewTSNumInVCB( &SavedVCB ) + NumTapesCrossed ) {
+ NumTapesCrossed++;
+ QTC_EndOfTape( mwQTC, NULL, NULL, NULL, fsh );
+ }
+
+ }
+
+ QTC_AddToCatalog( mwQTC, dblk_ptr, fsh, FALSE, NULL, 0 );
+
+ ST_StartBackupSetIdle( &mwOpStats );
+
+ if ( gb_abort_flag != ABORT_PROCESSED ) {
+ if ( VLM_CheckForCatalogError( mwQTC ) != SUCCESS ) {
+
+ // Trip the abort flag and get us outa here.
+ // If they can't catalog, don't continue cataloging.
+
+ gb_abort_flag = ABORT_PROCESSED;
+ mwOperation = OPER_NONE;
+ }
+ }
+
+ ST_EndBackupSetIdle( &mwOpStats );
+
+ if ( gb_abort_flag == CONTINUE_PROCESSING ) {
+ // yresprintf( RES_CATALOGING_ITEMS );
+ }
+
+ switch ( FS_GetBlockType( dblk_ptr ) ) {
+
+ /* process a directory or file in the current backup set */
+ case DDB_ID:
+ {
+ INT i;
+ INT item_size;
+
+ // Count all the new directories that showed up in
+ // this DDB.
+
+ // Only count the root once.
+
+ if ( ! root_counted ) {
+ ST_AddBSDirsProcessed( &mwOpStats, 1 );
+ root_counted = TRUE;
+ }
+
+ // Get the new path from the DDB.
+
+ item_size = FS_SizeofOSPathInDDB( fsh, dblk_ptr );
+
+ if ( UI_AllocPathBuffer( &buffer, (UINT16)item_size ) ) {
+ FS_GetOSPathFromDDB( fsh, dblk_ptr, buffer );
+
+ if ( item_size != sizeof(CHAR) ) {
+
+ i = 0;
+ while ( i < (INT)(item_size / sizeof(CHAR)) ) {
+
+ if ( i >= (INT)(path_length / sizeof(CHAR)) ) {
+
+ ST_AddBSDirsProcessed( &mwOpStats, 1 );
+ }
+ else {
+
+ if ( (path == NULL ) || stricmp( &buffer[ i ], &path[ i ] ) ) {
+
+ ST_AddBSDirsProcessed( &mwOpStats, 1 );
+ path_length = 0;
+ }
+ }
+ while ( buffer[ i++ ] );
+ }
+ }
+ }
+
+ // Set up for next time.
+ if ( UI_AllocPathBuffer( &path, (UINT16)item_size) ) {
+ memcpy( path, buffer, item_size );
+ }
+ path_length = item_size;
+
+ count = FS_GetDisplaySizeFromDBLK( fsh, dblk_ptr );
+ ST_AddBSBytesProcessed( &mwOpStats, count );
+
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, TRUE );
+ yprintf( TEXT("%s"), buffer );
+
+
+ yprintf( TEXT("%s"), buffer );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORY_NAMES );
+
+ yprintf(TEXT("%ld\r"), ST_GetBSDirsProcessed( &mwOpStats ) );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_DIRECTORIES_PROCESS );
+
+ ST_EndBackupSet( &mwOpStats );
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer );
+ break;
+ }
+
+ case BT_FDB:
+ count = FS_GetDisplaySizeFromDBLK( fsh, dblk_ptr );
+ ST_AddBSBytesProcessed( &mwOpStats, count );
+ ST_AddBSFilesProcessed( &mwOpStats, 1 );
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+ if ( object_type == AFP_OBJECT ) {
+ ST_AddBSAFPFilesProcessed( &mwOpStats, 1 );
+ }
+
+ if ( CDS_GetFilesFlag( CDS_GetCopy() ) ) {
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofOSFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetOSFnameFromFDB( fsh, dblk_ptr, buffer );
+
+ UI_DisplayFile( buffer );
+
+ JobStatusBackupRestore( JOB_STATUS_FILE_NAMES );
+ ST_EndBackupSet( &mwOpStats );
+ }
+ }
+ yprintf(TEXT("%ld\r"), ST_GetBSFilesProcessed( &mwOpStats ));
+ JobStatusBackupRestore( (WORD) JOB_STATUS_FILES_PROCESSED );
+ lresprintf( LOGGING_FILE, LOG_FILE, fsh, dblk_ptr );
+ break;
+
+ /* the current file in the current backup set is corrupt */
+ case CFDB_ID:
+ QTC_BlockBad( mwQTC );
+ break;
+
+ /* image set slipped by us */
+ case BT_IDB:
+ QTC_ImageScrewUp( mwQTC );
+ gb_abort_flag = ABORT_PROCESSED;
+ break;
+
+ /* should not be anything else, so abort out ... */
+ default:
+ break;
+ }
+
+ break;
+
+ case MSG_START_BACKUP_SET:
+ {
+ UINT32 LocalFID;
+ INT16 LocalSeq;
+ INT16 LocalSet;
+ DBLK temp_dblk;
+ BSET_OBJECT_PTR bset;
+
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ NumTapesCrossed = 0;
+
+ // reset our directory counter stuff.
+
+ root_counted = FALSE;
+ path_length = 0;
+ UI_FreePathBuffer( & path );
+ path = NULL;
+
+ // see if this set is already in the catalogs
+
+ AlreadyCataloged = FALSE;
+
+ if ( dblk_ptr == NULL ) {
+
+ bset = VLM_FindBset( mwTapeFID, mwSetNum );
+
+ if ( bset != NULL ) {
+ LocalSeq = bset->base_tape;
+ }
+ else {
+ LocalSeq = mwTapeNum;
+ }
+
+ LocalFID = mwTapeFID;
+ LocalSet = mwSetNum;
+ dblk_ptr = &temp_dblk;
+ CreateVCBFromQTC( LocalFID, LocalSeq, LocalSet, &temp_dblk, mwFsh );
+ }
+ else {
+ LocalFID = FS_ViewTapeIDInVCB( dblk_ptr );
+ LocalSeq = FS_ViewTSNumInVCB( dblk_ptr );
+ LocalSet = FS_ViewBSNumInVCB( dblk_ptr );
+ }
+
+ qtc_bset_ptr = QTC_FindBset( LocalFID,
+ LocalSeq,
+ LocalSet );
+
+ if ( qtc_bset_ptr != NULL ) {
+ AlreadyCataloged = TRUE;
+ }
+
+ // Start cataloging operation
+
+ mwQTC = QTC_GetBuildHandle( );
+ if ( mwOperation == OPER_BSET_FULL ||
+ mwOperation == OPER_TAPE_FULL ) {
+ QTC_DoFullCataloging( mwQTC, TRUE );
+ }
+ else {
+ QTC_DoFullCataloging( mwQTC, FALSE );
+ }
+
+ response = QTC_StartBackup( mwQTC, dblk_ptr );
+
+ memcpy( &SavedVCB, dblk_ptr, sizeof( DBLK ) );
+
+ // See if we will be cataloging the files in this set.
+
+ ST_StartBackupSet( &mwOpStats );
+
+ UI_Time( &mwOpStats, RES_CATALOG_STARTED, UI_START );
+
+ if ( response == SKIP_TO_NEXT_BSET ) {
+
+ // Either set is already fully cataloged or
+ // we are partially cataloging the tape or both.
+
+ // maybe it was an image backup set
+
+ FS_GetOSid_verFromDBLK( fsh, dblk_ptr, &os_id, &os_ver );
+
+ if ( os_id == FS_PC_IMAGE ) {
+
+ yresprintf( RES_IMAGE_BACKUP,
+ LocalSet,
+ FS_ViewSetNameInVCB( dblk_ptr ) ) ;
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX ) ;
+ }
+ else {
+
+ if ( mwOperation == OPER_TAPE_FULL ) {
+
+ // Previously cataloged with file details.
+
+ yresprintf( RES_ALREADY_FULLY_CATALOGED,
+ LocalSet,
+ FS_ViewSetNameInVCB( dblk_ptr ) ) ;
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX ) ;
+
+ }
+ else {
+
+ // Previously partially or fully cataloged.
+
+ if ( AlreadyCataloged ) {
+
+ // Set was already in catalogs.
+
+ yresprintf( RES_ALREADY_CATALOGED_SET,
+ LocalSet,
+ FS_ViewSetNameInVCB( dblk_ptr ) ) ;
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX ) ;
+
+ }
+ else {
+
+ // Set was added, we are cataloging partial.
+
+ yresprintf( RES_NEWLY_CATALOGED_SET,
+ LocalSet,
+ FS_ViewSetNameInVCB( dblk_ptr ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( RES_DISPLAY_VOLUME,
+ FS_ViewVolNameInVCB( dblk_ptr ),
+ LocalSet,
+ LocalSeq,
+ FS_ViewSetNameInVCB( dblk_ptr ) ); // chs:06-11-93
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ }
+ }
+ }
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_VOLUME,
+ FS_ViewVolNameInVCB( dblk_ptr ),
+ LocalSet,
+ LocalSeq,
+ FS_ViewSetNameInVCB( dblk_ptr ) ); // chs:06-11-93
+
+ }
+ else {
+
+ // Set was new to catalogs, cataloging full details.
+
+ mwEnableClock = TRUE;
+ error = SUCCESS;
+
+ yresprintf( RES_NEWLY_CATALOGED_SET,
+ LocalSet,
+ FS_ViewSetNameInVCB( dblk_ptr ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( RES_CATALOGING_ITEMS );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( RES_DISPLAY_VOLUME,
+ FS_ViewVolNameInVCB( dblk_ptr ),
+ LocalSet,
+ LocalSeq,
+ FS_ViewSetNameInVCB( dblk_ptr ) ); // chs:06-11-93
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_VOLUME,
+ FS_ViewVolNameInVCB( dblk_ptr ),
+ LocalSet,
+ LocalSeq,
+ FS_ViewSetNameInVCB( dblk_ptr ) ); // chs:06-11-93
+
+ }
+ }
+ break;
+
+ case MSG_EOM:
+
+ mwEOM = TRUE;
+
+ if ( gfIgnoreOTC || mwOTCFailure ) {
+
+ QTC_EndOfTape( mwQTC, NULL, NULL, NULL, fsh );
+ }
+ break;
+
+ case MSG_END_BACKUP_SET:
+
+ // Help the tape positioner above out by letting him know that
+ // processing of the tape has begun.
+
+
+ if ( ! mwAbortAtEOM ) {
+
+ QTC_FinishBackup( mwQTC );
+ }
+
+ ST_StartBackupSetIdle( &mwOpStats );
+
+ if ( gb_abort_flag != ABORT_PROCESSED ) {
+ if ( VLM_CheckForCatalogError( mwQTC ) != SUCCESS ) {
+ gb_abort_flag = ABORT_PROCESSED;
+ }
+ }
+
+ QTC_FreeBuildHandle( mwQTC );
+ ST_EndBackupSetIdle( &mwOpStats );
+ ST_EndBackupSet( &mwOpStats );
+
+ ClockRoutine(); // one last time
+ mwEnableClock = FALSE;
+
+ /* display and log any abort conditions */
+ UI_ConditionAtEnd( );
+ UI_Time( &mwOpStats, RES_CATALOG_COMPLETED, UI_END );
+ break;
+
+ case MSG_TBE_ERROR:
+ error = va_arg( arg_ptr, INT16 );
+
+ mwOperation = OPER_NONE;
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &mwOpStats );
+
+ UI_ProcessErrorCode( error, &response, tpos->channel );
+
+ // Keep going don't abort.
+ response = MSG_ACK;
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &mwOpStats );
+
+ if ( error != TFLE_USER_ABORT ) {
+ // Mark the last file as bad if not user abort.
+ QTC_BlockBad( mwQTC );
+ }
+
+ // Abort the catalog, marking the set as incomplete.
+ QTC_AbortCataloging( mwQTC, TRUE );
+
+ // If TapeFormat hits EOS unexpectedly, then we'll return what
+ // UI_ProcessErrorCode() says. (Namely, abort operation.)
+ if( error != TFLE_UNEXPECTED_EOS && error != LP_USER_ABORT_ERROR &&
+ error != TFLE_UI_HAPPY_ABORT && error != TFLE_USER_ABORT ) {
+
+ return AUXILARY_ERROR;
+ }
+ break;
+
+ case MSG_STOP_CLOCK:
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &mwOpStats );
+ break;
+
+ case MSG_START_CLOCK:
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &mwOpStats );
+ break;
+
+ case MSG_END_OPERATION:
+ UI_FreePathBuffer( &path );
+ UI_FreePathBuffer( &buffer );
+ break;
+
+ /* ignore these messages */
+ case MSG_IDLE:
+ case MSG_BLOCK_BAD:
+ case MSG_BYTES_BAD:
+ case MSG_BLOCK_DELETED:
+ case MSG_BYTES_DELETED:
+ case MSG_TAPE_STATS:
+ case MSG_BLK_NOT_FOUND:
+ case MSG_BLK_DIFFERENT:
+ case MSG_LOG_DIFFERENCE:
+ case MSG_START_OPERATION:
+ break;
+
+ default:
+ gb_error_during_operation = TRUE;
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &mwOpStats );
+ eresprintf( RES_UNKNOWN_MSG_HNDLR_MSG, msg );
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &mwOpStats );
+ mwOperation = OPER_NONE;
+ break;
+ }
+
+ return( response );
+
+}
+
+
+/*******************
+
+ Name: PromptNextTape
+
+ Description: Function to collect user response when a new tape is
+ required from the Tape Format/Tape positioner.
+
+ Returns: UI_ABORT_POSITIONING or UI_NEW_TAPE_INSERTED
+
+**********************/
+INT16 PromptForTape(
+INT WhatToAsk,
+INT16 TapeNum,
+CHAR_PTR TapeName,
+CHAR_PTR DriveName )
+{
+ INT response;
+
+ mwDisplayRewind = TRUE;
+
+ CDS_SetYesFlag( CDS_GetCopy(), NO_FLAG );
+
+ switch ( WhatToAsk ) {
+
+ case ASK_NEXTTAPE:
+ yresprintf( RES_INSERT_NEXT_TAPE, TapeNum, DriveName );
+
+ response = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ ID( RES_NEED_NEXT_TAPE ),
+ WMMB_OKCANCEL,
+ WMMB_ICONQUESTION,
+ gszTprintfBuffer,
+ IDRBM_LTAPE, 0 );
+ break;
+
+ case ASK_FORTAPE:
+ yresprintf( RES_TAPE_REQUEST, DriveName, TapeName,
+ TapeNum );
+
+ response = (INT)WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ gszTprintfBuffer,
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ),
+ 0, 0 );
+
+ break;
+ }
+
+ if ( response ) {
+#ifdef OS_WIN32
+ Sleep( (DWORD)3000 );
+ NtDemoChangeTape( (UINT16)mwTapeNum );
+#endif
+ response = UI_NEW_TAPE_INSERTED;
+ }
+ else {
+ response = UI_HAPPY_ABORT;
+ }
+
+ return( (INT16)response );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID ClockRoutine( VOID )
+{
+ INT16 NumHours;
+ INT16 NumMinutes;
+ INT16 NumSeconds;
+ UINT64 NumBytes;
+ BOOLEAN stat;
+ CHAR Numeral[ 40 ];
+ static UINT64 TotalBytes;
+
+
+ if ( mwRuntime && mwEnableClock && ( ST_BSIdleLevel( &mwOpStats ) == 0 ) ) {
+
+
+ NumBytes = ST_GetBSBytesProcessed ( &mwOpStats );
+
+ if ( !U64_EQ( NumBytes, TotalBytes ) ) {
+ TotalBytes = NumBytes;
+ U64_Litoa( NumBytes, Numeral, (UINT16)10, &stat ) ;
+ UI_BuildNumeralWithCommas( Numeral );
+ yprintf(TEXT("%s\r"),Numeral );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+ }
+
+
+ WM_AnimateAppIcon( IDM_OPERATIONSCATALOG, FALSE );
+
+ ST_EndBackupSet( &mwOpStats );
+
+ NumHours = ST_GetBSElapsedHours( &mwOpStats );
+ NumMinutes = ST_GetBSElapsedMinutes( &mwOpStats );
+ NumSeconds = ST_GetBSElapsedSeconds( &mwOpStats );
+
+ if ( NumHours ) {
+ yprintf( TEXT("%d%c%2.2d%c%2.2d\r"),
+ NumHours, UI_GetTimeSeparator(),
+ NumMinutes, UI_GetTimeSeparator(), NumSeconds );
+ }
+ else {
+ yprintf( TEXT("%2.2d%c%2.2d\r"),
+ NumMinutes, UI_GetTimeSeparator(), NumSeconds );
+ }
+
+ JobStatusBackupRestore(JOB_STATUS_ELAPSED_TIME);
+
+
+ }
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT UI_GetCatalogCurrentStatus(
+STATS *Stats,
+CHAR *Path,
+INT PathSize )
+{
+
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT CreateVCBFromQTC(
+UINT32 TapeFID,
+INT16 TapeSeq,
+INT16 SetNum,
+DBLK_PTR vcb,
+FSYS_HAND fsh )
+{
+ DATE_TIME backup_date;
+ QTC_BSET_PTR qtc;
+ QTC_HEADER_PTR header;
+ GEN_VCB_DATA gvcb_data;
+ STD_DBLK_DATA_PTR std_data = &gvcb_data.std_data;
+
+ qtc = QTC_FindBset( TapeFID, TapeSeq, SetNum );
+ if ( qtc == NULL ) {
+ return( FAILURE );
+ }
+
+ header = QTC_LoadHeader( qtc );
+ if ( header == NULL ) {
+ return( FAILURE );
+ }
+
+ /* Initialize the file systems interface structure */
+
+ FS_SetDefaultDBLK( fsh, BT_VCB, (CREATE_DBLK_PTR)&gvcb_data );
+
+ std_data->dblk = vcb;
+ std_data->tape_seq_num = (UINT16)header->tape_seq_num;
+
+ std_data->attrib = header->VCB_attributes;
+ std_data->continue_obj = (BOOLEAN)( header->status & QTC_CONTINUATION );
+
+ std_data->os_id = (UINT8)header->OS_id;
+ std_data->os_ver = (UINT8)header->OS_ver;
+
+ std_data->os_info = NULL;
+ std_data->os_info_size = 0;
+
+ std_data->lba = header->LBA;
+ std_data->disp_size = U64_Init( 0L, 0L );
+
+#if defined( UNICODE )
+ std_data->string_type = BEC_UNIC_STR;
+#else
+ std_data->string_type = BEC_ANSI_STR;
+#endif
+
+ gvcb_data.set_cat_tape_seq_num = (UINT16)header->FDD_SeqNum;
+ if ( ( gvcb_data.set_cat_pba = header->FDD_PBA ) == 0L ) {
+ gvcb_data.set_cat_info_valid = FALSE;
+ gvcb_data.on_tape_cat_ver = (UINT8)header->FDD_Version;
+ gvcb_data.on_tape_cat_level = TCL_PARTIAL;
+ } else {
+ gvcb_data.set_cat_info_valid = TRUE;
+ gvcb_data.on_tape_cat_ver = (UINT8)header->FDD_Version;
+ gvcb_data.on_tape_cat_level = TCL_FULL;
+ }
+
+ gvcb_data.tape_id = TapeFID;
+ gvcb_data.tape_seq_num = TapeSeq;
+ gvcb_data.bset_num = SetNum;
+
+ gvcb_data.password_encrypt_alg = (UINT16)header->encrypt_algor;
+
+ gvcb_data.tape_name = header->tape_name;
+ gvcb_data.tape_name_size = (UINT16)header->tape_name_size;
+ gvcb_data.tape_password = header->tape_password;
+ gvcb_data.tape_password_size = (UINT16)header->tape_password_size;
+
+ gvcb_data.bset_name = header->bset_name;
+ gvcb_data.bset_name_size = (UINT16)header->bset_name_size;
+
+ gvcb_data.bset_password = header->bset_password;
+ gvcb_data.bset_password_size = (UINT16)header->bset_password_size;
+
+ gvcb_data.bset_descript = header->bset_description;
+ gvcb_data.bset_descript_size = (UINT16)header->bset_description_size;
+
+ gvcb_data.user_name = header->user_name;
+ gvcb_data.user_name_size = (UINT16)header->user_name_size;
+
+ gvcb_data.volume_name = header->volume_name;
+ gvcb_data.volume_name_size = (UINT16)header->volume_name_size;
+
+ DateTimeDOS( (INT16)header->backup_date,
+ (INT16)header->backup_time,
+ &backup_date );
+
+ gvcb_data.date = &backup_date;
+
+ gvcb_data.pba = header->PBA_VCB;
+
+ /* Tell the file system to do its thing. It returns a data filter
+ which we have no use for.
+ */
+ (void) FS_CreateGenVCB( fsh, &gvcb_data );
+
+ free( header );
+
+ return( SUCCESS );
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT16 GetLowestTapeWithSet(
+UINT32 TapeFID,
+INT16 TapeSeq,
+INT16 SetNum )
+{
+ INT16 LowTape;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+
+ LowTape = TapeSeq;
+
+ tape = QTC_GetFirstTape();
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == TapeFID ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == SetNum ) {
+ if ( ( tape->tape_seq_num < LowTape ) || ( LowTape == (INT16)-1 ) ) {
+ LowTape = (INT16)tape->tape_seq_num;
+ }
+ }
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( LowTape );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT16 GetLowestSetOnTape(
+UINT32 TapeFID,
+INT16 TapeSeq )
+{
+ INT16 LowSet = -1;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+
+ tape = QTC_GetFirstTape();
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == TapeFID && tape->tape_seq_num == TapeSeq ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num < LowSet || LowSet == -1 ) {
+ LowSet = (INT16)bset->bset_num;
+ }
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( LowSet );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT GetBestOTCFlags(
+UINT32 TapeFID,
+INT16 TapeNum,
+INT16 SetNum,
+UINT32 *flags )
+{
+ QTC_BSET_PTR bset;
+ QTC_TAPE_PTR tape;
+ INT ret_val = FAILURE;
+
+ *flags = 0;
+
+ if ( gfIgnoreOTC || mwOTCFailure ) {
+ return( ret_val );
+ }
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == TapeFID ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->status & QTC_SMEXISTS ) {
+ *flags |= QTC_SMEXISTS;
+ }
+ if ( bset->status & QTC_FDDEXISTS ) {
+ *flags |= QTC_FDDEXISTS;
+ }
+ if ( bset->status & QTC_OTCVALID ) {
+ *flags |= QTC_OTCVALID;
+ }
+
+ ret_val = SUCCESS;
+
+ bset = QTC_GetNextBset( bset );
+ }
+
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( ret_val );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT GetBestFDDInfo(
+UINT32 TapeFID,
+INT16 TapeNum,
+INT16 SetNum,
+INT16 *FDDSeqNum,
+UINT32 *FDDPBA,
+UINT8 *FDDVersion )
+{
+ QTC_HEADER_PTR header;
+ QTC_BSET_PTR bset;
+ QTC_TAPE_PTR tape;
+ INT ret_val = FAILURE;
+
+
+ if ( gfIgnoreOTC || mwOTCFailure ) {
+ return( ret_val );
+ }
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL && ret_val == FAILURE ) {
+
+ if ( tape->tape_fid == TapeFID ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == SetNum ) {
+
+ if ( (bset->status & QTC_OTCVALID) && (bset->status & QTC_FDDEXISTS) ) {
+
+ header = QTC_LoadHeader( bset );
+
+ if ( header != NULL ) {
+
+ *FDDSeqNum = (UINT8)header->FDD_SeqNum;
+ *FDDPBA = header->FDD_PBA;
+ *FDDVersion = (UINT8)header->FDD_Version;
+
+ // Handle old catalogs which weren't set.
+
+ if ( *FDDVersion == (UINT8)0 ) {
+ *FDDVersion = (UINT8)1;
+ }
+ ret_val = SUCCESS;
+ free( header );
+ }
+ }
+ }
+
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( ret_val );
+}
+
+/**********************
+
+ NAME : CatalogPasswordCheck
+
+ DESCRIPTION : Check to see ifcurrent users has rights to catalog a tape.
+
+ RETURNS : TRUE - allowed access to catalog a tape
+ FALSE - not allowed access to catalog a tape
+
+**********************/
+
+BOOLEAN CatalogPasswordCheck ( DBLK_PTR vcb_ptr )
+{
+ CHAR_PTR currentloggedonuserpassword;
+ CHAR_PTR temppasswd; // hold the tape password from the VCB
+ // passwd on the tape.
+ INT16 tempsize; // length of password from tape.
+ CHAR_PTR buffer = NULL;
+ CHAR_PTR alteredtemppassword = NULL;
+ CHAR_PTR temppasswdbuffer = NULL;
+ INT16 currentpswdlength;
+ BOOLEAN retcode;
+
+
+ // If user has administrative access
+
+ if ( DoesUserHaveThisPrivilege( TEXT( "SeRestorePrivilege" ) ) ) {
+ return( TRUE );
+ }
+
+ //
+ // Get a current user-id-password
+ //
+
+ currentloggedonuserpassword = GetCurrentMachineNameUserName ();
+ if ( !currentloggedonuserpassword ) {
+ return( FALSE );
+ }
+
+ currentpswdlength = strlen( currentloggedonuserpassword );
+ alteredtemppassword = ( CHAR_PTR )calloc( 1, sizeof( CHAR ) * currentpswdlength + 2 * sizeof( CHAR ) );
+ if ( !alteredtemppassword ) return( FALSE );
+ *alteredtemppassword = NTPASSWORDPREFIX; // chs:04-08-93
+ strcat( alteredtemppassword, currentloggedonuserpassword );
+ currentpswdlength = strlen( alteredtemppassword ) * sizeof( CHAR );
+
+ //
+ // Verify if user tape password matches.
+ // Check the tape password from the current VCB
+ //
+
+ temppasswd = (CHAR_PTR)FS_ViewTapePasswordInVCB( vcb_ptr );
+ tempsize = FS_SizeofTapePswdInVCB( vcb_ptr );
+
+ //
+ // tempsize = 0 means no password on tape
+ //
+
+ if ( tempsize == 0 ) {
+ return( TRUE );
+ }
+
+ buffer = ( CHAR_PTR )calloc( 1, tempsize * sizeof( CHAR ) );
+ if ( !buffer ) {
+ free( alteredtemppassword );
+ return( FALSE );
+ }
+
+#ifdef UNICODE
+ if ( FS_ViewStringTypeinDBLK( vcb_ptr ) == BEC_ANSI_STR ) {
+
+ temppasswdbuffer = ( CHAR_PTR )calloc(1, sizeof( CHAR ) + tempsize );
+ if ( !temppasswdbuffer ) {
+ free( buffer );
+ free( alteredtemppassword );
+ return( FALSE );
+ }
+ memcpy( temppasswdbuffer, temppasswd, tempsize );
+ CryptPassword( ( INT16 ) DECRYPT, ENC_ALGOR_3, (INT8_PTR)temppasswdbuffer, tempsize );
+ tempsize *= sizeof( CHAR );
+ mapAnsiToUnicNoNull( ( ACHAR_PTR )temppasswdbuffer, ( WCHAR_PTR )buffer, ( INT )(tempsize / sizeof( CHAR ) ), ( INT * )&tempsize ) ;
+ if ( ( *temppasswdbuffer & 0xff ) == NTPASSWORDPREFIX ) {
+ *buffer = NTPASSWORDPREFIX;
+ }
+ free( temppasswdbuffer );
+
+ } else {
+ memcpy( buffer, temppasswd, tempsize );
+ CryptPassword( ( INT16 ) DECRYPT, ENC_ALGOR_3, (INT8_PTR)buffer, tempsize );
+ }
+#else
+ memcpy( buffer, temppasswd, tempsize );
+ CryptPassword( ( INT16 ) DECRYPT, ENC_ALGOR_3, (INT8_PTR)buffer, tempsize );
+#endif
+
+ if ( currentpswdlength == tempsize ) {
+
+ if ( !memcmp( buffer, alteredtemppassword, tempsize ) ) {
+
+ retcode = TRUE; // password match
+
+ } else {
+
+ retcode = FALSE; // password does not match
+ }
+
+ } else {
+
+ retcode = FALSE; // password lengths do not match
+ }
+
+ if ( alteredtemppassword ) free ( alteredtemppassword );
+ if ( buffer ) free( buffer );
+
+ return( retcode );
+}
+
diff --git a/private/utils/ntbackup/src/do_del.c b/private/utils/ntbackup/src/do_del.c
new file mode 100644
index 000000000..c1b236aeb
--- /dev/null
+++ b/private/utils/ntbackup/src/do_del.c
@@ -0,0 +1,638 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_del.c
+
+ Description:
+
+ $Log: G:\ui\logfiles\do_del.c_v $
+
+ Rev 1.33 26 Jul 1993 14:55:04 CARLS
+added code for MSG_NOT_DELETED
+
+ Rev 1.32 01 Jun 1993 16:30:32 chrish
+CAYMAN EPR 0385: Corrected delete phase of transfer process which had
+stated "Deleted 1 file in 2 directory".
+
+ Rev 1.31 18 Feb 1993 11:19:50 BURT
+For Cayman, fixed apparant bug that should also cause
+some problems under Windows. path[0] was being set to 0, but
+path pointed to NULL so kaboom under NT.
+
+
+ Rev 1.30 05 Nov 1992 17:01:58 DAVEV
+fix ts
+
+ Rev 1.28 07 Oct 1992 14:48:58 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.27 04 Oct 1992 19:34:02 DAVEV
+Unicode Awk pass
+
+ Rev 1.26 10 Sep 1992 17:44:42 DAVEV
+Integrate MikeP's changes from Microsoft
+
+ Rev 1.25 28 Jul 1992 14:52:52 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.24 27 Jul 1992 14:49:38 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.23 27 Jul 1992 11:08:18 JOHNWT
+ChuckB checked in for John Wright, who is no longer with us.
+
+ Rev 1.22 07 Jul 1992 15:31:18 MIKEP
+unicode changes
+
+ Rev 1.21 28 May 1992 15:20:18 MIKEP
+proto changes
+
+ Rev 1.20 19 May 1992 11:58:52 MIKEP
+mips changes
+
+ Rev 1.19 14 May 1992 17:39:36 MIKEP
+nt pass 2
+
+ Rev 1.18 11 May 1992 19:31:18 STEVEN
+64bit and large path sizes
+
+
+*****************************************************************************/
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static INT16 msg_hndlr( UINT16 msg, INT32 pid, BSD_PTR bsd_ptr, FSYS_HAND fsh, TPOS_PTR tpos, ... );
+static VOID clock_routine( VOID );
+static VOID do_delete_init( VOID );
+static VOID do_delete_process( VOID );
+
+static BOOLEAN clock_ready_flag;
+static HTIMER timer_handle;
+static STATS op_stats;
+static INT mw_oper_type;
+static INT16 mw_ret_val;
+
+/*****************************************************************************
+
+ Name: do_delete
+
+ Description: Kicks off the delete function. It first prompts the user
+ to make sure they wish to delete the data and then
+ displays the RTD.
+
+ Returns: SUCCESS or error from delete engine.
+
+ Notes: mw_ret_val is set in do_delete_process().
+
+*****************************************************************************/
+
+INT do_delete(
+ INT16 oper_type )
+{
+
+ mw_oper_type = oper_type;
+ mw_ret_val = SUCCESS;
+
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_ERASE ),
+ ID( RES_DELETE_QUEST ),
+ WMMB_YESNO | WMMB_BUT2DEFAULT,
+ WMMB_ICONQUESTION, NULL, 0, 0 ) ) {
+
+ /* set up call back functions, runtime dialog is app modal */
+
+ do_delete_init();
+ do_delete_process();
+
+ }
+
+ return( mw_ret_val );
+
+}
+
+
+/*****************************************************************************
+
+ Name: do_delete_init
+
+ Description: Initialize the text on the RTD.
+
+ Returns: none.
+
+*****************************************************************************/
+
+VOID do_delete_init( VOID )
+{
+ JobStatusBackupRestore( JOB_STATUS_CREATE_DIALOG );
+
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATDELETE );
+ JobStatusBackupRestore( JOB_STATUS_BACKUP_TITLE );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATDELETE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yprintf(TEXT("%d\r"),0 );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: do_delete_process
+
+ Description: Initialize the lis structure, etc and call the delete
+ engine to perform the operation.
+
+ Returns: none.
+
+ Notes: sets mw_ret_val to return from delete engine.
+
+*****************************************************************************/
+
+VOID do_delete_process( VOID )
+{
+ LIS lis;
+
+ lis.bsd_list = bsd_list;
+ lis.curr_bsd_ptr = BSD_GetFirst( bsd_list );
+ lis.tape_pos_handler = NULL;
+ lis.message_handler = msg_hndlr;
+ lis.oper_type = (INT16)mw_oper_type; /* set operation type */
+ lis.abort_flag_ptr = &gb_abort_flag; /* set abort flag address */
+ lis.auto_det_sdrv = TRUE; /* really a don't care value */
+
+ LP_SetAbortFlag( &lis, CONTINUE_PROCESSING );
+
+ /* set the Runtime abort flag pointer */
+ JobStatusAbort( lis.abort_flag_ptr );
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE );
+
+ BSD_SaveLastOper( bsd_list );
+ BSD_ProcLastOper( bsd_list );
+
+ clock_ready_flag = FALSE; // Wait on bset to start
+
+ timer_handle = WM_HookTimer( clock_routine, 1 );
+
+ PD_StopPolling();
+
+ /* clear the statistics before the operation starts */
+ ST_StartOperation( &op_stats );
+
+ mw_ret_val = LP_Delete_Engine( &lis );
+
+ PD_StartPolling();
+
+ WM_UnhookTimer( timer_handle );
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_OFF );
+
+ return;
+}
+
+
+
+/*****************************************************************************
+
+ Name: clock_routine
+
+ Description: one second timer to update the Runtime status
+ elapsed time
+
+ Returns: void
+
+*****************************************************************************/
+
+static VOID clock_routine( VOID )
+{
+ INT16 num_min, num_seconds;
+
+ if ( clock_ready_flag ) {
+
+ ST_EndBackupSet( &op_stats );
+
+ num_min = ST_GetBSElapsedMinutes( &op_stats );
+ num_seconds = ST_GetBSElapsedSeconds( &op_stats );
+
+ yprintf( TEXT("%2.2d%c%2.2d\r"), num_min, UI_GetTimeSeparator(), num_seconds );
+
+ JobStatusBackupRestore( JOB_STATUS_ELAPSED_TIME );
+ }
+}
+
+/*****************************************************************************
+
+ Name: msg_hndlr
+
+ Description: Delete message handler called by the loops
+
+ Returns:
+
+*****************************************************************************/
+
+INT16 msg_hndlr(
+UINT16 msg,
+INT32 pid,
+BSD_PTR bsd_ptr,
+FSYS_HAND fsh,
+TPOS_PTR tpos, ... )
+{
+ static CHAR delimiter = TEXT('#'); /* = # for debug */
+ INT16 response = MSG_ACK;
+ va_list arg_ptr;
+ UINT64 num_bytes;
+ BOOLEAN stat;
+ CHAR numeral[ UI_MAX_NUMERAL_LENGTH + 1 ];
+ CDS_PTR cds_ptr;
+
+ static CHAR_PTR path_buf = NULL;
+ static CHAR_PTR path = NULL;
+ static INT path_length;
+ static INT root_counted;
+
+ /* for future use */
+ pid;
+
+ cds_ptr = CDS_GetCopy();
+
+ /* set up first argument */
+ va_start( arg_ptr, tpos );
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+ switch( msg ) {
+
+ /* logging messages */
+ case MSG_LOG_BLOCK:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_VCB:
+ break;
+
+ case BT_DDB:
+ UI_BuildDelimitedPathFromDDB( &path_buf, fsh, dblk_ptr, delimiter, FALSE );
+
+ yprintf( TEXT("%s"), path_buf );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORY_NAMES );
+
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, path_buf );
+ break;
+
+ case BT_FDB:
+ if( CDS_GetFilesFlag( cds_ptr ) ) {
+ UI_AllocPathBuffer( &path_buf, FS_SizeofFnameInFDB( fsh, dblk_ptr ) );
+ if ( path_buf != NULL ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, path_buf );
+ }
+ UI_DisplayFile( path_buf );
+ JobStatusBackupRestore( JOB_STATUS_FILE_NAMES );
+
+ }
+ lresprintf( LOGGING_FILE, LOG_FILE, fsh, dblk_ptr );
+ break;
+ }
+ }
+ break;
+
+ /* statistics messages */
+ case MSG_BLOCK_PROCESSED:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ OBJECT_TYPE object_type;
+ INT item_size;
+ INT i;
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+
+ // Count all the new directories that showed up in
+ // this DDB.
+
+ // Only count the root once.
+
+ if ( ! root_counted ) {
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ root_counted = TRUE;
+ }
+
+ // Get the new path from the DDB.
+
+ item_size = FS_SizeofOSPathInDDB( fsh, dblk_ptr );
+ if ( UI_AllocPathBuffer( &path_buf, (UINT16) item_size ) != NULL ) {
+ FS_GetOSPathFromDDB( fsh, dblk_ptr, path_buf );
+ }
+
+ if ( item_size != 1 ) {
+
+ i = 0;
+ while ( i < item_size ) {
+
+ if ( i >= path_length ) {
+
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ }
+ else {
+
+ if ( (path == NULL) ||
+ stricmp( &path_buf[ i ], &path[ i ] ) ) {
+
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ path_length = 0;
+ }
+ }
+ while ( path_buf[ i++ ] );
+ }
+ }
+
+ // Set up for next time.
+ UI_AllocPathBuffer( &path, (UINT16) item_size );
+
+ if ( path != NULL ) {
+ memcpy( path, path_buf, item_size );
+ }
+ path_length = item_size;
+
+ yprintf(TEXT("%ld\r"),ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORIES_PROCESS );
+ break;
+
+ case BT_FDB:
+ ST_AddBSFilesProcessed( &op_stats, 1 );
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_FILES_PROCESSED );
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+ if( object_type == AFP_OBJECT ) {
+ ST_AddBSAFPFilesProcessed( &op_stats, 1 );
+ }
+ break;
+ }
+ }
+ break;
+
+ case MSG_BYTES_PROCESSED:
+ {
+ INT32 count_lsw = va_arg( arg_ptr, INT32 );
+ INT32 count_msw = va_arg( arg_ptr, INT32 );
+
+ ST_AddBSBytesProcessed( &op_stats, U64_Init( count_lsw, count_msw ) );
+ num_bytes = ST_GetBSBytesProcessed ( &op_stats );
+ U64_Litoa( num_bytes, numeral, (UINT16)10 , &stat );
+ UI_BuildNumeralWithCommas( numeral );
+ yprintf(TEXT("%s\r"),numeral );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+
+ }
+ break;
+
+ case MSG_TBE_ERROR:
+ {
+ INT16 error = va_arg( arg_ptr, INT16 );
+ GENERIC_DLE_PTR dle_ptr;
+
+ dle_ptr = BSD_GetDLE( bsd_ptr );
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ UI_ProcessErrorCode( error, &response, tpos->channel );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ }
+ break;
+
+ /* general messages */
+ case MSG_START_OPERATION:
+
+ lresprintf( LOGGING_FILE, LOG_START, FALSE );
+
+ /* display operation title in log file */
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_DLGTITLEJOBSTATDELETE );
+
+ break;
+
+ case MSG_END_OPERATION:
+
+ UI_FreePathBuffer( &path_buf );
+ UI_FreePathBuffer( &path );
+
+ lresprintf( LOGGING_FILE, LOG_END );
+ UI_ChkDispGlobalError( );
+ break;
+
+ case MSG_START_BACKUP_SET:
+ {
+ DBLK_PTR vcb_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ path_length = 0;
+ // path[0] = 0; // path was never init'd, doesn't seem to be used.
+ root_counted = FALSE;
+
+ /* display local or net drive bitmap */
+ if ( DLE_HasFeatures( BSD_GetDLE( bsd_ptr ), DLE_FEAT_REMOTE_DRIVE ) ) {
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_NETDRIVE );
+ }
+ else {
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_HARDDRIVE );
+ }
+
+ /* volume name of disk drive */
+ if ( UI_AllocPathBuffer( &path_buf, UI_MAX_PATH_LENGTH ) != NULL ) {
+ DLE_GetVolName( BSD_GetDLE( bsd_ptr ), path_buf );
+ yprintf(TEXT("%s\r"),path_buf );
+ JobStatusBackupRestore( JOB_STATUS_SOURCE_NAME );
+
+ /* clear the destination name */
+ yprintf(TEXT(" \r"));
+ JobStatusBackupRestore( JOB_STATUS_DEST_NAME );
+
+ BSD_SetOperStatus( bsd_ptr, SUCCESS );
+
+ yresprintf( (INT16) RES_DISPLAY_VOLUME,
+ path_buf,
+ BSD_GetSetNum( bsd_ptr ),
+ BSD_GetTapeNum( bsd_ptr ),
+ BSD_GetBackupLabel( bsd_ptr ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_VOLUME,
+ path_buf,
+ BSD_GetSetNum( bsd_ptr ),
+ BSD_GetTapeNum( bsd_ptr ),
+ BSD_GetBackupLabel( bsd_ptr ) );
+
+ }
+
+ ST_StartBackupSet( &op_stats );
+
+ UI_Time( &op_stats, RES_DELETE_STARTED, UI_START );
+
+ /* enable the real time clock */
+ clock_ready_flag = TRUE;
+
+ delimiter = DLE_GetPathDelim( BSD_GetDLE( bsd_ptr ) );
+ }
+ break;
+
+ case MSG_END_BACKUP_SET:
+ {
+ INT16 res_id;
+
+ /* turn off the real time clock */
+ clock_ready_flag = FALSE;
+
+ /* record the time that we finished */
+ ST_EndBackupSet( &op_stats );
+
+
+ /* clear last displayed filename from status display */
+ UI_ClearLastDisplayedFile( );
+
+ /* display and log any abort conditions */
+ UI_ConditionAtEnd( );
+
+ /* disable the real time clock */
+ clock_ready_flag = FALSE;
+
+ UI_Time( &op_stats, RES_DELETE_COMPLETED, UI_END );
+
+ /* display number of files / number of dirs */
+ if( ST_GetBSFilesProcessed( &op_stats ) <= 1 && ST_GetBSDirsProcessed( &op_stats ) <= 1 ) { // chs:05-26-93
+ res_id = RES_DELETE_DIR_FILE; // chs:05-26-93
+ } else if( ST_GetBSFilesProcessed( &op_stats ) <= 1 && ST_GetBSDirsProcessed( &op_stats ) > 1 ) { // chs:05-26-93
+ res_id = RES_DELETE_DIRS_FILE; // chs:05-26-93
+ } else if( ST_GetBSFilesProcessed( &op_stats ) > 1 && ST_GetBSDirsProcessed( &op_stats ) <= 1 ) { // chs:05-26-93
+ res_id = RES_DELETE_DIR_FILES; // chs:05-26-93
+ } else { // chs:05-26-93
+ res_id = RES_DELETE_DIRS_FILES; // chs:05-26-93
+ } // chs:05-26-93
+
+// chs:05-26-93 if( ST_GetBSFilesProcessed( &op_stats ) == 1 ) {
+// chs:05-26-93 res_id = RES_DELETE_DIR_FILE;
+// chs:05-26-93 } else if ( ST_GetBSDirsProcessed( &op_stats ) == 1 ) {
+// chs:05-26-93 res_id = RES_DELETE_DIR_FILES;
+// chs:05-26-93 } else {
+// chs:05-26-93 res_id = RES_DELETE_DIRS_FILES;
+// chs:05-26-93 }
+
+ yresprintf( res_id,
+ ST_GetBSFilesProcessed( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSFilesProcessed( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+
+ /* display number of mac files deleted */
+ if( ST_GetBSAFPFilesProcessed( &op_stats ) > 0 ) {
+
+ if( ST_GetBSAFPFilesProcessed( &op_stats ) == 1 ) {
+ res_id = RES_DELETE_MAC;
+ }
+ else {
+ res_id = RES_DELETE_MACS;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+ }
+
+ delimiter = TEXT('#'); /* = # for debug */
+ }
+ break;
+
+ case MSG_NOT_DELETED:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_VCB:
+ break;
+
+ case BT_DDB:
+ UI_BuildDelimitedPathFromDDB( &path_buf, fsh, dblk_ptr, delimiter, FALSE );
+ yprintf( TEXT("%s"), path_buf );
+ yresprintf( (INT16) RES_DIRECTORY_NOT_DELETED, path_buf );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_DIRECTORY_NOT_DELETED, path_buf );
+ gb_error_during_operation = TRUE;
+ break;
+
+ case BT_FDB:
+ if( CDS_GetFilesFlag( cds_ptr ) ) {
+ UI_AllocPathBuffer( &path_buf, FS_SizeofFnameInFDB( fsh, dblk_ptr ) );
+ if ( path_buf != NULL ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, path_buf );
+ yresprintf( (INT16) RES_FILE_NOT_DELETED, path_buf );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_FILE_NOT_DELETED, path_buf );
+ gb_error_during_operation = TRUE;
+ }
+
+ }
+ break;
+ }
+ }
+ break;
+
+
+ /* ignore these messages */
+ case MSG_COMM_FAILURE:
+ case MSG_IDLE:
+ case MSG_PROMPT:
+ case MSG_EOM:
+ case MSG_BLOCK_DELETED:
+ case MSG_BYTES_DELETED:
+ case MSG_TAPE_STATS:
+ case MSG_STOP_CLOCK:
+ case MSG_START_CLOCK:
+ case MSG_BLK_NOT_FOUND:
+ case MSG_BLK_DIFFERENT:
+ case MSG_LOG_DIFFERENCE:
+ case MSG_BLOCK_BAD:
+ case MSG_BYTES_BAD:
+ case MSG_IN_USE:
+ case MSG_IN_USE_WAIT:
+ case MSG_BLOCK_SKIPPED:
+ case MSG_BYTES_SKIPPED:
+ break;
+
+ default:
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ eresprintf( RES_UNKNOWN_MSG_HNDLR_MSG, msg );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ break;
+ }
+
+ return( response );
+
+}
diff --git a/private/utils/ntbackup/src/do_excl.c b/private/utils/ntbackup/src/do_excl.c
new file mode 100644
index 000000000..3a5315cb8
--- /dev/null
+++ b/private/utils/ntbackup/src/do_excl.c
@@ -0,0 +1,829 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_excl.c
+
+ Description: This function contains the code which creates
+ the excludes for the inteneral files ;
+
+ $Log: G:\ui\logfiles\do_excl.c_v $
+
+ Rev 1.44.1.3 28 Mar 1994 14:23:18 STEVEN
+exclude eadata.sf
+
+ Rev 1.44.1.2 16 Mar 1994 18:07:14 STEVEN
+we were not excluding evt files for restore
+
+ Rev 1.44.1.1 24 Feb 1994 22:04:34 STEVEN
+exclude the catalog files
+
+ Rev 1.44.1.0 25 Oct 1993 15:46:12 GREGG
+Added new excludes for temporary OTC files.
+
+ Rev 1.44 21 Jul 1993 17:10:36 CARLS
+change to tbrparse call
+
+ Rev 1.43 30 Jun 1993 15:30:52 CARLS
+changed the name of the restore & backup exclude files
+
+ Rev 1.42 14 Jun 1993 20:26:18 MIKEP
+enable c++
+
+ Rev 1.41 28 May 1993 15:16:30 CARLS
+added backup.nks support
+
+ Rev 1.40 14 May 1993 14:30:02 MIKEP
+Fix compiler warning.
+
+ Rev 1.39 10 May 1993 08:35:32 MIKEP
+Fix exclude of logfiles for non-command line specified log files.
+
+ Rev 1.38 29 Apr 1993 18:12:08 MIKEP
+improve catalog exclude code
+
+ Rev 1.37 02 Apr 1993 15:41:04 TIMN
+Added code to exclude event files (*.EVT) from VERIFY operations only
+Added code to exclude log files only if logging is enabled
+
+ Rev 1.36 31 Mar 1993 18:15:58 TIMN
+Fixed bug, only exclude log file if log's BSD is selected
+
+ Rev 1.35 29 Mar 1993 11:27:12 TIMN
+Exclude user specified backup/restore log from operation EPR(0335)
+
+ Rev 1.34 18 Mar 1993 11:52:36 TIMN
+Excluded restore.log from backup/restore EPR(0327)
+
+
+*****************************************************************************/
+
+#include "all.h"
+
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static VOID CreateExclude( CHAR_PTR path, CHAR_PTR file,
+ GENERIC_DLE_PTR drive, BOOLEAN wild_flag,
+ FSE_PTR *fse ) ;
+
+static VOID unimpregnatePath( CHAR_PTR pPath, INT16 nPathSize, CHAR cDelimiter ) ;
+
+/*****************************************************************************
+
+ Name: UI_ExcludeInternalFiles( )
+
+ Description: This function goes though the BSD list and adds
+ Exclude FSEs for internal Maynstream files.
+
+ Returns: NONE
+
+ Notes: The excluded files are :
+
+*****************************************************************************/
+
+static TCHAR szPlaceHolder1[] = TEXT("Placehol.der");
+static TCHAR szPlaceHolder2[] = TEXT("Placehol.der");
+
+INT16 UI_ExcludeInternalFiles( INT16 oper )
+{
+ BSD_HAND temp_bsd_list ;
+ INT16 ret_val = SUCCESS ;
+ CHAR_PTR data_path = NULL;
+ CHAR_PTR fname ; // fname from FS_ParsePath call
+ CHAR path[ UI_MAX_PATH_LENGTH ] ;
+ INT16 psize ;
+ BOOLEAN dummy = FALSE;
+ GENERIC_DLE_PTR dle = NULL;
+ BSD_PTR bsd = NULL;
+ FSE_PTR fse = NULL;
+ VLM_FIND_PTR pVlmFind = NULL;
+ CHAR szFile [VLM_MAXFNAME];
+ INT i ;
+ CHAR_PTR *exclude_list ;
+ BOOLEAN warning_printed = FALSE ;
+ CDS_PTR cfg = CDS_GetPerm();
+
+#ifdef OS_WIN32
+ INT bytes;
+ CHAR nt_drive[ 4 ];
+ CHAR nt_windows[ 256 ];
+#endif
+
+ static CHAR_PTR back_exclude_list[ ] = {
+ TEXT("SKIPPED.BKS"),
+ TEXT("VERIFY.BKS"),
+ TEXT("") } ;
+
+ static CHAR_PTR arch_exclude_list[ ] = {
+ TEXT("SKIPPED.BKS"),
+ TEXT("VERIFY.BKS"),
+ TEXT("") } ;
+
+ static CHAR_PTR ver_exclude_list[ ] = {
+ szPlaceHolder1, //will be replaced with job file
+ TEXT("") } ;
+
+ static CHAR_PTR ver_last_exclude_list[ ] = {
+ szPlaceHolder2, //will be replaced with schedule file
+ TEXT("") } ;
+
+ static CHAR_PTR empty_exclude_list[ ] = {
+ TEXT("") } ;
+
+
+#ifdef OS_WIN32
+
+ strcpy( nt_windows, TEXT( "" ) );
+ strcpy( nt_drive, TEXT( "" ) );
+
+ bytes = GetWindowsDirectory( (LPSTR)nt_windows, (DWORD)255 );
+
+ if ( bytes ) {
+
+ strcat( nt_windows, TEXT( "\\" ) );
+ }
+
+ if ( bytes && ! strlen( nt_drive ) ) {
+
+ nt_drive[ 0 ] = nt_windows[ 0 ]; // TEXT('C')
+ nt_drive[ 1 ] = nt_windows[ 1 ]; // TEXT(':')
+ nt_drive[ 2 ] = TEXT( '\0' );
+ }
+
+#endif
+
+ /* set up bsd list based on operation */
+
+ if ( ( oper == RESTORE_OPER ) ||
+ ( oper == VERIFY_OPER ) ) {
+ temp_bsd_list = tape_bsd_list ;
+ }
+ else {
+ temp_bsd_list = bsd_list ;
+ }
+
+ /* parse the NOVELL.NKS exclude script file AND add an exclude
+ for the Windows swap files to ALL BSDs */
+
+ if( ( oper == BACKUP_OPER ) || ( oper == ARCHIVE_BACKUP_OPER ) ) {
+
+ bsd = BSD_GetFirst( temp_bsd_list ) ;
+
+ while( bsd != NULL ) {
+
+ dle = BSD_GetDLE( bsd ) ;
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if( !warning_printed ) {
+
+ if( ( DLE_GetDeviceType( dle ) == NOVELL_DRV ) ||
+ ( DLE_GetDeviceType( dle ) == NOVELL_AFP_DRV ) ) {
+
+ strcpy( path, CDS_GetUserDataPath( ) ) ;
+ strcat( path, TEXT("NOVELL.NKS") ) ;
+
+ if ( pVlmFind = VLM_FindFirst ( path,
+ VLMFIND_NORMAL, szFile ) )
+ {
+ VLM_FindClose ( &pVlmFind );
+
+ strcpy( path, TEXT("@") ) ;
+ strcat( path, CDS_GetUserDataPath( ) ) ;
+ strcat( path, TEXT("NOVELL.NKS") ) ;
+ dle = DLE_GetDefaultDrive( dle_list ) ;
+ DLE_SetDefaultDrive( dle_list, BSD_GetDLE( bsd ) ) ;
+ tbrparse( &cfg, dle_list, temp_bsd_list, path, TBACKUP, bsd ) ;
+ DLE_SetDefaultDrive( dle_list, dle ) ;
+
+ } else {
+
+ WM_MessageBox( ID( IDS_MSGTITLE_WARNING ),
+ ID( RES_MISSING_NKS ),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_MISSING_NKS ) ;
+ warning_printed = TRUE ;
+
+ }
+ }
+ }
+ }
+# else
+ {
+ // NT special excludes
+
+# if defined ( OS_WIN32 )
+ {
+ CreateExclude( TEXT(""), TEXT("$AttrDef"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$BadClus"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$Bitmap"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$Boot"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$LogFile"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$MFT"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$MFTMirr"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$Quota"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$UpCase"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("$Volume"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+ }
+# endif // OS_WIN32
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ /* parse the user BACKUP.XFS exclude script file */
+
+ strcpy( path, CDS_GetUserDataPath( ) ) ;
+ strcat( path, TEXT("BACKUP.XFS") ) ;
+
+ if ( pVlmFind = VLM_FindFirst ( path,
+ VLMFIND_NORMAL, szFile ) )
+ {
+ VLM_FindClose ( &pVlmFind );
+
+ strcpy( path, TEXT("@") ) ;
+ strcat( path, CDS_GetUserDataPath( ) ) ;
+ strcat( path, TEXT("BACKUP.XFS") ) ;
+ dle = DLE_GetDefaultDrive( dle_list ) ;
+ DLE_SetDefaultDrive( dle_list, BSD_GetDLE( bsd ) ) ;
+ tbrparse( &cfg, dle_list, temp_bsd_list, path, TBACKUP, bsd ) ;
+ DLE_SetDefaultDrive( dle_list, dle ) ;
+
+ }
+
+ /* exclude the Windows swap file names */
+
+ CreateExclude( TEXT(""), TEXT("WIN386.SWP"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("PAGEFILE.SYS"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("ea data. sf"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( TEXT(""), TEXT("386SPART.PAR"), dle, FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ bsd = BSD_GetNext( bsd ) ;
+ }
+ }
+
+ /* parse the RESTORE.XFS script file */
+
+ if( oper == RESTORE_OPER ) {
+
+ bsd = BSD_GetFirst( temp_bsd_list ) ;
+
+ while( bsd != NULL ) {
+
+ dle = BSD_GetDLE( bsd ) ;
+
+ strcpy( path, CDS_GetUserDataPath( ) ) ;
+ strcat( path, TEXT("RESTORE.XFS") ) ;
+
+ if ( pVlmFind = VLM_FindFirst( path, VLMFIND_NORMAL, szFile ) ) {
+
+ VLM_FindClose ( &pVlmFind );
+
+ strcpy( path, TEXT("@") ) ;
+ strcat( path, CDS_GetUserDataPath( ) ) ;
+ strcat( path, TEXT("RESTORE.XFS") ) ;
+ dle = DLE_GetDefaultDrive( dle_list ) ;
+ DLE_SetDefaultDrive( dle_list, BSD_GetDLE( bsd ) ) ;
+ tbrparse( &cfg, dle_list, temp_bsd_list, path, TRESTORE, bsd ) ;
+ DLE_SetDefaultDrive( dle_list, dle ) ;
+ bsd = BSD_GetNext( bsd ) ;
+
+ } else {
+
+ bsd = NULL;
+ }
+ }
+ }
+
+#if defined( OS_WIN32 )
+ {
+ /* Exclude EVENT (*.EVT) files from verify operation */
+
+ if ( ( oper == VERIFY_OPER ) ||
+ ( oper == VERIFY_LAST_BACKUP_OPER ) ||
+ ( oper == VERIFY_LAST_RESTORE_OPER ) ) {
+
+ CHAR szPath[ MAX_PATH ] ;
+ UINT16 index ; // used, not important except setting it to 0
+ CHAR_PTR pPath ; // address of special files path
+ INT16 nPathSize ; // size of NULL impregnated path
+ CHAR_PTR pFname ; // !used
+
+ bsd = BSD_GetFirst( temp_bsd_list ) ;
+
+ while ( bsd != NULL ) {
+ dle = BSD_GetDLE( bsd ) ;
+ index = 0 ;
+
+ if ( FS_EnumSpecialFiles( dle, &index, &pPath, &nPathSize, &pFname ) == SUCCESS ) {
+ INT16 deviceLeng = DLE_GetDeviceNameLeng( dle ) ;
+
+ // get the device name, unimpregnate the path and append to device name
+
+ strncpy( szPath, DLE_GetDeviceName( dle ), deviceLeng ) ;
+ memmove( &szPath[ deviceLeng/sizeof(CHAR) ], pPath, nPathSize ) ;
+ unimpregnatePath( szPath, (INT16)(nPathSize + deviceLeng), TEXT('\\') ) ;
+
+ CreateExclude( szPath, TEXT("*.EVT"), dle, USE_WILD_CARD, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+ }
+
+ bsd = BSD_GetNext( bsd ) ;
+ }
+ }
+ }
+#endif // OS_WIN32
+
+ /* setup the default exclude list */
+
+ switch ( oper ) {
+
+ case BACKUP_OPER :
+ case RESTORE_OPER :
+
+ exclude_list = back_exclude_list ;
+ break ;
+
+ case ARCHIVE_BACKUP_OPER :
+
+ exclude_list = arch_exclude_list ;
+ break ;
+
+ case VERIFY_OPER :
+
+ // copy in the job filename
+
+ exclude_list = ver_exclude_list ;
+ RSM_StringCopy ( IDS_JOBFILENAME, exclude_list[0], 13 );
+ break;
+
+ case VERIFY_LAST_BACKUP_OPER :
+ case ARCHIVE_VERIFY_OPER :
+
+ exclude_list = ver_last_exclude_list ;
+
+ // copy in the schedule filename
+
+ RSM_StringCopy ( IDS_SCHFILENAME, exclude_list[0], 13 );
+
+ data_path = CDS_GetCatDataPath( ) ;
+ psize = UI_MAX_PATH_LENGTH ;
+
+ if( FS_ParsePath( dle_list, data_path, &dle, path, &psize, NULL,
+ &dummy ) == SUCCESS ) {
+
+ bsd = BSD_FindByDLE( temp_bsd_list, dle );
+
+ if( bsd != NULL ) {
+
+ /* call QTC util which will return the full data path */
+ /* and filename of the catalog file being updated. */
+ /* Set the name to familyid.??? so only one exclude is */
+ /* needed (also takes care of possible 8200SX ffr files) */
+
+ QTC_GetFileName( BSD_GetTapeID( bsd ), (INT16)1, path );
+ i = strlen( path );
+ path[--i] = TEXT('?');
+ path[--i] = TEXT('?');
+ path[--i] = TEXT('?');
+
+ /* Add an exclude fse to ALL bsd's with the path dle. */
+ /* We can have more than one bsd for the dle since */
+ /* the catalogs can be included as a bset. */
+
+ while ( bsd != NULL ) {
+
+ if ( BSD_GetDLE( bsd ) == dle ) {
+
+ CreateExclude( data_path,
+ &path[ strlen( data_path ) ],
+ dle,
+ USE_WILD_CARD, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+ }
+
+ bsd = BSD_GetNext( bsd );
+ }
+ }
+ }
+ break ;
+
+ default:
+
+ exclude_list = empty_exclude_list ;
+ break ;
+
+ } // end SWITCH
+
+
+ /* exlcude the application and all DLL's in the EXE path */
+
+ psize = UI_MAX_PATH_LENGTH ;
+
+ if ( FS_ParsePath( dle_list, CDS_GetExePath (), &dle, path, &psize, NULL, &dummy ) == SUCCESS ) {
+
+ bsd = BSD_FindByDLE( temp_bsd_list, dle );
+
+ if( bsd != NULL ) {
+
+ CreateExclude( CDS_GetExePath (), gb_exe_fname, BSD_GetDLE( bsd ), FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+#ifndef OS_WIN32
+ CreateExclude( CDS_GetExePath (), TEXT("*.DLL"), BSD_GetDLE( bsd ), USE_WILD_CARD, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+#endif
+ }
+ }
+
+ /* exlcude the temporary catalog files in the catalog path */
+
+ psize = UI_MAX_PATH_LENGTH ;
+
+ if( FS_ParsePath( dle_list, CDS_GetCatDataPath(), &dle, path, &psize,
+ NULL, &dummy ) == SUCCESS ) {
+
+ bsd = BSD_FindByDLE( temp_bsd_list, dle );
+
+ if( bsd != NULL ) {
+
+ CreateExclude( CDS_GetCatDataPath(), TEXT("FD??????.FDD"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( CDS_GetCatDataPath(), TEXT("EM??????.FDD"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( CDS_GetCatDataPath(), TEXT("SM??????.SM"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( CDS_GetCatDataPath(), TEXT("QTC_TEMP.???"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( CDS_GetCatDataPath(), TEXT("_PLUS_._"), BSD_GetDLE( bsd ),
+ FALSE, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+#ifdef UNICODE
+ CreateExclude( CDS_GetCatDataPath(), TEXT("????????.U0?"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( CDS_GetCatDataPath(), TEXT("????????.U1?"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+#else
+ CreateExclude( CDS_GetCatDataPath(), TEXT("????????.D0?"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ CreateExclude( CDS_GetCatDataPath(), TEXT("????????.D1?"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+#endif
+
+ }
+ }
+
+ /**
+ exclude the backup/restore log file
+
+ do not backup/restore the current log. Since the user can rename
+ the backup/restore log, we get the current log name and exclude it
+ UNC paths are supported as log names, but not excluded--yet.
+ **/
+
+ psize = UI_MAX_PATH_LENGTH ;
+
+ if ( FS_ParsePath( dle_list, LOG_GetCurrentLogName(), &dle,
+ path, &psize, &fname, &dummy ) == SUCCESS ) {
+
+ bsd = BSD_FindByDLE( temp_bsd_list, dle ) ;
+
+ if ( bsd != NULL ) {
+
+ LOG_GetCurrentLogPathOnly( path ) ;
+
+ // This one is needed for command line options, where
+ // the user can use any name they want.
+
+ CreateExclude( path, LOG_GetCurrentLogNameOnly(), dle,
+ FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse );
+ }
+ }
+ }
+
+ /* now exclude the files in the data path */
+
+ data_path = CDS_GetUserDataPath( ) ;
+ psize = UI_MAX_PATH_LENGTH ;
+
+ if( FS_ParsePath( dle_list, data_path, &dle, path, &psize, NULL,
+ &dummy ) == SUCCESS ) {
+
+ bsd = BSD_FindByDLE( temp_bsd_list, dle );
+
+ if( bsd != NULL ) {
+
+ CreateExclude( data_path, TEXT( "*.LOG" ),
+ BSD_GetDLE( bsd ), USE_WILD_CARD, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ /* exclude all the files in the exclude array */
+
+ i = 0 ;
+ while ( *exclude_list[ i ] != TEXT('\0') ) {
+
+ CreateExclude( data_path, exclude_list[ i ],
+ BSD_GetDLE( bsd ), FALSE, &fse ) ;
+
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ i ++ ;
+ }
+
+
+# if defined( TDEMO )
+ {
+ /* exlcude the TDEMO data files in the data path */
+
+ CreateExclude( data_path, TEXT("TDEMO?.DAT"), BSD_GetDLE( bsd ),
+ USE_WILD_CARD, &fse ) ;
+ if ( fse != NULL ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+ }
+# endif
+ }
+ }
+
+
+ return( ret_val ) ;
+}
+/*****************************************************************************
+
+ Name: CreateExclude
+
+ Description: This function creates an Exclude FSE for the specified path and file.
+
+ the format of the path must be
+ W:\eng\test\
+
+ if the fse pointer returned is NULL then no fse should be created.
+
+ Returns: none
+
+*****************************************************************************/
+VOID CreateExclude(
+CHAR_PTR path , /* I - path from root of device */
+CHAR_PTR file , /* I - file name to exclude */
+GENERIC_DLE_PTR drive , /* I - device to exclude from */
+BOOLEAN wild_flag , /* I - if file contains wild cards */
+FSE_PTR *fse ) /* O - fse created */
+{
+ GENERIC_DLE_PTR temp_dle ;
+ CHAR base_path[ MAX_UI_PATH_SIZE ] ;
+ CHAR vol_name[ UI_MAX_VOLUME_LENGTH ] ;
+ CHAR_PTR p ;
+ CHAR drive_name[ 3 ] ;
+ INT size ;
+ BOOLEAN sub_flag = FALSE ;
+
+ *fse = NULL ;
+
+ if ( path[ 0 ] != TEXT('\0') ) {
+
+ drive_name[ 0 ] = path[ 0 ] ;
+ drive_name[ 1 ] = path[ 1 ] ;
+ drive_name[ 2 ] = TEXT('\0') ;
+
+ if ( DLE_FindByName( dle_list, drive_name, ANY_DRIVE_TYPE, &temp_dle ) == SUCCESS ) {
+
+ if ( ( DLE_GetDeviceType( drive ) == NOVELL_DRV ) ||
+ ( DLE_GetDeviceType( drive ) == NOVELL_AFP_DRV ) ) {
+
+ DLE_GetVolName( drive, vol_name ) ;
+ DLE_GetVolName( temp_dle, base_path ) ;
+
+ p = strchr( vol_name, TEXT(':') ) ;
+ msassert( p != NULL ) ;
+ size = p - vol_name ;
+
+ if( !strncmp( vol_name, base_path, size ) ) {
+ /* same server/volume */
+
+ strcat( p++, TEXT("\\") ) ;
+
+ size = strlen( p ) ;
+ if( !strncmp( path + 3, p, size ) ) {
+ /* same base path */
+
+ strcpy( base_path, &path[ 3 + size ] ) ;
+ p = base_path ;
+ if ( p[ 0 ] == TEXT('\0') ) {
+ size = 1;
+ } else {
+ size = 0 ;
+ while( p[ size ] != TEXT('\0') ) {
+
+ if( p[ size ] == TEXT('\\') ) {
+ p[ size ] = TEXT('\0') ;
+ }
+
+ size++ ;
+ }
+ }
+
+ if( BSD_CreatFSE( fse, EXCLUDE, (INT8_PTR)p,
+ (INT16)(size * sizeof(CHAR)),
+ (INT8_PTR)file,
+ (INT16)strsize(file),
+ wild_flag, FALSE ) != SUCCESS ) {
+
+ *fse = NULL ;
+ }
+ }
+ }
+
+ } else {
+
+ if ( ! ( DLE_HasFeatures( drive, DLE_FEAT_REMOTE_DRIVE ) ) && /* substuted dirs */
+ ! ( DLE_HasFeatures( temp_dle, DLE_FEAT_REMOTE_DRIVE ) ) ) {
+
+ if ( drive == temp_dle ) {
+
+ strcpy( base_path, path+3 ) ;
+
+ p = base_path ;
+ if ( p[ 0 ] == TEXT('\0') ) {
+ size = 1;
+ } else {
+ size = 0 ;
+ while( p[ size ] != TEXT('\0') ) {
+
+ if( p[ size ] == TEXT('\\') ) {
+ p[ size ] = TEXT('\0') ;
+ }
+
+ size++ ;
+ }
+ }
+ } else {
+ size = 1 ;
+ p = TEXT("") ;
+ sub_flag = TRUE ;
+ }
+
+ if ( BSD_CreatFSE( fse, EXCLUDE, (INT8_PTR)p,
+ (INT16)(size * sizeof (CHAR)),
+ (INT8_PTR)file,
+ (INT16)strsize(file),
+ wild_flag, (BOOLEAN)sub_flag ) != SUCCESS ) {
+ *fse = NULL ;
+ }
+ }
+ }
+ }
+
+ } else {
+ if ( BSD_CreatFSE( fse, EXCLUDE, (INT8_PTR)TEXT(""), sizeof(CHAR),
+ (INT8_PTR)file,
+ (INT16)strsize( file ),
+ wild_flag, TRUE ) != SUCCESS ) {
+ *fse = NULL ;
+ }
+ }
+}
+
+
+/*****************************************************************************
+ Name: unimpregnatePath
+ Desc: Accepts a NULL impregnated path and the path's size and replaces
+ all impregnated NULLs with the delimiter character and NULL
+ terminates the path before ending.
+ Date: 04/01/93
+*****************************************************************************/
+
+VOID unimpregnatePath(
+CHAR_PTR pPath, /* I/O path to unimpregnate */
+INT16 nPathSize, /* I size of path */
+CHAR cDelimiter ) /* I path delimiter char */
+{
+ nPathSize /= 2 ;
+ for ( ; nPathSize; pPath++, nPathSize-- ) {
+ if ( *pPath == TEXT('\0') ) {
+ *pPath = cDelimiter ;
+ }
+ }
+
+ *pPath = TEXT('\0') ;
+}
diff --git a/private/utils/ntbackup/src/do_ffr.c b/private/utils/ntbackup/src/do_ffr.c
new file mode 100644
index 000000000..123682c0a
--- /dev/null
+++ b/private/utils/ntbackup/src/do_ffr.c
@@ -0,0 +1,602 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_ffr.c
+
+ Description: Function called from do_rest and do_very to pre-qualify
+ catalog backup sets and call loop to generated LBA
+ queue for each BSD.
+
+ $Log: G:/UI/LOGFILES/DO_FFR.C_V $
+
+ Rev 1.29 20 Jul 1994 19:33:36 STEVEN
+fix bad lba problem
+
+ Rev 1.28 17 Jan 1994 16:10:20 MIKEP
+fix unicode warnings
+
+ Rev 1.27 19 Jul 1993 10:10:42 BARRY
+Don't reference dle in BSD directly -- use BSD_GetDLE instead.
+
+ Rev 1.26 14 Jun 1993 20:27:02 MIKEP
+enable c++
+
+ Rev 1.25 29 Apr 1993 11:24:24 MIKEP
+try again at last fix
+
+ Rev 1.24 29 Apr 1993 11:09:08 MIKEP
+add on tape catalog version
+
+ Rev 1.23 08 Apr 1993 14:26:22 MIKEP
+Fix to allow user to restore files from the root of a set that has the
+registry backed up, ie. the root is in the catalogs twice. Requires a
+change to gtnxttpe.c to eliminate an assert.
+
+ Rev 1.22 26 Feb 1993 09:57:00 STEVEN
+we ignored the registry button
+
+ Rev 1.21 25 Feb 1993 13:25:04 STEVEN
+fixes from mikep and MSOFT
+
+ Rev 1.20 09 Feb 1993 17:18:38 STEVEN
+checkin for mikep
+
+ Rev 1.19 04 Feb 1993 16:12:22 STEVEN
+allow wildcards for exclude list
+
+ Rev 1.18 01 Nov 1992 15:49:16 DAVEV
+Unicode changes
+
+ Rev 1.17 07 Oct 1992 14:49:14 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.16 04 Oct 1992 19:34:10 DAVEV
+Unicode Awk pass
+
+ Rev 1.15 30 Sep 1992 10:43:46 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.14 17 Aug 1992 13:16:04 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.13 27 Jul 1992 14:49:56 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.12 27 Jul 1992 11:09:32 JOHNWT
+ChuckB checked in for John Wright, who is no longer with us.
+
+ Rev 1.11 08 Jul 1992 15:36:04 STEVEN
+Unicode BE changes
+
+ Rev 1.10 14 May 1992 17:39:20 MIKEP
+nt pass 2
+
+ Rev 1.9 11 May 1992 19:45:06 STEVEN
+64bit and large path sizes
+
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+typedef struct {
+
+ CHAR_PTR path; /* path for catalog query */
+ INT16 path_size; /* size of directory path */
+ CHAR itemname[256]; /* itemname for query */
+ INT16 item_size; /* size of itemname for search*/
+
+ FSE_PTR fse_ptr;
+ BSD_PTR bsd_ptr; /* bsd_ptr for this item */
+
+} LBA_QUERY, *LBA_QUERY_PTR;
+
+static INT16 GetLBAList( LIS_PTR );
+static INT16 GetLBAs( QTC_QUERY_PTR, BSD_PTR, FSE_PTR, UINT16 );
+static INT16 GetLBAForItem( QTC_QUERY_PTR, LBA_QUERY_PTR, UINT32_PTR, UINT16_PTR, INT16 );
+static BOOLEAN NewLBADirToProcess( LBA_QUERY_PTR );
+static INT16 TryToFindMoreMatchesInSameBSD( QTC_QUERY_PTR, LBA_QUERY_PTR, INT16 );
+
+INT16 mw_tape_num;
+
+/*****************************************************************************
+
+ Name: TryToCreateFFRQueue
+
+ Description: Set up the catalog and call routine to create an
+ LBA queue for a restore or a verify operation.
+
+ Returns: SUCCESS
+ FAILURE indicating that an empty bsd_list or catalog
+ error has resulted
+
+*****************************************************************************/
+INT16 TryToCreateFFRQueue(
+LIS_PTR lis,
+INT16 oper_type )
+{
+ INT16 ret_val = SUCCESS;
+
+ /* If the user does not want to use FFR or the tape drive does not
+ support FFR or we are about to perform a verify after or verify
+ last operation, simply return */
+
+ /* We generate the lba queue even if the drive doesn't support it
+ because the Teac 600 tells us it doesn't, then during the mount
+ it changes its mind. */
+
+ /* And because our catalogs are so fast no one notices anyway. */
+
+ if ( ! CDS_GetFastFileRestore( CDS_GetCopy() ) ||
+ ( oper_type == ARCHIVE_VERIFY_OPER ) ||
+ ( oper_type == VERIFY_LAST_BACKUP_OPER ) ||
+ ( oper_type == VERIFY_LAST_RESTORE_OPER ) ) {
+
+ // We were successful at not generating an LBA queue
+
+ return( SUCCESS );
+ }
+
+ /* Continue with calling loop to generated LBA Queue for the BSD list */
+
+ WM_ShowWaitCursor( TRUE );
+
+ ret_val = GetLBAList( lis );
+
+ WM_ShowWaitCursor( FALSE );
+
+ return( ret_val );
+}
+
+/**************************************************************************/
+/* */
+/* NOTES: */
+/* */
+/* (2) Wildcard filenames in a directory and entire directories (*.* */
+/* file specifications) will be treated as the same case for the */
+/* initial release of FFR support. */
+/* */
+/* (3) Since all single file processing is performed by examining the */
+/* FSL for each BSD, all desired files must have associated FSEs */
+/* in order to generate the corresponding LBA entries. Bindery */
+/* files will be individually handled by adding specific FSEs */
+/* to the FSL via File System calls (performed by the user */
+/* interface prior to calling the loops). */
+/* */
+/**************************************************************************/
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT16 GetLBAList( LIS_PTR lis_ptr )
+{
+ BSD_PTR bsd_ptr = lis_ptr->curr_bsd_ptr;
+ FSE_PTR fse_ptr;
+ QTC_QUERY_PTR query;
+ INT32 pba;
+ GENERIC_DLE_PTR dle_ptr;
+ UINT16 index = 0;
+ CHAR_PTR path;
+ INT16 path_size;
+ CHAR_PTR fname;
+ UINT8 TapeCatVer;
+
+ query = QTC_InitQuery( );
+ if ( query == NULL ) return( SUCCESS );
+
+ bsd_ptr = lis_ptr->curr_bsd_ptr;
+
+ /* Loop across all BSD elements in list */
+
+ while ( bsd_ptr != NULL ) {
+
+ /* Generate FSEs for the bindery files by getting names from FS */
+
+ index = 0;
+
+ mw_tape_num = -1;
+
+ dle_ptr = BSD_GetDLE( bsd_ptr );
+ if ( BSD_GetProcSpecialFlg( bsd_ptr ) ) {
+
+ while ( ( FS_EnumSpecialFiles( dle_ptr, &index, &path, &path_size, &fname ) ) != FS_NO_MORE ) {
+
+ BSD_CreatFSE( &fse_ptr, (INT16) INCLUDE, (INT8_PTR)path, (INT16) path_size,
+ (INT8_PTR)fname,
+ (INT16) strsize(fname),
+ TRUE, FALSE );
+
+ if ( fse_ptr != NULL ) {
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+ }
+ }
+ }
+
+ QTC_SetTapeFID( query, BSD_GetTapeID( bsd_ptr ) );
+ QTC_SetTapeSeq( query, -1 );
+ QTC_SetBsetNum( query, BSD_GetSetNum( bsd_ptr ) );
+ QTC_SetSubdirs( query, FALSE );
+
+ /* Loop across all FSE attached to this BSD */
+
+ fse_ptr = BSD_GetFirstFSE( bsd_ptr );
+
+ while ( fse_ptr != NULL ) {
+
+ /* Process all INCLUDE FSEs */
+
+ if ( FSE_GetOperType( fse_ptr ) == INCLUDE ) {
+
+ /* Determine type of FSE and call appropriate function */
+
+ if ( FSE_GetSelectType( fse_ptr ) == SINGLE_FILE_SELECTION ) {
+
+ GetLBAs( query, bsd_ptr, fse_ptr, LBA_SINGLE_OBJECT );
+ } else {
+
+ GetLBAs( query, bsd_ptr, fse_ptr, LBA_BEGIN_POSITION );
+ }
+ }
+
+ /* Get next FSE for this BSD */
+
+ fse_ptr = BSD_GetNextFSE( fse_ptr );
+ }
+
+ // We need the PBA of the highest number tape seq which
+ // contains the first LBA we are going to restore.
+
+ pba = QTC_GetMeTheVCBPBA( BSD_GetTapeID( bsd_ptr ),
+ mw_tape_num,
+ BSD_GetSetNum( bsd_ptr ) );
+
+ /* if this is an 8200SX drive, we don't really have a pba
+ so set it to manufacture the pba in the beng */
+
+ if ( ( ! pba ) && SupportSXFastFile( thw_list ) ) {
+ pba = MANUFACTURED_PBA;
+ }
+
+ BSD_SetPBA( bsd_ptr, pba );
+
+ TapeCatVer = QTC_GetMeTheTapeCatVer( BSD_GetTapeID( bsd_ptr ),
+ mw_tape_num,
+ BSD_GetSetNum( bsd_ptr ) );
+
+ BSD_SetTapeCatVer( bsd_ptr, TapeCatVer );
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+
+ }
+
+ QTC_CloseQuery( query );
+
+ return( SUCCESS );
+
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static INT16 GetLBAs(
+QTC_QUERY_PTR query,
+BSD_PTR curr_bsd_ptr, /* I - pointer to the current BSD */
+FSE_PTR curr_fse_ptr, /* I - pointer to the current FSE */
+UINT16 type ) /* type of LBA to enqueue */
+{
+ INT16 ret_val; /* return value */
+ LBA_QUERY lba_query; /* query related info */
+ UINT32 lba; /* lba found by query */
+ INT16 tape_num;
+
+ /* Setup path and filename for search */
+
+ FSE_GetPath( curr_fse_ptr, (BYTE **)&lba_query.path, &lba_query.path_size );
+
+ lba_query.bsd_ptr = curr_bsd_ptr;
+ lba_query.fse_ptr = curr_fse_ptr;
+
+ if ( type != LBA_SINGLE_OBJECT ) {
+
+ /** It was just a path, so process path into itemname and path **/
+
+ strcpy( lba_query.itemname, TEXT("") );
+ lba_query.item_size = 0;
+
+ ret_val = GetLBAForItem( query, &lba_query, &lba, (UINT16_PTR)&tape_num, type );
+ }
+ else {
+
+ /* Get LBA for this file item */
+
+ strcpy( lba_query.itemname, (CHAR_PTR)FSE_GetFname( curr_fse_ptr ) );
+ lba_query.item_size = (INT16)(strsize( lba_query.itemname )-sizeof(CHAR)); //byte len w/o null term
+
+ /* a file must always be found on the lowest number tape first,
+ at least I hope ! */
+
+ ret_val = GetLBAForItem( query, &lba_query, &lba, (UINT16_PTR)&tape_num, type );
+
+ }
+
+ if ( ret_val == SUCCESS ) {
+
+ /* Save this LBA */
+
+ if ( BSD_AddLBAElem( curr_bsd_ptr, lba, tape_num, type, 0 ) == SUCCESS ) {
+
+ if ( tape_num < mw_tape_num || mw_tape_num == -1 ) {
+
+ mw_tape_num = tape_num;
+ }
+
+ /* Check for processing security information for this BSD */
+ /* and continue to adjust the dir of interest until the */
+ /* root is reached */
+
+ if ( BSD_GetProcElemOnlyFlg( curr_bsd_ptr ) == FALSE ) {
+
+ /* Continue for each subdir level until the root is reached */
+
+ do {
+ strcpy( lba_query.itemname, TEXT("") );
+ lba_query.item_size = 0;
+
+ ret_val = GetLBAForItem( query, &lba_query,
+ &lba, (UINT16_PTR)&tape_num, (INT16) -1 );
+
+ if ( ret_val == SUCCESS ) {
+
+ /* Save this LBA */
+ BSD_AddLBAElem( curr_bsd_ptr, lba,
+ (UINT16) tape_num,
+ (UINT16) LBA_SINGLE_OBJECT, (UINT16) 0 );
+
+ if ( tape_num < mw_tape_num ||
+ mw_tape_num == -1 ) {
+
+ mw_tape_num = tape_num;
+ }
+ }
+
+ } while ( NewLBADirToProcess( &lba_query ) );
+
+ } else {
+
+ /* If we're processing a single file selection then we */
+ /* need to find the LBA for its parent, otherwise we */
+ /* are processing a directory based selection so we're */
+ /* finished. */
+
+ if ( type == LBA_SINGLE_OBJECT ) {
+
+ /* Just do one directory LBA */
+
+ strcpy( lba_query.itemname, TEXT("") );
+ lba_query.item_size = 0;
+
+ ret_val = GetLBAForItem( query, &lba_query,
+ &lba, (UINT16_PTR)&tape_num,
+ (INT16) LBA_SINGLE_OBJECT );
+
+ if ( ret_val == SUCCESS ) {
+
+ /* Save this LBA */
+ BSD_AddLBAElem( curr_bsd_ptr, lba,
+ (UINT16) tape_num,
+ (UINT16) LBA_SINGLE_OBJECT, (UINT16) 0 );
+
+ if ( tape_num < mw_tape_num || mw_tape_num == -1 ) {
+
+ mw_tape_num = tape_num;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return( ret_val );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static INT16 GetLBAForItem(
+QTC_QUERY_PTR query,
+LBA_QUERY_PTR lba_query, /* criteria for catalog query */
+UINT32_PTR lba, /* lba to fill out */
+UINT16_PTR tape_num, /* tape lba is on */
+INT16 type )
+{
+
+ INT16 ret_val; /* return value */
+
+ /* First init LBA to not found condition */
+
+ *lba = 0;
+
+ /* Setup Catalog Query structure */
+
+ QTC_SetSearchPath( query, lba_query->path, lba_query->path_size );
+ QTC_SetSearchName( query, lba_query->itemname );
+ QTC_SetSubdirs( query, FALSE );
+
+ /* Find first occurance of matching item */
+
+ if ( ! QTC_SearchFirstItem( query ) ) {
+
+ *lba = QTC_GetItemLBA( query );
+
+ /* Setup to return this LBA */
+
+ *tape_num = (INT16)QTC_GetTapeSeq( query );
+
+ ret_val = SUCCESS;
+
+
+ TryToFindMoreMatchesInSameBSD( query, lba_query, type );
+
+ }
+ else {
+ ret_val = FAILURE;
+ }
+
+ return( ret_val );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+/*** We got an LBA for a directory and now we need to see if we can
+ find more matches in the same BSD. If we can, then they need to
+ be added to the LBA queue as well.
+***/
+
+static INT16 TryToFindMoreMatchesInSameBSD(
+QTC_QUERY_PTR query,
+LBA_QUERY_PTR lba_query,
+INT16 type )
+{
+ INT16 tape_num;
+
+ // If the directory found has duplicates than enter the lba's for
+ // all the duplicates.
+
+ while ( ! QTC_SearchNextItem( query ) ) {
+
+ tape_num = (INT16)QTC_GetTapeSeq( query );
+
+ if ( !( query->status & QTC_DIRECTORY ) ||
+ !( query->status & QTC_CONTINUATION ) ||
+ ( QTC_GetItemLBA(query) > 1 ) ) {
+
+ BSD_AddLBAElem( lba_query->bsd_ptr,
+ QTC_GetItemLBA( query ),
+ tape_num,
+ type, 0 );
+
+ }
+
+ if ( tape_num < mw_tape_num || mw_tape_num == -1 ) {
+
+ mw_tape_num = tape_num;
+ }
+ }
+
+ return( 0 );
+
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+/***
+
+ 4 things to work with,
+ lba_query->path
+ lba_query->path_size - includes trailing null byte
+ lba_query->itemname
+ lba_query->item_size - excludes trailing null byte
+
+ Before
+ path = eng\proj\bengine
+ itemname = src
+
+ After
+ path = eng\proj
+ itemname = bengine
+
+***************/
+
+static BOOLEAN NewLBADirToProcess( lba_query )
+LBA_QUERY_PTR lba_query;
+{
+ INT i;
+ static CHAR_PTR empty = TEXT("");
+
+ /* Determine if a parent directory needs to be "extracted" */
+
+ if ( lba_query->path_size == 0 ) {
+ return FALSE;
+ }
+
+
+ if( lba_query->path_size != sizeof (CHAR) ) {
+
+ /* Make adjustments for new parent dir to process */
+
+ for( i = lba_query->path_size/sizeof (CHAR) - 2; i >= 0; i-- ) {
+
+ if ( lba_query->path[i] == TEXT('\0') ) {
+
+ strcpy( lba_query->itemname, &lba_query->path[i+1] );
+ lba_query->item_size = (INT16)(strsize( lba_query->itemname )-sizeof(CHAR));
+ lba_query->path_size = (INT16)(i * sizeof (CHAR));
+ return TRUE;
+ }
+ }
+
+ /* top subdirectory */
+
+ strcpy( lba_query->itemname, &lba_query->path[0] );
+ lba_query->item_size = (INT16)(strsize( lba_query->itemname )-sizeof(CHAR)); //byte size w/o null term
+ lba_query->path = empty;
+ lba_query->path_size = sizeof (CHAR);
+ return TRUE;
+
+ }
+ else {
+
+ /** Now do root **/
+
+ strcpy( lba_query->itemname, TEXT("") );
+ lba_query->item_size = sizeof (CHAR); //byte size (why does this one incl null term??)
+ lba_query->path_size = 0;
+ lba_query->path = empty;
+ return TRUE;
+ }
+}
diff --git a/private/utils/ntbackup/src/do_misc.c b/private/utils/ntbackup/src/do_misc.c
new file mode 100644
index 000000000..05425c31e
--- /dev/null
+++ b/private/utils/ntbackup/src/do_misc.c
@@ -0,0 +1,761 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_misc.c
+
+ Description:
+
+ $Log: J:/UI/LOGFILES/DO_MISC.C_V $
+
+ Rev 1.31 24 Mar 1994 15:29:32 GREGG
+Initialize temp size parameter passed into MapAnsiToUnicNoNull.
+
+ Rev 1.30 21 Mar 1994 12:40:08 STEVEN
+fix mapuin bugs
+
+ Rev 1.29 02 Feb 1994 17:30:34 chrish
+Added changes for UNICODE app to handle ANSI secured tapes.
+
+ Rev 1.28 17 Jan 1994 16:13:46 MIKEP
+fix unicode warnings
+
+ Rev 1.27 24 Nov 1993 15:32:04 BARRY
+Unicode fixes
+
+ Rev 1.26 26 Jul 1993 18:14:50 MARINA
+enable c++
+
+ Rev 1.25 30 Apr 1993 15:52:24 chrish
+NOSTRADAMOUS EPR 0391: Added logic to display when user aborts an operation
+to say "Operation completed" instead of "... operation completed successfully".
+
+ Rev 1.24 22 Apr 1993 15:54:48 chrish
+Fixs for Nostradamous: EPR 0403 - Added new function to get the user name
+from the catalog information of the first set on the tape. This is so as to
+display the original owner of the tape when the erase dialog box pops up.
+
+ Rev 1.23 08 Apr 1993 17:15:22 chrish
+Added new function WhoPasswordedTape to determine if the tape was secured
+by NTBackup or some other app ... ie Cayman app.
+
+
+ Rev 1.22 17 Mar 1993 16:14:22 chrish
+Added change to IsUserValid routine.
+
+ Rev 1.21 22 Feb 1993 11:18:26 chrish
+Added changes received from MikeP.
+Fix IsUserValid by non encrypting an already encypted password.
+
+ Rev 1.20 09 Feb 1993 09:41:54 chrish
+Minor change to UI_GetCurrentStatus routine for OPERATION_RESTORE case.
+
+ Rev 1.19 15 Dec 1992 11:23:16 chrish
+Modified IsUserValid routine, added another parameter passed to it.
+
+ Rev 1.18 14 Dec 1992 12:18:04 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.17 18 Nov 1992 11:22:06 chrish
+Added IFDEF OS_WIN32 for NT specific stuff.
+
+ Rev 1.17 18 Nov 1992 10:27:34 chrish
+IFDEF functions used only for NT app.
+
+ Rev 1.16 16 Nov 1992 12:20:58 chrish
+Minor changes to clean-up warning messages on building.
+
+ Rev 1.15 13 Nov 1992 17:25:46 chrish
+Added some routine used for Tape Security for NT
+
+ Rev 1.14 01 Nov 1992 15:49:30 DAVEV
+Unicode changes
+
+ Rev 1.13 20 Oct 1992 17:18:14 MIKEP
+abort at eof
+
+ Rev 1.12 20 Oct 1992 15:44:30 MIKEP
+gbCurrentOperation
+
+ Rev 1.11 07 Oct 1992 14:53:38 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.10 04 Oct 1992 19:34:14 DAVEV
+Unicode Awk pass
+
+ Rev 1.9 27 Jul 1992 14:49:06 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.8 11 Jun 1992 15:20:50 DAVEV
+do not display status message 'Examine <log file> for more info' if not logging
+
+ Rev 1.7 14 May 1992 17:24:08 MIKEP
+nt pass 2
+
+ Rev 1.6 28 Jan 1992 12:08:48 CARLS
+
+
+ Rev 1.5 28 Jan 1992 12:04:36 CARLS
+coding error on comment
+
+ Rev 1.4 28 Jan 1992 11:59:10 CARLS
+fixed password problem
+
+ Rev 1.3 16 Dec 1991 11:45:04 CARLS
+added <windows.h>
+
+ Rev 1.2 12 Dec 1991 11:03:36 JOHNWT
+removed UI_GetPasswordsAndLabels
+
+ Rev 1.1 25 Nov 1991 15:32:50 JOHNWT
+removed mresprintf
+
+ Rev 1.0 20 Nov 1991 19:32:24 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/*****************************************************************************
+
+ Name: UI_AbortAtEndOfFile
+
+ Description: Abort current operation at the end of the current file.
+
+ Returns: SUCCESS
+
+*****************************************************************************/
+INT UI_AbortAtEndOfFile( )
+{
+ gbAbortAtEOF = TRUE;
+ return( SUCCESS );
+}
+
+
+
+/*****************************************************************************
+
+ Name: UI_GetCurrentStatus
+
+ Description: Get the current status of an on going operation.
+
+ Returns: SUCCESS
+
+*****************************************************************************/
+INT UI_GetCurrentStatus(
+INT *Operation,
+STATS *Stats,
+CHAR *Path,
+INT PathSize )
+{
+
+ *Operation = gbCurrentOperation;
+
+ switch ( gbCurrentOperation ) {
+
+ case OPERATION_BACKUP:
+ UI_GetBackupCurrentStatus( Stats, Path, PathSize );
+ break;
+
+ case OPERATION_RESTORE:
+ UI_GetRestoreCurrentStatus( Stats, Path, PathSize );
+ break;
+
+ case OPERATION_VERIFY:
+ UI_GetBackupCurrentStatus( Stats, Path, PathSize );
+ break;
+
+ case OPERATION_CATALOG:
+ UI_GetBackupCurrentStatus( Stats, Path, PathSize );
+ break;
+
+ default:
+ break;
+ }
+
+
+ return( SUCCESS );
+}
+
+
+/*****************************************************************************
+
+ Name: UI_CheckOldTapePassword
+
+ Description: Function called from Cat/Restore/Verify tape positioners to
+ validate a tape password.
+
+ Returns: (UINT16)response that is returned to Tape Format if an
+ error has occurred
+
+ Notes: If a given tape has had the password matched once, this
+ routine will "match" the current password automatically
+
+*****************************************************************************/
+UINT16 UI_CheckOldTapePassword(
+DBLK_PTR cur_vcb )
+{
+ UINT16 response ;
+
+ /* assume the password already has or will be matched */
+ response = UI_CONTINUE_POSITIONING ;
+
+ /* look for MaynStream Tape Passwords */
+
+ if ( ( FS_SizeofTapePswdInVCB( cur_vcb ) != 0 ) ||
+ ( FS_SizeofSetPswdInVCB( cur_vcb ) != 0 ) ) {
+
+ /* TRUE = passwords matched, FALSE = no match */
+ if ( !VerifyTapePassword( (CHAR_PTR)FS_ViewTapeNameInVCB( cur_vcb ),
+ (CHAR_PTR)FS_ViewSetDescriptInVCB( cur_vcb ),
+ (CHAR_PTR)FS_ViewUserNameInVCB( cur_vcb ),
+ FS_ViewPswdEncryptInVCB( cur_vcb ),
+ (INT8_PTR)FS_ViewTapePasswordInVCB( cur_vcb ),
+ FS_SizeofTapePswdInVCB( cur_vcb ),
+ (INT8_PTR)FS_ViewSetPswdInVCB( cur_vcb ),
+ FS_SizeofSetPswdInVCB( cur_vcb ),
+ FS_ViewTapeIDInVCB( cur_vcb ) ) ) {
+
+ response = UI_ABORT_POSITIONING ;
+ }
+ }
+
+ return response ;
+}
+/*****************************************************************************
+
+ Name: UI_ChkDispGlobalError
+
+ Description: Checks and displays error message if global variable
+ gb_error_during_operation is TRUE.
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID UI_ChkDispGlobalError ( )
+{
+ if ( gb_error_during_operation == TRUE ) {
+
+ yresprintf( RES_ERROR_DURING_OPERATION ) ;
+ JobStatusBackupRestore(JOB_STATUS_LISTBOX);
+
+
+ if ( CDS_GetOutputDest( CDS_GetPerm() ) == (INT16) LOG_TO_FILE
+ && CDS_GetLogLevel ( CDS_GetPerm() ) != (INT16) LOG_DISABLED ) {
+ yresprintf( (INT16) RES_ERROR_FILE_TO_EXAMINE, LOG_GetCurrentLogName() ) ;
+ JobStatusBackupRestore(JOB_STATUS_LISTBOX);
+ }
+
+ } else {
+ if ( gb_abort_flag != CONTINUE_PROCESSING ) { // chs:04-30-93
+ yresprintf( (INT16) RES_OPERATION_COMPLETED ) ; // chs:04-30-93
+ } else { // chs:04-30-93
+ yresprintf( (INT16) RES_NOERROR_DURING_OPERATION ) ; // chs:04-30-93
+ } // chs:04-30-93
+ JobStatusBackupRestore(JOB_STATUS_LISTBOX);
+ }
+}
+
+
+/***************************************************
+
+ Name: GetCurrentMachineNameUserName
+
+ Description: Retrieves the Machine name and the
+ username as one string. Example
+ "machinename/username"
+
+ Returns: pointer to machine/user name
+
+*****************************************************/
+CHAR_PTR GetCurrentMachineNameUserName ( VOID )
+{
+ GENERIC_DLE_PTR dle_ptr;
+ CHAR_PTR machineusername;
+
+
+ machineusername = NULL;
+ DLE_GetFirst( dle_list, &dle_ptr );
+
+ if ( dle_ptr ) {
+ machineusername = DLE_ViewUserName( dle_ptr );
+ }
+
+ return( machineusername );
+}
+
+/***************************************************
+
+ Name: DoesUserHaveThisPrivileges
+
+ Description: Checks to see if current user
+ has administrative privileges.
+
+
+ Returns: TRUE - if has admin priv.
+ FALSE - if does not have admin. priv.
+
+
+*****************************************************/
+BOOLEAN DoesUserHaveThisPrivilege ( CHAR_PTR privilegestring )
+{
+
+#ifdef OS_WIN32
+
+ BOOLEAN ret_val = TRUE;
+ HANDLE ProcessHandle;
+ DWORD DesiredAccess;
+ HANDLE TokenHandle;
+ LUID BackupValue;
+ TOKEN_PRIVILEGES NewState;
+ DWORD error;
+
+
+ // get process handle
+
+ ProcessHandle = GetCurrentProcess();
+
+ // open process token
+
+ DesiredAccess = MAXIMUM_ALLOWED;
+
+ if ( ! OpenProcessToken( ProcessHandle, DesiredAccess, &TokenHandle ) ) {
+ return( FALSE );
+ }
+
+ // adjust backup token privileges
+
+ if ( ! LookupPrivilegeValue( NULL, privilegestring, &BackupValue ) ) {
+ ret_val = FALSE;
+ }
+
+ // Enable backup privilege for this process
+
+ NewState.PrivilegeCount = 1;
+ NewState.Privileges[0].Luid = BackupValue;
+ NewState.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+ AdjustTokenPrivileges( TokenHandle, FALSE, &NewState, (DWORD)0, NULL, NULL );
+ error = GetLastError();
+
+ if ( error ) {
+ ret_val = FALSE;
+ }
+
+ // close process token
+
+ CloseHandle( TokenHandle );
+ return( ret_val );
+
+#else
+
+ return ( TRUE );
+
+#endif
+
+}
+
+/***************************************************
+
+ Name: IsCurrentTapeSecured
+
+ Description: Check to see if current tape has a
+ password.
+
+
+ Returns: TRUE - tape is secured
+ FALSE - tape in not secure
+
+
+*****************************************************/
+BOOLEAN IsCurrentTapeSecured (
+
+DBLK_PTR vcb_ptr ) // current vcb
+
+{
+ if ( !vcb_ptr ) return( FALSE );
+
+ // does the tape have a password, check the tape password length
+ // for the current vcb
+
+ if ( FS_SizeofTapePswdInVCB( vcb_ptr ) ) {
+ return( TRUE );
+ }
+
+ return( FALSE );
+}
+
+/***************************************************
+
+ Name: IsUserValid
+
+ Description: Check to see if user has permission
+ to do backup on the tape. Basically
+ see if user is administrator or matches
+ tape password.
+ The vcb passed will contain the tape passwd
+ that is on the tape. The inputtapepasswd is
+ the current "machine/username" password.
+
+
+ Returns: TRUE - User is valid, he/she has privilege
+ FALSE - User is NOT valid, he/she does not
+ have privilege
+
+
+*****************************************************/
+BOOLEAN IsUserValid ( DBLK_PTR vcb_ptr, // current VCB
+ INT8_PTR inputtapepasswd, // tape password
+ INT16 inputtapepasswdlength // length of password
+)
+{
+ CHAR_PTR temppasswd; // hold the tape password from the VCB
+ // passwd on the tape.
+ INT dummysize;
+ INT16 tempsize; // length of password from tape.
+ CHAR_PTR buffer = NULL;
+ CHAR_PTR temppasswdbuffer = NULL;
+ BOOLEAN retcode;
+
+ if ( !vcb_ptr ) return( FALSE );
+ //
+ // Verify if user tape password matches.
+ // Check the tape password from the current VCB
+ //
+
+ temppasswd = FS_ViewTapePasswordInVCB( vcb_ptr );
+ if ( !temppasswd ) return( TRUE ); // no password on tape
+
+ tempsize = FS_SizeofTapePswdInVCB( vcb_ptr );
+ if ( tempsize == 0 ) return( TRUE ); // no password on tape
+
+ buffer = ( CHAR_PTR )calloc(1, tempsize * sizeof( CHAR ) );
+ if ( !buffer ) return( FALSE );
+
+#ifdef UNICODE
+ if ( FS_ViewStringTypeinDBLK( vcb_ptr ) == BEC_ANSI_STR ) {
+
+ temppasswdbuffer = ( CHAR_PTR )calloc(1, tempsize );
+ if ( !temppasswdbuffer ) {
+ free( buffer );
+ return( FALSE );
+ }
+ memcpy( temppasswdbuffer, temppasswd, tempsize );
+ CryptPassword( ( INT16 ) DECRYPT, ENC_ALGOR_3, (INT8_PTR)temppasswdbuffer, tempsize );
+ tempsize *= sizeof( CHAR );
+ dummysize = (INT)tempsize ;
+ mapAnsiToUnicNoNull( ( ACHAR_PTR )temppasswdbuffer, ( WCHAR_PTR )buffer, ( INT )(tempsize / sizeof( CHAR ) ), &dummysize ) ;
+ tempsize = (INT16)dummysize;
+ if ( ( *temppasswdbuffer & 0xff ) == NTPASSWORDPREFIX ) {
+ *buffer = NTPASSWORDPREFIX;
+ }
+ free( temppasswdbuffer );
+ } else {
+ memcpy( buffer, temppasswd, tempsize );
+ CryptPassword( ( INT16 ) DECRYPT, ENC_ALGOR_3, (INT8_PTR)buffer, tempsize );
+ }
+#else
+ memcpy( buffer, temppasswd, tempsize );
+ CryptPassword( ( INT16 ) DECRYPT, ENC_ALGOR_3, (INT8_PTR)buffer, tempsize );
+#endif
+
+ if ( inputtapepasswdlength == tempsize ) {
+
+ if ( !memcmp( buffer, inputtapepasswd, tempsize ) ) {
+ retcode = TRUE;
+
+ } else {
+ retcode = FALSE;
+ }
+
+ } else {
+ retcode = FALSE;
+ }
+
+ if ( buffer ) free ( buffer );
+
+ return( retcode );
+}
+
+/***************************************************
+
+ Name: WhoPasswordedTape
+
+ Description: This routine will tell who passworded
+ the tape. Whether it was tape secured
+ by Nostradamous or passworded by Cayman or
+ if no password exist. A tape secured by
+ Nostradamous always has a prefix character
+ of NTPASSWORDPREFIX on the actual password.
+ All other will be considered non-Nostradamous.
+
+ Returns: NOSTRADAMOUS_APP - tape secured by Nostardamous
+ OTHER_APP - tape passworded by some other
+ application.
+ NO_APP - tape is NOT passworded or
+ secured by any application or
+ general error out condition.
+
+*****************************************************/
+INT16 WhoPasswordedTape ( INT8_PTR tape_password, // encrypted password
+ INT16 tape_password_size )
+{
+ CHAR_PTR buffer;
+
+
+ if ( !tape_password || tape_password_size <= 0) return( NO_APP );
+
+ buffer = ( CHAR_PTR )calloc(1, sizeof( CHAR ) * tape_password_size );
+ if ( !buffer ) return( NO_APP );
+
+ memcpy( buffer, tape_password, tape_password_size );
+
+ CryptPassword( ( INT16 ) DECRYPT, ENC_ALGOR_3, (INT8_PTR)buffer, ( INT16 ) ( tape_password_size ) );
+ if ( (*buffer & 0xff ) == NTPASSWORDPREFIX) {
+ free( buffer );
+ return( NOSTRADAMOUS_APP );
+ }
+
+ free( buffer );
+ return( OTHER_APP );
+}
+
+/**************************************************************************
+
+ Name: GetOriginalOwnerOfTape
+
+ Description: This routine will get the username from the first
+ tape and first set of the same family of tape from
+ the catalog information. If the first tape does
+ not exist the it will jsut return a NULL.
+
+
+ Returns: pointer to the username from the fisrt tape
+ first set from the tape family.
+
+ NULL - if the first tape does not exist.
+
+
+**************************************************************************/
+BOOLEAN GetOriginalOwnerOfTape( DBLK_PTR vcb_ptr,
+ CHAR_PTR user_name
+ )
+{
+ UINT32 tape_id;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ INT done = 0;
+ INT found = 0;
+ QTC_HEADER_PTR qtc_header;
+
+
+ // no vcb_ptr
+ if ( !vcb_ptr ) return( FALSE );
+
+ // get tape id from current vcb
+ tape_id = FS_ViewTapeIDInVCB( vcb_ptr );
+
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL && ! done ) {
+
+ if ( ( tape->tape_fid == tape_id ) ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ // There must be a bset from this tape.
+
+ if ( bset != NULL ) {
+
+ qtc_header = QTC_LoadHeader( bset );
+ if ( qtc_header ) {
+ strcpy( user_name, qtc_header->user_name );
+ free( qtc_header );
+ return( TRUE );
+ }
+ } else {
+
+ return( FALSE ); // no first set found on the tape
+ }
+
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( FALSE ); // no tape found
+
+}
+/*****************************************************************************
+
+ Name: UI_AddSpecialIncOrExc
+
+ Description: Abort current operation at the end of the current file.
+
+ Returns: SUCCESS
+
+*****************************************************************************/
+VOID UI_AddSpecialIncOrExc( BSD_PTR bsd, BOOLEAN IsInclude )
+{
+ INT index = 0;
+ CHAR *name;
+ LONG ret;
+ ULONG ulOptions = 0L ;
+ HKEY key2;
+ REGSAM samDesired = KEY_QUERY_VALUE;
+ CHAR data[ 512 ];
+ CHAR ValueKey[ 512 ];
+ INT value_size;
+ INT data_size;
+ FSE_PTR fse ;
+ INT16 dir_size ;
+ CHAR_PTR p;
+ CHAR_PTR q;
+ CHAR log_name[256] ;
+
+ ret = GetEnvironmentVariable( TEXT("SystemRoot"), &data, 256 ) ;
+
+ if ( ret && IsInclude ) {
+ strcat( data, TEXT("\\profiles") ) ;
+ p = strchr( data, TEXT('\\') ) ;
+ if ( p == NULL ) {
+ p = data ;
+ } else {
+ p++ ;
+ }
+ dir_size = strsize( p ) ;
+ q = p ;
+ while (*q ) {
+ if (*q == TEXT('\\') ) {
+ *q = 0;
+ }
+ q++ ;
+ }
+ if ( SUCCESS == BSD_CreatFSE ( &fse,
+ (IsInclude?INCLUDE:EXCLUDE),
+ p,
+ dir_size,
+ TEXT("*") ,
+ 2 * sizeof(CHAR),
+ TRUE,
+ TRUE ) ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+ }
+
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ TEXT("system\\currentcontrolset\\control\\hivelist"),
+ ulOptions, samDesired, &key2 ) ;
+
+ if ( ret ) {
+ return ;
+ }
+
+ do {
+
+ value_size = 512 ;
+ data_size = 512 ;
+
+ ret = RegEnumValue( key2,
+ index,
+ ValueKey,
+ (LPDWORD)&value_size,
+ NULL,
+ NULL,
+ (LPBYTE)
+ data,
+ (LPDWORD)&data_size );
+
+ if ( ! ret ) {
+
+ // separate file name from end of data.
+
+ data_size /= sizeof(CHAR);
+
+ data[ data_size ] = 0;
+
+ while ( ( data[ data_size ] != TEXT( '\\' ) ) && data_size )
+ {
+ data_size--;
+ }
+
+ if ( data_size )
+ {
+ name = &data[ data_size + 1 ];
+ data[data_size] = 0 ;
+ p = strchr( data, TEXT('\\') ) ;
+ if ( p ) {
+ p = strchr( p+1, TEXT('\\') ) ;
+ }
+ if ( p ) {
+ p = strchr( p+1, TEXT('\\') ) ;
+ }
+ if ( p ) {
+ p = strchr( p+1, TEXT('\\') ) ;
+ }
+ if ( p ) {
+ q = p + 1 ;
+ dir_size = strsize( q ) ;
+ while (*q ) {
+ if (*q == TEXT('\\') ) {
+ *q = 0;
+ }
+ q++ ;
+ }
+ if ( SUCCESS == BSD_CreatFSE ( &fse,
+ (IsInclude?INCLUDE:EXCLUDE),
+ p+1,
+ dir_size,
+ name,
+ strsize( name ),
+ FALSE,
+ FALSE ) ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+ strcpy( log_name, name ) ;
+ strcat( log_name, TEXT(".LOG") ) ;
+
+ if ( SUCCESS == BSD_CreatFSE ( &fse,
+ EXCLUDE,
+ p+1,
+ dir_size,
+ log_name,
+ strsize( log_name ),
+ FALSE,
+ FALSE ) ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+
+ strcpy( log_name, name ) ;
+ strcat( log_name, TEXT(".ALT") ) ;
+ if ( SUCCESS == BSD_CreatFSE ( &fse,
+ EXCLUDE,
+ p+1,
+ dir_size,
+ log_name,
+ strsize( log_name ),
+ FALSE,
+ FALSE ) ) {
+ BSD_AddFSE( bsd, fse ) ;
+ }
+ }
+
+
+ }
+ }
+
+ index++;
+
+ } while ( ! ret );
+
+ RegCloseKey( key2 );
+
+}
+
diff --git a/private/utils/ntbackup/src/do_next.c b/private/utils/ntbackup/src/do_next.c
new file mode 100644
index 000000000..6cc58cf83
--- /dev/null
+++ b/private/utils/ntbackup/src/do_next.c
@@ -0,0 +1,427 @@
+
+/******************************************************************************
+
+ Unit: Tape
+
+ Name: do_next.c
+
+ Description: This module contains the functions which perform the
+ next set search operation.
+
+ Copyright: (c) Maynard Electronics, Inc. 1984-92
+
+ $Log: G:/UI/LOGFILES/DO_NEXT.C_V $
+
+ Rev 1.17 20 Oct 1992 15:46:54 MIKEP
+gbCurrentOperation
+
+ Rev 1.16 07 Oct 1992 14:49:34 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.15 04 Oct 1992 19:34:16 DAVEV
+Unicode Awk pass
+
+ Rev 1.14 03 Sep 1992 13:30:38 MIKEP
+turn off polldrive
+
+ Rev 1.12.1.1 02 Sep 1992 20:13:02 MIKEP
+turn polldrive off and back on if microsoft
+
+ Rev 1.13 16 Jun 1992 16:02:04 MIKEP
+remove no more bsets msg for NT
+
+ Rev 1.12 02 Jun 1992 08:08:24 MIKEP
+remove no more tape msg
+
+ Rev 1.11 28 May 1992 10:10:14 MIKEP
+fix return type
+
+ Rev 1.10 19 May 1992 13:01:16 MIKEP
+mips changes
+
+ Rev 1.9 14 May 1992 17:39:04 MIKEP
+nt pass 2
+
+ Rev 1.8 11 May 1992 21:15:50 MIKEP
+catalog haandle based
+
+ Rev 1.7 27 Apr 1992 16:14:50 CHUCKB
+Fixed error message.
+
+ Rev 1.6 09 Apr 1992 08:47:42 MIKEP
+speed up lots of sets
+
+ Rev 1.5 21 Feb 1992 16:17:52 CARLS
+change to TF_IDLE_NOBREAK
+
+ Rev 1.4 29 Jan 1992 18:02:30 DAVEV
+
+
+ * No changes
+
+ Rev 1.3 16 Jan 1992 13:27:08 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.2 16 Dec 1991 12:35:58 CARLS
+added <windows.h>
+
+ Rev 1.1 09 Dec 1991 16:39:02 JOHNWT
+the real initial revision
+
+ Rev 1.0 05 Dec 1991 16:11:46 STEVEN
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static UINT16 NextSet_TPos( UINT16, TPOS_PTR, BOOLEAN, DBLK_PTR, UINT16 );
+static INT16 NextSet_MsgHandler( UINT16, INT32, BSD_PTR, FSYS_HAND, TPOS_PTR, ... );
+
+static QTC_BUILD_PTR mw_qtc_ptr;
+
+INT16 mw_bset_found_flag; /* static flag to maintain result */
+
+
+/******************************************************************************
+ *
+ * Unit: Tape
+ *
+ * Name: do_nextset
+ *
+ * Modified: 12/09/91
+ *
+ * Description: This function calls LP_List_Tape_Engine to look for an
+ * unknown (uncataloged) backup set. It first gets the
+ * current vcb from poll drive. It then locates the first
+ * unknown/missing backup set number and calls the engine
+ * to position to the vcb.
+ *
+ * Notes: Requires poll drive.
+ *
+ * Returns: SUCCESS - an unknown vcb was located and added to the cats
+ * FAILURE - EOD encountered or error
+ *
+ * Global Data: gb_abort_flag
+ *
+ *****************************************************************************/
+
+INT do_nextset( VOID )
+{
+ LIS lis; /* lis structure for list eng */
+ BSD_HAND temp_bsd_list; /* pointer to our bsd list */
+ BE_CFG_PTR bec_cfg_ptr; /* pointer to our copy of the config */
+ DBLK_PTR vcb_ptr; /* ptr to vcb that poll drive rets */
+ QTC_BSET_PTR bset_ptr; /* used in search of QTC catalogs */
+ INT16 find_bset_num; /* first unknown bset number */
+
+
+ /* if poll drive does not know what tape is in the drive, we exit */
+
+ if ( VLM_GetDriveStatus( &vcb_ptr ) != VLM_VALID_TAPE ) {
+ return FAILURE;
+ }
+
+ /* We want to find the first unknown bset after the current vcb. We
+ loop until we find one that is not in the catalogs. We check the
+ bsets along the way to see if they are split which would mean there
+ are no more bsets on the tape. If poll drive knows what tape is
+ in the drive, we can assume that it is in the catalogs. */
+
+ find_bset_num = FS_ViewBSNumInVCB( vcb_ptr );
+
+ while ( ( bset_ptr = QTC_FindBset( FS_ViewTapeIDInVCB( vcb_ptr ),
+ FS_ViewTSNumInVCB( vcb_ptr ),
+ find_bset_num ) ) != NULL ) {
+
+ if ( bset_ptr->status & QTC_SPLIT ) {
+
+#ifndef OEM_MSOFT
+ WM_MessageBox( ID( IDS_MSGTITLE_NEXT ),
+ ID( RES_NO_MORE_TAPE_INFO ),
+ WMMB_OK, WMMB_ICONINFORMATION, NULL, 0, 0 );
+#endif
+
+ return FAILURE;
+ }
+
+ find_bset_num++;
+
+ }
+
+ gbCurrentOperation = OPERATION_NEXTSET;
+
+ PD_StopPolling();
+
+#ifdef OEM_MSOFT
+ do {
+#endif
+
+ mw_bset_found_flag = FAILURE;
+
+ /* we now set up for our call to the backup engine */
+
+ temp_bsd_list = (BSD_HAND)malloc( sizeof(BSD_LIST) );
+ if ( temp_bsd_list == NULL ) {
+ gbCurrentOperation = OPERATION_NEXTSET;
+ return FAILURE;
+ }
+
+ InitQueue( &(temp_bsd_list->current_q_hdr) );
+ InitQueue( &(temp_bsd_list->last_q_hdr) );
+
+ /* each bsd has its own config so we make a copy and then unlock it
+ so it will be free'ed when we free the bsd */
+
+ bec_cfg_ptr = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_cfg_ptr );
+
+ if ( BSD_Add( temp_bsd_list, &lis.curr_bsd_ptr, bec_cfg_ptr,
+ NULL, NULL, FS_ViewTapeIDInVCB( vcb_ptr ),
+ FS_ViewTSNumInVCB( vcb_ptr ), find_bset_num,
+ thw_list, NULL ) != SUCCESS ) {
+
+ free( temp_bsd_list );
+ BEC_ReleaseConfig( bec_cfg_ptr );
+ gbCurrentOperation = OPERATION_NEXTSET;
+ return FAILURE;
+ }
+
+ BSD_SetTapePos( lis.curr_bsd_ptr, FS_ViewTapeIDInVCB( vcb_ptr ),
+ FS_ViewTSNumInVCB( vcb_ptr ), find_bset_num );
+
+ /* set up the lis structure */
+
+ lis.bsd_list = temp_bsd_list; /* set bsd list */
+ lis.tape_pos_handler = NextSet_TPos; /* set tape positioner to call */
+ lis.message_handler = NextSet_MsgHandler; /* set message handler to call */
+ lis.oper_type = TDIR_OPER; /* set operation type */
+ lis.abort_flag_ptr = &gb_abort_flag; /* set abort flag address */
+ lis.auto_det_sdrv = TRUE;
+
+ LP_SetAbortFlag( &lis, CONTINUE_PROCESSING );
+
+ /* stop poll drive and call the list engine to look for the bset */
+
+ mw_bset_found_flag = FAILURE;
+
+ LP_List_Tape_Engine( &lis );
+
+ /* free our allocated memory */
+
+ BSD_Remove( lis.curr_bsd_ptr );
+ free( temp_bsd_list );
+
+ find_bset_num++;
+
+#ifdef OEM_MSOFT
+ } while ( mw_bset_found_flag == SUCCESS );
+#endif
+
+ PD_StartPolling();
+
+ gbCurrentOperation = OPERATION_NEXTSET;
+ return( mw_bset_found_flag );
+}
+
+
+/******************************************************************************
+ *
+ * Unit: Tape
+ *
+ * Name: NextSet_TPos
+ *
+ * Modified: 12/8/91
+ *
+ * Description: This is a simple tape positioner message handler. It
+ * adds the bset to the cats if the requested vcb is found,
+ * tells the user there is no more data, or displays an
+ * error message.
+ *
+ * Notes:
+ *
+ * Returns: Defined in tpos.h
+ *
+ * Global Data: none
+ *
+ *****************************************************************************/
+
+static UINT16 NextSet_TPos(
+UINT16 message,
+TPOS_PTR tpos,
+BOOLEAN curr_valid_vcb,
+DBLK_PTR cur_vcb,
+UINT16 mode )
+{
+ UINT16 response = UI_ACKNOWLEDGED;
+
+ DBG_UNREFERENCED_PARAMETER ( tpos );
+ DBG_UNREFERENCED_PARAMETER ( curr_valid_vcb );
+ DBG_UNREFERENCED_PARAMETER ( mode );
+
+ if ( UI_CheckUserAbort( message ) ) {
+ return UI_ABORT_POSITIONING;
+ }
+
+ switch( message ) {
+
+ CHAR_PTR drive_name;
+ TCHAR szErrorMsg[MAX_UI_RESOURCE_SIZE] ;
+
+ case TF_REQUESTED_VCB_FOUND:
+
+ /* The unknown bset has been located! Add it to the catalogs as
+ a partial bset and happily abort. */
+
+ mw_qtc_ptr = QTC_GetBuildHandle( );
+ QTC_DoFullCataloging( mw_qtc_ptr, FALSE );
+ QTC_StartBackup( mw_qtc_ptr, cur_vcb );
+ QTC_FreeBuildHandle( mw_qtc_ptr );
+ mw_qtc_ptr = NULL;
+
+ VLM_AddBset( FS_ViewTapeIDInVCB( cur_vcb ),
+ FS_ViewTSNumInVCB( cur_vcb ),
+ FS_ViewBSNumInVCB( cur_vcb ), NULL, TRUE );
+
+ mw_bset_found_flag = SUCCESS;
+
+ response = UI_HAPPY_ABORT;
+
+ break;
+
+ case TF_VCB_EOD:
+ case TF_NEED_NEW_TAPE:
+ case TF_NO_MORE_DATA:
+
+ /* nothing else on the tape, sorry dude */
+#ifndef OEM_MSOFT
+ WM_MessageBox( ID( IDS_MSGTITLE_NEXT ),
+ ID( RES_NO_MORE_TAPE_INFO ),
+ WMMB_OK, WMMB_ICONINFORMATION, NULL, 0, 0 );
+#endif
+
+ response = UI_HAPPY_ABORT;
+
+ break;
+
+ case TF_VCB_BOT:
+ case TF_ACCIDENTAL_VCB:
+ case TF_POSITIONED_AT_A_VCB:
+ response = UI_CONTINUE_POSITIONING;
+ break;
+
+ case TF_WRONG_TAPE:
+ case TF_INVALID_VCB:
+ case TF_EMPTY_TAPE:
+ case TF_READ_ERROR:
+ case TF_NO_TAPE_PRESENT:
+
+ /* get a pointer to the name of the current tape device */
+ drive_name = BE_GetCurrentDeviceName( tpos->channel );
+
+ /* put the drive name in the error message */
+ RSM_Sprintf( szErrorMsg, ID( RES_FATAL_TAPE_READ_ERR ), drive_name ) ;
+
+ /* display generic error message */
+
+ WM_MessageBox( ID( IDS_MSGTITLE_NEXT ),
+ szErrorMsg,
+ WMMB_OK, WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+
+ response = UI_HAPPY_ABORT;
+
+ break;
+
+ case TF_IDLE_NOBREAK:
+ case TF_SEARCHING:
+ case TF_REWINDING:
+ case TF_DRIVE_BUSY:
+ case TF_IDLE:
+ case TF_SKIPPING_DATA:
+ case TF_MOUNTING:
+ break;
+
+ default:
+ eresprintf( RES_UNKNOWN_TF_MSG, message );
+ response = UI_ABORT_POSITIONING;
+ break;
+ }
+
+ return( response );
+}
+
+
+/******************************************************************************
+ *
+ * Unit: Tape
+ *
+ * Name: NextSet_MsgHandler
+ *
+ * Modified: 12/8/91
+ *
+ * Description: Message handler for the list engine. It displays any
+ * error messages and ignores all others.
+ *
+ * Notes:
+ *
+ * Returns: defined in lp_msg.h
+ *
+ * Global Data: none
+ *
+ *****************************************************************************/
+
+static INT16 NextSet_MsgHandler(
+UINT16 msg,
+INT32 pid,
+BSD_PTR bsd_ptr,
+FSYS_HAND fsh,
+TPOS_PTR tpos,
+... )
+{
+ va_list arg_ptr;
+ INT16 response = MSG_ACK;
+ static INT16 error;
+
+ DBG_UNREFERENCED_PARAMETER ( pid );
+ DBG_UNREFERENCED_PARAMETER ( bsd_ptr );
+ DBG_UNREFERENCED_PARAMETER ( fsh );
+
+ va_start( arg_ptr, tpos );
+
+ switch( msg ) {
+
+ case MSG_TBE_ERROR:
+
+ error = va_arg( arg_ptr, INT16 );
+ UI_ProcessErrorCode( error, &response, tpos->channel );
+ break;
+
+ case MSG_START_BACKUP_SET:
+ case MSG_START_OPERATION:
+ case MSG_END_OPERATION:
+ case MSG_LOG_BLOCK:
+ case MSG_END_BACKUP_SET:
+ case MSG_STOP_CLOCK:
+ case MSG_START_CLOCK:
+ case MSG_EOM:
+ case MSG_IDLE:
+ case MSG_BLOCK_BAD:
+ case MSG_BYTES_BAD:
+ case MSG_BLOCK_DELETED:
+ case MSG_BYTES_DELETED:
+ case MSG_TAPE_STATS:
+ case MSG_BLK_NOT_FOUND:
+ case MSG_BLK_DIFFERENT:
+ case MSG_LOG_DIFFERENCE:
+ break;
+
+ default:
+ eresprintf( RES_UNKNOWN_MSG_HNDLR_MSG, msg );
+ break;
+ }
+ return( response );
+}
diff --git a/private/utils/ntbackup/src/do_rest.c b/private/utils/ntbackup/src/do_rest.c
new file mode 100644
index 000000000..521ce4276
--- /dev/null
+++ b/private/utils/ntbackup/src/do_rest.c
@@ -0,0 +1,2438 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_rest.c
+
+ Description: Tape restore tape positioning and message handler
+
+ $Log: J:/UI/LOGFILES/DO_REST.C_V $
+
+ Rev 1.96.1.12 24 May 1994 20:10:52 GREGG
+Improved handling of ECC, SQL, FUTURE_VER and OUT_OF_SEQUENCE tapes.
+
+ Rev 1.96.1.11 04 May 1994 15:00:50 STEVEN
+fix dlt settling time
+
+ Rev 1.96.1.10 21 Apr 1994 10:34:26 GREGG
+Fixed memory leak.
+
+ Rev 1.96.1.9 04 Mar 1994 16:55:32 STEVEN
+prompt if disk full
+
+ Rev 1.96.1.8 23 Feb 1994 12:51:48 STEVEN
+remove corrupt.lst support from ntbackup
+
+ Rev 1.96.1.7 01 Feb 1994 19:18:44 ZEIR
+tuned tape settling logic for initial no_tape_in_drive situations
+
+ Rev 1.96.1.6 19 Jan 1994 10:57:40 MIKEP
+change happy_abort to abort_positioning to fix abort
+
+ Rev 1.96.1.5 13 Jan 1994 18:14:28 STEVEN
+fix directory count
+
+ Rev 1.96.1.4 27 Dec 1993 14:53:30 STEVEN
+counted root twice
+
+ Rev 1.96.1.3 14 Dec 1993 12:10:02 BARRY
+Don't write to gszTprintfBuffer, use yprintf
+
+ Rev 1.96.1.2 03 Dec 1993 02:07:30 GREGG
+Put back changes from lost rev 1.96.
+
+ Rev 1.96.1.1 02 Dec 1993 12:50:28 STEVEN
+Fixed number of directories processed bug.
+
+ Rev 1.96.1.0 05 Nov 1993 08:23:36 STEVEN
+fix clock over 1 hour
+
+ Rev 1.0 05 Nov 1993 08:23:18 STEVEN
+fix clock over 1 hour
+
+ Rev 1.95 15 Sep 1993 13:52:36 CARLS
+changes for displaying full path/file name detail if Log files
+
+ Rev 1.94 25 Jul 1993 12:55:18 MIKEP
+fix display of destination volume in runtime
+
+ Rev 1.93 22 Jul 1993 18:36:00 KEVINS
+Corrected macro name.
+
+ Rev 1.92 22 Jul 1993 18:29:22 KEVINS
+Added support for tape drive settling time.
+
+ Rev 1.91 19 Jul 1993 10:15:50 BARRY
+Don't reference dle in BSD directly -- use BSD_GetDLE instead.
+
+ Rev 1.90 12 Jul 1993 09:19:14 KEVINS
+Added support for status monitor.
+
+ Rev 1.89 23 Jun 1993 16:22:58 CARLS
+moved PROMPT_RESTORE_OVER_RECENT to display the confirm file replace dialog
+
+ Rev 1.88 18 Jun 1993 16:49:48 CARLS
+added NtDemoChangeTape calls for NtDemo
+
+ Rev 1.87 14 Jun 1993 20:23:56 MIKEP
+enable c++
+
+ Rev 1.86 07 Jun 1993 08:20:32 MIKEP
+fix warnings.
+
+ Rev 1.85 03 Jun 1993 14:31:02 DARRYLP
+Removed excess \ from backup and restore directory field upon abort
+
+ Rev 1.84 18 May 1993 14:34:18 DARRYLP
+Backed out my previous changes.
+
+ Rev 1.83 18 May 1993 12:07:44 GREGG
+Fix for EPR# 294-0419: Starting restore on continuation tape, files before
+first new DDB are restored to the root.
+
+ Rev 1.82 18 May 1993 12:04:12 DARRYLP
+Added line to update the status field with number of bytes processed for
+the operation.
+
+ Rev 1.81 14 May 1993 15:31:02 CHUCKB
+Added notification for restoring active registry files.
+
+ Rev 1.80 14 May 1993 14:40:30 DARRYLP
+Modified event logging text
+
+ Rev 1.79 10 May 1993 16:38:16 chrish
+NOSTRADAMUS EPR 0400 and 0172 - Did not catch the fixes in the verify and
+restore process of the backup app. When spanning tape it gave the user
+wrong message to wait for tape to rewind, when it had already completed
+rewinding. Corrected by display proper message to user.
+
+ Rev 1.78 18 Apr 1993 16:23:52 BARRY
+Don't use 'free' on buffers allocated with UI_AllocPathBuffer.
+
+ Rev 1.77 15 Apr 1993 15:33:16 CARLS
+added fix for abort when skipping files
+
+ Rev 1.76 13 Apr 1993 12:51:34 BARRY
+Don't do verify after on a happy abort.
+
+ Rev 1.75 02 Apr 1993 15:48:36 CARLS
+changes for DC2000 unformatted tape
+
+ Rev 1.74 09 Mar 1993 10:57:42 MIKEP
+update clock stats at end of set
+
+ Rev 1.73 07 Mar 1993 16:33:08 GREGG
+Call _sleep for OS_WIN32 only.
+
+ Rev 1.72 02 Mar 1993 12:36:10 CARLS
+fixed problem with confirm file replace
+
+ Rev 1.71 17 Feb 1993 10:39:26 STEVEN
+changes from mikep
+
+ Rev 1.70 10 Feb 1993 12:16:36 chrish
+Changes in msg_hndlr routine for display proper info during restore process.
+
+ Rev 1.69 09 Feb 1993 09:44:22 chrish
+Added logic for aborting during a restore process. This is identical to
+how the ctrl break handling for aborting during a backup. A file will be
+allowed to be completely restore before aborting.
+
+
+ Rev 1.68 01 Feb 1993 19:54:50 STEVEN
+bug fixes
+
+ Rev 1.67 27 Jan 1993 14:32:52 STEVEN
+handle MSG_CONT_VCB message
+
+ Rev 1.66 18 Jan 1993 16:05:42 STEVEN
+add support for stream id error message
+
+ Rev 1.65 08 Jan 1993 14:31:12 chrish
+Deleted one line ... (... //chs)
+
+ Rev 1.64 30 Dec 1992 14:12:56 STEVEN
+we did not display file name when we skipped file
+
+ Rev 1.63 23 Dec 1992 14:43:16 chrish
+Focus on Abort & restore log file added drive info
+
+ Rev 1.62 22 Dec 1992 14:19:20 MIKEP
+tab removal
+
+ Rev 1.61 22 Dec 1992 08:48:48 MIKEP
+changes from msoft
+
+ Rev 1.60 11 Nov 1992 16:31:08 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.59 05 Nov 1992 17:02:34 DAVEV
+fix ts
+
+ Rev 1.57 20 Oct 1992 17:01:12 MIKEP
+getstatus calls
+
+ Rev 1.56 20 Oct 1992 15:44:10 MIKEP
+gbCurrentOperation
+
+ Rev 1.55 19 Oct 1992 14:34:28 STEVEN
+no more remaining size
+
+ Rev 1.54 07 Oct 1992 14:46:28 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.53 04 Oct 1992 19:34:24 DAVEV
+Unicode Awk pass
+
+ Rev 1.52 17 Sep 1992 17:40:10 DAVEV
+minor fix (strsiz->strsize)
+
+ Rev 1.51 17 Sep 1992 15:52:02 DAVEV
+UNICODE modifications: strlen usage check
+
+ Rev 1.50 24 Aug 1992 15:22:54 DAVEV
+NT Event Logging
+
+ Rev 1.49 27 Jul 1992 14:48:54 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.48 27 Jul 1992 11:10:00 JOHNWT
+ChuckB checked in for John Wright, who is no longer with us.
+
+ Rev 1.47 07 Jul 1992 16:03:22 MIKEP
+unicode changes
+
+ Rev 1.46 25 Jun 1992 14:17:32 STEVEN
+restore prompt did not specify path
+
+ Rev 1.45 10 Jun 1992 17:07:58 DAVEV
+Fixed file 2 name in message box (was date carried intemp buffer)
+
+ Rev 1.44 10 Jun 1992 09:34:32 BURT
+Fixed funcs to ANSI arg list
+
+ Rev 1.43 29 May 1992 10:14:36 MIKEP
+total to display change
+
+ Rev 1.42 28 May 1992 10:07:56 MIKEP
+fix return type
+
+ Rev 1.41 26 May 1992 10:30:54 MIKEP
+loop fixes
+
+ Rev 1.40 19 May 1992 13:01:24 MIKEP
+mips changes
+
+ Rev 1.39 14 May 1992 17:38:52 MIKEP
+nt pass 2
+
+ Rev 1.38 11 May 1992 19:31:40 STEVEN
+64bit and large path sizes
+
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static UINT16 tpos_rout( UINT16 message, TPOS_PTR tpos, BOOLEAN curr_vcb_valid, DBLK_PTR cur_vcb, UINT16 mode );
+static INT16 msg_hndlr( UINT16 msg, INT32 pid, BSD_PTR bsd_ptr, FSYS_HAND fsh, TPOS_PTR tpos, ... );
+static BOOLEAN CorruptLSTFound( VOID );
+static VOID clock_routine( VOID );
+static VOID do_restore_init( VOID );
+static VOID do_restore_process( VOID );
+static INT16 PromptNextTape( TPOS_PTR, DBLK_PTR, BOOLEAN, UINT16, CHAR_PTR, CHAR_PTR );
+
+static BOOLEAN clock_ready_flag;
+static BOOLEAN restored_active_flag;
+static HTIMER timer_handle;
+static STATS op_stats;
+static FILE_REPLACE_TEMP_PTR mw_file_replace_ptr;
+static INT mw_oper_type;
+static INT16 mw_ret_val;
+static INT mw_rewind;
+static CHAR mwCurrentDrive[ 512 ]; // chs:02-08-93
+static CHAR mwCurrentPath[ 512 ]; // chs:02-08-93
+static CHAR mwCurrentFile[ 512 ]; // chs:02-08-93
+
+#ifdef OEM_EMS
+extern INT32 RT_BSD_OsId ;
+#endif
+
+#ifdef OS_WIN32
+static UINT16 mwTapeSettlingCount,
+ tape_retries;
+static BOOL mwErrorDuringBackupSet = FALSE;
+#endif
+
+
+INT16 TryToCreateFFRQueue( LIS_PTR, INT16 );
+
+
+/*****************************************************************************
+
+ Name: do_restore
+
+ Description: Main entry point for tape restore functions that
+ performs initialization and displays the runtime
+ dialog.
+
+ Returns: SUCCESS
+ ABNORMAL_TERMINATION
+
+ Notes: mw_ret_val is set in do_restore_process
+
+*****************************************************************************/
+
+INT do_restore( INT16 oper_type )
+{
+ mw_ret_val = SUCCESS;
+ mw_oper_type = oper_type;
+ mw_rewind = TRUE;
+
+ gbAbortAtEOF = FALSE;
+ gbCurrentOperation = OPERATION_RESTORE;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_RESTORE);
+
+#ifdef OS_WIN32
+ /* we will check for tape every 3 seconds, but prompt user by interval
+ specified in INI file */
+ mwTapeSettlingCount = CDS_GetTapeDriveSettlingTime ( CDS_GetPerm () ) / 3;
+
+ if ( CDS_GetTapeDriveName( CDS_GetPerm( ) ) ) {
+
+ CHAR DriveName[80] ;
+
+ strncpy( DriveName, (CHAR_PTR)CDS_GetTapeDriveName( CDS_GetPerm( ) ), 80 ) ;
+ DriveName[79] = '\0' ;
+ strlwr( DriveName ) ;
+ if( strstr( DriveName, TEXT( "cipher" ) ) != NULL ||
+ ( strstr( DriveName, TEXT( "dec" ) ) != NULL &&
+ ( strstr( DriveName, TEXT( "thz02" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz86" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz87" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2700" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2000" ) ) != NULL ) ) ) {
+ mwTapeSettlingCount *= 2 ;
+ }
+ }
+
+ tape_retries = 0 ;
+#endif
+
+ /* collect the target drives and paths for restore */
+ /* display the target restore dialog */
+ if ( DM_StartRestoreBackupSet() ) {
+
+ /* user canceled the operation */
+ mw_ret_val = ABORT_OPERATION;
+
+ } else {
+
+ /* display warning for corrupt file if found, exit if user requests */
+// this functionality has been removed.
+
+// if ( LogFileExists( CORRUPT_FILE ) ) {
+//
+// if ( ! WM_MessageBox( ID( IDS_MSGTITLE_CORRUPT ),
+// ID( RES_CORRUPT_RESTORE_WARNING ),
+// WMMB_YESNO,
+// WMMB_ICONQUESTION,
+// ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+//
+// mw_ret_val = ABORT_OPERATION;
+// }
+// }
+ }
+
+ if( mw_ret_val == SUCCESS ) {
+
+ do_restore_init();
+ do_restore_process();
+ if ( restored_active_flag ) {
+
+ WM_MsgBox( ID(IDS_APPNAME), ID(RES_ACTIVE_FILES_RESTORED),
+ WMMB_OK, WMMB_ICONINFORMATION ) ;
+ }
+ }
+
+ gbCurrentOperation = OPERATION_NONE;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_IDLE);
+ return( mw_ret_val );
+}
+
+
+/*****************************************************************************
+
+ Name: do_restore_init
+
+ Description: Initializes the text on the runtime dialog.
+
+ Returns: none.
+
+*****************************************************************************/
+
+VOID do_restore_init ( VOID )
+{
+ VLM_CloseAll();
+
+ // create the Runtime status dialog
+ JobStatusBackupRestore( JOB_STATUS_CREATE_DIALOG );
+
+ // display the restore title for the dialog
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATRESTORE );
+ JobStatusBackupRestore( JOB_STATUS_RESTORE_TITLE );
+
+ // display "Set information n of n "
+ JobStatusBackupRestore( JOB_STATUS_N_OF_N );
+
+ // display the volume tape bitmap
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_TAPE );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ // display the Restore status title in the list box
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATRESTORE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ // clear the number of bytes processed in the Runtime dialog
+ yprintf(TEXT("%d\r"),0 );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+
+ restored_active_flag = FALSE ;
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: do_restore_process
+
+ Description: Initializes and calls the restore engine. The verify
+ after operation is performed if needed.
+
+ Returns: none.
+
+ Notes: if error, mw_ret_val is set to ABNORMAL_TERMINATION
+
+*****************************************************************************/
+
+VOID do_restore_process( VOID )
+{
+ LIS lis;
+ BSD_PTR bsd_ptr;
+ INT16 ret_val;
+
+ UI_ExcludeInternalFiles( (INT16)mw_oper_type );
+
+ lis.curr_bsd_ptr = BSD_GetFirst( tape_bsd_list );
+ lis.tape_pos_handler = tpos_rout; /* set tape positioner to call */
+ lis.message_handler = msg_hndlr; /* set message handler to call */
+ lis.oper_type = (INT16)mw_oper_type; /* set operation type */
+ lis.abort_flag_ptr = &gb_abort_flag; /* set abort flag address */
+ lis.pid = 0L;
+ lis.auto_det_sdrv = FALSE;
+ lis.bsd_list = tape_bsd_list;
+ lis.vmem_hand = NULL ;
+
+ gb_last_operation = mw_oper_type;
+
+ LP_SetAbortFlag( &lis, CONTINUE_PROCESSING );
+
+ // pass the location of the abort flag to the Runtime status dialog
+ JobStatusAbort( lis.abort_flag_ptr );
+
+ /* enable the abort button for the runtime dialog */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE ) ;
+
+ TryToCreateFFRQueue( &lis, (INT16) RESTORE_OPER );
+
+ clock_ready_flag = FALSE; // Wait on bset to start
+
+ timer_handle = WM_HookTimer( clock_routine, 1 );
+
+ /* call restore engine */
+
+ PD_StopPolling();
+
+ mw_file_replace_ptr = (FILE_REPLACE_TEMP_PTR)malloc(sizeof(FILE_REPLACE_TEMP) );
+
+ ret_val = LP_Restore_Engine( &lis );
+
+ if ( ( ret_val != SUCCESS ) && ( ret_val != TFLE_UI_HAPPY_ABORT ) ) {
+ BSD_SetOperStatus( lis.curr_bsd_ptr, ABNORMAL_TERMINATION );
+ }
+
+ if(mw_file_replace_ptr) {
+ free(mw_file_replace_ptr);
+ }
+
+ PD_StartPolling();
+
+ WM_UnhookTimer( timer_handle );
+
+ /* set return value of success or failure of entire operation */
+
+ bsd_ptr = BSD_GetFirst( tape_bsd_list );
+
+ while( ( bsd_ptr != NULL ) && !mw_ret_val ) {
+
+ mw_ret_val = BSD_GetOperStatus( bsd_ptr );
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ /* Set up for verify after if necessary */
+
+ if ( (mw_ret_val == ABNORMAL_TERMINATION) ||
+ (ret_val == TFLE_UI_HAPPY_ABORT) ) {
+
+ /* Don't even bother with verify on an error or happy abort */
+ CDS_SetAutoVerifyRestore( CDS_GetCopy(), NO_VERIFY_AFTER );
+
+ if ( mw_ret_val == SUCCESS ) {
+ mw_ret_val = ret_val;
+ }
+
+ } else if ( CDS_GetAutoVerifyRestore( CDS_GetCopy() ) == PROMPT_VERIFY_AFTER ) {
+
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_VERIFY ),
+ ID( RES_PROMPT_VERIFY_RESTORE ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION, NULL, 0, 0 ) ) {
+
+ CDS_SetAutoVerifyRestore( CDS_GetCopy(), DO_VERIFY_AFTER );
+ }
+ else {
+ CDS_SetAutoVerifyRestore( CDS_GetCopy(), NO_VERIFY_AFTER );
+ }
+ }
+
+ /* This call will disable the Runtime Abort button and */
+ /* enable the OK button */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_OFF );
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: tpos_rout
+
+ Description: Tape positioning routine for Tape Restore functions called
+ from Tape Format
+
+ Returns:
+
+*****************************************************************************/
+static UINT16 tpos_rout(
+UINT16 message,
+TPOS_PTR tpos,
+BOOLEAN curr_vcb_valid,
+DBLK_PTR cur_vcb,
+UINT16 mode )
+{
+ UINT16 response = UI_ACKNOWLEDGED;
+ LIS_PTR lis_ptr = (LIS_PTR)tpos->reference;
+ BSD_PTR bsd_ptr = (BSD_PTR)lis_ptr->curr_bsd_ptr;
+ CHAR_PTR drive_name;
+ CHAR_PTR tape_name;
+ GENERIC_DLE_PTR dle_ptr = BSD_GetDLE( bsd_ptr );
+
+ /* get a pointer to the name of the current tape device */
+ drive_name = BE_GetCurrentDeviceName( tpos->channel );
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+ /* Check for user abort */
+ if( UI_CheckUserAbort( message ) ) {
+ return UI_ABORT_POSITIONING ;
+ }
+
+ /* if we are positioned at the requested set, but on an uncataloged tape,
+ we want to dialog the user so make adjustments */
+
+ switch( message ) {
+
+ case TF_IDLE_NOBREAK:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ WM_MultiTask() ;
+ break;
+
+
+ case TF_IDLE:
+ case TF_SKIPPING_DATA:
+ case TF_MOUNTING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ case TF_REQUESTED_VCB_FOUND:
+ case TF_VCB_BOT:
+ case TF_POSITIONED_AT_A_VCB:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ mw_rewind = TRUE;
+ /* first check for read continuation */
+ if ( mode == TF_READ_CONTINUE ) {
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+ break;
+ }
+
+ if ( message == TF_VCB_BOT ) {
+ if( FS_ViewTSNumInVCB( cur_vcb ) > 1 ) {
+ yresprintf( (INT16) RES_OUT_OF_SEQUENCE_WARNING,
+ FS_ViewTSNumInVCB( cur_vcb ) );
+ if ( ! WM_MessageBox( ID( IDS_MSGTITLE_CONTINUE ),
+ gszTprintfBuffer,
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+ response = UI_ReplaceTape( drive_name );
+#ifdef OS_WIN32
+ tape_retries = mwTapeSettlingCount ;
+#endif
+ break;
+ }
+ }
+ }
+
+ /* otherwise, display backup set info */
+ UI_DisplayVCB( cur_vcb );
+
+ /* have user validate tape password if necessary */
+ if( UI_CheckOldTapePassword( cur_vcb ) == UI_ABORT_POSITIONING ) {
+ response = UI_HAPPY_ABORT;
+ break;
+ }
+
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+
+ break;
+
+ case TF_ACCIDENTAL_VCB:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ mw_rewind = TRUE;
+ UI_DisplayVCB( cur_vcb );
+
+ break;
+
+ case TF_VCB_EOD:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ mw_rewind = TRUE;
+ response = UI_ProcessVCBatEOD( tpos, drive_name );
+ break;
+
+ case TF_NEED_NEW_TAPE:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ mw_rewind = TRUE;
+ tape_name = UI_DisplayableTapeName( (CHAR_PTR)FS_ViewTapeNameInVCB( cur_vcb ),
+ FS_ViewBackupDateInVCB( cur_vcb ) );
+ response = PromptNextTape( tpos, cur_vcb, curr_vcb_valid,
+ mode, tape_name, drive_name );
+ break;
+
+ case TF_UNRECOGNIZED_MEDIA:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN);
+
+ mw_rewind = TRUE;
+ yresprintf( (INT16) IDS_VLMUNFORMATEDTEXT ) ;
+ WM_MessageBox( ID( IDS_VLMUNFORMATEDTITLE ) ,
+ gszTprintfBuffer ,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 ) ;
+
+ response = PromptNextTape( tpos, cur_vcb, curr_vcb_valid,
+ mode, NULL, drive_name );
+ break;
+
+ case TF_NO_TAPE_PRESENT:
+#ifdef OS_WIN32
+ if( tape_retries ){
+ Sleep( 3000 ) ;
+ response = UI_NEW_TAPE_INSERTED ;
+ --tape_retries ;
+ break ;
+ }
+ // NOTE: fall thru on implied else or !ifdef OS_WIN32
+#endif
+
+ case TF_EMPTY_TAPE:
+ case TF_INVALID_VCB:
+ case TF_WRONG_TAPE:
+ case TF_FUTURE_REV_MTF:
+ case TF_MTF_ECC_TAPE:
+ case TF_SQL_TAPE:
+ case TF_TAPE_OUT_OF_ORDER:
+
+ mw_rewind = TRUE;
+
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_EMPTY);
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+
+ tape_name = UI_DisplayableTapeName( (LPSTR)BSD_GetTapeLabel( bsd_ptr ),
+ BSD_ViewDate( bsd_ptr ) );
+ response = PromptNextTape( tpos, cur_vcb, curr_vcb_valid,
+ mode, tape_name, drive_name );
+ break;
+
+ case TF_NO_MORE_DATA:
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_EMPTY);
+ mw_rewind = TRUE;
+ yresprintf( (INT16) RES_NO_MORE_TAPE_INFO );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ response = UI_HAPPY_ABORT;
+ break;
+
+ case TF_READ_ERROR:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ mw_rewind = TRUE;
+ response = UI_HandleTapeReadError( drive_name );
+ break;
+
+ case TF_SEARCHING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ mw_rewind = TRUE;
+ yresprintf( (INT16) RES_SEARCHING );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ break;
+
+ case TF_REWINDING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ if ( mw_rewind ) {
+ mw_rewind = FALSE;
+ yresprintf( (INT16) RES_REWINDING );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+ break;
+
+ case TF_DRIVE_BUSY:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_BUSY);
+ mw_rewind = TRUE;
+ yresprintf( (INT16) RES_WAITING );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ break;
+
+ default:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ mw_rewind = TRUE;
+ eresprintf( RES_UNKNOWN_TF_MSG, message );
+ response = UI_ABORT_POSITIONING;
+ break;
+ }
+ return response;
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID clock_routine( VOID )
+{
+ INT16 num_hours, num_min, num_seconds;
+ UINT64 num_bytes;
+ CHAR numeral[ 40 ];
+ BOOLEAN stat ;
+ static UINT64 total_bytes;
+
+ if ( clock_ready_flag && ( ST_BSIdleLevel( &op_stats ) == 0 ) ) {
+
+ num_bytes = ST_GetBSBytesProcessed ( &op_stats );
+
+ if ( !U64_EQ( num_bytes, total_bytes ) ) {
+ total_bytes = num_bytes;
+ U64_Litoa( num_bytes, numeral, (INT16) 10, &stat ) ;
+ UI_BuildNumeralWithCommas( numeral );
+ yprintf(TEXT("%s\r"),numeral );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+ }
+ WM_AnimateAppIcon ( IDM_OPERATIONSRESTORE, FALSE );
+
+ ST_EndBackupSet( &op_stats );
+
+ SetStatusBlock(IDSM_FILECOUNT, ST_GetBSFilesProcessed( &op_stats ));
+ SetStatusBlock(IDSM_DIRCOUNT, ST_GetBSDirsProcessed( &op_stats ));
+ SetStatusBlock(IDSM_CORRUPTFILECOUNT, ST_GetBSFilesBad( &op_stats ));
+ SetStatusBlock(IDSM_SKIPPEDFILECOUNT, ST_GetBSFilesSkipped( &op_stats ));
+ SetStatusBlock(IDSM_BYTECOUNTLO, U64_Lsw(num_bytes));
+ SetStatusBlock(IDSM_BYTECOUNTHI, U64_Msw(num_bytes));
+ SetStatusBlock(IDSM_ELAPSEDSECONDS, (ST_GetBSEndTime( &op_stats ) -
+ ST_GetBSStartTime( &op_stats ) -
+ op_stats.bs_stats.bs_total_idle));
+
+ num_hours = ST_GetBSElapsedHours( &op_stats );
+ num_min = ST_GetBSElapsedMinutes( &op_stats );
+ num_seconds = ST_GetBSElapsedSeconds( &op_stats );
+
+ if ( num_hours ) {
+
+ yprintf( TEXT("%d%c%2.2d%c%2.2d\r"), num_hours, UI_GetTimeSeparator(),
+ num_min, UI_GetTimeSeparator(), num_seconds );
+
+
+ }
+ else {
+
+ yprintf( TEXT("%2.2d%c%2.2d\r"), num_min, UI_GetTimeSeparator(), num_seconds );
+
+ }
+
+ JobStatusBackupRestore( JOB_STATUS_ELAPSED_TIME );
+ }
+}
+
+/*****************************************************************************
+
+ Name: msg_hndlr
+
+ Description: Message handler for Tape Restore functions
+
+ Returns:
+
+*****************************************************************************/
+static INT16 msg_hndlr(
+UINT16 msg,
+INT32 pid,
+BSD_PTR bsd_ptr,
+FSYS_HAND fsh,
+TPOS_PTR tpos,
+... )
+{
+ static BOOLEAN ems_db_stopping = FALSE ;
+ static CHAR delimiter = TEXT('#'); /* = # for debug */
+ static INT8 recover_seq = 0; /* sequence number used for tape read error recovery */
+ INT16 response = MSG_ACK;
+ va_list arg_ptr;
+ static UINT16 OS_id;
+ static UINT16 OS_ver;
+ GENERIC_DLE_PTR dle;
+ static CHAR_PTR buffer = NULL;
+ CHAR_PTR buffer1;
+ static CHAR_PTR buffer2 = NULL;
+ static CHAR_PTR path = NULL;
+ static CHAR_PTR last_file = NULL ;
+ INT16 res_id;
+ UINT64 num_bytes;
+ BOOLEAN stat ;
+ CHAR numeral[ UI_MAX_NUMERAL_LENGTH ];
+ CDS_PTR cds_ptr;
+ WORD restore_existing_files_flag;
+ DATE_TIME tape_date;
+ DATE_TIME_PTR tape_date_ptr;
+ DATE_TIME disk_date;
+ DATE_TIME_PTR disk_date_ptr;
+ BE_CFG_PTR be_cfg_ptr;
+ CHAR_PTR p;
+ BOOLEAN stat64;
+ static INT path_length;
+ static INT root_counted;
+ CHAR date_str1[40] ;
+ CHAR date_str2[40] ;
+
+ /* for future use */
+
+ pid;
+
+ /* set up first argument */
+ va_start( arg_ptr, tpos );
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+ switch ( (INT16)msg ) {
+
+// You know it !
+// We are talking kludge city here. Keep the error
+// message from being displayed to the user.
+
+#ifdef MS_RELEASE
+ case -533:
+ zprintf( DEBUG_TEMPORARY, TEXT("** -533 LOOPS ERROR **") );
+ break;
+#endif
+
+ /* logging messages */
+ case MSG_LOG_STREAM_NAME:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ buffer1 = va_arg( arg_ptr, CHAR_PTR );
+
+ lresprintf( LOGGING_FILE, LOG_STREAM, fsh, buffer1 );
+
+ break;
+
+ case MSG_LOG_BLOCK:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ dle = BSD_GetDLE( bsd_ptr ) ;
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ if ( ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) && ems_db_stopping ) {
+ ems_db_stopping = FALSE ;
+ yresprintf( IDS_RESTOREBEGINEXCHANGE ) ;
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+ /* clear last displayed filename from status display */
+ UI_DisplayFile( TEXT("") );
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+
+ if ( DLE_GetDeviceType(BSD_GetDLE( bsd_ptr) ) == FS_EMS_DRV ) {
+ yprintf( TEXT("%s"), buffer+1 );
+ } else {
+ yprintf( TEXT("%s"), buffer );
+ }
+
+ if ( buffer ) { // chs:02-08-93
+ strcpy(mwCurrentPath, buffer ) ; // chs:02-08-93
+ strcpy( mwCurrentFile, TEXT("")) ; // chs:02-08-93
+ } // chs:02-08-93
+ SetStatusBlock(IDSM_OFFSETACTIVEDIR, (LONG)(LPSTR)mwCurrentPath);
+ if ( mw_file_replace_ptr ) {
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, TRUE );
+ strcpy( mw_file_replace_ptr->source_path, buffer ) ;
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ strcpy( mw_file_replace_ptr->destination_path, buffer ) ;
+ }
+
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORY_NAMES );
+
+ ST_EndBackupSet( &op_stats );
+
+ // build the full path with no "..." inserted
+ UI_BuildFullPathFromDDB2( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+
+ dle = BSD_GetDLE( bsd_ptr );
+
+ if ( ( DLE_GetDeviceType(dle) != FS_EMS_DRV ) && dle->device_name_leng ) {
+ buffer1 = (CHAR_PTR)calloc( 1, ( strlen( buffer ) * sizeof( CHAR ) ) + ( ( dle->device_name_leng ) * sizeof( CHAR ) ) + sizeof( CHAR ) );
+ if ( buffer1 ) {
+ strcpy( buffer1, dle->device_name );
+ strcat( buffer1, buffer );
+
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer1 );
+ free( buffer1 );
+ } else {
+
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer );
+ }
+ } else if ( DLE_GetDeviceType(dle) != FS_EMS_DRV ) {
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer );
+ }
+
+ break;
+
+ case BT_FDB:
+ ST_SetCFSize( &op_stats, FS_GetDisplaySizeFromDBLK( fsh, dblk_ptr ) ); // chs:02-08-93
+ ST_SetCFDone( &op_stats, U64_Init( 0L, 0L ) ); // chs:02-08-93
+
+ if ( UI_AllocPathBuffer( &last_file, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, last_file );
+
+ // copy the full file name for the Log file
+ yprintf( TEXT("%s"), buffer );
+ lresprintf( LOGGING_FILE, LOG_FILE, fsh, dblk_ptr );
+
+ strcpy( mwCurrentFile, last_file ); // chs: 02-08-93
+ if ( CDS_GetFilesFlag( CDS_GetCopy() ) ) {
+
+ SetStatusBlock(IDSM_OFFSETACTIVEFILE, (DWORD)last_file );
+
+ // truncate the file name, if needed, for Runtime display
+ UI_DisplayFile( last_file );
+ JobStatusBackupRestore( JOB_STATUS_FILE_NAMES );
+ }
+ }
+ break;
+
+ case BT_CFDB:
+ ST_AddBSFilesBad( &op_stats, 1 );
+ yresprintf( (INT16) RES_RESTORED_CORRUPT_WARNING, last_file );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RESTORED_CORRUPT_WARNING, buffer );
+ break;
+
+ }
+ }
+ break;
+
+ /* statistics messages */
+ case MSG_BLOCK_PROCESSED:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ OBJECT_TYPE object_type;
+ INT item_size;
+ INT i;
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ switch ( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+
+ // Count all the new directories that showed up in
+ // this DDB.
+
+ // Only count the root once.
+
+ if ( ! root_counted ) {
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ root_counted = TRUE;
+ }
+
+ // Get the new path from the DDB.
+
+ item_size = FS_SizeofOSPathInDDB( fsh, dblk_ptr );
+ if ( UI_AllocPathBuffer( &buffer, (UINT16) item_size ) ) {
+ FS_GetOSPathFromDDB( fsh, dblk_ptr, buffer );
+
+ if ( item_size != sizeof(CHAR) ) {
+
+ i = 0;
+ while ( (INT)(i * sizeof(CHAR)) < item_size ) {
+
+ if ( i >= (INT)(path_length/sizeof(CHAR)) ) {
+
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ }
+ else {
+
+ if ( ( path == NULL ) || stricmp( &buffer[ i ], &path[ i ] ) ) {
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ path_length = 0;
+ }
+ }
+ while ( buffer[ i++ ] );
+ }
+ }
+ }
+ // Set up for next time.
+
+ if ( buffer && UI_AllocPathBuffer( &path, (UINT16) item_size ) ) {
+ memcpy( path, buffer, item_size );
+ path_length = item_size;
+
+ yprintf(TEXT("%ld\r"),ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORIES_PROCESS );
+ }
+ break;
+
+ case BT_FDB:
+
+ // Lines added to complete restoring a file // chs:02-05-93
+ // fully when aborted by user. // chs:02-05-93
+ // // chs:02-05-93
+ // Should we stop at the end of this file. // chs:02-05-93
+ // // chs:02-05-93
+ // chs:02-05-93
+ if ( gbAbortAtEOF ) { // chs:02-05-93
+ gb_abort_flag = ABORT_PROCESSED; // chs:02-05-93
+ } // chs:02-05-93
+ // chs:02-05-93
+ // // chs:02-05-93
+ // // chs:02-05-93
+ // // chs:02-05-93
+
+ strcpy( mwCurrentFile, TEXT( "" ) ) ; // chs:02-08-93
+ ST_SetCFSize( &op_stats, U64_Init( 0L, 0L ) ); // chs:02-08-93
+ ST_SetCFDone( &op_stats, U64_Init( 0L, 0L ) ); // chs:02-08-93
+
+
+ ST_AddBSFilesProcessed( &op_stats, 1 );
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+
+ if( object_type == AFP_OBJECT ) {
+
+ ST_AddBSAFPFilesProcessed( &op_stats, 1 );
+ }
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_FILES_PROCESSED );
+
+ break;
+
+ case BT_IDB:
+ break;
+ }
+ }
+ break;
+
+ case MSG_BYTES_PROCESSED:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ {
+ UINT64 count = va_arg( arg_ptr, UINT64 );
+
+ ST_AddBSBytesProcessed( &op_stats, count );
+ ST_AddCFDone( &op_stats, count ); // chs:02-08-93
+ }
+
+ ST_EndBackupSet( &op_stats );
+
+ break;
+
+ case MSG_BLOCK_SKIPPED:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+ ST_AddBSDirsSkipped( &op_stats, 1 );
+ break;
+
+ case BT_FDB:
+ if ( gbAbortAtEOF ) { // CRS:04-15-93
+ gb_abort_flag = ABORT_PROCESSED; // CRS:04-15-93
+ } // CRS:04-15-93
+ ST_AddBSFilesSkipped( &op_stats, 1 );
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesSkipped( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_SKIPPED_FILES );
+ break;
+ }
+ }
+ break;
+
+ case MSG_BYTES_SKIPPED:
+ {
+ UINT64 count = va_arg( arg_ptr, UINT64 );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ ST_AddBSBytesSkipped( &op_stats, count ) ;
+ }
+ break;
+
+ case MSG_IN_USE:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ ST_AddBSInUseFilesProcessed( &op_stats, 1 );
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ yresprintf( (INT16) RES_RESTORED_IN_USE_WARNING, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RESTORED_IN_USE_WARNING, buffer );
+ }
+ }
+ break;
+
+ case MSG_TBE_ERROR:
+ {
+ INT16 error = va_arg( arg_ptr, INT16 );
+ DBLK_PTR ddb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ UINT32 strm_id = va_arg( arg_ptr, UINT32 ) ;
+
+ OBJECT_TYPE object_type;
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+ dle = BSD_GetDLE( bsd_ptr );
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ if ( strm_id != 0L ) {
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+ yresprintf( (INT16) RES_RESTOREWRITEERROR, DLE_GetDeviceName( dle ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RESTOREWRITEERROR, DLE_GetDeviceName( dle ) );
+
+ } else {
+
+ JS_ReportStreamError( fsh, dle, strm_id, OPERATION_RESTORE, error, ddb_dblk_ptr, dblk_ptr ) ;
+ }
+
+ } else {
+
+ switch( error ) {
+
+ case LP_CHANGE_DIRECTORY_ERROR:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+ if ( FS_GetBlockType( dblk_ptr ) == BT_FDB ) {
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+ if ( object_type == AFP_OBJECT ) {
+ yresprintf( (INT16) RES_ERROR_RESTORING_AFP_FILE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_AFP_FILE, buffer );
+ }
+ else {
+ yresprintf( (INT16) RES_ERROR_RESTORING_FILE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_FILE, buffer );
+ }
+ }
+ }
+ else if( FS_GetBlockType( dblk_ptr ) == BT_DDB ) {
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ if ( buffer != NULL ) {
+ yresprintf( (INT16) RES_ERROR_RESTORING_DIR, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_DIR, buffer );
+ }
+ }
+ break;
+
+ case FS_EMS_NO_PUBLIC:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ yresprintf( (INT16) IDS_EMS_NO_PUBLIC_SERVICE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_EMS_NO_PUBLIC_SERVICE );
+ break ;
+
+ case FS_EMS_NO_PRIVATE:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ yresprintf( (INT16) IDS_EMS_NO_PRIVATE_SERVICE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_EMS_NO_PUBLIC_SERVICE );
+ break ;
+
+ case LP_ACCESS_DENIED_ERROR:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ if ( strm_id != 0L ) {
+ JS_ReportStreamError( fsh,
+ dle,
+ strm_id,
+ OPERATION_RESTORE,
+ error,
+ ddb_dblk_ptr,
+ dblk_ptr ) ;
+ }
+
+ if ( FS_GetBlockType( dblk_ptr ) == BT_FDB ) {
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ yresprintf( (INT16) RES_INSUFFICIENT_PRIVILEGE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_INSUFFICIENT_PRIVILEGE, buffer );
+ }
+ }
+ else if( FS_GetBlockType( dblk_ptr ) == BT_DDB ) {
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ if ( buffer != NULL ) {
+ yresprintf( (INT16) RES_ERROR_RESTORING_DIR, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_DIR, buffer );
+ }
+ }
+ break;
+
+ case LP_FILE_CREATION_ERROR:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ if( FS_GetBlockType( dblk_ptr ) == BT_FDB ) {
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ yresprintf( (INT16) RES_ERROR_CREATING_FILE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_CREATING_FILE, buffer );
+ }
+ }
+ else if( FS_GetBlockType( dblk_ptr ) == BT_DDB ) {
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ if ( buffer != NULL ) {
+ yresprintf( (INT16) RES_ERROR_CREATING_DIR, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_CREATING_DIR, buffer );
+ }
+ }
+ break;
+
+ case LP_OUT_OF_SPACE_ERROR:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ yresprintf( (INT16) RES_INSUFFICIENT_DISK_SPACE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_INSUFFICIENT_DISK_SPACE );
+
+ /* falling through */
+
+ case FS_COMPRES_RESET_FAIL:
+ case LP_FILE_WRITE_ERROR:
+ case LP_FILE_OPEN_ERROR:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+ break ;
+ }
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+ case BT_FDB :
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+ if ( error == FS_COMPRES_RESET_FAIL ) {
+ yresprintf( (INT16) RES_ERROR_COMPRESS_FILE_FAIL, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_AFP_FILE, buffer );
+
+ } else if( object_type == AFP_OBJECT ) {
+ yresprintf( (INT16) RES_ERROR_RESTORING_AFP_FILE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_AFP_FILE, buffer );
+ }
+ else {
+ yresprintf( (INT16) RES_ERROR_RESTORING_FILE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_FILE, buffer );
+ }
+ }
+ break;
+
+ case BT_DDB :
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ if ( buffer != NULL ) {
+ res_id = (INT16) ( ( error == LP_FILE_OPEN_ERROR ) ? RES_ERROR_RESTORING_DIR
+ : RES_ERROR_RESTORING_TRUSTEE_SEC );
+ if ( error == FS_COMPRES_RESET_FAIL ) {
+ res_id = RES_ERROR_COMPRESS_FILE_FAIL ;
+ }
+ yresprintf( res_id, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id, buffer );
+ }
+ break;
+
+ }
+ break;
+
+ case LP_PRIVILEGE_ERROR:
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+ yresprintf( (INT16) RES_RESTOREWRITEERROR, DLE_GetDeviceName( dle ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RESTOREWRITEERROR, DLE_GetDeviceName( dle ) );
+
+ } else if( FS_GetBlockType( dblk_ptr ) == BT_FDB ) {
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ yresprintf( (INT16) RES_ERROR_RESTORING_FILE_SEC, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_FILE_SEC, buffer );
+ }
+ }
+ else if( FS_GetBlockType( dblk_ptr ) == BT_DDB ) {
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ if ( buffer != NULL ) {
+ yresprintf( (INT16) RES_ERROR_RESTORING_DIR_SEC, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_DIR_SEC, buffer );
+ }
+ }
+ break;
+
+ case LP_FILE_IN_USE_ERROR:
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+ if( object_type == AFP_OBJECT ) {
+ yresprintf( (INT16) RES_ERROR_RESTORING_AFP_FILE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_AFP_FILE, buffer );
+ }
+ else {
+ yresprintf( (INT16) RES_ERROR_RESTORING_FILE, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ERROR_RESTORING_FILE, buffer );
+ }
+ }
+ break;
+
+ default:
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+ if ( ( error == FS_DEVICE_ERROR ) || ( error == FS_COMM_FAILURE ) ) {
+ mwErrorDuringBackupSet = TRUE;
+ gb_error_during_operation = TRUE;
+ yresprintf( (INT16) RES_RESTOREWRITEERROR, DLE_GetDeviceName( dle ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RESTOREWRITEERROR, DLE_GetDeviceName( dle ) );
+ break ;
+ }
+ }
+
+ UI_ProcessErrorCode( error, &response, tpos->channel );
+ break;
+ }
+ }
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ }
+ break;
+
+ /* general messages */
+ case MSG_START_OPERATION:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ lresprintf( LOGGING_FILE, LOG_START, FALSE );
+
+ /* display operation title in log file */
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_DLGTITLEJOBSTATRESTORE ) ;
+
+ break;
+
+ case MSG_END_OPERATION:
+ {
+ BSD_PTR bsd_ptr ;
+ GENERIC_DLE_PTR dle_ptr ;
+ BE_CFG_PTR cfg;
+
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* first lets clear the kick bit on all but the last bsd for each dest */
+ bsd_ptr = BSD_GetFirst( tape_bsd_list );
+ while (bsd_ptr ) {
+ CHAR_PTR dest_name ;
+ CHAR_PTR dest_name1 ;
+ BSD_PTR temp_bsd ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ dest_name = BSD_GetVolumeLabel( bsd_ptr ) ;
+ if ( BSD_GetOsId( bsd_ptr ) == FS_EMS_MDB_ID ) {
+ dest_name = BSD_GetLogicalSourceDevice( bsd_ptr ) ;
+ }
+ temp_bsd = BSD_GetNext(bsd_ptr) ;
+ while( temp_bsd ) {
+
+ dest_name1 = BSD_GetVolumeLabel( temp_bsd ) ;
+ if ( BSD_GetOsId( temp_bsd ) == FS_EMS_MDB_ID ) {
+ dest_name1 = BSD_GetLogicalSourceDevice( temp_bsd ) ;
+ }
+
+ if ( dest_name1 && dest_name &&
+ !strcmp( dest_name1, dest_name) ) {
+
+ if ( BEC_GetEmsRipKick(cfg) ) {
+
+ BEC_SetEmsRipKick( BSD_GetConfigData( bsd_ptr ) , FALSE ) ;
+ BEC_SetEmsRipKick( BSD_GetConfigData( temp_bsd ) , TRUE ) ;
+ break ;
+ }
+ }
+ temp_bsd = BSD_GetNext( temp_bsd ) ;
+ }
+
+ bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+ }
+
+
+ /* lets go through the BSDs again and call end oper on all the dles */
+
+ bsd_ptr = BSD_GetFirst( tape_bsd_list );
+
+ while ( (gb_abort_flag == CONTINUE_PROCESSING) && bsd_ptr ) {
+ FSYS_HAND fsh ;
+ INT16 return_status ;
+
+ dle_ptr = BSD_GetDLE( bsd_ptr ) ;
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ return_status = FS_AttachToDLE( &fsh, dle_ptr, cfg, NULL, NULL ) ;
+
+ if (!return_status ) {
+
+ if (BEC_GetEmsRipKick( cfg ) ) {
+ yresprintf( IDS_RESTORESTARTEXCHANGE, DLE_GetDeviceName(DLE_GetParent(dle_ptr)) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+
+ FS_EndOperationOnDLE( fsh ) ;
+ FS_DetachDLE( fsh ) ;
+ }
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+
+ }
+ }
+
+ UI_FreePathBuffer( &buffer ) ;
+ UI_FreePathBuffer( &buffer2 ) ;
+ UI_FreePathBuffer( &path ) ;
+ UI_FreePathBuffer( &last_file ) ;
+
+ lresprintf( LOGGING_FILE, LOG_END );
+
+ /* force an update to the bytes counter */
+ num_bytes = ST_GetBSBytesProcessed ( &op_stats );
+
+ U64_Litoa( num_bytes, numeral, (INT16) 10, &stat );
+ UI_BuildNumeralWithCommas( numeral );
+ yprintf(TEXT("%s\r"),numeral );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+
+ UI_ChkDispGlobalError( );
+ break;
+
+ case MSG_START_BACKUP_SET:
+ {
+ CHAR szVolName[MAX_UI_FILENAME_LEN];
+ DBLK_PTR vcb_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_RESTORE);
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ path_length = 0;
+ UI_FreePathBuffer( &path ) ;
+
+ root_counted = FALSE;
+
+ FS_GetOSid_verFromVCB( vcb_ptr, &OS_id, &OS_ver );
+
+ BSD_SetOperStatus( bsd_ptr, SUCCESS );
+
+ dle = BSD_GetDLE( bsd_ptr );
+
+#ifdef OEM_EMS
+ RT_BSD_OsId = DLE_GetOsId( dle );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_FS_TYPE );
+#endif OEM_EMS
+
+ strcpy( mwCurrentDrive, DLE_GetDeviceName( dle ) ) ; // chs:02-08-93
+ mwCurrentPath[0] = TEXT( '\0' ); // chs:02-08-93
+ mwCurrentFile[0] = TEXT( '\0' ); // chs:02-08-93
+
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)FS_ViewTapeIDInVCB( vcb_ptr ) );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)FS_ViewTSNumInVCB( vcb_ptr ) );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)FS_ViewBSNumInVCB( vcb_ptr ) );
+
+ SetStatusBlock( IDSM_OFFSETCURRENTTAPENAME, (DWORD)FS_ViewTapeNameInVCB( vcb_ptr ) );
+ SetStatusBlock( IDSM_OFFSETDISKNAME, (DWORD)FS_ViewVolNameInVCB( vcb_ptr ) );
+
+ if ( DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_NETDRIVE );
+ }
+ else {
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_HARDDRIVE );
+ }
+
+ DLE_GetVolName( dle, szVolName );
+
+ yprintf(TEXT("%s"),BSD_GetTapeLabel( bsd_ptr ));
+ JobStatusBackupRestore( JOB_STATUS_SOURCE_NAME );
+
+ yprintf(TEXT("%s"), szVolName );
+ JobStatusBackupRestore( JOB_STATUS_DEST_NAME );
+
+ strcpy( mw_file_replace_ptr->destination_volume, DLE_GetDeviceName( dle ) );
+
+ UI_DisplayBSDVCB( bsd_ptr );
+
+ delimiter = (CHAR)DLE_GetPathDelim( dle );
+
+ ST_StartBackupSet( &op_stats );
+
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+ lresprintf( LOGGING_FILE, LOG_MSG,
+ SES_ENG_MSG,
+ RES_UNFORMATED_STRING,
+ DLE_GetDeviceName(dle) );
+
+ yresprintf( RES_UNFORMATED_STRING, DLE_GetDeviceName(dle) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+
+ UI_Time( &op_stats, RES_RESTORE_STARTED, UI_START );
+
+ clock_ready_flag = TRUE;
+
+#if defined ( OS_WIN32 ) //special feature-EventLogging
+ cds_ptr = CDS_GetCopy();
+ mwErrorDuringBackupSet = FALSE;
+
+ OMEVENT_LogBeginRestore( szVolName,
+ (INT16)(CDS_GetAutoVerifyBackup(cds_ptr) == 0 ? 1 : 0));
+#endif //defined ( OS_WIN32 ) //special feature-EventLogging
+
+ if ( DLE_GetDeviceType(dle) == FS_EMS_DRV ) {
+ ems_db_stopping = TRUE ;
+ if ( BEC_GetEmsWipeClean( BSD_GetConfigData( bsd_ptr ) ) ) {
+ yresprintf( IDS_WIPE_SPECIFIED ) ;
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_WIPE_SPECIFIED ) ;
+ }
+
+ yresprintf( IDS_RESTORESTOPEXCHANGE ) ;
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+
+ }
+ break;
+
+ case MSG_END_BACKUP_SET:
+ {
+ INT16 res_id;
+
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_IDLE);
+
+ // update stats
+ clock_routine();
+
+ mwCurrentPath[0] = TEXT( '\0' ); // chs: 02-08-93
+ mwCurrentFile[0] = TEXT( '\0' ); // chs: 02-08-93
+
+ ST_EndBackupSet( &op_stats );
+
+ /* set backup set operation status to FILES_SKIPPED if necessary */
+ if ( ST_GetBSFilesBad( &op_stats ) ||
+ ST_GetBSDirsBad( &op_stats ) ||
+ ST_GetBSFilesSkipped( &op_stats ) ||
+ ST_GetBSDirsSkipped( &op_stats ) ) {
+
+ BSD_SetOperStatus( bsd_ptr, FILES_SKIPPED );
+ }
+
+ clock_ready_flag = FALSE;
+
+ /* clear last displayed filename */
+ UI_ClearLastDisplayedFile( );
+
+ /* display and log any abort conditions */
+ UI_ConditionAtEnd( );
+
+ UI_Time( &op_stats, RES_RESTORE_COMPLETED, UI_END );
+
+ SetStatusBlock(IDSM_DIRCOUNT, (DWORD)0 );
+ SetStatusBlock(IDSM_FILECOUNT, (DWORD)0 );
+ SetStatusBlock(IDSM_BYTECOUNTLO, (DWORD)0 );
+ SetStatusBlock(IDSM_BYTECOUNTHI, (DWORD)0 );
+ SetStatusBlock(IDSM_ELAPSEDSECONDS, (DWORD)0 );
+ SetStatusBlock(IDSM_CORRUPTFILECOUNT, (DWORD)0 );
+ SetStatusBlock(IDSM_SKIPPEDFILECOUNT, (DWORD)0 );
+
+ SetStatusBlock(IDSM_OFFSETACTIVEFILE, (DWORD)TEXT( "" ) );
+ SetStatusBlock(IDSM_OFFSETACTIVEDIR, (DWORD)TEXT("" ) );
+ SetStatusBlock(IDSM_OFFSETDISKNAME, (DWORD)TEXT("" ) );
+
+ /* display number of files / number of dirs */
+ if( ST_GetBSFilesProcessed( &op_stats ) <= 1 && ST_GetBSDirsProcessed( &op_stats ) <= 1 ) { // chs:02-11-93
+ res_id = RES_RESTORED_DIR_FILE; // chs:02-11-93
+ } // chs:02-11-93
+ else if( ST_GetBSFilesProcessed( &op_stats ) <= 1 && ST_GetBSDirsProcessed( &op_stats ) > 1 ) { // chs:02-11-93
+ res_id = RES_RESTORED_DIRS_FILE; // chs:02-11-93
+ } // chs:02-11-93
+ else if( ST_GetBSFilesProcessed( &op_stats ) > 1 && ST_GetBSDirsProcessed( &op_stats ) > 1 ) { // chs:02-11-93
+ res_id = RES_RESTORED_DIRS_FILES; // chs:02-11-93
+ } else { // chs:02-11-93
+ res_id = RES_RESTORED_DIR_FILES; // chs:02-11-93
+ } // chs:02-11-93
+
+// chs:02-11-93 if( ST_GetBSFilesProcessed( &op_stats ) == 1 ) {
+// chs:02-11-93 res_id = RES_RESTORED_DIR_FILE;
+// chs:02-11-93 }
+// chs:02-11-93 else if( ST_GetBSDirsProcessed( &op_stats ) == 1 ) {
+// chs:02-11-93 res_id = RES_RESTORED_DIR_FILES;
+// chs:02-11-93 }
+// chs:02-11-93 else {
+// chs:02-11-93 res_id = RES_RESTORED_DIRS_FILES;
+// chs:02-11-93 }
+
+ dle = BSD_GetDLE( bsd_ptr );
+ if ( DLE_GetDeviceType( dle ) != FS_EMS_DRV ) {
+ yresprintf( res_id,
+ ST_GetBSFilesProcessed( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSFilesProcessed( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+ }
+
+ /* display number of mac files restored */
+ if ( ST_GetBSAFPFilesProcessed( &op_stats ) > 0 ) {
+
+ if ( ST_GetBSAFPFilesProcessed( &op_stats ) == 1 ) {
+ res_id = RES_RESTORED_MAC;
+ }
+ else {
+ res_id = RES_RESTORED_MACS;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+
+ }
+
+ /* display number of corrupt files */
+ if ( ST_GetBSFilesBad( &op_stats ) > 0 ) {
+
+ if ( ST_GetBSFilesBad( &op_stats ) == 1 ) {
+ res_id = RES_RESTORED_CORRUPT;
+ }
+ else {
+ res_id = RES_RESTORED_CORRUPTS;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSFilesBad( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSFilesBad( &op_stats ) );
+ }
+
+ /* display number of in-use files */
+ if ( ST_GetBSInUseFilesProcessed( &op_stats ) > 0 ) {
+ if( ST_GetBSInUseFilesProcessed( &op_stats ) == 1 ) {
+ res_id = RES_RESTORED_IN_USE;
+ }
+ else {
+ res_id = RES_RESTORED_IN_USES;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSInUseFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSInUseFilesProcessed( &op_stats ) );
+ }
+
+ /* display number of files skipped */
+ if ( ST_GetBSFilesSkipped( &op_stats ) > 0 ) {
+
+ if( ST_GetBSFilesSkipped( &op_stats ) == 1 ) {
+ res_id = RES_FILE_SKIPPED_STAT;
+ }
+ else {
+ res_id = RES_FILE_SKIPPEDS_STAT;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSFilesSkipped( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSFilesSkipped( &op_stats ) );
+
+ }
+
+ /* display number of Directories processed */
+ yprintf(TEXT("%ld\r"),ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORIES_PROCESS );
+
+ /* display number of Files processed */
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_FILES_PROCESSED );
+
+ /* display number of bytes processed */
+ UI_BytesProcessed( &op_stats );
+
+ /* display restore rate */
+ UI_RateProcessed( &op_stats );
+
+ delimiter = TEXT('#'); /* = # for debug */
+
+# if defined ( OS_WIN32 ) //special feature-EventLogging
+ {
+ OMEVENT_LogEndRestore ( mwErrorDuringBackupSet );
+ }
+# endif //defined ( OS_WIN32 ) //special feature-EventLogging
+ }
+ break;
+
+ case MSG_PROMPT:
+ {
+ INT16 type = va_arg( arg_ptr, INT16 );
+
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ switch( type ) {
+
+ case ASK_TO_REPLACE_MODIFIED:
+ response = TRUE;
+ break;
+ case ASK_TO_REPLACE_EXISTING:
+ {
+
+ /* get filename from dblk and display prompt */
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ DBLK_PTR disk_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ tape_date_ptr = &tape_date;
+ disk_date_ptr = &disk_date;
+
+ /* get dates for a later comparison */
+
+ FS_GetMDateFromDBLK( fsh, dblk_ptr, tape_date_ptr );
+ FS_GetMDateFromDBLK( fsh, disk_dblk_ptr, disk_date_ptr );
+
+ cds_ptr = CDS_GetCopy();
+ restore_existing_files_flag = CDS_GetRestoreExistingFiles( cds_ptr );
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofOSFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+
+
+ switch( restore_existing_files_flag ) {
+ case NO_RESTORE_OVER_EXISTING :
+
+ ST_AddBSFilesSkipped( &op_stats, 1 );
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesSkipped( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_SKIPPED_FILES );
+
+ yresprintf( (INT16) RES_FILE_WAS_SKIPPED_USER, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG,
+ RES_FILE_WAS_SKIPPED_USER, buffer );
+ break;
+
+ case PROMPT_RESTORE_OVER_RECENT :
+ case PROMPT_RESTORE_OVER_EXISTING :
+
+ if(mw_file_replace_ptr) {
+
+ UI_AllocPathBuffer( &buffer2,
+ (UINT16) ( FS_SizeofOSFnameInFDB( fsh, dblk_ptr ) +
+ strsize(mw_file_replace_ptr->destination_volume) +
+ strsize(mw_file_replace_ptr->destination_path) + 3 ) ) ;
+
+ if ( buffer2 ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ strcpy(buffer2, mw_file_replace_ptr->destination_volume);
+ strcat(buffer2, mw_file_replace_ptr->destination_path);
+ if ( strcmp( mw_file_replace_ptr->destination_path, TEXT( "\\" ) ) ) {
+ strcat(buffer2,TEXT("\\"));
+ }
+ strcat(buffer2,buffer);
+ yprintf(TEXT("%s\n"), buffer2 );
+ strcpy( mw_file_replace_ptr->line_1, gszTprintfBuffer );
+
+ disk_date_ptr->year -= 1900;
+ UI_MakeDateString( date_str1,
+ disk_date_ptr->month,
+ disk_date_ptr->day,
+ disk_date_ptr->year );
+ UI_MakeTimeString( date_str2,
+ disk_date_ptr->hour,
+ disk_date_ptr->minute,
+ disk_date_ptr->second );
+ yresprintf( (INT16) RES_FILE_DETAIL,
+ U64_Litoa( FS_GetDisplaySizeFromDBLK( fsh, disk_dblk_ptr ), // chs:02-09-93, per Carl.
+ numeral, (INT16) 10, &stat64 ),
+ date_str1,
+ date_str2 );
+ strcpy( mw_file_replace_ptr->line_2, gszTprintfBuffer );
+
+ strcpy(buffer2,(CHAR_PTR)VLM_GetVolumeName( BSD_GetTapeID( bsd_ptr), BSD_GetSetNum( bsd_ptr ) ));
+ p = strrchr( buffer2, TEXT(':') );
+ if(p) {
+ *++p = 0;
+ }
+ FS_GetOSFnameFromFDB( fsh, dblk_ptr, buffer );
+ strcpy(mw_file_replace_ptr->source_volume, buffer2 );
+ strcat(buffer2, mw_file_replace_ptr->source_path);
+ if ( strcmp( mw_file_replace_ptr->source_path, TEXT( "\\" ) ) ) {
+ strcat(buffer2,TEXT("\\"));
+ }
+ strcat(buffer2,buffer);
+ yprintf(TEXT("%s\n"), buffer2 );
+ strcpy( mw_file_replace_ptr->line_3, gszTprintfBuffer );
+
+ tape_date_ptr->year -= 1900;
+ UI_MakeDateString( date_str1,
+ tape_date_ptr->month,
+ tape_date_ptr->day,
+ tape_date_ptr->year );
+ UI_MakeTimeString( date_str2,
+ tape_date_ptr->hour,
+ tape_date_ptr->minute,
+ tape_date_ptr->second );
+ yresprintf( (INT16) RES_FILE_DETAIL,
+ U64_Litoa( FS_GetDisplaySizeFromDBLK( fsh, dblk_ptr ),
+ numeral, (INT16) 10, &stat64 ),
+ date_str1,
+ date_str2 );
+ strcpy( mw_file_replace_ptr->line_4, gszTprintfBuffer );
+
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ if( restore_existing_files_flag == PROMPT_RESTORE_OVER_RECENT ) {
+
+ /* if current disk file newer than tape file, prompt user */
+ if( CompDate(disk_date_ptr, tape_date_ptr ) > 0 ) {
+
+ response = DM_StartConfirmFileReplace( mw_file_replace_ptr );
+ }
+ else {
+ response = TRUE; /* restore file */
+ }
+ } else {
+
+ response = DM_StartConfirmFileReplace( mw_file_replace_ptr );
+ }
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ if(response == FILE_REPLACE_NO_BUTTON ) {
+
+ response = FALSE; /* don't restore file */
+ }
+ else if(response == FILE_REPLACE_YES_BUTTON ) {
+
+ response = TRUE; /* restore file */
+ }
+ else if(response == FILE_REPLACE_CANCEL_BUTTON ) {
+ response = FALSE; /* don't restore file */
+ JobStatusBackupRestore( JOB_STATUS_ABORT );
+ }
+ else if(response == FILE_REPLACE_YES_TO_ALL_BUTTON )
+ {
+ be_cfg_ptr = BSD_GetConfigData(bsd_ptr);
+
+ /* Set the restore extisting files flag for this BSD */
+ BEC_SetExistFlag( be_cfg_ptr, (INT16)BEC_REST_OVER_EXIST );
+ response = TRUE; /* restore file */
+ }
+
+ if( response == FALSE ) {
+
+ ST_AddBSFilesSkipped( &op_stats, 1 );
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesSkipped( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_SKIPPED_FILES );
+
+ yresprintf( (INT16) RES_FILE_WAS_SKIPPED_USER, buffer2 );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG,
+ RES_FILE_WAS_SKIPPED_USER, buffer2 );
+ }
+ }
+ }
+ break;
+
+ case NO_RESTORE_OVER_RECENT :
+
+ /* if current disk file newer than tape file, don't restore */
+ if( CompDate(disk_date_ptr, tape_date_ptr ) > 0 ) {
+
+ response = FALSE; /* don't restore file */
+ }
+ else {
+ response = TRUE; /* restore file */
+ }
+
+ if( response == FALSE ) {
+
+ ST_AddBSFilesSkipped( &op_stats, 1 );
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesSkipped( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_SKIPPED_FILES );
+
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ yresprintf( (INT16) RES_FILE_WAS_SKIPPED, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG,
+ RES_FILE_WAS_SKIPPED, buffer );
+ }
+ break;
+ }
+ }
+
+ }
+ break;
+
+ case ASK_TO_RESTORE_CONTINUE:
+ {
+ /* get filename from dblk and display prompt */
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ switch ( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_FDB :
+
+ if ( CDS_GetYesFlag( CDS_GetPerm() ) == YESYES_FLAG ) {
+
+ response = FALSE;
+
+ } else {
+
+ /* prompt user for response */
+
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ yresprintf( (INT16) RES_CONTINU_FILE_WARNING, buffer );
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ response = (INT16)WM_MessageBox( ID( IDS_MSGTITLE_RESTORE ),
+ gszTprintfBuffer,
+ (WORD)WMMB_YESNO,
+ (WORD)WMMB_ICONQUESTION,
+ ID( RES_CONTINU_FILE_PROMPT ),
+ 0, 0 );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ }
+ }
+ break;
+
+ case BT_DDB :
+ response = TRUE;
+ break;
+
+ default:
+ response = FALSE;
+ break;
+ }
+ }
+ break;
+
+ case ASK_DISK_FULL :
+ {
+ /* get filename from dblk and display prompt */
+ INT string_size ;
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ dle = BSD_GetDLE( bsd_ptr ) ;
+
+ response = FALSE;
+
+ if ( CDS_GetYesFlag( CDS_GetPerm() ) == YESYES_FLAG ) {
+
+ break ;
+ }
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ string_size = strsize(mw_file_replace_ptr->destination_volume) +
+ strsize(mw_file_replace_ptr->destination_path) + 6 ;
+
+ if ( FS_GetBlockType( dblk_ptr ) == BT_FDB ) {
+ string_size += FS_SizeofOSFnameInFDB( fsh, dblk_ptr ) ;
+ }
+
+ UI_AllocPathBuffer( &buffer2, (UINT16)string_size ) ;
+
+ if ( !buffer2 ) {
+ return FALSE ;
+ }
+
+ strcpy(buffer2, mw_file_replace_ptr->destination_volume);
+ if ( DLE_GetDeviceType(dle) != FS_EMS_DRV ) {
+ strcat(buffer2, mw_file_replace_ptr->destination_path);
+ }
+
+ if ( FS_GetBlockType( dblk_ptr ) == BT_FDB ) {
+
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ if ( strcmp( mw_file_replace_ptr->destination_path, TEXT( "\\" ) ) ) {
+ strcat(buffer2,TEXT("\\"));
+ }
+ strcat(buffer2,buffer);
+ }
+
+ yresprintf( (INT16) IDS_DISKFULL, buffer2 ) ;
+
+ response = WM_MessageBox( ID( IDS_DISKFULL_TITLE ),
+ gszTprintfBuffer,
+ WMMB_ABORTRETRYIGNOR,
+ WMMB_ICONEXCLAMATION,
+ NULL,
+ 0,
+ 0);
+
+ if ( response == WMMB_IDRETRY ) {
+ response = TRUE ;
+ } else if ( response == WMMB_IDABORT ) {
+ JobStatusBackupRestore( JOB_STATUS_ABORT );
+ response = FALSE ;
+ } else { /* must be ignore */
+ response = FALSE ;
+ }
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ }
+ break;
+
+ case CORRUPT_BLOCK_PROMPT:
+ {
+ CHAR_PTR user_buff = va_arg( arg_ptr, CHAR_PTR );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+ /* if user did not specify a filename, manufacture one */
+ recover_seq++;
+ sprintf( numeral, TEXT("%03d"), recover_seq );
+ strcpy( user_buff, TEXT("badfile.") );
+ strcat( user_buff, numeral );
+
+ /* log the fact that the tape read error occurred */
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RESTORE_RECOVER, user_buff );
+ }
+ break;
+
+ default:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ eresprintf( RES_UNKNOWN_LOOPS_PROMPT, type );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+ }
+
+
+ }
+ break;
+
+ case MSG_EOM:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ /* prompt for next tape is done during TF_NEED_NEW_TAPE? */
+ break;
+
+ case MSG_STOP_CLOCK:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+ break;
+
+ case MSG_START_CLOCK:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case MSG_ACCIDENTAL_VCB:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ /* miscellaneous messages */
+ case MSG_ACK_FDB_RECOVERED:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ yresprintf( (INT16) RES_RECOVERED_FILE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RECOVERED_FILE );
+ break;
+
+ case MSG_ACK_DDB_RECOVERED:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ yresprintf( (INT16) RES_RECOVERED_DIR );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_RECOVERED_DIR );
+ break;
+
+ case MSG_DATA_LOST:
+ {
+ UINT32 offset = va_arg( arg_ptr, UINT32 );
+ UINT16 size = va_arg( arg_ptr, UINT16 );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+ yresprintf( (INT16) RES_DATA_LOST, offset, size );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DATA_LOST, offset, size );
+
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+ break;
+ }
+
+ case MSG_IDLE:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ case MSG_RESTORED_ACTIVE:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* DDB/FDB are sent in if they're ever needed. */
+
+ restored_active_flag = TRUE ;
+
+ /* ignore these messages */
+ case MSG_BLOCK_BAD:
+ case MSG_BYTES_BAD:
+ case MSG_BLOCK_DELETED:
+ case MSG_BYTES_DELETED:
+ case MSG_TAPE_STATS:
+ case MSG_BLK_NOT_FOUND:
+ case MSG_BLK_DIFFERENT:
+ case MSG_LOG_DIFFERENCE:
+ case MSG_CONT_VCB:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ default:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+# if defined ( OS_WIN32 )
+ {
+ mwErrorDuringBackupSet = TRUE;
+ }
+# endif //defined ( OS_WIN32 )
+
+ gb_error_during_operation = TRUE;
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ eresprintf( RES_UNKNOWN_MSG_HNDLR_MSG, msg );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ break;
+ }
+
+ return( response );
+
+}
+
+
+
+/*****************************************************************************
+
+ Name: PromptNextTape
+
+ Description: Function to collect user response when a new tape is
+ required from the Tape Format/Tape positioner.
+
+ Returns: UI_ABORT_POSITIONING or UI_NEW_TAPE_INSERTED
+
+*****************************************************************************/
+static INT16 PromptNextTape(
+TPOS_PTR tpos,
+DBLK_PTR cur_vcb,
+BOOLEAN valid_vcb_flag,
+UINT16 mode,
+CHAR_PTR tape,
+CHAR_PTR drive )
+{
+ INT response;
+ CHAR temp[ MAX_UI_RESOURCE_SIZE ];
+
+ zprintf( DEBUG_USER_INTERFACE, RES_UI_TPOS_TAPE_SET, tape, tpos->tape_seq_num, tpos->backup_set_num );
+
+ CDS_SetYesFlag( CDS_GetCopy(), NO_FLAG );
+
+ switch ( mode ) {
+
+ case TF_READ_CONTINUE:
+
+ if ( valid_vcb_flag &&
+ ( FS_ViewTapeIDInVCB( cur_vcb ) == (UINT32)( tpos->tape_id ) ) &&
+ ( FS_ViewTSNumInVCB( cur_vcb ) == (UINT16)( tpos->tape_seq_num - 1 ) ) ) {
+
+ response = WM_MessageBox( ID( IDS_MSGTITLE_CONTINUE ),
+ ID( RES_CONTINUE_QUEST ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ NULL, 0, 0 );
+ } else {
+
+ RSM_Sprintf( temp, ID(RES_INSERT_NEXT_TAPE),
+ tpos->tape_seq_num,
+ BE_GetCurrentDeviceName( tpos->channel ) );
+
+ response = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ ID( RES_NEED_NEXT_TAPE_REWOUND ), // chs:05-10-93
+ WMMB_OKCANCEL,
+ WMMB_ICONQUESTION,
+ temp,
+ IDRBM_LTAPE, 0 );
+ }
+ break;
+
+ case TF_READ_OPERATION:
+ default:
+
+ if ( valid_vcb_flag &&
+ ( FS_ViewTapeIDInVCB( cur_vcb ) == (UINT32)( tpos->tape_id ) ) &&
+ ( FS_ViewTSNumInVCB( cur_vcb ) == (UINT16)( tpos->tape_seq_num - 1 ) ) ) {
+
+ RSM_Sprintf( temp, ID(RES_INSERT_NEXT_TAPE),
+ tpos->tape_seq_num,
+ BE_GetCurrentDeviceName( tpos->channel ) );
+
+ response = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ ID( RES_NEED_NEXT_TAPE_REWOUND ), // chs:05-10-93
+ WMMB_OKCANCEL,
+ WMMB_ICONQUESTION,
+ temp,
+ IDRBM_LTAPE, 0 );
+ } else {
+
+ RSM_Sprintf( temp, ID(RES_TAPE_REQUEST), drive, tape,
+ ( tpos->tape_seq_num == -1) ? 1 : tpos->tape_seq_num );
+
+ response = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ temp,
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ),
+ 0, 0 );
+ }
+ break;
+
+ }
+
+ if ( response ) {
+#ifdef OS_WIN32
+ NtDemoChangeTape( (UINT16)(( tpos->tape_seq_num == -1) ? 1u : tpos->tape_seq_num ) );
+ tape_retries = mwTapeSettlingCount ;
+#endif
+ response = UI_NEW_TAPE_INSERTED;
+ }
+ else {
+ response = UI_ABORT_POSITIONING;
+ }
+
+ return( (INT16)response );
+}
+
+/**************************************************
+ Returns the current stats structure and path/file
+ name being processed.
+***************************************************/
+INT UI_GetRestoreCurrentStatus(
+STATS *Stats,
+CHAR *Path,
+INT PathSize )
+{
+
+ INT SpaceNeeded = 2;
+
+ if ( Stats != NULL ) {
+ memcpy( Stats, &op_stats, sizeof( STATS ) );
+ }
+
+ SpaceNeeded += strlen( mwCurrentDrive );
+ SpaceNeeded += strlen( mwCurrentPath );
+ SpaceNeeded += strlen( mwCurrentFile );
+
+ if ( Path == NULL || PathSize < 0 ) {
+ return( FAILURE );
+ }
+
+ strcpy( Path, TEXT( "" ) );
+
+ if ( (INT)SpaceNeeded < PathSize ) {
+ strcpy( Path, mwCurrentDrive );
+ strcat( Path, mwCurrentPath );
+ if (strcmp(mwCurrentPath, TEXT("\\")) != 0)
+ {
+ strcat( Path, TEXT( "\\" ) );
+ }
+ strcat( Path, mwCurrentFile );
+ }
+ else {
+ if ( (INT)strlen( mwCurrentFile ) < PathSize ) {
+ strcpy( Path, mwCurrentFile );
+ }
+ else {
+ return( FAILURE );
+ }
+ }
+
+ return( SUCCESS );
+
+}
diff --git a/private/utils/ntbackup/src/do_tens.c b/private/utils/ntbackup/src/do_tens.c
new file mode 100644
index 000000000..a9ff13754
--- /dev/null
+++ b/private/utils/ntbackup/src/do_tens.c
@@ -0,0 +1,822 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_tens.c
+
+ Description: Functions for tape tension and erase including startup to call
+ LP_Tension_Engine, tape positioning and message handling
+
+ $Log: G:\ui\logfiles\do_tens.c_v $
+
+ Rev 1.40.2.3 20 Jul 1994 19:32:54 STEVEN
+fix format message
+
+ Rev 1.40.2.2 12 Jul 1994 19:34:06 STEVEN
+write protected tapes cause errors not success
+
+ Rev 1.40.2.1 24 May 1994 20:07:38 GREGG
+Improved handling of ECC, SQL, FUTURE_VER and OUT_OF_SEQUENCE tapes.
+
+ Rev 1.40.2.0 28 Jan 1994 18:30:54 GREGG
+Handle TF_UNRECOGNIZED_MEDIA.
+
+ Rev 1.40 14 Jul 1993 14:33:40 CARLS
+added check for transfer tape on erase operation
+
+ Rev 1.39 06 Jul 1993 16:19:20 KEVINS
+Status monitor additions.
+
+ Rev 1.38 28 Jun 1993 13:32:22 CARLS
+added VLM_CloseAll
+
+ Rev 1.37 22 Jun 1993 15:28:42 CARLS
+added clock routine for Icon animation
+
+ Rev 1.36 30 Apr 1993 15:53:32 chrish
+NOSTRADAMOUS EPR 0391: Added logic to display "Operation completed" instead of
+"... operation completed successfully" when user aborts an operation.
+
+ Rev 1.35 12 Mar 1993 14:42:14 CARLS
+changes for format tape
+
+ Rev 1.34 27 Jan 1993 14:24:16 STEVEN
+updates from msoft
+
+ Rev 1.33 20 Oct 1992 15:44:36 MIKEP
+gbCurrentOperation
+
+ Rev 1.32 07 Oct 1992 14:48:34 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.31 04 Oct 1992 19:34:38 DAVEV
+Unicode Awk pass
+
+ Rev 1.30 10 Sep 1992 17:44:56 DAVEV
+Integrate MikeP's changes from Microsoft
+
+ Rev 1.29 24 Aug 1992 15:27:22 DAVEV
+Event Logging
+
+ Rev 1.28 23 Jun 1992 17:35:46 DAVEV
+fix 'foreign tape' messgae
+
+ Rev 1.27 11 Jun 1992 15:20:42 DAVEV
+do not display status message 'Examine <log file> for more info' if not logging
+
+ Rev 1.26 10 Jun 1992 10:11:20 BURT
+Fix ANSI func lists
+
+ Rev 1.25 28 May 1992 10:10:16 MIKEP
+fix return type
+
+ Rev 1.24 19 May 1992 11:58:10 MIKEP
+mips changes
+
+ Rev 1.23 14 May 1992 17:39:18 MIKEP
+nt pass 2
+
+ Rev 1.22 08 Apr 1992 17:18:58 CARLS
+reset the gb_error_flag at start of operation
+
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static UINT16 TensionTapePositioner( UINT16, TPOS_PTR, BOOLEAN, DBLK_PTR, UINT16 );
+static INT16 TensionMessageHandler( UINT16, INT32, BSD_PTR, FSYS_HAND, TPOS_PTR, ... );
+
+static VOID clock_routine( VOID );
+static VOID do_tension_init( VOID );
+static VOID do_tension_process( VOID );
+
+static BOOLEAN clock_ready_flag;
+static HTIMER timer_handle;
+static INT mw_oper_type;
+static INT16 mw_ret_val;
+static UINT16 mw_last_msg = 0xFFFF;
+
+
+/*****************************************************************************
+
+ Name: do_tension
+
+ Description: This procedure kicks off the tension/erase function.
+
+ Returns: SUCCESS
+ ABNORMAL_TERMINATION
+
+ Notes: The return value mw_ret_val is set in do_tension_process().
+
+*****************************************************************************/
+
+INT do_tension( INT16 oper_type )
+{
+ DBLK_PTR vcb;
+ BOOLEAN prompt;
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_TENSION);
+ gbCurrentOperation = OPERATION_TENSION;
+ mw_oper_type = oper_type;
+ mw_ret_val = SUCCESS;
+ mw_last_msg = 0xFFFF;
+
+ // If it's a bad tape then don't try to read the VCB.
+ // Or if poll drive is disabled.
+
+ if ( VLM_GetDriveStatus( &vcb ) == VLM_BAD_TAPE ) {
+
+ if ( mw_oper_type == SECURITY_ERASE_OPER ) {
+ mw_oper_type = SEC_ERASE_NO_READ_OPER;
+ }
+
+ if ( mw_oper_type == ERASE_OPER ) {
+ mw_oper_type = ERASE_NO_READ_OPER;
+ }
+
+ }
+
+ prompt = FALSE;
+
+ /* poll drive is disabled */
+ if ( VLM_GetDriveStatus( &vcb ) == VLM_DISABLED ) {
+
+ if ( mw_oper_type == SECURITY_ERASE_OPER ) {
+ prompt = TRUE;
+ mw_oper_type = SEC_ERASE_NO_READ_OPER;
+ }
+
+ if ( mw_oper_type == ERASE_OPER ) {
+ prompt = TRUE;
+ mw_oper_type = ERASE_NO_READ_OPER;
+ }
+ }
+
+ if ( prompt ) {
+
+ RSM_StringCopy( IDS_TITLEERASEWARNING, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_TEXTERASEWARNING, text, MAX_UI_RESOURCE_LEN );
+
+ if ( WM_MsgBox ( title,
+ text,
+ WMMB_OKCANCEL,
+ WMMB_ICONQUESTION ) != WMMB_IDOK ) {
+
+ return( FALSE );
+ }
+ }
+
+ gb_error_during_operation = FALSE;
+
+ VLM_CloseAll();
+
+ do_tension_init();
+ do_tension_process();
+
+ gbCurrentOperation = OPERATION_NONE;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_IDLE);
+ return( mw_ret_val );
+}
+
+
+/*****************************************************************************
+
+ Name: do_tension_init
+
+ Description: Initialize the text on the RTD.
+
+ Returns: none.
+
+*****************************************************************************/
+
+VOID do_tension_init( VOID )
+{
+ /* initialize the text for either a tension or erase operation */
+
+ JobStatusTension( JOB_TENSION_CREATE_DIALOG );
+
+ if ( mw_oper_type == TENSION_OPER ) { /* tension operation */
+ yresprintf( IDS_DLGTITLEJOBSTATTENSION );
+ }
+ else if ( mw_oper_type == FORMAT_OPER ) { /* format operation */
+ yresprintf( IDS_DLGTITLEJOBSTATFORMAT );
+ }
+ else { /* erase operation */
+ yresprintf( IDS_DLGTITLEJOBSTATERASE );
+ }
+ JobStatusTension( JOB_TENSION_TENSION_TITLE );
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: do_tension_process
+
+ Description: Performs the actual process. It sets up the lis structure,
+ etc. and calls the tension tape engine.
+
+ Returns: none.
+
+ Notes: sets mw_ret_val to SUCCESS or error.
+
+*****************************************************************************/
+
+VOID do_tension_process( VOID )
+{
+ LIS lis;
+ BSD_HAND temp_bsd_list;
+ Q_ELEM_PTR old_channel_link;
+
+
+ temp_bsd_list = (BSD_HAND)malloc( sizeof(BSD_LIST) );
+ if ( temp_bsd_list == NULL ) {
+ mw_ret_val = ABNORMAL_TERMINATION;
+ return;
+ }
+
+ InitQueue( &(temp_bsd_list->current_q_hdr) );
+ InitQueue( &(temp_bsd_list->last_q_hdr) );
+
+ lis.oper_type = (INT16)mw_oper_type;
+
+ lis.auto_det_sdrv = FALSE;
+ gb_last_operation = mw_oper_type;
+
+ lis.bsd_list = temp_bsd_list;
+
+ /* check for a valid bsd first, set to search for first set if needed */
+
+ mw_ret_val = BSD_Add( temp_bsd_list,
+ &lis.curr_bsd_ptr,
+ BEC_CloneConfig( CDS_GetPermBEC() ),
+ NULL, NULL,
+ (UINT32)-1L, (UINT16)-1, -1,
+ thw_list, NULL );
+
+ if ( mw_ret_val == OUT_OF_MEMORY ) {
+ mw_ret_val = ABNORMAL_TERMINATION;
+ return;
+ }
+ /* get the first bset on the tape */
+ BSD_SetTapePos( lis.curr_bsd_ptr, (UINT32)-1L, (UINT16)-1, (UINT16)-1 );
+
+ /* setup lis structure */
+ lis.tape_pos_handler = TensionTapePositioner; /* set tape positioner to call */
+ lis.message_handler = TensionMessageHandler; /* set message handler to call */
+ lis.abort_flag_ptr = &gb_abort_flag; /* set abort flag address */
+
+ LP_SetAbortFlag( &lis, CONTINUE_PROCESSING );
+ JobStatusAbort( lis.abort_flag_ptr );
+
+ clock_ready_flag = FALSE; // Wait on bset to start
+
+ timer_handle = WM_HookTimer( clock_routine, 1 );
+
+ PD_StopPolling();
+
+ // Do one drive only
+
+ old_channel_link = thw_list->channel_link.q_next;
+ thw_list->channel_link.q_next = NULL;
+
+ LP_Tension_Tape_Engine( &lis );
+
+ // reset multiple drives
+
+ thw_list->channel_link.q_next = old_channel_link;
+
+ PD_StartPolling();
+
+ WM_UnhookTimer( timer_handle );
+
+ JobStatusTension(JOB_TENSION_ABORT_OFF);
+
+ BSD_Remove( lis.curr_bsd_ptr );
+
+ free( temp_bsd_list );
+
+ return;
+}
+
+/*****************************************************************************
+
+ Name: TensionTapePositioner
+
+ Description: Tape positioning routine to be called by Tape Format Layer
+ during tension and erase operations
+
+ Returns:
+
+*****************************************************************************/
+static UINT16 TensionTapePositioner(
+UINT16 message,
+TPOS_PTR tpos,
+BOOLEAN curr_valid_vcb,
+DBLK_PTR cur_vcb,
+UINT16 mode )
+{
+ UINT16 response = UI_ACKNOWLEDGED;
+ LIS_PTR lis_ptr = ( LIS_PTR )tpos->reference;
+ CHAR_PTR drive_name;
+
+ curr_valid_vcb;
+ mode;
+
+ /* get a pointer to the name of the current tape device */
+ drive_name = BE_GetCurrentDeviceName( tpos->channel );
+
+ /* Check for user abort */
+ if ( UI_CheckUserAbort( message ) ) {
+ return UI_ABORT_POSITIONING ;
+ }
+
+ /* Discontinue dots if required */
+
+ /* check for writing to write-protected tape */
+ if ( lis_ptr->oper_type != TENSION_OPER ) {
+ if ( UI_CheckWriteProtectedDevice( message, tpos, drive_name ) ) {
+ gb_error_during_operation = TRUE ;
+ return UI_ABORT_POSITIONING ;
+ }
+ }
+
+ switch( (INT16)message ) {
+
+ case TF_IDLE_NOBREAK:
+ case TF_IDLE:
+ case TF_SKIPPING_DATA:
+ case TF_MOUNTING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ case TF_VCB_BOT:
+ case TF_POSITIONED_AT_A_VCB:
+ case TF_REQUESTED_VCB_FOUND:
+ case TF_VCB_EOD:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ /* if performing tension operation, simply return to TF layer */
+ if ( lis_ptr->oper_type == TENSION_OPER ) {
+ response = UI_END_POSITIONING;
+ break;
+ }
+ else {
+
+ /* prompt user if they really want to erase this tape */
+
+ /* Check for archive tape, and warn user */
+ if ( FS_GetAttribFromVCB( cur_vcb ) & VCB_ARCHIVE_BIT ||
+ IsTransferTape( FS_ViewTapeIDInVCB( cur_vcb ) ) ) {
+
+ CDS_SetYesFlag( CDS_GetCopy(), NO_FLAG );
+
+ if ( ! WM_MessageBox( ID( IDS_MSGTITLE_ERASE ),
+ ID( RES_ARCHIVE_REPLACE_WARNING ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ),
+ 0, 0 ) ) {
+ response = UI_ABORT_POSITIONING;
+ break;
+ }
+ }
+
+ QTC_RemoveTape( FS_ViewTapeIDInVCB( cur_vcb ),
+ FS_ViewTSNumInVCB( cur_vcb ) );
+ VLM_RemoveTape( FS_ViewTapeIDInVCB( cur_vcb ),
+ FS_ViewTSNumInVCB( cur_vcb ), TRUE );
+
+ response = UI_END_POSITIONING;
+ }
+ break;
+
+ case TF_RETENSIONING:
+ case TF_ERASING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ TensionMessageHandler( MSG_START_BACKUP_SET, lis_ptr->pid, NULL, NULL, NULL, lis_ptr->oper_type );
+ break;
+
+ case TF_EMPTY_TAPE:
+ case TF_NO_MORE_DATA:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ response = UI_END_POSITIONING;
+ break;
+
+ case TF_INVALID_VCB:
+ case TF_FUTURE_REV_MTF:
+ case TF_MTF_ECC_TAPE:
+ case TF_SQL_TAPE:
+ case TF_TAPE_OUT_OF_ORDER:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN);
+
+ yresprintf( RES_FOREIGN_TAPE_MSG, drive_name );
+
+ // Fix 6/23: only one message box with 'Continue or Cancel' option
+ //WM_MessageBox( NULL,
+ // gszTprintfBuffer,
+ // WMMB_OK,
+ // WMMB_ICONINFORMATION,
+ // NULL, 0, 0 );
+
+ CDS_SetYesFlag( CDS_GetCopy(), NO_FLAG );
+
+ /* go ahead and retension foreign tapes */
+ if ( lis_ptr->oper_type == TENSION_OPER ) {
+ response = UI_END_POSITIONING;
+
+ /* prompt user before erasing foreign tapes */
+ }
+ else {
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_ERASE ),
+ //ID( RES_ERASE_QUEST ),
+ gszTprintfBuffer,
+ WMMB_CONTCANCEL, //WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ NULL, 0, 0 ) ) {
+ response = UI_END_POSITIONING;
+ } else {
+ response = UI_ABORT_POSITIONING;
+ }
+ }
+ break;
+
+ // Kludge to handle write protected tapes during erase_no_read
+ // operations.
+
+ case TFLE_WRITE_PROTECT:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ if ( lis_ptr->oper_type == TENSION_OPER ) {
+ response = UI_END_POSITIONING;
+ }
+ else {
+ eresprintf( RES_WRITE_PROT, drive_name );
+ response = UI_ABORT_POSITIONING;
+ }
+ break;
+
+ case TF_NO_TAPE_PRESENT:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_EMPTY);
+ response = UI_InsertTape( drive_name );
+ break;
+
+ case TF_READ_ERROR:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ if ( lis_ptr->oper_type == TENSION_OPER ) {
+ response = UI_END_POSITIONING;
+ }
+ else {
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_ERROR);
+ gb_error_during_operation = TRUE;
+
+ UI_ProcessErrorCode( TFLE_DRIVE_FAILURE, &response, tpos->channel );
+
+// response = UI_HandleTapeReadError( drive_name );
+ }
+ break;
+
+ case TF_UNRECOGNIZED_MEDIA:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ if ( lis_ptr->oper_type == TENSION_OPER ||
+ lis_ptr->oper_type == FORMAT_OPER ) {
+
+ response = UI_END_POSITIONING;
+ }
+ else {
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN);
+ yresprintf( (INT16) IDS_VLMUNFORMATEDTEXT );
+ WM_MessageBox( ID( IDS_VLMUNFORMATEDTITLE ) ,
+ gszTprintfBuffer ,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+ response = UI_ReplaceTape( drive_name );
+ }
+ break;
+
+ case TF_SEARCHING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ if ( mw_last_msg != message ) {
+ yresprintf( (INT16)RES_SEARCHING );
+ JobStatusTension(JOB_TENSION_LISTBOX);
+ mw_last_msg = message;
+ }
+ break;
+
+ case TF_REWINDING:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ if ( mw_last_msg != message ) {
+ yresprintf( (INT16)RES_REWINDING );
+ JobStatusTension(JOB_TENSION_LISTBOX);
+ mw_last_msg = message;
+ }
+ break;
+
+ case TF_DRIVE_BUSY:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_BUSY);
+ if ( mw_last_msg != message ) {
+ yresprintf( (INT16)RES_WAITING );
+ JobStatusTension(JOB_TENSION_LISTBOX);
+ mw_last_msg = message;
+ }
+ break;
+
+ case TF_NEED_NEW_TAPE:
+ case TF_WRONG_TAPE:
+ case TF_ACCIDENTAL_VCB:
+ case TF_AT_EOT:
+ case TF_CONT_TAPE_IN_FAMILY:
+ case TF_END_CHANNEL:
+ case TF_END_POSITIONING:
+ case TF_FAST_SEEK_EOD:
+ case TF_NEED_REWIND_FIRST:
+ case TF_NO_MORE_ENTRIES:
+ case TF_NO_SC_FOR_SET:
+ case TF_NO_SM_FOR_FAMILY:
+ case TF_NO_SM_ON_TAPE:
+ case TF_POSITIONED_FOR_WRITE:
+
+ /* These should never be passed in by TF for Tension/Erase */
+ break;
+
+ default:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ eresprintf( RES_UNKNOWN_TF_MSG, message );
+ response = UI_ABORT_POSITIONING;
+ break;
+ }
+
+ return( response );
+
+}
+
+/*****************************************************************************
+
+ Name: TensionMessageHandler
+
+ Description: Message handler for tension and erase operations
+
+ Returns:
+
+*****************************************************************************/
+static INT16 TensionMessageHandler(
+UINT16 msg,
+INT32 pid,
+BSD_PTR bsd_ptr,
+FSYS_HAND fsh,
+TPOS_PTR tpos,
+... )
+{
+ INT16 response = MSG_ACK;
+ static STATS op_stats;
+ INT16 res_id;
+ va_list arg_ptr;
+ INT16 oper_type;
+ DBLK_PTR vcb_ptr;
+ INT16 error;
+
+ /* future use */
+ pid;
+ bsd_ptr;
+ fsh;
+
+ /* set up first argument */
+ va_start( arg_ptr, tpos );
+
+ switch( msg ) {
+
+ case MSG_START_OPERATION:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+# if defined ( OS_WIN32 )
+ {
+ if ( mw_oper_type == TENSION_OPER )
+ {
+ OMEVENT_LogBeginRetension ();
+ }
+ else
+ {
+ OMEVENT_LogBeginErase ();
+ }
+ }
+# endif //defined ( OS_WIN32 )
+
+ lresprintf( LOGGING_FILE, LOG_START, FALSE );
+ break;
+
+ case MSG_END_OPERATION:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+# if defined ( OS_WIN32 )
+ {
+ if ( mw_oper_type == TENSION_OPER )
+ {
+ OMEVENT_LogEndRetension ( gb_error_during_operation );
+ }
+ else
+ {
+ OMEVENT_LogEndErase ( gb_error_during_operation );
+ }
+ }
+# endif //defined ( OS_WIN32 )
+
+ lresprintf( LOGGING_FILE, LOG_END );
+ if ( gb_error_during_operation == TRUE ) {
+
+ yresprintf( RES_ERROR_DURING_OPERATION );
+ JobStatusTension(JOB_TENSION_LISTBOX);
+
+
+ if ( CDS_GetOutputDest( CDS_GetPerm() ) == LOG_TO_FILE
+ && CDS_GetLogLevel ( CDS_GetPerm() ) != LOG_DISABLED ) {
+ yresprintf( RES_ERROR_FILE_TO_EXAMINE, LOG_GetCurrentLogName() );
+ JobStatusTension(JOB_TENSION_LISTBOX);
+ }
+
+ } else {
+
+ if ( gb_abort_flag != CONTINUE_PROCESSING ) { // chs:04-30-93
+ yresprintf( (INT16) RES_OPERATION_COMPLETED ) ; // chs:04-30-93
+ } else { // chs:04-30-93
+ yresprintf( RES_NOERROR_DURING_OPERATION ); // chs:04-30-93
+ } // chs:04-30-93
+
+ JobStatusTension(JOB_TENSION_LISTBOX);
+ }
+ break;
+
+ case MSG_START_BACKUP_SET:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ oper_type = va_arg( arg_ptr, INT16 );
+
+ ST_StartBackupSet( &op_stats );
+
+ clock_ready_flag = TRUE;
+
+ /* set appropriate resource id for operation type for messages */
+ switch( oper_type ) {
+
+ case TENSION_OPER:
+ res_id = RES_TENSION_STARTED;
+ break;
+
+ case FORMAT_OPER:
+ res_id = RES_FORMAT_STARTED;
+ break;
+
+ case ERASE_OPER:
+ case ERASE_NO_READ_OPER:
+ case ERASE_FMARK_ONLY:
+ res_id = RES_ERASE_STARTED;
+ break;
+
+ case SEC_ERASE_NO_READ_OPER:
+ case SECURITY_ERASE_OPER:
+ res_id = RES_SEC_ERASE_STARTED;
+ break;
+
+ }
+
+ UI_Time( &op_stats, res_id, UI_START );
+ JobStatusTension(JOB_TENSION_LISTBOX);
+
+ break;
+
+ case MSG_END_BACKUP_SET:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ oper_type = va_arg( arg_ptr, UINT16 );
+
+ ST_EndBackupSet( &op_stats );
+
+ /* display and log any abort conditions */
+ UI_ConditionAtEnd( );
+
+ clock_ready_flag = FALSE;
+
+ /* set appropriate resource id for operation type for messages */
+ switch( oper_type ) {
+
+ case TENSION_OPER:
+ res_id = RES_TENSION_COMPLETED;
+ break;
+
+ case FORMAT_OPER:
+ res_id = RES_FORMAT_COMPLETED;
+ break;
+
+ case ERASE_OPER:
+ case ERASE_NO_READ_OPER:
+ case ERASE_FMARK_ONLY:
+ res_id = RES_ERASE_COMPLETED;
+ break;
+
+ case SEC_ERASE_NO_READ_OPER:
+ case SECURITY_ERASE_OPER:
+ res_id = RES_SEC_ERASE_COMPLETED;
+ break;
+
+ }
+
+ UI_Time( &op_stats, res_id, UI_END );
+ JobStatusTension(JOB_TENSION_LISTBOX);
+
+ break;
+
+ case MSG_ACCIDENTAL_VCB:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ vcb_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ QTC_RemoveTape( FS_ViewTapeIDInVCB( vcb_ptr ),
+ FS_ViewTSNumInVCB( vcb_ptr ) );
+ VLM_RemoveTape( FS_ViewTapeIDInVCB( vcb_ptr ),
+ FS_ViewTSNumInVCB( vcb_ptr ), TRUE );
+ break;
+
+ case MSG_TBE_ERROR:
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+ error = va_arg( arg_ptr, INT16 );
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ UI_ProcessErrorCode( error, &response, tpos->channel );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ /* ignore these messages */
+ case MSG_LOG_BLOCK :
+ case MSG_IDLE:
+ case MSG_BLOCK_BAD:
+ case MSG_BYTES_BAD:
+ case MSG_BLOCK_DELETED:
+ case MSG_BYTES_DELETED:
+ case MSG_TAPE_STATS:
+ case MSG_BLK_NOT_FOUND:
+ case MSG_BLK_DIFFERENT:
+ case MSG_LOG_DIFFERENCE:
+ case MSG_EOM:
+ case MSG_STOP_CLOCK:
+ case MSG_START_CLOCK:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ default:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ gb_error_during_operation = TRUE;
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ eresprintf( RES_UNKNOWN_MSG_HNDLR_MSG, msg );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ break;
+ }
+
+ return( response );
+
+}
+/*****************************************************************************
+
+ Name: clock_routine
+
+ Description: one second time to update the Runtime status
+ elapsed time
+
+ Returns: void
+
+*****************************************************************************/
+
+static VOID clock_routine( VOID )
+{
+
+ if ( clock_ready_flag ) {
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ WM_AnimateAppIcon ( IDM_OPERATIONSVERIFY, FALSE );
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ }
+}
diff --git a/private/utils/ntbackup/src/do_very.c b/private/utils/ntbackup/src/do_very.c
new file mode 100644
index 000000000..a90974426
--- /dev/null
+++ b/private/utils/ntbackup/src/do_very.c
@@ -0,0 +1,1859 @@
+
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: do_very.c
+
+ Description: Tape Verify tape positioning and message handler
+
+ $Log: J:/UI/LOGFILES/DO_VERY.C_V $
+
+ Rev 1.78.1.5 16 Jun 1994 17:44:56 GREGG
+Fixed setting and clearing of YESYES flag.
+
+ Rev 1.78.1.4 24 May 1994 20:08:20 GREGG
+Improved handling of ECC, SQL, FUTURE_VER and OUT_OF_SEQUENCE tapes.
+
+ Rev 1.78.1.3 04 May 1994 14:23:16 STEVEN
+fix dlt settlin timeime
+
+ Rev 1.78.1.2 26 Apr 1994 18:56:56 STEVEN
+fix net disconnect bug
+
+ Rev 1.78.1.1 01 Feb 1994 19:40:30 ZEIR
+tuned tape settling logic to work same as restore's
+
+ Rev 1.78.1.0 17 Jan 1994 15:30:56 MIKEP
+fix unicode warnings
+
+ Rev 1.78 15 Sep 1993 13:53:06 CARLS
+changes for displaying full path/file name detail if Log files
+
+ Rev 1.77 22 Jul 1993 18:35:40 KEVINS
+Corrected macro name.
+
+ Rev 1.76 22 Jul 1993 18:28:52 KEVINS
+Added support for tape drive settling time.
+
+ Rev 1.75 15 Jul 1993 16:32:10 CARLS
+changed response on TF_WRONG_TAPE
+
+ Rev 1.74 27 Jun 1993 14:07:08 MIKEP
+continue work on status monitor stuff
+
+ Rev 1.73 18 Jun 1993 16:49:14 CARLS
+added NtDemoChangeTape calls for NtDemo
+
+ Rev 1.72 14 Jun 1993 20:25:14 MIKEP
+enable c++
+
+ Rev 1.71 08 Jun 1993 10:58:30 chrish
+Verify logging information, added more info such as the drive where the
+files are located.
+
+ Rev 1.70 18 May 1993 16:44:54 chrish
+CAYMAN EPR 0259: Can also go into Nostradamus. During a command line backup
+with verify ... on the veryify the Tape label displayed a null pointer. This
+is because the BSD member is a null pointer and no check was made to test
+for it before displaying it. Made change to display a null string if we
+get a null pointer.
+
+
+
+
+ Rev 1.69 14 May 1993 14:39:50 DARRYLP
+Modified event logging text
+
+ Rev 1.68 10 May 1993 16:37:42 chrish
+NOSTRADAMUS EPR 0400 and 0172 - Did not catch the fixes in the verify and
+restore process of the backup app. When spanning tape it gave the user
+wrong message to wait for tape to rewind, when it had already completed
+rewinding. Corrected by display proper message to user.
+
+ Rev 1.67 27 Apr 1993 16:21:48 DARRYLP
+Added status monitor functionality.
+
+ Rev 1.66 18 Apr 1993 16:23:38 BARRY
+Don't use 'free' on buffers allocated with UI_AllocPathBuffer.
+
+ Rev 1.65 09 Apr 1993 11:36:32 BARRY
+Clear gbAbortAtEOF before starting operation.
+
+ Rev 1.64 02 Apr 1993 15:49:38 CARLS
+changes for DC2000 unformatted tape
+
+ Rev 1.63 09 Mar 1993 10:57:54 MIKEP
+update clock stats at end of set
+
+ Rev 1.62 07 Mar 1993 16:33:56 GREGG
+Call _sleep for OS_WIN32 only.
+
+ Rev 1.61 23 Feb 1993 14:05:02 TIMN
+Added code to abort a Verify Operation EPR(0241)
+
+ Rev 1.60 22 Feb 1993 11:00:20 chrish
+Added changes received from MikeP.
+Added the ability to display hours to the clock_routine so it matches
+the do_back.c, do_cat.c and do_rest.c if the backup takes longer than 59
+minutes.
+
+ Rev 1.60 22 Feb 1993 10:43:26 chrish
+
+ Rev 1.59 17 Feb 1993 10:40:30 STEVEN
+changes from mikep
+
+ Rev 1.58 27 Jan 1993 14:33:04 STEVEN
+handle MSG_CONT_VCB message
+
+ Rev 1.57 18 Jan 1993 16:05:58 STEVEN
+add support for stream id error message
+
+ Rev 1.56 14 Dec 1992 12:18:16 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.55 11 Nov 1992 16:31:34 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.54 05 Nov 1992 17:03:14 DAVEV
+fix ts
+
+ Rev 1.52 20 Oct 1992 17:01:04 MIKEP
+getstatus calls
+
+ Rev 1.51 20 Oct 1992 15:44:00 MIKEP
+gbCurrentOperation
+
+ Rev 1.50 07 Oct 1992 14:47:10 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.49 04 Oct 1992 19:34:46 DAVEV
+Unicode Awk pass
+
+ Rev 1.48 31 Aug 1992 09:42:36 DAVEV
+OEM_MSOFT: Added Event Logging
+
+ Rev 1.47 27 Jul 1992 14:50:10 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.46 27 Jul 1992 11:07:48 JOHNWT
+ChuckB checked in for John Wright, who is no longer with us.
+
+ Rev 1.45 07 Jul 1992 15:33:24 MIKEP
+unicode changes
+
+ Rev 1.44 10 Jun 1992 10:07:40 BURT
+Fix ANSI func lists
+
+ Rev 1.43 28 May 1992 10:08:02 MIKEP
+fix return type
+
+ Rev 1.42 26 May 1992 10:30:46 MIKEP
+loop fixes
+
+ Rev 1.41 19 May 1992 11:58:30 MIKEP
+mips changes
+
+ Rev 1.40 14 May 1992 17:39:24 MIKEP
+nt pass 2
+
+ Rev 1.39 11 May 1992 19:31:02 STEVEN
+64bit and large path sizes
+
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static UINT16 tpos_rout( UINT16, TPOS_PTR, BOOLEAN, DBLK_PTR, UINT16 );
+static INT16 msg_hndlr( UINT16, INT32, BSD_PTR, FSYS_HAND, TPOS_PTR, ... );
+static VOID OpenVerifyScript( STATS_PTR, BSD_PTR, CHAR_PTR );
+static INT16 PromptNextTape( TPOS_PTR, DBLK_PTR, BOOLEAN, UINT16, CHAR_PTR, CHAR_PTR );
+
+static VOID clock_routine( VOID );
+static VOID do_verify_init( VOID );
+static VOID do_verify_process( VOID );
+
+static BOOLEAN clock_ready_flag;
+static HTIMER timer_handle;
+static STATS op_stats;
+static INT mw_oper_type;
+static INT mw_rewind;
+
+#ifdef OEM_EMS
+extern INT32 RT_BSD_OsId ;
+#endif
+
+#ifdef OS_WIN32
+static UINT16 mwTapeSettlingCount,
+ tape_retries;
+#endif
+
+/*****************************************************************************
+
+ Name: do_verify
+
+ Description: Main entry point for tape verification function.
+
+ Returns: SUCCESS
+ ABNORMAL_TERMINATION
+
+*****************************************************************************/
+
+INT do_verify( INT16 oper_type )
+{
+ INT16 ret_val = SUCCESS;
+ BSD_PTR bsd_ptr;
+
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_VERIFY);
+ gbCurrentOperation = OPERATION_VERIFY;
+ gbAbortAtEOF = FALSE;
+ gbAbortAtEOF = FALSE;
+ mw_oper_type = oper_type;
+ mw_rewind = TRUE;
+
+#ifdef OS_WIN32
+ /* we will check for tape every 3 seconds, but prompt user by interval
+ specified in INI file */
+ mwTapeSettlingCount = CDS_GetTapeDriveSettlingTime ( CDS_GetPerm () ) / 3;
+
+ if ( CDS_GetTapeDriveName( CDS_GetPerm( ) ) ) {
+
+ CHAR DriveName[80] ;
+
+ strncpy( DriveName, (CHAR_PTR)CDS_GetTapeDriveName( CDS_GetPerm( ) ), 80 ) ;
+ DriveName[79] = '\0' ;
+ strlwr( DriveName ) ;
+ if( strstr( DriveName, TEXT( "cipher" ) ) != NULL ||
+ ( strstr( DriveName, TEXT( "dec" ) ) != NULL &&
+ ( strstr( DriveName, TEXT( "thz02" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz86" ) ) != NULL ||
+ strstr( DriveName, TEXT( "tz87" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2700" ) ) != NULL ||
+ strstr( DriveName, TEXT( "dlt2000" ) ) != NULL ) ) ) {
+ mwTapeSettlingCount *= 2 ;
+ }
+ }
+
+ tape_retries = 0 ;
+#endif
+
+ do_verify_init();
+ do_verify_process();
+
+ /* set return value of success or failure of entire operation */
+
+ if( oper_type == VERIFY_LAST_BACKUP_OPER ||
+ oper_type == ARCHIVE_VERIFY_OPER ) {
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+ }
+ else {
+ bsd_ptr = BSD_GetFirst( tape_bsd_list );
+ }
+
+ while( ( bsd_ptr != NULL ) && !ret_val ) {
+
+ ret_val = BSD_GetOperStatus( bsd_ptr );
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ gbCurrentOperation = OPERATION_NONE;
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_IDLE);
+ return( ret_val );
+}
+
+
+/*****************************************************************************
+
+ Name: do_verify_init
+
+ Description: Initialize the RTD text.
+
+ Returns: none.
+
+*****************************************************************************/
+
+VOID do_verify_init( VOID )
+{
+ VLM_CloseAll();
+
+ JobStatusBackupRestore( JOB_STATUS_CREATE_DIALOG );
+
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATVERIFY );
+ JobStatusBackupRestore( JOB_STATUS_VERIFY_TITLE );
+
+ // display "Set information n of n "
+ JobStatusBackupRestore( JOB_STATUS_N_OF_N );
+
+ // display the tape bitmap
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_TAPE );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( (INT16) IDS_DLGTITLEJOBSTATVERIFY );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ yresprintf( (INT16) RES_TITLE_NEW_LINE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ /* clear the bytes processed field */
+ yprintf( TEXT("%d\r"), 0 );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: do_verify_process
+
+ Description: Initializes the lis structure, etc and calls the verify
+ engine to perform the operation.
+
+ Returns: none.
+
+ Notes: If a failure occurs, the operation status is set to
+ ABNORMAL_TERMINATION
+
+*****************************************************************************/
+VOID do_verify_process( VOID )
+{
+ LIS lis;
+ BSD_PTR bsd_ptr;
+ BSD_HAND temp_bsd_list;
+ INT16 ret_val;
+
+
+ if( mw_oper_type == VERIFY_LAST_BACKUP_OPER ||
+ mw_oper_type == ARCHIVE_VERIFY_OPER ) {
+
+ temp_bsd_list = bsd_list;
+ }
+ else {
+ temp_bsd_list = tape_bsd_list;
+ }
+
+ lis.vmem_hand = NULL;
+ lis.curr_bsd_ptr = BSD_GetFirst( temp_bsd_list );
+ lis.tape_pos_handler = tpos_rout; /* set tape positioner to call */
+ lis.message_handler = msg_hndlr; /* set message handler to call */
+ lis.oper_type = (INT16)mw_oper_type; /* set operation type */
+ lis.abort_flag_ptr = &gb_abort_flag; /* set abort flag address */
+ lis.pid = 0L;
+ lis.auto_det_sdrv = FALSE;
+ lis.bsd_list = temp_bsd_list;
+ gb_last_operation = mw_oper_type;
+
+ LP_SetAbortFlag( &lis, CONTINUE_PROCESSING );
+
+ /* set the Runtime abort flag pointer */
+ JobStatusAbort( lis.abort_flag_ptr );
+
+ /* enable the abort button for the runtime dialg */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_ENABLE );
+
+ /* Add additional excludes for catalog files if applicable. */
+ /* Note: don't care about return value here */
+
+ UI_ExcludeInternalFiles( (INT16)mw_oper_type );
+
+ if ( ( mw_oper_type | VERIFY_OPER ) &&
+ ( mw_oper_type & ~VERIFY_LAST_BACKUP_OPER ) &&
+ ( mw_oper_type & ~VERIFY_LAST_RESTORE_OPER ) ) {
+
+ /* Set the process-special flag if this is not */
+ /* a "verify-last" operation. */
+
+ bsd_ptr = BSD_GetFirst( temp_bsd_list );
+
+ while( bsd_ptr != NULL ) {
+ BSD_SetProcSpecialFlg( bsd_ptr, TRUE );
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ }
+
+ TryToCreateFFRQueue( &lis, (INT16)mw_oper_type );
+
+ clock_ready_flag = FALSE; // Wait on bset to start
+
+ timer_handle = WM_HookTimer( clock_routine, 1 );
+
+ PD_StopPolling();
+
+ /* call verify engine */
+ ret_val = LP_Verify_Engine( &lis );
+
+ PD_StartPolling();
+
+ WM_UnhookTimer( timer_handle );
+
+ /* This call will disable the Runtime Abort button and */
+ /* enable the OK button */
+ JobStatusBackupRestore( JOB_STATUS_ABORT_OFF );
+
+ if ( ( ret_val != SUCCESS ) && ( ret_val != TFLE_UI_HAPPY_ABORT ) ) {
+
+ BSD_SetOperStatus( lis.curr_bsd_ptr, ABNORMAL_TERMINATION );
+ }
+
+ return;
+}
+
+
+/*****************************************************************************
+
+ Name: tpos_rout
+
+ Description: Tape positioning routine for tape verification function
+ called from Tape Format
+
+ Returns:
+
+*****************************************************************************/
+static UINT16 tpos_rout(
+UINT16 message,
+TPOS_PTR tpos,
+BOOLEAN curr_vcb_valid,
+DBLK_PTR cur_vcb,
+UINT16 mode )
+{
+ UINT16 response = UI_ACKNOWLEDGED;
+ LIS_PTR lis_ptr = (LIS_PTR)tpos->reference;
+ BSD_PTR bsd_ptr = (BSD_PTR)lis_ptr->curr_bsd_ptr;
+ CHAR_PTR drive_name;
+ CHAR_PTR tape_name;
+
+ /* get a pointer to the name of the current tape device */
+ drive_name = BE_GetCurrentDeviceName( tpos->channel );
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ /* Check for user abort */
+ if( UI_CheckUserAbort( message ) ) {
+ return UI_ABORT_POSITIONING;
+ }
+
+ switch( message ) {
+
+ case TF_IDLE_NOBREAK:
+
+ WM_MultiTask();
+ break;
+
+ case TF_IDLE:
+ case TF_SKIPPING_DATA:
+ case TF_MOUNTING:
+ break;
+
+ case TF_REQUESTED_VCB_FOUND:
+
+ mw_rewind = TRUE;
+
+ /* if continuing a read operation, simply continue */
+ if( mode == TF_READ_CONTINUE ) {
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+ break;
+ }
+
+ /* check for "automatic style" verify first */
+ if ( ( lis_ptr->oper_type == ARCHIVE_VERIFY_OPER ) ||
+ ( lis_ptr->oper_type == VERIFY_LAST_BACKUP_OPER ) ||
+ ( lis_ptr->oper_type == VERIFY_LAST_RESTORE_OPER ) ) {
+
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+ break;
+ }
+
+ /* Otherwise, check for positioning for catalog selected set... */
+ /* We're located at a request VCB (using from a catalog based selection) */
+ /* If we're processing a specific set, and we've located this set via */
+ /* FFR PBA positioning, simply return TF_END_POSITIONING since this set */
+ /* has been pre-qualified prior to calling the loop */
+
+ if ( ( tpos->tape_id != -1 ) &&
+ ( tpos->tape_seq_num != -1 ) &&
+ ( tpos->backup_set_num != -1 ) &&
+ ( tpos->tape_loc.pba_vcb != 0 ) ) {
+
+ response = UI_END_POSITIONING;
+ break;
+ }
+
+ /* otherwise, fall through into tape set qualification logic... */
+
+
+ case TF_VCB_BOT:
+ case TF_POSITIONED_AT_A_VCB:
+
+ mw_rewind = TRUE;
+
+ /* first check for read continuation */
+ if ( mode == TF_READ_CONTINUE ) {
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+ break;
+ }
+
+ if ( message == TF_VCB_BOT ) {
+ if ( FS_ViewTSNumInVCB( cur_vcb ) > 1 ) {
+
+ yresprintf( (INT16) RES_OUT_OF_SEQUENCE_WARNING, FS_ViewTSNumInVCB( cur_vcb ) );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ if ( ! WM_MessageBox( ID( IDS_MSGTITLE_CONTINUE ),
+ gszTprintfBuffer,
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+ response = UI_ReplaceTape( drive_name );
+#ifdef OS_WIN32
+ tape_retries = mwTapeSettlingCount ;
+#endif
+ break;
+ }
+ }
+ }
+
+
+ /* have user validate tape password if necessary */
+ if ( ( lis_ptr->oper_type != ARCHIVE_VERIFY_OPER ) &&
+ ( lis_ptr->oper_type != VERIFY_LAST_BACKUP_OPER ) &&
+ ( lis_ptr->oper_type != VERIFY_LAST_RESTORE_OPER ) ) {
+
+ if ( UI_CheckOldTapePassword( cur_vcb ) == UI_ABORT_POSITIONING ) {
+ response = UI_HAPPY_ABORT;
+ break;
+ }
+ }
+
+ response = UI_UpdateTpos( tpos, cur_vcb, FALSE );
+ msg_hndlr( MSG_ACCIDENTAL_VCB, lis_ptr->pid, NULL, NULL, NULL, cur_vcb );
+
+ break;
+
+ case TF_ACCIDENTAL_VCB:
+ mw_rewind = TRUE;
+ UI_DisplayVCB( cur_vcb );
+
+ break;
+
+ case TF_VCB_EOD:
+ mw_rewind = TRUE;
+ response = UI_ProcessVCBatEOD( tpos, drive_name );
+ break;
+
+ case TF_NEED_NEW_TAPE:
+ mw_rewind = TRUE;
+ tape_name = UI_DisplayableTapeName( (CHAR_PTR) FS_ViewTapeNameInVCB( cur_vcb ),
+ FS_ViewBackupDateInVCB( cur_vcb ) );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ response = PromptNextTape( tpos, cur_vcb, curr_vcb_valid,
+ mode, tape_name, drive_name );
+ break;
+
+ case TF_UNRECOGNIZED_MEDIA:
+ mw_rewind = TRUE;
+ yresprintf( (INT16) IDS_VLMUNFORMATEDTEXT ) ;
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_UNFORMATTED);
+ WM_MessageBox( ID( IDS_VLMUNFORMATEDTITLE ) ,
+ gszTprintfBuffer ,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION, NULL, 0, 0 ) ;
+
+ response = PromptNextTape( tpos, cur_vcb, curr_vcb_valid,
+ mode, NULL, drive_name );
+ break;
+
+ case TF_NO_TAPE_PRESENT:
+#ifdef OS_WIN32
+ if( tape_retries ){
+ Sleep( 3000 ) ;
+ response = UI_NEW_TAPE_INSERTED ;
+ --tape_retries ;
+ break ;
+ }
+ // NOTE: fall thru on implied else or !ifdef OS_WIN32
+#endif
+
+ case TF_EMPTY_TAPE:
+ case TF_INVALID_VCB:
+ case TF_WRONG_TAPE:
+ case TF_FUTURE_REV_MTF:
+ case TF_MTF_ECC_TAPE:
+ case TF_SQL_TAPE:
+ case TF_TAPE_OUT_OF_ORDER:
+ mw_rewind = TRUE;
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_EMPTY);
+ tape_name = UI_DisplayableTapeName( (LPSTR)BSD_GetTapeLabel( bsd_ptr ),
+ BSD_ViewDate( bsd_ptr ) );
+ response = PromptNextTape( tpos, cur_vcb, curr_vcb_valid,
+ mode, tape_name, drive_name );
+
+ // Change UI_HAPPY_ABORT to UI_ABORT_POSITIONING because
+ // the loops will ask for the next Bset if you answered No
+ // to Do you want to continue, on insert tape message.
+ // The new response will cause the operation to abort
+ if( response == UI_HAPPY_ABORT ) {
+ response = UI_ABORT_POSITIONING;
+ }
+ break;
+
+ case TF_NO_MORE_DATA:
+ mw_rewind = TRUE;
+ yresprintf( (INT16) RES_NO_MORE_TAPE_INFO );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ response = UI_HAPPY_ABORT;
+ break;
+
+ case TF_READ_ERROR:
+ mw_rewind = TRUE;
+ response = UI_HandleTapeReadError( drive_name );
+ break;
+
+ case TF_SEARCHING:
+ mw_rewind = TRUE;
+ yresprintf( (INT16) RES_SEARCHING );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ break;
+
+ case TF_REWINDING:
+ if ( mw_rewind ) {
+ mw_rewind = FALSE;
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ yresprintf( (INT16) RES_REWINDING );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ }
+ break;
+
+ case TF_DRIVE_BUSY:
+ mw_rewind = TRUE;
+ yresprintf( (INT16) RES_WAITING );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ SetStatusBlock(IDSM_DRIVESTATUS, STAT_DRIVE_BUSY);
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ break;
+
+ default:
+ mw_rewind = TRUE;
+ eresprintf( RES_UNKNOWN_TF_MSG, message );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ response = UI_ABORT_POSITIONING;
+ break;
+ }
+
+ return( response );
+
+}
+
+
+/*****************************************************************************
+
+ Name: clock_routine
+
+ Description: one second time to update the Runtime status
+ elapsed time
+
+ Returns: void
+
+*****************************************************************************/
+
+static VOID clock_routine( VOID )
+{
+ INT16 num_hours, num_min, num_seconds; // chs:02-22-93 per mikep
+// chs:02-2-93 INT16 num_min, num_seconds;
+ UINT64 num_bytes;
+ BOOLEAN stat ;
+ CHAR numeral[ 40 ];
+ static UINT64 total_bytes;
+ UINT num_files;
+ UINT num_dirs;
+
+ if ( clock_ready_flag && ( ST_BSIdleLevel( &op_stats ) == 0 ) ) {
+
+ num_bytes = ST_GetBSBytesProcessed ( &op_stats );
+
+ if ( !U64_EQ( num_bytes, total_bytes ) ) {
+ total_bytes = num_bytes;
+ U64_Litoa( num_bytes, numeral, (INT16) 10, &stat ) ;
+ UI_BuildNumeralWithCommas( numeral );
+ yprintf(TEXT("%s\r"),numeral );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+ }
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ WM_AnimateAppIcon ( IDM_OPERATIONSVERIFY, FALSE );
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ ST_EndBackupSet( &op_stats );
+
+ num_dirs = ST_GetBSDirsProcessed( &op_stats );
+ num_files = ST_GetBSFilesProcessed( &op_stats );
+ SetStatusBlock(IDSM_FILECOUNT, num_files);
+ SetStatusBlock(IDSM_DIRCOUNT, num_dirs);
+ SetStatusBlock(IDSM_CORRUPTFILECOUNT, ST_GetBSFilesBad( &op_stats ));
+ SetStatusBlock(IDSM_SKIPPEDFILECOUNT, ST_GetBSFilesSkipped( &op_stats ));
+ SetStatusBlock(IDSM_BYTECOUNTLO, U64_Lsw(num_bytes));
+ SetStatusBlock(IDSM_BYTECOUNTHI, U64_Msw(num_bytes));
+ SetStatusBlock(IDSM_ELAPSEDSECONDS, (ST_GetBSEndTime( &op_stats ) -
+ ST_GetBSStartTime( &op_stats ) -
+ op_stats.bs_stats.bs_total_idle));
+ num_hours = ST_GetBSElapsedHours( &op_stats ); // chs:02-22-93 per mikep
+ num_min = ST_GetBSElapsedMinutes( &op_stats );
+ num_seconds = ST_GetBSElapsedSeconds( &op_stats );
+
+ if ( num_hours ) { // chs:02-22-93 per mikep
+ // chs:02-22-93 per mikep
+ yprintf( TEXT("%2.2d%c%2.2d%c%2.2d\r"), // chs:02-22-93 per mikep
+ num_hours, UI_GetTimeSeparator(), // chs:02-22-93 per mikep
+ num_min, UI_GetTimeSeparator(), // chs:02-22-93 per mikep
+ num_seconds ); // chs:02-22-93 per mikep
+ // chs:02-22-93 per mikep
+ // chs:02-22-93 per mikep
+ } // chs:02-22-93 per mikep
+ else { // chs:02-22-93 per mikep
+ // chs:02-22-93 per mikep
+ yprintf( TEXT("%2.2d%c%2.2d\r"), // chs:02-22-93 per mikep
+ num_min, UI_GetTimeSeparator(), // chs:02-22-93 per mikep
+ num_seconds ); // chs:02-22-93 per mikep
+
+ }
+
+// chs:02-22-93 per mikep yprintf( TEXT("%2.2d%c%2.2d\r"), num_min, UI_GetTimeSeparator(), num_seconds );
+
+ JobStatusBackupRestore( JOB_STATUS_ELAPSED_TIME );
+ }
+}
+
+
+/*****************************************************************************
+
+ Name: msg_hndlr
+
+ Description: Message handler for tape verification process
+
+ Returns:
+
+*****************************************************************************/
+static INT16 msg_hndlr(
+UINT16 msg,
+INT32 pid,
+BSD_PTR bsd_ptr,
+FSYS_HAND fsh,
+TPOS_PTR tpos,
+... )
+{
+ static CHAR delimiter = TEXT('#'); /* = # for debug */
+ INT16 response = MSG_ACK;
+ va_list arg_ptr;
+ static CHAR_PTR buffer = NULL;
+ static CHAR_PTR file_buf = NULL;
+ static CHAR_PTR path = NULL;
+ CHAR_PTR buffer1; // chs:06-08-93
+ static UINT16 OS_id;
+ static UINT16 OS_ver;
+ static BOOLEAN open_script;
+ static BOOLEAN open_brace = FALSE;
+ GENERIC_DLE_PTR dle;
+ BOOLEAN add_to_verify;
+ UINT64 num_bytes;
+ BOOLEAN stat ;
+ CHAR numeral[ UI_MAX_NUMERAL_LENGTH ];
+ QTC_BSET_PTR qtc_bset;
+ QTC_HEADER_PTR qtc_header;
+
+ // Accurate directory counts
+
+ static INT path_size;
+ static INT root_counted;
+
+ /* for future use */
+ pid;
+
+ /* set up first argument */
+ va_start( arg_ptr, tpos );
+
+ JobStatusBackupRestore( JOB_STATUS_ABORT_CHECK );
+
+ switch ( (INT16)msg ) {
+
+ /* logging messages */
+ case MSG_LOG_BLOCK:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+ /* clear last displayed filename from status display */
+ UI_DisplayFile( TEXT("") );
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+ if ( buffer != NULL ) {
+ yprintf( TEXT("%s"), buffer );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORY_NAMES );
+
+ ST_EndBackupSet( &op_stats );
+
+ // build the full path with no "..." inserted
+ UI_BuildFullPathFromDDB2( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+
+ dle = BSD_GetDLE( bsd_ptr ); // chs:06-08-93
+ if ( dle->device_name_leng ) { // chs:06-08-93
+ buffer1 = (CHAR_PTR)calloc( 1, ( strlen( buffer ) * sizeof( CHAR ) ) + ( ( dle->device_name_leng ) * sizeof( CHAR ) ) + sizeof( CHAR ) ); // chs:06-08-93
+ if ( buffer1 ) { // chs:06-08-93
+ strcpy( buffer1, dle->device_name ); // chs:06-08-93
+ strcat( buffer1, buffer ); // chs:06-08-93
+ // chs:06-08-93
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer1 ); // chs:06-08-93
+ free( buffer1 ); // chs:06-08-93
+ } else { // chs:06-08-93
+ // chs:06-08-93
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer ); // chs:06-08-93
+ } // chs:06-08-93
+ } else { // chs:06-08-93
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY, buffer ); // chs:06-08-93
+ } // chs:06-08-93
+ }
+ break;
+
+ case BT_FDB:
+
+ if ( CDS_GetFilesFlag( CDS_GetCopy() ) ) {
+
+ if ( UI_AllocPathBuffer( &buffer, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+
+ // copy the full file name for the Log file
+ strcpy( gszTprintfBuffer, buffer );
+ lresprintf( LOGGING_FILE, LOG_FILE, fsh, dblk_ptr );
+
+ // truncate the file name, if needed, for Runtime display
+ UI_DisplayFile( buffer );
+ JobStatusBackupRestore( JOB_STATUS_FILE_NAMES );
+ }
+
+ } else {
+ lresprintf( LOGGING_FILE, LOG_FILE, fsh, dblk_ptr );
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ /* statistics messages */
+
+ case MSG_BLOCK_PROCESSED:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ OBJECT_TYPE object_type;
+ INT i;
+ INT item_size;
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+
+ // Count all the new directories that showed up in
+ // this DDB.
+
+ // Only count the root once.
+
+ if ( ! root_counted ) {
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ root_counted = TRUE;
+ }
+
+ // Get the new path from the DDB.
+
+ item_size = FS_SizeofOSPathInDDB( fsh, dblk_ptr );
+ if ( UI_AllocPathBuffer( &buffer, (UINT16) item_size ) ) {
+
+ FS_GetOSPathFromDDB( fsh, dblk_ptr, buffer );
+
+ if ( item_size != sizeof (CHAR) ) {
+
+ i = 0;
+ while ( i < (INT)(item_size / sizeof (CHAR)) ) {
+
+ if ( i >= (INT)(path_size / sizeof (CHAR)) ) {
+
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ }
+ else if ( (path == NULL ) || stricmp( &buffer[ i ], &path[ i ] ) ) {
+
+ ST_AddBSDirsProcessed( &op_stats, 1 );
+ path_size = 0;
+ }
+ while ( buffer[ i++ ] );
+ }
+ }
+
+ // Set up for next time.
+ }
+ UI_AllocPathBuffer( &path, (UINT16) item_size ) ;
+ if ( buffer && path ) {
+ memcpy( path, buffer, item_size );
+ }
+
+ path_size = item_size;
+
+ yprintf(TEXT("%ld\r"),ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_DIRECTORIES_PROCESS );
+
+ break;
+
+ case BT_FDB:
+ ST_AddBSFilesProcessed( &op_stats, 1 );
+ FS_GetObjTypeDBLK( fsh, dblk_ptr, &object_type );
+ if( object_type == AFP_OBJECT ) {
+ ST_AddBSAFPFilesProcessed( &op_stats, 1 );
+ }
+
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_FILES_PROCESSED );
+
+ if ( gbAbortAtEOF ) {
+ gb_abort_flag = ABORT_PROCESSED ;
+ }
+
+ break;
+
+ case BT_IDB:
+ break;
+ }
+ }
+ break;
+
+ case MSG_BYTES_PROCESSED:
+ {
+ UINT64 count = va_arg( arg_ptr, UINT64 );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ ST_AddBSBytesProcessed( &op_stats, count );
+
+ }
+ ST_EndBackupSet( &op_stats );
+
+ break;
+
+ case MSG_BLOCK_SKIPPED:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+ ST_AddBSDirsSkipped( &op_stats, 1 );
+ break;
+
+ case BT_FDB:
+ ST_AddBSFilesSkipped( &op_stats, 1 );
+ yprintf(TEXT("%ld\r"),ST_GetBSFilesSkipped( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_SKIPPED_FILES );
+ break;
+ }
+ }
+ break;
+
+ case MSG_BYTES_SKIPPED:
+ {
+ UINT64 count = va_arg( arg_ptr, UINT64 );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ ST_AddBSBytesSkipped( &op_stats, count );
+ }
+ break;
+
+ case MSG_BLK_NOT_FOUND:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ DBLK_PTR ddb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+ gb_error_during_operation = TRUE;
+
+ switch( FS_GetBlockType( dblk_ptr ) ) {
+
+ case BT_DDB:
+ ST_AddDirectoriesNotFound( &op_stats, 1 );
+
+ lprintf( LOGGING_FILE, TEXT("\n") );
+
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, dblk_ptr, delimiter, FALSE );
+
+ if ( buffer != NULL ) {
+ yresprintf( (INT16) RES_DIRECTORY_NOT_FOUND_ON_DISK, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DIRECTORY_NOT_FOUND_ON_DISK, buffer );
+ lprintf( LOGGING_FILE, TEXT("\n") );
+ }
+ break;
+
+ case BT_FDB:
+ ST_AddFilesNotFound( &op_stats, 1 );
+
+ lprintf( LOGGING_FILE, TEXT("\n") );
+
+ yresprintf( (INT16) RES_ON_TAPE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ON_TAPE );
+
+ UI_BuildFileDetail( buffer, fsh, dblk_ptr, FALSE );
+
+ if ( buffer != NULL ) {
+ yprintf( TEXT("%s"), buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lprintf( LOGGING_FILE, TEXT(" %s"), buffer );
+ }
+
+ UI_AllocPathBuffer( &file_buf, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ;
+ UI_AllocPathBuffer( &buffer, (UINT16) ( FS_SizeofFnameInFDB( fsh, dblk_ptr ) +
+ FS_SizeofOSPathInDDB( fsh, ddb_dblk_ptr ) + 5 ) ) ;
+
+ if ( buffer && file_buf ) {
+
+ FS_GetFnameFromFDB( fsh, dblk_ptr, file_buf );
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, ddb_dblk_ptr, delimiter, FALSE );
+ UI_AppendDelimiter( buffer, delimiter );
+ strcat( buffer, file_buf );
+
+ yresprintf( (INT16) RES_FILE_NOT_FOUND_ON_DISK, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_FILE_NOT_FOUND_ON_DISK, buffer );
+ lprintf( LOGGING_FILE, TEXT("\n") );
+ }
+ break;
+
+ }
+ }
+ break;
+
+ case MSG_BLK_DIFFERENT:
+ {
+ DBLK_PTR tape_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ DBLK_PTR disk_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ BOOLEAN os_info_flag = va_arg( arg_ptr, BOOLEAN );
+ INT16 os_error_code = va_arg( arg_ptr, INT16 );
+
+ UI_AllocPathBuffer( &buffer, UI_MAX_PATH_LENGTH * sizeof (CHAR) ) ;
+
+ if ( buffer == NULL ) {
+ break ;
+ }
+
+ gb_error_during_operation = TRUE;
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+ /* if this is the first entry for this backup set set up the file ... */
+ if ( ! open_script ) {
+ OpenVerifyScript( &op_stats, bsd_ptr, buffer );
+ open_script = TRUE;
+ }
+
+ switch( FS_GetBlockType( tape_dblk_ptr ) ) {
+
+ case BT_DDB:
+ ST_AddDirectoriesDifferent( &op_stats, 1 );
+ ST_AddNumSecurityDifferences( &op_stats, 1 );
+
+ lprintf( LOGGING_FILE, TEXT("\n") );
+
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, tape_dblk_ptr, delimiter, FALSE );
+
+ if ( buffer != NULL ) {
+ yresprintf( (INT16) RES_DIRECTORY_DIFFERENT, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_DIRECTORY, SES_ENG_MSG, RES_DIRECTORY_DIFFERENT, buffer );
+ lprintf( LOGGING_FILE, TEXT("\n") );
+ }
+ break;
+
+ case BT_FDB:
+
+ if ( UI_AllocPathBuffer( &file_buf, FS_SizeofFnameInFDB( fsh, disk_dblk_ptr ) ) ) {
+ FS_GetFnameFromFDB( fsh, disk_dblk_ptr, file_buf );
+
+ switch ( os_error_code ) {
+
+ case FS_SECURITY_DIFFERENT :
+ ST_AddNumSecurityDifferences( &op_stats, 1 );
+ yresprintf( (INT16) RES_FILE_SECURITY_DIFF, file_buf );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_FILE_SECURITY_DIFF, file_buf );
+ break;
+
+ case FS_EADATA_DIFFERENT :
+ yresprintf( (INT16) RES_FILE_EA_DIFF, file_buf );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_FILE_EA_DIFF, file_buf );
+ break;
+
+ case FS_RESDATA_DIFFERENT :
+ ST_AddFilesDifferent( &op_stats, 1 );
+ yresprintf( (INT16) RES_FILE_RES_DIFF, file_buf );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_FILE_RES_DIFF, file_buf );
+ break;
+
+ default:
+ ST_AddFilesDifferent( &op_stats, 1 );
+ lprintf( LOGGING_FILE, TEXT("\n") );
+ lprintf( VERIFY_FILE, TEXT("\n{\n") );
+ open_brace = TRUE;
+
+ if ( !os_info_flag ) {
+ yresprintf( (INT16) RES_ON_TAPE );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ON_TAPE );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, RES_ON_TAPE );
+
+ UI_BuildFileDetail( buffer, fsh, tape_dblk_ptr, FALSE );
+
+ if ( buffer != NULL ) {
+ yprintf( TEXT("%s"), buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lprintf( LOGGING_FILE, TEXT(" %s"), buffer );
+ lprintf( VERIFY_FILE, TEXT(" %s"), buffer );
+
+ yresprintf( (INT16) RES_ON_DISK );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_ON_DISK );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, RES_ON_DISK );
+ }
+
+ UI_BuildFileDetail( buffer, fsh, disk_dblk_ptr, FALSE );
+
+ if ( buffer != NULL ) {
+
+ yprintf( TEXT("%s"), buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lprintf( LOGGING_FILE, TEXT(" %s"), buffer );
+ lprintf( VERIFY_FILE, TEXT(" %s"), buffer );
+
+ } else {
+ yresprintf( (INT16) RES_OS_FILE_INFO_DIFFERENT, file_buf );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_OS_FILE_INFO_DIFFERENT, file_buf );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, RES_OS_FILE_INFO_DIFFERENT, file_buf );
+ }
+ }
+ break;
+ }
+ }
+ break;
+
+ }
+ }
+ break;
+
+ case MSG_LOG_DIFFERENCE:
+ {
+ DBLK_PTR dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ DBLK_PTR ddb_dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ UINT32 strm_id = va_arg( arg_ptr, UINT32 );
+ INT16 os_error_code = va_arg( arg_ptr, INT16 );
+
+ UI_AllocPathBuffer( &buffer, UI_MAX_PATH_LENGTH * sizeof (CHAR)) ;
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ if ( buffer == NULL ) {
+ break ;
+ }
+
+ /* if this is the first entry for this backup set set up the file ... */
+ if( !open_script ) {
+ OpenVerifyScript( &op_stats, bsd_ptr, buffer );
+ open_script = TRUE;
+ }
+
+ add_to_verify = TRUE;
+
+ if( FS_GetBlockType( dblk_ptr ) == BT_FDB ) {
+
+ if ( !UI_AllocPathBuffer( &file_buf, FS_SizeofFnameInFDB( fsh, dblk_ptr ) ) ) {
+ break ;
+ }
+ FS_GetFnameFromFDB( fsh, dblk_ptr, file_buf );
+
+ switch ( os_error_code ) {
+
+ /* These don't get put in the verify script. */
+ case FS_SECURITY_DIFFERENT :
+ case FS_EADATA_DIFFERENT :
+ add_to_verify = FALSE;
+ break;
+
+ case FS_RESDATA_DIFFERENT :
+ if( open_brace ) {
+ open_brace = FALSE;
+ } else {
+ lprintf( VERIFY_FILE, TEXT("\n{\n") );
+ }
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, RES_FILE_RES_DIFF, file_buf );
+ lprintf( VERIFY_FILE, TEXT("\n}\n") );
+ break;
+
+ default:
+ if( open_brace ) {
+ open_brace = FALSE;
+ } else {
+ lprintf( LOGGING_FILE, TEXT("\n") );
+ lprintf( VERIFY_FILE, TEXT("\n{\n") );
+ }
+
+ switch( strm_id ) {
+
+ case LP_OPEN_ERROR :
+ yresprintf( (INT16) RES_VERIFY_OPEN_ERROR );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_VERIFY_OPEN_ERROR );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, RES_VERIFY_OPEN_ERROR );
+
+ break ;
+
+ case LP_DATA_VERIFIED :
+ yresprintf( (INT16) RES_VERIFY_DATA_VERIFIED );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_VERIFY_DATA_VERIFIED );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, RES_VERIFY_DATA_VERIFIED );
+ break ;
+
+ case STRM_NT_ACL: /* 'NACL' */
+ case STRM_NOV_TRUST_286: /* 'N286' */
+ case STRM_NOV_TRUST_386: /* 'N386' */
+
+ // print "difference encountered in security data stream"
+ yresprintf( (INT16) IDS_RTD_VERIFYERROR_SECURITYSTREAM );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_SECURITYSTREAM );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_SECURITYSTREAM );
+ break ;
+
+ case STRM_NT_EA: /* 'NTEA' */
+
+ // print "difference encountered in Extended Attribute information"
+ yresprintf( (INT16) IDS_RTD_VERIFYERROR_EA );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_EA );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_EA );
+ break ;
+
+ case STRM_MAC_RESOURCE: /* 'MRSC' */
+ case STRM_NTFS_ALT_DATA: /* 'ADAT' */
+
+ // print "difference encountered in alternate data stream"
+ yresprintf( (INT16) IDS_RTD_VERIFYERROR_ALTSTREAM );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_ALTSTREAM );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_ALTSTREAM );
+ break ;
+
+ case STRM_GENERIC_DATA: /* 'STAN' */
+ default:
+ yresprintf( (INT16) IDS_RTD_VERIFYERROR_DATA );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_DATA );
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, IDS_RTD_VERIFYERROR_DATA );
+ // print "difference encountered in data stream"
+ break ;
+
+ }
+
+ lprintf( VERIFY_FILE, TEXT("\n}\n") );
+ lprintf( LOGGING_FILE, TEXT("\n") );
+
+ break;
+
+ }
+
+ if ( add_to_verify ) {
+ delimiter = FS_GetDelimiterFromOSID( OS_id, OS_ver );
+ UI_AllocPathBuffer( &buffer, (UINT16) ( FS_SizeofFnameInFDB( fsh, dblk_ptr ) +
+ FS_SizeofOSPathInDDB( fsh, ddb_dblk_ptr ) + 5 ) ) ;
+ if ( buffer && file_buf ) {
+ UI_BuildDelimitedPathFromDDB( &buffer, fsh, ddb_dblk_ptr, delimiter, FALSE );
+
+ UI_AppendDelimiter( buffer, delimiter );
+ strcat( buffer, file_buf );
+
+ yresprintf( (INT16) RES_FILE_IS_DIFFERENT, buffer );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_FILE_IS_DIFFERENT, buffer );
+
+ UI_BuildFullPathFromDDB( &buffer, fsh, ddb_dblk_ptr, delimiter, FALSE );
+ UI_AppendDelimiter( buffer, delimiter );
+ strcat( buffer, file_buf );
+ lprintf( VERIFY_FILE, TEXT("%s%s%s\n"),
+ ( DLE_GetDeviceType( BSD_GetDLE( bsd_ptr ) ) == REMOTE_DOS_DRV ) ?
+ TEXT("+") : TEXT(""),
+ DLE_GetDeviceName( BSD_GetDLE( bsd_ptr ) ),
+ buffer );
+ }
+
+ }
+
+ }
+
+ }
+ break;
+
+ case MSG_TBE_ERROR:
+ {
+ INT16 error = va_arg( arg_ptr, INT16 );
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_ERROR);
+
+ UI_ProcessErrorCode( error, &response, tpos->channel );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+ }
+ break;
+
+ /* general messages */
+ case MSG_START_OPERATION:
+
+ lresprintf( LOGGING_FILE, LOG_START, FALSE );
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ /* display operation title in log file */
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, IDS_DLGTITLEJOBSTATVERIFY );
+
+ break;
+
+ case MSG_END_OPERATION: {
+
+ CHAR szPathSpec[MAX_UI_PATH_SIZE];
+ CHAR szFileName[MAX_UI_FILENAME_SIZE];
+
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ UI_FreePathBuffer( &path ) ;
+ UI_FreePathBuffer( &buffer ) ;
+ UI_FreePathBuffer( &file_buf ) ;
+
+ lresprintf( LOGGING_FILE, LOG_END );
+ UI_ChkDispGlobalError( );
+
+ /* force an update to the bytes counter */
+ num_bytes = ST_GetBSBytesProcessed ( &op_stats );
+
+ U64_Litoa( num_bytes, numeral, (INT16) 10, &stat ) ;
+ UI_BuildNumeralWithCommas( numeral );
+ yprintf(TEXT("%s\r"),numeral );
+ JobStatusBackupRestore( JOB_STATUS_BYTES_PROCESSED );
+
+ // If the verify worked, blow away VERIFY.BKS
+
+ if ( gb_error_during_operation != TRUE ) {
+
+ RSM_StringCopy( IDS_VERIFY_JOBNAME, szFileName, MAX_UI_FILENAME_LEN );
+
+ wsprintf ( szPathSpec, TEXT("%s%s%s"), CDS_GetUserDataPath(), szFileName, TEXT(".bks") );
+ remove ( szPathSpec ); // if not found, it was never there
+ }
+
+ break;
+ }
+
+ case MSG_START_BACKUP_SET:
+ {
+ DBLK_PTR vcb_ptr = va_arg( arg_ptr, DBLK_PTR );
+
+ UI_AllocPathBuffer( &buffer, UI_MAX_PATH_LENGTH * sizeof (CHAR) ) ;
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ root_counted = FALSE;
+ path_size = 0;
+ UI_FreePathBuffer( &path ) ;
+
+ FS_GetOSid_verFromVCB( vcb_ptr, &OS_id, &OS_ver );
+
+ BSD_SetOperStatus( bsd_ptr, SUCCESS );
+
+ dle = BSD_GetDLE( bsd_ptr );
+
+#ifdef OEM_EMS
+ RT_BSD_OsId = DLE_GetOsId( dle );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_FS_TYPE );
+#endif OEM_EMS
+
+ if ( DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_NETDRIVE );
+ }
+ else {
+ JobStatusBackupRestore( JOB_STATUS_VOLUME_HARDDRIVE );
+ }
+
+ yprintf(TEXT("%s\r"),BSD_GetTapeLabel( bsd_ptr ));
+ JobStatusBackupRestore( JOB_STATUS_SOURCE_NAME );
+
+ if ( buffer != NULL ) {
+
+ DLE_GetVolName( BSD_GetDLE( bsd_ptr ), buffer );
+ yprintf(TEXT("%s\r"), buffer );
+
+ JobStatusBackupRestore( JOB_STATUS_DEST_NAME );
+
+ qtc_bset = QTC_FindBset( BSD_GetTapeID( bsd_ptr ),
+ (INT16) -1 ,
+ BSD_GetSetNum( bsd_ptr ) );
+
+ if( qtc_bset ) {
+ qtc_header = QTC_LoadHeader( qtc_bset );
+ if ( qtc_header ) {
+ strcpy( buffer, qtc_header->volume_name );
+ free( qtc_header );
+ }
+ }
+ else {
+ strcpy( buffer, (CHAR_PTR)BSD_GetTapeLabel( bsd_ptr ) );
+ }
+
+ yresprintf( (INT16) RES_DISPLAY_VERIFY_INFO,
+ buffer ,
+ BSD_GetSetNum( bsd_ptr ),
+ BSD_GetTapeNum( bsd_ptr ),
+ (BSD_GetBackupLabel( bsd_ptr )!= NULL) ? (CHAR_PTR)BSD_GetBackupLabel( bsd_ptr ) : TEXT("\0") );
+
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_VERIFY_INFO,
+ buffer ,
+ BSD_GetSetNum( bsd_ptr ),
+ BSD_GetTapeNum( bsd_ptr ),
+ (BSD_GetBackupLabel( bsd_ptr ) != NULL) ? (CHAR_PTR)BSD_GetBackupLabel( bsd_ptr ) : TEXT("\0") ); // chs:05-18-93
+
+ }
+
+ delimiter = (CHAR)DLE_GetPathDelim( BSD_GetDLE( bsd_ptr ) );
+
+ ST_StartBackupSet( &op_stats );
+ UI_Time( &op_stats, (INT16) RES_VERIFY_STARTED, UI_START );
+
+#if defined ( OS_WIN32 )
+ DLE_GetVolName( BSD_GetDLE( bsd_ptr ), buffer );
+ OMEVENT_LogBeginVerify (buffer);
+#endif //defined ( OS_WIN32 )
+
+ clock_ready_flag = TRUE;
+
+ /* Init "searching" logic */
+ lw_search_first_time = TRUE;
+
+ open_script = FALSE;
+ }
+ break;
+
+ case MSG_END_BACKUP_SET:
+ {
+ INT16 res_id;
+
+
+ // update stats
+ clock_routine();
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ ST_EndBackupSet( &op_stats );
+
+ /* set backup set operation status to FILES_DIFFERENT if necessary */
+ if ( ST_GetFilesNotFound( &op_stats ) ||
+ ST_GetDirectoriesNotFound( &op_stats ) ||
+ ST_GetFilesDifferent( &op_stats ) ||
+ ST_GetDirectoriesDifferent( &op_stats ) ) {
+
+ BSD_SetOperStatus( bsd_ptr, FILES_DIFFERENT );
+ }
+
+ /* clear last displayed filename */
+ UI_ClearLastDisplayedFile( );
+
+ /* display and log any abort conditions */
+ UI_ConditionAtEnd( );
+
+ UI_Time( &op_stats, (INT16) RES_VERIFY_COMPLETED, UI_END );
+
+#if defined ( OS_WIN32 )
+ DLE_GetVolName( BSD_GetDLE( bsd_ptr ), buffer );
+ OMEVENT_LogEndVerify ( buffer,
+ gb_error_during_operation);
+#endif //defined ( OS_WIN32 )
+
+
+ clock_ready_flag = FALSE;
+
+
+ /* produce stats for dirs & files */
+ /* display number of files / number of dirs */
+ dle = BSD_GetDLE( bsd_ptr );
+ if ( DLE_GetDeviceType( dle ) != FS_EMS_DRV ) {
+
+ if( ST_GetFilesVerified( &op_stats ) == 1 &&
+ ST_GetBSDirsProcessed( &op_stats ) == 1) {
+ res_id = RES_VERIFIED_DIR_FILE;
+ }
+ else if( ST_GetFilesVerified( &op_stats ) == 1 &&
+ ST_GetBSDirsProcessed( &op_stats ) > 1) {
+ res_id = RES_VERIFIED_DIRS_FILE;
+ }
+ else if( ST_GetBSDirsProcessed( &op_stats ) == 1 &&
+ ST_GetFilesVerified( &op_stats ) > 1) {
+ res_id = RES_VERIFIED_DIR_FILES;
+ }
+ else {
+ res_id = RES_VERIFIED_DIRS_FILES;
+ }
+
+ yresprintf( res_id,
+ ST_GetFilesVerified( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetFilesVerified( &op_stats ),
+ ST_GetBSDirsProcessed( &op_stats ) );
+ }
+
+ /* display number of mac files verified */
+ if( ST_GetBSAFPFilesProcessed( &op_stats ) > 0 ) {
+
+ if ( ST_GetBSAFPFilesProcessed( &op_stats ) == 1 ) {
+ res_id = RES_VERIFIED_MAC;
+ }
+ else {
+ res_id = RES_VERIFIED_MACS;
+ }
+
+ yresprintf( res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetBSAFPFilesProcessed( &op_stats ) );
+
+ }
+
+ /* display number of files different */
+ if( ST_GetFilesDifferent( &op_stats ) == 1 ) {
+ res_id = RES_FILE_DIFFERENT;
+ }
+ else {
+ res_id = RES_FILES_DIFFERENT;
+ }
+
+ yresprintf( res_id, ST_GetFilesDifferent( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ /* log number of files different */
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetFilesDifferent( &op_stats ) );
+
+ /* display number of files not found */
+ if( ST_GetFilesNotFound( &op_stats ) > 0 ) {
+
+ if( ST_GetFilesNotFound( &op_stats ) == 1 ) {
+ res_id = RES_FILE_NOT_FOUND;
+ }
+ else {
+ res_id = RES_FILES_NOT_FOUND;
+ }
+
+ yresprintf( res_id,
+ ST_GetFilesNotFound( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetFilesNotFound( &op_stats ) );
+ }
+
+ /* display number of Directories not found */
+ if( ST_GetDirectoriesNotFound( &op_stats ) > 0 ) {
+
+ if( ST_GetDirectoriesNotFound( &op_stats ) == 1 ) {
+ res_id = RES_DIRECTORY_NOT_FOUND;
+ }
+ else {
+ res_id = RES_DIRECTORYS_NOT_FOUND;
+ }
+
+ yresprintf( res_id,
+ ST_GetDirectoriesNotFound( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetDirectoriesNotFound( &op_stats ) );
+ }
+
+ /* display number of security differences */
+ if( ST_GetNumSecurityDifferences( &op_stats ) > 0 ) {
+
+ if( ST_GetNumSecurityDifferences( &op_stats ) == 1 ) {
+ res_id = RES_SECURITY_DIFFERENCE;
+ }
+ else {
+ res_id = RES_SECURITY_DIFFERENCES;
+ }
+
+ yresprintf( res_id,
+ ST_GetNumSecurityDifferences( &op_stats ) );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, res_id,
+ ST_GetNumSecurityDifferences( &op_stats ) );
+ }
+
+ /* display number of bytes processed */
+ UI_BytesProcessed( &op_stats );
+
+ /* display verify rate */
+ UI_RateProcessed( &op_stats );
+
+ /* close the verify log file if it was used */
+ if( open_script ) {
+ lresprintf( VERIFY_FILE, LOG_END );
+ open_script = FALSE;
+ }
+
+ delimiter = TEXT('#'); /* = # for debug */
+ }
+ break;
+
+ case MSG_COMM_FAILURE:
+
+ gb_error_during_operation = TRUE;
+ yresprintf( (INT16) RES_COMM_FAILURE );
+ JobStatusBackupRestore( (WORD) JOB_STATUS_LISTBOX );
+ lresprintf( LOGGING_FILE, LOG_WARNING, SES_ENG_MSG, RES_COMM_FAILURE );
+ break;
+
+ case MSG_EOM:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ /* message for next tape is done during TF_NEED_NEW_TAPE */
+ break;
+
+ case MSG_STOP_CLOCK:
+ /* stop the clock with a start idle */
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ ST_StartBackupSetIdle( &op_stats );
+ break;
+
+ case MSG_START_CLOCK:
+ /* restart the clock with an end idle */
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ ST_EndBackupSetIdle( &op_stats );
+ break;
+
+ case MSG_ACCIDENTAL_VCB:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ case MSG_IDLE:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+ /* ignore these messages */
+ case MSG_IN_USE:
+ case MSG_PROMPT:
+ case MSG_BLOCK_DELETED:
+ case MSG_BYTES_DELETED:
+ case MSG_TAPE_STATS:
+ case MSG_CONT_VCB:
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+ break;
+
+// You know it !
+// We are talking kludge city here. Keep the error
+// message from being displayed to the user.
+
+#ifdef MS_RELEASE
+ case -533:
+ zprintf( DEBUG_TEMPORARY, TEXT("** -533 LOOPS ERROR **") );
+ break;
+#endif
+
+ default:
+ gb_error_during_operation = TRUE;
+
+ /* stop the clock with a start idle */
+ ST_StartBackupSetIdle( &op_stats );
+
+ eresprintf( RES_UNKNOWN_MSG_HNDLR_MSG, msg );
+
+ /* restart the clock with an end idle */
+ ST_EndBackupSetIdle( &op_stats );
+
+ break;
+ }
+
+ return( response );
+
+}
+
+static VOID OpenVerifyScript( op_stats_ptr, bsd_ptr, buffer )
+STATS_PTR op_stats_ptr;
+BSD_PTR bsd_ptr;
+CHAR_PTR buffer;
+{
+ time_t t_time;
+ CHAR date_str[MAX_UI_DATE_SIZE];
+ CHAR time_str[MAX_UI_TIME_SIZE];
+
+ lresprintf( VERIFY_FILE, LOG_START, FALSE );
+ DLE_GetVolName( BSD_GetDLE( bsd_ptr ), buffer );
+
+ t_time = ST_GetBSStartTime( op_stats_ptr );
+ UI_LongToDate( date_str, t_time );
+ UI_LongToTime( time_str, t_time );
+
+ lresprintf( VERIFY_FILE, LOG_MSG, SES_ENG_MSG, RES_VERIFY_SCRIPT_HEADER,
+ buffer,
+ DLE_GetDeviceName( BSD_GetDLE( bsd_ptr ) ),
+ date_str,
+ time_str );
+
+ return;
+
+}
+
+
+/*****************************************************************************
+
+ Name: PromptNextTape
+
+ Description: Function to collect user response when a new tape is
+ required from the Tape Format/Tape positioner.
+
+ Returns: UI_ABORT_POSITIONING or UI_NEW_TAPE_INSERTED
+
+*****************************************************************************/
+static INT16 PromptNextTape(
+TPOS_PTR tpos,
+DBLK_PTR cur_vcb,
+BOOLEAN valid_vcb_flag,
+UINT16 mode,
+CHAR_PTR tape,
+CHAR_PTR drive )
+{
+ INT response;
+ CHAR temp[ MAX_UI_RESOURCE_SIZE ];
+ INT16 prev_yes_flag;
+
+ zprintf( DEBUG_USER_INTERFACE, RES_UI_TPOS_TAPE_SET, tape, tpos->tape_seq_num, tpos->backup_set_num );
+
+ prev_yes_flag = CDS_GetYesFlag( CDS_GetCopy() );
+ CDS_SetYesFlag( CDS_GetCopy(), NO_FLAG );
+
+ switch ( mode ) {
+
+ case TF_READ_CONTINUE:
+
+ if ( valid_vcb_flag &&
+ ( FS_ViewTapeIDInVCB( cur_vcb ) == (UINT32)( tpos->tape_id ) ) &&
+ ( FS_ViewTSNumInVCB( cur_vcb ) == (UINT16)( tpos->tape_seq_num - 1 ) ) ) {
+
+ response = WM_MessageBox( ID( IDS_MSGTITLE_CONTINUE ),
+ ID( RES_CONTINUE_QUEST ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ NULL, 0, 0 );
+ } else {
+
+ RSM_Sprintf( temp, ID(RES_INSERT_NEXT_TAPE),
+ tpos->tape_seq_num,
+ BE_GetCurrentDeviceName( tpos->channel ) );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ response = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ ID( RES_NEED_NEXT_TAPE_REWOUND ), // chs:05-10-93
+ WMMB_OKCANCEL,
+ WMMB_ICONQUESTION,
+ temp,
+ IDRBM_LTAPE, 0 );
+ }
+ break;
+
+ case TF_READ_OPERATION:
+ default:
+
+ if ( valid_vcb_flag &&
+ ( FS_ViewTapeIDInVCB( cur_vcb ) == (UINT32)( tpos->tape_id ) ) &&
+ ( FS_ViewTSNumInVCB( cur_vcb ) == (UINT16)( tpos->tape_seq_num - 1 ) ) ) {
+
+ RSM_Sprintf( temp, ID(RES_INSERT_NEXT_TAPE_REWOUND), // chs:05-10-93
+ tpos->tape_seq_num,
+ BE_GetCurrentDeviceName( tpos->channel ) );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ response = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ ID( RES_NEED_NEXT_TAPE_REWOUND ), // chs:05-10-93
+ WMMB_OKCANCEL,
+ WMMB_ICONQUESTION,
+ temp,
+ IDRBM_LTAPE, 0 );
+ } else {
+
+ RSM_Sprintf( temp, ID(RES_TAPE_REQUEST), drive, tape,
+ ( tpos->tape_seq_num == -1) ? 1 : tpos->tape_seq_num );
+
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_NEEDTAPE);
+ response = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ temp,
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ),
+ 0, 0 );
+ }
+ break;
+
+ }
+
+ if ( response ) {
+#ifdef OS_WIN32
+ NtDemoChangeTape( (UINT16)(( tpos->tape_seq_num == -1) ? 1u : tpos->tape_seq_num ) );
+ tape_retries = mwTapeSettlingCount ;
+#endif
+ response = UI_NEW_TAPE_INSERTED;
+ }
+ else {
+ response = UI_HAPPY_ABORT;
+ }
+
+ CDS_SetYesFlag( CDS_GetCopy(), prev_yes_flag );
+
+ return( (INT16)response );
+}
+
+INT UI_GetVerifyCurrentStatus(
+STATS *Stats,
+CHAR *Path,
+INT PathSize )
+{
+
+
+ return( SUCCESS );
+}
diff --git a/private/utils/ntbackup/src/docproc.c b/private/utils/ntbackup/src/docproc.c
new file mode 100644
index 000000000..1b0e56273
--- /dev/null
+++ b/private/utils/ntbackup/src/docproc.c
@@ -0,0 +1,1561 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: docproc.c
+
+ Description: This file contains the functions for processing messages
+ sent by windows to MDI Document windows. It also handles
+ the resizing of listboxes and the slider within the
+ MDI Document.
+
+ The following routines are in this module:
+
+ WM_MDIDocWndProc
+ WM_DocListWndProc
+ WM_DocActivate
+ WM_DocCommandProc
+ WM_DocCreate
+ WM_DocIsMenuChange
+ WM_DocQueryClose
+ WM_DocSize
+ WM_DocKeyDown
+ WM_DocSplit
+
+ $Log: G:\UI\LOGFILES\DOCPROC.C_V $
+
+ Rev 1.41.1.1 10 Mar 1994 16:54:36 Glenn
+Added support for positioning MDI doc in viewing area if out of frame and desktop.
+
+ Rev 1.41.1.0 27 Jan 1994 13:36:48 Glenn
+Added F5 Refresh support.
+
+ Rev 1.41 28 Jul 1993 16:57:10 MARINA
+enable c++
+
+ Rev 1.40 07 May 1993 14:22:14 DARRYLP
+Added Rob's fixes for Windows double clicks and ID_DELETE key trappings.
+
+ Rev 1.39 27 Apr 1993 19:14:00 GLENN
+Ifdef'd the sort code.
+
+ Rev 1.38 22 Apr 1993 15:59:18 GLENN
+Added file SORT option support.
+
+ Rev 1.37 16 Oct 1992 15:48:18 GLENN
+Added pdsHdr stuff to list box proc kill focus.
+
+ Rev 1.36 14 Oct 1992 15:48:18 GLENN
+Added Selection Framing Support for List Boxes without the FOCUS.
+
+ Rev 1.35 04 Oct 1992 19:33:24 DAVEV
+Unicode Awk pass
+
+ Rev 1.34 02 Oct 1992 16:45:44 GLENN
+Fixed left hand side of slider for NT.
+
+ Rev 1.33 28 Sep 1992 17:05:10 GLENN
+Casted the MIN_LISTBOX_WIDTH define.
+
+ Rev 1.32 17 Aug 1992 13:05:24 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.31 28 Jul 1992 14:53:04 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.30 10 Jun 1992 16:20:16 GLENN
+Took out ClipCursor() for NT.
+
+ Rev 1.29 15 May 1992 13:32:36 MIKEP
+nt pass 2
+
+ Rev 1.28 30 Apr 1992 14:40:06 DAVEV
+OEM_MSOFT: Fix View-All File Details
+
+ Rev 1.27 20 Apr 1992 13:57:50 GLENN
+Fixed dlm/list box problem. Renamed global variables to module wides.
+
+ Rev 1.26 08 Apr 1992 13:41:52 ROBG
+Exclude border when calculating the region of the listbox to capture mouse.
+
+ Rev 1.25 02 Apr 1992 14:52:54 JOHNWT
+fixed mouse trap
+
+ Rev 1.24 31 Mar 1992 11:53:20 GLENN
+NT change: do not change cursor to pen for NT only.
+
+ Rev 1.23 25 Mar 1992 08:37:24 ROBG
+Fixed the problem about UAEs when dragging the mouse outside a listbox.
+
+ Rev 1.22 19 Mar 1992 15:49:10 GLENN
+Removed temporary multi task.
+
+ Rev 1.21 17 Mar 1992 19:09:00 GLENN
+Still working on list proc and doc proc.
+
+ Rev 1.20 10 Mar 1992 16:45:08 GLENN
+Put some switch points in for debugging.
+
+ Rev 1.19 09 Mar 1992 16:59:20 ROBG
+changed
+
+ Rev 1.18 09 Mar 1992 09:45:44 GLENN
+Fixed bug in maximize.
+
+ Rev 1.17 03 Mar 1992 18:20:02 GLENN
+Overhauled the proc functions.
+
+ Rev 1.16 18 Feb 1992 20:43:36 GLENN
+Changed SetWindowText() to WM_SetTitle().
+
+ Rev 1.15 11 Feb 1992 17:25:52 GLENN
+Changed DLM_KeyUp() parameter for new prototype.
+
+ Rev 1.14 06 Feb 1992 18:35:00 STEVEN
+fix typeo in NTKLUG
+
+ Rev 1.13 04 Feb 1992 16:08:30 STEVEN
+various bug fixes for NT
+
+ Rev 1.12 02 Feb 1992 16:34:04 GLENN
+Fixed slider/keyboard focus problem.
+
+ Rev 1.11 29 Jan 1992 18:07:02 GLENN
+Checked tree list box type before processing keys.
+
+ Rev 1.10 22 Jan 1992 12:37:44 GLENN
+Updated KEYDOWN and FOCUS areas.
+
+ Rev 1.9 07 Jan 1992 17:25:50 GLENN
+Added MDI split/slider support
+
+ Rev 1.8 26 Dec 1991 13:48:54 GLENN
+Added ability to block a doc restore/maximize during an operation
+
+ Rev 1.7 17 Dec 1991 15:29:02 ROBG
+Added handling of unwanted double clicks in hierarchical list boxes.
+
+ Rev 1.6 12 Dec 1991 17:07:42 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.5 10 Dec 1991 13:45:24 GLENN
+Added feature to create a single-column list box
+
+ Rev 1.4 05 Dec 1991 17:53:50 GLENN
+Changed Close/Destroy sequencing.
+
+ Rev 1.3 04 Dec 1991 15:16:20 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.2 03 Dec 1991 16:16:18 GLENN
+Added WM_DocKeyDown() call.
+
+ Rev 1.1 27 Nov 1991 12:09:30 GLENN
+Added parameter to DLM_DispListTerm().
+
+ Rev 1.0 20 Nov 1991 19:18:44 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// PRIVATE DEFINES
+
+#define MIN_LISTBOX_WIDTH ((INT)70)
+
+// MODULE WIDE GLOBAL VARIABLES.
+
+static RECT mwRectOldSlider;
+static BOOL mwfLButtonDown = FALSE;
+static BOOL mwfSliding = FALSE;
+static BOOL mwfInCheckBox = FALSE;
+
+
+// PRIVATE FUNCTION PROTOTYPES
+
+VOID WM_DocCreate ( HWND, LONG );
+VOID WM_DocSize ( HWND, INT, INT );
+BOOL WM_DocCommandProc ( HWND, MP1, MP2 );
+BOOL WM_DocQueryClose ( HWND );
+SHORT WM_DocSetSliderPos ( HWND hWnd, WORD wStyle, SHORT sNewSliderPos );
+
+
+
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: WM_MDIDocWndProc()
+
+ Description: This function is called internally by Windows when events
+ occur relating to MDI document windows.
+
+ Returns: NULL or a default message handler's return code.
+
+******************************************************************************/
+
+WINRESULT APIENTRY WM_MDIDocWndProc (
+
+HWND hWnd, // I - window handle of the list box
+MSGID msg, // I - message
+MP1 mp1, // I - another message parameter
+MP2 mp2 ) // I - yet another message parameter
+
+{
+
+ switch ( msg ) {
+
+ case WM_CREATE: // Do some creation initialization stuff.
+
+ WM_DocCreate ( hWnd, mp2 );
+ return 0;
+
+ case WM_MOVE:
+
+ if ( ! IsIconic ( ghWndFrame ) ) {
+
+ RECT rcIntersect;
+ RECT rcDesktop;
+ RECT rcFrame;
+ RECT rcWnd;
+
+ // Check for frame compliance, then for desktop window compliance.
+
+ GetWindowRect ( GetDesktopWindow(), &rcDesktop );
+ GetWindowRect ( ghWndFrame, &rcFrame );
+ GetWindowRect ( hWnd, &rcWnd );
+
+ if ( ! IntersectRect ( &rcIntersect, &rcFrame, &rcWnd ) &&
+ ! IntersectRect ( &rcIntersect, &rcDesktop, &rcWnd ) ) {
+
+ DM_CenterDialog( hWnd );
+ }
+ }
+
+ break;
+
+ case WM_MDIACTIVATE: { // If we're activating this child, remember it.
+
+ PDS_WMINFO pdsWinInfo;
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ if ( pdsWinInfo ) {
+
+ // If mp1 is TRUE, the child is being activated,
+ // else, deactivated.
+ // if ( mp1 ) { ** DVC - This is not true for portable code:
+ // ** we must compare the handle of the
+ // ** window being activated to our own
+ // ** (I think - it's worth a try!!
+
+ if (hWnd == GET_WM_MDIACTIVATE_ACTIVATE (mp1, mp2)) {
+
+ RIB_Activate ( pdsWinInfo->hRibbon );
+
+ MUI_ActivateDocument ( pdsWinInfo->wType );
+ ghWndActiveDoc = hWnd;
+
+ // SetFocus ( hWnd );
+
+ if ( ! IsIconic ( hWnd ) ) {
+ SetFocus ( pdsWinInfo->hWndActiveList );
+ }
+ }
+ }
+
+ // return 0;
+ }
+
+ case WM_QUERYDRAGICON: {
+
+ // Get the MDI Document so that windows will automatically use it
+ // to create a cursor for dragging this window unique icon.
+
+ PDS_WMINFO pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ return (LONG)pdsWinInfo->hIcon;
+
+ }
+
+ case WM_QUERYOPEN:
+
+ // If an operation is going on, do not allow the user to open
+ // an icon.
+
+ if ( gfOperation ) {
+ return FALSE;
+ }
+
+ return TRUE;
+
+ case WM_SETCURSOR: // Set the right cursor for this window.
+
+ // In help mode it is necessary to reset the cursor in response
+ // to every WM_SETCURSOR message.Otherwise, by default, Windows
+ // will reset the cursor to that of the window class.
+
+ if ( HM_SetCursor ( hWnd ) ) {
+ return 0;
+ }
+
+ if ( ( hWnd == (HWND)mp1 ) && ( LOWORD(mp2) == HTCLIENT ) ) {
+
+ PDS_WMINFO pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ RSM_CursorSet ( pdsWinInfo->hCursor );
+ return 0;
+ }
+
+ break;
+
+ case WM_KEYDOWN:
+
+ // This should only occur if there is sliding going on.
+
+ if ( mwfSliding ) {
+
+ POINT Point;
+ RECT Rect;
+
+ GetCursorPos ( &Point );
+ GetClientRect ( hWnd, &Rect );
+
+ switch ( LOWORD ( mp1 ) ) {
+
+ case VK_LEFT:
+
+ SetCursorPos ( Point.x - 1, Point.y );
+ break;
+
+ case VK_RIGHT:
+
+ SetCursorPos ( Point.x + 1, Point.y );
+ break;
+
+ case VK_RETURN:
+
+ WM_DocSetSliderMode ( hWnd, WMDOC_SLIDEROFF );
+ break;
+
+ case VK_ESCAPE:
+
+ WM_DocSetSliderMode ( hWnd, WMDOC_SLIDERCANCEL );
+ break;
+ }
+
+ return 0;
+
+ }
+
+ break;
+
+ case WM_LBUTTONDOWN:
+
+ if ( HM_ContextLbuttonDown( hWnd, mp1, mp2 ) == TRUE ) {
+ return 0 ;
+ }
+
+ // Fall through if Help is not called
+
+ case WM_LBUTTONDBLCLK:
+
+ WM_DocSetSliderMode ( hWnd, WMDOC_SLIDERON );
+ return 0;
+
+ case WM_LBUTTONUP:
+
+ WM_DocSetSliderMode ( hWnd, WMDOC_SLIDEROFF );
+ return 0;
+
+ case WM_LBTRACKPOINT:
+
+ return DLM_WMTrackPoint ( hWnd, mp1, mp2 );
+
+ case WM_MOUSEMOVE:
+
+ // If the cursor/mouse is being moved while the left button is down
+ // in the slider region, reposition a temporary slider to the new
+ // cursor/mouse position.
+
+ if ( mwfLButtonDown ) {
+
+ WM_DocSetSliderPos ( hWnd, WMDOC_SLIDERMOVE, (SHORT)LOWORD(mp2) );
+ }
+
+ return 0;
+
+ case WM_SIZE: {
+
+ PDS_WMINFO pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ // Change the title if this window is minimized, maximized, or restored.
+
+ switch ( mp1 ) {
+
+ case SIZEICONIC:
+
+ if ( WMDS_GetWinMinTitle ( pdsWinInfo ) ) {
+ WM_SetMinTitle ( hWnd, WMDS_GetWinMinTitle ( pdsWinInfo ) );
+ }
+
+ // Hide the list boxes.
+
+ if ( IsWindow ( WMDS_GetWinTreeList ( pdsWinInfo ) ) ) {
+ ShowWindow ( WMDS_GetWinTreeList ( pdsWinInfo ), SW_HIDE );
+ }
+
+ if ( IsWindow ( WMDS_GetWinFlatList ( pdsWinInfo ) ) ) {
+ ShowWindow ( WMDS_GetWinFlatList ( pdsWinInfo ), SW_HIDE );
+ }
+
+ break;
+
+ case SIZENORMAL:
+ case SIZEFULLSCREEN:
+
+ if ( WMDS_GetWinTitle ( pdsWinInfo ) ) {
+ WM_SetTitle ( hWnd, WMDS_GetWinTitle ( pdsWinInfo ) );
+ }
+
+ // Show the list boxes.
+
+ if ( IsWindow ( WMDS_GetWinTreeList ( pdsWinInfo ) ) ) {
+ ShowWindow ( WMDS_GetWinTreeList ( pdsWinInfo ), SW_SHOWNA );
+ }
+
+ if ( IsWindow ( WMDS_GetWinFlatList ( pdsWinInfo ) ) ) {
+ ShowWindow ( WMDS_GetWinFlatList ( pdsWinInfo ), SW_SHOWNA );
+ }
+
+ // Size the list box(es).
+
+ WM_DocSize ( hWnd, LOWORD(mp2), HIWORD(mp2) );
+
+ break;
+ }
+
+ break;
+ }
+
+ case WM_PAINT: // Make sure that the paint is handled appropriately.
+
+ if ( IsIconic ( hWnd ) ) {
+
+ PDS_WMINFO pdsWinInfo;
+ PAINTSTRUCT ps;
+ HDC hDC;
+ INT nOldBkMode;
+
+ hDC = BeginPaint ( hWnd, &ps );
+
+ nOldBkMode = SetBkMode( hDC, TRANSPARENT );
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+ RSM_IconDraw ( pdsWinInfo->hIcon, 0, 0, hDC );
+ SetBkMode( hDC, nOldBkMode );
+
+ EndPaint ( hWnd, &ps );
+
+ return 0;
+ }
+
+ break;
+
+ case WM_QUERYENDSESSION:
+
+ return WM_DocQueryClose ( hWnd );
+
+ case WM_CLOSE: { // Close or minimize the window.
+
+ PDS_WMINFO pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ // Minimize the window if it is not closable (a primary doc).
+ // Otherwise, deinitialize and destroy the window.
+
+ if ( ! pdsWinInfo->wClosable ) {
+ PostMessage( hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0L );
+ }
+ else {
+ WM_Destroy ( hWnd );
+ }
+
+ return 0;
+ }
+
+ case WM_DESTROY: { // Destroy the window and any child windows.
+
+ PDS_WMINFO pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ // Destroy any list boxes in the MDI doc window.
+
+ if ( pdsWinInfo->hWndTreeList ) {
+ DestroyWindow ( pdsWinInfo->hWndTreeList );
+ DLM_DispListTerm ( pdsWinInfo, pdsWinInfo->hWndTreeList );
+ }
+
+ if ( pdsWinInfo->hWndFlatList ) {
+ DestroyWindow ( pdsWinInfo->hWndFlatList );
+ DLM_DispListTerm ( pdsWinInfo, pdsWinInfo->hWndFlatList );
+ }
+
+ // Free up any memory associated with the win info structure.
+
+ if ( pdsWinInfo->pTitle ) {
+ free ( pdsWinInfo->pTitle );
+ }
+
+ if ( pdsWinInfo->pMinTitle ) {
+ free ( pdsWinInfo->pMinTitle );
+ }
+
+ // Now, call the application to free up any memory.
+
+ VLM_CloseWin ( hWnd );
+
+ return 0;
+ }
+
+ case WM_SETFOCUS:
+
+ if ( ! mwfSliding && ! IsIconic ( hWnd ) ) {
+
+ // Set the focus to the list box that had it previously for this
+ // MDI Document.
+
+ PDS_WMINFO pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ if ( pdsWinInfo ) {
+ SetFocus ( pdsWinInfo->hWndActiveList );
+ }
+
+ return 0;
+ }
+
+ break;
+
+ case WM_DRAWITEM:
+
+ return DLM_WMDrawItem( hWnd, (LPDRAWITEMSTRUCT) mp2 );
+
+ case WM_MEASUREITEM:
+
+ return DLM_WMMeasureItem( hWnd, (LPMEASUREITEMSTRUCT) mp2 );
+
+ case WM_DELETEITEM:
+
+ return DLM_WMDeleteItem( hWnd, (LPDELETEITEMSTRUCT) mp2 );
+
+ case WM_COMMAND:
+
+ if ( ! WM_DocCommandProc ( hWnd, mp1, mp2 ) ) {
+
+ // The command was processed.
+
+ return 0;
+ }
+
+ break;
+
+ } /* end switch */
+
+ // Pass on through to the default proc.
+
+ return DefMDIChildProc ( hWnd, msg, mp1, mp2 );
+
+} /* end WM_MDIDocWndProc() */
+
+
+/******************************************************************************
+
+ Name: WM_DocListWndProc()
+
+ Description: This function is a SUB-CLASS function of LIST BOXES for
+ the GUI MDI documents. It is called internally by Windows.
+ Windows calls this function when list box messages must be
+ processed. Windows will only call this routine for
+ MDI documents in this application.
+
+ Returns: NULL or a default message handler's return code.
+
+******************************************************************************/
+
+WINRESULT APIENTRY WM_DocListWndProc (
+
+HWND hWnd, // I - window handle of the list box
+MSGID msg, // I - message
+MP1 mp1, // I - another message parameter
+MP2 mp2 ) // I - yet another message parameter
+
+{
+
+ switch ( msg ) {
+
+# ifdef NTKLUG
+ case WM_DLMGETTEXT:
+ msg = LB_GETTEXT;
+ break;
+# endif
+ case WM_KEYDOWN:
+
+ // Pass the key to the Ribbon Window(s) and the Display List Manager.
+ // Note: the key will not be passed to the next function if the
+ // previous function used it.
+
+ if ( HM_KeyDown ( hWnd, mp1 ) ||
+ RIB_KeyDown ( ghWndMainRibbon, RIB_KEYBOARD, mp1, mp2 ) ||
+ WM_DocKeyDown ( hWnd, LOWORD ( mp1 ) ) ||
+ DLM_KeyDown ( hWnd, (LPWORD)&mp1, mp2 ) ) {
+
+ return 0;
+ }
+
+ break;
+
+ case WM_KEYUP:
+
+ // Pass the key to the Ribbon Window(s) and the Display List Manager.
+ // Note: the key will not be passed to the next function if the
+ // previous function used it.
+
+ if ( RIB_KeyUp ( ghWndMainRibbon, RIB_KEYBOARD, mp1, mp2 ) ||
+ DLM_KeyUp ( hWnd, (LPWORD)&mp1, mp2 ) ) {
+
+ return 0;
+ }
+
+ break;
+
+ case WM_MOUSEMOVE:
+
+ // Store the point in a global variable for the DLM.
+
+ WM_FromMP2toPOINT( gDLMpt, mp2 );
+
+ if ( DLM_CursorInCheckBox ( hWnd, gDLMpt ) ) {
+
+ mwfInCheckBox = TRUE;
+
+ }
+ else {
+
+ mwfInCheckBox = FALSE;
+ }
+
+ break;
+
+ case WM_SETCURSOR:
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ if ( mwfInCheckBox && ( hWnd == (HWND)mp1 ) && ( LOWORD(mp2) == HTCLIENT ) ) {
+
+ RSM_CursorSet ( ghCursorPen );
+ return 0;
+ }
+
+# endif
+
+ break;
+
+ case WM_SETFOCUS: {
+
+ mwfInCheckBox = FALSE;
+
+ DLM_UpdateFocus ( hWnd, TRUE );
+
+ break;
+ }
+
+ // When the left button goes down, keep the cursor within the listbox.
+ // Windows 3.0 and 3.1 have a problem when you drag the cursor
+ // outside of the listbox.
+
+ case WM_LBUTTONDOWN: {
+
+ DLM_HEADER_PTR pdsHdr = DLM_GetDispHdr( hWnd );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ if ( DLM_GMode( pdsHdr ) != DLM_HIERARCHICAL ) {
+
+ RECT dsRect;
+
+ // Take the borders and scroll bars out of the rectangle .
+
+ GetWindowRect( hWnd, &dsRect );
+
+ dsRect.top = dsRect.top + GetSystemMetrics( SM_CYBORDER );
+ dsRect.bottom = dsRect.bottom - GetSystemMetrics( SM_CYBORDER );
+ dsRect.left = dsRect.left + GetSystemMetrics( SM_CYBORDER );
+ dsRect.right = dsRect.right - GetSystemMetrics( SM_CXBORDER );
+
+ ClipCursor( &dsRect );
+
+ }
+ }
+# endif
+
+ break;
+ }
+
+ case WM_KILLFOCUS: {
+
+ DLM_UpdateFocus ( hWnd, FALSE );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+
+ DLM_HEADER_PTR pdsHdr = DLM_GetDispHdr( hWnd );
+
+ if ( DLM_GMode( pdsHdr ) != DLM_HIERARCHICAL ) {
+
+ ClipCursor( NULL );
+ }
+ }
+# endif
+
+ break;
+ }
+
+ case WM_LBUTTONUP:
+ case WM_NCLBUTTONUP: {
+
+ // When the left button goes up, allow the cursor to move anywhere
+ // in the frame again.
+
+ DLM_HEADER_PTR pdsHdr = DLM_GetDispHdr( hWnd );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ if ( DLM_GMode( pdsHdr ) != DLM_HIERARCHICAL ) {
+
+ ClipCursor( NULL );
+ }
+ }
+# endif
+
+ break;
+
+ }
+
+
+ case WM_LBUTTONDBLCLK: {
+
+ DLM_HEADER_PTR pdsHdr = DLM_GetDispHdr( hWnd );
+
+ if ( pdsHdr ) {
+
+ if ( DLM_GetTrkPtFailure( pdsHdr ) ) {
+
+ // Ignore the double click. This field
+ // is set in DLM_WMTrackPoint to 1 if the
+ // double click should be ignored.
+
+ return TRUE;
+ }
+ }
+
+ break;
+
+ }
+
+ case WM_SYSCOMMAND:
+ break;
+
+ case WM_PAINT: {
+
+ HWND hWndParent = GetParent ( hWnd );
+
+ // If the parent is iconic/minimized, no need to repaint, because
+ // this window is not shown anyway.
+
+ if ( IsIconic ( hWndParent ) ) {
+
+ PAINTSTRUCT ps;
+ HDC hDC;
+
+ hDC = BeginPaint ( hWnd, &ps );
+
+ // Paint the parent (MDI Doc) icon, if iconic.
+
+ EndPaint ( hWnd, &ps );
+ return TRUE;
+ }
+
+ break;
+ }
+
+ case WM_NCPAINT:
+ break;
+
+ case WM_ERASEBKGND:
+
+ if ( IsIconic ( GetParent ( hWnd ) ) ) {
+ return 0;
+ }
+
+ break;
+
+ } /* end switch () */
+
+ return CallWindowProc ( (VOID *)glpfnOldListProc, hWnd, msg, mp1, mp2 );
+
+} /* end WM_DocListWndProc() */
+
+
+/******************************************************************************
+
+ Name: WM_DocActivate()
+
+ Description: This function tells the MDI client to activate the
+ specified MDI document. If the document is minimized or
+ iconic, the document will be resored to the size and
+ position that it was prior to minimization.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_DocActivate (
+
+HWND hWnd ) // I - handle to a MDI document window
+
+{
+ if ( IsIconic ( hWnd ) ) {
+
+ SendMessage( ghWndMDIClient, WM_MDIRESTORE, (MP1)hWnd, 0L );
+ }
+
+ SendMessage( ghWndMDIClient, WM_MDIACTIVATE, (MP1)hWnd, 0L );
+
+} /* end WM_DocActivate() */
+
+
+/******************************************************************************
+
+ Name: WM_DocCommandProc()
+
+ Description: This function is called by WM_MDIDocWndProc when a
+ command message is sent by windows to a MDI document
+ window.
+
+ Returns: FALSE, if the command was processed. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL WM_DocCommandProc (
+
+HWND hWnd, // I - handle to an MDI document window
+MP1 mp1, // I - the ID of the list box for the command
+MP2 mp2 ) // I - just another parameter to pass the DLM
+
+{
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case WMIDC_TREELISTBOX:
+ case WMIDC_FLATLISTBOX:
+
+ return DLM_LBNmessages ( hWnd, mp1, mp2 );
+
+ default:
+ break;
+
+ } /* end switch */
+
+ return TRUE;
+
+} /* end WM_DocCommandProc() */
+
+
+/******************************************************************************
+
+ Name: WM_DocCreate()
+
+ Description: This function is called by WM_MDIDocWndProc when an
+ MDI document has been created. Depending on the type
+ of document window created, one or two list boxes will
+ be created inside the document. If there are two
+ list boxes created, a slider bar will separate them.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_DocCreate (
+
+HWND hWnd, // I - handle to a MDI document window
+LONG mp2 ) // I - an indirect pointer to a WMINFO structure
+ // to be attached to the doc window's extra bytes
+
+{
+ PDS_WMINFO pdsWinInfo;
+ DWORD dwWindowState;
+
+ // Menu stuff.
+ // Ribbon stuff.
+ // Display List stuff.
+ // Cursor stuff.
+ // More stuff.
+ //
+
+ // Get and set the window information pointer.
+
+ pdsWinInfo = (PDS_WMINFO)((LPMDICREATESTRUCT)((LPCREATESTRUCT)mp2)->lpCreateParams)->lParam;
+ pdsWinInfo->hWnd = hWnd;
+ WM_SetInfoPtr ( hWnd, pdsWinInfo );
+ dwWindowState = WMDS_GetWindowState ( pdsWinInfo );
+
+ // Create the TREE list box ONLY SINGLE COLUMN AT THIS TIME.
+
+ if ( dwWindowState & WMDOC_TREESC ) {
+
+ pdsWinInfo->hWndTreeList = CreateWindow ( WMCLASS_LISTBOX,
+ NULL,
+ WM_TREELISTBOX,
+ 0,
+ 0,
+ 0,
+ 0,
+ hWnd,
+ (HMENU)WMIDC_TREELISTBOX,
+ ghInst,
+ (LPSTR)NULL
+ );
+
+ WM_SubClassListBox ( pdsWinInfo->hWndTreeList );
+ }
+
+ // Create the FILE list box.
+
+ if ( ( dwWindowState & WMDOC_FLATMC ) || ( dwWindowState & WMDOC_FLATSC ) ) {
+
+ pdsWinInfo->hWndFlatList = CreateWindow ( WMCLASS_LISTBOX,
+ NULL,
+ ( ( dwWindowState & WMDOC_FLATMC ) ? WM_FLATLISTBOXMC : WM_FLATLISTBOXSC ),
+ 0,
+ 0,
+ 0,
+ 0,
+ hWnd,
+ (HMENU)WMIDC_FLATLISTBOX,
+ ghInst,
+ (LPSTR)NULL
+ );
+
+ WM_SubClassListBox ( pdsWinInfo->hWndFlatList );
+ }
+
+ // Create a View Window.
+
+ if ( ( dwWindowState == WMDOC_VIEWWIN ) ) {
+
+ pdsWinInfo->hWndFlatList = CreateWindow ( WMCLASS_VIEWWIN,
+ NULL,
+ WMSTYLE_VIEWWIN,
+ 0,
+ 0,
+ 0,
+ 0,
+ hWnd,
+ (HMENU)WMIDC_FLATLISTBOX,
+ ghInst,
+ (LPSTR)NULL
+ );
+
+ }
+
+ if ( pdsWinInfo->hWndTreeList ) {
+ WMDS_SetWinActiveList ( pdsWinInfo, WMDS_GetWinTreeList ( pdsWinInfo ) );
+ }
+ else {
+ WMDS_SetWinActiveList ( pdsWinInfo, WMDS_GetWinFlatList ( pdsWinInfo ) );
+ }
+
+
+
+} /* end WM_DocCreate() */
+
+
+/******************************************************************************
+
+ Name: WM_DocIsMenuChange()
+
+ Description: This function is called by WM_FrameCmdHandler when a
+ menu message is sent by windows to the frame window that
+ affects the way an MDI document is displayed.
+
+ Returns: TRUE, if the message affected an MDI document.
+ Otherwise, FALSE.
+
+******************************************************************************/
+
+WORD WM_DocIsMenuChange (
+
+HWND hWnd,
+WORD mp1 )
+
+{
+ PDS_WMINFO pdsWinInfo;
+ RECT Rect;
+ WORD msg = 0;
+
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ GetClientRect ( hWnd, &Rect );
+
+ switch ( mp1 ) {
+
+ case IDM_VIEWTREEANDDIR:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_TREEANDDIR ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_TREEANDDIR | ( pdsWinInfo->dwMenuState & ~MMDOC_TREEGROUP );
+ pdsWinInfo->nSliderPos = WM_SLIDERUNKNOWN;
+
+ WM_DocSize ( hWnd, Rect.right, Rect.bottom );
+ msg = ID_TREEANDFLAT;
+ }
+
+ break;
+
+ case IDM_VIEWTREEONLY:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_TREEONLY ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_TREEONLY | ( pdsWinInfo->dwMenuState & ~MMDOC_TREEGROUP );
+ pdsWinInfo->nSliderPos = WM_SLIDERMAX;
+
+ WM_DocSize ( hWnd, Rect.right, Rect.bottom );
+ msg = ID_TREEONLY;
+ }
+
+ break;
+
+ case IDM_VIEWDIRONLY:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_DIRONLY ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_DIRONLY | ( pdsWinInfo->dwMenuState & ~MMDOC_TREEGROUP );
+ pdsWinInfo->nSliderPos = WM_SLIDERMIN;
+
+ WM_DocSize ( hWnd, Rect.right, Rect.bottom );
+ msg = ID_FLATONLY;
+ }
+
+ break;
+
+ case IDM_VIEWALLFILEDETAILS:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_FILEDETAILS ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_FILEDETAILS | ( pdsWinInfo->dwMenuState & ~MMDOC_FILEGROUP );
+ msg = ID_FILEDETAILS;
+ }
+ else {
+
+ pdsWinInfo->dwMenuState = MMDOC_NAMEONLY | ( pdsWinInfo->dwMenuState & ~MMDOC_FILEGROUP );
+ msg = ID_NAMEONLY;
+ }
+ break;
+
+# ifndef OEM_MSOFT
+ {
+ case IDM_VIEWSORTNAME:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_SORTNAME ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_SORTNAME | ( pdsWinInfo->dwMenuState & ~MMDOC_SORTGROUP );
+ msg = ID_SORTNAME;
+ }
+ break;
+
+ case IDM_VIEWSORTTYPE:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_SORTTYPE ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_SORTTYPE | ( pdsWinInfo->dwMenuState & ~MMDOC_SORTGROUP );
+ msg = ID_SORTTYPE;
+ }
+ break;
+
+ case IDM_VIEWSORTSIZE:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_SORTSIZE ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_SORTSIZE | ( pdsWinInfo->dwMenuState & ~MMDOC_SORTGROUP );
+ msg = ID_SORTSIZE;
+ }
+ break;
+
+ case IDM_VIEWSORTDATE:
+
+ if ( ! ( pdsWinInfo->dwMenuState & MMDOC_SORTDATE ) ) {
+
+ pdsWinInfo->dwMenuState = MMDOC_SORTDATE | ( pdsWinInfo->dwMenuState & ~MMDOC_SORTGROUP );
+ msg = ID_SORTDATE;
+ }
+ break;
+
+ }
+# endif
+
+ } /* end switch */
+
+ return msg;
+
+} /* end WM_DocIsMenuChange() */
+
+
+/******************************************************************************
+
+ Name: WM_DocQueryClose()
+
+ Description: This function is called by WM_MDIDocWndProc when a
+ MDI document has been told to close.
+
+ Returns: TRUE, if it is OK to close. Otherwise, FALSE.
+
+******************************************************************************/
+
+BOOL WM_DocQueryClose (
+
+HWND hWnd )
+
+{
+ DBG_UNREFERENCED_PARAMETER ( hWnd );
+ return TRUE;
+
+} /* end WM_DocQueryClose() */
+
+
+/******************************************************************************
+
+ Name: WM_DocSize()
+
+ Description: This function is called by WM_MDIDocWndProc when an
+ MDI document has been resized. If there is a slider in
+ the window, it will be repositioned in the window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_DocSize (
+
+HWND hWnd, // I - handle to a MDI document window
+INT nWidth, // I - the width of the document
+INT nHeight ) // I - the height of the document
+
+{
+ PDS_WMINFO pdsWinInfo;
+ DWORD dwWindowState;
+ INT nSliderWidth;
+ INT nSliderPos;
+ HWND hWndOldFocus;
+
+
+ // Save the handle to the window that has the current focus. Then set the
+ // focus to no window.
+
+ hWndOldFocus = GetFocus ();
+
+ SetFocus ( (HWND)NULL );
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+ dwWindowState = pdsWinInfo->dwWindowState;
+
+ // Determine status of TREE and VIEW menu items. Remember, if a slider
+ // is all the way to the left (MIN), there will be no tree list box
+ // displayed.
+ // If a slider is all the way to the right (MAX), there will be no flat
+ // list box displayed. However, both of these constraints are true only
+ // if the MDI Document window has both tree and flat list boxes.
+
+ // If there is a slider, reposition it's rectangle.
+
+ if ( dwWindowState & WMDOC_SLIDER ) {
+
+ nSliderWidth = gnBorderWidth;
+
+ switch ( pdsWinInfo->nSliderPos ) {
+
+ case WM_SLIDERMIN:
+
+ nSliderPos = 0;
+ break;
+
+ case WM_SLIDERMAX:
+
+ nSliderPos = nWidth - nSliderWidth;
+ break;
+
+ case WM_SLIDERUNKNOWN:
+
+ if (nWidth == 0 ) {
+ nSliderPos = 0;
+ nSliderWidth = 0;
+ break ;
+ }
+
+ pdsWinInfo->nSliderPos = ( dwWindowState & WMDOC_TREEANDFLAT ) ?
+ ( nWidth - nSliderWidth ) / 2 : 0;
+
+ default:
+
+ nSliderPos = pdsWinInfo->nSliderPos;
+ break;
+
+ }
+ }
+ else {
+ nSliderWidth = 0;
+ nSliderPos = 0;
+ }
+
+ // If there is a file list, resize it's list box.
+
+ if ( ( dwWindowState & WMDOC_FLATSC ) || ( dwWindowState & WMDOC_FLATMC ) ) {
+
+ // WM_Hide ( pdsWinInfo->hWndFlatList );
+
+ WM_MoveWindow ( pdsWinInfo->hWndFlatList,
+ nSliderPos + nSliderWidth,
+ 0,
+ nWidth - ( nSliderPos + nSliderWidth ),
+ nHeight,
+ TRUE
+ );
+
+ }
+
+ // If there is a tree list, resize it's list box.
+
+ if ( dwWindowState & WMDOC_TREESC ) {
+
+ // WM_Hide ( pdsWinInfo->hWndTreeList );
+
+ WM_MoveWindow ( pdsWinInfo->hWndTreeList,
+ 0,
+ 0,
+ nSliderPos,
+ nHeight,
+ TRUE
+ );
+
+ }
+
+ // For View window, flat listbox window handle is the handle.
+
+ if ( dwWindowState == WMDOC_VIEWWIN ) {
+
+ WM_MoveWindow ( pdsWinInfo->hWndFlatList,
+ 0,
+ 0,
+ nWidth,
+ nHeight,
+ TRUE
+ );
+ }
+
+// WM_MultiTask ();
+
+ SetFocus ( hWndOldFocus );
+
+} /* end WM_DocSize() */
+
+
+/******************************************************************************
+
+ Name: WM_DocKeyDown()
+
+ Description: This function processes a key down message if a keyboard
+ key was pressed.
+
+ Returns: TRUE, if the key was used. Otherwise, FALSE.
+
+******************************************************************************/
+
+BOOL WM_DocKeyDown (
+
+HWND hWnd, // I - list box window handle
+WORD wKey ) // I - key information parameter
+
+{
+ WORD wVirKey = wKey;
+ BOOL fKeyUsed = TRUE;
+ BOOL fControlDown = ( GetKeyState ( VK_CONTROL ) < 0 ) ? TRUE : FALSE;
+ BOOL fShiftDown = ( GetKeyState ( VK_SHIFT ) < 0 ) ? TRUE : FALSE;
+ BOOL fTreeWindow = WM_IsTreeActive ( WM_GetInfoPtr ( GetParent ( hWnd ) ) );
+ BOOL wType = WMDS_GetWinType ( WM_GetInfoPtr ( GetParent ( hWnd ) ) );
+
+ if ( wVirKey == VK_CONTROL || wVirKey == VK_SHIFT ) {
+ return FALSE;
+ }
+
+ if ( wVirKey == VK_DELETE ) {
+
+ wVirKey = 0;
+ VLM_ChangeSettings(wKey, 0L);
+ return TRUE;
+ }
+
+ // Do the refresh if F5.
+
+ if ( wVirKey == VK_F5 && ! fControlDown && ! fShiftDown ) {
+
+ VLM_Refresh ( );
+ return TRUE;
+ }
+
+ // Do this only if it is a Disk or Tape Tree.
+
+ if ( fTreeWindow && ( wType == WMTYPE_DISKTREE
+ || wType == WMTYPE_TAPETREE
+#ifdef OEM_EMS
+ || wType == WMTYPE_EXCHANGE
+#endif
+ ) ) {
+
+ switch ( wVirKey ) {
+
+ case VK_8:
+
+ if ( ! fShiftDown ) {
+ break;
+ }
+
+ // Just fall through, since it is a shifted '8' or a '*'
+
+ case VK_MULTIPLY:
+
+ if ( fControlDown ) {
+ wKey = ID_EXPANDALL;
+ }
+ else {
+ wKey = ID_EXPANDBRANCH;
+ }
+
+ break;
+
+ case VK_SUBTRACT:
+ case VK_OEM_MINUS:
+
+ wKey = ID_COLLAPSEBRANCH;
+ break;
+
+ case VK_ADD:
+ case VK_OEM_PLUS:
+
+ wKey = ID_EXPANDONE;
+ break;
+
+ case VK_UP:
+
+ if ( fControlDown ) {
+ wKey = ID_CTRLARROWUP;
+ }
+ else {
+ fKeyUsed = FALSE;
+ }
+
+ break;
+
+ case VK_DOWN:
+
+ if ( fControlDown ) {
+ wKey = ID_CTRLARROWDOWN;
+ }
+ else {
+ fKeyUsed = FALSE;
+ }
+
+ break;
+
+ case VK_LEFT:
+
+ wKey = ID_ARROWLEFT;
+ break;
+
+ case VK_RIGHT:
+
+ wKey = ID_ARROWRIGHT;
+ break;
+
+ default:
+
+ fKeyUsed = FALSE;
+
+ } /* end switch */
+
+
+ if ( fKeyUsed ) {
+ VLM_ChangeSettings ( wKey, 0L );
+ }
+
+ }
+ else {
+ fKeyUsed = FALSE;
+ }
+
+ return fKeyUsed;
+
+} /* end WM_DocKeyDown() */
+
+
+/******************************************************************************
+
+ Name: WM_DocSetSliderMode()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_DocSetSliderMode (
+
+HWND hWnd, // I - handle to a MDI document window
+WORD wSliderMode ) // I - mode turning on/off the split window slider
+
+{
+ PDS_WMINFO pdsWinInfo;
+ DWORD dwWindowState;
+ INT nSliderPos;
+ RECT Rect;
+ POINT Point;
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+ dwWindowState = pdsWinInfo->dwWindowState;
+
+ // Determine status of TREE and VIEW menu items. Remember, if a slider
+ // is all the way to the left (MIN), there will be no tree list box
+ // displayed.
+ // If a slider is all the way to the right (MAX), there will be no flat
+ // list box displayed. However, both of these constraints are true only
+ // if the MDI Document window has both tree and flat list boxes.
+
+
+ if ( ! mwfSliding && ( dwWindowState & WMDOC_SLIDER ) && ( wSliderMode == WMDOC_SLIDERON ) ) {
+
+ GetCursorPos ( &Point );
+ ScreenToClient ( hWnd, &Point );
+
+ WM_DocSetSliderPos ( hWnd, WMDOC_SLIDERON, (SHORT)Point.x );
+
+ mwfLButtonDown = TRUE;
+ mwfSliding = TRUE;
+
+ SetCapture ( hWnd );
+ SetFocus ( hWnd );
+ }
+ else if ( mwfSliding && ( wSliderMode == WMDOC_SLIDEROFF || wSliderMode == WMDOC_SLIDERCANCEL ) ) {
+
+ nSliderPos = (INT)WM_DocSetSliderPos ( hWnd, WMDOC_SLIDEROFF, 0 );
+
+ // If the mouse position is different from the slider position,
+ // reset the slider position to the current mouse position and
+ // resize the MDI Document window.
+
+ if ( wSliderMode == WMDOC_SLIDEROFF && nSliderPos != pdsWinInfo->nSliderPos ) {
+
+ GetClientRect ( hWnd, &Rect );
+
+ if ( nSliderPos >= ( Rect.right - ( gnBorderWidth + MIN_LISTBOX_WIDTH ) ) ) {
+
+ VLM_ChangeSettings ( (INT16) ID_TREEONLY, 0L );
+ pdsWinInfo->dwMenuState = MMDOC_TREEONLY | ( pdsWinInfo->dwMenuState & ~MMDOC_TREEGROUP );
+ pdsWinInfo->nSliderPos = WM_SLIDERMAX;
+ }
+ else if ( nSliderPos <= ( gnBorderWidth + MIN_LISTBOX_WIDTH ) ) {
+
+ VLM_ChangeSettings ( (INT16) ID_FLATONLY, 0L );
+ pdsWinInfo->dwMenuState = MMDOC_DIRONLY | ( pdsWinInfo->dwMenuState & ~MMDOC_TREEGROUP );
+ pdsWinInfo->nSliderPos = WM_SLIDERMIN;
+ }
+ else {
+
+ VLM_ChangeSettings ( (INT16) ID_TREEANDFLAT, 0L );
+ pdsWinInfo->dwMenuState = MMDOC_TREEANDDIR | ( pdsWinInfo->dwMenuState & ~MMDOC_TREEGROUP );
+ pdsWinInfo->nSliderPos = nSliderPos;
+ }
+
+ WM_DocSize ( hWnd, Rect.right, Rect.bottom );
+
+ }
+
+ mwfLButtonDown = FALSE;
+ mwfSliding = FALSE;
+
+ ReleaseCapture ();
+
+ SetFocus ( WMDS_GetWinActiveList ( pdsWinInfo ) );
+ }
+
+} /* end WM_DocSetSliderMode() */
+
+
+/******************************************************************************
+
+ Name: WM_DocSetSliderPos()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+SHORT WM_DocSetSliderPos (
+
+HWND hWnd, // I - handle to an MDI document window
+WORD wStyle, // I - mouse message
+SHORT sNewSliderPos ) // I - the new slider position
+
+{
+ HDC hDC;
+ RECT Rect;
+ SHORT sOldSliderPos;
+
+ hDC = GetDC ( hWnd );
+
+ // If we are turning on the slider, set the old position.
+ // Otherwise, remove the old slider.
+
+ if ( wStyle == WMDOC_SLIDERON ) {
+ sOldSliderPos = sNewSliderPos;
+ }
+ else {
+ InvertRect ( hDC, &mwRectOldSlider );
+ sOldSliderPos = (SHORT)mwRectOldSlider.left;
+ }
+
+ // If there is a new slider to be drawn, draw it.
+
+ if ( wStyle != WMDOC_SLIDEROFF ) {
+
+ GetClientRect ( hWnd, &Rect );
+
+ Rect.left = sNewSliderPos;
+ Rect.right = sNewSliderPos + 4;
+
+ mwRectOldSlider = Rect;
+
+// memcpy ( &mwRectOldSlider, &Rect, sizeof ( RECT ) );
+
+ InvertRect ( hDC, &Rect );
+ }
+
+ ReleaseDC ( hWnd, hDC );
+
+ return sOldSliderPos;
+
+} /* end WM_DocSetSliderPos() */
diff --git a/private/utils/ntbackup/src/drives.c b/private/utils/ntbackup/src/drives.c
new file mode 100644
index 000000000..12e7ecd56
--- /dev/null
+++ b/private/utils/ntbackup/src/drives.c
@@ -0,0 +1,1771 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: drives.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the most drive related functions.
+
+
+ $Log: T:/LOGFILES/DRIVES.C_V $
+
+ Rev 1.50.1.7 12 Aug 1994 14:54:22 GREGG
+Make sure the drive block size is one the app can deal with in SetupDriveList.
+
+ Rev 1.50.1.6 06 Jul 1994 18:34:30 GREGG
+In Erase, report no tape as a TFLE, not TF and ignore TF returns from Rewind.
+
+ Rev 1.50.1.5 17 Feb 1994 18:00:52 GREGG
+Stop sending TFLEs to the UI tpos routine in Erase and Rewind.
+
+ Rev 1.50.1.4 11 Feb 1994 16:42:20 GREGG
+Ignore GEN_ERR_NO_MEDIA return from TpDismount. EPR 948-0278
+
+ Rev 1.50.1.3 28 Jan 1994 11:27:00 GREGG
+Handle GEN_ERR_UNRECOGNIZED_MEDIA returned on reads as well as mounts.
+
+ Rev 1.50.1.2 17 Dec 1993 16:40:12 GREGG
+Extended error reporting.
+
+ Rev 1.50.1.1 16 Nov 1993 23:13:00 GREGG
+Modified the way we control hardware compression from software to work around
+a bug in Archive DAT DC firmware rev. 3.58 (we shipped a lot of them).
+Files Modified: lw_data.c, lw_data.h, tfstuff.c, mtf10wdb.c, mtf10wt.c and
+ drives.c
+
+ Rev 1.50.1.0 08 Nov 1993 21:22:52 GREGG
+Put fixes in revs 1.55-1.57 in branch for Orcas.
+
+ Rev 1.50 29 Jul 1993 14:08:04 DON
+NLM only! Make the NLM code act the same for GEN_ERR_NO_MEDIA
+and GEN_ERR_UNRECOGNIZED_MEDIA
+
+ Rev 1.49 07 Jun 1993 08:32:52 MIKEP
+warning fix.
+
+ Rev 1.48 04 Jun 1993 18:42:58 GREGG
+Check for GEN_ERR_ENDSET return when writing a filemark. This shouldn't
+happen, but tell that to the HP DAT!
+
+ Rev 1.47 19 May 1993 17:41:16 GREGG
+Check for failure of TpSpecial SS_GET_DRV_INFO.
+
+ Rev 1.46 12 Apr 1993 22:48:04 GREGG
+Removed 297 TABS!!! Also removed stupid stuff from function headers.
+
+ Rev 1.45 11 Apr 1993 17:50:26 GREGG
+Expect GEN_ERR_RESET return from format command in EraseDrive.
+
+ Rev 1.44 09 Apr 1993 11:44:54 GREGG
+Dismount and remount the tape after it is formatted.
+
+ Rev 1.43 08 Apr 1993 11:07:26 GREGG
+Added debug print to WriteEndSet.
+
+ Rev 1.42 07 Apr 1993 20:38:38 GREGG
+Don't rewind first in EraseDrive if command is 'format'.
+
+ Rev 1.41 30 Mar 1993 16:15:54 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.40 04 Feb 1993 18:25:34 ZEIR
+Brought forward Loader changes (OS_NLM only)
+
+ Rev 1.39 30 Jan 1993 11:19:38 DON
+Removed compiler warnings
+
+ Rev 1.38 21 Jan 1993 16:12:56 GREGG
+Added parameter to calls to TpSeek and TpGetPosition.
+
+ Rev 1.37 20 Jan 1993 17:32:18 BobR
+Changes to MOVE_ESA macro calls
+
+ Rev 1.36 18 Jan 1993 15:11:36 BobR
+Added MOVE_ESA macro call(s)
+
+ Rev 1.35 18 Jan 1993 14:09:52 GREGG
+Changes to allow format command passed to driver through TpErase.
+
+ Rev 1.34 11 Nov 1992 22:27:22 GREGG
+Chanded EraseDrive to do only security or non-security erase.
+
+ Rev 1.33 23 Oct 1992 15:17:48 GREGG
+Removes msassert wrapped around UI tpos call. (oops)
+
+ Rev 1.32 02 Oct 1992 16:14:32 HUNTER
+Add check for TpOpen() failure in SetUpDriveList().
+
+ Rev 1.31 22 Sep 1992 09:13:54 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.30 17 Aug 1992 09:01:28 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.29 23 Jul 1992 10:33:16 GREGG
+Fixed warnings.
+
+ Rev 1.28 28 Mar 1992 18:23:06 GREGG
+ROLLER BLADES - OTC - Initial integration.
+
+ Rev 1.27 25 Mar 1992 18:18:36 GREGG
+ROLLER BLADES - Fixed GotoBlock to work with any physical/logical block size combination.
+
+ Rev 1.26 25 Mar 1992 14:57:48 NED
+reset TPS_NEW_TAPE and TPS_RESET bits
+
+ Rev 1.25 20 Mar 1992 18:02:12 NED
+added exception updating after TpReceive calls
+
+ Rev 1.24 03 Mar 1992 12:24:16 GREGG
+DisMount if rewind flag set and there's more than one drive in
+ResetChannelList.
+
+ Rev 1.23 19 Feb 1992 16:13:00 NED
+added DON's changes from 1.19.1.0->1.19.1.1 to trunk (ThreadSwitch)
+
+ Rev 1.22 08 Feb 1992 14:34:34 GREGG
+Changed check for lst_oper == -1 to check for boolean force_rewind, since
+this is what the lst_oper field in the drive structure had been reduced to.
+Also set force_rewind in cases where we know we have a new tape, but it
+won't be deteced by the call to TpMount (it only gets reported once), or
+where the driver had to rewind on DisMount to take the drive out of read/
+write mode and we want to tell the caller this happened.
+
+ Rev 1.21 03 Jan 1992 13:30:18 NED
+added DumpDebug() call
+
+ Rev 1.20 05 Dec 1991 13:50:44 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.19 02 Dec 1991 13:45:20 GREGG
+Return a reasonable error code from RewindDrive.
+
+ Rev 1.18 25 Nov 1991 10:06:58 GREGG
+Added ThreadSwitches after TpInit and TpAuto calls to keep that silly NLM happy.
+
+ Rev 1.17 18 Oct 1991 14:06:46 GREGG
+BIGWHEEL - Added missing break in case in MountTape for PollDrive cleanup.
+
+ Rev 1.16 17 Oct 1991 01:25:06 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.15 15 Oct 1991 07:57:54 GREGG
+Added ThreadSwitch call in empty TpReceive loops.
+
+ Rev 1.14 14 Oct 1991 11:18:06 GREGG
+Modified MountTape's handling of busy poll state to deal with changes made to
+PollDrive. UpdateDriveStatus now returns INT16 and actually reports drive
+failures!
+
+ Rev 1.13 09 Oct 1991 12:02:12 GREGG
+If NextDriveInChannel hits the end of the channel list, and rewind is
+requested, dismount the tape. * * * NOTE: This is a KLUDGE FIX!!!
+It should be investigated and fixed correctly when time allows.
+
+ Rev 1.12 07 Oct 1991 22:15:34 GREGG
+Reset drive position after tension operation.
+
+ Rev 1.11 28 Sep 1991 21:47:04 GREGG
+Removed BE_Zprintf's from UpdateDriveStatus.
+
+ Rev 1.10 17 Sep 1991 13:34:20 GREGG
+Added TF_MOUNTING message to MountTape.
+
+ Rev 1.9 09 Sep 1991 23:05:40 GREGG
+Added init of new drive struct elements and modified MountTape for TF_PollDrive.
+
+ Rev 1.8 21 Aug 1991 14:40:50 GREGG
+Added RewindDriveImmediate for TF_RewindAllDrives.
+
+ Rev 1.7 22 Jul 1991 13:03:30 GREGG
+Added debug printf to drive init routine.
+
+ Rev 1.6 15 Jul 1991 15:13:12 NED
+Removed unnecessary rewinds.
+
+ Rev 1.5 01 Jul 1991 10:51:18 NED
+Removed CH_AT_EOM
+
+ Rev 1.4 06 Jun 1991 22:53:18 NED
+Moved all the positioning functions to tflutils.c, and added CAST to
+remove a warning.
+
+ Rev 1.3 03 Jun 1991 10:43:48 NED
+added parameter to MoveToVCB().
+
+ Rev 1.2 20 May 1991 15:41:42 DAVIDH
+Cleared up Watcom warnings for defined, but not referenced parameters.
+
+ Rev 1.1 10 May 1991 16:17:02 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:11:52 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+
+#include <memory.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "queues.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "tfl_err.h"
+#include "lw_data.h"
+#include "lwprotos.h"
+#include "translat.h"
+#include "sx.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "genstat.h"
+#include "dddefs.h"
+
+/* Debug Stuff */
+#include "be_debug.h"
+
+VOID InitializeTapeBlockSize( void ) ;
+
+/**/
+/**
+
+ Name: ResetChannelList
+
+ Description: Resets the current drive pointer to the head of the
+ channel list.
+
+ Returns: Returns an Error code, or Zero is successful.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 ResetChannelList( CHANNEL_PTR channel, /* The channel we want to reset */
+ BOOLEAN rew_cur_drv ) /* Rewind current Drive */
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN is_tape_present ;
+ Q_ELEM_PTR prev_drive, drv_head ;
+
+ if ( rew_cur_drv ) {
+ (void) RewindDrive( channel->cur_drv, NULL, FALSE, TRUE, channel->mode ) ;
+ }
+
+ /* If there is actually more than one drive in the system */
+ if( channel->cur_drv->thw_inf.channel_link.q_next != NULL ||
+ channel->cur_drv->thw_inf.channel_link.q_prev != NULL ) {
+
+ if ( rew_cur_drv ) {
+ (void) DisMountTape( channel->cur_drv, NULL, FALSE ) ;
+ }
+
+ drv_head = prev_drive = ( Q_ELEM_PTR ) &channel->cur_drv->thw_inf.channel_link ;
+ while ( ( prev_drive = QueuePrev( prev_drive ) ) != NULL ) {
+ drv_head = prev_drive ;
+ }
+
+ if( drv_head ) {
+
+ channel->cur_drv = ( DRIVE_PTR ) GetQueueElemPtr( drv_head ) ;
+
+ ret_val = MountTape( channel->cur_drv, NULL, &is_tape_present ) ;
+
+ } else {
+ ret_val = TF_END_CHANNEL ;
+ }
+
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: NextDriveInChannel
+
+ Description: This closes the current drive in the channel. And then
+ opens the next drive in the channel.
+
+ Returns: An error code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 NextDriveInChannel(
+ CHANNEL_PTR channel, /* The channel you want to use */
+ BOOLEAN rew_cur_drv ) /* Rewind the Current Drive */
+{
+ Q_ELEM_PTR nxt_elem ;
+ DRIVE_PTR nxt_drive ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN is_tape_present ;
+
+ nxt_elem = QueueNext( ( Q_ELEM_PTR ) &channel->cur_drv->thw_inf.channel_link ) ;
+
+ if( nxt_elem ) {
+ nxt_drive = ( DRIVE_PTR ) GetQueueElemPtr( nxt_elem ) ;
+
+ /* DisMount This tape */
+ DisMountTape( channel->cur_drv, NULL, rew_cur_drv ) ;
+
+ if( ( ret_val = MountTape( nxt_drive, NULL, &is_tape_present ) ) == TFLE_NO_ERR ) {
+ channel->cur_drv = nxt_drive ;
+ /* Someone wanted a rewind */
+ if( is_tape_present && channel->cur_drv->force_rewind ) {
+ RewindDrive( channel->cur_drv, channel->ui_tpos, TRUE, TRUE, channel->mode ) ;
+ channel->cur_drv->force_rewind = FALSE ;
+ }
+ }
+ } else {
+ if( rew_cur_drv ) {
+ DisMountTape( channel->cur_drv, channel->ui_tpos, rew_cur_drv ) ;
+ }
+ ret_val = TF_END_CHANNEL ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: PrevDriveInChannel
+
+ Description: Switches to the previous drive in the channel.
+
+ Returns: An Error Code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+
+INT16 PrevDriveInChannel(
+ CHANNEL_PTR channel, /* The channel you want to use */
+ BOOLEAN rew_cur_drv ) /* Rewind Current Drive */
+{
+ Q_ELEM_PTR prev_elem ;
+ DRIVE_PTR prev_drive ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN is_tape_present ;
+
+ prev_elem = QueuePrev( ( Q_ELEM_PTR ) &channel->cur_drv->thw_inf.channel_link ) ;
+
+ if( prev_elem ) {
+
+ /* DisMount This tape */
+ DisMountTape( channel->cur_drv, NULL, rew_cur_drv ) ;
+
+ prev_drive = ( DRIVE_PTR ) GetQueueElemPtr( prev_elem ) ;
+
+ if( !( ret_val = MountTape( prev_drive, NULL, &is_tape_present ) ) ) {
+ channel->cur_drv = prev_drive ;
+ /* Someone wanted a rewind */
+ if( is_tape_present && channel->cur_drv->force_rewind ) {
+ RewindDrive( channel->cur_drv, channel->ui_tpos, TRUE, TRUE, channel->mode ) ;
+ channel->cur_drv->force_rewind = FALSE ;
+ }
+ }
+ } else {
+ ret_val = TF_END_CHANNEL ;
+ }
+
+ return( ret_val ) ;
+
+}
+
+/**/
+/**
+
+ Name: RewindDrive
+
+ Description: Rewinds the current drive in the channel and resets all the
+ appropriate fields.
+
+ Returns: An Error code if there is a problem.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 RewindDrive(
+ DRIVE_PTR curDRV , /* the current drive */
+ TPOS_PTR ui_tpos , /* To tell him i'ma workin' */
+ BOOLEAN call_ui , /* Should we call the user interface */
+ BOOLEAN reset_flg , /* Should we reset the counters */
+ UINT16 mode ) /* the mode we're in */
+{
+ INT16 drv_hdl = curDRV->drv_hdl ;
+ UINT16 i = 1 ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ RET_BUF myret ;
+
+ if ( ui_tpos == NULL ) {
+ call_ui = FALSE ;
+ }
+
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_REWIND_DRIVE_HDL, drv_hdl ) ;
+
+ if( call_ui ) {
+ ui_tpos->UI_TapePosRoutine( TF_REWINDING, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, mode ) ;
+ }
+
+ myret.gen_error = GEN_NO_ERR ;
+
+ /* This logic is to handle the case that we have read exactly to the filemark
+ on tape, and since the last read did not fail, the filemark will be reported
+ on this rewind call. So if we get a filemark error on rewind ( I mean how
+ stupid are these drives ), kill the error queue, and recall TpRewind */
+ do {
+ if( TpRewind( drv_hdl, FALSE ) == SUCCESS ) {
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ if( call_ui ) {
+ /* Move ESA info directly to TPOS instead of going
+ through THW for optimal speed
+ */
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+
+ (*ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, mode ) ;
+ } else {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ }
+ } else {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( curDRV->thw_inf.the, myret.the ) ;
+
+ /* This is to fix the Archive drives unwillingness to report an exception */
+ if( myret.gen_error == GEN_ERR_NO_MEDIA || myret.gen_error == GEN_RESET ) {
+ curDRV->vcb_valid = FALSE ;
+ }
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_DRV_RET, myret.gen_error ) ;
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ DumpDebug( drv_hdl ) ;
+ }
+ } while( ret_val == TFLE_NO_ERR && myret.gen_error != GEN_NO_ERR && i-- ) ;
+
+ if( myret.gen_error ) {
+ ret_val = MapGenErr2UIMesg( myret.gen_error ) ;
+ if ( call_ui && !IsTFLE( ret_val ) ) {
+ (*ui_tpos->UI_TapePosRoutine)( ret_val, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, mode ) ;
+ }
+ }
+
+ if( reset_flg ) {
+ ResetDrivePosition( curDRV ) ;
+ }
+
+ SetPosBit( curDRV, AT_BOT ) ;
+
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_RET_VAL_EQUALS, ret_val ) ;
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: EraseDrive
+
+ Description:
+
+ Modified: 11/10/1989 11:9:26
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 EraseDrive(
+ CHANNEL_PTR channel,
+ BOOLEAN security, /* as opposed to write a filemark only */
+ BOOLEAN format ) /* for DC 2000 */
+{
+ INT16 drv_hdl = channel->cur_drv->drv_hdl, ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ RET_BUF myret ;
+ BOOLEAN is_tape_present = TRUE ;
+ BOOLEAN tp_ret ;
+
+ BE_Zprintf( 0, TEXT("EraseDrive() security=%d\n"), security ) ;
+
+ /* Make sure error condition is reset first */
+ myret.gen_error = GEN_NO_ERR ;
+
+ /* Rewind, as we are probably in a read state */
+ if( security && !format ) {
+ if( ( ret_val = RewindDrive( channel->cur_drv, channel->ui_tpos, TRUE,
+ TRUE, channel->mode ) ) != TFLE_NO_ERR ) {
+
+ /* If we get an error, we return it immediatly, otherwise
+ it's just a message and we ignore it.
+ */
+ if ( IsTFLE( ret_val ) ) {
+ return( ret_val ) ;
+ } else {
+ ret_val = TFLE_NO_ERR ;
+ }
+ }
+ }
+
+ /* Possible Write Protect Error! */
+ if( (*channel->ui_tpos->UI_TapePosRoutine)( TF_ERASING, channel->ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ channel->mode )
+ == UI_ABORT_POSITIONING ) {
+
+ return( TFLE_USER_ABORT ) ;
+ }
+
+ if( security ) {
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_CALLING_ERASE );
+ if( format ) {
+ tp_ret = TpErase( drv_hdl, ERASE_TYPE_FORMAT ) ;
+ } else {
+ tp_ret = TpErase( drv_hdl, ERASE_TYPE_SECURITY ) ;
+ }
+ if( tp_ret == SUCCESS ) {
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* Move ESA info directly to TPOS instead of going
+ through THW for optimal speed
+ */
+ MOVE_ESA( channel->ui_tpos->the, myret.the ) ;
+
+ (*channel->ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK,
+ channel->ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ channel->mode ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+ } else {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ }
+
+ if( myret.gen_error != GEN_NO_ERR && myret.gen_error != GEN_ERR_RESET ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ if( myret.gen_error == GEN_ERR_NO_MEDIA ) {
+ ret_val = TFLE_NO_TAPE ;
+ } else {
+ ret_val = MapGenErr2UIMesg( myret.gen_error ) ;
+ }
+ if ( !IsTFLE( ret_val ) ) {
+ (*channel->ui_tpos->UI_TapePosRoutine)( ret_val,
+ channel->ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ channel->mode ) ;
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ return( ret_val ) ;
+ }
+
+ if( format ) {
+ /* Make sure the stupid thing has it's head on straight! */
+ (void) DisMountTape( channel->cur_drv, NULL, FALSE ) ;
+ ret_val = MountTape( channel->cur_drv, NULL, &is_tape_present ) ;
+ if( ret_val != TFLE_NO_ERR ) {
+
+ if ( !IsTFLE( ret_val ) ) {
+ (*channel->ui_tpos->UI_TapePosRoutine)( ret_val,
+ channel->ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ channel->mode ) ;
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ return( ret_val ) ;
+ }
+ }
+
+ if( ( ret_val = RewindDrive( channel->cur_drv, channel->ui_tpos, TRUE,
+ TRUE, channel->mode ) ) != TFLE_NO_ERR ) {
+
+ /* If we get an error, we return it immediatly, otherwise
+ it's just a message and we ignore it.
+ */
+ if ( IsTFLE( ret_val ) ) {
+ return( ret_val ) ;
+ } else {
+ ret_val = TFLE_NO_ERR ;
+ }
+ }
+
+ InitializeTapeBlockSize( ) ;
+
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_CALLING_WRITE_END_SET );
+ if( TpWriteEndSet( drv_hdl ) != SUCCESS ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( channel->ui_tpos->the, myret.the ) ;
+
+ (*channel->ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK,
+ channel->ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ channel->mode ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ ret_val = MapGenErr2UIMesg( myret.gen_error ) ;
+ if ( !IsTFLE( ret_val ) ) {
+ (*channel->ui_tpos->UI_TapePosRoutine)( ret_val,
+ channel->ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ channel->mode ) ;
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ return( ret_val ) ;
+ }
+
+ ret_val = RewindDrive( channel->cur_drv, channel->ui_tpos, TRUE, TRUE, channel->mode ) ;
+
+ /* If the return is just a message, ignore it. */
+ if ( !IsTFLE( ret_val ) ) {
+ ret_val = TFLE_NO_ERR ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: RetensionDrive
+
+ Description: Retension the tape in the current drive.
+
+ Returns: Nothing
+
+ Notes: THE ui_tpos ROUTINE MUST BE VALID BEFORE THIS IS CALLED.
+
+ Declaration:
+
+**/
+
+INT16 RetensionDrive( CHANNEL_PTR channel )
+{
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ RET_BUF myret ;
+
+ /* Inform Ernie of the Start */
+ channel->ui_tpos->UI_TapePosRoutine( TF_RETENSIONING, channel->ui_tpos, curDRV->vcb_valid,
+ &curDRV->cur_vcb, channel->mode ) ;
+
+ if( TpRetension( channel->cur_drv->drv_hdl ) == FAILURE ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( channel->ui_tpos->the, myret.the ) ;
+
+ if( (*channel->ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, channel->ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, channel->mode )
+ == UI_ABORT_POSITIONING ) {
+ ret_val = TFLE_USER_ABORT ;
+ break ;
+ }
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ } else {
+ ResetDrivePosition( curDRV ) ;
+ SetPosBit( curDRV, AT_BOT ) ;
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: CloseDrive
+
+ Description: Close the specified drive.
+
+ Returns: An error code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 CloseDrive(
+ DRIVE_PTR drive ,
+ TPOS_PTR ui_tpos ,
+ UINT16 mode ,
+ BOOLEAN rewind )
+{
+ RET_BUF myret ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_CLOSE_DRIVE ) ;
+
+ if( drive->thw_inf.drv_info.drv_features
+ & TDI_DRV_COMPRES_INIT ) {
+ TpSpecial( drive->drv_hdl, SS_SET_DRV_COMPRESSION, ENABLE_DRV_COMPRESSION ) ;
+ } else {
+ TpSpecial( drive->drv_hdl, SS_SET_DRV_COMPRESSION, DISABLE_DRV_COMPRESSION ) ;
+ }
+
+ /* Somebody has told us not to really close the drive, We are
+ probably in the middle of a set */
+ if( !IsPosBitSet( drive, DONT_CLOSE ) ) {
+ if( rewind ) {
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_REWIND ) ;
+ ResetDrivePosition( drive ) ;
+ TpCloseRewind( drive->drv_hdl ) ;
+ } else {
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_NO_REWIND ) ;
+ TpClose( drive->drv_hdl ) ;
+ }
+ do {
+ while( TpReceive( drive->drv_hdl, &myret ) == FAILURE ) {
+ if( ui_tpos != NULL ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+
+ ui_tpos->UI_TapePosRoutine( TF_IDLE, ui_tpos, drive->vcb_valid, &drive->cur_vcb, mode ) ;
+
+ } else {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ }
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ drive->thw_inf.drv_status = myret.status ;
+ }
+ } while( myret.call_type != GEN_NRCLOSE && myret.call_type != GEN_RCLOSE ) ;
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( drive->thw_inf.the, myret.the ) ;
+
+ drive->drv_hdl = 0 ;
+ drive->trans_started = FALSE ;
+ }
+
+ /* reset our idea of one-shot drive status bits */
+ drive->thw_inf.drv_status &= ~( TPS_RESET | TPS_NEW_TAPE ) ;
+
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_NEW_LINE ) ;
+
+ /* Reset It for latter, this ticket is only good for one ride */
+ ClrPosBit( drive, DONT_CLOSE ) ;
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: SetupDriveList
+
+ Description: This initializes the drivers allocates the tables for
+ it.
+
+ Returns:
+
+ Notes: IF THIS IS BEING CALLED MORE THAN ONCE, AFTER THE FIRST
+ TIME YOU MUST CALL "TpRelease()" and DEALLOCATE THE DRIVE
+ LIST.
+
+ Declaration:
+
+**/
+
+
+INT16 SetupDriveList(
+ DIL_HWD_PTR cards,
+ INT16 no_cards )
+{
+ UINT16 tdrives = 0 ;
+ INT16 i, thdl ;
+ UINT16 j ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* Set up the pointer to the controller cards */
+ lw_tfl_control.cntl_cards = cards ;
+ InitQueue( &lw_drive_list ) ;
+
+
+ /* First, we need to predetermine the cards irqs & dma and see if there
+ are any conflicts */
+ TpAuto( cards, no_cards ) ;
+ ThreadSwitch( ) ;
+
+ ret_val = TpInit( cards, no_cards ) ;
+ ThreadSwitch( ) ;
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_TPINIT_FAILURE, ret_val ) ;
+
+ if( ret_val == SUCCESS ) {
+
+ for( i = 0 ; i < no_cards ; i++ ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_PARM_BLK_DESCR, i ) ;
+ for( j = 0 ; j < 20 ; j+=5 ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_PARM_BLK,
+ cards[i].parameters[j],
+ cards[i].parameters[j+1],
+ cards[i].parameters[j+2],
+ cards[i].parameters[j+3],
+ cards[i].parameters[j+4] ) ;
+ }
+ }
+
+ lw_tfl_control.driver_inited = TRUE ;
+
+ for( i = 0, tdrives = 0 ; i < no_cards ; i++ ) {
+ tdrives += cards[i].no_attached_drives ;
+ }
+
+ if( tdrives ) {
+ /* This DISABLES the first request in the DRIVER, perhaps this should
+ not be done on NON MS/DOS Applications */
+ TpSpecial( (INT16)0, (INT16)SS_NO_1ST_REQ, 0L ) ;
+ if( ( lw_drives = calloc( tdrives, sizeof( DRIVE ) ) ) != NULL ) {
+ for( i = 0, tdrives = 0 ; i < no_cards ; i++ ) {
+ for( j = 0 ; j < cards[i].no_attached_drives ; j++, tdrives++ ) {
+ thdl = lw_drives[tdrives].drv_hdl = TpOpen( &cards[i], (INT16)( j + 1 ) ) ;
+ if( !thdl ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ if( TpSpecial( thdl, (INT16)SS_GET_DRV_INF, ( UINT32 ) &lw_drives[tdrives].thw_inf.drv_info ) == FAILURE ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+
+ /* There is a limited set of physical block
+ sizes our app can deal with. So if the
+ current setting doesn't match any of these
+ we're going to force the drive to its
+ default size.
+ */
+ if( lw_drives[tdrives].thw_inf.drv_info.drv_features
+ & TDI_CHNG_BLK_SIZE ) {
+
+ BOOLEAN size_ok = FALSE ;
+ INT idx ;
+ UINT16 bsize = lw_drives[tdrives].thw_inf.drv_info.drv_bsize ;
+
+ for( idx = 0; idx < lw_num_blk_sizes; idx++ ) {
+ if( bsize == lw_blk_size_list[idx] ) {
+ size_ok = TRUE ;
+ break ;
+ }
+ }
+ if( !size_ok ) {
+ if( TpSpecial( thdl, SS_CHANGE_BLOCK_SIZE, DEFAULT_BLOCK_SIZE ) != SUCCESS ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ if( TpSpecial( thdl, (INT16)SS_GET_DRV_INF, ( UINT32 ) &lw_drives[tdrives].thw_inf.drv_info ) == FAILURE ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ }
+ }
+
+ /* If the drive supports hardware compression
+ we need to keep it in uncompressed mode
+ unless we're actually writing a compressed
+ set. This is a work-around for a firmware
+ bug in early Archive DAT DC drives.
+ */
+ if( lw_drives[tdrives].thw_inf.drv_info.drv_features
+ & TDI_DRV_COMPRESS_ON ) {
+
+ lw_drives[tdrives].thw_inf.drv_info.drv_features |=
+ TDI_DRV_COMPRES_INIT ;
+ } else {
+ lw_drives[tdrives].thw_inf.drv_info.drv_features &=
+ ~TDI_DRV_COMPRES_INIT ;
+ }
+
+ if( lw_drives[tdrives].thw_inf.drv_info.drv_features
+ & TDI_DRV_COMPRESSION ) {
+
+ if( TpSpecial( thdl, SS_SET_DRV_COMPRESSION, DISABLE_DRV_COMPRESSION ) != SUCCESS ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ }
+
+ lw_drives[tdrives].drv_no = ( j + 1 ) ;
+ /* Check to see if they have requested fast file to be active,
+ if not, unconditionally set any fast file bits off ( including the MaynStream 2200+ ) */
+ if( !lw_tfl_control.use_fast_file ) {
+ lw_drives[tdrives].thw_inf.drv_info.drv_features &= ~TDI_FAST_NBLK ;
+ lw_drives[tdrives].thw_inf.drv_info.drv_features &= ~TDI_FIND_BLK ;
+ }
+ /* Which controller card is it attached to */
+ lw_drives[tdrives].thw_inf.card_no = i ;
+ /* This forces a rewind in TF_OpenSet, since
+ we won't know we have a new tape.
+ */
+ lw_drives[tdrives].force_rewind = TRUE ;
+ /* Point back to the head of the structure, so when we reference
+ the channel link we can get the structure's address */
+ SetQueueElemPtr( &lw_drives[tdrives].thw_inf.channel_link,
+ ( VOID_PTR ) &lw_drives[tdrives].thw_inf ) ;
+ EnQueueElem( &lw_drive_list, &lw_drives[tdrives].thw_inf.link, FALSE ) ;
+ /* ensure that we don't know the format */
+ lw_drives[tdrives].last_cur_fmt = UNKNOWN_FORMAT ;
+ lw_drives[tdrives].last_fmt_env = NULL ;
+ lw_drives[tdrives].poll_stuff.state = st_CLOSED ;
+ lw_drives[tdrives].poll_stuff.channel = NULL ;
+ }
+ }
+ } else {
+ ret_val = TFLE_NO_MEMORY ;
+ }
+ }
+ } else {
+
+ ret_val = TFLE_DRIVER_FAILURE ;
+ }
+
+ for( i = 0; i < no_cards; i++ ) {
+ BE_Zprintf( 0, TEXT("card #%d: # of drives = %d; dd_init_err = %d\n"),
+ i, cards[i].no_attached_drives, cards[i].init_error ) ;
+ }
+
+ return( ret_val ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: UpdateDriveStatus
+
+ Description: Takes the return information from the ret buf and updates
+ the drive stuff. If the status has changed, this flips the
+ boolean inside the drive struct.
+
+ Returns: TFLE_xxx
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 UpdateDriveStatus( DRIVE_PTR drive )
+{
+ RET_BUF myret ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ if( TpStatus( drive->drv_hdl ) != SUCCESS ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ while( TpReceive( drive->drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( drive->thw_inf.the, myret.the ) ;
+
+ /* We ignore the unrecognized media here and catch it in MountTape
+ or PollDrive Mount.
+ */
+ if( myret.gen_error != GEN_NO_ERR &&
+ myret.gen_error != GEN_ERR_UNRECOGNIZED_MEDIA ) {
+
+ ret_val = TFLE_DRIVE_FAILURE ;
+ } else {
+
+ /* Assume It hasn't */
+ drive->thw_inf.status_changed = FALSE ;
+
+ /* Set up Counters */
+ drive->cur_stats.underruns = myret.underruns ;
+ drive->cur_stats.dataerrs = myret.readerrs ;
+
+ /* If the status is different, set the flag and update it */
+ if( drive->thw_inf.drv_status != myret.status ) {
+ drive->thw_inf.status_changed = TRUE ;
+ drive->thw_inf.drv_status = myret.status ;
+ }
+
+ /* If the is a one of these conditions, turn off tape full */
+ if( drive->thw_inf.drv_status & ( TPS_RESET | TPS_NO_TAPE | TPS_NEW_TAPE ) ) {
+ ClrPosBit( drive, TAPE_FULL ) ;
+ /* Clear out counters */
+ drive->cur_stats.underruns = 0 ;
+ drive->cur_stats.dataerrs = 0 ;
+ }
+ }
+
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: WriteEndSet
+
+ Description: Writes a filemark to tape and the updates the filemark
+ count.
+
+ Returns: Nothing
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 WriteEndSet( DRIVE_PTR curDRV )
+{
+ INT16 drv_hdl = curDRV->drv_hdl ;
+ RET_BUF myret ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ if( TpWriteEndSet( drv_hdl ) == SUCCESS ) {
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( curDRV->thw_inf.the, myret.the ) ;
+
+ switch ( myret.gen_error ) {
+ case GEN_NO_ERR:
+ curDRV->cur_pos.fmks++ ;
+ break ;
+
+ case GEN_ERR_ENDSET:
+ curDRV->thw_inf.drv_status = myret.status ;
+ curDRV->cur_pos.fmks++ ;
+ break ;
+
+ case GEN_ERR_EOM:
+ curDRV->thw_inf.drv_status = myret.status ;
+ curDRV->cur_pos.fmks++ ;
+ SetPosBit( curDRV, ( AT_EOM | TAPE_FULL ) ) ;
+ break ;
+
+ default:
+ curDRV->thw_inf.drv_status = myret.status ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+ }
+ } else {
+ ret_val = TFLE_DRIVER_FAILURE ;
+ }
+
+ BE_Zprintf( 0, TEXT("WriteEndSet() returning %d\n"), ret_val ) ;
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: ResetDrivePosition
+
+ Description: Resets the specified drive information to a virgin
+ ( I heard that ) state.
+
+ Returns:
+
+ Notes:
+
+ Declaration:
+
+**/
+
+VOID ResetDrivePosition( DRIVE_PTR drive )
+{
+ drive->vcb_valid = FALSE ;
+ ClrPosBit( drive, ( AT_EOD | AT_EOM | AT_EOS | AT_MOS ) ) ;
+ drive->cur_pos.fmks = 0 ;
+ drive->cur_stats.underruns = 0 ;
+ drive->cur_stats.dataerrs = 0 ;
+
+ /* reset 1-shot drive status bits */
+ drive->thw_inf.drv_status &= ~( TPS_NEW_TAPE | TPS_RESET ) ;
+}
+
+
+/**/
+/**
+
+ Name: GotoBlock
+
+ Description: Positions the tape to the physical block which is nearest
+ to the given logical block offset from the current SSET
+ (without going over) and sets the output parameter
+ 'offset' to the offset of the given LBA in the next
+ physical block.
+
+ Returns: TFLE_xxx error code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 GotoBlock(
+ CHANNEL_PTR channel, /* I - God */
+ UINT32 lba, /* I - Desired Logical Block Address */
+ TPOS_PTR ui_tpos, /* I - For talking to the UI */
+ UINT16_PTR offset ) /* O - Offset of LBA in Physical Block */
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ UINT32 real_blk ;
+ RET_BUF myret ;
+ UINT64 logical_bytes ;
+ UINT64 physical_bytes ;
+ UINT64 remainder ;
+ INT16 status ;
+
+ logical_bytes = U64_Mult( U64_Init( lba - curDRV->cur_pos.lba_vcb, 0L ),
+ U64_Init( (UINT32)channel->lb_size, 0L ) ) ;
+ physical_bytes = U64_Init( (UINT32)ChannelBlkSize( channel ), 0L ) ;
+ real_blk = curDRV->cur_pos.pba_vcb +
+ U64_Lsw( U64_Div( logical_bytes, physical_bytes,
+ &remainder, &status ) ) ;
+ msassert( status == U64_OK ) ;
+ *offset = (UINT16)U64_Lsw( remainder ) ;
+ BE_Zprintf( 0, TEXT("GotoBlock: VCB_PBA = %ld, VCB_LBA = %ld, LBA = %ld,\n"),
+ curDRV->cur_pos.pba_vcb,
+ curDRV->cur_pos.lba_vcb,
+ lba ) ;
+ BE_Zprintf( 0, TEXT(" PBA = %ld, offset = %d\n"), real_blk, *offset ) ;
+
+ if( ui_tpos != NULL ) {
+ ui_tpos->UI_TapePosRoutine( TF_SEARCHING, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, 0 ) ;
+ } else {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ if( TpSeek( curDRV->drv_hdl, real_blk, FALSE ) == FAILURE ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ if( ui_tpos != NULL ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+
+ if( (*ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, 0 )
+ == UI_ABORT_POSITIONING ) {
+ ret_val = TFLE_USER_ABORT ;
+ }
+ }
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+
+ if( myret.gen_error && ( ret_val != TFLE_USER_ABORT ) ) {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: GetCurrentPos
+
+ Description: Gets the current block position for the drive.
+
+ Returns: An error code
+
+ Notes: ABCDEFG
+
+ Declaration:
+
+**/
+
+INT16 GetCurrentPosition( DRIVE_PTR curDRV )
+{
+
+ RET_BUF myret ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ if( TpGetPosition( curDRV->drv_hdl, FALSE ) == FAILURE ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( curDRV->thw_inf.the, myret.the ) ;
+
+ if( myret.gen_error ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ } else {
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_GET_CURRENT_POS_STAT, myret.misc ) ;
+ curDRV->cur_pos.pba_vcb = myret.misc ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: MountTape
+
+ Description: Mounts and readies a tape for IO.
+
+ Returns:
+
+ Notes: new_tape insures that mount will return with the NEW_TAPE
+ status bit set unless there is a NO_TAPE status returned
+ from the mount call itself.
+
+ Declaration:
+
+**/
+
+INT16 MountTape(
+ DRIVE_PTR cur_drv , /* The current Drive */
+ TPOS_PTR ui_tpos , /* The user interface tpos */
+ BOOLEAN_PTR tape_present ) /* Is there a tape present */
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN first_call = TRUE ;
+ RET_BUF myret ;
+
+ /* Default to tape NOT present */
+ *tape_present = FALSE ;
+
+ /* Was this drive being polled, and if it was, is there a pending request */
+ if( cur_drv->poll_stuff.state != st_CLOSED ) {
+ if ( ui_tpos != NULL ) {
+ if( *ui_tpos->UI_TapePosRoutine ) {
+ ui_tpos->UI_TapePosRoutine( TF_REWINDING, ui_tpos, cur_drv->vcb_valid, &cur_drv->cur_vcb, 0 /* no specific mode */ ) ;
+ }
+ }
+ while( TpReceive( cur_drv->drv_hdl, &myret ) == FAILURE ) {
+ if( ui_tpos != NULL ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+
+ if( (*ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, ui_tpos, cur_drv->vcb_valid, &cur_drv->cur_vcb, 0 )
+ == UI_ABORT_POSITIONING ) {
+ ret_val = TFLE_USER_ABORT ;
+ break ;
+ }
+ } else {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( cur_drv->thw_inf.the, myret.the ) ;
+ }
+
+
+ if( cur_drv->poll_stuff.state != st_CLOSED ) {
+
+ switch( myret.gen_error ) {
+
+ case GEN_ERR_NO_MEDIA :
+
+ cur_drv->tape_mounted = FALSE ;
+ if( cur_drv->poll_stuff.state != st_BSTAT ) {
+ cur_drv->force_rewind = TRUE ;
+ }
+ break ;
+
+ case GEN_ERR_UNRECOGNIZED_MEDIA :
+ case GEN_NO_ERR :
+ case GEN_ERR_NO_DATA :
+ case GEN_ERR_ENDSET :
+
+ switch( cur_drv->poll_stuff.state ) {
+
+ case st_BSTAT :
+
+ if( myret.gen_error == GEN_ERR_NO_DATA ||
+ myret.gen_error == GEN_ERR_ENDSET ) {
+
+ msassert( FALSE ) ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+ }
+
+ cur_drv->thw_inf.drv_status = myret.status ;
+ if( myret.status & ( TPS_NEW_TAPE | TPS_RESET | TPS_NO_TAPE ) ) {
+ cur_drv->force_rewind = TRUE ;
+ }
+ break ;
+
+ case st_BMNT :
+
+ if( myret.gen_error == GEN_ERR_NO_DATA ||
+ myret.gen_error == GEN_ERR_ENDSET ) {
+
+ msassert( FALSE ) ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+ }
+
+ cur_drv->thw_inf.drv_status = myret.status ;
+ if( myret.status & ( TPS_NEW_TAPE | TPS_RESET | TPS_NO_TAPE ) ) {
+ cur_drv->force_rewind = TRUE ;
+ }
+
+ /* Mount Succeeded check for status change */
+ if( ( ret_val = UpdateDriveStatus( cur_drv ) ) == TFLE_NO_ERR ) {
+ if( cur_drv->thw_inf.drv_status & ( TPS_NEW_TAPE | TPS_RESET | TPS_NO_TAPE ) ) {
+
+ /* New tape or no tape! Dismount and force mount */
+ cur_drv->tape_mounted = TRUE ;
+ ret_val = DisMountTape( cur_drv, NULL, FALSE ) ;
+ cur_drv->force_rewind = TRUE ;
+
+ } else {
+
+ /* Successful Mount! */
+ cur_drv->tape_mounted = TRUE ;
+ cur_drv->thw_inf.drv_status = myret.status ;
+ }
+ }
+ break ;
+
+ case st_BREW :
+ case st_BREAD :
+
+ if( cur_drv->poll_stuff.state == st_BREW &&
+ myret.gen_error == GEN_ERR_UNRECOGNIZED_MEDIA ) {
+
+ msassert( FALSE ) ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+ }
+
+ /* check for status change */
+ if( ( ret_val = UpdateDriveStatus( cur_drv ) ) == TFLE_NO_ERR ) {
+ if( cur_drv->thw_inf.drv_status & ( TPS_NEW_TAPE | TPS_RESET | TPS_NO_TAPE ) ) {
+
+ /* New tape or no tape! Dismount and force mount */
+ cur_drv->tape_mounted = TRUE ;
+ ret_val = DisMountTape( cur_drv, NULL, FALSE ) ;
+ cur_drv->force_rewind = TRUE ;
+
+ } else {
+
+ /* Success! */
+ cur_drv->tape_mounted = TRUE ;
+ if( cur_drv->poll_stuff.state == st_BREAD &&
+ myret.gen_error != GEN_ERR_UNRECOGNIZED_MEDIA ) {
+
+ /* Set up the buffer */
+ BM_SetBytesFree( cur_drv->hold_buff, (UINT16)myret.len_got ) ;
+ BM_SetReadError( cur_drv->hold_buff, myret.gen_error ) ;
+ }
+ }
+ }
+ break ;
+
+ default :
+ msassert( FALSE ) ;
+ break ;
+ }
+ break ;
+
+ default :
+
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+ }
+ }
+
+ cur_drv->poll_stuff.state = st_CLOSED ;
+
+ if( !cur_drv->tape_mounted && ret_val == TFLE_NO_ERR ) {
+
+ /* Mount the tape */
+ if( TpMount( cur_drv->drv_hdl ) != SUCCESS ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+
+ while( TpReceive( cur_drv->drv_hdl, &myret ) == FAILURE ) {
+ if( ui_tpos != NULL && ui_tpos->UI_TapePosRoutine != NULL ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+
+ if( first_call ) {
+ ui_tpos->UI_TapePosRoutine( TF_MOUNTING, ui_tpos, cur_drv->vcb_valid, &cur_drv->cur_vcb, 0 /* no specific mode */ ) ;
+ first_call = FALSE ;
+ } else {
+ if( (*ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, ui_tpos, cur_drv->vcb_valid, &cur_drv->cur_vcb, 0 )
+ == UI_ABORT_POSITIONING ) {
+ ret_val = TFLE_USER_ABORT ;
+ break ;
+ }
+ }
+ } else {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( cur_drv->thw_inf.the, myret.the ) ;
+
+ /* Set the status */
+ cur_drv->thw_inf.drv_status = myret.status ;
+
+ if( myret.gen_error ) {
+
+#ifdef OS_NLM
+ switch ( myret.gen_error ) {
+
+ case GEN_ERR_EMPTY_SRC:
+
+ /* loader could not find a tape at the requested location */
+
+ /* indicate requested source as empty */
+ ret_val = TFLE_EMPTY_SRC ;
+ break ;
+
+ case GEN_ERR_DEST_FULL :
+
+ /* loader could not place tape in desired location because */
+ /* location occupied by another tape */
+
+ /* indicate can't return tape to origin, tell user */
+ /* to manually remove tape */
+ ret_val = TFLE_DEST_FULL ;
+ break;
+
+ case GEN_ERR_ARM_FULL:
+
+ /* loader could not perform requested operation because */
+ /* loader arm is occupied with another tape */
+
+ /* there is already a tape in the loader arm */
+ ret_val = TFLE_ARM_FULL ;
+ break;
+
+ case GEN_ERR_DRIVE_FULL:
+
+ /* loader could not place requested tape in drive because */
+ /* there is something blocking the way (probably a tape in */
+ /* the open drive bay. */
+
+ /* there is already a tape in the drive */
+ ret_val = TFLE_DRIVE_FULL ;
+ break;
+
+ case GEN_ERR_NO_MEDIA:
+
+ /* no tape in slot */
+ ResetDrivePosition( cur_drv ) ;
+ /* Just to make sure... */
+ cur_drv->thw_inf.drv_status |= TPS_NO_TAPE ;
+ break ;
+
+ case GEN_ERR_UNRECOGNIZED_MEDIA:
+
+ *tape_present = TRUE ;
+ cur_drv->tape_mounted = TRUE ;
+ ret_val = TF_UNRECOGNIZED_MEDIA ;
+ break;
+
+ case GEN_ERR_DRIVE_CLOSED :
+
+ /* drive door is closed with no tape in the drive */
+
+ /* indicate drive door is closed and must be manually opened */
+ ret_val = TFLE_DRIVE_CLOSED ;
+ break;
+
+ case GEN_ERR_DOOR_AJAR :
+
+ /* the door has been opened during an operation */
+
+ ret_val = TFLE_DOOR_AJAR ;
+ break;
+
+ case GEN_ERR_NO_CARTRIDGE:
+
+ /* there is no cartridge in the loader to get tape from */
+
+ ret_val = TFLE_NO_CARTRIDGE ;
+ break;
+
+ case GEN_ERR_LOAD_UNLOAD:
+
+ /* loader arm movement interrupted (by loader door being opened) */
+
+ ret_val = TFLE_LOAD_UNLOAD ;
+ break;
+
+ case GEN_ERR_UNEXPECTED_TAPE:
+
+ /* The internal driver data indicates no tape in drive. Driver */
+ /* didn't expect a tape in the drive, yet one was found. Cannot */
+ /* proceed because we do not know where the tape belongs. */
+ /* */
+
+ ret_val = TFLE_UNEXPECTED_TAPE ;
+ break ;
+
+ case GEN_ERR_SW_REJECT_CMD:
+
+ /* the command never made it to the drive, we aborted it before hand */
+
+ /* what do we want to do with this ??? Right */
+ /* now it's a drive failure - falling through */
+
+ default :
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break;
+
+ } /* switch */
+#else
+
+ /*
+ NOTE:A change within this 'conditional' needs to
+ be made for the NLM above!
+ */
+
+ if( myret.gen_error == GEN_ERR_NO_MEDIA ) {
+ ResetDrivePosition( cur_drv ) ;
+
+ /* Just to make sure... */
+ cur_drv->thw_inf.drv_status |= TPS_NO_TAPE ;
+
+ } else if( myret.gen_error == GEN_ERR_UNRECOGNIZED_MEDIA ) {
+ *tape_present = TRUE ;
+ cur_drv->tape_mounted = TRUE ;
+ ret_val = TF_UNRECOGNIZED_MEDIA ;
+
+ } else {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+#endif
+ } else if( myret.status & TPS_NO_TAPE ) {
+
+ /* Can this really happen??? */
+ ResetDrivePosition( cur_drv ) ;
+
+ } else {
+ *tape_present = TRUE ;
+ cur_drv->tape_mounted = TRUE ;
+
+ /* If we have a valid VCB but the drive says we are at BOT, */
+ /* it means the drive did a rewind behind our backs (QIC */
+ /* has to do this occasionally to keep itself sane). So we */
+ /* set the force_rewind flag. This will tell the caller to */
+ /* follow the normal rewind procedure, and eliminate */
+ /* any confusion as to where we are positioned on tape. */
+
+ if( cur_drv->thw_inf.drv_status & TPS_BOT ) {
+ cur_drv->force_rewind = TRUE ;
+ }
+ }
+
+ } else if( ret_val == TFLE_NO_ERR ) {
+ *tape_present = TRUE ;
+ if( myret.gen_error == GEN_ERR_UNRECOGNIZED_MEDIA ) {
+ /* We ignored this error up to this point because we want
+ the mount to complete in case they're trying to format
+ the tape. Now we have to tell them about it.
+ */
+ ret_val = TF_UNRECOGNIZED_MEDIA ;
+ }
+ }
+
+ /* If the tape has mounted reset the drive features */
+ if( cur_drv->tape_mounted && myret.gen_error == GEN_NO_ERR ) {
+ if( TpSpecial( cur_drv->drv_hdl, (INT16)SS_GET_DRV_INF, ( UINT32 )&cur_drv->thw_inf.drv_info ) == FAILURE ) {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+
+ /* Check to see if they have requested fast file to be active,
+ if not, unconditionally set any fast file bits off ( including the MaynStream 2200+ ) */
+ if( !lw_tfl_control.use_fast_file ) {
+ cur_drv->thw_inf.drv_info.drv_features &= ~TDI_FAST_NBLK ;
+ cur_drv->thw_inf.drv_info.drv_features &= ~TDI_FIND_BLK ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: DisMountTape
+
+ Description: Releases a tape.
+
+ Returns:
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 DisMountTape(
+ DRIVE_PTR cur_drv ,
+ TPOS_PTR ui_tpos ,
+ BOOLEAN rewind_tape )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ RET_BUF myret ;
+
+ if( cur_drv->tape_mounted ) {
+
+ /* if a rewind was requested, do it */
+ if( rewind_tape ) {
+ if( ( ret_val = RewindDrive( cur_drv, ui_tpos, TRUE, TRUE, 0 ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+
+ if( TpDismount( cur_drv->drv_hdl ) == FAILURE ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+
+ while( TpReceive( cur_drv->drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( cur_drv->thw_inf.the, myret.the ) ;
+
+ if( myret.gen_error != GEN_NO_ERR && myret.gen_error != GEN_ERR_NO_MEDIA ) {
+ cur_drv->thw_inf.drv_status = myret.status ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+
+ cur_drv->tape_mounted = FALSE ;
+
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: RewindDriveImmediate
+
+ Description: Rewinds the current drive in the channel and resets all the
+ appropriate fields.
+
+ Returns: An Error code if there is a problem.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+VOID RewindDriveImmediate( DRIVE_PTR curDRV )
+{
+ UINT16 retry = 1 ;
+ RET_BUF myret ;
+
+ myret.gen_error = GEN_NO_ERR ;
+
+ /* This logic is to handle the case that we have read exactly to the filemark
+ on tape, and since the last read did not fail, the filemark will be reported
+ on this rewind call. So if we get a filemark error on rewind ( I mean how
+ stupid are these drives ), kill the error queue, and recall TpRewind */
+ do {
+ TpRewind( curDRV->drv_hdl, TRUE ) ;
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ } while( myret.gen_error != GEN_NO_ERR && retry-- ) ;
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( curDRV->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+
+ /* Clean up the mess. */
+
+ ResetDrivePosition( curDRV ) ;
+ if( curDRV->hold_buff != NULL ) {
+ BM_UnReserve( curDRV->hold_buff ) ;
+ BM_Put( curDRV->hold_buff ) ;
+ curDRV->hold_buff = NULL ;
+ }
+ if ( curDRV->last_fmt_env != NULL ) {
+ FreeFormatEnv( & curDRV->last_cur_fmt, & curDRV->last_fmt_env ) ;
+ }
+
+ SetPosBit( curDRV, AT_BOT ) ;
+}
+
diff --git a/private/utils/ntbackup/src/ems_tab.c b/private/utils/ntbackup/src/ems_tab.c
new file mode 100644
index 000000000..2ba679efd
--- /dev/null
+++ b/private/utils/ntbackup/src/ems_tab.c
@@ -0,0 +1,138 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ems_tab.c
+
+ Description: This file contains the DOS functon table.
+
+
+ $Log: M:/LOGFILES/EMS_TAB.C_V $
+
+**/
+/* begin include list */
+#include <windows.h>
+#include "stdtypes.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "gen_fs.h"
+/* $end$ include list */
+
+FUNC_LIST EMSFuncTab = {
+
+ NULL,
+ EMS_FindDrives,
+ GEN_RemoveDLE,
+ NULL,
+
+ EMS_DeviceDispName,
+ EMS_GetVolName,
+ EMS_SizeofVolName,
+ GEN_MakePath,
+ EMS_InitMakeData,
+
+ GEN_IsBlkComplete,
+ GEN_CompleteBlk,
+ EMS_DupBlk,
+ GEN_ReleaseBlk,
+
+ EMS_AttachToDLE,
+ EMS_DetachDLE,
+ EMS_EndOperationOnDLE,
+
+ EMS_ProcessDDB,
+ EMS_GetCurrentDDB,
+ EMS_GetCurrentPath,
+ NULL,
+ NULL,
+ NULL,
+ EMS_ChangeDir,
+ EMS_UpDir,
+
+#ifdef TDEMO
+ NULL,
+ EMS_OpenObj,
+ EMS_SeekObj,
+ EMS_ReadObj,
+ NULL,
+ NULL,
+ EMS_CloseObj,
+ NULL,
+ EMS_GetObjInfo,
+ NULL,
+ EMS_VerObjInfo,
+#else
+ EMS_CreateObj,
+ EMS_OpenObj,
+ EMS_SeekObj,
+ EMS_ReadObj,
+ EMS_WriteObj,
+ EMS_VerObj,
+ EMS_CloseObj,
+ NULL,// EMS_DeleteObj,
+ EMS_GetObjInfo,
+ EMS_SetObjInfo,
+ EMS_VerObjInfo,
+#endif
+
+ EMS_FindFirst,
+ EMS_FindNext,
+ NULL, //EMS_PushMinDDB,
+ NULL, //EMS_PopMinDDB,
+
+#if defined ( OEM_MSOFT )
+ NULL,
+ EMS_EnumSpecFiles,
+#else
+ DUMMY_GetSpecDBLKS,
+ DUMMY_EnumSpecFiles,
+#endif
+
+ EMS_ModFnameFDB,
+ EMS_ModPathDDB,
+ EMS_GetOSFnameFDB,
+ GEN_GetPartName,
+ EMS_GetOSPathDDB,
+ EMS_GetCdateDBLK,
+ EMS_GetMdateDBLK,
+ EMS_ModBdateDBLK,
+ EMS_ModAdateDBLK,
+ EMS_GetDisplaySizeDBLK,
+ EMS_ModAttribDBLK,
+ NULL,
+ EMS_SetOwnerId,
+
+ EMS_GetObjTypeDBLK,
+
+ EMS_SizeofFname,
+ EMS_SizeofPath,
+ NULL,
+ GEN_SizeofPartName, /* IMAGE size of part name */
+ EMS_SizeofOSPath,
+
+ EMS_SizeofOSInfo,
+
+ EMS_GetOS_InfoDBLK,
+ EMS_GetActualSizeDBLK,
+
+ DUMMY_InitGOS,
+
+ NULL, // EMS_CreateFDB,
+ GEN_CreateIDB,
+ EMS_CreateDDB,
+ EMS_ChangeIntoDDB,
+
+#if defined ( OEM_MSOFT )
+ EMS_SpecExcludeObj,
+#else
+ GEN_SpecExcludeObj,
+#endif
+ GEN_SetDataSize,
+ NULL, /* SetObjTypeDBLK, */
+ DUMMY_LogoutDevice,
+ EMS_FindClose,
+ NULL, /* SizeofDevName */
+ NULL /* GeneratedErrorLog */
+} ;
diff --git a/private/utils/ntbackup/src/enc_tab.c b/private/utils/ntbackup/src/enc_tab.c
new file mode 100644
index 000000000..571deab51
--- /dev/null
+++ b/private/utils/ntbackup/src/enc_tab.c
@@ -0,0 +1,77 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: enc_tab.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This module contains the encryption and decryption tables
+ for Encryption Standard 3 in ENCRYPT.C.
+
+
+
+ $Log: G:/LOGFILES/ENC_TAB.C_V $
+
+ Rev 1.0 09 May 1991 13:33:42 HUNTER
+Initial revision.
+
+**/
+
+#include "stdtypes.h"
+
+UINT8 enc_table[256] = { 53, 25, 81, 57, 6, 119, 173, 115, 215, 101,
+ 203, 9, 7, 254, 220, 167, 184, 187, 8, 163,
+ 24, 23, 67, 128, 192, 249, 175, 131, 213, 149,
+ 18, 240, 197, 37, 73, 158, 56, 246, 124, 17,
+ 61, 4, 174, 127, 253, 2, 147, 170, 183, 32,
+ 21, 84, 111, 150, 164, 42, 214, 94, 207, 91,
+ 235, 224, 222, 76, 153, 152, 89, 181, 43, 244,
+ 243, 27, 118, 68, 72, 31, 204, 219, 26, 247,
+ 144, 141, 156, 154, 47, 105, 143, 216, 179, 62,
+ 120, 59, 28, 13, 69, 65, 92, 231, 188, 245,
+ 234, 110, 121, 228, 36, 29, 135, 51, 3, 200,
+ 109, 178, 75, 40, 5, 50, 199, 195, 209, 46,
+ 165, 160, 177, 106, 182, 238, 19, 54, 86, 217,
+ 210, 103, 70, 138, 48, 191, 237, 133, 193, 16,
+ 196, 226, 229, 201, 55, 242, 88, 117, 148, 137,
+ 205, 80, 239, 49, 20, 140, 162, 185, 146, 10,
+ 223, 132, 227, 208, 85, 22, 166, 45, 99, 172,
+ 34, 77, 14, 232, 202, 176, 1, 251, 83, 96,
+ 33, 95, 71, 125, 104, 151, 35, 255, 66, 134,
+ 233, 225, 218, 39, 58, 186, 74, 161, 168, 100,
+ 190, 142, 157, 139, 212, 90, 79, 64, 248, 123,
+ 52, 145, 206, 87, 98, 221, 108, 122, 189, 60,
+ 15, 230, 211, 97, 116, 180, 136, 129, 44, 0,
+ 78, 38, 250, 102, 126, 241, 159, 107, 30, 93,
+ 236, 82, 155, 252, 194, 130, 41, 169, 11, 63,
+ 198, 113, 112, 171, 12, 114
+} ;
+/* decryption table */
+UINT8 dec_table[256] = { 229, 176, 45, 108, 41, 114, 4, 12, 18, 11,
+ 159, 248, 254, 93, 172, 220, 139, 39, 30, 126,
+ 154, 50, 165, 21, 20, 1, 78, 71, 92, 105,
+ 238, 75, 49, 180, 170, 186, 104, 33, 231, 193,
+ 113, 246, 55, 68, 228, 167, 119, 84, 134, 153,
+ 115, 107, 210, 0, 127, 144, 36, 3, 194, 91,
+ 219, 40, 89, 249, 207, 95, 188, 22, 73, 94,
+ 132, 182, 74, 34, 196, 112, 63, 171, 230, 206,
+ 151, 2, 241, 178, 51, 164, 128, 213, 146, 66,
+ 205, 59, 96, 239, 57, 181, 179, 223, 214, 168,
+ 199, 9, 233, 131, 184, 85, 123, 237, 216, 110,
+ 101, 52, 252, 251, 255, 7, 224, 147, 72, 5,
+ 90, 102, 217, 209, 38, 183, 234, 43, 23, 227,
+ 245, 27, 161, 137, 189, 106, 226, 149, 133, 203,
+ 155, 81, 201, 86, 80, 211, 158, 46, 148, 29,
+ 53, 185, 65, 64, 83, 242, 82, 202, 35, 236,
+ 121, 197, 156, 19, 54, 120, 166, 15, 198, 247,
+ 47, 253, 169, 6, 42, 26, 175, 122, 111, 88,
+ 225, 67, 124, 48, 16, 157, 195, 17, 98, 218,
+ 200, 135, 24, 138, 244, 117, 140, 32, 250, 116,
+ 109, 143, 174, 10, 76, 150, 212, 58, 163, 118,
+ 130, 222, 204, 28, 56, 8, 87, 129, 192, 77,
+ 14, 215, 62, 160, 61, 191, 141, 162, 103, 142,
+ 221, 97, 173, 190, 100, 60, 240, 136, 125, 152,
+ 31, 235, 145, 70, 69, 99, 37, 79, 208, 25,
+ 232, 177, 243, 44, 13, 187
+} ;
diff --git a/private/utils/ntbackup/src/encrypt.c b/private/utils/ntbackup/src/encrypt.c
new file mode 100644
index 000000000..b265a81e1
--- /dev/null
+++ b/private/utils/ntbackup/src/encrypt.c
@@ -0,0 +1,481 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: encrypt.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: The Encryption Unit Interface has the following functionality:
+ EU_Open, EU_ResetHand, EU_Close and EU_Encrypt. This interface
+ allows the user to encrypt and decrypt blocks of data.
+
+
+
+ $Log: M:/LOGFILES/ENCRYPT.C_V $
+
+ Rev 1.5 20 May 1993 17:27:06 BARRY
+Unicode fixes
+
+ Rev 1.4 30 Jan 1993 11:21:00 DON
+Removed compiler warnings
+
+ Rev 1.3 08 Oct 1992 12:47:06 DAVEV
+fixes for handling Unicode passwords
+
+ Rev 1.2 18 Aug 1992 09:58:26 BURT
+fix warnings
+
+ Rev 1.1 14 May 1991 12:12:58 JOHNW
+Added support for a "Do nothing" encryption algorithm.
+
+ Rev 1.0 09 May 1991 13:37:06 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+
+#ifndef CODERUNNER
+#include <io.h>
+#include <stdio.h>
+#include <malloc.h>
+#include <string.h>
+#else
+#pragma check_stack-
+#include "cr.h"
+#include "farlib.h"
+#endif
+
+#include "stdtypes.h"
+#include "msassert.h"
+
+#include "enc_priv.h"
+#include "enc_pub.h"
+#include "tble_prv.h"
+/* $end$ include list */
+
+VOID EncryptData3( EU_HAND_PTR enc_hand, INT8_PTR data, INT16 dsize ) ;
+VOID DecryptData3( EU_HAND_PTR enc_hand, INT8_PTR data, INT16 dsize ) ;
+VOID EncryptData1( INT8_PTR data, INT16 dsize ) ;
+VOID DecryptData1( INT8_PTR data, INT16 dsize ) ;
+
+/**/
+/**
+
+ Name: EU_Open
+
+ Description: EU_Open allocates memory for an encryption unit handle.
+
+
+ Modified: 9/25/1989
+
+ Returns: The encryption unit handle is returned.
+
+ Notes: Error points to the error code.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+EU_HAND_PTR EU_Open(
+ INT16 algor , /* Type of algorithm */
+ INT16 mode , /* Encrypt or Decrypt */
+ INT8_PTR key , /* Pointer to the key */
+ INT16 ksize , /* Size of the key in BYTES */
+ INT16_PTR block_size , /* Block size */
+ INT16_PTR error ) /* Pointer to an error code */
+{
+ EU_HAND_PTR euh ;
+
+ *error = EU_NO_ERROR ;
+
+ /* Verify parameter data */
+ msassert( key != NULL ) ;
+ msassert( ksize != 0 ) ;
+ msassert( ( ( mode == ENCRYPT ) || ( mode == DECRYPT ) ) ) ;
+
+ /* Allocate Memory */
+ if( ( euh = ( EU_HAND_PTR ) malloc( sizeof( EU_HAND ) ) ) != NULL ) {
+
+ /* fill in common part of the EU_HAND */
+ euh->algor= algor;
+ euh->mode = mode ;
+
+ switch( algor ) {
+
+ case ENC_ALGOR_3 : /* Maynard Encryption Standard (MES) */
+
+ /* Allocate space for the Encryption Key */
+ if( ( euh->algors.exor.key
+ = ( INT8 PTR_SIZE * ) malloc( ksize ) ) == NULL ) {
+ *error = EU_MEMORY_ERROR ;
+ free( euh ) ;
+ return NULL ;
+ }
+
+ /* Assign data to handle */
+ memcpy( euh->algors.exor.key, key, ksize );
+ euh->algors.exor.ksize = ksize ;
+ euh->algors.exor.feedback = 0 ;
+ euh->algors.exor.block_size = 1;
+ euh->algors.exor.bytes_processed = 0L ;
+ *block_size = 1;
+ break ;
+
+ case ENC_ALGOR_1 : /* Maynard Encryption Algorithm 2.0 */
+
+ /* Assign data to handle */
+ *block_size = 1;
+ break ;
+
+ case ENC_ALGOR_0 : /* Do nothing Algorithm */
+ break ;
+
+ default : /* Unknown Algorithm */
+ *error = EU_ALGORITHM_UNKNOWN ;
+ free( euh ) ;
+ return NULL ;
+ break ;
+
+ } /* End of Switch */
+ } else {
+ *error = EU_MEMORY_ERROR ;
+ }
+ return euh ;
+
+}
+
+/**/
+/**
+
+ Name: EU_Encrypt
+
+ Description: Encrypts or Decrypts a given block of data.
+
+ Modified: 9/25/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 EU_Encrypt(
+ EU_HAND_PTR enc_hand , /* encryption unit handle from EU_Open */
+ INT8_PTR data , /* pointer to data to be en/decrypted */
+ INT16 dsize ) /* size of the data in BYTES */
+{
+ INT16 status = EU_NO_ERROR ;
+
+ /* Verify parameter data */
+ msassert( enc_hand != NULL ) ;
+ msassert( data != NULL ) ;
+
+ if( enc_hand->mode == ENCRYPT ) {
+ /* encryption requested */
+ switch( enc_hand->algor ) {
+ case ENC_ALGOR_3 : /* Call MES encryption routine */
+ msassert( ( dsize % enc_hand->algors.exor.block_size ) == 0 ) ;
+ EncryptData3( enc_hand, data, dsize ) ;
+ break ;
+
+ case ENC_ALGOR_1 : /* Call password encryption routine */
+ EncryptData1( data, dsize ) ;
+ break ;
+
+ case ENC_ALGOR_0 : /* Do nothing Algorithm */
+ break ;
+
+ default :
+ msassert( FALSE ) ;
+ break ;
+ }
+ } else {
+ /* decryption requested */
+ switch( enc_hand->algor ) {
+ case ENC_ALGOR_3 : /* Call MES decryption routine */
+ msassert( ( dsize % enc_hand->algors.exor.block_size ) == 0 ) ;
+ DecryptData3( enc_hand, data, dsize ) ;
+ break ;
+
+ case ENC_ALGOR_1 : /* Call password decryption routine */
+ DecryptData1( data, dsize ) ;
+ break ;
+
+ case ENC_ALGOR_0 : /* Do nothing Algorithm */
+ break ;
+
+ default :
+ msassert( FALSE ) ;
+ break ;
+ }
+ }
+
+ return status ;
+}
+
+/**/
+/**
+
+ Name: EncryptData3
+
+ Description: Encrypts a given block of data using MES.
+
+ Modified: 9/25/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID EncryptData3(
+ EU_HAND_PTR enc_hand , /* encryption unit handle from EU_Open */
+ INT8_PTR data , /* data to be encrypted */
+ INT16 dsize ) /* size of data in BYTES */
+{
+
+ INT16 keypos ;
+ UINT8 enc_val ;
+
+ while( dsize-- ) {
+ keypos = (INT16) enc_hand->algors.exor.bytes_processed++
+ % enc_hand->algors.exor.ksize ;
+ enc_val = enc_hand->algors.exor.key[keypos] ^ *data
+ ^ enc_hand->algors.exor.feedback ;
+ enc_hand->algors.exor.feedback = *data++ = enc_table[enc_val] ;
+ }
+
+ return ;
+}
+/**/
+/**
+
+ Name: DecryptData3
+
+ Description: Decrypts a given block of data using MES
+
+ Modified: 9/25/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+VOID DecryptData3(
+ EU_HAND_PTR enc_hand , /* encryption unit handle from EU_Open */
+ INT8_PTR data , /* data to be decrypted */
+ INT16 dsize ) /* size of data in BYTES */
+{
+
+ INT16 keypos ;
+ UINT8 temp ;
+
+ while( dsize-- ) {
+ keypos = (INT16) enc_hand->algors.exor.bytes_processed++
+ % enc_hand->algors.exor.ksize ;
+ temp = dec_table[(UINT8)*data] ^ enc_hand->algors.exor.feedback
+ ^ enc_hand->algors.exor.key[keypos] ;
+ enc_hand->algors.exor.feedback = (UINT8) *data ;
+ *data++ = temp ;
+ }
+ return ;
+}
+
+/**/
+/**
+
+ Name: EncryptData1
+
+ Description: EncryptData1 encyrpts the given data using the
+ password encryption algorithm from version 2.0.
+
+ Modified: 9/26/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+VOID EncryptData1(
+ INT8_PTR data, /* data to be encrypted */
+ INT16 dsize ) /* size of data in BYTES */
+{
+ // old non-unicode compatible version
+ //INT16 i ;
+ //
+ //(VOID) strrev( data ) ;
+ //for( i=0; i < (INT16)strlen( data ); i++) {
+ // data[i] = data[i] - (CHAR)'+';
+ //}
+
+ // new unicode compatible version
+ // perform strrev and encryption in a single pass.
+
+ INT8_PTR right = data + dsize - 1;
+ INT8 temp;
+
+ while ( data < right )
+ {
+ temp = *data;
+ *data++ = *right + (INT8)'+';
+ *right-- = temp + (INT8)'+';
+ }
+ if ( right == data )
+ {
+ *data += (INT8)'+';
+ }
+
+ return ;
+}
+
+/**/
+/**
+
+ Name: DecryptData1
+
+ Description: DecryptData1 decrypts the given data using the
+ password encryption algorithm from version 2.0
+
+ Modified: 9/26/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+VOID DecryptData1(
+ INT8_PTR data, /* data to be decrypted */
+ INT16 dsize ) /* size of data in BYTES */
+{
+ // old non-unicode compatible version
+ //INT16 i ;
+
+ //for( i=0; i < (INT16)strlen( data ); i++) {
+ // data[i] = data[i] + (CHAR)'+';
+ //}
+ //(VOID) strrev( data ) ;
+
+ // new unicode compatible version
+ // perform strrev and decryption in a single pass.
+
+ INT8_PTR right = data + dsize - 1;
+ INT8 temp;
+
+ while ( data < right )
+ {
+ temp = *data;
+ *data++ = *right - (INT8)'+';
+ *right-- = temp - (INT8)'+';
+ }
+ if ( right == data )
+ {
+ *data -= (INT8)'+';
+ }
+ return ;
+}
+
+/**/
+/**
+
+ Name: EU_ResetHand
+
+ Description: Resets the feedback so that the next encryption stands alone.
+
+ Modified: 9/25/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+INT16 EU_ResetHand(
+ EU_HAND_PTR enc_hand )
+{
+ INT16 error = EU_NO_ERROR ;
+
+ msassert( enc_hand != NULL ) ;
+
+ switch( enc_hand->algor ) {
+ case ENC_ALGOR_3 : /* reset bytes processed and feedback */
+ enc_hand->algors.exor.feedback = 0 ;
+ enc_hand->algors.exor.bytes_processed = 0 ;
+ break ;
+ default :
+ break ;
+ }
+
+ return error ;
+}
+
+/**/
+/**
+
+ Name: EU_Close
+
+ Description: Frees the memory associated with the encryption unit handle.
+
+ Modified: 9/25/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID EU_Close(
+ EU_HAND_PTR enc_hand )
+{
+ msassert( enc_hand != NULL ) ;
+
+ switch( enc_hand->algor ) {
+ case ENC_ALGOR_3 : /* free memory used for key and handle */
+ free( enc_hand->algors.exor.key ) ;
+ break ;
+ default :
+ break ;
+ }
+
+ /* Free Encryption structure */
+ free( enc_hand ) ;
+
+ return ;
+}
diff --git a/private/utils/ntbackup/src/entrpris.ico b/private/utils/ntbackup/src/entrpris.ico
new file mode 100644
index 000000000..1142368ad
--- /dev/null
+++ b/private/utils/ntbackup/src/entrpris.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/eprintf.c b/private/utils/ntbackup/src/eprintf.c
new file mode 100644
index 000000000..a2729b4a5
--- /dev/null
+++ b/private/utils/ntbackup/src/eprintf.c
@@ -0,0 +1,174 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: eprintf.c
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/EPRINTF.C_V $
+
+ Rev 1.15 10 Dec 1993 14:37:06 BARRY
+Use malloc for message instead of automatic variable
+
+ Rev 1.14 14 Jun 1993 20:36:42 MIKEP
+enable c++
+
+ Rev 1.13 02 Jun 1993 09:26:34 MIKEP
+Fix buffer being over written by clock when error occurs.
+
+ Rev 1.12 01 Nov 1992 15:57:52 DAVEV
+Unicode changes
+
+ Rev 1.11 07 Oct 1992 14:50:10 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.10 04 Oct 1992 19:37:22 DAVEV
+Unicode Awk pass
+
+ Rev 1.9 17 Aug 1992 13:17:24 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.8 28 Jul 1992 14:41:18 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.7 27 Jul 1992 14:48:36 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.6 19 May 1992 13:01:22 MIKEP
+mips changes
+
+ Rev 1.5 14 May 1992 16:51:12 MIKEP
+nt pass 2
+
+ Rev 1.4 18 Feb 1992 11:00:14 ROBG
+Added logic to concatenate a CR/LF to any error message for
+the log file.
+
+ Rev 1.3 21 Jan 1992 16:51:28 JOHNWT
+added noyycheck flag
+
+ Rev 1.2 16 Jan 1992 11:23:10 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.1 25 Nov 1991 15:31:54 JOHNWT
+removed eprintf, converted to WM_MessageBox
+
+ Rev 1.0 20 Nov 1991 19:18:28 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: eresrintf
+
+ Description: This function displays an error message from SES_ENG_ERR
+
+ THIS IS A SPECIAL FUNCTION SPECIFICALLY
+ FOR THE "T" COMMANDS...NO WINDOWS ARE USED
+
+ Returns: VOID
+
+*****************************************************************************/
+VOID eresprintf( INT res_id, ... )
+{
+ UINT16 error ;
+ CHAR_PTR fmt ;
+ UINT16 tmp ;
+ va_list arg_ptr ;
+
+ fmt = (CHAR_PTR)RM_GetResource( rm, (UINT) SES_ENG_ERR, res_id, &tmp, &error ) ;
+
+ if ( fmt )
+ {
+ CHAR_PTR messageBuffer;
+
+ msassert( fmt != NULL ) ;
+ msassert( error == RM_NO_ERROR ) ;
+
+ va_start( arg_ptr, res_id ) ;
+
+ tprintf( fmt, arg_ptr ) ;
+
+ messageBuffer = malloc( strsize( gszTprintfBuffer ) );
+
+ if ( messageBuffer != NULL )
+ {
+ strcpy( messageBuffer, gszTprintfBuffer );
+ }
+
+ lvprintf( LOGGING_FILE, fmt, arg_ptr ) ;
+
+ va_end( arg_ptr ) ;
+
+ // Concatenate CR/LF after string.
+
+ lprintf ( LOGGING_FILE, TEXT("\n") ) ;
+
+ WM_MessageBox( ID( IDS_MSGTITLE_ERROR ),
+ messageBuffer == NULL ? TEXT("") : messageBuffer,
+ WMMB_OK | WMMB_NOYYCHECK,
+ WMMB_ICONEXCLAMATION,
+ NULL, 0, 0 );
+
+ free( messageBuffer );
+ }
+ return ;
+}
+
+BOOLEAN eresprintf_cancel( INT res_id, ... )
+{
+ UINT16 error ;
+ CHAR_PTR fmt ;
+ UINT16 tmp ;
+ va_list arg_ptr ;
+ BOOLEAN ret_val = FALSE ;
+
+ fmt = (CHAR_PTR)RM_GetResource( rm, (UINT) SES_ENG_ERR, res_id, &tmp, &error ) ;
+
+ if ( fmt )
+ {
+ CHAR_PTR messageBuffer;
+
+ msassert( fmt != NULL ) ;
+ msassert( error == RM_NO_ERROR ) ;
+
+ va_start( arg_ptr, res_id ) ;
+
+ tprintf( fmt, arg_ptr ) ;
+
+ messageBuffer = malloc( strsize( gszTprintfBuffer ) );
+
+ if ( messageBuffer != NULL )
+ {
+ strcpy( messageBuffer, gszTprintfBuffer );
+ }
+
+ lvprintf( LOGGING_FILE, fmt, arg_ptr ) ;
+
+ va_end( arg_ptr ) ;
+
+ // Concatenate CR/LF after string.
+
+ lprintf ( LOGGING_FILE, TEXT("\n") ) ;
+
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_ERROR ),
+ messageBuffer == NULL ? TEXT("") : messageBuffer,
+ WMMB_OKCANCEL | WMMB_NOYYCHECK,
+ WMMB_ICONEXCLAMATION,
+ NULL, 0, 0 ) != WMMB_IDOK ) {
+
+ ret_val = TRUE ;
+ }
+
+ free( messageBuffer );
+ }
+ return ret_val ;
+}
+
diff --git a/private/utils/ntbackup/src/erase.c b/private/utils/ntbackup/src/erase.c
new file mode 100644
index 000000000..aeb016f26
--- /dev/null
+++ b/private/utils/ntbackup/src/erase.c
@@ -0,0 +1,617 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: ERASE.C
+
+ Description: Erase tape dialog
+
+ $Log: J:/UI/LOGFILES/ERASE.C_V $
+
+ Rev 1.45.1.0 24 May 1994 20:07:34 GREGG
+Improved handling of ECC, SQL, FUTURE_VER and OUT_OF_SEQUENCE tapes.
+
+ Rev 1.45 02 Feb 1994 18:02:32 chrish
+Added change for UNICODE app to handle ANSI secured created tapes.
+
+ Rev 1.44 28 Jan 1994 17:22:34 Glenn
+Simplified and fixed Icon support.
+
+ Rev 1.43 25 Jan 1994 08:42:28 MIKEP
+fix warnings in orcas
+
+ Rev 1.42 01 Dec 1993 14:20:40 mikep
+add SQL recognition support to poll drive
+
+ Rev 1.41 30 Jul 1993 08:47:14 CARLS
+added VLM_ECC_TAPE & VLM_FUTURE_VER
+
+ Rev 1.40 03 May 1993 10:44:54 DARRYLP
+Changed help id to match existing format help id.
+
+ Rev 1.39 22 Apr 1993 15:50:12 chrish
+Fix for Nostradamous: EPR 0403 - When erasing a tape, the owner of the
+tape would be whoever it is in the current VCB got from poll drive. However
+the true owner is the person who first created the tape. Fix will now get
+the user name from the first set on the tape.
+
+ Rev 1.38 08 Apr 1993 17:18:34 chrish
+Made change to allow erasing a tape passworded by the Cayman app.
+
+ Rev 1.37 07 Apr 1993 17:59:20 CARLS
+changed dialog title for format operation
+
+ Rev 1.36 06 Apr 1993 16:16:10 GREGG
+Removed OEM_MSOFT ifdef around setting of secure erase radio button.
+
+ Rev 1.35 26 Mar 1993 15:08:30 chrish
+Corrected wrong privilege detection for erase.
+
+ Rev 1.34 25 Mar 1993 15:45:28 CARLS
+changed Format title ID
+
+ Rev 1.33 19 Mar 1993 17:08:00 chrish
+Cosmetic stuff for erase dialog display.
+
+ Rev 1.32 17 Mar 1993 16:37:40 chrish
+Changed security check to "SeBackupPrivilege"
+
+ Rev 1.31 10 Mar 1993 12:45:26 CARLS
+Changes to move Format tape to the Operations menu
+
+ Rev 1.30 25 Feb 1993 09:50:06 TIMN
+Disable SECURE erase button if drive doesn't support it EPR(0176)
+
+ Rev 1.29 12 Feb 1993 16:02:12 CARLS
+always set the focus to Cancel button
+
+ Rev 1.28 27 Jan 1993 14:23:50 STEVEN
+updates from msoft
+
+ Rev 1.27 06 Jan 1993 14:59:38 chrish
+Corrected tape security message displayed on illegal erase.
+
+ Rev 1.26 05 Jan 1993 09:23:02 chrish
+Fix for erasing a foreign tape
+
+ Rev 1.25 23 Dec 1992 11:34:00 chrish
+Added security erase.
+
+ Rev 1.24 13 Nov 1992 17:29:02 chrish
+Added partial stuff for formatting a tape.
+
+ Rev 1.23 07 Oct 1992 13:43:48 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.22 04 Oct 1992 19:37:24 DAVEV
+Unicode Awk pass
+
+ Rev 1.21 28 Jul 1992 15:06:54 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.20 07 Jul 1992 15:42:24 MIKEP
+unicode changes
+
+ Rev 1.19 14 May 1992 16:42:28 MIKEP
+nt pass 2
+
+ Rev 1.18 27 Mar 1992 10:27:52 DAVEV
+OEM_MSOFT: add user name to tape info string and chg Secure Erase chkbox to radio buttons
+
+
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define ERASE 1
+#define FORMAT 2
+
+struct erase_temp {
+ WORD dialog_return_status ;
+ HTIMER timer_handle ;
+ HWND ghDlg ; /* window handle of the dialog box */
+ UINT32 tape_id ;
+ WORD display_status ;
+ INT poll_drive_freq ;
+ WORD operation ;
+} ;
+
+static struct erase_temp *erase_temp_ptr ;
+
+static VOID clock_routine( VOID ) ;
+
+BOOLEAN GetOriginalOwnerOfTape( DBLK_PTR, CHAR_PTR ); // chs:04-22-93
+
+
+/***************************************************
+
+ Name: DM_StartErase
+
+ Description: Starts the Erase tape dialog
+
+ Returns: Returns the status from the dialog.
+
+*****************************************************/
+INT DM_StartErase( VOID )
+{
+INT status;
+struct erase_temp temp_data ;
+
+ erase_temp_ptr = &temp_data ;
+
+ erase_temp_ptr->operation = ERASE ;
+
+ status = DM_ShowDialog( ghWndFrame, IDD_ERASE, NULL ) ;
+
+ return( status ) ;
+}
+/***************************************************
+
+ Name: DM_StartFormat
+
+ Description: Starts the Format tape dialog
+
+ Returns: Returns the status from the dialog.
+
+*****************************************************/
+#ifdef OS_WIN32
+INT DM_StartFormat( VOID )
+{
+INT status;
+struct erase_temp temp_data ;
+
+ erase_temp_ptr = &temp_data ;
+
+ erase_temp_ptr->operation = FORMAT ;
+
+ status = DM_ShowDialog( ghWndFrame, IDD_ERASE, NULL ) ;
+
+ return( status ) ;
+}
+#endif // OS_WIN32
+/***************************************************
+
+ Name: DM_Erase
+
+ Description: Erase tape dialog procedure
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_Erase(
+HWND hDlg , /* window handle of the dialog box */
+MSGID message , /* type of message */
+MP1 mp1 , /* message-specific information */
+MP2 mp2
+)
+{
+ PAINTSTRUCT ps ;
+ HDC hDC ;
+ HDC hDCBitmap ;
+ HWND hWnd ;
+ HICON hIcon ;
+
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( message )
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ erase_temp_ptr->ghDlg = hDlg ;
+ erase_temp_ptr->tape_id = 0 ;
+
+ DM_CenterDialog( hDlg ) ;
+
+ hIcon = LoadIcon( 0, IDI_EXCLAMATION );
+ SendDlgItemMessage ( hDlg, IDD_ERASE_EXCLAMATION_BITMAP, STM_SETICON, (MP1)hIcon, 0L );
+
+#ifdef OS_WIN32
+ if( erase_temp_ptr->operation == FORMAT ) {
+ yresprintf( (INT16) RES_FORMAT_DIALOG_TITLE ) ;
+ SetWindowText( hDlg, gszTprintfBuffer ) ;
+ }
+#endif // OS_WIN32
+
+ /* read POLL DRIVE data */
+ clock_routine( ) ;
+
+ erase_temp_ptr->poll_drive_freq = PD_SetFrequency( 1 ) ;
+ erase_temp_ptr->timer_handle = WM_HookTimer( clock_routine, 1 );
+#ifdef OS_WIN32
+
+ if( erase_temp_ptr->operation == FORMAT ) {
+ yresprintf( (INT16) RES_FORMAT_TAPE_WARNING ) ;
+ SetDlgItemText( hDlg, IDD_ERASE_LINE2, gszTprintfBuffer ) ;
+ ShowWindow( GetDlgItem( hDlg, IDD_ERASE_QUICK_BUTTON ), SW_HIDE ) ;
+ ShowWindow( GetDlgItem( hDlg, IDD_ERASE_SECURE_BUTTON ), SW_HIDE ) ;
+ }
+#endif // OS_WIN32
+
+ if( erase_temp_ptr->operation == ERASE ) {
+ /* Check default log file radio button */
+ CheckDlgButton( hDlg, IDD_ERASE_QUICK_BUTTON, 1 ) ;
+
+ /* Enable or Disable the Secure Erase radio button */
+ EnableWindow( GetDlgItem( hDlg, IDD_ERASE_SECURE_BUTTON ),
+ ( thw_list->drv_info.drv_features & TDI_LONG_ERASE ) ? TRUE : 0 ) ;
+ }
+
+ return ( TRUE ) ;
+
+ case WM_COMMAND: /* message: received a command */
+ {
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+
+ switch( wId )
+ {
+
+#ifdef OEM_MSOFT //special feature
+
+ case IDD_ERASE_QUICK_BUTTON:
+ case IDD_ERASE_SECURE_BUTTON:
+
+ CheckRadioButton ( hDlg, IDD_ERASE_QUICK_BUTTON,
+ IDD_ERASE_SECURE_BUTTON, wId ) ;
+ return TRUE ;
+
+#endif //OEM_MSOFT //special feature
+
+/****************************************************************************
+ Continue button
+/***************************************************************************/
+ case IDD_ERASE_CONTINUE_BUTTON:
+
+#ifdef OEM_MSOFT
+{
+ CHAR_PTR passwdbuffer1;
+ LPSTR generic_str_ptr;
+ INT16 passwordlength;
+ DBLK_PTR vcb_ptr;
+ CHAR buffer[ MAX_UI_RESOURCE_SIZE ];
+ CHAR buffer2[ MAX_UI_RESOURCE_SIZE ];
+
+ //
+ // Check to see if is a valid user or not
+ //
+
+ if ( VLM_GetDriveStatus( &vcb_ptr ) == VLM_VALID_TAPE ) {
+ generic_str_ptr = GetCurrentMachineNameUserName( );
+ passwdbuffer1 = ( CHAR_PTR )calloc( 1, ( 3 + strlen( generic_str_ptr ) ) * sizeof( CHAR ) );
+
+ if ( passwdbuffer1 ) {
+ *passwdbuffer1 = NTPASSWORDPREFIX;
+ if ( generic_str_ptr ) {
+ strcat( passwdbuffer1, generic_str_ptr );
+ }
+
+ passwordlength = strlen( passwdbuffer1 );
+// chs:02-01-94 CryptPassword( ( INT16 ) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)passwdbuffer1, ( INT16 ) ( strlen( passwdbuffer1 ) * sizeof( CHAR ) ) );
+ if ( ( WhoPasswordedTape ( (BYTE_PTR)FS_ViewTapePasswordInVCB( vcb_ptr ), FS_SizeofTapePswdInVCB( vcb_ptr ) ) != OTHER_APP ) && // chs:04-08-93
+ !IsUserValid( vcb_ptr, (BYTE_PTR)passwdbuffer1, ( INT16 )( passwordlength * sizeof( CHAR ) ) ) && !DoesUserHaveThisPrivilege( TEXT ( "SeBackupPrivilege" ) ) ) { // chs:04-08-93
+ //
+ // Popup dialog box message if
+ // not a valid user
+ //
+
+ RSM_StringCopy( IDS_ERASE_TAPE_SECURITY, buffer, sizeof(buffer) );
+ RSM_StringCopy( IDS_TAPE_SECURITY_TITLE, buffer2, sizeof(buffer2) );
+ WM_MsgBox( buffer2, buffer, WMMB_OK, WMMB_ICONEXCLAMATION );
+ buffer[0] = 0;
+ free( passwdbuffer1 );
+ return ( TRUE );
+ }
+
+ free( passwdbuffer1 );
+ }
+ }
+}
+#endif //OEM_MSOFT
+
+ /* if secure erase is checked - set for secure erase */
+ if( IsDlgButtonChecked( hDlg, IDD_ERASE_SECURE_BUTTON ) )
+ CDS_SetEraseFlag( CDS_GetCopy(), ERASE_LONG ) ;
+
+#ifdef OS_WIN32
+ if( erase_temp_ptr->operation == FORMAT ) {
+ CDS_SetEraseFlag( CDS_GetCopy(), ERASE_FORMAT ) ;
+ }
+#endif // OS_WIN32
+
+ WM_UnhookTimer( erase_temp_ptr->timer_handle );
+ PD_SetFrequency( erase_temp_ptr->poll_drive_freq ) ;
+ EndDialog( hDlg, TRUE ) ; /* Exits the dialog box */
+ return ( TRUE ) ;
+ break ;
+/****************************************************************************
+ Help button
+/***************************************************************************/
+ case IDD_ERASE_HELP_BUTTON:
+ case IDHELP :
+
+ if( erase_temp_ptr->operation == FORMAT ) {
+ HM_DialogHelp( HELPID_OPERATIONSFORMAT ) ;
+ } else {
+ HM_DialogHelp( HELPID_DIALOGERASE ) ;
+ }
+
+ return ( TRUE ) ;
+ break ;
+/****************************************************************************
+ Cancel button
+/***************************************************************************/
+ case IDD_ERASE_CANCEL_BUTTON:
+ case IDCANCEL:
+
+ WM_UnhookTimer( erase_temp_ptr->timer_handle );
+ PD_SetFrequency( erase_temp_ptr->poll_drive_freq ) ;
+ EndDialog( hDlg, FALSE ) ; /* Exits the dialog box */
+ return ( TRUE ) ;
+ break ;
+
+ }
+ }
+ break ;
+ }
+ return ( FALSE ) ; /* Didn't process a message */
+}
+
+
+/***************
+
+ GetDriveStatus
+ possible return values
+ SEE VLM.H
+
+ VLM_VALID_TAPE 0
+ VLM_DRIVE_BUSY 1
+ VLM_FOREIGN_TAPE 2
+ VLM_BLANK_TAPE 3
+ VLM_NO_TAPE 4
+ VLM_BUSY 5
+ VLM_BAD_TAPE 6
+ VLM_GOOFY_TAPE 7
+ VLM_DISABLED 8
+ VLM_UNFORMATED 9
+ VLM_DRIVE_FAILURE 10
+ VLM_FUTURE_VER 11
+ VLM_ECC_TAPE 12
+ VLM_SQL_TAPE 13
+
+
+***************/
+/***************************************************
+
+ Name: clock_routine
+
+ Description: poll drive status routine
+
+ Returns: void
+
+*****************************************************/
+static VOID clock_routine( VOID )
+{
+ DBLK_PTR vcb_ptr ;
+ DATE_TIME_PTR dt ;
+ WORD status ;
+ UINT32 current_tape_id ;
+ CHAR date_str[ MAX_UI_DATE_SIZE ] ;
+ CHAR time_str[ MAX_UI_TIME_SIZE ] ;
+ CHAR buffer[ 80 ] ;
+ CHAR temptapepswd[2]; // chs:03-19-93
+
+ status = VLM_GetDriveStatus( &vcb_ptr ) ;
+
+ switch( status ) {
+
+ case VLM_VALID_TAPE:
+
+ /* get this tape ID */
+ current_tape_id = FS_ViewTapeIDInVCB( vcb_ptr ) ;
+
+ /* if this ID not equal to the last ID, then must be a new tape */
+ if( erase_temp_ptr->tape_id != current_tape_id )
+ {
+ /* save this tape ID */
+ erase_temp_ptr->tape_id = current_tape_id ;
+
+ /* display name, date and time of this tape */
+ dt = FS_ViewBackupDateInVCB( vcb_ptr ) ;
+ UI_MakeDateString( date_str, dt->month, dt->day, dt->year % 100 );
+ UI_MakeShortTimeString( time_str, dt->hour, dt->minute );
+
+# if defined ( OEM_MSOFT ) //alternate feature
+ {
+ CHAR namebuffer[ MAX_UI_RESOURCE_SIZE ]; // chs:04-22-93
+ // chs:04-22-93
+ if ( !GetOriginalOwnerOfTape( vcb_ptr, namebuffer ) ) { // chs:04-22-93
+ strcpy( namebuffer, FS_ViewUserNameInVCB( vcb_ptr ) ); // chs:04-22-93
+ } // chs:04-22-93
+
+ yresprintf( (INT16) RES_ERASE_TAPE_INFO1 ,
+ FS_ViewTapeNameInVCB( vcb_ptr ) ,
+ // chs:04-22-93 FS_ViewUserNameInVCB( vcb_ptr ),
+ namebuffer, // chs:04-22-93
+ date_str ,
+ time_str ) ;
+ }
+# else //if defined ( OEM_MSOFT ) //alternate feature
+ {
+ yresprintf( RES_ERASE_TAPE_INFO1 ,
+ FS_ViewTapeNameInVCB( vcb_ptr ) ,
+ date_str ,
+ time_str ) ;
+ }
+# endif //defined ( OEM_MSOFT ) //alternate feature
+
+#ifndef OEM_MSOFT // chs:03-19-93
+ // // chs:03-19-93
+ // Just cosmetic stuff // chs:03-19-93
+ // // chs:03-19-93
+ // chs:03-19-93
+ if( FS_SizeofTapePswdInVCB( vcb_ptr ) ) { // chs:03-19-93
+ temptapepswd[0] = *( FS_ViewTapePasswordInVCB( vcb_ptr ) ); // chs:03-19-93
+ temptapepswd[1] = TEXT( '\0' ); // chs:03-19-93
+ CryptPassword( ( INT16 ) DECRYPT, FS_ViewPswdEncryptInVCB( vcb_ptr ), (INT8_PTR)temptapepswd, 1 * sizeof( CHAR ) ); // chs:03-19-93
+ if ( temptapepswd[0] != NTPASSWORDPREFIX ) { // chs:04-08-93
+ // chs:03-19-93
+ RSM_StringCopy( IDS_TAPE_PASSWORD_PROTECTED, buffer, 80 ) ; // chs:03-19-93
+ strcat( gszTprintfBuffer, buffer ) ; // chs:03-19-93
+ } // chs:03-19-93
+ } // chs:03-19-93
+#endif // chs:03-19-93
+
+// chs:03-19-93 if( FS_SizeofTapePswdInVCB( vcb_ptr ) ) {
+// chs:03-19-93
+// chs:03-19-93 RSM_StringCopy( IDS_TAPE_PASSWORD_PROTECTED, buffer, 80 ) ;
+// chs:03-19-93 strcat( gszTprintfBuffer, buffer ) ;
+// chs:03-19-93 }
+
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+
+ /* turn the CONTINUE button on */
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), TRUE ) ;
+ }
+ break;
+
+ case VLM_FUTURE_VER:
+ case VLM_SQL_TAPE:
+ case VLM_ECC_TAPE:
+ case VLM_FOREIGN_TAPE:
+ case VLM_GOOFY_TAPE:
+
+ if ( erase_temp_ptr->display_status != VLM_FOREIGN_TAPE ) {
+
+ erase_temp_ptr->display_status = VLM_FOREIGN_TAPE ;
+
+ switch( status ) {
+
+ case VLM_FUTURE_VER:
+ yresprintf( IDS_VLMFUTURETEXT ) ;
+ break ;
+
+ case VLM_SQL_TAPE:
+ yresprintf( IDS_VLMSQLTEXT ) ;
+ break ;
+
+ case VLM_ECC_TAPE:
+ yresprintf( IDS_VLMECCTEXT ) ;
+ break ;
+
+ case VLM_FOREIGN_TAPE:
+ yresprintf( (INT16)RES_ERASE_FOREIGN_TAPE ) ;
+ break ;
+
+ case VLM_GOOFY_TAPE:
+ yresprintf( IDS_VLMGOOFYTEXT ) ;
+ break ;
+ }
+
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+ /* turn the CONTINUE button on */
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), TRUE ) ;
+ erase_temp_ptr->tape_id = 0 ;
+ }
+ break ;
+
+ case VLM_BAD_TAPE:
+
+ if(erase_temp_ptr->display_status != VLM_BAD_TAPE ) {
+
+ erase_temp_ptr->display_status = VLM_BAD_TAPE ;
+ yresprintf( (INT16) RES_ERASE_BAD_TAPE ) ;
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+ /* turn the CONTINUE button on */
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), TRUE ) ;
+ erase_temp_ptr->tape_id = 0 ;
+ }
+ break;
+
+ case VLM_BLANK_TAPE:
+
+ if(erase_temp_ptr->display_status != VLM_BLANK_TAPE ) {
+
+ erase_temp_ptr->display_status = VLM_BLANK_TAPE ;
+ yresprintf( (INT16) RES_ERASE_BLANK_TAPE ) ;
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+ /* turn the CONTINUE button on */
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), TRUE ) ;
+ erase_temp_ptr->tape_id = 0 ;
+ }
+ break;
+
+#ifdef OS_WIN32
+ case VLM_UNFORMATED:
+
+ if(erase_temp_ptr->display_status != VLM_UNFORMATED ) {
+
+ erase_temp_ptr->display_status = VLM_UNFORMATED ;
+ yresprintf( (INT16) RES_VLM_UNFORMATED_TAPE ) ;
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+ /* turn the CONTINUE button on */
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), TRUE ) ;
+ erase_temp_ptr->tape_id = 0 ;
+ }
+ break;
+#endif // OS_WIN32
+
+ case VLM_NO_TAPE:
+
+ if(erase_temp_ptr->display_status != VLM_NO_TAPE ) {
+
+ erase_temp_ptr->display_status = VLM_NO_TAPE ;
+ yresprintf( (INT16) RES_ERASE_NO_TAPE ) ;
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+
+ /* turn the CONTINUE button off when busy */
+
+ if ( GetFocus() == GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ) ) {
+ SetFocus( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CANCEL_BUTTON ) );
+ }
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE ) ;
+
+ erase_temp_ptr->tape_id = 0 ;
+ }
+ break;
+
+ case VLM_BUSY:
+
+ if(erase_temp_ptr->display_status != VLM_BUSY ) {
+
+ erase_temp_ptr->display_status = VLM_BUSY ;
+ yresprintf( (INT16) RES_ERASE_DRIVE_BUSY ) ;
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+
+ /* turn the CONTINUE button off when busy */
+
+ if ( GetFocus() == GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ) ) {
+ SetFocus( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CANCEL_BUTTON ) );
+ }
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), FALSE ) ;
+
+ erase_temp_ptr->tape_id = 0 ;
+ }
+ break;
+
+ case VLM_DISABLED:
+
+ if(erase_temp_ptr->display_status != VLM_DISABLED ) {
+
+ erase_temp_ptr->display_status = VLM_DISABLED ;
+ yresprintf( (INT16) RES_ERASE_POLL_DRIVE_DISABLED ) ;
+ SetDlgItemText( erase_temp_ptr->ghDlg, IDD_ERASE_LINE1, gszTprintfBuffer ) ;
+ /* turn the CONTINUE button on */
+ EnableWindow ( GetDlgItem ( erase_temp_ptr->ghDlg, IDD_ERASE_CONTINUE_BUTTON ), TRUE ) ;
+ erase_temp_ptr->tape_id = 0 ;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
diff --git a/private/utils/ntbackup/src/exe.bmp b/private/utils/ntbackup/src/exe.bmp
new file mode 100644
index 000000000..b1a9ea401
--- /dev/null
+++ b/private/utils/ntbackup/src/exe.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/file.bmp b/private/utils/ntbackup/src/file.bmp
new file mode 100644
index 000000000..286e4f89c
--- /dev/null
+++ b/private/utils/ntbackup/src/file.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/files.ico b/private/utils/ntbackup/src/files.ico
new file mode 100644
index 000000000..d746fddaf
--- /dev/null
+++ b/private/utils/ntbackup/src/files.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/filgetc.c b/private/utils/ntbackup/src/filgetc.c
new file mode 100644
index 000000000..8b2848836
--- /dev/null
+++ b/private/utils/ntbackup/src/filgetc.c
@@ -0,0 +1,96 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: filgetc.c
+
+ Description: This file contains code to get & unget the next
+ character in the current file.
+
+ $Log: G:/UI/LOGFILES/FILGETC.C_V $
+
+ Rev 1.7 03 May 1993 09:46:42 MIKEP
+try again.
+
+ Rev 1.6 03 May 1993 08:59:10 MIKEP
+Fix last change so it would compile.
+
+ Rev 1.5 02 May 1993 19:37:26 BARRY
+Changed to properly detect EOF on MIPS machine.
+
+ Rev 1.4 07 Oct 1992 14:15:44 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.3 04 Oct 1992 19:37:26 DAVEV
+Unicode Awk pass
+
+ Rev 1.2 17 Aug 1992 13:17:48 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.1 18 May 1992 09:06:36 MIKEP
+header
+
+ Rev 1.0 20 Nov 1991 19:19:34 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: filegetc()
+
+ Description: This function get the next character from an opened
+ file.
+
+ Returns: The character read from the file
+ ^Z if end of file.
+
+*****************************************************************************/
+CHAR filgetc(
+CHAR *fin , /* I - must come in as CHAR_PTR then cast as needed */
+INT16_PTR kludge ) /* U - here for consistency with string version */
+{
+ INT ch;
+ CHAR ret_val ;
+
+ ch = fgetc( (FILE * ) fin ) ;
+ ret_val = (CHAR)ch;
+
+ if ( ch == EOF ) {
+ if ( feof( (FILE *)fin ) || ferror( (FILE *)fin ) ) {
+ ret_val = 0x1a ;
+ }
+ }
+
+ return( ret_val ) ;
+
+ kludge ; /* so compiler won't complain ! */
+}
+/*****************************************************************************
+
+ Name: filpushc()
+
+ Description: This function places a character back into a file
+ by doing an ungetc()
+
+ Returns: nothing
+
+ Notes: The file pointer is passed as a character pointer
+ for conistancy with the string version.
+
+*****************************************************************************/
+VOID filpushc(
+CHAR c , /* I - character to palce back in fie */
+CHAR_PTR fin , /* I - File pointer */
+INT16_PTR kludge ) /* U - unused */
+{
+ INT16* dummy ;
+ dummy = kludge ; /* so compiler won't complain about unref locals */
+ ( VOID ) ungetc( c, (FILE *) fin ) ;
+ return ;
+}
diff --git a/private/utils/ntbackup/src/floppy1.bmp b/private/utils/ntbackup/src/floppy1.bmp
new file mode 100644
index 000000000..1b160782d
--- /dev/null
+++ b/private/utils/ntbackup/src/floppy1.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/floppy2.bmp b/private/utils/ntbackup/src/floppy2.bmp
new file mode 100644
index 000000000..1b160782d
--- /dev/null
+++ b/private/utils/ntbackup/src/floppy2.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/floppy3.bmp b/private/utils/ntbackup/src/floppy3.bmp
new file mode 100644
index 000000000..1b160782d
--- /dev/null
+++ b/private/utils/ntbackup/src/floppy3.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/floppy4.bmp b/private/utils/ntbackup/src/floppy4.bmp
new file mode 100644
index 000000000..1b160782d
--- /dev/null
+++ b/private/utils/ntbackup/src/floppy4.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fmttab.c b/private/utils/ntbackup/src/fmttab.c
new file mode 100644
index 000000000..e2a0739ca
--- /dev/null
+++ b/private/utils/ntbackup/src/fmttab.c
@@ -0,0 +1,581 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fmttab.c
+
+ Description: Contains the static table of tape format translator
+ entry points.
+
+ Note: To add a new translator, you must edit both this file
+ and "lwtfinf.c".
+
+
+ $Log: T:/LOGFILES/FMTTAB.C_V $
+
+ Rev 1.31 22 Jun 1993 10:53:20 GREGG
+Added API to change the catalog directory path.
+
+ Rev 1.30 29 Apr 1993 22:26:46 GREGG
+Added StartRead entry point for MTF translator.
+
+ Rev 1.29 17 Mar 1993 15:15:04 TERRI
+Added changes for the Sytos Plus translator.
+
+ Rev 1.28 09 Mar 1993 18:14:54 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.27 26 Jan 1993 01:30:50 GREGG
+Added Fast Append functionality.
+
+ Rev 1.26 25 Jan 1993 22:11:48 GREGG
+Brought all translators up to date as far as number of entries in table.
+
+ Rev 1.25 23 Nov 1992 10:22:40 HUNTER
+Add F40_ParseEOM into table.
+
+ Rev 1.24 17 Nov 1992 22:17:42 DAVEV
+unicode fixes
+
+ Rev 1.23 11 Nov 1992 13:59:38 HUNTER
+Deleted reference to "F31_Recall"
+
+ Rev 1.22 11 Nov 1992 09:45:56 HUNTER
+Updated Maynard 3.1 table.
+NOTE: This translator no longer supports writing tapes, and no longer
+supports reading IMAGE DBs.
+
+ Rev 1.21 09 Nov 1992 11:00:52 GREGG
+Added entry points for accessing tape catalogs.
+
+ Rev 1.20 03 Nov 1992 09:30:46 HUNTER
+
+ Rev 1.19 22 Oct 1992 10:44:00 HUNTER
+Changes for new stream headers
+
+ Rev 1.18 25 Sep 1992 09:29:10 GREGG
+Changed rd_mk_mdb function in 40 format table from NULL to F40_RdEOSPadBlk.
+
+ Rev 1.17 22 Sep 1992 08:56:48 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.16 14 Aug 1992 16:23:56 GREGG
+Removed size fields in function table initialization.
+
+ Rev 1.15 04 Aug 1992 16:54:40 GREGG
+Burt's fixes for variable length block support.
+
+ Rev 1.14 20 May 1992 19:58:44 GREGG
+Added StartRead and removed verify_vcb for 40 format.
+
+ Rev 1.13 28 Apr 1992 16:15:30 GREGG
+ROLLER BLADES - Added new_tape entry for 4.0 format.
+
+ Rev 1.12 23 Apr 1992 10:54:54 BURT
+Added table entries for Sytos Plus 1.0 read translator.
+
+
+ Rev 1.11 05 Apr 1992 17:17:10 GREGG
+ROLLER BLADES - Initial OTC integration.
+
+ Rev 1.10 25 Mar 1992 19:40:54 GREGG
+ROLLER BLADES - Added 4.0 format and min_siz_for_dblk to all.
+
+ Rev 1.9 11 Feb 1992 15:33:22 ZEIR
+
+ - Ad'd UTF_PreferredSpace entry.
+
+ Rev 1.8 04 Feb 1992 21:31:36 NED
+Changes to Buffer Management translator hooks.
+
+ Rev 1.7 16 Jan 1992 18:43:44 ZEIR
+Latest BufferMan solution no longer requires StartReadHook.
+
+ Rev 1.6 06 Jan 1992 17:34:46 ZEIR
+Added UTF entry, and ReadStartHook
+
+ Rev 1.5 05 Dec 1991 14:01:54 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.4 19 Nov 1991 08:53:48 GREGG
+VBLK - Closed the comment that HUNTER OPENED!!! (how did it ever compile???)
+
+ Rev 1.3 07 Nov 1991 15:33:56 unknown
+VBLK - Added Variable Length Block Support
+
+ Rev 1.2 07 Jun 1991 00:39:46 NED
+Added compiler directives to allow selective inclusion of translators.
+
+ Rev 1.1 10 May 1991 11:54:56 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:18:42 GREGG
+Initial revision.
+
+**/
+
+/* begin include list */
+#include <stdio.h>
+#include "stdtypes.h"
+#include "stdmacro.h"
+#include "tbe_defs.h"
+#include "datetime.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "fmteng.h"
+#include "transutl.h"
+#include "fsys.h"
+#include "tloc.h"
+#include "lw_data.h"
+#include "tfldefs.h"
+
+#include "mayn40.h"
+#include "transprt.h" /* prototypes */
+
+/* $end$ include list */
+
+FMT supported_fmts[] = {
+
+#ifdef MY40_TRANS
+ /*
+ * Maynard Tape Format 4.0
+ */
+ {
+ F40_Determiner, /* determiner */
+ F40_Initialize, /* initializer */
+ F40_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ NULL, /* get preferred space */
+ NULL, /* read buffer hook */
+ F40_DetBlkType, /* parser */
+ F40_SizeofTBLK, /* sizeof_tblk */
+ F40_RdException, /* exception_action */
+ F40_NewTape, /* new_tape, process tape header */
+ F40_WriteInit, /* post-positioning write init */
+ F40_InitTape, /* initialize new tape for write */
+ F40_StartRead, /* post-positioning read init */
+ F40_MoveToVCB, /* move_to_vcb */
+ F40_SeekEOD, /* seek_eod (for fast append) */
+ F40_RdSSET, /* get_current_vcb */
+ NULL, /* verify_vcb */
+ F40_RdContTape, /* rd_cont_tape */
+ NULL, /* rd_recall */
+ F40_RdSSET, /* rd_mk_vcb */
+ F40_RdDIRB, /* rd_mk_ddb */
+ F40_RdFILE, /* rd_mk_fdb */
+ F40_RdIMAG, /* rd_mk_idb */
+ F40_RdCFIL, /* rd_mk_cfdb */
+ F40_RdSSET, /* rd_mk_bsdb */
+ F40_RdUDB, /* rd_mk_osudb */
+ F40_RdMDB, /* rd_mk_mdb */
+ F40_RdStream, /* read stream */
+ F40_WtSSET, /* wt_mk_vcb */
+ F40_WtDIRB, /* wt_mk_ddb */
+ F40_WtFILE, /* wt_mk_fdb */
+ F40_WtStream, /* Write Stream */
+ F40_EndData, /* End Data */
+ F40_WtIMAG, /* wt_mk_idb */
+ F40_WtCFIL, /* wt_mk_cfdb */
+ F40_WtContVStream, /* Continue Variable Stream */
+ F40_WtEndVStream, /* End Variable Stream */
+ F40_ParseWrittenBuffer, /* Post processing of write buffer */
+ F40_WtCloseTape, /* wt_close_tape */
+ F40_WtContTape, /* wt_cont_set */
+ F40_WtCloseSet, /* wt_close_set */
+ F40_WtEOSPadBlk, /* wt_eos_pad_blk */
+ F40_LoadSM, /* load_set_map */
+ F40_LoadFDD, /* load_set_cat */
+ F40_GetNextSMEntry, /* get_next_sm_entry */
+ F40_GetNextFDDEntry, /* get_next_sc_entry */
+ F40_CloseCatalogs /* close_catalogs */
+ },
+#endif
+
+#ifdef MY31_TRANS
+ /*
+ * Maynard Tape Format 3.1
+ */
+ {
+ F31_Determiner, /* determiner */
+ F31_Initialize, /* initializer */
+ F31_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ NULL, /* get preferred space */
+ NULL, /* read buffer hook */
+ F31_DetBlkType, /* parser */
+ F31_SizeofTBLK, /* sizeof_tblk */
+ F31_RdException, /* exception_action */
+ NULL, /* new_tape, process tape header */
+ NULL, /* post-positioning write init */
+ NULL, /* initialize new tape for write */
+ NULL, /* post-positioning read init */
+ F31_MoveToVCB, /* move_to_vcb */
+ NULL, /* seek_eod (for fast append) */
+ F31_RdVCB, /* get_current_vcb */
+ F31_Determiner, /* verify_vcb */
+ F31_RdContTape, /* rd_cont_tape */
+ NULL, /* rd_recall */
+ F31_RdVCB, /* rd_mk_vcb */
+ F31_RdDDB, /* rd_mk_ddb */
+ F31_RdFDB, /* rd_mk_fdb */
+ NULL, /* rd_mk_idb */
+ F31_RdCFDB, /* rd_mk_cfdb */
+ F31_RdVCB, /* rd_mk_bsdb */
+ F31_RdUDB, /* rd_mk_osudb */
+ NULL, /* rd_mk_mdb */
+ F31_RdStream, /* read stream */
+ NULL, /* wt_mk_vcb */
+ NULL, /* wt_mk_ddb */
+ NULL, /* wt_mk_fdb */
+ NULL, /* Write Stream */
+ NULL, /* End Data */
+ NULL, /* wt_mk_idb */
+ NULL, /* wt_mk_cfdb */
+ NULL, /* Continue Variable Stream */
+ NULL, /* End Variable Stream */
+ NULL, /* Post processing of write buffer */
+ NULL, /* wt_close_tape */
+ NULL, /* wt_cont_set */
+ NULL, /* wt_close_set */
+ NULL, /* wt_eos_pad_blk */
+ NULL, /* load_set_map */
+ NULL, /* load_set_cat */
+ NULL, /* get_next_sm_entry */
+ NULL, /* get_next_sc_entry */
+ NULL /* close_catalogs */
+ },
+#endif
+
+#ifdef MY30_TRANS
+ /*
+ * Maynard Tape Format 3.0
+ */
+ {
+ F30_Determiner, /* determiner */
+ F30_Initializer, /* initializer */
+ F30_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ NULL, /* get preferred space */
+ NULL, /* read buffer hook */
+ F30_DetBlkType, /* parser */
+ NULL, /* sizeof_tblk */
+ F30_RdException, /* exception_action */
+ NULL, /* new_tape, process tape header */
+ NULL, /* post-positioning write init */
+ NULL, /* initialize new tape for write */
+ NULL, /* post-positioning read init */
+ F30_MoveToVCB, /* move_to_vcb */
+ NULL, /* seek_eod (for fast append) */
+ F30_RdVCB, /* get_current_vcb */
+ F30_Determiner, /* verify_vcb */
+ F30_RdContTape, /* rd_cont_tape */
+ NULL, /* rd_recall */
+ F30_RdVCB, /* rd_mk_vcb */
+ F30_RdDDB, /* rd_mk_ddb */
+ F30_RdFDB, /* rd_mk_fdb */
+ NULL, /* rd_mk_idb */
+ F30_RdCFDB, /* rd_mk_cfdb */
+ NULL, /* rd_mk_bsdb */
+ F30_RdUDB, /* rd_mk_osudb */
+ NULL, /* rd_mk_mdb */
+ NULL, /* read stream */
+ NULL, /* wt_mk_vcb */
+ NULL, /* wt_mk_ddb */
+ NULL, /* wt_mk_fdb */
+ NULL, /* Write Stream */
+ NULL, /* End Data */
+ NULL, /* wt_mk_idb */
+ NULL, /* wt_mk_cfdb */
+ NULL, /* Continue Variable Stream */
+ NULL, /* End Variable Stream */
+ NULL, /* Post processing of write buffer */
+ NULL, /* wt_close_tape */
+ NULL, /* wt_cont_set */
+ NULL, /* wt_close_set */
+ NULL, /* wt_eos_pad_blk */
+ NULL, /* load_set_map */
+ NULL, /* load_set_cat */
+ NULL, /* get_next_sm_entry */
+ NULL, /* get_next_sc_entry */
+ NULL /* close_catalogs */
+ },
+#endif
+
+#ifdef MY25_TRANS
+ /*
+ * Maynard Tape Format 2.5
+ */
+ {
+ F25_Determiner, /* determiner */
+ F25_Initializer, /* initializer */
+ F25_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ NULL, /* get preferred space */
+ NULL, /* read buffer hook */
+ F25_DetBlkType, /* parser */
+ NULL, /* sizeof_tblk */
+ F25_RdException, /* exception_action */
+ NULL, /* new_tape, process tape header */
+ NULL, /* post-positioning write init */
+ NULL, /* initialize new tape for write */
+ NULL, /* post-positioning read init */
+ F25_MoveToVCB, /* move_to_vcb */
+ NULL, /* seek_eod (for fast append) */
+ F25_RdVCB, /* get_current_vcb */
+ F25_Determiner, /* verify_vcb */
+ F25_RdContTape, /* rd_cont_tape */
+ F25_Recall, /* rd_recall */
+ F25_RdVCB, /* rd_mk_vcb */
+ F25_RdDDB, /* rd_mk_ddb */
+ F25_RdFDB, /* rd_mk_fdb */
+ F25_RdIDB, /* rd_mk_idb */
+ F25_RdCFDB, /* rd_mk_cfdb */
+ NULL, /* rd_mk_bsdb */
+ F25_RdUDB, /* rd_mk_osudb */
+ F25_RdMDB, /* rd_mk_mdb */
+ NULL, /* read stream */
+ NULL, /* wt_mk_vcb */
+ NULL, /* wt_mk_ddb */
+ NULL, /* wt_mk_fdb */
+ NULL, /* Write Stream */
+ NULL, /* End Data */
+ NULL, /* wt_mk_idb */
+ NULL, /* wt_mk_cfdb */
+ NULL, /* Continue Variable Stream */
+ NULL, /* End Variable Stream */
+ NULL, /* Post processing of write buffer */
+ NULL, /* wt_close_tape */
+ NULL, /* wt_cont_set */
+ NULL, /* wt_close_set */
+ NULL, /* wt_eos_pad_blk */
+ NULL, /* load_set_map */
+ NULL, /* load_set_cat */
+ NULL, /* get_next_sm_entry */
+ NULL, /* get_next_sc_entry */
+ NULL /* close_catalogs */
+ },
+#endif
+
+#ifdef QS19_TRANS
+ /*
+ * QicStream 1.92/1.93
+ */
+ {
+ FQ_DetermineFormat, /* determiner */
+ FQ_Initialize, /* initializer */
+ FQ_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ NULL, /* get preferred space */
+ NULL, /* read buffer hook */
+ FQ_Parse, /* parser */
+ NULL, /* sizeof_tblk */
+ FQ_RdException, /* exception_action */
+ FQ_NewTape, /* new_tape, process tape header */
+ NULL, /* post-positioning write init */
+ NULL, /* initialize new tape for write */
+ NULL, /* post-positioning read init */
+ FQ_MoveToVCB, /* move_to_vcb */
+ NULL, /* seek_eod (for fast append) */
+ FQ_GetCurrentVCB, /* get_current_vcb */
+ NULL, /* verify_vcb */
+ NULL, /* rd_cont_tape */
+ FQ_ReTranslate, /* rd_recall */
+ NULL, /* rd_mk_vcb */
+ FQ_ReadMakeDDB, /* rd_mk_ddb */
+ FQ_ReadMakeFDB, /* rd_mk_fdb */
+ NULL, /* rd_mk_idb */
+ NULL, /* rd_mk_cfdb */
+ NULL, /* rd_mk_bsdb */
+ FQ_ReadMakeUDB, /* rd_mk_osudb */
+ FQ_ReadMakeMDB, /* rd_mk_mdb */
+ NULL, /* read stream */
+ NULL, /* wt_mk_vcb */
+ NULL, /* wt_mk_ddb */
+ NULL, /* wt_mk_fdb */
+ NULL, /* Write Stream */
+ NULL, /* End Data */
+ NULL, /* wt_mk_idb */
+ NULL, /* wt_mk_cfdb */
+ NULL, /* Continue Variable Stream */
+ NULL, /* End Variable Stream */
+ NULL, /* Post processing of write buffer */
+ NULL, /* wt_close_tape */
+ NULL, /* wt_cont_set */
+ NULL, /* wt_close_set */
+ NULL, /* wt_eos_pad_blk */
+ NULL, /* load_set_map */
+ NULL, /* load_set_cat */
+ NULL, /* get_next_sm_entry */
+ NULL, /* get_next_sc_entry */
+ NULL /* close_catalogs */
+ },
+#endif
+
+#ifdef SY31_TRANS
+ /*
+ * SyTos 3.11 Read
+ */
+ {
+ FSYT_DetermineFormat, /* determiner */
+ FSYT_Initialize, /* initializer */
+ FSYT_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ NULL, /* get preferred space */
+ NULL, /* read buffer hook */
+ FSYT_Parse, /* parser */
+ NULL, /* sizeof_tblk */
+ FSYT_RdException, /* exception_action */
+ FSYT_NewTape, /* new_tape, process tape header */
+ NULL, /* post-positioning write init */
+ NULL, /* initialize new tape for write */
+ NULL, /* post-positioning read init */
+ FSYT_MoveToVCB, /* move_to_vcb */
+ NULL, /* seek_eod (for fast append) */
+ FSYT_GetCurrentVCB, /* get_current_vcb */
+ NULL, /* verify_vcb */
+ NULL, /* rd_cont_tape */
+ FSYT_ReTranslate, /* rd_recall */
+ NULL, /* rd_mk_vcb */
+ FSYT_ReadMakeDDB, /* rd_mk_ddb */
+ FSYT_ReadMakeFDB, /* rd_mk_fdb */
+ NULL, /* rd_mk_idb */
+ NULL, /* rd_mk_cfdb */
+ NULL, /* rd_mk_bsdb */
+ FSYT_ReadMakeUDB, /* rd_mk_osudb */
+ FSYT_ReadMakeMDB, /* rd_mk_mdb */
+ NULL, /* read stream */
+ NULL, /* wt_mk_vcb */
+ NULL, /* wt_mk_ddb */
+ NULL, /* wt_mk_fdb */
+ NULL, /* Write Stream */
+ NULL, /* End Data */
+ NULL, /* wt_mk_idb */
+ NULL, /* wt_mk_cfdb */
+ NULL, /* Continue Variable Stream */
+ NULL, /* End Variable Stream */
+ NULL, /* Post processing of write buffer */
+ NULL, /* wt_close_tape */
+ NULL, /* wt_cont_set */
+ NULL, /* wt_close_set */
+ NULL, /* wt_eos_pad_blk */
+ NULL, /* load_set_map */
+ NULL, /* load_set_cat */
+ NULL, /* get_next_sm_entry */
+ NULL, /* get_next_sc_entry */
+ NULL /* close_catalogs */
+ },
+#endif
+
+#ifdef SYPL10_TRANS
+ /*
+ * SyTos Plus 1.0 Read
+ */
+ {
+ SYPL_DetermineFormat, /* determiner */
+ SYPL_Initialize, /* initializer */
+ SYPL_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ NULL, /* get preferred space */
+ NULL, /* read buffer hook */
+ SYPL_Parse, /* parser */
+ NULL, /* sizeof_tblk */
+ SYPL_RdException, /* exception_action */
+ SYPL_NewTape, /* new_tape, process tape header */
+ NULL, /* post-positioning write init */
+ NULL, /* initialize new tape for write */
+ NULL, /* post-positioning read init */
+ SYPL_MoveToVCB, /* move_to_vcb */
+ NULL, /* seek_eod (for fast append) */
+ SYPL_GetCurrentVCB, /* get_current_vcb */
+ NULL, /* verify_vcb */
+ NULL, /* rd_cont_tape */
+ SYPL_ReTranslate, /* rd_recall */
+ NULL, /* rd_mk_vcb */
+ SYPL_ReadMakeDDB, /* rd_mk_ddb */
+ SYPL_ReadMakeFDB, /* rd_mk_fdb */
+ NULL, /* rd_mk_idb */
+ NULL, /* rd_mk_cfdb */
+ NULL, /* rd_mk_bsdb */
+ NULL, /* rd_mk_osudb */
+ SYPL_ReadMakeMDB, /* rd_mk_mdb */
+ SYPL_ReadMakeStreams, /* rd_mk_streams */
+ NULL, /* wt_mk_vcb */
+ NULL, /* wt_mk_ddb */
+ NULL, /* wt_mk_fdb */
+ NULL, /* Write Stream */
+ NULL, /* End Data */
+ NULL, /* wt_mk_idb */
+ NULL, /* wt_mk_cfdb */
+ NULL, /* Continue Variable Stream */
+ NULL, /* End Variable Stream */
+ NULL, /* Post processing of write buffer */
+ NULL, /* wt_close_tape */
+ NULL, /* wt_cont_set */
+ NULL, /* wt_close_set */
+ NULL, /* wt_eos_pad_blk */
+ NULL, /* load_set_map */
+ NULL, /* load_set_cat */
+ NULL, /* get_next_sm_entry */
+ NULL, /* get_next_sc_entry */
+ NULL /* close_catalogs */
+ },
+#endif
+
+#ifdef UTF_TRANS
+ /*
+ * Universal Tape Format (QicStream 2.0 && FasTape 5.0)
+ */
+ {
+ UTF_Determiner, /* determiner */
+ UTF_Initialize, /* initializer */
+ UTF_DeInitialize, /* deinitializer */
+ NULL, /* VCB buffer reqs */
+ UTF_PreferredSpace, /* get preferred space */
+ UTF_ReadBufferHook, /* read buffer hook */
+ UTF_DetBlkType, /* parser */
+ NULL, /* sizeof_tblk */
+ UTF_RdException, /* exception_action */
+ UTF_NewTape, /* new_tape, process tape header */
+ NULL, /* post-positioning write init */
+ NULL, /* initialize new tape for write */
+ NULL, /* post-positioning read init */
+ UTF_MoveToVCB, /* move_to_vcb */
+ NULL, /* seek_eod (for fast append) */
+ UTF_GetCurrentVCB, /* get_current_vcb */
+ NULL, /* verify_vcb */
+ UTF_RdContTape, /* rd_cont_tape */
+ UTF_ReadRecall, /* rd_recall */
+ NULL, /* rd_mk_vcb */
+ UTF_ReadMakeDDB, /* rd_mk_ddb */
+ UTF_ReadMakeFDB, /* rd_mk_fdb */
+ NULL, /* rd_mk_idb */
+ UTF_ReadMakeCFDB, /* rd_mk_cfdb */
+ NULL, /* rd_mk_bsdb */
+ NULL, /* rd_mk_osudb */
+ NULL, /* rd_mk_mdb */
+ NULL, /* read stream */
+ NULL, /* wt_mk_vcb */
+ NULL, /* wt_mk_ddb */
+ NULL, /* wt_mk_fdb */
+ NULL, /* Write Stream */
+ NULL, /* End Data */
+ NULL, /* wt_mk_idb */
+ NULL, /* wt_mk_cfdb */
+ NULL, /* Continue Variable Stream */
+ NULL, /* End Variable Stream */
+ NULL, /* Post processing of write buffer */
+ NULL, /* wt_close_tape */
+ NULL, /* wt_cont_set */
+ NULL, /* wt_close_set */
+ NULL, /* wt_eos_pad_blk */
+ NULL, /* load_set_map */
+ NULL, /* load_set_cat */
+ NULL, /* get_next_sm_entry */
+ NULL, /* get_next_sc_entry */
+ NULL /* close_catalogs */
+ }
+#endif
+
+} ;
+
diff --git a/private/utils/ntbackup/src/fol_cm.bmp b/private/utils/ntbackup/src/fol_cm.bmp
new file mode 100644
index 000000000..080b07f29
--- /dev/null
+++ b/private/utils/ntbackup/src/fol_cm.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fol_cn.bmp b/private/utils/ntbackup/src/fol_cn.bmp
new file mode 100644
index 000000000..ac407051a
--- /dev/null
+++ b/private/utils/ntbackup/src/fol_cn.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fol_cp.bmp b/private/utils/ntbackup/src/fol_cp.bmp
new file mode 100644
index 000000000..26c6c25fe
--- /dev/null
+++ b/private/utils/ntbackup/src/fol_cp.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fol_ocm.bmp b/private/utils/ntbackup/src/fol_ocm.bmp
new file mode 100644
index 000000000..5ab59aa8c
--- /dev/null
+++ b/private/utils/ntbackup/src/fol_ocm.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fol_ocn.bmp b/private/utils/ntbackup/src/fol_ocn.bmp
new file mode 100644
index 000000000..bc0187192
--- /dev/null
+++ b/private/utils/ntbackup/src/fol_ocn.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fol_ocp.bmp b/private/utils/ntbackup/src/fol_ocp.bmp
new file mode 100644
index 000000000..7188f626d
--- /dev/null
+++ b/private/utils/ntbackup/src/fol_ocp.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fold_om.bmp b/private/utils/ntbackup/src/fold_om.bmp
new file mode 100644
index 000000000..971e711d0
--- /dev/null
+++ b/private/utils/ntbackup/src/fold_om.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fold_on.bmp b/private/utils/ntbackup/src/fold_on.bmp
new file mode 100644
index 000000000..da53e18cf
--- /dev/null
+++ b/private/utils/ntbackup/src/fold_on.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/fold_op.bmp b/private/utils/ntbackup/src/fold_op.bmp
new file mode 100644
index 000000000..28e341ffe
--- /dev/null
+++ b/private/utils/ntbackup/src/fold_op.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/folder.bmp b/private/utils/ntbackup/src/folder.bmp
new file mode 100644
index 000000000..a104786dc
--- /dev/null
+++ b/private/utils/ntbackup/src/folder.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/folder_m.bmp b/private/utils/ntbackup/src/folder_m.bmp
new file mode 100644
index 000000000..3e982e3b1
--- /dev/null
+++ b/private/utils/ntbackup/src/folder_m.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/folder_p.bmp b/private/utils/ntbackup/src/folder_p.bmp
new file mode 100644
index 000000000..7c1024d9c
--- /dev/null
+++ b/private/utils/ntbackup/src/folder_p.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/font.c b/private/utils/ntbackup/src/font.c
new file mode 100644
index 000000000..e56f5d501
--- /dev/null
+++ b/private/utils/ntbackup/src/font.c
@@ -0,0 +1,282 @@
+
+
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: font.c
+
+ Description: This file contains the functions for UI font change.
+
+ $Log: G:/UI/LOGFILES/FONT.C_V $
+
+ Rev 1.15 04 Nov 1993 15:21:52 STEVEN
+fixes from Wa
+
+ Rev 1.14 15 Jun 1993 11:11:46 MIKEP
+enable c++
+
+ Rev 1.13 27 Apr 1993 20:53:08 MIKEP
+fix typo by glenns block copy
+
+ Rev 1.12 27 Apr 1993 19:08:42 GLENN
+Now telling VLM when ther is a case change.
+
+ Rev 1.11 24 Mar 1993 14:51:48 DARRYLP
+Added fix for Help with Font Viewer, other common dialogs.
+
+ Rev 1.10 24 Mar 1993 10:33:52 DARRYLP
+Changed VIEWFONT to VIEWFONTS to resolve help link.
+
+ Rev 1.9 22 Feb 1993 13:55:40 ROBG
+Added pshhelp to handle the help button.
+
+ Rev 1.8 23 Dec 1992 13:37:54 GLENN
+Added FAT lower case font support.
+
+ Rev 1.7 22 Dec 1992 13:19:54 GLENN
+Placed size limits on font and now using ANSI fonts only.
+
+ Rev 1.6 14 Oct 1992 15:53:28 GLENN
+Added Font selection to Config and INI.
+
+ Rev 1.5 07 Oct 1992 15:12:12 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.4 04 Oct 1992 19:37:28 DAVEV
+Unicode Awk pass
+
+ Rev 1.3 29 Sep 1992 15:12:50 GLENN
+Changed and ifdef from OEM_MSOFT to OS_WIN32.
+
+ Rev 1.2 09 Sep 1992 17:01:22 GLENN
+Updated NEW LOOK font stuff for BIMINI and NT.
+
+ Rev 1.1 04 Sep 1992 17:45:32 GLENN
+Working on changing to support the lower case box.
+
+ Rev 1.0 02 Sep 1992 16:12:54 GLENN
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define IDD_LOWERCASE chx4
+#define IDD_LOWERCASEFAT chx3
+
+static BOOL fLowerCase = FALSE;
+static BOOL fLowerCaseFAT = FALSE;
+
+INT APIENTRY WM_FontDlgHookProc(HWND hDlg, WORD wMsg, WPARAM wParam, LONG lParam);
+
+
+/******************************************************************************
+
+ Name: WM_ChangeFont()
+
+ Description: This allows us to change the MDI font.
+
+ Returns: SUCCESS, if successful. Otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL WM_ChangeFont ( VOID )
+
+{
+
+ HWND hWndNext;
+ LOGFONT lf;
+ CHOOSEFONT cf;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+
+ // Set up the existing font information.
+
+ GetObject ( ghFontFiles, sizeof( LOGFONT ), &lf ) ;
+
+ // Canned structure setup.
+
+ memset ( &cf, 0, sizeof(CHOOSEFONT ) );
+
+ cf.lStructSize = sizeof(CHOOSEFONT);
+ cf.hwndOwner = ghWndFrame;
+ cf.lpLogFont = &lf;
+ cf.hInstance = ghResInst;
+ cf.nSizeMin = 4;
+ cf.nSizeMax = 36;
+
+ if (IS_JAPAN() ) {
+ cf.Flags = CF_ENABLEHOOK | CF_ENABLETEMPLATE |
+ CF_SCREENFONTS | CF_SHOWHELP | CF_LIMITSIZE |
+ CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT ;
+ } else {
+
+ cf.Flags = CF_ENABLEHOOK | CF_ENABLETEMPLATE | CF_ANSIONLY |
+ CF_SCREENFONTS | CF_SHOWHELP | CF_LIMITSIZE |
+ CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT ;
+ }
+
+ cf.rgbColors = RGB( 0, 0, 0 ); // black
+ cf.nFontType = SCREEN_FONTTYPE;
+
+# if !defined ( OS_WIN32 )
+ cf.lpfnHook = MakeProcInstance((FARPROC)WM_FontDlgHookProc, ghInst);
+# else
+ cf.lpfnHook = (LPCFHOOKPROC)MakeProcInstance((FARPROC)WM_FontDlgHookProc, ghInst);
+# endif
+
+ cf.lpTemplateName = ID(IDD_CHOOSEFONT);
+ cf.lCustData = TRUE;
+
+ // Set up the custom data with the upper/lower case setting.
+
+ if ( ChooseFont ( &cf ) ) {
+
+ BOOL fSendVLMChangeMsg = FALSE;
+
+ DeleteObject ( ghFontFiles );
+
+ ghFontFiles = ghFontIconLabels = CreateFontIndirect ( cf.lpLogFont );
+
+ // Save the font, style, size, case in the CDS and INI file.
+
+ if ( strcmp ( (CHAR_PTR)cf.lpLogFont->lfFaceName, (CHAR_PTR)CDS_GetFontFace ( pCDS ) ) ) {
+ CDS_SetFontFace ( pCDS, (CHAR_PTR)cf.lpLogFont->lfFaceName );
+ CDS_WriteFontFace ( pCDS );
+ }
+
+ if ( CDS_GetFontSize ( pCDS ) != ( cf.iPointSize / 10 ) ) {
+ CDS_SetFontSize ( pCDS, ( cf.iPointSize / 10 ) );
+ CDS_WriteFontSize ( pCDS );
+ }
+
+ if ( CDS_GetFontWeight ( pCDS ) != cf.lpLogFont->lfWeight ) {
+ CDS_SetFontWeight ( pCDS, cf.lpLogFont->lfWeight );
+ CDS_WriteFontWeight ( pCDS );
+ }
+
+ if ( CDS_GetFontItalics ( pCDS ) != (BOOL)cf.lpLogFont->lfItalic ) {
+ CDS_SetFontItalics ( pCDS, (BOOL)cf.lpLogFont->lfItalic );
+ CDS_WriteFontItalics ( pCDS );
+ }
+
+ if ( fLowerCase != CDS_GetFontCase ( pCDS ) ) {
+ CDS_SetFontCase ( pCDS, fLowerCase );
+ CDS_WriteFontCase ( pCDS );
+ fSendVLMChangeMsg = TRUE;
+ }
+
+ if ( fLowerCaseFAT != CDS_GetFontCaseFAT ( pCDS ) ) {
+ CDS_SetFontCaseFAT ( pCDS, fLowerCaseFAT );
+ CDS_WriteFontCaseFAT ( pCDS );
+ fSendVLMChangeMsg = TRUE;
+ }
+
+ // If there is a font case change, tell the VLM.
+
+ if ( fSendVLMChangeMsg ) {
+ VLM_ChangeSettings( ID_VIEWFONT, 0L );
+ }
+
+ // Now, invalidate the MDI child docs so that the FONT
+ // change gets displayed.
+
+ hWndNext = WM_GetNext ( (HWND)NULL );
+
+ while ( hWndNext ) {
+
+ DLM_SetFont ( hWndNext );
+
+ // InvalidateRect ( hWndNext, (LPRECT)NULL, TRUE );
+
+ hWndNext = WM_GetNext ( hWndNext );
+ }
+ }
+
+ return SUCCESS;
+
+} /* end WM_ChangeFont() */
+
+
+INT APIENTRY WM_FontDlgHookProc(HWND hDlg, WORD wMsg, WPARAM wParam, LONG lParam)
+{
+ static LPCHOOSEFONT lpcf;
+ static HWND hWndOldCommon;
+ TCHAR str[LF_FULLFACESIZE], sel[LF_FULLFACESIZE];
+ INT index;
+ INT cnt;
+
+ switch ( wMsg ) {
+
+ case WM_INITDIALOG:
+
+ if ( IS_JAPAN() ) {
+ // Remove the Vertical Font Face Name in Font Dialog Box
+ cnt = (INT)SendDlgItemMessage( hDlg, cmb1, CB_GETCOUNT, 0, 0L);
+ index = (INT)SendDlgItemMessage( hDlg, cmb1, CB_GETCURSEL, 0, 0L);
+ SendDlgItemMessage( hDlg, cmb1, CB_GETLBTEXT, index, (DWORD)sel);
+ for (index = 0; index < cnt; ) {
+ SendDlgItemMessage( hDlg, cmb1, CB_GETLBTEXT, index, (DWORD)str);
+ if (str[0] == TEXT('@')) {
+ cnt = (INT)SendDlgItemMessage( hDlg, cmb1, CB_DELETESTRING, index, 0L);
+ }else{
+ index++;
+ }
+ }
+ index = (INT)SendDlgItemMessage(hDlg, cmb1, CB_FINDSTRING, (WPARAM)-1, (DWORD)sel);
+ SendDlgItemMessage(hDlg, cmb1, CB_SETCURSEL, index, 0L);
+ }
+
+ lpcf = (LPCHOOSEFONT)lParam;
+
+ CheckDlgButton(hDlg, IDD_LOWERCASE, (WORD)( CDS_GetFontCase ( CDS_GetPerm () ) ) );
+ CheckDlgButton(hDlg, IDD_LOWERCASEFAT, (WORD)( CDS_GetFontCaseFAT ( CDS_GetPerm () ) ) );
+ hWndOldCommon = ghWndCommonDlg;
+ ghWndCommonDlg = hDlg;
+ break;
+
+ case WM_COMMAND:
+
+ switch (GET_WM_COMMAND_ID(wParam, lParam)) {
+
+ case IDOK:
+
+ fLowerCase = (BOOL)IsDlgButtonChecked (hDlg, IDD_LOWERCASE );
+ fLowerCaseFAT = (BOOL)IsDlgButtonChecked (hDlg, IDD_LOWERCASEFAT );
+
+ return FALSE;
+
+ case pshHelp:
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_VIEWFONTS ) ;
+ return( TRUE ) ;
+
+ default:
+
+ return FALSE;
+
+ }
+ break;
+
+ case WM_DESTROY:
+ ghWndCommonDlg = hWndOldCommon;
+ break;
+
+ default:
+
+ return FALSE;
+
+ }
+
+ return TRUE;
+}
+
+
+
diff --git a/private/utils/ntbackup/src/font.dlg b/private/utils/ntbackup/src/font.dlg
new file mode 100644
index 000000000..b4ee58513
--- /dev/null
+++ b/private/utils/ntbackup/src/font.dlg
@@ -0,0 +1,36 @@
+
+
+IDD_CHOOSEFONT DIALOG 13, 54, 260, 152
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Font"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "&Font:", stc1, 6, 3, 40, 9
+ COMBOBOX cmb1, 6, 13, 94, 54, CBS_SIMPLE | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED | CBS_DISABLENOSCROLL
+
+ LTEXT "Font St&yle:", stc2, 108, 3, 44, 9
+ COMBOBOX cmb2, 108, 13, 64, 54, CBS_SIMPLE | WS_VSCROLL | CBS_DISABLENOSCROLL | WS_TABSTOP
+
+ LTEXT "&Size:", stc3, 179, 3, 30, 9
+ COMBOBOX cmb3, 179, 13, 32, 54, CBS_SIMPLE | WS_VSCROLL | WS_TABSTOP | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED | CBS_SORT | CBS_DISABLENOSCROLL
+
+ DEFPUSHBUTTON "OK", IDOK, 218, 6, 40, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", IDCANCEL, 218, 23, 40, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Apply", psh3, 218, 40, 40, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Help", pshHelp, 218, 57, 40, 14, WS_GROUP | WS_TABSTOP
+
+ GROUPBOX "Effects", grp1, 6, 72, 84, 34, WS_GROUP
+ CONTROL "Stri&keout", chx1, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 82, 49, 10
+ CONTROL "&Underline", chx2, "Button", BS_AUTOCHECKBOX, 10, 94, 51, 10
+
+ LTEXT "&Color:", stc4, 6, 110, 30, 9
+ COMBOBOX cmb4, 6, 120, 84, 100, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+
+ GROUPBOX "Sample", grp2, 6, 72, 252, 49, WS_GROUP
+ CTEXT "", stc6, 98, 124, 160, 20, SS_NOPREFIX | NOT WS_GROUP
+ CTEXT "AaBbYyZz", stc5, 12, 81, 240, 37, SS_NOPREFIX | NOT WS_VISIBLE
+
+ CONTROL "Display &Lowercase for FAT Drives", chx3, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 6, 126, 200, 10
+ CONTROL "Display Lowercase for All &Drives", chx4, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 6, 138, 200, 10
+END
+
diff --git a/private/utils/ntbackup/src/freplace.c b/private/utils/ntbackup/src/freplace.c
new file mode 100644
index 000000000..eb908dbe2
--- /dev/null
+++ b/private/utils/ntbackup/src/freplace.c
@@ -0,0 +1,282 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: FREPLACE.C
+
+ Description: Confirm file replace dialog
+
+ $Log: G:\UI\LOGFILES\FREPLACE.C_V $
+
+ Rev 1.18 28 Jan 1994 17:22:26 Glenn
+Simplified and fixed Icon support.
+
+ Rev 1.17 02 Jun 1993 16:03:56 CARLS
+change code in DisplayDirectory to fix displaying elipsis on long
+directory names
+
+ Rev 1.16 01 Nov 1992 15:58:04 DAVEV
+Unicode changes
+
+ Rev 1.15 07 Oct 1992 13:44:02 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.14 04 Oct 1992 19:37:30 DAVEV
+Unicode Awk pass
+
+ Rev 1.13 28 Jul 1992 14:52:32 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.12 14 May 1992 16:42:30 MIKEP
+nt pass 2
+
+ Rev 1.11 05 Feb 1992 17:05:42 CARLS
+fix for displaying driectory path
+
+ Rev 1.10 27 Jan 1992 12:48:06 GLENN
+Changed dialog support calls.
+
+ Rev 1.9 24 Jan 1992 10:08:50 GLENN
+Changed DM_Filereplace() to DM_FileReplace() to make it consistant with it's prototype.
+
+ Rev 1.8 20 Jan 1992 10:00:10 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.7 16 Jan 1992 14:39:58 CHUCKB
+Added help.
+
+ Rev 1.6 09 Jan 1992 18:24:58 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.5 20 Dec 1991 16:53:56 JOHNWT
+return ghModelessDialog
+
+ Rev 1.4 18 Dec 1991 11:33:00 JOHNWT
+changed ghModelessDialog to ghRuntimeDialog
+
+ Rev 1.3 25 Nov 1991 15:56:04 CARLS
+fixed DisplayDirectory problem - wrong handle used with ReleaseDC call
+
+ Rev 1.2 25 Nov 1991 15:26:20 JOHNWT
+add title to msgbox
+
+ Rev 1.1 25 Nov 1991 15:07:52 DAVEV
+Changes for 32-16 bit Windows port
+
+ Rev 1.0 11 Nov 1991 09:38:48 CARLS
+Initial revision.
+
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+static FILE_REPLACE_TEMP_PTR file_replace_temp_ptr;
+
+/***************************************************
+
+ Name: DM_StartConfirmFileReplace
+
+ Description: Starts the Confirm file replace dialog
+
+ Returns: Returns the status from the dialog.
+
+*****************************************************/
+INT16 DM_StartConfirmFileReplace( FILE_REPLACE_TEMP_PTR temp_ptr )
+{
+
+ file_replace_temp_ptr = temp_ptr;
+ DM_ShowDialog( ghModelessDialog, IDD_FILEREPLACE, NULL );
+
+ return( temp_ptr->dialog_return_status );
+}
+/***************************************************
+
+ Name: DM_FileReplace
+
+ Description: File replace dialog procedure
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_FileReplace(
+HWND hDlg , /* window handle of the dialog box */
+MSGID message , /* type of message */
+MP1 mp1 , /* message-specific information */
+MP2 mp2
+)
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+ HDC hDCBitmap;
+ HWND hWnd;
+ HICON hIcon;
+ WORD answer ;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( message )
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ DM_CenterDialog( hDlg );
+
+ hIcon = LoadIcon( 0, IDI_EXCLAMATION );
+ SendDlgItemMessage ( hDlg, IDD_FILE_REPLACE_BITMAP, STM_SETICON, (MP1)hIcon, 0L );
+
+ DisplayDirectory( hDlg, file_replace_temp_ptr->line_1, IDD_FILE_REPLACE_LINE1 );
+ SetDlgItemText( hDlg, IDD_FILE_REPLACE_LINE2, file_replace_temp_ptr->line_2 );
+
+ DisplayDirectory( hDlg, file_replace_temp_ptr->line_3, IDD_FILE_REPLACE_LINE3 );
+ SetDlgItemText( hDlg, IDD_FILE_REPLACE_LINE4, file_replace_temp_ptr->line_4 );
+
+ return ( TRUE );
+
+ case WM_COMMAND: /* message: received a command */
+ switch( GET_WM_COMMAND_ID ( mp1, mp2 ) )
+ {
+/****************************************************************************
+ Yes button
+/***************************************************************************/
+ case IDD_FILE_REPLACE_YES:
+ file_replace_temp_ptr->dialog_return_status = FILE_REPLACE_YES_BUTTON;
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+ return ( TRUE );
+ break;
+/****************************************************************************
+ Yes to all button
+/***************************************************************************/
+ case IDD_FILE_REPLACE_ALL:
+ file_replace_temp_ptr->dialog_return_status = FILE_REPLACE_YES_TO_ALL_BUTTON;
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+ return ( TRUE );
+ break;
+/****************************************************************************
+ No button
+/***************************************************************************/
+ case IDD_FILE_REPLACE_NO:
+ file_replace_temp_ptr->dialog_return_status = FILE_REPLACE_NO_BUTTON;
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+ return ( TRUE );
+ break;
+/****************************************************************************
+ Help button
+/***************************************************************************/
+ case IDD_FILE_REPLACE_HELP:
+ HM_DialogHelp( HELPID_DIALOGFILEREPLACE );
+ return( TRUE );
+ break;
+/****************************************************************************
+ Cancel button
+/***************************************************************************/
+ case IDD_FILE_REPLACE_CANCEL:
+ case IDCANCEL:
+
+ /* Ask the user if an abort is really what they want? */
+
+ answer = (WORD)WM_MsgBox( ID( RES_ABORT_STRING ),
+ ID( RES_ABORT_QUESTION ),
+ (WORD)WMMB_YESNO, (WORD)WMMB_ICONQUESTION );
+ if( answer == WMMB_IDYES) {
+
+ yresprintf( (INT16) RES_PROCESS_ABORTED );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( (INT16) LOGGING_FILE ,
+ (INT16) LOG_MSG ,
+ SES_ENG_MSG ,
+ RES_PROCESS_ABORTED );
+
+ file_replace_temp_ptr->dialog_return_status = FILE_REPLACE_CANCEL_BUTTON;
+ EndDialog( hDlg, FALSE ); /* Exits the dialog box */
+
+ }
+ return ( TRUE );
+ break;
+
+ }
+ break;
+ }
+ return ( FALSE ); /* Didn't process a message */
+}
+
+/***************************************************
+
+ Name: DisplayDirectory
+
+ Description:
+
+ Returns:
+
+*****************************************************/
+VOID DisplayDirectory(
+ HWND hDlg,
+ LPSTR buffer_ptr,
+ WORD control_id )
+{
+ CHAR buffer[ FILE_REPLACE_VOLUME_NAME_LEN + MAX_UI_PATH_SIZE ];
+ CHAR_PTR p2;
+ WORD count;
+ HWND hControl;
+ RECT rect;
+ HDC hDC;
+ HDC hDCClient;
+ SIZE sizeRect;
+ WORD width;
+ WORD text_size;
+ WORD length = 60;
+
+ hControl = GetDlgItem( hDlg, control_id );
+ hDC = GetDC( hControl );
+ hDCClient = GetDC( hDlg );
+ GetWindowRect( hControl, &rect );
+ text_size = (WORD)( rect.right - rect.left );
+
+ strcpy( buffer, buffer_ptr );
+ UI_FixPath( buffer, (INT16) length, (CHAR)(TEXT('\\')) );
+ do
+ {
+
+ /* if truncation was added to the string, change the "..."
+ to "WWW" to take up more space in the string to determine
+ the width of the string */
+ p2 = strstr( buffer, UI_TRUNCATION ) ;
+ if( p2 ) {
+ *(p2 + 0 ) = 'W';
+ *(p2 + 1 ) = 'W';
+ *(p2 + 2 ) = 'W';
+ }
+
+ count = (WORD)strlen( buffer );
+ GetTextExtentPoint ( hDCClient, buffer, count, &sizeRect );
+ width = (WORD)sizeRect.cx;
+
+ if( width < text_size )
+ break;
+
+ /* the string is still too big to fit in the dialog control,
+ reduce the length count and try again */
+ length -= 1;
+ strcpy( buffer, buffer_ptr );
+ UI_FixPath( buffer, (INT16) length, (CHAR)(TEXT('\\')) );
+ }
+ while( 1 );
+
+ /* change the "WWW" back to "..." */
+ if( p2 ) {
+ *(p2 + 0 ) = '.';
+ *(p2 + 1 ) = '.';
+ *(p2 + 2 ) = '.';
+ }
+ /* display the string */
+ SetDlgItemText( hDlg, control_id, buffer );
+
+ ReleaseDC( hControl, hDC );
+ ReleaseDC( hDlg, hDCClient );
+
+ strupr ( buffer_ptr );
+}
diff --git a/private/utils/ntbackup/src/frmproc.c b/private/utils/ntbackup/src/frmproc.c
new file mode 100644
index 000000000..b699b238d
--- /dev/null
+++ b/private/utils/ntbackup/src/frmproc.c
@@ -0,0 +1,936 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: frmproc.c
+
+ Description: This file contains the functions for processing messages
+ sent by windows to MDI Frame window. It also contains
+ functions for directly manipulating the windows inside of
+ the frame window.
+
+ The following routines are in this module:
+
+ WM_FrameWndProc
+ WM_FrameUpdate
+ WM_FrameCmdHandler
+ WM_FrameCreate
+ WM_FrameSize
+
+ See Also: wm.c -- the Window Manager (WM) file.
+
+ $Log: G:/UI/LOGFILES/FRMPROC.C_V $
+
+ Rev 1.41.1.1 04 May 1994 14:24:46 STEVEN
+fix shutdown problem
+
+ Rev 1.41.1.0 15 Mar 1994 15:23:36 Glenn
+Added support to relocate frame window if it is not visible within the desktop window. Also restore Icon on RETURN key.
+
+ Rev 1.41 23 Sep 1993 15:52:06 GLENN
+Added signalling to Frame window when out of poll drive, if it was previously busy.
+
+ Rev 1.40 23 Jun 1993 09:16:54 GLENN
+Added code to delay WM_COMMAND messages if we are multitasking from within polldrive.
+
+ Rev 1.39 18 May 1993 20:15:28 GLENN
+1. Fixed MDI close on Maximized doc by placing the MDICLIENT create
+ before the RIBBON create.
+2. Removed unnecessary SC_MOUSEMENU stuff that was just added.
+3. Changed WM_QueryCloseApp() to not terminate if an active operation is
+ being performed.
+
+ Rev 1.38 14 May 1993 16:17:28 GLENN
+Reformatted last code added. Now passing unused WM_COMMAND messages to the currently active child
+.
+
+ Rev 1.37 10 May 1993 18:21:34 GLENN
+Added JS_OkToClose() to the QueryClose function to see if the Runtime Status Dialog was OK to clos
+e.
+
+ Rev 1.36 07 May 1993 14:21:46 DARRYLP
+Added Rob's fixes for Windows double clicks and ID_DELETE key trappings.
+
+ Rev 1.35 22 Apr 1993 16:00:22 GLENN
+Removed the old doc ribbon that was not used.
+
+ Rev 1.34 19 Apr 1993 15:28:24 GLENN
+Now returning global return code in the post quit message.
+
+ Rev 1.33 09 Apr 1993 14:06:30 GLENN
+Added parm to RIB_UpPosition. Beautified code.
+
+ Rev 1.32 15 Mar 1993 15:29:26 ROBG
+Corrected typing error.
+
+ Rev 1.31 15 Mar 1993 14:20:20 ROBG
+Added call in WM_SYSCOMMAND to the help subsystem for OEM_MSOFT.
+
+ Rev 1.30 12 Mar 1993 14:00:50 ROBG
+In NT applications, ignore WM_ERASEBKGND messages to the frame.
+
+ Rev 1.29 02 Mar 1993 15:16:22 ROBG
+Added logic for WIN32 apps when a WM_ACTIVATEAPP message is found.
+If the app is being deactivated, then get the capture off the
+ribbon bar and put the current depressed button in an upright position.
+
+ Rev 1.28 18 Jan 1993 14:26:56 GLENN
+Clean up.
+
+ Rev 1.27 18 Nov 1992 11:40:02 GLENN
+Added ability to move the modeless dialog when the frame is moved.
+
+ Rev 1.26 14 Oct 1992 15:57:36 GLENN
+Added some.h
+
+ Rev 1.25 04 Oct 1992 19:37:34 DAVEV
+Unicode Awk pass
+
+ Rev 1.24 02 Oct 1992 16:46:58 GLENN
+Got rid of goto's and fixed wait cursor - set cursor stuff.
+
+ Rev 1.23 03 Aug 1992 16:41:32 CHUCKB
+Ifdef call to schedule function.
+
+ Rev 1.22 15 May 1992 13:32:08 MIKEP
+nt pass 2
+
+ Rev 1.21 23 Apr 1992 14:37:10 ROBG
+Added last menu ID and state in call to HM_EnterIdle.
+
+ Rev 1.20 22 Apr 1992 17:22:30 GLENN
+Added mwwLastMenuID for Menu Help.
+
+ Rev 1.19 20 Apr 1992 13:55:32 GLENN
+Removed register declarations.
+
+ Rev 1.18 15 Apr 1992 16:45:08 GLENN
+Added MM_ShowMenuStatusHelp() call to show status help only for valid menu IDs.
+
+ Rev 1.17 07 Apr 1992 10:38:00 GLENN
+Added a call back to the MUI when there is a system change. (future)
+
+ Rev 1.16 03 Apr 1992 15:04:08 JOHNWT
+removed YY set in query close
+
+ Rev 1.15 19 Mar 1992 11:43:38 JOHNWT
+fixed QUERYENDSESSION
+
+ Rev 1.14 17 Mar 1992 18:25:40 GLENN
+Took out changes put in for the runtime focus problem.
+
+ Rev 1.13 10 Mar 1992 17:01:46 GLENN
+Changed paint.
+
+ Rev 1.12 03 Mar 1992 09:44:10 DAVEV
+Changes for Nostradamus unique features (OEM_MSOFT)
+
+ Rev 1.11 23 Feb 1992 14:09:42 GLENN
+Fixed abort/cancel case of QueryCloseApp.
+
+ Rev 1.10 18 Feb 1992 18:34:32 GLENN
+Reset YY flag if user cancelled the abort.
+
+ Rev 1.9 11 Feb 1992 17:30:02 GLENN
+Added support for MDI client subclassing.
+
+ Rev 1.8 05 Feb 1992 17:41:14 GLENN
+Fixed deinit problem for runtime jobs.
+
+ Rev 1.7 27 Jan 1992 12:46:08 GLENN
+Changed dialog support calls.
+
+ Rev 1.6 16 Jan 1992 09:47:26 ROBG
+Added SCH_PublishRunningJob call to the message WM_QUERYRUNNINGJOB.
+
+ Rev 1.5 26 Dec 1991 13:46:46 GLENN
+Changed show flags to use CDS calls
+
+ Rev 1.4 11 Dec 1991 14:53:56 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.3 10 Dec 1991 13:39:08 GLENN
+Added dynamic ribbon height support
+
+ Rev 1.2 04 Dec 1991 18:35:34 GLENN
+Updated for ALT-F4 termination
+
+ Rev 1.1 02 Dec 1991 17:49:56 DAVEV
+16/32 bit Windows port changes
+
+ Rev 1.0 20 Nov 1991 19:33:44 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// PRIVATE MODULE-WIDE VARIABLES
+
+static WORD mwwLastMenuID;
+static WORD mwwLastMenuState;
+
+// PRIVATE FUNCTION HEADERS
+
+VOID WM_FrameCmdHandler ( HWND, MP1, MP2 );
+VOID WM_FrameCreate ( HWND );
+VOID WM_FrameSize ( VOID );
+BOOL WM_QueryCloseApp ( VOID );
+
+/******************************************************************************
+
+ Name: WM_FrameWndProc()
+
+ Description: This function is called internally by Windows. Windows
+ calls this function when messages related to the FRAME
+ window must be processed.
+
+ Returns: NULL or a default message handler's return code.
+
+******************************************************************************/
+
+WINRESULT APIENTRY WM_FrameWndProc (
+
+HWND hWnd, // I - Destination window handle
+MSGID msg, // I - message
+MP1 mp1, // I - parameter 1
+MP2 mp2 ) // I - parameter 2
+
+{
+
+ switch ( msg ) {
+
+# if defined ( OS_WIN32 )
+
+ case WM_ACTIVATEAPP: {
+
+ // If the application is being deactivated and
+ // a button is currently being held down by the mouse,
+ // put the ribbon button in the up position.
+
+ BOOL fActivated = (BOOL) mp1;
+
+ if ( ! fActivated ) {
+
+ if ( IsWindow ( WM_GetActiveDoc () ) ) {
+ RIB_UpPosition ( ghRibbonMain );
+ }
+ }
+
+ break;
+
+ }
+
+# endif /* OS_WIN32 */
+
+# if defined (OS_WIN32 )
+
+ // There appears to be a problem with NT. Any time a user
+ // moves a window from left to right over our app, an
+ // extra WM_ERASEBKGND gets sent to our frame after we
+ // paint our status bar. Use SPY and you will see this
+ // WM_ERASEBKGND. Make sure you scroll the NT SPY window
+ // down all the way.
+
+ // Since the status bar is the only portion of the frame
+ // we paint, we can ignore any WM_ERASEBKBND to the frame.
+
+ case WM_ERASEBKGND:
+
+ return 0;
+
+# endif /* OS_WIN32 */
+
+
+ case WM_CREATE:
+
+ WM_FrameCreate ( hWnd );
+ return 0;
+
+ case WM_MOVE:
+
+ if ( ! IsIconic ( ghWndFrame ) ) {
+
+ RECT rcIntersect;
+ RECT rcDesktop;
+ RECT rcWnd;
+
+ // For desktop window compliance.
+
+ GetWindowRect ( GetDesktopWindow (), &rcDesktop );
+ GetWindowRect ( hWnd, &rcWnd );
+
+ if ( ! IntersectRect ( &rcIntersect, &rcDesktop, &rcWnd ) ) {
+
+ DM_CenterDialog( hWnd );
+ }
+ }
+
+ break;
+
+ case WM_INITMENU:
+
+ // Set up the menu state.
+
+ MM_Init ( (HMENU)mp1 );
+
+ // If in Help-Context-Sensitive mode,
+ // then set cursor to Help cursor.
+
+ HM_InitMenu();
+
+ return 0;
+
+ case WM_WININICHANGE:
+ case WM_DEVMODECHANGE:
+
+ // Change the pens, brushes, and fonts to the newly selected colors.
+ // then update the frame, which will in effect, update all MDI
+ // Documents.
+
+ WM_DeleteObjects ();
+ WM_CreateObjects ();
+ UI_InitIntl ();
+ MUI_UISystemChange ();
+ WM_Update( hWnd );
+
+ return 0;
+
+ case WM_COMMAND:
+
+ // If the user is in the help context-sensitive mode,
+ // process the help associated with a menu selection.
+
+ if ( ! HM_WMCommandProcessing( hWnd, GET_WM_COMMAND_ID ( mp1, mp2 ) ) ) {
+
+ // Direct all menu selection or accelerator commands to the frame
+ // command handler function.
+
+ WM_FrameCmdHandler ( hWnd, mp1, mp2 );
+ }
+
+ return 0;
+
+ case WM_ENTERIDLE :
+
+ // If F1 is pressed while a menu item has been selected,
+ // then the help system is activated.
+
+ if ( HM_EnterIdle( hWnd, mp1, mwwLastMenuID, mwwLastMenuState ) ) {
+ return 0;
+ }
+
+ break;
+
+ case WM_INITAPPLICATION:
+
+ // Allow the GUI to fully initialize by multitasking for a moment.
+
+ WM_MultiTask ();
+
+ // Remove the WAIT cursor and release capture of all mouse messages
+ // from the frame window. Its complement is in WM_Init() after the
+ // frame window is created.
+
+ WM_ShowWaitCursor ( FALSE );
+
+ // GUI initialization is complete, ready to initialize the MUI.
+
+ if ( MUI_Init () ) {
+
+ // Exit the app if there was a command line job or there was
+ // an initialization error.
+
+# if defined ( OEM_MSOFT ) // OEM Microsoft special feature
+ {
+ PostMessage ( hWnd, WM_COMMAND, IDM_OPERATIONSEXIT, 0L );
+ }
+# else
+ {
+ if ( !gfTerminateApp ) {
+ PostMessage ( hWnd, WM_COMMAND, IDM_FILEEXIT, 0L );
+ }
+ }
+# endif // defined ( OEM_MSOFT ) // special feature
+ }
+
+ gfAppInitialized = TRUE;
+ return 0;
+
+ case WM_SETTINGSCHANGED:
+
+ // This is the way to delay the calling of a function from a dialog.
+
+ VLM_ChangeSettings ( (INT16)mp1, (INT32)mp2 );
+ return 0;
+
+ case WM_MENUSELECT:
+
+ // Display the menu help on the status line.
+
+ if ( MM_IS_MENU_CLOSED ( mp1, mp2 ) ) {
+
+ STM_SetIdleText ( IDS_READY );
+
+ }
+ else {
+
+ // Save the last menu select ID for help.
+
+ mwwLastMenuID = GET_WM_MENUSELECT_ID ( mp1, mp2 );
+ mwwLastMenuState = GET_WM_MENUSELECT_FLAGS( mp1, mp2 );
+
+ MM_ShowMenuStatusHelp ( mwwLastMenuID );
+ }
+
+ return 0;
+
+ case WM_SIZE:
+
+ if ( mp1 != SIZEICONIC ) {
+
+ gRectFrameClient.right = LOWORD(mp2);
+ gRectFrameClient.bottom = HIWORD(mp2);
+
+ WM_FrameSize ();
+ }
+
+ return 0;
+
+ case WM_PAINT:
+
+ if ( ! IsIconic ( hWnd ) ) {
+
+ // Take care of the status line.
+
+ STM_DrawBorder ();
+ STM_DrawIdle ();
+
+ }
+
+ // Continue to the default to validate any invalid rectangles.
+
+ break;
+
+ case WM_LBUTTONDOWN:
+
+ if ( HM_ContextLbuttonDown ( hWnd, mp1, mp2 ) ) {
+ return 0;
+ }
+
+ break;
+
+ case WM_KEYDOWN:
+
+ if ( HM_KeyDown ( hWnd, mp1 ) ) {
+ return 0;
+ }
+
+ break;
+
+ case WM_SETCURSOR:
+
+ // In help mode it is necessary to reset the cursor in response
+ // to every WM_SETCURSOR message.Otherwise, by default, Windows
+ // will reset the cursor to that of the window class.
+
+ if ( HM_SetCursor ( hWnd ) ) {
+ return 0;
+ }
+
+ if ( WM_SetCursor ( hWnd ) ) {
+ return 1;
+ }
+
+ break;
+
+#ifndef OEM_MSOFT
+ case WM_QUERYRUNNINGJOB:
+
+ // Publish the running job to the launcher.
+
+ SCH_PublishRunningJob();
+
+ return 0;
+
+#endif /* OEM_MSOFT */
+
+ case WM_QUERYENDSESSION:
+
+ // Don't end the session if any Docs cancel the operation or if
+ // there is a Runtime Dialog that doesn't want to quit.
+
+ return WM_QueryCloseApp ();
+
+ case WM_WINDOWPOSCHANGING:
+
+ if ( ghModelessDialog ) {
+
+ LPWINDOWPOS pdsNewPos = (LPWINDOWPOS)mp2;
+ RECT rcOldFrame;
+ RECT rcRuntime;
+ INT x;
+ INT y;
+
+ GetWindowRect ( ghWndFrame, &rcOldFrame );
+ GetWindowRect ( ghModelessDialog, &rcRuntime );
+
+ if ( ! ( pdsNewPos->flags & SWP_NOMOVE ) ) {
+
+ // Move the runtime window with the frame, but not
+ // vice versa.
+
+ x = rcRuntime.left + ( pdsNewPos->x - rcOldFrame.left );
+ y = rcRuntime.top + ( pdsNewPos->y - rcOldFrame.top );
+
+ SetWindowPos ( ghModelessDialog,
+ (HWND)NULL,
+ x,
+ y,
+ 0,
+ 0,
+ ( SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE )
+ );
+ }
+
+ }
+
+ break;
+
+ case WM_ENDSESSION:
+
+ if ( mp1 ) {
+
+ MUI_Deinit ();
+ }
+
+ return 0;
+
+ case WM_POLLDRIVEMSG:
+
+ if ( mp1 == (MP1)0 && gfTerminateApp && WM_QueryCloseApp () ) {
+
+ MUI_Deinit ();
+ DestroyWindow ( hWnd );
+ }
+
+ return 0;
+
+ case WM_CLOSE:
+
+ if ( WM_QueryCloseApp () ) {
+
+ MUI_Deinit ();
+ DestroyWindow ( hWnd );
+ }
+
+ return 0;
+
+ case WM_DESTROY:
+
+ PostQuitMessage ( gnReturnCode );
+ return 0;
+
+ case WM_SYSCOMMAND:
+
+# if defined ( OEM_MSOFT )
+
+ // If the user is in the help context-sensitive mode,
+ // process the help associated with a menu selection.
+
+ if ( HM_WMCommandProcessing( hWnd, GET_WM_COMMAND_ID ( mp1, mp2 ) ) ) {
+ return 0 ;
+ }
+
+# endif
+
+ switch ( mp1 ) {
+
+ case SC_MAXIMIZE:
+ case SC_RESTORE: {
+
+ HWND hWndTop;
+
+ // Take care of activating the proper window.
+
+ if ( ghModelessDialog ) {
+ hWndTop = GetLastActivePopup ( ghModelessDialog );
+ }
+ else {
+ hWndTop = GetLastActivePopup ( ghWndFrame );
+ }
+
+ SetActiveWindow ( hWndTop );
+
+ break;
+ }
+
+
+ } /* end switch */
+
+ break;
+
+ default:
+
+ break;
+
+ }
+
+ // Use DefFrameProc() instead of DefWindowProc() since there
+ // are things that have to be handled differently because of MDI.
+
+ return DefFrameProc ( hWnd, ghWndMDIClient, msg, mp1, mp2 );
+
+} /* end WM_FrameWndProc() */
+
+
+/******************************************************************************
+
+ Name: WM_FrameCmdHandler()
+
+ Description: This function is called by WM_FrameWndProc to handle
+ command specific messages such as MENU SELECTION messages.
+
+ Returns: NULL or a default message handler's return code.
+
+******************************************************************************/
+
+VOID WM_FrameCmdHandler (
+
+HWND hWnd, // I - Destination window handle
+MP1 mp1, // I - message parameter
+MP2 mp2 )
+
+{
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+
+ // If we are being called from polldrive's multitask call, repost
+ // the message cause this is dangerous in some re-entrancy cases.
+
+ if ( PD_IsPollDriveBusy () ) {
+ PostMessage ( hWnd, WM_COMMAND, mp1, mp2 );
+ return;
+ }
+
+ // Pass the message on the menu command handler. If it is not a menu
+ // item, see if it is a dialog. If it is not a dialog, pass it to the
+ // default frame proc.
+
+ if ( ! MM_MenuCmdHandler ( hWnd, wId ) ) {
+
+ HWND hWndChild = WM_GetActiveDoc ();
+
+ // Pass to active child.
+
+ if ( IsWindow ( hWndChild ) ) {
+ SendMessage ( hWndChild, WM_COMMAND, mp1, mp2 );
+ }
+
+ // This is essential, since there are frame WM_COMMANDS generated
+ // by the MDI system for activating child windows via the
+ // window menu.
+
+ DefFrameProc( hWnd, ghWndMDIClient, WM_COMMAND, mp1, mp2 );
+
+ }
+
+} /* end WM_FrameCmdHandler() */
+
+
+/******************************************************************************
+
+ Name: WM_FrameCreate()
+
+ Description: This function is called by WM_FrameWndProc as part of the
+ frame window creation so that other frame dependent
+ functions, such as creation and initialization of child
+ windows, can be done.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_FrameCreate (
+
+HWND hWnd // I - Destination window handle
+)
+{
+ // Set the global frame handle.
+
+ ghWndFrame = hWnd;
+
+ // Initialize the client area rectangle.
+
+ GetClientRect ( hWnd, &gRectFrameClient );
+
+ // Create the MAIN ribbon, DOC ribbon, and MDI client windows.
+
+ ghWndMDIClient = WM_Create ( WM_CLIENT, NULL, NULL, 0, 0, 0, 0, NULL );
+ ghWndMainRibbon = WM_Create ( WM_RIBBON, NULL, NULL, 0, 0, 0, 0, (PDS_WMINFO)(DWORD)ghWndFrame );
+
+ WM_Show( ghWndMDIClient );
+
+} /* end WM_FrameCreate() */
+
+
+/******************************************************************************
+
+ Name: WM_FrameSize()
+
+ Description: This function is called by WM_FrameWndProc as part of the
+ frame window sizing function. Upon receiving this message,
+ the ribbon, status line, and MDI client are resized to fit
+ the new frame size, depending on whether they are shown.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_FrameSize ( VOID )
+
+{
+ INT nClientTop = 0;
+ INT nClientBottom = gRectFrameClient.bottom;
+ CDS_PTR pCDS = CDS_GetPerm();
+
+ if ( IsWindowVisible ( ghWndMainRibbon ) && ! CDS_GetShowMainRibbon ( pCDS ) ) {
+ WM_Hide ( ghWndMainRibbon );
+ }
+
+ if ( CDS_GetShowMainRibbon ( pCDS ) ) {
+ nClientTop = gnMainRibbonHeight;
+ }
+
+ if ( CDS_GetShowStatusLine ( pCDS ) ) {
+ nClientBottom -= STATUS_LINE_HEIGHT;
+ }
+
+ // Resize the MDI client window.
+
+ MoveWindow ( ghWndMDIClient,
+ 0,
+ nClientTop,
+ gRectFrameClient.right,
+ nClientBottom - nClientTop,
+ TRUE
+ );
+
+ if ( CDS_GetShowMainRibbon ( pCDS ) ) {
+
+ // Resize the MAIN Ribbon window.
+
+ MoveWindow ( ghWndMainRibbon,
+ 0,
+ 0,
+ gRectFrameClient.right,
+ nClientTop,
+ TRUE
+ );
+
+ if ( ! IsWindowVisible ( ghWndMainRibbon ) ) {
+ WM_Show ( ghWndMainRibbon );
+ }
+ }
+
+ WM_MultiTask ();
+
+ // Rearrange the MDI Document icons, if any.
+
+ PostMessage ( ghWndMDIClient, WM_MDIICONARRANGE, 0, 0L );
+
+ // Now, show the Runtime Dialog if there is one.
+
+ if ( ghModelessDialog ) {
+
+ if ( ! IsWindowVisible ( ghModelessDialog ) ) {
+ ShowWindow ( ghModelessDialog, SW_SHOWNORMAL );
+ }
+
+ SetActiveWindow ( ghModelessDialog );
+ }
+
+} /* end WM_FrameSize() */
+
+
+/******************************************************************************
+
+ Name: WM_FrameUpdate()
+
+ Description: This function is called whenever the user has changed a
+ preference showing or hiding the ribbon or status line.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_FrameUpdate ( VOID )
+
+{
+ WM_FrameSize ();
+ InvalidateRect ( ghWndFrame, NULL, FALSE );
+
+} /* end WM_FrameUpdate() */
+
+
+/******************************************************************************
+
+ Name: WM_MDIClientWndProc()
+
+ Description: This function is a SUB-CLASS function of LIST BOXES for
+ the GUI MDI documents. It is called internally by Windows.
+ Windows calls this function when list box messages must be
+ processed. Windows will only call this routine for
+ MDI documents in this application.
+
+ Returns: NULL or a default message handler's return code.
+
+******************************************************************************/
+
+WINRESULT APIENTRY WM_MDIClientWndProc (
+
+HWND hWnd, // I - window handle of the list box
+MSGID msg, // I - message
+MP1 mp1, // I - another message parameter
+MP2 mp2 ) // I - yet another message parameter
+
+{
+ switch ( msg ) {
+
+ case WM_KEYDOWN: {
+
+ PDS_WMINFO pdsWinInfo;
+ HWND hWndList;
+
+ if ( ! IsWindow ( WM_GetActiveDoc () ) ) {
+ break;
+ }
+
+ if ( LOWORD ( mp1 ) == VK_RETURN && IsIconic ( WM_GetActiveDoc () ) ) {
+
+ WM_RestoreDoc ( WM_GetActiveDoc () );
+ return 0;
+ }
+
+ pdsWinInfo = WM_GetInfoPtr ( WM_GetActiveDoc () );
+
+ if ( ! pdsWinInfo ) {
+ break;
+ }
+
+ hWndList = WMDS_GetWinActiveList ( pdsWinInfo );
+
+ // Pass the key to the Ribbon Window(s).
+ // Note: the key will not be passed to the next function if the
+ // previous function used it.
+
+ if ( hWndList &&
+ ( HM_KeyDown ( hWndList, mp1 ) ||
+ RIB_KeyDown ( ghWndMainRibbon, RIB_KEYBOARD, mp1, mp2 ) ||
+ WM_DocKeyDown ( hWndList, LOWORD ( mp1 ) )
+ )
+ ) {
+
+ return 1;
+ }
+
+ break;
+ }
+
+ case WM_KEYUP: {
+
+ PDS_WMINFO pdsWinInfo;
+ HWND hWndList;
+
+ if ( ! IsWindow ( WM_GetActiveDoc () ) ) {
+ break;
+ }
+
+ pdsWinInfo = WM_GetInfoPtr ( WM_GetActiveDoc () );
+
+ if ( ! pdsWinInfo ) {
+ break;
+ }
+
+ hWndList = WMDS_GetWinActiveList ( pdsWinInfo );
+
+ // Pass the key to the Ribbon Window(s).
+ // Note: the key will not be passed to the next function if the
+ // previous function used it.
+
+ if ( hWndList && RIB_KeyUp ( ghWndMainRibbon, RIB_KEYBOARD, mp1, mp2 ) ) {
+
+ return 1;
+ }
+
+ break;
+ }
+
+ case WM_DESTROY:
+
+ ghWndMDIClient = (HWND) NULL;
+
+ break;
+
+ } /* end switch () */
+
+ return CallWindowProc ( (VOID *)glpfnOldMDIClientProc, hWnd, msg, mp1, mp2 );
+
+} /* end WM_MDIClientWndProc() */
+
+
+/******************************************************************************
+
+ Name: WM_QueryCloseApp()
+
+ Description: This function is called whenever the app is told to close.
+
+ Returns: TRUE, if OK to close, otherwise FALSE.
+
+******************************************************************************/
+
+BOOL WM_QueryCloseApp ( VOID )
+
+{
+ BOOL fResult;
+
+ gfTerminateApp = TRUE;
+
+ // If there is a RUN TIME STATUS DIALOG. Kill it off by sending it
+ // an abort.
+
+ if ( ghModelessDialog ) {
+
+ BOOL fCanCloseRuntime = JS_OkToClose ();
+
+ // If we cannot immediately close, don't terminate the app.
+
+ if ( ! fCanCloseRuntime ) {
+ gfTerminateApp = FALSE;
+ }
+
+ // Make sure we are displayed
+
+ WM_MakeAppActive( );
+
+ SendMessage ( ghModelessDialog, (MSGID)WM_COMMAND, (MPARAM1)IDCANCEL, (MPARAM2)NULL );
+
+ fResult = fCanCloseRuntime;
+ }
+ else if ( PD_IsPollDriveBusy () || gfOperation ) {
+
+// fResult = FALSE;
+ fResult = WM_QueryCloseAllDocs ();
+ }
+ else {
+
+ fResult = WM_QueryCloseAllDocs ();
+ }
+
+ return fResult;
+
+} /* end WM_QueryCloseApp() */
diff --git a/private/utils/ntbackup/src/fsecopy.c b/private/utils/ntbackup/src/fsecopy.c
new file mode 100644
index 000000000..555f9a916
--- /dev/null
+++ b/private/utils/ntbackup/src/fsecopy.c
@@ -0,0 +1,129 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: fsecopy.c
+
+ Description: This file contains code careate&copy an fse
+
+ $Log: M:/LOGFILES/FSECOPY.C_V $
+
+ Rev 1.4 16 Dec 1993 10:20:16 BARRY
+Change INT8_PTRs to VOID_PTRs
+
+ Rev 1.3 18 Jun 1993 09:08:26 MIKEP
+enable C++
+
+ Rev 1.2 09 Oct 1992 11:44:10 DAVEV
+Unicode (CHAR_PTR) pointer cast validation
+
+ Rev 1.1 14 May 1992 11:48:08 TIMN
+Changed CHARs to INT8\nstrcpy to memcpy
+
+ Rev 1.0 29 May 1991 17:11:34 STEVEN
+Initial revision.
+
+**/
+#include <malloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+
+#include "std_err.h"
+#include "queues.h"
+
+#include "bsdu.h"
+
+/**/
+/**
+
+ Name: FSE_Copy()
+
+ Description: This function allocates memory for an FSE. It then
+ initializes the allocated memory with the data in the provided FSE.
+
+ Modified: 5/29/1991 15:10:15
+
+ Returns: Error codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE(), FSE_SetComplexInfo() )$
+
+ Declaration:
+
+**/
+INT16 FSE_Copy(
+FSE_PTR fse, /* I - FSE to copy infor from */
+FSE_PTR *new_fse ) /* O - The newly created FSE */
+{
+ INT16 ret_val = SUCCESS ;
+ FSE_COMPLEX_PTR cplx ;
+ FSE_TGT_INFO_PTR tgt ;
+
+ msassert( new_fse != NULL );
+ msassert( fse != NULL );
+
+ cplx = fse->cplx ;
+ tgt = fse->tgt ;
+
+ *new_fse = (FSE_PTR)calloc( 1, sizeof( *fse ) + fse->dir_leng + fse->fname_leng );
+
+ if ( *new_fse != NULL ) {
+
+ (*new_fse)->flgs = fse->flgs ;
+ (*new_fse)->dir_leng = fse->dir_leng ;
+ (*new_fse)->dir = *new_fse + 1;
+ (*new_fse)->fname_leng = fse->fname_leng;
+ (*new_fse)->fname = (BYTE_PTR)(*new_fse)->dir + fse->dir_leng;
+ memcpy( (*new_fse)->dir, fse->dir, fse->dir_leng ) ;
+ memcpy( (*new_fse)->fname, fse->fname, fse->fname_leng ) ;
+
+ if ( cplx != NULL ) {
+
+ if ( ( FSE_SetAccDate( *new_fse, cplx->access_date ) != SUCCESS ) ||
+ ( FSE_SetBakDate( *new_fse, cplx->backup_date ) != SUCCESS ) ||
+ ( FSE_SetModDate( *new_fse, cplx->pre_m_date,
+ cplx->post_m_date ) != SUCCESS ) ||
+ ( FSE_SetAttribInfo( *new_fse, cplx->attr_on_mask,
+ cplx->attr_off_mask ) != SUCCESS ) ) {
+
+
+ if ( (*new_fse)->cplx != NULL ) {
+ free( (*new_fse)->cplx->pre_m_date ) ;
+ free( (*new_fse)->cplx->post_m_date ) ;
+ free( (*new_fse)->cplx->backup_date ) ;
+ free( (*new_fse)->cplx->access_date ) ;
+ free( (*new_fse)->cplx ) ;
+ }
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+ }
+
+ if ( tgt != NULL ) {
+ if ( FSE_SetTargetInfo( *new_fse, tgt->path, tgt->psize, tgt->fname, tgt->fnsize ) != SUCCESS ) {
+
+ if ( (*new_fse)->tgt != NULL ) {
+ free( (*new_fse)->tgt ) ;
+ }
+
+ ret_val = OUT_OF_MEMORY ;
+ }
+ }
+
+ if ( ret_val != SUCCESS ) {
+ free( *new_fse ) ;
+ *new_fse = NULL ;
+ }
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return ret_val ;
+}
+
diff --git a/private/utils/ntbackup/src/func_tab.c b/private/utils/ntbackup/src/func_tab.c
new file mode 100644
index 000000000..97a824913
--- /dev/null
+++ b/private/utils/ntbackup/src/func_tab.c
@@ -0,0 +1,25 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: func_tab.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains memory allocation for the
+ function table.
+
+
+ $Log: G:/LOGFILES/FUNC_TAB.C_V $
+
+ Rev 1.0 09 May 1991 13:35:02 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+
+#include "fsys.h"
+/* $end$ include list */
+
+FUNC_LIST func_tab[ MAX_DRV_TYPES ] = {NULL} ;
diff --git a/private/utils/ntbackup/src/gen_tab.c b/private/utils/ntbackup/src/gen_tab.c
new file mode 100644
index 000000000..69edad7b9
--- /dev/null
+++ b/private/utils/ntbackup/src/gen_tab.c
@@ -0,0 +1,137 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: dos_tab.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the DOS functon table.
+
+
+ $Log: L:/LOGFILES/GEN_TAB.C_V $
+
+ Rev 1.7 30 Jul 1993 13:18:22 STEVEN
+if dir too deep make new one
+
+ Rev 1.6 22 Sep 1992 17:21:56 CHUCKB
+Removed table entry for GetTotalSizeDBLK.
+
+ Rev 1.5 17 Mar 1992 09:05:34 STEVEN
+format 40 - added 64 bit support
+
+ Rev 1.4 03 Mar 1992 16:15:50 STEVEN
+added functions for long paths
+
+ Rev 1.3 16 Dec 1991 17:20:58 STEVEN
+move common functions to tables
+
+ Rev 1.2 27 Nov 1991 11:15:24 BARRY
+GEN table wrong.
+
+ Rev 1.1 14 Aug 1991 12:59:20 STEVEN
+added FindClose
+
+ Rev 1.0 09 May 1991 13:33:42 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+#include "FSYS.H"
+#include "fsys_prv.h"
+#include "gen_fs.h"
+/* $end$ include list */
+
+FUNC_LIST GENFuncTab = {
+
+ GEN_InitFileSys,
+ GEN_FindDrives,
+ GEN_RemoveDLE,
+ GEN_DeInitFileSys,
+
+ GEN_DeviceDispName,
+ GEN_GetVolName,
+ GEN_SizeofVolName,
+ GEN_MakePath,
+ GEN_InitMakeData,
+
+ GEN_IsBlkComplete,
+ GEN_CompleteBlk,
+ GEN_DupBlk,
+ GEN_ReleaseBlk,
+
+ NULL, /* GEN_AttachToDLE, */
+ NULL, /* GEN_DetachDLE, */
+ NULL, /* GEN_EndOperationOnDLE */
+
+ GEN_ProcessDDB,
+ NULL, /* GEN_GetCurrentDDB, */
+ NULL, /* GEN_GetCurrentPath, */
+ NULL,
+ GEN_SizeofOSPath,
+ NULL, /* GEN_GetBasePath, */
+ NULL, /* GEN_ChangeDir, */
+ NULL, /* GEN_UpDir, */
+
+ NULL, /* GEN_CreateObj, */
+ NULL, /* GEN_OpenObj, */
+ NULL, /* GEN_SeekObj, */
+ NULL, /* GEN_ReadObj, */
+ NULL, /* GEN_WriteObj, */
+ NULL, /* GEN_VerObj, */
+ NULL, /* GEN_CloseObj, */
+ NULL, /* GEN_DeleteObj, */
+
+ NULL, /* GEN_GetObjInfo, */
+ NULL, /* GEN_SetObjInfo, */
+ NULL, /* GEN_VerObjInfo, */
+
+ NULL, /* GEN_FindFirst, */
+ NULL, /* GEN_FindNext, */
+ NULL, /* GEN_PushMinDDB, */
+ NULL, /* GEN_PopMinDDB, */
+ NULL, /* GEN_GetSpecDBLKS,*/
+ NULL, /* GEN_EnumSpecFiles,*/
+
+ NULL, /* GEN_ModFnameFDB, */
+ NULL, /* GEN_ModPathDDB, */
+ GEN_GetOSFnameFDB,
+ GEN_GetPartName,
+ GEN_GetOSPathDDB,
+ GEN_GetCdateDBLK,
+ GEN_GetMdateDBLK,
+ GEN_ModBdateDBLK,
+ GEN_ModAdateDBLK,
+ GEN_GetDisplaySizeDBLK,
+// GEN_GetTotalSizeDBLK,
+ GEN_ModAttribDBLK,
+ GEN_GetFileVerFDB,
+ GEN_SetOwnerId,
+
+ GEN_GetObjTypeDBLK,
+
+ NULL, /* GEN_SizeofFname, */
+ NULL, /* GEN_SizeofPath, */
+ GEN_SizeofOSFname,
+ GEN_SizeofPartName,
+ GEN_SizeofOSPath,
+
+ NULL, /* GEN_SizeofOSInfo, */
+
+ NULL, /* GEN_GetOS_InfoDBLK, */
+ GEN_GetActualSizeDBLK,
+
+ DUMMY_InitGOS,
+
+ GEN_CreateFDB,
+ GEN_CreateIDB,
+ GEN_CreateDDB,
+ NULL, /* GEN_ChangeIntoDDB, */
+ GEN_SpecExcludeObj,
+ GEN_SetDataSize,
+ GEN_SetObjTypeDBLK,
+ NULL, /* LogoutDevice */
+ GEN_FindClose,
+} ;
+
diff --git a/private/utils/ntbackup/src/gendblk.c b/private/utils/ntbackup/src/gendblk.c
new file mode 100644
index 000000000..b00336f2c
--- /dev/null
+++ b/private/utils/ntbackup/src/gendblk.c
@@ -0,0 +1,342 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: gendblk.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to performe the generic
+ operations on DBLKS.
+
+
+ $Log: M:/LOGFILES/GENDBLK.C_V $
+
+ Rev 1.12 24 Nov 1993 15:15:26 BARRY
+Changed CHAR_PTR in I/O function to BYTE_PTR
+
+ Rev 1.11 17 Nov 1993 15:19:24 DOUG
+Added cases for FS_GRFS_MAC, FS_GRFS_UNIX to FS_GetDelimeterFromOSID()
+
+ Rev 1.10 21 Oct 1993 13:25:20 DON
+Only use '/' delimiter for SMS if NOT building Client Application
+
+ Rev 1.9 14 Oct 1993 11:49:44 DON
+If FS_NOV_SMS OS_id then delimiter is '/'
+
+ Rev 1.8 18 Jun 1993 09:49:14 MIKEP
+enable c++
+
+ Rev 1.7 25 Jan 1993 08:57:56 DON
+Don't use any specific delimiter for SMS, use default
+
+ Rev 1.6 19 Jan 1993 16:18:06 DON
+Use a default of '/' as delimiter for SMS
+
+ Rev 1.5 11 Nov 1992 22:26:50 GREGG
+Unicodeized literals.
+
+ Rev 1.4 18 Aug 1992 10:17:14 STEVEN
+fix warnings
+
+ Rev 1.3 11 Mar 1992 18:53:48 STEVEN
+converted Get???SizeFromDBLK to macros
+
+ Rev 1.2 03 Nov 1991 15:02:14 BARRY
+TRICYCLE: Added delimiter for SMS file system.
+
+ Rev 1.1 24 Jul 1991 15:57:50 DAVIDH
+Cleared up warnings under Watcom.
+
+ Rev 1.0 09 May 1991 13:33:50 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+
+#include "msassert.h"
+#include "fsys.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: FS_GetOSid_verFromDBLK()
+
+ Description: This function returns the OS id and OS version for
+ a specified DBLK.
+
+ Modified: 9/12/1989
+
+ Returns: SUCCESS
+
+ Notes: This function is designed only for the purpose of BACKUP.
+ The tape format layer will call this function in order to fill
+ out its own DBLK structure.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_GetOSid_verFromDBLK(
+FSYS_HAND fsh, /* I - File system handle */
+DBLK_PTR dblk, /* I - DBLK to os id from */
+UINT16 *id, /* O - os id saved in DBLK */
+UINT16 *ver) /* O - os ver saved in DBLK */
+{
+ *id = dblk->com.os_id ;
+ *ver = dblk->com.os_ver ;
+
+ return SUCCESS ;
+
+ (VOID) fsh ;
+}
+
+
+/**/
+/**
+
+ Name: FS_GetAttribFromDBLK()
+
+ Description: This function gets the atttribute of a DBLK
+
+ Modified: 9/13/1989
+
+ Returns: Attribute of the DBLK
+
+ Notes:
+
+ See also: $/SEE( FS_GetGenOffsetFromDBLK() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+UINT32 FS_GetAttribFromDBLK(
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR dblk ) /* I - DBLK to get size of */
+{
+ UINT32 attrib;
+
+ switch ( dblk->blk_type ) {
+
+ case FDB_ID:
+ case DDB_ID:
+ case IDB_ID:
+
+ fsh->tab_ptr->ModAttribDBLK( FALSE, dblk, &attrib ) ;
+
+ break ;
+
+ case VCB_ID:
+ attrib = ((VCB_PTR)dblk)->vcb_attributes ;
+ break ;
+
+ case CFDB_ID:
+ attrib = ((CFDB_PTR)dblk)->attributes ;
+ break ;
+
+ default:
+ attrib = 0 ;
+ }
+
+ return attrib ;
+}
+/**/
+/**
+
+ Name: FS_SetAttribFromDBLK()
+
+ Description: This function sets the atttribute of a DBLK
+
+ Modified: 9/13/1989
+
+ Returns: Attribute of the DBLK
+
+ Notes:
+
+ See also: $/SEE( FS_GetGenOffsetFromDBLK() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+UINT32 FS_SetAttribFromDBLK(
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR dblk , /* I - DBLK to get size of */
+UINT32 attrib ) /* I - Attrib value to set */
+{
+
+ switch ( dblk->blk_type ) {
+
+ case FDB_ID:
+ case DDB_ID:
+
+ fsh->tab_ptr->ModAttribDBLK( TRUE, dblk, &attrib ) ;
+
+ break ;
+
+ case VCB_ID:
+ ((VCB_PTR)dblk)->vcb_attributes = attrib ;
+ break ;
+
+ case CFDB_ID:
+ ((CFDB_PTR)dblk)->attributes = attrib ;
+ break ;
+
+ default:
+ break ;
+
+ }
+
+ return SUCCESS ;
+}
+
+
+/**/
+/**
+
+ Name: FS_SizeofOS_InfoInDBLK()
+
+ Description: This function gets the size of OS Info for the DBLK.
+
+ Modified: 9/13/1989
+
+ Returns: Size of the OS info for the DBLK
+
+ Notes:
+
+ See also: $/SEE( FS_GetGenOffsetFromDBLK() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_SizeofOS_InfoInDBLK(
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR dblk ) /* I - DBLK to get size from */
+{
+ INT16 size ;
+ switch ( dblk->blk_type ) {
+
+ case FDB_ID:
+ case DDB_ID:
+
+ size = fsh->tab_ptr->SizeofOSInfo( fsh, dblk ) ;
+
+ break ;
+
+ default:
+ size = 0 ;
+ }
+
+ return size ;
+}
+
+
+/**/
+/**
+
+ Name: FS_GetOS_InfoFromDBLK()
+
+ Description: This function gets the OS specific data for the DBLK.
+
+ Modified: 9/13/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( FS_SizeofOS_InfoInDBLK() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_GetOS_InfoFromDBLK(
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR dblk, /* I - DBLK to get info from */
+BYTE_PTR data) /* O - buffer to place data in */
+{
+ INT16 size = 1024;
+
+ /* Why on earth are we not looking at the return code? */
+
+ switch ( dblk->blk_type )
+ {
+ case FDB_ID:
+ case DDB_ID:
+ fsh->tab_ptr->GetOS_InfoDBLK( dblk, data, &size ) ;
+ break;
+ }
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: FS_GetDelimiterFromOSID
+
+ Description: This function switches on the OS Id to determine
+ the approprate delimiter character to be used to seperate
+ directory paths.
+
+ Modified: 11/22/1989
+
+ Returns: The dilimiter character
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+CHAR FS_GetDelimiterFromOSID(
+UINT16 id , /* I - OS Id to determine the delimiter for */
+UINT16 ver ) /* I - OS version. Not used */
+{
+ CHAR ret_val ;
+
+ (VOID) ver ;
+
+ switch( id ) {
+
+ case FS_MAC_FINDER:
+ case FS_MAC_TOPS:
+ case FS_MAC_APPLESHARE:
+ ret_val = TEXT(':') ;
+ break ;
+
+#if !defined(P_CLIENT)
+ /*
+ Until the CLIENT UI and FS_ParsePath can handle a '/' delimiter
+ we'll just have to use the default DOS style delimiter.
+ */
+ case FS_NOV_SMS :
+ case FS_GRFS_UNIX :
+ ret_val = TEXT('/');
+ break;
+
+ case FS_GRFS_MAC :
+ ret_val = TEXT(':');
+ break;
+
+#endif
+
+ default:
+ ret_val = TEXT('\\');
+ break ;
+
+ }
+
+ return ret_val ;
+}
+
diff --git a/private/utils/ntbackup/src/get_vcb.c b/private/utils/ntbackup/src/get_vcb.c
new file mode 100644
index 000000000..5aaec45fc
--- /dev/null
+++ b/private/utils/ntbackup/src/get_vcb.c
@@ -0,0 +1,131 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: get_vcb.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: T:/LOGFILES/GET_VCB.C_V $
+
+ Rev 1.8 23 Mar 1992 14:27:14 GREGG
+Set rewind_sdrv in open info struct from same in getvcb struct.
+
+ Rev 1.7 28 Feb 1992 18:08:44 GREGG
+Added calls to TF_OpenTape and TF_CloseTape.
+
+ Rev 1.6 19 Feb 1992 16:02:28 GREGG
+Added vcb_only parameter to call to TF_OpenSet.
+
+ Rev 1.5 17 Oct 1991 01:57:52 ED
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.4 22 Jul 1991 10:20:32 DAVIDH
+Corrected type mismatch warnings.
+
+ Rev 1.3 21 Jun 1991 13:51:16 STEVEN
+new config unit
+
+ Rev 1.2 23 May 1991 12:51:42 STEVEN
+Conversion to ansii prototypes
+
+ Rev 1.1 14 May 1991 14:13:42 DAVIDH
+Resolved pointer mismatch warning for Watcom compiler
+
+ Rev 1.0 09 May 1991 13:39:26 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+#include "datetime.h"
+#include "fsys.h"
+#include "thw.h"
+#include "drvinf.h"
+#include "bsdu.h"
+#include "tflproto.h"
+#include "loops.h"
+#include "tpos.h"
+#include "tfldefs.h"
+#include "tflstats.h"
+#include "tfl_err.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: LP_GetVCB
+
+ Description: This function Reads the VCB at the requested position.
+
+ Modified: 12/13/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_GetVCB(
+GETVCB_PTR getvcb_ptr, /* I - Specifies which backup set to read */
+TPOS_HANDLER ui_tpos_rout, /* I - The User Interface tape positioner */
+THW_PTR thw_list, /* I - Specifies the tape drive */
+VOID_PTR ref ) /* I - reference ptr returned to tpos rout */
+{
+ TFL_OPBLK tfl_opblk ;
+ TPOS tfl_pos ;
+ TF_STATS tf_stats ;
+ INT16 return_status ;
+ INT16 status ;
+
+ /* open the file system */
+ if( ( return_status = FS_OpenFileSys( &tfl_opblk.fsh, GENERIC_DATA, getvcb_ptr->cfg ) ) != SUCCESS ) {
+
+ return( return_status ) ;
+
+ }
+
+ /* save the fsh in the UI structure */
+ getvcb_ptr -> fsys_handle = tfl_opblk.fsh ;
+
+ tfl_opblk.sdrv = thw_list ;
+ tfl_opblk.ignore_clink = TRUE ;
+ tfl_opblk.mode = TF_READ_OPERATION ;
+ tfl_opblk.perm_filter = TF_KEEP_ALL_DATA ;
+ tfl_opblk.attributes = 0 ;
+ tfl_opblk.tape_position = &tfl_pos ;
+ tfl_opblk.tape_position->tape_id = getvcb_ptr->tape_fid ;
+ tfl_opblk.tape_position->tape_seq_num = getvcb_ptr->tape_seq_num ;
+ tfl_opblk.tape_position->backup_set_num = getvcb_ptr->backup_set_num ;
+ tfl_opblk.tape_position->reference = ( UINT32 )ref ;
+ tfl_opblk.tape_position->UI_TapePosRoutine = ui_tpos_rout ;
+ tfl_opblk.tape_position->tape_loc.pba_vcb = 0 ;
+ tfl_opblk.tape_position->tape_loc.lba_vcb = 0 ;
+ tfl_opblk.rewind_sdrv = getvcb_ptr->rewind_sdrv ;
+ tfl_opblk.cat_enabled = FALSE ; /* Doesn't matter for this */
+
+ if( ( return_status = TF_OpenTape( &tfl_opblk.channel, tfl_opblk.sdrv, tfl_opblk.tape_position ) ) == SUCCESS ) {
+ return_status = TF_OpenSet( &tfl_opblk, TRUE ) ;
+ TF_CloseSet( tfl_opblk.channel, &tf_stats ) ;
+ }
+ TF_CloseTape( tfl_opblk.channel ) ;
+
+ if( ( status = FS_CloseFileSys( tfl_opblk.fsh ) ) != SUCCESS ) {
+ msassert( status == SUCCESS ) ;
+ }
+
+ return( return_status ) ;
+
+}
diff --git a/private/utils/ntbackup/src/getres.c b/private/utils/ntbackup/src/getres.c
new file mode 100644
index 000000000..ebcc27278
--- /dev/null
+++ b/private/utils/ntbackup/src/getres.c
@@ -0,0 +1,76 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: getres.c
+
+ Description: Get a Resource
+
+ $Log: G:/UI/LOGFILES/GETRES.C_V $
+
+ Rev 1.10 07 Oct 1992 14:55:02 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.9 04 Oct 1992 19:37:36 DAVEV
+Unicode Awk pass
+
+ Rev 1.8 28 Jul 1992 14:45:32 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.7 27 Jul 1992 14:49:12 JOHNWT
+ChuckB fixed references for NT.
+
+ Rev 1.6 14 May 1992 17:24:12 MIKEP
+nt pass 2
+
+ Rev 1.5 05 Feb 1992 17:52:04 GLENN
+Set local variable to static.
+
+ Rev 1.4 20 Dec 1991 09:36:26 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.3 18 Dec 1991 14:08:54 GLENN
+Added windows.h
+
+ Rev 1.2 11 Dec 1991 13:55:44 CARLS
+check for NULL error pointer
+
+ Rev 1.1 10 Dec 1991 17:31:40 MIKEP
+fix error return code
+
+ Rev 1.0 20 Nov 1991 19:30:34 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+/* begin include list */
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static CHAR szResBuffer[ MAX_UI_RESOURCE_SIZE ];
+
+VOID_PTR RM_GetResource (
+
+RM_HDL_PTR hRes,
+UINT unSession,
+UINT unResNum,
+UINT16_PTR pNumItems,
+UINT16_PTR pError )
+
+{
+ DBG_UNREFERENCED_PARAMETER ( hRes );
+ DBG_UNREFERENCED_PARAMETER ( unSession );
+ DBG_UNREFERENCED_PARAMETER ( pNumItems );
+
+ // Check to see if calling function wants a return code.
+
+ if( pError ) {
+ *pError = RM_NO_ERROR;
+ }
+
+ RSM_StringCopy( unResNum, szResBuffer, MAX_UI_RESOURCE_LEN ) ;
+
+ return ( (VOID_PTR) szResBuffer ) ;
+}
diff --git a/private/utils/ntbackup/src/getstrm.c b/private/utils/ntbackup/src/getstrm.c
new file mode 100644
index 000000000..9a966ffa3
--- /dev/null
+++ b/private/utils/ntbackup/src/getstrm.c
@@ -0,0 +1,468 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: getstrm.c
+
+ Date Updated: 5/19/1992 14:28:59
+
+ Description: This file has common code to deal with path
+ names in streams.
+
+ $Log: T:\logfiles\getstrm.c_v $
+
+ Rev 1.24 24 Jan 1994 21:43:36 GREGG
+Warning fix.
+
+ Rev 1.23 15 Jan 1994 19:21:16 BARRY
+Change CHAR_PTR name parameter in FS_SetupOSPathOrNameInDBLK to
+BYTE_PTR since it takes data in either ANSI/Unicode at run-time.
+
+ Rev 1.22 12 Jan 1994 13:00:40 BARRY
+Added an msassert for something that shouldn't happen. Did this
+because the function's return value is probably never checked.
+
+ Rev 1.21 01 Dec 1993 13:10:06 STEVEN
+fill stream was returning -1 if size was 0
+
+ Rev 1.20 24 Nov 1993 15:17:46 BARRY
+Changed CHAR_PTR in I/O function to BYTE_PTR
+
+ Rev 1.19 19 Aug 1993 16:32:34 STEVEN
+fix unicode bugs
+
+ Rev 1.18 11 Aug 1993 18:01:02 STEVEN
+fix read of unicode tape with ansi app
+
+ Rev 1.17 17 Mar 1993 15:20:12 TERRI
+Added a NULL after name in name queue elem
+
+ Rev 1.16 30 Jan 1993 11:25:48 DON
+Removed compiler warnings
+
+ Rev 1.15 15 Jan 1993 13:19:06 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.14 17 Dec 1992 15:26:28 TIMN
+Added size parameter to initial an s_info
+
+ Rev 1.13 07 Dec 1992 14:17:44 STEVEN
+updates from msoft
+
+ Rev 1.12 11 Nov 1992 22:49:10 STEVEN
+This is Gregg checking files in for Steve. I don't know what he did!
+
+ Rev 1.11 10 Nov 1992 14:03:50 STEVEN
+do not queue invalid stuff
+
+ Rev 1.10 10 Nov 1992 08:17:52 STEVEN
+move os path and os name into common part of dblk
+
+ Rev 1.9 16 Oct 1992 15:41:42 STEVEN
+fix stream size problem
+
+ Rev 1.8 07 Oct 1992 14:10:24 STEVEN
+need to init tf_attrib to 0
+
+ Rev 1.7 07 Oct 1992 13:50:10 TIMN
+Added fs attrib parameter to initialize stream info
+
+ Rev 1.6 25 Sep 1992 12:53:10 CARLS
+added FS_InitStrmInfo
+
+ Rev 1.5 24 Sep 1992 13:44:32 BARRY
+Changes for huge file name support.
+
+ Rev 1.4 14 Aug 1992 09:45:54 BARRY
+Fixed warning.
+
+ Rev 1.3 23 Jul 1992 11:34:24 STEVEN
+fix warning
+
+ Rev 1.2 22 May 1992 16:05:50 STEVEN
+
+
+ Rev 1.1 21 May 1992 10:30:36 STEVEN
+added write_stream_header function
+
+ Rev 1.0 20 May 1992 17:18:48 STEVEN
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+#include <stdlib.h>
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+
+static BOOLEAN StreamIdMatch( UINT32 id_found, UINT32 id_req ) ;
+static INT16 AppendStreamData(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ VOID_PTR buffer,
+ UINT16 size ) ;
+
+
+/**/
+/**
+
+ Name: FS_FillBufferWithStream()
+
+ Description: This function will accept data and save it connected
+ to the FSYS_HAND. The data held is a sub-stream of the specified
+ type.
+
+ This function was designed for saveing the Pathname stream.
+
+ Modified: 5/20/1992 9:39:54
+
+ Returns: Error Codes:
+ SUCCESS or OUT_OF_MEMORY
+
+**/
+INT16 FS_FillBufferWithStream( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ VOID_PTR buffer,
+ UINT16 *size,
+ STREAM_INFO *sinfo )
+{
+ INT16 ret_val = SUCCESS ;
+ UINT16 tmp_size ;
+
+ /* if start of stream */
+ if ( sinfo->id != STRM_INVALID )
+ {
+ fsh->stream_info = *sinfo;
+ }
+
+ if (*size == 0 ) {
+ return SUCCESS ;
+ }
+
+ tmp_size = min( *size, (UINT16)(FS_GetStrmSizeLo(&fsh->stream_info) - dblk->com.stream_offset) ) ;
+
+ ret_val = AppendStreamData( fsh, dblk, buffer, tmp_size ) ;
+ *size = tmp_size ;
+
+ if ( ( ret_val == SUCCESS ) &&
+ ( dblk->com.stream_offset == (UINT16)FS_GetStrmSizeLo(&fsh->stream_info) ) )
+ {
+ ret_val = FS_STREAM_COMPLETE ;
+ }
+ return ret_val;
+}
+
+static INT16 AppendStreamData( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ VOID_PTR buffer,
+ UINT16 size )
+{
+ UINT16 needed_size ;
+
+ needed_size = size + dblk->com.stream_offset ;
+ if ( fsh->stream_buf_size < needed_size ) {
+
+ fsh->stream_ptr = realloc( fsh->stream_ptr, needed_size ) ;
+ fsh->stream_buf_size = needed_size ;
+ }
+
+ if ( fsh->stream_ptr != NULL ) {
+
+ memcpy( (INT8_PTR)fsh->stream_ptr + dblk->com.stream_offset, buffer, size ) ;
+ dblk->com.stream_offset += size ;
+ return SUCCESS ;
+
+ } else {
+
+ return OUT_OF_MEMORY ;
+
+ }
+}
+
+VOID FS_GetStreamInfo( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ STREAM_INFO_PTR *stream_info,
+ BYTE_PTR *stream_data )
+{
+ if ( dblk->com.stream_offset > 0 )
+ {
+ *stream_info = &fsh->stream_info;
+ *stream_data = fsh->stream_ptr;
+ }
+ else
+ {
+ *stream_info = NULL ;
+ *stream_data = NULL ;
+ }
+}
+
+/**/
+/**
+
+ Name: FS_WriteStreamHeader()
+
+ Description: This function copies a stream header to the provided
+ buffer. If the buffer is too small, the required size is
+ returned in the blk_size parameter.
+
+ Modified: 5/21/1992 10:29:27
+
+ Returns: Error codes:
+ none
+
+**/
+VOID FS_WriteStreamHeader(
+UINT32 strm_id, /* I - stream id to write */
+INT8_PTR strm_name, /* I - name of stream */
+UINT16 name_leng, /* I - length of stream name */
+UINT64 strm_size, /* I - length of data stream */
+UINT32 strm_attr, /* I - attribute of data stream */
+CHAR_PTR buf , /* O - buffer to place data into */
+UINT16 *size , /*I/O- Entry: size of buf; Exit: number of bytes read */
+UINT16 *blk_size ) /* O - Block size need for next read */
+{
+ msassert( FALSE );
+(VOID)strm_id;
+(VOID)strm_name;
+(VOID)name_leng;
+(VOID)strm_size;
+(VOID)strm_attr;
+(VOID)buf;
+(VOID)size;
+(VOID)blk_size;
+}
+
+/**/
+/**
+
+ Name: FS_InitStrmInfo()
+
+ Description: This function copies a stream id and file system attrib
+ into the stream header.
+
+ Modified: 9/25/1992 10:29:27
+
+ Returns: Void
+
+**/
+VOID FS_InitStrmInfo( STREAM_INFO_PTR s_info, UINT32 id, UINT16 fs_attrib, UINT32 size_lo )
+{
+ s_info->tf_attrib = 0U ; /* field used by TF */
+
+ FS_SetStrmId( s_info, id );
+ FS_SetStrmAttrib( s_info, fs_attrib );
+
+ FS_SetStrmSizeLo( s_info, size_lo );
+ FS_SetStrmSizeHi( s_info, 0U );
+}
+/**/
+/**
+
+ Name: FS_AllocOSPathOrNameInDBLK()
+
+ Description: This function will allocate memory for a name buffer.
+ This buffer is designed to be attached to a DBLK and
+ enqueued into a list of buffers pointed to by the
+ file system handle.
+
+ Modified: 11/9/1992
+
+ Returns: a pointer to the allocated name queue elem.
+ if NULL is returned then an OUT_OF_MEMORY error
+ should be assumed.
+
+**/
+FS_NAME_Q_ELEM_PTR FS_AllocPathOrName( FSYS_HAND fsh,
+ INT16 name_size )
+{
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+
+ name_q_elem = (FS_NAME_Q_ELEM_PTR)DeQueueElem( &fsh->avail_name_q ) ;
+ if ( name_q_elem == NULL ) {
+ name_q_elem = (FS_NAME_Q_ELEM_PTR)calloc( 1, sizeof( FS_NAME_Q_ELEM ) ) ;
+ }
+
+ if ( name_q_elem != NULL ) {
+
+ if ( name_q_elem->alloc_size < (UINT16)name_size ) {
+ name_q_elem->alloc_size = name_size + 100 ;
+ name_q_elem->name = realloc( name_q_elem->name, name_q_elem->alloc_size ) ;
+ }
+
+ if ( name_q_elem->name == NULL ) {
+ free( name_q_elem ) ;
+ name_q_elem = NULL ;
+ } else {
+ EnQueueElem( &fsh->in_use_name_q, &name_q_elem->q, FALSE ) ;
+ }
+
+ }
+
+ return name_q_elem ;
+}
+
+/**/
+/**
+
+ Name: FS_SetupOSPathOrNameInDBLK()
+
+ Description: This function will setup the os name field in the
+ common part of the dblk. This name is the file name as it
+ appeared on tape for a FDB or the path name as it appeared on
+ tape for a DDB.
+
+ This function should be shared between the OS's for seting up
+ the os path and os name inside the dblks.
+
+ Modified: 11/9/1992
+
+ Returns: Error Codes:
+ SUCCESS or OUT_OF_MEMORY
+
+**/
+INT16 FS_SetupOSPathOrNameInDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ BYTE_PTR name_ptr,
+ INT16 name_size )
+{
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+ BOOLEAN asci_to_uni = FALSE ;
+ BOOLEAN uni_to_asci = FALSE ;
+ INT16 ret_val ;
+ INT name_size_int ;
+
+ name_size_int = name_size ;
+
+# if defined( UNICODE )
+ if ( dblk->com.string_type == BEC_ANSI_STR ) {
+ name_size_int *= sizeof( WCHAR ) ;
+ asci_to_uni = TRUE ;
+ }
+# else
+ if ( dblk->com.string_type != BEC_ANSI_STR ) {
+ name_size_int /= sizeof( WCHAR ) ;
+ uni_to_asci = TRUE ;
+ }
+# endif
+
+ name_q_elem = FS_AllocPathOrName( fsh, (UINT16)name_size_int ) ;
+
+ if ( name_q_elem == NULL ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ if ( uni_to_asci ) {
+ ret_val = mapUnicToAnsiNoNull( (WCHAR_PTR)name_ptr,
+ (ACHAR_PTR)name_q_elem->name,
+ (ACHAR)'_',
+ (INT)name_size,
+ &name_size_int ) ;
+ } else if ( asci_to_uni ) {
+ ret_val = mapAnsiToUnicNoNull( (ACHAR_PTR)name_ptr,
+ (WCHAR_PTR)name_q_elem->name,
+ (INT)name_size,
+ &name_size_int ) ;
+ } else {
+ memcpy ( name_q_elem->name, name_ptr, name_size_int ) ;
+ ret_val = SUCCESS ;
+ }
+
+ msassert( ret_val == SUCCESS ); // should no ever happen [sic]
+
+ if ( ret_val != SUCCESS ) { // should no ever happen
+ return OUT_OF_MEMORY ;
+ }
+
+ name_q_elem->name_size = name_size_int ;
+// *(name_q_elem->name + name_size_int ) = TEXT('\0') ;
+
+ dblk->com.os_name = name_q_elem ;
+
+ return SUCCESS ;
+
+}
+
+/**/
+/**
+
+ Name: FS_ReleaseOSPathOrNameInDBLK()
+
+ Description: This function release the os name field in the
+ common part of the dblk. This name is the file name as it
+ appeared on tape for a FDB or the path name as it appeared on
+ tape for a DDB.
+
+ This function should be shared between the OS's for releasing
+ the os path and os name inside the dblks.
+
+ Modified: 11/9/1992
+
+ Returns: Error Codes:
+ none
+
+**/
+VOID FS_ReleaseOSPathOrNameInDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk )
+{
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+
+ name_q_elem = dblk->com.os_name ;
+
+ if ( name_q_elem != NULL ) {
+ if ( RemoveQueueElem( &fsh->in_use_name_q,
+ &name_q_elem->q ) == SUCCESS ) {
+
+ EnQueueElem( &fsh->avail_name_q,
+ &name_q_elem->q,
+ FALSE ) ;
+ }
+ }
+
+ dblk->com.os_name = NULL ;
+}
+
+/**/
+/**
+
+ Name: FS_FreeOSPathOrNameQueueInHand()
+
+ Description: This function frees the memory associated with the
+ name queues attached to the file system handle.
+
+ Modified: 11/9/1992
+
+ Returns: Error Codes:
+ none
+
+**/
+VOID FS_FreeOSPathOrNameQueueInHand( FSYS_HAND fsh )
+{
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+
+ do {
+ name_q_elem = (FS_NAME_Q_ELEM_PTR)DeQueueElem( &fsh->avail_name_q ) ;
+
+ if ( name_q_elem != NULL ) {
+ if ( name_q_elem->name != NULL ) {
+ free( name_q_elem->name ) ;
+ }
+ free( name_q_elem ) ;
+ }
+ } while( name_q_elem != NULL ) ;
+
+ do {
+ name_q_elem = (FS_NAME_Q_ELEM_PTR)DeQueueElem( &fsh->in_use_name_q ) ;
+
+ if ( name_q_elem != NULL ) {
+ if ( name_q_elem->name != NULL ) {
+ free( name_q_elem->name ) ;
+ }
+ free( name_q_elem ) ;
+ }
+ } while( name_q_elem != NULL ) ;
+}
+
diff --git a/private/utils/ntbackup/src/ginitfs.c b/private/utils/ntbackup/src/ginitfs.c
new file mode 100644
index 000000000..8b3bf9861
--- /dev/null
+++ b/private/utils/ntbackup/src/ginitfs.c
@@ -0,0 +1,138 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ginitfs.c
+
+
+ Description: This file contains code to initialize the specific
+ file system
+ volume name for the given DLE.
+
+
+ $Log: N:/LOGFILES/GINITFS.C_V $
+
+ Rev 1.2 16 Jul 1992 08:59:00 STEVEN
+fix default drive code
+
+ Rev 1.1 23 Jan 1992 13:01:06 STEVEN
+need a prototype for free
+
+ Rev 1.0 16 Dec 1991 17:26:36 STEVEN
+Initial revision.
+
+**/
+#include <string.h>
+#include <stdio.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "beconfig.h"
+/**/
+/**
+
+ Name: GEN_InitFileSys()
+
+ Description: This function initializes the specific file system.
+
+ Modified: 9/13/1989
+
+ Returns: SUCCESS
+
+ Notes: The generic files system need no initialization
+
+ Declaration:
+
+**/
+INT16 GEN_InitFileSys(
+DLE_HAND hand,
+BE_CFG_PTR cfg,
+UINT32 fsys_mask )
+{
+ (VOID)cfg ;
+ (VOID)hand ;
+ (VOID) fsys_mask ;
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_DeInitFileSys()
+
+ Description: This function deinitializes the specific file system.
+
+ Modified: 9/13/1989
+
+ Returns: SUCCESS
+
+ Notes: The generic files system need no deinitialization
+
+ Declaration:
+
+**/
+VOID GEN_DeInitFileSys( DLE_HAND hand )
+{
+ (VOID)hand ;
+ return ;
+}
+/**/
+/**
+
+ Name: GEN_FindDrives()
+
+ Description: This function finds all the devices for the
+ specific file system
+
+ Modified: 9/13/1989
+
+ Returns: SUCCESS
+
+ Notes: The generic files system need no devices
+
+ Declaration:
+
+**/
+INT16 GEN_FindDrives( DLE_HAND dle_hand, BE_CFG_PTR cfg, UINT32 fsys_mask )
+{
+ (VOID)dle_hand ;
+ (VOID)cfg ;
+ (VOID) fsys_mask ;
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_RemoveDLE()
+
+ Description: This function removes the specified DLE ;
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+**/
+VOID GEN_RemoveDLE( GENERIC_DLE_PTR dle )
+{ /* */
+ /* if this was the defalut drive then set the defalut driv to NULL */
+ /* */
+ if ( dle->handle->default_drv == dle ) {
+ dle->handle->default_drv = NULL ;
+ }
+
+ if (dle->parent == NULL ) {
+
+ RemoveQueueElem( &(dle->handle->q_hdr), &(dle->q) ) ;
+ } else {
+ RemoveQueueElem( &(dle->parent->child_q), &(dle->q) ) ;
+ }
+
+ if ( dle->dynamic_info ) {
+ free( dle->info.dos ) ;
+ }
+ free( dle ) ;
+
+}
diff --git a/private/utils/ntbackup/src/global.c b/private/utils/ntbackup/src/global.c
new file mode 100644
index 000000000..98e3f0c1f
--- /dev/null
+++ b/private/utils/ntbackup/src/global.c
@@ -0,0 +1,539 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: global.c
+
+ Description: This file contains the definitions for global variables and
+ the function(s) that initialize some of them.
+
+ See Also: gui.c.
+
+
+ $Log: G:/UI/LOGFILES/GLOBAL.C_V $
+
+ Rev 1.66 26 Jan 1994 15:16:50 STEVEN
+No sun makes the brain atrifee
+
+ Rev 1.65 26 Jan 1994 13:23:24 STEVEN
+protected ansi tapes read with unicode app
+
+ Rev 1.64 24 Jan 1994 15:58:50 GREGG
+Added option to tell mem debugger not to trap when consistency check fails.
+
+ Rev 1.63 12 Jan 1994 10:19:50 MikeP
+add abort in middle of file flag
+
+ Rev 1.62 07 Jan 1994 13:44:18 CARLS
+added loader default record name
+
+ Rev 1.61 20 Dec 1993 09:29:50 CARLS
+removed LOADER ifdef
+
+ Rev 1.60 16 Dec 1993 10:21:56 BARRY
+TEXT around literals
+
+ Rev 1.59 13 Dec 1993 14:56:38 CARLS
+loader changes
+
+ Rev 1.58 06 Dec 1993 15:46:46 CARLS
+init loader function pointers
+
+ Rev 1.57 06 Dec 1993 15:05:26 chrish
+Removed gb_swcompression = FALSE statement for previous software
+compression support.
+
+ Rev 1.56 01 Dec 1993 17:29:54 CARLS
+Added loader support
+
+ Rev 1.55 19 Oct 1993 14:57:02 MIKEP
+add lastopertotalbytes for gas guage
+
+ Rev 1.54 11 Oct 1993 09:26:28 MIKEP
+add gfNoCATS
+
+ Rev 1.53 23 Sep 1993 18:59:56 MARINA
+added network view globals
+
+ Rev 1.52 10 Sep 1993 17:48:44 chrish
+Added code for software compression support.
+
+ Rev 1.51 03 Aug 1993 20:54:24 CHUCKB
+Added global job name string.
+
+ Rev 1.50 15 Jun 1993 13:16:10 DARRYLP
+More status monitor features
+
+ Rev 1.49 14 Jun 1993 20:57:16 MIKEP
+enable c++
+
+ Rev 1.48 11 Jun 1993 15:50:26 GLENN
+Added gfDummyDriver flag. Rearranged status block global.
+
+ Rev 1.47 14 May 1993 14:09:36 TIMN
+Removed global variable TapeDevice for multiple instances. NOST only needs
+global.h (v1.38). Cayman needs hwconfnt.c dil_nt.c be_dinit.c mui.c
+backup.c global.h and hwconf.h.
+
+
+ Rev 1.46 14 May 1993 09:39:34 DARRYLP
+Moved SetStatusBlock to resolve compile warnings.
+
+ Rev 1.45 02 May 1993 18:27:20 MIKEP
+Fix to allow mips to build. INVALID_WINDOW_HANDLE may not be used
+with INT type variables.
+
+
+ Rev 1.44 30 Apr 1993 17:20:04 TIMN
+Changed initial tape device to an actual invalid value
+
+ Rev 1.43 27 Apr 1993 15:42:16 DARRYLP
+Added Status globals.
+
+ Rev 1.42 19 Apr 1993 15:21:12 GLENN
+Added tape name global.
+
+ Rev 1.41 13 Apr 1993 17:06:52 CHUCKB
+Added global flag to tell when a job is running.
+
+ Rev 1.40 09 Apr 1993 15:40:36 GLENN
+Ifdef'd the DDE status globals for not OEM_MSOFT so that they are included in future releases.
+
+ Rev 1.39 09 Apr 1993 14:10:12 GLENN
+Added ghReturnCode.
+
+ Rev 1.38 08 Apr 1993 13:43:02 DARRYLP
+Changes for STAT_SetStatus call.
+
+ Rev 1.37 24 Mar 1993 14:53:08 DARRYLP
+Added Help for Font viewer/other common dialogs.
+
+ Rev 1.36 22 Mar 1993 10:06:48 DARRYLP
+Added new DDE manager window.
+
+ Rev 1.35 12 Mar 1993 14:45:06 MIKEP
+add auto format call
+
+ Rev 1.34 12 Mar 1993 14:34:50 MIKEP
+auto call erase if foreign tape
+
+ Rev 1.33 07 Mar 1993 12:33:38 MIKEP
+add missing tape option
+
+ Rev 1.32 18 Feb 1993 13:01:22 chrish
+Added #ifdef CAYMAN for mapped file stuff.
+
+ Rev 1.31 01 Nov 1992 15:58:20 DAVEV
+Unicode changes
+
+ Rev 1.30 20 Oct 1992 14:27:08 MIKEP
+abort at EOF
+
+ Rev 1.29 20 Oct 1992 14:21:00 MIKEP
+add support for getcurrentoperation
+
+ Rev 1.28 07 Oct 1992 14:12:30 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.27 04 Oct 1992 19:37:38 DAVEV
+Unicode Awk pass
+
+ Rev 1.26 04 Sep 1992 10:34:02 MIKEP
+add tapedevice variable
+
+ Rev 1.25 02 Sep 1992 10:16:12 GLENN
+Added the highlight color stuff.
+
+ Rev 1.24 17 Aug 1992 13:18:12 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.22 04 Aug 1992 10:04:44 MIKEP
+no cats flag
+
+ Rev 1.21 10 Jun 1992 16:14:22 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.20 31 May 1992 11:12:20 MIKEP
+auto catalog changes
+
+ Rev 1.19 14 May 1992 18:00:32 MIKEP
+nt pass 2
+
+ Rev 1.18 20 Apr 1992 13:50:10 GLENN
+Added define for status line text size.
+
+ Rev 1.17 30 Mar 1992 18:06:02 GLENN
+Added support for pulling resources from .DLL
+
+ Rev 1.16 24 Mar 1992 11:45:00 DAVEV
+OEM_MSOFT: removed ghWndLogFiles and ghWndLogFileView & all references
+
+ Rev 1.15 25 Feb 1992 12:08:06 MIKEP
+multidrive
+
+ Rev 1.14 21 Feb 1992 14:16:00 GLENN
+Updated FrameClient rectangle name.
+
+ Rev 1.13 19 Feb 1992 11:18:48 MIKEP
+add free drive handles
+
+ Rev 1.12 11 Feb 1992 17:27:02 GLENN
+Added mdi client subclass globals.
+
+ Rev 1.11 22 Jan 1992 10:04:08 CARLS
+no change
+
+ Rev 1.10 20 Jan 1992 12:58:48 MIKEP
+disk full error
+
+ Rev 1.9 10 Jan 1992 11:19:34 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.8 23 Dec 1991 11:43:10 JOHNWT
+forgot to change the type
+
+ Rev 1.7 23 Dec 1991 11:40:02 JOHNWT
+changed gfPWForPWDBVerfified to ...State
+
+ Rev 1.6 20 Dec 1991 17:01:48 JOHNWT
+removed ghRuntimeDialog!
+
+ Rev 1.5 18 Dec 1991 11:42:52 JOHNWT
+added ghRuntimeDialog
+
+ Rev 1.4 14 Dec 1991 13:46:56 JOHNWT
+added gfPWForPWDBVerified
+
+ Rev 1.3 12 Dec 1991 17:10:00 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.2 06 Dec 1991 17:27:14 GLENN
+Added gnMainRibbonWidth
+
+ Rev 1.1 04 Dec 1991 18:36:16 GLENN
+Updated for ALT-F4 termination
+
+ Rev 1.0 20 Nov 1991 19:18:02 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+// SYSTEM GLOBAL VARIABLES
+
+INT gnReturnCode = 0;
+
+HINSTANCE ghInst;
+HINSTANCE ghResInst;
+HANDLE ghAccel;
+HWND ghWndFrame;
+HWND ghWndMDIClient;
+HWND ghWndActiveDoc;
+HWND ghWndMainRibbon;
+HWND ghWndDocRibbon;
+HWND ghWndCommonDlg = 0;
+void SetStatusBlock(INT, DWORD); // This must be defined!
+
+HWND ghWndDebug;
+HWND ghWndDiskVols; // TEMP
+HWND ghWndTapeVols; // TEMP
+HWND ghWndJobs; // TEMP
+HWND ghModelessDialog;
+
+HMENU ghMenuJobs;
+
+LPSTR glpCmdLine;
+CHAR gszStatusLine[MAX_STATUS_LINE_SIZE];
+CHAR gszTapeName[MAX_TAPE_NAME_SIZE];
+
+RECT gRectFrameClient;// Frame's client area rectangle.
+RECT gpStatusRect; // Status line rectangle.
+HPEN ghPenBlack; // Black pen.
+HPEN ghPenWhite; // White pen.
+HPEN ghPenGray; // Gray pen.
+HPEN ghPenBackGnd; // Background pen.
+HPEN ghPenForeGnd; // Foreground pen.
+HPEN ghPenBtnText; // Button text pen.
+HPEN ghPenLtGray; // Button face pen.
+HPEN ghPenDkGray; // Button shadow pen.
+HBRUSH ghBrushLtGray; // Light Gray brush.
+HBRUSH ghBrushGray; // Gray brush.
+HBRUSH ghBrushBlack; // Black brush.
+HBRUSH ghBrushDkGray; // Dark Gray brush.
+HBRUSH ghBrushWhite; // White brush.
+HBRUSH ghBrushHighLight; // High Light brush.
+
+HFONT ghFontStatus; // Status Line Font.
+HFONT ghFontMsgBox; // Message Box Font.
+HFONT ghFontRibbon; // Ribbon Button Font.
+HFONT ghFontFiles; // File Font.
+HFONT ghFontLog; // Log File Font.
+HFONT ghFontIconLabels;// Icon Label Font.
+
+COLORREF gColorForeGnd; // Foreground Color
+COLORREF gColorBackGnd; // Background Color
+
+COLORREF gColorHighLight;
+COLORREF gColorHighLightText;
+
+ULONG gulFiles;
+ULONG gulBytes;
+ULONG gulDirectories;
+
+HCURSOR ghCursorPen;
+BOOL gfOperation;
+BOOL gfHWInitialized;
+
+INT gnBorderWidth;
+INT gnMainRibbonHeight;
+
+INT16 gnNumJobs ;
+BOOL gfEditJob ;
+WORD gwCurrentJobIndex ;
+CHAR_PTR gpszJobName ;
+
+INT16 gnNumScheds ;
+INT16 gnEditSched ;
+
+// MENU ITEM/CONFIGURATION FLAGS
+
+BOOL gfDeleteCatalogs = TRUE;
+BOOL gfShowStatusLine;
+BOOL gfShowMainRibbon;
+BOOL gfShowDocRibbon;
+BOOL gfDebug;
+BOOL gfPollDrive;
+BOOL gfAppInitialized;
+BOOL gfTerminateApp;
+BOOL gfIsJobRunning;
+
+BOOL gfDummyDriver = FALSE;
+BOOL gfIndicators;
+BOOL gfReplace;
+BOOL gfServers;
+BOOL gfNetworks = FALSE;
+BOOL gfEnhanced;
+
+#ifdef OEM_EMS
+BOOL gfExchange;
+CHAR gszDleDsName[MAX_UI_RESOURCE_SIZE];
+CHAR gszDleIsName[MAX_UI_RESOURCE_SIZE];
+#endif
+
+HRIBBON ghRibbonMain;
+HRIBBON ghRibbonDoc;
+
+WNDPROC glpfnNewListProc;
+WNDPROC glpfnOldListProc;
+WNDPROC glpfnNewMDIClientProc;
+WNDPROC glpfnOldMDIClientProc;
+
+POINT gDLMpt;
+
+INT16 gCatMaintChoice;
+INT16 gCatBsetChoice;
+INT16 gCatTapeChoice;
+
+INT16 gViewNetChoices ;
+
+#ifdef OEM_EMS
+INT16 gViewXchgChoices ;
+#endif
+
+INT gfPWForPWDBState;
+
+INT gb_last_operation = -1;
+INT gbCurrentOperation = OPERATION_NONE;
+INT gbAbortAtEOF = FALSE;
+INT gb_new_tape_flag = 0;
+
+INT gfAbortInMiddleOfFile;
+INT gfNoCATS = FALSE;
+INT gfIgnoreOTC = FALSE;
+INT gfCallEraseTape = FALSE;
+INT gfCallFormatTape = FALSE;
+
+UINT64 gn64LastOperTotalBytes;
+
+// *************************** OLD TMENU GLOBAL ITEMS ************************
+
+AUTO_PASSWORD gb_auto_password = {
+// TEXT("­ì«%MÛì!>>"),
+ {0xad, 0xec, 0xab, 0x25, 1, 0x4d, 0xdb, 0xec, 0x21, 0x3e, 0x3e, 0},
+ {TEXT('\0'),TEXT('\0'),TEXT('\0'),TEXT('\0'),TEXT('\0'),TEXT('\0'),TEXT('\0'),TEXT('\0')}
+};
+
+// encryption_key to pass to the EU_Open.
+// pass strlen( gb_encryption_key ) for ksize.
+
+INT8 gb_encryption_key[ MAX_ENCRYPTION_KEY_SIZE ] = "MSII2.6->3.0";
+
+RM_HDL_PTR rm; // Resource file handle
+DLE_HAND dle_list = NULL; // Drive list
+BSD_HAND bsd_list = NULL; // BSD List
+BSD_HAND tape_bsd_list = NULL; // Tape BSD List
+THW_PTR thw_list = NULL; // THW List
+DIL_HWD_PTR gb_dhw_ptr = NULL; // DIL Hardware Pointer
+
+#ifdef OS_WIN32 // allocate one global dil for NT
+DIL_HWD gb_NTDIL;
+# ifdef OEM_MSOFT
+ INT TapeDevice = -1 ; // Multi-instance doesn't use this
+# endif
+#endif
+
+INT8 gb_abort_flag;
+CHAR gb_exe_fname[ MAX_UI_FILENAME_SIZE ];
+CHAR gb_exe_path[ MAX_UI_PATH_SIZE ];
+CHAR gb_tmp_string[GB_TMP_STRING_SIZE];
+INT16 gb_logging = NOT_LOGGING;
+INT gb_logging_error;
+BOOLEAN gb_error_during_operation = FALSE;
+
+
+// STATUS BLOCK STUFF
+
+void SetStatusBlock(INT, DWORD); // This must be defined!
+
+#ifndef OEM_MSOFT // NOT for MSOFT
+
+HWND ghWndLogFiles;
+HWND ghWndLogFileView;
+PSTAT_SETSTATUSBLOCK pSTAT_SetStatusBlock;
+ULONG (FAR PASCAL *glpfnSetStatus)(PSTAT_SETSTATUSBLOCK);
+void SendStatusMsg(PSTAT_SETSTATUSBLOCK pStatusBlk);
+void CALLBACK StatusTimerProc(void);
+
+LPSTR glpOffsetTapeDriveName = 0L;
+LPSTR glpOffsetCurrentTapeName = 0L;
+LPSTR glpOffsetServerVolume = 0L;
+LPSTR glpOffsetTapeDriveIdentifier = 0L;
+LPSTR glpOffsetTapeNeededName = 0L;
+LPSTR glpOffsetDiskName = 0L;
+LPSTR glpOffsetActiveFile = 0L;
+LPSTR glpOffsetErrorMsg = 0L;
+LPSTR glpOffsetActiveDir = 0L;
+
+#endif // ! OEM_MSOFT
+
+
+// LOADER
+BOOL gfLoaderEnabled = FALSE ;
+
+// This is a default magazine record entry name used to
+// display the "Default(from Setting)" string in the jobs hardward dialog.
+// This name should not be translated
+CHAR gLDR_DefaultMagName[] = TEXT("Default") ;
+
+#ifdef MEM_DEBUG
+BOOLEAN gb_no_abort_on_mem_check = FALSE;
+#endif
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: GUI_InitGlobals()
+
+ Description: This function initializes MUI and GUI global variables.
+
+ Returns: FALSE if successful, otherwise TRUE.
+
+******************************************************************************/
+
+
+BOOL GUI_InitGlobals ( VOID )
+
+{
+
+# if !defined (OS_WIN32) //16 bit Windows specific code...
+ {
+ // Get the Windows Mode (NOT SUPPORTED FOR NT).
+ DWORD dwFlags;
+ dwFlags = GetWinFlags ();
+
+ // If we are not running in protected mode, BUG OUT.
+ // This should never happen.
+
+ if ( ! ( dwFlags & WF_PMODE ) )
+ {
+ return TRUE;
+ }
+ gfEnhanced = (BOOL)( dwFlags & WF_ENHANCED );
+ }
+# else
+ {
+ gfEnhanced = TRUE; //OR SHOULD THIS BE FALSE?
+ }
+# endif //OS_WIN32 specific code
+
+ // Initialize any window handles that need to be.
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ ghWndLogFiles = (HWND)NULL;
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ ghWndDebug = (HWND)NULL;
+ ghWndActiveDoc = (HWND)NULL;
+ ghModelessDialog = (HWND)NULL;
+
+ // Initialize the selection values.
+
+ gulFiles = gulBytes = gulDirectories = 0L;
+
+ // Get and set the Show flags.
+
+ gfShowDocRibbon = FALSE;
+ gfIndicators = TRUE;
+ gfShowMemory = FALSE;
+
+ // MUI Globals
+
+ gfAppInitialized = FALSE;
+ gfTerminateApp = FALSE;
+ gfHWInitialized = FALSE;
+ gnMainRibbonHeight = 0;
+
+#ifdef OEM_EMS
+ gfExchange = FALSE ;
+ RSM_StringCopy( IDS_XCHNG_DIR, gszDleDsName, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_XCHNG_INFO_STORE, gszDleIsName, MAX_UI_RESOURCE_LEN );
+#endif
+
+ // Clear out the SubClass proc function pointers.
+
+ glpfnNewListProc = NULL;
+ glpfnOldListProc = NULL;
+ glpfnNewMDIClientProc = NULL;
+ glpfnOldMDIClientProc = NULL;
+
+ // PWDB password flag
+
+ gfPWForPWDBState = DBPW_NOT_VERIFIED;
+
+ return FALSE;
+
+} /* end GUI_InitGlobals() */
+
+#ifdef OS_WIN32
+
+ //
+ // Gloabls variables used for the mapped file objects.
+ //
+
+ CHAR_PTR gbMappedObjName = TEXT("BOB_MARLEY"); // Name of mapping object
+ LPVOID gbMappedObjBuffer = NULL; // Global mapped object buffer
+ // used by the app and the Launcher
+
+#endif
+
+
diff --git a/private/utils/ntbackup/src/gmkdblk.c b/private/utils/ntbackup/src/gmkdblk.c
new file mode 100644
index 000000000..86a51b5a7
--- /dev/null
+++ b/private/utils/ntbackup/src/gmkdblk.c
@@ -0,0 +1,434 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: gmkdblk.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains functions for the tape format
+ layer to use to create DBLKs. The structure's passed
+ to the create functions includes generic information which
+ is common to most file systems and os specific information.
+ The os specific information was saved when the file system
+ for that os was used to make a backup. The information in
+ the os specific portion could potentially be translated into
+ a useable format for this file system. Each file system defines
+ the format for its os specific information in the header file
+ osinfo.h.
+
+
+ $Log: M:/LOGFILES/GMKDBLK.C_V $
+
+ Rev 1.17 15 Jan 1994 19:22:20 BARRY
+Change types and make casts to suppress Unicode warnings
+
+ Rev 1.16 24 Nov 1993 14:40:24 BARRY
+Unicode fixes (removed TEXT macros around byte characters)
+
+ Rev 1.15 05 Sep 1993 10:08:04 DOUG
+Changed FS_PC_OS2 to FS_PC_OS2_40 in GEN_CreateDDB()
+
+ Rev 1.14 15 Jul 1993 12:33:40 GREGG
+Added setting of 'compressed_obj' BOOLEAN in common portion of DBLK.
+
+ Rev 1.13 13 May 1993 20:41:06 BARRY
+Make sure gos pointer is inited before use.
+
+ Rev 1.12 01 Dec 1992 15:52:50 CHUCKB
+Took out unreferenced locals and C++-style comments.
+
+ Rev 1.11 29 Nov 1992 18:53:50 GREGG
+Added setting of tape_seq_num and continue_obj in common part of dblk.
+
+ Rev 1.10 11 Nov 1992 22:49:16 STEVEN
+This is Gregg checking files in for Steve. I don't know what he did!
+
+ Rev 1.8 11 Nov 1992 10:44:28 STEVEN
+fix os_name for gen_fs
+
+ Rev 1.7 09 Oct 1992 11:44:28 DAVEV
+Unicode (CHAR_PTR) pointer cast validation
+
+ Rev 1.6 29 Sep 1992 18:01:40 CHUCKB
+Took out references to TF_READ_GEN_DATA_ONLY.
+
+ Rev 1.5 24 Sep 1992 17:32:30 CHUCKB
+Commented out references to rem_size.
+
+ Rev 1.4 12 Aug 1992 15:56:48 BARRY
+Changes for MTF 4.0.
+
+ Rev 1.3 17 Mar 1992 09:05:30 STEVEN
+format 40 - added 64 bit support
+
+ Rev 1.2 21 Jan 1992 14:19:50 BARRY
+Added new gen_size to GEN_DBLK.
+
+ Rev 1.1 24 Jul 1991 11:38:40 DAVIDH
+Corrected compiler warnings under Watcom.
+
+ Rev 1.0 09 May 1991 13:39:28 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "gendblk.h"
+#include "osinfo.h"
+#include "gen_fs.h"
+#include "tfldefs.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: GEN_CreateFDB
+
+ Description: This function creates a FDB based on the information
+ passed in the GEN_FDB_DATA structure. This function
+ allows the tape format layer to create DBLKs without
+ knowing their structure.
+
+ Modified: 8/24/1989
+
+ Returns: TF_KEEP_ALL_DATA
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+INT16 GEN_CreateFDB( fsh, dat )
+FSYS_HAND fsh;
+GEN_FDB_DATA_PTR dat;
+{
+ GEN_DBLK_PTR ddblk;
+ DBLK_PTR dblk;
+ INT16 i ;
+ GOS_PTR gos = (GOS_PTR)dat->std_data.os_info;
+ OS2_FILE_OS_INFO_PTR oinfo ;
+ INT16 ret_val ;
+
+ (VOID) fsh ;
+
+ dat->std_data.dblk->blk_type = FDB_ID ;
+ dat->std_data.dblk->com.blkid = dat->std_data.blkid;
+ dat->std_data.dblk->com.f_d.did = dat->std_data.did ;
+ dat->std_data.dblk->com.ba.lba = dat->std_data.lba ;
+ dat->std_data.dblk->com.os_id = dat->std_data.os_id ;
+ dat->std_data.dblk->com.os_ver = dat->std_data.os_ver ;
+ dat->std_data.dblk->com.continue_obj = dat->std_data.continue_obj ;
+ dat->std_data.dblk->com.tape_seq_num = dat->std_data.tape_seq_num ;
+ dat->std_data.dblk->com.compressed_obj = dat->std_data.compressed_obj ;
+
+ ddblk = (GEN_DBLK_PTR)dat->std_data.dblk;
+ dblk = dat->std_data.dblk;
+ dblk->com.string_type = dat->std_data.string_type ;
+
+ ddblk->blk_type = FDB_ID;
+ ddblk->obj_type = DOS_OBJECT ;
+ ddblk->tape_attribs = dat->std_data.attrib ;
+
+ ddblk->mdate = *dat->mod_date ;
+ ddblk->cdate = *dat->creat_date ;
+ ddblk->bdate = *dat->backup_date ;
+ ddblk->bdate = *dat->access_date ;
+
+ ddblk->disp_size = dat->std_data.disp_size;
+
+ if ( dat->std_data.attrib & FILE_NAME_IN_STREAM_BIT ) {
+ dblk->com.os_name = NULL ;
+ } else {
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)dat->fname,
+ dat->fname_size ) ;
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+ }
+
+ switch ( dat->std_data.os_id ) {
+
+ case FS_NON_AFP_NOV:
+ ddblk->obj_type = NOV_OBJECT ;
+ break ;
+
+ case FS_GOS:
+
+ for( i = 0 ; i < 32; i++ ) {
+ if ( gos->finder[i] != 0 ) {
+ ddblk->obj_type = AFP_OBJECT ;
+ }
+ }
+
+ if ( ( gos->finder[4] == 'm' ) &&
+ ( gos->finder[5] == 'd' ) &&
+ ( gos->finder[6] == 'o' ) &&
+ ( gos->finder[7] == 's' ) ) {
+
+ ddblk->obj_type = NOV_OBJECT ;
+ }
+
+ if ( ( gos->long_name[0] != '\0' ) && strcmpA( gos->long_name, (ACHAR_PTR)dat->fname ) ) {
+ ddblk->obj_type = AFP_OBJECT ;
+ }
+ break ;
+
+ case FS_AFP_NOVELL_40:
+ {
+ BYTE_PTR finfo;
+
+ finfo = ((AFP_FILE_OS_INFO_PTR)dat->std_data.os_info)->finder ;
+
+ for( i = 0 ; i < 32; i++ ) {
+ if ( finfo[i] != 0 ) {
+ ddblk->obj_type = AFP_OBJECT ;
+ }
+ }
+
+ if ( ( finfo[4] == 'm' ) &&
+ ( finfo[5] == 'd' ) &&
+ ( finfo[6] == 'o' ) &&
+ ( finfo[7] == 's' ) ) {
+
+ ddblk->obj_type = NOV_OBJECT ;
+ }
+
+ if ( strcmpA( (ACHAR_PTR)dat->fname, gos->long_name ) ) {
+ ddblk->obj_type = AFP_OBJECT ;
+ }
+ }
+ break ;
+
+ case FS_PC_OS2_40:
+ oinfo = (OS2_FILE_OS_INFO_PTR)(dat->std_data.os_info) ;
+ if ( oinfo->longNameLength != 0 ) {
+
+ FS_ReleaseOSPathOrNameInDBLK( fsh, dblk ) ;
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (INT8_PTR)dblk + oinfo->longName,
+ oinfo->longNameLength ) ;
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+ }
+ break ;
+
+ default:
+ break ;
+ }
+
+ return TF_KEEP_ALL_DATA ;
+}
+
+
+/**/
+/**
+
+ Name: GEN_CreateDDB
+
+ Description: This function creates a DDB based on the information
+ passed in the GEN_DDB_DATA structure. This function
+ allows the tape format layer to create DBLKs without
+ knowing their structure.
+
+ Modified: 8/24/1989
+
+ Returns: TF_SKIP_ALL_DATA
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+INT16 GEN_CreateDDB( fsh, dat )
+FSYS_HAND fsh;
+GEN_DDB_DATA_PTR dat;
+
+{
+ GEN_DBLK_PTR ddblk;
+ DBLK_PTR dblk ;
+ INT16 i ;
+ BYTE_PTR finfo ;
+ GOS_PTR gos = (GOS_PTR)dat->std_data.os_info;
+ INT16 ret_val ;
+ OS2_DIR_OS_INFO_PTR oinfo ;
+
+ (VOID) fsh ;
+
+ dat->std_data.dblk->blk_type = DDB_ID ;
+ dat->std_data.dblk->com.blkid = dat->std_data.blkid;
+ dat->std_data.dblk->com.f_d.did = dat->std_data.did ;
+ dat->std_data.dblk->com.ba.lba = dat->std_data.lba ;
+ dat->std_data.dblk->com.os_id = dat->std_data.os_id ;
+ dat->std_data.dblk->com.os_ver = dat->std_data.os_ver ;
+
+ dat->std_data.dblk->com.continue_obj = dat->std_data.continue_obj ;
+ dat->std_data.dblk->com.tape_seq_num = dat->std_data.tape_seq_num ;
+
+ ddblk = (GEN_DBLK_PTR)dat->std_data.dblk;
+ dblk = dat->std_data.dblk;
+ dblk->com.string_type = dat->std_data.string_type ;
+
+ ddblk->blk_type = DDB_ID;
+ ddblk->obj_type = DOS_OBJECT ;
+ ddblk->tape_attribs = dat->std_data.attrib ;
+
+ ddblk->mdate = *dat->mod_date ;
+ ddblk->cdate = *dat->creat_date ;
+ ddblk->bdate = *dat->backup_date ;
+ ddblk->adate = *dat->access_date ;
+
+ ddblk->disp_size = dat->std_data.disp_size;
+
+ if ( dat->std_data.attrib & DIR_PATH_IN_STREAM_BIT ) {
+ dblk->com.os_name = NULL ;
+ } else {
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)dat->path_name,
+ dat->path_size ) ;
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+ }
+
+ switch ( dat->std_data.os_id ) {
+
+ case FS_NON_AFP_NOV:
+ ddblk->obj_type = NOV_OBJECT ;
+ break ;
+
+ case FS_GOS:
+
+ for( i = 0 ; i < 32; i++ ) {
+ if ( gos->finder[i] != 0 ) {
+ ddblk->obj_type = AFP_OBJECT ;
+ }
+ }
+
+ if ( ( gos->finder[4] == 'm' ) &&
+ ( gos->finder[5] == 'd' ) &&
+ ( gos->finder[6] == 'o' ) &&
+ ( gos->finder[7] == 's' ) ) {
+
+ ddblk->obj_type = NOV_OBJECT ;
+ }
+ break ;
+
+ case FS_AFP_NOVELL_40:
+
+ finfo = ((AFP_DIR_OS_INFO_PTR)dat->std_data.os_info)->finder ;
+
+ for( i = 0 ; i < 32; i++ ) {
+ if ( finfo[i] != 0 ) {
+ ddblk->obj_type = AFP_OBJECT ;
+ }
+ }
+
+ if ( ( finfo[4] == 'm' ) &&
+ ( finfo[5] == 'd' ) &&
+ ( finfo[6] == 'o' ) &&
+ ( finfo[7] == 's' ) ) {
+
+ ddblk->obj_type = NOV_OBJECT ;
+ }
+ break ;
+
+ case FS_PC_OS2_40:
+ oinfo = (OS2_DIR_OS_INFO_PTR)(dat->std_data.os_info) ;
+ if ( oinfo->pathLength != 0 ) {
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (INT8_PTR)dblk + oinfo->path,
+ oinfo->pathLength ) ;
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+
+ }
+ break ;
+
+ default:
+ break ;
+ }
+
+ return TF_KEEP_ALL_DATA ;
+
+}
+
+
+/**/
+/**
+
+ Name: GEN_CreateIDB()
+
+ Description: This function looks for a GEN_IMAGE DLE with the same
+ name as the attached DOS DLE. If one is found then the File
+ System Handle is re-attached to the IMAGE DLE. If one is NOT
+ found then DUMMY_CreateIDB() is called.
+
+ Modified: 9/18/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( DUMMY_CreateIDB(), FS_AttachToDLE() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+INT16 GEN_CreateIDB( fsh, dat )
+FSYS_HAND fsh;
+GEN_IDB_DATA_PTR dat;
+
+
+{
+ GEN_DBLK_PTR ddblk;
+
+ (VOID) fsh ;
+
+ dat->std_data.dblk->blk_type = IDB_ID ;
+ dat->std_data.dblk->com.blkid = dat->std_data.blkid;
+ dat->std_data.dblk->com.f_d.did = dat->std_data.did ;
+ dat->std_data.dblk->com.ba.lba = dat->std_data.lba ;
+
+ ddblk = (GEN_DBLK_PTR)dat->std_data.dblk;
+
+ ddblk->blk_type = IDB_ID;
+ ddblk->obj_type = IMAGE_OBJECT ;
+ ddblk->tape_attribs = dat->std_data.attrib ;
+ ddblk->disp_size = dat->std_data.disp_size;
+ ddblk->os_part_name = sizeof( *ddblk ) ;
+
+ memcpy( ((INT8_PTR)ddblk) + ddblk->os_part_name, dat->pname, dat->pname_size ) ;
+ if( *((CHAR_PTR)((INT8_PTR)ddblk) + (ddblk->os_part_name + dat->pname_size - 1 )) != TEXT('\0') ) {
+ *((CHAR_PTR)((INT8_PTR)ddblk) + (ddblk->os_part_name + dat->pname_size )) = TEXT('\0') ;
+ }
+
+ return TF_KEEP_ALL_DATA ;
+}
+
diff --git a/private/utils/ntbackup/src/gmoddblk.c b/private/utils/ntbackup/src/gmoddblk.c
new file mode 100644
index 000000000..d7b79322c
--- /dev/null
+++ b/private/utils/ntbackup/src/gmoddblk.c
@@ -0,0 +1,748 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: gmoddblk.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to get/set generic information
+ from/to a DOS FDB or DDB.
+
+
+ $Log: T:/LOGFILES/GMODDBLK.C_V $
+
+ Rev 1.20 17 Feb 1994 17:00:14 GREGG
+Fixed unicode pointer math bug causing memory hit.
+
+ Rev 1.19 15 Jan 1994 19:22:44 BARRY
+Call SetupOSPathOrName with BYTE_PTRs instead of CHAR_PTRs
+
+ Rev 1.18 24 Nov 1993 15:16:26 BARRY
+Unicode fixes
+
+ Rev 1.17 02 Aug 1993 08:44:32 DON
+Needed prototype for FS_SetupOSPathOrNameInDBLK
+
+ Rev 1.16 30 Jul 1993 13:19:06 STEVEN
+if dir too deep make new one
+
+ Rev 1.15 17 Mar 1993 15:27:38 TERRI
+Added a null to file name.
+
+ Rev 1.14 09 Mar 1993 11:37:24 MARILYN
+GEN_ProcessDDB should return TRUE (process DDBs always) not FALSE
+
+ Rev 1.13 07 Dec 1992 14:55:40 STEVEN
+Microsoft updates
+
+ Rev 1.12 01 Dec 1992 10:38:34 DON
+needed to use strNcpy instead of strcpy
+
+ Rev 1.11 11 Nov 1992 10:43:34 STEVEN
+fix os_name for gen_fs
+
+ Rev 1.10 06 Oct 1992 13:24:46 DAVEV
+Unicode strlen verification
+
+ Rev 1.9 22 Sep 1992 17:29:40 CHUCKB
+Took out references to GetTotalSizeDBLK().
+
+ Rev 1.8 10 Sep 1992 09:45:52 STEVEN
+fix warnings
+
+ Rev 1.7 18 Aug 1992 10:20:26 STEVEN
+fix warnings
+
+ Rev 1.6 17 Mar 1992 09:05:32 STEVEN
+format 40 - added 64 bit support
+
+ Rev 1.5 21 Jan 1992 14:20:34 BARRY
+Added GEN_GetGenSizeDBLK().
+
+ Rev 1.4 27 Nov 1991 10:34:28 BARRY
+Fixed GEN_GetOSPath parameters.
+
+ Rev 1.3 01 Oct 1991 11:19:36 BARRY
+Include standard headers.
+
+ Rev 1.2 14 Aug 1991 13:06:58 STEVEN
+added FindClose
+
+ Rev 1.1 24 Jul 1991 11:37:54 DAVIDH
+Corrected compiler warnings under Watcom.
+
+ Rev 1.0 09 May 1991 13:39:36 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+#include "tfldefs.h"
+#include "datetime.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "gendblk.h"
+#include "GEN_fs.h"
+#include "fsys_err.h"
+#include "msassert.h"
+/* $end$ include list */
+/**/
+/**
+
+ Name: GEN_GetOSFnameFDB()
+
+ Description: This function copies the OS file name in the specified
+ FDB to the specified buffer. The OS file name is the same as
+ the "normal" file name during backup. During restore, the
+ OS file name is the name stored on tape.
+
+ Modified: 8/15/1989
+
+ Returns: Error codes
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( GEN_ModFnameFDB() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetOSFnameFDB( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get path from */
+CHAR_PTR buf ; /* O - buffer to place path in */
+{
+ memcpy( buf, dblk->com.os_name->name, dblk->com.os_name->name_size ) ;
+
+ *( buf + ( dblk->com.os_name->name_size / sizeof( CHAR ) ) ) = TEXT('\0') ;
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: GEN_GetPartName()
+
+ Description: This function copies the OS partition name in the specified
+ IDB to the specified buffer.
+
+ Modified: 8/15/1989
+
+ Returns: Error codes
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( GEN_GetOSFnameFDB() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetPartName( fsh, dblk, buf )
+FSYS_HAND fsh ; /* I - file system handle */
+DBLK_PTR dblk ; /* I - Descriptor block to get path from */
+CHAR_PTR buf ; /* O - buffer to place path in */
+{
+ GEN_DBLK_PTR ddblk ;
+
+ (VOID) fsh;
+
+ ddblk = (GEN_DBLK_PTR) dblk;
+
+ strcpy( buf, (CHAR_PTR)(((INT8_PTR)ddblk) + ddblk->os_part_name) ) ;
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: GEN_GetOSPathDDB()
+
+ Description: This function copies the OS path in the specified
+ DDB to the specified buffer. The OS path is the same as
+ the "normal" path during backup. During restore, the
+ OS path name is the name stored on tape.
+
+ Modified: 8/15/1989
+
+ Returns: Error codes:
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( GEN_GetOSFnameFDB() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetOSPathDDB(
+ FSYS_HAND fsh, /* I - file system handle */
+ DBLK_PTR dblk, /* I - Descriptor block to get path from */
+ CHAR_PTR buf ) /*I/O- path to read (or to write) */
+{
+ (void)fsh;
+
+ memcpy( buf, dblk->com.os_name->name, dblk->com.os_name->name_size ) ;
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_GetFileVerFDB()
+
+ Description: Since DOS does not support file versions, this
+ function simply sets the version number to 0.
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetFileVerFDB( dblk, version )
+DBLK_PTR dblk ;
+UINT32 *version ;
+{
+ (VOID) dblk ;
+ *version = 0 ;
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_GetCdateDBLK()
+
+ Description: Pretend Creation date is same as Modify date
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+
+ See also: $/SEE( GEN_ModBdate(), GEN_GetMdate(), GEN_ModAdate() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetCdateDBLK( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ; /*I/O- createion date to read (or to write) */
+{
+ GEN_DBLK_PTR ddblk ;
+
+ ddblk = (GEN_DBLK_PTR) dblk ;
+
+ *buf = ddblk->cdate ;
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: GEN_GetMdateDBLK()
+
+ Description: This function copies the modified date/time into (or out of)
+ the provided buffer.
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( GEN_GetCdate(), GEN_ModBdate(), GEN_ModAdate() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetMdateDBLK( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ; /* O - modify date to write */
+{
+ GEN_DBLK_PTR ddblk ;
+
+ ddblk = (GEN_DBLK_PTR) dblk ;
+
+ *buf = ddblk->mdate ;
+ return SUCCESS ;
+}
+
+
+/**/
+/**
+
+ Name: GEN_ModBdateDBLK()
+
+ Description: This function copies the backup date/time into (or out of)
+ the provided buffer.
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( GEN_GetCdate(), GEN_GetMdate(), GEN_ModAdate() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_ModBdateDBLK(
+BOOLEAN set_it, /* I - TRUE if setting creation date, FALSE if getting */
+DBLK_PTR dblk, /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ) /*I/O- createion date to read (or to write) */
+{
+
+ GEN_DBLK_PTR ddblk ;
+
+ ddblk = (GEN_DBLK_PTR) dblk ;
+
+ if ( set_it ) {
+ ddblk->cdate = *buf ;
+ } else {
+ *buf = ddblk->cdate ;
+ }
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_ModAdateDBLK()
+
+ Description: This function copies the access date/time into (or out ot )
+ the provided buffer.
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( GEN_GetCdate(), GEN_GetMdate(), GEN_ModBdate() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_ModAdateDBLK(
+BOOLEAN set_it, /* I - TRUE if setting creation date, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ) /*I/O- createion date to read (or to write) */
+{
+ (VOID) dblk;
+
+ if ( ! set_it ) {
+ buf->date_valid = FALSE;
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_GetTotalSizeDBLK()
+
+ Description: This function returns the total size of a DBLK. This is
+ the sum of the sizes of all the data forks for the object.
+
+
+ Modified: 8/15/1989
+
+ Returns: Total number of data bytes.
+
+**/
+/* begin declaration */
+// UINT64 GEN_GetTotalSizeDBLK( fsh, dblk )
+// FSYS_HAND fsh ; /* I - File system handle */
+// DBLK_PTR dblk ; /* I - Descriptor block to get generic data size for */
+// {
+// GEN_DBLK_PTR ddblk;
+//
+// (VOID) fsh ;
+//
+// ddblk = (GEN_DBLK_PTR) dblk;
+//
+// return ddblk->size ;
+//
+// }
+/**/
+
+/**
+
+ Name: GEN_GetDisplaySizeDBLK()
+
+ Description: This function returns the displayable size of a DBLK.
+ For a file, this is the file size. For a directory this is
+ always 0.
+
+ Modified: 21-Jan-92
+
+ Returns: Number of generic data bytes.
+
+**/
+/* begin declaration */
+UINT64 GEN_GetDisplaySizeDBLK( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* I - Descriptor block to get generic data size for */
+{
+ GEN_DBLK_PTR ddblk = (GEN_DBLK_PTR)dblk;
+
+ (VOID)fsh ;
+
+ return ddblk->disp_size;
+}
+/**/
+/**
+
+ Name: GEN_ModAttribDBLK()
+
+ Description: This function copies the generic attributes into
+ (or out of) the specified DBLK.
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes: This only supports FDBs and DDBs. This should be called
+ by the FS_... function NOT by a macro.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_ModAttribDBLK(
+BOOLEAN set_it, /* I - TRUE if we are seting data */
+DBLK_PTR dblk, /*I/O- dblk to read or write data from */
+UINT32 *attrib ) /*I/O- attributre read or written */
+{
+ GEN_DBLK_PTR ddblk ;
+
+ ddblk = (GEN_DBLK_PTR) dblk;
+
+ if ( set_it ) {
+ ddblk->tape_attribs = *attrib ;
+
+ } else {
+ *attrib = ddblk->tape_attribs ;
+ }
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_GetObjTypeDBLK()
+
+ Description: This function looks at the os_id in the provided DBLK
+ and returns the type of the object.
+
+ Modified: 8/16/1989
+
+ Returns: SUCCESS
+
+ Notes: If the os_id is unknown then type is UNKNOWN_OBJECT
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetObjTypeDBLK( dblk, type )
+DBLK_PTR dblk ; /* I - Descriptor block to get type of */
+OBJECT_TYPE *type ; /* O - type of DBLK */
+{
+ GEN_DBLK_PTR ddblk ;
+
+ ddblk = (GEN_DBLK_PTR) dblk;
+
+ msassert( type != NULL );
+
+ *type = ddblk->obj_type ;
+
+ return( SUCCESS ) ;
+}
+
+/**/
+/**
+
+ Name: GEN_SetObjTypeDBLK()
+
+ Description: This function set the os_id in the provided DBLK
+
+ Modified: 8/16/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_SetObjTypeDBLK( dblk, type )
+DBLK_PTR dblk ; /* I - Descriptor block to set type of */
+OBJECT_TYPE type ; /* I - type of DBLK */
+{
+ GEN_DBLK_PTR ddblk ;
+
+ ddblk = (GEN_DBLK_PTR) dblk ;
+
+ ddblk->obj_type = type ;
+
+ return( SUCCESS ) ;
+}
+
+/**/
+/**
+
+ Name: GEN_GetOS_InfoDBLK()
+
+ Description: This function returns the OS info for the DOS
+ file system
+
+ Modified: 9/11/1989
+
+ Returns: Error Code
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes: This file system has no OS info.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+#ifdef GEN_FS_WRITE
+INT16 GEN_GetOS_InfoDBLK( dblk, os_info, size )
+DBLK_PTR dblk ; /* I - DBLK to get the info from */
+CHAR_PTR os_info ; /* O - Buffer to place data */
+INT16 *size ; /*I/O- Buffer size / data length */
+{
+ dblk ;
+ os_info ;
+
+ *size = 0 ;
+ return SUCCESS ;
+}
+#endif
+/**/
+/**
+
+ Name: GEN_GetActualSizeDBLK
+
+ Description: This function returns the actual size of a DBLK.
+
+ Modified: 9/11/1989
+
+ Returns: The number of bytes
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_GetActualSizeDBLK( fsh, dblk )
+FSYS_HAND fsh ;
+DBLK_PTR dblk ;
+{
+
+ GEN_DBLK *ddb ;
+ INT16 size ;
+
+ (VOID) fsh ;
+
+ size = sizeof( GEN_DBLK ) ;
+ ddb = (GEN_DBLK *)dblk ;
+
+ switch( dblk->blk_type ) {
+
+ case DDB_ID:
+ case FDB_ID :
+ break;
+
+ case IDB_ID :
+ size += ddb->os_part_name ;
+ break ;
+
+ default:
+ size = 0 ;
+ break ;
+
+ }
+
+ return size ;
+}
+
+/**/
+/**
+
+ Name: GEN_SetOwnerId()
+
+ Description: does nothing
+
+ Modified: 10/2/1989
+
+ Returns: none
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID GEN_SetOwnerId( fsh, dblk, id )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* O - DBLK to modify */
+UINT32 id ; /* I - value to set it to */
+{
+ (VOID) fsh ;
+ (VOID) dblk ;
+ (VOID) id ;
+}
+
+/**/
+/**
+
+ Name: GEN_ProcessDDB()
+
+ Description: This function allways returns TRUE to
+ specify that directories should be restored even if
+ if there are no file to restore into the directory.
+
+ Modified: 10/23/1989
+
+ Returns: TRUE
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+BOOLEAN GEN_ProcessDDB( fsh, ddb )
+FSYS_HAND fsh; /* I - file system handle */
+DBLK_PTR ddb; /* I - Directory information */
+{
+ (VOID) fsh;
+ (VOID) ddb;
+ return TRUE ;
+}
+
+/**/
+/**
+
+ Name: GEN_SpecExcludeObj
+
+ Description: This function allways returns false to specify that
+ the object passed in should NOT be exclude.
+
+ Modified: 1/10/1990
+
+ Returns: FS_NORMAL_FILE because this file system has no special
+ files.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_SpecExcludeObj( fsh, ddb, fdb )
+FSYS_HAND fsh; /* I - File system handle */
+DBLK_PTR ddb; /* I - Descriptor block of ddb */
+DBLK_PTR fdb ; /* I - Descriptor block of fdb */
+{
+ (VOID) fsh ;
+ (VOID) ddb;
+ (VOID) fdb ;
+
+ return FS_NORMAL_FILE ;
+}
+/**/
+/**
+
+ Name: GEN_SetDataSize()
+
+ Description: Stub function
+
+ Modified: 1/12/1990
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_SetDataSize( fsh, ddb, size )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR ddb ; /* I - Descriptor block of ddb */
+UINT32 size ; /* I - new size */
+{
+ (VOID) fsh;
+ (VOID) ddb;
+ (VOID) size ;
+
+ return SUCCESS ;
+}
+
+INT16 GEN_FindClose( fsh, dblk )
+FSYS_HAND fsh;
+DBLK_PTR dblk ;
+{
+ (VOID) fsh ;
+ (VOID) dblk ;
+
+ return SUCCESS ;
+}
+
+INT16 GEN_DupBlk( FSYS_HAND fsh, DBLK_PTR db_org, DBLK_PTR db_dup )
+{
+ *db_dup = *db_org ;
+
+ return FS_SetupOSPathOrNameInDBLK( fsh,
+ db_dup,
+ (BYTE_PTR)db_org->com.os_name->name,
+ db_org->com.os_name->name_size ) ;
+}
diff --git a/private/utils/ntbackup/src/gname.c b/private/utils/ntbackup/src/gname.c
new file mode 100644
index 000000000..67987071f
--- /dev/null
+++ b/private/utils/ntbackup/src/gname.c
@@ -0,0 +1,338 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: gname.c
+
+
+ Description: This file contains code to get the device name and
+ volume name for the given DLE.
+
+
+ $Log: M:/LOGFILES/GNAME.C_V $
+
+ Rev 1.20 15 Jan 1994 19:23:10 BARRY
+Call SetupOSPathOrName with BYTE_PTRs instead of CHAR_PTRs
+
+ Rev 1.19 24 Nov 1993 15:16:54 BARRY
+Changed CHAR_PTR in I/O function to BYTE_PTR
+
+ Rev 1.18 17 Aug 1993 01:23:18 GREGG
+Always return TRUE from IsBlkComplete if block type is CFDB.
+
+ Rev 1.17 24 Apr 1993 17:23:44 BARRY
+Added SizeofDevName function.
+
+ Rev 1.16 01 Mar 1993 16:43:28 TIMN
+Added header to resolve linking errors
+
+ Rev 1.15 29 Dec 1992 13:32:32 DAVEV
+unicode fixes (3)
+
+ Rev 1.14 07 Dec 1992 14:55:18 STEVEN
+Microsoft updates
+
+ Rev 1.13 02 Dec 1992 10:47:10 CHUCKB
+Took out unreferenced local.
+
+ Rev 1.12 11 Nov 1992 22:49:06 STEVEN
+This is Gregg checking files in for Steve. I don't know what he did!
+
+ Rev 1.10 11 Nov 1992 10:43:40 STEVEN
+fix os_name for gen_fs
+
+ Rev 1.9 06 Oct 1992 13:24:38 DAVEV
+Unicode strlen verification
+
+ Rev 1.8 25 Sep 1992 10:24:28 CHUCKB
+Added sinfo to GEN_CompleteBLK().
+
+ Rev 1.7 01 Sep 1992 11:25:00 TIMN
+Changed os_id and os_ver back
+
+ Rev 1.6 12 Aug 1992 14:57:26 BARRY
+Changed default os_id and os_ver.
+
+ Rev 1.5 05 Aug 1992 11:01:30 DON
+removed warnings
+
+ Rev 1.4 15 May 1992 16:39:04 STEVEN
+temp add block complete functions
+
+ Rev 1.3 05 May 1992 17:19:20 STEVEN
+fixed typos and misc bugs
+
+ Rev 1.2 03 Mar 1992 16:16:42 STEVEN
+added function for initializeing defalut make block
+
+ Rev 1.1 16 Dec 1991 17:26:48 STEVEN
+move common functions to tables
+
+ Rev 1.0 10 Dec 1991 09:06:54 STEVEN
+Initial revision.
+
+**/
+#include <string.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdwcs.h"
+
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+
+/**/
+/**
+
+ Name: GEN_DeviceDispName()
+
+ Description: This function gets the displayable device name for
+ a DLE. This name is displayed for drive select.
+
+ Modified: 9/13/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 GEN_DeviceDispName( dle, dev_name, size, type )
+GENERIC_DLE_PTR dle;
+CHAR_PTR dev_name;
+INT16 size ;
+INT16 type ;
+{
+ (VOID)type;
+
+ if ( size < 6 * sizeof (CHAR) ) {
+ return FS_BUFFER_TO_SMALL ;
+ }
+
+ if ( ( dle->type & HAND_MADE_MASK ) ) {
+ strncpy ( dev_name, dle->info.user->vol_name, size / sizeof (CHAR) ) ;
+ dev_name[(size-1)/sizeof (CHAR)] = TEXT('\0') ;
+ return ( SUCCESS ) ;
+ }
+
+ strncpy( dev_name, dle->device_name, size / sizeof (CHAR) ) ;
+ dev_name[(size-1)/sizeof (CHAR)] = TEXT('\0') ;
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_GetVolName()
+
+ Description: This function coppies the volume name
+ of the specified drive to the buffer provided.
+
+ Modified: 12/4/1991 9:45:49
+
+**/
+VOID GEN_GetVolName( dle, buffer )
+GENERIC_DLE_PTR dle;
+CHAR_PTR buffer ;
+{
+ if ( dle->type & HAND_MADE_MASK ) {
+ strcpy( buffer, dle->info.user->vol_name ) ;
+
+ } else {
+ sprintf( buffer, TEXT("%s"), dle->device_name ) ;
+ }
+}
+
+/**/
+/**
+
+ Name: GEN_SizeofVolName()
+
+ Description: This function returns the size of the volume name
+ which will be created by DLE_GetVolName()
+
+ Modified: 12/4/1991 11:14:25
+
+ Returns: size of string including \0;
+
+**/
+INT16 GEN_SizeofVolName( dle )
+GENERIC_DLE_PTR dle ;
+{
+ INT16 size ;
+
+ if ( dle->type & HAND_MADE_MASK ) {
+ size = (INT16)(strsize( dle->info.user->vol_name ) ) ;
+
+ } else {
+ size = (INT16)(strsize ( dle->device_name )) ;
+ }
+
+ return( size ) ;
+}
+
+/**/
+/**
+
+ Name: GEN_SizeofDevName()
+
+ Description: Returns the size of the device name returned
+ by DLE_GetDeviceName.
+
+ Modified: 20-Apr-93
+
+ Returns: size of device name string, in bytes, including
+ terminating null character.
+
+**/
+INT16 GEN_SizeofDevName( dle )
+GENERIC_DLE_PTR dle ;
+{
+ return strsize( dle->device_name );
+}
+
+/**/
+/**
+
+ Name: GEN_MakePath()
+
+ Description: This function is used to create a test string which
+ can be used as a path specifier in a script file.
+
+ Modified: 12/4/1991 14:57:3
+
+ Returns: Error code
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 GEN_MakePath( buf, bsize, dle, path, psize, fname )
+CHAR_PTR buf; /* O - buffer to place path string into */
+INT16 bsize ; /* I - size of above buffer */
+GENERIC_DLE_PTR dle ; /* I - Drive the selection is from */
+CHAR_PTR path ; /* I - path string in generic format */
+INT16 psize ; /* I - size of above path */
+CHAR_PTR fname ; /* I - null terminated file name */
+{
+ INT16 cb_dev_len = 0 ;
+ INT16 ret_val = SUCCESS ;
+ CHAR_PTR c_ptr ;
+
+ if( dle != NULL ) {
+ cb_dev_len = (INT16)strsize( dle->device_name ) ;
+ }
+
+ /* Check to see whether the buffer to store the path is large enough */
+ if( bsize < (INT16)( psize + strsize( fname ) + cb_dev_len ) ) {
+ ret_val = FS_BUFFER_TO_SMALL ;
+ } else {
+
+ if( dle != NULL ) {
+ strcpy( buf, dle->device_name ) ;
+ } else {
+ *buf = TEXT('\0') ;
+ }
+
+ if( psize != sizeof (CHAR) ) {
+ strcat( buf, TEXT("\\") ) ;
+ }
+
+ c_ptr = path ;
+ while( c_ptr < path + psize / sizeof (CHAR) ) {
+ strcat( buf, c_ptr ) ;
+ strcat( buf, TEXT("\\") ) ;
+ c_ptr += strlen( c_ptr ) + 1 ;
+ }
+
+ if ( fname != NULL ) {
+ strcat( buf, fname ) ;
+ }
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: GEN_InitMakeData()
+
+ Description: This function is used to initialize the parameter block
+ which is passed to CreateDBLK.
+
+ Modified: 12/4/1991 14:57:3
+
+ Returns: NONE
+
+ Notes:
+
+**/
+VOID GEN_InitMakeData(
+FSYS_HAND fsh,
+INT16 blk_type,
+CREATE_DBLK_PTR data ) {
+
+ (VOID)fsh ;(VOID)blk_type;
+
+ data->v.std_data.os_id = FS_PC_DOS ;
+ data->v.std_data.os_ver = FS_PC_DOS_VER ;
+ return ;
+}
+
+
+BOOLEAN GEN_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk )
+{
+ (void)fsh;
+
+ if( dblk->blk_type != CFDB_ID && dblk->com.os_name == NULL ) {
+ return FALSE ;
+ } else {
+ return TRUE ;
+ }
+
+}
+
+INT16 GEN_CompleteBlk( FSYS_HAND fsh, DBLK_PTR dblk, BYTE_PTR buffer, UINT16 *size, STREAM_INFO_PTR s_info )
+{
+ INT16 ret_val ;
+ STREAM_INFO_PTR stream_info ;
+ BYTE_PTR stream_data ;
+
+ ret_val = FS_FillBufferWithStream( fsh, dblk, buffer, size, s_info );
+
+ if ( ret_val == FS_STREAM_COMPLETE )
+ {
+ /* buffer has been filled */
+ /* lets set up the buffers */
+
+ FS_GetStreamInfo( fsh, dblk, &stream_info, &stream_data ) ;
+
+ if ( FS_GetStrmSizeHi( stream_info ) != 0 )
+ {
+ ret_val = OUT_OF_MEMORY;
+ }
+ else
+ {
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ stream_data,
+ (UINT16)FS_GetStrmSizeLo( stream_info ) ) ;
+ }
+ }
+
+ return ret_val ;
+}
+
+VOID GEN_ReleaseBlk( FSYS_HAND fsh, DBLK_PTR dblk ) {
+
+ FS_ReleaseOSPathOrNameInDBLK( fsh, dblk ) ;
+
+ return ;
+}
diff --git a/private/utils/ntbackup/src/gsize.c b/private/utils/ntbackup/src/gsize.c
new file mode 100644
index 000000000..a3746e9a6
--- /dev/null
+++ b/private/utils/ntbackup/src/gsize.c
@@ -0,0 +1,181 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: gsize.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to get the size of the
+ variable length fields in FDBs and DDBs
+
+
+ $Log: M:/LOGFILES/GSIZE.C_V $
+
+ Rev 1.7 24 Nov 1993 15:17:16 BARRY
+Unicode fixes
+
+ Rev 1.6 01 Mar 1993 16:43:44 TIMN
+Added header to resolve linking errors
+
+ Rev 1.5 02 Dec 1992 17:05:36 CHUCKB
+Fixed compiler warning.
+
+ Rev 1.4 11 Nov 1992 10:43:38 STEVEN
+fix os_name for gen_fs
+
+ Rev 1.3 06 Oct 1992 13:24:56 DAVEV
+Unicode strlen verification
+
+ Rev 1.2 22 Jan 1992 10:22:14 STEVEN
+fix warnings for WIN32
+
+ Rev 1.1 24 Jul 1991 11:38:18 DAVIDH
+Corrected compiler warnings under Watcom.
+
+ Rev 1.0 09 May 1991 13:39:44 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+
+#include "msassert.h"
+#include "fsys.h"
+#include "gendblk.h"
+#include "gen_fs.h"
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: GEN_SizeofOSFname()
+
+ Description: This function returns the size of the file
+ name (as it appears on tape) contained in the FDB bassed in
+
+ Modified: 9/11/1989
+
+ Returns: number of bytes including terminating NULL.
+
+ Notes:
+
+ See also: $/SEE( GEN_SizeofPath(), GEN_SizeofFname() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_SizeofOSFname( fsh, fdb )
+FSYS_HAND fsh; /* I - file system in use */
+DBLK_PTR fdb ; /* I - dblk to get fname from */
+{
+ (VOID) fsh ;
+
+ msassert( fdb->blk_type == FDB_ID ) ;
+
+ return ( fdb->com.os_name->name_size ) ;
+}
+
+/**/
+/**
+
+ Name: GEN_SizeofPartName()
+
+ Description: This function returns the size of the partition
+ name (as it appears on tape).
+
+ Modified: 3/15/1990
+
+ Returns: number of bytes including terminating NULL.
+
+ Notes:
+
+ See also: $/SEE( GEN_SizeofOSPath(), GEN_SizeofOSFname() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_SizeofPartName( fsh, idb )
+FSYS_HAND fsh; /* I - file system in use */
+DBLK_PTR idb ; /* I - dblk to get fname from */
+{
+ INT16 size ;
+
+ (VOID) fsh ;
+
+ msassert( idb->blk_type == IDB_ID ) ;
+
+ size = (INT16)strsize( (CHAR_PTR)(((INT8_PTR)idb) + ((GEN_DBLK *)idb)->os_part_name) );
+
+ return size ;
+}
+
+/**/
+/**
+
+ Name: GEN_SizeofOSPath()
+
+ Description: This function return the size of the path saved in the
+ DDB.
+
+ Modified: 9/11/1989
+
+ Returns: Number of bytes in path string
+
+ Notes:
+
+ See also: $/SEE( GEN_SizeofPath(), GEN_SizeofFname() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 GEN_SizeofOSPath( fsh, ddb )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR ddb ; /* I - DBLK to get path size from */
+{
+ (VOID) fsh ;
+ msassert( ddb->blk_type == DDB_ID ) ;
+
+ return ( ddb->com.os_name->name_size ) ;
+}
+
+
+/**/
+/**
+
+ Name: GEN_SizeofOSInfo()
+
+ Description: This function returns the size of the OS info for
+ an FDB or a DDB
+
+ Modified: 9/11/1989
+
+ Returns: Size in bytes.
+
+ Notes:
+
+ See also: $/SEE( GEN_SizeofFname(), GEN_SizeofPath() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+#ifdef GEN_FS_WRITE
+INT16 GEN_SizeofOSInfo( fsh, dblk)
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk; /* I - DBLK to get size of OS info for */
+{
+ fsh ;
+ dblk ;
+
+ return 0 ;
+}
+#endif
+
diff --git a/private/utils/ntbackup/src/gtnxtdle.c b/private/utils/ntbackup/src/gtnxtdle.c
new file mode 100644
index 000000000..136187f74
--- /dev/null
+++ b/private/utils/ntbackup/src/gtnxtdle.c
@@ -0,0 +1,1032 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: gtnxtdle.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: this file contains the
+
+
+ $Log: M:/LOGFILES/GTNXTDLE.C_V $
+
+ Rev 1.36 24 Nov 1993 14:38:24 BARRY
+Unicode fixes
+
+ Rev 1.35 28 Oct 1993 13:21:08 DON
+Fixed where calls to FS_FindObjClose on non-SUCCESSful returns values
+was called. The code was never being executed due to 'break' or
+'continue' directives above conditional.
+
+ Rev 1.34 29 Sep 1993 18:24:58 BARRY
+Send the DBLK with ACCESS_DENIED.
+
+ Rev 1.33 29 Sep 1993 16:59:12 BARRY
+Upon FS error in GetADir, send an access denied message to the UI.
+
+ Rev 1.32 29 Sep 1993 13:42:06 MARILYN
+We needed to call FS_FindObjClose on non-SUCCESSful returns values
+from FS_FindFirst and FS_FindNext
+
+ Rev 1.31 27 Jul 1993 17:34:24 BARRY
+Handle errors from FindFirst/Next a little differently.
+
+ Rev 1.30 26 Jul 1993 14:52:52 CARLS
+added code for comm failure
+
+ Rev 1.29 16 Jul 1993 09:05:22 DON
+We must set the name space in the file system handle before calling
+FS_ChangeDir so the file system has a clue as to what the current
+name space is for a Dir Path. It will be saved in the DIR_PATH structure
+along with the Dir Path.
+
+ Rev 1.28 23 Apr 1993 16:43:48 CHARLIE
+Initialize BOOLEANs find_error and getinfo_error
+
+ Rev 1.27 11 Mar 1993 16:06:10 STEVEN
+fix bug found by PLUNGER
+
+ Rev 1.26 14 Jan 1993 13:33:00 STEVEN
+added stream_id to error message
+
+ Rev 1.25 24 Nov 1992 16:39:42 STEVEN
+fix loose name structures
+
+ Rev 1.24 13 Nov 1992 10:06:44 STEVEN
+UNICODE !
+
+ Rev 1.23 11 Nov 1992 22:49:02 STEVEN
+This is Gregg checking files in for Steve. I don't know what he did!
+
+ Rev 1.22 02 Oct 1992 16:28:54 BARRY
+Fixes so we don't stop processing a directory when a GetInfo fails.
+
+ Rev 1.21 23 Jul 1992 16:44:12 STEVEN
+fix warnings
+
+ Rev 1.20 23 Jul 1992 11:58:16 STEVEN
+fix warnings
+
+ Rev 1.19 09 Jul 1992 13:59:46 STEVEN
+BE_Unicode updates
+
+ Rev 1.18 26 May 1992 15:37:14 TIMN
+LP_InitPDL hard coded for ANSI data
+
+ Rev 1.17 21 May 1992 17:16:58 TIMN
+Convert CHARs to INT8
+
+ Rev 1.16 13 May 1992 12:39:10 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.15 13 May 1992 12:01:12 STEVEN
+40 format changes
+
+ Rev 1.14 16 Mar 1992 16:20:24 STEVEN
+added support to release DBLK for 40 format
+
+ Rev 1.13 10 Mar 1992 16:04:38 STEVEN
+make lp_add_a_dir faster
+
+ Rev 1.12 28 Feb 1992 10:37:10 GREGG
+Steve fixed bug involving backing up Image and nonimage sets from one BSD list.
+
+ Rev 1.11 16 Jan 1992 15:11:48 STEVEN
+fix warnings for WIN32
+
+ Rev 1.10 14 Nov 1991 17:18:50 STEVEN
+was incorrectly adding parent dirs
+
+ Rev 1.9 03 Sep 1991 15:46:08 STEVEN
+LP_PathComp() was returning >0 & <0 not +1 & -1
+
+ Rev 1.8 27 Aug 1991 10:18:32 STEVEN
+was only backing up bindery
+
+ Rev 1.7 23 Aug 1991 16:23:08 DON
+was never calling get info
+
+ Rev 1.6 15 Aug 1991 13:46:18 STEVEN
+special blocks returned as NULL
+
+ Rev 1.5 01 Aug 1991 17:07:56 STEVEN
+We backed up directories multiple times
+
+ Rev 1.4 21 Jun 1991 13:51:38 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:13:26 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 23 May 1991 12:50:58 STEVEN
+Changes due to changes from new BSDU
+
+ Rev 1.1 14 May 1991 14:28:04 DAVIDH
+Initialized 'pid' -- also cleared up Watcom compiler warning.
+
+ Rev 1.0 09 May 1991 13:39:46 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "msassert.h"
+#include "tbe_err.h"
+#include "tbe_defs.h"
+#include "tflproto.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "queues.h"
+#include "lis.h"
+#include "loops.h"
+#include "tfldefs.h"
+#include "loop_prv.h"
+#include "get_next.h"
+#include "vm.h"
+/* $end$ include list */
+
+/* declarations */
+typedef struct {
+ VM_PTR next ;
+ VM_PTR prev ;
+ BOOLEAN proc_dir_only ;
+ /* So we can tell FSYS what the name space is for a Dir Path */
+ UINT32 name_space;
+ INT16 psize ;
+ INT8 path[1] ;
+} DIR_PATH, *DIR_PATH_PTR ;
+
+
+static INT16 LP_PathComp( INT8_PTR, INT16, INT8_PTR, INT16 ) ;
+static INT16 LP_GetADir( LP_ENV_PTR, DBLK_PTR *, BOOLEAN * ) ;
+static INT16 LP_AddADir( LP_ENV_PTR, CHAR_PTR, INT16, BOOLEAN ) ;
+static INT16 LP_InitPDL( LP_ENV_PTR ) ;
+
+/**/
+/**
+
+ Name: LP_GetNextDLEBlock()
+
+ Description: this return uses the file system to obtain blocks to
+ match up against the fse list. blocks that match the
+ fse list are returned to the loops.
+
+ Modified: 5/20/1991 13:24:26
+
+ Returns: tape backup engine error
+ if no error is returned and bld_ptr == NULL then
+ there are no more files.
+
+ Notes:
+
+ See also: $/SEE( LP_BackupEngine() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_GetNextDLEBlock(
+LP_ENV_PTR lp,
+DBLK_PTR *blk_ptr )
+{
+ INT16 error = SUCCESS ;
+ UINT16 finished = FALSE ;
+ FSE_PTR fse_ptr ;
+ FSYS_HAND fsh ;
+ UINT32 attrib ;
+ INT16 match_status ;
+ UINT32 pid ;
+ BSD_PTR bsd ;
+ INT16 find_error = SUCCESS ;
+ INT16 getinfo_error = SUCCESS ;
+
+ bsd = lp->lis_ptr->curr_bsd_ptr ;
+ *blk_ptr = NULL ;
+
+ fsh = lp->curr_fsys ;
+ pid = lp->lis_ptr->pid ;
+
+ /* start loop to find file */
+ while ( !finished ) {
+
+ /* this portion of the loop finds the special blocks to return */
+ if( lp->get_spcl && ( BSD_GetProcSpecialFlg( bsd ) ) ) {
+
+ if ( FS_GetBlockType( lp->curr_blk ) == FDB_ID ) {
+ FS_ReleaseDBLK( lp->curr_fsys, lp->curr_blk ) ;
+ }
+
+ if ( FS_GetSpecialDBLKS( fsh, lp->curr_blk, &lp->seq_num ) == FS_NO_MORE ) {
+ lp->get_spcl = FALSE ;
+ if( lp->after_bs ) {
+ break ;
+ }
+
+ } else {
+ *blk_ptr = lp->curr_blk ;
+ if ( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) {
+ lp->empty_blk = lp->curr_ddb ;
+ lp->curr_ddb = lp->curr_blk ;
+ lp->curr_blk = lp->empty_blk ;
+
+ *blk_ptr = lp->curr_ddb ;
+ }
+ break ;
+ }
+
+ } else if( lp->get_spcl && lp->after_bs ) {
+ break ;
+ }
+
+
+ if( lp->start_new_dir ) {
+
+ if( lp->get_next_first_time ) {
+ /* build initial stack from fsl and sort it */
+
+ /*
+ NOTE:If this ever changes, the current way
+ were saving the name space for the
+ Dir Path must also change.
+ Assumptions are made as to the ordering
+ of the PDL Queue!
+ */
+ if ( (error = LP_InitPDL( lp )) != SUCCESS ) {
+ break ;
+ }
+ lp->get_next_first_time = FALSE ;
+ memset( lp->curr_ddb, 0, sizeof(DBLK) ) ;
+ }
+
+ if ( FS_GetBlockType( lp->curr_ddb ) == DDB_ID ) {
+
+ FS_ReleaseDBLK( lp->curr_fsys, lp->curr_ddb ) ;
+ }
+
+ if ( ( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) ||
+ ( FS_GetBlockType( lp->curr_blk ) == FDB_ID ) ) {
+
+ FS_ReleaseDBLK( lp->curr_fsys, lp->curr_blk ) ;
+ }
+
+ error = LP_GetADir( lp, blk_ptr, &lp->start_new_dir ) ;
+
+ if( error == SUCCESS && *blk_ptr == NULL ) {
+
+ /* Now get special blocks to return back to loops */
+ lp->get_spcl = TRUE ;
+ lp->after_bs = TRUE ;
+ continue ;
+
+ }else if( error != SUCCESS ) {
+ /* break to return error */
+ break ;
+ }
+
+ if( FS_GetBlockType( lp->curr_blk ) == IDB_ID ) {
+ lp->get_first_file = FALSE ;
+ break ;
+ }
+
+ switch( BSD_MatchObj( bsd, &fse_ptr, fsh,
+ lp->curr_blk, NULL, FALSE ) ) {
+
+ case OUT_OF_MEMORY:
+ return OUT_OF_MEMORY ;
+
+ case BSD_PROCESS_OBJECT:
+ case BSD_PROCESS_ELEMENTS:
+ /* reset appropriate flags */
+ lp->start_new_dir = FALSE ;
+ lp->get_first_file = TRUE ;
+
+ /* copy directory into curr_ddb */
+ lp->empty_blk = lp->curr_ddb ;
+ lp->curr_ddb = lp->curr_blk ;
+ lp->curr_blk = lp->empty_blk ;
+ break ;
+
+ default:
+ lp->start_new_dir = TRUE ;
+ continue ;
+ }
+
+ }else{
+
+ find_error = SUCCESS;
+
+ if ( lp->send_saved_block ) {
+
+ lp->send_saved_block = FALSE ;
+
+ } else if( lp->get_first_file ) {
+
+ if ( ( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) ||
+ ( FS_GetBlockType( lp->curr_blk ) == FDB_ID ) ) {
+
+ FS_ReleaseDBLK( lp->curr_fsys, lp->curr_blk ) ;
+ }
+
+ find_error = FS_FindFirstObj( fsh, lp->curr_blk, ALL_FILES );
+
+ if ( find_error == FS_COMM_FAILURE ) {
+
+ /* Send message to UI that we're stopping */
+ /* since the device is not responding. */
+
+ LP_MsgCommFailure( pid,
+ bsd,
+ fsh,
+ &lp->tpos,
+ lp->curr_ddb,
+ lp->curr_blk,
+ 0L );
+
+ *blk_ptr = NULL ;
+ error = SUCCESS ;
+ break ;
+ }
+
+ if ( (find_error == FS_NO_MORE) ||
+ ( find_error == FS_DEVICE_ERROR ) ||
+ (find_error == FS_ACCESS_DENIED) ) {
+
+ attrib = FS_GetAttribFromDBLK( fsh, lp->curr_ddb ) ;
+ attrib |= DIR_EMPTY_BIT ;
+ FS_SetAttribFromDBLK( fsh, lp->curr_ddb, attrib ) ;
+
+ if ( ( find_error == FS_DEVICE_ERROR ) ||
+ ( find_error == FS_ACCESS_DENIED ) ) {
+ LP_MsgError( pid,
+ bsd,
+ fsh,
+ &lp->tpos,
+ LP_ACCESS_DENIED_ERROR,
+ lp->curr_ddb,
+ NULL,
+ -1 ) ;
+ }
+
+ // Need to call find close to release find handles
+ FS_FindObjClose( fsh, lp->curr_blk ) ;
+
+ lp->start_new_dir = TRUE ;
+ *blk_ptr = lp->curr_ddb ;
+ break ;
+ }
+
+ if ( find_error != FS_DEVICE_ERROR ) {
+
+ attrib = FS_GetAttribFromDBLK( fsh, lp->curr_ddb ) ;
+ attrib &= ~(DIR_EMPTY_BIT) ;
+ FS_SetAttribFromDBLK( fsh, lp->curr_ddb, attrib ) ;
+
+ lp->send_saved_block = TRUE ;
+
+ break ;
+ }
+
+ } else {
+ if ( ( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) ||
+ ( FS_GetBlockType( lp->curr_blk ) == FDB_ID ) ) {
+
+ FS_ReleaseDBLK( lp->curr_fsys, lp->curr_blk ) ;
+ }
+
+ find_error = FS_FindNextObj( fsh, lp->curr_blk ) ;
+
+ if ( find_error != SUCCESS ) {
+
+ if ( find_error == FS_COMM_FAILURE ) {
+
+ /* Send message to UI that we're stopping */
+ /* since the device is not responding. */
+
+ LP_MsgCommFailure( pid,
+ bsd,
+ fsh,
+ &lp->tpos,
+ lp->curr_ddb,
+ lp->curr_blk,
+ 0L );
+
+ *blk_ptr = NULL ;
+ error = SUCCESS ;
+ break ;
+
+ } else {
+
+ if ( find_error == FS_ACCESS_DENIED ) {
+ LP_MsgError( pid,
+ bsd,
+ fsh,
+ &lp->tpos,
+ LP_ACCESS_DENIED_ERROR,
+ lp->curr_ddb,
+ NULL,
+ -1 ) ;
+ }
+
+ // Need to call find close to release find handles
+ FS_FindObjClose( fsh, lp->curr_blk ) ;
+
+ lp->start_new_dir = TRUE ;
+ continue ;
+ }
+ }
+ }
+
+ lp->get_first_file = FALSE ;
+
+ if ( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) {
+
+ switch( BSD_MatchObj( bsd, &fse_ptr, fsh,
+ lp->curr_blk, NULL, FALSE ) ) {
+
+ case OUT_OF_MEMORY:
+ return OUT_OF_MEMORY ;
+
+ case BSD_PROCESS_OBJECT:
+ case BSD_PROCESS_ELEMENTS:
+
+ if ( LP_AddADir( lp, NULL, (UINT16)0, FALSE ) != SUCCESS ) {
+ error = OUT_OF_MEMORY ;
+ finished = TRUE ;
+ } else {
+ FS_ReleaseDBLK( lp->curr_fsys, lp->curr_blk ) ;
+ }
+
+
+ break ;
+
+ case FSL_EMPTY:
+ return( FS_NO_MORE ) ;
+
+ case BSD_SKIP_OBJECT:
+ case BSD_SPECIAL_OBJECT:
+ break ;
+ }
+
+ } else {
+
+ if ( find_error == FS_DEVICE_ERROR )
+ {
+ getinfo_error = SUCCESS;
+ }
+ else
+ {
+ getinfo_error = FS_GetObjInfo( fsh, lp->curr_blk );
+ }
+
+ if ( (find_error != SUCCESS) || (getinfo_error != SUCCESS) )
+ {
+ INT16 theError = ((find_error != SUCCESS) ? find_error : getinfo_error);
+
+ if ( theError == FS_COMM_FAILURE )
+ {
+ /* Send message to UI that we're stopping */
+ /* since the device is not responding. */
+
+ LP_MsgCommFailure( pid,
+ bsd,
+ fsh,
+ &lp->tpos,
+ lp->curr_ddb,
+ lp->curr_blk,
+ 0L );
+
+ /* No point in trying any more for this dev. */
+ *blk_ptr = NULL;
+ error = SUCCESS;
+ break;
+ }
+ else
+ {
+ continue;
+ }
+
+ /**************************************************
+ In older backup engines, did something like:
+ LP_MsgAttrReadError( pid,
+ lp->curr_bsd_ptr,
+ fsh,
+ &lp->tpos,
+ lp->curr_blk ) ;
+ ***************************************************/
+ }
+
+ match_status = BSD_MatchObj( bsd, &fse_ptr, fsh,
+ lp->curr_ddb, lp->curr_blk, FALSE ) ;
+
+ switch( match_status ) {
+
+ case OUT_OF_MEMORY:
+ return OUT_OF_MEMORY ;
+
+ case BSD_PROCESS_OBJECT:
+ case BSD_PROCESS_ELEMENTS:
+
+ *blk_ptr = lp->curr_blk ;
+ finished = TRUE ;
+ break ;
+
+ case FSL_EMPTY:
+ return FS_NO_MORE ;
+
+ default:
+ break ;
+ }
+ }
+ }
+
+ }
+
+ return error ;
+}
+/**/
+/**
+
+ Name: LP_GetADir()
+
+ Description: this routine pulls a DIR_PATH off of the
+ pdl queue, changes into the directory,
+ and builds the ddb.
+
+ Modified: 7/14/1989
+
+ Returns: tape backup error
+
+ Notes: na
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_GetADir(
+register LP_ENV_PTR lp,
+DBLK_PTR *blk_ptr,
+BOOLEAN *proc_dir_only )
+{
+ DIR_PATH_PTR dpath_ptr ;
+ INT16 error = SUCCESS ;
+ INT16 getError = SUCCESS ;
+ VM_PTR vm_temp ;
+ VM_HDL vmem_hand = lp->pdl_q->vm_hdl ;
+
+ *blk_ptr = NULL ;
+
+ while ( lp->pdl_q->pdl_head != NULL ) {
+
+ if ( lp->pdl_q->pdl_head == lp->pdl_q->vm_last_elem ) {
+ lp->pdl_q->vm_last_elem = (VM_PTR)NULL ;
+ }
+ dpath_ptr = VM_MemLock( vmem_hand, (VM_PTR)(lp->pdl_q->pdl_head), VM_READ_ONLY ) ;
+
+ *proc_dir_only = dpath_ptr->proc_dir_only ;
+
+ /* Tell FSYS what the name space is for this Dir Path */
+ FS_SetNameSpace( lp->curr_fsys, dpath_ptr->name_space );
+
+ error = FS_ChangeDir( lp->curr_fsys,
+ (CHAR_PTR)dpath_ptr->path,
+ dpath_ptr->psize ) ;
+
+ if ( error == SUCCESS ) {
+ getError = FS_GetCurrentDDB( lp->curr_fsys, lp->curr_blk ) ;
+ } else {
+ getError = SUCCESS;
+ }
+
+
+ vm_temp = dpath_ptr->next ;
+ VM_MemUnLock( vmem_hand, (VM_PTR)(lp->pdl_q->pdl_head ) ) ;
+
+ VM_Free( vmem_hand, (VM_PTR)(lp->pdl_q->pdl_head ) ) ;
+
+ lp->pdl_q->pdl_head = (VOID_PTR)vm_temp ;
+
+ if ( (error == SUCCESS) && (getError == SUCCESS) ) {
+ *blk_ptr = lp->curr_blk ;
+ break ;
+
+ } else {
+ if ( getError != SUCCESS ) {
+ LP_MsgError( lp->lis_ptr->pid,
+ lp->lis_ptr->curr_bsd_ptr,
+ lp->curr_fsys,
+ &lp->tpos,
+ LP_ACCESS_DENIED_ERROR,
+ lp->curr_blk,
+ NULL,
+ 0L );
+ }
+ error = SUCCESS ;
+ }
+
+ }
+
+ if (lp->pdl_q->pdl_head != NULL ) {
+ dpath_ptr = VM_MemLock( vmem_hand, (VM_PTR)(lp->pdl_q->pdl_head), VM_READ_WRITE ) ;
+
+ dpath_ptr->prev = (VM_PTR)NULL ;
+ VM_MemUnLock( vmem_hand, (VM_PTR)(lp->pdl_q->pdl_head ) ) ;
+ }
+
+ if( error != SUCCESS ) {
+ LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr,
+ lp->curr_fsys, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+ }
+
+ return error ;
+}
+/**/
+/**
+
+ Name: LP_ClearPDL()
+
+ Description: this routine pulls all the DIR_PATHs off of the
+ pdl queue.
+
+ Modified: 7/14/1989
+
+ Returns: none
+
+ Notes: na
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID LP_ClearPDL(
+register LP_ENV_PTR lp )
+{
+ VM_PTR vm_dpath_ptr;
+ VM_PTR vm_temp;
+ DIR_PATH_PTR dpath_ptr ;
+ VM_HDL vmem_hand ;
+
+ if ( lp->pdl_q != NULL ) {
+ vmem_hand = lp->pdl_q->vm_hdl ;
+ vm_dpath_ptr = (VM_PTR)(lp->pdl_q->pdl_head);
+
+ while( vm_dpath_ptr != (VM_PTR)NULL ) {
+ dpath_ptr = VM_MemLock( vmem_hand, vm_dpath_ptr, VM_READ_ONLY ) ;
+ vm_temp = dpath_ptr->next;
+ VM_MemUnLock( vmem_hand, vm_dpath_ptr ) ;
+ VM_Free( vmem_hand, vm_dpath_ptr ) ;
+ vm_dpath_ptr = vm_temp;
+ }
+
+ free( lp->pdl_q ) ;
+ lp->pdl_q = NULL ;
+ }
+
+ return ;
+}
+
+
+static INT16 LP_InitPDL(
+LP_ENV_PTR lp )
+{
+ FSE_PTR fse ;
+ BOOLEAN first_include = TRUE ;
+ INT16 error = SUCCESS ;
+ CHAR_PTR path ;
+ INT8_PTR bp_path ;
+ INT16 psize ;
+ INT16 cchpsize ;
+
+ fse = BSD_GetFirstFSE( lp->lis_ptr->curr_bsd_ptr ) ;
+
+ while( !error && ( fse != NULL ) ) {
+
+ if ( FSE_GetOperType( fse ) == INCLUDE ) {
+
+ if ( first_include ) {
+ error = LP_AddADir( lp, TEXT(""), (UINT16)sizeof(CHAR), TRUE ) ;
+ first_include = FALSE ;
+ if ( error ) {
+ break ;
+ }
+ }
+
+ FSE_GetPath( fse, &bp_path, &psize ) ;
+ path = (CHAR_PTR)bp_path ;
+
+ error = LP_AddADir( lp, path, psize, FALSE ) ;
+
+ cchpsize = psize / sizeof(CHAR) ;
+
+ while ( (cchpsize > 0) && !error ) {
+ for ( cchpsize-=2 ;
+ (cchpsize > 0) && (path[cchpsize] != '\0');
+ cchpsize -- ) ;
+
+ if ( cchpsize > 0 ) {
+ error = LP_AddADir( lp,
+ path,
+ (INT16)( sizeof(CHAR) * (cchpsize + 1)),
+ TRUE ) ;
+ }
+ }
+ }
+
+ fse = BSD_GetNextFSE( fse ) ;
+ }
+
+ return error ;
+}
+/**/
+/**
+
+ Name: LP_AddADir()
+
+ Description: this routine adds a directory to the pdl,
+ checking for duplicates, inserts it in
+ inserts in the appropriate location.
+
+ Modified: 7/14/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+BOOLEAN LP_AddADir(
+LP_ENV_PTR lp,
+CHAR_PTR path,
+INT16 size,
+BOOLEAN proc_dir_only )
+{
+ VM_PTR vm_pdl_elem ;
+ VM_PTR vm_prev_pdl_elem ;
+ DIR_PATH_PTR pdl_elem ;
+ DIR_PATH_PTR prev_pdl_elem ;
+ DIR_PATH_PTR new_dir_ptr ;
+ VM_PTR vm_new_dir_ptr ;
+ INT16 ret_val = SUCCESS ;
+ INT16 location ;
+ BOOLEAN done = FALSE ;
+ VM_HDL vmem_hand ;
+ DIR_PATH_PTR last_elem ;
+
+/**
+*** Open the VM manager
+***
+**/
+
+ if ( lp->pdl_q == NULL ) {
+
+ lp->pdl_q = malloc( sizeof( *(lp->pdl_q) ) ) ;
+
+ if ( lp->pdl_q != NULL ) {
+
+ lp->pdl_q->pdl_head = NULL ;
+ lp->pdl_q->vm_hdl = lp->lis_ptr->vmem_hand ;
+ lp->pdl_q->vm_last_elem = NULL ;
+
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+ }
+
+ vmem_hand = lp->pdl_q->vm_hdl ;
+
+/**
+*** now create the new node
+***
+**/
+ if ( ret_val == SUCCESS ) {
+ if ( size == 0 ) {
+ size = FS_SizeofOSPathInDDB( lp->curr_fsys, lp->curr_blk ) ;
+ }
+
+ vm_new_dir_ptr = VM_Alloc( vmem_hand, (INT16)( sizeof(DIR_PATH) + size ) ) ;
+
+ if ( vm_new_dir_ptr == (VM_PTR)NULL ) {
+ ret_val = OUT_OF_MEMORY ;
+
+ } else {
+
+ new_dir_ptr = VM_MemLock( vmem_hand, vm_new_dir_ptr, VM_READ_WRITE ) ;
+ }
+ }
+
+ if ( ret_val == SUCCESS ) {
+
+ new_dir_ptr->next = new_dir_ptr->prev = (VM_PTR)NULL ;
+ new_dir_ptr->name_space = 0;
+ new_dir_ptr->psize = size ;
+ new_dir_ptr->proc_dir_only = proc_dir_only ;
+
+ if ( path == NULL ) {
+ FS_GetOSPathFromDDB( lp->curr_fsys, lp->curr_blk, (CHAR_PTR)new_dir_ptr->path ) ;
+ /* Save the name space for this Dir Path */
+ new_dir_ptr->name_space = FS_GetNameSpaceFromDBLK( lp->curr_blk );
+ } else {
+ memcpy( new_dir_ptr->path, path, size ) ;
+ }
+
+ path = (CHAR_PTR)new_dir_ptr->path ;
+
+ } else {
+
+ done = TRUE ;
+ }
+
+/**
+*** Enqueue the new node
+***
+**/
+ if ( ret_val == SUCCESS ) {
+
+ vm_pdl_elem = (VM_PTR)(lp->pdl_q->pdl_head) ;
+ vm_prev_pdl_elem = (VM_PTR)NULL ;
+
+ //
+ // if new item is > last item start at last item instead
+ // of first item.
+ //
+
+ if ( lp->pdl_q->vm_last_elem != NULL ) {
+
+ last_elem = VM_MemLock( vmem_hand,
+ (VM_PTR)(lp->pdl_q->vm_last_elem), VM_READ_WRITE ) ;
+
+ location = LP_PathComp( last_elem->path, last_elem->psize, (INT8_PTR)path, size ) ;
+
+ if ( location != PATH_AFTER ) {
+ vm_pdl_elem = (VM_PTR)lp->pdl_q->vm_last_elem ;
+ vm_prev_pdl_elem = last_elem->prev ;
+ }
+
+ VM_MemUnLock( vmem_hand, (VM_PTR)(lp->pdl_q->vm_last_elem) ) ;
+
+ }
+
+
+ while( !done ) {
+
+ ThreadSwitch() ;
+
+ if ( vm_pdl_elem == (VM_PTR)NULL ) {
+
+ if ( vm_prev_pdl_elem == (VM_PTR)NULL ) {
+ lp->pdl_q->pdl_head = (VOID_PTR)vm_new_dir_ptr ;
+
+ } else {
+ new_dir_ptr->prev = vm_prev_pdl_elem ;
+
+ prev_pdl_elem = VM_MemLock( vmem_hand, vm_prev_pdl_elem, VM_READ_WRITE ) ;
+ prev_pdl_elem->next = vm_new_dir_ptr ;
+
+ VM_MemUnLock( vmem_hand, vm_prev_pdl_elem ) ;
+ }
+
+ VM_MemUnLock( vmem_hand, vm_new_dir_ptr ) ;
+
+ break ;
+
+ } else {
+
+ pdl_elem = VM_MemLock( vmem_hand, vm_pdl_elem, VM_READ_WRITE ) ;
+
+ location = LP_PathComp( pdl_elem->path, pdl_elem->psize, (INT8_PTR)path, size ) ;
+
+ if( location == PATH_EQUAL ) {
+
+ if ( !proc_dir_only ) {
+ pdl_elem->proc_dir_only = FALSE ;
+ }
+ /*
+ We need the name space for the Dir Path in
+ the DBLK, not the path for the FSL!
+ */
+ pdl_elem->name_space = new_dir_ptr->name_space;
+
+ VM_MemUnLock( vmem_hand, vm_pdl_elem ) ;
+ VM_MemUnLock( vmem_hand, vm_new_dir_ptr ) ;
+ VM_Free ( vmem_hand, vm_new_dir_ptr ) ;
+ vm_new_dir_ptr = (VM_PTR)NULL ;
+
+ break ;
+
+ }else if( location == PATH_AFTER ) {
+
+ new_dir_ptr->next = vm_pdl_elem ;
+ new_dir_ptr->prev = pdl_elem->prev ;
+
+ pdl_elem->prev = vm_new_dir_ptr ;
+
+ if ( new_dir_ptr->prev != (VM_PTR)NULL ) {
+
+
+ prev_pdl_elem = VM_MemLock( vmem_hand, new_dir_ptr->prev,
+ VM_READ_WRITE ) ;
+
+ prev_pdl_elem->next = vm_new_dir_ptr ;
+
+ VM_MemUnLock( vmem_hand, new_dir_ptr->prev ) ;
+
+ } else {
+ lp->pdl_q->pdl_head = (VOID_PTR)vm_new_dir_ptr ;
+ }
+
+ VM_MemUnLock( vmem_hand, vm_pdl_elem ) ;
+
+ VM_MemUnLock( vmem_hand, vm_new_dir_ptr ) ;
+
+ break ;
+
+ } else {
+ vm_prev_pdl_elem = vm_pdl_elem ;
+ vm_pdl_elem = pdl_elem->next ;
+
+ if ( vm_prev_pdl_elem != (VM_PTR)NULL ) {
+ VM_MemUnLock( vmem_hand, vm_prev_pdl_elem ) ;
+ }
+ }
+ }
+ }
+ }
+ if ( vm_new_dir_ptr != (VM_PTR)NULL ) {
+ lp->pdl_q->vm_last_elem = (VOID_PTR)vm_new_dir_ptr ;
+ }
+
+ if ( ret_val != SUCCESS ) {
+ LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+ LP_ClearPDL( lp ) ;
+ }
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: LP_PathComp()
+
+ Desription: this routine compares two directory paths, and returns back whether they are equal,
+ less than, or greater than each other.
+
+ Modified: 7/14/1989
+
+ Returns: -1 is p1 is less than p2, 0 if equal, 1 if greater than
+
+ Notes: the path is a special format as follows:
+
+ \0[dir_spec]@
+
+ where:
+
+ dir_spec: directory_name\0
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_PathComp(
+INT8_PTR p1,
+INT16 s1,
+INT8_PTR p2,
+INT16 s2 )
+{
+ INT16 result ;
+
+ result = (INT16)memicmp( p1, p2, ( ( s1 < s2 ) ? s1 : s2 ) ) ;
+
+ if ( result > 0 ) {
+ result = PATH_AFTER ;
+ } else if ( result < 0 ) {
+ result = PATH_BEFORE ;
+ } else {
+ result = PATH_EQUAL ;
+ }
+
+ if ( ( result == PATH_EQUAL ) && ( s1 != s2 ) ) {
+ result = (INT16)(( s1 > s2 ) ? PATH_AFTER : PATH_BEFORE) ;
+ }
+
+ return( result ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/gtnxttpe.c b/private/utils/ntbackup/src/gtnxttpe.c
new file mode 100644
index 000000000..0deae89d7
--- /dev/null
+++ b/private/utils/ntbackup/src/gtnxttpe.c
@@ -0,0 +1,1021 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: gtnxttpe.c
+
+ Date Updated: 5/22/1991 16:32:44
+
+ Description: this file contains the getnext routine
+ for Restore and Verify operations.
+
+
+ $Log: M:/LOGFILES/GTNXTTPE.C_V $
+
+ Rev 1.39.2.3 19 Jan 1994 12:49:56 BARRY
+Suppress warnings
+
+ Rev 1.39.2.2 11 Jan 1994 13:45:36 GREGG
+Changed asserts to mscasserts and fixed the code to deal with it.
+
+ Rev 1.39.2.1 15 Dec 1993 17:52:38 DON
+Save the DDB before we modify it. No files will match if we don't
+
+ Rev 1.39.2.0 01 Dec 1993 13:20:58 STEVEN
+Complete DBLK loop was not working correctly
+
+ Rev 1.39 08 Apr 1993 14:24:02 MIKEP
+Fix to remove assert that can now happen that QTC catalogs allow the
+root directory to be in them twice.
+
+
+ Rev 1.38 08 Mar 1993 18:32:26 DON
+Update for setting target ddb to allow redirected single file restore
+
+ Rev 1.37 14 Dec 1992 13:06:12 STEVEN
+failing on empty dirs
+
+ Rev 1.36 07 Dec 1992 14:18:12 STEVEN
+updates from msoft
+
+ Rev 1.35 24 Nov 1992 16:39:38 STEVEN
+fix loose name structures
+
+ Rev 1.34 04 Nov 1992 09:28:58 STEVEN
+fix initial receive
+
+ Rev 1.33 03 Nov 1992 10:09:10 STEVEN
+change the way we skip data
+
+ Rev 1.32 06 Oct 1992 13:23:52 DAVEV
+Unicode strlen verification
+
+ Rev 1.31 17 Sep 1992 09:26:42 STEVEN
+update for stream info
+
+ Rev 1.30 10 Sep 1992 09:30:18 STEVEN
+fix bugs in restore
+
+ Rev 1.29 23 Jul 1992 16:43:58 STEVEN
+fix warnings
+
+ Rev 1.28 23 Jul 1992 12:02:04 STEVEN
+fix warnings
+
+ Rev 1.27 09 Jul 1992 13:59:34 STEVEN
+BE_Unicode updates
+
+ Rev 1.26 09 Jun 1992 16:47:02 STEVEN
+was comparing aginst wrong block
+
+ Rev 1.25 27 May 1992 15:08:18 TIMN
+Fixed FFR_SUBS path compare
+
+ Rev 1.24 21 May 1992 17:18:06 TIMN
+Converted CHARs to INT8, str to mem
+
+ Rev 1.23 13 May 1992 11:54:12 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.22 05 May 1992 17:19:12 STEVEN
+fixed typos and misc bugs
+
+ Rev 1.21 30 Apr 1992 16:32:16 BARRY
+Fixed setting of path in FDB.
+
+ Rev 1.20 16 Mar 1992 16:20:26 STEVEN
+added support to release DBLK for 40 format
+
+ Rev 1.19 13 Mar 1992 09:09:56 STEVEN
+40 tape format
+
+ Rev 1.18 11 Mar 1992 14:39:08 STEVEN
+was not properly restoring empty directories
+
+ Rev 1.17 16 Jan 1992 15:11:36 STEVEN
+fix warnings for WIN32
+
+ Rev 1.16 22 Oct 1991 15:44:02 STEVEN
+skip data for empty dir if process elements only
+
+ Rev 1.15 14 Oct 1991 11:31:08 STEVEN
+was trying to set path in FDB ?!?!
+
+ Rev 1.14 25 Sep 1991 20:42:54 GREGG
+Steve fixed read problem when last dir processed is empty.
+
+ Rev 1.13 04 Sep 1991 17:06:22 CARLS
+was appending root to path - bad idea
+
+ Rev 1.12 03 Sep 1991 15:36:12 CARLS
+ffr_last_fse was set to NULL before the end of operation
+
+ Rev 1.11 27 Aug 1991 17:28:34 STEVEN
+added BSD target dir support
+
+ Rev 1.10 27 Aug 1991 13:35:54 STEVEN
+would stop after one DDB
+
+ Rev 1.9 23 Aug 1991 16:17:44 STEVEN
+FFR error TRAP D ffr_last_fse uninitialized
+
+ Rev 1.8 27 Jun 1991 08:44:10 STEVEN
+fix return when LP_Finished called
+
+ Rev 1.7 21 Jun 1991 13:50:40 STEVEN
+new config unit
+
+ Rev 1.6 13 Jun 1991 15:23:24 STEVEN
+added support for ALL versions
+
+ Rev 1.5 11 Jun 1991 12:56:24 STEVEN
+LBAs now in virtual memory
+
+ Rev 1.4 30 May 1991 09:13:46 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.3 24 May 1991 14:55:38 STEVEN
+complete changes for new getnext
+
+ Rev 1.2 23 May 1991 13:07:42 STEVEN
+Added New function headers
+
+ Rev 1.1 23 May 1991 12:52:18 STEVEN
+ReDesigned Target object processing
+
+ Rev 1.0 09 May 1991 13:39:48 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <string.h>
+#include <assert.h>
+#include "stdtypes.h"
+#include "std_err.h"
+#include "msassert.h"
+#include "tbe_err.h"
+#include "tbe_defs.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "beconfig.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "queues.h"
+#include "stdwcs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "get_next.h"
+#include "be_debug.h"
+
+/***
+IDB - Image descriptor block
+ This data block contains a DOS disk image backup.
+DDB - Directory descriptor block
+ This data block contains a new directory path.
+FDB - File descriptor block
+ This data block contains a file in the current directory.
+CFDB - Corrupt file descriptor block
+ The previous data block was a file and was corrupt.
+***/
+
+#define FFR_NO_QUEUE 0
+#define FFR_POP 1
+#define FFR_SINGLE 2
+#define FFR_MULTI 3
+#define FFR_SUBS 4
+
+
+/****/
+static INT16 Get_an_FFR_DBLK( LP_ENV_PTR, INT16_PTR, FSE_PTR *, BOOLEAN_PTR );
+static INT16 LP_GetTheObject( LP_ENV_PTR lp, FSE_PTR *fse, BOOLEAN *match_val );
+static VOID LP_BuildTargetPath( LP_ENV_PTR lp, DBLK_PTR *dblk, BSD_PTR bsd, FSE_PTR fse ) ;
+static VOID ModifyFDB( LP_ENV_PTR lp, FSE_PTR fse, DBLK_PTR dblk ) ;
+static VOID ModifyDDB( LP_ENV_PTR lp, FSE_PTR fse, DBLK_PTR dblk ) ;
+static VOID ModifyDDBRoot( LP_ENV_PTR lp, CHAR_PTR path, INT16 psize, DBLK_PTR dblk ) ;
+static VOID CreateUniqueName( LP_ENV_PTR lp, DBLK_PTR dblk ) ;
+/**/
+/**
+
+ Name: LP_GetNextTPEBlock()
+
+ Description: this routine calls the tape
+
+ Modified: 7/18/1989
+
+ Returns: tape backup engine error
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_GetNextTPEBlock(
+LP_ENV_PTR lp,
+DBLK_PTR *blk_ptr_ptr )
+{
+ INT16 error ;
+ DBLK_PTR temp_ptr ;
+ FSE_PTR fse_ptr ;
+ BOOLEAN end_of_lba = FALSE;
+ UINT32 attrib ;
+ INT16 match ;
+ BOOLEAN block_skipped = FALSE ;
+ BSD_PTR bsd_ptr;
+ FSYS_HAND fsh ;
+ UINT32 pid ;
+ BOOLEAN object_is_special ;
+ BE_CFG_PTR cfg ;
+
+ fsh = lp->curr_fsys ;
+ bsd_ptr = lp->lis_ptr->curr_bsd_ptr ;
+ pid = lp->lis_ptr->pid ;
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+ *blk_ptr_ptr = NULL ;
+
+ if( lp->rr.tf_message == TRR_END ) {
+ return NO_ERR ;
+ }
+
+ do {
+ *blk_ptr_ptr = NULL ;
+
+ /*** when we hit a new directory, we have to wait to see
+ if there are files in it before we restore it. By
+ then we have two blocks that need to be sent, the
+ directory and the file. So we send the directory
+ and queue up the file to be sent here. **/
+
+ if( lp->send_saved_block ) {
+
+ lp->send_saved_block = FALSE ;
+ lp->ignore_data_for_ddb = FALSE ;
+ *blk_ptr_ptr = lp->curr_blk ;
+ return NO_ERR ;
+ }
+
+ /** We have two data areas for holding blocks, one where
+ we throw new blocks and one which holds the directory
+ block for the current directory. If we got a new
+ directory block in our temp area, then swap the pointers
+ and make it our directory block. **/
+
+ if( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) {
+
+ /** We have to release the old directory before we
+ can release our pointer to it. **/
+
+ if ( FS_GetBlockType( lp->curr_ddb ) == DDB_ID ) {
+ FS_ReleaseDBLK( fsh, lp->curr_ddb ) ;
+ }
+
+ temp_ptr = lp->curr_ddb ;
+ lp->curr_ddb = lp->curr_blk ;
+ lp->curr_blk = temp_ptr ;
+
+ }
+
+ /** get a new dblk from tape **/
+
+ error = Get_an_FFR_DBLK( lp, &match, &fse_ptr, &end_of_lba );
+ if ( error ) {
+ LP_FinishedOper( lp ) ;
+ *blk_ptr_ptr = NULL ;
+ return error ;
+ }
+
+ if ( end_of_lba == TRUE ) {
+ error = LP_FinishedOper( lp ) ;
+ *blk_ptr_ptr = NULL ;
+ return error ;
+ }
+
+
+ /** see if we hit end of tape **/
+
+ if( lp->rr.tf_message == TRR_END ) {
+ return NO_ERR ;
+ }
+
+ if( error == NO_ERR ) {
+ *blk_ptr_ptr = lp->curr_blk ;
+ }
+
+ if( error == NO_ERR ) {
+
+ /** set up pointers for matching **/
+
+
+ object_is_special = (INT16)(match == BSD_SPECIAL_OBJECT) ;
+
+ if ( ( match == BSD_SPECIAL_OBJECT ) && BSD_GetProcSpecialFlg( bsd_ptr ) ) {
+ match = BSD_PROCESS_OBJECT ;
+ }
+
+ switch( match ) {
+
+ /** our list of desired files is empty **/
+
+ case FSL_EMPTY:
+ error = LP_FinishedOper( lp ) ;
+ *blk_ptr_ptr = NULL ;
+ return error ;
+
+ /** stuff we don't want **/
+
+ case BSD_SKIP_OBJECT:
+ case BSD_SPECIAL_OBJECT:
+
+ LP_SkipData( lp ) ;
+ error = NO_ERR ;
+ block_skipped = TRUE ;
+ break ;
+
+
+ case BSD_PROCESS_ELEMENTS:
+
+ attrib = FS_GetAttribFromDBLK( fsh, lp->curr_blk ) ;
+
+ /** skip it if its an empty dir and we aren't proc'ing them **/
+ if( !(attrib & DIR_EMPTY_BIT) || !BEC_GetProcEmptyFlag( cfg ) ) {
+
+
+ LP_SkipData( lp ) ;
+ lp->ignore_data_for_ddb = TRUE ;
+
+ lp->proc_curr_dir = TRUE ;
+ error = NO_ERR ;
+ break ;
+
+ } else {
+ lp->proc_curr_dir = FALSE ;
+ lp->ignore_data_for_ddb = FALSE ;
+ }
+
+ /* fall through if we want it */
+
+ case BSD_PROCESS_OBJECT:
+
+ if( lp->proc_curr_dir ) {
+ lp->proc_curr_dir = FALSE ;
+ lp->send_saved_block = TRUE ;
+ *blk_ptr_ptr = lp->curr_ddb ;
+ *lp->saved_ddb = *lp->curr_ddb ;
+ }
+
+ if ( fse_ptr != NULL ) {
+
+ LP_BuildTargetPath( lp, blk_ptr_ptr, bsd_ptr, fse_ptr ) ;
+
+ if ( FS_GetBlockType( lp->curr_blk ) == FDB_ID ) {
+
+ if ( FSE_GetSelectType( fse_ptr ) == SINGLE_FILE_SELECTION ) {
+ FSE_MarkDeleted( fse_ptr ) ;
+ }
+ }
+ }
+
+ return( NO_ERR );
+
+ default:
+ msassert( FALSE ) ;
+ break ;
+ }
+ }
+
+ } while( error == NO_ERR ) ;
+
+ return( error ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: Get_an_FFR_DBLK( lp )
+
+ Description: This routine calls the tape and attempts to do a
+ Fast File Restore by skipping over unneeded
+ blocks. There's a queue of items to be processed.
+ Each item includes a tape location, and a type.
+ The type indicates if it is a single or multi
+ item restore. The tape locations are all
+ sorted in increasing order.
+
+
+ Modified: 7/18/1989
+
+ Returns: tape backup engine error
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 Get_an_FFR_DBLK(
+ LP_ENV_PTR lp, /* I - Loop Environment struct to access world */
+ INT16_PTR match_val, /* O - Specifies how the object should be proc */
+ FSE_PTR *fse_ptr, /* O - The FSE that was matched */
+ BOOLEAN_PTR end_of_lba ) /* O - Return TRUE if the lba queue is empty */
+{
+ INT16 error;
+ UINT32 current_lba;
+ INT8_PTR dirptr;
+ INT16 cb_size;
+ CHAR_PTR newpath = (CHAR_PTR)lp->newpath_buf ;
+ INT16 cb_newpath_size ;
+ BSD_PTR bsd ;
+ BOOLEAN finished = FALSE ;
+ BOOLEAN obj_skipped = FALSE ;
+
+ /****
+
+ lp->ffr_state
+
+ NO_QUEUE - no queue, do sequential block reads
+ POP - current operation is over pop queue
+ SINGLE - current operation is a single file restore
+ MULTI - current operation is a multi file restore
+ SUBS - current operation searches subdirectories
+
+ ****/
+
+ bsd = lp->lis_ptr->curr_bsd_ptr ;
+
+ if ( lp->ffr_inited != TRUE ) {
+
+ if ( BSD_GetFirstLBA( bsd, &lp->ffr_last_lba ) == SUCCESS ) {
+ lp->ffr_state = FFR_POP ;
+ } else {
+ lp->ffr_state = FFR_NO_QUEUE;
+ }
+
+ lp->ffr_inited = TRUE;
+ }
+
+ /** grab next sequential block **/
+
+ while ( !finished ) {
+ finished = TRUE ;
+ lp->rr.lp_message = LRR_STUFF;
+
+ error = LP_GetTheObject( lp, fse_ptr, match_val ) ;
+ if ( *fse_ptr != NULL ) {
+ lp->ffr_last_fse = *fse_ptr ;
+ }
+
+ if ( error || lp->rr.tf_message == TRR_END ) {
+ return error ;
+ }
+
+ switch ( lp->ffr_state ) {
+
+ case FFR_NO_QUEUE:
+ if ( match_val == BSD_SKIP_OBJECT ) {
+ obj_skipped = TRUE ;
+ finished = FALSE ;
+ }
+ if ( FS_GetBlockType( lp->curr_blk ) == CFDB_ID ) {
+ if ( obj_skipped ) {
+ LP_SkipData( lp ) ;
+ finished = FALSE ;
+ }
+ }
+
+ break;
+
+ case FFR_SINGLE:
+ /** ex. \FRED\PAUL.C **/
+
+ if ( FS_GetBlockType( lp->curr_blk ) != CFDB_ID ) {
+ lp->ffr_state = FFR_POP;
+ }
+ break;
+
+ case FFR_MULTI:
+ /** ex. \FRED\PAUL.* **/
+
+ if ( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) {
+ lp->ffr_state = FFR_POP;
+
+ } else if ( match_val == BSD_SKIP_OBJECT ) {
+ obj_skipped = TRUE ;
+ finished = FALSE ;
+
+ } else if ( FS_GetBlockType( lp->curr_blk ) == CFDB_ID ) {
+ if ( obj_skipped ) {
+ finished = FALSE ;
+ }
+ }
+
+ break;
+
+ case FFR_SUBS:
+ /** ex. \FRED\PAUL.C /S **/
+ /** ex. \FRED\PAUL.* /S **/
+
+ if ( FS_GetBlockType( lp->curr_blk ) == DDB_ID ) {
+
+ /* compare root path of lp->curr_blk with fse */
+
+ FSE_GetPath( lp->ffr_last_fse, &dirptr, &cb_size );
+ cb_newpath_size = FS_SizeofOSPathInDDB( lp->curr_fsys, lp->curr_blk ) ;
+ if ( cb_newpath_size > lp->newpath_buf_sz ) {
+ lp->newpath_buf = realloc( lp->newpath_buf, cb_newpath_size ) ;
+ lp->newpath_buf_sz = cb_newpath_size ;
+ }
+ if ( lp->newpath_buf == NULL ) {
+ return OUT_OF_MEMORY ;
+ } else {
+ newpath = (CHAR_PTR)lp->newpath_buf ;
+ }
+
+ FS_GetOSPathFromDDB( lp->curr_fsys,
+ lp->curr_blk,
+ (CHAR_PTR)newpath );
+
+ if ( cb_newpath_size < cb_size ) {
+ cb_size = cb_newpath_size ;
+ }
+
+ if ( ( cb_size != sizeof (CHAR) ) &&
+ memoryicmp( dirptr, cb_size, newpath, cb_size ) ) {
+
+ lp->ffr_state = FFR_POP;
+ }
+ }
+ break;
+
+ case FFR_POP:
+ break;
+
+ default: msassert( FALSE );
+ }
+ }
+
+ if ( lp->ffr_state == FFR_POP ) {
+
+ current_lba = FS_ViewLBAinDBLK( lp->curr_blk ) ;
+
+ /** pop queue until unpassed request shows up **/
+
+ while ( LBA_GetLBA( &lp->ffr_last_lba ) < current_lba ) {
+
+ if ( BSD_GetNextLBA( bsd, &lp->ffr_last_lba ) != SUCCESS ) {
+ *end_of_lba = TRUE;
+ return( NO_ERR );
+ }
+ }
+
+ /** jump to right place on tape and grab a block **/
+
+ if ( current_lba != LBA_GetLBA( &lp->ffr_last_lba ) ) {
+
+ lp->rr.tape_loc.tape_seq = LBA_GetTapeNum( &lp->ffr_last_lba );
+ lp->rr.tape_loc.lba = LBA_GetLBA( &lp->ffr_last_lba );
+ lp->rr.lp_message = LRR_GOTO_LBA;
+ error = LP_GetTheObject( lp, &lp->ffr_last_fse, match_val ) ;
+ *fse_ptr = lp->ffr_last_fse ;
+
+ /* if there is an LBA the object better match */
+ }
+
+ /** determine new current status **/
+
+ if ( LBA_GetType( &lp->ffr_last_lba ) == LBA_SINGLE_OBJECT ) {
+ lp->ffr_state = FFR_SINGLE;
+
+ } else if ( LBA_GetType( &lp->ffr_last_lba ) == LBA_BEGIN_POSITION ) {
+
+ if ( (*fse_ptr != NULL) && FSE_GetIncSubFlag( lp->ffr_last_fse ) ) {
+ lp->ffr_state = FFR_SUBS;
+
+ } else {
+ lp->ffr_state = FFR_MULTI;
+ }
+
+ }
+ }
+
+ return( error );
+}
+
+/**/
+/**
+
+ Name: LP_GetTheObject()
+
+ Description: This function Calls to get a DBLK then calls the
+ BSD unit to match the DBLK.
+
+
+ Modified: 5/23/1991 9:55:59
+
+ Returns: Any error returned while reading DBLK.
+
+ Notes: If the Receive failed then the match_val is not set.
+
+ Declaration:
+
+**/
+static INT16 LP_GetTheObject(
+LP_ENV_PTR lp,
+FSE_PTR *fse,
+BOOLEAN *match_val )
+{
+ DBLK_PTR fdb ;
+ DBLK_PTR ddb ;
+ INT16 error ;
+ UINT16 cb_size ;
+
+ *fse = NULL ;
+
+ FS_ReleaseDBLK( lp->curr_fsys, lp->curr_blk ) ;
+ error = LP_ReceiveDBLK( lp );
+
+ if ( error || lp->rr.tf_message == TRR_END ) {
+ return error ;
+ }
+
+ if ( FS_GetBlockType( lp->curr_blk ) == FDB_ID ) {
+ fdb = lp->curr_blk ;
+ ddb = lp->saved_ddb ;
+ } else {
+ fdb = NULL ;
+ ddb = lp->curr_blk ;
+ }
+
+ cb_size = 0 ;
+ while ( !FS_IsBlkComplete( lp->curr_fsys, lp->curr_blk ) ) {
+ LP_ReceiveData( lp, (UINT32)cb_size ) ;
+ cb_size = lp->rr.buff_size ;
+ FS_CompleteBlk( lp->curr_fsys, lp->curr_blk, lp->rr.buff_ptr, &cb_size, &lp->rr.stream ) ;
+ }
+
+ lp->initial_tape_buf_used = cb_size ;
+
+ *match_val = BSD_MatchObj( lp->lis_ptr->curr_bsd_ptr, fse,
+ lp->curr_fsys, ddb, fdb, FALSE ) ;
+
+ if ( *match_val == OUT_OF_MEMORY ) {
+ return OUT_OF_MEMORY ;
+ } else {
+ return SUCCESS ;
+ }
+
+}
+
+/**/
+/**
+
+ Name: LP_BuildTargetPath()
+
+ Description: This function uses the FSE passed in to set the
+ path & file name in the provided DBLK. This
+ function provides the Target Directory/File
+ functionality.
+
+ Modified: 5/23/1991 9:55:59
+
+ Returns: none
+
+ Notes:
+
+ Declaration:
+
+**/
+static VOID LP_BuildTargetPath(
+LP_ENV_PTR lp, /* I - handle of file system to use */
+DBLK_PTR *dblk, /*I/O- DBLK to modify - must be ddb */
+BSD_PTR bsd, /* I - bsd which may contain target info */
+FSE_PTR fse ) /* I - matched selector - contains target info */
+{
+ CHAR_PTR bsd_tgt_path ;
+ INT16 cb_bsd_tgt_psize ;
+
+ BSD_GetTargetInfo( bsd, &bsd_tgt_path, &cb_bsd_tgt_psize ) ;
+
+ if ( ( FS_GetBlockType( *dblk ) == DDB_ID ) &&
+ ( bsd_tgt_path != NULL ) ) {
+
+ // Save it before we modify it! Otherwise no files will match!
+ *lp->saved_ddb = **dblk ;
+ ModifyDDBRoot( lp, bsd_tgt_path, cb_bsd_tgt_psize, *dblk ) ;
+
+ } else {
+
+ if ( FS_GetBlockType( *dblk ) == DDB_ID ) {
+ *lp->saved_ddb = **dblk ;
+ }
+
+ if ( FSE_HasTargetInfo( fse ) || (lp->tgt_info != NULL) ) {
+
+ if ( FS_GetBlockType( *dblk ) == DDB_ID ) {
+
+ if ( FSE_HasTargetInfo( fse ) ) {
+ ModifyDDB( lp, fse, *dblk ) ;
+ lp->tgt_info = fse ;
+
+ } else {
+ lp->tgt_info = NULL ;
+ }
+
+ } else if ( FS_GetBlockType( *dblk ) == FDB_ID ) {
+
+ if ( FSE_HasTargetInfo( fse ) ) {
+ if ( lp->tgt_info != fse ) {
+
+ *lp->curr_ddb = *lp->saved_ddb ;
+ ModifyDDB( lp, fse, lp->curr_ddb ) ;
+
+ *dblk = lp->curr_ddb ;
+ lp->send_saved_block = TRUE ;
+ lp->tgt_info = fse ;
+ }
+
+ if ( FSE_GetSelectType( fse ) == SINGLE_FILE_SELECTION ) {
+ ModifyFDB( lp, fse, *dblk ) ;
+ }
+
+ } else if ( lp->tgt_info ) {
+ *lp->curr_ddb = *lp->saved_ddb ;
+ *dblk = lp->curr_ddb ;
+ lp->send_saved_block = TRUE ;
+ lp->tgt_info = NULL ;
+ }
+
+ if ( ( LBA_GetFileVer( &lp->ffr_last_lba ) != 0 ) &&
+ ( FS_GetBlockType( *dblk ) == FDB_ID ) ) {
+
+ CreateUniqueName( lp, *dblk ) ;
+ }
+ }
+ }
+ }
+}
+
+
+/**/
+/**
+
+ Name: ModifyDDBRoot()
+
+ Description: This function calls the file system to set the
+ path in a DDB.
+
+ Modified: 5/23/1991 9:55:59
+
+ Returns: none
+
+ Notes:
+
+ Declaration:
+
+**/
+static VOID ModifyDDBRoot(
+LP_ENV_PTR lp,
+CHAR_PTR path,
+INT16 psize, //size of string buffer in bytes incl NULL term
+DBLK_PTR dblk )
+{
+ CHAR new_path[1024] ;
+ INT16 cb_path_size ; //size of string buffer in bytes incl NULL term
+ INT16 cb_old_psize ; //size of string buffer in bytes incl NULL term
+ FSYS_HAND fsh ;
+
+ fsh = lp->curr_fsys ;
+
+ cb_path_size = psize ;
+
+ memcpy( new_path, path, psize ) ;
+
+ FS_GetPathFromDDB( fsh, dblk, &new_path[psize/sizeof (CHAR)] ) ;
+
+ cb_old_psize = FS_SizeofPathInDDB( fsh, dblk ) ;
+
+ if ( cb_old_psize > sizeof (CHAR) ) {
+ cb_path_size = cb_old_psize + psize ;
+ }
+
+ FS_SetPathInDDB( fsh, dblk, new_path, &cb_path_size ) ;
+
+}
+
+
+
+/**/
+/**
+
+ Name: ModifyDDB()
+
+ Description: This function calls the file system to set the
+ path in a DDB.
+
+ Modified: 5/23/1991 9:55:59
+
+ Returns: none
+
+ Notes:
+
+ Declaration:
+
+**/
+static VOID ModifyDDB(
+LP_ENV_PTR lp,
+FSE_PTR fse,
+DBLK_PTR dblk )
+{
+ CHAR new_path[1024] ;
+ INT16 cb_path_size ; //size of buffer in bytes
+ INT8_PTR fse_src_path ;
+ INT16 cb_fse_src_psize ; //size of buffer in bytes
+ INT8_PTR fse_dest_path ;
+ INT16 cb_fse_dest_psize ; //size of buffer in bytes
+ INT8_PTR fse_dest_fname ;
+ INT16 cb_fse_dest_fnsize ; //size of buffer in bytes
+ INT16 depth ;
+ INT16 i;
+ FSYS_HAND fsh ;
+
+ fsh = lp->curr_fsys ;
+
+ FSE_GetTargetInfo( fse, &fse_dest_path, &cb_fse_dest_psize,
+ &fse_dest_fname, &cb_fse_dest_fnsize ) ;
+
+ if( cb_fse_dest_psize ) {
+
+ if( cb_fse_dest_psize == sizeof (CHAR) ) {
+ cb_fse_dest_psize = 0 ;
+ }
+
+ FSE_GetPath( fse, &fse_src_path, &cb_fse_src_psize ) ;
+
+ if( cb_fse_src_psize == sizeof (CHAR) ) {
+ cb_fse_src_psize = 0 ;
+ }
+
+ depth = 0 ;
+ for( i = 0 ; i < (INT16)(cb_fse_src_psize / sizeof (CHAR)); i ++ ) {
+ if( fse_src_path[i] == TEXT('\0') ) {
+ depth++ ;
+ }
+ }
+
+ FS_GetPathFromDDB( fsh, dblk, new_path ) ;
+ cb_path_size = FS_SizeofPathInDDB( fsh, dblk ) ;
+
+ if( cb_path_size == sizeof (CHAR) ) {
+ cb_path_size = 0 ;
+ }
+
+
+ cb_fse_src_psize = 0 ;
+ while( depth ) {
+ if( new_path[ cb_fse_src_psize / sizeof (CHAR) ] == TEXT('\0') ) {
+ depth -- ;
+ }
+ cb_fse_src_psize += sizeof (CHAR);
+ }
+
+ memmove( new_path + cb_fse_dest_psize, new_path + cb_fse_src_psize, cb_path_size ) ;
+
+ memcpy( new_path, fse_dest_path, cb_fse_dest_psize ) ;
+
+ cb_path_size = cb_path_size - cb_fse_src_psize + cb_fse_dest_psize ;
+
+ if ( cb_path_size > 0 ) {
+
+ FS_SetPathInDDB( fsh, dblk, new_path, &cb_path_size ) ;
+ }
+ }
+
+ return ;
+
+}
+
+/**/
+/**
+
+ Name: ModifyFDB()
+
+ Description: This function calls the file system to set the
+ file name in a FDB.
+
+ Modified: 5/23/1991 9:55:59
+
+ Returns: none
+
+ Notes:
+
+ Declaration:
+
+**/
+static VOID ModifyFDB(
+LP_ENV_PTR lp,
+FSE_PTR fse,
+DBLK_PTR dblk )
+{
+ CHAR_PTR fse_dest_path ;
+ INT16 cb_fse_dest_psize ;
+ CHAR_PTR fse_dest_fname ;
+ INT16 cb_fse_dest_fnsize ;
+ FSYS_HAND fsh ;
+
+ fsh = lp->curr_fsys ;
+
+ FSE_GetTargetInfo( fse, &fse_dest_path, &cb_fse_dest_psize, &fse_dest_fname, &cb_fse_dest_fnsize ) ;
+ if ( fse_dest_fname != NULL ) {
+ FS_SetFnameInFDB( fsh, dblk, fse_dest_fname, &cb_fse_dest_fnsize ) ;
+ }
+}
+
+
+/**/
+/**
+
+ Name: CreateUniqueName()
+
+ Description: This function calls the file system to set the
+ file name in a FDB. The new file name is created
+ form the file version number in the LBA.
+
+ Modified: 5/23/1991 9:55:59
+
+ Returns: none
+
+ Notes:
+
+ Declaration:
+
+**/
+
+static VOID CreateUniqueName(
+LP_ENV_PTR lp,
+DBLK_PTR dblk )
+{
+ CHAR fname[1024] ;
+ INT16 fnsize ;
+ CHAR ver_str[3] ;
+ LBA_ELEM_PTR lba ;
+ INT16 ver_num ;
+ FSYS_HAND fsh ;
+ CHAR_PTR p ;
+ INT16 cch_len ;
+
+ fsh = lp->curr_fsys ;
+ lba = &lp->ffr_last_lba ;
+
+ ver_num = LBA_GetFileVer( lba ) ;
+
+ if ( ver_num != 0 ) {
+
+ mscassert( ver_num < 0x100 ) ;
+
+ if( ver_num >= 0x100 ) {
+ ver_num = 0xFF ;
+ }
+
+ sprintf( ver_str, TEXT("%02X"), ver_num ) ;
+
+ FS_GetFnameFromFDB( fsh, dblk, fname ) ;
+
+ p = strchr(fname, TEXT('.') ) ;
+
+ if ( p == NULL ) {
+
+ cch_len = (INT16)strlen( fname ) ;
+ if ( cch_len < 7 ) {
+ strcat( fname, ver_str ) ;
+
+ } else {
+ strcpy( fname + 6, ver_str ) ;
+ }
+
+ } else {
+
+ cch_len = (INT16)((p - fname) / sizeof (CHAR)) ;
+ if ( cch_len < 7 ) {
+ memmove( p, p+2, strsize( p ) ) ;
+
+ fname[cch_len] = ver_str[0] ;
+ fname[cch_len + 1] = ver_str[1] ;
+
+ } else {
+ fname[cch_len - 2] = ver_str[0] ;
+ fname[cch_len - 1] = ver_str[1] ;
+ }
+ }
+
+ fnsize = strsize( fname ) ;
+
+ FS_SetFnameInFDB( fsh, dblk, fname, &fnsize ) ;
+ }
+}
diff --git a/private/utils/ntbackup/src/gui.c b/private/utils/ntbackup/src/gui.c
new file mode 100644
index 000000000..5f907064b
--- /dev/null
+++ b/private/utils/ntbackup/src/gui.c
@@ -0,0 +1,1750 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: gui.c
+
+ Description: This file contains the functions for initializing and
+ deinitializing the GUI subsystem.
+
+ $Log: G:\ui\logfiles\gui.c_v $
+
+ Rev 1.61.1.8 01 Mar 1994 20:08:34 STEVEN
+uincode bug with memcpy on strings
+
+ Rev 1.61.1.7 11 Feb 1994 16:38:16 GREGG
+Changed command line switch to avoid conflict (two starting /MEM).
+
+ Rev 1.61.1.6 24 Jan 1994 15:59:00 GREGG
+Added option to tell mem debugger not to trap when consistency check fails.
+
+ Rev 1.61.1.5 14 Dec 1993 13:19:20 MikeP
+fix losing the ini filename
+
+ Rev 1.61.1.4 11 Dec 1993 12:17:02 MikeP
+fix cmdline buffer size bug
+
+ Rev 1.61.1.3 03 Dec 1993 01:02:42 GREGG
+Added HW Comp cmd line option and ifdefed KEEPCATS for MSDEBUG only.
+
+ Rev 1.61.1.2 30 Nov 1993 19:09:24 TIMN
+Added cmdline /tape:x option to NTJ
+
+ Rev 1.61.1.1 13 Sep 1993 15:51:24 BARRY
+Moved check for missing tape until after the GUI init -- only done for MSOFT.
+
+ Rev 1.61.1.0 17 Aug 1993 12:35:56 BARRY
+Put TEXT macros around hard-coded strings.
+
+ Rev 1.61 02 Aug 1993 16:20:54 chrish
+CAYMAN EPR 0645: Added #ifndef to handle log file passed on the command line
+backup for Nostradamus.
+
+ Rev 1.60 29 Jul 1993 23:09:32 MIKEP
+remove mapi.h
+
+ Rev 1.59 23 Jul 1993 15:26:32 GLENN
+Using data path for log file if a full path is not specified.
+
+ Rev 1.58 21 Jul 1993 17:05:36 GLENN
+Clarified the cmd line stuff by adding named mixed and upper case command line strings.
+
+ Rev 1.57 20 Jul 1993 16:15:44 GLENN
+Added AlterCmdLine stuff over from BACKUP.C - removed callocs and placed vars on stack.
+
+ Rev 1.56 15 Jul 1993 17:20:24 GLENN
+Added support for pulling resources from RESLIB.DLL
+
+ Rev 1.55 29 Jun 1993 11:39:08 TIMN
+Fixed Alpha build error with gszTapeName
+
+ Rev 1.54 23 Jun 1993 09:14:50 GLENN
+Placed limit on command line tape name copy to the size of the string.
+
+ Rev 1.53 17 Jun 1993 13:32:04 CARLS
+added code to delete catalogs if DEMO
+
+ Rev 1.52 15 Jun 1993 13:21:44 DARRYLP
+More status monitor features
+
+ Rev 1.51 18 May 1993 14:53:52 GLENN
+Added extra delimiter to INI cmd line check.
+
+ Rev 1.50 04 May 1993 11:37:30 DARRYLP
+Replaced unwanted OEM_MSOFT defines with CAYMAN defines.
+
+ Rev 1.49 30 Apr 1993 15:55:16 GLENN
+Added INI command line support. Modularized the Status Monitor code.
+
+ Rev 1.48 28 Apr 1993 15:42:22 DARRYLP
+Corrected typo.
+
+ Rev 1.47 28 Apr 1993 12:02:52 DARRYLP
+Updates to GUI.C to allow string printing in CBEMON.DLL
+
+ Rev 1.46 27 Apr 1993 22:35:48 MIKEP
+ifdef status code so nostrad can build
+
+ Rev 1.45 27 Apr 1993 19:12:06 GLENN
+Fixed module wide variable naming inconsistancy. Removed dead space.
+
+ Rev 1.44 27 Apr 1993 16:08:54 DARRYLP
+Updated Status monitor functionality
+
+ Rev 1.43 19 Apr 1993 15:27:08 GLENN
+Added tape name command line option - case preserving.
+
+ Rev 1.42 08 Apr 1993 13:42:42 DARRYLP
+Changes for STAT_SetStatus call.
+
+ Rev 1.41 06 Apr 1993 12:02:46 DARRYLP
+Changes to allow screwy mips machine to build.
+
+ Rev 1.40 02 Apr 1993 11:08:12 DARRYLP
+Changed the LoadLibrary result comparision to make allowances for the
+screwy MIPS machine.
+
+ Rev 1.39 25 Mar 1993 14:51:58 DARRYLP
+Conditional compile fix for Nostradamus.
+
+ Rev 1.38 23 Mar 1993 15:52:14 DARRYLP
+Added DDE-DLL loading modules for the special MS request allowing remote
+monitoring. This should be transparent without the associated DLL.
+
+ Rev 1.37 07 Mar 1993 12:33:40 MIKEP
+add missing tape option
+
+ Rev 1.36 02 Mar 1993 11:55:52 MIKEP
+fix delete catalogs on exit
+
+ Rev 1.35 18 Feb 1993 12:12:04 BURT
+Changes for Cayman
+
+
+ Rev 1.34 20 Jan 1993 20:25:04 MIKEP
+remove /T? kludge for NT
+
+ Rev 1.33 23 Dec 1992 14:30:42 GLENN
+Added /NOSERVERS option.
+
+ Rev 1.32 05 Nov 1992 17:07:40 DAVEV
+fix ts
+
+ Rev 1.30 14 Oct 1992 15:50:44 GLENN
+Added /ZL debug logging command line support.
+
+ Rev 1.29 07 Oct 1992 15:09:46 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.28 06 Oct 1992 15:55:28 DARRYLP
+Added new WFW definition.
+
+ Rev 1.27 04 Oct 1992 19:37:42 DAVEV
+Unicode Awk pass
+
+ Rev 1.26 28 Sep 1992 16:26:08 GLENN
+ifdef's email includes.
+
+ Rev 1.25 22 Sep 1992 15:05:52 DARRYLP
+Add calls to determine the validity of WFW Email option.
+
+ Rev 1.24 08 Sep 1992 17:30:50 DARRYLP
+
+ Rev 1.23 08 Sep 1992 17:00:32 DARRYLP
+
+ Rev 1.22 04 Sep 1992 10:35:54 MIKEP
+ifdef last change
+
+ Rev 1.21 04 Sep 1992 10:33:16 MIKEP
+add support for picking tape drive to command line.
+
+ Rev 1.20 04 Aug 1992 10:04:52 MIKEP
+no cats flag
+
+ Rev 1.19 26 Jun 1992 15:52:38 DAVEV
+
+
+ Rev 1.18 29 May 1992 16:00:20 JOHNWT
+PCH updates
+
+ Rev 1.17 09 Apr 1992 11:34:34 GLENN
+Added support for exe/resource version stamping.
+
+ Rev 1.16 07 Apr 1992 15:40:30 GLENN
+Specified complete resource library path.
+
+ Rev 1.15 07 Apr 1992 10:20:06 GLENN
+Change to exe dir before loading library.
+
+ Rev 1.14 02 Apr 1992 15:25:52 GLENN
+NT doesn't want to pull resources from .DLL
+
+ Rev 1.13 30 Mar 1992 18:02:56 GLENN
+Added support for pulling resources from .DLL
+
+ Rev 1.12 26 Mar 1992 08:51:40 GLENN
+Updated.
+
+ Rev 1.11 24 Mar 1992 14:41:36 DAVEV
+OEM_MSOFT: Removed Servers windows and associated code
+
+ Rev 1.10 10 Mar 1992 16:48:12 GLENN
+Update.
+
+ Rev 1.9 09 Mar 1992 09:36:08 GLENN
+Added Easter Egg - red checkmark command line support.
+
+ Rev 1.8 03 Mar 1992 18:45:46 GLENN
+Removed setup exe path function and changed the three UI_Init calls to a single UI_InitIntl call.
+
+ Rev 1.7 08 Feb 1992 11:57:02 CARLS
+added call to UI_InitThousandChar
+
+ Rev 1.6 04 Feb 1992 13:36:26 GLENN
+Changed gb_exe_path to CDS_GetExePath().
+
+ Rev 1.5 10 Jan 1992 16:37:42 JOHNWT
+moved set idle text into WM_Init
+
+ Rev 1.4 07 Jan 1992 17:41:32 GLENN
+Moved debug command line checking to here
+
+ Rev 1.3 19 Dec 1991 15:25:52 GLENN
+Added windows.h
+
+ Rev 1.2 04 Dec 1991 18:44:36 GLENN
+Added UI_InitDate and time calls
+
+ Rev 1.1 27 Nov 1991 12:14:32 GLENN
+Clean-up.
+
+ Rev 1.0 20 Nov 1991 19:29:54 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#ifdef WFW
+#ifndef OEM_MSOFT
+ #include "mapinit.h"
+#endif
+#endif
+
+#ifdef OEM_EMS
+#include "ctl3d.h"
+BOOL mwf3dEnabled;
+#endif
+
+#define DDEMANG "CBEMON.DLL"
+#define SZ_DDEMANG "STAT_SetStatus"
+
+// TEMPORARY ?????
+
+BOOL gfRedChecks;
+BOOL gfMultiDrive;
+HTIMER mhStatusTimer = 0;
+
+
+#define MAX_COMMAND_LINE_SIZE 2048
+
+#define INITIAL_STRING_SIZE 1024
+#define MAX_NAME_SIZE 128
+
+HINSTANCE mwhLibInst;
+
+// PRIVATE FUNCTION PROTOTYPES
+
+static BOOL GUI_GetCmdLineSwitches ( LPSTR, LPSTR );
+static BOOL GUI_ValidateCmdLine( LPSTR ) ;
+static LPSTR GUI_AlterCmdLine ( LPSTR, LPSTR );
+static VOID parseblk( CHAR_PTR );
+
+static VOID MON_Init();
+static VOID MON_Deinit();
+static BOOL MON_FreeDDEManager();
+static BOOL MON_LoadDDEManager();
+static BOOL MON_CreateStringList();
+static INT MON_SetSize(LPSTR);
+static DWORD MON_StringToStatusBlock(LPSTR, LPSTR);
+
+static BOOL GUI_ValidAtoiResult( CHAR *pszChar, INT nTapeNumber ) ;
+static VOID GUI_ProcessQuotedString ( LPSTR,
+ LPSTR,
+ BOOLEAN * );
+
+
+
+
+
+/*****************************************************************************
+
+ Name: GUI_Init ()
+
+ Description: This funciton initializes the GUI.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+*****************************************************************************/
+
+BOOL GUI_Init (
+
+LPSTR lpszCmdLine,
+INT nCmdShow )
+
+{
+ CDS_PTR pCDS = CDS_GetPerm ();
+ CHAR szMixedCmdLine[ MAX_COMMAND_LINE_SIZE ];
+ CHAR szUpperCmdLine[ MAX_COMMAND_LINE_SIZE ];
+
+ if ( lpszCmdLine ) {
+
+ CHAR szTempCmdLine[ MAX_COMMAND_LINE_SIZE ];
+ LPSTR pszNewCmdLine;
+
+ szTempCmdLine[0] = 0;
+ strcpy ( szMixedCmdLine, lpszCmdLine );
+
+ pszNewCmdLine = GUI_AlterCmdLine ( szMixedCmdLine, szTempCmdLine );
+
+ strcpy ( szMixedCmdLine, pszNewCmdLine );
+ strcpy ( szUpperCmdLine, pszNewCmdLine );
+ strupr ( szUpperCmdLine );
+
+ }
+ else {
+ szMixedCmdLine[0] = 0;
+ szUpperCmdLine[0] = 0;
+ }
+
+
+ // Initialize global variables.
+
+#ifdef OEM_EMS
+ mwf3dEnabled = Ctl3dRegister ( ghInst );
+#endif OEM_EMS
+
+ if ( GUI_InitGlobals () ) {
+ return FAILURE;
+ }
+
+ // NTKLUG: do NOT use external resource file for CAYMAN for now...
+# if ! (defined ( OEM_MSOFT ) ) //unsupported feature
+ {
+
+ CHAR szResFileName[ MAX_UI_PATH_SIZE ];
+ CHAR szTemp1[ MAX_UI_SMALLRES_SIZE ];
+ CHAR szTemp2[ MAX_UI_SMALLRES_SIZE ];
+
+ // Load the resource library using a fully specified path.
+
+ CDS_SetupExePath ();
+
+ strcpy ( szResFileName, CDS_GetExePath () );
+ strcat ( szResFileName, RSM_RESFILE );
+
+ ghResInst = LoadLibrary ( szResFileName );
+
+ // Bug out if the load failed.
+
+# ifdef OS_WIN32
+ if ( ghResInst == NULL ) {
+# else
+ if ( ghResInst < 32 ) {
+# endif
+
+ // This is the only place that actual text is allowed.
+ // UNTRANSLATED due to the failure to load the language specific
+ // resource file.
+
+ MessageBox ( (HWND)NULL,
+ TEXT("FATAL ERROR: The resource library is missing or invalid and could not be loaded. This application cannot continue executing. Please re-install the software."),
+ APPLICATIONNAME,
+ MB_OK | MB_ICONSTOP
+ );
+
+ return FAILURE;
+ }
+
+ // Check the EXE and RESOURCE DLL versions.
+
+ RSM_StringCopy ( IDS_APPRESVER, szTemp1, sizeof ( szTemp1 ) );
+ RSM_StringCopy ( IDS_APPEXEVER, szTemp2, sizeof ( szTemp2 ) );
+
+ // Bug out if either version is different.
+
+ if ( strcmp ( szTemp1, gszResVer ) || strcmp ( szTemp2, gszExeVer ) ) {
+
+ CHAR szAppName[ MAX_UI_PATH_SIZE ];
+ CHAR szString[ MAX_UI_PATH_SIZE ];
+
+ RSM_StringCopy ( IDS_APPNAME, szAppName, sizeof ( szAppName ) );
+ RSM_Sprintf ( szString, ID( IDS_BADRESVER ), szAppName );
+
+ MessageBox ( (HWND)NULL, szString, szAppName, MB_OK | MB_ICONSTOP );
+
+ return FAILURE;
+ }
+
+ }
+# else
+ {
+ ghResInst = ghInst;
+ }
+# endif
+
+
+ // Check for the memory debug switch.
+
+ if ( strstr ( szUpperCmdLine, TEXT("/MEM") ) ) {
+ gfShowMemory = TRUE;
+ }
+
+ // Check for command line INI file specification.
+
+# if ! (defined ( OEM_MSOFT ) ) //unsupported feature
+ {
+ LPSTR pSubString;
+ LPSTR pIndex;
+ CHAR szTemp[ 512 ];
+ CHAR szIniName[MAX_UI_FILENAME_SIZE];
+
+ strcpy ( szTemp, TEXT("/INI:") );
+
+ pSubString = strstr ( szUpperCmdLine, szTemp );
+
+ if ( pSubString ) {
+
+ INT nPos = pSubString - szUpperCmdLine;
+
+ pSubString = &szMixedCmdLine[nPos];
+
+ pSubString += strlen ( szTemp );
+ pIndex = szIniName;
+
+ // Extract the INI name from the command line. Search for the
+ // INI name terminators.
+
+ while ( ( *pSubString != TEXT(' ') ) &&
+ ( *pSubString != TEXT('.') ) &&
+ ( *pSubString != TEXT('/') ) &&
+ ( *pSubString != TEXT('\0') ) ) {
+
+ *pIndex++ = *pSubString++;
+ }
+
+ *pIndex = TEXT('\0');
+
+ strcat ( szIniName, TEXT(".INI") );
+
+ CDS_SetIniFileName ( szIniName );
+ }
+ else {
+
+ // Set the INI file to the APP default.
+
+ CDS_LoadIniFileName ();
+ }
+ }
+#else
+
+ CDS_LoadIniFileName();
+
+#endif
+
+ // Initialize Memory.
+
+ if ( MEM_Init () ) {
+ return FAILURE;
+ }
+
+ // Initialize permanent and run-time CDS's.
+
+ CDS_Init ();
+
+ // Get the Debug Command Line Switches.
+
+ GUI_GetCmdLineSwitches ( szMixedCmdLine, szUpperCmdLine );
+
+
+# if !defined ( OEM_MSOFT )
+ {
+ gfServers = CDS_GetDisplayNetwareServers ( pCDS );
+ }
+# else //if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ gfServers = FALSE;
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+# if defined ( OEM_EMS )
+ {
+ CDS_SetDisplayExchange( pCDS, gfExchange );
+ }
+# endif
+
+#if defined( CAYMAN )
+ gfServers = FALSE ;
+#endif
+
+ gfShowStatusLine = CDS_GetShowStatusLine ( pCDS );
+ gfShowMainRibbon = CDS_GetShowMainRibbon ( pCDS );
+
+ // Initialize the international date and time separators, etc...
+
+ UI_InitIntl ();
+
+ if ( WM_Init ( szMixedCmdLine, nCmdShow ) ) {
+
+ WM_Deinit ();
+ return FAILURE;
+ }
+
+#if defined ( OS_WIN32 ) //alternate feature - cmd line batch job
+
+ if ( GUI_ValidateCmdLine( szUpperCmdLine ) != SUCCESS ) {
+
+ WM_Deinit ();
+ return FAILURE;
+ }
+
+#endif // defined ( OS_WIN32 ) //alternate feature - cmd line batch job
+
+ CDS_UpdateCopy ();
+
+#ifdef WFW
+ if ( ( EM_IsMailAvailable () == TRUE) && ( InitMAPI () == 0))
+ {
+ EM_SetMAPIAvailable ( TRUE );
+ } else
+ {
+ EM_SetMAPIAvailable ( FALSE );
+ }
+#endif
+
+ MON_Init ();
+
+ return SUCCESS;
+
+} /* end GUI_Init() */
+
+
+/*****************************************************************************
+
+ Name: GUI_Deinit ()
+
+ Description: This funciton deinitializes the GUI.
+
+ Returns: Nothing.
+
+*****************************************************************************/
+
+VOID GUI_Deinit ( VOID )
+
+{
+ // Deinitialize the Window Manager.
+
+ WM_Deinit ();
+
+ // Now, nicely give back all of the memory that we used.
+
+ MEM_Deinit ();
+
+ // CAYKLUG: do NOT use external resource file for CAYMAN for now...
+# if ! (defined ( OEM_MSOFT ) || defined ( CAYKLUG )) //unsupported feature
+ {
+ // Free up the resource library.
+
+ FreeLibrary ( ghResInst );
+ }
+# endif
+
+ MON_Deinit ();
+
+ // Bye-Bye.
+
+#ifdef WFW
+ DeInitMAPI();
+#endif
+} /* end GUI_Deinit() */
+
+
+/*****************************************************************************
+
+ Name: GUI_GetCmdLineSwitches ()
+
+ Description: This function processes the command line.
+
+ Returns: SUCCESS, if successful. Otherwise FAILURE, if there was
+ a problem.
+
+*****************************************************************************/
+
+static BOOL GUI_GetCmdLineSwitches (
+
+LPSTR lpszMixedCmdLine, // I - pointer to the mixed case command line string
+LPSTR lpszUpperCmdLine ) // I - pointer to the upper case command line string
+
+{
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ // If the debug option is specified, set the debug flag.
+ // Otherwise, remove the debug menu option from the settings
+ // menu.
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/Z") ) ) {
+
+ gfDebug = TRUE;
+
+ CDS_SetDebugToWindow ( pCDS, TRUE );
+
+ // The debug window will use the flag in the config.
+
+ if ( ! CDS_GetDebugFlag ( pCDS ) ) {
+ CDS_SetDebugFlag ( pCDS, 0xFFFF );
+ }
+
+ }
+ else {
+
+ gfDebug = FALSE;
+
+ CDS_SetDebugToWindow ( pCDS, FALSE );
+ CDS_SetDebugFlag ( pCDS, 0x0000 );
+ }
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/ZL") ) ) {
+
+ if ( ! strlen ( CDS_GetDebugFileName ( pCDS ) ) ) {
+ CDS_SetDebugFileName ( pCDS, TEXT("debug") );
+ }
+
+ CDS_SetDebugToFile ( pCDS, TRUE ) ;
+ }
+
+
+#ifdef MEM_DEBUG
+ if ( strstr ( lpszUpperCmdLine, TEXT("/CONTONMEMERR") ) ) {
+ gb_no_abort_on_mem_check = TRUE;
+ }
+#endif
+
+#ifdef OEM_MSOFT
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/MISSINGTAPE") ) ) {
+ gfIgnoreOTC = TRUE;
+ }
+
+ // Only delete catalogs for microsoft version.
+
+#ifdef MSDEBUG
+ if ( strstr( lpszUpperCmdLine, TEXT("/KEEPCATS") ) ) {
+ gfDeleteCatalogs = FALSE;
+ }
+ else {
+ gfDeleteCatalogs = TRUE;
+ }
+#else
+ gfDeleteCatalogs = TRUE;
+#endif
+
+#else
+ gfDeleteCatalogs = FALSE;
+#endif
+
+#ifdef MAYN_DEMO
+
+ // Delete catalogs for DEMO version.
+ gfDeleteCatalogs = TRUE;
+
+#endif
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/CONFIG") ) ) {
+ CDS_SetAdvToConfig ( pCDS, TRUE );
+ }
+
+
+ if ( ! strstr ( lpszUpperCmdLine, TEXT("/NOPOLL") ) ) {
+ gfPollDrive = TRUE;
+ }
+ else {
+ gfPollDrive = FALSE;
+ }
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/RED") ) ) {
+ gfRedChecks = TRUE;
+ }
+ else {
+ gfRedChecks = FALSE;
+ }
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/PEN") ) ) {
+ ghCursorPen = RSM_CursorLoad ( IDRC_PEN );
+ }
+ else {
+ ghCursorPen = RSM_CursorLoad ( IDRC_PEN2 );
+ }
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/MD") ) ) {
+ gfMultiDrive = TRUE;
+ }
+ else {
+ gfMultiDrive = FALSE;
+ }
+
+ // If we were told not to display servers, make sure they
+ // are turned off.
+
+ if ( strstr ( lpszUpperCmdLine, TEXT("/NOSERVERS") ) ) {
+ CDS_SetDisplayNetwareServers ( pCDS, FALSE );
+ }
+
+ // Might as well make the following sections of code
+ // a single function to grab what is in the quotes.
+ // Of course, IN THE NEXT RELEASE when all of this is
+ // object oriented. Oh yeah, we should get rid of OMBATCH
+ // kludge code and place a simpler version here so that all of
+ // the command line stuff is done here.
+
+ // Figure out if there is a command line tape name.
+
+ {
+ CHAR *pSubString ;
+ CHAR *pIndex ;
+ CHAR szTapeNumber[ MAX_TAPE_NAME_SIZE ] ;
+ CHAR szTemp[ 10 ] ;
+
+ strcpy( szTemp, TEXT("/TAPE:") ) ;
+
+ pSubString = strstr( lpszUpperCmdLine, szTemp ) ;
+
+ if ( pSubString ) {
+
+ INT nMax = MAX_TAPE_NAME_SIZE ;
+ INT nPos = pSubString - lpszUpperCmdLine ;
+ INT nTapeNumber ;
+
+ pSubString = &lpszMixedCmdLine[ nPos ] ;
+
+ pSubString += strlen( szTemp ) ;
+ pIndex = szTapeNumber ;
+ nPos = 0;
+
+ while ( ( *pSubString != TEXT(' ') ) &&
+ ( *pSubString != TEXT('\0') ) &&
+ ( ++nPos < nMax ) ) {
+
+ *pIndex++ = *pSubString++ ;
+ }
+
+ *pIndex = TEXT('\0') ;
+
+ nTapeNumber = atoi( szTapeNumber ) ;
+
+ /* atoi returns 0 if the string is not numeric, so
+ let's make sure the result is correct */
+ if ( !GUI_ValidAtoiResult( szTapeNumber, nTapeNumber ) ) {
+ nTapeNumber = -1 ;
+ }
+
+ TapeDevice = HWC_SelectTapeDevice( nTapeNumber ) ;
+ }
+ }
+
+ //
+ // Check for hardware compression mode switch
+ //
+ // Looking for '/HC:ON' or '/HC:OFF'
+ //
+ {
+ CHAR *p ;
+
+ if ( p = strstr( lpszUpperCmdLine, TEXT("/HC:") ) ) {
+ p += 5 ; // skip "/HC:O"
+ if( *p == TEXT('N') ) {
+ CDS_SetHWCompMode( pCDS, TRUE ) ;
+ }
+ if( *p == TEXT('F') ) {
+ CDS_SetHWCompMode( pCDS, FALSE ) ;
+ }
+ }
+ }
+
+ // Look for a command line LOG file name.
+
+ {
+ LPSTR pSubString;
+ LPSTR pIndex;
+ CHAR szTemp[10];
+
+ strcpy ( szTemp, TEXT("/L \042") );
+
+ pSubString = strstr ( lpszUpperCmdLine, szTemp );
+
+ if ( pSubString ) {
+
+ CHAR chTerminator;
+ INT nPos = pSubString - lpszUpperCmdLine;
+ CHAR szLogName[MAX_UI_FILENAME_SIZE];
+ INT nMax = sizeof ( szLogName );
+
+ pSubString = &lpszMixedCmdLine[nPos];
+
+ pSubString += strlen ( szTemp );
+ pIndex = szLogName;
+ nPos = 0;
+
+ // Extract the log file name from the command line. Search for the
+ // lob file name terminator or the end of the command line string '\0'.
+ // The terminator is the same as the last character in the
+ // temporary string. In English it is the double-quote (").
+
+ chTerminator = *(pSubString - 1);
+
+ while ( ( *pSubString != chTerminator ) &&
+ ( *pSubString != TEXT('\0') ) &&
+ ( ++nPos < nMax ) ) {
+
+ *pIndex++ = *pSubString++;
+ }
+
+ *pIndex = TEXT('\0');
+
+ // Need to set the log file name so that we
+ // can write any invalid directories passed on
+ // the command line.
+
+#ifndef OEM_MSOFT // chs:08-02-93
+ {
+ CHAR szLogPathAndName[MAX_UI_FULLPATH_SIZE] = TEXT("");
+
+ // If a full path is not specified, append the log file
+ // name to the data path.
+
+ if ( ! ( strchr ( szLogName, TEXT(':') ) ||
+ strchr ( szLogName, TEXT('\\') ) ) ) {
+
+ strcpy ( szLogPathAndName, CDS_GetUserDataPath () );
+ }
+
+ strcat ( szLogPathAndName, szLogName );
+
+ LOG_SetCurrentLogName ( szLogPathAndName );
+ }
+#else // chs:08-02-93
+ LOG_SetCurrentLogName ( szLogName ); // chs:08-02-93
+ // chs:08-02-93
+#endif // chs:08-02-93
+ }
+ }
+
+ return SUCCESS;
+
+} /* end GUI_GetCmdLineSwitches() */
+
+
+/****************************************************************************
+NOTE : WHEN TRACING THE CODE FOR STRING PASSED ON THE COMMAND LINE,
+ THE DEBUGGER WILL NOT DISPLAY ANY QUOTES. THIS I BELIEVE TO
+ BE SOME SORT OF BUG WITH THE DEBUGGER. THE QUOTES MAYBE
+ THERE EVEN THOUGH YOU CANNOT SEE THEM WITH THE DEBUGGER.
+ SO BE CAREFUL WHEN DEBUGGING THE COMMAND LINE PASSED.
+
+Procedure : GUI_AlterCmdLine
+
+Description : Prepare the command line string passed to make some minor
+ corrections for the user. If quotes missing, then add the
+ quotes, make sure all the "/" are separated by a space ....
+
+ Patch the command line argument passed to the app.
+ 1. Separate all "/" command by a space.
+ 2. Make sure there are quotes around the strings that
+ are passed with the commands ... example:
+ /L "logfile", /D "Description" ...
+ 3. Make sure there is only one space between the "/"
+ command and any string passed. example:
+ /L"logfile" to /L "logfile"
+ 4. Force all single quotes to double quotes.
+
+Function : function returns the new altered string. NULL if failed.
+
+****************************************************************************/
+static CHAR_PTR GUI_AlterCmdLine (
+
+LPSTR pszCmdLine,
+LPSTR pszNewCmdLine )
+
+{
+
+ INT nLength = strlen( pszCmdLine );
+ CHAR szDelimiter[] = TEXT("/");
+ CHAR_PTR pszToken;
+ CHAR szTemp[200];
+ CHAR_PTR pszTemp;
+ CHAR szCmdString[2];
+ INT nFirstChar = 0;
+
+
+ LOG_SetCurrentLogName ( TEXT( "\0" ) );
+
+ if ( nLength <= 0 ) { // if no command line arg then return NULL
+ return( pszCmdLine );
+ }
+
+ if ( pszCmdLine[0] == szDelimiter[0] ) {
+ nFirstChar = 1;
+ }
+
+ if ( ! pszNewCmdLine ) {
+ return( pszCmdLine );
+ }
+
+ //
+ // Jump over the non "/" tokens command string
+ //
+
+ pszToken = strtok( pszCmdLine, szDelimiter );
+
+ if ( ! pszToken ) {
+ return( pszCmdLine );
+ }
+
+ if ( nFirstChar ) {
+ strcat( pszNewCmdLine, szDelimiter );
+ }
+
+ strcat( pszNewCmdLine, pszToken ); // start building new altered command line
+ parseblk( pszNewCmdLine );
+ strcat( pszNewCmdLine, TEXT(" ") );
+
+ //
+ // Get the first valid token command string
+ //
+
+ pszToken = strtok( NULL, szDelimiter );
+
+ if ( !pszToken ) {
+ return( pszCmdLine );
+ }
+
+ while ( pszToken ) {
+
+ pszTemp = szTemp;
+
+ strcpy ( pszTemp, pszToken );
+
+ if ( strlen( pszToken ) > 1 ) {
+
+ if ( toupper ( *pszToken ) == TEXT('D') || toupper ( *pszToken ) == TEXT('L') ) {
+
+ szCmdString[1] = TEXT('\0');
+ szCmdString[0] = *pszToken;
+ strcat( pszNewCmdLine, TEXT("/") );
+ strcat( pszNewCmdLine, szCmdString );
+
+ ++pszToken; // jump over command
+
+ // Jump over any spaces
+ while ( *pszToken && isspace ( *pszToken ) ) ++pszToken;
+
+ if ( *pszToken == TEXT('\'') || *pszToken == TEXT('"') ) {
+ strcat( pszNewCmdLine, TEXT(" ") );
+ strcat( pszNewCmdLine, pszToken );
+ } else {
+ strcat( pszNewCmdLine,TEXT(" ") );
+ strcat( pszNewCmdLine, TEXT("\"") );
+ parseblk( pszToken );
+ strcat( pszNewCmdLine, pszToken );
+ strcat( pszNewCmdLine, TEXT("\"") );
+ }
+ } else {
+ strcat( pszNewCmdLine, TEXT("/") );
+ parseblk( pszToken );
+ strcat( pszNewCmdLine, pszToken );
+ }
+
+ } else {
+ strcat( pszNewCmdLine, TEXT("/") );
+ parseblk( pszToken );
+ strcat( pszNewCmdLine, pszToken );
+ }
+
+ strcat( pszNewCmdLine, TEXT(" ") );
+
+ pszToken = strtok( NULL, szDelimiter );
+
+ }
+
+ parseblk ( pszNewCmdLine );
+
+ return ( pszNewCmdLine );
+
+}
+
+
+/****************************************************************************
+Procedure : parseblk
+Purpose : delete blanks from rights of string.
+Parm :
+ input : st (string to delete padded blanks)
+ output : st (new string without padded blanks)
+**************************************************************************** */
+
+static VOID parseblk( CHAR_PTR st)
+{
+ int i,j;
+
+ j = strlen( st ) - 1;
+
+ for (i = j; i >= 0 && *( st + i ) == TEXT(' ');i--);
+ ++i;
+ *( st + i ) = TEXT('\0');
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// STATUS MONITOR STUFF
+//
+/////////////////////////////////////////////////////////////////////////////
+
+VOID MON_Init ( VOID )
+
+{
+#ifdef CAYMAN
+
+ CHAR szDevName[MAX_NAME_SIZE];
+ CHAR szName[2*MAX_NAME_SIZE];
+ INT nNumChars = MAX_NAME_SIZE;
+
+ // Allocate a block for status if needed...
+
+ if ( MON_LoadDDEManager () )
+ {
+ DWORD dwCharBlock = INITIAL_STRING_SIZE * sizeof(CHAR);
+ DWORD dwSize = sizeof(STAT_SETSTATUSBLOCK) + dwCharBlock;
+
+ // Note - we are using an extra INITIAL_STRING_SIZE bytes block for strings. We
+ // will reallocate space as necessary.
+
+ pSTAT_SetStatusBlock = (PSTAT_SETSTATUSBLOCK)calloc(dwSize, 1);
+
+ SetStatusBlock(IDSM_DATASIZE, dwSize);
+ SetStatusBlock(IDSM_UNICODE, 0); // Unicode is off
+ SetStatusBlock(IDSM_OPERATIONSTATUS, STAT_OPER_IDLE);
+ SetStatusBlock(IDSM_APPSTATUS, STAT_APP_OK);
+
+ SetStatusBlock(IDSM_INSTANCE, (DWORD)ghInst);
+ GetComputerName((LPSTR)szDevName, (LPDWORD)&nNumChars);
+ strcpy(szName, TEXT("\\\\") );
+ strcat(szName, szDevName);
+
+ SetStatusBlock(IDSM_OFFSETSERVERVOLUME, (DWORD)szName);
+ SendStatusMsg(pSTAT_SetStatusBlock);
+ }
+
+#endif
+}
+
+
+VOID MON_Deinit ( VOID )
+
+{
+#ifdef CAYMAN
+ SendStatusMsg(NULL);
+
+ MON_FreeDDEManager();
+
+ if ( glpfnSetStatus == 0 )
+ {
+ // De-Allocate the block for status...
+
+ if (glpOffsetTapeDriveName != 0)
+ {
+ free(glpOffsetTapeDriveName);
+ }
+ if (glpOffsetCurrentTapeName != 0)
+ {
+ free(glpOffsetCurrentTapeName);
+ }
+ if (glpOffsetServerVolume != 0)
+ {
+ free(glpOffsetServerVolume);
+ }
+ if (glpOffsetTapeDriveIdentifier != 0)
+ {
+ free(glpOffsetTapeDriveIdentifier);
+ }
+ if (glpOffsetTapeNeededName != 0)
+ {
+ free(glpOffsetTapeNeededName);
+ }
+ if (glpOffsetDiskName != 0)
+ {
+ free(glpOffsetDiskName);
+ }
+ if (glpOffsetActiveFile != 0)
+ {
+ free(glpOffsetActiveFile);
+ }
+ if (glpOffsetErrorMsg != 0)
+ {
+ free(glpOffsetErrorMsg);
+ }
+ if (pSTAT_SetStatusBlock != 0)
+ {
+ free(pSTAT_SetStatusBlock);
+ }
+ pSTAT_SetStatusBlock = 0;
+ }
+
+#endif
+}
+
+
+BOOL MON_LoadDDEManager()
+{
+#ifdef CAYMAN
+
+ mwhLibInst = LoadLibrary(DDEMANG);
+
+ if (mwhLibInst != NULL)
+ {
+ glpfnSetStatus = (ULONG FAR PASCAL)GetProcAddress(mwhLibInst, (LPSTR)MAKELONG(2, 0)); //SZ_DDEMANG);
+
+ if (*glpfnSetStatus == NULL)
+ {
+ FreeLibrary(mwhLibInst);
+ mwhLibInst = 0;
+ return FALSE;
+ }
+ } else
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+BOOL MON_FreeDDEManager()
+{
+#ifdef CAYMAN
+ if (mwhLibInst != NULL)
+ {
+ glpfnSetStatus = 0L;
+ FreeLibrary(mwhLibInst);
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
+
+void CALLBACK DDEManagerTimerProc()
+{
+#ifdef CAYMAN
+ static UINT uiOldInterval;
+ UINT uiNewInterval;
+
+ if ((glpfnSetStatus != 0) && (pSTAT_SetStatusBlock != NULL))
+ {
+ MON_CreateStringList();
+ if (gfHWInitialized == TRUE)
+ {
+ pSTAT_SetStatusBlock->DriveStatus = STAT_DRIVE_VALID;
+ } else
+ {
+ pSTAT_SetStatusBlock->DriveStatus = STAT_DRIVE_BAD;
+ }
+ uiNewInterval = (*glpfnSetStatus)(pSTAT_SetStatusBlock);
+ if (uiNewInterval != uiOldInterval)
+ {
+ WM_SetTimerFrequency(mhStatusTimer, uiNewInterval);
+ uiOldInterval = uiNewInterval;
+ }
+ }
+#endif
+ return;
+}
+
+
+void SendStatusMsg(PSTAT_SETSTATUSBLOCK pStatusBlk)
+{
+#ifdef CAYMAN
+ ULONG ulTimer;
+
+ if ((glpfnSetStatus != 0) && (pSTAT_SetStatusBlock != NULL))
+ {
+ if (mhStatusTimer == 0)
+ {
+ mhStatusTimer = WM_HookTimer( DDEManagerTimerProc, 1 );
+ ulTimer = (*glpfnSetStatus)(pSTAT_SetStatusBlock);
+ } else
+ if (pStatusBlk == NULL)
+ {
+ WM_UnhookTimer( mhStatusTimer );
+ ulTimer = (*glpfnSetStatus)(NULL);
+ } else
+ {
+ ulTimer = (*glpfnSetStatus)(pSTAT_SetStatusBlock);
+ }
+ }
+#endif
+ return;
+}
+
+static BOOL MON_CreateStringList()
+{
+#ifdef CAYMAN
+ LPSTR lpString;
+ INT iStrSize = 0;
+ PSTAT_SETSTATUSBLOCK pTempBlock;
+
+ iStrSize = MON_SetSize(glpOffsetTapeDriveName);
+ iStrSize += MON_SetSize(glpOffsetCurrentTapeName);
+ iStrSize += MON_SetSize(glpOffsetServerVolume);
+ iStrSize += MON_SetSize(glpOffsetCurrentTapeName);
+ iStrSize += MON_SetSize(glpOffsetTapeDriveIdentifier);
+ iStrSize += MON_SetSize(glpOffsetTapeNeededName);
+ iStrSize += MON_SetSize(glpOffsetDiskName);
+ iStrSize += MON_SetSize(glpOffsetActiveFile);
+ iStrSize += MON_SetSize(glpOffsetErrorMsg);
+ iStrSize += MON_SetSize(glpOffsetActiveDir)+1;
+ if (iStrSize > (sizeof(pSTAT_SetStatusBlock) - sizeof(STAT_SETSTATUSBLOCK)))
+ {
+ pTempBlock = (PSTAT_SETSTATUSBLOCK)realloc(pSTAT_SetStatusBlock,
+ sizeof(STAT_SETSTATUSBLOCK) + iStrSize);
+ if (pTempBlock == NULL)
+ {
+ // Unable to allocate memory, return out.
+ return FALSE;
+ }
+ pSTAT_SetStatusBlock = pTempBlock;
+ }
+ lpString = (LPSTR)pSTAT_SetStatusBlock + sizeof(STAT_SETSTATUSBLOCK);
+ // We got the additional memory, now add the strings and set the offsets
+
+ pSTAT_SetStatusBlock->OffsetTapeDriveName =
+ MON_StringToStatusBlock(glpOffsetTapeDriveName, lpString);
+ if (glpOffsetTapeDriveName != 0)
+ {
+ lpString += strlen(glpOffsetTapeDriveName) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetCurrentTapeName =
+ MON_StringToStatusBlock(glpOffsetCurrentTapeName, lpString);
+ if (glpOffsetCurrentTapeName != 0)
+ {
+ lpString += strlen(glpOffsetCurrentTapeName) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetServerVolume =
+ MON_StringToStatusBlock(glpOffsetServerVolume, lpString);
+ if (glpOffsetServerVolume != 0)
+ {
+ lpString += strlen(glpOffsetServerVolume) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetTapeDriveIdentifier =
+ MON_StringToStatusBlock(glpOffsetTapeDriveIdentifier, lpString);
+ if (glpOffsetTapeDriveIdentifier != 0)
+ {
+ lpString += strlen(glpOffsetTapeDriveIdentifier) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetTapeNeededName =
+ MON_StringToStatusBlock(glpOffsetTapeNeededName, lpString);
+ if (glpOffsetTapeNeededName != 0)
+ {
+ lpString += strlen(glpOffsetTapeNeededName) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetDiskName =
+ MON_StringToStatusBlock(glpOffsetDiskName, lpString);
+ if (glpOffsetDiskName != 0)
+ {
+ lpString += strlen(glpOffsetDiskName) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetActiveFile =
+ MON_StringToStatusBlock(glpOffsetActiveFile, lpString);
+ if (glpOffsetActiveFile != 0)
+ {
+ lpString += strlen(glpOffsetActiveFile) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetErrorMsg =
+ MON_StringToStatusBlock(glpOffsetErrorMsg, lpString);
+ if (glpOffsetErrorMsg != 0)
+ {
+ lpString += strlen(glpOffsetErrorMsg) + 1;
+ }
+
+ pSTAT_SetStatusBlock->OffsetActiveDir =
+ MON_StringToStatusBlock(glpOffsetActiveDir, lpString);
+ if (glpOffsetActiveDir != 0)
+ {
+ lpString += strlen(glpOffsetActiveDir) + 1;
+ }
+
+#endif
+ return TRUE;
+}
+
+void SetStatusBlock(INT iType, DWORD dwValue)
+{
+#ifdef CAYMAN
+ if ((glpfnSetStatus != 0) && (pSTAT_SetStatusBlock != NULL))
+ {
+ switch(iType)
+ {
+ case IDSM_INSTANCE:
+ pSTAT_SetStatusBlock->Instance = dwValue;
+ break;
+
+ case IDSM_DATASIZE:
+ pSTAT_SetStatusBlock->DataSize = dwValue;
+ break;
+
+ case IDSM_UNICODE:
+ pSTAT_SetStatusBlock->Unicode = dwValue;
+ break;
+
+ case IDSM_OPERATIONSTATUS:
+ pSTAT_SetStatusBlock->OperationStatus = dwValue;
+ break;
+
+ case IDSM_APPSTATUS:
+ pSTAT_SetStatusBlock->AppStatus = dwValue;
+ break;
+
+ case IDSM_DRIVESTATUS:
+ pSTAT_SetStatusBlock->DriveStatus = dwValue;
+ break;
+
+ case IDSM_TAPEFAMILY:
+ pSTAT_SetStatusBlock->TapeFamily = dwValue;
+ break;
+
+ case IDSM_TAPESEQNUMBER:
+ pSTAT_SetStatusBlock->TapeSeqNumber = dwValue;
+ break;
+
+ case IDSM_BACKUPSET:
+ pSTAT_SetStatusBlock->BackupSet = dwValue;
+ break;
+
+ case IDSM_DIRCOUNT:
+ pSTAT_SetStatusBlock->DirCount = dwValue;
+ break;
+
+ case IDSM_FILECOUNT:
+ pSTAT_SetStatusBlock->FileCount = dwValue;
+ break;
+
+ case IDSM_BYTECOUNTLO:
+ pSTAT_SetStatusBlock->ByteCountLo = dwValue;
+ break;
+
+ case IDSM_BYTECOUNTHI:
+ pSTAT_SetStatusBlock->ByteCountHi = dwValue;
+ break;
+
+ case IDSM_CORRUPTFILECOUNT:
+ pSTAT_SetStatusBlock->CorruptFileCount = dwValue;
+ break;
+
+ case IDSM_SKIPPEDFILECOUNT:
+ pSTAT_SetStatusBlock->SkippedFileCount = dwValue;
+ break;
+
+ case IDSM_ELAPSEDSECONDS:
+ pSTAT_SetStatusBlock->ElapsedSeconds = dwValue;
+ break;
+
+ case IDSM_TAPEFAMILYNEEDED:
+ pSTAT_SetStatusBlock->TapeFamilyNeeded = dwValue;
+ break;
+
+ case IDSM_TAPESEQNEEDED:
+ pSTAT_SetStatusBlock->TapeSeqNeeded = dwValue;
+ break;
+
+ case IDSM_OFFSETTAPEDRIVENAME:
+ if (glpOffsetTapeDriveName != 0)
+ {
+ free(glpOffsetTapeDriveName);
+ glpOffsetTapeDriveName = NULL;
+ }
+ glpOffsetTapeDriveName = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetTapeDriveName, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETCURRENTTAPENAME:
+ if (glpOffsetCurrentTapeName != 0)
+ {
+ free(glpOffsetCurrentTapeName);
+ glpOffsetCurrentTapeName = NULL;
+ }
+ glpOffsetCurrentTapeName = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetCurrentTapeName, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETSERVERVOLUME:
+ if (glpOffsetServerVolume != 0)
+ {
+ free(glpOffsetServerVolume);
+ glpOffsetServerVolume = NULL;
+ }
+ glpOffsetServerVolume = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetServerVolume, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETTAPEDRIVEIDENTIFIER:
+ if (glpOffsetTapeDriveIdentifier != 0)
+ {
+ free(glpOffsetTapeDriveIdentifier);
+ glpOffsetTapeDriveIdentifier = NULL;
+ }
+ glpOffsetTapeDriveIdentifier = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetTapeDriveIdentifier, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETTAPENEEDEDNAME:
+ if (glpOffsetTapeNeededName != 0)
+ {
+ free(glpOffsetTapeNeededName);
+ glpOffsetTapeNeededName = NULL;
+ }
+ glpOffsetTapeNeededName = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetTapeNeededName, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETDISKNAME:
+ if (glpOffsetDiskName != 0)
+ {
+ free(glpOffsetDiskName);
+ glpOffsetDiskName = NULL;
+ }
+ glpOffsetDiskName = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetDiskName, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETACTIVEFILE:
+ if (glpOffsetActiveFile != 0)
+ {
+ free(glpOffsetActiveFile);
+ glpOffsetActiveFile = NULL;
+ }
+ glpOffsetActiveFile = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetActiveFile, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETERRORMSG:
+ if (glpOffsetErrorMsg != 0)
+ {
+ free(glpOffsetErrorMsg);
+ glpOffsetErrorMsg = NULL;
+ }
+ glpOffsetErrorMsg = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetErrorMsg, (LPSTR)dwValue);
+ break;
+
+ case IDSM_OFFSETACTIVEDIR:
+ if (glpOffsetActiveDir != 0)
+ {
+ free(glpOffsetActiveDir);
+ glpOffsetActiveDir = NULL;
+ }
+ glpOffsetActiveDir = (LPSTR)calloc(strlen((LPSTR)dwValue), sizeof(CHAR));
+ strcpy(glpOffsetActiveDir, (LPSTR)dwValue);
+ break;
+ }
+ }
+#endif
+ return;
+}
+
+
+/**
+
+ Name: GUI_ValidAtoiResult
+
+ Desc: Validates that atoi didn't fail to convert a string
+ to an integer because of an invalid character. atoi()
+ will return 0 if it fails.
+
+ Return: TRUE if string was zero.
+**/
+
+BOOL
+GUI_ValidAtoiResult( CHAR *pszChar, INT nTapeNumber )
+{
+BOOL fRetValu = TRUE ;
+CHAR *pStrStart = pszChar ;
+
+ if ( nTapeNumber == 0 )
+ {
+ while ( *pszChar == TEXT('0') )
+ {
+ pszChar++ ;
+ }
+
+ if ( ( *pszChar != TEXT('\0') ) || ( pStrStart == pszChar ) )
+ {
+ fRetValu = FALSE ;
+ }
+ }
+
+ return( fRetValu ) ;
+}
+
+
+#ifdef CAYMAN
+INT MON_SetSize(LPSTR lpString)
+{
+ INT iRet = 0;
+
+ if (lpString != 0)
+ {
+ iRet = strlen(lpString);
+ }
+ return iRet;
+}
+
+DWORD MON_StringToStatusBlock(LPSTR lpInString, LPSTR lpPlace)
+{
+ DWORD dwRet = 0;
+ INT iSize;
+
+ if (lpInString != 0)
+ {
+ dwRet = (DWORD)((LPSTR)lpPlace - (LPSTR)pSTAT_SetStatusBlock);
+ iSize = strlen(lpInString);
+ strncpy(lpPlace, lpInString, iSize);
+ *(lpPlace+iSize) = 0;
+ }
+ return dwRet;
+}
+
+
+#endif
+
+static BOOL GUI_ValidateCmdLine( LPSTR CmdLine )
+{
+ LPSTR pszNext = NULL; // Next command line item pointer
+ LPSTR pszCmdLine;
+ CHAR szBackup[ IDS_OEM_MAX_LEN ];
+ CHAR szEject[ IDS_OEM_MAX_LEN ];
+ CHAR szTokens[ IDS_OEM_MAX_LEN ];
+ OEMOPTS_PTR pOemOpts = NULL;
+ BSD_PTR bsd ;
+ LPSTR pszQuotedString;
+ BOOLEAN QuoteState = FALSE;
+ BOOL cmd_line_error;
+ BOOL oem_batch_mode;
+ BOOL oem_batch_eject_mode;
+ BOOL first_switch ;
+ INT opt_id ;
+ BOOL ret_val = SUCCESS;
+ BOOL path_specified = FALSE ;
+ BOOL switch_specified = FALSE ;
+
+ if ( CmdLine ) //global command line pointer
+ {
+
+ pszCmdLine = malloc( ( strlen( CmdLine ) + 1 ) * sizeof(CHAR) );
+
+ if ( pszCmdLine == NULL ) { //uh-oh - memory allocation problem!!
+
+ return FAILURE;
+ }
+
+ pszQuotedString = malloc( ( strlen( CmdLine ) + 1 ) * sizeof(CHAR) );
+
+ if ( pszQuotedString == NULL ) { //uh-oh - memory allocation problem!!
+
+ free( pszCmdLine );
+ return FAILURE;
+ }
+
+ strcpy( pszCmdLine, CmdLine );
+
+ RSM_StringCopy ( IDS_OEMBATCH_BACKUP,
+ szBackup, sizeof ( szBackup ) );
+
+ RSM_StringCopy ( IDS_OEMBATCH_EJECT,
+ szEject, sizeof ( szEject ) );
+
+ RSM_StringCopy ( IDS_OEMOPT_TOKENSEPS,
+ szTokens, sizeof ( szTokens ) );
+
+ pszNext = strtok ( pszCmdLine, szTokens ); //skip leading spaces
+
+ oem_batch_mode = cmd_line_error = FALSE ;
+ first_switch = TRUE ;
+
+ if ( pszNext &&
+ ( pOemOpts = OEM_DefaultBatchOptions () ) &&
+ ( (strnicmp ( pszNext, szBackup, strlen( pszNext ) ) == 0 ) ||
+ ( strnicmp ( pszNext, szEject, strlen( pszNext ) ) == 0 ) ) )
+ {
+ oem_batch_mode = TRUE ;
+ oem_batch_eject_mode = FALSE ;
+
+ if ( strnicmp ( pszNext, szEject, strlen( pszNext ) ) == 0 ) {
+ oem_batch_eject_mode = TRUE ;
+ }
+
+
+ // Process the command line: all following items in the command
+ // line must be one or more path specifiers with optional batch
+ // options mixed in.
+
+
+ if ( strlen( LOG_GetCurrentLogName( ) ) > 0 ) { // chs:07-16-93
+ lresprintf( LOGGING_FILE, LOG_START, FALSE ); // chs:07-16-93
+ lresprintf( LOGGING_FILE, LOG_END ); // chs:07-16-93
+ } // chs:07-16-93
+ }
+
+ while ( (first_switch && !oem_batch_mode ) ||
+ (pszNext = strtok ( NULL, szTokens ) ) ) {
+
+ first_switch = FALSE ;
+ opt_id = OEM_ProcessBatchCmdOption (
+ pOemOpts,
+ pszNext,
+ szTokens,
+ pszCmdLine ) ;
+
+ if ( oem_batch_mode && ( opt_id == IDS_OEMOPT_NOTANOPTION ) )
+
+ {
+
+ //
+ // Previous logic did not account for a directory name haveing spaces
+ // example ... "G:\SUB DIR WITH SPACE". This was the easiest way
+ // to fix this problem without changing the central logic of
+ // the codes.
+ //
+
+ if ( *pszNext == TEXT( '"' ) || QuoteState ) {
+ if ( !QuoteState ) strcpy( pszQuotedString, TEXT( "" ) );
+ QuoteState = TRUE;
+ if ( *pszNext == TEXT( '"' ) ) {
+ GUI_ProcessQuotedString ( pszQuotedString, ( pszNext + 1 ), &QuoteState );
+ } else {
+ GUI_ProcessQuotedString ( pszQuotedString, pszNext, &QuoteState );
+ }
+ if ( QuoteState ) {
+
+ strcat( pszQuotedString, TEXT( " " ) );
+ } else {
+
+ path_specified = TRUE ;
+ if ( switch_specified ||
+ ( (*(pszQuotedString+1) != ':') && *pszQuotedString != '\\' ) ) {
+ ret_val = FAILURE ;
+ cmd_line_error = TRUE ;
+ break ;
+ }
+
+ }
+ } else {
+
+ path_specified = TRUE ;
+ if ( switch_specified ||
+ ( (*(pszNext+1) != ':') && *pszNext != '\\' ) ) {
+
+ CHAR szDSA[ IDS_OEM_MAX_LEN ];
+ CHAR szMonolithic[ IDS_OEM_MAX_LEN ];
+
+ RSM_StringCopy ( IDS_OEMOPT_DSA,
+ szDSA, sizeof ( szDSA ) );
+
+ RSM_StringCopy ( IDS_OEMOPT_MONOLITHIC,
+ szMonolithic, sizeof ( szMonolithic ) );
+
+ if ( stricmp( szDSA, pszNext ) && stricmp(szMonolithic, pszNext) ) {
+
+ ret_val = FAILURE ;
+ cmd_line_error = TRUE ;
+ break ;
+ }
+
+ strtok ( NULL, szTokens ) ;
+ }
+ }
+
+ } else {
+
+ switch_specified = TRUE ;
+
+ if ( oem_batch_mode && (opt_id == IDS_OEMOPT_NOPOLLOPTION) ) {
+ cmd_line_error = TRUE ;
+ }
+
+ if ( opt_id == IDS_OEMOPT_USAGE ) {
+ /* help for usage */
+ HM_DialogHelp( IDH_DB_BATCHHELP );
+ cmd_line_error = FALSE ;
+ ret_val = FAILURE ;
+
+ } else if ((pszNext && ( opt_id == IDS_OEMOPT_UNKNOWN )) ||
+ (pszNext && !oem_batch_mode &&
+ ( opt_id != IDS_OEMOPT_NOPOLLOPTION) ) &&
+ ( opt_id != IDS_OEMOPT_VALIDGUIOPTION) ) {
+ cmd_line_error = TRUE ;
+
+ }
+ }
+ }
+
+ if ( cmd_line_error || ( !path_specified && oem_batch_mode && !oem_batch_eject_mode) ) {
+ yresprintf( (INT16) RES_INVALID_PARAMETER, CmdLine );
+
+ WM_MessageBox( ID( IDS_MSGTITLE_WARNING ), // chs:04-29-93
+ gszTprintfBuffer, // chs:04-29-93
+ WMMB_OK | WMMB_NOYYCHECK, // chs:04-29-93
+ WMMB_ICONEXCLAMATION, NULL, 0, IDH_DB_BATCHHELP ); // chs:04-29-93
+ ret_val = FAILURE ;
+ }
+ }
+ free( pszCmdLine );
+ free( pszQuotedString );
+ return ret_val ;
+}
+
+
+VOID GUI_ProcessQuotedString ( LPSTR OutPutString,
+ LPSTR InPutString,
+ BOOLEAN *QuoteState )
+{
+ UINT16 lngth;
+
+ lngth = strlen( InPutString );
+ if ( lngth < 1 ) {
+ return;
+ }
+
+ if ( *( InPutString + lngth - 1 ) == TEXT( '"' ) ) {
+ if ( *QuoteState ) {
+ *( InPutString + lngth - 1 ) = TEXT( '\0' );
+ strcat( OutPutString, InPutString );
+ *QuoteState = *QuoteState ? FALSE : TRUE;
+ }
+ }
+
+ if ( *QuoteState ) {
+ strcat( OutPutString, InPutString );
+ }
+}
+
+
diff --git a/private/utils/ntbackup/src/hcrpfile.bmp b/private/utils/ntbackup/src/hcrpfile.bmp
new file mode 100644
index 000000000..11d66ae45
--- /dev/null
+++ b/private/utils/ntbackup/src/hcrpfile.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/help.cur b/private/utils/ntbackup/src/help.cur
new file mode 100644
index 000000000..80b03e08f
--- /dev/null
+++ b/private/utils/ntbackup/src/help.cur
Binary files differ
diff --git a/private/utils/ntbackup/src/helpmang.c b/private/utils/ntbackup/src/helpmang.c
new file mode 100644
index 000000000..868f05dd8
--- /dev/null
+++ b/private/utils/ntbackup/src/helpmang.c
@@ -0,0 +1,1404 @@
+/****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: helpmang.c
+
+ Description: This file contains routines for Help Manager.
+
+ The following routines are in this module:
+
+ HM_DialogFilter
+ HM_Init
+ HM_Deinit
+ HM_FindHelpId
+ HM_MakeHelpPathName
+ HM_WinHelp
+ HM_MenuCommands
+ HM_ContextLbuttonDown
+ HM_GetWindowClassHelpId
+ HM_KeyDown
+ HM_SetCursor
+ HM_InitMenu
+ HM_EnterIdle
+ HM_CloseHelpWindow
+
+
+ $Log: G:\UI\LOGFILES\HELPMANG.C_V $
+
+ Rev 1.43 11 Jan 1994 11:17:46 mikep
+change ifdef
+
+ Rev 1.42 22 Nov 1993 16:12:50 BARRY
+Unicode fixes: put TEXT around literals
+
+ Rev 1.41 19 Jul 1993 19:21:02 MARINA
+enable c++, move mw* vars from header
+
+ Rev 1.40 14 May 1993 14:32:58 DARRYLP
+Added help for operations info.
+
+ Rev 1.39 22 Apr 1993 15:58:20 GLENN
+Added file SORT option support.
+
+ Rev 1.38 02 Apr 1993 14:11:20 GLENN
+Changed to NT help menu style and IDs.
+
+ Rev 1.37 29 Mar 1993 10:11:32 DARRYLP
+Added context help for Operation.Format.
+
+ Rev 1.36 24 Mar 1993 14:52:40 DARRYLP
+Added Help for Font viewer/other common dialogs
+
+ Rev 1.35 18 Mar 1993 15:26:56 ROBG
+Fixed context-sensitive functionality for menu area for Cayman.
+
+ Rev 1.34 18 Mar 1993 11:43:00 ROBG
+Fixed the class name parameter in the GetClassName call.
+
+ Rev 1.33 15 Mar 1993 14:39:24 ROBG
+More changes to support OEM_MSOFT WM_SYSCOMMAND help.
+
+ Rev 1.32 15 Mar 1993 09:50:28 ROBG
+Took out context-sensitive HELP for OEM_MSOFT.
+
+ Rev 1.31 12 Mar 1993 17:53:58 ROBG
+More fixes.
+
+ Rev 1.29 18 Jan 1993 14:49:54 GLENN
+Changed HM_EnterIdle() return type.
+
+ Rev 1.28 01 Nov 1992 15:58:54 DAVEV
+Unicode changes
+
+ Rev 1.27 07 Oct 1992 14:07:34 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.26 04 Oct 1992 19:37:46 DAVEV
+Unicode Awk pass
+
+ Rev 1.25 08 Sep 1992 16:43:36 DARRYLP
+
+ Rev 1.24 17 Aug 1992 13:18:48 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.23 11 Jun 1992 10:59:24 GLENN
+Now pulling in omhelpid.h. Fixed unresolved helpids.
+
+ Rev 1.22 29 May 1992 15:58:54 JOHNWT
+PCH updates
+
+ Rev 1.21 23 Apr 1992 14:35:12 ROBG
+Fixed problem with hitting F1 on a grayed out item.
+
+ Rev 1.20 22 Apr 1992 14:30:12 ROBG
+changed
+
+ Rev 1.19 23 Mar 1992 10:06:04 DAVEV
+changes for OEM_MSOFT
+
+ Rev 1.18 17 Mar 1992 13:12:02 ROBG
+changed
+
+ Rev 1.17 17 Mar 1992 11:55:20 ROBG
+changed
+
+ Rev 1.16 16 Mar 1992 16:35:36 ROBG
+changed
+
+ Rev 1.15 09 Mar 1992 16:19:44 ROBG
+changed
+
+ Rev 1.14 02 Mar 1992 17:09:36 DAVEV
+Added case for IDM_HELPSEARCH for Nostradamus
+
+ Rev 1.13 02 Mar 1992 14:56:12 DAVEV
+Changes for Nostradamus unique features
+
+ Rev 1.12 18 Feb 1992 20:40:38 GLENN
+Updated variables.
+
+ Rev 1.11 11 Feb 1992 17:24:54 GLENN
+Removed unnecessary menu related code.
+
+ Rev 1.10 05 Feb 1992 17:54:16 GLENN
+Replaced dialog string lookup table and supporting code with IDHELP call to specific dialog.
+
+ Rev 1.9 27 Jan 1992 00:32:26 CHUCKB
+Updated dialog id's.
+
+ Rev 1.8 24 Jan 1992 10:09:42 GLENN
+Matched the deinit call with it's prototype.
+
+ Rev 1.7 14 Jan 1992 11:39:52 ROBG
+Added "Job Status - " strings.
+
+ Rev 1.6 13 Jan 1992 15:29:44 ROBG
+Added HELPID_DIALOGTRANSFER.
+
+ Rev 1.5 09 Jan 1992 11:47:04 ROBG
+Updated IDs.
+
+ Rev 1.3 18 Dec 1991 15:52:12 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.2 05 Dec 1991 11:02:04 GLENN
+Changed WM_GetActive to WM_GetActiveDoc
+
+ Rev 1.1 04 Dec 1991 15:20:14 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.0 20 Nov 1991 19:32:54 SYSTEM
+Initial revision.
+
+****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static BOOL mwfHelp ; /* Help mode flag; TRUE = TEXT("ON") */
+static HCURSOR mwhHelpCursor; /* Cursor displayed when in help mode */
+static CHAR mwszHelpFilename[NAME_MAX_SIZE+1]; /* Help file name */
+static FARPROC mwlpfnNextHook ;
+static FARPROC mwlpFilterFunc ;
+
+HELPID_MENUID_TABLE HelpIdMenuIdTable[] = {
+
+#if defined ( OEM_MSOFT ) // OEM Microsoft product alternate help table
+
+ { IDM_OPERATIONSBACKUP ,HELPID_OPERATIONSBACKUP } ,
+ { IDM_OPERATIONSRESTORE ,HELPID_OPERATIONSRESTORE } ,
+ { IDM_OPERATIONSCATALOG ,HELPID_OPERATIONSCATALOG } ,
+ { IDM_OPERATIONSERASE ,HELPID_OPERATIONSERASE } ,
+ { IDM_OPERATIONSRETENSION ,HELPID_OPERATIONSRETENSION } ,
+ { IDM_OPERATIONSFORMAT ,HELPID_OPERATIONSFORMAT } ,
+ { IDM_OPERATIONSEJECT ,HELPID_OPERATIONSEJECT } ,
+ { IDM_OPERATIONSHARDWARE ,HELPID_OPERATIONSHARDWARE } ,
+ { IDM_OPERATIONSEXIT ,HELPID_OPERATIONSEXIT } ,
+#ifdef OEM_EMS
+ { IDM_OPERATIONSEXCHANGE ,HELPID_OPERATIONSEXCHANGE } ,
+#endif
+
+ { IDM_TREEEXPANDONE ,HELPID_TREEEXPANDONE } ,
+ { IDM_TREEEXPANDBRANCH ,HELPID_TREEEXPANDBRANCH } ,
+ { IDM_TREEEXPANDALL ,HELPID_TREEEXPANDALL } ,
+ { IDM_TREECOLLAPSEBRANCH ,HELPID_TREECOLLAPSEBRANCH } ,
+
+ { IDM_VIEWTREEANDDIR ,HELPID_VIEWTREEANDDIR } ,
+ { IDM_VIEWTREEONLY ,HELPID_VIEWTREEONLY } ,
+ { IDM_VIEWDIRONLY ,HELPID_VIEWDIRONLY } ,
+ { IDM_VIEWSPLIT ,HELPID_VIEWSPLIT } ,
+ { IDM_VIEWALLFILEDETAILS ,HELPID_VIEWALLFILEDETAILS } ,
+ { IDM_VIEWSTATUS ,HELPID_VIEWSTATUS } ,
+ { IDM_VIEWURIBBON ,HELPID_VIEWURIBBON } ,
+ { IDM_VIEWFONT ,HELPID_VIEWFONTS } ,
+
+ { IDM_SELECTCHECK ,HELPID_SELECTCHECK } ,
+ { IDM_SELECTUNCHECK ,HELPID_SELECTUNCHECK } ,
+
+ { IDM_WINDOWSCASCADE ,HELPID_WINDOWSCASCADE } ,
+ { IDM_WINDOWSTILE ,HELPID_WINDOWSTILE } ,
+ { IDM_WINDOWSARRANGEICONS ,HELPID_WINDOWSARRANGEICONS } ,
+ { IDM_WINDOWSREFRESH ,HELPID_WINDOWSREFRESH } ,
+ { IDM_WINDOWSCLOSEALL ,HELPID_WINDOWSCLOSEALL } ,
+
+ { IDM_HELPINDEX ,HELPID_HELPINDEX } ,
+ { IDM_HELPSEARCH ,HELPID_HELPSEARCH } ,
+ { IDM_HELPUSINGHELP ,HELPID_HELPUSINGHELP } ,
+ { IDM_HELPABOUTNOSTRADOMUS ,HELPID_HELPABOUTNOSTRADOMUS } ,
+ { 0 , 0 }
+
+#else // Standard Maynstream for Windows help table:
+
+ { IDM_FILEPRINT ,HELPID_FILEPRINT } ,
+ { IDM_FILESETUP ,HELPID_FILESETUP } ,
+ { IDM_FILEEXIT ,HELPID_FILEEXIT } ,
+
+ { IDM_JOBMAINTENANCE ,HELPID_JOBMAINTENANCE } ,
+
+ { IDM_TREEEXPANDONE ,HELPID_TREEEXPANDONE } ,
+ { IDM_TREEEXPANDBRANCH ,HELPID_TREEEXPANDBRANCH } ,
+ { IDM_TREEEXPANDALL ,HELPID_TREEEXPANDALL } ,
+ { IDM_TREECOLLAPSEBRANCH ,HELPID_TREECOLLAPSEBRANCH } ,
+
+ { IDM_VIEWTREEANDDIR ,HELPID_VIEWTREEANDDIR } ,
+ { IDM_VIEWTREEONLY ,HELPID_VIEWTREEONLY } ,
+ { IDM_VIEWDIRONLY ,HELPID_VIEWDIRONLY } ,
+ { IDM_VIEWSPLIT ,HELPID_VIEWSPLIT } ,
+ { IDM_VIEWALLFILEDETAILS ,HELPID_VIEWALLFILEDETAILS } ,
+ { IDM_VIEWSORTNAME ,HELPID_VIEWSORTNAME } ,
+ { IDM_VIEWSORTTYPE ,HELPID_VIEWSORTTYPE } ,
+ { IDM_VIEWSORTSIZE ,HELPID_VIEWSORTSIZE } ,
+ { IDM_VIEWSORTDATE ,HELPID_VIEWSORTDATE } ,
+ { IDM_VIEWFONT ,HELPID_VIEWFONTS } ,
+
+ { IDM_OPERATIONSBACKUP ,HELPID_OPERATIONSBACKUP } ,
+ { IDM_OPERATIONSRESTORE ,HELPID_OPERATIONSRESTORE } ,
+ { IDM_OPERATIONSTRANSFER ,HELPID_OPERATIONSTRANSFER } ,
+ { IDM_OPERATIONSVERIFY ,HELPID_OPERATIONSVERIFY } ,
+ { IDM_OPERATIONSINFO ,HELPID_OPERATIONSINFO } ,
+ { IDM_OPERATIONSCATALOG ,HELPID_OPERATIONSCATALOG } ,
+ { IDM_OPERATIONSCATMAINT ,HELPID_OPERATIONSCATMAINT } ,
+ { IDM_OPERATIONSSEARCH ,HELPID_OPERATIONSSEARCH } ,
+ { IDM_OPERATIONSNEXTSET ,HELPID_OPERATIONSNEXTSET } ,
+ { IDM_OPERATIONSEJECT ,HELPID_OPERATIONSEJECT } ,
+ { IDM_OPERATIONSERASE ,HELPID_OPERATIONSERASE } ,
+ { IDM_OPERATIONSRETENSION ,HELPID_OPERATIONSRETENSION } ,
+ { IDM_OPERATIONSCONNECT ,HELPID_OPERATIONSCONNECT } ,
+ { IDM_OPERATIONSDISCON ,HELPID_OPERATIONSDISCON } ,
+ { IDM_OPERATIONSFORMAT ,HELPID_OPERATIONSFORMAT } ,
+
+ { IDM_SELECTCHECK ,HELPID_SELECTCHECK } ,
+ { IDM_SELECTUNCHECK ,HELPID_SELECTUNCHECK } ,
+ { IDM_SELECTADVANCED ,HELPID_SELECTADVANCED } ,
+ { IDM_SELECTSUBDIRS ,HELPID_SELECTSUBDIRS } ,
+ { IDM_SELECTSAVE ,HELPID_SELECTSAVE } ,
+ { IDM_SELECTUSE ,HELPID_SELECTUSE } ,
+ { IDM_SELECTDELETE ,HELPID_SELECTDELETE } ,
+ { IDM_SELECTCLEAR ,HELPID_SELECTCLEAR } ,
+
+ { IDM_SETTINGSGENERAL ,HELPID_SETTINGSGENERAL } ,
+ { IDM_SETTINGSBACKUP ,HELPID_SETTINGSBACKUP } ,
+ { IDM_SETTINGSRESTORE ,HELPID_SETTINGSRESTORE } ,
+ { IDM_SETTINGSLOGGING ,HELPID_SETTINGSLOGGING } ,
+ { IDM_SETTINGSNETWORK ,HELPID_SETTINGSNETWORK } ,
+ { IDM_SETTINGSCATALOG ,HELPID_SETTINGSCATALOG } ,
+ { IDM_SETTINGSHARDWARE ,HELPID_SETTINGSHARDWARE } ,
+ { IDM_SETTINGSDEBUGWINDOW ,HELPID_SETTINGSDEBUGWINDOW } ,
+
+ { IDM_WINDOWSCASCADE ,HELPID_WINDOWSCASCADE } ,
+ { IDM_WINDOWSTILE ,HELPID_WINDOWSTILE } ,
+ { IDM_WINDOWSREFRESH ,HELPID_WINDOWSREFRESH } ,
+ { IDM_WINDOWSCLOSEALL ,HELPID_WINDOWSCLOSEALL } ,
+ { IDM_WINDOWSARRANGEICONS ,HELPID_WINDOWSARRANGEICONS } ,
+
+ { IDM_HELPINDEX ,HELPID_HELPINDEX } ,
+ { IDM_HELPSEARCH ,HELPID_HELPSEARCH } ,
+ { IDM_HELPUSINGHELP ,HELPID_HELPUSINGHELP } ,
+ { IDM_HELPABOUTWINTERPARK ,HELPID_HELPABOUTWINTERPARK } ,
+ { 0 , 0 }
+
+#endif // else !defined ( OEM_MSOFT ) - alternate help tables
+} ;
+
+
+/****************************************************************************
+
+ Name: HM_Init
+
+ Description: This function will establish a window hook to
+ the Winter Park task.
+
+ Modified: 6/25/1991
+
+ Returns: 0
+
+ Notes:
+ This function should only be called only once.
+ See also:
+
+****************************************************************************/
+
+VOID HM_Init ( VOID )
+
+{
+
+ mwfHelp = FALSE ;
+
+ HM_MakeHelpPathName(mwszHelpFilename);
+
+ mwhHelpCursor = RSM_CursorLoad( IDRC_HELP );
+
+ mwlpFilterFunc = (FARPROC)MakeProcInstance( (FARPROC)HM_DialogFilter, ghInst ) ;
+
+ mwlpfnNextHook = (FARPROC)SetWindowsHook( WH_MSGFILTER, (HOOKPROC)mwlpFilterFunc ) ;
+
+}
+
+
+
+
+/****************************************************************************
+
+ Name: HM_Deinit
+
+ Description: This function will unhook the help window hook to
+ the Winter Park task.
+
+ Modified: 6/25/1991
+
+ Returns: none
+
+****************************************************************************/
+
+VOID HM_Deinit ( VOID )
+
+{
+
+ UnhookWindowsHook( WH_MSGFILTER, (HOOKPROC)mwlpFilterFunc ) ;
+
+ FreeProcInstance( mwlpFilterFunc ) ;
+
+}
+
+
+
+/****************************************************************************
+
+ Name: HM_DialogFilter
+
+ Description: This function will filter all dialog messages, looking
+ for the pressing of a F1 key. If the F1 key has been
+ found to be pressed, then the help subsystem is called.
+
+ Modified: 6/25/1991
+
+ Returns: 1 if message was processed and should be discarded.
+ 0 if message was not processed and should be processed
+ by windows.
+
+ Notes:
+ This function is called by Windows 3.0 directly.
+
+ See also:
+
+****************************************************************************/
+
+INT APIENTRY HM_DialogFilter(
+
+ INT nCode , /* Specifies the type of message being processed.*/
+ MP1 mp1, /* Specifies a NULL value. */
+ MP2 mp2 ) /* Points to the message structure. */
+
+{
+ LPMSG lpMessage ;
+ WORD wMsgProcessed = FALSE ;
+ DWORD dwResult ;
+
+ /* Under Windows, nCode specifies whether the filter function
+ should process the message or call the DefHookProc function.
+ If this value is less than zero, the filter function should
+ pass the message to DefHookProc without further processing.
+ */
+
+ if ( nCode < 0 ) {
+ dwResult = DefHookProc ( nCode, (DWORD)mp1, (LONG)mp2, (VOID **)mwlpfnNextHook ) ;
+ return ( TRUE ) ;
+ }
+
+ /* If the message is for a dialogbox, intercept the processing
+ of a F1 key stroke to activate the help subsystem.
+ */
+
+ if ( nCode == MSGF_DIALOGBOX ) {
+
+ lpMessage = (LPMSG) mp2 ;
+
+ switch ( lpMessage->message ) {
+
+ case WM_KEYDOWN:
+
+ if (lpMessage->wParam == VK_F1) {
+
+ /* If F1 or shift F1, then call up the appropiate help
+ Post to frame procedure
+ */
+
+ mwfHelp = FALSE ;
+ wMsgProcessed = TRUE ;
+
+ // Post a Help button message to the dialog.
+ // The lpMessage->hwnd is the handle of the control that has focus
+ // in the dialog. Use the parent of this control to obtain the
+ // dialog's handle.
+ if (ghWndCommonDlg == 0)
+ {
+ PostMessage ( GetParent( lpMessage->hwnd ), WM_COMMAND, IDHELP, (MP2)NULL );
+ } else
+ {
+ PostMessage ( ghWndCommonDlg, WM_COMMAND, IDHELP, (MP2)NULL );
+ }
+ }
+
+ break ;
+ }
+
+ }
+
+ return( wMsgProcessed ) ;
+
+}
+
+
+
+/****************************************************************************
+
+ Name: HM_FindHelpId
+
+ Description: This function will return the HELPID value for
+ a given Menu item.
+
+ Modified: 6/25/1991
+
+ Returns: Non zero if the dialog has an associated HELPID.
+ 0 if the dialog has no associated HELPID.
+
+ Notes:
+ This function is called only by the Help Manager.
+
+ See also:
+
+****************************************************************************/
+
+WORD HM_FindHelpId(
+
+WORD wMenuId ) /* I - Menu Id */
+
+{
+
+ WORD wHelpId = 0 ;
+ BOOL fFound = FALSE ;
+ WORD i = 0 ;
+
+ /* Scan the MenuId Table for the MenuId
+ Last Entry is NULL to designate end of table
+ */
+
+ while ( ( HelpIdMenuIdTable[ i ].wMenuId ) && ( !fFound ) ) {
+
+ if ( HelpIdMenuIdTable[ i ].wMenuId == wMenuId ) {
+
+ wHelpId = HelpIdMenuIdTable[i].wHelpId ;
+ fFound = TRUE ;
+ }
+
+ i++ ;
+ }
+
+
+ // If not found, then check to see if it is a log file selection
+ // or an MDI document selection.
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if ( fFound == FALSE ) {
+
+ if ( ( wMenuId >= IDM_WINDOWSFIRSTCHILD ) && ( wMenuId < IDM_JOBSFIRSTJOB ) ) {
+ wHelpId = HELPID_MDISELECT ;
+ }
+
+ if ( ( wMenuId >= IDM_JOBSFIRSTJOB ) && ( wMenuId <= IDM_JOBSLASTJOB ) ) {
+
+ wHelpId = HELPID_JOBSELECT ;
+ }
+ }
+ }
+# else //!defined ( OEM_MSOFT )
+
+ {
+ if ( fFound == FALSE ) {
+
+ // To identify the drives and tape windows.
+
+ if ( ( wMenuId >= IDM_WINDOWSFIRSTCHILD ) ) {
+ wHelpId = IDH_MENU_WINDOWSNAMES ;
+ }
+
+ }
+ }
+# endif
+
+
+ return ( wHelpId ) ;
+}
+
+
+/****************************************************************************
+
+ Name: HM_MakeHelpPathName
+
+ Description: This function will return the full path name
+ of the help file for Winter Park.
+
+ Modified: 6/25/1991
+
+ Returns: file name
+
+ Notes:
+ This function is called only by the Help Manager at
+ initialization time.
+
+ See also:
+
+****************************************************************************/
+
+
+VOID HM_MakeHelpPathName(
+
+LPSTR szFileName ) /* O - File name */
+
+{
+ CHAR * pcFileName;
+ INT nFileNameLen;
+ CHAR szFname[ NAME_MAX_SIZE+1 ] ;
+
+ nFileNameLen = GetModuleFileName( ghInst,szFileName,NAME_MAX_SIZE);
+ pcFileName = szFileName + nFileNameLen;
+
+
+ /* With the full directory name, traverse backwards to strip off
+ the file name.
+ */
+
+ while (pcFileName > szFileName) {
+ if (*pcFileName == TEXT('\\') || *pcFileName == TEXT(':')) {
+ *(++pcFileName) = TEXT('\0');
+ break;
+ }
+ nFileNameLen--;
+ pcFileName--;
+ }
+
+ /* Check to see if possible path name can fit into internal buffer
+ of NAME_MAX_SIZE size.
+ */
+
+ if ((nFileNameLen+13) < NAME_MAX_SIZE) {
+
+ RSM_StringCopy( IDS_HMHELPFILENAME , szFname, NAME_MAX_SIZE ) ;
+ lstrcat(szFileName, szFname ) ;
+ }
+
+ else { /* Set the Help file name to NULL */
+ /* if not found */
+ lstrcpy(szFileName, TEXT(""));
+ }
+
+ /* On return, szFileName will contain the full path name of help file
+ for WinterPark or will be NULL.
+ */
+
+ return;
+}
+
+
+/****************************************************************************
+
+ Name: HM_WMCommandProcessing
+
+ Description: This function will return TRUE if the ID specified
+ by the WM_COMMAND message is a menu item.
+
+
+ Modified: 7/12/1991
+
+ Returns: TRUE if selection was processed.
+ FALSE if selection was not processed.
+
+****************************************************************************/
+
+BOOL HM_WMCommandProcessing (
+
+ HWND hWnd, /* I - Window handle */
+ WORD wId ) /* I - Menu Id */
+
+{
+ BOOL fProcessedCommand ;
+ DWORD dwHelpContextId ;
+
+ fProcessedCommand = FALSE ;
+
+ /*
+ If mwfHelp is non-zero, then WinterPark is in the context sensitive
+ mode. Either the user has pressed the F1 key while making a menu selection
+ or the user pressed SHIFT-F1.
+
+ Under OEM_MSOFT, mwfHelp is non-zero only when the user has pressed
+ the F1 key while making a menu selection. Also the sysmenu help
+ is all in IDH_SYSMENU, so entries were not put in the menu id table.
+
+ */
+
+ if ( mwfHelp ) {
+
+ dwHelpContextId = (DWORD) HM_FindHelpId( wId ) ;
+
+ fProcessedCommand = TRUE ;
+ mwfHelp = FALSE ;
+
+# if defined ( OEM_MSOFT ) // Use IDH_SYSMENU if appropiate
+ {
+ WORD wSaveId ;
+ wSaveId = wId & 0xfff0 ;
+
+ if ( ( wSaveId >= SC_SIZE ) && ( wSaveId <= SC_HOTKEY ) ) {
+
+ HM_WinHelp ( hWnd, HELP_CONTEXT, IDH_SYSMENU );
+ return( fProcessedCommand ) ;
+ }
+
+ }
+# endif
+
+ // Bring up the Help Context if the ID was found in the table.
+ // Otherwise, bring up the Help Index.
+
+ if ( dwHelpContextId ) {
+ HM_WinHelp ( hWnd, HELP_CONTEXT, dwHelpContextId );
+ }
+ else {
+// HM_WinHelp ( hWnd, HELP_INDEX, 0L );
+ HM_WinHelp ( hWnd, HELP_FINDER, 0L );
+ }
+
+ }
+
+ return ( fProcessedCommand ) ;
+
+}
+
+
+/****************************************************************************
+
+ Name: HM_WinHelp
+
+ Description: This function will call 'WinHelp' if the help file
+ for WinterPark exists.
+
+ Modified: 7/15/1991
+
+ Returns: none
+
+ Notes: If WinterPark's help file does not exist, then the user
+ is notified by way of a message box.
+
+ See also:
+
+****************************************************************************/
+
+VOID HM_WinHelp (
+
+HWND hWnd , /* I - Window handle. */
+WORD wCommand, /* I - Type of Help requested. */
+DWORD dwData ) /* I - Context or key work of the help requested. */
+
+{
+ CHAR szFile [ NAME_MAX_SIZE + 1 ] ;
+ CHAR szString [ NAME_MAX_SIZE + 1 ] ;
+ CHAR szOutput [ NAME_MAX_SIZE + 1 ] ;
+
+ /* Check for existence of help file */
+
+ if ( access ( mwszHelpFilename, 0 ) == -1 ) {
+ RSM_StringCopy( IDS_HMHELPFILENAME, szFile, NAME_MAX_SIZE ) ;
+ strupr ( szFile ) ;
+ RSM_StringCopy( IDS_HMNOHELPFILE, szString, NAME_MAX_SIZE ) ;
+ wsprintf( szOutput, szString, szFile ) ;
+ MessageBox( hWnd, szOutput,NULL, MB_ICONINFORMATION | MB_OK ) ;
+ } else {
+
+ // Set the status bar to Ready.
+
+ WinHelp( hWnd, mwszHelpFilename,wCommand,dwData );
+ }
+}
+
+
+/****************************************************************************
+
+ Name: HM_MenuCommands
+
+ Description: This function will process one of the help
+ menu selections
+
+ IDM_HELPINDEX
+ IDM_HELPSEARCH
+ IDM_HELPUSINGHELP
+
+
+ Modified: 7/15/1991
+
+ Returns: none
+
+****************************************************************************/
+
+VOID HM_MenuCommands (
+
+ HWND hWnd , /* I - Window handle */
+ WORD wId ) /* I - Menu ID selection */
+
+{
+ CHAR szString[ NAME_MAX_SIZE + 1 ] ;
+
+ switch ( wId ) {
+
+ case IDM_HELPSEARCH :
+
+ strcpy( szString, TEXT("") ) ;
+ HM_WinHelp ( hWnd, HELP_PARTIALKEY, (DWORD) szString );
+
+ break;
+
+ case IDM_HELPINDEX :
+
+// HM_WinHelp ( hWnd, HELP_INDEX, 0L);
+ HM_WinHelp ( hWnd, HELP_FINDER, 0L);
+ break;
+
+
+ case IDM_HELPUSINGHELP :
+
+ {
+ CHAR szFormat [ NAME_MAX_SIZE + 1 ] ;
+ CHAR szOutput [ NAME_MAX_SIZE + 1 ] ;
+
+
+ GetSystemDirectory( szString, NAME_MAX_SIZE ) ;
+ strcat( szString,TEXT("\\") ) ;
+ RSM_StringCopy( IDS_HMUSINGHELPFILENAME,szOutput, NAME_MAX_SIZE ) ;
+ strcat( szString, szOutput ) ;
+
+ // Check for existence of supplied 'Using Help' .HLP file.
+
+ if ( access ( szString, 0 ) == -1 ) {
+ RSM_StringCopy( IDS_HMNOHELPFILE, szFormat, NAME_MAX_SIZE ) ;
+ strupr ( szString ) ;
+ wsprintf( szOutput, szFormat, szString ) ;
+ MessageBox( hWnd, szOutput,NULL, MB_ICONINFORMATION | MB_OK ) ;
+ } else {
+ WinHelp(hWnd, szString,HELP_INDEX,0L);
+ }
+ }
+
+ }
+
+}
+
+/****************************************************************************
+
+ Name: HM_ContextLbuttonDown
+
+ Description: This function will process the WM_LBUTTONDOWN
+ message from a window. If the user is in the
+ Help Context Sensitive Mode (Shift-F1), then the
+ message is processed.
+
+ Modified: 7/15/1991
+
+ Returns: TRUE if message processed
+ FALSE if message not processed
+
+ Notes:
+
+ See also:
+
+****************************************************************************/
+
+BOOL HM_ContextLbuttonDown (
+
+HWND hWnd , /* I - Window handle */
+MP1 mp1 , /* I - Virtual key down. */
+MP2 mp2 ) /* I - x-y coordinates of cursor, relative to */
+ /* the upper-left corner of the window */
+
+{
+
+ BOOL wMsgProcessed = FALSE ;
+ POINT pt ;
+ HWND hWindow ;
+ CHAR szClass[ NAME_MAX_SIZE + 1 ] ;
+ DWORD dwHelpContextId ;
+ BYTE fStatusLine ;
+
+ RECT FrameRect ;
+ RECT ClientRect ;
+
+ POINT ptFrameLeft ;
+ POINT ptFrameRight ;
+ POINT ptClient ;
+ POINT ptBelowCaption ;
+
+ WORD wCaptionHeight ;
+ WORD wMenuHeight ;
+ WORD wMenuIconWidth ;
+
+ INT nPosxFrame ;
+ INT nPosyFrame ;
+ RECT rectFrame ;
+
+ UNREFERENCED_PARAMETER ( mp1 );
+
+#if defined ( OEM_MSOFT )
+
+ // OEM_MSOFT does not support context-sensitive
+ // help processing.
+
+ // Return a FALSE always.
+
+ mwfHelp = FALSE ;
+
+#endif
+
+ if (mwfHelp) {
+
+ /* Get rid of all MOUSE messages. This will ignore
+ WM_LBUTTONDOWNs and WM_LBUTTONDBLCLKs.
+ */
+
+
+ {
+ MSG msg ;
+ PeekMessage( &msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ) ;
+ }
+
+ mwfHelp = FALSE;
+ fStatusLine = FALSE ;
+
+ ReleaseCapture() ;
+
+ pt.x = LOWORD( mp2 ) ;
+ pt.y = HIWORD( mp2 ) ;
+
+ if ( CDS_GetShowStatusLine ( CDS_GetPerm () ) ) {
+ if ( PtInRect( &gpStatusRect, pt ) )
+ {
+ fStatusLine = TRUE ;
+ }
+ }
+
+
+ wCaptionHeight = (WORD)GetSystemMetrics( SM_CYCAPTION ) ;
+ wMenuHeight = (WORD)GetSystemMetrics( SM_CYMENU ) ;
+
+ wMenuIconWidth = (WORD)GetSystemMetrics( SM_CXSIZE ) ;
+
+ ClientToScreen( hWnd, &pt ) ;
+
+ hWindow = WindowFromPoint( pt ) ;
+
+ GetClassName ( hWindow, szClass, NAME_MAX_SIZE ) ;
+
+ /* Check to see the class of window it is.
+
+ WMCLASS_FRAME TEXT("frame") // Class name for the frame window.
+ WMCLASS_CLIENT TEXT("mdiclient") // Class name for the MDI client window.
+ WMCLASS_DOC TEXT("doc") // Class name for MDI document windows.
+ WMCLASS_RIBBON TEXT("ribbon") // Class name for the ribbon windows.
+ WMCLASS_LISTBOX TEXT("listbox") // Class name for the list box windows.
+ WMCLASS_VIEWWIN TEXT("Viewwin") // Class name for the log view window.
+
+
+ */
+
+#if defined ( OS_WIN32 )
+
+ if ( !hWindow ) {
+ strcpy( szClass, WMCLASS_FRAME ) ;
+
+ // With NT any pt in the menu area and above is 65535 +
+ // the real pt value in reference to the frame.
+
+ pt.y = pt.y - 65535 ; // Magic constant.
+ }
+#endif
+
+
+ dwHelpContextId = (DWORD) HELPID_FRAME_WINDOW ;
+
+ if ( !lstrcmpi( WMCLASS_FRAME, szClass ) ) {
+
+ GetClientRect ( ghWndMDIClient, &ClientRect ) ;
+ ptClient.x = ClientRect.left ;
+ ptClient.y = ClientRect.top ;
+ ClientToScreen( ghWndMDIClient, &ptClient ) ;
+
+ GetClientRect ( ghWndFrame, &FrameRect ) ;
+ ptFrameLeft.x = FrameRect.left ;
+ ptFrameLeft.y = FrameRect.top ;
+ ClientToScreen( ghWndFrame, &ptFrameLeft ) ;
+
+ ptFrameRight.x = FrameRect.right ;
+ ptFrameRight.y = FrameRect.bottom ;
+ ClientToScreen( ghWndFrame, &ptFrameRight ) ;
+
+ /* Get the screen position of the frame window. */
+
+ GetWindowRect( ghWndFrame, &rectFrame ) ;
+ nPosxFrame = rectFrame.left;
+ nPosyFrame = rectFrame.top ;
+
+ /* If application not zoomed, then add Frame height to
+ origin of frame.
+ */
+
+ if ( !IsZoomed( ghWndFrame ) ) {
+ nPosyFrame += ( INT ) GetSystemMetrics( SM_CYFRAME ) ;
+ }
+
+ /* Calculate the top point of the menu. */
+
+ ptBelowCaption = ptFrameLeft ;
+ ptBelowCaption.y = nPosyFrame+wCaptionHeight ;
+
+
+ // Check to see if in the Caption area.
+
+ if ( ( pt.x >= ptFrameLeft.x ) &&
+ ( pt.x <= ptFrameRight.x ) &&
+ ( pt.y >= nPosyFrame ) ) {
+
+
+ if ( pt.y < ptBelowCaption.y ) {
+
+ /* Must be in caption area.
+ Must not be in main icon and the minimize/maximize button
+ in the frame window.
+ */
+
+ if ( ( pt.x > (INT) (ptBelowCaption.x + (INT)wMenuIconWidth) ) &&
+ ( pt.x <= (INT) (ptFrameRight.x - 2*wMenuIconWidth ) ) ) {
+ dwHelpContextId = HELPID_TITLE_BAR ;
+ }
+
+ } else {
+
+ /* Check if in menu area.
+
+ When a DOC window is maximized, two bitmaps
+ reside on menu line
+ */
+
+ if ( pt.y < ptClient.y ) {
+
+ if ( IsZoomed( WM_GetActiveDoc() ) ) {
+ if ( ( pt.x <= (ptFrameRight.x - wMenuIconWidth) ) &&
+ ( pt.x > (INT) (ptBelowCaption.x + (INT) wMenuIconWidth ) ) ) {
+ dwHelpContextId = HELPID_SYSTEM_MENU ;
+ }
+ } else {
+ dwHelpContextId = HELPID_SYSTEM_MENU ;
+ }
+
+ } else {
+ if ( fStatusLine ) {
+ dwHelpContextId = (DWORD) HELPID_STATUSLINE ;
+ }
+ }
+ }
+ }
+ }
+
+ if ( !lstrcmpi( WMCLASS_CLIENT, szClass ) ) {
+ dwHelpContextId = (DWORD) HELPID_CLIENT_WINDOW ;
+ }
+
+# if !defined ( OEM_MSOFT )
+ {
+
+ if ( !lstrcmpi( WMCLASS_VIEWWIN, szClass ) ) {
+ dwHelpContextId = (DWORD) HELPID_LOGVIEW ;
+ }
+
+ }
+# endif
+
+ if ( !lstrcmpi( WMCLASS_DOC, szClass ) ) {
+ dwHelpContextId = (DWORD) HELPID_DOC_WINDOW ;
+
+ /* Get the window type */
+
+ HM_GetWindowClassHelpId( hWindow, (LPDWORD) &dwHelpContextId, (LPSTR) WMCLASS_DOC ) ;
+
+ }
+
+ if ( !lstrcmpi( WMCLASS_RIBBON, szClass ) ) {
+ dwHelpContextId = (DWORD) HELPID_RIBBON_WINDOW ;
+ }
+
+ if ( !lstrcmpi( WMCLASS_LISTBOX, szClass ) ) {
+
+ dwHelpContextId = (DWORD) HELPID_DOC_WINDOW ;
+
+ /* Get the window type */
+
+ HM_GetWindowClassHelpId( hWindow, (LPDWORD) &dwHelpContextId, (LPSTR) WMCLASS_LISTBOX ) ;
+
+
+ }
+
+ ClipCursor( NULL ) ;
+
+ HM_WinHelp( hWnd, HELP_CONTEXT, (DWORD) dwHelpContextId );
+
+ wMsgProcessed = TRUE ;
+
+ }
+
+ return ( wMsgProcessed ) ;
+}
+
+/****************************************************************************
+
+ Name: HM_GetDocWindowHelpId
+
+ Description: This function will return the Helpid associated
+ with the type of DOC window.
+
+
+ Modified: 7/15/1991
+
+ Returns: dwNewContextId if reassigned.
+
+ Notes: wClass will be either a DOC or LISTBOX.
+ Listboxes require extra processing to identify
+ the tree or flat part of the DOC window.
+
+ See also:
+
+****************************************************************************/
+
+VOID HM_GetWindowClassHelpId (
+
+HWND hWnd , /* I - Window handle */
+LPDWORD pdwNewContextId, /* O - Return value */
+LPSTR szClass ) /* I - Class of original window */
+
+{
+ PDS_WMINFO pWinInfo ;
+ HWND hParent ;
+ BYTE fWindowIsListbox = FALSE ;
+ WORD wType = 0 ;
+
+ wType = 0 ;
+
+ /* Supports only DOC and LISTBOX classes. */
+
+ if ( ( lstrcmpi( szClass, WMCLASS_DOC ) ) &&
+ ( lstrcmpi( szClass, WMCLASS_LISTBOX ) ) ) {
+
+ return ;
+ }
+
+ // If a listbox is clicked on, then get the parent DOC window
+
+ if ( lstrcmpi( szClass, WMCLASS_LISTBOX ) == 0 ) {
+ hParent = GetParent( hWnd ) ;
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hParent ) ;
+ fWindowIsListbox = TRUE ;
+
+ } else {
+ pWinInfo = (PDS_WMINFO) WM_GetInfoPtr( hWnd ) ;
+ }
+
+ switch ( pWinInfo->wType ) {
+
+
+ case WMTYPE_DISKS :
+
+ wType = HELPID_DISKS ;
+ break ;
+
+ case WMTYPE_TAPES :
+ wType = HELPID_TAPES ;
+ break ;
+
+ case WMTYPE_MACROS :
+ wType = HELPID_MACROS ;
+ break ;
+
+ case WMTYPE_JOBS :
+ wType = HELPID_JOBS ;
+ break ;
+
+ case WMTYPE_DISKTREE :
+ case WMTYPE_TAPETREE :
+
+ wType = HELPID_DISKTREE ;
+
+ /* If the mouse was clicked in a listbox,
+ then select the left or right listbox in doc window.
+ */
+
+ if ( fWindowIsListbox ) {
+ if ( pWinInfo->hWndTreeList == hWnd ) {
+ wType = HELPID_DISKTREELEFT ;
+ } else {
+ wType = HELPID_DISKTREERIGHT ;
+ }
+ }
+ break ;
+
+
+ case WMTYPE_SERVERS :
+
+ wType = HELPID_SERVERS ;
+
+ /* If the mouse was clicked in a listbox,
+ then select the left or right listbox in doc window.
+ */
+
+ if ( fWindowIsListbox ) {
+ if ( pWinInfo->hWndTreeList == hWnd ) {
+ wType = HELPID_SERVERLEFT ;
+ } else {
+ wType = HELPID_SERVERRIGHT ;
+ }
+ }
+
+ break ;
+
+# if !defined ( OEM_MSOFT )
+ {
+ case WMTYPE_LOGVIEW :
+
+ wType = HELPID_LOGVIEW ;
+ break ;
+ }
+# endif
+
+ case WMTYPE_LOGFILES :
+
+ wType = HELPID_LOGFILES ;
+ break ;
+
+ case WMTYPE_DEBUG :
+ wType = HELPID_DEBUG ;
+ break ;
+
+ case WMTYPE_SEARCH :
+ wType = HELPID_SEARCH ;
+ break ;
+
+ }
+
+ if ( wType ) {
+ *pdwNewContextId = (DWORD) wType ;
+ }
+
+}
+
+/****************************************************************************
+
+ Name: HM_KeyDown
+
+ Description: This function will process the WM_KEYDOWN
+ message from a window. If Shift-F1, help mode is turned on
+ and the cursor is set to the help cursor.
+
+ Modified: 7/15/1991
+
+ Returns: TRUE if message processed
+ FALSE if message not processed
+
+****************************************************************************/
+
+BOOL HM_KeyDown (
+
+HWND hWnd , /* I - Window handle */
+MP1 mp1 ) /* I - Additional information of message */
+{
+ BOOL wMsgProcessed = FALSE ;
+ RECT rectFrame ;
+
+# if defined ( OEM_MSOFT )
+
+ // OEM_SOFT does not have context sensitive help
+
+ if (mp1 == VK_F1) {
+ wMsgProcessed = TRUE ;
+// HM_WinHelp(hWnd,HELP_INDEX,0L);
+ HM_WinHelp(hWnd,HELP_FINDER,0L);
+ }
+
+# else
+
+ if (mp1 == VK_F1) {
+
+ /* If Shift-F1, turn help mode on and set help cursor. */
+
+ wMsgProcessed = TRUE ;
+
+ if (GetKeyState(VK_SHIFT)<0) {
+ mwfHelp = TRUE;
+ RSM_CursorSet ( mwhHelpCursor);
+ SetCapture( ghWndFrame ) ;
+ GetWindowRect( ghWndFrame, &rectFrame ) ;
+ ClipCursor( &rectFrame ) ;
+ } else {
+
+ /* F1 is without shift.
+ Call up the help main index topic
+ */
+
+ HM_WinHelp(hWnd,HELP_INDEX,0L);
+ }
+ } else if (mp1 == VK_ESCAPE && mwfHelp) {
+
+ /* Escape during help mode: turn help mode off */
+
+ mwfHelp = FALSE;
+ ReleaseCapture() ;
+ ClipCursor( NULL ) ;
+ wMsgProcessed = TRUE ;
+
+ RSM_CursorSet ( WM_GetClassCursor ( hWnd ) );
+ }
+
+# endif
+
+ return ( wMsgProcessed ) ;
+}
+
+/****************************************************************************
+
+ Name: HM_SetCursor
+
+ Description: In help mode it is necessary to reset the cursor in response
+ to every WM_SETCURSOR message.Otherwise, by default, Windows
+ will reset the cursor to that of the window class.
+
+ Modified: 7/15/1991
+
+ Returns: TRUE if message processed
+ FALSE if message not processed
+
+ Notes: Under OEM_MSOFT never set the cursor.
+
+
+****************************************************************************/
+
+BOOL HM_SetCursor (
+
+ HWND hWnd ) /* I - Handle to window */
+
+{
+ BOOL wMsgProcessed = FALSE ;
+
+ DBG_UNREFERENCED_PARAMETER ( hWnd );
+
+# if defined ( OEM_MSOFT )
+# else
+
+ if (mwfHelp) {
+ wMsgProcessed = TRUE ;
+ RSM_CursorSet ( mwhHelpCursor);
+ }
+# endif
+
+ return ( wMsgProcessed ) ;
+
+}
+/****************************************************************************
+
+ Name: HM_InitMenu
+
+ Description: This function will set the cursor to the help cursor
+ if the help mode is set.
+
+ Modified: 7/15/1991
+
+ Returns: none
+
+ Notes: This function is called on a WM_INITMENU, a message sent
+ before windows displays a menu.
+
+ Under OEM_MSOFT never set the cursor.
+
+****************************************************************************/
+
+VOID HM_InitMenu ( VOID )
+
+{
+
+# if defined ( OEM_MSOFT )
+# else
+
+ if (mwfHelp) {
+ RSM_CursorSet ( mwhHelpCursor);
+ }
+# endif
+
+}
+
+/****************************************************************************
+
+ Name: HM_EnterIdle
+
+ Description: The function will bring up the help window when a
+ a menu item is selected and the F1 key is pressed.
+
+ Modified: 7/15/1991
+
+ Returns: none.
+
+ Notes: This function is called by the frame window's procedure.
+ when a HM_ENTERIDLE message is encountered.
+
+****************************************************************************/
+
+BOOL HM_EnterIdle (
+
+HWND hWnd , /* I - Handle to window */
+MP1 mp1 , /* I - Additional information of message */
+WORD wLastMenuID , /* I - Menu ID */
+WORD wLastMenuState ) /* I - Menu State (grayed or not) */
+
+{
+ BOOL wMsgProcessed = FALSE ;
+
+ if ((mp1 == MSGF_MENU) && (GetKeyState(VK_F1) & 0x8000)) {
+
+ wMsgProcessed = TRUE;
+ mwfHelp = TRUE;
+
+ /* IF the status of the menu ID is grayed,
+ ** BEGIN
+ ** .
+ ** . Call HM_WMCommandProcessing to simulate processing
+ ** . the menu command, since the system will not generate
+ ** . a message for a grayed selection.
+ ** .
+ ** . END
+ ** END
+ */
+
+ if ( wLastMenuState & MF_GRAYED ) {
+ HM_WMCommandProcessing( hWnd, wLastMenuID );
+ } else {
+ PostMessage(hWnd, WM_KEYDOWN, VK_RETURN, 0L);
+ }
+
+ }
+
+ return ( wMsgProcessed );
+}
+
+/****************************************************************************
+
+ Name: HM_CloseHelpWindow
+
+ Description: The function will close the Help application window.
+
+ Modified: 7/15/1991
+
+ Returns: none.
+
+ Notes: This function is called only once by the application when
+ exiting.
+
+****************************************************************************/
+
+VOID HM_CloseHelpWindow (
+
+HWND hWnd ) /* I - Handle to window */
+
+{
+ OFSTRUCT OfStruct ;
+
+ if ( access ( mwszHelpFilename, 0 ) != -1 ) {
+ HM_WinHelp(hWnd,HELP_QUIT,0L);
+ }
+}
+
diff --git a/private/utils/ntbackup/src/hexefile.bmp b/private/utils/ntbackup/src/hexefile.bmp
new file mode 100644
index 000000000..56b1726ca
--- /dev/null
+++ b/private/utils/ntbackup/src/hexefile.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/hfile.bmp b/private/utils/ntbackup/src/hfile.bmp
new file mode 100644
index 000000000..3a30de5d9
--- /dev/null
+++ b/private/utils/ntbackup/src/hfile.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/hslider.cur b/private/utils/ntbackup/src/hslider.cur
new file mode 100644
index 000000000..58e322884
--- /dev/null
+++ b/private/utils/ntbackup/src/hslider.cur
Binary files differ
diff --git a/private/utils/ntbackup/src/hwcheck.c b/private/utils/ntbackup/src/hwcheck.c
new file mode 100644
index 000000000..1add90812
--- /dev/null
+++ b/private/utils/ntbackup/src/hwcheck.c
@@ -0,0 +1,258 @@
+
+/*****************************************************************************
+Copyright(c) Maynard, an Archive Company. 1991
+
+ Name: hwcheck.c
+
+ Description: Functions used for checking hardware status prior to
+ starting a tape operation.
+
+ $Log: G:\UI\LOGFILES\HWCHECK.C_V $
+
+ Rev 1.6.1.0 27 Jan 1994 17:01:38 Glenn
+Expanded list box horiz extent by 5 percent.
+
+ Rev 1.6 01 Nov 1992 15:59:08 DAVEV
+Unicode changes
+
+ Rev 1.5 07 Oct 1992 14:08:54 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.4 04 Oct 1992 19:37:52 DAVEV
+Unicode Awk pass
+
+ Rev 1.3 14 May 1992 18:00:32 MIKEP
+nt pass 2
+
+ Rev 1.2 19 Mar 1992 16:48:12 GLENN
+Added enhanced status support.
+
+ Rev 1.1 04 Feb 1992 14:42:46 DAVEV
+fixes to insure proper types for NT
+
+ Rev 1.0 31 Jan 1992 17:58:42 GLENN
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: HWC_TapeHWProblem()
+
+ Description: Checks the current status of each DIL_HWD structure for
+ any previous unsuccessful initialization attempts. If
+ any error is found, a generic message is displayed
+ informing the user that we will automatically retry
+ the tape related hardware. If an error is still found,
+ HWC_ReportDiagError is called to handle reporting the
+ error.
+
+ Returns: SUCCESS for no problem found
+ FAILURE for problems still found
+
+*****************************************************************************/
+
+BOOL HWC_TapeHWProblem (
+ BSD_HAND pBSDList )
+{
+ BOOL fResult = SUCCESS;
+ BE_INIT_STR pBE;
+ INT16 nErrorTFL;
+ INT16 nError;
+ BSD_PTR pBSD;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ /* Check current init status and re-test tape controller hardware if necessary */
+
+ if ( ( thw_list == NULL ) ||
+ ( HWC_ProcessDILHWD ( HW_RET_ERROR, gb_dhw_ptr ) == HW_ERROR_DETECTED ) ||
+ ( CDS_GetAdvToConfig ( pCDS ) ) ||
+ ( ! gfHWInitialized ) ) {
+
+ // Guarantee that Poll Drive is turned off. Poll Drive
+ // cannot be turned on while reinitializing.
+
+ PD_StopPolling ();
+
+ // Re-init the Tape Format layer and check for potential return errors.
+
+ {
+ CHAR szTemp[MAX_STATUS_LINE_SIZE];
+
+ // Save the old status line, put up the init hardware
+ // status, init the hardware, then restore the old
+ // status line.
+
+ strcpy ( szTemp, STM_GetStatusLineText () );
+
+ nErrorTFL = UI_UnitsInit ( &pBE, REINIT_TFL );
+
+ STM_SetStatusLineText ( szTemp );
+ STM_DrawIdle ();
+ }
+
+ HWC_ReportDiagError ( &pBE, nErrorTFL, &nError );
+
+ if ( ( HWC_ProcessDILHWD ( HW_RET_ERROR, gb_dhw_ptr ) == HW_ERROR_DETECTED ) || nErrorTFL ) {
+
+ gfHWInitialized = FALSE;
+
+ fResult = FAILURE;
+
+ }
+ else {
+
+ gfHWInitialized = TRUE;
+
+ // Restart poll drive.
+
+ PD_StartPolling ();
+
+ // Make sure that any existing BSDs have a valid THW.
+
+ pBSD = BSD_GetFirst ( pBSDList );
+
+ while ( pBSD != NULL ) {
+ BSD_SetTHW ( pBSD, thw_list );
+ pBSD = BSD_GetNext ( pBSD );
+ }
+
+ fResult = SUCCESS;
+
+ CDS_SetAdvToConfig ( pCDS, FALSE );
+ CDS_UpdateCopy ( );
+
+ }
+
+ }
+
+ return fResult;
+
+} /* end HWC_TapeHWProblem() */
+
+/*****************************************************************************
+
+ Name: HWC_ReportDiagError()
+
+ Description: Produces "Help" based message on screen for Tmenu for
+ diagnostic errors reported by BE_Init. A call is made
+ to the HW config unit to process any errors he is
+ sensitive to. Any help related messages provided herein
+ are from error conditions directly determined by
+ UI_UnitsInit (such as no controllers located).
+
+
+ Returns: FAILURE for those conditions that should result in
+ immediate program termination
+
+*****************************************************************************/
+
+VOID HWC_ReportDiagError (
+
+BE_INIT_STR_PTR pBE,
+INT16 nErrorBE,
+INT16_PTR pnError )
+
+{
+
+ CDS_PTR pCDS = CDS_GetPerm( );
+
+ /* map returned error value to help message and display */
+
+ switch ( nErrorBE ) {
+
+ case TFLE_NO_MEMORY:
+ case BE_FILE_SYS_FAIL:
+ case BE_BSDU_FAIL:
+ *pnError = FAILURE;
+ /* falling through to report out of memory */
+ case OUT_OF_MEMORY :
+ eresprintf( RES_OUT_OF_MEMORY );
+ break;
+
+ case BENGINE_IN_USE:
+ *pnError = FAILURE;
+ eresprintf( RES_BENGINE_IN_USE );
+ break;
+
+ /* device driver load failure */
+ case TFLE_DRIVER_LOAD_FAILURE:
+ case TFLE_DRIVER_FAILURE:
+
+ HWC_ProcessError ( HW_DISP_ERROR, IDS_HWC_TESTED_BAD, DRIVER_LOAD_FAILURE, 0, pCDS );
+ break;
+
+ /* no controller found */
+ case UI_NO_CONTROLLERS:
+
+ HWC_ProcessError ( HW_DISP_ERROR, IDS_HWC_TESTED_BAD, UI_NO_CONTROLLERS, 0, pCDS );
+ break;
+
+ /* A hardware configuration error was found, handle it... */
+ case HW_ERROR_NO_RES_FILE:
+ eresprintf( RES_MISSING_HW_RESOURCE, CDS_GetActiveDriver( pCDS ), TEXT(".RES") );
+ break;
+
+ case HW_INVALID_PARM:
+ /* this should not happen, unless the HW resource and device
+ driver files get out of sync and new acceptable values
+ within the driver are defined that the resource file does
+ not know about */
+ eresprintf( RES_INCONSISTENT_HW_PARMS );
+ break;
+
+ case HW_UNKNOWN_ERROR:
+ eresprintf( RES_UNKNOWN_HW_ERR );
+ break;
+
+ case BE_INIT_SUCCESS:
+ default:
+
+ if ( gb_dhw_ptr != (DIL_HWD_PTR)NULL ) {
+
+ /* Backup engine was inited, process DIL info, and report any errors */
+ switch( HWC_ProcessDILHWD( HW_DISP_ERROR, gb_dhw_ptr ) ) {
+
+ case HW_NO_ERROR:
+ case HW_ERROR_DISPLAYED:
+ case HW_ERROR_DETECTED:
+ /* Any errors already processed by HW unit, and break... */
+ break;
+
+ case HW_ERROR_NO_RES_FILE:
+ eresprintf( RES_MISSING_HW_RESOURCE, CDS_GetActiveDriver( pCDS ), TEXT(".RES") );
+ break;
+
+ case HW_INVALID_PARM:
+ /* this should not happen, unless the HW resource and device
+ driver files get out of sync and new acceptable values
+ within the driver are defined that the resource file does
+ not know about */
+ eresprintf( RES_INCONSISTENT_HW_PARMS );
+ break;
+
+ case HW_UNKNOWN_ERROR:
+ eresprintf( RES_UNKNOWN_HW_ERR );
+ break;
+
+ case OUT_OF_MEMORY:
+ eresprintf( RES_OUT_OF_MEMORY );
+ break;
+
+ }
+ }
+
+ break;
+ }
+
+ return;
+
+ pBE;
+
+} /* end HWC_ReportDiagError() */
diff --git a/private/utils/ntbackup/src/hwconfnt.c b/private/utils/ntbackup/src/hwconfnt.c
new file mode 100644
index 000000000..2c5d48a27
--- /dev/null
+++ b/private/utils/ntbackup/src/hwconfnt.c
@@ -0,0 +1,1281 @@
+/******************************************************************************
+Copyright (c) Archive Software Division 1992
+
+
+ Name: nthwconf.c
+
+ Description: This file contains the functions for the Hardware
+ Settings Dialog and for controller card and tape drive
+ selections.
+
+
+
+ $Log: G:\ui\logfiles\hwconfnt.c_v $
+
+ Rev 1.11.2.7 29 Jun 1994 19:42:28 STEVEN
+save config when changed
+
+ Rev 1.11.2.6 25 Jan 1994 08:43:10 MIKEP
+fix warnings in orcas
+
+ Rev 1.11.2.5 13 Dec 1993 11:40:56 TIMN
+Saves device name in cfg settings
+
+ Rev 1.11.2.4 07 Dec 1993 10:41:04 TIMN
+Additional Unicode changes
+
+ Rev 1.11.2.3 03 Dec 1993 14:27:32 TIMN
+Unicode fixes Fixes EPR0203
+
+ Rev 1.11.2.2 30 Nov 1993 19:18:30 TIMN
+Added cmdline /tape:x option to NTJ
+
+ Rev 1.11.2.1 05 Jun 1993 14:00:54 BARRY
+Initialize variables before using them
+
+ Rev 1.11.2.0 04 Jun 1993 19:05:02 STEVEN
+added new error messages
+ *
+ * Rev 1.0 04 Jun 1993 19:04:38 STEVEN
+ * added new error messages
+
+ Rev 1.11 16 Apr 1993 14:42:14 DARRYLP
+Changed ID for HWCONFNT Help to resolve differences.
+
+ Rev 1.10 20 Jan 1993 21:38:30 MIKEP
+floppy support
+
+ Rev 1.9 04 Dec 1992 08:48:36 MIKEP
+fix tape drive switching
+
+ Rev 1.8 17 Nov 1992 21:25:12 DAVEV
+unicode fixes
+
+ Rev 1.7 11 Nov 1992 16:43:58 DAVEV
+UNICODE: remove compile warnings, use sizeof instead of array size for CHAR arrays
+
+ Rev 1.6 30 Oct 1992 17:58:56 MIKEP
+quick kludge for steve for weekend
+
+ Rev 1.5 27 Oct 1992 16:32:12 MIKEP
+device number support
+
+ Rev 1.0 27 Oct 1992 16:32:04 MIKEP
+device number support
+
+ Rev 1.4 08 Oct 1992 16:01:00 DAVEV
+Unicode Awk Pass
+
+ Rev 1.3 08 Oct 1992 15:51:56 MIKEP
+latest
+
+
+******************************************************************************/
+
+
+
+#include "all.h"
+
+
+
+// PRIVATE DEFINITIONS
+
+#define HWC_SIZE_INIT 0
+#define HWC_SIZE_NO_CONFIG 1
+#define HWC_SIZE_NO_TARGET_IDS 2
+#define HWC_SIZE_MAX 3
+
+#define HWC_NOTDEFINED 0xFFFF
+#define HWC_SHOWLASTMESSAGE 0xFFFF
+#define DISABLED 0
+#define ENABLED 1
+#define AUTO_ENABLED 2
+#define HW_NO_CARD_ERROR 10
+
+#define REGENUMKEYSIZE 100 // subkey name size
+#define TEMPBUFFSIZE 512 //
+
+
+// generic f(x) calls for determining if char is a digit
+#if defined( UNICODE )
+# define _HWC_IsDigit(ch) ( !IsCharAlpha( ch ) && IsCharAlphaNumeric( ch ) )
+#else
+# define _HWC_IsDigit(ch) ( isdigit( ch ) )
+#endif
+
+
+
+
+// PRIVATE STRUCTURES
+
+typedef struct HWDRIVE {
+
+ Q_ELEM q_elem;
+ CHAR_PTR drive_name;
+
+ INT floppy;
+ INT card;
+ INT bus;
+ INT target_id;
+ INT lun;
+ INT device;
+
+} HWDRIVE, *HWDRIVE_PTR;
+
+
+static HWDRIVE_PTR mwSelectedDrive = NULL;
+static Q_HEADER DriveQueue ;
+static BOOLEAN DriveFound = FALSE ;
+static BOOLEAN DriverLoaded = FALSE ;
+
+
+// PRIVATE MACRO DEFINITIONS
+
+#define PostDlgItemMessage( u, v, x, y, z ) PostMessage( GetDlgItem ( u, v ), x, y, z );
+
+
+// PRIVATE FUNCTION PROTOTYPES
+
+
+INT HWC_FindFloppyTape( CHAR * );
+INT HWC_AddFloppyTapeDrive( CHAR * );
+INT HWC_FindScsiCards( CHAR * );
+INT HWC_FindBuses( INT, CHAR * );
+INT HWC_FindTargets( INT, INT, CHAR * );
+INT HWC_FindLuns( INT, INT, INT, CHAR * );
+INT HWC_QueryValues( INT, INT, INT, INT, CHAR * );
+INT HWC_TestHardware( VOID );
+INT HWC_GetTapeDevice( VOID );
+BOOL HWC_InitDialog( HWND );
+VOID HWC_DeinitDialog( HWND, INT );
+DLGRESULT HWC_ProcessCommand( HWND, MP1, MP2 );
+BOOL HWC_BuildDriveList( VOID );
+BOOL HWC_AddToDriveList( INT, INT, INT, INT, INT, CHAR_PTR );
+HWDRIVE_PTR HWC_IsInDriveList( INT, INT, INT, INT, CHAR_PTR );
+HWDRIVE_PTR HWC_GetFirstDrive( );
+HWDRIVE_PTR HWC_GetNextDrive( HWDRIVE_PTR );
+BOOL HWC_BuildDriveComboBox( HWND );
+BOOL HWC_NewDriveSelected( HWND );
+VOID HWC_FreeDriveList( VOID );
+
+int
+HWC_SelectTapeDevice( int nTapeDevice ) ;
+VOID
+HWC_FlushDeviceList( Q_HEADER *mwpdsDeviceQueue ) ;
+HWDRIVE_PTR
+HWC_GetDeviceFromDeviceList( int nTapeDevice ) ;
+
+// Determine the tape drive to use at startup.
+
+INT HWC_GetTapeDevice( )
+{
+
+ INT card = -1;
+ INT bus = -1;
+ INT target = -1;
+ INT lun = -1;
+ INT device = 0;
+ CHAR_PTR driver_name;
+ CHAR_PTR s;
+
+ HWC_FlushDeviceList( &DriveQueue );
+
+ // Build the controller card list. If no configured is selected,
+ // do not show the whole dialog. Make sure that the user picks a
+ // controller first.
+
+ HWC_BuildDriveList();
+
+ driver_name = (CHAR_PTR)CDS_GetTapeDriveName( CDS_GetPerm() );
+ s = driver_name;
+
+ // skip to digits
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) card = atoi( s );
+ // skip over digits
+ while ( *s && *s >= TEXT( '0' ) && *s <= TEXT( '9' ) ) s++;
+
+ // skip to digits
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) bus = atoi( s );
+ // skip over digits
+ while ( *s && *s >= TEXT( '0' ) && *s <= TEXT( '9' ) ) s++;
+
+ // skip to digits
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) target = atoi( s );
+ // skip over digits
+ while ( *s && *s >= TEXT( '0' ) && *s <= TEXT( '9' ) ) s++;
+
+ // skip to digits
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) lun = atoi( s );
+
+ mwSelectedDrive = HWC_IsInDriveList( card, bus, target, lun,
+ driver_name );
+
+ if ( mwSelectedDrive ) {
+ device = mwSelectedDrive->device;
+
+ // Let's modify the configuration with the selected tape device
+ CDS_SetTapeDriveName( CDS_GetPerm(), mwSelectedDrive->drive_name ) ;
+ CDS_SetChangedConfig( CDS_GetPerm(), TRUE ) ;
+ }
+
+ HWC_FreeDriveList( );
+
+ return( device );
+}
+
+
+/**
+
+**/
+
+INT
+HWC_SelectTapeDevice( INT nTapeDevice )
+{
+INT nRetValu = (INT)INVALID_HANDLE_VALUE ;
+
+ InitQueue( &DriveQueue );
+ HWC_BuildDriveList();
+
+ mwSelectedDrive = HWC_GetDeviceFromDeviceList( nTapeDevice ) ;
+
+ if ( mwSelectedDrive )
+ {
+ CDS_SetTapeDriveName( CDS_GetPerm(), mwSelectedDrive->drive_name );
+ nRetValu = nTapeDevice ;
+ }
+
+ HWC_FreeDriveList() ;
+
+ return( nRetValu ) ;
+}
+
+
+/****************************************************************************
+
+ Name: HWC_FlushDeviceList
+
+ Description: Frees all allocated memory in the Device Queue before
+ calling InitQueue to rebuild the device list.
+
+ Note:
+
+ Returns: Nothing
+
+****************************************************************************/
+
+VOID
+HWC_FlushDeviceList( Q_HEADER *mwpdsDeviceQueue )
+{
+HWDRIVE_PTR pdsDevice ;
+HWDRIVE_PTR pdsNextDevice ;
+
+ pdsDevice = HWC_GetFirstDrive() ;
+
+ while ( pdsDevice != NULL )
+ {
+ pdsNextDevice = HWC_GetNextDrive( pdsDevice ) ;
+ free( (void *)pdsDevice->q_elem.q_ptr ) ;
+ pdsDevice = pdsNextDevice ;
+ }
+
+ InitQueue( mwpdsDeviceQueue ) ;
+
+} /* end HWC_FlushDeviceList */
+
+
+
+/****************************************************************************
+
+ Name: HWC_GetDeviceFromDeviceList
+
+ Description: Gets the specified device from the device list queue
+
+ Note:
+
+ Returns: Address of the device
+
+****************************************************************************/
+
+HWDRIVE_PTR
+HWC_GetDeviceFromDeviceList( int nTapeDevice )
+{
+HWDRIVE_PTR pdsDevice = HWC_GetFirstDrive() ;
+
+ while ( pdsDevice && pdsDevice->device != nTapeDevice )
+ {
+ pdsDevice = HWC_GetNextDrive( pdsDevice ) ;
+ }
+
+ return( pdsDevice ) ;
+}
+
+
+
+/******************************************************************************
+
+ Name: DM_OptionHardware ()
+
+ Description: Dialog proc for hardware settings.
+
+ Returns:
+
+******************************************************************************/
+
+DLGRESULT APIENTRY DM_OptionHardware (
+HWND hDlg, // I - handle to a dialog
+MSGID Msg, // I - message
+MPARAM1 Param1, // I - word parameter
+MPARAM2 Param2 ) // I - long parameter
+{
+ switch ( Msg ) {
+
+ case WM_INITDIALOG :
+
+ return HWC_InitDialog ( hDlg );
+
+ case WM_COMMAND :
+
+ return (DLGRESULT) HWC_ProcessCommand ( hDlg, Param1, Param2 );
+
+ case WM_CLOSE :
+
+ HWC_DeinitDialog ( hDlg, (INT)NULL );
+ return TRUE ;
+
+ default :
+ return FALSE ;
+ }
+
+ return TRUE ;
+}
+
+
+BOOL HWC_InitDialog (
+HWND hDlg ) // I - handle to the dialog
+{
+ CHAR_PTR s;
+ CHAR_PTR driver_name;
+ INT card = -1;
+ INT bus = -1;
+ INT target = -1;
+ INT lun = -1;
+ RECT rcDialog;
+
+
+ // Center the dialog and init the dialog size since it is a dynamically
+ // sized dialog.
+
+ HWC_FlushDeviceList( &DriveQueue );
+
+ DM_CenterDialog( hDlg );
+
+ GetWindowRect( hDlg, &rcDialog );
+
+
+ // Build the controller card list. If no configured is selected,
+ // do not show the whole dialog. Make sure that the user picks a
+ // controller first.
+
+ HWC_BuildDriveList();
+
+ driver_name = (CHAR_PTR)CDS_GetTapeDriveName( CDS_GetPerm() );
+ s = driver_name;
+
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) card = atoi( s );
+ while ( *s && *s >= TEXT( '0' ) && *s <= TEXT( '9' ) ) s++;
+
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) bus = atoi( s );
+ while ( *s && *s >= TEXT( '0' ) && *s <= TEXT( '9' ) ) s++;
+
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) target = atoi( s );
+ while ( *s && *s >= TEXT( '0' ) && *s <= TEXT( '9' ) ) s++;
+
+ while ( *s && ( *s < TEXT( '0' ) || *s > TEXT( '9' ) ) ) s++;
+ if ( *s ) lun = atoi( s );
+
+ mwSelectedDrive = HWC_IsInDriveList( card, bus, target, lun,
+ driver_name );
+
+ HWC_BuildDriveComboBox ( hDlg );
+
+ return( TRUE );
+}
+
+VOID HWC_DeinitDialog (
+HWND hDlg,
+INT nReturnValue )
+{
+ HWC_FreeDriveList( );
+
+ EndDialog ( hDlg, nReturnValue ) ;
+
+} /* HWC_DeinitDialog() */
+
+
+
+BOOL HWC_ProcessCommand (
+HWND hDlg, // I - handle to the dialog
+MPARAM1 Param1, // I - command parameter
+MPARAM2 Param2 ) // I - long parameter
+{
+ WORD wCmd = GET_WM_COMMAND_CMD ( Param1, Param2 );
+ WORD wID = GET_WM_COMMAND_ID ( Param1, Param2 );
+
+ UNREFERENCED_PARAMETER ( Param2 );
+
+ switch ( wID ) {
+
+ case IDOK: {
+
+ // actually change tape drives here !
+
+ if ( mwSelectedDrive != NULL ) {
+
+ CDS_SetTapeDriveName( CDS_GetPerm(), mwSelectedDrive->drive_name );
+ CDS_SetChangedConfig( CDS_GetPerm(), TRUE );
+ TapeDevice = mwSelectedDrive->device;
+ HWC_TestHardware();
+ }
+
+ STM_SetIdleText( IDS_READY );
+ HWC_DeinitDialog( hDlg, (INT)IDOK );
+ CDS_SaveCDS ();
+ return( TRUE );
+ }
+
+ case IDCANCEL:
+ STM_SetIdleText ( IDS_READY );
+ HWC_DeinitDialog ( hDlg, (INT)IDCANCEL );
+ return( TRUE );
+
+ case IDD_H_CONTROLLER:
+ // Get the selected drive. If it was different from the
+ // previous one, change the lists associated with them.
+
+ if ( wCmd == (WORD)LBN_SELCHANGE ) {
+
+ HWC_NewDriveSelected ( hDlg );
+ }
+ break;
+
+ case IDHELP:
+ HM_DialogHelp( HELPID_OPERATIONSHARDWARE ) ;
+ break;
+
+ default:
+ // Clear the tested flag if the target IDs change.
+ return(FALSE);
+ }
+
+ return( TRUE );
+}
+
+
+VOID HWC_EnableStatusGroup (
+HWND hDlg, // I - handle to a dialog
+BOOL fEnable ) // I - flag to enable or disable the group
+{
+ EnableWindow( GetDlgItem( hDlg, IDOK ), fEnable );
+}
+
+
+
+BOOL HWC_BuildDriveList( )
+{
+
+#ifdef FLOPPY
+
+ if ( GetDriveType( TEXT("A:") ) != 1 ) {
+ HWC_AddToDriveList( -1, -1, -1, -1, 255, TEXT("Floppy Drive A:") ) ;
+ }
+
+ if ( GetDriveType( TEXT("B:") ) != 1 ) {
+ HWC_AddToDriveList( -1, -1, -1, -1, 256, TEXT("Floppy Drive B:") ) ;
+ }
+
+#endif
+
+ HWC_FindScsiCards( TEXT("hardware\\devicemap\\scsi") ) ;
+ HWC_FindFloppyTape( TEXT("hardware\\devicemap\\tape") ) ;
+
+ return( TRUE );
+}
+
+
+
+INT HWC_FindFloppyTape( CHAR *key_name )
+{
+LONG ret;
+REGSAM samDesired;
+HKEY hkResult;
+ULONG key_index;
+FILETIME ftLastWrite;
+CHAR name[ REGENUMKEYSIZE ] ;
+ULONG name_size ;
+CHAR temp_buff[ TEMPBUFFSIZE ] ;
+
+ samDesired = KEY_READ;
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ key_name, 0UL, samDesired, &hkResult );
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ key_index = 0UL ;
+
+ do {
+ name_size = REGENUMKEYSIZE ;
+
+ ret = RegEnumKeyEx( hkResult, key_index, name, &name_size,
+ NULL, NULL, NULL,
+ &ftLastWrite );
+
+ if ( ! ret ) {
+ strcpy( temp_buff, key_name );
+ strcat( temp_buff, TEXT("\\") );
+ strcat( temp_buff, name );
+
+ DriveFound = TRUE ;
+ DriverLoaded = TRUE ;
+ HWC_AddFloppyTapeDrive( temp_buff );
+ }
+
+ key_index++ ;
+
+ } while ( ! ret );
+
+ RegCloseKey( hkResult );
+
+ return( SUCCESS );
+
+}
+
+
+INT HWC_AddFloppyTapeDrive( CHAR *key_name )
+{
+LONG ret;
+REGSAM samDesired;
+HKEY hkResult;
+ULONG key_index;
+CHAR data[ REGENUMKEYSIZE ] ;
+DWORD data_size ;
+CHAR value_id[ REGENUMKEYSIZE ] ;
+DWORD value_size ;
+DWORD device = 0 ;
+INT tape_drive = FALSE;
+INT driver_loaded = FALSE;
+CHAR identifier[ TEMPBUFFSIZE ] ;
+CHAR unique[ TEMPBUFFSIZE ] ;
+CHAR deviceName[ REGENUMKEYSIZE ] ;
+
+ samDesired = KEY_QUERY_VALUE;
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ key_name, 0UL, samDesired, &hkResult );
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ identifier[ 0 ] = unique[ 0 ] = TEXT( '\0' ) ;
+ key_index = 0UL ;
+
+ do {
+
+ value_size = REGENUMKEYSIZE ;
+ data_size = sizeof(data) ;
+
+ ret = RegEnumValue( hkResult, key_index, value_id, &value_size,
+ (LPDWORD)NULL, (LPDWORD)NULL, (LPBYTE)data, &data_size );
+
+ if ( ! ret ) {
+
+ // null terminate data string from RegEnumValue() call
+ data_size /= sizeof( CHAR ) ;
+ data[ data_size ] = TEXT('\0') ;
+
+ if ( ! stricmp( value_id, TEXT("DeviceName") ) ) {
+ CHAR *s ;
+
+ strcpy( deviceName, data ) ; // store the tape string
+ s = data ;
+ s += strlen( TEXT("Tape") ) ;
+ device = atoi( s );
+ driver_loaded = TRUE;
+ }
+
+ if ( ! stricmp( value_id, TEXT("UniqueId") ) ) {
+ strcpy( unique, data ) ;
+ }
+
+ if ( ! stricmp( value_id, TEXT("Identifier") ) ) {
+ strcpy( identifier, data ) ;
+ }
+
+ }
+
+ key_index++;
+
+ } while ( ! ret );
+
+ if ( driver_loaded ) {
+
+ if ( *unique == TEXT('\0') ) {
+ strcpy( unique, deviceName ) ;
+ }
+
+ strcat( unique, TEXT( " " ) );
+ strcat( unique, identifier );
+ HWC_AddToDriveList( -1, -1, -1, -1, device, unique );
+ }
+
+ RegCloseKey( hkResult );
+
+ return( SUCCESS );
+
+}
+
+
+
+INT HWC_FindScsiCards( CHAR *key_name )
+{
+LONG ret ;
+REGSAM samDesired ;
+HKEY hkResult ;
+ULONG key_index ;
+INT card ;
+FILETIME ftLastWrite ;
+CHAR name[ REGENUMKEYSIZE ] ;
+ULONG name_size ;
+CHAR temp_buff[ TEMPBUFFSIZE ] ;
+
+ samDesired = KEY_READ;
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ key_name, 0UL, samDesired, &hkResult );
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ key_index = 0UL ;
+
+ do {
+
+ name_size = REGENUMKEYSIZE ;
+
+ ret = RegEnumKeyEx( hkResult, key_index, name, &name_size,
+ NULL, NULL, NULL,
+ &ftLastWrite );
+
+ if ( ! ret ) {
+ CHAR_PTR s ;
+
+ strcpy( temp_buff, key_name );
+ strcat( temp_buff, TEXT("\\") );
+ strcat( temp_buff, name );
+
+ s = name ;
+
+ while ( *s && !_HWC_IsDigit( *s ) ) {
+ s++ ;
+ }
+
+ card = atoi( s );
+
+ HWC_FindBuses( card, temp_buff );
+ }
+
+ key_index++;
+
+ } while ( ! ret );
+
+ RegCloseKey( hkResult );
+
+ return( SUCCESS );
+}
+
+
+INT HWC_FindBuses( INT card, CHAR *key_name )
+{
+LONG ret;
+INT bus;
+REGSAM samDesired;
+HKEY hkResult;
+ULONG key_index;
+FILETIME ftLastWrite;
+CHAR name[ REGENUMKEYSIZE ] ;
+ULONG name_size ;
+CHAR temp_buff[ TEMPBUFFSIZE ] ;
+
+ samDesired = KEY_READ;
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ key_name, 0UL, samDesired, &hkResult );
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ key_index = 0UL ;
+
+ do {
+
+ name_size = REGENUMKEYSIZE ;
+
+ ret = RegEnumKeyEx( hkResult, key_index, name, &name_size,
+ NULL, NULL, NULL,
+ &ftLastWrite );
+
+ if ( ! ret ) {
+ CHAR_PTR s;
+
+ strcpy( temp_buff, key_name );
+ strcat( temp_buff, TEXT("\\") );
+ strcat( temp_buff, name );
+
+ s = name ;
+
+ while ( *s && !_HWC_IsDigit( *s ) ) {
+ s++ ;
+ }
+
+ bus = atoi( s );
+
+ HWC_FindTargets( card, bus, temp_buff );
+ }
+
+ key_index++;
+
+ } while ( ! ret );
+
+ RegCloseKey( hkResult );
+
+ return( SUCCESS );
+}
+
+
+INT HWC_FindTargets( INT card, INT bus, CHAR *key_name )
+{
+LONG ret;
+REGSAM samDesired;
+HKEY hkResult;
+ULONG key_index;
+FILETIME ftLastWrite;
+INT id = 0 ;
+CHAR name[ REGENUMKEYSIZE ] ;
+ULONG name_size ;
+CHAR temp_buff[ TEMPBUFFSIZE ];
+
+ samDesired = KEY_READ;
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ key_name, 0UL, samDesired, &hkResult );
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ key_index = 0UL ;
+
+ do {
+
+ name_size = REGENUMKEYSIZE ;
+
+ ret = RegEnumKeyEx( hkResult, key_index, name, &name_size,
+ NULL, NULL, NULL,
+ &ftLastWrite );
+
+ if ( ! ret ) {
+ CHAR_PTR s;
+
+ strcpy( temp_buff, key_name );
+ strcat( temp_buff, TEXT("\\") );
+ strcat( temp_buff, name );
+
+ s = name ;
+
+ while ( *s && !_HWC_IsDigit( *s ) ) {
+ s++ ;
+ }
+
+ id = atoi( s );
+
+ HWC_FindLuns( card, bus, id, temp_buff );
+ }
+
+ key_index++;
+
+ } while ( ! ret );
+
+ RegCloseKey( hkResult );
+
+ return( SUCCESS );
+}
+
+INT HWC_FindLuns( INT card, INT bus, INT id, CHAR *key_name )
+{
+LONG ret;
+INT lun;
+REGSAM samDesired;
+HKEY hkResult;
+ULONG key_index;
+FILETIME ftLastWrite;
+CHAR name[ REGENUMKEYSIZE ] ;
+ULONG name_size ;
+CHAR temp_buff[ TEMPBUFFSIZE ] ;
+
+
+ samDesired = KEY_READ;
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ key_name, 0UL, samDesired, &hkResult );
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ key_index = 0UL ;
+
+ do {
+
+ name_size = REGENUMKEYSIZE ;
+
+ ret = RegEnumKeyEx( hkResult, key_index, name, &name_size,
+ NULL, NULL, NULL,
+ &ftLastWrite );
+
+ if ( ! ret ) {
+ CHAR_PTR s;
+
+ strcpy( temp_buff, key_name );
+ strcat( temp_buff, TEXT("\\") );
+ strcat( temp_buff, name );
+
+ s = name ;
+
+ while ( *s && !_HWC_IsDigit( *s ) ) {
+ s++ ;
+ }
+
+ lun = atoi( s );
+
+ HWC_QueryValues( card, bus, id, lun, temp_buff );
+ }
+
+ key_index++;
+
+ } while ( ! ret );
+
+ RegCloseKey( hkResult );
+
+ return( SUCCESS );
+}
+
+
+INT HWC_QueryValues( INT card, INT bus, INT id, INT lun, CHAR *key_name )
+{
+LONG ret;
+REGSAM samDesired;
+HKEY hkResult;
+ULONG key_index;
+CHAR data[ REGENUMKEYSIZE ] ;
+DWORD data_size ;
+CHAR value_id[ REGENUMKEYSIZE ] ;
+DWORD value_size ;
+DWORD device = 0;
+INT tape_drive = FALSE;
+INT driver_loaded = FALSE;
+CHAR buffer[ TEMPBUFFSIZE ] ;
+
+ samDesired = KEY_QUERY_VALUE;
+
+ ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ key_name, 0UL, samDesired, &hkResult );
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ key_index = 0UL ;
+
+ do {
+
+ value_size = REGENUMKEYSIZE ;
+ data_size = sizeof(data) ;
+
+ ret = RegEnumValue( hkResult, key_index, value_id, &value_size,
+ (LPDWORD)NULL, (LPDWORD)NULL, (LPBYTE)data, &data_size );
+
+ if ( ! ret ) {
+
+ if ( ! stricmp( value_id, TEXT("Type") ) ) {
+
+ if ( ! stricmp( data, TEXT("TapePeripheral") ) ) {
+ DriveFound = TRUE ;
+ tape_drive = TRUE;
+ }
+ }
+
+ if ( ! stricmp( value_id, TEXT("DeviceName") ) ) {
+ CHAR *s;
+
+ s = data;
+ s += strlen( TEXT("Tape") ) ;
+ device = atoi( s );
+ DriverLoaded = TRUE ;
+ driver_loaded = TRUE;
+ }
+
+
+ if ( ! stricmp( value_id, TEXT("Identifier") ) ) {
+ sprintf( buffer, TEXT("Scsi %d, Bus %d, Id %d, Lun %d %s"), card, bus, id, lun, data ) ;
+ }
+
+ }
+
+ key_index++;
+
+ } while ( ! ret );
+
+ if ( tape_drive && driver_loaded ) {
+ HWC_AddToDriveList( card, bus, id, lun, device, buffer );
+ }
+
+ RegCloseKey( hkResult );
+
+ return( SUCCESS );
+}
+
+BOOL HWC_AddToDriveList (
+INT card,
+INT bus,
+INT target_id,
+INT lun,
+INT device,
+CHAR_PTR drive_name ) // I - name of the device driver
+{
+ HWDRIVE_PTR new_drive;
+ static HWDRIVE_PTR last_drive;
+
+ // Allocate memory for the new card and stuff it.
+
+ new_drive = malloc( sizeof ( HWDRIVE ) +
+ ( ( strlen( drive_name ) + 1 ) * sizeof( CHAR )));
+
+ if ( new_drive == NULL ) {
+ return( FAILURE );
+ }
+
+ new_drive->drive_name = (CHAR_PTR)new_drive;
+ (INT8_PTR)(new_drive->drive_name) += sizeof( HWDRIVE );
+
+ // fill in drive name
+
+ strcpy ( new_drive->drive_name, drive_name );
+
+ // OK, fill out the rest of the card DS.
+
+ new_drive->q_elem.q_ptr = new_drive;
+ new_drive->card = card;
+ new_drive->bus = bus;
+ new_drive->target_id = target_id;
+ new_drive->lun = lun;
+ new_drive->device = device;
+ new_drive->floppy = FALSE;
+
+ if ( card == -1 && bus == -1 && target_id == -1 && lun == -1 ) {
+ new_drive->floppy = TRUE;
+ }
+
+
+ // Put the card on the end of the list.
+
+ if ( ! QueueCount( &DriveQueue ) ) {
+ EnQueueElem( &DriveQueue,
+ &(new_drive->q_elem), FALSE );
+ }
+ else {
+ InsertElem( &DriveQueue,
+ &(last_drive->q_elem),
+ &(new_drive->q_elem), AFTER );
+ }
+
+ last_drive = new_drive;
+
+ return SUCCESS;
+}
+
+
+HWDRIVE_PTR HWC_IsInDriveList (
+INT card,
+INT bus,
+INT id,
+INT lun,
+CHAR_PTR drive_name ) // I - name of the device driver
+{
+ HWDRIVE_PTR drive;
+
+
+ // CONFIGURATION WAS FOUND.
+ // Now, select the card in the list to be the card in the config.
+
+ drive = HWC_GetFirstDrive();
+
+ while ( drive ) {
+
+ if ( card == -1 || bus == -1 || id == -1 || lun == -1 ) {
+
+ // If we get any -1's and they have a floppy drive,
+ // default to it.
+
+ if ( drive->floppy ) {
+
+// return( drive ); // Card is valid, everything's OK.
+ }
+ }
+
+ if ( ( ( drive->card == card ) || ( card == -1 ) || drive->floppy ) &&
+ ( ( drive->bus == bus ) || ( bus == -1 ) || drive->floppy ) &&
+ ( ( drive->lun == lun ) || ( lun == -1 ) ) &&
+ ( ( drive->target_id == id ) || ( id == -1 ) ) ) {
+
+ if ( ! stricmp( drive->drive_name, drive_name ) ) {
+
+ return( drive ); // Card is valid, everything's OK.
+ }
+ }
+
+ drive = HWC_GetNextDrive( drive );
+ }
+
+ // CONFIGURATION WAS NOT FOUND OR WAS NOT VALID.
+
+ // return first drive, they probably only have one anyway.
+
+ drive = HWC_GetFirstDrive();
+
+ return ( drive );
+
+}
+
+
+BOOL HWC_BuildDriveComboBox (
+HWND hDlg ) // I - handle to the dialog
+{
+ HWDRIVE_PTR drive;
+
+ // Add all of the the controller cards to the list box.
+
+ drive = HWC_GetFirstDrive();
+
+ while ( drive ) {
+
+ SendDlgItemMessage ( (HWND) hDlg,
+ (INT) IDD_H_CONTROLLER,
+ (MSGID) CB_ADDSTRING,
+ (MPARAM1) 0,
+ (MPARAM2) drive->drive_name
+ );
+
+ drive = HWC_GetNextDrive( drive );
+ }
+
+ if ( mwSelectedDrive != NULL ) {
+
+ SendDlgItemMessage ( (HWND) hDlg,
+ (INT) IDD_H_CONTROLLER,
+ (MSGID) CB_SELECTSTRING,
+ (MPARAM1) -1,
+ (MPARAM2) mwSelectedDrive->drive_name
+ );
+ }
+ else {
+
+ // Indicate that there was no previously selected hardware config.
+
+ // If there is no controller card selected, setup the screen so
+ // that the user can make a selection based on cards that are
+ // supported by available device driver DLLs.
+
+ // Select the first card in the card list.
+
+
+
+ }
+
+ return FALSE;
+
+} /* end HWC_BuildDriveComboBox() */
+
+
+BOOL HWC_NewDriveSelected(
+HWND hDlg ) // I - handle to the dialog
+{
+ INT i;
+ INT nCard;
+ CHAR buffer[ 512 ];
+
+ // Get the index of the card in the list.
+
+ nCard = (INT)SendDlgItemMessage ( (HWND) hDlg,
+ (INT) IDD_H_CONTROLLER,
+ (MSGID) CB_GETCURSEL,
+ (MPARAM1) 0,
+ (MPARAM2) 0
+ );
+
+ if ( nCard == CB_ERR ) {
+ return FALSE;
+ }
+
+ nCard = (INT)SendDlgItemMessage ( (HWND) hDlg,
+ (INT) IDD_H_CONTROLLER,
+ (MSGID) CB_GETLBTEXT,
+ (MPARAM1) nCard,
+ (MPARAM2) buffer
+ );
+
+ if ( nCard == CB_ERR ) {
+ return FALSE;
+ }
+
+
+ // Now, get its associated card structure pointer.
+
+ mwSelectedDrive = HWC_GetFirstDrive();
+
+ while ( mwSelectedDrive ) {
+
+ if ( ! stricmp( mwSelectedDrive->drive_name, buffer ) ) {
+ break;
+ }
+ mwSelectedDrive = HWC_GetNextDrive( mwSelectedDrive );
+ }
+
+ return( TRUE );
+}
+
+
+
+VOID HWC_FreeDriveList ( VOID )
+{
+
+ mwSelectedDrive = (VOID_PTR)NULL;
+
+}
+
+
+
+
+HWDRIVE_PTR HWC_GetFirstDrive()
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueHead( &DriveQueue );
+
+ if ( q_elem_ptr != NULL ) {
+ return( (HWDRIVE_PTR)q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+
+HWDRIVE_PTR HWC_GetNextDrive( HWDRIVE_PTR drive )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ if ( drive != NULL ) {
+
+ q_elem_ptr = QueueNext( &(drive->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return( (HWDRIVE_PTR) q_elem_ptr->q_ptr );
+ }
+ }
+
+ return( NULL );
+}
+
+
+INT HWC_ProcessDILHWD( INT nProcFlag, DIL_HWD_PTR dil_ptr )
+{
+
+ if ( thw_list != NULL ) {
+
+ return( SUCCESS );
+ }
+ else {
+
+ HWC_ProcessError( (UINT16)nProcFlag,
+ (UINT16)0,
+ (UINT16)DRIVER_LOAD_FAILURE,
+ (UINT16)0,
+ CDS_GetPerm() );
+
+ return( HW_ERROR_DETECTED );
+ }
+}
+
+
+
+INT HWC_TestHardware( )
+{
+ gfHWInitialized = FALSE;
+ return( HWC_TapeHWProblem( bsd_list ) );
+}
+
+
+INT HWC_InitDILHWD( DIL_HWD_PTR *dil_ptr, INT *num_cards )
+{
+ return( SUCCESS );
+}
+
+
+INT HWC_ProcessError(
+UINT16 nProcFlag,
+UINT16 wStatus,
+UINT16 wError,
+UINT16 wCardNumber,
+CDS_PTR cds )
+{
+
+ if ( nProcFlag == HW_DISP_ERROR ) {
+
+ HWC_BuildDriveList();
+ HWC_FreeDriveList( );
+
+ if ( DriverLoaded ) {
+ WM_MsgBox ( ID(IDS_POLLDRIVE_MESSAGE),
+ ID(IDS_POLLDRIVE_SMALLPROBLEM),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+
+ } else if ( DriveFound ) { /* driver not loaded */
+
+ WM_MsgBox ( ID(IDS_POLLDRIVE_MESSAGE),
+ ID(IDS_HWC_NO_DRIVE),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+
+ } else { /* a drive did not exist */
+ WM_MsgBox ( ID(IDS_POLLDRIVE_MESSAGE),
+ ID(IDS_POLLDRIVE_BIGPROBLEM),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+ }
+
+ }
+
+ return( SUCCESS );
+}
diff --git a/private/utils/ntbackup/src/hwctext.rc b/private/utils/ntbackup/src/hwctext.rc
new file mode 100644
index 000000000..7d5ae787b
--- /dev/null
+++ b/private/utils/ntbackup/src/hwctext.rc
@@ -0,0 +1,181 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: hwctext.rc
+
+ Description: This file contains the references to string resources for
+ the Windows GUI Project HARDWARE CONFIG Resource File.
+
+ $Log: G:/UI/LOGFILES/HWCTEXT.RCV $
+
+ Rev 1.11.1.3 11 Jun 1993 13:17:50 CHUCKB
+ Small grammar changes.
+
+ Rev 1.11.1.2 04 Jun 1993 19:44:10 STEVEN
+ fix typo
+
+ Rev 1.11.1.1 04 Jun 1993 18:55:24 STEVEN
+ added messages
+
+ Rev 1.11 12 Apr 1993 15:15:00 BARRY
+ Changed text of HWC_NO_DRIVE and IDS_POLLDRIVE_DRIVE_FAILURE per MSoft.
+
+ Rev 1.10 28 Jan 1993 15:57:48 GLENN
+ Changed Adaptec to ASPI.
+
+ Rev 1.9 27 Jan 1993 15:26:56 STEVEN
+ fix 'resart' to 'restart'
+
+ Rev 1.8 18 Jan 1993 14:50:50 GLENN
+ Changed 'shure' to 'sure' - DeVos Spelling.
+
+ Rev 1.7 30 Nov 1992 16:09:32 GLENN
+ Added IBM PS/2 SCSI hardware support.
+
+ Rev 1.6 02 Oct 1992 16:28:34 STEVEN
+ Added polldrive failure text.
+
+ Rev 1.5 04 May 1992 16:41:40 GLENN
+ Added PS/2 QIC and SCSI stuff.
+
+ Rev 1.4 19 Mar 1992 16:48:50 GLENN
+ Added enhanced status support.
+
+ Rev 1.3 17 Mar 1992 15:40:30 GLENN
+ Added POLLDRIVE messages.
+
+ Rev 1.2 10 Feb 1992 09:04:16 GLENN
+ Added warning text.
+
+ Rev 1.1 29 Jan 1992 17:52:04 GLENN
+ Added Testing hardware string.
+
+ Rev 1.0 24 Jan 1992 19:00:58 GLENN
+ Initial revision.
+
+******************************************************************************/
+
+
+// SEE ALSO STRINGS.H and PRODDEFS.H -- PRODDEFS.H MUST BE TRANSLATED!!!!!
+
+// hardware settings dialog control text
+
+
+IDS_HWC_DRIVER_MS_SCSI "MS_SCSI"
+IDS_HWC_CARD_0_MS_SCSI "Maynard PC 8-Bit SCSI Controller"
+IDS_HWC_CARD_1_MS_SCSI "Maynard PC 16-Bit SCSI Controller"
+IDS_HWC_CARD_2_MS_SCSI "Maynard PS/2 SCSI Controller"
+
+IDS_HWC_DRIVER_MS_QIC "MS_QIC"
+IDS_HWC_CARD_0_MS_QIC "Maynard PC QIC-02 Controller"
+IDS_HWC_CARD_1_MS_QIC "Maynard PS/2 QIC-02 Controller"
+
+IDS_HWC_DRIVER_AD_SCSI "AD_SCSI"
+IDS_HWC_CARD_0_AD_SCSI "ASPI PC SCSI Controller"
+IDS_HWC_CARD_1_AD_SCSI "ASPI PS/2 SCSI Controller"
+
+IDS_HWC_DRIVER_MS_DUMMY "MS_DUMMY"
+IDS_HWC_CARD_0_MS_DUMMY "Maynard Dummy Controller"
+
+IDS_HWC_DRIVER_IBM_SCSI "IBM_SCSI"
+IDS_HWC_CARD_0_IBM_SCSI "IBM PS/2 SCSI Controller"
+
+
+IDS_HWC_ATTACHED "&Attached drives"
+IDS_HWC_IOADDRESS "&I/O Address"
+IDS_HWC_IRQNUM "Interrupt &Number"
+IDS_HWC_DMACHANNEL "D&MA Channel"
+
+IDS_HWC_AUTO "Auto Determine"
+IDS_HWC_NONDMA "None (non-DMA)"
+
+IDS_HWC_IO_360 "360"
+IDS_HWC_IO_370 "370"
+IDS_HWC_IO_FF60 "FF60"
+IDS_HWC_IO_FF70 "FF70"
+
+IDS_HWC_0 "0"
+IDS_HWC_1 "1"
+IDS_HWC_2 "2"
+IDS_HWC_3 "3"
+IDS_HWC_4 "4"
+IDS_HWC_5 "5"
+IDS_HWC_6 "6"
+IDS_HWC_7 "7"
+IDS_HWC_8 "8"
+IDS_HWC_9 "9"
+IDS_HWC_10 "10"
+IDS_HWC_11 "11"
+IDS_HWC_12 "12"
+IDS_HWC_13 "13"
+IDS_HWC_14 "14"
+IDS_HWC_15 "15"
+
+
+
+IDS_HWC_TESTRESULTSTITLE "Tape Hardware Initialization Results"
+
+// LEAVE THE TRAILING BLANKS IN THE FOLLOWING STRINGS!
+
+IDS_HWC_TESTED_NOT "The hardware has not been initialized for this configuration. "
+IDS_HWC_TESTED_GOOD "The hardware is ACTIVE and initialized for this configuration. "
+IDS_HWC_TESTED_BAD "The hardware FAILED to initialize for this configuration. "
+IDS_HWC_TESTED_INIT "The hardware is initializing. "
+
+IDS_HWC_NOCONFIG "Select a controller card."
+
+IDS_HWC_INIT_SUCCESS "The hardware has been tested successfully."
+
+IDS_HWC_JUMPER_CHANGE "Warning: this change requires a jumper change to the controller card."
+
+#ifdef OS_WIN32
+IDS_POLLDRIVE_BIGPROBLEM "No tape drive detected. If a tape drive is attached, make sure that the cables are properly connected and that the power is on. Also make sure that the appropriate tape driver has been installed using the Tape Devices option in Control Panel."
+IDS_HWC_NO_DRIVE "A SCSI tape device has been detected, but the tape driver has either not been installed, or failed to start. Make sure that the appropriate driver has been installed using the Tape Devices option in Control Panel."
+IDS_POLLDRIVE_SMALLPROBLEM "A tape device has been detected, and the tape driver started. However, the tape device is not responding. Check that tape device power is on and cables are properly connected."
+#else
+IDS_HWC_NO_DRIVE "No tape drive has been detected. Make sure a tape drive is attached and power is on."
+IDS_POLLDRIVE_BIGPROBLEM "A hardware error has been detected. All attempts to correct this problem have failed. Please exit %s. It is not safe to continue."
+IDS_POLLDRIVE_SMALLPROBLEM "A hardware error has been detected. The hardware must be tested to help determine the problem."
+#endif
+
+IDS_HWC_INTERRUPT_CONFLICT "Interrupt conflict. Change the controller interrupt number."
+IDS_HWC_DMA_CONFLICT "DMA conflict. Change the controller card DMA setting."
+IDS_HWC_NO_CARD "No card has been detected. Install a card in the machine."
+IDS_HWC_INVALID_BASE_ADDR "Invalid Base Address. Select a different address."
+IDS_HWC_INVALID_INTERRUPT "Invalid Interrupt Number. Select a different number."
+IDS_HWC_INVALID_DMA "Invalid DMA Channel. Select a different channel."
+IDS_HWC_ATTACHED_DRIVES "The number of attached drives found (%u) does not match the configured value (%u)."
+IDS_HWC_NO_TARGET_ID "No Target ID has been selected. At least one Target ID must be selected."
+IDS_HWC_CARD_DISABLED "The Controller Card is Disabled. Enable it to perform the test."
+IDS_HWC_NO_DRIVE_LOADED "The device driver failed to load. This may be due to an incomplete installation. Reinstall or contact Technical Support."
+IDS_HWC_ERROR_NUMBER "HARDWARE ERROR: 0x%.4x. Contact Technical Support."
+
+IDS_HWC_WARNING_TITLE "Hardware Configuration Warning"
+IDS_HWC_NO_CONFIG "A controller card has not been selected. Do you wish to select one now?"
+
+#ifdef OEM_MSOFT
+IDS_POLLDRIVE_MESSAGE "Tape Drive Error Detected"
+#else
+IDS_POLLDRIVE_MESSAGE "Hardware Error Detected"
+#endif
+
+IDS_POLLDRIVE_DRIVE_FAILURE "The tape drive is not responding. Please check to make sure the tape drive is on, the cables are connected and the tape driver is installed. Then restart the %s program."
+IDS_POLLDRIVE_TAPE_EJECT "Tape Eject had a BIG PROBLEM: %d"
+
+
+
+
+// THE FOLLOWING DO NOT HAVE TO BE TRANSLATED!!!!!
+
+IDS_POLLDRIVE_INIT "Poll Drive Initialized"
+IDS_POLLDRIVE_INIT_FAILED "Poll Drive Initialization failed - FS_OpenFileSys()"
+IDS_POLLDRIVE_START "Poll Drive Start Message: %d"
+IDS_POLLDRIVE_POLL "Poll Drive Poll Message: %d"
+IDS_POLLDRIVE_STOP "Poll Drive Stop Message: %d"
+IDS_POLLDRIVE_START_REENT "Poll Drive RE_ENTERED: Start Message"
+IDS_POLLDRIVE_POLL_REENT "Poll Drive RE_ENTERED: Poll Message"
+IDS_POLLDRIVE_STOP_REENT "Poll Drive RE_ENTERED: Stop Message"
+IDS_POLLDRIVE_FAILED_MINOR "Poll Drive FAILED: MINOR ERROR -- Temporarily Ending Poll Drive"
+IDS_POLLDRIVE_FAILED_SEVERE "Poll Drive FAILED: SEVERE ERROR -- Shutting Off Poll Drive"
diff --git a/private/utils/ntbackup/src/icons.rc b/private/utils/ntbackup/src/icons.rc
new file mode 100644
index 000000000..36b6e2a6f
--- /dev/null
+++ b/private/utils/ntbackup/src/icons.rc
@@ -0,0 +1,85 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: wntrpark.rc
+
+ Description: This file contains the references to icon resources for
+ the Windows GUI Project Resource File.
+
+ $Log: G:/UI/LOGFILES/ICONS.RCV $
+
+ Rev 1.6 04 Jun 1992 17:21:10 DAVEV
+ OEM_MSOFT: only included icons which are required - no extras allowed
+
+ Rev 1.5 31 Mar 1992 14:07:56 DAVEV
+ OEM_MSOFT: alternate icons
+
+ Rev 1.4 04 Mar 1992 14:39:54 GLENN
+ Changed to old icons.
+
+ Rev 1.3 03 Mar 1992 18:02:50 GLENN
+ Updated animated icons.
+
+ Rev 1.2 26 Jan 1992 16:37:28 CHUCKB
+ Fixed some includes.
+
+ Rev 1.1 22 Jan 1992 12:27:50 GLENN
+ Added animated icons
+
+ Rev 1.0 20 Nov 1991 19:17:26 SYSTEM
+ Initial revision.
+
+******************************************************************************/
+
+// ICONS -- ID's are defined in the Resource Manager header file 'ss_rsm.h'
+#ifdef OEM_MSOFT //alternate icons
+
+ IDRI_WNTRPARK ICON ombackup.ico // Main icon.
+ //IDRI_BACKUP ICON ombacku2.ico // Backup icon.
+
+#else //ifdef OEM_MSOFT //alternate main icon
+
+ IDRI_WNTRPARK ICON wp6.ico // Main icon.
+
+#endif //OEM_MSOFT //alternate main icon
+
+IDRI_DISKS ICON disks.ico // Disks icon.
+IDRI_TAPES ICON tapes3.ico // Tapes icon.
+IDRI_TREE ICON tree.ico // Hierarchical tree list icon.
+IDRI_FILES ICON files.ico // Files list icon.
+IDRI_TREEFILE ICON treefile.ico // Tree and file list icon.
+IDRI_DEBUG ICON debug.ico // Debug window icon.
+IDRI_EXCHANGE ICON entrpris.ico // Enterprise icon.
+
+#ifndef OEM_MSOFT
+
+ IDRI_SETUP ICON setup.ico // Setup icon.
+ IDRI_JOBS ICON jobs.ico // Jobs icon.
+ IDRI_JOBS1 ICON jobs1.ico // Jobs 1 icon.
+ IDRI_JOBS2 ICON jobs2.ico // Jobs 2 icon.
+ IDRI_SERVERS ICON servers.ico // Servers icon.
+ IDRI_LOGFILES ICON logfiles.ico // Log files icon.
+ IDRI_SEARCH ICON search.ico // Search results icon.
+
+ IDRI_BACKUP ICON backup.ico // Backup icon.
+
+ IDRI_RESTORE ICON restore.ico // Restore icon.
+ IDRI_TRANSFER ICON transfer.ico // Transfer icon.
+ IDRI_DONE ICON done.ico // Operation Done icon.
+ IDRI_BKUP0 ICON bkup0.ico // Animated backup icon.
+ IDRI_BKUP1 ICON bkup1.ico // Animated backup icon.
+ IDRI_BKUP2 ICON bkup2.ico // Animated backup icon.
+ IDRI_BKUP3 ICON bkup3.ico // Animated backup icon.
+ IDRI_BKUP4 ICON bkup4.ico // Animated backup icon.
+ IDRI_BKUP5 ICON bkup5.ico // Animated backup icon.
+ IDRI_BKUP6 ICON bkup6.ico // Animated backup icon.
+ IDRI_BKUP7 ICON bkup7.ico // Animated backup icon.
+ IDRI_BKUP8 ICON bkup00.ico // Animated backup icon.
+ IDRI_SPIN0 ICON spin0.ico // Animated tape spin icon.
+ IDRI_SPIN1 ICON spin1.ico // Animated tape spin icon.
+ IDRI_SPIN2 ICON spin2.ico // Animated tape spin icon.
+ IDRI_SPIN3 ICON spin3.ico // Animated tape spin icon.
+
+#endif //OEM_MSOFT
diff --git a/private/utils/ntbackup/src/initfsys.c b/private/utils/ntbackup/src/initfsys.c
new file mode 100644
index 000000000..8a0aaddb5
--- /dev/null
+++ b/private/utils/ntbackup/src/initfsys.c
@@ -0,0 +1,456 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: initfsys.c
+
+ Description: This file contains code used to initialize the DLE
+ list. To do this all necessary resoruces are allocated.
+ Additionaly, this function contains the critical error function.
+
+
+ $Log: M:/LOGFILES/INITFSYS.C_V $
+
+ Rev 1.33 04 Jan 1994 14:30:08 BARRY
+Now call fs init entry points from FS_InitFileSys, not DLE_UpdateList
+
+ Rev 1.32 07 Sep 1993 14:54:50 MARINA
+(BARRY) Init MSNET function table
+
+ Rev 1.31 23 Jun 1993 10:45:26 DON
+Added back the change made in rev 1.29 which was lost when Mike P. Enabled C++ in rev 1.30
+
+ Rev 1.30 18 Jun 1993 10:04:50 MIKEP
+enable c++
+
+ Rev 1.28 19 May 1993 16:49:58 DON
+Only skip the DLE_UpdateList for OS_NLM. Causes problems the Client App can't deal with
+
+ Rev 1.27 19 May 1993 11:12:06 Stefan
+If compiling for the windows client, need to keep the DLE_Updatelist
+call in the initialization.
+
+ Rev 1.26 18 May 1993 20:05:18 DON
+Made the ifdef's a bit more readable!
+
+ Rev 1.25 18 May 1993 16:24:24 DON
+if OS_NLM or P_CLIENT then there's no need to call DLE_UpdateList until we
+actually need to use the dle_list.
+
+ Rev 1.24 19 Jan 1993 15:34:30 DOUG
+Changed dle_hand malloc() to calloc()
+
+ Rev 1.23 13 Jan 1993 15:04:38 DOUG
+Changed FS_RMFS to FS_GRFS
+
+ Rev 1.22 11 Nov 1992 22:26:52 GREGG
+Unicodeized literals.
+
+ Rev 1.21 18 Aug 1992 10:22:30 STEVEN
+fix warnings
+
+ Rev 1.20 05 Aug 1992 10:54:58 DON
+removed warning's
+
+ Rev 1.19 01 Mar 1992 12:34:42 DOUG
+Added support for RMFS.
+
+ Rev 1.18 13 Jan 1992 18:45:48 STEVEN
+changes for WIN32 compile
+
+ Rev 1.17 20 Dec 1991 10:41:46 STEVEN
+redesign function for common functions into tables
+
+ Rev 1.16 06 Dec 1991 11:31:36 BARRY
+Fixed default device problems
+
+ Rev 1.15 14 Nov 1991 10:07:46 BARRY
+Use new defines for initialization bits (to reflect the move from
+be_init.h to fsys_str.h).
+
+ Rev 1.14 13 Nov 1991 14:56:44 BARRY
+Misspelled some of the BE_FS macros.
+
+ Rev 1.13 31 Oct 1991 19:03:22 BARRY
+Forgot to include be_init.h.
+
+ Rev 1.12 24 Oct 1991 14:57:18 BARRY
+TRICYCLE: Added new bit-mask parameter to FS_InitFileSys() to select
+file systems at run-time.
+
+ Rev 1.11 01 Oct 1991 11:15:26 BARRY
+Include standard headers.
+
+ Rev 1.10 10 Sep 1991 17:32:24 STEVEN
+need to determine net before add servers
+
+ Rev 1.9 09 Sep 1991 10:17:06 BARRY
+Added support for SMS.
+
+ Rev 1.8 12 Aug 1991 15:47:00 BARRY
+BEC_DisplayNetwareServers( ) should not be referenced. We always add
+all kinds of Novell DLEs.
+
+ Rev 1.7 06 Aug 1991 18:31:34 DON
+added NLM File System support
+
+ Rev 1.6 25 Jul 1991 16:24:02 BARRY
+Config changes, fix up #ifdef code, NLM warning removal.
+
+ Rev 1.5 04 Jun 1991 18:46:46 BARRY
+Removed critical error code and now call InitCritErrorHandler() and
+DeInitCritErrorHandler() functions. (These reside in separate
+OS-specific modules.)
+
+ Rev 1.4 03 Jun 1991 13:26:40 BARRY
+Remove product defines from conditional compilation.
+
+ Rev 1.3 29 May 1991 11:07:44 STEVEN
+fix bugs in DLE insertsion sort
+
+ Rev 1.2 28 May 1991 12:05:26 STEVEN
+fix typo
+
+ Rev 1.1 23 May 1991 16:40:06 BARRY
+Changed FSYSs to be conditional on FS_XXX defines instead of product defines.
+
+ Rev 1.0 09 May 1991 13:35:40 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+
+#if defined( OS_OS2 )
+
+#define INCL_DOS
+#include <os2.h>
+
+#elif defined( OS_DOS )
+
+#include <dos.h>
+
+#endif /* OS-specific includes */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "crit_err.h"
+#include "beconfig.h"
+#include "be_debug.h"
+
+/* $end$ include list */
+
+INT16 (*uw_crit_err)( CHAR_PTR, UINT16 ) = NULL ; /* user interface critical error handler */
+BOOLEAN uw_critical_error = FALSE ;
+
+/**/
+/**
+
+ Name: FS_InitFileSys()
+
+ Description: This function builds a list of all accessible drives
+ (DLEs). It also allocates resources needed to store and maintain this
+ list. It installs acritical error handler. The crit_err parameter
+ passed in points to a user interface function which prompts the user
+ to Abort, Retry, OR Ignore.
+
+
+ Modified: 7-12-89
+
+ Returns: The return value is an error code. They are:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: This function is designed to only be called once.
+ The limitation is due to the critical error handler. There can
+ only be one handler, thus multiple installs must discard old
+ critical error handlers. If this does not cause a problem with
+ the application the multiple calls can be made.
+
+
+ See also: $/SEE( FS_OpenFileSys() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_InitFileSys(
+DLE_HAND *hand, /* O - head of DLE list */
+BOOLEAN (*crit_err)( CHAR_PTR, UINT16 ), /* I - user interface critical error handler */
+BE_CFG_PTR cfg, /* I - config struct needed to create partition names */
+UINT16 remote_filter , /* I - bit_mask to specify visible remote resource types */
+UINT32 file_sys_mask ) /* I - bit_mask to specify file systems */
+{
+ BOOLEAN allocation_error = FALSE ;
+ INT16 ret_val = SUCCESS ;
+ INT16 i ;
+
+ /* Remote filter parameter not currently used */
+ (VOID) remote_filter ;
+
+ /* Initialize all entries to GENERIC for starters */
+
+ for ( i = 0; (i < MAX_DRV_TYPES); i++ ) {
+ func_tab[ i ] = GENFuncTab ;
+ }
+
+ /* Conditionally set all of the other entries to real FSs */
+
+#if defined( FS_DOS )
+ func_tab[ LOCAL_DOS_DRV ] = DOSFuncTab ;
+#endif
+
+#if defined( FS_OS2 )
+ func_tab[ LOCAL_OS2_DRV ] = OS2FuncTab ;
+#endif
+
+#if defined( FS_IMAGE )
+ func_tab[ LOCAL_IMAGE ] = ImageTab ;
+#endif
+
+#if defined( FS_REMOTE )
+ func_tab[ REMOTE_WORK_STAT ] = RemoteWSFuncTab ;
+ func_tab[ REMOTE_DOS_DRV ] = RemoteFuncTab ;
+#elif defined( FS_FAKEREM )
+ func_tab[ REMOTE_WORK_STAT ] = FakeRemoteWSFuncTab ;
+ func_tab[ REMOTE_DOS_DRV ] = FakeRemoteFuncTab ;
+#endif
+
+#if defined( FS_NOV_SERVER )
+ func_tab[ NOVELL_SERVER_ONLY ] = ServerVolFuncTab ;
+#endif
+
+#if defined( FS_AFP )
+ func_tab[ NOVELL_AFP_DRV ] = AFP_NovellFuncTab ;
+#endif
+
+#if defined( FS_NONAFP )
+ func_tab[ NOVELL_DRV ] = NovellFuncTab ;
+#endif
+
+#if defined( FS_NLMSERVER )
+ func_tab[ NLM_SERVER_ONLY ] = NLMServerVolFuncTab ;
+#endif
+
+#if defined( FS_NLMAFP )
+ func_tab[ NLM_AFP_VOLUME ] = NLMAFPNovellFuncTab ;
+#endif
+
+#if defined( FS_NLMNOV )
+ func_tab[ NLM_VOLUME ] = NLMNovellFuncTab ;
+#endif
+
+#if defined( FS_OS2 )
+ func_tab[ LOCAL_OS2_DRV ] = OS2FuncTab ;
+ if ( uw_os_version == 0 ) {
+ if ( DosGetVersion( &uw_os_version ) != SUCCESS ) {
+ uw_os_version = OS2_VER_1_1 ;
+ }
+ }
+#endif
+
+#if defined( FS_NTFS )
+ func_tab[ LOCAL_NTFS_DRV ] = NTFSFuncTab ;
+#endif
+
+
+#if defined( FS_SMS )
+ func_tab[ SMS_AGENT ] = TSAFuncTab ;
+ func_tab[ SMS_SERVICE ] = TSFuncTab ;
+ func_tab[ SMS_OBJECT ] = SMSFuncTab ;
+#endif
+
+#if defined( FS_GRFS )
+ func_tab[ GRFS_SERVER ] = GRFSFuncTab ;
+#endif
+
+#if defined( FS_MSNET )
+ func_tab[ MSNET ] = MSNetFuncTab ;
+#endif
+
+#if defined( FS_EMS )
+ func_tab[ FS_EMS_DRV ] = EMSFuncTab ;
+#endif
+
+/*
+ initialize the queue header
+*/
+
+ /** DJF: calloc() the dle_hand structure, so fs_initialize
+ field is reset **/
+
+ *hand = (struct HEAD_DLE *)calloc( 1, sizeof( struct HEAD_DLE ) ) ;
+ if ( *hand == NULL ) {
+ allocation_error = TRUE ;
+
+ } else {
+
+ (*hand)->default_drv = NULL ;
+ InitQueue( &((*hand)->q_hdr) ) ;
+ InitQueue( &((*hand)->fsh_queue) ) ;
+
+ InitCritErrorHandler( crit_err );
+ }
+
+ (*hand)->file_sys_mask = file_sys_mask ;
+
+
+/*
+ Pre -Initializes any special file systems
+*/
+
+ for ( i = 0; (i < MAX_DRV_TYPES) && (ret_val == SUCCESS); i++ ) {
+ if ( func_tab[i].InitFsys != NULL ) {
+ ret_val = func_tab[i].InitFsys( *hand, cfg, file_sys_mask ) ;
+ }
+ }
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = DLE_UpdateList( *hand, cfg ) ;
+ }
+
+ if ( ret_val != SUCCESS ) {
+ FS_RemoveFileSys( *hand ) ;
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: FS_RemoveFileSys()
+
+ Description: This function releases all resources allocated by the
+ FS_InitFileSys( ) call. It also releases the Critical Error Handler.
+
+
+ Modified: 7/12/1989
+
+ Returns: Error codes:
+ FS_NOT_INITIALIZED
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( FS_InitFileSys() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID FS_RemoveFileSys(
+DLE_HAND hand ) /* I - drive list handle */
+{
+ GENERIC_DLE_PTR temp_dle ;
+ INT16 i ;
+
+ DLE_GetFirst( hand, &temp_dle ) ;
+
+ while ( temp_dle != NULL ) {
+ DLE_RemoveRecurse( temp_dle, TRUE ) ;
+ DLE_GetFirst( hand, &temp_dle ) ;
+ }
+
+ for( i = 0; i < MAX_DRV_TYPES; i++ ) {
+ if ( func_tab[i].DeInit != NULL ) {
+ func_tab[i].DeInit( hand ) ;
+ }
+ }
+
+ DeInitCritErrorHandler( ) ;
+
+ free( hand ) ;
+}
+
+
+
+/**/
+/**
+
+ Name: DLE_QueueInsert()
+
+ Description: This function inserts a dle into the DLE list
+
+ Modified: 9/26/1990
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID DLE_QueueInsert(
+DLE_HAND dle_hand, /* I - head of DLE list */
+GENERIC_DLE_PTR new_dle ) /* I - dle to insert into queue */
+{
+ GENERIC_DLE_PTR temp_dle ;
+ GENERIC_DLE_PTR last_dle = NULL ;
+ CHAR_PTR new_name ;
+ CHAR_PTR q_elem_name ;
+
+ new_name = DLE_GetDeviceName( new_dle ) ;
+
+ temp_dle = (GENERIC_DLE_PTR)QueueHead( &(dle_hand->q_hdr) ) ;
+
+ while( temp_dle != NULL ) {
+
+ q_elem_name = DLE_GetDeviceName( temp_dle ) ;
+
+ if ( ( new_name[1] == TEXT(':') ) && ( new_name[2] == TEXT('\0') ) &&
+ ( new_dle->type != LOCAL_IMAGE ) ) {
+
+ if ( ( q_elem_name[1] == TEXT(':') ) && ( q_elem_name[2] == TEXT('\0') ) ) {
+
+ if ( new_name[0] < q_elem_name[0] ) {
+ break ;
+ }
+
+ } else {
+
+ break ;
+ }
+ } else {
+
+ if ( new_dle->type < temp_dle->type ) {
+ break ;
+
+ } else if ( new_dle->type == temp_dle->type ) {
+
+ if ( stricmp( new_name, q_elem_name ) < 0 ) {
+ break ;
+ }
+ }
+ }
+
+ last_dle = temp_dle ;
+ temp_dle = (GENERIC_DLE_PTR)QueueNext( &(temp_dle->q) ) ;
+ }
+
+ if ( temp_dle == NULL ) {
+
+ EnQueueElem( &(dle_hand->q_hdr), &((new_dle)->q), FALSE ) ;
+
+ } else if ( last_dle == NULL ) {
+
+ InsertElem( &(dle_hand->q_hdr), &(temp_dle->q), &(new_dle->q), BEFORE ) ;
+
+ } else {
+
+ InsertElem( &(dle_hand->q_hdr), &(last_dle->q), &(new_dle->q), AFTER ) ;
+ }
+
+ return ;
+}
+
diff --git a/private/utils/ntbackup/src/log.c b/private/utils/ntbackup/src/log.c
new file mode 100644
index 000000000..1e3613929
--- /dev/null
+++ b/private/utils/ntbackup/src/log.c
@@ -0,0 +1,1864 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: log.c
+
+ Description: This file contains the functions for the GUI Log File
+ Manager (LOG). The functions handle reading, writing,
+ displaying, the log files. The Log File Manager uses the
+ Display List Manager to list and display the files.
+
+ $Log: G:/UI/LOGFILES/LOG.C_V $
+
+ Rev 1.50 22 Jul 1993 17:06:20 MARINA
+enable c++
+
+ Rev 1.49 24 Jun 1993 10:52:48 KEVINS
+Avoid potential hang by not checking return status when deleting log file.
+
+ Rev 1.48 21 Jun 1993 15:56:12 KEVINS
+Check return status of log file selected, just in case it's not there.
+
+ Rev 1.47 07 Jun 1993 08:18:26 MIKEP
+Fix warnings.
+
+ Rev 1.46 24 May 1993 15:21:44 BARRY
+Unicode fixes.
+
+ Rev 1.45 10 May 1993 17:14:36 KEVINS
+Allow user to specify log file base name.
+
+ Rev 1.44 02 May 1993 16:54:28 MIKEP
+Add call to support log files base name changing.
+
+ Rev 1.43 21 Apr 1993 10:31:50 DARRYLP
+Added the setting of the file name to the local variable to allow a viewed
+log file to be printed.
+
+ Rev 1.42 29 Mar 1993 11:05:14 TIMN
+Added f(x)s to get the catalog path or filename only
+
+ Rev 1.41 17 Mar 1993 18:12:58 DARRYLP
+Cleaned up display of file/date/time.
+
+ Rev 1.40 16 Mar 1993 12:38:54 CARLS
+LOG file changes
+
+ Rev 1.39 13 Mar 1993 20:13:12 MIKEP
+VLM_CloseWin will free the wininfo pointer
+
+
+******************************************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+// PRIVATE FUNCTION PROTOTYPES
+
+BOOL LOG_InsertFiles ( Q_HEADER_PTR pLogQueue );
+BOOL LOG_KillLogFiles ( Q_HEADER_PTR pLogQueue, BOOL fRefresh );
+BOOL LOG_MakeNewFile ( LPSTR szFileName );
+VOID_PTR LOG_SetTag ( LOGITEM_PTR pLogItem, BYTE bTag );
+BYTE LOG_GetTag ( LOGITEM_PTR pLogItem );
+UINT LOG_GetItemCount ( Q_HEADER_PTR pLogQueue );
+VOID_PTR LOG_GetFirstItem ( Q_HEADER_PTR pLogQueue );
+VOID_PTR LOG_GetNextItem ( LOGITEM_PTR pLogItem );
+VOID_PTR LOG_GetPrevItem ( LOGITEM_PTR pLogItem );
+VOID_PTR LOG_GetObjects ( LOGITEM_PTR pLogItem );
+VOID_PTR LOG_SetObjects ( LOGITEM_PTR, WORD, BYTE );
+VOID LOG_SortLogFiles ( Q_HEADER_PTR pLogQueue );
+VOID LOG_ViewFile ( LOGITEM_PTR pLogItem );
+INT16 LOG_ItemCompare ( Q_ELEM_PTR pLogElem1, Q_ELEM_PTR pLogElem2 ) ;
+INT LOG_BuildLogViewList ( DLM_LOGITEM_PTR pDlm ) ;
+VOID LOG_BuildTitle ( LOGITEM_PTR pLogItem ) ;
+
+VOID_PTR LOG_SetViewTag ( LOGVIEWITEM_PTR pLogViewItem, BYTE bTag );
+BYTE LOG_GetViewTag ( LOGVIEWITEM_PTR pLogViewItem );
+VOID_PTR LOG_GetViewNextItem ( LOGVIEWITEM_PTR pLogViewItem );
+VOID_PTR LOG_GetViewPrevItem ( LOGVIEWITEM_PTR pLogViewItem );
+VOID_PTR LOG_GetViewObjects ( LOGVIEWITEM_PTR pLogViewItem );
+VOID_PTR LOG_SetViewObjects ( LOGVIEWITEM_PTR, WORD, BYTE );
+
+VOID LOG_ProcessViewList ( INT hFile, Q_HEADER_PTR pLogViewQueue, LPSTR szLogFile ) ;
+LPSTR LOG_GetLineFromFile ( INT hFile, LPWORD pwLength ) ;
+
+
+#define READBUFFERSIZE 4000
+#define MAXLINELENGTH 132
+
+static Q_HEADER_PTR mwpLogQueue;
+
+static UCHAR mwszCurrentLogFile [ MAX_UI_FULLPATH_SIZE ] = TEXT("\0");
+static UCHAR mwszCurrentViewLogFile [ MAX_UI_FULLPATH_SIZE ] = TEXT("\0");
+
+
+// FUNCTIONS
+
+
+/******************************************************************************
+
+ Name: LOG_BaseNameChanged()
+
+ Description: Refresh the window the base name displayed has changed.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+VOID LOG_BaseNameChanged( VOID ) {
+
+ LOG_Refresh( );
+
+}
+
+/******************************************************************************
+
+ Name: LOG_Init()
+
+ Description: This function initializes and creates the log files window.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+VOID LOG_Init ( VOID )
+
+{
+# if defined ( OEM_MSOFT ) // special feature
+ {
+# define OEMLOG_MAX_FILEPATH 512 //NTKLUG
+
+ CHAR szLogFilePath [ OEMLOG_MAX_FILEPATH ];
+ INT len;
+
+ if ( len = GetWindowsDirectory ( szLogFilePath,
+ OEMLOG_MAX_FILEPATH ) )
+ {
+ if ( szLogFilePath [ len-1 ] != TEXT('\\') //NTKLUG
+ && len < OEMLOG_MAX_FILEPATH )
+ {
+ strcat ( szLogFilePath, TEXT("\\") );
+ ++len;
+ }
+ if ( len < OEMLOG_MAX_FILEPATH
+ && RSM_StringCopy( IDS_OEMLOG_BACKUP_DEF_NAME,
+ szLogFilePath+len,
+ OEMLOG_MAX_FILEPATH - len ) > 0 )
+ {
+ LOG_SetCurrentLogName ( szLogFilePath );
+ }
+ }
+
+ }
+# endif //defined ( OEM_MSOFT ) // special feature
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+
+ PDS_WMINFO pdsWinInfo;
+ DLM_INIT dsDLM;
+ Q_HEADER_PTR pLogQueue;
+ UCHAR szName[ MAX_UI_RESOURCE_SIZE ] ;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+
+ ghWndLogFileView = 0;
+
+ pLogQueue = mwpLogQueue = (Q_HEADER_PTR)calloc( 1, sizeof(Q_HEADER) );
+
+ InitQueue ( pLogQueue );
+
+ // Check for any log files.
+
+ LOG_InsertFiles ( pLogQueue );
+
+ // Create the log window.
+
+ pdsWinInfo = (PDS_WMINFO)( calloc ( 1, sizeof ( DS_WMINFO ) ) );
+
+ WMDS_SetWinType ( pdsWinInfo, WMTYPE_LOGFILES );
+ WMDS_SetWinClosable ( pdsWinInfo, FALSE );
+ WMDS_SetCursor ( pdsWinInfo, RSM_CursorLoad ( ID(IDRC_ARROW) ) );
+ WMDS_SetIcon ( pdsWinInfo, RSM_IconLoad ( IDRI_LOGFILES ) );
+ WMDS_SetRibbon ( pdsWinInfo, ghRibbonMain );
+ WMDS_SetFlatList ( pdsWinInfo, pLogQueue );
+
+ DLM_ListBoxType ( &dsDLM, DLM_FLATLISTBOX );
+ DLM_Mode ( &dsDLM, DLM_SINGLECOLUMN ) ;
+ DLM_Display ( &dsDLM, DLM_SMALL_BITMAPS );
+ DLM_DispHdr ( &dsDLM, pLogQueue );
+ DLM_TextFont ( &dsDLM, DLM_SYSTEM_FONT );
+ DLM_GetItemCount ( &dsDLM, LOG_GetItemCount );
+ DLM_GetFirstItem ( &dsDLM, LOG_GetFirstItem );
+ DLM_GetNext ( &dsDLM, LOG_GetNextItem );
+ DLM_GetPrev ( &dsDLM, LOG_GetPrevItem );
+ DLM_GetObjects ( &dsDLM, LOG_GetObjects );
+ DLM_SetObjects ( &dsDLM, LOG_SetObjects );
+ DLM_GetTag ( &dsDLM, LOG_GetTag );
+ DLM_SetTag ( &dsDLM, LOG_SetTag );
+ DLM_GetSelect ( &dsDLM, NULL );
+ DLM_SetSelect ( &dsDLM, NULL );
+ DLM_SSetItemFocus ( &dsDLM, NULL ) ;
+ DLM_MaxNumObjects ( &dsDLM, 8 );
+
+ DLM_DispListInit ( pdsWinInfo, &dsDLM );
+
+ RSM_StringCopy( IDS_LOGFILESWINDOWNAME, (LPSTR)szName, MAX_UI_RESOURCE_LEN ) ;
+
+ ghWndLogFiles = WM_Create ( (WORD)(WM_MDIPRIMARY | WM_FLATLISTSC | CDS_GetLogInfo ( pCDS ).nSize),
+ (LPSTR) szName,
+ (LPSTR) NULL,
+ (INT)CDS_GetLogInfo ( pCDS ).x,
+ (INT)CDS_GetLogInfo ( pCDS ).y,
+ (INT)CDS_GetLogInfo ( pCDS ).cx,
+ (INT)CDS_GetLogInfo ( pCDS ).cy,
+ pdsWinInfo );
+
+ DLM_DispListProc ( WMDS_GetWinFlatList ( pdsWinInfo ), 0, NULL );
+
+ WM_Show ( ghWndLogFiles );
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+
+} /* end LOG_Init() */
+
+
+/******************************************************************************
+
+ Name: LOG_Deinit()
+
+ Description: This function deinitializes the log files window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID LOG_Deinit ( VOID )
+
+{
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ CDS_PTR pCDS = CDS_GetPerm ();
+ PDS_WMINFO pdsWinInfo;
+
+
+ // See if the current session log file should be printed.
+ // Do not attempt to print if winback was called by the
+ // program manager or the launcher.
+
+ if ( CDS_GetYesFlag( pCDS ) != YESYES_FLAG ) {
+
+ PM_CheckSessionLogPrint() ;
+
+ }
+
+ // Destroy the log file view and log file windows.
+
+ if ( IsWindow( ghWndLogFileView) ) {
+
+ pdsWinInfo = WM_GetInfoPtr ( ghWndLogFileView );
+
+ WM_Destroy ( ghWndLogFileView );
+ }
+
+ if ( IsWindow( ghWndLogFiles) ) {
+
+ pdsWinInfo = WM_GetInfoPtr ( ghWndLogFiles );
+
+ CDS_WriteLogWinSize ( ghWndLogFiles );
+ WM_Destroy ( ghWndLogFiles );
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+} /* end LOG_Deinit() */
+
+
+/******************************************************************************
+
+ Name: LOG_GetLogFileName()
+
+ Description: This function gets a log file name from an item that has
+ been tagged. This name is used by the Print Manager to
+ print the log file.
+
+ Returns: A pointer to the next tagged log file item in the list.
+
+******************************************************************************/
+
+VOID_PTR LOG_GetLogFileName (
+
+VOID_PTR pLogItem, // I - pointer to NULL or a log item.
+LPSTR pString ) // O - pointer to log file name to be printed.
+
+{
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ PDS_WMINFO pdsWinInfo;
+ Q_HEADER_PTR pLogQueue;
+ CDS_PTR pCDS = CDS_GetPerm();
+
+ // If the log item pointer is 0, return the first item in the queue.
+ // Otherwise, get the next item in the queue.
+
+ if ( ! pLogItem ) {
+
+ pdsWinInfo = WM_GetInfoPtr ( ghWndLogFiles );
+
+ pLogQueue = pdsWinInfo->pFlatList;
+
+ DLM_UpdateTags ( ghWndLogFiles, DLM_FLATLISTBOX );
+
+ pLogItem = (VOID_PTR)LOG_GetFirstItem ( pLogQueue );
+ }
+ else {
+ pLogItem = (VOID_PTR)LOG_GetNextItem ( (LOGITEM_PTR) pLogItem );
+ }
+
+ // Look for the next item that is tagged.
+
+ do {
+ if ( pLogItem && ((LOGITEM_PTR)pLogItem)->bTag ) {
+
+ wsprintf ( pString, TEXT("%s%s"),
+ CDS_GetUserDataPath (),
+ (((LOGITEM_PTR)pLogItem)->szFileName ) );
+
+ break;
+ }
+ else if ( pLogItem ) {
+
+ pLogItem = (VOID_PTR)LOG_GetNextItem ( (LOGITEM_PTR) pLogItem );
+ }
+
+ } while ( pLogItem );
+
+
+ if ( ! pLogItem ) {
+
+ *pString = 0;
+ }
+
+ return pLogItem;
+ }
+# else //if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ return (VOID_PTR)( pLogItem = NULL );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+} /* end LOG_GetLogFileName() */
+
+
+/******************************************************************************
+
+ Name: LOG_Refresh()
+
+ Description: This function refreshes the log files window by keeping
+ the most recent number of files that the user has
+ specified.
+
+ Notes: User will lose highlighted selections after this call.
+
+ Returns: none
+
+******************************************************************************/
+
+VOID LOG_Refresh ( VOID )
+
+{
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+
+ PDS_WMINFO pdsWinInfo ;
+ Q_HEADER_PTR pLogQueue ;
+ Q_ELEM_PTR pQElem ;
+ LOGITEM_PTR pLogItem ;
+
+ if ( ! IsWindow( ghWndLogFiles) ) {
+ return;
+ }
+
+ // Blow Away the List
+
+ pdsWinInfo = WM_GetInfoPtr( ghWndLogFiles ) ;
+ pLogQueue = pdsWinInfo->pFlatList;
+
+ // Release all the items in the queue
+
+ pQElem = DeQueueElem( pLogQueue );
+
+ while ( pQElem != NULL ) {
+
+ if ( pQElem->q_ptr ) {
+ free( pQElem->q_ptr );
+ }
+
+ pQElem = DeQueueElem( pLogQueue );
+ }
+
+ // Check for any log files.
+
+ InitQueue ( pLogQueue );
+
+ LOG_InsertFiles ( pLogQueue );
+
+ // Update the Display List Manager.
+
+ DLM_Update ( ghWndLogFiles, DLM_FLATLISTBOX, WM_DLMUPDATELIST, (LMHANDLE)NULL, 0 );
+
+ // IF the first log file on the queue is currently being viewed,
+ // THEN update the Log View File window to reflect possible changes.
+ // A current session log file must exist first.
+
+ if ( ( ghWndLogFileView ) && ( strlen ( LOG_GetCurrentLogName () ) ) ) {
+
+ if ( strcmpi ( LOG_GetCurrentLogName (), (LPSTR)mwszCurrentViewLogFile ) == 0 ) {
+
+ // The current log file will always be the first on the list.
+
+ pLogItem = (LOGITEM_PTR)LOG_GetFirstItem ( pLogQueue );
+
+ LOG_ViewFile( pLogItem ) ;
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+
+} /* end LOG_Refresh() */
+
+
+/******************************************************************************
+
+ Name: LOG_InsertFiles()
+
+ Description: This function inserts log file items into the log files
+ window list in sorted order. The display list manager
+ will use this list to display the information about
+ the log files.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL LOG_InsertFiles (
+
+Q_HEADER_PTR pLogQueue ) // I - pointer to the header of the log item list.
+
+{
+ LOGITEM_PTR pLogItem;
+ UCHAR szPath[ VLM_MAXFNAME ];
+ UCHAR szFile[ VLM_MAXFNAME ];
+ CHAR_PTR pMaynPath;
+ VLM_FIND_PTR pVlmFind = NULL;
+ UINT unHour;
+ CHAR szPrefix [ MAX_UI_RESOURCE_SIZE ] ;
+ CHAR szExtension[ MAX_UI_RESOURCE_SIZE ] ;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+
+ if ( ! pLogQueue ) {
+ return FAILURE;
+ }
+
+ // Get the path and drive.
+
+ pMaynPath = CDS_GetUserDataPath ();
+
+ // Add the file specifier.
+
+ strcpy ( szPrefix , CDS_GetLogFileRoot ( pCDS ) );
+ RSM_StringCopy( IDS_LOGEXTENSION, szExtension, MAX_UI_RESOURCE_LEN ) ;
+
+ wsprintf ( (LPSTR)szPath, TEXT("%s%s%s%s"), pMaynPath, szPrefix, TEXT("??"), szExtension );
+
+ // Get all log file directory entries.
+
+ if ( !( pVlmFind = VLM_FindFirst ( (LPSTR)szPath, VLMFIND_NORMAL, (LPSTR)szFile ) ) )
+ {
+ return FAILURE;
+ }
+
+ // We have a log file.
+
+ do {
+ pLogItem = (LOGITEM_PTR) calloc ( 1, sizeof ( DS_LOGITEM ) );
+
+ // Quick exit if no memory.
+
+ if ( !pLogItem ) {
+ return ( FAILURE ) ;
+ }
+
+ pLogItem->pQElem.q_ptr = pLogItem;
+
+ strcpy ( (LPSTR)pLogItem->szFileName, (LPSTR)szFile );
+
+ // Insert log file into the log file queue.
+
+ unHour = VLM_FindWriteHour ( pVlmFind );
+
+ // Save Date and Time for quick sorting.
+
+ pLogItem->iDate = VLM_FindWriteDate ( pVlmFind );
+ pLogItem->iTime = VLM_FindWriteTime ( pVlmFind );
+ pLogItem->lSize = VLM_FindSize ( pVlmFind );
+
+ EnQueueElem ( pLogQueue, &pLogItem->pQElem, FALSE );
+
+
+ } while ( VLM_FindNext ( pVlmFind, (LPSTR)szFile ) );
+
+ VLM_FindClose( &pVlmFind );
+
+ // Sort them in the queue.
+
+ LOG_SortLogFiles ( pLogQueue ) ;
+
+ // Now kill off the oldest files over the maximum log files to keep.
+
+ LOG_KillLogFiles ( pLogQueue, FALSE );
+
+ return SUCCESS;
+
+} /* end LOG_InsertFiles() */
+
+
+/******************************************************************************
+
+ Name: LOG_KillLogFiles()
+
+ Description: This function deletes the oldest log files maintaining only
+ the most recent number of files that the user has
+ specified. It will refresh the log files window if
+ fRefresh is set to TRUE.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL LOG_KillLogFiles (
+
+Q_HEADER_PTR pLogQueue, // I - the log queue
+BOOL fRefresh ) // I - specifies whether to refresh the log window
+
+{
+ UINT i;
+ UINT usCnt;
+ UINT usKeepCnt;
+ LOGITEM_PTR pLogItem;
+ LOGITEM_PTR pMaxLogItem;
+ CDS_PTR pCDS = CDS_GetPerm();
+
+ if ( ! pLogQueue ) {
+ return FAILURE;
+ }
+
+ // If the number of log sessions = 0, then don't do anything.
+
+ if ( CDS_GetNumLogSessions( pCDS ) == 0 ) {
+ return SUCCESS;
+ }
+
+ // Get the number of log files to keep.
+
+ usKeepCnt = CDS_GetNumLogSessions( pCDS);
+ usCnt = LOG_GetItemCount( pLogQueue );
+
+ // How many log files do we have? Remember the list is sorted by age
+ // in increasing order.
+
+ if ( usCnt && ( usCnt > usKeepCnt ) ) {
+
+ // Delete any extra log files starting with the oldest, etc...
+ // Go the Max number log session item and dequeue all items from
+ // here on.
+
+ pLogItem = (LOGITEM_PTR)LOG_GetFirstItem ( pLogQueue );
+
+ for ( i = 0; ( pLogItem && ( i < ( usKeepCnt - 1 ) ) ); i++ ) {
+ pLogItem = (LOGITEM_PTR)LOG_GetNextItem ( (LOGITEM_PTR) pLogItem );
+ }
+
+ // If list is found to be corrupt, then return FAILURE.
+
+ pMaxLogItem = pLogItem;
+
+ // Delete all elements on the list from here and delete
+ // the log files each element references.
+
+ pLogItem = (LOGITEM_PTR)LOG_GetNextItem ( (LOGITEM_PTR) pMaxLogItem );
+
+ while ( pLogItem ) {
+
+ UCHAR szPath[ MAX_UI_FULLPATH_SIZE ] ;
+
+ // Delete the file after building the full file path name.
+
+ wsprintf ( (LPSTR)szPath, TEXT("%s%s"), CDS_GetUserDataPath(),pLogItem->szFileName );
+
+ // delete the file
+
+ unlink( (LPSTR)szPath );
+
+ // Remove Item off the list.
+
+ RemoveQueueElem( pLogQueue, &pLogItem->pQElem ) ;
+ free( pLogItem ) ;
+
+ pLogItem = (LOGITEM_PTR)LOG_GetNextItem ( (LOGITEM_PTR) pMaxLogItem );
+ }
+
+ if ( fRefresh ) {
+ LOG_Refresh ();
+ }
+ }
+
+ return SUCCESS;
+
+} /* end LOG_KillLogFiles() */
+
+
+/******************************************************************************
+
+ Name: LOG_MakeNewFileName()
+
+ Description: This function makes the next available log file name.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+BOOL LOG_MakeNewFileName (
+
+LPSTR pDest ) // I - destination string pointer
+
+{
+ UCHAR szPath[ MAX_UI_PATH_SIZE ] ;
+ CHAR_PTR pMaynPath;
+ UINT16 unNum;
+ CHAR szPrefix [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szExtension[ MAX_UI_SMALLRES_SIZE ] ;
+
+ BOOL fFound = FALSE;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ // Get the path and drive.
+
+ strcpy ( szPrefix , CDS_GetLogFileRoot ( pCDS ) );
+ RSM_StringCopy( IDS_LOGEXTENSION, szExtension, MAX_UI_SMALLRES_LEN ) ;
+
+ unNum = 0 ;
+
+ pMaynPath = CDS_GetUserDataPath ();
+
+ do {
+ // Add the file specifier, the number, and extension.
+
+ wsprintf ( (LPSTR)szPath, TEXT("%s%s%.2u%s"), pMaynPath, szPrefix, unNum, szExtension );
+
+ // See if the file exists.
+
+ if ( access ( (LPSTR)szPath, LOG_FILEEXISTS ) == -1 ) {
+ fFound = TRUE;
+ }
+ else {
+ unNum++;
+ }
+
+ } while ( ! fFound && unNum < (UINT16) CDS_GetNumLogSessions( pCDS ) );
+
+ wsprintf ( pDest, TEXT("%s%.2u%s"), szPrefix, unNum, szExtension );
+
+ return ! fFound;
+
+} /* end LOG_MakeNewFileName() */
+
+
+
+/******************************************************************************
+
+ Name: LOG_GenerateLogFileName()
+
+ Description: This function will generate a new file name.
+ If the user has reached the maximum limit of log files,
+ the oldest log files will be deleted for a new log file.
+
+ Returns: SUCCESS if successful, otherwise FAILURE.
+
+******************************************************************************/
+
+VOID LOG_GenerateLogFileName (
+
+LPSTR pDest ) // I - destination string pointer
+
+{
+ UCHAR szPath[ MAX_UI_PATH_SIZE ]; // File name plus extension. Extra bytes.
+
+ // Kill off log files if need be. Passing TRUE will refresh the log files
+ // window if any log files were killed.
+
+ LOG_KillLogFiles ( mwpLogQueue, TRUE );
+
+ // Get the path and drive.
+
+ strcpy( pDest, CDS_GetUserDataPath () ) ;
+
+ LOG_MakeNewFileName ( (LPSTR)szPath ) ;
+
+ strcat( pDest, (LPSTR)szPath ) ;
+
+ LOG_SetCurrentLogName ( pDest );
+
+}
+
+/**************************************************************************
+
+ Name: LOG_GetCurrentLogPathOnly
+
+ Description: This function will get the path of the current
+ log file path. If no log path is being used, then
+ an empty string is stored. The parameter 'path'
+ is used as the buffer to store the log path. The
+ path ends with a trailing backslash.
+ i.e., 'c:\nt\'
+
+ Modified: 03/23/1993
+
+ Returns: Nothing.
+
+ See also : LOG_GenerateLogFileName
+
+**************************************************************************/
+
+VOID LOG_GetCurrentLogPathOnly( CHAR_PTR path )
+
+{
+LPSTR pEndOfPath = strrchr( (LPSTR)mwszCurrentLogFile, '\\' ) ;
+INT nPathSize ;
+
+ if ( pEndOfPath != NULL ) {
+ nPathSize = (INT)((++pEndOfPath) - (LPSTR)mwszCurrentLogFile ) ;
+ strncpy( path, (LPSTR)mwszCurrentLogFile, nPathSize ) ;
+ path[ nPathSize ] = TEXT('\0') ;
+ }
+ else {
+ // no path supplied, will exclude every file with log name
+ strcpy( path, TEXT("") ) ;
+ }
+}
+
+/**************************************************************************
+
+ Name: LOG_GetCurrentLogNameOnly
+
+ Description: This function will return the name of the current
+ log file only. If a path is include in the log file,
+ it is parsed out. There is always at least a default
+ log path+file in the mwszCurrentLogFile data field
+
+ Modified: 03/23/1993
+
+ Returns: Pointer to a string.
+
+ See also : LOG_GenerateLogFileName
+
+**************************************************************************/
+
+LPSTR LOG_GetCurrentLogNameOnly( VOID )
+
+{
+LPSTR szTemp = strrchr( (LPSTR)mwszCurrentLogFile, '\\' ) ;
+
+ if ( szTemp != NULL ) {
+ return( szTemp + 1 ) ;
+ }
+ else {
+ return (LPSTR)mwszCurrentLogFile ;
+ }
+}
+
+/**************************************************************************
+
+ Name: LOG_GetCurrentLogName
+
+ Description: This function will return the name of the current
+ log file. If no log file is being used, then
+ then an empty string is returned.
+
+ Modified: 10/24/1991
+
+ Returns: Pointer to a string.
+
+ See also : LOG_GenerateLogFileName
+
+**************************************************************************/
+
+LPSTR LOG_GetCurrentLogName( void )
+
+{
+ return (LPSTR)mwszCurrentLogFile;
+}
+
+
+/**************************************************************************
+
+ Name: LOG_SetCurrentLogName
+
+ Description: This function will set the name of the current
+ log file.
+
+ Modified: 2/24/1991
+
+ Returns: Pointer to a string.
+
+ See also : LOG_SetCurrentLogName
+
+**************************************************************************/
+
+VOID LOG_SetCurrentLogName (
+
+LPSTR pszLogName )
+
+{
+ strcpy ( (LPSTR)mwszCurrentLogFile, pszLogName );
+}
+
+
+/**************************************************************************
+
+ Name: LOG_GetCurrentViewLogName
+
+ Description: This function will return the name of the current
+ log view file.
+
+ Modified: 10/24/1991
+
+ Returns: Pointer to a string.
+
+ Notes: Always check the handle ghWndLogFileView for being NULL
+ before assuming the validity of this field.
+
+**************************************************************************/
+
+LPSTR LOG_GetCurrentViewLogName( void )
+
+{
+ return (LPSTR)mwszCurrentViewLogFile ;
+}
+
+
+
+/******************************************************************************
+
+ Name: LOG_SortLogFiles()
+
+ Description: This function sorts the log files by date and time.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID LOG_SortLogFiles (
+
+Q_HEADER_PTR pLogQueue ) // I - pointer to a log item.
+
+{
+
+ SortQueue( pLogQueue, LOG_ItemCompare );
+
+} /* end LOG_SortLogFiles() */
+
+
+/******************************************************************************
+
+ Name: LOG_ItemCompare()
+
+ Description: This function will compare the dates of two log files.
+ Ordering is youngest to oldest.
+
+ Returns: 1 if date of log1 < log2.
+ 0 if dates equal.
+ -1 if date of log1 > log2.
+
+******************************************************************************/
+
+INT16 LOG_ItemCompare(
+
+Q_ELEM_PTR pLogElem1, // I - queue element 1
+Q_ELEM_PTR pLogElem2 ) // I - queue element 2
+
+{
+ INT nResult ;
+ LOGITEM_PTR pLogItem1, pLogItem2;
+
+ pLogItem1 = (LOGITEM_PTR) pLogElem1->q_ptr;
+ pLogItem2 = (LOGITEM_PTR) pLogElem2->q_ptr;
+
+ // First check the dates and then the time if need be.
+
+ // Set default value to 0 to designate the elements being equal.
+
+ nResult = 0 ;
+
+ if ( LOG_GetItemDate( pLogItem1 ) == LOG_GetItemDate( pLogItem2 ) ) {
+
+ nResult = ( ( pLogItem1->iTime < pLogItem2->iTime ) ? 1 : -1 ) ;
+
+ } else {
+
+ // Set return value appropiately.
+
+ nResult = ( ( LOG_GetItemDate( pLogItem1 ) < LOG_GetItemDate( pLogItem2 ) ) ? 1 : -1 ) ;
+ }
+
+ return( (INT16)nResult ) ;
+}
+
+
+// DISPLAY LIST MANAGER CALL BACK FUNCTIONS.
+
+
+/****************************************************************************
+
+ Name: LOG_SetTag()
+
+ Description: This function sets the tag status of an item structure.
+
+ Returns: Nothing.
+
+****************************************************************************/
+
+VOID_PTR LOG_SetTag (
+
+LOGITEM_PTR pLogItem, // I - pointer to a list item
+BYTE bState ) // I - state to set the item to
+
+{
+ pLogItem->bTag = bState;
+ return( NULL ) ; // Return value unused.
+}
+
+
+
+/******************************************************************************
+
+ Name: LOG_GetTag()
+
+ Description: This function gets the tag status for the
+ Display List Manager.
+
+ Returns: The tag status of the item.
+
+******************************************************************************/
+
+BYTE LOG_GetTag (
+
+LOGITEM_PTR pLogItem ) // I - pointer to a list item
+
+{
+ return pLogItem->bTag;
+}
+
+
+/******************************************************************************
+
+ Name: LOG_GetItemCount()
+
+ Description: This function gets the item count in our list for the
+ Display List Manager.
+
+ Returns: The number of items in the list.
+
+******************************************************************************/
+
+UINT LOG_GetItemCount (
+
+Q_HEADER_PTR pLogQueue ) // I - pointer to a Log queue.
+
+{
+ return QueueCount ( pLogQueue );
+}
+
+
+/******************************************************************************
+
+ Name: LOG_GetFirstItem()
+
+ Description: This function returns the first item for the
+ Display List Manager.
+
+ Returns: The first item in the list.
+
+******************************************************************************/
+
+VOID_PTR LOG_GetFirstItem (
+
+Q_HEADER_PTR pLogQueue ) // I - pointer to a Log queue.
+
+{
+ Q_ELEM_PTR q;
+
+ q = QueueHead ( pLogQueue );
+
+ return( (q) ? (VOID_PTR)QueuePtr(q) : (VOID_PTR)NULL );
+}
+
+
+/******************************************************************************
+
+ Name: LOG_GetPrevItem()
+
+ Description: This function returns the previous list item for the
+ Display List Manager.
+
+ Returns: The previous item in the list.
+
+******************************************************************************/
+
+VOID_PTR LOG_GetPrevItem (
+
+LOGITEM_PTR pLogItem ) // I - pointer to a list item
+
+{
+ Q_ELEM_PTR q;
+
+ q = QueuePrev( &(pLogItem->pQElem) );
+
+ return( (q) ? (VOID_PTR)QueuePtr(q) : (VOID_PTR)NULL );
+}
+
+
+/******************************************************************************
+
+ Name: LOG_GetNextItem()
+
+ Description: This function returns the next list item for the
+ Display List Manager.
+
+ Returns: The next item in the list.
+
+******************************************************************************/
+
+VOID_PTR LOG_GetNextItem (
+
+LOGITEM_PTR pLogItem ) // I - pointer to a list item
+
+{
+ Q_ELEM_PTR q;
+
+ q = QueueNext ( &(pLogItem->pQElem) );
+
+ return( (q) ? (VOID_PTR)QueuePtr(q) : (VOID_PTR)NULL );
+}
+
+
+/******************************************************************************
+
+ Name: LOG_GetObjects()
+
+ Description: This function returns a given object and gets the
+ information that needs to be displayed by Display List
+ Manager.
+
+ Returns: The list of objects to be displayed.
+
+ Notes: 8 objects described:
+
+ 1st - Bitmap
+ 2nd - "Logged On"
+ 3rd - Date
+ 4th - Time
+ 5th - " for [fn] "
+ 6th - length
+ 7th - "bytes"
+
+ Example Output String
+
+ Logged On 12/12/1987 at 3:24 a.m. for MAYN0001.LOG 3456 bytes.
+
+*****************************************************************************/
+
+VOID_PTR LOG_GetObjects (
+
+LOGITEM_PTR pLogItem ) // I - pointer to a list item
+
+{
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ CHAR_PTR memblk ;
+ DLM_ITEM_PTR item;
+ PDS_WMINFO pdsWinInfo;
+ LPSTR pszString ;
+ UCHAR szShortFileName [ MAX_UI_FILENAME_SIZE ] ;
+ UCHAR szFormat [ MAX_UI_RESOURCE_SIZE ] ;
+ UCHAR szResourceStr [ MAX_UI_RESOURCE_SIZE ] ;
+ CHAR szDate [ MAX_UI_TIME_SIZE ];
+ CHAR szTime [ MAX_UI_TIME_SIZE ] ;
+ CHAR szLoggedOn [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szAt [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szFor [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szPrefix [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szExtension [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szAMString [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szPMString [ MAX_UI_SMALLRES_SIZE ] ;
+
+ DLM_HEADER_PTR pdsHdr ;
+ INT nPixel ;
+ INT nPixelpm ;
+ BYTE bObjectCnt = 0 ;
+
+ // Read in resources.
+
+ RSM_StringCopy( IDS_LOGPREFIX, szPrefix, MAX_UI_SMALLRES_LEN ) ;
+ RSM_StringCopy( IDS_LOGEXTENSION, szExtension, MAX_UI_SMALLRES_LEN ) ;
+ RSM_StringCopy( IDS_LOGLOGGEDON, szLoggedOn, MAX_UI_SMALLRES_LEN ) ;
+ RSM_StringCopy( IDS_LOGSTRINGAT, szAt, MAX_UI_SMALLRES_LEN ) ;
+ RSM_StringCopy( IDS_LOGFILENAMEPREFIX, szFor, MAX_UI_SMALLRES_LEN ) ;
+ RSM_StringCopy( IDS_LOGLENGTHOFFILE, (LPSTR)szFormat, MAX_UI_RESOURCE_LEN ) ;
+
+
+ // Get International date and time.
+
+ UI_IntToDate( szDate, LOG_GetItemDate ( pLogItem ) ) ;
+ UI_IntToTime( szTime, LOG_GetItemTime ( pLogItem ) ) ;
+
+ pdsWinInfo = WM_GetInfoPtr( ghWndLogFiles );
+
+ pdsHdr = DLM_GetDispHdr ( pdsWinInfo->hWndFlatList ) ;
+
+ memblk = (CHAR_PTR)DLM_GetObjectsBuffer( pdsWinInfo->hWndFlatList );
+
+ // Exception Handling.
+
+ if ( !pdsWinInfo || !pdsHdr || !memblk ) {
+ return (NULL ) ;
+ }
+
+ // Store the number of items in the first two bytes.
+
+ *memblk = 6; // Set up when window was created.
+
+ // Set up the bitmap.
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = bObjectCnt++ ; // Object #1
+ DLM_ItembType( item ) = DLM_BITMAP;
+ DLM_ItemwId( item ) = IDRBM_LOGFILE;
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ // Set up text "Logged on"
+
+ item++;
+ DLM_ItemcbNum( item ) = bObjectCnt++ ; // Object #2
+ DLM_ItembType( item ) = DLM_TEXT_ONLY ;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ strcpy( (LPSTR)DLM_ItemqszString( item ), szLoggedOn );
+
+ nPixel = RSM_GetFontStringWidth( ghFontIconLabels,
+ szLoggedOn, strlen( szLoggedOn ) ) ;
+
+ DLM_ItembMaxTextLen( item ) = ( BYTE ) ( ( nPixel / (INT) (pdsHdr->cxTextWidth ) ) + 1 ) ;
+
+ // Set up date
+
+ item++;
+ DLM_ItemcbNum( item ) = bObjectCnt++ ; // Object #3
+ DLM_ItembType( item ) = DLM_TEXT_ONLY ;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0; // mm/dd/yyyy worse case
+ sprintf((CHAR_PTR)szResourceStr, TEXT("%8s"), (CHAR_PTR)szDate);
+ strcpy( (LPSTR)DLM_ItemqszString( item ), (CHAR_PTR)szResourceStr );
+
+ if ( UI_UseLeadCentury() ) {
+
+ nPixel = RSM_GetFontStringWidth( ghFontIconLabels,
+ TEXT("00/00/0000"), strlen( TEXT("00/00/0000") ) ) ;
+
+ } else {
+
+ nPixel = RSM_GetFontStringWidth( ghFontIconLabels,
+ TEXT("00/00/00"), strlen( TEXT("00/00/00") ) ) ;
+ }
+
+ DLM_ItembMaxTextLen( item ) = ( BYTE ) ( ( nPixel / (INT) (pdsHdr->cxTextWidth ) ) + 1 ) ;
+
+
+ // Set up time
+
+ UI_GetPMString ( szPMString ) ;
+ UI_GetAMString ( szAMString ) ;
+
+ item++;
+ DLM_ItemcbNum( item ) = bObjectCnt++ ; // Object #5
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0; // hh/mm [stringxx]
+
+ sprintf((CHAR_PTR)szResourceStr, TEXT("%8s"), (CHAR_PTR)szTime);
+ strcpy( (LPSTR)DLM_ItemqszString( item ), (CHAR_PTR)szResourceStr );
+
+
+ nPixel = RSM_GetFontStringWidth( ghFontIconLabels,
+ TEXT("00:00:00 "), strlen( TEXT("00:00:00 ") ) ) ;
+
+ DLM_ItembMaxTextLen( item ) = ( BYTE ) ( ( nPixel / (INT) (pdsHdr->cxTextWidth ) ) + 1 ) ;
+
+ // If am or pm string defined, then pick maximum
+
+ if ( strlen( szAMString ) || strlen( szPMString ) ) {
+
+ nPixel = RSM_GetFontStringWidth( ghFontIconLabels,
+ szAMString, strlen( szAMString ) ) ;
+
+ nPixelpm = RSM_GetFontStringWidth( ghFontIconLabels,
+ szPMString, strlen( szPMString ) ) ;
+
+ if ( nPixelpm > nPixel ) {
+ nPixel = nPixelpm ;
+ }
+
+ DLM_ItembMaxTextLen( item ) += (BYTE) ( nPixel / (INT) (pdsHdr->cxTextWidth ) ) + 1 ;
+
+ }
+
+ // Set up " for [fn] "
+
+ item++;
+ DLM_ItemcbNum( item ) = bObjectCnt++ ; // Object #6
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = ( BYTE ) ( strlen( szFor ) ) ;
+ strcpy( (LPSTR)DLM_ItemqszString( item ), szFor );
+
+ // Concatenate file name.
+
+ if ( pszString = strrchr( (LPSTR)pLogItem->szFileName , TEXT('\\') ) ) {
+ strcpy( (LPSTR)szShortFileName, ++pszString ) ;
+ } else {
+ strcpy( (LPSTR)szShortFileName, (LPSTR)pLogItem->szFileName ) ;
+ }
+
+ strcat( (LPSTR)DLM_ItemqszString( item ), (LPSTR)szShortFileName ) ;
+
+ nPixel = RSM_GetFontStringWidth( ghFontIconLabels,
+ (LPSTR)DLM_ItemqszString( item ),
+ strlen( (LPSTR)DLM_ItemqszString( item ) ) ) ;
+
+
+ DLM_ItembMaxTextLen( item ) = ( BYTE ) ( ( nPixel / (INT) (pdsHdr->cxTextWidth ) ) + 1 ) ;
+
+ // Setup length of log file
+
+ item++;
+ DLM_ItemcbNum( item ) = bObjectCnt++; // Object #7
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ wsprintf( (LPSTR)szResourceStr, (LPSTR)szFormat, pLogItem->lSize ) ;
+ strcpy( (LPSTR)DLM_ItemqszString( item ), (LPSTR)szResourceStr ) ;
+
+ wsprintf( (LPSTR)szResourceStr, (LPSTR)szFormat, (long) 99999999L ) ;
+
+ nPixel = RSM_GetFontStringWidth( ghFontIconLabels,
+ (LPSTR)szResourceStr,
+ strlen( (LPSTR)szResourceStr ) ) ;
+
+ DLM_ItembMaxTextLen( item ) = ( BYTE ) ( ( nPixel / (INT) (pdsHdr->cxTextWidth ) ) + 1 ) ;
+
+
+ return ( memblk ) ;
+ }
+# else //if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ return NULL;
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+
+/******************************************************************************
+
+ Name: LOG_SetObjects()
+
+ Description: This function performs an action based on a click or
+ double-click on an item that is in the list.
+
+ Returns: NULL.
+
+******************************************************************************/
+
+VOID_PTR LOG_SetObjects (
+
+LOGITEM_PTR pLogItem, // I - pointer to a list item
+WORD wEvent, // I - type of event
+BYTE bSubItem ) // I - sub item
+
+{
+ DBG_UNREFERENCED_PARAMETER ( bSubItem );
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if ( wEvent == WM_DLMDBCLK ) {
+ WM_ShowWaitCursor( TRUE );
+ LOG_ViewFile( pLogItem );
+ WM_ShowWaitCursor( FALSE );
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ return( NULL ) ; // Return value unused.
+
+} /* end LOG_SetObjects() */
+
+
+/******************************************************************************
+
+ Name: LOG_GetCurrentTime()
+
+ Description: This function gets the current date and time in
+ a particular format to be used in the header of all
+ log files, viewed or just printed.
+
+ Returns: NULL.
+
+ Notes: Needs to be internationalized.
+
+******************************************************************************/
+
+VOID LOG_GetCurrentTime(
+
+LPSTR szDate, // I/O
+LPSTR szTime ) // I/O
+
+{
+ UI_CurrentDate( szDate ) ;
+ UI_CurrentTime( szTime ) ;
+
+}
+
+
+
+/******************************************************************************
+
+ Name: LOG_ViewFile()
+
+ Description: This function displays a log file in a window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID LOG_ViewFile (
+
+LOGITEM_PTR pLogItem ) // I - pointer to a log item.
+
+{
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ PDS_WMINFO pdsWinInfo ;
+ UCHAR szMinimizedName[ MAX_UI_RESOURCE_SIZE ] ;
+ DLM_LOGITEM_PTR pDlm ;
+ INT32_PTR pArray ;
+
+
+ // See if there is a log file currently being displayed.
+
+ if ( ghWndLogFileView ) {
+
+ // Is it the same file that has just been requested to be viewed?
+
+ pdsWinInfo = WM_GetInfoPtr ( ghWndLogFileView );
+
+ if ( strcmp ( WMDS_GetWinTitle( pdsWinInfo ), (LPSTR)pLogItem->szDateTime ) == 0 ) {
+
+ // Just bring the log file view window to the foreground.
+
+ WM_DocActivate( ghWndLogFileView ) ;
+ return ;
+
+ } else {
+
+ // Blow Away the window.
+
+ WM_Destroy ( ghWndLogFileView );
+ }
+ }
+
+ pDlm = ( DLM_LOGITEM_PTR ) calloc( 1, sizeof( DLM_LOGITEM ) ) ;
+
+ if ( !pDlm ) {
+ return ;
+ }
+
+ L_SetMaxNumOfBlocks( pDlm, 200 ) ;
+ L_SetRecsPerBlock( pDlm, 1000 ) ;
+ L_SetRecsPerTrack( pDlm, 1 ) ;
+ L_SetMaxStringLen( pDlm, 133 ) ;
+ L_SetFont ( pDlm, ghFontLog ) ;
+
+ pArray = ( INT32_PTR) calloc( L_GetMaxNumOfBlocks( pDlm ), sizeof( INT32_PTR ) ) ;
+
+ if ( !pArray ) {
+ return ;
+ }
+
+ L_SetArrayPtr( pDlm, pArray ) ;
+
+ pArray = ( INT32_PTR) calloc( L_GetMaxStringLen( pDlm ), sizeof( CHAR ) ) ;
+
+ if ( !pArray ) {
+ return ;
+ }
+
+ L_GetBuffer( pDlm ) = (LPSTR) pArray ;
+
+ // Build the full path name for log file.
+
+ wsprintf ( L_GetFileName( pDlm ) , TEXT("%s%s"), CDS_GetUserDataPath (),
+ (((LOGITEM_PTR)pLogItem)->szFileName ) );
+
+ strcpy( (LPSTR)mwszCurrentViewLogFile, L_GetFileName( pDlm ) ) ;
+ // Create a log file view window.
+
+ // Read in the log file.
+
+ if ( ( LOG_BuildLogViewList ( pDlm ) ) != SUCCESS ) {
+ LOG_Refresh( );
+ return;
+ }
+
+ LOG_BuildTitle ( pLogItem ) ;
+
+ // Create the log view window.
+
+ pdsWinInfo = (PDS_WMINFO)( calloc ( 1, sizeof ( DS_WMINFO ) ) );
+
+ WMDS_SetWinType ( pdsWinInfo, WMTYPE_LOGVIEW );
+ WMDS_SetWinClosable ( pdsWinInfo, FALSE );
+ WMDS_SetCursor ( pdsWinInfo, RSM_CursorLoad ( ID(IDRC_ARROW) ) );
+ WMDS_SetIcon ( pdsWinInfo, RSM_IconLoad ( IDRI_LOGFILES ) );
+ WMDS_SetRibbon ( pdsWinInfo, ghRibbonMain );
+ WMDS_SetAppInfo ( pdsWinInfo, (Q_HEADER_PTR) pDlm );
+
+ RSM_StringCopy( IDS_LOGVIEWMINWINDOWNAME, (LPSTR)szMinimizedName, MAX_UI_RESOURCE_LEN ) ;
+
+ ghWndLogFileView = WM_Create ( WM_MDISECONDARY | WM_VIEWWIN ,
+ (LPSTR)pLogItem->szDateTime,
+ (LPSTR)szMinimizedName,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ pdsWinInfo );
+
+ WM_SetTitle ( ghWndLogFileView, (LPSTR)pLogItem->szDateTime ) ;
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+} /* end LOG_ViewFile() */
+
+
+/******************************************************************************
+
+ Name: LOG_ClearBlocks
+
+ Description: This function will free the blocks allocated.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+
+VOID LOG_ClearBlocks(
+
+DLM_LOGITEM_PTR pDlm ) // I - Pointer to information
+
+{
+ int i ;
+
+ for(i=0; i<L_GetMaxNumOfBlocks( pDlm ); i++) {
+
+ if ( L_GetBlockPtr( pDlm, i ) ) {
+ free( (LPSTR) L_GetBlockPtr( pDlm, i ) ) ;
+ }
+
+ L_SetBlockPtr( pDlm, i, /*(INT32_PTR) NULL*/ 0 ) ;
+ }
+
+ L_SetNumOfUsedBlocks( pDlm, 0 ) ;
+ L_SetTotalLines( pDlm, 0 ) ;
+ L_SetVisibleTopLine( pDlm, 0 ) ;
+ L_SetTrackMax( pDlm, 0 ) ;
+ L_SetVscrollMax( pDlm, 0 ) ;
+ L_SetVscrollPos( pDlm, 0 ) ;
+ L_SetHscrollMax( pDlm, 0 ) ;
+ L_SetHscrollPos( pDlm, 0 ) ;
+}
+
+
+/******************************************************************************
+
+ Name: LOG_BuildTitle
+
+ Description: This function build title for window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID LOG_BuildTitle (
+
+LOGITEM_PTR pLogItem ) // I - pointer to a log item.
+
+{
+
+ CHAR szDate [ MAX_UI_TIME_SIZE ];
+ CHAR szTime [ MAX_UI_TIME_SIZE ] ;
+ CHAR szLoggedOn [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szAt [ MAX_UI_SMALLRES_SIZE ] ;
+ CHAR szFor [ MAX_UI_SMALLRES_SIZE ] ;
+
+ // Read in resources.
+
+ RSM_StringCopy( IDS_LOGLOGGEDON, szLoggedOn, MAX_UI_SMALLRES_LEN ) ;
+ RSM_StringCopy( IDS_LOGSTRINGAT, szAt, MAX_UI_SMALLRES_LEN ) ;
+ RSM_StringCopy( IDS_LOGFILENAMEPREFIX, szFor, MAX_UI_SMALLRES_LEN ) ;
+
+ // Get International date and time.
+
+ UI_IntToDate( szDate, LOG_GetItemDate ( pLogItem ) ) ;
+ UI_IntToTime( szTime, LOG_GetItemTime ( pLogItem ) ) ;
+
+ wsprintf( (LPSTR)pLogItem->szDateTime,
+ TEXT("%s%11s %s %-15s"),
+ szLoggedOn ,
+ szDate ,
+ szAt ,
+ szTime
+ ) ;
+
+}
+
+
+/******************************************************************************
+
+ Name: LOG_BuildLogViewList()
+
+ Description: This function builds a list of pointers to records
+ in a log file.
+
+ Returns: SUCCESS if Ok.
+ FAILURE if not Ok.
+
+******************************************************************************/
+
+INT LOG_BuildLogViewList (
+
+DLM_LOGITEM_PTR pDlm ) // I - Item in the list.
+
+{
+
+ FILE *fp ;
+ LPSTR pszLine ;
+ LONG lLastSeekPos ;
+ INT nStatus ;
+ INT index = 0 ;
+ INT nLen ;
+ INT32_PTR pCurBlock ;
+ CHAR szString[ MAX_UI_SMALLRES_SIZE ] ;
+
+
+ pszLine = L_GetBuffer( pDlm ) ;
+
+ nStatus = SUCCESS ;
+
+ // Turn the cursor to wait .
+ WM_ShowWaitCursor( TRUE ) ;
+
+ // Update status line.
+ RSM_StringCopy( IDS_LOGSCANNINGFILE, szString, MAX_UI_SMALLRES_LEN ) ;
+ STM_DrawText( szString ) ;
+
+ // Open a file.
+
+ L_SetFilePtr( pDlm, UNI_fopen ( L_GetFileName( pDlm ), _O_RDONLY ) ) ;
+
+ if ( L_GetFilePtr( pDlm ) ) {
+
+ fp = L_GetFilePtr( pDlm ) ;
+
+ // Record last relative position in file .
+
+ lLastSeekPos = ftell( fp ) ;
+
+ while ( TRUE ) {
+
+ if ( fgets( pszLine, (L_GetMaxStringLen( pDlm )-1), fp ) == NULL ) {
+ if ( feof( fp ) ) {
+ if ( ferror( fp ) ) {
+ nStatus = FAILURE ;
+ } else {
+ nStatus = SUCCESS ;
+ }
+
+ fclose( fp ) ;
+ L_SetFilePtr( pDlm, NULL ) ;
+ break ;
+ }
+ } else {
+
+
+ if ( L_NewBlock( pDlm ) ) {
+
+
+ WM_MultiTask() ;
+
+ // New Block needed
+
+ pCurBlock = ( INT32_PTR) calloc( L_GetRecsPerBlock( pDlm ), sizeof( LONG ) ) ;
+
+ if ( L_GetMaxNumOfBlocks ( pDlm ) == L_GetNumOfUsedBlocks( pDlm ) ) {
+
+ // Maximum number of blocks limit hit.
+
+ fclose( fp ) ;
+ L_SetFilePtr( pDlm, NULL ) ;
+ nStatus = FAILURE ;
+ break ;
+ }
+
+ // Leave room for header lines in array.
+
+ if ( lLastSeekPos == 0L ) {
+ index = LOG_NUMHEADERLINES ;
+ L_GetTotalLines( pDlm ) += LOG_NUMHEADERLINES ;
+ } else {
+ index = 0 ;
+ }
+
+ // pCurBlock is the address of new block .
+
+ L_SetBlockPtr( pDlm, L_GetNumOfUsedBlocks( pDlm ), ( (LONG) pCurBlock ) ) ;
+
+ L_GetNumOfUsedBlocks( pDlm )++ ;
+
+ }
+
+ // Set Maximum length if possible .
+
+ nLen = strlen( pszLine ) ;
+
+ if ( nLen > L_GetMaxWidth( pDlm ) ) {
+ L_GetMaxWidth( pDlm ) = nLen ;
+ }
+
+ // Save relative offset in block.
+
+ pCurBlock[ index++ ] = lLastSeekPos ;
+
+ // Increment line counter.
+
+ L_GetTotalLines( pDlm )++ ;
+
+ // LOG_MAXRECS is the current limit.
+
+ if ( L_GetTotalLines( pDlm ) == (LOG_MAXRECS+1+LOG_NUMHEADERLINES) ) {
+
+ CHAR szFormat[ MAX_UI_RESOURCE_SIZE ] ;
+ CHAR szString[ MAX_UI_RESOURCE_SIZE ] ;
+ CHAR szApp [ MAX_UI_RESOURCE_SIZE ] ;
+ LPSTR pString ;
+
+ // Restore the cursor.
+ WM_ShowWaitCursor( FALSE ) ;
+
+ // This log file contains more than %ld lines.
+
+ RSM_StringCopy( IDS_LOGMAXLINES, szFormat, MAX_UI_RESOURCE_LEN ) ;
+ wsprintf( szString, szFormat, (LONG) LOG_MAXRECS );
+
+ // Maynstream supports viewing the first %ld lines.
+
+ RSM_StringCopy( IDS_LOGMAXSUPPORT, szFormat, MAX_UI_RESOURCE_LEN ) ;
+ RSM_StringCopy( IDS_APPNAME, szApp, MAX_UI_RESOURCE_LEN ) ;
+ pString = szString + strlen( szString ) ;
+ strcat( pString, TEXT("\n") );
+ wsprintf( pString, szFormat, szApp, (LONG) LOG_MAXRECS ) ;
+
+ nStatus = WM_MsgBox( ID(IDS_LOGVIEWMINWINDOWNAME), szString,
+ (WORD)WMMB_OK, (WORD)WMMB_ICONINFORMATION ) ;
+
+ nStatus = FAILURE ;
+ fclose( fp ) ;
+ L_SetFilePtr( pDlm, NULL ) ;
+ nStatus = FAILURE ;
+ L_GetTotalLines( pDlm )-- ;
+
+ break ;
+ }
+
+
+ // Record last relative position in file .
+
+ lLastSeekPos = ftell( fp ) ;
+
+ }
+ }
+
+ // Set the number of tracks.
+
+ L_GetTrackMax( pDlm ) = ( INT ) (L_GetTotalLines( pDlm ) / L_GetRecsPerTrack( pDlm ) ) ;
+
+ if ( L_GetTrackMax( pDlm ) ) {
+
+ if ( L_GetTotalLines( pDlm ) % L_GetRecsPerTrack( pDlm ) ) {
+ L_GetTrackMax( pDlm ) -- ;
+ }
+ }
+
+ } else {
+
+ // Problem opening log file .
+
+
+ CHAR szFormat[ MAX_UI_RESOURCE_SIZE ] ;
+ CHAR szString[ MAX_UI_RESOURCE_SIZE ] ;
+
+ // Restore the cursor.
+ WM_ShowWaitCursor( FALSE ) ;
+
+ RSM_StringCopy( IDS_CANTOPEN, szFormat, MAX_UI_RESOURCE_LEN ) ;
+ wsprintf( szString, szFormat, L_GetFileName( pDlm ) );
+ nStatus = WM_MsgBox( ID(IDS_LOGVIEWMINWINDOWNAME), szString,
+ (WORD)WMMB_OK, (WORD)WMMB_ICONINFORMATION ) ;
+ nStatus = FAILURE ;
+ }
+
+
+ // Restore the cursor.
+
+ WM_ShowWaitCursor( FALSE ) ;
+
+ RSM_StringCopy( IDS_READY, szString, MAX_UI_SMALLRES_LEN ) ;
+ STM_DrawText( szString ) ;
+
+ return( nStatus ) ;
+
+}
+
+/******************************************************************************
+
+ Name: LOG_GetViewHdrLine()
+
+ Description: This function builds the string for view header lines.
+
+
+ Returns: pszResult - string.
+
+ Notes: Four lines are currently implemented.
+
+******************************************************************************/
+
+
+VOID LOG_GetViewHdrLine(
+
+DLM_LOGITEM_PTR pDlm , // I - pointer to app area
+INT i , // I - Index of header line
+LPSTR pszResult ) // I/O - Buffer
+
+{
+
+ /*****************************************************************
+ The lines are defined as follows:
+
+ File Name : MAYNxxxx.LOG line 0
+ Date: mm/dd/yy line 1
+ Time: hh:mm[a,p]m line 2
+ line 3
+ ******************************************************************/
+
+
+ CHAR szDate[ MAX_UI_DATE_SIZE ] ;
+ CHAR szTime[ MAX_UI_TIME_SIZE ] ;
+ CHAR szBuf [ MAX_UI_RESOURCE_SIZE ] ;
+ CHAR szBuf1[ MAX_UI_RESOURCE_SIZE ] ;
+ LPSTR pszString ;
+
+ switch ( i ) {
+
+ case 0:
+
+ // File Name : MAYNxxxx.LOG
+
+ RSM_StringCopy( IDS_LOGHEADERFILENAME,
+ szBuf, MAX_UI_RESOURCE_LEN ) ;
+
+ if ( pszString = strrchr( L_GetFileName( pDlm ) , TEXT('\\') ) ) {
+ strcpy( szBuf1, ++pszString ) ;
+ } else {
+ strcpy( szBuf1, L_GetFileName( pDlm ) ) ;
+ }
+
+ // Save the full path name for print manager.
+
+ strcpy( (LPSTR)mwszCurrentViewLogFile, L_GetFileName( pDlm ) ) ;
+ wsprintf( pszResult, szBuf, szBuf1 ) ;
+
+ break ;
+
+ case 1:
+
+ /* Date : mm/dd/yy */
+
+ LOG_GetCurrentTime ( szDate, szTime ) ;
+ RSM_StringCopy ( IDS_LOGHEADERDATE, szBuf, MAX_UI_RESOURCE_LEN ) ;
+ wsprintf( pszResult, szBuf, szDate ) ;
+
+ break ;
+
+
+ case 2:
+
+
+ /* Time : hh:mm */
+
+ LOG_GetCurrentTime ( szDate, szTime ) ;
+ RSM_StringCopy( IDS_LOGHEADERTIME, szBuf, MAX_UI_RESOURCE_LEN ) ;
+ wsprintf( pszResult, szBuf, szTime ) ;
+
+ break ;
+
+ case 3:
+ default :
+
+ /* blank line */
+
+ strcpy( pszResult,TEXT("") ) ;
+
+ }
+
+}
+
diff --git a/private/utils/ntbackup/src/logoproc.c b/private/utils/ntbackup/src/logoproc.c
new file mode 100644
index 000000000..e3cff4697
--- /dev/null
+++ b/private/utils/ntbackup/src/logoproc.c
@@ -0,0 +1,257 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+RCG
+
+ Name: logoproc.c
+
+ Description: This file contains the functions for processing messages
+ sent by Windows to the LOGO window.
+
+
+ The following routines are in this module:
+
+ WM_LogoWndProc
+
+ $Log: G:\ui\logfiles\logoproc.c_v $
+
+ Rev 1.17 05 Aug 1993 17:31:06 GLENN
+Increased size of text display on logo window.
+
+ Rev 1.16 03 Aug 1993 19:46:32 MARINA
+updated param type cast
+
+ Rev 1.15 28 Jul 1993 17:27:16 MARINA
+enable c++
+
+ Rev 1.14 12 Apr 1993 10:16:38 CHUCKB
+Fixed adjustment coefficients placement of version text.
+
+ Rev 1.13 01 Nov 1992 16:01:24 DAVEV
+Unicode changes
+
+ Rev 1.12 07 Oct 1992 15:12:02 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.11 04 Oct 1992 19:38:38 DAVEV
+Unicode Awk pass
+
+ Rev 1.10 18 May 1992 09:00:48 MIKEP
+header
+
+ Rev 1.9 16 Apr 1992 11:44:18 JOHNWT
+removed beta/er info
+
+ Rev 1.8 15 Apr 1992 18:25:04 GLENN
+updated for new bmp
+
+ Rev 1.7 09 Apr 1992 11:33:48 GLENN
+Using exe version and eng release version stamps in display now.
+
+ Rev 1.6 30 Mar 1992 18:04:38 GLENN
+Added support for discarding logo bitmap when done.
+
+ Rev 1.5 23 Mar 1992 14:08:00 JOHNWT
+updated to new logo
+
+ Rev 1.4 19 Mar 1992 16:44:16 GLENN
+Updated.
+
+ Rev 1.3 18 Mar 1992 09:16:12 GLENN
+Updated width of text area.
+
+ Rev 1.2 17 Mar 1992 18:29:40 GLENN
+Pulling strings from resources.
+
+ Rev 1.1 10 Mar 1992 16:31:32 GLENN
+Still working on this one...
+
+ Rev 1.0 09 Mar 1992 09:00:58 GLENN
+Initial revision.
+
+
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define ADJ_TOP 170
+#define ADJ_BOTTOM 10
+#define ADJ_LEFT 232
+#define ADJ_RIGHT 10
+
+static HWND mwhWndLogo = (HWND)0;
+static BOOL mwfRegistered = FALSE;
+
+
+/******************************************************************************
+
+ Name: WM_LogoWndProc()
+
+ Description: This function is called internally by Windows when events
+ occur relating to the LOGO window.
+
+ Returns: A WINRELULT
+
+******************************************************************************/
+
+WINRESULT APIENTRY WM_LogoWndProc (
+
+HWND hWnd, // I - window handle of the list box
+MSGID msg, // I - message
+MP1 mp1, // I - another message parameter
+MP2 mp2 ) // I - yet another message parameter
+
+
+{
+ switch (msg) {
+
+ case WM_CREATE:
+
+ DM_CenterDialog ( hWnd );
+ break;
+
+ case WM_PAINT: { /* Begin Block */
+
+ HDC hDC;
+ PAINTSTRUCT ps;
+
+ HANDLE hSaveObject;
+ RECT rcInfo;
+
+ CHAR szMessage[MAX_UI_RESOURCE_SIZE];
+
+ hDC = BeginPaint (hWnd, &ps);
+
+ RSM_Sprintf ( szMessage, ID(IDS_STARTUPTEXT), gszExeVer );
+
+ // Set Font.
+
+ hSaveObject = SelectObject ( hDC, ghFontStatus );
+
+ // Set backgrnd to transparent and text to black
+
+ SetBkMode ( hDC, TRANSPARENT );
+ SetTextColor ( hDC, RGB( 0, 0, 0 ) );
+
+ // get the rectangle and then adjust for the text portion
+
+ GetClientRect ( hWnd, &rcInfo );
+
+ rcInfo.top += ADJ_TOP;
+ rcInfo.bottom -= ADJ_BOTTOM;
+ rcInfo.left += ADJ_LEFT;
+ rcInfo.right -= ADJ_RIGHT;
+
+ // draw the bitmap and then the text on top
+
+ RSM_BitmapDraw ( IDRBM_LOGO, 0, 0, 0, 0, hDC );
+
+ DrawText ( hDC,
+ szMessage,
+ -1,
+ &rcInfo,
+ DT_RIGHT
+ );
+
+ SelectObject( hDC, hSaveObject );
+
+ EndPaint ( hWnd, &ps );
+
+ return FALSE;
+
+ } /* End Block */
+
+ case WM_DESTROY:
+
+ mwhWndLogo = (HWND)NULL;
+ break;
+
+ } /* end switch */
+
+ return DefWindowProc ( hWnd, msg, mp1, mp2 );
+
+} /* end WM_LogoWndProc() */
+
+
+VOID WM_LogoShow ( VOID )
+
+{
+
+ WNDCLASS wc;
+ INT nWidth;
+ INT nHeight;
+
+ // If the frame is not minimized and we have not already registered
+ // the class, do the logo thing.
+
+ if ( ! WM_IsMinimized ( ghWndFrame ) && ! mwfRegistered ) {
+
+ wc.style = 0;
+ wc.lpfnWndProc = WM_LogoWndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = ghInst;
+ wc.hIcon = RSM_IconLoad ( IDRI_WNTRPARK );
+ wc.hCursor = RSM_CursorLoad ( ( LPSTR )IDC_ARROW );
+ wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WMCLASS_LOGO;
+
+ if ( ! RegisterClass( &wc ) ) {
+ return;
+ }
+
+ mwfRegistered = TRUE;
+ }
+ else {
+ return;
+ }
+
+ // Load the logo bitmap and get it's size.
+
+ RSM_BitmapLoad ( IDRBM_LOGO, RSM_MAGICCOLOR );
+ RSM_GetBitmapSize ( IDRBM_LOGO, ( LPINT )&nWidth, ( LPINT )&nHeight );
+
+ nWidth += 2;
+ nHeight += 2;
+
+ // create the window
+
+ mwhWndLogo = CreateWindow ( WMCLASS_LOGO, // class name
+ TEXT("\0"), // window title
+ WMSTYLE_LOGO, // window style
+ 200, // starting x position
+ 100, // starting y position
+ nWidth, // window width
+ nHeight, // window height
+ ghWndFrame, // parent window handle
+ (HMENU)NULL,
+ ghInst, // instance (global)
+ (LPSTR)NULL // window creation parameter
+ );
+
+ WM_MultiTask ();
+
+} /* end WM_LogoShow() */
+
+
+VOID WM_LogoDestroy ( VOID )
+
+{
+ if ( mwhWndLogo ) {
+
+ DestroyWindow ( mwhWndLogo );
+ WM_MultiTask ();
+ UnregisterClass ( WMCLASS_LOGO, ghInst );
+ mwfRegistered = FALSE;
+ RSM_BitmapFree ( IDRBM_LOGO );
+ }
+
+
+} /* end WM_LogoDestroy() */
+
+
diff --git a/private/utils/ntbackup/src/lp_tdir.c b/private/utils/ntbackup/src/lp_tdir.c
new file mode 100644
index 000000000..aec676e4d
--- /dev/null
+++ b/private/utils/ntbackup/src/lp_tdir.c
@@ -0,0 +1,494 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lp_tdir.c
+
+ Description: this file contains the entry points for the
+ tape directory routines.
+
+ $Log: N:/LOGFILES/LP_TDIR.C_V $
+
+ Rev 1.23 14 Jan 1993 13:33:16 STEVEN
+added stream_id to error message
+
+ Rev 1.22 23 Jul 1992 16:45:02 STEVEN
+fix warnings
+
+ Rev 1.21 23 Jul 1992 12:08:02 STEVEN
+fix warnings
+
+ Rev 1.20 21 May 1992 17:22:34 TIMN
+Added corrupt block filename length
+
+ Rev 1.19 14 May 1992 16:11:38 STEVEN
+corrupt -> corrupt_bit
+
+ Rev 1.18 13 May 1992 12:27:20 TIMN
+Removed used references to tapename and backup_set_name for TPOS structs.
+
+ Rev 1.17 13 May 1992 11:59:58 STEVEN
+40 format changes
+
+ Rev 1.16 24 Feb 1992 10:03:10 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.15 19 Feb 1992 16:01:28 GREGG
+Added vcb_only parameter to call to TF_OpenSet.
+
+ Rev 1.14 04 Feb 1992 21:42:02 GREGG
+Changed parameters in calls to TF_AllocateTapeBuffers and TF_FreeTapeBuffers.
+
+ Rev 1.13 22 Jan 1992 10:20:28 STEVEN
+fix warnings for WIN32
+
+ Rev 1.0 22 Jan 1992 10:17:40 STEVEN
+fix warnings for WIN32
+
+ Rev 1.12 13 Dec 1991 15:21:48 GREGG
+SKATEBOARD - Initial Integration.
+
+ Rev 1.11 06 Nov 1991 19:24:50 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from the BE config.
+
+ Rev 1.10 28 Oct 1991 13:07:16 GREGG
+BIGWHEEL - Re-switch after calls to ProcessEOM.
+
+ Rev 1.9 18 Oct 1991 16:25:12 STEVEN
+added parm for restore over exist prompt
+
+ Rev 1.8 17 Oct 1991 01:53:58 ED
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.7 24 Jul 1991 17:42:30 STEVEN
+lp was not set up
+
+ Rev 1.6 22 Jul 1991 10:57:14 DAVIDH
+Corrected type mismatch warnings.
+
+ Rev 1.5 21 Jun 1991 09:33:12 STEVEN
+new config unit
+
+ Rev 1.4 30 May 1991 09:10:16 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.3 28 May 1991 10:49:06 STEVEN
+use MAYN_MEM instead of MAYN_OS2
+
+ Rev 1.2 24 May 1991 13:15:18 STEVEN
+updates from BSDU redesign
+
+ Rev 1.1 15 May 1991 09:35:08 DAVIDH
+Cleared up Watcom compiler warnings for NLM.
+
+ Rev 1.0 09 May 1991 13:38:02 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+/**/
+/**
+
+ Name: LP_StartTapeDirectory()
+
+ Description: this routine starts a tape directory operation.
+
+ Modified: 5/24/1991 12:21:43
+
+ Returns: tape backup engine error.
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_StartTapeDirectory(
+TAPE_DIR_PTR tape_dir_ptr, /* I - Tape directory interface structure */
+LIS_PTR lis_ptr, /* I - Loop interface structure */
+INT32 tid, /* I - tape Id */
+INT16 tno, /* I - tape number */
+INT16 bno, /* I - backup set number */
+THW_PTR tdrv_list ) /* I - Specifies the tape drive */
+{
+ BSD_PTR bsd_ptr ;
+ TFL_OPBLK pb ;
+ DBLK_PTR dblk_ptr ;
+ INT16 return_status = SUCCESS ;
+ UINT16 mem_save ;
+ UINT16 max_buffs ;
+ UINT16 buff_size ;
+ INT16 status ;
+ LP_ENV_PTR lp ;
+ BE_CFG_PTR cfg ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+ lis_ptr->curr_bsd_ptr = bsd_ptr ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ /* Allocate the loop environment structure */
+ if( ( tape_dir_ptr->lp = ( LP_ENV_PTR )calloc( 1, sizeof( LP_ENV ) ) ) == NULL ) {
+
+ /* we cannot use macro because it relies on the lp structure */
+ lis_ptr->message_handler( MSG_TBE_ERROR, lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ lp = ( LP_ENV_PTR )tape_dir_ptr->lp ;
+
+ /* allocate DBLKs */
+ if( ( dblk_ptr = ( DBLK_PTR )calloc( 3, sizeof( DBLK ) ) ) == NULL ) {
+
+ /* Set this to NULL so we do not attempt to free it in LP_END... */
+ lp->rr.vcb_ptr = NULL ;
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( tape_dir_ptr->lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+ else {
+ /* Set up the loop environment structure */
+ /* set up the DBLK_PTRs in the Request/Reply structure */
+ lp->rr.vcb_ptr = dblk_ptr ;
+ lp->rr.ddb_ptr = dblk_ptr + 1 ;
+ lp->saved_ddb = dblk_ptr + 1 ;
+ lp->rr.fdb_ptr = dblk_ptr + 2 ; /* ASSUMPTION : */
+ lp->rr.idb_ptr = dblk_ptr + 2 ; /* no FS has both FDB & IDB */
+ lp->curr_ddb = &lp->dblk1 ;
+ lp->curr_blk = &lp->dblk2 ;
+ lp->empty_blk = &lp->dblk3 ;
+ lp->blk_is_empty = TRUE ;
+ lp->lis_ptr = lis_ptr ;
+ lp->tpos.reference = (UINT32)lis_ptr;
+ }
+
+ /* allocate buffers for operation */
+
+ mem_save = BEC_GetReserveMem( cfg ) ;
+ max_buffs = BEC_GetMaxTapeBuffers( cfg ) ;
+ buff_size = BEC_GetTFLBuffSize( cfg ) ;
+
+ return_status = TF_AllocateTapeBuffers( mem_save, max_buffs, buff_size ) ;
+
+ if( return_status != SUCCESS ) {
+
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( tape_dir_ptr->lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ if( ( return_status = FS_OpenFileSys( &lp->curr_fsys, GENERIC_DATA, cfg ) ) == OUT_OF_MEMORY ) {
+
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Deinit operation buffers */
+ if( ( status = TF_FreeTapeBuffers( ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, status, NULL, NULL, 0L ) ;
+ }
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+
+ return( return_status ) ;
+
+ }
+
+ tape_dir_ptr->curr_fsys = lp->curr_fsys ;
+ tape_dir_ptr->first_time = TRUE ;
+ tape_dir_ptr->last_time = FALSE ;
+ tape_dir_ptr->valid_save_block = FALSE ;
+ lp->rr.filter_to_use = TF_KEEP_ALL_DATA ; /* to permit keystroke processing */
+
+ /* set up for tape positioning */
+ pb.tape_position = &lp->tpos ;
+ pb.tape_position->tape_id = tid ;
+ pb.tape_position->tape_seq_num = tno ;
+ pb.tape_position->backup_set_num = bno ;
+ pb.tape_position->reference = ( UINT32 )NULL ;
+ pb.tape_position->UI_TapePosRoutine = lis_ptr->tape_pos_handler ;
+ pb.rewind_sdrv = FALSE ;
+ pb.sdrv = tdrv_list ;
+ pb.perm_filter = TF_KEEP_ALL_DATA ; /* to permit keystroke processing */
+ pb.attributes = 0L ;
+ pb.fsh = lp->curr_fsys ;
+ pb.mode = TF_READ_OPERATION ;
+ pb.ignore_clink = FALSE ;
+ pb.wrt_format = 0 ;
+ pb.idle_call = NULL ;
+ pb.cat_enabled = (BOOLEAN)(BEC_GetCatalogLevel( cfg ) != CATALOGS_NONE) ;
+
+ /* Now open the backup set */
+ lp->set_opened = FALSE ;
+ if( ( return_status = TF_OpenTape( &pb.channel, pb.sdrv, pb.tape_position ) ) == SUCCESS ) {
+ lp->set_opened = TRUE ;
+ return_status = TF_OpenSet( &pb, FALSE ) ;
+ }
+ lp->channel = pb.channel ;
+
+ /* Need to set up the tape directory pointer to point */
+ /* to the loop environment structure */
+
+ if( return_status == SUCCESS ) {
+
+ lp->rr.cur_dblk = dblk_ptr ;
+ return_status = LP_StartTPEDialogue( lp, FALSE ) ;
+
+ }
+
+ return( return_status ) ;
+}
+/**/
+/**
+
+ Name: LP_EndTapeDirectory()
+
+ Description: this routine ends a tape directory
+
+ Modified: 5/24/1991 12:37:1
+
+ Returns: tape backup engine error.
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_EndTapeDirectory(
+TAPE_DIR_PTR tape_dir_ptr, /* I - Tape directory handle */
+BOOLEAN tf_finish_needed ) /* I - TRUE if abort contition */
+{
+ INT16 return_status = SUCCESS ;
+ INT16 status = SUCCESS ;
+ LP_ENV_PTR lp ;
+
+ /* Get loop environment structure */
+ lp = ( LP_ENV_PTR )tape_dir_ptr->lp ;
+
+ /* If we did not run out of memory */
+ if( lp ) {
+
+ if( tf_finish_needed ) {
+ LP_FinishedOper( lp ) ;
+ }
+
+ /* close off the tape format layer */
+ if( lp->set_opened ) {
+ TF_CloseSet( lp->channel, NULL ) ;
+ }
+ TF_CloseTape( lp->channel ) ;
+
+ /* Deinit operation buffers */
+ if( ( return_status = TF_FreeTapeBuffers( ) ) != SUCCESS ) {
+ LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, NULL, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+
+ if( ( status = FS_CloseFileSys( lp->curr_fsys ) ) != SUCCESS ) {
+ msassert( status == SUCCESS ) ;
+ }
+
+ /* Free local allocations */
+ if( lp->rr.vcb_ptr != NULL ) {
+ free( lp->rr.vcb_ptr ) ;
+ }
+ free( lp ) ;
+ }
+
+ return( return_status ) ;
+}
+/**/
+/**
+
+ Name: LP_ReadTape()
+
+ Description: this routine reads a block from the tape
+
+ Modified: 7/26/1989
+
+ Returns: tape backup engine error
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_ReadTape(
+TAPE_DIR_PTR tape_dir_ptr, /* I - tape directory handle */
+BOOLEAN *valid_blk, /* O - TRUE if block returne is valid */
+DBLK_PTR dblk ) /* O - Where to copy the dblk */
+{
+ INT16 return_status = SUCCESS ;
+ CHAR crrpt_blk_fname[ 13 ] ;
+ INT16 crrpt_blk_fname_leng ; /* length of corrupt block filename */
+ GEN_FDB_DATA gfdb_data ;
+ LP_ENV_PTR lp ;
+ INT16 msg_err_stat ;
+ BOOLEAN done = FALSE ;
+
+ /* Get loop environment structure */
+ lp = ( LP_ENV_PTR )tape_dir_ptr->lp ;
+
+ if( LP_AbortFlagIsSet( lp->lis_ptr ) ) {
+
+ return TFLE_USER_ABORT ;
+ }
+
+ *valid_blk = FALSE ;
+
+ if( tape_dir_ptr->last_time ) {
+ /* Then we need to send the last block, if there is one */
+ if( tape_dir_ptr->valid_save_block ) {
+ tape_dir_ptr->valid_save_block = FALSE ;
+ *valid_blk = TRUE ;
+ *dblk = *lp->curr_ddb ;
+ }
+ return( return_status ) ;
+ }
+
+ lp->rr.lp_message = LRR_STUFF ;
+ lp->rr.cur_dblk = lp->curr_blk ;
+
+ if( ( return_status = TF_GetNextTapeRequest( &lp->rr ) ) == SUCCESS ) {
+
+ /* This loop is for the EOM case. We call ProcessEOM and it does
+ another GetNextTapeRequest so we need to re-switch on the new
+ tf_message.
+ */
+ while( !done && return_status == SUCCESS ) {
+
+ done = TRUE ;
+
+ switch( lp->rr.tf_message ) {
+
+ case TRR_DATA:
+ lp->rr.buff_used = lp->rr.buff_size ;
+ break ;
+
+ case TRR_DDB:
+ case TRR_IDB:
+
+ /* return saved block if any */
+ if( tape_dir_ptr->valid_save_block ) {
+ *dblk = *lp->curr_ddb ;
+ *valid_blk = TRUE ;
+ *lp->curr_ddb = *lp->curr_blk ;
+ } else {
+
+ /* if no saved block, then return this one */
+ *dblk = *lp->curr_blk ;
+ *valid_blk = TRUE ;
+ }
+ break ;
+
+ case TRR_FDB:
+
+ /* return saved block (if any) */
+ if( tape_dir_ptr->valid_save_block ) {
+ *dblk = *lp->curr_ddb ;
+ *valid_blk = TRUE ;
+ }
+
+ /* simply store the block */
+ tape_dir_ptr->valid_save_block = TRUE ;
+ *lp->curr_ddb = *lp->curr_blk ;
+ break ;
+
+ case TRR_CFDB:
+
+ /* Set the corrupt attribute of the saved block */
+ FS_SetAttribFromDBLK( lp->curr_fsys, lp->curr_ddb,
+ ( FS_GetAttribFromDBLK( lp->curr_fsys, lp->curr_ddb ) | OBJ_CORRUPT_BIT ) ) ;
+ /* and continue */
+ break ;
+
+ case TRR_END:
+ tape_dir_ptr->last_time = TRUE ;
+ /* Check if there is a saved block */
+ if( tape_dir_ptr->valid_save_block ) {
+ *dblk = *lp->curr_ddb ;
+ *valid_blk = TRUE ;
+ tape_dir_ptr->valid_save_block = FALSE ;
+ }
+ break ;
+
+ case TRR_EOM:
+ return_status = LP_ProcessEOM( lp, (UINT16)TRR_EOM ) ;
+ done = FALSE ; /* Switch Again! */
+ break ;
+
+ case TRR_RECV_ERR:
+ lp->rr.tf_message = TRR_FDB ;
+
+ FS_SetDefaultDBLK( lp->curr_fsys, FDB_ID, ( CREATE_DBLK_PTR ) &gfdb_data ) ;
+ gfdb_data.std_data.dblk = lp->rr.cur_dblk ;
+ gfdb_data.std_data.disp_size = U64_Init(0,0) ; /* $$$ literal */
+
+ /* call message handler to provide filename */
+ LP_MsgPrompt( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos,
+ CORRUPT_BLOCK_PROMPT, crrpt_blk_fname, &crrpt_blk_fname_leng ) ;
+
+ gfdb_data.fname = crrpt_blk_fname ;
+ gfdb_data.fname_size = crrpt_blk_fname_leng ;
+ FS_CreateGenFDB( lp->curr_fsys, &gfdb_data ) ;
+ break ;
+
+ case TRR_DATA_END:
+ break ;
+
+ case TRR_FATAL_ERR:
+ msassert( FALSE ) ;
+ break ;
+
+ case TRR_VCB:
+ break ;
+
+ }
+ }
+ }
+ else {
+ if( ( msg_err_stat = LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+ }
+
+ return( return_status ) ;
+
+}
diff --git a/private/utils/ntbackup/src/lp_tens.c b/private/utils/ntbackup/src/lp_tens.c
new file mode 100644
index 000000000..aea851516
--- /dev/null
+++ b/private/utils/ntbackup/src/lp_tens.c
@@ -0,0 +1,239 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lp_tens.c
+
+ Description: Main loop for tension, erase and security erase
+
+ $Log: N:/LOGFILES/LP_TENS.C_V $
+
+ Rev 1.11 15 Mar 1993 13:50:16 CARLS
+removed START_BACKUP_SET message
+
+ Rev 1.10 12 Mar 1993 13:59:12 CARLS
+added MSG_START_BACKUP_SET message
+
+ Rev 1.9 18 Jan 1993 14:09:40 GREGG
+Changes to allow format command passed to driver through TpErase.
+
+ Rev 1.8 14 Jan 1993 13:33:20 STEVEN
+added stream_id to error message
+
+ Rev 1.7 13 May 1992 12:29:00 TIMN
+Removed used references to tapename and backup_set_name for TPOS structs.
+
+ Rev 1.6 18 Sep 1991 09:59:52 GREGG
+TF_RetensionChannel now called for reten and erase.
+
+ Rev 1.5 24 Jul 1991 15:53:42 DAVIDH
+Cleared up warnings for Watcom.
+
+ Rev 1.4 21 Jun 1991 09:42:32 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:10:34 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 24 May 1991 13:16:46 STEVEN
+updates from BSDU redesign
+
+ Rev 1.1 15 May 1991 09:50:10 DAVIDH
+Cleared up type mismatch warning found by Watcom compiler.
+
+
+ Rev 1.0 09 May 1991 13:38:06 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "get_next.h"
+
+/**/
+/**
+
+ Name: LP_Tension_Tape_Engine
+
+ Description: Performs the various tension / erase operations of a tape
+
+ Modified: 5/24/1991 12:6:6
+
+ Returns: NO_ERR or error code from Tape Format or Loop error code
+
+ Notes:
+
+ See also:
+
+ Declaration:
+
+**/
+INT16 LP_Tension_Tape_Engine(
+LIS_PTR lis_ptr ) /* I - Loop Interface Structure */
+{
+ BSD_PTR bsd_ptr ;
+ TFL_OPBLK pb ;
+ LP_ENV_PTR lp ;
+ INT16 return_status = SUCCESS ;
+ INT16 status ;
+ DBLK_PTR dblk_ptr ;
+ BE_CFG_PTR cfg ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ /* Allocate the loop environment structure */
+ if( ( lp = ( LP_ENV_PTR )calloc( 1, sizeof( LP_ENV ) ) ) == NULL ) {
+
+ /* we cannot use macro because it relies on the lp structure */
+ lis_ptr->message_handler( MSG_TBE_ERROR, lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* Set up the loop environment structure */
+ lp->lis_ptr = lis_ptr ;
+ lp->tpos.reference = ( UINT32 )lis_ptr ;
+
+ /* allocate DBLKs */
+ if( ( dblk_ptr = ( DBLK_PTR )calloc( 3, sizeof( DBLK ) ) ) == NULL ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ } else {
+ /* set up the DBLK_PTRs in the Request/Reply structure */
+ lp->rr.vcb_ptr = dblk_ptr ;
+ lp->rr.ddb_ptr = dblk_ptr + 1 ;
+ lp->rr.fdb_ptr = dblk_ptr + 2 ; /* ASSUMPTION : */
+ lp->rr.idb_ptr = dblk_ptr + 2 ; /* no FS has both FDB & IDB */
+ }
+
+ /* Set up the loop environment structure */
+
+ if( ( return_status = FS_OpenFileSys( &lp->curr_fsys, GENERIC_DATA, cfg ) ) == OUT_OF_MEMORY ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+ else {
+
+ /* indicate the start of the operation */
+ LP_MsgStartOP( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ /* set up for tape positioning */
+ pb.tape_position = &lp->tpos ;
+ pb.rewind_sdrv = FALSE ;
+ pb.sdrv = LP_DetermineStartingTPDrv( lis_ptr->oper_type, bsd_ptr, &lp->tpos, lis_ptr->auto_det_sdrv ) ;
+ pb.perm_filter = TF_SKIP_ALL_DATA ;
+ pb.attributes = 0L ;
+ pb.fsh = lp->curr_fsys ;
+ pb.mode = 0 ; /* tape format fills this out */
+ pb.ignore_clink = FALSE ;
+ pb.wrt_format = 0 ;
+ pb.idle_call = NULL ;
+ lp->get_spcl = FALSE ;
+ lp->seq_num = 1 ;
+ lp->start_new_dir = FALSE ;
+ lp->get_first_file = FALSE ;
+ lp->get_next_first_time = FALSE ;
+ lp->curr_blk = &lp->dblk1 ;
+ lp->curr_ddb = &lp->dblk2 ;
+ lp->empty_blk = &lp->dblk3 ;
+ lp->blk_is_empty = FALSE ;
+ lp->send_saved_block = FALSE ;
+ lp->tpos.tape_id = -1 ;
+ lp->tpos.tape_seq_num = -1 ;
+ lp->tpos.backup_set_num = -1 ;
+ lp->tpos.UI_TapePosRoutine = lis_ptr->tape_pos_handler ;
+ lp->rr.filter_to_use = TF_SKIP_ALL_DATA ;
+ lp->channel = pb.channel ;
+
+ switch( lis_ptr->oper_type ) {
+
+ case TENSION_OPER:
+ return_status = TF_RetensionChannel( &pb, TF_RETENSION_READ ) ;
+ break ;
+
+ case TENSION_NO_READ_OPER:
+ return_status = TF_RetensionChannel( &pb, TF_RETENSION_NO_READ ) ;
+ break ;
+
+ case ERASE_OPER:
+ return_status = TF_RetensionChannel( &pb, TF_ERASE_READ ) ;
+ break ;
+
+ case ERASE_NO_READ_OPER:
+ return_status = TF_RetensionChannel( &pb, TF_ERASE_NO_READ ) ;
+ break ;
+
+ case SEC_ERASE_NO_READ_OPER:
+ return_status = TF_RetensionChannel( &pb, TF_ERASE_SEC_NO_READ ) ;
+ break ;
+
+ case SECURITY_ERASE_OPER:
+ return_status = TF_RetensionChannel( &pb, TF_ERASE_SECURITY ) ;
+ break ;
+
+ /* This case is used for Maynard production facility as is specified
+ via the /FM undocumented switch for tension */
+ case ERASE_FMARK_ONLY:
+ return_status = TF_RetensionChannel( &pb, TF_ERASE_FMARK ) ;
+ break ;
+
+ case FORMAT_OPER:
+ return_status = TF_RetensionChannel( &pb, TF_FORMAT_READ ) ;
+ break ;
+
+ }
+
+ if( return_status != SUCCESS ) {
+ /* report error condition */
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ } else {
+ /* log the end of the operation */
+ LP_MsgEndTens( lis_ptr->oper_type ) ;
+ }
+
+ if( ( status = FS_CloseFileSys( lp->curr_fsys ) ) != SUCCESS ) {
+ msassert( status == SUCCESS ) ;
+ }
+ }
+
+ /* indicate the end of the operation */
+ LP_MsgEndOP( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+
+}
diff --git a/private/utils/ntbackup/src/lpbackup.c b/private/utils/ntbackup/src/lpbackup.c
new file mode 100644
index 000000000..d4d9937c6
--- /dev/null
+++ b/private/utils/ntbackup/src/lpbackup.c
@@ -0,0 +1,301 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lpbackup.c
+
+ Description: This module contains the entry point for the backup engine.
+
+ $Log: N:/LOGFILES/LPBACKUP.C_V $
+
+ Rev 1.12 14 Jan 1993 13:33:44 STEVEN
+added stream_id to error message
+
+ Rev 1.11 24 Feb 1992 09:54:30 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.10 04 Feb 1992 21:40:26 GREGG
+Changed parameters in calls to TF_AllocateTapeBuffers and TF_FreeTapeBuffers.
+
+ Rev 1.9 16 Jan 1992 15:45:28 STEVEN
+fix warnings for WIN32
+
+ Rev 1.8 13 Dec 1991 15:25:36 GREGG
+SKATEBOARD - Initial Integration.
+
+ Rev 1.7 06 Nov 1991 19:04:40 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from the BE config.
+
+ Rev 1.6 23 Aug 1991 17:00:34 STEVEN
+added support for NORMAL/COPY/DIFERENTIAL/INCREMENTAL
+
+ Rev 1.5 21 Jun 1991 09:28:46 STEVEN
+new config unit
+
+ Rev 1.4 30 May 1991 09:12:16 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.3 28 May 1991 09:59:38 STEVEN
+use MAYN_MEM instead of MAYN_OS2
+
+ Rev 1.2 24 May 1991 14:42:34 STEVEN
+complete changes for new getnext
+
+ Rev 1.1 23 May 1991 16:19:26 STEVEN
+update for BSD redesign
+
+ Rev 1.0 09 May 1991 13:35:48 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "vm.h"
+#include "get_next.h"
+
+/**/
+/**
+
+ Name: LP_Backup_Engine()
+
+ Description: this routine orchestrates backups on a volume by volume basis. it is the entry
+ point into the tape backup engine for the backup operation.
+
+ Modified: 5/23/1991 13:9:10
+
+ Returns: SUCCESS or error code from Tape Format or Loop error code
+
+ Notes:
+
+ See also: $/SEE( LP_Restore_Engine(), LP_Verify_Engine() )$
+ $/SEE( LP_Delete_Engine() )$
+
+ Declaration:
+
+**/
+INT16 LP_Backup_Engine(
+LIS_PTR lis_ptr ) /* I - Loop Interface structure */
+{
+ BSD_PTR bsd_ptr ;
+ GENERIC_DLE_PTR dle_ptr ;
+ LP_ENV_PTR lp ;
+ INT16 return_status = SUCCESS ;
+ INT16 status ;
+ UINT16 mem_save ;
+ UINT16 max_buffs ;
+ UINT16 buff_size ;
+ DBLK_PTR dblk_ptr ;
+ UINT16 tfl_open_mode = TF_WRITE_OPERATION ;
+ BE_CFG_PTR cfg ;
+ BOOLEAN tape_opened = FALSE ;
+ INT16 channel_no ;
+ THW_PTR sdrv ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+
+ msassert( bsd_ptr != NULL ) ;
+
+ lis_ptr->curr_bsd_ptr = bsd_ptr ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+ if ( cfg == NULL ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ /* Allocate the loop environment structure */
+ if( ( lp = ( LP_ENV_PTR )calloc( 1, sizeof( LP_ENV ) ) ) == NULL ) {
+
+ /* we cannot use macro because it relies on the lp structure */
+ lis_ptr->message_handler( MSG_TBE_ERROR, lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* Set up the loop environment structure */
+ lp->lis_ptr = lis_ptr ;
+ lp->tpos.reference = ( UINT32 )lis_ptr ;
+
+ /* allocate DBLKs */
+ if( ( dblk_ptr = ( DBLK_PTR )calloc( 4, sizeof( DBLK ) ) ) == NULL ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* set up the DBLK_PTRs in the Request/Reply structure */
+ lp->rr.vcb_ptr = dblk_ptr ;
+ lp->rr.ddb_ptr = dblk_ptr + 1 ;
+ lp->rr.fdb_ptr = dblk_ptr + 2 ; /* ASSUMPTION : */
+ lp->rr.idb_ptr = dblk_ptr + 2 ; /* no FS has both FDB & IDB */
+ lp->rr.cfdb_ptr = dblk_ptr + 3 ; /* CFDB needed during backup */
+
+ /* allocate CFDB data */
+ if( ( lp->rr.cfdb_data_ptr = ( GEN_CFDB_DATA_PTR )calloc( 1, sizeof( GEN_CFDB_DATA ) ) ) == NULL ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* allocate buffers for operation */
+
+ mem_save = BEC_GetReserveMem( cfg ) ;
+ max_buffs = BEC_GetMaxTapeBuffers( cfg ) ;
+ buff_size = BEC_GetTFLBuffSize( cfg ) ;
+
+ return_status = TF_AllocateTapeBuffers( mem_save, max_buffs, buff_size ) ;
+
+ if( ( return_status != SUCCESS ) ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( lp->rr.cfdb_data_ptr ) ;
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+
+ }
+
+ /* indicate the start of the operation */
+ LP_MsgStartOP( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* loop for each bsd */
+ do {
+
+ if( BSD_GetMarkStatus( bsd_ptr ) == NONE_SELECTED ) {
+
+ bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+ continue ;
+
+ }
+
+ /* First attach to the drive */
+ dle_ptr = BSD_GetDLE( bsd_ptr ) ;
+ lis_ptr->curr_bsd_ptr = bsd_ptr ;
+
+ cfg = BEC_CloneConfig( BSD_GetConfigData( bsd_ptr ) ) ;
+ if ( cfg == NULL ) {
+ return_status = OUT_OF_MEMORY ;
+ break ;
+ }
+
+ BEC_UseConfig( cfg ) ;
+ if ( !BSD_CompatibleBackup( bsd_ptr) ) {
+
+ if ( BSD_SetArchiveBackup( bsd_ptr ) ) {
+ BEC_SetSetArchiveFlag( cfg, (BOOLEAN)TRUE ) ;
+ } else {
+ BEC_SetSetArchiveFlag( cfg, (BOOLEAN)FALSE ) ;
+ }
+
+ if ( BSD_ModFilesOnly( bsd_ptr ) ) {
+ BEC_SetModifiedOnlyFlag( cfg, (BOOLEAN)TRUE ) ;
+ } else {
+ BEC_SetModifiedOnlyFlag( cfg, (BOOLEAN)FALSE ) ;
+ }
+ }
+
+ /* Now attach to the dle */
+ if( ( return_status = FS_AttachToDLE( &lp->curr_fsys, dle_ptr, cfg, NULL, NULL ) ) == SUCCESS ) {
+
+ /* Set up the loop environment structure */
+ lp->get_spcl = TRUE ;
+ lp->seq_num = 1 ;
+ lp->start_new_dir = TRUE ;
+ lp->get_first_file = TRUE ;
+ lp->get_next_first_time = TRUE ;
+ lp->after_bs = FALSE ;
+ lp->curr_blk = &lp->dblk1 ;
+ lp->curr_ddb = &lp->dblk2 ;
+ lp->empty_blk = &lp->dblk3 ;
+ lp->pdl_q = NULL ;
+ lp->cat_enabled = (BOOLEAN)(BEC_GetCatalogLevel( cfg ) != CATALOGS_NONE) ;
+ lp->tpos.tape_id = BSD_GetTapeID( bsd_ptr ) ;
+ lp->tpos.tape_seq_num = BSD_GetTapeNum( bsd_ptr ) ;
+ lp->tpos.backup_set_num = BSD_GetSetNum( bsd_ptr ) ;
+ lp->tpos.UI_TapePosRoutine = lis_ptr->tape_pos_handler ;
+ lp->curr_dle = dle_ptr ;
+
+ sdrv = LP_DetermineStartingTPDrv( lis_ptr->oper_type, bsd_ptr, &lp->tpos, lis_ptr->auto_det_sdrv ) ;
+
+ if( !tape_opened ) {
+ tape_opened = TRUE ;
+ /* open the tape for operation */
+ if( ( return_status = TF_OpenTape( &channel_no, sdrv, &lp->tpos ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+
+ if( return_status == SUCCESS ) {
+ /* Perform the operation */
+ return_status = LP_BackupDLE( bsd_ptr, lp, tfl_open_mode, channel_no, sdrv ) ;
+
+ LP_ClearPDL( lp ) ;
+
+ FS_DetachDLE( lp->curr_fsys ) ;
+ }
+ }
+ else if( return_status != USER_ABORT ) {
+
+ /* error attaching to the drive, just go on to next drive, if there is one */
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_DRIVE_ATTACH_ERROR, NULL, NULL, 0L ) ;
+
+ /* reset return_status, and try the next bsd */
+ return_status = SUCCESS ;
+ }
+
+ BEC_ReleaseConfig( cfg ) ;
+
+ tfl_open_mode = TF_WRITE_APPEND ;
+ bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+
+ } while( !return_status && (bsd_ptr != NULL) ) ;
+
+ if( tape_opened ) {
+ TF_CloseTape( channel_no ) ;
+ }
+
+ if( ( status = TF_FreeTapeBuffers( ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr,
+ NULL, &lp->tpos, status, NULL, NULL, 0L ) ;
+ }
+
+ /* indicate the end of the operation */
+ LP_MsgEndOP( lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* Free local allocations */
+ free( lp->rr.cfdb_data_ptr ) ;
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+
+}
diff --git a/private/utils/ntbackup/src/lpdelete.c b/private/utils/ntbackup/src/lpdelete.c
new file mode 100644
index 000000000..03236b53a
--- /dev/null
+++ b/private/utils/ntbackup/src/lpdelete.c
@@ -0,0 +1,414 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lpdelete.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: N:\logfiles\lpdelete.c_v $
+
+ Rev 1.15 12 Aug 1993 21:28:04 BARRY
+fix delete bug
+
+ Rev 1.14 26 Jul 1993 14:53:30 CARLS
+added code for delete failure
+
+ Rev 1.13 20 Jul 1993 15:31:50 BARRY
+Call FS_FindCloseObj
+
+ Rev 1.12 19 Jun 1993 10:14:28 DON
+If a release build, and msassert are gone
+don't attempt to use a NULL bsd_ptr
+
+ Rev 1.11 14 Jan 1993 13:33:30 STEVEN
+added stream_id to error message
+
+ Rev 1.10 13 May 1992 12:00:58 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.9 26 Mar 1992 15:26:34 CARLS
+was deleting special files
+
+ Rev 1.8 22 Jan 1992 15:57:28 BARRY
+Now is aware of new return status codes from BSD_MatchObj().
+
+ Rev 1.7 23 Dec 1991 13:27:10 BARRY
+Wasn't deleting anything but the first DLE--Terri's fix.
+
+ Rev 1.6 24 Jun 1991 17:25:32 STEVEN
+remove date time from StartBS
+
+ Rev 1.5 21 Jun 1991 09:32:38 STEVEN
+new config unit
+
+ Rev 1.4 14 Jun 1991 11:05:42 BARRY
+Config ptr sent to FS_AttachToDLE() should come from BSD.
+
+ Rev 1.3 30 May 1991 09:13:06 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 24 May 1991 13:18:16 STEVEN
+updates from BSDU redesign
+
+ Rev 1.1 23 May 1991 18:30:08 BARRY
+Made delete a little more tolerant about possible file system problems.
+
+ Rev 1.0 09 May 1991 13:37:52 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+#include "beconfig.h"
+#include "tbe_err.h"
+#include "tbe_defs.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "queues.h"
+#include "loops.h"
+#include "loop_prv.h"
+/* $end$ include list */
+
+/* static function declarations */
+static INT16 LP_DeleteDLE( LP_ENV_PTR lp ) ;
+
+#define EMPTY_DO_NOT_DEL 2
+#define DELETE_SUCCESS 0
+#define DELETE_FAILED 1
+
+/**/
+/**
+
+ Name: LP_Delete_Engine()
+
+ Description:
+
+ Modified: 6/22/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_Delete_Engine(
+LIS_PTR lis_ptr ) /* loop interface structure */
+{
+ BSD_PTR bsd_ptr ;
+ GENERIC_DLE_PTR dle_ptr ;
+ LP_ENV_PTR lp ;
+ INT16 error = SUCCESS ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+
+ if ( bsd_ptr == NULL ) {
+ msassert( FALSE );
+ /* if the UI managed to pass in a NULL bsd were done */
+ return SUCCESS ;
+ }
+
+ /* Allocate the loop environment structure */
+ if( ( lp = ( LP_ENV_PTR )calloc( 1, sizeof( LP_ENV ) ) ) == NULL ) {
+
+ /* we cannot use macro because it relies on the lp structure */
+ lis_ptr->message_handler( MSG_TBE_ERROR, lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* Set up the loop environment structure */
+ lp->lis_ptr = lis_ptr ;
+ lp->tpos.reference = ( UINT32 )lis_ptr ;
+
+ /* indicate the start of the operation */
+ LP_MsgStartOP( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* loop for each bsd */
+ do {
+ /* First attach to the drive */
+ dle_ptr = BSD_GetDLE( bsd_ptr ) ;
+ lp->curr_blk = &lp->dblk1 ;
+ lp->curr_ddb = &lp->dblk2 ;
+ lp->empty_blk = &lp->dblk3 ;
+
+ /* Now attach to the dle */
+ error = FS_AttachToDLE( &lp->curr_fsys, dle_ptr, BSD_GetConfigData( bsd_ptr ), NULL, NULL ) ;
+
+ if( error == SUCCESS ) {
+ /* No problems getting ahold of the drive */
+
+ LP_MsgStartBS( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, NULL ) ;
+
+ error = LP_DeleteDLE( lp ) ;
+ if ( ( error == DELETE_SUCCESS) || (error == EMPTY_DO_NOT_DEL) ) {
+ error = SUCCESS ;
+ }
+
+ LP_MsgEndBS( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ FS_DetachDLE( lp->curr_fsys ) ;
+
+ } else if( error != USER_ABORT ) {
+ /* error attaching to the drive, now we just want to */
+ /* go on with the next drive, if there is one */
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_DRIVE_ATTACH_ERROR, NULL, NULL, 0L ) ;
+
+ /* reset error, and continue on */
+ error = SUCCESS ;
+ }
+
+ /* Now we continue, as long as we did not have an error, and we can get a new bsd */
+ bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+
+ /* assign the bsd ptr to the lis' curr bsd so that LP_DeleteDLE gets the next bsd */
+ lp->lis_ptr->curr_bsd_ptr = bsd_ptr ;
+
+ } while( !error && ( bsd_ptr != NULL ) ) ;
+
+ /* indicate the end of the operation */
+ LP_MsgEndOP( lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* Free local allocations */
+ free( lp ) ;
+
+ return error ;
+}
+/**/
+/**
+
+ Name: LP_DeleteDLE()
+
+ Description:
+
+ Modified: 6/22/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_DeleteDLE( lp )
+register LP_ENV_PTR lp ;
+{
+ INT16 result ;
+ BOOLEAN empty_flag = TRUE ;
+ INT16 finished = FALSE ;
+ INT16 first_time = TRUE ;
+ UINT8 scan_blk_type = FDB_ID;
+ BOOLEAN log_dir = FALSE ;
+ INT16 ret_val ;
+
+ static FSYS_HAND fsh ;
+ static BSD_PTR bsd_ptr ;
+ static UINT32 pid ;
+ static FSE_PTR fse_ptr ;
+
+ bsd_ptr = lp->lis_ptr->curr_bsd_ptr ;
+ fsh = lp->curr_fsys ;
+ pid = lp->lis_ptr->pid ;
+
+ FS_GetCurrentDDB( fsh, lp->curr_ddb ) ;
+
+ result = BSD_MatchObj( bsd_ptr, &fse_ptr, fsh, lp->curr_ddb, NULL, FALSE ) ;
+
+ if ( result != BSD_SKIP_OBJECT ) {
+ log_dir = TRUE ;
+ }
+
+ while( !finished ) {
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+ /* falling through (no break) */
+ case ABORT_PROCESSED:
+ return USER_ABORT ;
+
+
+ case ABORT_AT_EOM:
+
+ return USER_ABORT ;
+
+ }
+
+ do {
+ if( first_time ) {
+ result = FS_FindFirstObj( fsh, lp->curr_blk, ALL_FILES ) ;
+ if( result == SUCCESS ) {
+ empty_flag = FALSE ;
+ } else {
+ FS_FindObjClose( fsh, lp->curr_blk );
+ }
+
+ first_time = FALSE ;
+
+ } else {
+ FS_ReleaseDBLK( fsh, lp->curr_blk );
+ result = FS_FindNextObj( fsh, lp->curr_blk ) ;
+ if ( result != SUCCESS ) {
+ FS_FindObjClose( fsh, lp->curr_blk );
+ }
+ }
+ } while( ( result == SUCCESS ) && ( FS_GetBlockType( lp->curr_blk ) != scan_blk_type ) ) ;
+
+ if( ( result != SUCCESS) && ( scan_blk_type == FDB_ID ) ) {
+ scan_blk_type = DDB_ID ;
+ first_time = TRUE ;
+ continue ;
+ }
+
+ if( result != SUCCESS ) {
+ /* delete empty directories */
+
+ if ( empty_flag ) {
+ if ( BEC_GetProcEmptyFlag( BSD_GetConfigData( bsd_ptr ) ) ) {
+
+ result = BSD_MatchObj( bsd_ptr, &fse_ptr, fsh,
+ lp->curr_ddb, NULL, FALSE ) ;
+
+ if ( !(result == BSD_SKIP_OBJECT) && !(result == FSL_EMPTY) ) {
+
+ LP_MsgLogBlock( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_ddb ) ;
+ LP_MsgBlockProcessed( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_ddb ) ;
+
+ }
+
+ } else {
+ return EMPTY_DO_NOT_DEL ;
+ }
+
+ }
+
+ return DELETE_SUCCESS ;
+
+ } else {
+
+ /* Don't match on a possibly bogus DBLK */
+ if ( FS_GetObjInfo( fsh, lp->curr_blk ) != SUCCESS ) {
+ continue;
+ }
+
+ /* Now process item type */
+ switch( FS_GetBlockType( lp->curr_blk ) ) {
+ case FDB_ID:
+ result = BSD_MatchObj( bsd_ptr, &fse_ptr, fsh, lp->curr_ddb, lp->curr_blk, FALSE ) ;
+
+ if ( !(result == BSD_SKIP_OBJECT) && !(result == FSL_EMPTY) ) {
+ if ( ( result == BSD_SPECIAL_OBJECT ) && !BSD_GetProcSpecialFlg( bsd_ptr ) ) {
+ break;
+ }
+
+ if ( log_dir ) {
+ log_dir = FALSE ;
+ LP_MsgLogBlock( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_ddb ) ;
+ LP_MsgBlockProcessed( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_ddb ) ;
+ }
+
+#ifndef TDEMO
+ /* Make sure DBLK is completely filled out before asking FS to delete it */
+ if ( (ret_val = FS_GetObjInfo( fsh, lp->curr_blk )) == SUCCESS ) {
+ ret_val = FS_DeleteObj( fsh, lp->curr_blk ) ;
+ }
+
+ if ( ret_val != SUCCESS ) {
+ /* send message to UI we were unable to delete */
+ /* this object. */
+ LP_MsgNotDeleted( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_blk ) ;
+ }
+#endif
+
+ if ( ret_val == SUCCESS ) {
+ LP_MsgLogBlock( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_blk ) ;
+ LP_MsgBlockProcessed( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_blk ) ;
+ }
+ }
+ break ;
+
+ case DDB_ID:
+ result = BSD_MatchObj( bsd_ptr, &fse_ptr, fsh, lp->curr_blk, NULL, TRUE ) ;
+
+ if ( !(result == BSD_SKIP_OBJECT) && !(result == FSL_EMPTY) ) {
+
+ ret_val = FS_PushMinDDB( fsh, lp->curr_blk ) ;
+
+ if( ret_val != SUCCESS ) {
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+ ret_val = OUT_OF_MEMORY ;
+ finished = TRUE ;
+ break ;
+
+ }
+
+ FS_ChangeIntoDDB( fsh, lp->curr_blk ) ;
+
+ ret_val = LP_DeleteDLE( lp ) ;
+
+ FS_UpDir( fsh ) ;
+ FS_ReleaseDBLK( fsh, lp->curr_ddb );
+ FS_GetCurrentDDB( fsh, lp->curr_ddb ) ;
+
+ if( FS_PopMinDDB( fsh, lp->curr_blk ) ) {
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+ ret_val = OUT_OF_MEMORY ;
+ finished = TRUE ;
+ break ;
+ }
+
+ if ( (ret_val != DELETE_SUCCESS) && (ret_val != EMPTY_DO_NOT_DEL) ) {
+ return( ret_val ) ;
+ }
+
+ if ( !(result == BSD_SKIP_OBJECT) && !(result == FSL_EMPTY) ) {
+ if ( ret_val != EMPTY_DO_NOT_DEL ) {
+#ifndef TDEMO
+ /* Make sure DBLK is completely filled out before asking FS to delete it */
+ ret_val = FS_GetObjInfo( fsh,
+ lp->curr_blk );
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FS_DeleteObj( fsh, lp->curr_blk ) ;
+ }
+
+ if ( ret_val != SUCCESS ) {
+ /* send message to UI we were unable to delete */
+ /* this object. */
+ log_dir = FALSE ;
+ LP_MsgNotDeleted( pid, bsd_ptr, fsh, &lp->tpos, lp->curr_blk ) ;
+ }
+ FS_ReleaseDBLK( fsh, lp->curr_blk );
+#endif
+ }
+ }
+ }
+ break ;
+ }
+ }
+ }
+ return DELETE_SUCCESS ;
+}
+
+
diff --git a/private/utils/ntbackup/src/lplist.c b/private/utils/ntbackup/src/lplist.c
new file mode 100644
index 000000000..a9ab053c4
--- /dev/null
+++ b/private/utils/ntbackup/src/lplist.c
@@ -0,0 +1,443 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lplist.c
+
+ Description: This module contains the entry point for the list tape engine.
+
+ $Log: J:/LOGFILES/LPLIST.C_V $
+
+ Rev 1.23 05 Nov 1993 15:01:48 MARILYN
+EPR963: keeping track of which tape we are on so we know which one to expect
+
+ Rev 1.22 14 Jan 1993 13:33:34 STEVEN
+added stream_id to error message
+
+ Rev 1.21 30 May 1992 23:31:38 GREGG
+Turn off rewind_sdrv if we know the family id, sequence number and set number.
+
+ Rev 1.20 29 May 1992 10:22:50 STEVEN
+added support for not rewinding
+
+ Rev 1.19 13 May 1992 12:26:50 TIMN
+Removed used references to tapename and backup_set_name for TPOS structs.
+
+ Rev 1.18 20 Mar 1992 13:09:58 STEVEN
+do not call tape format if AUXIL_ERROR
+
+ Rev 1.17 24 Feb 1992 10:03:32 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.16 19 Feb 1992 16:01:48 GREGG
+Added vcb_only parameter to call to TF_OpenSet.
+
+ Rev 1.15 04 Feb 1992 21:41:42 GREGG
+Changed parameters in calls to TF_AllocateTapeBuffers and TF_FreeTapeBuffers.
+
+ Rev 1.14 22 Jan 1992 10:20:12 STEVEN
+fix warnings for WIN32
+
+ Rev 1.0 22 Jan 1992 10:17:54 STEVEN
+fix warnings for WIN32
+
+ Rev 1.13 13 Dec 1991 15:21:18 GREGG
+SKATEBOARD - Initial Integration.
+
+ Rev 1.12 13 Dec 1991 15:18:18 STEVEN
+bug in pba stuff
+
+ Rev 1.11 21 Nov 1991 14:29:42 STEVEN
+set pba in tpos structure
+
+ Rev 1.10 06 Nov 1991 19:25:18 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from the BE config.
+
+ Rev 1.9 28 Oct 1991 12:09:54 GREGG
+BIGWHEEL - Assert if TRR_EOM encountered (should be taken care of in GetNextTPE.
+
+ Rev 1.8 17 Oct 1991 01:53:26 ED
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.7 22 Jul 1991 10:56:50 DAVIDH
+Corrected type mismatch warnings.
+
+ Rev 1.6 24 Jun 1991 17:24:14 STEVEN
+remove date time from StartBS
+
+ Rev 1.5 21 Jun 1991 09:33:34 STEVEN
+new config unit
+
+ Rev 1.4 30 May 1991 09:15:06 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.3 28 May 1991 10:49:18 STEVEN
+use MAYN_MEM instead of MAYN_OS2
+
+ Rev 1.2 24 May 1991 13:15:30 STEVEN
+updates from BSDU redesign
+
+ Rev 1.1 15 May 1991 09:36:04 DAVIDH
+Cleared up Watcom compiler warnings for NLM.
+
+ Rev 1.0 09 May 1991 13:37:52 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "get_next.h"
+
+
+
+INT16 LP_List_Tape_Engine(
+LIS_PTR lis_ptr ) /* I - Loop interface structure */
+{
+ BSD_PTR bsd_ptr ;
+ TFL_OPBLK pb ;
+ LP_ENV_PTR lp ;
+ INT16 done = FALSE ;
+ INT16 return_status = SUCCESS ;
+ INT16 status ;
+ UINT16 mem_save ;
+ UINT16 max_buffs ;
+ UINT16 buff_size ;
+ DBLK_PTR dblk_ptr ;
+ DBLK_PTR curr_blk ;
+ BE_CFG_PTR cfg ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+
+ msassert( bsd_ptr != NULL ) ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ /* Allocate the loop environment structure */
+ if( ( lp = ( LP_ENV_PTR )calloc( 1, sizeof( LP_ENV ) ) ) == NULL ) {
+
+ /* we cannot use macro because it relies on the lp structure */
+ lis_ptr->message_handler( MSG_TBE_ERROR, lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* Set up the loop environment structure */
+ lp->lis_ptr = lis_ptr ;
+ lp->tpos.reference = ( UINT32 )lis_ptr ;
+
+ /* allocate DBLKs */
+ if( ( dblk_ptr = ( DBLK_PTR )calloc( 3, sizeof( DBLK ) ) ) == NULL ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ } else {
+ /* set up the DBLK_PTRs in the Request/Reply structure */
+ lp->rr.vcb_ptr = dblk_ptr ;
+ lp->rr.ddb_ptr = dblk_ptr + 1 ;
+ lp->saved_ddb = dblk_ptr + 1 ;
+ lp->rr.fdb_ptr = dblk_ptr + 2 ; /* ASSUMPTION : */
+ lp->rr.idb_ptr = dblk_ptr + 2 ; /* no FS has both FDB & IDB */
+ }
+
+ /* Set up the loop environment structure */
+ lp->get_spcl = TRUE ;
+ lp->seq_num = 1 ;
+ lp->start_new_dir = TRUE ;
+ lp->get_first_file = TRUE ;
+ lp->get_next_first_time = TRUE ;
+ lp->curr_blk = &lp->dblk1 ;
+ lp->curr_ddb = &lp->dblk2 ;
+ lp->empty_blk = &lp->dblk3 ;
+ lp->blk_is_empty = TRUE ;
+ lp->send_saved_block = FALSE ;
+
+ /* allocate buffers for operation */
+
+ mem_save = BEC_GetReserveMem( cfg ) ;
+ max_buffs = BEC_GetMaxTapeBuffers( cfg ) ;
+ buff_size = BEC_GetTFLBuffSize( cfg ) ;
+
+ return_status = TF_AllocateTapeBuffers( mem_save, max_buffs, buff_size ) ;
+
+ if( return_status != SUCCESS ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+
+ }
+
+ /* Need to open file system */
+ if( ( return_status = FS_OpenFileSys( &lp->curr_fsys, GENERIC_DATA, cfg ) ) == OUT_OF_MEMORY ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Deinit operation buffers */
+ if( ( status = TF_FreeTapeBuffers( ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, status, NULL, NULL, 0L ) ;
+ }
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ } else {
+
+ /* indicate the start of the operation */
+ LP_MsgStartOP( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ msassert( return_status == SUCCESS ) ;
+
+ /* set up for tape positioning */
+ lp->tpos.tape_id = BSD_GetTapeID( bsd_ptr ) ;
+ lp->tpos.tape_seq_num = BSD_GetTapeNum( bsd_ptr ) ;
+ lp->tpos.backup_set_num = BSD_GetSetNum( bsd_ptr ) ;
+ lp->tpos.tape_loc.pba_vcb = BSD_GetPBA( bsd_ptr );
+ lp->tpos.UI_TapePosRoutine = lis_ptr->tape_pos_handler ;
+ pb.tape_position = &lp->tpos ;
+ pb.sdrv = LP_DetermineStartingTPDrv( lis_ptr->oper_type, bsd_ptr, &lp->tpos, lis_ptr->auto_det_sdrv ) ;
+ pb.perm_filter = TF_SKIP_ALL_DATA ;
+ pb.attributes = 0L ;
+ pb.fsh = lp->curr_fsys ;
+ pb.mode = TF_SCAN_OPERATION ;
+ pb.ignore_clink = FALSE ;
+ pb.wrt_format = 0 ;
+ pb.idle_call = NULL ;
+ pb.cat_enabled = (BOOLEAN)(BEC_GetCatalogLevel( cfg ) != CATALOGS_NONE) ;
+ lp->rr.filter_to_use = TF_SKIP_ALL_DATA ;
+ lp->rr.tape_loc.pba_vcb = BSD_GetPBA( bsd_ptr );
+
+ pb.rewind_sdrv = (BOOLEAN)(( lis_ptr->oper_type == CATALOG_TAPE_OPER ) ? TRUE : FALSE ) ;
+ if( lp->tpos.tape_id != -1 &&
+ lp->tpos.tape_seq_num != -1 &&
+ lp->tpos.backup_set_num != -1 ) {
+
+ pb.rewind_sdrv = FALSE ;
+ }
+
+ /* Don't really want negative backup set numbers */
+ if ( (lp->tpos.backup_set_num != -1) && (lp->tpos.backup_set_num < 0) ) {
+ lp->tpos.backup_set_num = -BSD_GetSetNum( bsd_ptr ) ;
+ }
+
+ /* Open the tape */
+ if( ( return_status = TF_OpenTape( &pb.channel, pb.sdrv, pb.tape_position ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ } else {
+
+ /* Now open the backup set */
+ if( ( return_status = TF_OpenSet( &pb, FALSE ) ) != SUCCESS ) {
+ TF_CloseSet( lp->channel, NULL ) ;
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ } else {
+
+ lp->channel = pb.channel ;
+
+ BEC_SetProcEmptyFlag( cfg, (BOOLEAN)TRUE ) ;
+ BEC_SetSpecialFlag( cfg, (BOOLEAN)TRUE ) ;
+ BEC_SetHiddenFlag( cfg, (BOOLEAN)TRUE ) ;
+
+
+ while( return_status == SUCCESS ) {
+
+ if( ( return_status = LP_StartTPEDialogue( lp, FALSE ) ) == SUCCESS ) {
+
+ do {
+ switch( lp->rr.tf_message ) {
+
+ case TRR_FDB:
+ case TRR_DDB:
+ case TRR_IDB:
+ case TRR_CFDB:
+ /* call message handler to process the directory listing */
+ return_status = LP_MsgLogBlock( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, curr_blk ) ;
+ break ;
+
+ case TRR_VCB:
+ done = FALSE ;
+
+ /* call message handler to log the start of the operation */
+ switch( return_status = LP_MsgStartBS( lis_ptr->pid,
+ bsd_ptr,
+ lp->curr_fsys,
+ &lp->tpos,
+ lp->curr_blk ) ) {
+
+ case OPERATION_COMPLETE:
+ break ;
+
+ case SKIP_TO_NEXT_BSET:
+ pb.rewind_sdrv = FALSE ;
+ lp->tpos.backup_set_num++ ;
+ break ;
+
+ default:
+ break ;
+ }
+
+ break ;
+
+ case TRR_END:
+ done = TRUE ;
+ break ;
+
+ case TRR_EOM:
+ /* This shold be taken care of in LP_GetNextTPEBlock. */
+ msassert( FALSE ) ;
+ break ;
+
+ default:
+ break ;
+ }
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ /* falling through (no break) */
+
+ case ABORT_PROCESSED:
+ return_status = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ return_status = USER_ABORT ;
+ break ;
+ }
+
+ if( ( return_status != OPERATION_COMPLETE ) &&
+ ( return_status != USER_ABORT ) &&
+ ( return_status != TFLE_USER_ABORT ) &&
+ ( return_status != ABORT_OPERATION ) &&
+ ( return_status != AUXILARY_ERROR ) &&
+ ( return_status != SKIP_TO_NEXT_BSET ) ) {
+
+ if( !( return_status = LP_GetNextTPEBlock( lp, &curr_blk ) ) ) {
+ if ( curr_blk == NULL ) {
+ break ;
+ }
+ }
+ }
+
+ } while( !return_status && !done ) ;
+
+ /* call message handler to log the end of the operation */
+ LP_MsgEndBS( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+ }
+
+ /* Process last tape format request as long as no fatal error occurred */
+ switch( return_status ) {
+
+ case SKIP_TO_NEXT_BSET:
+ case OPERATION_COMPLETE:
+ case AUXILARY_ERROR:
+ case TFLE_USER_ABORT:
+ case TFLE_UI_HAPPY_ABORT:
+ case USER_ABORT:
+ if( return_status == SKIP_TO_NEXT_BSET ) {
+ lp->rr.lp_message = LRR_FINISHED ;
+ } else {
+ lp->rr.lp_message = LRR_ABORT ;
+ }
+ if( ( return_status == SKIP_TO_NEXT_BSET ) ||
+ ( return_status == OPERATION_COMPLETE ) ||
+ ( return_status == TFLE_USER_ABORT ) ||
+ ( ( return_status == TFLE_UI_HAPPY_ABORT ) && ( LP_GetAbortFlag( lis_ptr ) != ABORT_AT_EOM ) ) ||
+ ( ( return_status == USER_ABORT ) && ( LP_GetAbortFlag( lis_ptr ) != ABORT_AT_EOM ) ) ) {
+
+ if( ( status = TF_GetNextTapeRequest( &lp->rr ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, status, NULL, NULL, 0L ) ;
+ }
+ }
+ break ;
+
+ default:
+ /* don't care about these conditions */
+ break ;
+ }
+
+ /* Close set, save current tape device and post tape stats */
+ LP_CloseSet( pb.channel ) ;
+
+ if( ( return_status != OPERATION_COMPLETE ) &&
+ ( return_status != ABORT_OPERATION ) &&
+ ( return_status != AUXILARY_ERROR ) &&
+ ( return_status != TFLE_UI_HAPPY_ABORT ) &&
+ ( return_status != TFLE_USER_ABORT ) &&
+ ( return_status != USER_ABORT ) ) {
+
+ if( return_status != SKIP_TO_NEXT_BSET ) {
+ /* try to get the next bset */
+ lp->tpos.backup_set_num++ ;
+ pb.rewind_sdrv = FALSE ;
+ }
+
+ /* Update current tape device in TF pblock in case we crossed to a new drive */
+ pb.sdrv = lw_last_tpdrv ;
+
+ /* if specific set was specified then exit out of loop */
+ if ( BSD_GetPBA( bsd_ptr ) != 0 ) {
+ break ;
+ }
+
+ if( ( return_status = TF_OpenSet( &pb, FALSE ) ) != SUCCESS ) {
+ TF_CloseSet( lp->channel, NULL ) ;
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+ } /* END: while( return_status == SUCCESS ) */
+ }
+ }
+
+ if( ( status = FS_CloseFileSys( lp->curr_fsys ) ) != SUCCESS ) {
+ msassert( status == SUCCESS ) ;
+ }
+ }
+
+ TF_CloseTape( lp->channel ) ;
+
+ /* Deinit operation buffers */
+ if( ( status = TF_FreeTapeBuffers( ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, status, NULL, NULL, 0L ) ;
+ }
+
+ /* indicate the end of the operation */
+ LP_MsgEndOP( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+}
diff --git a/private/utils/ntbackup/src/lprestor.c b/private/utils/ntbackup/src/lprestor.c
new file mode 100644
index 000000000..2632c5801
--- /dev/null
+++ b/private/utils/ntbackup/src/lprestor.c
@@ -0,0 +1,341 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lprestor.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This module contains the entry point for the restore engine.
+
+
+ $Log: T:\logfiles\lprestor.c_v $
+
+ Rev 1.11.1.0 07 Feb 1994 02:06:52 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.11 29 Apr 1993 22:26:44 GREGG
+Transfer the Tape Catalog Version in the BSD to the tpos structure.
+
+ Rev 1.10 14 Jan 1993 13:33:38 STEVEN
+added stream_id to error message
+
+ Rev 1.9 24 Feb 1992 09:58:42 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.8 04 Feb 1992 21:40:50 GREGG
+Changed parameters in calls to TF_AllocateTapeBuffers and TF_FreeTapeBuffers.
+
+ Rev 1.7 16 Jan 1992 15:56:36 STEVEN
+fix warnings for WIN32
+
+ Rev 1.6 13 Dec 1991 15:25:06 GREGG
+SKATEBOARD - Initial Integration.
+
+ Rev 1.5 06 Nov 1991 19:07:38 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from the BE config.
+
+ Rev 1.4 21 Jun 1991 09:23:02 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:14:26 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 28 May 1991 10:12:22 STEVEN
+use MAYN_MEM instead of MAYN_OS2
+
+ Rev 1.1 24 May 1991 14:45:46 STEVEN
+complete changes for new getnext
+
+ Rev 1.0 09 May 1991 13:37:54 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "tfldefs.h"
+#include "lis.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: LP_Restore_Engine()
+
+ Description: this routine handles restoring multiple backup sets to multiple targets.
+
+ Modified: 02/02/1990
+
+ Returns: SUCCESS or error code from Tape Format or Loop error code
+
+ Notes: the loop interface structure must be entirely filled out.
+
+ See also: $/SEE( LP_Backup_Engine(), LP_Verify_Engine )$
+ $/SEE( LP_Delete_Engine() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_Restore_Engine(
+LIS_PTR lis_ptr )
+{
+ BSD_PTR bsd_ptr ;
+ BSD_PTR temp_bsd_ptr;
+ GENERIC_DLE_PTR dle_ptr ;
+ register LP_ENV_PTR lp ;
+ INT16 return_status = SUCCESS ;
+ INT16 status ;
+ UINT16 mem_save ;
+ UINT16 max_buffs ;
+ UINT16 buff_size ;
+ DBLK_PTR dblk_ptr ;
+ BOOLEAN reuse_bsd = FALSE ;
+ BOOLEAN first_time = TRUE ;
+ BE_CFG_PTR cfg ;
+ BOOLEAN tape_opened = FALSE ;
+ INT16 channel_no ;
+ THW_PTR sdrv ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+
+ msassert( bsd_ptr != NULL ) ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ /* Allocate the loop environment structure */
+ if( ( lp = ( LP_ENV_PTR )calloc( 1, sizeof( LP_ENV ) ) ) == NULL ) {
+
+ lis_ptr->message_handler( MSG_TBE_ERROR, lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* Set up the loop environment structure */
+ lp->lis_ptr = lis_ptr ;
+ lp->tpos.reference = ( UINT32 )lis_ptr ;
+
+ /* allocate DBLKs */
+ if( ( dblk_ptr = ( DBLK_PTR )calloc( 3, sizeof( DBLK ) ) ) == NULL ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+ else {
+ /* set up the DBLK_PTRs in the Request/Reply structure */
+ lp->rr.vcb_ptr = dblk_ptr ;
+ lp->rr.ddb_ptr = dblk_ptr + 1 ;
+ lp->saved_ddb = dblk_ptr + 1 ;
+ lp->rr.fdb_ptr = dblk_ptr + 2 ; /* ASSUMPTION : */
+ lp->rr.idb_ptr = dblk_ptr + 2 ; /* no FS has both FDB & IDB */
+ }
+
+ /* Set up the loop environment structure */
+ lp->rr.filter_to_use = TF_KEEP_ALL_DATA ;
+ lp->seq_num = 1 ;
+ lp->tpos.tape_id = -1 ;
+ lp->tpos.tape_seq_num = -1 ;
+
+ /* allocate buffers for operation */
+
+ mem_save = BEC_GetReserveMem( cfg ) ;
+ max_buffs = BEC_GetMaxTapeBuffers( cfg ) ;
+ buff_size = BEC_GetTFLBuffSize( cfg ) ;
+
+ return_status = TF_AllocateTapeBuffers( mem_save, max_buffs, buff_size ) ;
+
+ if( return_status != SUCCESS ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+
+ }
+
+ /* indicate the start of the operation */
+ LP_MsgStartOP( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* for each bsd */
+ do {
+
+ /* First attach to the drive */
+ dle_ptr = BSD_GetDLE( bsd_ptr ) ;
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ lis_ptr->curr_bsd_ptr = bsd_ptr ;
+
+ /* Now attach to the dle */
+ if( ( return_status = FS_AttachToDLE( &lp->curr_fsys, dle_ptr, cfg, NULL, NULL ) ) == SUCCESS ) {
+
+ /* Set up the loop environment structure */
+ lp->get_spcl = TRUE ;
+ lp->seq_num = 1 ;
+ lp->start_new_dir = TRUE ;
+ lp->get_first_file = TRUE ;
+ lp->get_next_first_time = TRUE ;
+ lp->send_saved_block = FALSE ;
+ lp->curr_blk = &lp->dblk1 ;
+ lp->curr_ddb = &lp->dblk2 ;
+ lp->empty_blk = &lp->dblk3 ;
+ lp->blk_is_empty = TRUE ;
+ lp->ffr_inited = FALSE ;
+ lp->cat_enabled = (BOOLEAN)(BEC_GetCatalogLevel( cfg ) != CATALOGS_NONE) ;
+ /* Reset the PBA values in case one set is fully catalogged */
+ /* and another is not. */
+ lp->tpos.tape_loc.pba_vcb = 0 ;
+ lp->rr.tape_loc.pba_vcb = 0 ;
+ lp->tpos.tape_loc.lba = 0 ;
+ lp->rr.tape_loc.lba = 0 ;
+ lp->tpos.UI_TapePosRoutine = lis_ptr->tape_pos_handler ;
+ lp->curr_dle = dle_ptr ;
+ lp->tpos.tape_cat_ver = BSD_GetTapeCatVer( bsd_ptr ) ;
+
+ sdrv = LP_DetermineStartingTPDrv( lis_ptr->oper_type, bsd_ptr, &lp->tpos, lis_ptr->auto_det_sdrv ) ;
+
+ /* fill in the the set number before calling LP_RestoreDLE */
+
+ if ( reuse_bsd ) {
+ lp->tpos.backup_set_num ++ ;
+ /* In case any FSEs have been tagged as deleted by processing
+ the last set, make sure they are "real" now */
+ BSD_ClearDelete( bsd_ptr ) ;
+ }
+ else {
+
+ /* this is the first time we are looking at this BSD */
+
+ if ( BSD_GetSetNum( bsd_ptr ) < 0 ) {
+
+ /* Set reuse indicator based upon whether another
+ bsd is in the queue */
+
+ temp_bsd_ptr = BSD_GetNext( bsd_ptr );
+ if ( temp_bsd_ptr != NULL ) {
+ reuse_bsd = FALSE;
+ }
+ else {
+ reuse_bsd = TRUE;
+ }
+
+ if ( BSD_GetSetNum( bsd_ptr ) == -1 ) {
+ /* negative one means the current set and all following sets */
+ if( first_time ) {
+ lp->tpos.backup_set_num = -1;
+ } else {
+ lp->tpos.backup_set_num++ ;
+ }
+ }
+ else {
+
+ /* -2 means set 2 and all the following sets */
+ /* -3 " " 3 " " " " " */
+ /* and so on */
+
+ lp->tpos.backup_set_num = (-BSD_GetSetNum( bsd_ptr ) ) ;
+ }
+ }
+ else {
+ lp->tpos.backup_set_num = BSD_GetSetNum( bsd_ptr ) ;
+ }
+ }
+
+ if( !tape_opened ) {
+ /* open the tape for operation */
+ tape_opened = TRUE ;
+ if( ( return_status = TF_OpenTape( &channel_no, sdrv, &lp->tpos ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+
+ if( return_status == SUCCESS ) {
+
+ /* Perform the operation */
+ return_status = LP_RestoreDLE( bsd_ptr, lp, reuse_bsd, channel_no, sdrv ) ;
+
+ if ( reuse_bsd && ( ( return_status == TFLE_UI_HAPPY_ABORT ) || ( return_status == TFLE_USER_ABORT ) ) && !( first_time ) ) {
+
+ /* we've hit the end of a tape that we were restoring unknown sets from */
+
+ reuse_bsd = FALSE ;
+
+ /* filter out the error */
+ return_status = SUCCESS ;
+ }
+
+ /* The following condition is used to fix the prompt for
+ 2nd tape in a multiple tape restore/verify with
+ restore that tape 1 contains uncataloged backup sets
+ or with the possibility of containing uncataloged
+ backup sets */
+
+ if ( return_status == TFLE_UI_HAPPY_ABORT ) {
+ temp_bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+ if ( temp_bsd_ptr != NULL ) {
+ return_status = SUCCESS ;
+ }
+ }
+
+ first_time = FALSE ;
+
+ FS_DetachDLE( lp->curr_fsys ) ; /* $$$ ??? checking return value */
+ }
+
+ } else if( return_status != USER_ABORT ) {
+
+ /* error attaching to the drive, just go on to next drive, if there is one */
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_DRIVE_ATTACH_ERROR, NULL, NULL, 0L ) ;
+
+ /* reset return_status, and try the next bsd */
+ return_status = SUCCESS ;
+ }
+
+ if ( ! reuse_bsd ) {
+ bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+ }
+
+ /* Continue, as long as we did not have an error, and we can get a new bsd */
+ } while( !return_status && ( bsd_ptr != NULL ) ) ;
+
+ if( tape_opened ) {
+ TF_CloseTape( channel_no ) ;
+ }
+
+ /* Deinit operation buffers */
+ if( ( status = TF_FreeTapeBuffers( ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, lis_ptr->curr_bsd_ptr, NULL, &lp->tpos,
+ status, NULL, NULL, 0L ) ;
+ }
+
+ /* indicate the end of the operation */
+ LP_MsgEndOP( lis_ptr->pid, lis_ptr->curr_bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+}
diff --git a/private/utils/ntbackup/src/lprintf.c b/private/utils/ntbackup/src/lprintf.c
new file mode 100644
index 000000000..37bca761d
--- /dev/null
+++ b/private/utils/ntbackup/src/lprintf.c
@@ -0,0 +1,610 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: lprintf.c
+
+ Description: Functions for log file support
+
+ $Log: G:\UI\LOGFILES\LPRINTF.C_V $
+
+ Rev 1.26 14 Dec 1993 09:14:40 MikeP
+fix msoft logfiles to always append
+
+ Rev 1.25 26 Jul 1993 17:51:50 MARINA
+enable c++
+
+ Rev 1.24 10 May 1993 09:20:24 chrish
+NOSTRADAMUS EPR 0401: Fixed the problem of the "backup.log" always being
+appended to. Fixed such that when a new session of the app is invoked it
+replaces the the log rather than append to it.
+
+ Rev 1.23 31 Mar 1993 17:56:12 TIMN
+Doesn't log to logfile with DONT LOG selected EPR(unknown)
+
+ Rev 1.22 08 Feb 1993 15:44:54 chrish
+Change in lresprintf routine to allow directory information on
+detail as well as summary logging selected.
+
+ Rev 1.21 05 Nov 1992 17:09:18 DAVEV
+fix ts
+
+ Rev 1.19 07 Oct 1992 14:50:38 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.18 04 Oct 1992 19:38:42 DAVEV
+Unicode Awk pass
+
+ Rev 1.17 28 Jul 1992 14:48:08 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.16 10 Jun 1992 12:40:54 JOHNWT
+bug out if verify/skipped for msoft
+
+ Rev 1.15 19 May 1992 13:01:20 MIKEP
+mips changes
+
+ Rev 1.14 14 May 1992 16:51:10 MIKEP
+nt pass 2
+
+ Rev 1.13 28 Apr 1992 08:32:58 ROBG
+Took tab out of the logging of multiple file names on a single line.
+
+ Rev 1.12 06 Apr 1992 13:28:26 GLENN
+Fixed new-line problem for all log files.
+
+ Rev 1.11 31 Mar 1992 11:32:34 DAVEV
+OEM_MSOFT:do not attempt to open log file if none specified
+
+ Rev 1.10 20 Mar 1992 12:38:42 DAVEV
+Changes for OEM_MSOFT product alternate functionality
+
+ Rev 1.9 18 Mar 1992 11:58:00 ROBG
+Fixed problem when more than one log file is opened and
+the names are misused.
+
+ Rev 1.8 18 Mar 1992 09:38:24 ROBG
+Modified the New Page after closing of a log file to New Line.
+
+ Rev 1.7 18 Mar 1992 09:33:18 DAVEV
+changes for OEM_MSOFT log files
+
+ Rev 1.6 25 Feb 1992 21:32:04 GLENN
+Changed log file name to be created only if not prev created.
+
+ Rev 1.5 18 Feb 1992 15:43:08 ROBG
+Modified UI_TruncateString call Not to set blanks to 0xFF.
+
+ Rev 1.4 03 Feb 1992 16:57:38 ROBG
+Added debug line when closing the log file.
+
+ Rev 1.3 20 Jan 1992 12:58:36 MIKEP
+disk full error
+
+ Rev 1.2 16 Jan 1992 11:23:48 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.1 10 Jan 1992 16:24:54 CARLS
+removed strings
+
+ Rev 1.0 20 Nov 1991 19:30:02 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/* Defined logging output lookup table for various output files */
+
+LOG_DEST output_dest[ NUM_DEST_TYPES ] = {
+ { /* Log file */
+ NULL,
+ 0xff,
+ },
+ { /* corrupt file */
+ NULL,
+ LOG_APPEND,
+ },
+ { /* debug log file */
+ NULL,
+ LOG_APPEND,
+ },
+ { /* skipped file */
+ NULL,
+ LOG_APPEND,
+ },
+ { /* verify file */
+ NULL,
+ LOG_APPEND,
+ }
+};
+
+static CHAR_PTR GetResId( INT, INT );
+static VOID OpenLog( INT );
+static VOID DetermineLogFileName( CHAR_PTR, INT );
+static CHAR log_name[ MAX_UI_PATH_SIZE ];
+
+/*****************************************************************************
+
+ Name: OpenLog
+
+ Description: Init the logging capability, disk file or printer
+
+ Returns: (void)
+
+ Notes: Called indirectly from a call to lresprintf with the
+ "LOG_START" message. Log file is opened in append mode
+ always except upon the first entry if the permanent
+ configuration specified to overwrite the log.
+
+*****************************************************************************/
+static VOID OpenLog( INT index )
+{
+ CDS_PTR conf_ptr = CDS_GetCopy( );
+ BOOLEAN append = CDS_GetLogMode( conf_ptr );
+ CHAR open_mode[ 2 ];
+ INT open_mode_UNI ;
+
+ msassert( index < NUM_DEST_TYPES );
+
+ // Determine file name based on the type of log file.
+ // Determine the name if not the session log file.
+
+ if ( index ) {
+ DetermineLogFileName( log_name, index );
+ } else {
+
+ // For the process log file only, use the previous defined.
+
+ strcpy( log_name, LOG_GetCurrentLogName() ) ;
+ }
+
+ /* Determine file open mode */
+
+ if ( output_dest[index].mode == 0xff ) { // For log file only.
+
+ DetermineLogFileName( log_name, index );
+
+#ifdef OEM_MSOFT
+
+ // According to Steve, microsoft wants it to always append. mikep 12/12/93
+
+ strcpy( open_mode, TEXT("a") );
+ open_mode_UNI = _O_TEXT|_O_APPEND ;
+#else
+ strcpy( open_mode, ( append ? TEXT("a"):TEXT("w") ) );
+ if ( append ) {
+ open_mode_UNI = _O_TEXT|_O_APPEND ;
+ }
+#endif
+
+ CDS_SetLogMode( conf_ptr, 1 ); /* set runtime config to append mode */
+ output_dest[index].mode = LOG_APPEND;
+
+ }
+ else {
+
+ if ( output_dest[index].mode == LOG_APPEND ) {
+ strcpy( open_mode, TEXT("a") );
+ open_mode_UNI = _O_TEXT|_O_APPEND ;
+ }
+ else {
+ open_mode_UNI = _O_TEXT;
+ strcpy( open_mode, TEXT("w") );
+ }
+ }
+
+# if defined ( OEM_MSOFT ) // special feature
+ {
+ if ( !*log_name )
+ {
+ return; // no log file to open!
+ }
+ }
+# endif //defined ( OEM_MSOFT ) // special feature
+
+ zprintf( DEBUG_USER_INTERFACE, RES_OPENING_LOG_NAME, log_name, open_mode[0] );
+
+ if ( ( output_dest[index].fh = UNI_fopen( log_name, open_mode_UNI ) ) == NULL ) {
+ eresprintf( RES_OPEN_LOG_ERROR, log_name );
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: lresprintf
+
+ Description: Entry point for logging information to log file/printer
+
+ Returns: (void)
+
+*****************************************************************************/
+VOID lresprintf( INT index, INT message, ... )
+{
+ INT res_session; /* resource session for format */
+ INT res_id; /* variable argument resource id # */
+ CHAR buffer[ UI_MAX_DETAIL_LENGTH ]; /* temporary filename */
+ FSYS_HAND fsh; /* variable argument file system handle */
+ DBLK_PTR dblk_ptr; /* variable argument dblock pointer */
+ CHAR_PTR fmt; /* resource format string */
+ va_list arg_ptr; /* variable argument pointer */
+ CDS_PTR conf_ptr = CDS_GetCopy( ); /* working copy config */
+ static UINT16 num_files[ NUM_DEST_TYPES ]; /* counters for wide logging of files */
+ static BOOLEAN OS_flag = TRUE; /* indicate how to build file details */
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR_PTR stream_name ;
+
+ msassert( index < NUM_DEST_TYPES );
+
+ if ( ( index == LOGGING_FILE ) && ( CDS_GetOutputDest( conf_ptr ) == LOG_NOWHERE ) ||
+ ( index == LOGGING_FILE ) && ( CDS_GetLogLevel( conf_ptr ) == LOG_DISABLED ) ||
+ ( index == DEBUG_LOG_FILE ) ) {
+ return;
+ }
+
+#if defined ( OEM_MSOFT ) // not supported
+
+ if ( ( index == VERIFY_FILE ) || ( index == SKIPPED_FILE ) ) {
+ return;
+ }
+
+#endif //defined ( OEM_MSOFT )
+
+ va_start( arg_ptr, message );
+
+ switch( message ) {
+
+ case LOG_DIRECTORY:
+// chs:02-03-93 if( CDS_GetLogLevel( conf_ptr ) > LOG_ERRORS ) {
+
+ //
+ // Allow the directory information when detail or summary
+ // logging was selected by the user.
+ //
+
+ if( CDS_GetLogLevel( conf_ptr ) >= LOG_ERRORS ) { // chs: 02-03-93
+ res_session = va_arg( arg_ptr, INT );
+ res_id = va_arg( arg_ptr, INT );
+ fmt = GetResId ( res_session, res_id );
+
+ if( num_files[ index ] ) { /* force a blank line and reset counter */
+ lprintf ( index, TEXT("\n") );
+ num_files[ index ] = 0;
+ }
+ lvprintf( index, fmt, arg_ptr );
+ lprintf( index, TEXT("\n") );
+ }
+ break;
+
+ case LOG_FILE:
+ /* get additional arguments first */
+ fsh = va_arg( arg_ptr, FSYS_HAND );
+ dblk_ptr = va_arg( arg_ptr, DBLK_PTR );
+ if( CDS_GetLogLevel( conf_ptr ) == LOG_FILES ) {
+ /* log filenames only */
+ if ( OS_flag ) {
+ FS_GetOSFnameFromFDB( fsh, dblk_ptr, buffer );
+ } else {
+ FS_GetFnameFromFDB( fsh, dblk_ptr, buffer );
+ }
+ UI_TruncateString( buffer, (UINT16)UI_MAX_WIDE_FILE_DISPLAY, FALSE );
+ if( num_files[ index ] >= 5 ) { /* advance to next line */
+ lprintf( index, TEXT("\n") );
+ num_files[ index ] = 0;
+ }
+#ifndef UNICODE
+ lprintf( index, TEXT("%-15s"), buffer );
+#else //UNICODE
+ lprintf( index, TEXT("%-15ws"), buffer );
+#endif //UNICODE
+ num_files[ index ]++;
+ } else if ( CDS_GetLogLevel( conf_ptr ) == LOG_DETAIL ) {
+ /* log filenames and detail also */
+ UI_BuildFileDetail( buffer, fsh, dblk_ptr, OS_flag );
+ lprintf( index, TEXT("%s"), buffer );
+ }
+ break;
+
+ case LOG_STREAM:
+ fsh = va_arg( arg_ptr, FSYS_HAND );
+ stream_name = va_arg( arg_ptr, CHAR_PTR );
+ if( CDS_GetLogLevel( conf_ptr ) == LOG_DETAIL ) {
+
+ lprintf ( index, stream_name );
+ lprintf ( index, TEXT("\n") );
+ }
+
+ break;
+
+ case LOG_MSG:
+ case LOG_ERROR:
+ case LOG_WARNING:
+ res_session = va_arg( arg_ptr, INT );
+ res_id = va_arg( arg_ptr, INT );
+ fmt = GetResId ( res_session, res_id );
+
+ // Advance to next line.
+
+ if( num_files[ index ] ) { /* force a blank line and reset counter */
+ lprintf ( index, TEXT("\n") );
+ num_files[ index ] = 0;
+ }
+
+ lvprintf( index, fmt, arg_ptr );
+ lprintf ( index, TEXT("\n") );
+
+ break;
+
+ case LOG_START:
+ OS_flag = va_arg( arg_ptr, BOOLEAN );
+ OpenLog( index );
+ gb_logging_error = FALSE;
+
+ // Reset the number of files for this index.
+
+ num_files[ index ] = 0;
+
+ break;
+
+ case LOG_END:
+
+ if ( gb_logging_error ) {
+
+ // Tell user disk was full.
+
+ RSM_StringCopy ( IDS_VLMLOGERROR, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy ( IDS_VLMLOGFULLERROR, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title,
+ text,
+ WMMB_OK, WMMB_ICONINFORMATION );
+ }
+
+ if ( output_dest[index].fh != NULL ) {
+ if ( index <= CORRUPT_FILE ) {
+ fprintf( output_dest[index].fh, TEXT("\n") ); /* send new line */
+ }
+
+ zprintf( DEBUG_USER_INTERFACE, RES_CLOSING_LOG_NAME, log_name );
+
+ fclose( output_dest[index].fh );
+
+ // Refresh the Log Files Window.
+
+ LOG_Refresh();
+
+ output_dest[index].fh = NULL;
+
+# if defined ( OEM_MSOFT ) //special feature
+ {
+ if ( index == 0 ) // if Log file
+ {
+ output_dest[index].mode = 0xff; //reset log file info
+ }
+ }
+# endif //defined ( OEM_MSOFT ) //special feature
+
+ }
+ break;
+
+ default:
+ eresprintf( RES_UNKNOWN_LOG_MSG, message );
+ break;
+ }
+
+ va_end( arg_ptr );
+ return;
+}
+
+/*****************************************************************************
+
+ Name: GetResId
+
+ Description: Performs calls to Resource Manager to load a specific
+ session and a specific resource
+
+ Returns: CHAR_PTR to requested resource, asserts if not found
+
+ Notes: Desired session should already be loaded, if resource is
+ not found, inconsistencies exist in resource file so
+ an assert is done.
+
+*****************************************************************************/
+CHAR_PTR GetResId( INT res_session, INT res_id )
+{
+ UINT16 num_resources;/* number of resource items */
+ UINT16 error; /* resource manager error */
+ CHAR_PTR fmt; /* resource format string read */
+
+ fmt = (LPSTR)RM_GetResource( rm, (UINT) res_session, (UINT) res_id, &num_resources, &error );
+ msassert( error == RM_NO_ERROR );
+
+ return( fmt );
+}
+/*****************************************************************************
+
+ Name: lprintf
+
+ Description: Log printf function that accepts a format string and a
+ variable list of arguments and calls lvprintf to perform
+ actual logging
+
+ Returns: (void)
+
+*****************************************************************************/
+VOID lprintf( INT index, CHAR_PTR fmt, ... )
+{
+ va_list arg_ptr;
+
+ msassert( index < NUM_DEST_TYPES );
+
+#if defined ( OEM_MSOFT ) // not supported
+
+ if ( ( index == VERIFY_FILE ) || ( index == SKIPPED_FILE ) ) {
+ return;
+ }
+
+#endif //defined ( OEM_MSOFT )
+
+ va_start( arg_ptr, fmt );
+
+ lvprintf( index, fmt, arg_ptr );
+
+ va_end( arg_ptr );
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: lvprintf
+
+ Description: Performs call to vfprintf with log file handle,
+ format string and list of variable arguments to be
+ written to the log file
+
+ Returns: (void)
+
+*****************************************************************************/
+VOID lvprintf(
+INT index,
+CHAR_PTR fmt,
+va_list arg_ptr )
+{
+ msassert( index < NUM_DEST_TYPES );
+
+ if ( output_dest[index].fh != NULL && gb_logging_error != TRUE ) {
+
+ gb_logging = NOW_LOGGING;
+ if (IS_JAPAN() ) {
+ CHAR wBuff[MAX_UI_RESOURCE_SIZE];
+ char aBuff[MAX_UI_RESOURCE_SIZE*2];
+ BOOL fDefCharUsed;
+ int iRet;
+
+ wvsprintf( wBuff, fmt, arg_ptr );
+ iRet = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)wBuff, -1, aBuff,
+ MAX_UI_RESOURCE_SIZE*2, NULL, &fDefCharUsed );
+ if( !iRet ) {
+ gb_logging_error = TRUE;
+ } else{
+ fwrite(aBuff, 1, iRet, output_dest[index].fh);
+ }
+
+ } else {
+ vfprintf( output_dest[index].fh, fmt, arg_ptr );
+ }
+
+ if ( ferror( output_dest[index].fh ) ) {
+
+ gb_logging_error = TRUE;
+ }
+
+ if ( gb_logging == STOP_LOGGING ) {
+
+ fclose( output_dest[index].fh );
+
+ output_dest[index].fh = NULL;
+ }
+
+ clearerr( output_dest[index].fh );
+
+ gb_logging = NOT_LOGGING;
+ }
+
+ return;
+
+}
+/*****************************************************************************
+
+ Name: LogFileExists
+
+ Description: Determines if a log file exists or not
+
+ Returns: TRUE if the file was found on disk
+ FALSE if the file was not found
+
+*****************************************************************************/
+BOOLEAN LogFileExists( INT index )
+{
+ CHAR log_name[ UI_MAX_PATH_LENGTH + UI_MAX_FILENAME_LENGTH ];
+
+ msassert( index < NUM_DEST_TYPES );
+
+ DetermineLogFileName( log_name, index );
+
+ return (BOOLEAN)( ( access( log_name, 0 ) == 0 ) ? TRUE : FALSE );
+
+}
+/*****************************************************************************
+
+ Name: DetermineLogFileName
+
+ Description:
+
+ Returns: VOID
+
+ Notes: Call is responsible for memory associated with name string
+
+*****************************************************************************/
+static VOID DetermineLogFileName(
+CHAR_PTR pLogName,
+INT nIndex )
+{
+ CDS_PTR pCDS = CDS_GetCopy( );
+
+ msassert( nIndex < NUM_DEST_TYPES );
+
+ switch ( nIndex ) {
+
+ case LOGGING_FILE:
+
+ if ( CDS_GetOutputDest( pCDS ) == LOG_TO_FILE ) {
+
+ strcpy ( pLogName, LOG_GetCurrentLogName () );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ if ( ! strlen ( pLogName ) ) {
+ LOG_GenerateLogFileName ( pLogName );
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+ }
+
+ break;
+
+ case CORRUPT_FILE:
+ strcpy( pLogName, CDS_GetUserDataPath( ) );
+ strcat( pLogName, CORRUPT_LOG );
+ strcat( pLogName, LST_EXT );
+ break;
+
+ case DEBUG_LOG_FILE:
+ strcpy( pLogName, CDS_GetUserDataPath( ) );
+ strcat( pLogName, DEBUG_LOG );
+ strcat( pLogName, LOG_EXT );
+ break;
+
+ case SKIPPED_FILE:
+ strcpy( pLogName, CDS_GetUserDataPath( ) );
+ strcat( pLogName, SKIPPED_LOG );
+ strcat( pLogName, BKS_EXT );
+ break;
+
+ case VERIFY_FILE:
+ strcpy( pLogName, CDS_GetUserDataPath( ) );
+ strcat( pLogName, VERIFY_LOG );
+ strcat( pLogName, BKS_EXT );
+ break;
+ }
+
+ return;
+}
diff --git a/private/utils/ntbackup/src/lptools.c b/private/utils/ntbackup/src/lptools.c
new file mode 100644
index 000000000..4a5b0f3de
--- /dev/null
+++ b/private/utils/ntbackup/src/lptools.c
@@ -0,0 +1,837 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lptools.c
+
+ Description: this module contains the loop tools used by the loops layer.
+
+ $Log: T:/LOGFILES/LPTOOLS.C_V $
+
+ Rev 1.32 13 Mar 1993 17:09:42 GREGG
+Changed LP_SendDataEnd back to the old method of always setting buff_used to 0.
+
+ Rev 1.31 11 Mar 1993 12:43:38 STEVEN
+fix bugs found by GREGG
+
+ Rev 1.30 14 Jan 1993 13:34:00 STEVEN
+added stream_id to error message
+
+ Rev 1.29 20 Nov 1992 12:57:00 STEVEN
+added support for skip stream filter
+
+ Rev 1.28 20 Nov 1992 10:38:24 STEVEN
+added suport for continue VCB message
+
+ Rev 1.27 04 Nov 1992 17:29:48 STEVEN
+fix typo
+
+ Rev 1.26 04 Nov 1992 13:23:54 STEVEN
+fix various bugs with read
+
+ Rev 1.25 27 Oct 1992 12:10:48 STEVEN
+if we send new stream then return
+
+ Rev 1.24 21 Oct 1992 16:23:02 STEVEN
+forgot the case statement
+
+ Rev 1.23 15 Oct 1992 10:01:46 STEVEN
+added new stream message
+
+ Rev 1.22 13 Oct 1992 17:26:22 STEVEN
+oops I forgot the TRR_END message
+
+ Rev 1.21 13 Oct 1992 17:20:24 STEVEN
+save old tf message
+
+ Rev 1.20 23 Jul 1992 16:44:48 STEVEN
+fix warnings
+
+ Rev 1.19 23 Jul 1992 12:10:12 STEVEN
+fix warnings
+
+ Rev 1.18 06 Jul 1992 09:39:10 STEVEN
+fix typo
+
+ Rev 1.17 21 May 1992 17:20:30 TIMN
+Converted CHARs to INT8
+
+ Rev 1.16 13 May 1992 12:35:36 TIMN
+Added TEXT() macro to literals, but not msassert literals
+
+ Rev 1.15 13 May 1992 12:00:34 STEVEN
+40 format changes
+
+ Rev 1.14 04 Feb 1992 22:22:00 GREGG
+Don't restart clock in ProcessEOM until after tape request returns.
+
+ Rev 1.13 25 Jan 1992 15:04:02 GREGG
+Removed loop around GetNxetTapeRequest in ProcessEOM so he only calls it
+once, and leaves it up to the caller to decide what to do with the response.
+
+ Rev 1.12 16 Jan 1992 15:11:00 STEVEN
+fix warnings for WIN32
+
+ Rev 1.11 19 Dec 1991 16:32:08 BARRY
+Clear buffer used when sending END_DATA message.
+
+ Rev 1.10 25 Oct 1991 15:58:06 GREGG
+TRICYCLE - Re-switch after calls to ProcessEOM.
+
+ Rev 1.9 18 Oct 1991 14:06:36 STEVEN
+TRICYCLE-added function for end of varible length file
+
+ Rev 1.8 18 Oct 1991 14:02:42 STEVEN
+BIGWHEEL-fixed bug where we asserted
+
+ Rev 1.7 18 Oct 1991 11:34:12 STEVEN
+BIGWHEEL-add parameter to message prompt
+
+ Rev 1.6 16 Aug 1991 17:11:26 STEVEN
+Could not Verify or Restore multiple sets
+
+ Rev 1.5 27 Jun 1991 13:06:20 STEVEN
+removed unused parm to ReceiveData
+
+ Rev 1.4 21 Jun 1991 08:45:40 STEVEN
+new config unit
+
+ Rev 1.3 17 Jun 1991 16:28:14 STEVEN
+LP_PadData is called from lptools.c so it was moved to there
+
+ Rev 1.2 30 May 1991 09:10:52 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.1 24 May 1991 13:12:10 STEVEN
+changed to ANSI prototypes
+
+ Rev 1.0 09 May 1991 13:37:56 HUNTER
+Initial revision.
+
+**/
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "tbe_err.h"
+#include "tbe_defs.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "queues.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "get_next.h"
+#include "be_debug.h"
+
+/* internal function prototypes */
+INT16 LP_ProcessEOM( LP_ENV_PTR lp, UINT16 tf_message ) ;
+
+/* Static table of values for LP_Send( ) when sending DBLK, not data */
+static UINT16 loops_messages[] = {
+
+ 0,
+ LRW_VCB,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ LRW_DDB,
+ LRW_FDB,
+ LRW_IDB,
+ LRW_CFDB } ;
+
+/**/
+/**
+
+ Name: LP_StartTPEDialogue()
+
+ Description: this routine starts the dialogue with the tape format.
+
+ Modified: 5/24/1991 12:47:11
+
+ Returns: SUCCESS or the error returned by Tape Format
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_StartTPEDialogue(
+register LP_ENV_PTR lp, /* I - loop environment pointer */
+BOOLEAN write ) /* I - TRUE if starting for write */
+{
+ INT16 return_status = SUCCESS ;
+ INT16 msg_err_stat ;
+
+ if( lp->lis_ptr != NULL ) {
+
+ if( LP_AbortFlagIsSet( lp->lis_ptr ) ) {
+
+ return TFLE_USER_ABORT ;
+
+ }
+ }
+
+ /* start dialogue with tape format */
+ lp->rr.lp_message = (INT16)(( write ) ? LRW_START : LRR_START) ;
+ lp->rr.cur_dblk = lp->curr_blk ;
+
+ if( ( return_status = TF_GetNextTapeRequest( &lp->rr ) ) == SUCCESS ) {
+
+ switch( lp->rr.tf_message ) {
+
+ default:
+ break ;
+
+ case TRR_FATAL_ERR:
+ case TRW_FATAL_ERR:
+ case TRR_DATA:
+ case TRW_DATA:
+ case TRR_EOM:
+ case TRW_EOM:
+ msassert( FALSE ) ;
+ break ;
+
+ }
+ }
+ else {
+ if( ( msg_err_stat = LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+ }
+
+ return( return_status ) ;
+
+}
+
+/**/
+/**
+
+ Name: LP_Send()
+
+ Description: this routine sends a descriptor block or data to the tape format.
+
+ Modified: 5/24/1991 12:47:34
+
+ Returns: SUCCESS or the error returned by Tape Format
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_Send(
+register LP_ENV_PTR lp, /* I - loop environment structure */
+BOOLEAN data_flag ) /* I - True if we are in data phase */
+{
+ INT16 return_status = SUCCESS ;
+ INT16 msg_err_stat ;
+ BOOLEAN request_made = FALSE ;
+
+ if( LP_AbortFlagIsSet( lp->lis_ptr ) ) {
+
+ return TFLE_USER_ABORT ;
+
+ }
+
+ if( ( msg_err_stat = LP_MsgIdle( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+
+ /* set loop message */
+ if ( data_flag ) {
+
+ if ( lp->rr.stream.id != STRM_INVALID ) {
+
+ lp->current_stream_size = lp->rr.stream.size ;
+ lp->current_stream_id = lp->rr.stream.id ;
+ lp->rr.lp_message = LRW_NEW_STREAM ;
+ return_status = TF_GetNextTapeRequest( &lp->rr ) ;
+ request_made = TRUE ;
+
+ } else {
+ lp->rr.lp_message = LRW_DATA ;
+ }
+
+ } else {
+ lp->rr.lp_message = loops_messages[ FS_GetBlockType( lp->rr.cur_dblk ) ] ;
+ }
+
+ lp->rr.requested_size = 0 ; /* only to be used during reads */
+
+ if ( !request_made ) {
+ return_status = TF_GetNextTapeRequest( &lp->rr ) ;
+ }
+
+ if ( return_status == SUCCESS ) {
+
+ switch( lp->rr.tf_message ) {
+
+ default:
+ break ;
+
+ case TRW_EOM:
+ return_status = LP_ProcessEOM( lp, TRW_EOM ) ;
+ break ;
+
+ case TRW_FATAL_ERR:
+ msassert( FALSE ) ;
+ break ;
+
+ }
+ }
+ else {
+ if( ( msg_err_stat = LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+ }
+
+ return( return_status ) ;
+
+}
+/**/
+/**
+
+ Name: LP_SendDataEnd()
+
+ Description: this routine sends a end data message to tape format.
+
+ Modified: 5/24/1991 12:47:34
+
+ Returns: SUCCESS or the error returned by Tape Format
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_SendDataEnd(
+register LP_ENV_PTR lp ) /* I - loop environment structure */
+{
+ INT16 return_status = SUCCESS ;
+ INT16 msg_err_stat ;
+
+ /* set loop message */
+ lp->rr.lp_message = LRW_DATA_END ;
+ lp->rr.buff_used = 0 ;
+ lp->rr.requested_size = 0 ; /* only to be used during reads */
+
+ if( ( return_status = TF_GetNextTapeRequest( &lp->rr ) ) == SUCCESS ) {
+
+ switch( lp->rr.tf_message ) {
+
+ default:
+ break ;
+
+ case TRW_EOM:
+ return_status = LP_ProcessEOM( lp, TRW_EOM ) ;
+ break ;
+
+ case TRW_FATAL_ERR:
+ msassert( FALSE ) ;
+ break ;
+
+ }
+ }
+ else {
+ if( ( msg_err_stat = LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+ }
+
+ return( return_status ) ;
+}
+
+/**/
+/**
+
+ Name: LP_ReceiveDBLK()
+
+ Description:
+
+ Modified: 5/24/1991 12:48:54
+
+ Returns: SUCCESS or the error returned by Tape Format
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_ReceiveDBLK(
+register LP_ENV_PTR lp ) /* I - Loop Environment structre */
+{
+ INT16 return_status = SUCCESS ;
+ INT16 msg_err_stat ;
+ DBLK_PTR temp_ptr ;
+ CHAR crrpt_blk_fname[ 13 ] ; /* $$$ literal ??? MAX_FNAME_LEN ??? */
+ INT16 crrpt_blk_fname_leng ;
+ GEN_FDB_DATA gfdb_data ;
+ BOOLEAN done = FALSE ;
+
+ if( LP_AbortFlagIsSet( lp->lis_ptr ) ) {
+
+ return TFLE_USER_ABORT ;
+
+ }
+
+ /* Let everyone know we are here */
+ if( ( msg_err_stat = LP_MsgIdle( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+
+ if ( lp->blk_is_empty ) {
+
+ lp->rr.cur_dblk = lp->empty_blk ;
+
+ if( ( return_status = TF_GetNextTapeRequest( &lp->rr ) ) == SUCCESS ) {
+
+ /* This loop is for the EOM case. We call ProcessEOM and it does
+ another GetNextTapeRequest so we need to re-switch on the new
+ tf_message.
+ */
+ while( !done && return_status == SUCCESS ) {
+
+ done = TRUE ;
+
+ switch( lp->rr.tf_message ) {
+
+ default:
+ break ;
+
+ case TRR_END:
+ /* end of set */
+ break ;
+
+ case TRR_DATA_END:
+ if( lp->rr.error_locus == TF_ERROR_BLK_WAS_FDB ) {
+ /* data dumped to disk was associated with a FDB */
+ LP_MsgRecFDB( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ } else if( lp->rr.error_locus == TF_ERROR_BLK_WAS_DDB ) {
+ /* data dumped to disk was associated with a DDB */
+ LP_MsgRecDDB( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+ }
+ break ;
+
+ case TRR_RECV_ERR:
+ lp->rr.tf_message = TRR_FDB ;
+
+ FS_SetDefaultDBLK( lp->curr_fsys, FDB_ID, ( CREATE_DBLK_PTR ) &gfdb_data ) ;
+ gfdb_data.std_data.dblk = lp->rr.cur_dblk ;
+ gfdb_data.std_data.disp_size = U64_Init(0,0) ; /* $$$ literal */
+
+ /* call message handler to prompt user for filename */
+ LP_MsgPrompt( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos,
+ CORRUPT_BLOCK_PROMPT, crrpt_blk_fname, &crrpt_blk_fname_leng ) ;
+
+ gfdb_data.fname = crrpt_blk_fname ;
+ gfdb_data.fname_size = crrpt_blk_fname_leng ;
+ FS_CreateGenFDB( lp->curr_fsys, &gfdb_data ) ;
+ break ;
+
+ case TRR_EOM:
+ return_status = LP_ProcessEOM( lp, (UINT16)TRR_EOM ) ;
+ done = FALSE ; /* Switch Again! */
+ break ;
+
+ case TRR_FATAL_ERR:
+ case TRR_DATA:
+ msassert( FALSE ) ;
+ break ;
+
+ }
+ }
+ }
+ else {
+ if( ( msg_err_stat = LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+ }
+ } else {
+ lp->rr.tf_message = lp->last_tape_message ;
+ }
+
+
+ temp_ptr = lp->empty_blk ;
+ lp->empty_blk = lp->curr_blk ;
+ lp->curr_blk = temp_ptr ;
+ lp->blk_is_empty = TRUE ;
+ lp->rr.filter_to_use = TF_KEEP_ALL_DATA ;
+
+ return( return_status ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: LP_FinishedOper()
+
+ Description: Sends a Finished message to Tape format
+
+ Modified: 5/24/1991 12:49:46
+
+ Returns: the error returned by Tape Format
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_FinishedOper(
+register LP_ENV_PTR lp ) /* I - Loop Environment structure */
+{
+ INT16 return_status = SUCCESS ;
+
+ if( LP_AbortFlagIsSet( lp->lis_ptr ) ) {
+
+ return TFLE_USER_ABORT ;
+
+ }
+
+ lp->rr.lp_message = LRR_FINISHED ;
+
+ return_status = TF_GetNextTapeRequest( &lp->rr ) ;
+
+ return( return_status ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: LP_ReceiveData()
+
+ Description:
+
+ Modified: 5/24/1991 12:50:10
+
+ Returns: SUCCESS or the error returned by Tape Format
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 LP_ReceiveData(
+register LP_ENV_PTR lp, /* I - Loop environment strucutre */
+UINT32 amount_used ) /* I - Amount of last buffer used */
+{
+ INT16 return_status = SUCCESS ;
+ INT16 msg_err_stat ;
+ CHAR crrpt_blk_fname[ 13 ] ; /* $$$ literal ??? MAX_FNAME_LEN ??? */
+ INT16 crrpt_blk_fname_leng ;
+ GEN_FDB_DATA gfdb_data ;
+ BOOLEAN done = FALSE ;
+
+ if( LP_AbortFlagIsSet( lp->lis_ptr ) ) {
+
+ return TFLE_USER_ABORT ;
+
+ }
+
+ /* Let everyone know we are here */
+ if( ( msg_err_stat = LP_MsgIdle( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+
+ lp->rr.lp_message = LRR_STUFF ;
+ lp->rr.buff_used = ( UINT16 )amount_used ;
+ lp->rr.cur_dblk = lp->empty_blk ;
+ lp->rr.requested_size = 0 ;
+
+
+ if( ( return_status = TF_GetNextTapeRequest( &lp->rr ) ) == SUCCESS ) {
+
+ /* This loop is for the EOM case. We call ProcessEOM and it does
+ another GetNextTapeRequest so we need to re-switch on the new
+ tf_message.
+ */
+ while( !done && return_status == SUCCESS ) {
+
+ done = TRUE ;
+
+ switch( lp->rr.tf_message ) {
+
+ case TRR_FDB:
+ case TRR_DDB:
+ case TRR_CFDB:
+ case TRR_VCB:
+ case TRR_IDB:
+ lp->blk_is_empty = FALSE ;
+ lp->last_tape_message = lp->rr.tf_message ;
+ lp->rr.tf_message = TRR_DATA_END ;
+ break ;
+
+ case TRR_END:
+ /* end of set */
+ lp->blk_is_empty = FALSE ;
+ lp->last_tape_message = lp->rr.tf_message ;
+ lp->rr.tf_message = TRR_DATA_END ;
+ break ;
+
+ case TRR_RECV_ERR:
+ lp->tape_rd_error = TRUE ;
+
+ if( lp->rr.error_locus == TF_ERROR_IN_DBLK ) {
+ lp->rr.tf_message = TRR_FDB ;
+
+ FS_SetDefaultDBLK( lp->curr_fsys, FDB_ID, ( CREATE_DBLK_PTR ) &gfdb_data ) ;
+ gfdb_data.std_data.dblk = lp->rr.cur_dblk ;
+ gfdb_data.std_data.disp_size = U64_Init(0,0) ; /* $$$ literal */
+
+ /* call message handler to prompt user for filename */
+ LP_MsgPrompt( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos,
+ CORRUPT_BLOCK_PROMPT, crrpt_blk_fname, &crrpt_blk_fname_leng ) ;
+
+ gfdb_data.fname = crrpt_blk_fname ;
+ gfdb_data.fname_size = crrpt_blk_fname_leng ;
+ FS_CreateGenFDB( lp->curr_fsys, &gfdb_data ) ;
+ }
+ else {
+ /* message informing user of data read error at offset */
+ LP_MsgDataLost( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos,
+ lp->rr.error_file_offset, lp->rr.error_data_loss ) ;
+
+ lp->rr.tf_message = TRR_DATA ;
+ lp->rr.buff_size = lp->rr.error_data_loss ;
+
+ LP_PadData( lp->rr.buff_ptr, ( UINT32 )lp->rr.buff_size ) ;
+ }
+ break ;
+
+ case TRR_EOM:
+ return_status = LP_ProcessEOM( lp, (UINT16)TRR_EOM ) ;
+ done = FALSE ; /* Switch Again! */
+ break ;
+
+ case TRR_NEW_STREAM :
+ lp->current_stream_size = lp->rr.stream.size ;
+ lp->current_stream_id = lp->rr.stream.id ;
+ lp->rr.tf_message = TRR_DATA ;
+ break ;
+
+ case TRR_DATA :
+ lp->rr.stream.id = STRM_INVALID ;
+ break ;
+
+ case TRR_DATA_END :
+ default:
+ break ;
+
+ case TRR_FATAL_ERR:
+ msassert( FALSE ) ;
+ break ;
+
+ }
+ }
+ }
+ else {
+ if( ( msg_err_stat = LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+ }
+
+ lp->rr.filter_to_use = TF_KEEP_ALL_DATA ;
+
+ return( return_status ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: LP_ProcessEOM()
+
+ Description: Processes end of media condition
+
+ Modified: 5/24/1991 12:54:59
+
+ Returns: SUCCESS or the error returned by Tape Format
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_ProcessEOM(
+LP_ENV_PTR lp, /* I - Loope Environment struct */
+UINT16 tf_message ) /* I - Message returne from tape format */
+{
+ INT16 return_status = SUCCESS ;
+ INT16 msg_err_stat ;
+ UINT16 lp_message = (INT16)(( tf_message == TRW_EOM ) ? LRW_EOM_ACK : LRR_EOM_ACK ) ;
+
+ /* stop the clock during EOM processing */
+ LP_MsgStopClock( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ /* call message handler to prompt for next tape */
+ LP_MsgEOM( lp->lis_ptr->pid,
+ lp->lis_ptr->curr_bsd_ptr,
+ lp->curr_fsys,
+ &lp->tpos,
+ lp->rr.vcb_ptr,
+ lp->rr.ddb_ptr,
+ lp->rr.fdb_ptr,
+ lp->rr.idb_ptr ) ;
+
+ /* now acknowledge EOM to tape format and return control */
+ lp->rr.lp_message = lp_message ;
+
+ /* Let everyone know we are here */
+ if( ( msg_err_stat = LP_MsgIdle( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+
+ return_status = TF_GetNextTapeRequest( &lp->rr ) ;
+
+ /* restart the clock after EOM processing */
+ LP_MsgStartClock( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ /* check to see if the user wanted to continue processing */
+ if( return_status == TFLE_UI_HAPPY_ABORT ) {
+ LP_SetAbortFlag( lp->lis_ptr, ABORT_AT_EOM ) ;
+
+ } else if( return_status != SUCCESS ) {
+
+ if( ( msg_err_stat = LP_MsgError( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ) != MSG_ACK ) {
+ return( msg_err_stat ) ;
+ }
+
+ } else {
+ LP_MsgContinueVCB( lp->lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, lp->curr_fsys, &lp->tpos, lp->rr.vcb_ptr ) ;
+
+ }
+
+ return( return_status ) ;
+
+}
+
+/**/
+/**
+
+ Name: LP_PadData()
+
+ Description: This function fills a buffer of specified size with padded data.
+
+ Modified: 5/24/1991 13:3:0
+
+ Returns: none
+
+ Notes: the pad data is "This is padding !! \r\n"
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID LP_PadData(
+INT8_PTR buf, /* I - Buffer to place pad data into */
+UINT32 count ) /* I - Number of bytes of pad */
+{
+ UINT16 dest_pos ;
+ INT16 source_pos = 0 ;
+ INT8_PTR pad_string = "This is padding!! \r\n" ;
+
+
+ for( dest_pos = 0 ; dest_pos < (UINT16)count; dest_pos ++ ) {
+
+ if( pad_string[source_pos] == '\0' ) {
+ source_pos = 0 ;
+ }
+
+ buf[dest_pos] = pad_string[ source_pos ++ ] ;
+ }
+
+ return ;
+
+}
+/**/
+/**
+
+ Name: LP_CheckForOpen()
+
+ Description: This function trys to re open the file.
+
+ Modified: 11/16/1989
+
+ Returns: File system errors for open.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_CheckForOpen( ref )
+UINT32 ref ;
+{
+ LP_ENV_PTR lp;
+
+ lp = ( LP_ENV_PTR )ref ;
+
+ return( FS_OpenObj( lp->curr_fsys, lp->f_hand, lp->curr_blk, FS_READ ) ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: LP_CheckForReadLock()
+
+ Description: This function trys to re read the file inorder to
+ obtain a lock.
+
+ Modified: 11/16/1989
+
+ Returns: File system errors for Read.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_CheckForReadLock( ref )
+UINT32 ref ;
+{
+ LP_ENV_PTR lp;
+
+ lp = ( LP_ENV_PTR )ref ;
+
+ return( FS_ReadObj( lp->file_hand, lp->buf_start, &lp->read_size, &lp->blk_size, &lp->rr.stream ) ) ;
+
+}
+
+
+
diff --git a/private/utils/ntbackup/src/lptpcat.c b/private/utils/ntbackup/src/lptpcat.c
new file mode 100644
index 000000000..7995cdebc
--- /dev/null
+++ b/private/utils/ntbackup/src/lptpcat.c
@@ -0,0 +1,180 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: lptpcat.c
+
+ Description: Tape catalog read loop.
+
+ $Log: T:/LOGFILES/LPTPCAT.C_V $
+
+ Rev 1.4 10 Jun 1993 20:24:44 GREGG
+Initialize the channel number in the tpos structure.
+
+ Rev 1.3 16 Apr 1993 15:12:04 GREGG
+Steve's fix for abort handling.
+
+ Rev 1.2 21 Jan 1993 15:04:40 GREGG
+Added parameter to MsgError macro.
+
+ Rev 1.1 14 Jan 1993 13:33:12 STEVEN
+added stream_id to error message
+
+ Rev 1.0 09 Nov 1992 14:26:42 GREGG
+Initial revision.
+
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "get_next.h"
+
+
+/* the regular define for error messages, 'LP_MsgError', won't work because
+ we don't have a loop environment structure.
+*/
+#define MsgError( pid, bsd_ptr, fsys, tpos, error, ddb_dblk_ptr, dblk_ptr, strm_id ) \
+ ( lis_ptr->message_handler( MSG_TBE_ERROR, pid, bsd_ptr, fsys, tpos, error, ddb_dblk_ptr, dblk_ptr, strm_id ) )
+
+
+/**/
+/**
+
+ Unit: Loops
+
+ Name: LP_Tape_Cat_Engine
+
+ Description: This function simulates the behavior of
+ LP_List_Tape_Engine while calling the tape catalog API
+ to hide the fact that the DBLKs are being generated
+ from OTC as opposed to scanning the actual set.
+
+ Returns: Error code.
+
+ Notes: None.
+
+**/
+
+INT16 LP_Tape_Cat_Engine(
+ LIS_PTR lis_ptr ) /* I - Loop interface structure */
+{
+ BSD_PTR bsd_ptr ;
+ INT16 done = FALSE ;
+ INT16 return_status = SUCCESS ;
+ INT16 status ;
+ DBLK dblk ;
+ TPOS tpos ;
+ FSYS_HAND fsh ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+ msassert( bsd_ptr != NULL ) ;
+ tpos.reference = (UINT32)lis_ptr ;
+
+ /* open file system */
+ if( ( return_status = FS_OpenFileSys( &fsh, GENERIC_DATA,
+ BSD_GetConfigData( bsd_ptr ) ) )
+ == OUT_OF_MEMORY ) {
+
+ MsgError( lis_ptr->pid, bsd_ptr, NULL, &tpos,
+ LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ return( LP_OUT_OF_MEMORY_ERROR ) ;
+ }
+ msassert( return_status == SUCCESS ) ;
+
+ /* indicate the start of the operation */
+ lis_ptr->message_handler( MSG_START_OPERATION, lis_ptr->pid,
+ bsd_ptr, fsh, &tpos ) ;
+
+ /* set up for tape positioning */
+ tpos.tape_id = BSD_GetTapeID( bsd_ptr ) ;
+ tpos.tape_seq_num = BSD_GetTapeNum( bsd_ptr ) ;
+ tpos.backup_set_num = BSD_GetSetNum( bsd_ptr ) ;
+ tpos.tape_loc.pba_vcb = BSD_GetPBA( bsd_ptr );
+
+ /* This is a kludge! Currently, there is only one channel. */
+ tpos.channel = 0 ;
+
+ done = FALSE ;
+ return_status = lis_ptr->message_handler( MSG_START_BACKUP_SET,
+ lis_ptr->pid, bsd_ptr,
+ fsh, &tpos, NULL ) ;
+
+ while( return_status == SUCCESS && !done ) {
+
+ switch( return_status = TF_GetNextSCEntry( fsh, &dblk ) ) {
+
+ case TFLE_NO_ERR :
+ return_status = lis_ptr->message_handler( MSG_LOG_BLOCK,
+ lis_ptr->pid,
+ bsd_ptr, fsh,
+ &tpos, &dblk ) ;
+ break ;
+
+ case TF_NO_MORE_ENTRIES :
+ return_status = SUCCESS ;
+ done = TRUE ;
+ break ;
+
+ default :
+ if( ( return_status = MsgError( lis_ptr->pid, bsd_ptr, fsh,
+ &tpos, return_status, NULL,
+ NULL, 0L ) ) == MSG_ACK ) {
+
+ return_status = SUCCESS ;
+ }
+ }
+
+ if( !done ) {
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ /* falling through (no break) */
+ case ABORT_PROCESSED:
+ MsgError( lis_ptr->pid, bsd_ptr, fsh, &tpos,
+ LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+
+ return_status = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ return_status = USER_ABORT ;
+ break ;
+ }
+ }
+ }
+
+ /* call message handler to log the end of the operation */
+ lis_ptr->message_handler( MSG_END_BACKUP_SET, lis_ptr->pid,
+ bsd_ptr, fsh, &tpos ) ;
+
+ if( ( status = FS_CloseFileSys( fsh ) ) != SUCCESS ) {
+ msassert( status == SUCCESS ) ;
+ }
+
+ /* indicate the end of the operation */
+ lis_ptr->message_handler( MSG_END_OPERATION, lis_ptr->pid,
+ bsd_ptr, NULL, &tpos ) ;
+
+ return( return_status ) ;
+}
+
diff --git a/private/utils/ntbackup/src/lpverify.c b/private/utils/ntbackup/src/lpverify.c
new file mode 100644
index 000000000..40175545d
--- /dev/null
+++ b/private/utils/ntbackup/src/lpverify.c
@@ -0,0 +1,353 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lpverify.c
+
+ Description: This module contains the entry point for the verify engine.
+
+
+ $Log: T:\logfiles\lpverify.c_v $
+
+ Rev 1.13.1.0 07 Feb 1994 02:06:42 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.13 29 Apr 1993 22:26:46 GREGG
+Transfer the Tape Catalog Version in the BSD to the tpos structure.
+
+ Rev 1.12 14 Jan 1993 13:33:10 STEVEN
+added stream_id to error message
+
+ Rev 1.11 10 Nov 1992 17:28:32 STEVEN
+verify buffer off by factor of 1K
+
+ Rev 1.10 28 Oct 1992 15:05:42 STEVEN
+very buffer is buffer size
+
+ Rev 1.9 24 Feb 1992 10:00:52 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.8 04 Feb 1992 21:41:14 GREGG
+Changed parameters in calls to TF_AllocateTapeBuffers and TF_FreeTapeBuffers.
+
+ Rev 1.7 16 Jan 1992 15:52:54 STEVEN
+fix warnings for WIN32
+
+ Rev 1.6 13 Dec 1991 15:26:06 GREGG
+SKATEBOARD - Initial Integration.
+
+ Rev 1.5 06 Nov 1991 19:14:00 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from the BE config.
+
+ Rev 1.4 21 Jun 1991 08:49:28 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:11:24 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 28 May 1991 10:13:48 STEVEN
+use MAYN_MEM instead of MAYN_OS2
+
+ Rev 1.1 24 May 1991 13:18:48 STEVEN
+updates from BSDU redesign
+
+ Rev 1.0 09 May 1991 13:38:00 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+/**/
+/**
+
+ Name: LP_Verify_Engine()
+
+ Description: this routine processes a list of bsds for a verify operation.
+
+ Modified: 5/24/1991 10:33:31
+
+ Returns: SUCCESS or error code from Tape Format or Loop error code
+
+ Notes: na
+
+ See also: $/SEE( LP_Backup_Engine(), LP_Restore_Engine() )$
+ $/SEE( LP_Delete_Engine() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_Verify_Engine(
+LIS_PTR lis_ptr ) /* I - Loop interface structure */
+{
+ BSD_PTR bsd_ptr ;
+ BSD_PTR temp_bsd_ptr;
+ GENERIC_DLE_PTR dle_ptr ;
+ register LP_ENV_PTR lp ;
+ INT16 return_status = SUCCESS ;
+ INT16 status ;
+ UINT16 mem_save ;
+ UINT16 max_buffs ;
+ UINT16 buff_size ;
+ DBLK_PTR dblk_ptr ;
+ BOOLEAN reuse_bsd = FALSE ;
+ BOOLEAN first_time = TRUE ;
+ BE_CFG_PTR cfg ;
+ BOOLEAN tape_opened = FALSE ;
+ INT16 channel_no ;
+ THW_PTR sdrv ;
+
+ bsd_ptr = BSD_GetFirst( lis_ptr->bsd_list ) ;
+
+ msassert( bsd_ptr != NULL ) ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ /* Allocate the loop environment structure */
+ if( ( lp = ( LP_ENV_PTR )calloc( 1, sizeof( LP_ENV ) ) ) == NULL ) {
+
+ /* we cannot use macro because it relies on the lp structure */
+ lis_ptr->message_handler( MSG_TBE_ERROR, lis_ptr->pid, bsd_ptr, NULL, NULL, LP_OUT_OF_MEMORY_ERROR, NULL, NULL ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* Set up the loop environment structure */
+ lp->lis_ptr = lis_ptr ;
+ lp->tpos.reference = ( UINT32 )lis_ptr ;
+
+ /* allocate DBLKs */
+ if( ( dblk_ptr = ( DBLK_PTR )calloc( 3, sizeof( DBLK ) ) ) == NULL ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( lp ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+ else {
+ /* set up the DBLK_PTRs in the Request/Reply structure */
+ lp->rr.vcb_ptr = dblk_ptr ;
+ lp->rr.ddb_ptr = dblk_ptr + 1 ;
+ lp->saved_ddb = dblk_ptr + 1 ;
+ lp->rr.fdb_ptr = dblk_ptr + 2 ; /* ASSUMPTION : */
+ lp->rr.idb_ptr = dblk_ptr + 2 ; /* no FS has both FDB & IDB */
+ }
+
+ /* Set up the loop environment structure */
+ lp->rr.filter_to_use = TF_KEEP_ALL_DATA ;
+ lp->seq_num = 1 ;
+ lp->tpos.tape_id = -1 ;
+ lp->tpos.tape_seq_num = -1 ;
+
+ mem_save = BEC_GetReserveMem( cfg ) ;
+ max_buffs = BEC_GetMaxTapeBuffers( cfg ) ;
+ buff_size = BEC_GetTFLBuffSize( cfg ) ;
+
+ if( ( lp->very_buff = calloc( 1, buff_size * 1024 ) ) == NULL ) {
+
+ /* Free local allocations */
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_OUT_OF_MEMORY_ERROR, NULL, NULL, 0L ) ;
+
+ return LP_OUT_OF_MEMORY_ERROR ;
+
+ }
+
+ /* allocate buffers for operation */
+
+ return_status = TF_AllocateTapeBuffers( mem_save, max_buffs, buff_size ) ;
+
+ if( return_status != SUCCESS ) {
+
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+
+ /* Free local allocations */
+ free( lp->very_buff ) ;
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+
+ }
+
+ /* indicate the start of the operation */
+ LP_MsgStartOP( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* loop for each bsd */
+ do {
+
+ /* First attach to the drive */
+ dle_ptr = BSD_GetDLE( bsd_ptr ) ;
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ /* Now attach to the dle */
+ if( ( return_status = FS_AttachToDLE( &lp->curr_fsys, dle_ptr, cfg, NULL, NULL ) ) == SUCCESS ) {
+
+ /* Set up the loop environment structure */
+ lp->get_spcl = TRUE ;
+ lp->start_new_dir = TRUE ;
+ lp->get_first_file = TRUE ;
+ lp->get_next_first_time = TRUE ;
+ lp->send_saved_block = FALSE ;
+ lp->curr_blk = &lp->dblk1 ;
+ lp->curr_ddb = &lp->dblk2 ;
+ lp->empty_blk = &lp->dblk3 ;
+ lp->blk_is_empty = TRUE ;
+ lp->ffr_inited = FALSE;
+ lp->cat_enabled = (BOOLEAN)(BEC_GetCatalogLevel( cfg ) != CATALOGS_NONE) ;
+ /* Reset the PBA values in case one set is fully catalogged */
+ /* and another is not. */
+ lp->tpos.tape_loc.pba_vcb = 0 ;
+ lp->rr.tape_loc.pba_vcb = 0 ;
+ lp->tpos.tape_loc.lba = 0 ;
+ lp->rr.tape_loc.lba = 0 ;
+
+ lp->tpos.UI_TapePosRoutine = lis_ptr->tape_pos_handler ;
+ lp->curr_dle = dle_ptr ;
+ lp->tpos.tape_cat_ver = BSD_GetTapeCatVer( bsd_ptr ) ;
+
+ sdrv = LP_DetermineStartingTPDrv( lis_ptr->oper_type, bsd_ptr, &lp->tpos, lis_ptr->auto_det_sdrv ) ;
+
+ /* fill in the the set number before calling LP_VerifyDLE */
+
+ if ( reuse_bsd ) {
+ lp->tpos.backup_set_num ++ ;
+ /* In case any FSEs have been tagged as deleted by processing
+ the last set, make sure they are "real" now */
+ BSD_ClearDelete( bsd_ptr ) ;
+ }
+ else {
+
+ /* this is the first time we are looking at this BSD */
+
+ if ( BSD_GetSetNum( bsd_ptr ) < 0 ) {
+
+ /* Set reuse indicator based upon whether another
+ bsd is in the queue */
+ temp_bsd_ptr = BSD_GetNext( bsd_ptr );
+ if ( temp_bsd_ptr != NULL ) {
+ reuse_bsd = FALSE;
+ }
+ else {
+ reuse_bsd = TRUE;
+ }
+
+ if ( BSD_GetSetNum( bsd_ptr ) == -1 ) {
+ /* negative one means the current set and all following sets */
+ if( first_time ) {
+ lp->tpos.backup_set_num = -1;
+ } else {
+ lp->tpos.backup_set_num++ ;
+ }
+ }
+ else {
+
+ /* -2 means set 2 and all the following sets */
+ /* -3 " " 3 " " " " " */
+ /* and so on */
+
+ lp->tpos.backup_set_num = (-BSD_GetSetNum( bsd_ptr ) ) ;
+ }
+ }
+ else {
+ lp->tpos.backup_set_num = BSD_GetSetNum( bsd_ptr ) ;
+ }
+ }
+
+ if( !tape_opened ) {
+ /* open the tape for operation */
+ tape_opened = TRUE ;
+ if( ( return_status = TF_OpenTape( &channel_no, sdrv, &lp->tpos ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+
+ if( return_status == SUCCESS ) {
+
+ /* Perform the operation */
+ return_status = LP_VerifyDLE( bsd_ptr, lp, reuse_bsd, channel_no, sdrv ) ;
+
+ first_time = FALSE ;
+
+ if ( reuse_bsd && ( return_status == TFLE_UI_HAPPY_ABORT ) ) {
+
+ /* we've hit the end of a tape that we were verifying unknown sets from */
+
+ reuse_bsd = FALSE ;
+
+ /* filter out the error */
+ return_status = SUCCESS ;
+ }
+
+ /* The following condition is used to fix the prompt for
+ 2nd tape in a multiple tape restore/verify with
+ restore that tape 1 contains uncataloged backup sets
+ or with the possibility of containing uncataloged
+ backup sets */
+
+ if ( return_status == TFLE_UI_HAPPY_ABORT ) {
+ temp_bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+ if ( temp_bsd_ptr != NULL ) {
+ return_status = SUCCESS ;
+ }
+ }
+
+ FS_DetachDLE( lp->curr_fsys ) ;
+ }
+
+ } else if( return_status != USER_ABORT ) {
+
+ /* error attaching to the drive, print error and give up */
+ LP_MsgError( lis_ptr->pid, bsd_ptr, NULL, &lp->tpos, LP_DRIVE_ATTACH_ERROR, NULL, NULL, 0L ) ;
+
+ /* reset return_status, and try the next bsd */
+ return_status = SUCCESS ;
+ }
+
+ if ( ! reuse_bsd ) {
+ bsd_ptr = BSD_GetNext( bsd_ptr ) ;
+ }
+
+ /* Continue, as long as we did not have an error, and we can get a new bsd */
+ } while( !return_status && (bsd_ptr != NULL ) ) ;
+
+ if( tape_opened ) {
+ TF_CloseTape( channel_no ) ;
+ }
+
+ /* Deinit operation buffers */
+ if( ( status = TF_FreeTapeBuffers( ) ) != SUCCESS ) {
+ LP_MsgError( lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, NULL, &lp->tpos, status, NULL, NULL, 0L ) ;
+ }
+
+ /* indicate the end of the operation */
+ LP_MsgEndOP( lis_ptr->pid, lp->lis_ptr->curr_bsd_ptr, NULL, &lp->tpos ) ;
+
+ /* Free local allocations */
+ free( lp->very_buff ) ;
+ free( dblk_ptr ) ;
+ free( lp ) ;
+
+ return( return_status ) ;
+}
diff --git a/private/utils/ntbackup/src/ltape.bmp b/private/utils/ntbackup/src/ltape.bmp
new file mode 100644
index 000000000..6ce446768
--- /dev/null
+++ b/private/utils/ntbackup/src/ltape.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/lw_data.c b/private/utils/ntbackup/src/lw_data.c
new file mode 100644
index 000000000..bdd8678f2
--- /dev/null
+++ b/private/utils/ntbackup/src/lw_data.c
@@ -0,0 +1,122 @@
+/**/
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lw_data.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains all the layer wide definitions.
+
+
+ $Log: T:\logfiles\lw_data.c_v $
+
+ Rev 1.12 30 Aug 1993 18:47:42 GREGG
+Modified the way we control hardware compression from software to work around
+a bug in Archive DAT DC firmware rev. 3.58 (we shipped a lot of them).
+Files Modified: lw_data.c, lw_data.h, tfstuff.c, mtf10wdb.c, mtf10wt.c and
+ drives.c
+
+ Rev 1.11 22 Jul 1993 12:13:26 ZEIR
+ad'd lw_software_name & _len
+
+ Rev 1.10 11 May 1993 21:55:34 GREGG
+Moved Sytos translator stuff from layer-wide area to translator.
+
+ Rev 1.9 10 May 1993 15:13:28 Terri_Lynn
+Added Steve's changes and My changes for EOM processing
+
+ Rev 1.8 17 Mar 1993 15:08:20 GREGG
+Added global array for Sytos Plus translator and tape drive block mode changes
+
+ Rev 1.7 24 Jul 1992 16:51:40 NED
+Incorporated Skateboard and BigWheel changed into Graceful Red code,
+including MTF4.0 translator support, adding 3.1 file-system structures
+support to the 3.1 translator, additions to GOS to support non-4.0 translators.
+Also did Unicode and 64-bit filesize changes.
+
+ Rev 1.6 05 Apr 1992 19:09:54 GREGG
+ROLLER BLADES - Changed lw_sx_file_path to lw_cat_file_path.
+
+ Rev 1.5 16 Jan 1992 18:40:28 NED
+Skateboard: buffer manager changes
+
+ Rev 1.4 02 Jan 1992 14:56:28 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.3 05 Dec 1991 13:48:52 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.2 17 Oct 1991 01:21:26 GREGG
+BIGWHEEL - 8200sx - Added sx file path pointers.
+
+ Rev 1.1 10 May 1991 16:17:48 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:12:06 GREGG
+Initial revision.
+
+**/
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "stdmath.h"
+
+#include "tfldefs.h"
+#include "drive.h"
+#include "channel.h"
+#include "lw_cntl.h"
+#include "buffman.h"
+#include "dblkmap.h"
+
+
+/* The Channel Array */
+CHANNEL_PTR lw_channels = NULL ;
+
+/* The Drive List */
+DRIVE_PTR lw_drives = NULL ;
+
+/* The Drive linked list */
+Q_HEADER lw_drive_list = { NULL } ;
+
+/* The Main TFL control structure */
+LW_CNTL lw_tfl_control = {
+ FALSE, /* drives_active */
+ FALSE, /* driver_inited */
+ NULL, /* cntl_cards */
+ NULL, /* driver_addr */
+ 0, /* no_channels */
+ 0, /* no_chans_open */
+ 0 /* use_fast_file */
+ } ;
+
+
+/* The current byte format indicator */
+UINT16 lw_byte_fmt = INTEL ;
+
+/* The Buffer Requirements */
+BUF_REQ lw_default_vcb_requirements ; /* for initial reads */
+BUF_REQ lw_default_bm_requirements ; /* for regular reads */
+UINT16 lw_buff_size ; /* from config */
+
+/* The directory where catalog type files should be written */
+CHAR_PTR lw_cat_file_path = NULL ;
+CHAR_PTR lw_cat_file_path_end = NULL ;
+
+/* The name of this software - who's creating sets for MTF */
+CHAR_PTR lw_software_name = NULL ;
+UINT16 lw_software_name_len = 0 ;
+
+/* some global UINT64 constants for our use */
+const UINT64 lw_UINT64_ZERO = { 0, 0 };
+const UINT64 lw_UINT64_MAX = { 0xffffffffUL, 0xffffffffUL };
+
+/* List of valid tape drive physical block sizes. */
+UINT32 lw_blk_size_list[] = { 512UL, 1024UL, 2048UL, 4096UL,
+ 8192UL, 16384UL, 32768UL } ;
+INT lw_num_blk_sizes = sizeof( lw_blk_size_list ) / sizeof( UINT32 ) ;
+
+/* TRUE if we want the next set to be backed up with hardware compression */
+BOOLEAN lw_hw_comp = FALSE ;
+
diff --git a/private/utils/ntbackup/src/lwtfinf.c b/private/utils/ntbackup/src/lwtfinf.c
new file mode 100644
index 000000000..de2f136da
--- /dev/null
+++ b/private/utils/ntbackup/src/lwtfinf.c
@@ -0,0 +1,147 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: lwtfinf.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the layer tape of supported formats.
+
+
+ $Log: Q:/LOGFILES/LWTFINF.C_V $
+
+ Rev 1.16 21 Jul 1993 18:25:10 ZEIR
+Reintroduced (from Cougar/Skateboard) TAPES_FIRST_TO_LAST for relevant translators
+
+ Rev 1.15 05 Apr 1993 14:58:04 TERRI
+Added resource defintion for Sypl 10
+
+ Rev 1.14 17 Mar 1993 15:17:16 TERRI
+Added changes for the Sytos Plus translator
+
+ Rev 1.13 12 Mar 1993 17:34:38 GREGG
+Removed POS_INF_AVAIL attribute from 3.1 translator.
+
+ Rev 1.12 18 Feb 1993 00:13:54 GREGG
+Removed attribute bits which are no longer valid.
+
+ Rev 1.11 22 Jan 1993 13:51:48 unknown
+Removed the Tape Format name from the structure. Instead of embedding
+this info in the structure, the format_id field has become an index
+into a resource session. The UI gets the tape format name from the
+resources based on the format_id. Note that the format_id of the
+first tape format is required to be zero because the Backup engine
+always writes tape format zero.
+
+ Rev 1.10 11 Nov 1992 10:55:10 GREGG
+Unicodeized literals.
+
+ Rev 1.9 17 Aug 1992 08:33:52 GREGG
+Added min_size_for_dblk field.
+
+ Rev 1.8 29 May 1992 15:13:36 GREGG
+Added CAN_READ_FROM_VCB_BUFF attr bit to appropriate translators.
+
+ Rev 1.7 25 Mar 1992 19:00:50 GREGG
+ROLLER BLADES - Added 4.0 format.
+
+ Rev 1.6 07 Jan 1992 14:11:06 ZEIR
+Added UTF entry
+
+ Rev 1.5 05 Dec 1991 14:46:38 LORIB
+Changed format name from "SY-TOS Format 3.11" to "Non-Maynard Format".
+
+ Rev 1.4 22 Jul 1991 12:44:00 GREGG
+Set 3.1 format attribute bit to indicate we must write a continuation tape
+if EOS coincides with EOM.
+
+ Rev 1.3 06 Jun 1991 23:48:42 NED
+Added compiler directives to allow selective inclusion of translators.
+
+ Rev 1.2 21 May 1991 17:05:46 NED
+added max_password_size field.
+
+ Rev 1.1 10 May 1991 11:54:28 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:18:22 GREGG
+Initial revision.
+
+**/
+/* Note that to change the list of supported formats, you must also
+ * edit the file "fmttab.c"
+ */
+/* begin include list */
+
+#include "stdtypes.h"
+#include "fmtinf.h"
+#include "eng_fmt.h"
+
+/* $end$ include list */
+
+
+TFINF lw_fmtdescr[] = {
+
+#ifdef MY40_TRANS
+ {
+ ( RD_FORMAT_BIT | WT_FORMAT_BIT | POS_INF_AVAIL |
+ APPEND_SUPPORTED | MUST_WRITE_CONT | CAN_READ_FROM_VCB_BUFF ),
+ 9, RES_MY40_TRANS, 1024
+ },
+#endif
+
+#ifdef MY31_TRANS
+ {
+ ( RD_FORMAT_BIT | CAN_READ_FROM_VCB_BUFF ),
+ 9, RES_MY31_TRANS, 512
+ },
+#endif
+
+#ifdef MY30_TRANS
+ {
+ ( RD_FORMAT_BIT | CAN_READ_FROM_VCB_BUFF ),
+ 9, RES_MY30_TRANS, 512
+ },
+#endif
+
+#ifdef MY25_TRANS
+ {
+ ( RD_FORMAT_BIT | CAN_READ_FROM_VCB_BUFF ),
+ 9, RES_MY25_TRANS, 512
+ },
+#endif
+
+#ifdef QS19_TRANS
+ {
+ ( RD_FORMAT_BIT | CAN_READ_FROM_VCB_BUFF | TAPES_FIRST_TO_LAST ),
+ 9, RES_QS19_TRANS, 512
+ },
+#endif
+
+#ifdef SY31_TRANS
+ {
+ ( RD_FORMAT_BIT | CAN_READ_FROM_VCB_BUFF | TAPES_FIRST_TO_LAST ),
+ 20, RES_SY31_TRANS, 512
+ },
+#endif
+
+#ifdef SYPL10_TRANS
+ {
+ ( RD_FORMAT_BIT | CAN_READ_FROM_VCB_BUFF | TAPES_FIRST_TO_LAST ),
+ 20, RES_SYPL10_TRANS, 1024
+ },
+#endif
+
+#ifdef UTF_TRANS
+ {
+ ( RD_FORMAT_BIT | TAPES_FIRST_TO_LAST ),
+ 11, RES_UTF_TRANS, 512
+ }
+#endif
+
+
+
+} ;
+
+UINT16 lw_num_supported_fmts = sizeof( lw_fmtdescr ) / sizeof( lw_fmtdescr[0] ) ;
diff --git a/private/utils/ntbackup/src/mach_nt.c b/private/utils/ntbackup/src/mach_nt.c
new file mode 100644
index 000000000..4924a2f25
--- /dev/null
+++ b/private/utils/ntbackup/src/mach_nt.c
@@ -0,0 +1,38 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: mach_nt.c
+
+ Description: Function to determine if machine type is PS/2
+ It now always returns UNKNOWN_MACHINE.
+
+
+ $Log: P:/LOGFILES/MACH_NT.C_V $
+
+ Rev 1.0 17 Jan 1992 17:25:30 STEVEN
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+#include "machine.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: GetMachineType
+
+ Description: For NT this function always return UNKNOWN_MACHINE.
+
+ Modified: 1/17/1992 15:53:9
+
+ Returns: machine type
+
+**/
+INT16 GetMachineType( VOID )
+{
+ return UNKNOWN_MACHINE ;
+}
+
diff --git a/private/utils/ntbackup/src/makecfdb.c b/private/utils/ntbackup/src/makecfdb.c
new file mode 100644
index 000000000..83b196a65
--- /dev/null
+++ b/private/utils/ntbackup/src/makecfdb.c
@@ -0,0 +1,88 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: makecfdb.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains all code relevant to CFDBs
+
+
+ $Log: Q:/LOGFILES/MAKECFDB.C_V $
+
+ Rev 1.3 18 Jun 1993 10:09:48 MIKEP
+enable c++
+
+ Rev 1.2 25 Apr 1993 20:13:46 GREGG
+Fifth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Store the corrupt stream number in the CFIL tape struct and the CFDB.
+
+Matches: MTF10WDB.C 1.9, FSYS.H 1.33, FSYS_STR.H 1.47, MAKECFDB.C 1.2,
+ BACK_OBJ.C 1.36, MAYN40RD.C 1.58
+
+ Rev 1.1 05 Aug 1992 10:55:06 DON
+removed warning's
+
+ Rev 1.0 09 May 1991 13:33:56 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+
+#include "tfldefs.h"
+#include "fsys.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: FS_CreateGenCFDB()
+
+ Description: This functioncreates a CFDB
+
+ Modified: 9/12/1989
+
+ Returns: TF_SKIP_ALL_DATA ;
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_CreateGenCFDB(
+FSYS_HAND fsh ,
+GEN_CFDB_DATA_PTR data )
+{
+ (void)fsh ;
+
+ data->std_data.dblk->blk_type = CFDB_ID ;
+ data->std_data.dblk->com.blkid = data->std_data.blkid;
+ data->std_data.dblk->com.f_d.did = data->std_data.did ;
+ data->std_data.dblk->com.ba.lba = data->std_data.lba ;
+ data->std_data.dblk->com.continue_obj = FALSE;
+ data->std_data.dblk->com.stream_ptr = NULL;
+ data->std_data.dblk->com.stream_offset = 0;
+ data->std_data.dblk->com.tape_seq_num = 0; // ???
+ data->std_data.dblk->com.string_type = 0; // ??
+ data->std_data.dblk->com.os_id = 0;
+ data->std_data.dblk->com.os_ver = 0;
+
+
+ ((CFDB_PTR)data->std_data.dblk)->corrupt_offset = data->corrupt_offset ;
+ ((CFDB_PTR)data->std_data.dblk)->stream_number = data->stream_number ;
+ ((CFDB_PTR)data->std_data.dblk)->attributes = data->std_data.attrib ;
+
+ return TF_SKIP_ALL_DATA;
+}
+
+
+
+
+
diff --git a/private/utils/ntbackup/src/makefile b/private/utils/ntbackup/src/makefile
new file mode 100644
index 000000000..6ee4f43fa
--- /dev/null
+++ b/private/utils/ntbackup/src/makefile
@@ -0,0 +1,6 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
+# file to this component. This file merely indirects to the real make file
+# that is shared by all the components of NT OS/2
+#
+!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/private/utils/ntbackup/src/makefile.inc b/private/utils/ntbackup/src/makefile.inc
new file mode 100644
index 000000000..effef6444
--- /dev/null
+++ b/private/utils/ntbackup/src/makefile.inc
@@ -0,0 +1,2 @@
+bkuevent.h bkuevent.rc msg00001.bin: bkuevent.mc
+ mc -v bkuevent.mc
diff --git a/private/utils/ntbackup/src/makeudb.c b/private/utils/ntbackup/src/makeudb.c
new file mode 100644
index 000000000..9c2c281da
--- /dev/null
+++ b/private/utils/ntbackup/src/makeudb.c
@@ -0,0 +1,66 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: makeudb.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains all the code to support a UDB
+
+
+ $Log: S:/LOGFILES/MAKEUDB.C_V $
+
+ Rev 1.1 24 Jul 1991 11:00:58 DAVIDH
+Corrected Watcom compiler warnings.
+
+ Rev 1.0 09 May 1991 13:33:48 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+
+#include "tfldefs.h"
+#include "fsys.h"
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: FS_CreateGenUDB()
+
+ Description: This function creates a UDB
+
+ Modified: 9/13/1989
+
+ Returns: TF_SKIP_ALL_DATA
+
+ Notes:
+
+ See also: $/SEE( FS_CreateGenVCB() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_CreateGenUDB( fsh, data )
+FSYS_HAND fsh;
+GEN_UDB_DATA_PTR data ;
+{
+
+ (VOID) fsh ;
+
+ data->std_data.dblk->blk_type = UDB_ID ;
+ data->std_data.dblk->com.blkid = data->std_data.blkid;
+ data->std_data.dblk->com.f_d.did = data->std_data.did ;
+ data->std_data.dblk->com.ba.lba = data->std_data.lba ;
+
+
+ return TF_SKIP_ALL_DATA;
+}
+
+
+
+
diff --git a/private/utils/ntbackup/src/makevcb.c b/private/utils/ntbackup/src/makevcb.c
new file mode 100644
index 000000000..5e2111aed
--- /dev/null
+++ b/private/utils/ntbackup/src/makevcb.c
@@ -0,0 +1,428 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: makevcb.c
+
+ Description: This file contains all the code necessary to support the VCBs
+
+
+ $Log: N:/LOGFILES/MAKEVCB.C_V $
+
+ Rev 1.18.1.3 24 Mar 1994 21:58:48 STEVEN
+alignment fault if password was odd size
+
+ Rev 1.18.1.2 19 Jan 1994 12:52:30 BARRY
+Supress warnings
+
+ Rev 1.18.1.1 15 Oct 1993 10:35:30 GREGG
+Set string type in dblk and make sure dev_name_leng is 0 if not NLM.
+
+ Rev 1.18.1.0 21 Sep 1993 14:16:18 BARRY
+Unicode fixes
+
+ Rev 1.18 15 Jul 1993 19:23:32 GREGG
+Added setting compressed_obj and vendor_id; Removed setting compression_alg.
+
+ Rev 1.17 18 Jun 1993 10:13:14 MIKEP
+enable c++
+
+ Rev 1.16 03 Jun 1993 15:59:52 DON
+Changed the OTHER msassert( fsh->attached_dle != NULL ) to an if, since
+we may not have a volume name in create-vcb data and may not be attached
+to a DLE (retension tape, catalog tape, etc...).
+
+ Rev 1.15 19 Apr 1993 18:00:50 GREGG
+Second in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ Changes to write version 2 of OTC, and to read both versions.
+
+Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ mayn40.h 1.32, mtf.h 1.3.
+
+NOTE: There are additional changes to the catalogs needed to save the OTC
+ version and put it in the tpos structure before loading the OTC
+ File/Directory Detail. These changes are NOT listed above!
+
+ Rev 1.14 24 Mar 1993 10:24:28 unknown
+ChuckS: Changed msassert( fsh->attached_dle != NULL ) to an if, since
+we may not have a device name in create-vcb data and may not be attached
+to a DLE (read tape, verify tape, etc).
+
+ Rev 1.13 18 Mar 1993 15:17:44 ChuckS
+OS_NLM (for now): Add code to put DeviceName into VCB
+
+ Rev 1.12 04 Feb 1993 14:55:36 TIMN
+Added Unicode header to resolve link errors
+
+ Rev 1.11 26 Oct 1992 18:10:06 STEVEN
+added continue bit
+
+ Rev 1.10 21 Oct 1992 10:39:46 GREGG
+Changed 'set_catalog_level' to 'on_tape_cat_level'.
+
+ Rev 1.9 20 Oct 1992 15:51:22 STEVEN
+added support for otc / catalog interface through DBLK
+
+ Rev 1.8 14 Oct 1992 14:20:42 STEVEN
+fix typos
+
+ Rev 1.7 14 Oct 1992 11:56:22 STEVEN
+add translations for unicode strings
+
+ Rev 1.6 05 Oct 1992 17:05:56 DAVEV
+Unicode strlen verification
+
+ Rev 1.5 18 Aug 1992 10:25:12 STEVEN
+fix warnings
+
+ Rev 1.4 13 Jan 1992 18:46:02 STEVEN
+changes for WIN32 compile
+
+ Rev 1.3 07 Jan 1992 11:59:32 STEVEN
+move common functions to tables
+
+ Rev 1.2 06 Aug 1991 18:29:48 DON
+added NLM File System support
+
+ Rev 1.1 03 Jun 1991 13:26:56 BARRY
+Remove product defines from conditional compilation.
+
+ Rev 1.0 09 May 1991 13:33:46 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+
+#include "msassert.h"
+#include "fsys.h"
+#include "tfldefs.h"
+/* $end$ include list */
+
+static INT16 SetStringInVCB(
+ INT8_PTR target,
+ INT16_PTR target_length_ptr,
+ VOID_PTR source,
+ INT16 source_length,
+ BOOLEAN in_str_asci,
+ BOOLEAN out_str_asci ) ;
+
+/**/
+/**
+
+ Name: FS_CreateGenVCB( )
+
+ Description: This function creates a VCB given the data provided
+
+ Modified: 6/22/1990
+
+ Returns: TF_SKIP_ALL_DATA
+
+ Notes: If the volume name in the request structure is blank
+ then it is filled out.
+
+ The drive leter has been added to the volume name for
+ Novell network drives. This was done for MBS. If This
+ causes a problem contact the MBS group before you change
+ it back.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_CreateGenVCB(
+FSYS_HAND fsh ,
+GEN_VCB_DATA_PTR data )
+{
+ VCB_PTR vcb ;
+ INT8_PTR vcb_str ;
+ BOOLEAN in_str_asci ;
+ BOOLEAN out_str_asci ;
+
+ if ( data->std_data.string_type != FS_GetStringTypes( fsh ) ) {
+ if ( data->std_data.string_type == BEC_ANSI_STR ) {
+ in_str_asci = TRUE;
+ out_str_asci = FALSE;
+ } else {
+ in_str_asci = FALSE;
+ out_str_asci = TRUE;
+ }
+ } else {
+ if ( data->std_data.string_type == BEC_ANSI_STR ) {
+ in_str_asci = TRUE;
+ out_str_asci = TRUE;
+ } else {
+ in_str_asci = FALSE;
+ out_str_asci = FALSE;
+ }
+ }
+
+
+ data->std_data.dblk->blk_type = VCB_ID ;
+ data->std_data.dblk->com.blkid = data->std_data.blkid ;
+ data->std_data.dblk->com.f_d.f_mark = data->f_mark ;
+ data->std_data.dblk->com.ba.pba = data->pba ;
+ data->std_data.dblk->com.ba.lba = data->std_data.lba ;
+ data->std_data.dblk->com.os_id = data->std_data.os_id ;
+ data->std_data.dblk->com.continue_obj = data->std_data.continue_obj ;
+ data->std_data.dblk->com.os_ver = data->std_data.os_ver ;
+ data->std_data.dblk->com.tape_seq_num = data->std_data.tape_seq_num ;
+ data->std_data.dblk->com.compressed_obj = data->std_data.compressed_obj ;
+ data->std_data.dblk->com.string_type = data->std_data.string_type ;
+
+ vcb = ( VCB_PTR )data->std_data.dblk ;
+ vcb_str = ( BYTE_PTR )vcb ;
+
+
+ vcb->vcb_attributes = data->std_data.attrib ;
+ vcb->tape_id = data->tape_id ;
+ vcb->tape_seq_num = data->tape_seq_num ;
+ vcb->backup_set_num = data->bset_num ;
+ vcb->size = 0 ;
+ vcb->tf_major_ver = data->tf_major_ver ;
+ vcb->tf_minor_ver = data->tf_minor_ver ;
+ vcb->sw_major_ver = data->sw_major_ver ;
+ vcb->sw_minor_ver = data->sw_minor_ver ;
+ vcb->os_id = data->std_data.os_id ;
+ vcb->os_ver = data->std_data.os_ver ;
+ vcb->backup_date = *( data->date ) ;
+ vcb->password_encrypt_alg = data->password_encrypt_alg ;
+ vcb->data_encrypt_alg = data->data_encrypt_alg ;
+ vcb->set_cat_pba = data->set_cat_pba ;
+ vcb->set_cat_tape_seq_num = data->set_cat_tape_seq_num ;
+ vcb->on_tape_cat_level = data->on_tape_cat_level ;
+ vcb->set_cat_info_valid = data->set_cat_info_valid ;
+ vcb->on_tape_cat_ver = data->on_tape_cat_ver ;
+ vcb->vendor_id = data->vendor_id ;
+
+ if ( vcb->set_cat_info_valid ) {
+ vcb->set_cat_num_dirs = data->set_cat_num_dirs ;
+ vcb->set_cat_num_files = data->set_cat_num_files ;
+ vcb->set_cat_num_corrupt = data->set_cat_num_corrupt ;
+ }
+
+ /* tape name */
+ vcb->tape_name = sizeof( *vcb ) ;
+ SetStringInVCB( &vcb_str[ vcb->tape_name ],
+ &vcb->tape_name_leng,
+ data->tape_name,
+ data->tape_name_size,
+ in_str_asci,
+ out_str_asci ) ;
+
+ /* backup set name */
+ vcb->backup_set_name = (INT16)(vcb->tape_name + vcb->tape_name_leng ) ;
+ SetStringInVCB( &vcb_str[ vcb->backup_set_name ],
+ &vcb->backup_set_name_leng,
+ data->bset_name,
+ data->bset_name_size,
+ in_str_asci,
+ out_str_asci ) ;
+
+ /* backup set description */
+ vcb->backup_set_descript = (INT16)(vcb->backup_set_name + vcb->backup_set_name_leng ) ;
+ SetStringInVCB( &vcb_str[ vcb->backup_set_descript ],
+ &vcb->backup_set_descript_leng,
+ data->bset_descript,
+ data->bset_descript_size,
+ in_str_asci,
+ out_str_asci ) ;
+
+ /* user name */
+ vcb->user_name = (INT16)(vcb->backup_set_descript + vcb->backup_set_descript_leng ) ;
+ SetStringInVCB( &vcb_str[ vcb->user_name ],
+ &vcb->user_name_leng,
+ data->user_name,
+ data->user_name_size,
+ in_str_asci,
+ out_str_asci ) ;
+
+ /* tape password */
+ vcb->tape_password = (INT16)(vcb->user_name + vcb->user_name_leng ) ;
+ vcb->tape_password_leng = data->tape_password_size ;
+ memcpy( &vcb_str[ vcb->tape_password ],
+ data->tape_password,
+ data->tape_password_size ) ;
+
+ /* backup set password */
+ vcb->backup_set_password = (INT16)(vcb->tape_password + vcb->tape_password_leng ) ;
+ vcb->backup_set_password_leng = data->bset_password_size ;
+ memcpy( &vcb_str[ vcb->backup_set_password ], data->bset_password, data->bset_password_size ) ;
+
+ /* machine name */
+ vcb->machine_name = (INT16)(vcb->backup_set_password + vcb->backup_set_password_leng ) ;
+ vcb->machine_name += (vcb->machine_name & 1 ) ; // align the strings.
+ if( SetStringInVCB( &vcb_str[ vcb->machine_name ],
+ &vcb->machine_name_leng,
+ data->machine_name,
+ data->machine_name_size,
+ in_str_asci,
+ out_str_asci ) == 0 ) {
+
+
+ SetStringInVCB( &vcb_str[ vcb->machine_name ],
+ &vcb->machine_name_leng,
+ "IBM PC or compatible",
+ 21, // size in bytes of above string
+ TRUE,
+ out_str_asci ) ;
+
+ }
+
+ /* short machine name */
+ vcb->short_machine_name = (INT16)(vcb->machine_name + vcb->machine_name_leng ) ;
+ if( SetStringInVCB( &vcb_str[ vcb->short_machine_name ],
+ &vcb->short_machine_name_leng,
+ data->short_m_name,
+ data->short_m_name_size,
+ in_str_asci,
+ out_str_asci ) == 0 ) {
+
+
+ SetStringInVCB( &vcb_str[ vcb->short_machine_name ],
+ &vcb->short_machine_name_leng,
+ "IBM",
+ 4, // size in bytes of above string
+ TRUE,
+ out_str_asci ) ;
+ }
+
+ /* volume name */
+ vcb->vol_name = (INT16)(vcb->short_machine_name + vcb->short_machine_name_leng );
+ if( SetStringInVCB( &vcb_str[ vcb->vol_name ],
+ &vcb->vol_name_leng,
+ data->volume_name,
+ data->volume_name_size,
+ in_str_asci,
+ out_str_asci ) == 0 ) {
+
+ if ( fsh->attached_dle != NULL ) {
+ DLE_GetVolName( fsh->attached_dle, (CHAR_PTR)&vcb_str[ vcb->vol_name ] ) ;
+ vcb->vol_name_leng = DLE_SizeofVolName( fsh->attached_dle ) ;
+ }
+ }
+
+#if defined( OS_NLM )
+ /* device name */
+ vcb->dev_name = (INT16)( vcb->vol_name + vcb->vol_name_leng ) ;
+
+ if ( SetStringInVCB( &vcb_str[ vcb->dev_name ],
+ &vcb->dev_name_leng,
+ data->device_name,
+ data->dev_name_size,
+ in_str_asci,
+ out_str_asci ) == 0 ) {
+
+ if ( fsh->attached_dle != NULL ) {
+ DLE_DeviceName( fsh->attached_dle, &vcb_str[ vcb->dev_name ], DLE_SizeofDevName( fsh->attached_dle ) ) ;
+ vcb->dev_name_leng = DLE_SizeofDevName( fsh->attached_dle ) ;
+ }
+ }
+#else
+ vcb->dev_name = 0 ;
+ vcb->dev_name_leng = 0 ;
+#endif
+
+ return TF_SKIP_ALL_DATA ;
+}
+
+
+/**/
+/**
+
+ Name: SetStringInVCB
+
+ Description: Transfers string information from a source to a target ( in a VCB ).
+ If the target is not NUL terminated then the length ( in the VCB )
+ is incremented.
+
+ Modified: 4/23/1990
+
+ Returns: The actual length of the string as indicated in the VCB
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 SetStringInVCB(
+INT8_PTR target,
+INT16_PTR target_length_ptr, // length in bytes incl NULL terminator
+VOID_PTR source,
+INT16 source_length, // length in bytes incl NULL terminator
+BOOLEAN in_str_asci,
+BOOLEAN out_str_asci )
+{
+ int target_size ;
+
+ target[ 0 ] = '\0' ;
+ target_size = *target_length_ptr = source_length ;
+
+ if( source_length == 0 ) { // simply return if nothing to do
+ return( 0 ) ;
+ }
+
+ if ( in_str_asci && !out_str_asci ) { // asci to unicode
+
+ WCHAR UNALIGNED * temp_ptr ;
+
+ target_size = *target_length_ptr = source_length * sizeof(WCHAR) ;
+
+ mapAnsiToUnic( (ACHAR_PTR)source, (WCHAR_PTR)target, &target_size ) ;
+
+ temp_ptr = (WCHAR UNALIGNED *)(&target[*target_length_ptr]) ;
+ if ( *(temp_ptr -1) != 0 ) {
+ *temp_ptr = 0 ;
+ ( *target_length_ptr ) +=sizeof(WCHAR) ;
+ }
+
+ } else if ( !in_str_asci && out_str_asci) { // unicode to ascii
+
+ target_size = *target_length_ptr = source_length / sizeof(WCHAR) ;
+
+ mapUnicToAnsi( (WCHAR_PTR)source, (ACHAR_PTR)target, (ACHAR)('_'), &target_size ) ;
+
+ if( target[ *target_length_ptr - 1 ] != 0 ) {
+ target[ *target_length_ptr ] = 0 ;
+ ( *target_length_ptr ) ++ ;
+ }
+
+
+ } else if ( !in_str_asci && !out_str_asci) { // unicode to unicode
+
+ WCHAR UNALIGNED *temp_ptr ;
+
+ memcpy( target, source, source_length ) ;
+
+ temp_ptr = (WCHAR UNALIGNED *)(&target[source_length]) ;
+ if ( *(temp_ptr -1) != 0 ) {
+ *temp_ptr = 0 ;
+ ( *target_length_ptr ) += sizeof(WCHAR) ;
+ }
+
+ } else { // ascii to asci
+
+ memcpy( target, source, source_length ) ;
+
+ if( target[ source_length - 1 ] != 0 ) {
+ target[ source_length ] = 0 ;
+ ( *target_length_ptr ) ++ ;
+ }
+ }
+
+ return( *target_length_ptr ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/mayn31rd.c b/private/utils/ntbackup/src/mayn31rd.c
new file mode 100644
index 000000000..1e868b246
--- /dev/null
+++ b/private/utils/ntbackup/src/mayn31rd.c
@@ -0,0 +1,1724 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: mayn31rd.c
+
+ Date Updated: $./FDT$ $./FTM$
+ 9/25/1989 15:9:9
+
+ Description: Contains the code for Maynard Format 3.1
+
+
+ $Log: T:/LOGFILES/MAYN31RD.C_V $
+
+ Rev 1.49.1.4 12 Jan 1995 16:47:44 GREGG
+Added code to deal with continuation bits wrongly set in DDBs.
+
+ Rev 1.49.1.3 05 Jan 1995 16:57:24 GREGG
+Several fixes to translation of OS info and generation of alt data streams.
+
+ Rev 1.49.1.2 11 Feb 1994 16:38:56 GREGG
+Clear the MOS bit in MoveToVCB. EPR 948-0244
+
+ Rev 1.49.1.1 24 Jan 1994 15:59:12 GREGG
+Fixed warnings.
+
+ Rev 1.49.1.0 17 Jan 1994 13:35:44 GREGG
+Unicode fixes.
+
+ Rev 1.49 29 Sep 1993 14:35:54 GREGG
+Fixed bug in generation of stream info in F40_RdFDB.
+
+ Rev 1.48 21 Aug 1993 03:56:10 GREGG
+Return TAPE_INCONSISTENCY instead of BAD_TAPE in F31_MoveToVCB if
+TF_NO_MORE_DATA is returned from MoveFileMarks.
+
+ Rev 1.47 15 Jul 1993 19:32:18 GREGG
+Set compressed_obj, vendor_id, and compressed, encrypted and future_rev
+bits in appropriate dblks.
+
+ Rev 1.46 30 Jun 1993 09:01:40 GREGG
+Fixed setting of continue_obj, and set cross_set and cross_lba in channel.
+
+ Rev 1.45 25 Jun 1993 20:45:34 GREGG
+We were screwing up the stream info reading the continuation VCB.
+
+ Rev 1.44 26 Apr 1993 02:43:46 GREGG
+Sixth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Redefined attribute bits to match the spec.
+ - Eliminated unused/undocumented bits.
+ - Added code to translate bits on tapes that were written wrong.
+
+Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+
+ Rev 1.43 30 Jan 1993 11:43:46 DON
+Removed compiler warnings
+
+ Rev 1.42 28 Jan 1993 12:28:50 GREGG
+Fixed warnings.
+
+ Rev 1.41 20 Jan 1993 14:50:12 BobR
+Added MOVE_ESA macro call(s)
+
+ Rev 1.40 20 Jan 1993 14:08:14 GREGG
+Fixed processing of continuation DBLKS (all remaining data labeled as pad stream).
+
+ Rev 1.39 13 Jan 1993 21:01:08 GREGG
+Fixed setting of pointer to OS info.
+
+ Rev 1.38 12 Jan 1993 11:10:58 GREGG
+Fixed problem with not recognizing we had repositioned and needed a new DBLK.
+
+ Rev 1.37 06 Jan 1993 17:20:22 GREGG
+Added pad stream to skip the pad data.
+
+ Rev 1.36 18 Dec 1992 08:46:16 HUNTER
+Fixes for "streamizing"
+
+ Rev 1.35 18 Nov 1992 10:41:14 HUNTER
+Bug fixes
+
+ Rev 1.34 11 Nov 1992 14:17:34 GREGG
+Moved F31_CalculatePad from Write.
+
+ Rev 1.33 11 Nov 1992 09:47:38 HUNTER
+Added support for the New Stream methods. Deleted both the VARIABLE block
+code, and SUPPORT FOR IMAGE DBs.
+
+ Rev 1.32 12 Aug 1992 13:04:56 BARRY
+Removed translation of Turtle tapes to GOS (old SMS).
+
+ Rev 1.31 24 Jul 1992 16:49:40 NED
+Incorporated Skateboard and BigWheel changed into Graceful Red code,
+including MTF4.0 translator support, adding 3.1 file-system structures
+support to the 3.1 translator, additions to GOS to support non-4.0 translators.
+Also did Unicode and 64-bit filesize changes.
+
+ Rev 1.30 20 May 1992 18:35:08 STEVEN
+Changes for 64 bit file system.
+
+ Rev 1.29 25 Mar 1992 20:11:54 GREGG
+ROLLER BLADES - 64 bit support.
+
+ Rev 1.28 20 Mar 1992 17:58:00 NED
+added exception updating after TpReceive calls
+
+ Rev 1.27 12 Mar 1992 17:05:26 NED
+Added changes for EOS at EOM bug not requesting second tape
+when cataloging.
+
+ Rev 1.26 19 Feb 1992 17:26:22 GREGG
+In exception handler, if we can't get a regular buffer, use the VCB buffer.
+
+ Rev 1.25 03 Feb 1992 11:35:10 NED
+re-enabled MakeIDB for non-DOS
+
+ Rev 1.24 23 Jan 1992 23:28:06 GREGG
+Kludge for Wangtech bug. (again???)
+
+ Rev 1.23 05 Dec 1991 14:02:58 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.22 13 Nov 1991 06:55:30 GREGG
+Changed assert calls to msassert.
+
+ Rev 1.21 07 Nov 1991 15:20:52 unknown
+VBLK - Added support for Maynard 3.1 Rd
+
+ Rev 1.20 29 Oct 1991 10:49:36 GREGG
+Set EOS position bit if EOS detected by exception handler call in move_to_vcb.
+
+ Rev 1.19 15 Oct 1991 07:42:56 GREGG
+Added ThreadSwitch call in empty TpReceive loops.
+
+ Rev 1.18 07 Oct 1991 22:27:52 GREGG
+Update lba stuff in continuation read.
+
+ Rev 1.17 16 Sep 1991 20:24:10 GREGG
+Changed Initializer to return a TFLE_xxx.
+
+ Rev 1.16 27 Aug 1991 14:39:50 GREGG
+Fixed bug in MoveToVCB (Move FMKS as else to rewind_first).
+
+ Rev 1.15 22 Aug 1991 16:28:58 NED
+Changed all references to internals of the buffer structure to macros.
+
+ Rev 1.14 16 Aug 1991 09:09:00 GREGG
+Added handling of BSDBs with associated data.
+
+ Rev 1.13 14 Aug 1991 12:07:48 GREGG
+Fixed bug in EOM handling in MoveToVCB.
+
+ Rev 1.12 30 Jul 1991 15:33:14 GREGG
+Included 'dddefs.h'.
+
+ Rev 1.11 22 Jul 1991 12:55:40 GREGG
+Modified the move to VCB routine to handle EOS encountered at EOM.
+
+ Rev 1.10 09 Jul 1991 15:56:50 NED
+Don't translate return from MoveFileMarks forward.
+
+ Rev 1.9 24 Jun 1991 19:41:36 NED
+If buffer has EOS or EOM exception, set filemark count one higher than listed
+in current DBLK (in SetStandFields). Added buffer parameter to SetStandFields
+to eliminate references to channel->cur_buff.
+
+ Rev 1.8 17 Jun 1991 18:12:00 GREGG
+Added logic to set the REW_CLOSE position bit only under specific conditions.
+
+ Rev 1.7 12 Jun 1991 15:35:46 GREGG
+Changes to positioning logic in MoveToVCB.
+
+ Rev 1.6 07 Jun 1991 01:24:16 GREGG
+Changed error check to msassert in MoveToVCB.
+
+ Rev 1.5 06 Jun 1991 23:24:02 GREGG
+New parameters for F31_DeInitialize. Set filemark pos from blocks when tape
+blocks at translation time. Check for EOM exception after read in
+F31_RdException. Changes to MoveToVCB due to Teac problems and appends to
+2.5 tapes. Removed product specific compiler directive.
+
+ Rev 1.4 23 May 1991 16:07:18 GREGG
+Handle EOM like FMK in exception handler.
+
+ Rev 1.3 20 May 1991 15:37:38 DAVIDH
+Cleared up Watcom warnings for "defined, but not referenced" parameters.
+
+ Rev 1.2 14 May 1991 11:22:54 GREGG
+Changed order of includes.
+
+ Rev 1.1 10 May 1991 11:56:02 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:18:44 GREGG
+Initial revision.
+
+**/
+
+#include <string.h>
+#include <malloc.h>
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdmacro.h"
+#include "tbe_defs.h"
+#include "datetime.h"
+#include "drive.h"
+#include "channel.h"
+#include "fmteng.h"
+#include "mayn31.h"
+#include "f31proto.h"
+#include "transutl.h"
+#include "fsys.h"
+#include "tloc.h"
+#include "lw_data.h"
+#include "lwprotos.h"
+#include "tfldefs.h"
+#include "translat.h"
+#include "tfl_err.h"
+
+/* Device Driver Interface Headers */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genstat.h"
+#include "genfuncs.h"
+#include "dddefs.h"
+#include "dil.h"
+
+/* Internal Function Prototypes */
+
+static VOID _near SetStandFields( CHANNEL_PTR, STD_DBLK_DATA_PTR, DB_HDR_PTR, BUF_PTR ) ;
+
+/* Static data */
+
+static UINT16 blkhdr_layout[] = {
+ /* Conversion type Number of items to convert */
+ SIZE_WORD + 2,
+ SIZE_DWORD + 1,
+ SIZE_WORD + 4,
+ SIZE_DWORD + 4,
+ NO_MORE_CNV
+} ;
+
+static UINT16 vcb_layout[] = {
+ /* Conversion type Number of items to convert */
+ SIZE_DWORD + 1,
+ SIZE_DATE_TIME + 1,
+ SIZE_WORD + 4,
+ SIZE_DWORD + 1,
+ SIZE_WORD + 23,
+ NO_MORE_CNV
+} ;
+
+static UINT16 ddb_layout[] = {
+ /* Conversion type Number of items to convert */
+ SIZE_DWORD + 1,
+ SIZE_DATE_TIME + 3,
+ SIZE_DWORD + 1,
+ SIZE_WORD + 2,
+ NO_MORE_CNV
+} ;
+
+#ifdef SUPPORT_IMAGE
+static UINT16 idb_layout[] = {
+ /* Conversion type Number of items to convert */
+ SIZE_DWORD + 4,
+ SIZE_WORD + 1,
+ SIZE_DWORD + 2,
+ SIZE_WORD + 3,
+ NO_MORE_CNV
+} ;
+#endif
+
+static UINT16 cfdb_layout[] = {
+ /* Conversion type Number of items to convert */
+ SIZE_DWORD + 4,
+ NO_MORE_CNV
+} ;
+
+#ifdef OS_DOS
+#pragma alloc_text( MAYN31RD_1, F31_Initialize, F31_DeInitialize, F31_RdVCB )
+#pragma alloc_text( MAYN31RD_2, F31_DetBlkType, F31_RdDDB, F31_RdFDB )
+#pragma alloc_text( MAYN31RD_3, F31_RdIDB, F31_RdCFDB, F31_RdUDB )
+#pragma alloc_text( MAYN31RD_4, F31_RdContTape, F31_Recall )
+#pragma alloc_text( MAYN31RD_5, SetStandFields )
+#pragma alloc_text( MAYN31RD_6, F31_RdException )
+#pragma alloc_text( MAYN31RD_7, F31_MoveToVCB )
+#endif
+
+/**/
+/**
+
+ Format 3.1 Read Routines
+
+**/
+
+/**/
+/**
+
+ Name: F31_Initialize
+
+ Description: This routine is used to allocate and initialize
+ the format 3.1 environment structure.
+
+ Modified: Oct. 24, 1990 NK
+
+ Returns: TRUE if allocated & init'd OK
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 F31_Initialize(
+ CHANNEL_PTR channel )
+{
+ F31_ENV_PTR env_ptr = (F31_ENV_PTR)malloc( sizeof( F31_ENV ) ) ;
+
+ channel->fmt_env = env_ptr ;
+
+ if ( env_ptr == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+
+ memset( env_ptr, 0, sizeof( F31_ENV ) ) ;
+
+ env_ptr->os_id = FS_PC_DOS ;
+ env_ptr->os_ver = FS_PC_DOS_VER ;
+ env_ptr->no_streams = 0 ;
+ env_ptr->stream_mode = FALSE ;
+ env_ptr->curr_lba = 0L ;
+ env_ptr->in_streams = FALSE ;
+
+ channel->lb_size = 512 ; /* Always the case! */
+
+ return TFLE_NO_ERR ;
+}
+
+/**/
+/**
+
+ Name: F31_DeInitialize
+
+ Description: Returns environment memory
+
+ Modified: 10/24/1990
+
+ Returns: Nothing.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+VOID F31_DeInitialize(
+ VOID_PTR *fmt_env )
+{
+ free( *fmt_env ) ;
+ *fmt_env = NULL ;
+}
+
+/**/
+/**
+
+ Name: F31_DetBlkType
+
+ Description: Determines the type of Descriptor Block for the given
+ buffer.
+
+ Modified: August 17, 1989 (3:00pm)
+
+ Returns: The Block type number.
+
+ Notes: This routine assumes the buffer is at least
+ min_siz_for_dblk bytes long.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 F31_DetBlkType(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer, /* Transfer Parameter Block */
+ UINT16_PTR blk_type )
+{
+ DB_HDR_PTR cur_hdr = (DB_HDR_PTR)BM_NextBytePtr( buffer ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ F31_ENV_PTR currentEnv = ( F31_ENV_PTR ) channel->fmt_env ;
+
+ if( currentEnv->curr_lba != BM_BeginningLBA( buffer ) +
+ BM_NextByteOffset( buffer )
+ && ! currentEnv->in_streams ) {
+
+ currentEnv->stream_mode = FALSE ;
+ }
+
+ /* Are we in a stream mode */
+ if( currentEnv->stream_mode ) {
+ *blk_type = BT_STREAM ;
+ return( ret_val ) ;
+ }
+
+ *blk_type = cur_hdr->type ;
+
+ switch( *blk_type ) {
+ case F31_VCB_ID:
+ case F31_CVCB_ID:
+ case F31_DDB_ID:
+ case F31_FDB_ID:
+ case F31_CFDB_ID:
+ case F31_IDB_ID:
+ case F31_BSDB_ID:
+ break ;
+ default:
+ ret_val = BT_UDB ;
+ break ;
+ }
+
+ /* Make sure the block's checksums are valid */
+ if( CalcChecksum( (UINT16_PTR)(VOID_PTR)cur_hdr, F31_HDR_CHKSUM_LEN ) != cur_hdr->hdr_chksm ) {
+ *blk_type = BT_HOSED ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ }
+
+ if ( ret_val != BT_HOSED ) {
+ if( CalcChecksum( &cur_hdr->chksm_len, cur_hdr->chksm_len ) != cur_hdr->blk_chksm ) {
+ *blk_type = BT_HOSED ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: F31_SizeofTBLK
+
+ Description: returns the size of a tape block.
+
+ Modified: 10/5/1989 10:44:19
+
+ Returns: the size in bytes
+
+ Notes: IT IS ASSUMED THAT THE BUFFER PASSED TO THIS FUNCTION
+ CONTAINS A VALID FORMAT 3.1 TAPE BLOCK.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+UINT16 F31_SizeofTBLK(
+ VOID_PTR buffer )
+{
+ return( ( (DB_HDR_PTR)buffer)->data_off ) ;
+}
+
+/**/
+/**
+ Name: F31_RdVCB
+
+ Description: Format 3.1 VCB translator.
+
+ Modified: 7/9/92 NK
+
+ Returns: True if successful, false if not
+
+ Notes:
+**/
+
+INT16 F31_RdVCB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ F31_VCB_PTR cur_vcb = (F31_VCB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_VCB_DATA gvcb_data ;
+ UINT16 tmp_filter ;
+ ACHAR_PTR vstr_ptr = (ACHAR_PTR)( cur_vcb ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ F31_ENV_PTR cur_env = (F31_ENV_PTR)channel->fmt_env ;
+
+ /* If processor types don't match, swap bytes */
+ if( cur_vcb->hdr.format != CUR_PROCESSOR ) {
+ SwapBlock( blkhdr_layout, (UINT8_PTR)&cur_vcb->hdr.blk_chksm ) ;
+ SwapBlock( vcb_layout, (UINT8_PTR)( cur_vcb + sizeof( DB_HDR ) ) ) ;
+ }
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_VCB, (CREATE_DBLK_PTR)&gvcb_data ) ;
+ gvcb_data.std_data.dblk = cur_dblk ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gvcb_data.std_data, &cur_vcb->hdr, buffer ) ;
+
+ gvcb_data.std_data.attrib =
+ ( ( ( cur_vcb->vcb_attribs & F31_VCB_ARCHIVE_BIT ) ? VCB_ARCHIVE_BIT : 0UL )
+ | ( ( cur_vcb->vcb_attribs & F31_VCB_COPY_SET ) ? VCB_COPY_SET : 0UL )
+ | ( ( cur_vcb->vcb_attribs & F31_VCB_NORMAL_SET ) ? VCB_NORMAL_SET : 0UL )
+ | ( ( cur_vcb->vcb_attribs & F31_VCB_DIFFERENTIAL_SET ) ? VCB_DIFFERENTIAL_SET : 0UL )
+ | ( ( cur_vcb->vcb_attribs & F31_VCB_INCREMENTAL_SET ) ? VCB_INCREMENTAL_SET : 0UL ) ) ;
+
+ if ( cur_vcb->hdr.blk_attribs & F31_DB_CONT_BIT ) {
+ gvcb_data.std_data.continue_obj = TRUE ;
+ cur_env->cont_vcb = TRUE ;
+ } else {
+ cur_env->cont_vcb = FALSE ;
+ }
+
+ /* The IDs for the tape */
+ gvcb_data.tape_id = (UINT32)cur_vcb->id ;
+ gvcb_data.tape_seq_num = (UINT16)cur_vcb->ts_num ;
+ gvcb_data.bset_num = (UINT16)cur_vcb->bs_num ;
+ gvcb_data.tf_major_ver = (CHAR)cur_vcb->tf_mjr_ver ;
+ gvcb_data.tf_minor_ver = (CHAR)cur_vcb->tf_mnr_ver ;
+ gvcb_data.sw_major_ver = (CHAR)cur_vcb->sw_mjr_ver ;
+ gvcb_data.sw_minor_ver = (CHAR)cur_vcb->sw_mnr_ver ;
+ gvcb_data.password_encrypt_alg = cur_vcb->pass_encrypt_algm ;
+ gvcb_data.data_encrypt_alg = cur_vcb->data_encrypt_algm ;
+ gvcb_data.vendor_id = 0 ;
+
+ /* The Variable Length Strings */
+ gvcb_data.tape_name = (CHAR_PTR)( vstr_ptr + cur_vcb->t_name_off ) ;
+ gvcb_data.tape_name_size = cur_vcb->t_name_len ;
+ gvcb_data.bset_name = (CHAR_PTR)( vstr_ptr + cur_vcb->bs_name_off ) ;
+ gvcb_data.bset_name_size = cur_vcb->bs_name_len ;
+ gvcb_data.bset_descript = (CHAR_PTR)( vstr_ptr + cur_vcb->bs_desc_off ) ;
+ gvcb_data.bset_descript_size = cur_vcb->bs_desc_len ;
+ gvcb_data.machine_name = (CHAR_PTR)( vstr_ptr + cur_vcb->mach_name_off ) ;
+ gvcb_data.machine_name_size = cur_vcb->mach_name_len ;
+ gvcb_data.short_m_name = (CHAR_PTR)( vstr_ptr + cur_vcb->shrt_mach_name_off ) ;
+ gvcb_data.short_m_name_size = cur_vcb->shrt_mach_name_len ;
+ gvcb_data.volume_name = (CHAR_PTR)( vstr_ptr + cur_vcb->vol_name_off ) ;
+ gvcb_data.volume_name_size = cur_vcb->vol_name_len ;
+ gvcb_data.user_name = (CHAR_PTR)( vstr_ptr + cur_vcb->username_off ) ;
+ gvcb_data.user_name_size = cur_vcb->username_len ;
+ gvcb_data.bset_password = (CHAR_PTR)( vstr_ptr + cur_vcb->bs_pass_off ) ;
+ gvcb_data.bset_password_size = cur_vcb->bs_pass_len ;
+ gvcb_data.tape_password = (CHAR_PTR)( vstr_ptr + cur_vcb->t_pass_off ) ;
+ gvcb_data.tape_password_size = cur_vcb->t_pass_len ;
+ gvcb_data.date = &cur_vcb->backup_date ;
+
+ /* Set up Position Info */
+ gvcb_data.pba = cur_vcb->hdr.pba_vcb ;
+
+ if( gvcb_data.std_data.continue_obj ) {
+ /* Fix for the app not knowing the LBA for a continuation VCB */
+ channel->cross_set = cur_vcb->bs_num ;
+ channel->cross_lba = cur_vcb->hdr.lba ;
+ }
+
+ /* Tell the file system to do its thing */
+ tmp_filter = (UINT16)FS_CreateGenVCB( cur_fsys, &gvcb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ /* We are done with this much */
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: F31_RdDDB
+
+ Description:
+
+ Modified: 9/21/1989 11:12:3
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 F31_RdDDB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ F31_DDB_PTR cur_ddb = (F31_DDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ F31_ENV_PTR currentEnv = (F31_ENV_PTR)channel->fmt_env ;
+ GEN_DDB_DATA gddb_data ;
+ UINT16 tmp_filter ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ ACHAR_PTR vstr_ptr = (ACHAR_PTR)cur_ddb ;
+ VOID_PTR di_ptr ;
+ STREAM_INFO_PTR currentStream = &currentEnv->streams[0] ;
+ GOS gos ;
+ DATE_TIME fake_access_date ;
+
+ /* There was a bug in 3.1 write which caused the continuation bit to be
+ set in the first DDB of a set which was not a continuation set. It
+ is not clear how, why or how often this happened, but it was never
+ discovered because the read translator worked in such a way that it
+ was not apparent during read that anything was wrong. Now it messes
+ us up big time so we set a flag to tell if the VCB has the
+ continuation bit set, and clear the bit in the DDB if it wasn't set
+ in the VCB.
+ */
+ if( ( !currentEnv->cont_vcb ) &&
+ ( cur_ddb->hdr.blk_attribs & F31_DB_CONT_BIT ) ) {
+ cur_ddb->hdr.blk_attribs &= ~F31_DB_CONT_BIT ;
+ }
+
+ /* If the processor types don't match, swap bytes */
+ if( cur_ddb->hdr.format != CUR_PROCESSOR ) {
+ SwapBlock( blkhdr_layout, (UINT8_PTR)&cur_ddb->hdr.blk_chksm ) ;
+ SwapBlock( ddb_layout, (UINT8_PTR)( vstr_ptr + sizeof( DB_HDR ) ) ) ;
+ }
+
+ di_ptr = (VOID_PTR)( ( (INT8_PTR)cur_ddb ) + cur_ddb->hdr.non_gen_off ) ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_DDB, (CREATE_DBLK_PTR)&gddb_data ) ;
+ gddb_data.std_data.dblk = cur_dblk ;
+
+ (void)FS_InitializeGOS( channel->cur_fsys, &gos ) ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gddb_data.std_data, &cur_ddb->hdr, buffer ) ;
+
+ /* now copy the OS-specific structure into the GOS if needed
+ * These things used to be done by the file system.
+ */
+ switch ( cur_ddb->hdr.os_id ) {
+
+ case FS_PC_OS2 :
+ {
+ F31_OS2_DIR_OS_INFO_PTR dip = di_ptr ;
+
+ gos.access_date = dip->access_date ;
+
+ gos.ea_fork_size = dip->ea_fork_size ;
+ gos.ea_fork_offset = dip->ea_fork_offset ;
+
+ if( dip->ea_fork_size ) {
+ currentStream->id = STRM_OS2_EA ;
+ currentStream->size = U64_Init( dip->ea_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+
+ gos.long_path_leng = dip->path_leng ;
+ gos.long_path = (ACHAR_PTR)(VOID_PTR)dip + dip->path ;
+
+ if( cur_ddb->hdr.os_ver == FS_PC_OS2_ACL_VER ) {
+ gos.acl_fork_size = dip->acl_fork_size ;
+ gos.acl_fork_offset = dip->acl_fork_offset ;
+
+ if( dip->acl_fork_size ) {
+ currentStream->id = STRM_OS2_ACL ;
+ currentStream->size = U64_Init( dip->acl_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+ } else {
+ gos.acl_fork_size = 0 ;
+ gos.acl_fork_offset = 0 ;
+ }
+
+ break ;
+ }
+
+ case FS_AFP_NOVELL :
+ {
+ F31_OLD_AFP_DIR_OS_INFO_PTR dip = di_ptr ;
+
+ memcpy( gos.finder, dip->finder, sizeof(gos.finder) );
+ gos.nov_owner_id = dip->owner_id ;
+
+ gos.trust_fork_size = dip->trust_fork_size ;
+ gos.trust_fork_offset = dip->trust_fork_offset ;
+
+ if( dip->trust_fork_size ) {
+ currentStream->id = STRM_NOV_TRUST_286 ;
+ currentStream->size = U64_Init( dip->trust_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+
+ gos.long_path_leng = dip->path_leng ;
+ gos.long_path = dip->long_path ;
+ break ;
+ }
+
+ case FS_AFP_NOVELL31 :
+ {
+ F31_AFP_DIR_OS_INFO_PTR dip = di_ptr ;
+
+ memcpy( gos.finder, dip->finder, sizeof(gos.finder) );
+ gos.nov_owner_id = dip->owner_id ;
+ gos.trust_fork_size = dip->trust_fork_size ;
+ gos.trust_fork_offset = dip->trust_fork_offset ;
+ gos.trust_fork_format = dip->trust_fork_format ;
+
+ if( dip->trust_fork_size ) {
+ currentStream->id = ( dip->trust_fork_format == TRUSTEE_FMT_286 )
+ ? STRM_NOV_TRUST_286 : STRM_NOV_TRUST_386 ;
+ currentStream->size = U64_Init( dip->trust_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+
+ gos.long_path_leng = dip->lpath_leng ;
+ gos.long_path = (ACHAR_PTR)( (UINT8_PTR)dip + dip->long_path ) ;
+
+ gos.dir_info_386.info_valid = dip->info_386.info_valid ;
+ gos.dir_info_386.maximum_space = dip->info_386.maximum_space ;
+ gos.dir_info_386.attributes_386 = dip->info_386.attributes_386 ;
+ gos.dir_info_386.extend_attr = dip->info_386.extend_attr ;
+ gos.dir_info_386.inherited_rights = dip->info_386.inherited_rights ;
+
+ memcpy( gos.proDosInfo, dip->proDosInfo, sizeof(gos.proDosInfo) );
+ break ;
+ }
+
+ case FS_NON_AFP_NOV :
+ case FS_NON_AFP_NOV31 :
+ {
+ F31_NOV_DIR_OS_INFO_PTR dip = di_ptr ;
+
+ gos.nov_owner_id = dip->owner_id;
+ gos.trust_fork_size = dip->trust_fork_size ;
+ gos.trust_fork_offset = dip->trust_fork_offset;
+ gos.trust_fork_format = dip->trust_fork_format ;
+
+ gos.dir_info_386.info_valid = dip->info_386.info_valid ;
+ gos.dir_info_386.maximum_space = dip->info_386.maximum_space ;
+ gos.dir_info_386.attributes_386 = dip->info_386.attributes_386 ;
+ gos.dir_info_386.extend_attr = dip->info_386.extend_attr ;
+ gos.dir_info_386.inherited_rights = dip->info_386.inherited_rights ;
+
+ if( dip->trust_fork_size ) {
+ currentStream->id = ( dip->trust_fork_format == TRUSTEE_FMT_286 )
+ ? STRM_NOV_TRUST_286 : STRM_NOV_TRUST_386 ;
+
+ currentStream->size = U64_Init( dip->trust_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+ break ;
+ }
+
+ /* case FS_NLM_AFP_NOVELL31: */
+ default:
+ break ;
+ }
+
+ /* If this is a continuation DDB, and we've called this function, we
+ DIDN'T see the first tape! We don't want to attemt to restore the
+ data anyway, so we're going to call all the data up to the next DBLK
+ pad instead of trying to figure out which stream we're in.
+ */
+ if ( cur_ddb->hdr.blk_attribs & F31_DB_CONT_BIT ) {
+ cur_dblk->com.continue_obj = TRUE ;
+ if( cur_ddb->hdr.rem_data_siz != 0L ) {
+ currentEnv->no_streams = 1 ;
+ currentEnv->streams[0].id = STRM_PAD ;
+ currentEnv->streams[0].size =
+ U64_Init( cur_ddb->hdr.rem_data_siz +
+ currentEnv->pad_size, 0L ) ;
+ }
+ } else {
+ if( currentEnv->pad_size ) {
+ currentEnv->no_streams++ ;
+ currentStream->id = STRM_PAD ;
+ currentStream->size = U64_Init( currentEnv->pad_size, 0L ) ;
+ currentStream++ ;
+ }
+ }
+
+ gos.novell_directory_max_rights = (UINT)
+ ( ( ( cur_ddb->dir_attribs & F31_DDB_READ_ACCESS_BIT ) ? NOVA_DIR_READ_RIGHTS : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_WRITE_ACCESS_BIT ) ? NOVA_DIR_WRITE_RIGHTS : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_OPEN_FILE_RIGHTS_BIT ) ? NOVA_DIR_OPEN_FILE_RIGHTS : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_CREATE_FILE_RIGHTS_BIT ) ? NOVA_DIR_CREATE_FILE_RIGHTS : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_DELETE_FILE_RIGHTS_BIT ) ? NOVA_DIR_DELETE_FILE_RIGHTS : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_PARENTAL_RIGHTS_BIT ) ? NOVA_DIR_PARENTAL_RIGHTS : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_SEARCH_RIGHTS_BIT ) ? NOVA_DIR_SEARCH_RIGHTS : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_MOD_FILE_ATTRIBS_BIT ) ? NOVA_DIR_MOD_FILE_ATTRIBS : 0 ) ) ;
+
+ gddb_data.std_data.attrib =
+ ( ( cur_ddb->dir_attribs & F31_DDB_EMPTY_BIT ) ? DIR_EMPTY_BIT : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_HIDDEN_BIT ) ? OBJ_HIDDEN_BIT : 0 )
+ | ( ( cur_ddb->dir_attribs & F31_DDB_SYSTEM_BIT ) ? OBJ_SYSTEM_BIT : 0 ) ;
+
+ /* Set the non-defaulted DDB specific fields */
+ gddb_data.path_name = (CHAR_PTR)( vstr_ptr + cur_ddb->dir_name_off ) ;
+ gddb_data.path_size = (INT16)cur_ddb->dir_name_len ;
+ gddb_data.creat_date = &cur_ddb->create_date ;
+ gddb_data.mod_date = &cur_ddb->mod_date ;
+ gddb_data.backup_date = &cur_ddb->backup_date ;
+
+ /* We don't have one of these, but they need a pointer to something! */
+ fake_access_date.date_valid = FALSE ;
+ gddb_data.access_date = &fake_access_date ;
+
+ gddb_data.std_data.os_info = (BYTE_PTR)&gos ;
+ gddb_data.std_data.os_info_size = sizeof(gos) ;
+ gddb_data.std_data.os_id = FS_GOS ;
+
+ /* Tell the file system to do its thing */
+ tmp_filter = (UINT16)FS_CreateGenDDB( cur_fsys, &gddb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ channel->lst_did = cur_ddb->hdr.blk_id ;
+
+ currentEnv->curr_lba = BM_BeginningLBA( buffer ) +
+ BM_NextByteOffset( buffer ) ;
+ currentEnv->in_streams = FALSE ;
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: F31_RdFDB
+
+ Description: Translates a tape format blk into a OS DBLK.
+
+ Modified: 9/21/1989 11:46:41
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 F31_RdFDB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ F31_FDB_PTR cur_fdb = (F31_FDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_FDB_DATA gfdb_data ;
+ UINT16 tmp_filter ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ ACHAR_PTR vstr_ptr = (ACHAR_PTR)cur_fdb ;
+ VOID_PTR di_ptr ;
+ GOS gos ;
+ F31_ENV_PTR currentEnv = (F31_ENV_PTR)channel->fmt_env ;
+ STREAM_INFO_PTR currentStream = &currentEnv->streams[0] ;
+ DATE_TIME fake_access_date ;
+
+ /* If the processor types don't match, swap bytes */
+ if( cur_fdb->hdr.format != CUR_PROCESSOR ) {
+ SwapBlock( blkhdr_layout, (UINT8_PTR)&cur_fdb->hdr.blk_chksm ) ;
+ SwapBlock( ddb_layout, (UINT8_PTR)( vstr_ptr + sizeof( DB_HDR ) ) ) ;
+ }
+
+ di_ptr = (VOID_PTR)( ( (INT8_PTR)cur_fdb ) + cur_fdb->hdr.non_gen_off ) ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_FDB, (CREATE_DBLK_PTR)&gfdb_data ) ;
+ gfdb_data.std_data.dblk = cur_dblk ;
+
+ (void)FS_InitializeGOS( channel->cur_fsys, &gos ) ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gfdb_data.std_data, &cur_fdb->hdr, buffer ) ;
+
+ if( cur_fdb->hdr.gen_data_siz ) {
+ currentEnv->no_streams++ ;
+ currentStream->id = STRM_GENERIC_DATA ;
+ currentStream->size = U64_Init( cur_fdb->hdr.gen_data_siz, 0L ) ;
+ currentStream++ ;
+ }
+
+ /* now copy the OS-specific structure into the GOS if needed
+ * These things used to be done by the file system.
+ */
+ switch ( cur_fdb->hdr.os_id ) {
+
+ case FS_PC_OS2 :
+ {
+ F31_OS2_FILE_OS_INFO_PTR dip = di_ptr ;
+
+ gos.access_date = dip->access_date ;
+ gos.ea_fork_size = dip->ea_fork_size ;
+ gos.ea_fork_offset = dip->ea_fork_offset ;
+
+ if( dip->ea_fork_size ) {
+ currentStream->id = STRM_OS2_EA ;
+ currentStream->size = U64_Init( dip->ea_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+
+ if( cur_fdb->hdr.os_ver == FS_PC_OS2_ACL_VER ) {
+ gos.acl_fork_size = dip->acl_fork_size ;
+ gos.acl_fork_offset = dip->acl_fork_offset ;
+
+ if( dip->acl_fork_size ) {
+ currentStream->id = STRM_OS2_ACL ;
+ currentStream->size = U64_Init( dip->acl_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+ } else {
+ gos.acl_fork_size = 0 ;
+ gos.acl_fork_offset = 0 ;
+ }
+
+ gos.data_fork_size = dip->data_fork_size ;
+ gos.data_fork_offset = dip->data_fork_offset ;
+ gos.long_path_leng = dip->lname_leng ;
+ gos.long_path = (ACHAR_PTR)( (UINT8_PTR)dip + dip->long_name ) ;
+ gos.alloc_size = dip->alloc_size ;
+ break ;
+ }
+
+ case FS_AFP_NOVELL :
+ case FS_AFP_NOVELL31 :
+ {
+ F31_AFP_FILE_OS_INFO_PTR dip = di_ptr ;
+
+ memcpy( gos.finder, dip->finder, sizeof(gos.finder) );
+ memcpy( gos.long_name, dip->long_name, sizeof(gos.long_name) );
+
+ gos.data_fork_size = dip->data_fork_size ;
+ gos.data_fork_offset = dip->data_fork_offset ;
+
+ gos.res_fork_size = dip->res_fork_size ;
+ gos.res_fork_offset = dip->res_fork_offset ;
+
+ if( dip->res_fork_size ) {
+ dip->res_fork_size = BSwapLong( dip->res_fork_size ) ;
+ currentStream->id = STRM_MAC_RESOURCE ;
+ currentStream->size = U64_Init( dip->res_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+
+ gos.nov_owner_id = dip->owner_id ;
+ gos.access_date16 = dip->access_date ;
+
+ gos.file_info_386.info_valid = dip->info_386.info_valid ;
+ gos.file_info_386.creation_time = dip->info_386.creation_time ;
+ gos.file_info_386.archiver_id = dip->info_386.archiver_id ;
+ gos.file_info_386.attributes_386 = dip->info_386.attributes_386 ;
+ gos.file_info_386.last_modifier_id = dip->info_386.last_modifier_id ;
+ gos.file_info_386.trust_fork_size = dip->info_386.trust_fork_size ;
+ gos.file_info_386.trust_fork_offset = dip->info_386.trust_fork_offset ;
+ gos.file_info_386.trust_fork_format = dip->info_386.trust_fork_format ;
+ gos.file_info_386.inherited_rights = dip->info_386.inherited_rights ;
+
+ if( dip->info_386.trust_fork_size ) {
+ currentStream->id = ( dip->info_386.trust_fork_format == TRUSTEE_FMT_286 )
+ ? STRM_NOV_TRUST_286 : STRM_NOV_TRUST_386 ;
+
+ currentStream->size = U64_Init( dip->info_386.trust_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+
+ memcpy( gos.proDosInfo, dip->proDosInfo, sizeof(gos.proDosInfo) );
+ break ;
+ }
+
+ case FS_NON_AFP_NOV :
+ case FS_NON_AFP_NOV31 :
+ {
+ F31_NOV_FILE_OS_INFO_PTR dip = di_ptr ;
+
+ gos.nov_owner_id = dip->owner_id;
+ gos.access_date16 = dip->access_date ;
+
+ gos.file_info_386.info_valid = dip->info_386.info_valid ;
+ gos.file_info_386.creation_time = dip->info_386.creation_time ;
+ gos.file_info_386.archiver_id = dip->info_386.archiver_id ;
+ gos.file_info_386.attributes_386 = dip->info_386.attributes_386 ;
+ gos.file_info_386.last_modifier_id = dip->info_386.last_modifier_id ;
+ gos.file_info_386.trust_fork_size = dip->info_386.trust_fork_size ;
+ gos.file_info_386.trust_fork_offset = dip->info_386.trust_fork_offset ;
+ gos.file_info_386.trust_fork_format = dip->info_386.trust_fork_format ;
+ gos.file_info_386.inherited_rights = dip->info_386.inherited_rights ;
+
+ if( dip->info_386.trust_fork_size ) {
+ currentStream->id = ( dip->info_386.trust_fork_format == TRUSTEE_FMT_286 )
+ ? STRM_NOV_TRUST_286 : STRM_NOV_TRUST_386 ;
+
+ currentStream->size = U64_Init( dip->info_386.trust_fork_size, 0L ) ;
+ currentStream++ ;
+ currentEnv->no_streams++ ;
+ }
+
+ gos.data_fork_offset = dip->data_fork_offset ;
+ break ;
+ }
+
+ /* case FS_NLM_AFP_NOVELL31: */
+ default:
+ break ;
+ }
+
+ /* If this is a continuation FDB, and we've called this function, we
+ DIDN'T see the first tape! We don't want to attemt to restore the
+ data anyway, so we're going to call all the data up to the next DBLK
+ pad instead of trying to figure out which stream we're in.
+ */
+ if ( cur_fdb->hdr.blk_attribs & F31_DB_CONT_BIT ) {
+ cur_dblk->com.continue_obj = TRUE ;
+ if( cur_fdb->hdr.rem_data_siz != 0L ) {
+ currentEnv->no_streams = 1 ;
+ currentEnv->streams[0].id = STRM_PAD ;
+ currentEnv->streams[0].size =
+ U64_Init( cur_fdb->hdr.rem_data_siz +
+ currentEnv->pad_size, 0L ) ;
+ }
+ } else {
+ if( currentEnv->pad_size ) {
+ currentEnv->no_streams++ ;
+ currentStream->id = STRM_PAD ;
+ currentStream->size = U64_Init( currentEnv->pad_size, 0L ) ;
+ currentStream++ ;
+ }
+ }
+
+ gos.novell_file_attributes = (UINT)
+ ( ( ( cur_fdb->file_attribs & F31_FDB_READ_ONLY_BIT ) ? NOVA_FILE_READ_ONLY : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_HIDDEN_BIT ) ? NOVA_FILE_HIDDEN : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_SYSTEM_BIT ) ? NOVA_FILE_SYSTEM : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_EXECUTE_ONLY_BIT ) ? NOVA_FILE_EXECUTE_ONLY : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_MODIFIED_BIT ) ? NOVA_FILE_MODIFIED : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_SHAREABLE_BIT ) ? NOVA_FILE_SHAREABLE : 0 ) ) ;
+
+ gos.novell_extended_attributes = (UINT)
+ ( ( ( cur_fdb->file_attribs & F31_FDB_TRANSACTIONAL_BIT ) ? NOVA_FILE_TRANSACTIONAL : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_INDEXING_BIT ) ? NOVA_FILE_INDEXING : 0 ) ) ;
+
+ gfdb_data.std_data.attrib =
+ ( ( cur_fdb->file_attribs & F31_FDB_CORRUPT_FILE ) ? OBJ_CORRUPT_BIT : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_IN_USE_BIT ) ? FILE_IN_USE_BIT : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_READ_ONLY_BIT ) ? OBJ_READONLY_BIT : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_HIDDEN_BIT ) ? OBJ_HIDDEN_BIT : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_SYSTEM_BIT ) ? OBJ_SYSTEM_BIT : 0 )
+ | ( ( cur_fdb->file_attribs & F31_FDB_MODIFIED_BIT ) ? OBJ_MODIFIED_BIT : 0 ) ;
+
+ /* Set the non-defaulted FDB specific fields */
+ gfdb_data.fname = (CHAR_PTR)( vstr_ptr + cur_fdb->file_name_off ) ;
+ gfdb_data.fname_size = cur_fdb->file_name_len ;
+ gfdb_data.creat_date = &cur_fdb->create_date ;
+ gfdb_data.mod_date = &cur_fdb->mod_date ;
+ gfdb_data.backup_date = &cur_fdb->backup_date ;
+ gfdb_data.file_ver = cur_fdb->file_version ;
+
+ /* We don't have one of these, but they need a pointer to something! */
+ fake_access_date.date_valid = FALSE ;
+ gfdb_data.access_date = &fake_access_date ;
+
+ gfdb_data.std_data.os_info = (BYTE_PTR)&gos ;
+ gfdb_data.std_data.os_info_size = sizeof(gos) ;
+ gfdb_data.std_data.os_id = FS_GOS ;
+
+ /* Tell the file system to do its thing */
+ tmp_filter = (UINT16)FS_CreateGenFDB( cur_fsys, &gfdb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ channel->lst_fid = cur_fdb->hdr.blk_id ;
+
+ currentEnv->curr_lba = BM_BeginningLBA( buffer ) +
+ BM_NextByteOffset( buffer ) ;
+ currentEnv->in_streams = FALSE ;
+
+ return( ret_val ) ;
+}
+
+INT16 F31_RdStream( CHANNEL_PTR Channel,
+ BUF_PTR Buffer )
+{
+ F31_ENV_PTR currentEnv = ( F31_ENV_PTR ) Channel->fmt_env ;
+
+ currentEnv->in_streams = TRUE ;
+
+ Channel->current_stream = currentEnv->streams[currentEnv->cur_stream++] ;
+
+ if( --currentEnv->no_streams == 0 ) {
+ currentEnv->stream_mode = FALSE ;
+ }
+
+ /* Reset Filter */
+ if( Channel->current_stream.id == STRM_PAD ) {
+ SetChannelStatus( Channel, CH_SKIP_CURRENT_STREAM ) ;
+ } else {
+ ClrChannelStatus( Channel, CH_SKIP_CURRENT_STREAM ) ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+ (VOID)Buffer;
+}
+/**/
+/**
+
+ Name: F31_RdIDB
+
+ Description:
+
+ Modified: 9/21/1989 13:1:40
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 F31_RdIDB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+#ifdef SUPPORT_IMAGE
+
+ BOOLEAN ret_val = TRUE ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ F31_IDB_PTR cur_idb = (F31_IDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_IDB_DATA gidb_data ;
+ UINT16 tmp_filter ;
+
+
+
+ /* If our processor types don't match swap bytes */
+ if( cur_idb->hdr.format != CUR_PROCESSOR ) {
+ SwapBlock( blkhdr_layout, (UINT8_PTR)&cur_idb->hdr.blk_chksm ) ;
+ SwapBlock( idb_layout, (UINT8_PTR)( (UINT8_PTR)cur_idb + sizeof( DB_HDR ) ) ) ;
+ }
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_IDB, (CREATE_DBLK_PTR)&gidb_data ) ;
+ gidb_data.std_data.dblk = cur_dblk ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gidb_data.std_data, &cur_idb->hdr, buffer ) ;
+
+ gidb_data.std_data.attrib = cur_idb->image_attribs ;
+
+ /* Set the continuation bit, encryption and compression bits */
+ gidb_data.std_data.attrib |= cur_idb->hdr.blk_attribs ;
+
+ /* Set the non-defaulted IDB specific fields */
+ gidb_data.pname = (CHAR_PTR)( (ACHAR_PTR)cur_idb + cur_idb->partition_name_off ) ;
+ gidb_data.pname_size = cur_idb->partition_name_len ;
+
+ gidb_data.byte_per_sector = (UINT16)cur_idb->bytes_in_sector ;
+ gidb_data.num_sect = cur_idb->part_no_of_sector ;
+ gidb_data.sys_ind = cur_idb->part_sys_ind ;
+ gidb_data.hhead = cur_idb->no_of_heads ;
+ gidb_data.hsect = (UINT16)cur_idb->no_of_sectors ;
+ gidb_data.rsect = cur_idb->relative_sector ;
+
+ /* Setup Total Data Size */
+ channel->tdata_size = U32_To_U64( cur_idb->hdr.tot_data_siz ) ;
+
+ tmp_filter = (UINT16)FS_CreateGenIDB( cur_fsys, &gidb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+#else
+ (VOID)channel;(VOID)buffer;
+#endif
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Name: F31_RdCFDB
+
+ Description:
+
+ Modified: 9/21/1989 12:2:27
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 F31_RdCFDB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ F31_CFDB_PTR cur_cfdb = (F31_CFDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_CFDB_DATA gcfdb_data ;
+ UINT16 tmp_filter ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* If the processor types don't match, swap bytes */
+ if( cur_cfdb->hdr.format != CUR_PROCESSOR ) {
+ SwapBlock( blkhdr_layout, (UINT8_PTR)&cur_cfdb->hdr.blk_chksm ) ;
+ SwapBlock( cfdb_layout, (UINT8_PTR)( (UINT8_PTR)cur_cfdb + sizeof( DB_HDR ) ) ) ;
+ }
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_CFDB, (CREATE_DBLK_PTR)&gcfdb_data ) ;
+ gcfdb_data.std_data.dblk = cur_dblk ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gcfdb_data.std_data, &cur_cfdb->hdr, buffer ) ;
+
+ gcfdb_data.std_data.attrib = cur_cfdb->crupt_file_attribs ;
+
+ /* Set the continuation bit, encryption and compression bits */
+ gcfdb_data.std_data.attrib |= cur_cfdb->hdr.blk_attribs ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ gcfdb_data.corrupt_offset = cur_cfdb->file_offset ;
+
+ /* Tell the file system to do its thing */
+ tmp_filter = (UINT16)FS_CreateGenCFDB( cur_fsys, &gcfdb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: F31_RdUDB
+
+ Description: Translates a Unknown Desciptor Block and throws away
+ the data.
+
+ Modified: 9/25/1989 14:50:13
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 F31_RdUDB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+// F31_UDB_PTR cur_udb = (F31_UDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ GEN_UDB_DATA gudb_data ;
+ F31_ENV_PTR currentEnv = ( F31_ENV_PTR ) channel->fmt_env ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_UDB, (CREATE_DBLK_PTR)&gudb_data ) ;
+ gudb_data.std_data.dblk = channel->cur_dblk ;
+
+ /* Create the entry less Ccfdb */
+ FS_CreateGenUDB( channel->cur_fsys, &gudb_data ) ;
+
+ currentEnv->pad_size = 0 ;
+
+/*
+ channel->data_size = lw_UINT64_ZERO ;
+ channel->tdata_size = U32_To_U64( cur_udb->hdr.length * 512L ) ;
+*/
+
+ return( TFLE_NO_ERR ) ;
+ (void)buffer;
+}
+
+/**/
+/**
+
+ Name: F31_RdContTape
+
+ Description: Sets up the continuation tape to pass over the updated
+ bs.
+
+ Modified: 9/29/1989 8:49:54
+
+ Returns:
+
+ Notes: THIS ASSUMES THAT THE BUFFER POINTER IS POINTING DIRECTLY
+ AFTER THE CONT. VCB. TO THE NEXT TBLK.
+
+ FURTHER, IT IS ASSUMED THE CURRENT BUFFER HAS BEEN READ
+ FROM THE NEXT TAPE IN THE TAPE SEQUENCE ( THIS SHOULD HAVE
+ BEEN DONE BY "Tape Positioning" .
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN F31_RdContTape(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ BOOLEAN ret_val = FALSE ;
+ DB_HDR_PTR cur_hdr = (DB_HDR_PTR)( BM_NextBytePtr( buffer ) ) ;
+ F31_ENV_PTR currentEnv = ( F31_ENV_PTR ) channel->fmt_env ;
+
+ if( IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+ ClrChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ return( TRUE ) ;
+ }
+
+ /* Set the lba of the beginning of the buffer and adjust the running lba */
+ BM_SetBeginningLBA( buffer, ( cur_hdr->lba - ( BM_NextByteOffset( buffer ) / 512L ) ) ) ;
+ channel->running_lba = cur_hdr->lba + ( BM_BytesFree( buffer ) / 512L ) ;
+
+ /* Find The last DBLK, we were operating on */
+ while( cur_hdr->blk_id != channel->eom_id ) {
+ BM_UpdCnts( buffer, (UINT16)( cur_hdr->length * 512 ) ) ;
+ cur_hdr = (DB_HDR_PTR)( BM_NextBytePtr( buffer ) ) ;
+ }
+
+ /* Okay we have a live one, let's update the counts */
+ if( cur_hdr->blk_id == channel->eom_id ) {
+ ret_val = TRUE ;
+ /* There is no data, so let's make set ourselves to the next block */
+ if( !cur_hdr->rem_data_siz ) {
+ BM_UpdCnts( buffer, (UINT16)( cur_hdr->length * 512 ) ) ;
+ } else {
+ if( currentEnv->no_streams != 0 ) {
+ currentEnv->stream_mode = TRUE ;
+ }
+ ProcessDataFilter( channel, channel->eom_filter ) ;
+ BM_UpdCnts( buffer, cur_hdr->data_off ) ;
+ }
+
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: SetStandFields
+
+ Description: Sets up the standard fields in translation to dblks.
+
+ Modified: 9/20/1989 14:8:27
+
+ Returns: Nothing.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static VOID _near SetStandFields(
+ CHANNEL_PTR channel,
+ STD_DBLK_DATA_PTR std_data,
+ DB_HDR_PTR cur_hdr,
+ BUF_PTR buffer )
+{
+ UINT8_PTR os_info = (UINT8_PTR)cur_hdr ;
+ F31_ENV_PTR currentEnv = ( F31_ENV_PTR ) channel->fmt_env ;
+ UINT32 dataSize ;
+ BOOLEAN cont_mode ;
+
+ cont_mode = (BOOLEAN)( IsChannelStatus( channel, CH_CONTINUING ) ) ;
+
+ /* Reset the stream stuff */
+ if( !cont_mode ) {
+ currentEnv->no_streams = 0 ;
+ currentEnv->cur_stream = 0 ;
+
+ if( cur_hdr->tot_data_siz ) {
+ currentEnv->stream_mode = TRUE ;
+ }
+ }
+
+ std_data->tape_seq_num = channel->ts_num ;
+ std_data->os_id = ( UINT8 ) cur_hdr->os_id ;
+ std_data->os_ver = ( UINT8 ) cur_hdr->os_ver ;
+ std_data->disp_size = U32_To_U64( cur_hdr->gen_data_siz ) ;
+ std_data->blkid = cur_hdr->blk_id ;
+ std_data->lba = cur_hdr->lba ;
+ std_data->string_type = BEC_ANSI_STR ;
+ std_data->compressed_obj = FALSE ;
+
+
+ /* We don't have to retranslate */
+ channel->retranslate_size = lw_UINT64_MAX ;
+
+ /* Is This a continuation */
+ dataSize = ( ( cur_hdr->blk_attribs & F31_DB_CONT_BIT )
+ ? cur_hdr->rem_data_siz
+ : cur_hdr->tot_data_siz ) ;
+
+ if( !cont_mode ) {
+ currentEnv->pad_size = (UINT16)F31_CalculatePad( ChannelBlkSize( channel ), dataSize,
+ ( UINT16 ) ( ChannelBlkSize( channel ) - cur_hdr->data_off ) ) ;
+ }
+
+ if( dataSize != 0L ) {
+ BM_UpdCnts( buffer, cur_hdr->data_off ) ;
+ } else {
+ BM_UpdCnts( buffer, (UINT16)( cur_hdr->length * 512 ) ) ;
+ }
+
+ /* Get Generic info */
+ std_data->os_info = (BYTE_PTR)( os_info + cur_hdr->non_gen_off ) ;
+ std_data->os_info_size = cur_hdr->non_gen_siz ;
+
+ /* set filemark position from block (ugh!)
+ * as unpleasant as this may be, it is the only chance we have
+ * to keep up with the random tape motion caused by our Fast File
+ * strategy.
+ */
+ channel->cur_drv->cur_pos.fmks = cur_hdr->fmks ;
+
+ if ( BM_ReadError( buffer ) == GEN_ERR_ENDSET
+ || BM_ReadError( buffer ) == GEN_ERR_EOM ) {
+ channel->cur_drv->cur_pos.fmks++ ;
+ }
+}
+
+/**/
+/**
+
+ Name: F31_RdEndSet
+
+ Description: Does the Action at a filemark.
+
+ Modified: 12/27/1989 14:12:42
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+UINT16 F31_RdException(
+ CHANNEL_PTR channel, /* which channel */
+ INT16 exception ) /* which exception seen */
+{
+ BUF_PTR tmpBUF ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ UINT16 ret_val = FMT_EXC_HOSED ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ RET_BUF myret ;
+ UINT16 blk_type ;
+ F31_ENV_PTR currentEnv = ( F31_ENV_PTR ) channel->fmt_env ;
+
+ currentEnv->stream_mode = FALSE ;
+
+ if ( ( exception != GEN_ERR_ENDSET ) && ( exception != GEN_ERR_EOM ) ) {
+ return ret_val ;
+ }
+
+ /* re-use channel->cur_buff (don't need to BM_Put() it) */
+ if ( channel->cur_buff != NULL ) {
+ tmpBUF = channel->cur_buff ;
+ BM_InitBuf( tmpBUF ) ;
+ } else {
+ if( ( tmpBUF = BM_Get( &channel->buffer_list ) ) == NULL ) {
+ tmpBUF = BM_GetVCBBuff( &channel->buffer_list ) ;
+ }
+ }
+
+ if( tmpBUF == NULL ) {
+ /* !!! We need something better than this !!! */
+ return FMT_EXC_HOSED ;
+ }
+
+ TpRead( drv_hdl, BM_XferBase( tmpBUF ), (UINT32)BM_XferSize( tmpBUF ) ) ;
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+
+/* NOTE: We used to check for proper gen_error codes below, as well as
+ sufficient len_got. However, due to an error in existing code
+ which causes Wangtech drives to mess up (like that's really hard)
+ and not write a second filemark, we now check only for 512 read,
+ and leave it up to the translators block determiner to determine
+ if something is amiss.
+*/
+ if ( myret.len_got < 512UL ) {
+ if ( channel->cur_buff == NULL ) {
+ BM_UseAll( tmpBUF ) ;
+ BM_Put( tmpBUF ) ;
+ }
+ return FMT_EXC_HOSED ;
+ }
+
+ F31_DetBlkType( channel, tmpBUF, &blk_type ) ;
+
+ switch( blk_type ) {
+ case BT_BSDB:
+ /* BSDB may have associated data. If it does, we eat it! */
+ if( myret.gen_error == GEN_NO_ERR ) {
+ TpReadEndSet( drv_hdl, 1, FORWARD ) ;
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ ret_val = FMT_EXC_HOSED ;
+ break;
+ }
+ }
+ ret_val = FMT_EXC_EOS ;
+ break ;
+
+ case BT_CVCB:
+ if( myret.gen_error == GEN_NO_ERR ) {
+ ret_val = FMT_EXC_HOSED ;
+ } else {
+ ret_val = FMT_EXC_EOM ;
+ }
+ break ;
+ default:
+ ret_val = FMT_EXC_HOSED ;
+ break ;
+ }
+ curDRV->cur_pos.fmks ++ ;
+ BM_UseAll( tmpBUF ) ; /* so we have no bytes left */
+
+ /* channel->cur_buff will be Punted */
+ if ( channel->cur_buff == NULL ) {
+ BM_Put( tmpBUF ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: F31_MoveToVCB
+
+ Description:
+
+ Modified: 10/25/1990
+
+ Returns:
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 F31_MoveToVCB(
+ CHANNEL_PTR channel,
+ INT16 number,
+ BOOLEAN_PTR need_read,
+ BOOLEAN really_move )
+{
+ INT16 nmarks = 0 ; /* number of file marks to move */
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN at_mos = IsPosBitSet( channel->cur_drv, AT_MOS ) != 0UL ;
+ BOOLEAN at_eos = ( ! at_mos ) && IsPosBitSet( channel->cur_drv, AT_EOS ) ;
+
+ msassert( number <= 1 ) ;
+
+ if ( really_move ) { /* this is a no-op for us */
+ * need_read = FALSE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ ClrPosBit( channel->cur_drv, AT_MOS ) ;
+
+ if ( number == 1 ) { /* move forward */
+ * need_read = TRUE ;
+ if( IsChannelStatus( channel, CH_AT_EOM ) ) {
+ ClrChannelStatus( channel, CH_AT_EOM ) ;
+ ret_val = TF_NEED_NEW_TAPE ;
+ } else if( at_eos ) {
+ ret_val = TFLE_NO_ERR ;
+ } else {
+ ret_val = MoveFileMarks( channel, 1, FORWARD ) ;
+ if( ret_val == TFLE_NO_ERR || ret_val == TFLE_UNEXPECTED_EOM ) {
+ ret_val = F31_RdException( channel, GEN_ERR_ENDSET ) ;
+ if( ret_val == FMT_EXC_HOSED ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ } else if ( ret_val == FMT_EXC_EOM ) {
+ ret_val = TF_NEED_NEW_TAPE ;
+ } else {
+ SetPosBit( channel->cur_drv, AT_EOS ) ;
+ ret_val = TFLE_NO_ERR ;
+ }
+ } else if( ret_val == TF_NO_MORE_DATA ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ }
+ }
+
+ } else {
+ /* If we're moving backward, AT_EOM is essentially the same as
+ AT_EOS (same number of filemarks to skip).
+ */
+ if( IsChannelStatus( channel, CH_AT_EOM ) ) {
+ ClrChannelStatus( channel, CH_AT_EOM ) ;
+ at_mos = FALSE ;
+ at_eos = TRUE ;
+ }
+ if ( number < 0 ) { /* move backward */
+ nmarks = ( number * -2 ) + 1 ;
+ if ( at_eos ) {
+ nmarks += 2 ;
+ }
+ } else { /* current */
+ if ( at_mos ) {
+ nmarks = 1 ;
+ } else if ( at_eos ) {
+ nmarks = 3 ;
+ } else { /* we're already there. */
+ * need_read = FALSE ;
+ ret_val = TFLE_NO_ERR ;
+ }
+ }
+ }
+
+ if( nmarks != 0 ) {
+ if ( channel->cur_drv->thw_inf.drv_info.drv_features & TDI_REV_FMK ) {
+ if( nmarks > (INT16) channel->cur_drv->cur_pos.fmks ) {
+ /*
+ We probably have one of two conditions:
+ 1. We are searching for the first set on tape.
+ 2. There is a mix of formats on the tape, so we
+ have to take it from the top.
+ */
+ ret_val = TF_NEED_REWIND_FIRST ;
+ } else {
+ * need_read = TRUE ;
+ ret_val = MoveFileMarks( channel, nmarks, BACKWARD ) ;
+ }
+ } else {
+ /* we can't go backwards without rewinding (ugh!) */
+ ret_val = TF_NEED_REWIND_FIRST ;
+ }
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: F31_CalculatePad
+
+ Description: For the given amount of data calculates the appropriate
+ pad value.
+
+ Modified: 10/10/1989 15:5:3
+
+ Returns: The amount of data to use as a pad.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+UINT16 F31_CalculatePad(
+ UINT16 blk_size, /* The block size of a device */
+ UINT32 data_size, /* The total data size */
+ UINT16 bytes_to_next_blk ) /* The bytes to the next block */
+{
+ UINT16 pad ;
+
+ data_size -= bytes_to_next_blk ;
+ if( ( pad = (UINT16)( data_size % blk_size ) ) != 0 ) {
+ pad = blk_size - pad ;
+ }
+
+ return( pad ) ;
+
+}
diff --git a/private/utils/ntbackup/src/mayn40rd.c b/private/utils/ntbackup/src/mayn40rd.c
new file mode 100644
index 000000000..9e14bf324
--- /dev/null
+++ b/private/utils/ntbackup/src/mayn40rd.c
@@ -0,0 +1,2431 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: mayn40rd.c
+
+ Description: Contains General and Read API's for Maynard's
+ 4.0 Format.
+
+ $Log: T:/LOGFILES/MAYN40RD.C_V $
+
+ Rev 1.74.1.12 27 Mar 1994 19:30:36 GREGG
+Don't map password strings to unicode no matter what.
+
+ Rev 1.74.1.11 16 Jan 1994 14:35:08 GREGG
+tape_password field in gvcb_data was being left uninitialized.
+
+ Rev 1.74.1.10 05 Jan 1994 10:56:18 BARRY
+Changed UINT16 parameters in Unicode mapping functions to INTs
+
+ Rev 1.74.1.9 22 Dec 1993 18:15:14 STEVEN
+don't cast INT16_PTR into an INT_PTR!!!
+
+ Rev 1.74.1.8 15 Dec 1993 18:15:24 GREGG
+Fixed warnings.
+
+ Rev 1.74.1.7 15 Dec 1993 17:22:36 GREGG
+Fixed method used to determine if we have the right tape in NewTape.
+
+ Rev 1.74.1.6 13 Dec 1993 19:25:52 GREGG
+Don't init 'make_streams_invisible' in StartRead if continuation.
+
+ Rev 1.74.1.5 24 Nov 1993 15:20:48 BARRY
+Clear up warnings for Unicode.
+
+ Rev 1.74.1.4 11 Nov 1993 15:42:26 GREGG
+Initialize the 'make_streams_invisible' environment flag in StartRead.
+
+ Rev 1.74.1.3 03 Nov 1993 11:45:20 GREGG
+Added string type conversion of tape name password if THDR type != SSET type.
+Translate file dblk attribs under DOS and OS2 to and from MTF.
+Modified F40_FindNextDBLK so all zeros won't pass as a valid DBLK, and
+changed call in F40_RdVOLB to look for any valid DBLK instead of only
+looking for a DIRB.
+
+ Rev 1.74.1.2 15 Sep 1993 14:15:10 GREGG
+Pass max of F40_LB_SIZE and sizeof DBLK to AllocChannelTmpBlks in case
+DBLK size is greater.
+
+ Rev 1.74.1.1 21 Aug 1993 03:37:54 GREGG
+Handle TF_NO_MORE_DATA return from MoveFileMarks in F40_MoveToVCB.
+
+ Rev 1.74.1.0 13 Aug 1993 00:13:32 GREGG
+Fixed free of same memory twice.
+
+ Rev 1.74 15 Jul 1993 19:31:08 GREGG
+Updated handling of ECC and future rev tapes, and set compressed_obj,
+vendor_id, and compressed, encrypted and future_rev bits in appropriate dblks.
+
+ Rev 1.73 04 Jul 1993 03:55:52 GREGG
+Added the function FindNextDBLK to get us past any streams or unknown DBLKs
+between the SSET and first VOLB, and between the first VOLB and the first
+DIRB. It is also used to skip between DBLKS in continuation tape processing.
+
+ Rev 1.72 25 Jun 1993 20:48:12 GREGG
+If EOS_AT_EOM in RdContTape, eat the SSET in the buffer.
+
+ Rev 1.71 21 Jun 1993 18:06:04 GREGG
+Ignore partial stream at EOM.
+
+ Rev 1.70 20 Jun 1993 16:16:38 GREGG
+Set compression algor in VCB to 0 since the field isn't in the SSET any more.
+
+ Rev 1.69 20 Jun 1993 16:08:32 GREGG
+Unicode fixes.
+
+ Rev 1.68 16 Jun 1993 19:57:58 GREGG
+Reset append flag in format environment whenever we get a new tape.
+
+ Rev 1.67 09 Jun 1993 04:27:46 GREGG
+Fixed handling of SSET only at BOT. Make partial VCB instead of ignoring it.
+
+ Rev 1.66 07 Jun 1993 23:58:36 GREGG
+Reset the buffer in RdContTape so we process ALL the continuation DBLKS.
+
+ Rev 1.65 04 Jun 1993 18:38:26 GREGG
+For OEM_MSOFT (ntbackup) - mark sets with encrypted or compressed data as
+image set so the UI wont try to restore the data. This is a kludge which
+will be fixed correctly when we have more time.
+
+ Rev 1.64 23 May 1993 19:15:52 GREGG
+Fix for EPR 294-0148 - Clear AT_MOS bit in MoveToVCB.
+
+ Rev 1.63 20 May 1993 08:53:36 GREGG
+Fix for EPR 357-0262 - Set the cur_drv pba_vcb in RdSSET.
+
+ Rev 1.62 17 May 1993 20:49:40 GREGG
+Added logic to deal with the fact that the app above tape format doesn't
+keep track of the lba of the vcb.
+
+ Rev 1.61 29 Apr 1993 22:26:50 GREGG
+Added StartRead to determine if we're about to read an 'old' set.
+
+ Rev 1.60 26 Apr 1993 11:45:40 GREGG
+Seventh in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Changed handling of EOM processing during non-OTC EOS processing.
+
+Matches CHANNEL.H 1.17, MAYN40RD.C 1.60, TFWRITE.C 1.63, MTF.H 1.5,
+ TFLUTILS.C 1.44, MTF10WDB.C 1.10, MTF10WT.C 1.9
+
+ Rev 1.59 26 Apr 1993 02:43:30 GREGG
+Sixth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Redefined attribute bits to match the spec.
+ - Eliminated unused/undocumented bits.
+ - Added code to translate bits on tapes that were written wrong.
+
+Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+
+ Rev 1.58 25 Apr 1993 20:12:32 GREGG
+Fifth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Store the corrupt stream number in the CFIL tape struct and the CFDB.
+
+Matches: MTF10WDB.C 1.9, FSYS.H 1.33, FSYS_STR.H 1.47, MAKECFDB.C 1.2,
+ BACK_OBJ.C 1.36, MAYN40RD.C 1.58
+
+ Rev 1.57 25 Apr 1993 18:52:36 GREGG
+Fourth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Parse the device name and volume name out of the FS supplied "volume
+ name", and write it to tape as separate fields.
+ - Generate the "volume name" the FS and UI expect out of the device
+ name and volume name on tape.
+ - Write all strings without NULL terminater, and translate them back
+ to NULL terminated strings on the read side.
+
+Matches: MTF10WDB.C 1.8, F40PROTO.H 1.26, OTC40WT.C 1.24, MAYN40.H 1.33,
+ MAYN40RD.C 1.57, OTC40RD.C 1.25
+
+ Rev 1.56 22 Apr 1993 03:31:28 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.55 19 Apr 1993 17:59:34 GREGG
+Second in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ Changes to write version 2 of OTC, and to read both versions.
+
+Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ mayn40.h 1.32, mtf.h 1.3.
+
+NOTE: There are additional changes to the catalogs needed to save the OTC
+ version and put it in the tpos structure before loading the OTC
+ File/Directory Detail. These changes are NOT listed above!
+
+ Rev 1.54 18 Apr 1993 17:21:12 GREGG
+Treat additional VOLBs in set as UDBs.
+
+ Rev 1.53 18 Apr 1993 00:41:06 GREGG
+First in a series of incremental changes to bring the translator in line
+with the MTF spec:
+ - Pass UINT8_PTR instead of CHAR_PTR to F40_SaveLclName.
+
+Matches: MTF10WDB.C 1.6, MTF10WT.C 1.6, MAYN40.H 1.31 and F40PROTO.H 1.25
+
+ Rev 1.52 14 Apr 1993 02:00:08 GREGG
+Fixes to deal with non-ffr tapes in ffr drives (i.e. EXB2200 in EXB5000).
+
+ Rev 1.51 08 Apr 1993 22:21:44 ZEIR
+Cleaned-up reverse file mark positioning for non-ffr drives (2200HS)
+
+ Rev 1.50 07 Apr 1993 16:18:18 GREGG
+Changed boolean in environment to one not used on write side (they collided).
+
+
+Rev 1.49 31 Mar 1993 17:37:24 GREGG
+Fix for continuation stream header not being 4 byte alligned.
+
+ Rev 1.48 24 Mar 1993 10:23:16 ChuckS
+Added code to handle device_name added to F40_ENV with 1.28+ of mayn40.h.
+
+ Rev 1.47 17 Mar 1993 14:47:46 GREGG
+This is Terri Lynn. Added Gregg's changes for switching a tape drive's
+block mode to match the block size of the current tape.
+
+
+ Rev 1.46 13 Mar 1993 17:39:40 GREGG
+Fixed F40_RdVarStream.
+
+ Rev 1.45 11 Mar 1993 17:28:42 GREGG
+Fixed RdMDB.
+
+ Rev 1.44 11 Mar 1993 08:17:24 STEVEN
+fix write protect detection
+
+ Rev 1.43 09 Mar 1993 18:15:12 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.42 24 Feb 1993 18:06:06 GREGG
+Changed return on no_data read in NewTape from TFLE_UNKNOWN_FMT to TF_INVALID_VCB.
+
+ Rev 1.41 05 Feb 1993 12:51:36 GREGG
+Fixed incorrect parameter being sent to SaveLclName for the tape password.
+Removed tons of tabs!!!
+
+ Rev 1.40 01 Feb 1993 17:50:18 chrish
+Change in F40_NewTape routine to correct tape security password problem for NT.
+
+ Rev 1.39 30 Jan 1993 11:43:54 DON
+Removed compiler warnings
+
+ Rev 1.38 28 Jan 1993 11:37:08 GREGG
+Changed error returned when the tape header is the only thing on the tape.
+
+ Rev 1.37 18 Jan 1993 16:52:14 BobR
+Added MOVE_ESA macro calls
+
+ Rev 1.36 21 Dec 1992 12:24:50 DAVEV
+Enabled for Unicode - IT WORKS!!
+
+ Rev 1.35 18 Dec 1992 17:08:14 HUNTER
+Fixes for Variable streams.
+
+ Rev 1.34 14 Dec 1992 12:26:14 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.33 11 Dec 1992 16:56:38 GREGG
+Fix to align stream headers on four byte boundaries.
+
+ Rev 1.32 07 Dec 1992 10:06:58 GREGG
+Changes for tf ver moved to SSET, otc ver added to SSET and links added to FDD.
+
+ Rev 1.31 02 Dec 1992 13:45:24 GREGG
+Unicode fixes - some CHAR_PTRs now UINT8_PTRs.
+
+ Rev 1.30 24 Nov 1992 18:15:56 GREGG
+Updates to match MTF document.
+
+ Rev 1.29 23 Nov 1992 10:03:40 GREGG
+Changes for path in stream.
+
+ Rev 1.28 18 Nov 1992 11:01:24 GREGG
+changed manner in which stream ID is referenced since it is now a UINT32.
+
+ Rev 1.27 12 Nov 1992 16:42:34 HUNTER
+Added code for frag stuff
+
+ Rev 1.26 09 Nov 1992 11:00:46 GREGG
+Merged in changes for new method of accessing OTC.
+
+ Rev 1.25 04 Nov 1992 13:05:20 HUNTER
+Fix for read.
+
+ Rev 1.24 03 Nov 1992 09:29:50 HUNTER
+various fixes for stream stuff
+
+ Rev 1.23 22 Oct 1992 10:40:34 HUNTER
+Major revision for New data Stream handling
+
+ Rev 1.22 25 Sep 1992 09:26:52 GREGG
+Added F40_RdEOSPadBlk.
+
+ Rev 1.21 22 Sep 1992 08:58:02 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.20 17 Aug 1992 08:37:54 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.19 12 Aug 1992 18:29:38 GREGG
+Added logic to use OTC when scanning before calling MoveToVCB.
+
+ Rev 1.18 06 Aug 1992 12:07:54 BURT
+Changes to support VBLKs, specifically with 1K logical
+block size.
+
+
+ Rev 1.17 04 Aug 1992 16:23:16 GREGG
+Burt's fixes for variable length streams.
+
+ Rev 1.16 30 Jul 1992 13:24:06 GREGG
+Changes to StartRead for EOM handling.
+
+ Rev 1.15 27 Jul 1992 12:39:46 GREGG
+Fixed more warnings...
+
+ Rev 1.14 24 Jul 1992 16:20:30 GREGG
+Removed warnings.
+
+ Rev 1.13 15 Jul 1992 12:28:42 GREGG
+Don't kill OTC files when write oper calls read translator in EOM processing.
+
+ Rev 1.12 01 Jul 1992 19:31:44 GREGG
+Converted to new date/time structure for dates written to tape.
+
+ Rev 1.11 09 Jun 1992 16:00:38 GREGG
+Changes to use F40_CalcChecksum instead of CalcChecksum.
+Removed merging of attributes.
+Set a boolean for continuation blocks.
+Removed setting of filemark_count.
+
+ Rev 1.10 02 Jun 1992 21:42:44 GREGG
+Handle switching to and from OTC based on operation type.
+
+ Rev 1.9 01 Jun 1992 17:10:32 GREGG
+Set disp_size in gen_data structure.
+
+ Rev 1.8 29 May 1992 15:09:02 GREGG
+Added setting of last access date, and misc. bug fixes.
+
+ Rev 1.7 20 May 1992 19:27:38 GREGG
+Added Steve's changes for 64 bit file system to the tip.
+
+ Rev 1.6 20 May 1992 19:16:22 GREGG
+Changes to support OTC read.
+
+ Rev 1.5 05 May 1992 11:26:50 GREGG
+Folded 'local_tape' global into environment, and fixed bugs in EOM handling.
+
+ Rev 1.4 28 Apr 1992 16:13:22 GREGG
+ROLLER BLADES - Changes to conform to new 4.0 EOM handling specifications.
+
+ Rev 1.3 17 Apr 1992 15:59:50 BURT
+Translated error return from Call to RdVOLB to FALSE. This is what
+the upper levels expect. This will cause and error to be reported
+instead of a perpetual request for inserting tape 'n'.
+
+
+ Rev 1.2 16 Apr 1992 17:39:14 BURT
+Integrated my EOM processing changes with Gregg's OTC code.
+Changed structure of code to be closer to coding standards.
+
+
+ Rev 1.1 05 Apr 1992 17:18:26 GREGG
+ROLLER BLADES - Initial OTC integration.
+
+ Rev 1.0 25 Mar 1992 20:26:54 GREGG
+Initial revision.
+
+**/
+#include <string.h>
+#include <malloc.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "tbe_defs.h"
+#include "datetime.h"
+#include "drive.h"
+#include "channel.h"
+#include "mayn40.h"
+#include "f40proto.h"
+#include "transutl.h"
+#include "fsys.h"
+#include "tloc.h"
+#include "lwprotos.h"
+#include "tfldefs.h"
+#include "translat.h"
+#include "tfl_err.h"
+#include "sx.h"
+#include "lw_data.h"
+#include "minmax.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genstat.h"
+#include "dddefs.h"
+#include "dil.h"
+
+
+/* Internal Function Prototypes */
+
+static VOID _near SetStandFields( CHANNEL_PTR, STD_DBLK_DATA_PTR,
+ MTF_DB_HDR_PTR, BUF_PTR ) ;
+
+static INT16 F40_RdEOSPadBlk( CHANNEL_PTR, BUF_PTR ) ;
+static INT16 F40_RdVarStream( CHANNEL_PTR, BUF_PTR ) ;
+static VOID F40_FindNextDBLK( BUF_PTR, UINT16, UINT8_PTR ) ;
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_CopyAndTerminate
+
+ Description: This function copys size bytes from src to dest, adds
+ a NULL terminator at the end, and sets the dest pointer
+ past the end of the terminated string.
+
+ Returns: New string size
+
+ Notes: This is a VERY specialized function for translating
+ strings on tape to strings the UI can understand.
+
+**/
+UINT16 F40_CopyAndTerminate(
+ UINT8_PTR *dest,
+ UINT8_PTR src,
+ UINT16 size,
+ UINT8 src_str_type,
+ UINT8 dest_str_type )
+{
+ INT new_size ;
+
+ if( src_str_type == dest_str_type ) {
+ memcpy( *dest, src, size ) ;
+ *dest += size ;
+ if( src_str_type == BEC_UNIC_STR ) {
+ *((WCHAR UNALIGNED *)(*dest)) = L'\0' ;
+ (*dest) += sizeof( WCHAR ) ;
+ new_size = size + sizeof( WCHAR ) ;
+ } else {
+ *((ACHAR_PTR)(*dest)) = '\0' ;
+ (*dest)++ ;
+ new_size = size + 1 ;
+ }
+ } else if( src_str_type == BEC_UNIC_STR ) {
+ new_size = size / sizeof( WCHAR ) ;
+ mapUnicToAnsiNoNull( (WCHAR_PTR)src, (ACHAR_PTR)(*dest), '_',
+ size, &new_size ) ;
+ *dest += new_size ;
+ *((ACHAR_PTR)(*dest)) = '\0' ;
+ (*dest)++ ;
+ new_size++ ;
+ } else {
+ new_size = size * sizeof( WCHAR ) ;
+ mapAnsiToUnicNoNull( (ACHAR_PTR)src, (WCHAR_PTR)(*dest),
+ size, &new_size ) ;
+ *dest += new_size ;
+ *((WCHAR UNALIGNED *)(*dest)) = L'\0' ;
+ (*dest) += sizeof( WCHAR ) ;
+ new_size += sizeof( WCHAR ) ;
+ }
+ return( new_size ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_StartRead
+
+ Description: This is our hook before a read operation starts.
+ At this point, all we need it for is to determine
+ what version of OTC we have, and set up an indicator
+ as to whether this is an "old" MTF tape.
+
+ Returns: TFLE_NO_ERR (we don't do a whole lot!)
+
+ Notes: If the OTC version number is 0, it means the VCB was
+ not cataloged at the start of the operation, so we also
+ set this in RdSSET and WtSSET. If this doesn't cover
+ all the bases, we're #@$%ed.
+
+**/
+INT16 F40_StartRead( CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+
+ if( !( IsChannelStatus( channel, CH_CONTINUING ) ) ) {
+ cur_env->make_streams_invisible = FALSE ;
+ }
+
+ if( channel->ui_tpos->tape_cat_ver != 0 ) {
+ if( channel->ui_tpos->tape_cat_ver == 1 ) {
+ cur_env->old_tape = TRUE ;
+ } else {
+ cur_env->old_tape = FALSE ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_Initialize
+
+
+ Description: This routine is used to allocate and initialize
+ the format 4.0 environment structure.
+
+ Returns: TRUE if allocated & init'd OK
+
+ Notes:
+
+**/
+INT16 F40_Initialize(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR env_ptr ;
+ BUF_REQ new_reqs ;
+ BUF_REQ_PTR bufreq_ptr ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ if( channel->fmt_env == NULL ) {
+
+ if( !IsChannelStatus( channel, CH_CONTINUING ) ) {
+ /* Allocate the temporary DBLK storage area in the channel */
+ if( ( ret_val = AllocChannelTmpBlks( channel, (UINT)( MAX( F40_LB_SIZE, sizeof( DBLK ) ) ) ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+
+ if( ( env_ptr = calloc( 1, sizeof( F40_ENV ) ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+
+ memset( env_ptr, 0, sizeof( F40_ENV ) ) ;
+ if( ( env_ptr->util_buff = calloc( F40_INIT_UTIL_BUFF_SIZE, 1 ) ) == NULL ) {
+ free( env_ptr ) ;
+ return( TFLE_NO_MEMORY ) ;
+ }
+ env_ptr->util_buff_size = F40_INIT_UTIL_BUFF_SIZE ;
+
+ if( ( env_ptr->dir_links =
+ calloc( F40_INIT_DIR_LINKS_SIZE, sizeof( long ) ) ) == NULL ) {
+
+ free( env_ptr->util_buff ) ;
+ free( env_ptr ) ;
+ return( TFLE_NO_MEMORY ) ;
+ }
+ env_ptr->dir_links_size = F40_INIT_DIR_LINKS_SIZE ;
+
+ channel->fmt_env = env_ptr ;
+ channel->lb_size = F40_LB_SIZE ;
+
+ env_ptr->unaligned_stream = FALSE ;
+ }
+
+ /* if we're in write mode, we've got to add dblkmap storage */
+
+ if( channel->mode == TF_WRITE_CONTINUE &&
+ !IsChannelStatus( channel, CH_CONTINUING ) ) {
+
+ bufreq_ptr = BM_ListRequirements( &channel->buffer_list ) ;
+ BM_ClearRequirements( &new_reqs ) ;
+ new_reqs.b.min_size = F40_DEFAULT_AUX_BUFFER_SIZE ;
+ new_reqs.b.incr_size = F40_AUX_BUFFER_INCR_SIZE ;
+
+ if( BM_AddRequirements( bufreq_ptr, &new_reqs ) != BR_NO_ERR ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ ret_val = BM_ReSizeList( &channel->buffer_list ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_DeInitialize
+
+ Description: Returns environment memory
+
+ Returns: Nothing.
+
+ Notes:
+
+**/
+VOID F40_DeInitialize(
+ VOID_PTR *fmt_env )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( *fmt_env ) ;
+
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ if( cur_env->tape_name != NULL ) {
+ free( cur_env->tape_name ) ;
+ }
+ if( cur_env->tape_password != NULL ) {
+ free( cur_env->tape_password ) ;
+ }
+ if( cur_env->vol_name != NULL ) {
+ free( cur_env->vol_name ) ;
+ }
+ if( cur_env->machine_name != NULL ) {
+ free( cur_env->machine_name ) ;
+ }
+ if ( cur_env->device_name != NULL ) {
+ free( cur_env->device_name ) ;
+ }
+ if( cur_env->util_buff != NULL ) {
+ free( cur_env->util_buff ) ;
+ }
+ if( cur_env->otc_buff != NULL ) {
+ free( cur_env->otc_buff ) ;
+ }
+ if( cur_env->dir_links != NULL ) {
+ free( cur_env->dir_links ) ;
+ }
+ free( *fmt_env ) ;
+ *fmt_env = NULL ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_GetBlkType
+
+ Description: Returns a UINT16 value that represents the
+ 4 character block type in the passed dblk header.
+
+ Returns: The Block type number.
+
+ Notes: We don't expect to see a VOLB at this point, because we
+ only write one per set, and we handle it transparently.
+ So if we see one here someone else wrote this tape, and
+ we're just going to treat it as a UDB.
+
+**/
+UINT16 F40_GetBlkType( MTF_DB_HDR_PTR cur_hdr )
+{
+ INT i ;
+
+ static UINT8 *blk_type[] = { MTF_TAPE_N, MTF_SSET_N, MTF_DIRB_N,
+ MTF_FILE_N, MTF_ESET_N, MTF_EOTM_N,
+ F40_IMAG_N, MTF_CFIL_N, MTF_ESPB_N,
+ F40_DBDB_N, NULL } ;
+
+ static UINT16 blk_id[] = { F40_TAPE_IDI, F40_SSET_IDI, F40_DIRB_IDI,
+ F40_FILE_IDI, F40_ESET_IDI, F40_EOTM_IDI,
+ F40_IMAG_IDI, F40_CFIL_IDI, F40_ESPB_IDI,
+ F40_DBDB_IDI, 0 } ;
+
+ i = 0 ;
+ while( blk_type[i] != NULL ) {
+ if( memcmp( blk_type[i], cur_hdr->block_type, 4 ) == 0 ) {
+ return( blk_id[i] ) ;
+ }
+ ++i ;
+ }
+
+ /* F40_ types are equal to BT defines */
+ return( BT_UDB ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_DetBlkType
+
+ Description: Determines the type of Descriptor Block for the given
+ buffer.
+
+ Returns: TFLE_xxx error code.
+
+ Notes: This routine assumes the buffer is at least
+ min_siz_for_dblk bytes long.
+**/
+INT16 F40_DetBlkType(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16_PTR blk_type )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ MTF_DB_HDR_PTR cur_hdr ;
+ MTF_DB_HDR temp ;
+ MTF_STREAM_PTR currentStream ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ if( !cur_env->unaligned_stream ) {
+ BM_UpdCnts( buffer, (UINT16)PadToBoundary( BM_NextByteOffset( buffer ), 4 ) ) ;
+ cur_hdr = (MTF_DB_HDR_PTR)( BM_NextBytePtr( buffer ) ) ;
+ } else {
+ memcpy( (UINT8_PTR)&temp, (UINT8_PTR)BM_NextBytePtr( buffer ),
+ sizeof( MTF_DB_HDR ) ) ;
+ cur_hdr = &temp ;
+ cur_env->unaligned_stream = FALSE ;
+ }
+ currentStream = ( MTF_STREAM_PTR ) cur_hdr ;
+
+ if( BM_BytesFree( buffer ) < sizeof( MTF_STREAM ) ) {
+
+ cur_env->frag_cnt = BM_BytesFree( buffer ) ;
+ memcpy( &cur_env->frag[0], BM_NextBytePtr( buffer ), cur_env->frag_cnt ) ;
+ BM_UpdCnts( buffer, cur_env->frag_cnt ) ;
+ *blk_type = BT_MDB ;
+ return( TFLE_NO_ERR ) ;
+
+ } else if ( cur_env->frag_cnt ) {
+
+ memcpy( &cur_env->frag[cur_env->frag_cnt], BM_NextBytePtr( buffer ),
+ ( sizeof( MTF_STREAM ) - cur_env->frag_cnt ) ) ;
+ if( cur_env->make_streams_invisible ) {
+ *blk_type = BT_MDB ;
+ } else {
+ *blk_type = BT_STREAM ;
+ }
+ BM_UpdCnts( buffer, ( UINT16 ) ( sizeof( MTF_STREAM ) - cur_env->frag_cnt ) ) ;
+ return( TFLE_NO_ERR ) ;
+
+ } else if( ( *blk_type = F40_GetBlkType( cur_hdr ) ) == BT_VCB &&
+ !( cur_hdr->block_attribs & MTF_DB_CONT_BIT ) &&
+ BM_BytesFree( buffer ) == channel->lb_size ) {
+
+ /* This is the big lie! All we managed to fit on this tape was
+ the SSET, so were going to pretend it's not here (nobody said
+ software development was pretty!).
+ */
+ *blk_type = BT_CVCB ;
+ }
+
+
+ /* Verify checksums */
+ if( *blk_type == BT_UDB &&
+ ( F40_CalcChecksum( ( UINT16_PTR ) currentStream, F40_STREAM_CHKSUM_LEN ) == currentStream->chksum ) ) {
+
+ if( cur_env->make_streams_invisible ) {
+ *blk_type = BT_MDB ;
+ } else {
+ *blk_type = BT_STREAM ;
+ }
+
+ } else if( F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN ) != cur_hdr->hdr_chksm ) {
+ *blk_type = BT_HOSED ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_SizeofTBLK
+
+ Description: returns the size of a tape block.
+
+ Returns: the size in bytes
+
+ Notes: IT IS ASSUMED THAT THE BUFFER PASSED TO THIS FUNCTION
+ CONTAINS A VALID 4.0 FORMAT TAPE BLOCK.
+
+**/
+UINT16 F40_SizeofTBLK(
+ VOID_PTR buffer )
+{
+ (void)buffer ;
+ return( F40_LB_SIZE ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_NewTape
+
+ Description: Get us past the tape header, extracting any necessary
+ information.
+
+ Returns: TFLE_xxx error code.
+
+ Notes:
+
+**/
+INT16 F40_NewTape(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN_PTR need_read )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ MTF_TAPE_PTR cur_tape ;
+ UINT8_PTR vstr_ptr ;
+ BOOLEAN ret_val = TFLE_NO_ERR ;
+ BOOLEAN write_mode = FALSE ;
+ BOOLEAN resized_buff ;
+ RET_BUF myret ;
+
+ /* Always start with the assumption you can append to the tape */
+ lw_fmtdescr[channel->cur_fmt].attributes |= APPEND_SUPPORTED ;
+
+ if( ( ( channel->mode & ~0x8000 ) == TF_WRITE_OPERATION ) ||
+ ( ( channel->mode & ~0x8000 ) == TF_WRITE_APPEND ) ) {
+ write_mode = TRUE ;
+ }
+
+ /* Preserve the needed information from this tape header. */
+ cur_tape = (MTF_TAPE_PTR)( BM_NextBytePtr( buffer ) ) ;
+ vstr_ptr = (UINT8_PTR)( cur_tape ) ;
+
+ /* If this is a future rev tape, we don't want to try to process it! */
+ if( cur_tape->tf_major_ver != FORMAT_VER_MAJOR ) {
+ return( TF_FUTURE_REV_MTF ) ;
+ }
+
+ /* If tape has software ECC, we don't want to try to process it! */
+ if( cur_tape->ecc_algorithm != ECC_NONE ) {
+ return( TF_MTF_ECC_TAPE ) ;
+ }
+
+ /* If continuing, make sure this is the continuation tape */
+ if( !write_mode && IsChannelStatus( channel, CH_CONTINUING ) ) {
+ if( cur_tape->tape_id_number != (UINT32)channel->ui_tpos->tape_id ||
+ cur_tape->tape_seq_number != (UINT16)channel->ui_tpos->tape_seq_num ) {
+ return( TF_WRONG_TAPE ) ;
+ }
+ }
+
+ /* Set the logical block size in the channel */
+ channel->lb_size = cur_tape->logical_block_size ;
+
+ cur_env->tape_hdr = *cur_tape ;
+
+ if( cur_tape->block_header.block_attribs & MTF_DB_SM_EXISTS ) {
+ if( cur_tape->block_header.block_attribs & MTF_DB_FDD_ALLOWED ) {
+ cur_env->max_otc_level = TCL_FULL ;
+ } else {
+ cur_env->max_otc_level = TCL_PARTIAL ;
+ }
+ } else {
+ cur_env->max_otc_level = TCL_NONE ;
+ }
+
+ /* Don't allow append if the logical block size doesn't match what we
+ write.
+ */
+ if( channel->lb_size != F40_LB_SIZE ) {
+ lw_fmtdescr[channel->cur_fmt].attributes &= ~APPEND_SUPPORTED ;
+ }
+
+ /* Make sure we can use the catalogs */
+ if( cur_tape->block_header.block_attribs & MTF_DB_FDD_ALT_PART ) {
+ cur_env->max_otc_level = TCL_PARTIAL ;
+ }
+ if( ( cur_tape->block_header.block_attribs & MTF_DB_SM_ALT_OVERWRITE ) ||
+ ( cur_tape->block_header.block_attribs & MTF_DB_SM_ALT_APPEND ) ) {
+
+ lw_fmtdescr[channel->cur_fmt].attributes &= ~APPEND_SUPPORTED ;
+ cur_env->max_otc_level = TCL_NONE ;
+ }
+ if( cur_tape->tape_catalog_type != MTF10_OTC ) {
+ lw_fmtdescr[channel->cur_fmt].attributes &= ~APPEND_SUPPORTED ;
+ cur_env->max_otc_level = TCL_NONE ;
+ }
+ if( !SupportBlkPos( channel->cur_drv ) ||
+ !SupportFastEOD( channel->cur_drv ) ||
+ !SupportRevFmk( channel->cur_drv ) ) {
+
+ cur_env->max_otc_level = TCL_NONE ;
+ }
+
+ /* This sick little conditional checks to see if the tape name is NULL
+ terminated (which is only true on "old" tapes). If it's there, we
+ pretend it isn't. Note that there are no "old" UNICODE tapes.
+ */
+ if( cur_tape->block_header.string_type == BEC_ANSI_STR &&
+ cur_tape->tape_name.data_size != 0 &&
+ *( vstr_ptr + cur_tape->tape_name.data_offset +
+ cur_tape->tape_name.data_size - 1 ) == 0 ) {
+
+ cur_env->tape_hdr.tape_name.data_size-- ;
+ }
+
+ if( ( ret_val = F40_SaveLclName( &cur_env->tape_name,
+ (UINT8_PTR)( vstr_ptr + cur_tape->tape_name.data_offset ),
+ &cur_env->tape_name_size,
+ &cur_env->tape_name_alloc,
+ cur_env->tape_hdr.tape_name.data_size ) ) != TFLE_NO_ERR ) {
+
+ return( ret_val ) ;
+ }
+ if( ( ret_val = F40_SaveLclName( &cur_env->tape_password,
+ (UINT8_PTR)( vstr_ptr + cur_tape->tape_password.data_offset ),
+ &cur_env->tape_password_size,
+ &cur_env->tape_password_alloc,
+ cur_tape->tape_password.data_size ) ) != TFLE_NO_ERR ) {
+
+ return( ret_val ) ;
+ }
+
+ /* We need to make sure that we have eaten the File mark */
+
+ if( buffer->read_error != GEN_ERR_ENDSET ) {
+
+ DRIVER_CALL( channel->cur_drv->drv_hdl,
+ TpReadEndSet( channel->cur_drv->drv_hdl, (INT16)1, (INT16)FORWARD ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+ }
+
+ channel->cur_drv->cur_pos.fmks = 1 ; /* always 1 ! */
+
+ /* NOTE:
+
+ The code below (in the "if 0") used to pretend that an SSET by
+ itself was not there. This turned out to be a bad idea since we
+ could overwrite the tape thinking it was blank! We still call
+ ReadABuff to catch the odd tape with a tape header only and report
+ is as foreign, but then we treat the lone SSET like any other short
+ set. F40_RdSSET will fake out that there is no Volume, Device or
+ Machine Name when generating the VCB, and thats all we care about
+ in the VOLB anyway.
+ */
+
+#if 0
+
+ /* Here we make the call to ReadABuff ourselves so we can catch some
+ edge conditions in EOM processing where all we write is an SSET
+ before the filemark on the continuation tape. If this is the case,
+ and we're not continuing, we're going to pretend this set isn't here
+ at all.
+ */
+ if( ( ret_val = ReadABuff( channel, FALSE, &resized_buff ) ) != TFLE_NO_ERR ) {
+ if( ret_val == TF_NO_MORE_DATA ) {
+ ret_val = TF_INVALID_VCB ;
+ }
+ return( ret_val ) ;
+ }
+ if( BM_BytesFree( buffer ) <= channel->lb_size &&
+ !IsChannelStatus( channel, CH_CONTINUING ) ) {
+
+ if( F40_RdException( channel, BM_ReadError( buffer ) ) != FMT_EXC_EOS ) {
+ return( TFLE_TAPE_INCONSISTENCY ) ;
+ }
+ *need_read = TRUE ;
+ } else {
+ *need_read = FALSE ;
+ }
+
+#endif
+
+ /* Here we make the call to ReadABuff ourselves so we can catch tapes
+ with only a tape header on them and report them as foreign.
+ */
+ if( ( ret_val = ReadABuff( channel, FALSE, &resized_buff ) ) != TFLE_NO_ERR ) {
+ if( ret_val == TF_NO_MORE_DATA ) {
+ ret_val = TF_INVALID_VCB ;
+ }
+ return( ret_val ) ;
+ }
+
+ *need_read = FALSE ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdVOLB
+
+ Description: Format 4.0 VOLB translator.
+
+ Returns: TFLE_xxx error code.
+
+ Notes:
+
+**/
+INT16 F40_RdVOLB(
+ BUF_PTR buffer,
+ VOID_PTR env_ptr,
+ BOOLEAN_PTR cont_volb,
+ UINT8_PTR str_type )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)env_ptr ;
+ MTF_VOL_PTR cur_volb ;
+ UINT8_PTR vstr_ptr ;
+ INT16 ret_val ;
+
+ cur_volb = (MTF_VOL_PTR)( BM_NextBytePtr( buffer ) ) ;
+ vstr_ptr = (UINT8_PTR)( BM_NextBytePtr( buffer ) ) ;
+ *cont_volb = (BOOLEAN)( cur_volb->block_hdr.block_attribs & MTF_DB_CONT_BIT ) ;
+ *str_type = cur_volb->block_hdr.string_type ;
+
+ if( ( ret_val = F40_SaveLclName( &cur_env->vol_name,
+ (UINT8_PTR)( vstr_ptr +
+ cur_volb->volume_name.data_offset ),
+ &cur_env->vol_name_size,
+ &cur_env->vol_name_alloc,
+ cur_volb->volume_name.data_size ) )
+ == TFLE_NO_ERR ) {
+
+ if( ( ret_val = F40_SaveLclName( &cur_env->machine_name,
+ (UINT8_PTR)( vstr_ptr +
+ cur_volb->machine_name.data_offset ),
+ &cur_env->machine_name_size,
+ &cur_env->machine_name_alloc,
+ cur_volb->machine_name.data_size ) )
+ == TFLE_NO_ERR ) {
+
+ ret_val = F40_SaveLclName( &cur_env->device_name,
+ (UINT8_PTR)( vstr_ptr +
+ cur_volb->device_name.data_offset ),
+ &cur_env->device_name_size,
+ &cur_env->device_name_alloc,
+ cur_volb->device_name.data_size ) ;
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ F40_FindNextDBLK( buffer, cur_env->tape_hdr.logical_block_size, NULL ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdSSET
+
+ Description: Format 4.0 SSET translator.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 F40_RdSSET(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ MTF_SSET_PTR cur_sset ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_VCB_DATA gvcb_data ;
+ UINT16 tmp_filter ;
+ UINT8_PTR vstr_ptr ;
+ UINT8_PTR buff_ptr ;
+ UINT8 str_type ;
+ BOOLEAN cont_volb ;
+ INT16 ret_val ;
+ DATE_TIME backup_date ;
+
+ cur_sset = (MTF_SSET_PTR)( BM_NextBytePtr( buffer ) ) ;
+ vstr_ptr = (UINT8_PTR)( cur_sset ) ;
+
+ /* Figure out the OTC level for the set. If the catalog version is
+ greater than the one we write, we won't be able to read the FDD,
+ but we'll still be able to read the set map.
+ */
+ if( cur_env->max_otc_level == TCL_FULL ) {
+ if( ( cur_sset->block_hdr.block_attribs & MTF_DB_FDD_EXISTS ) &&
+ ( cur_sset->tape_cat_ver <= TAPE_CATALOG_VER ) ) {
+
+ cur_env->cur_otc_level = TCL_FULL ;
+ } else {
+ cur_env->cur_otc_level = TCL_PARTIAL ;
+ }
+ } else {
+ cur_env->cur_otc_level = cur_env->max_otc_level ;
+ }
+
+ if( cur_env->tape_hdr.tape_catalog_type == MTF10_OTC &&
+ cur_sset->tape_cat_ver == 1 ) {
+
+ cur_env->old_tape = TRUE ;
+ } else {
+ cur_env->old_tape = FALSE ;
+ }
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_VCB, (CREATE_DBLK_PTR)&gvcb_data ) ;
+ gvcb_data.std_data.dblk = cur_dblk ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gvcb_data.std_data, &cur_sset->block_hdr, buffer ) ;
+
+ /* Tape catalog information. The Set Map entry is the only place
+ where the first two fields are valid.
+ */
+ gvcb_data.set_cat_pba = 0L ;
+ gvcb_data.set_cat_tape_seq_num = 0 ;
+ gvcb_data.set_cat_info_valid = FALSE ;
+ gvcb_data.on_tape_cat_level = cur_env->cur_otc_level ;
+ gvcb_data.on_tape_cat_ver = cur_sset->tape_cat_ver ;
+
+ /* General VCB info */
+
+ gvcb_data.tape_id = cur_env->tape_hdr.tape_id_number ;
+ gvcb_data.tape_seq_num = cur_env->tape_hdr.tape_seq_number ;
+ gvcb_data.tf_major_ver = (CHAR)cur_env->tape_hdr.tf_major_ver ;
+ gvcb_data.tf_minor_ver = (CHAR)cur_sset->tf_minor_ver ;
+ gvcb_data.bset_num = cur_sset->backup_set_number ;
+ gvcb_data.sw_major_ver = (CHAR)cur_sset->software_ver_mjr ;
+ gvcb_data.sw_minor_ver = (CHAR)cur_sset->software_ver_mnr ;
+ gvcb_data.password_encrypt_alg = cur_sset->password_encryption_algor ;
+ gvcb_data.data_encrypt_alg = cur_sset->data_encryption_algor ;
+ gvcb_data.vendor_id = cur_sset->software_vendor_id ;
+
+ /* Set the VCB attributes. Note that if this is an "old" tape,
+ the attibute bits were being set wrong, and need to be translated.
+ */
+ if( cur_env->old_tape ) {
+ gvcb_data.std_data.attrib = 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->sset_attribs & OLD_VCB_COPY_SET )
+ ? VCB_COPY_SET : 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->sset_attribs & OLD_VCB_NORMAL_SET )
+ ? VCB_NORMAL_SET : 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->sset_attribs & OLD_VCB_DIFFERENTIAL_SET )
+ ? VCB_DIFFERENTIAL_SET : 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->sset_attribs & OLD_VCB_INCREMENTAL_SET )
+ ? VCB_INCREMENTAL_SET : 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->sset_attribs & OLD_VCB_DAILY_SET )
+ ? VCB_DAILY_SET : 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->sset_attribs & OLD_VCB_ARCHIVE_BIT )
+ ? VCB_ARCHIVE_BIT : 0 ;
+ } else {
+ gvcb_data.std_data.attrib = cur_sset->sset_attribs ;
+ }
+
+ /* Clear other vendor's vendor specific bits */
+ gvcb_data.std_data.attrib &= 0x00FFFFFF ;
+
+ /* Set our own vendor specific bits */
+ gvcb_data.std_data.attrib |= ( cur_sset->tf_minor_ver != FORMAT_VER_MINOR )
+ ? VCB_FUTURE_VER_BIT : 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->block_hdr.block_attribs & MTF_DB_COMPRESS_BIT )
+ ? VCB_COMPRESSED_BIT : 0 ;
+ gvcb_data.std_data.attrib |= ( cur_sset->block_hdr.block_attribs & MTF_DB_ENCRYPT_BIT )
+ ? VCB_ENCRYPTED_BIT : 0 ;
+
+ /* The Variable Length Strings */
+
+ if( cur_env->util_buff == NULL ) {
+ if( ( cur_env->util_buff = calloc( F40_INIT_UTIL_BUFF_SIZE, 1 ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ cur_env->util_buff_size = F40_INIT_UTIL_BUFF_SIZE ;
+ }
+
+ buff_ptr = cur_env->util_buff ;
+
+ gvcb_data.tape_password = (CHAR_PTR)cur_env->tape_password ;
+ gvcb_data.tape_password_size = cur_env->tape_password_size ;
+
+ gvcb_data.bset_password =
+ (CHAR_PTR)( (INT8_PTR)vstr_ptr + cur_sset->backup_set_password.data_offset ) ;
+ gvcb_data.bset_password_size = cur_sset->backup_set_password.data_size ;
+
+ /* Tape Name */
+ gvcb_data.tape_name = (CHAR_PTR)buff_ptr ;
+ if( cur_env->tape_name_size != 0 ) {
+ gvcb_data.tape_name_size =
+ F40_CopyAndTerminate( &buff_ptr, cur_env->tape_name,
+ cur_env->tape_name_size,
+ cur_env->tape_hdr.block_header.string_type,
+ cur_sset->block_hdr.string_type ) ;
+ } else {
+ gvcb_data.tape_name_size = 0 ;
+ }
+
+ /* If this is an "old" tape the strings below are NULL terminated.
+ If it's a "new" tape, we have to copy the string to another data
+ area and NULL terminate them before passing them to the UI.
+ Note that the tape name is NEVER NULL terminated because we have to
+ strip it off before we store it to maintain consistancy.
+ */
+ if( cur_env->old_tape ) {
+ /* This is an old tape with NULL terminated strings. */
+
+ gvcb_data.bset_name = (CHAR_PTR)( vstr_ptr + cur_sset->backup_set_name.data_offset ) ;
+ gvcb_data.bset_name_size = cur_sset->backup_set_name.data_size ;
+ gvcb_data.bset_descript = (CHAR_PTR)( vstr_ptr + cur_sset->backup_set_description.data_offset ) ;
+ gvcb_data.bset_descript_size = cur_sset->backup_set_description.data_size ;
+ gvcb_data.user_name = (CHAR_PTR)( vstr_ptr + cur_sset->user_name.data_offset ) ;
+ gvcb_data.user_name_size = cur_sset->user_name.data_size ;
+
+ } else {
+ /* This is a new tape, copy the strings into a buffer and NULL
+ terminate them.
+ */
+
+ /* Backup Set Name */
+ gvcb_data.bset_name = (CHAR_PTR)buff_ptr ;
+ if( cur_sset->backup_set_name.data_size != 0 ) {
+ gvcb_data.bset_name_size =
+ F40_CopyAndTerminate( &buff_ptr, vstr_ptr +
+ cur_sset->backup_set_name.data_offset,
+ cur_sset->backup_set_name.data_size,
+ cur_sset->block_hdr.string_type,
+ cur_sset->block_hdr.string_type ) ;
+ } else {
+ gvcb_data.bset_name_size = 0 ;
+ }
+
+ /* Backup Set Description */
+ gvcb_data.bset_descript = (CHAR_PTR)buff_ptr ;
+ if( cur_sset->backup_set_description.data_size != 0 ) {
+ gvcb_data.bset_descript_size =
+ F40_CopyAndTerminate( &buff_ptr, vstr_ptr +
+ cur_sset->backup_set_description.data_offset,
+ cur_sset->backup_set_description.data_size,
+ cur_sset->block_hdr.string_type,
+ cur_sset->block_hdr.string_type ) ;
+ } else {
+ gvcb_data.bset_descript_size = 0 ;
+ }
+
+ /* User Name */
+ gvcb_data.user_name = (CHAR_PTR)buff_ptr ;
+ if( cur_sset->user_name.data_size != 0 ) {
+ gvcb_data.user_name_size =
+ F40_CopyAndTerminate( &buff_ptr, vstr_ptr +
+ cur_sset->user_name.data_offset,
+ cur_sset->user_name.data_size,
+ cur_sset->block_hdr.string_type,
+ cur_sset->block_hdr.string_type ) ;
+ } else {
+ gvcb_data.user_name_size = 0 ;
+ }
+ }
+
+ TapeDateToDate( &backup_date, &cur_sset->backup_date ) ;
+ gvcb_data.date = &backup_date ;
+
+ /* Set up Position Info */
+ gvcb_data.pba = U64_Lsw( cur_sset->physical_block_address ) ;
+ channel->cur_drv->cur_pos.pba_vcb = U64_Lsw( cur_sset->physical_block_address ) ;
+
+ /* This is saved so we know whether or not the tape has position
+ info stored on it in case they do an append.
+ */
+ cur_env->last_sset_pba = U64_Lsw( cur_sset->physical_block_address ) ;
+
+ gvcb_data.short_m_name = (CHAR_PTR)buff_ptr ;
+ gvcb_data.short_m_name_size = 0 ;
+
+ BM_SetBytesFree( buffer, BM_BytesFree( buffer ) +
+ BM_NextByteOffset( buffer ) ) ;
+ BM_SetNextByteOffset( buffer, 0 ) ;
+ F40_FindNextDBLK( buffer, channel->lb_size, MTF_VOLB_N ) ;
+
+ /* If we only have an SSET we either have an EOM at EOS continuation,
+ or a short set generated by another application (since we write an
+ SSET and VOLB at the very least). So we'll fake out the volume
+ info in a way which the UI can deal with.
+ */
+ if( BM_BytesFree( buffer ) != 0 ) {
+
+ if( ( ret_val = F40_RdVOLB( buffer, channel->fmt_env, &cont_volb,
+ &str_type ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+
+ if( !cont_volb ) {
+
+ /* At this point we have a continuation SSET but not a
+ continuation VOLB, so we're going to pretend that this
+ is a brand new set.
+ */
+
+ gvcb_data.std_data.continue_obj = FALSE ;
+ }
+
+ /* If this is an "old" tape the strings below are NULL terminated.
+ If it's a "new" tape, we have to copy the strings to another
+ data area and NULL terminate them before passing them to the UI.
+ */
+ if( cur_env->old_tape ) {
+ /* This is an old tape with NULL terminated strings. */
+
+ gvcb_data.volume_name = (CHAR_PTR)cur_env->vol_name ;
+ gvcb_data.volume_name_size = cur_env->vol_name_size ;
+ gvcb_data.machine_name = (CHAR_PTR)cur_env->machine_name ;
+ gvcb_data.machine_name_size = cur_env->machine_name_size ;
+ gvcb_data.device_name = (CHAR_PTR)cur_env->device_name ;
+ gvcb_data.dev_name_size = cur_env->device_name_size ;
+
+ } else {
+ /* This is a new tape, copy the strings into a buffer and
+ NULL terminate them.
+ */
+
+ /* Device Name */
+ gvcb_data.device_name = (CHAR_PTR)buff_ptr ;
+ if( cur_env->device_name_size != 0 ) {
+ gvcb_data.dev_name_size =
+ F40_CopyAndTerminate( &buff_ptr,
+ cur_env->device_name,
+ cur_env->device_name_size,
+ str_type, str_type ) ;
+ } else {
+ gvcb_data.dev_name_size = 0 ;
+ }
+
+ /* Volume Name */
+ gvcb_data.volume_name = (CHAR_PTR)buff_ptr ;
+ if( cur_env->vol_name_size != 0 ) {
+ gvcb_data.volume_name_size =
+ F40_CopyAndTerminate( &buff_ptr,
+ cur_env->vol_name,
+ cur_env->vol_name_size,
+ str_type, str_type ) ;
+ } else {
+ gvcb_data.volume_name_size = 0 ;
+ }
+
+ /* Machine Name */
+ gvcb_data.machine_name = (CHAR_PTR)buff_ptr ;
+ if( cur_env->machine_name_size != 0 ) {
+ gvcb_data.machine_name_size =
+ F40_CopyAndTerminate( &buff_ptr,
+ cur_env->machine_name,
+ cur_env->machine_name_size,
+ str_type, str_type ) ;
+ } else {
+ gvcb_data.machine_name_size = 0 ;
+ }
+
+ /* Other than in the NLM where they already fixed this, the
+ UI expects to see a volume name of the form
+ "<device name><space><volume name>", and NO DEVICE NAME.
+ We do this by pointing the volume name at the device name,
+ and replacing the NULL terminator on the device name with
+ a space.
+ */
+
+#if !defined( OS_NLM )
+
+ if( gvcb_data.dev_name_size != 0 ) {
+ gvcb_data.volume_name = gvcb_data.device_name ;
+ gvcb_data.volume_name_size += gvcb_data.dev_name_size ;
+ if( gvcb_data.volume_name_size != gvcb_data.dev_name_size ) {
+ vstr_ptr = (UINT8_PTR)gvcb_data.volume_name ;
+ if( str_type == BEC_ANSI_STR ) {
+ vstr_ptr += gvcb_data.dev_name_size - 1 ;
+ *((ACHAR *)vstr_ptr) = (ACHAR)' ' ;
+ } else {
+ vstr_ptr += gvcb_data.dev_name_size - 2 ;
+ *((WCHAR *)vstr_ptr) = (WCHAR)' ' ;
+ }
+ }
+ gvcb_data.dev_name_size = 0 ;
+ }
+
+#endif
+
+ }
+
+ if( gvcb_data.std_data.continue_obj ) {
+ /* Fix for the app not knowing the LBA for a continuation VCB */
+ channel->cross_set = cur_sset->backup_set_number ;
+ channel->cross_lba = U64_Lsw( cur_sset->block_hdr.logical_block_address ) ;
+ }
+
+ } else {
+ gvcb_data.device_name = TEXT( "" ) ;
+ gvcb_data.dev_name_size = sizeof( CHAR ) ;
+ gvcb_data.volume_name = TEXT( "" ) ;
+ gvcb_data.volume_name_size = sizeof( CHAR ) ;
+ gvcb_data.machine_name = TEXT( "" ) ;
+ gvcb_data.machine_name_size = sizeof( CHAR ) ;
+ }
+
+ /* Tell the file system to do its thing */
+ tmp_filter = FS_CreateGenVCB( cur_fsys, &gvcb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdDIRB
+
+ Description: Translates a tape format DIRB blk into a OS DBLK.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 F40_RdDIRB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ MTF_DIR_PTR cur_dirb = (MTF_DIR_PTR)( BM_NextBytePtr( buffer ) ) ;
+ F40_DBDB_PTR cur_dbdb = (F40_DBDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_DDB_DATA gddb_data ;
+ UINT16 tmp_filter ;
+ UINT8_PTR vstr_ptr = (UINT8_PTR)cur_dirb ;
+ DATE_TIME dummy_date ;
+ DATE_TIME create_date ;
+ DATE_TIME last_mod_date ;
+ DATE_TIME backup_date ;
+ DATE_TIME last_access_date ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_DDB, (CREATE_DBLK_PTR)&gddb_data ) ;
+ gddb_data.std_data.dblk = cur_dblk ;
+
+ if( memcmp( F40_DBDB_N, BM_NextBytePtr( buffer ), 4 ) == 0 ) {
+ /* This is a Database DBLK, but the boys upstairs don't want to
+ know about such silly things! So we lie and call it a DDB to
+ get it passed on to the File System. The File System can tell
+ what it really is too, and will deal with it appropriatly.
+ */
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gddb_data.std_data, &cur_dirb->block_hdr, buffer ) ;
+
+ gddb_data.std_data.attrib = cur_dbdb->database_attribs ;
+
+ /* Clear all vendor specific bits */
+ gddb_data.std_data.attrib &= 0x00FFFFFF ;
+
+ /* Set our vendor specific bit that says this is a DBDB */
+ gddb_data.std_data.attrib |= DIR_IS_REALLY_DB ;
+
+ gddb_data.path_name =
+ (CHAR_PTR)( (INT8_PTR)vstr_ptr + cur_dbdb->database_name.data_offset ) ;
+ gddb_data.path_size = (INT16)cur_dbdb->database_name.data_size ;
+
+ TapeDateToDate( &backup_date, &cur_dbdb->backup_date ) ;
+ gddb_data.backup_date = &backup_date ;
+
+ /* DBDBs don't have the following date fields */
+ memset( &dummy_date, 0, sizeof( dummy_date ) ) ;
+ gddb_data.creat_date = &dummy_date ;
+ gddb_data.mod_date = &dummy_date ;
+ gddb_data.access_date = &dummy_date ;
+
+ } else {
+
+ /* Standard DDB structure stuffing */
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gddb_data.std_data, &cur_dirb->block_hdr, buffer ) ;
+
+ /* Set the DIR attributes. Note that if this is an "old" tape,
+ the attibute bits were being set wrong, and need to be translated.
+ */
+ if( cur_env->old_tape ) {
+
+ gddb_data.std_data.attrib = cur_dirb->directory_attribs &
+ ~( OLD_DIR_EMPTY_BIT | OLD_DIR_PATH_IN_STREAM_BIT ) ;
+
+ gddb_data.std_data.attrib |= ( cur_dirb->directory_attribs & OLD_DIR_EMPTY_BIT )
+ ? DIR_EMPTY_BIT : 0 ;
+ gddb_data.std_data.attrib |= ( cur_dirb->directory_attribs & OLD_DIR_PATH_IN_STREAM_BIT )
+ ? DIR_PATH_IN_STREAM_BIT : 0 ;
+ } else {
+ gddb_data.std_data.attrib = cur_dirb->directory_attribs ;
+ }
+
+ /* Clear all vendor specific bits */
+ gddb_data.std_data.attrib &= 0x00FFFFFF ;
+
+ /* Set the non-defaulted DDB specific fields */
+ if( ! ( cur_dirb->directory_attribs & DIR_PATH_IN_STREAM_BIT ) ) {
+ gddb_data.path_name =
+ (CHAR_PTR)( (INT8_PTR)vstr_ptr + cur_dirb->directory_name.data_offset ) ;
+ gddb_data.path_size = (INT16)cur_dirb->directory_name.data_size ;
+ } else {
+ gddb_data.path_name = NULL ;
+ gddb_data.path_size = 0 ;
+ }
+
+ TapeDateToDate( &create_date, &cur_dirb->create_date ) ;
+ gddb_data.creat_date = &create_date ;
+ TapeDateToDate( &last_mod_date, &cur_dirb->last_mod_date ) ;
+ gddb_data.mod_date = &last_mod_date ;
+ TapeDateToDate( &backup_date, &cur_dirb->backup_date ) ;
+ gddb_data.backup_date = &backup_date ;
+ TapeDateToDate( &last_access_date, &cur_dirb->last_access_date ) ;
+ gddb_data.access_date = &last_access_date ;
+ }
+
+ /* Tell the file system to do its thing */
+ tmp_filter = FS_CreateGenDDB( cur_fsys, &gddb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ channel->lst_did = cur_dirb->block_hdr.control_block_id ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdFILE
+
+ Description: Translates a tape format FILE blk into a OS DBLK.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 F40_RdFILE(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ MTF_FILE_PTR cur_file = (MTF_FILE_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_FDB_DATA gfdb_data ;
+ UINT16 tmp_filter ;
+ UINT8_PTR vstr_ptr = (UINT8_PTR)cur_file ;
+ UINT8_PTR buff_ptr ;
+ DATE_TIME create_date ;
+ DATE_TIME last_mod_date ;
+ DATE_TIME backup_date ;
+ DATE_TIME last_access_date ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_FDB, (CREATE_DBLK_PTR)&gfdb_data ) ;
+ gfdb_data.std_data.dblk = cur_dblk ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gfdb_data.std_data, &cur_file->block_hdr, buffer ) ;
+
+ /* Set the FILE attributes. Note that if this is an "old" tape,
+ the attibute bits were being set wrong, and need to be translated.
+ */
+ if( cur_env->old_tape ) {
+
+ gfdb_data.std_data.attrib = cur_file->file_attributes &
+ ~( OLD_FILE_IN_USE_BIT | OLD_FILE_NAME_IN_STREAM_BIT ) ;
+
+ gfdb_data.std_data.attrib |= ( cur_file->file_attributes & OLD_FILE_IN_USE_BIT )
+ ? FILE_IN_USE_BIT : 0 ;
+ gfdb_data.std_data.attrib |= ( cur_file->file_attributes & OLD_FILE_NAME_IN_STREAM_BIT )
+ ? FILE_NAME_IN_STREAM_BIT : 0 ;
+ } else {
+ gfdb_data.std_data.attrib = cur_file->file_attributes ;
+ if( cur_file->block_hdr.machine_os_id == FS_PC_DOS ||
+ cur_file->block_hdr.machine_os_id == FS_PC_OS2 ) {
+
+ gfdb_data.std_data.attrib &= 0xFFFF00FF ;
+ gfdb_data.std_data.attrib |=
+ ( cur_file->file_attributes & DOS_FILE_READONLY_BIT )
+ ? OBJ_READONLY_BIT : 0 ;
+ gfdb_data.std_data.attrib |=
+ ( cur_file->file_attributes & DOS_FILE_HIDDEN_BIT )
+ ? OBJ_HIDDEN_BIT : 0 ;
+ gfdb_data.std_data.attrib |=
+ ( cur_file->file_attributes & DOS_FILE_SYSTEM_BIT )
+ ? OBJ_SYSTEM_BIT : 0 ;
+ gfdb_data.std_data.attrib |=
+ ( cur_file->file_attributes & DOS_FILE_MODIFIED_BIT )
+ ? OBJ_MODIFIED_BIT : 0 ;
+ gfdb_data.std_data.attrib &= 0xFFFFFF00 ;
+ }
+ }
+
+ /* If this is an "old" tape the file name is NULL terminated. If it's
+ a "new" tape, we have to copy the string to another data area and
+ NULL terminate it before passing it to the UI.
+ */
+ if( cur_env->old_tape ) {
+ /* This is an old tape with NULL terminated strings. */
+
+ gfdb_data.fname = (CHAR_PTR)( vstr_ptr + cur_file->file_name.data_offset ) ;
+ gfdb_data.fname_size = cur_file->file_name.data_size ;
+
+ } else {
+ /* This is a new tape, copy the file name into a buffer and NULL
+ terminate it.
+ */
+
+ if( cur_env->util_buff == NULL ) {
+ if( ( cur_env->util_buff = calloc( F40_INIT_UTIL_BUFF_SIZE, 1 ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ cur_env->util_buff_size = F40_INIT_UTIL_BUFF_SIZE ;
+ }
+
+ buff_ptr = cur_env->util_buff ;
+
+ gfdb_data.fname = (CHAR_PTR)buff_ptr ;
+ if( cur_file->file_name.data_size != 0 ) {
+ gfdb_data.fname_size =
+ F40_CopyAndTerminate( &buff_ptr, vstr_ptr +
+ cur_file->file_name.data_offset,
+ cur_file->file_name.data_size,
+ cur_file->block_hdr.string_type,
+ cur_file->block_hdr.string_type ) ;
+ } else {
+ gfdb_data.fname_size = 0 ;
+ }
+ }
+
+ TapeDateToDate( &create_date, &cur_file->create_date ) ;
+ gfdb_data.creat_date = &create_date ;
+ TapeDateToDate( &last_mod_date, &cur_file->last_mod_date ) ;
+ gfdb_data.mod_date = &last_mod_date ;
+ TapeDateToDate( &backup_date, &cur_file->backup_date ) ;
+ gfdb_data.backup_date = &backup_date ;
+ TapeDateToDate( &last_access_date, &cur_file->last_access_date ) ;
+ gfdb_data.access_date = &last_access_date ;
+
+ /* Tell the file system to do its thing */
+ tmp_filter = FS_CreateGenFDB( cur_fsys, &gfdb_data ) ;
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ channel->lst_fid = cur_file->block_hdr.control_block_id ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdIMAG
+
+ Description: Translates a tape format IMAG blk into a OS DBLK.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 F40_RdIMAG(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ F40_IMAG_PTR cur_imag = (F40_IMAG_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_IDB_DATA gidb_data ;
+ UINT16 tmp_filter ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_IDB, (CREATE_DBLK_PTR)&gidb_data ) ;
+ gidb_data.std_data.dblk = cur_dblk ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gidb_data.std_data, &cur_imag->block_hdr,
+ buffer ) ;
+
+ gidb_data.std_data.attrib = cur_imag->image_attribs ;
+
+ /* Set the non-defaulted IDB specific fields */
+ gidb_data.pname =
+ (CHAR_PTR)( (UINT8_PTR)cur_imag + cur_imag->partition_name.data_offset ) ;
+ gidb_data.pname_size = cur_imag->partition_name.data_size ;
+
+ gidb_data.byte_per_sector = (UINT16)cur_imag->bytes_in_sector ;
+ gidb_data.num_sect = cur_imag->partition_no_of_sector ;
+ gidb_data.sys_ind = cur_imag->partition_sys_ind ;
+ gidb_data.hhead = cur_imag->no_of_heads ;
+ gidb_data.hsect = (UINT16)cur_imag->no_of_sectors ;
+ gidb_data.rsect = cur_imag->relative_sector_no ;
+
+ /* Setup Total Data Size */
+ /* ***** 64 BIT ****
+ channel->tdata_size = cur_imag->block_hdr.number_of_data_bytes ;
+ */
+
+ tmp_filter = FS_CreateGenIDB( cur_fsys, &gidb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdCFIL
+
+ Description: Translates a tape format CFIL blk into a OS DBLK.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 F40_RdCFIL(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ MTF_CFIL_PTR cur_cfil = (MTF_CFIL_PTR)( BM_NextBytePtr( buffer ) ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ GEN_CFDB_DATA gcfdb_data ;
+ INT16 tmp_filter ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( cur_fsys, BT_CFDB, (CREATE_DBLK_PTR)&gcfdb_data ) ;
+ gcfdb_data.std_data.dblk = cur_dblk ;
+
+ SetStandFields( channel, &gcfdb_data.std_data, &cur_cfil->block_hdr, buffer ) ;
+
+ /* Set the CFIL attributes. Note that if this is an "old" tape,
+ the attibute bits were being set wrong, and need to be translated.
+ */
+ if( cur_env->old_tape ) {
+ gcfdb_data.std_data.attrib = 0 ;
+ gcfdb_data.std_data.attrib |= ( cur_cfil->corrupt_file_attribs & OLD_CFDB_LENGTH_CHANGE_BIT )
+ ? CFDB_LENGTH_CHANGE_BIT : 0 ;
+ gcfdb_data.std_data.attrib |= ( cur_cfil->corrupt_file_attribs & OLD_CFDB_UNREADABLE_BLK_BIT )
+ ? CFDB_UNREADABLE_BLK_BIT : 0 ;
+ gcfdb_data.std_data.attrib |= ( cur_cfil->corrupt_file_attribs & OLD_CFDB_DEADLOCK_BIT )
+ ? CFDB_DEADLOCK_BIT : 0 ;
+
+ } else {
+ gcfdb_data.std_data.attrib = cur_cfil->corrupt_file_attribs ;
+ }
+
+ gcfdb_data.corrupt_offset = U64_Lsw( cur_cfil->stream_offset ) ;
+ gcfdb_data.stream_number = cur_cfil->corrupt_stream_number ;
+
+ /* Tell the file system to do its thing */
+ tmp_filter = FS_CreateGenCFDB( cur_fsys, &gcfdb_data ) ;
+
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdEOSPadBlk
+
+ Description: We know if we see this DBLK type that there is no more
+ real data in the set, and that the data area this block
+ is intended to pad out is in this buffer (it is the left
+ over area of a physical block and the buffer size must
+ be an even multiple of the pbysical block size). So we
+ set all the data size stuff to 0, and set the buffer
+ offset to the end of data. the read loop will check for
+ another DBLK, and when it doesn't find one it will report
+ that we are at the end of set.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+static INT16 F40_RdEOSPadBlk(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ channel->retranslate_size = CH_NO_RETRANSLATE_40 ;
+
+ /* We know that is the last DBLK in the buffer, and that the data area
+ it is padding out is the remainder of the data in this buffer.
+ */
+ BM_UpdCnts( channel->cur_buff, BM_BytesFree( channel->cur_buff ) ) ;
+ return( TFLE_NO_ERR ) ;
+ (VOID)buffer;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdVarStream
+
+ Description: This is actually used for Variable length streams
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+
+INT16 F40_RdVarStream( CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR currentEnv = (F40_ENV_PTR)( channel->fmt_env ) ;
+ MTF_STREAM_PTR currentStream = (MTF_STREAM_PTR)BM_NextBytePtr( buffer ) ;
+
+
+ channel->current_stream.size = currentStream->data_length ;
+ BM_UpdCnts( buffer, sizeof( MTF_STREAM ) ) ;
+ SetChannelStatus( channel, CH_DATA_PHASE ) ;
+
+ if( currentStream->tf_attribs & STREAM_VAR_END ) {
+ currentEnv->make_streams_invisible = FALSE ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdVarStream
+
+ Description: This is actually used for Variable length streams
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 F40_RdMDB( CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR currentEnv = (F40_ENV_PTR)( channel->fmt_env ) ;
+
+
+ if( currentEnv->frag_cnt && BM_BytesFree( buffer ) == 0 ) {
+ return( TFLE_NO_ERR ) ;
+ }
+
+ if( currentEnv->make_streams_invisible ) {
+ return( F40_RdVarStream( channel, buffer ) ) ;
+ } else {
+ return( F40_RdEOSPadBlk( channel, buffer ) ) ;
+ }
+}
+
+
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdStream
+
+ Description: Reads a Stream Header
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+
+INT16 F40_RdStream( CHANNEL_PTR Channel,
+ BUF_PTR Buffer )
+{
+ F40_ENV_PTR currentEnv = (F40_ENV_PTR)( Channel->fmt_env ) ;
+ MTF_STREAM_PTR currentStream = (MTF_STREAM_PTR)( BM_NextBytePtr( Buffer ) ) ;
+ STREAM_INFO_PTR channelStream = &Channel->current_stream ;
+
+
+
+ if( currentEnv->frag_cnt ) {
+ currentStream = ( MTF_STREAM_PTR ) &currentEnv->frag[0] ;
+ currentEnv->frag_cnt = 0 ;
+ } else {
+ BM_UpdCnts( Buffer, sizeof( MTF_STREAM ) ) ;
+ }
+
+
+ /* Reset Filter */
+ if( currentStream->id == STRM_PAD ) {
+ SetChannelStatus( Channel, CH_SKIP_CURRENT_STREAM ) ;
+ } else {
+ ClrChannelStatus( Channel, CH_SKIP_CURRENT_STREAM ) ;
+ }
+
+ channelStream->id = currentStream->id ;
+ channelStream->fs_attrib = currentStream->fs_attribs ;
+ channelStream->tf_attrib = currentStream->tf_attribs ;
+ channelStream->size = currentStream->data_length ;
+
+ if( currentStream->tf_attribs & STREAM_VARIABLE ) {
+ currentEnv->make_streams_invisible = TRUE ;
+ } else {
+ currentEnv->make_streams_invisible = FALSE ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+
+}
+
+
+
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdUDB
+
+ Description: Translates a Unknown Desciptor Block and throws away
+ the data.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 F40_RdUDB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_UDB_PTR cur_udb = (F40_UDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ GEN_UDB_DATA gudb_data ;
+ INT16 tmp_filter ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_UDB, (CREATE_DBLK_PTR)&gudb_data ) ;
+ gudb_data.std_data.dblk = channel->cur_dblk ;
+
+ /* Set the non-defaulted standard fields for the FS */
+ SetStandFields( channel, &gudb_data.std_data, &cur_udb->block_hdr, buffer ) ;
+
+ tmp_filter = FS_CreateGenUDB( channel->cur_fsys, &gudb_data ) ;
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdContTape
+
+ Description: Sets up the continuation tape to pass over the updated bs.
+
+ Returns: BOOLEAN indicating Success or Failure
+
+ Notes: THIS ASSUMES THAT THE BUFFER POINTER IS POINTING DIRECTLY
+ AFTER THE CONT. VCB. TO THE NEXT TBLK.
+
+ FURTHER, IT IS ASSUMED THE CURRENT BUFFER HAS BEEN READ
+ FROM THE NEXT TAPE IN THE TAPE SEQUENCE ( THIS SHOULD
+ HAVE BEEN DONE BY "Tape Positioning".
+
+**/
+BOOLEAN F40_RdContTape(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ MTF_DB_HDR_PTR cur_hdr ;
+ MTF_STREAM_PTR cur_strm ;
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+
+ BM_SetBytesFree( buffer, BM_BytesFree( buffer ) +
+ BM_NextByteOffset( buffer ) ) ;
+ BM_SetNextByteOffset( buffer, 0 ) ;
+
+ if( cur_env->tape_hdr.block_header.block_attribs & MTF_DB_EOS_AT_EOM_BIT ) {
+ BM_SetNextByteOffset( buffer, BM_BytesFree( buffer ) ) ;
+ BM_SetBytesFree( buffer, 0 ) ;
+ return( TRUE ) ;
+ }
+
+ cur_hdr = (MTF_DB_HDR_PTR)( BM_NextBytePtr( buffer ) ) ;
+
+ /* Set the lba of the beginning of the buffer and adjust the running lba */
+ BM_SetBeginningLBA( buffer, ( U64_Lsw( cur_hdr->logical_block_address ) -
+ ( BM_NextByteOffset( buffer ) / channel->lb_size ) ) ) ;
+
+ channel->running_lba = U64_Lsw( cur_hdr->logical_block_address ) +
+ ( BM_BytesFree( buffer ) / channel->lb_size ) ;
+
+ /* Find The last DBLK, we were operating on */
+ while( cur_hdr->control_block_id != channel->eom_id ) {
+ F40_FindNextDBLK( buffer, channel->lb_size, NULL ) ;
+ cur_hdr = (MTF_DB_HDR_PTR)( BM_NextBytePtr( buffer ) ) ;
+ }
+
+ /* Okay we have a live one, let's update the counts */
+ if( cur_hdr->control_block_id == channel->eom_id ) {
+ BM_UpdCnts( buffer, cur_hdr->offset_to_data ) ;
+
+ /* If the next block is a stream header, and it's a continuation,
+ just skip it.
+ */
+ cur_strm = (MTF_STREAM_PTR)BM_NextBytePtr( buffer ) ;
+ if( F40_CalcChecksum( (UINT16_PTR)cur_strm, F40_STREAM_CHKSUM_LEN )
+ == cur_strm->chksum ) {
+ if( cur_strm->tf_attribs & STREAM_CONTINUE ) {
+ BM_UpdCnts( buffer, sizeof( MTF_STREAM ) ) ;
+ }
+ }
+ }
+ return( TRUE ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: SetStandFields
+
+ Description: Sets up the standard fields in translation to dblks.
+
+ Returns: Nothing.
+
+ Notes:
+
+**/
+static VOID _near SetStandFields(
+ CHANNEL_PTR channel,
+ STD_DBLK_DATA_PTR std_data,
+ MTF_DB_HDR_PTR cur_hdr,
+ BUF_PTR buffer )
+{
+ UINT8_PTR os_info = (UINT8_PTR)cur_hdr ;
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)channel->fmt_env ;
+
+ /* New Block, reset filter */
+ ClrChannelStatus( channel, CH_SKIP_ALL_STREAMS ) ;
+
+ std_data->tape_seq_num = cur_env->tape_hdr.tape_seq_number ;
+
+ std_data->os_id = ( UINT8 ) cur_hdr->machine_os_id ;
+ std_data->os_ver = ( UINT8 ) cur_hdr->machine_os_version ;
+
+ std_data->string_type = cur_hdr->string_type ;
+
+ std_data->blkid = cur_hdr->control_block_id ;
+ std_data->lba = U64_Lsw( cur_hdr->logical_block_address ) ;
+
+ std_data->continue_obj = (BOOLEAN)( cur_hdr->block_attribs & MTF_DB_CONT_BIT ) ;
+ std_data->compressed_obj = (BOOLEAN)( cur_hdr->block_attribs & MTF_DB_COMPRESS_BIT ) ;
+
+ /* Calculate Total Data & Pad Sizes */
+ std_data->disp_size = cur_hdr->displayable_size ;
+
+ channel->retranslate_size = CH_NO_RETRANSLATE_40 ;
+
+ BM_UpdCnts( buffer, cur_hdr->offset_to_data ) ;
+
+ /* There is only one case where the offset to data isn't on a 4 byte
+ boundary, and that's when we're pointing at a continuation stream
+ header. If this is the case, we set a flag so DetBlkType won't
+ try to line up on a boundary before looking for the header.
+ */
+ if( cur_hdr->offset_to_data % 4 != 0 ) {
+ msassert( std_data->continue_obj ) ;
+ cur_env->unaligned_stream = TRUE ;
+ }
+
+ /* Get OS Specific info */
+ std_data->os_info = (BYTE_PTR)( (INT8_PTR)os_info + cur_hdr->os_specific_data.data_offset ) ;
+ std_data->os_info_size = cur_hdr->os_specific_data.data_size ;
+
+ /* we're not ready for this yet! need to calc FMs from Bset# first
+ *
+ *
+ * if ( BM_ReadError( buffer ) == GEN_ERR_ENDSET ) {
+ * channel->cur_drv->cur_pos.fmks++ ;
+ * }
+ *
+ */
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_RdException
+
+ Description: Determines the meaning of an exception passed to it.
+
+ Returns: UINT16 - FMT_EXC_xxx
+
+ Notes:
+
+**/
+UINT16 F40_RdException(
+ CHANNEL_PTR channel,
+ INT16 exception )
+{
+ BUF_PTR tmpBUF ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ UINT16 ret_val = FMT_EXC_HOSED ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)channel->fmt_env ;
+ RET_BUF myret ;
+ UINT16 blk_type ;
+
+ /* If we had a partial stream at EOM, ignore it. */
+ cur_env->frag_cnt = 0 ;
+
+ if( exception != GEN_ERR_ENDSET ) {
+ return( FMT_EXC_HOSED ) ;
+ }
+
+ if( ( tmpBUF = BM_Get( &channel->buffer_list ) ) == NULL ) {
+ if( ( tmpBUF = BM_GetVCBBuff( &channel->buffer_list ) ) == NULL ) {
+ msassert( FALSE ) ;
+ return( FMT_EXC_HOSED ) ;
+ }
+ }
+
+ if( TpRead( drv_hdl, BM_XferBase( tmpBUF ),
+ (UINT32)BM_XferSize( tmpBUF ) ) == FAILURE ) {
+ BM_Put( tmpBUF ) ;
+ return( FMT_EXC_HOSED ) ;
+ }
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+
+ if ( myret.len_got < sizeof( MTF_DB_HDR ) ||
+ ( myret.gen_error != GEN_NO_ERR &&
+ myret.gen_error != GEN_ERR_ENDSET ) ) {
+
+ BM_Put( tmpBUF ) ;
+ return( FMT_EXC_HOSED ) ;
+ }
+
+ if( F40_DetBlkType( channel, tmpBUF, &blk_type ) != TFLE_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( FMT_EXC_HOSED ) ;
+ }
+
+ switch( blk_type ) {
+
+ case F40_ESET_IDI:
+ /* ESET may have associated data. If it does, we eat it! */
+ if( myret.gen_error == GEN_NO_ERR ) {
+ if( TpReadEndSet( drv_hdl, (INT16)1, (INT16)FORWARD ) == FAILURE ) {
+ BM_Put( tmpBUF ) ;
+ return( FMT_EXC_HOSED ) ;
+ }
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if( myret.gen_error != GEN_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( FMT_EXC_HOSED ) ;
+ }
+ }
+ ret_val = FMT_EXC_EOS ;
+ break ;
+
+ case F40_EOTM_IDI:
+ ret_val = FMT_EXC_EOM ;
+ break ;
+
+ default:
+ ret_val = FMT_EXC_HOSED ;
+ break ;
+ }
+
+ curDRV->cur_pos.fmks++ ;
+ BM_Put( tmpBUF ) ;
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_MoveToVCB
+
+ Description: Positions the tape in front of the SSET for the set
+ a relative offset from the current set.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 F40_MoveToVCB(
+ CHANNEL_PTR channel,
+ INT16 number,
+ BOOLEAN_PTR need_read,
+ BOOLEAN really_move )
+{
+ INT16 nmarks = 0 ; /* number of file marks to move */
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN at_mos = IsPosBitSet( channel->cur_drv, AT_MOS ) != 0UL ;
+ BOOLEAN at_eos = ( ! at_mos ) && IsPosBitSet( channel->cur_drv, AT_EOS ) ;
+
+ msassert( number <= 1 ) ;
+
+ if ( really_move ) { /* this is a no-op for us */
+ *need_read = FALSE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ ClrPosBit( channel->cur_drv, AT_MOS ) ;
+
+ if ( number == 1 ) { /* move forward */
+ *need_read = TRUE ;
+ if( at_eos ) {
+ ret_val = TFLE_NO_ERR ;
+ } else {
+ ret_val = MoveFileMarks( channel, (INT16)1, (INT16)FORWARD ) ;
+ if( ret_val == TFLE_NO_ERR || ret_val == TFLE_UNEXPECTED_EOM ) {
+ ret_val = F40_RdException( channel, (INT16)GEN_ERR_ENDSET ) ;
+ if( ret_val == FMT_EXC_HOSED ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ } else if( ret_val == FMT_EXC_EOM ) {
+ ret_val = TF_NEED_NEW_TAPE ;
+ } else {
+ SetPosBit( channel->cur_drv, AT_EOS ) ;
+ ret_val = TFLE_NO_ERR ;
+ }
+ } else if ( ret_val == TF_NO_MORE_DATA ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ }
+ }
+
+ } else if ( number < 0 ) { /* move backward */
+ nmarks = ( number * (INT16)(-2) ) + (INT16)1 ;
+ if( at_eos ) {
+ nmarks += 2 ;
+ }
+ } else { /* current */
+ if( at_mos ) {
+ nmarks = 1 ;
+ } else if( at_eos ) {
+ nmarks = 3 ;
+ } else { /* we're already there. */
+ *need_read = FALSE ;
+ ret_val = TFLE_NO_ERR ;
+ }
+ }
+
+ if( nmarks != 0 ) {
+ if( channel->cur_drv->thw_inf.drv_info.drv_features & TDI_REV_FMK ) {
+ if( nmarks >= (INT16) channel->cur_drv->cur_pos.fmks ) {
+ /* We probably have one of two conditions:
+ 1. We are searching for the first set on tape.
+ 2. There is a mix of formats on the tape, so we
+ have to take it from the top.
+ */
+ ret_val = TF_NEED_REWIND_FIRST ;
+ } else {
+ *need_read = TRUE ;
+ ret_val = MoveFileMarks( channel, nmarks, (INT16)BACKWARD ) ;
+ /* MoveFileMarks is DERANGED - kludge filemark count */
+ /* 'cause we're not allowed to FIX MoveFileMarks properly! */
+ ++channel->cur_drv->cur_pos.fmks ;
+ }
+ } else {
+ /* we can't go backwards without rewinding (ugh!) */
+ ret_val = TF_NEED_REWIND_FIRST ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: DateToTapeDate
+
+ Description: Translates the Date/Time structure used by the upper
+ layers into a compressed format for writing to tape.
+
+ Returns: Nothing
+
+ Notes: Assumes integers stored in Intel format
+
+**/
+VOID DateToTapeDate(
+ MTF_DATE_TIME_PTR tape_date, /* O - Dest Tape Date/Time struct */
+ DATE_TIME_PTR date ) /* I - Source Date/Time struct */
+{
+ UINT16 temp ;
+
+ if( !date->date_valid ) {
+ tape_date->dt_field[2] = 0 ;
+ } else {
+ temp = date->year << 2 ;
+ tape_date->dt_field[0] = ((UINT8_PTR)&temp)[1] ;
+ tape_date->dt_field[1] = ((UINT8_PTR)&temp)[0] ;
+ temp = date->month << 6 ;
+ tape_date->dt_field[1] |= ((UINT8_PTR)&temp)[1] ;
+ tape_date->dt_field[2] = ((UINT8_PTR)&temp)[0] ;
+ temp = date->day << 1 ;
+ tape_date->dt_field[2] |= ((UINT8_PTR)&temp)[0] ;
+ temp = date->hour << 4 ;
+ tape_date->dt_field[2] |= ((UINT8_PTR)&temp)[1] ;
+ tape_date->dt_field[3] = ((UINT8_PTR)&temp)[0] ;
+ temp = date->minute << 6 ;
+ tape_date->dt_field[3] |= ((UINT8_PTR)&temp)[1] ;
+ tape_date->dt_field[4] = ((UINT8_PTR)&temp)[0] ;
+ temp = date->second ;
+ tape_date->dt_field[4] |= ((UINT8_PTR)&temp)[0] ;
+ }
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: TapeDateToDate
+
+ Description: Translates the compressed Tape Date/Time structure
+ stored on tape to the Date/Time structure used by the
+ upper layers.
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+VOID TapeDateToDate(
+ DATE_TIME_PTR date, /* O - Dest Date/Time struct */
+ MTF_DATE_TIME_PTR tape_date ) /* I - Source Tape Date/Time struct */
+{
+ UINT8 temp[2] ;
+
+ if( tape_date->dt_field[2] == 0 ) {
+ date->date_valid = 0 ;
+ } else {
+ date->date_valid = 1 ;
+ temp[0] = tape_date->dt_field[1] ;
+ temp[1] = tape_date->dt_field[0] ;
+ date->year = *((UINT16_PTR)temp) >> 2 ;
+ temp[0] = tape_date->dt_field[2] ;
+ temp[1] = tape_date->dt_field[1] ;
+ date->month = (*((UINT16_PTR)temp) >> 6) & 0x000F ;
+ date->day = (*((UINT16_PTR)temp) >> 1) & 0x001F ;
+ temp[0] = tape_date->dt_field[3] ;
+ temp[1] = tape_date->dt_field[2] ;
+ date->hour = (*((UINT16_PTR)temp) >> 4) & 0x001F ;
+ temp[0] = tape_date->dt_field[4] ;
+ temp[1] = tape_date->dt_field[3] ;
+ date->minute = (*((UINT16_PTR)temp) >> 6) & 0x003F ;
+ date->second = *((UINT16_PTR)temp) & 0x003F ;
+ }
+}
+
+
+static VOID F40_FindNextDBLK(
+ BUF_PTR buffer,
+ UINT16 lb_size,
+ UINT8_PTR blk_type )
+{
+ MTF_DB_HDR_PTR cur_hdr ;
+ UINT8 temp[4] ;
+
+ if( blk_type == NULL ) {
+ temp[0] = temp[1] = temp[2] = temp[3] = 0 ;
+ }
+
+ BM_UpdCnts( buffer, lb_size ) ;
+ cur_hdr = (MTF_DB_HDR_PTR)BM_NextBytePtr( buffer ) ;
+ while( BM_BytesFree( buffer ) >= lb_size ) {
+ if( F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN )
+ == cur_hdr->hdr_chksm ) {
+ if( ( blk_type == NULL &&
+ memcmp( temp, cur_hdr->block_type, 4 ) != 0 )) {
+ return ;
+ }
+ if ( ( blk_type == NULL) ||
+ memcmp( blk_type, cur_hdr->block_type, 4 ) == 0 ) {
+
+ return ;
+ }
+ }
+ BM_UpdCnts( buffer, lb_size ) ;
+ cur_hdr = (MTF_DB_HDR_PTR)BM_NextBytePtr( buffer ) ;
+ }
+}
+
diff --git a/private/utils/ntbackup/src/memang32.c b/private/utils/ntbackup/src/memang32.c
new file mode 100644
index 000000000..094792c23
--- /dev/null
+++ b/private/utils/ntbackup/src/memang32.c
@@ -0,0 +1,801 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: memang32.c
+
+ Description: This file contains the functions for the 32 bit GUI Memory
+ Manager (MEM).
+
+ $Log: T:/LOGFILES/MEMANG32.C_V $
+
+ Rev 1.11.1.1 11 Feb 1994 16:38:52 GREGG
+Report more details when size mismatch detected.
+
+ Rev 1.11.1.0 24 Jan 1994 15:59:26 GREGG
+A variety of improvements to the debug side.
+
+ Rev 1.11 29 Oct 1993 16:17:58 BARRY
+ Almost a total rewrite. Changed the block-copied nature of
+malloc, calloc, and realloc. Gregg fixed ANSI violations in behavior
+of realloc.
+ The debug code has been completely rewritten to start a
+thread that does nothing but continually check the validity of
+allocated memory. [This is turned on by defining MEM_DEBUG.] Any
+inconsistency found will result in a mscassert [critical assert]
+being raised.
+
+
+ Rev 1.10 12 Aug 1993 16:39:32 BARRY
+In debug code, count bytes used properly.
+
+ Rev 1.9 12 Aug 1993 12:50:14 BARRY
+Added some debug code (enabled by definition of MEM_DEBUG) to help
+diagnose common memory corruption problems.
+
+ Rev 1.8 14 May 1993 15:24:56 BARRY
+Fixed warning.
+
+ Rev 1.7 16 Mar 1993 15:41:08 STEVEN
+fix free of failed realloc
+
+ Rev 1.6 16 Mar 1993 13:46:18 STEVEN
+realloc sucked
+
+ Rev 1.5 07 Mar 1993 10:38:48 MIKEP
+fix wwarnings for no return values
+
+ Rev 1.4 11 Feb 1993 12:12:16 STEVEN
+stuf from mike
+
+ Rev 1.3 04 Sep 1992 15:19:54 STEVEN
+realloc must be moveable
+
+ Rev 1.2 18 Aug 1992 10:02:52 BURT
+fix warnings
+
+ Rev 1.1 25 Jun 1992 11:16:44 STEVEN
+do not zeroinit a realloc and specify fixed
+
+ Rev 1.0 09 Jun 1992 17:14:56 STEVEN
+Initial revision.
+
+
+******************************************************************************/
+
+#include "all.h"
+
+// GLOBAL VARIABLES
+
+UINT gunSegCount = 0;
+ULONG gulMemAvail = 0;
+ULONG gulMemUsed = 0;
+BOOL gfShowMemory = FALSE;
+
+
+static HTIMER TimerHandle;
+
+INT MEM_StartShowMemory( )
+{
+ TimerHandle = WM_HookTimer( STM_DrawMemory, 5 );
+ return( 0 );
+}
+
+
+INT MEM_StopShowMemory( )
+{
+ WM_UnhookTimer( TimerHandle );
+ return( 0 );
+}
+
+
+#if !defined( MEM_DEBUG )
+
+/**/
+/**
+
+ Name: MEM_Malloc
+
+ Description: Calls LocalAlloc to allocate memory.
+
+ Modified: 18-Aug-93
+
+ Returns: NULL if no memory available, Pointer to block otherwise.
+ Note: This uses LocalAlloc( with fixed block ) to
+ perform the alloc.
+
+ Notes: Zeros memory (and MEM_Calloc relies on this).
+**/
+VOID_PTR MEM_Malloc( UINT size )
+{
+ VOID_PTR mem;
+
+ mem = (VOID_PTR)LocalAlloc( LMEM_FIXED | LMEM_ZEROINIT, size );
+
+ if ( mem != NULL )
+ {
+ gulMemUsed += LocalSize( (HLOCAL)mem );
+ }
+
+ return mem;
+}
+
+/**/
+/**
+
+ Name: MEM_Calloc
+
+ Description: This routine allocates storage space for an array of
+ n elements, each of length size bytes. Each element
+ is initialized to zero.
+
+ Modified: 18-Aug-93
+
+ Returns: NULL if unsuccessful, otherwise returns pointer to
+ allocated block.
+
+ Notes: Relies on MEM_Malloc clearing allocated memory.
+
+**/
+VOID_PTR MEM_Calloc( UINT n, UINT size )
+{
+ return MEM_Malloc( n * size );
+}
+
+/**/
+/**
+
+ Name: MEM_ReAlloc
+
+ Description: This function changes the size of a previously allocated
+ memory block.
+
+ If "buf" is NULL, a new buffer is "malloc"-ed.
+
+ If "new_size" is 0, then the block, if it was allocated
+ is now freed (and we return NULL).
+
+ Note: This routine DOES NOT SUPPORT realloc-ing a buffer
+ previously freed. This uses LocalReAlloc()
+ to do the work.
+
+ Modified: 18-Aug-93
+
+ Returns: NULL if unsuccessful, pointer otherwise.
+
+ Notes:
+
+**/
+VOID_PTR MEM_ReAlloc( VOID_PTR oldMem, UINT newSize )
+{
+ VOID_PTR newMem = NULL;
+
+ if ( oldMem == NULL )
+ {
+ newMem = MEM_Malloc( newSize );
+ }
+ else if ( newSize == 0UL )
+ {
+ MEM_Free( oldMem );
+ }
+ else
+ {
+ UINT oldSize = LocalSize( oldMem );
+
+ if ( oldSize >= newSize )
+ {
+ newMem = oldMem;
+ }
+ else
+ {
+ newMem = MEM_Malloc( newSize ) ;
+ if ( newMem != NULL )
+ {
+ memcpy( newMem, oldMem, oldSize ) ;
+ MEM_Free( oldMem );
+ }
+ }
+ }
+ return newMem;
+}
+
+/**/
+/**
+
+ Name: MEM_Free
+
+ Description: This routine frees the memory allocated by a previous
+ call to MEM_Malloc.
+
+ Modified: 18-Aug-93
+
+ Returns: Nothing
+
+**/
+VOID MEM_Free( VOID_PTR mem )
+{
+ if ( mem != NULL )
+ {
+ gulMemUsed -= LocalSize( (HLOCAL)mem );
+ LocalFree( (HLOCAL)mem );
+ }
+}
+
+#else /* MEM_DEBUG */
+
+/**/
+/**************************************************************************
+
+ Debug code to help find memory hits. For each requested memory
+ allocation, addition memory is allocated to hold a debug "header"
+ and a linked list of this memory is maintained. Upon the first
+ allocation, a thread is started that continually scans this list
+ looking for errors (memory overruns, free of invalid pointer, or
+ a free of the same pointer more than once). Upon any error, a
+ critical assert is raised.
+
+
+ gMemList -------> +-------------+
+ | block size | Checked for agreement w/ OS
+ +-------------+
+ | user's size |
+ +-------------+
+ | next block |---> next block
+ +-------------+
+ previous blk <----| prev block |
+ +-------------+
+ | a55aa55a | Checked for "underrun"
+ +-------------+
+ | | Pointer to this area returned
+ | user memory | to caller of malloc, calloc,
+ | | or realloc.
+ +-------------+
+ | a55aa55a | Checked for "overrun"
+ +-------------+
+
+ This list is protected by Enter/LeaveCriticalSection whenever
+ it is manipulated.
+
+ Important: This block is defined to be a multiple of 16 bytes,
+ and must stay that way for MIPS compatibility. This could be
+ conditionally compiled based on the target platform.
+
+
+**************************************************************************/
+
+
+/* Data to put outside allocated memory to detect mem getting trodden on */
+#define NOISE_WORD 0xa55aa55a
+
+/* Structure must be multiple of 16 bytes for MIPS compatibility */
+typedef struct MEM_HEADER {
+ UINT32 size; // Size allocated (>= size requested)
+ UINT32 userSize; // Size requested
+ struct MEM_HEADER *next;
+ struct MEM_HEADER *prev;
+ UINT16 bad; // See MEMERR defines below
+ UINT16 allocLine; // Source line where mem was allocated
+ CHAR allocFile[16]; // Source file where mem was allocated
+ UINT32 reserved[2]; // Pad, adjust if structure changes
+ UINT32 noise; // Leave last
+} MEM_HEADER;
+
+static MEM_HEADER *gMemList = NULL; // Linked list of mem blocks
+static BOOLEAN gMemInited = FALSE; // Is sniffer thread started?
+static UINT32 gMemBlocks = 0; // Count of mem blocks
+static UINT32 gBadBlocks = 0; // Count of bad mem blocks
+static CRITICAL_SECTION gMemListCriticalSection; // Protects list of blocks
+
+typedef struct MEMERR_REC {
+ UINT16 bad;
+ UINT16 allocLine;
+ CHAR allocFile[16];
+ UINT32 gle_code;
+ UINT32 lcl_size;
+ UINT32 save_size;
+} MEMERR_REC;
+
+static MEMERR_REC memErrList[20];
+
+/* Amount of extra memory needed for debug info on each allocation. */
+#define OVERHEAD_SIZE (sizeof(MEM_HEADER) + sizeof(UINT32))
+
+#define MEMERR_NOT_BAD 0
+#define MEMERR_BAD_SIZE 1
+#define MEMERR_BAD_FRONT 2
+#define MEMERR_BAD_BACK 3
+
+
+/**/
+/**
+
+ Name: MEM_ConsistencyCheck()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+static VOID MEM_ConsistencyCheck( VOID )
+{
+ MEM_HEADER *memList;
+ UINT32 noise = NOISE_WORD;
+ UINT16 count = 0;
+ DWORD gle_code = NO_ERROR ;
+ UINT lcl_size ;
+
+ EnterCriticalSection( &gMemListCriticalSection );
+
+ memList = gMemList;
+
+ for ( ; memList != NULL; memList = memList->next )
+ {
+ if ( memList->bad == MEMERR_NOT_BAD )
+ {
+ UINT16 bad = MEMERR_NOT_BAD;
+
+ SetLastError( NO_ERROR ) ;
+ lcl_size = LocalSize( (HLOCAL)memList );
+ if ( memList->size != lcl_size )
+ {
+ gle_code = GetLastError( ) ;
+ bad = MEMERR_BAD_SIZE;
+ }
+ else if ( memList->noise != NOISE_WORD )
+ {
+ bad = MEMERR_BAD_FRONT;
+ }
+ else
+ {
+ BYTE *p = (BYTE *)(memList + 1) + memList->userSize;
+
+ if ( memcmp( p, &noise, sizeof( noise ) ) != 0 )
+ {
+ bad = MEMERR_BAD_BACK;
+ }
+ }
+
+ if ( bad )
+ {
+ if ( !gb_no_abort_on_mem_check )
+ {
+ RaiseException( EXCEPTION_BREAKPOINT,
+ 0,
+ 0,
+ NULL );
+
+ // Because the debugger doesn't like to stop ...
+
+ RaiseException( EXCEPTION_BREAKPOINT,
+ 0,
+ 0,
+ NULL );
+ }
+ memList->bad = bad;
+ memErrList[count].bad = bad;
+ memErrList[count].lcl_size = lcl_size;
+ memErrList[count].save_size = memList->size;
+ memErrList[count].gle_code = gle_code;
+ memErrList[count].allocLine = memList->allocLine;
+ memcpy( memErrList[count].allocFile,
+ memList->allocFile, 16 * sizeof( CHAR ) );
+ count++;
+ gBadBlocks++;
+ }
+ }
+ }
+ LeaveCriticalSection( &gMemListCriticalSection );
+
+ while ( count-- )
+ {
+ switch ( memErrList[count].bad )
+ {
+ case MEMERR_BAD_SIZE :
+ zprintf( 0, TEXT("Memory consistency checker reported bad size\n") );
+ break;
+
+ case MEMERR_BAD_FRONT :
+ zprintf( 0, TEXT("Memory consistency checker reported buffer underflow\n") );
+ break;
+
+ case MEMERR_BAD_BACK :
+ zprintf( 0, TEXT("Memory consistency checker reported buffer overflow\n") );
+ break;
+ }
+
+ zprintf( 0, "on memory allocated in %s at line %d.\n",
+ memErrList[count].allocFile, memErrList[count].allocLine );
+
+ if ( memErrList[count].bad == MEMERR_BAD_SIZE ) {
+ zprintf( 0, TEXT("Expected size = %lu, Local size = %lu, GetLastError returned: %08lX.\n"),
+ memErrList[count].save_size,
+ memErrList[count].lcl_size,
+ memErrList[count].gle_code );
+ }
+ }
+}
+
+/**/
+/**
+
+ Name: MEM_SnifferThread()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+static VOID MEM_SnifferThread( )
+{
+ for ( ;; )
+ {
+ MEM_ConsistencyCheck( );
+ _sleep( 1 ) ;
+ }
+}
+
+/**/
+/**
+
+ Name: MEM_InitDebugStuff()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+static BOOL MEM_InitDebugStuff( VOID )
+{
+ DWORD threadID;
+ BOOL ret_val = FALSE;
+
+ mscassert( !gMemInited );
+
+ if ( !gMemInited )
+ {
+ InitializeCriticalSection( &gMemListCriticalSection );
+
+ if ( CreateThread( NULL, // lpsa,
+ (DWORD)0, // cbStack,
+ (LPVOID)MEM_SnifferThread, // lpStartAddr,
+ NULL, // lpvThreadParm,
+ 0, // fdwCreate,
+ &threadID ) != NULL )
+ {
+ gMemInited = TRUE;
+ ret_val = TRUE;
+ }
+ }
+ else
+ {
+ ret_val = TRUE;
+ }
+ return ret_val;
+}
+
+
+/**/
+/**
+
+ Name: MEM_PrepareMemBlock()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+static VOID MEM_PrepareMemBlock( VOID *mem, UINT userSize, ACHAR_PTR allocFile, INT allocLine )
+{
+ MEM_HEADER *header = (MEM_HEADER *)mem;
+ BYTE *p;
+ UINT32 noise = NOISE_WORD;
+ ACHAR_PTR q;
+ INT size = 32;
+
+ header->size = LocalSize( (HLOCAL)mem );
+ header->userSize = userSize;
+ header->next = NULL;
+ header->prev = NULL;
+ header->bad = MEMERR_NOT_BAD;
+ header->allocLine = (UINT16)allocLine;
+ header->noise = noise;
+
+ if ( allocFile != NULL )
+ {
+ q = allocFile + strlenA( allocFile );
+ while( q > allocFile && *(q-1) != '\\' )
+ {
+ q--;
+ }
+ q[15] = TEXT('\0');
+
+#ifdef UNICODE
+ mapAnsiToUnic( q, header->allocFile, &size );
+#else
+ strcpy( header->allocFile, q );
+#endif
+ }
+ else
+ {
+ header->allocFile[0] = TEXT('\0');
+ }
+
+ p = (BYTE *)(header + 1) + userSize;
+ memcpy( p, &noise, sizeof( noise ) );
+}
+
+
+/**/
+/**
+
+ Name: MEM_InsertMemBlock()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+static VOID MEM_InsertMemBlock( VOID *mem )
+{
+ MEM_HEADER *p = (MEM_HEADER *)mem;
+
+ if ( mem != NULL )
+ {
+ EnterCriticalSection( &gMemListCriticalSection );
+
+ // Insert this memory in the list;
+ if ( gMemList == NULL )
+ {
+ p->next = NULL;
+ }
+ else
+ {
+ p->next = gMemList;
+ gMemList->prev = p;
+ }
+ p->prev = NULL;
+ gMemList = p;
+
+ LeaveCriticalSection( &gMemListCriticalSection );
+ }
+}
+
+
+/**/
+/**
+
+ Name: MEM_RemoveMemBlock()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+static VOID MEM_RemoveMemBlock( VOID *mem )
+{
+ if ( mem != NULL )
+ {
+ BOOLEAN found;
+ MEM_HEADER *cur;
+
+ /*
+ * Let's scan the list and be sure the memory really is in it
+ * before we dequeue it.
+ */
+
+ EnterCriticalSection( &gMemListCriticalSection );
+
+ for ( found = FALSE, cur = gMemList; (cur != NULL); cur = cur->next )
+ {
+ if ( cur == mem )
+ {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if ( found )
+ {
+ MEM_HEADER *p = (MEM_HEADER *)mem;
+
+ /* Adjust pointers to remove elem from list */
+ if ( p->next != NULL )
+ {
+ p->next->prev = p->prev;
+ }
+
+ if ( p->prev != NULL )
+ {
+ p->prev->next = p->next;
+ }
+
+ /* Special case for removing item at head of list */
+ if ( p == gMemList )
+ {
+ gMemList = p->next;
+ }
+ }
+ LeaveCriticalSection( &gMemListCriticalSection );
+
+ /* If this elem wasn't found in list, somebody freed it twice. */
+ mscassert( found == TRUE );
+ }
+}
+
+
+/**/
+/**
+
+ Name: MEM_Malloc()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+VOID_PTR MEM_Malloc( UINT size, ACHAR_PTR allocFile, INT allocLine )
+{
+ VOID_PTR mem;
+
+ if ( gMemInited == FALSE )
+ {
+ if ( !MEM_InitDebugStuff( ) )
+ {
+ return NULL;
+ }
+ }
+
+ mem = (VOID_PTR)LocalAlloc( LMEM_FIXED | LMEM_ZEROINIT,
+ size + OVERHEAD_SIZE );
+
+ if ( mem != NULL )
+ {
+ gMemBlocks++;
+ MEM_PrepareMemBlock( mem, size, allocFile, allocLine );
+ MEM_InsertMemBlock( mem );
+
+ gulMemUsed += LocalSize( (HLOCAL)mem );
+ return (VOID_PTR)((MEM_HEADER *)mem + 1);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/**/
+/**
+
+ Name: MEM_Calloc()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+VOID_PTR MEM_Calloc( UINT n, UINT size, ACHAR_PTR allocFile, INT allocLine )
+{
+ return MEM_Malloc( n * size, allocFile, allocLine );
+}
+
+/**/
+/**
+
+ Name: MEM_ReAlloc()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+VOID_PTR MEM_ReAlloc( VOID_PTR oldMem, UINT newSize, ACHAR_PTR allocFile, INT allocLine )
+{
+ VOID_PTR newMem = NULL;
+
+ if ( oldMem == NULL )
+ {
+ newMem = MEM_Malloc( newSize, allocFile, allocLine );
+ }
+ else if ( newSize == 0UL )
+ {
+ MEM_Free( oldMem, allocFile, allocLine );
+ }
+ else
+ {
+ VOID_PTR oldRealPtr;
+ UINT oldSize;
+
+ oldRealPtr = (VOID_PTR)((MEM_HEADER *)oldMem - 1);
+ oldSize = LocalSize( oldRealPtr );
+ mscassert( oldSize > 0 );
+ oldSize -= OVERHEAD_SIZE;
+
+ if ( oldSize >= newSize )
+ {
+ newMem = oldMem;
+ }
+ else
+ {
+ newMem = MEM_Malloc( newSize, allocFile, allocLine ) ;
+ if ( newMem != NULL )
+ {
+ memcpy( newMem, oldMem, oldSize ) ;
+ MEM_Free( oldMem, allocFile, allocLine );
+ }
+ }
+ }
+ return newMem;
+}
+
+/**/
+/**
+
+ Name: MEM_Free()
+
+ Description:
+
+ Modified: 22-Sep-93
+
+ Returns:
+
+ Notes:
+
+**/
+VOID MEM_Free( VOID_PTR mem, ACHAR_PTR allocFile, INT allocLine )
+{
+ if ( mem != NULL )
+ {
+ /*
+ * User is passing us their pointer -- back up over the
+ * header to get our "real" pointer.
+ */
+
+ gMemBlocks--;
+ mem = (VOID_PTR)((MEM_HEADER *)mem - 1);
+
+ MEM_RemoveMemBlock( mem );
+
+ gulMemUsed -= LocalSize( (HLOCAL)mem );
+ LocalFree( (HLOCAL)mem );
+ }
+}
+
+
+#endif /* MEM_DEBUG */
+
diff --git a/private/utils/ntbackup/src/memver.c b/private/utils/ntbackup/src/memver.c
new file mode 100644
index 000000000..6aa873974
--- /dev/null
+++ b/private/utils/ntbackup/src/memver.c
@@ -0,0 +1,79 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: memver.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: N:/LOGFILES/MEMVER.C_V $
+
+ Rev 1.3 14 Oct 1993 17:49:46 STEVEN
+fix unicode bugs
+
+ Rev 1.2 18 Jun 1993 10:15:26 MIKEP
+enable c++
+
+ Rev 1.1 01 Oct 1991 11:15:38 BARRY
+Include standard headers.
+
+ Rev 1.0 09 May 1991 13:35:54 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: memver()
+
+ Description: Simple memory compairson routine which specifies
+ the position of the difference ;
+
+ Modified: 8/1/1989
+
+ Returns: SUCCESS if same
+ FAILURE if different.
+
+ Notes: Should be converted to assembly.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 memver(
+BYTE_PTR buf1 ,
+BYTE_PTR buf2 ,
+UINT16 *size )
+{
+ UINT16 i ;
+ INT16 ret_val = SUCCESS ;
+
+ if ( memcmp( buf1, buf2, *size ) ) {
+
+ for ( i = 0; i < *size; i++ ) {
+
+ if (buf1[i] != buf2[i] ) {
+ ret_val = FAILURE ;
+ *size = i ;
+ break ;
+ }
+ }
+ }
+
+ return ret_val ;
+}
+
+
diff --git a/private/utils/ntbackup/src/menumang.c b/private/utils/ntbackup/src/menumang.c
new file mode 100644
index 000000000..bb50d01fe
--- /dev/null
+++ b/private/utils/ntbackup/src/menumang.c
@@ -0,0 +1,1546 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: menumang.c
+
+ Description: This file contains the functions for the GUI Menu
+ Manager (MM).
+
+ $Log: G:\ui\logfiles\menumang.c_v $
+
+ Rev 1.53 19 Jul 1993 11:11:58 GLENN
+Added sticky file sort and file details support.
+
+ Rev 1.52 25 May 1993 14:02:12 GLENN
+Removed commented sprintf - someone at Microsoft complained.
+
+ Rev 1.51 24 May 1993 15:21:54 BARRY
+Unicode fixes.
+
+ Rev 1.50 18 May 1993 14:49:04 GLENN
+Synchronized tool bar with menu. Fixed show menu status help macro which fixed need for Ready.
+
+ Rev 1.49 06 May 1993 16:04:00 DARRYLP
+Tied Backup/Transfer and Restore/Verify.
+
+ Rev 1.48 27 Apr 1993 19:01:44 GLENN
+Move the VLM change font to the font.c file.
+
+ Rev 1.47 26 Apr 1993 08:45:08 MIKEP
+Add support for telling the vlm that the user may have changed font
+case display for FAT, HPFS, etc.
+
+ Rev 1.46 22 Apr 1993 15:58:48 GLENN
+Added file SORT option support.
+
+ Rev 1.45 21 Apr 1993 16:05:08 GLENN
+Fixed Nostradamus and Cayman menu enabling problems.
+
+ Rev 1.44 09 Apr 1993 15:20:34 GLENN
+Enabling INFO menu item based on ribbon state.
+
+ Rev 1.43 09 Apr 1993 15:03:00 GLENN
+Graying out Net connect, disconnect, font.
+
+ Rev 1.42 08 Apr 1993 11:02:12 DARRYLP
+Removed Print menu graying to allow new functionality to work.
+
+ Rev 1.41 02 Apr 1993 14:12:16 GLENN
+Added display info. Changed to NT help menu style and IDs.
+
+ Rev 1.40 26 Mar 1993 10:39:24 DARRYLP
+The print options are now firmly grayed for the beta.
+
+ Rev 1.39 16 Mar 1993 15:38:38 CARLS
+put back the changes for format tape that were removed by accident
+
+ Rev 1.38 12 Mar 1993 13:53:52 ROBG
+Changed to "Ready" from "" in status bar when nothing is to be done.
+
+ Rev 1.36 03 Mar 1993 16:44:58 ROBG
+Added support to set operation menu selections to ribbon statuses
+for MSOFT_UI.
+
+ Rev 1.35 02 Mar 1993 09:34:36 ROBG
+Placed a "Ready" in status line after showing/hiding a toolbar,
+window refresh on a drive, and showing/hiding the status bar.
+
+ Rev 1.34 22 Feb 1993 13:51:20 ROBG
+Disabled the VIEW split selection if active doc is minimized.
+
+ Rev 1.33 11 Dec 1992 18:22:36 GLENN
+Now handling state of hardware option under NT.
+
+ Rev 1.32 18 Nov 1992 11:38:42 GLENN
+Removed warnings.
+
+ Rev 1.31 01 Nov 1992 16:02:14 DAVEV
+Unicode changes
+
+ Rev 1.30 07 Oct 1992 15:11:18 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.29 04 Oct 1992 19:38:50 DAVEV
+Unicode Awk pass
+
+ Rev 1.28 22 Sep 1992 10:23:28 GLENN
+Removed the WNet calls and headers. They are now in the VLM_UTIL.C file.
+
+ Rev 1.27 10 Sep 1992 17:18:58 GLENN
+Resolved outstanding state issues for toolbar and menubar.
+
+ Rev 1.26 09 Sep 1992 14:39:12 DARRYLP
+Added WFW net functionality - net connect and disconnect.
+
+ Rev 1.25 08 Sep 1992 16:43:00 DARRYLP
+
+ Rev 1.24 20 Aug 1992 09:32:46 GLENN
+Added catalog operation support for NT.
+
+ Rev 1.23 10 Jul 1992 10:27:30 GLENN
+Enabled font selection support NT.
+
+ Rev 1.22 23 Jun 1992 17:59:50 DAVEV
+correctly fixed IDM_VIEWMENU problem this time!
+
+ Rev 1.21 23 Jun 1992 17:34:56 DAVEV
+IDM_VIEWFONT only for OEM_MSOFT
+
+ Rev 1.20 10 Jun 1992 16:15:14 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.19 15 May 1992 13:32:16 MIKEP
+nt pass 2
+
+ Rev 1.18 20 Apr 1992 14:03:46 GLENN
+Changed send to post message when requested to close the app.
+
+ Rev 1.17 15 Apr 1992 16:44:54 GLENN
+Added MM_ShowMenuStatusHelp() call to show status help only for valid menu IDs.
+
+ Rev 1.16 17 Mar 1992 18:26:46 GLENN
+Allowing spaces at the begining of a job name in quick pick.
+
+ Rev 1.15 03 Mar 1992 19:01:02 GLENN
+Added && double ampersand support to quick pick.
+
+ Rev 1.14 25 Feb 1992 21:33:22 GLENN
+Changed close all call.
+
+ Rev 1.13 23 Feb 1992 13:42:50 GLENN
+Fixed exit case.
+
+ Rev 1.12 11 Feb 1992 17:19:08 GLENN
+Enabling view-split for tapes and servers.
+
+ Rev 1.11 10 Feb 1992 09:14:10 GLENN
+Changed Settings - Options to Settings - General.
+
+ Rev 1.10 29 Jan 1992 18:04:32 GLENN
+Grayed out delete sel when no selections exist.
+
+ Rev 1.9 27 Jan 1992 12:45:58 GLENN
+Changed dialog support calls.
+
+ Rev 1.8 22 Jan 1992 12:31:42 GLENN
+Clean-up.
+
+ Rev 1.7 13 Jan 1992 16:50:42 CHUCKB
+Fixed string variables that hold job names.
+
+ Rev 1.6 07 Jan 1992 17:25:26 GLENN
+Added MDI split/slider support
+
+ Rev 1.5 26 Dec 1991 13:46:10 GLENN
+Changed show flags to use CDS calls
+
+ Rev 1.4 12 Dec 1991 17:06:42 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.3 10 Dec 1991 13:47:54 GLENN
+Replaced ghWndActiveDoc with WM_GetActiveDoc().
+
+ Rev 1.2 04 Dec 1991 15:21:12 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.1 03 Dec 1991 16:24:34 GLENN
+Added code to set limit on jobs in menu to 9. Added VLM_Refresh call.
+
+ Rev 1.0 20 Nov 1991 19:30:40 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// PRIVATE DEFINITIONS
+
+#define MAX_JOBS_IN_MENU 9
+
+// PRIVATE FUNCTION PROTOTYPES
+
+VOID MM_InitFileMenu ( HMENU, WORD );
+VOID MM_InitTreeMenu ( HMENU, WORD, DWORD );
+VOID MM_InitViewMenu ( HMENU, WORD, DWORD );
+VOID MM_InitOperationsMenu ( HMENU, WORD, WORD );
+VOID MM_InitSelectMenu ( HMENU, WORD, WORD );
+VOID MM_InitJobsMenu ( HMENU, WORD );
+VOID MM_InitSettingsMenu ( HMENU, WORD );
+VOID MM_InitWindowsMenu ( HMENU, WORD );
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: MM_Init()
+
+ Description: This function initializes the menus.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_Init (
+
+HMENU hMenu ) // I - handle of the menu to be initialized
+
+{
+ WORD wStatus;
+ PDS_WMINFO pdsWinInfo;
+ DWORD dwMenuState = 0L;
+ WORD wWinType = 0;
+
+ // Set the status to Enabled if there is active child doc window to
+ // talk to and if there is not an operation going on.
+
+ if ( WM_GetActiveDoc () && ! gfOperation ) {
+
+ wStatus = MF_ENABLED;
+ pdsWinInfo = WM_GetInfoPtr ( WM_GetActiveDoc () );
+ dwMenuState = pdsWinInfo->dwMenuState;
+ if (pdsWinInfo ) {
+ wWinType = pdsWinInfo->wType;
+ if ( ( wWinType == WMTYPE_DISKTREE ) ||
+ ( wWinType == WMTYPE_TAPETREE ) ) {
+
+ dwMenuState = pdsWinInfo->dwMenuState ;
+ }
+ }
+
+ }
+ else {
+ wStatus = MF_GRAYED;
+ }
+
+ MM_InitFileMenu ( hMenu, wStatus );
+ MM_InitTreeMenu ( hMenu, wStatus, dwMenuState );
+ MM_InitViewMenu ( hMenu, wStatus, dwMenuState );
+ MM_InitOperationsMenu ( hMenu, wStatus, wWinType );
+ MM_InitSelectMenu ( hMenu, wStatus, wWinType );
+ MM_InitJobsMenu ( hMenu, wStatus );
+ MM_InitSettingsMenu ( hMenu, wStatus );
+ MM_InitWindowsMenu ( hMenu, wStatus );
+
+
+} /* end MM_Init() */
+
+
+/******************************************************************************
+
+ Name: MM_InitFileMenu()
+
+ Description: This function initializes the File Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_InitFileMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus ) // I - enabled or disabled status
+
+{
+# if !defined ( OEM_MSOFT )
+ {
+ EnableMenuItem ( hMenu, IDM_FILEEXIT, wStatus );
+ EnableMenuItem ( hMenu, IDM_FILESETUP, wStatus );
+
+ if ( ( WM_GetActiveDoc () != ghWndLogFiles ) &&
+ ( WM_GetActiveDoc () != ghWndLogFileView ) ) {
+
+ wStatus = MF_GRAYED;
+ }
+
+ EnableMenuItem ( hMenu, IDM_FILEPRINT, wStatus );
+ }
+# endif
+
+} /* end MM_InitFileMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_InitTreeMenu()
+
+ Description: This function initializes the Tree Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_InitTreeMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus, // I - enabled or disabled status
+DWORD dwMenuState ) // I - MDI Document menu state bit mask
+
+{
+ // Gray out the entire menu if the active doc window does not support it
+ // or if the active doc is minimized.
+
+ if ( wStatus != MF_GRAYED &&
+ ( IsIconic ( WM_GetActiveDoc () ) || ! MM_HasTreeMenu ( dwMenuState ) ) ) {
+
+ wStatus = MF_GRAYED;
+ }
+
+ EnableMenuItem ( hMenu, IDM_TREEEXPANDONE, wStatus );
+ EnableMenuItem ( hMenu, IDM_TREEEXPANDBRANCH, wStatus );
+ EnableMenuItem ( hMenu, IDM_TREEEXPANDALL, wStatus );
+ EnableMenuItem ( hMenu, IDM_TREECOLLAPSEBRANCH, wStatus );
+
+
+} /* end MM_InitTreeMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_InitViewMenu()
+
+ Description: This function initializes the View Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_InitViewMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus, // I - enabled or disabled status
+DWORD dwMenuState ) // I - MDI Document menu state bit mask
+
+{
+ PDS_WMINFO info_ptr ;
+
+ WORD wPassedStatus = wStatus;
+ WORD wType ;
+
+ info_ptr = WM_GetInfoPtr ( WM_GetActiveDoc () ) ;
+
+ if (!info_ptr) return ;
+
+ wType = WMDS_GetWinType ( info_ptr ) ;
+
+ // Uncheck all the View Menu Items.
+
+ CheckMenuItem ( hMenu, IDM_VIEWTREEANDDIR, MF_UNCHECKED );
+ CheckMenuItem ( hMenu, IDM_VIEWTREEONLY, MF_UNCHECKED );
+ CheckMenuItem ( hMenu, IDM_VIEWDIRONLY, MF_UNCHECKED );
+ CheckMenuItem ( hMenu, IDM_VIEWALLFILEDETAILS, MF_UNCHECKED );
+
+# ifndef OEM_MSOFT
+ {
+ CheckMenuItem ( hMenu, IDM_VIEWSORTNAME, MF_UNCHECKED );
+ CheckMenuItem ( hMenu, IDM_VIEWSORTTYPE, MF_UNCHECKED );
+ CheckMenuItem ( hMenu, IDM_VIEWSORTSIZE, MF_UNCHECKED );
+ CheckMenuItem ( hMenu, IDM_VIEWSORTDATE, MF_UNCHECKED );
+ }
+# endif
+
+# if defined ( OEM_MSOFT ) // new function
+ {
+ CDS_PTR pPermCDS = CDS_GetPerm () ;
+ UINT fSet;
+
+ fSet = ( CDS_GetShowStatusLine( pPermCDS ) == CDS_ENABLE )
+ ? MF_CHECKED : MF_UNCHECKED ;
+ CheckMenuItem ( hMenu, IDM_VIEWSTATUS, fSet );
+
+ fSet = ( CDS_GetShowMainRibbon( pPermCDS ) == CDS_ENABLE )
+ ? MF_CHECKED : MF_UNCHECKED ;
+ CheckMenuItem ( hMenu, IDM_VIEWURIBBON, fSet );
+
+ }
+# endif // defined ( OEM_MSOFT ) // new function
+
+ EnableMenuItem ( hMenu, IDM_VIEWFONT, wStatus );
+
+ // Gray out the entire menu if the active window does not support it.
+
+ if ( ! MM_HasViewMenu ( dwMenuState ) ) {
+
+ wStatus = MF_GRAYED;
+ }
+ else {
+
+ // Check the only one per group, if the menu is enabled.
+
+ // Do the TREE group.
+
+ if ( dwMenuState & MMDOC_TREEANDDIR ) {
+
+ CheckMenuItem ( hMenu, IDM_VIEWTREEANDDIR, MF_CHECKED );
+ }
+ else if ( dwMenuState & MMDOC_TREEONLY ) {
+
+ CheckMenuItem ( hMenu, IDM_VIEWTREEONLY, MF_CHECKED );
+ }
+ else if ( dwMenuState & MMDOC_DIRONLY ) {
+
+ CheckMenuItem ( hMenu, IDM_VIEWDIRONLY, MF_CHECKED );
+ }
+
+ // Do the FILE group.
+
+ CheckMenuItem ( hMenu, IDM_VIEWALLFILEDETAILS,
+ ( dwMenuState & MMDOC_FILEDETAILS ) ? MF_CHECKED : MF_UNCHECKED );
+
+# ifndef OEM_MSOFT
+ {
+ // Ok, now the SORT group.
+
+ if ( dwMenuState & MMDOC_SORTNAME ) {
+
+ CheckMenuItem ( hMenu, IDM_VIEWSORTNAME, MF_CHECKED );
+ }
+ else if ( dwMenuState & MMDOC_SORTTYPE ) {
+
+ CheckMenuItem ( hMenu, IDM_VIEWSORTTYPE, MF_CHECKED );
+ }
+ else if ( dwMenuState & MMDOC_SORTSIZE ) {
+
+ CheckMenuItem ( hMenu, IDM_VIEWSORTSIZE, MF_CHECKED );
+ }
+ else if ( dwMenuState & MMDOC_SORTDATE ) {
+
+ CheckMenuItem ( hMenu, IDM_VIEWSORTDATE, MF_CHECKED );
+ }
+ }
+# endif
+
+ }
+
+ // If the doc is minimized, gray out the tree/dir stuff.
+
+ if ( wStatus != MF_GRAYED && IsIconic ( WM_GetActiveDoc () ) ) {
+ wStatus = MF_GRAYED;
+ }
+
+ EnableMenuItem ( hMenu, IDM_VIEWTREEANDDIR, wStatus );
+ EnableMenuItem ( hMenu, IDM_VIEWTREEONLY, wStatus );
+ EnableMenuItem ( hMenu, IDM_VIEWDIRONLY, wStatus );
+ EnableMenuItem ( hMenu, IDM_VIEWALLFILEDETAILS, wStatus );
+
+# ifndef OEM_MSOFT
+ {
+ EnableMenuItem ( hMenu, IDM_VIEWSORTNAME, wStatus );
+ EnableMenuItem ( hMenu, IDM_VIEWSORTTYPE, wStatus );
+ EnableMenuItem ( hMenu, IDM_VIEWSORTSIZE, wStatus );
+ EnableMenuItem ( hMenu, IDM_VIEWSORTDATE, wStatus );
+ }
+# endif
+
+ // Determine the way to display the split menu item.
+
+ if ( ( wPassedStatus == MF_ENABLED ) &&
+ ( !IsIconic ( WM_GetActiveDoc () ) ) &&
+ ( wType == WMTYPE_TAPES || wType == WMTYPE_DISKTREE ||
+ wType == WMTYPE_TAPETREE || wType == WMTYPE_SERVERS
+#ifdef OEM_EMS
+ || wType == WMTYPE_EXCHANGE
+#endif
+ ) ) {
+
+ wStatus = MF_ENABLED;
+ }
+ else {
+ wStatus = MF_GRAYED;
+ }
+
+ EnableMenuItem ( hMenu, IDM_VIEWSPLIT, wStatus );
+
+} /* end MM_InitViewMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_InitOperationsMenu()
+
+ Description: This function initializes the Operations Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+#ifdef FS_EMS
+extern HINSTANCE JetApi ;
+#endif
+
+VOID MM_InitOperationsMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus, // I - enabled or disabled status
+WORD wType ) // I - window type
+
+
+{
+ WORD wTempStatus;
+ WORD wTapeStatus;
+ WORD wTapeFmtStatus;
+
+ // Set the temp status based on the currently active window.
+
+ if ( wType == WMTYPE_DISKS || wType == WMTYPE_DISKTREE || wType == WMTYPE_SERVERS ||
+ wType == WMTYPE_TAPES || wType == WMTYPE_TAPETREE || wType == WMTYPE_SEARCH
+#ifdef OEM_EMS
+ || wType == WMTYPE_EXCHANGE
+#endif
+ ) {
+
+ wTempStatus = wStatus;
+ }
+ else {
+ wTempStatus = MF_GRAYED;
+ }
+
+ wTapeStatus = ( MUI_IsTapeInDrive () ) ? wTempStatus : (WORD)MF_GRAYED;
+ wTapeFmtStatus = ( MUI_IsTapeInDrive () ) ? MF_ENABLED : (WORD)MF_GRAYED;
+
+ // OK, so maybe we could use the ribbon states. But,
+ // a better way is to use a state table - maybe we will do this
+ // when we use C++. Sure we will. The problem with doing it this
+ // way is, what happens when we yank something out of the ribbon?
+ // What do we do then?
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSBACKUP,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSBACKUP ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSRESTORE,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSRESTORE ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSTRANSFER,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSBACKUP ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSINFO,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSINFO ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSVERIFY,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSRESTORE ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSCATALOG,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSCATALOG ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ // Catalog file dependent menu items.
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSSEARCH,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSSEARCH ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu, IDM_OPERATIONSCATMAINT, ( QTC_AnyCatalogFiles () ) ? wTempStatus : MF_GRAYED );
+
+ // Special tape-in-drive dependent menu items.
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSEJECT,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSEJECT ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSERASE,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSERASE ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSRETENSION,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSRETENSION ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSCONNECT,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSCONNECT ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSDISCON,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSDISCON ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+# if defined ( OS_WIN32 )
+ {
+ if ( thw_list && gfHWInitialized && ( thw_list->drv_info.drv_features & TDI_FORMAT ) ) {
+ EnableMenuItem ( hMenu, IDM_OPERATIONSFORMAT, wTapeFmtStatus );
+ }
+ else {
+ EnableMenuItem ( hMenu, IDM_OPERATIONSFORMAT, (WORD)MF_GRAYED );
+ }
+ }
+# endif // defined ( OS_WIN32 )
+
+# if defined ( OEM_MSOFT ) // Use the ribbon states.
+ {
+ EnableMenuItem ( hMenu, IDM_OPERATIONSHARDWARE, wStatus );
+
+ /******************************************************************
+
+ For Microsoft's product, the menu is set to the status of the
+ ribbon buttons.
+
+ The menu selections are made to reflect the ribbon button statuses
+
+ IDM_OPERATIONSCATALOG Catalog button
+ IDM_OPERATIONSRETENSION Retension button
+ IDM_OPERATIONSEJECT Eject button
+ IDM_OPERATIONSERASE Erase button
+
+ ******************************************************************/
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSCATALOG,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSCATALOG ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSRETENSION,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSRETENSION ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSEJECT,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSEJECT ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu,
+ IDM_OPERATIONSERASE,
+ ( ( RIB_IsItemEnabled ( ghRibbonMain, IDM_OPERATIONSERASE ) ) ? MF_ENABLED : MF_GRAYED )
+ );
+
+ EnableMenuItem ( hMenu, IDM_OPERATIONSEXIT, wStatus );
+
+# ifdef FS_EMS
+ if ( !JetApi ) {
+ JetApi = LoadLibrary( TEXT("edbbcli.dll")) ;
+ }
+
+ EnableMenuItem ( hMenu, IDM_OPERATIONSEXCHANGE, (WORD)MF_GRAYED );
+
+ if ( JetApi ) {
+ static first_time = TRUE ;
+ if (first_time ) {
+ InsertMenu ( hMenu,
+ IDM_OPERATIONSEXCHANGE,
+ MF_BYCOMMAND | MF_SEPARATOR | wStatus,
+ 0,
+ (LPSTR)NULL
+ );
+ first_time = FALSE ;
+ }
+
+ EnableMenuItem ( hMenu, IDM_OPERATIONSEXCHANGE, wStatus );
+ } else {
+ static first_time = TRUE ;
+ if (first_time ) {
+ RemoveMenu( hMenu, IDM_OPERATIONSEXCHANGE, MF_BYCOMMAND) ;
+ first_time = FALSE ;
+ }
+ }
+
+# endif
+ }
+
+# endif
+
+} /* end MM_InitOperationsMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_InitSelectMenu()
+
+ Description: This function initializes the Select Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_InitSelectMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus, // I - enabled or disabled status
+WORD wType ) // I - window type
+
+{
+ WORD wTempStatus = wStatus;
+
+# if !defined ( OEM_MSOFT )
+ {
+ // Check or Uncheck the STATUS LINE, MAIN RIBBON, etc... menu items.
+
+ CheckMenuItem ( hMenu, IDM_SELECTSUBDIRS,
+ ( CDS_GetIncludeSubdirs ( CDS_GetPerm () ) ) ? MF_CHECKED : MF_UNCHECKED );
+ }
+# endif // !defined ( OEM_MSOFT )
+
+ if ( ! ( wType == WMTYPE_DISKS || wType == WMTYPE_DISKTREE || wType == WMTYPE_SERVERS ||
+ wType == WMTYPE_TAPES || wType == WMTYPE_TAPETREE || wType == WMTYPE_SEARCH
+#ifdef OEM_EMS
+ || wType == WMTYPE_EXCHANGE
+#endif
+ ) ) {
+
+ wTempStatus = MF_GRAYED;
+ }
+
+ EnableMenuItem ( hMenu, IDM_SELECTCHECK, wTempStatus );
+ EnableMenuItem ( hMenu, IDM_SELECTUNCHECK, wTempStatus );
+
+# if !defined ( OEM_MSOFT )
+ {
+ EnableMenuItem ( hMenu, IDM_SELECTADVANCED, ( wType != WMTYPE_SEARCH ) ? wTempStatus : MF_GRAYED );
+ EnableMenuItem ( hMenu, IDM_SELECTSUBDIRS, ( wType != WMTYPE_SEARCH ) ? wTempStatus : MF_GRAYED );
+ EnableMenuItem ( hMenu, IDM_SELECTCLEAR, wTempStatus );
+
+ EnableMenuItem ( hMenu, IDM_SELECTSAVE, ( VLM_AnyDiskSelections () ) ? wStatus : MF_GRAYED );
+ EnableMenuItem ( hMenu, IDM_SELECTUSE, ( VLM_AnySelFiles () ) ? wStatus : MF_GRAYED );
+ EnableMenuItem ( hMenu, IDM_SELECTDELETE, ( VLM_AnySelFiles () ) ? wStatus : MF_GRAYED );
+
+ }
+# endif // !defined ( OEM_MSOFT )
+
+} /* end MM_InitSelectMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_InitJobsMenu()
+
+ Description: This function initializes the Job Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_InitJobsMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus ) // I - enabled or disabled status
+
+{
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ BOOL fJobFiles = ( JOB_GetNextJob ( (JOBREC_PTR)NULL ) ) ? TRUE : FALSE;
+ BOOL fDone = FALSE;
+
+ EnableMenuItem ( hMenu, IDM_JOBMAINTENANCE, wStatus );
+
+ // Use the Jobs Menu GLOBAL handle for deleting and appending
+ // from/to this menu. First, delete any old job entries in the menu
+ // regardless of whether or not any jobs exist at this time.
+
+ // Delete the old job list, since it could have changed.
+
+ do {
+ fDone = ! DeleteMenu ( ghMenuJobs, JOBSMENUSEPARATORPOS, MF_BYPOSITION );
+
+ } while ( ! fDone );
+
+ // If there are any job files, append them to the menu as menu items.
+
+ if ( fJobFiles ) {
+
+ JOBREC_PTR pJobItem = (JOBREC_PTR)NULL;
+ CHAR szJobName[MAX_JOBNAME_LEN * 2];
+ WORD wIndex = 0;
+ LPSTR pSrc;
+ LPSTR pDest;
+
+ // Insert the separator.
+
+ InsertMenu ( ghMenuJobs,
+ (UINT)-1,
+ MF_BYPOSITION | MF_SEPARATOR | wStatus,
+ 0,
+ (LPSTR)NULL
+ );
+
+ // Loop for appending job names to the Jobs menu.
+
+ while ( pJobItem = JOB_GetNextJob ( pJobItem ) ) {
+
+ wIndex++;
+
+ if ( wIndex > MAX_JOBS_IN_MENU ) {
+
+ RSM_StringCopy ( IDS_JOBMOREJOBS, szJobName, MAX_JOBNAME_LEN );
+
+ szJobName[MAX_JOBNAME_LEN] = TEXT('\0');
+
+ InsertMenu ( ghMenuJobs,
+ (UINT)-1,
+ MF_BYPOSITION | MF_STRING | wStatus,
+ IDM_JOBSFIRSTJOB + wIndex,
+ szJobName
+ );
+
+ break;
+ }
+
+ // Prefix the job name with a job reference number by
+ // copying the index into the begining of the menu item
+ // string. Then, get the next job name and append it
+ // to the menu item string.
+
+ wsprintf ( szJobName, TEXT("&%u "), wIndex );
+
+ pDest = szJobName + strlen ( szJobName );
+
+ pSrc = JOB_GetJobName ( pJobItem );
+
+ while ( *pSrc != TEXT('\0') ) {
+
+ // Replace & with && to prevent problem with underscores
+ // being in the job name.
+
+ if ( *pSrc == TEXT('&') ) {
+ *pDest++ = TEXT('&');
+ }
+
+ *pDest++ = *pSrc++;
+ }
+
+ *pDest++ = *pSrc++;
+
+ // Insert the menu item at the end of the menu by position
+ // as a string with the status that is passed to this
+ // function, if there is a valid job.
+
+ InsertMenu ( ghMenuJobs,
+ (UINT)-1,
+ MF_BYPOSITION | MF_STRING | wStatus,
+ IDM_JOBSFIRSTJOB + wIndex,
+ szJobName
+ );
+
+ }
+ }
+
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+} /* end MM_InitJobsMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_InitSettingsMenu()
+
+ Description: This function initializes the Settings Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_InitSettingsMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus ) // I - enabled or disabled status
+
+{
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ EnableMenuItem ( hMenu, IDM_SETTINGSGENERAL, wStatus );
+ EnableMenuItem ( hMenu, IDM_SETTINGSBACKUP, wStatus );
+ EnableMenuItem ( hMenu, IDM_SETTINGSRESTORE, wStatus );
+ EnableMenuItem ( hMenu, IDM_SETTINGSLOGGING, wStatus );
+ EnableMenuItem ( hMenu, IDM_SETTINGSNETWORK, wStatus );
+ EnableMenuItem ( hMenu, IDM_SETTINGSCATALOG, wStatus );
+ EnableMenuItem ( hMenu, IDM_SETTINGSHARDWARE, wStatus );
+ EnableMenuItem ( hMenu, IDM_SETTINGSDEBUGWINDOW, wStatus );
+
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+} /* end MM_InitSettingsMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_InitWindowsMenu()
+
+ Description: This function initializes the Window Menu.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_InitWindowsMenu (
+
+HMENU hMenu, // I - handle of the menu to be initialized
+WORD wStatus ) // I - enabled or disabled status
+
+{
+ // The following menu items are enabled if there is an active window.
+
+ EnableMenuItem ( hMenu, IDM_WINDOWSTILE, wStatus );
+ EnableMenuItem ( hMenu, IDM_WINDOWSCASCADE, wStatus );
+ EnableMenuItem ( hMenu, IDM_WINDOWSREFRESH, wStatus );
+ EnableMenuItem ( hMenu, IDM_WINDOWSCLOSEALL, wStatus );
+ EnableMenuItem ( hMenu, IDM_WINDOWSARRANGEICONS, wStatus );
+
+} /* end MM_InitWindowsMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_GetJobNameFromMenu()
+
+ Description: This function extracts a filename from a menu item's text.
+
+ Returns: A pointer to the filename string.
+
+******************************************************************************/
+
+LPSTR MM_GetJobNameFromMenu (
+
+WORD wJobMenuID, // I - menu ID of the job name
+LPSTR pszJobName ) // I - pointer to the job name string
+
+{
+ CHAR szTemp[MAX_JOBNAME_LEN * 2];
+ CHAR_PTR pSrc = szTemp;
+ LPSTR pDest = pszJobName;
+
+ // Determine the job name.
+
+ GetMenuString ( GetMenu ( ghWndFrame ),
+ wJobMenuID,
+ szTemp,
+ sizeof ( szTemp ),
+ MF_BYCOMMAND
+ );
+
+ // Bump the pointer past the prefix number and the space(s).
+
+ for ( ; *pSrc != TEXT(' '); pSrc ++ ); // point past number
+
+ pSrc++; // point past the space.
+
+// for ( ; *pSrc == ' '; pSrc ++ ); // point past space(s)
+
+ // Now, remove any double && that we put in (underscore char).
+
+ while ( *pSrc != TEXT('\0') ) {
+
+ if ( *pSrc == TEXT('&') ) {
+
+ pSrc++;
+ }
+
+ *pDest++ = *pSrc++;
+ }
+
+ *pDest = *pSrc;
+
+ return pszJobName;
+
+} /* end MM_GetJobNameFromMenu() */
+
+
+/******************************************************************************
+
+ Name: MM_MenuCmdHandler()
+
+ Description: This handles menu commands.
+
+ Returns: TRUE, if it was a menu command, otherwise FALSE.
+
+******************************************************************************/
+
+BOOL MM_MenuCmdHandler (
+
+HWND hWnd,
+WORD wID ) // ID of control which generated the WM_COMMAND
+
+{
+ BOOL fCmdProcessed = TRUE;
+ WORD wDialogID = 0xFFFF;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+
+ // JOB MENU SELECTIONS:
+
+ if ( ( wID >= IDM_JOBSFIRSTJOB ) && ( wID <= IDM_JOBSLASTJOB ) ) {
+
+ CHAR szJobName[MAX_JOBNAME_LEN + 5];
+
+ MM_GetJobNameFromMenu ( wID, szJobName );
+
+ if ( wID <= ( IDM_JOBSFIRSTJOB + MAX_JOBS_IN_MENU ) ) {
+
+ JOB_StartJob ( szJobName, JOB_NOTSCHEDULED );
+ }
+ else {
+
+ DM_ShowDialog ( ghWndFrame, IDD_JOBMAINTENANCE, (PVOID)0 );
+ }
+
+ return fCmdProcessed;
+ }
+
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ switch ( wID ) {
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ // FILE MENU COMMANDS
+
+ case IDM_FILEPRINT:
+
+ PM_FilePrint ();
+ break;
+
+ case IDM_FILESETUP:
+
+ PM_FileSetup ();
+ break;
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+
+# if defined ( OEM_MSOFT ) // alternate feature
+
+ case IDM_OPERATIONSEXIT:
+
+# else // !defined ( OEM_MSOFT ) // standard feature
+
+ case IDM_FILEEXIT:
+
+# endif // else !defined ( OEM_MSOFT ) // alternate/standard feature
+
+
+ if ( ! gfOperation ) {
+ PostMessage ( ghWndFrame, WM_CLOSE, (MP1)NULL, (MP2)NULL );
+ }
+
+ break;
+
+
+ // TREE MENU COMMANDS
+
+ case IDM_TREEEXPANDONE:
+ case IDM_TREEEXPANDBRANCH:
+ case IDM_TREEEXPANDALL:
+ case IDM_TREECOLLAPSEBRANCH:
+
+ VLM_ChangeSettings ( wID, 0L );
+ break;
+
+ // VIEW MENU COMMANDS
+
+ case IDM_VIEWTREEANDDIR:
+ case IDM_VIEWTREEONLY:
+ case IDM_VIEWDIRONLY:
+ case IDM_VIEWALLFILEDETAILS: {
+
+ WORD wChangeMsg = WM_DocIsMenuChange ( WM_GetActiveDoc (), wID );
+
+ if ( wChangeMsg ) {
+
+ if ( wID == IDM_VIEWALLFILEDETAILS ) {
+
+ BOOL fFileDetails = ( wChangeMsg == ID_FILEDETAILS ) ? TRUE : FALSE;
+
+ CDS_SetFileDetails ( CDS_GetPerm (), fFileDetails );
+ CDS_WriteFileDetails ( CDS_GetPerm () );
+ }
+
+ VLM_ChangeSettings ( wChangeMsg, 0L );
+ }
+
+ break;
+ }
+
+# ifndef OEM_MSOFT
+ {
+ // VIEW MENU SORT COMMANDS
+
+ case IDM_VIEWSORTNAME:
+ case IDM_VIEWSORTTYPE:
+ case IDM_VIEWSORTSIZE:
+ case IDM_VIEWSORTDATE: {
+
+ WORD wChangeMsg = WM_DocIsMenuChange ( WM_GetActiveDoc (), wID );
+
+ if ( wChangeMsg ) {
+
+ CDS_SetSortOptions ( CDS_GetPerm (), wChangeMsg );
+ CDS_WriteSortOptions ( CDS_GetPerm () );
+ VLM_ChangeSettings ( wChangeMsg, 0L );
+ }
+
+ break;
+ }
+ }
+# endif
+
+ case IDM_VIEWSPLIT:
+
+ WM_DocSetSliderMode ( WM_GetActiveDoc (), WMDOC_SLIDERON );
+ break;
+
+# if defined ( OEM_MSOFT ) // new feature
+
+ case IDM_VIEWSTATUS: // Toggle the view/hide status bar state
+ {
+ CDS_PTR pPermCDS = CDS_GetPerm () ;
+ UINT uSet = ( CDS_GetShowStatusLine( pPermCDS ) == CDS_ENABLE )
+ ? CDS_DISABLE : CDS_ENABLE ;
+
+ CDS_SetShowStatusLine( pPermCDS, uSet ) ;
+ CDS_WriteShowStatusLine( pPermCDS ) ;
+ WM_FrameUpdate ();
+ }
+
+ STM_SetIdleText( IDS_READY ) ; //**ROB
+ break;
+
+
+ case IDM_VIEWURIBBON: // Toggle the view/hide ribbon state
+ {
+ CDS_PTR pPermCDS = CDS_GetPerm () ;
+ UINT uSet = ( CDS_GetShowMainRibbon( pPermCDS ) == CDS_ENABLE )
+ ? CDS_DISABLE : CDS_ENABLE ;
+
+ CDS_SetShowMainRibbon( pPermCDS, uSet );
+ CDS_WriteShowMainRibbon( pPermCDS ) ;
+ WM_FrameUpdate ();
+ }
+
+ STM_SetIdleText( IDS_READY ) ; //**ROB
+ break;
+
+# endif //defined ( OEM_MSOFT ) // new feature
+
+ case IDM_VIEWFONT: // Put up the common Font Dialog.
+
+ WM_ChangeFont ();
+
+ break;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ // SELECT MENU COMMANDS
+
+ case IDM_SELECTSUBDIRS:
+
+ CDS_SetIncludeSubdirs ( CDS_GetPerm(), ! CDS_GetIncludeSubdirs ( CDS_GetPerm () ) );
+ break;
+
+ case IDM_SELECTCLEAR:
+
+ VLM_ClearAllSelections ();
+ break;
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_SELECTCHECK:
+ case IDM_SELECTUNCHECK:
+
+ VLM_ChangeSettings ( wID, 0L );
+ break;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_SELECTADVANCED:
+
+ MUI_AdvancedSelections ();
+ break;
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ // WINDOW MENU COMMANDS
+
+ case IDM_WINDOWSTILE:
+
+ // Tile MDI windows.
+ SendMessage ( ghWndMDIClient, WM_MDITILE, 0, 0L );
+ break;
+
+ case IDM_WINDOWSCASCADE:
+
+ // Cascade MDI windows.
+ SendMessage ( ghWndMDIClient, WM_MDICASCADE, 0, 0L );
+ break;
+
+ case IDM_WINDOWSREFRESH:
+
+ VLM_Refresh ( );
+ STM_SetIdleText( IDS_READY ) ; //**ROB
+ break;
+
+ case IDM_WINDOWSCLOSEALL:
+
+ WM_SetDocSizes ();
+ WM_MinimizeDocs ();
+ break;
+
+ case IDM_WINDOWSARRANGEICONS:
+
+ // Arrange all ICONS in the window.
+ SendMessage( ghWndMDIClient, WM_MDIICONARRANGE, 0, 0L);
+ break;
+
+
+ // OPERATIONS MENU SELECTIONS
+
+ case IDM_OPERATIONSBACKUP:
+ case IDM_OPERATIONSRESTORE:
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSTRANSFER:
+ case IDM_OPERATIONSVERIFY:
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSCATALOG:
+
+ MUI_StartOperation ( wID, TRUE );
+
+ break;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSINFO:
+ case IDM_OPERATIONSDISCON:
+ case IDM_OPERATIONSCONNECT:
+ case IDM_OPERATIONSCATMAINT:
+ case IDM_OPERATIONSSEARCH:
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSEJECT:
+ case IDM_OPERATIONSERASE:
+ case IDM_OPERATIONSRETENSION:
+
+#ifdef OS_WIN32
+ case IDM_OPERATIONSFORMAT:
+#endif // OS_WIN32
+
+#ifdef OEM_EMS
+ case IDM_OPERATIONSEXCHANGE:
+#endif // OEM_EMS
+
+ MUI_StartOperation ( wID, TRUE );
+
+ break;
+
+ // HELP MENU SELECTIONS
+
+ case IDM_HELPINDEX:
+ case IDM_HELPSEARCH:
+ case IDM_HELPUSINGHELP:
+
+ HM_MenuCommands ( hWnd, wID );
+ break;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ // MENU ITEMS THAT CALL DIALOGS.
+
+ case IDM_SELECTSAVE:
+ wDialogID = IDD_SELECTSAVE;
+ break;
+
+ case IDM_SELECTUSE:
+ wDialogID = IDD_SELECTUSE;
+ break;
+
+ case IDM_SELECTDELETE:
+ wDialogID = IDD_SELECTDELETE;
+ break;
+
+ case IDM_JOBMAINTENANCE:
+ wDialogID = IDD_JOBMAINTENANCE;
+ break;
+
+ case IDM_SETTINGSGENERAL:
+ wDialogID = IDD_SETTINGSOPTIONS;
+ break;
+
+ case IDM_SETTINGSBACKUP:
+ wDialogID = IDD_SETTINGSBACKUP;
+ break;
+
+ case IDM_SETTINGSRESTORE:
+ wDialogID = IDD_SETTINGSRESTORE;
+ break;
+
+ case IDM_SETTINGSLOGGING:
+ wDialogID = IDD_SETTINGSLOGGING;
+ break;
+
+ case IDM_SETTINGSNETWORK:
+ wDialogID = IDD_SETTINGSNETWORK;
+ break;
+
+ case IDM_SETTINGSCATALOG:
+ wDialogID = IDD_SETTINGSCATALOG;
+ break;
+
+ case IDM_SETTINGSHARDWARE:
+ wDialogID = IDD_SETTINGSHARDWARE;
+ break;
+
+ case IDM_SETTINGSDEBUGWINDOW:
+ wDialogID = IDD_SETTINGSDEBUGWINDOW;
+ break;
+
+# else // defined ( OEM_MSOFT ) // alternate feature
+
+ case IDM_OPERATIONSHARDWARE:
+ wDialogID = IDD_SETTINGSHARDWARE;
+ break;
+
+# endif // else defined ( OEM_MSOFT ) // unsupported/alternate feature
+
+
+
+# if !defined ( OEM_MSOFT ) // Standard Maynstream product feature
+
+ case IDM_HELPABOUTWINTERPARK:
+ wDialogID = IDD_HELPABOUTWINTERPARK;
+ break;
+
+
+# else // OEM_MSOFT - alternate feature
+
+ case IDM_HELPABOUTNOSTRADOMUS:
+ wDialogID = IDD_HELPABOUTWINTERPARK; // NEED TO CHANGE THIS!!
+ break;
+
+# endif // !defined ( OEM_MSOFT ) - standard/alternate feature
+
+
+ default:
+
+ fCmdProcessed = FALSE;
+
+ } /* end switch() */
+
+
+ // Check to see if a dialog ID was found. If so, show it.
+
+ if ( fCmdProcessed && wDialogID != 0xFFFF ) {
+
+ if ( DM_ShowDialog ( hWnd, wDialogID, (PVOID)0 ) == DM_SHOWNOTFOUND ) {
+ fCmdProcessed = FALSE;
+ }
+ }
+
+ return fCmdProcessed;
+
+} /* end MM_MenuCmdHandler() */
+
+
+/******************************************************************************
+
+ Name: MM_ShowMenuStatusHelp()
+
+ Description: This handles showing menu help one-liners on the status
+ line.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MM_ShowMenuStatusHelp (
+
+WORD wID ) // ID of the menu item for displaying status help
+
+{
+ // You may be able to get away with just a range, but this
+ // way, you are guaranteed that no erroneous messages will be
+ // displayed.
+
+# if !defined ( OEM_MSOFT ) //alternate functionality
+ {
+
+ switch ( wID ) { //Menus for standard Maynstream product...
+
+ case IDM_FILEPRINT:
+ case IDM_FILESETUP:
+ case IDM_FILEEXIT:
+
+ case IDM_JOBMAINTENANCE:
+
+ case IDM_TREEEXPANDONE:
+ case IDM_TREEEXPANDBRANCH:
+ case IDM_TREEEXPANDALL:
+ case IDM_TREECOLLAPSEBRANCH:
+
+ case IDM_VIEWTREEANDDIR:
+ case IDM_VIEWTREEONLY:
+ case IDM_VIEWDIRONLY:
+ case IDM_VIEWSPLIT:
+ case IDM_VIEWALLFILEDETAILS:
+ case IDM_VIEWSORTNAME:
+ case IDM_VIEWSORTTYPE:
+ case IDM_VIEWSORTSIZE:
+ case IDM_VIEWSORTDATE:
+ case IDM_VIEWFONT:
+
+ case IDM_OPERATIONSBACKUP:
+ case IDM_OPERATIONSRESTORE:
+ case IDM_OPERATIONSTRANSFER:
+ case IDM_OPERATIONSVERIFY:
+ case IDM_OPERATIONSINFO:
+ case IDM_OPERATIONSCATALOG:
+ case IDM_OPERATIONSCATMAINT:
+ case IDM_OPERATIONSSEARCH:
+ case IDM_OPERATIONSEJECT:
+ case IDM_OPERATIONSERASE:
+ case IDM_OPERATIONSRETENSION:
+ case IDM_OPERATIONSCONNECT:
+ case IDM_OPERATIONSDISCON:
+#ifdef OS_WIN32
+ case IDM_OPERATIONSFORMAT:
+#endif // OS_WIN32
+
+ case IDM_SELECTCHECK:
+ case IDM_SELECTUNCHECK:
+ case IDM_SELECTADVANCED:
+ case IDM_SELECTSUBDIRS:
+ case IDM_SELECTSAVE:
+ case IDM_SELECTUSE:
+ case IDM_SELECTDELETE:
+ case IDM_SELECTCLEAR:
+
+ case IDM_SETTINGSBACKUP:
+ case IDM_SETTINGSRESTORE:
+ case IDM_SETTINGSLOGGING:
+ case IDM_SETTINGSNETWORK:
+ case IDM_SETTINGSCATALOG:
+ case IDM_SETTINGSHARDWARE:
+ case IDM_SETTINGSDEBUGWINDOW:
+ case IDM_SETTINGSGENERAL:
+
+ case IDM_WINDOWSCASCADE:
+ case IDM_WINDOWSTILE:
+ case IDM_WINDOWSREFRESH:
+ case IDM_WINDOWSCLOSEALL:
+ case IDM_WINDOWSARRANGEICONS:
+
+ case IDM_HELPINDEX:
+ case IDM_HELPSEARCH:
+ case IDM_HELPUSINGHELP:
+ case IDM_HELPABOUTWINTERPARK:
+
+ STM_DrawText ( ID(wID) );
+ return;
+
+ default:
+
+ STM_DrawText ( TEXT("") );
+ return;
+
+ }
+ }
+# else //if defined ( OEM_MSOFT ) //alternate functionality
+ {
+ switch ( wID ) { // Menus for OEM_MSOFT product...
+
+ case IDM_OPERATIONSBACKUP:
+ case IDM_OPERATIONSRESTORE:
+ case IDM_OPERATIONSCATALOG:
+ case IDM_OPERATIONSERASE:
+ case IDM_OPERATIONSRETENSION:
+ case IDM_OPERATIONSEJECT:
+ case IDM_OPERATIONSHARDWARE:
+ case IDM_OPERATIONSEXIT:
+ case IDM_OPERATIONSFORMAT:
+#ifdef OEM_EMS
+ case IDM_OPERATIONSEXCHANGE:
+#endif
+
+ case IDM_TREEEXPANDONE:
+ case IDM_TREEEXPANDBRANCH:
+ case IDM_TREEEXPANDALL:
+ case IDM_TREECOLLAPSEBRANCH:
+
+ case IDM_VIEWTREEANDDIR:
+ case IDM_VIEWTREEONLY:
+ case IDM_VIEWDIRONLY:
+ case IDM_VIEWSPLIT:
+ case IDM_VIEWALLFILEDETAILS:
+ case IDM_VIEWSTATUS:
+ case IDM_VIEWURIBBON:
+ case IDM_VIEWFONT:
+
+ case IDM_SELECTCHECK:
+ case IDM_SELECTUNCHECK:
+
+ case IDM_WINDOWSCASCADE:
+ case IDM_WINDOWSTILE:
+ case IDM_WINDOWSARRANGEICONS:
+ case IDM_WINDOWSREFRESH:
+ case IDM_WINDOWSCLOSEALL:
+
+ case IDM_HELPINDEX:
+ case IDM_HELPSEARCH:
+ case IDM_HELPUSINGHELP:
+ case IDM_HELPABOUTNOSTRADOMUS:
+
+ STM_DrawText ( ID(wID) );
+ return;
+
+ default:
+
+ STM_DrawText ( TEXT("") );
+ return;
+
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //alternate functionality
+
+
+} /* end MM_ShowMenuStatusHelp() */
diff --git a/private/utils/ntbackup/src/msgbox.c b/private/utils/ntbackup/src/msgbox.c
new file mode 100644
index 000000000..c508cfe30
--- /dev/null
+++ b/private/utils/ntbackup/src/msgbox.c
@@ -0,0 +1,1304 @@
+
+/******************************************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+JPW
+
+ Name: msgbox.c
+
+ Description: This module contains the message box functions. The
+ original WM_MsgBox call has been stubbed to call the
+ new WM_MessageBox. See the header of WM_MessageBox
+ for a complete description of the new features.
+
+ Functions in this module:
+
+ WM_MsgBox - old call to display message box
+ WM_MessageBox - new call to display message box
+ WM_MessageDlg - dialog procedure for message box
+
+
+ $Log: G:\ui\logfiles\msgbox.c_v $
+
+ Rev 1.49.1.2 04 Mar 1994 16:57:24 STEVEN
+prompt if disk is full
+
+ Rev 1.49.1.1 28 Jan 1994 17:22:30 Glenn
+Simplified and fixed Icon support.
+
+ Rev 1.49.1.0 04 Nov 1993 15:22:20 STEVEN
+fixes from Wa
+
+ Rev 1.49 10 Aug 1993 14:29:58 GLENN
+Now showing help only if the help ID is not NULL.
+
+ Rev 1.48 28 Jul 1993 17:52:18 MARINA
+enable c++
+
+ Rev 1.47 30 Jun 1993 14:46:04 STEVEN
+update lagest message to 400
+
+ Rev 1.46 15 Jun 1993 11:19:10 GLENN
+Fixed box to load button text strings only when needed.
+
+ Rev 1.45 08 Jun 1993 15:27:46 BARRY
+Get rid of DT_TABSTOP in call to DrawText -- was hosing '&' in dialogs.
+
+ Rev 1.44 24 May 1993 14:48:04 GLENN
+Added Dynamic Button Sizing based on the length of button string and Font Type.
+
+ Rev 1.43 03 May 1993 11:48:02 CHUCKB
+Change default tab stops in message box.
+
+ Rev 1.42 01 Nov 1992 16:02:38 DAVEV
+Unicode changes
+
+ Rev 1.41 16 Oct 1992 15:55:24 GLENN
+Got rid of a ton of compiler warnings for windows.
+
+ Rev 1.40 14 Oct 1992 15:58:26 GLENN
+Added code to pause and resume the wait cursor during a message box.
+
+ Rev 1.39 04 Oct 1992 19:38:56 DAVEV
+Unicode Awk pass
+
+ Rev 1.38 17 Aug 1992 13:20:44 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.37 10 Jun 1992 14:30:06 JOHNWT
+changed font to ghFontMsgBox
+
+ Rev 1.36 29 May 1992 15:59:42 JOHNWT
+PCH updates
+
+ Rev 1.35 30 Mar 1992 18:02:44 GLENN
+Added support for pulling resources from .DLL
+
+ Rev 1.34 23 Mar 1992 16:10:48 JOHNWT
+added WMMB_BUT2DEFAULT functionality
+
+ Rev 1.33 22 Mar 1992 12:53:06 JOHNWT
+added WMMB_OKDISABLE
+
+ Rev 1.32 19 Mar 1992 11:45:50 JOHNWT
+moved WM_MakeAppActive to winmang.c
+
+ Rev 1.31 17 Mar 1992 08:05:02 ROBG
+added IDHELP
+
+ Rev 1.30 28 Feb 1992 16:32:22 JOHNWT
+tried more things
+
+ Rev 1.29 25 Feb 1992 21:25:08 GLENN
+Removed system modal specific calls.
+
+ Rev 1.28 23 Feb 1992 13:55:56 GLENN
+Trying new things...
+
+ Rev 1.27 18 Feb 1992 18:33:46 GLENN
+Placed strategically located WM_MultiTask() statements.
+
+ Rev 1.26 11 Feb 1992 17:24:16 GLENN
+Moved multitask to destroy case.
+
+ Rev 1.25 06 Feb 1992 16:11:00 DAVEV
+NT ONLY: Kludged weird bug where GetClientRect on a push button seems to return dialog units in Re
+ct.bottom?!?
+
+ Rev 1.24 31 Jan 1992 14:37:24 JOHNWT
+if iconic use IDS_APPNAME as msg title
+
+ Rev 1.23 31 Jan 1992 13:44:06 JOHNWT
+moved center operation to DM_CenterDialog
+
+ Rev 1.22 30 Jan 1992 11:41:04 JOHNWT
+moved WMMB_SYSMODAL to msgbox.h
+
+ Rev 1.21 29 Jan 1992 13:14:18 CARLS
+No change
+
+ Rev 1.20 27 Jan 1992 00:29:46 CHUCKB
+Updated dialog id's.
+
+ Rev 1.19 21 Jan 1992 16:53:52 JOHNWT
+changed checkyy to noyycheck flag
+
+ Rev 1.18 14 Jan 1992 17:25:00 JOHNWT
+more sysmodal changes
+
+ Rev 1.17 14 Jan 1992 16:36:16 JOHNWT
+reset ghModelessDialog to sysmodal
+
+ Rev 1.16 13 Jan 1992 10:22:18 JOHNWT
+added help
+
+ Rev 1.15 20 Dec 1991 16:58:36 JOHNWT
+return ghModelessDialog
+
+ Rev 1.14 19 Dec 1991 15:24:38 GLENN
+Added windows.h
+
+ Rev 1.13 18 Dec 1991 11:21:30 JOHNWT
+changed modeless to runtime
+
+ Rev 1.12 16 Dec 1991 17:18:18 JOHNWT
+made parent the active window
+
+ Rev 1.11 16 Dec 1991 10:07:20 JOHNWT
+removed get/set focus call!
+
+ Rev 1.10 13 Dec 1991 16:40:42 JOHNWT
+fixed last fix
+
+ Rev 1.9 13 Dec 1991 15:45:06 JOHNWT
+added get/setfocus
+
+ Rev 1.8 12 Dec 1991 17:07:12 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.7 09 Dec 1991 11:43:58 JOHNWT
+fixed bogus ReleaseDC
+
+ Rev 1.6 04 Dec 1991 15:19:40 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.5 02 Dec 1991 12:53:54 JOHNWT
+check malloc/callocs
+
+ Rev 1.4 25 Nov 1991 15:25:14 JOHNWT
+adjusted size of msgbox
+
+ Rev 1.3 24 Nov 1991 13:03:52 JOHNWT
+removed large font on inst line
+
+ Rev 1.2 21 Nov 1991 18:11:26 JOHNWT
+added yy flag check
+
+ Rev 1.1 21 Nov 1991 13:33:48 JOHNWT
+do not force large font
+
+ Rev 1.0 20 Nov 1991 19:34:00 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+#include "ctl3d.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/* module wide defines */
+
+#define WMMB_MAX_TITLE 100 /* maximum size of title */
+#define WMMB_MAX_MESSAGE 400 /* maximum size of message */
+#define WMMB_MAX_INSTRUCTION 60 /* maximum size of instruction */
+
+#define WMMB_MAX_BUTTON 40 /* maximum size of button text */
+#define WMMB_MAX_MSG_LINE (IS_JAPAN()?60:40) /* max line length (dlg base units) */
+#define WMMB_MID_MSG_LINE (IS_JAPAN()?40:30) /* mid line length (dlg base units) */
+#define WMMB_MIN_MSG_LINE 20 /* min line length (dlg base units) */
+
+#define BUTTON_BORDERWIDTH 3
+
+/* structure passed to WM_MessageDlg */
+
+typedef struct DS_MESSAGE {
+
+ WORD wIcon; /* message box icon to use */
+ WORD wType; /* buttons to use, etc */
+ CHAR_PTR pTitle; /* ptr to title (caption) */
+ CHAR_PTR pMessage; /* ptr to message text */
+ CHAR_PTR pInstruction; /* optional instruction line */
+ WORD wInstBitMap; /* optional bitmap to precede inst line */
+ WORD wHelpID; /* optional help id for message */
+
+} DS_MESSAGE, far *DS_MESSAGE_PTR;
+
+// MODULE-WIDE VARIABLES
+
+static WORD mwwHelpButID, /* help button id */
+ mwwHelpID; /* help id */
+
+/* Dialog procedure prototype */
+
+DLGRESULT APIENTRY WM_MessageDlg( HWND, MSGID, MP1, MP2 );
+
+static INT MB_SetButtons ( HWND, WORD, INT *, DS_MESSAGE_PTR );
+static INT MB_GetMaxButtonExtent ( HDC, LPSTR, INT );
+
+
+
+/******************************************************************************
+
+ Name: WM_MsgBox()
+
+ Description: This function displays a message box. The message box can
+ contain a title, message, various buttons, and one out
+ of various icons.
+
+ Modified: 11/14/91
+
+ Returns: Various message IDs depending on the input parameters and
+ the button selected.
+
+ WMMB_IDOK
+ WMMB_IDRETRY
+ WMMB_IDIGNOR
+ WMMB_IDYES
+ WMMB_IDCONTINUE
+ WMMB_IDCANCEL
+ WMMB_IDNO
+ WMMB_IDABORT
+ WMMB_IDDISABLE
+
+
+ Notes: This function is now a stub which calls WM_MessageBox.
+
+******************************************************************************/
+
+INT WM_MsgBox (
+
+LPSTR lpszTitle, /* I - title of the message box */
+LPSTR lpszMessage, /* I - message of the message box */
+WORD wType, /* I - type IDs of buttons OR'd together */
+WORD wIcon ) /* I - icon ID to be displayed */
+
+{
+
+ return WM_MessageBox( lpszTitle, lpszMessage, wType, wIcon, (CHAR_PTR)NULL, 0, 0 );
+
+} /* end WM_MsgBox() */
+
+
+/******************************************************************************
+
+ Name: WM_MessageBox()
+
+ Description: This function displays a message box. The message box can
+ contain a title, icon, message, instruction line, a
+ bitmap which precedes the instruction line, and various
+ buttons. If WMMB_NOYYCHECK is set, it will not check the YY
+ flag, otherwise it will return yes if it is set.
+
+ Modified: 11/14/91
+
+ Input: Text input can be in the form of pointers or resids.
+ The message can contain line-breaks (\012) and tabs (\011).
+
+ pTitle - msgbox title, if NULL, "Message" is title
+ pMessage - message text ( max 400 chars if resid )
+
+ wType - one of the following:
+
+ WMMB_OK - OK button only
+ WMMB_RETRYCANCEL - Retry/Cancel buttons
+ WMMB_YESNO - Yes/No buttons
+ WMMB_OKCANCEL - OK/Cancel buttons
+ WMMB_CONTABORT - Continue/Abort buttons
+ WMMB_CONTCANCEL - Continue/Cancel buttons
+ WMMB_OKDISABLE - OK/Disable buttons
+ WMMB_ABORTRETRYIGNOR - Abort/Retry/Ignore buttons
+
+ maybe OR'ed with:
+
+ WMMB_BUT2DEFAULT - make but 2 default
+ WMMB_NOYYCHECK - Ignore the YY flag
+ WMMB_INSTBIG - Big font for inst
+ WMMB_MSGBIG - Big font for msg
+ WMMB_MSGBIGBOLD - Big-bold font for msg
+
+ wIcon - one of the following (0 for none)
+
+ WMMB_ICONQUESTION - question mark
+ WMMB_ICONSTOP - stop sign
+ WMMB_ICONINFORMATION - circled i
+ WMMB_ICONEXCLAMATION - circled !
+
+ pInstruction - inst text (one line only, NULL for none)
+ wInstBitMap - inst bitmap to precede inst (0 for none)
+ wHelpID - help id for message (0 for none)
+
+ Return: Various message IDs depending on the input parameters and
+ the button selected.
+
+ Affirmative responses: Negative responses:
+
+ WMMB_IDOK WMMB_IDCANCEL
+ WMMB_IDRETRY WMMB_IDNO
+ WMMB_IDYES WMMB_IDABORT
+ WMMB_IDCONTINUE WMMB_IDDISABLE
+
+ Notes:
+
+******************************************************************************/
+
+INT WM_MessageBox (
+
+ CHAR_PTR pTitle, /* I - title, if NULL - TEXT("Message") is title */
+ CHAR_PTR pMessage, /* I - ptr to message or resid */
+ WORD wType, /* I - type of buttons, font size */
+ WORD wIcon, /* I - icon to display, if 0 none is displayed */
+ CHAR_PTR pInstruction, /* I - ptr to message of resid */
+ WORD wInstBitMap, /* I - bitmap or 0 for none */
+ WORD wHelpID ) /* I - help id for message */
+
+{
+ INT rc;
+ DS_MESSAGE Message;
+ WNDPROC lpProc ;
+ HWND hWnd;
+ CHAR_PTR pResTitle = (CHAR_PTR)NULL;
+ CHAR_PTR pResMessage = (CHAR_PTR)NULL;
+ CHAR_PTR pResInstruction = (CHAR_PTR)NULL;
+ /* If the ignore option is not set, check the YY flag to see if we
+ should just return. */
+
+ WM_ShowWaitCursor( FALSE ) ;
+
+ if ( !( wType & WMMB_NOYYCHECK ) &&
+ ( CDS_GetYesFlag ( CDS_GetCopy() ) == YESYES_FLAG ) ) {
+
+ return WMMB_IDYES;
+ }
+
+ /* If a RESOURCE ID was passed, copy the string from the resource. */
+
+ if ( pTitle && ! HIWORD(pTitle) ) {
+
+ pResTitle = ( CHAR_PTR )calloc( WMMB_MAX_TITLE, sizeof ( CHAR ) );
+
+ if ( pResTitle == (CHAR_PTR)NULL ) {
+ return WMMB_IDNO;
+ }
+
+ RSM_StringCopy ( LOWORD((DWORD)pTitle), pResTitle, WMMB_MAX_TITLE - 1 );
+ pTitle = pResTitle;
+ }
+
+ if ( pMessage && ! HIWORD(pMessage) ) {
+
+ pResMessage = ( CHAR_PTR )calloc( WMMB_MAX_MESSAGE, sizeof ( CHAR ) );
+
+ if ( pResMessage == (CHAR_PTR)NULL ) {
+ if ( pResTitle ) {
+ free( pResTitle );
+ }
+ return WMMB_IDNO;
+ }
+
+ RSM_StringCopy ( LOWORD((DWORD)pMessage), pResMessage, WMMB_MAX_MESSAGE - 1 );
+ pMessage = pResMessage;
+ }
+
+ if ( pInstruction && ! HIWORD(pInstruction) ) {
+
+ pResInstruction = ( CHAR_PTR )calloc( WMMB_MAX_INSTRUCTION, sizeof ( CHAR ) );
+
+ if ( pResInstruction == (CHAR_PTR)NULL ) {
+
+ if ( pResTitle ) {
+ free( pResTitle );
+ }
+
+ if ( pResMessage ) {
+ free( pResMessage );
+ }
+
+ return WMMB_IDNO;
+ }
+
+ RSM_StringCopy ( LOWORD((DWORD)pInstruction), pResInstruction, WMMB_MAX_INSTRUCTION - 1 );
+ pInstruction = pResInstruction;
+ }
+
+ /* Set up message structure to pass for the init dialog processing */
+
+ Message.wIcon = wIcon;
+ Message.wType = wType;
+ Message.pTitle = pTitle;
+ Message.pMessage = pMessage;
+ Message.pInstruction = pInstruction;
+ Message.wInstBitMap = wInstBitMap;
+ Message.wHelpID = wHelpID;
+
+ WM_MultiTask ();
+
+ WM_MakeAppActive();
+
+ WM_MultiTask ();
+
+ /* Get the top window of our app */
+
+ if ( ghModelessDialog ) {
+ hWnd = GetLastActivePopup( ghModelessDialog );
+ }
+ else {
+ hWnd = GetLastActivePopup( ghWndFrame );
+ }
+
+ // Check to see if the wait cursor is being shown. If so, pause it,
+ // then resume it later.
+
+ WM_ShowWaitCursor ( SWC_PAUSE );
+
+ WM_MultiTask ();
+
+ /* make our proc instance and display the dialog */
+
+ lpProc = (WNDPROC)MakeProcInstance( ( FARPROC )WM_MessageDlg, ghInst ) ;
+
+ rc = DialogBoxParam( ghResInst,
+ MAKEINTRESOURCE( IDD_MESSAGE_BOX ),
+ hWnd,
+ (DLGPROC)lpProc,
+ (LONG) (DS_MESSAGE_PTR)&Message );
+
+ FreeProcInstance( lpProc );
+
+ // Resume the wait cursor. (only if it was truly paused)
+
+ WM_ShowWaitCursor ( SWC_RESUME );
+
+ /* free any allocated memory due to resids */
+
+ if ( pResTitle ) {
+ free( pResTitle );
+ }
+
+ if ( pResMessage ) {
+ free( pResMessage );
+ }
+
+ if ( pResInstruction ) {
+ free( pResInstruction );
+ }
+
+ return rc;
+
+} /* end WM_MessageBox() */
+
+
+/******************************************************************************
+
+ Name: WM_MessageDlg ()
+
+ Description: Dialog procedure for the message box.
+
+ Modified: 11/14/91
+
+ Returns: TRUE if message was processed
+
+ Notes: The size and placement of all controls is calculated
+ during the INIT_DIALOG processing. Required info is
+ placed in static variables for use during the PAINT
+ message.
+
+******************************************************************************/
+
+DLGRESULT APIENTRY WM_MessageDlg (
+
+ HWND hDlg, /* I - from Windows */
+ MSGID msg, /* I - from Windows */
+ MP1 mp1, /* I - from Windows */
+ MP2 mp2 ) /* I - from Windows, contains ptr to DS_MESSAGE struc */
+
+{
+ static WORD wIcon, /* icon to be displayed in upper left */
+ wType, /* holds type of buttons, font */
+ wInstBitMap; /* bitmap for instruction line */
+ static HWND hWndIcon, /* handle of window for icon drawing */
+ hWndMsg, /* handle of window for message text */
+ hWndInst; /* handle of window for inst bitmap/text */
+ static CHAR_PTR pMsgText, /* message text */
+ pInstText; /* instruction text */
+ static RECT MsgRect, /* rectangle in which to display message */
+ InstRect; /* rectangle in which to displa inst */
+ static INT nInstIconX; /* X coordinate of instruction bitmap */
+ static LOGFONT logfont; /* logical font */
+ static LONG lDlgBaseUnits; /* base units for dialog boxes */
+ static INT nButtonWidth; /* width of the buttons */
+
+ HWND hWndBut; /* button window */
+ RECT DlgRect, /* calculated size of dialog */
+ Rect; /* used for get calls */
+ HDC hDC; /* device context */
+ INT nTextBot, /* height of all texts + margins */
+ nButsBot = 2, /* number of buttons (def to 2) */
+ nButX, /* X coordinate of buttons */
+ nTextWidth; /* longest width of text */
+ SIZE sizeRect; /* length/width of line in current hDC*/
+ HFONT hFont; /* holds old font */
+
+
+ /* switch based on message passed by Windows */
+
+ switch ( msg ) {
+
+/***************************************************************************
+ * Initialize the dialog
+ ***************************************************************************/
+
+ case WM_INITDIALOG :
+ {
+ DS_MESSAGE_PTR pMessage;
+ HICON hIcon;
+ BYTE csfont ;
+ if (IS_JAPAN() ) {
+ CHARSETINFO csi;
+ DWORD dw = GetACP();
+
+ if (!TranslateCharsetInfo((DWORD*)dw, &csi, TCI_SRCCODEPAGE))
+ csi.ciCharset = ANSI_CHARSET;
+ csfont = csi.ciCharset;
+ } else {
+ csfont = ANSI_CHARSET ;
+ }
+
+ WM_MultiTask ();
+
+ /* Let's go 3-D! */
+ Ctl3dSubclassDlgEx( hDlg, CTL3D_ALL );
+
+ pMessage = (DS_MESSAGE_PTR) mp2;
+
+ /* save info in static variables */
+
+ pMsgText = pMessage->pMessage;
+ pInstText = pMessage->pInstruction;
+ wIcon = pMessage->wIcon;
+ wType = pMessage->wType;
+ wInstBitMap = pMessage->wInstBitMap;
+
+ /* if the message is small, force it into the big font */
+
+ // if ( ( strlen( pMsgText ) < ( 3 * WMMB_MAX_MSG_LINE ) ) &&
+ // !( wType & ( WMMB_MSGBIG | WMMB_MSGBIGBOLD ) ) ) {
+ // wType |= WMMB_MSGBIG;
+ // }
+
+
+ // Set the icon.
+
+ switch ( wIcon ) {
+
+ case WMMB_ICONQUESTION:
+ hIcon = LoadIcon( (HINSTANCE)NULL, IDI_QUESTION );
+ break;
+
+ case WMMB_ICONSTOP:
+ hIcon = LoadIcon( (HINSTANCE)NULL, IDI_HAND );
+ break;
+
+ case WMMB_ICONEXCLAMATION:
+ hIcon = LoadIcon( (HINSTANCE)NULL, IDI_EXCLAMATION );
+ break;
+
+ default:
+ hIcon = LoadIcon( (HINSTANCE)NULL, IDI_ASTERISK );
+ break;
+ }
+
+ SendDlgItemMessage ( hDlg, IDD_MSG_ICON, STM_SETICON, (MP1)hIcon, 0L );
+
+
+ /* Get the base units for dialogs which will determine where */
+ /* everything resides. */
+
+ lDlgBaseUnits = GetDialogBaseUnits();
+
+ /* Create our logical font */
+
+ if (IS_JAPAN() ) {
+ logfont.lfWeight = FW_NORMAL;
+ logfont.lfCharSet = csfont;
+ logfont.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
+ strcpy( logfont.lfFaceName, TEXT("MS Shell Dlg") );
+ } else {
+ logfont.lfWeight = FW_BOLD;
+ logfont.lfCharSet = ANSI_CHARSET;
+ logfont.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
+ strcpy( logfont.lfFaceName, TEXT("Swiss") );
+ }
+
+ if( pMessage->pTitle ) {
+ SetWindowText ( hDlg, pMessage->pTitle );
+ }
+
+ /* set up rectangle for call to DrawText which will */
+ /* modify the right and bottom to make the text fit. */
+ /* We start with just one line of max chars. */
+
+ MsgRect.left = 0;
+ MsgRect.top = 0;
+ MsgRect.right = WMMB_MAX_MSG_LINE * LOWORD(lDlgBaseUnits);
+ MsgRect.bottom = HIWORD(lDlgBaseUnits);
+
+ hWndMsg = GetDlgItem( hDlg, IDD_MSG_TEXT );
+ hDC = GetDC( hWndMsg );
+
+ if ( wType & ( WMMB_MSGBIG | WMMB_MSGBIGBOLD ) ) {
+ logfont.lfHeight = ( wType & WMMB_MSGBIG ) ?
+ HIWORD(lDlgBaseUnits) + (HIWORD(lDlgBaseUnits) / 4) :
+ HIWORD(lDlgBaseUnits) + (HIWORD(lDlgBaseUnits) / 2);
+ hFont = SelectObject( hDC, CreateFontIndirect( &logfont ) );
+ } else {
+ SelectObject ( hDC, ghFontMsgBox );
+ }
+
+ nButtonWidth = MB_SetButtons ( hDlg, wType, &nButsBot, pMessage );
+
+ /* Make sure we don't have a long skinny message box */
+
+ GetTextExtentPoint( hDC, pMsgText, strlen( pMsgText ), &sizeRect );
+
+ if ( sizeRect.cx < (INT) MsgRect.right ) {
+ MsgRect.right = WMMB_MIN_MSG_LINE * LOWORD(lDlgBaseUnits);
+ } else if ( pInstText == (CHAR_PTR)NULL ) {
+ if ( sizeRect.cx < (INT) (2 * MsgRect.right) ) {
+ MsgRect.right = WMMB_MIN_MSG_LINE * LOWORD(lDlgBaseUnits);
+ } else if ( sizeRect.cx < (INT) (3 * MsgRect.right) ) {
+ MsgRect.right = WMMB_MID_MSG_LINE * LOWORD(lDlgBaseUnits);
+ }
+ } else {
+ if ( sizeRect.cx < (INT) (2 * MsgRect.right) ) {
+ MsgRect.right = WMMB_MID_MSG_LINE * LOWORD(lDlgBaseUnits);
+ }
+ }
+
+ DrawText( hDC, pMsgText, -1, &MsgRect,
+ DT_CALCRECT | DT_EXPANDTABS | DT_LEFT |
+ DT_NOPREFIX | DT_WORDBREAK );
+
+ if ( wType & ( WMMB_MSGBIG | WMMB_MSGBIGBOLD ) ) {
+ DeleteObject( SelectObject( hDC, hFont ) );
+ }
+
+ ReleaseDC( hWndMsg, hDC );
+
+ /* if text is less than the minimum, set length to minimum */
+
+ nTextWidth = MsgRect.right;
+ if ( nTextWidth < (INT)( WMMB_MIN_MSG_LINE * LOWORD(lDlgBaseUnits) ) ) {
+ nTextWidth = WMMB_MIN_MSG_LINE * LOWORD(lDlgBaseUnits);
+ MsgRect.right = nTextWidth;
+ }
+
+ /* calculate the width of the instruction line */
+
+ if ( pInstText != (CHAR_PTR)NULL ) {
+
+ hWndInst = GetDlgItem( hDlg, IDD_MSG_INST );
+ hDC = GetDC( hWndInst );
+
+ if ( wType & WMMB_INSTBIG ) {
+ logfont.lfHeight = HIWORD(lDlgBaseUnits) + ( HIWORD(lDlgBaseUnits) / 4 );
+ hFont = SelectObject( hDC, CreateFontIndirect( &logfont ) );
+ } else {
+ SelectObject ( hDC, ghFontMsgBox );
+ }
+
+ GetTextExtentPoint( hDC, pInstText, strlen( pInstText ),
+ &sizeRect );
+
+ if ( wType & WMMB_INSTBIG ) {
+ DeleteObject( SelectObject( hDC, hFont ) );
+ }
+
+ ReleaseDC( hWndInst, hDC );
+
+ nTextWidth = sizeRect.cx;
+
+ /* if bitmap defined, use icon size to calculate size */
+
+ if ( wInstBitMap != 0 ) {
+ nTextWidth += LOWORD(lDlgBaseUnits) +
+ GetSystemMetrics( SM_CXICON );
+ }
+
+ /* if the line is longer than the max, set it back */
+
+ if ( nTextWidth > (INT)( WMMB_MAX_MSG_LINE * LOWORD(lDlgBaseUnits) ) ) {
+ nTextWidth = WMMB_MAX_MSG_LINE * LOWORD(lDlgBaseUnits) ;
+ }
+
+ /* if the instruction text is less than the message, set it to */
+ /* the same and then set up the instruction rectangle size. */
+
+ if ( nTextWidth < MsgRect.right ) {
+ nTextWidth = MsgRect.right;
+ }
+
+ InstRect.top = 0;
+ InstRect.left = 0;
+ InstRect.right = nTextWidth;
+ InstRect.bottom = GetSystemMetrics( SM_CYICON );
+
+ /* if no bitmap and inst is less than max, center it */
+
+ if ( wInstBitMap == 0 ) {
+
+ if ( sizeRect.cx < (INT) nTextWidth ) {
+ InstRect.left = ( nTextWidth - sizeRect.cx ) / 2;
+ }
+
+ } else {
+
+ /* calculate the X position of the bitmap */
+
+ nInstIconX = LOWORD(lDlgBaseUnits) +
+ GetSystemMetrics( SM_CXICON ) + sizeRect.cx;
+ if ( nInstIconX < nTextWidth ) {
+ nInstIconX = ( nTextWidth - nInstIconX ) / 2;
+ } else {
+ nInstIconX = 0;
+ }
+
+ InstRect.left = nInstIconX + LOWORD(lDlgBaseUnits) +
+ GetSystemMetrics( SM_CXICON );
+ }
+
+ /* if the inst stuff is longer than the message, reset the msg */
+
+ if ( nTextWidth > MsgRect.right) {
+ MsgRect.right = nTextWidth;
+ }
+
+ }
+
+
+ /* get the current dialog rectangle and subtract off the size */
+ /* of the client area which will leave us the size of the */
+ /* borders, title, etc. */
+
+ GetWindowRect( hDlg, &DlgRect );
+ GetClientRect( hDlg, &Rect );
+
+ DlgRect.right -= Rect.right;
+ DlgRect.bottom -= Rect.bottom;
+
+ /* Now we calculate the width and height of the dialog. */
+ /* We add 8 base-unit-widths for margins, the width of */
+ /* the icon, the width of the message text, and the */
+ /* width of a button. */
+
+ hWndBut = GetDlgItem( hDlg, IDD_MSG_BUT1 );
+
+
+# if defined ( NTKLUG )
+ {
+
+ // Note: this is a definite kludge for NT!!
+ // the height seems to be getting returned in
+ // dialog units??!! (which happen to be 14).
+ // The temporary fix is to convert these units to pixels.
+
+ GetClientRect( hWndBut, &Rect );
+
+ if (Rect.bottom == 14)
+ Rect.bottom = (Rect.bottom * LOWORD (lDlgBaseUnits)) /4;
+ }
+# else
+ {
+ GetClientRect( hWndBut, &Rect );
+ }
+# endif
+
+ DlgRect.right += (8 * LOWORD(lDlgBaseUnits) ) +
+ GetSystemMetrics( SM_CXICON ) +
+ MsgRect.right +
+ nButtonWidth;
+// Rect.right;
+
+ /* The height is room for margins plus the height of the */
+ /* message text. If an instruction line is defined, add */
+ /* the height of the line which is defined by the icon */
+ /* height. */
+
+ nTextBot = (2 * HIWORD(lDlgBaseUnits) ) + MsgRect.bottom;
+
+ if ( pMessage->pInstruction != (CHAR_PTR)NULL ) {
+ nTextBot += HIWORD(lDlgBaseUnits) + GetSystemMetrics( SM_CYICON );
+ }
+
+ /* We must also calculate the height of the buttons since */
+ /* they may exceed the height of the text. If so, the */
+ /* height of the dialog is set to the button heights. */
+
+ nButsBot *= (HIWORD(lDlgBaseUnits) / 2) + Rect.bottom;
+ nButsBot += (HIWORD(lDlgBaseUnits) / 2) + HIWORD(lDlgBaseUnits);
+
+ DlgRect.bottom += (nTextBot > nButsBot) ? nTextBot : nButsBot;
+
+ /* Now put everything in its place. We start with the dialog */
+ /* itself. We set its size and then call the center function. */
+
+ SetWindowPos( hDlg, (HWND)NULL, 0, 0,
+ (DlgRect.right - DlgRect.left + 1 ),
+ (DlgRect.bottom - DlgRect.top + 1 ),
+ SWP_NOACTIVATE );
+
+ DM_CenterDialog( hDlg );
+
+ /* place the icon in its place */
+
+ hWndIcon = GetDlgItem( hDlg, IDD_MSG_ICON );
+
+ SetWindowPos( hWndIcon, (HWND)NULL,
+ 2 * LOWORD(lDlgBaseUnits),
+ HIWORD(lDlgBaseUnits),
+ GetSystemMetrics( SM_CXICON ),
+ GetSystemMetrics( SM_CYICON ),
+ SWP_NOACTIVATE );
+
+ /* place the message text in its place */
+
+ SetWindowPos( hWndMsg, (HWND)NULL,
+ (4 * LOWORD(lDlgBaseUnits) ) + GetSystemMetrics( SM_CXICON ),
+ HIWORD(lDlgBaseUnits),
+ MsgRect.right,
+ MsgRect.bottom,
+ SWP_NOACTIVATE );
+
+ /* place the instruction text in its place and set visible */
+
+ if ( pInstText != (CHAR_PTR)NULL ) {
+
+ SetWindowPos( hWndInst, (HWND)NULL,
+ (4 * LOWORD(lDlgBaseUnits) ) + GetSystemMetrics( SM_CXICON ),
+ (2* HIWORD(lDlgBaseUnits) ) + MsgRect.bottom,
+ nTextWidth,
+ GetSystemMetrics( SM_CYICON ),
+ SWP_NOACTIVATE );
+
+ ShowWindow( hWndInst, SW_SHOWNOACTIVATE );
+
+ }
+
+ /* Now line up the buttons. We first calculate the X position */
+ /* since it is the same for all the buttons. The top and bottom */
+ /* margins on the button stack are one base-unit-height. Between */
+ /* the buttons is 1/2 a base-unit-height. */
+
+ nButX = (6 * LOWORD(lDlgBaseUnits) ) + GetSystemMetrics( SM_CXICON ) +
+ MsgRect.right;
+
+ /* set the button positions */
+
+ hWndBut = GetDlgItem( hDlg, IDD_MSG_BUT2 );
+
+# if defined ( NTKLUG )
+ {
+ // Note: this is a definite kludge for NT!!
+ // the height seems to be getting returned in
+ // dialog units??!! (which happen to be 14).
+ // The temporary fix is to convert these units to pixels.
+
+ GetClientRect( hWndBut, &Rect );
+
+ if (Rect.bottom == 14)
+ Rect.bottom = (Rect.bottom * LOWORD (lDlgBaseUnits)) /4;
+ }
+# else
+ {
+ GetClientRect( hWndBut, &Rect );
+ }
+# endif
+
+ Rect.right = nButtonWidth;
+
+ SetWindowPos( hWndBut, (HWND)NULL,
+ nButX,
+ (HIWORD(lDlgBaseUnits) / 2) + HIWORD(lDlgBaseUnits) + Rect.bottom,
+ Rect.right,
+ Rect.bottom,
+ SWP_NOACTIVATE );
+
+ hWndBut = GetDlgItem( hDlg, IDD_MSG_BUT3 );
+ SetWindowPos( hWndBut, (HWND)NULL,
+ nButX,
+ (2 * HIWORD(lDlgBaseUnits)) + (2 * Rect.bottom),
+ Rect.right,
+ Rect.bottom,
+ SWP_NOACTIVATE );
+
+ hWndBut = GetDlgItem( hDlg, IDD_MSG_BUT1 );
+ SetWindowPos( hWndBut, (HWND)NULL,
+ nButX,
+ HIWORD(lDlgBaseUnits),
+ Rect.right,
+ Rect.bottom,
+ SWP_NOACTIVATE );
+
+ /* if flag set, set button 2 as default */
+
+ if ( wType & WMMB_BUT2DEFAULT ) {
+ SendDlgItemMessage( hDlg, IDD_MSG_BUT1, BM_SETSTYLE, (WORD) BS_PUSHBUTTON, 0L );
+ SendDlgItemMessage( hDlg, IDD_MSG_BUT2, BM_SETSTYLE, (WORD) BS_DEFPUSHBUTTON, 0L );
+ SetFocus( GetDlgItem( hDlg, IDD_MSG_BUT2 ) ) ;
+ } else {
+ SetFocus( GetDlgItem( hDlg, IDD_MSG_BUT1 ) ) ;
+ }
+
+ /* if flag set, set the dialog to system modal */
+
+ if ( wType & WMMB_SYSMODAL ) {
+ SetSysModalWindow( hDlg ) ;
+ }
+
+ WM_MultiTask ();
+
+ return FALSE; /* since we have already set the focus */
+ }
+
+
+/***************************************************************************
+ * Respond to button selections
+ ***************************************************************************/
+
+ case WM_COMMAND:
+ {
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDD_MSG_BUT1: /* button 1, ret affirmative */
+ {
+
+ if ( wType & WMMB_ABORTRETRYIGNOR ) {
+
+ EndDialog ( hDlg, FALSE );
+
+ } else {
+
+ EndDialog ( hDlg, TRUE );
+ }
+ return TRUE;
+ }
+
+ case IDD_MSG_BUT2: /* button 2, ret negative */
+ {
+ if ( mwwHelpButID == GET_WM_COMMAND_ID( mp1, mp2 ) ) {
+ HM_DialogHelp( mwwHelpID ) ;
+ } else {
+
+ if ( wType & WMMB_ABORTRETRYIGNOR ) {
+ EndDialog ( hDlg, TRUE );
+ } else {
+ EndDialog ( hDlg, FALSE );
+ }
+ }
+ return TRUE;
+ }
+
+ case IDCANCEL: /* sent because of ESC button */
+ {
+
+ if ( wType & WMMB_OK ) {
+ EndDialog ( hDlg, TRUE ); /* if just the OK, ret affirm */
+ } else {
+ EndDialog ( hDlg, FALSE ); /* if two buttons, ret neg */
+ }
+ return TRUE;
+ }
+
+ case IDD_MSG_BUT3:
+ if ( wType & WMMB_ABORTRETRYIGNOR ) {
+ EndDialog ( hDlg, WMMB_IDIGNOR );
+ }
+ case IDHELP :
+ {
+
+ if ( mwwHelpID ) {
+ HM_DialogHelp( mwwHelpID ) ;
+ }
+ return TRUE;
+ }
+ }
+ break;
+ }
+
+/***************************************************************************
+ * Respond to the close selection from the system menu
+ ***************************************************************************/
+
+ case WM_CLOSE:
+ {
+ EndDialog ( hDlg, FALSE ); /* return false in this case */
+ return TRUE;
+ }
+
+/***************************************************************************
+ * Respond to the destroy message
+ ***************************************************************************/
+
+ case WM_DESTROY:
+
+ WM_MultiTask ();
+ break;
+
+/***************************************************************************
+ * Paint the dialog
+ ***************************************************************************/
+
+ case WM_PAINT:
+
+ PostMessage( hDlg, WM_MSGBOXDRAWTXT, mp1, mp2 );
+ break;
+
+ case WM_MSGBOXDRAWTXT:
+ {
+
+ /* draw the message text */
+
+ InvalidateRect( hWndMsg, (LPRECT)NULL, TRUE );
+ UpdateWindow( hWndMsg );
+ hDC = GetDC( hWndMsg );
+
+ if ( wType & ( WMMB_MSGBIG | WMMB_MSGBIGBOLD ) ) {
+ logfont.lfHeight = ( wType & WMMB_MSGBIG ) ?
+ HIWORD(lDlgBaseUnits) + (HIWORD(lDlgBaseUnits) / 4) :
+ HIWORD(lDlgBaseUnits) + (HIWORD(lDlgBaseUnits) / 2);
+ hFont = SelectObject( hDC, CreateFontIndirect( &logfont ) );
+ } else {
+ SelectObject ( hDC, ghFontMsgBox );
+ }
+
+ /* set the background and text colors and then draw the text */
+
+ SetBkColor( hDC, GetSysColor( COLOR_BTNFACE) );
+ SetTextColor( hDC, GetSysColor( COLOR_BTNTEXT ) ) ;
+
+ if (IS_JAPAN()) {
+ DrawText( hDC, pMsgText, -1, &MsgRect,
+ DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_WORDBREAK);
+ } else {
+ DrawText( hDC, pMsgText, -1, &MsgRect,
+ DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_WORDBREAK | 0x0A00 );
+ }
+
+ if ( wType & ( WMMB_MSGBIG | WMMB_MSGBIGBOLD ) ) {
+ DeleteObject( SelectObject( hDC, hFont ) );
+ }
+
+ ReleaseDC( hWndMsg, hDC );
+
+
+ /* draw the instruction text */
+
+ if ( pInstText != (CHAR_PTR)NULL ) {
+
+ InvalidateRect( hWndInst, (LPRECT)NULL, TRUE );
+ UpdateWindow( hWndInst );
+ hDC = GetDC( hWndInst );
+
+ if ( wType & WMMB_INSTBIG ) {
+ logfont.lfHeight = HIWORD(lDlgBaseUnits) + ( HIWORD(lDlgBaseUnits) / 4 );
+ hFont = SelectObject( hDC, CreateFontIndirect( &logfont ) );
+ } else {
+ SelectObject ( hDC, ghFontMsgBox );
+ }
+
+ /* set the background and text colors and then draw the text */
+
+ SetBkColor( hDC, GetSysColor( COLOR_BTNFACE) );
+ SetTextColor( hDC, GetSysColor( COLOR_BTNTEXT ) ) ;
+
+ DrawText( hDC, pInstText, -1, &InstRect,
+ DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER );
+
+ /* if a bitmap was defined, draw the bitmap centered */
+
+ if ( wInstBitMap != 0 ) {
+ RSM_BitmapDrawCentered ( (WORD)(wInstBitMap + BTNFACE_BACKGND),
+ nInstIconX,
+ 0,
+ GetSystemMetrics( SM_CXICON ),
+ GetSystemMetrics( SM_CYICON ),
+ hDC );
+ }
+
+ if ( wType & WMMB_INSTBIG ) {
+ DeleteObject( SelectObject( hDC, hFont ) );
+ }
+ ReleaseDC( hWndInst, hDC );
+ }
+ break; /* pass the message along */
+ }
+ }
+ return FALSE; /* message not processed (or more required) */
+}
+
+
+static INT MB_SetButtons (
+
+HWND hDlg,
+WORD wType,
+INT *nButsBot,
+DS_MESSAGE_PTR pMessage )
+
+{
+ INT nTemp;
+ INT nDefaultWidth;
+ CHAR szButton1[WMMB_MAX_BUTTON]; /* used for loading resources */
+ CHAR szButton2[WMMB_MAX_BUTTON]; /* used for loading resources */
+ CHAR szHelpButton[WMMB_MAX_BUTTON]; /* used for loading resources */
+ HDC hDC;
+ RECT rc;
+
+ // Clear out the button text strings.
+
+ szButton1[0] = 0;
+ szButton2[0] = 0;
+ szHelpButton[0] = 0;
+
+ // Set the button text based on the wType.
+
+ // The YES NO button group.
+
+ if ( wType & WMMB_YESNO ) {
+ RSM_StringCopy( IDS_BUT_YES, szButton1, sizeof ( szButton1 ) );
+ RSM_StringCopy( IDS_BUT_NO, szButton2, sizeof ( szButton2 ) );
+ }
+
+
+ // The ABORT first button group.
+
+ if ( wType & WMMB_ABORTRETRYIGNOR ) {
+ RSM_StringCopy( IDS_BUT_ABORT, szButton1, sizeof ( szButton1 ) );
+ }
+
+ // The OK first button group.
+
+ if ( wType & ( WMMB_OK | WMMB_OKCANCEL | WMMB_OKDISABLE ) ) {
+ RSM_StringCopy( IDS_BUT_OK, szButton1, sizeof ( szButton1 ) );
+ }
+
+ // The RETRY first button group.
+
+ if ( wType & WMMB_RETRYCANCEL ) {
+ RSM_StringCopy( IDS_BUT_RETRY, szButton1, sizeof ( szButton1 ) );
+ }
+
+ // The CONTINUE first button group.
+
+ if ( wType & ( WMMB_CONTABORT | WMMB_CONTCANCEL ) ) {
+ RSM_StringCopy( IDS_BUT_CONTINUE, szButton1, sizeof ( szButton1 ) );
+ }
+
+ // The RETRY second button group.
+
+ if ( wType & WMMB_ABORTRETRYIGNOR ) {
+ RSM_StringCopy( IDS_BUT_RETRY, szButton2, sizeof ( szButton2 ) );
+ }
+
+ // The CANCEL second button group.
+
+ if ( wType & ( WMMB_OKCANCEL | WMMB_RETRYCANCEL | WMMB_CONTCANCEL ) ) {
+ RSM_StringCopy( IDS_BUT_CANCEL, szButton2, sizeof ( szButton2 ) );
+ }
+
+ // The ABORT second button group.
+
+ if ( wType & WMMB_CONTABORT ) {
+ RSM_StringCopy( IDS_BUT_ABORT, szButton2, sizeof ( szButton2 ) );
+ }
+
+ // The DISABLE second button group.
+
+ if ( wType & WMMB_OKDISABLE ) {
+ RSM_StringCopy( IDS_BUT_DISABLE, szButton2, sizeof ( szButton2 ) );
+ }
+
+ SetDlgItemText ( hDlg, IDD_MSG_BUT1, szButton1 );
+
+ if ( !(wType & WMMB_OK) ) {
+ SetDlgItemText ( hDlg, IDD_MSG_BUT2, szButton2 );
+ ShowWindow( GetDlgItem( hDlg, IDD_MSG_BUT2 ), SW_SHOWNOACTIVATE );
+ }
+
+ // The IGNORE Third button group.
+
+ if ( wType & WMMB_ABORTRETRYIGNOR ) {
+ RSM_StringCopy( IDS_BUT_IGNORE, szHelpButton, sizeof ( szHelpButton ) );
+ SetDlgItemText ( hDlg, IDD_MSG_BUT3, szHelpButton );
+ ShowWindow ( GetDlgItem( hDlg, IDD_MSG_BUT3 ), SW_SHOWNOACTIVATE );
+ *nButsBot = *nButsBot + 1;
+
+ }
+
+ if ( pMessage->wHelpID ) {
+
+ RSM_StringCopy ( IDS_BUT_HELP, szHelpButton, sizeof ( szHelpButton ) );
+
+ if ( wType & WMMB_OK ) {
+ mwwHelpButID = IDD_MSG_BUT2;
+ }
+ else {
+ mwwHelpButID = IDD_MSG_BUT3;
+ *nButsBot = *nButsBot + 1;
+ }
+
+ mwwHelpID = pMessage->wHelpID;
+
+ SetDlgItemText ( hDlg, mwwHelpButID, szHelpButton );
+ ShowWindow ( GetDlgItem( hDlg, mwwHelpButID ), SW_SHOWNOACTIVATE );
+
+ }
+ else {
+
+ mwwHelpButID = 0;
+ mwwHelpID = 0;
+
+ }
+
+ // Get the default width of the buttons.
+
+ GetClientRect ( GetDlgItem ( hDlg, IDD_MSG_BUT1 ), &rc );
+
+ nDefaultWidth = rc.right - rc.left;
+
+ hDC = GetDC ( GetDlgItem ( hDlg, IDD_MSG_BUT1 ) );
+
+ // Get the button text widths.
+
+ nTemp = MB_GetMaxButtonExtent ( hDC, szButton1, nDefaultWidth );
+ nTemp = MB_GetMaxButtonExtent ( hDC, szButton2, nTemp );
+ nTemp = MB_GetMaxButtonExtent ( hDC, szHelpButton, nTemp );
+
+ ReleaseDC ( hDlg, hDC );
+
+ return nTemp;
+}
+
+
+
+static INT MB_GetMaxButtonExtent (
+
+HDC hDC,
+LPSTR lpString,
+INT nOldWidth )
+
+{
+ INT nTemp;
+ SIZE sizeRect; // Return from GetTextExtentPoint
+
+// HFONT hFont = (HFONT) GetStockObject ( SYSTEM_FONT );
+// nTemp = RSM_GetFontStringWidth ( hFont, lpString, strlen ( lpString ) );
+
+ // Get the text extent width and height.
+
+ GetTextExtentPoint ( hDC, lpString, strlen ( lpString ), &sizeRect );
+
+ nTemp = sizeRect.cx;
+
+ // Now add in the 3D borders.
+
+ nTemp += ( 2 * ( BUTTON_BORDERWIDTH + 2 ) );
+
+ if ( nTemp < nOldWidth ) {
+
+ nTemp = nOldWidth;
+ }
+
+ return nTemp;
+}
diff --git a/private/utils/ntbackup/src/msgbox.dlg b/private/utils/ntbackup/src/msgbox.dlg
new file mode 100644
index 000000000..0494d54d9
--- /dev/null
+++ b/private/utils/ntbackup/src/msgbox.dlg
@@ -0,0 +1,52 @@
+
+/**************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+JPW
+
+ Name: msgbox.dlg
+
+ Description: This file contains the dialog template for the
+ generic message box.
+
+ $Log: G:\UI\LOGFILES\MSGBOX.DLV $
+
+ Rev 1.7 28 Jan 1994 17:23:36 Glenn
+ Simplified and fixed Icon support.
+
+ Rev 1.6 10 May 1993 13:24:28 CHUCKB
+ Don't process & for every control.
+
+ Rev 1.5 18 Dec 1992 11:16:42 chrish
+ Moved #include to dialogs.rc
+
+ Rev 1.4 10 Jun 1992 14:30:30 JOHNWT
+ changed font
+
+ Rev 1.3 27 Apr 1992 18:51:40 STEVEN
+ NTKLUG for font type
+
+ Rev 1.2 06 Apr 1992 10:08:46 CHUCKB
+ Fixed include list.
+
+ Rev 1.1 27 Jan 1992 00:46:40 CHUCKB
+ Updated dialog id's.
+
+ Rev 1.0 20 Nov 1991 19:18:22 SYSTEM
+ Initial revision.
+
+**************************************************************************/
+
+IDD_MESSAGE_BOX DIALOG 38, 64, 241, 62
+STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Message"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ ICON 0, IDD_MSG_ICON, 8, 8, 20, 20
+ LTEXT "", IDD_MSG_TEXT, 30, 8, 164, 26, SS_NOPREFIX
+ LTEXT "", IDD_MSG_INST, 30, 44, 164, 10, NOT WS_VISIBLE | SS_NOPREFIX
+ DEFPUSHBUTTON "", IDD_MSG_BUT1, 200, 6, 35, 14
+ PUSHBUTTON "", IDD_MSG_BUT2, 200, 24, 35, 14, NOT WS_VISIBLE
+ PUSHBUTTON "", IDD_MSG_BUT3, 200, 42, 35, 14, NOT WS_VISIBLE
+END
+
diff --git a/private/utils/ntbackup/src/msmktemp.c b/private/utils/ntbackup/src/msmktemp.c
new file mode 100644
index 000000000..9f5ee3139
--- /dev/null
+++ b/private/utils/ntbackup/src/msmktemp.c
@@ -0,0 +1,72 @@
+/*
+
+ $Log: T:/LOGFILES/MSMKTEMP.C_V $
+
+ Rev 1.1 26 Oct 1993 23:37:16 GREGG
+Mod the process id with 0xFFFF just in case it's larger.
+
+ Rev 1.0 14 Oct 1993 18:20:16 GREGG
+Initial revision.
+
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <process.h>
+#include <io.h>
+#include <errno.h>
+
+#include "stdtypes.h"
+#include "msmktemp.h"
+
+CHAR_PTR msmktemp( CHAR_PTR template )
+{
+ CHAR_PTR ptr ;
+ int i ;
+ int ret ;
+ int len ;
+ BOOLEAN success = FALSE ;
+ CHAR rep_str[41] ;
+
+ strcpy( rep_str, TEXT("0123456789abcdefghijklmnopqrstuvwxyz$_!-") ) ;
+
+ if( template == NULL || strlen( template ) < 8 ) {
+ return( NULL ) ;
+ }
+
+ ptr = template + strlen( template ) - 1 ;
+ for( i = 0; i < 5; i++, ptr-- ) {
+ if( *ptr != TEXT('X') ) {
+ return( NULL ) ;
+ }
+ }
+ if( *ptr != TEXT('X') ) {
+ return( NULL ) ;
+ }
+
+#if defined( OS_WIN32 )
+
+ sprintf( ptr, TEXT(" %05d"), _getpid( ) % 0xFFFF ) ;
+
+#elif defined( OS_NLM )
+
+ sprintf( ptr, TEXT(" %05d"), GetNLMHandle( ) % 0xFFFF ) ;
+
+#endif
+
+ len = strlen( rep_str ) ;
+ for( i = 0; !success && i < len; i++ ) {
+ *ptr = rep_str[i] ;
+ if( access( template, 0 ) == -1 && errno == ENOENT ) {
+ success = TRUE ;
+ }
+ }
+
+ if( success ) {
+ return( template ) ;
+ }else {
+ return( NULL ) ;
+ }
+}
+
diff --git a/private/utils/ntbackup/src/mtf10wdb.c b/private/utils/ntbackup/src/mtf10wdb.c
new file mode 100644
index 000000000..5f8a7bf20
--- /dev/null
+++ b/private/utils/ntbackup/src/mtf10wdb.c
@@ -0,0 +1,1639 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: mtf40wdb.c
+
+ Description: Contains the Code for writing Maynard 4.0 Format.
+
+
+ $Log: T:\logfiles\mtf10wdb.c_v $
+
+ Rev 1.24.1.3 11 Jan 1994 13:35:54 GREGG
+Changed asserts to mscasserts.
+
+ Rev 1.24.1.2 16 Nov 1993 22:23:50 GREGG
+Modified the way we control hardware compression from software to work around
+a bug in Archive DAT DC firmware rev. 3.58 (we shipped a lot of them).
+Files Modified: lw_data.c, lw_data.h, tfstuff.c, mtf10wdb.c, mtf10wt.c and
+ drives.c
+
+ Rev 1.24.1.1 02 Nov 1993 12:34:58 GREGG
+Translate file dblk attribs under DOS and OS2 to and from MTF.
+
+ Rev 1.24.1.0 09 Sep 1993 17:51:44 GREGG
+Call WriteInit before InitTape so if we get an early OTC failure we don't
+leave a tape with just a tape header on it.
+
+ Rev 1.24 22 Jul 1993 12:14:44 ZEIR
+ad'd lw_software_name logic
+
+ Rev 1.23 17 Jul 1993 17:57:00 GREGG
+Changed write translator functions to return INT16 TFLE_xxx errors instead
+of BOOLEAN TRUE/FALSE. Files changed:
+ MTF10WDB.C 1.23, TRANSLAT.H 1.22, F40PROTO.H 1.30, FMTENG.H 1.23,
+ TRANSLAT.C 1.43, TFWRITE.C 1.68, MTF10WT.C 1.18
+
+ Rev 1.22 04 Jul 1993 03:48:34 GREGG
+Fixed setting of file_id and directory_id in DIRB, FILE and CFIL structs.
+
+ Rev 1.21 04 Jul 1993 03:35:40 GREGG
+Reset lb_size in channel and EOS_AT_EOM bits when writing cont tape header.
+
+ Rev 1.20 20 Jun 1993 16:15:22 GREGG
+Added setting of vendor id in SSET, and removed setting of compression algor.
+
+ Rev 1.19 20 Jun 1993 16:08:12 GREGG
+Unicode fixes.
+
+ Rev 1.18 18 Jun 1993 17:14:48 GREGG
+Reset append attrib when overwriting tape.
+
+ Rev 1.17 28 May 1993 18:06:18 ZEIR
+Made software_package changes UNICODE compliant
+
+ Rev 1.16 24 May 1993 13:25:50 GREGG
+In InitTape we were resetting max_otc_level on continuation tapes.
+
+ Rev 1.15 19 May 1993 14:20:10 ZEIR
+cx'd vendor_id to conner_software_vendor_id
+
+ Rev 1.14 18 May 1993 15:52:24 ZEIR
+More MTF clean-up...
+ a) F40_InitTape now inits software_package for Nostradamus only (currently)
+ b) SetupDBHeader ensures os_spec_data_offset is 0 if there's no data
+ c) F40_WtSSet had a few non-sensical channel assignments removed
+ d) usage of local macro LongAlignOffset improved throughout compiland
+
+ Rev 1.13 12 May 1993 12:14:06 GREGG
+Set 'last_sset_pba' in WtSSET to fix faulty determination of incompatible
+drive during fast append.
+
+ Rev 1.12 29 Apr 1993 22:26:58 GREGG
+Set the Tape Catalog Version in the VCB.
+
+ Rev 1.11 27 Apr 1993 02:17:14 GREGG
+Don't put SSET attribs in VOLB.
+
+ Rev 1.10 26 Apr 1993 11:45:52 GREGG
+Seventh in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Changed handling of EOM processing during non-OTC EOS processing.
+
+Matches CHANNEL.H 1.17, MAYN40RD.C 1.60, TFWRITE.C 1.63, MTF.H 1.5,
+ TFLUTILS.C 1.44, MTF10WDB.C 1.10, MTF10WT.C 1.9
+
+ Rev 1.9 25 Apr 1993 20:12:26 GREGG
+Fifth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Store the corrupt stream number in the CFIL tape struct and the CFDB.
+
+Matches: MTF10WDB.C 1.9, FSYS.H 1.33, FSYS_STR.H 1.47, MAKECFDB.C 1.2,
+ BACK_OBJ.C 1.36, MAYN40RD.C 1.58
+
+ Rev 1.8 25 Apr 1993 17:36:02 GREGG
+Fourth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Parse the device name and volume name out of the FS supplied "volume
+ name", and write it to tape as separate fields.
+ - Generate the "volume name" the FS and UI expect out of the device
+ name and volume name on tape.
+ - Write all strings without NULL terminater, and translate them back
+ to NULL terminated strings on the read side.
+
+Matches: MTF10WDB.C 1.8, F40PROTO.H 1.26, OTC40WT.C 1.24, MAYN40.H 1.33,
+ MAYN40RD.C 1.57, OTC40RD.C 1.25
+
+ Rev 1.7 22 Apr 1993 03:31:20 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.6 18 Apr 1993 00:38:58 GREGG
+First in a series of incremental changes to bring the translator in line
+with the MTF spec:
+ - Rewrote F40_InitTape:
+ - Stop using SetupDBHeader to set up the Tape Header (needs
+ special setup specific to that DBLK).
+ - Cleaned up logic.
+ - Set string_storage_offset properly in all DBLKs.
+ - Pass UINT8_PTR instead of CHAR_PTR to F40_SaveLclName.
+
+Matches: MTF10WT.C 1.6, MAYN40RD.C 1.53, MAYN40.H 1.31 and F40PROTO.H 1.25
+
+ Rev 1.5 17 Apr 1993 19:41:34 GREGG
+In F40_WtCFIL tell SetupDBHeader that there will never be associated data.
+
+ Rev 1.4 14 Apr 1993 02:00:04 GREGG
+Fixes to deal with non-ffr tapes in ffr drives (i.e. EXB2200 in EXB5000).
+
+ Rev 1.3 18 Mar 1993 15:17:50 ChuckS
+OS_NLM (for now): Added code to get dev name out of VCB
+
+ Rev 1.2 09 Mar 1993 18:36:18 GREGG
+Was calling FS_ViewDataEncrypt to get password encryption algorithm.
+
+ Rev 1.1 28 Jan 1993 11:39:40 GREGG
+Set the Tape Cat Level and Set Cat Valid fields while writing the SSET.
+
+ Rev 1.0 27 Jan 1993 14:37:42 GREGG
+Half of mayn40wt.c.
+
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "stdtypes.h"
+#include "stdmacro.h"
+#include "fsys.h"
+#include "tbe_defs.h"
+#include "datetime.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "fmteng.h"
+#include "mayn40.h"
+#include "f40proto.h"
+#include "transutl.h"
+#include "tloc.h"
+#include "lw_data.h"
+#include "tfldefs.h"
+#include "lwprotos.h"
+#include "sx.h"
+#include "tfl_err.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "tdemo.h"
+#include "dddefs.h"
+/* $end$ include list */
+
+/*
+ * Define the test OTC level here 0 == none, 1 == partial, 2 == full
+*/
+#define TEST_OTC_LEVEL 2
+
+/* Size required to pad to next logical block */
+#define PadToLBBoundary( x ) PadToBoundary( (x), F40_LB_SIZE )
+
+/* Adjusts offset to next 4 byte boundary */
+#define LongAlignOffset( x ) ( (x) += PadToBoundary( (x), 4 ) )
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: SetupDBHeader
+
+ Description: This does all the setup necessary for the standard block
+ header. It also updates the used count in the buffer
+ pointer.
+
+ Returns: The amount of space the header used in the buffer.
+
+ Notes: THIS FUNCTION MUST BE CALLED AFTER ALL OTHER FIELDS ARE
+ FILLED OUT IN THE HEADER
+
+**/
+
+UINT16 SetupDBHeader(
+ UINT8_PTR block_type, /* four byte array */
+ CHANNEL_PTR channel, /* current Channel Structure */
+ DBLK_PTR cur_dblk, /* current DBLK */
+ MTF_DB_HDR_PTR cur_hdr, /* current tape block header structure */
+ UINT16 offset, /* space used by var string portion */
+ BOOLEAN data_to_follow, /* Is data to follow */
+ BOOLEAN continuation ) /* Continuation flag */
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ UINT16 temp_os_id ;
+ UINT16 temp_os_ver ;
+
+
+ /* Setup the block type */
+ F40_SetBlkType( cur_hdr, block_type ) ;
+
+ cur_hdr->logical_block_address = U64_Init( channel->running_lba, 0L ) ;
+ FS_SetLBAinDBLK( cur_dblk, channel->running_lba ) ;
+
+ /* Let's get the OS specific info loaded in */
+ LongAlignOffset( offset ) ;
+
+ if( ( cur_hdr->os_specific_data.data_size =
+ (UINT16)FS_SizeofOS_InfoInDBLK( cur_fsys, cur_dblk ) ) != 0 ){
+
+ cur_hdr->os_specific_data.data_offset = offset ;
+ (VOID)FS_GetOS_InfoFromDBLK( cur_fsys, cur_dblk,
+ (UINT8_PTR)cur_hdr + offset ) ;
+ offset += cur_hdr->os_specific_data.data_size ;
+ LongAlignOffset( offset ) ;
+ }
+
+ (VOID)FS_GetOSid_verFromDBLK( cur_fsys, cur_dblk, &temp_os_id, &temp_os_ver ) ;
+ cur_hdr->machine_os_id = (UINT8)temp_os_id;
+ cur_hdr->machine_os_version = (UINT8)temp_os_ver ;
+
+ cur_hdr->session_id = U64_Init( 0L, 0L ) ;
+
+ cur_hdr->displayable_size = FS_GetDisplaySizeFromDBLK( cur_fsys, cur_dblk ) ;
+
+ cur_hdr->string_type = (UINT8)FS_GetStringTypes( cur_fsys ) ;
+
+ cur_hdr->block_attribs = 0L ;
+
+ if( continuation ) {
+ cur_hdr->block_attribs |= MTF_DB_CONT_BIT ;
+ if( IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+ cur_hdr->block_attribs |= MTF_DB_EOS_AT_EOM_BIT ;
+ }
+ /* Setup Block ID, if its a continuation, don't increment it */
+ cur_hdr->control_block_id = channel->eom_id ;
+ data_to_follow = FALSE ;
+ } else {
+ cur_hdr->control_block_id = channel->eom_id++ ;
+ }
+
+ if( !data_to_follow ) {
+ offset += (UINT16)PadToLBBoundary( offset ) ;
+ } else {
+ cur_env->pad_size = (UINT16)PadToLBBoundary( offset ) ;
+ }
+
+
+ cur_hdr->offset_to_data = offset ;
+
+ /* Calculate the Header Check Sum */
+ cur_hdr->hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN ) ;
+
+ return( offset ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_InitTape
+
+ Description: Writes the TAPE tape header block to tape. Checks to
+ see if this is a continuation and if so doesn't generate
+ new information and sets the continuation attribute bit
+ in the block header. Copies the tape header information
+ to the global storage for things like tape name etc.
+
+ Notes:
+
+ Returns: INT16 - TFLE_xxx error code.
+
+**/
+INT16 F40_InitTape(
+ CHANNEL_PTR channel, /* Current active channel */
+ BOOLEAN continuation, /* I think we need the ability to flag cont*/
+ BUF_PTR tmpBUF )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ; /* Pointer to cur DBLK */
+ MTF_TAPE_PTR cur_tape ; /* Current tape header structure storage */
+ MTF_DB_HDR_PTR cur_hdr ;
+ UINT8_PTR vstr_ptr ;
+ UINT16 offset, date, time ;
+ INT16 lcl_ret_val ;
+ DATE_TIME temp_date ;
+ UINT16 temp_os_id ;
+ UINT16 temp_os_ver ;
+
+ /* If the drive supports hardware compression we need to keep it in
+ uncompressed mode unless we're actually writing a compressed set.
+ This is a work-around for a firmware bug in early Archive DAT DC
+ drives. If we are going to write a compressed set, we set it here.
+ */
+ if( lw_hw_comp && ( curDRV->thw_inf.drv_info.drv_features & TDI_DRV_COMPRESSION ) ) {
+ if( TpSpecial( drv_hdl, SS_SET_DRV_COMPRESSION,
+ ENABLE_DRV_COMPRESSION ) != SUCCESS ) {
+ return( TFLE_DRIVE_FAILURE ) ;
+ }
+ }
+
+ if( channel->tape_id != 0L && !continuation ) {
+ /* Get the PBA before writing the SSET. Note that in this case
+ we are appending, and if we didn't put position info in ANY
+ of the prior sets on tape, we're not going to put any in this
+ one either. We don't dare try because there are drives which
+ change their mind about whether or not TpGetPosition is a
+ valid command depending on the tape in the drive. So if the
+ prior sets don't have a PBA for the SSET, we assume it's
+ because that info isn't available. In order to write position
+ info when overwriting, the drive has to indicate it has the
+ Get and Seek Position features, even when it doesn't. So we
+ use this alternative method to tell. IDDI-NSMDI-YCPA
+ */
+ if( SupportBlkPos( curDRV ) &&
+ cur_env->last_sset_pba != 0UL ) {
+
+ ret_val = GetCurrentPosition( curDRV ) ;
+ } else {
+ curDRV->cur_pos.pba_vcb = 0 ;
+ }
+ return( ret_val ) ;
+ }
+
+ /* reinit the buffer */
+ BM_SetNextByteOffset( tmpBUF, 0 ) ;
+ memset( BM_XferBase( tmpBUF ), 0, BM_XferSize( tmpBUF ) ) ;
+
+ cur_tape = (MTF_TAPE_PTR)( BM_XferBase( tmpBUF ) ) ;
+ cur_hdr = (MTF_DB_HDR_PTR)cur_tape ;
+ vstr_ptr = ( BM_XferBase( tmpBUF ) ) ;
+ offset = sizeof( MTF_TAPE ) ;
+
+ channel->lb_size = F40_LB_SIZE ;
+ cur_env->eset_pba = 0L ;
+
+ /* Set up the TAPE BLOCK */
+ if( channel->tape_id == 0L ) {
+
+ msassert( !continuation ) ;
+
+ /* Here we do our own version of SetupDBHeader that does only what
+ we need, and not all the extranious stuff.
+ */
+ F40_SetBlkType( cur_hdr, MTF_TAPE_N ) ;
+
+ (VOID)FS_GetOSid_verFromDBLK( channel->cur_fsys, channel->cur_dblk, &temp_os_id, &temp_os_ver ) ;
+
+ cur_hdr->machine_os_id = (UINT8)temp_os_id;
+ cur_hdr->machine_os_version = (UINT8)temp_os_ver ;
+ cur_hdr->logical_block_address = U64_Init( 0L, 0L ) ;
+ cur_hdr->os_specific_data.data_offset = 0 ;
+ cur_hdr->os_specific_data.data_size = 0 ;
+ cur_hdr->session_id = U64_Init( 0L, 0L ) ;
+ cur_hdr->displayable_size = U64_Init( 0L, 0L ) ;
+ cur_hdr->string_type = (UINT8)FS_GetStringTypes( channel->cur_fsys ) ;
+ cur_hdr->block_attribs = 0L ;
+
+ /* Fill out general info */
+ cur_tape->software_vendor_id = CONNER_SOFTWARE_VENDOR_ID ;
+ cur_tape->tape_seq_number = 1 ;
+ cur_tape->logical_block_size = F40_LB_SIZE ;
+ cur_tape->tf_major_ver = FORMAT_VER_MAJOR ;
+ cur_tape->ecc_algorithm = ECC_NONE ;
+ cur_tape->tape_catalog_type = MTF10_OTC ;
+ cur_tape->tape_attributes = 0L ;
+ cur_tape->password_encryption_algor =
+ FS_ViewPswdEncryptInVCB( (VCB_PTR)cur_dblk ) ;
+
+ /* Get backup date */
+ GetCurrentDate( &temp_date ) ;
+ DateToTapeDate( &cur_tape->tape_date, &temp_date ) ;
+
+ /* Generate tape ID */
+ DOSDateTime( &temp_date, &date, &time ) ;
+#ifdef TDEMO
+ cur_tape->tape_id_number = ( (UINT32)date << 16 ) |
+ ( (UINT32)time & 0xFFFC ) |
+ TdemoGeneratedTapeId( ) ;
+#else
+ cur_tape->tape_id_number = ( ( (UINT32)date << 16 ) |
+ ( (UINT32)time ) ) ;
+#endif
+
+ /* Setup string data. NOTE: On strings other than the password we
+ decrement the size to leave off the '\0'.
+ */
+ cur_tape->tape_name.data_size = FS_SizeofTapeNameInVCB( (VCB_PTR)cur_dblk ) ;
+ if( cur_tape->tape_name.data_size != 0 ) {
+ cur_tape->tape_name.data_size -= sizeof( CHAR ) ;
+ cur_tape->tape_name.data_offset = offset ;
+ FS_GetTapeNameInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + offset ) ) ;
+ offset += cur_tape->tape_name.data_size ;
+ if( ( lcl_ret_val =
+ F40_SaveLclName( &cur_env->tape_name,
+ (UINT8_PTR)( vstr_ptr +
+ cur_tape->tape_name.data_offset ),
+ &cur_env->tape_name_size,
+ &cur_env->tape_name_alloc,
+ cur_tape->tape_name.data_size ) )
+ != TFLE_NO_ERR ) {
+
+ return lcl_ret_val ;
+ }
+ } else {
+ cur_env->tape_name_size = 0 ;
+ cur_tape->tape_name.data_offset = 0 ;
+ }
+
+ /* For now we have no tape description */
+ cur_tape->tape_description.data_offset = 0 ;
+ cur_tape->tape_description.data_size = 0 ;
+
+ cur_tape->tape_password.data_size = FS_SizeofTapePswdInVCB( (VCB_PTR)cur_dblk ) ;
+ if( cur_tape->tape_password.data_size != 0 ) {
+ cur_tape->tape_password.data_offset = offset ;
+ FS_GetTapePswdInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + offset ) ) ;
+ offset += cur_tape->tape_password.data_size ;
+ if( ( lcl_ret_val =
+ F40_SaveLclName( &cur_env->tape_password,
+ (UINT8_PTR)( vstr_ptr +
+ cur_tape->tape_password.data_offset ),
+ &cur_env->tape_password_size,
+ &cur_env->tape_password_alloc,
+ cur_tape->tape_password.data_size ) )
+ != TFLE_NO_ERR ) {
+
+ return lcl_ret_val ;
+ }
+ } else {
+ cur_env->tape_password_size = 0 ;
+ cur_tape->tape_password.data_offset = 0 ;
+ }
+
+ cur_tape->software_name.data_size = lw_software_name_len * sizeof(CHAR) ;
+ if( lw_software_name != NULL ){
+ cur_tape->software_name.data_offset = offset ;
+ memcpy( (UINT8_PTR)( vstr_ptr + offset ), lw_software_name,
+ cur_tape->software_name.data_size ) ;
+ offset += cur_tape->software_name.data_size ;
+ }else{
+ cur_tape->software_name.data_offset = 0 ;
+ }
+
+ /* Set block specific attribs to indicate OTC level allowed */
+ if( cur_env->max_otc_level != TCL_NONE ) {
+ cur_tape->block_header.block_attribs |= MTF_DB_SM_EXISTS ;
+ if( cur_env->max_otc_level == TCL_FULL ) {
+ cur_tape->block_header.block_attribs |= MTF_DB_FDD_ALLOWED ;
+ }
+ }
+
+ /* Copy current tape header to environment */
+ cur_env->tape_hdr = *cur_tape ;
+
+ /* Set the channel stuff */
+ channel->bs_num = channel->ts_num = 1 ;
+ channel->tape_id = (INT32)cur_tape->tape_id_number ;
+
+ } else {
+ /* We need to get the last TAPE HEADER info and update the
+ appropriate fields.
+ */
+ *cur_tape = cur_env->tape_hdr ;
+ cur_env->tape_hdr.tape_seq_number = (UINT16)channel->ts_num ;
+ cur_tape->tape_seq_number = (UINT16)channel->ts_num ;
+ if( cur_env->tape_name_size != 0 ) {
+ memcpy( (UINT8_PTR)( vstr_ptr + offset ), cur_env->tape_name,
+ cur_env->tape_name_size ) ;
+ offset += cur_env->tape_name_size ;
+ }
+ if( cur_env->tape_password_size != 0 ) {
+ memcpy( (UINT8_PTR)( vstr_ptr + offset ), cur_env->tape_password,
+ cur_env->tape_password_size ) ;
+ offset += cur_env->tape_password_size ;
+ }
+
+ cur_tape->software_name.data_size = lw_software_name_len * sizeof(CHAR) ;
+ if( lw_software_name != NULL ){
+ cur_tape->software_name.data_offset = offset ;
+ memcpy( (UINT8_PTR)( vstr_ptr + offset ), lw_software_name,
+ cur_tape->software_name.data_size ) ;
+ offset += cur_tape->software_name.data_size ;
+ }else{
+ cur_tape->software_name.data_offset = 0 ;
+ }
+
+ cur_hdr->block_attribs |= MTF_DB_CONT_BIT ;
+ if( IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+ cur_hdr->block_attribs |= MTF_DB_EOS_AT_EOM_BIT ;
+ } else {
+ cur_hdr->block_attribs &= ~MTF_DB_EOS_AT_EOM_BIT ;
+ }
+ }
+
+ FS_SetTSNumInVCB( (DBLK_PTR)channel->lst_osvcb, channel->ts_num ) ;
+
+ /* Here we need to adjust the offset_to_data field to insure we write
+ a full physical block.
+ */
+ offset += (UINT16)PadToLBBoundary( offset ) ;
+ cur_hdr->offset_to_data = offset +
+ PadToBoundary( offset, ChannelBlkSize( channel ) ) ;
+
+ /* Recalculate the Header Check Sum */
+ cur_hdr->hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_tape, F40_HDR_CHKSUM_LEN ) ;
+
+ BM_UpdCnts( tmpBUF, cur_tape->block_header.offset_to_data ) ;
+
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), BM_NextByteOffset( tmpBUF ) ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, (void)0 )
+
+ /* Once we've successfully written the header, it is one of our tapes.
+ It may have been a tape we didn't allow append to before, so we need
+ to reset the bit that says we can.
+ */
+ lw_fmtdescr[channel->cur_fmt].attributes |= APPEND_SUPPORTED ;
+
+ if( ( ret_val = WriteEndSet( curDRV ) ) == TFLE_NO_ERR ) {
+
+ /* Get the PBA before writing the SSET. */
+ if( SupportBlkPos( channel->cur_drv ) ) {
+ ret_val = GetCurrentPosition( curDRV ) ;
+ } else {
+ channel->cur_drv->cur_pos.pba_vcb = 0 ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtVOLB
+
+ Description: Translates a DBLK in a format 4.0 VOLB.
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes: None.
+
+**/
+INT16 F40_WtVOLB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN continuation,
+ UINT16_PTR offset ) /* Pointer to offset passed in */
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ; /* Pointer to cur DBLK */
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ MTF_DB_HDR_PTR cur_hdr ;
+ MTF_VOL_PTR cur_volb ;
+ UINT8_PTR vstr_ptr ;
+ UINT16 v_offset ;
+ DATE_TIME temp_date ;
+ UINT16 temp_os_id ;
+ UINT16 temp_os_ver ;
+
+ cur_volb = (MTF_VOL_PTR)( BM_NextBytePtr( buffer ) ) ;
+ cur_hdr = (MTF_DB_HDR_PTR)cur_volb ;
+ vstr_ptr = (UINT8_PTR)cur_volb ;
+ v_offset = sizeof( MTF_VOL ) ;
+
+ if( !continuation ) {
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ }
+
+ /* Get Backup Date */
+ GetCurrentDate( &temp_date ) ;
+ DateToTapeDate( &cur_volb->backup_date, &temp_date ) ;
+
+
+ /* Setup string data. NOTE: On strings other than the password we
+ decrement the size to leave off the '\0'.
+ */
+
+#if defined( OS_NLM )
+
+ /* Device Name */
+ cur_volb->device_name.data_size = FS_SizeofDevNameInVCB( (VCB_PTR) cur_dblk ) ;
+ if( cur_volb->device_name.data_size != 0 ) {
+ cur_volb->device_name.data_size -= sizeof( CHAR ) ;
+ cur_volb->device_name.data_offset = v_offset ;
+ FS_GetDevNameInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR) vstr_ptr + v_offset ) ) ;
+ if( ( ret_val = F40_SaveLclName( &cur_env->device_name,
+ (UINT8_PTR)( vstr_ptr + v_offset ),
+ &cur_env->device_name_size,
+ &cur_env->device_name_alloc,
+ cur_volb->device_name.data_size ) ) != TFLE_NO_ERR ) {
+
+ return( ret_val ) ;
+ }
+ v_offset += cur_volb->device_name.data_size ;
+ } else {
+ cur_env->device_name_size = 0 ;
+ cur_volb->device_name.data_offset = 0 ;
+ }
+
+ /* Volume Name */
+ cur_volb->volume_name.data_size = FS_SizeofVolNameInVCB( (VCB_PTR)cur_dblk ) ;
+ if( cur_volb->volume_name.data_size != 0 ) {
+ cur_volb->volume_name.data_size -= sizeof( CHAR ) ;
+ cur_volb->volume_name.data_offset = v_offset ;
+ FS_GetVolNameInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + v_offset ) ) ;
+ if( ( ret_val = F40_SaveLclName( &cur_env->vol_name,
+ (UINT8_PTR)( vstr_ptr + v_offset ),
+ &cur_env->vol_name_size,
+ &cur_env->vol_name_alloc,
+ cur_volb->volume_name.data_size ) ) != TFLE_NO_ERR ) {
+
+ return( ret_val ) ;
+ }
+ v_offset += cur_volb->volume_name.data_size ;
+ } else {
+ cur_env->vol_name_size = 0 ;
+ cur_volb->volume_name.data_offset = 0 ;
+ }
+
+#else
+
+ /* If we have a volume name, it is actually of the form
+ "<device name><space><volume name>". We have to do some fiddling
+ here to put it on tape as a device name and volume name.
+
+ !!!!NOTE : We "know the device name is "<drive letter>:" for CAYMAN
+ and NOSTRADAMUS ONLY!!! All other products using this
+ BE will have to provide us with the device name and
+ volume name separately (as the NLM does above).
+ */
+ cur_volb->volume_name.data_size = FS_SizeofVolNameInVCB( (VCB_PTR)cur_dblk ) ;
+ if( cur_volb->volume_name.data_size != 0 ) {
+ CHAR UNALIGNED *temp_vol_name;
+
+ /* Device Name */
+ temp_vol_name = (CHAR_PTR)( (INT8_PTR)vstr_ptr + v_offset ) ;
+ FS_GetVolNameInVCB( cur_dblk, temp_vol_name ) ;
+ cur_volb->device_name.data_offset = v_offset ;
+
+ if ( temp_vol_name[1] == TEXT(':') ) {
+ cur_volb->device_name.data_size = 2 * sizeof( CHAR ) ;
+ } else {
+ cur_volb->device_name.data_size = cur_volb->volume_name.data_size ;
+ }
+
+ if( ( ret_val = F40_SaveLclName( &cur_env->device_name,
+ (UINT8_PTR)( vstr_ptr + v_offset ),
+ &cur_env->device_name_size,
+ &cur_env->device_name_alloc,
+ cur_volb->device_name.data_size ) ) != TFLE_NO_ERR ) {
+
+ return( ret_val ) ;
+ }
+ v_offset += cur_volb->device_name.data_size ;
+
+ cur_volb->volume_name.data_size -= cur_volb->device_name.data_size
+ + sizeof( CHAR ) ;
+
+ if( ( temp_vol_name[1] == TEXT(':') ) &&
+ (cur_volb->volume_name.data_size > sizeof( CHAR ) ) ) {
+
+ /* Shift Volume Name back over the space character */
+ cur_volb->volume_name.data_size -= sizeof( CHAR ) ;
+ memmove( vstr_ptr + v_offset, vstr_ptr + v_offset + sizeof( CHAR ),
+ cur_volb->volume_name.data_size ) ;
+
+ cur_volb->volume_name.data_offset = v_offset ;
+ if( ( ret_val = F40_SaveLclName( &cur_env->vol_name,
+ (UINT8_PTR)( vstr_ptr + v_offset ),
+ &cur_env->vol_name_size,
+ &cur_env->vol_name_alloc,
+ cur_volb->volume_name.data_size ) ) != TFLE_NO_ERR ) {
+
+ return( ret_val ) ;
+ }
+ v_offset += cur_volb->volume_name.data_size ;
+
+ } else {
+ cur_env->vol_name_size = 0 ;
+ cur_volb->volume_name.data_size = 0 ;
+ cur_volb->volume_name.data_offset = 0 ;
+ }
+ } else {
+ cur_env->device_name_size = 0 ;
+ cur_volb->device_name.data_size = 0 ;
+ cur_volb->device_name.data_offset = 0 ;
+ cur_env->vol_name_size = 0 ;
+ cur_volb->volume_name.data_offset = 0 ;
+ }
+
+#endif
+
+ cur_volb->machine_name.data_size = FS_SizeofMachNameInVCB( (VCB_PTR)cur_dblk ) ;
+ if( cur_volb->machine_name.data_size != 0 ) {
+ cur_volb->machine_name.data_size -= sizeof( CHAR ) ;
+ cur_volb->machine_name.data_offset = v_offset ;
+ FS_GetMachNameInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + v_offset ) ) ;
+
+ if( ( ret_val = F40_SaveLclName( &cur_env->machine_name,
+ (UINT8_PTR)( vstr_ptr + v_offset ),
+ &cur_env->machine_name_size,
+ &cur_env->machine_name_alloc,
+ cur_volb->machine_name.data_size ) ) != TFLE_NO_ERR ) {
+
+ return( ret_val ) ;
+ }
+ v_offset += cur_volb->machine_name.data_size ;
+ } else {
+ cur_env->machine_name_size = 0 ;
+ cur_volb->machine_name.data_offset = 0 ;
+ }
+
+
+ cur_volb->volume_attribs = 0 ;
+
+ /* Here we do our own version of SetupDBHeader that does only what
+ we need, and not all the extranious stuff.
+ */
+
+ F40_SetBlkType( cur_hdr, MTF_VOLB_N ) ;
+
+ (VOID)FS_GetOSid_verFromDBLK( cur_fsys, cur_dblk, &temp_os_id, &temp_os_ver ) ;
+
+ cur_hdr->machine_os_id = (UINT8)temp_os_id;
+ cur_hdr->machine_os_version = (UINT8)temp_os_ver ;
+ cur_hdr->logical_block_address = U64_Init( channel->running_lba, 0L ) ;
+ cur_hdr->os_specific_data.data_offset = 0 ;
+ cur_hdr->os_specific_data.data_size = 0 ;
+ cur_hdr->session_id = U64_Init( 0L, 0L ) ;
+ cur_hdr->displayable_size = U64_Init( 0L, 0L ) ;
+ cur_hdr->string_type = (UINT8)FS_GetStringTypes( cur_fsys ) ;
+ cur_hdr->block_attribs = 0L ;
+
+ if( continuation ) {
+ cur_hdr->block_attribs |= MTF_DB_CONT_BIT ;
+ /* Setup Block ID, if its a continuation, don't increment it */
+ cur_hdr->control_block_id = channel->eom_id ;
+ } else {
+ cur_hdr->control_block_id = channel->eom_id++ ;
+ }
+
+ v_offset += (UINT16)PadToLBBoundary( v_offset ) ;
+ cur_hdr->offset_to_data = v_offset ;
+
+ /* Calculate the Header Check Sum */
+ cur_hdr->hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN ) ;
+
+ *offset = v_offset ;
+
+ /* For later pad calculations */
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( v_offset, 0L ) ;
+ }
+
+ /* Write OTC SM and FDD entry */
+ if( ret_val == TFLE_NO_ERR && cur_env->cur_otc_level != TCL_NONE
+ && !cur_env->sm_aborted ) {
+ ret_val = OTC_GenVolEntry( cur_env, cur_volb, channel->ts_num ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtSSET
+
+ Description: Translates a DBLK in a format 4.0 SSET.
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes: I have two concerns about this function:
+
+ 1) I don't know if the translators should be
+ setting up the Tape ID, Tape Sequence, and
+ Backup Set NUmber. This seems to be a unit
+ violation, and also requires a writer of
+ of translator to know he must update the fields
+ in the channel, and in the "current dblk".
+
+ 2) I forgot what the second concern was. This really
+ concerns me.
+
+ If the field "channel->tape_id" is zero, this function
+ manufactures a tape_id, a backup set number, and tape
+ sequence number and sets the appropriate fields in
+ the channel structure. Note: It also needs to create
+ a TAPE HEADER DBLK and save the appropriate information
+ in an Enviornment that is never destroyed.
+
+ The TAPE HEADER must be written first, followed by
+ the SSET block. Then a VOLB block must be written
+ with the volume information.
+
+**/
+
+INT16 F40_WtSSET(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN continuation )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ; /* Pointer to cur DBLK */
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ MTF_SSET_PTR cur_sset ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ UINT8_PTR vstr_ptr ;
+ UINT16 offset ;
+ DATE_TIME temp_date ;
+ INT16 ret_val ;
+
+ if( channel->tape_id == 0L && !continuation ) {
+ cur_env->max_otc_level = TEST_OTC_LEVEL ;
+ }
+
+ /* Temporary way to stop OTC on drives that don't have seek capability */
+ if( !SupportBlkPos( curDRV ) ||
+ !SupportFastEOD( curDRV ) ||
+ !SupportRevFmk( curDRV ) ) {
+
+ if( cur_env->max_otc_level != TCL_NONE && continuation ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ cur_env->max_otc_level = TCL_NONE ;
+ }
+
+ if( !continuation ) {
+ if( ( ret_val = F40_WriteInit( channel, TEST_OTC_LEVEL, buffer ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+
+ if( ( ret_val = F40_InitTape( channel, continuation, buffer ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ return( ret_val ) ;
+ }
+
+ /* Now we need to get a pointer to the SSET in the buffer */
+ /* Here we are going to 'rewind' the pointer back to the start
+ of the buffer. We don't want the tape header to be rememebered.
+ */
+ BM_SetNextByteOffset( buffer, 0 ) ;
+ BM_SetBytesFree( buffer, BM_TFSize( buffer ) ) ;
+ memset( BM_XferBase( buffer ), 0, BM_XferSize( buffer ) ) ;
+ cur_sset = (MTF_SSET_PTR)( BM_XferBase( buffer ) ) ;
+ vstr_ptr = BM_XferBase( buffer ) ;
+ offset = sizeof( MTF_SSET ) ;
+
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( 0L, 0L ) ;
+ }
+
+ if( !continuation ) {
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ }
+
+ /* Set based on information in the channel. The channel information
+ will have been properly setup by the call to F40_InitTape()
+ */
+
+ cur_sset->backup_set_number = (UINT16)channel->bs_num ;
+ cur_sset->time_zone = LOCAL_TZ ;
+
+ /* NOTE: On strings other than the password we decrement the size to
+ leave off the '\0'.
+ */
+
+ /* Backup Set Name */
+ if( ( cur_sset->backup_set_name.data_size =
+ FS_SizeofBackupSetNameInVCB( (VCB_PTR)cur_dblk ) ) != 0 ) {
+
+ cur_sset->backup_set_name.data_offset = offset ;
+ FS_GetSetNameInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + offset ) ) ;
+ cur_sset->backup_set_name.data_size -= sizeof( CHAR ) ;
+ offset += cur_sset->backup_set_name.data_size ;
+ } else {
+ cur_sset->backup_set_name.data_offset = 0 ;
+ }
+
+ /* Backup Description */
+ if( ( cur_sset->backup_set_description.data_size =
+ FS_SizeofSetDescriptInVCB( (VCB_PTR)cur_dblk ) ) != 0 ) {
+ cur_sset->backup_set_description.data_offset = offset ;
+ FS_GetSetDescrInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + offset ) ) ;
+ cur_sset->backup_set_description.data_size -= sizeof( CHAR ) ;
+ offset += cur_sset->backup_set_description.data_size ;
+ } else {
+ cur_sset->backup_set_description.data_offset = 0 ;
+ }
+
+ /* Backup Set Password */
+ if( ( cur_sset->backup_set_password.data_size =
+ FS_SizeofSetPswdInVCB( (VCB_PTR)cur_dblk ) ) != 0 ) {
+ cur_sset->backup_set_password.data_offset = offset ;
+ FS_GetSetPswdInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + offset ) ) ;
+ offset += cur_sset->backup_set_password.data_size ;
+ } else {
+ cur_sset->backup_set_password.data_offset = 0 ;
+ }
+
+ cur_sset->software_vendor_id = CONNER_SOFTWARE_VENDOR_ID ;
+ cur_sset->password_encryption_algor =
+ FS_ViewPswdEncryptInVCB( (VCB_PTR)cur_dblk ) ;
+
+ /* User Name */
+ if( ( cur_sset->user_name.data_size =
+ FS_SizeofUserNameInVCB( (VCB_PTR)cur_dblk ) ) != 0 ) {
+ cur_sset->user_name.data_offset = offset ;
+ FS_GetUserNameInVCB( cur_dblk, (CHAR_PTR)( (INT8_PTR)vstr_ptr + offset ) ) ;
+ cur_sset->user_name.data_size -= sizeof( CHAR ) ;
+ offset += cur_sset->user_name.data_size ;
+ } else {
+ cur_sset->user_name.data_offset = 0 ;
+ }
+
+ cur_sset->software_ver_mjr = BE_MAJ_VERSION ;
+
+ cur_sset->software_ver_mnr = BE_MIN_VERSION ;
+
+ cur_sset->tf_minor_ver = FORMAT_VER_MINOR ;
+ cur_sset->tape_cat_ver = TAPE_CATALOG_VER ;
+
+ /* Get Backup Date */
+ GetCurrentDate( &temp_date ) ;
+ DateToTapeDate( &cur_sset->backup_date, &temp_date ) ;
+
+ /* Okay Set Them in The saved DBLK in the Channel list and in the curDBLK */
+ FS_SetBSNumInVCB( (DBLK_PTR)channel->lst_osvcb,
+ cur_sset->backup_set_number ) ;
+ FS_SetBSNumInVCB( cur_dblk, cur_sset->backup_set_number ) ;
+
+ FS_SetTSNumInVCB( (DBLK_PTR)channel->lst_osvcb,
+ cur_env->tape_hdr.tape_seq_number ) ;
+ FS_SetTSNumInVCB( cur_dblk, cur_env->tape_hdr.tape_seq_number ) ;
+
+ FS_SetTapeIDInVCB( (DBLK_PTR)channel->lst_osvcb,
+ cur_env->tape_hdr.tape_id_number ) ;
+ FS_SetTapeIDInVCB( cur_dblk, cur_env->tape_hdr.tape_id_number ) ;
+
+ FS_SetTFMajorVerInVCB( (DBLK_PTR)channel->lst_osvcb, FORMAT_VER_MAJOR ) ;
+ FS_SetTFMajorVerInVCB( cur_dblk, FORMAT_VER_MAJOR ) ;
+ FS_SetTFMinorVerInVCB( (DBLK_PTR)channel->lst_osvcb, FORMAT_VER_MINOR ) ;
+ FS_SetTFMinorVerInVCB( cur_dblk, FORMAT_VER_MINOR ) ;
+ FS_SetSWMajorVerInVCB( (DBLK_PTR)channel->lst_osvcb,
+ cur_sset->software_ver_mjr ) ;
+ FS_SetSWMajorVerInVCB( cur_dblk, cur_sset->software_ver_mjr ) ;
+ FS_SetSWMinorVerInVCB( (DBLK_PTR)channel->lst_osvcb,
+ cur_sset->software_ver_mnr ) ;
+ FS_SetSWMinorVerInVCB( cur_dblk, cur_sset->software_ver_mnr ) ;
+
+ /* Set the Time for the loops */
+ FS_SetBackupDateInVCB( cur_dblk, &temp_date ) ;
+
+ FS_SetOnTapeCatLevel( cur_dblk, cur_env->cur_otc_level ) ;
+ FS_SetSetCatInfoValid( cur_dblk, FALSE ) ;
+ FS_SetOnTapeCatVer( cur_dblk, TAPE_CATALOG_VER ) ;
+
+ cur_sset->data_encryption_algor = FS_ViewDataEncryptInVCB( (VCB_PTR)cur_dblk ) ;
+
+ cur_sset->sset_attribs = FS_GetAttribFromDBLK( cur_fsys, cur_dblk ) ;
+
+ cur_sset->physical_block_address = U64_Init( PbaOfVCB( channel ), 0L ) ;
+ offset = SetupDBHeader( MTF_SSET_N, channel, cur_dblk,
+ (MTF_DB_HDR_PTR)cur_sset, offset, FALSE, continuation ) ;
+
+ FS_SetLBAinDBLK( (DBLK_PTR)channel->lst_osvcb, channel->running_lba ) ;
+
+ if( cur_env->cur_otc_level == TCL_FULL ) {
+ cur_sset->block_hdr.block_attribs |= MTF_DB_FDD_EXISTS ;
+ /* Recalculate the Header Check Sum */
+ cur_sset->block_hdr.hdr_chksm =
+ F40_CalcChecksum( (UINT16_PTR)cur_sset, F40_HDR_CHKSUM_LEN ) ;
+ }
+
+ FS_SetPBAinVCB( cur_dblk, U64_Lsw( cur_sset->physical_block_address ) ) ;
+ FS_SetPBAinVCB( (DBLK_PTR)channel->lst_osvcb,
+ U64_Lsw( cur_sset->physical_block_address ) ) ;
+ cur_env->last_sset_pba = U64_Lsw( cur_sset->physical_block_address ) ;
+ LongAlignOffset( offset ) ;
+
+ BM_UpdCnts( buffer, offset ) ;
+
+ /* For later pad calculations */
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( offset, 0L ) ;
+ }
+
+ /* This grotesque little conditional checks to see if we wrote the SSET
+ on the last tape but fell short of writing the VOLB, or if we are
+ crossing tape during CloseSet processing. In either case, we don't
+ want to write a continuation VOLB, or an OTC SM Entry.
+ */
+ if( continuation &&
+ ( ( channel->lst_tblk == BT_VCB && channel->eom_buff != NULL &&
+ BM_NextByteOffset( channel->eom_buff ) == F40_LB_SIZE ) ||
+ IsChannelStatus( channel, CH_EOS_AT_EOM ) ) ) {
+
+ /* We're all done. */
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* Write OTC SM entry */
+ if( cur_env->cur_otc_level != TCL_NONE && !cur_env->sm_aborted ) {
+ if( ( ret_val = OTC_GenSMEntry( cur_sset, channel, continuation ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+
+ /* Now we need to do the VOLB block. This will involve saving
+ the current VOLB information in the enviornment and testing
+ to see if anything changed. If there has been a change then we
+ must write a new VOLB. Of course if this is the start of a
+ new set we need a new VOLB.
+ */
+ if( ( ret_val = F40_WtVOLB( channel, buffer, continuation, &offset ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+
+ BM_UpdCnts( buffer, offset ) ;
+
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtDIRB
+
+ Description: Translates an OSDBLK DDB into a format 4.0 DIRB
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes:
+
+**/
+INT16 F40_WtDIRB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN continuation )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ; /* Pointer to cur DBLK */
+ FSYS_HAND cur_fsys = channel->cur_fsys ; /* Pointer to cur FilSys */
+ MTF_DIR_PTR cur_dir = (MTF_DIR_PTR)( BM_NextBytePtr( buffer ) ) ;
+ UINT16 offset = sizeof( MTF_DIR ) ;
+ UINT8_PTR vstr_ptr = ( BM_NextBytePtr( buffer ) ) ;
+ DATE_TIME temp_date ;
+
+ cur_dir->directory_attribs = FS_GetAttribFromDBLK( cur_fsys, cur_dblk ) ;
+
+ if( cur_dir->directory_attribs & DIR_IS_REALLY_DB ) {
+ /* This is a Database DBLK, but the boys upstairs don't want to
+ know about such silly things! So the File System lies and
+ calls it a DDB to get it passed on to us. Now we're going
+ to call the appropriate function to write a Database DBLK
+ (DBDB) to tape.
+ */
+ return( F40_WtDBDB( channel, buffer, continuation ) ) ;
+ }
+
+ if( !continuation ) {
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ }
+
+ /* UpDate Dates */
+ FS_GetMDateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_dir->last_mod_date, &temp_date ) ;
+ FS_GetCDateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_dir->create_date, &temp_date ) ;
+ FS_GetBDateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_dir->backup_date, &temp_date ) ;
+ FS_GetADateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_dir->last_access_date, &temp_date ) ;
+
+ /* dir_name */
+ if( ! ( cur_dir->directory_attribs & DIR_PATH_IN_STREAM_BIT ) ) {
+ vstr_ptr += cur_dir->directory_name.data_offset = offset ;
+ FS_GetOSPathFromDDB( cur_fsys, cur_dblk, (CHAR_PTR)( vstr_ptr ) ) ;
+ offset += cur_dir->directory_name.data_size =
+ FS_SizeofOSPathInDDB( cur_fsys, cur_dblk ) ;
+ } else {
+ cur_dir->directory_name.data_size = 0 ;
+ cur_dir->directory_name.data_offset = 0 ;
+ }
+
+ if( !continuation ) {
+ cur_dir->directory_id = ++cur_env->dir_count ;
+ } else {
+ cur_dir->directory_id = cur_env->eom_dir_id ;
+ }
+
+ /* Setup DB header */
+ offset = SetupDBHeader( MTF_DIRB_N, channel, cur_dblk,
+ (MTF_DB_HDR_PTR)cur_dir, offset, TRUE, continuation ) ;
+
+ BM_UpdCnts( buffer, offset ) ;
+
+ /* For later pad calculations */
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( offset, 0L ) ;
+ }
+
+ /* For later file stuff */
+ channel->lst_did = cur_dir->block_hdr.control_block_id ;
+
+ /* Write OTC FDD entry */
+ if( ret_val == TFLE_NO_ERR && cur_env->cur_otc_level == TCL_FULL
+ && !cur_env->fdd_aborted ) {
+ ret_val = OTC_GenDirEntry( channel, cur_dir, channel->ts_num ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtDBDB
+
+ Description: Translates an OSDBLK DDB into an MTF DBDB.
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes:
+
+**/
+INT16 F40_WtDBDB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN continuation )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ F40_DBDB_PTR cur_dbdb = (F40_DBDB_PTR)( BM_NextBytePtr( buffer ) ) ;
+ UINT16 offset = sizeof( F40_DBDB ) ;
+ UINT8_PTR vstr_ptr = ( BM_NextBytePtr( buffer ) ) ;
+ DATE_TIME temp_date ;
+
+ if( !continuation ) {
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ }
+
+ FS_GetBDateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_dbdb->backup_date, &temp_date ) ;
+
+ cur_dbdb->database_attribs = FS_GetAttribFromDBLK( cur_fsys, cur_dblk ) ;
+
+ vstr_ptr += cur_dbdb->database_name.data_offset = offset ;
+ FS_GetOSPathFromDDB( cur_fsys, cur_dblk, (CHAR_PTR)( vstr_ptr ) ) ;
+ offset += cur_dbdb->database_name.data_size =
+ FS_SizeofOSPathInDDB( cur_fsys, cur_dblk ) ;
+
+ /* Setup DB header */
+ offset = SetupDBHeader( F40_DBDB_N, channel, cur_dblk,
+ (MTF_DB_HDR_PTR)cur_dbdb, offset, TRUE, continuation ) ;
+
+ BM_UpdCnts( buffer, offset ) ;
+
+ /* For later pad calculations */
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( offset, 0L ) ;
+ }
+
+ /* Write OTC FDD entry */
+ if( ret_val == TFLE_NO_ERR && cur_env->cur_otc_level == TCL_FULL
+ && !cur_env->fdd_aborted ) {
+ ret_val = OTC_GenDBDBEntry( channel, cur_dbdb, channel->ts_num ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtFILE
+
+ Description: Translates an OSDBLK FDB into a format 4.0 FILE
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes:
+
+**/
+INT16 F40_WtFILE(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN continuation )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ MTF_FILE_PTR cur_file = (MTF_FILE_PTR)( BM_NextBytePtr( buffer ) ) ;
+ UINT16 offset = sizeof( MTF_FILE ) ;
+ UINT8_PTR vstr_ptr = ( BM_NextBytePtr( buffer ) ) ;
+ DATE_TIME temp_date ;
+
+ if( !continuation ) {
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ }
+
+ /* Get generic fields from file system */
+ FS_GetMDateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_file->last_mod_date, &temp_date ) ;
+ FS_GetCDateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_file->create_date, &temp_date ) ;
+ FS_GetBDateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_file->backup_date, &temp_date ) ;
+ FS_GetADateFromDBLK( cur_fsys, cur_dblk, &temp_date ) ;
+ DateToTapeDate( &cur_file->last_access_date, &temp_date ) ;
+
+ /* For error recovery */
+ if( !continuation ) {
+ cur_file->directory_id = cur_env->dir_count ;
+ cur_file->file_id = ++cur_env->file_count ;
+ } else {
+ cur_file->directory_id = cur_env->eom_dir_id ;
+ cur_file->file_id = cur_env->eom_file_id ;
+ }
+
+ /* file name */
+ vstr_ptr += cur_file->file_name.data_offset = offset ;
+ FS_GetOSFnameFromFDB( cur_fsys, cur_dblk, (CHAR_PTR)( vstr_ptr ) ) ;
+ cur_file->file_name.data_size = FS_SizeofOSFnameInFDB( cur_fsys, cur_dblk ) ;
+
+ /* Decrement the size to leave off the '\0'. */
+ cur_file->file_name.data_size -= sizeof( CHAR ) ;
+
+ offset += cur_file->file_name.data_size ;
+
+ cur_file->file_attributes = FS_GetAttribFromDBLK( cur_fsys, cur_dblk ) ;
+
+ /* Setup DB header */
+ offset = SetupDBHeader( MTF_FILE_N, channel, cur_dblk,
+ (MTF_DB_HDR_PTR)cur_file, offset, TRUE, continuation ) ;
+
+ if( cur_file->block_hdr.machine_os_id == FS_PC_DOS ||
+ cur_file->block_hdr.machine_os_id == FS_PC_OS2 ) {
+
+ cur_file->file_attributes |=
+ ( cur_file->file_attributes & OBJ_READONLY_BIT )
+ ? DOS_FILE_READONLY_BIT : 0 ;
+ cur_file->file_attributes |=
+ ( cur_file->file_attributes & OBJ_HIDDEN_BIT )
+ ? DOS_FILE_HIDDEN_BIT : 0 ;
+ cur_file->file_attributes |=
+ ( cur_file->file_attributes & OBJ_SYSTEM_BIT )
+ ? DOS_FILE_SYSTEM_BIT : 0 ;
+ cur_file->file_attributes |=
+ ( cur_file->file_attributes & OBJ_MODIFIED_BIT )
+ ? DOS_FILE_MODIFIED_BIT : 0 ;
+ cur_file->file_attributes &= 0xFFFF00FF ;
+ }
+
+ BM_UpdCnts( buffer, offset ) ;
+
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( offset, 0L ) ;
+ }
+
+ /* For later file stuff */
+ channel->lst_fid = cur_file->block_hdr.control_block_id ;
+
+ /* Write OTC FDD entry */
+ if( ret_val == TFLE_NO_ERR && cur_env->cur_otc_level == TCL_FULL
+ && !cur_env->fdd_aborted ) {
+ ret_val = OTC_GenFileEntry( cur_env, cur_file, channel->ts_num ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtIMAG
+
+ Description: This writes an image descriptor block to the buffer.
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes:
+
+**/
+INT16 F40_WtIMAG(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN continuation )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+
+#if defined( FS_IMAGE )
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ F40_IMAG_PTR cur_imag = (F40_IMAG_PTR)( BM_NextBytePtr( buffer ) ) ;
+ UINT16 offset = sizeof( F40_IMAG ) ;
+ UINT8_PTR vstr_ptr = ( BM_NextBytePtr( buffer ) ) ;
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+
+
+ if( !continuation ) {
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ }
+
+ cur_imag->block_hdr.block_attribs = 0 ;
+
+ cur_imag->bytes_in_sector = FS_ViewDriveSecSizeIDB( cur_fsys, cur_dblk ) ;
+ cur_imag->no_of_sectors = FS_ViewDriveNumSecIDB( cur_fsys, cur_dblk ) ;
+ cur_imag->no_of_heads = FS_ViewDriveNumHeadsIDB( cur_fsys, cur_dblk ) ;
+
+
+ cur_imag->relative_sector_no = FS_ViewPartRelSecIDB( cur_fsys, cur_dblk) ;
+ cur_imag->partition_no_of_sector =
+ FS_ViewPartNumSecIDB( cur_fsys, cur_dblk ) ;
+ cur_imag->partition_sys_ind = FS_ViewPartSysIndIDB( cur_fsys, cur_dblk ) ;
+
+ vstr_ptr += cur_imag->partition_name.string_offset = offset ;
+ FS_GetPnameIDB( cur_fsys, cur_dblk, (CHAR_PTR)( vstr_ptr ) ) ;
+ offset += cur_imag->partition_name.data_size =
+ FS_SizeofPnameInIDB( cur_fsys, cur_dblk ) ;
+ offset = SetupDBHeader( F40_IMAG_N, channel, cur_dblk,
+ (MTF_DB_HDR_PTR)cur_imag, offset, TRUE, continuation ) ;
+ BM_UpdCnts( buffer, offset ) ;
+
+ /* For later pad calculations */
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( offset, 0L ) ;
+ }
+
+#else
+ (VOID) channel ;
+ (VOID) buffer ;
+ (VOID) continuation ;
+ mscassert( FALSE ) ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+#endif
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtCFDB
+
+ Description: Writes a corrupt file descriptor block.
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes:
+
+**/
+
+INT16 F40_WtCFIL(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN continuation )
+{
+
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ MTF_CFIL_PTR cur_cfil = (MTF_CFIL_PTR)( BM_NextBytePtr( buffer ) ) ;
+ UINT16 offset = sizeof( MTF_CFIL ) ;
+
+ if( !continuation ) {
+ cur_env->corrupt_obj_count++ ;
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ }
+
+ LongAlignOffset( offset ) ;
+ /* Clear Attributes */
+ cur_cfil->block_hdr.block_attribs = 0 ;
+
+ cur_cfil->corrupt_file_attribs = FS_GetAttribFromDBLK( cur_fsys, cur_dblk ) ;
+ if( !continuation ) {
+ cur_cfil->directory_id = cur_env->dir_count ;
+ cur_cfil->file_id = cur_env->file_count ;
+ } else {
+ cur_cfil->directory_id = cur_env->eom_dir_id ;
+ cur_cfil->file_id = cur_env->eom_file_id ;
+ }
+
+ cur_cfil->stream_offset =
+ U32_To_U64( FS_GetCorruptOffsetInCFDB( (CFDB_PTR)cur_dblk ) ) ;
+ cur_cfil->corrupt_stream_number =
+ FS_GetCorruptStrmNumInCFDB( (CFDB_PTR)cur_dblk ) ;
+
+ /* Setup DB header */
+ offset = SetupDBHeader( MTF_CFIL_N, channel, cur_dblk,
+ (MTF_DB_HDR_PTR)cur_cfil, offset, FALSE, continuation ) ;
+
+ BM_UpdCnts( buffer, offset ) ;
+
+ /* For later pad calculations */
+ if( !continuation ) {
+ cur_env->used_so_far = U64_Init( offset, 0L ) ;
+ }
+
+ /* Adjust OTC FDD entry */
+ if( ret_val == TFLE_NO_ERR && cur_env->cur_otc_level == TCL_FULL
+ && !cur_env->fdd_aborted ) {
+ ret_val = OTC_MarkLastEntryCorrupt( cur_env ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtESET
+
+ Description: Translates a DBLK in a format 4.0 ESET.
+ End of Set.
+
+ Returns: INT16 TFLE_xxx error code.
+
+ Notes: None
+
+**/
+INT16 F40_WtESET(
+ CHANNEL_PTR channel, /* Pointer to current channel */
+ BUF_PTR buffer, /* Pointer to buffer */
+ BOOLEAN continuation, /* TRUE if continuation VCB */
+ BOOLEAN abort ) /* TRUE if aborted operation */
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ; /* Pointer to cur DBLK */
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ MTF_ESET_PTR cur_eset ;
+ MTF_DB_HDR_PTR cur_hdr ;
+ FSYS_HAND cur_fsys = channel->cur_fsys ;
+ UINT16 offset ;
+ DATE_TIME temp_date ;
+ UINT16 temp_os_id ;
+ UINT16 temp_os_ver ;
+
+ /* get a pointer to the ESET in the buffer */
+ cur_eset = (MTF_ESET_PTR)( BM_NextBytePtr( buffer ) ) ;
+ cur_hdr = &cur_eset->block_hdr ;
+ offset = sizeof( MTF_ESET ) ;
+ LongAlignOffset( offset ) ;
+
+ cur_eset->corrupt_file_count = cur_env->corrupt_obj_count ;
+ cur_eset->set_map_phys_blk_adr = U64_Init( 0L, 0L ) ;
+ cur_eset->fdd_phys_blk_adr = U64_Init( 0L, 0L ) ;
+
+ cur_hdr->control_block_id = (UINT32)channel->tape_id ;
+ cur_eset->backup_set_number = (UINT16)channel->bs_num ;
+
+ /* Get Backup Date */
+ GetCurrentDate( &temp_date ) ;
+ DateToTapeDate( &cur_eset->backup_date, &temp_date ) ;
+
+ cur_hdr->control_block_id = (UINT32)channel->tape_id ;
+ cur_eset->backup_set_number = (UINT16)channel->bs_num ;
+
+ cur_eset->eset_attribs = 0L ;
+
+ /* Here we do our own version of SetupDBHeader because we're setting
+ up our own data streams (OTC)
+ */
+
+ /* Setup the block type */
+ F40_SetBlkType( cur_hdr, MTF_ESET_N ) ;
+
+ cur_hdr->logical_block_address = U64_Init( 0L, 0L ) ;
+ cur_hdr->os_specific_data.data_offset = 0 ;
+ cur_hdr->os_specific_data.data_size = 0 ;
+ (VOID)FS_GetOSid_verFromDBLK( cur_fsys, cur_dblk, &temp_os_id, &temp_os_ver ) ;
+ cur_hdr->machine_os_id = (UINT8)temp_os_id;
+ cur_hdr->machine_os_version = (UINT8)temp_os_ver ;
+
+ cur_hdr->session_id = U64_Init( 0L, 0L ) ;
+
+ /* Setup Block ID, if its a continuation, don't increment it */
+ if( continuation ) {
+ cur_hdr->control_block_id = channel->eom_id ;
+ } else {
+ cur_hdr->control_block_id = channel->eom_id++ ;
+ }
+
+ /* set up the attributes */
+ cur_hdr->block_attribs = 0L ;
+ if( abort ) {
+ cur_hdr->block_attribs |= MTF_DB_ABORTED_SET_BIT ;
+ }
+ if( continuation ) {
+ cur_hdr->block_attribs |= MTF_DB_CONT_BIT ;
+ }
+ if( cur_env->fdd_aborted ) {
+ cur_hdr->block_attribs |= MTF_DB_FDD_ABORTED_BIT ;
+ }
+ if( cur_env->sm_aborted ) {
+ cur_hdr->block_attribs |= MTF_DB_END_OF_FAMILY_BIT ;
+ }
+
+ /* Set data size fields */
+ cur_hdr->displayable_size = U64_Init( 0L, 0L ) ;
+
+ offset += PadToBoundary( offset, ChannelBlkSize( channel ) ) ;
+ cur_hdr->offset_to_data = offset ;
+
+ /* Calculate the Header Check Sum */
+ cur_hdr->hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_eset, F40_HDR_CHKSUM_LEN ) ;
+
+ BM_UpdCnts( buffer, offset ) ;
+ return( ret_val ) ;
+
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtEOSPadBlk
+
+ Description: Writes an ESPB descriptor block to pad buffer out to a
+ physical block boundary.
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+
+VOID F40_WtEOSPadBlk(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ MTF_DB_HDR_PTR cur_hdr = (MTF_DB_HDR_PTR)( BM_NextBytePtr( channel->cur_buff ) ) ;
+ UINT16 size ;
+ UINT16 temp_os_id ;
+ UINT16 temp_os_ver ;
+
+ size = BM_BytesFree( channel->cur_buff ) % ChannelBlkSize( channel ) ;
+ memset( cur_hdr, 0, size ) ;
+
+ channel->running_lba += F40_CalcRunningLBA( cur_env ) ;
+ cur_env->used_so_far = U64_Init( size, 0L ) ;
+
+ F40_SetBlkType( cur_hdr, MTF_ESPB_N ) ;
+
+ (VOID)FS_GetOSid_verFromDBLK( channel->cur_fsys, channel->cur_dblk, &temp_os_id, &temp_os_ver ) ;
+ cur_hdr->machine_os_id = (UINT8)temp_os_id ;
+ cur_hdr->machine_os_version = (UINT8)temp_os_ver ;
+ cur_hdr->session_id = U64_Init( 0L, 0L ) ;
+ cur_hdr->offset_to_data = size ;
+ cur_hdr->control_block_id = channel->eom_id++ ;
+ cur_hdr->logical_block_address = U64_Init( channel->running_lba, 0L ) ;
+ cur_hdr->hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN ) ;
+
+ cur_env->pad_size = 0 ;
+
+ BM_UpdCnts( channel->cur_buff, size ) ;
+}
+
diff --git a/private/utils/ntbackup/src/mtf10wt.c b/private/utils/ntbackup/src/mtf10wt.c
new file mode 100644
index 000000000..b7a39e9ba
--- /dev/null
+++ b/private/utils/ntbackup/src/mtf10wt.c
@@ -0,0 +1,1678 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: mtf40wt.c
+
+ Description: Contains the Code for writing Maynard 4.0 Format.
+
+ $Log: T:/LOGFILES/MTF10WT.C_V $
+
+ Rev 1.20.1.2 11 Jan 1995 21:05:08 GREGG
+Calculate OTC addrs from fmk instead of always asking (fixes Wangtek bug).
+
+ Rev 1.20.1.1 08 Jan 1995 21:51:06 GREGG
+Added database DBLK.
+
+ Rev 1.20.1.0 13 Jan 1994 17:20:44 GREGG
+If backup was aborted, mark last file entry in OTC as corrupt.
+
+ Rev 1.20 08 Sep 1993 13:28:36 GREGG
+Fixed method WriteInit uses to determine if we are appending.
+
+ Rev 1.19 31 Aug 1993 16:54:54 GREGG
+Modified the way we control hardware compression from software to work around
+a bug in Archive DAT DC firmware rev. 3.58 (we shipped a lot of them).
+Files Modified: lw_data.c, lw_data.h, tfstuff.c, mtf10wdb.c, mtf10wt.c and
+ drives.c
+
+ Rev 1.18 17 Jul 1993 17:57:22 GREGG
+Changed write translator functions to return INT16 TFLE_xxx errors instead
+of BOOLEAN TRUE/FALSE. Files changed:
+ MTF10WDB.C 1.23, TRANSLAT.H 1.22, F40PROTO.H 1.30, FMTENG.H 1.23,
+ TRANSLAT.C 1.43, TFWRITE.C 1.68, MTF10WT.C 1.18
+
+ Rev 1.17 04 Jul 1993 03:38:52 GREGG
+Set eom_file_id and eom_dir_id in ParseWrittenBuffer.
+
+ Rev 1.16 15 Jun 1993 18:48:46 GREGG
+Fixed EPR #294-0443 - Continue flag not set if EOM hit writing 1st fmk.
+
+ Rev 1.15 09 Jun 1993 19:53:04 GREGG
+Fix for EPR #0525 - Accept GEN_ERR_EOM return on space to EOD for Wangtek bug.
+
+ Rev 1.14 09 Jun 1993 03:51:14 GREGG
+In EOS at EOM case, don't call OTC_PreprocessEOM.
+
+ Rev 1.13 08 Jun 1993 00:09:56 GREGG
+Fix for bug in the way we were handling EOM and continuation OTC entries.
+Files modified for fix: mtf10wt.c, otc40wt.c, otc40msc.c f40proto.h mayn40.h
+
+ Rev 1.12 24 May 1993 13:23:22 GREGG
+Put back the VCB buffer before returning error in WtContTape.
+
+ Rev 1.11 17 May 1993 20:11:56 GREGG
+Added logic to deal with the fact that the app above tape format doesn't
+keep track of the lba of the vcb.
+
+ Rev 1.10 29 Apr 1993 23:37:14 GREGG
+Fixed assert caused by GetBlkType calling a VOLB a UDB.
+
+ Rev 1.9 26 Apr 1993 11:45:56 GREGG
+Seventh in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Changed handling of EOM processing during non-OTC EOS processing.
+
+Matches CHANNEL.H 1.17, MAYN40RD.C 1.60, TFWRITE.C 1.63, MTF.H 1.5,
+ TFLUTILS.C 1.44, MTF10WDB.C 1.10, MTF10WT.C 1.9
+
+ Rev 1.8 25 Apr 1993 17:12:48 GREGG
+Fixed cast (CHAR_PTR to UINT8_PTR) in F40_SaveLclName.
+
+ Rev 1.7 22 Apr 1993 03:31:32 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.6 18 Apr 1993 00:34:36 GREGG
+First in a series of incremental changes to bring the translator in line
+with the MTF spec:
+ - Rewrote F40_WtCloseTape:
+ - Stop using SetupDBHeader to set up the Tape Header (needs
+ special setup specific to that DBLK).
+ - Set string_storage_offset properly.
+ - Changed CHAR_PTRs to UINT8_PTRs in F40_SaveLclName.
+
+Matches: MTF10WDB.C 1.6, MAYN40RD.C 1.53, MAYN40.H 1.31 and F40PROTO.H 1.25
+
+ Rev 1.5 14 Apr 1993 02:00:00 GREGG
+Fixes to deal with non-ffr tapes in ffr drives (i.e. EXB2200 in EXB5000).
+
+ Rev 1.4 12 Mar 1993 14:13:50 DON
+Changed F40_SeekEOD so it will call the ui with new message TF_FAST_SEEK_EOD
+
+ Rev 1.3 10 Mar 1993 16:03:52 DON
+EndVStream copying to hold buffer instead of buffer
+
+ Rev 1.2 09 Mar 1993 18:16:30 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.1 30 Jan 1993 11:44:00 DON
+Removed compiler warnings
+
+ Rev 1.0 27 Jan 1993 14:37:38 GREGG
+Half of mayn40wt.c.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "stdtypes.h"
+#include "stdmacro.h"
+#include "fsys.h"
+#include "tbe_defs.h"
+#include "datetime.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "fmteng.h"
+#include "mayn40.h"
+#include "f40proto.h"
+#include "transutl.h"
+#include "tloc.h"
+#include "lw_data.h"
+#include "tfldefs.h"
+#include "lwprotos.h"
+#include "sx.h"
+#include "tfl_err.h"
+#include "minmax.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "tdemo.h"
+#include "dddefs.h"
+/* $end$ include list */
+
+/*
+ * Define the test OTC level here 0 == none, 1 == partial, 2 == full
+*/
+#define TEST_OTC_LEVEL 2
+
+/* Size required to pad to next logical block */
+#define PadToLBBoundary( x ) PadToBoundary( (x), F40_LB_SIZE )
+
+/* Adjusts offset to next 4 byte boundary */
+#define LongAlignOffset( x ) ( (x) += PadToBoundary( (x), 4 ) )
+
+
+/**/
+/**
+
+ Name: F40_SeekEOD
+
+ Description: Seeks to EOD and sets up to start an append operation
+ (load Set Map if there is one, and get last set number).
+
+ Returns: TFLE_xxx error or TF_NEED_NEW_TAPE
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 F40_SeekEOD( CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+ BOOLEAN expect_sm ;
+ BOOLEAN sm_exists ;
+ TPOS_PTR ui_tpos = channel->ui_tpos ;
+
+ /* First we need to make sure the drive has all the features required
+ to do a fast append. Note that in some cases the driver supports
+ block positioning, but not for the tape currently in the drive
+ (backward compatability mode). We can't tell this for sure, so we
+ have to make an assumtion that if there isn't a PBA in the SSET of
+ the first set, position info must not be available.
+ */
+ if( !SupportBlkPos( curDRV ) ||
+ !SupportFastEOD( curDRV ) ||
+ !SupportRevFmk( curDRV ) ||
+ cur_env->last_sset_pba == 0UL ) {
+
+ return( TFLE_INCOMPATIBLE_DRIVE ) ;
+ }
+
+ if( cur_env->cur_otc_level == TCL_NONE ) {
+ expect_sm = FALSE ;
+ } else {
+ expect_sm = TRUE ;
+ ret_val = OTC_OpenSM( cur_env, FALSE, &sm_exists ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ (*ui_tpos->UI_TapePosRoutine)( TF_FAST_SEEK_EOD, ui_tpos,
+ curDRV->vcb_valid, &curDRV->cur_vcb,
+ channel->mode ) ;
+
+ if( TpReadEndSet( drv_hdl, (INT16)0, (INT16)TO_EOD ) != SUCCESS ) {
+ ret_val = TFLE_DRIVER_FAILURE ;
+ } else {
+
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+ (*ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK,
+ ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ channel->mode ) ;
+ }
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( curDRV->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = OTC_GetPrevSM( channel, channel->cur_buff,
+ TRUE, expect_sm ) ;
+ }
+ }
+ }
+
+ if( expect_sm ) {
+ if( ret_val == TFLE_NO_ERR ) {
+ ClrPosBit( curDRV, AT_BOT ) ;
+ SetPosBit( curDRV, AT_EOD ) ;
+ OTC_Close( cur_env, OTC_CLOSE_SM, FALSE ) ;
+ } else {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ }
+ }
+
+ /* This is a really stupid little kludge, but in the case where we
+ are at EOD because we did a read or OTC operation then WriteInit
+ will call GetPrevSM and it will be expected to bump the bs_num,
+ so GetPrevSM sets bs_num to one greater than the last set. However,
+ in this case, we are being called by PositionAtSet (no, we're not
+ supposed to know that ... so what's your point?!?) and PositionAtSet,
+ in it's constant attempt to do everything for everyone, is going to
+ bump the bs_num itself. So, here we decrement bs_num to couteract
+ PositionAtSet's increment. (I don't want to hear it!!!)
+ */
+ if( ret_val == TFLE_NO_ERR ) {
+ channel->bs_num-- ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: F40_ParseWrittenBufer
+
+ Description: Parses the return buffer from the driver to keep track
+ of the last DDB, FDB and Stream which successfully made
+ it to tape. This information is used during EOM
+ processing.
+
+ Returns: Nothing
+
+ Notes: It is possible for a stream header to be only partially
+ written to tape for one of two reasons:
+
+ 1. It crosses buffer boundaries
+ 2. It crosses tape boundaries
+
+ In both cases the portion of the stream that made it to
+ tape is written into 'eom_stream', and 'pstream_crosses'
+ is set to TRUE to indicate this. If the first case is
+ true, the next buffer we see will have the remainder of
+ the header at the front. We complete the 'eom_stream',
+ and clear the flag. In the second case, F40_WtContTape
+ will handle "rebuilding" the crossing stream on the
+ continuation tape, but leave the flag set as the next
+ buffer we will see will start at the point where we left
+ off with this one (i.e. the first thing in it will be
+ the rest of the stream header) and we will handle it in
+ the same manner as the first case, just in case this
+ same stream crosses the next EOM (never say never).
+
+**/
+VOID F40_ParseWrittenBuffer(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16 written )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)channel->fmt_env ;
+ INT num = (INT)BM_NoDblks( buffer ) ;
+ DBLKMAP_PTR dmap = (DBLKMAP_PTR)BM_AuxBase( buffer ) ;
+ BOOLEAN got_ddb = FALSE ;
+ BOOLEAN got_fdb = FALSE ;
+ BOOLEAN got_strm = FALSE ;
+ BOOLEAN blk_proc = FALSE ;
+ UINT16 rem_strm = 0 ;
+ INT i ;
+ UINT64 data ;
+ BOOLEAN stat ;
+
+ if( written == 0 ) { /* This little bugger case just doesn't fit in! */
+ return ;
+ }
+
+ if( cur_env->pstream_crosses ) {
+ rem_strm = sizeof( MTF_STREAM ) - cur_env->pstream_offset ;
+ memcpy( (UINT8_PTR)( &cur_env->eom_stream ) +
+ cur_env->pstream_offset,
+ BM_XferBase( buffer ), rem_strm ) ;
+ cur_env->pstream_offset = 0 ;
+ cur_env->pstream_crosses = FALSE ;
+ }
+
+ for( i = num - 1; i >= 0 && !got_ddb; i-- ) {
+
+ if( dmap[i].blk_offset >= written ) {
+ continue ;
+ }
+
+ switch( dmap[i].blk_type ) {
+
+ case BT_FDB:
+ if( !got_fdb ) {
+ got_fdb = TRUE ;
+ memcpy( channel->lst_osfdb,
+ (UINT8_PTR)BM_XferBase( buffer ) +
+ dmap[i].blk_offset, (int)F40_LB_SIZE ) ;
+ cur_env->eom_file_id =
+ ((MTF_FILE_PTR)channel->lst_osfdb)->file_id ;
+ ClrChannelStatus( channel, CH_FDB_DBLK ) ;
+ channel->lst_tblk = dmap[i].blk_type ;
+ }
+ break ;
+
+ case BT_DDB:
+ got_ddb = TRUE ;
+ memcpy( channel->lst_osddb, (UINT8_PTR)BM_XferBase( buffer ) +
+ dmap[i].blk_offset, (int)F40_LB_SIZE ) ;
+ cur_env->eom_dir_id =
+ ((MTF_DIR_PTR)channel->lst_osddb)->directory_id ;
+ ClrChannelStatus( channel, CH_DDB_DBLK ) ;
+ if( !got_fdb ) {
+ channel->lst_tblk = dmap[i].blk_type ;
+ }
+ break ;
+
+ case BT_STREAM:
+ if( !got_strm && !got_fdb ) {
+ got_strm = TRUE ;
+ if( written - dmap[i].blk_offset < sizeof( MTF_STREAM ) ) {
+ cur_env->pstream_offset = written - dmap[i].blk_offset ;
+ memcpy( &cur_env->eom_stream,
+ (UINT8_PTR)BM_XferBase( buffer ) +
+ dmap[i].blk_offset, cur_env->pstream_offset ) ;
+ cur_env->pstream_crosses = TRUE ;
+ } else {
+ memcpy( &cur_env->eom_stream,
+ (UINT8_PTR)BM_XferBase( buffer ) +
+ dmap[i].blk_offset, sizeof( MTF_STREAM ) ) ;
+ data = U32_To_U64( (UINT32)( written -
+ ( dmap[i].blk_offset +
+ sizeof( MTF_STREAM ) ) ) ) ;
+ cur_env->eom_stream.data_length =
+ U64_Sub( cur_env->eom_stream.data_length,
+ data, &stat ) ;
+ }
+ }
+ break ;
+
+ case BT_VCB:
+ /* There is only one of these, and we have already copied it
+ to lst_osvcb.
+ */
+ channel->lst_tblk = dmap[i].blk_type ;
+ break ;
+
+ default:
+ /* I guess we'll just let this slide once the msassert goes
+ away (release code). It should NEVER, EVER, EVER HAPPEN!!!
+ */
+ msassert( FALSE ) ;
+ continue ;
+ }
+
+ if( !blk_proc ) {
+ blk_proc = TRUE ;
+ }
+ }
+
+ if( !blk_proc ) {
+ cur_env->eom_stream.data_length =
+ U64_Sub( cur_env->eom_stream.data_length,
+ U32_To_U64( (UINT32)( written - rem_strm ) ),
+ &stat ) ;
+ } else {
+ cur_env->stream_at_eom = got_strm ;
+ }
+}
+
+
+/**/
+/**
+
+ Name: F40_CalcChecksum
+
+ Description: This routine will calculate the checksum for
+ 'Length' words starting at location pointed
+ to by "StartPtr". This routine supports both INTEL
+ and MOTOROLA byte ordering as byte order is unimportant.
+
+ Returns: result of checksum
+
+ Notes:
+
+ Declaration:
+
+**/
+UINT16 F40_CalcChecksum(
+ UINT16_PTR StartPtr,
+ UINT16 Length )
+{
+ UINT16 resultSoFar = INTERIM_CHECKSUM_BASE ;
+
+ while( Length-- ) {
+ resultSoFar ^= *StartPtr++ ;
+ }
+
+ return( resultSoFar ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtCloseSet
+
+ Description: This writes an ESET for the given backup set. The
+ cur_drv pointer in the channel must be valid. Also,
+ the "lst_osvcb" field in the channel must contain a
+ valid SSET DBLK.
+
+ In the presence of OTC it will write a FILE MARK, ESET,
+ { { F/DD } SM ESET } FILE MARK. If EOM is encountered
+ during this process it is handled internally.
+
+ There is an assumption that if we return with the EOM
+ Pos Bit set we will get called back once a continuation
+ tape has been inserted.
+
+ We use the VCB buffer here to insure that OTC will have
+ a buffer to use.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 F40_WtCloseSet(
+ CHANNEL_PTR channel,
+ BOOLEAN abort )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ RET_BUF myret ;
+ MTF_ESET_PTR cur_eset ;
+ BUF_PTR tmpBUF ;
+ INT16 ret_val ;
+
+ /* Write Ending OTC FDD entry */
+ if( cur_env->cur_otc_level == TCL_FULL &&
+ !cur_env->end_set_continuing &&
+ !cur_env->fdd_aborted ) {
+
+ if( abort ) {
+ if( ( ret_val = OTC_MarkLastEntryCorrupt( cur_env ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ return( ret_val ) ;
+ }
+ }
+ if( !cur_env->fdd_aborted ) {
+ if( ( ret_val = OTC_GenEndEntry( channel ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ return( ret_val ) ;
+ }
+ }
+ }
+
+ /* drop a filemark */
+ if( ( ret_val = WriteEndSet( curDRV ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ return( ret_val ) ;
+ }
+
+ /* if we hit EOM writing the filemark, we don't even start end set
+ processing. We just write the EOTM, and make this look like the
+ case where EOM is encountered at the end of the set data.
+ */
+ if( IsPosBitSet( curDRV, ( AT_EOM ) ) ) {
+
+ SetChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ cur_env->end_set_continuing = TRUE ;
+
+ /* set the flag to tell CloseTape not to write the first filemark */
+ cur_env->eotm_no_first_fmk = TRUE ;
+
+ if( ( ret_val = F40_WtCloseTape( channel ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ }
+ cur_env->eotm_no_first_fmk = FALSE ;
+ return( ret_val ) ;
+ }
+
+ /* Get base address for calculating OTC and ESET addresses. */
+ if( SupportBlkPos( curDRV ) ) {
+
+ DRIVER_CALL( drv_hdl, TpGetPosition( drv_hdl, FALSE ), myret,
+ GEN_NO_ERR, GEN_NO_ERR,
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) )
+ } else {
+ curDRV->cur_pos.pba_vcb = 0 ;
+ }
+ cur_env->eset_base_addr = myret.misc ;
+
+
+ /* Get a buffer */
+ tmpBUF = BM_GetVCBBuff( &channel->buffer_list ) ;
+
+ /* Generate the ESET */
+ cur_eset = (MTF_ESET_PTR)( BM_NextBytePtr( tmpBUF ) ) ;
+ channel->cur_dblk = (DBLK_PTR)channel->lst_osvcb ;
+ F40_WtESET( channel, tmpBUF, cur_env->end_set_continuing, abort ) ;
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), BM_NextByteOffset( tmpBUF ) ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM,
+ { BM_Put( tmpBUF ) ; OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ; } )
+
+ cur_env->eset_base_addr += BM_NextByteOffset( tmpBUF ) / ChannelBlkSize( channel ) ;
+
+ if( myret.gen_error == GEN_ERR_EOM ) {
+
+ SetChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ cur_env->end_set_continuing = TRUE ;
+
+ SetPosBit( curDRV, ( AT_EOM | TAPE_FULL ) ) ;
+ if( myret.len_req != myret.len_got ) {
+ BM_SetNextByteOffset( tmpBUF, (UINT16)myret.len_got ) ;
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_NextBytePtr( tmpBUF ), myret.len_req - myret.len_got ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM,
+ { BM_Put( tmpBUF ) ; OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ; } )
+ }
+ BM_Put( tmpBUF ) ;
+ if( ( ret_val = F40_WtCloseTape( channel ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ }
+ return( ret_val ) ;
+ }
+
+ if( cur_env->cur_otc_level != TCL_NONE ) {
+
+ /* Write the catalog info to tape. Note that the physical
+ block addresses and tape sequence numbers of the start of
+ the SM and FDD will be filled in by this function.
+ */
+ if( ( ret_val = OTC_WriteCat( channel, cur_eset ) ) != TFLE_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+
+ if( IsPosBitSet( curDRV, AT_EOM ) ) {
+ BM_Put( tmpBUF ) ;
+ SetChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ cur_env->end_set_continuing = TRUE ;
+ if( ( ret_val = F40_WtCloseTape( channel ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ }
+ return( ret_val ) ;
+ }
+
+ /* Save the PBA in the environment (for EOM processing) */
+ cur_env->eset_pba = cur_env->eset_base_addr ;
+
+ /* Write the second ESET */
+ /*
+ NOTE: tmpBUF still holds the first ESET, and the PBA of the
+ FDD and SM are now filled in. Here we check to see
+ if the FDD or SM aborted bits need to be set. We also
+ need to check the offset_to_data. The first ESETs
+ offset is the physical block size of the device. The
+ second ESET offset must be at least Logical Block
+ Size. So the first one could be 512, and we need to
+ adjust this for the second.
+ */
+ if( cur_env->fdd_aborted ) {
+ cur_eset->block_hdr.block_attribs |= MTF_DB_FDD_ABORTED_BIT ;
+ }
+ if( cur_env->sm_aborted ) {
+ cur_eset->block_hdr.block_attribs |= MTF_DB_END_OF_FAMILY_BIT ;
+ }
+ if( BM_NextByteOffset( tmpBUF ) < F40_LB_SIZE ) {
+ BM_SetNextByteOffset( tmpBUF, F40_LB_SIZE ) ;
+ cur_eset->block_hdr.offset_to_data = BM_NextByteOffset( tmpBUF ) ;
+ }
+ /* Calculate the Header Check Sum */
+ cur_eset->block_hdr.hdr_chksm =
+ F40_CalcChecksum( (UINT16_PTR)cur_eset, F40_HDR_CHKSUM_LEN ) ;
+
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), BM_NextByteOffset( tmpBUF ) ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM,
+ { BM_Put( tmpBUF ) ;
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ; } )
+
+ if( myret.gen_error == GEN_ERR_EOM ) {
+ cur_env->sm_continuing = TRUE ;
+ SetChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ cur_env->end_set_continuing = TRUE ;
+ SetPosBit( curDRV, ( AT_EOM | TAPE_FULL ) ) ;
+ if( myret.len_req != myret.len_got ) {
+ BM_SetNextByteOffset( tmpBUF, (UINT16)myret.len_got ) ;
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_NextBytePtr( tmpBUF ), myret.len_req - myret.len_got ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM,
+ { BM_Put( tmpBUF ) ;
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ; } )
+ }
+ BM_Put( tmpBUF ) ;
+ if( ( ret_val = F40_WtCloseTape( channel ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ }
+ return( ret_val ) ;
+ }
+ }
+
+ /* drop a filemark */
+ if( ( ret_val = WriteEndSet( curDRV ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+
+ BM_Put( tmpBUF ) ;
+ if( IsPosBitSet( curDRV, ( AT_EOM ) ) ) {
+
+ SetChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ cur_env->end_set_continuing = TRUE ;
+ if( cur_env->cur_otc_level != TCL_NONE ) {
+ cur_env->sm_continuing = TRUE ;
+ }
+
+ /* set the flag to tell CloseTape not to write the first filemark */
+ cur_env->eotm_no_first_fmk = TRUE ;
+ if( ( ret_val = F40_WtCloseTape( channel ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ }
+ cur_env->eotm_no_first_fmk = FALSE ;
+ return( ret_val ) ;
+ }
+
+ OTC_Close( cur_env, OTC_CLOSE_SM, FALSE ) ;
+
+ /* If the drive supports hardware compression we need to keep it in
+ uncompressed mode unless we're actually writing a compressed set.
+ This is a work-around for a firmware bug in early Archive DAT DC
+ drives.
+ */
+ if( curDRV->thw_inf.drv_info.drv_features & TDI_DRV_COMPRESSION ) {
+ if( TpSpecial( drv_hdl, SS_SET_DRV_COMPRESSION,
+ DISABLE_DRV_COMPRESSION ) != SUCCESS ) {
+
+ return( TFLE_DRIVE_FAILURE ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtCloseTape
+
+ Description: Writes an EOTM on the tape.
+
+ Returns: An error code if an error occurred.
+
+ Notes: THE DRIVE MUST BE IN SINGLE STEP MODE BEFORE CALLING
+ THIS FUNCTION.
+
+**/
+INT16 F40_WtCloseTape(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ RET_BUF myret ;
+ MTF_EOTM_PTR cur_eotm ;
+ MTF_DB_HDR_PTR cur_hdr ;
+ BUF_PTR tmpBUF ;
+ UINT16 offset ;
+ INT16 ret_val ;
+ UINT16 temp_os_id ;
+ UINT16 temp_os_ver ;
+
+ if( ! cur_env->eotm_no_first_fmk ) {
+ /* drop a filemark */
+ if( ( ret_val = WriteEndSet( curDRV ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+
+ /* Get a buffer */
+ tmpBUF = BM_GetVCBBuff( &channel->buffer_list ) ;
+
+ cur_eotm = (MTF_EOTM_PTR)( BM_XferBase( tmpBUF ) ) ;
+ cur_hdr = (MTF_DB_HDR_PTR)cur_eotm ;
+
+ channel->cur_dblk = (DBLK_PTR)channel->lst_osvcb ; /* GRH - Why is this here!?! Just for call to SetupDBHeader??? See if it can go away!!! */
+ offset = sizeof( MTF_EOTM ) ;
+
+ /* Here we do our own version of SetupDBHeader that does only what
+ we need, and not all the extranious stuff.
+ */
+
+ F40_SetBlkType( cur_hdr, MTF_EOTM_N ) ;
+
+ (VOID)FS_GetOSid_verFromDBLK( channel->cur_fsys, channel->cur_dblk, &temp_os_id, &temp_os_ver ) ;
+
+ cur_hdr->machine_os_id = (UINT8)temp_os_id;
+ cur_hdr->machine_os_version = (UINT8)temp_os_ver ;
+ cur_hdr->logical_block_address = U64_Init( 0L, 0L ) ;
+ cur_hdr->os_specific_data.data_offset = 0 ;
+ cur_hdr->os_specific_data.data_size = 0 ;
+ cur_hdr->session_id = U64_Init( 0L, 0L ) ;
+ cur_hdr->displayable_size = U64_Init( 0L, 0L ) ;
+ cur_hdr->string_type = (UINT8)FS_GetStringTypes( channel->cur_fsys ) ;
+ cur_hdr->block_attribs = 0L ;
+
+ offset += (UINT16)PadToLBBoundary( offset ) ;
+ offset += PadToBoundary( offset, ChannelBlkSize( channel ) ) ;
+
+ /* If we're doing OTC, set PBA of the second ESET of the last set
+ completed on this tape. If not doing OTC or no set was completed
+ on this tape, set block attributes to indicate this.
+ */
+ cur_eotm->eset_phys_blk_adr = U64_Init( cur_env->eset_pba, 0L ) ;
+ if( cur_env->cur_otc_level != TCL_NONE ) {
+ if( cur_env->eset_pba == 0L ) {
+ cur_eotm->block_hdr.block_attribs |= MTF_DB_NO_ESET_PBA ;
+ }
+ } else {
+ cur_eotm->block_hdr.block_attribs |= MTF_DB_INVALID_ESET_PBA ;
+ }
+
+ cur_eotm->block_hdr.hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_eotm, F40_HDR_CHKSUM_LEN ) ;
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), (UINT32)offset ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM, BM_Put( tmpBUF ) )
+
+ BM_Put( tmpBUF ) ;
+
+ /* drop a filemark */
+ ret_val = WriteEndSet( curDRV ) ;
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtContTape
+
+ Description: Writes the continuation info for a given tape.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 F40_WtContTape(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+ BUF_PTR tmpBUF ;
+ UINT32 eom_id ;
+ MTF_DB_HDR_PTR cur_hdr ;
+ UINT16 num_lbs ;
+ UINT16 offset ;
+ UINT16 end_db_offset ;
+ UINT16 strm_hdr_size ;
+ UINT16 blk_size = MAX( (UINT16)F40_LB_SIZE, ChannelBlkSize( channel ) ) ;
+ INT16 ret_val ;
+
+ if( cur_env->cur_otc_level == TCL_FULL && !cur_env->fdd_aborted &&
+ !IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+
+ if( ( ret_val = OTC_PreprocessEOM( cur_env, channel->eom_lba ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+
+ if( !cur_env->end_set_continuing ) {
+ cur_env->sm_count++ ;
+ }
+
+ /* Get a buffer */
+ tmpBUF = BM_GetVCBBuff( &channel->buffer_list ) ;
+
+ channel->cur_dblk = (DBLK_PTR)channel->lst_osvcb ;
+
+ /* In this first pass, we will write all the continuation DBLKs
+ to the buffer, then we will make a second pass adjusting their
+ LBAs.
+ */
+
+ eom_id = channel->eom_id ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( channel->cur_dblk ) ;
+
+ /* This will write the tape header and put the SSET and VOLB blocks
+ in the buffer.
+ */
+ if( ( ret_val = F40_WtSSET( channel, tmpBUF, TRUE ) ) != TFLE_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+
+ if( channel->lst_tblk != BT_VCB &&
+ !IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+
+ if( channel->lst_tblk == BT_IDB ) {
+ channel->cur_dblk = (DBLK_PTR)channel->lst_osfdb ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( channel->cur_dblk ) ;
+ if( ( ret_val = F40_WtIMAG( channel, tmpBUF, TRUE ) ) != TFLE_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+ } else {
+ channel->cur_dblk = (DBLK_PTR)channel->lst_osddb ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( channel->cur_dblk ) ;
+ if( ( ret_val = F40_WtDIRB( channel, tmpBUF, TRUE ) ) != TFLE_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+ if( channel->lst_tblk == BT_FDB ) {
+
+ channel->cur_dblk = (DBLK_PTR)channel->lst_osfdb ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( channel->cur_dblk ) ;
+ if( ( ret_val = F40_WtFILE( channel, tmpBUF, TRUE ) ) != TFLE_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+ }
+ }
+ }
+
+ /* This is pass 2, adjusting the LBAs */
+ offset = BM_NextByteOffset( tmpBUF ) ;
+ offset += PadToBoundary( offset, blk_size ) ;
+ num_lbs = (UINT16)( offset / F40_LB_SIZE ) ;
+ offset = BM_NextByteOffset( tmpBUF ) ;
+ BM_SetNextByteOffset( tmpBUF, (UINT16)0 ) ;
+ do {
+ cur_hdr = (MTF_DB_HDR_PTR)BM_NextBytePtr( tmpBUF ) ;
+ cur_hdr->logical_block_address = U64_Init( ( channel->eom_lba - num_lbs ), 0L ) ;
+ cur_hdr->hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN ) ;
+ num_lbs -= ( UINT16 ) cur_hdr->offset_to_data / ( UINT16 ) F40_LB_SIZE ;
+ BM_UpdCnts( tmpBUF, cur_hdr->offset_to_data ) ;
+
+ /* Set the LBA in the DBLK */
+ switch( F40_GetBlkType( cur_hdr ) ) {
+
+ case F40_SSET_IDI :
+ FS_SetLBAinDBLK( (DBLK_PTR)channel->lst_osvcb,
+ U64_Lsw( cur_hdr->logical_block_address ) ) ;
+
+ /* Fix for the app not knowing the LBA for a continuation VCB */
+ channel->cross_set = FS_ViewBSNumInVCB( channel->lst_osvcb ) ;
+ channel->cross_lba = U64_Lsw( cur_hdr->logical_block_address ) ;
+
+ break ;
+
+ case F40_VOLB_IDI :
+ break ;
+
+ case F40_DIRB_IDI :
+ FS_SetLBAinDBLK( (DBLK_PTR)channel->lst_osddb,
+ U64_Lsw( cur_hdr->logical_block_address ) ) ;
+ break ;
+
+ case F40_FILE_IDI :
+ case F40_IMAG_IDI :
+ FS_SetLBAinDBLK( (DBLK_PTR)channel->lst_osfdb,
+ U64_Lsw( cur_hdr->logical_block_address ) ) ;
+ break ;
+
+ default :
+ /* This is a yucky little fix for the fact that GetBlkType
+ now returns UDB for the VOLB block because we need to
+ skip VOLBs if there are multiple ones in a single set.
+ */
+
+ /* DO NOT UNICODEIZE THE FOLLOWING CONSTANT!!! */
+ if( memcmp( cur_hdr->block_type, "VOLB", 4 ) != 0 ) {
+ msassert( FALSE ) ;
+ BM_Put( tmpBUF ) ;
+ return( TFLE_TRANSLATION_FAILURE ) ;
+ }
+ }
+
+ } while( BM_NextByteOffset( tmpBUF ) != offset ) ;
+
+ cur_hdr->offset_to_data += PadToBoundary( offset, blk_size ) ;
+ offset += PadToBoundary( offset, blk_size ) ;
+
+ if( cur_env->stream_at_eom &&
+ U64_NE( cur_env->eom_stream.data_length, lw_UINT64_ZERO ) ) {
+
+ if( cur_env->pstream_crosses ) {
+ strm_hdr_size = cur_env->pstream_offset ;
+ } else {
+ strm_hdr_size = sizeof( MTF_STREAM ) ;
+ cur_env->eom_stream.tf_attribs |= STREAM_CONTINUE ;
+ cur_env->eom_stream.chksum =
+ F40_CalcChecksum( (UINT16_PTR)&cur_env->eom_stream,
+ F40_STREAM_CHKSUM_LEN ) ;
+ }
+
+ end_db_offset = cur_hdr->os_specific_data.data_offset +
+ cur_hdr->os_specific_data.data_size ;
+ LongAlignOffset( end_db_offset ) ;
+ if( cur_hdr->offset_to_data - end_db_offset < strm_hdr_size ) {
+ cur_hdr->offset_to_data += blk_size ;
+ offset += blk_size ;
+ }
+ cur_hdr->offset_to_data -= strm_hdr_size ;
+ memcpy( (UINT8_PTR)cur_hdr + cur_hdr->offset_to_data,
+ &cur_env->eom_stream, strm_hdr_size ) ;
+ }
+
+ cur_hdr->hdr_chksm = F40_CalcChecksum( (UINT16_PTR)cur_hdr, F40_HDR_CHKSUM_LEN ) ;
+
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, (UINT8_PTR)BM_XferBase( tmpBUF ), (UINT32)offset ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, BM_Put( tmpBUF ) )
+
+ /* Back to normal */
+ channel->eom_id = eom_id ;
+ BM_Put( tmpBUF ) ;
+
+ if( cur_env->cur_otc_level != TCL_NONE && !cur_env->sm_aborted ) {
+ if( ( ret_val = OTC_PostprocessEOM( channel, channel->cross_lba ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtContVStream
+
+ Description: Writes a copy of the current variable length stream
+ header to the buffer.
+
+ Returns: TFLE_xxx error code.
+
+ Notes: If the stream is variable, we write it in chunks, with
+ stream headers in front of each chunk. The first
+ chunk is written by F40_WtStream, then subsequent
+ chunks are written by this function. The size provided
+ in the stream info is zero for variable length streams,
+ but the actual stream header must contain the size of
+ the chunk. Therefore, the data_length field is set to
+ the number of bytes remaining in the buffer. See
+ F40_WtEndVStream for details on how the data_length
+ field is adjusted when we reach the end of the data
+ stream.
+
+ There is an assumption made in this function that we
+ have the full buffer to play with, since chunk sizes
+ are always based on the total remaining space in the
+ current buffer, only the first header written by
+ F40_WtStream would ever be written at points other than
+ the front of the buffer.
+
+**/
+INT16 F40_WtContVStream(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)channel->fmt_env ;
+ BOOLEAN status ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* This may have been set by WtStream to indicate to EndVStream that
+ the stream header crossed a tape boundary. This header obviously
+ doesn't cross buffers, so we clear the flag.
+ */
+ cur_env->stream_crosses = FALSE ;
+
+ cur_env->cur_stream.data_length =
+ U64_Init( BM_XferSize( buffer ) - sizeof( MTF_STREAM ), 0L ) ;
+ cur_env->cur_stream.chksum =
+ F40_CalcChecksum( (UINT16_PTR)&cur_env->cur_stream,
+ F40_STREAM_CHKSUM_LEN ) ;
+ memcpy( BM_XferBase( buffer ), &cur_env->cur_stream, sizeof( MTF_STREAM ) ) ;
+ BM_UpdCnts( buffer, sizeof( MTF_STREAM ) ) ;
+
+ channel->current_stream.size = cur_env->cur_stream.data_length ;
+ cur_env->var_stream_offset = 0L ;
+ cur_env->used_so_far = U64_Add( cur_env->used_so_far,
+ U64_Init( sizeof( MTF_STREAM ), 0L ), &status ) ;
+ cur_env->used_so_far = U64_Add( cur_env->used_so_far,
+ cur_env->cur_stream.data_length, &status ) ;
+
+ /* Setup DBLK map */
+ if( ( ret_val = GetDBLKMapStorage( channel, buffer ) ) == TFLE_NO_ERR ) {
+ BM_IncNoDblks( buffer ) ;
+ channel->map_entry->blk_offset = 0 ;
+ channel->map_entry->blk_type = BT_STREAM ;
+ channel->map_entry->blk_data = cur_env->cur_stream.data_length ;
+ }
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtEndVStream
+
+ Description: Rewrites the last variable stream header as a variable
+ stream ending header.
+
+ Returns: Nothing
+
+ Notes: If the stream is variable, we write it in chunks, with
+ stream headers in front of each chunk. When each
+ header is written, the data_length field is set to the
+ number of bytes remaining in the buffer. When the end
+ of the stream is reached, this function is called with
+ 'used' set to the portion of the last chunk which was
+ actually filled with data. This function backs up to
+ the last stream header written to the buffer (located
+ with 'var_stream_offset'), and changes the attributes
+ to indicate this is the last chunk for this stream.
+
+ If the flag 'stream_crosses' in the environment is TRUE,
+ then the stream header spans from the end of the buffer
+ pointed to by 'channel->hold_buff' to the front of the
+ buffer passed in, and this must be dealt with in
+ rewriting the stream header.
+
+**/
+VOID F40_WtEndVStream(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16 used )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)channel->fmt_env ;
+ UINT64 used_64 = U64_Init( (UINT32)used, 0L ) ;
+ UINT64 diff ;
+ BOOLEAN status ;
+
+ cur_env->cur_stream.tf_attribs |= STREAM_VAR_END ;
+ cur_env->cur_stream.tf_attribs &= ~STREAM_VARIABLE ;
+ channel->current_stream.tf_attrib &= ~STREAM_VARIABLE ;
+
+ diff = U64_Sub( cur_env->cur_stream.data_length, used_64, &status ) ;
+ cur_env->used_so_far = U64_Sub( cur_env->used_so_far, diff, &status ) ;
+
+ channel->map_entry->blk_data = cur_env->cur_stream.data_length = used_64 ;
+ cur_env->cur_stream.chksum =
+ F40_CalcChecksum( (UINT16_PTR)&cur_env->cur_stream,
+ F40_STREAM_CHKSUM_LEN ) ;
+ if( cur_env->stream_crosses ) {
+ cur_env->stream_crosses = FALSE ;
+ memcpy( (UINT8_PTR)BM_XferBase( channel->hold_buff ) +
+ cur_env->var_stream_offset, &cur_env->cur_stream,
+ cur_env->stream_offset ) ;
+ memcpy( BM_XferBase( buffer ),
+ (UINT8_PTR)&cur_env->cur_stream + cur_env->stream_offset,
+ sizeof( MTF_STREAM ) - cur_env->stream_offset ) ;
+
+ } else {
+ memcpy( (UINT8_PTR)BM_XferBase( buffer ) +
+ cur_env->var_stream_offset, &cur_env->cur_stream,
+ sizeof( MTF_STREAM ) ) ;
+ }
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_WtStream
+
+ Description: Writes a stream header into the buffer.
+
+ Returns: TFLE_xxx error code or NEED_NEW_BUFFER if there isn't
+ room to complete the stream header in the current buffer.
+
+ Notes: If the stream is variable, we write it in chunks, with
+ stream headers in front of each chunk. This function
+ writes the first chunk, then subsequent chunks are
+ written by F40_WtContVStream. The size provided in the
+ stream info is zero for variable length streams, but
+ the actual stream header must contain the size of the
+ chunk. Therefore, the data_length field is set to the
+ number of bytes remaining in the buffer. See
+ F40_WtEndVStream for details on how the data_length
+ field is adjusted when we reach the end of the data
+ stream.
+
+**/
+
+INT16 F40_WtStream(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ STREAM_INFO_PTR new_stream )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)channel->fmt_env ;
+ BOOLEAN status ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ UINT16 pad ;
+ UINT16 rem_strm ;
+
+ /* If stream_crosses is TRUE, we are being called back to fill out the
+ rest of a stream we started in the last buffer. Otherwise we need
+ to initialize the basic fields for the stream header.
+ */
+ if( !cur_env->stream_crosses ) {
+ /* Pad to align stream on four byte boundary (format spec). */
+ pad = PadToBoundary( BM_NextByteOffset( buffer ), 4 ) ;
+ cur_env->used_so_far = U64_Add( U64_Init( (UINT32)pad, 0L ),
+ cur_env->used_so_far, &status ) ;
+ BM_UpdCnts( buffer, pad ) ;
+
+ /* If we don't even have room to start a new stream header, there
+ isn't any point in setting anything up. So we return failure
+ now to force a call-back as if we'd never been called at all.
+ */
+ if( BM_BytesFree( buffer ) == 0 ) {
+ return( NEED_NEW_BUFFER ) ;
+ }
+
+ cur_env->cur_stream.id = new_stream->id ;
+ cur_env->cur_stream.fs_attribs = new_stream->fs_attrib ;
+ cur_env->cur_stream.tf_attribs = new_stream->tf_attrib ;
+ cur_env->cur_stream.data_length = new_stream->size ;
+ cur_env->cur_stream.encr_algor = 0 ;
+ cur_env->cur_stream.comp_algor = 0 ;
+
+ /* Setup DBLK map */
+ if( ( ret_val = GetDBLKMapStorage( channel, buffer ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ BM_IncNoDblks( buffer ) ;
+ channel->map_entry->blk_offset = BM_NextByteOffset( buffer ) ;
+ channel->map_entry->blk_type = BT_STREAM ;
+ channel->map_entry->blk_data = new_stream->size ;
+ }
+
+ /* One of three thing is true at this point:
+
+ 1. We're being called back to finish a stream header we started in
+ the last buffer.
+ 2. This is the first time called for this stream header, but we
+ don't have room to write it and will have to be called back.
+ 3. This is the first time called, and we have room (general case).
+ */
+ if( cur_env->stream_crosses ) {
+
+ /* Case 1:
+
+ We need to write the remainder of the stream at the front of
+ the new buffer. If this is a variable length stream, we need
+ to fill in the data_length field, because it could not be
+ determined until we got the new buffer (see note in header for
+ explanation). This means we also have to calculate the
+ checksum, and write the first half of the stream header
+ to the end of the previous buffer which is being held in
+ channel->hold_buff. Note that if the stream isn't variable
+ we clear the stream_crosses flag immediatly, otherwise we leave
+ it set in case have to rewrite the stream header as an "end
+ variable stream" (see the function F40_EndVBLK for further
+ details).
+ */
+ rem_strm = sizeof( MTF_STREAM ) - cur_env->stream_offset ;
+
+ if( cur_env->cur_stream.tf_attribs & STREAM_VARIABLE ) {
+ cur_env->cur_stream.data_length =
+ U64_Init( BM_BytesFree( buffer ) -
+ rem_strm, 0L ) ;
+ channel->map_entry->blk_data = new_stream->size =
+ cur_env->cur_stream.data_length ;
+ cur_env->cur_stream.chksum =
+ F40_CalcChecksum( (UINT16_PTR)&cur_env->cur_stream,
+ F40_STREAM_CHKSUM_LEN ) ;
+ memcpy( BM_NextBytePtr( channel->hold_buff ),
+ &cur_env->cur_stream, cur_env->stream_offset ) ;
+ BM_UpdCnts( channel->hold_buff, cur_env->stream_offset ) ;
+
+ } else {
+ cur_env->stream_crosses = FALSE ;
+ }
+
+ memcpy( BM_XferBase( buffer ), (UINT8_PTR)&cur_env->cur_stream +
+ cur_env->stream_offset, rem_strm ) ;
+ BM_UpdCnts( buffer, rem_strm ) ;
+
+ cur_env->used_so_far = U64_Add( U64_Init( sizeof( MTF_STREAM ), 0L ),
+ cur_env->used_so_far, &status ) ;
+ cur_env->used_so_far = U64_Add( cur_env->used_so_far,
+ cur_env->cur_stream.data_length,
+ &status ) ;
+
+ } else if( BM_BytesFree( buffer ) < sizeof( MTF_STREAM ) ) {
+
+ /* Case 2:
+
+ If the stream is variable, we don't know what value goes in
+ the data_length (see note in header for explanation), so there's
+ no point in writing anything. We point channel->hold_buff at
+ the buffer so the caller won't send it off to tape. This way
+ we can fill it in when we are called back. This buffer is then
+ held on to until we are certain that we don't have to rewrite
+ the stream header as an "end variable stream" (see the function
+ F40_EndVBLK for further details).
+ If the stream isn't variable, we fill it out in full, and
+ write as much as we can fit at the end of the buffer. The
+ caller is free to send this buffer off to tape immediatly.
+ In both cases, we set the stream_crosses flag to remember
+ we're being called back, and return FAILURE so the caller will
+ call us back with a fresh buffer.
+ */
+ ret_val = NEED_NEW_BUFFER ;
+ cur_env->stream_offset = BM_BytesFree( buffer ) ;
+ cur_env->stream_crosses = TRUE ;
+
+ if( cur_env->cur_stream.tf_attribs & STREAM_VARIABLE ) {
+ channel->hold_buff = buffer ;
+ cur_env->var_stream_offset = BM_NextByteOffset( buffer ) ;
+
+ } else {
+ cur_env->cur_stream.chksum =
+ F40_CalcChecksum( (UINT16_PTR)&cur_env->cur_stream,
+ F40_STREAM_CHKSUM_LEN ) ;
+ memcpy( BM_NextBytePtr( buffer ), &cur_env->cur_stream,
+ cur_env->stream_offset ) ;
+ BM_UpdCnts( buffer, cur_env->stream_offset ) ;
+ }
+
+ } else {
+
+ /* Case 3:
+
+ This is the most common of the three cases. If the stream is
+ variable, we calculate the data_length (see note in header for
+ explanation), then we calculate the checksum, and copy the
+ header into the buffer.
+ */
+ if( cur_env->cur_stream.tf_attribs & STREAM_VARIABLE ) {
+ cur_env->cur_stream.data_length =
+ U64_Init( BM_BytesFree( buffer ) -
+ sizeof( MTF_STREAM ), 0L ) ;
+ channel->map_entry->blk_data = new_stream->size =
+ cur_env->cur_stream.data_length ;
+ cur_env->var_stream_offset = (UINT32)BM_NextByteOffset( buffer ) ;
+ }
+
+ cur_env->cur_stream.chksum =
+ F40_CalcChecksum( (UINT16_PTR)&cur_env->cur_stream,
+ F40_STREAM_CHKSUM_LEN ) ;
+ memcpy( BM_NextBytePtr( buffer ), &cur_env->cur_stream,
+ sizeof( MTF_STREAM ) ) ;
+ BM_UpdCnts( buffer, sizeof( MTF_STREAM ) ) ;
+
+ cur_env->used_so_far = U64_Add( U64_Init( sizeof( MTF_STREAM ), 0L ),
+ cur_env->used_so_far, &status ) ;
+ cur_env->used_so_far = U64_Add( cur_env->used_so_far,
+ cur_env->cur_stream.data_length,
+ &status ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_EndData
+
+ Description: Writes a pad stream header to the buffer and updates
+ the byte counts in the buffer to pad out to a logical
+ block boundary in preparation for writing the next DBLK.
+
+ Returns: TFLE_xxx error code or NEED_NEW_BUFFER if there isn't
+ room to complete the stream header in the current buffer.
+
+ Notes: It is possible that the amount of pad that is needed is
+ smaller than a stream header. In this case we add one
+ logical block size to the size of the pad. Since
+ buffer sizes are evenly divisable by the logical block
+ size, a pad stream will normally fit in the current
+ buffer, but in this special case, it is possible that
+ the pad stream header will cross buffer boundaries.
+ So we call F40_WtStream to write the pad stream, as it
+ is set up to deal with this whole mess.
+
+**/
+INT16 F40_EndData(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)channel->fmt_env ;
+ STREAM_INFO info ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ UINT16 offset ;
+
+ if( !cur_env->stream_crosses ) {
+ /* Pad to align stream on four byte boundary (format spec).
+ Note: F40_WtStream does this, but we do it first because if the
+ alignment puts us on a logical block boundary, we don't
+ need a pad stream.
+ */
+ offset = PadToBoundary( BM_NextByteOffset( buffer ), 4 ) ;
+ BM_UpdCnts( buffer, offset ) ;
+ cur_env->pad_size =
+ (UINT16)PadToLBBoundary( BM_NextByteOffset( buffer ) ) ;
+
+ /* Bump pad size if smaller than stream header. */
+ if( cur_env->pad_size != 0 && cur_env->pad_size < sizeof( MTF_STREAM ) ) {
+ cur_env->pad_size += F40_LB_SIZE ;
+ }
+ }
+
+ if( cur_env->pad_size != 0 ) {
+ info.id = STRM_PAD ;
+ info.fs_attrib = 0 ;
+ info.tf_attrib = 0 ;
+ info.size = U32_To_U64( (UINT32)( cur_env->pad_size -
+ sizeof( MTF_STREAM ) ) ) ;
+
+ /* Note that this will fail once at most, and when it succeeds
+ we are gaurenteed, by virtue of the fact that the buffer sizes
+ are evenly divisible by the logical block size, that the
+ actual "pad data" will all fit in this buffer.
+ */
+ if( ( ret_val = F40_WtStream( channel, buffer, &info ) ) == TFLE_NO_ERR ) {
+ BM_UpdCnts( buffer, (UINT16)( U64_Lsw( info.size ) ) ) ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+ Unit: Translators
+
+ Name: F40_SaveLclName
+
+ Description: Saves the passed string and length in the destination
+ passed as a pointer. Assumes that the initial
+ destination pointer and last_alloc_size are set to zero,
+ as they are with a global variable. This will allocate
+ a chunk of memory to hold the name and if needed later
+ will release this memory and allocate a bigger chunk for
+ larger strings.
+
+ Returns: INT16 - TFLE_xxx error for no memory or no error code.
+
+**/
+/*
+ The following define is used to specify the minimum memory to be allocated
+ for path and machine names etc.
+*/
+#define F40_MIN_ALLOC 1024
+#define F40_CHUNK 64
+
+INT16 F40_SaveLclName(
+ UINT8_PTR *dest_string,
+ UINT8_PTR source_string,
+ UINT16_PTR dest_length,
+ UINT16_PTR last_alloc_size,
+ UINT16 source_length )
+{
+ UINT16 alloc_size ;
+
+ /* If there is not string space allocated or the desired length is
+ greater than the currently allocated length then we need to insure
+ that we have enough space for the current data.
+ */
+ if( *dest_string == NULL || source_length > *last_alloc_size ) {
+ if( *dest_string != NULL ) {
+ /* Release the existing memory since we need to allocate more */
+ free( *dest_string ) ;
+ *dest_string = NULL ; /* Mark as not allocated */
+ } else {
+ *last_alloc_size = 0 ;
+ }
+
+ if( source_length > (UINT16)0 ) {
+ /* There is something to copy so we need to get the storage.
+ This probably needs to have some smarts added to it to
+ keep a small static size that can be used for strings
+ that are shorter than some threshold. This will prevent
+ the malloc'ing of single bytes which can happen with the
+ 4.0 tape format.
+
+ We need to malloc the greater of minimum alloc size or
+ source_length, whichever is larger. This will avoid
+ successive mallocs of single bytes etc.
+ */
+ alloc_size = source_length ;
+ if( alloc_size % F40_CHUNK != 0 ) {
+ alloc_size += F40_CHUNK ; /* Add the chunk size */
+ }
+ alloc_size = max( (UINT16)alloc_size, F40_MIN_ALLOC ) ;
+ *dest_string = (UINT8_PTR)malloc( alloc_size ) ;
+ if( *dest_string == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+
+ /* Update the static var last_size so we can use it to
+ determine if we need to release the current memory and
+ allocate more.
+ */
+ *last_alloc_size = alloc_size ;
+ *dest_length = source_length ;
+ memmove( *dest_string, source_string, (size_t)source_length ) ;
+
+ } else {
+
+ /* Nothing to copy so just set the length to 0 */
+ *dest_length = 0 ;
+ }
+
+ } else { /* End of env tape name needs malloc */
+
+ *dest_length = source_length ;
+ memmove( *dest_string, source_string, (size_t)source_length ) ;
+ }
+
+ return TFLE_NO_ERR ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_SetBlkType
+
+ Description: This function sets the passed block type in the
+ passed in block header.
+
+ Returns: Nothing
+
+ Notes: None
+
+**/
+VOID F40_SetBlkType(
+ MTF_DB_HDR_PTR cur_hdr, /* The current tape block header structure*/
+ UINT8_PTR block_id )
+{
+ INT i ;
+
+ for ( i = 0 ; i < 4 ; i++ ) {
+ cur_hdr->block_type[i] = block_id[i] ;
+ }
+}
+
+/**/
+/**
+
+ Name: F40_CalcRunningLBA
+
+ Description: This calculates the number of Logical block the last
+ Format 4.0 block occupied.
+
+ Returns: Number of Logical Blocks the last DBLK occupied
+
+ Notes:
+
+ Declaration:
+
+**/
+UINT32 F40_CalcRunningLBA( F40_ENV_PTR CurrentEnv )
+{
+ UINT64 remaining ;
+ BOOLEAN status ;
+ UINT32 noLBAs ;
+
+ noLBAs = U64_Lsw( U64_Div( CurrentEnv->used_so_far,
+ U64_Init( F40_LB_SIZE, 0L ),
+ &remaining, &status ) ) ;
+
+ noLBAs += remaining.lsw ? 1L : 0L ;
+
+ return( noLBAs ) ;
+
+}
+
+
+/**/
+/**
+ Unit: Translators
+
+ Name: F40_WriteInit
+
+ Modified:
+
+ Description: Initializes the OTC temporary files.
+
+ Notes: The otc_level is for the current set, but it must be
+ compatible with the max_otc_level for the tape as follows:
+
+ MAX ALLOWED
+ --- -------
+ NONE NONE
+ PARTIAL PARTIAL
+ FULL PARTIAL or FULL
+
+ Returns: INT16 - TFLE_xxx error code.
+
+**/
+INT16 F40_WriteInit(
+ CHANNEL_PTR channel, /* Current active channel */
+ UINT16 otc_level, /* Attributes for OTC */
+ BUF_PTR buffer ) /* For GetPrevSM */
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ BOOLEAN sm_exists ;
+ BOOLEAN appending = ( channel->tape_id != 0L ) ;
+ UINT16 ret_val ;
+
+ if( appending && !( lw_fmtdescr[channel->cur_fmt].attributes & APPEND_SUPPORTED ) ) {
+ return( TFLE_APPEND_NOT_ALLOWED ) ;
+ }
+
+ cur_env->sm_count = 1 ;
+ cur_env->dir_count = 0 ;
+ cur_env->file_count = 0 ;
+ cur_env->fdd_seq_num = 0 ;
+ cur_env->fdd_pba = 0L ;
+ cur_env->fdd_aborted = FALSE ;
+ cur_env->sm_aborted = FALSE ;
+ cur_env->fdd_completed = FALSE ;
+ cur_env->sm_adjusted = FALSE ;
+ cur_env->fdd_continuing = FALSE ;
+ cur_env->sm_continuing = FALSE ;
+ cur_env->end_set_continuing = FALSE ;
+ cur_env->eotm_no_first_fmk = FALSE ;
+ cur_env->corrupt_obj_count = 0 ;
+ cur_env->dir_links[0] = 0L ;
+ cur_env->dir_level = 0 ;
+ cur_env->max_dir_level = 0 ;
+ cur_env->last_volb = -1L ;
+ cur_env->stream_crosses = FALSE ;
+ cur_env->stream_offset = 0 ;
+ cur_env->stream_at_eom = FALSE ;
+ cur_env->pstream_crosses = FALSE ;
+ cur_env->pstream_offset = 0 ;
+
+ cur_env->cur_otc_level = otc_level ;
+
+ /* Temporary way to stop OTC on drives that don't have seek capability */
+ if( !SupportBlkPos( channel->cur_drv ) ||
+ !SupportFastEOD( channel->cur_drv ) ||
+ !SupportRevFmk( channel->cur_drv ) ||
+ ( cur_env->max_otc_level == TCL_NONE && appending ) ) {
+
+ cur_env->cur_otc_level = TCL_NONE ;
+ }
+
+ if( cur_env->cur_otc_level == TCL_NONE ) {
+ msassert( cur_env->max_otc_level == TCL_NONE ) ;
+ if( cur_env->max_otc_level != TCL_NONE ) {
+ return( TFLE_OTC_FAILURE ) ;
+ } else {
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ if( ( ret_val = OTC_OpenSM( cur_env, appending, &sm_exists ) ) != TFLE_NO_ERR ) {
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( ret_val ) ;
+ }
+
+ if( appending ) {
+ if( !sm_exists ) {
+ if( ( ret_val = OTC_GetPrevSM( channel, buffer, FALSE, TRUE ) ) != TFLE_NO_ERR ) {
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ return( ret_val ) ;
+ }
+ }
+ } else {
+ if( ( ret_val = OTC_GenSMHeader( channel ) ) != TFLE_NO_ERR ) {
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ return( ret_val ) ;
+ }
+ }
+
+ if( cur_env->cur_otc_level == TCL_FULL ) {
+ msassert( cur_env->max_otc_level == TCL_FULL ) ;
+ if( cur_env->max_otc_level != TCL_FULL ) {
+ cur_env->cur_otc_level = TCL_PARTIAL ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( ( ret_val = OTC_OpenFDD( cur_env ) ) != TFLE_NO_ERR ) {
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ return( ret_val ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
diff --git a/private/utils/ntbackup/src/mui.c b/private/utils/ntbackup/src/mui.c
new file mode 100644
index 000000000..94ac39f25
--- /dev/null
+++ b/private/utils/ntbackup/src/mui.c
@@ -0,0 +1,1904 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: mui.c
+
+ Description: This file contains the functions for the Maynard User
+ Interface (MUI) to the Graphical User Interface and the
+ Backup Engine.
+
+ $Log: G:\ui\logfiles\mui.c_v $
+
+ Rev 1.83.2.0 25 Jan 1994 15:49:38 chrish
+Added fix for ORCAS EPR 0054. Problem with using a space as a valid
+character in the log file name or directory name.
+
+ Rev 1.83 16 Aug 1993 14:55:38 BARRY
+Got rid of unresolved externals for NTBACKUP.
+
+ Rev 1.82 05 Aug 1993 17:43:48 GLENN
+Checking for a valid job name pointer now.
+
+ Rev 1.81 05 Aug 1993 17:32:02 GLENN
+Not initializing tape device or hardware if this is a command line job. Job Start will.
+
+ Rev 1.80 05 Aug 1993 13:23:30 GLENN
+Added support to allow mui to completely init if we were told to terminate the app - (allows proper deinit).
+
+ Rev 1.79 03 Aug 1993 20:59:38 CHUCKB
+Make job name string global and changed its name accordingly.
+
+ Rev 1.78 21 Jul 1993 18:02:02 MARINA
+enable c++
+
+ Rev 1.77 21 Jul 1993 16:55:16 GLENN
+Added operation queing support.
+
+ Rev 1.76 16 Jul 1993 13:38:24 chrish
+CAYMAN EPR 0564: Added code to open and close log file for writing information
+about invalid directories passed on the command line.
+
+ Rev 1.75 02 Jun 1993 13:21:30 DARRYLP
+Fixed the slight problem in which the iconified application does not
+permit keyboard switching when the backup is finished.
+
+ Rev 1.74 25 May 1993 15:44:44 GLENN
+Moved the mui deinit flag to top of MUI_Deinit().
+
+ Rev 1.73 25 May 1993 09:42:04 GLENN
+Fixed hardware init logic.
+
+ Rev 1.72 20 May 1993 13:36:54 DARRYLP
+Kill WinHelp if we called it and it is up during our termination.
+
+ Rev 1.71 18 May 1993 20:21:50 GLENN
+Added enable state for advanced button if it is not a search window.
+
+ Rev 1.70 18 May 1993 15:01:52 GLENN
+Changed tool bar settings based on window type.
+
+ Rev 1.69 14 May 1993 14:14:46 TIMN
+Added f(x) call to physically claim a specified tape device. No impact to
+NOST. Cayman needs hwconfnt.c dil_nt.c be_dinit.c global.c global.h hwconf.h
+
+
+ Rev 1.68 04 May 1993 12:59:28 BARRY
+Fixed MIPS compile error.
+
+ Rev 1.67 03 May 1993 11:40:52 TIMN
+Updated invalid device value which was changed in global.c
+
+ Rev 1.66 29 Apr 1993 16:14:34 DARRYLP
+Eject Tape now makes you wait for it to complete before allowing the user
+to attempt anything else.
+
+ Rev 1.65 22 Apr 1993 15:55:54 GLENN
+Cleanup.
+
+ Rev 1.64 19 Apr 1993 15:22:58 GLENN
+Added global return code setting at end of operation.
+
+ Rev 1.63 09 Apr 1993 14:02:06 GLENN
+Improved logic in MUI_ActivateDocument().
+
+ Rev 1.62 02 Apr 1993 14:09:00 GLENN
+Added display info support.
+
+ Rev 1.61 25 Mar 1993 15:49:24 CARLS
+changes in TapeInDrive for update to retension button
+
+ Rev 1.60 24 Mar 1993 11:23:38 chrish
+Added code to MUI_EnableOperation to fix aborting in the middle of a
+backup.
+
+ Rev 1.59 22 Mar 1993 13:44:16 chrish
+Added gbCurrentOperation = OPERATION_CATALOG to MUI_StartOperation routine.
+
+ Rev 1.58 17 Mar 1993 17:50:36 CHUCKB
+Fixed cayman's handling of jobs.
+
+ Rev 1.57 11 Mar 1993 13:27:56 STEVEN
+add batch
+
+ Rev 1.56 10 Mar 1993 12:47:52 CARLS
+Changes to move Format tape to the Operations menu
+
+ Rev 1.55 20 Jan 1993 20:26:12 MIKEP
+add mem display to NT
+
+ Rev 1.54 23 Nov 1992 14:28:56 MIKEP
+add vm ptr to qtc_init call
+
+ Rev 1.53 18 Nov 1992 13:04:04 GLENN
+Fixed button states based on the poll drive state.
+
+ Rev 1.52 01 Nov 1992 16:02:58 DAVEV
+Unicode changes
+
+ Rev 1.51 30 Oct 1992 15:44:02 GLENN
+Moved the configuration deinit after the units deinit.
+
+ Rev 1.50 07 Oct 1992 14:10:50 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.49 04 Oct 1992 19:39:04 DAVEV
+Unicode Awk pass
+
+ Rev 1.48 02 Oct 1992 16:47:50 GLENN
+Fixed wait cursor - set cursor stuff.
+
+ Rev 1.47 28 Sep 1992 17:01:28 GLENN
+MikeP changes (DriveType).
+
+ Rev 1.46 22 Sep 1992 10:24:48 GLENN
+Added the net connect and disconnect stuff.
+
+ Rev 1.45 10 Sep 1992 17:19:14 GLENN
+Resolved outstanding state issues for toolbar and menubar.
+
+ Rev 1.44 09 Sep 1992 16:59:00 GLENN
+Updated toolbar stuff for BIMINI and NT.
+
+ Rev 1.43 08 Sep 1992 15:40:30 GLENN
+Resolved modeless dialog while loop.
+
+ Rev 1.42 02 Sep 1992 16:42:22 GLENN
+Added support for toolbar button states based on current window. MikeP added catalog enable stuff
+.
+
+ Rev 1.41 06 Aug 1992 13:17:30 CHUCKB
+Changes for NT.
+
+ Rev 1.40 27 Jun 1992 18:31:46 MIKEP
+another qtc change to init
+
+ Rev 1.39 27 Jun 1992 17:58:38 MIKEP
+changes for qtc
+
+ Rev 1.38 20 May 1992 18:07:42 GLENN
+Fixed added checking to strtok - command line stuff. Put in changes for 1.32.1.1 branch.
+
+ Rev 1.37 19 May 1992 09:26:16 MIKEP
+mo changes
+
+ Rev 1.36 15 May 1992 16:48:14 MIKEP
+incl_cds removal
+
+ Rev 1.35 14 May 1992 18:00:26 MIKEP
+nt pass 2
+
+ Rev 1.34 11 May 1992 15:47:58 GLENN
+Made sure RTD had focus when MUI_EnableOperations() was called, iff the RTD existed.
+
+ Rev 1.33 11 May 1992 14:20:36 DAVEV
+OEM_MSOFT: modifications for batch command line support
+
+ Rev 1.32 27 Apr 1992 16:19:50 JOHNWT
+get pw for pwdb before startup.bks
+
+ Rev 1.31 23 Apr 1992 15:57:40 JOHNWT
+added pwdb check to jobs
+
+ Rev 1.30 20 Apr 1992 13:54:42 GLENN
+Removed multitask from MUI_EnableOperations() - caused exit problems.
+
+ Rev 1.29 09 Apr 1992 11:32:18 GLENN
+Added catalog initializing and UI initializing status line calls.
+
+ Rev 1.28 07 Apr 1992 10:25:30 GLENN
+Added a call back when there is a system change. (future)
+
+ Rev 1.27 02 Apr 1992 15:39:56 GLENN
+Added NT support for tape-in-drive dependent selection bar buttons.
+
+ Rev 1.26 26 Mar 1992 17:05:32 STEVEN
+remove hwconfig
+
+ Rev 1.25 23 Mar 1992 11:53:28 GLENN
+Added bad data and catalog path warning support.
+
+ Rev 1.24 22 Mar 1992 12:55:52 JOHNWT
+finished stdmodewarn disable
+
+ Rev 1.23 20 Mar 1992 17:23:50 GLENN
+Added std mode warning config option.
+
+ Rev 1.22 20 Mar 1992 12:40:08 DAVEV
+Changes for OEM_MSOFT product alternate functionality
+
+ Rev 1.21 19 Mar 1992 09:30:16 MIKEP
+debug deinit
+
+ Rev 1.20 17 Mar 1992 17:13:54 GLENN
+Added standard mode warning message box.
+
+ Rev 1.19 10 Mar 1992 15:50:46 DAVEV
+fix for OEM_MSOFT changes
+
+ Rev 1.18 09 Mar 1992 09:23:10 GLENN
+GLENN - Added logo bitmap support. DAVEV - Added NT ifdef options
+
+ Rev 1.17 27 Feb 1992 13:53:02 GLENN
+Enabled poll drive for command line jobs and scheduled jobs.
+
+ Rev 1.16 18 Feb 1992 16:36:40 CHUCKB
+Added code to make auto job for verify.
+
+ Rev 1.15 11 Feb 1992 17:23:26 GLENN
+Fixed ribbon enabling for search window.
+
+ Rev 1.14 08 Feb 1992 16:50:38 MIKEP
+refresh all selections
+
+ Rev 1.13 05 Feb 1992 20:50:16 MIKEP
+pass config to qtc init
+
+ Rev 1.12 05 Feb 1992 17:39:46 GLENN
+Added MUI_Deinit() call when forcefully terminating app.
+
+ Rev 1.11 30 Jan 1992 12:36:02 GLENN
+Changed UI_TapeHWProblem to HWC_TapeHWProblem for modularity.
+
+ Rev 1.10 28 Jan 1992 08:27:28 JOHNWT
+fixed my fix
+
+ Rev 1.9 28 Jan 1992 08:24:40 JOHNWT
+fixed pwdb flag setting
+
+ Rev 1.8 27 Jan 1992 00:32:10 CHUCKB
+Updated dialog id's.
+
+ Rev 1.7 22 Jan 1992 12:32:48 GLENN
+Added animate icon support.
+
+ Rev 1.6 10 Jan 1992 15:47:40 CARLS
+removed strings
+
+ Rev 1.5 10 Jan 1992 11:18:12 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.4 07 Jan 1992 17:29:42 GLENN
+Added catalog data path support
+
+ Rev 1.3 10 Dec 1991 14:30:22 GLENN
+Bunches of changes by everyone
+
+ Rev 1.2 04 Dec 1991 18:36:40 GLENN
+Updated for ALT-F4 termination
+
+ Rev 1.1 03 Dec 1991 16:19:10 GLENN
+Added advanced restore, catalog maint operation to list.
+
+ Rev 1.0 20 Nov 1991 19:16:42 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define MUI_NO_STARTUP_JOBS 0xFFFF
+#define MAX_QUEUED_OPERATIONS 1
+
+// PRIVATE MODULE-WIDE VARIABLES
+
+static WORD mwwLastDocType = ID_NOTDEFINED;
+static BOOL mwfInitialized = FALSE;
+static BOOL mwfTapeInDrive = FALSE;
+
+static BOOL mwfTapeValid = FALSE;
+
+static BOOL mwfInfoAvailable = FALSE;
+
+static INT nJobIndex = MUI_NO_STARTUP_JOBS;
+static LONG lSchedKey = 0L ;
+
+static UINT mwnQueuedOperationMsg = 0;
+static INT mwnNumOperationsInQueue = 0;
+
+// PRIVATE FUNCTION PROTOTYPES
+
+static VOID MUI_CheckPWDB ( CDS_PTR );
+
+static VOID MUI_ProcessQuotedString ( LPSTR,
+ LPSTR,
+ BOOLEAN * );
+
+
+
+/******************************************************************************
+
+ Name: MUI_Init()
+
+ Description: This function initializes the Maynard User Interface (MUI)
+ by creating the tool bar and initializing the Volume List
+ Manager (VLM), which in turn creates the primary
+ documents.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+BOOL MUI_Init ( VOID )
+
+{
+ BE_INIT_STR pBE;
+ INT16 nErrorBE;
+ INT16 nResult = SUCCESS;
+ CDS_PTR pCDS = CDS_GetPerm();
+ BOOL fReadStartup;
+ BOOL fDelayTermination = FALSE;
+
+
+ WM_ShowWaitCursor ( TRUE );
+
+ // Make and Activate the Main tool bar window.
+
+ ghRibbonMain = MUI_MakeMainRibbon ();
+ RIB_Activate ( ghRibbonMain );
+ RIB_Draw ( ghRibbonMain );
+
+ // Now disable the operations, (and setup the UI accordingly).
+ MUI_DisableOperations ( (WORD)NULL );
+
+ WM_FrameUpdate ();
+
+ // Show the LOGO window.
+# if !defined ( OEM_MSOFT )
+ {
+ WM_LogoShow ();
+ }
+# endif //!defined ( OEM_MSOFT )
+
+ // If the debug flag is set, turn the debug window on.
+
+ if ( gfDebug ) {
+ DBM_Init ();
+ }
+
+ zprintf ( DEBUG_USER_INTERFACE, RES_INIT_APPLICATION );
+
+ // Allow the GUI to fully initialize by multitasking for a moment.
+
+ WM_MultiTask ();
+
+ // Setup the common module-wide resources.
+
+ UI_SetResources( );
+
+ // Initialize only the FILE SYSTEM and BSDU.
+
+ nErrorBE = UI_UnitsInit( &pBE, INIT_FSYS_BSDU );
+
+#ifdef OS_WIN32
+
+ // Display memory usage
+
+ if ( gfShowMemory ) {
+ MEM_StartShowMemory();
+ }
+
+
+# ifdef OEM_MSOFT
+ // Determine the starting drive to use if we didn't set it on
+ // the command line already.
+
+ if ( TapeDevice == (INT)INVALID_HANDLE_VALUE ) {
+ TapeDevice = HWC_GetTapeDevice ();
+ }
+# endif
+
+
+#endif // OS_WIN32
+
+
+ // Report any initialization errors.
+
+ WM_ShowWaitCursor ( FALSE );
+ HWC_ReportDiagError( &pBE, nErrorBE, &nResult );
+ WM_ShowWaitCursor ( TRUE );
+
+ // Now, check for advance to hardware config before going further.
+ // If advance to config is set, the hardware configuration dialog
+ // will be called. If the hardware is then initialized, the global
+ // hardware initialized flag will be set.
+
+# if !defined ( OS_WIN32 ) //NTKLUG?: done by Steve for NT only
+ {
+ WM_ShowWaitCursor ( FALSE );
+
+ if ( CDS_GetAdvToConfig ( pCDS ) ) {
+
+ // Destroy the LOGO window.
+
+ WM_LogoDestroy ();
+
+ nResult = (INT16)DM_ShowDialog ( ghWndFrame, IDD_SETTINGSHARDWARE, (PVOID)0 );
+
+
+ // Clear the advance to hardware config flag.
+
+ CDS_SetAdvToConfig ( pCDS, FALSE );
+ }
+
+ // If the hardware is not initialized, initialize it by calling the
+ // hardware problem handler.
+
+ if ( ! gfHWInitialized ) {
+
+ HWC_TapeHWProblem ( bsd_list );
+ }
+
+ WM_ShowWaitCursor ( TRUE );
+
+ }
+# else
+ {
+ WM_ShowWaitCursor ( FALSE );
+
+# ifndef OEM_MSOFT
+
+ // If this is a command line job - the job will init the
+ // tape device.
+
+ if ( ! gpszJobName ) {
+ HWC_InitTapeDevice() ; // claims the tape device
+ }
+# endif
+
+ // If this is a command line job - the job will init the hardware.
+
+#if defined( OEM_MSOFT )
+ if ( ! gpszJobName && ! gfHWInitialized ) {
+#else
+ if ( ! gpszJobName && ! gfHWInitialized && ! HWC_IsDeviceNoDevice () ) {
+#endif
+
+ HWC_TapeHWProblem ( bsd_list );
+ }
+
+ CDS_SetAdvToConfig( CDS_GetPerm(), FALSE );
+
+ WM_ShowWaitCursor ( TRUE );
+ }
+# endif // OS_WIN32 - NTKLUG?
+
+ // If we were told to terminate the app during hardware init,
+ // temporarily delay that order so that the app can finish initializing
+ // and log any job errors or other types of errors.
+
+ if ( gfTerminateApp ) {
+ fDelayTermination = TRUE;
+ gfTerminateApp = FALSE;
+ }
+
+ // Destroy the LOGO window.
+
+# if !defined ( OEM_MSOFT )
+ {
+ WM_LogoDestroy ();
+ }
+# endif //!defined ( OEM_MSOFT )
+
+ // Allow the GUI to be repainted.
+
+ WM_MultiTask ();
+
+# if !defined ( OEM_MSOFT )
+
+ // Enter the PWDB password if necessary
+
+ if ( ( gpszJobName ) ||
+ ( nJobIndex == MUI_NO_STARTUP_JOBS ) ) {
+
+ STM_SetIdleText ( IDS_INITUI );
+ MUI_CheckPWDB( pCDS );
+
+ }
+# endif //!defined ( OEM_MSOFT )
+
+ // Initialize the catalogs.
+
+ STM_SetIdleText ( IDS_INITCATALOGS );
+
+ // True is that we wish to read unicode cats
+
+ QTC_Init ( CDS_GetCatDataPath(), NULL );
+
+ // Initialize the BACKUP ENGINE and the PRIMARY DOCUMENT windows.
+
+ STM_SetIdleText ( IDS_INITUI );
+ fReadStartup = ( ( gpszJobName == NULL ) &&
+ ( nJobIndex == MUI_NO_STARTUP_JOBS ) );
+
+ VLM_Init ( fReadStartup );
+ WM_MultiTask ();
+
+ // Create the LOG FILES window.
+
+ LOG_Init ();
+ WM_MultiTask ();
+
+ // Display the standard mode warning if we are in standard mode.
+
+ if ( ! gfEnhanced && CDS_GetStdModeWarning ( pCDS ) ) {
+
+ CHAR szMessage[MAX_UI_RESOURCE_SIZE];
+ CHAR szTemp[MAX_UI_SMALLRES_SIZE];
+
+ RSM_StringCopy ( IDS_APPNAME, szTemp, sizeof ( szTemp ) );
+ RSM_Sprintf ( szMessage, ID(IDS_STDMODEWARNING), szTemp );
+
+ WM_ShowWaitCursor ( FALSE );
+
+ nResult = WM_MsgBox ( ID(IDS_APPNAME),
+ szMessage,
+ WMMB_OKDISABLE,
+ WMMB_ICONEXCLAMATION );
+
+ if ( nResult == WMMB_IDDISABLE ) {
+
+ CDS_SetStdModeWarning ( pCDS, FALSE );
+ CDS_WriteStdModeWarning ( pCDS );
+ }
+
+
+ WM_ShowWaitCursor ( TRUE );
+
+ }
+
+ // Initialize the application timer.
+
+ WM_InitTimer ();
+
+# if !defined ( OEM_MSOFT )
+
+ // Initialize the Jobs Queue and Create any non-existant permanent jobs.
+
+ JOB_Refresh ();
+ UI_MakeAutoJobs ( (INT)NULL );
+
+# endif //!defined ( OEM_MSOFT )
+
+
+ // Initialize Poll Drive and Start Polling the Drive.
+
+ PD_Init ();
+ PD_StartPolling ();
+ PD_SetFrequency ( CDS_GetPollFrequency ( pCDS ) );
+
+ mwfInitialized = TRUE;
+
+ zprintf ( DEBUG_USER_INTERFACE, RES_APPLICATION_INIT );
+
+ // Guarantee the tool bar, doc, and the rest of the screen is correct.
+
+// MUI_EnableOperations ( (WORD)NULL );
+
+ // WM_ShowWaitCursor ( FALSE );
+
+# if defined ( OS_WIN32 ) //alternate feature - cmd line batch job
+ {
+ // we must process the command line now (as opposed to during
+ // MUI_ProcessCommandLine) because dle_list and bsd_list
+ // must be initialized.
+
+ if ( glpCmdLine ) //global command line pointer
+ {
+ LPSTR pszNext = NULL; // Next command line item pointer
+ LPSTR pszCmdLine;
+ CHAR szBackup[ IDS_OEM_MAX_LEN ];
+ CHAR szEject[ IDS_OEM_MAX_LEN ];
+ CHAR szTokens[ IDS_OEM_MAX_LEN ];
+ CHAR szDSA[ IDS_OEM_MAX_LEN ];
+ CHAR szMonolithic[ IDS_OEM_MAX_LEN ];
+ OEMOPTS_PTR pOemOpts = NULL;
+ BSD_PTR bsd ;
+ LPSTR pszQuotedString;
+ BOOLEAN QuoteState = FALSE;
+ UINT8 uEmsFSType = (UINT8)FS_UNKNOWN_OS;
+ BOOLEAN oem_batch_eject_mode = FALSE ;
+
+ pszCmdLine = malloc( ( strlen( glpCmdLine ) + 1 ) * sizeof(CHAR) );
+
+ if ( pszCmdLine == NULL ) { //uh-oh - memory allocation problem!!
+
+ return FAILURE;
+ }
+
+ pszQuotedString = malloc( ( strlen( glpCmdLine ) + 1 ) * sizeof(CHAR) );
+
+ if ( pszQuotedString == NULL ) { //uh-oh - memory allocation problem!!
+
+ free( pszCmdLine );
+ return FAILURE;
+ }
+
+ strcpy( pszCmdLine, glpCmdLine );
+
+ RSM_StringCopy ( IDS_OEMBATCH_BACKUP,
+ szBackup, sizeof ( szBackup ) );
+
+ RSM_StringCopy ( IDS_OEMBATCH_EJECT,
+ szEject, sizeof ( szEject ) );
+
+ RSM_StringCopy ( IDS_OEMOPT_TOKENSEPS,
+ szTokens, sizeof ( szTokens ) );
+
+ pszNext = strtok ( pszCmdLine, szTokens ); //skip leading spaces
+
+ if ( pszNext &&
+ ( pOemOpts = OEM_DefaultBatchOptions () ) &&
+ ( (strnicmp ( pszNext, szBackup, strlen( pszNext ) ) == 0 ) ||
+ ( strnicmp ( pszNext, szEject, strlen( pszNext ) ) == 0 ) ) )
+ {
+ oem_batch_eject_mode = FALSE ;
+
+ if ( strnicmp ( pszNext, szEject, strlen( pszNext ) ) == 0 ) {
+ oem_batch_eject_mode = TRUE ;
+ }
+
+ // Make sure we're starting with a clear BSD list
+
+ bsd = BSD_GetFirst( bsd_list );
+
+ while ( bsd != NULL ) {
+ BSD_Remove( bsd );
+ bsd = BSD_GetFirst( bsd_list );
+ }
+
+ // Process the command line: all following items in the command
+ // line must be one or more path specifiers with optional batch
+ // options mixed in.
+
+
+ if ( strlen( LOG_GetCurrentLogName( ) ) > 0 ) { // chs:07-16-93
+ lresprintf( LOGGING_FILE, LOG_START, FALSE ); // chs:07-16-93
+ } // chs:07-16-93
+
+ RSM_StringCopy ( IDS_OEMOPT_DSA,
+ szDSA, sizeof ( szDSA ) );
+ RSM_StringCopy ( IDS_OEMOPT_MONOLITHIC,
+ szMonolithic, sizeof ( szMonolithic ) );
+
+ while ( pszNext = strtok ( NULL, szTokens ) ) {
+
+ if ( OEM_ProcessBatchCmdOption (
+ pOemOpts,
+ pszNext,
+ szTokens,
+ pszCmdLine ) == IDS_OEMOPT_NOTANOPTION )
+ {
+
+ //
+ // Previous logic did not account for a directory name haveing spaces
+ // example ... "G:\SUB DIR WITH SPACE". This was the easiest way
+ // to fix this problem without changing the central logic of
+ // the codes.
+ //
+
+ if ( *pszNext == TEXT( '"' ) || QuoteState ) {
+
+ if ( !QuoteState ) strcpy( pszQuotedString, TEXT( "" ) );
+ QuoteState = TRUE;
+ if ( *pszNext == TEXT( '"' ) ) {
+ MUI_ProcessQuotedString ( pszQuotedString, ( pszNext + 1 ), &QuoteState );
+ } else {
+ MUI_ProcessQuotedString ( pszQuotedString, pszNext, &QuoteState );
+ }
+ if ( !QuoteState ) {
+
+ //It's either a path or Exchange server name, based on the
+ //setting of uEmsFSType.
+ if ( ((UINT8)FS_UNKNOWN_OS) == uEmsFSType ) {
+ OEM_AddPathToBackupSets ( bsd_list, dle_list, pszNext );
+
+ } else {
+ // Add EMS Server path to Backup sets and reset EMS flag.
+#ifdef OEM_EMS
+ OEM_AddEMSServerToBackupSets ( bsd_list, dle_list,
+ pszNext, uEmsFSType );
+ uEmsFSType = (UINT8)FS_UNKNOWN_OS;
+#endif
+ }
+ } else {
+
+ strcat( pszQuotedString, TEXT( " " ) );
+ }
+ } else {
+
+ //It's not an option, so it must be a path specifier, an
+ //Exchange backup specifier, or an Exchange server specifier.
+
+ //Check first for Exchange DSA backup
+ if ( strnicmp ( pszNext, szDSA, strlen( pszNext ) ) == 0 ) {
+ uEmsFSType = FS_EMS_DSA_ID;
+
+ //Check next for Exchange Monolithic backup
+ } else if ( strnicmp ( pszNext, szMonolithic, strlen( pszNext ) ) == 0 ) {
+ uEmsFSType = FS_EMS_MDB_ID;
+
+ } else {
+
+ //It's either a path or Exchange server name, based on the
+ //setting of uEmsFSType.
+
+ if ( ((UINT8)FS_UNKNOWN_OS) == uEmsFSType ) {
+ OEM_AddPathToBackupSets ( bsd_list, dle_list, pszNext );
+
+ } else {
+#ifdef OEM_EMS
+ // Add EMS Server path to Backup sets and reset EMS flag
+ OEM_AddEMSServerToBackupSets ( bsd_list, dle_list,
+ pszNext, uEmsFSType );
+ uEmsFSType = (UINT8)FS_UNKNOWN_OS;
+#endif
+ }
+ }
+ }
+
+ }
+ }
+
+ if ( strlen( LOG_GetCurrentLogName( ) ) > 0 ) { // chs:07-16-93
+ lresprintf( LOGGING_FILE, LOG_END, FALSE ); // chs:07-16-93
+ }
+
+ //Update the BSD(s) with the batch option selections...
+
+ OEM_UpdateBatchBSDOptions ( bsd_list, pOemOpts );
+ OEM_DeleteBatchOptions ( &pOemOpts ); //don't need it anymore
+
+ // Now, go do the batch backup operation...
+ CDS_SetYesFlag ( CDS_GetPerm (), YESYES_FLAG );
+
+ MUI_EnableOperations ( (WORD)NULL );
+
+ WM_ShowWaitCursor ( FALSE );
+
+ if ( oem_batch_eject_mode ) {
+ MUI_StartOperation ( IDM_OPERATIONSEJECT, TRUE );
+ } else {
+ MUI_StartOperation ( IDM_OPERATIONSBACKUP, TRUE );
+ }
+
+ free ( pszCmdLine ); //don't need this anymore
+
+ return FAILURE; // we are done! exit the app.
+ }
+ else
+ {
+ free ( pszCmdLine ); //don't need this anymore
+ }
+ }
+ }
+#endif //if defined ( OS_WIN32 ) for command line batch jobs
+ MUI_EnableOperations ( (WORD)NULL );
+ WM_ShowWaitCursor ( FALSE );
+
+#if !defined ( OEM_MSOFT ) //OEM_MSOFT can't do jobs or schedules
+ {
+
+ // Kick off a job if one was found to be on the command line.
+ // If the job was on the command line, we exit the app when
+ // the job is done.
+
+ if ( gpszJobName ) {
+
+ JOB_StartJob ( gpszJobName, JOB_NOTSCHEDULED );
+ return FAILURE;
+
+ }
+ else if ( nJobIndex != MUI_NO_STARTUP_JOBS ) {
+
+ // If the password database is configured for use, set the db
+ // state flag to VERIFIED so that unattended jobs can run without
+ // a pw for the pwdb being entered.
+
+ if ( CDS_GetEnablePasswordDbase( pCDS ) ) {
+ gfPWForPWDBState = DBPW_VERIFIED;
+ }
+
+ SCH_StartJob ( (INT16)nJobIndex, (LONG) lSchedKey );
+ return FAILURE;
+ }
+
+ }
+# endif //defined ( OEM_MSOFT ) //alternate/Standard features
+
+ if ( fDelayTermination ) {
+ return FAILURE;
+ }
+
+ // Check for bad data paths and display warning(s) if found.
+
+ CDS_CheckForBadPaths ();
+
+ return SUCCESS;
+
+} /* end MUI_Init() */
+
+
+/******************************************************************************
+
+ Name: MUI_Deinit()
+
+ Description: This function deinitializes the Maynard User Interface (MUI).
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MUI_Deinit ( VOID )
+
+{
+ // This may be called twice, so check to see if it has already been
+ // deinitialized. Once, by a normal close, another, by a TASK killer.
+ // We have to check for both. The reason it is done this way is so
+ // that we keep showing our application until the app is completely
+ // deinitialized. This is a courtesy to our users.
+
+ if ( mwfInitialized ) {
+
+ mwfInitialized = FALSE;
+
+ WM_ShowWaitCursor ( TRUE );
+
+ // Deinitialize the application timer.
+
+ WM_DeinitTimer ();
+
+ // Turn off and deinitialize the tape drive polling.
+
+ PD_StopPolling ();
+ PD_Deinit ();
+
+ if ( CDS_GetEjectTapeFlag ( CDS_GetPerm () ) ) {
+ PD_EjectTape ();
+ }
+
+ // Deinitialize the Log stuff.
+
+ LOG_Deinit ();
+
+ // Deinitialize the Jobs Queue.
+# if !defined ( OEM_MSOFT )
+
+ JOB_DeInitQueue ();
+
+# endif //!defined ( OEM_MSOFT )
+ // Deinitialize the VLM.
+
+ VLM_Deinit ();
+
+ // Clean up the catalogs.
+
+ QTC_Deinit ( (INT) gfDeleteCatalogs );
+
+ // Deinitialize the backup engine and hardware.
+
+ UI_UnitsDeInit ();
+
+ // Deinitialize the debug stuff.
+
+ DBM_Deinit( );
+
+ // Deinitialize and Save the CDS.
+
+ CDS_SaveDisplayConfig ();
+ CDS_Deinit ();
+
+ // Kill WinHelp if we brought it up and it is still around
+
+ WinHelp( ghWndFrame,
+ NULL,
+ HELP_QUIT,
+ 0L );
+
+ // Turn of the show memory flag.
+
+#ifdef OS_WIN32
+
+ if ( gfShowMemory ) {
+ MEM_StopShowMemory();
+ }
+#endif
+
+ gfShowMemory = FALSE;
+
+ WM_ShowWaitCursor ( FALSE );
+ }
+
+} /* end MUI_Deinit() */
+
+
+/******************************************************************************
+
+ Name: MUI_StartOperation()
+
+ Description: This function prepares the GUI for an operation, then
+ kicks off the operation.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+BOOL MUI_StartOperation (
+
+WORD wType, // I - type of operation to start
+BOOL fUpdateTempCDS ) // I - flag to update the temp CDS (copy of CDS)
+
+{
+ BOOL fError = SUCCESS;
+
+
+ // Bug out, if we cannot disable other operations. This will only occur
+ // if there is an operation currently being done.
+
+ if ( MUI_DisableOperations ( wType ) ) {
+ return FAILURE;
+ }
+
+ // SINCE THIS IS A RECURSIVE ROUTINE
+ // Check to see if an operation is currently in progress.
+ // If so, bug out. Otherwise, switch to the appropriate operation.
+
+ if ( fUpdateTempCDS ) {
+
+ // Refresh the temp or copy of the CDS with the perm CDS before the
+ // operation. The copy can be modified, but the modifications will
+ // not be reflected in the permanent CDS.
+
+ CDS_UpdateCopy ();
+ }
+
+ switch ( wType ) {
+
+ case IDM_OPERATIONSBACKUP:
+
+ STM_SetIdleText ( IDS_BACKINGUP );
+ WM_AnimateAppIcon ( wType, TRUE );
+
+ if ( ! VLM_StartBackup () ) {
+ VLM_ClearAllSelections ();
+
+# if !defined ( OEM_MSOFT )
+ UI_MakeAutoJobs ( JOBBACKUP );
+# endif //!defined ( OEM_MSOFT )
+ }
+
+ else {
+ VLM_RematchAllLists( );
+ fError = FAILURE;
+ }
+ break;
+
+# ifdef OEM_EMS
+ case IDM_OPERATIONSEXCHANGE:
+
+ DM_ShowDialog ( ghWndFrame, IDD_CONNECT_XCHNG, (PVOID) NULL );
+
+ break;
+# endif
+
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSTRANSFER:
+
+ STM_SetIdleText ( IDS_TRANSFERRING );
+ WM_AnimateAppIcon ( wType, TRUE );
+
+ if ( ! VLM_StartTransfer () ) {
+ UI_MakeAutoJobs ( JOBTRANSFER );
+ VLM_ClearAllSelections ();
+ }
+ else {
+ VLM_RematchAllLists( );
+ fError = FAILURE;
+ }
+
+ break;
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSRESTORE:
+
+ STM_SetIdleText ( IDS_RESTORING );
+ WM_AnimateAppIcon ( wType, TRUE );
+
+ if ( ! VLM_StartRestore () ) {
+ VLM_ClearAllSelections ();
+# if !defined ( OEM_MSOFT )
+ UI_MakeAutoJobs ( JOBRESTORE );
+# endif //!defined ( OEM_MSOFT )
+ }
+ else {
+ VLM_RematchAllLists( );
+ fError = FAILURE;
+ }
+
+ break;
+
+ case IDM_OPERATIONSCATALOG:
+
+ gbCurrentOperation = OPERATION_CATALOG; // chs:03-21-93
+ STM_SetIdleText ( IDS_CATALOGING );
+ WM_AnimateAppIcon ( wType, TRUE );
+ VLM_StartCatalog ();
+
+ break;
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSVERIFY:
+
+ STM_SetIdleText ( IDS_VERIFYING );
+ WM_AnimateAppIcon ( wType, TRUE );
+
+ if ( ! VLM_StartVerify () ) {
+ UI_MakeAutoJobs ( JOBBACKUP );
+ VLM_ClearAllSelections ();
+ }
+ else {
+ VLM_RematchAllLists( );
+ fError = FAILURE;
+ }
+
+ break;
+
+ case IDM_OPERATIONSINFO:
+
+ STM_SetIdleText ( IDS_INFOING );
+ VLM_DisplayInfo ();
+
+ break;
+
+ case IDM_OPERATIONSCATMAINT:
+
+ STM_SetIdleText ( IDS_CATMAINT );
+ DM_ShowDialog ( ghWndFrame, IDD_OPERATIONSCATMAINT, (PVOID) NULL );
+
+ break;
+
+ case IDM_OPERATIONSSEARCH:
+
+ VLM_StartSearch ( NULL );
+
+ break;
+
+ case IDM_OPERATIONSCONNECT:
+
+ VLM_NetConnect ( );
+
+ break;
+
+ case IDM_OPERATIONSDISCON:
+
+ VLM_NetDisconnect ( );
+
+ break;
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ case IDM_OPERATIONSEJECT:
+
+ WM_ShowWaitCursor(TRUE);
+ STM_SetIdleText ( IDS_EJECTING );
+ PD_EjectTape ();
+ WM_ShowWaitCursor(FALSE);
+
+ break;
+
+ case IDM_OPERATIONSERASE:
+
+ STM_SetIdleText ( IDS_ERASING );
+ VLM_StartErase ();
+
+ break;
+
+ case IDM_OPERATIONSRETENSION:
+
+ STM_SetIdleText ( IDS_RETENSIONING );
+ VLM_StartTension ();
+
+ break;
+
+
+#ifdef OS_WIN32
+ case IDM_OPERATIONSFORMAT:
+
+ STM_SetIdleText ( IDS_FORMATING );
+ VLM_StartFormat ();
+
+ break;
+#endif
+
+ } /* end switch */
+
+ MUI_EnableOperations ( wType );
+
+ gnReturnCode = (INT)fError;
+
+ return fError;
+
+} /* end MUI_StartOperation() */
+
+
+BOOL MUI_DisableOperations (
+
+WORD wType ) // type of operation that is disabling the display
+
+{
+ // If there is a currently active operation, don't let another occur.
+
+ if ( gfOperation ) {
+ return FAILURE;
+ }
+
+ gfOperation = TRUE;
+
+ // Disable all operation buttons, but the operation that is to occur.
+ // Push any tool bar item button down to reflect the operation.
+
+ MUI_SetOperationButtons ( RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetActionButtons ( RIB_ITEM_UP | RIB_ITEM_DISABLED );
+ MUI_SetButtonState ( wType, RIB_ITEM_DOWN | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ WM_SetDocSizes ();
+ WM_MultiTask ();
+
+ return SUCCESS;
+
+} /* end MUI_DisableOperations() */
+
+
+BOOL MUI_EnableOperations (
+
+WORD wType ) // type of operation that is enabling the display
+
+{
+ HWND hWndFocus = GetFocus( );
+
+ DBG_UNREFERENCED_PARAMETER ( wType );
+
+ // Set the focus to the Runtime Status dialog if it is not already
+ // set to it. Then, bug out, because the dialog will call us when
+ // the user finishes the dialog.
+
+ if ( ghModelessDialog ) {
+
+ if (( ! hWndFocus || IsChild ( ghWndFrame, hWndFocus ) ) &&
+ !IsIconic(ghWndFrame))
+ {
+ SetFocus ( ghModelessDialog );
+ }
+
+ return FAILURE;
+ }
+
+ // Release any tool bar item button up that was down.
+
+ MUI_SetOperationButtons ( RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetActionButtons ( RIB_ITEM_UP | RIB_ITEM_ENABLED );
+
+ gfOperation = FALSE;
+
+ // Now, force a screen update based on the last active doc type.
+
+ mwwLastDocType = ID_NOTDEFINED;
+
+ //
+ // This maybe a Kludge but it appears to work. When you double click on the
+ // system menu to close the app. in the middle of a backup it comes through
+ // this routine twice. The second time WM_GetInfoPtr ( WM_GetActiveDoc () )
+ // is NULL. Thus we place a check here. I placed the PostQuitMessage here
+ // because without it the app does not terminate properly and seem to be
+ // hung in the WinMain ... while ( GetMessage ... waiting for a message
+ // which it never gets, thus the app. hangs.
+ //
+
+ if ( !WM_GetInfoPtr ( WM_GetActiveDoc () ) ) { // chs:03-23-93
+ PostQuitMessage( 0 ); // chs:03-23-93
+ } else { // chs:03-23-93
+ MUI_ActivateDocument ( WMDS_GetWinType ( WM_GetInfoPtr ( WM_GetActiveDoc () ) ) ); // chs:03-23-93
+ } // chs:03-23-93
+
+ WM_SetAppIcon ( RSM_IconLoad ( IDRI_WNTRPARK ) );
+ WM_RestoreDocs ();
+
+ STM_SetIdleText ( IDS_READY );
+
+ // Check to see if we are to terminate the application. This will happen
+ // if a user or task killer told our app to terminate during an operation.
+
+ if ( gfTerminateApp && ! MUI_AnyQueuedOperations () ) {
+
+ MUI_Deinit ();
+ WM_TerminateApp ();
+ }
+ else {
+
+ // Check to see if any operations were queued up since the
+ // last operation.
+
+ if ( MUI_AnyQueuedOperations () ) {
+ MUI_ReleaseQueuedOperation ();
+ }
+ }
+
+ return SUCCESS;
+
+} /* end MUI_EnableOperations() */
+
+
+/******************************************************************************
+
+ Name: MUI_QueueOperation ()
+
+ Description:
+
+ Returns: TRUE, if successful. Otherwise, FALSE.
+
+******************************************************************************/
+
+BOOL MUI_QueueOperation (
+
+UINT nType ) // I - type of window being activated
+
+{
+ if ( mwnNumOperationsInQueue >= MAX_QUEUED_OPERATIONS ) {
+ return FALSE;
+ }
+
+ mwnQueuedOperationMsg = nType;
+ mwnNumOperationsInQueue++;
+
+ return TRUE;
+
+} /* MUI_QueueOperation () */
+
+
+/******************************************************************************
+
+ Name: MUI_ReleaseQueuedOperation ()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MUI_ReleaseQueuedOperation ( VOID )
+
+{
+ if ( mwnNumOperationsInQueue > 0 && mwnQueuedOperationMsg > 0 ) {
+
+ POST_WM_COMMAND_MSG ( ghWndFrame, (MSGID)mwnQueuedOperationMsg, 0, 0 );
+
+ mwnQueuedOperationMsg = 0;
+ mwnNumOperationsInQueue--;
+ }
+
+
+} /* MUI_ReleaseQueuedOperation () */
+
+
+/******************************************************************************
+
+ Name: MUI_AnyQueuedOperations ()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+BOOL MUI_AnyQueuedOperations ( VOID )
+
+{
+ return (BOOL)mwnNumOperationsInQueue;
+
+} /* MUI_AnyQueuedOperations () */
+
+
+/******************************************************************************
+
+ Name: MUI_ActivateDocument ()
+
+ Description: This function prepares the tool bar, menu and whatever else
+ needs preparation when a new document window becomes active.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MUI_ActivateDocument (
+
+WORD wType ) // I - type of window being activated
+
+{
+ WORD wTempType = wType;
+
+ if ( gfOperation ) {
+ return;
+ }
+
+ if ( wType == WMTYPE_DISKTREE || wType == WMTYPE_TAPETREE ) {
+ MUI_SetInfoAvailable ( TRUE );
+ }
+ else {
+ MUI_SetInfoAvailable ( FALSE );
+ }
+
+ // Break out the types later, if needed.
+
+ switch ( wType ) {
+
+ case WMTYPE_DISKS:
+ case WMTYPE_DISKTREE:
+ case WMTYPE_SERVERS:
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE :
+#endif
+
+ wType = WMTYPE_DISKS;
+
+ // If this is the same type of window, bug out.
+
+ if ( mwwLastDocType == wType ) {
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ // Enable/disable the information button.
+
+ if ( MUI_IsInfoAvailable () ) {
+ MUI_SetButtonState ( IDM_OPERATIONSINFO, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ }
+ else {
+ MUI_SetButtonState ( IDM_OPERATIONSINFO, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ }
+
+ }
+# endif // !defined ( OEM_MSOFT ) //unsupported feature
+
+ break;
+ }
+
+ // Enable all operation and action tool bar items.
+
+ MUI_SetOperationButtons ( RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetActionButtons ( RIB_ITEM_UP | RIB_ITEM_ENABLED );
+
+ // Enable/Disable appropriate tool bar items.
+
+ MUI_SetButtonState ( IDM_OPERATIONSBACKUP, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetButtonState ( IDM_OPERATIONSRESTORE, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ MUI_SetButtonState ( IDM_OPERATIONSTRANSFER, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ }
+# endif // !defined ( OEM_MSOFT ) //unsupported feature
+
+ break;
+
+ case WMTYPE_TAPES:
+ case WMTYPE_TAPETREE:
+ case WMTYPE_SEARCH:
+
+ wType = WMTYPE_TAPES;
+
+ // If this is the same type of window, bug out.
+
+ if ( mwwLastDocType == wType ) {
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ // Enable/disable the information button.
+
+ if ( MUI_IsInfoAvailable () ) {
+ MUI_SetButtonState ( IDM_OPERATIONSINFO, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ }
+ else {
+ MUI_SetButtonState ( IDM_OPERATIONSINFO, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ }
+
+ // Disable the Advanced button if this is a search window.
+
+ if ( wTempType == WMTYPE_SEARCH ) {
+ MUI_SetButtonState ( IDM_SELECTADVANCED, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ }
+ else {
+ MUI_SetButtonState ( IDM_SELECTADVANCED, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ }
+ }
+# endif // !defined ( OEM_MSOFT ) //unsupported feature
+
+ break;
+ }
+
+ // Enable all operation and action tool bar items.
+
+ MUI_SetOperationButtons ( RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetActionButtons ( RIB_ITEM_UP | RIB_ITEM_ENABLED );
+
+ // Enable/Disable appropriate tool bar items.
+
+ MUI_SetButtonState ( IDM_OPERATIONSBACKUP, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetButtonState ( IDM_OPERATIONSRESTORE, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ MUI_SetButtonState ( IDM_OPERATIONSTRANSFER, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+
+ // Disable the Advanced button if this is a search window.
+
+ if ( wTempType == WMTYPE_SEARCH ) {
+ MUI_SetButtonState ( IDM_SELECTADVANCED, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ }
+ }
+# endif // !defined ( OEM_MSOFT ) //unsupported feature
+
+ break;
+
+ case WMTYPE_DEBUG:
+ case WMTYPE_LOGFILES:
+ default:
+
+ wType = WMTYPE_DEBUG;
+
+ // If this is the same type of window, bug out.
+
+ if ( mwwLastDocType == wType ) {
+ break;
+ }
+
+ // Disable all action tool bar items.
+
+ MUI_SetOperationButtons ( RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetActionButtons ( RIB_ITEM_UP | RIB_ITEM_DISABLED );
+
+ // Enable/Disable appropriate tool bar items.
+
+ MUI_SetButtonState ( IDM_OPERATIONSBACKUP, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ MUI_SetButtonState ( IDM_OPERATIONSRESTORE, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ // Enable/disable the information button.
+
+ if ( MUI_IsInfoAvailable () ) {
+ MUI_SetButtonState ( IDM_OPERATIONSINFO, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ }
+ else {
+ MUI_SetButtonState ( IDM_OPERATIONSINFO, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+ }
+
+ MUI_SetButtonState ( IDM_SELECTADVANCED, RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL );
+
+ }
+# endif // !defined ( OEM_MSOFT ) //unsupported feature
+
+ break;
+
+ } /* end switch */
+
+ mwwLastDocType = wType;
+
+ STM_SetIdleText ( IDS_READY );
+
+} /* end MUI_ActivateDocument() */
+
+
+VOID MUI_TapeInDrive (
+
+BOOL fInDrive ) // I - flag indicating whether a tape is in the drive
+
+{
+ BOOL fTapeCurrentlyValid;
+ WORD wState;
+
+ // See if the tape in the drive is valid.
+
+ if ( VLM_GetDriveStatus ( NULL ) == VLM_VALID_TAPE ) {
+ fTapeCurrentlyValid = TRUE;
+ }
+ else {
+ fTapeCurrentlyValid = FALSE;
+ }
+
+ if ( ! gfOperation ) {
+
+ // Set all of the ribbon item states that are dependent upon a tape
+ // being in the drive, if the operation flag is not set.
+
+ if ( fInDrive != mwfTapeInDrive ) {
+
+ WORD wTempState;
+
+ if ( fInDrive ) {
+ wState = RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL;
+ }
+ else {
+ wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ }
+
+ MUI_SetButtonState ( IDM_OPERATIONSEJECT, wState );
+ MUI_SetButtonState ( IDM_OPERATIONSERASE, wState );
+
+ // Set catalog a tape button status
+
+ wTempState = (WORD)(( fTapeCurrentlyValid ) ? wState : RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL);
+ MUI_SetButtonState ( IDM_OPERATIONSCATALOG, wTempState );
+
+ wTempState = (WORD)(( thw_list ) ? (BOOL)( thw_list->drv_info.drv_features & TDI_RETENSION ) : FALSE );
+ wTempState = (WORD)(( wTempState ) ? wState : RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL);
+ MUI_SetButtonState ( IDM_OPERATIONSRETENSION, wTempState );
+
+ }
+ else if ( mwfTapeValid != fTapeCurrentlyValid ) {
+
+ // WHY DO WE HAVE TO DO THIS, MIKEP?
+
+ if ( fTapeCurrentlyValid ) {
+ wState = RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL;
+ }
+ else {
+ wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ }
+
+ MUI_SetButtonState ( IDM_OPERATIONSCATALOG, wState );
+ }
+
+ }
+
+ mwfTapeInDrive = fInDrive;
+ mwfTapeValid = fTapeCurrentlyValid;
+
+} /* end MUI_TapeInDrive() */
+
+
+BOOL MUI_IsTapeInDrive ( VOID )
+
+{
+ return ( ( gfPollDrive ) ? mwfTapeInDrive : gfHWInitialized );
+
+} /* end MUI_IsTapeInDrive() */
+
+
+BOOL MUI_IsEjectSupported ( VOID )
+
+{
+ return ( (thw_list && gfHWInitialized) ? (BOOL)( thw_list->drv_info.drv_features & TDI_UNLOAD ) : FALSE );
+
+} /* end MUI_IsEjectSupported() */
+
+
+VOID MUI_SetInfoAvailable (
+
+BOOL fAvailable )
+
+{
+
+ if ( fAvailable && QTC_AnySearchableBsets () ) {
+// if ( fAvailable && QTC_AnySearchableBsets () && VLM_IsInfoAvailable () ) {
+ mwfInfoAvailable = TRUE;
+ }
+ else {
+ mwfInfoAvailable = FALSE;
+ }
+
+} /* end MUI_SetInfoAvailable() */
+
+
+BOOL MUI_IsInfoAvailable ( VOID )
+
+{
+ return mwfInfoAvailable;
+
+} /* end MUI_IsInfoAvailable() */
+
+
+BOOL MUI_IsRetensionSupported ( VOID )
+
+{
+ return ( ( MUI_IsTapeInDrive () && thw_list ) ? (BOOL)( thw_list->drv_info.drv_features & TDI_RETENSION ) : FALSE );
+
+} /* end MUI_IsRetensionSupported() */
+
+
+BOOL MUI_IsTapeValid ( VOID )
+
+{
+ return (BOOL)( MUI_IsTapeInDrive () && mwfTapeValid );
+
+} /* end MUI_IsTapeValid() */
+
+
+/*****************************************************************************
+
+ Name: MUI_ProcessCommandLine ()
+
+ Description: This function processes the MUI part of the command line.
+
+ Returns: SUCCESS, if successful. Otherwise FAILURE, if there was
+ a problem.
+
+*****************************************************************************/
+
+BOOL MUI_ProcessCommandLine (
+
+LPSTR lpszCmdLine, // I - pointer to the command line string
+INT *pnCmdShow ) // I - pointer to the command show style integer
+
+{
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+
+ LPSTR pSubString;
+ LPSTR pIndex;
+ CHAR szTemp[10];
+
+ // Look for Jobs or Launched Jobs Now, but not both.
+
+ RSM_StringCopy ( IDS_JOBCOMMANDLINE, szTemp, sizeof ( szTemp ) );
+
+ pSubString = strstr ( lpszCmdLine, szTemp );
+
+ if ( pSubString ) {
+
+ CHAR chTerminator;
+
+ // Don't even allow poll drive to start.
+
+ // gfPollDrive = FALSE;
+
+ // Set the YYFLAG since this was started from the command line.
+
+ CDS_SetYesFlag ( CDS_GetPerm (), YESYES_FLAG );
+
+ pSubString += strlen ( szTemp );
+ pIndex = gpszJobName = (CHAR_PTR)calloc ( MAX_JOBNAME_LEN, sizeof ( CHAR ) );
+
+ // Extract the job name from the command line. Search for the
+ // job name terminator or the end of the command line string '\0'.
+ // The terminator is the same as the last character in the
+ // temporary string. In English it is the double-quote (").
+
+ chTerminator = *(pSubString - 1);
+
+ while ( ( *pSubString != chTerminator ) && ( *pSubString != TEXT('\0') ) ) {
+
+ *pIndex++ = *pSubString++;
+ }
+
+ pIndex = TEXT('\0');
+
+ // Get the show status of the job.
+
+ if ( JOB_IsIconic ( gpszJobName ) ) {
+ *pnCmdShow = SW_SHOWMINIMIZED;
+ }
+
+ }
+ else {
+
+ RSM_StringCopy ( IDS_SCHCOMMANDLINE, szTemp, sizeof ( szTemp ) );
+
+ pSubString = strstr ( lpszCmdLine, szTemp );
+
+ if ( pSubString ) {
+
+ // Don't even allow poll drive to start.
+
+ // gfPollDrive = FALSE;
+
+ // Set the YYFLAG since this was started from the command line.
+
+ CDS_SetYesFlag ( CDS_GetPerm (), YESYES_FLAG );
+
+ pSubString += strlen ( szTemp );
+
+ // Extract the job name index from the command line.
+
+ sscanf ( pSubString, TEXT("%d"), &nJobIndex );
+
+ // Get the show status of the job.
+
+ if ( SCH_IsJobIconic ( nJobIndex ) ) {
+ *pnCmdShow = SW_SHOWMINIMIZED;
+ }
+ }
+
+ // Pick up the unique key if specified. Only the launcher
+ // creates this entry.
+
+ RSM_StringCopy ( IDS_SCHUNIQUEKEY, szTemp, sizeof ( szTemp ) );
+
+ pSubString = strstr ( lpszCmdLine, szTemp );
+
+ if ( pSubString ) {
+
+ pSubString += strlen ( szTemp );
+
+ // Extract the unique key from the command line.
+
+ sscanf ( pSubString, TEXT("%ld"), &lSchedKey );
+
+
+ // THIS MAY NOT BE COMPLETE ?????
+ }
+ }
+
+ // Update the configuration copy now.
+
+ CDS_UpdateCopy ();
+
+ }
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+
+ return SUCCESS;
+
+} /* end MUI_ProcessCommandLine() */
+
+
+VOID MUI_AdvancedSelections ( VOID )
+
+{
+# if !defined ( OEM_MSOFT )
+ INT rc = DM_SHOWCANCEL;
+ PDS_WMINFO pdsWinInfo;
+ DS_ADVANCED_PTR pdsAdvanced;
+
+ pdsAdvanced = ( DS_ADVANCED_PTR ) calloc ( 1, sizeof ( DS_ADVANCED ) ) ;
+
+ // First, find out which dialog to show: tape or disk
+
+ pdsWinInfo = WM_GetInfoPtr( WM_GetActiveDoc () );
+
+ if ( ( pdsWinInfo->wType == WMTYPE_DISKTREE ) ||
+ ( pdsWinInfo->wType == WMTYPE_DISKS ) ||
+ ( pdsWinInfo->wType == WMTYPE_SERVERS ) ) {
+
+ rc = DM_ShowDialog ( ghWndFrame, IDD_SELECTADVANCED, (PVOID) pdsAdvanced ) ;
+
+ } else if ( ( pdsWinInfo->wType == WMTYPE_TAPETREE ) ||
+ ( pdsWinInfo->wType == WMTYPE_TAPES ) ) {
+
+ rc = DM_ShowDialog ( ghWndFrame, IDD_ADVRESTORE, (PVOID) pdsAdvanced ) ;
+ }
+
+ if ( rc == DM_SHOWOK ) {
+
+ // Call the VLM with the advanced selections structure, because
+ // the user made an advanced selection.
+
+ WM_ShowWaitCursor ( TRUE );
+ VLM_AddAdvancedSelection ( WM_GetActiveDoc (), pdsAdvanced );
+ WM_ShowWaitCursor ( FALSE );
+ }
+
+ free ( pdsAdvanced );
+
+ {
+ MUI_SetButtonState ( IDM_SELECTADVANCED, RIB_ITEM_UP | RIB_ITEM_ENABLED | RIB_ITEM_POSITIONAL );
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ STM_SetIdleText ( IDS_READY );
+
+} /* end MUI_AdvancedSelections() */
+
+
+/*****************************************************************************
+
+ Name: MUI_UISystemChange ()
+
+ Description: This function is called when there is a low level UI system
+ change.
+
+ Returns: Nothing.
+
+*****************************************************************************/
+
+VOID MUI_UISystemChange ( VOID )
+
+{
+ // Nothing is done at this time.
+
+} /* end MUI_UISystemChange() */
+
+
+/*****************************************************************************
+
+ Name: MUI_CheckPWDB ()
+
+ Description: This function is called to check for a pw on the pwdb.
+
+ Returns: gfPWForPWDBState
+
+*****************************************************************************/
+
+VOID MUI_CheckPWDB (
+
+CDS_PTR pCDS )
+
+{
+
+ // If the password database is enabled and a password for the
+ // database exists, prompt the user to enter the PW.
+
+ if ( CDS_GetEnablePasswordDbase( pCDS ) ) {
+
+ if ( IsThereADBPassword() ) {
+
+ CDS_SetYesFlag ( CDS_GetCopy (), NO_FLAG );
+ WM_ShowWaitCursor ( FALSE );
+
+ EnterDBPassword( pCDS, ghWndFrame, DBPW_ALLOW_NEW );
+
+ if ( gpszJobName ) {
+ CDS_SetYesFlag ( CDS_GetCopy (), YESYES_FLAG );
+ }
+ WM_ShowWaitCursor ( TRUE );
+
+ } else {
+
+ gfPWForPWDBState = DBPW_VERIFIED;
+
+ }
+
+ }
+
+} /* end MUI_CheckPWDB() */
+
+
+/*****************************************************************************
+
+ Name: MUI_ProcessQuotedString
+
+ Description: Accepts beginning of a string in quotes. It starts and will build
+ a string when it encounters the first quote and continues until it
+ hits another quote. Example: 1. "this
+ 2. is
+ 3. a
+ 4. test" = this is a test
+ (without the quotes)
+ In the above this routine is called FOUR time to build that string
+
+ Parameters: OutPutString - Built string from InPutString. Must be initially
+ empty.
+ InPutString - OutPutString is built from this
+ QuoteState - The very first time this routine is called
+ the lag must be FALSE.
+
+*****************************************************************************/
+
+VOID MUI_ProcessQuotedString ( LPSTR OutPutString,
+ LPSTR InPutString,
+ BOOLEAN *QuoteState )
+{
+ UINT16 lngth;
+
+ lngth = strlen( InPutString );
+ if ( lngth < 1 ) {
+ return;
+ }
+
+ if ( *( InPutString + lngth - 1 ) == TEXT( '"' ) ) {
+ if ( *QuoteState ) {
+ *( InPutString + lngth - 1 ) = TEXT( '\0' );
+ strcat( OutPutString, InPutString );
+ *QuoteState = *QuoteState ? FALSE : TRUE;
+ }
+ }
+
+ if ( *QuoteState ) {
+ strcat( OutPutString, InPutString );
+ }
+}
+
diff --git a/private/utils/ntbackup/src/muiconf.c b/private/utils/ntbackup/src/muiconf.c
new file mode 100644
index 000000000..37d2a6eaa
--- /dev/null
+++ b/private/utils/ntbackup/src/muiconf.c
@@ -0,0 +1,1483 @@
+
+/******************************************************************************
+
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: muiconf.c
+
+ Description: This file contains the functions for the GUI Configuration
+ Manager (CM).
+
+ $Log: G:\ui\logfiles\muiconf.c_v $
+
+ Rev 1.50.1.3 16 Jun 1994 15:26:14 STEVEN
+do not save cfg on exit
+
+ Rev 1.50.1.2 28 Jan 1994 11:16:52 GREGG
+More warning fixes.
+
+ Rev 1.50.1.1 24 Nov 1993 19:11:48 GREGG
+Added hardware compression option to backup dialog and config.
+
+ Rev 1.50.1.0 16 Nov 1993 15:39:08 BARRY
+Put TEXT aroung hard-coded strings
+
+ Rev 1.50 16 Aug 1993 14:43:38 GLENN
+Now setting the gfIgnoreOTC flag based on the opposite of UseTapeCatalogs INI value.
+
+ Rev 1.49 23 Jul 1993 12:20:26 GLENN
+Added Sytron ECC and Drive Settling Time support.
+
+ Rev 1.48 22 Jul 1993 19:11:36 MARINA
+enable c++
+
+ Rev 1.47 16 Jul 1993 10:40:44 GLENN
+Added UseTapeCatalog and SortOptions support.
+
+ Rev 1.46 23 May 1993 19:57:58 BARRY
+Unicode changes.
+
+ Rev 1.45 18 May 1993 14:51:34 GLENN
+Added tape settling time to hardware data struct init.
+
+ Rev 1.44 10 May 1993 13:59:38 MIKEP
+remove calls to openuserprofilemapping.
+
+ Rev 1.43 06 May 1993 17:16:32 chrish
+Added CAYMAN stuff will not affect Nostradamus. To do HW/SW compression
+stuff.
+
+ Rev 1.42 02 May 1993 15:30:12 MIKEP
+Add code to place the event message information into the registry at startup
+if it is not already there. Steve is fixing this in nostradamus at msoft
+by having the entries placed in the distributed registries. But cayman must
+add it's own.
+
+ Rev 1.41 30 Apr 1993 15:54:30 GLENN
+Added INI command line support.
+
+ Rev 1.40 27 Apr 1993 11:24:24 GLENN
+Added Search tapes with password, Search subdirs, log file prefix.
+
+ Rev 1.39 23 Apr 1993 08:52:12 MIKEP
+Change the ini path to be \software\conner for cayman instead
+of \software\microsoft.
+
+ Rev 1.38 19 Apr 1993 15:08:52 GLENN
+Fixed registry string logic.
+
+ Rev 1.37 17 Apr 1993 17:20:58 MIKEP
+add ini to registry
+
+ Rev 1.36 05 Apr 1993 13:33:52 GLENN
+Starting debug window in normal position.
+
+ Rev 1.35 06 Jan 1993 10:17:16 GLENN
+Miscellaneous window validations.
+
+ Rev 1.34 04 Jan 1993 14:38:06 GLENN
+Added File Details and Search Limit items.
+
+ Rev 1.33 23 Dec 1992 15:41:58 GLENN
+Added all file details, runtime dlg pos saving, search limit, FAT drive lower case display.
+
+ Rev 1.32 18 Nov 1992 13:05:38 GLENN
+Added initialization states for frame and disk windows.
+
+ Rev 1.31 11 Nov 1992 16:33:28 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.30 05 Nov 1992 17:09:42 DAVEV
+fix ts
+
+ Rev 1.28 30 Oct 1992 15:47:12 GLENN
+Added Frame and MDI Doc window size and position saving and restoring.
+
+ Rev 1.27 14 Oct 1992 15:53:36 GLENN
+Added Font selection to Config and INI.
+
+ Rev 1.26 07 Oct 1992 14:11:52 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.25 04 Oct 1992 19:39:14 DAVEV
+Unicode Awk pass
+
+ Rev 1.24 17 Sep 1992 17:40:36 DAVEV
+minor fix (strsiz->strsize)
+
+ Rev 1.23 17 Sep 1992 15:51:10 DAVEV
+UNICODE modifications: strlen usage check
+
+ Rev 1.22 08 Sep 1992 14:06:10 STEVEN
+fix warnings for NT
+
+ Rev 1.21 19 Aug 1992 14:31:42 CHUCKB
+Changed for NT.
+
+ Rev 1.20 06 Aug 1992 22:01:00 MIKEP
+add support for tape drive name for nt
+
+ Rev 1.19 29 Jul 1992 14:14:26 GLENN
+ChuckB checked in after NT fixes.
+
+ Rev 1.18 30 Jun 1992 13:16:12 JOHNWT
+added enable stats flag
+
+ Rev 1.17 10 Jun 1992 16:53:32 DAVEV
+OEM_MSOFT: force Prompt before overwite existing files
+
+ Rev 1.16 10 Jun 1992 10:43:48 STEVEN
+change NULL to 0
+
+ Rev 1.15 15 May 1992 16:48:12 MIKEP
+incl_cds removal
+
+ Rev 1.14 14 May 1992 18:00:36 MIKEP
+nt pass 2
+
+ Rev 1.13 01 Apr 1992 09:47:34 JOHNWT
+key creation of config on existence of debug info
+
+ Rev 1.12 20 Mar 1992 17:23:16 GLENN
+Added std mode warning config option.
+
+ Rev 1.11 18 Mar 1992 14:13:54 JOHNWT
+commented out write of PWD entries
+
+ Rev 1.10 27 Feb 1992 11:15:42 JOHNWT
+wait/skip files change
+
+ Rev 1.9 27 Feb 1992 08:37:50 GLENN
+Added SetupExePath and ChangeToExeDir.
+
+ Rev 1.8 23 Feb 1992 13:46:06 GLENN
+Moved INI util functions to confmisc.c
+
+ Rev 1.7 27 Jan 1992 12:51:16 GLENN
+Changed hardware config init status.
+
+ Rev 1.6 24 Jan 1992 14:50:48 GLENN
+Updated the get hardware config function.
+
+ Rev 1.5 20 Jan 1992 09:42:10 GLENN
+Moved data path verification to verify functions.
+
+ Rev 1.4 14 Jan 1992 08:16:44 GLENN
+Added Sort BSD support.
+
+ Rev 1.3 10 Jan 1992 11:18:42 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.2 07 Jan 1992 17:29:00 GLENN
+Added catalog data path support
+
+ Rev 1.1 04 Dec 1991 18:43:10 GLENN
+Added machine type references.
+
+ Rev 1.0 20 Nov 1991 19:30:56 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#ifdef TDEMO
+#define CMI_ARCBIT 0
+#define CMI_REMOTE 1
+#else
+#define CMI_ARCBIT 1
+#define CMI_REMOTE 0
+#endif
+
+#define CDS_TOKENS TEXT(", ")
+
+#define TOKEN_WINSIZE 1
+#define TOKEN_WINSHOW 2
+#define TOKEN_WINSLIDER 3
+
+// VARIABLE DECLARATIONS
+
+CDS PermCDS;
+CDS TempCDS;
+BE_CFG_PTR pPermBEC;
+
+
+// PRIVATE FUNCTION PROTOTYPES
+
+VOID CDS_GetUIConfig ( VOID );
+VOID CDS_GetDisplayConfig ( VOID );
+VOID CDS_GetLoggingConfig ( VOID );
+VOID CDS_GetDebugConfig ( VOID );
+VOID CDS_GetBEConfig ( VOID );
+INT CDS_GetToken ( WORD, LPSTR );
+
+VOID CDS_CreateConfigFile ( VOID );
+VOID CDS_SaveCDS ( VOID );
+VOID CDS_SaveUIConfig ( VOID );
+VOID CDS_SaveBEConfig ( VOID );
+
+#ifdef OS_WIN32
+
+INT CDS_CheckRegistryForIniMappings( VOID );
+INT CDS_CheckRegistryForEventMappings( VOID );
+
+/**************************************************************************
+
+ Name: CDS_CheckRegistryForEventMappings ()
+
+ Description: Check the registry to see if it knows about us already.
+
+ Returns: Nothing.
+
+**************************************************************************/
+
+INT CDS_CheckRegistryForEventMappings( )
+{
+ HKEY Key;
+ LONG Status;
+ DWORD Disposition;
+ DWORD Types = (DWORD)0x07;
+ INT KeyFound = FALSE;
+ CHAR path[ 256 ];
+
+ Status = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+#ifdef OEM_MSOFT
+ TEXT("System\\CurrentControlSet\\Services\\EventLog\\Application\\Ntbackup.ini"),
+#else
+ TEXT("System\\CurrentControlSet\\Services\\EventLog\\Application\\Bewinnt"),
+#endif
+ (DWORD)0,
+ (LPTSTR)TEXT(""),
+ REG_OPTION_NON_VOLATILE,
+ MAXIMUM_ALLOWED,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ &Key,
+ &Disposition );
+
+
+
+ if ( Status != ERROR_SUCCESS ) {
+
+ return( FAILURE );
+ }
+
+
+ strcpy( path, CDS_GetExePath() );
+ strcat( path, gb_exe_fname );
+
+ // Add our string to it.
+
+ Status = RegSetValueEx( Key,
+ TEXT("EventMessageFile"),
+ (DWORD)0,
+ REG_SZ,
+ (LPBYTE)path,
+ (DWORD)(strsize(path) * sizeof(CHAR) ) );
+
+ if ( Status != ERROR_SUCCESS ) {
+ RegCloseKey( Key );
+ return( FAILURE );
+ }
+
+ // Add our string to it.
+
+ Status = RegSetValueEx( Key,
+ TEXT("TypesSupported"),
+ (DWORD)0,
+ REG_DWORD,
+ (LPBYTE)&Types,
+ (DWORD)sizeof( DWORD ) );
+
+ if ( Status != ERROR_SUCCESS ) {
+ RegCloseKey( Key );
+ return( FAILURE );
+ }
+
+
+ RegCloseKey( Key );
+
+ return( SUCCESS );
+}
+
+/**************************************************************************
+
+ Name: CDS_CheckRegistryForIniMappings ()
+
+ Description: Check the registry to see if it knows about us already.
+
+ Returns: Nothing.
+
+**************************************************************************/
+
+INT CDS_CheckRegistryForIniMappings( )
+{
+ HKEY Key;
+ LONG Status;
+ DWORD Disposition;
+ INT KeyFound = FALSE;
+
+#ifdef OEM_MSOFT
+ CHAR String[] = TEXT("#USR:Software\\Microsoft\\Ntbackup");
+#else
+ CHAR String[] = TEXT("#USR:Software\\Conner\\Bewinnt");
+#endif
+
+ // ********************************************************
+ //
+ // First Do Machine Specific Part
+ //
+ // ********************************************************
+
+ Status = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+#ifdef OEM_MSOFT
+ TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\Ntbackup.ini"),
+#else
+ TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\Bewinnt.ini"),
+#endif
+ (DWORD)0,
+ (LPTSTR)TEXT(""),
+ REG_OPTION_NON_VOLATILE,
+ MAXIMUM_ALLOWED,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ &Key,
+ &Disposition );
+
+
+
+ if ( Status != ERROR_SUCCESS ) {
+
+ return( FAILURE );
+ }
+
+
+ if ( Disposition == REG_CREATED_NEW_KEY ) {
+
+
+ // Add our string to it.
+
+ Status = RegSetValueEx( Key,
+ TEXT(""),
+ (DWORD)0,
+ REG_SZ,
+ (LPBYTE)String,
+ (DWORD)(strsize(String) * sizeof(CHAR) ) );
+
+ if ( Status != ERROR_SUCCESS ) {
+ RegCloseKey( Key );
+ return( FAILURE );
+ }
+
+ }
+
+ RegCloseKey( Key );
+
+ // ********************************************************
+ //
+ // Then Do User Specific Part
+ //
+ // ********************************************************
+
+ Status = RegCreateKeyEx( HKEY_CURRENT_USER,
+#ifdef OEM_MSOFT
+ TEXT("Software\\Microsoft\\Ntbackup"),
+#else
+ TEXT("Software\\Conner\\Bewinnt"),
+#endif
+ (DWORD)0,
+ (LPTSTR)TEXT(""),
+ REG_OPTION_NON_VOLATILE,
+ MAXIMUM_ALLOWED,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ &Key,
+ &Disposition );
+
+ if ( Status != ERROR_SUCCESS ) {
+
+ return( FAILURE );
+ }
+
+ RegCloseKey( Key );
+
+
+ return( SUCCESS );
+}
+
+#endif
+
+
+/******************************************************************************
+
+ Name: CDS_Init ()
+
+ Description: Initializes the perm CDS from the private profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_Init ( VOID )
+
+{
+ INT nNumControllers;
+
+
+#ifdef OS_WIN32
+
+ if ( ! CDS_UsingCmdLineINI () ) {
+
+ CDS_CheckRegistryForIniMappings();
+ }
+
+#endif
+
+ // Set up the exe path and file name.
+
+ CDS_SetupExePath ();
+
+#ifdef OS_WIN32
+ CDS_CheckRegistryForEventMappings();
+#endif
+
+ // The loading of the INI name is NOW DONE IN GUI.C for
+ // multiple INI file support.
+
+ // Set the known defaults.
+
+ CDS_SetChangedConfig ( &PermCDS, FALSE );
+ CDS_SetDefaultDriveList ( &PermCDS, NULL );
+ CDS_SetYesFlag ( &PermCDS, NO_FLAG );
+ CDS_SetEraseFlag ( &PermCDS, ERASE_OFF );
+ CDS_SetTransferFlag ( &PermCDS, FALSE );
+ CDS_SetAdvToConfig ( &PermCDS, FALSE );
+
+ // Get and validate the Maynard data path. Do this by first stuffing
+ // the path read from the .INI file into the Temporary CDS, then making
+ // sure that a '\' is appended to the end of the path. This is
+ // accomplished by calling CDS_SetUserDataPath().
+
+ CDS_ReadUserDataPath ( &PermCDS );
+ CDS_ValidateUserDataPath ( CDS_GetUserDataPath () );
+ CDS_SetMaynFolder ( CDS_GetUserDataPath () );
+
+ // Validate the catalog data path.
+
+ CDS_ReadCatDataPath ( &PermCDS );
+ CDS_ValidateCatDataPath ( CDS_GetCatDataPath () );
+
+ // Set the Update password database filename.
+
+ RSM_StringCopy ( IDS_PWDFILENAME,
+ CDS_GetPwDbaseFname ( &PermCDS ),
+ MAX_UI_FILENAME_SIZE );
+
+ // Initialize the backup engine configuration unit.
+
+ BEC_Init ();
+
+ // Create the global permanent backup engine configuration structure.
+ // Lock the BEC to make sure that it does not get destroyed.
+
+ pPermBEC = PermCDS.pPermBEC = BEC_CloneConfig ( NULL );
+
+ BEC_LockConfig ( pPermBEC );
+
+ // Get the different config stuff
+
+ CDS_GetUIConfig ();
+ CDS_GetDisplayConfig ();
+ CDS_GetLoggingConfig ();
+
+ // If there are no configured controllers for this driver or the driver
+ // is invalid based on initializing the DIL HWD, then we want to advance
+ // to the hardware settings dialog by setting the flag.
+
+ PermCDS.pHWParms = (HWPARMS_PTR)calloc ( 1, sizeof ( HWPARMS ) );
+
+ nNumControllers = CDS_GetHardwareConfig ( CDS_GetActiveDriver ( &PermCDS ), PermCDS.pHWParms );
+
+ if ( ! nNumControllers || HWC_InitDILHWD ( &gb_dhw_ptr, &nNumControllers ) ) {
+
+ CDS_SetAdvToConfig ( &PermCDS, 1 );
+ }
+
+ // Reset the global DIL HWD pointer.
+
+ gb_dhw_ptr = (DIL_HWD_PTR)NULL;
+
+ CDS_GetDebugConfig ();
+ CDS_GetBEConfig ();
+
+ gfIgnoreOTC = ! CDS_GetUseTapeCatalogs ( &PermCDS );
+
+ // Update the temporary config from permanent.
+
+ CDS_UpdateCopy( ) ;
+
+ // if no debug info is in the config, we assume this is an incomplete
+ // config and write out the complete file
+
+ if ( CDS_GetInt ( CMS_DEBUG, CMS_DEBUGFLAG, 0xFFFF ) == 0xFFFF ) {
+
+ CDS_CreateConfigFile ();
+ }
+
+ CDS_ChangeToExeDir ();
+
+ return ;
+
+} /* end CDS_Init() */
+
+
+/******************************************************************************
+
+ Name: CDS_Deinit ()
+
+ Description: Deinitializes and saves the CDS and BEC.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_Deinit ( VOID )
+
+{
+ // Save the CDS and BEC configurations.
+
+#ifndef OEM_MSOFT
+ CDS_SaveCDS ();
+#endif
+ // Release the permanent BEC memory and close the BEC.
+
+ BEC_UnLockConfig ( pPermBEC );
+ BEC_ReleaseConfig ( pPermBEC );
+ BEC_Close ();
+
+} /* end CDS_Deinit() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetUIConfig ()
+
+ Description: Gets the UI config from the private profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_GetUIConfig ( VOID )
+
+{
+ CHAR szDefDrivesLine[CDS_STRLEN];
+ CHAR szDriveName[CDS_STRLEN];
+ CHAR_PTR p;
+ CHAR_PTR pLine;
+ DEF_DRIVE_ENTRY *pNewDriveEntry ;
+ DEF_DRIVE_ENTRY *pNextDriveEntry ;
+
+ // Read the UI config from the INI file.
+
+ CDS_ReadOutputDest ( &PermCDS );
+ CDS_ReadFilesFlag ( &PermCDS );
+ CDS_ReadPasswordFlag ( &PermCDS );
+ CDS_ReadCreateSkipped ( &PermCDS );
+ CDS_ReadDisplayNetwareServers ( &PermCDS );
+ CDS_ReadAutoVerifyBackup ( &PermCDS );
+ CDS_ReadAutoVerifyRestore ( &PermCDS );
+ CDS_ReadEnablePasswordDbase ( &PermCDS );
+ CDS_ReadMaxPwDbaseSize ( &PermCDS );
+ CDS_ReadAppendFlag ( &PermCDS );
+ CDS_ReadCatalogLevel ( &PermCDS );
+
+# if defined ( OEM_MSOFT ) // no user selection for restore over existing
+ {
+ CDS_SetDisplayNetwareServers ( &PermCDS, CDS_DISABLE );
+ CDS_SetRestoreExistingFiles ( &PermCDS, PROMPT_RESTORE_OVER_EXISTING );
+ }
+# else //if defined ( OEM_MSOFT ) // no user selection for restore over existing
+ {
+ CDS_ReadDisplayNetwareServers ( &PermCDS );
+ CDS_ReadRestoreExistingFiles ( &PermCDS );
+ }
+# endif //defined ( OEM_MSOFT ) // no user selection for restore over existing
+
+ CDS_ReadBackupCatalogs ( &PermCDS );
+ CDS_ReadLauncherFlag ( &PermCDS );
+ CDS_ReadIncludeSubdirs ( &PermCDS );
+ CDS_ReadDefaultBackupType ( &PermCDS );
+ CDS_ReadEjectTapeFlag ( &PermCDS );
+
+# if defined ( OEM_MSOFT ) // no stats
+ {
+ CDS_SetEnableStatsFlag ( &PermCDS, CDS_DISABLE );
+ }
+# else
+ {
+ CDS_ReadEnableStatsFlag ( &PermCDS );
+ }
+# endif //defined ( OEM_MSOFT )
+
+ CDS_ReadSearchLimit ( &PermCDS );
+ CDS_ReadSearchPwdTapes ( &PermCDS );
+ CDS_ReadSearchSubdirs ( &PermCDS );
+ CDS_ReadUseTapeCatalogs ( &PermCDS );
+
+ CDS_ReadWaitTime ( &PermCDS );
+ CDS_ReadStdModeWarning ( &PermCDS );
+
+ // If no groupname was found in the config file, get the default group
+ // name from the resources.
+
+ if ( ! CDS_ReadGroupName ( &PermCDS ) ) {
+ RSM_StringCopy ( IDS_APPNAME, CDS_GetGroupName (&PermCDS), MAX_GROUPNAME_SIZE );
+ }
+
+
+ // Create the default drives list.
+
+ CDS_GetString ( CMS_UI, CMS_DEFDRIVES, TEXT("C"), szDefDrivesLine, CDS_STRLEN );
+
+ pLine = szDefDrivesLine;
+
+ while ( *pLine != TEXT('\0') ) {
+
+ CDS_SkipBlanks ( pLine );
+
+ if ( *pLine != TEXT('\0') ) {
+
+ pNewDriveEntry = (DEF_DRIVE_ENTRY_PTR)malloc( sizeof( DEF_DRIVE_ENTRY ) );
+ pNewDriveEntry->next = NULL ;
+
+ // Get drive name.
+
+ p = szDriveName ;
+
+ // Copy the drive name into the szDriveName buffer.
+
+ while ( ( *pLine != TEXT(' ') ) && ( *pLine != TEXT('\0') ) ) {
+ *p = *pLine;
+ p++;
+ pLine++;
+ }
+
+ *p = TEXT('\0') ;
+
+ pNewDriveEntry->drive_name = (CHAR_PTR)malloc( strsize( szDriveName ) );
+ strcpy( pNewDriveEntry->drive_name, szDriveName ) ;
+
+ // Add to default drive list.
+
+ if ( CDS_GetDefaultDriveList ( &PermCDS ) == NULL ) {
+ CDS_SetDefaultDriveList ( &PermCDS, pNewDriveEntry );
+ }
+ else {
+
+ // Put the new entry at the end of the list.
+
+ pNextDriveEntry = CDS_GetDefaultDriveList ( &PermCDS );
+
+ while ( pNextDriveEntry->next != NULL ) {
+ pNextDriveEntry = pNextDriveEntry->next;
+ }
+
+ pNextDriveEntry->next = pNewDriveEntry;
+ }
+ }
+ }
+
+} /* end CDS_GetUIConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetDisplayConfig ()
+
+ Description: Gets the display config from the private profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_GetDisplayConfig ( VOID )
+
+{
+ CDS_ReadShowMainRibbon ( &PermCDS );
+ CDS_ReadShowStatusLine ( &PermCDS );
+
+ CDS_ReadFontFace ( &PermCDS );
+ CDS_ReadFontSize ( &PermCDS );
+ CDS_ReadFontWeight ( &PermCDS );
+ CDS_ReadFontCase ( &PermCDS );
+ CDS_ReadFontCaseFAT ( &PermCDS );
+ CDS_ReadFontItalics ( &PermCDS );
+ CDS_ReadFileDetails ( &PermCDS );
+ CDS_ReadSortOptions ( &PermCDS );
+
+ // Add the MDI Doc Window coordinates to this list in the NEXT release.
+ // This time has arrived. Take a look.
+
+ if ( ! CDS_GetWinSize ( CMS_FRAMEWINDOW, &(PermCDS.frame_info) ) ) {
+ PermCDS.frame_info.x = 0;
+ PermCDS.frame_info.y = 0;
+ PermCDS.frame_info.nSize = 0;
+ }
+
+ if ( ! CDS_GetWinSize ( CMS_DISKWINDOW, &(PermCDS.disk_info) ) ) {
+ PermCDS.disk_info.x = 0;
+ PermCDS.disk_info.y = 0;
+ PermCDS.disk_info.nSize = 0;
+ }
+
+ CDS_GetWinSize ( CMS_SERVERWINDOW, &(PermCDS.server_info) );
+ CDS_GetWinSize ( CMS_TAPEWINDOW, &(PermCDS.tape_info) );
+ CDS_GetWinSize ( CMS_LOGWINDOW, &(PermCDS.log_info) );
+
+ if ( ! CDS_GetWinSize ( CMS_DEBUGWINDOW, &(PermCDS.debug_info) ) ) {
+ PermCDS.debug_info.nSize = 0;
+ }
+
+ if ( ! CDS_GetWinSize ( CMS_RUNTIMEDLG, &(PermCDS.runtime_info) ) ) {
+ PermCDS.runtime_info.nSize = WM_DEFAULT;
+ }
+
+
+} /* end CDS_GetDisplayConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetWinSize ()
+
+ Description: Gets the size of the window.
+
+ Returns: TRUE, if the config line was found, otherwise, FALSE.
+
+******************************************************************************/
+
+BOOL CDS_GetWinSize (
+
+LPSTR szType,
+PWINSIZE pWinSize )
+
+{
+ CHAR szTokens[MAX_UI_RESOURCE_SIZE];
+ BOOL fFound;
+
+ fFound = (BOOL)CDS_ReadWindowSize ( szType, szTokens );
+
+ pWinSize->x = CDS_GetToken ( TOKEN_WINSIZE, (LPSTR)szTokens );
+ pWinSize->y = CDS_GetToken ( TOKEN_WINSIZE, (LPSTR)NULL );
+ pWinSize->cx = CDS_GetToken ( TOKEN_WINSIZE, (LPSTR)NULL );
+ pWinSize->cy = CDS_GetToken ( TOKEN_WINSIZE, (LPSTR)NULL );
+ pWinSize->nSize = CDS_GetToken ( TOKEN_WINSHOW, (LPSTR)NULL );
+ pWinSize->nSliderPos = CDS_GetToken ( TOKEN_WINSLIDER, (LPSTR)NULL );
+
+ return fFound;
+
+} /* end CDS_GetWinSize() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetLoggingConfig ()
+
+ Description: Gets the logging config from the private profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_GetLoggingConfig ( VOID )
+
+{
+ CDS_ReadLogFileRoot ( &PermCDS );
+ CDS_ReadNumLogSessions ( &PermCDS );
+ CDS_ReadLogLevel ( &PermCDS );
+ CDS_ReadLogMode ( &PermCDS );
+ CDS_ReadPrintLogSession ( &PermCDS );
+
+} /* end CDS_GetLoggingConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetHardwareConfig ()
+
+ Description: Gets the hardware config from the private profile file.
+
+ Returns: The number of cards configured for this driver.
+
+******************************************************************************/
+
+INT CDS_GetHardwareConfig (
+
+LPSTR lpDriverName, // I - device driver name of controller configuration
+HWPARMS_PTR pCallerHW ) // I - pointer to the callers HW Parms
+
+{
+ CHAR szDriverConfig[40];
+ INT nNumControllers = 0; // number of controllers
+ BOOL fDone=FALSE;
+ WORD wStatus;
+ HWPARMS_PTR pHW;
+ HWPARMS_PTR pTempHW;
+
+ // Get the device driver name.
+
+#ifdef OS_WIN32
+ CDS_ReadTapeDriveName ( &PermCDS );
+#endif
+
+ CDS_ReadActiveDriver ( &PermCDS );
+
+ CDS_ReadHWCompMode ( &PermCDS ); // chs:05-06-93
+#ifndef OEM_MSOFT // chs:05-06-93
+ CDS_ReadSWCompMode ( &PermCDS ); // chs:05-06-93
+#endif // chs:05-06-93
+
+ CDS_ReadTapeDriveSettlingTime ( &PermCDS );
+
+ // TEMP STUFF
+
+ // Now, grab all of the controller lines in the configuration file.
+
+ while ( ! fDone ) {
+
+ sprintf ( szDriverConfig, TEXT("%s %s %d"), lpDriverName, CMS_CONTROLLER, nNumControllers );
+
+ wStatus = CDS_GetInt ( szDriverConfig, CMS_STATUS, 0xFFFF );
+
+ // If we have at least one controller and the status is invalid,
+ // we are done.
+
+ if ( nNumControllers && wStatus > 2 ) {
+
+ fDone = TRUE;
+ }
+ else {
+
+ // If there was a previous hardware parms structure, set the next
+ // pointer to the newly malloc'd structure.
+ // Otherwise, set the Hardware parms Config Pointer to point
+ // to the newly allocated structure.
+
+ if ( nNumControllers ) {
+ pHW->pNext = pTempHW = (HWPARMS_PTR)malloc ( sizeof ( HWPARMS ) );
+ }
+ else {
+ pTempHW = pCallerHW;
+ }
+
+ pHW = pTempHW;
+
+ pHW->wStatus = IDS_HWC_TESTED_NOT;
+ pHW->wCardID = CDS_GetInt ( szDriverConfig, CMS_CARDID, 0xFFFF );
+ pHW->wDrives = CDS_GetInt ( szDriverConfig, CMS_DRIVES, 0 );
+ pHW->wSlot = CDS_GetInt ( szDriverConfig, CMS_SLOT, 0 );
+ pHW->wTargets = CDS_GetInt ( szDriverConfig, CMS_TARGETS, 0xFFFF );
+
+ // Now get the device dependent parameters.
+
+ // ????? Temp hardcoded addr, irq, dma.
+
+ pHW->nNumParms = 3;
+
+ pHW->ulAddr = CDS_GetLongInt ( szDriverConfig, CMS_ADDR, 0xFFFFFFFF );
+ pHW->ulIRQ = CDS_GetLongInt ( szDriverConfig, CMS_IRQ, 0xFFFFFFFF );
+ pHW->ulDMA = CDS_GetLongInt ( szDriverConfig, CMS_DMA, 0xFFFFFFFF );
+
+ pHW->pNext = (HWPARMS_PTR)NULL;
+
+ // If this is the first controller and we have an invalid
+ // status, we have now set-up an autodetermine scenario.
+
+ if ( ! nNumControllers && wStatus == 0xFFFF ) {
+ return nNumControllers;
+ }
+
+ // Increment the controller count.
+
+ nNumControllers++;
+ }
+
+ } /* end while() */
+
+ return nNumControllers;
+
+} /* end CDS_GetHardwareConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetDebugConfig ()
+
+ Description: Gets the Debugging config from the private profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_GetDebugConfig ( VOID )
+
+{
+ CDS_ReadDebugFlag ( &PermCDS );
+ CDS_ReadDebugToFile ( &PermCDS );
+ CDS_ReadDebugToWindow ( &PermCDS );
+ CDS_ReadDebugWindowShowAll ( &PermCDS );
+ CDS_ReadDebugWindowNumLines ( &PermCDS );
+ CDS_ReadDebugFileName ( &PermCDS );
+ CDS_ReadPollFrequency ( &PermCDS );
+
+
+} /* end CDS_GetDebugConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_GetBEConfig ()
+
+ Description: Gets the BEC config from the private profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_GetBEConfig ( VOID )
+
+{
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ // The following two are not used by our app.
+
+ CDS_SetReserveMem ( pCDS, 0 );
+ //CDS_SetPartList ( pCDS, 0L );
+
+ // Default the restore security off.
+
+ CDS_SetRestoreSecurity ( pCDS, FALSE );
+
+ // Read the following BENGINE stuff from the INI file.
+
+ CDS_ReadSpecialWord ( pCDS );
+ CDS_ReadMaxTapeBuffers ( pCDS );
+ CDS_ReadTFLBuffSize ( pCDS );
+ CDS_ReadMaxBufferSize ( pCDS );
+ CDS_ReadSkipOpenFiles ( pCDS );
+ CDS_ReadBackupFilesInUse ( pCDS );
+ CDS_ReadAFPSupport ( pCDS );
+ CDS_ReadExtendedDateSupport ( pCDS );
+
+ CDS_ReadHiddenFlag ( pCDS );
+ CDS_ReadSpecialFlag ( pCDS );
+ CDS_ReadSetArchiveFlag ( pCDS );
+ CDS_ReadProcEmptyFlag ( pCDS );
+ CDS_ReadExistFlag ( pCDS );
+ CDS_ReadPromptFlag ( pCDS );
+ CDS_ReadNetNum ( pCDS );
+ CDS_ReadSortBSD ( pCDS );
+
+ CDS_ReadRemoteDriveBackup ( pCDS );
+ CDS_ReadFastFileRestore ( pCDS );
+
+#if !defined( OEM_MSOFT )
+ CDS_ReadWriteFormat ( pCDS );
+ CDS_ReadNRLDosVector ( pCDS );
+#endif
+
+ CDS_ReadConfiguredMachineType ( pCDS );
+ CDS_ReadProcessSytronECCFlag ( pCDS );
+
+ // Make sure we do not have a bogus machine type.
+
+ switch ( CDS_GetConfiguredMachineType ( pCDS ) ) {
+
+ case UNKNOWN_MACHINE:
+ case IBM_PS2:
+ case IBM_PC:
+ case IBM_XT_OR_PC_PORTABLE:
+ case IBM_PC_JR:
+ case IBM_AT:
+ break;
+
+ default:
+ CDS_SetConfiguredMachineType ( pCDS, UNKNOWN_MACHINE );
+ break;
+ }
+
+ CDS_ReadOTCLevel ( pCDS );
+
+
+} /* end CDS_GetBEConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_CreateConfigFile ()
+
+ Description: Saves GUI config data structure and BENGINE config data
+ structure to private a profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_CreateConfigFile ( VOID )
+
+{
+ CDS_SaveUIConfig ();
+ CDS_SaveDisplayConfig ();
+ CDS_SaveLoggingConfig ();
+ CDS_SaveDebugConfig ();
+ CDS_SaveBEConfig ();
+
+ CDS_WriteHWCompMode ( &PermCDS ); // chs:05-06-93
+#ifndef OEM_MSOFT // chs:05-06-93
+ CDS_WriteSWCompMode ( &PermCDS ); // chs:05-06-93
+#endif // chs:05-06-93
+
+ CDS_WriteTapeDriveSettlingTime ( &PermCDS );
+
+} /* end CDS_CreateConfigFile() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveCDS ()
+
+ Description: Saves GUI config data structure to private profile file
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_SaveCDS ( VOID )
+
+{
+ if ( CDS_GetChangedConfig ( &PermCDS ) ) {
+
+ CDS_SaveUIConfig ();
+ CDS_SaveBEConfig ();
+ }
+
+ CDS_SaveDisplayConfig ();
+
+ return ;
+
+} /* end CDS_SaveCDS() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveUIConfig ()
+
+ Description: Saves UI config data structure to private profile file.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID CDS_SaveUIConfig ()
+
+{
+ // Write the UI config
+
+#ifdef OS_WIN32
+ CDS_WriteTapeDriveName ( &PermCDS );
+#endif
+ CDS_WriteOutputDest ( &PermCDS );
+ CDS_WriteFilesFlag ( &PermCDS );
+ CDS_WritePasswordFlag ( &PermCDS );
+ CDS_WriteCreateSkipped ( &PermCDS );
+ CDS_WriteDisplayNetwareServers ( &PermCDS );
+ CDS_WriteAutoVerifyBackup ( &PermCDS );
+ CDS_WriteAutoVerifyRestore ( &PermCDS );
+ CDS_WriteEnablePasswordDbase ( &PermCDS );
+// CDS_WriteMaxPwDbaseSize ( &PermCDS );
+ CDS_WriteAppendFlag ( &PermCDS );
+ CDS_WriteCatalogLevel ( &PermCDS );
+ CDS_WriteRestoreExistingFiles ( &PermCDS );
+ CDS_WriteBackupCatalogs ( &PermCDS );
+ CDS_WriteLauncherFlag ( &PermCDS );
+ CDS_WriteIncludeSubdirs ( &PermCDS );
+ CDS_WriteDefaultBackupType ( &PermCDS );
+ CDS_WriteEjectTapeFlag ( &PermCDS );
+ CDS_WriteEnableStatsFlag ( &PermCDS );
+ CDS_WriteSearchLimit ( &PermCDS );
+ CDS_WriteSearchPwdTapes ( &PermCDS );
+ CDS_WriteSearchSubdirs ( &PermCDS );
+ CDS_WriteUseTapeCatalogs ( &PermCDS );
+ CDS_WriteWaitTime ( &PermCDS );
+ CDS_WriteStdModeWarning ( &PermCDS );
+
+
+
+ // DEFAULT DRIVES ?????
+ // PASSWORD ?????
+
+} /* end CDS_SaveUIConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveDisplayConfig ()
+
+ Description: Saves config data structure to private profile file.
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_SaveDisplayConfig ()
+
+{
+ CDS_WriteShowMainRibbon ( &PermCDS );
+ CDS_WriteShowStatusLine ( &PermCDS );
+
+ CDS_WriteFontFace ( &PermCDS );
+ CDS_WriteFontSize ( &PermCDS );
+ CDS_WriteFontWeight ( &PermCDS );
+ CDS_WriteFontCase ( &PermCDS );
+ CDS_WriteFontCaseFAT ( &PermCDS );
+ CDS_WriteFontItalics ( &PermCDS );
+ CDS_WriteFileDetails ( &PermCDS );
+ CDS_WriteSortOptions ( &PermCDS );
+
+ CDS_WriteFrameWinSize ( ghWndFrame );
+
+} /* end CDS_SaveDisplayConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveLoggingConfig ()
+
+ Description: Saves config data structure to private profile file.
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_SaveLoggingConfig ()
+
+{
+ CDS_WriteLogFileRoot ( &PermCDS );
+ CDS_WriteNumLogSessions ( &PermCDS );
+ CDS_WriteLogLevel ( &PermCDS );
+ CDS_WriteLogMode ( &PermCDS );
+ CDS_WritePrintLogSession ( &PermCDS );
+
+} /* end CDS_SaveLoggingConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveHardwareConfig ()
+
+ Description: Saves config data structure to private profile file.
+
+ Returns: FALSE, if no changes were detected. Otherwise, TRUE.
+
+******************************************************************************/
+
+VOID CDS_SaveHardwareConfig (
+
+LPSTR lpszDriver, // I - pointer to the driver name
+HWPARMS_PTR pHW, // I - pointer to the hardware parms to save
+LPSTR lpszCardName ) // I - string containing the card name
+
+{
+ CHAR szAppName[80];
+ CHAR szString[80];
+ INT nController = 0;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+
+
+
+ // If this is the autodetermine driver, don't save it.
+
+ if ( ! stricmp ( lpszDriver, CMS_AUTO ) ) {
+ return;
+ }
+
+ CDS_SetActiveDriver ( pCDS, lpszDriver );
+ CDS_SaveString ( CMS_HARDWARE, CMS_DRIVER, lpszDriver );
+
+ sprintf ( szAppName, TEXT("%s %s %u"), lpszDriver, CMS_CONTROLLER, nController );
+ sprintf ( szString, TEXT("%u (%s)"), pHW->wCardID, lpszCardName );
+ CDS_SaveString ( szAppName, CMS_CARDID, szString );
+
+ sprintf ( szString, TEXT("%u (%s)"), 1, TEXT("status mark") );
+ CDS_SaveString ( szAppName, CMS_STATUS, szString );
+
+ CDS_SaveInt ( szAppName, CMS_DRIVES, pHW->wDrives );
+ CDS_SaveInt ( szAppName, CMS_SLOT, pHW->wSlot );
+
+ CDS_SaveHexInt ( szAppName, CMS_TARGETS, (DWORD)pHW->wTargets );
+ CDS_SaveHexInt ( szAppName, CMS_ADDR, pHW->ulAddr );
+ CDS_SaveHexInt ( szAppName, CMS_IRQ, pHW->ulIRQ );
+ CDS_SaveHexInt ( szAppName, CMS_DMA, pHW->ulDMA );
+
+} /* end CDS_SaveHardwareConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveDebugConfig ()
+
+ Description: Saves config data structure to private profile file.
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_SaveDebugConfig ()
+
+{
+ CDS_WriteDebugFlag ( &PermCDS );
+ CDS_WriteDebugToFile ( &PermCDS );
+ CDS_WriteDebugToWindow ( &PermCDS );
+ CDS_WriteDebugWindowShowAll ( &PermCDS );
+ CDS_WriteDebugWindowNumLines ( &PermCDS );
+ CDS_WriteDebugFileName ( &PermCDS );
+ CDS_WritePollFrequency ( &PermCDS );
+
+} /* end CDS_SaveDebugConfig() */
+
+
+/******************************************************************************
+
+ Name: CDS_SaveBEConfig ()
+
+ Description: Saves config data structure to private profile file.
+
+ Returns:
+
+******************************************************************************/
+
+VOID CDS_SaveBEConfig ()
+
+{
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+// CDS_WriteSpecialWord ( pCDS );
+ CDS_WriteMaxTapeBuffers ( pCDS );
+ CDS_WriteTFLBuffSize ( pCDS );
+ CDS_WriteMaxBufferSize ( pCDS );
+ CDS_WriteSkipOpenFiles ( pCDS );
+ CDS_WriteBackupFilesInUse ( pCDS );
+ CDS_WriteAFPSupport ( pCDS );
+ CDS_WriteExtendedDateSupport ( pCDS );
+
+ CDS_WriteHiddenFlag ( pCDS );
+ CDS_WriteSpecialFlag ( pCDS );
+ CDS_WriteSetArchiveFlag ( pCDS );
+ CDS_WriteProcEmptyFlag ( pCDS );
+ CDS_WriteExistFlag ( pCDS );
+ CDS_WritePromptFlag ( pCDS );
+ CDS_WriteNetNum ( pCDS );
+ CDS_WriteSortBSD ( pCDS );
+
+ CDS_WriteRemoteDriveBackup ( pCDS );
+ CDS_WriteFastFileRestore ( pCDS );
+ CDS_WriteWriteFormat ( pCDS );
+ CDS_WriteNRLDosVector ( pCDS );
+
+ CDS_WriteConfiguredMachineType ( pCDS );
+ CDS_WriteProcessSytronECCFlag ( pCDS );
+
+ CDS_WriteOTCLevel ( pCDS );
+
+} /* end CDS_SaveBEConfig() */
+
+
+//note: this function MUST return int since CW_USEDEFAULT is defined in NT
+// as 0x80000000!!!
+
+INT CDS_GetToken (
+
+WORD wType,
+LPSTR szValue )
+
+{
+ LPSTR lpHold;
+
+ lpHold = (LPSTR) strtok ( (LPSTR)szValue, (LPSTR)CDS_TOKENS);
+
+ switch ( wType ) {
+
+ case TOKEN_WINSIZE:
+
+ if (lpHold != NULL) {
+ return atoi(lpHold);
+ }
+ else {
+ return CW_USEDEFAULT;
+ }
+
+ break;
+
+ case TOKEN_WINSHOW:
+
+ if (lpHold != NULL) {
+ return atoi(lpHold);
+ }
+ else {
+ return WM_MIN;
+ }
+
+ break;
+
+ case TOKEN_WINSLIDER:
+
+ if (lpHold != NULL) {
+ return atoi(lpHold);
+ }
+ else {
+ return WM_SLIDERUNKNOWN;
+ }
+
+ break;
+
+ default:
+
+ return 0;
+ break;
+ }
+
+
+} /* end CDS_GetToken() */
+
+
+VOID CDS_SaveWinSize (
+
+LPSTR szName,
+HWND hWnd )
+
+{
+ CHAR szTokens[MAX_UI_RESOURCE_SIZE];
+ INT nSize;
+ WINDOWPLACEMENT dsWPDoc;
+
+ dsWPDoc.length = sizeof ( dsWPDoc );
+
+ if ( ! GetWindowPlacement ( hWnd, &dsWPDoc ) ) {
+ return;
+ }
+
+ if ( WM_IsMaximized ( hWnd ) ) {
+ nSize = WM_MAX;
+ }
+ else {
+ nSize = 0;
+ }
+
+ sprintf ( szTokens,
+ TEXT("%d, %d, %d, %d, %d, %d"),
+ dsWPDoc.rcNormalPosition.left,
+ dsWPDoc.rcNormalPosition.top,
+ dsWPDoc.rcNormalPosition.right - dsWPDoc.rcNormalPosition.left,
+ dsWPDoc.rcNormalPosition.bottom - dsWPDoc.rcNormalPosition.top,
+ nSize,
+ 0
+ );
+
+ CDS_WriteWindowSize ( szName, szTokens );
+
+} /* end CDS_SaveWinSize() */
+
+
+VOID CDS_SaveDlgWinSize (
+
+LPSTR szName,
+HWND hWnd )
+
+{
+ CHAR szTokens[MAX_UI_RESOURCE_SIZE];
+ INT nSize;
+ WINDOWPLACEMENT dsWPDoc;
+ RECT rcFrame;
+ INT x;
+ INT y;
+
+
+ dsWPDoc.length = sizeof ( dsWPDoc );
+
+ if ( ! GetWindowPlacement ( hWnd, &dsWPDoc ) ) {
+ return;
+ }
+
+ GetWindowRect ( ghWndFrame, &rcFrame );
+
+ x = dsWPDoc.rcNormalPosition.left - rcFrame.left;
+ y = dsWPDoc.rcNormalPosition.top - rcFrame.top;
+
+ nSize = 0;
+
+ sprintf ( szTokens,
+ TEXT("%d, %d, %d, %d, %d, %d"),
+ x,
+ y,
+ dsWPDoc.rcNormalPosition.right - dsWPDoc.rcNormalPosition.left,
+ dsWPDoc.rcNormalPosition.bottom - dsWPDoc.rcNormalPosition.top,
+ nSize,
+ 0
+ );
+
+ CDS_WriteWindowSize ( szName, szTokens );
+
+} /* end CDS_SaveDlgWinSize() */
+
+
+VOID CDS_SaveMDIWinSize (
+
+LPSTR szName,
+HWND hWnd )
+
+{
+ CHAR szTokens[MAX_UI_RESOURCE_SIZE];
+ INT nSize;
+ PDS_WMINFO pWinInfo;
+ WINDOWPLACEMENT dsWPDoc;
+
+ if ( ! IsWindow ( hWnd ) ) {
+ return;
+ }
+
+ pWinInfo = WM_GetInfoPtr ( hWnd );
+
+ dsWPDoc.length = sizeof ( dsWPDoc );
+
+ if ( ! GetWindowPlacement ( hWnd, &dsWPDoc ) ) {
+ return;
+ }
+
+ if ( WM_IsMinimized ( hWnd ) ) {
+ nSize = WM_MIN;
+ }
+ else if ( WM_IsMaximized ( hWnd ) ) {
+ nSize = WM_MAX;
+ }
+ else {
+ nSize = 0;
+ }
+
+ sprintf ( szTokens,
+ TEXT("%d, %d, %d, %d, %d, %d"),
+ dsWPDoc.rcNormalPosition.left,
+ dsWPDoc.rcNormalPosition.top,
+ dsWPDoc.rcNormalPosition.right - dsWPDoc.rcNormalPosition.left,
+ dsWPDoc.rcNormalPosition.bottom - dsWPDoc.rcNormalPosition.top,
+ nSize,
+ WMDS_GetSliderPos ( pWinInfo )
+ );
+
+ CDS_WriteWindowSize ( szName, szTokens );
+
+} /* end CDS_SaveMDIWinSize() */
+
diff --git a/private/utils/ntbackup/src/muiutil.c b/private/utils/ntbackup/src/muiutil.c
new file mode 100644
index 000000000..06768ef17
--- /dev/null
+++ b/private/utils/ntbackup/src/muiutil.c
@@ -0,0 +1,1560 @@
+
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: muiutil.c
+
+ Description: This module contains miscellaneous functions within the
+ MAYNARD USER INTERFACE (MUI) for displaying information.
+
+ This file contains the following functions:
+
+ UI_AnsiLowerChar()
+ UI_AnsiLowerString()
+ UI_AnsiUpperChar()
+ UI_AnsiUpperString()
+ UI_CountLetters()
+ UI_CurrentDate()
+ UI_CurrentDateLeadingZero()
+ UI_CurrentTime()
+ UI_CurrentTimeLeadingZero()
+ UI_GetDateFormat()
+ UI_GetDateSeparator()
+ UI_GetTimeSeparator()
+ UI_InitDate()
+ UI_InitIntl()
+ UI_InitThousandsChar()
+ UI_InitTime()
+ UI_IntToDate()
+ UI_IntToTime()
+ UI_LongToDate()
+ UI_LongToTime()
+ UI_MakeDateString()
+ UI_MakeTimeString()
+ UI_MakeShortTimeString()
+ UI_UseLeadCentury()
+ UI_UseLeadDays()
+ UI_UseLeadHours()
+ UI_UseLeadMonth()
+ UI_Use24Hour()
+
+ WM_MultiTask()
+
+ $Log: G:\UI\LOGFILES\MUIUTIL.C_V $
+
+ Rev 1.25.1.3 18 Jan 1994 14:39:06 MIKEP
+fix buffers that were too small for mark
+
+ Rev 1.25.1.2 10 Jan 1994 13:08:06 MikeP
+fix leading zero on dates > 2000
+
+ Rev 1.25.1.1 10 Jan 1994 11:52:58 MikeP
+fix epr 168 about dates greater than 1999
+
+ Rev 1.25.1.0 04 Nov 1993 15:22:56 STEVEN
+fixes from Wa
+
+ Rev 1.25 24 Jun 1993 17:07:10 CARLS
+added UI_CurrentDateLeadingZero and UI_CurrentTimeLeadingZero routines
+
+ Rev 1.24 23 Jun 1993 09:20:04 GLENN
+Added code to break when WM_COMMAND messages are found - to prevent reentrancy problems.
+
+ Rev 1.23 27 Apr 1993 19:10:32 GLENN
+Removed dead code from the multitask -- just for fun.
+
+ Rev 1.22 29 Dec 1992 13:33:28 DAVEV
+unicode fixes (3)
+
+ Rev 1.21 05 Nov 1992 17:10:06 DAVEV
+fix ts
+
+ Rev 1.19 07 Oct 1992 14:13:26 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.18 04 Oct 1992 19:39:18 DAVEV
+Unicode Awk pass
+
+ Rev 1.17 22 Sep 1992 10:33:32 GLENN
+Added FULL BACKUP, INCREMENTAL BACKUP, DIFFERENTIAL BACKUP, FM REPLACE, FM APPEND
+
+ Rev 1.16 10 Jun 1992 12:46:00 JOHNWT
+removed autojob creation for msoft
+
+ Rev 1.15 14 May 1992 18:00:22 MIKEP
+nt pass 2
+
+ Rev 1.14 09 Mar 1992 16:58:58 CHUCKB
+Fixed InitDate().
+
+ Rev 1.13 13 Feb 1992 13:35:56 CHUCKB
+Fixed am string length constants.
+
+ Rev 1.12 12 Feb 1992 18:03:56 CHUCKB
+Got ValidatePath working, then removed it.
+
+ Rev 1.11 10 Feb 1992 10:36:04 CHUCKB
+Added InitIntl and moved BuildNumeralWithCommas.
+
+ Rev 1.10 22 Jan 1992 10:26:00 CHUCKB
+Fixed make time string functions for 12:00 a.m.
+
+ Rev 1.9 10 Jan 1992 11:20:06 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.8 03 Jan 1992 17:47:10 CHUCKB
+Added UI_MakeShortDateString.
+
+ Rev 1.7 13 Dec 1991 09:44:50 ROBG
+Corrected #define LAUNCHER logic in WM_MultiTask.
+
+ Rev 1.6 13 Dec 1991 09:24:42 ROBG
+Made multitask to support the launcher as well.
+
+ Rev 1.5 10 Dec 1991 10:05:20 CHUCKB
+Put in makeautojobs function.
+
+ Rev 1.4 05 Dec 1991 10:44:12 CHUCKB
+Put in LongToDate/Time.
+
+ Rev 1.3 04 Dec 1991 18:41:52 GLENN
+Converted parse routines to init routines which are called at init time and
+WIN.INI change time. Removed calls to the old parse routines, unnecessary
+due to init routines.
+
+ Rev 1.2 03 Dec 1991 14:52:10 CHUCKB
+Fixed IntToDate and IntToTime.
+
+ Rev 1.1 27 Nov 1991 11:15:14 CHUCKB
+Put in default international values
+
+ Rev 1.0 20 Nov 1991 19:30:48 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// PRIVATE DEFINITIONS
+
+#define TEMP_STR_SIZE 100
+
+// module-wide flags and other variables for international date/time functions
+
+static CHAR mwcDateSeparator;
+static INT mwnOrder;
+static BOOL mwfLeadMonth;
+static BOOL mwfLeadDay;
+static BOOL mwfLeadYear;
+static BOOL mwfLeadTime;
+static CHAR mwcTimeSeparator;
+static BOOL mwfIs24Hour;
+static BOOL mwfIsTimePrefix;
+static CHAR mwszAMString[TEMP_STR_SIZE];
+static CHAR mwszPMString[TEMP_STR_SIZE];
+static CHAR mwThousandBuffer[TEMP_STR_SIZE]; // these two are used to find the character
+static CHAR mwDefThousandBuffer[TEMP_STR_SIZE]; // that separates thousands numerals
+static BOOL mwfMultitasking;
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: UI_AnsiLowerChar()
+
+ Description: This function changes a character to lower case.
+
+ Returns: The converted character.
+
+******************************************************************************/
+
+INT16 UI_AnsiLowerChar (
+
+INT16 nChar ) // I - character to be converted
+
+{
+ return (INT16)(DWORD) AnsiLower( (LPSTR)(LONG)(UCHAR)(nChar) );
+
+} /* end UI_AnsiLowerChar() */
+
+/******************************************************************************
+
+ Name: UI_AnsiLowerString()
+
+ Description: This function changes a null terminated string to lower
+ case.
+
+ Returns: The converted string.
+
+******************************************************************************/
+
+CHAR_PTR UI_AnsiLowerString (
+
+CHAR_PTR pString ) // I - character to be converted
+
+{
+ return AnsiLower ( (LPSTR)pString );
+
+} /* end UI_AnsiLowerChar() */
+
+
+/******************************************************************************
+
+ Name: UI_AnsiUpperChar()
+
+ Description: This function changes a character to upper case.
+
+ Returns: The converted character.
+
+******************************************************************************/
+
+INT16 UI_AnsiUpperChar (
+
+INT16 nChar ) // I - character to be converted
+
+{
+ return (INT16)(DWORD) AnsiUpper( (LPSTR)(LONG)(UCHAR)(nChar) );
+
+} /* end UI_AnsiUpperChar() */
+
+/******************************************************************************
+
+ Name: UI_AnsiUpperString()
+
+ Description: This function changes a null terminated string to upper
+ case.
+
+ Returns: The converted string.
+
+******************************************************************************/
+
+CHAR_PTR UI_AnsiUpperString (
+
+CHAR_PTR pString ) // I - character to be converted
+
+{
+ return AnsiUpper ( (LPSTR)pString );
+
+} /* end UI_AnsiUpperChar() */
+
+/*****************************************************************************
+
+ Name: UI_BuildNumeralWithCommas
+
+ Description: Builds a numeral with commas
+
+ Returns: VOID
+
+*****************************************************************************/
+
+VOID UI_BuildNumeralWithCommas(
+
+CHAR_PTR numeral ) // I/O - buffer in which to build the numeral
+
+{
+ CHAR_PTR n;
+ CHAR_PTR w;
+ INT comma_index;
+ CHAR work_area[ UI_MAX_NUMERAL_LENGTH ];
+
+ n = numeral;
+ w = work_area;
+
+ /* make sure comma_index is not negative */
+ if( ( comma_index = ( strlen( numeral ) % UI_COMMA_SPACING ) - 1 ) < 0 ) {
+ comma_index += UI_COMMA_SPACING;
+ }
+
+ /* first char must not be comma */
+ *w++ = *n++;
+
+ while( *n ) {
+ if( comma_index-- ) {
+ *w++ = *n++;
+ }
+ else {
+ if ( mwThousandBuffer[0] ) {
+ *w++ = mwThousandBuffer[0];
+ }
+ comma_index = UI_COMMA_SPACING;
+ }
+ }
+
+ *w = TEXT('\0');
+
+ strcpy( numeral, work_area );
+
+ return;
+}
+
+/***************************************************
+
+ Name: UI_CountLetters
+
+ Description: counts the number of consecutive occurences
+ of a given letter in a given string;
+ the letter is specified by its index in the string
+
+ Modified: 11-13-91
+
+ Returns: INT the number of consecutive occurrences of the letter
+ at the given position of the given string starting
+ at the given position
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+INT UI_CountLetters ( CHAR string[], INT index )
+
+{
+ INT nCount = 1; // the character at least matches itself
+
+ while ( string[index] == string[index+1] ) {
+
+ index++;
+ nCount++;
+ }
+
+ return ( nCount );
+}
+
+/***************************************************
+
+ Name: UI_CurrentDate
+
+ Description: Generates a string with the current date in
+ the current international format.
+
+ Modified: 11-11-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_CurrentDate ( LPSTR szDateBuffer )
+
+{
+ SYSTEMTIME loc_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ UI_MakeDateString ( szDateBuffer, loc_time.wMonth,
+ loc_time.wDay, loc_time.wYear -1900 );
+
+ return;
+
+}
+/***************************************************
+
+ Name: UI_CurrentDateLeadingZero
+
+ Description: Generates a string with the current date in
+ the current international format, forcing
+ leading zeros.
+
+ Modified: 6-24-93
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_CurrentDateLeadingZero ( LPSTR szDateBuffer )
+
+{
+ BOOL fLeadMonthSave;
+ BOOL fLeadDaySave;
+ LONG lCurTime;
+
+ // get the current date, and send that to UI_LongToDate
+
+ //save the global flags
+ fLeadMonthSave = mwfLeadMonth ;
+ fLeadDaySave = mwfLeadDay ;
+
+ mwfLeadMonth = TRUE ;
+ mwfLeadDay = TRUE ;
+
+ time ( &lCurTime );
+
+ UI_LongToDate( szDateBuffer, lCurTime );
+
+ //restore the global flags
+ mwfLeadMonth = fLeadMonthSave ;
+ mwfLeadDay = fLeadDaySave ;
+
+ return;
+}
+
+/***************************************************
+
+ Name: UI_CurrentTime
+
+ Description: Puts the current time in the input string in int'l format
+
+ Modified: 11-11-91
+
+ Returns: void; returns value through input argument
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_CurrentTime ( LPSTR szTimeBuffer )
+
+{
+ LONG lCurTime;
+
+ // get the current time, and send that to UI_LongToTime
+
+ time ( &lCurTime );
+
+ UI_LongToTime( szTimeBuffer, lCurTime );
+ return;
+}
+
+/***************************************************
+
+ Name: UI_CurrentTimeLeadingZero
+
+ Description: Puts the current time in the input string in int'l format
+
+ Modified: 11-11-91
+
+ Returns: void; returns value through input argument
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_CurrentTimeLeadingZero ( LPSTR szTimeBuffer )
+
+{
+ BOOL fLeadTimeSave;
+ LONG lCurTime;
+
+ // get the current time, and send that to UI_LongToTime
+
+ //save the global flags
+ fLeadTimeSave = mwfLeadTime ;
+
+ mwfLeadTime = TRUE ;
+
+ time ( &lCurTime );
+
+ UI_LongToTime( szTimeBuffer, lCurTime );
+
+ //restore the global flags
+ mwfLeadTime = fLeadTimeSave ;
+
+ return;
+}
+
+/***************************************************
+
+ Name: UI_GetAMString
+
+ Description: Returns the string that goes after am times
+
+ Modified: 11-18-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_GetAMString ( LPSTR lpszBuffer )
+
+{
+ lstrcpy ( lpszBuffer, mwszAMString );
+}
+
+/***************************************************
+
+ Name: UI_GetDateFormat
+
+ Description: Tells what the format for dates is
+
+ Modified: 11-11-91
+
+ Returns: INT YMD, MDY, or DMY
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+INT UI_GetDateFormat ( )
+
+{
+ return mwnOrder;
+}
+
+/***************************************************
+
+ Name: UI_GetDateSeparator
+
+ Description: Tells what the date field separator character is
+
+ Modified: 11-11-91
+
+ Returns: CHAR the character that separates the fields of dates
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+CHAR UI_GetDateSeparator ( )
+
+{
+ return mwcDateSeparator;
+}
+
+/***************************************************
+
+ Name: UI_GetPMString
+
+ Description: Returns the string that goes after pm times
+
+ Modified: 11-18-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_GetPMString ( LPSTR lpszBuffer )
+
+{
+ lstrcpy ( lpszBuffer, mwszPMString );
+}
+
+/***************************************************
+
+ Name: UI_GetTimeSeparator
+
+ Description: Tells what the time field separator character is
+
+ Modified: 11-11-91
+
+ Returns: CHAR the character that separates the fields of times
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+CHAR UI_GetTimeSeparator ( )
+
+{
+ return mwcTimeSeparator;
+}
+
+/***************************************************
+
+ Name: UI_InitDate
+
+ Description: Parses the short date key field in win.ini
+ determines the date format, separator character,
+ whether or not the month and day have leading 0's,
+ and whether or not the year has a leading century
+
+ Modified:
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_InitDate ( )
+
+{
+ CHAR szDateBuffer[TEMP_STR_SIZE];
+ CHAR szDefaultBuffer[TEMP_STR_SIZE];
+ INT nTemp, nTemp2;
+
+ mwnOrder = -1;
+
+ RSM_StringCopy( IDS_DEFAULT_SHORTDATE, szDefaultBuffer, TEMP_STR_SIZE );
+
+ GetProfileString ( TEXT("intl"), TEXT("sShortDate"), szDefaultBuffer, szDateBuffer, TEMP_STR_SIZE );
+
+ // the year field will tell us the separator,
+ // because it must have either 2 or 4 y's;
+ // there cannot be 3 or 5 y's in a valid year
+ // the year is either the first or last field in the string
+
+ if ( szDateBuffer[0] == TEXT('y') ) {
+
+ // this is ymd format, so the y's are first, followed by the separator
+
+ mwnOrder = YMD;
+ mwfLeadYear = FALSE;
+ nTemp = 1;
+
+ while ( szDateBuffer[nTemp] == TEXT('y') ) {
+
+ nTemp++;
+ }
+
+ mwcDateSeparator = szDateBuffer[nTemp];
+
+ } else {
+
+ // the year is not the first field, so it is the last field
+ // count backward from the end to find the separator
+
+ nTemp = lstrlen ( szDateBuffer ) - 1;
+ nTemp2 = 0;
+ while ( szDateBuffer[nTemp] == TEXT('y') ) {
+
+ nTemp--;
+ nTemp2++;
+ }
+
+ mwcDateSeparator = szDateBuffer[nTemp];
+ }
+
+ mwfLeadYear = ( nTemp > 2 ); // nTemp has the number of y's
+
+ //
+ // after the separator has been identified, parse the d's and M's
+ //
+
+ if ( szDateBuffer[0] == TEXT('d') ) { // the order is DMY
+
+ mwnOrder = DMY;
+
+ // days are followed by months, so count d's first
+
+ nTemp = UI_CountLetters ( szDateBuffer, 0 );
+ mwfLeadDay = ( ( nTemp == 3 ) ||
+ ( ( mwcDateSeparator != TEXT('d') ) &&
+ ( nTemp > 1 ) ) );
+
+ // followed by either 1 or 2 M's, followed by one separator,
+ // if the separator is not a 'd', skip the separator
+
+ if ( mwcDateSeparator != TEXT('d') ) {
+
+ nTemp++;
+ }
+
+ mwfLeadMonth = ( UI_CountLetters ( szDateBuffer, nTemp ) > 1 );
+
+ // skip the M and the separator; if there is an extra M, skip it too
+
+ nTemp +=2;
+ if ( mwfLeadMonth ) {
+
+ nTemp++;
+ }
+
+ // followed by either 2 or 4 y's
+
+ mwfLeadYear = ( UI_CountLetters ( szDateBuffer, nTemp ) > 2 );
+
+ } else {
+
+ // see what the order is: if it isn't YMD it is MDY
+
+ if ( mwnOrder != YMD ) {
+
+ mwnOrder = MDY;
+
+ nTemp = UI_CountLetters ( szDateBuffer, 0 );
+ mwfLeadMonth = ( ( nTemp == 3 ) ||
+ ( ( mwcDateSeparator != TEXT('M') ) &&
+ ( nTemp > 1 ) ) );
+
+ // followed by either 1 or 2 d's, followed by one separator
+
+ if ( mwcDateSeparator != TEXT('d') ) {
+
+ nTemp++;
+ }
+
+ mwfLeadDay = ( UI_CountLetters ( szDateBuffer, nTemp ) > 1 );
+
+ // now find the y's
+
+ while ( ( szDateBuffer[nTemp] != TEXT('y') ) &&
+ ( nTemp < lstrlen ( szDateBuffer ) ) ) {
+
+ nTemp++;
+ }
+
+ // followed by either 2 or 4 y's
+
+ mwfLeadYear = ( UI_CountLetters ( szDateBuffer, nTemp ) > 2 );
+
+ } else { // the order is YMD
+
+ // find the first M
+
+ nTemp = 3;
+ if ( mwfLeadYear ) {
+
+ nTemp += 2;
+ }
+
+ nTemp2 = UI_CountLetters ( szDateBuffer, nTemp );
+ mwfLeadMonth = ( ( nTemp2 == 3 ) ||
+ ( ( mwcDateSeparator != TEXT('M') ) &&
+ ( nTemp2 > 1 ) ) );
+
+ nTemp += nTemp2;
+
+ // followed by a separator and either 1 or 2 d's
+
+ if ( mwcDateSeparator != TEXT('M') ) {
+
+ nTemp++;
+ }
+
+ mwfLeadDay = ( UI_CountLetters ( szDateBuffer, nTemp ) > 1 );
+ }
+ }
+ return;
+}
+
+/*****************************************************************************
+
+ Name: UI_InitThousandsChar
+
+ Description: Gets the character that separates every three digits in
+ numbers with more than three digits. In the U.S., this
+ character is a comma; in other countries, it may vary.
+
+ Returns: VOID
+
+*****************************************************************************/
+
+VOID UI_InitThousandsChar( )
+
+{
+ RSM_StringCopy( IDS_DEFAULT_THOUSAND, mwDefThousandBuffer, TEMP_STR_SIZE );
+ GetProfileString( TEXT("intl"), TEXT("sThousand"), mwDefThousandBuffer, mwThousandBuffer, TEMP_STR_SIZE );
+}
+
+/***************************************************
+
+ Name: UI_InitTime
+
+ Description: Determines important international things about the
+ Windows time settings.
+
+ Modified:
+
+ Returns:
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_InitTime ( )
+
+{
+ // This guy is much easier to parse than the bloody date
+
+ CHAR szBuffer[TEMP_STR_SIZE];
+ CHAR szDefaultBuffer[TEMP_STR_SIZE];
+
+ // Should we display using 24 hour (military) time.
+
+ mwfIs24Hour = (BOOL) GetProfileInt( TEXT("intl"), TEXT("iTime"), 0 );
+
+ if ( GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, szBuffer, TEMP_STR_SIZE*sizeof(CHAR) ) ) {
+ if ( *szBuffer == 'H') {
+ mwfIs24Hour = (BOOL)TRUE ;
+ }
+ }
+
+ if ( IS_JAPAN() ) {
+ /* v-hirot July.12.1993 for New Prefix */
+ mwfIsTimePrefix = (BOOL) GetProfileInt( TEXT("intl"), TEXT("iTimePrefix"), 0 );
+ }
+
+ // Get the AM string.
+
+ RSM_StringCopy( IDS_DEFAULT_1159, szDefaultBuffer, TEMP_STR_SIZE );
+ GetProfileString( TEXT("intl"), TEXT("s1159"), szDefaultBuffer, mwszAMString, TEMP_STR_SIZE );
+
+ // Get the PM string.
+
+ RSM_StringCopy( IDS_DEFAULT_2359, szDefaultBuffer, TEMP_STR_SIZE );
+ GetProfileString( TEXT("intl"), TEXT("s2359"), szDefaultBuffer, mwszPMString, TEMP_STR_SIZE );
+
+ // Should we use leading zeros for hours.
+
+ mwfLeadTime = (BOOL) GetProfileInt( TEXT("intl"), TEXT("iTLZero"), 0 );
+
+ // Get the separator. Really, it's only 1 character, but we'll make the
+ // buffer bigger anyway.
+
+ RSM_StringCopy( IDS_DEFAULT_TIME, szDefaultBuffer, TEMP_STR_SIZE );
+ GetProfileString( TEXT("intl"), TEXT("sTime"), szDefaultBuffer, szBuffer, TEMP_STR_SIZE );
+ mwcTimeSeparator = szBuffer[0];
+
+ return;
+}
+
+/***************************************************
+
+ Name: UI_InitIntl
+
+ Description: Calls InitDate, InitTime, and InitThousandsChar to make
+ life easier for frmproc.c when WIN.INI gets changed
+
+ Modified: 2-7-92
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_InitIntl( )
+{
+ UI_InitDate( );
+ UI_InitTime( );
+ UI_InitThousandsChar( );
+
+ return;
+}
+
+/***************************************************
+
+ Name: UI_IntToDate
+
+ Description: converts an integer to a date string
+
+ Modified: 11-19-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_IntToDate ( LPSTR lpszDateBuffer,
+ UINT16 uInValue )
+
+{
+ // from Duncan's DOS book
+ // 00h-04h day of month 1-31
+ // 05h-08h month 1-12
+ // 09h-0fh year from 1980
+
+ INT nMonth;
+ INT nDay;
+ INT nYear;
+
+ nDay = (INT)(uInValue & 0x001f);
+ uInValue >>= 5;
+ nMonth =(INT)(uInValue & 0x000f);
+ uInValue >>= 4;
+ nYear = (INT)(( uInValue & 0x007f ) + 80);
+
+ UI_MakeDateString( lpszDateBuffer, nMonth, nDay, nYear );
+
+ return;
+}
+
+/***************************************************
+
+ Name: UI_IntToTime
+
+ Description: converts an integer to a time string
+
+ Modified: 11-19-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_IntToTime ( LPSTR lpszTimeBuffer,
+ UINT16 uInValue )
+
+{
+ // from Duncan's DOS book
+ // 00h-04h binary number of 2-second increments 0-29
+ // 05h-0ah binary number of minutes
+ // 0bh-0fh binary number of hours
+
+ INT nHour;
+ INT nMinute;
+ INT nSecond;
+
+ nSecond = (INT)(uInValue & 0x001f);
+ uInValue >>= 5;
+ nMinute = (INT)(uInValue & 0x003f);
+ uInValue >>= 6;
+ nHour = (INT)(uInValue & 0x001f);
+
+ UI_MakeTimeString( lpszTimeBuffer, nHour, nMinute, nSecond );
+
+ return;
+}
+
+/***************************************************
+
+ Name: UI_LongToDate
+
+ Description: converts a long to a string with the date in it
+
+ Modified: 11-19-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_LongToDate ( LPSTR lpszDateBuffer,
+ LONG lInValue )
+
+{
+ struct tm *dsDate;
+
+ dsDate = localtime ( &lInValue );
+
+ UI_MakeDateString ( lpszDateBuffer, (dsDate->tm_mon) + 1,
+ dsDate->tm_mday, dsDate->tm_year );
+ return;
+}
+
+/***************************************************
+
+ Name: UI_LongToTime
+
+ Description: converts a long to a string with the time in it
+
+ Modified: 11-19-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_LongToTime ( LPSTR lpszTimeBuffer,
+ LONG lInValue )
+
+{
+ struct tm *dsTime;
+
+ dsTime = localtime ( &lInValue );
+
+ UI_MakeTimeString ( lpszTimeBuffer, dsTime->tm_hour,
+ dsTime->tm_min, dsTime->tm_sec );
+ return;
+}
+
+/***************************************************
+
+ Name: UI_MakeAutoJobs
+
+ Description: If the skipped/verify scripts exist and their jobs don't,
+ this function causes those jobs to be created.
+
+ Modified: 12-9-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_MakeAutoJobs ( INT nOperType )
+
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ JOB_MakeAutoJob ( IDS_SKIPPED_JOBNAME, IDS_SKIPPED_JOBNAME, JOBBACKUP, BSD_BACKUP_NORMAL, TRUE, TRUE );
+ JOB_MakeAutoJob ( IDS_VERIFY_JOBNAME, IDS_VERIFY_JOBNAME, JOBBACKUP, BSD_BACKUP_NORMAL, TRUE, TRUE );
+
+ JOB_MakeAutoJob ( IDS_FULLBACKUP_JOBNAME, IDS_VLMSTARTUPBKS, JOBBACKUP, BSD_BACKUP_NORMAL, FALSE, TRUE );
+ JOB_MakeAutoJob ( IDS_INCBACKUP_JOBNAME, IDS_VLMSTARTUPBKS, JOBBACKUP, BSD_BACKUP_INCREMENTAL, FALSE, TRUE );
+ JOB_MakeAutoJob ( IDS_DIFFBACKUP_JOBNAME, IDS_VLMSTARTUPBKS, JOBBACKUP, BSD_BACKUP_DIFFERENTIAL, FALSE, TRUE );
+
+ JOB_MakeAutoJob ( IDS_FM_APPEND_JOBNAME, IDS_FM_SCRIPTNAME, JOBBACKUP, BSD_BACKUP_NORMAL, TRUE, TRUE );
+ JOB_MakeAutoJob ( IDS_FM_REPLACE_JOBNAME, IDS_FM_SCRIPTNAME, JOBBACKUP, BSD_BACKUP_NORMAL, FALSE, TRUE );
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+/***************************************************
+
+ Name: UI_MakeDateString
+
+ Description: Makes a string by putting the input date into
+ the current international format
+
+ Modified: 11-11-91
+
+ Returns: void
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID UI_MakeDateString ( LPSTR lpszDateBuffer,// O - string with date in int'l form
+ INT nMonth, // I - month being passed in
+ INT nDay, // I - day/date being passed in
+ INT nYear ) // I - year being passed in
+
+{
+ CHAR szProfile[100]; // profile string for wsprintf statements
+
+ // now put the correct values in the return string
+ // first, set up the profile string for the wsprintf;
+ // then just put the values in
+
+ if ( mwfLeadYear ) {
+ nYear += 1900;
+ }
+ else {
+ nYear %= 100;
+ }
+
+
+
+ switch ( mwnOrder ) {
+
+ case YMD : // print the year, then month, then date
+
+ wsprintf ( szProfile, TEXT("%s%c%s%c%s"),
+ TEXT("%02d"), mwcDateSeparator,
+ ( mwfLeadMonth ? TEXT("%02d") : TEXT("%d") ), mwcDateSeparator,
+ ( mwfLeadDay ? TEXT("%02d") : TEXT("%d") ) );
+
+ wsprintf ( lpszDateBuffer, szProfile,
+ nYear, nMonth, nDay );
+
+ break;
+
+ case MDY : // print the month, then day, then year
+
+ wsprintf ( szProfile, TEXT("%s%c%s%c%s"),
+ ( mwfLeadMonth ? TEXT("%02d") : TEXT("%d") ), mwcDateSeparator,
+ ( mwfLeadDay ? TEXT("%02d") : TEXT("%d") ), mwcDateSeparator,
+ TEXT("%02d") );
+
+ wsprintf ( lpszDateBuffer, szProfile, nMonth, nDay, nYear );
+
+ break;
+
+ case DMY : // print the day, then month, then year
+
+ wsprintf ( szProfile, TEXT("%s%c%s%c%s"),
+ ( mwfLeadDay ? TEXT("%02d") : TEXT("%d") ), mwcDateSeparator,
+ ( mwfLeadMonth ? TEXT("%02d") : TEXT("%d") ), mwcDateSeparator,
+ TEXT("%02d") );
+
+ wsprintf ( lpszDateBuffer, szProfile, nDay, nMonth, nYear );
+
+ break;
+
+ default :
+
+ break;
+ }
+ return;
+}
+
+/***************************************************
+
+ Name: UI_MakeTimeString
+
+ Description: Makes a string by putting the input time into
+ the current international format
+
+ Modified: 11-11-91
+
+ Returns: void
+
+ Notes:
+
+ See also: UI_MakeDateString [in this file]
+
+*****************************************************/
+
+VOID UI_MakeTimeString (
+
+LPSTR lpszTimeBuffer, // O - pointer to user's time buffer
+INT nHours, // I - number of hours
+INT nMinutes, // I - number of minutes
+INT nSeconds ) // I - number of seconds
+
+{
+ CHAR szProfile[100];
+ INT nTempHours;
+
+ nTempHours = nHours;
+
+ if ( !mwfIs24Hour ) {
+
+ if ( nHours == 0 ) {
+
+ nTempHours = 12;
+
+ } else if ( nHours > 12 ) {
+
+ nTempHours -= 12;
+ }
+ }
+
+ // minutes and seconds always have leading 0's; hours might not
+
+ if ( IS_JAPAN() ) {
+ /* v-hirot July.12.1993 for New Prefix */
+ if( mwfIsTimePrefix ){
+ if ( mwfIs24Hour ) {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator,
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes,
+ nSeconds );
+ } else {
+ wsprintf ( szProfile,
+ TEXT("%%s %s%c%%02d%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator,
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ ( (nHours < 12 ) ? mwszAMString : mwszPMString ),
+ nTempHours,
+ nMinutes,
+ nSeconds );
+ }
+ }
+ else{
+
+ if ( mwfIs24Hour ) {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator,
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes,
+ nSeconds ) ;
+ } else {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d%c%%02d %%s"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator,
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes,
+ nSeconds,
+ ( (nHours < 12 ) ? mwszAMString : mwszPMString ) );
+ }
+ }
+ } else {
+ if ( !mwfIs24Hour ) {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d%c%%02d %%s"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator,
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes,
+ nSeconds,
+ ( (nHours < 12 ) ? mwszAMString : mwszPMString ) );
+ } else {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator,
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes,
+ nSeconds,
+ TEXT("") );
+ }
+ }
+
+}
+
+/***************************************************
+
+ Name: UI_MakeShortTimeString
+
+ Description: Makes a string by putting the input time into
+ the current international format
+
+ Modified: 11-11-91
+
+ Returns: void
+
+ Notes:
+
+ See also: UI_MakeDateString [in this file]
+
+*****************************************************/
+
+VOID UI_MakeShortTimeString (
+
+LPSTR lpszTimeBuffer, // O - pointer to user's time buffer
+INT nHours, // I - number of hours
+INT nMinutes ) // I - number of minutes
+
+{
+ CHAR szProfile[100];
+ INT nTempHours;
+
+ nTempHours = nHours;
+
+ if ( !mwfIs24Hour ) {
+
+ if ( nHours == 0 ) {
+
+ nTempHours = 12;
+
+ } else if ( nHours > 12 ) {
+
+ nTempHours -= 12;
+ }
+ }
+
+ // minutes and seconds always have leading 0's; hours might not
+
+ if ( IS_JAPAN() ) {
+ /* v-hirot July.12.1993 for New Prefix */
+ if( mwfIsTimePrefix ){
+ if ( mwfIs24Hour ) {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes );
+ } else {
+ wsprintf ( szProfile,
+ TEXT("%%s %s%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ ( ( nHours < 12 ) ? mwszAMString : mwszPMString ),
+ nTempHours,
+ nMinutes );
+ }
+ }
+ else{
+ if ( mwfIs24Hour ) {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes ) ;
+ } else {
+
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d %%s"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes,
+ ( ( nHours < 12 ) ? mwszAMString : mwszPMString ) );
+ }
+ }
+ } else {
+ if ( mwfIs24Hour ) {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes ) ;
+ } else {
+ wsprintf ( szProfile,
+ TEXT("%s%c%%02d %%s"),
+ ( mwfLeadTime ? TEXT("%02d") : TEXT("%d") ),
+ mwcTimeSeparator );
+
+ wsprintf ( lpszTimeBuffer,
+ szProfile,
+ nTempHours,
+ nMinutes,
+ ( ( nHours < 12 ) ? mwszAMString : mwszPMString ) );
+ }
+ }
+
+
+}
+
+/***************************************************
+
+ Name: UI_UseLeadCentury()
+
+ Description: Tells caller if leading century is used on year field
+
+ Modified: 11-11-91
+
+ Returns: BOOL TRUE if leading century is used
+ FALSE otherwise
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL UI_UseLeadCentury ( )
+{
+ return ( mwfLeadYear );
+}
+
+/***************************************************
+
+ Name: UI_UseLeadDays()
+
+ Description:
+
+ Modified: 11-11-91
+
+ Returns: BOOL TRUE if leading zero is used on day fields
+ FALSE otherwise
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL UI_UseLeadDays ( )
+{
+ return ( mwfLeadDay );
+}
+
+/***************************************************
+
+ Name: UI_UseLeadMonth()
+
+ Description:
+
+ Modified: 11-11-91
+
+ Returns: BOOL TRUE if leading zero is used on month fields
+ FALSE otherwise
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL UI_UseLeadMonth ( )
+{
+ return ( mwfLeadMonth );
+}
+
+/***************************************************
+
+ Name: UI_UseLeadTime ()
+
+ Description:
+
+ Modified: 11-11-91
+
+ Returns: BOOL TRUE if leading zeroes are used on time fields
+ FALSE otherwise
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL UI_UseLeadTime ( )
+{
+ return ( mwfLeadTime );
+}
+
+/***************************************************
+
+ Name: UI_Use24Hour()
+
+ Description:
+
+ Modified: 11-11-91
+
+ Returns: BOOL TRUE if 24-hour time is used
+ FALSE otherwise
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+BOOL UI_Use24Hour ( )
+{
+ return ( mwfIs24Hour );
+}
+
+/******************************************************************************
+
+ Name: WM_MultiTask()
+
+ Description: This function basically gives up the CPU until there are
+ no more messages to be processed by other applications.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_MultiTask ( VOID )
+
+{
+ MSG msg;
+ BOOL fContinue = TRUE;
+
+ mwfMultitasking = FALSE;
+
+ // Make sure that we don't allow recursion to this routine.
+
+ if ( mwfMultitasking ) {
+ return;
+ }
+
+ mwfMultitasking = TRUE;
+
+ while ( fContinue && PeekMessage ( &msg, (HWND)NULL, 0, 0, PM_REMOVE ) ) {
+
+ if ( msg.message == WM_COMMAND ) {
+ fContinue = FALSE;
+ }
+
+ // DIALOG MESSAGE STUFF WILL GO HERE IF NEEDED.
+
+ if ( ( ! ghWndMDIClient || ! TranslateMDISysAccel ( ghWndMDIClient, &msg ) ) &&
+ ( ! ghAccel || ! TranslateAccelerator ( ghWndFrame, ghAccel, &msg ) ) &&
+ ( ! ghModelessDialog || ! IsDialogMessage ( ghModelessDialog, &msg ) ) ) {
+
+ TranslateMessage ( &msg );
+ DispatchMessage ( &msg );
+ }
+ }
+
+ mwfMultitasking = FALSE;
+
+} /* end WM_MultiTask() */
+
+
+BOOL WM_IsMultiTaskBusy ( VOID )
+
+{
+ return mwfMultitasking;
+
+} /* end WM_IsMultiTaskBusy() */
+
+BOOLEAN IS_JAPAN( void )
+{
+ static INT lastAnswer = -1 ;
+ CHAR szMachNLCode[4];
+
+ if ( lastAnswer == -1 ) {
+ // Get this machines NL code.
+
+ GetProfileString ( TEXT("intl"), TEXT("sLanguage"), TEXT("ENU"), szMachNLCode, sizeof( szMachNLCode ) );
+
+ // The third character is unimportant to us, just the first two.
+
+ szMachNLCode[2] = 0;
+
+ CharUpper ( szMachNLCode );
+
+ // Scan for the matching NL code(s).
+
+ if ( !memcmp( TEXT("JP"), szMachNLCode, 2*sizeof(CHAR) ) ) {
+ lastAnswer = 1 ;
+ return TRUE ;
+ }
+ lastAnswer = 0 ;
+ return FALSE ;
+ }
+ return (BOOLEAN)lastAnswer ;
+}
diff --git a/private/utils/ntbackup/src/myn40otc.c b/private/utils/ntbackup/src/myn40otc.c
new file mode 100644
index 000000000..db7559c93
--- /dev/null
+++ b/private/utils/ntbackup/src/myn40otc.c
@@ -0,0 +1,315 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: myn40otc.c
+
+ Description: This module contains the Maynard 4.0 translator entry
+ points for accessing On Tape Catalogs.
+
+ $Log: T:/LOGFILES/MYN40OTC.C_V $
+
+ Rev 1.7 22 Jun 1993 10:53:08 GREGG
+Added API to change the catalog directory path.
+
+ Rev 1.6 10 Jun 1993 20:22:54 GREGG
+Set Fatal status in channel on TFLE return from GetNext routines.
+
+ Rev 1.5 09 Jun 1993 19:53:06 GREGG
+Fix for EPR #0525 - Accept GEN_ERR_EOM return on space to EOD for Wangtek bug.
+
+ Rev 1.4 30 Jan 1993 11:44:04 DON
+Removed compiler warnings
+
+ Rev 1.3 26 Jan 1993 01:30:30 GREGG
+Added Fast Append functionality.
+
+ Rev 1.2 24 Nov 1992 18:16:20 GREGG
+Updates to match MTF document.
+
+ Rev 1.1 23 Nov 1992 10:04:32 GREGG
+Changes for path in stream.
+
+ Rev 1.0 09 Nov 1992 14:28:14 GREGG
+Initial revision.
+
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "lwprotos.h"
+#include "mayn40.h"
+#include "f40proto.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+
+/* Device Driver InterFace Headers */
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "dddefs.h"
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_LoadSM
+
+ Description: This function loads the last (and best) Set Map of the
+ current tape into a temporary file on disk and sets it
+ up for F40_GetNextSMEntry.
+
+ Returns: INT - TFLE_xxx or TF_xxx as appropriate. Also,
+ 'complete' is set to TRUE if this is the last Set Map
+ in the family.
+
+ Notes: If 'get_best' is TRUE, TF_NEED_NEW_TAPE is returned if
+ this is not the last tape in the family.
+
+**/
+
+INT F40_LoadSM(
+ CHANNEL_PTR channel,
+ BOOLEAN_PTR complete,
+ BOOLEAN get_best )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ INT ret_val = TFLE_NO_ERR ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+ BOOLEAN sm_exists ;
+
+ msassert( cur_env->otc_sm_fptr == NULL ) ;
+
+ if( cur_env->otc_buff == NULL ) {
+ /* This can only happen if a realloc call in OTC_GenDirEntry
+ failed during a previous backup.
+ */
+ if( ( cur_env->otc_buff = calloc( F40_INIT_OTC_BUFF_SIZE, 1 ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ cur_env->otc_buff_size = F40_INIT_OTC_BUFF_SIZE ;
+ }
+
+ if( cur_env->cur_otc_level == TCL_NONE ) {
+ ret_val = TF_NO_SM_FOR_FAMILY ;
+
+ } else if( ( ret_val = OTC_OpenSM( cur_env, FALSE, &sm_exists ) ) == TFLE_NO_ERR ) {
+ DRIVER_CALL( drv_hdl, TpReadEndSet( drv_hdl, (INT16)0, (INT16)TO_EOD ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM, (VOID)0 )
+ if( ( ret_val = OTC_GetPrevSM( channel, channel->cur_buff, get_best, TRUE ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ } else {
+ /* we need to skip the SM header */
+ if( fseek( cur_env->otc_sm_fptr, (long)sizeof( MTF_SM_HDR ),
+ SEEK_SET ) != 0 ) {
+ ret_val = TFLE_OTC_FAILURE ;
+ }
+ }
+ *complete = !( cur_env->sm_at_eom ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_LoadFDD
+
+ Description: This function loads the File/Directory Detail at the PBA
+ specified in channel->ui_tpos into a temporary file on
+ disk and sets it up for F40_GetNextFDDEntry.
+
+ Returns: INT - TFLE_xxx or TF_xxx as appropriate.
+
+ Notes: None.
+
+**/
+
+INT F40_LoadFDD(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT ret_val = TFLE_NO_ERR ;
+
+ if( cur_env->otc_buff == NULL ) {
+ /* This can only happen if a realloc call in OTC_GenDirEntry
+ failed during a previous backup.
+ */
+ if( ( cur_env->otc_buff = calloc( F40_INIT_OTC_BUFF_SIZE, 1 ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ cur_env->otc_buff_size = F40_INIT_OTC_BUFF_SIZE ;
+ }
+
+ if( !cur_env->fdd_continuing ) {
+ ret_val = OTC_OpenFDD( cur_env ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ if( ( ret_val = OTC_FDDtoFile( channel ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ }
+ }
+
+ /* We may have hit EOM reading the FDD */
+ if( IsPosBitSet( channel->cur_drv, AT_EOM ) ) {
+ ret_val = TF_NEED_NEW_TAPE ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+
+ /* Initialize the OTC buffer. Setting remaining to 0 will force
+ OTC_GetFDDType to read in the first buffer full of FDD data
+ the first time he is called.
+ */
+ cur_env->otc_buff_ptr = cur_env->otc_buff ;
+ cur_env->otc_buff_remaining = 0 ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_GetNextSMEntry
+
+ Description: This function gets an entry from the Set Map currently
+ loaded on disk and translates it into a DBLK stored in
+ the channel cur_dblk.
+
+ Returns: INT - TFLE_xxx or TF_xxx as appropriate.
+
+ Notes: None.
+
+**/
+
+INT F40_GetNextSMEntry(
+ CHANNEL_PTR channel )
+{
+ INT ret_val = TFLE_NO_ERR ;
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+
+ msassert( cur_env->otc_sm_fptr != NULL ) ;
+ if( ( ret_val = OTC_RdSSET( channel ) ) == TF_NO_MORE_ENTRIES ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ }
+
+ if( IsTFLE( ret_val ) ) {
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_GetNextFDDEntry
+
+ Description: This function gets an entry from the File/Directory
+ Detail currently loaded on disk and translates it into
+ a DBLK stored in the channel cur_dblk.
+
+ Returns: INT - TFLE_xxx or TF_xxx as appropriate.
+
+ Notes: Continuation entries and Volume entries are skipped
+ because the upper layers don't currently want to see
+ them.
+
+ When the end entry is encountered, the message
+ TF_NO_MORE_ENTRIES is returned.
+
+**/
+
+INT F40_GetNextFDDEntry(
+ CHANNEL_PTR channel )
+{
+ UINT16 blk_type = FDD_UNKNOWN_BLK ;
+ INT ret_val = TFLE_NO_ERR ;
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+
+ msassert( cur_env->otc_fdd_fptr != NULL ) ;
+ while( ret_val == TFLE_NO_ERR && blk_type == FDD_UNKNOWN_BLK ) {
+ if( ( ret_val = OTC_GetFDDType( channel, &blk_type ) ) == TFLE_NO_ERR ) {
+ if( blk_type == FDD_VOL_BLK ) {
+ if( ( ret_val = OTC_SkipFDDEntry( channel ) ) == TFLE_NO_ERR ) {
+ if( ( ret_val = OTC_SkipFDDContEntries( channel ) ) == TFLE_NO_ERR ) {
+ ret_val = OTC_GetFDDType( channel, &blk_type ) ;
+ }
+ }
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+
+ switch( blk_type ) {
+
+ case FDD_DIR_BLK :
+ ret_val = OTC_RdDIR( channel ) ;
+ break ;
+
+ case FDD_FILE_BLK :
+ ret_val = OTC_RdFILE( channel ) ;
+ break ;
+
+ case FDD_END_BLK :
+ ret_val = TF_NO_MORE_ENTRIES ;
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ break ;
+
+ case FDD_UNKNOWN_BLK :
+ ret_val = OTC_SkipFDDEntry( channel ) ;
+ break ;
+
+ default :
+ msassert( FALSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ break ;
+ }
+ }
+ }
+ }
+
+ if( IsTFLE( ret_val ) ) {
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: F40_CloseCatalogs
+
+ Description: This function is just an API shell for deleteing the
+ temporary OTC files.
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+
+VOID F40_CloseCatalogs( VOID_PTR env_ptr )
+{
+ OTC_Close( (F40_ENV_PTR)env_ptr, OTC_CLOSE_ALL, TRUE ) ;
+}
+
diff --git a/private/utils/ntbackup/src/nostrad.rc b/private/utils/ntbackup/src/nostrad.rc
new file mode 100644
index 000000000..43ecf39bc
--- /dev/null
+++ b/private/utils/ntbackup/src/nostrad.rc
@@ -0,0 +1,89 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: nostrad.rc
+
+ Description: This file contains the headers and resource files to build
+ the 32-bit Windows/NT GUI Project Resource File created
+ under OEM contract for Microsoft Corporation.
+
+ This file was initially created by copying and modifying
+ WntrPark.Rc which is used for the standard Windows
+ Maynstream product.
+
+ File Names: All files included by this this file are named
+ using the following conventions:
+
+ - If the file was previously created for use with
+ the standard Windows Maynstream product, the
+ original file name not changed.
+
+ - If the file was created by copying and modifying
+ a file previously created for the Windows
+ Maynstream product, the file name is appended
+ with 'OM' and the remaining portion of the
+ file name is truncated if necessary. OM stands
+ for OEM Microsoft. Example:
+ ACCKEYS.H becomes OMACCKEY.H
+
+ - All new files created specifically for this project
+ are given a name starting with 'OM'.
+ Eg.: OMNEW.RC or OM_NEW.RC, etc.
+
+ $Log: G:/UI/LOGFILES/NOSTRAD.RCV $
+
+ Rev 1.4 16 Nov 1993 19:34:28 STEVEN
+ add support for filever
+
+ Rev 1.3 18 Dec 1992 11:25:20 chrish
+ Consolidated dialogs, now using one common file to hold
+ all the dialogs ... "dialogs.rc"
+
+ Rev 1.2 24 Aug 1992 15:21:16 DAVEV
+ include bkuevent.rc for NT Event Logging
+
+ Rev 1.1 18 Mar 1992 14:47:00 DAVEV
+
+
+ Rev 1.0 03 Mar 1992 12:23:00 DAVEV
+ Initial revision.
+
+
+******************************************************************************/
+
+#define OEM_MSOFT 1
+
+#include <windows.h>
+
+#include "ss_gui.h"
+#include "cursors.h"
+#include "icons.h"
+#include "bitmaps.h"
+#include "ommenus.h" // modified from menus.h
+#include "keys.h"
+#include "omstring.h" // modified from strings.h
+#include "dialogs.h"
+#include "eng_msg.h"
+#include "eng_err.h"
+#include "eng_dbug.h"
+
+#include "proddefs.h" // THIS FILE MUST BE TRANSLATED!!!!!
+
+#ifdef OEM_EMS
+#include "ctl3d.h"
+#endif
+
+#include "cursors.rc"
+#include "icons.rc"
+#include "bitmaps.rc"
+#include "ommenus.rc" // modified from menus.rc
+#include "omacckey.rc" // modified from acckeys.rc
+#include "omstring.rc" // modified from strings.rc
+#include "dialogs.rc"
+#include "version.rc" // Conner keeps deleting this.
+
+#ifdef OS_WIN32
+# include "bkuevent.rc" // include messages for NT Event Logging
+#endif
diff --git a/private/utils/ntbackup/src/nothing.c b/private/utils/ntbackup/src/nothing.c
new file mode 100644
index 000000000..ba64be408
--- /dev/null
+++ b/private/utils/ntbackup/src/nothing.c
@@ -0,0 +1,34 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: nothing.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: L:/LOGFILES/NOTHING.C_V $
+
+ Rev 1.1 18 Aug 1992 10:05:34 BURT
+fix warnings
+
+ Rev 1.0 09 May 1991 13:34:34 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+
+/* $end$ include list */
+
+#include "stdtypes.h"
+
+
+UINT16 nothing( VOID )
+{
+
+ return SUCCESS ;
+
+}
+
diff --git a/private/utils/ntbackup/src/ntbackup.c b/private/utils/ntbackup/src/ntbackup.c
new file mode 100644
index 000000000..45f5bbf62
--- /dev/null
+++ b/private/utils/ntbackup/src/ntbackup.c
@@ -0,0 +1,309 @@
+
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: backup.c
+
+ Description: This file contains the WinMain() for the GUI Windows
+ Application. This is the 'C' main() for Windows.
+
+ $Log: J:/UI/LOGFILES/BACKUP.C_V $
+
+ Rev 1.22.1.12 11 Feb 1994 16:38:36 GREGG
+Removed old command line preprocessor since we call new one in gui.c.
+
+ Rev 1.22.1.11 13 Jan 1994 18:20:20 GREGG
+Mike P's fix so Orcas could use tip of globals.c and globals.h.
+
+ Rev 1.22.1.10 20 Dec 1993 15:13:40 GLENN
+Fixed multiple instance 20 second delay for OEM_MSOFT.
+
+ Rev 1.22.1.9 16 Dec 1993 13:19:02 BARRY
+Placed TEXT around string literal
+
+ Rev 1.22.1.8 03 Dec 1993 13:33:00 GREGG
+Removed TEXT macro from around string defines which already have TEXT macro.
+
+ Rev 1.22.1.7 18 Oct 1993 18:47:54 STEVEN
+fixed unicode bo-bo
+
+ Rev 1.22.1.6 26 May 1993 17:49:32 CHUCKB
+Changed sleep to Sleep to get rid of a warning.
+
+ Rev 1.22.1.5 26 May 1993 15:29:54 STEVEN
+fix another text()
+
+ Rev 1.22.1.4 26 May 1993 14:41:20 STEVEN
+fix typo
+
+ Rev 1.22.1.3 26 May 1993 12:05:24 STEVEN
+added text macro for version constants
+
+ Rev 1.22.1.2 14 May 1993 16:02:48 GLENN
+Returning msg.wParam for return code.
+
+ Rev 1.22.1.1 10 May 1993 09:11:46 CHUCKB
+Adjusted sleep time in checking for previous instance.
+
+ Rev 1.22.1.0 07 May 1993 16:43:12 CHUCKB
+Put in sleep and check for frame window to make sure we can come back up
+after an abend.
+
+ Rev 1.22 19 Apr 1993 15:26:12 GLENN
+Changed return code back to 0. Return code is passed in quit message.
+
+ Rev 1.21 09 Apr 1993 14:05:30 GLENN
+Added global return code. Beautified code.
+
+ Rev 1.20 23 Mar 1993 13:11:18 DARRYLP
+Once again... Missed a few changes.
+
+ Rev 1.18 22 Mar 1993 14:49:20 DARRYLP
+Altered the way we check for previous instances to make it "Cleaner".
+This should fix EPR#22 for Cayman.
+
+ Rev 1.17 22 Mar 1993 13:38:06 DARRYLP
+Altered startup code to check not only for a file mapping, but to check
+and see if our Frame window is already up.
+
+ Rev 1.16 15 Mar 1993 16:57:12 DARRYLP
+Removed unwanted string functions from my last fix.
+
+ Rev 1.15 15 Mar 1993 15:58:54 DARRYLP
+Brought inactive window to foreground when re-started.
+
+ Rev 1.13 15 Mar 1993 14:53:54 DARRYLP
+Only Restore for EPR31 if Iconic.
+
+ Rev 1.12 15 Mar 1993 14:44:28 chrish
+Fix for command line, oops on /z command.
+
+ Rev 1.11 15 Mar 1993 14:43:04 DARRYLP
+Restore minimized application when an attempt to execute a
+subsequent instance occurs. Fix for EPR #31.
+
+ Rev 1.10 10 Mar 1993 14:15:58 chrish
+Made a change for CAYMAN NT in the AlterTheCmdLineParam routine.
+
+ Rev 1.9 09 Mar 1993 14:27:02 chrish
+Added fix for command line argument passed.
+
+ Rev 1.8 25 Feb 1993 12:16:36 CHUCKB
+Fixed check for duplicate instances.
+
+ Rev 1.7 07 Dec 1992 15:06:38 STEVEN
+updates from msoft
+
+ Rev 1.6 20 Nov 1992 14:54:50 DAVEV
+fix cmd line processing for NT
+
+ Rev 1.5 18 Nov 1992 15:47:30 MIKEP
+fix malloc changes
+
+ Rev 1.4 17 Nov 1992 21:24:30 DAVEV
+unicode fixes
+
+ Rev 1.3 04 Oct 1992 19:32:22 DAVEV
+Unicode Awk pass
+
+ Rev 1.2 18 Aug 1992 17:49:42 DAVEV
+Chgs for switch to prev inst as per Microsoft
+
+ Rev 1.1 30 Jul 1992 10:04:12 davev
+Chgs for switching to prev app on 2nd instance
+
+ Rev 1.0 21 May 1992 15:09:02 MIKEP
+Initial revision.
+
+
+******************************************************************************/
+
+#include "all.h"
+
+// GLOBALS - APPLICATION SPECIFIC
+
+CHAR * gszAppName = APPLICATIONNAME;
+CHAR * gszExeVer = APP_EXEVER;
+CHAR * gszResVer = APP_RESVER;
+CHAR * gszEngRel = APP_ENGREL;
+
+static HANDLE mhMap;
+
+// FUNCTIONS
+
+#if defined ( OS_WIN32 ) // special feature
+
+static BOOL IsAlreadyRunning( void ) ;
+
+#endif //defined ( OS_WIN32 ) // special feature
+
+
+/******************************************************************************
+
+ Name: WinMain()
+
+ Description: This function is the WinMain() for the GUI Windows
+ Application. IT IS CALLED DIRECTLY BY WINDOWS ONLY.
+ This is the equivalent of a 'C' main() for Windows.
+
+ Returns: NULL or 0 if successful, otherwise ! NULL.
+
+******************************************************************************/
+
+int WINAPI WinMain(
+
+HINSTANCE hInstance, // I - handle of application instance
+HINSTANCE hPrevInstance, // I - handle of any previous instance
+char * lpCmdLine, // I - long pointer to the command line
+int nCmdShow ) // I - how to show the window
+
+{
+ MSG msg;
+ LPSTR pszCmdLine = NULL;
+
+ ghInst = hInstance; // set the global instance handle for the app.
+
+ // Allow only one instance of the application. If this is compiled
+ // under the large memory model, there can only be one instance.
+ // If this is the only instance of the application, initialize.
+
+ // OS_WIN32: Since hPrevInstance is always NULL in NT, it isn't
+ // very informative. IsAlreadyRunning uses shared memory
+ // to check for other instances.
+
+# if defined ( OS_WIN32 ) // special feature
+ {
+
+ pszCmdLine = GetCommandLine (); // chs:03-05-93
+
+ // cycle past the executable name to the first parameter if
+ // there is one...
+
+ while ( *pszCmdLine && isspace ( *pszCmdLine ) ) ++pszCmdLine; // chs:03-05-93
+ while ( *pszCmdLine && !isspace ( *pszCmdLine ) ) ++pszCmdLine; // chs:03-05-93
+ while ( *pszCmdLine && isspace ( *pszCmdLine ) ) ++pszCmdLine; // chs:03-05-93
+
+ // New routine - If IsAlreadyRunning() returns back that we have a prior
+ // instance, we double check to verify before handling the situation.
+
+ if ( IsAlreadyRunning () ) {
+
+ // Get the window handle and Show it restored.
+
+ HWND hWndMain;
+
+ hWndMain = FindWindow ( WMCLASS_FRAME, NULL );
+
+ if ( IsWindow ( hWndMain ) ) {
+
+ if ( IsIconic ( hWndMain ) != FALSE ) {
+ ShowWindow ( hWndMain, SW_RESTORE );
+ }
+
+ SetForegroundWindow ( hWndMain );
+ }
+
+ return 0;
+ }
+ }
+# else
+ {
+ pszCmdLine = lpCmdLine; // chs:03-05-93
+ }
+# endif //defined ( OS_WIN32 ) // special feature
+
+ if ( hPrevInstance || GUI_Init ( pszCmdLine, nCmdShow ) ) {
+
+ return 0;
+ }
+
+ // MAIN MESSAGE LOOP
+ // -----------------
+ //
+ // KEYBOARD: If a keyboard message is for the MDI, let the MDI client
+ // take care of it. Otherwise, check to see if it's a normal
+ // accelerator key (like F3 = find next).
+ //
+ // MODELESS DIALOG:
+ //
+ // OTHERS: Just handle the message as usual.
+ //
+
+
+ // Initialize the application.
+
+ PostMessage ( ghWndFrame, WM_INITAPPLICATION, 0, 0L );
+
+
+ while ( GetMessage ( &msg, NULL, 0, 0 ) ) {
+
+ if ( ! TranslateMDISysAccel ( ghWndMDIClient, &msg ) &&
+ ! TranslateAccelerator ( ghWndFrame, ghAccel, &msg ) &&
+ ( ! ghModelessDialog || ! IsDialogMessage ( ghModelessDialog, &msg ) ) ) {
+
+ TranslateMessage ( &msg );
+ DispatchMessage ( &msg );
+ }
+ }
+
+ GUI_Deinit ();
+
+ CloseHandle ( mhMap );
+
+ return msg.wParam;
+
+} /* end WinMain() */
+
+
+#ifdef OS_WIN32 //special feature
+
+// This function uses shared memory to indicate that it is running.
+// If the call fails, that means that an instance of this app. is already
+// running, and this instance should discontinue itself.
+// Return TRUE if another instance already exists; FALSE otherwise.
+
+static BOOL IsAlreadyRunning ( void )
+{
+ INT nLastErr;
+
+ mhMap = CreateFileMapping ( (HANDLE) -1,
+ NULL,
+ PAGE_READONLY,
+ 0,
+ 1,
+ APPLICATIONNAME
+ );
+
+ nLastErr = GetLastError ();
+
+ if ( mhMap && nLastErr == ERROR_ALREADY_EXISTS ) {
+
+ INT nTimer = 30;
+ BOOL fFound = FALSE;
+
+ // Hunt for the existing application frame window for about
+ // 30 seconds max.
+
+ while ( ! fFound && nTimer > 0 ) {
+
+ if ( FindWindow ( WMCLASS_FRAME, NULL ) ) {
+
+ CloseHandle ( mhMap );
+ mhMap = NULL;
+ fFound = TRUE;
+ }
+ else {
+
+ Sleep ( 1000 );
+ nTimer--;
+ }
+ }
+ }
+
+ return ! mhMap;
+}
+
+#endif //OS_WIN32 //special feature
+
diff --git a/private/utils/ntbackup/src/ntfs_tab.c b/private/utils/ntbackup/src/ntfs_tab.c
new file mode 100644
index 000000000..591c16721
--- /dev/null
+++ b/private/utils/ntbackup/src/ntfs_tab.c
@@ -0,0 +1,184 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ntfs_tab.c
+
+ Description: This file contains the DOS functon table.
+
+
+ $Log: M:/LOGFILES/NTFS_TAB.C_V $
+
+ Rev 1.13 16 Nov 1993 18:13:24 BARRY
+Added init/deinit entry points to set up our static stuff.
+
+ Rev 1.12 29 Sep 1993 20:28:40 GREGG
+Removed the dummy function from the table since it was only there to shut
+the compiler up. The compiler was complaining because the last initializer
+was followed by a comma, so I also removed the last comma, and in some
+cases, added NULLs for new functions which had been added to the bottom of
+the table since the last update.
+Files Modified: GEN_TAB.C, GR_TAB.C, TSA_TAB.C, TS_TAB.C, MNET_TAB.C,
+ SMS_TAB.C, NTFS_TAB.C and FSYS_STR.H
+
+ Rev 1.11 30 Jul 1993 13:18:16 STEVEN
+if dir too deep make new one
+
+ Rev 1.10 29 Jun 1993 16:22:12 BARRY
+Don't GetSpecialDBLKs for Cayman.
+
+ Rev 1.9 27 Jun 1993 14:36:56 MIKEP
+Don't generate special files for cayman.
+
+ Rev 1.8 13 May 1993 21:24:10 BARRY
+For NTBACKUP use real EnumSpecial files; for others, don't enum reg files.
+
+ Rev 1.7 21 Oct 1992 11:53:04 STEVEN
+added SpecialExclude
+
+ Rev 1.6 14 Oct 1992 16:33:22 STEVEN
+fix typos
+
+ Rev 1.5 22 Sep 1992 15:36:20 BARRY
+Got rid of GetTotalSizeDBLK.
+
+ Rev 1.4 03 Sep 1992 17:06:32 STEVEN
+add support for volume name
+
+ Rev 1.3 22 May 1992 16:05:16 STEVEN
+
+
+ Rev 1.2 12 Mar 1992 15:50:08 STEVEN
+64 bit changes
+
+ Rev 1.1 13 Feb 1992 10:44:34 STEVEN
+fix stuff
+
+ Rev 1.0 20 Jan 1992 14:48:20 STEVEN
+Initial revision.
+**/
+/* begin include list */
+#include <windows.h>
+#include "stdtypes.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfs_fs.h"
+#include "gen_fs.h"
+/* $end$ include list */
+
+FUNC_LIST NTFSFuncTab = {
+
+ NTFS_InitFileSys,
+ NTFS_FindDrives,
+ GEN_RemoveDLE,
+ NTFS_DeInitFileSys,
+
+ NTFS_DeviceDispName,
+ NTFS_GetVolName,
+ NTFS_SizeofVolName,
+ GEN_MakePath,
+ NTFS_InitMakeData,
+
+ NTFS_IsBlkComplete,
+ NTFS_CompleteBlk,
+ NTFS_DupBlk,
+ NTFS_ReleaseBlk,
+
+ NTFS_AttachToDLE,
+ NTFS_DetachDLE,
+ NTFS_EndOperationOnDLE,
+
+ NTFS_ProcessDDB,
+ NTFS_GetCurrentDDB,
+ NTFS_GetCurrentPath,
+ NULL,
+ NULL,
+ NULL,
+ NTFS_ChangeDir,
+ NTFS_UpDir,
+
+#ifdef TDEMO
+ NULL,
+ NTFS_OpenObj,
+ NTFS_SeekObj,
+ NTFS_ReadObj,
+ NULL,
+ NULL,
+ NTFS_CloseObj,
+ NULL,
+ NTFS_GetObjInfo,
+ NULL,
+ NTFS_VerObjInfo,
+#else
+ NTFS_CreateObj,
+ NTFS_OpenObj,
+ NTFS_SeekObj,
+ NTFS_ReadObj,
+ NTFS_WriteObj,
+ NTFS_VerObj,
+ NTFS_CloseObj,
+ NTFS_DeleteObj,
+ NTFS_GetObjInfo,
+ NTFS_SetObjInfo,
+ NTFS_VerObjInfo,
+#endif
+
+ NTFS_FindFirst,
+ NTFS_FindNext,
+ NTFS_PushMinDDB,
+ NTFS_PopMinDDB,
+
+#if defined ( OEM_MSOFT )
+ NTFS_GetSpecDBLKS,
+ NTFS_EnumSpecFiles,
+#else
+ DUMMY_GetSpecDBLKS,
+ DUMMY_EnumSpecFiles,
+#endif
+
+ NTFS_ModFnameFDB,
+ NTFS_ModPathDDB,
+ NTFS_GetOSFnameFDB,
+ GEN_GetPartName,
+ NTFS_GetOSPathDDB,
+ NTFS_GetCdateDBLK,
+ NTFS_GetMdateDBLK,
+ NTFS_ModBdateDBLK,
+ NTFS_ModAdateDBLK,
+ NTFS_GetDisplaySizeDBLK,
+ NTFS_ModAttribDBLK,
+ NTFS_GetFileVerFDB,
+ NTFS_SetOwnerId,
+
+ NTFS_GetObjTypeDBLK,
+
+ NTFS_SizeofFname,
+ NTFS_SizeofPath,
+ NTFS_SizeofOSFname,
+ GEN_SizeofPartName, /* IMAGE size of part name */
+ NTFS_SizeofOSPath,
+
+ NTFS_SizeofOSInfo,
+
+ NTFS_GetOS_InfoDBLK,
+ NTFS_GetActualSizeDBLK,
+
+ DUMMY_InitGOS,
+
+ NTFS_CreateFDB,
+ GEN_CreateIDB,
+ NTFS_CreateDDB,
+ NTFS_ChangeIntoDDB,
+
+#if defined ( OEM_MSOFT )
+ NTFS_SpecExcludeObj,
+#else
+ GEN_SpecExcludeObj,
+#endif
+ GEN_SetDataSize,
+ NULL, /* SetObjTypeDBLK, */
+ DUMMY_LogoutDevice,
+ NTFS_FindClose,
+ NULL, /* SizeofDevName */
+ NULL /* GeneratedErrorLog */
+} ;
diff --git a/private/utils/ntbackup/src/ntfslink.c b/private/utils/ntbackup/src/ntfslink.c
new file mode 100644
index 000000000..454b07a7b
--- /dev/null
+++ b/private/utils/ntbackup/src/ntfslink.c
@@ -0,0 +1,476 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ntfslink.c
+
+ Date Updated: 20-Oct-92
+
+ Description: Miscellaneous convenience functions for support
+ of linked-files in the NT file system.
+
+ $Log: M:/LOGFILES/NTFSLINK.C_V $
+
+ Rev 1.13 24 Nov 1993 14:35:22 BARRY
+Unicode fixes
+
+ Rev 1.12 30 Jul 1993 13:19:36 STEVEN
+if dir too deep make new one
+
+ Rev 1.11 21 Jul 1993 16:09:38 BARRY
+Add case for FS_NOT_FOUND in error routine.
+
+ Rev 1.10 16 Jul 1993 11:59:50 BARRY
+Add FS_NO_MORE to error translation routine.
+
+ Rev 1.9 02 Jun 1993 14:35:22 BARRY
+Was closing wrong handle in NTFS_LinkFileToFDB
+
+ Rev 1.8 12 Mar 1993 13:13:24 STEVEN
+fix warnings
+
+ Rev 1.7 27 Jan 1993 13:50:46 STEVEN
+updates from msoft
+
+ Rev 1.6 15 Jan 1993 13:19:04 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.5 24 Nov 1992 11:01:48 BARRY
+Changes to make LINK streams null-impregnated.
+
+ Rev 1.4 17 Nov 1992 22:19:06 DAVEV
+unicode fixes
+
+ Rev 1.3 17 Nov 1992 15:22:58 BARRY
+Updates after testing with Backup APIs.
+
+ Rev 1.2 10 Nov 1992 08:33:14 STEVEN
+fix path name to full_name_ptr
+
+ Rev 1.1 29 Oct 1992 16:49:02 BARRY
+Restore links coded (need Unicode support, though.
+
+ Rev 1.0 21 Oct 1992 19:57:22 BARRY
+Initial revision.
+
+**/
+
+
+#include <windows.h>
+#include <string.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+#include "queues.h"
+
+#include "beconfig.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+
+
+static BOOLEAN SearchFunc( INT8_PTR elem, INT8_PTR parm );
+
+typedef struct {
+ DWORD lo;
+ DWORD hi;
+} LINK_ID;
+
+/**/
+/**
+
+ Name: NTFS_SearchLinkQueue()
+
+ Description: Search the linkq for the file specified by its
+ unique id.
+
+ Modified: 20-Oct-92
+
+ Returns: A pointer to the linkq element if found,
+ NULL if not found.
+
+**/
+NTFS_LINK_Q_ELEM_PTR NTFS_SearchLinkQueue( FSYS_HAND fsh,
+ DWORD idHi,
+ DWORD idLo )
+{
+ NTFS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+ LINK_ID id;
+
+ id.lo = idLo;
+ id.hi = idHi;
+
+ return (NTFS_LINK_Q_ELEM_PTR)SearchQueue( &res->linkq,
+ SearchFunc,
+ (INT8_PTR)&id,
+ FALSE );
+}
+static BOOLEAN SearchFunc( INT8_PTR elem, INT8_PTR parm )
+{
+ NTFS_LINK_Q_ELEM_PTR linkElem = (NTFS_LINK_Q_ELEM_PTR)elem;
+ LINK_ID *id = (LINK_ID *)parm;
+
+ return id->lo == linkElem->idLo && id->hi == linkElem->idHi;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_EnqueueLinkInfo(()
+
+ Description: Adds a file to the link queue. (Presumably because
+ the file has links and we just backed it up.)
+
+ Modified: 20-Oct-92
+
+ Returns: SUCCESS
+ FAILURE
+
+ Notes:
+
+**/
+INT16 NTFS_EnqueueLinkInfo( FSYS_HAND fsh,
+ DWORD idHi,
+ DWORD idLo,
+ CHAR_PTR path,
+ CHAR_PTR name )
+{
+ NTFS_LINK_Q_ELEM_PTR elem;
+ NTFS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+ size_t sizeNeeded;
+ INT16 ret = FAILURE;
+
+ sizeNeeded = sizeof( NTFS_LINK_Q_ELEM );
+
+ /* Need room for path, name, and maybe a separator */
+ sizeNeeded += strsize( path ) + strsize( name ) + sizeof( CHAR );
+
+ if ( (elem = malloc( sizeNeeded )) != NULL )
+ {
+ CHAR_PTR p;
+
+ InitQElem( &elem->q );
+
+ elem->idHi = idHi;
+ elem->idLo = idLo;
+ elem->linkName = (CHAR_PTR)(elem + 1);
+
+ strcpy( elem->linkName, path + 1 );
+ if ( (strlen(elem->linkName) > 0) &&
+ (*(path + strlen( path ) - 1) != TEXT('\\')) )
+ {
+ strcat( elem->linkName, TEXT("\\") );
+ }
+ strcat( elem->linkName, name );
+ elem->linkNameLen = strsize( elem->linkName ) ;
+
+ for ( p = elem->linkName; ( *p ); p++ )
+ {
+ if ( *p == TEXT('\\') )
+ {
+ *p = TEXT('\0');
+ }
+ }
+ EnQueueElem( &res->linkq, &elem->q, FALSE );
+ }
+ return ret;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_LinkFileToFDB()
+
+ Description: Links the FDB in the hand with the original file
+ whose full path was received in WriteObj.
+
+ Modified: 13-Nov-92
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+ FS_ACCESS_DENIED if link could not be performed
+
+**/
+INT16 NTFS_LinkFileToFDB( FILE_HAND hand )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ INT16 ret = FS_ACCESS_DENIED;
+ HANDLE fhand;
+ INT temp_size;
+
+ /* Open the original file.... */
+
+#if defined( UNICODE )
+ if ( hand->dblk->com.string_type == BEC_ANSI_STR )
+ {
+ ACHAR *p = (ACHAR *)nt_hand->linkBuffer;
+ UINT16 i;
+
+ for ( i = 0; (i < (nt_hand->linkNameLen - 1)); i++, p++ )
+ {
+ if ( *p == (ACHAR)'\0' )
+ {
+ *p = (ACHAR)'\\';
+ }
+ }
+ temp_size = nt_hand->linkBufferSize ;
+
+ mapAnsiToUnic( (ACHAR_PTR)nt_hand->linkBuffer,
+ (WCHAR_PTR)nt_hand->linkBuffer,
+ &temp_size );
+
+ nt_hand->linkBufferSize = temp_size ;
+ }
+#else
+ if ( hand->dblk->com.string_type == BEC_UNIC_STR )
+ {
+ WCHAR *p = (WCHAR *)nt_hand->linkBuffer;
+ UINT16 i;
+
+ for ( i = 0; (i < (nt_hand->linkNameLen - 1)); i++, p++ )
+ {
+ if ( *p == (WCHAR)'\0' )
+ {
+ *p = (WCHAR)'\\';
+ }
+ }
+
+ temp_size = nt_hand->linkBufferSize ;
+
+ mapUnicToAnsi( (WCHAR_PTR)nt_hand->linkBuffer,
+ (ACHAR_PTR)nt_hand->linkBuffer,
+ (const ACHAR)'_',
+ &temp_size );
+
+ nt_hand->linkBufferSize = temp_size ;
+ }
+#endif
+ else
+ {
+ CHAR *p = nt_hand->linkBuffer;
+ UINT16 i;
+
+ for ( i = 0; (i < (nt_hand->linkNameLen - 1)/sizeof(CHAR)); i++, p++ )
+ {
+ if ( (*p == TEXT('\0')) && (*(p+1) == TEXT('\0')) ) {
+ break ;
+ }
+
+ if ( *p == TEXT('\0') )
+ {
+ *p = TEXT('\\');
+ }
+ }
+ }
+
+ fhand = CreateFile( nt_hand->linkBuffer,
+ GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
+ NULL ) ;
+
+ if ( fhand == INVALID_HANDLE_VALUE ) {
+ return FS_ACCESS_DENIED ;
+
+ } else {
+// if ( fhand != INVALID_HANDLE_VALUE )
+// {
+ NTFS_DBLK_PTR fdb = (NTFS_DBLK_PTR)hand->dblk;
+ BOOLEAN stat;
+ WCHAR_PTR uniPath;
+ size_t pathCharCount;
+ INT uniBufferSize;
+
+ /* Stuff the current path and name as link data to the original. */
+
+ pathCharCount = strsize( DLE_GetDeviceName( hand->fsh->attached_dle ) );
+ pathCharCount += sizeof( CHAR ) ;
+ pathCharCount += strsize( hand->fsh->cur_dir ) ;
+ if ( *(hand->fsh->cur_dir + strlen( hand->fsh->cur_dir) - 1) != TEXT('\\') )
+ {
+ pathCharCount += sizeof( CHAR );
+ }
+ pathCharCount += strsize( fdb->full_name_ptr->name );
+ pathCharCount+= sizeof(CHAR); // Account for NULL
+
+ uniBufferSize = pathCharCount * sizeof(WCHAR) ;
+
+ uniPath = (WCHAR_PTR)malloc( uniBufferSize );
+
+ if ( uniPath == NULL )
+ {
+ ret = OUT_OF_MEMORY;
+ }
+ else
+ {
+ VOID_PTR context = NULL;
+ DWORD sizeout;
+
+ strcpy( (CHAR_PTR)uniPath, DLE_GetDeviceName( hand->fsh->attached_dle ) );
+ strcat( (CHAR_PTR)uniPath, hand->fsh->cur_dir );
+ if ( *(hand->fsh->cur_dir + strlen( hand->fsh->cur_dir) - 1) != TEXT('\\') )
+ {
+ strcat( (CHAR_PTR)uniPath, TEXT("\\") );
+ }
+ strcat( (CHAR_PTR)uniPath, fdb->full_name_ptr->name );
+
+#if !defined( UNICODE )
+ mapAnsiToUnic( (ACHAR_PTR)uniPath, uniPath, &uniBufferSize );
+#endif
+
+ nt_hand->streamHeader.id = BACKUP_LINK;
+ nt_hand->streamHeader.attrib = 0;
+ nt_hand->streamHeader.size_hi = 0;
+ nt_hand->streamHeader.size_lo = uniBufferSize;
+ nt_hand->streamHeader.name_leng = 0;
+
+ stat = BackupWrite( fhand,
+ (LPBYTE)&nt_hand->streamHeader,
+ NT_SIZEOF_NAMELESS_STREAM_HEAD,
+ &sizeout,
+ FALSE,
+ TRUE,
+ &context );
+ if ( stat )
+ {
+ stat = BackupWrite( fhand,
+ (LPBYTE)uniPath,
+ nt_hand->streamHeader.size_lo,
+ &sizeout,
+ FALSE,
+ TRUE,
+ &context );
+ }
+
+ if ( stat )
+ {
+ ret = SUCCESS;
+ }
+
+ /* Need to let Backup API clean up context? */
+
+ if ( context != NULL )
+ {
+ BackupRead( fhand, NULL, 0, NULL, TRUE, FALSE, &context );
+ }
+ free( uniPath );
+ }
+ CloseHandle( fhand );
+ }
+ return ret;
+}
+
+/**/
+/**
+
+ Name: NTFS_TranslateBackupError()
+
+ Description: Translates Win32 errors received from BackupRead
+ or BackupWrite to an FS_XXX error code.
+
+ Modified: 13-Jan-93
+
+ Returns: FS error code mapped from Win32 error.
+
+ Notes: Not intended to map all errors, but primarily those
+ encountered when using BackupRead & BackupWrite.
+
+**/
+INT16 NTFS_TranslateBackupError( DWORD backupError )
+{
+ INT16 ret;
+
+ switch ( backupError )
+ {
+ case ERROR_FILENAME_EXCED_RANGE:
+ ret = FS_PATH_TOO_LONG ;
+ break;
+
+ case ERROR_FILE_NOT_FOUND:
+ ret = FS_NOT_FOUND;
+ break;
+
+ case ERROR_NO_MORE_FILES:
+ case ERROR_NO_MORE_ITEMS:
+ ret = FS_NO_MORE;
+ break;
+
+ case ERROR_ALREADY_EXISTS:
+ case ERROR_DRIVE_LOCKED:
+ case ERROR_WRITE_PROTECT:
+ case ERROR_INVALID_OWNER:
+ ret = FS_ACCESS_DENIED;
+ break;
+
+ case ERROR_DEV_NOT_EXIST:
+ case ERROR_NOT_DOS_DISK:
+ case ERROR_READ_FAULT:
+ case ERROR_WRITE_FAULT:
+ ret = FS_DEVICE_ERROR;
+ break;
+
+ case ERROR_DISK_FULL:
+ case ERROR_HANDLE_DISK_FULL:
+ ret = FS_OUT_OF_SPACE;
+ break;
+
+ case ERROR_DISK_CORRUPT:
+ case ERROR_FILE_CORRUPT:
+ case ERROR_FILE_INVALID:
+ case ERROR_SEEK:
+ ret = FS_OBJECT_CORRUPT;
+ break;
+
+ case ERROR_HANDLE_EOF:
+ ret = FS_EOF_REACHED;
+ break;
+
+ case ERROR_EA_ACCESS_DENIED:
+ case ERROR_EA_FILE_CORRUPT:
+ case ERROR_EA_LIST_INCONSISTENT:
+ case ERROR_EA_TABLE_FULL:
+ case ERROR_INVALID_ACL:
+ case ERROR_EAS_NOT_SUPPORTED:
+ ret = FS_STREAM_CORRUPT;
+ break;
+
+ case ERROR_INVALID_HANDLE:
+ ret = FS_OBJECT_NOT_OPENED;
+ break;
+
+ case ERROR_LOCK_FAILED:
+ case ERROR_LOCK_VIOLATION:
+ ret = FS_UNABLE_TO_LOCK;
+ break;
+
+ case ERROR_NETWORK_BUSY:
+ case ERROR_PATH_BUSY:
+ ret = FS_BUSY;
+ break;
+
+ case ERROR_SHARING_VIOLATION:
+ ret = FS_IN_USE_ERROR;
+ break;
+
+ case NO_ERROR:
+ ret = SUCCESS;
+ break;
+
+ default:
+ ret = FS_ACCESS_DENIED; // CBN -- Need better default
+ break;
+ }
+ return ret;
+}
+
diff --git a/private/utils/ntbackup/src/ntfsregy.c b/private/utils/ntbackup/src/ntfsregy.c
new file mode 100644
index 000000000..fc042ef8f
--- /dev/null
+++ b/private/utils/ntbackup/src/ntfsregy.c
@@ -0,0 +1,1330 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: ntfsregy.c
+
+ Description: This file contains code to work with registry's on
+ NT machines.
+
+ $Log: N:/LOGFILES/NTFSREGY.C_V $
+
+ Rev 1.13.1.11 31 Jan 1994 20:37:26 STEVEN
+remove mac syntax from Reg calls
+
+ Rev 1.13.1.10 07 Jan 1994 19:04:50 STEVEN
+event file check must skip mac stuff
+
+ Rev 1.13.1.9 04 Jan 1994 11:08:14 BARRY
+Fixed lots of Unicode problems
+
+ Rev 1.13.1.8 21 Oct 1993 15:17:44 BARRY
+Now pass device name instead of drive letter to REG_GetRegistryPath
+
+ Rev 1.13.1.7 17 Aug 1993 20:02:22 STEVEN
+fix unicode bug
+
+ Rev 1.13.1.6 16 Aug 1993 18:14:40 BARRY
+Fix warning
+
+ Rev 1.13.1.5 26 Jul 1993 17:03:26 STEVEN
+fixe restore active file with registry
+
+ Rev 1.13.1.4 26 Jul 1993 16:48:14 STEVEN
+fix restore over active files
+
+ Rev 1.13.1.3 17 Jun 1993 12:35:50 STEVEN
+changed OpenRegistry calls to CreateRegistry calls
+
+ Rev 1.13.1.2 03 May 1993 20:42:14 BARRY
+Hacked out the remote registry stuff that doesn't belong.
+
+ Rev 1.13.1.1 02 May 1993 19:49:40 BARRY
+Comparing registry paths with case-sensitive compare can't be done
+any longer since the UI is lowercasing paths before they're sent down.
+
+ Rev 1.13.1.0 19 Apr 1993 11:16:34 BARRY
+Steve's registry fixes from Microsoft.
+
+ Rev 1.13 08 Feb 1993 07:55:08 STEVEN
+fix unable to restore registry problem.
+
+ Rev 1.12 07 Dec 1992 14:16:54 STEVEN
+updates from msoft
+
+ Rev 1.11 23 Nov 1992 09:32:16 STEVEN
+fix support for event log
+
+ Rev 1.10 03 Nov 1992 15:32:52 MIKEP
+call GetLastError to see if privileges ok
+
+ Rev 1.9 28 Oct 1992 12:18:18 STEVEN
+event stuff not needed
+
+ Rev 1.8 26 Oct 1992 10:57:34 MIKEP
+event file stuff
+
+ Rev 1.7 21 Oct 1992 19:40:32 BARRY
+Fixed warning.
+
+ Rev 1.6 20 Oct 1992 17:35:02 STEVEN
+started support for Event files
+
+ Rev 1.5 20 Oct 1992 13:13:40 STEVEN
+made it compile
+
+ Rev 1.4 19 Oct 1992 15:13:02 unknown
+fix REG_Restore
+
+ Rev 1.3 16 Oct 1992 14:59:02 STEVEN
+added support for backing up registry
+
+ Rev 1.2 07 Oct 1992 15:55:20 MIKEP
+fix tabs
+
+ Rev 1.1 07 Oct 1992 15:33:24 STEVEN
+registry.h does not exist
+
+ Rev 1.0 05 Oct 1992 13:34:54 STEVEN
+Initial revision.
+
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <memory.h>
+#include <windows.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdwcs.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfs_fs.h"
+
+
+// Local Defines
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+
+// This should be plenty big for the things it is used for here.
+
+#define REG_BUFF_SIZE 256
+
+// Local function prototypes
+
+INT REG_ChopOffDirectory( CHAR * );
+INT REG_CheckEventListForFile( HKEY, CHAR_PTR, CHAR_PTR );
+INT REG_CheckHiveListForFile( HKEY, CHAR_PTR, CHAR_PTR, INT );
+INT REG_CheckSingleEventForFile( HKEY, CHAR *, CHAR * );
+INT REG_GetPathFromHiveEntry( CHAR *, CHAR *, INT * );
+INT REG_GetRegistryPathFromHiveList( HKEY, CHAR *, INT * );
+INT REG_LocalIsRegistryFile( GENERIC_DLE_PTR, CHAR_PTR, CHAR_PTR, INT );
+INT REG_LocalIsEventFile( GENERIC_DLE_PTR, CHAR_PTR, CHAR_PTR );
+INT REG_RestoreActiveRegistryFile( CHAR *, CHAR *, CHAR * );
+INT REG_SaveActiveRegistryFile( CHAR *, CHAR * );
+
+/**/
+/**
+
+ Name: REG_AssertBackupPrivilege
+
+ Description: Tell the OS that we will be doing backups.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_AssertBackupPrivilege()
+{
+ INT ret_val = SUCCESS;
+ HANDLE ProcessHandle;
+ DWORD DesiredAccess;
+ HANDLE TokenHandle;
+ LUID BackupValue;
+ TOKEN_PRIVILEGES NewState;
+
+
+ // get process handle
+
+ ProcessHandle = GetCurrentProcess();
+
+ // open process token
+
+ DesiredAccess = MAXIMUM_ALLOWED;
+
+ if ( ! OpenProcessToken( ProcessHandle, DesiredAccess, &TokenHandle ) ) {
+ return( FAILURE );
+ }
+
+ // adjust backup token privileges
+
+ if ( ! LookupPrivilegeValue( NULL, TEXT("SeBackupPrivilege"), &BackupValue ) ) {
+ ret_val = FAILURE;
+ }
+
+ // Enable backup privilege for this process
+
+ NewState.PrivilegeCount = 1;
+ NewState.Privileges[0].Luid = BackupValue;
+ NewState.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+ if ( ! AdjustTokenPrivileges( TokenHandle, FALSE, &NewState, (DWORD)0, NULL, NULL ) ) {
+ ret_val = FAILURE;
+ }
+
+ // AdjustTokenPriv always returns SUCCESS, call GetLast to see if it worked.
+
+ if ( GetLastError() != ERROR_SUCCESS ) {
+ ret_val = FAILURE;
+ }
+
+ // close process token
+
+ CloseHandle( TokenHandle );
+ return( ret_val );
+}
+
+/**/
+/**
+
+ Name: REG_AssertRestorePrivilege
+
+ Description: Tell the OS that we are going to be doing restores.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_AssertRestorePrivilege( )
+{
+ INT ret_val = SUCCESS;
+ HANDLE ProcessHandle;
+ DWORD DesiredAccess;
+ HANDLE TokenHandle;
+ LUID RestoreValue;
+ TOKEN_PRIVILEGES NewState;
+
+ // get process handle
+
+ ProcessHandle = GetCurrentProcess();
+
+ // open process token
+
+ DesiredAccess = MAXIMUM_ALLOWED;
+
+ if ( ! OpenProcessToken( ProcessHandle, DesiredAccess, &TokenHandle ) ) {
+ return( FAILURE );
+ }
+
+ // adjust restore token privileges
+
+ if ( ! LookupPrivilegeValue( NULL, TEXT("SeRestorePrivilege"), &RestoreValue ) ) {
+ ret_val = FAILURE;
+ }
+
+ // Enable backup privilege for this process
+
+ NewState.PrivilegeCount = 1;
+ NewState.Privileges[0].Luid = RestoreValue;
+ NewState.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+ if ( ! AdjustTokenPrivileges( TokenHandle, FALSE, &NewState, (DWORD)0, NULL, NULL ) ) {
+ ret_val = FAILURE;
+ }
+
+ if ( GetLastError() != ERROR_SUCCESS ) {
+ ret_val = FAILURE;
+ }
+
+ CloseHandle( TokenHandle );
+ return( ret_val );
+}
+
+/**/
+/**
+
+ Name: REG_IsRegistryFile
+
+ Description: Determine if a file is a registry file. This function
+ is for public use.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_IsRegistryFile(
+IN GENERIC_DLE_PTR dle,
+IN CHAR_PTR FileSpec )
+{
+ CHAR ValueKey[ REG_BUFF_SIZE ];
+
+
+ return( REG_LocalIsRegistryFile( dle,
+ FileSpec,
+ ValueKey, REG_BUFF_SIZE ) == SUCCESS );
+}
+
+INT REG_IsEventFile(
+ GENERIC_DLE_PTR dle,
+ CHAR_PTR FileSpec,
+ CHAR_PTR buffer )
+{
+ if ( NTFS_GetRegistryPathSize(dle) != 0 ) {
+
+ return( REG_LocalIsEventFile( dle,
+ FileSpec,
+ buffer ) == SUCCESS );
+ } else {
+ return FALSE ;
+ }
+}
+
+INT REG_IsCurDirRegistryPath(
+IN FSYS_HAND fsh )
+{
+ CHAR_PTR p ;
+
+ if ( NTFS_GetRegistryPathSize(fsh->attached_dle) != 0 ) {
+
+ p = strchr( NTFS_GetRegistryPath( fsh->attached_dle ), TEXT( '\\' ) ) ;
+
+ if ( (p != NULL ) && !stricmp( p, fsh->cur_dir ) ) {
+ return TRUE ;
+ }
+ }
+
+ return FALSE ;
+}
+
+/**/
+/**
+
+ Name: REG_LocalIsEventFile
+
+ Description: Determine if a file is an event file.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_LocalIsEventFile(
+IN GENERIC_DLE_PTR dle,
+IN CHAR_PTR FileSpec,
+OUT CHAR_PTR buffer )
+{
+ HKEY Key;
+ INT RegPathSize;
+ CHAR_PTR p ;
+ INT ret_val = FAILURE;
+ LONG ret;
+ CHAR *FileName;
+ CHAR Machine[ REG_BUFF_SIZE ];
+ CHAR RegPath[ REG_BUFF_SIZE ];
+
+ RegPathSize = NTFS_GetRegistryPathSize(dle) ;
+
+
+ memcpy( RegPath,
+ NTFS_GetRegistryPath(dle),
+ NTFS_GetRegistryPathSize(dle) ) ;
+
+ // Separate the path from the file name.
+
+ p = strrchr( FileSpec, TEXT( '\\' ) ) ;
+
+ if ( p != NULL ) {
+ *p = TEXT( '\0' );
+ FileName = p + 1 ;
+ } else {
+ return( ret_val ) ;
+ }
+
+ // Is this file in the correct path ?
+
+ if ( dle->info.ntfs->mac_name_syntax ) {
+ FileSpec += 4; // this takes care of \\?\ syntax
+ }
+
+ if ( memicmp( RegPath, FileSpec, RegPathSize ) ) {
+ *p = TEXT( '\\' );
+ return( ret_val );
+ }
+
+ *p = TEXT( '\\' );
+
+ // Now we have to go through the damned registry to see if it's in it.
+
+ if ( ! DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+ ret_val = REG_CheckEventListForFile( HKEY_LOCAL_MACHINE, FileSpec, buffer );
+ }
+ else {
+
+ ret_val = FAILURE;
+ }
+
+ return( ret_val );
+}
+
+/**/
+/**
+
+ Name: REG_LocalIsRegistryFile
+
+ Description: Determine if a file is a registry file.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_LocalIsRegistryFile(
+IN GENERIC_DLE_PTR dle,
+IN CHAR_PTR FileSpec,
+OUT CHAR_PTR ValueKey,
+IN INT ValueKeySize )
+{
+ HKEY Key;
+ INT RegPathSize;
+ CHAR_PTR p ;
+ INT ret_val = FAILURE;
+ LONG ret;
+ CHAR *FileName;
+ CHAR Machine[ REG_BUFF_SIZE ];
+ CHAR RegPath[ REG_BUFF_SIZE ];
+
+ RegPathSize = NTFS_GetRegistryPathSize(dle) ;
+
+
+ memcpy( RegPath,
+ NTFS_GetRegistryPath(dle),
+ NTFS_GetRegistryPathSize(dle) ) ;
+
+ // Separate the path from the file name.
+
+ p = strrchr( FileSpec, TEXT( '\\' ) ) ;
+
+ if ( p != NULL ) {
+ *p = TEXT( '\0' );
+ FileName = p + 1 ;
+ } else {
+ return( ret_val ) ;
+ }
+
+ // Is this file in the correct path ?
+
+// if ( memicmp( RegPath, FileSpec, RegPathSize ) ) {
+// *p = TEXT( '\\' );
+// return( ret_val );
+// }
+
+ *p = TEXT( '\\' );
+
+ // Now we have to go through the damned hivelist to see if it's in it.
+
+ if ( ! DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+ ret_val = REG_CheckHiveListForFile( HKEY_LOCAL_MACHINE, FileName, ValueKey, ValueKeySize );
+ }
+ else {
+
+ ret_val = FAILURE;
+ }
+
+ return( ret_val );
+}
+
+
+/**/
+/**
+
+ Name: REG_CheckEventListForFile
+
+ Description: See if a file is in the registry event list.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_CheckEventListForFile(
+IN HKEY Key,
+IN CHAR_PTR FileName,
+OUT CHAR_PTR buffer )
+{
+ INT index = 0;
+ INT ret_val = FAILURE;
+ LONG ret;
+ ULONG ulOptions = 0L;
+ HKEY key2;
+ REGSAM samDesired = KEY_READ;
+ FILETIME ftLastWrite;
+ CHAR data[ REG_BUFF_SIZE ];
+ INT data_size;
+
+
+ // Now let's see what event log directories the registry has in it.
+
+ ret = RegOpenKeyEx( Key,
+ TEXT("system\\currentcontrolset\\services\\eventlog"),
+ ulOptions, samDesired, &key2 ) ;
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ do {
+
+ data_size = REG_BUFF_SIZE;
+
+ ret = RegEnumKeyEx( key2,
+ index,
+ data, (LPDWORD)&data_size,
+ NULL, NULL, NULL,
+ &ftLastWrite );
+
+ if ( ! ret ) {
+
+ // Now let's see what the event file in this directory is named.
+
+ ret_val = REG_CheckSingleEventForFile( key2, data, FileName );
+
+ if ( ret_val == SUCCESS )
+ {
+ data[ data_size ] = TEXT( '\0' );
+ strcpy( buffer, data ) ;
+ ret = -1;
+ }
+ }
+
+ index++;
+
+ } while ( ! ret );
+
+ RegCloseKey( key2 );
+
+ return( ret_val );
+}
+
+/**/
+/**
+
+ Name: REG_CheckHiveListForFile
+
+ Description: See if a file is in the hivelist.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_CheckHiveListForFile(
+IN HKEY Key,
+IN CHAR_PTR FileName,
+OUT CHAR_PTR ValueKey,
+IN INT ValueKeySize )
+{
+ INT index = 0;
+ INT ret_val = FAILURE;
+ CHAR *name;
+ LONG ret;
+ ULONG ulOptions = 0L ;
+ HKEY key2;
+ REGSAM samDesired = KEY_QUERY_VALUE;
+ CHAR data[ REG_BUFF_SIZE ];
+ INT value_size;
+ INT data_size;
+
+
+ ret = RegOpenKeyEx( Key,
+ TEXT("system\\currentcontrolset\\control\\hivelist"),
+ ulOptions, samDesired, &key2 ) ;
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ do {
+
+ value_size = ValueKeySize;
+ data_size = REG_BUFF_SIZE;
+
+ ret = RegEnumValue( key2,
+ index,
+ ValueKey,
+ (LPDWORD)&value_size,
+ NULL,
+ NULL,
+ (LPBYTE)
+ data,
+ (LPDWORD)&data_size );
+
+ if ( ! ret ) {
+
+ // separate file name from end of data.
+
+ data_size /= sizeof(CHAR);
+
+ data[ data_size ] = 0;
+
+ while ( ( data[ data_size ] != TEXT( '\\' ) ) && data_size )
+ {
+ data_size--;
+ }
+
+ if ( data_size )
+ {
+ name = &data[ data_size + 1 ];
+ }
+ else
+ {
+ name = data;
+ }
+
+ if ( ! stricmp( name, FileName ) )
+ {
+ ret_val = SUCCESS; // success !
+ }
+ }
+
+ index++;
+
+ } while ( ( ! ret ) && ( ret_val == FAILURE ) );
+
+ RegCloseKey( key2 );
+
+ return( ret_val );
+}
+/**/
+/**
+
+ Name: REG_CheckHiveListForFile
+
+ Description: See if a file is in the hivelist.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_CheckSingleEventForFile(
+IN HKEY Key,
+IN CHAR_PTR Directory,
+IN CHAR_PTR FileName )
+{
+ INT index = 0;
+ INT ret_val = FAILURE;
+ CHAR *name;
+ LONG ret;
+ ULONG ulOptions = 0L ;
+ HKEY key2;
+ REGSAM samDesired = KEY_QUERY_VALUE;
+ CHAR value[ REG_BUFF_SIZE ];
+ CHAR data[ REG_BUFF_SIZE ];
+ INT value_size;
+ INT data_size;
+ INT name_length;
+ INT file_length;
+
+ ret = RegOpenKeyEx( Key,
+ Directory,
+ ulOptions, samDesired, &key2 ) ;
+
+ if ( ret ) {
+ return( FAILURE );
+ }
+
+ do {
+
+ value_size = REG_BUFF_SIZE;
+ data_size = REG_BUFF_SIZE;
+
+ ret = RegEnumValue( key2,
+ index,
+ value,
+ (LPDWORD)&value_size,
+ NULL,
+ NULL,
+ (LPBYTE)data,
+ (LPDWORD)&data_size );
+
+ if ( ! ret ) {
+
+ if ( ! strncmp( value, TEXT( "File" ), 4 ) ) {
+
+ // separate file name from end of data.
+
+ data_size /= sizeof( CHAR );
+
+ data[ data_size ] = TEXT( '\0' );
+
+ while ( ( data[ data_size ] != TEXT( '%' ) ) && data_size )
+ {
+ data_size--;
+ }
+
+ if ( data_size )
+ {
+ name = &data[ data_size + 1 ];
+ }
+ else
+ {
+ name = data;
+ }
+
+ name_length = strlen( name );
+ file_length = strlen( FileName );
+ if ( file_length >= name_length )
+ {
+ FileName += ( file_length - name_length );
+ if ( ! stricmp( name, FileName ) )
+ {
+ ret_val = SUCCESS; // success !
+ ret = -1;
+ }
+ }
+ }
+ }
+
+ index++;
+
+ } while ( ! ret );
+
+ RegCloseKey( key2 );
+
+ return( ret_val );
+}
+
+
+/**/
+/**
+
+ Name: REG_GetRegistryPath
+
+ Description: Determine if/where the registry is for a drive.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_GetRegistryPath(
+IN CHAR *Machine,
+IN CHAR Drive,
+OUT CHAR_PTR Path,
+IN INT *PathSize )
+{
+ CHAR system[ REG_BUFF_SIZE ];
+ CHAR drive[] = TEXT("X:\\");
+ DWORD DriveType;
+ OFSTRUCT openbuff;
+ INT i;
+ INT ret;
+ INT ret_val = FAILURE;
+ INT RegFound;
+ INT fh;
+ HKEY Key;
+
+
+ drive[ 0 ] = Drive;
+
+ DriveType = GetDriveType( drive );
+
+ if ( DriveType == DRIVE_FIXED )
+ {
+ GetSystemDirectory( system, (DWORD)255 );
+
+ if ( ! strnicmp( system, drive, 2 ) )
+ {
+ // There is a registry on this drive, lets find it.
+
+ ret_val = REG_GetRegistryPathFromHiveList( HKEY_LOCAL_MACHINE,
+ Path,
+ PathSize );
+ }
+ }
+
+ if ( ret_val != SUCCESS )
+ {
+ *PathSize = 0;
+ }
+
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: REG_ChopOffDirectory
+
+ Description: Remove the top level directory from the path.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_ChopOffDirectory(
+CHAR *Path )
+{
+ CHAR *s;
+ CHAR *t;
+
+ if ( strlen( Path ) < 4 ) {
+ return( FAILURE );
+ }
+
+ // We are going to drop something.
+
+ s = Path;
+ while ( *s && *s != TEXT( '\\' ) ) s++;
+ s++;
+
+ t = s;
+ while ( *t && *t != TEXT( '\\' ) ) t++;
+
+ if ( *t == TEXT( '\\' ) ) {
+ t++;
+ strcpy( s, t );
+ }
+ else {
+ *s = TEXT( '\0' );
+ }
+
+ return( SUCCESS );
+}
+
+/**/
+/**
+
+ Name: REG_GetRegistryPathFromHiveList
+
+ Description: Get the registry's path from the hivelist.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_GetRegistryPathFromHiveList(
+IN HKEY key,
+OUT CHAR *Path,
+IN INT *PathSize )
+{
+ CHAR Data[ REG_BUFF_SIZE ];
+ CHAR Value[ REG_BUFF_SIZE ];
+ REGSAM samDesired = KEY_QUERY_VALUE;
+ ULONG ulOptions = 0L ;
+ DWORD ValueSize;
+ DWORD DataSize;
+ INT Index = 0;
+ INT ret;
+
+ ret = RegOpenKeyEx( key,
+ TEXT("SYSTEM\\CURRENTCONTROLSET\\CONTROL\\HIVELIST"),
+ ulOptions, samDesired, &key );
+
+ if ( ! ret )
+ {
+ do
+ {
+ ValueSize = REG_BUFF_SIZE;
+ DataSize = REG_BUFF_SIZE;
+
+ ret = RegEnumValue( key,
+ Index,
+ Value,
+ (LPDWORD)&ValueSize,
+ NULL,
+ NULL,
+ (LPBYTE)Data,
+ (LPDWORD)&DataSize );
+
+ if ( ! ret )
+ {
+ DataSize /= sizeof( CHAR );
+ Data[ DataSize ] = TEXT( '\0' );
+
+ if ( DataSize > 1 )
+ {
+ ret = REG_GetPathFromHiveEntry( Data, Path, PathSize );
+ break;
+ }
+ }
+
+ Index++;
+
+ } while( ! ret );
+
+ RegCloseKey( key );
+ }
+
+ return( ret );
+}
+
+/**/
+/**
+
+ Name: REG_GetPathFromHiveEntry
+
+ Description: Get the registry's path from a hive entry.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_GetPathFromHiveEntry(
+IN CHAR *Data,
+OUT CHAR *Path,
+IN INT *PathSize )
+{
+ INT Length;
+ INT Index;
+ INT i;
+
+
+ Path[ 0 ] = TEXT( '\0' );
+
+ // BEFORE
+ // Data = TEXT("\device\harddisk0\partition1\NT\SYSTEM\CONFIG\SOFTWARE")
+ // *PathSize = sizeof( Path )
+
+
+ // AFTER
+ // Path = TEXT("\NT\SYSTEM\CONFIG")
+ // *PathSize = 17
+
+
+ Length = strlen( Data );
+
+ // Chop off file name.
+
+ Index = Length;
+ while ( Index && Data[ Index ] != TEXT( '\\' ) ) Index--;
+ Data[ Index ] = TEXT( '\0' );
+
+ // Find start of path.
+
+ Index = 0;
+ for ( i = 0; i < 4; i ++ ) {
+ while ( Index < Length && Data[ Index ] != TEXT( '\\' ) ) Index++;
+ Index++;
+ }
+
+ // Quick sanity check
+
+ if ( Index >= Length ) {
+ *PathSize = 0;
+ return( FAILURE );
+ }
+
+ if ( (INT)strsize( &Data[ Index ] ) >= *PathSize ) {
+ *PathSize = strsize( &Data[ Index ] ) + sizeof(CHAR);
+ return( FAILURE );
+ }
+ else {
+ *PathSize = strsize( &Data[ Index-1 ] ) + sizeof(CHAR);
+ strcpy( Path, &Data[ Index-1 ] );
+ }
+
+
+ return( SUCCESS );
+}
+
+/**/
+/**
+
+ Name: REG_BackupRegistryFile
+
+ Description: Code to back up an active registry hive.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_BackupRegistryFile(
+IN GENERIC_DLE_PTR dle,
+IN CHAR_PTR RegFileSpec,
+IN CHAR_PTR TempFileSpec )
+{
+ CHAR ValueKey[ REG_BUFF_SIZE ];
+
+ if ( DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) )
+ {
+ // We don't do remote ones yet.
+
+ return( FAILURE );
+ }
+
+ if ( ! REG_LocalIsRegistryFile( dle, RegFileSpec, ValueKey, REG_BUFF_SIZE ) )
+ {
+ return( REG_SaveActiveRegistryFile( ValueKey, TempFileSpec ) );
+ }
+
+ return( FAILURE );
+}
+
+
+/**/
+/**
+
+ Name: REG_SaveActiveRegistryFile
+
+ Description: Save an active hive to a temp file.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_SaveActiveRegistryFile(
+IN CHAR *ValueKey,
+IN CHAR *NewFile )
+{
+ HKEY hkey;
+ LONG status;
+ CHAR *keyname;
+ CHAR *machine = TEXT("\\REGISTRY\\MACHINE");
+ DWORD disposition ;
+ REGSAM samDesired = MAXIMUM_ALLOWED;
+
+
+ keyname = ValueKey;
+ keyname += strlen( ValueKey );
+ while ( *keyname != TEXT( '\\' ) ) keyname--;
+ keyname++;
+
+ if ( ! strnicmp( machine, ValueKey, strlen( machine ) ) ) {
+
+ status = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ keyname,
+ 0,
+ NULL,
+ REG_OPTION_BACKUP_RESTORE,
+ samDesired,
+ NULL,
+ &hkey,
+ &disposition );
+
+ }
+ else {
+
+ status = RegCreateKeyEx( HKEY_USERS,
+ keyname,
+ 0,
+ NULL,
+ REG_OPTION_BACKUP_RESTORE,
+ samDesired,
+ NULL,
+ &hkey,
+ &disposition );
+ }
+
+ if ( status ) {
+ return( FAILURE );
+ }
+
+ status = RegSaveKey( (HKEY)hkey, NewFile, (LPSECURITY_ATTRIBUTES)NULL );
+
+ if ( status != ERROR_SUCCESS ) {
+ status = FAILURE;
+ }
+ else {
+ status = SUCCESS;
+ }
+
+ RegCloseKey( hkey );
+
+ return( status );
+}
+
+/**/
+/**
+
+ Name: REG_RestoreRegistryFile
+
+ Description: Code to restore an active registry file.
+
+ Modified:
+
+ Returns: SUCCESS/FAILURE
+
+ Declaration:
+**/
+
+INT REG_RestoreRegistryFile(
+IN GENERIC_DLE_PTR dle,
+IN CHAR_PTR RegFileSpec, // current active registry file
+IN CHAR_PTR NewFileSpec, // file to become new registry on reboot
+IN CHAR_PTR OldFileSpec ) // file to place old registry into.
+{
+ CHAR ValueKey[ REG_BUFF_SIZE ] ;
+
+ if ( DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+
+ // We don't do remote ones yet.
+
+ return( FAILURE );
+ }
+
+ if ( ! REG_LocalIsRegistryFile( dle, RegFileSpec, ValueKey, REG_BUFF_SIZE ) ) {
+
+ return( REG_RestoreActiveRegistryFile( ValueKey, NewFileSpec, OldFileSpec ) );
+ }
+
+ return( FAILURE );
+}
+
+
+INT REG_RestoreActiveRegistryFile(
+CHAR *ValueKey,
+CHAR *NewFileSpec,
+CHAR *OldFileSpec )
+{
+ HKEY LocalKey;
+ HKEY BigKey;
+ INT Status;
+ DWORD disposition ;
+ REGSAM samDesired = MAXIMUM_ALLOWED;
+ CHAR Machine[] = TEXT( "\\REGISTRY\\MACHINE" );
+ CHAR *keyname;
+
+ keyname = ValueKey;
+ keyname += strlen( ValueKey );
+ while ( *keyname != TEXT( '\\' ) ) keyname--;
+ keyname++;
+
+ // Set BigKey
+
+ if ( ! strnicmp( Machine, ValueKey, strlen( Machine ) ) ) {
+ BigKey = HKEY_LOCAL_MACHINE;
+ }
+ else {
+ BigKey = HKEY_USERS;
+ }
+
+
+
+
+ Status = RegCreateKeyEx( BigKey,
+ keyname,
+ 0,
+ NULL,
+ REG_OPTION_BACKUP_RESTORE,
+ samDesired,
+ NULL,
+ &LocalKey,
+ &disposition );
+
+ if ( Status ) {
+ return( FAILURE );
+ }
+
+ if ( !strncmp( NewFileSpec, TEXT("\\\\?\\"),4 ) ) {
+ NewFileSpec +=4 ;
+ }
+ if ( !strncmp( OldFileSpec, TEXT("\\\\?\\"),4 ) ) {
+ OldFileSpec +=4 ;
+ }
+
+ Status = RegReplaceKey( LocalKey, NULL, NewFileSpec, OldFileSpec );
+
+ if ( Status != ERROR_SUCCESS ) {
+ Status = FAILURE;
+ }
+ else {
+ Status = SUCCESS;
+ }
+
+ RegCloseKey( LocalKey );
+
+ return( Status );
+}
+
+VOID REG_MoveActiveRenameKey(
+GENERIC_DLE_PTR dle,
+CHAR_PTR reg_file )
+{
+ CHAR Data[ REG_BUFF_SIZE ];
+ CHAR Value[ REG_BUFF_SIZE ];
+ CHAR DestKeyName[ REG_BUFF_SIZE ];
+ DWORD ValueSize;
+ DWORD DataSize;
+ INT ret ;
+ HKEY key_in ;
+ HKEY key_out ;
+ HKEY key_temp ;
+ HKEY key ;
+ INT Index = 0;
+ DWORD val_type ;
+ CHAR_PTR temp_name ;
+ DWORD disposition ;
+ REGSAM samDesired = MAXIMUM_ALLOWED;
+
+ /* load in the temporary Key */
+ ret = RegLoadKey( HKEY_LOCAL_MACHINE, TEXT("NT_BACKUP_REG"), reg_file ) ;
+
+ if ( ret == ERROR_SUCCESS ) {
+
+ /* Open Select to determine Default */
+
+ ret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ TEXT("NT_BACKUP_REG\\Select"),
+ 0,
+ NULL,
+ REG_OPTION_BACKUP_RESTORE,
+ samDesired,
+ NULL,
+ &key,
+ &disposition );
+
+// ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+// TEXT("NT_BACKUP_REG\\Select"),
+// 0L, KEY_QUERY_VALUE, &key );
+
+
+ if ( ret == ERROR_SUCCESS ) {
+
+ DataSize = REG_BUFF_SIZE;
+
+ ret = RegQueryValueEx( key,
+ TEXT("Default"),
+ NULL,
+ NULL,
+ (LPBYTE)Data,
+ (LPDWORD)&DataSize );
+
+ if ( ! ret )
+ {
+ DataSize /= sizeof(CHAR);
+ Data[ DataSize ] = TEXT('\0');
+ sprintf( DestKeyName, TEXT("NT_BACKUP_REG\\ControlSet%03d\\Control\\Session Manager\\FileRenameOperations"), *((LPDWORD)Data) ) ;
+ }
+
+
+ RegCloseKey( key ) ;
+
+ if ( !ret ) {
+
+ /* Open the control for the new registry file */
+ ret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ DestKeyName,
+ 0,
+ NULL,
+ REG_OPTION_BACKUP_RESTORE,
+ samDesired,
+ NULL,
+ &key_out,
+ &disposition );
+
+// ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+// DestKeyName,
+// 0L, KEY_SET_VALUE, &key_out );
+
+ if ( !ret ) {
+
+
+ /* Open the control for the Current file */
+
+ ret = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ TEXT("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\FileRenameOperations"),
+ 0,
+ NULL,
+ REG_OPTION_BACKUP_RESTORE,
+ samDesired,
+ NULL,
+ &key_in,
+ &disposition );
+
+// ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+// TEXT("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\FileRenameOperations"),
+// 0L, KEY_QUERY_VALUE, &key_in );
+
+ if ( !ret ) {
+
+
+ temp_name = NTFS_MakeTempName( reg_file, TEXT("REG") ) ;
+
+ if ( temp_name != NULL ) {
+
+ ret = RegSaveKey( key_in, temp_name, NULL ) ;
+ if ( ret ) {
+ CHAR *p ;
+
+ DeleteFile( temp_name ) ;
+ free( temp_name ) ;
+ p = strrchr( reg_file, TEXT('\\') ) ;
+ if ( p ) {
+ *p = TEXT('\0') ;
+ temp_name = NTFS_MakeTempName( reg_file, TEXT("REG") ) ;
+ *p = TEXT('\\') ;
+ ret = RegSaveKey( key_in, temp_name, NULL ) ;
+ }
+ }
+
+ if ( !ret ) {
+
+ ret = RegRestoreKey( key_out, temp_name, 0 );
+
+ }
+ DeleteFile( temp_name ) ;
+
+ free( temp_name ) ;
+ }
+
+ RegCloseKey( key_in ) ;
+ }
+ RegCloseKey( key_out ) ;
+ }
+ }
+ }
+
+ RegFlushKey( HKEY_LOCAL_MACHINE ) ;
+
+ ret = RegUnLoadKey( HKEY_LOCAL_MACHINE, TEXT("NT_BACKUP_REG") ) ;
+
+ }
+}
diff --git a/private/utils/ntbackup/src/ntfstemp.c b/private/utils/ntbackup/src/ntfstemp.c
new file mode 100644
index 000000000..34c3dc29b
--- /dev/null
+++ b/private/utils/ntbackup/src/ntfstemp.c
@@ -0,0 +1,449 @@
+/**
+Copyright(c) Conner Peripherals, Inc. 1993
+
+
+ Name: ntfstemp.c
+
+ Date Updated: 29-Nov-93
+
+ Description: Manages temporary file names for actively restored
+ files.
+
+ $Log: M:/LOGFILES/NTFSTEMP.C_V $
+
+ Rev 1.1 17 Feb 1994 17:40:12 BARRY
+Removed debug printfs
+
+ Rev 1.0 29 Nov 1993 18:43:34 BARRY
+Initial revision.
+
+**/
+
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "ntfs_fs.h"
+#include "msassert.h"
+#include "be_debug.h"
+
+
+/*
+ * The following are for maintaining statistics about the performance
+ * of this module. They should be removed once this is debugged and
+ * working....
+ */
+UINT32 numQueries; /* Number of times GetTempName is called */
+UINT32 numProbes; /* Number of times GetTempName has to hunt */
+
+
+/*
+ * Entry for each item in the hash table. A vector of pointers to
+ * this type of structure is maintained.
+ */
+typedef struct HASH_ENTRY
+{
+ struct HASH_ENTRY *next; /* next item for collision resolution */
+ CHAR_PTR tapeName; /* name of item as on tape */
+ CHAR_PTR diskName; /* name of item on disk -- temp name */
+} HASH_ENTRY;
+
+HASH_ENTRY **hashTable; /* Pointer to vector of entries */
+UINT16 hashTableSize;
+UINT16 hashTableEntries;
+
+/*
+ * Vector of prime numbers for sizes to make table. If the table gets
+ * over half-way filled, the next higher table size will be used.
+ * (This probably will not happen under most circumstances.) If the
+ * table needs to get larger than the largest size here, the table
+ * will be increased to (2 * currentTableSize + 1). (The numbers chosen
+ * here are rather arbitrary.)
+ */
+UINT16 tableSizes[] = { 1223, 2377, 3571, 0 };
+
+/*
+ * Number of bits to rotate hash code for each character in key.
+ */
+#define HASH_ROTATE_BITS 3
+
+
+/**/
+/**
+
+ Name: NTFS_InitTemp()
+
+ Description: Performs initializations needed in this module.
+
+ Modified: 29-Nov-93
+
+ Returns: Nothing
+
+ Notes: Only called once, at program start.
+
+**/
+VOID NTFS_InitTemp( VOID )
+{
+ hashTable = NULL;
+ hashTableSize = 0;
+ hashTableEntries = 0;
+
+ /* Debug stuff */
+ numProbes = 0;
+ numQueries = 0;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_DeinitTemp()
+
+ Description: Frees any memory used by the hash table.
+
+ Modified: 29-Nov-93
+
+ Returns: Nothing
+
+ Notes: Only called once, at program end.
+
+**/
+VOID NTFS_DeinitTemp( VOID )
+{
+ UINT32 i;
+ HASH_ENTRY *nxt;
+ HASH_ENTRY *cur;
+
+ if ( hashTable != NULL )
+ {
+ for ( i = 0; (i < hashTableSize); i++ )
+ {
+ cur = *(hashTable + i);
+
+ while ( cur != NULL )
+ {
+ nxt = cur->next;
+
+ free( cur->diskName );
+ free( cur->tapeName );
+ free( cur );
+
+ cur = nxt;
+ }
+ }
+ free( hashTable );
+ hashTable = NULL;
+ }
+ hashTableSize = 0;
+ hashTableEntries = 0;
+}
+
+
+/**/
+/**
+
+ Name: Hash()
+
+ Description: Computes a hash code from a key (fully-qualified
+ path)
+
+ Modified: 29-Nov-93
+
+ Returns: 16-bit hash code
+
+ Notes: Rotates the code a little for each character in
+ the key (in hopes to better scatter the codes).
+ The macro HASH_ROTATE_BITS allows this value to
+ be changed for experimentation.
+
+**/
+static UINT16 Hash( CHAR_PTR s )
+{
+ UINT16 code = 0;
+ UINT16 temp;
+
+ while ( *s )
+ {
+ /*
+ * XOR the character into the hash code.
+ */
+ code ^= (unsigned)*s++;
+
+ /*
+ * Rotate the hash code by number of bits specified.
+ */
+ temp = code >> (sizeof(code) * 8 - HASH_ROTATE_BITS);
+ code <<= HASH_ROTATE_BITS;
+ code |= temp;
+ }
+ return code;
+}
+
+/**/
+/**
+
+ Name: GrowHashTable()
+
+ Description: Expands the hash table
+
+ Modified: 29-Nov-93
+
+ Returns: TRUE if either:
+ a) the table could be expanded
+ b) the table could not be expanded but
+ existed in the first place
+
+ FALSE if the hash table did not exist and
+ could not be allocated
+
+ Notes: Uses global vector of suggested table sizes
+
+**/
+static BOOLEAN GrowHashTable( VOID )
+{
+ BOOLEAN ret = TRUE;
+ UINT32 i;
+ UINT16 newTableSize = 0;
+ HASH_ENTRY **newTable;
+
+ for ( i = 0; (tableSizes[i] != 0); i++ )
+ {
+ if ( tableSizes[i] > hashTableSize )
+ {
+ newTableSize = tableSizes[i];
+ break;
+ }
+ }
+
+ if ( newTableSize == 0 )
+ {
+ newTableSize = hashTableSize * 2 + 1;
+ }
+
+ newTable = realloc( hashTable, newTableSize * sizeof( hashTable ) );
+
+ if ( newTable != NULL )
+ {
+ hashTable = newTable;
+ hashTableSize = newTableSize;
+ }
+ else if ( hashTable == NULL )
+ {
+ ret = FALSE;
+ }
+ return ret;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_SaveTempName()
+
+ Description: Saves the real name (ie, tape name) and the
+ name on disk (the temp name) for an actively-
+ restored file.
+
+ Modified: 29-Nov-93
+
+ Returns: TRUE if name was successfully saved,
+ FALSE otherwise
+
+**/
+BOOLEAN NTFS_SaveTempName( CHAR_PTR tapeName, CHAR_PTR diskName )
+{
+ BOOLEAN ret = TRUE;
+
+ /*
+ * If table is half full, expand it. We want lookups
+ * to be very, very fast....
+ */
+
+ if ( hashTableEntries >= (hashTableSize / 2) )
+ {
+ ret = GrowHashTable();
+ }
+
+ if ( ret )
+ {
+ HASH_ENTRY *dest;
+ HASH_ENTRY *prev = NULL;
+ INT compVal = 0;
+ UINT16 tableIndex;
+
+ /*
+ * Hash the name and get an index into hash table
+ */
+ tableIndex = Hash( tapeName ) % hashTableSize;
+
+ /*
+ * Go into the hash table and find a place for the
+ * new entry, chaining if necessary.
+ */
+ dest = *(hashTable + tableIndex);
+
+ while ( dest != NULL )
+ {
+ compVal = strcmp( dest->tapeName, tapeName );
+
+ if ( compVal >= 0 )
+ {
+ break;
+ }
+ prev = dest;
+ dest = dest->next;
+ }
+
+ /*
+ * We've found the right spot for the name. Let's store it.
+ */
+ if ( dest != NULL && compVal == 0 )
+ {
+ CHAR_PTR newName;
+
+ /*
+ * This is a special case of replacement of a disk name.
+ * (Somebody's restored the same active file twice.)
+ */
+
+ newName = realloc( dest->diskName, strsize( diskName ) );
+ if ( newName == NULL )
+ {
+ free( dest->diskName );
+ dest->diskName = NULL;
+ ret = FALSE;
+ }
+ else
+ {
+ dest->diskName = newName;
+ strcpy( dest->diskName, diskName );
+ }
+ }
+ else
+ {
+ HASH_ENTRY *newEntry;
+ CHAR_PTR tapeNameMem;
+ CHAR_PTR diskNameMem;
+
+ /*
+ * Allocate memory for the table entry and strings.
+ */
+ newEntry = malloc( sizeof( HASH_ENTRY ) );
+ tapeNameMem = malloc( strsize( tapeName ) );
+ diskNameMem = malloc( strsize( diskName ) );
+
+ if ( newEntry == NULL || tapeNameMem == NULL || diskNameMem == NULL )
+ {
+ free( newEntry );
+ free( tapeNameMem );
+ free( diskNameMem );
+
+ ret = FALSE;
+ }
+ else
+ {
+ /*
+ * Stick the entry in the table (or chain)
+ */
+
+ newEntry->next = NULL;
+ newEntry->diskName = diskNameMem;
+ newEntry->tapeName = tapeNameMem;
+
+ strcpy( newEntry->tapeName, tapeName );
+ strcpy( newEntry->diskName, diskName );
+
+ if ( prev != NULL )
+ {
+ newEntry->next = prev->next;
+ prev->next = newEntry;
+ }
+ else
+ {
+ newEntry->next = dest;
+ *(hashTable + tableIndex) = newEntry;
+ }
+ hashTableEntries++;
+ }
+ }
+ }
+ return ret;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_GetTempName()
+
+ Description: Retrieves the disk name (temp name) of a file,
+ given the file's tape name.
+
+ Modified: 29-Nov-93
+
+ Returns: Pointer to name.
+
+ Notes: If the file name does not exist in the hash table,
+ a pointer to the tape name is returned.
+
+**/
+CHAR_PTR NTFS_GetTempName( CHAR_PTR tapeName )
+{
+ CHAR_PTR diskName = tapeName;
+
+ numQueries++;
+
+ /*
+ * Unless someone's restored at least one active file, the
+ * hash table will have never been allocated. Simply returning
+ * the pointer passed will be the bulk of this function's use.
+ */
+
+ if ( hashTable != NULL )
+ {
+ HASH_ENTRY *entry;
+ INT comp;
+
+ /*
+ * Get the hash table entry where the name should be.
+ */
+
+ entry = hashTable[ Hash( tapeName ) % hashTableSize ];
+
+ while ( entry != NULL )
+ {
+ comp = strcmp( tapeName, entry->tapeName );
+
+ /*
+ * Since the entries for each bucket are maintained in
+ * sorted order, we can stop if the name matches or is
+ * greater than the name we're looking for.
+ */
+
+ if ( comp >= 0 )
+ {
+ /* If we have a match, return the temp name */
+ if ( comp == 0 )
+ {
+ /*
+ * Make sure that we have a name (a failed realloc
+ * could result in a NULL name).
+ */
+
+ if ( entry->diskName != NULL )
+ {
+ diskName = entry->diskName;
+ }
+ }
+ break;
+ }
+ numProbes++;
+ entry = entry->next;
+ }
+ }
+ return diskName;
+}
+
+
+
diff --git a/private/utils/ntbackup/src/ntfsutil.c b/private/utils/ntbackup/src/ntfsutil.c
new file mode 100644
index 000000000..66725ee63
--- /dev/null
+++ b/private/utils/ntbackup/src/ntfsutil.c
@@ -0,0 +1,158 @@
+/**
+Copyright(c) Arcada Software, Inc. 1994
+
+
+ Name: ntfsutil.c
+
+ Date Updated: 18-Jan-94
+
+ Description: Utility functions for the NTFS and MSNet file systems.
+
+ $Log: M:/LOGFILES/NTFSUTIL.C_V $
+
+ Rev 1.1 23 Jan 1994 14:00:34 BARRY
+Changed types for ANSI/Unicode compiles
+
+ Rev 1.0 23 Jan 1994 12:49:04 BARRY
+Initial revision.
+
+**/
+
+#include <windows.h>
+#include <stdio.h> /* for printf functions */
+#include <stdarg.h> /* for var arg functions */
+#include <wchar.h> /* for wprintf functions */
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfs_fs.h"
+
+#if defined( FS_MSNET )
+#include "mnet.h"
+#endif
+
+#include "be_debug.h"
+#include "msassert.h"
+
+
+
+/*
+ * Definitions for debug print code
+ */
+
+#define NTFS_DEBUG_WIDTH 78
+
+#if defined( UNICODE )
+#define vsnprintf _vsnwprintf
+#else
+#define vsnprintf _vsnprintf
+#endif
+
+
+
+/**/
+/**
+
+ Name: NTFS_DebugPrintFunction()
+
+ Description: Prints to a string buffer and calls BE_Zprintf
+ with the result. Written as special function to
+ take potentially huge strings (like when a deep
+ path is printed) and split them up into smaller
+ lines.
+
+ Modified: 18-Jan-94
+
+ Returns: Nothing
+
+
+ Notes: Use the NTFS_DebugPrint macro to call this function
+
+**/
+VOID NTFS_DebugPrintFunction( CHAR *fmt, ... )
+{
+ static CHAR_PTR buff = NULL;
+ static size_t buffSize = 0;
+ va_list args;
+
+ va_start( args, fmt );
+
+ while ( vsnprintf( buff, buffSize, fmt, args ) == -1 )
+ {
+ CHAR_PTR newBuff;
+
+ /* Buffer wasn't big enough. Realloc and try again. */
+ buffSize += 256;
+ newBuff = realloc( buff, buffSize * sizeof(CHAR) );
+
+ if ( newBuff != NULL )
+ {
+ buff = newBuff;
+ }
+ else
+ {
+ free( buff );
+ buff = NULL;
+ buffSize = 0;
+ break;
+ }
+ }
+
+ if ( buff == NULL )
+ {
+ BE_Zprintf( DEBUG_TEMPORARY, TEXT("NTFS_DebugPrint: out of memory") );
+ }
+ else
+ {
+ CHAR_PTR src = buff;
+ CHAR_PTR end;
+ CHAR c;
+ int len = (int)strlen( buff );
+
+ do {
+ end = src + min( len, NTFS_DEBUG_WIDTH );
+ len -= end - src;
+ c = *end;
+ *end = TEXT('\0');
+ BE_Zprintf( DEBUG_TEMPORARY, TEXT("%s"), src );
+ *end = c;
+ src = end;
+ } while ( *src );
+ }
+}
+
+/**/
+/**
+
+ Name: NTFS_DuplicateString()
+
+ Description: Convenience function to duplicate strings.
+ May be called with NULL string pointer.
+
+ Modified: 18-Jan-94
+
+ Returns: Pointer to duplicate string; NULL if source string
+ is NULL or if memory allocation fails.
+
+
+ Notes: Use free() to discard the string.
+
+
+**/
+CHAR_PTR NTFS_DuplicateString( CHAR_PTR src )
+{
+ CHAR_PTR result = NULL;
+
+ if ( src != NULL )
+ {
+ if ( (result = malloc(strsize(src))) != NULL )
+ {
+ strcpy( result, src );
+ }
+ }
+ return result;
+}
+
+
+
diff --git a/private/utils/ntbackup/src/om_blank.bmp b/private/utils/ntbackup/src/om_blank.bmp
new file mode 100644
index 000000000..17110911a
--- /dev/null
+++ b/private/utils/ntbackup/src/om_blank.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_dsap.bmp b/private/utils/ntbackup/src/om_dsap.bmp
new file mode 100644
index 000000000..2812d9d25
--- /dev/null
+++ b/private/utils/ntbackup/src/om_dsap.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_dsas.bmp b/private/utils/ntbackup/src/om_dsas.bmp
new file mode 100644
index 000000000..e2e972d1e
--- /dev/null
+++ b/private/utils/ntbackup/src/om_dsas.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_dsax.bmp b/private/utils/ntbackup/src/om_dsax.bmp
new file mode 100644
index 000000000..4567c4c16
--- /dev/null
+++ b/private/utils/ntbackup/src/om_dsax.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_entrs.bmp b/private/utils/ntbackup/src/om_entrs.bmp
new file mode 100644
index 000000000..fde3eb60d
--- /dev/null
+++ b/private/utils/ntbackup/src/om_entrs.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_mdbp.bmp b/private/utils/ntbackup/src/om_mdbp.bmp
new file mode 100644
index 000000000..741de7923
--- /dev/null
+++ b/private/utils/ntbackup/src/om_mdbp.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_mdbs.bmp b/private/utils/ntbackup/src/om_mdbs.bmp
new file mode 100644
index 000000000..07342ab59
--- /dev/null
+++ b/private/utils/ntbackup/src/om_mdbs.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_mdbx.bmp b/private/utils/ntbackup/src/om_mdbx.bmp
new file mode 100644
index 000000000..f293d3dd8
--- /dev/null
+++ b/private/utils/ntbackup/src/om_mdbx.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_servs.bmp b/private/utils/ntbackup/src/om_servs.bmp
new file mode 100644
index 000000000..435df3fa1
--- /dev/null
+++ b/private/utils/ntbackup/src/om_servs.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_sites.bmp b/private/utils/ntbackup/src/om_sites.bmp
new file mode 100644
index 000000000..4fb902941
--- /dev/null
+++ b/private/utils/ntbackup/src/om_sites.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/om_stats.bmp b/private/utils/ntbackup/src/om_stats.bmp
new file mode 100644
index 000000000..d41f8d34f
--- /dev/null
+++ b/private/utils/ntbackup/src/om_stats.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omabout.dlg b/private/utils/ntbackup/src/omabout.dlg
new file mode 100644
index 000000000..b56bc4267
--- /dev/null
+++ b/private/utils/ntbackup/src/omabout.dlg
@@ -0,0 +1,49 @@
+// NT style about box.
+// Apparently \n is now supported in the TEXT controls now.
+//
+
+
+IDD_HELPABOUTWINTERPARK DIALOG DISCARDABLE 20, 20, 229, 190
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION ABOUTAPPLICATIONNAME
+FONT 8, "MS Shell Dlg"
+BEGIN
+ ICON 0,IDD_ABOUTICON,10,5,18,20
+ LTEXT "<app text string>",IDD_ABOUTAPPNAME,45,5,181,8,
+ SS_NOPREFIX | NOT WS_GROUP
+ LTEXT "<version number goes here>",IDD_ABOUTVERSION,45,15,180,10,
+ SS_NOPREFIX | NOT WS_GROUP
+
+#ifdef CONNER
+ LTEXT "Copyright \251 1993-1996 Seagate Software, Inc.\n\nCall Conner's 1-800 number for additional information on software products.",
+#else
+ LTEXT "Copyright \251 1993-1996 Seagate Software, Inc.\n\nCall Seagate Software's 1-800 number for additional information on software products.",
+#endif
+ -1,45,25,180,35,SS_NOPREFIX | NOT WS_GROUP
+
+ LTEXT "This product is licensed to:",-1,45,67,180,10,
+ SS_NOPREFIX | NOT WS_GROUP
+ LTEXT "<user name goes here>",IDD_ABOUTUSERNAME,45,77,180,10,
+ SS_NOPREFIX | NOT WS_GROUP
+ LTEXT "<organization name goes here>",IDD_ABOUTCOMPANYNAME,45,87,
+ 180,10,SS_NOPREFIX | NOT WS_GROUP
+ CONTROL "",9998,"Static",SS_BLACKRECT,45,100,180,1
+ LTEXT "Product ID:",
+ IDD_ABOUTSERIALNUM,45,108,178,18,SS_NOPREFIX | NOT WS_GROUP
+ LTEXT "<product ID here>",IDD_ABOUTPRODID,95,108,180,10,
+ CONTROL "",9999,"Static",SS_BLACKRECT,45,128,180,1
+ LTEXT "Total Physical Memory:",IDD_ABOUTMEMTITLE,45,135,90,10,
+ SS_NOPREFIX | NOT WS_GROUP
+ LTEXT "%s KB",IDD_ABOUTMEMORY,140,135,74,10,SS_NOPREFIX | NOT
+ WS_GROUP
+ LTEXT "Processor:",IDD_ABOUTPROCESSORTITLE,45,144,90,10,SS_NOPREFIX |
+ NOT WS_GROUP
+ LTEXT "<processor name>",IDD_ABOUTPROCESSOR,88,144,114,10,
+ SS_NOPREFIX | NOT WS_GROUP | SS_LEFTNOWORDWRAP
+ LTEXT "Identifier:",IDD_ABOUTIDENTTITLE,45,153,90,10,SS_NOPREFIX |
+ NOT WS_GROUP
+ LTEXT "<identifier name>",IDD_ABOUTIDENT,88,153,114,10,
+ SS_NOPREFIX | NOT WS_GROUP | SS_LEFTNOWORDWRAP
+ DEFPUSHBUTTON "OK",IDOK,94,170,40,14
+END
+
diff --git a/private/utils/ntbackup/src/omacckey.rc b/private/utils/ntbackup/src/omacckey.rc
new file mode 100644
index 000000000..abd7a876e
--- /dev/null
+++ b/private/utils/ntbackup/src/omacckey.rc
@@ -0,0 +1,34 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: wntrpark.rc
+
+ Description: This file contains the references to accelerator resources
+ for the Microsoft OEM GUI Project for NT Resource File.
+
+ This file was created by copying and modifying the
+ Standard Maynard GUI Project file: ACCKEYS.RC
+
+ $Log: G:/UI/LOGFILES/OMACCKEY.RCV $
+
+ Rev 1.0 03 Mar 1992 12:23:02 DAVEV
+ Initial revision.
+
+******************************************************************************/
+
+// ACCELERATOR KEYS -- ID's are defined in the Menu Manager header file 'ss_mm.h'
+
+// Frame Menu Accelerators
+
+IDRA_ACCKEYS ACCELERATORS
+BEGIN
+ VK_F2, IDM_HELPABOUTNOSTRADOMUS, VIRTKEY, SHIFT
+// VK_INSERT, IDM_EDITCOPY, VIRTKEY, CONTROL
+// VK_INSERT, IDM_EDITPASTE, VIRTKEY, SHIFT
+// VK_DELETE, IDM_EDITCUT, VIRTKEY, SHIFT
+// VK_BACK, IDM_EDITUNDO, VIRTKEY, ALT
+END
+
+
diff --git a/private/utils/ntbackup/src/ombackup.bmp b/private/utils/ntbackup/src/ombackup.bmp
new file mode 100644
index 000000000..218f2872b
--- /dev/null
+++ b/private/utils/ntbackup/src/ombackup.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/ombackup.ico b/private/utils/ntbackup/src/ombackup.ico
new file mode 100644
index 000000000..17f772be3
--- /dev/null
+++ b/private/utils/ntbackup/src/ombackup.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/ombatch.c b/private/utils/ntbackup/src/ombatch.c
new file mode 100644
index 000000000..f863e656d
--- /dev/null
+++ b/private/utils/ntbackup/src/ombatch.c
@@ -0,0 +1,1205 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: ombatch.c
+
+ Description: This file contains the functions for the Microsoft
+ OEM version of Maynstream for Windows & Win32/NT to
+ support Command Line batch processing.
+
+ The following support is implemented for batch mode
+ processing (see the NT Backup/Restore Utility
+ Specification for more information.)
+
+ The batch command has the following parameters:
+
+ APPNAME [OPERATION PATHNAMES [OPTIONS]]
+
+ where:
+
+ OPERATION = "Backup"
+
+ PATHNAMES = [[drive:][path]filespec] ...
+
+ OPTIONS = {Mode, Verify, RestrictAccess,
+ Description, BackupType, Logfile,
+ Logmode }...
+
+ Mode = /A[ppend]
+ Verify = /V[erify]
+ Access = /R[estrict]
+ Description = /D[escription] "text"
+ BackupType = /T[ype] {Normal, Incremental,
+ Differential, Copy,
+ Incremental_Copy}
+ Logfile = /L[ogfile] "filename"
+ Logmode = /E[xceptions]
+
+ Note: In this implementation, options may appear
+ anywhere in the command line following the
+ 'Backup' operation key word - they are not
+ restricted to just following the list of
+ path names.
+
+ $Log: G:/UI/LOGFILES/OMBATCH.C_V $
+
+ Rev 1.22.1.3 24 Feb 1994 16:13:52 STEVEN
+DO NOT prompt for skip open files
+
+ Rev 1.22.1.2 24 Feb 1994 16:06:06 STEVEN
+log switch functionality was broken
+
+ Rev 1.22.1.1 25 Jan 1994 15:48:12 chrish
+Added fix for ORCAS EPR 0054. Problem with using a space as a valid
+character in the log file name or directory name.
+
+ Rev 1.22.1.0 26 Oct 1993 18:10:34 BARRY
+Added backupRegistry option
+
+ Rev 1.22 04 Jun 1993 17:14:32 chrish
+Nostradamus EPR 0490 - Added source to fix command line /r switch. Fix
+to set the command line restrict access flag.
+
+Added in the OEM_UpdateBatchBSDOptions routine the line ...
+CDS_SetCmdLineRestrictAccess ( pcds, (pOpts->eAccess == OEM_ACCESS_RESTRICTED ) );
+to set the "cmd_line_restrict_access" flag in the CDS structure.
+
+ Rev 1.21 18 May 1993 13:48:32 chrish
+NOSTRADAMUS and CAYMAN - Commented out portion of code that gave a default
+description when one was not supplied. Did this to make the display more
+consistent. If user does not supply a description, he does not get one.
+
+ Rev 1.20 14 May 1993 18:02:56 chrish
+NOSTRADAMUS EPR 0478: Fix for command line description from 32 to 50
+characters. Another fix for the fix at Rev 1.19.
+
+ Rev 1.19 11 May 1993 17:05:48 chrish
+NOSTRADAMUS EPR 0478: Fix for command line description from 32 to 50
+characters.
+
+ Rev 1.18 07 Apr 1993 15:34:02 MIKEP
+fix called in by steve
+
+ Rev 1.17 11 Mar 1993 15:27:34 STEVEN
+
+
+ Rev 1.16 26 Feb 1993 17:13:50 STEVEN
+fix typo
+
+ Rev 1.15 25 Feb 1993 13:37:50 STEVEN
+trunk set label at 32 characters
+
+ Rev 1.14 11 Feb 1993 12:02:42 STEVEN
+fix batch logfile and path
+
+ Rev 1.13 30 Nov 1992 15:41:16 DAVEV
+Changed /D to backup set description and use default tape label text
+
+ Rev 1.12 01 Nov 1992 16:03:56 DAVEV
+Unicode changes
+
+ Rev 1.11 15 Oct 1992 13:02:32 DAVEV
+fix problem with batch mode /T option
+
+ Rev 1.10 07 Oct 1992 14:13:46 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.9 04 Oct 1992 19:39:28 DAVEV
+Unicode Awk pass
+
+ Rev 1.8 30 Sep 1992 10:41:44 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.7 17 Sep 1992 17:39:46 DAVEV
+minor fix (strsiz->strsize)
+
+ Rev 1.6 17 Sep 1992 15:51:30 DAVEV
+UNICODE modifications: strlen usage check
+
+ Rev 1.5 24 Jul 1992 13:31:34 davev
+Removed warnings when building for NT
+
+ Rev 1.4 08 Jul 1992 15:32:42 STEVEN
+Unicode BE changes
+
+ Rev 1.3 29 May 1992 16:00:58 JOHNWT
+PCH updates
+
+ Rev 1.2 18 May 1992 15:28:08 DAVEV
+Created OEM_StrDup and replaced all calls to strdup() wiht it
+
+ Rev 1.1 18 May 1992 13:47:58 MIKEP
+i don't know
+
+ Rev 1.0 11 May 1992 14:28:42 DAVEV
+Initial revision.
+
+******************************************************************************/
+
+
+//#define INCL_CDS_READWRITE_MACROS
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+extern WORD RT_max_BSD_index; //Why isn't this in a header file????
+
+static LPSTR OEM_StrDup ( LPSTR pszSrc );
+static void OEM_FixPathCase( LPSTR pszPath ) ;
+
+#if defined ( OEM_EMS )
+static VOID EMS_RecurseSearchDLE (
+ GENERIC_DLE_PTR dle_tree, // I - DLE subtree root to search
+ GENERIC_DLE_PTR *dle, // O - pointer to matched DLE
+ LPSTR pszName, // I - name of server
+ UINT8 uType ); // I - type of dle to search for
+
+static VOID EMS_GetDleByEmsType(
+ GENERIC_DLE_PTR dle_tree, // I - Matching EMS server dle
+ GENERIC_DLE_PTR *dle, // O - pointer to matched dle
+ UINT8 uType ); // I - type of dle to search for
+#endif
+
+OEMOPTS_PTR OEM_DefaultBatchOptions ( VOID )
+{
+ OEMOPTS_PTR pOpts = calloc ( 1, sizeof ( OEMOPTS ) );
+
+ if ( pOpts )
+ {
+ // Set options to default values..
+
+ pOpts->eMode = OEM_MODE_OVERWRITE;
+ pOpts->eVerify = OEM_VERIFY_OFF;
+ pOpts->eAccess = OEM_ACCESS_NO_RESTRICT;
+ pOpts->eType = OEM_TYPE_NORMAL;
+ pOpts->eLogOpt = OEM_LOG_FULLDETAIL; //ignored if no logname given
+
+ pOpts->pszLogName = NULL;
+ pOpts->pszDescription = NULL;
+ pOpts->backupRegistry = FALSE;
+ }
+ return pOpts;
+}
+
+VOID OEM_UpdateBatchBSDOptions ( BSD_HAND hbsdList, OEMOPTS_PTR pOpts )
+{
+ CDS_PTR pcds = CDS_GetPerm ();
+ BE_CFG_PTR pbe_cfg;
+ BSD_PTR pbsd;
+ INT cBsds = 0; //count of BSD's
+ INT16 desc_str_size; // chs:05-14-93
+ LPSTR pszTmp;
+ CHAR szLabel [MAX_UI_RESOURCE_SIZE];
+ CHAR szLabel1 [MAX_UI_RESOURCE_SIZE];
+ CHAR szLabel2 [MAX_UI_RESOURCE_SIZE];
+
+ //Set the global backup configuration options...
+ if ( pOpts->pszLogName )
+ {
+ CDS_SetLogLevel ( pcds, (pOpts->eLogOpt == OEM_LOG_SUMMARY_ONLY)
+ ? LOG_ERRORS : LOG_DETAIL );
+ LOG_SetCurrentLogName ( pOpts->pszLogName );
+ }
+ else
+ {
+ CDS_SetLogLevel ( pcds, LOG_DISABLED );
+ }
+ CDS_SetAppendFlag ( pcds, (pOpts->eMode == OEM_MODE_APPEND) ) ;
+ CDS_SetAutoVerifyBackup ( pcds, (pOpts->eVerify == OEM_VERIFY_ON) ) ;
+ CDS_SetCmdLineRestrictAccess ( pcds, (pOpts->eAccess == OEM_ACCESS_RESTRICTED ) ); // chs:06-04-93
+
+//
+// Comment out setting a default description string
+//
+// chs:05-18-93 if ( pOpts->eMode == OEM_MODE_OVERWRITE
+// chs:05-18-93 && !pOpts->pszDescription )
+// chs:05-18-93 {
+// chs:05-18-93 // create a default tape description...
+// chs:05-18-93
+// chs:05-18-93 CHAR szBuf[ MAX_TAPE_NAME_SIZE ] ;
+// chs:05-18-93 LPSTR psz;
+// chs:05-18-93
+// chs:05-18-93 RSM_StringCopy( IDS_DEFAULT_TAPE_NAME, szBuf, MAX_TAPE_NAME_LEN ) ;
+// chs:05-18-93 psz = szBuf ;
+// chs:05-18-93 while ( *psz ) ++psz;
+// chs:05-18-93 UI_CurrentDate( psz ) ;
+// chs:05-18-93 pOpts->pszDescription = OEM_StrDup ( szBuf );
+// chs:05-18-93 }
+// chs:05-18-93 /* set default tape name */
+// chs:05-18-93
+
+ RSM_StringCopy( IDS_DEFAULT_TAPE_NAME, szLabel1, MAX_TAPE_NAME_LEN );
+ UI_CurrentDate( szLabel2 );
+ wsprintf( szLabel, szLabel1, szLabel2 ) ;
+
+ //Insert the options into each of the bsd's in the bsd list.
+ // keeping a count of the number of BSD's
+ for ( pbsd = BSD_GetFirst( hbsdList ), cBsds = 0;
+ pbsd != NULL;
+ pbsd = BSD_GetNext( pbsd ), ++cBsds )
+ {
+ if (pOpts->pszDescription)
+ {
+ desc_str_size = (INT16)strsize( pOpts->pszDescription); // chs:05-14-93
+ BSD_SetBackupDescript( pbsd, (INT8_PTR)pOpts->pszDescription,
+ desc_str_size ); // chs:05-14-93
+
+ if ( strlen(pOpts->pszDescription) > MAX_BSET_DESC_LEN ) {
+ pOpts->pszDescription[ MAX_BSET_DESC_LEN ] = TEXT('\0') ; // chs:05-14-93
+ }
+
+ BSD_SetBackupLabel( pbsd, (INT8_PTR)pOpts->pszDescription,
+ (INT16)strsize( pOpts->pszDescription) );
+ }
+
+ BSD_SetTapeLabel( pbsd, (INT8_PTR)szLabel,
+ (INT16) strsize( szLabel ) );
+ BSD_SetBackupType ( pbsd, (INT16)pOpts->eType );
+ BSD_SetFullyCataloged( pbsd, TRUE ); /* always do full cataloging */
+
+ pbe_cfg = BSD_GetConfigData( pbsd );
+// BEC_SetSkipOpenFiles ( pbe_cfg, (INT16)SKIP_NO );
+ BEC_SetRestoreSecurity ( pbe_cfg,
+ (pOpts->eAccess == OEM_ACCESS_RESTRICTED) );
+
+ if ( pOpts->backupRegistry &&
+ DLE_HasFeatures( BSD_GetDLE( pbsd ),
+ DLE_FEAT_BKUP_SPECIAL_FILES ) )
+ {
+ BSD_SetProcSpecialFlg( pbsd, TRUE );
+ }
+
+ }
+ RT_max_BSD_index = (WORD) ( cBsds );
+}
+
+VOID OEM_DeleteBatchOptions ( OEMOPTS_PTR * pOpts )
+{
+ if ( pOpts && *pOpts )
+ {
+ if ( (*pOpts)->pszLogName )
+ free ( (*pOpts)->pszLogName );
+ if ( (*pOpts)->pszDescription )
+ free ( (*pOpts)->pszDescription );
+ free ( * pOpts );
+
+ *pOpts = NULL;
+ }
+}
+
+
+/*****************************************************************************
+
+ Name: OEM_LookupBatchType
+
+ Description: If the target string contains a valid type specifier
+ for the type option, look it up in the type table and
+ return the associated resource string identifier.
+
+ Returns(INT): IDS_OEMTYPE_UNKNOWN - This is not a recognized type
+ specifier.
+
+ other - One of the IDS_OEMTYPE_* resource string ids
+ defined in OMSTRING.H.
+
+ INT OEM_LookupBatchType (
+ LPSTR pszType ) I - Targe type string to look for
+
+
+*****************************************************************************/
+LPSTR apszTypeTable [ IDS_OEMTYPE_COUNT ];
+
+static BOOL OEM_InitTypeTable ( VOID )
+{
+ CHAR szType [ IDS_OEM_MAX_LEN ]; //Temporary string buffer
+ INT count; //loop counter
+
+ memset ( apszTypeTable, 0, sizeof ( apszTypeTable ) );
+ for ( count = 0; count < IDS_OEMTYPE_COUNT; ++count )
+ {
+ // Read in the option string and add it to the table
+
+ RSM_StringCopy ( IDS_OEMTYPE_FIRST + count, szType, sizeof ( szType ) );
+ apszTypeTable[ count ] = OEM_StrDup ( szType );
+ }
+ return TRUE;
+}
+/*----------------------------------------------------------------------*/
+
+OEMTYPE OEM_LookupTypeOption ( LPSTR pszType )
+{
+ INT idx = 0; //Start with first option
+ INT found_idx = 0; //Start with first option
+ BOOL wasFound = FALSE; //Did we find the option?
+ INT nTypeLen; //Length of target option string
+ OEMTYPE oemType = OEM_TYPE_UNKNOWN;
+ BOOL idx_valid = FALSE ;
+
+ if( pszType
+ && ( nTypeLen = strlen ( pszType ) ) //must have a length!
+ && ( *apszTypeTable || OEM_InitTypeTable () )) //init table if needed
+ {
+ // cycle through the option table comparing each entry with the
+ // target option. Note that only as much of the option as the user
+ // has entered needs to be matched, since anything past the first
+ // character is optional.
+
+ do {
+ while ( idx < IDS_OEMTYPE_COUNT ) {
+
+ wasFound = (strnicmp ( pszType,
+ apszTypeTable[ idx ],
+ nTypeLen ) == 0) ;
+
+ if ( wasFound && (found_idx != 0) ) { /*not significant enough */
+ found_idx = idx = 0;
+ nTypeLen ++ ;
+ wasFound = 0 ;
+ idx_valid = FALSE ;
+ break ;
+
+ } else if ( wasFound ) {
+ found_idx = idx ;
+ idx_valid = TRUE ;
+ }
+
+ idx ++ ;
+ }
+
+ } while( (idx < IDS_OEMTYPE_COUNT) ) ;
+
+ idx = found_idx ;
+
+ }
+ if ( idx_valid )
+ {
+ // map the array index into a backup type
+
+ switch ( idx + IDS_OEMTYPE_FIRST )
+ {
+ case IDS_OEMTYPE_NORMAL:
+ oemType = OEM_TYPE_NORMAL; break;
+
+ case IDS_OEMTYPE_COPY:
+ oemType = OEM_TYPE_COPY; break;
+
+ case IDS_OEMTYPE_DIFFERENTIAL:
+ oemType = OEM_TYPE_DIFFERENTIAL; break;
+
+ case IDS_OEMTYPE_INCREMENTAL:
+ oemType = OEM_TYPE_INCREMENTAL; break;
+
+ case IDS_OEMTYPE_DAILY:
+ oemType = OEM_TYPE_DAILY; break;
+
+ case IDS_OEMTYPE_COMPATIBLE:
+ oemType = OEM_TYPE_COMPATIBLE; break;
+
+ default:
+ oemType = OEM_TYPE_UNKNOWN; break;
+ }
+ }
+ return oemType;
+}
+
+/*****************************************************************************
+
+ Name: OEM_ProcessCmdOption
+
+ Description: This function processes an option on the Backup batch
+ mode command line. The command line is expected to
+ be partially tokenized (via strtok) so that strtok may
+ be called with NULL as the second parameter
+ will continue tokenization using the original token
+ seperators. This is a requirement - NOT an option.
+
+ The contents of the option buffer are verified to
+ determine if it contains a backup option. If so,
+ the option is processed and the contents of the
+ OEM Option buffer is updated to contain the appropriate
+ information. The command line may be futher tokenized
+ before this function returns if required by processed
+ option.
+
+
+ Returns(INT): IDS_OEMOPT_NOANOPTION - The target string is not an
+ option string.
+ IDS_OEMOPT_UNKNOWN - This is not a recognized batch
+ option - it may be an error
+ or a general application option.
+
+ other - One of the IDS_OEMOPT_* resource string ids
+ defined in OMSTRING.H.
+
+*****************************************************************************/
+
+INT OEM_ProcessBatchCmdOption (
+ OEMOPTS_PTR pOpts, //IO - Pointer to the options buffer to update
+ LPSTR pszOption, //I - Pointer to option string
+ LPSTR pszTokens, //I - Token seperators between cmd line options
+ LPSTR pszCmdLine) //IO - Pointer to partially tokenized command line
+ // ( not really needed, but may be modified
+ // as a side effect of strtok () )
+{
+ INT nOptId = IDS_OEMOPT_UNKNOWN; //default to unrecognized option
+
+ UNREFERENCED_PARAMETER ( pszCmdLine );
+
+ if ( pOpts && pszOption ) // Must have these to do anything!
+ {
+ switch ( ( nOptId = OEM_LookupBatchOption ( pszOption ) ) )
+ {
+ case IDS_OEMOPT_VALIDGUIOPTION:
+ break ;
+
+ case IDS_OEMOPT_APPEND:
+ pOpts->eMode = OEM_MODE_APPEND;
+ break;
+
+ case IDS_OEMOPT_VERIFY:
+ pOpts->eVerify = OEM_VERIFY_ON;
+ break;
+
+ case IDS_OEMOPT_RESTRICT:
+ pOpts->eAccess = OEM_ACCESS_RESTRICTED;
+ break;
+
+ case IDS_OEMOPT_DESCRIPTION:
+ {
+ // this is a little more complext than the others, since
+ // the description following the IDS_OEMOPT_DESCRIPTION token
+ // may be deliminated by quotes. So, we look ahead in the
+ // partially tokenized command line string to determine what
+ // the first non-token seperator character is, and, if it is
+ // a quote or double quote, use that in the call to strtok...
+
+ LPSTR pszTemp = & pszOption [ strlen ( pszOption ) + 1 ];
+ CHAR szDelim [2] = TEXT("\0");
+ INT cSeps = 0; //number of extra token seperators betw
+ //the option and the descripton strings
+ // ('extra' meaning 'more than one'
+
+ while ( *pszTemp && OEM_CharInSet ( *pszTemp, pszTokens ) )
+ {
+ ++pszTemp;
+ ++cSeps;
+ }
+ if ( *pszTemp )
+ {
+ if ( *pszTemp == TEXT('\'') )
+ {
+ szDelim [0] = TEXT('\'');
+ }
+ else
+ if ( *pszTemp == TEXT('"') )
+ {
+ szDelim [0] = TEXT('"');
+ }
+ if ( szDelim [0] ) //is it quote deliminated?
+ {
+ // bump up to the starting deliminator
+ // if there was more than one token seperator
+ // between the option and the first deliminator
+
+ if ( cSeps )
+ pszOption = strtok ( NULL, szDelim );
+
+ // and get the string up to the closing deliminator
+ pszOption = strtok ( NULL, szDelim );
+ }
+ else // option is not deliminated by quotes
+ {
+ pszOption = strtok ( NULL, pszTokens );
+ }
+ if ( pOpts->pszDescription )
+ free ( pOpts->pszDescription );
+ pOpts->pszDescription = NULL ;
+
+ if ( pszOption )
+ pOpts->pszDescription = OEM_StrDup ( pszOption );
+ }
+ }
+ break;
+
+ case IDS_OEMOPT_TYPE:
+ if ( pszOption = strtok ( NULL, pszTokens ) )
+ {
+ if ((pOpts->eType = OEM_LookupTypeOption ( pszOption ))
+ == OEM_TYPE_UNKNOWN)
+ {
+ nOptId = IDS_OEMOPT_UNKNOWN; //default to unrecognized option
+
+ //NTKLUG: error! unknown backup type specified. use normal
+ pOpts->eType = OEM_TYPE_NORMAL;
+ }
+ }
+ break;
+
+ case IDS_OEMOPT_LOGFILENAME:
+ //
+ // The previous logic did not account for logfile names with spaces. Example
+ // ... /L "LOG FILE". So this fix is to allow spaces in log file names. Kind
+ // of kludgie but implemented without changing much of the central logic for the
+ // whole string passed on the command line.
+ //
+
+ if ( pszOption = strtok ( NULL, pszTokens ) )
+ {
+ if ( pOpts->pszLogName )
+ free ( pOpts->pszLogName );
+
+ if ( *pszOption == TEXT( '\"' ) ) {
+ *pszCmdLine = TEXT( '\0' );
+ strcpy( pszCmdLine, ( pszOption + 1 ) );
+
+ // We don't want to call strtok if we see the next qoute
+
+ while ( !strchr( pszCmdLine, TEXT('\"') ) &&
+ (pszOption = strtok ( NULL, pszTokens ) ) ) {
+
+ strcat( pszCmdLine, TEXT( " " ) );
+ strcat( pszCmdLine, pszOption );
+ }
+
+ if ( strlen( pszCmdLine ) > 1 ) {
+ // Ignore closing quote character, string will always have ending
+ // quotes if it has a beginning quote. This is forced in some previous
+ // string routine.
+ *( pszCmdLine + strlen( pszCmdLine ) - 1 ) = TEXT( '\0' );
+ }
+ pOpts->pszLogName = OEM_StrDup ( pszCmdLine );
+
+ } else {
+
+ pOpts->pszLogName = OEM_StrDup ( pszOption );
+ }
+
+ }
+ break;
+
+ case IDS_OEMOPT_LOGEXCEPTIONS: //this is ignored if no logname given
+ pOpts->eLogOpt = OEM_LOG_SUMMARY_ONLY;
+ break;
+
+ case IDS_OEMOPT_BACKUP_REGISTRY:
+ pOpts->backupRegistry = TRUE;
+ break;
+
+ //default:
+ // either this is not an option, or it is an
+ // unrecognized option - must be an application option (not
+ // specific to batch mode backup) so just ignore it.
+ // No errors can be reported without more extensive processing.
+ }
+ }
+ return nOptId;
+}
+
+
+/*****************************************************************************
+
+ Name: OEM_LookupBatchOption
+
+ Description: If the target string contains a valid batch command
+ line option, look it up in the option table and
+ return the associated resource string identifier.
+
+ Returns(INT): IDS_OEMOPT_NOANOPTION - The target string is not an
+ option string.
+ IDS_OEMOPT_UNKNOWN - This is not a recognized batch
+ option - it may be an error
+ or a general application option.
+
+ other - One of the IDS_OEMOPT_* resource string ids
+ defined in OMSTRING.H.
+
+ INT OEM_LookupBatchOption (
+ LPSTR pszOption ) I - Targe option string to look for
+
+
+*****************************************************************************/
+
+// The option table is an array containing all of the batch options
+// in NULL-terminated strings.
+
+static LPSTR apszOptionsTable [ IDS_OEMOPT_COUNT ] = {NULL};
+
+// Initialize the option table by reading all the IDS_OEMOPT_* strings
+// This is only done the first time OEM_LookupBatchOption is called
+
+static BOOL OEM_InitOptTable ( VOID )
+{
+ CHAR szOpt [ IDS_OEM_MAX_LEN ]; //Temporary string buffer
+ INT count; //loop counter
+
+ memset ( apszOptionsTable, 0, sizeof ( apszOptionsTable ) );
+
+ for ( count = 0; count < IDS_OEMOPT_COUNT; ++count )
+ {
+ // Read in the option string and add it to the table
+
+ RSM_StringCopy ( IDS_OEMOPT_FIRST + count, szOpt, sizeof ( szOpt ) );
+ apszOptionsTable[ count ] = OEM_StrDup ( szOpt );
+ }
+ return TRUE;
+}
+/*----------------------------------------------------------------------*/
+
+INT OEM_LookupBatchOption (
+ LPSTR pszOption ) //I - Targe option string to look for
+{
+ INT idx = 0; //Start with first option
+ BOOL wasFound = FALSE; //Did we find the option?
+ INT nOptLen; //Length of target option string
+static CHAR szPrefix [ IDS_OEM_MAX_LEN ]; //option prefixes string buffer
+
+ if (!*szPrefix) // load the option prefixes string if first time
+ {
+ RSM_StringCopy ( IDS_OEMOPT_PREFIXES, szPrefix, sizeof ( szPrefix ) );
+ }
+ if( !pszOption //make sure we have a
+ || !OEM_CharInSet( *pszOption, szPrefix ) ) // valid option string
+ {
+ return IDS_OEMOPT_NOTANOPTION; // it's not an option!
+ }
+ else
+ if( ( nOptLen = strlen ( ++pszOption ) ) //must have a length!
+ && ( *apszOptionsTable || OEM_InitOptTable () )) //init table if needed
+ {
+ // cycle through the option table comparing each entry with the
+ // target option. Note that only as much of the option as the user
+ // has entered needs to be matched, since anything past the first
+ // character is optional.
+
+ while ( !(wasFound = (strnicmp ( pszOption,
+ apszOptionsTable[ idx ],
+ nOptLen ) == 0) )
+ && ++idx < IDS_OEMOPT_COUNT );
+ }
+ if ( !wasFound ) {
+ if ( !stricmp( pszOption, TEXT("MISSINGTAPE") ) ||
+ !stricmp( pszOption, TEXT("ZL") ) ||
+ !stricmp( pszOption, TEXT("Z") ) ||
+ !stricmp( pszOption, TEXT("CONTONMEMERR") ) ||
+ !stricmp( pszOption, TEXT("KEEPCATS") ) ||
+ !stricmp( pszOption, TEXT("CONFIG") ) ||
+ !stricmp( pszOption, TEXT("HC:ON") ) ||
+ !stricmp( pszOption, TEXT("HC:OFF") ) ) {
+ return IDS_OEMOPT_VALIDGUIOPTION ;
+ }
+
+
+ if ( !strnicmp( pszOption, TEXT("TAPE:"),5 ) &&
+ (pszOption[5] >= TEXT('0')) &&
+ (pszOption[5] <= TEXT('9')) ) {
+
+ return IDS_OEMOPT_VALIDGUIOPTION ;
+ }
+
+ if (!stricmp( pszOption, TEXT("NOPOLL") ) ) {
+ return IDS_OEMOPT_NOPOLLOPTION ;
+ }
+
+ if ( !strcmp( pszOption, TEXT("?") ) ) {
+ return IDS_OEMOPT_USAGE ;
+ }
+
+ }
+ return ( wasFound ) ? (idx + IDS_OEMOPT_FIRST) : IDS_OEMOPT_UNKNOWN;
+}
+
+
+/*****************************************************************************
+
+ Name: OEM_AddPathToBackupSet
+
+ Description: Given a path to a file, optionally containing wild cards
+ and/or a drive descriptor, insert it into the proper
+ backup set in the list of backup sets for the proper
+ drive. If no appropriate backup set exists, one will
+ be created and added to the backup set list.
+
+ The path must be of the form allowed for the target
+ system and may include whatever wildcards are allowed
+ by the file system.
+
+ If no drive is specified, the current drive will be used.
+ If no path is specified, the current path will be used.
+
+ Return(BOOL): TRUE if the path was added succesfully,
+ FALSE otherwise.
+
+*****************************************************************************/
+
+BOOL OEM_AddPathToBackupSets (
+ BSD_HAND hbsd, //IO - list of backup sets to update
+ DLE_HAND hdle, //I - list of drives
+ LPSTR pszPath ) //I - Path to insert into backup set
+{
+ GENERIC_DLE_PTR pdle = NULL;
+ BSET_OBJECT_PTR pbset = NULL;
+ BSD_PTR pbsd = NULL;
+ FSE_PTR pfse = NULL;
+ BE_CFG_PTR pbeConfig = NULL;
+ BOOLEAN star_star;
+ CHAR_PTR pchFile;
+ CHAR szDir [ MAX_UI_PATH_LEN + MAX_UI_FILENAME_LEN + 1 ] ;
+ INT16 nBufLen = (INT16)( MAX_UI_PATH_LEN + MAX_UI_FILENAME_LEN );
+ CHAR_PTR pszTemp;
+
+ OEM_FixPathCase( pszPath ) ;
+
+ pszTemp = calloc( strsize( pszPath ) + strsize( TEXT("\\*.* ") ), 1 ) ;
+
+ if ( pszTemp == NULL ) {
+
+ return FALSE ;
+ }
+ strcpy( pszTemp, pszPath ) ;
+ if ( pszTemp[ strlen(pszTemp) - 1 ] != TEXT( '\\' ) ) {
+ strcat( pszTemp, TEXT( "\\*.*") ) ;
+ }
+ else {
+ strcat( pszTemp, TEXT( "*.*") ) ;
+ }
+ pszPath = pszTemp;
+
+ if ( FS_ParsePath( hdle, (CHAR_PTR)pszPath,
+ &pdle, (CHAR_PTR)szDir,
+ &nBufLen, &pchFile, &star_star ) != SUCCESS )
+ {
+ return FALSE; // NTKLUG: need error handling here!
+ }
+ if ( pszTemp )
+ {
+ free ( pszTemp );
+ pszTemp = NULL;
+ }
+ pszPath = NULL; //can't use this anymore
+
+ if ( BSD_CreatFSE( &pfse, (INT16)INCLUDE,
+ (INT8_PTR) szDir,
+ (INT16) nBufLen,
+ (INT8_PTR) pchFile,
+ (INT16) strsize( pchFile ),
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) TRUE ) != SUCCESS )
+ {
+ return FALSE; // NTKLUG: need error handling here!
+ }
+ else
+ {
+ pbsd = BSD_FindByDLE ( hbsd, pdle ); //look for the right BSD
+ }
+ if ( pbsd == NULL )
+ {
+ pbeConfig = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( pbeConfig );
+
+ BSD_Add( hbsd, &pbsd, pbeConfig, NULL,
+ pdle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+ }
+ if ( pbsd != NULL )
+ {
+ BSD_AddFSE( pbsd, pfse );
+
+ return TRUE; //SUCCESS
+ }
+ return FALSE; //FAILED!
+}
+
+#ifdef OEM_EMS
+/*****************************************************************************
+
+ Name: OEM_AddEMSServerToBackupSet
+
+ Description: Given a name of an Exchange server, insert it into the proper
+ backup set in the list of backup sets for the proper
+ drive. If no appropriate backup set exists, one will
+ be created and added to the backup set list.
+
+ The path must be of the form allowed for the target
+ system and may include whatever wildcards are allowed
+ by the file system.
+
+ Return(BOOL): TRUE if the server was added succesfully,
+ FALSE otherwise.
+
+*****************************************************************************/
+
+BOOL OEM_AddEMSServerToBackupSets (
+ BSD_HAND hbsd, //IO - list of backup sets to update
+ DLE_HAND hdle, //I - list of drives
+ LPSTR pszServer, //I - Server name to insert into backup set
+ UINT8 uType ) //I - FS_EMS_MDB_ID (Monolithic) or
+ // FS_EMS_DSA_ID (DSA)
+{
+ GENERIC_DLE_PTR pdle = NULL;
+ BSET_OBJECT_PTR pbset = NULL;
+ BSD_PTR pbsd = NULL;
+ FSE_PTR pfse = NULL;
+ BE_CFG_PTR pbeConfig = NULL;
+ CHAR_PTR pszTemp;
+
+ pszTemp = pszServer;
+
+ // Extract off the leading '\'s from the server name.
+ while ( TEXT ('\\') == *pszTemp ) pszTemp++;
+
+ if ( ( !pszTemp ) || ( TEXT ( '\0' ) == *pszTemp ) )
+ return FALSE;
+
+ // Things that have to happen in order. First, add name to EMS server list.
+ if ( SUCCESS == EMS_AddToServerList ( hdle, pszTemp ) ) {
+ if ( SUCCESS != FS_FindDrives( FS_EMS_DRV, hdle, pbeConfig = CDS_GetPermBEC(), 0 ) ) {
+ return FALSE;
+ }
+ }
+
+ // Next, find the DLE for the server name and type.
+ if ( SUCCESS != DLE_FindByEMSServerName( hdle, pszTemp, uType, &pdle ) ) {
+ return FALSE;
+ }
+
+ if ( BSD_CreatFSE( &pfse, (INT16)INCLUDE,
+ (CHAR_PTR) TEXT( "" ),
+ (INT16) sizeof( CHAR ),
+ (CHAR_PTR) ALL_FILES,
+ (INT16) ALL_FILES_LENG,
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) TRUE ) != SUCCESS ) {
+
+ return FALSE; // NTKLUG: need error handling here!
+
+ } else {
+
+ pbsd = BSD_FindByDLE ( hbsd, pdle ); //look for the right BSD
+ }
+ if ( pbsd == NULL )
+ {
+ pbeConfig = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( pbeConfig );
+
+ BSD_Add( hbsd, &pbsd, pbeConfig, NULL,
+ pdle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+ }
+ if ( pbsd != NULL )
+ {
+ BSD_AddFSE( pbsd, pfse );
+
+ return TRUE; //SUCCESS
+ }
+ return FALSE; //FAILED!
+}
+#endif OEM_EMS
+
+/***************************************************************************
+
+ Name: CharInSet
+
+ Description: Search the set of characters contained in a set for
+ one that matches the target character.
+
+ Parameters: CHAR chTarg : I - The target character to search for.
+ LPSTR pszSet: I - A NULL-terminated string containing
+ the set of charaters to search.
+
+ Returns: BOOL : TRUE if a matching character was found in the set,
+ FALSE otherwise.
+
+****************************************************************************/
+
+INT OEM_CharInSet ( CHAR chTarg, LPSTR pszSet )
+{
+ if ( !pszSet )
+ return FALSE;
+
+ while ( *pszSet && chTarg != *pszSet ) ++pszSet;
+
+ return ( *pszSet != 0 );
+}
+
+/***************************************************************************
+
+ Name: OEM_StrDup
+
+ Description: Replacement for the strdup() function. strdup() may
+ not be called because malloc, calloc, etc. may be
+ mapped to alternate functions.
+
+ Parameters: LPSTR pszSrc: I - Source string to duplicate
+
+ Returns: LPSTR: pointer to allocated string copy.
+
+****************************************************************************/
+
+static LPSTR OEM_StrDup ( LPSTR pszSrc )
+{
+ LPSTR pszResult = NULL;
+
+ if ( pszSrc )
+ {
+ pszResult = malloc ( strsize ( pszSrc ) );
+
+ if ( pszResult )
+ {
+ strcpy ( pszResult, pszSrc );
+ }
+ }
+ return pszResult;
+}
+
+
+#ifdef OEM_EMS
+
+/*************************************************************************/
+/**
+
+ Name: DLE_FindByEMSServerName()
+
+ Description: This function scans through the DLE tree looking for the
+ DLE with the EMS server name and specified type.
+
+ Modified: 9/15/1994
+
+ Returns: NOT_FOUND
+ SUCCESS
+
+ Notes: If no dle can be found then NULL is returned as the
+ DLE pointer.
+
+ See also: $/SEE( )$
+
+ Declaration: Ombatch.h
+/**/
+/* begin declaration */
+
+INT16 DLE_FindByEMSServerName (
+ DLE_HAND hand, /* I - DLE list handle */
+ LPSTR name, /* I - name to search for */
+ UINT8 uType, /* I - type of dle to search for */
+ GENERIC_DLE_PTR *dle ) /* O - pointer to matched DLE */
+
+{
+ GENERIC_DLE_PTR temp_dle ;
+ GENERIC_DLE_PTR found_dle ;
+ UINT8 uCurType;
+
+ *dle = NULL ;
+
+ if ( (name == NULL) || (hand == NULL) ) {
+ return FS_NOT_FOUND ;
+
+ } else {
+
+ if ( NULL == (temp_dle = (GENERIC_DLE_PTR)QueueHead( &(hand->q_hdr) )) )
+ return FS_NOT_FOUND;
+
+ found_dle = NULL ;
+
+ // Recurse on each of the EMS device with the server name that we're looking for.
+ do {
+
+ uCurType = DLE_GetDeviceType( temp_dle );
+ if( FS_EMS_DRV == uCurType ) {
+
+ EMS_RecurseSearchDLE ( temp_dle, &found_dle, name, uType ) ;
+
+ }
+
+ } while ( (NULL == found_dle) && (SUCCESS == DLE_GetNext( &temp_dle )) ) ;
+
+ if ( found_dle != NULL ) {
+
+ *dle = found_dle ;
+
+ } else {
+
+ return FS_NOT_FOUND ;
+ }
+ }
+ return SUCCESS ;
+}
+
+/*************************************************************************/
+/**
+
+ Name: EMS_RecurseSearchDLE()
+
+ Description: Does a recursive scan on an EMS drive for the server matching the
+ the description and calls EMS_GetDleByEmsType to find the child DLE
+ corresponding to the type..
+
+ Modified: 9/15/1994
+
+ Returns: Nothing.
+
+ Notes: If no dle can be found then NULL is returned as the
+ DLE pointer.
+
+ See also: $/SEE( )$
+
+ Declaration: Private
+
+**/
+/* begin declaration */
+static VOID EMS_RecurseSearchDLE (
+ GENERIC_DLE_PTR dle_tree, // I - DLE subtree root to search
+ GENERIC_DLE_PTR *dle, // O - pointer to matched DLE
+ LPSTR pszName, // I - name of server
+ UINT8 uType ) // I - type of dle to search for
+{
+ GENERIC_DLE_PTR dle_child;
+
+ while ( (dle_tree != NULL) && (*dle == NULL) ) {
+
+ if ( EMS_SERVER == DLE_GetDeviceSubType( dle_tree ) ) {
+
+ if ( 0 == strnicmp( pszName, DLE_GetDeviceName( dle_tree ), strsize( pszName ) ) ) {
+
+ // Get the specified DSA or MDB DLE for the server.
+ EMS_GetDleByEmsType( dle_tree, dle, uType );
+ }
+ } else {
+
+ // Not at server level - recurse through the children looking for the server name.
+ if ( (QueueCount( &(dle_tree->child_q) ) != 0) &&
+ (SUCCESS == DLE_GetFirstChild( dle_tree, &dle_child )) ) {
+
+ EMS_RecurseSearchDLE( dle_child, dle, pszName, uType );
+ }
+ }
+ if( SUCCESS != DLE_GetNext( &dle_tree ) )
+ return ;
+ }
+}
+
+
+/*************************************************************************/
+/**
+
+ Name: EMS_GetDleByEmsType()
+
+ Description: Iterates through child DLEs of an EMS server looking for
+ the DLE of the specified type.
+
+ Modified: 9/15/1994
+
+ Returns: Nothing.
+
+ Notes: If no dle can be found then NULL is returned as the
+ DLE pointer.
+
+ See also: $/SEE( )$
+
+ Declaration: Private
+
+**/
+/* begin declaration */
+
+static VOID EMS_GetDleByEmsType(
+ GENERIC_DLE_PTR dle_tree, // I - Matching EMS server dle
+ GENERIC_DLE_PTR *dle, // O - pointer to matched dle
+ UINT8 uType ) // I - type of dle to search for
+{
+ GENERIC_DLE_PTR dle_child;
+
+ *dle = NULL;
+
+ if ( SUCCESS == DLE_GetFirstChild( dle_tree, &dle_child ) )
+ {
+
+ /* Now that we've found the first child, let's try them all until
+ we find the one with the correct type. */
+ do {
+
+ if ( DLE_GetOsId( dle_child ) == uType ) {
+
+ *dle = dle_child ;
+ }
+
+ } while ( (NULL == *dle) &&
+ (SUCCESS == DLE_GetNext( &dle_child )) ) ;
+
+ }
+}
+
+#endif //OEM_EMS
+
+void OEM_FixPathCase( LPSTR pszPath )
+{
+CHAR CurDir[512] ;
+WIN32_FIND_DATA find_data;
+HANDLE find_hand;
+CHAR_PTR new_path_start ;
+CHAR_PTR old_str ;
+CHAR_PTR temp_str ;
+CHAR_PTR temp_str_start ;
+INT sub_dir_name_size ;
+
+ if (pszPath[1] != TEXT(':') ) {
+ return ;
+ }
+ CurDir[0] = pszPath[0] ;
+ CurDir[1] = TEXT(':') ;
+ CurDir[2] = TEXT('\\') ;
+ CurDir[3] = TEXT('\0') ;
+ temp_str = &(CurDir[3]) ;
+
+// new_path_start must point to first char of path name
+ if ( pszPath[2] == TEXT('\\') ) {
+ old_str = &pszPath[3] ;
+ } else {
+ old_str = &pszPath[2] ;
+ }
+
+ while ( *old_str != TEXT('\0')) {
+
+ temp_str_start = temp_str ;
+ new_path_start = old_str ;
+ sub_dir_name_size = 0 ;
+
+ while ( (*old_str != TEXT('\0')) && (*old_str != TEXT('\\')) ) {
+ *temp_str = *old_str ;
+ temp_str ++ ; old_str++ ;
+ sub_dir_name_size++ ;
+ }
+
+ *temp_str = TEXT('*') ;
+ *(temp_str+1) = TEXT('\0') ;
+
+ find_hand = FindFirstFile( CurDir, &find_data ) ;
+
+ if (find_hand == INVALID_HANDLE_VALUE ) {
+ return ;
+ }
+ while( ( strlen(find_data.cFileName) != (unsigned short)sub_dir_name_size ) ||
+ memicmp( find_data.cFileName, temp_str_start, sub_dir_name_size*sizeof(CHAR) ) ) {
+
+ if ( !FindNextFile( find_hand, &find_data ) ) {
+ FindClose( find_hand ) ;
+ return ;
+ }
+ }
+
+ FindClose( find_hand ) ;
+
+ memcpy( new_path_start, find_data.cFileName, sub_dir_name_size * sizeof(CHAR) ) ;
+
+ *temp_str = *old_str ;
+
+ if ( *old_str == TEXT('\0')) {
+ break ;
+ }
+
+ temp_str ++ ; old_str++ ;
+
+ }
+
+}
+
diff --git a/private/utils/ntbackup/src/ombkup.dlg b/private/utils/ntbackup/src/ombkup.dlg
new file mode 100644
index 000000000..772407757
--- /dev/null
+++ b/private/utils/ntbackup/src/ombkup.dlg
@@ -0,0 +1,67 @@
+
+IDD_BACKUPSET DIALOG 5, 15, 268, 236
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Backup Information"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "Current Tape:",-1,6,6,59,10
+ CONTROL "",IDD_BKUP_CURRENT_TAPE_NAME,"Static",SS_LEFTNOWORDWRAP |
+ SS_NOPREFIX | WS_GROUP,62,6,200,12
+ LTEXT "Creation Date:",-1,6,21,59,10
+ LTEXT "",IDD_BKUP_CREATION_DATE,62,21,200,10,SS_NOPREFIX
+ LTEXT "Owner:",-1,6,36,59,10
+ LTEXT "",IDD_BKUP_OWNER,62,36,200,10,SS_NOPREFIX
+ LTEXT "&Tape Name:",IDD_BKUP_TAPE_NAME_TEXT,6,51,52,12
+ EDITTEXT IDD_BKUP_TAPE_NAME,62,49,140,12,ES_AUTOHSCROLL |
+ WS_GROUP
+ CONTROL "&Verify After Backup",IDD_BKUP_AUTO_VERIFY,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,6,66,89,10
+ CONTROL "Backup Local Re&gistry",IDD_BKUP_REGISTRY,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,110,66,89,10
+ CONTROL "R&estrict Access to Owner or Administrator",
+ IDD_BKUP_RESTRICT_ACCESS,"Button",BS_AUTOCHECKBOX |
+ WS_GROUP | WS_TABSTOP,6,78,194,10
+ CONTROL "Hardware &Compression",IDD_BKUP_HARDCOMP,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,6,90,194,10
+ GROUPBOX "Operation",105,210,45,52,44,WS_GROUP
+ CONTROL "&Append ",IDD_BKUP_APPEND,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP | WS_TABSTOP,214,61,46,11
+ CONTROL "&Replace ",IDD_BKUP_REPLACE,"Button",BS_AUTORADIOBUTTON,
+ 214,75,46,11
+ SCROLLBAR IDD_BKUP_SCROLLBAR,249,106,11,54,SBS_VERT | WS_TABSTOP
+ GROUPBOX "Backup Set Information ",IDD_BKUP_INFO_TITLE,6,102,256,
+ 58
+ LTEXT "Drive Name:",IDD_BKUP_DRIVE_NAME_TEXT,12,116,48,10,NOT
+ WS_GROUP
+ LTEXT "",IDD_BKUP_DRIVE_NAME,62,116,186,10,SS_NOPREFIX | NOT
+ WS_GROUP
+ LTEXT "&Description:",IDD_BKUP_DESC_TEXT,12,130,48,10,
+ NOT WS_GROUP
+ EDITTEXT IDD_BKUP_DESCRIPTION,62,128,183,12,ES_AUTOHSCROLL |
+ WS_GROUP
+ LTEXT "&Backup Type:",IDD_BKUP_TYPE_TEXT,12,146,48,10,
+ NOT WS_GROUP
+ COMBOBOX IDD_BKUP_METHOD,62,144,84,58,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDD_XCHG_BKUP_METHOD,62,144,84,58,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ LTEXT "Microsoft Exchange:",IDD_BKUP_XCHG_NAME_TEXT,
+ 12,116,80,10,NOT WS_VISIBLE | NOT WS_GROUP
+ LTEXT "",IDD_BKUP_XCHG_NAME,90,116,155,10,NOT WS_VISIBLE |
+ SS_NOPREFIX | NOT WS_GROUP | SS_LEFTNOWORDWRAP
+ GROUPBOX "Log Information",-1,6,164,256,46
+ LTEXT "&Log File:",-1,12,180,48,10
+ EDITTEXT IDD_BKUP_LOG_FILENAME,62,178,163,12,ES_AUTOHSCROLL |
+ WS_GROUP
+ PUSHBUTTON "...",IDD_BKUP_LOG_BROWSE,224,178,15,12,WS_GROUP
+ CONTROL "&Full Detail",IDD_BKUP_LOG_FULL,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,62,196,65,10
+ CONTROL "&Summary Only",IDD_BKUP_LOG_SUMMARY,"Button",
+ BS_AUTORADIOBUTTON,129,196,65,10
+ CONTROL "D&on't Log",IDD_BKUP_LOG_NONE,"Button",
+ BS_AUTORADIOBUTTON,196,196,45,10
+ DEFPUSHBUTTON "OK",IDD_BKUP_OK_BUTTON,48,216,40,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDD_BKUP_CANCEL_BUTTON,112,216,40,14
+ PUSHBUTTON "&Help",IDD_BKUP_HELP_BUTTON,180,216,40,14
+END
+
diff --git a/private/utils/ntbackup/src/ombrowse.dlg b/private/utils/ntbackup/src/ombrowse.dlg
new file mode 100644
index 000000000..3dfac9496
--- /dev/null
+++ b/private/utils/ntbackup/src/ombrowse.dlg
@@ -0,0 +1,105 @@
+/******************************************************************************
+Copyright (c) Arcada Software, Inc. 1994
+GSH
+
+ Name: ombrowse.dlg
+
+ Description:
+
+ $Log: G:\UI\LOGFILES\OMBROWSE.DLV $
+
+ Rev 1.2 02 Feb 1994 11:29:54 Glenn
+ Added log file browse template.
+
+******************************************************************************/
+
+IDD_BROWSE DIALOG 139, 24, 220, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Browse Path"
+FONT 8, "MS Shell Dlg"
+BEGIN
+
+ LTEXT "&Directories:", -1, 7, 6, 140, 9
+ LTEXT "", stc1, 7, 18, 140, 9, SS_NOPREFIX
+ LISTBOX lst2, 7, 32, 140, 68, LBS_SORT | LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL |
+ WS_TABSTOP
+
+ LTEXT "Dri&ves:", stc4, 7, 104, 140, 9
+ COMBOBOX cmb2, 7, 114, 140, 68, CBS_DROPDOWNLIST |
+ CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT |
+ CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+
+ DEFPUSHBUTTON "OK", IDOK, 160, 6, 50, 14, WS_GROUP
+ PUSHBUTTON "Cancel", IDCANCEL, 160, 24, 50, 14, WS_GROUP
+ PUSHBUTTON "&Help", psh15, 160, 46, 50, 14, WS_GROUP
+
+ // CONTROLS NOT USED - but needed for template.
+
+ LTEXT "File &Name:", stc3, 137, 115, 1, 1, NOT WS_VISIBLE |
+ WS_GROUP
+ EDITTEXT edt1, 112, 90, 1, 1, ES_AUTOHSCROLL |
+ NOT WS_VISIBLE | NOT WS_TABSTOP
+ LISTBOX lst1, 129, 92, 1, 1, LBS_SORT | LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL |
+ NOT WS_VISIBLE
+
+ LTEXT "List Files of &Type:", stc2, 141, 94, 1, 1,
+ NOT WS_VISIBLE | NOT WS_GROUP
+ COMBOBOX cmb1, 143, 105, 1, 1, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
+ WS_BORDER | WS_VSCROLL | NOT WS_VISIBLE
+
+ CONTROL "&Read Only", chx1, "Button", BS_AUTOCHECKBOX |
+ WS_VISIBLE, 160, 68, 1, 1
+
+END
+
+
+IDD_LOGFILEBROWSE DIALOG LOADONCALL MOVEABLE DISCARDABLE
+36, 24, 264, 134
+CAPTION "Log File Browse"
+STYLE WS_CAPTION | WS_SYSMENU | WS_POPUP | DS_MODALFRAME
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "File &Name:", stc3, 6, 6, 76, 9
+ CONTROL "", edt1, "edit", ES_LEFT | ES_AUTOHSCROLL | WS_BORDER |
+ WS_TABSTOP | WS_CHILD,
+ 6, 16, 90, 12
+ CONTROL "", lst1, "listbox",
+ LBS_SORT | LBS_HASSTRINGS | LBS_NOTIFY | LBS_DISABLENOSCROLL
+ | WS_VSCROLL | WS_CHILD | WS_BORDER | WS_TABSTOP
+ | LBS_OWNERDRAWFIXED,
+ 6, 32, 90, 68
+
+ LTEXT "&Directories:", -1, 110, 6, 92, 9
+ LTEXT "", stc1, 110, 18, 92, 9, SS_NOPREFIX
+ CONTROL "", lst2, "listbox",
+ LBS_SORT | LBS_HASSTRINGS | LBS_NOTIFY | LBS_DISABLENOSCROLL
+ | WS_VSCROLL | WS_HSCROLL | WS_CHILD | WS_BORDER | WS_TABSTOP
+ | LBS_OWNERDRAWFIXED,
+ 110, 32, 92, 68
+
+ LTEXT "List Files of &Type:", stc2, 6, 104, 90, 9
+ CONTROL "", cmb1, "combobox", CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
+ WS_BORDER | WS_VSCROLL | WS_TABSTOP | WS_CHILD,
+ 6, 114, 90, 36
+
+ LTEXT "Dri&ves:", stc4, 110, 104, 92, 9
+ CONTROL "", cmb2, "combobox",
+ CBS_SORT | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED | CBS_DROPDOWNLIST
+ | WS_CHILD | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL
+ | WS_TABSTOP,
+ 110, 114, 92, 68
+
+ DEFPUSHBUTTON "OK", IDOK, 208, 6, 50, 14, WS_GROUP
+ PUSHBUTTON "Cancel", IDCANCEL, 208, 24, 50, 14, WS_GROUP
+
+ PUSHBUTTON "&Help", pshHelp, 208, 46, 50, 14, WS_GROUP
+// AUTOCHECKBOX "&Read Only", chx1, 208, 68, 50, 12,
+// WS_TABSTOP | WS_GROUP
+
+// PUSHBUTTON "Net&work...", psh14, 208, 114, 50, 14, WS_GROUP
+
+
+END
+
diff --git a/private/utils/ntbackup/src/omcat.bmp b/private/utils/ntbackup/src/omcat.bmp
new file mode 100644
index 000000000..850fb081e
--- /dev/null
+++ b/private/utils/ntbackup/src/omcat.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omcatlog.dlg b/private/utils/ntbackup/src/omcatlog.dlg
new file mode 100644
index 000000000..5ca32c34f
--- /dev/null
+++ b/private/utils/ntbackup/src/omcatlog.dlg
@@ -0,0 +1,15 @@
+
+IDD_CATALOG DIALOG 27, 32, 270, 94
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Job Status - "
+FONT 8, "MS Shell Dlg"
+BEGIN
+
+ CONTROL "OK", IDD_JS_OK, "BUTTON", BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP, 66, 77, 40, 12
+ CONTROL "&Abort", IDD_JS_ABORT, "BUTTON", BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP, 116, 77, 40, 12
+ CONTROL "&Help", IDD_JS_HELP, "BUTTON", BS_PUSHBUTTON | WS_TABSTOP, 167, 77, 40, 12
+
+ LTEXT "Summary", 0x0069, 3, 4, 39, 8
+ LISTBOX IDD_JS_LISTBOX, 4, 15, 261, 61, WS_VSCROLL | WS_HSCROLL |
+ WS_TABSTOP
+END
diff --git a/private/utils/ntbackup/src/omcdisk.bmp b/private/utils/ntbackup/src/omcdisk.bmp
new file mode 100644
index 000000000..8b78cb20a
--- /dev/null
+++ b/private/utils/ntbackup/src/omcdisk.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omcheck.bmp b/private/utils/ntbackup/src/omcheck.bmp
new file mode 100644
index 000000000..cf4d199b6
--- /dev/null
+++ b/private/utils/ntbackup/src/omcheck.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omeject.bmp b/private/utils/ntbackup/src/omeject.bmp
new file mode 100644
index 000000000..341d5d762
--- /dev/null
+++ b/private/utils/ntbackup/src/omeject.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omerase.bmp b/private/utils/ntbackup/src/omerase.bmp
new file mode 100644
index 000000000..141701586
--- /dev/null
+++ b/private/utils/ntbackup/src/omerase.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omerase.dlg b/private/utils/ntbackup/src/omerase.dlg
new file mode 100644
index 000000000..14fdc77e4
--- /dev/null
+++ b/private/utils/ntbackup/src/omerase.dlg
@@ -0,0 +1,23 @@
+
+IDD_ERASE DIALOG 32, 47, 288, 100
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Erase Tape"
+FONT 8, "MS Shell Dlg"
+BEGIN
+
+ ICON 0, IDD_ERASE_EXCLAMATION_BITMAP, 8, 6, 20, 20
+ LTEXT "WARNING: You have chosen to erase the contents of this tape. All of the information on the tape will be destroyed!",
+ IDD_ERASE_LINE2, 33, 6, 204, 46, SS_NOPREFIX
+
+ LTEXT "", IDD_ERASE_LINE1, 33, 32, 204, 46, SS_NOPREFIX
+
+ DEFPUSHBUTTON "Cancel", IDD_ERASE_CANCEL_BUTTON, 245, 27, 40, 14
+ PUSHBUTTON "&Continue", IDD_ERASE_CONTINUE_BUTTON, 245, 8, 40, 14
+ PUSHBUTTON "&Help", IDD_ERASE_HELP_BUTTON, 245, 46, 40, 14
+
+ CONTROL "&Quick Erase", IDD_ERASE_QUICK_BUTTON, "Button",
+ BS_AUTORADIOBUTTON, 97, 80, 55, 10
+ CONTROL "&Secure Erase", IDD_ERASE_SECURE_BUTTON, "Button",
+ BS_AUTORADIOBUTTON, 160, 80, 64, 10
+END
+
diff --git a/private/utils/ntbackup/src/omevent.c b/private/utils/ntbackup/src/omevent.c
new file mode 100644
index 000000000..a9bcdd75e
--- /dev/null
+++ b/private/utils/ntbackup/src/omevent.c
@@ -0,0 +1,329 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: omevent.c
+
+ Description: This file contains the functions for the Microsoft
+ OEM version of Maynstream for Windows & Win32/NT to
+ support Event Logging.
+
+ Events must be logged at the start and end of the
+ following backup application operations:
+
+ Backup, Restore, Retension and Erase
+
+ For Backup and Restore opperations, the state of
+ the verify flag must be recorded.
+
+ For Backup operations the following information must
+ be supplied:
+
+ - Append or Replace,
+ - Type: Incremental, Differential, Daily,
+ Normal or Copy
+ $Log: G:/UI/LOGFILES/OMEVENT.C_V $
+
+ Rev 1.9 14 May 1993 14:40:54 DARRYLP
+Modified event logging text
+
+ Rev 1.8 10 May 1993 13:01:18 DARRYLP
+Changed the style of display to eliminate cryptic app logs.
+
+ Rev 1.7 11 Nov 1992 16:33:40 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.6 01 Nov 1992 16:04:10 DAVEV
+Unicode changes
+
+ Rev 1.5 04 Oct 1992 19:39:32 DAVEV
+Unicode Awk pass
+
+ Rev 1.4 30 Sep 1992 10:46:06 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.3 01 Sep 1992 13:04:00 STEVEN
+id name has changed
+
+ Rev 1.2 31 Aug 1992 09:56:30 DAVEV
+
+ Rev 1.1 31 Aug 1992 09:48:34 DAVEV
+Added Verify Events
+
+******************************************************************************/
+
+//#ifdef OEM_MSOFT // module compiled ONLY for Microsoft OEM version
+
+#include "all.h"
+
+#include <winnetwk.h>
+#include "bkuevent.h"
+
+void OMEVENT_LogEvent ( DWORD dwEventId, //id of event message
+ WORD wEventType, //type of event
+ INT cStrings, //number of replacement strings
+ ... ) //replacement strings
+{
+#if defined ( OS_WIN32 )
+
+ static HANDLE hEvent = NULL;
+ static CHAR szSource [ IDS_OEMEVENT_MAX_SOURCE_LEN ] = TEXT("");
+
+#define MAX_USERNAME_LENGTH 200 //NTKLUG: Remove when Win32 has a define for this!!
+ static CHAR szUserName [ MAX_USERNAME_LENGTH ] = TEXT("");
+ static DWORD dwUserLen = MAX_USERNAME_LENGTH;
+
+ if ( hEvent == NULL )
+ {
+ RSM_StringCopy ( IDS_OEMEVENT_SOURCE_NAME,
+ szSource, sizeof ( szSource ) );
+
+ GetUserName ( szUserName, &dwUserLen );
+ hEvent = RegisterEventSource ( NULL, szSource );
+ }
+ if ( hEvent != NULL )
+ {
+ LPSTR apszStrings [ 10 ];
+ INT i;
+ va_list ap;
+
+ va_start ( ap, cStrings );
+
+ memset ( apszStrings, 0, sizeof (apszStrings) );
+ for ( i = 0; i < cStrings; ++i )
+ {
+ apszStrings [ i ] = va_arg ( ap, LPSTR );
+ if ( apszStrings [i] && !strlen (apszStrings [i]) )
+ {
+ // note: ReportEvent will fail if a zero-length replacement
+ // string is passed. I have reported this as an NT bug.
+ strcpy ( apszStrings [i], TEXT(" ") );
+ }
+ }
+ va_end ( ap );
+
+ if ( !ReportEvent ( hEvent,
+ wEventType, //type of event
+ (WORD)0, //category
+ dwEventId, //id of message
+ NULL,//szUserName, //Current User Name
+ (WORD)cStrings, //# of strings
+ (DWORD)0, //# bytes of data
+ apszStrings, //msg replacement strings
+ NULL ) ) //binary data
+ {
+ DWORD dwLastError = GetLastError ();
+ zprintf ( DEBUG_USER_INTERFACE, IDS_OEMLOG_ERROR_REPORTEVENT,
+ dwLastError, dwEventId, wEventType, cStrings );
+ for ( i = 0; i < cStrings; ++i )
+ {
+ zprintf ( DEBUG_USER_INTERFACE, IDS_OEMLOG_ERROR_EVENTSTRING,
+ i, apszStrings [ i ] );
+ }
+ }
+ }
+#endif
+}
+
+
+// Save the backup set info recieved on a LogBegin for Backup or Restore for
+// use in the associated LogEnd call
+
+#define OMEVT_MAX_DRIVE 512
+
+static struct _OMEVT_BACKUPSETINFO {
+
+ CHAR szDrive [ OMEVT_MAX_DRIVE ];
+ CHAR szVerify [ 8 ];
+ CHAR szMode [ 8 ];
+ CHAR szType [ 8 ];
+
+ } mwBkpSet;
+
+void OMEVENT_LogBeginBackup (
+ CHAR_PTR pszDrive, //Drive name
+ INT16 verify, //VERIFY ON or OFF
+ INT16 mode, //APPEND or REPLACE
+ INT16 type ) //NORMAL, COPY, etc.
+{
+ memset ( &mwBkpSet, 0, sizeof ( mwBkpSet ) );
+ strncpy ( mwBkpSet.szDrive, pszDrive, OMEVT_MAX_DRIVE-1 );
+ if (verify == 0)
+ {
+ strcpy(mwBkpSet.szVerify, TEXT("Off"));
+ } else
+ {
+ strcpy(mwBkpSet.szVerify, TEXT("On"));
+ }
+ if (mode == 0)
+ {
+ strcpy(mwBkpSet.szMode, TEXT("Replace"));
+ } else
+ {
+ strcpy(mwBkpSet.szMode, TEXT("Append"));
+ }
+ switch(type)
+ {
+ case 1:
+ strcpy(mwBkpSet.szType, TEXT("Normal"));
+ break;
+
+ case 2:
+ strcpy(mwBkpSet.szType, TEXT("Copy"));
+ break;
+
+ case 3:
+ strcpy(mwBkpSet.szType, TEXT("Dif"));
+ break;
+
+ case 4:
+ strcpy(mwBkpSet.szType, TEXT("Inc"));
+ break;
+ }
+
+ OMEVENT_LogEvent((DWORD)EVENT_BKUP_BEGINBACKUP,
+ (WORD)EVENTLOG_INFORMATION_TYPE,
+ 4, mwBkpSet.szDrive, mwBkpSet.szVerify,
+ mwBkpSet.szMode, mwBkpSet.szType );
+}
+
+
+void OMEVENT_LogEndBackup(BOOL bError ) //Did an error occur?
+{
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_ENDBACKUP,
+ (WORD) ((bError) ? EVENTLOG_ERROR_TYPE
+ : EVENTLOG_INFORMATION_TYPE),
+ 4, mwBkpSet.szDrive, mwBkpSet.szVerify,
+ mwBkpSet.szMode, mwBkpSet.szType );
+}
+
+
+void OMEVENT_LogBeginRestore (
+ CHAR_PTR pszDrive, //Drive name
+ INT16 verify ) //VERIFY ON or OFF
+{
+ memset ( &mwBkpSet, 0, sizeof ( mwBkpSet ) );
+ strncpy ( mwBkpSet.szDrive, pszDrive, OMEVT_MAX_DRIVE-1 );
+ if (verify == 0)
+ {
+ strcpy(mwBkpSet.szVerify, TEXT("Off"));
+ } else
+ {
+ strcpy(mwBkpSet.szVerify, TEXT("On"));
+ }
+
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_BEGINRESTORE,
+ (WORD) EVENTLOG_INFORMATION_TYPE,
+ 2, mwBkpSet.szDrive, mwBkpSet.szVerify );
+}
+
+
+void OMEVENT_LogEndRestore (
+ BOOL bError ) //Did an error occur?
+{
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_ENDRESTORE,
+ (WORD)((bError) ? EVENTLOG_ERROR_TYPE
+ : EVENTLOG_INFORMATION_TYPE),
+ 2, mwBkpSet.szDrive, mwBkpSet.szVerify );
+}
+
+void OMEVENT_LogBeginErase ( VOID )
+{
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_BEGINERASE,
+ (WORD) EVENTLOG_INFORMATION_TYPE,
+ 0 );
+}
+
+
+void OMEVENT_LogEndErase (
+ BOOL bError ) //Did an error occur?
+{
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_ENDERASE,
+ (WORD) ((bError) ? EVENTLOG_ERROR_TYPE
+ : EVENTLOG_INFORMATION_TYPE),
+ 0 );
+}
+
+void OMEVENT_LogBeginRetension ( VOID )
+{
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_BEGINRETENSION,
+ (WORD) EVENTLOG_INFORMATION_TYPE,
+ 0 );
+}
+
+
+void OMEVENT_LogEndRetension (
+ BOOL bError ) //Did an error occur?
+{
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_ENDRETENSION,
+ (WORD) ((bError) ? EVENTLOG_ERROR_TYPE
+ : EVENTLOG_INFORMATION_TYPE),
+ 0 );
+}
+
+void OMEVENT_LogBeginVerify ( CHAR_PTR pszDrive )
+{
+ memset ( &mwBkpSet, 0, sizeof ( mwBkpSet ) );
+ strncpy ( mwBkpSet.szDrive, pszDrive, OMEVT_MAX_DRIVE-1 );
+
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_BEGINVERIFY,
+ (WORD) EVENTLOG_INFORMATION_TYPE,
+ 1, mwBkpSet.szDrive );
+}
+
+
+void OMEVENT_LogEndVerify ( CHAR_PTR pszDrive,
+ BOOL bError ) //Did an error occur?
+{
+ memset ( &mwBkpSet, 0, sizeof ( mwBkpSet ) );
+ strncpy ( mwBkpSet.szDrive, pszDrive, OMEVT_MAX_DRIVE-1 );
+
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_ENDVERIFY,
+ (WORD) ((bError) ? EVENTLOG_ERROR_TYPE
+ : EVENTLOG_INFORMATION_TYPE),
+ 1, mwBkpSet.szDrive );
+}
+void OMEVENT_LogEMSError (
+ CHAR_PTR function_name,
+ INT status,
+ CHAR_PTR additional_info ) //Did an error occur?
+{
+CHAR stat_str [30] ;
+
+ sprintf( stat_str, TEXT("%x"), status ) ;
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_EMS_ERROR,
+ (WORD) EVENTLOG_ERROR_TYPE,
+ 3,
+ stat_str,
+ function_name,
+ additional_info );
+}
+void OMEVENT_LogEMSErrorText (
+ CHAR_PTR function_name,
+ CHAR_PTR status,
+ CHAR_PTR additional_info ) //Did an error occur?
+{
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_EMS_ERROR,
+ (WORD) EVENTLOG_ERROR_TYPE,
+ 3,
+ status,
+ function_name,
+ additional_info );
+}
+
+void OMEVENT_LogEMSToFewDbError (
+ INT num_found,
+ INT num_needed )
+{
+CHAR found_str [30] ;
+CHAR needed_str [30] ;
+
+ sprintf( found_str, TEXT("%x"), num_found ) ;
+ sprintf( needed_str, TEXT("%x"), num_needed ) ;
+
+ OMEVENT_LogEvent ( (DWORD)EVENT_BKUP_EMS_DB_ERROR,
+ (WORD) EVENTLOG_ERROR_TYPE,
+ 2,
+ found_str,
+ needed_str ) ;
+}
diff --git a/private/utils/ntbackup/src/omfdisk.bmp b/private/utils/ntbackup/src/omfdisk.bmp
new file mode 100644
index 000000000..b1e85498d
--- /dev/null
+++ b/private/utils/ntbackup/src/omfdisk.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omfiler.dlg b/private/utils/ntbackup/src/omfiler.dlg
new file mode 100644
index 000000000..9e605348d
--- /dev/null
+++ b/private/utils/ntbackup/src/omfiler.dlg
@@ -0,0 +1,19 @@
+
+IDD_FILEREPLACE DIALOG 30, 82, 299, 70
+CAPTION "Confirm File Replace"
+FONT 8, "MS Shell Dlg"
+STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+BEGIN
+ ICON 0, IDD_FILE_REPLACE_BITMAP, 8, 6, 20, 20
+ CONTROL "Replace File:", -1, "STATIC", SS_LEFT | WS_GROUP, 26, 6, 46, 8
+ CONTROL "With File:", -1, "STATIC", SS_LEFT | WS_GROUP, 26, 27, 46, 8
+ CONTROL "", IDD_FILE_REPLACE_LINE1, "STATIC", SS_LEFT | WS_GROUP, 72, 6, 219, 8
+ CONTROL "", IDD_FILE_REPLACE_LINE2, "STATIC", SS_LEFT | WS_GROUP, 72, 16, 219, 8
+ CONTROL "", IDD_FILE_REPLACE_LINE3, "STATIC", SS_LEFT | WS_GROUP, 72, 27, 219, 8
+ CONTROL "", IDD_FILE_REPLACE_LINE4, "STATIC", SS_LEFT | WS_GROUP, 72, 37, 219, 8
+ CONTROL "&Yes", IDD_FILE_REPLACE_YES, "BUTTON", BS_DEFPUSHBUTTON | WS_TABSTOP, 40, 54, 40, 13
+ CONTROL "Yes to &All", IDD_FILE_REPLACE_ALL, "BUTTON", BS_PUSHBUTTON | WS_TABSTOP, 100, 54, 40, 13
+ CONTROL "&No", IDD_FILE_REPLACE_NO, "BUTTON", BS_PUSHBUTTON | WS_TABSTOP, 160, 54, 40, 13
+ CONTROL "Cancel", IDD_FILE_REPLACE_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_TABSTOP, 220, 54, 40, 13
+// CONTROL "&Help", IDD_FILE_REPLACE_HELP, "BUTTON", BS_PUSHBUTTON | WS_TABSTOP, 228, 54, 40, 13
+END
diff --git a/private/utils/ntbackup/src/omgbacku.bmp b/private/utils/ntbackup/src/omgbacku.bmp
new file mode 100644
index 000000000..78ad2fcb2
--- /dev/null
+++ b/private/utils/ntbackup/src/omgbacku.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omgcat.bmp b/private/utils/ntbackup/src/omgcat.bmp
new file mode 100644
index 000000000..b47089921
--- /dev/null
+++ b/private/utils/ntbackup/src/omgcat.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omgcheck.bmp b/private/utils/ntbackup/src/omgcheck.bmp
new file mode 100644
index 000000000..65443dd4f
--- /dev/null
+++ b/private/utils/ntbackup/src/omgcheck.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omgeject.bmp b/private/utils/ntbackup/src/omgeject.bmp
new file mode 100644
index 000000000..0744d6249
--- /dev/null
+++ b/private/utils/ntbackup/src/omgeject.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omgerase.bmp b/private/utils/ntbackup/src/omgerase.bmp
new file mode 100644
index 000000000..97e14bd9f
--- /dev/null
+++ b/private/utils/ntbackup/src/omgerase.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omgresto.bmp b/private/utils/ntbackup/src/omgresto.bmp
new file mode 100644
index 000000000..ee63dd963
--- /dev/null
+++ b/private/utils/ntbackup/src/omgresto.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omgtensi.bmp b/private/utils/ntbackup/src/omgtensi.bmp
new file mode 100644
index 000000000..9a172a600
--- /dev/null
+++ b/private/utils/ntbackup/src/omgtensi.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omgunche.bmp b/private/utils/ntbackup/src/omgunche.bmp
new file mode 100644
index 000000000..44bff6168
--- /dev/null
+++ b/private/utils/ntbackup/src/omgunche.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omhdisk.bmp b/private/utils/ntbackup/src/omhdisk.bmp
new file mode 100644
index 000000000..9a6a6f7da
--- /dev/null
+++ b/private/utils/ntbackup/src/omhdisk.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omhwconf.dlg b/private/utils/ntbackup/src/omhwconf.dlg
new file mode 100644
index 000000000..1ff78ffc0
--- /dev/null
+++ b/private/utils/ntbackup/src/omhwconf.dlg
@@ -0,0 +1,13 @@
+
+IDD_SETTINGSHARDWARE DIALOG 68, 30, 241, 73
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Hardware Setup"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "&Tape Drive", -1, 10, 8, 149, 8
+ COMBOBOX IDD_H_CONTROLLER, 11, 20, 221, 50, CBS_DROPDOWNLIST |
+ CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK", HWC_SECONDLISTBOX, 44, 50, 35, 14, WS_GROUP
+ PUSHBUTTON "Cancel", HWC_THIRDLISTBOX, 103, 50, 35, 14
+ PUSHBUTTON "&Help", IDHELP, 160, 50, 35, 14
+END
diff --git a/private/utils/ntbackup/src/ommenus.rc b/private/utils/ntbackup/src/ommenus.rc
new file mode 100644
index 000000000..587d110e0
--- /dev/null
+++ b/private/utils/ntbackup/src/ommenus.rc
@@ -0,0 +1,131 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+DAVEV
+
+ Name: wntrpark.rc
+
+ Description: This file contains the references to menu resources for
+ the 32-bit Windows/NT GUI Project Resource File.
+
+ This file was created by copying and modifying
+ MENUS.RC from the standard Windows GUI project.
+
+ $Log: G:\UI\LOGFILES\OMMENUS.RCV $
+
+ Rev 1.12 27 Jan 1994 13:36:44 Glenn
+ Added F5 Refresh support.
+
+ Rev 1.11 21 Apr 1993 15:25:14 GLENN
+ Changed all file details hot key from F to A.
+
+ Rev 1.10 12 Mar 1993 16:47:02 CARLS
+ added ... to format tape
+
+ Rev 1.9 10 Mar 1993 12:55:56 CARLS
+ Changes to move Format tape to the Operations menu
+
+ Rev 1.8 27 Jan 1993 14:23:56 STEVEN
+ updates from msoft
+
+ Rev 1.7 11 Dec 1992 17:33:40 GLENN
+ Changed a help menu item hot-key.
+
+ Rev 1.6 28 Sep 1992 16:27:14 GLENN
+ Added the split to the view menu.
+
+ Rev 1.5 20 Aug 1992 08:46:32 GLENN
+ Added catalog menu support.
+
+ Rev 1.4 07 Jul 1992 16:03:02 GLENN
+ Enabled the view/font item - was commented out for beta.
+
+ Rev 1.3 10 Jun 1992 16:09:06 GLENN
+ Updated according to NT SPEC.
+
+ Rev 1.2 06 May 1992 11:19:54 GLENN
+ Changed hot key for select menu and status bar.
+
+ Rev 1.1 25 Mar 1992 17:45:34 DAVEV
+ OEM_MSOFT: changes to meet spec.
+
+ Rev 1.0 03 Mar 1992 12:23:04 DAVEV
+ Initial revision.
+
+******************************************************************************/
+
+// MENUS -- ID's are defined in the Menu Manager header file 'ntmenus.h'
+
+// Frame window menu.
+
+IDRM_MAINMENU MENU PRELOAD
+BEGIN
+
+ POPUP "&Operations"
+ BEGIN
+ MENUITEM "&Backup...", IDM_OPERATIONSBACKUP
+ MENUITEM "&Restore...", IDM_OPERATIONSRESTORE
+ MENUITEM "&Catalog", IDM_OPERATIONSCATALOG
+ MENUITEM "&Erase Tape...", IDM_OPERATIONSERASE
+ MENUITEM "Re&tension Tape...", IDM_OPERATIONSRETENSION
+ MENUITEM "E&ject Tape", IDM_OPERATIONSEJECT
+ MENUITEM "&Format Tape...", IDM_OPERATIONSFORMAT
+#ifdef FS_EMS
+ MENUITEM "&Microsoft Exchange..." IDM_OPERATIONSEXCHANGE
+#endif
+ MENUITEM SEPARATOR
+ MENUITEM "&Hardware Setup...", IDM_OPERATIONSHARDWARE
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit", IDM_OPERATIONSEXIT
+ END
+
+ POPUP "&Tree"
+ BEGIN
+ MENUITEM "E&xpand One Level", IDM_TREEEXPANDONE
+ MENUITEM "Expand &Branch", IDM_TREEEXPANDBRANCH
+ MENUITEM "Expand &All", IDM_TREEEXPANDALL
+ MENUITEM "&Collapse Branch", IDM_TREECOLLAPSEBRANCH
+ END
+
+ POPUP "&View"
+ BEGIN
+ MENUITEM "Tr&ee and Directory",IDM_VIEWTREEANDDIR
+ MENUITEM "&Tree Only", IDM_VIEWTREEONLY
+ MENUITEM "&Directory Only", IDM_VIEWDIRONLY
+ MENUITEM SEPARATOR
+ MENUITEM "Sp&lit", IDM_VIEWSPLIT
+ MENUITEM SEPARATOR
+ MENUITEM "&All File Details", IDM_VIEWALLFILEDETAILS
+ MENUITEM SEPARATOR
+ MENUITEM "&Status Bar", IDM_VIEWSTATUS
+ MENUITEM "Tool&bar", IDM_VIEWURIBBON
+ MENUITEM SEPARATOR
+ MENUITEM "&Font...", IDM_VIEWFONT
+
+ END
+
+ POPUP "&Select"
+ BEGIN
+ MENUITEM "&Check", IDM_SELECTCHECK
+ MENUITEM "&Uncheck", IDM_SELECTUNCHECK
+ END
+
+ POPUP "&Window"
+ BEGIN
+ MENUITEM "&Cascade", IDM_WINDOWSCASCADE
+ MENUITEM "&Tile", IDM_WINDOWSTILE
+ MENUITEM "&Arrange Icons", IDM_WINDOWSARRANGEICONS
+ MENUITEM "&Refresh\tF5", IDM_WINDOWSREFRESH
+ MENUITEM "C&lose All", IDM_WINDOWSCLOSEALL
+ END
+
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "&Contents", IDM_HELPINDEX
+ MENUITEM "&Search for Help on...", IDM_HELPSEARCH
+ MENUITEM "&How to Use Help", IDM_HELPUSINGHELP
+ MENUITEM SEPARATOR
+ MENUITEM AABOUTAPPLICATIONNAME, IDM_HELPABOUTNOSTRADOMUS
+ END
+
+END
diff --git a/private/utils/ntbackup/src/ommuibar.c b/private/utils/ntbackup/src/ommuibar.c
new file mode 100644
index 000000000..cded2f89b
--- /dev/null
+++ b/private/utils/ntbackup/src/ommuibar.c
@@ -0,0 +1,458 @@
+
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1992
+GSH
+
+ Name: ommuibar.c
+
+ Description: This file contains the functions for the NT Maynard User
+ Interface (MUI) Selection Bar / Ribbon Bar.
+
+ $Log: J:\ui\logfiles\ommuibar.c_v $
+
+ Rev 1.12 07 Feb 1994 01:46:02 GREGG
+Don't allow backup or restore if we're running with the 'NOPOLL' option.
+
+ Rev 1.11 11 Dec 1992 18:21:32 GLENN
+Added dynamic text region sizing based on the length of a text string in a button.
+
+ Rev 1.10 18 Nov 1992 13:01:36 GLENN
+Added microsoft 3D button enhancement.
+
+ Rev 1.9 07 Oct 1992 14:11:30 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.8 04 Oct 1992 19:39:34 DAVEV
+Unicode Awk pass
+
+ Rev 1.7 10 Sep 1992 17:19:04 GLENN
+Resolved outstanding state issues for toolbar and menubar.
+
+ Rev 1.6 20 Aug 1992 09:07:54 GLENN
+Added catalog button support.
+
+ Rev 1.5 10 Jun 1992 16:14:30 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.4 29 May 1992 16:01:18 JOHNWT
+PCH updates
+
+ Rev 1.3 15 May 1992 14:55:30 MIKEP
+changes
+
+ Rev 1.2 21 Apr 1992 16:53:06 chrish
+NT stuff
+
+ Rev 1.1 21 Apr 1992 16:19:46 DAVEV
+Added conditionals to include/exclude all code based on definition of OEM_MSOFT
+
+ Rev 1.0 02 Apr 1992 16:22:52 GLENN
+Initial revision.
+
+******************************************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#ifdef OEM_MSOFT //This file is only compiled for OEM_MSOFT
+
+
+// MODULE WIDE DEFINITIONS
+#define OEM_BUTTONBAR_HEIGHT (IS_JAPAN()?33:26)
+#define OEM_BUTTON_WIDTH 23
+#define OEM_BUTTON_HEIGHT (IS_JAPAN()?28:21)
+#define OEM_BUTTONWITHTEXT_WIDTH 86
+#define OEM_BORDER_WIDTH ( RIB_ITEM_BORDER_WIDTH - 1 )
+#define OEM_BETWEEN_BUTTON_SPACE 7
+#define OEM_BEGIN_BUTTON_LEFT 9
+#define OEM_BEGIN_BUTTON_TOP 2
+#define OEM_BITMAP_TEXT_SPACE 3
+
+// PRIVATE FUNCTIONS
+
+INT MUI_GetMaxTextWidth ( WORD, INT );
+
+
+/******************************************************************************
+
+ Name: MUI_MakeMainRibbon()
+
+ Description: This function creates and stuffs the applications main
+ ribbon.
+
+ Returns: A handle to the main ribbon.
+
+******************************************************************************/
+
+HRIBBON MUI_MakeMainRibbon ( VOID )
+
+{
+ HRIBBON hRibbon;
+ DS_RIBITEMINFO dsItem;
+ UINT i = 0;
+ INT nFontMaxWidth = 0;
+ INT nFontMaxHeight = 0;
+ INT nTextWidth;
+ INT nButtonWithTextWidth;
+
+ // Create the Ribbon.
+
+ hRibbon = RIB_Create ( ghWndMainRibbon,
+ (WORD) 0,
+ MAIN_RIBBON_ITEMWIDTH,
+ MAIN_RIBBON_HEIGHT,
+ MAIN_RIBBON_MAXITEMS
+ );
+
+ // Add the item information. Note: the accelerator key is derived from
+ // the string.
+
+ dsItem.wAccelKey = ID_NOTDEFINED;
+
+ // Use the system font.
+
+ dsItem.hFont = ghFontRibbon;
+
+ // Draw the text left justified and vertically centered.
+
+ dsItem.wTextStyle = RIB_TEXT_HLEFT | RIB_TEXT_VCENTER;
+
+ //
+ // Stuff the COMMON parts of the buttons.
+ //
+ // the TOP, BOTTOM, BITMAP WIDTH, etc.
+ //
+
+ dsItem.Rect.top = OEM_BEGIN_BUTTON_TOP;;
+ dsItem.Rect.bottom = dsItem.Rect.top + OEM_BUTTON_HEIGHT;
+
+ dsItem.rcBM = dsItem.rcText = dsItem.Rect;
+
+ dsItem.rcBM.top += OEM_BORDER_WIDTH;
+ dsItem.rcBM.bottom -= OEM_BORDER_WIDTH;
+
+// dsItem.rcText.top += 2;
+
+ dsItem.rcText.top += OEM_BORDER_WIDTH + 1;
+ dsItem.rcText.bottom -= OEM_BORDER_WIDTH - 1;
+
+ dsItem.wStyle = RIB_ITEM_STYLECHICKLET;
+
+ // Determine the size of the buttons with text in them.
+ // The size will be based on the largest text size.
+
+ nButtonWithTextWidth = OEM_BUTTONWITHTEXT_WIDTH;
+
+ nTextWidth = OEM_BUTTONWITHTEXT_WIDTH - ( ( 2 * OEM_BORDER_WIDTH ) +
+ OEM_BUTTON_WIDTH +
+ OEM_BITMAP_TEXT_SPACE + 4
+ );
+
+
+ nTextWidth = MUI_GetMaxTextWidth ( IDS_RIB_BACKUP, nTextWidth );
+ nTextWidth = MUI_GetMaxTextWidth ( IDS_RIB_RESTORE, nTextWidth );
+
+
+ nButtonWithTextWidth = ( 2 * OEM_BORDER_WIDTH ) + OEM_BUTTON_WIDTH +
+ OEM_BITMAP_TEXT_SPACE + nTextWidth + (IS_JAPAN()?6:4) ;
+
+ // Now, stuff each item.
+
+
+ // BACKUP
+
+ dsItem.wEnabledID = IDRBM_BACKUP;
+ dsItem.wDisabledID = IDRBM_BACKUP_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ dsItem.wMessage = IDM_OPERATIONSBACKUP;
+ dsItem.wStringID = IDS_RIB_BACKUP;
+
+ dsItem.Rect.left = OEM_BEGIN_BUTTON_LEFT;;
+ dsItem.Rect.right = dsItem.Rect.left + nButtonWithTextWidth;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH;
+ dsItem.rcBM.right = dsItem.rcBM.left + OEM_BUTTON_WIDTH + 2;
+
+ dsItem.rcText.left = dsItem.rcBM.right + ( OEM_BITMAP_TEXT_SPACE + 2 );
+ dsItem.rcText.right = dsItem.Rect.right - ( OEM_BORDER_WIDTH + 2 );
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ // RESTORE
+
+ dsItem.wEnabledID = IDRBM_RESTORE;
+ dsItem.wDisabledID = IDRBM_RESTORE_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ dsItem.wMessage = IDM_OPERATIONSRESTORE;
+ dsItem.wStringID = IDS_RIB_RESTORE;
+
+ dsItem.Rect.left = dsItem.Rect.left + nButtonWithTextWidth + OEM_BETWEEN_BUTTON_SPACE;
+ dsItem.Rect.right = dsItem.Rect.left + nButtonWithTextWidth;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH;
+ dsItem.rcBM.right = dsItem.rcBM.left + OEM_BUTTON_WIDTH + 2;
+
+ dsItem.rcText.left = dsItem.rcBM.right + ( OEM_BITMAP_TEXT_SPACE + 2 );
+ dsItem.rcText.right = dsItem.Rect.right - ( OEM_BORDER_WIDTH + 2 );
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ // CATALOG
+
+ dsItem.wEnabledID = IDRBM_CATALOG;
+ dsItem.wDisabledID = IDRBM_CATALOG_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ dsItem.wMessage = IDM_OPERATIONSCATALOG;
+ dsItem.wStringID = ID_NOTDEFINED;
+
+ dsItem.Rect.left = dsItem.Rect.left + nButtonWithTextWidth + OEM_BETWEEN_BUTTON_SPACE;
+ dsItem.Rect.right = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH;
+ dsItem.rcBM.right = dsItem.Rect.right - OEM_BORDER_WIDTH + 1;
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ // RETENSION
+
+ dsItem.wEnabledID = IDRBM_RETENSION;
+ dsItem.wDisabledID = IDRBM_RETENSION_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ dsItem.wMessage = IDM_OPERATIONSRETENSION;
+ dsItem.wStringID = ID_NOTDEFINED;
+
+ dsItem.Rect.left = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+ dsItem.Rect.right = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH - 1;
+ dsItem.rcBM.right = dsItem.Rect.right - OEM_BORDER_WIDTH;
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ // EJECT
+
+ dsItem.wEnabledID = IDRBM_EJECT;
+ dsItem.wDisabledID = IDRBM_EJECT_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ dsItem.wMessage = IDM_OPERATIONSEJECT;
+ dsItem.wStringID = ID_NOTDEFINED;
+
+ dsItem.Rect.left = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+ dsItem.Rect.right = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH;
+ dsItem.rcBM.right = dsItem.Rect.right - OEM_BORDER_WIDTH + 1;
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ // ERASE
+
+ dsItem.wEnabledID = IDRBM_ERASE;
+ dsItem.wDisabledID = IDRBM_ERASE_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL;
+ dsItem.wMessage = IDM_OPERATIONSERASE;
+ dsItem.wStringID = ID_NOTDEFINED;
+
+ dsItem.Rect.left = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+ dsItem.Rect.right = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH;
+ dsItem.rcBM.right = dsItem.Rect.right - OEM_BORDER_WIDTH + 1;
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ // CHECK
+
+ dsItem.wEnabledID = IDRBM_CHECK;
+ dsItem.wDisabledID = IDRBM_CHECK_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED;
+ dsItem.wMessage = IDM_SELECTCHECK;
+ dsItem.wStringID = ID_NOTDEFINED;
+
+ dsItem.Rect.left = dsItem.Rect.left + OEM_BUTTON_WIDTH + OEM_BETWEEN_BUTTON_SPACE;
+ dsItem.Rect.right = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH;
+ dsItem.rcBM.right = dsItem.Rect.right - OEM_BORDER_WIDTH + 1;
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ // UNCHECK
+
+ dsItem.wEnabledID = IDRBM_UNCHECK;
+ dsItem.wDisabledID = IDRBM_UNCHECK_GRAY;
+ dsItem.wState = RIB_ITEM_UP | RIB_ITEM_DISABLED;
+ dsItem.wMessage = IDM_SELECTUNCHECK;
+ dsItem.wStringID = ID_NOTDEFINED;
+
+ dsItem.Rect.left = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+ dsItem.Rect.right = dsItem.Rect.left + OEM_BUTTON_WIDTH;
+
+ dsItem.rcBM.left = dsItem.Rect.left + OEM_BORDER_WIDTH;
+ dsItem.rcBM.right = dsItem.Rect.right - OEM_BORDER_WIDTH + 1;
+
+ RIB_ItemAppend ( hRibbon, &dsItem );
+
+
+ gnMainRibbonHeight = OEM_BUTTONBAR_HEIGHT + 1;
+
+ RIB_SetOwner ( hRibbon, ghWndFrame );
+
+ return hRibbon;
+
+} /* end MUI_MakeMainRibbon() */
+
+
+/******************************************************************************
+
+ Name: MUI_SetOperationButtons ()
+
+ Description: This function sets the state of all operation buttons.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MUI_SetOperationButtons (
+
+WORD wState ) // I - state of the buttons
+
+{
+ WORD wNewState = wState;
+
+ wNewState = (WORD)(( gfPollDrive ) ? wState : RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL);
+
+ RIB_ItemSetState ( ghRibbonMain, IDM_OPERATIONSBACKUP, wNewState );
+ RIB_ItemSetState ( ghRibbonMain, IDM_OPERATIONSRESTORE, wNewState );
+
+ // Special tape-in-drive dependent buttons.
+
+ wNewState = (WORD)(( MUI_IsTapeInDrive () ) ? wState : RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL);
+
+ RIB_ItemSetState ( ghRibbonMain, IDM_OPERATIONSERASE, wNewState );
+ RIB_ItemSetState ( ghRibbonMain, IDM_OPERATIONSEJECT, wNewState );
+
+ wNewState = (WORD)(( MUI_IsTapeValid () ) ? wState : RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL);
+
+ RIB_ItemSetState ( ghRibbonMain, IDM_OPERATIONSCATALOG, wNewState );
+
+ wNewState = (WORD)(( MUI_IsRetensionSupported () ) ? wState : RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL);
+
+ RIB_ItemSetState ( ghRibbonMain, IDM_OPERATIONSRETENSION, wNewState );
+
+} /* end MUI_SetOperationButtons() */
+
+
+/******************************************************************************
+
+ Name: MUI_SetActionButtons()
+
+ Description: This function sets the state of all action buttons.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MUI_SetActionButtons (
+
+WORD wState ) // I - state of the buttons
+
+{
+ RIB_ItemSetState ( ghRibbonMain, IDM_SELECTCHECK, wState );
+ RIB_ItemSetState ( ghRibbonMain, IDM_SELECTUNCHECK, wState );
+
+} /* end MUI_SetActionButtons() */
+
+
+/******************************************************************************
+
+ Name: MUI_SetButtonState()
+
+ Description: This function sets the state of a single button.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID MUI_SetButtonState (
+
+WORD wType, // I - button ID
+WORD wState ) // I - state of the button
+
+{
+ WORD wNewState = wState ;
+
+ if( !gfPollDrive &&
+ ( wType == IDM_OPERATIONSBACKUP ||
+ wType == IDM_OPERATIONSRESTORE ||
+ wType == IDM_OPERATIONSCATALOG ) ) {
+
+ wNewState = (WORD)( RIB_ITEM_UP | RIB_ITEM_DISABLED | RIB_ITEM_POSITIONAL ) ;
+ }
+
+ RIB_ItemSetState ( ghRibbonMain, wType, wNewState );
+
+} /* end MUI_SetButtonState() */
+
+
+
+INT MUI_GetMaxTextWidth (
+
+WORD wStringID,
+INT nOldStringWidth )
+
+{
+// INT nMaxFontWidth = 0;
+// INT nAvgFontWidth = 0;
+// INT nFontHeight = 0;
+ INT nStringLen = 0;
+ INT nMaxStringWidth = 0;
+ CHAR szString[RIB_ITEM_TEXT_SIZE];
+
+ INT nTemp = 0;
+ UINT j;
+
+ nStringLen = RSM_StringCopy ( wStringID, szString, RIB_ITEM_TEXT_SIZE );
+
+// RSM_GetFontSize ( ghFontRibbon, &nMaxFontWidth, &nAvgFontWidth, &nFontHeight );
+// nMaxStringWidth = nStringLen * nAvgFontWidth;
+// nMaxStringWidth = ( nOldStringWidth > nMaxStringWidth ) ? nOldStringWidth : nMaxStringWidth;
+
+ // Remove the underscore character ('&') from the string if any.
+
+ for ( j = 0; j < strlen ( szString ); j++ ) {
+
+ if ( szString[j] == TEXT('&') ) {
+
+ do {
+ szString[j] = szString[j+1];
+ } while ( szString[++j] != TEXT('\0') );
+
+ break;
+ }
+ }
+
+ nMaxStringWidth = RSM_GetFontStringWidth ( ghFontRibbon, szString, nStringLen ) +(IS_JAPAN()?OEM_BITMAP_TEXT_SPACE:0);
+ nMaxStringWidth = ( nOldStringWidth > nMaxStringWidth ) ? nOldStringWidth : nMaxStringWidth;
+
+ return nMaxStringWidth;
+
+} /* end MUI_GetMaxTextWidth() */
+
+
+#endif //OEM_MSOFT //This file is only compiled for OEM_MSOFT
+
+
+
diff --git a/private/utils/ntbackup/src/omndisk.bmp b/private/utils/ntbackup/src/omndisk.bmp
new file mode 100644
index 000000000..f93edd0d7
--- /dev/null
+++ b/private/utils/ntbackup/src/omndisk.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omrdisk.bmp b/private/utils/ntbackup/src/omrdisk.bmp
new file mode 100644
index 000000000..df925d42b
--- /dev/null
+++ b/private/utils/ntbackup/src/omrdisk.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omrestor.bmp b/private/utils/ntbackup/src/omrestor.bmp
new file mode 100644
index 000000000..7a5cc595c
--- /dev/null
+++ b/private/utils/ntbackup/src/omrestor.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omrset.dlg b/private/utils/ntbackup/src/omrset.dlg
new file mode 100644
index 000000000..5f08c6df2
--- /dev/null
+++ b/private/utils/ntbackup/src/omrset.dlg
@@ -0,0 +1,71 @@
+
+IDD_RESTORESET DIALOG DISCARDABLE 5, 15, 270, 208
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Restore Information"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Restore Set Information ",IDD_RSET_INFO_TITLE,5,3,260,
+ 136
+ LTEXT "Tape Name:",IDD_RSET_TAPE_NAME_TEXT,10,17,59,10,NOT
+ WS_GROUP
+ CONTROL "",IDD_RSET_TAPE_NAME,"Static",SS_LEFTNOWORDWRAP |
+ SS_NOPREFIX,70,17,184,10
+ LTEXT "Backup Set:",IDD_RSET_SET_TEXT,10,29,59,10,NOT WS_GROUP
+ CONTROL "",IDD_RSET_SET_LINE_1,"Static",SS_LEFTNOWORDWRAP |
+ SS_NOPREFIX,70,29,184,10
+ LTEXT "Creation Date:",-1,10,41,60,10,NOT WS_GROUP
+ LTEXT "",IDD_RSET_CREATION_DATE,70,41,184,10,SS_NOPREFIX | NOT
+ WS_GROUP
+ LTEXT "Owner:",-1,10,53,60,10,NOT WS_GROUP
+ LTEXT "",IDD_RSET_OWNERS_NAME,70,53,184,10,SS_NOPREFIX | NOT
+ WS_GROUP
+ LTEXT "Original Server:",IDD_RSET_ORG_TEXT,16,75,63,8
+ LTEXT "",IDD_RSET_ORG_NAME,82,75,147,12,SS_NOPREFIX | NOT
+ WS_GROUP
+ LTEXT "Dest&ination Server:",IDD_RSET_DEST_TEXT,16,90,63,8
+ LTEXT "Destination Server:",IDD_RSET_DS_DEST_TEXT,16,90,63,8
+ LTEXT "",IDD_RSET_DSA_DEST_NAME,82,90,147,12,SS_NOPREFIX | NOT
+ WS_GROUP
+ EDITTEXT IDD_RSET_DEST_NAME,82,88,147,12,ES_AUTOHSCROLL
+ CONTROL "&Erase all existing data",IDD_RSET_WIPE_DATA,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,16,103,100,9
+ CONTROL "&Private",IDD_RSET_PRIV_IS,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,120,103,43,9
+ CONTROL "P&ublic",IDD_RSET_PUB_IS,"Button",BS_AUTOCHECKBOX |
+ WS_GROUP | WS_TABSTOP,192,103,43,9
+ CONTROL "&Verify After Restore",IDD_RSET_VERIFY_AFTER,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,11,121,77,12
+ CONTROL "S&tart Service After Restore ",IDD_RSET_START_EMS,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,150,121,100,12
+ GROUPBOX "Restore",-1,10,62,238,56
+ LTEXT "Restore to &Drive:",IDD_RSET_DRIVE_TEXT,16,74,60,9,NOT
+ WS_GROUP
+ COMBOBOX IDD_RSET_DRIVE_BOX,76,72,163,60,CBS_DROPDOWNLIST |
+ CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
+ LTEXT "&Alternate Path:",IDD_RSET_PATH_TEXT,16,90,54,9,NOT
+ WS_GROUP
+ EDITTEXT IDD_RSET_RESTORE_PATH,76,88,148,12,ES_AUTOHSCROLL |
+ WS_GROUP
+ PUSHBUTTON "...",IDD_RSET_BROWSE_BUTTON,224,88,15,12,WS_GROUP
+ CONTROL "Restore Local Re&gistry",IDD_RSET_REGISTRY,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,16,103,104,12
+ CONTROL "&Restore File Permissions",IDD_RSET_SECURITY_INFO,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,103,96,12
+ SCROLLBAR IDD_RSET_SCROLLBAR,254,7,11,132,SBS_VERT | WS_GROUP |
+ WS_TABSTOP
+ GROUPBOX "Log Information",-1,5,142,260,44
+ LTEXT "&Log File:",-1,10,156,60,9
+ EDITTEXT IDD_RSET_LOG_FILENAME,70,155,148,12,ES_AUTOHSCROLL |
+ WS_GROUP
+ PUSHBUTTON "...",IDD_RSET_LOG_BROWSE,218,155,15,12,WS_GROUP
+ CONTROL "&Full Detail",IDD_RSET_LOG_FULL,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,70,172,47,10
+ CONTROL "&Summary Only",IDD_RSET_LOG_SUMMARY,"Button",
+ BS_AUTORADIOBUTTON,121,172,58,10
+ CONTROL "D&on't Log",IDD_RSET_LOG_NONE,"Button",
+ BS_AUTORADIOBUTTON,185,172,46,10
+ DEFPUSHBUTTON "OK",IDD_RSET_OK_BUTTON,50,191,40,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDD_RSET_CANCEL_BUTTON,115,191,40,14
+ PUSHBUTTON "&Help",IDD_RSET_HELP_BUTTON,180,191,40,14
+END
+
diff --git a/private/utils/ntbackup/src/omruntim.dlg b/private/utils/ntbackup/src/omruntim.dlg
new file mode 100644
index 000000000..fdea4dce3
--- /dev/null
+++ b/private/utils/ntbackup/src/omruntim.dlg
@@ -0,0 +1,82 @@
+/**************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: omruntim.dlg
+
+ Description: This file contains a dialog template.
+
+ $Log: G:\UI\LOGFILES\OMRUNTIM.DLV $
+
+ Rev 1.6 31 Jan 1994 13:49:00 Glenn
+ Cleared out the width and height of dummy bitmap controls - NT processes dialogs differently now.
+
+ Rev 1.5 13 Mar 1993 18:41:36 MIKEP
+ fix byte count display
+
+ Rev 1.4 22 Feb 1993 17:34:52 ROBG
+ Made height of IDD_JS_FILE 9 instead of 8.
+ Bitmaps written are 16 pixels tall. 1/8*9 will yield 16 pixels.
+
+ Rev 1.3 18 Dec 1992 11:19:02 chrish
+ Moved from omdialog.rc
+
+ Rev 1.2 19 Aug 1992 14:23:18 CHUCKB
+ Moved things around for NT.
+
+ Rev 1.1 10 Jun 1992 16:11:08 GLENN
+ Updated according to NT SPEC.
+
+ Rev 1.0 11 May 1992 16:54:50 GLENN
+ Initial revision.
+
+**************************************************************************/
+
+IDD_RUNTIME DIALOG 40, 20, 246, 174
+FONT 8, "MS Shell Dlg"
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+BEGIN
+ CONTROL "Text", 304, "STATIC", SS_BLACKFRAME, 4, 4, 238, 34
+ CONTROL "Text", 132, "STATIC", SS_BLACKFRAME, 122, 4, 120, 34
+
+ CONTROL "Directories:", IDD_JS_DP_LABEL, "STATIC", SS_LEFT | WS_GROUP, 6, 6, 80, 10
+ CONTROL "0", IDD_JS_DP, "STATIC", SS_RIGHT | WS_GROUP, 60, 6, 60, 8
+
+ CONTROL "Files:", IDD_JS_FP_LABEL, "STATIC", SS_NOPREFIX | SS_LEFT, 6, 16, 64, 10
+ CONTROL "0", IDD_JS_FP, "STATIC", SS_RIGHT, 60, 16, 60, 8
+
+ CONTROL "Bytes:", IDD_JS_BP_LABEL, "STATIC", SS_NOPREFIX | SS_LEFT, 6, 26, 64, 10
+ CONTROL "0", IDD_JS_BP, "STATIC", SS_RIGHT, 60, 26, 60, 8
+
+ CONTROL "Elapsed time:", IDD_JS_ET_LABEL, "STATIC", SS_NOPREFIX | SS_LEFT, 126, 6, 60, 10
+ CONTROL "00:00", IDD_JS_ET, "STATIC", SS_RIGHT, 190, 6, 50, 8
+
+ CONTROL "Corrupt files:", IDD_JS_CF_LABEL, "STATIC", SS_NOPREFIX | SS_LEFT, 126, 16, 60, 10
+ CONTROL "0", IDD_JS_CF, "STATIC", SS_RIGHT, 190, 16, 50, 8
+
+ CONTROL "Skipped files:", IDD_JS_SF_LABEL, "STATIC", SS_NOPREFIX | SS_LEFT, 126, 26, 60, 10
+ CONTROL "0", IDD_JS_SF, "STATIC", SS_RIGHT, 190, 26, 50, 8
+
+
+ CONTROL "", IDD_JS_SOURCE_DRIVE, "STATIC", SS_LEFT, 4, 42, 0, 0
+ CONTROL "", IDD_JS_SOURCE_NAME, "STATIC", SS_LEFT | SS_NOPREFIX, 22, 42, 186, 8
+
+ CONTROL "Text", 124, "STATIC", SS_BLACKFRAME, 4, 53, 238, 24
+ CONTROL "", IDD_JS_FOLDER, "STATIC", SS_LEFT, 10, 56, 10, 8
+ CONTROL "", IDD_JS_FILE, "STATIC", SS_LEFT, 14, 66, 10, 8
+ CONTROL "", IDD_JS_LINE1, "STATIC", SS_LEFT | SS_NOPREFIX, 23, 56, 198, 8
+ CONTROL "", IDD_JS_LINE2, "STATIC", SS_LEFT | SS_NOPREFIX, 27, 66, 194, 8
+
+
+ CONTROL "Summary", 305, "STATIC", SS_NOPREFIX | SS_LEFT, 4, 80, 238, 56
+ CONTROL "", IDD_JS_LISTBOX, "LISTBOX", LBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP | SS_NOPREFIX, 4, 90, 238, 68
+
+
+ CONTROL "OK", IDD_JS_OK, "BUTTON", BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP, 52, 159, 40, 12
+ CONTROL "&Abort", IDD_JS_ABORT, "BUTTON", BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP, 102, 159, 40, 12
+ CONTROL "&Help", IDD_JS_HELP, "BUTTON", BS_PUSHBUTTON | WS_TABSTOP, 153, 159, 40, 12
+
+
+
+END
+
diff --git a/private/utils/ntbackup/src/omselall.bmp b/private/utils/ntbackup/src/omselall.bmp
new file mode 100644
index 000000000..a6408bb48
--- /dev/null
+++ b/private/utils/ntbackup/src/omselall.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omselnon.bmp b/private/utils/ntbackup/src/omselnon.bmp
new file mode 100644
index 000000000..74029a058
--- /dev/null
+++ b/private/utils/ntbackup/src/omselnon.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omselpar.bmp b/private/utils/ntbackup/src/omselpar.bmp
new file mode 100644
index 000000000..7c6a4f267
--- /dev/null
+++ b/private/utils/ntbackup/src/omselpar.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omstring.rc b/private/utils/ntbackup/src/omstring.rc
new file mode 100644
index 000000000..c47d7312f
--- /dev/null
+++ b/private/utils/ntbackup/src/omstring.rc
@@ -0,0 +1,1515 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: strings.rc
+
+ Description: This file contains the references to string resources for
+ the 32-bit Windows/NT GUI Project Resource File developed
+ under contract to Microsoft Corp.
+
+ This file was created by copying and modifying
+ the WinterPark file: STRING.RC.
+
+ $Log: J:/UI/LOGFILES/OMSTRING.RCV $
+
+ Rev 1.80 24 May 1994 20:11:12 GREGG
+ Improved handling of ECC, SQL, FUTURE_VER and OUT_OF_SEQUENCE tapes.
+
+ Rev 1.79 26 Apr 1994 18:55:22 STEVEN
+ fix disconnect bug
+
+ Rev 1.78 04 Mar 1994 16:58:42 STEVEN
+ prompt if disk is full
+
+ Rev 1.77 11 Feb 1994 16:38:22 GREGG
+ Changed prompt for user to eject tape. EPR 948-0153
+
+ Rev 1.76 07 Feb 1994 02:06:12 GREGG
+ Fixed and expanded 'extended error reporting'.
+
+ Rev 1.75 27 Jan 1994 15:48:28 GREGG
+ Always ask to abort at EOF and don't display bytes remaining.
+
+ Rev 1.74 17 Jan 1994 13:32:18 GREGG
+ Changed translation error strings and ran spell checker on it (1 error found).
+
+ Rev 1.73 10 Jan 1994 21:02:02 STEVEN
+ fix minor grammer stuff
+
+ Rev 1.72 08 Jan 1994 14:58:48 MikeP
+ fix string internationalization characteristics
+
+ Rev 1.71 06 Jan 1994 14:10:40 GREGG
+ Fixed phrasing in SQL tape string.
+
+ Rev 1.70 05 Jan 1994 20:20:00 GREGG
+ Changed string defines for extended error reporting.
+
+ Rev 1.69 01 Dec 1993 14:19:10 mikep
+ add SQL recognition support to poll drive
+
+ Rev 1.68 16 Nov 1993 19:00:14 MARINA
+ fix hard coded text - NEED d_o_bkup.c
+
+ Rev 1.67 04 Nov 1993 16:28:20 STEVEN
+ fixes from WA
+
+ Rev 1.66 26 Oct 1993 18:10:24 BARRY
+ Added backupRegistry option
+
+ Rev 1.65 16 Aug 1993 15:07:24 BARRY
+ Added new strings to bring Nostradamus to UI tips.
+
+ Rev 1.64 29 Jun 1993 17:33:50 GLENN
+ Added new style about box support.
+
+ Rev 1.63 25 May 1993 14:57:36 GLENN
+ Added IDS_VLMDRIVESMSG.
+
+ Rev 1.62 23 May 1993 13:41:46 MIKEP
+ fix epr 294-489, adjust foreign tape as continuation tape msg.
+
+ Rev 1.61 21 May 1993 18:13:24 KEVINS
+ Added browse strings.
+
+
+ Rev 1.60 21 May 1993 10:25:48 chrish
+ This change is for both CAYMAN and NOSTRADAMUS.
+ NOSTRADAMUS EPR 0407: Added new string resource ... RES_SAME_TAPE_FAMILY.
+ The string is used when backing up across two tapes, to warn the user
+ when he has placed a second tape in the drive to be backed up that it
+ is of the same tape family.
+
+ Rev 1.59 21 May 1993 10:05:12 chrish
+ Minor clean-up, changed some mispelled words.
+
+ Rev 1.58 14 May 1993 14:12:20 CHUCKB
+ Added string for active files restored.
+
+ Rev 1.57 10 May 1993 16:16:02 chrish
+ NOSTRADAMUS EPR 0400 and 0172: Did not catch the fix in the veryfy and restore
+ processes of the backup app. Both EPR are the same ... message the tape is
+ rewinding when it already was rewound. Made correction to display proper
+ message.
+
+
+ Rev 1.56 07 May 1993 17:46:00 MIKEP
+ elaborate error msg to user
+
+ Rev 1.55 05 May 1993 10:46:20 MIKEP
+ add message to handle cataloging with full hard drive.
+
+ Rev 1.54 03 May 1993 15:02:04 chrish
+ Nostradamus EPR 0376: log file problem, no quotes around tape name.
+
+ Rev 1.53 03 May 1993 11:29:00 chrish
+ Nostradamous EPR 0172 and 0400: Added RES_TAPE_FULL_REWOUND resource string
+ to display a different message when spanning tape. Current message indication
+ that tape is rewinding when in effect by the time it display this message
+ the tape has been rewound.
+
+ Rev 1.52 02 May 1993 20:01:38 BARRY
+ Changed tense in "...differences was found" to "...differences were found"
+
+
+
+ Rev 1.51 30 Apr 1993 15:46:26 chrish
+ NOSTRADAMOUS EPR 0391: When user aborts operation instead of saying "...
+ operation completed successfully" now says "Operation completed". Will
+ get slightly different message when completed or aborted.
+
+
+ Rev 1.50 29 Apr 1993 17:33:58 DARRYLP
+ Changed DAily to Daily.
+
+ Rev 1.49 28 Apr 1993 16:30:54 CARLS
+ added RES_DRIVE_ERROR_DETECTED
+
+ Rev 1.48 22 Apr 1993 16:04:50 GLENN
+ Fixed event string to say NTBackup.
+
+ Rev 1.47 16 Apr 1993 14:34:32 MIKEP
+ add tape drive name
+
+ Rev 1.46 16 Apr 1993 09:49:30 MIKEP
+ add stings for cataloging
+
+ Rev 1.45 07 Apr 1993 17:56:02 CARLS
+ Changes for seek to end of data
+
+ Rev 1.44 07 Apr 1993 11:15:22 CHUCKB
+ Had a problem with chkout that caused me to lose the changes made for revisions
+ 1.34 through 1.40. This change was to put those changes back in.
+
+ Rev 1.43 02 Apr 1993 15:45:54 CARLS
+ changes for DC2000 unformatted tape
+
+ Rev 1.42 31 Mar 1993 10:42:48 MIKEP
+ add catalog message
+
+ Rev 1.41 25 Mar 1993 17:41:20 CHUCKB
+ Added string for aborting an operation (it isn't just for backups any more).
+
+ Rev 1.34 03 Mar 1993 14:17:06 DARRYLP
+ New read only drive strings
+
+ Rev 1.33 10 Feb 1993 13:13:32 ROBG
+ Renamed title of Tension dialog to ReTension.
+
+ Rev 1.32 10 Feb 1993 12:15:22 chrish
+ Added string resources dor description of backup/restore process info.
+
+ Rev 1.31 09 Feb 1993 10:04:16 CARLS
+ changed VERIFY_INFO from set label to description
+
+ Rev 1.30 09 Feb 1993 09:29:38 chrish
+ Added strings for backup/restore abort ....
+
+ Rev 1.29 27 Jan 1993 14:24:06 STEVEN
+ updates from msoft
+
+ Rev 1.28 18 Jan 1993 14:47:22 GLENN
+ Added Stream Error Reporting Strings and IDs.
+
+ Rev 1.27 06 Jan 1993 15:05:36 chrish
+ Added some more messages for tape security.
+
+ Rev 1.26 23 Dec 1992 13:28:32 MIKEP
+ fix name
+
+ Rev 1.25 23 Dec 1992 10:59:52 chrish
+ Minor string changes
+
+ Rev 1.24 22 Dec 1992 14:48:08 MIKEP
+ fix bytes processed messages
+
+ Rev 1.23 18 Nov 1992 17:13:06 MIKEP
+ on tapes resource
+
+ Rev 1.22 17 Nov 1992 20:09:02 MIKEP
+ unformated message
+
+ Rev 1.21 13 Nov 1992 17:27:12 chrish
+ Added stuff for Tape Security for NT
+
+ Rev 1.20 28 Oct 1992 16:45:58 chrish
+ Added string for Control Break Handling
+
+ Rev 1.19 19 Oct 1992 14:47:26 STEVEN
+ no more remaining size
+
+ Rev 1.18 15 Oct 1992 13:03:10 DAVEV
+ fix problem with batch mode /T option
+
+ Rev 1.17 09 Oct 1992 13:24:06 MIKEP
+ add daily backup type
+
+ Rev 1.16 02 Oct 1992 16:57:52 GLENN
+ Changed backup set name to backup description.
+
+ Rev 1.15 17 Sep 1992 16:54:08 STEVEN
+ added support for daily backup
+
+ Rev 1.14 04 Sep 1992 18:11:18 CHUCKB
+ Added string for sales pitch.
+
+ Rev 1.13 04 Sep 1992 14:32:04 STEVEN
+ file detail byte size is string
+
+ Rev 1.12 04 Sep 1992 10:09:32 GLENN
+ Changed underscore on continue button text.
+
+ Rev 1.11 02 Sep 1992 14:58:44 GLENN
+ Added catalog and davev added event logging stuff and
+ chuckb added about box stuff.
+
+ Rev 1.10 23 Jun 1992 17:37:10 DAVEV
+ added ids from strings.rc, modified RES_FOREIGN_TAPE_MSG
+
+ Rev 1.9 10 Jun 1992 16:11:22 GLENN
+ Updated according to NT SPEC.
+
+ Rev 1.8 05 Jun 1992 12:49:50 DAVEV
+ Added default log file name strings
+
+ Rev 1.7 01 Jun 1992 15:32:42 GLENN
+ Removed excess baggage from RES_DISPLAY_TAPE.
+
+ Rev 1.6 11 May 1992 14:28:16 DAVEV
+ Batch command line option strings added
+
+ Rev 1.5 23 Apr 1992 10:05:50 DAVEV
+ Added new strings from strings.h
+
+
+
+ Rev 1.4 27 Mar 1992 11:56:56 DAVEV
+ Added new ids from WinterPark. Added user name to tape description strings
+
+ Rev 1.3 25 Mar 1992 17:45:04 DAVEV
+ OEM_MSOFT: changes to meet spec.
+
+ Rev 1.2 18 Mar 1992 14:47:10 DAVEV
+
+
+ Rev 1.1 11 Mar 1992 17:03:38 DAVEV
+ integrated winterpark strings.h changes
+
+ Rev 1.0 03 Mar 1992 12:23:04 DAVEV
+ Initial revision.
+
+******************************************************************************/
+
+
+// SEE ALSO PRODDEFS.H -- PRODDEFS.H MUST BE TRANSLATED!!!!!
+
+
+// STRINGS -- ID's are defined in the Resource Manager Header File 'resmang.h'
+
+
+STRINGTABLE
+BEGIN
+
+IDS_APPNAME APPLICATIONNAME
+IDS_EXEFILENAME EXEFILENAME
+IDS_INIFILENAME INIFILENAME
+//IDS_PWDFILENAME PWDFILENAME
+
+IDS_CANTOPEN "Cannot open the file \042%s\042."
+IDS_CANTREAD "Cannot read the file \042%s\042."
+IDS_CANTCREATE "Cannot create the file \042%s\042."
+IDS_CANTWRITE "Cannot write the file \042%s\042."
+IDS_CANTCLOSE "Cannot close the file \042%s\042."
+IDS_ADDEXT ".TXT"
+IDS_ILLFNM "Invalid filename: %s"
+IDS_CLOSESAVE "%s has been changed. Save this file before closing?"
+IDS_CANTFIND "Cannot find %s."
+IDS_HELPNOTAVAIL "Cannot load Windows Help application."
+IDS_CLIENTTITLE "MaynStream"
+IDS_UNTITLED "Untitled"
+IDS_STDMODEWARNING "CAUTION! You are running Windows in Standard mode. Do not enter a DOS box while %s is running.\012\012\012To disable this message, choose Disable."
+IDS_APPVERSION ABOUTVERSION
+IDS_STARTUPTEXT "%s\012\012%s\012%s\012\012The finest backup software\012in the industry."
+IDS_COPYRIGHT COPYRIGHT
+IDS_COMPANY COMPANY
+IDS_APPMSGNAME APPMSGNAME
+IDS_APPEXEVER APP_EXEVER
+IDS_APPRESVER APP_RESVER
+IDS_APPENGREL APP_ENGREL
+IDS_CONGLOMERATE CONGLOMERATE
+IDS_LONGAPPNAME LONGAPPNAME
+IDS_SALESPITCH SALESPITCH
+
+IDS_BADUSERDATAPATH "WARNING! The Data Path specified, \042%s\042, is invalid.\012\012Defaulting to \042%s\042."
+IDS_BADCATDATAPATH "WARNING! The Catalog Path specified, \042%s\042, is invalid.\012\012Defaulting to \042%s\042."
+
+IDS_UNDERSCOREMARKER "&"
+IDS_FONTHELV "MS Shell Dlg"
+IDS_FONTSYSTEM "system"
+IDS_FONTCOURIER "courier"
+
+IDS_BADRESVER "Inconsistent resource files were found. Please reinstall %s."
+IDS_NORESFILE "The %s resource files were not found. Please reinstall %s."
+
+// OPERATION ACTIONS
+
+IDS_READY "Ready"
+IDS_INITIALIZING "Initializing..."
+IDS_BACKINGUP "Backing up files from disk to tape..."
+IDS_TRANSFERRING "Transferring files from disk to tape..."
+IDS_RESTORING "Restoring files from tape to disk..."
+IDS_VERIFYING "Verifying files..."
+IDS_RETENSIONING "Retensioning the tape..."
+IDS_ERASING "Erasing the tape..."
+IDS_CATALOGING "Cataloging the tape..."
+IDS_REWINDING "Rewinding the tape..."
+IDS_EJECTING "Ejecting the tape..."
+IDS_INITFILESYS "Initializing the file system..."
+IDS_INITHARDWARE "Initializing the hardware..."
+IDS_DIRSCANNED "Directories scanned: %d"
+IDS_CATMAINT "Partially catalog the tape or remove it from the catalog."
+IDS_NEXTSETTING "Searching for unknown backup sets..."
+IDS_INITCATALOGS "Initializing the catalogs..."
+IDS_INITUI "Initializing the user interface..."
+IDS_FORMATING "Formatting the tape..."
+
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//
+// DO NOT EVER CHANGE THE ID NUMBERING BELOW 100.
+// BELOW 100 CONTAINS STRINGS THAT WILL NEVER CHANGE FROM VERSION
+// TO VERSION, THIS IS WHERE ALL VERSION STAMPS ARE KEPT FOR ALL
+// FUTURE RELEASES.
+//
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+// Ribbon Manager Item/Button Strings //CHANGE
+
+IDS_RIB_BACKUP "&Backup"
+IDS_RIB_RESTORE "&Restore"
+IDS_RIB_TRANSFER "&Transfer"
+IDS_RIB_ERASE "&Erase"
+IDS_RIB_RETENSION "Rete&nsion"
+IDS_RIB_JOBSTATUS "&Job Status"
+IDS_RIB_CHECK "&Check"
+IDS_RIB_UNCHECK "&Uncheck"
+IDS_RIB_MODIFIED "&Modified"
+IDS_RIB_ADVANCED "&Advanced"
+IDS_RIB_UNDO "&Undo"
+IDS_RIB_INCLUDE "&Include"
+IDS_RIB_EXCLUDE "E&xclude"
+IDS_RIB_VERIFY "&Verify"
+IDS_RIB_CATALOG "Cata&log"
+IDS_RIB_SEARCH "&Search"
+IDS_RIB_NEXTSET "&Next Set"
+IDS_RIB_EJECT "&Eject"
+IDS_RIB_REWIND "Re&wind"
+IDS_RIB_EXIT "E&xit"
+
+IDS_RIB_MEMDEBUG "Memory Trace ON/OFF"
+IDS_RIB_STATLINE "Status Line"
+
+/* button strings used in msgbox.c */
+
+IDS_BUT_OK "OK"
+IDS_BUT_CANCEL "Cancel"
+IDS_BUT_RETRY "&Retry"
+IDS_BUT_YES "&Yes"
+IDS_BUT_NO "&No"
+IDS_BUT_CONTINUE "&Continue"
+IDS_BUT_ABORT "&Abort"
+IDS_BUT_HELP "&Help"
+IDS_BUT_DISABLE "&Disable"
+IDS_BUT_IGNORE "&Ignore"
+
+// Menu Item Status Line Help Strings
+
+IDS_OPERATIONSBACKUP "Back up data from disk to tape."
+IDS_OPERATIONSRESTORE "Restore data from tape to disk."
+IDS_OPERATIONSCATALOG "Catalog and search tape for backup sets."
+IDS_OPERATIONSERASE "Erase a Tape"
+IDS_OPERATIONSRETENSION "Retension a Tape"
+IDS_OPERATIONSEJECT "Rewind and Eject the Tape"
+IDS_OPERATIONSHARDWARE "Change Hardware specific settings"
+IDS_OPERATIONSEXIT "Exit this application; close it down"
+IDS_OPERATIONSFORMAT "Format a tape"
+#ifdef OEM_EMS
+IDS_OPERATIONSEXCHANGE "Connect to a Microsoft Exchange server."
+#endif
+
+IDS_TREEEXPANDONE "Expand the Tree One Level down"
+IDS_TREEEXPANDBRANCH "Expand the current branch"
+IDS_TREEEXPANDALL "Expand All branches"
+IDS_TREECOLLAPSEBRANCH "Collapse the current branch"
+
+IDS_VIEWTREEANDDIR "Show the tree list and the directory list."
+IDS_VIEWTREEONLY "Show only the tree list."
+IDS_VIEWDIRONLY "Show only the directory list."
+IDS_VIEWALLFILEDETAILS "Show all of the file details."
+IDS_VIEWSTATUS "Show/Hide the Status Bar."
+IDS_VIEWURIBBON "Show/Hide the Tool Bar."
+IDS_VIEWFONT "Select a new font."
+IDS_VIEWSPLIT "Create a split bar to resize tree and directory windows."
+
+IDS_SELECTCHECK "Check the highlighted item(s)"
+IDS_SELECTUNCHECK "Uncheck the highlighted item(s)"
+
+IDS_WINDOWSCASCADE "Overlap active windows."
+IDS_WINDOWSTILE "Place active windows adjacent to one another."
+IDS_WINDOWSARRANGEICONS "Arrange all icons."
+IDS_WINDOWSREFRESH "Update the contents of the active window."
+IDS_WINDOWSCLOSEALL "Close all user created windows."
+
+IDS_HELPINDEX "Display the Help Index window."
+IDS_HELPSEARCH "Search for information on a specific subject"
+IDS_HELPKEYBOARD "Display help on the available keystroke commands."
+IDS_HELPCOMMANDS "Display help on the available commands."
+IDS_HELPPROCEDURES "Display help on MaynStream procedures."
+IDS_HELPUSINGHELP "Display help on using the Help system."
+IDS_HELPABOUTNOSTRADOMUS ABOUTAPPLICATIONNAME
+
+
+// DEFINES for the RUNTIME DIALOGS
+
+IDS_DLGTITLEJOBSTATBACKUP "Backup Status"
+IDS_DLGTITLEJOBSTATRESTORE "Restore Status"
+IDS_DLGTITLEJOBSTATTRANSFER "Transfer Status" //DEL
+IDS_DLGTITLEJOBSTATVERIFY "Verify Status"
+IDS_DLGTITLEJOBSTATCATALOG "Catalog Status" //DEL?
+IDS_DLGTITLEJOBSTATTENSION "Retension Status"
+IDS_DLGTITLEJOBSTATERASE "Erase Status"
+IDS_DLGTITLEJOBSTATDELETE "Delete Status"
+IDS_DLGTITLEJOBSTATFORMAT "Format Status"
+
+// STRINGS for the HELP MANAGER
+
+IDS_HMHELPFILENAME HLPFILENAME
+IDS_HMKEYWORDKEYS "keys"
+IDS_HMKEYWORDCOMMANDS "commands"
+IDS_HMKEYWORDPROCS "procedures"
+IDS_HMUSINGHELPFILENAME "winhelp.hlp"
+IDS_HMNOHELPFILE "Help file \042%s\042 was not found."
+
+
+// defines for launcher
+
+//IDS_LCHAPPNAME LCHAPPLICATIONNAME
+//IDS_LCHEXITAPP "To run a scheduled job, please exit "
+//IDS_LCHDELAYTITLE LCHDELAYTITLE
+//IDS_LCHWNTRPARKEXE "winback.exe"
+//IDS_LCHEXECUTIONERROR "Launcher was unable to execute WINBACK.EXE."
+//IDS_LCHONHOLD "Hold"
+//IDS_LCHACTIVE "Ready"
+//IDS_LCHRUNNING "Running"
+//IDS_LCHTOOMANYCLOCKS "Too many clocks or timers in system."
+//IDS_LCHABORTED "Aborted"
+//IDS_LCHDELAYED "Delayed"
+//IDS_LCHMISSED "Missed"
+//IDS_LCHSKIPMSG "Skipping this job will remove it from the schedule list. Do you wish to continue?"
+
+
+IDS_RESTOREPATHINVALID "Specified path is not valid."
+IDS_RESTOREEMSSERVERINVALID "Connection could not be made to the Microsoft Exchange services on the specified server."
+IDS_RESTOREEMSWARNING "You are about to restore Microsoft Exchange components. The Microsoft Exchange services on the destination server will be stopped."
+IDS_RESTOREEMSNOWIPE "You cannot delete the existing data if you don't restore both the public and private stores."
+IDS_DONT_SPECIFY_DRIVE "Path cannot contain a drive designator."
+IDS_DONT_SPECIFY_FNAME "Path cannot contain a file name."
+IDS_RESTORESTOPEXCHANGE "Shutting down Microsoft Exchange services before restoring."
+IDS_RESTORESTARTEXCHANGE "Starting Microsoft Exchange services on \\\\%s.\n Be sure to verify that this service has started successfully."
+IDS_STARTEXCHANGE "Microsoft Exchange service is starting. Be sure to verify that it has started successfully."
+IDS_RESTOREBEGINEXCHANGE "Copying Microsoft Exchange database files."
+RES_RESTOREWRITEERROR "Unable to restore data to %s,\ncheck the application event log for more information."
+IDS_EMS_NO_INC_DS_BACKUP "\\\\%s Directory\nA Normal or Copy type backup must be performed on this Microsoft Exchange component before a Differential or Incremental type backup can be performed on it."
+IDS_EMS_NO_INC_IS_BACKUP "\\\\%s Information Store\nA Normal or Copy type backup must be performed on this Microsoft Exchange component before a Differential or Incremental type backup can be performed on it."
+IDS_EMS_CIRC_LOGS_DS "\\\\%s Directory\nCircular Logging is turned on for this Microsoft Exchange component. Only Normal or Copy type backups can be performed while Circular Logging is turned on."
+IDS_EMS_CIRC_LOGS_IS "\\\\%s Information Store\nCircular Logging is turned on for this Microsoft Exchange component. Only Normal or Copy type backups can be performed while Circular Logging is turned on."
+IDS_EMS_NO_DEST_DRIVE "You must enter a Destination Server."
+IDS_EMS_MUST_PUB_OR_PRI "You must choose to restore the Private or Public or both Information Stores."
+IDS_EMS_NOT_RESPONDING_DS "Directory service on \\\\%s is not responding."
+IDS_EMS_NOT_RESPONDING_IS "Information Store service on \\\\%s is not responding."
+IDS_RESTOREEMSMUSTWIPE "You must select 'Erase all existing data' if the Destination Server is not the same as the Original Server."
+IDS_EMS_NO_PUBLIC_SERVICE "You have selected to restore the Public database to a Private only server.\n"
+IDS_EMS_NO_PRIVATE_SERVICE "You have selected to restore the Private database to a Public only server.\n"
+
+IDS_BACKUP_TYPE "Backup Method: %s\n"
+IDS_WIPE_SPECIFIED "Deleting existing log files."
+
+// defines for Job processing //DEL?
+
+IDS_JOBPROGMAN "PROGMAN"
+IDS_JOBPMGROUP "PMGROUP"
+IDS_JOBDEFAULTGROUP APPGROUP
+IDS_JOBNOPROGMAN "Insertion failed. Program Manager must be running."
+IDS_JOBPROGMANTITLE "Job Icon for Program Manager"
+IDS_JOBPROGMANCONFIRM "Inserting Job \042%s\042 into Group \042%s\042. Do you want to continue?"
+IDS_JOBPROGMANCREATEGROUP "[CreateGroup(%s)]"
+IDS_JOBPROGMANFORMATLINE "[CreateGroup(%s)][ShowGroup(%s,5)][AddItem(%s%s /J:\042%s\042,%s,%s%s,%s )]"
+IDS_JOBFILENAME JOBFILENAME
+IDS_JOBBACKUPICONVALUE "14"
+IDS_JOBTRANSFERICONVALUE "16"
+IDS_JOBRESTOREICONVALUE "15"
+IDS_JOBCOMMANDLINE "/J:\042"
+IDS_JOBSTARTEDLOGMSG "Job \042%s\042 began execution on %s at %s."
+IDS_JOBFINISHEDLOGMSG "Job \042%s\042 ended execution on %s at %s."
+IDS_JOBNOTFOUNDLOGMSG "Job \042%s\042 was not found on %s at %s.\n"
+IDS_JOBMOREJOBS "&More Jobs..."
+IDS_JOBSCHEDULEDJOB "** Scheduled **"
+IDS_JOBEXECERROR "Job Execution Error."
+IDS_JOBWRONGMETHOD "Method has been changed to copy."
+
+// names for automatic jobs (to go with verify.bks and skipped.bks) //DEL?
+
+IDS_VERIFY_JOBNAME "VERIFY"
+IDS_SKIPPED_JOBNAME "SKIPPED"
+
+// error message for when a job can't find its selection file
+
+IDS_JOB_SELNOTFOUNDLOGMSG "Selection File \042%s\042 was not found on %s at %s.\n"
+IDS_JOB_SELNOTVALIDLOGMSG "\nSelection File \042%s\042 was found on %s at %s, but contained\nno valid selections for the settings at that time.\n"
+
+// defines for Schedule processing //DEL?
+
+IDS_SCHEXTENSION "*.SEL"
+IDS_SCHFILENAME SCHFILENAME
+IDS_SCHCOMMANDLINE "/S:"
+IDS_SCHUNIQUEKEY "/K:"
+
+// Job/Schedule error message strings //DEL?
+
+IDS_JOBIOERR "Job File Error"
+IDS_SCHEDULEIOERR "Schedule File Error"
+IDS_JOBISSCHEDULED "This job has been scheduled."
+
+// The days of the week
+
+IDS_DAYOFTHEWEEK "Day of the Week"
+
+IDS_MONDAY "Monday"
+IDS_TUESDAY "Tuesday"
+IDS_WEDNESDAY "Wednesday"
+IDS_THURSDAY "Thursday"
+IDS_FRIDAY "Friday"
+IDS_SATURDAY "Saturday"
+IDS_SUNDAY "Sunday"
+
+// days of the week hot keys
+
+IDS_MONDAYKEY "&Monday"
+IDS_TUESDAYKEY "&Tuesday"
+IDS_WEDNESDAYKEY "&Wednesday"
+IDS_THURSDAYKEY "T&hursday"
+IDS_FRIDAYKEY "&Friday"
+IDS_SATURDAYKEY "&Saturday"
+IDS_SUNDAYKEY "S&unday"
+
+// Weeks of the month
+
+IDS_WEEKOFTHEMONTH "Week of the Month"
+
+IDS_FIRSTWEEK "&First"
+IDS_SECONDWEEK "&Second"
+IDS_THIRDWEEK "&Third"
+IDS_FOURTHWEEK "Fo&urth"
+IDS_LASTWEEK "&Last"
+
+// Backup set description dialog method text
+
+IDS_METHOD_NORMAL "Normal"
+IDS_METHOD_COPY "Copy"
+IDS_METHOD_INCREMENTAL "Incremental"
+IDS_METHOD_DIFFERENTIAL "Differential"
+IDS_METHOD_DAILY "Daily"
+
+IDS_DEFAULT_TAPE_NAME "Tape created on %s"
+IDS_BKUP_PASSWORD_ERROR "Passwords do not match. Would you like to try again?"
+IDS_BKUP_SHORT_PASSWORD_ERROR "Passwords do not match."
+IDS_BKUP_PASSWORD_ERROR_TITLE "Password Error"
+IDS_SET_INFORMATION " Backup Set Information (%d of %d sets) "
+IDS_NO_BSET_NAME "< Not Named >"
+IDS_TAPE_PASSWORD_PROTECTED "Tape is password protected."
+IDS_XCHG_BKUP_NAME "%s \\\\%s"
+
+
+//
+// Tape Security for NT
+//
+
+IDS_BKUP_TAPE_SECURITY "This tape has been secured. You do not have the proper backup privileges."
+IDS_TAPE_SECURITY_TITLE "Tape Security Violation"
+IDS_REST_TAPE_SECURITY "This tape has been secured. You do not have the proper restore privileges."
+IDS_ERASE_TAPE_SECURITY "This tape has been secured. You do not have the proper erase privileges."
+IDS_GENERAL_TAPE_SECURITY "This tape has been secured. You do not have the proper privileges."
+
+// Catalog defines
+
+IDS_TAPEOUTOFSEQUENCE "Warning: This tape is out of sequence."
+IDS_ALLTAPES "All Tapes"
+IDS_ALLFILES "*.*"
+IDS_CATALOGSETNAME "Catalogs Backup" //DEL OR CHANGE?
+IDS_CANTDELTAPEINDRIVECAPTION "Catalog Maintenance Error" //DEL OR CHANGE?
+IDS_CANTDELTAPEINDRIVE "The tape in the drive cannot be removed from the catalog." //CHANGE?
+
+IDS_CATINFOTITLE "Catalog Information"
+IDS_NOSETSADDED "No uncataloged sets were found on the tape."
+
+IDS_CHANGETOPARTIAL "Change to Partially Cataloged"
+
+IDS_REALLYCHANGETOPARTIAL "Do you really want to change %s to partially cataloged?"
+IDS_DELETEFROMCATALOG "Remove backup set from catalog"
+IDS_REALLYDELETEFROMCATALOG "Do you really want to remove tape %s from the catalog?"
+
+// Attach-to-server defines
+
+IDS_LOGINTOSERVERCAPTION "Login to: " //DEL
+
+// Selection and Job Setup defines
+
+IDS_ALLSELECTIONFILES "*.BKS"
+IDS_SELECTIONEXTENSION ".BKS"
+
+IDS_NETWORKERRORCAPTION "Selections invalid for current network setting." //DEL all network stuff
+IDS_MAPPEDFOUND "Network setting is currently Server/Volumes, but mapped drives were found. Do you wish to continue?"
+IDS_SERVERSFOUND "Network setting is currently Mapped Drives, but server/volumes were found. Do you wish to continue?"
+IDS_SERVOLUMES "Server/Volumes"
+IDS_MAPPEDDRIVES "Mapped Drives"
+
+IDS_SELECTCAPTION "Advanced File Selection" //DEL
+IDS_NOSERVERSFOUND "No servers are currently attached." //DEL
+
+IDS_ADVANCEDDATESCAPTION "Please check the dates again." //DEL
+IDS_ADVANCEDDATESMESSAGE "The 'To' date must be later than the 'From' date." //DEL
+IDS_NOFILESSELECTED "No Files Selected."
+
+IDS_SELECTWARNING "Confirm Deletion of Selection File"
+IDS_SELECTAREYOUSURE "Are you sure you want to delete the file \042%s\042?"
+IDS_SELECTUSEDBYJOB "Selection file \042%s\042 is being used by job \042%s\042. "
+
+IDS_SELECTNAMEINUSE "%s Already Exists."
+IDS_SELECTREPLACE "Do you want to replace \042%s\042?"
+IDS_SELECTNAMENOTVALID "Invalid File Name"
+IDS_SELECTENTERVALID "Please enter a valid file name."
+
+IDS_ADVNOTAPESCATALOGED "A tape must be cataloged before making advanced selections."
+IDS_ADVNOTAPESCATALOGEDCAPTION "No tapes are cataloged."
+
+IDS_SELECTNOTFOUND "Selection file \042%s\042 could not be found."
+IDS_NONETWORKFOUND "This selection file contains selections from a network drive that could not be found."
+
+IDS_SELECT_WRITE_ERROR "Unable to open selection file."
+
+// jobs //DEL all jobs stuff
+
+IDS_JOBWARNING "Delete a Job"
+IDS_SCHWARNING "Removing a Scheduled Job"
+IDS_JOBAREYOUSURE "Are you sure you want to delete job \042%s\042?"
+IDS_SCHAREYOUSURE "Are you sure you want to remove job \042%s\042?"
+
+IDS_NOJOBSELECTED "No Job Selected"
+IDS_PLSSELECTJOBRUN "Please select a job to run."
+IDS_PLSSELECTJOBEDIT "Please select a job to edit."
+IDS_NEWJOBCAPTION "Create a New Job"
+IDS_JOBNAMEINUSE "Job \042%s\042 already exists."
+IDS_NOMORESPACE "No more job space available."
+IDS_JOBNOTINLIST "Job is not in the Job List."
+IDS_JOBNAMENOTVALID "Invalid Job Name"
+IDS_PLSSELECTVALIDJOB "Please select a valid job name."
+IDS_PLSENTERVALIDJOB "Please enter a valid job name."
+IDS_EDITJOB "Edit a Job"
+
+// job operations
+
+IDS_OPERATIONBACKUP "BACKUP"
+IDS_OPERATIONTRANSFER "TRANSFER"
+
+// Errors with days/times/time intervals //DEL?
+
+IDS_NODAYCHECKED "No day of the week specified."
+IDS_PLSSELECTDAY "Please check at least one day of the week."
+IDS_NOWEEKCHECKED "No week of the month specified."
+IDS_PLSSELECTWEEK "Please check at least one week of the month."
+IDS_FILENAMENOTVALID "Invalid File Name"
+IDS_INTERVALNOTVALID "Invalid Interval"
+
+IDS_NEXTTIMEINVALID "Invalid Next Time"
+IDS_CHECKMINUTES "Check the minutes and try again."
+IDS_CHECKHOURS "Check the hours and try again."
+IDS_CHECKAMPM "Check the am or pm and try again."
+IDS_CHECKDAY "Check the day and try again."
+IDS_CHECKMONTH "Check the month and try again."
+IDS_CHECKYEAR "Check the year and try again."
+
+IDS_ALLBSETS "All backup sets"
+
+// Default International strings
+
+IDS_DEFAULT_SHORTDATE "MM/dd/yyyy"
+IDS_DEFAULT_TIME ":"
+IDS_DEFAULT_1159 "am"
+IDS_DEFAULT_2359 "pm"
+IDS_DEFAULT_THOUSAND ","
+
+// DEBUG MANAGER STRINGS
+
+IDS_DEBUGWARNING "Debug Settings Warning"
+IDS_DEBUGMESSAGESTOOLOW "The number of debug messages to keep must be at least 10."
+IDS_DEBUGMESSAGESTOOHIGH "The number of debug messages to keep may not be greater than 250."
+IDS_DEBUGBADFILENAME "The file name may not contain blanks."
+
+// LOG FILE MANAGER STRINGS
+
+IDS_LOGFILESWINDOWNAME "Log Files"
+IDS_LOGVIEWMINWINDOWNAME "View Log File"
+IDS_LOGHEADERFILENAME "Log File Name: %s"
+IDS_LOGHEADERDATE "Current Date: %s"
+IDS_LOGHEADERTIME "Current Time: %s"
+IDS_LOGLOGGEDON "Logged on"
+IDS_LOGSTRINGAT "at"
+IDS_LOGLENGTHOFFILE "%8ld bytes"
+IDS_LOGFILENAMEPREFIX " for "
+IDS_LOGPREFIX SHORTAPPNAME
+IDS_LOGEXTENSION ".LOG"
+IDS_LOG_BKS ".BKS"
+IDS_LOG_TKS ".TKS"
+IDS_LOG_RSS ".RSS"
+IDS_LOG_LST ".LST"
+IDS_LOGMAXLINES "Log file contains more than %ld lines."
+IDS_LOGMAXSUPPORT "%s supports viewing only the first %ld lines."
+IDS_LOGSCANNINGFILE "Scanning log file..."
+
+// PRINT MANAGER STRINGS //DEL all print manager stuff
+
+IDS_PRTHEADERFORMAT " Page %4d Date: %s Time: %s Log File Name: %s"
+IDS_PRTSESSIONLOGQUESTION "Do you want to print the log file?"
+IDS_PRTSETUPALREADYOPEN "A Printer Setup dialog box is already open.\012 Close it and try again."
+IDS_PRTPMTITLE "Print Manager"
+IDS_PRTDEFAULT "A default printer must be specified."
+IDS_PRTNOLOGSSELECTED "There are no log files selected to be printed."
+IDS_PRTPRINTINGABORTED "Printing of log files canceled."
+IDS_PRTPRINTINGCOMPLETE "Printing of log files complete."
+IDS_PRTNUMOFLOGFILES "%d log files"
+IDS_PRTONELOGFILE "%d log file"
+IDS_PRTSTARTERROR "Unable to start the print operation."
+IDS_PRTDRIVERNOTFOUND "Printer driver not found."
+IDS_PRTCANNOTACCESSDRIVER "Cannot access the specified printer driver."
+IDS_PRTPRINTSTATUS "Printing \042%s\042 Page %4d. Choose <Esc> to cancel."
+IDS_PRTPRINTCOMPLETE "Printing \042%s\042 complete."
+IDS_PRTPRINTERDRIVERERROR "Printer driver error. Setup failed."
+IDS_PRTNOPRINTERSAVAILABLE "There are no printers available."
+IDS_PRTONSTRING " on "
+IDS_PRTUNACCESSABLE "Printer is currently unavailable."
+
+// EJECT STRINGS
+
+IDS_EJECTTAPEMESSAGE "Eject Tape"
+IDS_EJECTTAPEMANUALEJECT "The tape has been rewound.\012Please remove the tape and choose OK to continue."
+IDS_EJECTTAPENOTAPE "There is no tape in the drive."
+IDS_EJECTTAPEBIGPROBLEM "Tape Eject Failed.\012 Not possible to eject tape now."
+
+// EJECT STRINGS
+
+
+
+// MEMORY MANAGER STRINGS
+
+IDS_MEMNORUNAPP "Insufficient memory available. Close other applications before starting this application again."
+IDS_MEMRETRY "Insufficient memory available. To continue, close another application and choose Retry or choose Cancel to quit."
+IDS_MEMFAILED "Insufficient memory available."
+
+// Read Only drive support...
+
+IDS_RDONLY_DRV_ENCOUNTER "Read Only Drive Encountered!"
+IDS_RDONLY_COPY "Drive %s will not have the attribute bits reset during backup."
+
+// Browse strings
+
+IDS_BROWSETITLE "Browse"
+IDS_BROWSELOGFILES "Log Files(*.LOG)"
+IDS_BROWSELOGFILESEXT "*.log"
+IDS_BROWSEALLFILES "All Files(*.*)"
+IDS_BROWSEALLFILESEXT "*.*"
+
+
+// Extended error reporting stuff
+
+IDS_GENERR_TITLE "Tape Drive Error"
+IDS_GENERR_DRIVER_FAIL1 "Tape device driver failed on a request to %s."
+IDS_GENERR_DRIVER_FAIL2 "Tape device failed on a request to %s."
+IDS_GENERR_DRIVE_FAILED "Tape device reported an error on a request to %s.\n\nError reported:\n%s."
+
+IDS_GENERR_TIMEOUT "Timeout before function completed"
+IDS_GENERR_EOM "End of media early warning"
+IDS_GENERR_BAD_DATA "Unrecognizable data"
+IDS_GENERR_NO_MEDIA "No tape is in drive"
+IDS_GENERR_ENDSET "File mark encountered"
+IDS_GENERR_NO_DATA "No data exists"
+IDS_GENERR_INVALID_CMD "Command is not valid"
+IDS_GENERR_RESET "Bus reset"
+IDS_GENERR_WRT_PROTECT "Write protected tape"
+IDS_GENERR_HARDWARE "Hardware failure"
+IDS_GENERR_UNDETERMINED "Unknown error"
+IDS_GENERR_EOM_OVERFLOW "Attempt to move past end of tape"
+IDS_GENERR_WRONG_BLOCK_SIZE "Device block size differs from size with which tape was written"
+IDS_GENERR_UNRECOGNIZED_MEDIA "Tape is not formatted"
+IDS_GENFUNC_INIT "initialize"
+IDS_GENFUNC_OPEN "claim device"
+IDS_GENFUNC_NRCLOSE "close device"
+IDS_GENFUNC_RCLOSE "deinitialize"
+IDS_GENFUNC_READ "read data from tape"
+IDS_GENFUNC_WRITE "write data to tape"
+IDS_GENFUNC_WRITE_ENDSET "write a file mark to tape"
+IDS_GENFUNC_SPACE_FWD_FMK "space forward by file marks"
+IDS_GENFUNC_SPACE_BKWD_FMK "space backward by file marks"
+IDS_GENFUNC_SPACE_EOD "space to end of data"
+IDS_GENFUNC_SPACE_FWD_BLK "space forward by blocks"
+IDS_GENFUNC_SPACE_BKWD_BLK "space backward by blocks"
+IDS_GENFUNC_ERASE "erase the tape"
+IDS_GENFUNC_REWIND "rewind the tape"
+IDS_GENFUNC_REWINDI "rewind the tape"
+IDS_GENFUNC_RETEN "retension the tape"
+IDS_GENFUNC_STATUS "get device status"
+IDS_GENFUNC_RELEASE "release device"
+IDS_GENFUNC_SEEK "seek to a logical tape address"
+IDS_GENFUNC_GETPOS "report current logical tape address"
+IDS_GENFUNC_MOUNT "mount the tape"
+IDS_GENFUNC_DISMOUNT "dismount the tape"
+IDS_GENFUNC_SPECIAL_GET_INFO "get device information"
+IDS_GENFUNC_SPECIAL_CHNG_BLK_SIZE "change physical block size"
+IDS_GENFUNC_SPECIAL_SET_COMPRESS "enable/disable hardware compression"
+IDS_GENFUNC_EJECT "eject the tape"
+
+
+// VLM
+
+IDS_VLMDISKTITLE "Drives"
+IDS_VLMSERVERTITLE "Servers"
+IDS_VLMSEARCHTITLE "Search Results"
+IDS_VLMTAPETITLE "Tapes"
+IDS_VLMSRCHOOPS "Error"
+IDS_VLMSRCHNOFILESFOUND "No matching files were found."
+IDS_VLMSRCHNOMATCHINGSETS "None of the backup sets matched the requested volume."
+IDS_VLMSRCHTOOMANY "Too many files matched the selection criteria. More files were found than will be displayed."
+IDS_VLMSRCHNOCATALOGS "There are no cataloged tapes to search."
+IDS_VLMSRCHBADFILENAME "Invalid file name."
+IDS_VLMSRCHINGWHAT "Searching tape \042%s\042, set %d"
+IDS_VLMFILESSCANNED "Files scanned: %d"
+IDS_VLMCATWARNING "Catalog Warning"
+IDS_VLMSETINCOMPLETE "This set is not completely cataloged."
+IDS_VLMSETPARTIAL "This set must be cataloged before it can be viewed."
+IDS_VLMSETIMAGE "Image backups cannot be viewed or restored."
+IDS_VLMCATERROR "Catalog Error"
+IDS_VLMCATREADERROR "Error reading a catalog file, the file may be corrupted."
+IDS_VLMCATWRITEERROR "Error writing a catalog file, check available disk space."
+IDS_VLMCATOPENERROR "Error opening a catalog file, check available disk space, and Verify that you have full access to the Working Directory."
+IDS_VLMCATHANDLEERROR "Not enough available file handles."
+IDS_VLMCATSEEKERROR "Error positioning in a catalog file. The file may be corrupted."
+IDS_VLMCATMEMERROR "Insufficient memory available."
+IDS_VLMCATFULLERROR "Insufficient disk space. Verify that you have full access to the Working Directory and there is disk space available."
+IDS_VLMCATUNKNOWNERROR "Unknown error."
+IDS_VLMLOGERROR "Logging error"
+IDS_VLMLOGFULLERROR "Insufficient disk space. Verify that you have full access to the Working Directory and there is disk space available."
+IDS_VLMDEVICEERRORTITLE "Device Error."
+IDS_VLMDEVICEERRORMSG "Drive not responding."
+IDS_VLMSETNUMBER "Set %d"
+IDS_VLMNORM "norm"
+IDS_VLMIMAGE "image"
+IDS_VLMDIFF "diff"
+IDS_VLMCOPY "copy"
+IDS_VLMINCR "incr"
+IDS_VLMDAILY "daily"
+IDS_VLMSERVERNOTLOGGEDIN "You are not logged on to the server."
+IDS_VLMSTARTUPBKS "STARTUP.BKS"
+IDS_VLMTAPENAME "Untitled Tape"
+IDS_VLMAFPTITLE "Warning"
+IDS_VLMAFPTEXT "All open volumes for this server must be closed."
+IDS_TITLEERASEWARNING "Erase Warning"
+IDS_TEXTERASEWARNING "Are you sure you want to erase the tape in the drive ?"
+IDS_VLMONTAPES "Tapes %d/%d"
+IDS_VLMONTAPE "Tape %d"
+IDS_VLMFOREIGNTITLE "Foreign Tape"
+IDS_VLMFOREIGNTEXT "The tape in the drive must be erased before it can be used."
+IDS_VLMUNFORMATEDTITLE "Unrecognizable Tape"
+IDS_VLMUNFORMATEDTEXT "The tape in the drive has an unrecognizable format or is not formatted."
+IDS_VLMDRIVEMSG "Drive %s %s"
+IDS_VLMGOOFYTITLE "Out of Sequence Error"
+IDS_VLMGOOFYTEXT "Tapes in this family require sequential access. Only tape one of the family can be independently identified."
+
+IDS_VLMSETCOMPRESSED "This set is compressed and cannot be viewed or restored."
+IDS_VLMSETENCRYPT "This set is encrypted and cannot be viewed or restored."
+IDS_VLMSETFUTURE "This set was written with a newer version of software and cannot be viewed or restored."
+IDS_VLMSETSMS "This set contains an SMS data stream and cannot be viewed or restored."
+IDS_VLMSQLTEXT "This tape was created with Microsoft(R) SQL Server(c). The data cannot be translated by this application."
+
+IDS_VLMEMSTITLE "Microsoft Exchange - %s"
+
+IDS_VLMECCTEXT "This tape was written with software ECC and cannot be read by this application."
+IDS_VLMFUTURETEXT "This tape was made with a newer version of software and cannot be read by this application."
+IDS_VLMACCESSDENIEDMSG "Access Denied."
+
+IDS_DISKFULL_TITLE "Error Restoring File"
+IDS_DISKFULL "Backup cannot restore %s: There is not enough space on the disk.\n\nDelete one or more files to increase disk space, and then try again."
+
+IDS_XCHNG_NO_SERVER "Specified computer cannot be found."
+IDS_XCHNG_NO_CONNECT "Specified computer is not a Microsoft Exchange server or its Microsoft Exchange services are not started."
+IDS_XCHNG_STOP_RECOVER "The connection to the server being restored will be terminated and no further progress indication will be available. The recovery procedure will continue on the server and cannot be interrupted."
+IDS_XCHNG_RECOVER_TITLE "Microsoft Exchange"
+IDS_XCHNG_SERVICE_NO_START "Microsoft Exchange service failed to start."
+IDS_XCHNG_SERVICE_RUNNING "Microsoft Exchange service is already running on the specified computer."
+IDS_XCHNG_NO_SERVICE "Specified computer is not a Microsoft Exchange server."
+IDS_XCHNG_NO_SERVICE_ACCESS "Your account does not have access to start the Microsoft Exchange services on the specified computer."
+IDS_XCHNG_DIR "Directory"
+IDS_XCHNG_INFO_STORE "Information Store"
+IDS_XCHNG_NO_SERVICE_RUNNING "The Microsoft Exchange %s service is not \nstarted on the selected computer."
+IDS_XCHNG_BKUP_IN_PROG "The selected Microsoft Exchange service is currently \nbeing backed up by another process."
+
+// Loops
+
+IDS_LOOPSOUTOFSEQUENCE "This tape is out of sequence."
+IDS_CAT_LOADING_SM "Loading set list from tape."
+IDS_CAT_LOADING_FDD "Loading set directory from tape."
+IDS_CAT_TAPENAME "The tape"
+IDS_TAPEDRIVENAME "the tape drive"
+IDS_CATLOADERROR "Unable to load catalog data from the tape."
+IDS_BACKUPERRORTITLE "Backup Error"
+IDS_BACKUPWRONGFAMILY "Current tape is from a different tape family."
+
+
+
+// MAYNARD MSII.RES STRINGS
+
+RES_ABORT_KEY "A"
+RES_ABORT_RETRY_FAIL "Abort, Retry, Fail? "
+RES_ABORT_STRING APPABORT
+RES_ABORT_QUESTION "Do you want to end this operation? "
+RES_AFTER_NOON "p"
+RES_ALREADY_CATALOGED_SET "Backup set #%d: %s\nPreviously cataloged"
+RES_APPEND_QUEST "Do you want to append data to this tape? "
+RES_ARCHIVE_NO_SELECTIONS "Nothing selected for Transfer."
+RES_ARCHIVE_REPLACE_WARNING "WARNING: This tape was created with the Transfer option. The data on this tape may have been permanently erased from your disk."
+RES_BACKED_UP_CORRUPT "One corrupted file was backed up."
+RES_BACKED_UP_CORRUPTS "%ld corrupted files were backed up."
+RES_BACKED_UP_CORRUPT_WARNING "File %s is corrupted.\nThis file cannot be verified."
+RES_BACKED_UP_DIRS_FILES "Backed up %ld files in %ld directories."
+RES_BACKED_UP_DIRS_FILE "Backed up %ld file in %ld directories."
+RES_BACKED_UP_DIR_FILE "Backed up %ld file in %ld directory."
+RES_BACKED_UP_DIR_FILES "Backed up %ld files in %ld directory."
+RES_BACKED_UP_IN_USE "%ld file was in use."
+RES_BACKED_UP_IN_USES "%ld files were in use."
+RES_BACKED_UP_IN_USE_WARNING "File %s is in use but is being backed up anyway."
+RES_BACKED_UP_MAC "%ld Macintosh file was backed up."
+RES_BACKED_UP_MACS "%ld Macintosh files were backed up."
+RES_BACKUP_COMPLETED "Backup completed on %s at %s."
+RES_BACKUP_NO_SELECTIONS "No files were selected for Backup."
+RES_BACKUP_STARTED "Backup started on %s at %s."
+RES_BAD_ATTACH_TO_SERVER "Unable to attach to server %s."
+RES_BAD_ATTR_READ "WARNING: Unable to read extended file information for file \042%s\042."
+RES_BAD_SERVER_LOGIN "Unable to login to server %s. Enter another user name and password."
+RES_BENGINE_IN_USE "The MaynStream software is already in use on this system. Concurrent use of MaynStream is not supported."
+RES_BLANK_TAPE "The tape in %s cannot be read."
+RES_CATALOGING_ITEMS "Cataloging file detail information. Please wait..."
+RES_CATALOG_COMPLETED "Cataloging completed on %s at %s."
+RES_CATALOG_STARTED "Cataloging started on %s at %s."
+RES_COMMAND_SYNTAX_ERROR "Syntax error in command line."
+RES_CONFIRM_TAPE_PASSWORD "Reenter the password to confirm that it is correct: "
+RES_CONTINUE "Press any key to continue..."
+RES_CONTINUE_BACKUP_ABORT "Aborting ... Completing backup of file. "
+RES_CONTINUE_RESTORE_ABORT "Aborting ... Completing restore of file. "
+RES_CONTINUE_QUEST "Do you want to continue? "
+RES_CONTINU_FILE_PROMPT "Do you want to restore this file? "
+RES_CONTINU_FILE_WARNING "File %s will be smaller if it is restored."
+RES_CONVERT_MAC_BSET "WARNING: This backup set contains Macintosh folders and files. To restore this information, filenames and directory names may need to be abbreviated from their original Macintosh format."
+RES_CORRUPT_HEADER "List of corrupted files during Backup of %s, device %s at %s, %s."
+RES_CORRUPT_RESTORE_WARNING "WARNING: The CORRUPT.LST file was found. This file indicates that corrupted file(s) have been backed up."
+RES_DATA_LOST "The tape data starting at offset %d, size %d was unreadable. The file has been padded."
+RES_DELETE_COMPLETED "Transfer deletion completed on %s at %s."
+RES_DELETE_DIRS_FILES "Deleted %ld files in %ld directories."
+RES_DELETE_DIR_FILE "Deleted %ld file in %ld directory."
+RES_DELETE_DIR_FILES "Deleted %ld files in %ld directory."
+RES_DELETE_MAC "%ld Macintosh file was deleted."
+RES_DELETE_MACS "%ld Macintosh files were deleted."
+RES_DELETE_QUEST "Do you want to delete all data from your disk? "
+RES_DELETE_STARTED "Transfer deletion started on %s at %s."
+RES_DEVICE_DEAD "Connection to device %s has been lost."
+RES_DIRECTORY "Directory %s"
+RES_DIRECTORYS_NOT_FOUND "%ld directories were not found."
+RES_DIRECTORY_DIFFERENT "Security information for the %s directory is different."
+RES_DIRECTORY_NOT_FOUND "%ld directory was not found."
+RES_DIRECTORY_NOT_FOUND_ON_DISK "Directory %s not found on the disk."
+RES_DISPLAY_BSD_VCB "\nTape #%d: \042%s\042\nBackup performed on %s at %s\nBackup set #%d: \042%s\042"
+RES_DISPLAY_TAPE "\nTape Name: \042%s\042"
+RES_DISPLAY_VCB "Backup of %s on %s at %s\nBackup set #%d on tape #%d\nBackup description: \042%s\042"
+RES_DISPLAY_VOLUME "\nBackup of \042%s\042\nBackup set #%d on tape #%d\nBackup description: \042%s\042"
+RES_DISPLAY_VOLUME_1 "Backup of \042%s\042\nBackup set #%d on tape #%d\nBackup description: \042%s\042"
+RES_DRIVE_MATCH_ERROR "Target drive must match the source drive. Source: %s, target: %s."
+RES_DRIVE_NOT_READY " "
+RES_EMBEDDED_PW_MISMATCH "The password does not match."
+RES_EMPTY_DRIVE_ERROR "%s does not contain a tape."
+RES_EMPTY_TREE_WARNING "Security information will be restored for all selected directories, even if no files are restored to these directories."
+RES_END_CHANNEL "Improperly linked tape drive channel."
+RES_ENTER_TAPE_PASSWORD "Enter a new password or press <Enter> to skip the password: "
+RES_EOM_TAPE_ABORT "The tape operation was terminated."
+RES_ERASE_CAT_WARNING "The tape was not read before it was erased. You must manually delete this tape from the catalog."
+RES_ERASE_COMPLETED "Tape Erase completed on %s at %s."
+RES_ERASE_QUEST "Do you want to erase the data on this tape? "
+RES_ERASE_STARTED "Tape Erase started on %s at %s.\nErasing. "
+RES_ERROR_CREATING_DIR "Unable to create the directory %s."
+RES_ERROR_CREATING_FILE "Unable to create the file %s."
+RES_ERROR_DURING_ATTACH "Error 0x%x during attachment to device %s."
+RES_ERROR_DURING_OPERATION "Error(s) were found during the operation."
+RES_ERROR_FILE_TO_EXAMINE "Examine %s for more detailed error information."
+RES_ERROR_OPENING_PWDBASE "Error accessing the password database."
+RES_ERROR_POSITIONING_TAPE "Tape positioning error on %s."
+RES_ERROR_READING_PDBASE "Error reading the password database."
+RES_ERROR_RESTORING_AFP_FILE "Error restoring AFP resource data for the file %s."
+RES_ERROR_RESTORING_DIR "Unable to restore the directory %s."
+RES_ERROR_RESTORING_FILE "Error restoring the file %s."
+RES_ERROR_RESTORING_FILE_SEC "Unable to restore \042File Attributes Security\042 for file %s."
+RES_ERROR_RESTORING_TRUSTEE_SEC "Unable to restore \042Extended Attribute\042 information for directory %s."
+RES_ERROR_UPDATING_PDBASE "Error writing to the password database."
+RES_ERROR_EMS_RESTART "Unable to bring the Microsoft Exchange service \'%s\' back on line. Check the event log for more details."
+RES_ERROR_WRITING_SCRIPT "Error writing the script file %s."
+RES_ERROR_COMPRESS_FILE_FAIL "Unable to set the NT compression state for %s."
+RES_EU_ERROR "Encryption Unit error: 0x%x."
+RES_FAIL_KEY "F"
+RES_FAIL_STRING "Fail"
+RES_FATAL_TAPE_DRIVE_ERR "Error on %s."
+RES_FATAL_TAPE_ERR "Error on the tape in %s."
+RES_FATAL_TAPE_FMT_ERR "An inconsistency was encountered on the tape in %s."
+RES_FATAL_TAPE_READ_ERR "Unable to read the tape in %s."
+RES_FATAL_TAPE_TRANS_ERR "An error occurred during translation of data to or from the tape in %s."
+RES_FATAL_TAPE_WRITE_ERR "Unable to write to the tape in %s."
+RES_FILES_DIFFERENT "%ld files were different."
+RES_FILES_NOT_FOUND "%ld files were not found."
+RES_FILE_DIFFERENT "%ld file was different."
+RES_FILE_EA_DIFF "Extended Attribute information for the file %s is different."
+RES_FILE_IS_DIFFERENT "File %s is different."
+RES_FILE_NOT_FOUND "One file was not found on the target disk."
+RES_FILE_NOT_FOUND_ON_DISK "File %s was not found on disk."
+RES_FILE_OPEN_ERROR "Unable to open the file %s - skipped."
+RES_FILE_RENAME_ERROR "File may not be renamed. Source: %s Target: %s."
+RES_FILE_RES_DIFF "Resource fork data for the file %s is different."
+RES_FILE_SECURITY_DIFF "Security information for the file %s is different."
+RES_FILE_SKIPPED "File %s is in use. It has been skipped."
+RES_FILE_SKIPPEDS_STAT "%ld files were skipped."
+RES_FILE_SKIPPED_STAT "%ld file was skipped."
+RES_FOREIGN_TAPE_ERROR "Tape in %s is unrecognizable and cannot be read."
+RES_FOREIGN_TAPE_MSG "The tape in %s is not blank. It was created by another application. Do you wish to continue?"
+RES_FOREIGN_TAPE_MSG2 "Tape in drive %s is not blank. It was created by another application. Do you want to replace the data on this tape?"
+RES_GENERAL_FAILURE "General failure."
+RES_INCONSISTENT_HW_PARMS "Inconsistent tape hardware parameters were defined."
+RES_INSERT_MULTI_TAPES "Insert tapes %d-%d in drives %d-%d."
+RES_INSERT_NEW_TAPE "Insert a tape in %s."
+RES_INSERT_NEXT_TAPE "Insert tape number %d in drive %s."
+RES_INSERT_NEXT_TAPE_REWOUND "Tape has been rewound. Insert tape number %d in drive %s."
+RES_ACTIVE_FILES_RESTORED "Active files that were restored will not become usable until the computer is restarted."
+RES_INSUFFICIENT_DISK_SPACE "Insufficient disk space. Verify that you have full access to the Working Directory and there is disk space available."
+RES_INSUFFICIENT_PRIVILEGE "Insufficient privilege for the file %s - skipped."
+RES_INVALID_PARAMETER "Command line %s contains an invalid parameter."
+RES_INVALID_SOURCE "Invalid source path or file name specified in %s."
+RES_INVALID_TARGET "Invalid target path or file name specified in %s."
+RES_MAKE_ANOTHER_COPY "Do you want to make another copy? "
+RES_MENU_CONTINUE "Press any key to return to the menu."
+RES_MISMATCHED_PASSWORD "The supplied password does not match. Please try again."
+RES_MISSING_HW_RESOURCE "Error opening resource file: %s%s."
+RES_MISSING_NKS "Exclude script NOVELL.NKS was not found."
+RES_MISSING_RSS "Exclude script EXCLUDE.RSS was not found."
+RES_NEWLY_CATALOGED_SET "Backup set #%d: %s was added to the catalog."
+RES_NOERROR_DURING_OPERATION "\nThe operation was successfully completed."
+RES_NO_MORE_CONNECTIONS "There are no more connections available for this device."
+RES_NO_MORE_TAPE_INFO "There is no more data on this tape."
+RES_NO_TAPE_PASSWORD "This tape is not password protected."
+RES_NO_TRANSFER_APPEND "You cannot append a transfer set to a tape containing data that was created using the Backup operation."
+RES_OPERATION_COMPLETED "\nOperation Completed."
+RES_ON_DISK "File information found on disk:"
+RES_ON_TAPE "File information found on tape:"
+RES_OPEN_LOG_ERROR "Error opening the log file %s. "
+RES_OS_FILE_INFO_DIFFERENT "Extended file information for %s is different."
+RES_OUT_OF_MEMORY "Insufficient memory available."
+RES_OUT_OF_SEQUENCE_WARNING "Tape number %d is out of sequence."
+RES_PDBASE_FULL "The password database is full. Increase the value of \042Max_PDBase_Entries\042 in the MAYNARD.INI file."
+RES_PRE_NOON "a"
+RES_PRINTER_ERROR " "
+RES_PROCESS_ABORTED "Process Aborted "
+RES_PROCESSED_BYTES "Processed %s bytes in %d minute(s) and %d second(s)."
+RES_PROCESSED_BYTES_MIN "Processed %s bytes in %d minute(s)."
+RES_PROCESSED_BYTES_SEC "Processed %s bytes in %d second(s)."
+RES_PROCESS_RATE "Rate: %ld bytes/second."
+RES_PROMPT_VERIFY_BACKUP "Do you want to verify the Backup operation? "
+RES_PROMPT_VERIFY_RESTORE "Do you want to verify the Restore operation? "
+RES_READ_ERROR " "
+RES_RECOVERED_DIR "The recovered data was associated with a directory."
+RES_RECOVERED_FILE "The recovered data was associated with a file."
+RES_REMOTE_DENIED_READ "You do not have privileges to restore to the volume %s."
+RES_REPLACE_OLD_TAPE "Replace the tape in %s."
+RES_REPLACE_TAPE "Do you want to replace the data on this tape?"
+RES_REPLACE_WARNING "All of the data on the tape in drive %s will be replaced.\012\012Tape:\011%s\012\011Tape number %d\012Set number %d:\011%s\012\012Do you want to replace this information?"
+RES_RESTORED_CORRUPT "One corrupted file was restored. This file was corrupted before it was backed up."
+RES_RESTORED_CORRUPTS "%ld corrupted files were restored. These files were corrupted before they were backed up."
+RES_RESTORED_CORRUPT_WARNING "Corrupted file %s was restored."
+RES_RESTORED_DIRS_FILES "Restored %ld files in %ld directories."
+RES_RESTORED_DIR_FILE "Restored %ld file in %ld directory."
+RES_RESTORED_DIR_FILES "Restored %ld files in %ld directory."
+RES_RESTORED_DIRS_FILE "Restored %ld file in %ld directories."
+RES_RESTORED_IN_USE "%ld in-use file was restored."
+RES_RESTORED_IN_USES "%ld in-use files were restored."
+RES_RESTORED_IN_USE_WARNING "In-use file %s was restored."
+RES_RESTORED_MAC "%ld Macintosh file was restored."
+RES_RESTORED_MACS "%ld Macintosh files were restored."
+RES_RESTORE_BINDERY "Do you want to restore the bindery files if they are present in this backup set? "
+RES_RESTORE_COMPLETED "Restore completed on %s at %s."
+RES_RESTORE_FILE_PROMPT "The file \042%s\042 on disk is more recent than the version on tape."
+RES_RESTORE_NO_SELECTIONS "No files were selected for Restore."
+RES_RESTORE_QUEST "WARNING: You are about to restore data to %s."
+RES_RESTORE_RECOVER "A tape read error occurred. Writing recovered data to %s."
+RES_RESTORE_SECURITY "Do you want to restore directory security information for each directory? "
+RES_RESTORE_STARTED "Restore started on %s at %s."
+RES_RETRY_KEY "R"
+RES_RETRY_STRING "Retry"
+RES_REWINDING "Rewinding the tape. Please wait... "
+RES_SCRIPT_NESTING_ERROR "Too many nested script files."
+RES_SCRIPT_OPEN_ERROR "Cannot open the script file %s."
+RES_SCRIPT_SYNTAX_ERROR "Syntax error on line %d of the script %s."
+RES_SEARCHING "Searching for the backup set. Please wait... "
+RES_SEARCHING_NEXT_FILE "\rSearching for the next file. Please wait... "
+RES_SEARCH_QUEST "Do you want to search for another backup set on this tape? "
+RES_SECTOR_NOT_FOUND "Sector not found."
+RES_SECURITY_DIFFERENCE "%ld security difference was found."
+RES_SECURITY_DIFFERENCES "%ld security differences were found."
+RES_SEC_ERASE_COMPLETED "Tape security erase completed on %s at %s."
+RES_SEC_ERASE_STARTED "Tape security erase started on %s at %s.\nErasing..."
+RES_SEEK_ERROR "Seek error"
+RES_SERVER_ADDR_NOT_FOUND "Unable to obtain the address of the server %s on the network."
+RES_SKIPPED_DEVICE "{Attachment to the device failed during backup of %s, device %s at %s, %s.}"
+RES_SKIPPED_SCRIPT_HEADER "{List of skipped files during backup of %s, device %s at %s, %s.}"
+RES_SKIPPING_REMOTE "The selections for %s will be omitted from the operation."
+RES_SKIP_CONTINUE "Skip this file?"
+RES_TAPE_CREATED "Tape created on "
+RES_TAPE_DRIVE_NAME "Drive %d"
+RES_TAPE_NOT_INSERTED "Tape in drive %s is not properly inserted."
+RES_TAPE_PASSWORD_MATCH "The password is confirmed."
+RES_TAPE_PASSWORD_MISMATCH "The password does not match. Please try again."
+RES_TAPE_REQUEST "Insert the following tape in %s:\012\012%s\012Tape #%d."
+RES_TENSION_COMPLETED "Tape retension completed on %s at %s."
+RES_TENSION_STARTED "Tape retension started on %s at %s.\nRetensioning... "
+RES_UNEXPECTED_EOS "Unexpected end of backup set encountered on %s."
+RES_UNKNOWN_DEVICE "Unknown Device"
+RES_UNKNOWN_HW_ERR "Unknown device driver initialization error."
+RES_UNKNOWN_LOG_MSG "Unknown log message: 0x%x."
+RES_UNKNOWN_LOOPS_ERR "Unknown loops error: %d."
+RES_UNKNOWN_LOOPS_PROMPT "Unknown loops prompt type: 0x%x."
+RES_UNKNOWN_MSG_HNDLR_MSG "Unknown MSG handler message: %d."
+RES_UNKNOWN_PDBASE_ERROR "Unknown password database error: 0x%x."
+RES_UNKNOWN_TF_MSG "Unknown tape format message: %d."
+RES_UNRECOVERABLE_DISK_ERROR "Unrecoverable Disk Error"
+RES_USER_TAPE_ABORT "The tape operation was terminated by the user."
+RES_VERIFIED_DIRS_FILES "Verified %ld files in %ld directories."
+RES_VERIFIED_DIR_FILE "Verified %ld file in %ld directory."
+RES_VERIFIED_DIR_FILES "Verified %ld files in %ld directory."
+RES_VERIFIED_MAC "%ld Macintosh file was processed."
+RES_VERIFIED_MACS "%ld Macintosh files were processed."
+RES_VERIFY_COMPLETED "Verify completed on %s at %s."
+RES_VERIFY_DATA_DIFFERENCE "Verify failed at offset %ld."
+RES_VERIFY_DATA_VERIFIED "Contents verified."
+RES_VERIFY_NO_SELECTIONS "No files were selected for Verify."
+RES_VERIFY_OPEN_ERROR "Disk file was not found or was not accessible."
+RES_VERIFY_PASSWORD_MISMATCH "The password does not match. Please try again. "
+RES_VERIFY_QUEST "Do you want to verify this data with the data on drive %s? "
+RES_VERIFY_SCRIPT_HEADER "{List of files not verified from %s, device %s on %s at %s.}"
+RES_VERIFY_STARTED "Verify started on %s at %s."
+RES_VERIFY_TAPE_PASSWORD "Enter the old password: "
+RES_WAITING "Waiting for the tape drive. Please wait... "
+RES_WAITING_FOR_OPEN "File %s is in use and is waiting."
+RES_WAIT_AND_REPLACE_TAPE "To make an additional copy, wait for the tape to finish rewinding and insert another tape."
+RES_WRITE_ERROR "Write prot "
+RES_WRITE_PROT "Tape in drive %s is write-protected."
+RES_WRITE_PROTECTED "Write Protected "
+RES_TARGET_TRANSFER_TITLE "Transfer"
+RES_ERASE_FOREIGN_TAPE "The tape in the drive is unrecognizable."
+RES_ERASE_BLANK_TAPE "The tape in the drive is blank."
+RES_ERASE_NO_TAPE "There is no tape in the drive."
+RES_ERASE_TAPE_INFO1 "The tape in the drive is \042%s\042 and was created by %s on %s at %s."
+RES_ERASE_DRIVE_BUSY "The tape drive is busy. Please wait..."
+RES_NEED_NEXT_TAPE "The end of the tape was reached. When the tape finishes rewinding, insert the next tape for this backup."
+RES_NEED_NEXT_TAPE_REWOUND "The end of the tape was reached and the tape has been rewound. Insert the next tape for this backup."
+RES_TAPE_FULL "The tape is full. When the tape finishes rewinding, insert the next tape for this backup."
+RES_TAPE_FULL_REWOUND "The tape is full. The tape has been rewound. Insert the next tape for this backup."
+RES_RESTORE_DESC_1 "%s backup of \042%s\042 performed %s at %s by %s."
+RES_TITLE_NEW_LINE "\n"
+RES_NEXT_SET "Search for the next backup set on tape: \042%s\042?"
+RES_NO_NEXT_SET "Invalid tape for the Next Set on Tape operation."
+RES_FOUND_BSET "A backup set was found and has been added to the catalog. Do you want to continue searching?"
+RES_ERASE_POLL_DRIVE_DISABLED "Poll drive is disabled."
+RES_POLL_DRIVE_BAD_TAPE "This tape cannot be cataloged."
+RES_POLL_DRIVE_GOOFY_TAPE "Tapes in this family require sequential access. Please insert the first tape in this family."
+RES_RETENSION_MESSAGE "Retensioning the tape may take several minutes."
+RES_KEEP_CURRENT_SETTINGS "Do you want to keep the current settings for this operation?"
+RES_ERASE_PWDB "Do you want to erase the password database?"
+RES_PWDB_DISABLED "You have entered three invalid passwords. The password database has been disabled."
+RES_PWDB_BAD_CONFIRM "The password failed to confirm. Please try again."
+RES_INIT_FILE_SYSTEM "Initializing the file system."
+RES_INIT_HARDWARE "Initializing the hardware."
+RES_INIT_APPLICATION "Initializing the application."
+RES_APPLICATION_INIT "Application initialized."
+RES_INIT_VLM "Initializing the VLM."
+RES_OPENING_LOG_NAME "\n Opening log: %s, mode: %c\n"
+RES_ERROR_ATTACHING "Unable to attach to %s."
+RES_FILE_DETAIL "%s bytes %s %s\n"
+RES_CLOSING_LOG_NAME "\n Closing log: %s \n"
+RES_ALREADY_FULLY_CATALOGED "Backup set #%d: %s\nPreviously cataloged with file detail information."
+RES_IMAGE_BACKUP "Backup set #%d: %s\nImage Backup."
+RES_ERASE_BAD_TAPE "The tape in the drive is unrecognizable. Use another tape."
+RES_DISPLAY_VERIFY_INFO "\nVerify of \042%s\042\nBackup set #%d on tape #%d\nBackup description: \042%s\042"
+RES_VERIFIED_DIRS_FILE "Verified %ld file in %ld directories."
+RES_FATAL_TAPE_FMT_NO_APPEND "An inconsistency was encountered on the tape in %s. Do not append to this tape."
+RES_COMM_FAILURE "Network disk drive has stopped responding. Backup set aborted."
+RES_EMS_COMM_FAILURE "The Microsoft Exchange service on \\\\%s has\nreported an error. Check the event log for more information."
+RES_EMS_BKU_ACCESS_FAILURE "Your account is not a member of the Backup Operators group\non either this system or \\\\%s. \nYou cannot back up this Microsoft Exchange server."
+RES_EMS_RST_ACCESS_FAILURE "The Microsoft Exchange services could not be stopped. Your account must be\na member of the Administrators group on this system and \non\\\\%s.You cannot restore to this Microsoft Exchange server."
+
+RES_SAME_TAPE_FAMILY "This tape is of the same tape family. Insert a different tape in the drive."
+
+#ifdef OS_WIN32
+RES_FORMAT_TAPE_WARNING "You have chosen to format this tape. All of the information on the tape will be destroyed."
+RES_FORMAT_DIALOG_TITLE "Format Tape"
+RES_FORMAT_COMPLETED "Format completed on %s at %s."
+RES_FORMAT_STARTED "Format started on %s at %s.\nFormatting..."
+#endif
+
+RES_USESYPLFLAG "Sytos ECC translation error. Please check the manual for possible solutions."
+
+//
+// ABORT ERROR STRING
+//
+
+RES_CURRENT_FILE "Current File:"
+RES_BACKUP_ABORT_EOF "Current file: %s\012\012Click Continue to finish writing this file to tape, or click Abort to stop the backup without finishing the current file."
+RES_RESTORE_ABORT_EOF "Current File: %s\012\012Choose Continue to finish writing this file to disk, or click Abort to stop restoring without finishing the current file."
+
+
+// DEBUG ERROR STRINGS
+
+RES_CONFIG_REMOTE "CDS_GetRemoteDriveBackup %d"
+RES_CONFIG_NRL_DOS_VECTOR "CDS_GetNRLDosVector returned %02X."
+RES_SMB_INITIALIZE "SMB_Initialize returned %d (%04X)"
+RES_REMOTE_BUFFERS " InitializeRemote : Buffs %d Unused %d"
+RES_NO_NRL_FUNCTION_TABLE "rinitfs: Could not locate NRL function table."
+RES_REWIND_DRIVE_HDL "RewindDrive( ): hdl = %d "
+RES_DRV_RET " Drv Error = %d"
+RES_RET_VAL_EQUALS " ret_val = %d"
+RES_ERASE_EXABYTE_SECURITY "EraseDrive -- Exabyte: %d Security: %d"
+RES_CALLING_ERASE "Calling TpErase() ..."
+RES_CALLING_WRITE_END_SET "Calling TpWriteEndSet() ..."
+RES_READ_NEXT_SET "ReadNextSet( ):"
+RES_READ_END_SET " TpReadEndSet( ): "
+RES_END_OF_SET " EOS Detected"
+RES_END_OF_MEDIA " EOM Detected"
+RES_TP_READ " TpRead( ): "
+RES_DRV_ERROR_BYTES_RCVD "Error = %d Req = %ld Got = %ld"
+RES_READ_NEXT_SET_RETVAL "ReadNextSet( ): ret_val = %d"
+RES_GOTO_BCKUP_SET "GotoBckUpSet( )"
+RES_OPEN_DRIVE_CARD_NO "OpenDrive( ): Card = %d No = %d"
+RES_CLOSE_DRIVE "CloseDrive( ):"
+RES_REWIND " -- Rewind"
+RES_NO_REWIND " -- No Rewind"
+RES_BADDR_IRQ_DMA_NO_DRIVES "Baddr: %x Irq: %d Dma: %d No Drives: %d"
+RES_UPDATE_DRIVE_STATUS "UpdateDriveStatus( ): "
+RES_VAL_CHANGED " Val = %lx Changed"
+RES_VAL_UNCHANGED " Val = %lx Unchanged"
+RES_CATALOG_TIME "Cataloging Elapsed Time : %d minute(s) and %d second(s)"
+RES_UI_TPOS_TAPE_SET "UI_TPOS: %s, tape #%d, set #%d"
+RES_IMAGE_DIFFERENCE "Difference at head %u cyl %u sector %u\nTape Contents: "
+RES_HEX_BYTE "%02X"
+RES_DISK_CONTENTS "Disk Contents: "
+RES_NEW_LINE ""
+RES_TAPE_PARTITION_SPECS "Tape: bytes/sec %u sec/track %u rsect %lu num sect %lu sys_ind %u"
+RES_DISK_PARTITION_SPECS "Disk: bytes/sec %u sec/track %u rsect %lu num sect %lu sys_ind %u"
+RES_REM_ATTACH_TO_DLE "REM_AttachToDLE"
+RES_SMB_CONNECT_APPLICATION "REM_AttachToDLE: SMB_ConnectApplication returned %p"
+RES_FOUND_REMOTE_DEVICE "REM_AttachToDLE: Found device %s"
+RES_REMOTE_BINDING "REM_AttachToDLE: Binding... "
+RES_FAILED "failed! %04X"
+RES_OKAY "OK!"
+RES_SMB_RELEASE "REM_DetachDLE: SMB_ReleaseDevice "
+RES_REM_SMB_DISCONNECT "REM_DetachDLE: SMB_DisconnectApplication "
+RES_HEX_INT "%04X."
+RES_RWS_ATTACH_TO_DLE "RWS_AttachToDLE"
+RES_DLE_GET_CHILD "DLE_GetChild..."
+RES_RWS_SMB_DISCONNECT "RWS_DetachDLE: SMB_DisconnectApplication "
+RES_SOFT_ERRORS_UNDERRUNS "%d soft error(s) encountered, %d underrun(s)"
+RES_REQUESTED_SET "Requested Set: ID = %lx Seq = %d Set = %d"
+RES_RESIDUAL_READ_BUFFER "Residual Read Buffer"
+RES_ATTEMPTING_TO_VCB "Attempting to VCB tape"
+RES_CURRENT_VCB "Current VCB: ID = %lx Seq = %d Set = %d"
+RES_POSITION_AT_SET "PositionAtSet( ): TF Msg = %x"
+RES_UI_MSG " UI Msg = %x"
+RES_TF_CLOSE_SET "TF_CloseSet "
+RES_FATAL_ERROR_DETECTED "Error detected"
+RES_READ_BUFFER_LEFT_OVER " - Read Buffer Left Over"
+RES_TF_OPEN_SET "TF_OpenSet( )"
+RES_HOLD_BUFFER "Hold Buffer from last Close"
+RES_DESTROY_HOLD_BUFFER "Destroying Hold buffer"
+RES_OPEN_REQUESTED_REWIND "Rewind Requested from Open"
+RES_END_OF_TFOPEN_SET "End of TF_OpenSet: Ret_val = %d Buffs = %d HiWater = %d"
+RES_TF_ALLOCATE_BUFFERS "TF_AllocateTapeBuffers( ): SysMem = %ld Reserved = %ld"
+RES_END_ALLOCATE "End Allocate: No = %d Sz = %ld"
+RES_TF_FREE_BUFFERS "TF_FreeTapeBuffers( ): Start = %d "
+RES_END_EQUALS "End = %d"
+RES_TF_GETNEXT_TAPE_REQUEST "TF_GetNextTapeRequest( ): Recalled in Error State"
+RES_TF_GETNEXT_ERROR "TF_GetNextTapeRequest( ) Error = %d "
+RES_ABORT_READ "AbortRead( )"
+RES_INITIATE_WATCH "TF_InitiateWatch( )"
+RES_WATCH_REWIND "Watch Rewind"
+RES_DEVICE_ERROR "Device Error = %d"
+RES_GOTO_LBA "GotoBlock( ): vPBA = %lx vLBA = %lx rLBA = %lx rBLK = %lx"
+RES_DRIVER_TO_LOAD "Determined driver: %s"
+RES_LOADING_DRIVER "Using driver: %s"
+RES_TPINIT_FAILURE "TpInit() returned - %x"
+RES_WATCH_DRIVE_CALLED "TF_WatchDrive( )"
+RES_WATCH_DRIVE_STATUS "Drv_ret Action = %d Error = %d Len Got = %d"
+RES_WATCH_DRIVE_EXIT " Watch Return = %d"
+RES_WATCH_DRIVE_END "TF_EndWatch( )"
+RES_GET_CURRENT_POS_STAT "Current Block is = %x"
+RES_UI_PURGE_CATALOG "UI_PurgeCatalog( ) = 0x%x"
+RES_UNFORMATED_STRING "%s"
+RES_IMAGE_BAD_VERIFY "No longer able to read disk at head %u cylinder %u sector %u."
+RES_IMAGE_BAD_BLOCK "Not verifying bad sector at head %u cyl %u sector %u."
+RES_IMAGE_BAD_READ "Unable to read disk at head %u cyl %u sector %u."
+RES_IMAGE_BAD_WRITE "Unable to write to disk at head %u cyl %u sector %u."
+RES_CLOSE_BINDERY "Closing Bindery"
+RES_AL_RESULT " AL = %x"
+RES_OPEN_BINDERY "Opening Bindery"
+RES_PARM_BLK_DESCR "Card %d Parameter Block:"
+RES_PARM_BLK "%8lx %8lx %8lx %8lx %8lx"
+RES_CRIT_ADDRS "DriverAddr = %lx lw_channels = %lx"
+RES_ATTACH_TO_DLE "Attach to %s"
+RES_DETACH_FROM_DLE "Detach from %s"
+RES_NOVELL_SERVER_INFO "NOVELL(%d) server %s, volume %s, supp = 0x%02x"
+RES_DLE_BASE_PATH "Base = \042%s\042"
+RES_NO_ATTACHED_DRIVES "Card %x number of attached drives %x"
+RES_INIT_ERROR "Card %x init error status = %x"
+
+RES_VLM_ECC_TAPE "Software ECC Tape"
+RES_VLM_FUTURE_TAPE "Newer Version Tape"
+RES_VLM_BLANK_TAPE "Blank Tape"
+RES_VLM_FOREIGN_TAPE "Foreign Tape"
+RES_VLM_BAD_TAPE "Bad Tape"
+RES_VLM_SQL_TAPE "SQL Tape"
+RES_VLM_GOOFY_TAPE "Out of Sequence Tape"
+RES_VLM_NO_TAPE "No tape in the drive."
+RES_VLM_BUSY_DRIVE "The tape drive is busy."
+RES_VLM_UNFORMATED_TAPE "Unrecognizable Tape"
+RES_FILE_WAS_SKIPPED "File %s was skipped."
+RES_FILE_WAS_SKIPPED_USER "File %s was skipped by the user."
+
+RES_NEW_PROCESSED_BYTES "%s"
+RES_BYTES_PROCESSED "Processed %s bytes in "
+RES_BYTES_PROCESSED_HOUR " %d hour, "
+RES_BYTES_PROCESSED_HOURS " %d hours, "
+RES_BYTES_PROCESSED_MINUTE1 " %d minute, and "
+RES_BYTES_PROCESSED_MINUTES1 " %d minutes, and "
+RES_BYTES_PROCESSED_MINUTE2 " %d minute and "
+RES_BYTES_PROCESSED_MINUTES2 " %d minutes and "
+RES_BYTES_PROCESSED_SECOND " %d second."
+RES_BYTES_PROCESSED_SECONDS " %d seconds."
+
+RES_ABORT_OPERATION "Abort Operation"
+RES_DRIVE_ERROR_DETECTED "Tape drive error was detected."
+
+/* MessageBox titles */
+
+IDS_MSGTITLE_VERIFY "Verify"
+IDS_MSGTITLE_INSERT "Insert Tape"
+IDS_MSGTITLE_REPLACE "Replace Information"
+IDS_MSGTITLE_APPEND "Append Information"
+IDS_MSGTITLE_INUSE "File In-Use"
+IDS_MSGTITLE_CONTINUE "Continue"
+IDS_MSGTITLE_COPY "Copy Tape"
+IDS_MSGTITLE_ERASE "Erase"
+IDS_MSGTITLE_CORRUPT "Corrupted File"
+IDS_MSGTITLE_RESTORE "Restore"
+IDS_MSGTITLE_MACNAMES "Macintosh Names"
+IDS_MSGTITLE_BINDFILES "Bindery Files"
+IDS_MSGTITLE_SECURITY "Security Information"
+IDS_MSGTITLE_ERROR APPERROR
+IDS_MSGTITLE_NEXT "Next Set on Tape"
+IDS_MSGTITLE_RETENSION "Retension"
+IDS_MSGTITLE_KEEP_SETTINGS "Keep Current Settings"
+IDS_MSGTITLE_WARNING "Warning"
+IDS_MSGTITLE_TAPEPSWD "Tape Password"
+IDS_MSGTITLE_XFERMETHOD "Method Is Invalid"
+IDS_MSGTITLE_ABORT "Abort"
+IDS_MSGTITLE_BADEXCHNG "Backup"
+
+
+#include "hwctext.rc"
+
+// Microsoft OEM version command line batch processing strings.
+// ------------------------------------------------------------------
+// The backup string must be the first item on the command line and
+// must match exactly (case insensitive).
+// Each of these IDS_OEM* strings may be no longer than
+// IDS_OEM_MAX_LEN - 1 (eg. 31) characters in length (defined in OMSTRING.H)
+// See OMBATCH.C and MUI_ProcessCommandLine in MUI.C for more information.
+
+IDS_OEMBATCH_BACKUP "Backup"
+IDS_OEMBATCH_EJECT "Eject"
+
+ // Can use DSA or Monolithic backup of Microsoft Mail Exchange servers.
+
+IDS_OEMOPT_DSA "DS"
+IDS_OEMOPT_MONOLITHIC "IS"
+
+ // Each option on the command line must be prefixed by one of the chars
+ // specified in the prefixes string.
+
+IDS_OEMOPT_PREFIXES "/-"
+
+ // This string holds the list of tokens (characters) which seperate
+ // one command line item from another - eg. spaces, tabs, commas, etc.
+
+IDS_OEMOPT_TOKENSEPS " \t,"
+
+ // The first letter of each of the following option MUST BE UNIQUE!!
+
+IDS_OEMOPT_APPEND "Append"
+IDS_OEMOPT_VERIFY "Verify"
+IDS_OEMOPT_RESTRICT "Restrict"
+IDS_OEMOPT_DESCRIPTION "Description"
+IDS_OEMOPT_TYPE "Type"
+IDS_OEMOPT_LOGFILENAME "Logfile"
+IDS_OEMOPT_LOGEXCEPTIONS "Exceptions"
+IDS_OEMOPT_BACKUP_REGISTRY "B" // Need text for this?
+
+ // The first letter of each of the following types MUST BE UNIQUE!!
+IDS_OEMTYPE_NORMAL "Normal"
+IDS_OEMTYPE_COPY "Copy"
+IDS_OEMTYPE_INCREMENTAL "Incremental"
+IDS_OEMTYPE_DIFFERENTIAL "Differential"
+IDS_OEMTYPE_DAILY "Daily"
+IDS_OEMTYPE_COMPATIBLE "#Compatible" //special undocumented feature!
+
+#ifdef OS_WIN32
+ //Microsoft OEM Event Logging 'Source' Name - eg. the name which identifies
+ // a message logged to the event logger as having come from us.
+ IDS_OEMEVENT_SOURCE_NAME "NTBackup"
+#endif
+
+//Backup and Restore Log file default names
+IDS_OEMLOG_BACKUP_DEF_NAME "BACKUP.LOG"
+IDS_OEMLOG_RESTORE_DEF_NAME "RESTORE.LOG"
+IDS_OEMLOG_ERROR_REPORTEVENT "Error %ld Logging EventId=%ld Type=%d nStrings=%d"
+IDS_OEMLOG_ERROR_EVENTSTRING "-- Event String %d: '%s'"
+
+// Extra stuff for the About box
+
+IDS_ABOUT_ENHANCED_MODE "386 Enhanced Mode"
+IDS_ABOUT_STANDARD_MODE "Standard Mode"
+IDS_ABOUT_MEMORY "Memory:"
+IDS_ABOUT_MEM_FORMAT "%d,%03d KB Free"
+IDS_ABOUT_RESOURCES "System Resources:"
+IDS_ABOUT_RES_FORMAT "%d%% Free"
+IDS_APPTEXTSTRING "Microsoft Windows NT %s"
+IDS_LICENSEINFOKEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
+IDS_CURRENTVERSION "CurrentVersion"
+IDS_REGUSER "RegisteredOwner"
+IDS_REGORGANIZATION "RegisteredOrganization"
+IDS_VERSIONMSG "Version %s %s"
+IDS_DEBUG "Debug"
+IDS_PROCESSORINFOKEY "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"
+IDS_PROCESSORIDENTIFIER "Identifier"
+IDS_IDENTIFIERIDENTIFIER "HARDWARE\\DESCRIPTION\\System"
+IDS_PRODUCTIDINFOKEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
+IDS_PRODUCTIDENTIFIER "ProductId"
+
+
+// Runtime JOB Status Events
+
+
+IDS_RTD_ACCESSDENIED_FILE "You do not have permission to access portions of\n %s.\nPlease see the owner or administrator to get permission."
+IDS_RTD_ACCESSDENIED_DIR "You do not have permission to access portions of\n %s.\nPlease see the owner or administrator to get permission."
+
+IDS_RTD_WRITEERROR_FILE "You do not have permission to access portions of\n %s.\nPlease see the owner or administrator to get permission."
+IDS_RTD_WRITEERROR_DIR "You do not have permission to access portions of\n %s.\nPlease see the owner or administrator to get permission."
+
+IDS_RTD_READERROR_STREAM "Error reading file data."
+IDS_RTD_WRITEERROR_STREAM "Error writing file data."
+IDS_RTD_VERIFYERROR_DATA "Difference encountered in file data."
+
+IDS_RTD_READERROR_SECURITYSTREAM "Unable to read security information."
+IDS_RTD_WRITEERROR_SECURITYSTREAM "Unable to write security information."
+IDS_RTD_VERIFYERROR_SECURITYSTREAM "Difference encountered in security information."
+
+IDS_RTD_READERROR_EA "Error reading Extended Attribute information."
+IDS_RTD_WRITEERROR_EA "Error writing Extended Attribute information."
+IDS_RTD_VERIFYERROR_EA "Difference encountered in Extended Attribute information."
+
+IDS_RTD_READERROR_ALTSTREAM "Error reading alternate file data."
+IDS_RTD_WRITEERROR_ALTSTREAM "Error writing alternate file data."
+IDS_RTD_VERIFYERROR_ALTSTREAM "Difference encountered in alternate file data."
+
+IDS_RTD_READERROR_LINK "Error reading file link information."
+IDS_RTD_CREATEERROR_LINK "Unable to create file link."
+
+END
+
diff --git a/private/utils/ntbackup/src/omtensio.bmp b/private/utils/ntbackup/src/omtensio.bmp
new file mode 100644
index 000000000..85fdc1fd2
--- /dev/null
+++ b/private/utils/ntbackup/src/omtensio.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omunchec.bmp b/private/utils/ntbackup/src/omunchec.bmp
new file mode 100644
index 000000000..b6dc56e2b
--- /dev/null
+++ b/private/utils/ntbackup/src/omunchec.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/omxchng.dlg b/private/utils/ntbackup/src/omxchng.dlg
new file mode 100644
index 000000000..252c0b9d9
--- /dev/null
+++ b/private/utils/ntbackup/src/omxchng.dlg
@@ -0,0 +1,52 @@
+
+IDD_CONNECT_XCHNG DIALOG DISCARDABLE 0, 0, 217, 93
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Microsoft Exchange"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ ICON IDRI_EXCHANGE,-1,6,6,18,20
+ LTEXT "Type the name of any online Microsoft Exchange server in the organization.",
+ -1,30,7,125,16
+ LTEXT "&Server:",-1,6,32,23,8
+ EDITTEXT IDD_XCNCT_SVR_NAME,6,43,135,12,ES_AUTOHSCROLL
+ PUSHBUTTON "...",IDD_XCNCT_PICKER,141,43,12,12
+ CONTROL "&Connect to Organization",IDD_XCNCT_CONNECT,"Button",
+ BS_AUTORADIOBUTTON,6,63,92,10
+ CONTROL "S&tart Service:",IDD_XCNCT_ONLINE,"Button",
+ BS_AUTORADIOBUTTON,6,76,78,10
+ COMBOBOX IDD_XCNCT_SERVICE,88,75,73,30, CBS_DROPDOWNLIST |
+ CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDD_XCNCT_OK,161,6,50,14
+ PUSHBUTTON "&Help",IDD_XCNCT_HELP,161,40,50,14
+ PUSHBUTTON "Cancel",IDD_XCNCT_CANCEL,161,23,50,14
+END
+
+IDD_XCHG_RECOVER DIALOG DISCARDABLE 38, 64, 241, 59
+STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Recovering..."
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "Recovering %s Service",IDD_XCHG_RCVR_TEXT,6,6,164,11,
+ SS_NOPREFIX
+ CONTROL "%d%% Complete",IDD_XCHG_RCVR_PCT,"Static",
+ SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,6,48,115,8
+ DEFPUSHBUTTON "Close",IDD_XCHG_RCVR_CANCEL,185,34,50,14
+ ICON IDRI_EXCHANGE,-1,211,6,18,20
+ CONTROL "",IDD_XCHG_RCVR_STATUS,"Button",BS_OWNERDRAW,91,18,117,
+ 11
+ CONTROL "Phase %d of %d",IDD_XCHG_RCVR_PHASE,"Static",
+ SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,6,20,115,8
+ CONTROL "",IDD_XCHG_RCVR_STATUS_BORDER,"Static",SS_BLACKFRAME,6,
+ 34,169,11
+END
+
+IDR_XCHG_RCVR_IS_PHASE RCDATA
+BEGIN
+ 4
+END
+
+IDR_XCHG_RCVR_DS_PHASE RCDATA
+BEGIN
+ 2
+END
diff --git a/private/utils/ntbackup/src/openbsdu.c b/private/utils/ntbackup/src/openbsdu.c
new file mode 100644
index 000000000..24027157b
--- /dev/null
+++ b/private/utils/ntbackup/src/openbsdu.c
@@ -0,0 +1,109 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: openbsdu.c
+
+ Description: This file contains code to initialize the BSDU and code
+ to close and remove an initialized BSD list.
+
+ $Log: N:/LOGFILES/OPENBSDU.C_V $
+
+ Rev 1.2 12 Jun 1991 16:05:16 STEVEN
+added virtual memory for LBAs
+
+ Rev 1.1 29 May 1991 17:21:08 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:38:24 HUNTER
+Initial revision.
+
+**/
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+#include "vm.h"
+
+#include "bsdu.h"
+#include "msassert.h"
+/**/
+/**
+
+ Name: BSD_OpenList()
+
+ Description: This function allocates memory for a BSD handle and
+ modifies the pointer provided to point to this handle. It
+ also initializes The list which will be pointed to by the new
+ handle.
+
+ Modified: 5/17/1991 13:21:29
+
+ Returns: Error codes:
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: The handle returned must be passed to all subsequent
+ BSDU list operation functions calls.
+
+ See also: $/SEE( BSDU_CloseList() )$
+
+ Declaration:
+
+**/
+INT16 BSD_OpenList(
+BSD_HAND *bsdh, /* O - The BSD handle */
+VM_HDL vm_hand ) /* I - virtual memory handle */
+{
+ INT16 ret_val ;
+
+ msassert( bsdh != NULL );
+
+ *bsdh = (BSD_HAND)calloc( 1, sizeof( BSD_LIST ) );
+
+ if( *bsdh != NULL ) {
+
+ (*bsdh)->vm_hand = vm_hand ;
+ ret_val = SUCCESS;
+
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: BSDU_CloseList()
+
+ Description: This function goes through both the Last Oper list and
+ the current list and removes all BSD elements. It then releases
+ the BSD handle itself.
+
+
+ Modified: 8/7/1989
+
+ Returns: None.
+
+ Notes: All pointers previously returned by the BSDU for this
+ handle will now point to free memory.
+
+
+ See also: $/SEE( BSDU_OpenList() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID BSD_CloseList(
+BSD_HAND bsdh ) /* I - BSD List to close */
+{
+ BSD_ClearCurrOper( bsdh ) ;
+ BSD_ClearLastOper( bsdh ) ;
+
+ free( bsdh ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/opensys.c b/private/utils/ntbackup/src/opensys.c
new file mode 100644
index 000000000..c0c1bdc32
--- /dev/null
+++ b/private/utils/ntbackup/src/opensys.c
@@ -0,0 +1,273 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: opensys.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains the code to open and close a specified
+ file system. A file system must be opened prior to access.
+
+
+ $Log: J:/LOGFILES/OPENSYS.C_V $
+
+ Rev 1.15 26 Jul 1993 19:22:54 DON
+When we close down the file system, added a call to free the os path or name queue!
+
+ Rev 1.14 11 Nov 1992 09:52:34 GREGG
+Unicodeized literals.
+
+ Rev 1.13 10 Nov 1992 08:17:46 STEVEN
+move os path and os name into common part of dblk
+
+ Rev 1.12 25 Sep 1992 16:22:22 CARLS
+Fixed error in last edit. [Barry]
+
+ Rev 1.11 25 Sep 1992 13:18:26 BARRY
+Removed references to FS_SIZEOF_NAMELESS_STREAM_HEAD.
+
+ Rev 1.10 01 Sep 1992 11:44:20 TIMN
+Fixed typo for BINT16
+
+ Rev 1.9 18 Aug 1992 10:26:48 STEVEN
+fix warnings
+
+ Rev 1.8 23 Jul 1992 12:41:06 STEVEN
+fix warning
+
+ Rev 1.7 09 Jul 1992 13:58:30 STEVEN
+BE_Unicode updates
+
+ Rev 1.6 21 May 1992 13:58:10 STEVEN
+added more long path stuff
+
+ Rev 1.5 16 Mar 1992 10:06:56 LORIB
+Added InitQueue() for path_q.
+
+ Rev 1.4 01 Oct 1991 11:15:48 BARRY
+Include standard headers.
+
+ Rev 1.3 06 Aug 1991 18:30:24 DON
+added NLM File System support
+
+ Rev 1.2 25 Jun 1991 09:34:54 BARRY
+Changes for new config.
+
+ Rev 1.1 03 Jun 1991 13:27:04 BARRY
+Remove product defines from conditional compilation.
+
+ Rev 1.0 09 May 1991 13:38:26 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdlib.h>
+#include <std_err.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+
+#include "beconfig.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: FS_OpenFileSys()
+
+ Description: This function is called to get a file system handle.
+ The handle is required for all subsequent calls to the file system.
+ This routine allocates all resources necessary to support the
+ particular file system. The valid file system types are:
+ LOCAL_IMAGE
+ LOCAL_DOS_DRV
+ REMOTE_DOS_DRV
+ NOVELL_DRV
+ NOVELL_AFP_DRV
+ IBM_PC_LAN_DRV
+
+ Modified: 7/14/1989
+
+ Returns: Error codes:
+ UNDEFINED_TYPE
+ OUT_OF_MEMORY
+ SUCCESS
+
+
+ Notes:
+
+ See also: $/SEE( FS_AttachDLE(), FS_CloseFileSys() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_OpenFileSys(
+FSYS_HAND *fsh, /* O - Created file system handle */
+INT16 type, /* I - File system type */
+BE_CFG_PTR cfg ) /* I - configuration structure */
+{
+ if ( type >= MAX_DRV_TYPES ) {
+ return ( FS_UNDEFINED_TYPE ) ;
+ }
+
+ *fsh = (FSYS_HAND)calloc( 1, sizeof( struct FSYS_HAND_STRUCT ) ) ;
+
+ if( *fsh != NULL ) {
+
+ (*fsh)->stream_ptr = NULL;
+ (*fsh)->stream_buf_size = 0;
+
+ (*fsh)->cur_dir = calloc( 1, CUR_DIR_CHUNK ) ;
+
+ if ( (*fsh)->cur_dir == NULL ) {
+ free( (*fsh)->stream_ptr ) ;
+ free( *fsh ) ;
+ } else {
+
+ #if ( defined(FS_AFP) && defined(FS_NONAFP) )
+ if ( ( type == NOVELL_AFP_DRV ) && !BEC_GetAFPSupport( cfg ) ) {
+ type = NOVELL_DRV ;
+ }
+ #endif
+
+ #if ( defined(FS_NLMAFP) && defined(FS_NLMNOV) )
+ if ( ( type == NLM_AFP_VOLUME ) && !BEC_GetAFPSupport( cfg ) ) {
+ type = NLM_VOLUME ;
+ }
+ #endif
+
+ (*fsh)->f_type = type ;
+ (*fsh)->tab_ptr = &(func_tab[type]) ;
+ (*fsh)->leng_dir = CUR_DIR_CHUNK ;
+ (*fsh)->cfg = cfg;
+
+ InitQueue( &((*fsh)->min_ddb_stk) ) ;
+
+ InitQueue( &((*fsh)->in_use_name_q) ) ;
+
+ InitQueue( &((*fsh)->avail_name_q) ) ;
+
+ return ( SUCCESS ) ;
+ }
+ }
+ return ( OUT_OF_MEMORY ) ;
+}
+
+/**/
+/**
+
+ Name: FS_ReOpenFileSys()
+
+ Description: This function is called to modify a file system handle.
+ The previously opened file system is closed and the memory for the old
+ handle is reused for the new file system. This routine allocates all
+ resources necessary to support the particular file system. The valid
+ file system types are:
+ LOCAL_IMAGE
+ LOCAL_DOS_DRV
+ REMOTE_DOS_DRV
+ NOVELL_DRV
+ NOVELL_AFP_DRV
+ IBM_PC_LAN_DRV
+
+ Modified: 7/14/1989
+
+ Returns: Error codes:
+ UNDEFINED_TYPE
+ OUT_OF_MEMORY
+ SUCCESS
+
+
+ Notes:
+
+ See also: $/SEE( FS_AttachDLE(), FS_CloseFileSys() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_ReOpenFileSys(
+FSYS_HAND fsh, /* O - Modified file system handle */
+INT16 type, /* I - File system type */
+BE_CFG_PTR cfg ) /* I - configuration structure */
+{
+ if ( type < MAX_DRV_TYPES ) {
+ return ( FS_UNDEFINED_TYPE ) ;
+ }
+
+ msassert( fsh != NULL ) ;
+
+ if ( fsh->attached_dle != NULL ) {
+ FS_DetachDLE( fsh ) ;
+ }
+
+ fsh->f_type = type ;
+ fsh->tab_ptr = &(func_tab[type]) ;
+ fsh->cur_dir[0] = TEXT('\0') ;
+ fsh->cfg = cfg;
+
+ InitQueue( &(fsh->min_ddb_stk) ) ;
+
+ InitQueue( &(fsh->in_use_name_q) ) ;
+
+ InitQueue( &(fsh->avail_name_q) ) ;
+
+ return ( SUCCESS ) ;
+}
+
+
+/**/
+/**
+
+ Name: FS_CloseFileSys()
+
+ Description: This releases any memory allocated by the FS_OpenFileSys()
+ function. It will also release any memory leftover from FS_PushDir()
+
+
+ Modified: 7/14/1989
+
+ Returns: Error codes:
+ FS_NOT_OPEN
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( FS_OpenFileSys( ), FS_PushDir( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_CloseFileSys( fsh )
+FSYS_HAND fsh ;
+{
+ if ( fsh != NULL ) {
+
+ /* Release any unreleased resources in the name queue */
+ FS_FreeOSPathOrNameQueueInHand( fsh );
+
+ if ( fsh->attached_dle != NULL ) {
+ FS_DetachDLE( fsh ) ;
+ }
+
+ free( fsh->cur_dir ) ;
+ free( fsh->stream_ptr ) ;
+ free( fsh ) ;
+
+ return ( SUCCESS ) ;
+ } else {
+
+ return ( FS_NOT_OPEN );
+
+ }
+}
+
+UINT16 FS_GetStringTypes( FSYS_HAND fsh )
+{
+ return BEC_GetStringTypes( fsh->cfg ) ;
+}
diff --git a/private/utils/ntbackup/src/otc40msc.c b/private/utils/ntbackup/src/otc40msc.c
new file mode 100644
index 000000000..ae0afe1d6
--- /dev/null
+++ b/private/utils/ntbackup/src/otc40msc.c
@@ -0,0 +1,1192 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: otc40msc.c
+
+ Description: Contains misc code for processing On Tape Catalogs.
+
+
+ $Log: T:/LOGFILES/OTC40MSC.C_V $
+
+ Rev 1.28.2.0 11 Jan 1995 21:04:54 GREGG
+Calculate OTC addrs from fmk instead of always asking (fixes Wangtek bug).
+
+ Rev 1.28 17 Dec 1993 16:40:18 GREGG
+Extended error reporting.
+
+ Rev 1.27 15 Oct 1993 18:12:04 GREGG
+Call GetPosition to get addr of the 2nd ESET in case we need it for an EOTM.
+
+ Rev 1.26 14 Oct 1993 18:17:16 GREGG
+Call home grown mktemp.
+
+ Rev 1.25 15 Sep 1993 21:37:28 GREGG
+Use mktemp to generate the temp OTC file names to gaurentee unique names.
+
+ Rev 1.24 09 Jun 1993 03:48:46 GREGG
+Consider pad in calculating how far to back up in FDD if EOM encountered.
+
+ Rev 1.23 07 Jun 1993 23:59:58 GREGG
+Fix for bug in the way we were handling EOM and continuation OTC entries.
+Files modified for fix: mtf10wt.c, otc40wt.c, otc40msc.c f40proto.h mayn40.h
+
+ Rev 1.22 17 May 1993 19:30:34 GREGG
+In GetPrevSM, we now do a TpSpace to get to the ESET or EOTM instead of
+calculating an address and doing a seek. (safer and faster)
+
+ Rev 1.21 27 Apr 1993 03:09:40 GREGG
+Allign pad stream after Set Map on 4 byte boundary, and pad to max of
+logical or physical block boundary.
+
+ Rev 1.20 22 Apr 1993 03:31:34 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.19 19 Apr 1993 18:00:28 GREGG
+Second in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ Changes to write version 2 of OTC, and to read both versions.
+
+Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ mayn40.h 1.32, mtf.h 1.3.
+
+NOTE: There are additional changes to the catalogs needed to save the OTC
+ version and put it in the tpos structure before loading the OTC
+ File/Directory Detail. These changes are NOT listed above!
+
+ Rev 1.18 17 Mar 1993 16:20:30 GREGG
+Changed GetPrevSM to report BAD_SET_MAP if data detected past last filemark.
+
+ Rev 1.17 18 Feb 1993 09:02:16 DON
+Cleaned up compiler warnings
+
+ Rev 1.16 05 Feb 1993 12:26:22 GREGG
+Make sure we get a GEN_ERR_NO_DATA read at EOD or some drivers won't write.
+
+ Rev 1.15 30 Jan 1993 11:44:06 DON
+Removed compiler warnings
+
+ Rev 1.14 26 Jan 1993 01:30:26 GREGG
+Added Fast Append functionality.
+
+ Rev 1.13 21 Jan 1993 15:46:26 GREGG
+Added parameter to calls to TpSeek and TpGetPosition.
+
+ Rev 1.12 14 Dec 1992 12:28:24 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.11 24 Nov 1992 18:16:04 GREGG
+Updates to match MTF document.
+
+ Rev 1.10 17 Nov 1992 14:14:32 GREGG
+Fixed catalog write code to deal with new stream stuff.
+
+ Rev 1.9 11 Nov 1992 22:33:34 GREGG
+Unicodeized literals.
+
+ Rev 1.8 09 Nov 1992 11:00:40 GREGG
+Merged in changes for new method of accessing OTC.
+
+ Rev 1.7 22 Oct 1992 10:43:20 HUNTER
+Changes for Stream Headers
+
+ Rev 1.6 28 Sep 1992 11:02:42 GREGG
+Set using_sm and have_sm to false when reporting TF_NEED_NEW_TAPE.
+
+ Rev 1.5 22 Sep 1992 18:46:02 GREGG
+Removed asserts on error from unlink (error returned if file doesn't exist).
+
+ Rev 1.4 22 Sep 1992 08:57:12 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.3 31 Aug 1992 19:10:28 GREGG
+Added fflush calls to insure all data gets to disk and fclose doesn't fail.
+
+ Rev 1.2 17 Aug 1992 08:40:10 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.1 12 Aug 1992 14:55:00 GREGG
+Fixed bugs in OTC_WriteStream and OTC_MoveToVCB.
+
+ Rev 1.0 30 Jul 1992 16:24:38 GREGG
+Initial revision.
+
+**/
+
+#include <stdio.h>
+#include <io.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <fcntl.h>
+
+#include "stdtypes.h"
+#include "channel.h"
+#include "mayn40.h"
+#include "f40proto.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+#include "minmax.h"
+#include "transutl.h"
+#include "fsstream.h"
+#include "msmktemp.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "dddefs.h"
+
+/* Local Function Prototypes */
+static INT16 _near OTC_SMtoFile( CHANNEL_PTR channel, BUF_PTR tmpBUF ) ;
+static INT16 _near OTC_ReadStream( CHANNEL_PTR channel, BUF_PTR tmpBUF,
+ FILE * fptr ) ;
+static INT16 _near OTC_WriteFDD( CHANNEL_PTR channel, BUF_PTR tmpBUF,
+ unsigned int rdwr_size ) ;
+static INT16 _near OTC_WriteSM( CHANNEL_PTR channel, BUF_PTR tmpBUF,
+ unsigned int rdwr_size ) ;
+static INT16 _near OTC_WriteStream( CHANNEL_PTR channel, BUF_PTR tmpBUF,
+ unsigned int rdwr_size, FILE * fptr,
+ UINT32 type, UINT32 length,
+ BOOLEAN pad_to_boundary,
+ BOOLEAN_PTR completed,
+ BOOLEAN continuation ) ;
+static INT16 _near OTC_WriteSMPadStream( CHANNEL_PTR channel,
+ BUF_PTR tmpBUF ) ;
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_OpenSM
+
+ Description: Opens the temporary SM header file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_OpenSM(
+ F40_ENV_PTR cur_env,
+ BOOLEAN appending,
+ BOOLEAN_PTR sm_exists )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* Gen file name */
+ if( cur_env->sm_fname[0] == TEXT('\0') ) {
+ strcpy( lw_cat_file_path_end, TEXT("SMXXXXXX") ) ;
+ if( msmktemp( lw_cat_file_path ) == NULL ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ strcat( lw_cat_file_path, TEXT(".SM") ) ;
+ strcpy( cur_env->sm_fname, lw_cat_file_path_end ) ;
+ } else {
+ strcpy( lw_cat_file_path_end, cur_env->sm_fname ) ;
+ }
+
+ if( !appending ) {
+ if( ( cur_env->otc_sm_fptr = UNI_fopen( lw_cat_file_path, 0 ) ) == NULL ) {
+ ret_val = TFLE_OTC_FAILURE ;
+ }
+
+ } else {
+ if( access( lw_cat_file_path, 0 ) == -1 ) {
+ if( ( cur_env->otc_sm_fptr = UNI_fopen( lw_cat_file_path, 0 ) ) == NULL ) {
+ ret_val = TFLE_OTC_FAILURE ;
+ }
+ *sm_exists = FALSE ;
+ } else {
+ if( ( cur_env->otc_sm_fptr = UNI_fopen( lw_cat_file_path, _O_APPEND ) ) == NULL ) {
+ ret_val = TFLE_OTC_FAILURE ;
+ }
+
+// fseek( cur_env->otc_sm_fptr, 0L, SEEK_SET ) ;
+ *sm_exists = TRUE ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_OpenFDD
+
+ Description: Opens the temporary FDD file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_OpenFDD(
+ F40_ENV_PTR cur_env )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* Gen file name */
+ if( cur_env->fdd_fname[0] == TEXT('\0') ) {
+ strcpy( lw_cat_file_path_end, TEXT("FDXXXXXX") ) ;
+ if( msmktemp( lw_cat_file_path ) == NULL ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ strcat( lw_cat_file_path, TEXT(".FDD") ) ;
+ strcpy( cur_env->fdd_fname, lw_cat_file_path_end ) ;
+ } else {
+ strcpy( lw_cat_file_path_end, cur_env->fdd_fname ) ;
+ }
+
+ if( ( cur_env->otc_fdd_fptr = UNI_fopen( lw_cat_file_path, 0 ) ) == NULL ) {
+ ret_val = TFLE_OTC_FAILURE ;
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_Close
+
+ Description: Closes the OTC temporary files indicated, and deletes
+ them if indicated.
+
+ Returns: Nothing
+
+ Notes: Defined values for the first parameter are:
+
+ OTC_CLOSE_SM
+ OTC_CLOSE_FDD
+ OTC_CLOSE_ALL
+
+**/
+VOID OTC_Close(
+ F40_ENV_PTR cur_env,
+ UINT16 otc_files,
+ BOOLEAN delete_after )
+{
+ int ret ;
+
+ if( otc_files != OTC_CLOSE_FDD ) {
+ /* close the SM file if open and delete it if indicated */
+ if( cur_env->otc_sm_fptr != NULL ) {
+ fflush( cur_env->otc_sm_fptr ) ;
+ ret = fclose( cur_env->otc_sm_fptr ) ;
+ msassert( ret == 0 ) ;
+ cur_env->otc_sm_fptr = NULL ;
+ }
+ if( delete_after ) {
+ if( cur_env->sm_fname[0] != TEXT('\0') ) {
+ strcpy( lw_cat_file_path_end, cur_env->sm_fname ) ;
+ remove( lw_cat_file_path ) ;
+ cur_env->sm_fname[0] = TEXT('\0') ;
+ }
+ }
+ }
+
+ if( otc_files != OTC_CLOSE_SM ) {
+ /* close the FDD file if open and delete it if indicated */
+ if( cur_env->otc_fdd_fptr != NULL ) {
+ fflush( cur_env->otc_fdd_fptr ) ;
+ ret = fclose( cur_env->otc_fdd_fptr ) ;
+ msassert( ret == 0 ) ;
+ cur_env->otc_fdd_fptr = NULL ;
+ }
+ if( delete_after ) {
+ if( cur_env->fdd_fname[0] != TEXT('\0') ) {
+ strcpy( lw_cat_file_path_end, cur_env->fdd_fname ) ;
+ remove( lw_cat_file_path ) ;
+ cur_env->fdd_fname[0] = TEXT('\0') ;
+ }
+ }
+
+ /* If the EOM FDD processing file is around, close and delete it */
+ if( cur_env->otc_eom_fptr != NULL ) {
+ fflush( cur_env->otc_eom_fptr ) ;
+ ret = fclose( cur_env->otc_eom_fptr ) ;
+ msassert( ret == 0 ) ;
+ cur_env->otc_eom_fptr = NULL ;
+ strcpy( lw_cat_file_path_end, cur_env->eom_fname ) ;
+ remove( lw_cat_file_path ) ;
+ }
+ }
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GetPrevSM
+
+ Description: This function retrieves the Set Map from the last set
+ fully written to the current tape. It is called before
+ an append operation so that the Set Map may be updated
+ and written after the appended set. It is also called
+ by F40_LoadSM to set the Set Map up for subsequent calls
+ to F40_GetNextSMEntry. It also gets the last set number
+ from the ESET. We need this if we are going to do an
+ append operation.
+
+ If the boolean 'expect_sm' is FALSE, it is assumed that
+ there is no Set Map and all we do is get the previous
+ set number.
+
+ If the boolean 'get_best' is TRUE, it means we are
+ looking for the end of the tape FAMILY (to get the best
+ Set Map possible or to start an append operation), so
+ if we see an EOTM we return TF_NEED_NEW_TAPE indicating
+ the family continues onto another tape.
+
+ Returns: INT16 - TFLE_xxx, TF_NO_SM_ON_TAPE or TF_NEED_NEW_TAPE
+
+ Notes: It is assumed that we are at EOD when this function is
+ called.
+
+ If 'get_best' is FALSE and there is no set which ends on
+ the current tape then there is obviously no Set Map on
+ the tape and we return TF_NO_SM_ON_TAPE. This is not an
+ error, only an indication that since we can't get the
+ next tape in the family we cannot provide ANY set map
+ information for the tape family.
+
+**/
+INT16 OTC_GetPrevSM(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN get_best,
+ BOOLEAN expect_sm )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ MTF_ESET_PTR cur_eset = (MTF_ESET_PTR)BM_XferBase( buffer ) ;
+ MTF_DB_HDR_PTR cur_hdr = (MTF_DB_HDR_PTR)BM_XferBase( buffer ) ;
+ MTF_EOTM_PTR cur_eotm = (MTF_EOTM_PTR)BM_XferBase( buffer ) ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ INT16 ret_val ;
+ RET_BUF myret ;
+ UINT32 addr ;
+ INT16 num_blks ;
+
+ msassert( buffer != NULL ) ;
+
+ /* Move to previous ESET */
+
+ DRIVER_CALL( drv_hdl, TpReadEndSet( drv_hdl, (INT16)1, (INT16)BACKWARD ), myret,
+ GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+ if( ChannelBlkSize( channel ) < channel->lb_size ) {
+ num_blks = channel->lb_size / ChannelBlkSize( channel ) ;
+ } else {
+ num_blks = 1 ;
+ }
+
+ DRIVER_CALL( drv_hdl, TpSpace( drv_hdl, num_blks, SPACE_BKWD_BLK ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+
+ DRIVER_CALL( drv_hdl, TpGetPosition( drv_hdl, FALSE ), myret,
+ GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+ addr = myret.misc ;
+
+ DRIVER_CALL( drv_hdl, TpRead( drv_hdl, BM_XferBase( buffer ), (UINT32)BM_XferSize( buffer ) ),
+ myret, GEN_NO_ERR, GEN_ERR_ENDSET, (VOID)0 )
+
+ BM_SetBytesFree( buffer, (UINT16)myret.len_got ) ;
+ BM_SetReadError( buffer, myret.gen_error ) ;
+
+ /* If we read an EOTM, and get_best is TRUE, or expect_sm is FALSE,
+ tell them we need the next tape, otherwise we use the EOTM to get
+ to the last ESET on tape.
+ */
+ if( F40_GetBlkType( cur_hdr ) == BT_CVCB ) {
+ cur_env->sm_at_eom = TRUE ;
+ if( get_best || !expect_sm ) {
+ return( TF_NEED_NEW_TAPE ) ;
+ }
+ if( cur_hdr->block_attribs & MTF_DB_NO_ESET_PBA ) {
+ return( TF_NO_SM_ON_TAPE ) ;
+ }
+ addr = U64_Lsw( cur_eotm->eset_phys_blk_adr ) ;
+ DRIVER_CALL( drv_hdl, TpSeek( drv_hdl, addr, FALSE ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+
+ BM_SetNextByteOffset( buffer, 0 ) ;
+ DRIVER_CALL( drv_hdl, TpRead( drv_hdl, BM_XferBase( buffer ), (UINT32)BM_XferSize( buffer ) ),
+ myret, GEN_NO_ERR, GEN_ERR_ENDSET, (VOID)0 )
+
+ BM_SetBytesFree( buffer, (UINT16)myret.len_got ) ;
+ BM_SetReadError( buffer, myret.gen_error ) ;
+ } else {
+ cur_env->sm_at_eom = FALSE ;
+
+ /* Save the PBA in the environment (for EOM processing) */
+ cur_env->eset_pba = addr ;
+ }
+
+ if( F40_GetBlkType( cur_hdr ) != BT_BSDB ) {
+ return( TFLE_TAPE_INCONSISTENCY ) ;
+ }
+
+ /* So we put the correct set number on tape. */
+ if( ( ( channel->mode & ~0x8000 ) == TF_WRITE_OPERATION ) ||
+ ( ( channel->mode & ~0x8000 ) == TF_WRITE_APPEND ) ) {
+
+ channel->bs_num = cur_eset->backup_set_number + 1 ;
+ }
+
+ if( !expect_sm ) {
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* Get SM starting address from ESET */
+ if( cur_hdr->block_attribs & MTF_DB_END_OF_FAMILY_BIT ) {
+ return( TFLE_BAD_SET_MAP ) ;
+ } else {
+ addr = U64_Lsw( cur_eset->set_map_phys_blk_adr ) ;
+ }
+
+ /* Position to start of SM */
+ DRIVER_CALL( drv_hdl, TpSeek( drv_hdl, addr, FALSE ), myret, GEN_NO_ERR,
+ GEN_NO_ERR, (VOID)0 )
+
+ /* Write SM to file */
+ ret_val = OTC_SMtoFile( channel, buffer ) ;
+
+ if( ret_val == TFLE_NO_ERR && !cur_env->sm_at_eom ) {
+ /* We need to do a "no data" read for the drives sake!!! */
+ myret.gen_error = GEN_NO_ERR ;
+ while( ret_val == TFLE_NO_ERR && myret.gen_error != GEN_ERR_NO_DATA ) {
+ if( TpRead( drv_hdl, BM_XferBase( buffer ),
+ (UINT32)BM_XferSize( buffer ) ) != SUCCESS ) {
+
+ ret_val = TFLE_DRIVER_FAILURE ;
+ } else {
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ ThreadSwitch( ) ;
+ }
+ if( myret.gen_error == GEN_NO_ERR ||
+ ( myret.gen_error == GEN_ERR_NO_DATA &&
+ myret.len_got != 0 ) ) {
+
+ ret_val = TFLE_BAD_SET_MAP ;
+ } else if( myret.gen_error == GEN_ERR_NO_MEDIA ) {
+ ret_val = TFLE_NO_TAPE ;
+ } else if( myret.gen_error != GEN_ERR_ENDSET &&
+ myret.gen_error != GEN_ERR_NO_DATA ) {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+ }
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_SMtoFile
+
+ Description: Called by OTC_GetPrevSM to transfer the Set Map on tape
+ to the temporary SM file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: Assumes tape is positioned at start of SM.
+
+**/
+static INT16 _near OTC_SMtoFile(
+ CHANNEL_PTR channel,
+ BUF_PTR tmpBUF )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ INT16 ret_val ;
+
+ if( ( ret_val = OTC_ReadStream( channel, tmpBUF, cur_env->otc_sm_fptr ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ if( IsPosBitSet( channel->cur_drv, AT_EOM ) ) {
+ /* We should never be reading a set map which did not finish
+ before hitting EOM.
+ */
+ msassert( FALSE ) ;
+ return( TFLE_TAPE_INCONSISTENCY ) ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_FDDtoFile
+
+ Description: This function seeks to the fdd_pba as set in the
+ environment, reads in the FDD, and writes it to the
+ FDD temporary file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_FDDtoFile(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+ INT16 ret_val ;
+ UINT32 skip ;
+ long cur_pos ;
+ long new_pos ;
+ MTF_FDD_HDR fdd_hdr ;
+
+ /* Position to start of FDD */
+ if( cur_env->fdd_continuing ) {
+ cur_env->fdd_continuing = FALSE ;
+ skip = (UINT32)( sizeof( MTF_ESET ) +
+ PadToBoundary( sizeof( MTF_ESET ),
+ ChannelBlkSize( channel ) ) ) ;
+ DRIVER_CALL( drv_hdl, TpRead( drv_hdl, BM_XferBase( channel->cur_buff ), skip ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+ } else {
+ cur_env->otc_ver = channel->ui_tpos->tape_cat_ver ;
+
+ DRIVER_CALL( drv_hdl, TpSeek( drv_hdl, channel->ui_tpos->set_cat_pba, FALSE ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+ }
+
+ if( ( ret_val = OTC_ReadStream( channel, channel->cur_buff, fptr ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+
+ if( IsPosBitSet( channel->cur_drv, AT_EOM ) ) {
+
+ /* If this is rev 1 of otc, the continuation of the FDD stream
+ starts after the last entry which was fully written to this
+ tape, so we need to adjust the file pointer to point to this
+ position before we write the portion of the FDD on the
+ continuation tape.
+
+ If this is rev 2, the FDD stream will pick up where it left off.
+ */
+ if( cur_env->otc_ver == 1 ) {
+ cur_pos = ftell( fptr ) ;
+ new_pos = 0L ;
+ fdd_hdr.length = 0L ;
+ while( new_pos + fdd_hdr.length <= cur_pos ) {
+ new_pos += fdd_hdr.length ;
+ if( fseek( fptr, new_pos, SEEK_SET ) != 0 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( cur_pos - new_pos >= sizeof( MTF_FDD_HDR ) ) {
+ if( fread( (void *)&fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ } else {
+ break ;
+ }
+ }
+ fseek( fptr, new_pos, SEEK_SET ) ;
+ }
+ cur_env->fdd_continuing = TRUE ;
+ } else {
+ fseek( fptr, 0L, SEEK_SET ) ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_ReadStream
+
+ Description:
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+static INT16 _near OTC_ReadStream(
+ CHANNEL_PTR channel,
+ BUF_PTR tmpBUF,
+ FILE * fptr )
+{
+ unsigned int rdwr_size ;
+ UINT32 size ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+
+ if( ( rdwr_size = UINT_MAX - UINT_MAX % ChannelBlkSize( channel ) ) == UINT_MAX ) {
+ rdwr_size -= ChannelBlkSize( channel ) ;
+ }
+ rdwr_size = MIN( rdwr_size, BM_XferSize( tmpBUF ) ) ;
+
+ /* Read in the first buffer which contains the stream header */
+ BM_SetNextByteOffset( tmpBUF, 0 ) ;
+ DRIVER_CALL( drv_hdl, TpRead( drv_hdl, BM_XferBase( tmpBUF ), (UINT32)rdwr_size ),
+ myret, GEN_NO_ERR, GEN_ERR_ENDSET, (VOID)0 )
+ BM_SetBytesFree( tmpBUF, (UINT16)myret.len_got ) ;
+ BM_SetReadError( tmpBUF, myret.gen_error ) ;
+
+ /* get the size of the stream */
+ size = U64_Lsw( ((MTF_STREAM_PTR)BM_XferBase( tmpBUF ))->data_length ) ;
+ BM_UpdCnts( tmpBUF, sizeof( MTF_STREAM ) ) ;
+
+ while( size > BM_BytesFree( tmpBUF ) ) {
+ size -= BM_BytesFree( tmpBUF ) ;
+ if( fwrite( BM_NextBytePtr( tmpBUF ), 1, (size_t)BM_BytesFree( tmpBUF ), fptr )
+ != (size_t)BM_BytesFree( tmpBUF ) ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ if( BM_ReadError( tmpBUF ) == GEN_ERR_ENDSET ) {
+ SetPosBit( channel->cur_drv, ( AT_EOM | TAPE_FULL ) ) ;
+ return( TFLE_NO_ERR ) ;
+ }
+ BM_SetNextByteOffset( tmpBUF, 0 ) ;
+ DRIVER_CALL( drv_hdl, TpRead( drv_hdl, BM_XferBase( tmpBUF ), (UINT32)rdwr_size ),
+ myret, GEN_NO_ERR, GEN_ERR_ENDSET, (VOID)0 )
+ BM_SetBytesFree( tmpBUF, (UINT16)myret.len_got ) ;
+ BM_SetReadError( tmpBUF, myret.gen_error ) ;
+ }
+ if( fwrite( BM_NextBytePtr( tmpBUF ), 1, (size_t)size, fptr )
+ != (size_t)size ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( fflush( fptr ) != 0 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ /* if we haven't crossed over the ending file mark, do so now, and set
+ the drive position accordingly.
+ */
+ if( BM_ReadError( tmpBUF ) != GEN_ERR_ENDSET ) {
+ DRIVER_CALL( drv_hdl, TpReadEndSet( drv_hdl, (INT16)1, (INT16)FORWARD ),
+ myret, GEN_NO_ERR, GEN_NO_ERR, (VOID)0 )
+ }
+ ClrPosBit( channel->cur_drv, ( AT_EOD | AT_EOM | AT_MOS ) ) ;
+ SetPosBit( channel->cur_drv, AT_EOS ) ;
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_WriteCat
+
+ Description: This function transfers the OTC temporary files to tape.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_WriteCat(
+ CHANNEL_PTR channel,
+ MTF_ESET_PTR cur_eset )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ BUF_PTR tmpBUF ;
+ INT16 ret_val ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+ unsigned int rdwr_size ;
+
+ /* get buffer and calc transfer size to work on file read as
+ well as tape write.
+ */
+ tmpBUF = BM_Get( &channel->buffer_list ) ;
+ if( ( rdwr_size = UINT_MAX - UINT_MAX % ChannelBlkSize( channel ) ) == UINT_MAX ) {
+ rdwr_size -= ChannelBlkSize( channel ) ;
+ }
+ rdwr_size = MIN( rdwr_size, BM_XferSize( tmpBUF ) ) ;
+
+ /* if we're writing FDD ... */
+ if( cur_env->cur_otc_level == TCL_FULL && !cur_env->fdd_aborted &&
+ !cur_env->fdd_completed ) {
+
+ /* Set the PBA and sequence number of the FDD in the ESET */
+ if( !cur_env->fdd_continuing ) {
+ cur_env->fdd_pba = cur_env->eset_base_addr ;
+ cur_eset->fdd_phys_blk_adr = U64_Init( cur_env->eset_base_addr, 0L ) ;
+ cur_env->fdd_seq_num = channel->ts_num ;
+ cur_eset->fdd_tape_seq_number = channel->ts_num ;
+ } else {
+ cur_eset->fdd_phys_blk_adr = U64_Init( cur_env->fdd_pba, 0L ) ;
+ cur_eset->fdd_tape_seq_number = cur_env->fdd_seq_num ;
+ }
+
+ /* Write FDD to tape */
+ if( ( ret_val = OTC_WriteFDD( channel, tmpBUF, rdwr_size ) ) != TFLE_NO_ERR ) {
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+
+ if( IsPosBitSet( channel->cur_drv, ( AT_EOM ) ) ) {
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+ }
+
+ /* Update OTC SM entry */
+ if( !cur_env->sm_aborted && !cur_env->sm_continuing ) {
+ if( ( ret_val = OTC_UpdateSMEntry( (F40_ENV_PTR)channel->fmt_env ) )
+ != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+ }
+ }
+
+ if( !cur_env->sm_aborted ) {
+ /* Set the PBA of the SM in the ESET. Note that if we hit EOM we
+ won't write the ESET and we will rewrite the whole SM on the
+ continuation tape, so we do this no matter what.
+ */
+ cur_eset->set_map_phys_blk_adr = U64_Init( cur_env->eset_base_addr, 0L ) ;
+
+ BM_SetNextByteOffset( tmpBUF, 0U ) ;
+ ret_val = OTC_WriteSM( channel, tmpBUF, rdwr_size ) ;
+ }
+
+ BM_Put( tmpBUF ) ;
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_WriteFDD
+
+ Description: This function is called by OTC_WriteCat to transfer the
+ FDD data to tape.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+static INT16 _near OTC_WriteFDD(
+ CHANNEL_PTR channel,
+ BUF_PTR tmpBUF,
+ unsigned int rdwr_size )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ BOOLEAN completed ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ UINT32 len ;
+ long hdr_size = sizeof( MTF_FDD_HDR ) ;
+ UINT32 bsize = ChannelBlkSize( channel ) ;
+
+ len = filelength( _fileno( fptr ) ) + sizeof( MTF_STREAM ) ;
+
+ /* rewind the file */
+ if( !cur_env->fdd_continuing ) {
+ if( fseek( fptr, 0L, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ } else {
+ len -= ftell( fptr ) ;
+ }
+
+ len = ( ( len + bsize - 1L ) / bsize ) * bsize ;
+ cur_env->eset_base_addr += len / bsize ;
+ len -= sizeof( MTF_STREAM ) ;
+
+ ret_val = OTC_WriteStream( channel, tmpBUF, rdwr_size, fptr,
+ STRM_OTC_FDD, len, TRUE, &completed,
+ cur_env->fdd_continuing ) ;
+
+ cur_env->fdd_continuing = FALSE ;
+
+ if( ret_val != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ if( ret_val == TFLE_OTC_FAILURE ) {
+ ret_val = TFLE_NO_ERR ;
+ }
+
+ } else if( IsPosBitSet( channel->cur_drv, AT_EOM ) && !completed ) {
+ cur_env->fdd_continuing = TRUE ;
+
+ } else {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_completed = TRUE ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_WriteSM
+
+ Description: This function is called by OTC_WriteCat to transfer the
+ SM data to tape.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: We don't close the SM file here because we may still
+ hit EOM and have to rewrite the SM on the next tape.
+
+**/
+static INT16 _near OTC_WriteSM(
+ CHANNEL_PTR channel,
+ BUF_PTR tmpBUF,
+ unsigned int rdwr_size )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ MTF_SM_HDR sm_hdr ;
+ FILE * fptr = cur_env->otc_sm_fptr ;
+ INT16 ret_val ;
+ BOOLEAN completed ;
+ UINT32 len ;
+
+ if( !cur_env->sm_adjusted ) {
+ /* read SM header, update it and write it back out */
+ fseek( fptr, 0L, SEEK_SET ) ;
+ if( fread( &sm_hdr, sizeof( MTF_SM_HDR ), 1, fptr ) != 1 ) {
+ /* Abort Set Map */
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ sm_hdr.num_set_recs += cur_env->sm_count ;
+ fseek( fptr, 0L, SEEK_SET ) ;
+ if( fwrite( &sm_hdr, sizeof( MTF_SM_HDR ), 1, fptr ) != 1 ) {
+ /* Abort Set Map */
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ cur_env->sm_adjusted = TRUE ;
+ }
+
+ /* rewind the file */
+ if( fseek( fptr, 0L, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ len = filelength( _fileno( fptr ) ) ;
+ cur_env->eset_base_addr += ( len + sizeof( MTF_STREAM ) ) /
+ ChannelBlkSize( channel ) ;
+ ret_val = OTC_WriteStream( channel, tmpBUF, rdwr_size, fptr,
+ STRM_OTC_SM, len, FALSE, &completed, FALSE ) ;
+
+ if( ret_val != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ if( ret_val == TFLE_OTC_FAILURE ) {
+ ret_val = TFLE_NO_ERR ;
+ }
+ } else if( IsPosBitSet( channel->cur_drv, AT_EOM ) ) {
+ cur_env->sm_continuing = TRUE ;
+ } else {
+ if( ( ret_val = OTC_WriteSMPadStream( channel, tmpBUF ) ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ if( ret_val == TFLE_OTC_FAILURE ) {
+ ret_val = TFLE_NO_ERR ;
+ }
+ } else if( IsPosBitSet( channel->cur_drv, AT_EOM ) ) {
+ cur_env->sm_continuing = TRUE ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_WriteStream
+
+ Description: This function is called by OTC_WriteFDD and OTC_WriteSM
+ to write the stream header and data to tape.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+static INT16 _near OTC_WriteStream(
+ CHANNEL_PTR channel,
+ BUF_PTR tmpBUF,
+ unsigned int rdwr_size,
+ FILE * fptr,
+ UINT32 type,
+ UINT32 length,
+ BOOLEAN pad_to_boundary,
+ BOOLEAN_PTR completed,
+ BOOLEAN continuation )
+{
+ RET_BUF myret ;
+ unsigned int size ;
+ MTF_STREAM_PTR str_hdr ;
+ BOOLEAN first_time = TRUE ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ BOOLEAN file_error = FALSE ;
+ UINT32 pad ;
+ long offset ;
+
+ memset( (void *)BM_XferBase( tmpBUF ), 0, (size_t)BM_XferSize( tmpBUF ) ) ;
+ *completed = TRUE ;
+
+ /* Write the stream header */
+ str_hdr = ( MTF_STREAM_PTR ) BM_XferBase( tmpBUF ) ;
+
+ str_hdr->id = type ;
+ str_hdr->fs_attribs = 0L ;
+ str_hdr->tf_attribs = 0L ;
+ str_hdr->encr_algor = 0 ;
+ str_hdr->comp_algor = 0 ;
+ str_hdr->data_length = U64_Init( length, 0L ) ;
+
+ if( continuation ) {
+ str_hdr->tf_attribs |= STREAM_CONTINUE ;
+ }
+
+ str_hdr->chksum = CalcChecksum( (UINT16_PTR)str_hdr, F40_STREAM_CHKSUM_LEN ) ;
+
+ BM_SetNextByteOffset( tmpBUF, sizeof( MTF_STREAM ) ) ;
+
+ /* loop writing file to tape until done, error or EOM */
+ do {
+ /* On the first pass, the stream header is already in the buffer. */
+ if( first_time ) {
+ first_time = FALSE ;
+ size = rdwr_size - sizeof( MTF_STREAM ) ;
+ size = fread( (void *)BM_NextBytePtr( tmpBUF ), 1, size, fptr ) ;
+ if( ferror( fptr ) != 0 ) {
+ file_error = TRUE ;
+ size = (unsigned int)( MIN( length, ( rdwr_size - sizeof( MTF_STREAM ) ) ) ) ;
+ }
+ length -= size ;
+ size += sizeof( MTF_STREAM ) ;
+ } else {
+ if( !file_error ) {
+ size = fread( (void *)BM_XferBase( tmpBUF ), 1, rdwr_size, fptr ) ;
+ if( ferror( fptr ) != 0 ) {
+ file_error = TRUE ;
+ size = (unsigned int)( MIN( length, rdwr_size ) ) ;
+ }
+ } else {
+ size = (unsigned int)( MIN( length, rdwr_size ) ) ;
+ }
+ length -= size ;
+ }
+
+ /* if we are done, set size to include pad out to block boundry. */
+ if( !file_error && feof( fptr ) ) {
+ if( pad_to_boundary ) {
+ msassert( length == ( rdwr_size - size ) % ChannelBlkSize( channel ) ) ;
+ pad = length ;
+ size += length ;
+ length = 0 ;
+
+ } else {
+ msassert( length == 0 ) ;
+ BM_SetNextByteOffset( tmpBUF, size ) ;
+ BM_SetBytesFree( tmpBUF, rdwr_size - size ) ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), size ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM, (VOID)0 )
+
+ memset( (void *)BM_XferBase( tmpBUF ), 0, size ) ;
+
+ if( myret.gen_error == GEN_ERR_EOM ) {
+ SetPosBit( channel->cur_drv, ( AT_EOM | TAPE_FULL ) ) ;
+ if( myret.len_got != myret.len_req || !feof( fptr ) ) {
+ *completed = FALSE ;
+ }
+ if( type == STRM_OTC_FDD && myret.len_got != myret.len_req ) {
+
+ /* seek back in file the amount not written */
+ offset = (long)( myret.len_req - myret.len_got ) ;
+ offset -= pad ;
+ if( fseek( fptr, - offset, SEEK_CUR ) != 0 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ return( TFLE_NO_ERR ) ;
+ }
+ } while( length != 0 ) ;
+
+ return( file_error ? TFLE_OTC_FAILURE : TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name:
+
+ Description:
+
+ Returns:
+
+ Notes: We need to make sure we are on a 1024 boundary to avoid
+ a bug with the Wangtek 525 drives reporting the PBA
+ wrong when in 512 mode.
+
+**/
+static INT16 _near OTC_WriteSMPadStream(
+ CHANNEL_PTR channel,
+ BUF_PTR tmpBUF )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ UINT32 bsize = ChannelBlkSize( channel ) ;
+ RET_BUF myret ;
+ unsigned int size = 0 ;
+ unsigned int part ;
+ MTF_STREAM str_hdr ;
+ UINT8_PTR p ;
+
+ /* Pad to align stream on four byte boundary (format spec). */
+ BM_UpdCnts( tmpBUF, (UINT16)PadToBoundary( BM_NextByteOffset( tmpBUF ), 4 ) ) ;
+
+ if( BM_BytesFree( tmpBUF ) % bsize != 0 ) {
+
+ cur_env->eset_base_addr++ ;
+ size = (unsigned int)( BM_BytesFree( tmpBUF ) % bsize ) ;
+ /* If we're not on a 1024, get there. */
+ if( bsize == 512 && cur_env->eset_base_addr % 2 != 0 ) {
+ size += 512 ;
+ cur_env->eset_base_addr++ ;
+ }
+ /* If the pad is smaller than the header, pad anoth chunk. */
+ if( size < sizeof( MTF_STREAM ) ) {
+ size += MAX( bsize, 1024 ) ;
+ cur_env->eset_base_addr += size / bsize ;
+ }
+ size -= sizeof( MTF_STREAM ) ;
+ } else {
+ /* If we're not on a 1024, get there. */
+ if( bsize == 512 && cur_env->eset_base_addr % 2 != 0 ) {
+ size = 512 - sizeof( MTF_STREAM ) ;
+ cur_env->eset_base_addr++ ;
+ }
+ }
+
+ if( size != 0 ) {
+ str_hdr.id = STRM_PAD ;
+ str_hdr.fs_attribs = 0L ;
+ str_hdr.tf_attribs = 0L ;
+ str_hdr.encr_algor = 0 ;
+ str_hdr.comp_algor = 0 ;
+ str_hdr.data_length = U64_Init( size, 0L ) ;
+ str_hdr.chksum = CalcChecksum( (UINT16_PTR)&str_hdr, F40_STREAM_CHKSUM_LEN ) ;
+ size += sizeof( MTF_STREAM ) ;
+
+ if( ( part = BM_BytesFree( tmpBUF ) ) < sizeof( MTF_STREAM ) ) {
+ if( part != 0 ) {
+ memcpy( BM_NextBytePtr( tmpBUF ), &str_hdr, part ) ;
+ BM_UpdCnts( tmpBUF, (UINT16)part ) ;
+ }
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), BM_NextByteOffset( tmpBUF ) ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM, (VOID)0 )
+
+ if( myret.gen_error == GEN_ERR_EOM ) {
+ SetPosBit( channel->cur_drv, ( AT_EOM | TAPE_FULL ) ) ;
+ return( TFLE_NO_ERR ) ;
+ }
+ p = (UINT8_PTR)(void *)( &str_hdr ) ;
+ p += part ;
+ size -= part ;
+ memset( BM_XferBase( tmpBUF ), 0, (size_t)BM_XferSize( tmpBUF ) ) ;
+ memcpy( BM_XferBase( tmpBUF ), p, sizeof( MTF_STREAM ) - part ) ;
+ } else {
+ memset( BM_NextBytePtr( tmpBUF ), 0, (size_t)BM_BytesFree( tmpBUF ) ) ;
+ memcpy( BM_NextBytePtr( tmpBUF ), &str_hdr, sizeof( MTF_STREAM ) ) ;
+ if( size > BM_BytesFree( tmpBUF ) ) {
+ size -= BM_BytesFree( tmpBUF ) ;
+ BM_UpdCnts( tmpBUF, BM_BytesFree( tmpBUF ) ) ;
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), BM_NextByteOffset( tmpBUF ) ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM, (VOID)0 )
+ memset( BM_XferBase( tmpBUF ), 0, (size_t)size ) ;
+ } else {
+ size += BM_NextByteOffset( tmpBUF ) ;
+ }
+ }
+ } else {
+ size = BM_NextByteOffset( tmpBUF ) ;
+ }
+
+ if( size != 0 ) {
+ DRIVER_CALL( drv_hdl, TpWrite( drv_hdl, BM_XferBase( tmpBUF ), size ),
+ myret, GEN_NO_ERR, GEN_ERR_EOM, (VOID)0 )
+
+ if( myret.gen_error == GEN_ERR_EOM ) {
+ SetPosBit( channel->cur_drv, ( AT_EOM | TAPE_FULL ) ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
diff --git a/private/utils/ntbackup/src/otc40rd.c b/private/utils/ntbackup/src/otc40rd.c
new file mode 100644
index 000000000..4a7af701c
--- /dev/null
+++ b/private/utils/ntbackup/src/otc40rd.c
@@ -0,0 +1,1058 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: otc40rd.c
+
+ Description: Contains the Code for reading On Tape Catalogs.
+
+
+ $Log: T:/LOGFILES/OTC40RD.C_V $
+
+ Rev 1.32.1.2 27 Mar 1994 19:30:22 GREGG
+Don't map password strings to unicode no matter what.
+
+ Rev 1.32.1.1 05 Jan 1994 10:51:52 BARRY
+Changed UINT16 parameters in Unicode mapping functions to INTs
+
+ Rev 1.32.1.0 02 Nov 1993 12:43:02 GREGG
+Added string type conversion of tape name password if THDR type != SSET type.
+
+ Rev 1.32 15 Jul 1993 19:32:04 GREGG
+Set compressed_obj, vendor_id, and compressed, encrypted and future_rev
+bits in appropriate dblks.
+
+ Rev 1.32 13 Jul 1993 19:28:04 GREGG
+Set compressed_set, compressed_obj, encrypted_set, future_rev and vendor_id
+in appropriate dblks.
+
+ Rev 1.31 04 Jun 1993 18:50:42 GREGG
+Fixed bug where we were skipping past the "FEND" entry thinking it was a
+continuation entry (garbage data in the attrib field which is not defined
+for a "FEND" entry).
+
+ Rev 1.30 04 Jun 1993 18:35:50 GREGG
+For OEM_MSOFT (ntbackup) - mark sets with encrypted or compressed data as
+image set so the UI wont try to restore the data. This is a kludge which
+will be fixed correctly when we have more time.
+
+ Rev 1.29 02 Jun 1993 16:59:26 GREGG
+Fixed bug in determining if the OTC is version 1 or 2 in OTC_RdDIR.
+
+ Rev 1.28 20 May 1993 17:33:04 BARRY
+Declare a problematic variable volatile to get around an MSoft NT compiler bug.
+
+ Rev 1.27 26 Apr 1993 11:32:44 GREGG
+Old tape read fix: Was getting OTC ver number from wrong place.
+
+ Rev 1.26 26 Apr 1993 02:43:40 GREGG
+Sixth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Redefined attribute bits to match the spec.
+ - Eliminated unused/undocumented bits.
+ - Added code to translate bits on tapes that were written wrong.
+
+Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+
+ Rev 1.25 25 Apr 1993 18:52:40 GREGG
+Fourth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Parse the device name and volume name out of the FS supplied "volume
+ name", and write it to tape as separate fields.
+ - Generate the "volume name" the FS and UI expect out of the device
+ name and volume name on tape.
+ - Write all strings without NULL terminater, and translate them back
+ to NULL terminated strings on the read side.
+
+Matches: MTF10WDB.C 1.8, F40PROTO.H 1.26, OTC40WT.C 1.24, MAYN40.H 1.33,
+ MAYN40RD.C 1.57, OTC40RD.C 1.25
+
+ Rev 1.24 22 Apr 1993 03:31:26 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.23 19 Apr 1993 18:00:26 GREGG
+Second in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ Changes to write version 2 of OTC, and to read both versions.
+
+Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ mayn40.h 1.32, mtf.h 1.3.
+
+NOTE: There are additional changes to the catalogs needed to save the OTC
+ version and put it in the tpos structure before loading the OTC
+ File/Directory Detail. These changes are NOT listed above!
+
+ Rev 1.22 12 Feb 1993 02:26:48 GREGG
+Fixes to deal with the MIPS machine's dislike for unaligned pointers.
+
+ Rev 1.21 07 Dec 1992 10:06:52 GREGG
+Changes for tf ver moved to SSET, otc ver added to SSET and links added to FDD.
+
+ Rev 1.20 24 Nov 1992 18:16:10 GREGG
+Updates to match MTF document.
+
+ Rev 1.19 23 Nov 1992 10:03:52 GREGG
+Changes for path in stream.
+
+ Rev 1.18 17 Nov 1992 14:12:42 GREGG
+Added string_type.
+
+ Rev 1.17 09 Nov 1992 11:00:34 GREGG
+Merged in changes for new method of accessing OTC.
+
+ Rev 1.16 22 Oct 1992 10:43:02 HUNTER
+Changes for Stream Headers
+
+
+ Rev 1.15 22 Sep 1992 08:58:18 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.14 30 Jul 1992 16:14:22 GREGG
+Moved OTC_MoveToVCB and OTC_GetFDDtoFile to otc40msc.c.
+
+ Rev 1.13 27 Jul 1992 12:48:56 GREGG
+Fixed more warnings...
+
+ Rev 1.12 01 Jul 1992 19:30:54 GREGG
+Converted to new date/time structure for dates written to tape.
+
+ Rev 1.11 18 Jun 1992 16:29:26 GREGG
+Handled request to move to the current set in OTC_MoveToVCB.
+
+ Rev 1.10 17 Jun 1992 15:56:06 GREGG
+Fixed loop transfering OTC from tape to disk.
+
+ Rev 1.9 12 Jun 1992 10:38:28 GREGG
+Fixed bug with single set sm_entry not being copied to the environment.
+
+ Rev 1.8 09 Jun 1992 16:01:24 GREGG
+Changes to use F40_CalcChecksum instead of CalcChecksum.
+Removed merging of attributes.
+Set a boolean for continuation blocks.
+Removed setting of filemark_count.
+
+ Rev 1.7 08 Jun 1992 16:57:32 GREGG
+Changed msassert in OTC_MoveToVCB.
+
+ Rev 1.6 04 Jun 1992 16:20:24 GREGG
+Fixed buffer handling in OTC_RdSSET.
+
+ Rev 1.5 01 Jun 1992 17:10:18 GREGG
+Set disp_size in gen_data structure.
+
+ Rev 1.4 29 May 1992 15:03:54 GREGG
+Added setting of last access date.
+
+ Rev 1.3 25 May 1992 18:26:50 GREGG
+Expect call to OTC_MoveToVCB more than once at EOD.
+
+ Rev 1.2 22 May 1992 15:25:30 GREGG
+Changed dots to pointers.
+
+ Rev 1.1 21 May 1992 12:22:08 GREGG
+Changes for 64 bit file system.
+
+ Rev 1.0 21 May 1992 12:07:02 GREGG
+Initial revision.
+
+
+**/
+
+#include <stdio.h>
+#include <io.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "stdtypes.h"
+#include "channel.h"
+#include "mayn40.h"
+#include "f40proto.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+#include "minmax.h"
+#include "transutl.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "dddefs.h"
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_RdSSET
+
+ Description: Reads in an SM entry and it's associated volume entry
+ from the SM file, and translates it to a VCB.
+
+ Returns: INT16 - TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 OTC_RdSSET(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ GEN_VCB_DATA gvcb_data ;
+ STD_DBLK_DATA_PTR std_data = &gvcb_data.std_data ;
+ UNALIGNED MTF_SM_ENTRY_PTR sm_entry = (UNALIGNED MTF_SM_ENTRY_PTR)cur_env->otc_buff ;
+ UINT8_PTR buff_ptr = cur_env->otc_buff ;
+ UINT8_PTR dest_ptr ;
+ UINT8_PTR src_ptr ;
+ UNALIGNED MTF_FDD_HDR_PTR fdd_hdr ;
+ UNALIGNED MTF_FDD_VOL_V1_PTR fdd_vol_v1 ;
+ UNALIGNED MTF_FDD_VOL_V2_PTR fdd_vol_v2 ;
+ FILE * fptr = cur_env->otc_sm_fptr ;
+ volatile size_t size ;
+ DATE_TIME backup_date ;
+ MTF_DATE_TIME temp_date ;
+
+ /* read the Set Map Entry */
+ if( fread( sm_entry, sizeof( MTF_SM_ENTRY ), 1, fptr ) != 1 ) {
+ if( !ferror( fptr ) && feof( fptr ) ) {
+ return( TF_NO_MORE_ENTRIES ) ;
+ } else {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+
+ /* Figure out the OTC level for the set. If the catalog version is
+ greater than the one we write, we won't be able to read the FDD,
+ but we'll still be able to read the set map.
+ */
+ if( U64_Lsw( sm_entry->fdd_pba ) != 0L &&
+ sm_entry->tape_cat_ver <= TAPE_CATALOG_VER ) {
+
+ cur_env->cur_otc_level = TCL_FULL ;
+ } else {
+ cur_env->cur_otc_level = TCL_PARTIAL ;
+ }
+
+ /* read the Set Map Entry's strings */
+ buff_ptr += sizeof( MTF_SM_ENTRY ) ;
+ size = (size_t)sm_entry->length - sizeof( MTF_SM_ENTRY ) ;
+ if( fread( buff_ptr, 1, size, fptr ) != size ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ /* read the Set Map Volume Entry */
+ buff_ptr += size ;
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)buff_ptr ;
+ if( sm_entry->tape_cat_ver == 1 ) {
+ fdd_vol_v1 = (UNALIGNED MTF_FDD_VOL_V1_PTR)(void *)( fdd_hdr + 1 ) ;
+ size = sizeof( MTF_FDD_HDR ) + sizeof( MTF_FDD_VOL_V1 ) ;
+ } else {
+ fdd_vol_v2 = (UNALIGNED MTF_FDD_VOL_V2_PTR)(void *)( fdd_hdr + 1 ) ;
+ size = sizeof( MTF_FDD_HDR ) + sizeof( MTF_FDD_VOL_V2 ) ;
+ }
+ if( fread( fdd_hdr, 1, size, fptr ) != size ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ /* read the Set Map Volume Entry's strings */
+ buff_ptr += size ;
+ size = (size_t)fdd_hdr->length - size ;
+ if( fread( buff_ptr, 1, size, fptr ) != size ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_VCB, (CREATE_DBLK_PTR)&gvcb_data ) ;
+ std_data->dblk = channel->cur_dblk ;
+
+ std_data->tape_seq_num = sm_entry->seq_num ;
+
+ /* Set the VCB attributes. Note that if this is an "old" tape,
+ the attibute bits were being set wrong, and need to be translated.
+ */
+ if( sm_entry->tape_cat_ver == 1 ) { // if old tape
+
+ std_data->attrib = 0 ;
+ std_data->attrib |= ( sm_entry->set_attribs & OLD_VCB_COPY_SET )
+ ? VCB_COPY_SET : 0 ;
+ std_data->attrib |= ( sm_entry->set_attribs & OLD_VCB_NORMAL_SET )
+ ? VCB_NORMAL_SET : 0 ;
+ std_data->attrib |= ( sm_entry->set_attribs & OLD_VCB_DIFFERENTIAL_SET )
+ ? VCB_DIFFERENTIAL_SET : 0 ;
+ std_data->attrib |= ( sm_entry->set_attribs & OLD_VCB_INCREMENTAL_SET )
+ ? VCB_INCREMENTAL_SET : 0 ;
+ std_data->attrib |= ( sm_entry->set_attribs & OLD_VCB_DAILY_SET )
+ ? VCB_DAILY_SET : 0 ;
+ std_data->attrib |= ( sm_entry->set_attribs & OLD_VCB_ARCHIVE_BIT )
+ ? VCB_ARCHIVE_BIT : 0 ;
+ } else {
+ std_data->attrib = sm_entry->set_attribs ;
+ }
+
+ /* Clear other vendor's vendor specific bits */
+ std_data->attrib &= 0x00FFFFFF ;
+
+ /* Set our own vendor specific bits */
+ std_data->attrib |= ( sm_entry->tf_minor_ver != FORMAT_VER_MINOR )
+ ? VCB_FUTURE_VER_BIT : 0 ;
+ std_data->attrib |= ( sm_entry->blk_attribs & MTF_DB_COMPRESS_BIT )
+ ? VCB_COMPRESSED_BIT : 0 ;
+ std_data->attrib |= ( sm_entry->blk_attribs & MTF_DB_ENCRYPT_BIT )
+ ? VCB_ENCRYPTED_BIT : 0 ;
+
+ std_data->continue_obj = (BOOLEAN)( sm_entry->blk_attribs & MTF_DB_CONT_BIT ) ;
+ std_data->compressed_obj = (BOOLEAN)( sm_entry->blk_attribs & MTF_DB_COMPRESS_BIT ) ;
+
+ std_data->os_id = (UINT8)sm_entry->os_id ;
+ std_data->os_ver = (UINT8)sm_entry->os_ver ;
+
+ std_data->os_info = NULL ;
+ std_data->os_info_size = 0 ;
+
+ std_data->lba = U64_Lsw( sm_entry->lba ) ;
+ std_data->disp_size = sm_entry->disp_size ;
+
+ std_data->string_type = sm_entry->string_type ;
+
+ gvcb_data.vendor_id = 0 ;
+
+ gvcb_data.set_cat_tape_seq_num = sm_entry->fdd_seq_num ;
+ if( ( gvcb_data.set_cat_pba = U64_Lsw( sm_entry->fdd_pba ) ) == 0L ||
+ sm_entry->tape_cat_ver > TAPE_CATALOG_VER ||
+ cur_env->max_otc_level != TCL_FULL ) {
+
+ gvcb_data.set_cat_info_valid = FALSE ;
+ gvcb_data.on_tape_cat_level = TCL_PARTIAL ;
+ } else {
+ gvcb_data.set_cat_info_valid = TRUE ;
+ gvcb_data.on_tape_cat_level = TCL_FULL ;
+ }
+ gvcb_data.on_tape_cat_ver = sm_entry->tape_cat_ver ;
+
+ gvcb_data.tf_major_ver = (CHAR)cur_env->tape_hdr.tf_major_ver ;
+ gvcb_data.tf_minor_ver = (CHAR)sm_entry->tf_minor_ver ;
+ gvcb_data.tape_id = cur_env->tape_hdr.tape_id_number ;
+ gvcb_data.tape_seq_num = sm_entry->seq_num ;
+ gvcb_data.bset_num = sm_entry->set_num ;
+
+ gvcb_data.password_encrypt_alg = sm_entry->pswd_encr_algor ;
+
+ if( cur_env->util_buff == NULL ) {
+ if( ( cur_env->util_buff = calloc( F40_INIT_UTIL_BUFF_SIZE, 1 ) ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_SM, TRUE ) ;
+ return( TFLE_NO_MEMORY ) ;
+ }
+ cur_env->util_buff_size = F40_INIT_UTIL_BUFF_SIZE ;
+ }
+
+ dest_ptr = cur_env->util_buff ;
+
+ gvcb_data.tape_password = (CHAR_PTR)cur_env->tape_password ;
+ gvcb_data.tape_password_size = cur_env->tape_password_size ;
+
+ gvcb_data.bset_password = (CHAR_PTR)( (INT8_PTR)sm_entry + sm_entry->password.data_offset ) ;
+ gvcb_data.bset_password_size = sm_entry->password.data_size ;
+
+ gvcb_data.short_m_name = NULL ;
+ gvcb_data.short_m_name_size = 0 ;
+
+ gvcb_data.set_cat_num_dirs = (UINT16)sm_entry->num_dirs ;
+ gvcb_data.set_cat_num_files = (UINT16)sm_entry->num_files ;
+ gvcb_data.set_cat_num_corrupt = (UINT16)sm_entry->num_corrupt_files ;
+
+
+ /* Tape Name */
+ gvcb_data.tape_name = (CHAR_PTR)dest_ptr ;
+ if( cur_env->tape_name_size != 0 ) {
+ gvcb_data.tape_name_size =
+ F40_CopyAndTerminate( &dest_ptr, cur_env->tape_name,
+ cur_env->tape_name_size,
+ cur_env->tape_hdr.block_header.string_type,
+ sm_entry->string_type ) ;
+ } else {
+ gvcb_data.tape_name_size = 0 ;
+ }
+
+ /* If this is an "old" tape the strings below are NULL terminated.
+ If it's a "new" tape, we have to copy the string to another data
+ area and NULL terminate them before passing them to the UI.
+ Note that the tape name is NEVER NULL terminated because we have to
+ strip it off before we store it to maintain consistancy.
+ */
+ if( sm_entry->tape_cat_ver == 1 ) {
+ /* This is an old tape with NULL terminated strings. */
+
+ gvcb_data.bset_name = (CHAR_PTR)( (INT8_PTR)sm_entry + sm_entry->set_name.data_offset ) ;
+ gvcb_data.bset_name_size = sm_entry->set_name.data_size ;
+ gvcb_data.bset_descript = (CHAR_PTR)( (INT8_PTR)sm_entry + sm_entry->set_descr.data_offset ) ;
+ gvcb_data.bset_descript_size = sm_entry->set_descr.data_size ;
+ gvcb_data.user_name = (CHAR_PTR)( (INT8_PTR)sm_entry + sm_entry->user_name.data_offset ) ;
+ gvcb_data.user_name_size = sm_entry->user_name.data_size ;
+ gvcb_data.device_name = NULL ;
+ gvcb_data.dev_name_size = 0 ;
+ gvcb_data.volume_name = (CHAR_PTR)( (INT8_PTR)fdd_hdr + fdd_vol_v1->vol_name.data_offset ) ;
+ gvcb_data.volume_name_size = fdd_vol_v1->vol_name.data_size ;
+ gvcb_data.machine_name = (CHAR_PTR)( (INT8_PTR)fdd_hdr + fdd_vol_v1->machine_name.data_offset ) ;
+ gvcb_data.machine_name_size = fdd_vol_v1->machine_name.data_size ;
+
+ } else {
+ /* This is a new tape, copy the strings into a buffer and NULL
+ terminate them.
+ */
+
+ src_ptr = (UINT8_PTR)sm_entry ;
+
+ /* Backup Set Name */
+ gvcb_data.bset_name = (CHAR_PTR)dest_ptr ;
+ if( sm_entry->set_name.data_size != 0 ) {
+ gvcb_data.bset_name_size =
+ F40_CopyAndTerminate( &dest_ptr, src_ptr +
+ sm_entry->set_name.data_offset,
+ sm_entry->set_name.data_size,
+ sm_entry->string_type,
+ sm_entry->string_type ) ;
+ } else {
+ gvcb_data.bset_name_size = 0 ;
+ }
+
+ /* Backup Set Description */
+ gvcb_data.bset_descript = (CHAR_PTR)dest_ptr ;
+ if( sm_entry->set_descr.data_size != 0 ) {
+ gvcb_data.bset_descript_size =
+ F40_CopyAndTerminate( &dest_ptr, src_ptr +
+ sm_entry->set_descr.data_offset,
+ sm_entry->set_descr.data_size,
+ sm_entry->string_type,
+ sm_entry->string_type ) ;
+ } else {
+ gvcb_data.bset_descript_size = 0 ;
+ }
+
+ /* User Name */
+ gvcb_data.user_name = (CHAR_PTR)dest_ptr ;
+ if( sm_entry->user_name.data_size != 0 ) {
+ gvcb_data.user_name_size =
+ F40_CopyAndTerminate( &dest_ptr, src_ptr +
+ sm_entry->user_name.data_offset,
+ sm_entry->user_name.data_size,
+ sm_entry->string_type,
+ sm_entry->string_type ) ;
+ } else {
+ gvcb_data.user_name_size = 0 ;
+ }
+
+ src_ptr = (UINT8_PTR)fdd_hdr ;
+
+ /* Device Name */
+ gvcb_data.device_name = (CHAR_PTR)dest_ptr ;
+ if( fdd_vol_v2->device_name.data_size != 0 ) {
+ gvcb_data.dev_name_size =
+ F40_CopyAndTerminate( &dest_ptr, src_ptr +
+ fdd_vol_v2->device_name.data_offset,
+ fdd_vol_v2->device_name.data_size,
+ fdd_hdr->string_type,
+ fdd_hdr->string_type ) ;
+ } else {
+ gvcb_data.dev_name_size = 0 ;
+ }
+
+ /* Volume Name */
+ gvcb_data.volume_name = (CHAR_PTR)dest_ptr ;
+ if( fdd_vol_v2->vol_name.data_size != 0 ) {
+ gvcb_data.volume_name_size =
+ F40_CopyAndTerminate( &dest_ptr, src_ptr +
+ fdd_vol_v2->vol_name.data_offset,
+ fdd_vol_v2->vol_name.data_size,
+ fdd_hdr->string_type,
+ fdd_hdr->string_type ) ;
+ } else {
+ gvcb_data.volume_name_size = 0 ;
+ }
+
+ /* Machine Name */
+ gvcb_data.machine_name = (CHAR_PTR)dest_ptr ;
+ if( fdd_vol_v2->machine_name.data_size != 0 ) {
+ gvcb_data.machine_name_size =
+ F40_CopyAndTerminate( &dest_ptr, src_ptr +
+ fdd_vol_v2->machine_name.data_offset,
+ fdd_vol_v2->machine_name.data_size,
+ fdd_hdr->string_type,
+ fdd_hdr->string_type ) ;
+ } else {
+ gvcb_data.machine_name_size = 0 ;
+ }
+
+ /* Other than in the NLM where they already fixed this, the
+ UI expects to see a volume name of the form
+ "<device name><space><volume name>", and NO DEVICE NAME.
+ We do this by pointing the volume name at the device name,
+ and replacing the NULL terminator on the device name with
+ a space.
+ */
+
+#if !defined( OS_NLM )
+
+ if( gvcb_data.dev_name_size != 0 ) {
+ gvcb_data.volume_name = gvcb_data.device_name ;
+ gvcb_data.volume_name_size += gvcb_data.dev_name_size ;
+ if( gvcb_data.volume_name_size != gvcb_data.dev_name_size ) {
+ dest_ptr = (UINT8_PTR)gvcb_data.volume_name ;
+ if( fdd_hdr->string_type == BEC_ANSI_STR ) {
+ dest_ptr += gvcb_data.dev_name_size - 1 ;
+ *((ACHAR *)dest_ptr) = (ACHAR)' ' ;
+ } else {
+ dest_ptr += gvcb_data.dev_name_size - 2 ;
+ *((WCHAR *)dest_ptr) = (WCHAR)' ' ;
+ }
+ }
+ gvcb_data.dev_name_size = 0 ;
+ }
+
+#endif
+
+ } // end of else these are new tapes
+
+ temp_date = sm_entry->backup_date ;
+ TapeDateToDate( &backup_date, &temp_date ) ;
+ gvcb_data.date = &backup_date ;
+
+ gvcb_data.pba = U64_Lsw( sm_entry->sset_pba ) ;
+
+ /* Tell the file system to do its thing. It returns a data filter
+ which we have no use for.
+ */
+ (void) FS_CreateGenVCB( channel->cur_fsys, &gvcb_data ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_RdDIR
+
+ Description:
+
+ Returns: INT16 - TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 OTC_RdDIR(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ GEN_DDB_DATA gddb_data ;
+ STD_DBLK_DATA_PTR std_data = &gddb_data.std_data ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ UNALIGNED MTF_FDD_HDR_PTR fdd_hdr ;
+ UNALIGNED MTF_FDD_DIR_V1_PTR fdd_dir_v1 ;
+ UNALIGNED MTF_FDD_DIR_V2_PTR fdd_dir_v2 ;
+ UNALIGNED F40_FDD_DBDB_PTR fdd_dbdb ;
+ DATE_TIME create_date ;
+ DATE_TIME last_mod_date ;
+ DATE_TIME backup_date ;
+ DATE_TIME last_access_date ;
+ DATE_TIME dummy_date ;
+ MTF_DATE_TIME temp_date ;
+
+ /* Note: We know we have at least the FDD header, or the block type
+ determiner would have gotten us a new buffer.
+ */
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+ if( cur_env->otc_buff_remaining < fdd_hdr->length ) {
+ if( ( ret_val = OTC_ReadABuff( cur_env, fdd_hdr->length ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+ }
+
+ cur_env->otc_buff_ptr += fdd_hdr->length ;
+ cur_env->otc_buff_remaining -= fdd_hdr->length ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_DDB, (CREATE_DBLK_PTR)&gddb_data ) ;
+
+ std_data->dblk = channel->cur_dblk ;
+ std_data->tape_seq_num = fdd_hdr->seq_num ;
+ std_data->continue_obj = (BOOLEAN)( fdd_hdr->blk_attribs & MTF_DB_CONT_BIT ) ;
+ std_data->compressed_obj = (BOOLEAN)( fdd_hdr->blk_attribs & MTF_DB_COMPRESS_BIT ) ;
+ std_data->os_id = (UINT8)fdd_hdr->os_id ;
+ std_data->os_ver = (UINT8)fdd_hdr->os_ver ;
+ std_data->os_info = NULL ;
+ std_data->os_info_size = 0 ;
+ std_data->lba = U64_Lsw( fdd_hdr->lba ) ;
+ std_data->disp_size = fdd_hdr->disp_size ;
+ std_data->string_type = fdd_hdr->string_type ;
+
+ if( memcmp( fdd_hdr->type, "DBDB", 4 ) == 0 ) {
+ /* This is a Database DBLK, but the boys upstairs don't want to
+ know about such silly things! So we lie and call it a DDB to
+ get it passed on to the File System. The File System can tell
+ what it really is too, and will deal with it appropriatly.
+ */
+ fdd_dbdb = (UNALIGNED F40_FDD_DBDB_PTR)(void *)( fdd_hdr + 1 ) ;
+
+ std_data->attrib = fdd_dbdb->database_attribs ;
+
+ /* Clear all vendor specific bits */
+ std_data->attrib &= 0x00FFFFFF ;
+
+ /* Set our vendor specific bit that says this is a DBDB */
+ std_data->attrib |= DIR_IS_REALLY_DB ;
+
+ gddb_data.path_name = (CHAR_PTR)( (INT8_PTR)fdd_hdr + fdd_dbdb->database_name.data_offset ) ;
+ gddb_data.path_size = fdd_dbdb->database_name.data_size ;
+
+ TapeDateToDate( &backup_date, &fdd_dbdb->backup_date ) ;
+ gddb_data.backup_date = &backup_date ;
+
+ /* DBDBs don't have the following date fields */
+ memset( &dummy_date, 0, sizeof( dummy_date ) ) ;
+ gddb_data.creat_date = &dummy_date ;
+ gddb_data.mod_date = &dummy_date ;
+ gddb_data.access_date = &dummy_date ;
+
+ } else {
+
+ /* Standard DDB structure stuffing */
+
+ if( cur_env->otc_ver == 1 ) {
+ fdd_dir_v1 = (UNALIGNED MTF_FDD_DIR_V1_PTR)(void *)( fdd_hdr + 1 ) ;
+ } else {
+ fdd_dir_v2 = (UNALIGNED MTF_FDD_DIR_V2_PTR)(void *)( fdd_hdr + 1 ) ;
+ }
+
+ /* Set the DIR attributes. Note that if this is an "old" tape,
+ the attibute bits were being set wrong, and need to be translated.
+ */
+ if( cur_env->otc_ver == 1 ) {
+
+ std_data->attrib = fdd_dir_v1->dir_attribs &
+ ~( OLD_DIR_EMPTY_BIT | OLD_DIR_PATH_IN_STREAM_BIT ) ;
+
+ std_data->attrib |= ( fdd_dir_v1->dir_attribs & OLD_DIR_EMPTY_BIT )
+ ? DIR_EMPTY_BIT : 0 ;
+ std_data->attrib |= ( fdd_dir_v1->dir_attribs & OLD_DIR_PATH_IN_STREAM_BIT )
+ ? DIR_PATH_IN_STREAM_BIT : 0 ;
+ } else {
+ std_data->attrib = fdd_dir_v2->dir_attribs ;
+ }
+
+ if( cur_env->otc_ver == 1 ) {
+ gddb_data.path_name = (CHAR_PTR)( (INT8_PTR)fdd_hdr + fdd_dir_v1->dir_name.data_offset ) ;
+ gddb_data.path_size = fdd_dir_v1->dir_name.data_size ;
+
+ temp_date = fdd_dir_v1->create_date ;
+ TapeDateToDate( &create_date, &temp_date ) ;
+ temp_date = fdd_dir_v1->last_mod_date ;
+ TapeDateToDate( &last_mod_date, &temp_date ) ;
+ temp_date = fdd_dir_v1->backup_date ;
+ TapeDateToDate( &backup_date, &temp_date ) ;
+ temp_date = fdd_dir_v1->last_access_date ;
+ TapeDateToDate( &last_access_date, &temp_date ) ;
+ } else {
+ gddb_data.path_name = (CHAR_PTR)( (INT8_PTR)fdd_hdr + fdd_dir_v2->dir_name.data_offset ) ;
+ gddb_data.path_size = fdd_dir_v2->dir_name.data_size ;
+
+ temp_date = fdd_dir_v2->create_date ;
+ TapeDateToDate( &create_date, &temp_date ) ;
+ temp_date = fdd_dir_v2->last_mod_date ;
+ TapeDateToDate( &last_mod_date, &temp_date ) ;
+ temp_date = fdd_dir_v2->backup_date ;
+ TapeDateToDate( &backup_date, &temp_date ) ;
+ temp_date = fdd_dir_v2->last_access_date ;
+ TapeDateToDate( &last_access_date, &temp_date ) ;
+ }
+ gddb_data.creat_date = &create_date ;
+ gddb_data.mod_date = &last_mod_date ;
+ gddb_data.backup_date = &backup_date ;
+ gddb_data.access_date = &last_access_date ;
+ }
+
+ /* Tell the file system to do its thing. It returns a data filter
+ which we have no use for.
+ */
+ (void) FS_CreateGenDDB( channel->cur_fsys, &gddb_data ) ;
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_RdFILE
+
+ Description:
+
+ Returns: INT16 - TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 OTC_RdFILE(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ GEN_FDB_DATA gfdb_data ; /* FDB create structure */
+ STD_DBLK_DATA_PTR std_data = &gfdb_data.std_data ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ UNALIGNED MTF_FDD_HDR_PTR fdd_hdr ;
+ UNALIGNED MTF_FDD_FILE_V1_PTR fdd_file_v1 ;
+ UNALIGNED MTF_FDD_FILE_V2_PTR fdd_file_v2 ;
+ DATE_TIME create_date ;
+ DATE_TIME last_mod_date ;
+ DATE_TIME backup_date ;
+ DATE_TIME last_access_date ;
+ MTF_DATE_TIME temp_date ;
+ UINT8_PTR buff_ptr ;
+
+ /* Note: We know we have at least the FDD header, or the block type
+ determiner would have gotten us a new buffer.
+ */
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+ if( cur_env->otc_buff_remaining < fdd_hdr->length ) {
+ if( ( ret_val = OTC_ReadABuff( cur_env, fdd_hdr->length ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+ }
+ if( cur_env->otc_ver == 1 ) {
+ fdd_file_v1 = (UNALIGNED MTF_FDD_FILE_V1_PTR)(void *)( fdd_hdr + 1 ) ;
+ } else {
+ fdd_file_v2 = (UNALIGNED MTF_FDD_FILE_V2_PTR)(void *)( fdd_hdr + 1 ) ;
+ }
+ cur_env->otc_buff_ptr += fdd_hdr->length ;
+ cur_env->otc_buff_remaining -= fdd_hdr->length ;
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_DDB, (CREATE_DBLK_PTR)&gfdb_data ) ;
+
+ std_data->dblk = channel->cur_dblk ;
+ std_data->tape_seq_num = fdd_hdr->seq_num ;
+ std_data->continue_obj = (BOOLEAN)( fdd_hdr->blk_attribs & MTF_DB_CONT_BIT ) ;
+ std_data->compressed_obj = (BOOLEAN)( fdd_hdr->blk_attribs & MTF_DB_COMPRESS_BIT ) ;
+ std_data->os_id = (UINT8)fdd_hdr->os_id ;
+ std_data->os_ver = (UINT8)fdd_hdr->os_ver ;
+ std_data->os_info = NULL ;
+ std_data->os_info_size = 0 ;
+ std_data->lba = U64_Lsw( fdd_hdr->lba ) ;
+ std_data->disp_size = fdd_hdr->disp_size ;
+ std_data->string_type = fdd_hdr->string_type ;
+
+ /* Set the FILE attributes. Note that if this is an "old" tape,
+ the attibute bits were being set wrong, and need to be translated.
+ */
+ if( cur_env->otc_ver == 1 ) { // if old tape
+
+ std_data->attrib = fdd_file_v1->file_attribs &
+ ~( OLD_FILE_IN_USE_BIT | OLD_FILE_NAME_IN_STREAM_BIT |
+ OLD_OBJ_CORRUPT_BIT ) ;
+
+ std_data->attrib |= ( fdd_file_v1->file_attribs & OLD_FILE_IN_USE_BIT )
+ ? FILE_IN_USE_BIT : 0 ;
+ std_data->attrib |= ( fdd_file_v1->file_attribs & OLD_FILE_NAME_IN_STREAM_BIT )
+ ? FILE_NAME_IN_STREAM_BIT : 0 ;
+ std_data->attrib |= ( fdd_file_v1->file_attribs & OLD_OBJ_CORRUPT_BIT )
+ ? OBJ_CORRUPT_BIT : 0 ;
+ } else {
+ std_data->attrib = fdd_file_v2->file_attribs ;
+ }
+
+ if( cur_env->otc_ver == 1 ) {
+ temp_date = fdd_file_v1->create_date ;
+ TapeDateToDate( &create_date, &temp_date ) ;
+ temp_date = fdd_file_v1->last_mod_date ;
+ TapeDateToDate( &last_mod_date, &temp_date ) ;
+ temp_date = fdd_file_v1->backup_date ;
+ TapeDateToDate( &backup_date, &temp_date ) ;
+ temp_date = fdd_file_v1->last_access_date ;
+ TapeDateToDate( &last_access_date, &temp_date ) ;
+ } else {
+ temp_date = fdd_file_v2->create_date ;
+ TapeDateToDate( &create_date, &temp_date ) ;
+ temp_date = fdd_file_v2->last_mod_date ;
+ TapeDateToDate( &last_mod_date, &temp_date ) ;
+ temp_date = fdd_file_v2->backup_date ;
+ TapeDateToDate( &backup_date, &temp_date ) ;
+ temp_date = fdd_file_v2->last_access_date ;
+ TapeDateToDate( &last_access_date, &temp_date ) ;
+ }
+
+ /* If this is an "old" tape the file name is NULL terminated. If it's
+ a "new" tape, we have to copy the string to another data area and
+ NULL terminate it before passing it to the UI.
+ */
+ if( cur_env->otc_ver == 1 ) {
+ /* This is an old tape with NULL terminated strings. */
+
+ gfdb_data.fname = (CHAR_PTR)( (INT8_PTR)fdd_hdr + fdd_file_v1->file_name.data_offset ) ;
+ gfdb_data.fname_size = fdd_file_v1->file_name.data_size ;
+
+ } else {
+ /* This is a new tape, copy the file name into a buffer and NULL
+ terminate it.
+ */
+
+ if( cur_env->util_buff == NULL ) {
+ if( ( cur_env->util_buff = calloc( F40_INIT_UTIL_BUFF_SIZE, 1 ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ cur_env->util_buff_size = F40_INIT_UTIL_BUFF_SIZE ;
+ }
+
+ buff_ptr = cur_env->util_buff ;
+
+ gfdb_data.fname = (CHAR_PTR)buff_ptr ;
+ if( fdd_file_v2->file_name.data_size != 0 ) {
+ gfdb_data.fname_size =
+ F40_CopyAndTerminate( &buff_ptr, (UINT8_PTR)fdd_hdr +
+ fdd_file_v2->file_name.data_offset,
+ fdd_file_v2->file_name.data_size,
+ fdd_hdr->string_type,
+ fdd_hdr->string_type ) ;
+ } else {
+ gfdb_data.fname_size = 0 ;
+ }
+ }
+
+ gfdb_data.creat_date = &create_date ;
+ gfdb_data.mod_date = &last_mod_date ;
+ gfdb_data.backup_date = &backup_date ;
+ gfdb_data.access_date = &last_access_date ;
+
+ /* Tell the file system to do its thing. It returns a data filter
+ which we have no use for.
+ */
+ (void) FS_CreateGenFDB( channel->cur_fsys, &gfdb_data ) ;
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_ReadABuff
+
+ Description:
+
+ Returns: INT16 - TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 OTC_ReadABuff(
+ F40_ENV_PTR cur_env,
+ UINT16 length )
+{
+ UINT8_PTR tmp_buff ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ size_t size ;
+ size_t size_got ;
+
+ if( cur_env->otc_buff_size < length ) {
+ while( cur_env->otc_buff_size < length ) {
+ cur_env->otc_buff_size += F40_OTC_BUFF_INC ;
+ }
+ if( ( tmp_buff = calloc( cur_env->otc_buff_size, 1 ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ if( cur_env->otc_buff_remaining != 0 ) {
+ memmove( tmp_buff, cur_env->otc_buff_ptr, cur_env->otc_buff_remaining ) ;
+ }
+ free( cur_env->otc_buff ) ;
+ cur_env->otc_buff = tmp_buff ;
+ } else {
+ if( cur_env->otc_buff_remaining != 0 ) {
+ memmove( cur_env->otc_buff, cur_env->otc_buff_ptr, cur_env->otc_buff_remaining ) ;
+ }
+ }
+
+ cur_env->otc_buff_ptr = cur_env->otc_buff + cur_env->otc_buff_remaining ;
+ size = cur_env->otc_buff_size - cur_env->otc_buff_remaining ;
+
+ if( ( size_got = fread( cur_env->otc_buff_ptr, 1, size, fptr ) ) != size ) {
+ if( ferror( fptr ) || !feof( fptr ) ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+
+ cur_env->otc_buff_ptr = cur_env->otc_buff ;
+ cur_env->otc_buff_remaining += (UINT16)size_got ;
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GetFDDType
+
+ Description: This function determines the type of the next FDD entry
+ in the buffer.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_GetFDDType(
+ CHANNEL_PTR channel,
+ UINT16_PTR blk_type )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ UNALIGNED MTF_FDD_HDR_PTR fdd_hdr ;
+
+ if( cur_env->otc_buff_remaining < sizeof( MTF_FDD_HDR ) ) {
+ if( ( ret_val = OTC_ReadABuff( cur_env, sizeof( MTF_FDD_HDR ) ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+
+ /* DO NOT UNICODEIZE THE FOLLOWING CONSTANTS!!! */
+
+ if( memcmp( fdd_hdr->type, "VOLB", 4 ) == 0 ) {
+ *blk_type = FDD_VOL_BLK ;
+
+ } else if( memcmp( fdd_hdr->type, "DIRB", 4 ) == 0 ||
+ memcmp( fdd_hdr->type, "DBDB", 4 ) == 0 ) {
+ *blk_type = FDD_DIR_BLK ;
+
+ } else if( memcmp( fdd_hdr->type, "FILE", 4 ) == 0 ) {
+ *blk_type = FDD_FILE_BLK ;
+
+ } else if( memcmp( fdd_hdr->type, "FEND", 4 ) == 0 ) {
+ *blk_type = FDD_END_BLK ;
+ } else {
+ *blk_type = FDD_UNKNOWN_BLK ;
+ msassert( FALSE ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_SkipFDDEntry
+
+ Description:
+
+ Returns: INT16 - TFLE_xxx error code
+
+ Notes:
+
+**/
+INT16 OTC_SkipFDDEntry(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ UNALIGNED MTF_FDD_HDR_PTR fdd_hdr ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* Note: We know we have at least the FDD header, or the block type
+ determiner would have gotten us a new buffer.
+ */
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+ if( cur_env->otc_buff_remaining < fdd_hdr->length ) {
+ if( ( ret_val = OTC_ReadABuff( cur_env, fdd_hdr->length ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+ }
+ cur_env->otc_buff_ptr += fdd_hdr->length ;
+ cur_env->otc_buff_remaining -= fdd_hdr->length ;
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_SkipFDDContEntries
+
+ Description: Skip past any FDD entries which have the continuation
+ bit set, unit you encounter one that doesn't.
+
+ Returns: INT16 - TFLE_xxx error code
+
+ Notes: Since the attrib field in the FEND entry is undefined,
+ it may have garbage in it! We do a special check to
+ make sure we don't accidently skip past it.
+
+**/
+INT16 OTC_SkipFDDContEntries(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)( channel->fmt_env ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ UNALIGNED MTF_FDD_HDR_PTR fdd_hdr ;
+
+ while( 1 ) {
+ if( cur_env->otc_buff_remaining < sizeof( MTF_FDD_HDR ) ) {
+ if( ( ret_val = OTC_ReadABuff( cur_env, sizeof( MTF_FDD_HDR ) ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ }
+ fdd_hdr = (UNALIGNED MTF_FDD_HDR_PTR)cur_env->otc_buff_ptr ;
+
+ /* DO NOT UNICODEIZE THE FOLLOWING CONSTANT!!! */
+
+ if( ( fdd_hdr->blk_attribs & MTF_DB_CONT_BIT ) &&
+ memcmp( fdd_hdr->type, "FEND", 4 ) != 0 ) {
+
+ if( ( ret_val = OTC_SkipFDDEntry( channel ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+ } else {
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+}
+
diff --git a/private/utils/ntbackup/src/otc40wt.c b/private/utils/ntbackup/src/otc40wt.c
new file mode 100644
index 000000000..ec7c623ba
--- /dev/null
+++ b/private/utils/ntbackup/src/otc40wt.c
@@ -0,0 +1,1793 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: otc40wt.c
+
+ Description: Contains the Code for writing On Tape Catalogs.
+
+
+ $Log: T:/LOGFILES/OTC40WT.C_V $
+
+ Rev 1.30.2.1 11 Jan 1995 21:01:18 GREGG
+Added size of FDD header to calculation of FDD end entry size.
+
+ Rev 1.30.2.0 08 Jan 1995 21:49:00 GREGG
+Added database DBLK.
+
+ Rev 1.30 01 Dec 1993 15:51:40 GREGG
+Fixed unicode bug in OTC_SetDirLinks.
+
+ Rev 1.29 14 Oct 1993 18:17:04 GREGG
+Call home grown mktemp.
+
+ Rev 1.28 15 Sep 1993 21:37:40 GREGG
+Use mktemp to generate the temp OTC file names to gaurentee unique names.
+
+ Rev 1.27 09 Jun 1993 03:55:08 GREGG
+In EOS at EOM case in OTC_PostprocessEOM, don't process FDD.
+
+ Rev 1.26 08 Jun 1993 00:02:36 GREGG
+Fix for bug in the way we were handling EOM and continuation OTC entries.
+Files modified for fix: mtf10wt.c, otc40wt.c, otc40msc.c f40proto.h mayn40.h
+
+ Rev 1.25 17 May 1993 21:13:36 ZEIR
+GenSMHeader pad bytes are now clean 0's
+
+ Rev 1.24 25 Apr 1993 17:36:06 GREGG
+Fourth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Parse the device name and volume name out of the FS supplied "volume
+ name", and write it to tape as separate fields.
+ - Generate the "volume name" the FS and UI expect out of the device
+ name and volume name on tape.
+ - Write all strings without NULL terminater, and translate them back
+ to NULL terminated strings on the read side.
+
+Matches: MTF10WDB.C 1.8, F40PROTO.H 1.26, OTC40WT.C 1.24, MAYN40.H 1.33,
+ MAYN40RD.C 1.57, OTC40RD.C 1.25
+
+ Rev 1.23 19 Apr 1993 18:00:32 GREGG
+Second in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ Changes to write version 2 of OTC, and to read both versions.
+
+Matches: mayn40rd.c 1.55, otc40msc.c 1.19, otc40rd.c 1.23, otc40wt.c 1.23,
+ makevcb.c 1.15, fsys.h 1.32, fsys_str.h 1.46, tpos.h 1.16,
+ mayn40.h 1.32, mtf.h 1.3.
+
+NOTE: There are additional changes to the catalogs needed to save the OTC
+ version and put it in the tpos structure before loading the OTC
+ File/Directory Detail. These changes are NOT listed above!
+
+ Rev 1.22 19 Mar 1993 17:14:36 GREGG
+Bobo head (that's me) was reallocing less than was initially alloced!!!
+
+ Rev 1.21 03 Mar 1993 17:26:54 GREGG
+Fixed realloc calls to eliminate possible memory loss.
+
+ Rev 1.20 28 Jan 1993 12:28:56 GREGG
+Fixed warnings.
+
+ Rev 1.19 05 Jan 1993 17:21:48 GREGG
+Fix for initial DIRB not being root.
+
+ Rev 1.18 07 Dec 1992 10:06:46 GREGG
+Changes for tf ver moved to SSET, otc ver added to SSET and links added to FDD.
+
+ Rev 1.17 24 Nov 1992 18:16:16 GREGG
+Updates to match MTF document.
+
+ Rev 1.16 23 Nov 1992 10:03:48 GREGG
+Changes for path in stream.
+
+ Rev 1.15 17 Nov 1992 14:12:36 GREGG
+Added string_type.
+
+ Rev 1.14 09 Nov 1992 11:01:06 GREGG
+Changed references to tape catalog levels for new defines.
+
+ Rev 1.13 22 Oct 1992 10:42:48 HUNTER
+Changes for Stream Headers
+
+ Rev 1.12 31 Aug 1992 19:10:16 GREGG
+Added fflush calls to insure all data gets to disk and fclose doesn't fail.
+
+ Rev 1.11 30 Jul 1992 16:23:26 GREGG
+A lot of the functions previosly in this module were moved to otc40msc.c.
+Some changes were made to the functions which remained to deal with the
+addition of Stream Headers and to fix some EOM bugs.
+
+ Rev 1.10 27 Jul 1992 12:48:34 GREGG
+Fixed more warnings...
+
+ Rev 1.9 17 Jun 1992 15:55:50 GREGG
+Fixed loop transfering OTC from tape to disk.
+
+ Rev 1.8 12 Jun 1992 14:15:04 GREGG
+Call GetBlkType instead of DetBlkType in OTC_GetPrevSM.
+
+ Rev 1.7 09 Jun 1992 15:50:54 GREGG
+Removed setting of filemark_count.
+
+ Rev 1.6 29 May 1992 15:05:48 GREGG
+Added setting of last access date.
+
+ Rev 1.5 20 May 1992 20:21:46 GREGG
+Replaced reference of FILE_CORRUPT_BIT with OBJ_CORRUPT_BIT.
+
+ Rev 1.4 20 May 1992 20:04:28 GREGG
+Bug fixes and code review changes.
+
+ Rev 1.3 11 May 1992 13:35:40 GREGG
+More changes for EOM handling. NOTE: THIS IS NOT A STABLE REVISION!!!
+
+ Rev 1.2 05 May 1992 11:25:50 GREGG
+Folded 'local_tape' global into environment.
+
+ Rev 1.1 29 Apr 1992 12:57:28 GREGG
+ A variety of changes for a variety of reasons (still early in development).
+
+ Rev 1.0 09 Apr 1992 11:14:56 GREGG
+Initial revision.
+
+**/
+
+#include <stdio.h>
+#include <io.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "stdtypes.h"
+#include "channel.h"
+#include "mayn40.h"
+#include "f40proto.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+#include "minmax.h"
+#include "msmktemp.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "dddefs.h"
+
+/* Local Function Prototypes */
+static VOID _near OTC_SetFDDHeaderFields( MTF_FDD_HDR_PTR fdd_hdr,
+ MTF_DB_HDR_PTR db_hdr, INT16 seq_num ) ;
+static INT _near OTC_ReverseLinks( F40_ENV_PTR cur_env ) ;
+static INT _near OTC_SetLink( FILE * fptr, long curr_link, long next_link,
+ long * prev_link ) ;
+static INT16 _near OTC_SetDirLink( F40_ENV_PTR cur_env,
+ MTF_FDD_HDR_PTR fdd_hdr,
+ UINT8_PTR str_ptr, UINT16 size ) ;
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GenSMHeader
+
+ Description: Called when starting a new tape family, this function
+ writes a new Set Map header to the temporary SM file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_GenSMHeader(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ MTF_SM_HDR sm_hdr ;
+
+ sm_hdr.num_set_recs = 0 ;
+ sm_hdr.family_id = channel->tape_id ;
+ sm_hdr.pad[0] = sm_hdr.pad[1] = 0 ; /* kill random tape litter */
+ if( fwrite( &sm_hdr, sizeof( MTF_SM_HDR ), 1, cur_env->otc_sm_fptr ) != 1 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_SetFDDHeaderFields
+
+ Description: Generates an OTC volume entry and writes it to the SM
+ and FDD temporary files.
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+static VOID _near OTC_SetFDDHeaderFields(
+ MTF_FDD_HDR_PTR fdd_hdr,
+ MTF_DB_HDR_PTR db_hdr,
+ INT16 seq_num )
+{
+ fdd_hdr->seq_num = seq_num ;
+ fdd_hdr->blk_attribs = db_hdr->block_attribs ;
+ fdd_hdr->lba = db_hdr->logical_block_address ;
+ fdd_hdr->disp_size = db_hdr->displayable_size ;
+ fdd_hdr->os_id = db_hdr->machine_os_id ;
+ fdd_hdr->os_ver = db_hdr->machine_os_version ;
+ fdd_hdr->string_type = db_hdr->string_type ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GenVolEntry
+
+ Description: Generates an OTC volume entry and writes it to the SM
+ and FDD temporary files.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_GenVolEntry(
+ F40_ENV_PTR cur_env,
+ MTF_VOL_PTR cur_volb,
+ INT16 seq_num )
+{
+ MTF_FDD_HDR fdd_hdr ;
+ MTF_FDD_VOL_V2 fdd_vol ;
+ UINT8_PTR str_ptr ;
+ UINT16 offset = sizeof( MTF_FDD_HDR ) + sizeof( MTF_FDD_VOL_V2 ) ;
+ FILE * fptr = cur_env->otc_sm_fptr ;
+
+ /* DO NOT UNICODEIZE THIS CONSTANT!!! */
+ memcpy( fdd_hdr.type, "VOLB", 4 ) ;
+ OTC_SetFDDHeaderFields( &fdd_hdr, &cur_volb->block_hdr, seq_num ) ;
+
+ fdd_vol.backup_date = cur_volb->backup_date ;
+ fdd_vol.vol_attribs = cur_volb->volume_attribs ;
+ fdd_vol.os_info.data_size = 0 ;
+ fdd_vol.os_info.data_offset = 0 ;
+
+ if( ( fdd_vol.device_name.data_size = cur_volb->device_name.data_size ) != 0 ) {
+ fdd_vol.device_name.data_offset = offset ;
+ offset += fdd_vol.device_name.data_size ;
+ } else {
+ fdd_vol.device_name.data_offset = 0 ;
+ }
+
+ if( ( fdd_vol.vol_name.data_size = cur_volb->volume_name.data_size ) != 0 ) {
+ fdd_vol.vol_name.data_offset = offset ;
+ offset += fdd_vol.vol_name.data_size ;
+ } else {
+ fdd_vol.vol_name.data_offset = 0 ;
+ }
+
+ if( ( fdd_vol.machine_name.data_size = cur_volb->machine_name.data_size ) != 0 ) {
+ fdd_vol.machine_name.data_offset = offset ;
+ } else {
+ fdd_vol.machine_name.data_offset = 0 ;
+ }
+
+ /* The link field is always zero in the Set Map. If we are writing FDD
+ too, the link field will be set just before we write the entry in
+ the FDD temp file.
+ */
+ fdd_hdr.link = 0L ;
+
+ fdd_hdr.length = sizeof( MTF_FDD_HDR ) + sizeof( MTF_FDD_VOL_V2 )
+ + fdd_vol.device_name.data_size
+ + fdd_vol.vol_name.data_size
+ + fdd_vol.machine_name.data_size ;
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( fwrite( &fdd_vol, sizeof( MTF_FDD_VOL_V2 ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( fdd_vol.device_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_volb + cur_volb->device_name.data_offset ;
+ if( fwrite( str_ptr, 1, fdd_vol.device_name.data_size, fptr )
+ != fdd_vol.device_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ if( fdd_vol.vol_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_volb + cur_volb->volume_name.data_offset ;
+ if( fwrite( str_ptr, 1, fdd_vol.vol_name.data_size, fptr )
+ != fdd_vol.vol_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ if( fdd_vol.machine_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_volb + cur_volb->machine_name.data_offset ;
+ if( fwrite( str_ptr, 1, fdd_vol.machine_name.data_size, fptr )
+ != fdd_vol.machine_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ if( fflush( fptr ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ if( cur_env->cur_otc_level == TCL_FULL && !cur_env->fdd_aborted ) {
+
+ fptr = cur_env->otc_fdd_fptr ;
+
+ /* Here we set the link field to the previous volume entry. This
+ is done so that at the end of the backup we can traverse back
+ through the volume entries setting foreward links from each
+ one to its next sibling.
+ */
+ fdd_hdr.link = cur_env->last_volb ;
+ cur_env->last_volb = ftell( fptr ) ;
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fwrite( &fdd_vol, sizeof( MTF_FDD_VOL_V2 ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fdd_vol.device_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_volb + cur_volb->device_name.data_offset ;
+ if( fwrite( str_ptr, 1, fdd_vol.device_name.data_size, fptr )
+ != fdd_vol.device_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ if( fdd_vol.vol_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_volb + cur_volb->volume_name.data_offset ;
+ if( fwrite( str_ptr, 1, fdd_vol.vol_name.data_size, fptr )
+ != fdd_vol.vol_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+ if( fdd_vol.machine_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_volb + cur_volb->machine_name.data_offset ;
+ if( fwrite( str_ptr, 1, fdd_vol.machine_name.data_size, fptr )
+ != fdd_vol.machine_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GenDirEntry
+
+ Description: Generates an OTC directory entry and writes it to the
+ FDD temporary file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+INT16 OTC_GenDirEntry(
+ CHANNEL_PTR channel,
+ MTF_DIR_PTR cur_dir,
+ INT16 seq_num )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ MTF_FDD_HDR fdd_hdr ;
+ MTF_FDD_DIR_V2 fdd_dir ;
+ UINT8_PTR str_ptr ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ void * temp ;
+ UINT16 new_size ;
+
+ /* DO NOT UNICODEIZE THIS CONSTANT!!! */
+ memcpy( fdd_hdr.type, "DIRB", 4 ) ;
+ OTC_SetFDDHeaderFields( &fdd_hdr, &cur_dir->block_hdr, seq_num ) ;
+
+ fdd_dir.last_mod_date = cur_dir->last_mod_date ;
+ fdd_dir.create_date = cur_dir->create_date ;
+ fdd_dir.backup_date = cur_dir->backup_date ;
+ fdd_dir.last_access_date = cur_dir->last_access_date ;
+ fdd_dir.dir_attribs = cur_dir->directory_attribs ;
+ fdd_dir.os_info.data_size = 0 ;
+ fdd_dir.os_info.data_offset = 0 ;
+
+ /* Here we need to get a path which may not be in the buffer with the
+ DBLK (path in stream). We have a special buffer for this in the
+ environment, which we pass to the file system to fill out. If the
+ size currently allocated to this buffer isn't big enough, we need
+ to reallocate.
+ */
+ if( fdd_dir.dir_attribs & DIR_PATH_IN_STREAM_BIT ) {
+ fdd_dir.dir_attribs &= ~DIR_PATH_IN_STREAM_BIT ;
+ fdd_dir.dir_name.data_size = FS_SizeofOSPathInDDB( channel->cur_fsys, channel->cur_dblk ) ;
+ if( cur_env->util_buff_size < fdd_dir.dir_name.data_size ) {
+ new_size = cur_env->util_buff_size ;
+ while( new_size < fdd_dir.dir_name.data_size ) {
+ new_size += F40_UTIL_BUFF_INC ;
+ }
+ if( ( temp = realloc( cur_env->util_buff, new_size ) ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ } else {
+ cur_env->util_buff = temp ;
+ cur_env->util_buff_size = new_size ;
+ }
+ }
+ str_ptr = cur_env->util_buff ;
+ FS_GetOSPathFromDDB( channel->cur_fsys, channel->cur_dblk, (CHAR_PTR)( str_ptr ) ) ;
+ } else {
+ str_ptr = (UINT8_PTR)cur_dir + cur_dir->directory_name.data_offset ;
+ fdd_dir.dir_name.data_size = cur_dir->directory_name.data_size ;
+ }
+
+ fdd_dir.dir_name.data_offset = sizeof( MTF_FDD_HDR )
+ + sizeof( MTF_FDD_DIR_V2 ) ;
+
+ fdd_hdr.length = sizeof( MTF_FDD_HDR ) + sizeof( MTF_FDD_DIR_V2 )
+ + fdd_dir.dir_name.data_size ;
+
+ if( OTC_SetDirLink( cur_env, &fdd_hdr, str_ptr,
+ fdd_dir.dir_name.data_size ) != TFLE_NO_ERR ) {
+
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* for setting the corrupt file bit later (if necessary) */
+ if( !( fdd_hdr.blk_attribs & MTF_DB_CONT_BIT ) ) {
+ cur_env->last_fdd_offset = ftell( fptr ) ;
+ cur_env->last_fdd_type = FDD_DIR_BLK ;
+ }
+
+ if( fwrite( &fdd_dir, sizeof( MTF_FDD_DIR_V2 ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fdd_dir.dir_name.data_size != 0 ) {
+ if( fwrite( str_ptr, 1, fdd_dir.dir_name.data_size, fptr )
+ != fdd_dir.dir_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GenDBDBEntry
+
+ Description: Generates an OTC database entry and writes it to the
+ FDD temporary file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+INT16 OTC_GenDBDBEntry(
+ CHANNEL_PTR channel,
+ F40_DBDB_PTR cur_dbdb,
+ INT16 seq_num )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ MTF_FDD_HDR fdd_hdr ;
+ F40_FDD_DBDB fdd_dbdb ;
+ UINT8_PTR str_ptr ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ void * temp ;
+ UINT16 new_size ;
+
+ /* DO NOT UNICODEIZE THIS CONSTANT!!! */
+ memcpy( fdd_hdr.type, "DBDB", 4 ) ;
+ OTC_SetFDDHeaderFields( &fdd_hdr, &cur_dbdb->block_hdr, seq_num ) ;
+
+ fdd_dbdb.backup_date = cur_dbdb->backup_date ;
+ fdd_dbdb.database_attribs = cur_dbdb->database_attribs ;
+ fdd_dbdb.os_info.data_size = 0 ;
+ fdd_dbdb.os_info.data_offset = 0 ;
+
+ str_ptr = (UINT8_PTR)cur_dbdb + cur_dbdb->database_name.data_offset ;
+ fdd_dbdb.database_name.data_size = cur_dbdb->database_name.data_size ;
+
+ fdd_dbdb.database_name.data_offset = sizeof( MTF_FDD_HDR )
+ + sizeof( F40_FDD_DBDB ) ;
+
+ fdd_hdr.length = sizeof( MTF_FDD_HDR ) + sizeof( F40_FDD_DBDB )
+ + fdd_dbdb.database_name.data_size ;
+
+ fdd_hdr.link = 0 ;
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* for setting the corrupt file bit later (if necessary) */
+ if( !( fdd_hdr.blk_attribs & MTF_DB_CONT_BIT ) ) {
+ cur_env->last_fdd_offset = ftell( fptr ) ;
+ cur_env->last_fdd_type = FDD_DBDB_BLK ;
+ }
+
+ if( fwrite( &fdd_dbdb, sizeof( F40_FDD_DBDB ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fdd_dbdb.database_name.data_size != 0 ) {
+ if( fwrite( str_ptr, 1, fdd_dbdb.database_name.data_size, fptr )
+ != fdd_dbdb.database_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GenFileEntry
+
+ Description: Generates an OTC file entry and writes it to the FDD
+ temporary file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+INT16 OTC_GenFileEntry(
+ F40_ENV_PTR cur_env,
+ MTF_FILE_PTR cur_file,
+ INT16 seq_num )
+{
+ MTF_FDD_HDR fdd_hdr ;
+ MTF_FDD_FILE_V2 fdd_file ;
+ UINT8_PTR str_ptr = (UINT8_PTR)cur_file ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+
+ /* DO NOT UNICODEIZE THIS CONSTANT!!! */
+ memcpy( fdd_hdr.type, "FILE", 4 ) ;
+ OTC_SetFDDHeaderFields( &fdd_hdr, &cur_file->block_hdr, seq_num ) ;
+
+ fdd_file.last_mod_date = cur_file->last_mod_date ;
+ fdd_file.last_access_date = cur_file->last_access_date ;
+ fdd_file.create_date = cur_file->create_date ;
+ fdd_file.backup_date = cur_file->backup_date ;
+ fdd_file.file_attribs = cur_file->file_attributes ;
+ fdd_file.os_info.data_size = 0 ;
+ fdd_file.os_info.data_offset = 0 ;
+ fdd_file.file_name.data_size = cur_file->file_name.data_size ;
+ fdd_file.file_name.data_offset = sizeof( MTF_FDD_HDR )
+ + sizeof( MTF_FDD_FILE_V2 ) ;
+
+ fdd_hdr.length = sizeof( MTF_FDD_HDR ) + sizeof( MTF_FDD_FILE_V2 )
+ + fdd_file.file_name.data_size ;
+
+ /* Set link to parent directory */
+ fdd_hdr.link = cur_env->dir_links[cur_env->dir_level] ;
+
+ str_ptr += cur_file->file_name.data_offset ;
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* for setting the corrupt file bit later (if necessary) */
+ if( !( fdd_hdr.blk_attribs & MTF_DB_CONT_BIT ) ) {
+ cur_env->last_fdd_offset = ftell( fptr ) ;
+ cur_env->last_fdd_type = FDD_FILE_BLK ;
+ }
+
+ if( fwrite( &fdd_file, sizeof( MTF_FDD_FILE_V2 ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fdd_file.file_name.data_size != 0 ) {
+ if( fwrite( str_ptr, 1, fdd_file.file_name.data_size, fptr )
+ != fdd_file.file_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GenEndEntry
+
+ Description: Generates an OTC End-of-FDD entry and writes it to the
+ FDD temporary file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+INT16 OTC_GenEndEntry(
+ CHANNEL_PTR channel )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ MTF_FDD_HDR fdd_hdr ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ UINT16 len ;
+
+ memset( &fdd_hdr, 0, sizeof( MTF_FDD_HDR ) ) ;
+
+ /* DO NOT UNICODEIZE THIS CONSTANT!!! */
+ memcpy( fdd_hdr.type, "FEND", 4 ) ;
+
+ /* Set length to include pad out to physical block boundary */
+ len = (UINT16)( ( ftell( fptr ) +
+ sizeof( MTF_STREAM ) +
+ sizeof( MTF_FDD_HDR ) ) % ChannelBlkSize( channel ) ) ;
+ fdd_hdr.length = ChannelBlkSize( channel ) - len ;
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fflush( fptr ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* Set up the link fields */
+ if( OTC_ReverseLinks( cur_env ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_GenSMEntry
+
+ Description: Generates an OTC Set Map entry and writes it to the SM
+ temporary file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes:
+
+**/
+INT16 OTC_GenSMEntry(
+ MTF_SSET_PTR cur_sset,
+ CHANNEL_PTR channel,
+ BOOLEAN continuation )
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ MTF_SM_ENTRY sm_entry ;
+ UINT8_PTR str_ptr ;
+ UINT16 offset = sizeof( MTF_SM_ENTRY ) ;
+ FILE * fptr = cur_env->otc_sm_fptr ;
+
+ sm_entry.seq_num = channel->ts_num ;
+ sm_entry.set_num = cur_sset->backup_set_number ;
+ sm_entry.blk_attribs = cur_sset->block_hdr.block_attribs ;
+ sm_entry.set_attribs = cur_sset->sset_attribs ;
+ sm_entry.sset_pba = cur_sset->physical_block_address ;
+ sm_entry.lba = cur_sset->block_hdr.logical_block_address ;
+ sm_entry.backup_date = cur_sset->backup_date ;
+ sm_entry.os_id = cur_sset->block_hdr.machine_os_id ;
+ sm_entry.os_ver = cur_sset->block_hdr.machine_os_version ;
+ sm_entry.disp_size = cur_sset->block_hdr.displayable_size ;
+ sm_entry.num_volumes = 1 ;
+ sm_entry.time_zone = cur_sset->time_zone ;
+ sm_entry.pswd_encr_algor = cur_sset->password_encryption_algor ;
+ sm_entry.string_type = cur_sset->block_hdr.string_type ;
+ sm_entry.tf_minor_ver = cur_sset->tf_minor_ver ;
+ sm_entry.tape_cat_ver = cur_sset->tape_cat_ver ;
+
+ if( ( sm_entry.set_name.data_size =
+ cur_sset->backup_set_name.data_size ) != 0 ) {
+ sm_entry.set_name.data_offset = offset ;
+ offset += sm_entry.set_name.data_size ;
+ } else {
+ sm_entry.set_name.data_offset = 0 ;
+ }
+
+ if( ( sm_entry.password.data_size =
+ cur_sset->backup_set_password.data_size ) != 0 ) {
+ sm_entry.password.data_offset = offset ;
+ offset += sm_entry.password.data_size ;
+ } else {
+ sm_entry.password.data_offset = 0 ;
+ }
+
+ if( ( sm_entry.set_descr.data_size =
+ cur_sset->backup_set_description.data_size ) != 0 ) {
+ sm_entry.set_descr.data_offset = offset ;
+ offset += sm_entry.set_descr.data_size ;
+ } else {
+ sm_entry.set_descr.data_offset = 0 ;
+ }
+
+ if( ( sm_entry.user_name.data_size =
+ cur_sset->user_name.data_size ) != 0 ) {
+ sm_entry.user_name.data_offset = offset ;
+ } else {
+ sm_entry.user_name.data_offset = 0 ;
+ }
+
+ sm_entry.length = sizeof( MTF_SM_ENTRY ) + sm_entry.set_name.data_size
+ + sm_entry.password.data_size
+ + sm_entry.set_descr.data_size
+ + sm_entry.user_name.data_size ;
+
+ if( fseek( fptr, 0L, SEEK_END ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ /* for setting the remainder of the SM fields */
+ if( !continuation ) {
+ cur_env->last_sm_offset = ftell( fptr ) ;
+ } else {
+ cur_env->cont_sm_offset = ftell( fptr ) ;
+ }
+
+ if( fwrite( &sm_entry, sizeof( MTF_SM_ENTRY ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( sm_entry.set_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_sset + cur_sset->backup_set_name.data_offset ;
+ if( fwrite( str_ptr, 1, sm_entry.set_name.data_size, fptr )
+ != sm_entry.set_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ if( sm_entry.password.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_sset + cur_sset->backup_set_password.data_offset ;
+ if( fwrite( str_ptr, 1, sm_entry.password.data_size, fptr )
+ != sm_entry.password.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ if( sm_entry.set_descr.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_sset + cur_sset->backup_set_description.data_offset ;
+ if( fwrite( str_ptr, 1, sm_entry.set_descr.data_size, fptr )
+ != sm_entry.set_descr.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+ if( sm_entry.user_name.data_size != 0 ) {
+ str_ptr = (UINT8_PTR)cur_sset + cur_sset->user_name.data_offset ;
+ if( fwrite( str_ptr, 1, sm_entry.user_name.data_size, fptr )
+ != sm_entry.user_name.data_size ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_UpdateSMEntry
+
+ Description: Updates all Set Map entries for the current backup with
+ information which is not available until the backup has
+ completed, and writes the updated entries to the SM
+ temporary file.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+INT16 OTC_UpdateSMEntry(
+ F40_ENV_PTR cur_env )
+{
+ MTF_SM_ENTRY sm_entry ;
+ MTF_FDD_HDR fdd_hdr ;
+ FILE * fptr = cur_env->otc_sm_fptr ;
+ long pos = cur_env->last_sm_offset ;
+ UINT16 count = cur_env->sm_count ;
+
+ while( count != 0 ) {
+ if( fseek( fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fread( &sm_entry, sizeof( MTF_SM_ENTRY ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ if( cur_env->cur_otc_level == TCL_FULL && !cur_env->fdd_aborted ) {
+ sm_entry.fdd_pba = U64_Init( cur_env->fdd_pba, 0L ) ;
+ sm_entry.fdd_seq_num = cur_env->fdd_seq_num ;
+ } else {
+ sm_entry.fdd_pba = U64_Init( 0L, 0L ) ;
+ sm_entry.fdd_seq_num = 0 ;
+ }
+
+ sm_entry.num_dirs = cur_env->dir_count ;
+ sm_entry.num_files = cur_env->file_count ;
+ sm_entry.num_corrupt_files = cur_env->corrupt_obj_count ;
+
+ if( fseek( fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fwrite( &sm_entry, sizeof( MTF_SM_ENTRY ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ if( --count != 0 ) {
+ pos += sm_entry.length ;
+ if( fseek( fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ pos += fdd_hdr.length ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_MarkLastEntryCorrupt
+
+ Description: Called when the last object backed up is found to be
+ corrupt, this function reads the last FDD entry from
+ the temporary file, sets the corrupt bit in the
+ attribute field, and writes it back out.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+INT16 OTC_MarkLastEntryCorrupt(
+ F40_ENV_PTR cur_env )
+{
+ union {
+ MTF_FDD_DIR_V2 d ;
+ MTF_FDD_FILE_V2 f ;
+ F40_FDD_DBDB db ;
+ } fdd_entry ;
+
+// FDD_ENTRY fdd_entry ;
+
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ size_t size ;
+
+ switch( cur_env->last_fdd_type ) {
+
+ case FDD_DIR_BLK:
+ size = sizeof( MTF_FDD_DIR_V2 ) ;
+ break ;
+
+ case FDD_FILE_BLK:
+ size = sizeof( MTF_FDD_FILE_V2 ) ;
+ break ;
+
+ case FDD_DBDB_BLK:
+ size = sizeof( F40_FDD_DBDB ) ;
+ break ;
+
+ default:
+ msassert( FALSE ) ;
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ if( fseek( fptr, cur_env->last_fdd_offset, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fread( &fdd_entry, 1, size, fptr ) != size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ switch( cur_env->last_fdd_type ) {
+
+ case FDD_DIR_BLK:
+ fdd_entry.d.dir_attribs |= OBJ_CORRUPT_BIT ;
+ break ;
+
+ case FDD_FILE_BLK:
+ fdd_entry.f.file_attribs |= OBJ_CORRUPT_BIT ;
+ break ;
+
+ case FDD_DBDB_BLK:
+ fdd_entry.db.database_attribs |= OBJ_CORRUPT_BIT ;
+ break ;
+ }
+
+ if( fseek( fptr, cur_env->last_fdd_offset, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fwrite( &fdd_entry, 1, size, fptr ) != size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fseek( fptr, 0, SEEK_END ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_ReverseLinks
+
+ Description: When this function is called, the link fields in the
+ directory and volume entries contain the file offset of
+ the entry who's link field SHOULD point at them. This
+ function traverses back through these "backward" links
+ and makes them foreward links.
+
+ Returns: TFLE_xxx error code
+
+ Notes: In the case of directory links, if the back link is
+ negative it indicates that the previous directory at
+ that tree level does not have the same parent. In this
+ case we use the link field to get to the previous entry,
+ but we don't put in a foreward link.
+
+**/
+static INT _near OTC_ReverseLinks(
+ F40_ENV_PTR cur_env )
+{
+ UINT16 level ;
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ long prev_link ;
+ long curr_link ;
+ long next_link ;
+
+ curr_link = cur_env->last_volb ;
+ next_link = 0L ;
+ while( curr_link != -1L ) {
+ if( OTC_SetLink( fptr, curr_link, next_link, &prev_link ) != TFLE_NO_ERR ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ next_link = curr_link ;
+ curr_link = prev_link ;
+ }
+
+ for( level = 0; level <= cur_env->max_dir_level; level++ ) {
+ curr_link = cur_env->dir_links[level] ;
+ next_link = 0L ;
+ while( curr_link != 0L ) {
+ if( OTC_SetLink( fptr, curr_link, next_link, &prev_link ) != TFLE_NO_ERR ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( prev_link < 0L ) {
+ next_link = 0L ;
+ curr_link = - prev_link ;
+ } else {
+ next_link = curr_link ;
+ curr_link = prev_link ;
+ }
+ }
+ }
+
+ /* Set the file pointer back to the end */
+ if( fseek( fptr, 0L, SEEK_END ) != 0 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_SetLink
+
+ Description: This function seeks to the given file position,
+ reads in the FDD_HDR at that location, sets the
+ 'prev_link' parameter to the contents of the link
+ field in the header, sets the link field to the given
+ 'next_link' value and rewrites the header.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+static INT _near OTC_SetLink(
+ FILE * fptr,
+ long curr_link,
+ long next_link,
+ long * prev_link )
+{
+ MTF_FDD_HDR fdd_hdr ;
+
+ if( fseek( fptr, curr_link, SEEK_SET ) != 0 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+
+ *prev_link = fdd_hdr.link ;
+ fdd_hdr.link = next_link ;
+
+ if( fseek( fptr, curr_link, SEEK_SET ) != 0 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fptr ) != 1 ) {
+ return( TFLE_OTC_FAILURE ) ;
+ }
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_PreprocessEOM
+
+ Description: This function copies the FDD data into a temporary file,
+ rewinds the FDD file, and writes the entries which
+ actually made it on to the first tape to the FDD file.
+ This is done in preparation for writing the continuation
+ entries.
+
+ Returns: TFLE_xxx error code
+
+ Notes: After the continuation entries are written, the function
+ OTC_PostprocessEOM will be called to write the remaining
+ entries in the temporary file back to the FDD file, and
+ delete the temporary file.
+
+ OTC_Close will also close and delete the EOM temporary
+ file since this isn't the only function using it, so we
+ open it here, but we don't explicitly close it if there
+ is an error.
+
+ Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+
+INT16 OTC_PreprocessEOM(
+ F40_ENV_PTR cur_env, /* The format environment */
+ UINT32 cross_lba ) /* The LBA of the crossing entry */
+{
+ FILE * fdd_fptr = cur_env->otc_fdd_fptr ;
+ FILE * tmp_fptr ;
+ UINT8_PTR buff_ptr ;
+ UINT8_PTR str_ptr ;
+ size_t size ;
+ UINT16 len ;
+ MTF_FDD_HDR fdd_hdr ;
+ BOOLEAN first = TRUE ;
+ long hdr_size = (long)sizeof( MTF_FDD_HDR ) ;
+ UNALIGNED MTF_FDD_DIR_V2 * fdd_dir ;
+ INT32 save_link ;
+ void * temp ;
+ UINT16 new_size ;
+
+ msassert( cur_env->otc_fdd_fptr != NULL ) ;
+ msassert( cur_env->otc_eom_fptr == NULL ) ;
+
+ /* Make sure we have utility buffer space allocated */
+ if( cur_env->util_buff == NULL ) {
+ if( ( cur_env->util_buff = calloc( F40_INIT_UTIL_BUFF_SIZE, 1 ) ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ cur_env->util_buff_size = F40_INIT_UTIL_BUFF_SIZE ;
+ }
+ buff_ptr = cur_env->util_buff ;
+
+ /* Open the temp file */
+ strcpy( lw_cat_file_path_end, TEXT("EMXXXXXX") ) ;
+ if( msmktemp( lw_cat_file_path ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ strcat( lw_cat_file_path, TEXT(".FDD") ) ;
+ strcpy( cur_env->eom_fname, lw_cat_file_path_end ) ;
+ if( ( cur_env->otc_eom_fptr = UNI_fopen( lw_cat_file_path, 0 ) ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ tmp_fptr = cur_env->otc_eom_fptr ;
+
+ /* Rewind the FDD file, and copy it to the temp file */
+ if( fseek( fdd_fptr, 0L, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ while( !feof( fdd_fptr ) ) {
+ size = fread( buff_ptr, 1, cur_env->util_buff_size, fdd_fptr ) ;
+ if( ferror( fdd_fptr ) ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( size != 0 ) {
+ if( fwrite( buff_ptr, 1, size, tmp_fptr ) != size ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ first = FALSE ;
+ } else {
+ if( first ) { // Nothing to transfer
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+ }
+
+ /* Rewind the temp file, clear the FDD file, and copy all entries
+ with LBAs less than the crossing LBA.
+ */
+ if( fseek( tmp_fptr, 0L, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ fclose( cur_env->otc_fdd_fptr ) ;
+ cur_env->otc_fdd_fptr = NULL ;
+ if( OTC_OpenFDD( cur_env ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ fdd_fptr = cur_env->otc_fdd_fptr ;
+
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, tmp_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* We're going to reset all the dir links */
+ cur_env->dir_links[0] = 0L ;
+ cur_env->dir_level = 0 ;
+ cur_env->max_dir_level = 0 ;
+
+ while( !feof( tmp_fptr ) && U64_Lsw( fdd_hdr.lba ) < cross_lba ) {
+ len = fdd_hdr.length - sizeof( MTF_FDD_HDR ) ;
+
+ if( cur_env->util_buff_size < len ) {
+ new_size = cur_env->util_buff_size + F40_UTIL_BUFF_INC ;
+ if( ( temp = realloc( cur_env->util_buff, new_size ) ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ } else {
+ cur_env->util_buff = temp ;
+ cur_env->util_buff_size = new_size ;
+ buff_ptr = cur_env->util_buff ;
+ }
+ }
+
+ if( fread( buff_ptr, 1, len, tmp_fptr ) != len ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* DO NOT UNICODEIZE THE FOLLOWING CONSTANT!!! */
+ if( memcmp( fdd_hdr.type, "DIRB", 4 ) == 0 ) {
+
+ fdd_dir = (UNALIGNED MTF_FDD_DIR_V2 *)(void *)( buff_ptr ) ;
+ str_ptr = buff_ptr + ( fdd_dir->dir_name.data_offset -
+ sizeof( MTF_FDD_HDR ) ) ;
+ save_link = fdd_hdr.link ;
+
+ if( OTC_SetDirLink( cur_env, &fdd_hdr, str_ptr,
+ fdd_dir->dir_name.data_size ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ msassert( save_link == fdd_hdr.link ) ;
+ }
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fdd_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fwrite( buff_ptr, 1, len, fdd_fptr ) != len ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, tmp_fptr ) != 1 ) {
+ if( !feof( tmp_fptr ) ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+ }
+
+ if( !feof( tmp_fptr ) ) {
+ if( fseek( tmp_fptr, -hdr_size, SEEK_CUR ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_PostProcessEOM
+
+ Description: This function adjusts the LBAs in the continuation
+ entries in the Set Map and FDD since we don't know
+ what they really are until after they're written.
+ If FDD is being written, it then copies the remainder
+ of the EOM temporary FDD file to the actual FDD file.
+
+ Returns: TFLE_xxx error code
+
+ Notes: It is assumed the prior to calling this function,
+ OTC_PreprocessEOM has been called, and the continuation
+ FDD entries have been appended to the FDD file.
+
+ OTC_Close will also close and delete the EOM temporary
+ file since this isn't the only function using it, so we
+ open it here, but we don't explicitly close it if there
+ is an error. If the operation completes successfully,
+ the we explicitly close and delete it since we don't
+ want it sitting around until OTC close in called.
+
+ Currently always returns TFLE_NO_ERR since failed writes
+ to disk are handled internally and shouldn't cause a
+ backup to be aborted.
+
+**/
+
+INT16 OTC_PostprocessEOM(
+ CHANNEL_PTR channel,
+ UINT32 sset_lba ) /* LBA of the continuation SSET */
+{
+ F40_ENV_PTR cur_env = (F40_ENV_PTR)(channel->fmt_env) ;
+ FILE * fdd_fptr = cur_env->otc_fdd_fptr ;
+ FILE * tmp_fptr = cur_env->otc_eom_fptr ;
+ FILE * sm_fptr = cur_env->otc_sm_fptr ;
+ UINT8_PTR buff_ptr ;
+ size_t size ;
+ UINT16 len ;
+ MTF_FDD_HDR fdd_hdr ;
+ MTF_SM_ENTRY sm_entry ;
+ long pos = cur_env->cont_sm_offset ;
+ long count ;
+ BOOLEAN done ;
+ UNALIGNED MTF_FDD_DIR_V2 * fdd_dir ;
+ void * temp ;
+ UINT16 new_size ;
+ UINT8_PTR str_ptr ;
+ int ret ;
+
+ msassert( cur_env->otc_sm_fptr != NULL ) ;
+
+ /* This grotesque little conditional checks to see if we wrote the SSET
+ on the last tape but fell short of writing the VOLB, or if we are
+ crossing tape during CloseSet processing. In either case, there
+ aren't any continuation entries to adjust the LBAs in.
+ */
+ if( ( channel->lst_tblk != BT_VCB || channel->eom_buff == NULL ||
+ BM_NextByteOffset( channel->eom_buff ) != F40_LB_SIZE ) &&
+ !IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+
+ /* Adjust the SSET LBA */
+ if( fseek( sm_fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fread( &sm_entry, sizeof( MTF_SM_ENTRY ), 1, sm_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = TRUE ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ sm_entry.lba = U64_Init( sset_lba, 0L ) ;
+
+ if( fseek( sm_fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fwrite( &sm_entry, sizeof( MTF_SM_ENTRY ), 1, sm_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* Adjust the LBA of the VOLB in the Set Map */
+ pos += sm_entry.length ;
+ if( fseek( sm_fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, sm_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ fdd_hdr.lba = U64_Init( sset_lba + 1L, 0L ) ;
+
+ if( fseek( sm_fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, sm_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* Set file pointer to end */
+ if( fseek( sm_fptr, 0L, SEEK_END ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_ALL, TRUE ) ;
+ cur_env->sm_aborted = cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* Adjust the LBAs of the continuation FDD entries */
+ if( cur_env->cur_otc_level == TCL_FULL && !cur_env->fdd_aborted ) {
+ pos = cur_env->last_volb ;
+ count = 1L ;
+ done = FALSE ;
+ while( !done ) {
+ if( fseek( fdd_fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fdd_fptr ) != 1 ) {
+ if( feof( fdd_fptr ) ) {
+ done = TRUE ;
+ } else {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+ if( !done ) {
+ fdd_hdr.lba = U64_Init( sset_lba + count, 0L ) ;
+ count++ ;
+ if( fseek( fdd_fptr, pos, SEEK_SET ) != 0 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fdd_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ pos += fdd_hdr.length ;
+ }
+ }
+ }
+ }
+
+ if( cur_env->cur_otc_level != TCL_FULL || cur_env->fdd_aborted ||
+ IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+
+ /* Not doing FDD, or done with it, so skip the next part */
+ return( TFLE_NO_ERR ) ;
+ }
+
+ msassert( cur_env->otc_fdd_fptr != NULL ) ;
+ msassert( cur_env->otc_eom_fptr != NULL ) ;
+
+ /* Make sure we have utility buffer space allocated */
+ if( cur_env->util_buff == NULL ) {
+ if( ( cur_env->util_buff = calloc( F40_INIT_UTIL_BUFF_SIZE, 1 ) ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ cur_env->util_buff_size = F40_INIT_UTIL_BUFF_SIZE ;
+ }
+ buff_ptr = cur_env->util_buff ;
+
+ /* Copy the remainder of the temp file to the FDD file */
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, tmp_fptr ) != 1 ) {
+ if( !feof( tmp_fptr ) ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ while( !feof( tmp_fptr ) ) {
+
+ len = fdd_hdr.length - sizeof( MTF_FDD_HDR ) ;
+
+ if( cur_env->util_buff_size < len ) {
+ new_size = cur_env->util_buff_size + F40_UTIL_BUFF_INC ;
+ if( ( temp = realloc( cur_env->util_buff, new_size ) ) == NULL ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ } else {
+ cur_env->util_buff = temp ;
+ cur_env->util_buff_size = new_size ;
+ buff_ptr = cur_env->util_buff ;
+ }
+ }
+
+ if( fread( buff_ptr, 1, len, tmp_fptr ) != len ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ fdd_hdr.seq_num++ ;
+
+ /* DO NOT UNICODEIZE THE FOLLOWING CONSTANT!!! */
+ if( memcmp( fdd_hdr.type, "DIRB", 4 ) == 0 ) {
+
+ fdd_dir = (UNALIGNED MTF_FDD_DIR_V2 *)(void *)( buff_ptr ) ;
+ str_ptr = (UINT8_PTR)( buff_ptr +
+ ( fdd_dir->dir_name.data_offset -
+ sizeof( MTF_FDD_HDR ) ) ) ;
+
+ if( OTC_SetDirLink( cur_env, &fdd_hdr, str_ptr,
+ fdd_dir->dir_name.data_size ) != TFLE_NO_ERR ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ /* DO NOT UNICODEIZE THE FOLLOWING CONSTANT!!! */
+ if( memcmp( fdd_hdr.type, "FILE", 4 ) == 0 ) {
+ fdd_hdr.link = cur_env->dir_links[cur_env->dir_level] ;
+ }
+
+ if( fwrite( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, fdd_fptr ) != 1 ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ /* DO NOT UNICODEIZE THE FOLLOWING CONSTANTS!!! */
+ if( memcmp( fdd_hdr.type, "DIRB", 4 ) == 0 ) {
+ cur_env->last_fdd_type = FDD_DIR_BLK ;
+ cur_env->last_fdd_offset = ftell( fdd_fptr ) ;
+ } else if( memcmp( fdd_hdr.type, "DBDB", 4 ) == 0 ) {
+ cur_env->last_fdd_type = FDD_DBDB_BLK ;
+ cur_env->last_fdd_offset = ftell( fdd_fptr ) ;
+ } else if( memcmp( fdd_hdr.type, "FILE", 4 ) == 0 ) {
+ cur_env->last_fdd_type = FDD_FILE_BLK ;
+ cur_env->last_fdd_offset = ftell( fdd_fptr ) ;
+ }
+
+ if( fwrite( buff_ptr, 1, len, fdd_fptr ) != len ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+
+ if( fread( &fdd_hdr, sizeof( MTF_FDD_HDR ), 1, tmp_fptr ) != 1 ) {
+ if( !feof( tmp_fptr ) ) {
+ OTC_Close( cur_env, OTC_CLOSE_FDD, TRUE ) ;
+ cur_env->fdd_aborted = TRUE ;
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+ }
+
+ /* Close and delete the temp file */
+ fflush( cur_env->otc_eom_fptr ) ;
+ ret = fclose( cur_env->otc_eom_fptr ) ;
+ msassert( ret == 0 ) ;
+ cur_env->otc_eom_fptr = NULL ;
+ strcpy( lw_cat_file_path_end, cur_env->eom_fname ) ;
+ remove( lw_cat_file_path ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Translators
+
+ Name: OTC_SetDirLink
+
+ Description: This function sets the link field to the previous
+ directory at the same level, if the previous directory
+ is from a new different tree, we make the link value
+ negative to indicate this. This is all done so that at
+ the end of the backup we can traverse back through the
+ directories setting foreward links from each directory
+ to its next sibling.
+
+ Returns: INT16 - TFLE_xxx
+
+ Notes: This function relies on the str_ptr being on a two byte
+ boundary if the path is a Unicode string, and we are
+ running on a machine which requires even byte alignment
+ for 2 byte characters (such as the MIPS). We don't
+ want to use an unaligned pointer as this would slow
+ us down too much.
+
+**/
+static INT16 _near OTC_SetDirLink(
+ F40_ENV_PTR cur_env,
+ MTF_FDD_HDR_PTR fdd_hdr,
+ UINT8_PTR str_ptr,
+ UINT16 size )
+{
+ FILE * fptr = cur_env->otc_fdd_fptr ;
+ UINT16 level ;
+ void * temp ;
+ UINT16 new_size ;
+ WCHAR_PTR wp ;
+ UNALIGNED WCHAR_PTR uwp ;
+ ACHAR_PTR ap ;
+ int i ;
+
+ if( fdd_hdr->string_type == BEC_ANSI_STR ) { // Path is an ASCII string.
+
+ if( size == 1 ) {
+ level = 0 ;
+ } else {
+ level = 1 ;
+ size-- ;
+ for( i = 0, ap = (ACHAR_PTR)str_ptr; i < size; i++, ap++ ) {
+ if( *ap == (ACHAR)('\0') ) {
+ level++ ;
+ }
+ }
+ }
+ } else { // Path is a Unicode string.
+
+ if( (UINT32)str_ptr & 1 ) {
+ if( size == 2 ) {
+ level = 0 ;
+ } else {
+ level = 1 ;
+ size -= 2 ;
+ for( i = 0, uwp = (UNALIGNED WCHAR_PTR)str_ptr; i < size; i += 2, uwp++ ) {
+ if( *uwp == (WCHAR)('\0') ) {
+ level++ ;
+ }
+ }
+ }
+ } else {
+ if( size == 2 ) {
+ level = 0 ;
+ } else {
+ level = 1 ;
+ size -= 2 ;
+ for( i = 0, wp = (WCHAR_PTR)str_ptr; i < size; i += 2, wp++ ) {
+ if( *wp == (WCHAR)('\0') ) {
+ level++ ;
+ }
+ }
+ }
+ }
+ }
+
+ if( level > cur_env->dir_level ) {
+ if( level > cur_env->max_dir_level ) {
+
+ if( level == cur_env->dir_links_size ) {
+ new_size = cur_env->dir_links_size + F40_DIR_LINKS_INC ;
+ if( ( temp = realloc( cur_env->dir_links,
+ new_size * sizeof( long ) ) ) == NULL ) {
+
+ return( TFLE_NO_MEMORY ) ;
+ } else {
+ cur_env->dir_links_size = new_size ;
+ cur_env->dir_links = temp ;
+ }
+ }
+
+ for( i = cur_env->max_dir_level + 1; i < level; i++ ) {
+ cur_env->dir_links[i] = 0L ;
+ }
+
+ fdd_hdr->link = 0L ;
+ cur_env->max_dir_level = level ;
+ } else {
+ if( cur_env->dir_links[level] == 0L ) {
+ fdd_hdr->link = 0L ;
+ } else {
+ fdd_hdr->link = - cur_env->dir_links[level] ;
+ }
+ }
+ } else {
+ fdd_hdr->link = cur_env->dir_links[level] ;
+ }
+
+ cur_env->dir_level = level ;
+ cur_env->dir_links[level] = ftell( fptr ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
diff --git a/private/utils/ntbackup/src/parspath.c b/private/utils/ntbackup/src/parspath.c
new file mode 100644
index 000000000..6b42c3a68
--- /dev/null
+++ b/private/utils/ntbackup/src/parspath.c
@@ -0,0 +1,1104 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: parspath.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file is responsible for seperating the drive,
+ path name, and file name, from a text string.
+
+
+ $Log: M:/LOGFILES/PARSPATH.C_V $
+
+ Rev 1.19.1.2 19 Nov 1993 12:46:26 BARRY
+Unicode fix: improper path sizes were being returned.
+
+ Rev 1.19.1.1 18 Aug 1993 18:20:18 BARRY
+Removed temp Unicode fix and call strcspn since it is in stdwcs.c now
+
+ Rev 1.19.1.0 13 Aug 1993 15:44:44 TIMN
+Changed ALPHA define to ALTTER due to DECs ALPHA machine conflicts
+
+ Rev 1.19 19 Feb 1993 09:31:56 STEVEN
+fix steve's forgoen NULL
+
+ Rev 1.18 12 Feb 1993 09:01:02 STEVEN
+fix typo
+
+ Rev 1.17 11 Feb 1993 15:25:30 STEVEN
+fixe defined from define
+
+ Rev 1.16 11 Feb 1993 11:53:50 STEVEN
+win32 does large paths
+
+ Rev 1.13 04 Jan 1993 09:40:22 MIKEP
+temporary unicode fix
+
+ Rev 1.12 02 Dec 1992 17:00:16 CHUCKB
+Casted to remove a warning. You might say the warning was cast out...
+
+ Rev 1.11 11 Nov 1992 09:53:50 GREGG
+Unicodeized literals.
+
+ Rev 1.10 06 Oct 1992 09:23:14 ChuckS
+Got by mistake, but fixed typo anyway
+
+ Rev 1.9 05 Oct 1992 17:05:58 DAVEV
+Unicode strlen verification
+
+ Rev 1.8 18 Aug 1992 10:28:38 STEVEN
+fix warnings
+
+ Rev 1.7 28 Jul 1992 15:38:14 STEVEN
+fix warnings
+
+ Rev 1.6 24 Mar 1992 10:10:58 DON
+if *path is '\0' and psize is 0 then psize is 1
+
+ Rev 1.5 13 Jan 1992 18:46:38 STEVEN
+changes for WIN32 compile
+
+ Rev 1.4 06 Aug 1991 18:32:20 DON
+added NLM File System support
+
+ Rev 1.3 25 Jul 1991 16:32:26 BARRY
+Finish #ifdef changes, remove warnings.
+
+ Rev 1.2 04 Jun 1991 11:28:46 BARRY
+Starting to make #defines not product specific--more to come.
+
+ Rev 1.1 29 May 1991 13:51:08 CARLS
+added valid sregs pointers for intdosx calls for windows
+
+ Rev 1.0 09 May 1991 13:38:46 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#if defined( OS_OS2 )
+#define INCL_DOS
+#include <os2.h>
+#else
+#include <dos.h>
+#endif
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmacro.h"
+
+#include "fsys.h"
+#include "fsys_err.h"
+#include "novcom.h"
+#include "parstab.h" /* must be last include in list */
+#include "msassert.h"
+/* $end$ include list */
+
+
+#define DOS8_3 1
+#define NOV_14 2
+#define OS2_HPFS 3
+#define MAC_SPEC 4
+
+#define BACK_ZERO_DIR 1
+#define BACK_ONE_DIR 2
+
+#define FNAME_ELEM 0
+#define DIR_ELEM_MID 1
+#define DIR_ELEM_TRAIL 2
+
+static CHAR parse_table[6][11] = {
+#if defined ( OS_OS2 ) || defined( OS_WIN32 )
+/* COLON PERIOD BK_SLASH END_OS ALETTER NUMERIC SPECIAL GRAPHIC ANY REMOT_CHAR IMAGE_START */
+/*INITIAL*/ MAC_SPC, DRVDONE, DRVDONE, ERROR, DRV_REL, DRV_REL, DRV_REL, DRV_REL, ERROR, REM_DRV, DRV_REL,
+/*DRV_REL*/ DRVDONE, DRV_REL, DRVDONE, FILEDON, DRV_REL, DRV_REL, DRV_REL, DRV_REL, DRV_REL, ERROR, ERROR,
+/*MAC_SPC*/ MAC_SPC, MAC_SPC, MAC_SPC, ALLDON, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC,
+/*DOS*/ ERROR, DOS, DOS, ALLDON, DOS, DOS, DOS, DOS, ERROR, ERROR, ERROR,
+/*IM_NAME*/ IM_NAME, IM_NAME, IM_NAME, IM_DONE, IM_NAME, IM_NAME, IM_NAME, IM_NAME, IM_NAME, IM_NAME, IM_NAME,
+/*OS2*/ ERROR, OS2, OS2, ALLDON, OS2, OS2, OS2, OS2, OS2, OS2, ERROR
+};
+#else
+/* COLON PERIOD BK_SLASH END_OS ALETTER NUMERIC SPECIAL GRAPHIC ANY REMOT_CHAR IMAGE_START */
+/*INITIAL*/ MAC_SPC, DRVDONE, DRVDONE, ERROR, DRV_REL, DRV_REL, DRV_REL, DRV_REL, ERROR, REM_DRV, IM_NAME,
+/*DRV_REL*/ DRVDONE, DRV_REL, DRVDONE, FILEDON, DRV_REL, DRV_REL, DRV_REL, DRV_REL, DRV_REL, REM_DRV, ERROR,
+/*MAC_SPC*/ MAC_SPC, MAC_SPC, MAC_SPC, ALLDON, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC, MAC_SPC,
+/*DOS*/ ERROR, DOS, DOS, ALLDON, DOS, DOS, DOS, DOS, ERROR, ERROR, ERROR,
+/*IM_NAME*/ IM_NAME, IM_NAME, IM_NAME, IM_DONE, IM_NAME, IM_NAME, IM_NAME, IM_NAME, IM_NAME, IM_NAME, IM_NAME
+};
+#endif
+
+#if defined( FS_IMAGE )
+static INT16 FindImageDLE ( DLE_HAND, CHAR_PTR, GENERIC_DLE_PTR * ) ;
+#endif
+
+static INT16 FindDLE ( DLE_HAND, CHAR_PTR, GENERIC_DLE_PTR * ) ;
+static INT16 InitPathRoot( GENERIC_DLE_PTR dle,
+ CHAR_PTR path,
+ INT16 *pcb_psize,
+ INT16 cb_original_size ) ;
+
+static INT16 ValidateDirElem( CHAR_PTR str, INT16 fmt, INT name_is_dir ) ;
+
+/**/
+/**
+
+ Name: FS_ParsePath()
+
+ Description: The input_text is parsed and the remain parameter are
+ modified to reflect the contents of the input_text. The dle is
+ modified to point to the DLE which represents the drive specified
+ by the input_text. The path name in the input_text is copied in to
+ the memory pointed to by the path parameter. Likewise the file
+ name in the input_text is coppied in to the memory pointed to by
+ the file parameter. If the input_text specifies all the files in
+ a directory then the star_star parameter is set to TRUE otherwise
+ it is set to FALSE.
+
+ Note that if the input_text does not specify a drive then the
+ dle is set to the default DLE. If the input_test does specify
+ a drive but the drive cannot be found then an error is returned.
+
+
+ Modified: 7/20/1989
+
+ Returns: The return value is an error code. They are:
+ DRIVE_NOT_FOUND
+ ATTACH_TO_PARRENT
+ INVALID_PATH_DESCRIPTOR
+ INVALID_FILE_DESCRIPTOR
+ SUCCESS
+
+
+ Notes: If you pass NULL for DLE_HAND then this routine will
+ ignore any drive specification data.
+ If you pass NULL for the file name pointer then this
+ Routine assumes the path does not contain a file name.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_ParsePath( dle_hand, input_text, dle, path, psize, file, star_star )
+DLE_HAND dle_hand;
+CHAR_PTR input_text;
+GENERIC_DLE_PTR *dle ;
+CHAR_PTR path;
+INT16 *psize ;
+CHAR_PTR *file;
+BOOLEAN *star_star;
+{
+ INT16 state = INITIAL ;
+ INT16 cch_input_pos = 0 ; // char count offset into string
+ INT16 cch_buf_pos = 0 ; // char count offset into string
+ INT16 path_type = UNKNOWN ;
+ INT16 ret_val ;
+ INT16 ret_save = 0 ;
+ INT16 cb_original_size ; // byte length of string incl NULL term
+ CHAR character ;
+ int i;
+#if defined( OS_OS2 ) || defined( OS_WIN32 )
+ INT16 path_format = OS2_HPFS ;
+#else
+ INT16 path_format = DOS8_3 ;
+#endif
+
+ msassert( psize != NULL );
+ msassert( path != NULL );
+ msassert( ( dle_hand == NULL ) || ( dle != NULL ) ) ;
+
+ /* first skip over any initial './' */
+ while( (input_text[cch_input_pos] == TEXT ('.')) && ( input_text[cch_input_pos + 1] == TEXT ('\\') ) ) {
+ cch_input_pos +=2 ;
+ }
+
+ cb_original_size = *psize ;
+ if ( cb_original_size > 0 ) {
+ *path = TEXT ('\0') ;
+ }
+
+ *psize = 0 ;
+
+ while( (state != ERROR) && (state != ALLDON) && ( state != IM_DONE ) ) {
+
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+
+ switch ( state ) {
+
+ case INITIAL:
+ case DRV_REL:
+
+ character = input_text[ cch_input_pos++ ] ;
+ path[ cch_buf_pos++ ] = character ;
+ if ( (UINT)character < 256 )
+ state = parse_table[ state] [ ascii[(UINT8)character] ];
+ else
+ state = parse_table[ state] [ ALETTER ];
+
+ if ( state == REM_DRV ) {
+
+ if ( cch_buf_pos == 1 ) {
+ path_type = REM_DRV ;
+ cch_buf_pos = 0 ;
+ state = DRV_REL ;
+ } else {
+ state = ERROR ;
+ }
+
+ } else if( state == MAC_SPC) {
+
+ path_format = MAC_SPEC ;
+ cch_buf_pos = 0 ;
+
+ } else if( ( state == DRVDONE ) && ( cch_buf_pos ==2 ) &&
+ isdigit( input_text[0] ) ) {
+
+ state = IM_NAME ;
+ }
+
+ break ;
+
+ case IM_NAME:
+ path_type = IM_NAME ;
+ character = input_text[ cch_input_pos++ ] ;
+ path[ cch_buf_pos++ ] = character ;
+ if ( (UINT)character < 256 )
+ state = parse_table[ state ][ ascii[(UINT8)character] ];
+ else
+ state = parse_table[ state ][ ALETTER ];
+
+ break ;
+
+
+
+ case FILEDON:
+ case DRVDONE:
+
+ ret_val = SUCCESS ;
+
+ if ( character == TEXT (':') ){
+
+ path[ cch_buf_pos ] = TEXT ('\0') ;
+ cch_buf_pos = 0;
+
+ #if defined( OS_OS2 ) || defined ( OS_WIN32 )
+ state = OS2 ;
+ path_format = OS2_HPFS ;
+ #endif
+
+ if ( dle_hand != NULL ) {
+ ret_val = FindDLE( dle_hand, path, dle ) ;
+ } else {
+ ret_val = DRIVE_DESCRIPTOR_ERROR ;
+ }
+
+ if( ret_val == FS_DEFAULT_SPECIFIED ) {
+ ret_save = ret_val ;
+ ret_val = SUCCESS ;
+ state = DOS ;
+
+ } else if ( ret_val != SUCCESS ) {
+ state = ERROR ;
+ break;
+
+ } else {
+ path_format = DOS8_3 ;
+ state = DOS ;
+
+ switch ( DLE_GetDeviceType( *dle ) ) {
+
+ case LOCAL_OS2_DRV :
+ case LOCAL_NTFS_DRV :
+
+#if defined( OS_OS2 ) || defined( OS_WIN32 )
+ path_format = OS2_HPFS ;
+ state = OS2 ;
+
+ if ( (*dle)->info.os2->fname_fmt == FAT_FNAME ) {
+ state = DOS ;
+ path_format = DOS8_3 ;
+ }
+#endif
+
+ break ;
+
+ case NOVELL_DRV :
+ case NOVELL_AFP_DRV :
+ if ( !((*dle)->info.nov->server_support & SUPPORT_386 ) ) {
+ state = DOS ;
+ path_format = NOV_14 ;
+ }
+ break ;
+
+ case NLM_VOLUME :
+ case NLM_AFP_VOLUME :
+ if ( !((*dle)->info.nlm->server_support & SUPPORT_386 ) ) {
+ state = DOS ;
+ path_format = NOV_14 ;
+ }
+ break ;
+
+ }
+
+ }
+
+ #if !defined( OS_OS2 ) && !defined ( OS_WIN32 )
+ state = DOS ;
+ #endif
+
+ } else { /* relative path with no drive specified */
+
+ #if defined( OS_OS2 ) || defined( OS_WIN32 )
+ path_type = OS2 ;
+ path_format = OS2_HPFS ;
+ #else
+ path_type = DOS ;
+ #endif
+
+ if ( dle_hand != NULL ) {
+
+ ret_val = FindDLE( dle_hand, NULL, dle ) ;
+
+ if ( ret_val != SUCCESS ) {
+ state = ERROR ;
+ break;
+#if defined( OS_OS2 ) || defined( OS_WIN32 )
+ } else {
+ if ( ( (*dle)->type != LOCAL_OS2_DRV ) || ( (*dle)->info.os2->fname_fmt == FAT_FNAME ) ) {
+ path_type = DOS ;
+ }
+#endif
+ }
+ }
+
+ if ( path[ cch_buf_pos-1 ] == TEXT ('.') ) {
+ path[ cch_buf_pos ] = TEXT ('\0') ;
+
+ } else {
+ path[ cch_buf_pos -1 ] = TEXT ('\0') ;
+ }
+
+ if (state != FILEDON ){
+ state = path_type ;
+ } else {
+ state = ALLDON ;
+ }
+ }
+
+ if ( dle_hand != NULL ) {
+
+ if ( input_text[cch_input_pos] != TEXT ('\\') ) {
+ if ( (cch_buf_pos != 1) || (path[0] == TEXT ('.') ) ) {
+ *psize = cch_buf_pos * sizeof (CHAR) ;
+ ret_val = InitPathRoot( *dle, path, psize, cb_original_size ) ;
+ cch_buf_pos = *psize / sizeof (CHAR);
+ }
+ }
+ }
+
+ if ( cch_buf_pos == 1 ) { /* will hapen if path start with '\' */
+ cch_buf_pos = 0 ;
+ }
+
+ if ( ret_val != SUCCESS ) {
+ state = ERROR ;
+ }
+
+ break ;
+
+ case DOS:
+ path_type = DOS ;
+
+ character = input_text[ cch_input_pos++ ] ;
+ if ( (UINT)character < 256 )
+ state = parse_table[ state ][ ascii[(UINT8)character] ];
+ else
+ state = parse_table[ state ][ ALETTER ];
+
+ if ( character != TEXT ('\\') ) {
+ path[ cch_buf_pos++ ] = character ;
+
+ } else if ( cch_buf_pos != 0 ) {
+
+ if ( path[ cch_buf_pos-1 ] != TEXT ('\0') ) {
+ path[ cch_buf_pos++ ] = TEXT ('\0');
+
+ } else {
+ state = ERROR ;
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+ if( cch_buf_pos > 1 ) {
+
+ /* find start of this sub dir */
+ for ( i = cch_buf_pos - 2;
+ ((i!=0) && (path[i-1] != TEXT ('\0'))) ; i -- ) {
+ }
+
+ ret_val = ValidateDirElem( &path[i], path_format, DIR_ELEM_MID ) ;
+
+ if ( ret_val == BACK_ZERO_DIR ) {
+ cch_buf_pos -= 2 ;
+
+ } else if ( ret_val == BACK_ONE_DIR ) {
+
+ if ( i == 0 ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ } else {
+ for ( i = (i-1) ; ((i!=0) && (path[i-1] != TEXT ('\0'))) ; i -- ) {
+ }
+ cch_buf_pos = (INT16)i ;
+ }
+ }
+
+ if ( ret_val != SUCCESS ) {
+ state = ERROR ;
+ }
+
+ }
+
+ }
+
+ break ;
+
+#if defined( OS_OS2 ) || defined(OS_WIN32)
+ case OS2:
+ path_type = OS2 ;
+
+ character = input_text[ cch_input_pos++ ] ;
+ if ( (UINT)character < 256 )
+ state = parse_table[ state ][ ascii[(UINT8)character] ];
+ else
+ state = parse_table[ state ][ ALETTER ];
+
+
+ if ( character != TEXT ('\\') ) {
+ path[ cch_buf_pos++ ] = character ;
+
+ } else if ( cch_buf_pos != 0 ) {
+
+ if ( path[ cch_buf_pos-1 ] != TEXT ('\0') ) {
+ path[ cch_buf_pos++ ] = TEXT ('\0');
+
+ } else {
+ state = ERROR ;
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+ if( cch_buf_pos > 1 ) {
+
+ /* find start of this sub dir */
+ for (i = cch_buf_pos - 2; ((i!=0) && (path[i-1] != TEXT ('\0'))) ; i -- ) {
+ }
+
+ ret_val = ValidateDirElem( &path[i], path_format, DIR_ELEM_MID ) ;
+
+ if ( ret_val == BACK_ZERO_DIR ) {
+ cch_buf_pos -= 2 ;
+
+ } else if ( ret_val == BACK_ONE_DIR ) {
+
+ if ( i == 0 ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ } else {
+ for ( i = i-1 ; ((i!=0) && (path[i-1] != TEXT ('\0'))) ; i -- ) {
+ }
+ cch_buf_pos = i ;
+ }
+ }
+
+ if ( ret_val != SUCCESS ) {
+ state = ERROR ;
+ }
+
+ }
+
+ }
+
+ break ;
+
+#endif
+ case MAC_SPC:
+ path_type = MAC_SPC ;
+
+ character = input_text[ cch_input_pos++ ] ;
+
+ if ( (UINT)character < 256 )
+ state = parse_table[ state ][ ascii[(UINT8)character] ];
+ else
+ state = parse_table[ state ][ ALETTER ];
+
+ if ( character != TEXT (':') ) {
+ path[ cch_buf_pos++ ] = character ;
+ } else {
+ path[ cch_buf_pos++ ] = TEXT ('\0');
+
+ /* check if valid directory name */
+ for (i = cch_buf_pos - 2; (i != 0 ) && (path[i-1] != TEXT ('\0')) ; i -- ) {
+ }
+
+ ret_val = ValidateDirElem( &path[i], path_format, DIR_ELEM_MID ) ;
+
+ if ( ( ret_val == BACK_ZERO_DIR ) ||
+ ( ret_val == BACK_ONE_DIR ) ) {
+
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+
+ }
+
+ if ( ret_val != SUCCESS ) {
+ state = ERROR ;
+ }
+
+ }
+
+ break ;
+
+ } /* end switch */
+
+ if ( cch_buf_pos+1 > cb_original_size / (INT16) sizeof (CHAR) ) {
+ ret_val = FS_BUFFER_TO_SMALL ;
+ state = ERROR;
+ }
+
+ }
+
+
+ if ( state == ALLDON ) {
+
+ ret_val = SUCCESS ;
+
+ if ( ( path[0] == TEXT ('+') ) && ( path_format != MAC_SPEC ) && ( path_format != OS2_HPFS ) ) {
+
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+
+ } else if ( file != NULL ) {
+
+ if ( cch_buf_pos <= 1 ) {
+ path[0] = TEXT ('\0') ;
+ strcpy( &path[1], TEXT("*.*") ) ;
+ cch_buf_pos = 3 ;
+
+ } else if ( path[ cch_buf_pos -2 ] == TEXT ('\0') ) {
+ strcpy( &path[ cch_buf_pos -1 ], TEXT("*.*") ) ;
+ cch_buf_pos += 2 ;
+ }
+
+ for (i = cch_buf_pos - 2;(i!=0) && (path[i-1] != TEXT ('\0')) ; i -- ) {
+ }
+
+ if ( i == 0 ) {
+ memmove( &path[1], path, cch_buf_pos++ * sizeof (CHAR) ) ;
+ path[0] = TEXT ('\0');
+ i = 1 ;
+ }
+
+ *psize = (INT16)i * sizeof( CHAR );
+
+
+ ret_val = ValidateDirElem( &path[i], path_format, FNAME_ELEM ) ;
+
+ if ( ret_val != SUCCESS ) {
+
+ ret_val = INVALID_FILE_DESCRIPTOR ;
+
+ }
+
+ *star_star = FALSE ;
+
+ if ( ret_val == SUCCESS ) {
+
+ *file = &path[ i ] ;
+
+ if ( !strncmp (*file, TEXT("*.*"),3 ) ) {
+ *star_star = TRUE ;
+ }
+
+ }
+ } else {
+
+ if ( cch_buf_pos <=1 ) {
+ cch_buf_pos = 2 ;
+ path[0] = TEXT ('\0') ;
+ path[1] = TEXT ('\0') ;
+ *psize = sizeof( CHAR );
+
+ } else if ( path[ cch_buf_pos - 2 ] == TEXT ('\0') ) {
+ cch_buf_pos -- ;
+ *psize = cch_buf_pos * sizeof (CHAR) ;
+ }
+
+ for (i = cch_buf_pos - 2; (i > 0 ) && (path[i-1] != TEXT ('\0')) ; i -- ) {
+ }
+
+ if ( i < 1 ) {
+
+ ret_val = ValidateDirElem( &path[i], path_format, DIR_ELEM_TRAIL ) ;
+
+ if ( ret_val != SUCCESS ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ } else if ( *psize == 0 ) {
+ *psize = cch_buf_pos * sizeof (CHAR) ;
+ }
+ } else {
+
+ *psize = cch_buf_pos * sizeof (CHAR) ;
+ }
+
+ }
+
+ } else if ( state == IM_DONE ) {
+ *star_star = FALSE ;
+
+#if defined( FS_IMAGE )
+ ret_val = FindImageDLE ( dle_hand, path, dle ) ;
+
+ path[0] = TEXT ('\0') ;
+ path[1] = TEXT ('\0') ;
+
+ if ( file != NULL ) {
+ *file = path+1 ;
+ }
+ *psize = sizeof( CHAR );
+#else
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+#endif
+ }
+
+
+ if( ( ret_val == SUCCESS ) && ( ret_save != 0 ) ) {
+ ret_val = ret_save ;
+ }
+
+ /*
+ if *path is TEXT ('\0') and psize is 0 then psize is 1
+ */
+ if ( ( *psize == 0 ) && ( *path == TEXT ('\0') ) ) {
+ *psize = sizeof( CHAR );
+ }
+
+ return( ret_val ) ;
+
+}
+/**/
+/**
+
+ Name: FindDLE()
+
+ Description: This function scans through the DLE list looking
+ for a DLE which has the name specified in the path.
+
+ Modified: 7/20/1989
+
+ Returns: Error codes
+ ATTACH_TO_PARENT
+ NO_DLE_FOUND
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( FS_ParsePath() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 FindDLE( dle_hand, path, dle )
+DLE_HAND dle_hand;
+CHAR_PTR path ;
+GENERIC_DLE_PTR *dle ;
+{
+ INT16 ret_val ;
+ CHAR_PTR pch;
+ CHAR_PTR pch2 = NULL ;
+
+ if ( ( path == NULL ) || ( *path == TEXT ('\0') ) ) {
+
+ *dle = dle_hand->default_drv ;
+ ret_val = SUCCESS ;
+
+ } else if ( !stricmp( path, TEXT("DEFAULT:") ) ) {
+ *dle = NULL ;
+ ret_val = FS_DEFAULT_SPECIFIED ;
+
+ } else {
+
+ ret_val = DLE_FindByName( dle_hand, path, ANY_DRIVE_TYPE, dle ) ;
+
+ if ( ret_val != SUCCESS ) {
+ pch = strchr( path, TEXT ('/') ) ;
+
+ /* search backwards up the dle names until we find a match */
+ do {
+
+ if ( pch2 != NULL ) {
+ *pch2 = TEXT( '\0' ) ;
+ }
+
+ pch = strrchr( path, TEXT ('/') ) ;
+
+ ret_val = DLE_FindByName( dle_hand, path, ANY_DRIVE_TYPE, dle ) ;
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FS_ATTACH_TO_PARENT ;
+ break ;
+ } else {
+ ret_val = FS_DEVICE_NOT_FOUND ;
+ }
+
+ if ( pch2 != NULL ) {
+ *pch2 = TEXT( '/' ) ;
+ }
+
+ pch2 = pch ;
+
+
+ } while ( pch != NULL ) ;
+
+ }
+ }
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: InitPathRoot()
+
+ Description: This function gets the current directory for the
+ specified drive. For DOS drives this is the active directory
+ at MaynStream initialization time. For all other drives this
+ will be simply the root.
+
+ It is possible that our support of IBM PC NET will follow the
+ DOS functionality.
+
+ Modified: 8/14/1989
+
+ Returns: Error Codes
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes: This function is only called from FS_ParsePath()
+
+ Possible input paths are in DOS relative path format.
+ for example: PROJ\MSII\TEST
+ The input path will never start with a '\'.
+
+ See also: $/SEE( FindDLE(), FS_ParsePath() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 InitPathRoot(
+GENERIC_DLE_PTR dle, /* I - drive to get current dir for */
+CHAR_PTR path, /*I/O- Entry: path so far, Exit:new path */
+INT16 *pcb_psize, /*I/O- byte size of path on entry and exit*/
+INT16 original_size ) /* I - byte size of buffer for path string*/
+{
+ CHAR_PTR dos_path = NULL ;
+ CHAR dos_wk_space[260] ;
+ CHAR_PTR temp ;
+ INT16 cb_cur_path_leng ; //path buffer length in bytes w/ NULL term
+ INT16 ret_val = SUCCESS ;
+
+
+ if ( dle == NULL ) {
+ dos_path = dos_wk_space ;
+ dos_wk_space[0] = TEXT ('\0') ;
+
+ } else {
+
+ #if defined( OS_OS2 )
+ if( dle->type == LOCAL_OS2_DRV ) {
+
+ cb_cur_path_leng = 260 ;
+
+ if ( DosQCurDir( *(dle->device_name) - 0x40, dos_wk_space,
+ &cb_cur_path_leng ) == SUCCESS ) {
+
+ dos_path = dos_wk_space ;
+ }
+ }
+
+ #elif defined( OS_DOS )
+
+ if( dle->type == LOCAL_DOS_DRV ) {
+
+ union REGS inregs, outregs ;
+ struct SREGS sregs ;
+
+ inregs.x.ax = 0x4700 ;
+ temp = dos_wk_space ;
+ inregs.x.si = FP_OFF( temp ) ;
+ sregs.ds = FP_SEG( temp ) ;
+
+ /* need valid sregs pointers for windows */
+ sregs.es = FP_SEG( temp ) ;
+
+ inregs.h.dl = *(dle->device_name) - (UINT8)0x40 ;
+
+ intdosx( &inregs, &outregs, &sregs) ;
+
+ if( !outregs.x.cflag ) {
+ dos_path = temp ;
+ }
+ }
+ #elif defined( OS_WIN32 )
+ cb_cur_path_leng = 260 ;
+ dos_path = dos_wk_space ;
+ dos_wk_space[0] = TEXT ('\0') ;
+ #else
+
+ dos_path = dos_wk_space ;
+ dos_wk_space[0] = TEXT ('\0') ;
+
+ #endif
+ }
+
+ if ( dos_path != NULL ) {
+
+ cb_cur_path_leng = (INT16)(strsize ( dos_path ) ) ;
+
+ if ( cb_cur_path_leng + *pcb_psize > original_size ) {
+ ret_val = FS_BUFFER_TO_SMALL ;
+
+ } else {
+ memmove( &path[ cb_cur_path_leng ], path, *pcb_psize ) ;
+ memcpy( path, dos_path, cb_cur_path_leng ) ;
+ *pcb_psize += cb_cur_path_leng ;
+
+ temp = strchr(path, TEXT ('\\') ) ;
+ while ( temp != NULL ) {
+ *temp = TEXT ('\0') ;
+ temp = strchr( temp+1, TEXT ('\\') ) ;
+ }
+ }
+ }
+
+ return ret_val ;
+}
+
+#if defined( FS_IMAGE )
+/**/
+/**
+
+ Name: FindImageDLE()
+
+ Description: This function looks for a image partition using a stirng
+ of the following format :
+ n:[name].Px where n is the drive number;
+ x is the partition number and
+ name is the partition name.
+
+ if the name may be omitted. If the brackets [] are omitted
+ then the period must also be omitted.
+ the other leagal permutations are :
+
+ [].Px or n:Px or [name] or [name].Px
+ or n:[name]
+
+
+ Modified: 9/22/1989
+
+ Returns: Error Codes
+ NO_DLE_FOUND
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 FindImageDLE ( dle_hand, name, dle )
+DLE_HAND dle_hand ;
+CHAR_PTR name;
+GENERIC_DLE_PTR *dle ;
+{
+ INT16 drive_num = -1 ;
+ INT16 part_num = -1 ;
+ CHAR_PTR p ;
+ INT16 ret_val = SUCCESS ;
+
+ if ( isdigit( name[0] ) && ( name[1] == TEXT (':')) ) {
+
+ drive_num = name[0] - TEXT ('0') ;
+ }
+
+ p = strchr( name, TEXT ('[') ) ;
+
+ if ( p != NULL ) {
+ name = p + 1 ;
+ p = strchr( name, TEXT (']') ) ;
+
+ if (p != NULL ) {
+ *p = TEXT ('\0') ;
+
+ if ( p[1] == TEXT ('.') ) {
+ p = p+2;
+ }
+
+ } else {
+ ret_val = FAILURE ;
+ }
+ } else {
+ p = name ;
+ }
+ if ( ( p[0] ==TEXT ('P') ) && ( isdigit( p[1] ) ) ) {
+ part_num = p[1] - TEXT ('0') ;
+ }
+
+ if ( ret_val == SUCCESS ) {
+
+ if ( ( drive_num != -1 ) && ( part_num != -1 ) ) {
+
+ ret_val = DLE_GetFirst( dle_hand, dle ) ;
+
+ while ( ret_val == SUCCESS ) {
+
+ if ( (*dle)->type == LOCAL_IMAGE ) {
+
+ if ( ( ((*dle)->info.image->drive_num & 0x7f) == (INT8)drive_num ) &&
+ ( (*dle)->info.image->partition == (INT8)part_num ) ) {
+ break ;
+ }
+ }
+ ret_val = DLE_GetNext( dle ) ;
+ }
+
+ } else {
+
+ ret_val = DLE_FindByName( dle_hand, name, LOCAL_IMAGE, dle ) ;
+
+ }
+
+ }
+
+ if ( ret_val != SUCCESS ) {
+ ret_val = FS_DEVICE_NOT_FOUND;
+ }
+
+ return ret_val ;
+}
+
+#endif /* FS_IMAGE */
+
+static INT16 ValidateDirElem(
+CHAR_PTR str,
+INT16 fmt,
+INT name_is_dir )
+{
+ CHAR_PTR p ;
+ CHAR_PTR s ;
+ INT16 cch_dir_leng ; //number of chars in str (strlen)
+ INT16 ret_val = SUCCESS ;
+
+ cch_dir_leng = (INT16)strlen( str ) ;
+
+ if ( ( name_is_dir == DIR_ELEM_MID ) && ( cch_dir_leng == 0 ) ) {
+
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+
+ } else {
+
+ switch ( fmt ) {
+
+ case NOV_14:
+ case DOS8_3:
+
+ if ( cch_dir_leng > 14 ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+ p = strchr( str, TEXT ('.') ) ;
+
+ if ( p != NULL ) {
+
+ if ( ( fmt == DOS8_3 ) || !name_is_dir ) {
+
+ if( ( p - ( str ) > 8 ) ||
+ ( strlen( p ) > 4 ) ||
+ ( cch_dir_leng > 12 ) ) {
+
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+ }
+
+ } else {
+ if ( ( fmt == DOS8_3 ) || !name_is_dir ) {
+ if ( strlen( str ) > 8 ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+ }
+ }
+
+ if ( strcspn( str, TEXT("<>\"\\/:;,=+|[]") ) != (size_t)cch_dir_leng ) {
+
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+
+ if ( name_is_dir ) {
+ if ( strchr( str, TEXT ('*') ) || strchr( str, TEXT ('?') ) ) {
+
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+ if ( ( ret_val == SUCCESS ) && !strcmp( str, TEXT(".") ) ) {
+ ret_val = BACK_ZERO_DIR ;
+ }
+
+ if ( ( ret_val == SUCCESS ) && !strcmp( str, TEXT("..") ) ) {
+ ret_val = BACK_ONE_DIR ;
+
+ }
+ }
+
+ break ;
+
+ case OS2_HPFS:
+
+ if ( cch_dir_leng > 256 ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+ if ( strcspn( str, TEXT("<>\"\\/") ) != strlen( str ) ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+ if ( name_is_dir ) {
+
+ if ( strchr( str, TEXT ('*') ) || strchr( str, TEXT ('?') ) ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+
+ if ( ( ret_val == SUCCESS ) && !strcmp( str, TEXT(".") ) ) {
+ ret_val = BACK_ZERO_DIR ;
+ }
+
+ if ( ( ret_val == SUCCESS ) && !strcmp( str, TEXT("..") ) ) {
+ ret_val = BACK_ONE_DIR ;
+ }
+ }
+ break ;
+
+ case MAC_SPEC:
+ if ( cch_dir_leng > 32 ) {
+ ret_val = INVALID_PATH_DESCRIPTOR ;
+ }
+ break ;
+ }
+
+ }
+
+ return ret_val ;
+
+}
+
diff --git a/private/utils/ntbackup/src/passdb.c b/private/utils/ntbackup/src/passdb.c
new file mode 100644
index 000000000..a1e3443b3
--- /dev/null
+++ b/private/utils/ntbackup/src/passdb.c
@@ -0,0 +1,383 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: passdb.c
+
+ Description: The Password Database Interface offers the following
+ functionality: PD_Open, PD_Close,
+ PD_Read, and PD_Write.
+
+ $Log: G:/UI/LOGFILES/PASSDB.C_V $
+
+ Rev 1.13 28 Jul 1993 14:41:04 DARRYLP
+
+ Rev 1.12 26 Jul 1993 18:25:30 MARINA
+enable c++
+
+ Rev 1.11 01 Nov 1992 16:04:24 DAVEV
+Unicode changes
+
+ Rev 1.10 07 Oct 1992 14:54:20 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.9 04 Oct 1992 19:39:38 DAVEV
+Unicode Awk pass
+
+ Rev 1.8 30 Sep 1992 10:45:48 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.7 28 Jul 1992 14:43:16 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.6 27 Jul 1992 11:10:30 JOHNWT
+ChuckB checked in for John Wright, who is no longer with us.
+
+ Rev 1.5 14 May 1992 17:24:10 MIKEP
+nt pass 2
+
+ Rev 1.4 18 Mar 1992 16:57:36 JOHNWT
+*** TOTALLY NEW CODE ***
+
+ Rev 1.3 21 Jan 1992 13:50:48 JOHNWT
+remove partially created/init file
+
+ Rev 1.2 20 Dec 1991 09:33:34 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.1 04 Dec 1991 15:21:14 MIKEP
+remoce pwxface.h
+
+ Rev 1.0 20 Nov 1991 19:20:14 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static UINT16 PD_WriteThePassword( DB_HAND_PTR pd_hnd, CHAR_PTR key, CHAR_PTR pswd ) ;
+static UINT16 PD_GetTheRecordNumber( DB_HAND_PTR pd_hnd, CHAR_PTR key ) ;
+
+/*****************************************************************************
+
+ Name: PD_Open
+
+ Description: PD_Open provides the caller with a database file_ptr for the
+ given file. If the file does not exist, it will be created.
+
+ Modified: 9/18/1989 3/12/1992
+
+ Returns: The database file_ptr is NULL if an error occurs opening the file.
+ The following errors are returned:
+ PD_RECORD_LENGTH_INVALID, PD_MEMORY_ERROR, PD_FILE_FAILED_INIT, PD_READ_ERROR,
+ PD_REBUILD_ERROR, and PD_NO_ERROR.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+*****************************************************************************/
+
+UINT16 PD_Open(
+ DB_HAND_PTR pd_hnd , /* O - file pointer to the PWDatabase */
+ CHAR_PTR pwd_name ) /* I - Name of PWDatabase file to open */
+{
+
+ /* clear the file pointer */
+ pd_hnd->fhand = NULL ;
+
+ /* open the specified "existing" database file */
+ if( ( pd_hnd->fhand = UNI_fopen( pwd_name, 0) ) == NULL ) {
+
+ return (UINT16) PD_FILE_OPEN_ERROR ;
+ }
+
+ return PD_NO_ERROR ;
+}
+
+/*****************************************************************************
+
+ Name: PD_Close
+
+ Description: PD_Close attempts to close the file and free the memory associated with
+ the handle.
+
+ Modified: 9/18/1989
+
+ Returns: The following error values are returned PD_NULL_HANDLE, PD_NO_ERROR, and
+ PD_CLOSE_ERROR.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+*****************************************************************************/
+
+UINT16 PD_Close(
+ DB_HAND_PTR pd_hnd ) /* I - Close and free memory */
+{
+
+ /* validate pwd file pointer */
+ if( pd_hnd->fhand == NULL ) {
+ return (UINT16) PD_NULL_HANDLE ;
+ }
+
+ /* close the password database file */
+ if( !fclose( pd_hnd->fhand ) ) {
+
+ pd_hnd->fhand = NULL ;
+ return PD_NO_ERROR ;
+
+ } else {
+ return (UINT16) PD_CLOSE_ERROR ;
+ }
+}
+
+/*****************************************************************************
+
+ Name: PD_Write
+
+ Description: PD_Write places the given key and password into the password
+ database. If the password already exist, it is over written.
+
+ Modified: 9/18/1989
+
+ Returns: The following error values are returned: PD_NO_ERROR, PD_WRITE_ERROR,
+ PD_READ_ERROR, PD_FULL.
+
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+*****************************************************************************/
+
+UINT16 PD_Write(
+ DB_HAND_PTR pd_hnd , /* I - PWDatabase file pointer */
+ CHAR_PTR key , /* I - Key -- Server/User/Alias name */
+ CHAR_PTR pswd ) /* I - Password */
+{
+ UINT16 error ;
+
+ /* validate pwd file pointer */
+ if( pd_hnd->fhand == NULL ) {
+ return (UINT16) PD_NULL_HANDLE ;
+ }
+
+ PD_GetTheRecordNumber( pd_hnd, key ) ;
+
+ /* add a new record */
+ error = PD_WriteThePassword( pd_hnd, key, pswd ) ;
+
+ return error ;
+}
+
+/*****************************************************************************
+
+ Name: WritePasswordFile
+
+ Description: Checks the length of the key and password before writing it to the Password
+ Database.
+
+ Modified: 9/18/1989
+
+ Returns: PD_NO_ERROR and PD_EXCEEDED_RECORD_LENGTH
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+*****************************************************************************/
+
+static UINT16 PD_WriteThePassword(
+ DB_HAND_PTR pd_hnd , /* I - Required DB handle */
+ CHAR_PTR key , /* I - Server/User name */
+ CHAR_PTR pswd ) /* I - Password */
+{
+
+ UINT8 password_size ; /* size of password */
+
+
+ /* Seek to record number */
+
+ fseek( pd_hnd->fhand,
+ ((INT32)(MAX_PSWD_RECORD_SIZE * sizeof (CHAR))) * pd_hnd->record_number,
+ SEEK_SET ) ;
+
+
+ /* Initialize the pad amount */
+ memset( pd_hnd->buffer, TEXT('Û'), MAX_PSWD_RECORD_SIZE * sizeof (CHAR) ) ;
+
+ /* get the password size */
+ password_size = (UINT8)( strsize( pswd ) - sizeof (CHAR) ) ;
+
+
+ /* 1 the byte for storing the password size */
+
+ if( (INT16)( strsize( key ) + password_size + 1 ) <= MAX_PSWD_RECORD_SIZE ) {
+
+ /* fill the buffer */
+ memcpy( pd_hnd->buffer, key, strsize ( key ) ) ;
+
+ pd_hnd->buffer[strlen( key )] = TEXT('\0') ;
+
+ /* encrypt the password */
+ CryptPassword( (INT16) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)pswd, (INT16) password_size ) ;
+
+ memcpy( &(pd_hnd->buffer)[ ( strlen( key ) + 1 ) ],
+ &password_size, 1 ) ;
+
+ memcpy( &(pd_hnd->buffer)[ ( strlen( pd_hnd->buffer ) + 2 ) ],
+ pswd, password_size ) ;
+
+
+ /* write the buffer to file */
+ fwrite( pd_hnd->buffer, MAX_PSWD_RECORD_SIZE*sizeof(CHAR), 1, pd_hnd->fhand ) ;
+ if( ferror( pd_hnd->fhand ) ) {
+ return (UINT16) PD_WRITE_ERROR ;
+ }
+
+ return PD_NO_ERROR ;
+
+ }
+
+ return (UINT16) PD_EXCEEDED_RECORD_LENGTH ;
+
+}
+
+/*****************************************************************************
+
+ Name: PD_Read
+
+ Description: PD_Read matches the given key to the key and password in
+ the database. The password is copied to the pswd parameter.
+
+
+ Modified: 9/18/1989
+
+ Returns: The following error values : PD_NULL_HANDLE, PD_MEMORY_ERROR,
+ PD_READ_ERROR, PD_NOT_FOUND, and PD_NO_ERROR.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+*****************************************************************************/
+
+INT16 PD_Read(
+ DB_HAND_PTR pd_hnd , /* I - PWDatabase file pointer */
+ CHAR_PTR key , /* I - key -- Server/User/Alias name */
+ CHAR_PTR pswd ) /* O - password */
+{
+
+ CHAR tmp_pwd[MAX_PSWD_SIZE] ; /* current password */
+ UINT16 error ; /* return value */
+ UINT8 pswd_size ; /* size of the password */
+
+ /* validate file pointer */
+ if( pd_hnd->fhand == NULL ) {
+ return PD_NULL_HANDLE ;
+ }
+
+ error = PD_GetTheRecordNumber( pd_hnd, key ) ;
+
+ if( error == PD_NO_ERROR ) {
+
+ /* Retrieve the password */
+ memcpy( &pswd_size, &(pd_hnd->buffer)[ ( strlen( pd_hnd->buffer ) + 1 ) ], 1 ) ;
+
+ memcpy( tmp_pwd, &(pd_hnd->buffer)[ ( strlen( pd_hnd->buffer ) + 2 ) ], pswd_size ) ;
+
+ CryptPassword( (INT16) DECRYPT, ENC_ALGOR_3, (INT8_PTR)tmp_pwd, (INT16) pswd_size ) ;
+
+ memcpy( pswd, tmp_pwd, pswd_size ) ;
+
+ pswd[ pswd_size/sizeof(CHAR) ] = TEXT('\0') ;
+
+ }
+ return error ;
+}
+
+/*****************************************************************************
+
+ Name: PD_GetTheRecordNumber
+
+ Description: Performs a linear search of the password database file and
+ attempts to match the key.
+
+
+ Modified: 3/11/1992
+
+ Returns: The following error values :
+ PD_NOT_FOUND, and PD_NO_ERROR.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+*****************************************************************************/
+
+UINT16 PD_GetTheRecordNumber(
+ DB_HAND_PTR pd_hnd, /* I - PWDatabase file pointer */
+ CHAR_PTR key ) /* I - key -- Server/User/Alias name */
+{
+
+ UINT16 cmp_error ; /* compare error variable */
+
+
+ /* ensure that the ptr is at the beginning of file */
+ fseek( pd_hnd->fhand , 0L, SEEK_SET ) ;
+
+ /* Set the record number */
+ pd_hnd->record_number = 0 ;
+
+ /* match key name */
+ while( !feof( pd_hnd->fhand ) ) {
+
+ /* fill buffer */
+ fread( pd_hnd->buffer, MAX_PSWD_RECORD_SIZE*sizeof(CHAR), 1, pd_hnd->fhand ) ;
+ if( ferror( pd_hnd->fhand ) ){
+
+ clearerr( pd_hnd->fhand ) ;
+ return (UINT16) PD_READ_ERROR ;
+ }
+
+ /* match the key name */
+ cmp_error = strcmpi( pd_hnd->buffer, key ) ;
+ if( ( cmp_error == 0 ) ) {
+
+ return PD_NO_ERROR ;
+ }
+
+ /* if eof, return */
+ if ( feof( pd_hnd->fhand ) ) {
+
+ return (UINT16) PD_NOT_FOUND;
+
+ }
+
+ /* Increment the record number */
+ pd_hnd->record_number++ ;
+
+ }
+
+ return (UINT16) PD_NOT_FOUND ;
+
+}
diff --git a/private/utils/ntbackup/src/password.c b/private/utils/ntbackup/src/password.c
new file mode 100644
index 000000000..3e6281682
--- /dev/null
+++ b/private/utils/ntbackup/src/password.c
@@ -0,0 +1,813 @@
+
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: password.c
+
+ Description:
+
+ Code to handle tape/bset passwords.
+
+ $Log: J:/UI/LOGFILES/PASSWORD.C_V $
+
+ Rev 1.35 24 Mar 1994 15:29:30 GREGG
+Initialize temp size parameter passed into MapAnsiToUnicNoNull.
+
+ Rev 1.34 21 Mar 1994 12:39:58 STEVEN
+fix mapuin bugs
+
+ Rev 1.33 18 Mar 1994 14:33:38 chrish
+Added change to allow unicode ORCAS to read ANSI ORCAS tapes that
+were backed up with restrict accessed to owner.
+
+ Rev 1.32 02 Feb 1994 17:28:18 chrish
+Added changes for the UNICODE version of the app to handle ANSI
+secured tapes.
+
+ Rev 1.31 17 Jan 1994 15:05:46 MIKEP
+fix more unicode warnings
+
+ Rev 1.30 24 Nov 1993 15:28:52 BARRY
+Fix Unicode warnings
+
+ Rev 1.29 26 Jul 1993 18:35:48 MARINA
+enable c++
+
+ Rev 1.28 08 Apr 1993 17:20:10 chrish
+Made change to check for tape passworded by Cayman.
+
+
+ Rev 1.27 22 Mar 1993 13:47:08 chrish
+Made changes to VerifyTapePassword routine for CAYMAN.
+
+ Rev 1.26 17 Mar 1993 16:31:02 chrish
+Made change to VerifyTapePassword routine, since we change the security
+privilege checking.
+
+ Rev 1.25 10 Mar 1993 17:19:54 chrish
+Added another paramater passed to DM_GetTapePswd.
+
+ Rev 1.24 22 Feb 1993 11:12:08 chrish
+Added changes received from MikeP.
+Check to see if the user is an administrator when checking to see if
+password matches. This allows administrator to access any tape. Now
+that I think about it, this wil need changing for Cayman, so admin's
+can't access one of our real tape password.
+
+ Rev 1.23 07 Jan 1993 13:25:00 chrish
+Added tape security for full catalog.
+
+ Rev 1.22 13 Nov 1992 17:10:24 chrish
+Minor change for Tape Security stuff inside VerifyTapePassword routine
+
+ Rev 1.21 01 Nov 1992 16:04:40 DAVEV
+Unicode changes
+
+ Rev 1.20 07 Oct 1992 14:54:34 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.19 05 Oct 1992 14:22:10 DAVEV
+cbPasswordSize
+
+ Rev 1.18 05 Oct 1992 14:02:12 DAVEV
+fix password struct names
+
+ Rev 1.17 04 Oct 1992 19:39:40 DAVEV
+Unicode Awk pass
+
+ Rev 1.16 30 Sep 1992 10:45:14 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.15 10 Sep 1992 17:45:32 DAVEV
+Integrate MikeP's changes from Microsoft
+
+ Rev 1.14 06 Aug 1992 13:17:18 CHUCKB
+Changes for NT.
+
+ Rev 1.13 28 Jul 1992 15:05:18 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.12 07 Jul 1992 15:50:38 MIKEP
+unicode changes
+
+ Rev 1.11 14 May 1992 17:23:54 MIKEP
+nt pass 2
+
+ Rev 1.10 02 Mar 1992 16:26:22 CHUCKB
+Fixed length of password in CollectTapePassword.
+
+ Rev 1.9 08 Feb 1992 16:48:14 MIKEP
+fix mac passwords
+
+ Rev 1.8 03 Feb 1992 16:52:46 CHUCKB
+In function VerifyTapePassword, changed size of array password to MAX_..._SIZE instead of ..._LEN.
+
+ Rev 1.7 23 Jan 1992 13:10:34 CARLS
+fixed password problems
+
+ Rev 1.6 13 Jan 1992 17:22:16 CARLS
+added call to JobStatusBackupRestore for Tape
+password cancel
+
+ Rev 1.5 20 Dec 1991 09:34:12 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.4 06 Dec 1991 15:38:38 CHUCKB
+No change.
+
+ Rev 1.3 04 Dec 1991 14:54:08 CARLS
+changed return value from TRUE to FALSE if prompting id disabled
+
+ Rev 1.2 03 Dec 1991 20:49:04 MIKEP
+macros & headers
+
+ Rev 1.1 22 Nov 1991 08:47:00 MIKEP
+structure changes in tape_object
+
+ Rev 1.0 20 Nov 1991 19:34:08 SYSTEM
+Initial revision.
+
+****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+LOCALVAR Q_HEADER tape_pswd_list;
+
+/* prototypes for internal functions */
+
+LOCALFN BOOLEAN MatchOldPassword( INT8_PTR, INT16 );
+
+#ifdef OEM_MSOFT
+ LOCALFN BOOLEAN CompareTapePswdToCurrentPaswd(
+ INT8_PTR tape_password, /* tape password in NULL terminated string*/
+ INT16 tape_password_size ); /* length of tape_password in BYTES */
+#endif
+
+
+/**********************
+
+ NAME : PSWD_CheckForPassword
+
+ DESCRIPTION :
+
+ Checks the given tape/bset combination for read permission. Returns
+ success if no password is present, the password has already been
+ entered or the user entered the correct password after he was prompted.
+
+ RETURNS : SUCCESS or FAILURE
+
+**********************/
+
+INT16 PSWD_CheckForPassword( UINT32 tape_fid, INT16 bset_num )
+{
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+ INT16 status;
+
+ // See if this tape has a password
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape ) {
+
+ if ( TAPE_GetFID( tape ) == tape_fid ) {
+ break;
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ if ( tape == NULL ) {
+ return( FAILURE );
+ }
+
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ while ( bset != NULL ) {
+
+ if ( BSET_GetBsetNum( bset ) == bset_num ) {
+ break;
+ }
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ if ( bset == NULL ) {
+ return( FAILURE );
+ }
+
+ if ( BSET_GetPswdSize( bset ) == 0 ) {
+ return( SUCCESS );
+ }
+
+ if ( BSET_GetBsetPswd( bset ) ) {
+
+ status = VerifyTapePassword( TAPE_GetName( tape ),
+ BSET_GetName( bset ),
+ BSET_GetUserName( bset ),
+ (UINT16) BSET_GetEncryptAlgor( bset ),
+ NULL,
+ (INT16) 0,
+ (INT8_PTR)BSET_GetPassword( bset ),
+ (INT16) BSET_GetPswdSize( bset ),
+ tape_fid );
+ }
+ else {
+
+ status = VerifyTapePassword( TAPE_GetName( tape ),
+ BSET_GetName( bset ),
+ BSET_GetUserName( bset ),
+ (UINT16) BSET_GetEncryptAlgor( bset ),
+ (INT8_PTR)BSET_GetPassword( bset ),
+ (INT16) BSET_GetPswdSize( bset ),
+ NULL,
+ (INT16) 0,
+ tape_fid );
+ }
+
+ if ( status == TRUE ) { /* if passwords matched - set return code to SUCCESS */
+ status = SUCCESS;
+ }
+ else {
+ status = FAILURE;
+ }
+
+ return( status );
+}
+
+/**********************
+
+ NAME : PSWD_GetFirstPSWD
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+PSWD_OBJECT_PTR PSWD_GetFirstPSWD( )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueHead( &tape_pswd_list );
+
+ if ( q_elem_ptr != NULL ) {
+ return (PSWD_OBJECT_PTR)( q_elem_ptr->q_ptr ) ;
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : PSWD_GetNextPSWD
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+PSWD_OBJECT_PTR PSWD_GetNextPSWD( PSWD_OBJECT_PTR pswd )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueNext( &(pswd->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return (PSWD_OBJECT_PTR)( q_elem_ptr->q_ptr ) ;
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : PSWD_AddPassword
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT16 PSWD_AddPassword(
+INT8_PTR pszPassword,
+INT16 cbPasswordLen,
+UINT16 algor,
+UINT32 tape_fid )
+{
+ PSWD_OBJECT_PTR pswd;
+
+ pswd = (PSWD_OBJECT_PTR)malloc( sizeof( PSWD_OBJECT ) );
+
+ if ( pswd != NULL ) {
+ pswd->q_elem.q_ptr = pswd;
+ memcpy( pswd->achPassword, pszPassword, cbPasswordLen );
+ pswd->cbPasswordSize = cbPasswordLen;
+ pswd->encrypt_algor = algor;
+ pswd->tape_fid = tape_fid;
+ EnQueueElem( &tape_pswd_list, &(pswd->q_elem), FALSE );
+ return( SUCCESS );
+ }
+
+ return( FAILURE );
+}
+
+/**********************
+
+ NAME : PSWD_InitPSWDList
+
+ DESCRIPTION :
+
+ RETURNS : nothing.
+
+**********************/
+
+INT16 PSWD_InitPSWDList( )
+{
+
+ InitQueue( &tape_pswd_list );
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME : PSWD_FreePSWDList
+
+ DESCRIPTION :
+
+ A function that hasn't been done yet.
+
+ RETURNS : nothing.
+
+**********************/
+
+INT16 PSWD_FreePSWDList( )
+{
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME : VerifyTapePassword
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+BOOLEAN VerifyTapePassword(
+CHAR_PTR tape_name,
+CHAR_PTR bset_name,
+CHAR_PTR user_name,
+UINT16 encrypt_algor,
+INT8_PTR tape_password, /* tape password in NULL terminated string*/
+INT16 tape_password_size, /* length of tape_password in BYTES */
+INT8_PTR bset_password, /* BSET password in NULL terminated string*/
+INT16 bset_password_size, /* length of bset_password in BYTES */
+UINT32 tape_fid )
+{
+ PSWD_OBJECT_PTR pswd;
+ CHAR password[ MAX_TAPE_PASSWORD_SIZE ];
+ BOOLEAN status = FALSE;
+ CHAR buffer[ MAX_UI_RESOURCE_SIZE ]; // chs:04-08-93
+ CHAR buffer2[ MAX_UI_RESOURCE_SIZE ]; // chs:04-08-93
+
+
+#ifdef OEM_MSOFT
+
+ if ( ( WhoPasswordedTape( tape_password, tape_password_size ) == OTHER_APP ) || // chs:04-08-93
+ ( WhoPasswordedTape( bset_password, bset_password_size ) == OTHER_APP ) ) { // chs:04-08-93
+ // chs:04-08-93
+ // // chs:04-08-93
+ // Popup dialog box message if // chs:04-08-93
+ // not a valid user // chs:04-08-93
+ // // chs:04-08-93
+ // chs:04-08-93
+ RSM_StringCopy( IDS_GENERAL_TAPE_SECURITY, buffer, sizeof(buffer) ); // chs:04-08-93
+ RSM_StringCopy( IDS_TAPE_SECURITY_TITLE, buffer2, sizeof(buffer2) ); // chs:04-08-93
+ WM_MsgBox( buffer2, buffer, WMMB_OK | WMMB_NOYYCHECK, WMMB_ICONEXCLAMATION ); // chs:04-08-93
+ return ( FALSE ); // chs:04-08-93
+ } // chs:04-08-93
+
+ switch ( gbCurrentOperation ) { // chs:03-15-93
+ // chs:03-15-93
+ case OPERATION_BACKUP: // chs:03-15-93
+ // chs:03-15-93
+ if ( DoesUserHaveThisPrivilege( TEXT( "SeBackupPrivilege" ) ) ) { // chs:03-15-93
+ return( TRUE ); // chs:03-15-93
+ } // chs:03-15-93
+ break; // chs:03-15-93
+ // chs:03-15-93
+ case OPERATION_RESTORE: // chs:03-15-93
+ case OPERATION_CATALOG: // chs:03-15-93
+ if ( DoesUserHaveThisPrivilege( TEXT( "SeRestorePrivilege" ) ) ) { // chs:03-15-93
+ return( TRUE ); // chs:03-15-93
+ } // chs:03-15-93
+ break; // chs:03-15-93
+ // chs:03-15-93
+ default: // chs:03-15-93
+ return( TRUE ); // chs:03-15-93
+ break; // chs:03-15-93
+ // chs:03-15-93
+ } // chs:03-15-93
+
+#endif
+
+ if ( tape_password_size != 0 ) {
+
+ // See if it's in our list already
+
+ pswd = PSWD_GetFirstPSWD();
+
+ while ( pswd != NULL ) {
+
+ if ( ( encrypt_algor == pswd->encrypt_algor ) &&
+ ( tape_fid == pswd->tape_fid ) &&
+ ( (UINT16)tape_password_size == pswd->cbPasswordSize ) ) {
+
+ if ( ! memcmp( pswd->achPassword, tape_password, tape_password_size ) ) {
+ return( TRUE );
+ }
+ }
+
+ pswd = PSWD_GetNextPSWD( pswd );
+ }
+
+ // Ask user for it
+
+ memcpy( password, tape_password, tape_password_size );
+
+ CryptPassword( (INT16) DECRYPT, encrypt_algor, (INT8_PTR)password, tape_password_size );
+
+ password[ tape_password_size / sizeof (CHAR) ] = TEXT( '\0' );
+
+ if ( strlen( password ) == 0 ) {
+
+ // I have a maxstream tape that says the password is 8 characters
+ // long but it is all zero's.
+
+ return( TRUE );
+ }
+
+#ifndef OEM_MSOFT
+ status = DM_GetTapePswd( tape_name, NULL, NULL, password, tape_password_size ); // chs:03-10-93
+#else
+ status = FALSE;
+#endif /* OEM_MSOFT */
+
+ // If it was good enter it into our list
+
+ if ( status == TRUE && password[0] != NTPASSWORDPREFIX ) { // chs:04-08-93
+ // clear right answer out of memory // chs:03-22-93
+ // chs:03-22-93
+ memset( password, 0, sizeof (password) ); // chs:03-22-93
+ // chs:03-22-93
+ PSWD_AddPassword( tape_password, tape_password_size, encrypt_algor, tape_fid ); // chs:03-22-93
+ } // chs:03-22-93
+
+ }
+
+ if ( bset_password_size != 0 ) {
+
+ // See if it's in our list already
+
+ pswd = PSWD_GetFirstPSWD();
+
+ while ( pswd != NULL ) {
+
+ if ( ( encrypt_algor == pswd->encrypt_algor ) &&
+ ( tape_fid == pswd->tape_fid ) &&
+ ( (UINT16)bset_password_size == pswd->cbPasswordSize ) ) {
+
+ if ( ! memcmp( pswd->achPassword, bset_password, bset_password_size ) ) {
+ return( TRUE );
+ }
+ }
+
+ pswd = PSWD_GetNextPSWD( pswd );
+ }
+
+ // Ask user for it
+
+ memcpy( password, bset_password, bset_password_size );
+
+ CryptPassword( (INT16) DECRYPT, encrypt_algor, (INT8_PTR)password, bset_password_size );
+
+ password[ bset_password_size / sizeof (CHAR) ] = 0;
+
+#ifndef OEM_MSOFT
+ status = DM_GetTapePswd( tape_name, bset_name, user_name, password, bset_password_size ); // chs:03-10-93
+#else
+ status = FALSE;
+#endif /* OEM_MSOFT */
+
+
+ // If it was good enter it into our list
+
+ if ( status == TRUE && password[0] != NTPASSWORDPREFIX ) { // chs:04-08-93
+ // clear right answer out of memory // chs:03-22-93
+ // chs:03-22-93
+ memset( password, 0, sizeof (password) ); // chs:03-22-93
+ // chs:03-22-93
+ PSWD_AddPassword( bset_password, bset_password_size, encrypt_algor, tape_fid ); // chs:03-22-93
+ } // chs:03-22-93
+
+
+
+ }
+
+
+#ifdef OEM_MSOFT
+{
+
+ // Microsoft only supports tape passwords.
+
+ if ( status == FALSE ) {
+
+ INT8_PTR temp_password = ( INT8_PTR )calloc( 1, tape_password_size + ( 2 * sizeof( CHAR ) ) );
+
+ if ( !temp_password ) { return( FALSE ); }
+
+ memcpy( temp_password, tape_password, tape_password_size );
+
+ CryptPassword( (INT16)DECRYPT, (UINT16)encrypt_algor, temp_password, (INT16)tape_password_size );
+
+ status = CompareTapePswdToCurrentPaswd(
+ temp_password,
+ (INT16)tape_password_size );
+
+ if ( status != TRUE ) {
+
+ //
+ // Popup dialog box message if
+ // not a valid user
+ //
+
+ RSM_StringCopy( IDS_GENERAL_TAPE_SECURITY, buffer, sizeof(buffer) );
+ RSM_StringCopy( IDS_TAPE_SECURITY_TITLE, buffer2, sizeof(buffer2) );
+ WM_MsgBox( buffer2, buffer, WMMB_OK | WMMB_NOYYCHECK, WMMB_ICONEXCLAMATION ); // chs:03-17-93
+ }
+
+ free( temp_password );
+ }
+
+}
+#endif
+
+ return( status );
+
+}
+
+
+/***********
+
+ Name: CryptPassword
+
+ Description: Interfaces with Encryption Unit to encrypt of decrypt
+ the supplied password buffer
+
+ Returns: n/a
+
+ Notes: The Encryption Unit is opened with the supplied mode:
+ ENCRYPT or DECRYPT and the specified algorithm
+
+**********/
+VOID CryptPassword(
+INT16 mode, /* encrypt or decrypt mode */
+UINT16 encrypt_algor, /* encryption algorithm used on tape */
+INT8_PTR password, /* buffer to manipulate */
+INT16 password_size ) /* size of tape password */
+{
+ EU_HAND_PTR enchand; /* encrypt unit handle */
+ INT16 blck, error, ret_code; /* variables for EU */
+
+ /* open encryption unit */
+
+ enchand = EU_Open( encrypt_algor,
+ mode,
+ (INT8_PTR)gb_encryption_key,
+ (INT16)(strlenA( gb_encryption_key ) ),
+ &blck, &error );
+
+ if ( enchand == NULL ) {
+ eresprintf( (INT16) RES_EU_ERROR, error );
+ return;
+ }
+
+ /* perform requested function */
+
+ ret_code = EU_Encrypt( enchand, (INT8_PTR)password, password_size );
+
+ if ( ret_code != EU_NO_ERROR ) {
+ eresprintf( (INT16) RES_EU_ERROR, ret_code );
+ }
+
+ EU_Close( enchand );
+
+ return;
+}
+
+
+/************
+
+ Name: CollectTapePassword
+
+ Description: Function to validate current tape password and collect
+ new tape password as appropriate
+
+ Returns: TRUE or FALSE if existing password is verified
+ TRUE = password matched
+ FALSE = password did not match, or user wants to cancel
+
+ Notes: Called for backup only
+
+**************/
+
+BOOLEAN CollectTapePassword( INT8_PTR new_password,
+ INT16_PTR new_password_size,
+ UINT16 encrypt_algor,
+ INT8_PTR old_password,
+ INT16 old_password_size )
+{
+ CHAR confirm[ MAX_TAPE_PASSWORD_SIZE ]; /* confirmation buffer */
+ BOOLEAN confirmed = FALSE; /* continue condition */
+ DBLK_PTR vcb_ptr;
+ WORD status;
+ UINT32 current_tape_id;
+
+ status = VLM_GetDriveStatus( &vcb_ptr );
+
+ if( status == VLM_VALID_TAPE ) {
+
+ /* get tape ID */
+ current_tape_id = FS_ViewTapeIDInVCB( vcb_ptr );
+ }
+
+ /* used for initial comparisons */
+ memset( confirm, TEXT('\0'), sizeof (confirm) );
+
+ /* Check for .EXE embedded password supplied */
+ if ( memcmp( confirm, gb_auto_password.string, MAX_TAPE_PASSWORD_LEN * sizeof (CHAR) ) ) {
+
+ if ( old_password_size > 0 ) {
+
+ if ( memcmp( old_password, gb_auto_password.string, MAX_TAPE_PASSWORD_LEN * sizeof (CHAR) ) ) {
+
+ memcpy( confirm, old_password, min( old_password_size, MAX_TAPE_PASSWORD_LEN * sizeof (CHAR) ) );
+
+ /* Make adjustments for 2.0 Encryption algorithm */
+ if( encrypt_algor == ENC_ALGOR_1 ) {
+ old_password_size = (INT16) min( (UINT16)( strlen( confirm ) * sizeof (CHAR) ), (UINT16)old_password_size );
+ confirm[ old_password_size/sizeof (CHAR) ] = TEXT('\0');
+ }
+
+ CryptPassword( (INT16) DECRYPT, encrypt_algor, (INT8_PTR)confirm, old_password_size );
+ CryptPassword( (INT16) ENCRYPT, ENC_ALGOR_3, (INT8_PTR)confirm, old_password_size );
+
+ if ( memcmp( confirm, gb_auto_password.string, old_password_size ) ) {
+ eresprintf( (INT16) RES_EMBEDDED_PW_MISMATCH );
+
+ return FALSE;
+
+ }
+ }
+ }
+
+ memcpy( new_password, gb_auto_password.string, MAX_TAPE_PASSWORD_LEN * sizeof (CHAR) );
+ *new_password_size = strlen( (CHAR_PTR)new_password ) * sizeof (CHAR) ;
+
+ return TRUE;
+
+ }
+
+ /* verify existing tape password if necessary, return if mismatch */
+
+ if ( ( old_password_size != 0 ) &&
+ ( memcmp( confirm, old_password, old_password_size ) ) ) {
+
+ if ( ! VerifyTapePassword( (CHAR_PTR)FS_ViewTapeNameInVCB( vcb_ptr ),
+ (CHAR_PTR)FS_ViewSetNameInVCB( vcb_ptr ),
+ (CHAR_PTR)FS_ViewUserNameInVCB( vcb_ptr ),
+ encrypt_algor,
+ old_password,
+ old_password_size,
+ (INT8_PTR)TEXT("setpassword"),
+ (INT16) 0,
+ current_tape_id ) ) {
+
+ return FALSE; /* password mismatch */
+ }
+ return TRUE; /* password matched */
+ }
+
+ /* return a null password if prompting is disabled or "yes" flag set */
+
+ if ( ( ! CDS_GetPasswordFlag( CDS_GetCopy() ) ) ||
+ ( CDS_GetYesFlag( CDS_GetCopy() ) != NO_FLAG ) ) {
+
+ memset( new_password, TEXT('\0'), MAX_TAPE_PASSWORD_LEN * sizeof (CHAR) );
+ *new_password_size = 0;
+ return TRUE;
+ }
+ return TRUE;
+}
+
+
+/************
+
+ Name: CompareTapePswdToCurrentPaswd
+
+ Description: This routine will compare the password on the
+ selected tape against the current logged on user
+ password (Machine/Username). This routine is
+ specific to NT. In the NT app only the only password
+ that is allowed is the tape password NOT the backup
+ set password.
+
+
+ Returns: TRUE = password matched or no password checking needed
+ FALSE = password did not match, or user wants to cancel
+
+
+ Notes: The tape_password parameter passed in is not encrypted.
+
+**************/
+
+#ifdef OEM_MSOFT
+
+BOOLEAN CompareTapePswdToCurrentPaswd(
+ INT8_PTR tape_password, /* tape password in NULL terminated string*/
+ INT16 tape_password_size ) /* length of tape_password in BYTES */
+{
+ CHAR_PTR generic_str_ptr;
+ CHAR_PTR alteredtemppassword = NULL;
+ CHAR_PTR buffer = NULL;
+ BOOLEAN retcode = FALSE;
+ INT dummy_size ;
+
+ if ( tape_password_size == 0 ) return( TRUE ); // No password detected
+
+ generic_str_ptr = GetCurrentMachineNameUserName( ); // Get current logged on user password
+ if ( !generic_str_ptr ) return( TRUE );
+
+ alteredtemppassword = ( CHAR_PTR )calloc( 1, ( 3 + strlen( generic_str_ptr ) ) * sizeof( CHAR ) );
+ if ( !alteredtemppassword ) return( FALSE );
+ *alteredtemppassword = NTPASSWORDPREFIX;
+ strcat( alteredtemppassword, generic_str_ptr );
+
+#ifdef UNICODE
+ buffer = ( CHAR_PTR )calloc( 1, tape_password_size * sizeof( CHAR ) );
+ if ( !buffer ) {
+ free( alteredtemppassword );
+ return( FALSE );
+ }
+
+ if ( ( ( tape_password[0] & 0xff ) == NTPASSWORDPREFIX ) &&
+ ( ( tape_password[1] & 0xff ) != 0) ) { // this is an ANSI tape.....
+
+ tape_password_size *= sizeof( CHAR );
+ dummy_size = (INT)tape_password_size ;
+ mapAnsiToUnicNoNull( ( ACHAR_PTR )tape_password, ( WCHAR_PTR )buffer, ( INT )(tape_password_size / sizeof( CHAR ) ), &dummy_size ) ;
+ tape_password_size = (INT16)dummy_size ;
+ if ( ( *tape_password & 0xff ) == NTPASSWORDPREFIX ) {
+ *buffer = NTPASSWORDPREFIX;
+ }
+ } else {
+ memcpy( buffer, tape_password, tape_password_size );
+ }
+#else
+ buffer = tape_password;
+#endif
+
+ if ( tape_password_size == ( INT16 )( strlen( alteredtemppassword ) * sizeof( CHAR ) ) ) {
+
+ if ( !memcmp( buffer, alteredtemppassword, tape_password_size ) ) {
+ retcode = TRUE;
+
+ } else {
+ retcode = FALSE;
+ }
+
+ } else {
+ retcode = FALSE;
+ }
+
+ if ( alteredtemppassword ) free( alteredtemppassword );
+
+#ifdef UNICODE
+ if ( buffer ) free( buffer );
+#endif
+
+ return( retcode );
+
+}
+
+#endif
diff --git a/private/utils/ntbackup/src/pdir2.bmp b/private/utils/ntbackup/src/pdir2.bmp
new file mode 100644
index 000000000..b9bc64c2b
--- /dev/null
+++ b/private/utils/ntbackup/src/pdir2.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/polldrv.c b/private/utils/ntbackup/src/polldrv.c
new file mode 100644
index 000000000..5e1b981f3
--- /dev/null
+++ b/private/utils/ntbackup/src/polldrv.c
@@ -0,0 +1,1124 @@
+
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: polldrv.c
+
+ Description: This file contains the functions for UI poll drive.
+
+ Code Reviews: 11-21-91
+
+ $Log: J:/UI/LOGFILES/POLLDRV.C_V $
+
+ Rev 1.43.1.2 11 Feb 1994 16:38:30 GREGG
+Changed prompt for user to eject tape. EPR 948-0153
+
+ Rev 1.43.1.1 07 Feb 1994 02:06:02 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.43.1.0 01 Feb 1994 15:12:54 GREGG
+Put TEXT macros debug print format strings.
+
+ Rev 1.43 01 Dec 1993 14:27:10 mikep
+add SQL recognition support to poll drive
+
+ Rev 1.42 23 Sep 1993 15:48:20 GLENN
+Added signalling to Frame window when out of poll drive, if it was previously busy.
+
+ Rev 1.41 21 Jul 1993 17:02:58 GLENN
+Added PD_WaitUntilSettled () function to wait until poll drive is in a settled state.
+
+ Rev 1.40 13 Jul 1993 17:57:18 MARINA
+enable c++
+
+ Rev 1.39 01 Jul 1993 18:00:34 GLENN
+Removed bogus thw_list NULL check - it should not be in here, it causes problems when resetting flags.
+
+ Rev 1.38 16 Jun 1993 16:38:10 GLENN
+Added PD_IsPollDriveBusy().
+
+ Rev 1.37 04 Jun 1993 18:46:34 STEVEN
+added messages for tape failures
+
+ Rev 1.36 25 May 1993 15:03:48 GLENN
+Checking init flag in deinit. Moved static vars around. Ifdef'd no device code for Nost.
+
+ Rev 1.35 25 May 1993 09:39:34 GLENN
+Moved inappropriate message box at begining of Start function.
+
+ Rev 1.34 28 Apr 1993 16:35:02 CARLS
+add code for drive failure in GetDriveStatus call
+
+ Rev 1.33 08 Apr 1993 14:29:06 DARRYLP
+Replaced references to undefined IDS_POLLDRIVE_DRIVE_FAILURE with
+IDS_POLLDRIVE_SMALLPROBLEM.
+
+ Rev 1.32 30 Mar 1993 16:21:50 GREGG
+Changed PD_UNFORMATTED_TAPE to PD_UNRECOGNIZED_MEDIA.
+
+ Rev 1.31 12 Mar 1993 15:17:42 MIKEP
+add unformated tape support
+
+ Rev 1.30 12 Mar 1993 14:46:54 MIKEP
+add auto format call
+
+ Rev 1.29 12 Mar 1993 14:35:58 MIKEP
+auto call erase if foreign tape
+
+ Rev 1.28 18 Nov 1992 13:24:32 GLENN
+Improved speed by increasing polling during dynamic/unstable states.
+
+ Rev 1.27 01 Nov 1992 16:04:56 DAVEV
+Unicode changes
+
+ Rev 1.26 07 Oct 1992 14:09:18 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.25 04 Oct 1992 19:39:44 DAVEV
+Unicode Awk pass
+
+ Rev 1.24 02 Oct 1992 16:33:26 STEVEN
+Changed to report drive failure for NT only.
+
+ Rev 1.22 02 Sep 1992 16:32:24 GLENN
+MikeP changes for NT.
+
+ Rev 1.21 28 Jul 1992 14:41:58 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.20 24 Jul 1992 10:37:00 STEVEN
+do not start polldrive if no drive exists
+
+ Rev 1.19 31 May 1992 11:13:20 MIKEP
+auto catalog changes
+
+ Rev 1.18 14 May 1992 18:00:10 MIKEP
+nt pass 2
+
+ Rev 1.17 23 Mar 1992 15:53:08 GLENN
+Added success message box when hardware retests successful.
+
+ Rev 1.16 19 Mar 1992 15:58:02 GLENN
+Fixed eject bug.
+
+ Rev 1.15 17 Mar 1992 15:39:26 GLENN
+Changed major and minor hardware error processing.
+
+ Rev 1.14 31 Jan 1992 15:02:10 GLENN
+Added restart logic messaging and major error messaging.
+
+ Rev 1.13 21 Jan 1992 16:57:04 JOHNWT
+removed checkyy flag
+
+ Rev 1.12 14 Jan 1992 08:17:08 GLENN
+Updated error processor.
+
+ Rev 1.11 11 Jan 1992 09:22:02 CARLS
+remove strings
+
+ Rev 1.10 07 Jan 1992 17:31:42 GLENN
+Added support for polldrive retry after hwinit failure
+
+ Rev 1.9 26 Dec 1991 13:37:00 GLENN
+Added yy flag check to message boxes
+
+ Rev 1.8 20 Dec 1991 09:34:48 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.7 18 Dec 1991 14:06:42 GLENN
+Added windows.h
+
+ Rev 1.6 18 Dec 1991 13:13:12 GLENN
+Put backin poll drive init check in the start function
+
+ Rev 1.5 11 Dec 1991 13:05:10 JOHNWT
+changed assert in StopPolling to return
+
+ Rev 1.4 04 Dec 1991 18:19:22 GLENN
+Added TF_NO_TAPE_PRESENT to eject error processing.
+
+ Rev 1.3 04 Dec 1991 12:55:24 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.2 27 Nov 1991 12:12:52 GLENN
+Clean-up.
+
+ Rev 1.1 21 Nov 1991 10:42:18 GLENN
+Added headers and eject/polldrive re-entrancy protection.
+
+ Rev 1.0 20 Nov 1991 19:19:54 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// POLL DRIVE DATA STRUCTURES
+
+typedef struct DS_SETTLE far *DS_SETTLE_PTR;
+typedef struct DS_SETTLE far *PDS_SETTLE;
+typedef struct DS_SETTLE {
+
+ BOOL fWaiting;
+ INT nCurrentState;
+ INT nTimeout;
+ INT nOldFrequency;
+ HTIMER hTimerID;
+ PF_VOID fnUserCallBack;
+
+} DS_SETTLE;
+
+static DS_SETTLE mwdsSettle;
+
+// PRIVATE MODULE WIDE VARIABLES
+
+static FSYS_HAND mwhFileSys = (FSYS_HAND)NULL;
+static BOOL mwfPDInitialized = FALSE;
+static BOOL mwfPollDriveInUse = FALSE;
+static BOOL mwfSignalWhenAvailable = FALSE;
+static BOOL mwfStarted = FALSE;
+static HTIMER mwhTimer = INVALID_TIMER_HANDLE;
+static INT mwnFrequency = 0;
+static INT mwnEjectAttempts = 0;
+static BOOL mwfEjectInProgess = FALSE;
+static BOOL mwfFastPolling = FALSE;
+static INT mwnOldFrequency = 0;
+static DBLK mwVCB;
+static INT16 mwnLastMsg;
+static BOOL mwfInVLMTapeChanged = FALSE;
+
+
+// PRIVATE FUNCTION PROTOTYPES
+
+static UINT16 PD_TapePosCallBack ( WORD wMsg, TPOS_PTR pTpos, BOOL fCurrValidVCB, DBLK_PTR pCurVCB, WORD wMode ) ;
+static VOID PD_DisplayMajorError ( WORD res_id, INT16 pd_error );
+static INT PD_GetLastMessage ( VOID );
+static VOID PD_SettleCallBack ( VOID );
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: PD_Init()
+
+ Description: Initializes the UI portion of poll drive.
+
+ Returns: SUCCESS, if successful, otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL PD_Init ( VOID )
+
+{
+ // Get a generic file system handle.
+
+ if ( FS_OpenFileSys ( &mwhFileSys, GENERIC_DATA, CDS_GetPermBEC () ) ) {
+
+ mwhFileSys = (FSYS_HAND)NULL;
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_INIT_FAILED );
+ return FAILURE;
+ }
+
+ mwfPDInitialized = TRUE;
+
+ // Show the init message in the debug window.
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_INIT );
+
+ return SUCCESS;
+
+} /* end PD_Init() */
+
+
+/******************************************************************************
+
+ Name: PD_Deinit()
+
+ Description: Deinitializes the UI portion of poll drive.
+
+ Returns: SUCCESS, if successful, otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL PD_Deinit ( VOID )
+
+{
+ // Close the generic file system using the stored file system handle.
+
+ if ( mwfPDInitialized && mwhFileSys ) {
+ FS_CloseFileSys( mwhFileSys );
+ }
+
+ mwfPDInitialized = FALSE;
+
+ return SUCCESS;
+
+} /* end PD_Deinit() */
+
+
+/******************************************************************************
+
+ Name: PD_StartPolling()
+
+ Description: Determines if the TF poll drive can be called. If it can,
+ it will start it with a timer callback to PD_PollDrive().
+
+ Returns: SUCCESS, if successful, otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL PD_StartPolling ( VOID )
+
+{
+ INT16 nMsg;
+
+ // If poll drive was never or is no longer initialized, or was previously
+ // started, or poll drive is not enabled, or we do not have a generic
+ // file system handle, or the hardware was not initialized, BUG OUT.
+
+ if ( ! mwfPDInitialized || mwfStarted || ! gfPollDrive || ! mwhFileSys || ! gfHWInitialized ) {
+ zprintf ( 0, TEXT("Poll Drive Start IGNORED - already started or HW not initialized") );
+ return FAILURE;
+ }
+
+ if ( mwfPollDriveInUse ) {
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_START_REENT );
+ return FAILURE;
+ }
+
+ mwfPollDriveInUse = TRUE;
+
+ nMsg = TF_PollDrive( thw_list, (DBLK_PTR)&mwVCB, mwhFileSys,
+ (TPOS_HANDLER) PD_TapePosCallBack, (INT16) PDMSG_START );
+
+ if ( nMsg != PD_NO_CHANGE ) {
+ mwnLastMsg = nMsg;
+ }
+
+ // Show the message in the debug window.
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_START, nMsg );
+
+ switch ( nMsg ) {
+
+ case PD_DRIVE_FAILURE:
+ case PD_DRIVER_FAILURE:
+
+ // End the poll drive and fall through to the break.
+
+ TF_PollDrive ( thw_list, (DBLK_PTR)&mwVCB, mwhFileSys,
+ (TPOS_HANDLER)PD_TapePosCallBack, (INT16) PDMSG_END );
+
+ // Start failed.
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_FAILED_MINOR );
+
+ gfHWInitialized = FALSE;
+
+ PD_AttemptRestart ();
+
+ break;
+
+ case PD_OUT_OF_MEMORY:
+ case PD_NO_FREE_CHANNELS:
+ case PD_FUBAR:
+
+ // Start failed.
+
+ // ????? THE APPLICATION SHOULD BE SHUT DOWN AT THIS POINT.
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_FAILED_SEVERE );
+
+ gfPollDrive = FALSE;
+
+ break;
+
+
+ default:
+
+ mwfStarted = TRUE;
+
+ // Kick off the timer.
+
+ mwhTimer = WM_HookTimer ( (PF_VOID)PD_PollDrive, (WORD)PD_TIMERDELAY );
+
+ // Signal the VLM that the tape has changed.
+
+ mwfInVLMTapeChanged = TRUE;
+ VLM_TapeChanged ( nMsg, &mwVCB, mwhFileSys );
+ mwfInVLMTapeChanged = FALSE;
+
+ break;
+ }
+
+ mwfPollDriveInUse = FALSE;
+
+ return ( mwfStarted ) ? SUCCESS : FAILURE ;
+
+} /* end PD_StartPolling () */
+
+
+/******************************************************************************
+
+ Name: PD_StopPolling()
+
+ Description: Stops TF poll drive only if poll drive was previously
+ started. It also removes the timer for the PD_PollDrive()
+ call back.
+
+ Returns: SUCCESS, if successful, otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL PD_StopPolling ( VOID )
+
+{
+ INT16 nMsg;
+
+ // If the polling was not started, simply return.
+
+ if ( ! mwfPDInitialized || ! mwfStarted ) {
+ zprintf ( 0, TEXT("Poll Drive Stop IGNORED - not started") );
+ return FAILURE;
+ }
+
+ if ( mwfPollDriveInUse ) {
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_STOP_REENT );
+ return FAILURE;
+ }
+
+ mwfPollDriveInUse = TRUE;
+
+ // Turn the started flag off so that no continue messages are sent to the
+ // TF_PollDrive() function by the timer function.
+
+ mwfStarted = FALSE;
+
+ // Unhook the timer -- this is done before a tape operation.
+
+ WM_UnhookTimer ( mwhTimer );
+
+ // Call the TF to stop the polling.
+
+ nMsg = TF_PollDrive( thw_list, (DBLK_PTR)&mwVCB, mwhFileSys,
+ (TPOS_HANDLER)PD_TapePosCallBack, (INT16) PDMSG_END );
+
+ if ( nMsg != PD_NO_CHANGE ) {
+ mwnLastMsg = nMsg;
+ }
+
+ // Show the message in the debug window.
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_STOP, nMsg );
+
+ switch ( nMsg ) {
+
+ case PD_BUSY:
+
+ break;
+
+ case PD_SQL_TAPE:
+ case PD_NO_TAPE:
+ case PD_NEW_TAPE:
+ case PD_VALID_VCB:
+ case PD_BLANK_TAPE:
+ case PD_FOREIGN_TAPE:
+ case PD_MTF_ECC_TAPE:
+ case PD_FUTURE_REV_MTF:
+ case PD_UNRECOGNIZED_MEDIA:
+
+ // Signal the VLM that the tape has changed.
+
+ mwfInVLMTapeChanged = TRUE;
+ VLM_TapeChanged ( nMsg, &mwVCB, mwhFileSys );
+ mwfInVLMTapeChanged = FALSE;
+ break;
+
+ default:
+
+ break;
+ }
+
+ mwfPollDriveInUse = FALSE;
+
+ return SUCCESS;
+
+} /* end PD_StopPolling() */
+
+
+/******************************************************************************
+
+ Name: PD_SetFrequency()
+
+ Description: Sets the frequency of poll drive (in seconds).
+
+ Returns: The old poll drive frequency.
+
+******************************************************************************/
+
+INT PD_SetFrequency (
+
+INT nFrequency ) // I - frequency to call poll drive
+
+{
+ // If the frequency is not specified, set it to the poll drive default.
+ // Otherwise, change the module wide default frequency.
+
+ if ( ! nFrequency ) {
+ nFrequency = mwnFrequency;
+ }
+ else {
+ mwnFrequency = nFrequency;
+ }
+
+ // If we are in the middle of a fast poll, set the old frequency to
+ // the new frequency that was past, and return the old frequency, but
+ // dont actually reset the timer frequency right now, because it will
+ // be set to the new frequency when the fast polling stops. OK?
+
+ if ( mwfFastPolling ) {
+
+ nFrequency = mwnOldFrequency;
+ mwnOldFrequency = mwnFrequency;
+ }
+ else {
+
+ nFrequency = WM_SetTimerFrequency ( mwhTimer, nFrequency );
+ }
+
+ // Get/Set the old poll drive frequency from the timer module.
+
+ return nFrequency;
+
+} /* end PD_SetFrequency() */
+
+
+/******************************************************************************
+
+ Name: PD_PollDrive()
+
+ Description: CALLED BY HOOKING THE WM_HookTimer() to call TF poll drive
+ only if poll drive was started and poll drive is not
+ currently in progress (re-entered).
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID PD_PollDrive ( VOID )
+
+{
+ INT16 nMsg;
+
+ // If the polling was not started, somebody is calling it directly.
+ // THIS IS NOT ALLOWED, so ASSERT.
+
+ msassert ( mwfStarted );
+
+ if ( mwfPollDriveInUse ) {
+
+ mwfSignalWhenAvailable = TRUE;
+ if( !mwfInVLMTapeChanged ) {
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_POLL_REENT );
+ }
+ return;
+ }
+
+ mwfPollDriveInUse = TRUE;
+
+ nMsg = TF_PollDrive( thw_list, (DBLK_PTR)&mwVCB, mwhFileSys,
+ (TPOS_HANDLER)PD_TapePosCallBack, (INT16) PDMSG_CONTINUE );
+
+ if ( nMsg != PD_NO_CHANGE ) {
+ mwnLastMsg = nMsg;
+ }
+
+ switch ( nMsg ) {
+
+ case PD_DRIVE_FAILURE:
+ case PD_DRIVER_FAILURE:
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_FAILED_MINOR );
+
+ gfHWInitialized = FALSE;
+ mwfPollDriveInUse = FALSE;
+
+ PD_StopPolling ();
+
+ VLM_TapeChanged ( nMsg, &mwVCB, mwhFileSys );
+
+ // The following may need to be done with some sort of a PostMessage,
+ // if it fails to work properly. Maybe, maybe not. I guess we'll
+ // find out sooner or later.
+
+#ifdef OS_WIN32
+
+ // OK, there is a small problem. Let's tell the user.
+
+ PD_DisplayMajorError ( IDS_POLLDRIVE_SMALLPROBLEM, nMsg );
+
+#else
+ PD_AttemptRestart ();
+
+#endif
+ break;
+
+ case PD_FUBAR:
+ case PD_OUT_OF_MEMORY:
+
+ // Stop the polling and clear the hardware initialized flag so that
+ // the next time the user goes to perform an operation, he/she
+ // will get notified of the error. At this time, TF_PollDrive()
+ // does not do any error processing with the UI.
+
+ // ????? THE APPLICATION SHOULD BE SHUT DOWN AT THIS POINT.
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_FAILED_SEVERE );
+
+ gfPollDrive = FALSE;
+ gfHWInitialized = FALSE;
+ mwfPollDriveInUse = FALSE;
+
+ PD_DisplayMajorError ( IDS_POLLDRIVE_FAILED_SEVERE, 0 );
+ PD_StopPolling ();
+
+ break;
+
+ case PD_BUSY:
+ break;
+
+ case PD_NEW_TAPE:
+
+ // Make sure that fast polling is turned on.
+
+ if ( ! mwfFastPolling ) {
+
+ mwnOldFrequency = WM_SetTimerFrequency ( mwhTimer, -1 );
+ mwfFastPolling = TRUE;
+ }
+
+ // Signal the VLM that the tape has changed.
+
+ mwfInVLMTapeChanged = TRUE;
+ VLM_TapeChanged ( nMsg, &mwVCB, mwhFileSys );
+ mwfInVLMTapeChanged = FALSE;
+ break;
+
+ case PD_NO_TAPE:
+ case PD_SQL_TAPE:
+ case PD_BAD_TAPE:
+ case PD_VALID_VCB:
+ case PD_BLANK_TAPE:
+ case PD_FOREIGN_TAPE:
+ case PD_MTF_ECC_TAPE:
+ case PD_FUTURE_REV_MTF:
+ case PD_UNRECOGNIZED_MEDIA:
+ case PD_OUT_OF_SEQUENCE:
+
+ // OK, if fast polling is on, you can turn it off now.
+
+ if ( mwfFastPolling ) {
+
+ WM_SetTimerFrequency ( mwhTimer, mwnOldFrequency );
+ mwfFastPolling = FALSE;
+ }
+
+ // Signal the VLM that the tape has changed.
+
+ mwfInVLMTapeChanged = TRUE;
+ VLM_TapeChanged ( nMsg, &mwVCB, mwhFileSys );
+ mwfInVLMTapeChanged = FALSE;
+ break;
+
+ case PD_NO_CHANGE:
+
+ break;
+
+ default:
+
+ // THE APP WILL BE COMPLETELY HOSED.
+
+ msassert ( FALSE );
+
+ break;
+ }
+
+ mwfPollDriveInUse = FALSE;
+
+ if ( mwfSignalWhenAvailable ) {
+ PostMessage ( ghWndFrame, WM_POLLDRIVEMSG, (MP1)0, (MP2)0 );
+ mwfSignalWhenAvailable = FALSE;
+ }
+
+} /* end PD_PollDrive() */
+
+
+/*****************************************************************************
+
+ Name: PD_GetLastMessage
+
+ Description: Poll drive last message status routine.
+
+ Returns: Poll drive last message status.
+
+*****************************************************************************/
+
+INT PD_GetLastMessage ( VOID )
+
+{
+ return (INT)mwnLastMsg;
+
+} /* end PD_GetLastMessage () */
+
+
+/******************************************************************************
+
+ Name: PD_IsPollDriveBusy()
+
+ Description: Called to determine if Poll Drive is busy in the process
+ of executing.
+
+ Returns: TRUE, if busy. Otherwise, FALSE.
+
+******************************************************************************/
+
+BOOL PD_IsPollDriveBusy ( VOID )
+
+{
+ if ( mwfPollDriveInUse ) {
+ mwfSignalWhenAvailable = TRUE;
+ }
+
+ return mwfPollDriveInUse;
+
+} /* end PD_IsPollDriveBusy () */
+
+
+
+/******************************************************************************
+
+ Name: PD_AttemptRestart()
+
+ Description: Attempts to restart poll drive when a minor error occurs.
+ This should be called only when a minor error has occured.
+
+ Returns: SUCCESS, if successful, otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL PD_AttemptRestart ( VOID )
+
+{
+ BOOL fResult;
+ INT nAnswer;
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_SMALLPROBLEM );
+
+ // OK, there is a small problem. Let's tell the user.
+
+ nAnswer = WM_MsgBox ( ID(IDS_POLLDRIVE_MESSAGE),
+ ID(IDS_POLLDRIVE_SMALLPROBLEM),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION
+ );
+
+ // Attempt to reinitialize the hardware.
+ // If successful, reset the "restart attempts" counter.
+ // If unsuccessful, put the user into the hardware configuration
+ // dialog.
+
+ if ( ! HWC_TapeHWProblem ( bsd_list ) ) {
+
+ WM_MsgBox ( ID(IDS_HWC_TESTRESULTSTITLE),
+ ID(IDS_HWC_INIT_SUCCESS),
+ WMMB_OK,
+ WMMB_ICONINFORMATION
+ );
+
+ fResult = SUCCESS;
+ }
+ else {
+
+ DM_ShowDialog ( ghWndFrame, IDD_SETTINGSHARDWARE, (PVOID)0 );
+
+ if ( gfHWInitialized ) {
+
+ // It be fixed now.
+
+ fResult = SUCCESS;
+ }
+ else {
+
+ // We're HOSED!!!!!
+
+ PD_DisplayMajorError ( IDS_POLLDRIVE_BIGPROBLEM, 0 );
+ fResult = FAILURE;
+ }
+ }
+
+ // Turn Polling back on if everything is OK.
+
+ if ( fResult == SUCCESS ) {
+
+ PD_StartPolling ();
+ }
+
+ STM_SetIdleText ( IDS_READY );
+
+ return fResult;
+
+} /* end PD_AttemptRestart() */
+
+
+/******************************************************************************
+
+ Name: PD_TapePosCallBack()
+
+ Description: This is called by the TF layer during a lengthy operation.
+
+ Returns: UI_ACKNOWLEDGED.
+
+******************************************************************************/
+
+static UINT16 PD_TapePosCallBack (
+
+WORD wMsg,
+TPOS_PTR pTpos,
+BOOL fCurrValidVCB,
+DBLK_PTR pVCB,
+WORD wMode )
+
+{
+ DBG_UNREFERENCED_PARAMETER ( wMsg );
+ DBG_UNREFERENCED_PARAMETER ( pTpos );
+ DBG_UNREFERENCED_PARAMETER ( fCurrValidVCB );
+ DBG_UNREFERENCED_PARAMETER ( pVCB );
+ DBG_UNREFERENCED_PARAMETER ( wMode );
+
+ // Allow the GUI to update any display changes.
+
+ WM_MultiTask ();
+
+ return UI_ACKNOWLEDGED;
+
+} /* end PD_TapePosCallBack() */
+
+
+/******************************************************************************
+
+ Name: PD_DisplayMajorError()
+
+ Description: This is called by the TF layer during a lengthy operation.
+
+ Returns: UI_ACKNOWLEDGED.
+
+******************************************************************************/
+
+static VOID PD_DisplayMajorError ( WORD res_id, INT16 pd_error )
+
+{
+ CHAR szString[MAX_UI_RESOURCE_SIZE];
+ CHAR szMessage[MAX_UI_RESOURCE_SIZE];
+ CHAR szAppName[MAX_UI_RESOURCE_SIZE];
+ BOOLEAN have_msg = FALSE;
+
+ if ( res_id == IDS_POLLDRIVE_SMALLPROBLEM ) {
+ have_msg = UI_GetExtendedErrorString( pd_error, szMessage );
+ }
+
+ if ( !have_msg ) {
+ RSM_StringCopy ( res_id, szString, sizeof ( szString ) );
+ RSM_StringCopy ( IDS_APPNAME, szAppName, sizeof ( szAppName ) );
+ sprintf ( szMessage, szString, szAppName );
+ }
+
+ WM_MsgBox ( ID(IDS_POLLDRIVE_MESSAGE),
+ szMessage,
+ WMMB_OK,
+ WMMB_ICONSTOP
+ );
+
+} /* end PD_DisplayMajorError() */
+
+
+/******************************************************************************
+
+ Name: PD_EjectTape()
+
+ Description: Rewinds and Ejects a tape only if poll drive is not in use
+ (by some strange re-entry occurance). TF poll drive must
+ be ended prior to calling TF eject tape, otherwise
+ unpredictable results will occur. (we make sure it is ended)
+ If we detect poll drive in use, we post a message to eject
+ the tape at a later time.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID PD_EjectTape ( VOID )
+
+{
+ INT rc;
+ INT16 tf_rc;
+ CHAR szMessage[MAX_UI_RESOURCE_SIZE];
+
+ // Wait until poll drive is settled into a known state before attempting
+ // to eject the tape.
+
+ rc = PD_WaitUntilSettled ( PD_SETTLE_NOCALLBACK, 30 );
+
+ if ( rc == PD_SETTLE_TIMEOUT ) {
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_EJECTTAPEBIGPROBLEM );
+
+ WM_MsgBox ( ID(IDS_EJECTTAPEMESSAGE),
+ ID(IDS_EJECTTAPEBIGPROBLEM),
+ WMMB_OK,
+ WMMB_ICONINFORMATION
+ );
+ }
+
+ // Reset the eject attempts.
+
+ mwnEjectAttempts = 0;
+
+ // Call the Tape Format Eject API if there is no hardware problem
+ // and we are busy fast polling or the tape is known to be in the drive.
+ // If we are fast polling, the tape is still in the drive even if the
+ // tape in drive status indicates otherwise by the VLM.
+
+ if ( MUI_IsTapeInDrive () && ! HWC_TapeHWProblem ( bsd_list ) ) {
+
+ // Turn off Polling.
+
+ PD_StopPolling ();
+
+ tf_rc = (INT)TF_EjectTape ( thw_list, (TPOS_HANDLER)PD_TapePosCallBack );
+
+ switch ( tf_rc ) {
+
+ case TFLE_NO_ERR:
+
+ // Put up a manual eject message box if electronic eject is not
+ // supported.
+
+ if ( ! MUI_IsEjectSupported () ) {
+
+ WM_MsgBox ( ID(IDS_EJECTTAPEMESSAGE),
+ ID(IDS_EJECTTAPEMANUALEJECT),
+ WMMB_OKCANCEL,
+ WMMB_ICONINFORMATION
+ );
+ }
+
+ break;
+
+ case TFLE_NO_TAPE:
+ case TF_NO_TAPE_PRESENT:
+
+ WM_MsgBox ( ID(IDS_EJECTTAPEMESSAGE),
+ ID(IDS_EJECTTAPENOTAPE),
+ WMMB_OK,
+ WMMB_ICONINFORMATION
+ );
+ break;
+
+ case TFLE_DRIVE_FAILURE:
+ case TFLE_DRIVER_FAILURE:
+
+ if ( ! UI_GetExtendedErrorString( tf_rc, szMessage ) ) {
+ RSM_StringCopy ( IDS_EJECTTAPEBIGPROBLEM, szMessage, MAX_UI_RESOURCE_LEN );
+ }
+ WM_MsgBox ( ID(IDS_EJECTTAPEMESSAGE),
+ szMessage,
+ WMMB_OK,
+ WMMB_ICONINFORMATION
+ );
+ break;
+
+ default:
+
+ zprintf ( DEBUG_USER_INTERFACE, IDS_POLLDRIVE_TAPE_EJECT, tf_rc );
+
+ WM_MsgBox ( ID(IDS_EJECTTAPEMESSAGE),
+ ID(IDS_EJECTTAPEBIGPROBLEM),
+ WMMB_OK,
+ WMMB_ICONINFORMATION
+ );
+ break;
+ }
+
+ MUI_TapeInDrive ( FALSE );
+
+ // Turn Polling back on.
+
+ PD_StartPolling ();
+ }
+ else {
+
+ // TEMPORARY
+
+ MessageBeep ( MB_ICONEXCLAMATION );
+ }
+
+
+} /* end PD_EjectTape() */
+
+
+/*****************************************************************************
+
+ Name: PD_WaitUntilSettled ()
+
+ Description: Waits untile poll drive has settled to a known state.
+
+ Returns:
+
+*****************************************************************************/
+
+INT PD_WaitUntilSettled (
+
+PF_VOID fnCallBack,
+INT nTimeout )
+
+{
+
+ // If the polling was not started, simply return not started.
+
+ if ( ! mwfPDInitialized || ! mwfStarted ) {
+ zprintf ( 0, TEXT("Poll Drive Wait Until Settled IGNORED - poll drive was not started") );
+ return PD_SETTLE_NOTINITIALIZED;
+ }
+
+ // Bug out if already waiting.
+
+ if ( mwdsSettle.fWaiting ) {
+
+ return PD_SETTLE_ALREADYWAITING;
+ }
+
+ mwdsSettle.fWaiting = TRUE;
+ mwdsSettle.nCurrentState = PD_SETTLE_UNKNOWN;
+ mwdsSettle.nTimeout = nTimeout;
+ mwdsSettle.fnUserCallBack = fnCallBack;
+
+ // Set up the callback.
+
+ if ( nTimeout ) {
+
+ PD_SettleCallBack ( );
+
+ if ( mwdsSettle.nCurrentState == PD_SETTLE_UNKNOWN ) {
+
+ // Set up the timer and set the PD frequency to one second.
+
+// mwdsSettle.nOldFrequency = PD_SetFrequency ( 1 );
+ mwdsSettle.hTimerID = WM_HookTimer ( PD_SettleCallBack, 1 );
+
+ while ( mwdsSettle.nCurrentState == PD_SETTLE_UNKNOWN ) {
+
+ WaitMessage ();
+ WM_MultiTask ();
+ }
+
+ }
+ }
+ else {
+
+ // Set up the timer and set the PD frequency to one second.
+ // The settle call back routine will unhook the timer and reset
+ // the frequency when a stable state occurs.
+
+// mwdsSettle.nOldFrequency = PD_SetFrequency ( 1 );
+ mwdsSettle.hTimerID = WM_HookTimer ( PD_SettleCallBack, 1 );
+ }
+
+ mwdsSettle.fWaiting = FALSE;
+
+ return mwdsSettle.nCurrentState;
+
+} /* end PD_WaitUntilSettled */
+
+
+/*****************************************************************************
+
+ Name: PD_SettleCallBack ()
+
+ Description: Poll drive status routine
+
+ Returns: VOID
+
+*****************************************************************************/
+
+static VOID PD_SettleCallBack ( VOID )
+
+{
+ static INT nCallCount = 0;
+
+ INT nLastMsg = PD_GetLastMessage ();
+
+
+ switch ( nLastMsg ) {
+
+ case PD_NO_TAPE:
+ case PD_SQL_TAPE:
+ case PD_BAD_TAPE:
+ case PD_VALID_VCB:
+ case PD_BLANK_TAPE:
+ case PD_FOREIGN_TAPE:
+ case PD_MTF_ECC_TAPE:
+ case PD_FUTURE_REV_MTF:
+ case PD_UNRECOGNIZED_MEDIA:
+ case PD_OUT_OF_SEQUENCE:
+
+ mwdsSettle.nCurrentState = PD_SETTLE_OK;
+ nCallCount = 0;
+ break;
+
+ case PD_BUSY:
+ case PD_NEW_TAPE:
+
+ nCallCount++;
+ break;
+
+ default: // Some severe problem occurred - let's signal a break out.
+
+ mwdsSettle.nCurrentState = PD_SETTLE_ERROR;
+ nCallCount = 0;
+ }
+
+ // Check for a timeout.
+
+ if ( mwdsSettle.nTimeout != PD_SETTLE_NOWAIT && nCallCount > mwdsSettle.nTimeout ) {
+ mwdsSettle.nCurrentState = PD_SETTLE_TIMEOUT;
+ }
+
+ // If the state is now known, free up the timer.
+
+ if ( mwdsSettle.nCurrentState != PD_SETTLE_UNKNOWN ) {
+
+ // Free up the timer and reset the PD frequency back to
+ // the old one.
+
+ WM_UnhookTimer ( mwdsSettle.hTimerID );
+// PD_SetFrequency ( mwdsSettle.nOldFrequency );
+ }
+
+ // Call back the users function.
+
+ if ( mwdsSettle.fnUserCallBack ) {
+
+ mwdsSettle.fnUserCallBack ();
+ }
+
+} /* end PD_SettleCallBack () */
+
diff --git a/private/utils/ntbackup/src/posatset.c b/private/utils/ntbackup/src/posatset.c
new file mode 100644
index 000000000..745bd0f26
--- /dev/null
+++ b/private/utils/ntbackup/src/posatset.c
@@ -0,0 +1,1185 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: posatset.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the code for PositionAtSet().
+
+
+ $Log: T:/LOGFILES/POSATSET.C_V $
+
+ Rev 1.42.1.6 24 May 1994 20:16:22 GREGG
+Never eject foreign tapes in write mode.
+
+ Rev 1.42.1.5 24 May 1994 15:55:50 GREGG
+Report wierd tapes (SQL, Sytos continuation, etc.) as WRONG_TAPE when
+searching for EOD to append.
+
+ Rev 1.42.1.4 11 May 1994 14:36:58 GREGG
+Don't eject foreign tapes in write-continue mode.
+
+ Rev 1.42.1.3 01 Feb 1994 15:12:28 GREGG
+Put TEXT macros debug print format strings.
+
+ Rev 1.42.1.2 21 Nov 1993 23:34:22 GREGG
+Added eject on conditions where we know we need a different tape.
+
+ Rev 1.42.1.1 17 Nov 1993 00:56:48 GREGG
+1. Handle no tape and new tape conditions returned from Mount after UI
+ callback.
+2. Report an error if the UI tells us to append and the format on the
+ current tape doesn't allow append operations.
+
+ Rev 1.42.1.0 27 Sep 1993 14:16:28 GREGG
+Reset pos info so we don't look for a particular tape during EOM continuation.
+
+ Rev 1.42 03 Aug 1993 21:23:50 ZEIR
+fixes/cleanups for UI_FAST_APPEND & UI_EOD
+
+ Rev 1.41 21 Jul 1993 19:13:40 ZEIR
+Reintroduced TAPES_FIRST_TO_LAST logic from Cougar/Skateboard.
+
+ Rev 1.40 15 Jul 1993 11:51:44 GREGG
+Don't free the fmt env on TF_EMPTY_TAPE msg when in cont mode.
+
+ Rev 1.39 26 Jun 1993 02:03:02 GREGG
+Fixed a bug for a VERY specific case: The UI wants to partially catalogging
+a tape, so they keep starting read operations requesting -1, -1, -1, and
+then aborting them once DoRead gives them the VCB. If DoRead reads to EOM
+before getting aborted, then we are sitting at EOM and at MOS when the next
+request comes in for -1, -1, -1. In this unique case, we clear the channel
+EOM bit, and set the tf_msg to TF_NEED_NEW_TAPE before we even enter the
+positioning loop the first time, because this case is too confusing for the
+rest of the positioning logic.
+
+ Rev 1.38 18 Jun 1993 17:12:48 GREGG
+Fixed EPR 294-0560 - Now reports wrong tape instead of empty or invalid tape.
+
+ Rev 1.37 13 Jun 1993 21:57:28 GREGG
+Fix for EPR #294-0544 -- Continuation on EOD search was being allowed to
+tapes not in the same family. This fix require a change to the backup tpos
+routine to expect TF_WRONG_TAPE, and to use the sequence number in the
+position info structure to prompt for the tape on WRONG_TAPE and NEED_NEW.
+
+ Rev 1.36 22 May 1993 22:20:04 GREGG
+Fix for EPR 357-0250 - won't append if drive can't do fast append.
+
+ Rev 1.35 19 May 1993 15:57:00 GREGG
+Added logic to prevent using tape with same family id to continue a backup.
+
+ Rev 1.34 17 May 1993 20:12:06 GREGG
+Added logic to deal with the fact that the app above tape format doesn't
+keep track of the lba of the vcb.
+
+ Rev 1.33 29 Apr 1993 22:26:56 GREGG
+Need to call StartRead even if we're going to do FFR.
+
+ Rev 1.32 14 Apr 1993 01:59:58 GREGG
+Fixes to deal with non-ffr tapes in ffr drives (i.e. EXB2200 in EXB5000).
+
+ Rev 1.31 12 Apr 1993 22:35:18 GREGG
+Don't do Fast Append if the drive doesn't have the features to support it.
+
+ Rev 1.30 01 Apr 1993 13:50:22 GREGG
+Fixed a STUPID logic error in changes made for last rev.
+
+ Rev 1.29 31 Mar 1993 18:24:12 GREGG
+Always dismount before calling the UI.
+
+ Rev 1.28 30 Mar 1993 16:15:46 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.27 10 Mar 1993 11:01:52 GREGG
+Dismount tape if write protected and in write mode anticipating tape change.
+
+ Rev 1.26 26 Jan 1993 18:22:48 GREGG
+Added Fast Append functionality.
+
+ Rev 1.25 04 Aug 1992 17:17:12 GREGG
+Added case for UI_NON_OTC_SCAN.
+
+ Rev 1.24 23 Jul 1992 10:33:04 GREGG
+Fixed warnings.
+
+ Rev 1.23 15 Jul 1992 12:23:12 GREGG
+Don't punt the buffer at the end if the mode is TF_SCAN_CONTINUE.
+
+ Rev 1.22 05 Apr 1992 19:13:48 GREGG
+ROLLER BLADES - Removed call to InitTape, and don't call StartRead in write mode!
+
+ Rev 1.21 28 Mar 1992 18:23:00 GREGG
+ROLLER BLADES - OTC - Initial integration.
+
+ Rev 1.20 20 Feb 1992 18:15:20 NED
+ensured proper rewind upon finding a foreign tape.
+
+ Rev 1.19 12 Feb 1992 19:16:42 GREGG
+Bug fixes.
+
+ Rev 1.18 08 Feb 1992 14:29:10 GREGG
+Removed references to lst_oper in drive stucture (it no longer exits).
+
+ Rev 1.17 15 Jan 1992 01:47:54 GREGG
+Added a boolean parameter indicating if all they want is a VCB off the tape,
+and code to call the special GetVCBBuff if that is the case.
+
+ Rev 1.16 13 Jan 1992 13:45:22 GREGG
+Skateboard - Bug fixes.
+
+ Rev 1.15 02 Jan 1992 14:56:52 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.14 05 Dec 1991 13:51:22 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.13 29 Oct 1991 10:42:10 GREGG
+BIGWHEEL - EPR #13 - Don't increment tape_seq_num for next_tape if dont_care.
+
+ Rev 1.12 23 Oct 1991 10:07:44 GREGG
+EPR #7 - Replaced rewindDrive with ResetDrivePosition when aborting from NEED_NEW_TAPE.
+
+ Rev 1.11 17 Oct 1991 01:25:46 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.10 17 Sep 1991 12:06:20 GREGG
+Changed continuation logic to save format in channel, and only during write.
+
+ Rev 1.9 22 Aug 1991 16:40:06 NED
+Changed all references to internals of the buffer structure to macros.
+
+ Rev 1.8 16 Aug 1991 09:30:06 GREGG
+Added saving of current format at continuation time.
+
+ Rev 1.7 14 Aug 1991 12:17:26 GREGG
+Indicate drive sholud be rewound on calls to ResetChannelList so that the
+current tape is rewound before the user is prompted for a new one.
+Eliminated stuff to throw away the current buffer on user and happy abort.
+
+ Rev 1.6 22 Jul 1991 13:01:24 GREGG
+Removed macro calls to set unreferenced channel status bits.
+Added handling for two new channel status bits: CH_CONTINUING and CH_EOS_AT_EOM.
+
+ Rev 1.5 10 Jul 1991 11:12:22 GREGG
+Free format environment in case of an aborted continuation.
+
+ Rev 1.4 09 Jul 1991 16:06:14 NED
+Free format env if tape in drive is found to be empty.
+Pass address of the position structure's backup set number to GotoBckUpSet.
+Handle exception in current buffer (if any) at Happy Abort time.
+
+ Rev 1.3 26 Jun 1991 16:23:08 NED
+added exception handling prior to PuntBuffer after UI_HAPPY_ABORT
+zeroed bytes_free after SnagBuffer at top of positioning loop for F25_MoveToVCB()
+
+ Rev 1.2 20 Jun 1991 14:30:46 GREGG
+Removed forced rewind on abort.
+
+ Rev 1.1 10 May 1991 16:18:04 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:12:16 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdtypes.h>
+#include <queues.h>
+
+#include "channel.h"
+#include "drive.h"
+#include "tpos.h"
+#include "lwprotos.h"
+#include "tfl_err.h"
+#include "tfldefs.h"
+#include "translat.h"
+#include "sx.h"
+#include "lw_data.h"
+
+/* Device driver header source */
+#include "retbuf.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genstat.h"
+#include "dil.h"
+#include "tdemo.h"
+
+/* The file system files */
+#include "fsys.h"
+
+/* For Debug */
+#include "be_debug.h"
+
+
+/* $end$ include list */
+
+
+/* Some Useful Defines */
+
+#define NO_MATCH 0
+#define MATCH 1
+#define DONT_CARE 2
+
+/* Static Prototypes */
+static INT16 _near MatchTapeId( DBLK_PTR, INT32 ) ;
+static INT16 _near MatchTapeSeq( DBLK_PTR, INT16 ) ;
+static INT16 _near MatchBckSet( DBLK_PTR, INT16 ) ;
+
+
+
+/**/
+/**
+
+ Name: PositionAtSet
+
+ Description: This is the main tape positioning routine for the system.
+ This does the initial position on TF_OpenSet().
+
+ Modified: 3/1/1990 10:43:17
+
+ Returns: 0 if positioned OK, or an Error Code
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 PositionAtSet(
+ CHANNEL_PTR channel, /* Channel we are dealing with */
+ TPOS_PTR position, /* Tape Position desired */
+ BOOLEAN vcb_only ) /* TRUE: We're only going to VCB the tape */
+{
+ INT16 tmp ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ INT16 tf_msg = 0 ;
+ INT16 prev_tf_msg = 0 ;
+ UINT16 ui_msg = 0 ;
+ INT16 matched_id, matched_seq, matched_set ;
+ UINT16 mode ;
+ RET_BUF myret ;
+ BOOLEAN is_tape_present,
+ done = FALSE,
+ space = FALSE,
+ search_eod = FALSE,
+ need_new_vcb = FALSE,
+ write_mode = FALSE,
+ read_mode = FALSE,
+ cont_mode = FALSE,
+ abs_pos = FALSE,
+ pop_it = FALSE,
+ rewind_it = FALSE,
+ fast_file = FALSE ;
+
+ /* Set up some Booleans */
+ if( ( ( channel->mode & ~0x8000 ) == TF_WRITE_OPERATION ) ||
+ ( ( channel->mode & ~0x8000 ) == TF_WRITE_APPEND ) ) {
+ write_mode = TRUE ;
+ }
+
+ if( ( ( channel->mode & ~0x8000 ) == TF_READ_OPERATION ) ||
+ ( ( channel->mode & ~0x8000 ) == TF_READ_OPERATION ) ) {
+ read_mode = TRUE ;
+ }
+
+ if( channel->mode & 0x8000 ) {
+ cont_mode = TRUE ;
+ }
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_REQUESTED_SET,
+ position->tape_id, position->tape_seq_num, position->backup_set_num ) ;
+
+ /* The haven't specified a position, special READ processing */
+ if( !write_mode ) {
+
+ /* Are they requesting a fast position ( via ordinary SEEK ) ? */
+ fast_file = ( position->tape_loc.pba_vcb &&
+ ( DriveAttributes( channel->cur_drv ) & TDI_FAST_NBLK ) )
+ ? TRUE : FALSE ;
+
+ /* Are they requesting a fast position ( on an EXABYTE 8200SX - MaynStream 2200+ ) ? */
+ if( !fast_file && position->tape_loc.pba_vcb && SX_IsOK( channel ) ) {
+
+ /* if SX file exists for this physical tape THEN ... */
+ if( SX_OpenFile( channel,
+ position->tape_id,
+ position->tape_seq_num ) ) {
+
+ /* some record of the set exists in the SX file THEN ... */
+ if( SX_SeekSetInFile( channel,
+ position->backup_set_num,
+ (INT16)SX_FINDING_SET ) ) {
+
+ /* OK to fast file on the EXABYTE 8200SX - MaynStream 2200+ */
+ fast_file = TRUE ;
+ } else {
+ /* what's the point of keeping the file open */
+ SX_CloseFile( channel ) ;
+ }
+ }
+ }
+
+ /* If there are available bytes in the is buffer, and nothing has been
+ used from it, and we are at end of set ... then this must have been read
+ at the end of set on the last operation, so we don't need to read tape
+ */
+ if( ( channel->cur_buff != NULL ) &&
+ ( BM_BytesFree( channel->cur_buff ) && BM_NextByteOffset( channel->cur_buff ) == 0 ) &&
+ IsPosBitSet( channel->cur_drv, AT_EOS ) ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_RESIDUAL_READ_BUFFER ) ;
+ need_new_vcb = TRUE ;
+ } else if( position->tape_id == -1L && position->tape_seq_num == -1 && position->backup_set_num == -1 ) {
+ /* We are at the end of set, so lets get the next VCB */
+ if( IsPosBitSet( channel->cur_drv, AT_EOS ) ) {
+ need_new_vcb = TRUE ;
+ } else if( IsPosBitSet( channel->cur_drv, AT_MOS ) ) {
+ BE_Zprintf( 0, TEXT("Posatset: 'don't care' request at MOS \n") ) ;
+ need_new_vcb = TRUE ;
+ if( !AtEOM( channel ) ) {
+ BE_Zprintf( 0, TEXT(" Not at EOM, setting space = TRUE \n") ) ;
+ space = TRUE ;
+ } else {
+ BE_Zprintf( 0, TEXT(" At EOM, leaving space = FALSE \n") ) ;
+ if( cont_mode ) {
+ BE_Zprintf( 0, TEXT(" In cont mode, leaving EOM status \n") ) ;
+ } else {
+ BE_Zprintf( 0, TEXT(" Not in cont mode, clearing EOM status \n") ) ;
+ ClrChannelStatus( channel, CH_AT_EOM ) ;
+ tf_msg = TF_NEED_NEW_TAPE ;
+ }
+ }
+ }
+ }
+ }
+
+ /* If we don't have a buffer, then get one */
+
+ if( channel->cur_buff == NULL ) {
+ channel->cur_buff = ( vcb_only || write_mode ) ?
+ BM_GetVCBBuff( &channel->buffer_list ) :
+ BM_Get( &channel->buffer_list ) ;
+ if ( channel->cur_buff == NULL ) {
+ ret_val = TFLE_NO_MEMORY ;
+ } else {
+ BM_SetBytesFree( channel->cur_buff, 0 ) ;
+ }
+ }
+
+ if( cont_mode ) {
+ SetChannelStatus( channel, CH_CONTINUING ) ;
+ if( write_mode ) {
+ /* Save the write format */
+ channel->save_fmt = channel->cur_fmt ;
+ channel->cur_fmt = UNKNOWN_FORMAT ;
+ channel->save_env = channel->fmt_env ;
+ channel->fmt_env = NULL ;
+ }
+ }
+
+ /* At this point, if everything is ok, we should have a buffer.
+ Let's start positioning. */
+ while( !done && !ret_val ) {
+
+ /* The drive could have changed so reset it */
+ curDRV = channel->cur_drv ;
+
+ /* This code should only execute on a multi-drive channel */
+ if( curDRV->hold_buff != NULL ) {
+ PuntBuffer( channel ) ;
+ channel->cur_buff = curDRV->hold_buff ;
+ curDRV->hold_buff = NULL ;
+ BM_UnReserve( channel->cur_buff );
+ }
+
+ /* Has some position been specified */
+ if( position->tape_id != -1 || position->tape_seq_num != -1 || position->backup_set_num != -1 ) {
+ abs_pos = TRUE ;
+ }
+
+ if( !tf_msg ) {
+
+ /* Tell the UI we need a new tape if :
+ 1) There is no previous drive in the channel.
+ 2) We are at EOM.
+ 3) There is no previous ui_msg ( indicating this is the first pass ).
+ */
+ if( curDRV->thw_inf.channel_link.q_prev == NULL && AtEOM( channel ) && !ui_msg ) {
+
+ tf_msg = TF_NEED_NEW_TAPE ;
+
+ /* If a tape is not mounted, then there is not tape */
+ } else if( !IsTapeMounted( channel ) ) {
+
+ tf_msg = TF_NO_TAPE_PRESENT ;
+
+ /* We Need to read a new VCB if:
+ 1) The current drive's VCB is not valid, or
+ 2) The positioner is explicitly requesting a VCB, and
+ 3) We know we are not at the end of data
+ */
+ } else if( ( !curDRV->vcb_valid || need_new_vcb ) && !( IsPosBitSet( curDRV, AT_EOD ) ) ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_ATTEMPTING_TO_VCB ) ;
+ if ( ( IsPosBitSet( curDRV, AT_BOT ) && IsPosBitSet( curDRV, AT_EOS ) ) || space ) {
+ ClrPosBit( curDRV, AT_BOT ) ;
+ }
+ if ( IsPosBitSet( curDRV, AT_BOT ) ) {
+ tmp = ReadNewTape( channel, position, TRUE ) ;
+ } else {
+ tmp = MoveNextSet( channel, position ) ;
+ }
+ if ( tmp == TFLE_NO_ERR ) {
+ tmp = ReadThisSet( channel ) ;
+ }
+ space = FALSE ;
+ /* If there is an Error, Who do I address it to ? */
+ IsTFLE( tmp ) ? ( ret_val = tmp ) : ( tf_msg = tmp ) ;
+ if( ret_val ) {
+ break ;
+ }
+ /* This assumes that he will have rejected the current VCB
+ and we will need a new one on the next pass
+ */
+ need_new_vcb = TRUE ;
+
+ /* This logic moves us down a multi-drive channel */
+ if( ( !write_mode || search_eod ) && tf_msg == TF_NEED_NEW_TAPE ) {
+ /* do a preliminary match for later test */
+ matched_id = MatchTapeId( &curDRV->cur_vcb, position->tape_id ) ;
+ if( NextDriveInChannel( channel, FALSE ) != TF_END_CHANNEL ) {
+ curDRV = channel->cur_drv ;
+ tf_msg = 0 ;
+ /* On a dual drive system, the UI has no idea that EOM has occurred, hence
+ we must increment the sequence number to prevent the wrong tape
+ message */
+ if( ( matched_id == MATCH ) && ( position->tape_seq_num != -1 ) ) {
+ position->tape_seq_num++ ;
+ }
+ continue ;
+ } else {
+ ResetChannelList( channel, TRUE ) ;
+ }
+ }
+ }
+
+ /* If the VCB is valid, then attempt to match it against the
+ criteria passed in the TPOS structure from the loops */
+ if( curDRV->vcb_valid ) {
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_CURRENT_VCB,
+ FS_ViewTapeIDInVCB( &curDRV->cur_vcb ),
+ FS_ViewTSNumInVCB( &curDRV->cur_vcb ),
+ FS_ViewBSNumInVCB( &curDRV->cur_vcb ) ) ;
+
+ /* If We are search for a place to write, update the current
+ position in the channel structure */
+
+ if( write_mode && !cont_mode ) {
+ /*lint -e713 */
+ channel->tape_id = FS_ViewTapeIDInVCB( &curDRV->cur_vcb ) ;
+ channel->ts_num = FS_ViewTSNumInVCB( &curDRV->cur_vcb ) ;
+ channel->bs_num = FS_ViewBSNumInVCB( &curDRV->cur_vcb ) ;
+ /*lint +e713 */
+ }
+
+ /* If this is a read, and we are at end of data, say VCB_EOD */
+ if( ( !write_mode && ( tf_msg == TF_NO_MORE_DATA || IsPosBitSet( channel->cur_drv, AT_EOD ) ) ) && !abs_pos ) {
+ tf_msg = TF_VCB_EOD ;
+ }
+
+ if( !tf_msg ) {
+
+ /* Ok, what is what */
+ matched_id = MatchTapeId( &curDRV->cur_vcb, position->tape_id ) ;
+ if( matched_id == MATCH ){
+ if( lw_fmtdescr[channel->cur_fmt].attributes & TAPES_FIRST_TO_LAST ){
+ position->tape_seq_num = FS_ViewTSNumInVCB( &curDRV->cur_vcb ) ;
+ }
+ if( !(lw_fmtdescr[channel->cur_fmt].attributes & POS_INF_AVAIL) ){
+ fast_file = FALSE ;
+ position->tape_loc.pba_vcb = 0 ;
+ }
+ }
+ matched_seq = MatchTapeSeq( &curDRV->cur_vcb, position->tape_seq_num ) ;
+ matched_set = MatchBckSet( &curDRV->cur_vcb, position->backup_set_num ) ;
+
+ /* Has the idiot specified an actual tape position or are we
+ winging it ? */
+ if( matched_id == MATCH || matched_id == DONT_CARE ) {
+ if( matched_seq == MATCH || matched_seq == DONT_CARE ) {
+ if( matched_set == MATCH ) {
+ /* If the match conditions succeed and the following conditions fail:
+ 1) We are at End of Set and we don't need a new VCB ( this suggests
+ that we had a VCB prior to entering this function, hence we are
+ no really sitting at the beginning ot this set.
+ 2) We are at End of Data, hence we are not really sitting at
+ the VCB we are.
+ 3) We are sitting somewhere in the middle of the Set.
+ Tell the user we found his VCB
+ */
+ if( ( IsPosBitSet( curDRV, AT_EOS ) && !need_new_vcb )
+ || IsPosBitSet( curDRV, AT_EOD )
+ || IsPosBitSet( curDRV, AT_MOS ) ) {
+ matched_set = NO_MATCH ;
+ } else {
+ tf_msg = TF_REQUESTED_VCB_FOUND ;
+ }
+ }
+ }
+ }
+
+ /* No complete match yet, so let's either do some positioning or talk
+ to the UI */
+
+ /* We need a new tape if:
+ 1) The tape id didn't match, or
+ 2) The Tape sequence didn't match, or
+ 3) we are at BOT, and
+ 4) current VCBs Backup Set number is greater then
+ the requested Backup set number.
+ */
+ if( matched_id == NO_MATCH || matched_seq == NO_MATCH ) {
+ /* Is this a more then one drive system ? */
+ if( curDRV->thw_inf.channel_link.q_next != NULL || curDRV->thw_inf.channel_link.q_prev ) {
+ if( NextDriveInChannel( channel, TRUE ) != TF_END_CHANNEL ) {
+ curDRV = channel->cur_drv ;
+ if( curDRV->vcb_valid ) {
+ need_new_vcb = FALSE ;
+ }
+ /* No Message this pass */
+ tf_msg = 0 ;
+ /* If the drive is in the middle of set, rewind before proceeding */
+ if( IsPosBitSet( curDRV, AT_MOS ) ) {
+ RewindDrive( channel->cur_drv, position, TRUE, TRUE, channel->mode ) ;
+ }
+ /* Ugly jump to top of loop */
+ continue ;
+ } else {
+ ResetChannelList( channel, FALSE ) ;
+ tf_msg = TF_WRONG_TAPE ;
+ }
+ } else {
+ tf_msg = TF_WRONG_TAPE ;
+ }
+ } else if( ( IsPosBitSet( curDRV, AT_BOT ) &&
+ ( (UINT16)FS_ViewBSNumInVCB( &curDRV->cur_vcb ) > (UINT16)position->backup_set_num ) ) ) {
+ tf_msg = TF_WRONG_TAPE ;
+ if( lw_fmtdescr[channel->cur_fmt].attributes & TAPES_FIRST_TO_LAST ){
+ position->tape_seq_num = 1 ;
+ }
+ }
+
+ /* We currently have the right tape in the drive, */
+ /* now let's attempt to position to correct set. */
+ if( !tf_msg && ( matched_id == MATCH || matched_id == DONT_CARE )
+ && ( matched_seq == MATCH || matched_seq == DONT_CARE )
+ && ( matched_set == NO_MATCH ) ) {
+ if( !fast_file ) {
+ tmp = GotoBckUpSet( channel, &position->backup_set_num, position ) ;
+ IsTFLE( tmp ) ? ( ret_val = tmp ) : ( tf_msg = tmp ) ;
+ /* This logic moves us down a multi-drive channel */
+ if( tf_msg == TF_NEED_NEW_TAPE ) {
+ /* Do a preliminary match for later test */
+ matched_id = MatchTapeId( &curDRV->cur_vcb, position->tape_id ) ;
+ if( NextDriveInChannel( channel, FALSE ) != TF_END_CHANNEL ) {
+ curDRV = channel->cur_drv ;
+ /* No Message this pass */
+ tf_msg = 0 ;
+ /* On a dual drive system, the UI has no idea that EOM has occurred, hence
+ we must increment the sequence number to prevent the wrong tape
+ message */
+ if( ( matched_id == MATCH ) && ( position->tape_seq_num != -1 ) ) {
+ position->tape_seq_num++ ;
+ }
+ /* Ugly jump to top of loop */
+ continue ;
+ } else {
+ ResetChannelList( channel, TRUE ) ;
+ }
+ }
+ /* Is This now the correct Set ? */
+ if ( (lw_fmtdescr[channel->cur_fmt].attributes & TAPES_FIRST_TO_LAST) && tf_msg ) {
+ /* make sure we skip the next assignment! */
+ } else if ( MatchBckSet( &curDRV->cur_vcb, position->backup_set_num ) == MATCH ) {
+ tf_msg = TF_REQUESTED_VCB_FOUND ;
+ }
+ } else { /* using fast file */
+ channel->tape_id = position->tape_id ;
+ channel->ts_num = position->tape_seq_num ;
+ channel->bs_num = position->backup_set_num ;
+ if( ( tmp = StartRead( channel ) ) != TFLE_NO_ERR ) {
+ IsTFLE( tmp ) ? ( ret_val = tmp ) : ( tf_msg = tmp ) ;
+ } else {
+ done = TRUE ;
+ }
+ }
+ }
+ }
+ }
+ }
+ /* We are not done yet */
+ if( !done && !ret_val ) {
+
+ /* If we don't have a message for the UI interface yet, use
+ one of these ( this will occur when no absolute position
+ has been requested */
+ if( !tf_msg ) {
+ if( IsPosBitSet( curDRV, AT_EOD ) ) {
+ tf_msg = TF_VCB_EOD ;
+ } else if( IsPosBitSet( curDRV, AT_BOT ) && !search_eod ) {
+
+ /* If the ID for this tape and the last tape match,
+ the stupid user has requested to overwrite one
+ of the tapes in the family they're trying to
+ continue.
+ */
+ if( write_mode && cont_mode &&
+ FS_ViewTapeIDInVCB( &curDRV->cur_vcb ) == FS_ViewTapeIDInVCB( channel->lst_osvcb ) ) {
+
+ tf_msg = TF_CONT_TAPE_IN_FAMILY ;
+ } else {
+ tf_msg = TF_VCB_BOT ;
+ }
+ } else if( search_eod ) {
+ tf_msg = TF_ACCIDENTAL_VCB ;
+ } else {
+ tf_msg = TF_POSITIONED_AT_A_VCB ;
+ }
+ }
+
+ /* If we have a no more data message from ReadNextSet(), and we
+ are at BOT, the tape is empty
+ */
+ if( tf_msg == TF_NO_MORE_DATA && IsPosBitSet( curDRV, AT_BOT ) ) {
+ tf_msg = TF_EMPTY_TAPE ;
+ if( !cont_mode ) {
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ }
+ }
+
+ if( tf_msg == TF_EMPTY_TAPE ||
+ tf_msg == TF_FUTURE_REV_MTF ||
+ tf_msg == TF_MTF_ECC_TAPE ||
+ tf_msg == TF_SQL_TAPE ||
+ tf_msg == TF_TAPE_OUT_OF_ORDER ||
+ tf_msg == TF_INVALID_VCB ) {
+ if( write_mode && !cont_mode && position->tape_id != -1 ) {
+ tf_msg = TF_WRONG_TAPE ;
+ } else {
+ if( ( ret_val = RewindDrive( channel->cur_drv, position, FALSE, TRUE, channel->mode ) ) != TFLE_NO_ERR ) {
+ break ;
+ }
+ }
+ }
+
+ /* Reset the tape id overwriting */
+ if( tf_msg == TF_EMPTY_TAPE && write_mode && !cont_mode ) {
+ channel->tape_id = 0L ;
+ }
+
+ mode = channel->mode ;
+
+ /* This is a TOTAL KLUDGE, implemented only because THE UI
+ has know idea what it did, is currently doing, or is going to do in
+ the future ... */
+ if( !write_mode && !cont_mode && tf_msg == TF_NEED_NEW_TAPE ) {
+ /* mode |= 0x8000 ; *//* Heaven only knows if or when we'll need this again! */
+ if( position->tape_seq_num != -1 ) {
+ position->tape_seq_num++ ;
+ }
+ }
+
+ if( write_mode && !cont_mode && tf_msg == TF_NEED_NEW_TAPE ){
+
+ if( position->tape_id == -1 ){
+ position->tape_id = FS_ViewTapeIDInVCB( &curDRV->cur_vcb ) ;
+ position->tape_seq_num = FS_ViewTSNumInVCB( &curDRV->cur_vcb ) ;
+ }
+ ++position->tape_seq_num ;
+ }
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_POSITION_AT_SET, tf_msg ) ;
+
+ /* We now dismount (and possibly eject) the tape in all cases,
+ just in case the UI decides to allow the user to change
+ tapes. Note that we dismount without rewinding or ejecting
+ except in cases where we expect the user to change tapes.
+ */
+ pop_it = FALSE ;
+ rewind_it = FALSE ;
+ switch( tf_msg ) {
+
+ case TF_NEED_NEW_TAPE :
+ case TF_WRONG_TAPE :
+ case TF_CONT_TAPE_IN_FAMILY :
+ rewind_it = pop_it = TRUE ;
+ break ;
+
+ case TF_INVALID_VCB :
+ rewind_it = TRUE ;
+ if( read_mode ) {
+ pop_it = TRUE ;
+ }
+ break ;
+
+ case TF_EMPTY_TAPE :
+ rewind_it = TRUE ;
+ if( read_mode && position->tape_id != -1 ) {
+ pop_it = TRUE ;
+ }
+ break ;
+
+ case TF_UNRECOGNIZED_MEDIA :
+ break ;
+
+ default:
+ if( write_mode &&
+ ( channel->cur_drv->thw_inf.drv_status & TPS_WRITE_PROTECT ) ) {
+ rewind_it = pop_it = TRUE ;
+ }
+ break ;
+ }
+
+ if( rewind_it ) {
+ ret_val = RewindDrive( curDRV, position, TRUE, TRUE, 0 ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR && pop_it &&
+ ( curDRV->thw_inf.drv_info.drv_features & TDI_UNLOAD ) ) {
+
+ if( TpEject( curDRV->drv_hdl ) == FAILURE ) {
+ ret_val = TFLE_DRIVER_FAILURE ;
+ } else {
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ (*position->UI_TapePosRoutine)( TF_IDLE_NOBREAK, position, curDRV->vcb_valid, &curDRV->cur_vcb, 0 ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( thw->the, myret.the ) ;
+
+ if( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = DisMountTape( curDRV, NULL, FALSE ) ;
+ }
+
+ if( IsTFLE( ret_val ) ) {
+ break ;
+ }
+
+ /* Tell 'em the deal */
+ ui_msg = (*position->UI_TapePosRoutine)( tf_msg, position, curDRV->vcb_valid, &curDRV->cur_vcb, mode ) ;
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_UI_MSG, ui_msg ) ;
+
+ if( ( ret_val = MountTape( channel->cur_drv, position, &is_tape_present ) ) != TFLE_NO_ERR ) {
+ if( IsTFLE( ret_val ) ) {
+ break ;
+ }
+ ResetDrivePosition( channel->cur_drv ) ;
+
+ if( ui_msg != UI_ABORT_POSITIONING &&
+ ui_msg != UI_HAPPY_ABORT ) {
+
+ tf_msg = ret_val ;
+ ret_val = TFLE_NO_ERR ;
+ continue ;
+ }
+ ret_val = TFLE_NO_ERR ;
+ }
+
+ if( !is_tape_present ) {
+ if( ui_msg != UI_ABORT_POSITIONING &&
+ ui_msg != UI_HAPPY_ABORT ) {
+
+ tf_msg = TF_NO_TAPE_PRESENT ;
+ continue ;
+ }
+
+ } else if( channel->cur_drv->thw_inf.drv_status &
+ ( TPS_NEW_TAPE|TPS_RESET ) ) {
+ switch( ui_msg ) {
+ case UI_ACKNOWLEDGED:
+ case UI_END_POSITIONING:
+ case UI_OVERWRITE:
+ case UI_BOT:
+ case UI_EOD:
+ case UI_CONTINUE_POSITIONING:
+ case UI_NEW_POSITION_REQUESTED:
+ case UI_SEARCH_CHANNEL:
+ case UI_FAST_APPEND:
+ ui_msg = UI_NEW_TAPE_INSERTED ;
+ break ;
+
+ default:
+ break ;
+ }
+ }
+
+ /* Clear Our message for the next loop around */
+ prev_tf_msg = tf_msg ;
+ tf_msg = 0 ;
+
+ /* Process what he Told us */
+ switch( ui_msg ) {
+
+ case UI_END_POSITIONING:
+ if( !write_mode ) {
+ if( ( tmp = StartRead( channel ) ) != TFLE_NO_ERR ) {
+ IsTFLE( tmp ) ? ( ret_val = tmp ) : ( tf_msg = tmp ) ;
+ if( ret_val != TFLE_NO_ERR ) {
+ done = TRUE ;
+ } else {
+ channel->mode |= 0x8000 ;
+ cont_mode = TRUE ;
+ }
+
+ } else {
+ done = TRUE ;
+ }
+ } else {
+ if( IsPosBitSet( curDRV, AT_EOD ) ) {
+ if( channel->cur_fmt == UNKNOWN_FORMAT ||
+ !( lw_fmtdescr[channel->cur_fmt].attributes & APPEND_SUPPORTED ) ) {
+ ret_val = TFLE_APPEND_NOT_ALLOWED ;
+ }
+ }
+ done = TRUE ;
+ }
+ break ;
+
+ case UI_NEW_TAPE_INSERTED:
+ TdemoNewTape( position->tape_id ) ;
+ channel->cur_drv->vcb_valid = FALSE ;
+ if( is_tape_present ) {
+ ClrPosBit( channel->cur_drv, TAPE_FULL ) ;
+ RewindDrive( channel->cur_drv, position, TRUE, TRUE, channel->mode ) ;
+ /* Re-status the drive */
+ UpdateDriveStatus( channel->cur_drv ) ;
+ }
+ break ;
+
+ case UI_BOT:
+ /* Although Update Drive Status should do this if necessary,
+ the ARCHIVE DRIVES have a problem with exceptions */
+ ClrPosBit( channel->cur_drv, TAPE_FULL ) ;
+ channel->cur_drv->vcb_valid = FALSE ;
+ RewindDrive( channel->cur_drv, position, TRUE, TRUE, channel->mode ) ;
+ /* Re-status the drive */
+ UpdateDriveStatus( channel->cur_drv ) ;
+ break ;
+
+ case UI_OVERWRITE:
+ RewindDrive( channel->cur_drv, position, TRUE, TRUE, channel->mode ) ;
+ /* BLATZ - add the code for TF_POSITIONED_FOR_WRITE */
+
+ /* if we're writing */
+ if( write_mode ) {
+
+ /* In case there was EXABYTE SX - 2200+ positioning info in an SX file
+ then delete the SX file corresponding to the physical tape in the drive
+ which is about to be overwritten */
+ SX_DeleteFile( FS_ViewTapeIDInVCB( &curDRV->cur_vcb ),
+ FS_ViewTSNumInVCB( &curDRV->cur_vcb ) ) ;
+
+ /* if this is not continuation positioning */
+ if( !cont_mode ) {
+
+ /* Start a New Tape Family */
+ channel->tape_id = 0L ;
+
+ /* Fix for the app not knowing the LBA for a
+ continuation VCB
+ */
+ channel->cross_set = 0 ;
+ channel->cross_lba = 0UL ;
+ }
+ }
+ done = TRUE ;
+ break ;
+
+
+ case UI_ABORT_POSITIONING:
+ ret_val = TFLE_USER_ABORT ;
+ /* fall through */
+
+ case UI_HAPPY_ABORT:
+ if( prev_tf_msg == TF_NEED_NEW_TAPE ) {
+ ClrChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ ResetDrivePosition( channel->cur_drv ) ;
+ }
+
+ if( !ret_val ) {
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ break ;
+
+ case UI_ACKNOWLEDGED:
+ case UI_CONTINUE_POSITIONING:
+ need_new_vcb = TRUE ;
+ /* BLATZ -- I believe this line should be changed to
+ space = IsPosBitSet( curDRV, AT_EOS ) ? FALSE : TRUE ;
+ This would fix the problem of skipping a set if we
+ are Positioned at the beginning of a set and we return
+ the last read VCB. I am not fixing it right now, as it
+ might break the UI. */
+ space = TRUE ;
+ break ;
+
+ case UI_SEARCH_CHANNEL:
+ case UI_NEW_POSITION_REQUESTED:
+ need_new_vcb = FALSE ;
+ break ;
+
+ case UI_BEGINNING_OF_CHANNEL:
+ ResetChannelList( channel, TRUE ) ;
+ break ;
+
+ case UI_NEXT_DRIVE:
+ tmp = NextDriveInChannel( channel, FALSE ) ;
+ IsTFLE( tmp ) ? ( ret_val = tmp ) : ( tf_msg = tmp ) ;
+ break ;
+
+ case UI_PREVIOUS_DRIVE:
+ tmp = PrevDriveInChannel( channel, FALSE ) ;
+ IsTFLE( tmp ) ? ( ret_val = tmp ) : ( tf_msg = tmp ) ;
+ break ;
+
+ case UI_FAST_APPEND:
+ if( channel->cur_fmt == UNKNOWN_FORMAT ||
+ !( lw_fmtdescr[channel->cur_fmt].attributes & APPEND_SUPPORTED ) ) {
+ ret_val = TFLE_APPEND_NOT_ALLOWED ;
+ done = TRUE ;
+ } else {
+ if( IsPosBitSet( channel->cur_drv, TAPE_FULL ) ) {
+ /* See if there is another drive in the channel */
+ if( NextDriveInChannel( channel, TRUE ) == TF_END_CHANNEL ) {
+ /* If not, start at the beginning and ask for new tape */
+ ResetChannelList( channel, FALSE ) ;
+ tf_msg = TF_NEED_NEW_TAPE ;
+ }
+ } else if( IsPosBitSet( channel->cur_drv, AT_EOD ) ) {
+ /* If we're already at EOD, the old way is faster */
+ need_new_vcb = TRUE ;
+ space = ( !IsPosBitSet( channel->cur_drv, AT_EOS )
+ ? TRUE : FALSE ) ;
+ search_eod = TRUE ;
+ } else {
+ ret_val = SeekEOD( channel ) ;
+ if( ret_val == TF_NEED_NEW_TAPE ) {
+ ret_val = TFLE_NO_ERR ;
+ /* See if there is another drive in the channel */
+ if( NextDriveInChannel( channel, TRUE ) == TF_END_CHANNEL ) {
+ /* If not, start at the beginning and ask for new tape */
+ ResetChannelList( channel, FALSE ) ;
+ tf_msg = TF_NEED_NEW_TAPE ;
+ }
+ } else if( ret_val == TFLE_INCOMPATIBLE_DRIVE ) {
+
+ ret_val = TFLE_NO_ERR ;
+ need_new_vcb = TRUE ;
+ space = ( !IsPosBitSet( channel->cur_drv, AT_EOS )
+ ? TRUE : FALSE ) ;
+ search_eod = TRUE ;
+ } else {
+ done = TRUE ;
+ }
+ }
+ }
+ break ;
+
+ case UI_EOD:
+ if( channel->cur_fmt == UNKNOWN_FORMAT ||
+ !( lw_fmtdescr[channel->cur_fmt].attributes & APPEND_SUPPORTED ) ) {
+ ret_val = TFLE_APPEND_NOT_ALLOWED ;
+ done = TRUE ;
+ } else {
+ /* They are asking to append, and this tape is full */
+ if( IsPosBitSet( channel->cur_drv, TAPE_FULL ) ) {
+ /* See if there is another drive in the channel */
+ if( NextDriveInChannel( channel, TRUE ) == TF_END_CHANNEL ) {
+ /* If not, start at the beginning and ask for new tape */
+ ResetChannelList( channel, FALSE ) ;
+ tf_msg = TF_NEED_NEW_TAPE ;
+ }
+ } else {
+ need_new_vcb = TRUE ;
+ space = ( !IsPosBitSet( channel->cur_drv, AT_EOS )
+ ? TRUE : FALSE ) ;
+ }
+ search_eod = TRUE ;
+ }
+ break ;
+
+
+ default:
+ msassert( FALSE ) ;
+ break ;
+ }
+ }
+ }
+
+ /* If we're in write mode, we may have messed with the position info
+ while seeking to end of data, so we reset it to "don't care" here
+ in case we come back to posatset to get a continuation tape.
+ */
+ if( write_mode ) {
+ position->tape_id = -1 ;
+ position->tape_seq_num = -1 ;
+ }
+
+ if( IsChannelStatus( channel, CH_CONTINUING ) ) {
+ ClrChannelStatus( channel, CH_CONTINUING ) ;
+ if( write_mode ) {
+ /* Restore the write format */
+ FreeFormatEnv( &( channel->cur_fmt ), &( channel->fmt_env ) ) ;
+ channel->cur_fmt = channel->save_fmt ;
+ channel->fmt_env = channel->save_env ;
+ }
+ }
+
+ /* Translate the append operation to the WRITE Operation */
+ channel->mode = ( ( channel->mode == TF_WRITE_APPEND ) ? TF_WRITE_OPERATION : channel->mode ) ;
+
+ /* Update Mode for later */
+ if( !ret_val ) {
+ channel->mode |= 0x8000 ;
+ }
+
+ /* If we are writing, check if the tape is write protected */
+ if( !ret_val && write_mode ) {
+ if( curDRV->thw_inf.drv_status & TPS_WRITE_PROTECT ) {
+ ret_val = TFLE_WRITE_PROTECT ;
+ }
+ }
+
+ /* We Need the current buffer for end of volume processing */
+ if ( write_mode || ( channel->mode != TF_READ_CONTINUE &&
+ channel->mode != TF_SCAN_CONTINUE &&
+ AtEOM( channel ) ) ) {
+ PuntBuffer( channel ) ;
+ }
+
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: MatchTapeId
+
+ Description: Tests to see if the current tape id matches the desired
+ tape id.
+
+ Modified: 8/10/1989 15:28:19
+
+ Returns: MATCH if it matchs, DONT_CARE if we don't care, and
+ NO_MATCH if we don't match.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static INT16 _near MatchTapeId(
+ DBLK_PTR dblk,
+ INT32 tape_id )
+{
+ INT16 ret_val = DONT_CARE ;
+
+
+ if( tape_id != -1 ) {
+ ret_val = ( FS_ViewTapeIDInVCB( dblk ) == (UINT32)tape_id ) ? MATCH : NO_MATCH ;
+ }
+
+ return( ret_val ) ;
+
+}
+
+/**/
+/**
+
+ Name: MatchTapeSeq
+
+ Description: Matchs the current DBLKs Tape Sequence number against
+ the specified sequeunce.
+
+ Modified: 8/10/1989 15:30:1
+
+ Returns: MATCH if it matchs, DONT_CARE if we don't care, and
+ NO_MATCH if we don't match.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static INT16 _near MatchTapeSeq(
+ DBLK_PTR dblk,
+ INT16 seq_num )
+{
+ INT16 ret_val = DONT_CARE ;
+
+
+ if( seq_num != -1 ) {
+ ret_val = ( FS_ViewTSNumInVCB( dblk ) == (UINT16)seq_num ) ? MATCH : NO_MATCH ;
+ }
+
+ return( ret_val ) ;
+
+
+}
+
+/**/
+/**
+
+ Name: MatchBckSet
+
+ Description: Matches the current DBLKs backup set number against the
+ specified number.
+
+ Modified: 8/10/1989 15:31:52
+
+ Returns: MATCH if it matchs, DONT_CARE if we don't care, and
+ NO_MATCH if we don't match.
+
+
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static INT16 _near MatchBckSet(
+ DBLK_PTR dblk,
+ INT16 bck_set )
+{
+ INT16 ret_val = DONT_CARE ;
+
+
+ if( bck_set != -1 ) {
+ ret_val = ( FS_ViewBSNumInVCB( dblk ) == ( INT16 ) bck_set ) ? MATCH : NO_MATCH ;
+ }
+
+ return( ret_val ) ;
+
+}
diff --git a/private/utils/ntbackup/src/pwxface.c b/private/utils/ntbackup/src/pwxface.c
new file mode 100644
index 000000000..0d9a100d9
--- /dev/null
+++ b/private/utils/ntbackup/src/pwxface.c
@@ -0,0 +1,720 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: pwxface.c
+
+ Description: Password database interface routines used during
+ drive selection and backup, restore, verify operations
+
+ $Log: G:/UI/LOGFILES/PWXFACE.C_V $
+
+ Rev 1.20 26 Jul 1993 19:25:48 MARINA
+enable c++
+
+ Rev 1.19 01 Nov 1992 16:05:58 DAVEV
+Unicode changes
+
+ Rev 1.18 07 Oct 1992 14:54:48 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.17 04 Oct 1992 19:40:08 DAVEV
+Unicode Awk pass
+
+ Rev 1.16 14 May 1992 17:24:06 MIKEP
+nt pass 2
+
+ Rev 1.15 18 Mar 1992 16:58:22 JOHNWT
+updated to work with new passdb.c
+
+ Rev 1.14 06 Feb 1992 17:42:36 JOHNWT
+made pwdb compat with 3.1
+
+ Rev 1.13 27 Jan 1992 12:47:54 GLENN
+Changed dialog support calls.
+
+ Rev 1.12 21 Jan 1992 13:51:40 JOHNWT
+correct error processing
+
+ Rev 1.11 21 Jan 1992 11:28:44 JOHNWT
+fixed UAE on full disk
+
+ Rev 1.10 20 Jan 1992 10:24:28 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.9 13 Jan 1992 10:27:22 JOHNWT
+added help
+
+ Rev 1.8 09 Jan 1992 14:49:24 JOHNWT
+added confirm new pw
+
+ Rev 1.7 06 Jan 1992 13:46:36 JOHNWT
+added remove pw protection
+
+ Rev 1.6 23 Dec 1991 15:47:20 JOHNWT
+PW for PWDB II
+
+ Rev 1.5 20 Dec 1991 09:35:26 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.4 16 Dec 1991 15:52:46 JOHNWT
+added parent window to EnterDBPassword
+
+ Rev 1.3 16 Dec 1991 15:28:40 JOHNWT
+added YY countdown timer
+
+ Rev 1.2 14 Dec 1991 13:44:08 JOHNWT
+changes for pw to enable db
+
+ Rev 1.1 04 Dec 1991 15:21:48 MIKEP
+remoce pwxface.h
+
+ Rev 1.0 20 Nov 1991 19:18:36 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/* module defines */
+
+#define PW_READ_ERR 0 /* error in read attempt */
+#define PW_NOT_FOUND 1 /* no pw for key found */
+#define PW_FOUND 2 /* pw for the key found */
+
+/* struct for data used by dialog procedure to get PWDB lock pw */
+
+typedef struct PWDB_DATA {
+
+ CHAR password[MAX_LOCKPW_SIZE]; /* pw to match (passed to dlg) */
+ CHAR new_password[MAX_LOCKPW_SIZE]; /* new password passed back */
+ INT allow_new; /* enable new passwd field */
+
+} PWDB_DATA, *PWDB_DATA_PTR;
+
+/* module functions */
+
+static DB_HAND_PTR OpenPwdbase ( CDS_PTR );
+static VOID ClosePwdbase ( DB_HAND_PTR );
+static INT16 GetDLEPassword ( CDS_PTR, GENERIC_DLE_PTR, CHAR_PTR );
+static INT16 GetPassword ( CDS_PTR, CHAR_PTR, CHAR_PTR );
+static VOID clock_routine ( VOID );
+
+/* module-wide variables */
+
+PWDB_DATA_PTR mw_verify_pw_ptr; /* pointer used by dialog proc */
+DB_HAND mw_pw_hand;
+
+
+/*****************************************************************************
+
+ Name: CheckThePWDBase
+
+ Description: Checks to see if the pwdb is enabled, if so, it checks
+ to see if the pwdb password has been entered. If not,
+ it prompts for the pwdb password. If all is ok, it opens
+ the pwdb and attempts to read the info for the DLE.
+
+ Returns: SUCCESS - pw info successfully read from pwdb
+ FAILURE - must prompt user for pw
+
+ Notes:
+
+*****************************************************************************/
+
+INT16 CheckThePWDBase(
+CDS_PTR conf_ptr, /* I - config pointer */
+GENERIC_DLE_PTR dle_ptr ) /* I - DLE for match */
+{
+ INT16 result = FAILURE;
+ CHAR pw_buffer[ MAX_PWDBASE_REC_SIZE + 1 ];
+
+ /* if the db password was verified, look for the DLE info */
+
+ if ( gfPWForPWDBState == DBPW_VERIFIED ) {
+ result = GetDLEPassword( conf_ptr, dle_ptr, pw_buffer );
+ }
+
+ return( result );
+}
+
+
+/*****************************************************************************
+
+ Name: IsThereADBPassword
+
+ Description: Checks to see if a password exists for the DB.
+
+ Modified: 12/23/91
+
+ Returns: TRUE
+ FALSE
+
+*****************************************************************************/
+
+BOOLEAN IsThereADBPassword( VOID )
+{
+ CHAR pw_buffer[ MAX_PWDBASE_REC_SIZE + 1 ];
+
+ /* look for the db password in the db */
+
+ if ( GetPassword( CDS_GetPerm(), DBPW_KEY, pw_buffer ) == PW_FOUND ) {
+
+ if ( strnicmp( DBPW_NODBPW, pw_buffer, MAX_LOCKPW_SIZE ) != 0 ) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+/*****************************************************************************
+
+ Name: EnterDBPassword
+
+ Description: Retrieves the password for the DB from the DB using the
+ unique key. If found it initializes the data buffer.
+ The password dialog is then displayed. If OK is returned,
+ a successful pw was entered. If a new one was specified,
+ it is saved in the DB.
+
+ Modified: 12/23/91
+
+ Returns: SUCCESS - pw successfully entered
+ FAILURE - pw not entered or incorrect
+
+*****************************************************************************/
+
+INT16 EnterDBPassword(
+CDS_PTR conf_ptr, /* I - config pointer */
+HWND hWnd, /* parent window */
+INT allow_new ) /* I - allow new pw to be entered */
+{
+ INT16 pw_result = PW_FOUND;
+ CHAR pw_buffer[ MAX_PWDBASE_REC_SIZE + 1 ];
+ PWDB_DATA verify_pw;
+
+ /* look for the db password in the db */
+
+ pw_result = GetPassword( conf_ptr, DBPW_KEY, pw_buffer );
+
+ if ( pw_result != PW_READ_ERR ) {
+
+ verify_pw.password[0] = 0;
+ verify_pw.new_password[0] = 0;
+ verify_pw.allow_new = allow_new;
+
+ /* if the pw for the db was found, and it is not the dummy pw, copy
+ to buffer for use in compare in dialog procedure */
+
+ if ( ( pw_result == PW_FOUND ) &&
+ ( strnicmp( DBPW_NODBPW, pw_buffer, MAX_LOCKPW_SIZE ) != 0 ) ) {
+ strcpy( verify_pw.password, pw_buffer );
+ }
+
+ /* set the module-wide ptr and call the dialog */
+
+ mw_verify_pw_ptr = &verify_pw;
+
+ if ( DM_ShowDialog( hWnd, IDD_PWDB_PASSWORD, NULL ) ==
+ DM_SHOWOK ) {
+
+ if ( gfPWForPWDBState == DBPW_VERIFIED ) {
+
+ /* if a new password was specified, save it in the db */
+
+ if ( verify_pw.new_password[0] != 0 ) {
+ SavePassword( conf_ptr, DBPW_KEY, verify_pw.new_password );
+ }
+
+ return SUCCESS;
+
+ }
+ }
+ }
+
+ return FAILURE;
+}
+
+
+/*****************************************************************************
+
+ Name: DM_PWDBPassword
+
+ Description: Dialog procedure for the DB password. If a password is
+ already in the buffer, we init the dialog normally.
+ Otherwise we assume it is the first time and only enable
+ the new password field. The password is verified and
+ the global verified flag set after OK is pressed.
+
+ Modified: 12/14/91
+
+ Returns: TRUE - message processed
+ FALSE - message ignored
+
+*****************************************************************************/
+
+DLGRESULT APIENTRY DM_PWDBPassword (
+
+ HWND hDlg,
+ MSGID msg,
+ MPARAM1 mp1,
+ MPARAM2 mp2 )
+
+{
+ CHAR pw_input[ MAX_LOCKPW_SIZE ]; /* temp buffer for user input */
+ static INT attempts;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG :
+
+ DM_CenterDialog( hDlg ) ;
+
+ /* set the text limits on the password fields */
+
+ SendDlgItemMessage( hDlg, IDD_PWDB_PW, EM_LIMITTEXT,
+ (MPARAM1) MAX_LOCKPW_LEN, (MPARAM2) NULL );
+ SendDlgItemMessage( hDlg, IDD_PWDB_NEWPW, EM_LIMITTEXT,
+ (MPARAM1) MAX_LOCKPW_LEN, (MPARAM2) NULL );
+ SendDlgItemMessage( hDlg, IDD_PWDB_CONFIRM, EM_LIMITTEXT,
+ (MPARAM1) MAX_LOCKPW_LEN, (MPARAM2) NULL );
+
+ /* if no password was passed in, disable the password window */
+
+ if ( mw_verify_pw_ptr->password[0] == 0 ) {
+
+ EnableWindow( GetDlgItem( hDlg, IDD_PWDB_PW ), FALSE );
+ EnableWindow( GetDlgItem( hDlg, IDD_PWDB_PWTEXT ), FALSE );
+
+ }
+
+ /* if the new option is disabled, disable the new password window */
+
+ if ( mw_verify_pw_ptr->allow_new == DBPW_NO_NEW ) {
+
+ EnableWindow( GetDlgItem( hDlg, IDD_PWDB_NEWPW ), FALSE );
+ EnableWindow( GetDlgItem( hDlg, IDD_PWDB_NEWPWTEXT ), FALSE );
+ EnableWindow( GetDlgItem( hDlg, IDD_PWDB_CONFIRM ), FALSE );
+ EnableWindow( GetDlgItem( hDlg, IDD_PWDB_CONFTEXT ), FALSE );
+
+ }
+
+ attempts = 0; /* user gets 3 attempts */
+
+ return TRUE ;
+
+ case WM_COMMAND :
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDOK:
+
+ /* first get the text in the new password field */
+
+ GetDlgItemText( hDlg, IDD_PWDB_NEWPW,
+ mw_verify_pw_ptr->new_password,
+ MAX_LOCKPW_SIZE );
+
+ /* if the user entered a new password, make sure it matches
+ the confirm field */
+
+ if ( mw_verify_pw_ptr->new_password[0] != 0 ) {
+
+ GetDlgItemText( hDlg, IDD_PWDB_CONFIRM, pw_input, MAX_LOCKPW_SIZE );
+ if ( strnicmp( mw_verify_pw_ptr->new_password, pw_input,
+ MAX_LOCKPW_SIZE ) != 0 ) {
+ WM_MessageBox( ID( IDS_BKUP_PASSWORD_ERROR_TITLE ),
+ ID( RES_PWDB_BAD_CONFIRM ),
+ WMMB_OK, WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+ SetFocus( GetDlgItem ( hDlg, IDD_PWDB_CONFIRM ) );
+ return TRUE;
+ }
+
+ }
+
+ /* if no password was required (first time), simply
+ check for the new password, don't exit without it */
+
+ if ( mw_verify_pw_ptr->password[0] == 0 ) {
+
+ if ( mw_verify_pw_ptr->new_password[0] == 0 ) {
+ SetFocus( GetDlgItem ( hDlg, IDD_PWDB_NEWPW ) );
+ return TRUE;
+ } else {
+ gfPWForPWDBState = DBPW_VERIFIED;
+ }
+
+ } else {
+
+ /* get the pw the user entered and compare it to the
+ one in the buffer */
+
+ attempts++;
+ GetDlgItemText( hDlg, IDD_PWDB_PW, pw_input, MAX_LOCKPW_SIZE );
+
+ if ( strnicmp( mw_verify_pw_ptr->password, pw_input,
+ MAX_LOCKPW_SIZE ) != 0 ) {
+
+ /* WRONG! If we have 3 invalids, lock them out. Else,
+ inform the user then erase the input fields,
+ reset the focus and set the global flag to false. */
+
+ if ( attempts == MAX_ATTEMPTS ) {
+
+ gfPWForPWDBState = DBPW_LOCKOUT;
+
+ WM_MessageBox( ID( IDS_BKUP_PASSWORD_ERROR_TITLE ),
+ ID( RES_PWDB_DISABLED ),
+ WMMB_OK, WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+
+ } else {
+
+ WM_MessageBox( ID( IDS_BKUP_PASSWORD_ERROR_TITLE ),
+ ID( RES_MISMATCHED_PASSWORD ),
+ WMMB_OK, WMMB_ICONEXCLAMATION, NULL, 0, 0 );
+
+ SetDlgItemText( hDlg, IDD_PWDB_PW, TEXT("") );
+ SetDlgItemText( hDlg, IDD_PWDB_NEWPW, TEXT("") );
+ SetDlgItemText( hDlg, IDD_PWDB_CONFIRM, TEXT("") );
+ SetFocus( GetDlgItem ( hDlg, IDD_PWDB_PW ) );
+ gfPWForPWDBState = DBPW_NOT_VERIFIED;
+
+ return TRUE;
+
+ }
+
+ } else {
+
+ /* everything was peachy */
+
+ gfPWForPWDBState = DBPW_VERIFIED;
+ }
+
+ }
+
+ EndDialog ( hDlg, DM_SHOWOK ) ;
+ return TRUE ;
+
+ case IDCANCEL:
+
+ EndDialog ( hDlg, DM_SHOWCANCEL ) ;
+ return TRUE ;
+
+ case IDHELP:
+
+ HM_DialogHelp( HELPID_DIALOGPWDBPASSWORD ) ;
+
+ return TRUE;
+ }
+
+ break ;
+
+ }
+ return FALSE ;
+}
+
+
+/*****************************************************************************
+
+ Name: SaveDLEPassword
+
+ Description: This function is used to add a new entry to the password
+ database. Both the username and the password are passed
+ into this module.
+
+ Returns: (void)
+
+ Notes: If any errors occurred during the database update operation,
+ they are reported here via eresprintf and processing should
+ continue normally
+
+*****************************************************************************/
+
+VOID SaveDLEPassword(
+CDS_PTR conf_ptr,
+GENERIC_DLE_PTR dle_ptr,
+CHAR_PTR pw_buffer,
+CHAR_PTR user_name )
+{
+
+ CHAR password[ MAX_PWDBASE_REC_SIZE + 1 ];
+
+ /* if a password is required for this DLE save it in the password database */
+
+ if( DLE_PswdRequired( dle_ptr ) && CDS_GetEnablePasswordDbase( conf_ptr ) ) {
+
+ strcpy( password, TEXT("") ) ;
+
+ switch ( DLE_GetDeviceType( dle_ptr ) ) {
+
+ case NOVELL_SERVER_ONLY:
+ strcpy( password, user_name ) ;
+ strcat( password, TEXT("/") ) ;
+ break ;
+
+ default:
+ break ;
+ }
+
+ strcat( password, pw_buffer );
+
+ if ( SavePassword( conf_ptr, DLE_GetDeviceName( dle_ptr ), password )
+ == SUCCESS ) {
+
+ switch ( DLE_GetDeviceType( dle_ptr ) ) {
+
+ case NOVELL_SERVER_ONLY:
+ DLE_UserSaved( dle_ptr ) = TRUE;
+ DLE_PswdSaved( dle_ptr ) = TRUE;
+ break ;
+
+ default:
+ break ;
+ }
+ }
+ }
+
+ return ;
+}
+
+
+/*****************************************************************************
+
+ Name: SavePassword
+
+ Description: This function is used to add a new entry to the password
+ database.
+
+ Returns: SUCCESS/FAILURE
+
+ Notes: If any errors occurred during the database update operation,
+ they are reported here via eresprintf and processing should
+ continue normally
+
+*****************************************************************************/
+
+INT16 SavePassword(
+CDS_PTR conf_ptr,
+CHAR_PTR key_ptr,
+CHAR_PTR password )
+{
+ INT16 pw_error;
+ INT16 result = FAILURE;
+ DB_HAND_PTR pw_hand;
+
+ pw_hand = OpenPwdbase( conf_ptr );
+
+ if ( pw_hand != NULL ) {
+
+ pw_error = (INT16)PD_Write( pw_hand, key_ptr, password );
+
+ switch( pw_error ) {
+
+ case PD_NO_ERROR :
+ result = SUCCESS;
+ break;
+
+ case PD_WRITE_ERROR :
+ CDS_SetEnablePasswordDbase( conf_ptr, FALSE ) ;
+ eresprintf( RES_ERROR_UPDATING_PDBASE );
+ break;
+
+ case PD_READ_ERROR :
+ CDS_SetEnablePasswordDbase( conf_ptr, FALSE ) ;
+ eresprintf( RES_ERROR_READING_PDBASE );
+ break;
+
+ case PD_FULL :
+ eresprintf( RES_PDBASE_FULL );
+ break;
+
+ default :
+ CDS_SetEnablePasswordDbase( conf_ptr, FALSE ) ;
+ eresprintf( RES_UNKNOWN_PDBASE_ERROR, pw_error );
+ break ;
+ }
+
+ ClosePwdbase( pw_hand );
+ }
+
+ return result;
+}
+
+
+/*****************************************************************************
+
+ Name: GetDLEPassword
+
+ Description: Interfaces to password database to read a password for
+ a specified device.
+
+ Returns: FAILURE meaning that a user password prompt is required
+ SUCCESS in reading a password, meaning that the user is not
+ required to be prompted
+
+*****************************************************************************/
+
+INT16 GetDLEPassword(
+CDS_PTR conf_ptr,
+GENERIC_DLE_PTR dle_ptr,
+CHAR_PTR pw_buffer )
+{
+ INT16 result = FAILURE;
+ CHAR_PTR p;
+
+ /* check for saved password */
+
+ if ( GetPassword( conf_ptr, DLE_GetDeviceName( dle_ptr ), pw_buffer ) ==
+ PW_FOUND ) {
+
+ result = SUCCESS;
+
+ switch ( DLE_GetDeviceType( dle_ptr ) ) {
+
+ case NOVELL_SERVER_ONLY:
+
+ p = strchr( pw_buffer, TEXT('/') ) ;
+ msassert ( p != NULL ) ;
+ *(p++) = TEXT('\0') ;
+ strcpy( DLE_GetServerUserName ( dle_ptr ), pw_buffer ) ;
+ strcpy( DLE_GetServerPswd ( dle_ptr ), p ) ;
+ DLE_UserSaved ( dle_ptr ) = TRUE ;
+ DLE_PswdSaved ( dle_ptr ) = TRUE ;
+
+ break ;
+
+ default:
+ break ;
+ }
+ }
+
+ return result;
+}
+
+
+/*****************************************************************************
+
+ Name: GetPassword
+
+ Description: Interfaces to password database to read a password for
+ a specified key.
+
+ Returns: PW_READ_ERR - could not read the db
+ PW_NOT_FOUND - key not found in db
+ PW_FOUND - found it
+
+*****************************************************************************/
+
+INT16 GetPassword(
+CDS_PTR conf_ptr,
+CHAR_PTR key_ptr,
+CHAR_PTR pw_buffer )
+{
+ INT16 pw_error;
+ INT16 result = PW_READ_ERR;
+ DB_HAND_PTR pw_hand;
+
+ pw_hand = OpenPwdbase( conf_ptr );
+
+ if ( pw_hand != NULL ) {
+
+ pw_error = (INT16)PD_Read( pw_hand, key_ptr, pw_buffer );
+
+ switch( pw_error ) {
+
+ case PD_NO_ERROR :
+ result = PW_FOUND;
+ break ;
+
+ case PD_MEMORY_ERROR :
+ CDS_SetEnablePasswordDbase( conf_ptr, FALSE ) ;
+ eresprintf( RES_OUT_OF_MEMORY ) ;
+ break ;
+
+ case PD_NOT_FOUND :
+ /* requested database key not found, return with indication
+ that user must be prompted for password */
+ result = PW_NOT_FOUND;
+ break ;
+
+ default :
+ CDS_SetEnablePasswordDbase( conf_ptr, FALSE ) ;
+ eresprintf( RES_ERROR_READING_PDBASE ) ;
+ break ;
+ }
+
+ ClosePwdbase( pw_hand );
+ }
+
+ return result;
+}
+
+
+/*****************************************************************************
+
+ Name: OpenPwdbase
+
+ Description: Opens the password database through a call to PD_Open
+
+ Returns: Handle of db or NULL for failure
+
+ Notes: Will set the module wide password database handle so that
+ subsequent database calls should be performed
+
+*****************************************************************************/
+
+DB_HAND_PTR OpenPwdbase(
+
+CDS_PTR conf_ptr )
+{
+ UINT16 pw_error ; /* password database error */
+ CHAR pwd_file[MAX_UI_PATH_SIZE] ;
+
+ /* concatenate the path and password file name. */
+
+ strcpy ( pwd_file, CDS_GetUserDataPath () );
+ strcat ( pwd_file, CDS_GetPwDbaseFname ( conf_ptr ) );
+
+ /* open password database */
+
+ pw_error = PD_Open( &mw_pw_hand, pwd_file ) ;
+
+ if( pw_error != PD_NO_ERROR ) {
+ eresprintf( RES_ERROR_OPENING_PWDBASE ) ;
+ CDS_SetEnablePasswordDbase( conf_ptr, FALSE ) ;
+ return (DB_HAND_PTR) NULL;
+ }
+
+ return &mw_pw_hand;
+}
+
+
+/*****************************************************************************
+
+ Name: ClosePwdbase
+
+ Description: Interfaces with the password database to close the file
+
+ Returns: (void)
+
+ Notes: Does not attempt the operation if the current pw_handle is NULL
+
+*****************************************************************************/
+
+VOID ClosePwdbase(
+
+DB_HAND_PTR pw_hand )
+{
+ if( pw_hand ) {
+ PD_Close( pw_hand ) ;
+ }
+
+ return ;
+}
diff --git a/private/utils/ntbackup/src/qtc_add.c b/private/utils/ntbackup/src/qtc_add.c
new file mode 100644
index 000000000..e883daf10
--- /dev/null
+++ b/private/utils/ntbackup/src/qtc_add.c
@@ -0,0 +1,1028 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: QTC_ADD.C
+
+ Description:
+
+ The functions used when constructing catalog information about
+ a new bset being backed up or a tape being cataloged.
+
+ $Log: N:\LOGFILES\QTC_ADD.C_V $
+
+ Rev 1.15 10 Mar 1994 22:09:56 MIKEP
+fix memory leak
+
+ Rev 1.14 11 Dec 1993 11:48:22 MikeP
+fix bug overwriting byte that wasn't mine
+
+ Rev 1.13 06 Dec 1993 09:46:16 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.12 05 Nov 1993 08:45:04 MIKEP
+fix error msg reporting
+
+ Rev 1.11 03 Nov 1993 09:06:58 MIKEP
+warning fixes
+
+ Rev 1.10 28 Oct 1993 14:50:20 MIKEP
+dll changes
+
+ Rev 1.9 29 Jul 1993 14:42:34 MIKEP
+fix support for >32bit set sizes
+
+ Rev 1.8 21 Apr 1993 17:23:58 TERRI
+Placed a NULL after path in QTC_AddDir.
+
+ Rev 1.7 14 Apr 1993 13:05:38 Stefan
+Fixed really minor warning (there was an newline within a single line comment)
+
+ Rev 1.6 25 Feb 1993 13:05:54 STEVEN
+changes from MIKEP @Msoft
+
+ Rev 1.5 30 Jan 1993 12:06:24 DON
+Removed compiler warnings
+
+ Rev 1.4 14 Dec 1992 12:28:42 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.3 20 Nov 1992 13:37:06 CHARLIE
+JAGUAR: Move to SRM based QTC code
+
+ENDEAVOR: Replaced rroduct conditionals with NOT_MTF4_0. Such conditions
+are no longer determined on a product basis.
+
+ Rev 1.2 06 Nov 1992 15:30:14 DON
+Change debug.h to be_debug.h and zprintf to BE_Zprintf
+
+ Rev 1.1 09 Oct 1992 11:53:46 MIKEP
+unicode pass
+
+ Rev 1.0 03 Sep 1992 16:56:10 STEVEN
+Initial revision.
+
+ Rev 1.17 12 Aug 1992 18:21:04 STEVEN
+alignment problems
+
+ Rev 1.16 09 Jul 1992 10:30:40 MIKEP
+chnages
+
+
+****************************************************/
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdwcs.h"
+#include "qtc.h"
+
+// unicode text macro
+#ifndef UNALIGNED
+#define UNALIGNED
+#endif
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+
+/********
+
+ We were doing a backup or catalog operation. When we hit a directory entry we
+ go back and record the number of files and bytes in the previous directory.
+ But this time we hit two directories in a row, so mark the last one empty.
+
+********/
+
+INT QTC_MarkLastDirEmpty( QTC_BUILD_PTR build )
+{
+ QTC_RECORD_PTR record_ptr;
+ UINT32 record_num;
+ INT size;
+ INT Error;
+
+
+
+ // Why don't we default every entry to empty. So this function is not needed at all ?
+
+
+
+ // If this dir is empty then no files have been added since we added
+ // it, so it was the last record added.
+
+ // See if record is still in buffer, 90% success rate.
+
+
+ // If offset is not 0, then the last entry is in the buffer.
+
+ if ( build->rec_offset ) {
+
+ record_ptr = (QTC_RECORD_PTR)(build->rec_buffer + build->rec_offset);
+ record_ptr--;
+
+ record_ptr->status |= QTC_EMPTY;
+
+ return( SUCCESS );
+ }
+
+ // Back up one record and turn the empty bit on.
+
+ record_num = build->record_cnt - 1;
+
+ QTC_SeekFile( build->fh_rec, record_num * sizeof(QTC_RECORD) );
+
+ size = QTC_ReadFile( build->fh_rec, (BYTE_PTR)&(build->record), sizeof(QTC_RECORD), &Error );
+
+ if ( size == sizeof(QTC_RECORD ) ) {
+
+ build->record.status |= QTC_EMPTY;
+
+ QTC_SeekFile( build->fh_rec, record_num * sizeof(QTC_RECORD) );
+
+ size = QTC_WriteFile( build->fh_rec, (BYTE_PTR)&(build->record), sizeof(QTC_RECORD), &Error );
+
+ if ( size != sizeof( QTC_RECORD ) ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return( FAILURE );
+ }
+ }
+ else {
+
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return( FAILURE );
+ }
+
+ return( SUCCESS );
+
+}
+
+INT QTC_SetCountsForLastDir( QTC_BUILD_PTR build )
+{
+ QTC_NAME UNALIGNED *name; // Fix for MIPS portability.
+ INT bytes_to_add;
+ INT bytes;
+ INT Error;
+ UINT32 temp32;
+ UINT32 UNALIGNED *i32;
+ BYTE buffer[ QTC_BUF_SIZE ];
+ BYTE data[ 15 ];
+
+
+ if ( build == NULL ) {
+ return( FAILURE );
+ }
+
+ if ( build->error ) {
+ return( FAILURE );
+ }
+
+ if ( ! build->do_full_cataloging ) {
+ return( SUCCESS );
+ }
+
+ if ( build->state != QTC_ACTIVE_STATE ) {
+ return( SUCCESS );
+ }
+
+ if ( build->record_cnt == 0 ) {
+ return( SUCCESS );
+ }
+
+ if ( build->files_in_dir == 0 ) {
+
+ QTC_MarkLastDirEmpty( build );
+ return( SUCCESS );
+ }
+
+ // We need to add the bytes and files info to the xtra bytes
+ // for the last dir entry.
+
+ if ( U64_Msw( build->bytes_in_dir ) ) {
+
+ // Use QTC_BYTE_COUNT_MSW, QTC_FILE_COUNT && QTC_BYTE_COUNT_LSW
+
+ bytes_to_add = 15;
+
+ data[ 0 ] = QTC_FILE_COUNT;
+ i32 = (UINT32 *)&data[ 1 ];
+ *i32 = build->files_in_dir;
+
+ data[ 5 ] = QTC_BYTE_COUNT_LSW;
+
+ i32 = (UINT32 *)&data[ 6 ];
+ *i32 = U64_Lsw( build->bytes_in_dir );
+
+ data[ 10 ] = QTC_BYTE_COUNT_MSW;
+
+ i32 = (UINT32 *)&data[ 11 ];
+ *i32 = U64_Msw( build->bytes_in_dir );
+ }
+ else {
+
+ if ( ( build->files_in_dir < 256 ) &&
+ ! ( U64_Lsw( build->bytes_in_dir ) & 0xFF000000L ) ) {
+
+ temp32 = U64_Lsw( build->bytes_in_dir );
+ temp32 += (UINT32)build->files_in_dir << 24;
+
+ // Use QTC_COMBO_COUNT
+ bytes_to_add = 5;
+
+ data[ 0 ] = QTC_COMBO_COUNT;
+ i32 = (UINT32 *)&data[ 1 ];
+ *i32 = temp32;
+
+ }
+ else {
+ // Use QTC_FILE_COUNT && QTC_BYTE_COUNT_LSW
+
+ bytes_to_add = 10;
+
+ data[ 0 ] = QTC_FILE_COUNT;
+ i32 = (UINT32 *)&data[ 1 ];
+ *i32 = build->files_in_dir;
+
+ data[ 5 ] = QTC_BYTE_COUNT_LSW;
+
+ i32 = (UINT32 *)&data[ 6 ];
+ *i32 = U64_Lsw( build->bytes_in_dir );
+ }
+ }
+
+ // We now know what to add, find the correct place to add it.
+ // If we are lucky, and we are very lucky, it will still be
+ // in the buffer, not on disk.
+
+ if ( build->curr_dir_off < build->last_mom_offset ) {
+
+ // starts in buffer
+
+ if ( bytes_to_add + build->dir_offset <= QTC_BUF_SIZE ) {
+
+ // finishes in buffer also
+
+ memcpy( &build->dir_buffer[ build->dir_offset ], &data, bytes_to_add );
+ build->dir_offset += bytes_to_add;
+
+ name = (QTC_NAME_PTR)&build->dir_buffer[ build->last_mom_offset - build->curr_dir_off ];
+
+ name->size += bytes_to_add;
+ name->xtra_size += bytes_to_add;
+
+ // We be done !
+
+ return( SUCCESS );
+ }
+ }
+
+
+ // Write out buffer and work on file.
+
+ bytes = QTC_WriteFile( build->fh_dir, build->dir_buffer, build->dir_offset, &Error );
+
+ if ( bytes != build->dir_offset ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return( FAILURE );
+ }
+
+ build->curr_dir_off += bytes; // increment file size
+ build->dir_offset = 0; // reset buff pointer to empty
+
+ // get data from file
+
+ QTC_SeekFile( build->fh_dir, build->last_mom_offset );
+
+ bytes = QTC_ReadFile( build->fh_dir, buffer, (INT)(build->curr_dir_off - build->last_mom_offset), &Error );
+
+ // work on it
+
+ name = (QTC_NAME_PTR)buffer;
+
+ name->size += bytes_to_add;
+ name->xtra_size += bytes_to_add;
+
+ memcpy( &buffer[ bytes ], data, bytes_to_add );
+
+ // write it back
+
+ QTC_SeekFile( build->fh_dir, build->last_mom_offset );
+
+ QTC_WriteFile( build->fh_dir, buffer, bytes + bytes_to_add, &Error );
+
+ // notice file pointer is left at end of file !
+
+ // update file size
+
+ build->curr_dir_off += bytes_to_add; // increment file size
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_AddDirectoryToCatalog(
+QTC_BUILD_PTR build,
+UINT64 DisplaySize,
+CHAR_PTR szPath,
+INT nPathLength,
+UINT16 Date,
+UINT16 Time,
+UINT32 Attribute,
+UINT32 LBA,
+BYTE_PTR xtra_bytes,
+UINT xtra_size )
+{
+ BYTE temp_xtra_bytes[ QTC_MAX_XTRA_BYTES ];
+ INT temp_xtra_size;
+ CHAR *buffer;
+ INT path_len; // path length in characters
+ UINT32 size_msw;
+
+ // Make sure we don't UAE in my code.
+
+ if ( build == NULL ) {
+ return;
+ }
+
+ if ( ! build->do_full_cataloging ||
+ build->error ||
+ ( build->header == NULL ) ) {
+ return;
+ }
+
+ // Copy the xtra bytes to a larger buffer, in case we have to add
+ // to them with a 64 bit file size.
+
+ if ( xtra_size ) {
+ memcpy( temp_xtra_bytes, xtra_bytes, xtra_size );
+ }
+ temp_xtra_size = xtra_size;
+
+ QTC_SetCountsForLastDir( build );
+
+ // Clear out counts
+
+ build->files_in_dir = 0;
+ build->bytes_in_dir = U64_Init( 0L, 0L );
+
+ build->header->num_bytes += U64_Lsw( DisplaySize );
+ size_msw = U64_Msw( DisplaySize );
+
+ if ( size_msw ) {
+
+ // add high part to xtrabytes
+
+ temp_xtra_bytes[ temp_xtra_size++ ] = QTC_XTRA_64BIT_SIZE;
+ memcpy( &temp_xtra_bytes[ temp_xtra_size ], &size_msw, 4 );
+ temp_xtra_size += 4;
+ }
+
+ buffer = malloc( nPathLength );
+ if ( buffer == NULL ) {
+ return;
+ }
+
+ memcpy( buffer, szPath, nPathLength );
+ path_len = nPathLength / sizeof(CHAR);
+
+ build->record.status = QTC_DIRECTORY;
+
+ build->record.date = Date;
+ build->record.time = Time;
+
+ build->record.attribute = Attribute;
+ build->record.lba = LBA;
+
+ // Fake a root if needed.
+
+ if ( ( path_len != 1 ) && ( build->record_cnt == 0 ) ) {
+ QTC_AddDir( build, TEXT(""), 1,
+ temp_xtra_bytes, temp_xtra_size );
+ }
+
+ QTC_AddDir( build, buffer, path_len,
+ temp_xtra_bytes, temp_xtra_size );
+
+ free( buffer );
+}
+
+
+
+VOID QTC_AddFileToCatalog(
+QTC_BUILD_PTR build,
+UINT64 DisplaySize,
+CHAR_PTR szFile,
+UINT16 Date,
+UINT16 Time,
+UINT32 Attribute,
+UINT32 LBA,
+UINT32 AFPObject,
+BYTE_PTR xtra_bytes,
+UINT xtra_size )
+{
+ BYTE temp_xtra_bytes[ QTC_MAX_XTRA_BYTES ];
+ INT temp_xtra_size;
+ UINT32 size_msw;
+ BOOLEAN u64_stat;
+ UINT64 temp64;
+
+ if ( build == NULL ) {
+ return;
+ }
+
+ if ( ! build->do_full_cataloging ||
+ build->error ||
+ ( build->header == NULL ) ) {
+ return;
+ }
+
+ // Copy the xtra bytes to a larger buffer, in case we have to add
+ // to them with a 64 bit file size.
+
+ if ( xtra_size ) {
+ memcpy( temp_xtra_bytes, xtra_bytes, xtra_size );
+ }
+ temp_xtra_size = xtra_size;
+
+ // switch based on what type dblk they passed us.
+
+ build->header->num_files++;
+
+ // Add file size to size of set.
+
+ temp64 = U64_Init( build->header->num_bytes, build->header->num_bytes_msw );
+ temp64 = U64_Add( temp64, DisplaySize, &u64_stat );
+
+ build->header->num_bytes = U64_Lsw( temp64 );
+ build->header->num_bytes_msw = U64_Msw( temp64 );
+
+ // Get high 32 bits of file size.
+
+ size_msw = U64_Msw( DisplaySize );
+
+ if ( size_msw ) {
+
+ // put high part of file size into xtrabytes
+
+ temp_xtra_bytes[ temp_xtra_size++ ] = QTC_XTRA_64BIT_SIZE;
+ memcpy( &temp_xtra_bytes[ temp_xtra_size ], &size_msw, 4 );
+ temp_xtra_size += 4;
+ }
+
+ // We keep file and byte counts on a per dir basis
+
+ build->files_in_dir++;
+
+ build->bytes_in_dir = U64_Add( build->bytes_in_dir, DisplaySize, &u64_stat );
+
+ build->record.status = QTC_FILE;
+
+ if ( AFPObject ) {
+ build->record.status |= QTC_AFP;
+ }
+ build->record.date = Date;
+ build->record.time = Time;
+
+ build->record.common.size = U64_Lsw( DisplaySize );
+
+ build->record.attribute = Attribute;
+ build->record.lba = LBA;
+
+ QTC_AddFile( build, szFile, temp_xtra_bytes, temp_xtra_size );
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+VOID QTC_AddRecord( QTC_BUILD_PTR build )
+{
+ BYTE_PTR s;
+ INT bytes;
+ INT Error;
+
+ if ( build->rec_offset + sizeof(QTC_RECORD) <= QTC_BUF_SIZE ) {
+ memcpy( &build->rec_buffer[ build->rec_offset ],
+ &build->record,
+ sizeof(QTC_RECORD) );
+ build->rec_offset += sizeof(QTC_RECORD);
+ }
+ else {
+ s = (BYTE_PTR)&build->record;
+
+ memcpy( &build->rec_buffer[ build->rec_offset ],
+ s,
+ QTC_BUF_SIZE - build->rec_offset );
+
+ QTC_SeekFile( build->fh_rec, build->curr_rec_off );
+
+ bytes = QTC_WriteFile( build->fh_rec, build->rec_buffer, QTC_BUF_SIZE, &Error );
+
+ if ( bytes != QTC_BUF_SIZE ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ s += (QTC_BUF_SIZE - build->rec_offset);
+
+ memcpy( &build->rec_buffer[ 0 ],
+ s,
+ sizeof(QTC_RECORD) - (QTC_BUF_SIZE - build->rec_offset) );
+
+ build->curr_rec_off += QTC_BUF_SIZE;
+ build->rec_offset = sizeof(QTC_RECORD) -
+ (QTC_BUF_SIZE - build->rec_offset);
+ }
+
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+VOID QTC_AddFile(
+QTC_BUILD_PTR build,
+CHAR_PTR filename,
+BYTE_PTR xtra_bytes,
+INT xtra_size )
+{
+ QTC_NAME temp;
+ BYTE_PTR s;
+ INT bytes;
+ INT level;
+ INT name_length;
+ INT Error;
+
+ level = build->current_level + 1;
+
+ name_length = strlen( filename ) * sizeof( CHAR );
+
+ temp.size = (INT16)(sizeof( QTC_NAME ) + name_length + xtra_size);
+ temp.record = build->record_cnt;
+ temp.mom_offset = build->mom_offset[ level - 1 ];
+ temp.xtra_size = xtra_size;
+
+ build->record_cnt++;
+ build->record.name_offset = build->curr_fil_off + build->fil_offset;
+
+ // RECORD
+
+ QTC_AddRecord( build );
+
+ // FIXED PART
+
+ if ( sizeof(QTC_NAME) + build->fil_offset <= QTC_BUF_SIZE ) {
+
+ memcpy( &build->fil_buffer[ build->fil_offset ],
+ &temp, sizeof(QTC_NAME) );
+ build->fil_offset += sizeof(QTC_NAME);
+ }
+ else {
+
+ s = (BYTE_PTR)&temp;
+
+ memcpy( &build->fil_buffer[ build->fil_offset ],
+ s,
+ QTC_BUF_SIZE - build->fil_offset );
+
+ bytes = QTC_WriteFile( build->fh_fil, build->fil_buffer, QTC_BUF_SIZE, &Error );
+
+ if ( bytes != QTC_BUF_SIZE ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ s += (QTC_BUF_SIZE - build->fil_offset);
+
+ memcpy( &build->fil_buffer[ 0 ],
+ s,
+ sizeof(QTC_NAME) - (QTC_BUF_SIZE - build->fil_offset) );
+
+ build->curr_fil_off += QTC_BUF_SIZE;
+ build->fil_offset = sizeof(QTC_NAME) - (QTC_BUF_SIZE - build->fil_offset);
+ }
+
+ // NAME PART
+
+ if ( name_length + build->fil_offset <= QTC_BUF_SIZE ) {
+
+ memcpy( &build->fil_buffer[ build->fil_offset ], filename, name_length );
+ build->fil_offset += name_length;
+ }
+ else {
+
+ s = (BYTE_PTR)filename;
+
+ memcpy( &build->fil_buffer[ build->fil_offset ],
+ s,
+ QTC_BUF_SIZE - build->fil_offset );
+
+ bytes = QTC_WriteFile( build->fh_fil, build->fil_buffer, QTC_BUF_SIZE, &Error );
+
+ if ( bytes != QTC_BUF_SIZE ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ s += (QTC_BUF_SIZE - build->fil_offset);
+ memcpy( &build->fil_buffer[ 0 ],
+ s,
+ name_length - (QTC_BUF_SIZE - build->fil_offset) );
+
+ build->curr_fil_off += QTC_BUF_SIZE;
+ build->fil_offset = name_length - (QTC_BUF_SIZE - build->fil_offset);
+ }
+
+ // XTRA BYTE PART
+
+ if ( xtra_size + build->fil_offset <= QTC_BUF_SIZE ) {
+
+ memcpy( &build->fil_buffer[ build->fil_offset ],
+ xtra_bytes, xtra_size );
+ build->fil_offset += xtra_size;
+ }
+ else {
+
+ memcpy( &build->fil_buffer[ build->fil_offset ],
+ xtra_bytes,
+ QTC_BUF_SIZE - build->fil_offset );
+
+ bytes = QTC_WriteFile( build->fh_fil, build->fil_buffer, QTC_BUF_SIZE, &Error );
+
+ if ( bytes != QTC_BUF_SIZE ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ xtra_bytes += (QTC_BUF_SIZE - build->fil_offset);
+ memcpy( &build->fil_buffer[ 0 ],
+ xtra_bytes,
+ xtra_size - (QTC_BUF_SIZE - build->fil_offset) );
+
+ build->curr_fil_off += QTC_BUF_SIZE;
+ build->fil_offset = xtra_size - (QTC_BUF_SIZE - build->fil_offset);
+ }
+
+ return;
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_AddDir(
+QTC_BUILD_PTR build,
+CHAR_PTR path,
+INT path_len, // In characters
+BYTE_PTR xtra_bytes,
+INT xtra_size )
+{
+ CHAR *buffer;
+ CHAR *last_path;
+ CHAR *name;
+ CHAR *temp;
+ INT i;
+ INT level;
+ INT process_level;
+
+
+ last_path = malloc( build->build_path_len * sizeof(CHAR) );
+ buffer = malloc( path_len * sizeof(CHAR) );
+
+ if ( last_path == NULL || buffer == NULL ) {
+ free( last_path );
+ free( buffer );
+ return;
+ }
+
+ memcpy( last_path, build->curr_build_path, build->build_path_len * sizeof(CHAR) );
+ memcpy( buffer, path, path_len * sizeof(CHAR));
+
+ if ( (INT)(path_len * sizeof(CHAR)) > build->curr_build_path_size ) {
+
+ // make our path buffer bigger.
+
+ temp = malloc( ( path_len + 256 ) * sizeof(CHAR) );
+
+ if ( temp == NULL ) {
+ free( last_path );
+ free( buffer );
+ return;
+ }
+
+ build->curr_build_path_size = (path_len + 256) * sizeof(CHAR);
+
+ free( build->curr_build_path );
+ build->curr_build_path = temp;
+ }
+
+ memcpy( build->curr_build_path, buffer, path_len * sizeof(CHAR) );
+
+ build->build_path_len = path_len;
+
+ // See what the deepest level of this new guy is.
+
+ level = 0;
+ process_level = 0;
+
+ if ( buffer[0] ) {
+
+ for ( i = 0; i < path_len; i++ ) {
+ if ( buffer[i] == TEXT( '\0' ) ) level++;
+ }
+
+ //
+ // Be careful here not to completely skip a directory because it was
+ // the same as the last directory. The deepest directory should be
+ // processed as a duplicate directory. But do determine where the
+ // new path starts differing from the last one.
+ //
+ // Example 1:
+ // LAST: \DOS\BIN\JUNK
+ // NEW: \DOS\GAMES
+ // Set process_level to 2 and start working with "GAMES", because
+ // the "DOS" part of the path has already been done.
+ //
+ // Example 2:
+ // LAST: \MIKE\JUNK
+ // NEW: \MIKE\JUNK
+ // Set process_level to 2 and start with "JUNK" because it is a
+ // duplicate directory that needs to be processed.
+ //
+ // Example 3:
+ // LAST: \MIKE\JUNK
+ // NEW: \
+ // Set process_level to 0, and add another root to the catalogs.
+ // Note this case is automaticly handled for you.
+
+ process_level = 1;
+ i = 0;
+
+ while ( ( i < path_len ) && ( process_level < level ) ) {
+
+ if ( stricmp( &buffer[i], &last_path[i] ) ) {
+ break;
+ }
+ process_level++;
+ while ( buffer[i] ) i++;
+ i++;
+ }
+ }
+
+ build->current_level = level;
+
+ // do this stuff for all the directories that are different
+ // from the last dblk.
+
+
+
+
+ while ( process_level <= level ) {
+
+ name = buffer;
+
+ for ( i = 1; i < process_level; i++ ) {
+ while ( *name++ ) ;
+ }
+
+ if ( process_level < level ) {
+ build->record.status |= QTC_MANUFACTURED;
+ }
+
+ build->record.name_offset = build->curr_dir_off + build->dir_offset;
+ build->record.common.common.file_start = build->curr_fil_off + build->fil_offset;
+ build->record.common.common.height = process_level;
+
+ QTC_SaveDirRecord( build, name, process_level++,
+ build->record_cnt++, xtra_bytes, xtra_size );
+
+ build->header->num_dirs++;
+ }
+
+ free( last_path );
+ free( buffer );
+
+ return;
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+VOID QTC_SaveDirRecord(
+QTC_BUILD_PTR build,
+CHAR_PTR name,
+INT level,
+UINT32 record,
+BYTE_PTR xtra_bytes,
+INT xtra_size )
+{
+ UINT32 *temp_mom_offset;
+ QTC_NAME temp;
+ BYTE_PTR s;
+ INT bytes;
+ INT name_size;
+ INT Error;
+
+ name_size = strlen( name ) * sizeof( CHAR );
+
+ temp.size = (INT16)(sizeof( QTC_NAME ) + name_size + xtra_size);
+ temp.xtra_size = xtra_size;
+ temp.record = record;
+
+ if ( level ) {
+ temp.mom_offset = build->mom_offset[ level - 1 ];
+ }
+ else {
+ temp.mom_offset = 0;
+ }
+
+ // RECORD
+
+ QTC_AddRecord( build );
+
+ // FIXED PART
+
+ if ( level >= build->mom_depth ) {
+
+ // increase path depth support another 10 levels
+
+ temp_mom_offset = malloc( ( level + 10 ) * sizeof( UINT32 ) );
+ if ( temp_mom_offset == NULL ) {
+ build->error = QTC_NO_MEMORY;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ memcpy( temp_mom_offset, build->mom_offset, level * sizeof( UINT32 ) );
+ free( build->mom_offset );
+ build->mom_offset = temp_mom_offset;
+ build->mom_depth = level + 10;
+ }
+
+ build->mom_offset[ level ] = build->curr_dir_off + build->dir_offset;
+
+ // We use this to update counts, after it is added.
+
+ build->last_mom_offset = build->mom_offset[ level ];
+
+ if ( sizeof(QTC_NAME) + build->dir_offset <= QTC_BUF_SIZE ) {
+
+ memcpy( &build->dir_buffer[ build->dir_offset ], &temp, sizeof(QTC_NAME) );
+ build->dir_offset += sizeof(QTC_NAME);
+ }
+ else {
+
+ s = (BYTE_PTR)&temp;
+
+ memcpy( &build->dir_buffer[ build->dir_offset ],
+ s,
+ QTC_BUF_SIZE - build->dir_offset );
+
+ bytes = QTC_WriteFile( build->fh_dir, build->dir_buffer, QTC_BUF_SIZE, &Error );
+
+ if ( bytes != QTC_BUF_SIZE ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ s += (QTC_BUF_SIZE - build->dir_offset);
+ memcpy( &build->dir_buffer[ 0 ],
+ s,
+ sizeof(QTC_NAME) - (QTC_BUF_SIZE - build->dir_offset) );
+
+ build->curr_dir_off += QTC_BUF_SIZE;
+ build->dir_offset = sizeof(QTC_NAME) - (QTC_BUF_SIZE - build->dir_offset);
+ }
+
+
+ // NAME PART
+
+ if ( name_size + build->dir_offset <= QTC_BUF_SIZE ) {
+
+ memcpy( &build->dir_buffer[ build->dir_offset ], name, name_size );
+ build->dir_offset += name_size;
+ }
+ else {
+
+ s = (BYTE_PTR)name;
+ memcpy( &build->dir_buffer[ build->dir_offset ],
+ s,
+ QTC_BUF_SIZE - build->dir_offset );
+
+ bytes = QTC_WriteFile( build->fh_dir, build->dir_buffer, QTC_BUF_SIZE, &Error );
+
+ if ( bytes != QTC_BUF_SIZE ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ s += (QTC_BUF_SIZE - build->dir_offset);
+ memcpy( &build->dir_buffer[ 0 ],
+ s,
+ name_size - (QTC_BUF_SIZE - build->dir_offset) );
+
+ build->curr_dir_off += QTC_BUF_SIZE;
+ build->dir_offset = name_size - (QTC_BUF_SIZE - build->dir_offset);
+ }
+
+ // XTRA BYTES PART
+
+ if ( xtra_size + build->dir_offset <= QTC_BUF_SIZE ) {
+
+ memcpy( &build->dir_buffer[ build->dir_offset ],
+ xtra_bytes,
+ xtra_size );
+ build->dir_offset += xtra_size;
+ }
+ else {
+
+ memcpy( &build->dir_buffer[ build->dir_offset ],
+ xtra_bytes,
+ QTC_BUF_SIZE - build->dir_offset );
+
+ bytes = QTC_WriteFile( build->fh_dir, build->dir_buffer, QTC_BUF_SIZE, &Error );
+
+ if ( bytes != QTC_BUF_SIZE ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return;
+ }
+
+ xtra_bytes += (QTC_BUF_SIZE - build->dir_offset);
+ memcpy( &build->dir_buffer[ 0 ],
+ xtra_bytes,
+ xtra_size - (QTC_BUF_SIZE - build->dir_offset) );
+
+ build->curr_dir_off += QTC_BUF_SIZE;
+ build->dir_offset = xtra_size - (QTC_BUF_SIZE - build->dir_offset);
+ }
+
+ return;
+}
diff --git a/private/utils/ntbackup/src/qtc_back.c b/private/utils/ntbackup/src/qtc_back.c
new file mode 100644
index 000000000..3df503855
--- /dev/null
+++ b/private/utils/ntbackup/src/qtc_back.c
@@ -0,0 +1,1884 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: QTC_Back.C
+
+ Description:
+
+ The functions used when constructing catalog information about
+ a new bset being backed up or a tape being cataloged.
+
+ $Log: N:\LOGFILES\QTC_BACK.C_V $
+
+ Rev 1.36 07 Jan 1994 14:23:28 mikep
+fixes for unicode
+
+ Rev 1.35 11 Dec 1993 11:49:16 MikeP
+fix warnings from unicode compile
+
+ Rev 1.34 06 Dec 1993 09:46:34 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.33 05 Nov 1993 08:47:16 MIKEP
+fix error msg reporting
+
+ Rev 1.32 03 Nov 1993 09:08:54 MIKEP
+warning fixes
+
+ Rev 1.31 02 Nov 1993 17:55:30 MIKEP
+remove unused parameter
+
+ Rev 1.30 28 Oct 1993 14:47:32 MIKEP
+dll changes
+
+ Rev 1.11 28 Oct 1993 14:47:04 MIKEP
+dll changes
+
+ Rev 1.29 27 Sep 1993 13:08:26 MIKEP
+set ecc flags
+
+ Rev 1.28 12 Aug 1993 18:21:56 DON
+If were out of disk space say so, not just open failure
+
+ Rev 1.27 06 Aug 1993 16:52:22 DON
+Set NO_REDIRECT and/or NON_VOLUME if File System says we should
+
+ Rev 1.26 20 Jun 1993 17:36:28 GREGG
+Removed include of mtf.h.
+
+ Rev 1.25 07 Jun 1993 17:02:48 CARLS
+add code to save the SSET attributes in the catalogs
+
+ Rev 1.24 19 May 1993 16:18:44 ChuckS
+OS_NLM: Get user name for catalog record from gb_QTC.cat_user, not the
+VCB.
+
+ Rev 1.23 13 May 1993 13:24:30 ChuckS
+Changes for revamped QTC usage of virtual memory. Removed (Q_ELEM *) cast
+of v_bset_item when assigned to q_elem.q_ptr -- it's now a VQ_HDL; changed
+argument to QTC_NewBset to vm handle for bset.
+
+ Rev 1.22 10 May 1993 08:28:08 MIKEP
+Add support for DAILY backup type. Fix qtc_abortcataloging to not blow
+up if called in idle state. Nostradamus needs this change.
+
+ Rev 1.21 23 Apr 1993 10:33:40 MIKEP
+Add support for gregg's new on tape catalog version info.
+
+ Rev 1.20 14 Apr 1993 13:01:08 Stefan
+Changed if !defined( P_CLIENT ) by adding "|| defined(OS_WIN) because
+the windows client needs this code.
+
+ Rev 1.19 23 Mar 1993 18:00:26 ChuckS
+Added arg to QTC_OpenFile indicating if need to open for writes
+
+ Rev 1.18 18 Mar 1993 15:17:52 ChuckS
+OS_NLM: Use device name in preference to volume name
+
+ Rev 1.17 27 Jan 1993 11:15:04 CHARLIE
+Use NO_MTF40 as criteria to include tfldefs.h or mtf.h
+
+ Rev 1.16 26 Jan 1993 17:10:44 MIKEP
+vcb changes
+
+ Rev 1.15 04 Jan 1993 16:13:54 DON
+changed if OS_??? to NO_MTF40
+
+ Rev 1.14 01 Jan 1993 15:19:20 MIKEP
+fix crossing tape bug
+
+ Rev 1.13 14 Dec 1992 12:28:52 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.12 08 Dec 1992 09:40:54 DON
+Graceful Red: changed VCB_CONT_BIT to MTF_DB_CONT_BIT
+
+ Rev 1.11 01 Dec 1992 13:24:22 MIKEP
+otc fix for setting status bits
+
+ Rev 1.10 23 Nov 1992 14:20:40 MIKEP
+fix continuation vcb for MTF only
+
+ Rev 1.9 20 Nov 1992 13:28:44 CHARLIE
+JAGUAR: Move to SRM based QTC code
+
+ENDEAVOR: Ifdef'd out all code in the module. Only reason we're linking it
+in is to get the global QTC structure. And this module brings in qtc_add.
+
+ENDEAVOR: Modified QTC_AbortCataloging to pass BOOLEAN keep_items
+
+ENDEAVOR: Keep TAPE, BSET info at Virtual Memory
+
+ENDEAVOR: We needed to clean up the QTC_TEMP files after an abort
+
+ Rev 1.8 15 Nov 1992 16:05:36 MIKEP
+fix warnings
+
+ Rev 1.7 06 Nov 1992 15:30:06 DON
+Change debug.h to be_debug.h and zprintf to BE_Zprintf
+
+ Rev 1.6 28 Oct 1992 11:32:30 MIKEP
+fix PBA of FDD stuff
+
+ Rev 1.5 23 Oct 1992 13:26:20 MIKEP
+change otc call
+
+ Rev 1.4 22 Oct 1992 16:51:42 MIKEP
+otc fixes
+
+ Rev 1.3 22 Oct 1992 09:27:34 MIKEP
+second pass otc changes
+
+ Rev 1.2 15 Oct 1992 10:31:38 MIKEP
+add fdd fields
+
+ Rev 1.1 09 Oct 1992 11:53:40 MIKEP
+unicode pass
+
+ Rev 1.0 03 Sep 1992 16:56:14 STEVEN
+Initial revision.
+
+****************************************************/
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdwcs.h"
+#include "qtc.h"
+
+// unicode text macro
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+
+/*
+ This is THE global catalog.
+*/
+
+QTC_CATALOG gb_QTC;
+
+
+#if !defined( P_CLIENT ) || defined( OS_WIN )
+
+static INT QTC_AssembleError( QTC_BUILD_PTR, INT );
+static INT QTC_AssembleFiles( QTC_BUILD_PTR );
+
+
+INT QTC_ErrorCleanup( QTC_BUILD_PTR build )
+{
+
+ if ( build ) {
+ if ( build->files_open ) {
+ QTC_CloseFile( build->fh_rec );
+ build->fh_rec = -1 ;
+ QTC_CloseFile( build->fh_dir );
+ build->fh_dir = -1 ;
+ QTC_CloseFile( build->fh_fil );
+ build->fh_fil = -1 ;
+ build->files_open = FALSE;
+ }
+ }
+
+ return( SUCCESS );
+}
+
+
+
+QTC_BUILD_PTR QTC_GetBuildHandle( )
+{
+ QTC_BUILD_PTR build;
+ INT i;
+
+ build = calloc( sizeof( QTC_BUILD ), 1 );
+
+ if ( build != NULL ) {
+
+ build->files_open = FALSE;
+
+ build->rec_file = malloc( (strlen( gb_QTC.data_path ) + 30) * sizeof(CHAR) );
+ build->dir_file = malloc( (strlen( gb_QTC.data_path ) + 30) * sizeof(CHAR) );
+ build->fil_file = malloc( (strlen( gb_QTC.data_path ) + 30) * sizeof(CHAR) );
+
+ build->mom_offset = malloc( QTC_START_DEPTH * sizeof( UINT32 ) );
+
+ build->last_mom_offset = 0L;
+
+ build->curr_build_path = malloc( 256 );
+ build->curr_build_path_size = 256;
+
+ if ( ( build->rec_file != NULL ) &&
+ ( build->dir_file != NULL ) &&
+ ( build->fil_file != NULL ) &&
+ ( build->curr_build_path != NULL ) &&
+ ( build->mom_offset != NULL ) ) {
+
+ build->continuation_tape = FALSE;
+ build->mom_depth = QTC_START_DEPTH;
+
+ for ( i = 0; i < QTC_START_DEPTH; i++ ) {
+ build->mom_offset[ i ] = 0L;
+ }
+ }
+ else {
+
+ free( build->curr_build_path );
+ free( build->rec_file );
+ free( build->dir_file );
+ free( build->fil_file );
+ free( build->mom_offset );
+ free( build );
+ build = NULL;
+ }
+ }
+
+ return( build );
+}
+
+
+INT QTC_FreeBuildHandle( QTC_BUILD_PTR build )
+{
+ if ( build != NULL ) {
+ if ( build->files_open ) {
+ QTC_CloseFile( build->fh_rec );
+ build->fh_rec = -1 ;
+ QTC_CloseFile( build->fh_dir );
+ build->fh_dir = -1 ;
+ QTC_CloseFile( build->fh_fil );
+ build->fh_fil = -1 ;
+ }
+ free( build->curr_build_path );
+ free( build->old_header );
+ free( build->header );
+ free( build->rec_file );
+ free( build->dir_file );
+ free( build->fil_file );
+ free( build->mom_offset );
+ free( build );
+ }
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ There are 3.1 tapes with image sets as the first set on tape that do not
+ identify themselves as image sets. This routine corrects the attributes
+ if we hit one of these.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_ImageScrewUp( QTC_BUILD_PTR build )
+{
+ if ( build != NULL ) {
+
+ if ( build->header != NULL ) {
+ build->header->status |= QTC_IMAGE;
+ build->header->status |= QTC_PARTIAL;
+ }
+ }
+
+ return( 0 );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ The 4.0 tape format (MTF) does NOT put the continuation vcb at PBA 0,
+ LBA 0, like all the others do. So it has to be corrected after the VCB
+ has been written to tape. This call will correct the current one being
+ built.
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_PatchVCB( QTC_BUILD_PTR build, UINT32 LBA, UINT32 PBA )
+{
+ if ( build != NULL ) {
+
+ if ( build->header != NULL ) {
+
+ build->header->LBA = LBA;
+ build->header->PBA_VCB = PBA;
+
+ }
+ }
+
+ return;
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_AbortBackup( QTC_BUILD_PTR build )
+{
+
+ if ( build == NULL ) {
+ return;
+ }
+
+ switch ( build->state ) {
+
+ case QTC_WAITING_STATE:
+ case QTC_ERROR_STATE:
+
+ /*
+ Reset everything important
+ */
+
+ if( build->rec_file != NULL ) {
+ QTC_CloseFile( build->fh_rec ) ;
+ build->fh_rec = -1 ;
+ unlink( build->rec_file ) ;
+ free( build->rec_file ) ;
+ build->rec_file = NULL ;
+ }
+ if( build->dir_file != NULL ) {
+ QTC_CloseFile( build->fh_dir ) ;
+ build->fh_dir = -1 ;
+ unlink( build->dir_file ) ;
+ free( build->dir_file ) ;
+ build->dir_file = NULL ;
+ }
+ if( build->fil_file != NULL ) {
+ QTC_CloseFile( build->fh_fil );
+ build->fh_fil = -1 ;
+ unlink( build->fil_file ) ;
+ free( build->fil_file ) ;
+ build->fil_file = NULL ;
+ }
+
+ free( build->header );
+ build->header = NULL;
+ break;
+
+ case QTC_ACTIVE_STATE:
+
+
+#ifndef OS_WIN32
+
+ /*
+ Reset this bset to partial, because we can't tell what
+ really went to tape and what didn't. MTF 4.0 does put all
+ the files to tape, so there is no reason to convert set to
+ partial cataloging.
+ */
+
+ build->header->status |= QTC_PARTIAL;
+ build->do_full_cataloging = FALSE;
+
+ build->record_cnt = 0;
+ build->dir_offset = 0;
+ build->curr_dir_off = 0;
+ build->fil_offset = 0;
+ build->curr_fil_off = 0;
+ build->rec_offset = 0;
+ build->curr_rec_off = 0;
+#endif
+ QTC_FinishBackup( build );
+ break;
+
+ case QTC_IDLE_STATE:
+ default:
+ break;
+ }
+
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+VOID QTC_AbortCataloging( QTC_BUILD_PTR build, BOOLEAN keep_items )
+{
+ if ( build == NULL ) {
+ return;
+ }
+
+ switch ( build->state ) {
+
+ case QTC_ACTIVE_STATE:
+
+ if ( keep_items ) {
+
+ build->header->status |= QTC_INCOMPLETE;
+
+ } else {
+
+ build->header->status |= QTC_PARTIAL;
+ build->do_full_cataloging = FALSE;
+
+ build->record_cnt = 0;
+ build->dir_offset = 0;
+ build->curr_dir_off = 0;
+ build->fil_offset = 0;
+ build->curr_fil_off = 0;
+ build->rec_offset = 0;
+ build->curr_rec_off = 0;
+ }
+
+ QTC_FinishBackup( build );
+
+ break;
+
+
+ case QTC_WAITING_STATE:
+ case QTC_ERROR_STATE:
+ /*
+ Reset everything important
+ */
+
+ if( build->rec_file != NULL ) {
+ QTC_CloseFile( build->fh_rec );
+ build->fh_rec = -1 ;
+ unlink( build->rec_file ) ;
+ free( build->rec_file ) ;
+ build->rec_file = NULL ;
+ }
+ if( build->dir_file != NULL ) {
+ QTC_CloseFile( build->fh_dir );
+ build->fh_dir = -1 ;
+ unlink( build->dir_file ) ;
+ free( build->dir_file ) ;
+ build->dir_file = NULL ;
+ }
+ if( build->fil_file != NULL ) {
+ QTC_CloseFile( build->fh_fil );
+ build->fh_fil = -1 ;
+ unlink( build->fil_file ) ;
+ free( build->fil_file ) ;
+ build->fil_file = NULL ;
+ }
+
+ build->header = NULL;
+ build->state = QTC_IDLE_STATE;
+ break;
+
+ case QTC_IDLE_STATE:
+ default:
+ break;
+ }
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ We buffer all data going to disk. In case we need to work on the data
+ being actively written or we have completed recieving data, then this
+ function will flush the buffer contents to disk.
+
+ RETURNS :
+
+**********************/
+INT QTC_FlushInternalBuffers( QTC_BUILD_PTR build )
+{
+ INT ret;
+ INT Error;
+
+ // Flush directory names buffer
+
+ if ( build == NULL ) {
+ return( FAILURE );
+ }
+
+ QTC_SeekFile( build->fh_dir, build->curr_dir_off );
+
+ ret = QTC_WriteFile( build->fh_dir, build->dir_buffer, build->dir_offset, &Error );
+
+ if ( ret == build->dir_offset ) {
+ build->curr_dir_off += ret;
+ }
+ else {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return(FAILURE);
+ }
+
+ // Flush file names buffer
+
+ QTC_SeekFile( build->fh_fil, build->curr_fil_off );
+
+ ret = QTC_WriteFile( build->fh_fil, build->fil_buffer, build->fil_offset, &Error );
+
+ if ( ret == build->fil_offset ) {
+ build->curr_fil_off += ret;
+ }
+ else {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return(FAILURE);
+ }
+
+ // Flush records buffer
+
+ QTC_SeekFile( build->fh_rec, build->curr_rec_off );
+
+ ret = QTC_WriteFile( build->fh_rec, build->rec_buffer, build->rec_offset, &Error );
+
+ if ( ret == build->rec_offset ) {
+ build->curr_rec_off += ret;
+ }
+ else {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return(FAILURE);
+ }
+
+ // Reset the internal buffer pointers for the next Bset
+
+ build->dir_offset = 0;
+ build->fil_offset = 0;
+ build->rec_offset = 0;
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_ChangeBsetFlags( QTC_HEADER_PTR header, INT flags )
+{
+ QTC_HEADER disk_header;
+ INT fd;
+ INT Error;
+
+ header->status |= flags;
+
+ fd = QTC_OpenFile( header->tape_fid, (INT16)header->tape_seq_num, TRUE, FALSE );
+
+ if ( fd < 0 ) {
+ return( FAILURE );
+ }
+
+ QTC_SeekFile( fd, header->offset );
+
+ if ( QTC_ReadFile( fd, (BYTE_PTR)&disk_header, sizeof( QTC_HEADER ), &Error ) != sizeof( QTC_HEADER ) ) {
+ QTC_CloseFile( fd );
+ return( FAILURE );
+ }
+
+ disk_header.status |= flags;
+
+ QTC_SeekFile( fd, header->offset );
+
+ if ( QTC_WriteFile( fd, (BYTE_PTR)&disk_header, sizeof( QTC_HEADER ), &Error ) != sizeof( QTC_HEADER ) ) {
+ QTC_CloseFile( fd );
+ return( FAILURE );
+ }
+
+ QTC_CloseFile( fd );
+ return( SUCCESS );
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+INT QTC_BuildNewPath( QTC_BUILD_PTR build, UINT32 mom_offset )
+{
+ INT i;
+ INT result;
+ INT Error;
+ INT BytesNeeded;
+ QTC_NAME_PTR name;
+ CHAR_PTR dirname;
+ CHAR_PTR temp;
+ BYTE_PTR buff1;
+ BYTE_PTR buff2;
+ CHAR_PTR terminator ;
+
+
+ buff1 = calloc( QTC_BUF_SIZE, 1 );
+ buff2 = calloc( QTC_BUF_SIZE, 1 );
+
+ name = (QTC_NAME_PTR)buff2;
+
+ dirname = (CHAR_PTR)( buff2 + sizeof(QTC_NAME) );
+
+ if ( mom_offset == 0 ) {
+ build->curr_build_path[ 0 ] = TEXT( '\0' );
+ build->build_path_len = 1; // in characters, not bytes
+ }
+ else {
+
+ build->build_path_len = 0;
+
+ while ( mom_offset ) {
+
+ QTC_SeekFile( build->fh_dir, mom_offset );
+
+ result = QTC_ReadFile( build->fh_dir, buff1, QTC_BUF_SIZE, &Error );
+
+ if ( QTC_GetNameFromBuff( buff1, name, result ) ) {
+
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ free( buff1 );
+ free( buff2 );
+ return( FAILURE );
+ }
+
+ // terminate dir_name string in buffer with a zero
+
+ terminator = (CHAR_PTR)(&buff2[ name->size - (INT)name->xtra_size ] );
+ *terminator = TEXT( '\0' );
+
+ mom_offset = name->mom_offset;
+
+ // BEFORE
+ // path[] dirname[]
+ // 01234567890 0123456789
+ // xx0xxx0 yyy0
+ //
+ // AFTER
+ // path[]
+ // yyy0xx0xxx0
+
+
+ if ( (INT)((build->build_path_len + strlen( dirname ) + 1 ) * sizeof(CHAR)) >= build->curr_build_path_size ) {
+
+ // We need to enlarge the curr_build_path buffer
+
+ BytesNeeded = build->build_path_len + strlen( dirname );
+ BytesNeeded += 256; // room to grow.
+ BytesNeeded *= sizeof(CHAR);
+
+ temp = malloc( BytesNeeded );
+
+ if ( temp == NULL ) {
+
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ free( buff1 );
+ free( buff2 );
+ return( FAILURE );
+ }
+
+ memcpy( temp, build->curr_build_path, build->build_path_len * sizeof(CHAR) );
+ free( build->curr_build_path );
+ build->curr_build_path = temp;
+
+ build->curr_build_path_size = BytesNeeded;
+ }
+
+ // shift everything to the right, far enough to insert new directory name.
+
+ for ( i = build->build_path_len; i > 0; i-- ) {
+ build->curr_build_path[ i + strlen( dirname ) ] = build->curr_build_path[ i - 1 ];
+ }
+
+ strcpy( build->curr_build_path, dirname );
+ build->build_path_len += strlen( dirname ) + 1;
+ }
+ }
+
+ free( buff1 );
+ free( buff2 );
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+ The last file or directory saved to tape failed its verification test
+ So mark it as corrupt
+
+ RETURNS :
+
+**********************/
+
+INT QTC_BlockBad( QTC_BUILD_PTR build )
+{
+ UINT32 record_num;
+ INT size;
+ INT Error;
+
+ if ( build == NULL ) {
+ return( FAILURE );
+ }
+
+ if ( build->error ) {
+ return( FAILURE );
+ }
+
+ if ( ! build->do_full_cataloging ) {
+ return( SUCCESS );
+ }
+
+ if ( build->state != QTC_ACTIVE_STATE ) {
+ return( SUCCESS );
+ }
+
+ QTC_FlushInternalBuffers( build );
+
+ build->header->num_corrupt_files++;
+
+ // Back up one record and turn the corrupt bit on.
+
+ record_num = build->record_cnt - 1;
+
+ QTC_SeekFile( build->fh_rec, record_num * sizeof(QTC_RECORD) );
+
+ size = QTC_ReadFile( build->fh_rec, (BYTE_PTR)&(build->record), sizeof(QTC_RECORD), &Error );
+
+ if ( size == sizeof(QTC_RECORD ) ) {
+
+ build->record.status |= QTC_CORRUPT;
+
+ QTC_SeekFile( build->fh_rec, record_num * sizeof(QTC_RECORD) );
+
+ size = QTC_WriteFile( build->fh_rec, (BYTE_PTR)&(build->record), sizeof(QTC_RECORD), &Error );
+
+ if ( size != sizeof( QTC_RECORD ) ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return( FAILURE );
+ }
+ }
+ else {
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return( FAILURE );
+ }
+
+ // Now mark this guys parent as corrupt so that we can tell in the
+ // tree if there's a file in this directory that is corrupt.
+
+ while ( record_num != 0 ) {
+
+ // Look for a directory record
+
+ record_num--;
+
+ QTC_SeekFile( build->fh_rec, record_num * sizeof(QTC_RECORD) );
+
+ size = QTC_ReadFile( build->fh_rec, (BYTE_PTR)&(build->record), sizeof(QTC_RECORD), &Error );
+
+ if ( size == sizeof(QTC_RECORD ) ) {
+
+ if ( build->record.status & QTC_DIRECTORY ) {
+
+ build->record.status |= QTC_CORRUPT;
+
+ QTC_SeekFile( build->fh_rec, record_num * sizeof(QTC_RECORD) );
+
+ size = QTC_WriteFile( build->fh_rec, (BYTE_PTR)&(build->record), sizeof(QTC_RECORD), &Error );
+
+ if ( size != sizeof( QTC_RECORD ) ) {
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return( FAILURE );
+ }
+
+ return( SUCCESS );
+ }
+ }
+ else {
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ QTC_ErrorCleanup( build );
+ return( FAILURE );
+ }
+ }
+
+ return( SUCCESS );
+}
+
+
+INT QTC_UpdateOTCInfo( QTC_HEADER_PTR header )
+{
+ QTC_BSET_PTR bset;
+ UINT32 FDD_SeqNum;
+ UINT32 FDD_PBA;
+ UINT32 FDD_Version;
+ INT fd;
+ INT ret;
+ INT Error;
+ INT num_files;
+ INT num_dirs ;
+ INT num_corrupt_files;
+
+ if ( ! ( header->status & QTC_OTCVALID ) ) {
+ return( SUCCESS );
+ }
+
+ bset = QTC_FindBset( header->tape_fid, (INT16)header->tape_seq_num, (INT16)header->bset_num );
+
+ // Copy all the headers into it.
+
+ if ( bset != NULL ) {
+
+ if ( (bset->status & ( QTC_SMEXISTS | QTC_FDDEXISTS | QTC_OTCVALID )) ==
+ (header->status & ( QTC_SMEXISTS | QTC_FDDEXISTS | QTC_OTCVALID )) ) {
+
+ // They are the same.
+
+ return( SUCCESS );
+ }
+
+ // Adjust the one in memory.
+
+ bset->status &= ~( QTC_SMEXISTS | QTC_FDDEXISTS | QTC_OTCVALID );
+ bset->status |= header->status & ( QTC_SMEXISTS | QTC_FDDEXISTS | QTC_OTCVALID );
+
+ FDD_PBA = header->FDD_PBA;
+ FDD_SeqNum = header->FDD_SeqNum;
+ FDD_Version = header->FDD_Version;
+ num_files = header->num_files ;
+ num_dirs = header->num_dirs;
+ num_corrupt_files = header->num_corrupt_files;
+
+ // Load the header for the one bset that is changing.
+
+ header = QTC_LoadHeader( bset );
+
+ if ( header == NULL ) {
+ return( FAILURE );
+ }
+
+ header->status &= ~( QTC_SMEXISTS | QTC_FDDEXISTS | QTC_OTCVALID );
+ header->status |= bset->status & ( QTC_SMEXISTS | QTC_FDDEXISTS | QTC_OTCVALID );
+
+ header->FDD_PBA = FDD_PBA;
+ header->FDD_SeqNum = FDD_SeqNum;
+ header->FDD_Version = FDD_Version;
+
+ header->num_files =num_files ;
+ header->num_dirs=num_dirs ;
+ header->num_corrupt_files=num_corrupt_files ;
+
+ fd = QTC_OpenFile( bset->tape_fid, (INT16)bset->tape_seq_num, TRUE, FALSE );
+
+ if ( fd < 0 ) {
+ return( FAILURE );
+ }
+
+ QTC_SeekFile( fd, bset->offset );
+
+ ret = QTC_WriteFile( fd, (BYTE_PTR)header, sizeof( QTC_HEADER ), &Error );
+
+ QTC_CloseFile( fd );
+
+ free( header );
+
+ if ( ret != sizeof( QTC_HEADER ) ) {
+ return( FAILURE );
+ }
+ }
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+ Start the catalog off building data for a new Bset
+
+ RETURNS :
+
+**********************/
+
+INT QTC_StartNewBackup(
+QTC_BUILD_PTR build,
+CHAR_PTR szTapeName,
+CHAR_PTR szSetName,
+CHAR_PTR szUserName,
+CHAR_PTR szSetDescription,
+CHAR_PTR szDeviceName,
+CHAR_PTR szVolumeName,
+CHAR_PTR szTapePassword,
+CHAR_PTR szSetPassword,
+INT nTapePasswordLength,
+INT nSetPasswordLength,
+UINT32 TapeID,
+UINT16 TapeNum,
+UINT16 SetNum,
+UINT32 LBA,
+UINT32 PBA,
+UINT32 Attribute,
+INT FDDVersion,
+INT fFDDExists,
+INT fSMExists,
+UINT32 SetCatPBA,
+UINT32 SetCatSeqNumber,
+INT fSetCatInfoValid,
+INT fBlockContinued,
+INT nBackupType,
+INT OS_id,
+INT OS_ver,
+INT fImage,
+INT fNonVolume,
+INT fNoRedirect,
+INT fFutureVersion,
+INT fCompressed,
+INT fEncrypted,
+UINT16 Date,
+UINT16 Time,
+INT EncryptionAlgorithm )
+{
+ QTC_HEADER_PTR header;
+ INT string_size;
+ INT alloc_size;
+ BYTE_PTR byte_ptr;
+
+
+ (void)szUserName;
+
+ // Clear errors and reset states.
+
+ if ( build == NULL ) {
+ return( FAILURE );
+ }
+
+ build->error = 0;
+ build->state = QTC_IDLE_STATE;
+
+ free( build->header ); // free header from last time
+ free( build->old_header );
+
+ build->header = NULL;
+ build->old_header = NULL;
+
+ // Get tape data from vcb, sizes are bytes.
+
+ string_size = 0;
+
+#ifdef OS_NLM
+ if ( szDeviceName ) {
+ string_size += strsize( szDeviceName ) * sizeof( CHAR ) ;
+ } else {
+ string_size += strsize( szVolumeName ) * sizeof( CHAR ) ;
+ }
+#else
+ string_size += strsize( szVolumeName ) * sizeof (CHAR);
+#endif
+ string_size += strsize( szTapeName ) * sizeof (CHAR);
+ string_size += strsize( szSetName ) * sizeof (CHAR);
+ string_size += strsize( szSetDescription ) * sizeof (CHAR);
+
+#ifdef OS_NLM
+ if ( gb_QTC.cat_user ) {
+ string_size += strsize( gb_QTC.cat_user ) * sizeof(CHAR);
+ } else {
+ string_size += sizeof( CHAR ) ;
+ }
+#else
+ string_size += strsize( szUserName ) * sizeof (CHAR);
+#endif
+
+ string_size += nTapePasswordLength + sizeof (CHAR);
+ string_size += nSetPasswordLength + sizeof (CHAR);
+
+
+ alloc_size = sizeof( QTC_HEADER ) + string_size;
+ if ( alloc_size < 512 ) alloc_size = 512;
+
+ header = calloc( alloc_size, 1 );
+
+ if ( header == NULL ) {
+ build->error = QTC_NO_MEMORY;
+ return( QTC_OPERATION_COMPLETE );
+ }
+
+ header->header_size = alloc_size;
+ header->string_offset = sizeof( QTC_HEADER );
+
+ build->end_of_media = FALSE;
+ build->fake_root_added = FALSE;
+
+ build->last_record = 0;
+
+ build->header = header; // for building purposes
+
+ // Set string pointers
+#ifdef OS_NLM
+ if ( szDeviceName ) {
+ header->volume_name_size = (UINT16)( strsize( szDeviceName ) * sizeof (CHAR));
+ } else {
+ header->volume_name_size = (UINT16)( strsize( szVolumeName ) * sizeof (CHAR));
+ }
+#else
+ header->volume_name_size = (UINT16)( strsize( szVolumeName ) * sizeof (CHAR));
+#endif
+
+ header->tape_name_size = (UINT16)( strsize( szTapeName ) * sizeof (CHAR));
+ header->bset_name_size = (UINT16)( strsize( szSetName ) * sizeof (CHAR));
+ header->bset_description_size = (UINT16)( strsize( szSetDescription ) * sizeof (CHAR));
+
+#ifdef OS_NLM
+ if ( gb_QTC.cat_user ) {
+ header->user_name_size = strsize( gb_QTC.cat_user ) * sizeof(CHAR);
+ } else {
+ header->user_name_size = sizeof( CHAR ) ;
+ }
+#else
+ header->user_name_size = (UINT16)( strsize( szUserName ) * sizeof(CHAR));
+#endif
+
+ header->bset_password_size = nSetPasswordLength;
+ header->tape_password_size = nTapePasswordLength;
+
+ byte_ptr = (BYTE_PTR)header;
+ byte_ptr += header->string_offset;
+
+ header->tape_name = (CHAR_PTR)byte_ptr;
+ byte_ptr += header->tape_name_size;
+ header->bset_name = (CHAR_PTR)byte_ptr;
+ byte_ptr += header->bset_name_size;
+ header->volume_name = (CHAR_PTR)byte_ptr;
+ byte_ptr += header->volume_name_size;
+ header->user_name = (CHAR_PTR)byte_ptr;
+ byte_ptr += header->user_name_size;
+ header->bset_description = (CHAR_PTR)byte_ptr;
+ byte_ptr += header->bset_description_size;
+ header->tape_password = (CHAR_PTR)byte_ptr;
+ byte_ptr += header->tape_password_size;
+ header->bset_password = (CHAR_PTR)byte_ptr;
+
+ header->tape_fid = TapeID;
+ header->tape_seq_num = TapeNum;
+ header->bset_num = SetNum;
+
+ header->FDD_SeqNum = 0;
+ header->FDD_PBA = 0;
+
+ header->VCB_attributes = Attribute;
+
+ header->FDD_Version = FDDVersion;
+
+ if ( fSetCatInfoValid ) {
+
+ header->FDD_SeqNum = SetCatSeqNumber;
+ header->FDD_PBA = SetCatPBA;
+ header->status |= QTC_OTCVALID;
+ }
+
+ if ( fFutureVersion ) {
+ header->status |= QTC_FUTURE_VER;
+ }
+ if ( fEncrypted ) {
+ header->status |= QTC_ENCRYPTED;
+ }
+ if ( fCompressed ) {
+ header->status |= QTC_COMPRESSED;
+ }
+
+ if ( fFDDExists ) {
+ header->status |= QTC_FDDEXISTS;
+ }
+
+ if ( fSMExists ) {
+ header->status |= QTC_SMEXISTS;
+ }
+
+ if ( fBlockContinued ) {
+ header->status |= QTC_CONTINUATION;
+ }
+
+ if ( QTC_GetLowerTapeBset( header->tape_fid,
+ (INT16)header->tape_seq_num,
+ (INT16)header->bset_num ) ) {
+
+ header->status |= QTC_CONTINUATION;
+ }
+
+ if ( QTC_GetHigherTapeBset( header->tape_fid,
+ (INT16)header->tape_seq_num,
+ (INT16)header->bset_num ) ) {
+
+ header->status |= QTC_SPLIT;
+ }
+
+ if ( header->status & ( QTC_SPLIT | QTC_CONTINUATION ) ) {
+
+ // Try updating flags on other pieces of this bset.
+
+ QTC_AdjustFlagsOnOtherPieces( header->tape_fid,
+ (INT16)header->tape_seq_num,
+ (INT16)header->bset_num );
+
+ }
+
+ if ( gb_QTC.unicode ) {
+ header->status |= QTC_UNICODE;
+ }
+
+ header->num_dirs = build->num_dirs;
+ header->num_files = build->num_files ;
+ header->num_bytes = 0;
+ header->num_bytes_msw = 0;
+ header->num_corrupt_files = build->num_corrupt_files;
+ header->num_files_in_use = 0;
+
+ if ( QTC_IsThisBsetKnown( build, header ) ) {
+ QTC_UpdateOTCInfo( header );
+ free( header );
+ build->header = NULL;
+ return( QTC_SKIP_TO_NEXT_BSET );
+ }
+
+ if ( header->tape_name_size ) {
+ memcpy( header->tape_name,
+ szTapeName, (INT)header->tape_name_size );
+ header->tape_name[ (header->tape_name_size - 1) / sizeof(CHAR) ] = TEXT( '\0' );
+ }
+ else {
+
+ header->tape_name_size = sizeof( CHAR );
+ header->tape_name[ 0 ] = TEXT( '\0' );
+ }
+
+ if ( header->bset_name_size ) {
+ strncpy( header->bset_name,
+ szSetName, (INT)header->bset_name_size / sizeof (CHAR) );
+ header->bset_name[ (header->bset_name_size - 1) / sizeof(CHAR) ] = TEXT( '\0' );
+ }
+ else {
+ header->bset_name_size = sizeof( CHAR );
+ header->bset_name[ 0 ] = TEXT( '\0' );
+ }
+
+ if ( header->bset_description_size ) {
+ strncpy( header->bset_description,
+ szSetDescription, (INT)header->bset_description_size / sizeof (CHAR) );
+ header->bset_description[ (header->bset_description_size - 1) / sizeof(CHAR) ] = TEXT( '\0' );
+ }
+ else {
+ header->bset_description_size = sizeof( CHAR );
+ header->bset_description[ 0 ] = TEXT( '\0' );
+ }
+
+ if ( header->user_name_size ) {
+#ifdef OS_NLM
+
+ if ( gb_QTC.cat_user ) {
+ strncpy( header->user_name, gb_QTC.cat_user, header->user_name_size ) ;
+ } else {
+ msassert( header->user_name_size == sizeof( CHAR ) ) ;
+ }
+#else
+ strncpy( header->user_name,
+ szUserName, (INT)header->user_name_size / sizeof (CHAR) );
+#endif
+ header->user_name[ (header->user_name_size - 1) / sizeof(CHAR) ] = TEXT( '\0' );
+ }
+ else {
+ header->user_name_size = sizeof( CHAR );
+ header->user_name[ 0 ] = 0;
+ }
+
+ if ( header->volume_name_size ) {
+#ifdef OS_NLM
+ if ( szDeviceName ) {
+ memcpy( header->volume_name,
+ szDeviceName, (INT)header->volume_name_size ) ;
+ } else {
+ strncpy( header->volume_name,
+ szVolumeName, (INT) header->volume_name_size / sizeof( CHAR ) ) ;
+ }
+#else
+ strncpy( header->volume_name,
+ szVolumeName, (INT) header->volume_name_size / sizeof( CHAR ) ) ;
+#endif
+ header->volume_name[ (header->volume_name_size - 1) / sizeof(CHAR) ] = TEXT( '\0' );
+ }
+ else {
+ header->volume_name_size = sizeof( CHAR );
+ header->volume_name[ 0 ] = TEXT( '\0' );
+ }
+
+ if ( header->tape_password_size ) {
+ memcpy( header->tape_password,
+ szTapePassword,
+ (INT)header->tape_password_size );
+ }
+
+ if ( header->bset_password_size ) {
+ memcpy( header->bset_password,
+ szSetPassword,
+ (INT)header->bset_password_size );
+ }
+
+ header->encrypt_algor = EncryptionAlgorithm;
+
+ // set backup set type
+
+ header->backup_type = nBackupType;
+
+ // init other stuff for this bset
+
+ header->LBA = LBA;
+ header->PBA_VCB = PBA;
+
+
+ header->backup_date = Date;
+ header->backup_time = Time;
+
+ header->OS_id = OS_id;
+ header->OS_ver = OS_ver;
+
+ if ( fNoRedirect ) {
+ header->status |= QTC_NO_REDIRECT;
+ }
+
+ if ( fNonVolume ) {
+ header->status |= QTC_NON_VOLUME;
+ }
+
+ header->dir_start = 0;
+ header->fil_start = 0;
+ header->rec_start = 0;
+
+ header->dir_size = 0;
+ header->fil_size = 0;
+ header->rec_size = 0;
+
+ if ( fImage ) {
+ header->status |= QTC_IMAGE;
+ header->status |= QTC_PARTIAL;
+ build->do_full_cataloging = FALSE;
+ }
+
+ if ( build->continuation_tape ) {
+ header->status |= QTC_CONTINUATION;
+ }
+
+ if ( ! build->do_full_cataloging ) {
+ header->status |= QTC_PARTIAL;
+ }
+
+ header->num_dirs = build->num_dirs;
+ header->num_files = build->num_files ;
+ header->num_bytes = 0;
+ header->num_bytes_msw = 0;
+ header->num_corrupt_files = build->num_corrupt_files;
+ header->num_files_in_use = 0;
+
+ if ( QTC_OpenTempFiles( build ) != SUCCESS ) {
+
+ free( header );
+ header = NULL;
+ build->header = NULL;
+
+ return( QTC_OPERATION_COMPLETE );
+ }
+
+ build->build_path_len = 0;
+ build->curr_fil_off = 0;
+ build->curr_dir_off = 0;
+ build->curr_rec_off = 0;
+ build->record_cnt = 0;
+
+ build->state = QTC_ACTIVE_STATE;
+
+ build->current_level = 0;
+
+ if ( ( build->do_full_cataloging == FALSE ) ||
+ ( header->status & QTC_IMAGE ) ) {
+
+ // Save a pointer to this backup set in case we cross tape.
+
+ build->old_header = malloc( (INT)build->header->header_size );
+ memcpy( build->old_header, build->header, (INT)build->header->header_size );
+ QTC_FinishBackup( build );
+
+ return( QTC_SKIP_TO_NEXT_BSET );
+ }
+
+ return( QTC_SKIP_TO_NEXT_ITEM );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_AdjustFlagsOnOtherPieces(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+INT16 bset_num )
+{
+ QTC_BSET_PTR bset;
+ QTC_HEADER_PTR header;
+
+ bset = QTC_GetHigherTapeBset( tape_fid, tape_seq_num, bset_num );
+
+ while ( bset != NULL ) {
+
+ if ( ! bset->status & QTC_CONTINUATION ) {
+ header = QTC_LoadHeader( bset );
+ if ( header ) {
+ QTC_ChangeBsetFlags( header, QTC_CONTINUATION );
+ free( header );
+ }
+ }
+
+ bset = QTC_GetHigherTapeBset( bset->tape_fid,
+ (INT16)bset->tape_seq_num,
+ (INT16)bset->bset_num );
+ }
+
+
+ bset = QTC_GetLowerTapeBset( tape_fid, tape_seq_num, bset_num );
+
+ while ( bset != NULL ) {
+
+ if ( ! bset->status & QTC_SPLIT ) {
+ header = QTC_LoadHeader( bset );
+ if ( header ) {
+ QTC_ChangeBsetFlags( header, QTC_SPLIT );
+ free( header );
+ }
+ }
+
+ bset = QTC_GetLowerTapeBset( bset->tape_fid,
+ (INT16)bset->tape_seq_num,
+ (INT16)bset->bset_num );
+ }
+
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_IsThisBsetKnown( QTC_BUILD_PTR build, QTC_HEADER_PTR header )
+{
+ QTC_BSET_PTR bset;
+
+ bset = QTC_FindBset( header->tape_fid,
+ (INT16)header->tape_seq_num,
+ (INT16)header->bset_num );
+
+ if ( bset != NULL ) {
+
+ if ( ( bset->status & (QTC_PARTIAL|QTC_INCOMPLETE) ) &&
+ build->do_full_cataloging ) {
+
+ // this space intentionally left blank
+
+ }
+ else {
+
+ return( TRUE );
+ }
+ }
+
+ return( FALSE );
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ Called when we reached the end of data for a Bset.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_FinishBackup( QTC_BUILD_PTR build )
+{
+ QTC_BSET_PTR bset;
+
+ if ( build == NULL ) {
+ return( FAILURE );
+ }
+
+ if ( build->error ) {
+ return( FAILURE );
+ }
+
+ // If this was set then we are done with it and it should be reset,
+ // otherwise all sets on tape N are labeled as contiuation sets.
+
+ build->continuation_tape = FALSE;
+
+ // We were doing a partial catalog a tape and not a backup
+ // and this operation has already been done.
+
+ if ( build->header == NULL ) {
+
+ return( SUCCESS );
+ }
+
+ if ( (build->record_cnt == 0) && build->do_full_cataloging ) {
+
+ // Fake the root
+
+ build->record.status = QTC_DIRECTORY;
+ build->record.attribute = 0;
+ build->record.date = 0;
+ build->record.time = 0;
+ build->record.lba = 1;
+ build->record.name_offset = 0;
+ build->record.common.common.file_start = 0;
+ build->record.common.common.height = 0;
+
+ QTC_SaveDirRecord( build, TEXT(""), 0, build->record_cnt++, NULL, 0 );
+ }
+
+ // Update data for last dir processed
+
+ QTC_SetCountsForLastDir( build );
+
+ // Flush the internal data buffers
+
+ QTC_FlushInternalBuffers( build );
+
+ // Save the size in bytes of catalog data stored for this Bset
+
+ build->header->rec_size = build->curr_rec_off;
+ build->header->fil_size = build->curr_fil_off;
+ build->header->dir_size = build->curr_dir_off;
+
+ if ( QTC_AssembleFiles( build ) == SUCCESS ) {
+
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item );
+ v_bset_item = VM_Alloc( qtc_vmem_hand, sizeof( QTC_BSET ) );
+ bset = VM_MemLock( qtc_vmem_hand, v_bset_item, VM_READ_WRITE );
+
+ if ( bset != NULL ) {
+
+ // fill in bset
+ bset->q_elem.q_ptr = v_bset_item;
+ bset->tape_fid = build->header->tape_fid;
+ bset->tape_seq_num = build->header->tape_seq_num;
+ bset->bset_num = build->header->bset_num;
+ bset->offset = build->header->offset;
+ bset->status = build->header->status;
+
+ QTC_NewBset( v_bset_item ) ;
+ free( build->header );
+ build->header = NULL;
+ }
+ else {
+ build->error = QTC_NO_MEMORY;
+ }
+ }
+
+ build->state = QTC_IDLE_STATE;
+ build->end_of_media = FALSE;
+
+ if ( build->error ) {
+ return( FAILURE );
+ }
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+static INT QTC_AssembleFiles( QTC_BUILD_PTR build )
+{
+ INT fd = -1;
+ INT ret;
+ INT Error;
+ UINT32 offset;
+ UINT32 last_header_offset = 0;
+ BYTE_PTR buffer = NULL;
+ QTC_TAPE_HEADER tape_header;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ QTC_HEADER temp_header;
+
+
+ if ( build->error ) {
+ return( QTC_AssembleError( build, fd ) );
+ }
+
+ buffer = malloc( QTC_BUF_SIZE ); // borrow a buffer
+
+ if ( buffer == NULL ) {
+ return( QTC_AssembleError( build, fd ) );
+ }
+
+ // find previous last bset header
+
+ last_header_offset = 0L;
+
+ tape = QTC_GetFirstTape();
+
+ while ( tape != NULL ) {
+
+ if ( ( tape->tape_fid == build->header->tape_fid ) &&
+ ( tape->tape_seq_num == (INT16)build->header->tape_seq_num ) ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+ if ( bset->offset > last_header_offset ) {
+ last_header_offset = bset->offset;
+ }
+ bset = QTC_GetNextBset( bset );
+ }
+ break;
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ fd = QTC_OpenFile( build->header->tape_fid,
+ (INT16)build->header->tape_seq_num, TRUE, TRUE );
+
+ if ( fd < 0 ) {
+
+ free( buffer );
+ if ( errno == ENOSPC ) {
+ build->error = QTC_DISK_FULL;
+ }
+ else if ( errno == EMFILE ) {
+ build->error = QTC_NO_FILE_HANDLES;
+ }
+ else {
+ build->error = QTC_OPEN_FAILED;
+ }
+
+ build->state = QTC_ERROR_STATE;
+ return( QTC_AssembleError( build, fd ) );
+ }
+
+ if ( last_header_offset != 0 ) {
+
+ QTC_SeekFile( fd, last_header_offset );
+
+ ret = QTC_ReadFile( fd, (BYTE_PTR)&temp_header, sizeof( QTC_HEADER ), &Error );
+
+ if ( ret != sizeof( QTC_HEADER ) ) {
+ free( buffer );
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ return( QTC_AssembleError( build, fd ) );
+ }
+
+ // make it point to end of good data, which may not be EOF
+
+ offset = last_header_offset + temp_header.header_size;
+ offset += temp_header.rec_size;
+ offset += temp_header.fil_size;
+ offset += temp_header.dir_size;
+
+ // point to new last bset offset
+
+ temp_header.next_bset = offset;
+
+ QTC_SeekFile( fd, offset );
+ }
+ else {
+
+ QTC_SeekFile( fd, 0L );
+
+ memcpy( tape_header.signature, QTC_SIGNATURE, sizeof( QTC_SIGNATURE ) );
+
+ tape_header.major_version = QTC_MAJOR_VERSION;
+ tape_header.minor_version = QTC_MINOR_VERSION;
+
+ ret = QTC_WriteFile( fd, (BYTE_PTR)&tape_header, sizeof(QTC_TAPE_HEADER), &Error );
+
+ if ( ret != sizeof( QTC_TAPE_HEADER ) ) {
+
+ free( buffer );
+
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+
+ return( QTC_AssembleError( build, fd ) );
+ }
+
+ offset = sizeof( QTC_TAPE_HEADER );
+ }
+
+ build->header->offset = offset;
+
+ build->header->rec_start = build->header->offset + build->header->header_size;
+ build->header->dir_start = build->header->rec_start + build->header->rec_size;
+ build->header->fil_start = build->header->dir_start + build->header->dir_size;
+
+ build->header->next_bset = 0L;
+
+ // write out bset header
+
+ ret = QTC_WriteFile( fd, (BYTE_PTR)build->header, (INT)build->header->header_size, &Error );
+
+ if ( ret != (INT)build->header->header_size ) {
+
+ free( buffer );
+
+ build->error = Error;
+ build->state = QTC_ERROR_STATE;
+
+ return( QTC_AssembleError( build, fd ) );
+ }
+
+ // transfer records file
+
+ ret = QTC_CopyFile( build->fh_rec, fd, build->header->rec_size, buffer );
+
+ if ( ret != SUCCESS ) {
+
+ if ( errno == ENOSPC ) {
+ build->error = QTC_DISK_FULL;
+ }
+ else {
+ build->error = QTC_WRITE_FAILED;
+ }
+ build->state = QTC_ERROR_STATE;
+ free( buffer );
+
+ return( QTC_AssembleError( build, fd ) );
+ }
+ else {
+ QTC_CloseFile( build->fh_rec );
+ build->fh_rec = -1;
+ unlink( build->rec_file );
+ }
+
+ // transfer directories file
+
+ ret = QTC_CopyFile( build->fh_dir, fd, build->header->dir_size, buffer );
+
+ if ( ret != SUCCESS ) {
+ if ( errno == ENOSPC ) {
+ build->error = QTC_DISK_FULL;
+ }
+ else {
+ build->error = QTC_WRITE_FAILED;
+ }
+ build->state = QTC_ERROR_STATE;
+ free( buffer );
+ return( QTC_AssembleError( build, fd ) );
+ }
+ else {
+ QTC_CloseFile( build->fh_dir );
+ build->fh_dir = -1;
+ unlink( build->dir_file );
+ }
+
+ // transfer files file
+
+ ret = QTC_CopyFile( build->fh_fil, fd, build->header->fil_size, buffer );
+
+ if ( ret != SUCCESS ) {
+ if ( errno == ENOSPC ) {
+ build->error = QTC_DISK_FULL;
+ }
+ else {
+ build->error = QTC_WRITE_FAILED;
+ }
+ build->state = QTC_ERROR_STATE;
+ free( buffer );
+ return( QTC_AssembleError( build, fd ) );
+ }
+ else {
+ QTC_CloseFile( build->fh_fil );
+ build->fh_fil = -1;
+ unlink( build->fil_file );
+ }
+
+ if ( last_header_offset ) {
+
+ // set the last bset to point to this one now that all the data
+ // was correctly written to file.
+
+ QTC_SeekFile( fd, last_header_offset );
+ QTC_WriteFile( fd, (BYTE_PTR)&temp_header, sizeof( QTC_HEADER ), &Error );
+ }
+
+ // close the new longer data file
+
+ QTC_CloseFile( fd );
+
+ free( buffer );
+
+ // return that everything is A-OK
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_CopyFile(
+INT from,
+INT to,
+UINT32 count,
+BYTE_PTR buffer )
+{
+ INT size;
+ INT Error;
+
+ // Reposition to beginning of temp data file
+
+ QTC_SeekFile( from, 0L );
+
+ do {
+
+ if ( count > (UINT32)QTC_BUF_SIZE ) {
+ size = QTC_BUF_SIZE;
+ }
+ else {
+ size = (INT)count;
+ }
+
+ size = QTC_ReadFile( from, buffer, size, &Error );
+ if ( size == -1 ) {
+ return( FAILURE );
+ }
+
+ size = QTC_WriteFile( to, buffer, size, &Error );
+ if ( size == -1 ) {
+ return( FAILURE );
+ }
+
+ count -= size;
+
+ } while ( size != 0 && count != 0 );
+
+ if ( count ) {
+ return( FAILURE );
+ }
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static INT QTC_AssembleError( QTC_BUILD_PTR build, INT fd )
+{
+
+ if ( fd >= 0 ) {
+ QTC_CloseFile( fd );
+ }
+
+ if ( build->fh_rec >= 0 ) {
+ QTC_CloseFile( build->fh_rec );
+ unlink( build->rec_file );
+ }
+
+ if ( build->fh_dir >= 0 ) {
+ QTC_CloseFile( build->fh_dir );
+ unlink( build->dir_file );
+ }
+
+ if ( build->fh_fil >= 0 ) {
+ QTC_CloseFile( build->fh_fil );
+ unlink( build->fil_file );
+ }
+
+ build->files_open = FALSE;
+
+ // check to see if this was a new file and if so delete it.
+
+ return( FAILURE );
+}
+
+
+#endif // #if !defined( P_CLIENT )
diff --git a/private/utils/ntbackup/src/qtc_bset.c b/private/utils/ntbackup/src/qtc_bset.c
new file mode 100644
index 000000000..91c3d22fe
--- /dev/null
+++ b/private/utils/ntbackup/src/qtc_bset.c
@@ -0,0 +1,685 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: QTC_BSET.C
+
+ Description:
+
+ The functions used when constructing catalog information about
+ a new bset being backed up or a tape being cataloged.
+
+ $Log: N:\LOGFILES\QTC_BSET.C_V $
+
+ Rev 1.9 06 Dec 1993 09:46:10 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.8 28 Oct 1993 14:50:12 MIKEP
+dll changes
+
+ Rev 1.7 16 Sep 1993 15:19:20 JOHNES
+803EPR0879 - When adding a new tape to gb_QTC.tape_list, started inserting
+it in the right place with respect to the other tapes in a family
+(i.e. seq #'s 1, 2, 3 ... );
+
+ Rev 1.6 13 May 1993 13:18:44 ChuckS
+Revamped QTC usage of virtual memory. Changed bset arguments of QTC_RemoveBset
+and QTC_NewBset to VM handles (VQ_HDL's); changed queue function calls to
+corresponding vm- queue calls. Removed logic in QTC_NewBset which was
+deciding whether to InsertElem AFTER the last element of the queue, or
+to EnQueue the elem (there's no difference).
+
+ Rev 1.5 23 Mar 1993 18:00:32 ChuckS
+Added arg to QTC_OpenFile indicating if need to open for writes
+
+ Rev 1.4 04 Dec 1992 17:37:42 ChuckS
+Deleted line that was smashing the v_tape_item VM_HDL we were saving in
+the q_ptr of the QUEUE_ELEM. This was causing VM_SEEK_ERROR's when QTC was
+asking the VM unit to load bogus virtual memory pages.
+
+ Rev 1.3 20 Nov 1992 13:49:54 CHARLIE
+JAGUAR: Move to SRM based QTC code
+
+ENDEAVOR: Integrated virtual memory usage in anticipation of DOS. These
+changes should be transparent to non DOS products.
+
+ Rev 1.2 06 Nov 1992 15:29:56 DON
+Change debug.h to be_debug.h and zprintf to BE_Zprintf
+
+ Rev 1.1 09 Oct 1992 11:53:48 MIKEP
+unicode pass
+
+ Rev 1.0 03 Sep 1992 16:56:16 STEVEN
+Initial revision.
+
+****************************************************/
+
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "qtc.h"
+
+// unicode text macro
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+QTC_BSET_PTR QTC_GetLowerTapeBset(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+INT16 bset_num )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ QTC_BSET_PTR bset_found = NULL;
+
+ tape = QTC_GetFirstTape();
+
+ while ( tape != NULL ) {
+
+ if ( ( tape->tape_fid == tape_fid ) &&
+ ( tape->tape_seq_num < tape_seq_num ) ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == bset_num ) {
+
+ if ( ( bset_found == NULL ) ||
+ ( bset_found->tape_seq_num < bset->tape_seq_num ) ) {
+
+ bset_found = bset;
+ }
+ }
+
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( bset_found );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+QTC_BSET_PTR QTC_GetHigherTapeBset(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+INT16 bset_num )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ QTC_BSET_PTR bset_found = NULL;
+
+ tape = QTC_GetFirstTape();
+
+ while ( tape != NULL ) {
+
+ if ( ( tape->tape_fid == tape_fid ) &&
+ ( tape->tape_seq_num > tape_seq_num ) ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == bset_num ) {
+
+ if ( ( bset_found == NULL ) ||
+ ( bset_found->tape_seq_num > bset->tape_seq_num ) ) {
+
+ bset_found = bset;
+ }
+ }
+
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( bset_found );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+ This option is used when a bset is going to be recataloged. So we remove
+ the old bset header for it by marking it erased.
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_RemoveBset( QTC_TAPE_PTR tape, VQ_HDL hBset )
+{
+ INT fd;
+ INT ret;
+ INT Error;
+ QTC_HEADER temp_header;
+ QTC_BSET_PTR bset ;
+
+ // Need to open file and mark this bset as QTC_ERASED
+ // then close the file.
+
+ vmRemoveQueueElem( &(tape->bset_list), hBset ) ;
+
+ bset = VM_MemLock( qtc_vmem_hand, hBset, VM_READ_WRITE ) ;
+
+ // Rewrite bset header in data file to indicate
+ // it's gone.
+
+ fd = QTC_OpenFile( bset->tape_fid, (INT16)bset->tape_seq_num, TRUE, FALSE );
+
+ if ( fd >= 0 ) {
+
+ QTC_SeekFile( fd, bset->offset );
+
+ ret = QTC_ReadFile( fd, (BYTE_PTR)&temp_header, sizeof( QTC_HEADER ), &Error );
+
+ if ( ret == sizeof( QTC_HEADER ) ) {
+ temp_header.status |= QTC_ERASED;
+ QTC_SeekFile( fd, bset->offset );
+ QTC_WriteFile( fd, (BYTE_PTR)&temp_header, sizeof( QTC_HEADER ), &Error );
+ }
+ QTC_CloseFile( fd );
+ }
+
+ /* free( bset ); VM_stuff */
+ VM_MemUnLock( qtc_vmem_hand, hBset ) ;
+
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+ Add a new tape/bset to our list of known bsets
+
+ RETURNS :
+
+**********************/
+
+INT QTC_NewBset( VQ_HDL hBset )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR temp_bset;
+ QTC_BSET_PTR bset ;
+ VQ_HDL v_bset_old_item ;
+ VQ_HDL hRelatedTape ; /* pointer to a related tape, if any. */
+ INT16 RelatedTapeSeqNo ; /* the sequence number of the related tape */
+
+ if ( !( bset = VM_MemLock( qtc_vmem_hand, hBset, VM_READ_WRITE ) ) ) {
+ return QTC_NO_MEMORY ;
+ }
+
+ // Look through list to see if tapes already here before adding it
+ //
+ // The new tape must be sorted into the queue so while we're looking,
+ // keep track of the nearest related tape already in the list (preferably
+ // the one just before it).
+
+ tape = QTC_GetFirstTape( );
+
+ hRelatedTape = 0 ;
+ RelatedTapeSeqNo = 0 ; /* sequence numbers start at 1 */
+
+ while ( tape != NULL ) {
+
+ msassert( tape->tape_seq_num != 0 ) ;
+
+ if ( tape->tape_fid == bset->tape_fid ) {
+
+ if ( tape->tape_seq_num == (INT16)bset->tape_seq_num ) {
+
+ hRelatedTape = 0 ;
+ RelatedTapeSeqNo = 0 ; /* sequence numbers start at 1 */
+
+ break;
+
+ } else {
+
+ if ( tape->tape_seq_num > (INT16)bset->tape_seq_num ) {
+
+ // this 'tape' comes after the new bset tape
+ // since the list is in sorted order, there
+ // is no need to search any farther.
+
+ hRelatedTape = tape->q_elem.q_ptr ;
+ RelatedTapeSeqNo = tape->tape_seq_num ;
+
+ // leave the lock of the 'tape' virtual memory
+ // hanging since that's what QTC_GetNextTape
+ // would do if it were at the end of the list
+ tape = NULL ;
+
+ break ;
+
+ } else {
+
+ // the new bset tape must come after this 'tape' so
+ // save this VM pointer and seq_no in-case it's
+ // the last one in the list.
+
+ hRelatedTape = tape->q_elem.q_ptr ;
+ RelatedTapeSeqNo = tape->tape_seq_num ;
+
+ }
+
+ }
+
+ } else {
+
+ // if we've found a related tape and the next tape
+ // has a different FID, there's no need to keep searching
+ // since all the tapes with the same FID are together in
+ // the list.
+
+ if ( hRelatedTape != 0 ) {
+
+ // leave the lock of the 'tape' virtual memory
+ // hanging since that's what QTC_GetNextTape
+ // would do if it were at the end of the list
+ tape = NULL ;
+ break;
+
+ }
+
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ if ( tape == NULL ) {
+
+ VM_MemUnLock( qtc_vmem_hand, v_tape_item ) ;
+ v_tape_item = VM_Alloc( qtc_vmem_hand, sizeof(QTC_TAPE) ) ;
+ tape = VM_MemLock( qtc_vmem_hand, v_tape_item, VM_READ_WRITE ) ;
+
+ if ( tape == NULL ) {
+ return( QTC_NO_MEMORY ) ;
+ }
+ vmInitQElem( &( tape->q_elem ) ) ;
+ tape->status = 0;
+ tape->tape_fid = bset->tape_fid;
+ tape->tape_seq_num = (INT16)bset->tape_seq_num;
+
+ tape->q_elem.q_ptr = v_tape_item ;
+
+ vmInitQueue( &(tape->bset_list) ) ;
+
+
+ // insert the tape into the queue.
+
+
+ // if we found a related tape out there, use it as an
+ // anchor point else just insert at the end
+ if ( hRelatedTape != (VQ_HDL)NULL ) {
+
+ if ( tape->tape_seq_num < RelatedTapeSeqNo ) {
+
+ // the new element must come before this one
+ vmInsertElem( &(gb_QTC.tape_list),
+ hRelatedTape,
+ v_tape_item, BEFORE );
+
+ } else {
+
+ // the new element must come after this one
+ vmInsertElem( &(gb_QTC.tape_list),
+ hRelatedTape,
+ v_tape_item, AFTER );
+
+ }
+ }
+ else {
+ // Insert at the end. There's no difference between
+ // inserting an element AFTER the last element and enqueueing...
+ vmEnQueueElem( &(gb_QTC.tape_list), v_tape_item, FALSE ) ;
+ }
+
+ } /* endif !tape */
+
+ /*
+ Search to see if another bset matches this one, they may have
+ fully cataloged an existing partial set.
+ */
+
+ if ( vmQueueCount( &(tape->bset_list ) ) ) {
+
+ // Try to start searching at the end, saves time.
+
+ temp_bset = QTC_GetLastBset( tape ) ;
+
+ if ( temp_bset->bset_num > bset->bset_num ) {
+
+ temp_bset = QTC_GetFirstBset( tape ) ;
+ }
+
+ while ( temp_bset != NULL ) {
+
+ if ( temp_bset->bset_num == bset->bset_num ) {
+
+ v_bset_old_item = v_bset_item ;
+ temp_bset = QTC_GetNextBset( temp_bset ) ;
+
+ QTC_RemoveBset( tape, v_bset_old_item ) ;
+ VM_Free( qtc_vmem_hand, v_bset_old_item ) ;
+
+ break;
+ }
+
+ // There's no guarantee temp_bset is still non-NULL, because of
+ // temp_bset = QTC_GetNextBset( temp_bset ) above. So check it...
+
+ if ( temp_bset ) {
+ if ( temp_bset->bset_num > bset->bset_num ) {
+ break;
+ }
+
+ temp_bset = QTC_GetNextBset( temp_bset );
+ }
+ }
+
+ if ( temp_bset != NULL ) {
+
+ // Insert before this one.
+
+ vmInsertElem( &(tape->bset_list),
+ v_bset_item,
+ hBset, BEFORE );
+ }
+ else {
+ // Insert at the end. There's no difference between
+ // inserting an element AFTER the last element and enqueueing...
+ vmEnQueueElem( &(tape->bset_list), hBset, FALSE ) ;
+ }
+ }
+ else {
+
+ // First item added.
+ vmEnQueueElem( &(tape->bset_list), hBset, FALSE ) ;
+ }
+
+
+ // leave a the lock on v_tape_item hanging
+ // the next call to QTC_GetxxxxTape will clear it.
+
+ VM_MemUnLock( qtc_vmem_hand, hBset ) ;
+
+ return( SUCCESS ) ;
+}
+
+/**********************
+
+ NAME : QTC_FindBset
+
+ DESCRIPTION :
+
+ Returns a pointer to the backup set if it exists in the catalog.
+
+ RETURNS :
+
+**********************/
+
+QTC_BSET_PTR QTC_FindBset( UINT32 tape_fid, INT16 tape_num, INT16 bset_num )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+
+ tape = QTC_GetFirstTape( ) ;
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+
+ if ( ( tape->tape_seq_num == tape_num ) ||
+ ( tape_num == -1 ) ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( ( bset->bset_num == bset_num ) ||
+ ( bset_num == -1 ) ) {
+ return( bset );
+ }
+
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( NULL );
+}
+
+
+/**********************
+
+ NAME : QTC_AnySearchableBsets
+
+ DESCRIPTION :
+
+ A function to tell the menu manager if the search catalogs option is
+ possible. It checks to see if there is at least one known fully
+ cataloged bset.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_AnySearchableBsets( )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->status & QTC_PARTIAL ) {
+ bset = QTC_GetNextBset( bset );
+ }
+ else {
+ return( TRUE );
+ }
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( FALSE );
+}
+
+
+/**********************
+
+ NAME : QTC_IsThereAnotherBset
+
+ DESCRIPTION :
+
+ Determine if there is another bset on this tape that we know about.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_IsThereAnotherBset( QTC_BSET_PTR bset )
+{
+ INT16 seq_num;
+
+ seq_num = (INT16)bset->tape_seq_num;
+
+ bset = QTC_GetNextBset( bset );
+
+ if ( bset == NULL ) {
+ return( FALSE );
+ }
+
+ if ( bset->tape_seq_num != seq_num ) {
+ return( FALSE );
+ }
+
+ return( TRUE );
+}
+
+
+/**********************
+
+ NAME : QTC_GetFirstBset
+
+ DESCRIPTION :
+
+ Get a pointer to the first bset on this tape.
+
+ RETURNS :
+
+**********************/
+
+QTC_BSET_PTR QTC_GetFirstBset(
+QTC_TAPE_PTR tape ) // I - tape to get bsets from
+{
+ VQ_HDL hBset ;
+
+ if ( tape == NULL ) {
+ return( (QTC_BSET_PTR)NULL );
+ }
+
+ hBset = vmQueueHead( &(tape->bset_list) ) ;
+
+ if ( hBset != (VQ_HDL) NULL ) {
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item ) ;
+ return( (QTC_BSET_PTR)VM_MemLock( qtc_vmem_hand, v_bset_item = hBset, VM_READ_WRITE ) ) ;
+ }
+
+ return( NULL ) ;
+}
+
+/**********************
+
+ NAME : QTC_GetLastBset
+
+ DESCRIPTION :
+
+ Get a pointer to the last bset on this tape.
+
+ RETURNS :
+
+**********************/
+
+QTC_BSET_PTR QTC_GetLastBset(
+QTC_TAPE_PTR tape ) // I - tape to get bsets from
+{
+ VQ_HDL hBset ;
+
+ if ( tape == NULL ) {
+ return( (QTC_BSET_PTR)NULL );
+ }
+
+ hBset = vmQueueTail( &(tape->bset_list) );
+
+ if ( hBset != (VQ_HDL) NULL ) {
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item ) ;
+ return( (QTC_BSET_PTR)VM_MemLock( qtc_vmem_hand, v_bset_item = hBset, VM_READ_WRITE ) ) ;
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : QTC_GetNextBset
+
+ DESCRIPTION :
+
+ Get a pointer to the next bset on this tape.
+
+ RETURNS :
+
+**********************/
+
+QTC_BSET_PTR QTC_GetNextBset(
+QTC_BSET_PTR bset ) // I - current bset
+{
+ VQ_HDL hBset ;
+
+ hBset = vmQueueNext( &( bset->q_elem ) ) ;
+
+ if ( hBset != (VQ_HDL) NULL ) {
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item );
+ return( (QTC_BSET_PTR)VM_MemLock( qtc_vmem_hand, v_bset_item = hBset, VM_READ_WRITE ) ) ;
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : QTC_GetPrevBset
+
+ DESCRIPTION :
+
+ Get a pointer to the previous bset on this tape.
+
+ RETURNS :
+
+**********************/
+
+QTC_BSET_PTR QTC_GetPrevBset(
+QTC_BSET_PTR bset ) // I - current bset
+{
+ VQ_HDL hBset ;
+
+ hBset = vmQueuePrev( &( bset->q_elem ) ) ;
+
+ if ( hBset != (VQ_HDL) NULL ) {
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item );
+ return( (QTC_BSET_PTR)VM_MemLock( qtc_vmem_hand, v_bset_item = hBset, VM_READ_WRITE ) ) ;
+ }
+
+ return( NULL );
+}
diff --git a/private/utils/ntbackup/src/qtc_eom.c b/private/utils/ntbackup/src/qtc_eom.c
new file mode 100644
index 000000000..0f8dfef14
--- /dev/null
+++ b/private/utils/ntbackup/src/qtc_eom.c
@@ -0,0 +1,894 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: QTC_EOM.C
+
+ Description:
+
+ The functions used when constructing catalog information about
+ a new bset being backed up or a tape being cataloged, and you
+ hit EOM.
+
+ $Log: N:/LOGFILES/QTC_EOM.C_V $
+
+ Rev 1.19.1.0 20 Jul 1994 19:35:12 STEVEN
+fix unicode status flag
+
+ Rev 1.19 23 Mar 1994 10:27:30 MIKEP
+fix trap if eom reached after abort called
+
+ Rev 1.18 15 Feb 1994 14:05:24 MIKEP
+fix cataloging crossing set bug
+
+ Rev 1.17 11 Dec 1993 11:49:18 MikeP
+fix warnings from unicode compile
+
+ Rev 1.16 06 Dec 1993 09:46:48 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.15 28 Oct 1993 14:47:36 MIKEP
+dll changes
+
+ Rev 1.14 16 Jun 1993 21:29:22 GLENN
+fix crossing set restores for eom with mtf.
+
+ Rev 1.13 18 Feb 1993 09:02:08 DON
+Cleaned up compiler warnings
+
+ Rev 1.12 09 Feb 1993 17:22:44 STEVEN
+checkin for mikep
+
+ Rev 1.11 30 Jan 1993 12:06:26 DON
+Removed compiler warnings
+
+ Rev 1.10 26 Jan 1993 17:11:00 MIKEP
+vcb changes
+
+ Rev 1.9 25 Jan 1993 09:10:00 MIKEP
+add stdwcs because it seems to need it now
+
+ Rev 1.8 01 Jan 1993 15:19:58 MIKEP
+fix unicode bug
+
+ Rev 1.7 14 Dec 1992 12:29:00 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.6 07 Dec 1992 13:47:06 CHARLIE
+Fixed warning
+
+ Rev 1.5 02 Dec 1992 10:14:14 MIKEP
+fix warnings
+
+ Rev 1.4 20 Nov 1992 13:53:46 CHARLIE
+JAGUAR: Move to SRM based QTC code - no changes from previous version
+
+ Rev 1.3 06 Nov 1992 15:30:12 DON
+Change debug.h to be_debug.h and zprintf to BE_Zprintf
+
+ Rev 1.2 15 Oct 1992 10:27:26 MIKEP
+add fdd fields
+
+ Rev 1.1 09 Oct 1992 11:53:50 MIKEP
+unicode pass
+
+ Rev 1.0 03 Sep 1992 16:56:04 STEVEN
+Initial revision.
+
+****************************************************/
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdwcs.h"
+#include "msassert.h"
+#include "qtc.h"
+
+// unicode text macro
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+
+/*
+ Structure used for end of media processing during backups.
+*/
+
+typedef struct QTC_ZOMBIE *QTC_ZOMBIE_PTR;
+typedef struct QTC_ZOMBIE {
+
+ Q_ELEM q_elem;
+ CHAR_PTR name;
+ INT name_size; // size of name in BYTES incl NULL terminator
+ BYTE_PTR xtra_bytes;
+ INT xtra_byte_size;
+ UINT32 status; // file or directory
+ UINT32 attribute; // maynard FS_ attribute
+ UINT16 date; // dos date & time
+ UINT16 time;
+ union {
+ UINT32 size; // file size
+ struct {
+ UINT32 file_start:24; // start offset of file names for this dir
+ UINT32 height:8; // hieght in tree of directory
+ } common;
+ } common;
+ UINT32 lba; // logical block address on tape
+
+} QTC_ZOMBIE;
+
+
+
+
+static INT QTC_AdjustForZombies( QTC_BUILD_PTR, CHAR_PTR, CHAR_PTR, INT, Q_HEADER_PTR );
+static INT QTC_ZombieMatch( QTC_BUILD_PTR, QTC_RECORD_PTR, QTC_NAME_PTR, CHAR_PTR, CHAR_PTR, INT );
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+/****************************
+
+ Gather round and listen to my story,
+
+ During a backup operation we have hit the end of tape. Several files that
+ we have already entered into the catalogs were not actually put on this
+ tape. What happens is that we are told about the files when they are
+ placed in buffers and sent to the device driver. So when tape runs out,
+ there are files (zombies) in the buffers that will end up on the next tape,
+ not this one. The file that crosses tape is in the DDB/FDB
+ passed into this routine. We must look backwards through our catalogs to
+ find that file. The item should be marked as a split
+ item on this tape and not put on the next tape. All the
+ later items are to be placed on the next tape as normal entries. We will
+ go ahead and start the bset for the next tape and force these entries into
+ into it. However if the user aborts and doesn't supply a continuation
+ tape, then this new bset will have to be deleted.
+
+*****************************/
+
+VOID QTC_EndOfTapeReached(
+QTC_BUILD_PTR build,
+CHAR_PTR szFile,
+CHAR_PTR szPath,
+INT nPathLength )
+{
+ QTC_HEADER_PTR old_header;
+ Q_HEADER zombie_list;
+ Q_ELEM_PTR q_elem;
+
+ if ( build == NULL ) {
+ return;
+ }
+
+ if ( build->error ) {
+ return;
+ }
+
+ if ( build->header == NULL ) {
+ return;
+ }
+
+ InitQueue( &zombie_list );
+
+ if ( build->do_full_cataloging ) {
+
+ // Flush the internal data buffers
+
+ if ( QTC_FlushInternalBuffers( build ) != SUCCESS ) {
+ return;
+ }
+
+ // Save the size in bytes of catalog data stored for this Bset
+
+ build->header->rec_size = build->curr_rec_off;
+ build->header->fil_size = build->curr_fil_off;
+ build->header->dir_size = build->curr_dir_off;
+
+ // Now mark the last successful file/directory and build a queue
+ // of all the items to be sent to the next tape; and adjust our
+ // catalog size pointers for this bset, subtracting off any files
+ // sent to the next tape.
+
+ QTC_AdjustForZombies( build, szFile, szPath, nPathLength, &zombie_list );
+
+ // Just in case no files were on this tape reset that it's not a
+ // continuation tape;
+
+ build->continuation_tape = FALSE;
+
+ build->fake_root_added = FALSE;
+
+ // Mark this bset as incomplete on this tape
+
+ build->header->status |= QTC_SPLIT;
+
+ // save pointer to old bset
+
+ old_header = malloc( (INT)build->header->header_size );
+ if ( old_header == NULL ) {
+ build->error = QTC_NO_MEMORY;
+ return;
+ }
+
+ memcpy( old_header, build->header, (INT)build->header->header_size );
+
+ // close down current catalogs
+
+ if ( ! build->error ) {
+
+ build->end_of_media = TRUE; // save structures
+
+ QTC_FinishBackup( build );
+
+ // Restart cataloging for next tape
+
+ if ( ! QTC_RestartBackup( build, old_header, &zombie_list ) ) {
+
+ build->state = QTC_WAITING_STATE;
+ }
+ }
+
+ free( old_header );
+
+ // Free our zombie queue.
+
+ q_elem = DeQueueElem( &zombie_list );
+
+ while ( q_elem != NULL ) {
+ free( q_elem->q_ptr );
+ q_elem = DeQueueElem( &zombie_list );
+ }
+ }
+ else {
+
+ // Holy Tangled Tape Batman, we were doing partial cataloging/backup
+ // and we crossed the end of media. This program is about to blow its
+ // grits all over the user's lap.
+
+ // Change the flags on the active and disk copy of the bset.
+
+ QTC_ChangeBsetFlags( build->old_header, QTC_SPLIT );
+
+ // Restart cataloging for next tape
+
+ if ( ! QTC_RestartBackup( build, build->old_header, &zombie_list ) ) {
+
+ build->state = QTC_WAITING_STATE;
+
+ // This new one for use next time.
+
+ memcpy( build->old_header, build->header, (INT)build->header->header_size );
+
+ QTC_FinishBackup( build );
+ }
+
+ }
+
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static INT QTC_AdjustForZombies(
+QTC_BUILD_PTR build,
+CHAR_PTR szFile,
+CHAR_PTR szPath,
+INT nPathLength,
+Q_HEADER_PTR zombie_list )
+{
+ QTC_ZOMBIE_PTR zombie;
+ Q_ELEM_PTR curr_elem = NULL;
+ BYTE_PTR byte_ptr;
+ BYTE_PTR buffer;
+ BYTE_PTR xtra_bytes;
+ CHAR_PTR item_path;
+ CHAR_PTR item_buffer;
+ CHAR_PTR item;
+ INT item_size = 0;
+ INT xtra_byte_size = 0;
+ INT ret;
+ INT Error;
+ QTC_NAME_PTR name_ptr;
+ CHAR_PTR filename;
+ QTC_RECORD record;
+ QTC_RECORD temp_record;
+ UINT32 temp_record_num;
+ BOOLEAN done;
+ INT nSize;
+
+
+ if ( szFile == NULL && szPath == NULL ) {
+ return( SUCCESS );
+ }
+
+ buffer = (BYTE_PTR)calloc( QTC_BUF_SIZE, 1 );
+
+ if ( szFile && ((INT)strsize( szFile ) > nPathLength) ) {
+ nSize = strsize( szFile );
+ }
+ else {
+ nSize = nPathLength;
+ }
+
+ nSize *= 2; // << safety feature, i'm insecure about my math abilities
+
+ item_path = (CHAR_PTR)calloc( nSize, 1 );
+ item_buffer = (CHAR_PTR)calloc( nSize, 1 );
+
+ xtra_bytes = (BYTE_PTR)calloc( QTC_MAX_XTRA_BYTES, 1 );
+
+ name_ptr = (QTC_NAME_PTR)buffer;
+ filename = (CHAR_PTR)&buffer[ sizeof( QTC_NAME ) ];
+
+ // See what we are looking for dir or file and get name
+
+ if ( szFile != NULL ) {
+ strcpy( (CHAR_PTR)buffer, szFile );
+ strcpy( item_buffer, (CHAR_PTR)szFile );
+ item = item_buffer;
+ }
+ else {
+ item = NULL;
+ }
+
+ memcpy( buffer, szPath, nPathLength );
+ memcpy( item_path, szPath, nPathLength );
+ item_size = nPathLength;
+
+ done = FALSE;
+
+ while ( ! done ) {
+
+ if ( QTC_GetLastRecordEntered( build, &record,
+ buffer,
+ xtra_bytes, &xtra_byte_size ) != SUCCESS ) {
+ break;
+ }
+
+ if ( QTC_ZombieMatch( build, &record, name_ptr, item,
+ item_path, item_size ) == SUCCESS ) {
+
+ // Don't remove the crossing entry from the catalogs for
+ // tape 1 and don't add it to the zombie list for tape 2.
+
+ done = TRUE;
+
+ }
+ else {
+
+ if ( record.status & QTC_DIRECTORY ) {
+
+ /*******
+ Build a new current build path
+
+ Look through records for last directory and then pass
+ its name_offset as the last dir in the new path.
+ *******/
+
+ temp_record_num = build->record_cnt - 2;
+
+ while ( temp_record_num > 0 ) {
+
+ QTC_SeekFile( build->fh_rec, temp_record_num * sizeof( QTC_RECORD ) );
+
+ ret = QTC_ReadFile( build->fh_rec, (BYTE_PTR)&temp_record, sizeof( QTC_RECORD ), &Error );
+
+ if ( ret != sizeof( QTC_RECORD ) ) {
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ free( buffer );
+ free( item_path );
+ free( item_buffer );
+ free( xtra_bytes );
+ return( FAILURE );
+ }
+
+ if ( temp_record.status & QTC_DIRECTORY ) {
+ break;
+ }
+
+ temp_record_num--;
+ }
+
+ // Turn the current build path into a zombie.
+
+ zombie = calloc( sizeof( QTC_ZOMBIE ) + ( build->build_path_len * sizeof(CHAR) ), 1 );
+
+ if ( zombie == NULL ) {
+ build->state = QTC_ERROR_STATE;
+ build->error = QTC_NO_MEMORY;
+ free( buffer );
+ free( item_path );
+ free( item_buffer );
+ free( xtra_bytes );
+ return( FAILURE );
+ }
+
+ byte_ptr = (BYTE_PTR)zombie;
+ byte_ptr += sizeof( QTC_ZOMBIE );
+ zombie->name = (CHAR_PTR)byte_ptr;
+ zombie->name_size = build->build_path_len * sizeof (CHAR);
+ memcpy( zombie->name,
+ build->curr_build_path,
+ build->build_path_len * sizeof (CHAR) );
+
+
+ // Now change the current build path to remove the last directory.
+
+ if ( temp_record_num ) {
+
+ if ( QTC_BuildNewPath( build, temp_record.name_offset ) ) {
+ free( buffer );
+ free( item_path );
+ free( item_buffer );
+ free( xtra_bytes );
+ return( FAILURE );
+ }
+ }
+ else {
+ build->curr_build_path[ 0 ] = TEXT( '\0' );
+ build->build_path_len = 1; // character count, not byte count
+ }
+ }
+ else {
+
+ zombie = calloc( sizeof( QTC_ZOMBIE ) + ( strsize( filename ) * sizeof(CHAR) ) + xtra_byte_size, 1 );
+
+ if ( zombie == NULL ) {
+ build->state = QTC_ERROR_STATE;
+ build->error = QTC_NO_MEMORY;
+ free( buffer );
+ free( item_path );
+ free( item_buffer );
+ free( xtra_bytes );
+ return( FAILURE );
+ }
+
+ byte_ptr = (BYTE_PTR)zombie;
+ byte_ptr += sizeof( QTC_ZOMBIE );
+ zombie->name = (CHAR_PTR)byte_ptr;
+ zombie->name_size = strsize ( filename );
+ strcpy( zombie->name, filename );
+ zombie->xtra_bytes = (INT8_PTR)zombie->name + zombie->name_size;
+ zombie->xtra_byte_size = xtra_byte_size;
+ if ( zombie->xtra_byte_size ) {
+ memcpy( zombie->xtra_bytes, xtra_bytes, xtra_byte_size );
+ }
+ }
+
+ zombie->q_elem.q_ptr = zombie;
+ zombie->status = record.status;
+ zombie->attribute = record.attribute;
+ zombie->date = (INT16)record.date;
+ zombie->time = (INT16)record.time;
+ zombie->lba = record.lba;
+ zombie->common.size = record.common.size;
+
+ if ( QueueCount( zombie_list ) ) {
+ InsertElem( zombie_list, curr_elem, &(zombie->q_elem), BEFORE );
+ }
+ else {
+ EnQueueElem( zombie_list, &(zombie->q_elem), FALSE );
+ }
+
+ curr_elem = &(zombie->q_elem);
+
+ // and shorten offsets and sizes
+
+ if ( record.status & QTC_FILE ) {
+ build->curr_fil_off -= name_ptr->size;
+ }
+ else {
+ build->curr_dir_off -= name_ptr->size;
+ }
+
+ build->curr_rec_off -= sizeof( QTC_RECORD );
+ build->record_cnt--;
+
+ }
+ }
+
+ free( buffer );
+ free( item_path );
+ free( item_buffer );
+ free( xtra_bytes );
+ return( SUCCESS );
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static INT QTC_ZombieMatch(
+QTC_BUILD_PTR build,
+QTC_RECORD_PTR record,
+QTC_NAME_PTR name,
+CHAR_PTR item,
+CHAR_PTR item_path,
+INT item_size )
+{
+ BYTE_PTR byte_ptr;
+ CHAR_PTR filename;
+
+ byte_ptr = (BYTE_PTR)name;
+ byte_ptr += sizeof( QTC_NAME );
+ filename = (CHAR_PTR)byte_ptr;
+
+ // Is the path the right one ?
+
+ if ( ( (UINT)item_size == (UINT)( build->build_path_len * sizeof(CHAR) ) &&
+ ( ! memicmp( build->curr_build_path, item_path, item_size ) ) ) ) {
+
+ // Was there a file, and is this it ?
+
+ if ( ( record->status & QTC_FILE ) &&
+ ( item != NULL ) ) {
+
+ if ( ! stricmp( filename, item ) ) {
+ return( SUCCESS );
+ }
+ }
+
+ // Was it a directory that crossed and is this it ?
+
+ if ( ( record->status & QTC_DIRECTORY ) &&
+ ( item == NULL ) ) {
+
+ return( SUCCESS );
+ }
+ }
+
+ return( FAILURE );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_GetLastRecordEntered(
+QTC_BUILD_PTR build,
+QTC_RECORD_PTR record,
+BYTE_PTR buffer,
+BYTE_PTR xtra_bytes,
+INT * xtra_byte_size )
+{
+ QTC_NAME_PTR name;
+ CHAR_PTR char_ptr;
+ INT ret;
+ INT Error;
+
+ name = (QTC_NAME_PTR)buffer;
+
+ // Always leave the root, record #1 present
+
+ if ( build->record_cnt < 2 ) {
+ return( FAILURE );
+ }
+
+ QTC_SeekFile( build->fh_rec, (build->record_cnt - 1) * sizeof( QTC_RECORD ) );
+
+ ret = QTC_ReadFile( build->fh_rec, (BYTE_PTR)record, sizeof( QTC_RECORD ), &Error );
+
+ if ( ret != sizeof( QTC_RECORD ) ) {
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ return( FAILURE );
+ }
+
+ if ( record->status & QTC_FILE ) {
+ QTC_SeekFile( build->fh_fil, record->name_offset );
+ ret = QTC_ReadFile( build->fh_fil, buffer, QTC_BUF_SIZE, &Error );
+ }
+ else {
+ QTC_SeekFile( build->fh_dir, record->name_offset );
+ ret = QTC_ReadFile( build->fh_dir, buffer, QTC_BUF_SIZE, &Error );
+ }
+
+ if ( ret < sizeof( QTC_NAME ) ) {
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ return( FAILURE );
+ }
+
+ if ( ret < (INT)name->size ) {
+ build->error = QTC_READ_FAILED;
+ build->state = QTC_ERROR_STATE;
+ return( FAILURE );
+ }
+
+ *xtra_byte_size = (INT)name->xtra_size;
+
+ if ( name->xtra_size ) {
+
+ memcpy( xtra_bytes,
+ &buffer[ name->size - (INT)name->xtra_size ],
+ (INT)name->xtra_size );
+ }
+
+ // null terminate string
+ char_ptr = (CHAR_PTR)&buffer[ name->size - name->xtra_size ];
+ *char_ptr = TEXT( '\0' );
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_RestartBackup(
+QTC_BUILD_PTR build,
+QTC_HEADER_PTR old_header,
+Q_HEADER_PTR zombie_list )
+{
+ QTC_ZOMBIE_PTR zombie;
+ QTC_HEADER_PTR header;
+ QTC_HEADER_PTR temp_header;
+ QTC_BSET_PTR bset;
+ Q_ELEM_PTR q_elem;
+ INT i;
+
+ // Get tape data from vcb
+
+ header = calloc( (INT)old_header->header_size, 1 );
+
+ if ( header == NULL ) {
+ build->state = QTC_ERROR_STATE;
+ build->error = QTC_NO_MEMORY;
+ return( FAILURE );
+ }
+
+ memcpy( header, old_header, (INT)old_header->header_size );
+
+ // Adjust all the string pointers to point to this
+ // headers strings, rather than the old_headers memory
+ // locations.
+
+ QTC_SetUpStrings( header );
+
+ header->tape_seq_num = (UINT16)(old_header->tape_seq_num + 1);
+
+ msassert( header->tape_seq_num != 0 );
+
+ // init other stuff for this header
+
+ header->LBA = 0; //
+ header->PBA_VCB = 1; //
+
+ header->FDD_SeqNum = 0; // Tape FDD starts on
+ header->FDD_PBA = 0; // PBA of FDD info for set
+
+
+ // With maynstream 3.1 formats when we crossed EOM we faked the
+ // crossing VCB because we knew the numbers for it. We don't know
+ // them with MTF 1.0
+
+ // With MTF 1.0, a problem has developed here. The cont vcb is loaded
+ // correctly from the set list. It has the correct PBA for the VCB,
+ // usually a number greater than or equal to 4. But almost never 1.
+
+ // When we fully catalog the crossing set we generate an End-of-media
+ // call the attempts to duplicate the vcb from tape 1. By doing this
+ // we lose the good numbers we had from the set list catalog. This
+ // attempts to preserve any good numbers we already had. mikep
+
+ bset = QTC_FindBset( header->tape_fid,
+ (INT16)header->tape_seq_num,
+ (INT16)header->bset_num );
+
+
+ if ( bset != NULL ) {
+
+
+ temp_header = QTC_LoadHeader( bset ) ;
+
+
+ if ( temp_header != NULL ) {
+
+ header->LBA = temp_header->LBA;
+ header->PBA_VCB = temp_header->PBA_VCB;
+
+ header->FDD_SeqNum = temp_header->FDD_SeqNum;
+ header->FDD_PBA = temp_header->FDD_PBA;
+
+ free( temp_header );
+ }
+
+ }
+
+
+ // clear data offsets and sizes
+
+ header->dir_start = 0;
+ header->fil_start = 0;
+ header->rec_start = 0;
+
+ header->dir_size = 0;
+ header->fil_size = 0;
+ header->rec_size = 0;
+
+ // Clear all other status bits
+
+ header->status = QTC_CONTINUATION;
+
+ if ( gb_QTC.unicode ) {
+ header->status |= QTC_UNICODE;
+ }
+
+ // stats
+
+ header->num_dirs = 0;
+ header->num_files = 0;
+ header->num_bytes = 0;
+ header->num_bytes_msw = 0;
+ header->num_corrupt_files = 0;
+ header->num_files_in_use = 0;
+
+ if ( QTC_OpenTempFiles( build ) != SUCCESS ) {
+
+ free( header );
+ return( FAILURE );
+ }
+
+ build->header = header;
+
+ build->curr_fil_off = 0;
+ build->curr_dir_off = 0;
+ build->curr_rec_off = 0;
+
+ build->record_cnt = 0;
+
+ // Add old build path to catalog here
+
+ build->current_level = 0;
+
+ if ( build->do_full_cataloging ) {
+
+ // Send out root directory
+
+ build->record.status = QTC_DIRECTORY | QTC_CONTINUATION;
+ build->record.attribute = 0;
+ build->record.date = 0;
+ build->record.time = 0;
+ build->record.lba = 1;
+ build->record.name_offset = build->curr_dir_off +
+ build->dir_offset;
+
+ build->record.common.common.file_start = 0;
+ build->record.common.common.height = 0;
+
+ QTC_SaveDirRecord( build, TEXT(""),
+ 0,
+ build->record_cnt++, NULL, 0 );
+
+ i = 0;
+
+ while ( ( i < build->build_path_len ) &&
+ ( build->build_path_len != 1 ) ) {
+
+ build->record.status = QTC_DIRECTORY | QTC_CONTINUATION;
+ build->record.attribute = 0;
+ build->record.date = 0;
+ build->record.time = 0;
+ build->record.lba = 0;
+ build->record.name_offset = build->curr_dir_off +
+ build->dir_offset;
+
+ build->record.common.common.file_start = 0;
+ build->record.common.common.height = build->current_level + 1;
+
+ QTC_SaveDirRecord( build,
+ &build->curr_build_path[ i ],
+ ++build->current_level,
+ build->record_cnt++,
+ NULL, 0 );
+
+ while ( build->curr_build_path[i] ) i++;
+ i++;
+ }
+
+ /*************************************
+
+ Send out zombie list here.
+
+ ***********************************/
+
+ i = 0;
+
+ q_elem = QueueHead( zombie_list );
+
+ while ( q_elem != NULL ) {
+
+ RemoveQueueElem( zombie_list, q_elem );
+
+ zombie = (QTC_ZOMBIE_PTR)q_elem->q_ptr;
+
+ if ( ! i++ ) {
+ zombie->status |= QTC_CONTINUATION;
+ }
+
+ if ( zombie->status & QTC_FILE ) {
+ build->record.status = zombie->status;
+ build->record.date = zombie->date;
+ build->record.time = zombie->time;
+ build->record.common.size = zombie->common.size;
+ build->record.attribute = zombie->attribute;
+ build->record.lba = zombie->lba;
+ QTC_AddFile( build, zombie->name,
+ zombie->xtra_bytes, zombie->xtra_byte_size );
+ }
+ else {
+ build->record.status = zombie->status;
+ build->record.date = zombie->date;
+ build->record.time = zombie->time;
+ build->record.attribute = zombie->attribute;
+ build->record.lba = zombie->lba;
+ build->record.common.common.file_start = zombie->common.common.file_start;
+ build->record.common.common.height = zombie->common.common.height;
+ QTC_AddDir( build,
+ zombie->name, zombie->name_size / sizeof(CHAR),
+ zombie->xtra_bytes, zombie->xtra_byte_size );
+ }
+
+ free( zombie );
+ q_elem = QueueHead( zombie_list );
+ }
+ }
+ else {
+
+ // We are partially cataoging.
+
+ build->header->status |= QTC_PARTIAL;
+ }
+
+ if ( ! build->error ) {
+ build->state = QTC_ACTIVE_STATE;
+ }
+
+ return( SUCCESS );
+}
diff --git a/private/utils/ntbackup/src/qtc_init.c b/private/utils/ntbackup/src/qtc_init.c
new file mode 100644
index 000000000..f6ba5d536
--- /dev/null
+++ b/private/utils/ntbackup/src/qtc_init.c
@@ -0,0 +1,660 @@
+
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: QTC_INIT.C
+
+ Description:
+
+ A lot of utility functions for the catalogs.
+
+ $Log: N:\LOGFILES\QTC_INIT.C_V $
+
+ Rev 1.23 07 Dec 1993 16:35:54 MikeP
+Remove redundant call to free
+
+ Rev 1.22 06 Dec 1993 09:46:42 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.21 03 Nov 1993 09:11:06 MIKEP
+warning fixes
+
+ Rev 1.20 28 Oct 1993 14:50:18 MIKEP
+dll changes
+
+ Rev 1.19 20 Sep 1993 10:27:04 unknown
+Started saving (and then using a virtual pointer to our temp_bset instead
+of allocating additional memory for it.
+
+ Rev 1.18 16 Sep 1993 17:48:38 Stefan
+Free temp_bset after we're done with it
+
+ Rev 1.17 14 Sep 1993 09:48:28 Stefan
+Added a temporary bset variable in QTC_LoadBsetInfo to keep some P_CLIENT
+code from using an uninitialized variable (and potentially freed variable)
+if there were no valid backup sets in a tape catalog.
+
+ Rev 1.16 26 Jun 1993 15:14:22 ChuckS
+803EPR0307 Got rid of stupid msassert in QTC_Init. We're checking for NULL
+ data_path on next line and returning an error anyway, so why bother
+ asserting? Also changed error to QTC_OPEN_FAILED.
+
+ Rev 1.15 15 Jun 1993 11:21:50 ChuckS
+P_CLIENT || OS_NLM only: Added test of QTC_TAPE_DELETED bit of status
+for first set of tape. If set, tape is not loaded.
+
+P_CLIENT: added test for !error before going on with file stat. If
+error is QTC_TAPE_TAGGED_DELETED, we don't care what filedate the file
+has. We don't have a QTC_TAPE pointer to store the stat info in anyway.
+
+
+ Rev 1.14 19 May 1993 16:18:22 ChuckS
+If P_CLIENT or OS_NLM, free gb_QTC.cat_user in QTC_Deinit, if allocated.
+If P_CLIENT, need to load bset strings during QTC_LoadBsetInfo. If not
+supervisor and cat_user is set, need the user_name to restrict the view
+of the catalogs.
+
+ Rev 1.13 13 May 1993 13:18:02 ChuckS
+Changes for revamped QTC usage of virtual memory. Changed queue calls to
+corresponding vm- queue calls.
+
+ Rev 1.12 12 Apr 1993 13:17:02 DON
+Don't allow a NULL data path
+
+ Rev 1.11 05 Apr 1993 18:22:44 DON
+Needed to free the data path allocated at init
+
+ Rev 1.10 30 Jan 1993 12:06:28 DON
+Removed compiler warnings
+
+ Rev 1.9 25 Jan 1993 09:10:04 MIKEP
+add stdwcs because it seems to need it now
+
+ Rev 1.8 04 Jan 1993 09:36:22 MIKEP
+unicode changes
+
+ Rev 1.7 14 Dec 1992 12:29:06 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.6 11 Dec 1992 16:44:06 CHARLIE
+Removed literal string
+
+ Rev 1.5 25 Nov 1992 16:14:20 ChuckS
+P_CLIENT only: Code to init new v_olume and wr_time fields
+
+ Rev 1.4 20 Nov 1992 13:27:54 CHARLIE
+JAGUAR: Move to SRM based QTC code
+
+ENDEAVOR: Modified QTC_Init prototype to require VM_HDL vm_hdl passed by the
+front end calling routine. Passing NULL indicates virtual memory will not
+be used (by design or consequence)
+
+ENDEAVOR: Integrated virtual memory usage in anticipation of DOS. These
+changes should be transparent to non DOS products.
+
+ Rev 1.3 06 Nov 1992 15:30:10 DON
+Change debug.h to be_debug.h and zprintf to BE_Zprintf
+
+ Rev 1.2 15 Oct 1992 10:21:42 MIKEP
+fix delete catalogs option
+
+ Rev 1.1 09 Oct 1992 11:53:54 MIKEP
+unicode pass
+
+ Rev 1.0 03 Sep 1992 16:56:04 STEVEN
+Initial revision.
+
+****************************************************/
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+#include <sys\types.h>
+#include <sys\stat.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdwcs.h"
+#include "msassert.h"
+#include "qtc.h"
+
+// global data
+
+VM_HDL qtc_vmem_hand;
+VM_PTR v_bset_item;
+VM_PTR v_tape_item;
+
+// unicode text macro
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+
+/**********************
+
+ NAME : QTC_Deinit
+
+ DESCRIPTION :
+
+ The application is terminating, so free everything.
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_Deinit( INT delete_catalogs )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+
+
+ // Yank the temporary disk scan file, if it exists
+
+ QTC_RemoveTape( 0L, (INT16) 1 ) ;
+
+ // Yank all known files for microsoft
+ if ( delete_catalogs ) {
+ QTC_PurgeAllFiles();
+ }
+
+ // Free all our queues
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+
+ bset = QTC_GetFirstBset( tape ) ;
+
+ while ( bset != NULL ) {
+ msassert( bset->q_elem.q_ptr == v_bset_item ) ;
+
+ vmRemoveQueueElem( &( tape->bset_list ), v_bset_item ) ;
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item ) ;
+ VM_Free( qtc_vmem_hand, v_bset_item ) ;
+ v_bset_item = (VM_PTR) NULL ;
+
+ bset = QTC_GetFirstBset( tape ) ;
+ }
+
+ msassert( tape->q_elem.q_ptr == v_tape_item ) ;
+
+ vmRemoveQueueElem( &(gb_QTC.tape_list), v_tape_item ) ;
+ VM_MemUnLock( qtc_vmem_hand, v_tape_item ) ;
+ VM_Free( qtc_vmem_hand, v_tape_item ) ;
+ v_tape_item = (VM_PTR) NULL ;
+
+ tape = QTC_GetFirstTape( ) ;
+ }
+
+ // Free the data path allocated at init
+
+ if ( gb_QTC.data_path != NULL ) {
+ free( gb_QTC.data_path );
+ }
+
+#if defined( P_CLIENT ) || defined( OS_NLM )
+
+ if ( gb_QTC.cat_user ) {
+ free( gb_QTC.cat_user ) ;
+ gb_QTC.cat_user = NULL ;
+ }
+
+#endif
+}
+
+
+
+/**********************
+
+ NAME : QTC_PurgeAllFiles
+
+ DESCRIPTION :
+
+ Used by the microsoft version of NT to delete all catalog files when
+ the user exits.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_PurgeAllFiles( )
+{
+ QTC_TAPE_PTR tape;
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape ) {
+ QTC_RemoveTape( tape->tape_fid, tape->tape_seq_num ) ;
+ tape = QTC_GetFirstTape( );
+ }
+
+ return( 0 );
+}
+
+
+
+/**********************
+
+ NAME : QTC_Init
+
+ DESCRIPTION :
+
+ Init the catalogs, called ONCE at start up time.
+ Tries to read existing catalogs, if it fails it creates new ones.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_Init(
+CHAR_PTR data_path,
+VM_HDL vm_hdl )
+{
+
+ // Are we returning ASCII or UNICODE results.
+
+#ifdef UNICODE
+ gb_QTC.unicode = TRUE;
+#else
+ gb_QTC.unicode = FALSE;
+#endif
+
+ // Set virtual memory handle as passed from the UI
+
+ qtc_vmem_hand = vm_hdl ;
+
+ vmSetVMHandle( vm_hdl ) ;
+
+ // Don't allow passing of a NULL data path
+ if ( data_path == NULL ) {
+ return( QTC_OPEN_FAILED ) ;
+ }
+
+ gb_QTC.data_path = malloc( strsize ( data_path ) );
+
+ if ( gb_QTC.data_path == NULL ) {
+
+ return( QTC_NO_MEMORY );
+ }
+
+ strcpy( gb_QTC.data_path, data_path );
+
+ // Delete the disk scan temporary file if present
+
+ QTC_UnlinkFile( 0L, (INT16) 1 );
+
+ vmInitQueue( &(gb_QTC.tape_list) ) ;
+
+ // Mark that we were successfully inited.
+
+ gb_QTC.inited = QTC_MAGIC_NUMBER;
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME : QTC_GetFIDFromName
+
+ DESCRIPTION :
+
+ We need to make sure the stupid user did not rename the catalog file.
+ So we check to make sure the tape fid of the sets match the file name.
+ This function works because we are garanteed that the name is
+ "xxxxxxxx.yyy"
+
+ RETURNS :
+
+**********************/
+
+INT QTC_GetDataFromName( CHAR_PTR name, UINT32_PTR fid, UINT16_PTR seq )
+{
+ CHAR_PTR s;
+ INT i;
+ INT16 value;
+
+ *fid = 0;
+ *seq = 0;
+
+ i = strlen( name );
+ i -= 12;
+
+ s = &name[ i ];
+
+ for ( i = 0; i < 8; i++ ) {
+
+ if ( *s >= TEXT('0') && *s <= TEXT('9') ) {
+ value = ( *s - TEXT('0') );
+ }
+ else {
+ value = 10 + ( toupper( *s ) - TEXT('A') );
+ }
+
+ s++;
+
+ *fid *= 16;
+ *fid += value;
+ }
+
+ i = strlen( name );
+ i -= 2;
+
+ s = &name[ i ];
+
+ for ( i = 0; i < 2; i++ ) {
+
+ if ( *s >= TEXT('0') && *s <= TEXT('9') ) {
+ value = ( *s - TEXT('0') );
+ }
+
+ s++;
+
+ *seq *= 10;
+ *seq += value;
+ }
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME : QTC_LoadBsetInfo
+
+ DESCRIPTION :
+
+ Reads in all the bset headers from a catalog file and builds a queue.
+
+ Uses either the file name passed in or the tape, set the other to NULL.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_LoadBsetInfo( CHAR_PTR name, QTC_TAPE_PTR tape )
+{
+ INT fd;
+ LONG ret;
+ UINT32 next_header = sizeof( QTC_TAPE_HEADER );
+ QTC_TAPE_HEADER tape_header;
+ QTC_HEADER header;
+ QTC_BSET_PTR bset;
+ UINT32 fid;
+ UINT16 seq;
+ INT error = SUCCESS;
+ INT Error;
+ CHAR *name_buffer;
+
+#if defined( P_CLIENT )
+ VQ_HDL v_temp_bset = (VQ_HDL)NULL ;
+#endif
+
+ if ( gb_QTC.inited != QTC_MAGIC_NUMBER ) {
+ return( QTC_NO_INIT );
+ }
+
+ // open file, share it with everyone
+
+ if ( name != NULL ) {
+ name_buffer = (CHAR *)malloc( ( strsize( gb_QTC.data_path ) + strsize( name ) ) * sizeof(CHAR ) );
+ if ( name_buffer == NULL ) {
+ return( QTC_NO_INIT );
+ }
+ strcpy( name_buffer, gb_QTC.data_path );
+ strcat( name_buffer, name );
+ }
+
+ if ( ( tape != NULL ) && ( name == NULL ) ) {
+ QTC_GetFileName( tape->tape_fid, tape->tape_seq_num, name_buffer );
+ }
+ else {
+ //first lets make sure this is a valid name
+ if ( (strlen( name ) != 12) ||
+ (name[10] < '0') ||
+ ((name[10] > '9' ) && (name[10] < 'A') ) ||
+ ((name[10] > 'F' ) && (name[10] < 'a') ) ||
+ (name[10] > 'f' ) ||
+ (name[11] < '0') ||
+ ((name[11] > '9' ) && (name[11] < 'A') ) ||
+ ((name[11] > 'F' ) && (name[11] < 'a') ) ||
+ (name[11] > 'f' ) ) {
+
+ return( QTC_OPEN_FAILED );
+ }
+
+ QTC_GetDataFromName( name, &fid, &seq );
+ }
+
+ fd = QTC_OpenFile( fid, seq, FALSE, FALSE );
+
+ if ( fd < 0 ) {
+ return( QTC_OPEN_FAILED );
+ }
+
+ // read header
+
+ ret = QTC_ReadFile( fd, (BYTE_PTR)&tape_header, sizeof( QTC_TAPE_HEADER ), &Error );
+
+ if ( ret != sizeof( QTC_TAPE_HEADER ) ) {
+ QTC_CloseFile( fd );
+ return( QTC_INVALID_FILE );
+ }
+
+ if ( memcmp( tape_header.signature, QTC_SIGNATURE, sizeof( QTC_SIGNATURE ) ) ||
+ ( tape_header.major_version != QTC_MAJOR_VERSION ) ) {
+
+ QTC_CloseFile( fd );
+ return( QTC_INVALID_FILE );
+ }
+
+ QTC_GetDataFromName( name_buffer, &fid, &seq );
+
+ free( name_buffer );
+
+ while ( ( next_header != 0L ) && ( error == SUCCESS ) ) {
+
+ // skip to first bset
+
+ ret = QTC_SeekFile( fd, next_header );
+
+ // read temp bset info to get size
+
+ ret = QTC_ReadFile( fd, (BYTE_PTR)&header, sizeof( QTC_HEADER ), &Error );
+
+ if ( ret != sizeof( QTC_HEADER ) ) {
+ QTC_CloseFile( fd );
+ return( QTC_READ_FAILED );
+ }
+
+ if ( ( header.tape_fid != fid ) ||
+ ( header.tape_seq_num != (INT32)seq ) ) {
+
+ // User renamed file or it is corrupt.
+ QTC_CloseFile( fd );
+ return( QTC_INVALID_FILE );
+ }
+
+
+#if defined( P_CLIENT ) || defined( OS_NLM )
+
+ if ( header.status & QTC_TAPE_DELETED ) {
+ error = QTC_TAPE_TAGGED_DELETED ;
+ break ;
+ }
+
+#endif
+
+ if ( ! ( header.status & QTC_ERASED ) ) {
+
+#if defined( P_CLIENT )
+ QTC_HEADER_PTR vlen_header ;
+ INT rbytes ;
+
+ // P_CLIENT needs to filter user view of catalogs based on who
+ // the user is.
+ //
+ if ( !( vlen_header = malloc( (size_t) header.header_size ) ) ) {
+ QTC_CloseFile( fd ) ;
+ return ( QTC_NO_MEMORY ) ;
+ }
+
+ QTC_SeekFile( fd, next_header ) ;
+ rbytes = QTC_ReadFile( fd, vlen_header, (size_t) header.header_size, &Error ) ;
+
+ if ( rbytes != (INT) header.header_size ) {
+ free( vlen_header );
+ QTC_CloseFile( fd ) ;
+ return( QTC_INVALID_FILE ) ;
+ }
+
+ QTC_SetUpStrings( vlen_header ) ;
+
+ if ( gb_QTC.cat_user == NULL || !strcmpi( gb_QTC.cat_user, vlen_header->user_name ) ) {
+
+#endif
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item ) ;
+ v_bset_item = VM_Alloc( qtc_vmem_hand, sizeof( QTC_BSET ) ) ;
+ bset = VM_MemLock( qtc_vmem_hand, v_bset_item, VM_READ_WRITE ) ;
+
+ if ( bset == NULL ) {
+
+#if defined( P_CLIENT )
+ free( vlen_header );
+#endif
+
+ QTC_CloseFile( fd );
+ return( QTC_NO_MEMORY ) ;
+ }
+ vmInitQElem( &( bset->q_elem ) ) ;
+
+ QTC_SeekFile( fd, next_header );
+
+ bset->q_elem.q_ptr = v_bset_item ;
+ bset->bset_num = header.bset_num ;
+ bset->tape_seq_num = header.tape_seq_num ;
+ bset->tape_fid = header.tape_fid ;
+ bset->status = header.status ;
+
+ bset->offset = next_header ; // set where this guy actually started in file
+
+#if defined( P_CLIENT )
+ bset->v_volume = NULL ;
+ // save a virtual pointer to the backup set
+ // for later use.
+ v_temp_bset = v_bset_item ;
+#endif
+
+ error = QTC_NewBset( v_bset_item ) ;
+
+ // We are NOT entitled to use the bset pointer after QTC_NewBset
+ // returns!! Problem is, it was locked as v_bset_item above.
+ // Meanwhile, QTC_NewBset may have called QTC_GetFirstBset, etc.
+ // which unlocked v_bset_item...
+
+#if defined( P_CLIENT )
+ }
+ free( vlen_header ) ;
+#endif
+ }
+
+ // get address of next bset
+
+ next_header = header.next_bset ;
+ }
+
+
+#if defined( P_CLIENT )
+ if ( !error ) {
+ struct stat tmp_stat ;
+
+ // if 'tape' argument was NULL, find tape in the in-memory queue
+ // also check that there actually WAS a bset to compare against.
+ if ( (tape == NULL) && (v_temp_bset != (VQ_HDL)NULL) ) {
+
+
+ // lock the last temp_bset we saved.
+ bset = VM_MemLock( qtc_vmem_hand, v_temp_bset, VM_READ_WRITE ) ;
+
+ if ( bset == NULL ) {
+ QTC_CloseFile( fd );
+ return( QTC_NO_MEMORY ) ;
+ }
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+ if ( ( tape->tape_fid == bset->tape_fid ) &&
+ ( tape->tape_seq_num == (INT16)bset->tape_seq_num ) ) {
+ break;
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ VM_MemUnLock( qtc_vmem_hand, v_temp_bset ) ;
+
+ }
+
+
+ // There's a possibility that tape _is_ NULL, if this user didn't
+ // have any backups on this tape
+ if ( tape != NULL ) {
+
+ // save the file's modified date/time in the structure
+ if ( !fstat( fd, &tmp_stat ) ) {
+
+ msassert( sizeof( time_t ) == sizeof( UINT32 ) ) ;
+ tape->wr_time = (UINT32) tmp_stat.st_mtime ;
+ }
+ }
+ }
+#endif
+
+
+ QTC_CloseFile( fd );
+ return( error );
+}
+
+/**********************
+
+ NAME : QTC_DumpBsetInfo
+
+ DESCRIPTION :
+
+ Frees the bset queue for this tape from memory.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_DumpBsetInfo( QTC_TAPE_PTR tape )
+{
+ QTC_BSET_PTR bset;
+
+ if ( tape != NULL ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+ msassert( v_bset_item == bset->q_elem.q_ptr ) ;
+
+ vmRemoveQueueElem( &(tape->bset_list), v_bset_item ) ;
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item ) ;
+ VM_Free( qtc_vmem_hand, v_bset_item ) ;
+ v_bset_item = (VM_PTR) NULL ;
+
+ bset = QTC_GetFirstBset( tape ) ;
+ }
+ }
+
+ return( SUCCESS );
+}
diff --git a/private/utils/ntbackup/src/qtc_srch.c b/private/utils/ntbackup/src/qtc_srch.c
new file mode 100644
index 000000000..6accc9945
--- /dev/null
+++ b/private/utils/ntbackup/src/qtc_srch.c
@@ -0,0 +1,3034 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: QTC_SRCH.C
+
+ Description:
+
+ A lot of searching functions for the catalogs.
+
+ $Log: N:\logfiles\qtc_srch.c_v $
+
+ Rev 1.31.1.0 20 Jul 1994 19:36:38 STEVEN
+now search next tape as well
+
+ Rev 1.31 18 Feb 1994 17:01:52 MIKEP
+one more unicode typo
+
+ Rev 1.30 15 Feb 1994 11:15:24 MIKEP
+fix unicode catalog search stuff
+
+ Rev 1.29 24 Jan 1994 09:36:04 MIKEP
+fix yet another unicode bug
+
+ Rev 1.28 07 Jan 1994 14:23:22 mikep
+fixes for unicode
+
+ Rev 1.27 11 Dec 1993 11:49:12 MikeP
+fix warnings from unicode compile
+
+ Rev 1.26 06 Dec 1993 09:46:26 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.25 28 Oct 1993 14:47:40 MIKEP
+dll changes
+
+ Rev 1.24 20 Jul 1993 20:18:06 MIKEP
+fix unicode bug for steve.
+
+ Rev 1.23 16 Jul 1993 11:45:46 MIKEP
+Fix bug if searching for files & not searching subdirectories &
+crossing tapes all at the same time. It would return files that
+were in child subdirectories, when it shouldn't.
+
+ Rev 1.22 22 Jun 1993 14:35:12 DON
+Needed to check if there was an error before checking for QTC_NO_MORE in SearchFirstItem
+
+ Rev 1.21 08 Jun 1993 19:05:32 DON
+If we are calling QTC_SearchFirstItem and then searching for more matches
+withing the same BSD, as is the case when restoring multiple Single
+File Selections, ERROR will be set to QTC_NO_MORE and when we call
+QTC_SearchFirstItem again to find the next file, ERROR has not be cleared!
+So...If ERROR is QTC_NO_MORE just reset error and continue else FAILURE.
+
+ Rev 1.20 11 May 1993 08:55:24 MIKEP
+Enable unicode to compile.
+
+ Rev 1.19 30 Apr 1993 08:36:24 MIKEP
+Fix search if the user is searching the root and does not wish
+to search subdirectories. It was broken and would search
+everything in the set if the path was the root.
+
+ Rev 1.18 23 Mar 1993 18:00:34 ChuckS
+Added arg to QTC_OpenFile indicating if need to open for writes
+
+ Rev 1.17 04 Mar 1993 17:28:54 ANDY
+Added bug-fix for MIKEP
+
+ Rev 1.16 18 Feb 1993 09:02:10 DON
+Cleaned up compiler warnings
+
+ Rev 1.15 09 Feb 1993 17:26:46 STEVEN
+checkin for mikep
+
+ Rev 1.14 26 Jan 1993 12:28:04 ANDY
+if OS_NLM, don't want alloc_text pragma's either!
+
+ Rev 1.13 25 Jan 1993 09:09:00 MIKEP
+fix duplicate \system directory bug
+
+ Rev 1.12 21 Jan 1993 16:20:58 MIKEP
+fix undisplayed directories with duplicate parents
+
+ Rev 1.11 20 Jan 1993 19:47:16 MIKEP
+fix nt warnings
+
+ Rev 1.10 04 Jan 1993 09:34:36 MIKEP
+unicode changes
+
+ Rev 1.8 22 Dec 1992 12:02:12 DAVEV
+fix for loop problem indexing past end of unicode string
+
+ Rev 1.7 14 Dec 1992 12:29:24 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.6 20 Nov 1992 13:50:38 CHARLIE
+JAGUAR: Move to SRM based QTC code
+
+ENDEAVOR: Virtualized QTC_SRCH into multiple sections in anticipation of DOS.
+
+ Rev 1.5 15 Nov 1992 16:05:18 MIKEP
+fix warnings and change wcs.h to stdwcs.h
+
+ Rev 1.4 06 Nov 1992 15:29:58 DON
+Change debug.h to be_debug.h and zprintf to BE_Zprintf
+
+ Rev 1.3 05 Nov 1992 08:55:20 STEVEN
+fix typo
+
+ Rev 1.2 29 Oct 1992 14:41:28 MIKEP
+fix duplicate directory detection
+
+ Rev 1.1 09 Oct 1992 11:53:56 MIKEP
+unicode pass
+
+ Rev 1.0 03 Sep 1992 16:56:06 STEVEN
+Initial revision.
+
+
+****************************************************/
+
+//
+// A query structure may be used for 1 set of GetFirst/GetNext commands
+// at a time. You may not use the same query structure to go through
+// the directory tree and get all the files in those directories.
+// But you can use as many different query structures as you wish,
+// at the same time, intermingling the calls. You may reuse a query
+// structure.
+//
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdwcs.h"
+#include "qtc.h"
+
+#if !defined( OS_WIN32 ) && !defined( OS_NLM )
+#pragma alloc_text( QTC_SRCH_SEG1, QTC_SearchFirstItem )
+#pragma alloc_text( QTC_SRCH_SEG2, QTC_SearchNextItem )
+#pragma alloc_text( QTC_SRCH_SEG3, QTC_FastSearchForFile )
+#pragma alloc_text( QTC_SRCH_SEG4, QTC_FastSearchForDir )
+#pragma alloc_text( QTC_SRCH_SEG5, QTC_GetNextItem )
+#pragma alloc_text( QTC_SRCH_SEG6, QTC_FindStoppingOffset )
+#endif
+
+// unicode text macro
+#ifndef UNALIGNED
+#define UNALIGNED
+#endif
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+// defines for data buffering scheme
+
+#define BUFF_DIR 0
+#define BUFF_FILE 1
+#define BUFF_CHILD_DIR 2
+
+
+static INT QTC_FindDirectoryPath( QTC_QUERY_PTR, QTC_RECORD_PTR, UINT32, INT );
+
+
+QTC_BSET_PTR QTC_GetBsetForSrch( QTC_QUERY_PTR qtc )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ QTC_BSET_PTR temp_bset;
+
+ // Now find a bset that matches it
+
+ tape = QTC_GetFirstTape( );
+
+ temp_bset = NULL;
+ bset = NULL;
+
+ while ( tape != NULL ) {
+
+ if ( ( tape->tape_fid == qtc->tape_fid ) &&
+ ( tape->tape_seq_num == qtc->tape_seq_num ) ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == qtc->bset_num ) {
+
+ if ( ! ( bset->status & ( QTC_PARTIAL | QTC_IMAGE ) ) ) {
+ break;
+ }
+ }
+ bset = QTC_GetNextBset( bset );
+ }
+ break;
+ }
+ else {
+
+ if ( ( tape->tape_fid == qtc->tape_fid ) &&
+ ( qtc->tape_seq_num == -1 ) ) {
+
+ temp_bset = QTC_GetFirstBset( tape );
+
+ while ( temp_bset != NULL ) {
+
+ if ( temp_bset->bset_num == qtc->bset_num ) {
+
+ if ( ! ( temp_bset->status & ( QTC_PARTIAL | QTC_IMAGE ) ) ) {
+
+ if ( bset == NULL ) {
+ bset = temp_bset;
+ }
+
+ if ( bset->tape_seq_num > temp_bset->tape_seq_num ) {
+
+ bset = temp_bset;
+ }
+ }
+ }
+ temp_bset = QTC_GetNextBset( temp_bset );
+ }
+ }
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( bset );
+}
+
+
+
+INT QTC_SetFileCounts( QTC_QUERY_PTR qtc )
+{
+ INT index;
+ UINT32 files = 0;
+ UINT32 bytes_msw = 0;
+ UINT32 bytes_lsw = 0;
+ UINT32 UNALIGNED *i32;
+
+ index = 0;
+
+ while ( index < qtc->xtra_size ) {
+
+ if ( qtc->xtra_bytes[ index ] == QTC_COMBO_COUNT ) {
+
+ i32 = (UINT32 *)&qtc->xtra_bytes[ index + 1 ];
+ files = *i32 >> 24;
+ bytes_lsw = *i32 & 0x00FFFFFFL;
+
+ }
+ if ( qtc->xtra_bytes[ index ] == QTC_FILE_COUNT ) {
+
+ i32 = (UINT32 *)&qtc->xtra_bytes[ index + 1 ];
+ files = *i32;
+ }
+ if ( qtc->xtra_bytes[ index ] == QTC_BYTE_COUNT_LSW ) {
+
+ i32 = (UINT32 *)&qtc->xtra_bytes[ index + 1 ];
+ bytes_lsw = *i32;
+ }
+ if ( qtc->xtra_bytes[ index ] == QTC_BYTE_COUNT_MSW ) {
+
+ i32 = (UINT32 *)&qtc->xtra_bytes[ index + 1 ];
+ bytes_msw = *i32;
+ }
+ index += 5;
+ }
+
+ qtc->file_count = (INT)files;
+ qtc->byte_count = U64_Init( bytes_lsw, bytes_msw );
+
+ return( SUCCESS );
+}
+
+INT QTC_TestItemSize( QTC_QUERY_PTR qtc, INT bytes )
+{
+ CHAR_PTR item;
+
+ bytes += 4; // in case they ask for 0
+
+ if ( qtc->size_of_item < bytes ) {
+ item = malloc( bytes );
+ memcpy( item, qtc->item, qtc->size_of_item );
+ free( qtc->item );
+ qtc->item = item;
+ qtc->size_of_item = bytes;
+ }
+
+ return( SUCCESS );
+}
+
+INT QTC_TestPathSize( QTC_QUERY_PTR qtc, INT bytes )
+{
+ CHAR_PTR path;
+
+ bytes += 4;
+
+ if ( qtc->size_of_path < bytes ) {
+ path = malloc( bytes );
+ memcpy( path, qtc->path, qtc->size_of_path );
+ free( qtc->path );
+ qtc->path = path;
+ qtc->size_of_path = bytes;
+ }
+
+ return( SUCCESS );
+}
+
+INT QTC_TestLastPathSize( QTC_QUERY_PTR qtc, INT bytes )
+{
+ CHAR_PTR path;
+
+ bytes += 4;
+
+ if ( qtc->size_of_last_path < bytes ) {
+ path = malloc( bytes );
+ memcpy( path, qtc->last_path, qtc->size_of_last_path );
+ free( qtc->last_path );
+ qtc->last_path = path;
+ qtc->size_of_last_path = bytes;
+ }
+
+ return( SUCCESS );
+}
+
+/***************
+ Get the path to search for in the query structure provided.
+****************/
+
+INT QTC_GetSearchPath( QTC_QUERY_PTR qtc, CHAR_PTR path )
+{
+ if ( qtc == NULL ) {
+ return( QTC_FAILURE );
+ }
+
+ memcpy( path, qtc->search_path, qtc->search_path_size );
+
+ return( QTC_SUCCESS );
+}
+
+/***************
+ Get the path to search for in the query structure provided.
+****************/
+
+INT QTC_GetSearchPathLength( QTC_QUERY_PTR qtc )
+{
+ if ( qtc == NULL ) {
+ return( 0 );
+ }
+
+ return( qtc->search_path_size );
+}
+
+
+/***************
+ Set the path to search for in the query structure provided.
+****************/
+
+INT QTC_SetSearchPath( QTC_QUERY_PTR qtc, CHAR_PTR path, INT size )
+{
+ free( qtc->search_path );
+
+ qtc->search_path = malloc( size );
+ qtc->search_path_size = size;
+
+ if ( qtc->search_path == NULL ) {
+ qtc->error = TRUE;
+ return( FAILURE );
+ }
+
+ memcpy( qtc->search_path, path, size );
+
+ return( QTC_SUCCESS );
+}
+
+
+/***************
+ Set the name to search for in the query structure provided.
+
+ Fills in the unicode and ascii versions for use later if needed.
+
+****************/
+
+INT QTC_SetSearchName( QTC_QUERY_PTR qtc, CHAR_PTR name )
+{
+ int length;
+
+ free( qtc->search_name );
+
+ length = strlen( name ) + 1;
+
+ qtc->search_name = malloc( length * sizeof (CHAR) );
+
+ if ( qtc->search_name == NULL ) {
+ qtc->error = TRUE;
+ return( FAILURE );
+ }
+
+ memcpy( qtc->search_name, name, length * sizeof (CHAR) );
+
+ return( SUCCESS );
+}
+
+
+/*******************
+
+ The user would like to query the catalogs and he has asked us to init
+ a query structure for him. So do it.
+
+********************/
+
+QTC_QUERY_PTR QTC_InitQuery( )
+{
+ QTC_QUERY_PTR qtc;
+
+ qtc = calloc( sizeof(QTC_QUERY), 1 );
+
+ if ( qtc != NULL ) {
+
+ qtc->search_path = NULL;
+
+ qtc->path = NULL;
+ qtc->item = NULL;
+ qtc->last_path = NULL;
+
+ qtc->size_of_path = 0;
+ qtc->size_of_item = 0;
+ qtc->size_of_last_path = 0;
+
+ qtc->header = NULL;
+ qtc->error = FALSE; // no error yet
+ qtc->file_open = FALSE; // no data file open either
+
+ QTC_TestItemSize( qtc, sizeof( CHAR ) );
+ strcpy( qtc->item, TEXT( "" ) );
+
+ QTC_SetSubdirs( qtc, TRUE );
+ QTC_SetPreDate( qtc, 0 );
+ QTC_SetPostDate( qtc, 0 );
+
+ QTC_SetSearchName( qtc, TEXT("*.*") );
+ QTC_SetSearchPath( qtc, TEXT(""), sizeof(CHAR) );
+ }
+
+
+ return( qtc );
+}
+
+/**************
+ The user is done with this query structure.
+ Terminate It.
+**************/
+
+INT QTC_CloseQuery(
+QTC_QUERY_PTR qtc ) // I - query structure to dump
+{
+
+ if ( qtc->file_open ) {
+ QTC_CloseFile( qtc->fh );
+ }
+
+ free( qtc->path );
+ free( qtc->last_path );
+ free( qtc->item );
+ free( qtc->header );
+ free( qtc->search_path );
+ free( qtc->search_name );
+ free( qtc );
+
+ return( SUCCESS );
+}
+
+
+/********************
+
+ The user has requested a search of the catalogs. The search criteria are
+ in the qtc structure. Set up our own stuff for the search and then call
+ QTC_GetNextSearchItem(), to find the first item.
+
+*********************/
+
+INT QTC_SearchFirstItem(
+QTC_QUERY_PTR qtc )
+{
+ BOOLEAN found;
+ QTC_RECORD record;
+
+ if ( gb_QTC.inited != QTC_MAGIC_NUMBER ) {
+ return( QTC_NO_INIT );
+ }
+
+ free( qtc->header );
+ qtc->header = NULL;
+
+ /*
+ If we are calling this function and then searching for more matches
+ withing the same BSD, as is the case when restoring multiple Single
+ File Selections, error will be set to QTC_NO_MORE and when we call
+ this function again to find the next file, error will not be cleared!
+
+ So, if the error is QTC_NO_MORE we will just reset error and continue
+ else FAILURE.
+ */
+
+ if ( qtc->error )
+ {
+ if ( qtc->error == QTC_NO_MORE )
+ {
+ qtc->error = FALSE;
+ }
+ else
+ {
+ return( QTC_FAILURE );
+ }
+ }
+
+ if ( qtc->file_open ) {
+ QTC_CloseFile( qtc->fh );
+ qtc->file_open = FALSE;
+ }
+
+ qtc->bset = QTC_GetBsetForSrch( qtc );
+
+ if ( qtc->bset == NULL ) {
+ return( QTC_BSET_NOT_FOUND );
+ }
+
+ qtc->header = QTC_LoadHeader( qtc->bset );
+ if ( qtc->header == NULL ) {
+ return( QTC_NO_HEADER );
+ }
+
+ qtc->fh = QTC_OpenFile( qtc->bset->tape_fid,
+ (INT16)qtc->bset->tape_seq_num, FALSE, FALSE );
+
+ if ( qtc->fh < 0 ) {
+ return( QTC_OPEN_FAILED );
+ }
+
+ qtc->file_open = TRUE;
+
+ qtc->fil_dir_offset = 0;
+
+ // Here we need to find the starting and ending offsets to search.
+ // For the root default to entire bset.
+
+ if ( ! strlen( qtc->search_name ) ) {
+
+ // they only wanted a directory
+
+ found = FALSE;
+
+ do {
+
+ if ( QTC_FindDirRec( qtc, &record ) == SUCCESS ) {
+
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+ found = TRUE;
+ break;
+ }
+
+ } while ( QTC_MoveToNextTapeInFamily( qtc ) == SUCCESS );
+
+ if ( ! found ) {
+ return( QTC_NO_MORE );
+ }
+
+ QTC_TestPathSize( qtc, qtc->search_path_size );
+ memcpy( qtc->path, qtc->search_path, qtc->search_path_size );
+ qtc->path_size = qtc->search_path_size;
+
+ QTC_TestItemSize( qtc, ( strlen( TEXT("") ) + 1 ) * sizeof(CHAR) );
+ strcpy( qtc->item, TEXT("") );
+
+ qtc->status = (UINT8)record.status;
+ qtc->date = (INT16)record.date;
+ qtc->time = (INT16)record.time;
+ qtc->attrib = record.attribute;
+ qtc->size = U64_Init( record.common.common.height, 0L );
+ qtc->lba = record.lba;
+
+ QTC_SetFileCounts( qtc );
+ return( QTC_SUCCESS );
+ }
+
+
+ // Decide where to start and stop searching in this set. We can just
+ // search the entire set if the path is the root and we can search
+ // subdirectories.
+
+
+ if ( ( qtc->search_path_size == sizeof(CHAR) ) && ( qtc->subdirs ) ) {
+
+ qtc->search_start = qtc->header->fil_start;
+ qtc->curr_mom_offset = qtc->header->dir_start;
+ qtc->search_stop = qtc->header->fil_start + qtc->header->fil_size;
+ }
+ else {
+
+ found = FALSE;
+
+ do {
+
+ if ( QTC_FindDirRec( qtc, &record ) == SUCCESS ) {
+
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+ found = TRUE;
+ break;
+ }
+
+ } while ( QTC_MoveToNextTapeInFamily( qtc ) == SUCCESS );
+
+ if ( ! found ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_start = qtc->header->fil_start + record.common.common.file_start;
+
+ // Find the first directory at a higher level than this one and
+ // that's where to stop.
+
+ if ( QTC_FindStoppingOffset( qtc, &record ) ) {
+ return( QTC_READ_FAILED );
+ }
+
+ }
+
+ // Initialize buffers as empty
+
+ qtc->search_max = 0;
+ qtc->search_index = 0;
+ qtc->search_base = qtc->search_start;
+
+ // If no '*' characters in search name then set requested search length
+
+ if ( strchr( qtc->search_name, TEXT('*') ) ) {
+ qtc->search_size = 0;
+ }
+ else {
+
+ qtc->search_size = (UINT16)( sizeof( QTC_NAME ) +
+ (strlen( qtc->search_name ) * sizeof(CHAR) ) );
+ }
+
+ return( QTC_SearchNextItem( qtc ) );
+}
+
+/************************
+
+ Find the next matching item to the search request set up in the qtc.
+
+*************************/
+
+INT QTC_SearchNextItem( QTC_QUERY_PTR qtc )
+{
+ QTC_NAME UNALIGNED * name;
+ QTC_RECORD record;
+ UINT32 offset;
+ UINT32 msw_size = 0L;
+ BYTE_PTR s;
+ BOOLEAN found;
+ INT result;
+ INT size;
+ INT i;
+ INT Error;
+
+
+ if ( qtc->error ) {
+ return( QTC_FAILURE );
+ }
+
+ if ( ! strlen( qtc->search_name ) ) {
+
+ // They only wanted a directory, so look for a duplicate.
+
+ if ( QTC_FindNextDirRec( qtc, &record ) != SUCCESS ) {
+
+ found = FALSE;
+
+ while ( QTC_MoveToNextTapeInFamily( qtc ) == SUCCESS ) {
+
+ if ( QTC_FindDirRec( qtc, &record ) == SUCCESS ) {
+
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+ found = TRUE;
+ break;
+ }
+
+ }
+
+ if ( ! found ) {
+ return( QTC_NO_MORE );
+ }
+ }
+
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+
+ QTC_TestPathSize( qtc, qtc->search_path_size );
+ memcpy( qtc->path, qtc->search_path, qtc->search_path_size );
+ qtc->path_size = qtc->search_path_size;
+
+ QTC_TestItemSize( qtc, ( strlen( TEXT("") ) + 1 ) * sizeof(CHAR) );
+ strcpy( qtc->item, TEXT("") );
+
+ qtc->status = (UINT8)record.status;
+ qtc->date = (INT16)record.date;
+ qtc->time = (INT16)record.time;
+ qtc->attrib = record.attribute;
+ qtc->size = U64_Init( record.common.common.height, 0L );
+ qtc->lba = record.lba;
+
+ QTC_SetFileCounts( qtc );
+ return( QTC_SUCCESS );
+ }
+
+ // If duplicates exist in the directory, than we need to check for the
+ // possible existence of another valid search area.
+
+ if ( QTC_FastSearchForFile( qtc ) != SUCCESS ) {
+
+ found = FALSE;
+
+ // Loop over all the directories in all the tapes.
+
+ while ( ! found ) {
+
+ // Look at all duplicate directories first.
+
+ while ( QTC_FindNextDirRec( qtc, &record ) == SUCCESS ) {
+
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+
+ qtc->search_start = qtc->header->fil_start + record.common.common.file_start;
+
+ // Find the first directory at a higher level than this one and
+ // that's where to stop.
+
+ if ( QTC_FindStoppingOffset( qtc, &record ) ) {
+ return( QTC_READ_FAILED );
+ }
+
+ // Initialize buffers as empty
+
+ qtc->search_max = 0;
+ qtc->search_index = 0;
+ qtc->search_base = qtc->search_start;
+
+ // Now look for the file in our new duplicate directory.
+
+ if ( QTC_FastSearchForFile( qtc ) == SUCCESS ) {
+ found = TRUE;
+ break;
+ }
+
+ }
+
+ if ( ! found ) {
+
+ // Try another tape, same bset number.
+
+ if ( QTC_MoveToNextTapeInFamily( qtc ) == SUCCESS ) {
+
+ // Find the directory.
+
+ if ( QTC_FindDirRec( qtc, &record ) == SUCCESS ) {
+
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+
+ if ( ( qtc->search_path_size == sizeof(CHAR) ) && ( qtc->subdirs ) ) {
+
+ qtc->search_start = qtc->header->fil_start;
+ qtc->search_stop = qtc->header->fil_start + qtc->header->fil_size;
+ }
+ else {
+
+ qtc->search_start = qtc->header->fil_start + record.common.common.file_start;
+
+ // Find the first directory at a higher level than this one and
+ // that's where to stop.
+
+ if ( QTC_FindStoppingOffset( qtc, &record ) ) {
+ return( QTC_READ_FAILED );
+ }
+ }
+
+ // Initialize buffers as empty
+
+ qtc->search_max = 0;
+ qtc->search_index = 0;
+ qtc->search_base = qtc->search_start;
+
+ // Look for the file.
+
+ if ( QTC_FastSearchForFile( qtc ) == SUCCESS ) {
+ found = TRUE;
+ }
+
+ // Go back up to the top and look for a duplicate directory.
+ }
+ }
+ else {
+
+ // Every damn thing we've tried has failed.
+
+ return( FAILURE );
+ }
+ }
+ }
+ }
+
+ name = (QTC_NAME UNALIGNED *)qtc->buff1;
+
+ offset = qtc->header->rec_start;
+ offset += name->record * sizeof( QTC_RECORD );
+
+ QTC_SeekFile( qtc->fh, offset );
+
+ result = QTC_ReadFile( qtc->fh, (BYTE_PTR)&record, sizeof( QTC_RECORD ), &Error );
+
+ if ( result != sizeof( QTC_RECORD ) ) {
+ return( QTC_READ_FAILED );
+ }
+
+ QTC_TestPathSize( qtc, sizeof(CHAR) );
+ qtc->path[ 0 ] = TEXT( '\0' );
+ qtc->path_size = sizeof(CHAR);
+
+ // Copy name
+
+ s = qtc->buff1 + sizeof( QTC_NAME );
+
+ size = (INT)name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+
+ QTC_TestItemSize( qtc, size );
+ memcpy( qtc->item, s, size );
+ qtc->item[ size / sizeof(CHAR) ] = TEXT( '\0' );
+
+ // Item xtra bytes
+
+ s += name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+ memcpy( qtc->xtra_bytes, s, (INT)name->xtra_size );
+ qtc->xtra_size = (INT8)name->xtra_size;
+
+ for ( i = 0; i < qtc->xtra_size; i += 5 ) {
+ if ( qtc->xtra_bytes[ i ] == QTC_XTRA_64BIT_SIZE ) {
+ memcpy( &msw_size, &qtc->xtra_bytes[ i + 1 ] , 4 );
+ }
+ }
+
+ // record data
+
+ qtc->status = (UINT8)record.status;
+ qtc->date = (INT16)record.date;
+ qtc->time = (INT16)record.time;
+ qtc->attrib = record.attribute;
+ qtc->size = U64_Init( record.common.size, msw_size );
+ qtc->lba = record.lba;
+
+ // build path up
+
+ if ( QTC_BuildWholePath( qtc, name->mom_offset ) ) {
+ return( QTC_READ_FAILED );
+ }
+
+ QTC_SetFileCounts( qtc );
+
+ return( QTC_SUCCESS );
+}
+
+/**********************
+
+ The goal here is to fill in the qtc->search_stop field.
+
+ The user has asked for a search and specified a path. We have already
+ found the location in the catalogs where the path "\DOS\GAMES\JF"
+ starts and now we want to know where it stops. By finding the end
+ of this directory we can abort out of our search as soon as the valid
+ area has been searched. The QTC_NAME structure for the \JF entry is
+ in qtc->buff1 and the record for \JF is in the record field. Both of
+ these are no longer needed so they can be trashed by this routine.
+
+ If the user has requested we not search subdirectories then stop at
+ the first directory we find.
+
+ If we hit the end of the backup set before we reach the end of the
+ \JF directory than the end of the bset is where we stop searching.
+
+***********************/
+
+INT QTC_FindStoppingOffset( QTC_QUERY_PTR qtc, QTC_RECORD_PTR record )
+{
+ UINT32 curr_try_offset;
+ UINT32 dir_max;
+ UINT32 offset;
+ INT init = TRUE;
+ INT result;
+ INT Error;
+ QTC_NAME UNALIGNED * name;
+
+
+ // where is the end of valid data ?
+
+ dir_max = qtc->header->dir_start + qtc->header->dir_size;
+
+ // use buff1 to store the temp results in
+
+ name = ( QTC_NAME *)qtc->buff1;
+
+ // start looking immediately after the entry for starting at
+
+ curr_try_offset = qtc->header->dir_start;
+ curr_try_offset += record->name_offset + name->size;
+
+ // Look for name with mom_offset < last_offset
+ // This guy will fill in the name structure for us
+
+ while ( ! QTC_FastSearchForDir( qtc,
+ &curr_try_offset,
+ dir_max,
+ 0,
+ init ) ) {
+
+ // Only init once
+
+ if ( init ) {
+ init = FALSE;
+ }
+
+ // See if we found a brother or higher relative to the
+ // directory we started with. If we do then we are done.
+
+ if ( ( name->mom_offset < record->name_offset ) ||
+ ( ! qtc->subdirs ) ) {
+
+ // Yo dude, success !
+
+ offset = qtc->header->rec_start;
+ offset += ( name->record * sizeof( QTC_RECORD ) );
+
+ QTC_SeekFile( qtc->fh, offset );
+
+ result = QTC_ReadFile( qtc->fh, (BYTE_PTR)record, sizeof( QTC_RECORD ), &Error );
+
+ if ( result != sizeof(QTC_RECORD ) ) {
+ return( QTC_READ_FAILED );
+ }
+
+ qtc->search_stop = qtc->header->fil_start + record->common.common.file_start;
+
+ return( QTC_SUCCESS );
+ }
+ }
+
+ // We hit the end of the bset, use it for the stopping location
+
+ qtc->search_stop = qtc->header->fil_start + qtc->header->fil_size;
+
+ return( QTC_SUCCESS );
+}
+
+
+/**********************
+
+ Build the entire path starting with the offset passed in. We have
+ found a file during a search whose parent directory ends with the
+ directory entry at 'offset'. Fill in the qtc->path field with the
+ complete path for this file by working backwards up the name table.
+ Where each entry has the offset of its parent. When the parent
+ offset is zero, you can stop, you are at the root.
+
+***********************/
+
+INT QTC_BuildWholePath( QTC_QUERY_PTR qtc, UINT32 offset )
+{
+ INT i;
+ INT result;
+ INT bytes;
+ INT Error;
+ QTC_NAME UNALIGNED * name;
+ CHAR_PTR dirname;
+ BYTE buff1[ QTC_BUF_SIZE ];
+ BYTE_PTR byte_ptr;
+
+ name = (QTC_NAME UNALIGNED *)buff1;
+
+ byte_ptr = (BYTE_PTR)name;
+ byte_ptr += sizeof( QTC_NAME );
+
+ dirname = (CHAR_PTR)byte_ptr;
+
+ if ( offset == 0 ) {
+ QTC_TestPathSize( qtc, sizeof( CHAR ) );
+ qtc->path[ 0 ] = TEXT( '\0' );
+ qtc->path_size = sizeof( CHAR );
+ }
+ else {
+
+ qtc->path_size = 0;
+
+ while ( offset ) {
+
+ QTC_SeekFile( qtc->fh, qtc->header->dir_start + offset );
+
+ result = QTC_ReadFile( qtc->fh, buff1, QTC_BUF_SIZE, &Error );
+
+ if ( result < sizeof( QTC_NAME ) || result < (INT)name->size ) {
+ return( QTC_READ_FAILED );
+ }
+
+ // Zero terminate name
+
+ dirname[ (name->size - name->xtra_size - sizeof( QTC_NAME )) / sizeof(CHAR) ] = 0;
+
+ offset = name->mom_offset;
+
+ // BEFORE
+ // qtc->path[] dirname[]
+ // 01234567890 0123456789
+ // xx0xxx0 yyy0
+ //
+ // AFTER
+ // qtc->path[]
+ // yyy0xx0xxx0
+
+ bytes = qtc->path_size + strsize( dirname );
+
+ QTC_TestPathSize( qtc, bytes );
+ for ( i = qtc->path_size/sizeof(CHAR); i > 0; i-- ) {
+ qtc->path[ i + strlen( dirname ) ] = qtc->path[ i - 1 ];
+ }
+
+ strcpy( qtc->path, dirname );
+ qtc->path_size += strsize( dirname );
+ }
+ }
+
+
+ return( SUCCESS );
+}
+
+
+/*******************
+
+ The user is performing a catalog search call. The search parameters are
+ all set up and the only thing for us to do now is skim through the
+ filenames looking for one that is a match.
+
+********************/
+
+INT QTC_FastSearchForFile( QTC_QUERY_PTR qtc )
+{
+ UINT bytes_left;
+ INT index;
+ QTC_NAME UNALIGNED *name;
+ BYTE buff[ QTC_BUF_SIZE ];
+ BYTE_PTR s;
+ INT Error;
+
+
+ name = ( QTC_NAME *)qtc->buff1;
+
+ while ( TRUE ) {
+
+ s = (BYTE_PTR)name;
+
+ // copy the fixed size part of the structure
+
+ if ( qtc->search_index + sizeof( QTC_NAME ) <= qtc->search_max ) {
+
+ // fast copy, no buffer break
+
+ memcpy( s, &(qtc->buff2[ qtc->search_index ]), sizeof( QTC_NAME ) );
+
+ qtc->search_index += sizeof( QTC_NAME );
+ }
+ else {
+
+ // Slow copy to handle buffer break
+
+ memcpy( s,
+ &(qtc->buff2[ qtc->search_index ]),
+ qtc->search_max - qtc->search_index );
+
+
+ s += qtc->search_max - qtc->search_index;
+
+ bytes_left = sizeof(QTC_NAME) -
+ ( qtc->search_max - qtc->search_index );
+
+ qtc->search_base += qtc->search_max;
+
+ if ( qtc->search_base >= qtc->search_stop ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_max = (UINT16)min( (INT32)QTC_BUF_SIZE,
+ qtc->search_stop - qtc->search_base );
+
+ QTC_SeekFile( qtc->fh, qtc->search_base );
+
+ qtc->search_max = (UINT16)QTC_ReadFile( qtc->fh, qtc->buff2, (INT)qtc->search_max, &Error );
+
+ if ( qtc->search_max < (UINT16)bytes_left ) {
+ return( QTC_NO_MORE );
+ }
+
+ memcpy( s,
+ &(qtc->buff2[ 0 ]),
+ bytes_left );
+
+ qtc->search_index = (UINT16)bytes_left;
+
+ }
+
+ // See if this file is a match
+
+ s = (BYTE_PTR)name;
+
+ if ( ( qtc->search_size == 0 ) ||
+ ( qtc->search_size == (UINT16)(name->size - name->xtra_size ) ) ) {
+
+ // copy variable sized part of structure, the name which we learned
+ // how long it was from the fixed part we just read in.
+
+ s += sizeof( QTC_NAME );
+
+ if ( (UINT16)( qtc->search_index +
+ (INT)name->size - sizeof(QTC_NAME) ) <= qtc->search_max ) {
+
+ // fast copy name
+
+ memcpy( s,
+ &(qtc->buff2[ qtc->search_index ]),
+ (INT)name->size - sizeof( QTC_NAME ) );
+
+ qtc->search_index += (UINT16)(name->size - sizeof( QTC_NAME ));
+ }
+ else {
+
+ // Slow copy to handle buffer break
+
+ memcpy( s,
+ &(qtc->buff2[ qtc->search_index ]),
+ qtc->search_max - qtc->search_index );
+
+ s += qtc->search_max - qtc->search_index;
+
+ bytes_left = (INT)name->size - sizeof(QTC_NAME) -
+ ( qtc->search_max - qtc->search_index );
+
+ qtc->search_base += qtc->search_max;
+
+ if ( qtc->search_base >= qtc->search_stop ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_max = (UINT16)min( (INT32)QTC_BUF_SIZE,
+ qtc->search_stop - qtc->search_base );
+
+ QTC_SeekFile( qtc->fh, qtc->search_base );
+
+ qtc->search_max = (UINT16)QTC_ReadFile( qtc->fh, qtc->buff2, (INT)qtc->search_max, &Error );
+
+ if ( qtc->search_max < (UINT16)bytes_left ) {
+ return( QTC_NO_MORE );
+ }
+
+ memcpy( s,
+ &(qtc->buff2[ 0 ]),
+ bytes_left );
+
+ qtc->search_index = (UINT16)bytes_left;
+
+ }
+
+ s = (BYTE_PTR)name;
+ s += sizeof(QTC_NAME); // point to file name again
+
+ memcpy( buff, s, (INT)name->size - (INT)name->xtra_size - sizeof(QTC_NAME) );
+
+ index = (INT)name->size - (INT)name->xtra_size - sizeof(QTC_NAME);
+ buff[ index ] = 0;
+
+ if ( sizeof(CHAR) != 1 ) {
+ buff[ ++index ] = 0;
+ }
+
+ if ( ! QTC_TryToMatchFile( qtc, buff ) ) {
+ return( QTC_SUCCESS );
+ }
+ }
+ else {
+
+ // skip over worthless data
+
+ if ( (UINT16)( qtc->search_index +
+ (INT)name->size - sizeof(QTC_NAME) ) <= qtc->search_max ) {
+
+ qtc->search_index += (UINT16)(name->size - sizeof( QTC_NAME ));
+ }
+ else {
+
+ bytes_left = (INT)name->size - sizeof(QTC_NAME) -
+ ( qtc->search_max - qtc->search_index );
+
+ if ( (qtc->search_base + qtc->search_max) >= qtc->search_stop ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_base += qtc->search_max;
+
+ qtc->search_max = (UINT16)min( (INT32)QTC_BUF_SIZE,
+ qtc->search_stop - qtc->search_base );
+
+ QTC_SeekFile( qtc->fh, qtc->search_base );
+
+ qtc->search_max = (UINT16)QTC_ReadFile( qtc->fh, qtc->buff2, (INT)qtc->search_max, &Error );
+
+ if ( qtc->search_max < (UINT16)bytes_left ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_index = (UINT16)bytes_left;
+ }
+ }
+ }
+
+ return( QTC_FAILURE );
+}
+
+
+/**********************
+
+ While doing a getfirst/getnext command we ran into the end of media and
+ we want to attempt to move on to the next tape and continue with the
+ same bset.
+
+***********************/
+
+INT QTC_MoveToNextTapeInFamily( QTC_QUERY_PTR qtc )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ QTC_TAPE_PTR best_tape = NULL;
+ INT tape_seq_num = 0;
+
+ // was user picky about sequence number ?
+
+ if ( qtc->tape_seq_num != -1 ) {
+ return( FAILURE );
+ }
+
+ free( qtc->header );
+ qtc->header = NULL;
+
+ // close the old file if it's open
+
+ if ( qtc->file_open ) {
+ QTC_CloseFile( qtc->fh );
+ qtc->file_open = FALSE;
+ }
+
+ // Now find a bset that matches it
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+
+ if ( ( tape->tape_fid == qtc->tape_fid ) &&
+ ( tape->tape_seq_num > (INT16)qtc->bset->tape_seq_num ) ) {
+
+ // Find the lowest numbered tape in this family that's higher
+ // number than the current tape we are using.
+
+ if ( ( best_tape == NULL ) ||
+ ( tape_seq_num > tape->tape_seq_num ) ) {
+
+ tape_seq_num = tape->tape_seq_num;
+ best_tape = tape;
+ }
+ }
+ tape = QTC_GetNextTape( tape );
+ }
+
+ // We have found another member of the same tape family
+
+ if ( best_tape == NULL ) {
+ return( FAILURE );
+ }
+
+ // Now see if the desired set continues on to this tape.
+
+ bset = QTC_GetFirstBset( best_tape );
+
+ while ( bset != NULL ) {
+
+ if ( qtc->bset->bset_num == bset->bset_num ) {
+ break;
+ }
+
+ bset = QTC_GetNextBset( bset );
+ }
+
+ // No known continuation bset
+
+ if ( bset == NULL ) {
+ return( FAILURE );
+ }
+
+ qtc->header = QTC_LoadHeader( bset );
+
+ if ( qtc->header == NULL ) {
+ return( QTC_NO_HEADER );
+ }
+
+ // Open the file
+
+ qtc->fh = QTC_OpenFile( bset->tape_fid, (INT16)bset->tape_seq_num, FALSE, FALSE );
+
+ if ( qtc->fh < 0 ) {
+ return( FAILURE );
+ }
+
+ qtc->bset = bset;
+
+ qtc->file_open = TRUE;
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ Get us all the entries for a bset
+
+***********************/
+
+INT QTC_GetFirstItem(
+QTC_QUERY_PTR qtc ) // I - query structure to use
+{
+
+ if ( gb_QTC.inited != QTC_MAGIC_NUMBER ) {
+ return( QTC_NO_INIT );
+ }
+
+ if ( qtc->file_open ) {
+ QTC_CloseFile( qtc->fh );
+ qtc->file_open = FALSE;
+ }
+
+ free( qtc->header );
+ qtc->header = NULL;
+
+ qtc->last_path_size = 0;
+
+ // Now find a bset that matches it
+
+ qtc->bset = QTC_GetBsetForSrch( qtc );
+
+ if ( qtc->bset == NULL ) {
+ // So sorry, never heard of that bset
+ return( QTC_BSET_NOT_FOUND );
+ }
+
+ qtc->header = QTC_LoadHeader( qtc->bset );
+
+ if ( qtc->header == NULL ) {
+ return( QTC_NO_HEADER );
+ }
+
+ // Open data file for bset
+
+ qtc->fh = QTC_OpenFile( qtc->bset->tape_fid, (INT16)qtc->bset->tape_seq_num, FALSE, FALSE );
+
+ if ( qtc->fh < 0 ) {
+ return( QTC_OPEN_FAILED );
+ }
+
+ qtc->file_open = TRUE;
+
+ // Set up the record number to return next
+
+ qtc->record_number = 0L;
+
+ return( QTC_GetNextItem( qtc ) );
+
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_GetNextItem(
+QTC_QUERY_PTR qtc ) // I - query structure to use
+{
+ BYTE_PTR s;
+ QTC_NAME UNALIGNED * name;
+ QTC_RECORD record;
+ INT limit;
+ INT i, j;
+ INT size;
+ INT Error;
+ INT BytesNeeded;
+ UINT32 msw_size = 0L;
+
+ name = (QTC_NAME UNALIGNED *)qtc->buff1;
+
+ if ( ! qtc->file_open ) {
+ return( QTC_NO_MORE );
+ }
+
+ do {
+
+ if ( qtc->record_number * sizeof( QTC_RECORD ) < qtc->header->rec_size ) {
+
+ QTC_SeekFile( qtc->fh, qtc->header->rec_start + ( qtc->record_number * sizeof( QTC_RECORD ) ) );
+
+ if ( QTC_ReadFile( qtc->fh, (BYTE_PTR)&record, sizeof( QTC_RECORD ), &Error ) == sizeof( QTC_RECORD ) ) {
+
+ if ( record.status & QTC_DIRECTORY ) {
+
+ // read in a directory name item
+
+ QTC_SeekFile( qtc->fh, qtc->header->dir_start + record.name_offset );
+
+ limit = QTC_ReadFile( qtc->fh, qtc->buff2, QTC_BUF_SIZE, &Error );
+ limit = (INT)min( (LONG)limit, (LONG)(qtc->header->dir_size - record.name_offset) );
+ if ( ! QTC_GetNameFromBuff( qtc->buff2, name, limit ) ) {
+ break;
+ }
+ }
+ else {
+
+ // read in a file name item
+
+ QTC_SeekFile( qtc->fh, qtc->header->fil_start + record.name_offset );
+
+ limit = QTC_ReadFile( qtc->fh, qtc->buff2, QTC_BUF_SIZE, &Error );
+ limit = (INT)min( (LONG)limit, (LONG)(qtc->header->fil_size - record.name_offset) );
+ if ( ! QTC_GetNameFromBuff( qtc->buff2, name, limit ) ) {
+ break;
+ }
+ }
+ }
+ }
+
+ if ( QTC_MoveToNextTapeInFamily( qtc ) != SUCCESS ) {
+ return( QTC_NO_MORE );
+ }
+
+ // We've changed backup sets, so reset buffer.
+
+ qtc->data_index = 0;
+ qtc->data_max = 0;
+
+ } while ( TRUE );
+
+ // next time get the next record
+
+ qtc->record_number++;
+
+ // Fill in results for application layer
+
+ // Item name
+
+ s = (BYTE_PTR)name;
+ s += sizeof( QTC_NAME );
+
+ size = (INT)name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+
+ QTC_TestItemSize( qtc, size + sizeof(CHAR) );
+ memcpy( qtc->item, s, size );
+ qtc->item[ size / sizeof(CHAR) ] = TEXT( '\0' );
+
+ // Item xtra bytes
+
+ s += name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+ memcpy( qtc->xtra_bytes, s, (INT)name->xtra_size );
+ qtc->xtra_size = (INT8)name->xtra_size;
+
+ for ( i = 0; i < qtc->xtra_size; i += 5 ) {
+ if ( qtc->xtra_bytes[ i ] == QTC_XTRA_64BIT_SIZE ) {
+ memcpy( &msw_size, &qtc->xtra_bytes[ i + 1 ] , 4 );
+ }
+ }
+
+ // Record data
+
+ qtc->status = (UINT8)record.status;
+ qtc->date = (INT16)record.date;
+ qtc->time = (INT16)record.time;
+ qtc->attrib = record.attribute;
+ qtc->lba = record.lba;
+
+ if ( qtc->status & QTC_FILE ) {
+ qtc->size = U64_Init( record.common.size, msw_size );
+ }
+ else {
+
+ qtc->size = U64_Init( record.common.common.height, 0L );
+
+ QTC_TestPathSize( qtc, qtc->last_path_size );
+ memcpy( qtc->path, qtc->last_path, qtc->last_path_size );
+
+ i = 1;
+ j = 0;
+
+ while ( i < (INT)U64_Lsw( qtc->size ) ) {
+
+ while ( qtc->path[ j++ ] );
+ i++;
+ }
+
+ qtc->path_size = j * sizeof (CHAR);
+
+ if ( U64_Lsw( qtc->size ) < 2 ) {
+ QTC_TestPathSize( qtc, sizeof(CHAR) );
+ qtc->path[ 0 ] = TEXT( '\0' );
+ qtc->path_size = sizeof(CHAR);
+ }
+
+ QTC_TestLastPathSize( qtc, qtc->path_size );
+ memcpy( qtc->last_path, qtc->path, qtc->path_size );
+
+ BytesNeeded = strsize( qtc->item ) + (j * sizeof(CHAR));
+ QTC_TestLastPathSize( qtc, BytesNeeded );
+ strcpy( &qtc->last_path[ j ], qtc->item );
+
+ qtc->last_path_size = BytesNeeded;
+
+ QTC_SetFileCounts( qtc );
+ }
+
+ return( QTC_SUCCESS );
+}
+
+/**********************
+
+ Get us all the directory entries for a bset
+
+***********************/
+
+INT QTC_GetFirstDir(
+QTC_QUERY_PTR qtc ) // I - query structure to use
+{
+
+ if ( gb_QTC.inited != QTC_MAGIC_NUMBER ) {
+ return( QTC_NO_INIT );
+ }
+
+ if ( qtc->file_open ) {
+ QTC_CloseFile( qtc->fh );
+ qtc->file_open = FALSE;
+ }
+
+ free( qtc->header );
+ qtc->header = NULL;
+
+ qtc->last_path_size = 0;
+
+ // Now find a bset that matches it
+
+ qtc->bset = QTC_GetBsetForSrch( qtc );
+
+ if ( qtc->bset == NULL ) {
+ // So sorry, never heard of that bset
+ return( QTC_BSET_NOT_FOUND );
+ }
+
+ qtc->header = QTC_LoadHeader( qtc->bset );
+
+ if ( qtc->header == NULL ) {
+ return( QTC_NO_HEADER );
+ }
+
+ // Open data file for bset
+
+ qtc->fh = QTC_OpenFile( qtc->bset->tape_fid, (INT16)qtc->bset->tape_seq_num, FALSE, FALSE );
+
+ if ( qtc->fh < 0 ) {
+ return( QTC_OPEN_FAILED );
+ }
+
+ qtc->file_open = TRUE;
+
+ // Set up our buffer stuff
+
+ qtc->dir_offset = qtc->header->dir_start;
+
+ qtc->data_index = 0;
+ qtc->data_max = 0;
+
+ return( QTC_GetNextDir( qtc ) );
+
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_GetNextDir(
+QTC_QUERY_PTR qtc ) // I - query structure to use
+{
+ BYTE_PTR s;
+ QTC_NAME UNALIGNED * name;
+ QTC_RECORD record;
+ INT i, j;
+ INT size;
+ INT BytesNeeded;
+ UINT32 msw_size = 0L;
+
+
+ if ( ! qtc->file_open ) {
+ return( QTC_NO_MORE );
+ }
+
+ do {
+
+ name = QTC_GetNextItemFromBuffer( qtc, &record, BUFF_DIR );
+
+ if ( name ) {
+ break;
+ }
+
+ if ( QTC_MoveToNextTapeInFamily( qtc ) != SUCCESS ) {
+ return( QTC_NO_MORE );
+ }
+
+ // We've changed backup sets, so reset buffer.
+
+ qtc->dir_offset = qtc->header->dir_start;
+ qtc->data_index = 0;
+ qtc->data_max = 0;
+
+ } while ( TRUE );
+
+ // Fill in results for application layer
+
+ // Item name
+
+ s = (BYTE_PTR)name;
+ s += sizeof( QTC_NAME );
+
+ size = (INT)name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+
+ QTC_TestItemSize( qtc, size + sizeof(CHAR) );
+ memcpy( qtc->item, s, size );
+ qtc->item[ size / sizeof(CHAR) ] = TEXT( '\0' );
+
+ // Item xtra bytes
+
+ s += name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+ memcpy( qtc->xtra_bytes, s, (INT)name->xtra_size );
+ qtc->xtra_size = (INT8)name->xtra_size;
+
+ for ( i = 0; i < qtc->xtra_size; i += 5 ) {
+ if ( qtc->xtra_bytes[ i ] == QTC_XTRA_64BIT_SIZE ) {
+ memcpy( &msw_size, &qtc->xtra_bytes[ i + 1 ] , 4 );
+ }
+ }
+
+ // Record data
+
+ qtc->status = (UINT8)record.status;
+ qtc->date = (INT16)record.date;
+ qtc->time = (INT16)record.time;
+ qtc->attrib = record.attribute;
+ qtc->size = U64_Init( record.common.common.height, msw_size );
+ qtc->lba = record.lba;
+
+ QTC_TestPathSize( qtc, qtc->last_path_size );
+ memcpy( qtc->path, qtc->last_path, qtc->last_path_size );
+
+ i = 1;
+ j = 0;
+
+ while ( i < (INT)U64_Lsw( qtc->size ) ) {
+
+ while ( qtc->path[ j++ ] );
+ i++;
+ }
+
+ qtc->path_size = j * sizeof (CHAR);
+
+ if ( U64_Lsw( qtc->size ) < 2 ) {
+ QTC_TestPathSize( qtc, sizeof(CHAR) );
+ qtc->path[ 0 ] = TEXT( '\0' );
+ qtc->path_size = sizeof(CHAR);
+ }
+
+
+ BytesNeeded = strsize( qtc->item ) + ( j * sizeof(CHAR) );
+ QTC_TestLastPathSize( qtc, BytesNeeded );
+ memcpy( qtc->last_path, qtc->path, qtc->path_size );
+ strcpy( &qtc->last_path[ j ], qtc->item );
+
+ qtc->last_path_size = BytesNeeded;
+
+ QTC_SetFileCounts( qtc );
+ return( QTC_SUCCESS );
+}
+
+/*************
+
+ The data[] buffer contains info from a name file, with a name record
+ starting at byte 0. Limit is the size of good data in the buffer.
+ name points to not only a name structure, but also has space for the
+ name to be placed in memory after it. This routine will fill in the
+ name structure for you.
+
+***************/
+
+
+INT QTC_GetNameFromBuff(
+BYTE_PTR data, // I - source of data
+QTC_NAME UNALIGNED *name, // O - name structure to fill in
+INT limit ) // I - how much data is available
+{
+ if ( limit < sizeof( QTC_NAME ) ) {
+ return( QTC_NO_MORE );
+ }
+
+ // Copy fixed size of structure
+
+ memcpy( (BYTE *)name, data, sizeof( QTC_NAME ) );
+
+ // Now get variable size of structure from fixed part
+
+ if ( name->size > (INT16)limit ) {
+ return( QTC_NO_MORE );
+ }
+
+ memcpy( (BYTE *)name, data, (INT)name->size );
+
+ return( QTC_SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+QTC_NAME UNALIGNED * QTC_GetNextItemFromBuffer(
+QTC_QUERY_PTR qtc,
+QTC_RECORD_PTR record,
+INT buff_type )
+{
+ BOOLEAN buffer_needs_refilling;
+ QTC_NAME UNALIGNED *name;
+ INT limit;
+ INT32 data_left;
+ INT Error;
+
+ if ( qtc->data_max >= (INT)sizeof( QTC_NAME ) + qtc->data_index ) {
+
+ name = (QTC_NAME UNALIGNED *)&qtc->buff2[ qtc->data_index ];
+
+ if ( qtc->data_max - qtc->data_index < (INT)name->size ) {
+
+ buffer_needs_refilling = TRUE;
+ }
+
+ }
+ else {
+
+ buffer_needs_refilling = TRUE;
+ }
+
+ if ( buffer_needs_refilling ) {
+
+ buffer_needs_refilling = FALSE;
+
+ name = (QTC_NAME UNALIGNED *)qtc->buff2;
+
+ switch ( buff_type ) {
+
+ case BUFF_DIR:
+
+ qtc->dir_offset += qtc->data_index;
+
+ QTC_SeekFile( qtc->fh, qtc->dir_offset );
+
+ data_left = qtc->header->dir_start + qtc->header->dir_size;
+ data_left -= qtc->dir_offset;
+ break;
+
+ case BUFF_FILE:
+ qtc->fil_offset += qtc->data_index;
+
+ QTC_SeekFile( qtc->fh, qtc->fil_offset );
+
+ data_left = qtc->header->fil_start + qtc->header->fil_size;
+ data_left -= qtc->fil_offset;
+ break;
+
+ case BUFF_CHILD_DIR:
+
+ qtc->fil_dir_offset += qtc->data_index;
+
+ QTC_SeekFile( qtc->fh, qtc->fil_dir_offset );
+
+ data_left = qtc->header->dir_start + qtc->header->dir_size;
+ data_left -= qtc->fil_dir_offset;
+ break;
+
+ default:
+ return( NULL );
+
+ }
+
+ limit = (INT)min( (INT32)QTC_BUF_SIZE, data_left );
+
+ qtc->data_max = QTC_ReadFile( qtc->fh, qtc->buff2, limit, &Error );
+
+ if ( qtc->data_max == -1 ) {
+
+ // Read error
+ return( NULL );
+ }
+
+ qtc->data_index = 0;
+
+ if ( qtc->data_max < sizeof( QTC_NAME ) ) {
+ buffer_needs_refilling = TRUE;
+ }
+ else {
+
+ if ( qtc->data_max - qtc->data_index < (INT)name->size ) {
+
+ buffer_needs_refilling = TRUE;
+ }
+ }
+ }
+
+ if ( ! buffer_needs_refilling ) {
+
+ // We have enough good data to return a solution.
+
+ QTC_SeekFile( qtc->fh, qtc->header->rec_start + (name->record * sizeof( QTC_RECORD)) );
+
+ if ( QTC_ReadFile( qtc->fh, (BYTE_PTR)record, sizeof( QTC_RECORD ), &Error ) != sizeof( QTC_RECORD ) ) {
+
+ return( NULL );
+ }
+
+ qtc->data_index += (INT)name->size; // bump our buffer index
+
+ }
+ else {
+ return( NULL );
+ }
+
+ return( (QTC_NAME UNALIGNED *)name );
+}
+
+// if we do find a duplicate directory path after all the files in the
+// current directory are returned, then we set everything up for the
+// next call and return QTC_TRY_AGAIN.
+
+INT QTC_GetFirstObj(
+QTC_QUERY_PTR qtc ) // I - query structure to use
+{
+ QTC_RECORD record;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR temp_bset;
+
+ if ( gb_QTC.inited != QTC_MAGIC_NUMBER ) {
+ return( QTC_NO_INIT );
+ }
+
+ if ( qtc->file_open ) {
+ QTC_CloseFile( qtc->fh );
+ qtc->file_open = FALSE;
+ }
+ // Now find a bset that matches it
+
+ tape = QTC_GetFirstTape( );
+
+ temp_bset = NULL;
+ qtc->bset = NULL;
+
+ while ( tape != NULL ) {
+
+ if ( ( tape->tape_fid == qtc->tape_fid ) &&
+ ( tape->tape_seq_num == qtc->tape_seq_num ) ) {
+
+ qtc->bset = QTC_GetFirstBset( tape );
+
+ while ( qtc->bset != NULL ) {
+
+ if ( qtc->bset->bset_num == qtc->bset_num ) {
+ if ( ! ( qtc->bset->status & ( QTC_PARTIAL | QTC_IMAGE ) ) ) {
+ break;
+ }
+ }
+ qtc->bset = QTC_GetNextBset( qtc->bset );
+ }
+ break;
+ }
+ else {
+
+ if ( ( tape->tape_fid == qtc->tape_fid ) &&
+ ( qtc->tape_seq_num == -1 ) ) {
+
+ temp_bset = QTC_GetFirstBset( tape );
+
+ while ( temp_bset != NULL ) {
+
+ if ( temp_bset->bset_num == qtc->bset_num ) {
+
+ if ( ! ( temp_bset->status & ( QTC_PARTIAL | QTC_IMAGE ) ) ) {
+ if ( qtc->bset == NULL ) {
+ qtc->bset = temp_bset;
+ }
+
+ if ( qtc->bset->tape_seq_num > temp_bset->tape_seq_num ) {
+
+ qtc->bset = temp_bset;
+ }
+ }
+ }
+ temp_bset = QTC_GetNextBset( temp_bset );
+ }
+ }
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ if ( qtc->bset == NULL ) {
+ return( QTC_BSET_NOT_FOUND );
+ }
+
+ qtc->header = QTC_LoadHeader( qtc->bset );
+ if ( qtc->header == NULL ) {
+ return( QTC_NO_HEADER );
+ }
+
+ qtc->fh = QTC_OpenFile( qtc->bset->tape_fid, (INT16)qtc->bset->tape_seq_num, FALSE, FALSE );
+
+ if ( qtc->fh < 0 ) {
+ return( QTC_OPEN_FAILED );
+ }
+
+ // Copy search path to reply path, it won't change
+
+ QTC_TestPathSize( qtc, qtc->search_path_size );
+ memcpy( qtc->path, qtc->search_path, qtc->search_path_size );
+ qtc->path_size = qtc->search_path_size;
+
+ qtc->file_open = TRUE;
+
+ // Attempt to find the requested path on all the tapes this
+ // bset is on.
+
+ do {
+
+ qtc->fil_dir_offset = 0;
+
+ if ( QTC_FindDirRec( qtc, &record ) == SUCCESS ) {
+
+ // We found the path, set up for FindNextObj.
+
+ qtc->fil_offset = record.common.common.file_start + qtc->header->fil_start;
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+
+ qtc->data_index = 0;
+ qtc->data_max = 0;
+
+ return( QTC_GetNextObj( qtc ) );
+ }
+
+ } while ( QTC_MoveToNextTapeInFamily( qtc ) == SUCCESS );
+
+ // Requested path doesn't exist in catalogs.
+
+
+ return( QTC_NO_MORE );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_GetNextObj(
+QTC_QUERY_PTR qtc ) // I - query structure to use
+{
+ BOOLEAN done = FALSE;
+ QTC_RECORD record;
+
+
+ if ( ! qtc->file_open ) {
+ return( QTC_NO_MORE );
+ }
+
+ while ( ! done ) {
+
+ if ( QTC_TryToLocateFile( qtc ) == SUCCESS ) {
+ QTC_SetFileCounts( qtc );
+ return( SUCCESS );
+ }
+
+ if ( QTC_LookForChildDirs( qtc ) == SUCCESS ) {
+ QTC_SetFileCounts( qtc );
+ return( SUCCESS );
+ }
+
+ // Try for a duplicate directory.
+
+ qtc->fil_dir_offset = 0;
+
+ if ( QTC_FindNextDirRec( qtc, &record ) == SUCCESS ) {
+
+ // We found a new duplicate path, go to top loop again.
+
+ // Set up for FindNextObj.
+
+ qtc->fil_offset = record.common.common.file_start + qtc->header->fil_start;
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+
+ qtc->data_index = 0;
+ qtc->data_max = 0;
+
+ continue;
+ }
+
+ // Everything has failed on this tape, try for a new one.
+
+ done = TRUE;
+
+ while ( QTC_MoveToNextTapeInFamily( qtc ) == SUCCESS ) {
+
+ qtc->fil_dir_offset = 0;
+
+ if ( QTC_FindDirRec( qtc, &record ) == SUCCESS ) {
+
+ // We found a new duplicate path, go to top loop again.
+
+ // Set up for FindNextObj.
+
+ qtc->fil_offset = record.common.common.file_start + qtc->header->fil_start;
+ qtc->curr_mom_offset = qtc->header->dir_start + record.name_offset;
+
+ qtc->data_index = 0;
+ qtc->data_max = 0;
+
+ done = FALSE;
+ break;
+ }
+ }
+
+ }
+
+
+ return( QTC_NO_MORE );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_TryToLocateFile(
+QTC_QUERY_PTR qtc )
+{
+ INT bytes;
+ INT i;
+ UINT32 msw_size = 0L;
+ BYTE_PTR s;
+ QTC_NAME UNALIGNED * name;
+ QTC_RECORD record;
+
+
+ do {
+
+ if ( qtc->fil_dir_offset ) {
+ return( FAILURE );
+ }
+
+ name = QTC_GetNextItemFromBuffer( qtc, &record, BUFF_FILE );
+
+ // No more files
+
+ if ( name == NULL ) {
+ return( FAILURE );
+ }
+
+ // No more files in this directory
+
+ if ( (qtc->header->dir_start + name->mom_offset) != qtc->curr_mom_offset ) {
+ return( FAILURE );
+ }
+
+ s = (BYTE_PTR)name;
+ s += sizeof( QTC_NAME );
+
+ // Item name
+
+ bytes = (INT)name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+
+ QTC_TestItemSize( qtc, bytes + 1 );
+ memcpy( qtc->item, s, bytes );
+ qtc->item[ bytes/sizeof (CHAR) ] = TEXT( '\0' );
+
+ } while ( QTC_TryToMatchFile( qtc, (BYTE_PTR)qtc->item ) );
+
+ // Item xtra bytes
+
+ s += name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+ memcpy( qtc->xtra_bytes, s, (INT)name->xtra_size );
+ qtc->xtra_size = (UINT8)name->xtra_size;
+
+ for ( i = 0; i < qtc->xtra_size; i += 5 ) {
+ if ( qtc->xtra_bytes[ i ] == QTC_XTRA_64BIT_SIZE ) {
+ memcpy( &msw_size, &qtc->xtra_bytes[ i + 1 ] , 4 );
+ }
+ }
+
+ // Record data
+
+ qtc->status = (UINT8)record.status;
+ qtc->date = (INT16)record.date;
+ qtc->time = (INT16)record.time;
+ qtc->attrib = record.attribute;
+ qtc->size = U64_Init( record.common.size, msw_size );
+ qtc->lba = record.lba;
+
+ QTC_SetFileCounts( qtc );
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ Given the qtc->curr_mom_offset, look for any children directories, using
+ qtc->fil_dir_offset as a base and stop at bset->dir_start + bset->dir_size;
+
+********************/
+
+INT QTC_LookForChildDirs(
+QTC_QUERY_PTR qtc )
+{
+ QTC_RECORD record;
+ QTC_NAME UNALIGNED *name;
+ BYTE_PTR s;
+ UINT32 msw_size = 0L;
+ INT ret;
+ INT i;
+ INT bytes;
+ INT Error;
+
+
+ name = ( QTC_NAME UNALIGNED *)qtc->buff1;
+
+ if ( qtc->fil_dir_offset == 0 ) {
+
+ qtc->fil_dir_offset = qtc->curr_mom_offset;
+ qtc->data_index = 0;
+ qtc->data_max = 0;
+
+ /** skip over parent **/
+
+ QTC_SeekFile( qtc->fh, qtc->fil_dir_offset );
+
+ ret = QTC_ReadFile( qtc->fh, (BYTE_PTR)name, sizeof( QTC_NAME), &Error );
+
+ if ( ret != sizeof( QTC_NAME ) ) {
+ return( FAILURE );
+ }
+
+ qtc->fil_dir_offset += name->size;
+ }
+
+ do {
+
+ name = QTC_GetNextItemFromBuffer( qtc, &record, BUFF_CHILD_DIR );
+
+ if ( name == NULL ) {
+ return( FAILURE );
+ }
+
+ // Once we find an older parent's kids,
+ // we will never hit any more of this guys.
+
+ if ( qtc->header->dir_start + name->mom_offset < qtc->curr_mom_offset ) {
+ return( FAILURE );
+ }
+
+ // Keep skipping over younger children.
+
+ } while ( qtc->header->dir_start + name->mom_offset != qtc->curr_mom_offset );
+
+ // Item name
+
+ s = (BYTE_PTR)name;
+ s += sizeof( QTC_NAME );
+ bytes = (INT)name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+ QTC_TestItemSize( qtc, bytes + 1 );
+ memcpy( qtc->item, s, bytes );
+ qtc->item[ bytes / sizeof (CHAR) ] = TEXT( '\0' );
+
+ // Item xtra bytes
+
+ s += name->size - (INT)name->xtra_size - sizeof( QTC_NAME );
+ memcpy( qtc->xtra_bytes, s, (INT)name->xtra_size );
+ qtc->xtra_size = (INT8)name->xtra_size;
+
+ for ( i = 0; i < qtc->xtra_size; i += 5 ) {
+ if ( qtc->xtra_bytes[ i ] == QTC_XTRA_64BIT_SIZE ) {
+ memcpy( &msw_size, &qtc->xtra_bytes[ i + 1 ] , 4 );
+ }
+ }
+
+ // Record data
+
+ qtc->status = (UINT8)record.status;
+ qtc->date = (INT16)record.date;
+ qtc->time = (INT16)record.time;
+ qtc->attrib = record.attribute;
+ qtc->size = U64_Init( record.common.common.height, msw_size );
+ qtc->lba = record.lba;
+ QTC_SetFileCounts( qtc );
+
+ return( SUCCESS );
+
+}
+
+
+
+
+/**************
+
+ Given the path in qtc fill in the record structure for the last
+ subdirectory in the path.
+ Also fill in the dir_rec_offsets[] array;
+
+ ex. \DOS\GAMES\TETRIS
+
+ fills in the record structure for TETRIS.
+
+****************/
+
+INT QTC_FindDirRec(
+QTC_QUERY_PTR qtc, // I - use the path in this structure
+QTC_RECORD_PTR record ) // O - the record for the deepest dir in path
+{
+ // start looking at the start of the directory data
+
+ return( QTC_FindDirectoryPath( qtc, record, qtc->header->dir_start, TRUE ) );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ We have been asked to find yet another matching path. The success of
+ this function call is dependent on there being duplicate directories
+ in the catalog. This DOES happen with the \SYSTEM directory on
+ NOVELL servers if security stuff is backed up.
+
+ qtc->curr_mom_offset is the current directory tail.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_FindNextDirRec(
+QTC_QUERY_PTR qtc, // I - use the path in this structure
+QTC_RECORD_PTR record ) // O - the record for the deepest dir in path
+{
+ UINT32 curr_try_offset; // current offset in the directory names
+ QTC_NAME UNALIGNED * name;
+ INT Error;
+
+ name = (QTC_NAME UNALIGNED *)qtc->buff1;
+
+ // Determine the offset we wish to find a child from. Use the mom
+ // offset of the current directory at qtc->curr_mom_offset.
+
+ QTC_SeekFile( qtc->fh, qtc->curr_mom_offset );
+
+ if ( QTC_ReadFile( qtc->fh, (BYTE_PTR)name, sizeof( QTC_NAME ), &Error ) != sizeof( QTC_NAME ) ) {
+ return( FAILURE );
+ }
+
+ // Determine the offset in the directory data to start looking at.
+ // It should be the entry immediately after qtc->curr_mom_offset.
+
+ curr_try_offset = qtc->curr_mom_offset + name->size;
+
+ return( QTC_FindDirectoryPath( qtc, record, curr_try_offset, FALSE ) );
+}
+
+
+
+/**********************
+
+ NAME :
+
+ QTC_FindDirectoryPath
+
+ DESCRIPTION :
+
+ Called by QTC_FindDirRec() and QTC_FindNextDirRec() to find out if
+ a path exists in the current backup set. It returns the record for
+ the last directory entry in the path, if successful.
+
+ RETURNS :
+
+ SUCCESS/FAILURE
+
+**********************/
+
+static INT QTC_FindDirectoryPath(
+QTC_QUERY_PTR qtc, // I - use the path in this structure
+QTC_RECORD_PTR record, // O - the record for the deepest dir in path
+UINT32 curr_try_offset,
+INT start_at_root )
+{
+ QTC_NAME UNALIGNED *name;
+ INT current_level;
+ INT final_level;
+ INT new_level;
+ INT i;
+ INT Error;
+ INT init = TRUE;
+ CHAR *dir_name;
+ BYTE *s;
+ UINT32 dir_max;
+ UINT32 offset;
+
+ name = (QTC_NAME UNALIGNED *)qtc->buff1;
+
+ // Stop looking at the end of the directory data
+
+ dir_max = qtc->header->dir_start + qtc->header->dir_size;
+
+ // Uuse buff1 to store the temp results in
+
+ name = ( QTC_NAME *)qtc->buff1;
+
+ s = (BYTE_PTR)name;
+ s += sizeof( QTC_NAME );
+
+ // Determine depth of this path
+
+ final_level = 1;
+
+ if ( qtc->search_path_size > sizeof(CHAR) ) {
+ for ( i = 0; i < (INT)( qtc->search_path_size / sizeof(CHAR) ); i++ ) {
+ if ( qtc->search_path[i] == TEXT('\0') ) {
+ final_level++;
+ }
+ }
+ }
+
+ // example:
+ // for \, final_level = 1
+ // for \dos\games\tetris, final_level = 4
+
+
+ // current_level is the maximum level for which a solution directory
+ // is valid, we may come across a directory at level 6, that
+ // is an exact match for the level 6 name we are looking for,
+ // but if we are currently only working at level 2, then this
+ // new entry has the wrong parent for us to use it.
+
+ if ( start_at_root ) {
+ current_level = 0;
+ }
+ else {
+ current_level = final_level - 1;
+ }
+
+ do {
+
+ // Look for name with mom_offset == last_offset
+
+ if ( QTC_FastSearchForDir( qtc, &curr_try_offset,
+ dir_max, 0, init ) ) {
+
+ // A normal return, we ran out of namespace.
+ return( FAILURE );
+ }
+
+ // Only init once
+
+ if ( init ) {
+ init = FALSE;
+ }
+
+ // See if the directory found matches the name and
+ // height we are looking for.
+
+ // Load the record for this directory. Notice that if this is the
+ // solution directory, than we have loaded it here to return it.
+
+ offset = qtc->header->rec_start;
+ offset += ( name->record * sizeof( QTC_RECORD ) );
+ QTC_SeekFile( qtc->fh, offset );
+
+ if ( QTC_ReadFile( qtc->fh, (BYTE_PTR)record, sizeof( QTC_RECORD ), &Error ) != sizeof( QTC_RECORD ) ) {
+ return( FAILURE );
+ }
+
+ new_level = (INT)record->common.common.height;
+
+ if ( new_level <= current_level ) {
+
+ // Get the name we are looking for at this level.
+
+ dir_name = TEXT(""); // find the root first
+ if ( new_level != 0 ) {
+ dir_name = qtc->search_path;
+ for ( i = 1; i < new_level; i++ ) {
+ while ( *dir_name++ );
+ }
+ }
+
+ // Initialize a pointer to this new entry's name.
+
+ ((CHAR_PTR)s)[ ((INT)name->size - (INT)name->xtra_size - sizeof( QTC_NAME ))/ sizeof (CHAR) ] = TEXT ('\0');
+
+ if ( ! stricmp( (CHAR_PTR)s, dir_name ) ) {
+
+ // We matched at this level, move down one deeper.
+
+ current_level = new_level + 1;
+ }
+ else {
+ current_level = new_level;
+ }
+
+ }
+
+ // We are done as soon as this we need to look one deeper than
+ // what our goal was.
+
+ } while ( current_level < final_level );
+
+ return( SUCCESS );
+
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ Starting at offset in the directory name file, this routine will look
+ for an entry with size == requested_size. Max is the ending offset
+ for data to be searched, usually the end of this BSET. Init is TRUE
+ if this is the first call. The name structure will
+ be filled in with the answer for you. If requested_size == 0, it
+ returns the first one found.
+
+******************/
+
+INT QTC_FastSearchForDir(
+QTC_QUERY_PTR qtc, // I - query structure to use
+UINT32_PTR offset, // I/O - file offset to start/finished at
+UINT32 max, // I - how far from offset can we look
+INT requested_size, // I - size of requested name
+INT init ) // I - is this the first call
+{
+ UINT bytes_left;
+ INT Error;
+ QTC_NAME UNALIGNED * name;
+ BYTE_PTR s;
+
+
+ name = (QTC_NAME UNALIGNED *)qtc->buff1;
+
+ if ( init ) {
+ qtc->search_index = 0;
+ qtc->search_max = 0;
+ qtc->search_base = *offset;
+ QTC_SeekFile( qtc->fh, *offset );
+ }
+
+ /** find dir name in dir names **/
+
+ while ( TRUE ) {
+
+ *offset = qtc->search_base + (UINT32)qtc->search_index;
+
+ s = (BYTE_PTR)name;
+
+ // copy structure
+
+ if ( qtc->search_index + sizeof( QTC_NAME ) <= qtc->search_max ) {
+
+ memcpy( s, &(qtc->buff2[ qtc->search_index ]), sizeof( QTC_NAME ) );
+ qtc->search_index += sizeof( QTC_NAME );
+ }
+ else {
+
+ // Slow copy to handle buffer break
+
+ memcpy( s,
+ &(qtc->buff2[ qtc->search_index ]),
+ qtc->search_max - qtc->search_index );
+
+
+ s += qtc->search_max - qtc->search_index;
+
+ bytes_left = sizeof(QTC_NAME) - ( qtc->search_max - qtc->search_index );
+
+ if ( (qtc->search_base + qtc->search_max) >= max ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_base += qtc->search_max;
+
+ qtc->search_max = (UINT16)min( (INT32)QTC_BUF_SIZE, max - qtc->search_base );
+
+ QTC_SeekFile( qtc->fh, qtc->search_base );
+
+ qtc->search_max = (UINT16)QTC_ReadFile( qtc->fh, qtc->buff2, (INT)qtc->search_max, &Error );
+
+ if ( qtc->search_max < (UINT16)bytes_left ) {
+ return( QTC_NO_MORE );
+ }
+
+ memcpy( s, &(qtc->buff2[ 0 ]), bytes_left );
+
+ qtc->search_index = (UINT16)bytes_left;
+
+ s = (BYTE_PTR)name;
+ }
+
+ if ( ( requested_size == (INT)name->size - (INT)name->xtra_size ) ||
+ ( requested_size == 0 ) ) {
+
+ // Copy variable sized name part,
+ // we are going to return this entry.
+
+ s += sizeof( QTC_NAME );
+
+ if ( ( qtc->search_index +
+ (INT16)name->size - sizeof(QTC_NAME) ) <= qtc->search_max ) {
+
+ memcpy( s,
+ &(qtc->buff2[ qtc->search_index ]),
+ (INT)name->size - sizeof( QTC_NAME ) );
+
+ qtc->search_index += (UINT16)(name->size - sizeof( QTC_NAME ));
+ }
+ else {
+
+ // Slow copy to handle buffer break
+
+ memcpy( s,
+ &(qtc->buff2[ qtc->search_index ]),
+ (INT)name->size - sizeof(QTC_NAME) );
+
+ s += qtc->search_max - qtc->search_index;
+
+ bytes_left = (INT)name->size - sizeof(QTC_NAME) - ( qtc->search_max - qtc->search_index );
+
+ qtc->search_base += qtc->search_max;
+
+ if ( qtc->search_base >= max ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_max = (UINT16)min( (INT32)QTC_BUF_SIZE, max - qtc->search_base );
+
+ QTC_SeekFile( qtc->fh, qtc->search_base );
+
+ qtc->search_max = (UINT16)QTC_ReadFile( qtc->fh, qtc->buff2, (INT)qtc->search_max, &Error );
+
+ if ( qtc->search_max < (UINT16)bytes_left ) {
+ return( QTC_NO_MORE );
+ }
+
+ memcpy( s,
+ &(qtc->buff2[ 0 ]),
+ bytes_left );
+
+ qtc->search_index = (UINT16)bytes_left;
+
+ }
+
+ return( QTC_SUCCESS );
+ }
+ else {
+
+ // skip worthless data
+
+ if ( (UINT16)( qtc->search_index + (INT)name->size - sizeof(QTC_NAME) ) <= qtc->search_max ) {
+
+ qtc->search_index += (UINT16)(name->size - sizeof( QTC_NAME ));
+ }
+ else {
+
+ bytes_left = (INT)name->size - sizeof(QTC_NAME) - ( qtc->search_max - qtc->search_index );
+
+ qtc->search_base += qtc->search_max;
+
+ if ( qtc->search_base >= max ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_max = (UINT16)min( (INT32)QTC_BUF_SIZE, max - qtc->search_base );
+
+ QTC_SeekFile( qtc->fh, qtc->search_base );
+
+ qtc->search_max = (UINT16)QTC_ReadFile( qtc->fh, qtc->buff2, (INT)qtc->search_max, &Error );
+
+ if ( qtc->search_max < (UINT16)bytes_left ) {
+ return( QTC_NO_MORE );
+ }
+
+ qtc->search_index = (UINT16)bytes_left;
+ }
+
+ }
+
+ }
+
+ return( QTC_FAILURE );
+}
+
+
+/*
+ Here's how this works, to keep up the speed of searches, we created
+ two copies of the name comparison code. One if the bset is ascii,
+ and the other if the bset is unicode. We have two search name fields
+ already filled in. A one time conversion, to last the entire search.
+*/
+
+INT QTC_TryToMatchFile(
+QTC_QUERY_PTR qtc,
+BYTE_PTR file_name )
+{
+ INT ret = -1;
+
+#ifdef NO_UNICODE
+
+ // The UI has no desire to support anything having to do with unicode.
+
+ if ( ! ( qtc->bset->status & QTC_UNICODE ) ) {
+ ret = QTC_CompNormalNames( (CHAR_PTR)qtc->search_name,
+ (CHAR_PTR)file_name );
+ }
+
+#else
+
+ if ( gb_QTC.unicode ) {
+ ret = QTC_CompUnicodeNames( (WCHAR_PTR)qtc->search_name,
+ (WCHAR_PTR)file_name );
+ }
+ else {
+ ret = QTC_CompAsciiNames( (ACHAR_PTR)qtc->search_name,
+ (ACHAR_PTR)file_name );
+ }
+#endif
+
+ return( ret );
+}
+
+#if defined(NO_UNICODE)
+
+INT QTC_CompNormalNames( CHAR_PTR srch_name, CHAR_PTR file_name )
+{
+ INT pos = 0; /* index for file_name */
+ INT i; /* index for wild_name */
+ INT ret_val = 0;
+ CHAR_PTR p;
+ CHAR save_char;
+ INT ptrn_len;
+
+ pos = 0;
+
+ if ( strcmp( srch_name, "*.*" ) ) {
+
+ for ( i = 0; (srch_name[i] != 0) && (ret_val == 0); i++ ) {
+
+ switch( srch_name[i] ) {
+
+ case '*':
+
+ while ( srch_name[i+1] != 0 ) {
+
+ if ( srch_name[i+1] == '?' ) {
+ if ( file_name[ ++pos ] == 0 ) {
+ break;
+ }
+
+ }
+ else {
+ if ( srch_name[i+1] != '*' ) {
+ break;
+ }
+ }
+ i++;
+ }
+
+ p = strpbrk( &srch_name[i+1], TEXT ("*?") );
+
+ if ( p != NULL ) {
+ save_char = *p;
+ *p = 0;
+
+ ptrn_len = strlen( &srch_name[i+1] );
+
+ while ( file_name[pos] &&
+ strnicmp( &file_name[pos], &srch_name[i+1], ptrn_len ) ) {
+ pos++;
+ }
+
+ i += ptrn_len;
+
+ *p = save_char;
+
+ if ( file_name[pos] == 0 ) {
+ ret_val = -1;
+ } else {
+ pos++;
+ }
+ }
+ else {
+ if ( srch_name[i+1] == 0 ) {
+ pos = strlen( file_name );
+ break;
+ }
+ else {
+
+ p = strchr( &file_name[pos], srch_name[i+1] );
+ if ( p != NULL ) {
+ pos += p - &file_name[pos];
+ }
+ else {
+ ret_val = -1;
+ }
+ }
+ }
+ break;
+
+ case '?' :
+ if ( file_name[pos] != 0 ) {
+ pos++;
+ }
+ break;
+
+ default:
+ if ( ( file_name[pos] == 0 ) ||
+ ( toupper(file_name[pos]) != toupper(srch_name[i]) ) ){
+ ret_val = -1;
+ }
+ else {
+ pos++;
+ }
+ }
+ }
+
+ if ( file_name[pos] != 0 ) {
+ ret_val = -1;
+ }
+ }
+
+ return( ret_val );
+}
+
+#else
+
+INT QTC_CompAsciiNames( ACHAR_PTR srch_name, ACHAR_PTR file_name )
+{
+ INT pos = 0; /* index for file_name */
+ INT i; /* index for wild_name */
+ INT ret_val = 0;
+ ACHAR_PTR p;
+ ACHAR save_char;
+ INT ptrn_len;
+
+ pos = 0;
+
+ if ( strcmpA( srch_name, "*.*" ) ) {
+
+ for ( i = 0; (srch_name[i] != 0) && (ret_val == 0); i++ ) {
+
+ switch( srch_name[i] ) {
+
+ case '*':
+
+ while ( srch_name[i+1] != 0 ) {
+
+ if ( srch_name[i+1] == '?' ) {
+ if ( file_name[ ++pos ] == 0 ) {
+ break;
+ }
+
+ }
+ else {
+ if ( srch_name[i+1] != '*' ) {
+ break;
+ }
+ }
+ i++;
+ }
+
+ p = strpbrkA( &srch_name[i+1], "*?" );
+
+ if ( p != NULL ) {
+ save_char = *p;
+ *p = 0;
+
+ ptrn_len = strlenA( &srch_name[i+1] );
+
+ while ( file_name[pos] &&
+ strnicmpA( &file_name[pos], &srch_name[i+1], ptrn_len ) ) {
+ pos++;
+ }
+
+ i += ptrn_len;
+
+ *p = save_char;
+
+ if ( file_name[pos] == 0 ) {
+ ret_val = -1;
+ } else {
+ pos++;
+ }
+ }
+ else {
+ if ( srch_name[i+1] == 0 ) {
+ pos = strlenA( file_name );
+ break;
+ }
+ else {
+
+ p = strchrA( &file_name[pos], srch_name[i+1] );
+ if ( p != NULL ) {
+ pos += p - &file_name[pos];
+ }
+ else {
+ ret_val = -1;
+ }
+ }
+ }
+ break;
+
+ case '?' :
+ if ( file_name[pos] != 0 ) {
+ pos++;
+ }
+ break;
+
+ default:
+ if ( ( file_name[pos] == 0 ) ||
+ ( toupper(file_name[pos]) != toupper(srch_name[i]) ) ){
+ ret_val = -1;
+ }
+ else {
+ pos++;
+ }
+ }
+ }
+
+ if ( file_name[pos] != 0 ) {
+ ret_val = -1;
+ }
+ }
+
+ return( ret_val );
+}
+
+
+
+INT QTC_CompUnicodeNames( WCHAR_PTR srch_name, WCHAR_PTR file_name )
+{
+#ifdef UNICODE
+
+ INT pos = 0; /* index for file_name */
+ INT i; /* index for wild_name */
+ INT ret_val = 0;
+ WCHAR_PTR p;
+ WCHAR save_char;
+ WCHAR stardotstar[ 4 ];
+ WCHAR starquestion[ 4 ];
+ INT ptrn_len;
+
+ strcpy( stardotstar, TEXT( "*.*" ) );
+
+ strcpy( starquestion, TEXT( "*?" ) );
+
+ pos = 0;
+
+ if ( wcscmp( srch_name, stardotstar ) ) {
+
+ for ( i = 0; (srch_name[i] != TEXT('\0')) && (ret_val == 0); i++ ) {
+
+ switch ( srch_name[i] ) {
+
+ case TEXT('*'):
+
+ while ( srch_name[i+1] != TEXT('\0') ) {
+
+ if ( srch_name[i+1] == TEXT('?') ) {
+ if ( file_name[ ++pos ] == TEXT('\0') ) {
+ break;
+ }
+
+ }
+ else {
+ if ( srch_name[i+1] != TEXT('*') ) {
+ break;
+ }
+ }
+ i++;
+ }
+
+ p = wcspbrk( &srch_name[i+1], starquestion );
+
+ if ( p != NULL ) {
+ save_char = *p;
+ *p = TEXT('0');
+
+ ptrn_len = wcslen( &srch_name[i+1] );
+
+ while ( file_name[pos] &&
+ wcsnicmp( &file_name[pos], &srch_name[i+1], ptrn_len ) ) {
+ pos++;
+ }
+
+ i += ptrn_len;
+
+ *p = save_char;
+
+ if ( file_name[pos] == TEXT('\0') ) {
+ ret_val = -1;
+ } else {
+ pos++;
+ }
+ }
+ else {
+ if ( srch_name[i+1] == TEXT('\0') ) {
+ pos = wcslen( file_name );
+ break;
+ }
+ else {
+
+ p = wcschr( &file_name[pos], srch_name[i+1] );
+ if ( p != NULL ) {
+ pos += p - &file_name[pos];
+ }
+ else {
+ ret_val = -1;
+ }
+ }
+ }
+ break;
+
+ case TEXT('?') :
+ if ( file_name[pos] != TEXT('\0') ) {
+ pos++;
+ }
+ break;
+
+ default:
+ if ( ( file_name[pos] == TEXT('\0') ) ||
+ ( toupper(file_name[pos]) != toupper(srch_name[i]) ) ){
+ ret_val = -1;
+ }
+ else {
+ pos++;
+ }
+ }
+ }
+
+ if ( file_name[pos] != TEXT( '\0' ) ) {
+ ret_val = -1;
+ }
+ }
+ return( ret_val );
+
+#endif
+ return( 0 );
+}
+
+#endif
diff --git a/private/utils/ntbackup/src/qtc_util.c b/private/utils/ntbackup/src/qtc_util.c
new file mode 100644
index 000000000..03588d107
--- /dev/null
+++ b/private/utils/ntbackup/src/qtc_util.c
@@ -0,0 +1,1555 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: QTC_UTIL.C
+
+ Description:
+
+ A lot of utility functions for the catalogs.
+
+ $Log: N:\LOGFILES\QTC_UTIL.C_V $
+
+ Rev 1.32 07 Jan 1994 14:23:18 mikep
+fixes for unicode
+
+ Rev 1.31 11 Dec 1993 11:49:20 MikeP
+fix warnings from unicode compile
+
+ Rev 1.30 06 Dec 1993 09:46:54 mikep
+Very deep path support & unicode fixes
+
+ Rev 1.29 05 Nov 1993 08:46:16 MIKEP
+fix error msg reporting
+
+ Rev 1.28 02 Nov 1993 17:49:14 MIKEP
+fix non-dll build
+
+ Rev 1.27 28 Oct 1993 14:50:14 MIKEP
+dll changes
+
+ Rev 1.26 21 Sep 1993 11:03:26 JOHNES
+Started mallocing long character strings so we would be sure not to
+overflow them. Added some msasserts to make sure this really doesn't happen.
+
+ Rev 1.25 12 Aug 1993 18:22:00 DON
+If were out of disk space say so, not just open failure
+
+ Rev 1.24 24 May 1993 16:56:58 MIKEP
+Fix getting the pba of the vcb so that it always gets the pba
+of the set from the lowest numbered tape available.
+
+ Rev 1.23 19 May 1993 16:18:32 ChuckS
+P_CLIENT || OS_NLM: Added QTC_SetCatUserName function.
+
+ Rev 1.22 13 May 1993 13:18:22 ChuckS
+Revamped QTC usage of virtual memory. Changed queue calls to corresponding
+vm- queue calls; added msassert's to check integrity of vm queue objects
+(q_ptr always points to the object, providing a means of getting the handle,
+if you only have a pointer).
+
+ Rev 1.21 30 Apr 1993 10:12:36 BRYAN
+(fixed compiler warning)
+
+ Rev 1.20 29 Apr 1993 22:26:42 GREGG
+If there is no TapeCatVer stored in the catalog, set it to one.
+
+ Rev 1.19 29 Apr 1993 11:36:38 MIKEP
+add on tape catalog version call
+
+ Rev 1.18 27 Apr 1993 16:14:54 ChuckS
+Broke QTC_RemoveTape into two functions. Calling QTC_RemoveTape should have
+exactly the same effect as before, but clients can now call QTC_ForgetTape,
+which merely discards the memory allocations associated with the tape,
+without attempting to unlink the file.
+
+ Rev 1.17 26 Apr 1993 08:54:18 MIKEP
+Fix qtc_accessfiles call that I didn't quite get right last time.
+
+ Rev 1.15 15 Apr 1993 10:00:30 Stefan
+Changed if !defined(P_CLIENT) to add || defined(OS_WIN) because the windows
+client needs this code.
+
+ Rev 1.14 24 Mar 1993 11:11:22 ChuckS
+Enclosed QTC_OpenTempFiles with #if !defined( P_CLIENT ) ... #endif.
+
+ Rev 1.13 23 Mar 1993 18:00:30 ChuckS
+Added arg to QTC_OpenFile indicating if need to open for writes
+
+ Rev 1.12 23 Mar 1993 10:32:02 BRYAN
+Fixed compiler warnings.
+
+ Rev 1.11 18 Mar 1993 11:35:20 TIMN
+Added two f(x)s to get catalog info: get data path and get filename only
+
+ Rev 1.10 30 Jan 1993 12:06:28 DON
+Removed compiler warnings
+
+ Rev 1.9 27 Jan 1993 11:25:40 CHARLIE
+Eliminated compiler warnings
+
+ Rev 1.8 26 Jan 1993 17:11:04 MIKEP
+vcb changes
+
+ Rev 1.7 25 Jan 1993 09:10:02 MIKEP
+add stdwcs because it seems to need it now
+
+ Rev 1.6 04 Jan 1993 09:35:18 MIKEP
+unicode changes
+
+ Rev 1.4 14 Dec 1992 12:29:36 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.3 20 Nov 1992 13:51:40 CHARLIE
+JAGUAR: Move to SRM based QTC code
+
+ENDEAVOR: Integrated virtual memory usage in anticipation of DOS. These
+changes should be transparent to non DOS products.
+
+ENDEAVOR: chmod sets S_IREAD along with S_IWRITE to fix a novell clib bug
+that made the file hidden for the NLM in QTC_UnlinkFile.
+
+ Rev 1.2 06 Nov 1992 15:30:04 DON
+Change debug.h to be_debug.h and zprintf to BE_Zprintf
+
+ Rev 1.1 09 Oct 1992 11:54:04 MIKEP
+unicode pass
+
+ Rev 1.0 03 Sep 1992 16:56:16 STEVEN
+Initial revision.
+
+****************************************************/
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+#include <sys\types.h>
+#include <sys\stat.h>
+
+#ifdef WIN32 // Needed for file i/o prototypes.
+#include <windows.h>
+#endif
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdwcs.h"
+#include "msassert.h"
+#include "qtc.h"
+
+
+// unicode text macro
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+INT QTC_OpenUniqueTempFile( CHAR_PTR );
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_CouldThisSetCrossTapes(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+INT16 bset_num )
+{
+ QTC_BSET_PTR bset;
+
+ bset = QTC_FindBset( tape_fid, tape_seq_num, bset_num );
+
+ // We don't even have it so who knows.
+
+ if ( bset == NULL ) {
+ return( TRUE );
+ }
+
+ // If it is split, then we know it crosses.
+
+ if ( bset->status & QTC_SPLIT ) {
+ return( TRUE );
+ }
+
+ // If he has a later brother on this tape he doesn't cross.
+
+ bset = QTC_GetNextBset( bset );
+
+ if ( bset != NULL ) {
+ return( FALSE );
+ }
+
+ // No known "Next set", he may cross.
+
+ return( TRUE );
+}
+
+
+
+
+/**********************
+
+ NAME : QTC_AnyCatalogFiles
+
+ DESCRIPTION :
+
+ A quick call for the menu to know if there are any catalog files.
+
+ RETURNS :
+
+**********************/
+
+BOOLEAN QTC_AnyCatalogFiles( VOID )
+{
+ return( (BOOLEAN) vmQueueCount( &gb_QTC.tape_list ) ) ;
+}
+
+
+INT QTC_PartializeTape( UINT32 tape_fid, INT16 tape_seq_num, INT16 bset_num )
+{
+ QTC_TAPE_HEADER tape_header;
+ QTC_HEADER_PTR header;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ INT fd;
+ INT ret;
+ INT Error;
+ INT16 temp_tape_seq_num;
+ INT BytesNeeded;
+ UINT32 temp_tape_fid;
+ UINT32 offset;
+ CHAR_PTR temp_file_name ;
+ CHAR_PTR real_file_name ;
+
+
+ BytesNeeded = strlen( gb_QTC.data_path ) + 13;
+ BytesNeeded *= sizeof( CHAR );
+
+ if ( ( temp_file_name = (CHAR_PTR)malloc( BytesNeeded )) == NULL ) {
+ return ( FAILURE ) ;
+ }
+
+ if ( ( real_file_name = (CHAR_PTR)malloc( BytesNeeded )) == NULL ) {
+ free( temp_file_name ) ;
+ return ( FAILURE ) ;
+ }
+
+ // Look for the right tape.
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+
+ if ( ( ( tape->tape_fid == tape_fid ) ||
+ ( (INT32)tape_fid == -1L ) ) &&
+ ( ( tape->tape_seq_num == tape_seq_num ) ||
+ ( tape_seq_num == -1 ) ) ) {
+
+ temp_tape_fid = tape->tape_fid;
+
+ if ( bset_num == -1 ) {
+
+ // Create a temp file
+
+ fd = QTC_OpenUniqueTempFile( temp_file_name );
+
+ msassert( strlen( temp_file_name ) < (strlen( gb_QTC.data_path ) + 13) ) ;
+
+ if ( fd < 0 ) {
+ free( temp_file_name ) ;
+ free( real_file_name ) ;
+ return( FAILURE );
+ }
+
+ // Write out the QTC header.
+
+ memcpy( tape_header.signature, QTC_SIGNATURE, sizeof(QTC_SIGNATURE) );
+
+ tape_header.major_version = QTC_MAJOR_VERSION;
+ tape_header.minor_version = QTC_MINOR_VERSION;
+
+ ret = QTC_WriteFile( fd, (BYTE_PTR)&tape_header, sizeof( QTC_TAPE_HEADER ), &Error );
+
+ if ( ret != sizeof( QTC_TAPE_HEADER ) ) {
+
+ // tell user he's hosed
+
+ QTC_CloseFile( fd );
+
+ unlink( temp_file_name );
+
+ free( temp_file_name ) ;
+ free( real_file_name ) ;
+
+ return( FAILURE );
+ }
+
+ offset = sizeof( QTC_TAPE_HEADER );
+
+ // Now look for bsets.
+
+ bset = QTC_GetFirstBset( tape );
+
+ // Copy all the headers into it.
+
+ while ( bset != NULL ) {
+
+ temp_tape_seq_num = (INT16)bset->tape_seq_num;
+
+ // Write out all the bsets for this tape.
+
+ while ( bset->tape_seq_num == temp_tape_seq_num ) {
+
+ header = QTC_LoadHeader( bset );
+
+ if ( header == NULL ) {
+ QTC_CloseFile( fd );
+ unlink( temp_file_name );
+
+ free( temp_file_name ) ;
+ free( real_file_name ) ;
+
+ return( FAILURE );
+ }
+
+ bset->status |= QTC_PARTIAL;
+ header->status |= QTC_PARTIAL;
+
+ header->dir_size = 0;
+ header->fil_size = 0;
+ header->rec_size = 0;
+
+ header->offset = offset;
+ bset->offset = offset;
+
+ offset += header->header_size;
+
+ if ( QTC_IsThereAnotherBset( bset ) ) {
+ header->next_bset = offset;
+ }
+ else {
+ header->next_bset = 0L;
+ }
+
+ // write out bset
+
+ ret = QTC_WriteFile( fd, (BYTE_PTR)header, (INT)header->header_size, &Error );
+
+ if ( ret != (INT)header->header_size ) {
+
+ free( header );
+ QTC_CloseFile( fd );
+ unlink( temp_file_name );
+ free( temp_file_name ) ;
+ free( real_file_name ) ;
+
+ return( FAILURE );
+ }
+
+ free( header );
+
+ bset = QTC_GetNextBset( bset );
+
+ if ( bset == NULL ) {
+ break;
+ }
+ }
+
+ QTC_CloseFile( fd );
+
+ // Delete the original.
+
+ QTC_UnlinkFile( temp_tape_fid, temp_tape_seq_num );
+
+ // Rename the temp file.
+
+ QTC_GetFileName( temp_tape_fid, temp_tape_seq_num, real_file_name );
+
+ msassert( strlen( real_file_name ) < (strlen( gb_QTC.data_path ) + 13) ) ;
+
+ rename( temp_file_name, real_file_name );
+ }
+ }
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ free( temp_file_name ) ;
+ free( real_file_name ) ;
+
+ return( SUCCESS );
+}
+
+/*
+ A single bset is being converted to partial. Just change its status
+ bits and leave all the data there.
+*/
+
+INT QTC_PartializeBset(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+INT16 bset_num )
+{
+ QTC_HEADER_PTR header;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+ INT Error;
+ INT fd;
+ INT ret;
+
+ // Look for the right tape.
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+
+ if ( ( ( tape->tape_fid == tape_fid ) ||
+ ( (INT32)tape_fid == -1L ) ) &&
+ ( ( tape->tape_seq_num == tape_seq_num ) ||
+ ( tape_seq_num == -1 ) ) ) {
+
+ // mark the set as partial in memory and on disk.
+
+ // Now look for bsets.
+
+ bset = QTC_GetFirstBset( tape );
+
+ // Copy all the headers into it.
+
+ while ( bset != NULL ) {
+
+ // Find the one bset that is changing.
+
+ if ( bset->bset_num == bset_num ) {
+
+ header = QTC_LoadHeader( bset );
+
+ if ( header == NULL ) {
+ return( FAILURE );
+ }
+
+ bset->status |= QTC_PARTIAL; // in memory queue
+
+ header->status |= QTC_PARTIAL; // structure going out to disk
+ header->dir_size = 0;
+ header->fil_size = 0;
+ header->rec_size = 0;
+
+ fd = QTC_OpenFile( bset->tape_fid, (INT16)bset->tape_seq_num, TRUE, FALSE );
+
+ if ( fd < 0 ) {
+ return( FAILURE );
+ }
+
+ QTC_SeekFile( fd, bset->offset );
+
+ ret = QTC_WriteFile( fd, (BYTE_PTR)header, (INT)header->header_size, &Error );
+
+ QTC_CloseFile( fd );
+
+ if ( ret != (INT)header->header_size ) {
+
+ free( header );
+ return( FAILURE );
+ }
+
+ free( header );
+ }
+
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME : QTC_Partialize
+
+ DESCRIPTION :
+
+ The user has requested by way of catalog maintenance, that this tape be
+ converted to partially cataloged to save disk space. Rewrite the file
+ onto disk leaving out all data sets.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_Partialize(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+INT16 bset_num )
+{
+ INT error;
+
+ if ( bset_num == -1 ) {
+ error = QTC_PartializeTape( tape_fid, tape_seq_num, bset_num );
+ }
+ else {
+ error = QTC_PartializeBset( tape_fid, tape_seq_num, bset_num );
+ }
+
+ return( error );
+}
+
+/**********************
+
+ NAME : QTC_GetMeTheVCBPBA
+
+ DESCRIPTION :
+
+ Another of those FFR support routines. Returns the PBA of the VCB for
+ this BSET on this FID.
+
+ RETURNS :
+
+**********************/
+
+INT32 QTC_GetMeTheVCBPBA(
+UINT32 tape_fid,
+INT16 tape_num,
+INT16 bset_num )
+{
+ QTC_BSET_PTR best_bset = NULL;
+ QTC_HEADER_PTR header;
+ UINT32 PBA_VCB = 0L;
+ BOOLEAN done = FALSE;
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL && ! done ) {
+
+ if ( ( tape->tape_fid == tape_fid ) &&
+ ( ( tape->tape_seq_num == tape_num ) ||
+ ( tape_num == -1 ) ) ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL && ! done ) {
+
+ if ( bset->bset_num == bset_num ) {
+
+ if ( best_bset == NULL ) {
+
+ best_bset = bset;
+
+ // if its all on one tape we are done.
+
+ if ( ! (best_bset->status & (QTC_SPLIT | QTC_CONTINUATION) ) ) {
+ done = TRUE;
+ }
+ }
+ else {
+ if ( best_bset->tape_seq_num > bset->tape_seq_num ) {
+ best_bset = bset;
+ }
+ }
+ if ( best_bset->tape_seq_num == 1 ) {
+ done = TRUE;
+ }
+ }
+
+ bset = QTC_GetNextBset( bset );
+ }
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ if ( best_bset != NULL ) {
+
+ header = QTC_LoadHeader( best_bset );
+
+ if ( header ) {
+ PBA_VCB = header->PBA_VCB;
+ free( header );
+ }
+ }
+
+ return( PBA_VCB );
+
+}
+
+
+
+/**********************
+
+ NAME : QTC_GetMeTheTapeCatVer
+
+ DESCRIPTION :
+
+ Another of those FFR support routines.
+ Returns the on tape catalog version.
+
+ RETURNS :
+
+**********************/
+
+UINT8 QTC_GetMeTheTapeCatVer(
+UINT32 tape_fid,
+INT16 tape_num,
+INT16 bset_num )
+{
+ QTC_BSET_PTR bset;
+ QTC_HEADER_PTR header;
+ UINT8 TapeCatVer = (UINT8)0;
+
+ bset = QTC_FindBset( tape_fid, tape_num, bset_num );
+
+ if ( bset != NULL ) {
+ header = QTC_LoadHeader( bset );
+
+ if ( header ) {
+ if( ( TapeCatVer = (UINT8) header->FDD_Version ) == 0 ) {
+ TapeCatVer = 1 ;
+ }
+ free( header );
+ }
+ }
+
+ return( TapeCatVer );
+}
+
+
+
+/**********************
+
+ NAME : QTC_RemoveTape
+
+ DESCRIPTION :
+
+ This tape is going to be written over, so remove all information from the
+ catalogs for it. Or the user has requested we delete this tape from the
+ catalogs in the maintenance option.
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_RemoveTape(
+UINT32 tape_fid, // I - the family ID
+INT16 tape_seq_num ) // I - the sequence number
+{
+ QTC_TAPE_PTR tape;
+
+ tape = QTC_GetFirstTape();
+
+ while ( tape != NULL ) {
+
+ if ( ( tape->tape_fid == tape_fid ) &&
+ ( ( tape->tape_seq_num == tape_seq_num ) ||
+ ( tape_seq_num == -1 ) ) ) {
+
+ // Delete file from disk
+ QTC_UnlinkFile( tape->tape_fid, tape->tape_seq_num );
+
+ // remove it from our list
+ QTC_ForgetTape( tape ) ;
+ tape = NULL;
+ }
+
+ if ( tape == NULL ) {
+ tape = QTC_GetFirstTape();
+ }
+ else {
+ tape = QTC_GetNextTape( tape );
+ }
+ }
+}
+
+
+
+
+/**********************
+
+ NAME : QTC_ForgetTape
+
+ DESCRIPTION :
+
+ This is code broken out of the bottom of QTC_RemoveTape. It takes care
+ of freeing the queue of QTC_BSET's associated with the tape, and the
+ QTC_TAPE record itself.
+
+ This function was created because the client may want to remove all
+ record of a tape, without necessarily erasing the tape file.
+
+
+* IMPORTANT NOTE *
+
+ It is IMPERATIVE that the caller NOT USE the QTC_TAPE_PTR he passed in,
+ after this function returns. i,e, safe usage is:
+
+ QTC_ForgetTape( tape ) ;
+ tape = NULL ;
+
+ RETURNS :
+
+**********************/
+VOID QTC_ForgetTape(
+ QTC_TAPE_PTR tape
+)
+{
+ VQ_HDL hBset ;
+ VQ_HDL hTape ;
+
+ hBset = vmDeQueueElem( &( tape->bset_list ) ) ;
+
+ while ( hBset != (VQ_HDL) NULL ) {
+ if ( hBset == v_bset_item ) {
+ VM_MemUnLock( qtc_vmem_hand, hBset ) ;
+ v_bset_item = (VM_PTR) NULL ;
+ }
+
+ VM_Free( qtc_vmem_hand, hBset ) ;
+ hBset = vmDeQueueElem( &(tape->bset_list) ) ;
+ }
+
+ // Now remove that tape from the tapes list
+ vmRemoveQueueElem( &(gb_QTC.tape_list), ( hTape = tape->q_elem.q_ptr ) ) ;
+
+ if ( hTape == v_tape_item ) {
+ // if it happens to be the current tape item, unlock it and NULL v_tape_item
+ VM_MemUnLock( qtc_vmem_hand, hTape ) ;
+ v_tape_item = (VQ_HDL) NULL ;
+ }
+
+ VM_Free( qtc_vmem_hand, hTape ) ;
+}
+
+
+/**********************
+
+ NAME : QTC_CheckFilesAccess
+
+ DESCRIPTION :
+
+ Check to see if any files are gone from the disk and delete them
+ if they are.
+
+ RETURNS :
+
+**********************/
+
+INT QTC_CheckFilesAccess( )
+{
+ QTC_TAPE_PTR tape;
+ VQ_HDL hBset ;
+ CHAR_PTR path ;
+ INT BytesNeeded;
+
+ BytesNeeded = strsize( gb_QTC.data_path ) + 13;
+ BytesNeeded *= sizeof(CHAR );
+
+ if ( ( path = (CHAR_PTR)malloc( BytesNeeded ) ) == NULL ) {
+ return ( FAILURE ) ;
+ }
+
+ tape = QTC_GetFirstTape( ) ;
+
+ while ( tape != NULL ) {
+
+ QTC_GetFileName( tape->tape_fid, tape->tape_seq_num, path ) ;
+
+ msassert( strlen( path ) < (strlen( gb_QTC.data_path ) + 13) ) ;
+
+ if ( access( path, 0 ) ) {
+
+ // Remove it from our list
+
+ hBset = vmDeQueueElem( &(tape->bset_list) ) ;
+
+ while ( hBset != (VQ_HDL) NULL ) {
+ if ( hBset == v_bset_item ) {
+ VM_MemUnLock( qtc_vmem_hand, v_bset_item ) ;
+ v_bset_item = (VM_PTR) NULL ;
+ }
+ VM_Free( qtc_vmem_hand, hBset ) ;
+ hBset = vmDeQueueElem( &(tape->bset_list) ) ;
+ }
+
+ // Now remove that tape from the tapes list
+
+ msassert( v_tape_item == tape->q_elem.q_ptr ) ;
+
+ vmRemoveQueueElem( &(gb_QTC.tape_list), v_tape_item ) ;
+ VM_MemUnLock( qtc_vmem_hand, v_tape_item );
+ VM_Free( qtc_vmem_hand, v_tape_item ) ;
+ tape = NULL ;
+ }
+
+ if ( tape != NULL ) {
+ tape = QTC_GetNextTape( tape ) ;
+ } else {
+ tape = QTC_GetFirstTape() ;
+ }
+ }
+
+ free( path ) ;
+
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME : QTC_GetFirstTape
+
+ DESCRIPTION :
+
+ Get a pointer to the first tape in the catalogs
+
+ RETURNS :
+
+**********************/
+
+QTC_TAPE_PTR QTC_GetFirstTape( )
+{
+ VQ_HDL hTape ;
+
+ hTape = vmQueueHead( &(gb_QTC.tape_list) ) ;
+
+ if ( hTape != (VQ_HDL) NULL ) {
+ VM_MemUnLock( qtc_vmem_hand, v_tape_item ) ;
+ return( (QTC_TAPE_PTR)VM_MemLock( qtc_vmem_hand, v_tape_item = hTape, VM_READ_WRITE ) ) ;
+ }
+
+ return( NULL ) ;
+}
+
+
+/**********************
+
+ NAME : QTC_GetNextTape
+
+ DESCRIPTION :
+
+ Get a pointer to the next tape in the catalogs
+
+ RETURNS :
+
+**********************/
+
+QTC_TAPE_PTR QTC_GetNextTape(
+QTC_TAPE_PTR tape ) // I - current tape
+{
+ VQ_HDL hTape ;
+
+ hTape = vmQueueNext( &tape->q_elem ) ;
+
+ if ( hTape != (VQ_HDL) NULL ) {
+ VM_MemUnLock( qtc_vmem_hand, v_tape_item ) ;
+ return( (QTC_TAPE_PTR)VM_MemLock( qtc_vmem_hand, v_tape_item = hTape, VM_READ_WRITE ) ) ;
+ }
+
+ return( NULL );
+}
+
+
+/**********************
+
+ NAME : QTC_GetPrevTape
+
+ DESCRIPTION :
+
+ Get a pointer to the previous tape in the catalog
+
+ RETURNS :
+
+**********************/
+
+QTC_TAPE_PTR QTC_GetPrevTape(
+QTC_TAPE_PTR tape ) // I - current tape
+{
+ VQ_HDL hTape ;
+
+ hTape = vmQueuePrev( &( tape->q_elem ) ) ;
+
+ if ( hTape != (VQ_HDL) NULL ) {
+ VM_MemUnLock( qtc_vmem_hand, v_tape_item ) ;
+ return( (QTC_TAPE_PTR)VM_MemLock( qtc_vmem_hand, hTape, VM_READ_WRITE ) ) ;
+ }
+
+ return( NULL ) ;
+}
+
+
+
+
+/**********************
+
+ NAME : QTC_GetDataPath
+
+ DESCRIPTION :
+
+ Returns global path where catalog files reside.
+
+ RETURNS : TRUE if successful, FALSE if not enough space to copy path
+
+**********************/
+
+BOOLEAN QTC_GetDataPath( CHAR_PTR path, INT16 pathSize )
+{
+ BOOLEAN retValu = TRUE;
+
+ if ( pathSize > (INT16)strsize( gb_QTC.data_path ) ) {
+ strcpy( path, gb_QTC.data_path );
+ }
+ else {
+ *path = TEXT( '\0' );
+ retValu = FALSE;
+ }
+
+ return( retValu );
+}
+
+
+/**********************
+
+ NAME : QTC_GetFileName
+
+ DESCRIPTION :
+
+ Builds the complete path and file name for a catalog file.
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_GetFileName(
+UINT32 tape_fid,
+INT16 tape_seq,
+CHAR_PTR name )
+{
+ CHAR temp[13];
+
+ strcpy( name, gb_QTC.data_path );
+ QTC_GetFileNameOnly( tape_fid, tape_seq, temp ) ;
+ strcat( name, temp );
+}
+
+
+/**********************
+
+ NAME : QTC_GetFileNameOnly
+
+ DESCRIPTION :
+
+ Builds only the file name for a catalog file.
+
+ RETURNS :
+
+**********************/
+
+CHAR_PTR QTC_GetFileNameOnly(
+UINT32 tape_fid,
+INT16 tape_seq,
+CHAR_PTR name )
+{
+ INT i;
+ static CHAR hex[16] = { TEXT('0'), TEXT('1'), TEXT('2'), TEXT('3'),
+ TEXT('4'), TEXT('5'), TEXT('6'), TEXT('7'),
+ TEXT('8'), TEXT('9'), TEXT('A'), TEXT('B'),
+ TEXT('C'), TEXT('D'), TEXT('E'), TEXT('F') };
+
+ if ( gb_QTC.unicode ) {
+ sprintf( name, TEXT("00000000.U%02d"), tape_seq );
+ }
+ else {
+ sprintf( name, TEXT("00000000.D%02d"), tape_seq );
+ }
+
+ for ( i = 7; i >= 0; i-- ) {
+ name[ i ] = hex[ tape_fid & 0x0f ];
+ tape_fid >>= 4;
+ }
+
+ return( name ) ;
+}
+
+
+/**********************
+
+ NAME : QTC_UnlinkFile
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_UnlinkFile( UINT32 tape_fid, INT16 tape_seq_num )
+{
+ CHAR_PTR name;
+ INT BytesNeeded;
+
+ BytesNeeded = strsize( gb_QTC.data_path ) + 13;
+ BytesNeeded *= sizeof(CHAR);
+
+ if ( ( name = (CHAR_PTR)malloc( BytesNeeded ) ) == NULL ) {
+ return ( FAILURE ) ;
+ }
+
+ QTC_GetFileName( tape_fid, tape_seq_num, name );
+
+ msassert( strlen( name ) < strlen( gb_QTC.data_path ) + 13 ) ;
+
+ // Make sure they haven't set it to read only.
+
+ chmod( name, S_IREAD | S_IWRITE );
+
+ if ( unlink( name ) ) {
+ free ( name );
+ return( FAILURE );
+ }
+
+ free ( name );
+
+ return( SUCCESS );
+}
+
+
+// Squeeze it.
+
+INT QTC_CompressFile( UINT32 tape_fid, INT16 tape_seq_num )
+{
+ (VOID)tape_fid;(VOID)tape_seq_num;
+
+ // rename it
+
+ // open new file, and start copying blocks
+
+ // delete old renamed one
+
+
+ return( SUCCESS );
+}
+
+UINT32 QTC_GetKiloBytesWasted( UINT32 tape_fid, UINT16 tape_seq_num )
+{
+ (VOID)tape_fid;
+ (VOID)tape_seq_num;
+
+ return( 0L );
+}
+
+
+
+INT QTC_Open( CHAR_PTR szFile, INT fCreate, INT fWrite, INT *Error )
+{
+ INT fd = -1;
+ INT nError;
+
+ *Error = 0;
+ (void)nError;
+
+ #ifdef WIN32
+
+ if ( fCreate ) {
+ fd = (INT)CreateFile( szFile,
+ (DWORD)(GENERIC_READ|GENERIC_WRITE),
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ (HANDLE)NULL );
+ }
+ else {
+ fd = (INT)CreateFile( szFile,
+ (DWORD)( fWrite ? GENERIC_READ|GENERIC_WRITE : GENERIC_READ ),
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ (HANDLE)NULL );
+ }
+
+ if ( fd < 0 ) {
+
+ nError = GetLastError();
+
+ switch ( nError ) {
+
+ case ERROR_HANDLE_DISK_FULL:
+ *Error = QTC_DISK_FULL;
+ break;
+
+ case ERROR_TOO_MANY_OPEN_FILES:
+ *Error = QTC_NO_FILE_HANDLES;
+ break;
+
+ default:
+ *Error = QTC_OPEN_FAILED; // Start with generic case.
+ break;
+ }
+
+ }
+
+ #else
+
+ if ( fCreate ) {
+ fd = sopen( szFile, O_CREAT|O_RDWR|O_BINARY, SH_DENYNO, S_IWRITE|S_IREAD );
+ }
+ else {
+ fd = sopen( szFile, ( fWrite ? O_RDWR:O_RDONLY ) | O_BINARY, SH_DENYNO, S_IWRITE|S_IREAD ) ;
+ }
+
+ if ( fd < 0 ) {
+
+ *Error = QTC_OPEN_FAILED; // Start with generic case.
+
+ if ( errno == ENOSPC ) { // Try fr specific things
+ *Error = QTC_DISK_FULL;
+ }
+ if ( errno == EMFILE ) {
+ *Error = QTC_NO_FILE_HANDLES;
+ }
+ }
+
+ #endif
+
+
+ return( fd );
+}
+
+INT QTC_CloseFile( INT FileHandle )
+{
+ INT ret_val;
+
+ #ifdef WIN32
+ ret_val = (INT)CloseHandle( (HANDLE)FileHandle );
+ #else
+ ret_val = close( FileHandle );
+ #endif
+
+ return( ret_val );
+}
+
+INT QTC_SeekFile( INT FileHandle, INT Offset )
+{
+ INT ret_val;
+
+ #ifdef WIN32
+ ret_val = SetFilePointer( (HANDLE)FileHandle, (LONG)Offset, (PLONG)NULL, FILE_BEGIN );
+ #else
+ ret_val = lseek( FileHandle, Offset, SEEK_SET );
+ #endif
+
+ return( ret_val );
+}
+
+INT QTC_ReadFile( INT FileHandle, BYTE_PTR Buffer, INT Size, INT *Error )
+{
+ INT ret_val;
+
+ #ifdef WIN32
+
+ DWORD BytesRead;
+
+ *Error = 0;
+
+ ret_val = (INT)ReadFile( (HANDLE)FileHandle, Buffer, (DWORD)Size, (LPDWORD)&BytesRead, (LPOVERLAPPED)NULL );
+
+ ret_val = BytesRead;
+
+ if ( (DWORD)Size != BytesRead ) {
+ *Error = QTC_READ_FAILED;
+ }
+
+ #else
+
+ *Error = 0;
+
+ ret_val = read( FileHandle, Buffer, Size );
+
+ if ( ret_val < 0 ) {
+ *Error = QTC_READ_FAILED;
+ }
+
+ #endif
+
+ return( ret_val );
+}
+
+INT QTC_WriteFile( INT FileHandle, BYTE_PTR Buffer, INT Size, INT *Error )
+{
+ INT ret_val;
+
+ #ifdef WIN32
+ DWORD BytesWritten;
+
+ *Error = 0;
+
+ ret_val = (INT)WriteFile( (HANDLE)FileHandle, Buffer, (DWORD)Size, (LPDWORD)&BytesWritten, (LPOVERLAPPED)NULL );
+
+ if ( (DWORD)Size == BytesWritten ) {
+ ret_val = BytesWritten;
+ }
+ else {
+
+ *Error = QTC_WRITE_FAILED;
+
+ if ( GetLastError() == ERROR_HANDLE_DISK_FULL ) {
+ *Error = QTC_DISK_FULL;
+ }
+
+ }
+
+ #else
+
+ *Error = 0;
+
+ ret_val = write( FileHandle, Buffer, Size );
+
+ if ( ret_val != Size ) {
+
+ *Error = QTC_WRITE_FAILED;
+
+ if ( errno == ENOSPC ) {
+ *Error = QTC_DISK_FULL;
+ }
+ }
+
+ #endif
+
+ return( ret_val );
+}
+
+
+
+
+/**********************
+
+ NAME : QTC_OpenFile
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_OpenFile( UINT32 tape_fid, INT16 tape_seq_num, INT write_mode, INT create )
+{
+ INT fd = -1;
+ INT Error;
+ INT BytesNeeded;
+ CHAR_PTR name;
+
+ BytesNeeded = strsize( gb_QTC.data_path ) + 13;
+ BytesNeeded *= sizeof(CHAR);
+
+ if ( ( name = (CHAR_PTR)malloc( BytesNeeded ) ) == NULL ) {
+ return ( fd ) ;
+ }
+
+ QTC_GetFileName( tape_fid, tape_seq_num, name );
+
+ // open files and share them with every one
+
+ if ( access( name, 0 ) ) {
+
+ if ( create ) {
+
+ msassert( write_mode != FALSE ) ;
+
+ fd = QTC_Open( name, TRUE, TRUE, &Error );
+ }
+ }
+ else {
+ fd = QTC_Open( name, FALSE, write_mode, &Error ) ;
+ }
+
+ free ( name ) ;
+
+ return( fd );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_OpenUniqueTempFile( CHAR_PTR file )
+{
+ INT file_number = 0;
+ INT Error;
+
+ do {
+
+ if ( file_number == 1000 ) {
+ return( FAILURE );
+ }
+
+ sprintf( file, TEXT("%sQTC_TEMP.%03d"), gb_QTC.data_path, file_number++ );
+
+ } while ( ! access( file, 0 ) );
+
+ // Now we have a unique file name, try to open it.
+
+ return( QTC_Open( file, TRUE, TRUE, &Error ) );
+
+}
+
+
+
+#if !defined( P_CLIENT ) || defined( OS_WIN )
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT QTC_OpenTempFiles(
+QTC_BUILD_PTR build )
+{
+
+ build->fh_rec = -1;
+ build->fh_dir = -1;
+ build->fh_fil = -1;
+
+ build->fh_fil = QTC_OpenUniqueTempFile( build->fil_file );
+
+ if ( build->fh_fil < 0 ) {
+
+ if ( errno == ENOSPC ) {
+ build->error = QTC_DISK_FULL;
+ }
+ else if ( errno == EMFILE ) {
+ build->error = QTC_NO_FILE_HANDLES;
+ }
+ else {
+ build->error = QTC_OPEN_FAILED;
+ }
+ build->state = QTC_ERROR_STATE;
+ QTC_CloseFile( build->fh_rec );
+ build->fh_rec = INVALID_HANDLE_VALUE ;
+ return( FAILURE );
+ }
+
+ build->fh_rec = QTC_OpenUniqueTempFile( build->rec_file );
+
+ if ( build->fh_rec < 0 ) {
+
+ if ( errno == ENOSPC ) {
+ build->error = QTC_DISK_FULL;
+ }
+ else if ( errno == EMFILE ) {
+ build->error = QTC_NO_FILE_HANDLES;
+ }
+ else {
+ build->error = QTC_OPEN_FAILED;
+ }
+ build->state = QTC_ERROR_STATE;
+ return( FAILURE );
+ }
+
+
+ build->fh_dir = QTC_OpenUniqueTempFile( build->dir_file );
+
+ if ( build->fh_dir < 0 ) {
+
+ if ( errno == ENOSPC ) {
+ build->error = QTC_DISK_FULL;
+ }
+ else if ( errno == EMFILE ) {
+ build->error = QTC_NO_FILE_HANDLES;
+ }
+ else {
+ build->error = QTC_OPEN_FAILED;
+ }
+ build->state = QTC_ERROR_STATE;
+ QTC_CloseFile( build->fh_rec );
+ build->fh_rec = INVALID_HANDLE_VALUE ;
+ QTC_CloseFile( build->fh_fil );
+ build->fh_fil = INVALID_HANDLE_VALUE ;
+ return( FAILURE );
+ }
+
+ build->files_open = TRUE;
+
+ return( SUCCESS );
+}
+#endif
+
+
+QTC_HEADER_PTR QTC_LoadHeader( QTC_BSET_PTR bset )
+{
+ QTC_HEADER_PTR header = NULL;
+ QTC_HEADER temp_header;
+ INT Error;
+ INT fh;
+ INT ret;
+
+ // load it from file.
+
+ // open file
+
+ fh = QTC_OpenFile( bset->tape_fid, (UINT16)bset->tape_seq_num, FALSE, FALSE );
+
+ if ( fh < 0 ) {
+ return( NULL );
+ }
+
+ // seek file
+
+ QTC_SeekFile( fh, bset->offset );
+
+ // read file
+
+ ret = QTC_ReadFile( fh, (BYTE_PTR)&temp_header, sizeof( QTC_HEADER ), &Error );
+
+ if ( ret != sizeof( QTC_HEADER ) ) {
+ return( NULL );
+ }
+
+ header = (QTC_HEADER_PTR)malloc( (INT)temp_header.header_size );
+
+ if ( header == NULL ) {
+ return( NULL );
+ }
+
+ QTC_SeekFile( fh, bset->offset );
+
+ ret = QTC_ReadFile( fh, (BYTE_PTR)header, (INT)temp_header.header_size, &Error );
+
+ if ( ret != (INT)temp_header.header_size ) {
+ free( header );
+ return( NULL );
+ }
+
+ // close file
+
+ QTC_CloseFile( fh );
+
+ header->offset = bset->offset;
+
+ // Quick sanity check
+
+ if ( ( bset->tape_fid != header->tape_fid ) ||
+ ( bset->tape_seq_num != header->tape_seq_num ) ||
+ ( bset->bset_num != header->bset_num ) ) {
+
+ msassert( FALSE );
+ free( header );
+ return( NULL );
+ }
+
+ // Fun test for safety.
+
+ if ( header->status & ( QTC_IMAGE | QTC_PARTIAL ) ) {
+
+ header->dir_size = 0;
+ header->rec_size = 0;
+ header->fil_size = 0;
+ }
+
+ // Update bset pointers
+
+ header->rec_start = header->offset + header->header_size;
+ header->dir_start = header->rec_start + header->rec_size;
+ header->fil_start = header->dir_start + header->dir_size;
+
+ // set up string pointers
+
+ header = QTC_SetUpStrings( header );
+
+ return( header );
+}
+
+
+
+// The string pointers in the header data structure need to be pointed to
+// the correct memory locations in the extra memory located immediately
+// after the header. These strings may very well also need to be converted.
+
+QTC_HEADER_PTR QTC_SetUpStrings( QTC_HEADER_PTR header )
+{
+ BYTE_PTR b; // byte always
+
+ b = (BYTE_PTR)header;
+ b += header->string_offset;
+
+ header->tape_name = (CHAR_PTR)b;
+ b += header->tape_name_size;
+ header->bset_name = (CHAR_PTR)b;
+ b += header->bset_name_size;
+ header->volume_name = (CHAR_PTR)b;
+ b += header->volume_name_size;
+ header->user_name = (CHAR_PTR)b;
+ b += header->user_name_size;
+ header->bset_description = (CHAR_PTR)b;
+ b += header->bset_description_size;
+ header->tape_password = (CHAR_PTR)b;
+ b += header->tape_password_size;
+ header->bset_password = (CHAR_PTR)b;
+
+ return( header );
+}
+
+
+#if defined( P_CLIENT ) || defined( OS_NLM )
+
+/**********************
+
+ NAME : QTC_SetCatUser
+
+ DESCRIPTION : Sets the user name to use when scanning the catalog
+ files and building the in-memory queue of tapes and
+ sets.
+
+ If user_name == NULL, all sets will be returned. If
+ user_name != NULL, only those sets belonging to the
+ same user_name, or sets having no user-name, will
+ be visible.
+
+ RETURNS :
+
+**********************/
+
+VOID QTC_SetCatUserName( CHAR_PTR user_name )
+{
+ if ( gb_QTC.cat_user ) {
+ free( gb_QTC.cat_user ) ;
+ }
+
+ if ( user_name ) {
+ // MSC strdup and our DOS substitution strdup don't handle NULL
+ // arg very well, so assume other compiler libraries may not
+ // handle it.
+ gb_QTC.cat_user = strdup( user_name ) ;
+ } else {
+ gb_QTC.cat_user = NULL ;
+ }
+}
+#endif
diff --git a/private/utils/ntbackup/src/qtcxface.c b/private/utils/ntbackup/src/qtcxface.c
new file mode 100644
index 000000000..15301efaf
--- /dev/null
+++ b/private/utils/ntbackup/src/qtcxface.c
@@ -0,0 +1,1173 @@
+/***************************************************
+Copyright (C) Conner Software 1994
+
+ Name: QTCxface.C
+
+ Description:
+
+ This file contains all of the interface functions to the catalog unit. It prevents the
+ catalog unit froming having to understand tape format, file systems, or loops. It also
+ contains the function interfaces to the catalog dll.
+
+ $Log: N:\LOGFILES\QTCXFACE.C_V $
+
+ Rev 1.6 12 Jan 1994 09:34:26 MikeP
+mark files as corrupt if they have corrupt bit set
+
+ Rev 1.5 07 Jan 1994 14:42:22 mikep
+change ifdef
+
+ Rev 1.4 06 Dec 1993 18:27:30 mikep
+deep pathes and unicode fixes
+
+ Rev 1.3 03 Nov 1993 09:02:54 MIKEP
+warning fixes
+
+ Rev 1.2 02 Nov 1993 18:02:06 MIKEP
+fix dll build
+
+ Rev 1.1 02 Nov 1993 17:49:16 MIKEP
+fix non-dll build
+
+ Rev 1.0 28 Oct 1993 14:49:32 MIKEP
+Initial revision.
+
+ Rev 1.0 28 Oct 1993 14:45:54 MIKEP
+Initial revision.
+
+****************************************************/
+
+#include <dos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <string.h>
+#include <time.h>
+#include <share.h>
+#include <malloc.h>
+
+#ifdef QTCDLL
+#include <windows.h>
+#endif
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "lp_msg.h"
+#include "fsys.h"
+#include "tfldefs.h"
+#include "qtc.h"
+#include "qtcxface.h"
+#include "dle.h"
+
+// unicode text macro
+
+#ifndef TEXT
+#define TEXT( x ) x
+#endif
+
+
+#ifdef QTCDLL
+
+typedef INT (APIENTRY *PFNQTC_BLOCKBAD)( QTC_BUILD_PTR );
+PFNQTC_BLOCKBAD pfnQTC_BlockBad;
+
+typedef INT (APIENTRY *PFNQTC_INIT)( CHAR_PTR, VM_HDL );
+PFNQTC_INIT pfnQTC_Init;
+
+typedef INT (APIENTRY *PFNQTC_FINISHBACKUP)( QTC_BUILD_PTR );
+PFNQTC_FINISHBACKUP pfnQTC_FinishBackup;
+
+typedef QTC_TAPE_PTR (APIENTRY *PFNQTC_GETFIRSTTAPE)( VOID );
+PFNQTC_GETFIRSTTAPE pfnQTC_GetFirstTape;
+
+typedef QTC_TAPE_PTR (APIENTRY *PFNQTC_GETNEXTTAPE)( QTC_TAPE_PTR );
+PFNQTC_GETNEXTTAPE pfnQTC_GetNextTape;
+
+typedef QTC_BSET_PTR (APIENTRY *PFNQTC_GETFIRSTBSET)( QTC_TAPE_PTR );
+PFNQTC_GETFIRSTBSET pfnQTC_GetFirstBset;
+
+typedef QTC_BSET_PTR (APIENTRY *PFNQTC_GETNEXTBSET)( QTC_BSET_PTR );
+PFNQTC_GETNEXTBSET pfnQTC_GetNextBset;
+
+typedef QTC_BSET_PTR (APIENTRY *PFNQTC_GETPREVBSET)( QTC_BSET_PTR );
+PFNQTC_GETPREVBSET pfnQTC_GetPrevBset;
+
+typedef VOID (APIENTRY *PFNQTC_ABORTBACKUP)( QTC_BUILD_PTR );
+PFNQTC_ABORTBACKUP pfnQTC_AbortBackup;
+
+typedef VOID (APIENTRY *PFNQTC_ABORTCATALOGING)( QTC_BUILD_PTR, BOOLEAN );
+PFNQTC_ABORTCATALOGING pfnQTC_AbortCataloging;
+
+typedef VOID (APIENTRY *PFNQTC_ADDDIRECTORYTOCATALOG)( QTC_BUILD_PTR, UINT64, CHAR_PTR, INT, UINT16, UINT16, UINT32, UINT32, BYTE_PTR, UINT );
+PFNQTC_ADDDIRECTORYTOCATALOG pfnQTC_AddDirectoryToCatalog;
+
+typedef VOID (APIENTRY *PFNQTC_ADDFILETOCATALOG)( QTC_BUILD_PTR, UINT64, CHAR_PTR, UINT16, UINT16, UINT32, UINT32, UINT32, BYTE_PTR, UINT );
+PFNQTC_ADDFILETOCATALOG pfnQTC_AddFileToCatalog;
+
+typedef BOOLEAN (APIENTRY *PFNQTC_ANYCATALOGFILES)( VOID );
+PFNQTC_ANYCATALOGFILES pfnQTC_AnyCatalogFiles;
+
+typedef INT (APIENTRY *PFNQTC_ANYSEARCHABLEBSETS)( VOID );
+PFNQTC_ANYSEARCHABLEBSETS pfnQTC_AnySearchableBsets;
+
+typedef INT (APIENTRY *PFNQTC_CLOSEQUERY)( QTC_QUERY_PTR );
+PFNQTC_CLOSEQUERY pfnQTC_CloseQuery;
+
+typedef VOID (APIENTRY *PFNQTC_DEINIT)( INT );
+PFNQTC_DEINIT pfnQTC_Deinit;
+
+typedef VOID (APIENTRY *PFNQTC_ENDOFTAPEREACHED)( QTC_BUILD_PTR, CHAR_PTR, CHAR_PTR, INT );
+PFNQTC_ENDOFTAPEREACHED pfnQTC_EndOfTapeReached;
+
+typedef QTC_BSET_PTR (APIENTRY *PFNQTC_FINDBSET)( UINT32, INT16, INT16 );
+PFNQTC_FINDBSET pfnQTC_FindBset;
+
+typedef INT (APIENTRY *PFNQTC_FREEBUILDHANDLE)( QTC_BUILD_PTR );
+PFNQTC_FREEBUILDHANDLE pfnQTC_FreeBuildHandle;
+
+typedef QTC_BUILD_PTR (APIENTRY *PFNQTC_GETBUILDHANDLE)( VOID );
+PFNQTC_GETBUILDHANDLE pfnQTC_GetBuildHandle;
+
+typedef VOID (APIENTRY *PFNQTC_GETFILENAME)( UINT32, INT16, CHAR_PTR );
+PFNQTC_GETFILENAME pfnQTC_GetFileName;
+
+typedef CHAR_PTR (APIENTRY *PFNQTC_GETFILENAMEONLY)( UINT32, INT16, CHAR_PTR );
+PFNQTC_GETFILENAMEONLY pfnQTC_GetFileNameOnly;
+
+typedef INT (APIENTRY *PFNQTC_GETFIRSTDIR)( QTC_QUERY_PTR );
+PFNQTC_GETFIRSTDIR pfnQTC_GetFirstDir;
+
+typedef INT (APIENTRY *PFNQTC_GETFIRSTITEM)( QTC_QUERY_PTR );
+PFNQTC_GETFIRSTITEM pfnQTC_GetFirstItem;
+
+typedef INT (APIENTRY *PFNQTC_GETFIRSTOBJ)( QTC_QUERY_PTR );
+PFNQTC_GETFIRSTOBJ pfnQTC_GetFirstObj;
+
+typedef UINT8 (APIENTRY *PFNQTC_GETMETHETAPECATVER)( UINT32, INT16, INT16 );
+PFNQTC_GETMETHETAPECATVER pfnQTC_GetMeTheTapeCatVer;
+
+typedef INT32 (APIENTRY *PFNQTC_GETMETHEVCBPBA)( UINT32, INT16, INT16 );
+PFNQTC_GETMETHEVCBPBA pfnQTC_GetMeTheVCBPBA;
+
+typedef INT (APIENTRY *PFNQTC_GETNEXTDIR)( QTC_QUERY_PTR );
+PFNQTC_GETNEXTDIR pfnQTC_GetNextDir;
+
+typedef INT (APIENTRY *PFNQTC_GETNEXTITEM)( QTC_QUERY_PTR );
+PFNQTC_GETNEXTITEM pfnQTC_GetNextItem;
+
+typedef INT (APIENTRY *PFNQTC_GETNEXTOBJ)( QTC_QUERY_PTR );
+PFNQTC_GETNEXTOBJ pfnQTC_GetNextObj;
+
+typedef INT (APIENTRY *PFNQTC_IMAGESCREWUP)( QTC_BUILD_PTR );
+PFNQTC_IMAGESCREWUP pfnQTC_ImageScrewUp;
+
+typedef QTC_QUERY_PTR (APIENTRY *PFNQTC_INITQUERY)( VOID );
+PFNQTC_INITQUERY pfnQTC_InitQuery;
+
+typedef INT (APIENTRY *PFNQTC_LOADBSETINFO)( CHAR_PTR, QTC_TAPE_PTR );
+PFNQTC_LOADBSETINFO pfnQTC_LoadBsetInfo;
+
+typedef QTC_HEADER_PTR (APIENTRY *PFNQTC_LOADHEADER)( QTC_BSET_PTR );
+PFNQTC_LOADHEADER pfnQTC_LoadHeader;
+
+typedef INT (APIENTRY *PFNQTC_PARTIALIZE)( UINT32, INT16, INT16 );
+PFNQTC_PARTIALIZE pfnQTC_Partialize;
+
+typedef VOID (APIENTRY *PFNQTC_PATCHVCB)( QTC_BUILD_PTR, UINT32, UINT32 );
+PFNQTC_PATCHVCB pfnQTC_PatchVCB;
+
+typedef VOID (APIENTRY *PFNQTC_REMOVETAPE)( UINT32, INT16 );
+PFNQTC_REMOVETAPE pfnQTC_RemoveTape;
+
+typedef INT (APIENTRY *PFNQTC_SEARCHFIRSTITEM)( QTC_QUERY_PTR );
+PFNQTC_SEARCHFIRSTITEM pfnQTC_SearchFirstItem;
+
+typedef INT (APIENTRY *PFNQTC_SEARCHNEXTITEM)( QTC_QUERY_PTR );
+PFNQTC_SEARCHNEXTITEM pfnQTC_SearchNextItem;
+
+typedef INT (APIENTRY *PFNQTC_SETSEARCHNAME)( QTC_QUERY_PTR, CHAR_PTR );
+PFNQTC_SETSEARCHNAME pfnQTC_SetSearchName;
+
+typedef INT (APIENTRY *PFNQTC_SETSEARCHPATH)( QTC_QUERY_PTR, CHAR_PTR, INT );
+PFNQTC_SETSEARCHPATH pfnQTC_SetSearchPath;
+
+typedef INT (APIENTRY *PFNQTC_STARTNEWBACKUP)( QTC_BUILD_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR, CHAR_PTR,
+ INT, INT, UINT32, UINT16, UINT16, UINT32, UINT32, UINT32, INT, INT, INT,
+ UINT32, UINT32, INT, INT, INT,
+ INT, INT, INT, INT, INT, INT, INT, INT, UINT16, UINT16, INT );
+
+PFNQTC_STARTNEWBACKUP pfnQTC_StartNewBackup;
+
+static HINSTANCE mwhLibQTC;
+
+
+VOID QTC_AbortBackup( QTC_BUILD_PTR pB )
+{
+ if ( pfnQTC_AbortBackup ) {
+ (*pfnQTC_AbortBackup)( pB );
+ }
+}
+
+VOID QTC_AbortCataloging( QTC_BUILD_PTR pB, BOOLEAN b )
+{
+ if ( pfnQTC_AbortCataloging ) {
+ (*pfnQTC_AbortCataloging)( pB, b );
+ }
+}
+
+VOID QTC_AddDirectoryToCatalog(
+QTC_BUILD_PTR build,
+UINT64 DisplaySize,
+CHAR_PTR szPath,
+INT nPathLength,
+UINT16 Date,
+UINT16 Time,
+UINT32 Attribute,
+UINT32 LBA,
+BYTE_PTR xtra_bytes,
+UINT xtra_size )
+{
+
+ if ( pfnQTC_AddDirectoryToCatalog ) {
+ (*pfnQTC_AddDirectoryToCatalog)( build,
+ DisplaySize,
+ szPath,
+ nPathLength,
+ Date,
+ Time,
+ Attribute,
+ LBA,
+ xtra_bytes,
+ xtra_size );
+ }
+
+}
+
+VOID QTC_AddFileToCatalog(
+QTC_BUILD_PTR build,
+UINT64 DisplaySize,
+CHAR_PTR szFile,
+UINT16 Date,
+UINT16 Time,
+UINT32 Attribute,
+UINT32 LBA,
+UINT32 AFPObject,
+BYTE_PTR xtra_bytes,
+UINT xtra_size )
+{
+ if ( pfnQTC_AddFileToCatalog ) {
+ (*pfnQTC_AddFileToCatalog)( build,
+ DisplaySize,
+ szFile,
+ Date,
+ Time,
+ Attribute,
+ LBA,
+ AFPObject,
+ xtra_bytes,
+ xtra_size );
+ }
+}
+
+BOOLEAN QTC_AnyCatalogFiles( VOID )
+{
+ if ( pfnQTC_AnyCatalogFiles ) {
+ return( (*pfnQTC_AnyCatalogFiles)() );
+ }
+ else {
+ return( FALSE );
+ }
+}
+
+INT QTC_AnySearchableBsets( VOID )
+{
+ if ( pfnQTC_AnySearchableBsets ) {
+ return( (*pfnQTC_AnySearchableBsets)() );
+ }
+ else {
+ return( FALSE );
+ }
+}
+
+INT QTC_CloseQuery( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_CloseQuery ) {
+ return( (*pfnQTC_CloseQuery)( pQ ) );
+ }
+}
+
+VOID QTC_Deinit( INT n )
+{
+
+ if ( pfnQTC_Deinit ) {
+ (*pfnQTC_Deinit)( n );
+ }
+}
+
+VOID QTC_EndOfTapeReached( QTC_BUILD_PTR pB, CHAR_PTR path, CHAR_PTR file, INT size )
+{
+ if ( pfnQTC_EndOfTapeReached ) {
+ (*pfnQTC_EndOfTapeReached)( pB, path, file, size );
+ }
+}
+
+QTC_BSET_PTR QTC_FindBset( UINT32 fid, INT16 tape, INT16 set )
+{
+ if ( pfnQTC_FindBset ) {
+ return( (*pfnQTC_FindBset)( fid, tape, set ) );
+ }
+ else {
+ return( (QTC_BSET_PTR)NULL );
+ }
+}
+
+INT QTC_FreeBuildHandle( QTC_BUILD_PTR pB )
+{
+ if ( pfnQTC_FreeBuildHandle ) {
+ return( (*pfnQTC_FreeBuildHandle)( pB ) );
+ }
+}
+
+QTC_BUILD_PTR QTC_GetBuildHandle( VOID )
+{
+ if ( pfnQTC_GetBuildHandle ) {
+ return( (*pfnQTC_GetBuildHandle)() );
+ }
+ else {
+ return( (QTC_BUILD_PTR)NULL );
+ }
+}
+
+VOID QTC_GetFileName( UINT32 fid, INT16 tape, CHAR_PTR name )
+{
+ if ( pfnQTC_GetFileName ) {
+ (*pfnQTC_GetFileName)( fid, tape, name );
+ }
+}
+
+CHAR_PTR QTC_GetFileNameOnly( UINT32 fid, INT16 tape, CHAR_PTR name )
+{
+ if ( pfnQTC_GetFileNameOnly ) {
+ return( (*pfnQTC_GetFileNameOnly)( fid, tape, name ) );
+ }
+ else {
+ return( (CHAR_PTR)NULL );
+ }
+}
+
+INT QTC_GetFirstDir( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_GetFirstDir ) {
+ return( (*pfnQTC_GetFirstDir)( pQ ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+INT QTC_GetFirstItem( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_GetFirstItem ) {
+ return( (*pfnQTC_GetFirstItem)( pQ ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+INT QTC_GetFirstObj( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_GetFirstObj ) {
+ return( (*pfnQTC_GetFirstObj)( pQ ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+UINT8 QTC_GetMeTheTapeCatVer( UINT32 fid, INT16 tape, INT16 set )
+{
+ if ( pfnQTC_GetMeTheTapeCatVer ) {
+ return( (*pfnQTC_GetMeTheTapeCatVer)( fid, tape, set ) );
+ }
+ else {
+ return( (UINT8)0 );
+ }
+}
+
+INT32 QTC_GetMeTheVCBPBA( UINT32 fid, INT16 tape, INT16 set )
+{
+ if ( pfnQTC_GetMeTheVCBPBA ) {
+ return( (*pfnQTC_GetMeTheVCBPBA)( fid, tape, set ) );
+ }
+ else {
+ return( (INT32)0 );
+ }
+}
+
+INT QTC_GetNextDir( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_GetNextDir ) {
+ return( (*pfnQTC_GetNextDir)( pQ ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+INT QTC_GetNextItem( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_GetNextItem ) {
+ return( (*pfnQTC_GetNextItem)( pQ ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+INT QTC_GetNextObj( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_GetNextObj ) {
+ return( (*pfnQTC_GetNextObj)( pQ ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+INT QTC_ImageScrewUp( QTC_BUILD_PTR pB )
+{
+ if ( pfnQTC_ImageScrewUp ) {
+ return( (*pfnQTC_ImageScrewUp)( pB ) );
+ }
+}
+
+QTC_QUERY_PTR QTC_InitQuery( VOID )
+{
+ if ( pfnQTC_InitQuery ) {
+ return( (*pfnQTC_InitQuery)() );
+ }
+ else {
+ return( (QTC_QUERY_PTR)NULL );
+ }
+}
+
+INT QTC_LoadBsetInfo( CHAR_PTR psz, QTC_TAPE_PTR pT )
+{
+ if ( pfnQTC_LoadBsetInfo ) {
+ return( (*pfnQTC_LoadBsetInfo)( psz, pT ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+QTC_HEADER_PTR QTC_LoadHeader( QTC_BSET_PTR bset )
+{
+ if ( pfnQTC_LoadHeader ) {
+ return( (*pfnQTC_LoadHeader)( bset ) );
+ }
+ else {
+ return( (QTC_HEADER_PTR)NULL );
+ }
+}
+
+INT QTC_Partialize( UINT32 fid, INT16 tape, INT16 set )
+{
+ if ( pfnQTC_Partialize ) {
+ return( (*pfnQTC_Partialize)( fid, tape, set ) );
+ }
+}
+
+VOID QTC_PatchVCB( QTC_BUILD_PTR pB, UINT32 lba, UINT32 pba )
+{
+ if ( pfnQTC_PatchVCB ) {
+ (*pfnQTC_PatchVCB)( pB, lba, pba );
+ }
+}
+
+VOID QTC_RemoveTape( UINT32 fid, INT16 tape )
+{
+ if ( pfnQTC_RemoveTape ) {
+ (*pfnQTC_RemoveTape)( fid, tape );
+ }
+}
+
+INT QTC_SearchFirstItem( QTC_QUERY_PTR pQ )
+{
+ if ( pfnQTC_SearchFirstItem ) {
+ return( (*pfnQTC_SearchFirstItem)( pQ ) );
+ }
+}
+
+INT QTC_SearchNextItem( QTC_QUERY_PTR pQ)
+{
+ if ( pfnQTC_SearchNextItem ) {
+ return( (*pfnQTC_SearchNextItem)( pQ ) );
+ }
+}
+
+INT QTC_SetSearchName( QTC_QUERY_PTR pQ, CHAR_PTR file )
+{
+ if ( pfnQTC_SetSearchName ) {
+ return( (*pfnQTC_SetSearchName)( pQ, file ) );
+ }
+}
+
+INT QTC_SetSearchPath( QTC_QUERY_PTR pQ, CHAR_PTR path, INT len )
+{
+ if ( pfnQTC_SetSearchPath ) {
+ return( (*pfnQTC_SetSearchPath)( pQ, path, len ) );
+ }
+}
+
+INT QTC_StartNewBackup(
+QTC_BUILD_PTR build,
+CHAR_PTR szTapeName,
+CHAR_PTR szSetName,
+CHAR_PTR szUserName,
+CHAR_PTR szSetDescription,
+CHAR_PTR szDeviceName,
+CHAR_PTR szVolumeName,
+CHAR_PTR szTapePassword,
+CHAR_PTR szSetPassword,
+INT nTapePasswordLength,
+INT nSetPasswordLength,
+UINT32 TapeID,
+UINT16 TapeNum,
+UINT16 SetNum,
+UINT32 LBA,
+UINT32 PBA,
+UINT32 Attribute,
+INT FDDVersion,
+INT fFDDExists,
+INT fSMExists,
+UINT32 SetCatPBA,
+UINT32 SetCatSeqNumber,
+INT fSetCatInfoValid,
+INT fBlockContinued,
+INT nBackupType,
+INT OS_id,
+INT OS_ver,
+INT fImage,
+INT fNonVolume,
+INT fNoRedirect,
+INT fFutureVersion,
+INT fCompressed,
+INT fEncrypted,
+UINT16 Date,
+UINT16 Time,
+INT EncryptionAlgorithm )
+{
+ if ( pfnQTC_StartNewBackup ) {
+ return( (*pfnQTC_StartNewBackup)( build,
+ szTapeName,
+ szSetName,
+ szUserName,
+ szSetDescription,
+ szDeviceName,
+ szVolumeName,
+ szTapePassword,
+ szSetPassword,
+ nTapePasswordLength,
+ nSetPasswordLength,
+ TapeID,
+ TapeNum,
+ SetNum,
+ LBA,
+ PBA,
+ Attribute,
+ FDDVersion,
+ fFDDExists,
+ fSMExists,
+ SetCatPBA,
+ SetCatSeqNumber,
+ fSetCatInfoValid,
+ fBlockContinued,
+ nBackupType,
+ OS_id,
+ OS_ver,
+ fImage,
+ fNonVolume,
+ fNoRedirect,
+ fFutureVersion,
+ fCompressed,
+ fEncrypted,
+ Date,
+ Time,
+ EncryptionAlgorithm ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+INT QTC_Init( CHAR_PTR psz, VM_HDL vmh )
+{
+
+ if ( pfnQTC_Init ) {
+ return( (*pfnQTC_Init)( psz, vmh ) );
+ }
+}
+
+INT QTC_BlockBad( QTC_BUILD_PTR pB )
+{
+ if ( pfnQTC_BlockBad ) {
+ return( (*pfnQTC_BlockBad)( pB ) );
+ }
+}
+
+
+INT QTC_FinishBackup( QTC_BUILD_PTR pB )
+{
+ if ( pfnQTC_FinishBackup ) {
+ return( (*pfnQTC_FinishBackup)( pB ) );
+ }
+ else {
+ return( QTC_FAILURE );
+ }
+}
+
+
+QTC_TAPE_PTR QTC_GetFirstTape( )
+{
+ if ( pfnQTC_GetFirstTape ) {
+ return( (*pfnQTC_GetFirstTape)() );
+ }
+ else {
+ return( (QTC_TAPE_PTR)NULL );
+ }
+}
+
+
+QTC_TAPE_PTR QTC_GetNextTape( QTC_TAPE_PTR pT )
+{
+ if ( pfnQTC_GetNextTape ) {
+ return( (*pfnQTC_GetNextTape)( pT ) );
+ }
+ else {
+ return( (QTC_TAPE_PTR)NULL );
+ }
+}
+
+QTC_BSET_PTR QTC_GetFirstBset( QTC_TAPE_PTR pT )
+{
+ if ( pfnQTC_GetFirstBset ) {
+ return( (*pfnQTC_GetFirstBset)( pT ) );
+ }
+ else {
+ return( (QTC_BSET_PTR)NULL );
+ }
+}
+
+QTC_BSET_PTR QTC_GetNextBset( QTC_BSET_PTR pBset )
+{
+ if ( pfnQTC_GetNextBset ) {
+ return( (*pfnQTC_GetNextBset)( pBset ) );
+ }
+ else {
+ return( (QTC_BSET_PTR)NULL );
+ }
+}
+
+QTC_BSET_PTR QTC_GetPrevBset( QTC_BSET_PTR pBset )
+{
+ if ( pfnQTC_GetPrevBset ) {
+ return( (*pfnQTC_GetPrevBset)( pBset ) );
+ }
+ else {
+ return( (QTC_BSET_PTR)NULL );
+ }
+}
+
+#endif
+
+// ------------------------------------------------------
+//
+// Code for both the DLL version and the regular version.
+//
+// ------------------------------------------------------
+
+INT QTC_LoadDLL( CHAR_PTR library_name )
+{
+
+#ifdef QTCDLL
+ if ( strlen ( library_name ) ) {
+
+ mwhLibQTC = LoadLibrary ( library_name );
+
+ if ( ! mwhLibQTC ) {
+ return (INT)0;
+ }
+ }
+
+ pfnQTC_AbortBackup = (PFNQTC_ABORTBACKUP) GetProcAddress( mwhLibQTC, "QTC_AbortBackup");
+ pfnQTC_AbortCataloging = (PFNQTC_ABORTCATALOGING) GetProcAddress( mwhLibQTC, "QTC_AbortCataloging");
+ pfnQTC_AddDirectoryToCatalog = (PFNQTC_ADDDIRECTORYTOCATALOG)GetProcAddress( mwhLibQTC, "QTC_AddDirectoryToCatalog");
+ pfnQTC_AddFileToCatalog = (PFNQTC_ADDFILETOCATALOG) GetProcAddress( mwhLibQTC, "QTC_AddFileToCatalog");
+ pfnQTC_AnyCatalogFiles = (PFNQTC_ANYCATALOGFILES) GetProcAddress( mwhLibQTC, "QTC_AnyCatalogFiles");
+ pfnQTC_AnySearchableBsets = (PFNQTC_ANYSEARCHABLEBSETS) GetProcAddress( mwhLibQTC, "QTC_AnySearchableBsets");
+ pfnQTC_CloseQuery = (PFNQTC_CLOSEQUERY) GetProcAddress( mwhLibQTC, "QTC_CloseQuery");
+ pfnQTC_Deinit = (PFNQTC_DEINIT) GetProcAddress( mwhLibQTC, "QTC_Deinit");
+ pfnQTC_EndOfTapeReached = (PFNQTC_ENDOFTAPEREACHED) GetProcAddress( mwhLibQTC, "QTC_EndOfTapeReached");
+ pfnQTC_FindBset = (PFNQTC_FINDBSET) GetProcAddress( mwhLibQTC, "QTC_FindBset");
+ pfnQTC_FreeBuildHandle = (PFNQTC_FREEBUILDHANDLE) GetProcAddress( mwhLibQTC, "QTC_FreeBuildHandle");
+ pfnQTC_GetBuildHandle = (PFNQTC_GETBUILDHANDLE) GetProcAddress( mwhLibQTC, "QTC_GetBuildHandle");
+ pfnQTC_GetFileName = (PFNQTC_GETFILENAME) GetProcAddress( mwhLibQTC, "QTC_GetFileName");
+ pfnQTC_GetFileNameOnly = (PFNQTC_GETFILENAMEONLY) GetProcAddress( mwhLibQTC, "QTC_GetFileNameOnly");
+ pfnQTC_GetFirstDir = (PFNQTC_GETFIRSTDIR) GetProcAddress( mwhLibQTC, "QTC_GetFirstDir");
+ pfnQTC_GetFirstItem = (PFNQTC_GETFIRSTITEM) GetProcAddress( mwhLibQTC, "QTC_GetFirstItem");
+ pfnQTC_GetFirstObj = (PFNQTC_GETFIRSTOBJ) GetProcAddress( mwhLibQTC, "QTC_GetFirstObj");
+ pfnQTC_GetMeTheTapeCatVer = (PFNQTC_GETMETHETAPECATVER) GetProcAddress( mwhLibQTC, "QTC_GetMeTheTapeCatVer");
+ pfnQTC_GetMeTheVCBPBA = (PFNQTC_GETMETHEVCBPBA) GetProcAddress( mwhLibQTC, "QTC_GetMeTheVCBPBA");
+ pfnQTC_GetNextDir = (PFNQTC_GETNEXTDIR) GetProcAddress( mwhLibQTC, "QTC_GetNextDir");
+ pfnQTC_GetNextItem = (PFNQTC_GETNEXTITEM) GetProcAddress( mwhLibQTC, "QTC_GetNextItem");
+ pfnQTC_GetNextObj = (PFNQTC_GETNEXTOBJ) GetProcAddress( mwhLibQTC, "QTC_GetNextObj");
+ pfnQTC_ImageScrewUp = (PFNQTC_IMAGESCREWUP) GetProcAddress( mwhLibQTC, "QTC_ImageScrewUp");
+ pfnQTC_InitQuery = (PFNQTC_INITQUERY) GetProcAddress( mwhLibQTC, "QTC_InitQuery");
+ pfnQTC_LoadBsetInfo = (PFNQTC_LOADBSETINFO) GetProcAddress( mwhLibQTC, "QTC_LoadBsetInfo");
+ pfnQTC_LoadHeader = (PFNQTC_LOADHEADER) GetProcAddress( mwhLibQTC, "QTC_LoadHeader");
+ pfnQTC_Partialize = (PFNQTC_PARTIALIZE) GetProcAddress( mwhLibQTC, "QTC_Partialize");
+ pfnQTC_PatchVCB = (PFNQTC_PATCHVCB) GetProcAddress( mwhLibQTC, "QTC_PatchVCB");
+ pfnQTC_RemoveTape = (PFNQTC_REMOVETAPE) GetProcAddress( mwhLibQTC, "QTC_RemoveTape");
+ pfnQTC_SearchFirstItem = (PFNQTC_SEARCHFIRSTITEM) GetProcAddress( mwhLibQTC, "QTC_SearchFirstItem");
+ pfnQTC_SearchNextItem = (PFNQTC_SEARCHNEXTITEM) GetProcAddress( mwhLibQTC, "QTC_SearchNextItem");
+ pfnQTC_SetSearchName = (PFNQTC_SETSEARCHNAME) GetProcAddress( mwhLibQTC, "QTC_SetSearchName");
+ pfnQTC_SetSearchPath = (PFNQTC_SETSEARCHPATH) GetProcAddress( mwhLibQTC, "QTC_SetSearchPath");
+ pfnQTC_StartNewBackup = (PFNQTC_STARTNEWBACKUP) GetProcAddress( mwhLibQTC, "QTC_StartNewBackup");
+ pfnQTC_BlockBad = (PFNQTC_BLOCKBAD) GetProcAddress( mwhLibQTC, "QTC_BlockBad");
+ pfnQTC_Init = (PFNQTC_INIT) GetProcAddress( mwhLibQTC, "QTC_Init");
+ pfnQTC_FinishBackup = (PFNQTC_FINISHBACKUP) GetProcAddress( mwhLibQTC, "QTC_FinishBackup");
+ pfnQTC_GetFirstTape = (PFNQTC_GETFIRSTTAPE) GetProcAddress( mwhLibQTC, "QTC_GetFirstTape");
+ pfnQTC_GetNextTape = (PFNQTC_GETNEXTTAPE) GetProcAddress( mwhLibQTC, "QTC_GetNextTape");
+ pfnQTC_GetFirstBset = (PFNQTC_GETFIRSTBSET) GetProcAddress( mwhLibQTC, "QTC_GetFirstBset");
+ pfnQTC_GetNextBset = (PFNQTC_GETNEXTBSET) GetProcAddress( mwhLibQTC, "QTC_GetNextBset");
+ pfnQTC_GetPrevBset = (PFNQTC_GETPREVBSET) GetProcAddress( mwhLibQTC, "QTC_GetPrevBset");
+#else
+ (void)library_name;
+
+#endif
+
+ return (INT)1;
+
+}
+
+INT QTC_UnLoadDLL( )
+{
+#ifdef QTCDLL
+ if ( mwhLibQTC ) {
+ FreeLibrary ( mwhLibQTC );
+ mwhLibQTC = 0;
+ }
+
+#endif
+ return SUCCESS;
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+ Start the catalog off building data for a new Bset
+
+ RETURNS :
+
+**********************/
+
+INT QTC_StartBackup( QTC_BUILD_PTR build, DBLK_PTR dblk )
+{
+ CHAR_PTR szTapeName;
+ CHAR_PTR szSetName;
+ CHAR_PTR szUserName;
+ CHAR_PTR szSetDescription;
+ CHAR_PTR szDeviceName = NULL;
+ CHAR_PTR szVolumeName;
+ CHAR_PTR szTapePassword;
+ CHAR_PTR szSetPassword;
+ INT nTapePasswordLength;
+ INT nSetPasswordLength;
+ UINT32 TapeID;
+ UINT16 TapeNum;
+ UINT16 SetNum;
+ UINT32 LBA;
+ UINT32 PBA;
+ UINT32 Attribute;
+ INT FDDVersion;
+ INT fFDDExists = FALSE;
+ INT fSMExists = FALSE;
+ UINT32 SetCatPBA;
+ UINT32 SetCatSeqNumber;
+ INT fSetCatInfoValid = FALSE;
+ INT fBlockContinued = FALSE;
+ INT nBackupType;
+ INT OS_id;
+ INT OS_ver;
+ INT fImage = FALSE;
+ INT fNonVolume = FALSE;
+ INT fNoRedirect = FALSE;
+ INT fFutureVersion = FALSE;
+ INT fCompressed = FALSE;
+ INT fEncrypted = FALSE;
+ UINT16 Date;
+ UINT16 Time;
+ INT EncryptionAlgorithm;
+ INT ret_val ;
+
+ nTapePasswordLength = FS_SizeofTapePswdInVCB( dblk );
+ nSetPasswordLength = FS_SizeofSetPswdInVCB( dblk );
+
+ szTapeName = (CHAR *)FS_ViewTapeNameInVCB( dblk );
+ szSetName = (CHAR *)FS_ViewSetNameInVCB( dblk );
+ szSetDescription = (CHAR *)FS_ViewSetDescriptInVCB( dblk );
+
+ TapeID = FS_ViewTapeIDInVCB( dblk );
+ TapeNum = FS_ViewTSNumInVCB( dblk );
+ SetNum = FS_ViewBSNumInVCB( dblk );
+
+ Attribute = FS_GetAttribFromVCB( dblk ) ;
+
+ FDDVersion = FS_GetOnTapeCatVer( dblk );
+
+ if ( FS_IsSetCatInfoValid( dblk ) ) {
+
+ fSetCatInfoValid = TRUE;
+ SetCatSeqNumber = FS_GetSetCatSeqNumberInVCB( dblk );
+ SetCatPBA = FS_GetSetCatPbaInVCB( dblk );
+ }
+
+ if ( Attribute & VCB_FUTURE_VER_BIT ) {
+ fFutureVersion = TRUE;
+ }
+ if ( Attribute & VCB_ENCRYPTED_BIT ) {
+ fEncrypted = TRUE;
+ }
+ if ( Attribute & VCB_COMPRESSED_BIT ) {
+ fCompressed = TRUE;
+ }
+
+ if ( FS_GetOnTapeCatLevel( dblk ) == TCL_FULL ) {
+ fFDDExists = TRUE;
+ fSMExists = TRUE;
+ }
+
+ if ( FS_GetOnTapeCatLevel( dblk ) == TCL_PARTIAL ) {
+ fSMExists = TRUE;
+ }
+
+ if ( FS_IsBlockContinued( dblk ) ) {
+ fBlockContinued = TRUE;
+ }
+
+#ifdef OS_NLM
+ if ( gb_QTC.cat_user ) {
+ szUserName = gb_QTC.cat_user;
+ } else {
+ szUserName = TEXT( "" );
+ }
+#else
+ szUserName = (CHAR_PTR)FS_ViewUserNameInVCB( dblk );
+#endif
+
+#ifdef OS_NLM
+ if ( FS_SizeofDevNameInVCB( dblk ) ) {
+ szVolumeName = FS_ViewDevNameInVCB( dblk );
+ } else {
+ szVolumeName = FS_ViewVolNameInVCB( dblk );
+ }
+#else
+ szVolumeName = (CHAR_PTR)FS_ViewVolNameInVCB( dblk );
+#endif
+
+ szTapePassword = (CHAR *)FS_ViewTapePasswordInVCB( dblk );
+ szSetPassword = (CHAR *)FS_ViewSetPswdInVCB( dblk );
+
+ EncryptionAlgorithm = FS_ViewPswdEncryptInVCB( dblk );
+
+ nBackupType = QTC_NORM_BACKUP;
+
+ if ( FS_GetAttribFromVCB( dblk ) & VCB_COPY_SET ) {
+ nBackupType = QTC_COPY_BACKUP;
+ }
+ if ( FS_GetAttribFromVCB( dblk ) & VCB_DIFFERENTIAL_SET ) {
+ nBackupType = QTC_DIFF_BACKUP;
+ }
+ if ( FS_GetAttribFromVCB( dblk ) & VCB_INCREMENTAL_SET ) {
+ nBackupType = QTC_INCR_BACKUP;
+ }
+ if ( FS_GetAttribFromVCB( dblk ) & VCB_DAILY_SET ) {
+ nBackupType = QTC_DAIL_BACKUP;
+ }
+
+ // init other stuff for this bset
+
+ LBA = FS_ViewLBAinDBLK( dblk );
+ PBA = FS_ViewPBAinVCB( dblk );
+
+ Date = ConvertDateDOS( FS_ViewBackupDateInVCB( dblk ) );
+ Time = ConvertTimeDOS( FS_ViewBackupDateInVCB( dblk ) );
+
+ FS_GetOSid_verFromVCB( dblk, (UINT16_PTR)&OS_id, (UINT16_PTR)&OS_ver );
+
+#ifndef OS_WIN32
+#ifndef OEM_MSOFT
+ if ( FS_IsNoRedirectRestore( dblk ) ) {
+ fNoRedirect = TRUE;
+ }
+
+ if ( FS_IsNonVolume( dblk ) ) {
+ fNonVolume = TRUE;
+ }
+#endif
+#endif
+
+ if ( OS_id == FS_PC_IMAGE ) {
+ fImage = TRUE;
+ }
+
+ build->num_files = FS_ViewNumFiles( dblk ) ;
+ build->num_dirs = FS_ViewNumDirs( dblk ) ;
+ build->num_corrupt_files = FS_ViewNumCorrupt( dblk ) ;
+
+
+ switch ( QTC_StartNewBackup( build,
+ szTapeName,
+ szSetName,
+ szUserName,
+ szSetDescription,
+ szDeviceName,
+ szVolumeName,
+ szTapePassword,
+ szSetPassword,
+ nTapePasswordLength,
+ nSetPasswordLength,
+ TapeID,
+ TapeNum,
+ SetNum,
+ LBA,
+ PBA,
+ Attribute,
+ FDDVersion,
+ fFDDExists,
+ fSMExists,
+ SetCatPBA,
+ SetCatSeqNumber,
+ fSetCatInfoValid,
+ fBlockContinued,
+ nBackupType,
+ OS_id,
+ OS_ver,
+ fImage,
+ fNonVolume,
+ fNoRedirect,
+ fFutureVersion,
+ fCompressed,
+ fEncrypted,
+ Date,
+ Time,
+ EncryptionAlgorithm ) ) {
+
+ case QTC_OPERATION_COMPLETE:
+ ret_val = OPERATION_COMPLETE;
+ break;
+
+ case QTC_SKIP_TO_NEXT_BSET:
+ ret_val = SKIP_TO_NEXT_BSET;
+ break;
+
+ case QTC_SKIP_TO_NEXT_ITEM:
+ ret_val = SKIP_TO_NEXT_ITEM;
+ break;
+
+ }
+
+ return( ret_val );
+
+}
+
+
+VOID QTC_PatchContinuationVCB( QTC_BUILD_PTR build, DBLK_PTR vcb )
+{
+ if ( build != NULL ) {
+
+ if ( build->header != NULL ) {
+
+ QTC_PatchVCB( build, FS_ViewLBAinDBLK( vcb ), FS_ViewPBAinVCB( vcb ) );
+
+ }
+ }
+}
+
+
+VOID QTC_EndOfTape(
+QTC_BUILD_PTR build,
+DBLK_PTR vcb,
+DBLK_PTR ddb,
+DBLK_PTR fdb,
+FSYS_HAND fsh )
+{
+ CHAR_PTR szFile = NULL;
+ CHAR_PTR szPath = NULL;
+ INT nPathLength = 0;
+
+
+ CHAR buffer[ 2048 ];
+
+ (void)vcb;
+
+ // Every now and then we get empty ones, that aren't null.
+
+ if ( fdb ) {
+ if ( FS_GetBlockType( fdb ) != BT_FDB ) {
+ fdb = NULL;
+ }
+ else {
+ FS_GetOSFnameFromFDB( fsh, fdb, buffer );
+ szFile = (CHAR_PTR)malloc( strsize( buffer ) * sizeof(CHAR) );
+ if ( szFile ) {
+ strcpy( szFile, buffer );
+ }
+ }
+ }
+
+ if ( ddb ) {
+ if ( FS_GetBlockType( ddb ) != BT_DDB ) {
+ ddb = NULL;
+ }
+ else {
+ nPathLength = FS_SizeofOSPathInDDB( fsh, ddb );
+ szPath = (CHAR_PTR)malloc( nPathLength );
+ if ( szPath ) {
+ FS_GetOSPathFromDDB( fsh, ddb, szPath );
+ }
+ }
+ }
+
+ QTC_EndOfTapeReached( build, szFile, szPath, nPathLength );
+
+ if ( szFile ) {
+ free( szFile );
+ }
+ if ( szPath ) {
+ free( szPath );
+ }
+}
+
+VOID FillFakeInfo( QTC_BUILD_PTR build, CHAR *buff, INT nPathLength, UINT64 DisplaySize, UINT16 Date, UINT16 Time, UINT32 Attribute, UINT32 LBA, BYTE *xtra_bytes, UINT xtra_size );
+
+VOID QTC_AddToCatalog(
+QTC_BUILD_PTR build,
+DBLK_PTR dblk,
+FSYS_HAND fsh,
+BOOLEAN split,
+BYTE_PTR xtra_bytes,
+UINT xtra_size )
+{
+ UINT32 Attribute;
+ UINT32 LBA;
+ UINT16 Date;
+ UINT16 Time;
+ INT nPathLength; // path length in characters
+ UINT64 DisplaySize;
+ CHAR *buffer;
+ OBJECT_TYPE ObjectType;
+ DATE_TIME datetime;
+
+ (void)split;
+
+ switch ( FS_GetBlockType( dblk ) ) {
+
+ case BT_FDB:
+
+ DisplaySize = FS_GetDisplaySizeFromDBLK( fsh, dblk );
+
+ buffer = malloc( 1024 );
+
+ if ( buffer ) {
+
+ FS_GetOSFnameFromFDB( fsh, dblk, buffer );
+ FS_GetMDateFromDBLK( fsh, dblk, &datetime );
+ FS_GetObjTypeDBLK( fsh, dblk, &ObjectType );
+
+ Date = ConvertDateDOS( &datetime );
+ Time = ConvertTimeDOS( &datetime );
+
+ Attribute = FS_GetAttribFromDBLK( fsh, dblk );
+ LBA = FS_ViewLBAinDBLK( dblk );
+
+ if ( ObjectType == AFP_OBJECT ) {
+ ObjectType = TRUE;
+ }
+ else {
+ ObjectType = FALSE;
+ }
+
+ QTC_AddFileToCatalog( build, DisplaySize, buffer, Date, Time, Attribute, LBA, ObjectType, xtra_bytes, xtra_size );
+
+ if ( Attribute & OBJ_CORRUPT_BIT ) {
+ QTC_BlockBad( build );
+ }
+
+ free( buffer );
+ }
+ break;
+
+ case BT_DDB:
+
+ DisplaySize = FS_GetDisplaySizeFromDBLK( fsh, dblk );
+
+ nPathLength = FS_SizeofOSPathInDDB( fsh, dblk );
+
+ buffer = malloc( nPathLength * sizeof(CHAR) );
+
+ if ( buffer ) {
+
+ FS_GetOSPathFromDDB( fsh, dblk, buffer );
+ FS_GetMDateFromDBLK( fsh, dblk, &datetime );
+
+ Date = ConvertDateDOS( &datetime );
+ Time = ConvertTimeDOS( &datetime );
+
+ Attribute = FS_GetAttribFromDBLK( fsh, dblk );
+ LBA = FS_ViewLBAinDBLK( dblk );
+
+ QTC_AddDirectoryToCatalog( build, DisplaySize, buffer, nPathLength, Date, Time, Attribute, LBA, xtra_bytes, xtra_size );
+
+ // FillFakeInfo( build, buffer, nPathLength, DisplaySize, Date, Time, Attribute, LBA, xtra_bytes, xtra_size );
+
+ if ( Attribute & OBJ_CORRUPT_BIT ) {
+ QTC_BlockBad( build );
+ }
+
+ free( buffer );
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+VOID FillFakeInfo( QTC_BUILD_PTR build, CHAR *buff, INT nPathLength, UINT64 DisplaySize, UINT16 Date, UINT16 Time, UINT32 Attribute, UINT32 LBA, BYTE *xtra_bytes, UINT xtra_size )
+{
+ CHAR buffer[ 8192 ];
+
+ if ( nPathLength > 2 ) {
+
+ memcpy( buffer, buff, nPathLength * sizeof(CHAR) );
+
+ while ( nPathLength < 4096 ) {
+
+ strcpy( &buffer[ nPathLength / sizeof(CHAR) ], TEXT("bark like a dog") );
+ nPathLength += 32;
+ }
+
+ QTC_AddDirectoryToCatalog( build, DisplaySize, buffer, nPathLength, Date, Time, Attribute, LBA, xtra_bytes, xtra_size );
+ }
+
+}
+
diff --git a/private/utils/ntbackup/src/queues.c b/private/utils/ntbackup/src/queues.c
new file mode 100644
index 000000000..c2199bb78
--- /dev/null
+++ b/private/utils/ntbackup/src/queues.c
@@ -0,0 +1,914 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: queues.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: ALL of the code that deals with queues in one simple
+ easy to deal with place.
+
+
+ $Log: M:/LOGFILES/QUEUES.C_V $
+
+ Rev 1.3 24 Nov 1993 14:51:36 BARRY
+Unicode fixes
+
+ Rev 1.2 08 Sep 1993 12:37:22 JOHNES
+Added TopOfStack_with_0_values for those cases where you want to know if the
+stack is empty or the next value is just 0.
+
+
+ Rev 1.1 17 Nov 1992 22:18:32 DAVEV
+unicode fixes
+
+ Rev 1.0 30 Oct 1992 12:47:26 STEVEN
+Initial revision.
+
+
+**/
+/* begin include list */
+
+/* $end$ include list */
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "cli.h"
+
+static INT16 ElementCount( Q_HEADER_PTR q_hdr, Q_ELEM_PTR q_el ) ;
+
+/**/
+/**
+
+ Name: DeQueueElem
+
+ Description: Dequeue an element for the specified queue.
+
+ Modified: 8/9/1989 13:42:20
+
+ Returns: A pointer to the element that was dequeue'd or a null
+ if the queue was empty.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+Q_ELEM_PTR DeQueueElem(
+Q_HEADER_PTR queue ) /* The queue */
+{
+ Q_ELEM_PTR element = NULL ;
+ BOOLEAN prev_state;
+
+ prev_state = DisableInterrupts() ;
+
+
+ if( ( element = queue->q_head ) != NULL ) {
+ queue->q_count-- ;
+ if( queue->q_tail == element ) {
+ queue->q_tail = NULL ;
+ }
+ queue->q_head = element->q_next ;
+ if( element->q_next != NULL ) {
+ element->q_next->q_prev = NULL ;
+ element->q_next = NULL ;
+ }
+ element->q_next = NULL; /* let's practice safe coding */
+ element->q_prev = NULL;
+ }
+
+ RestoreInterruptState( prev_state );
+ return( element ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: EnQueueElem
+
+ Description: Enqueues an element on the specified queue. If the priority
+ field is TRUE, this function will enqueue the element in sorted
+ order based on the "q_priority" field in the element structure.
+
+ Modified: 8/9/1989 13:38:31
+
+ Returns: A pointer to that element.
+
+ Notes:
+
+ See also: $/SEE( DeQeueuElem )$
+
+ Declaration:
+
+**/
+
+Q_ELEM_PTR EnQueueElem(
+Q_HEADER_PTR queue, /* The destination queue */
+Q_ELEM_PTR element, /* The element */
+BOOLEAN w_priority ) /* Enqueue w/ priority */
+{
+ Q_ELEM_PTR telem ;
+ BOOLEAN prev_state;
+
+ prev_state = DisableInterrupts() ;
+
+
+ /* If priority insertion is not set or there are no elements on
+ the stack. */
+ if( !w_priority || !queue->q_count ) {
+ element->q_next = NULL ; /* end of queue */
+ element->q_prev = queue->q_tail ; /* previous = queue's old tail */
+ if( !QueueCount( queue ) ) {
+ queue->q_head = element ; /* 0 elems .. element is head */
+ } else {
+ queue->q_tail->q_next = element ; /* old tail's next is elem */
+ }
+ queue->q_tail = element ; /* tail is always element */
+ } else {
+ telem = QueueHead( queue ) ; /* set temp to head */
+ while ( telem ) {
+ if( element->q_priority <= telem->q_priority ) {
+ element->q_next = telem ;
+ element->q_prev = telem->q_prev ;
+ if( !telem->q_prev ) {
+ queue->q_head = element ;
+ } else {
+ telem->q_prev->q_next = element ;
+ }
+ telem->q_prev = element ;
+ /* takes care of if element is being inserted
+ at head */
+ break ;
+ }
+ telem = QueueNext( telem ) ;
+ }
+ /* insert at tail */
+ if( !telem ) {
+ element->q_next = NULL ;
+ element->q_prev = queue->q_tail ;
+ queue->q_tail->q_next = element ;
+ queue->q_tail = element ;
+ }
+ }
+ queue->q_count++ ;
+ element->q_element = queue->q_magic++ ;
+
+ RestoreInterruptState( prev_state );
+ return( element ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: FindQueueElem
+
+ Description: Finds the specified queue element in a queue.
+
+ Modified: 8/9/1989 13:50:33
+
+ Returns: A NULL if it was not found, and a pointer to the element
+ if it was.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+Q_ELEM_PTR FindQueueElem(
+Q_HEADER_PTR queue ,
+Q_ELEM_PTR element )
+{
+ INT16 i ;
+ Q_ELEM_PTR next_elem ;
+
+ next_elem = QueueHead( queue ) ;
+
+ for( i = 0 ; i < QueueCount( queue ) ; i++ ) {
+ if( next_elem == element ) {
+ return( next_elem ) ;
+ }
+ next_elem = QueueNext( next_elem ) ;
+ }
+
+ return( NULL ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: InitQueue
+
+ Description: Initializes a queue header
+
+ Modified: 7/12/1989
+
+ Returns: It's a VOID dummy
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID InitQueue(
+Q_HEADER_PTR queue )
+{
+ queue->q_head = queue->q_tail = NULL ;
+ queue->q_count = 0 ;
+ queue->q_active = TRUE ;
+ queue->q_magic = 1 ;
+
+ return ;
+}
+
+
+/**/
+/**
+
+ Name: InitQelem
+
+ Description: Initialises a queue element.
+
+ Modified: 8/9/1989 13:37:8
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID InitQElem(
+Q_ELEM_PTR element )
+{
+ element->q_prev = element->q_next = NULL ;
+ element->q_element = 0 ;
+ element->q_priority = 0L ;
+
+ return ;
+}
+
+
+/**/
+/**
+
+ Name: InsertElem
+
+ Description: Inserts an element into a queue. If the "boa" field is set
+ to 0 ( defined as BEFORE in queues.h ), this will insert the
+ element before the anchor element. If it is set to 1 ( defined
+ as AFTER in queues.h ), it will insert it after.
+
+ Modified: 8/9/1989 13:44:55
+
+ Returns: A pointer to the inserted element.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+Q_ELEM_PTR InsertElem(
+Q_HEADER_PTR q ,
+Q_ELEM_PTR anchor ,
+Q_ELEM_PTR elem ,
+UINT16 boa )
+{
+
+ if( boa == BEFORE ) {
+ if( anchor->q_prev != NULL ) {
+ elem->q_prev = anchor->q_prev ;
+ anchor->q_prev->q_next = elem ;
+ }
+ else {
+ elem->q_prev = NULL;
+ q->q_head = elem;
+ }
+ elem->q_next = anchor ;
+ anchor->q_prev = elem ;
+ }
+ else /* boa == AFTER */ {
+
+ if( anchor->q_next != NULL ) {
+ elem->q_next = anchor->q_next ;
+ anchor->q_next->q_prev = elem ;
+ }
+ else {
+ elem->q_next = NULL ;
+ q->q_tail = elem;
+ }
+ elem->q_prev = anchor ;
+ anchor->q_next = elem ;
+ }
+ elem->q_element = q->q_magic++;
+ q->q_count++ ;
+
+ return elem ;
+
+}
+
+
+/**/
+/**
+
+ Name: MoveQueue
+
+ Description: Moves the elements of the "from_queue" to "to_queue".
+
+ Modified: 10/16/1989 10:52:28
+
+ Returns: Nothing.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID MoveQueue(
+Q_HEADER_PTR from_queue,
+Q_HEADER_PTR to_queue )
+{
+ while( from_queue->q_count ) {
+ EnQueueElem( to_queue, DeQueueElem( from_queue ), FALSE ) ;
+ }
+ return ;
+}
+
+
+/**/
+/**
+
+ Name: PopElem
+
+ Description: Functions exactly like DeQueueElem, returns a pointer to the
+ head of the queue, and deletes the head from off the queue.
+
+ Modified: 8/9/1989 13:54:34
+
+ Returns: A pointer to the element that was popped, or NULL if the
+ list is empty.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+Q_ELEM_PTR PopElem(
+Q_HEADER_PTR queue )
+{
+ return( DeQueueElem( queue ) ) ;
+}
+
+/**/
+/**
+
+ Name: PushElem
+
+ Description: This makes a queue function like a stack. Unlike EnQueueElem()
+ which puts the element at the tail of the specified queue,
+ PushElem() puts the element on the head of the queue.
+
+ Modified: 8/9/1989 13:52:59
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID PushElem(
+Q_HEADER_PTR queue,
+Q_ELEM_PTR element )
+{
+ BOOLEAN prev_state;
+
+ prev_state = DisableInterrupts() ;
+
+ element->q_prev = NULL ;
+ element->q_next = QueueHead( queue ) ;
+ element->q_element = queue->q_magic++ ;
+ if( !QueueCount( queue ) ) {
+ queue->q_tail = element ;
+ } else {
+ queue->q_head->q_prev = element ;
+ }
+ queue->q_head = element ;
+ queue->q_count++ ;
+
+ RestoreInterruptState( prev_state );
+ return ;
+}
+
+/**/
+/**
+
+ Name: RemoveElem
+
+ Description: Routine for removing an element from a queue.
+ No error checking is performed and the element is assumed
+ to be a valid one. Currently this routine is used by
+ RemoveQueueElem() and SearchQueue().
+
+
+ Modified: 10/16/1989 10:49:46
+
+ Returns: Nothing.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID RemoveElem(
+Q_HEADER_PTR queue,
+Q_ELEM_PTR element )
+{
+ queue->q_count-- ;
+
+ if( queue->q_head == element ) {
+ queue->q_head = QueueNext( element ) ;
+ }
+ if( queue->q_tail == element ) {
+ queue->q_tail = QueuePrev( element ) ;
+ }
+ if( element->q_prev != NULL ) {
+ element->q_prev->q_next = QueueNext( element ) ;
+ }
+ if( element->q_next != NULL ) {
+ element->q_next->q_prev = QueuePrev( element ) ;
+ }
+ element->q_prev = element->q_next = NULL ;
+
+ return ;
+}
+
+
+/**/
+/**
+
+ Name: RemoveQueueElem
+
+ Description: Removes a queue element from a queue.
+
+ Modified: 8/9/1989 13:48:48
+
+ Returns: Returns SUCCESS if the element was not removed, and FAILURE
+ if it was not.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN RemoveQueueElem(
+Q_HEADER_PTR queue,
+Q_ELEM_PTR element )
+{
+ Q_ELEM_PTR temp ;
+ BOOLEAN ret = FAILURE ;
+ BOOLEAN prev_state;
+
+ prev_state = DisableInterrupts() ;
+
+ for( temp = QueueHead( queue ) ;
+ ( ( temp != NULL ) && ( element != temp ) ) ;
+ temp = QueueNext( temp ) ) ;
+ if( temp != NULL ) {
+ RemoveElem( queue, element ) ;
+ ret = SUCCESS ;
+ }
+
+ RestoreInterruptState( prev_state );
+ return ret ;
+}
+
+
+/**/
+/**
+
+ Name: SortQueue
+
+ Description: This function sorts the specified queue into order. A pointer
+ to the compare rountine is passed to the function. This compare
+ routine must follow the following conventions:
+
+ 1) It takes two Q_ELEM pointers ( Q_ELEM_PTR ) as its
+ arguements.
+
+ 2) It returns a <0 for parm1 < parm2, 0 for parm1 == parm2,
+ and >0 for parm1 > parm2.
+
+ 3) This function is slower than molasses on the north pole.
+ You should build/maintain your queue in order so that you
+ never have to sort it.
+
+ Modified: 10/16/1989 10:38:47
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID SortQueue(
+Q_HEADER_PTR queue,
+INT16 ( *cmp )( Q_ELEM_PTR, Q_ELEM_PTR ) )
+{
+ INT16 i ;
+ INT16 end ;
+ BOOLEAN any_swaps ;
+ Q_ELEM_PTR cur_el, temp ;
+
+ end = QueueCount( queue );
+ if( end > 1 ) {
+ do {
+ cur_el = QueueHead( queue ) ;
+ any_swaps = FALSE ;
+ for( i = 1 ; i < end; i++ ) {
+ if( (*cmp)( cur_el, QueueNext(cur_el)) > 0) {
+ temp = QueueNext( cur_el );
+
+ if ( QueueHead( queue ) == cur_el ) {
+ queue->q_head = temp;
+ }
+ else {
+ QueuePrev( cur_el )->q_next = temp ;
+ }
+ temp->q_prev = QueuePrev( cur_el );
+
+ if ( QueueTail( queue ) == temp ) {
+ queue->q_tail = cur_el;
+ }
+ else {
+ QueueNext( temp )->q_prev = cur_el ;
+ }
+ cur_el->q_next = QueueNext( temp );
+
+ temp->q_next = cur_el;
+ cur_el->q_prev = temp;
+
+
+ any_swaps = TRUE ;
+ }
+ else {
+ cur_el = QueueNext( cur_el );
+ }
+ }
+ end -- ;
+ } while( any_swaps ) ;
+ }
+ return ;
+}
+
+/**/
+/**
+
+ Name: SplitQueue( )
+
+ Description: Splits a queue into two queues at a specified element.
+
+ Modified: 2/21/1990
+
+ Returns: Pointer to the new_Q
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+Q_HEADER_PTR SplitQueue(
+Q_HEADER_PTR old_Q, /* I/O - the original queue */
+Q_ELEM_PTR split, /* I - the element to split at */
+Q_HEADER_PTR new_Q ) /* O - a queue header for the new queue */
+
+{
+ BOOLEAN prev_state ; /* saves interrupt enable state */
+ INT16 q_ct ; /* saves current count in queue */
+
+ InitQueue( new_Q ) ;
+
+ if ( split ) {
+ prev_state = DisableInterrupts( ) ;
+
+ if ( old_Q->q_head != split ) {
+ q_ct = QueueCount( old_Q ) ;
+ old_Q->q_count = ElementCount( old_Q, split ) ;
+
+ new_Q->q_tail = old_Q->q_tail ;
+
+ if ( old_Q->q_tail = split->q_prev ) {
+ old_Q->q_tail->q_next = NULL ;
+ }
+ split->q_prev = NULL ;
+
+ new_Q->q_head = split ;
+ new_Q->q_count = q_ct - old_Q->q_count ;
+ new_Q->q_magic = old_Q->q_magic ;
+
+ } else {
+ *new_Q = *old_Q ;
+ InitQueue( old_Q ) ;
+ }
+
+ RestoreInterruptState( prev_state ) ;
+ }
+
+ return new_Q ;
+}
+
+/**/
+/**
+
+ Name: ElementCount
+
+ Description: Finds the number of elements in the queue PRECEDING a
+ specific queue element.
+
+ Modified: 2/21/1990
+
+ Returns: The number of elements found preceding the element.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+static INT16 ElementCount(
+Q_HEADER_PTR q_hdr,
+Q_ELEM_PTR q_el )
+{
+ Q_ELEM_PTR tmp ;
+ INT16 ct = 0 ;
+
+ for ( tmp = q_hdr->q_head ; tmp != NULL && tmp != q_el ; tmp = tmp->q_next ) {
+ ct++ ;
+ }
+
+ return ct ;
+}
+
+
+/**/
+/**
+
+ Name: SearchQueue
+
+ Description: This function searches the specifed queue for the first
+ occurrence of a member which satisfies the compare routine.
+ The compare routine must follow these guidelines.
+
+ 1) It takes two character pointers: the first is to be a
+ cast of the element and the second is the 'parm'.
+
+ 2) It returns TRUE when the cmp function is satisfied
+ with the element.
+
+ The boolean 'remove' flag is used to indicate whether of not
+ the caller wishes the found element to be removed from the
+ queue.
+
+ Modified: 10/16/1989 10:42:43
+
+ Returns: An element pointer to the found element or NULL if not
+ found.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+Q_ELEM_PTR SearchQueue(
+Q_HEADER_PTR queue ,
+BOOLEAN ( *cmp )( VOID_PTR, VOID_PTR ) ,
+VOID_PTR parm ,
+BOOLEAN remove )
+{
+ Q_ELEM_PTR element ;
+ BOOLEAN prev_state;
+
+ prev_state = DisableInterrupts() ;
+
+
+ for( element = QueueHead( queue ) ;
+ ( ( element != NULL ) && !( (*cmp)( element, parm ) ) ) ;
+ element = QueueNext( element ) ) ;
+ if( remove && ( element != NULL ) ) {
+ RemoveElem( queue, element ) ;
+ }
+
+ RestoreInterruptState( prev_state );
+ return( element ) ;
+}
+
+
+//
+// Stacks Code Below Here
+//
+
+/**/
+/** :FH1: Copyright (C) Maynard Electronics, Inc. 1988
+
+ :Name: InitStack() - Initialize a Stack
+
+ :Declaration: VOID InitStack( STACK_HDR_PTR stack )
+
+ :Description: This routine will initialize a "STACK_HDR". The
+ stack header is actually a "QUEUE_HDR".
+
+ :See Also: InitQueue()
+
+ :Notes:
+
+ :Design:
+
+**/
+VOID InitStack(
+STACK_HDR_PTR stack )
+{
+ InitQueue( ( Q_HEADER_PTR ) stack ) ;
+ return ;
+}
+
+/**/
+/** :FH1: Copyright (C) Maynard Electronics, Inc. 1988
+
+ :Name: Push() - Push an item on the Stack
+
+ :Declaration: UINT16 Push( STACK_HDR_PTR stack, UINT32 item )
+
+ :Description: This routine will "push" an item on the stack. A
+ Queue element is allocated for the item, the item
+ is stored in the Queue element and "pushed" onto
+ the stack.
+
+ If we are unable to allocate a "Queue" Element then
+ this routine will fail to "push" the element, and return
+ a non zero value.
+
+ :See Also: PushElem()
+
+ :Notes:
+
+ :Design:
+
+**/
+UINT16 Push(
+STACK_HDR_PTR stack,
+UINT32 item )
+{
+ STACK_ELEM_PTR qptr ;
+
+ /* Allocate the memory and enqueue the item */
+ if( ( qptr = ( STACK_ELEM_PTR ) malloc( sizeof( STACK_ELEM ) ) ) != NULL ) {
+ InitQElem( ( Q_ELEM_PTR ) qptr ) ;
+ qptr->item = item ;
+ PushElem( ( Q_HEADER_PTR ) stack, ( Q_ELEM_PTR ) qptr ) ;
+ return SUCCESS ;
+ }
+ return FAILURE ;
+}
+
+/**/
+/** :FH1: Copyright (C) Maynard Electronics, Inc. 1988
+
+ :Name: Pop() - Pop an item from the Stack
+
+ :Declaration: UINT32 Pop( STACK_HDR_PTR stack )
+
+ :Description: This routine will "pop" an item on the stack. This
+ routine will return NULL if there are no more items
+ on the stack.
+
+ :See Also: PushElem()
+
+ :Notes:
+
+ :Design:
+
+**/
+UINT32 Pop(
+STACK_HDR_PTR stack )
+{
+ STACK_ELEM_PTR qptr ;
+ UINT32 item ;
+
+ if( ( qptr = ( STACK_ELEM_PTR ) PopElem( ( Q_HEADER_PTR ) stack ) ) != NULL ) {
+ item = qptr->item ;
+ free( qptr ) ;
+ return item ;
+ }
+ return (UINT32)0;
+}
+
+/**/
+/** :FH1: Copyright (C) Maynard Electronics, Inc. 1988
+
+ :Name: TopOfStack() - Get Top of Stack
+
+ :Declaration: UINT32 TopOfStack( STACK_HDR_PTR stack )
+
+ :Description: This routine will return the top of the stack. This
+ routine will return NULL if there are no more items
+ on the stack.
+
+ :See Also:
+
+ :Notes:
+
+ :Design:
+
+**/
+UINT32 TopOfStack(
+STACK_HDR_PTR stk_ptr )
+{
+ if( stk_ptr->q_head != NULL ) {
+ return( ( ( STACK_ELEM_PTR ) stk_ptr->q_head )->item ) ;
+ }
+ return (UINT32)0 ;
+}
+
+
+
+/**/
+/** :FH1: Copyright (C) Maynard Electronics, Inc. 1988 - 1993
+
+ :Name: TopOfStack_with_0_values() - Get Top of Stack
+
+ :Declaration: UINT32 TopOfStack( STACK_HDR_PTR stack )
+
+ :Description: This routine will return the top value of a stack which
+ may contain the value 0. If there are no more values
+ on the stack, it will return FAILURE.
+
+ :See Also:
+
+ :Notes:
+
+ :Design:
+
+**/
+UINT16 TopOfStack_with_0_values( stk_ptr, stk_elem )
+STACK_HDR_PTR stk_ptr ;
+UINT32_PTR stk_elem ;
+{
+ if( stk_ptr->q_head != NULL ) {
+
+ *stk_elem = (UINT32)( ( STACK_ELEM_PTR ) stk_ptr->q_head )->item ;
+
+ return SUCCESS ;
+ }
+ return FAILURE ;
+}
diff --git a/private/utils/ntbackup/src/resmang.c b/private/utils/ntbackup/src/resmang.c
new file mode 100644
index 000000000..10699bd1a
--- /dev/null
+++ b/private/utils/ntbackup/src/resmang.c
@@ -0,0 +1,1381 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: resmang.c
+
+ Description: This file contains the functions for windows resource calls.
+ It processes requests for loading, drawing, sizing,
+ background color replacing, and freeing of bitmaps.
+
+
+ $Log: G:/UI/LOGFILES/RESMANG.C_V $
+
+ Rev 1.34 03 Aug 1993 19:44:08 MARINA
+RSM_GetBitmapSize(), RSM_GetFontSize(): changed params to LPINT
+
+ Rev 1.33 28 Jul 1993 18:19:52 MARINA
+enable c++
+
+ Rev 1.32 09 Jun 1993 16:39:22 GLENN
+Adjusted max font width for fixed fonts due to integer division truncating.
+
+ Rev 1.31 07 Jun 1993 14:03:06 GLENN
+Fixed the true type font display problem by kludging the max char width.
+
+ Rev 1.30 04 Jun 1993 14:50:14 TerriLynn
+
+I added the #define OS_WIN32 to the Global Alloc code. Bimini's startup
+bitmap does not paint correctly with this NT specific code."
+
+
+
+ Rev 1.29 14 Apr 1993 16:00:36 GLENN
+Added GlobalAlloc()/GlobalFree() to be able to create bitmaps greater than 64K.
+
+ Rev 1.28 14 Apr 1993 10:54:10 GLENN
+Now copying the bitmap resouce to our memory before modifying the color table. (STEVED)
+
+ Rev 1.27 02 Apr 1993 14:10:22 GLENN
+Added display info support. Fixed background color problem.
+
+ Rev 1.26 10 Mar 1993 11:18:48 ROBG
+Fixed extra comma problem found by the Mike Meister.
+
+ Rev 1.25 02 Mar 1993 15:00:02 ROBG
+Added logic to keep the value of a loaded bitmap equal to the
+original value in the executable. The color table, once used
+to create a memory-based bitmap, is restored to its original state.
+NT requires this.
+
+ Rev 1.24 14 Dec 1992 12:23:54 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.23 18 Nov 1992 11:39:16 GLENN
+Removed warnings.
+
+ Rev 1.22 11 Nov 1992 16:34:30 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.21 01 Nov 1992 16:06:16 DAVEV
+Unicode changes
+
+ Rev 1.20 07 Oct 1992 15:10:58 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.19 04 Oct 1992 19:40:12 DAVEV
+Unicode Awk pass
+
+ Rev 1.18 09 Sep 1992 17:00:12 GLENN
+Updated NEW LOOK toolbar bitmap stuff for BIMINI.
+
+ Rev 1.17 08 Sep 1992 15:41:22 GLENN
+Added more room for new bitmaps.
+
+ Rev 1.16 20 Aug 1992 09:05:32 GLENN
+ifdef'd NT bitmaps just a little bit further.
+
+ Rev 1.15 03 Jun 1992 13:31:42 JOHNWT
+added empty dir bitmaps
+
+ Rev 1.14 18 May 1992 09:00:52 MIKEP
+header
+
+ Rev 1.13 14 May 1992 18:36:16 STEVEN
+40Format changes
+
+ Rev 1.12 22 Apr 1992 17:34:12 GLENN
+Added shark and diver bitmap stuff.
+
+ Rev 1.11 21 Apr 1992 16:48:06 chrish
+NT changes
+
+ Rev 1.10 30 Mar 1992 18:01:42 GLENN
+Added support for pulling resources from .DLL
+
+ Rev 1.9 27 Mar 1992 17:34:08 GLENN
+Changed cursor and icon load macros to functions.
+
+ Rev 1.8 09 Mar 1992 09:18:20 GLENN
+Added logo bitmap support.
+
+ Rev 1.7 25 Feb 1992 21:34:24 GLENN
+Created RSM_Sprintf().
+
+ Rev 1.6 05 Feb 1992 17:53:12 GLENN
+In Process - adding logic to calc bitmap string width.
+
+ Rev 1.5 24 Jan 1992 14:48:34 GLENN
+Removed the msassert calls, should not kill the app.
+
+ Rev 1.4 07 Jan 1992 17:41:58 GLENN
+Preloading some more bitmaps.
+
+ Rev 1.3 15 Dec 1991 10:28:20 MIKEP
+hidden files
+
+ Rev 1.2 12 Dec 1991 17:09:06 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.1 10 Dec 1991 13:54:16 GLENN
+Added functions for get bitmap, font, font string sizes
+
+ Rev 1.0 20 Nov 1991 19:31:16 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static HBITMAP BMTable[] = {
+
+ 0, // 0 IDRBM_FLOPPYDRIVE
+ 0, // 1 IDRBM_HARDDRIVE
+ 0, // 2 IDRBM_RAMDRIVE
+ 0, // 3 IDRBM_NETDRIVE
+ 0, // 4 IDRBM_TAPEDRIVE01
+ 0, // 5 IDRBM_TAPEDRIVE02
+ 0, // 6 IDRBM_TAPEDRIVE03
+ 0, // 7 IDRBM_MACRO
+ 0, // 8 IDRBM_SEL_NONE
+ 0, // 9 IDRBM_SEL_PART
+ 0, // 10 IDRBM_SEL_ALL
+ 0, // 11 IDRBM_FOLDER
+ 0, // 12 IDRBM_FOLDERPLUS
+ 0, // 13 IDRBM_FOLDERMINUS
+ 0, // 14 IDRBM_EXE
+ 0, // 15 IDRBM_FILE
+ 0, // 16 IDRBM_DOC
+ 0, // 17 IDRBM_FOLDEROPEN
+ 0, // 18 IDRBM_FOLDERPLUSOPEN
+ 0, // 19 IDRBM_FOLDERMINUSOPEN
+ 0, // 20 IDRBM_BACKUP
+ 0, // 21 IDRBM_RESTORE
+ 0, // 22 IDRBM_ERASE
+ 0, // 23 IDRBM_RETENSION
+ 0, // 24 IDRBM_JOBSTATUS
+ 0, // 25 IDRBM_SELECT
+ 0, // 26 IDRBM_SELECTALL
+ 0, // 27 IDRBM_DESELECT
+ 0, // 28 IDRBM_CHECK
+ 0, // 29 IDRBM_UNCHECK
+ 0, // 30 IDRBM_MODIFIED
+ 0, // 31 IDRBM_ADVANCED
+ 0, // 32 IDRBM_UNDO
+ 0, // 33 IDRBM_RUN
+ 0, // 34 IDRBM_SCHEDULE
+ 0, // 35 IDRBM_RECORD
+ 0, // 36 IDRBM_EDIT
+ 0, // 37 IDRBM_SAVE
+ 0, // 38 IDRBM_TEST
+ 0, // 39 IDRBM_INSERT
+ 0, // 40 IDRBM_DELETE
+ 0, // 41 IDRBM_SAVEAS
+ 0, // 42 IDRBM_CANCEL
+ 0, // 43 IDRBM_BACKUP_GRAY
+ 0, // 44 IDRBM_RESTORE_GRAY
+ 0, // 45 IDRBM_ERASE_GRAY
+ 0, // 46 IDRBM_TRANSFER
+ 0, // 47 IDRBM_TRANSFER_GRAY
+ 0, // 48 IDRBM_RETENSION_GRAY
+ 0, // 49 IDRBM_PARENTDIR
+ 0, // 50 IDRBM_MEMORY
+ 0, // 51 IDRBM_SEARCH
+ 0, // 52 IDRBM_TAPE
+ 0, // 53 IDRBM_SERVER
+ 0, // 54 IDRBM_SDISK
+ 0, // 55 IDRBM_BSET
+ 0, // 56 IDRBM_LOGFILE
+ 0, // 57 IDRBM_UPARROW
+ 0, // 58 IDRBM_DNARROW
+ 0, // 59 IDRBM_CATALOG
+ 0, // 60 IDRBM_VERIFY
+ 0, // 61 IDRBM_BSETPART
+ 0, // 62 IDRBM_SERVERDETACHED
+ 0, // 63 IDRBM_CHECK_GRAY
+ 0, // 64 IDRBM_UNCHECK_GRAY
+ 0, // 65 IDRBM_MODIFIED_GRAY
+ 0, // 66 IDRBM_ADVANCED_GRAY
+ 0, // 67 IDRBM_CATALOG_GRAY
+ 0, // 68 IDRBM_VERIFY_GRAY
+ 0, // 69 IDRBM_SEARCH_GRAY
+ 0, // 70 IDRBM_NEXTSET
+ 0, // 71 IDRBM_NEXTSET_GRAY
+ 0, // 72 IDRBM_EJECT
+ 0, // 73 IDRBM_EJECT_GRAY
+ 0, // 74 IDRBM_TAPEINDRIVE
+ 0, // 75 IDRBM_REWIND
+ 0, // 76 IDRBM_REWIND_GRAY
+ 0, // 77 IDRBM_LTAPE
+ 0, // 78 IDRBM_UPARROW_GRAY
+ 0, // 79 IDRBM_DOWNARROW_GRAY
+ 0, // 80 IDRBM_RT_ARROW_GRAY
+ 0, // 81 IDRBM_CORRUPTFILE
+ 0, // 82 IDRBM_FOLDERC
+ 0, // 83 IDRBM_FOLDERPLUSC
+ 0, // 84 IDRBM_FOLDERMINUSC
+ 0, // 85 IDRBM_FOLDEROPENC
+ 0, // 86 IDRBM_FOLDERPLUSOPENC
+ 0, // 87 IDRBM_FOLDERMINUSOPENC
+ 0, // 88 IDRBM_HFILE
+ 0, // 89 IDRBM_HEXE
+ 0, // 90 IDRBM_HCRPTFILE
+ 0, // 91 IDRBM_EXIT
+ 0, // 92 IDRBM_EXIT_GRAY
+ 0, // 93 IDRBM_LOGO
+ 0, // 94 IDRBM_SEL_ALL_RED
+ 0, // 95 IDRBM_CHECK_RED
+ 0, // 96 IDRBM_UNCHECK_RED
+ 0, // 97 IDRBM_ADVANCED_RED
+ 0, // 98 IDRBM_SHARK1
+ 0, // 99 IDRBM_SHARK2
+ 0, //100 IDRBM_SHARK3
+ 0, //101 IDRBM_DIVER1
+ 0, //102 IDRBM_DIVER2
+ 0, //103 IDRBM_DIVER3
+ 0, //104 IDRBM_FOLDER_EN
+ 0, //105 IDRBM_FOLDER_EM
+ 0, //106 IDRBM_FOLDER_EP
+ 0, //107 IDRBM_FOLDER_EON
+ 0, //108 IDRBM_FOLDER_EOM
+ 0, //109 IDRBM_FOLDER_EOP
+ 0, //110 IDRBM_FOLDER_ECN
+ 0, //111 IDRBM_FOLDER_ECM
+ 0, //112 IDRBM_FOLDER_ECP
+ 0, //113 IDRBM_FOLDER_EOCN
+ 0, //114 IDRBM_FOLDER_EOCM
+ 0, //115 IDRBM_FOLDER_EOCP
+ 0, //116 IDRBM_CDROM
+ 0, //117 IDRBM_TAPES
+ 0, //118 IDRBM_TAPESINDRIVE
+ 0, //119 IDRBM_NETCONNECT
+ 0, //120 IDRBM_NETCONNECT_GRAY
+ 0, //121 IDRBM_NETDISCON
+ 0, //122 IDRBM_NETDISCON_GRAY
+ 0, //123 IDRBM_FLOPPYSINDRIVE
+ 0, //124 IDRBM_FLOPPYINDRIVE
+ 0, //125 IDRBM_FLOPPYS
+ 0, //126 IDRBM_FLOPPY
+ 0, //127 IDRBM_INFO
+ 0, //128 IDRBM_INFO_GRAY
+ 0, //129 IDRBM_COLINDICATOR
+ 0, //130 IDRBM_EMS_ENTERPRISE
+ 0, //131 IDRBM_EMS_SITE
+ 0, //132 IDRBM_EMS_SERVER
+ 0, //133 IDRBM_EMS_MDB
+ 0, //134 IDRBM_EMS_DSA
+ 0, //135 IDRBM_RCVR_STATUS
+ 0, //136 IDRBM_EMS_MDBX
+ 0, //137 IDRBM_EMS_DSAX
+ 0, //138 IDRBM_EMS_MDBP
+ 0, //139 IDRBM_EMS_DSAP
+ 0, //140 IDRBM_BLANK16x16
+};
+
+
+static HBITMAP BMTableButton[] = {
+
+ 0, // 0 IDRBM_FLOPPYDRIVE
+ 0, // 1 IDRBM_HARDDRIVE
+ 0, // 2 IDRBM_RAMDRIVE
+ 0, // 3 IDRBM_NETDRIVE
+ 0, // 4 IDRBM_TAPEDRIVE01
+ 0, // 5 IDRBM_TAPEDRIVE02
+ 0, // 6 IDRBM_TAPEDRIVE03
+ 0, // 7 IDRBM_MACRO
+ 0, // 8 IDRBM_SEL_NONE
+ 0, // 9 IDRBM_SEL_PART
+ 0, // 10 IDRBM_SEL_ALL
+ 0, // 11 IDRBM_FOLDER
+ 0, // 12 IDRBM_FOLDERPLUS
+ 0, // 13 IDRBM_FOLDERMINUS
+ 0, // 14 IDRBM_EXE
+ 0, // 15 IDRBM_FILE
+ 0, // 16 IDRBM_DOC
+ 0, // 17 IDRBM_FOLDEROPEN
+ 0, // 18 IDRBM_FOLDERPLUSOPEN
+ 0, // 19 IDRBM_FOLDERMINUSOPEN
+ 0, // 20 IDRBM_BACKUP
+ 0, // 21 IDRBM_RESTORE
+ 0, // 22 IDRBM_ERASE
+ 0, // 23 IDRBM_RETENSION
+ 0, // 24 IDRBM_JOBSTATUS
+ 0, // 25 IDRBM_SELECT
+ 0, // 26 IDRBM_SELECTALL
+ 0, // 27 IDRBM_DESELECT
+ 0, // 28 IDRBM_CHECK
+ 0, // 29 IDRBM_UNCHECK
+ 0, // 30 IDRBM_MODIFIED
+ 0, // 31 IDRBM_ADVANCED
+ 0, // 32 IDRBM_UNDO
+ 0, // 33 IDRBM_RUN
+ 0, // 34 IDRBM_SCHEDULE
+ 0, // 35 IDRBM_RECORD
+ 0, // 36 IDRBM_EDIT
+ 0, // 37 IDRBM_SAVE
+ 0, // 38 IDRBM_TEST
+ 0, // 39 IDRBM_INSERT
+ 0, // 40 IDRBM_DELETE
+ 0, // 41 IDRBM_SAVEAS
+ 0, // 42 IDRBM_CANCEL
+ 0, // 43 IDRBM_BACKUP_GRAY
+ 0, // 44 IDRBM_RESTORE_GRAY
+ 0, // 45 IDRBM_ERASE_GRAY
+ 0, // 46 IDRBM_TRANSFER
+ 0, // 47 IDRBM_TRANSFER_GRAY
+ 0, // 48 IDRBM_RETENSION_GRAY
+ 0, // 49 IDRBM_PARENTDIR
+ 0, // 50 IDRBM_MEMORY
+ 0, // 51 IDRBM_SEARCH
+ 0, // 52 IDRBM_TAPE
+ 0, // 53 IDRBM_SERVER
+ 0, // 54 IDRBM_SDISK
+ 0, // 55 IDRBM_BSET
+ 0, // 56 IDRBM_LOGFILE
+ 0, // 57 IDRBM_UPARROW
+ 0, // 58 IDRBM_DNARROW
+ 0, // 59 IDRBM_CATALOG
+ 0, // 60 IDRBM_VERIFY
+ 0, // 61 IDRBM_BSETPART
+ 0, // 62 IDRBM_SERVERDETACHED
+ 0, // 63 IDRBM_CHECK_GRAY
+ 0, // 64 IDRBM_UNCHECK_GRAY
+ 0, // 65 IDRBM_MODIFIED_GRAY
+ 0, // 66 IDRBM_ADVANCED_GRAY
+ 0, // 67 IDRBM_CATALOG_GRAY
+ 0, // 68 IDRBM_VERIFY_GRAY
+ 0, // 69 IDRBM_SEARCH_GRAY
+ 0, // 70 IDRBM_NEXTSET
+ 0, // 71 IDRBM_NEXTSET_GRAY
+ 0, // 72 IDRBM_EJECT
+ 0, // 73 IDRBM_EJECT_GRAY
+ 0, // 74 IDRBM_TAPEINDRIVE
+ 0, // 75 IDRBM_REWIND
+ 0, // 76 IDRBM_REWIND_GRAY
+ 0, // 77 IDRBM_LTAPE
+ 0, // 78 IDRBM_UPARROW_GRAY
+ 0, // 79 IDRBM_DOWNARROW_GRAY
+ 0, // 80 IDRBM_RT_ARROW_GRAY
+ 0, // 81 IDRBM_CORRUPTFILE
+ 0, // 82 IDRBM_FOLDERC
+ 0, // 83 IDRBM_FOLDERPLUSC
+ 0, // 84 IDRBM_FOLDERMINUSC
+ 0, // 85 IDRBM_FOLDEROPENC
+ 0, // 86 IDRBM_FOLDERPLUSOPENC
+ 0, // 87 IDRBM_FOLDERMINUSOPENC
+ 0, // 88 IDRBM_HFILE
+ 0, // 89 IDRBM_HEXE
+ 0, // 90 IDRBM_HCRPTFILE
+ 0, // 91 IDRBM_EXIT
+ 0, // 92 IDRBM_EXIT_GRAY
+ 0, // 93 IDRBM_LOGO
+ 0, // 94 IDRBM_SEL_ALL_RED
+ 0, // 95 IDRBM_CHECK_RED
+ 0, // 96 IDRBM_UNCHECK_RED
+ 0, // 97 IDRBM_ADVANCED_RED
+ 0, // 98 IDRBM_SHARK1
+ 0, // 99 IDRBM_SHARK2
+ 0, //100 IDRBM_SHARK3
+ 0, //101 IDRBM_DIVER1
+ 0, //102 IDRBM_DIVER2
+ 0, //103 IDRBM_DIVER3
+ 0, //104 IDRBM_FOLDER_EN
+ 0, //105 IDRBM_FOLDER_EM
+ 0, //106 IDRBM_FOLDER_EP
+ 0, //107 IDRBM_FOLDER_EON
+ 0, //108 IDRBM_FOLDER_EOM
+ 0, //109 IDRBM_FOLDER_EOP
+ 0, //110 IDRBM_FOLDER_ECN
+ 0, //111 IDRBM_FOLDER_ECM
+ 0, //112 IDRBM_FOLDER_ECP
+ 0, //113 IDRBM_FOLDER_EOCN
+ 0, //114 IDRBM_FOLDER_EOCM
+ 0, //115 IDRBM_FOLDER_EOCP
+ 0, //116 IDRBM_CDROM
+ 0, //117 IDRBM_TAPES
+ 0, //118 IDRBM_TAPESINDRIVE
+ 0, //119 IDRBM_NETCONNECT
+ 0, //120 IDRBM_NETCONNECT_GRAY
+ 0, //121 IDRBM_NETDISCON
+ 0, //122 IDRBM_NETDISCON_GRAY
+ 0, //123 IDRBM_FLOPPYSINDRIVE
+ 0, //124 IDRBM_FLOPPYINDRIVE
+ 0, //125 IDRBM_FLOPPYS
+ 0, //126 IDRBM_FLOPPY
+ 0, //127 IDRBM_INFO
+ 0, //128 IDRBM_INFO_GRAY
+ 0, //129 IDRBM_COLINDICATOR
+ 0, //130 IDRBM_EMS_ENTERPRISE
+ 0, //131 IDRBM_EMS_SITE
+ 0, //132 IDRBM_EMS_SERVER
+ 0, //133 IDRBM_EMS_MDB
+ 0, //134 IDRBM_EMS_DSA
+ 0, //135 IDRBM_RCVR_STATUS
+ 0, //136 IDRBM_EMS_MDBX
+ 0, //137 IDRBM_EMS_DSAX
+ 0, //138 IDRBM_EMS_MDBP
+ 0, //139 IDRBM_EMS_DSAP
+ 0, //140 IDRBM_BLANK16x16
+};
+
+#define NUMBITMAPS (sizeof (BMTable) / sizeof (BMTable[0]) )
+
+
+// MODULE WIDE VARIABLES - PRIVATE
+
+static COLORREF mwBitmapBackGnd;
+
+extern BOOL gfRedChecks;
+
+// PRIVATE FUNCTION PROTOTYPES
+
+
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: RSM_BitmapDraw()
+
+ Description: This function draws a bitmap at the specified
+ upper-left location using the specified dimensions.
+ If the bitmap handle was not previously loaded into
+ the bitmap table, the function loads it using the
+ the specified bitmap ID. If no width or height are
+ specified, the bitmap's width and height are used.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RSM_BitmapDraw (
+
+WORD wBitmapID, // I - ID of the bitmap to be drawn
+INT X, // I - starting X location
+INT Y, // I - starting Y location
+INT nWidth, // I - bitmap width
+INT nHeight, // I - bitmap height
+HDC hDC ) // I - handle to a device context
+
+{
+ BOOL fRC; // return code
+ HDC hDCMem1; // memory DC
+ HBITMAP hBM; // handle to the bitmap
+
+ // Get a handle to the bitmap and put it into a memory DC.
+ // Almost all of the time, the bitmap will already be loaded. This
+ // code is optimized (I hope) for this scenario.
+
+ if ( wBitmapID < BTNFACE_BACKGND + BM_OFFSET ) {
+ hBM = BMTable[ wBitmapID - BM_OFFSET ];
+
+ } else {
+
+ hBM = BMTableButton[ wBitmapID - BM_OFFSET - BTNFACE_BACKGND ];
+ }
+
+ if ( ! hBM ) {
+
+ hBM = RSM_BitmapLoad ( wBitmapID, mwBitmapBackGnd );
+
+ if ( ! hBM ) {
+ return TRUE;
+ }
+ }
+
+ hDCMem1 = CreateCompatibleDC ( hDC );
+ fRC = ! SelectObject ( hDCMem1, hBM );
+
+ if ( ! fRC ) {
+
+ SetMapMode ( hDCMem1, GetMapMode ( hDC ) );
+
+ // If the caller specified NULL for the WIDTH or HEIGHT, use the
+ // bitmaps WIDTH and HEIGHT for drawing.
+
+ if ( ! nWidth || ! nHeight ) {
+
+ BITMAP dsBM ;
+
+ GetObject ( hBM, sizeof (BITMAP), (LPSTR)&dsBM ) ;
+
+ nWidth = dsBM.bmWidth;
+ nHeight = dsBM.bmHeight;
+ }
+
+ fRC = BitBlt( hDC, // Destination device context.
+ X, // Destination X location.
+ Y, // Destination Y location.
+ nWidth, // Destination bitmap width.
+ nHeight, // Destination bitmap height.
+ hDCMem1, // Source device context.
+ 0, // Source X origin.
+ 0, // Source Y origin.
+ SRCCOPY // Copy the source to the destination.
+ );
+ }
+
+ DeleteDC ( hDCMem1 );
+
+ return fRC;
+
+} /* end RSM_BitmapDraw() */
+
+
+/******************************************************************************
+
+ Name: RSM_BitmapDrawCentered()
+
+ Description: This function draws a bitmap at the specified
+ upper-left location using the specified dimensions.
+ If the bitmap handle was not previously loaded into
+ the bitmap table, the function loads it using the
+ the specified bitmap ID. If no width or height are
+ specified, the bitmap's width and height are used.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RSM_BitmapDrawCentered (
+
+WORD wBitmapID, // I - ID of the bitmap to be drawn
+INT X, // I - starting X location
+INT Y, // I - starting Y location
+INT nWidth, // I - bitmap width
+INT nHeight, // I - bitmap height
+HDC hDC ) // I - handle to a device context
+
+{
+ BOOL fRC; // return code
+ HBITMAP hBM; // handle to the bitmap
+ BITMAP dsBM; // bitmap data structure
+ INT i; // temp integer
+
+ // Get a handle to the bitmap and put it into a memory DC.
+ // Almost all of the time, the bitmap will already be loaded. This
+ // code is optimized (I hope) for this scenario.
+
+ hBM = BMTable[ wBitmapID - BM_OFFSET ];
+
+ if ( ! hBM ) {
+
+ hBM = RSM_BitmapLoad ( wBitmapID, mwBitmapBackGnd );
+
+ if ( ! hBM ) {
+ return TRUE;
+ }
+ }
+
+ // Calculate the rectangular area dimensions to CENTER the BITMAP.
+
+ GetObject ( hBM, sizeof ( BITMAP ), (LPSTR)&dsBM );
+
+ i = nWidth - dsBM.bmWidth;
+
+ if ( i > 1 ) {
+
+ i = i / 2;
+
+ X += i;
+ nWidth -= i;
+ }
+
+ i = nHeight - dsBM.bmHeight;
+
+ if ( i > 1 ) {
+
+ i = i / 2;
+
+ Y += i;
+ nHeight -= i;
+ }
+
+// fRC = RSM_BitmapDraw ( wBitmapID, X, Y, nWidth, nHeight, hDC );
+
+ fRC = RSM_BitmapDraw ( wBitmapID, X, Y, dsBM.bmWidth, dsBM.bmHeight, hDC );
+
+ return fRC;
+
+} /* end RSM_BitmapDrawCentered() */
+
+
+/******************************************************************************
+
+ Name: RSM_BitmapFree()
+
+ Description: This function frees the memory associated with a bitmap,
+ then clears the handle out of the bitmap table.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RSM_BitmapFree (
+
+WORD wBitmapID ) // I - bitmap ID to be freed
+
+{
+ BOOL wStatus;
+
+ wStatus = DeleteObject ( BMTable[ wBitmapID - BM_OFFSET ] ) ;
+
+ BMTable[ wBitmapID - BM_OFFSET ] = 0;
+
+ return wStatus;
+
+} /* end RSM_BitmapFree() */
+
+
+/******************************************************************************
+
+ Name: RSM_BitmapFreeAll()
+
+ Description: This function frees all memory associated with all bitmaps.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RSM_BitmapFreeAll ( VOID )
+
+{
+ int i;
+
+ for ( i = 0; i < NUMBITMAPS; i++ ) {
+
+ if ( BMTable[i] ) {
+ DeleteObject ( BMTable[i] ) ;
+ BMTable[i] = 0;
+ }
+ }
+
+} /* end RSM_BitmapFreeAll() */
+
+
+/******************************************************************************
+
+ Name: RSM_BitmapInit()
+
+ Description: This function initializes the bitmap background color.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RSM_BitmapInit ( VOID )
+
+{
+ COLORREF ColorGray = GetSysColor ( COLOR_BTNFACE );
+ COLORREF ColorBackGnd = GetSysColor ( COLOR_WINDOW );
+ COLORREF BackGround;
+
+ // Load the bitmaps that do not require background color changes.
+
+
+ // Setup the color to use when replacing background color bits in bitmaps.
+ // Do this by CONVERTING the RGB to BGR, since DIB format uses BGRs --
+ // Who knows why?
+
+ // MAYBE pre-load some bitmaps that will be used immediately.
+
+ // OK, let's load the Selection Bar bitmaps with a gray (button face)
+ // background.
+
+ BackGround = RGB (
+ (BYTE)( HIWORD(ColorGray) ),
+ (BYTE)( (WORD)ColorGray >> 8 ),
+ (BYTE)ColorGray
+ );
+
+ RSM_BitmapLoad ( IDRBM_BACKUP, BackGround );
+ RSM_BitmapLoad ( IDRBM_BACKUP_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_RESTORE, BackGround );
+ RSM_BitmapLoad ( IDRBM_RESTORE_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_EJECT, BackGround );
+ RSM_BitmapLoad ( IDRBM_EJECT_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_CHECK, BackGround );
+ RSM_BitmapLoad ( IDRBM_CHECK_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_UNCHECK, BackGround );
+ RSM_BitmapLoad ( IDRBM_UNCHECK_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_CATALOG, BackGround );
+ RSM_BitmapLoad ( IDRBM_CATALOG_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_ERASE, BackGround );
+ RSM_BitmapLoad ( IDRBM_ERASE_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_RETENSION, BackGround );
+ RSM_BitmapLoad ( IDRBM_RETENSION_GRAY, BackGround );
+
+
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_HARDDRIVE, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_NETDRIVE, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_SEL_NONE, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_SEL_PART, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_SEL_ALL, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_FOLDER, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_FOLDERPLUS, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_FOLDERMINUS, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_EXE, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_FILE, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_FOLDEROPEN, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_FOLDERPLUSOPEN, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_FOLDERMINUSOPEN, BackGround );
+
+#ifdef OEM_EMS
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_EMS_ENTERPRISE, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_EMS_SITE, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_EMS_SERVER, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_EMS_MDB, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_EMS_DSA, BackGround );
+ RSM_BitmapLoad ( BTNFACE_BACKGND + IDRBM_BLANK16x16, BackGround );
+#endif // OEM_EMS
+
+
+
+# if defined ( OEM_MSOFT )
+ {
+ }
+# else
+ {
+ RSM_BitmapLoad ( IDRBM_TRANSFER, BackGround );
+ RSM_BitmapLoad ( IDRBM_TRANSFER_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_SEARCH, BackGround );
+ RSM_BitmapLoad ( IDRBM_SEARCH_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_ADVANCED, BackGround );
+ RSM_BitmapLoad ( IDRBM_ADVANCED_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_INFO, BackGround );
+ RSM_BitmapLoad ( IDRBM_INFO_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_EXIT, BackGround );
+ RSM_BitmapLoad ( IDRBM_EXIT_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_UPARROW, BackGround );
+ RSM_BitmapLoad ( IDRBM_UPARROW_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_DNARROW, BackGround );
+ RSM_BitmapLoad ( IDRBM_DOWNARROW_GRAY, BackGround );
+ RSM_BitmapLoad ( IDRBM_NETCONNECT, BackGround );
+ RSM_BitmapLoad ( IDRBM_NETCONNECT_GRAY,BackGround );
+ RSM_BitmapLoad ( IDRBM_NETDISCON, BackGround );
+ RSM_BitmapLoad ( IDRBM_NETDISCON_GRAY, BackGround );
+ }
+# endif // defined ( OEM_MSOFT )
+
+
+ // Now, let's load the rest of the most commonly used bitmaps with the
+ // windows (user selected) background color.
+
+ BackGround = RGB (
+ (BYTE)( HIWORD(ColorBackGnd) ),
+ (BYTE)( (WORD)ColorBackGnd >> 8 ),
+ (BYTE)ColorBackGnd,
+ );
+
+ RSM_BitmapLoad ( IDRBM_HARDDRIVE, BackGround );
+ RSM_BitmapLoad ( IDRBM_NETDRIVE, BackGround );
+ RSM_BitmapLoad ( IDRBM_SEL_NONE, BackGround );
+ RSM_BitmapLoad ( IDRBM_SEL_PART, BackGround );
+ RSM_BitmapLoad ( IDRBM_SEL_ALL, BackGround );
+ RSM_BitmapLoad ( IDRBM_FOLDER, BackGround );
+ RSM_BitmapLoad ( IDRBM_FOLDERPLUS, BackGround );
+ RSM_BitmapLoad ( IDRBM_FOLDERMINUS, BackGround );
+ RSM_BitmapLoad ( IDRBM_EXE, BackGround );
+ RSM_BitmapLoad ( IDRBM_FILE, BackGround );
+ RSM_BitmapLoad ( IDRBM_FOLDEROPEN, BackGround );
+ RSM_BitmapLoad ( IDRBM_FOLDERPLUSOPEN, BackGround );
+ RSM_BitmapLoad ( IDRBM_FOLDERMINUSOPEN, BackGround );
+
+#ifdef OEM_EMS
+ RSM_BitmapLoad ( IDRBM_EMS_ENTERPRISE, BackGround );
+ RSM_BitmapLoad ( IDRBM_EMS_SITE, BackGround );
+ RSM_BitmapLoad ( IDRBM_EMS_SERVER, BackGround );
+ RSM_BitmapLoad ( IDRBM_EMS_MDB, BackGround );
+ RSM_BitmapLoad ( IDRBM_EMS_DSA, BackGround );
+#endif // OEM_EMS
+
+
+ mwBitmapBackGnd = BackGround;
+
+} /* end RSM_BitmapInit() */
+
+
+COLORREF RSM_BitmapGetBackgroundColor ( VOID )
+{
+ return mwBitmapBackGnd ;
+}
+
+VOID RSM_BitmapSetBackgroundColor ( COLORREF new_color )
+{
+
+ mwBitmapBackGnd = new_color ;
+}
+
+/******************************************************************************
+
+
+ Name: RSM_BitmapLoad()
+
+ Description: This function load a bitmaps and sets the bitmap backgound
+ color to the background color specified. This function
+ checks to see if the bitmap was previously loaded. If so,
+ it simply returns the handle to that bitmap.
+
+ Returns: A handle to a bitmap if successful. Otherwise, NULL.
+
+******************************************************************************/
+
+
+HBITMAP RSM_BitmapLoad (
+
+WORD wBitmapID, // I - bitmap ID
+COLORREF cBackGround ) // I - background replacement color
+
+{
+ HDC hDC;
+ INT nIndex;
+ DWORD FAR *lpColorTable;
+ DWORD FAR *lpColorTableEnd;
+ HBITMAP hBM;
+ HANDLE hRes;
+ LPBITMAPINFOHEADER lpBMIH;
+#if defined ( OS_WIN32 )
+ UINT32 unResSize;
+ VOID_PTR pTemp;
+ HANDLE hMem;
+#endif
+
+ // Determine whether to display RED or BLACK checkmarks.
+
+ if ( gfRedChecks && FALSE ) {
+
+ switch ( wBitmapID ) {
+
+ case IDRBM_SEL_ALL:
+ wBitmapID = IDRBM_SEL_ALL_RED;
+
+ break;
+
+ case IDRBM_CHECK:
+ wBitmapID = IDRBM_CHECK_RED;
+
+ break;
+
+ case IDRBM_UNCHECK:
+ wBitmapID = IDRBM_UNCHECK_RED;
+
+ break;
+
+ case IDRBM_ADVANCED:
+ wBitmapID = IDRBM_ADVANCED_RED;
+
+ break;
+ }
+ }
+
+ // Determine the bitmap ID index into the Bitmap Table.
+
+ nIndex = wBitmapID - BM_OFFSET;
+
+ // Check to see if the bitmap has already been loaded. If so, then
+ // return the handle from the table.
+
+ if ( nIndex < BTNFACE_BACKGND ) {
+ if ( BMTable[ nIndex ] ) {
+ return BMTable[ nIndex ];
+ }
+ } else {
+
+ COLORREF ColorGray = GetSysColor ( COLOR_BTNFACE );
+
+ if ( BMTableButton[ nIndex - BTNFACE_BACKGND ] ) {
+ return BMTableButton[ nIndex - BTNFACE_BACKGND ];
+ }
+ wBitmapID -= BTNFACE_BACKGND ;
+
+ cBackGround = RGB (
+ (BYTE)( HIWORD(ColorGray) ),
+ (BYTE)( (WORD)ColorGray >> 8 ),
+ (BYTE)ColorGray
+ );
+ }
+
+ // THE NO-BACKGROUND-COLOR VERSION.
+ //
+ // Load the bitmap.
+ // hBM = LoadBitmap ( ghResInst, ID(wBitmapID) );
+ // BMTable[nIndex] = hBM; // REMOVE THIS LINE IF DIBs ARE SUPPORTED
+ // return hBM;
+
+ // THE BACKGROUND-COLOR VERSION.
+ //
+ // Load the bitmap as a resource.
+
+ hRes = LoadResource ( ghResInst, FindResource ( ghResInst, ID(wBitmapID), RT_BITMAP ) );
+
+ if ( ! hRes ) {
+ return (HBITMAP)NULL;
+ }
+
+ // Lock it down and get a Long Pointer to the BitMap Information Header.
+
+ lpBMIH = (LPBITMAPINFOHEADER)LockResource ( hRes );
+
+#if defined( OS_WIN32 )
+ // Determine the size of the bitmap header including the size of
+ // the color table. This will be used to determine the size of the
+ // entire bitmap for copying it to our memory.
+
+ lpColorTable = (DWORD FAR *)( (INT8_PTR)(lpBMIH) + (WORD)(lpBMIH->biSize) );
+
+ // Determine the ending point of the color table search.
+
+ lpColorTableEnd = (DWORD FAR *)( (INT8_PTR)(lpColorTable) +
+ (WORD)( ( 1 << lpBMIH->biBitCount ) *
+ sizeof ( RGBQUAD ) ) );
+ // Now, copy the bitmap resource to our own memory since we can
+ // no longer modify it directly in NT. We might as well do it
+ // for all OS's since it can't hurt.
+
+ unResSize = (INT8_PTR)lpColorTableEnd - (INT8_PTR)lpBMIH ;
+
+ if ( lpBMIH->biSizeImage ) {
+
+ // Add the compressed size found in biSizeImage.
+
+ unResSize += lpBMIH->biSizeImage ;
+ }
+ else {
+
+ // The bitmap is not compressed, multiply the width x height.
+
+ unResSize += ( lpBMIH->biWidth * lpBMIH->biHeight );
+ }
+
+ hMem = GlobalAlloc ( GHND, unResSize );
+
+ if ( ! hMem ) {
+ return (HBITMAP)NULL;
+ }
+
+ pTemp = GlobalLock ( hMem );
+
+ if ( ! pTemp ) {
+ return (HBITMAP)NULL;
+ }
+
+ memcpy( pTemp, lpBMIH, unResSize ) ;
+ lpBMIH=(LPBITMAPINFOHEADER)pTemp ;
+
+#endif
+
+ // Now get a pointer to the color table of the bitmap. This will be the
+ // starting point of the search for the color table entry which will be
+ // replaced by the background color.
+
+ lpColorTable = (DWORD FAR *)( (INT8_PTR)(lpBMIH) + (WORD)(lpBMIH->biSize) );
+
+ // Determine the ending point of the color table search.
+
+ lpColorTableEnd = (DWORD FAR *)( (INT8_PTR)(lpColorTable) +
+ (WORD)( ( 1 << lpBMIH->biBitCount ) *
+ sizeof ( RGBQUAD ) ) );
+
+ // Search for the PURE BLUE (RSM_MAGICCOLOR) entry and replace it with
+ // the current background RGB.
+
+ for ( ; lpColorTable < lpColorTableEnd; lpColorTable++ ) {
+
+// if ( *lpColorTable == RSM_MAGICCOLOR ) { // PURE BLUE
+ if ( *lpColorTable == 0x00ff00FF ) { // PURE BLUE
+
+ *lpColorTable = cBackGround;
+ break;
+ }
+ }
+
+ // Create a color DIB compatible with the display device.
+
+ hDC = GetDC ( (HWND)NULL );
+
+ hBM = CreateDIBitmap ( hDC,
+ lpBMIH,
+ (DWORD)CBM_INIT,
+ (BYTE_PTR)lpColorTableEnd,
+ (LPBITMAPINFO)lpBMIH,
+ DIB_RGB_COLORS
+ );
+
+ ReleaseDC ( (HWND)NULL, hDC );
+
+ // Now UNLOCK and FREE the resource and the copy of the bitmap.
+
+ GlobalUnlock ( hRes );
+ FreeResource ( hRes );
+
+#if defined( OS_WIN32 )
+ GlobalUnlock ( hMem );
+ GlobalFree ( hMem ) ;
+#endif
+
+ if ( nIndex < BTNFACE_BACKGND ) {
+ BMTable[nIndex] = hBM;
+ } else {
+ BMTableButton[nIndex - BTNFACE_BACKGND] = hBM;
+ }
+
+ return hBM;
+
+} /* end RSM_BitmapLoad() */
+
+
+/******************************************************************************
+
+ Name: RSM_BitmapStretch()
+
+ Description: This function stretches or shrinks a bitmap to the
+ specified width.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RSM_BitmapStretch (
+
+HDC hDC, // I - handle to a device context
+WORD wBitmapID, // I - ID of the bitmap to stretch
+INT nWidth, // I - bitmap width
+INT nHeight ) // I - bitmap height
+
+{
+ DBG_UNREFERENCED_PARAMETER ( hDC );
+ DBG_UNREFERENCED_PARAMETER ( wBitmapID );
+ DBG_UNREFERENCED_PARAMETER ( nWidth );
+ DBG_UNREFERENCED_PARAMETER ( nHeight );
+/*
+ INT nIndex; // index into the bitmap table
+ HBITMAP hBM1; // bitmap handle
+ HBITMAP hBM2; // bitmap handle
+ BITMAP bm1; // temporary bitmap
+ BITMAP bm2; // temporary bitmap
+
+
+ nIndex = wBitmapID - BM_OFFSET;
+
+ hBM1 = BMTable[ nIndex ];
+
+ GetObject ( hBM1, sizeof(BITMAP), (LPSTR) &bm1 );
+ hDCMem1 = CreateCompatibleDC ( hDC );
+ hDCMem2 = CreateCompatibleDC ( hDC );
+
+ bm2 = bm1;
+ bm2.bmWidth = nWidth;
+ bm2.bmHeight = nHeight;
+ bm2.bmWidthBytes = ( ( bm2.bmWidth + 15 ) / 16 ) * 2; // Why? Because!
+
+ hBM2 = CreateBitmapIndirect( &bm2 );
+
+ SelectObject ( hDCMem1, hBM1 );
+ SelectObject ( hDCMem2, hBM2 );
+
+ StretchBlt ( hDCMem2, 0, 0, bm2.bmWidth, bm2.bmHeight,
+ hDCMem1, 0, 0, bm1.bmWidth, bm1.bmHeight, SRCCOPY );
+
+ DeleteDC ( hDCMem1);
+ DeleteDC ( hDCMem2);
+
+ DeleteObject ( hBM1 );
+
+ BMTable[ nIndex ] = hBM2;
+*/
+
+} /* end RSM_BitmapStretch() */
+
+
+/******************************************************************************
+
+ Name: RSM_GetBitmapSize()
+
+ Description: This function gets the width and height of the bitmap.
+
+ Returns: SUCCESS if successful, otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL RSM_GetBitmapSize (
+
+WORD wBitmapID, // I - ID of the bitmap to stretch
+LPINT pnWidth, // O - pointer to storage of bitmap width
+LPINT pnHeight ) // O - pointer to storage of bitmap height
+
+{
+ HBITMAP hBM; // handle to the bitmap
+ BITMAP dsBM; // bitmap data structure
+
+ // Get a handle to the bitmap and put it into a memory DC.
+ // Almost all of the time, the bitmap will already be loaded. This
+ // code is optimized (I hope) for this scenario.
+
+ hBM = BMTable[ wBitmapID - BM_OFFSET ];
+
+ if ( ! hBM ) {
+
+ hBM = RSM_BitmapLoad ( wBitmapID, mwBitmapBackGnd );
+
+ if ( ! hBM ) {
+ return FAILURE;
+ }
+ }
+
+ GetObject ( hBM, sizeof (BITMAP), (LPSTR)&dsBM );
+
+ *pnWidth = dsBM.bmWidth;
+ *pnHeight = dsBM.bmHeight;
+
+ return SUCCESS;
+
+} /* end RSM_GetBitmapSize() */
+
+
+/******************************************************************************
+
+ Name: RSM_GetFontMaxSize()
+
+ Description: This function gets the maximum width, average width,
+ and height of a font.
+
+ Returns: SUCCESS if successful, otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL RSM_GetFontSize (
+
+HFONT hFont, // I - handle to a font
+LPINT pnMaxWidth, // O - pointer to storage of max font width
+LPINT pnAvgWidth, // O - pointer to storage of average font width
+LPINT pnHeight ) // O - pointer to storage of font height
+
+{
+ BOOL fRC; // return code
+ HDC hDC;
+ HFONT hOldFont;
+ TEXTMETRIC dsMetrics;
+
+ hDC = GetDC ( ghWndFrame );
+
+ // Select the new font and save the old font to put it back.
+
+ hOldFont = SelectObject ( hDC, hFont );
+
+ // Get the text metrics data structure.
+
+ fRC = GetTextMetrics ( hDC, &dsMetrics );
+
+ if ( fRC ) {
+ *pnMaxWidth = dsMetrics.tmMaxCharWidth;
+ *pnAvgWidth = dsMetrics.tmAveCharWidth;
+ *pnHeight = dsMetrics.tmHeight;
+ }
+
+ // Kludge the max width for the DLM - FIX THE DLM LATER.
+
+ if ( *pnMaxWidth < ( *pnAvgWidth + ( *pnAvgWidth / 2 ) ) ) {
+
+ *pnMaxWidth += ( ( *pnAvgWidth + 1 ) / 2 );
+ }
+
+ // Put back the old font.
+
+ SelectObject ( hDC, hOldFont );
+
+ ReleaseDC ( ghWndFrame, hDC );
+
+ return ! fRC;
+
+} /* end RSM_GetFontMaxSize() */
+
+
+/******************************************************************************
+
+ Name: RSM_GetFontStringWidth()
+
+ Description: This function gets the display width of a string based on
+ the font passed.
+
+ Returns: The width of the string.
+
+******************************************************************************/
+
+INT RSM_GetFontStringWidth (
+
+HFONT hFont, // I - handle to a font
+LPSTR lpString, // I - string ID or a pointer to the string
+INT nStringLen ) // I - string length
+
+{
+ HDC hDC;
+ HDC hDCMem;
+ HFONT hOldFont;
+ LPSTR lpResString = (LPSTR)NULL;
+ SIZE sizeRect; //Return from GetTextExtentPoint
+
+ // If the pointer contains a resource ID, get the string from the
+ // resources.
+
+ if ( lpString && ! HIWORD(lpString) ) {
+
+ lpResString = ( LPSTR )calloc( nStringLen + 1, sizeof ( CHAR ) );
+
+ if ( ! lpResString ) {
+ return 0;
+ }
+
+ RSM_StringCopy ( LOWORD((DWORD)lpString), lpResString, nStringLen + 1 );
+ lpString = lpResString;
+ }
+
+ hDC = CreateIC ( TEXT("DISPLAY"), NULL, NULL, NULL );
+ hDCMem = CreateCompatibleDC ( hDC );
+
+ // Select the new font and save the old font to put it back.
+
+ hOldFont = SelectObject ( hDCMem, hFont );
+
+ // Get the text extent width and height.
+
+ GetTextExtentPoint ( hDCMem, lpString, nStringLen, &sizeRect );
+
+ // Put back the old font. Just for fun.
+
+ SelectObject ( hDC, hOldFont );
+
+ DeleteDC ( hDCMem );
+ DeleteDC ( hDC );
+
+ // Free up any memory allocated.
+
+ if ( lpResString ) {
+ free ( lpResString );
+ }
+
+ return sizeRect.cx;
+
+} /* end RSM_GetFontStringWidth() */
+
+
+/******************************************************************************
+
+ Name: RSM_StringLoad()
+
+ Description: This function loads a string from the resources.
+
+ Returns: The number of characters copied into the buffer. It is
+ 0 if unsuccessful.
+
+ Note: String Resources are pulled from the DLL.
+
+******************************************************************************/
+
+INT RSM_StringLoad (
+
+VOID_PTR pID, // I - ID of the string to load
+LPSTR lpBuffer, // O - pointer to destination buffer area
+INT nBufferMax ) // I - max number of characters to copy
+
+{
+ return LoadString ( ghResInst, (WORD)(DWORD)pID, lpBuffer, nBufferMax );
+
+} /* end RSM_StringLoad() */
+
+
+/******************************************************************************
+
+ Name: RSM_Sprintf()
+
+ Description: This function loads a string from the resources.
+
+ Returns: The number of characters copied into the buffer. It is
+ 0 if unsuccessful.
+
+******************************************************************************/
+
+INT RSM_Sprintf (
+
+LPSTR lpDestBuffer, // O - pointer to destination buffer area
+LPSTR lpFormatBuffer, // I - pointer to format string area
+... ) // I - argument list
+
+{
+ va_list lpArgList ;
+ CHAR szTemp[MAX_UI_RESOURCE_SIZE];
+ INT nCount;
+
+ // If the pointer contains a resource ID, get the string from the
+ // resources.
+
+ if ( lpFormatBuffer && ! HIWORD(lpFormatBuffer) ) {
+
+ RSM_StringCopy ( LOWORD((DWORD)lpFormatBuffer), szTemp, sizeof ( szTemp ) );
+ lpFormatBuffer = szTemp;
+ }
+
+ va_start( lpArgList, lpFormatBuffer ) ;
+
+ nCount = wvsprintf ( lpDestBuffer, lpFormatBuffer, lpArgList );
+
+ va_end( lpArgList ) ;
+
+ return nCount;
+
+} /* end RSM_Sprintf() */
+
+
+/******************************************************************************
+
+ Name: RSM_CursorLoad()
+
+ Description: This function loads an icon from the resources.
+
+ Returns: The handle to the icon if successful. It is
+ 0 if unsuccessful.
+
+ Note: Icon Resources are pulled from the DLL.
+
+******************************************************************************/
+
+HCURSOR RSM_CursorLoad (
+
+LPSTR pID ) // I - ID of the icon to load
+
+{
+ HANDLE hInst = ( ( pID < WIN_RES_MIN ) ? ghResInst : 0 );
+
+ return LoadCursor ( hInst, pID );
+
+} /* end RSM_CursorLoad() */
+
+
+/******************************************************************************
+
+ Name: RSM_IconLoad()
+
+ Description: This function loads an icon from the resources.
+
+ Returns: The handle to the icon if successful. It is
+ 0 if unsuccessful.
+
+ Note: Icon Resources are pulled from the EXE.
+
+******************************************************************************/
+
+HICON RSM_IconLoad (
+
+LPSTR pID ) // I - ID of the icon to load
+
+{
+ HANDLE hInst = ( ( pID < WIN_RES_MIN ) ? ghInst : 0 );
+
+ return LoadIcon ( hInst, pID );
+
+} /* end RSM_IconLoad() */
+
+
diff --git a/private/utils/ntbackup/src/rest_dle.c b/private/utils/ntbackup/src/rest_dle.c
new file mode 100644
index 000000000..3426e970e
--- /dev/null
+++ b/private/utils/ntbackup/src/rest_dle.c
@@ -0,0 +1,259 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: rest_dle.c
+
+ Description: this file contains the routines to process a dle for restore
+
+ $Log: T:\logfiles\rest_dle.c_v $
+
+ Rev 1.16.1.0 07 Feb 1994 02:06:50 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.16 11 Oct 1993 18:32:56 DON
+If ABORT_OPERATION still need to get the next tape request with ABORT
+
+ Rev 1.15 14 Jan 1993 13:33:24 STEVEN
+added stream_id to error message
+
+ Rev 1.14 08 Apr 1992 17:40:22 NED
+added handling of TFLE_USER_ABORT
+from LP_StartTPEDialog().
+Marilyn made me do it!
+
+ Rev 1.13 16 Mar 1992 16:23:16 STEVEN
+initialize the DBLKS
+
+ Rev 1.12 24 Feb 1992 09:58:24 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.11 19 Feb 1992 16:00:16 GREGG
+Added vcb_only parameter to call to TF_OpenSet.
+
+ Rev 1.10 06 Nov 1991 18:22:34 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from lp instead of lis.
+
+ Rev 1.9 17 Oct 1991 01:51:30 ED
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.8 27 Aug 1991 13:35:30 STEVEN
+would stop after one DDB
+
+ Rev 1.7 16 Aug 1991 17:11:40 STEVEN
+Could not Verify or Restore multiple sets
+
+ Rev 1.6 22 Jul 1991 10:56:26 DAVIDH
+Corrected type mismatch warnings.
+
+ Rev 1.5 24 Jun 1991 17:21:56 STEVEN
+remove date time from StartBS
+
+ Rev 1.4 21 Jun 1991 09:22:22 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:14:46 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 24 May 1991 14:45:32 STEVEN
+complete changes for new getnext
+
+ Rev 1.1 14 May 1991 14:51:06 DAVIDH
+Resolved pointer type mismatch warning under Watcom compiler
+
+
+ Rev 1.0 09 May 1991 13:34:26 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "get_next.h"
+
+/**/
+/**
+
+ Name: LP_RestoreDLE()
+
+ Description: This function restores all the objects for a specirfied
+ Backup Set.
+
+ Modified: 5/23/1991 16:49:25
+
+ Returns: Any lower layer error enountered.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_RestoreDLE(
+BSD_PTR bsd_ptr, /* I - The verify selections */
+register LP_ENV_PTR lp, /* I - The Loop Environment struct */
+BOOLEAN reuse_bsd, /* I - TRUE if this is the same BSD */
+INT16 channel_no, /* I - The channel number */
+THW_PTR sdrv ) /* I - The starting drive */
+{
+ INT16 return_status ;
+ DBLK_PTR curr_blk ;
+ TFL_OPBLK pb ;
+ DATA_FRAGMENT data_frag ;
+ LBA_ELEM lba_elem ;
+ BOOLEAN lba_empty ;
+
+ /* setup requested tape id and tape seq number */
+ if( ( ( BSD_GetTapeID( bsd_ptr ) != -1 ) ||
+ ( BSD_GetTapeNum( bsd_ptr ) != -1 ) ) &&
+ ( !reuse_bsd ) ) {
+ lp->tpos.tape_id = BSD_GetTapeID( bsd_ptr ) ;
+ lp->tpos.tape_seq_num = BSD_GetTapeNum( bsd_ptr ) ;
+ }
+
+ memset( lp->curr_ddb, 0, sizeof(DBLK) ) ;
+ memset( lp->curr_blk, 0, sizeof(DBLK) ) ;
+
+ pb.tape_position = &lp->tpos ;
+ pb.sdrv = sdrv ;
+ pb.channel = channel_no ;
+ pb.rewind_sdrv = FALSE ;
+ pb.perm_filter = TF_KEEP_ALL_DATA ;
+ pb.attributes = 0L ;
+ pb.fsh = lp->curr_fsys ;
+ pb.mode = TF_READ_OPERATION ;
+ pb.ignore_clink = FALSE ;
+ pb.wrt_format = 0 ;
+ pb.idle_call = NULL ;
+ pb.cat_enabled = lp->cat_enabled ;
+ data_frag.buffer_used = 0 ;
+ data_frag.buffer_size = 0 ;
+ data_frag.memory_allocated = 0 ;
+ data_frag.buffer = NULL ;
+
+ if( !reuse_bsd ) {
+ /* Setup for FFR based operation... */
+ lp->tpos.tape_loc.pba_vcb = BSD_GetPBA( bsd_ptr );
+ lp->rr.tape_loc.pba_vcb = BSD_GetPBA( bsd_ptr );
+ }
+
+ lba_empty = BSD_GetFirstLBA( bsd_ptr, &lba_elem ) ;
+
+ if ( !reuse_bsd && !lba_empty ) {
+
+ lp->tpos.tape_loc.tape_seq = LBA_GetTapeNum( &lba_elem );
+ lp->tpos.tape_loc.lba = LBA_GetLBA( &lba_elem );
+ lp->rr.tape_loc.tape_seq = LBA_GetTapeNum( &lba_elem );
+ lp->rr.tape_loc.lba = LBA_GetLBA( &lba_elem );
+ pb.tape_position->tape_seq_num = LBA_GetTapeNum( &lba_elem );
+ pb.tape_position->tape_id = BSD_GetTapeID( bsd_ptr );
+
+ } else {
+
+ /* If not a FFR drive, nor a drive which can be mode switched to FFR, nor an SX drive then
+ make sure that PBA of the VCB has been cleared */
+ if( !( BSD_HardwareSupportsFeature( bsd_ptr, TDI_FAST_NBLK ) ||
+ BSD_HardwareSupportsFeature( bsd_ptr, TDI_MODE_CHANGE ) ||
+ BSD_HardwareSupportsFeature( bsd_ptr, TDI_FIND_BLK ) ) ) {
+ lp->tpos.tape_loc.pba_vcb = 0 ;
+ lp->rr.tape_loc.pba_vcb = 0 ;
+ }
+
+ }
+
+
+ /* Now open the backup set */
+ if( ( return_status = TF_OpenSet( &pb, FALSE ) ) == SUCCESS ) {
+
+ /* store the channel */
+ lp->channel = pb.channel ;
+
+ if( ( return_status = LP_StartTPEDialogue( lp, FALSE ) ) == SUCCESS ) {
+
+ /* log start of backup set */
+ LP_MsgStartBS( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, lp->curr_blk ) ;
+
+ /* Now we have the GetNextItemLoop */
+ while( return_status == SUCCESS ) {
+
+ if( ( return_status = LP_GetNextTPEBlock( lp, &curr_blk ) ) == SUCCESS ) {
+
+ if ( curr_blk != NULL ) {
+ return_status = LP_RestoreOBJ( lp, curr_blk, &data_frag ) ;
+ } else {
+ break ;
+ }
+
+ }
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ /* falling through (no break) */
+
+ case ABORT_PROCESSED:
+ return_status = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ return_status = USER_ABORT ;
+ break ;
+ }
+ }
+
+ /* Log end of backup set */
+ LP_MsgEndBS( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+ } else if ( return_status == TFLE_USER_ABORT ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+ }
+
+ /* Process last tape format request as long as no fatal error occurred */
+ // NOTE: COMM_FAILUREs will return ABORT_OPERATION
+ if( ( return_status == ABORT_OPERATION ) || ( return_status == USER_ABORT ) && ( LP_GetAbortFlag( lp->lis_ptr ) != ABORT_AT_EOM ) ) {
+ lp->rr.lp_message = LRR_ABORT ;
+ if( ( TF_GetNextTapeRequest( &lp->rr ) ) != SUCCESS ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+
+ /* Close set, save current tape device and post tape stats */
+ LP_CloseSet( pb.channel ) ;
+
+ }
+ else {
+ TF_CloseSet( lp->channel, NULL ) ;
+ if( return_status == TFLE_USER_ABORT ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ } else if( return_status != TFLE_UI_HAPPY_ABORT ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+
+ free( data_frag.buffer ) ;
+
+ return( return_status ) ;
+
+}
diff --git a/private/utils/ntbackup/src/rest_obj.c b/private/utils/ntbackup/src/rest_obj.c
new file mode 100644
index 000000000..a411fd3f2
--- /dev/null
+++ b/private/utils/ntbackup/src/rest_obj.c
@@ -0,0 +1,983 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: rest_obj.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: N:\logfiles\rest_obj.c_v $
+
+ Rev 1.49.1.1 04 Mar 1994 16:52:14 STEVEN
+prompt if disk is full
+
+ Rev 1.49.1.0 01 Dec 1993 14:07:40 STEVEN
+fix problem with re-reading path stream
+
+ Rev 1.49 24 Aug 1993 19:47:56 STEVEN
+fix too_long bugs
+
+ Rev 1.48 19 Aug 1993 16:32:24 STEVEN
+fix unicode bugs
+
+ Rev 1.47 30 Jul 1993 13:17:50 STEVEN
+if dir too deep make new one
+
+ Rev 1.46 19 Jul 1993 14:25:08 BARRY
+Added code to skip files when told to do so by FS_CreateObj or FS_OpenObj.
+
+ Rev 1.45 13 Jul 1993 11:59:46 DON
+Added case for FS_IN_USE_ERROR on WriteObj call. This is the only time we know this in SMS
+
+ Rev 1.44 28 Jun 1993 15:23:22 DEBBIE
+803EPR0311 - Because the code for the FS_ACCESS_DENIED error returned from
+ FS_WriteObj would set error to SUCCESS, the bytes and file were
+ not getting added to the skipped stats. I added the calls to
+ LP_MsgBlockSkipped and LP_MsgBytesSkipped there.
+
+ Rev 1.43 01 Jun 1993 15:19:58 CARLS
+code was sending LP_MsgBlockSkipped twice
+
+ Rev 1.42 25 May 1993 17:18:36 DON
+If we LP_SkipStream then don't attempt to CheckSum!
+
+ Rev 1.41 20 May 1993 20:22:46 DON
+If we have a COMM Failure then we need to abort the restore
+
+ Rev 1.40 13 May 1993 13:47:54 BARRY
+Send msg to UI when the FS restores over an active file.
+
+ Rev 1.39 11 May 1993 13:08:06 DON
+Need to check for COMM_FAILURE during read/write operations. May lose attachment!
+
+ Rev 1.38 31 Mar 1993 08:51:54 MARILYN
+changed over to use MTF checksums, display message when a data stream
+does not have a checksum when we are supposed to be processing them
+
+ Rev 1.37 09 Mar 1993 12:27:36 STEVEN
+if we have an access violation writing a stream then skip to next stream
+
+ Rev 1.36 04 Mar 1993 15:36:22 MARILYN
+Now sending back LP_LOG_DIFFERENCE when the checksum verification fails.
+
+ Rev 1.35 01 Mar 1993 17:36:16 MARILYN
+If BEC_GetProcChecksumStrms is set, a checksum will be computed for
+each object restored and verified against the checksum stream on
+tape (if it exists).
+
+ Rev 1.34 19 Feb 1993 09:21:36 STEVEN
+fix some bugs
+
+ Rev 1.33 04 Feb 1993 18:05:00 STEVEN
+fix problem with calling back tpfmt if error ocured
+
+ Rev 1.32 01 Feb 1993 19:46:30 STEVEN
+bug fixes
+
+ Rev 1.31 27 Jan 1993 13:50:52 STEVEN
+updates from msoft
+
+ Rev 1.30 14 Jan 1993 16:40:12 STEVEN
+fix bugs in last checkin
+
+ Rev 1.29 14 Jan 1993 13:33:56 STEVEN
+added stream_id to error message
+
+ Rev 1.28 04 Nov 1992 13:23:34 STEVEN
+fix various bugs with read
+
+ Rev 1.27 04 Nov 1992 09:29:18 STEVEN
+fix initial receive
+
+ Rev 1.26 03 Nov 1992 10:09:30 STEVEN
+change the way we skip data
+
+ Rev 1.25 19 Oct 1992 15:55:36 STEVEN
+remaining size is gone
+
+ Rev 1.24 05 Oct 1992 10:29:54 STEVEN
+remove TotalSize
+
+ Rev 1.23 16 Sep 1992 16:55:18 STEVEN
+added support for stream info struct for Tpfmt
+
+ Rev 1.22 01 Sep 1992 16:12:10 STEVEN
+added stream headers to fsys API
+
+ Rev 1.21 23 Jul 1992 16:45:50 STEVEN
+fix warnings
+
+ Rev 1.19 23 Jul 1992 12:13:46 STEVEN
+fix warnings
+
+ Rev 1.18 27 May 1992 17:39:24 TIMN
+Changed CHARs to INT8s
+
+ Rev 1.17 05 May 1992 17:19:24 STEVEN
+fixed typos and misc bugs
+
+ Rev 1.16 27 Apr 1992 16:41:54 STEVEN
+fix typo in include
+
+ Rev 1.15 20 Mar 1992 13:43:32 STEVEN
+do not prompt for special files
+
+ Rev 1.14 16 Mar 1992 16:40:34 STEVEN
+more 64 bit support for format 40
+
+ Rev 1.13 13 Mar 1992 09:23:28 STEVEN
+4.0 tape format 64 bit
+
+ Rev 1.12 04 Feb 1992 10:35:56 DON
+if NOT defined FS_IMAGE then Images should be ignored
+
+ Rev 1.11 11 Dec 1991 14:09:34 STEVEN
+read converted to FS_READ
+
+ Rev 1.10 18 Oct 1991 14:11:28 STEVEN
+BIGWHEEL-add support for prompt before restore over exist
+
+ Rev 1.9 02 Oct 1991 15:34:58 STEVEN
+BIGWEEL - Added support for Prompt before restore over existing
+
+ Rev 1.8 19 Sep 1991 17:00:22 STEVEN
+fix warning for UNSIGNED SIGNED mismatch
+
+ Rev 1.7 10 Sep 1991 18:19:40 DON
+got rid of pointer type mismatches
+
+ Rev 1.6 25 Jul 1991 10:39:14 STEVEN
+remove 0 length files if disk is full
+
+ Rev 1.5 27 Jun 1991 13:05:46 STEVEN
+removed unused parm to ReceiveData
+
+ Rev 1.4 21 Jun 1991 09:22:42 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:14:06 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 24 May 1991 14:45:18 STEVEN
+complete changes for new getnext
+
+ Rev 1.1 14 May 1991 14:52:08 DAVIDH
+Initialized blk_size to 0 -- resolved Watcom compiler warning
+
+
+ Rev 1.0 09 May 1991 13:34:28 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "sleep.h"
+#include "checksum.h"
+/* $end$ include list */
+
+#define TOO_DEEP_DIR TEXT("TOO_LONG.BKP")
+
+/* static variables */
+static DBLK disk_dblk ;
+
+static INT16 LP_ShortenDDB( LP_ENV_PTR lp, DBLK_PTR tape_dblk_ptr ) ;
+
+/**/
+/**
+
+ Name: LP_RestoreOBJ()
+
+ Description:
+
+ Modified: 7/20/1989
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_RestoreOBJ(
+register LP_ENV_PTR lp, /* I - Loop environment structure */
+DBLK_PTR tape_dblk_ptr, /* I - Object to be restored. */
+DATA_FRAGMENT_PTR frag_ptr ) /* I - Buffer to use for fragments */
+{
+ INT16 res_id ;
+ UINT16 write_size ;
+ UINT16 atempt_size ;
+ UINT16 blk_size = 0 ;
+ UINT32 attr ;
+ BOOLEAN do_it, skippedStream ;
+ UINT64 amount_restored ;
+ INT16 error = SUCCESS ;
+ INT16 buffer_used_size ;
+ INT8_PTR tape_data_buf ;
+ INT16 return_status = SUCCESS ;
+ BOOLEAN math_status ;
+ UINT32 checksum ;
+ STREAM_INFO savedStrmHeader ;
+ BOOLEAN block_skipped_flag = TRUE ;
+ BOOLEAN temp_renamed_dir = FALSE ;
+ DBLK temp_new_dir ;
+ UINT32 last_stream_id = STRM_INVALID ;
+
+
+
+ BSD_PTR bsd_ptr ;
+ FSYS_HAND fsh ;
+ UINT32 pid ;
+ BE_CFG_PTR cfg ;
+ FILE_HAND hdl = NULL ;
+
+ fsh = lp->curr_fsys ;
+ bsd_ptr = lp->lis_ptr->curr_bsd_ptr ;
+ pid = lp->lis_ptr->pid ;
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ amount_restored = U64_Init(0,0) ;
+
+ /* if it is a CFDB ... */
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_CFDB ) {
+
+ return_status = LP_MsgLogBlock( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr ) ;
+
+ return return_status ;
+
+ }
+
+#ifndef FS_IMAGE
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_IDB ) {
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ LP_SkipData( lp ) ;
+ return SUCCESS ;
+ }
+
+#endif
+
+ /* if the current directory is invalid AND it is a file ... */
+ if( lp->ddb_create_error && FS_GetBlockType( tape_dblk_ptr ) == BT_FDB) {
+
+ switch( lp->ddb_create_error ) {
+ case FS_OUT_OF_SPACE:
+ res_id = LP_OUT_OF_SPACE_ERROR ;
+ break ;
+
+ case FS_ACCESS_DENIED:
+ res_id = LP_ACCESS_DENIED_ERROR ;
+ break ;
+
+ case FS_COMM_FAILURE:
+ res_id = FS_COMM_FAILURE;
+ break;
+
+ case FS_DEVICE_ERROR:
+ default:
+ res_id = LP_FILE_CREATION_ERROR ;
+ break ;
+ }
+
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, res_id, lp->curr_ddb, tape_dblk_ptr, 0L ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ LP_SkipData( lp ) ;
+
+ if ( lp->ddb_create_error == FS_COMM_FAILURE ) {
+ return FAILURE;
+ } else {
+ return SUCCESS ;
+ }
+ }
+
+ disk_dblk = *tape_dblk_ptr ;
+
+ /* determine if continuation file */
+ do_it = TRUE ;
+ if ( FS_IsBlockContinued( tape_dblk_ptr ) ) {
+ do_it = LP_MsgPrompt( pid, bsd_ptr, fsh, &lp->tpos,
+ ASK_TO_RESTORE_CONTINUE, tape_dblk_ptr, NULL ) ;
+ }
+
+ if( do_it ) {
+ /* determine whether block exists or not on disk */
+ switch( FS_GetObjInfo( fsh, &disk_dblk ) ) {
+ case FS_ACCESS_DENIED:
+
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_ACCESS_DENIED_ERROR, lp->curr_ddb, &disk_dblk, 0L ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_DDB ) {
+ lp->ddb_create_error = FS_ACCESS_DENIED ;
+ }
+
+ LP_SkipData( lp ) ;
+
+ return SUCCESS ;
+
+ case FS_COMM_FAILURE:
+
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, FS_COMM_FAILURE, lp->curr_ddb, &disk_dblk, 0L ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_DDB ) {
+ lp->ddb_create_error = FS_COMM_FAILURE;
+ }
+ LP_SkipData( lp ) ;
+
+ return SUCCESS;
+
+ case FS_NOT_FOUND:
+ case FS_NO_MORE:
+ break ;
+
+ case SUCCESS:
+ if( (FS_GetBlockType( tape_dblk_ptr ) == BT_FDB) &&
+ !FS_SpecExcludeObj( fsh, lp->curr_ddb, tape_dblk_ptr ) ) {
+
+ /* handle condition to restore existing files */
+ if( BEC_GetExistFlag( cfg ) == BEC_NO_REST_OVER_EXIST ) {
+ do_it = FALSE ;
+
+ } else if( BEC_GetExistFlag( cfg ) == BEC_PROMPT_REST_OVER_EXIST ) {
+ do_it = LP_MsgPrompt( pid, bsd_ptr, fsh, &lp->tpos,
+ ASK_TO_REPLACE_EXISTING, tape_dblk_ptr, &disk_dblk ) ;
+
+ } else {
+
+ attr = FS_GetAttribFromDBLK( fsh, &disk_dblk ) ;
+
+ /* handle condition to restore the file if it was modified or read only ... */
+ if( ( ( attr & OBJ_MODIFIED_BIT ) || ( attr & OBJ_READONLY_BIT ) ) ) {
+ /* ... and if the user should be prompted ... */
+ if( BEC_GetPromptFlag( cfg ) ) {
+ do_it = LP_MsgPrompt( pid, bsd_ptr, fsh, &lp->tpos,
+ ASK_TO_REPLACE_MODIFIED, tape_dblk_ptr, NULL ) ;
+ }
+ }
+ }
+ }
+
+ break ;
+ default:
+ msassert( FALSE ) ; /* this should never happen */
+ break ;
+ }
+ }
+
+ if( !do_it ) {
+ /* never mind ... */
+ LP_SkipData( lp ) ;
+
+ return SUCCESS ;
+
+ }
+
+#ifdef TDEMO
+ error = SUCCESS ;
+#else
+ error = FS_CreateObj( fsh, tape_dblk_ptr ) ;
+
+ if ( error == FS_PATH_TOO_LONG ) {
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_DDB ) {
+ LP_ShortenDDB( lp, tape_dblk_ptr ) ;
+ error = FS_CreateObj( fsh, tape_dblk_ptr ) ;
+
+ } else if( FS_GetBlockType( tape_dblk_ptr ) == BT_FDB ) {
+
+ BOOLEAN save_ignore_data_flag = lp->ignore_data_for_ddb ;
+
+ lp->ignore_data_for_ddb = TRUE ;
+ FS_DuplicateDBLK( fsh, lp->curr_ddb, &temp_new_dir ) ;
+ LP_ShortenDDB( lp, lp->curr_ddb ) ;
+
+ error = LP_RestoreOBJ( lp, lp->curr_ddb, frag_ptr ) ;
+
+ lp->ignore_data_for_ddb = save_ignore_data_flag ;
+
+ if ( error != SUCCESS ) {
+ return( error ) ;
+ } else {
+
+ temp_renamed_dir = TRUE ;
+ error = FS_CreateObj( fsh, tape_dblk_ptr ) ;
+ if ( error != SUCCESS ) {
+ LP_ShortenDDB( lp, lp->curr_ddb ) ;
+ error = LP_RestoreOBJ( lp, lp->curr_ddb, frag_ptr ) ;
+ if ( error != SUCCESS ) {
+ return( error ) ;
+ }
+ error = FS_CreateObj( fsh, tape_dblk_ptr ) ;
+
+ if ( error != SUCCESS ) {
+
+ FS_ReleaseDBLK( fsh, lp->curr_ddb ) ;
+ FS_DuplicateDBLK( fsh, &temp_new_dir, lp->curr_ddb );
+ temp_renamed_dir = FALSE ;
+ }
+ }
+ }
+
+ }
+ }
+
+#endif
+
+ while ( error == FS_OUT_OF_SPACE ) {
+
+ /* I am assuming that an out of PathTooLong error would be */
+ /* returned instead of OUT_OF_SPACE if the path was to long */
+
+ if ( LP_MsgPrompt( pid, bsd_ptr, fsh, &lp->tpos,
+ ASK_DISK_FULL, tape_dblk_ptr, NULL ) ) {
+
+ error = FS_CreateObj( fsh, tape_dblk_ptr ) ;
+
+ } else {
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_OUT_OF_SPACE_ERROR, lp->curr_ddb, tape_dblk_ptr, 0L ) ;
+ break ;
+ }
+ }
+
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_DDB ) {
+ lp->ddb_create_error = error ;
+ }
+
+ if( error != SUCCESS ) {
+
+ switch( error ) {
+
+ case FS_SKIP_OBJECT: /* Do nothing for skip request. */
+ break;
+
+ case FS_OUT_OF_SPACE:
+ res_id = LP_OUT_OF_SPACE_ERROR ;
+ break ;
+
+ case FS_ACCESS_DENIED:
+ res_id = LP_ACCESS_DENIED_ERROR ;
+ break ;
+
+ case FS_INCOMPATIBLE_OBJECT :
+ res_id = LP_FILE_OPEN_ERROR ;
+ break ;
+
+ case FS_COMM_FAILURE:
+ res_id = FS_COMM_FAILURE;
+ break;
+
+ case FS_DEVICE_ERROR:
+ default:
+ res_id = LP_FILE_CREATION_ERROR ;
+ break ;
+ }
+
+ if ( error != FS_SKIP_OBJECT ) {
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, res_id, lp->curr_ddb, tape_dblk_ptr, -1L ) ;
+ }
+
+ if ( DLE_GetDeviceType(BSD_GetDLE(bsd_ptr)) == FS_EMS_DRV ) {
+ return (error ) ;
+
+ } else if( FS_GetBlockType( tape_dblk_ptr ) == BT_IDB ) {
+ LP_FinishedOper( lp ) ;
+
+ return( error ) ;
+
+ } else {
+
+ /* quietly skip the object */
+ if ( error != FS_SKIP_OBJECT ) {
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ }
+
+ LP_SkipData( lp ) ;
+
+ if ( error == FS_COMM_FAILURE ) {
+ return FAILURE;
+ } else {
+ return SUCCESS ;
+ }
+ }
+ }
+
+ LP_MsgLogBlock( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr ) ; /* create may change block */
+
+#ifdef TDEMO
+ error = SUCCESS ;
+#else
+ error = FS_OpenObj( fsh, &hdl, tape_dblk_ptr, FS_WRITE ) ;
+#endif
+
+ if(( error == FS_COMPRES_RESET_FAIL )||
+ ( error == FS_EMS_NO_PUBLIC ) ||
+ ( error == FS_EMS_NO_PRIVATE ) ) {
+ LP_MsgError( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ error,
+ lp->curr_ddb,
+ tape_dblk_ptr,
+ 0L ) ;
+
+ }
+
+ if( error == FS_COMPRES_RESET_FAIL ) {
+ error = SUCCESS ;
+ }
+
+ if( error == SUCCESS ) {
+
+ Checksum_Init( &checksum ) ;
+ skippedStream = FALSE;
+
+ /* restore the object here */
+ if ( !lp->ignore_data_for_ddb ) {
+ buffer_used_size = lp->initial_tape_buf_used ;
+
+ /* get initial data */
+ if( ( error = LP_ReceiveData( lp, buffer_used_size ) ) != ABORT_OPERATION ) {
+ tape_data_buf = lp->rr.buff_ptr ;
+ write_size = lp->rr.buff_size ;
+ }
+ }
+
+ /* If the current data stream is not checksumed, tell em */
+ if ( BEC_GetProcChecksumStrm( cfg ) &&
+ ( lp->rr.stream.id != STRM_INVALID ) &&
+ ( lp->rr.stream.id != STRM_PAD ) &&
+ !FS_IsStreamChecksumed( &lp->rr.stream ) ) {
+
+ LP_MsgNoChecksum( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ tape_dblk_ptr,
+ lp->curr_ddb,
+ 0L ) ;
+
+ }
+
+ while( !lp->ignore_data_for_ddb && !error && lp->rr.tf_message == TRR_DATA )
+ {
+ /* if checksum processing enabled, calculate */
+ /* the checksum for the object */
+ if ( FS_IsStreamChecksumed( &lp->rr.stream ) ) {
+
+ Checksum_Block( &checksum, lp->rr.buff_ptr, lp->rr.buff_size ) ;
+
+ /* we need to know the type of stream being processed */
+ /* so that our data corrupt message will be able to */
+ /* inform the user what type of data was corrupt */
+ if ( lp->rr.stream.id != STRM_INVALID ) {
+ savedStrmHeader = lp->rr.stream ;
+ }
+ }
+
+ if (lp->rr.stream.id != STRM_INVALID ) {
+ if ( (last_stream_id == STRM_EMS_MONO_DB) ||
+ (last_stream_id == STRM_EMS_MONO_LOG) ) {
+
+ CHAR strm_name[256] ;
+ INT16 size = sizeof(strm_name) ;
+
+ EMS_GetStreamName( hdl, (BYTE_PTR)strm_name, &size ) ;
+ LP_MsgLogStream( pid, bsd_ptr, fsh, &lp->tpos, strm_name ) ;
+
+ }
+
+ last_stream_id = lp->rr.stream.id ;
+ }
+
+ atempt_size = write_size ;
+
+#ifdef TDEMO
+ if ( (FAST_TDEMO & BEC_GetSpecialWord( cfg )) == 0 ) {
+ sleep( (UINT32) (write_size / 130) );
+ }
+ error = SUCCESS ;
+#else
+ error = FS_WriteObj( hdl, tape_data_buf, &write_size, &blk_size, &lp->rr.stream ) ;
+#endif
+ switch( error ) {
+
+ case FS_DONT_WANT_STREAM:
+ LP_SkipStream( lp ) ;
+ last_stream_id = STRM_INVALID ;
+ skippedStream = TRUE;
+ error = SUCCESS ;
+ break ;
+
+ case FS_OUT_OF_SPACE:
+
+ if ( !LP_MsgPrompt( pid, bsd_ptr, fsh, &lp->tpos,
+ ASK_DISK_FULL, tape_dblk_ptr, NULL ) ) {
+
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_OUT_OF_SPACE_ERROR, lp->curr_ddb, tape_dblk_ptr, 0L ) ;
+ break ;
+ } else {
+ error = SUCCESS ;
+ /* fall through */
+ }
+
+ case SUCCESS:
+
+ amount_restored = U64_Add(amount_restored, U64_Init(write_size, 0), &math_status ) ;
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_IDB ) {
+ /* let's lie about the number of bytes processed ( so that we can handle 2.5 images ) */
+ /* the msg handlers must know that we are lying */
+#ifdef TDEMO
+ /* amount_restored is probably equal to the ObjPos durring TMENU */
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, amount_restored ) ;
+#else
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, U64_Init(FS_GetObjPosition( hdl ), 0) ) ;
+#endif
+ } else {
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, U64_Init(write_size, 0) ) ;
+ }
+
+ if( tape_data_buf == lp->rr.buff_ptr ) {
+ buffer_used_size = write_size ;
+ }
+
+ if( ( atempt_size != write_size ) &&
+ ( (UINT16)(atempt_size - write_size) < blk_size ) ) {
+
+ if( frag_ptr->memory_allocated < (UINT16)blk_size ) {
+ free( frag_ptr->buffer ) ;
+
+ frag_ptr->buffer = calloc( 1, blk_size ) ;
+ if( frag_ptr->buffer == NULL ) {
+ error = OUT_OF_MEMORY ;
+#ifndef TDEMO
+ FS_CloseObj( hdl ) ;
+#endif
+ LP_FinishedOper( lp ) ;
+ return OUT_OF_MEMORY ;
+ }
+
+ frag_ptr->memory_allocated = blk_size ;
+ }
+
+ frag_ptr->buffer_used = atempt_size - write_size ;
+ memcpy( frag_ptr->buffer,
+ tape_data_buf + write_size,
+ frag_ptr->buffer_used ) ;
+ buffer_used_size = atempt_size ;
+ }
+
+ break ;
+
+ case FS_ACCESS_DENIED :
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_ACCESS_DENIED_ERROR, lp->curr_ddb, tape_dblk_ptr, lp->current_stream_id ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ LP_SkipStream( lp ) ;
+ skippedStream = TRUE;
+ error = SUCCESS ;
+ break ;
+
+ case FS_IN_USE_ERROR:
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_FILE_IN_USE_ERROR, lp->curr_ddb, tape_dblk_ptr, lp->current_stream_id ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ LP_SkipStream( lp ) ;
+ skippedStream = TRUE;
+ error = SUCCESS ;
+ break ;
+
+ case FS_DEVICE_ERROR:
+ case FS_COMM_FAILURE:
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, error, lp->curr_ddb, tape_dblk_ptr, lp->current_stream_id ) ;
+ break;
+
+ default:
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_FILE_WRITE_ERROR, lp->curr_ddb, tape_dblk_ptr, lp->current_stream_id ) ;
+ break ;
+ }
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ /* falling through (no break) */
+
+ case ABORT_PROCESSED:
+ error = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ error = USER_ABORT ;
+ break ;
+ }
+
+ if( error == SUCCESS ) {
+ /* get more data */
+ if( ( error = LP_ReceiveData( lp, (INT32)buffer_used_size ) ) != ABORT_OPERATION ) {
+
+ if( frag_ptr->buffer_used != 0 ) {
+
+ if( lp->rr.buff_size < (UINT16)(blk_size - frag_ptr->buffer_used) ) {
+ memcpy( frag_ptr->buffer + frag_ptr->buffer_used,
+ lp->rr.buff_ptr,
+ lp->rr.buff_size ) ;
+
+ frag_ptr->buffer_used += lp->rr.buff_size ;
+ buffer_used_size = lp->rr.buff_size ;
+ write_size = 0 ;
+ } else {
+
+ memcpy( frag_ptr->buffer + frag_ptr->buffer_used,
+ lp->rr.buff_ptr,
+ blk_size - frag_ptr->buffer_used ) ;
+
+ tape_data_buf = frag_ptr->buffer ;
+ write_size = blk_size ;
+ buffer_used_size = blk_size - frag_ptr->buffer_used ;
+ frag_ptr->buffer_used = 0 ;
+ }
+
+ } else {
+ write_size = lp->rr.buff_size ;
+ tape_data_buf = lp->rr.buff_ptr ;
+ }
+ }
+
+ } else if( error != USER_ABORT ) {
+
+ block_skipped_flag = FALSE ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ LP_SkipData( lp ) ;
+ }
+
+ /* if checksum processing if enabled and a checksum stream is encountered, */
+ /* verify that the checksum computed as the object was restored matches */
+ /* the checksum that was stored on tape for the object */
+ if ( !skippedStream && !error &&
+ ( lp->rr.stream.id == STRM_CHECKSUM_DATA ) &&
+ BEC_GetProcChecksumStrm( cfg ) ) {
+
+ error = LP_VerifyChecksumStream( checksum, lp ) ;
+
+ /* Bad news. The checksum data did not match. */
+ /* The data on the tape is corrupt. */
+ if ( error == FS_CRC_FAILURE ) {
+
+ error = LP_MsgLogDifference( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ tape_dblk_ptr,
+ lp->curr_ddb,
+ savedStrmHeader,
+ 0L ) ;
+ }
+
+ /* We know that we just processed an entire stream. Now */
+ /* we need to get the next stream header and set things */
+ /* up to process it. Note: we don't need to frag */
+ /* because no data will be sent back with the header. */
+ if ( lp->rr.tf_message != TRR_FATAL_ERR && !error ) {
+
+ Checksum_Init( &checksum ) ;
+ skippedStream = FALSE;
+ error = LP_ReceiveData( lp, (INT32)lp->rr.buff_size ) ;
+ }
+ }
+ }
+
+ return_status = error ;
+
+
+ if ( (last_stream_id == STRM_EMS_MONO_DB) ||
+ (last_stream_id == STRM_EMS_MONO_LOG) ) {
+
+ CHAR strm_name[256] ;
+ INT16 size = sizeof(strm_name) ;
+
+ EMS_GetStreamName( hdl, (BYTE_PTR)strm_name, &size ) ;
+ LP_MsgLogStream( pid, bsd_ptr, fsh, &lp->tpos, strm_name ) ;
+
+ }
+
+#ifdef TDEMO
+ error = SUCCESS ;
+#else
+ error = FS_CloseObj( hdl );
+#endif
+
+ /*
+ * On NT, if a file was active (open) there is a way to restore
+ * it anyway. But the user needs to know that this happened so
+ * they can reboot to get the files back. Send a message to the
+ * UI so it can be nice.
+ */
+ if ( error == FS_RESTORED_ACTIVE ) {
+ error = SUCCESS;
+ LP_MsgRestoredActive( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ lp->curr_ddb,
+ tape_dblk_ptr );
+ }
+
+ if ( return_status == SUCCESS ) {
+ return_status = error ;
+ }
+
+ if ( ( return_status == FS_OUT_OF_SPACE ) &&
+ ( FS_GetBlockType( tape_dblk_ptr ) == BT_FDB ) ) {
+
+#ifndef TDEMO
+ FS_DeleteObj( fsh, tape_dblk_ptr ) ;
+#endif
+ }
+
+ if ( error == FS_ACCESS_DENIED ) {
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_PRIVILEGE_ERROR, lp->curr_ddb, tape_dblk_ptr, lp->current_stream_id ) ;
+ } else if ( ( error == FS_COMM_FAILURE ) &&
+ ( DLE_GetDeviceType(BSD_GetDLE(bsd_ptr)) == FS_EMS_DRV ) ) {
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, error, lp->curr_ddb, tape_dblk_ptr, 0L ) ;
+ return_status = SUCCESS ;
+
+ } else if ( return_status == error ) {
+ return_status = SUCCESS ;
+ }
+
+ if( ( FS_GetBlockType( tape_dblk_ptr ) == BT_FDB ) &&
+ ( FS_GetAttribFromDBLK( fsh, tape_dblk_ptr ) & FILE_IN_USE_BIT ) ) {
+ LP_MsgOpenedInUse( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr ) ;
+ }
+ } else {
+
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_FILE_OPEN_ERROR, lp->curr_ddb, tape_dblk_ptr, 0L ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ /* skip the data and log it ... */
+ LP_SkipData( lp ) ;
+
+ return SUCCESS ;
+
+ }
+
+ if( return_status == SUCCESS) {
+ if ( FS_GetBlockType( tape_dblk_ptr ) != BT_IDB ) {
+
+ LP_MsgBlockProcessed( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr ) ;
+ }
+
+ } else if( ( return_status != USER_ABORT ) ) {
+
+ /* if FALSE then we already logged error somewhere above */
+ if( block_skipped_flag ) {
+
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ /* skip the data and log it ... */
+ LP_SkipData( lp ) ;
+
+ }
+
+ if ( return_status != ABORT_OPERATION ) {
+ return_status = SUCCESS ;
+ }
+
+ }
+
+ if ( temp_renamed_dir ) {
+
+ FS_ReleaseDBLK( fsh, lp->curr_ddb ) ;
+ FS_DuplicateDBLK( fsh, &temp_new_dir, lp->curr_ddb );
+ FS_ChangeIntoDDB( fsh, lp->curr_ddb ) ;
+ temp_renamed_dir = FALSE ;
+ }
+
+ return( return_status ) ;
+
+}
+
+static INT16 LP_ShortenDDB( LP_ENV_PTR lp, DBLK_PTR ddb )
+{
+ CHAR_PTR path ;
+ INT16 psize ;
+ CHAR_PTR p ;
+ CHAR_PTR from ;
+ CHAR_PTR to ;
+ INT16 ret_val ;
+
+ psize = FS_SizeofPathInDDB( lp->curr_fsys, ddb ) ;
+
+ path = calloc( 1, psize ) ;
+
+ if ( path == NULL ) {
+ return OUT_OF_MEMORY;
+ }
+
+ FS_GetPathFromDDB( lp->curr_fsys, ddb, path ) ;
+
+ p = path + psize/sizeof(CHAR) -2 ;
+
+ strcpy( path, TOO_DEEP_DIR ) ;
+
+ for ( ;*p != TEXT('\0'); p-- ) ;
+
+ from = p + 1 ;
+ to = path + strlen( TOO_DEEP_DIR ) + 1 ;
+
+ if ( from == to ) {
+ psize = strsize( TOO_DEEP_DIR ) ;
+ } else {
+ memmove( to, from, psize + ((BYTE_PTR)path - (BYTE_PTR)from) ) ;
+ psize -= ((BYTE_PTR)from - (BYTE_PTR)to) ;
+ }
+
+ ret_val = FS_SetPathInDDB( lp->curr_fsys, ddb, path, &psize ) ;
+
+ free( path ) ;
+
+ return ret_val ;
+}
+
+
+
+
+
diff --git a/private/utils/ntbackup/src/ribproc.c b/private/utils/ntbackup/src/ribproc.c
new file mode 100644
index 000000000..d798e5a04
--- /dev/null
+++ b/private/utils/ntbackup/src/ribproc.c
@@ -0,0 +1,1968 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: ribproc.c
+
+ Description: This file contains the functions for processing messages
+ sent by Windows to ribbon windows. It also contains the
+ supporting functions called the Ribbon Manager (RIB).
+ The functions handle selecting, drawing button items using
+ text and bitmaps ( in up and down positions with enabled and
+ disabled status ), and message sending and posting.
+
+
+ $Log: G:\ui\logfiles\ribproc.c_v $
+
+ Rev 1.29 11 Aug 1993 11:19:44 GLENN
+Replaced the sleep call with a maintained delay variable.
+
+ Rev 1.28 05 Aug 1993 16:45:16 MARINA
+enable c++
+
+ Rev 1.27 15 Jul 1993 15:05:30 KEVINS
+Sleep a little bit before spinning really takes off.
+
+ Rev 1.26 18 May 1993 15:07:12 GLENN
+Removed bogus stuff from ribbon disable to eliminate warning.
+
+ Rev 1.25 09 Apr 1993 14:07:36 GLENN
+Added RIB_ItemEnable, RIB_Init, RIB_Deinit, RIB_IsItemEnabled routines.
+
+ Rev 1.24 03 Mar 1993 16:50:06 ROBG
+Added function RIB_ItemGetState so MSOFT_UI can set the some
+menu statuses to particular ribbon statuses.
+
+ Rev 1.23 02 Mar 1993 15:25:14 ROBG
+Added RIB_UpPosition to support WIN32 applications.
+
+ Rev 1.22 18 Nov 1992 11:42:02 GLENN
+Added new feature to emulate Microsoft's 3D highlighting.
+
+ Rev 1.21 10 Nov 1992 07:50:36 GLENN
+Now clearing the current item in the right place. (found under NT)
+
+ Rev 1.20 01 Nov 1992 16:06:38 DAVEV
+Unicode changes
+
+ Rev 1.19 07 Oct 1992 15:10:10 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.18 04 Oct 1992 19:40:18 DAVEV
+Unicode Awk pass
+
+ Rev 1.17 10 Jun 1992 16:21:08 GLENN
+Took out the extra line at the top of the ribbon.
+
+ Rev 1.16 29 May 1992 16:00:32 JOHNWT
+PCH updates
+
+ Rev 1.15 20 Apr 1992 14:00:04 GLENN
+Fixed status line help problem. Renamed global variables to module wides.
+
+ Rev 1.14 07 Apr 1992 10:39:38 GLENN
+Using global ribbon font instead of font passed in rib item structure due to sys change problems.
+
+ Rev 1.13 02 Apr 1992 16:18:54 GLENN
+Put the new changes into the spinner.
+
+ Rev 1.12 02 Apr 1992 15:29:02 GLENN
+Added bitmap and text rectangles for buttons - drawing is faster. Supports NT better now.
+
+ Rev 1.11 23 Feb 1992 13:49:32 GLENN
+Added IsWindow calls to keyboard functions.
+
+ Rev 1.10 11 Feb 1992 17:27:46 GLENN
+Fixed point stuff.
+
+ Rev 1.9 04 Feb 1992 16:37:36 STEVEN
+now use macro to convert MP2 to POINT
+
+ Rev 1.8 04 Feb 1992 16:21:20 GLENN
+Working on auto calc size for ribbon.
+
+ Rev 1.7 29 Jan 1992 18:05:06 DAVEV
+
+
+ * No changes
+
+ Rev 1.6 19 Dec 1991 15:25:34 GLENN
+Added windows.h
+
+ Rev 1.5 12 Dec 1991 17:10:30 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.4 10 Dec 1991 14:37:44 GLENN
+Added RIB_AutoCalcSize() stuff
+
+ Rev 1.3 05 Dec 1991 17:51:46 GLENN
+Changed active window handle to macro
+
+ Rev 1.2 02 Dec 1991 17:50:44 DAVEV
+16/32 bit Windows port changes
+
+ Rev 1.1 27 Nov 1991 12:07:52 GLENN
+Added code to prevent messages if the button is already down and it is
+a positional button.
+
+ Rev 1.0 20 Nov 1991 19:28:36 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+// PRIVATE DEFINITIONS
+
+#define WINCLASS_RIBBON TEXT("GSH_Ribbon") // Class name for the ribbon windows.
+
+// POSSIBLY HAVE THE ABILITY TO ENABLE AND DISABLE RIBBON ITEMS BASED ON
+// AN ITEM ID AS WELL AS AN ITEM INDEX INTO THE RIBBON ITEM LIST.
+
+static BOOL mwfButtonDown = FALSE;
+static WORD mwwButtonType = 0;
+static BOOL mwfWasInRect = FALSE;
+static CHAR mwszRibbonText[RIB_ITEM_TEXT_SIZE];
+
+static HBRUSH mwhColorFace;
+static HPEN mwhColorBorder;
+static HPEN mwhColorHilite;
+static HPEN mwhColorShadow;
+
+static HANDLE mwhAppInst = 0;
+static HANDLE mwhResInst = 0;
+static BOOL mwfInitialized = FALSE;
+static INT mwnCurrentDelay = 0;
+static INT mwnRepeatDelay = 400;
+
+// PRIVATE MACROS
+
+#define RIB_GetInfoPtr( x ) (HRIBBON)GetWindowLong( x, 0 )
+#define RIB_SetInfoPtr( x, y ) SetWindowLong( x, 0, (DWORD)y )
+
+// PRIVATE FUNCTION PROTOTYPES
+
+VOID RIB_MouseMove ( HWND, MP2 );
+VOID RIB_Paint ( HWND );
+VOID RIB_Timer ( HWND );
+VOID RIB_Up3D( HDC, LPRECT, BOOL );
+VOID RIB_Down3D( HDC, LPRECT, BOOL );
+
+// FUNCTIONS NOT YET IMPLEMENTED
+
+BOOL RIB_GetInfo ( HRIBBON, PDS_RIBINFO );
+HWND RIB_GetOwner ( HRIBBON );
+HRIBBON RIB_Load ( WORD );
+BOOL RIB_SetState ( HRIBBON, LPSTR );
+BOOL RIB_ItemDelete ( HRIBBON, UINT );
+BOOL RIB_ItemGetState ( HRIBBON, UINT, PDS_RIBITEMINFO );
+
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: WM_RibbonWndProc()
+
+ Description: This function is called internally by Windows.
+ Windows calls this function when messages related to
+ Ribbon windows must be processed.
+
+ Returns: NULL or a default message handler's return code.
+
+******************************************************************************/
+
+WINRESULT APIENTRY WM_RibbonWndProc (
+
+ register HWND hWnd, // I - window handle of the list box
+ MSGID msg, // I - message
+ MP1 mp1, // I - another message parameter
+ MP2 mp2 ) // I - yet another message parameter
+
+{
+ switch ( msg ) {
+
+ case WM_CREATE: // Do some creation initialization stuff.
+
+ RIB_SetInfoPtr ( hWnd, NULL );
+ break;
+
+ case WM_SETCURSOR: // Set the right cursor for this window position.
+
+ break;
+
+ case WM_LBUTTONDOWN:
+
+ // If we have a help context mode handler callback,
+ // do the callback. I will add this later.
+
+//# ifdef MAYN_WIN
+ {
+ if ( HM_ContextLbuttonDown( hWnd, mp1, mp2 ) == TRUE ) {
+ return 0;
+ }
+ }
+//# endif
+
+ // Fall through if Help is not called
+
+ case WM_LBUTTONDBLCLK:
+
+ RIB_KeyDown ( hWnd, RIB_MOUSE, mp1, mp2 );
+ return 0;
+
+
+ case WM_LBUTTONUP:
+
+ RIB_KeyUp ( hWnd, RIB_MOUSE, mp1, mp2 );
+ return 0;
+
+ case WM_MOUSEMOVE:
+
+ RIB_MouseMove ( hWnd, mp2 );
+ return 0;
+
+ case WM_PAINT: // Paint the ribbon or ribbon item.
+
+ RIB_Paint( hWnd );
+ return 0;
+
+ case WM_TIMER:
+
+ RIB_Timer ( hWnd );
+ return 0;
+
+ default:
+ break;
+ }
+
+ return DefWindowProc ( hWnd, msg, mp1, mp2 );
+
+
+} /* end WM_RibbonWndProc() */
+
+
+/******************************************************************************
+
+ Name: RIB_Init ()
+
+ Description: This function initializes the ribbon/toolbar manager.
+
+ Returns: SUCCESS, if successful. Otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL RIB_Init (
+
+HANDLE hAppInst,
+HANDLE hResInst )
+
+{
+ if ( ! mwfInitialized ) {
+
+ WNDCLASS wc;
+
+ mwhAppInst = hAppInst;
+ mwhResInst = hResInst;
+
+ wc.style = 0;
+ wc.lpfnWndProc = WM_RibbonWndProc;
+ wc.hInstance = mwhAppInst;
+ wc.hIcon = (HICON)NULL;
+ wc.hCursor = LoadCursor ( (HANDLE)NULL, IDC_ARROW );
+ wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+ wc.lpszMenuName = NULL;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = sizeof(PDS_RIBINFO) + sizeof(WORD);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WINCLASS_RIBBON;
+
+ if ( ! RegisterClass( &wc ) ) {
+ return FAILURE;
+ }
+
+ // Create any needed brushes and pens.
+
+ mwhColorFace = CreateSolidBrush ( GetSysColor ( COLOR_BTNFACE ) );
+ mwhColorBorder = GetStockObject ( BLACK_PEN );
+ mwhColorHilite = GetStockObject ( WHITE_PEN );
+ mwhColorShadow = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_BTNSHADOW ) );
+
+ mwfInitialized = TRUE;
+ }
+
+ return SUCCESS;
+
+} /* end RIB_Init() */
+
+
+/******************************************************************************
+
+ Name: RIB_Deinit ()
+
+ Description: This function initializes the ribbon/toolbar manager.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+VOID RIB_Deinit ( VOID )
+
+{
+ if ( mwfInitialized ) {
+
+ // Destroy objects - pens, brushes.
+
+ if ( mwhColorFace ) DeleteObject ( mwhColorFace );
+ if ( mwhColorShadow ) DeleteObject ( mwhColorShadow );
+
+ UnregisterClass ( WINCLASS_RIBBON, mwhAppInst );
+
+ mwfInitialized = FALSE;
+ }
+
+} /* end RIB_Deinit() */
+
+
+/******************************************************************************
+
+ Name: RIB_SystemChange ()
+
+ Description: This function initializes ribbon/toolbar colors.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+VOID RIB_SystemChange ( VOID )
+
+{
+ if ( mwfInitialized ) {
+
+ // Destroy objects - pens, brushes.
+
+ if ( mwhColorFace ) DeleteObject ( mwhColorFace );
+ if ( mwhColorShadow ) DeleteObject ( mwhColorShadow );
+
+ // Create any needed brushes and pens.
+
+ mwhColorFace = CreateSolidBrush ( GetSysColor ( COLOR_BTNFACE ) );
+ mwhColorBorder = GetStockObject ( BLACK_PEN );
+ mwhColorHilite = GetStockObject ( WHITE_PEN );
+ mwhColorShadow = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_BTNSHADOW ) );
+ }
+
+} /* end RIB_SystemChange() */
+
+
+/******************************************************************************
+
+ Name: RIB_IsItemEnabled ()
+
+ Description: This function gets the state of a button by using an
+ item id.
+
+ Returns: TRUE, if the item is enable. Otherwise FALSE.
+
+
+*****************************************************************************/
+
+BOOL RIB_IsItemEnabled (
+
+HRIBBON hRibbon, // I - ribbon handle
+WORD wItemID ) // I - item ID
+
+{
+ PDS_RIBITEMINFO pdsItem;
+ INT i;
+ BOOL fEnabled = FALSE;
+
+ // Ribbon must exist.
+
+ if ( ! hRibbon ) {
+ return fEnabled;
+ }
+
+ // Find the Menu Id in the list of buttons.
+
+ pdsItem = hRibbon->pdsItemList;
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ if ( pdsItem[i].wMessage == wItemID ) {
+ fEnabled = (pdsItem[i].wState & RIB_ITEM_ENABLED) ? TRUE : FALSE;
+ break;
+ }
+ }
+
+ return fEnabled;
+
+}
+
+
+/******************************************************************************
+
+ Name: RIB_UpPosition()
+
+ Description: This function resets a depressed button to the up position
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RIB_UpPosition (
+
+HRIBBON hRibbon )
+
+{
+ PDS_RIBITEMINFO pdsItems;
+
+ if ( ! hRibbon ) {
+ return;
+ }
+
+ pdsItems = hRibbon->pdsItemList;
+
+ if ( ! pdsItems ) {
+ return;
+ }
+
+ // Change the item to the "up" state if depressed by a mouse.
+
+ if ( ( hRibbon->nCurItem != RIB_ITEMUNKNOWN ) && ( mwfButtonDown == TRUE ) ) {
+
+ pdsItems[hRibbon->nCurItem].wState |= RIB_ITEM_UP;
+
+ hRibbon->nCurItem = RIB_ITEMUNKNOWN;
+
+ mwfWasInRect = FALSE;
+ mwfButtonDown = FALSE;
+ mwwButtonType = 0;
+
+ ReleaseCapture ();
+
+ RIB_Draw( hRibbon );
+
+ UpdateWindow( hRibbon->hWnd );
+
+ }
+
+} /* end RIB_UpPosition */
+
+
+/******************************************************************************
+
+ Name: RIB_Activate()
+
+ Description: This function sets the active ribbon for a ribbon window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+BOOL RIB_Activate (
+
+HRIBBON hRibbon ) // I - handle of the ribbon to activate
+
+{
+ if ( hRibbon ) {
+
+ WM_SetInfoPtr ( hRibbon->hWnd, hRibbon );
+
+ // Restore the ribbon state for this window.
+
+ // WM_SetState ( );
+
+ // Draw the ribbon.
+
+ }
+
+ return FALSE;
+
+} /* end RIB_Activate() */
+
+
+/******************************************************************************
+
+ Name: RIB_AutoCalcSize()
+
+ Description: This function automatically calculates the size of each
+ button in a ribbon. The buttons will automatically be
+ set next to each other and the size will be determined
+ based on the character font size, the bitmap size, and
+ the button border width.
+
+ Returns: The height of the ribbon.
+
+******************************************************************************/
+
+BOOL RIB_AutoCalcSize (
+
+HRIBBON hRibbon ) // I - handle of the ribbon to calculate the size for
+
+{
+ INT i;
+ INT nItemWidth = 0;
+ INT nItemHeight = 0;
+ INT nTempWidth = 0;
+ INT nTempHeight = 0;
+ INT nMaxFontWidth = 0;
+ INT nAvgFontWidth = 0;
+ INT nFontHeight = 0;
+ INT nBitmapWidth = 0;
+ INT nBitmapHeight = 0;
+ INT nStringLen = 0;
+ INT nTempStringWidth = 0;
+ INT nMaxStringWidth = 0;
+ CHAR szString[RIB_ITEM_TEXT_SIZE];
+
+ INT nTemp = 0;
+ UINT j;
+
+ PDS_RIBITEMINFO pdsItems;
+
+ msassert ( hRibbon != (HRIBBON)NULL );
+
+ pdsItems = hRibbon->pdsItemList =
+ (PDS_RIBITEMINFO)( (BYTE FAR *)hRibbon + sizeof (DS_RIBINFO) );
+
+ // Calculate the max bitmap width and height of all buttons in the ribbon.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ if ( ! RSM_GetBitmapSize ( pdsItems[i].wEnabledID, &nTempWidth, &nTempHeight ) ) {
+
+ nBitmapWidth = ( nTempWidth > nBitmapWidth ) ? nTempWidth : nBitmapWidth;
+ nBitmapHeight = ( nTempHeight > nBitmapHeight ) ? nTempHeight : nBitmapHeight;
+ }
+ }
+
+ // Calculate the max string width and height of all buttons in the ribbon.
+
+ RSM_GetFontSize ( ghFontRibbon, &nMaxFontWidth, &nAvgFontWidth, &nFontHeight );
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ nStringLen = RSM_StringCopy ( pdsItems[i].wStringID, szString, RIB_ITEM_TEXT_SIZE );
+ nTempStringWidth = nStringLen * nAvgFontWidth;
+ nMaxStringWidth = ( nTempStringWidth > nMaxStringWidth ) ? nTempStringWidth : nMaxStringWidth;
+
+ // Remove the underscore character ('&') from the string if any.
+
+ for ( j = 0; j < strlen ( szString ); j++ ) {
+
+ if ( szString[j] == TEXT('&') ) {
+
+ do {
+ szString[j] = szString[j+1];
+ } while ( szString[++j] != TEXT('\0') );
+
+ break;
+ }
+ }
+
+ nTemp = RSM_GetFontStringWidth ( ghFontRibbon, szString, nStringLen );
+ }
+
+ // Calculate button width.
+
+ nItemWidth = ( 2 * RIB_ITEM_BORDER_WIDTH ) + ( ( nBitmapWidth > nMaxStringWidth ) ? nBitmapWidth : nMaxStringWidth );
+
+ // Calculate button height.
+
+ nItemHeight = ( 2 * RIB_ITEM_BORDER_WIDTH ) + nBitmapHeight + nFontHeight;
+
+ // Now set up the width and height of each button item.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ // Stuff the font in the item.
+
+ pdsItems[i].hFont = ghFontRibbon;
+
+ // Calculate the Button rectangle.
+
+ pdsItems[i].Rect.left = ( i * nItemWidth );
+ pdsItems[i].Rect.right = ( i * nItemWidth ) + ( nItemWidth );
+ pdsItems[i].Rect.top = 0;
+ pdsItems[i].Rect.bottom = nItemHeight - 1;
+
+ pdsItems[i].rcBM = pdsItems[i].rcText = pdsItems[i].Rect;
+
+ // Calculate the Bitmap rectangle.
+
+ pdsItems[i].rcBM.left += RIB_ITEM_BORDER_WIDTH;
+ pdsItems[i].rcBM.right -= RIB_ITEM_BORDER_WIDTH;
+
+ // Calculate the Text rectangle.
+
+ pdsItems[i].rcText.left += RIB_ITEM_BORDER_WIDTH;
+ pdsItems[i].rcText.right -= RIB_ITEM_BORDER_WIDTH;
+
+ // Don't give any room to things that aren't displayed.
+
+ if ( pdsItems[i].wEnabledID == ID_NOTDEFINED ) {
+
+ pdsItems[i].rcText.top += RIB_ITEM_BORDER_WIDTH;
+ pdsItems[i].rcText.bottom -= RIB_ITEM_BORDER_WIDTH;
+ }
+ else if ( pdsItems[i].wStringID == ID_NOTDEFINED ) {
+
+ pdsItems[i].rcBM.top += RIB_ITEM_BORDER_WIDTH;
+ pdsItems[i].rcBM.bottom -= RIB_ITEM_BORDER_WIDTH;
+ }
+ else {
+
+ pdsItems[i].rcBM.top += RIB_ITEM_BORDER_WIDTH;
+ pdsItems[i].rcBM.bottom -= 14;
+ pdsItems[i].rcText.top = pdsItems[i].rcBM.bottom - 2;
+ pdsItems[i].rcText.bottom -= 2;
+ }
+ }
+
+ return nItemHeight;
+
+} /* end RIB_AutoCalcSize() */
+
+
+/******************************************************************************
+
+ Name: RIB_Create()
+
+ Description: This function creates a ribbon for the specified ribbon
+ window.
+
+ Returns: A handle to the newly created ribbon.
+
+ Note: There can be multiple ribbons per ribbon window, but only
+ one active ribbon at a time. The width and height of the
+ ribbon items is used as the default if they are not
+ specified on an item by item basis.
+
+******************************************************************************/
+
+HRIBBON RIB_Create (
+
+HWND hWnd, // I - handle of a ribbon window
+WORD wType, // I - the type of ribbon to create
+INT nItemWidth, // I - the default width of each item
+INT nItemHeight, // I - the default height of each item
+INT nMaxItems ) // I - the maximum number of items in this ribbon
+
+{
+ INT i;
+ HRIBBON hRibbon;
+ PDS_RIBITEMINFO pdsItems;
+
+ // Allocate the memory for the creation of a new ribbon.
+
+ i = sizeof ( DS_RIBINFO ) + ( nMaxItems * sizeof ( DS_RIBITEMINFO ) );
+
+ hRibbon = (HRIBBON)calloc ( 1, i );
+
+ // Stuff the ribbon structure.
+
+ hRibbon->hWnd = hWnd;
+ hRibbon->wType = wType;
+ hRibbon->nItemWidth = nItemWidth;
+ hRibbon->nItemHeight = nItemHeight;
+ hRibbon->nMaxItems = nMaxItems;
+ hRibbon->nNumItems = 0;
+ hRibbon->nCurItem = RIB_ITEMUNKNOWN;
+
+ pdsItems = hRibbon->pdsItemList =
+ (PDS_RIBITEMINFO)( (BYTE FAR *)hRibbon + sizeof (DS_RIBINFO) );
+
+ // Initialize each of the item rectangles.
+
+ for ( i = 0; i < nMaxItems; i++ ) {
+
+ pdsItems[i].Rect.left = ( i * nItemWidth );
+ pdsItems[i].Rect.right = ( i * nItemWidth ) + ( nItemWidth );
+ pdsItems[i].Rect.top = 0;
+ pdsItems[i].Rect.bottom = nItemHeight - 1;
+ }
+
+ return hRibbon;
+
+} /* end RIB_Create() */
+
+
+/******************************************************************************
+
+ Name: RIB_Deactivate()
+
+ Description: This function deactivates the current ribbon in this
+ window.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_Deactivate (
+
+HRIBBON hRibbon ) // I - the handle of the ribbon to be deactivated
+
+{
+ PDS_WMINFO pdsWinInfo;
+
+ // Save the current ribbon item status settings into ribbon's current
+ // owner ribbon status area. HUH? Just do it!
+
+ if ( hRibbon && WM_GetActiveDoc () ) {
+
+ pdsWinInfo = (PDS_WMINFO)NULL;
+ }
+
+ return FALSE;
+
+} /* end RIB_Deactivate() */
+
+
+/******************************************************************************
+
+ Name: RIB_Destroy()
+
+ Description: This function destroys a ribbon and frees all of it's
+ associated memory.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_Destroy (
+
+HRIBBON hRibbon ) // I - the handle of the ribbon to be destroyed
+
+{
+ // Free the memory associated with the ribbon.
+
+ if ( hRibbon ) {
+ free( hRibbon );
+ return FALSE;
+ }
+
+ return TRUE;
+
+} /* end RIB_Destroy */
+
+
+/******************************************************************************
+
+ Name: RIB_Disable()
+
+ Description: This function disables each item in a ribbon and saves the
+ current state in the area specified by the caller.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_Disable (
+
+HRIBBON hRibbon, // I - the handle of the ribbon to be disabled
+LPSTR lpCurState ) // I - the pointer to the callers area where the
+ // current state will be stored
+
+{
+ INT i;
+
+ DBG_UNREFERENCED_PARAMETER ( lpCurState );
+
+ if ( ! hRibbon ) {
+
+ return TRUE;
+ }
+
+ // Save the current state of each item in the callers area.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ }
+
+ // Disable all items in the ribbon.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ }
+
+ // Draw the disabled ribbon.
+
+ RIB_Draw ( hRibbon );
+
+ return FALSE;
+
+} /* end RIB_Disable() */
+
+
+/******************************************************************************
+
+ Name: RIB_Enable()
+
+ Description: This function enables each item in a ribbon to the state
+ that is specified in the callers area.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_Enable (
+
+HRIBBON hRibbon, // I - the handle of the ribbon to be enabled
+LPSTR lpOldState ) // I - the pointer to the callers area where the
+ // old state will be restored from
+
+{
+ INT i;
+ DBG_UNREFERENCED_PARAMETER ( lpOldState );
+
+ if ( ! hRibbon ) {
+
+ return TRUE;
+ }
+
+ // Set the current state of each item to that in the callers area.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ }
+
+ // Draw the enabled ribbon.
+
+ RIB_Draw ( hRibbon );
+
+ return FALSE;
+
+} /* end RIB_Enable() */
+
+
+/******************************************************************************
+
+ Name: RIB_GetState()
+
+ Description: This function gets the current state of each item in a
+ ribbon and stores it in the location specified by the
+ caller.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_GetState (
+
+HRIBBON hRibbon, // I - the handle of the ribbon to be disabled
+LPSTR lpCurState ) // I - the pointer to the callers area where the
+ // current state will be stored
+
+{
+ DBG_UNREFERENCED_PARAMETER ( lpCurState );
+
+ if ( ! hRibbon ) {
+
+ return TRUE;
+ }
+
+/////////////////////////////////////////////////////////////////////
+ return FALSE;
+
+} /* end RIB_GetState() */
+
+
+/******************************************************************************
+
+ Name: RIB_KeyDown()
+
+ Description: This function processes a key down message if a mouse
+ key was pressed or a keyboard key was pressed.
+
+ Returns: FALSE, if the key was used. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_KeyDown (
+
+HWND hWnd, // I - handle of the ribbon window
+WORD wType, // I - type of key down - MOUSE or KEYBOARD
+MP1 mp1, // I - key information parameter
+MP2 mp2 ) // I - mouse information parameter
+
+{
+ HRIBBON hRibbon;
+ INT i;
+ PDS_RIBITEMINFO pdsItems;
+ BOOL fRepeat = FALSE;
+ BOOL fControlDown;
+ POINT CurPoint ;
+
+ if ( IsWindow ( hWnd ) && ! mwfButtonDown ) {
+
+ hRibbon = (HRIBBON)RIB_GetInfoPtr ( hWnd );
+
+ if ( ! hRibbon ) {
+
+ return ! RIB_KEYUSED;
+ }
+
+ // The control key must be down before we allow any key board
+ // messages to be passed on through.
+
+ fControlDown = ( GetKeyState ( VK_CONTROL ) < 0 ) ? TRUE : FALSE;
+
+ mwwButtonType = wType;
+
+ pdsItems = hRibbon->pdsItemList;
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ // If the button down was a MOUSE type and it was in this button,
+ // OR, the button down was a CTRL accelerator key,
+ // AND, the button item was ENABLED,
+ // AND, the button was not POSITIONAL and already down, WHEW...
+ // Then, let's change the button state and see if we should send
+ // a message.
+
+ WM_FromMP2toPOINT( CurPoint, mp2 ) ;
+
+ if ( ( ( wType == RIB_MOUSE && PtInRect ( &pdsItems[i].Rect, CurPoint ) ) ||
+ ( wType == RIB_KEYBOARD && fControlDown && pdsItems[i].wAccelKey == (WORD)mp1 ) ) &&
+ ( pdsItems[i].wState & RIB_ITEM_ENABLED ) &&
+ ! ( ( pdsItems[i].wState & RIB_ITEM_POSITIONAL ) &&
+ ! ( pdsItems[i].wState & RIB_ITEM_UP ) ) ) {
+
+ // Indicate that the button is down, capture the mouse,
+ // etc...
+
+ mwfButtonDown = TRUE;
+ mwfWasInRect = TRUE;
+ SetCapture ( hWnd );
+
+ // Get the current state of the item and change it.
+
+ if ( pdsItems[i].wState & RIB_ITEM_UP ) {
+ pdsItems[i].wState &= ~RIB_ITEM_UP;
+ }
+ else {
+ pdsItems[i].wState |= RIB_ITEM_UP;
+ }
+
+ hRibbon->nCurItem = i;
+
+ InvalidateRect ( hWnd, &pdsItems[i].Rect, FALSE );
+ UpdateWindow ( hWnd );
+
+ // If the creator of the ribbon has requested the DOWN
+ // message be sent, post the message that tells the owner
+ // that the item is down.
+
+ if ( ( hRibbon->wType & RIB_DOWNMESSAGE ) &&
+ ( pdsItems[i].wMessage != ID_NOTDEFINED ) ) {
+
+ POST_WM_COMMAND_MSG (hRibbon->hWndCurOwner,
+ pdsItems[i].wMessage,
+ hRibbon->hWnd, RIB_ITEM_DOWN );
+
+ fRepeat = ( hRibbon->wType & RIB_DOWNREPEAT ) ? TRUE : FALSE;
+ mwnCurrentDelay = 0;
+ }
+
+ // If the down message should be repeated while the item
+ // is down, set a timer to do so.
+
+ if ( fRepeat ) {
+
+ WM_MultiTask ();
+
+ SetTimer ( hRibbon->hWnd, RIB_TIMERID, RIB_TIMERDELAY, NULL );
+ }
+
+ return RIB_KEYUSED;
+ }
+ }
+ }
+
+ return ! RIB_KEYUSED;
+
+} /* end RIB_KeyDown() */
+
+
+/******************************************************************************
+
+ Name: RIB_KeyUp()
+
+ Description: This function processes a key up message if a mouse
+ key was released or a keyboard key was released.
+
+ Returns: FALSE, if the key was used. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_KeyUp (
+
+HWND hWnd, // I - handle of the ribbon window
+WORD wType, // I - type of key down - MOUSE or KEYBOARD
+MP1 mp1, // I - key information parameter
+MP2 mp2 ) // I - mouse information parameter
+
+{
+ HRIBBON hRibbon;
+ PDS_RIBITEMINFO pdsItems;
+ POINT CurPoint ;
+
+ if ( IsWindow ( hWnd ) && mwfButtonDown && ( wType == mwwButtonType ) ) {
+
+ hRibbon = (HRIBBON)RIB_GetInfoPtr ( hWnd );
+
+ if ( ! hRibbon ) {
+
+ return ! RIB_KEYUSED;
+ }
+
+ pdsItems = hRibbon->pdsItemList;
+
+ if ( ( mwwButtonType == RIB_MOUSE ) ||
+ ( mwwButtonType == RIB_KEYBOARD && pdsItems[hRibbon->nCurItem].wAccelKey == (WORD)mp1 ) ) {
+
+ WM_FromMP2toPOINT( CurPoint, mp2 ) ;
+
+ if ( ! ( mwwButtonType == RIB_MOUSE && ! PtInRect ( &pdsItems[hRibbon->nCurItem].Rect, CurPoint ) ) ) {
+
+ // TRICKY BUSINESS, if the button is positional, don't
+ // change its state. If it is momentary, change its state.
+
+ if ( ! ( pdsItems[hRibbon->nCurItem].wState & RIB_ITEM_POSITIONAL ) ) {
+
+ // Get the current state of the item and change it.
+
+ if ( pdsItems[hRibbon->nCurItem].wState & RIB_ITEM_UP ) {
+ pdsItems[hRibbon->nCurItem].wState &= ~RIB_ITEM_UP;
+ }
+ else {
+ pdsItems[hRibbon->nCurItem].wState |= RIB_ITEM_UP;
+ }
+
+ InvalidateRect ( hWnd, &pdsItems[hRibbon->nCurItem].Rect, FALSE );
+ UpdateWindow ( hWnd );
+ }
+
+ // Post the message associated with the item.
+
+ if ( pdsItems[hRibbon->nCurItem].wMessage != ID_NOTDEFINED ) {
+
+ POST_WM_COMMAND_MSG ( hRibbon->hWndCurOwner,
+ pdsItems[hRibbon->nCurItem].wMessage,
+ hRibbon->hWnd, RIB_ITEM_UP );
+ }
+
+ // STM_SetIdleText ( IDS_READY );
+ }
+
+ // If the creator of the ribbon had requested REPEATED DOWN
+ // messages be sent, kill the timer associated with it.
+
+ if ( ( hRibbon->wType & ( RIB_DOWNMESSAGE | RIB_DOWNREPEAT ) ) &&
+ pdsItems[hRibbon->nCurItem].wMessage != ID_NOTDEFINED ) {
+
+ KillTimer ( hRibbon->hWnd, RIB_TIMERID );
+ }
+
+ hRibbon->nCurItem = RIB_ITEMUNKNOWN;
+
+ // Indicate the button is released and release the captured mouse.
+
+ mwfButtonDown = FALSE;
+ ReleaseCapture ();
+
+ return RIB_KEYUSED;
+ }
+
+ mwfWasInRect = FALSE;
+ }
+
+ return ! RIB_KEYUSED;
+
+} /* end RIB_KeyUp() */
+
+
+/******************************************************************************
+
+ Name: RIB_MouseMove()
+
+ Description: This function processes a mouse move message if a mouse
+ was moved in a ribbon window. If a ribbon item or button
+ was pressed and the mouse moves outside of the item's
+ region, the item changes to it's opposite position.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RIB_MouseMove (
+
+HWND hWnd, // I - the handle to a ribbon window
+MP2 mp2 ) // I - mouse information parameter
+
+{
+ BOOL fIsInRect;
+ HRIBBON hRibbon;
+ PDS_RIBITEMINFO pdsItems;
+ POINT CurPoint ;
+
+ // If the mouse cursor is in the selected item, the item remains the
+ // same. Otherwise change the state from UP to DOWN or DOWN to UP.
+
+ if ( mwfButtonDown && ( mwwButtonType == RIB_MOUSE ) ) {
+
+ // Get the information associated with the ribbon.
+
+ hRibbon = (PDS_RIBINFO)RIB_GetInfoPtr ( hWnd );
+ pdsItems = hRibbon->pdsItemList;
+
+ // Change the item state only when the cursor transitions in
+ // or out of the item.
+
+ WM_FromMP2toPOINT( CurPoint, mp2 ) ;
+ fIsInRect = PtInRect ( &pdsItems[hRibbon->nCurItem].Rect, CurPoint );
+
+ if ( ( fIsInRect || mwfWasInRect ) && ! ( fIsInRect && mwfWasInRect ) ) {
+
+ // Get the current state of the item and change it.
+
+ if ( pdsItems[hRibbon->nCurItem].wState & RIB_ITEM_UP ) {
+ pdsItems[hRibbon->nCurItem].wState &= ~RIB_ITEM_UP;
+ }
+ else {
+ pdsItems[hRibbon->nCurItem].wState |= RIB_ITEM_UP;
+ }
+
+ InvalidateRect ( hWnd, &pdsItems[hRibbon->nCurItem].Rect, FALSE );
+ }
+
+ mwfWasInRect = fIsInRect;
+ }
+
+} /* end RIB_MouseMove() */
+
+
+/******************************************************************************
+
+ Name: RIB_Paint()
+
+ Description: This function processes a paint message if a ribbon item
+ or items need repainting.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RIB_Paint (
+
+HWND hWnd ) // I - handle to a ribbon window
+
+{
+ HDC hDC;
+ PAINTSTRUCT ps;
+ RECT Rect;
+ PDS_RIBITEMINFO pdsItem;
+ INT i;
+ PDS_RIBINFO hRibbon;
+
+ hDC = BeginPaint ( hWnd, &ps );
+
+ // Get the information associated with the ribbon.
+
+ hRibbon = (PDS_RIBINFO)RIB_GetInfoPtr ( hWnd );
+
+ if ( hRibbon ) {
+
+ if ( hRibbon->nCurItem == RIB_ITEMUNKNOWN ) {
+
+ GetClientRect ( hWnd, &Rect );
+
+ if ( Rect.right && Rect.bottom ) {
+
+ // Draw the top border.
+
+ SelectObject ( hDC, ghPenBlack );
+
+ // MoveToEx ( hDC, Rect.left, Rect.top, NULL );
+ // LineTo ( hDC, Rect.right, Rect.top );
+
+ // Draw the bottom border.
+
+ MoveToEx ( hDC, Rect.right, Rect.bottom - 1, NULL );
+ LineTo ( hDC, Rect.left - 1, Rect.bottom - 1 );
+
+ // Paint each button item.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ pdsItem = &hRibbon->pdsItemList[i];
+
+ RIB_ItemDraw ( hRibbon, hDC, pdsItem );
+ }
+ }
+ }
+ else {
+
+ RIB_ItemDraw ( hRibbon, hDC, &hRibbon->pdsItemList[hRibbon->nCurItem] );
+
+ if ( ! mwfButtonDown) {
+ hRibbon->nCurItem = RIB_ITEMUNKNOWN;
+ }
+ }
+ }
+
+ EndPaint ( hWnd, &ps );
+
+} /* end RIB_Paint() */
+
+
+/******************************************************************************
+
+ Name: RIB_Timer()
+
+ Description: This function processes a timer message if a ribbon item
+ is down and the repeat option has been specified.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RIB_Timer (
+
+HWND hWnd ) // I - handle to a ribbon window
+
+{
+ HRIBBON hRibbon;
+
+ if ( mwfButtonDown && mwfWasInRect ) {
+
+ if ( mwnCurrentDelay < mwnRepeatDelay ) {
+ mwnCurrentDelay += RIB_TIMERDELAY;
+ }
+ else {
+ hRibbon = (HRIBBON)RIB_GetInfoPtr ( hWnd );
+
+ POST_WM_COMMAND_MSG ( hRibbon->hWndCurOwner,
+ hRibbon->pdsItemList[hRibbon->nCurItem].wMessage,
+ hRibbon->hWnd, RIB_ITEM_DOWN );
+ }
+ }
+
+} /* end RIB_Timer() */
+
+
+/******************************************************************************
+
+ Name: RIB_ItemDraw()
+
+ Description: This function draws a ribbon item in the up or down
+ position depending on which has been specified.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RIB_ItemDraw (
+
+HRIBBON hRibbon, // I - handle to the ribbon
+HDC hDC, // I - handle to a display device context
+PDS_RIBITEMINFO pdsItem ) // I - pointer to a ribbon item
+
+{
+ RECT rcButton = pdsItem->Rect;
+ RECT rcText = pdsItem->rcText;
+ RECT rcBM = pdsItem->rcBM;
+ WORD wBitmapID;
+ INT nOldBkMode;
+ BOOL fChicklet = (BOOL)( pdsItem->wStyle | RIB_ITEM_STYLECHICKLET );
+
+
+ // Set up the FONT, PAINT BRUSH, and BACKGROUND COLOR.
+
+// if ( pdsItem->hFont ) {
+// SelectObject ( hDC, pdsItem->hFont );
+// }
+
+ if ( ghFontRibbon ) {
+ SelectObject ( hDC, ghFontRibbon );
+ }
+
+ SelectObject ( hDC, ghBrushLtGray );
+ SetBkColor ( hDC, GetSysColor ( COLOR_BTNFACE ) );
+
+ // Determine ENABLED or DISABLED bitmap ID and TEXT color.
+
+ if( pdsItem->wState & RIB_ITEM_ENABLED ) {
+
+ wBitmapID = pdsItem->wEnabledID;
+ SetTextColor ( hDC, GetSysColor ( COLOR_BTNTEXT ) );
+ }
+ else {
+ wBitmapID = pdsItem->wDisabledID;
+ SetTextColor ( hDC, GetSysColor ( COLOR_BTNSHADOW ) );
+ }
+
+ if ( pdsItem->wState & RIB_ITEM_UP ) {
+
+ // Draw the button in the up position.
+
+ RIB_Up3D( hDC, &rcButton, fChicklet );
+ }
+ else {
+
+ // Draw the button in the down position.
+
+ RIB_Down3D( hDC, &rcButton, fChicklet );
+
+ if ( fChicklet ) {
+
+ rcBM.left += 1;
+ rcBM.right += 1;
+ rcBM.top += 1;
+ rcBM.bottom += 1;
+
+ rcText.left += 1;
+ rcText.right += 1;
+ rcText.top += 1;
+ rcText.bottom += 1;
+ }
+ else {
+
+ rcBM.left += 2;
+ rcBM.right += 2;
+ rcBM.top += 2;
+ rcBM.bottom += 2;
+
+ rcText.left += 2;
+ rcText.right += 2;
+ rcText.top += 2;
+ rcText.bottom += 2;
+ }
+ }
+
+ // Draw the bitmap CENTERED in the rectangle.
+
+ if ( wBitmapID != ID_NOTDEFINED ) {
+
+ RSM_BitmapDrawCentered ( wBitmapID,
+ rcBM.left,
+ rcBM.top,
+ rcBM.right - rcBM.left,
+ rcBM.bottom - rcBM.top,
+ hDC
+ );
+ }
+
+ // Get the string and draw it CENTERED with a TRANSPARENT BACKGROUND.
+
+ nOldBkMode = SetBkMode( hDC, TRANSPARENT );
+
+ if ( pdsItem->wStringID != ID_NOTDEFINED ) {
+
+ WORD wFormat = 0;
+
+ RSM_StringCopy ( pdsItem->wStringID, mwszRibbonText, RIB_ITEM_TEXT_SIZE );
+
+ // Do the horizontal allignment stuff.
+
+ if ( pdsItem->wTextStyle & RIB_TEXT_HCENTER ) {
+ wFormat |= DT_CENTER;
+ }
+ else if ( pdsItem->wTextStyle & RIB_TEXT_HLEFT ) {
+ wFormat |= DT_LEFT;
+ }
+ else if ( pdsItem->wTextStyle & RIB_TEXT_HRIGHT ) {
+ wFormat |= DT_RIGHT;
+ }
+ else {
+ wFormat |= DT_CENTER;
+ }
+
+ // Do the vertical allignment stuff.
+
+ if ( pdsItem->wTextStyle & RIB_TEXT_VCENTER ) {
+ wFormat |= DT_VCENTER;
+ }
+ else if ( pdsItem->wTextStyle & RIB_TEXT_VTOP ) {
+ wFormat |= DT_TOP;
+ }
+ else if ( pdsItem->wTextStyle & RIB_TEXT_VBOTTOM ) {
+ wFormat |= DT_BOTTOM;
+ }
+ else {
+ wFormat |= DT_VCENTER;
+ }
+
+ DrawText ( hDC, mwszRibbonText, -1, &rcText, wFormat );
+ }
+
+ // Show any status line text (based on a menu item).
+
+ if ( mwfButtonDown && ! ( pdsItem->wState & RIB_ITEM_NOMENUITEM ) ) {
+
+ if ( ! ( pdsItem->wState & RIB_ITEM_UP ) ) {
+
+ // The mouse button is down and so is the ribbon item.
+ // So, show any status line help (this is directly related to the menus).
+
+ SEND_WM_MENUSELECT_MSG ( hRibbon->hWndCurOwner, pdsItem->wMessage, 0, 0 );
+
+ }
+ else if ( mwfButtonDown ) {
+
+ // The mouse button is down, but the ribbon item isn't.
+ // So, send a message to clear out the menu select.
+
+ SEND_WM_MENUSELECT_MSG ( hRibbon->hWndCurOwner, 0, LOWORD(MM_MENUCLOSED), 0 );
+ }
+ }
+
+ SetBkMode( hDC, nOldBkMode );
+
+} /* end RIB_ItemDraw() */
+
+
+/******************************************************************************
+
+ Name: RIB_ItemInsert()
+
+ Description: This function inserts an item into a ribbon at the position
+ specified.
+
+ Returns: FALSE, if the item was inserted. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_ItemInsert (
+
+HRIBBON hRibbon, // I - handle to a ribbon
+UINT unPosition, // I - position to insert after
+PDS_RIBITEMINFO pdsItem ) // I - pointer to a ribbon item
+
+{
+ UINT i;
+
+ // See if the ribbon is full.
+
+ if ( ! hRibbon || hRibbon->nNumItems == hRibbon->nMaxItems ) {
+ return TRUE;
+ }
+
+ // Extract the accelerator key from the item string and insert it into the
+ // accelerator key item.
+
+ if ( pdsItem->wStringID != ID_NOTDEFINED ) {
+
+ LPSTR pHotKey;
+ CHAR szMarker[3];
+
+ RSM_StringCopy ( pdsItem->wStringID, mwszRibbonText, RIB_ITEM_TEXT_SIZE );
+ RSM_StringCopy ( IDS_UNDERSCOREMARKER, szMarker, 3 );
+
+ // Search for the accelerator key MARKER in the string. If one is not
+ // found, use the first character in the string. Otherwise, use the
+ // character following the accelerator key MARKER.
+
+ pHotKey = strstr ( mwszRibbonText, szMarker );
+
+ if ( ! pHotKey || ! *(pHotKey+1) ) {
+ pHotKey = mwszRibbonText;
+ }
+ else {
+ pHotKey++;
+ }
+
+ // Get the key scan code and strip out the shift state for
+ // the character.
+
+ pdsItem->wAccelKey = (WORD)( LOBYTE ( VkKeyScan ( *pHotKey ) ) );
+ }
+
+
+ hRibbon->nNumItems ++;
+
+ // Determine the item number to insert.
+
+ if ( ( unPosition == RIB_APPEND ) || ( unPosition >= (UINT)hRibbon->nNumItems ) ) {
+
+ unPosition = hRibbon->nNumItems;
+ }
+ else {
+
+ // Move the existing items down one.
+
+ for ( i = hRibbon->nNumItems - 1; i > unPosition; i-- ) {
+ memcpy ( &hRibbon->pdsItemList[i], &hRibbon->pdsItemList[i-1], sizeof ( DS_RIBITEMINFO ) );
+ }
+ }
+
+ memcpy ( &hRibbon->pdsItemList[--unPosition], pdsItem, sizeof ( DS_RIBITEMINFO ) );
+
+ return FALSE;
+
+} /* end RIB_ItemInsert() */
+
+
+/******************************************************************************
+
+ Name: RIB_Up3D()
+
+ Description: This function draws a raised 3-D border of a ribbon
+ item/button to using the specified rectangle. Simulates
+ a button in the up position.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RIB_Up3D (
+
+HDC hDC, // I - handle to a display device context
+LPRECT pRect, // I - pointer to a rectangle structure
+BOOL fChicklet ) // I - Chicklet type highlighting
+
+{
+ RECT rcTemp = *pRect;
+
+ rcTemp.top = pRect->top + 1;
+ rcTemp.bottom = pRect->bottom - 1;
+ rcTemp.left = pRect->left + 1;
+ rcTemp.right = pRect->right - 1;
+
+ FillRect ( hDC, &rcTemp, ghBrushLtGray );
+
+ // Draw the border.
+
+ SelectObject ( hDC, ghPenBlack );
+
+ MoveToEx ( hDC, pRect->left + 1, pRect->top, NULL );
+ LineTo ( hDC, pRect->right, pRect->top );
+
+ MoveToEx ( hDC, pRect->right, pRect->top + 1, NULL );
+ LineTo ( hDC, pRect->right, pRect->bottom );
+
+ MoveToEx ( hDC, pRect->right - 1, pRect->bottom, NULL );
+ LineTo ( hDC, pRect->left, pRect->bottom );
+
+ MoveToEx ( hDC, pRect->left, pRect->bottom - 1, NULL );
+ LineTo ( hDC, pRect->left, pRect->top );
+
+ // Draw the highlight.
+
+ SelectObject ( hDC, ghPenWhite );
+
+ MoveToEx ( hDC, pRect->left + 1, pRect->bottom - 2, NULL );
+ LineTo ( hDC, pRect->left + 1, pRect->top + 1 );
+ LineTo ( hDC, pRect->right - 1, pRect->top + 1 );
+
+ if ( ! fChicklet ) {
+
+ MoveToEx ( hDC, pRect->left + 2, pRect->bottom - 3, NULL );
+ LineTo ( hDC, pRect->left + 2, pRect->top + 2 );
+ LineTo ( hDC, pRect->right - 2, pRect->top + 2 );
+ }
+
+ // Draw the shadow.
+
+ SelectObject ( hDC, ghPenDkGray );
+
+ MoveToEx ( hDC, pRect->left + 1, pRect->bottom - 1, NULL );
+ LineTo ( hDC, pRect->right - 1, pRect->bottom - 1 );
+ LineTo ( hDC, pRect->right - 1, pRect->top + 0 );
+ MoveToEx ( hDC, pRect->left + 2, pRect->bottom - 2, NULL );
+ LineTo ( hDC, pRect->right - 2, pRect->bottom - 2 );
+ LineTo ( hDC, pRect->right - 2, pRect->top + 1 );
+
+} /* end RIB_Up3D() */
+
+
+/******************************************************************************
+
+ Name: RIB_Down3D()
+
+ Description: This function draws a depressed 3-D border of a ribbon
+ item/button to using the specified rectangle. Simulates
+ a button in the down position.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID RIB_Down3D (
+
+HDC hDC, // I - handle to a display device context
+LPRECT pRect, // I - pointer to a rectangle structure
+BOOL fChicklet ) // I - Chicklet type highlighting
+
+{
+ RECT rcTemp = *pRect;
+
+ rcTemp.top = pRect->top + 1;
+ rcTemp.bottom = pRect->bottom;
+ rcTemp.left = pRect->left + 1;
+ rcTemp.right = pRect->right;
+
+ FillRect ( hDC, &rcTemp, ghBrushLtGray );
+
+ // Draw the border.
+
+ SelectObject ( hDC, ghPenBlack );
+
+ MoveToEx ( hDC, pRect->left + 1, pRect->top, NULL );
+ LineTo ( hDC, pRect->right, pRect->top );
+
+ MoveToEx ( hDC, pRect->right, pRect->top + 1, NULL );
+ LineTo ( hDC, pRect->right, pRect->bottom );
+
+ MoveToEx ( hDC, pRect->right - 1, pRect->bottom, NULL );
+ LineTo ( hDC, pRect->left, pRect->bottom );
+
+ MoveToEx ( hDC, pRect->left, pRect->bottom - 1, NULL );
+ LineTo ( hDC, pRect->left, pRect->top );
+
+// MoveToEx ( hDC, pRect->left, pRect->top, NULL );
+// LineTo ( hDC, pRect->right, pRect->top );
+// LineTo ( hDC, pRect->right, pRect->bottom );
+// LineTo ( hDC, pRect->left, pRect->bottom );
+// LineTo ( hDC, pRect->left, pRect->top );
+
+ // Draw the shadow.
+
+ SelectObject ( hDC, ghPenDkGray );
+
+ MoveToEx ( hDC, pRect->left + 1, pRect->bottom, NULL );
+ LineTo ( hDC, pRect->left + 1, pRect->top + 1 );
+ LineTo ( hDC, pRect->right , pRect->top + 1 );
+
+
+ if ( ! fChicklet ) {
+
+ MoveToEx ( hDC, pRect->left + 2, pRect->bottom, NULL );
+ LineTo ( hDC, pRect->left + 2, pRect->top + 2 );
+ LineTo ( hDC, pRect->right , pRect->top + 2 );
+ }
+
+} /* end RIB_Down3D() */
+
+
+/******************************************************************************
+
+ Name: RIB_ItemReplace()
+
+ Description: This function replaces the contents of a ribbon item
+ structure.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_ItemReplace (
+
+HRIBBON hRibbon, // I - handle to a ribbon
+WORD wMessageID, // I - the ribbon item message ID
+PDS_RIBITEMINFO pdsRibItem ) // I - the pointer to the ribbon item data structure
+
+{
+ PDS_RIBITEMINFO pdsItems;
+ INT i;
+
+ if ( ! hRibbon ) {
+ return TRUE;
+ }
+
+ pdsItems = hRibbon->pdsItemList;
+
+ // Loop through the items until we find the matching one.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ if ( pdsItems[i].wMessage == wMessageID ) {
+
+ memcpy ( &pdsItems[i], &pdsRibItem, sizeof ( DS_RIBITEMINFO ) );
+ InvalidateRect ( hRibbon->hWnd, &pdsItems[i].Rect, FALSE );
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+
+} /* end RIB_ItemReplace() */
+
+
+/******************************************************************************
+
+ Name: RIB_ItemSetState()
+
+ Description: This function sets the state of a ribbon item.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_ItemSetState (
+
+HRIBBON hRibbon, // I - handle to a ribbon
+WORD wMessageID, // I - the ribbon item message ID
+WORD wState ) // I - the new ribbon item state.
+
+{
+ PDS_RIBITEMINFO pdsItems;
+ INT i;
+
+ if ( ! hRibbon ) {
+ return TRUE;
+ }
+
+ pdsItems = hRibbon->pdsItemList;
+
+ // Loop through the items until we find the matching one.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ if ( pdsItems[i].wMessage == wMessageID ) {
+
+ // Set the state and redraw only if it is different.
+
+ if ( pdsItems[i].wState != wState ) {
+
+ // If the item was DOWN and now it is UP,
+ // clear any menu select message.
+
+ if ( ! ( pdsItems[i].wState & RIB_ITEM_UP ) ) {
+ SEND_WM_MENUSELECT_MSG ( hRibbon->hWndCurOwner, 0, LOWORD(MM_MENUCLOSED), 0 );
+ }
+
+ pdsItems[i].wState = wState;
+ InvalidateRect ( hRibbon->hWnd, &pdsItems[i].Rect, FALSE );
+ }
+
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+
+} /* end RIB_ItemSetState() */
+
+
+/******************************************************************************
+
+ Name: RIB_ItemEnable()
+
+ Description: This function enables a ribbon item.
+
+ Returns: FALSE, if successful. Otherwise, TRUE.
+
+******************************************************************************/
+
+BOOL RIB_ItemEnable (
+
+HRIBBON hRibbon, // I - handle to a ribbon
+WORD wMessageID, // I - the ribbon item message ID
+BOOL fEnable ) // I - enable/disable flag.
+
+{
+ PDS_RIBITEMINFO pdsItems;
+ INT i;
+ WORD wState;
+
+ if ( ! hRibbon ) {
+ return TRUE;
+ }
+
+ pdsItems = hRibbon->pdsItemList;
+
+ // Loop through the items until we find the matching one.
+
+ for ( i = 0; i < hRibbon->nNumItems; i++ ) {
+
+ if ( pdsItems[i].wMessage == wMessageID ) {
+
+ // Always force UP when the item is enabled or disabled.
+
+ wState = pdsItems[i].wState;
+
+ wState |= RIB_ITEM_UP;
+
+ if ( fEnable ) {
+ wState |= RIB_ITEM_ENABLED;
+ }
+ else {
+ wState &= ~RIB_ITEM_ENABLED;
+ }
+
+ // Set the state and redraw only if it is different.
+
+ if ( pdsItems[i].wState != wState ) {
+
+ // If the item was DOWN and now it is UP,
+ // clear any menu select message.
+
+ if ( ! ( pdsItems[i].wState & RIB_ITEM_UP ) ) {
+ SEND_WM_MENUSELECT_MSG ( hRibbon->hWndCurOwner, 0, LOWORD(MM_MENUCLOSED), 0 );
+ }
+
+ pdsItems[i].wState = wState;
+ InvalidateRect ( hRibbon->hWnd, &pdsItems[i].Rect, FALSE );
+
+ }
+
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+
+} /* end RIB_ItemEnable() */
+
+
+
+HSPINNER RIB_CreateSpinner (
+
+HWND hWnd,
+WORD wItemID,
+INT x,
+INT y,
+WORD wIncrementMsg,
+WORD wDecrementMsg )
+
+{
+ HSPINNER hSpinner;
+ HWND hWndSpinnerRib;
+ DS_RIBITEMINFO dsRibItem;
+
+ DBG_UNREFERENCED_PARAMETER ( x );
+ DBG_UNREFERENCED_PARAMETER ( y );
+
+ if ( ! hWnd ) {
+ return (HSPINNER)0;
+ }
+
+ hSpinner = (HSPINNER)malloc ( sizeof ( DS_SPINNER ) );
+
+ if ( ! hSpinner ) {
+ return (HSPINNER)0;
+ }
+
+ // create the ribbon window here
+
+ hWndSpinnerRib = WM_Create ( WM_RIBBON,
+ TEXT("Spinner Ribbon"),
+ NULL,
+ 0,
+ 0,
+ 15,
+ 27,
+ (PDS_WMINFO) (DWORD) GetDlgItem ( hWnd, wItemID )
+ );
+
+ // Create/initialize the ribbon itself inside the ribbon window.
+
+ hSpinner->hRib = RIB_Create ( hWndSpinnerRib, RIB_DOWNMESSAGE | RIB_DOWNREPEAT, 8, 16, 2 ) ;
+ hSpinner->wIncrementMsg = wIncrementMsg;
+ hSpinner->wDecrementMsg = wDecrementMsg;
+
+ // Set up the font.
+
+ dsRibItem.hFont = ghFontRibbon;
+
+ // UP ARROW
+
+ dsRibItem.Rect.left = 0;
+ dsRibItem.Rect.top = 0;
+ dsRibItem.Rect.right = 15;
+ dsRibItem.Rect.bottom = 13;
+
+ dsRibItem.rcBM = dsRibItem.Rect;
+
+ dsRibItem.rcBM.left += RIB_ITEM_BORDER_WIDTH;
+ dsRibItem.rcBM.top += RIB_ITEM_BORDER_WIDTH;
+ dsRibItem.rcBM.right -= RIB_ITEM_BORDER_WIDTH;
+ dsRibItem.rcBM.bottom -= RIB_ITEM_BORDER_WIDTH;
+
+ dsRibItem.wEnabledID = IDRBM_UPARROW ;
+ dsRibItem.wDisabledID = IDRBM_UPARROW_GRAY ;
+ dsRibItem.wStringID = ID_NOTDEFINED ;
+ dsRibItem.wAccelKey = ID_NOTDEFINED ;
+ dsRibItem.wState = RIB_ITEM_ENABLED | RIB_ITEM_UP | RIB_ITEM_NOMENUITEM;
+ dsRibItem.wMessage = wIncrementMsg ;
+
+ RIB_ItemAppend ( hSpinner->hRib, &dsRibItem ) ;
+
+
+ // DOWN ARROW
+
+ dsRibItem.Rect.top = 13;
+ dsRibItem.Rect.bottom = 26;
+
+ dsRibItem.rcBM = dsRibItem.Rect;
+
+ dsRibItem.rcBM.left += RIB_ITEM_BORDER_WIDTH;
+ dsRibItem.rcBM.top += RIB_ITEM_BORDER_WIDTH;
+ dsRibItem.rcBM.right -= RIB_ITEM_BORDER_WIDTH;
+ dsRibItem.rcBM.bottom -= RIB_ITEM_BORDER_WIDTH;
+
+ dsRibItem.wEnabledID = IDRBM_DNARROW ;
+ dsRibItem.wDisabledID = IDRBM_DOWNARROW_GRAY ;
+ dsRibItem.wMessage = wDecrementMsg ;
+
+ RIB_ItemAppend ( hSpinner->hRib, &dsRibItem ) ;
+
+ // Set up the spinner owner, the activate, show, and draw the spinner.
+
+ RIB_SetOwner ( hSpinner->hRib, hWnd ) ;
+ RIB_Activate ( hSpinner->hRib );
+ WM_Show ( hSpinner->hRib->hWnd );
+ RIB_Draw ( hSpinner->hRib ) ;
+
+ return hSpinner;
+
+} /* end RIB_CreateSpinner() */
+
+
+VOID RIB_DestroySpinner (
+
+HSPINNER hSpinner )
+
+{
+ if ( ! hSpinner ) {
+ return;
+ }
+
+ // Destroy the spinner ribbon window, then the ribbon.
+
+ DestroyWindow ( hSpinner->hRib->hWnd );
+ RIB_Destroy ( hSpinner->hRib ) ;
+ free ( hSpinner );
+
+} /* end RIB_DestroySpinner() */
+
+
+BOOL RIB_EnableSpinner (
+
+HSPINNER hSpinner,
+BOOL fEnable )
+
+{
+ WORD wState = (WORD) (RIB_ITEM_UP
+ | RIB_ITEM_NOMENUITEM
+ | ( ( fEnable ) ? RIB_ITEM_ENABLED
+ : RIB_ITEM_DISABLED ));
+
+ if ( ! hSpinner ) {
+ return TRUE;
+ }
+
+ RIB_ItemSetState ( hSpinner->hRib, hSpinner->wIncrementMsg, wState );
+ RIB_ItemSetState ( hSpinner->hRib, hSpinner->wDecrementMsg, wState );
+ return FALSE ;
+
+} /* end RIB_EnableSpinner() */
+
diff --git a/private/utils/ntbackup/src/runtime.c b/private/utils/ntbackup/src/runtime.c
new file mode 100644
index 000000000..214738c77
--- /dev/null
+++ b/private/utils/ntbackup/src/runtime.c
@@ -0,0 +1,2481 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: RUNTIME.C
+
+ Description: Displays the runtime status for backup, restore
+ verify, delete, erase, and tension.
+
+ $Log: G:\UI\LOGFILES\RUNTIME.C_V $
+
+ Rev 1.98.1.4 27 Jan 1994 16:50:10 Glenn
+Pushing and popping the status line for hw init.
+
+ Rev 1.98.1.3 27 Jan 1994 15:48:52 GREGG
+Always ask to abort at EOF and don't display bytes remaining.
+
+ Rev 1.98.1.2 18 Jan 1994 18:11:28 chrish
+Added fix for EPR 0169. Added fix to handle aborting incremental backup.
+
+ Rev 1.98.1.1 12 Jan 1994 10:24:50 MikeP
+add handling for abort in middle of file
+
+ Rev 1.98.1.0 08 Dec 1993 11:32:44 MikeP
+very deep pathes and unicode
+
+ Rev 1.98 23 Aug 1993 18:33:54 BARRY
+Under OS_WIN32, allow a really large number of lines in the rutime listbox.
+
+ Rev 1.97 20 Aug 1993 09:57:18 GLENN
+Fixed problem with horizontal scroll bar extent - it is now based on the text string extent.
+
+ Rev 1.96 04 Aug 1993 10:17:32 GLENN
+Added support for moving runtime dialog into viewing area if it is moved completely off of the screen.
+
+ Rev 1.95 30 Jul 1993 15:57:12 chrish
+Fixed bug for Nostradamus, when backing up using the command line, aborting
+a large file would wait for complete backup of that file before aborting.
+
+ Rev 1.94 26 Jul 1993 08:53:22 chrish
+CAYMAN EPR 0578: Cleaned up abort messages to display and log file
+
+ Rev 1.93 13 Jul 1993 16:10:14 chrish
+CAYMAN EPR 0578: Added logic to handle aborting a backup or restore. The
+small abort box will only be displayed if there does not exist a file to
+display. Otherwise if aborted in the middle of a file one will get the
+large abort box.
+
+ Rev 1.92 09 Jul 1993 16:47:56 TIMN
+Added Abort dialog help. Need helpids.h also. Fixes EPR(357-0419)
+
+ Rev 1.91 03 Jun 1993 13:16:30 chrish
+CAYMAN fix for canceling of a restore to continue processing.
+
+ Rev 1.90 25 May 1993 14:18:46 chrish
+For CAYMAN - Added new backup/restore abort dialog box.
+
+ Rev 1.89 24 May 1993 15:28:12 CARLS
+
+ Rev 1.88 24 May 1993 12:34:10 chrish
+For Nostradamus and Cayman:
+Cleaned up some logic for JOB_STATUS_ABORT_CHECK switch condition. Also
+modified LargeFileAbort to check to see if operation came from an
+OPERATION_BACKUP or OPERATION_RESTORE operation.
+
+ Rev 1.87 22 May 1993 14:23:58 MIKEP
+fix cataloging abort bug. nostradamus should get this.
+
+ Rev 1.86 18 May 1993 20:04:40 GLENN
+Added INI file name root to the Runtime TITLE bar.
+
+ Rev 1.85 11 May 1993 13:22:30 GLENN
+Added JS_OkToClose() to indicate that the RTD can be closed (operation completed) Removed SC_CLOSE stuff.
+
+ Rev 1.84 29 Apr 1993 11:08:32 CARLS
+fixed runtime status display - screen saver problem
+
+ Rev 1.83 27 Apr 1993 19:30:10 GLENN
+Fixed the tension dialog from calling MultiTask after the DestroyWindow-this fixed EPR that hung the app.
+
+ Rev 1.82 24 Apr 1993 14:51:04 DARRYLP
+Added trap for Alt-F4, allowing us to abort a runtime operation by simulating
+an abort.
+
+ Rev 1.81 22 Apr 1993 13:36:36 chrish
+Nostradamous fix: EPR 0116 - Fixes a problem when the user presses the abort
+button during a backup. The elapse time continue will noe suspend while
+waiting for the user to continue or abort.
+
+ Rev 1.80 21 Apr 1993 17:20:42 GLENN
+Displaying Ready on the status line when the OK button is enabled.
+
+ Rev 1.79 19 Apr 1993 13:36:00 CARLS
+removed warnings
+
+ Rev 1.78 19 Apr 1993 10:26:40 CARLS
+added new line to lprintf's in JS_ReportStreamError routine
+
+ Rev 1.77 13 Apr 1993 16:36:46 GLENN
+Fixed ALT-F4 problem during ERASE. Fixed problem with tape name not displayed.
+
+ Rev 1.76 18 Mar 1993 11:13:22 chrish
+Changed MAX_DISPLAY_PATH_LENGTH to 30
+
+ Rev 1.75 17 Mar 1993 14:31:34 DARRYLP
+Properly fixed the previous bitmap problem - This time I covered the
+correct bitmap.
+
+ Rev 1.74 15 Mar 1993 16:36:04 DARRYLP
+Commented out source bitmap "stuff" for MikeP
+
+ Rev 1.73 12 Mar 1993 09:41:24 MIKEP
+fix bitmap being displayed
+
+ Rev 1.72 11 Mar 1993 15:57:16 chrish
+Addeded code to routine NormalFileAbort such during an abort of a backup or a
+restore when there a multiple set, does not go through all the sets before
+aborting.
+
+ Rev 1.71 09 Mar 1993 11:53:52 STEVEN
+fix bug where we except if no rights to set ACL for DIR
+
+ Rev 1.70 04 Mar 1993 11:10:54 CHUCKB
+When a button gets enabled, make it a default button.
+
+ Rev 1.69 02 Mar 1993 16:45:02 ROBG
+Added *.CMD files to be displayed as executables for WIN32 apps.
+
+ Rev 1.68 18 Feb 1993 11:55:34 BURT
+Changes for Cayman (WIN32)
+
+
+ Rev 1.67 09 Feb 1993 09:33:36 chrish
+1. Moved backup/restore strings to resource strings.
+2. Added stuff for restore abort.
+3. Added back stuff for backup abort ... this was previously put in but don't
+ know if someone forgot to merge back in.
+
+ Rev 1.66 01 Feb 1993 19:55:26 STEVEN
+bug fixes
+
+ Rev 1.65 27 Jan 1993 14:23:10 STEVEN
+updates from msoft
+
+ Rev 1.64 18 Jan 1993 14:32:34 GLENN
+Initialized pointers in the Stream Error reporter.
+
+ Rev 1.63 18 Jan 1993 14:25:38 GLENN
+Added Stream Error Reporting stuff.
+
+ Rev 1.62 08 Jan 1993 14:32:24 chrish
+Kludged the SetModelessFocus routine, the IsChild API does not appear to
+be working properly under NT (Bld-349).
+
+ Rev 1.61 06 Jan 1993 10:18:46 GLENN
+Miscellaneous window validations.
+
+ Rev 1.60 04 Jan 1993 13:37:34 GLENN
+Try something new with horiz ext.
+
+ Rev 1.59 23 Dec 1992 15:37:56 GLENN
+Worked on horizontal SB - now using DlgUnits. Added ability to save RTD location.
+
+ Rev 1.58 17 Nov 1992 08:45:18 chrish
+Minor change to aborting a backup on a large file. Size done maybe greater
+than the file size.
+
+ Rev 1.57 11 Nov 1992 16:34:50 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.56 05 Nov 1992 17:20:56 DAVEV
+fix ts
+
+ Rev 1.55 03 Nov 1992 08:27:48 MIKEP
+save otc changes
+
+ Rev 1.54 01 Nov 1992 16:07:02 DAVEV
+Unicode changes
+
+ Rev 1.53 31 Oct 1992 14:56:06 MIKEP
+continue adding small catalog dialog
+
+ Rev 1.52 30 Oct 1992 17:55:56 MIKEP
+started small catalog window
+
+ Rev 1.51 28 Oct 1992 16:44:26 chrish
+Control Break Handling For Backup
+
+ Rev 1.50 07 Oct 1992 13:44:48 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.49 04 Oct 1992 19:40:28 DAVEV
+Unicode Awk pass
+
+ Rev 1.48 02 Oct 1992 16:49:06 GLENN
+Fixed focus change stuff on verify when app is not active.
+
+ Rev 1.47 10 Sep 1992 17:17:44 GLENN
+Fixed bitmap display for BIMINI.
+
+ Rev 1.46 08 Sep 1992 17:29:44 GLENN
+Same as last but added to DM_Tension.
+
+ Rev 1.45 08 Sep 1992 15:42:16 GLENN
+Added MUI_EnableOperations() call in DESTROY message.
+
+ Rev 1.44 19 Aug 1992 14:29:38 CHUCKB
+Added new stuff for NT.
+
+ Rev 1.43 20 Jul 1992 09:59:46 JOHNWT
+gas gauge display work
+
+ Rev 1.42 07 Jul 1992 15:42:06 MIKEP
+unicode changes
+
+ Rev 1.41 19 May 1992 11:58:56 MIKEP
+mips changes
+
+ Rev 1.40 14 May 1992 18:10:18 MIKEP
+nt pass 2
+
+ Rev 1.39 11 May 1992 16:14:40 GLENN
+Added NT changes and a focus fix.
+
+
+*****************************************************/
+
+#include "all.h"
+#include "ctl3d.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define ONEMEG (UINT32) 1048576
+#define LISTBOX_BUFFER_LEN 256
+#define LISTBOX_BUFFER_SIZE ( LISTBOX_BUFFER_LEN + 1 )
+#define LISTBOX_LINE_SIZE 256
+#if defined( OS_WIN32 )
+#define MAX_LISTBOX_INDEX 3000 /* max # of items in Runtime listbox */
+#else
+#define MAX_LISTBOX_INDEX 250 /* max # of items in Runtime listbox */
+#endif
+#define GENERAL_NO_ANSWER -999
+#define TEXT_BOX_BUFSIZE 500
+#define FILE_PATH_BUFSIZE 500
+#define NUMERIC_ASCII_BUFSIZE 64
+#define MAX_DISPLAY_PATH_LENGTH 30
+
+extern WORD RT_BSD_index ;
+extern WORD RT_max_BSD_index ;
+#ifdef OEM_EMS
+extern INT32 RT_BSD_OsId ;
+#endif
+
+/* PRIVATE FUNCTION PROTOTYPES */
+
+static INT NormalFileAbort( VOID );
+#ifdef OEM_MSOFT
+ static VOID LargeFileAbort( VOID );
+#else
+ static INT AlternateLargeFileAbort( VOID );
+#endif
+static VOID ListBoxText( LPSTR ) ;
+static VOID SetModelessFocus( WORD );
+static VOID SetTotalBytes( VOID );
+
+/* PRIVATE VARIABLES */
+
+static BOOL mwfSavePos;
+static BOOL mwfOkToClose = FALSE;
+static WORD wIdFile ;
+static WORD wIdFileSave ;
+static WORD wIdDestination ;
+static WORD wIdSource ;
+static WORD wIdBitmapReverseFlag ;
+static HMENU hMenu ;
+static CHAR_PTR abort_flag_ptr ;
+static WORD dialog_status ;
+static WORD wMaxLength ;
+static LONG listbox_index = 4 ;
+static WORD mwActiveListBoxID ;
+static CHAR mwRuntimeAbortFlag ;
+static CHAR mwRuntimeCloseFlag ;
+static UINT64 mwTotalBytes;
+static HWND mwhWndStatus;
+static UINT64 mwLastByteCnt;
+static STATS_PTR op_stats;
+
+#ifdef OEM_EMS
+static DLG_CTRL_ENTRY DefaultCtrlTable[] = {
+ { IDD_JS_DP, 0, CM_ENABLE },
+ { IDD_JS_DP_LABEL, 0, CM_ENABLE },
+ { IDD_JS_FP, 0, CM_ENABLE },
+ { IDD_JS_FP_LABEL, 0, CM_ENABLE },
+ { IDD_JS_BP, 0, CM_ENABLE },
+ { IDD_JS_BP_LABEL, 0, CM_ENABLE },
+ { IDD_JS_ET, 0, CM_ENABLE },
+ { IDD_JS_ET_LABEL, 0, CM_ENABLE },
+ { IDD_JS_CF, 0, CM_ENABLE },
+ { IDD_JS_CF_LABEL, 0, CM_ENABLE },
+ { IDD_JS_SF, 0, CM_ENABLE },
+ { IDD_JS_SF_LABEL, 0, CM_ENABLE }
+};
+
+static DLG_CTRL_ENTRY EMSCtrlTable[] = {
+ { IDD_JS_DP, 0, CM_HIDE },
+ { IDD_JS_DP_LABEL, 0, CM_DISABLE },
+ { IDD_JS_FP, 0, CM_HIDE },
+ { IDD_JS_FP_LABEL, 0, CM_DISABLE },
+ { IDD_JS_BP, 0, CM_ENABLE },
+ { IDD_JS_BP_LABEL, 0, CM_ENABLE },
+ { IDD_JS_ET, 0, CM_ENABLE },
+ { IDD_JS_ET_LABEL, 0, CM_ENABLE },
+ { IDD_JS_CF, 0, CM_HIDE },
+ { IDD_JS_CF_LABEL, 0, CM_DISABLE },
+ { IDD_JS_SF, 0, CM_HIDE },
+ { IDD_JS_SF_LABEL, 0, CM_DISABLE }
+};
+
+// FS_UNKNOWN_OS must be last w/ no other iDispType == FS_UNKNOWN_OS (or its value).
+static DLG_DISPLAY_ENTRY RuntimeDispTable[] = {
+ { FS_EMS_MDB_ID, EMSCtrlTable,
+ sizeof(EMSCtrlTable)/sizeof(EMSCtrlTable[0]), HELPID_DIALOGRUNTIME },
+ { FS_EMS_DSA_ID, EMSCtrlTable,
+ sizeof(EMSCtrlTable)/sizeof(EMSCtrlTable[0]), HELPID_DIALOGRUNTIME },
+ { FS_UNKNOWN_OS, DefaultCtrlTable,
+ sizeof(DefaultCtrlTable)/sizeof(DefaultCtrlTable[0]), HELPID_DIALOGRUNTIME }
+};
+
+static DLG_MODE ModeTable[] = {
+ { 0, RuntimeDispTable,
+ sizeof(RuntimeDispTable)/sizeof(RuntimeDispTable[0]), &(RuntimeDispTable[2]) },
+};
+
+static UINT16 cModeTblSize = sizeof( ModeTable ) / sizeof( ModeTable[0] );
+static DLG_MODE *pCurMode = ModeTable;
+
+#endif
+
+STATS_PTR UI_GetBackupPtrToStatsStructure( );
+
+// Keep track of what's displayed.
+
+#define RUNTIME_NONE 0
+#define RUNTIME_SMALL 1
+#define RUNTIME_LARGE 2
+
+static INT mwRuntimeDisplayed = RUNTIME_NONE;
+
+/***************************************************
+
+ Name: DM_Runtime()
+
+ Description:
+
+ Modified:
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_Runtime (
+
+HWND hDlg, /* window handle of the dialog box */
+MSGID msg, /* type of message */
+MP1 mp1, /* message-specific information */
+MP2 mp2 )
+
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+ HDC hDCBitmap;
+ HWND hWnd;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( msg ) {
+
+ case WM_INITDIALOG: /* message: initialize dialog box */
+ {
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ // Let's go 3-D!!
+ Ctl3dSubclassDlgEx( hDlg, CTL3D_ALL );
+
+#ifdef OEM_EMS
+ pCurMode = DM_InitCtrlTables( hDlg, ModeTable, cModeTblSize, 0 );
+ DM_DispShowControls( hDlg, pCurMode, FS_UNKNOWN_OS );
+#endif
+ // Place the dialog in the place saved relative to the
+ // frame window.
+
+ if ( ( ! IsIconic ( ghWndFrame ) ) && CDS_GetRuntimeSize ( pCDS ) != WM_DEFAULT ) {
+
+ RECT rcOldFrame;
+ INT x;
+ INT y;
+
+ GetWindowRect ( ghWndFrame, &rcOldFrame );
+
+ // Move the runtime window to the last position that it was
+ // relative to the frame window.
+
+ x = rcOldFrame.left + CDS_GetRuntimeInfo ( pCDS ).x;
+ y = rcOldFrame.top + CDS_GetRuntimeInfo ( pCDS ).y;
+
+ SetWindowPos ( hDlg,
+ (HWND)NULL,
+ x,
+ y,
+ 0,
+ 0,
+ ( SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE )
+ );
+
+ }
+ else {
+
+ DM_CenterDialog( hDlg );
+ }
+
+ EnableWindow ( GetDlgItem ( hDlg, IDD_JS_OK ), FALSE ) ;
+ EnableWindow ( GetDlgItem ( hDlg, IDD_JS_ABORT ), FALSE ) ;
+
+ // mwhWndStatus = GetDlgItem( hDlg, IDD_STATUS_BAR );
+
+ mwLastByteCnt = U64_Init( 0L, 0L );
+ mwTotalBytes = U64_Init( 0L, 0L );
+
+ mwfSavePos = FALSE;
+ mwfOkToClose = FALSE;
+
+ return FALSE;
+ }
+
+ case WM_MOVE:
+
+ if ( ! IsIconic ( ghWndFrame ) ) {
+
+ RECT rcIntersect;
+ RECT rcDesktop;
+ RECT rcRuntime;
+
+ GetWindowRect ( GetDesktopWindow(), &rcDesktop );
+ GetWindowRect ( hDlg, &rcRuntime );
+
+ if ( ! IntersectRect ( &rcIntersect, &rcDesktop, &rcRuntime ) ) {
+ DM_CenterDialog( hDlg );
+ }
+
+ mwfSavePos = TRUE;
+ }
+
+ break;
+
+ case WM_PAINT:
+
+ /* After removing the screen saver, parts of the runtime display
+ were not refreshed. This call invalidates the window and
+ causes the window to be repainted */
+ InvalidateRect( hDlg, NULL, FALSE ) ;
+
+ hDC = BeginPaint( hDlg, &ps );
+ EndPaint( hDlg, &ps );
+ UpdateWindow( hDlg );
+
+ /* source bitmap */
+
+ if ( wIdSource ) {
+ if ( mwRuntimeDisplayed == RUNTIME_LARGE ) {
+ hWnd = GetDlgItem( hDlg, IDD_JS_SOURCE_DRIVE );
+ hDCBitmap = GetDC( hWnd );
+ RSM_BitmapDraw( (WORD)(wIdSource + BTNFACE_BACKGND), 0, 0, 0, 0, hDCBitmap );
+ ReleaseDC( hWnd, hDCBitmap );
+ }
+ }
+
+ if ( mwRuntimeDisplayed == RUNTIME_LARGE ) {
+ /* destination bitmap */
+
+#ifndef OEM_MSOFT
+ if ( wIdDestination ) {
+ hWnd = GetDlgItem( hDlg, IDD_JS_DEST_DRIVE );
+ hDCBitmap = GetDC( hWnd );
+ RSM_BitmapDraw( wIdDestination, 0, 0, 0, 0, hDCBitmap );
+ ReleaseDC( hWnd, hDCBitmap );
+ }
+#endif
+ /* arrow bitmap */
+ // hWnd = GetDlgItem( hDlg, IDD_JS_ARROW );
+ // hDCBitmap = GetDC( hWnd );
+ // RSM_BitmapDraw( IDRBM_RT_ARROW + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ // ReleaseDC( hWnd, hDCBitmap );
+
+ hWnd = GetDlgItem( hDlg, IDD_JS_FOLDER );
+ hDCBitmap = GetDC( hWnd );
+ RSM_BitmapDraw( IDRBM_BLANK16x16 + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+#ifdef OEM_EMS
+ switch ( RT_BSD_OsId ) {
+
+ case FS_EMS_MDB_ID:
+ RSM_BitmapDraw( IDRBM_EMS_MDB + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ wIdFile= 0 ;
+ break;
+ case FS_EMS_DSA_ID:
+ RSM_BitmapDraw( IDRBM_EMS_DSA + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ wIdFile= 0 ;
+ break;
+ default:
+ RSM_BitmapDraw( IDRBM_FOLDER + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ break;
+ }
+#else
+ RSM_BitmapDraw( IDRBM_FOLDER + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+#endif
+ ReleaseDC( hWnd, hDCBitmap );
+
+ if ( wIdFile ) {
+
+ hWnd = GetDlgItem( hDlg, IDD_JS_FILE );
+ hDCBitmap = GetDC( hWnd );
+ RSM_BitmapDraw( IDRBM_BLANK16x16 + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ RSM_BitmapDraw( (WORD)(wIdFile + BTNFACE_BACKGND), 0, 0, 0, 0, hDCBitmap );
+ ReleaseDC( hWnd, hDCBitmap );
+ }
+
+ JobStatusStats( mwLastByteCnt );
+ }
+
+ return TRUE;
+
+ case WM_COMMAND:
+
+ switch ( GET_WM_COMMAND_ID ( mp1, mp2 ) ) {
+
+ case IDOK:
+ case IDD_JS_OK:
+
+ // If the OK button is enabled, kill off the dialog.
+
+ if ( IsWindowEnabled ( GetDlgItem ( hDlg, IDD_JS_OK ) ) ) {
+ DestroyWindow ( hDlg );
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ }
+
+ return TRUE;
+
+ case IDCANCEL:
+ case IDD_JS_ABORT:
+
+ // Only allow an ABORT when the ABORT button is enable
+ // or the OK button is enabled
+ // If the ABORT button is enabled, then pop up the message
+ // box.
+
+ if ( IsWindowEnabled ( GetDlgItem( hDlg, IDD_JS_ABORT ) ) ) {
+ mwRuntimeAbortFlag = TRUE ;
+ EnableWindow( GetDlgItem( hDlg, IDD_JS_ABORT ), FALSE );
+ }
+ else if ( IsWindowEnabled ( GetDlgItem( hDlg, IDD_JS_OK ) ) ) {
+ DestroyWindow( hDlg ) ;
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ }
+
+ return TRUE;
+
+ case IDHELP:
+ case IDD_JS_HELP:
+
+ HM_DialogHelp( HELPID_DIALOGRUNTIME );
+ return TRUE;
+
+ } /* end switch() */
+
+ break;
+
+ case WM_CLOSE:
+
+ if ( IsWindowEnabled ( GetDlgItem ( hDlg, IDD_JS_OK ) ) ) {
+ DestroyWindow ( hDlg );
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ }
+ else {
+ mwRuntimeAbortFlag = TRUE ;
+ mwRuntimeCloseFlag = TRUE;
+ SendMessage ( hDlg, (MSGID)WM_COMMAND, (MPARAM1)IDCANCEL, (MPARAM2)NULL );
+ }
+
+ return TRUE;
+
+ case WM_DESTROY:
+
+ if ( ghModelessDialog ) {
+
+ if ( mwfSavePos ) {
+
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ CDS_WriteRuntimeWinSize ( ghModelessDialog );
+ CDS_ReadRuntimeWinSize ( pCDS );
+ mwfSavePos = FALSE;
+ }
+
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ ghModelessDialog = (HWND)NULL ;
+
+ MUI_EnableOperations ( (WORD)NULL );
+
+ return FALSE;
+ }
+ else {
+ return TRUE;
+ }
+
+ } /* end switch() */
+
+ return FALSE;
+}
+
+
+/***************************************************
+
+ Name: JobStatusStats()
+
+ Description:
+
+ Returns:
+
+*****************************************************/
+VOID JobStatusStats (
+
+UINT64 NumBytes )
+
+{
+#ifndef OEM_MSOFT
+
+ HDC hDC;
+ HBRUSH hBrush;
+ RECT rect;
+ UINT32 divisor;
+ INT width;
+ CHAR szPercent[5];
+ INT BkModeOld;
+ INT x,y;
+ INT AmtDone;
+#if !defined( WIN32 )
+ DWORD dwExtent;
+#endif
+#if defined ( WIN32 )
+ SIZE tSize ;
+#endif
+
+ mwLastByteCnt = NumBytes;
+
+ if ( ( !U64_EQ(mwTotalBytes, U64_Init( 0L, 0L )) ) &&
+ ( !U64_EQ(NumBytes, U64_Init( 0L, 0L )) ) ) {
+
+ GetClientRect( mwhWndStatus, &rect );
+ divisor = mwTotalBytes.lsw / ((UINT32) rect.right);
+ width = rect.right;
+ rect.right = (INT) ( NumBytes.lsw / divisor );
+
+ hDC = GetDC( mwhWndStatus );
+
+ divisor = mwTotalBytes.lsw / ((UINT32) 100);
+ AmtDone = (INT) ( NumBytes.lsw / divisor );
+ sprintf (szPercent, TEXT("%d%%"), AmtDone);
+#if !defined( WIN32 )
+ dwExtent = GetTextExtent (hDC, szPercent, strlen(szPercent));
+ x = ( width - LOWORD(dwExtent) ) / 2;
+ y = ( rect.bottom - HIWORD(dwExtent) ) / 2;
+#else
+ GetTextExtentPoint ( hDC, szPercent, strlen(szPercent), &tSize );
+ x = ( width - tSize.cx ) / 2;
+ y = ( rect.bottom - tSize.cy ) / 2;
+
+#endif
+
+ // kludge to erase the background
+ if ( rect.right < x+25 ) {
+ TextOut (hDC, x, y, TEXT(" "), 6);
+ }
+
+ BkModeOld = SetBkMode (hDC, TRANSPARENT);
+
+ hBrush = SelectObject( hDC, ghBrushGray );
+
+ Rectangle( hDC, rect.left,
+ rect.top,
+ rect.right,
+ rect.bottom );
+
+ TextOut (hDC, x, y, szPercent, strlen(szPercent));
+
+ SetBkMode (hDC, BkModeOld);
+ SelectObject( hDC, hBrush );
+ ReleaseDC( mwhWndStatus, hDC );
+
+ }
+
+#endif
+
+ return;
+}
+
+
+
+/***************************************************
+
+ Name: JobStatusBackupRestore()
+
+ Description:
+
+ Modified:
+
+ Returns:
+
+*****************************************************/
+
+VOID JobStatusBackupRestore (
+
+WORD control_function ) /* I - control function number */
+
+{
+ HWND hWnd ;
+ HDC hDCBitmap ;
+
+ switch( control_function ) {
+
+ case JOB_STATUS_N_OF_N:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ /* catalog a tape will not know the max number of backup sets on */
+ /* the tape, so don't display "N of N" */
+
+ /* for each new backup set clear the runtime display status fields */
+ if ( RT_max_BSD_index ) {
+
+ #ifndef OEM_MSOFT
+ {
+ CHAR buffer1[ LISTBOX_BUFFER_SIZE ] ;
+ CHAR buffer2[ LISTBOX_BUFFER_SIZE ] ;
+
+ /* display the N of N count */
+ RSM_StringCopy( IDS_SET_INFORMATION, buffer1, 80) ;
+ wsprintf( buffer2, buffer1, RT_BSD_index, RT_max_BSD_index ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_N_OF_N, buffer2 ) ;
+ }
+ #endif
+
+ /* clear the all the counter fields between sets */
+ yprintf( TEXT("0\r") ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_FP, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_BP, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_DP, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_SF, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_CF, gszTprintfBuffer ) ;
+
+ /* clear the elapsed time field */
+ yprintf( TEXT("00%c00\r"), UI_GetTimeSeparator() ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_ET, gszTprintfBuffer ) ;
+
+ /* clear the directory & file name fields */
+ yprintf( TEXT(" \r") ) ;
+// SetDlgItemText( ghModelessDialog, IDD_JS_FILE, gszTprintfBuffer ) ;
+// SetDlgItemText( ghModelessDialog, IDD_JS_FOLDER, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_LINE1, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_LINE2, gszTprintfBuffer ) ;
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_FOLDER ) ;
+ hDCBitmap = GetDC( hWnd );
+ RSM_BitmapDraw( IDRBM_BLANK16x16 + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+
+ ReleaseDC( hWnd, hDCBitmap );
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_FILE ) ;
+
+ hDCBitmap = GetDC( hWnd ) ;
+ RSM_BitmapDraw( IDRBM_BLANK16x16 + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+
+ ReleaseDC ( hWnd, hDCBitmap ) ;
+
+ }
+ break ;
+
+ case JOB_STATUS_DIRECTORY_NAMES:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ DisplayDirectory( ghModelessDialog, gszTprintfBuffer, IDD_JS_LINE1 ) ;
+ wIdFileSave = FALSE ;
+
+// SetDlgItemText ( ghModelessDialog, IDD_JS_FILE, TEXT(" \r") ) ;
+ SetDlgItemText ( ghModelessDialog, IDD_JS_LINE2, TEXT(" \r") ) ;
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_FOLDER ) ;
+ hDCBitmap = GetDC( hWnd );
+ RSM_BitmapDraw( IDRBM_BLANK16x16 + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+
+ switch ( RT_BSD_OsId ) {
+
+ case FS_EMS_MDB_ID:
+ RSM_BitmapDraw( IDRBM_EMS_MDB + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ break;
+ case FS_EMS_DSA_ID:
+ RSM_BitmapDraw( IDRBM_EMS_DSA + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ break;
+ default:
+ RSM_BitmapDraw( IDRBM_FOLDER + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+ break;
+ }
+ ReleaseDC( hWnd, hDCBitmap );
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_FILE ) ;
+
+ hDCBitmap = GetDC( hWnd ) ;
+ RSM_BitmapDraw( IDRBM_BLANK16x16 + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap );
+
+ ReleaseDC ( hWnd, hDCBitmap ) ;
+
+ break ;
+
+ case JOB_STATUS_ELAPSED_TIME:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetDlgItemText( ghModelessDialog, IDD_JS_ET, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_FILES_PROCESSED:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetDlgItemText( ghModelessDialog, IDD_JS_FP, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_BYTES_PROCESSED:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetDlgItemText( ghModelessDialog, IDD_JS_BP, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_SOURCE_NAME:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ /* display the source name */
+ SetDlgItemText( ghModelessDialog, IDD_JS_SOURCE_NAME, gszTprintfBuffer ) ;
+
+ /* for each new backup set clear the runtime display status fields */
+ JobStatusBackupRestore( JOB_STATUS_N_OF_N ) ;
+
+ /* increment the N of N counter */
+ RT_BSD_index++ ;
+
+ break ;
+
+ case JOB_STATUS_DEST_NAME:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ /* display the destination name */
+ SetDlgItemText( ghModelessDialog, IDD_JS_DEST_NAME, gszTprintfBuffer ) ;
+
+ break ;
+#ifdef OEM_EMS
+ case JOB_STATUS_FS_TYPE:
+
+ DM_DispShowControls( ghModelessDialog, pCurMode, RT_BSD_OsId );
+
+ break;
+#endif
+ case JOB_STATUS_VOLUME_HARDDRIVE:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ if ( wIdBitmapReverseFlag ) {
+ wIdSource = IDRBM_LTAPE;
+ }
+ else {
+ wIdSource = IDRBM_HARDDRIVE;
+ }
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_SOURCE_DRIVE ) ;
+ hDCBitmap = GetDC( hWnd ) ;
+ RSM_BitmapDraw( (WORD)(wIdSource + BTNFACE_BACKGND), 0, 0, 0, 0, hDCBitmap ) ;
+ ReleaseDC( hWnd, hDCBitmap ) ;
+
+ if ( wIdBitmapReverseFlag ) {
+ wIdDestination = IDRBM_HARDDRIVE ;
+ }
+ else {
+ wIdDestination = IDRBM_LTAPE ;
+ }
+
+ #ifndef OEM_MSOFT
+ {
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_DEST_DRIVE ) ;
+ hDCBitmap = GetDC( hWnd ) ;
+ RSM_BitmapDraw( wIdDestination + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap ) ;
+ ReleaseDC( hWnd, hDCBitmap ) ;
+
+ // hWnd = GetDlgItem( ghModelessDialog, IDD_JS_ARROW ) ;
+ // hDCBitmap = GetDC( hWnd ) ;
+ // RSM_BitmapDraw( IDRBM_RT_ARROW, 0, 0, 0, 0, hDCBitmap ) ;
+ // ReleaseDC( hWnd, hDCBitmap ) ;
+ }
+ #endif
+
+ break ;
+
+ case JOB_STATUS_VOLUME_NETDRIVE:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ if ( wIdBitmapReverseFlag ) {
+ wIdSource = IDRBM_LTAPE;
+ }
+ else {
+ wIdSource = IDRBM_NETDRIVE;
+ }
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_SOURCE_DRIVE ) ;
+ hDCBitmap = GetDC( hWnd ) ;
+
+ RSM_BitmapDraw( (WORD)(wIdSource + BTNFACE_BACKGND), 0, 0, 0, 0, hDCBitmap ) ;
+ ReleaseDC( hWnd, hDCBitmap ) ;
+
+ if ( wIdBitmapReverseFlag ) {
+ wIdDestination = IDRBM_NETDRIVE ;
+ }
+ else {
+ wIdDestination = IDRBM_LTAPE ;
+ }
+
+ #ifndef OEM_MSOFT
+ {
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_DEST_DRIVE ) ;
+ hDCBitmap = GetDC( hWnd ) ;
+ RSM_BitmapDraw( wIdDestination + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap ) ;
+ ReleaseDC( hWnd, hDCBitmap ) ;
+
+ // hWnd = GetDlgItem( ghModelessDialog, IDD_JS_ARROW ) ;
+ // hDCBitmap = GetDC( hWnd ) ;
+ // RSM_BitmapDraw( IDRBM_RT_ARROW, 0, 0, 0, 0, hDCBitmap ) ;
+ // ReleaseDC( hWnd, hDCBitmap ) ;
+ }
+ #endif
+
+
+ break ;
+
+ case JOB_STATUS_VOLUME_TAPE:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ wIdSource = IDRBM_LTAPE;
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_SOURCE_DRIVE ) ;
+ hDCBitmap = GetDC( hWnd ) ;
+
+ RSM_BitmapDraw( (WORD)(wIdSource + BTNFACE_BACKGND), 0, 0, 0, 0, hDCBitmap ) ;
+ ReleaseDC( hWnd, hDCBitmap ) ;
+
+ #ifndef OEM_MSOFT
+ {
+ wIdDestination = IDRBM_HARDDRIVE ;
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_DEST_DRIVE ) ;
+ hDCBitmap = GetDC( hWnd ) ;
+ RSM_BitmapDraw( wIdDestination + BTNFACE_BACKGND, 0, 0, 0, 0, hDCBitmap ) ;
+ ReleaseDC( hWnd, hDCBitmap ) ;
+
+ // hWnd = GetDlgItem( ghModelessDialog, IDD_JS_ARROW ) ;
+ // hDCBitmap = GetDC( hWnd ) ;
+ // RSM_BitmapDraw( IDRBM_RT_ARROW, 0, 0, 0, 0, hDCBitmap ) ;
+ // ReleaseDC( hWnd, hDCBitmap ) ;
+ }
+ #endif
+
+ break ;
+
+ case JOB_STATUS_EXCEPTION_WINDOW:
+
+ if ( mwRuntimeDisplayed != RUNTIME_NONE ) break;
+ SetDlgItemText( ghModelessDialog, IDD_JS_LISTBOX, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_DIRECTORIES_PROCESS:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetDlgItemText( ghModelessDialog, IDD_JS_DP, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_SKIPPED_FILES:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetDlgItemText( ghModelessDialog, IDD_JS_SF, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_CORRUPT_FILES:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetDlgItemText( ghModelessDialog, IDD_JS_CF, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_FILE_NAMES:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ if ( strstr ( gszTprintfBuffer, TEXT(".COM") ) ) {
+ wIdFile = IDRBM_EXE ;
+ }
+ else if ( strstr ( gszTprintfBuffer, TEXT(".EXE") ) ) {
+ wIdFile = IDRBM_EXE ;
+ }
+
+#if defined ( WIN32 )
+
+ else if ( strstr ( gszTprintfBuffer, TEXT(".CMD") ) ) {
+ wIdFile = IDRBM_EXE ;
+ }
+#endif
+
+ else {
+ wIdFile = IDRBM_FILE ;
+ }
+
+ /* only draw the bitmap if it has changed */
+ if( wIdFile != wIdFileSave ) {
+
+ hWnd = GetDlgItem( ghModelessDialog, IDD_JS_FILE ) ;
+
+ hDCBitmap = GetDC( hWnd ) ;
+
+ RSM_BitmapDraw ( (WORD)(wIdFile + BTNFACE_BACKGND), 0, 0, 0, 0, hDCBitmap ) ;
+
+ ReleaseDC ( hWnd, hDCBitmap ) ;
+ }
+
+ wIdFileSave = wIdFile ;
+
+ strlwr ( gszTprintfBuffer ) ;
+ SetDlgItemText ( ghModelessDialog, IDD_JS_LINE2, gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_LISTBOX:
+
+ if ( mwRuntimeDisplayed == RUNTIME_NONE ) break;
+ ListBoxText( gszTprintfBuffer ) ;
+ break ;
+
+ case JOB_STATUS_ABORT:
+
+ if ( mwRuntimeDisplayed == RUNTIME_NONE ) break;
+ *abort_flag_ptr = (CHAR)ABORT_PROCESSED ;
+ break ;
+
+ case JOB_STATUS_ABORT_OFF:
+
+ if ( mwRuntimeDisplayed == RUNTIME_NONE ) break;
+ WM_SetAppIcon ( RSM_IconLoad ( IDRI_DONE ) );
+
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_OK ), TRUE );
+ SetModelessFocus ( IDD_JS_OK );
+ EnableMenuItem ( hMenu, SC_CLOSE, MF_ENABLED );
+
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_ABORT ), FALSE );
+
+ STM_SetIdleText ( IDS_READY );
+ mwfOkToClose = TRUE;
+
+ // If the Yes Flag is set, don't wait for the OK, kill off the
+ // window. Also if this was a WM_CLOSE, kill the window.
+
+ if ( ( CDS_GetYesFlag ( CDS_GetCopy () ) == YESYES_FLAG ) || mwRuntimeCloseFlag ) {
+
+ JobStatusBackupRestore( JOB_STATUS_DESTROY_DIALOG );
+ }
+
+ break ;
+
+ case JOB_STATUS_ABORT_ON:
+ case JOB_STATUS_ABORT_ENABLE:
+
+ if ( mwRuntimeDisplayed == RUNTIME_NONE ) break;
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_ABORT ), TRUE ) ;
+ SetModelessFocus( IDD_JS_ABORT ) ;
+ EnableMenuItem( hMenu, SC_CLOSE, MF_ENABLED ) ;
+ break ;
+
+ case JOB_STATUS_ABORT_DISABLE:
+
+ /* if abort button enabled - disable it */
+
+ if ( mwRuntimeDisplayed == RUNTIME_NONE ) break;
+
+ if ( IsWindowEnabled ( GetDlgItem ( ghModelessDialog, IDD_JS_ABORT ) ) ) {
+ SetModelessFocus ( IDD_JS_HELP );
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_ABORT ), FALSE ) ;
+ EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
+ }
+
+ break ;
+
+ case JOB_STATUS_ABORT_CHECK:
+
+ if ( mwRuntimeAbortFlag ) {
+
+ if ( gbCurrentOperation == OPERATION_BACKUP ) {
+ op_stats = UI_GetBackupPtrToStatsStructure( );
+ ST_StartBackupSetIdle( op_stats );
+ }
+
+#ifdef OEM_MSOFT
+ if ( NormalFileAbort() == WMMB_IDYES ) {
+ LargeFileAbort();
+ }
+#else
+ if ( !AlternateLargeFileAbort() ) {
+ NormalFileAbort();
+ }
+#endif
+
+ if ( gbCurrentOperation == OPERATION_BACKUP ) {
+ ST_EndBackupSetIdle( op_stats );
+ }
+ }
+
+ break;
+
+ case JOB_STATUS_CREATE_DIALOG:
+
+ // if ( mwRuntimeDisplayed != RUNTIME_NONE ) break;
+
+ /* if the runtime dialog is displayed already, don't try to create it */
+ if ( ! ghModelessDialog ) {
+
+ mwRuntimeDisplayed = RUNTIME_LARGE;
+
+ DM_ShowDialog ( ghWndFrame, IDD_RUNTIME, NULL ) ;
+
+ SetWindowText( ghModelessDialog, TEXT(" ") ) ;
+
+ /* Show the dialog window like the frame window is shown. */
+
+ if ( IsIconic ( ghWndFrame ) ) {
+ ShowWindow ( ghModelessDialog, SW_HIDE ) ;
+ }
+ else {
+ ShowWindow ( ghModelessDialog, SW_SHOWNORMAL ) ;
+ }
+
+ hMenu = GetSystemMenu( ghModelessDialog, FALSE ) ;
+ EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
+
+ wIdFile = 0 ;
+
+ /* reset the HARD DRIVE as the default bitmap */
+
+ wIdSource = 0 ;
+ wIdDestination = 0 ;
+
+ // wIdSource = IDRBM_HARDDRIVE ;
+ // wIdDestination = IDRBM_LTAPE ;
+
+ UpdateWindow( ghModelessDialog ) ;
+
+ hMenu = GetSystemMenu( ghModelessDialog, FALSE ) ;
+ EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
+
+ /* clear the elapsed time field */
+ yprintf( TEXT("00%c00\r"), UI_GetTimeSeparator() ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_ET, gszTprintfBuffer ) ;
+
+ wMaxLength = 1 ;
+ listbox_index = 4 ;
+
+ /* set the ID for the Runtime status listbox */
+ mwActiveListBoxID = IDD_JS_LISTBOX ;
+ }
+
+ // set the statistics totals
+ mwLastByteCnt = U64_Init( 0L, 0L );
+ mwTotalBytes = U64_Init( 0L, 0L );
+ if ( CDS_GetEnableStatsFlag ( CDS_GetPerm () ) ) {
+ SetTotalBytes();
+ }
+
+ /* disable the ABORT button until the abort flag pointer has been set */
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_ABORT ), FALSE ) ;
+
+ /* disable the OK button */
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_OK ), FALSE ) ;
+
+ /* disable the system menu close */
+ EnableMenuItem ( hMenu, SC_CLOSE, MF_GRAYED );
+
+ /* give the listbox the focus */
+ SetModelessFocus ( IDD_JS_LISTBOX );
+
+ mwRuntimeAbortFlag = FALSE ;
+ mwRuntimeCloseFlag = FALSE ;
+ wIdFileSave = FALSE ;
+
+ break ;
+
+
+ case JOB_STATUS_CREATE_SMALL_DIALOG:
+
+ /* if the runtime dialog is displayed already, don't try to create it */
+
+ if ( mwRuntimeDisplayed != RUNTIME_NONE ) break;
+
+ if ( ! ghModelessDialog ) {
+
+ mwRuntimeDisplayed = RUNTIME_SMALL;
+
+ DM_ShowDialog ( ghWndFrame, IDD_CATALOG, NULL ) ;
+
+ SetWindowText( ghModelessDialog, TEXT(" ") ) ;
+
+ /* Show the dialog window like the frame window is shown. */
+
+ if ( IsIconic ( ghWndFrame ) ) {
+ ShowWindow ( ghModelessDialog, SW_HIDE ) ;
+ }
+ else {
+ ShowWindow ( ghModelessDialog, SW_SHOWNORMAL ) ;
+ }
+
+ hMenu = GetSystemMenu( ghModelessDialog, FALSE ) ;
+ EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
+
+ UpdateWindow( ghModelessDialog ) ;
+
+ hMenu = GetSystemMenu( ghModelessDialog, FALSE ) ;
+ EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
+
+ wMaxLength = 1 ;
+ listbox_index = 4 ;
+
+ /* set the ID for the Runtime status listbox */
+ mwActiveListBoxID = IDD_JS_LISTBOX ;
+ }
+
+ /* disable the ABORT button until the abort flag pointer has been set */
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_ABORT ), FALSE ) ;
+
+ /* disable the OK button */
+ EnableWindow ( GetDlgItem ( ghModelessDialog, IDD_JS_OK ), FALSE ) ;
+
+ /* disable the system menu close */
+ EnableMenuItem ( hMenu, SC_CLOSE, MF_GRAYED );
+
+ /* give the listbox the focus */
+ SetModelessFocus ( IDD_JS_LISTBOX );
+
+ mwRuntimeAbortFlag = FALSE ;
+ mwRuntimeCloseFlag = FALSE ;
+ break ;
+
+
+ case JOB_STATUS_DESTROY_DIALOG:
+
+ if ( mwRuntimeDisplayed != RUNTIME_NONE ) {
+ DestroyWindow ( ghModelessDialog ) ;
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ }
+
+ return;
+
+ case JOB_STATUS_BACKUP_TITLE:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+
+ if ( CDS_UsingCmdLineINI () ) {
+
+ CHAR szTemp[MAX_UI_RESOURCE_SIZE];
+ LPSTR p;
+
+ CDS_GetIniFileName ( szTemp, sizeof ( szTemp ) );
+
+ p = strstr ( szTemp, TEXT(".INI") );
+
+ *p = (CHAR)NULL;
+
+ strcat ( gszTprintfBuffer, TEXT(" - ") );
+ strcat ( gszTprintfBuffer, szTemp );
+ }
+
+ SetWindowText( ghModelessDialog, gszTprintfBuffer ) ;
+
+ RT_BSD_index = 1 ; /* start with set number 1 */
+
+ /* clear the source/destination name fields */
+ yprintf( TEXT(" \r") ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_SOURCE_NAME, gszTprintfBuffer ) ;
+
+ #ifndef OEM_MSOFT
+ {
+ SetDlgItemText( ghModelessDialog, IDD_JS_DEST_NAME, gszTprintfBuffer ) ;
+ }
+ #endif
+
+ wIdBitmapReverseFlag = FALSE ;
+ break ;
+
+ case JOB_STATUS_RESTORE_TITLE:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetWindowText( ghModelessDialog, gszTprintfBuffer ) ;
+ RT_BSD_index = 1 ; /* start with set number 1 */
+ wIdBitmapReverseFlag = TRUE ;
+ break ;
+
+ case JOB_STATUS_CATALOG_TITLE:
+
+ if ( mwRuntimeDisplayed == RUNTIME_NONE ) break;
+ SetWindowText( ghModelessDialog, gszTprintfBuffer ) ;
+ RT_BSD_index = 1 ; /* start with set number 1 */
+ RT_max_BSD_index = 0 ; /* will not know the max BSDs when cataloging */
+ wIdBitmapReverseFlag = TRUE ;
+ break ;
+
+ case JOB_STATUS_VERIFY_TITLE:
+
+ if ( mwRuntimeDisplayed != RUNTIME_LARGE ) break;
+ SetWindowText( ghModelessDialog, gszTprintfBuffer ) ;
+
+ /* clear the source/destination name fields */
+ yprintf( TEXT(" \r") ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_SOURCE_NAME, gszTprintfBuffer ) ;
+
+ #ifndef OEM_MSOFT
+ {
+ SetDlgItemText( ghModelessDialog, IDD_JS_DEST_NAME, gszTprintfBuffer ) ;
+ }
+ #endif
+
+ /* clear the directory & file name fields */
+ SetDlgItemText( ghModelessDialog, IDD_JS_LINE1, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_LINE2, gszTprintfBuffer ) ;
+
+ /* clear the all the counter fields */
+ yprintf( TEXT("0\r") ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_FP, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_BP, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_DP, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_SF, gszTprintfBuffer ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_CF, gszTprintfBuffer ) ;
+
+ /* clear the elapsed time field */
+ yprintf( TEXT("00%c00\r"), UI_GetTimeSeparator() ) ;
+ SetDlgItemText( ghModelessDialog, IDD_JS_ET, gszTprintfBuffer ) ;
+
+ RT_BSD_index = 1 ; /* start with set number 1 */
+
+ wIdBitmapReverseFlag = TRUE ;
+ break ;
+
+ }
+
+ if ( ghModelessDialog ) {
+ UpdateWindow( ghModelessDialog ) ;
+ }
+
+ WM_MultiTask ( ) ;
+}
+
+
+/***************************************************
+
+ Name: LargeFileAbort ()
+
+ Description: Performs the abort process
+ during backup for a file that
+ has > 1MEG bytes left to process
+
+ Modified:
+
+ Returns:
+
+*****************************************************/
+static VOID LargeFileAbort ( VOID )
+{
+
+ INT nAnswer;
+ CHAR fpath[FILE_PATH_BUFSIZE];
+ CHAR buffer1[LISTBOX_BUFFER_SIZE ] ;
+ CHAR AbortText[TEXT_BOX_BUFSIZE];
+ INT largeAbort = 1;
+ INT operation;
+ CHAR AbortFmtStr[MAX_UI_RESOURCE_SIZE];
+ CHAR AbortTitle[81];
+ STATS stats;
+
+ UI_GetCurrentStatus( &operation, &stats, fpath, sizeof( fpath ) - 1 );
+
+ if ( operation == OPERATION_BACKUP || operation == OPERATION_RESTORE ) {
+ // do nothing
+ } else {
+ /* We answered YES to normal abort, so change the abort pointer */
+ /* back to ABORT_PROCESSED - This is for operations catalog, delete, verify */
+ *abort_flag_ptr = (CHAR)ABORT_PROCESSED;
+ return;
+ }
+
+ UI_FixPath( fpath, MAX_DISPLAY_PATH_LENGTH, TEXT('\\') );
+
+ /* reset the abort flag */
+ mwRuntimeAbortFlag = FALSE ;
+
+ // Ask the user if an abort is really what they want.
+
+ if ( operation == OPERATION_BACKUP ) {
+ RSM_StringCopy( RES_BACKUP_ABORT_EOF, AbortFmtStr, MAX_UI_RESOURCE_SIZE );
+ } else {
+ RSM_StringCopy( RES_RESTORE_ABORT_EOF, AbortFmtStr, MAX_UI_RESOURCE_SIZE );
+ }
+
+ RSM_StringCopy( IDS_MSGTITLE_ABORT, AbortTitle, 80 );
+
+ sprintf( AbortText, AbortFmtStr, fpath ) ;
+
+ nAnswer = WM_MessageBox ( AbortTitle,
+ AbortText,
+ WMMB_CONTABORT | WMMB_NOYYCHECK,
+ WMMB_ICONEXCLAMATION,
+ NULL,
+ 0,
+ HELPID_OPERATIONSBACKUP ) ;
+
+ if ( nAnswer == WMMB_IDABORT ) {
+
+ gfAbortInMiddleOfFile = TRUE;
+
+ *abort_flag_ptr = (CHAR)ABORT_PROCESSED;
+
+ // if we are terminating the app, set the YY flag so
+ // we exit out without prompts
+
+ if ( gfTerminateApp ) {
+
+ CDS_SetYesFlag ( CDS_GetCopy (), YESYES_FLAG );
+
+ }
+
+ }
+ else {
+ /* display the abort message in the listbox */
+
+ if ( operation == OPERATION_BACKUP ) {
+ RSM_StringCopy( RES_CONTINUE_BACKUP_ABORT, buffer1, LISTBOX_BUFFER_LEN ) ;
+ lresprintf( LOGGING_FILE ,
+ LOG_MSG ,
+ SES_ENG_MSG ,
+ RES_CONTINUE_BACKUP_ABORT );
+ } else {
+ RSM_StringCopy( RES_CONTINUE_RESTORE_ABORT, buffer1, LISTBOX_BUFFER_LEN ) ;
+ lresprintf( LOGGING_FILE ,
+ LOG_MSG ,
+ SES_ENG_MSG ,
+ RES_CONTINUE_RESTORE_ABORT );
+ }
+
+ ListBoxText( buffer1 ) ;
+
+
+ //
+ // These two lines below tell the backup app. not to chop
+ // off the file when the user aborts the backup or restore
+ // process. Compliments of MikeP.
+ //
+
+ *abort_flag_ptr = CONTINUE_PROCESSING ; // chs
+ UI_AbortAtEndOfFile(); // chs
+
+ //
+ //
+ //
+
+ EnableWindow( GetDlgItem( ghModelessDialog, IDD_JS_ABORT ), FALSE );
+
+ }
+
+}
+
+
+/***************************************************
+
+ Name: NormalAbortFile ()
+
+ Description: Performs the abort process
+ during backup.
+
+ Modified:
+
+ Returns: WMMB_? value
+
+*****************************************************/
+static INT NormalFileAbort ( VOID )
+{
+ CHAR buffer1[ LISTBOX_BUFFER_SIZE ] ;
+ INT nAnswer;
+ STATS stats;
+ CHAR fpath[FILE_PATH_BUFSIZE];
+ // and file name
+
+
+ /* reset the abort flag */
+ mwRuntimeAbortFlag = FALSE ;
+
+ // Ask the user if an abort is really what they want.
+
+ nAnswer = WM_MsgBox ( ID( RES_ABORT_STRING ),
+ ID( RES_ABORT_QUESTION ),
+ WMMB_YESNO | WMMB_NOYYCHECK,
+ WMMB_ICONQUESTION );
+
+ if ( nAnswer == WMMB_IDYES ) {
+
+ *abort_flag_ptr = (CHAR)ABORT_PROCESSED;
+
+ /* display the abort message in the listbox */
+
+ RSM_StringCopy( RES_PROCESS_ABORTED, buffer1, LISTBOX_BUFFER_LEN ) ;
+
+ ListBoxText( buffer1 ) ;
+
+ lresprintf( LOGGING_FILE ,
+ LOG_MSG ,
+ SES_ENG_MSG ,
+ RES_PROCESS_ABORTED );
+
+ *abort_flag_ptr = CONTINUE_PROCESSING ;
+
+ if ( UI_GetBackupCurrentStatus( &stats, fpath, sizeof( fpath ) - 1 ) == SUCCESS ) {
+ // chs:03-11-93
+ //
+ // If current file size is zero then we do not have a file.
+ //
+
+ if ( U64_EQ( ST_GetCFSize( &stats ), U32_To_U64( 0L ) ) ) {
+
+ *abort_flag_ptr = (CHAR)ABORT_PROCESSED;
+ } else {
+
+ UI_AbortAtEndOfFile();
+ }
+
+ } else {
+ *abort_flag_ptr = (CHAR)ABORT_PROCESSED;
+ }
+
+ // if we are terminating the app, set the YY flag so
+ // we exit out without prompts
+
+ if ( gfTerminateApp ) {
+
+ CDS_SetYesFlag ( CDS_GetCopy (), YESYES_FLAG );
+
+ }
+
+ }
+ else { /* don't abort */
+
+ gfTerminateApp = FALSE;
+ EnableWindow( GetDlgItem( ghModelessDialog, IDD_JS_ABORT ), TRUE );
+ SetModelessFocus ( IDD_JS_ABORT );
+ mwRuntimeCloseFlag = FALSE ;
+
+ }
+
+ return( nAnswer );
+}
+
+/***************************************************
+
+ Name: JobStatusAbort( )
+
+ Description:
+
+ Modified:
+
+ Returns: Void
+
+*****************************************************/
+
+VOID JobStatusAbort( VOID *p )
+{
+ abort_flag_ptr = (CHAR *)p ;
+}
+
+
+/***************************************************
+
+ Name: JS_OkToClose ( )
+
+ Description:
+
+ Modified:
+
+ Returns: TRUE, if OK to close, otherwise FALSE.
+
+*****************************************************/
+
+BOOL JS_OkToClose ( VOID )
+{
+ return mwfOkToClose;
+}
+
+
+/***************************************************
+
+ Name: ListBoxText( )
+
+ Description: This routine processes strings for the runtime and
+ tension/erase listbox.
+
+ Modified:
+
+ Returns: Void
+
+*****************************************************/
+static VOID ListBoxText(
+LPSTR input_buffer_ptr ) /* i - pointer to string */
+{
+ CHAR buff[ LISTBOX_BUFFER_SIZE ] ;
+ LPSTR p ;
+ CHAR *temp_buffer_ptr, ch ;
+ WORD char_counter ;
+ LONG index ;
+ HDC hDC ;
+ WORD wLength ;
+
+ char_counter = 0 ;
+ temp_buffer_ptr = buff ;
+
+ do
+ {
+ ch = *temp_buffer_ptr = *input_buffer_ptr ;
+ char_counter++ ;
+
+ if ( char_counter == LISTBOX_LINE_SIZE ) {
+
+ if ( *input_buffer_ptr != TEXT(' ') ) {
+
+ /* try to find a word break to split the line */
+ while ( *input_buffer_ptr != TEXT(' ') )
+ {
+ *input_buffer_ptr-- ;
+ *temp_buffer_ptr-- ;
+ }
+
+ *input_buffer_ptr-- ;
+ ch = 0 ;
+ }
+ }
+
+ if ( ch == 0x0a || ch == 0x0d || ch == 0 ) {
+
+ if ( ch == 0x0a ) {
+ *temp_buffer_ptr++ = TEXT(' ') ; /* replace the LF control CHAR with a space */
+ }
+ *temp_buffer_ptr = 0 ;
+
+ /* if any data in the buffer, print it */
+ if ( strlen ( buff ) ) {
+
+ SIZE dsSize;
+
+ hDC = GetDC( GetDlgItem( ghModelessDialog, mwActiveListBoxID) ) ;
+
+ /* get the length of the string in logical units */
+
+ GetTextExtentPoint ( hDC, buff, strlen ( buff ), &dsSize );
+
+ // Add in about 5% for dialog list box approximation error.
+
+ wLength = ( (WORD)dsSize.cx * 105 ) / 100;
+
+ if ( wLength > wMaxLength ) {
+
+ SendMessage( GetDlgItem( ghModelessDialog, mwActiveListBoxID),
+ LB_SETHORIZONTALEXTENT, wLength, 0L ) ;
+
+ wMaxLength = wLength ;
+
+ /* if horizontal scroll bars are displayed - */
+ /* then only allow 4 entries in the list box */
+
+ listbox_index = 3 ;
+ }
+
+ ReleaseDC( GetDlgItem( ghModelessDialog, mwActiveListBoxID), hDC ) ;
+
+ p = buff ;
+
+ /* add the new string to the list box */
+
+ index = SendDlgItemMessage ( ghModelessDialog,
+ mwActiveListBoxID,
+ LB_ADDSTRING,
+ ( WORD )NULL,
+ ( DWORD )p ) ;
+
+ // Needed for single lines broken up into multiple lines?
+
+ UpdateWindow ( ghModelessDialog );
+
+ /* only allow MAX_LISTBOX_INDEX entries in the list box */
+
+ if( index > MAX_LISTBOX_INDEX ) {
+
+ SendDlgItemMessage ( ghModelessDialog,
+ mwActiveListBoxID,
+ LB_DELETESTRING,
+ ( WORD )0,
+ ( DWORD )NULL ) ;
+ }
+
+ /* there can be 4 or 5 lines in the listbox */
+ /* if printing to the last line, cause the listbox */
+ /* to scroll */
+
+ if ( index > listbox_index ) {
+
+ HWND hWnd = GetDlgItem ( ghModelessDialog, mwActiveListBoxID );
+
+ SEND_WM_VSCROLL_MSG ( hWnd, SB_BOTTOM, 0, NULL );
+ SEND_WM_VSCROLL_MSG ( hWnd, SB_ENDSCROLL, 1, NULL );
+
+// SendDlgItemMessage ( ghModelessDialog,
+// mwActiveListBoxID,
+// LB_SETTOPINDEX,
+// ( WORD )( index - listbox_index ),
+// (MP2) NULL ) ;
+ }
+ }
+
+ temp_buffer_ptr = buff ;
+ char_counter = 0 ;
+ }
+ else {
+ *temp_buffer_ptr++ ;
+ }
+
+ } while( *input_buffer_ptr++ ) ;
+}
+
+
+/***************************************************
+
+ Name: DM_Tension( )
+
+ Description:
+
+ Modified:
+
+ Returns:
+
+*****************************************************/
+
+BOOL FAR PASCAL DM_Tension (
+
+HWND hDlg, /* window handle of the dialog box */
+MSGID message, /* type of message */
+MP1 mp1, /* message-specific information */
+MP2 mp2 )
+
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( message ) {
+
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ DM_CenterDialog( hDlg );
+ mwfOkToClose = FALSE;
+ return TRUE;
+
+ case WM_PAINT:
+
+ hDC = BeginPaint( hDlg, &ps );
+ EndPaint( hDlg, &ps );
+ UpdateWindow( hDlg );
+ return TRUE;
+
+ case WM_COMMAND: /* message: received a command */
+ {
+ WORD wId = GET_WM_COMMAND_ID ( mp1, mp2 );
+
+ if ( wId == IDOK || wId == IDD_JST_OK ) { /* TEXT("OK") box selected? */
+
+ // if the OK button is enabled, destroy the dialog
+
+ if ( IsWindowEnabled ( GetDlgItem ( hDlg, IDD_JST_OK ) ) ) {
+ DestroyWindow ( hDlg );
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ }
+
+ return TRUE; // RETURN
+ }
+
+ break;
+ }
+
+ case WM_CLOSE:
+
+ if ( ghModelessDialog && IsWindowEnabled ( GetDlgItem ( hDlg, IDD_JST_OK ) ) ) {
+ DestroyWindow ( hDlg );
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ }
+
+ break;
+
+ case WM_DESTROY:
+
+ if ( ghModelessDialog ) {
+ ghModelessDialog = (HWND)NULL;
+ MUI_EnableOperations ( (WORD)NULL );
+ break;
+ }
+ else {
+ return TRUE;
+ }
+
+ } /* end switch */
+
+ return FALSE; /* Didn't process a message */
+}
+
+
+/***************************************************
+
+ Name: JobStatusTension( )
+
+ Description:
+
+ Modified:
+
+ Returns: Void
+
+*****************************************************/
+
+VOID JobStatusTension (
+
+WORD control_function ) /* I - control function number */
+
+{
+
+ switch ( control_function ) {
+
+ case JOB_TENSION_LISTBOX:
+
+ ListBoxText( gszTprintfBuffer );
+ break;
+
+ case JOB_TENSION_ABORT_OFF:
+
+ EnableMenuItem( hMenu, SC_CLOSE, MF_ENABLED );
+ EnableWindow( GetDlgItem( ghModelessDialog, IDD_JST_OK ), 1 );
+ SetModelessFocus( IDD_JST_OK );
+ STM_SetIdleText ( IDS_READY );
+ mwfOkToClose = TRUE;
+ break;
+
+ case JOB_TENSION_ABORT_ON:
+ break;
+
+ case JOB_TENSION_DRAW_BITMAP:
+ break;
+
+ case JOB_TENSION_CREATE_DIALOG:
+
+ DM_ShowDialog ( ghWndFrame, IDD_TENSION, NULL );
+
+ SetWindowText( ghModelessDialog, TEXT(" ") );
+
+ hMenu = GetSystemMenu( ghModelessDialog, FALSE );
+ EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED );
+ EnableWindow( GetDlgItem( ghModelessDialog, IDD_JST_OK ), 0 );
+ wMaxLength = 1;
+ listbox_index = 4;
+
+ /* set the ID for the Tension/Erase listbox */
+ mwActiveListBoxID = IDD_JST_LISTBOX;
+
+ break;
+
+ case JOB_TENSION_DESTROY_DIALOG:
+
+ if ( mwRuntimeDisplayed != RUNTIME_NONE ) {
+ DestroyWindow ( ghModelessDialog );
+ mwRuntimeDisplayed = RUNTIME_NONE;
+ }
+
+ return;
+
+ case JOB_TENSION_ERASE_TITLE:
+
+ SetWindowText( ghModelessDialog, gszTprintfBuffer );
+ break;
+
+ case JOB_TENSION_TENSION_TITLE:
+
+ SetWindowText( ghModelessDialog, gszTprintfBuffer );
+ break;
+ }
+
+ if ( ghModelessDialog ) {
+ UpdateWindow ( ghModelessDialog );
+ }
+
+ WM_MultiTask ( );
+}
+
+/***************************************************
+
+ Name: SetModelessFocus( )
+
+ Description: Set the focus to a dialog control if our
+ app is active.
+
+ Returns: Void
+
+*****************************************************/
+
+static VOID SetModelessFocus ( WORD wControl )
+{
+ HWND hWndActive = GetActiveWindow( );
+ HWND ParentWindow;
+
+ if ( !hWndActive ) {
+ return;
+ }
+
+ ParentWindow = GetParent( hWndActive );
+
+ if ( ( GetParent ( hWndActive ) == ghModelessDialog ) ||
+ ( IsChild ( ghWndFrame, hWndActive ) == TRUE ) ||
+ ( ParentWindow == ghWndFrame ) ) {
+
+ SetFocus ( GetDlgItem ( ghModelessDialog, wControl ) );
+ SendDlgItemMessage( ghModelessDialog, wControl, BM_SETSTYLE,
+ (WPARAM) LOWORD(BS_DEFPUSHBUTTON), MAKELPARAM(TRUE, 0) );
+ }
+}
+
+/***************************************************
+
+ Name: SetTotalBytes( )
+
+ Description:
+
+
+ Returns: Void
+
+*****************************************************/
+
+static VOID SetTotalBytes( VOID )
+{
+
+ return;
+
+}
+
+
+/******************************************************************************
+
+ Name: JS_ReportStreamError ()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID JS_ReportStreamError (
+
+FSYS_HAND hFsys,
+GENERIC_DLE_PTR dle,
+UINT32 unStreamID,
+WORD wOperationType,
+INT16 nLoopError,
+DBLK_PTR pDirDBLK,
+DBLK_PTR pFileDBLK )
+
+{
+ CHAR szBuffer[MAX_UI_RESOURCE_SIZE];
+ UINT unStringID;
+ BOOL fDirOnly = TRUE;
+ UINT16 alloc_size ;
+
+ if ( pFileDBLK && FS_GetBlockType( pFileDBLK ) == DDB_ID ) {
+ pDirDBLK = pFileDBLK ;
+ pFileDBLK = NULL ;
+ }
+
+ // Verify difference in data, security, alt-data, extended attr.
+
+ switch ( nLoopError ) {
+
+ case LP_ACCESS_DENIED_ERROR:
+ case LP_PRIVILEGE_ERROR:
+
+ if ( DLE_GetDeviceType( dle ) == FS_EMS_DRV ) {
+ if (wOperationType == OPERATION_BACKUP ) {
+ unStringID = RES_EMS_BKU_ACCESS_FAILURE ;
+ } else {
+ unStringID = RES_EMS_RST_ACCESS_FAILURE ;
+ }
+
+ if ( DLE_GetParent( dle ) ) {
+
+ dle = DLE_GetParent(dle) ;
+ }
+
+
+ unStreamID = STRM_INVALID ;
+
+ } else if ( pFileDBLK != NULL ) {
+ unStringID = IDS_RTD_ACCESSDENIED_FILE;
+ fDirOnly = FALSE;
+ }
+ else {
+ unStringID = IDS_RTD_ACCESSDENIED_DIR;
+ }
+
+ break;
+
+ case FS_BAD_ATTACH_TO_SERVER:
+
+ unStringID = IDS_XCHNG_NO_SERVICE_RUNNING ;
+ unStreamID = STRM_INVALID ;
+
+ break;
+ case LP_FILE_WRITE_ERROR:
+
+ if ( pFileDBLK != NULL ) {
+ unStringID = IDS_RTD_WRITEERROR_FILE;
+ fDirOnly = FALSE;
+ }
+ else {
+ unStringID = IDS_RTD_WRITEERROR_DIR;
+ }
+
+ break;
+
+ default:
+
+ unStringID = 0;
+ break;
+
+ }
+
+ // If there is a valid string ID, print out the message to the
+ // list box, log file, and debug window.
+
+ if ( unStringID ) {
+
+ LPSTR pszDirFile = NULL;
+ alloc_size = FS_SizeofPathInDDB( hFsys, pDirDBLK ) + 5 ;
+
+ if ( pFileDBLK ) {
+ alloc_size += FS_SizeofFnameInFDB( hFsys, pFileDBLK ) ;
+ }
+
+ UI_AllocPathBuffer( &pszDirFile,
+ alloc_size ) ;
+
+ if ( pszDirFile ) {
+
+ CHAR chDelimiter = (CHAR)DLE_GetPathDelim ( dle );
+
+ UI_BuildDelimitedPathFromDDB ( &pszDirFile, hFsys, pDirDBLK, chDelimiter, FALSE );
+
+ if ( ! fDirOnly ) {
+
+ LPSTR pszFile = NULL;
+
+ UI_AllocPathBuffer ( &pszFile, FS_SizeofFnameInFDB ( hFsys, pFileDBLK ) ) ;
+
+ if ( pszFile ) {
+
+ FS_GetFnameFromFDB( hFsys, pFileDBLK, pszFile );
+ UI_AppendDelimiter( pszDirFile, chDelimiter );
+ strcat( pszDirFile, pszFile );
+ UI_FreePathBuffer( &pszFile );
+ }
+ }
+ }
+
+ RSM_Sprintf ( szBuffer, (LPSTR)(DWORD)unStringID, pszDirFile+1 );
+
+ UI_FreePathBuffer ( &pszDirFile ) ;
+
+ zprintf ( 0, szBuffer );
+ ListBoxText ( szBuffer );
+ lprintf( (INT16) LOGGING_FILE, TEXT("%s\n"), szBuffer );
+
+ }
+
+ unStringID = 0 ;
+ switch ( unStreamID ) {
+
+ case -1:
+ case 0 :
+ break ;
+
+ case STRM_GENERIC_DATA: /* 'STAN' */
+
+ switch ( wOperationType ) {
+
+ case OPERATION_BACKUP:
+ unStringID = IDS_RTD_READERROR_STREAM;
+ break;
+
+ case OPERATION_RESTORE:
+ unStringID = IDS_RTD_WRITEERROR_STREAM;
+ break;
+ }
+
+ break;
+
+ case STRM_NT_ACL: /* 'NACL' */
+ case STRM_NOV_TRUST_286: /* 'N286' */
+ case STRM_NOV_TRUST_386: /* 'N386' */
+
+ switch( wOperationType ) {
+
+ case OPERATION_BACKUP:
+ unStringID = IDS_RTD_READERROR_SECURITYSTREAM;
+ break;
+
+ case OPERATION_RESTORE:
+ unStringID = IDS_RTD_WRITEERROR_SECURITYSTREAM;
+ break;
+ }
+
+ break;
+
+ case STRM_NT_EA: /* 'NTEA' */
+
+ switch( wOperationType ) {
+
+ case OPERATION_BACKUP:
+ unStringID = IDS_RTD_READERROR_EA;
+ break;
+
+ case OPERATION_RESTORE:
+ unStringID = IDS_RTD_WRITEERROR_EA;
+ break;
+
+ case OPERATION_VERIFY:
+ unStringID = IDS_RTD_VERIFYERROR_EA;
+ break;
+ }
+
+ break;
+
+ case STRM_NTFS_LINK: /* 'LINK' */
+
+ switch( wOperationType ) {
+
+ case OPERATION_BACKUP:
+ unStringID = IDS_RTD_READERROR_LINK;
+ break;
+
+ case OPERATION_RESTORE:
+ unStringID = IDS_RTD_CREATEERROR_LINK;
+ break;
+ }
+
+ break;
+
+ case STRM_MAC_RESOURCE: /* 'MRSC' */
+ case STRM_NTFS_ALT_DATA: /* 'ADAT' */
+
+ default:
+
+ switch( wOperationType ) {
+
+ case OPERATION_BACKUP:
+ unStringID = IDS_RTD_READERROR_ALTSTREAM;
+ break;
+
+ case OPERATION_RESTORE:
+ unStringID = IDS_RTD_WRITEERROR_ALTSTREAM;
+ break;
+ }
+
+ break;
+
+ } /* end switch() */
+
+
+ // Print out the message to the list box, log file, and debug window.
+ if ( unStringID != 0 ) {
+
+ RSM_StringCopy ( unStringID, szBuffer, sizeof ( szBuffer ) );
+
+ zprintf ( 0, szBuffer );
+ ListBoxText ( szBuffer );
+ lprintf( (INT16) LOGGING_FILE, TEXT("%s\n"), szBuffer );
+ }
+
+ return;
+
+} /* end JS_ReportStreamError() */
+
+
+#ifndef OEM_MSOFT
+
+/***************************************************
+
+ Name: AlternateLargeFileAbort ()
+
+ Description: Performs the abort process
+ during backup for a file
+
+ Modified:
+
+ Returns:
+
+*****************************************************/
+static INT AlternateLargeFileAbort ( VOID )
+{
+
+ INT nAnswer;
+ STATS stats;
+ CHAR fpath[FILE_PATH_BUFSIZE];
+ CHAR buffer1[ LISTBOX_BUFFER_SIZE ] ;
+ CHAR AbortText[TEXT_BOX_BUFSIZE];
+ INT operation;
+ BOOLEAN retval;
+ CHAR AbortMsg[2][TEXT_BOX_BUFSIZE / 2];
+ WNDPROC lpProc ;
+ HWND hWnd;
+ INT16 FileFound = 0;
+
+
+ UI_GetCurrentStatus( &operation, &stats, fpath, sizeof( fpath ) - 1 );
+
+ if ( operation == OPERATION_BACKUP || operation == OPERATION_RESTORE ) {
+ // do nothing
+ } else {
+ /* We answered YES to normal abort, so change the abort pointer */
+ /* back to ABORT_PROCESSED - This is for operations catalog, delete, verify */
+
+ return( 0 );
+ }
+
+ if ( strlen( fpath ) > 1 ) {
+ if ( stricmp( &fpath[ strlen( fpath ) - 1 ], TEXT( "\\" ) ) )
+ FileFound = 1;
+ }
+
+ if ( !FileFound ) {
+
+
+ // if we are terminating the app, set the YY flag so
+ // we exit out without prompts
+
+ if ( gfTerminateApp ) {
+ CDS_SetYesFlag ( CDS_GetCopy (), YESYES_FLAG );
+ }
+ return( 0 );
+ }
+
+
+ UI_FixPath( fpath, MAX_DISPLAY_PATH_LENGTH, TEXT('\\') );
+
+ /* reset the abort flag */
+ mwRuntimeAbortFlag = FALSE ;
+
+ // Ask the user if an abort is really what they want.
+
+ RSM_StringCopy( RES_CURRENT_FILE, AbortMsg[0], TEXT_BOX_BUFSIZE / 2 );
+
+ if ( operation == OPERATION_BACKUP ) {
+ RSM_StringCopy( RES_BACKUP_ABORT_PART2, AbortMsg[1], TEXT_BOX_BUFSIZE / 2 );
+ } else {
+ RSM_StringCopy( RES_RESTORE_ABORT_PART2, AbortMsg[1], TEXT_BOX_BUFSIZE / 2 );
+ }
+
+ sprintf(AbortText, TEXT("%s %s\012\012%s"), AbortMsg[0], fpath, AbortMsg[1]);
+
+
+ hWnd = GetLastActivePopup( ghWndFrame );
+
+ nAnswer = DM_ShowDialog( hWnd, IDD_ABORT_BOX, AbortText );
+
+ switch (nAnswer ) {
+
+ case IDD_ABORT_YES:
+
+ /* display the abort message in the listbox */
+
+ RSM_StringCopy( RES_PROCESS_ABORTED, buffer1, LISTBOX_BUFFER_LEN ) ;
+
+ ListBoxText( buffer1 ) ;
+
+ lresprintf( LOGGING_FILE ,
+ LOG_MSG ,
+ SES_ENG_MSG ,
+ RES_PROCESS_ABORTED );
+
+ *abort_flag_ptr = (CHAR)ABORT_PROCESSED;
+
+ // if we are terminating the app, set the YY flag so
+ // we exit out without prompts
+
+ if ( gfTerminateApp ) {
+ CDS_SetYesFlag ( CDS_GetCopy (), YESYES_FLAG );
+ }
+
+ break;
+
+ case IDD_ABORT_EOF:
+
+
+ /* display the abort message in the listbox */
+
+ RSM_StringCopy( RES_PROCESS_ABORTED, buffer1, LISTBOX_BUFFER_LEN ) ;
+
+ ListBoxText( buffer1 ) ;
+
+ lresprintf( LOGGING_FILE ,
+ LOG_MSG ,
+ SES_ENG_MSG ,
+ RES_PROCESS_ABORTED );
+
+ //
+ // These two lines below tell the backup app. not to chop
+ // off the file when the user aborts the backup or restore
+ // process. Compliments of MikeP.
+ //
+
+ *abort_flag_ptr = CONTINUE_PROCESSING ;
+ UI_AbortAtEndOfFile();
+
+ //
+ //
+ //
+
+ EnableWindow( GetDlgItem( ghModelessDialog, IDD_JS_ABORT ), TRUE );
+
+ break;
+
+ case IDD_ABORT_CANCEL:
+
+
+// chs:07-24-93 ListBoxText( buffer1 ) ;
+// chs:07-24-93
+// chs:07-24-93 lresprintf( LOGGING_FILE ,
+// chs:07-24-93 LOG_MSG ,
+// chs:07-24-93 SES_ENG_MSG ,
+// chs:07-24-93 RES_RESUME_PROCESS );
+
+ mwRuntimeAbortFlag = FALSE ;
+ gfTerminateApp = FALSE;
+ mwRuntimeCloseFlag = FALSE ;
+ gb_abort_flag = *abort_flag_ptr = CONTINUE_PROCESSING ;
+ gbAbortAtEOF = FALSE;
+ EnableWindow( GetDlgItem( ghModelessDialog, IDD_JS_ABORT ), TRUE );
+
+ break;
+ }
+
+ return( 1 );
+
+}
+
+/***************************************************
+
+ Name: DM_Abort()
+
+ Description:
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_Abort(
+ HWND hDlg , /* window handle of the dialog box */
+ MSGID message , /* type of message */
+ MP1 mp1 , /* message-specific information */
+ MP2 mp2
+)
+{
+ static HWND hWndMsg;
+ HDC hDC; /* device context */
+ RECT rect;
+ CHAR_PTR MsgPtr;
+ HICON hIcon;
+ HWND hWndIcon; /* handle of window for icon drawing */
+ PAINTSTRUCT ps ;
+
+
+ switch ( message )
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ DM_CenterDialog( hDlg );
+ MsgPtr = ( CHAR_PTR )mp2;
+ SetDlgItemText( hDlg, IDD_ABORT_MESSAGE_TEXT, MsgPtr );
+
+ return (TRUE);
+
+ break;
+
+ case WM_PAINT:
+
+ hDC = BeginPaint( hDlg, &ps ) ;
+ EndPaint( hDlg, &ps ) ;
+ UpdateWindow( hDlg ) ; /* force the dialog to be displayed now */
+
+ hWndIcon = GetDlgItem( hDlg, IDD_MSG_ICON );
+ hIcon = LoadIcon( (HINSTANCE)NULL, IDI_EXCLAMATION );
+ hDC = GetDC( hWndIcon );
+ DrawIcon( hDC, 0, 0, hIcon );
+ ReleaseDC( hWndIcon, hDC );
+
+ return ( TRUE ) ;
+
+ break;
+
+ case WM_COMMAND: /* message: received a command */
+ switch( GET_WM_COMMAND_ID ( mp1, mp2 ) )
+ {
+
+ case IDD_ABORT_YES:
+ case IDD_ABORT_EOF:
+ case IDD_ABORT_CANCEL:
+ EndDialog( hDlg, GET_WM_COMMAND_ID ( mp1, mp2 ) );
+ return( TRUE );
+ break;
+
+ case IDHELP:
+ HM_DialogHelp( HELPID_DIALOGABORT ) ;
+ return( TRUE );
+ break;
+
+ default:
+ return( FALSE );
+ break;
+
+ }
+ break;
+
+
+/***************************************************************************
+ * Respond to the close selection from the system menu
+ ***************************************************************************/
+
+ case WM_CLOSE:
+ {
+ EndDialog ( hDlg, FALSE ); /* return false in this case */
+ return TRUE;
+ }
+
+/***************************************************************************
+ * Respond to the destroy message
+ ***************************************************************************/
+
+ case WM_DESTROY:
+
+ WM_MultiTask ();
+ break;
+
+ }
+
+
+ return ( FALSE ); /* Didn't process a message */
+}
+
+#endif
+
+
+
diff --git a/private/utils/ntbackup/src/savepath.c b/private/utils/ntbackup/src/savepath.c
new file mode 100644
index 000000000..44b7c88fe
--- /dev/null
+++ b/private/utils/ntbackup/src/savepath.c
@@ -0,0 +1,164 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: savepath.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to attach a "current directory" string
+ on to the file system handle
+
+
+ $Log: M:/LOGFILES/SAVEPATH.C_V $
+
+ Rev 1.8 24 Nov 1993 14:47:16 BARRY
+Unicode fixes
+
+ Rev 1.7 10 Nov 1993 13:09:22 STEVEN
+fixed memory corruption with unicode
+
+ Rev 1.6 04 Feb 1993 14:56:18 TIMN
+Added Unicode header to resolve link errors
+
+ Rev 1.5 11 Nov 1992 22:26:56 GREGG
+Unicodeized literals.
+
+ Rev 1.4 06 Oct 1992 13:24:20 DAVEV
+Unicode strlen verification
+
+ Rev 1.3 18 Aug 1992 10:29:52 STEVEN
+fix warnings
+
+ Rev 1.2 13 Jan 1992 18:46:14 STEVEN
+changes for WIN32 compile
+
+ Rev 1.1 01 Oct 1991 11:16:20 BARRY
+Include standard headers.
+
+ Rev 1.0 09 May 1991 13:37:10 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdwcs.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: FS_SavePath()
+
+ Description: This function attaches a copy of the passed path to the
+ file system handle.
+
+ Modified: 8/10/1989
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_SavePath(
+FSYS_HAND fsh,
+UINT8_PTR path,
+UINT16 path_len ) // size of path buffer in bytes incl NULL term
+{
+ UINT16 cb_psize; // string buffer size in bytes incl NULL term
+ CHAR_PTR temp;
+ INT16 ret_val = SUCCESS ;
+
+ if ( path_len > (UINT16)fsh->leng_dir ) {
+
+ /* previous buffer was too small. so lets allocate a */
+ /* bigger one and throw the old one away. */
+
+ cb_psize = (INT16)(((path_len + 2 * sizeof (CHAR) ) / CUR_DIR_CHUNK + 1 ) * CUR_DIR_CHUNK );
+ temp = fsh->cur_dir;
+ fsh->cur_dir = (CHAR_PTR) malloc( cb_psize ) ;
+
+ if ( fsh->cur_dir == NULL ) {
+ fsh->cur_dir = temp ;
+ ret_val = OUT_OF_MEMORY ;
+ } else {
+ free( temp ) ;
+ fsh->leng_dir = cb_psize ;
+ memcpy( fsh->cur_dir, path, path_len );
+ fsh->cur_dir[path_len/sizeof(CHAR)] = TEXT('\0') ;
+ }
+ } else {
+ memcpy( fsh->cur_dir, path, path_len );
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: FS_AppendPath()
+
+ Description: This function appends a copy of the passed path to the
+ path in file system handle.
+
+ Modified: 8/10/1989
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes: This function requires that the saved path and the
+ provided path are ASCIIZ strings.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_AppendPath(
+FSYS_HAND fsh,
+UINT8_PTR path,
+UINT16 path_len ) //size of path buffer in bytes incl NULL term
+{
+ INT16 cb_psize; //string buffer length in bytes incl NULL term
+ CHAR_PTR temp;
+ INT16 ret_val = SUCCESS ;
+
+ cb_psize = (INT16)(strsize(fsh->cur_dir) + path_len + sizeof (CHAR)) ;
+ if ( cb_psize > fsh->leng_dir ) {
+
+ /* previous buffer was too small. so lets allocate a */
+ /* bigger one and throw the old one away. */
+
+ cb_psize = (INT16)((cb_psize / CUR_DIR_CHUNK + sizeof (CHAR) ) * CUR_DIR_CHUNK) ;
+ temp = fsh->cur_dir;
+ fsh->cur_dir = (CHAR_PTR) calloc( 1, cb_psize ) ;
+
+ if ( fsh->cur_dir == NULL ) {
+ fsh->cur_dir = temp ;
+ ret_val = OUT_OF_MEMORY ;
+ } else {
+ strcpy( fsh->cur_dir, temp ) ;
+ strncat( fsh->cur_dir, (CHAR_PTR)path, path_len / sizeof (CHAR) ) ;
+ fsh->leng_dir = cb_psize ;
+ free( temp ) ;
+ }
+ } else {
+ strncat( fsh->cur_dir, (CHAR_PTR)path, path_len / sizeof (CHAR) ) ;
+ }
+
+ return ret_val ;
+}
+
diff --git a/private/utils/ntbackup/src/scanbsd.c b/private/utils/ntbackup/src/scanbsd.c
new file mode 100644
index 000000000..39a47339e
--- /dev/null
+++ b/private/utils/ntbackup/src/scanbsd.c
@@ -0,0 +1,283 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: scanbsd.c
+
+ Description: This file contains code to scan the list of BSDs and
+ read the data associated with them
+
+
+ $Log: M:/LOGFILES/SCANBSD.C_V $
+
+ Rev 1.9.1.0 24 Nov 1993 15:11:46 BARRY
+Unicode fixes
+
+ Rev 1.9 29 Jul 1993 13:27:54 TIMN
+Added a required header
+
+ Rev 1.8 21 Jul 1993 08:56:30 DON
+bsd_matchname function incorrectly defined
+
+ Rev 1.7 20 Jul 1993 11:08:30 MIKEP
+add bsd_findbyname call
+
+ Rev 1.6 19 Jul 1993 10:06:08 BARRY
+Fixes for disappearing DLEs.
+
+ Rev 1.5 22 May 1992 13:35:20 TIMN
+Changed CHAR to INT8
+
+ Rev 1.4 14 Jan 1992 10:24:20 STEVEN
+fix warnings for WIN32
+
+ Rev 1.3 23 Jul 1991 16:19:48 STEVEN
+added BSD_RefreshConfig( )
+
+ Rev 1.2 03 Jul 1991 15:25:50 BRYAN
+Fixed typo in msassert.
+
+ Rev 1.1 29 May 1991 17:21:12 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:37:12 HUNTER
+Initial revision.
+
+**/
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+#include "msassert.h"
+
+#include "dle_str.h"
+#include "beconfig.h"
+#include "bsdu.h"
+
+
+typedef struct {
+ UINT32 tape_id ;
+ UINT16 set_num ;
+} TAPE_MATCH_STRUCT, *TAPE_MATCH_STRUCT_PTR ;
+
+static BOOLEAN BSD_MatchDLE( VOID_PTR bsd, VOID_PTR dle ) ;
+static BOOLEAN BSD_MatchName( VOID_PTR bsd, VOID_PTR name ) ;
+static BOOLEAN BSD_MatchTapeID( VOID_PTR bsd, VOID_PTR tap_match ) ;
+static BOOLEAN BSD_MatchSourceDev( VOID_PTR bsd, VOID_PTR src_dev ) ;
+/**/
+/**
+
+ Name: BSD_FindByDLE()
+
+ Description: This function scans through the BSD list looking for
+ the first BSD which points to the specified dle.
+
+ Modified: 8/8/1989
+
+ Returns: The bsd found
+ NULL if BSD not found
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+BSD_PTR BSD_FindByDLE(
+BSD_HAND bsdh, /* I - BSD list to look through */
+struct GENERIC_DLE *dle ) /* I - DLE to search for */
+{
+ BSD_PTR bsd ;
+
+ bsd = (BSD_PTR)SearchQueue( &(bsdh->current_q_hdr),
+ BSD_MatchDLE,
+ dle,
+ FALSE ) ;
+
+ return( bsd ) ;
+}
+
+/**/
+/**
+
+ Name: BSD_FindByName()
+
+ Description: This function scans through the BSD list looking for
+ the first BSD which points to the specified dle name.
+
+ Modified: 7/20/1993
+
+ Returns: The bsd found
+ NULL if BSD not found
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+BSD_PTR BSD_FindByName(
+BSD_HAND bsdh, /* I - BSD list to look through */
+CHAR_PTR name ) /* I - name to search for */
+{
+ BSD_PTR bsd ;
+
+ bsd = (BSD_PTR)SearchQueue( &(bsdh->current_q_hdr),
+ BSD_MatchName,
+ name,
+ FALSE ) ;
+
+ return( bsd ) ;
+}
+
+
+
+static BOOLEAN BSD_MatchName(
+VOID_PTR bsd,
+VOID_PTR name )
+{
+ return( !stricmp( name , BSD_GetName( (BSD_PTR)bsd ) ) );
+}
+
+static BOOLEAN BSD_MatchDLE(
+VOID_PTR bsd,
+VOID_PTR dle )
+{
+ return (dle == BSD_GetDLE( (BSD_PTR)bsd ));
+}
+
+/**/
+/**
+
+ Name: BSD_FindByTapeID()
+
+ Description: This function scans through the BSD list looking for
+ the first BSD for the specified tape ID and set number.
+
+ Modified: 8/8/1989
+
+ Returns: The bsd found
+ NULL if BSD not found
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+BSD_PTR BSD_FindByTapeID(
+BSD_HAND bsdh, /* I - BSD list to look through */
+UINT32 tape_id, /* I - Tape ID to look for */
+UINT16 set_num ) /* I - Set number to look for */
+{
+ TAPE_MATCH_STRUCT tap_match ;
+ BSD_PTR bsd ;
+
+ msassert( bsdh != NULL );
+
+ tap_match.tape_id = tape_id ;
+ tap_match.set_num = set_num ;
+
+ bsd = (BSD_PTR)SearchQueue( &(bsdh->current_q_hdr),
+ BSD_MatchTapeID,
+ &tap_match,
+ FALSE ) ;
+
+ return( bsd ) ;
+}
+
+static BOOLEAN BSD_MatchTapeID(
+VOID_PTR bsd,
+VOID_PTR tap_match )
+{
+ TAPE_MATCH_STRUCT_PTR t_m ;
+ BSD_PTR bsd_ptr ;
+
+ msassert( bsd != NULL );
+ msassert( tap_match != NULL );
+
+ bsd_ptr = (BSD_PTR) bsd ;
+ t_m = (TAPE_MATCH_STRUCT_PTR)tap_match ;
+
+ if ( ( t_m->tape_id == bsd_ptr->tape_id ) &&
+ ( t_m->set_num == (UINT16)bsd_ptr->set_num ) ) {
+
+ return ( TRUE ) ;
+ } else {
+ return( FALSE ) ;
+ }
+}
+
+
+/**/
+/**
+
+ Name: BSD_FindBySourceDevice()
+
+ Description: This function scans through the BSD list looking for
+ the first BSD for the specified SourceDevice.
+
+ Modified: 8/8/1989
+
+ Returns: The bsd found
+ NULL if BSD not found
+
+ Notes:
+
+ Declaration:
+**/
+BSD_PTR BSD_FindBySourceDevice(
+BSD_HAND bsdh, /* I - BSD list to look through */
+VOID_PTR source_dev ) /* I - Soruce Device to look for */
+{
+ BSD_PTR bsd ;
+
+ bsd = (BSD_PTR)SearchQueue( &(bsdh->current_q_hdr),
+ BSD_MatchSourceDev,
+ source_dev,
+ FALSE ) ;
+
+ return( bsd ) ;
+}
+static BOOLEAN BSD_MatchSourceDev(
+VOID_PTR bsd,
+VOID_PTR source_dev )
+{
+ return (INT16)( source_dev == ((BSD_PTR)bsd)->source_dev ) ;
+}
+
+/**/
+/**
+
+ Name: BSD_RefreshConfig()
+
+ Description: This funciton refreshes the config data in all BSDs for
+ the specified BSD handle.
+
+ Modified: 7/23/1991 16:12:3
+
+ Returns:
+
+ Notes:
+
+ Declaration:
+**/
+VOID BSD_RefreshConfig(
+BSD_HAND bsdh,
+struct BE_CFG *conf )
+{
+ BSD_PTR bsd ;
+
+ bsd = BSD_GetFirst( bsdh ) ;
+
+ while ( bsd != NULL ) {
+
+ BEC_UpdateConfig( BSD_GetConfigData( bsd ), conf ) ;
+ bsd = BSD_GetNext( bsd ) ;
+ }
+}
+
+
+
diff --git a/private/utils/ntbackup/src/scomplex.c b/private/utils/ntbackup/src/scomplex.c
new file mode 100644
index 000000000..58b253b24
--- /dev/null
+++ b/private/utils/ntbackup/src/scomplex.c
@@ -0,0 +1,618 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: scomplex.c
+
+ Description: This file contains code to initialize the complex info
+ for an FSE. The complex info includes target path and
+ file names, date selections, and attribute selectios.
+
+
+ $Log: M:/LOGFILES/SCOMPLEX.C_V $
+
+ Rev 1.11 16 Dec 1993 10:20:18 BARRY
+Change INT8_PTRs to VOID_PTRs
+
+ Rev 1.10 18 Jun 1993 09:03:46 MIKEP
+C++ enable
+
+ Rev 1.9 26 May 1992 13:41:50 TIMN
+Added target filename size
+
+ Rev 1.8 19 May 1992 12:57:36 TIMN
+Removed strlen call
+
+ Rev 1.7 14 May 1992 11:56:04 TIMN
+Changed CHARs to INT8
+Changed strcpy to memcpy
+Added file name size to formal parameter lists
+
+ Rev 1.6 14 Jan 1992 10:24:34 STEVEN
+fix warnings for WIN32
+
+ Rev 1.5 18 Dec 1991 11:50:00 DON
+changed mallocs to callocs to avoid using invalid memory...
+
+ Rev 1.4 19 Sep 1991 17:02:28 STEVEN
+fix warning for alloc_size unused
+
+ Rev 1.3 27 Aug 1991 17:30:10 STEVEN
+added BSD target dir support
+
+ Rev 1.2 08 Jul 1991 08:37:16 STEVEN
+did not initialize return value
+
+ Rev 1.1 29 May 1991 17:21:16 STEVEN
+Re-Design of BSDU for New Fast File Restore
+
+ Rev 1.0 09 May 1991 13:36:16 HUNTER
+Initial revision.
+
+**/
+#include <stdlib.h>
+#include <malloc.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+#include "std_err.h"
+
+#include "bsdu.h"
+#include "be_debug.h"
+
+static INT16 FSE_SetDate( DATE_TIME_PTR *dptr, DATE_TIME_PTR date ) ;
+static INT16 FSE_AllocCplxInfo( FSE_PTR fse ) ;
+
+/**/
+/**
+
+ Name: FSE_SetTargetInfo()
+
+ Description: This function allocated a target info structure if
+ necessary; then sets the specified attribute information.
+
+ Modified: 5/17/1991 11:24:8
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+INT16 FSE_SetTargetInfo(
+FSE_PTR fse, /* I - FSE to set target info for */
+VOID_PTR path, /* I - target path name (NULL Impregnated */
+INT16 psize, /* I - size of target path */
+VOID_PTR fname, /* I - ASCIZ string for target file name */
+INT16 fnsize ) /* I - size of target file name */
+{
+ INT16 alloc_size ;
+ INT16 ret_val = SUCCESS ;
+ FSE_TGT_INFO_PTR tgt ;
+
+ free( fse->tgt ) ;
+
+ alloc_size = (INT16)(sizeof( FSE_TGT_INFO ) + psize) ;
+ if ( fname != NULL ) {
+ alloc_size += fnsize + 1 ;
+ }
+
+ tgt = (FSE_TGT_INFO_PTR)calloc( 1, alloc_size ) ;
+
+ fse->tgt = tgt ;
+
+ if ( tgt != NULL ) {
+ tgt->psize = psize ;
+ tgt->path = tgt + 1;
+ memcpy( tgt->path, path, psize ) ;
+ if ( fname != NULL ) {
+ tgt->fname = (INT8_PTR)tgt->path + psize ;
+ tgt->fnsize = fnsize ;
+ memcpy( tgt->fname, fname, fnsize ) ;
+ }
+ else {
+ tgt->fname = NULL ;
+ tgt->fnsize = 0 ;
+ }
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return ret_val ;
+
+}
+/**/
+/**
+
+ Name: FSE_GetTargetInfo()
+
+ Description: returns any target information for the FSE.
+ If no target info exists, then all returns are NULL .
+
+ Modified: 5/17/1991 11:23:58
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+VOID FSE_GetTargetInfo(
+FSE_PTR fse, /* I - FSE to set target info for */
+VOID_PTR *path, /* O - target path name (NULL Impregnated */
+INT16 *psize, /* O - size of target path */
+VOID_PTR *fname, /* O - ASCIZ string for target file name */
+INT16 *fnsize ) /* O - size of target file name */
+{
+ FSE_TGT_INFO_PTR tgt = fse->tgt ;
+
+ if ( tgt != NULL ) {
+ *path = tgt->path ;
+ *psize = tgt->psize ;
+ *fname = tgt->fname ;
+ *fnsize = tgt->fnsize ;
+ } else {
+ *path = NULL ;
+ *psize = 0 ;
+ *fname = NULL ;
+ *fnsize = 0 ;
+ }
+}
+/**/
+/**
+
+ Name: BSD_SetTargetInfo()
+
+ Description: This function allocated a target info structure if
+ necessary; then sets the specified attribute information.
+
+ Modified: 5/17/1991 11:24:8
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+INT16 BSD_SetTargetInfo(
+BSD_PTR bsd, /* I - BSD to set target info for */
+VOID_PTR path, /* I - target path name (NULL Impregnated */
+INT16 psize ) /* I - size of target path */
+{
+ INT16 ret_val = SUCCESS ;
+ VOID_PTR tgt ;
+
+ free( bsd->target_path ) ;
+ bsd->target_path = NULL ;
+ bsd->tgt_psize = 0 ;
+
+ if ( psize > 1 ) {
+
+ tgt = calloc( 1, psize ) ;
+
+ bsd->target_path = tgt ;
+
+ if ( tgt == NULL ) {
+ psize = 0 ;
+ ret_val = OUT_OF_MEMORY ;
+ } else {
+ memcpy( tgt, path, psize ) ;
+ }
+
+ bsd->tgt_psize = psize ;
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: BSD_GetTargetInfo()
+
+ Description: returns any target information for the BSD.
+ If no target info exists, then all returns are NULL .
+
+ Modified: 5/17/1991 11:23:58
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+VOID BSD_GetTargetInfo(
+BSD_PTR bsd, /* I - BSD to set target info for */
+VOID_PTR *path, /* O - target path name (NULL Impregnated */
+INT16 *psize ) /* O - size of target path */
+{
+
+ *path = bsd->target_path ;
+ *psize = bsd->tgt_psize ;
+
+}
+/**/
+/**
+
+ Name: FSE_SetAttribInfo()
+
+ Description: This function allocated a complex info structure if
+ necessary; then sets the specified attribute information.
+
+ Modified: 5/17/1991 11:25:36
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FSE_SetAttribInfo(
+FSE_PTR fse, /* I - FSE to set attribute info in */
+UINT32 a_on_mask, /* I - bits which must Be set to match */
+UINT32 a_off_mask ) /* I - bits which must be cleared to match */
+{
+ INT16 ret_val ;
+
+ ret_val = FSE_AllocCplxInfo( fse );
+
+ if ( ret_val == SUCCESS ) {
+ fse->cplx->attr_on_mask = a_on_mask ;
+ fse->cplx->attr_off_mask = a_off_mask ;
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: FSE_GetAttribInfo()
+
+ Description: returns any attribute information for the FSE.
+ If no complex info exists, then all returns are 0 .
+
+ Modified: 5/17/1991 11:23:58
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+VOID FSE_GetAttribInfo(
+FSE_PTR fse, /* I - FSE to set attribute info in */
+UINT32_PTR a_on_mask, /* O - bits which must Be set to match */
+UINT32_PTR a_off_mask ) /* O - bits which must be cleared to match */
+{
+ FSE_COMPLEX_PTR cplx = fse->cplx ;
+
+ if ( cplx != NULL ) {
+ *a_on_mask = cplx->attr_on_mask ;
+ *a_off_mask = cplx->attr_off_mask ;
+ } else {
+ *a_on_mask = 0 ;
+ *a_off_mask = 0 ;
+ }
+}
+
+/**/
+/**
+
+ Name: FSE_SetModDate()
+
+ Description: This function allocated a complex info structure if
+ necessary; then allocates a date time structure if necessary;
+ then sets the date time fields approprately ;
+
+ Modified: 5/17/1991 12:12:32
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes: if you wish to not specify one of the dates,
+ simply pass NULL, You may also pass an invalid date.
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FSE_SetModDate(
+FSE_PTR fse, /* I - FSE to set the Modification dates in */
+DATE_TIME_PTR pre, /* I - The Before modification date */
+DATE_TIME_PTR post ) /* I - The After modification date */
+{
+ INT16 ret_val ;
+ FSE_COMPLEX_PTR cplx ;
+
+ ret_val = FSE_AllocCplxInfo( fse );
+
+ cplx = fse->cplx ;
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FSE_SetDate( &cplx->pre_m_date, pre ) ;
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FSE_SetDate( &cplx->post_m_date, post ) ;
+ if ( ret_val != SUCCESS ) {
+ free( &cplx->pre_m_date ) ;
+ }
+ }
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: FSE_GetModDate()
+
+ Description: This function returns any modification date information
+ for the specified FSE. If no Complex information exists,
+ then both return date are NULL .
+
+ Modified: 5/17/1991 12:12:32
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+VOID FSE_GetModDate(
+FSE_PTR fse, /* I - The FSE to get the date from */
+DATE_TIME_PTR *pre, /* O - The before date */
+DATE_TIME_PTR *post ) /* O - The after date */
+{
+ FSE_COMPLEX_PTR cplx = fse->cplx ;
+
+ if ( cplx != NULL ) {
+ *pre = cplx->pre_m_date ;
+ *post = cplx->post_m_date ;
+ } else {
+ *pre = NULL ;
+ *post = NULL ;
+ }
+}
+
+/**/
+/**
+
+ Name: FSE_SetAccDate()
+
+ Description: This function allocated a complex info structure if
+ necessary; then allocates a date time structure if necessary;
+ then sets the date time fields approprately ;
+
+ Modified: 5/17/1991 12:17:10
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FSE_SetAccDate(
+FSE_PTR fse, /* I - The FSE to set the access date in */
+DATE_TIME_PTR pre ) /* I - The new access date */
+{
+ INT16 ret_val ;
+
+ ret_val = FSE_AllocCplxInfo( fse );
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FSE_SetDate( &fse->cplx->access_date, pre ) ;
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: FSE_GetAccDate()
+
+ Description: This function gets the access date information from the
+ specified FSE. If no complex info exist for the FSE then
+ a NULL date is returned.
+
+ Modified: 5/17/1991 12:17:10
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+
+VOID FSE_GetAccDate(
+FSE_PTR fse, /* I - The FSE to get the date from */
+DATE_TIME_PTR *pre ) /* O - The access date */
+{
+ if ( fse->cplx != NULL ) {
+ *pre = fse->cplx->access_date ;
+ } else {
+ *pre = NULL ;
+ }
+}
+
+/**/
+/**
+
+ Name: FSE_SetBakDate()
+
+ Description: This function allocated a complex info structure if
+ necessary; then allocates a date time structure if necessary;
+ then sets the date time fields approprately ;
+
+ Modified: 5/17/1991 12:19:41
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FSE_SetBakDate(
+FSE_PTR fse, /* I - The FSE to set the backup date in */
+DATE_TIME_PTR pre ) /* I - The backup date */
+{
+ INT16 ret_val ;
+
+ ret_val = FSE_AllocCplxInfo( fse );
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FSE_SetDate( &fse->cplx->backup_date, pre ) ;
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: FSE_GetBakDate()
+
+ Description: This function returns the Backup date stored in the FSE.
+ If there is no complex info for the FSE the backup date
+ returned is NULL.
+
+ Modified: 5/17/1991 12:17:10
+
+ Returns: None
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID FSE_GetBakDate(
+FSE_PTR fse, /* I - The FSE to get the date from */
+DATE_TIME_PTR *pre ) /* O - The backup date */
+{
+ if ( fse->cplx != NULL ) {
+ *pre = fse->cplx->backup_date ;
+ } else {
+ *pre = NULL ;
+ }
+}
+
+/**/
+/**
+
+ Name: FSE_AllocCplxInfo()
+
+ Description: This is a private function which will allocate a
+ Complex Info structure if necessary.
+
+ Modified: 5/17/1991 12:23:35
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 FSE_AllocCplxInfo(
+FSE_PTR fse )
+{
+ if ( fse->cplx == NULL ) {
+ fse->cplx = (FSE_COMPLEX_PTR)calloc( 1, sizeof ( FSE_COMPLEX ) ) ;
+ }
+
+ if ( fse->cplx == NULL ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: FSE_SetDate()
+
+ Description: This is a private function which will allocate a
+ date_time structure and set the date.
+
+ Modified: 5/17/1991 12:23:35
+
+ Returns: SUCCESS or OUT_OF_MEMORY
+
+ Notes:
+
+ See also: $/SEE( BSD_AddFSE( ) )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 FSE_SetDate(
+DATE_TIME_PTR *d_ptr,
+DATE_TIME_PTR date )
+{
+ INT16 ret_val = SUCCESS ;
+
+ if ( ( date == NULL ) || !date->date_valid ) {
+ free (*d_ptr ) ;
+ *d_ptr = NULL ;
+
+ } else if ( *d_ptr == NULL ) {
+ *d_ptr = (DATE_TIME_PTR)calloc( 1, sizeof( DATE_TIME ) ) ;
+
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ if ( *d_ptr != NULL ) {
+ **d_ptr = *date ;
+ }
+
+ return ret_val ;
+}
+
+
+
+
diff --git a/private/utils/ntbackup/src/sdisk.bmp b/private/utils/ntbackup/src/sdisk.bmp
new file mode 100644
index 000000000..a5d35a043
--- /dev/null
+++ b/private/utils/ntbackup/src/sdisk.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/set_dbug.dlg b/private/utils/ntbackup/src/set_dbug.dlg
new file mode 100644
index 000000000..864645eff
--- /dev/null
+++ b/private/utils/ntbackup/src/set_dbug.dlg
@@ -0,0 +1,43 @@
+
+IDD_SETTINGSDEBUGWINDOW DIALOG 27, 28, 255, 133
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Debug Window Settings"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Window", 0xFFFF, 2, 2, 85, 124
+ CONTROL "Record to &window", IDD_DB_TOWIN, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 7, 16, 75, 10
+ RADIOBUTTON "Record &last", IDD_DB_RLAST, 7, 34, 57, 10
+ EDITTEXT IDD_DB_RNUM, 64, 34, 19, 12, ES_AUTOHSCROLL
+ LTEXT "messages", IDD_DB_M, 17, 48, 41, 8
+ RADIOBUTTON "Record &all messages", IDD_DB_RALL, 6, 64, 78, 10
+ LTEXT "Messages:", 0x006B, 5, 84, 42, 8
+ LTEXT "", IDD_DB_WMSGS, 50, 84, 20, 8, SS_NOPREFIX
+ PUSHBUTTON "&Reset Window", IDD_DB_RMEM, 11, 101, 64, 14
+ GROUPBOX "File", 0xFFFF, 96, 2, 108, 77
+ CONTROL "Record to &file", IDD_DB_TOFILE, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 102, 15, 70, 10
+ LTEXT "File &name:", IDD_DB_FNAMELABEL, 102, 31, 35, 8
+ EDITTEXT IDD_DB_FNAME, 138, 29, 59, 12, ES_AUTOHSCROLL
+ LTEXT "Messages:", 0x006C, 102, 47, 42, 8
+ LTEXT "", IDD_DB_FMSGS, 146, 47, 18, 8, SS_NOPREFIX
+ PUSHBUTTON "R&eset File", IDD_DB_RFILE, 114, 61, 70, 14
+ GROUPBOX "Options", 0xFFFF, 96, 86, 108, 40
+ CONTROL "Display &memory trace", IDD_DB_MEMTRACE, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 103, 99, 98, 10
+ CONTROL "Enable &poll drive", IDD_DB_POLLDRIVEON, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 103, 111, 95, 10
+ DEFPUSHBUTTON "OK", IDOK, 213, 6, 40, 14
+ PUSHBUTTON "Cancel", IDCANCEL, 213, 26, 40, 14
+ DEFPUSHBUTTON "&Help", IDHELP, 213, 46, 40, 14
+
+# ifndef OEM_MSOFT //no shadows allowed in OEM version
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 87, 10, 3, 119
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 204, 10, 3, 72
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 99, 79, 106, 3
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 204, 94, 2, 35
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 5, 126, 84, 3
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 99, 126, 107, 3
+# endif //OEM_MSOFT //no shadows allowed in OEM version
+
+END
diff --git a/private/utils/ntbackup/src/skipno.c b/private/utils/ntbackup/src/skipno.c
new file mode 100644
index 000000000..c20349128
--- /dev/null
+++ b/private/utils/ntbackup/src/skipno.c
@@ -0,0 +1,133 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: SKIPNO.C
+
+ Description:
+
+ $Log: G:\UI\LOGFILES\SKIPNO.C_V $
+
+ Rev 1.1 28 Jan 1994 17:22:36 Glenn
+Simplified and fixed Icon support.
+
+ Rev 1.0 13 Jul 1993 17:04:28 CARLS
+Initial revision
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/***************************************************
+
+ Name: DM_StartSkipNo
+
+ Description:
+
+ Returns: Returns the status from the dialog.
+
+*****************************************************/
+INT DM_StartSkipNo( )
+{
+ INT16 status ;
+
+ status = DM_ShowDialog( ghModelessDialog, IDD_SKIPNO, NULL ) ;
+
+ return( status ) ;
+}
+/***************************************************
+
+ Name: DM_SkipNo
+
+ Description:
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_SkipNo(
+HWND hDlg , /* window handle of the dialog box */
+MSGID message , /* type of message */
+MP1 mp1 , /* message-specific information */
+MP2 mp2
+)
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+ HDC hDCBitmap;
+ HWND hWnd;
+ HICON hIcon;
+ WORD answer ;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+
+ switch ( message )
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ DM_CenterDialog( hDlg );
+
+ hIcon = LoadIcon( 0, IDI_EXCLAMATION );
+ SendDlgItemMessage ( hDlg, IDD_SKIPNO_BITMAP, STM_SETICON, (MP1)hIcon, 0L );
+
+ SetDlgItemText( hDlg, IDD_SKIPNO_TEXT, gszTprintfBuffer );
+
+ return ( TRUE );
+
+ case WM_COMMAND: /* message: received a command */
+ switch( GET_WM_COMMAND_ID ( mp1, mp2 ) )
+ {
+/****************************************************************************
+ Yes button
+/***************************************************************************/
+ case IDD_SKIPNO_YES:
+ EndDialog( hDlg, SKIPNO_YES_BUTTON ); /* Exits the dialog box */
+ break;
+/****************************************************************************
+ Yes to all button
+/***************************************************************************/
+ case IDD_SKIPNO_ALL:
+ EndDialog( hDlg, SKIPNO_YES_TO_ALL_BUTTON ); /* Exits the dialog box */
+ break;
+/****************************************************************************
+ No button
+/***************************************************************************/
+ case IDD_SKIPNO_NO:
+ EndDialog( hDlg, SKIPNO_NO_BUTTON ); /* Exits the dialog box */
+ break;
+/****************************************************************************
+ Cancel button
+/***************************************************************************/
+ case IDD_SKIPNO_CANCEL:
+ case IDCANCEL:
+
+ /* Ask the user if an abort is really what they want? */
+
+ answer = (WORD)WM_MsgBox( ID( RES_ABORT_STRING ),
+ ID( RES_ABORT_QUESTION ),
+ (WORD)WMMB_YESNO, (WORD)WMMB_ICONQUESTION );
+ if( answer == WMMB_IDYES) {
+
+ yresprintf( (INT16) RES_PROCESS_ABORTED );
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( (INT16) LOGGING_FILE ,
+ (INT16) LOG_MSG ,
+ SES_ENG_MSG ,
+ RES_PROCESS_ABORTED );
+
+ EndDialog( hDlg, SKIPNO_CANCEL_BUTTON ); /* Exits the dialog box */
+
+ }
+ return ( TRUE );
+ break;
+
+ }
+ break;
+ }
+ return ( FALSE ); /* Didn't process a message */
+}
+
diff --git a/private/utils/ntbackup/src/skipno.dlg b/private/utils/ntbackup/src/skipno.dlg
new file mode 100644
index 000000000..19c5bd9b3
--- /dev/null
+++ b/private/utils/ntbackup/src/skipno.dlg
@@ -0,0 +1,12 @@
+IDD_SKIPNO DIALOG 12, 43, 254, 61
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Skip Open File"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ ICON 0, IDD_SKIPNO_BITMAP, 8, 6, 20, 20
+ LTEXT "", IDD_SKIPNO_TEXT, 33, 6, 220, 33, SS_NOPREFIX
+ DEFPUSHBUTTON "&Yes", IDD_SKIPNO_YES, 15, 44, 44, 14
+ PUSHBUTTON "&No", IDD_SKIPNO_NO, 135, 44, 44, 14
+ PUSHBUTTON "Yes to &ALL", IDD_SKIPNO_ALL, 75, 44, 44, 14
+ PUSHBUTTON "&Cancel", IDD_SKIPNO_CANCEL, 194, 44, 44, 14
+END
diff --git a/private/utils/ntbackup/src/skipopen.c b/private/utils/ntbackup/src/skipopen.c
new file mode 100644
index 000000000..ccbb0bafa
--- /dev/null
+++ b/private/utils/ntbackup/src/skipopen.c
@@ -0,0 +1,235 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: SKIPOPEN.C
+
+ Description: Skip open files dialog.
+
+ $Log: G:\UI\LOGFILES\SKIPOPEN.C_V $
+
+ Rev 1.15 28 Jan 1994 14:50:40 MIKEP
+fix if file goes away while we're waiting
+
+ Rev 1.14 27 Jul 1993 14:35:02 CARLS
+changed timer routine to use elapsed time
+
+ Rev 1.13 14 May 1993 15:24:30 CARLS
+check for open file in the timer function
+
+ Rev 1.12 01 Nov 1992 16:07:56 DAVEV
+Unicode changes
+
+ Rev 1.11 07 Oct 1992 13:44:18 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.10 04 Oct 1992 19:40:44 DAVEV
+Unicode Awk pass
+
+ Rev 1.9 28 Jul 1992 14:49:30 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.8 14 May 1992 16:40:16 MIKEP
+Nt pass 2
+
+ Rev 1.7 27 Jan 1992 12:50:10 GLENN
+Changed dialog support calls.
+
+ Rev 1.6 22 Jan 1992 14:53:02 JOHNWT
+fixed last fix
+
+ Rev 1.5 20 Jan 1992 09:35:12 CARLS
+added a call to DM_CenterDialog
+
+ Rev 1.4 09 Jan 1992 18:25:26 DAVEV
+16/32 bit port 2nd pass
+
+ Rev 1.3 20 Dec 1991 16:55:00 JOHNWT
+return ghModelessDialog
+
+ Rev 1.2 18 Dec 1991 11:33:46 JOHNWT
+changed ghModelessDialog to ghRuntimeDialog
+
+ Rev 1.1 26 Nov 1991 17:27:06 DAVEV
+16/32 bit Windows port changes
+
+ Rev 1.0 20 Nov 1991 19:34:26 SYSTEM
+Initial revision.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+static VOID clock_routine( VOID );
+
+struct skipopen_temp {
+ WORD dialog_return_status;
+ WORD wait_time;
+ HTIMER timer_handle;
+ HWND ghDlg; /* global window handle of the dialog box */
+ CHK_OPEN TryOpen;
+ UINT32 parm;
+ INT status;
+ time_t stop_time ;
+};
+
+static struct skipopen_temp *skip_temp_ptr;
+
+/***************************************************
+
+ Name: DM_StartSkipOpen()
+
+ Description: Starts the Skip Open files dialog
+
+ Returns: Returns the status from the dialog.
+
+*****************************************************/
+INT DM_StartSkipOpen( CHK_OPEN TryOpen, UINT32 parm )
+{
+INT status;
+struct skipopen_temp temp_data;
+
+ skip_temp_ptr = &temp_data;
+ skip_temp_ptr->TryOpen = TryOpen ;
+ skip_temp_ptr->parm = parm ;
+ skip_temp_ptr->status = ~SUCCESS ;
+ time( &skip_temp_ptr->stop_time ) ;
+
+ status = (INT16)DM_ShowDialog( ghModelessDialog, IDD_SKIPOPEN, NULL );
+
+ return( skip_temp_ptr->status );
+}
+/***************************************************
+
+ Name: DM_SkipOpen()
+
+ Description: Skip open files dialog procedure
+
+ Returns:
+
+*****************************************************/
+DLGRESULT APIENTRY DM_SkipOpen(
+ HWND hDlg , /* window handle of the dialog box */
+ MSGID message , /* type of message */
+ MP1 mp1 , /* message-specific information */
+ MP2 mp2
+)
+{
+ CDS_PTR cds_ptr;
+
+ CHAR buffer[20] ;
+ INT16 error ;
+ time_t current_time ;
+ time_t elapsed_time ;
+
+ UNREFERENCED_PARAMETER ( mp2 );
+ switch ( message )
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+
+ DM_CenterDialog( hDlg );
+
+ SetDlgItemText( hDlg, IDD_SKIP_FILE_NAME, gszTprintfBuffer );
+
+ /* save the handle to this window */
+ skip_temp_ptr->ghDlg = hDlg;
+
+ cds_ptr = CDS_GetCopy();
+
+ /* get the skip wait time */
+ skip_temp_ptr->wait_time = CDS_GetWaitTime( cds_ptr );
+ skip_temp_ptr->stop_time += skip_temp_ptr->wait_time ;
+
+ time( &current_time ) ;
+ elapsed_time = skip_temp_ptr->stop_time - current_time ;
+ if( elapsed_time >= 1 ) {
+ wsprintf( buffer, TEXT("%d"), elapsed_time ) ;
+
+ /* display the remaining time until we skip this file */
+ SetDlgItemText( skip_temp_ptr->ghDlg, IDD_SKIP_OPEN_WAIT_TIME, buffer ) ;
+ }
+
+ /* save the handle to the timer */
+ skip_temp_ptr->timer_handle = WM_HookTimer( clock_routine, 1 );
+
+ return (TRUE);
+
+ case WM_COMMAND: /* message: received a command */
+ switch( GET_WM_COMMAND_ID ( mp1, mp2 ) )
+ {
+/****************************************************************************
+ Cancel button
+/***************************************************************************/
+ case IDD_SKIP_CANCEL_BUTTON:
+ case IDCANCEL:
+
+ skip_temp_ptr->dialog_return_status = TRUE;
+
+ /* release the timer */
+ WM_UnhookTimer( skip_temp_ptr->timer_handle );
+
+ EndDialog(hDlg, FALSE); /* Exits the dialog box */
+
+ return (TRUE);
+ break;
+
+ }
+ break;
+ }
+ return (FALSE); /* Didn't process a message */
+}
+
+/***************************************************
+
+ Name: clock_routine()
+
+ Description: Skip Open files timer
+
+ Returns: void
+
+*****************************************************/
+static VOID clock_routine( VOID )
+{
+ CHAR buffer[20] ;
+ INT16 error ;
+ time_t current_time ;
+ time_t elapsed_time ;
+
+ time( &current_time ) ;
+ elapsed_time = skip_temp_ptr->stop_time - current_time ;
+ if( elapsed_time >= 1 ) {
+ wsprintf( buffer, TEXT("%d"), elapsed_time ) ;
+
+ /* display the remaining time until we skip this file */
+ SetDlgItemText( skip_temp_ptr->ghDlg, IDD_SKIP_OPEN_WAIT_TIME, buffer ) ;
+ }
+
+ if( current_time >= skip_temp_ptr->stop_time ) {
+
+ skip_temp_ptr->dialog_return_status = TRUE ;
+
+ /* release the timer */
+ WM_UnhookTimer( skip_temp_ptr->timer_handle ) ;
+
+ EndDialog(skip_temp_ptr->ghDlg, FALSE) ; /* close the dialog box */
+ }
+
+ /* try to open the file */
+ error = skip_temp_ptr->TryOpen( skip_temp_ptr->parm ) ;
+
+ if ( error == SUCCESS || error == FS_NOT_FOUND || error == FS_OPENED_INUSE ) {
+
+ /* the file was opened, set the return status */
+ skip_temp_ptr->status = error;
+
+ /* release the timer */
+ WM_UnhookTimer( skip_temp_ptr->timer_handle ) ;
+
+ EndDialog(skip_temp_ptr->ghDlg, FALSE) ; /* close the dialog box */
+ }
+
+}
diff --git a/private/utils/ntbackup/src/skipopen.dlg b/private/utils/ntbackup/src/skipopen.dlg
new file mode 100644
index 000000000..a9119e208
--- /dev/null
+++ b/private/utils/ntbackup/src/skipopen.dlg
@@ -0,0 +1,33 @@
+/**************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+
+ Name: skipopen.dlg
+
+ Description: This file contains a dialog template.
+
+ $Log: G:/UI/LOGFILES/SKIPOPEN.DLV $
+
+ Rev 1.3 18 Dec 1992 11:22:56 chrish
+ Moved #include to dialogs.rc
+
+ Rev 1.2 06 Apr 1992 07:36:56 CARLS
+ added DLGINCLUDE
+
+ Rev 1.1 27 Jan 1992 00:43:08 CHUCKB
+ Updated dialog id's.
+
+ Rev 1.0 20 Nov 1991 19:19:06 SYSTEM
+ Initial revision.
+
+**************************************************************************/
+
+IDD_SKIPOPEN DIALOG 53, 67, 186, 50
+CAPTION "Skip Open Files Wait Time"
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+BEGIN
+ CONTROL "", IDD_SKIP_OPEN_WAIT_TIME, "STATIC", SS_RIGHT | WS_GROUP, 39, 19, 26, 8
+ CONTROL "seconds remaining", -1, "STATIC", SS_LEFT | WS_GROUP, 71, 19, 80, 8
+ CONTROL "Cancel", IDD_SKIP_CANCEL_BUTTON, "BUTTON", BS_DEFPUSHBUTTON | WS_TABSTOP, 71, 33, 39, 14
+ CONTROL "", IDD_SKIP_FILE_NAME, "STATIC", SS_CENTER | WS_GROUP, 7, 5, 173, 8
+END
+ \ No newline at end of file
diff --git a/private/utils/ntbackup/src/sleepwin.c b/private/utils/ntbackup/src/sleepwin.c
new file mode 100644
index 000000000..c1f61edaa
--- /dev/null
+++ b/private/utils/ntbackup/src/sleepwin.c
@@ -0,0 +1,85 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+
+ Name: sleepwin.c
+
+ Description: This function loops until the specified
+ number of thousandths of a second have
+ elapsed.
+
+ Note: Thousandths of seconds are used instead
+ of timer ticks so that this function
+ could be ported easily to other machines
+ or operating systems.
+
+
+ $Log: L:/LOGFILES/SLEEPWIN.C_V $
+
+ Rev 1.4 18 Aug 1992 10:06:36 BURT
+fix warnings
+
+ Rev 1.3 23 Jul 1992 12:15:20 STEVEN
+fix warnings
+
+ Rev 1.2 28 Oct 1991 13:53:18 STEVEN
+remove WM_MultiTask() prototype
+
+ Rev 1.1 18 Sep 1991 10:28:58 GREGG
+Added 'killtimer' function.
+
+ Rev 1.0 21 Jun 1991 13:12:52 STEVEN
+Initial revision.
+
+**/
+/* begin include list */
+
+#include <windows.h>
+
+#include "stdtypes.h"
+#include "sleep.h"
+/* $end$ include list */
+
+extern HANDLE ghInst ;
+
+WORD FAR PASCAL TimerFunc( HWND hwind, WORD msg, INT16 event, DWORD time ) ;
+
+static BOOLEAN mw_time_up ;
+
+VOID sleep( UINT32 thousandths )
+{
+ UINT16 loop_cnt ;
+ WORD hTimerInst;
+ static FARPROC pfTimerFunc = (FARPROC)0 ;
+
+ if ( ! pfTimerFunc ) {
+ pfTimerFunc = (FARPROC)MakeProcInstance( TimerFunc, ghInst ) ;
+ }
+
+ loop_cnt = (UINT16)(thousandths >> 16);
+
+ hTimerInst = SetTimer ( (HWND)NULL, 0, (UINT16)thousandths, (TIMERPROC)pfTimerFunc );
+
+ do {
+ mw_time_up = FALSE ;
+
+ if ( hTimerInst ) {
+ while( ! mw_time_up ) {
+ WM_MultiTask ();
+ }
+ }
+
+ } while( loop_cnt-- != 0 );
+
+ KillTimer ( (HWND)NULL, hTimerInst );
+}
+
+WORD FAR PASCAL TimerFunc(
+HWND hwind,
+WORD msg,
+INT16 event,
+DWORD time )
+{
+ mw_time_up = TRUE ;
+ return 0 ;
+}
diff --git a/private/utils/ntbackup/src/sources b/private/utils/ntbackup/src/sources
new file mode 100644
index 000000000..466bad038
--- /dev/null
+++ b/private/utils/ntbackup/src/sources
@@ -0,0 +1,392 @@
+#
+# Build SOURCES file for Nostradamus -- Microsoft's NTBACKUP application.
+#
+
+MAJORCOMP=utils
+MINORCOMP=ntbackup
+
+TARGETNAME=ntbackup
+TARGETPATH=obj
+TARGETTYPE=LIBRARY
+
+USE_CRTDLL=1
+#
+# If MSUNICODE is defined, a Unicode application will be built; otherwise
+# an ASCII version will be built.
+#
+# If MSDEBUG is not defined, we will build an application without msasserts.
+# If MSDEBUG is defined, we will build with memory manager debug code
+# and msasserts (with strings).
+# (For now, memory debug code is enabled only on x86 machines -- it
+# doesn't seem to work on MIPS/Alpha.)
+#
+# IMPORTANT!:
+# This SOURCES file also defines CONNER_SOFTWARE_BUILD. This places our
+# own E.R. and other info in the about box. This must not be checked in
+# literally at Microsoft.
+#
+
+PRODUCT_OPTIONS=-DOEM_EMS -DOEM_MSOFT -DMY40_TRANS -DMY31_TRANS -DSYPL10_TRANS -DNTKLUG
+
+OS_OPTIONS=-D_WIN32_ -DWIN32 -DOS_WIN32
+
+DEBUG_OPTIONS=-DMS_RELEASE
+
+UNICODE_OPTION=-DUNICODE
+
+FSYS=-DFS_NTFS -DFS_EMS
+
+#############################################################################
+
+!IF ("$(TDCOMMON)"=="")||("$(MBUDEV)"=="")
+INCLUDES=..\inc;..\exchange\inc;..\..\..\inc
+!ELSE
+INCLUDES=..\inc;..\exchange\build\inc;$(TDCOMMON)\inc;$(MBUDEV)\inc32;$(MBUDEV)\inc32\sys
+!ENDIF
+
+SOURCES= \
+ addbsd.c \
+ addfse.c \
+ addlba.c \
+ atachdle.c \
+ att_drv.c \
+ back_dle.c \
+ back_obj.c \
+ back_vcb.c \
+ be_debug.c \
+ be_dinit.c \
+ be_init.c \
+ be_tfutl.c \
+ bec_init.c \
+ bec_mem.c \
+ bec_misc.c \
+ bsdlasto.c \
+ bsdmatch.c \
+ bsdsinfo.c \
+ bsdthw.c \
+ buffman.c \
+ buffnt.c \
+ checksum.c \
+ clearfsl.c \
+ cli_stub.c \
+ confmisc.c \
+ critstub.c \
+ ctbrkstb.c \
+ d_about.c \
+ d_adv_us.c \
+ d_attach.c \
+ d_browse.c \
+ d_ctape.c \
+ d_date.c \
+ d_dbug.c \
+ d_erase.c \
+ d_o_bkup.c \
+ d_o_rset.c \
+ d_r_path.c \
+ d_t_pswd.c \
+ d_v_path.c \
+ datetime.c \
+ dateutil.c \
+ dblksize.c \
+ ddeproc.c \
+ debug.c \
+ defchan.c \
+ defltblk.c \
+ details.c \
+ detfmt.c \
+ dettpdrv.c \
+ dialmang.c \
+ dilnttp.c \
+ dilntmsc.c \
+ dledelet.c \
+ dleget.c \
+ dlereset.c \
+ dleupdat.c \
+ dlg_util.c \
+ dlm_draw.c \
+ dlm_init.c \
+ dlm_lbn.c \
+ dlm_proc.c \
+ dlm_scrn.c \
+ dlm_updt.c \
+ do_back.c \
+ do_cat.c \
+ do_del.c \
+ do_excl.c \
+ do_ffr.c \
+ do_misc.c \
+ do_next.c \
+ do_rest.c \
+ do_tens.c \
+ do_very.c \
+ docproc.c \
+ drives.c \
+ enc_tab.c \
+ encrypt.c \
+ eprintf.c \
+ erase.c \
+ filgetc.c \
+ fmttab.c \
+ font.c \
+ freplace.c \
+ frmproc.c \
+ fsecopy.c \
+ func_tab.c \
+ gen_tab.c \
+ gendblk.c \
+ get_vcb.c \
+ getres.c \
+ getstrm.c \
+ ginitfs.c \
+ global.c \
+ gmkdblk.c \
+ gmoddblk.c \
+ gname.c \
+ gsize.c \
+ gtnxtdle.c \
+ gtnxttpe.c \
+ gui.c \
+ helpmang.c \
+ hwcheck.c \
+ hwconfnt.c \
+ initfsys.c \
+ log.c \
+ logoproc.c \
+ lp_tdir.c \
+ lp_tens.c \
+ lpbackup.c \
+ lpdelete.c \
+ lplist.c \
+ lprestor.c \
+ lprintf.c \
+ lptools.c \
+ lptpcat.c \
+ lpverify.c \
+ lw_data.c \
+ lwtfinf.c \
+ mach_nt.c \
+ makecfdb.c \
+ makeudb.c \
+ makevcb.c \
+ mayn31rd.c \
+ mayn40rd.c \
+ mtf10wt.c \
+ mtf10wdb.c \
+ memang32.c \
+ memver.c \
+ menumang.c \
+ winassrt.c \
+ msgbox.c \
+ msmktemp.c \
+ mui.c \
+ muiconf.c \
+ muiutil.c \
+ myn40otc.c \
+ nothing.c \
+ ntfs_tab.c \
+ ntfslink.c \
+ ntfsregy.c \
+ ntfstemp.c \
+ ntfsutil.c \
+ ombatch.c \
+ omevent.c \
+ ommuibar.c \
+ openbsdu.c \
+ opensys.c \
+ otc40rd.c \
+ otc40wt.c \
+ otc40msc.c \
+ parspath.c \
+ passdb.c \
+ password.c \
+ polldrv.c \
+ posatset.c \
+ pwxface.c \
+ qtc_add.c \
+ qtc_back.c \
+ qtc_bset.c \
+ qtc_eom.c \
+ qtc_init.c \
+ qtc_srch.c \
+ qtc_util.c \
+ qtcxface.c \
+ queues.c \
+ tfread.c \
+ resmang.c \
+ rest_dle.c \
+ rest_obj.c \
+ ribproc.c \
+ runtime.c \
+ savepath.c \
+ scanbsd.c \
+ scomplex.c \
+ skipno.c \
+ skipopen.c \
+ sleepwin.c \
+ statline.c \
+ stats.c \
+ stdmath.c \
+ stdwcs.c \
+ stubfunc.c \
+ sx.c \
+ sypl10rd.c \
+ tattach.c \
+ tbdpars.c \
+ tbgetc.c \
+ tbnextok.c \
+ tbpdat.c \
+ tbprocsw.c \
+ tbrparse.c \
+ tchgdir.c \
+ tclose.c \
+ tcomplet.c \
+ tcreate.c \
+ tdelete.c \
+ tfbuffs.c \
+ tfclose.c \
+ tfeject.c \
+ tfinit.c \
+ tflutils.c \
+ tfopen.c \
+ tfpoll.c \
+ tfreten.c \
+ tfrewind.c \
+ tfstuff.c \
+ tftpcat.c \
+ tgetinfo.c \
+ tgetnext.c \
+ tgetpath.c \
+ tgetspec.c \
+ timers.c \
+ tinitfs.c \
+ tminddb.c \
+ tmkdblk.c \
+ tmoddblk.c \
+ tname.c \
+ topen.c \
+ tposmisc.c \
+ tprintf.c \
+ translat.c \
+ transutl.c \
+ treadobj.c \
+ tseekobj.c \
+ tsetinfo.c \
+ tsize.c \
+ tverinfo.c \
+ tverobj.c \
+ twritobj.c \
+ uadd_dle.c \
+ unicode.c \
+ unitinit.c \
+ very_dle.c \
+ very_obj.c \
+ viewproc.c \
+ vlm_bset.c \
+ vlm_cat.c \
+ vlm_disk.c \
+ vlm_file.c \
+ vlm_find.c \
+ vlm_init.c \
+ vlm_menu.c \
+ vlm_poll.c \
+ vlm_refr.c \
+ vlm_srch.c \
+ vlm_srv.c \
+ vlm_strt.c \
+ vlm_tape.c \
+ vlm_tree.c \
+ vlm_util.c \
+ vmstubs.c \
+ winmang.c \
+ tfwrite.c \
+ writescr.c \
+ yprintf.c \
+ zprintf.c \
+ xinitfs.c \
+ ems_tab.c \
+ d_o_xchg.c \
+ xattach.c \
+ xmoddblk.c \
+ xgetnext.c \
+ xgetpath.c \
+ xname.c \
+ xsize.c \
+ xchgdir.c \
+ xopen.c \
+ xcreate.c \
+ xreadobj.c \
+ xgetinfo.c \
+ xverinfo.c \
+ xsetinfo.c \
+ xclose.c \
+ xverobj.c \
+ xseekobj.c \
+ xwritobj.c \
+ xmkdblk.c \
+ vlm_xchg.c \
+ nostrad.rc
+#
+# NOTE: The following C_DEFINES definition determines whether the app is
+# compiled for ASCII/ANSI or Unicode. Use only one of these...
+#
+# Compile app for Unicode support...
+#
+#C_DEFINES= -DUNICODE -DUNIKLUG -D_WIN32_ -DWIN32 -DMS_RELEASE -DOS_WIN32 -DFS_NTFS -DMY40_TRANS -DMY31_TRANS -DNTKLUG -DOEM_MSOFT -DSTRICT
+#
+# Compile app for ASCII/ANSI support...
+#
+C_DEFINES= $(DEBUG_OPTIONS) $(UNICODE_OPTION) $(FSYS) $(PRODUCT_OPTIONS) $(OS_OPTIONS)
+
+UMTYPE=windows
+UMENTRY=winmain
+UMAPPL=ntbackup
+
+!IF ("$(TDCOMMON)"=="")||("$(MBUDEV)"=="")
+UMLIBS=obj\*\ntbackup.lib \
+$(BASEDIR)\public\sdk\lib\*\mpr.lib \
+$(BASEDIR)\public\sdk\lib\*\comdlg32.lib \
+$(BASEDIR)\public\sdk\lib\*\netapi32.lib \
+$(BASEDIR)\public\sdk\lib\*\ntlanman.lib \
+$(BASEDIR)\public\sdk\lib\*\rpcrt4.lib \
+$(BASEDIR)\public\sdk\lib\*\wsock32.lib \
+$(BASEDIR)\public\sdk\lib\*\ntctl3d.lib \
+$(BASEDIR)\public\sdk\lib\*\oldnames.lib \
+..\exchange\lib\*\sadapi.lib
+!ELSE
+!IF !$(386)
+UMLIBS=obj\*\ntbackup.lib \
+$(MBUDEV)\lib32\mpr.lib \
+$(MBUDEV)\lib32\comdlg32.lib \
+$(MBUDEV)\lib32\netapi32.lib \
+$(MBUDEV)\lib32\rpcrt4.lib \
+$(MBUDEV)\lib32\wsock32.lib \
+$(MBUDEV)\lib32\msvcrtd.lib \
+$(MBUDEV)\lib32\user32.lib \
+$(MBUDEV)\lib32\kernel32.lib \
+$(MBUDEV)\lib32\gdi32.lib \
+$(MBUDEV)\lib32\advapi32.lib \
+..\exchange\build\lib\*\ntlanman.lib \
+..\exchange\build\lib\*\ntctl3d.lib \
+$(TDCOMMON)\lib\win32\sadapi.lib
+!ELSE
+UMLIBS=obj\*\ntbackup.lib \
+$(MBUDEV)\lib32\mpr.lib \
+$(MBUDEV)\lib32\comdlg32.lib \
+$(MBUDEV)\lib32\netapi32.lib \
+$(MBUDEV)\lib32\rpcrt4.lib \
+$(MBUDEV)\lib32\wsock32.lib \
+$(MBUDEV)\lib32\crtdll.lib \
+$(MBUDEV)\lib32\user32.lib \
+$(MBUDEV)\lib32\kernel32.lib \
+$(MBUDEV)\lib32\gdi32.lib \
+$(MBUDEV)\lib32\int64.lib \
+$(MBUDEV)\lib32\advapi32.lib \
+..\exchange\build\lib\*\ntlanman.lib \
+..\exchange\build\lib\*\ntctl3d.lib \
+$(TDCOMMON)\lib\win32\sadapi.lib
+!ENDIF
+!ENDIF
+
+UMRES=obj\*\nostrad.res
+
+NTTARGETFILE0=bkuevent.h bkuevent.rc
diff --git a/private/utils/ntbackup/src/statline.c b/private/utils/ntbackup/src/statline.c
new file mode 100644
index 000000000..2d9f5bee4
--- /dev/null
+++ b/private/utils/ntbackup/src/statline.c
@@ -0,0 +1,396 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: statline.c
+
+ Description: This file contains the functions for the GUI Status Line
+ Manager (STM). The Status Line Manager displays information
+ on the status line. What else?
+
+ $Log: G:/UI/LOGFILES/STATLINE.C_V $
+
+ Rev 1.17 04 Aug 1993 18:44:14 MARINA
+enable c++
+
+ Rev 1.16 20 Jan 1993 19:54:56 MIKEP
+add nt memory display
+
+ Rev 1.15 01 Nov 1992 16:08:10 DAVEV
+Unicode changes
+
+ Rev 1.14 07 Oct 1992 15:10:38 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.13 04 Oct 1992 19:40:46 DAVEV
+Unicode Awk pass
+
+ Rev 1.12 10 Jul 1992 10:29:10 GLENN
+Changed the status line to be identical to the new file manager.
+
+ Rev 1.11 10 Jun 1992 16:14:38 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.10 29 May 1992 16:00:42 JOHNWT
+PCH updates
+
+ Rev 1.9 22 Apr 1992 17:53:32 GLENN
+Using MAX_STATUS_LINE_LEN for status line text length.
+
+ Rev 1.8 20 Apr 1992 13:48:38 GLENN
+Added status line get/set capability.
+
+ Rev 1.7 26 Mar 1992 08:44:48 JOHNWT
+don't display mem line unless app is up
+
+ Rev 1.6 03 Mar 1992 18:18:38 GLENN
+Updated draw text call.
+
+ Rev 1.5 23 Feb 1992 13:56:54 GLENN
+Removed right status box - not used at this time.
+
+ Rev 1.4 20 Jan 1992 13:09:56 MIKEP
+changes
+
+ Rev 1.3 26 Dec 1991 13:41:12 GLENN
+Changed show flags to use CDS calls
+
+ Rev 1.2 19 Dec 1991 15:25:14 GLENN
+Added windows.h
+
+ Rev 1.1 02 Dec 1991 17:51:36 DAVEV
+16/32 bit Windows port changes
+
+ Rev 1.0 20 Nov 1991 19:32:46 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// MODULE-WIDE VARIABLES
+
+static BOOL mwfMemoryText = FALSE;
+
+// PRIVATE FUNCTION PROTOTYPES
+
+VOID STM_Raised3D ( HDC, LPRECT );
+VOID STM_Recessed3D ( HDC, LPRECT );
+
+// FUNCTIONS
+
+
+/******************************************************************************
+
+ Name: STM_DrawBorder()
+
+ Description: This function draws a cool looking 3-D border with a
+ recessed area to frame the status line text.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID STM_DrawBorder ( VOID )
+
+{
+ HDC hDC;
+ RECT Rect;
+
+ if ( CDS_GetShowStatusLine ( CDS_GetPerm () ) ) {
+
+ hDC = GetDC ( ghWndFrame );
+
+ // Make the Status Line rectangle.
+
+ gpStatusRect = gRectFrameClient;
+
+ gpStatusRect.top = gRectFrameClient.bottom - STATUS_LINE_HEIGHT;
+ gpStatusRect.right = max ( gRectFrameClient.right, STATUS_TEXT );
+
+ Rect = gpStatusRect;
+
+ Rect.top += STATUS_BORDER + STATUS_HIGHLIGHT_WIDTH;
+ Rect.bottom -= STATUS_BORDER + STATUS_HIGHLIGHT_WIDTH;
+
+ // Give a raised 3-D look to the status line.
+
+ STM_Raised3D ( hDC, &gpStatusRect );
+
+ // Now make the text areas recessed.
+
+ Rect.left += STATUS_BORDER + STATUS_INDENT;
+ Rect.right = Rect.left + STATUS_TEXT;
+
+ STM_Recessed3D ( hDC, &Rect );
+
+ // The other Status Area is unused at this time.
+
+ // Rect.left += Rect.right + STATUS_BORDER;
+ // Rect.right = gRectFrameClient.right - STATUS_BORDER;
+
+ // STM_Recessed3D ( hDC, &Rect );
+
+ ReleaseDC ( ghWndFrame, hDC );
+
+ // Resize the status rectangle for drawing text inside the border.
+
+ gpStatusRect.top += ( STATUS_BORDER + STATUS_HIGHLIGHT_WIDTH + 1 );
+ gpStatusRect.bottom -= ( STATUS_BORDER + STATUS_HIGHLIGHT_WIDTH );
+ gpStatusRect.left += ( STATUS_INDENT + STATUS_BORDER + STATUS_TEXT_MARGIN );
+ gpStatusRect.right = ( STATUS_INDENT + STATUS_BORDER + STATUS_TEXT - STATUS_TEXT_MARGIN );
+ }
+
+} /* end STM_DrawBorder() */
+
+
+/******************************************************************************
+
+ Name: STM_DrawMemory()
+
+ Description: This function draws the current memory status on the status
+ line.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID STM_DrawMemory( VOID )
+{
+ // if the app has been displayed, show the memory usage
+
+ if ( ghWndFrame ) {
+
+#ifdef OS_WIN32
+ sprintf ( gszStatusLine,
+ TEXT( "Bytes: %10lu" ), gulMemUsed );
+#else
+ wsprintf ( gszStatusLine,
+ TEXT("Memory bytes: %lu in use; %lu allocated; %u segment(s)"),
+ gulMemUsed, gulMemAvail, gunSegCount );
+#endif
+
+ mwfMemoryText = TRUE;
+ STM_DrawText ( gszStatusLine );
+ mwfMemoryText = FALSE;
+
+ }
+
+} /* end STM_DrawMemory() */
+
+
+/******************************************************************************
+
+ Name: STM_DrawText()
+
+ Description: This function draws the specified text string on the status
+ line.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID STM_DrawText (
+
+LPSTR lpszText ) // I - pointer to a text string
+
+{
+ HDC hDC;
+
+ // If we are monitoring memory than don't display other messages.
+
+ if ( CDS_GetShowStatusLine ( CDS_GetPerm () ) && ( ! gfShowMemory || ( gfShowMemory && mwfMemoryText ) ) ) {
+
+ hDC = GetDC ( ghWndFrame );
+
+ FillRect ( hDC, &gpStatusRect, ghBrushLtGray );
+
+ // Default text color is black.
+
+ SelectObject ( hDC, ghFontStatus );
+ SelectObject ( hDC, ghBrushLtGray );
+
+ SetBkColor( hDC, GetSysColor ( COLOR_BTNFACE ) );
+
+ // If a RESOURCE ID was passed, copy the string from the resource.
+
+ if ( ! HIWORD(lpszText) ) {
+
+ RSM_StringCopy ( LOWORD((DWORD)lpszText),
+ gszStatusLine,
+ MAX_STATUS_LINE_LEN );
+
+ lpszText = gszStatusLine;
+ }
+
+ DrawText ( hDC, lpszText, -1, &gpStatusRect, DT_LEFT | DT_VCENTER | DT_SINGLELINE );
+
+ ReleaseDC( ghWndFrame, hDC );
+ }
+
+} /* end STM_DrawText() */
+
+
+/******************************************************************************
+
+ Name: STM_SetIdleText()
+
+ Description: This function extracts a text string from the resource file
+ based on the passed ID. It then displays this text
+ whenever the application is idle.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID STM_SetIdleText (
+
+WORD wTextID ) // I - resource text string ID.
+
+{
+ RSM_StringCopy ( wTextID, gszStatusLine, MAX_STATUS_LINE_LEN );
+ STM_DrawText ( gszStatusLine );
+
+} /* end STM_SetIdleText() */
+
+
+/******************************************************************************
+
+ Name: STM_Raised3D()
+
+ Description: This function draws a 3-D raised looking rectangle on
+ the status line.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID STM_Raised3D(
+
+HDC hDC,
+LPRECT pRect )
+
+{
+ FillRect ( hDC, pRect, ghBrushLtGray );
+
+ // Draw a black frame.
+
+ SelectObject ( hDC, ghPenBlack );
+
+ MoveToEx ( hDC, pRect->left, pRect->top, NULL );
+ LineTo ( hDC, pRect->right + 1, pRect->top );
+
+ // LineTo ( hDC, pRect->right, pRect->bottom );
+ // LineTo ( hDC, pRect->left, pRect->bottom );
+ // LineTo ( hDC, pRect->left, pRect->top );
+
+ // Draw the white highlights.
+
+ SelectObject ( hDC, ghPenWhite );
+
+ MoveToEx ( hDC, pRect->left, pRect->top + 1, NULL );
+ LineTo ( hDC, pRect->right, pRect->top + 1 );
+
+ // MoveToEx ( hDC, pRect->left + 2, pRect->bottom - 2, NULL );
+ // LineTo ( hDC, pRect->left + 2, pRect->top + 2 );
+ // LineTo ( hDC, pRect->right - 2, pRect->top + 2 );
+
+ // Draw the gray shadows.
+
+ // SelectObject ( hDC, ghPenDkGray );
+
+ // MoveToEx ( hDC, pRect->left + 2, pRect->bottom - 1, NULL );
+ // LineTo ( hDC, pRect->right - 1, pRect->bottom - 1 );
+ // LineTo ( hDC, pRect->right - 1, pRect->top + 1 );
+ // MoveToEx ( hDC, pRect->left + 3, pRect->bottom - 2, NULL );
+ // LineTo ( hDC, pRect->right - 2, pRect->bottom - 2 );
+ // LineTo ( hDC, pRect->right - 2, pRect->top + 2 );
+
+} /* end STM_Raised3D() */
+
+
+/******************************************************************************
+
+ Name: STM_Recessed3D()
+
+ Description: This function draws a 3-D recessed looking rectangle on
+ the status line.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID STM_Recessed3D (
+
+HDC hDC, // I - handle to a display device context
+LPRECT pRect ) // I - the rectangle to draw the 3-D recess in
+
+{
+ SelectObject ( hDC, ghPenDkGray );
+
+ MoveToEx ( hDC, pRect->left, pRect->bottom, NULL );
+ LineTo ( hDC, pRect->left, pRect->top );
+ LineTo ( hDC, pRect->right, pRect->top );
+
+ // MoveToEx ( hDC, pRect->left + 1, pRect->bottom - 1, NULL );
+ // LineTo ( hDC, pRect->left + 1, pRect->top + 1 );
+ // LineTo ( hDC, pRect->right - 1, pRect->top + 1 );
+
+ SelectObject ( hDC, ghPenWhite );
+
+ MoveToEx ( hDC, pRect->left + 1, pRect->bottom, NULL );
+ LineTo ( hDC, pRect->right, pRect->bottom );
+ LineTo ( hDC, pRect->right, pRect->top + 1 );
+
+ // MoveToEx ( hDC, pRect->left + 2, pRect->bottom - 1, NULL );
+ // LineTo ( hDC, pRect->right - 1, pRect->bottom - 1 );
+ // LineTo ( hDC, pRect->right - 1, pRect->top + 1 );
+
+} /* end STM_Recessed3D() */
+
+
+/******************************************************************************
+
+ Name: STM_GetStatusLineText()
+
+ Description: This function returns a pointer to the current status line
+ text string.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+LPSTR STM_GetStatusLineText ( VOID )
+
+{
+ return gszStatusLine;
+
+} /* end STM_GetStatusLineText() */
+
+
+/******************************************************************************
+
+ Name: STM_SetStatusLineText()
+
+ Description: This function returns a pointer to the current status line
+ text string.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID STM_SetStatusLineText (
+
+LPSTR pString )
+
+{
+ strncpy ( gszStatusLine, pString, MAX_STATUS_LINE_LEN );
+
+} /* end STM_SetStatusLineText() */
+
diff --git a/private/utils/ntbackup/src/stats.c b/private/utils/ntbackup/src/stats.c
new file mode 100644
index 000000000..537733d3b
--- /dev/null
+++ b/private/utils/ntbackup/src/stats.c
@@ -0,0 +1,360 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: stats.c
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/STATS.C_V $
+
+ Rev 1.5 26 Jul 1993 19:32:06 MARINA
+enable c++
+
+ Rev 1.4 07 Oct 1992 15:01:56 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.3 04 Oct 1992 19:40:50 DAVEV
+Unicode Awk pass
+
+ Rev 1.2 29 May 1992 16:03:44 JOHNWT
+PCH updates
+
+ Rev 1.1 29 Dec 1991 11:35:50 MIKEP
+remove msassert we were hitting
+
+ Rev 1.0 20 Nov 1991 19:34:34 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: ST_StartOperation()
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+VOID ST_StartOperation(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900 ;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+ memset( stats_ptr, 0, sizeof( STATS ) ) ;
+ ST_SetOPStartTime( stats_ptr, t_time ) ;
+
+ return ;
+
+}
+/*****************************************************************************
+
+ Name: ST_EndOperation()
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+VOID ST_EndOperation(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+ ST_SetOPEndTime( stats_ptr, t_time ) ;
+
+ return ;
+
+}
+/*****************************************************************************
+
+ Name: ST_StartOperationIdle()
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+VOID ST_StartOperationIdle(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+
+ if( ST_OPIdleLevel( stats_ptr ) == 0 ) {
+ ST_SetOPStartIdle( stats_ptr, t_time ) ;
+ }
+ else {
+ msassert( ST_GetOPStartIdle( stats_ptr ) != 0L ) ;
+ }
+
+ ST_PushOPIdleLevel( stats_ptr ) ;
+
+ return ;
+
+}
+/*****************************************************************************
+
+ Name: ST_EndOperationIdle()
+
+ Description:
+
+*****************************************************************************/
+VOID ST_EndOperationIdle(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+ if( ST_OPIdleLevel( stats_ptr ) == 1 ) {
+ ST_AddOPIdle( stats_ptr, ( UINT32 )( t_time - ST_GetOPStartIdle( stats_ptr ) ) ) ;
+ ST_SetOPStartIdle( stats_ptr, 0L ) ;
+ }
+
+ ST_PopOPIdleLevel( stats_ptr ) ;
+
+ return ;
+
+}
+/*****************************************************************************
+
+ Name: ST_StartBackupSet()
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+VOID ST_StartBackupSet(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+
+ memset( stats_ptr, 0, sizeof( STATS ) ) ;
+ ST_SetBSStartTime( stats_ptr, t_time ) ;
+
+ return ;
+
+}
+/*****************************************************************************
+
+ Name: ST_EndBackupSet()
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+VOID ST_EndBackupSet(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+
+ ST_SetBSEndTime( stats_ptr, t_time ) ;
+
+ return ;
+
+}
+/*****************************************************************************
+
+ Name: ST_StartBackupSetIdle()
+
+ Description:
+
+ Returns:
+*****************************************************************************/
+VOID ST_StartBackupSetIdle(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+
+ if( ST_BSIdleLevel( stats_ptr ) == 0 ) {
+ ST_SetBSStartIdle( stats_ptr, t_time ) ;
+ }
+ else {
+ msassert( ST_GetBSStartIdle( stats_ptr ) != 0L ) ;
+ }
+
+ ST_PushBSIdleLevel( stats_ptr ) ;
+
+ return ;
+
+}
+/*****************************************************************************
+
+ Name: ST_EndBackupSetIdle()
+
+ Description:
+
+ Returns:
+
+*****************************************************************************/
+VOID ST_EndBackupSetIdle(
+
+STATS_PTR stats_ptr )
+{
+ SYSTEMTIME loc_time ;
+ struct tm dos_time ;
+ time_t t_time ;
+
+ GetLocalTime( &loc_time ) ;
+
+ dos_time.tm_sec = loc_time.wSecond;
+ dos_time.tm_min = loc_time.wMinute ;
+ dos_time.tm_hour = loc_time.wHour ;
+ dos_time.tm_mday = loc_time.wDay ;
+ dos_time.tm_mon = loc_time.wMonth -1;
+ dos_time.tm_year = loc_time.wYear -1900;
+ dos_time.tm_isdst= -1 ;
+
+ t_time = mktime( &dos_time ) ;
+ if ( t_time == -1 ) {
+ t_time = 0 ;
+ }
+
+
+ if( ST_BSIdleLevel( stats_ptr ) == 1 ) {
+ ST_AddBSIdle( stats_ptr, ( UINT32 )( t_time - ST_GetBSStartIdle( stats_ptr ) ) ) ;
+ ST_SetBSStartIdle( stats_ptr, 0L ) ;
+ }
+
+ ST_PopBSIdleLevel( stats_ptr ) ;
+
+ return ;
+
+}
+
diff --git a/private/utils/ntbackup/src/stdmath.c b/private/utils/ntbackup/src/stdmath.c
new file mode 100644
index 000000000..95ecd11bf
--- /dev/null
+++ b/private/utils/ntbackup/src/stdmath.c
@@ -0,0 +1,1976 @@
+/**
+ $Header: T:/LOGFILES/STDMATH.C_V 1.19 21 Jul 1993 17:10:16 GREGG $
+ Name: stdmath.c
+
+ Description: To provide support functions for 64 bit unsigned manipulations.
+
+ $Log: T:/LOGFILES/STDMATH.C_V $
+
+ Rev 1.19 21 Jul 1993 17:10:16 GREGG
+Fixed and optimized U64_LitoA.
+
+ Rev 1.18 03 Mar 1993 14:15:26 DON
+Commented out local variable t_str to agree with commented out use of such variable
+
+ Rev 1.17 01 Mar 1993 16:37:02 TIMN
+Added header to resolve wide char function linking errors
+
+ Rev 1.16 17 Nov 1992 22:19:38 DAVEV
+unicode fixes
+
+ Rev 1.15 27 Oct 1992 21:09:20 GREGG
+Replaced mallocs of small chunks used for temporary storage in binary_divide
+with static arrays.
+Removed functions which are now implemented as macros in stdmath.h.
+Cleaned up and indented code.
+
+ Rev 1.14 08 Oct 1992 14:21:20 DAVEV
+Unicode strlen verfication
+
+ Rev 1.13 14 Aug 1992 09:56:16 BARRY
+Fixed warnings.
+
+ Rev 1.12 12 Aug 1992 17:55:52 BARRY
+Added max and min functions.
+
+ Rev 1.11 28 Jul 1992 15:39:16 STEVEN
+fix warnings
+
+ Rev 1.10 23 Jul 1992 16:44:32 STEVEN
+fix warnings
+
+ Rev 1.9 29 May 1992 13:05:20 BURT
+Fixed octal conversions for numbers > 32 bits. Added a function, and related
+logic, called U64_Commas() to specify the addition of commas to the resulting
+string for decimal conversions from UINT64 to ASCII string.
+
+
+ Rev 1.6 26 May 1992 10:13:10 MIKEP
+fixes to last change
+
+ Rev 1.5 26 May 1992 10:11:48 MIKEP
+fixes to last change
+
+ Rev 1.4 26 May 1992 09:30:54 BURT
+Added logic to U64_Div to perform 32 bit division in the event that
+the msws of arg1 and arg2 are both 0.
+
+Removed leading 0 from U64_Litoa decimal conversions, cut and paste
+strikes again.
+
+
+ Rev 1.3 17 Apr 1992 14:57:32 BURT
+Standardified the source code.
+
+
+ Rev 1.2 18 Mar 1992 16:09:26 BURT
+Cleaned up braces for if's and added type casts to constants
+again to ease port to NT.
+
+
+ Rev 1.1 18 Mar 1992 10:26:26 BURT
+Changed INT and INT_PTR to INT16 and INT16_PTR to make it easier
+to port to NT
+
+ Rev 1.0 7 Feb 1992 16:19:00 BURT
+ Initial revision.
+
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#ifdef STAND_ALONE
+#define NO_STD_HOOKS
+#endif
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdwcs.h"
+
+#include "msassert.h"
+
+/* TRUE if we want commas in the string (decimal only) */
+static BOOLEAN commas = FALSE ;
+
+static UINT64 mw_powers[] = {
+ { 0x89E80000L, 0x8AC72304L },
+ { 0xA7640000L, 0xDE0B6B3L },
+ { 0x5D8A0000L, 0x1634578L },
+ { 0x6FC10000L, 0x2386F2L },
+ { 0xA4C68000L, 0x38D7EL },
+ { 0x107A4000L, 0x5AF3L },
+ { 0x4E72A000L, 0x918L },
+ { 0xD4A51000L, 0xE8L },
+ { 0x4876E800L, 0x17L },
+ { 0x540BE400L, 0x2L },
+ { 0x3B9ACA00L, 0x0L },
+ { 0x5F5E100L, 0x0L },
+ { 0x989680L, 0x0L },
+ { 0xF4240L, 0x0L },
+ { 0x186A0L, 0x0L },
+ { 0x2710L, 0x0L },
+ { 0x3E8L, 0x0L },
+ { 0x64L, 0x0L },
+ { 0xAL, 0x0L } } ;
+
+
+/**/
+/**
+
+ Name: U64_Add()
+
+ Description: Adds 64 bit values arg1 and arg2. Returns result in
+ *result and returns TRUE if no overflow. Otherwise
+ returns FALSE and the value in *result reflects the
+ result of the overflow.
+
+ Entry: UINT64 arg1
+
+ UINT64 arg2
+
+ BOOLEAN_PTR status
+
+ Returns: UINT64 sum of arg1+arg2, Sets *status to TRUE if there
+ is no overflow, FALSE otherwise.
+
+**/
+
+UINT64 U64_Add(
+ UINT64 arg1, /* First 64 bit argument to add */
+ UINT64 arg2, /* Second 64 bit argument to add */
+ BOOLEAN_PTR status ) /* Error status */
+{
+ UINT32 temp1 ;
+ UINT64 result ;
+
+ /* Take sum of lsw. If it overflows we should be able to test for it
+ by comparing with each of the operands. If the sum is less than
+ either of the operands then we have overflow. In this case we will
+ add 1 to the msw.
+ */
+ temp1 = arg1.lsw + arg2.lsw ;
+ if( temp1 < arg1.lsw || temp1 < arg2.lsw ) { /* Handle case of carry */
+ result.lsw = arg1.lsw + arg2.lsw ;
+ result.msw = arg1.msw + arg2.msw + 1L ; /* Add in carry */
+
+ if( arg1.msw + 1L > arg1.msw ) {
+ /* Add here so we can test for possible overflow later */
+ arg1.msw += 1L ;
+ } else if( arg2.msw + 1L > arg2.msw ) {
+ /* else we don't need to add since we will overflow anyway. */
+ arg2.msw += 1L ;
+ }
+ } else {
+ /* Case of no carry on lsw */
+ result.lsw = arg1.lsw + arg2.lsw ;
+ result.msw = arg1.msw + arg2.msw ;
+ }
+
+ /* Take sum of msw. If it overflows we can test by comparing with each
+ of the operands. If the sum is less than either of the operands then
+ we have overflow. If we see overflow we will return FALSE in *status
+ to indicate that the value returned is an overflowed value.
+ */
+ temp1 = arg1.msw + arg2.msw ;
+ *status = TRUE ;
+ if( ( temp1 < arg1.msw ) || ( temp1 < arg2.msw ) ) {
+ *status = FALSE ;
+ }
+
+ return( result ) ;
+}
+
+
+/**/
+/**
+
+ Name: U64_Sub()
+
+ Description: Subtract arg2 from arg1 (arg1 - arg2) retunr the UINT64
+ result. Set *status TRUE if there was no underflow.
+ Otherwise set *status FALSE and the UINT64 value returned
+ reflects the underflow condition.
+
+ Entry: UINT64 arg1
+
+ UINT64 arg2
+
+ BOOLEAN_PTR status
+
+ Returns: UINT64 value which is arg1 - arg2, and sets *status to
+ TRUE if there was no underflow, else sets *status to
+ FALSE and the returned value reflects the underflow.
+
+**/
+
+UINT64 U64_Sub(
+ UINT64 arg1, /* 64 bit argument */
+ UINT64 arg2, /* 64 bit argument */
+ BOOLEAN_PTR status ) /* Error status */
+{
+ UINT64 result ;
+
+ result.msw = result.lsw = 0L ;
+
+ /* see if we will have underflow */
+ if( arg1.msw < arg2.msw ) {
+ *status = FALSE ;
+ return( result ) ;
+ }
+
+ /* Subtract the msw portions. */
+ result.msw = arg1.msw - arg2.msw ;
+
+ /* Do lsw subtraction and let it uflow */
+ result.lsw = arg1.lsw - arg2.lsw ;
+
+ if( arg1.lsw < arg2.lsw ) {
+ /* Need to borrow from .msw, the .lsw has done an implied borrow
+ from the 'bit bank' already so we just need to fix .msw
+ */
+ if( result.msw == 0L ) {
+ *status = FALSE ;
+ return( result ) ;
+ } else {
+ result.msw-- ;
+ }
+ }
+ *status = TRUE ;
+ return( result ) ;
+}
+
+
+/**/
+/**
+
+ Name: U64_To_32Bit()
+
+ Description: Converts a 64 bit entity to 2 UINT32s. The 64 Bit value
+ is passed in arg1 and the lsw and msw are returned in
+ *lsw and *msw respectively.
+
+ Entry: UINT64 arg1 64 bit argument
+
+ UINT32_PTR lsw Pointer to 32 bit least significant
+ portion.
+
+ UINT32_PTR msw Pointer to 32 bit most significant
+ portion.
+
+ Returns: TRUE and sets *lsw and *msw accordingly.
+
+**/
+
+BOOLEAN U64_To_32Bit(
+ UINT64 arg1, /* 64 bit argument */
+ UINT32_PTR lsw, /* Pointer to least significant 32 bits */
+ UINT32_PTR msw ) /* Pointer to most significant 32 bits */
+{
+ *lsw = arg1.lsw ;
+ *msw = arg1.msw ;
+ return( TRUE ) ;
+}
+
+
+/**/
+/**
+
+ Name: U32_To_U64()
+
+ Description: Enters with a 32 bit value in arg. Returns a 64 Bit
+ result that consists of the msw set to 0L and the lsw
+ set to the 32 bit argument.
+
+ Entry: UINT32 arg
+
+ Returns: UINT64 value with msw set to 0L and lsw set to arg.
+
+**/
+
+UINT64 U32_To_U64(
+ UINT32 arg ) /* 32 bit argument */
+{
+ UINT64 result ;
+
+ result.lsw = arg ;
+ result.msw = 0L ;
+ return( result ) ;
+}
+
+
+/**/
+/**
+
+ Name: U64_Test()
+
+ Description: Returns non-zero if any of the specified bits are set.
+
+ Entry: UINT64 arg
+
+ UINT32 lsw_mask Least significant 32 bits to test.
+
+ UINT32 msw_mask Most significant 32 bits to test.
+
+ Returns: UINT32 0 if none of the specified bits are set.
+ Otherwise returns a non-zero value.
+
+**/
+
+UINT32 U64_Test(
+ UINT64 arg, /* 64 bit argument */
+ UINT32 lsw_mask, /* Least significant 32 bits of mask */
+ UINT32 msw_mask ) /* Most significant 32 bits of mask */
+{
+ return( (arg.lsw & lsw_mask) | (arg.msw & msw_mask) ) ;
+}
+
+
+/**/
+/**
+
+ Name: U64_Stest()
+
+ Description: Returns non-zero if any of the specified bits are set.
+
+ Entry: UINT64 arg
+
+ CHAR_PTR mask 'C' string representation of 64 bit mask.
+ May be Hex, Octal (and eventually) Decimal.
+
+ Returns: UINT32 0 if none of the specified bits are set.
+ Otherwise returns a non-zero value.
+
+**/
+
+UINT32 U64_Stest(
+ UINT64 arg, /* 64 bit argument */
+ CHAR_PTR mask ) /* Pointer to TEXT('C') string representation of mask */
+{
+ BOOLEAN status ;
+ UINT64 tui64 ;
+
+ /* First we need to convert the value in mask to a UINT64 and then
+ we can test the arg with it.
+ */
+ tui64 = U64_Atoli( mask, &status ) ;
+
+ return( ( arg.lsw & tui64.lsw ) | ( arg.msw & tui64.msw ) ) ;
+}
+
+
+/**/
+
+/* Defines used by U64_Btop() and related Macros */
+
+#define CLR_64BIT 0
+#define SET_64BIT 1
+#define XOR_64BIT 2
+#define OR_64BIT 3
+#define AND_64BIT 4
+#define NOT_64BIT 5
+/* Shift operations */
+#define SHL_64BIT 6
+#define SHR_64BIT 7
+
+/**
+
+ Name: U64_Btop()
+
+ Description: Does 64 Bit manipulations. Clear, Set, Xor, Or, And,
+ Shift Left and Shift Right. NOTE: These are all
+ unsigned operations. So pay attention if you attempt
+ to use this with signed 64 Bit entities. Sets or clears
+ bits in the UINT64 arg based on the value passed in lws
+ and msw_mask and operation. If operation == CLR_64BIT
+ then the specified bits will be cleared. If
+ operation == SET_64BIT then the bits will be set. If
+ operation == XOR_64BIT then the bits will be exclusive
+ OR'd. Likewise for OR_64BIT and AND_64BIT.
+
+ Entry: UINT64 arg 64 Bit argument to be operated on.
+
+ UINT32 lsw_mask Least significant 32 bits to operate
+ on.
+
+ UINT32 msw_mask Most significant 32 bits to operate
+ on. NOTE: lsw_mask and msw_mask have
+ no meaning to shift left or right.
+
+ INT16 operation Requested operation.
+
+ INT16 shift_count Number of bits to shift by. Values
+ outside of the range of 1 - 63 are
+ ignored. shift_count has no meaning
+ for operations other than shift left
+ and right.
+
+ Returns: UINT64 value that is the result of applying the requested
+ operation to arg.
+
+**/
+
+UINT64 U64_Btop(
+ UINT64 arg, /* 64 bit argument */
+ UINT32 lsw_mask, /* 32 bit least significant 32 bits of mask */
+ UINT32 msw_mask, /* 32 bit most significant 32 bits of mask */
+ INT operation, /* Operation to be performed */
+ INT shift_count ) /* Number of bits for shift operations */
+{
+ switch( operation ) {
+
+ case CLR_64BIT: /* Clears the bits specified in the masks */
+ arg.lsw &= ~lsw_mask ;
+ arg.msw &= ~msw_mask ;
+ break ;
+
+ case NOT_64BIT: /* Bitwise NOT operation */
+ arg.lsw = ~arg.lsw ;
+ arg.msw = ~arg.msw ;
+ break ;
+
+ case XOR_64BIT: /* Exclusive OR the bits specified in the masks */
+ arg.lsw ^= lsw_mask ;
+ arg.msw ^= msw_mask ;
+ break ;
+
+ case SET_64BIT: /* Sets the bits specified in the masks */
+ case OR_64BIT : /* OR is the same as setting the bits */
+ arg.lsw |= lsw_mask ;
+ arg.msw |= msw_mask ;
+ break ;
+
+ case AND_64BIT: /* Ands the bits specified in the masks */
+ arg.lsw &= lsw_mask ;
+ arg.msw &= msw_mask ;
+ break ;
+
+ case SHR_64BIT: /* Shifts the bits right by shift count number */
+ if( shift_count > 0 && shift_count < (INT16)64 ) {
+ if( shift_count == (INT16)32 ) {
+ arg.lsw = arg.msw ;
+ arg.msw = 0L ;
+
+ } else if( shift_count > (INT16)32 ) {
+ arg.lsw = arg.msw ;
+ arg.lsw >>= ( shift_count - (INT16)32 ) ;
+ arg.msw = 0L ;
+
+ } else {
+ UINT32 t = 0x80000000L ;
+ INT16 i ;
+
+ arg.lsw >>= shift_count ;
+ t = ( t >> ( shift_count - (INT16)1 ) ) ;
+ for( i = 0; i < shift_count; i++ ) {
+ if( arg.msw & 0x01 ) {
+ /* We need to place this bit in the appropriate
+ position in the lsw.
+ */
+ arg.lsw |= t ;
+ }
+ t <<= 1;
+ arg.msw >>= (INT16)1 ;
+ }
+ }
+ }
+ break ;
+
+ case SHL_64BIT: /* Shifts the bits left by shift_count number */
+ if( shift_count > 0 && shift_count < (INT16)64 ) {
+ if( shift_count == (INT16)32 ) {
+ arg.msw = arg.lsw ;
+ arg.lsw = 0L ;
+
+ } else if( shift_count > (INT16)32 ) {
+ arg.msw = arg.lsw ;
+ arg.msw <<= ( shift_count - (INT16)32 ) ;
+ arg.lsw = 0L ;
+
+ } else {
+ UINT32 t = ( 1L << ( shift_count - (INT16)1 ) ) ;
+ INT16 i ;
+
+ arg.msw <<= shift_count ;
+ for( i = 0; i < shift_count; i++ ) {
+ if( arg.lsw & 0x80000000L ) {
+ /* We need to place this bit in the appropriate
+ position in the msw.
+ */
+ arg.msw |= t ;
+ }
+ t >>= (INT16)1 ;
+ arg.lsw <<= (INT16)1 ;
+ }
+ }
+ }
+ break ;
+
+ default:
+ break ;
+
+ } /* End of switch */
+
+ return( arg ) ;
+}
+
+
+/**/
+
+/* Some macros to make life easier for the different bit wise functions */
+
+#define U64_CLR( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), CLR_64BIT, 0 )
+
+#define U64_SET( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), SET_64BIT, 0 )
+
+#define U64_XOR( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), XOR_64BIT, 0 )
+
+#define U64_OR( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), OR_64BIT, 0 )
+
+#define U64_AND( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), AND_64BIT, 0 )
+
+#define U64_NOT( arg, mask ) \
+ U64_Btop( (arg), ( U64_Lsw( mask ) ), ( U64_Msw( mask ) ), NOT_64BIT, 0 )
+
+/* Shift operations */
+#define U64_SHL( arg, shift_count ) \
+ U64_Btop( (arg), 0L, 0L, SHL_64BIT, (shift_count) )
+
+#define U64_SHR( arg, shift_count ) \
+ U64_Btop( (arg), 0L, 0L, SHR_64BIT, (shift_count) )
+
+
+/**/
+
+/**
+
+ Name: U64_Init()
+
+ Description: A fast 'constructor' for a UINT64. Takes two UINT32 args
+ and initializes a temporary UINT64. Returns a UINT64.
+
+ Entry: UINT32 lsw
+
+ UINT32 msw
+
+ Returns: UINT64 value that consists of msw and lsw.
+
+**/
+
+UINT64 U64_Init(
+ UINT32 lsw, /* Least significant 32 bits */
+ UINT32 msw ) /* Most significnat 32 bits */
+{
+ UINT64 result ;
+
+ result.lsw = lsw ;
+ result.msw = msw ;
+ return( result ) ;
+}
+
+
+/**/
+/**
+
+ Name: U64_Atoli()
+
+ Description: A slower, but more flexible, 'constructor' for a UINT64.
+ Takes a 'C' string that may be a Decimal, Hex or Octal
+ number and converts it to a UINT64.
+
+ Entry: CHAR_PTR arg
+
+ BOOLEAN_PTR status
+
+ Returns: UINT64 value that is the 64 bit value represented by the
+ 'C' string. Sets *status to TRUE if there was no error
+ during the conversion. Uses standard C conversion
+ functions to do the work where possible.
+
+ NOTE: If the number of Hex digits is > 16 it is an error.
+ If the number of Dec digits is > 20 it is an error.
+ If the number of Oct digits is > 22 it is an error.
+
+**/
+
+UINT64 U64_Atoli(
+ CHAR_PTR arg, /* Pointer to TEXT('C') string that is the Decimal,
+ Hex or Octal representation of the desired
+ 64 bit number.
+ */
+ BOOLEAN_PTR status ) /* Pointer to completion status */
+{
+ UINT64 result ;
+ CHAR buffer[32] ; /* Biggest number of digits */
+
+ *status = TRUE ;
+ *buffer = TEXT('\0') ;
+ result.lsw = 0L ;
+ result.msw = 0L ;
+
+ if( *arg == TEXT('0') && toupper(*(arg+1)) == TEXT('X') ) {
+ if( strlen( arg + 2 ) > 16 ) { /* If we are too many digits croak */
+ *status = FALSE ;
+ return( result ) ;
+ }
+
+ /* Assume that it is hex for now */
+ if( strlen( arg + 2 ) < 9 ) {
+ result.msw = 0L ;
+ sscanf( arg, TEXT("%lX"), &result.lsw ) ;
+
+ } else {
+ /* We have to do 64 bit conversion. The lower 8 bytes go
+ into lsw and the upper n - 8 bytes go into msw.
+ */
+
+ INT tlen = strlen( arg + 2 ) ; /* Get number of digits */
+
+ strcpy( buffer, TEXT("0x") ) ;
+ strcat( buffer, arg + 2 + (tlen - 8) ) ;
+
+ sscanf( buffer, TEXT("%lX"), &result.lsw ) ;
+ strcpy( buffer, arg ) ;
+ *( buffer + 2 + ( tlen - 8 ) ) = TEXT('\0') ;
+ sscanf( buffer, TEXT("%lX"), &result.msw ) ;
+ }
+
+ } else if( *arg == TEXT('0') ) {
+ /* Assume Octal */
+ if( strlen( arg + 1 ) > 22 ) { /* If we are too many digits croak */
+ *status = FALSE ;
+ return( result ) ;
+ }
+ if( strlen( arg + 1 ) < 11 ||
+ ( strlen( arg + 1 ) == 11 && *( arg + 1 ) < TEXT('4') ) ) {
+
+ /* Only 32 bit so it is easy */
+ result.msw = 0L ;
+ sscanf( arg, TEXT("%lO"), &result.lsw ) ;
+
+ } else {
+ /* We have to do 64 bit conversion. */
+ INT tlen ;
+ CHAR temp[2] ;
+ CHAR temp1[2] ;
+
+ temp[0] = 0 ;
+ temp[1] = 0 ;
+ temp1[0] = 0 ;
+ temp1[1] = 0 ;
+ tlen = strlen( arg + 1 ) ; /* Get number of digits */
+ strcpy( buffer, TEXT("0") ) ;
+
+ /* Get the high order octal digit */
+ *temp = arg[ 1 + (tlen - 11)] ;
+
+ /* If this is more than 2 bits we need to keep the low order
+ 2 bits for the lsw and save the high order bit to be added
+ to the bottom of the msw.
+ */
+ if( *temp > TEXT('3') ) {
+ *temp1 = *temp & (CHAR)0x03;
+ *temp1 = *temp1 + (CHAR)TEXT('0') ;
+ strcat( buffer, temp1 ) ;
+
+ if( ( *temp & 0x04 ) == 0x04 ) {
+ *temp = TEXT('1') ;
+ }
+
+ } else {
+ *temp = TEXT('\0') ;
+ }
+
+ strcat( buffer, arg + 1 + ( tlen - 11 ) ) ;
+ sscanf( buffer, TEXT("%lO"), &result.lsw ) ;
+ strcpy( buffer, arg ) ;
+ buffer[ 1 + ( tlen - 11 ) ] = TEXT('\0') ;
+ sscanf( buffer, TEXT("%lO"), &result.msw ) ;
+
+ if( *temp != TEXT('\0') ) {
+ result.msw <<= 1 ; /* Shift left by 1 */
+ result.msw |= 1L ; /* Add in LSBit from lsw MSBit */
+
+ } else {
+ result.msw <<= 1 ;
+ result.msw &= ~0x00000001L ; /* Kill the low order bit */
+ }
+ }
+
+ } else { /* Must be 64 bit decimal conversion */
+
+ /* Here we must do real work since we don't have as easy a way to
+ scale and convert decimal numbers.
+ */
+
+ UINT64 factor ;
+ UINT64 temp ;
+ UINT64 ten ;
+ BOOLEAN stat ;
+ INT16 arg_index = strlen( arg ) ;
+
+ result.lsw = 0 ;
+ result.msw = 0 ;
+ factor.lsw = 10L ;
+ factor.msw = 0 ;
+ ten.lsw = 10L ;
+ ten.msw = 0 ;
+
+ if( arg_index > 20 ) {
+ *status = FALSE ;
+ return( result ) ;
+ }
+
+ if( arg_index <= 0 ) {
+ *status = TRUE ;
+ return( result ) ;
+ }
+
+ arg_index-- ; /* Index to the last byte in the string LSB */
+
+ if( isdigit( arg[arg_index] ) ) {
+ result.lsw = arg[arg_index] - TEXT('0') ;
+
+ } else {
+ *status = FALSE ;
+ return( result ) ;
+ }
+
+ --arg_index ;
+ while( arg_index >= 0 ) {
+ if( isdigit( arg[arg_index] ) ) {
+ temp.lsw = arg[arg_index] - TEXT('0') ;
+ } else {
+ *status = FALSE ;
+ return( result ) ;
+ }
+ temp.msw = 0 ;
+ result = U64_Add( result, U64_Mult( temp, factor ), &stat ) ;
+ factor = U64_Mult( factor, ten ) ;
+ --arg_index ;
+ }
+ /* When we get here we should have the conversion in result */
+ *status = TRUE ; /* Should be fine now */
+
+ }
+
+ return( result ) ;
+}
+
+
+/**/
+
+CHAR_PTR mstrncat( CHAR_PTR target, CHAR_PTR source, INT num )
+{
+ INT16 i ;
+
+ i = strlen( target ) ;
+
+ while( num ) {
+ target[i] = *source ;
+ ++i;
+ ++source ;
+ --num ;
+ }
+ target[i] = TEXT('\0') ;
+ return( target ) ;
+}
+
+
+/**/
+/**
+
+ Name: U64_Litoa()
+
+ Description: Convert a UINT64 argument to a 'C' ASCII string.
+
+ Entry: UINT64 arg 64 bit value to be converted.
+
+ CHAR_PTR string Pointer to char array to hold result.
+
+ INT16 base Number base to convert to. 8 - Octal,
+ 10 - decimal, 16 - Hex.
+
+ BOOLEAN_PTR status Holds status of conversion operation.
+
+ Returns: CHAR_PTR to string. The string will have the ASCII
+ representation of arg and *status will be set to TRUE
+ unless there is an error. If there is an error *string
+ will be set to '\0' and *status will be set to FALSE.
+
+ NOTE: Currently up to 64 bit values may be handled in Octal
+ and Hex and up to 32 bit values in decimal. *status
+ will be set FALSE if a decimal value greater than 32
+ bits would result from the conversion.
+
+**/
+
+CHAR_PTR U64_Litoa(
+ UINT64 arg, /* 64 bit argument to be converted. */
+ CHAR_PTR string, /* Pointer to character array to hold result */
+ INT16 base, /* Base to convert to. Dec, Hex, Oct. */
+ BOOLEAN_PTR status ) /* Pointer to completion status */
+{
+ CHAR work_str[32] ; /* Holds comma'fied string */
+ INT16 index ;
+ BOOLEAN did_decimal = FALSE ;
+
+ *status = TRUE ;
+
+ if( string != NULL ) {
+ *string = TEXT('\0') ;
+ } else {
+ *status = FALSE ;
+ return( NULL ) ;
+ }
+
+
+ if( arg.msw != 0L ) {
+ if( base == 16 ) {
+ sprintf( string, TEXT("0x%lx%08.8lx"), arg.msw, arg.lsw ) ;
+
+ } else if( base == 8 ) {
+ INT temp;
+
+ temp = (INT16)arg.msw & 0x1 ;
+ temp <<= 2 ;
+ temp |= (INT16)((arg.lsw & 0xC0000000L) >> 30) ;
+
+ arg = U64_CLR( arg, U64_Init( 0xC0000000, 0 ) ) ;
+ arg.msw >>= 1 ; /* Shift off low order bit */
+
+ sprintf( string, TEXT("0%lo%d%lo"), arg.msw, temp, arg.lsw ) ;
+
+ } else {
+
+ UINT64 temp ;
+ UINT64 remainder ;
+ BOOLEAN stat ;
+ INT16 i ;
+
+ /* Find the first power of ten which is smaller than arg. */
+ for( i = 0; i < 19; i++ ) {
+ if( U64_LT( mw_powers[i], arg ) ) {
+ break ;
+ }
+ }
+
+ /* Start dividing by powers of ten, placing the result in
+ the string.
+ */
+ for( ; i < 19; i++ ) {
+ temp = U64_Div( arg, mw_powers[i], &remainder, &stat ) ;
+ sprintf ( &string[strlen(string)], TEXT("%ld"), temp.lsw ) ;
+ arg = remainder ; /* Use the remainder */
+ }
+
+ /* Must add the remainder in, this is the Least
+ significant digit.
+ */
+ sprintf ( &string[strlen(string)], TEXT("%ld"), arg.lsw ) ;
+ did_decimal = TRUE ;
+ *status = TRUE ;
+ }
+
+ } else { /* Process 16 and 32 bit flavors (lsw only) */
+ if( base == 16 ) {
+ sprintf( string, TEXT("0x%lx"), arg.lsw ) ;
+ } else if ( base == 10 ) {
+ did_decimal = TRUE ;
+ sprintf( string, TEXT("%lu"), arg.lsw ) ;
+ } else {
+ sprintf( string, TEXT("0%lo"), arg.lsw ) ;
+ }
+ }
+
+ /* If we wanted commas and we did decimal numbers */
+ if( commas && did_decimal ) {
+ INT16 t ;
+
+ if( strlen( string ) > 3 ) {
+
+ /* Need a copy of the string to work with */
+ strcpy( work_str, string ) ;
+ memset( string, 0, strsize( work_str ) ) ;
+
+ /* Now start with the LSB and work backwards, every 3rd
+ char insert a ','.
+ */
+ index = 0 ;
+ t = strlen( work_str ) % 3 ;
+ if( t == 0 ) {
+
+ /* Need to copy 3 bytes, add ',' and repeat until done */
+ strncpy( string, work_str, 3 ) ;
+ strcat( string, TEXT(",") ) ;
+ index += 3 ;
+
+ } else if( t == 2 ) {
+ strncpy( string, work_str, 2 ) ;
+ strcat( string, TEXT(",") ) ;
+ index += 2 ;
+
+ } else if( t == 1 ) {
+ strncpy( string, work_str, 1 ) ;
+ strcat( string, TEXT(",") ) ;
+ index++ ;
+ }
+
+ while( index <= (INT16)( strlen( work_str ) - 3 ) ) {
+
+ mstrncat( string, &work_str[index], 3 ) ;
+
+ if( index != (INT16)( strlen( work_str ) - 3 ) ) {
+ strcat( string, TEXT(",") ) ;
+ }
+
+ index += 3 ;
+ }
+ }
+ }
+
+ return( string ) ;
+}
+
+
+/**/
+/**
+
+ Name: bshift()
+
+ Description: Binary shift for 64 Bit numbers.
+
+ Entry: UINT16_PTR src Pointer to the bytes to be shifted.
+
+ INT16 num Number of bits to be shifted.
+
+ UINT16_PTR dest Pointer to the location to hold the
+ result of the shift operation.
+
+ INT16 carry Initial Carry to be factored into the
+ shift operation.
+
+ INT16 size Number of bytes in source and dest.
+
+ Returns: INT16 Carry out from shift. The result of the shift is
+ placed at the location pointed to by dest.
+
+**/
+
+static INT16 bshift(
+ UINT16_PTR src, /* Source bytes to be shifted */
+ INT num, /* Number of bits to shift */
+ UINT16_PTR dest, /* Destination storage */
+ UINT carry, /* Initial carry to be shifted in */
+ INT size ) /* Number of bytes in src and dest */
+{
+ unsigned long accumulator ;
+ INT16 i ;
+
+ if( num == 0 ) {
+ memmove( dest, src, size * sizeof( *src ) ) ;
+ return( 0 ) ;
+ }
+
+ accumulator = carry ;
+ for( i = little_end(size) ; not_msd( i, size ) ; i = next_msd( i ) ) {
+ accumulator |= (unsigned long) src[i] << num ;
+ dest[i] = (UINT16)(accumulator & mask_low16) ;
+ accumulator = accumulator >> 16 ;
+ }
+ return( (UINT16)accumulator ) ;
+}
+
+
+/**/
+/**
+
+ Name: binary_divide()
+
+ Description: Low level binary division for 2 64 Bit numbers.
+
+ Entry: UINT16_PTR arg1 Pointer to the 64 bit (quad
+ word) dividend. Treated as an
+ array of 16 bit entities to
+ ease the manipulations.
+
+ UINT16_PTR arg2 Pointer to the 64 bit (quad
+ word) divisor. Handled as an
+ array of 16 bit entities to
+ ease the manipulations.
+
+ UINT16_PTR quotient Pointer to the 64 bit quotient
+ (result) of the division. Also
+ handled as an array of 16 bit
+ entities.
+
+ UINT16_PTR remainder Pointer to the 64 bit remainder
+ of the division. You guessed
+ it, handled as an array of 16
+ bit entities.
+
+ INT16 arg1_size Size of arg1 in bytes.
+
+ INT16 arg2_size Size of arg2 in bytes.
+
+ Returns: UINT16 status of operation. The result of the division
+ is placed at the location pointed to by quotient and
+ remainder.
+
+**/
+
+INT16 binary_divide(
+ UINT16_PTR arg1,
+ UINT16_PTR arg2,
+ UINT16_PTR quotient,
+ UINT16_PTR remainder,
+ INT arg1_size,
+ INT arg2_size )
+{
+ UINT32 qhat ;
+ UINT32 rhat ;
+ UINT32 accumulator ;
+ UINT16 buff1[16] ; /* holds arg1_size BYTES (currently max 32) */
+ UINT16 buff2[8] ; /* holds arg2_size BYTES (currently max 16) */
+ UINT16_PTR temp1 = buff1 ;
+ UINT16_PTR temp2 = buff2 ;
+ UINT16_PTR u0 ;
+ UINT16_PTR u1 ;
+ UINT16_PTR u2 ;
+ UINT16_PTR v0 ;
+ INT16 d ;
+ INT16 qn ;
+ INT16 i ;
+ INT16 j ;
+
+ /* If this assert fails, you need to increase the size of the buff
+ arrays
+ */
+ msassert( arg1_size <= 32 && arg2_size <= 16 ) ;
+
+ arg1_size /= sizeof( *arg1 ) ;
+ arg2_size /= sizeof( *arg2 ) ;
+ qn = arg1_size - arg2_size ;
+
+ /* Remove leading zero digits from divisor, and the same number of
+ digits (which must be zero) from dividend.
+ */
+
+ while( arg2[big_end(arg2_size)] == 0 ) {
+ remainder[big_end( arg2_size )] = 0 ;
+
+ arg1 += little_end( 2 ) ;
+ arg2 += little_end( 2 ) ;
+ remainder += little_end( 2 ) ;
+ arg1_size-- ;
+ arg2_size-- ;
+
+ /* Check for zero divisor. */
+ if( arg2_size == 0 ) {
+ return( U64_DIVZ ) ;
+ }
+ }
+
+ /* If divisor is a single digit, do short division. */
+
+ if( arg2_size == 1 ) {
+ accumulator = arg1[big_end( arg1_size )] ;
+ arg1 += little_end( 2 ) ;
+ for( j = big_end( qn ) ; not_lsd( j, qn ) ; j = next_lsd( j ) ) {
+ accumulator = (accumulator << 16) | arg1[j] ;
+ quotient[j] = (UINT16)(accumulator / *arg2) ;
+ accumulator = accumulator % *arg2 ;
+ }
+ *remainder = (UINT16)(accumulator) ;
+ return( U64_OK ) ;
+ }
+
+ /* Gotta do long division. Shift divisor and dividend left until the
+ high bit of the divisor becomes 1.
+ */
+
+ for( d = 0 ; d < 16 ; d++ ) {
+ if( arg2[big_end( arg2_size )] & ( 1 << ( 16 - 1 - d ) ) ) {
+ break ;
+ }
+ }
+
+ bshift ( arg1, d, temp1, 0, arg1_size ) ;
+ bshift ( arg2, d, temp2, 0, arg2_size ) ;
+
+ /* Get pointers to the high dividend and divisor digits. */
+
+ u0 = temp1 + big_end( arg1_size ) - big_end( qn ) ;
+ u1 = next_lsd( u0 ) ;
+ u2 = next_lsd( u1 ) ;
+ temp1 += little_end( 2 ) ;
+
+ v0 = temp2 + big_end( arg2_size ) ;
+
+ /* Main loop: find a quotient digit, multiply it by the divisor, and
+ subtract that from the dividend, shifted over the right amount.
+ */
+
+ for( j = big_end( qn ) ; not_lsd( j, qn ) ; j = next_lsd( j ) ) {
+
+ /* Quotient digit initial guess: high 2 dividend digits over high
+ divisor digit.
+ */
+ if( u0[j] == *v0 ) {
+ qhat = B - 1 ;
+ rhat = (UINT32) *v0 + u1[j] ;
+
+ } else {
+ UINT32 numerator = ((UINT32)u0[j] << 16) | u1[j] ;
+
+ qhat = numerator / *v0 ;
+ rhat = numerator % *v0 ;
+ }
+
+ /* Now get the quotient right for high 3 dividend digits over high
+ 2 divisor digits.
+ */
+
+ while( rhat < B &&
+ qhat * *next_lsd (v0) > ( ( rhat << 16 ) | u2[j] ) ) {
+
+ qhat -= 1 ;
+ rhat += *v0 ;
+ }
+
+ /* Multiply quotient by divisor, subtract from dividend. */
+
+ accumulator = 0 ;
+ for( i = little_end( arg2_size ) ; not_msd( i, arg2_size ) ;
+ i = next_msd( i ) ) {
+
+ accumulator += (UINT32)(temp1 + j)[i] - temp2[i] * qhat ;
+ (temp1 + j)[i] = (UINT16)(accumulator & mask_low16) ;
+ if(accumulator < B) {
+ accumulator = 0 ;
+ } else {
+ accumulator = (accumulator >> 16) | -B ;
+ }
+ }
+
+ quotient[j] = (UINT16)(qhat) ;
+
+ /* Quotient may have been too high by 1. If dividend went
+ negative, decrement the quotient by 1 and add the divisor back.
+ */
+
+ if( (INT32)(accumulator + u0[j]) < 0 ) {
+ quotient[j] -= 1 ;
+ accumulator = 0 ;
+ for( i = little_end( arg2_size ) ; not_msd( i, arg2_size ) ;
+ i = next_msd( i ) ) {
+
+ accumulator += (UINT32)(temp1 + j)[i] + temp2[i] ;
+ (temp1 + j)[i] = (UINT16)(accumulator & mask_low16) ;
+ accumulator = accumulator >> 16 ;
+ }
+ }
+ }
+
+ /* Now the remainder is what's left of the dividend, shifted right by
+ by the amount of the normalizing left shift at the top.
+ */
+
+ remainder[big_end( arg2_size )] =
+ bshift( temp1 + 1 + little_end( j - 1 ), 16 - d,
+ remainder + little_end( 2 ),
+ temp1[little_end( arg1_size - 1 )] >> d,
+ arg2_size - 1 ) ;
+
+ return( U64_OK ) ;
+}
+
+
+/**/
+
+/* Some defines for status returns from the Division and Mod operations */
+
+#define U64_OK 0
+#define U64_BAD_DIV 1
+#define U64_OVRFL 2
+#define U64_UNDFL 3
+#define U64_DIVZ 4
+
+/**
+
+ Name: U64_Div()
+
+ Description: Divide 2 64 Bit numbers and return result, remainder and
+ status of operation.
+
+ Entry: UINT64 arg1 The 64 bit (quad word) dividend.
+
+ UINT64 arg2 The 64 bit (quad word) divisor.
+
+ UINT64_PTR remainder The 64 bit remainder of the
+ division.
+
+ INT_PTR status One of the defined values
+ reporting the status of the
+ division.
+
+ Returns: UINT64 value that is the result of the division.
+ (arg1 / arg2), sets *remainder to the UINT64 value of
+ the remainder of the division operation and sets *status
+ to U64_OK if no error otherwise sets *status to one of
+ the defined error values.
+
+**/
+
+UINT64 U64_Div(
+ UINT64 arg1, /* 64 bit dividend */
+ UINT64 arg2, /* 64 bit divisor */
+ UINT64_PTR remainder, /* Pointer to 64 bit remainder */
+ INT16_PTR status ) /* Pointer to completion status */
+{
+ UINT32 accumulator[2][2] ; /* Allow for a 128 bit accumulator */
+ UINT32 bwork[2] ;
+ UINT32 quotient[2] ;
+ UINT32 rwork[2] ;
+ long_64 work ;
+ long_64 temp1 ;
+ long_64 temp2 ;
+
+ temp1.big_long = arg1 ;
+ temp2.big_long = arg2 ;
+
+ accumulator[HIGH][HIGH] = 0 ;
+ accumulator[HIGH][LOW] = 0 ;
+ accumulator[LOW][HIGH] = temp1.s.high ;
+ accumulator[LOW][LOW] = temp1.s.low ;
+ bwork[HIGH] = temp2.s.high ;
+ bwork[LOW] = temp2.s.low ;
+
+ *status = binary_divide( (UINT16_PTR)&accumulator[0][0],
+ (UINT16_PTR)bwork, (UINT16_PTR)quotient,
+ (UINT16_PTR)rwork, sizeof( accumulator ),
+ sizeof( bwork ) ) ;
+
+ remainder->lsw = rwork[LOW] ; /* Update the remainder */
+ remainder->msw = rwork[HIGH] ;
+
+ work.s.high = quotient[HIGH] ;
+ work.s.low = quotient[LOW] ;
+
+ return( work.big_long ) ;
+}
+
+
+/**/
+/**
+
+ Name: U64_Mod()
+
+ Description: Mod function. arg1 % arg2. Returns UINT64 result that
+ is the remainder of the division.
+
+ Entry: UINT64 arg1
+
+ UINT64 arg2
+
+ INT16_PTR status
+
+ Returns: UINT64 value that is the remainder of arg1 / arg2. Sets
+ *status to U64_OK if no error else sets *status to a
+ defined error value.
+
+**/
+
+UINT64 U64_Mod(
+ UINT64 arg1, /* 64 bit dividend argument */
+ UINT64 arg2, /* 64 bit divisor argument */
+ INT16_PTR status ) /* Pointer to completion status */
+{
+ UINT32 accumulator[2][2] ; /* Allow for a 128 bit accumulator */
+ UINT32 bwork[2] ;
+ UINT32 quotient[2] ;
+ UINT32 remainder[2] ;
+ long_64 work ;
+ long_64 temp1 ;
+ long_64 temp2 ;
+
+ temp1.big_long = arg1 ;
+ temp2.big_long = arg2 ;
+
+ accumulator[HIGH][HIGH] = 0 ;
+ accumulator[HIGH][LOW] = 0 ;
+ accumulator[LOW][HIGH] = temp1.s.high ;
+ accumulator[LOW][LOW] = temp1.s.low ;
+ bwork[HIGH] = temp2.s.high ;
+ bwork[LOW] = temp2.s.low ;
+
+ /* Do the division */
+ *status = binary_divide( (UINT16_PTR)accumulator, (UINT16_PTR)bwork,
+ (UINT16_PTR)quotient, (UINT16_PTR)remainder,
+ sizeof( accumulator ), sizeof( bwork ) ) ;
+
+ work.s.high = remainder[HIGH] ;
+ work.s.low = remainder[LOW] ;
+
+ return( work.big_long ) ;
+}
+
+
+/**/
+/**
+
+ Name: binary_mult()
+
+ Description: Binary 64 bit multiplication. Places the result of the
+ multiplication of arg1 * arg2 in result.
+
+ Entry: UINT64 arg1 Treated as an array of 16 bit
+ entities to ease manipulation.
+
+ UINT64 arg2 Treated as an array of 16 bit
+ entities to ease manipulation.
+
+ Returns: Nothing. The result of the multiplication is placed in
+ memory pointed to by result.
+
+**/
+
+static VOID binary_mult(
+ UINT16_PTR arg1,
+ UINT16_PTR arg2,
+ UINT16_PTR result,
+ INT m,
+ INT n )
+{
+ INT16 i ;
+ INT16 j ;
+ UINT32 accumulator ;
+
+ memset( result, 0, ( m + n ) ) ; /* Zero the bytes */
+
+ m /= sizeof( *arg1 ) ;
+ n /= sizeof( *arg2 ) ;
+
+ for( j = little_end( n ) ; not_msd( j, n ) ; j = next_msd( j ) ) {
+
+ UINT16_PTR c1 = result + j + little_end( 2 ) ;
+
+ accumulator = 0 ;
+ for( i = little_end( m ) ; not_msd( i, m ) ; i = next_msd( i ) ) {
+
+ /* Widen before arithmetic to avoid loss of high bits. */
+ accumulator += (UINT32)arg1[i] * arg2[j] + c1[i] ;
+ c1[i] = (UINT16)(accumulator & mask_low16) ;
+ accumulator = accumulator >> 16 ;
+ }
+ c1[i] = (UINT16)(accumulator) ;
+ }
+}
+
+
+/**/
+/**
+
+ Name: U64_Mult()
+
+ Description: 64 bit multiply function. arg1 * arg2.
+
+ Entry: UINT64 arg1
+
+ UINT64 arg2
+
+ Returns: UINT64 value that is the result of arg1 * arg2.
+
+**/
+
+UINT64 U64_Mult(
+ UINT64 arg1,
+ UINT64 arg2 )
+{
+ INT32 accumulator[2] ;
+ INT32 bwork[2] ;
+ INT32 c[2][2] ;
+ long_64 work ;
+ long_64 temp1 ;
+ long_64 temp2 ;
+
+ temp1.big_long = arg1 ;
+ temp2.big_long = arg2 ;
+
+ accumulator[HIGH] = temp1.s.high ;
+ accumulator[LOW] = temp1.s.low ;
+ bwork[HIGH] = temp2.s.high ;
+ bwork[LOW] = temp2.s.low ;
+
+ /* Do the multiply */
+ binary_mult( (UINT16_PTR)accumulator, (UINT16_PTR)bwork,
+ (UINT16_PTR)c, sizeof( accumulator ), sizeof( bwork ) ) ;
+
+ work.s.high = c[LOW][HIGH] ;
+ work.s.low = c[LOW][LOW] ;
+
+ return( work.big_long ) ;
+}
+
+
+/**
+
+ Name: U64_Commas()
+
+ Description: Specifies if the string returned by Litoa() for decimal
+ conversions has commas (',') in it. If action is set to
+ TRUE then the resulting decimal string will be of the
+ form 'nnn,nnn,nnn' If action is set to FALSE then the
+ resulting decimal string will be of the form
+ 'nnnnnnnnn'. Octal and Hex conversions are not affected.
+ The default is FALSE (no commas in the string).
+
+ Entry: BOOLEAN action
+
+
+ Returns: Nothing. Sets and internal flag that tells Litoa() to
+ include or omit commas from the converted decimal string.
+
+**/
+
+VOID U64_Commas(
+ BOOLEAN action )
+{
+ commas = action ;
+}
+
+
+/**/
+
+#ifdef STAND_ALONE
+
+/**
+
+ Name: main()
+
+ Description: Used to test this module in a stand alone mode. I.e.
+ without needing to link with another application.
+
+ Entry: None.
+
+ Returns: Nothing. Prints results to stdin.
+
+**/
+
+VOID main()
+{
+ UINT64 t1, t2, t3, t4, save_t1, save_t2 ;
+ INT16 RetVal ;
+ BOOLEAN bRetVal ;
+ CHAR buffer[64], buffer2[64] ;
+ UINT64 arg1, arg2, result, remainder ;
+ INT16 status ;
+
+#ifdef INTER_ACT
+
+ CHAR value[128] ;
+
+ U64_Commas( TRUE ) ; /* Want commas in dec out strings */
+ while( 1 ) {
+ printf( TEXT("Enter the number to be converted (Enter alone to exit) >") ) ;
+
+ gets( value ) ;
+ if( *value == TEXT('\0') ) {
+ exit(1) ;
+ }
+ printf( TEXT("Converting %s to UINT64\n"), value ) ;
+ t1 = U64_Atoli( value, &bRetVal ) ;
+
+ printf( TEXT("Raw t1 = %08lX:%08lX\n"), t1.msw, t1.lsw ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Atoli()\n") ) ;
+ }
+
+ printf( TEXT("t1 = %s Decimal\n"), U64_Litoa( t1, buffer2, 10, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+ printf( TEXT("t1 = %s Octal\n"), U64_Litoa( t1, buffer2, 8, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+ printf( TEXT("t1 = %s Hex\n"), U64_Litoa( t1, buffer2, 16, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+ printf( TEXT("\n") ) ;
+ }
+
+#else /* INTER_ACT not defined */
+
+ t1 = U64_Atoli( TEXT("1000000000"), &bRetVal ) ;
+ printf( TEXT("t1 = %08lX:%08lX\n"), t1.msw, t1.lsw ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Atoli()\n") ) ;
+ }
+
+ printf( TEXT("Converting 1000000000003 to UINT64\n") ) ;
+ t1 = U64_Atoli( TEXT("1000000000003"), &bRetVal ) ;
+ printf( TEXT("t1 = %08lX:%08lX\n"), t1.msw, t1.lsw ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Atoli()\n") ) ;
+ }
+
+ printf( TEXT("t1 = %s\n"), U64_Litoa( t1, buffer2, 10, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+
+
+
+ arg1.msw = 0x02 ;
+ arg1.lsw = 0x04 ;
+
+ arg2.msw = 0x01 ;
+ arg2.lsw = 0x00 ;
+
+ printf( TEXT("Dividing %08lX:%08lXh by %08lX:%08lX\n"),
+ arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+
+ result = U64_Div( arg1, arg2, &remainder, &status ) ;
+
+ printf( TEXT("Result is %08lX:%08lXh\n"), result.msw, result.lsw ) ;
+
+
+ arg1.msw = 0x01 ;
+ arg1.lsw = 0x0000 ;
+
+ arg2.msw = 0x00 ;
+ arg2.lsw = 0x002 ;
+
+ printf( TEXT("Dividing %08lX:%08lXh by %08lX:%08lX\n"),
+ arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+
+ result = U64_Div( arg1, arg2, &remainder, &status ) ;
+
+ printf( TEXT("Result is %08lX:%08lXh\n"), result.msw, result.lsw ) ;
+
+ printf( TEXT("Mod of %08lX:%08lXh by %08lX:%08lX\n"),
+ arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+
+ result = U64_Mod( arg1, arg2, &status ) ;
+
+ printf( TEXT("Result is %08lX:%08lXh\n"), result.msw, result.lsw ) ;
+
+ arg1.msw = 0x01 ;
+ arg1.lsw = 0x0000 ;
+
+ arg2.msw = 0x00 ;
+ arg2.lsw = 0x003 ;
+
+ printf( TEXT("Dividing %08lX:%08lXh by %08lX:%08lX\n"),
+ arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+
+ result = U64_Div( arg1, arg2, &remainder, &status ) ;
+
+ printf( TEXT("Result is %08lX:%08lXh\n"), result.msw, result.lsw ) ;
+
+ printf( TEXT("Mod of %08lX:%08lXh by %08lX:%08lX\n"),
+ arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+
+ result = U64_Mod( arg1, arg2, &status ) ;
+
+ printf( TEXT("Result is %08lX:%08lXh\n\n"), result.msw, result.lsw ) ;
+
+
+ arg1.msw = 0x01 ;
+ arg1.lsw = 0x0000 ;
+
+ arg2.msw = 0x00 ;
+ arg2.lsw = 0x003 ;
+
+ printf( TEXT("Mult of %08lX:%08lXh by %08lX:%08lX\n"),
+ arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT("%s dec * %s dec\n"), U64_Litoa( arg1, buffer2, 10, &bRetVal ),
+ U64_Litoa( arg2, buffer2, 10, &bRetVal ) ) ;
+
+ result = U64_Mult( arg1, arg2 ) ;
+
+
+ printf( TEXT("Result is %08lX:%08lXh\n"), result.msw, result.lsw ) ;
+
+
+ t1 = U64_Atoli( TEXT("0x0000000F80000001"), &bRetVal ) ;
+ if( U64_Stest( t1, TEXT("0x0000000000000000") ) != 0L ) {
+ printf( TEXT("Bits are set\n") ) ;
+ } else {
+ printf( TEXT("Bits are not set\n") ) ;
+ }
+
+ t1 = U64_Atoli( TEXT("0x0000000F80000001"), &bRetVal ) ;
+ printf( TEXT("t1 = %sH\n"), U64_Litoa( t1, buffer2, 16, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+
+ printf( TEXT("t1 = %sD\n"), U64_Litoa( t1, buffer2, 10, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+ printf( TEXT("t1 = %sO\n"), U64_Litoa( t1, buffer2, 8, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+
+ t1 = U64_Atoli( TEXT("0x0000000000000001"), &bRetVal ) ;
+ printf( TEXT("t1 = %sH\n"), U64_Litoa( t1, buffer2, 16, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+
+ t1 = U64_Atoli( TEXT("0x000000FFF0000000001"), &bRetVal ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Atoli()\n") ) ;
+ }
+ printf( TEXT("t1 = %sH\n"), U64_Litoa( t1, buffer2, 16, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+ printf( TEXT("t1 = %sD\n"), U64_Litoa( t1, buffer2, 10, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+ printf( TEXT("t1 = %sO\n"), U64_Litoa( t1, buffer2, 8, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+
+ t1 = U64_Atoli( TEXT("0x00000000F0000001"), &bRetVal ) ;
+ printf( TEXT("t1 = %sH\n"), U64_Litoa( t1, buffer2, 16, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+
+ printf( TEXT("t1 = %sD\n"), U64_Litoa( t1, buffer2, 10, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+ printf( TEXT("t1 = %sO\n"), U64_Litoa( t1, buffer2, 8, &bRetVal ) ) ;
+ if( bRetVal == FALSE ) {
+ printf( TEXT("Error returned from Litoa()\n") ) ;
+ }
+
+ t1 = U64_Init( 0x00000043L, 0x00000001L ) ;
+ /* 3 % 4 */
+ printf( TEXT("67 Mod 4 = %04X\n"), 67 % 4 ) ;
+ t2 = U64_Init( 0x00000004L, 0x00000000L ) ;
+ save_t1 = t1 ;
+ save_t2 = t2 ;
+ printf( TEXT("(%sH / %sH) = "), U64_Litoa( t1, buffer, 16, &bRetVal ),
+ U64_Litoa( t2, buffer2, 16, &bRetVal ) ) ;
+
+ t4 = U64_Div( t1, t2, &t3, &RetVal ) ;
+ printf( TEXT("%sH\n"), U64_Litoa( t4, buffer, 16, &bRetVal ) ) ;
+ printf( TEXT("Remainder = %sH and status = %d\n"),
+ U64_Litoa( t3, buffer, 16, &bRetVal ), RetVal ) ;
+
+ t1 = U64_Init( 0x00000000L, 0x00000001L ) ;
+ t1 = U64_Init( 0x00000043L, 0x00000001L ) ;
+ /* 3 % 4 */
+ printf( TEXT("67 Mod 2 = %04X\n"), 67 % 2 ) ;
+ t2 = U64_Init( 0x00000002L, 0x00000000L ) ;
+ save_t1 = t1 ;
+ save_t2 = t2 ;
+ printf( TEXT("(%sH / %sH) = "), U64_Litoa( t1, buffer, 16, &bRetVal ),
+ U64_Litoa( t2, buffer2, 16, &bRetVal ) ) ;
+
+ t4 = U64_Div( t1, t2, &t3, &RetVal ) ;
+ printf( TEXT("%sH\n"), U64_Litoa( t4, buffer, 16, &bRetVal ) ) ;
+ printf( TEXT("Remainder = %sH and status = %d\n"),
+ U64_Litoa( t3, buffer, 16, &bRetVal ), RetVal ) ;
+
+ t1 = U64_Atoli( TEXT("0x0000000100000043"), &bRetVal ) ;
+ /* 3 % 4 */
+ printf( TEXT("Divide by 0\n") ) ;
+ t2 = U64_Atoli( TEXT("0x0000000000000000"), &bRetVal ) ;
+ printf( TEXT("(%sH / %sH) = "), U64_Litoa( t1, buffer, 16, &bRetVal ),
+ U64_Litoa( t2, buffer2, 16, &bRetVal ) ) ;
+
+ t4 = U64_Div( t1, t2, &t3, &RetVal ) ;
+ printf( TEXT("%sH\n"), U64_Litoa( t4, buffer, 16, &bRetVal ) ) ;
+ printf( TEXT("Remainder = %sH and status = %d\n"),
+ U64_Litoa( t3, buffer, 16, &bRetVal ), RetVal ) ;
+
+ t1 = U64_Atoli( TEXT("0x0000000100000043"), &bRetVal ) ;
+ printf( TEXT("Divide by 1\n") ) ;
+ t2 = U64_Atoli( TEXT("0x0000000000000001"), &bRetVal ) ;
+ printf( TEXT("(%sH / %sH) = "), U64_Litoa( t1, buffer, 16, &bRetVal ),
+ U64_Litoa( t2, buffer2, 16, &bRetVal ) ) ;
+
+ t4 = U64_Div( t1, t2, &t3, &RetVal ) ;
+ printf( TEXT("%sH\n"), U64_Litoa( t4, buffer, 16, &bRetVal ) ) ;
+ printf( TEXT("Remainder = %sH and status = %d\n"),
+ U64_Litoa( t3, buffer, 8, &bRetVal ), RetVal ) ;
+
+ t1 = U64_Atoli( TEXT("0x0000000100000043"), &bRetVal ) ;
+ printf( TEXT("t1 == t2\n") ) ;
+ t2 = U64_Atoli( TEXT("0x0000000100000043"), &bRetVal ) ;
+ printf( TEXT("(%sH / %sH) = "), U64_Litoa( t1, buffer, 16, &bRetVal ),
+ U64_Litoa( t2, buffer2, 16, &bRetVal ) ) ;
+
+ t4 = U64_Div( t1, t2, &t3, &RetVal ) ;
+ printf( TEXT("%sH\n"), U64_Litoa( t4, buffer, 16, &bRetVal ) ) ;
+ printf( TEXT("Remainder = %sH and status = %d\n"),
+ U64_Litoa( t3, buffer, 16, &bRetVal ), RetVal ) ;
+
+ t1 = U64_Atoli( TEXT("0x0000000000000008"), &bRetVal ) ;
+ t2 = U64_Atoli(TEXT("0x0000000000000002"), &bRetVal ) ;
+ t1 = save_t1 ;
+ t2 = save_t2 ;
+ printf( TEXT("(%sH %c %sH) = "), U64_Litoa( t1, buffer, 16, &bRetVal ), TEXT('%'),
+ U64_Litoa( t2, buffer2, 16, &bRetVal ) ) ;
+
+ t4 = U64_Mod( t1, t2, &RetVal ) ;
+ printf( TEXT("%sH and status = %d\n"), U64_Litoa( t4, buffer, 16, &bRetVal ),
+ RetVal ) ;
+
+
+ t1 = U64_Atoli(TEXT("0x0001000110001000"), &bRetVal ) ;
+
+ printf( TEXT("UINT64 t1 = %sH before setting bits 62 and 2\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+
+ t1 = U64_SET( t1, U64_Init( 0x00000002L, 0x40000000L ) ) ;
+ printf( TEXT("UINT64 t1 = %sH after set bits 62 and 2\n\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+
+ t1 = U64_Atoli(TEXT("0x4000002001010002"), &bRetVal ) ;
+ printf( TEXT("UINT64 t1 = %sH before clear bits 62 and 2\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+ t1 = U64_CLR( t1, U64_Init( 0x00000002L, 0x40000000L ) ) ;
+ printf( TEXT("UINT64 t1 = %sH after clear bits 62 and 2\n\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+
+ // Now check out the bit test
+ if( U64_Test( t1, 0x00000002L, 0x40000000L ) != 0L ) {
+ printf( TEXT("The bits are set\n") ) ;
+ } else {
+ printf( TEXT("The bits are not set\n") ) ;
+ }
+
+ t1 = U64_SET( t1, U64_Init( 0x00000002L, 0x40000000L ) ) ;
+ printf( TEXT("UINT64 t1 = %sH after set bits 62 and 2\n\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+
+ // Now check out the bit test
+ if( U64_Test( t1, 0x00000002L, 0x40000000L ) != 0L ) {
+ printf( TEXT("The bits are set\n") ) ;
+ } else {
+ printf( TEXT("The bits are not set\n") ) ;
+ }
+
+ t1 = U64_XOR( t1, U64_Init( 0x00000002L, 0x00000000L ) ) ;
+ printf( TEXT("UINT64 t1 = %sH after XOR bit 2\n\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+
+ t1 = U64_XOR( t1, U64_Init( 0x00000002L, 0x00000000L ) ) ;
+ printf( TEXT("UINT64 t1 = %sH after XOR bit 2 again\n\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+
+ t1 = U64_Atoli(TEXT("0x0000000100000002"), &bRetVal ) ;
+ t2 = U64_Atoli( TEXT("0x0000000000000000"), &bRetVal ) ;
+
+ printf( TEXT("Testing Subtraction\n") ) ;
+
+ {
+ INT16 i ;
+ BOOLEAN bRetVal1 ;
+
+ for( i = 0; i < 64; i++ ) {
+ printf( TEXT("(%2d) (%08lX%08lX - "), i, t1.msw, t1.lsw ) ;
+ printf( TEXT("%08lX%08lX) = "), t2.msw,t2.lsw ) ;
+ t3 = U64_Sub( t1, t2, &bRetVal ) ;
+ printf( TEXT("%sH %s\n"), U64_Litoa( t3, buffer, 16, &bRetVal1 ),
+ bRetVal == TRUE ? TEXT("") : TEXT("Uflw") ) ;
+ t2 = U64_SHL( t2, 1 ) ;
+ if( i == 0 ) {
+ t2 = U64_SET( t2, U64_Init( 0x01L, 0x0L ) ) ;
+ }
+ }
+ printf( TEXT("\n") ) ;
+
+ t1 = U64_Atoli( TEXT("0x0000000100000002"), &bRetVal ) ;
+ t2 = U64_Atoli( TEXT("0x0000000000000000"), &bRetVal ) ;
+
+ printf( TEXT("Testing Addition\n") ) ;
+
+ for( i = 0; i < 64; i++ ) {
+ printf( TEXT("(%2d) (%08lX%08lX + "), i, t1.msw, t1.lsw ) ;
+ printf( TEXT("%08lX%08lX) = "), t2.msw,t2.lsw ) ;
+ t3 = U64_Add( t1, t2, &bRetVal ) ;
+ printf( TEXT("%sH %s\n"), U64_Litoa( t3, buffer, 16, &bRetVal1 ),
+ bRetVal == TRUE ? TEXT("") : TEXT("Ovfl")) ;
+ t2 = U64_SHL( t2, 1 ) ;
+ if( i == 0 ) {
+ t2 = U64_SET( t2, U64_Init( 0x01L, 0x0L ) ) ;
+ }
+ }
+
+ printf( TEXT("\nTesting Left Shift\n") ) ;
+
+ for ( i = 0; i <= 64; i++ ) {
+ t1 = U64_Atoli( TEXT("0x0000000000000001"), &bRetVal ) ;
+ printf( TEXT("%sH is "), U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+ t1 = U64_SHL( t1, i ) ;
+ printf( TEXT("%sH after SHL by %2d\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal1 ),i ) ;
+ }
+
+ printf( TEXT("Testing Right Shift\n") ) ;
+ for ( i = 0; i <= 64; i++ ) {
+ t1 = U64_Atoli( TEXT("0x8000000000000000"), &bRetVal ) ;
+ printf( TEXT("%sH is "), U64_Litoa( t1, buffer, 16, &bRetVal ) ) ;
+ t1 = U64_SHR( t1, i ) ;
+ printf( TEXT("%sH after SHR by %2d\n"),
+ U64_Litoa( t1, buffer, 16, &bRetVal1 ), i ) ;
+ }
+ } /* End of local block */
+
+#endif /* INTER_ACT */
+
+
+ printf( TEXT("Testing Comparisons\n") ) ;
+
+ arg1.msw = 0L ;
+ arg1.lsw = 0L ;
+ arg2.msw = 0L ;
+ arg2.lsw = 0L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+ arg1.msw = 5L ;
+ arg1.lsw = 0L ;
+ arg2.msw = 0L ;
+ arg2.lsw = 0L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+ arg1.msw = 0L ;
+ arg1.lsw = 5L ;
+ arg2.msw = 0L ;
+ arg2.lsw = 0L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+ arg1.msw = 0L ;
+ arg1.lsw = 0L ;
+ arg2.msw = 5L ;
+ arg2.lsw = 0L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+ arg1.msw = 0L ;
+ arg1.lsw = 0L ;
+ arg2.msw = 0L ;
+ arg2.lsw = 5L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+ arg1.msw = 1L ;
+ arg1.lsw = 5L ;
+ arg2.msw = 1L ;
+ arg2.lsw = 5L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+ arg1.msw = 2L ;
+ arg1.lsw = 5L ;
+ arg2.msw = 1L ;
+ arg2.lsw = 5L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+ arg1.msw = 1L ;
+ arg1.lsw = 5L ;
+ arg2.msw = 2L ;
+ arg2.lsw = 5L ;
+ printf( TEXT("arg1: %08lX : %08lX arg2: %08lX : %08lX\n"), arg1.msw, arg1.lsw, arg2.msw, arg2.lsw ) ;
+ printf( TEXT(" U64_EQ returned: %d\n"), U64_EQ( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_NE returned: %d\n"), U64_NE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LT returned: %d\n"), U64_LT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GT returned: %d\n"), U64_GT( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_LE returned: %d\n"), U64_LE( arg1, arg2 ) ) ;
+ printf( TEXT(" U64_GE returned: %d\n"), U64_GE( arg1, arg2 ) ) ;
+ t1 = U64_Min( arg1, arg2 ) ;
+ printf( TEXT(" U64_Min returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+ t1 = U64_Max( arg1, arg2 ) ;
+ printf( TEXT(" U64_Max returned: %08lX : %08lX\n"), t1.msw, t1.lsw ) ;
+
+}
+
+#endif
diff --git a/private/utils/ntbackup/src/stdwcs.c b/private/utils/ntbackup/src/stdwcs.c
new file mode 100644
index 000000000..ee3af8836
--- /dev/null
+++ b/private/utils/ntbackup/src/stdwcs.c
@@ -0,0 +1,902 @@
+/** Copyright (C) Maynard Electronics, An Archive Company. 1992
+
+ Name: STDWCS.C
+
+ Description:
+
+ Contains wide string functions, unicode mapping functions,
+ unicode comparison functions and memory functions. The file
+ is divided into the sections as outline here.
+
+ MIKEP-note,
+ Wide string functions for using unicode strings under MSC 6.0
+ and not having a library to use. If you add a function, add
+ it here, to STDWCS.H, and to MAPPINGS.H
+
+
+ $Log: M:/LOGFILES/STDWCS.C_V $
+
+ Rev 1.11 17 Jan 1994 15:06:46 BARRY
+Changed memorycmp functions to take VOID_PTR args
+
+ Rev 1.10 16 Nov 1993 13:25:28 GREGG
+Replaced 'L' modifier with cast.
+
+ Rev 1.9 20 Oct 1993 19:29:10 GREGG
+Fixed conversion routines and removed tabs.
+
+ Rev 1.8 18 Aug 1993 18:19:22 BARRY
+Added strcspn/wcscspn
+
+ Rev 1.7 12 Aug 1993 16:43:26 DON
+Fixed cleanup code for map_dst_overflow
+
+ Rev 1.6 11 Aug 1993 18:01:10 STEVEN
+fix read of unicode tape with ansi app
+
+ Rev 1.5 12 Nov 1992 11:00:34 DAVEV
+transparent unicode support fixes, comment out strlwr, strupr
+
+ Rev 1.4 12 Nov 1992 10:44:54 BARRY
+Change mapAnsiToUnic to work on strings in place.
+
+ Rev 1.3 23 Jul 1992 08:32:44 STEVEN
+fix warnings
+
+ Rev 1.2 17 Jul 1992 14:58:56 STEVEN
+fix NT bugs
+
+ Rev 1.0 10 Jun 1992 16:11:10 TIMN
+Initial Revision (UNICODE)
+
+
+
+**/
+
+
+/* include files go here */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <assert.h>
+
+#define NO_STRING_REMAPPING 1 /* bypasses wide str function remapping */
+
+#include "stdtypes.h"
+#include "msassert.h"
+#include "stdwcs.h"
+
+
+
+/**
+ begin private wide string stuff *****
+**/
+
+
+
+
+/**
+ begin private unicode mapping stuff *****
+**/
+
+/* begin defines */
+
+#define MAP_MAX_ANSI_CH 0x00FF /* max. ansi to unic mappable code point */
+
+#define MAP_CTRLCH_TBL_SIZ 32 /* num of ansi ctrl chars, 00h-1Fh */
+#define MAP_MAX_CTRL_CH 0x1F /* max. ctrl char code point */
+
+#define MAP_EXTCH_TBL_SIZ 128 /* num of ansi mappable chars, 80h-FFh */
+#define MAP_BASE_CH 0x80 /* first ansi mappable code point */
+
+#define MAP_COMPATCH_TBL_SIZ 37 /* num of ansi mappable compatability zone chars */
+#define MAP_BEGIN_CMPTZONE 0xFE33 /* begin mappable compatability zone */
+#define MAP_END_CMPTZONE 0xFFE5 /* end mappable compatability zone */
+
+
+
+/* begin data structures */
+
+static WCHAR ansiToUnicExtChTbl[ MAP_EXTCH_TBL_SIZ ] = {
+/* map cp437 chars to Unicode 1250 */
+
+ /* 80 */ (WCHAR)0x00C7, (WCHAR)0x00FC, (WCHAR)0x00E9, (WCHAR)0x00E2,
+ (WCHAR)0x00E4, (WCHAR)0x00E0, (WCHAR)0x00E5, (WCHAR)0x00E7,
+ (WCHAR)0x00EA, (WCHAR)0x00EB, (WCHAR)0x00E8, (WCHAR)0x00EF,
+ (WCHAR)0x00EE, (WCHAR)0x00EC, (WCHAR)0x00C4, (WCHAR)0x00C5,
+ /* 90 */ (WCHAR)0x00C9, (WCHAR)0x00E6, (WCHAR)0x00C6, (WCHAR)0x00F4,
+ (WCHAR)0x00F6, (WCHAR)0x00F2, (WCHAR)0x00FB, (WCHAR)0x00F9,
+ (WCHAR)0x00FF, (WCHAR)0x00D6, (WCHAR)0x00DC, (WCHAR)0x00A2,
+ (WCHAR)0x00A3, (WCHAR)0x00A5, (WCHAR)0x20A7, (WCHAR)0x0192,
+ /* A0 */ (WCHAR)0x00E1, (WCHAR)0x00ED, (WCHAR)0x00F3, (WCHAR)0x00FA,
+ (WCHAR)0x00F1, (WCHAR)0x00D1, (WCHAR)0x00AA, (WCHAR)0x00BA,
+ (WCHAR)0x00BF, (WCHAR)0x2310, (WCHAR)0x00AC, (WCHAR)0x00BD,
+ (WCHAR)0x00BC, (WCHAR)0x00A1, (WCHAR)0x00AB, (WCHAR)0x00BB,
+ /* B0 */ (WCHAR)0x2591, (WCHAR)0x2592, (WCHAR)0x2593, (WCHAR)0x2502,
+ (WCHAR)0x2524, (WCHAR)0x2561, (WCHAR)0x2562, (WCHAR)0x2556,
+ (WCHAR)0x2555, (WCHAR)0x2563, (WCHAR)0x2551, (WCHAR)0x2557,
+ (WCHAR)0x255D, (WCHAR)0x255C, (WCHAR)0x255B, (WCHAR)0x2510,
+ /* C0 */ (WCHAR)0x2514, (WCHAR)0x2534, (WCHAR)0x252C, (WCHAR)0x251C,
+ (WCHAR)0x2500, (WCHAR)0x253C, (WCHAR)0x255E, (WCHAR)0x255F,
+ (WCHAR)0x255A, (WCHAR)0x2554, (WCHAR)0x2569, (WCHAR)0x2566,
+ (WCHAR)0x2560, (WCHAR)0x2550, (WCHAR)0x256C, (WCHAR)0x2567,
+ /* D0 */ (WCHAR)0x2568, (WCHAR)0x2564, (WCHAR)0x2565, (WCHAR)0x2559,
+ (WCHAR)0x2558, (WCHAR)0x2552, (WCHAR)0x2553, (WCHAR)0x256B,
+ (WCHAR)0x256A, (WCHAR)0x2518, (WCHAR)0x250C, (WCHAR)0x2588,
+ (WCHAR)0x2584, (WCHAR)0x258C, (WCHAR)0x2590, (WCHAR)0x2580,
+ /* E0 */ (WCHAR)0x03B1, (WCHAR)0x00DF, (WCHAR)0x0393, (WCHAR)0x03C0,
+ (WCHAR)0x03A3, (WCHAR)0x03C3, (WCHAR)0x00B5, (WCHAR)0x03C4,
+ (WCHAR)0x03A6, (WCHAR)0x0398, (WCHAR)0x03A9, (WCHAR)0x03B4,
+ (WCHAR)0x221E, (WCHAR)0x03C6, (WCHAR)0x03B5, (WCHAR)0x2229,
+ /* F0 */ (WCHAR)0x2261, (WCHAR)0x00B1, (WCHAR)0x2265, (WCHAR)0x2264,
+ (WCHAR)0x2320, (WCHAR)0x2321, (WCHAR)0x00F7, (WCHAR)0x2248,
+ (WCHAR)0x00B0, (WCHAR)0x2219, (WCHAR)0x00B7, (WCHAR)0x221A,
+ (WCHAR)0x207F, (WCHAR)0x00B2, (WCHAR)0x25A0, (WCHAR)0x00A0
+} ;
+
+
+/* parallel arrays of UNIC/ANSI mappable chars for extended chars Unic1250 to cp437 */
+
+static WCHAR unicExtChTbl[ MAP_EXTCH_TBL_SIZ ] = {
+/* ascending order Unic 1250 extended chars. Maps Unic to cp437 */
+
+ /* 80 */ (WCHAR)0x00A0, (WCHAR)0x00A1, (WCHAR)0x00A2, (WCHAR)0x00A3,
+ (WCHAR)0x00A5, (WCHAR)0x00AA, (WCHAR)0x00AB, (WCHAR)0x00AC,
+ (WCHAR)0x00B0, (WCHAR)0x00B1, (WCHAR)0x00B2, (WCHAR)0x00B5,
+ (WCHAR)0x00B7, (WCHAR)0x00BA, (WCHAR)0x00BB, (WCHAR)0x00BC,
+ /* 90 */ (WCHAR)0x00BD, (WCHAR)0x00BF, (WCHAR)0x00C4, (WCHAR)0x00C5,
+ (WCHAR)0x00C6, (WCHAR)0x00C7, (WCHAR)0x00C9, (WCHAR)0x00D1,
+ (WCHAR)0x00D6, (WCHAR)0x00DC, (WCHAR)0x00DF, (WCHAR)0x00E0,
+ (WCHAR)0x00E1, (WCHAR)0x00E2, (WCHAR)0x00E4, (WCHAR)0x00E5,
+ /* A0 */ (WCHAR)0x00E6, (WCHAR)0x00E7, (WCHAR)0x00E8, (WCHAR)0x00E9,
+ (WCHAR)0x00EA, (WCHAR)0x00EB, (WCHAR)0x00EC, (WCHAR)0x00ED,
+ (WCHAR)0x00EE, (WCHAR)0x00EF, (WCHAR)0x00F1, (WCHAR)0x00F2,
+ (WCHAR)0x00F3, (WCHAR)0x00F4, (WCHAR)0x00F6, (WCHAR)0x00F7,
+ /* B0 */ (WCHAR)0x00F9, (WCHAR)0x00FA, (WCHAR)0x00FB, (WCHAR)0x00FC,
+ (WCHAR)0x00FF, (WCHAR)0x0192, (WCHAR)0x0393, (WCHAR)0x0398,
+ (WCHAR)0x03A3, (WCHAR)0x03A6, (WCHAR)0x03A9, (WCHAR)0x03B1,
+ (WCHAR)0x03B4, (WCHAR)0x03B5, (WCHAR)0x03C0, (WCHAR)0x03C3,
+ /* C0 */ (WCHAR)0x03C4, (WCHAR)0x03C6, (WCHAR)0x207F, (WCHAR)0x20A7,
+ (WCHAR)0x2219, (WCHAR)0x221A, (WCHAR)0x221E, (WCHAR)0x2229,
+ (WCHAR)0x2248, (WCHAR)0x2261, (WCHAR)0x2264, (WCHAR)0x2265,
+ (WCHAR)0x2310, (WCHAR)0x2320, (WCHAR)0x2321, (WCHAR)0x2500,
+ /* D0 */ (WCHAR)0x2502, (WCHAR)0x250C, (WCHAR)0x2510, (WCHAR)0x2514,
+ (WCHAR)0x2518, (WCHAR)0x251C, (WCHAR)0x2524, (WCHAR)0x252C,
+ (WCHAR)0x2534, (WCHAR)0x253C, (WCHAR)0x2550, (WCHAR)0x2551,
+ (WCHAR)0x2552, (WCHAR)0x2553, (WCHAR)0x2554, (WCHAR)0x2555,
+ /* E0 */ (WCHAR)0x2556, (WCHAR)0x2557, (WCHAR)0x2558, (WCHAR)0x2559,
+ (WCHAR)0x255A, (WCHAR)0x255B, (WCHAR)0x255C, (WCHAR)0x255D,
+ (WCHAR)0x255E, (WCHAR)0x255F, (WCHAR)0x2560, (WCHAR)0x2561,
+ (WCHAR)0x2562, (WCHAR)0x2563, (WCHAR)0x2564, (WCHAR)0x2565,
+ /* F0 */ (WCHAR)0x2566, (WCHAR)0x2567, (WCHAR)0x2568, (WCHAR)0x2569,
+ (WCHAR)0x256A, (WCHAR)0x256B, (WCHAR)0x256C, (WCHAR)0x2580,
+ (WCHAR)0x2584, (WCHAR)0x2588, (WCHAR)0x258C, (WCHAR)0x2590,
+ (WCHAR)0x2591, (WCHAR)0x2592, (WCHAR)0x2593, (WCHAR)0x25A0
+} ;
+
+static ACHAR ansiExtCh[ MAP_EXTCH_TBL_SIZ ] = {
+/* ANSI mappable chars that correlate to unicExtChTbl */
+
+ /* 80 */ (ACHAR)0xFF, (ACHAR)0xAD, (ACHAR)0x9B, (ACHAR)0x9C,
+ (ACHAR)0x9D, (ACHAR)0xA6, (ACHAR)0xAE, (ACHAR)0xAA,
+ (ACHAR)0xF8, (ACHAR)0xF1, (ACHAR)0xFD, (ACHAR)0xE6,
+ (ACHAR)0xFA, (ACHAR)0xA7, (ACHAR)0xAF, (ACHAR)0xAC,
+ /* 90 */ (ACHAR)0xAB, (ACHAR)0xA8, (ACHAR)0x8E, (ACHAR)0x8F,
+ (ACHAR)0x92, (ACHAR)0x80, (ACHAR)0x90, (ACHAR)0xA5,
+ (ACHAR)0x99, (ACHAR)0x9A, (ACHAR)0xE1, (ACHAR)0x85,
+ (ACHAR)0xA0, (ACHAR)0x83, (ACHAR)0x84, (ACHAR)0x86,
+ /* A0 */ (ACHAR)0x91, (ACHAR)0x87, (ACHAR)0x8A, (ACHAR)0x82,
+ (ACHAR)0x88, (ACHAR)0x89, (ACHAR)0x8D, (ACHAR)0xA1,
+ (ACHAR)0x8C, (ACHAR)0x8B, (ACHAR)0xA4, (ACHAR)0x95,
+ (ACHAR)0xA2, (ACHAR)0x93, (ACHAR)0x94, (ACHAR)0xF6,
+ /* B0 */ (ACHAR)0x97, (ACHAR)0xA3, (ACHAR)0x96, (ACHAR)0x81,
+ (ACHAR)0x98, (ACHAR)0x9F, (ACHAR)0xE2, (ACHAR)0xE9,
+ (ACHAR)0xE4, (ACHAR)0xE8, (ACHAR)0xEA, (ACHAR)0xE0,
+ (ACHAR)0xEB, (ACHAR)0xEE, (ACHAR)0xE3, (ACHAR)0xE5,
+ /* C0 */ (ACHAR)0xE7, (ACHAR)0xED, (ACHAR)0xFC, (ACHAR)0x9E,
+ (ACHAR)0xF9, (ACHAR)0xFB, (ACHAR)0xEC, (ACHAR)0xEF,
+ (ACHAR)0xF7, (ACHAR)0xF0, (ACHAR)0xF3, (ACHAR)0xF2,
+ (ACHAR)0xA9, (ACHAR)0xF4, (ACHAR)0xF5, (ACHAR)0xC4,
+ /* D0 */ (ACHAR)0xB3, (ACHAR)0xDA, (ACHAR)0xBF, (ACHAR)0xC0,
+ (ACHAR)0xD9, (ACHAR)0xC3, (ACHAR)0xB4, (ACHAR)0xC2,
+ (ACHAR)0xC1, (ACHAR)0xC5, (ACHAR)0xCD, (ACHAR)0xBA,
+ (ACHAR)0xD5, (ACHAR)0xD6, (ACHAR)0xC9, (ACHAR)0xB8,
+ /* E0 */ (ACHAR)0xB7, (ACHAR)0xBB, (ACHAR)0xD4, (ACHAR)0xD3,
+ (ACHAR)0xC8, (ACHAR)0xBE, (ACHAR)0xBD, (ACHAR)0xBC,
+ (ACHAR)0xC6, (ACHAR)0xC7, (ACHAR)0xCC, (ACHAR)0xB5,
+ (ACHAR)0xB6, (ACHAR)0xB9, (ACHAR)0xD1, (ACHAR)0xD2,
+ /* F0 */ (ACHAR)0xCB, (ACHAR)0xCF, (ACHAR)0xD0, (ACHAR)0xCA,
+ (ACHAR)0xD8, (ACHAR)0xD7, (ACHAR)0xCE, (ACHAR)0xDF,
+ (ACHAR)0xDC, (ACHAR)0xDB, (ACHAR)0xDD, (ACHAR)0xDE,
+ (ACHAR)0xB0, (ACHAR)0xB1, (ACHAR)0xB2, (ACHAR)0xFE
+} ;
+
+
+
+/* parallel arrays of UNIC/ANSI mappable chars for control chars Unic1250 to cp437 */
+
+static WCHAR unicCtrlChTbl[ MAP_CTRLCH_TBL_SIZ ] = {
+/* ascending order Unic 1250 control chars. Maps Unic to cp437 */
+
+ /* 00 */ (WCHAR)0x0000, (WCHAR)0x00A7, (WCHAR)0x00B6, (WCHAR)0x2022,
+ (WCHAR)0x203C, (WCHAR)0x2190, (WCHAR)0x2191, (WCHAR)0x2192,
+ (WCHAR)0x2193, (WCHAR)0x2194, (WCHAR)0x2195, (WCHAR)0x21A8,
+ (WCHAR)0x221F, (WCHAR)0x22D9, (WCHAR)0x25AC, (WCHAR)0x25B2,
+ /* 10 */ (WCHAR)0x25BA, (WCHAR)0x25BC, (WCHAR)0x25C4, (WCHAR)0x25CB,
+ (WCHAR)0x25D8, (WCHAR)0x263A, (WCHAR)0x263B, (WCHAR)0x263C,
+ (WCHAR)0x2640, (WCHAR)0x2642, (WCHAR)0x2660, (WCHAR)0x2663,
+ (WCHAR)0x2665, (WCHAR)0x2666, (WCHAR)0x266A, (WCHAR)0x266B
+} ;
+
+static ACHAR ansiCtrlCh[ MAP_CTRLCH_TBL_SIZ ] = {
+/* ANSI mappable chars that correlate to unicCtrlChTbl */
+
+ /* 00 */ (ACHAR)0x00, (ACHAR)0x15, (ACHAR)0x16, (ACHAR)0x1C,
+ (ACHAR)0x1D, (ACHAR)0x1B, (ACHAR)0x1A, (ACHAR)0x03,
+ (ACHAR)0x14, (ACHAR)0x13, (ACHAR)0x0D, (ACHAR)0x19,
+ (ACHAR)0x18, (ACHAR)0x1E, (ACHAR)0x1F, (ACHAR)0x17,
+ /* 10 */ (ACHAR)0x10, (ACHAR)0x12, (ACHAR)0x0A, (ACHAR)0x04,
+ (ACHAR)0x02, (ACHAR)0x01, (ACHAR)0x0E, (ACHAR)0x0B,
+ (ACHAR)0x06, (ACHAR)0x08, (ACHAR)0x07, (ACHAR)0x05,
+ (ACHAR)0x0C, (ACHAR)0x09, (ACHAR)0x0F, (ACHAR)0x11
+} ;
+
+
+
+/* parallel arrays of UNIC/ANSI mappable chars for compatability zone chars Unic1250 to cp437 */
+
+static WCHAR unicCmptZoneChTbl[ MAP_COMPATCH_TBL_SIZ ] = {
+/* ascending order Unic 1250 compatability zone chars. Maps Unic to cp437 */
+
+ (WCHAR)0xFE33, (WCHAR)0xFE34, (WCHAR)0xFE35, (WCHAR)0xFE36,
+ (WCHAR)0xFE37, (WCHAR)0xFE38, (WCHAR)0xFE4D, (WCHAR)0xFE4E,
+ (WCHAR)0xFE4F, (WCHAR)0xFE50, (WCHAR)0xFE52, (WCHAR)0xFE54,
+ (WCHAR)0xFE55, (WCHAR)0xFE56, (WCHAR)0xFE57, (WCHAR)0xFE59,
+ (WCHAR)0xFE5A, (WCHAR)0xFE5B, (WCHAR)0xFE5C, (WCHAR)0xFE5F,
+ (WCHAR)0xFE60, (WCHAR)0xFE61, (WCHAR)0xFE62, (WCHAR)0xFE63,
+ (WCHAR)0xFE64, (WCHAR)0xFE65, (WCHAR)0xFE66, (WCHAR)0xFE68,
+ (WCHAR)0xFE69, (WCHAR)0xFE6A, (WCHAR)0xFE6B, (WCHAR)0xFFE0,
+ (WCHAR)0xFFE1, (WCHAR)0xFFE2, (WCHAR)0xFFE3, (WCHAR)0xFFE4,
+ (WCHAR)0xFFE5
+} ;
+
+static ACHAR ansiCmptZoneCh[ MAP_COMPATCH_TBL_SIZ ] = {
+/* ANSI mappable chars that correlate to unicCmptZoneChTbl */
+
+ (ACHAR)0x5F, (ACHAR)0x5F, (ACHAR)0x28, (ACHAR)0x29,
+ (ACHAR)0x7B, (ACHAR)0x7D, (ACHAR)0x5F, (ACHAR)0x5F,
+ (ACHAR)0x5F, (ACHAR)0x2C, (ACHAR)0x2E, (ACHAR)0x3B,
+ (ACHAR)0x3A, (ACHAR)0x3F, (ACHAR)0x21, (ACHAR)0x28,
+ (ACHAR)0x29, (ACHAR)0x7B, (ACHAR)0x7D, (ACHAR)0x23,
+ (ACHAR)0x26, (ACHAR)0x2A, (ACHAR)0x2B, (ACHAR)0x2D,
+ (ACHAR)0x3C, (ACHAR)0x3E, (ACHAR)0x3D, (ACHAR)0x5C,
+ (ACHAR)0x24, (ACHAR)0x25, (ACHAR)0x40, (ACHAR)0xA2,
+ (ACHAR)0xA3, (ACHAR)0xAC, (ACHAR)0xAF, (ACHAR)0xA6,
+ (ACHAR)0xA5
+} ;
+
+
+
+/* begin macros */
+
+#define _cvtExtChToTblIndx(c) ( (unsigned char)(c) - MAP_BASE_CH )
+
+
+/* macros to access parallel arrays for UNIC to ANSI mappings */
+
+#define _getAnsiExtCh( x ) ( ansiExtCh[ x ] )
+#define _getAnsiCtrlCh( x ) ( ansiCtrlCh[ x ] )
+#define _getAnsiCmptZoneCh( x ) ( ansiCmptZoneCh[ x ] )
+
+
+
+/* begin private unicode utility stuff */
+
+static BOOLEAN bSrchUnicChTbl( WCHAR wch, WCHAR_PTR unicTblArry, INT max, INT *indx ) ;
+
+
+
+/**
+ begin wide string functions *****
+**/
+
+#if !defined( OS_WIN32 )
+
+INT wcslen( WCHAR_PTR s )
+{
+ INT i = 0;
+ while ( *s++ ) i++;
+ return( i );
+}
+
+WCHAR_PTR wcscpy
+( WCHAR_PTR s, WCHAR_PTR t )
+{
+ WCHAR_PTR tmp;
+ tmp = s;
+ while ( *s++ = *t++ );
+ return( tmp );
+}
+
+WCHAR_PTR wcsncpy( WCHAR_PTR s, WCHAR_PTR t, INT i )
+{
+ WCHAR_PTR tmp;
+ tmp = s;
+ while ( i-- && (*s++ = *t++) );
+ return( tmp );
+
+}
+
+WCHAR_PTR wcscat( WCHAR_PTR s, WCHAR_PTR t )
+{
+ WCHAR_PTR tmp;
+ tmp = s;
+ while ( *s++ );
+ while ( *s++ = *t++ );
+ return( tmp );
+}
+
+WCHAR_PTR wcsncat( WCHAR_PTR s, WCHAR_PTR t, INT i )
+{
+ WCHAR_PTR tmp;
+ tmp = s;
+ while ( *s++ );
+ while ( i-- && (*s++ = *t++) );
+
+ if ( !i ) {
+ *s = (WCHAR)NULL ;
+ }
+ return( tmp );
+}
+
+INT wcscmp( WCHAR_PTR s, WCHAR_PTR t )
+{
+ while ( *s && ( *s++ == *t++ ) );
+ if ( *s > *t ) return( 1 );
+ if ( *s < *t ) return( -1 );
+ return( 0 );
+}
+
+INT wcsncmp( WCHAR_PTR s, WCHAR_PTR t, INT i )
+{
+ while ( *s && i-- && ( *s++ == *t++ ) );
+ if ( *s > *t && i ) return( 1 );
+ if ( *s < *t && i ) return( -1 );
+ return( 0 );
+}
+
+INT wcsicmp( WCHAR_PTR s, WCHAR_PTR t )
+{
+ INT n = _toLowerW( *s ) - _toLowerW( *t ) ;
+
+ while ( !n && *s++ && *t++ ) {
+ n = _toLowerW( *s ) - _toLowerW( *t ) ;
+ }
+
+ return( n ) ;
+}
+
+INT wcsnicmp( WCHAR_PTR s, WCHAR_PTR t, INT i )
+{
+ INT n = 0 ;
+
+ msassert( i >= 0 ) ;
+
+ if ( i ) {
+ n = _toLowerW( *s ) - _toLowerW( *t ) ;
+
+ while ( --i && !n && *s++ && *t++ ) {
+ n = _toLowerW( *s ) - _toLowerW( *t ) ;
+ }
+ }
+
+ return( n ) ;
+}
+
+WCHAR_PTR wcsrchr( WCHAR_PTR s, INT c )
+{
+ INT i;
+
+ i = wcslen( s ) + 1;
+ s += i;
+
+ for ( ; i >= 0; i-- ) {
+ if ( *s == (WCHAR)c ) {
+ return( s );
+ }
+ s--;
+ }
+
+ return( NULL );
+}
+
+WCHAR_PTR wcschr( WCHAR_PTR s, INT c )
+{
+ INT i;
+
+ i = wcslen( s );
+
+ for ( ; i >= 0; i-- ) {
+ if ( *s == (WCHAR)c ) {
+ return( s );
+ }
+ s++;
+ }
+
+ return( NULL );
+}
+
+WCHAR_PTR wcspbrk( WCHAR_PTR s, WCHAR_PTR t )
+{
+ INT i;
+
+ while ( *s ) {
+ for ( i = 0; t[i]; i++ ) {
+ if ( *s == t[i] ) {
+ return( s );
+ }
+ }
+ s++;
+ }
+
+ return( NULL );
+}
+
+WCHAR_PTR wcslwr( WCHAR_PTR s )
+{
+ WCHAR_PTR tmp = s ;
+
+ for ( ; *s; s++) {
+ *s = _toLowerW( *s ) ;
+ }
+
+ return( tmp ) ;
+}
+
+WCHAR_PTR wcsupr( WCHAR_PTR s )
+{
+ WCHAR_PTR tmp = s ;
+
+ for ( ; *s; s++) {
+ *s = _toUpperW( *s ) ;
+ }
+
+ return( tmp ) ;
+}
+
+WCHAR_PTR wcsstr( WCHAR_PTR s, WCHAR_PTR t )
+{
+ INT i;
+ i = wcslen( t );
+
+ while ( *s ) {
+ if ( ! wcsncmp( s, t, i ) ) {
+ return( s );
+ }
+ s++;
+ }
+
+ return( NULL );
+}
+
+size_t wcscspn( WCHAR_PTR s, WCHAR_PTR t )
+{
+ size_t index;
+ WCHAR_PTR p;
+
+ for ( index = 0; ( *s ); index++, s++ )
+ {
+ for ( p = t; ( *p ); p++ )
+ {
+ if ( *s == *p )
+ {
+ return index;
+ }
+ }
+ }
+ return index;
+}
+
+#endif //!OS_WIN32
+
+
+/**
+ ANSI strings for use when UNICODE is defined
+**/
+#ifdef UNICODE
+INT strlenA( ACHAR_PTR s )
+{
+ return( strlen( s ) );
+}
+
+ACHAR_PTR strcpyA( ACHAR_PTR s, ACHAR_PTR t )
+{
+ return( strcpy( s, t ) );
+}
+
+ACHAR_PTR strncpyA( ACHAR_PTR s, ACHAR_PTR t, INT i )
+{
+ return( strncpy( s, t, i ) );
+}
+
+ACHAR_PTR strcatA( ACHAR_PTR s, ACHAR_PTR t )
+{
+ return( strcat( s, t ) );
+}
+
+ACHAR_PTR strncatA( ACHAR_PTR s, ACHAR_PTR t, INT i )
+{
+ return( strncat( s, t, i ) );
+}
+
+INT strcmpA( ACHAR_PTR s, ACHAR_PTR t )
+{
+ return( strcmp( s, t ) );
+}
+
+INT strncmpA( ACHAR_PTR s, ACHAR_PTR t, INT i )
+{
+ return( strncmp( s, t, i ) );
+}
+
+INT stricmpA( ACHAR_PTR s, ACHAR_PTR t )
+{
+ return( stricmp( s, t ) );
+}
+
+INT strnicmpA( ACHAR_PTR s, ACHAR_PTR t, INT i )
+{
+ return( strnicmp( s, t, i ) );
+}
+
+ACHAR_PTR strrchrA( ACHAR_PTR s, INT c )
+{
+ return( strrchr( s, c ) );
+}
+
+ACHAR_PTR strchrA( ACHAR_PTR s, INT c )
+{
+ return( strchr( s, c ) );
+}
+
+ACHAR_PTR strpbrkA( ACHAR_PTR s, ACHAR_PTR t )
+{
+ return( strpbrkA( s, t ) );
+}
+
+//ACHAR_PTR strlwrA( ACHAR_PTR s )
+//{
+// return( strlwr( s ) );
+//}
+
+//ACHAR_PTR struprA( ACHAR_PTR s )
+//{
+// return( strupr( s ) );
+//}
+
+ACHAR_PTR strstrA( ACHAR_PTR s, ACHAR_PTR t )
+{
+ return( strstr( s, t ) );
+}
+
+#endif //UNICODE
+
+
+/**
+ begin unicode mapping functions *****
+**/
+
+/**/
+/**
+
+ Name: mapAnsiToUnic()
+
+ Description: Converts ASCII string to UNICODE.
+
+ Modified: 11-Nov-92
+
+ Returns: MAP_DST_OVERFLOW if buffer is too small
+ SUCCESS otherwise.
+
+ Notes: If buffer is too small, *dstStrSize will give the
+ number of additional bytes required.
+ Will work on a string in-place (ie, src==dst).
+
+**/
+INT mapAnsiToUnic( ACHAR_PTR src, WCHAR_PTR dst, INT *dstStrSize )
+{
+ INT result;
+ INT asciiSize = strlenA( src ) + 1;
+
+ if ( (asciiSize * 2) > *dstStrSize )
+ {
+ msassert( (asciiSize * 2) <= *dstStrSize ) ;
+ result = MAP_DST_OVERFLOW ;
+ *dstStrSize = (asciiSize * 2) - *dstStrSize;
+ }
+ else
+ {
+ result = SUCCESS;
+
+ dst += asciiSize - 1;
+ src += asciiSize - 1;
+
+ while ( asciiSize-- > 0 )
+ {
+ *dst = ((unsigned char)*src < MAP_BASE_CH) ?
+ (WCHAR)*src :
+ ansiToUnicExtChTbl[ _cvtExtChToTblIndx( *src ) ];
+
+ dst--, src--;
+ }
+ }
+ return result;
+}
+
+
+INT mapUnicToAnsi( WCHAR_PTR src, ACHAR_PTR dst, const ACHAR rplCh, INT *dstStrSize )
+{
+ WCHAR UNALIGNED *ua_src = (WCHAR UNALIGNED *)src ;
+ INT result = SUCCESS ;
+ INT indx ;
+ ACHAR_PTR pDst = dst ;
+ INT unicSize = sizeof( WCHAR ) ;
+
+ while( *ua_src ) {
+ unicSize += sizeof(WCHAR) ;
+ ua_src++ ;
+ }
+
+ ua_src = (WCHAR UNALIGNED *)src ;
+
+ if ( (unicSize / 2) > *dstStrSize ) {
+ msassert( (unicSize / 2) <= *dstStrSize ) ;
+ result = MAP_DST_OVERFLOW ;
+ *dstStrSize = (unicSize / 2) - *dstStrSize ;
+ }
+ else {
+ /* source string is a NULL terminated string */
+ for ( ; *ua_src != (WCHAR)'\0'; ua_src++ ) {
+ /* assign UNICODE character to destination */
+ if ( *ua_src < MAP_BASE_CH ) {
+ /* direct mapping from UNICODE to ANSI */
+ *pDst = (ACHAR) *ua_src ;
+ }
+ else {
+ /* is char a mappable ANSI extended char */
+ if ( bSrchUnicChTbl( *ua_src, unicExtChTbl, MAP_EXTCH_TBL_SIZ, &indx ) ) {
+ indx = _getAnsiExtCh( indx ) ;
+ }
+ /* okay, it wasn't. How about a mappable ANSI control char */
+ else if ( bSrchUnicChTbl( *ua_src, unicCtrlChTbl, MAP_CTRLCH_TBL_SIZ, &indx ) ) {
+ indx = _getAnsiCtrlCh( indx ) ;
+ }
+ else {
+ indx = 0 ; /* default to not found */
+
+ /* okay, it wasn't. How about a mappable ANSI char from the compatablity zone */
+ if ( ( *ua_src >= MAP_BEGIN_CMPTZONE ) && ( *ua_src <= MAP_END_CMPTZONE ) ) {
+
+ /* ANSI Latin1 mappable chars using offset */
+ if ( ( *ua_src >= 0xFF01 ) && ( *ua_src <= 0xFF5E ) ) {
+ indx = (ACHAR) (( *ua_src & 0x00FF ) + 0x0020 ) ;
+ }
+ /* search compatability zone table for char */
+ else if ( bSrchUnicChTbl( *ua_src, unicCmptZoneChTbl, MAP_COMPATCH_TBL_SIZ, &indx ) ) {
+ indx = _getAnsiCmptZoneCh( indx ) ;
+ }
+ }
+ }
+
+ *pDst = ( indx ) ? (ACHAR) indx : rplCh ;
+ }
+
+ pDst++ ;
+ }
+
+ /* NULL terminate destination */
+ *pDst = '\0' ;
+ }
+
+ return( result ) ;
+}
+
+
+/**/
+/**
+
+ Name: mapAnsiToUnicNoNull()
+
+ Description: Converts ASCII string with possible embedded nulls
+ to UNICODE.
+
+ Modified: 11-Nov-92
+
+ Returns: MAP_DST_OVERFLOW if buffer is too small
+ SUCCESS otherwise.
+
+ Notes: If buffer is too small, *dstStrSize will give the
+ number of additional bytes required.
+ Will work on a string in-place (ie, src==dst).
+
+**/
+INT mapAnsiToUnicNoNull( ACHAR_PTR src, WCHAR_PTR dst, INT srcStrSize, INT *dstStrSize )
+{
+ INT result;
+ INT asciiSize = srcStrSize;
+ WCHAR UNALIGNED *ua_dst = (WCHAR UNALIGNED *)dst ;
+
+ if ( (asciiSize * 2) > *dstStrSize )
+ {
+ result = MAP_DST_OVERFLOW ;
+ *dstStrSize = (asciiSize * 2) - *dstStrSize;
+ }
+ else
+ {
+ result = SUCCESS;
+
+ ua_dst += asciiSize - 1;
+ src += asciiSize - 1;
+
+ while ( asciiSize-- > 0 )
+ {
+ *ua_dst = ((unsigned char)*src < MAP_BASE_CH) ?
+ (WCHAR)*src :
+ ansiToUnicExtChTbl[ _cvtExtChToTblIndx( *src ) ];
+
+ ua_dst--, src--;
+ }
+ }
+ return result;
+}
+
+
+INT mapUnicToAnsiNoNull(
+ WCHAR_PTR src,
+ ACHAR_PTR dst,
+ const ACHAR rplCh,
+ INT srcStrSize,
+ INT *dstStrSize )
+{
+ INT result = SUCCESS ;
+ INT indx ;
+ ACHAR_PTR pDst = dst ;
+ WCHAR UNALIGNED *ua_src = (WCHAR UNALIGNED *)src ;
+
+ if ( (srcStrSize / 2) > *dstStrSize ) {
+ msassert( (srcStrSize / 2) <= *dstStrSize ) ;
+ result = MAP_DST_OVERFLOW ;
+ *dstStrSize = (srcStrSize / 2) - *dstStrSize ;
+ }
+ else {
+ for ( ; srcStrSize > 0; srcStrSize -= sizeof(WCHAR), ua_src++ ) {
+ /* assign UNICODE character to destination */
+ if ( *ua_src < MAP_BASE_CH ) {
+ /* direct mapping from UNICODE to ANSI */
+ *pDst = (ACHAR) *ua_src ;
+ }
+ else {
+ /* is char a mappable ANSI extended char */
+ if ( bSrchUnicChTbl( *ua_src, unicExtChTbl, MAP_EXTCH_TBL_SIZ, &indx ) ) {
+ indx = _getAnsiExtCh( indx ) ;
+ }
+ /* okay, it wasn't. How about a mappable ANSI control char */
+ else if ( bSrchUnicChTbl( *ua_src, unicCtrlChTbl, MAP_CTRLCH_TBL_SIZ, &indx ) ) {
+ indx = _getAnsiCtrlCh( indx ) ;
+ }
+ else {
+ indx = 0 ; /* default to not found */
+
+ /* okay, it wasn't. How about a mappable ANSI char from the compatablity zone */
+ if ( ( *ua_src >= MAP_BEGIN_CMPTZONE ) && ( *ua_src <= MAP_END_CMPTZONE ) ) {
+
+ /* ANSI Latin1 mappable chars using offset */
+ if ( ( *ua_src >= 0xFF01 ) && ( *ua_src <= 0xFF5E ) ) {
+ indx = (ACHAR) (( *ua_src & 0x00FF ) + 0x0020 ) ;
+ }
+ /* search compatability zone table for char */
+ else if ( bSrchUnicChTbl( *ua_src, unicCmptZoneChTbl, MAP_COMPATCH_TBL_SIZ, &indx ) ) {
+ indx = _getAnsiCmptZoneCh( indx ) ;
+ }
+ }
+ }
+
+ *pDst = ( indx ) ? (ACHAR) indx : rplCh ;
+ }
+
+ pDst++ ;
+ }
+ }
+
+ return( result ) ;
+}
+
+
+
+/**
+ begin unicode comparison functions *****
+**/
+
+
+INT cmpiUnicToUnic( WCHAR_PTR ws1, WCHAR_PTR ws2 )
+{
+ INT cmpValu = SUCCESS ;
+
+ /* compare strings, i.e., lowercase */
+ for ( ; !cmpValu && ( *ws1 && *ws2 ); ws1++, ws2++ ) {
+ cmpValu = _toLowerW( *ws1 ) - _toLowerW( *ws2 ) ;
+ }
+
+ /* was one string shorter than the other */
+ if ( !( *ws1 && *ws2 ) ) {
+ cmpValu = *ws1 - *ws2 ;
+ }
+
+ return( cmpValu ) ;
+}
+
+
+
+/**
+ begin memory functions *****
+**/
+
+
+INT memorycmp( const VOID_PTR s1, const INT s1len, const VOID_PTR s2, const INT s2len )
+{
+ INT cmpValu = memcmp( s1, s2, (( s1len < s2len ) ? s1len : s2len ) ) ;
+
+ if ( !cmpValu ) {
+ cmpValu = s2len - s1len ;
+ }
+
+ return( cmpValu ) ;
+}
+
+INT memoryicmp( const VOID_PTR s1, const INT s1len, const VOID_PTR s2, const INT s2len )
+{
+ INT cmpValu = memicmp( s1, s2, (( s1len < s2len ) ? s1len : s2len ) ) ;
+
+ if ( !cmpValu ) {
+ cmpValu = s2len - s1len ;
+ }
+
+ return( cmpValu ) ;
+}
+
+
+
+
+/**
+ begin unicode utility functions *****
+**/
+
+static BOOLEAN bSrchUnicChTbl( WCHAR wch, WCHAR_PTR unicTblArry, INT max, INT *indx )
+{
+ INT min, mid ;
+
+ msassert( unicTblArry != NULL ) ;
+ msassert( max ) ;
+
+ *indx = min = 0 ;
+ max-- ;
+
+ while ( min <= max ) {
+ mid = ( min + max ) / 2 ;
+
+ if ( wch < unicTblArry[ mid ] ) {
+ max = mid - 1 ;
+ }
+ else if ( wch > unicTblArry[ mid ] ) {
+ min = mid + 1;
+ }
+ else {
+ *indx = mid ;
+ return( TRUE ) ;
+ }
+ }
+
+ return( FALSE ) ;
+}
diff --git a/private/utils/ntbackup/src/stubfunc.c b/private/utils/ntbackup/src/stubfunc.c
new file mode 100644
index 000000000..61b1c11ac
--- /dev/null
+++ b/private/utils/ntbackup/src/stubfunc.c
@@ -0,0 +1,206 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: stubfunc.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains a set of stub function. These
+ functions are "DUMMY" functions for the file system tables.
+
+
+ $Log: M:/LOGFILES/STUBFUNC.C_V $
+
+ Rev 1.3 28 Aug 1992 16:31:40 BARRY
+Changed InitGOS to default Novell items differently.
+
+ Rev 1.2 01 Oct 1991 11:16:30 BARRY
+Include standard headers.
+
+ Rev 1.1 24 Jul 1991 11:08:42 DAVIDH
+Corrected Watcom compiler warnings.
+
+ Rev 1.0 09 May 1991 13:40:40 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+
+#include "stdtypes.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "tfldefs.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: DUMMY_CreateIDB()
+
+ Description: For file systems which do not support Images this is
+ the function to use for CreateGenIDB()
+
+ Modified: 9/13/1989
+
+ Returns: TF_SKIP_ALL_DATA
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DUMMY_CreateIDB( fsh, data )
+FSYS_HAND fsh; /* I - file system handle */
+GEN_IDB_DATA_PTR data ; /* I - retquest structure */
+{
+ (VOID) fsh ;
+
+ data->std_data.dblk->blk_type = IDB_ID ;
+ data->std_data.dblk->com.blkid = data->std_data.blkid;
+ data->std_data.dblk->com.f_d.did = data->std_data.did ;
+ data->std_data.dblk->com.ba.lba = data->std_data.lba ;
+
+ return TF_SKIP_ALL_DATA ;
+}
+
+/**/
+/**
+
+ Name: DUMMY_InitGOS()
+
+ Description: Simpel return of success for GOS
+ initialization.
+
+ Modified: 9/21/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DUMMY_InitGOS( fsh, gos )
+FSYS_HAND fsh ;
+GOS_PTR gos ;
+{
+ (VOID)fsh;
+
+ memset( gos, 0, sizeof( *gos ) );
+
+ /* Initiailize things that shouldn't default to zero */
+
+ gos->max_rights = 0xff;
+ gos->novell_directory_max_rights = 0xffff;
+
+ return SUCCESS;
+}
+
+/**/
+/**
+
+ Name: DUMMY_EnumSpecFiles()
+
+ Description: This function allways returns NO_MORE
+
+ Modified: 9/4/1990
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DUMMY_EnumSpecFiles( dle, index, path, psize, fname )
+GENERIC_DLE_PTR dle ;
+UINT16 *index ;
+CHAR_PTR *path ;
+INT16 *psize ;
+CHAR_PTR *fname ;
+{
+ (VOID) dle ; /* Prevent compiler warnings. */
+ (VOID) index ;
+ (VOID) path ;
+ (VOID) psize ;
+ (VOID) fname ;
+
+ return FS_NO_MORE ;
+}
+
+/**/
+/**
+
+ Name: DUMMY_GetSpecDBLKS()
+
+ Description: This function is called to return DBLKS for files or
+ directories which should be backed up first (index = 1) or
+ last (index = -1). For DOS there are no special dblks.
+
+ Modified: 8-21-89
+
+ Returns: Error codes:
+ FS_NO_MORE
+
+ See also: $/SEE( DOS_FindFirst(), DOS_FindNext() )$
+
+ Notes: Should consider if \IO.SYS should be a special dblk.
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DUMMY_GetSpecDBLKS( fsh, dblk, index )
+FSYS_HAND fsh;
+DBLK_PTR dblk;
+INT32 *index;
+{
+
+ (VOID) dblk ;
+ (VOID) index ;
+ (VOID) fsh ;
+
+ msassert( fsh->attached_dle != NULL ) ;
+
+ return FS_NO_MORE ;
+}
+
+
+
+/**/
+/**
+
+ Name: DUMMY_LogoutDevice()
+
+ Description: Logout of a server.
+
+ Modified: 10-17-90
+
+ Returns: None
+
+ Notes: Only valid when dle is NOVELL_SERVER_ONLY.
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 DUMMY_LogoutDevice( dle )
+GENERIC_DLE_PTR dle ;
+{
+
+ (VOID) dle ;
+
+ return SUCCESS ;
+}
diff --git a/private/utils/ntbackup/src/sx.c b/private/utils/ntbackup/src/sx.c
new file mode 100644
index 000000000..0b1cc41d6
--- /dev/null
+++ b/private/utils/ntbackup/src/sx.c
@@ -0,0 +1,1239 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: sx.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the Support functions for the SX drive
+
+
+ $Log: T:/LOGFILES/SX.C_V $
+
+ Rev 1.14 18 Jan 1993 14:42:40 BobR
+Added MOVE_ESA macro call(s)
+
+ Rev 1.13 29 Dec 1992 13:32:48 DAVEV
+unicode fixes (3)
+
+ Rev 1.12 11 Nov 1992 10:53:58 GREGG
+Unicodeized literals.
+
+ Rev 1.11 22 Sep 1992 11:32:50 GREGG
+Fixed last fixes.
+
+ Rev 1.10 18 Aug 1992 10:35:16 BURT
+fix warnings
+
+ Rev 1.9 17 Aug 1992 09:01:38 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.8 22 Jul 1992 14:35:38 GREGG
+Fixed warnings.
+
+ Rev 1.7 09 Jun 1992 15:35:16 GREGG
+Changed call to check for continuation block.
+
+ Rev 1.6 21 May 1992 16:22:34 GREGG
+Changed reference to VCB_CONT_BIT to DB_CONT_BIT.
+
+ Rev 1.5 05 Apr 1992 19:09:34 GREGG
+ROLLER BLADES - Changed lw_sx_file_path to lw_cat_file_path.
+
+ Rev 1.4 20 Mar 1992 18:02:36 NED
+added exception updating after TpReceive calls
+
+ Rev 1.3 02 Mar 1992 14:53:26 DON
+added ThreadSwitch's before low level I/O calls
+
+ Rev 1.2 06 Feb 1992 17:34:38 DON
+Added ThreadSwitch call in empty TpReceive call and if no call to ui
+
+ Rev 1.1 17 Oct 1991 01:23:20 GREGG
+Now uses lw_sx_file_path in place of CDS_GetMaynFolder.
+
+ Rev 1.0 30 Sep 1991 11:02:10 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+
+#include <stdio.h>
+#include <conio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys\types.h>
+#include <sys\stat.h>
+#include <io.h>
+#include <memory.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "fsys.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "tfldefs.h"
+#include "sx.h"
+
+/* Device Driver Interface Files */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+
+#include "be_debug.h"
+
+/*
+ * LOCAL FUNCTION PROTOTYPES
+ */
+
+static BOOLEAN SX_OpenTmpFile( /* called by: SX_StartSampling() */
+ CHANNEL_PTR channel
+) ;
+
+static BOOLEAN SX_SeekFile( /* called by: SX_OpenFile() */
+ CHANNEL_PTR channel, /* SX_SeekSetInFile() */
+ INT32 offset, /* SX_FindBlock() */
+ INT origin, /* SX_StartSampling() */
+ INT file_type
+) ;
+
+static BOOLEAN SX_ReadFile( /* called by: SX_OpenFile() */
+ CHANNEL_PTR channel /* SX_SeekSetInFile() */
+) ;
+
+/**/
+/**
+
+ Name: SX_Begin
+
+ Description: Contains the code to initialize the SX INFO.
+
+ Modified: 5/2/91
+
+ Returns: nothing
+
+ Notes: memory is TpLocked for OS/2 device driver reference
+
+ called by: TFOPEN TF_OpenSet()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID SX_Begin(
+ CHANNEL_PTR channel,
+ UINT16 tf_mode )
+{
+ /* Initialize SX info */
+ memset( ( VOID_PTR )&channel->sx_info, SX_INITIALIZER, sizeof( SX_INFO ) ) ;
+
+ /* Initialize the SX status */
+ SX_ClearStatus( channel, SX_STATUS ) ;
+
+ /* check to see if we would like to scan tape for positioning information */
+ if( tf_mode & TF_LIST_TAPE_OPERATION ) {
+ SX_SetStatus( channel, SX_LIST_TAPE_IN_PROGRESS ) ;
+ }
+
+#if defined( MAYN_OS2 )
+ /* ( for OS/2 ) lock memory to be used by device driver */
+ TpLock( ( INT8_PTR )&( SX_GetRecord( channel ) ), &( SX_GetLock( channel ) ) ) ;
+#endif
+
+ return ;
+
+}
+
+
+/**/
+/**
+
+ Name: SX_End
+
+ Description: Contains the code to ensure any opened SX file is closed and
+ the SX tmp file is deleted
+
+ Modified: 5/2/91
+
+ Returns: nothing
+
+ Notes: memory is TpLocked for OS/2 device driver reference
+
+ called by: TFCLOSE TF_CloseSet()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID SX_End( CHANNEL_PTR channel )
+{
+ /* in case positioning was attempted using an SX file for an EXABYTE 8200SX - MaynStream 2200+ ... */
+ if( SX_FileIsOpen( channel ) || SX_TmpFileIsOpen( channel ) ) {
+ SX_CloseFile( channel ) ;
+ }
+
+ /* build the tmp file name */
+ strcpy( lw_cat_file_path_end, SX_TMP_FILE_NAME ) ;
+
+ /* delete the file tmp file */
+ unlink( lw_cat_file_path ) ;
+
+ /* reset the SX status */
+ SX_ClearStatus( channel, SX_STATUS ) ;
+
+#if defined( MAYN_OS2 )
+ /* unlock memory */
+ TpUnlock( &( SX_GetLock( channel ) ) ) ;
+#endif
+
+ return ;
+
+}
+
+
+/**/
+/**
+
+ Name: SX_OpenFile
+
+ Description: Contains the code to open the SX file in READ mode for a physical tape.
+
+ Modified: 4/12/91
+
+ Returns: TRUE - successful
+ FALSE - unsuccessful
+
+ Notes: called by: POSATSET PositionAtSet()
+ READ StartRead()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN SX_OpenFile(
+ CHANNEL_PTR channel,
+ UINT32 tape_id,
+ UINT16 ts_num )
+{
+ BOOLEAN result = TRUE ;
+ CHAR sx_file_name[ SX_FILE_NAME_LENGTH ] ;
+
+ /* close any SX files which may be open */
+ result = SX_CloseFile( channel ) ;
+
+ if( result ) {
+
+ /* generate the name in the form "TAPE ID"."TS_NUM" */
+ sprintf( sx_file_name, SX_FILE_FORMAT, tape_id, ts_num ) ;
+
+ /* form the full path name */
+ strcpy( lw_cat_file_path_end, sx_file_name ) ;
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ /* open the file */
+
+// if( ( SX_FileHandle( channel ) = UNI_fopen( lw_cat_file_path, SX_READ_FLAG ) ) == -1 ) {
+// result = FALSE ;
+// } else {
+// /* indicate the file is opened for READ */
+// SX_SetStatus( channel, SX_OPEN_FOR_READ ) ;
+//
+// /* be sure we are at the beginning */
+// result = SX_SeekFile( channel, 0L, SEEK_SET, SX_FILE ) ;
+//
+// /* indicate where we are at */
+// if( result ) {
+// SX_SetAt( channel, SX_AT_BOF ) ;
+// } else {
+// SX_ClearAt( channel ) ;
+// }
+// }
+ }
+
+ return( result ) ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_CloseFile
+
+ Description: Contains the code to close the SX file for a physical tape and the SX tmp file
+ if either or both were open.
+
+ Modified: 5/8/91
+
+ Returns: TRUE - successful
+ FALSE - unsuccessful
+
+ Notes: called by: POSATSET PositionAtSet()
+ READ StartRead()
+ SX SX_OpenFile()
+ SX SX_End()
+ SX SX_EndSampling()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN SX_CloseFile( CHANNEL_PTR channel )
+{
+ BOOLEAN result_sx = TRUE ;
+ BOOLEAN result_tmp = TRUE ;
+
+ /* if the SX file is open ... */
+ if( SX_FileIsOpen( channel ) ) {
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ /* close the SX file */
+ if( close( SX_FileHandle( channel ) ) != 0 ) {
+ result_sx = FALSE ;
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ /* clear the handle */
+ SX_FileHandle( channel ) = -1L ;
+ }
+
+ /* if the SX tmp file is open ... */
+ if( SX_TmpFileIsOpen( channel ) ) {
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ /* close the SX tmp file */
+ if( close( SX_TmpFileHandle( channel ) ) != 0 ) {
+ result_tmp = FALSE ;
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ /* clear the handle */
+ SX_TmpFileHandle( channel ) = -1L ;
+ }
+
+ /* clear the status of any refernece to files being opened */
+ SX_ClearStatus( channel, SX_OPEN ) ;
+
+ return( result_sx && result_tmp ) ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_DeleteFile
+
+ Description: Contains the code to delete the SX file for the specified physical tape.
+
+ Modified: 4/4/91
+
+ Returns: 0 - successful
+ -1 - error ( check errno )
+
+ Notes: called by: POSATSET PositionAtSet()
+ TFERASE TF_EraseChannel()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 SX_DeleteFile(
+ UINT32 tape_id,
+ UINT16 ts_num )
+{
+ CHAR sx_file_name[ SX_FILE_NAME_LENGTH ] ;
+
+ /* generate the name in the form "TAPE ID"."TS_NUM" */
+ sprintf( sx_file_name, SX_FILE_FORMAT, tape_id, ts_num ) ;
+
+ /* form the full path name */
+ strcpy( lw_cat_file_path_end, sx_file_name ) ;
+
+ /* delete the file */
+
+ return( unlink( lw_cat_file_path ) ) ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_WriteTmpFile
+
+ Description: Contains the code to write a record to the SX tmp file.
+
+ Modified: 4/12/91
+
+ Returns: TRUE - successful
+ FALSE - unsuccessful
+
+ Notes: called by: READ AcquireReadBuffer()
+ READ CleanUpDriverQ()
+ WRITE AcquireWriteBuffer()
+ WRITE FinishWrite()
+ SX SX_ShowBlock()
+ SX SX_StartSampling()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN SX_WriteTmpFile( CHANNEL_PTR channel )
+{
+ BOOLEAN result = FALSE ;
+
+ /* the tmp file has to be open ... */
+ if( SX_TmpFileIsOK( channel ) ) {
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ /* write the record in the tmp file */
+ if( write( SX_TmpFileHandle( channel ),
+ ( CHAR_PTR )&( SX_GetRecord( channel ) ),
+ sizeof( SX_RECORD ) )
+ == sizeof( SX_RECORD ) ) {
+ result = TRUE ;
+#ifdef SX_DEBUG
+ SX_InfoDump( channel, TEXT("SX_WriteTmpFile( )") ) ;
+#endif
+ } else {
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ } else {
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+
+ return( result ) ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_SeekSetInFile
+
+ Description: Contains the code to lseek to the first record of a set in the SX file.
+
+ Modified: 4/12/91
+
+ Returns: TRUE - successful
+ FALSE - unsuccessful
+
+ Notes: called by: POSATSET PositionAtSet()
+ READ StartRead()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN SX_SeekSetInFile(
+ CHANNEL_PTR channel,
+ INT16 set,
+ INT16 mode )
+{
+ BOOLEAN found = FALSE ;
+ BOOLEAN done = FALSE ;
+ SX_RECORD record_hold ;
+
+ /* we are looking into a new set so ... */
+ SX_ClearStatus( channel, SX_FOUND_BLOCK ) ;
+
+ /* the SX file must be open ... */
+ if( SX_FileIsOK( channel ) ) {
+
+ /* if we are just checking to see if this set is here */
+ if( mode == SX_CHECKING_FOR_SET ) {
+
+ /* in case we've got something importaant like a would be VCB */
+ record_hold = SX_GetRecord( channel ) ;
+ }
+
+ /* make sure we're at the beginning */
+ if( !SX_IsStatusSet( channel, SX_AT_BOF ) ) {
+ SX_SeekFile( channel, 0L, SEEK_SET, SX_FILE ) ;
+ }
+
+ do {
+ /* make sure we remember where we were */
+ if( SX_SeekFile( channel, 0L, SEEK_CUR, SX_FILE ) ) {
+
+ /* read the record from the SX file */
+ if( SX_ReadFile( channel ) ) {
+
+ /* determine the set from the record and see it it matches */
+ if( set == SX_GetBackupSetNumber( channel ) ) {
+ found = TRUE ;
+ done = TRUE ;
+ }
+ } else {
+ done = TRUE ;
+ }
+ } else {
+ done = TRUE ;
+ }
+
+ } while( !done ) ;
+
+ /* if we are just checking to see if this set is here */
+ if( mode == SX_CHECKING_FOR_SET ) {
+
+ /* reset the record */
+ SX_SetRecord( channel, record_hold ) ;
+
+ } else if( found ) {
+
+ /* make sure we are at where we were */
+ SX_OffsetFile( channel ) ;
+ SX_SetAt( channel, SX_AT_SET ) ;
+ }
+ }
+
+ return( found ) ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_FindBlock
+
+ Description: Contains the code to fast seek to a lba using the SX file.
+
+ Modified: 4/15/91
+
+ Returns: A TFL error code
+
+ Notes: called by: READ StartRead()
+ READ DoRead()
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 SX_FindBlock(
+ CHANNEL_PTR channel,
+ UINT32 lba,
+ TPOS_PTR ui_tpos,
+ INT16 tf_message )
+{
+ INT16 ret_val = TFLE_DRIVE_FAILURE ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ BOOLEAN done = FALSE ;
+ BOOLEAN ready = FALSE ;
+ SX_RECORD record_hold ;
+ UINT32 at_set_hold ;
+ RET_BUF myret ;
+
+ /* we should never be doing this unless we are ready ... */
+ if( SX_IsOK( channel ) &&
+ SX_IsStatusSet( channel, SX_AT_SET ) ) {
+
+ ret_val = TFLE_NO_ERR ;
+ at_set_hold = SX_GetMisc( channel ) ;
+
+ /* let everyone know what we are doing */
+ BE_Zprintf( DEBUG_TAPE_FORMAT,
+ RES_GOTO_LBA,
+ curDRV->cur_pos.pba_vcb,
+ curDRV->cur_pos.lba_vcb,
+ lba,
+ lba ) ;
+
+ if( ui_tpos != NULL ) {
+ ( *ui_tpos->UI_TapePosRoutine )( tf_message,
+ ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb,
+ 0 ) ;
+ } else {
+ /* relinquish control */
+ ThreadSwitch( ) ;
+ }
+
+ /* since we will overwrite the SX_RECORD */
+ SX_ClearAt( channel ) ;
+
+ /* if we already close by ... */
+ if( SX_IsNearbyLBA( channel, lba ) ) {
+
+ /* but we are not actually already there ... */
+ if( SX_IsNotAlreadyAtLBA( channel, lba ) ) {
+
+ /* VOID out the SX_POSITION information */
+ memset( ( VOID_PTR )&( SX_GetPosition( channel ) ), SX_DO_NOT_MOVE, sizeof( SX_POSITION ) ) ;
+
+ /* indicate where we currently are */
+ SX_SetLBA( channel ) ;
+
+ /* everything is set to issue a TpSpecial call which will only SPACE from where we are */
+ ready = TRUE ;
+ }
+ } else {
+
+ /* find the closest previously sampled position */
+ do {
+ /* hold on to the wanna be */
+ record_hold = SX_GetRecord( channel ) ;
+
+ /* read the next record */
+ if( SX_ReadFile( channel ) ) {
+
+ /* determine if this lba goes too far */
+ if( SX_GetLBA( channel ) > lba ) {
+
+ /* the wanna be is a */
+ SX_SetRecord( channel, record_hold ) ;
+
+ ready = TRUE ;
+ done = TRUE ;
+ }
+ } else {
+ done = TRUE ;
+ }
+
+ } while( !done ) ;
+ }
+
+ if( ready ) {
+
+ /* determine how many blocks to SPACE after the position is reached */
+ if( ChannelBlkSize( channel ) > channel->lb_size ) {
+ channel->sx_info.sx_record.lba =
+ ( lba - SX_GetLBA( channel ) ) /
+ ( ChannelBlkSize( channel ) / channel->lb_size ) ;
+ } else {
+ channel->sx_info.sx_record.lba =
+ ( lba - SX_GetLBA( channel ) ) *
+ ( channel->lb_size / ChannelBlkSize( channel ) ) ;
+ }
+#ifdef SX_DEBUG
+ SX_InfoDump( channel, TEXT("SX_FindBlock( )") ) ;
+#endif
+ /* really go there */
+ TpSpecial( curDRV->drv_hdl, (INT16)SS_FIND_BLOCK, ( UINT32 )&( SX_GetRecord( channel ) ) ) ;
+
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ if( ui_tpos != NULL ) {
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if( ( *ui_tpos->UI_TapePosRoutine )( TF_IDLE_NOBREAK,
+ ui_tpos,
+ curDRV->vcb_valid,
+ &curDRV->cur_vcb, 0 ) == UI_ABORT_POSITIONING ) {
+ ret_val = TFLE_USER_ABORT ;
+ }
+ } else {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+ }
+
+ /* reset the SX file to be positioned at the set for the next search */
+ if( SX_SeekFile( channel, at_set_hold, SEEK_SET, SX_FILE ) ) {
+
+ /* restore the record in the SX info */
+ if( SX_ReadFile( channel ) ) {
+
+ /* reset the SX file to be positioned at the set for the next search */
+ if ( SX_SeekFile( channel, at_set_hold, SEEK_SET, SX_FILE ) ) {
+
+ SX_SetAt( channel, SX_AT_SET ) ;
+ } else {
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ } else {
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ } else {
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ }
+
+ if( !ret_val ) {
+
+ /* we fould what we were looking for */
+ SX_SetLBANow( channel, lba ) ;
+ SX_SetStatus( channel, SX_FOUND_BLOCK ) ;
+ }
+
+ return( ret_val ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: SX_ShowBlock
+
+ Description: Contains the code to determine the position of the drive on an SX drive.
+
+ Modified: 5/2/91
+
+ Returns: A TFL error code
+
+ Notes: called by: DRIVES ReadNextSet()
+ SX SX_SamplingProcessing()
+ SX SX_EndSampling()
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 SX_ShowBlock(
+ CHANNEL_PTR channel,
+ UINT16 mode )
+{
+ RET_BUF myret ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+#ifdef SX_DEBUG
+ BE_Zprintf( 0, TEXT("\nSX_ShowBlock()\n") ) ;
+#endif
+
+ if( SX_IsOK( channel ) ) {
+
+ /* reset the memory */
+ memset( ( VOID_PTR )&( SX_GetPosition( channel ) ), SX_INITIALIZER, sizeof( SX_POSITION ) ) ;
+
+ /* do it */
+ TpSpecial( channel->cur_drv->drv_hdl, (INT16)SS_SHOW_BLOCK, ( UINT32 )&( SX_GetPosition( channel ) ) ) ;
+
+ /* if this is not to be queued ... */
+ if( mode & SX_SHOW_IMMEDIATE ) {
+
+ while( TpReceive( channel->cur_drv->drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if( myret.gen_error ) {
+ channel->cur_drv->thw_inf.drv_status = myret.status ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ } else if( mode & SX_SHOW_WRITE ) {
+ /* write the positioning information sample to the SX file */
+ SX_WriteTmpFile( channel ) ;
+ }
+ }
+
+ if( !ret_val ) {
+ /* if we think this might turn out to be a VCB ... */
+ if( mode & SX_SHOW_VCB_PENDING ) {
+ SX_SetType( channel, SX_VCB_PENDING ) ;
+ } else {
+ SX_ClearType( channel ) ;
+ }
+ }
+ } else {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+
+ return( ret_val ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: SX_SamplingProcessing
+
+ Description: Contains the code to sample the tape position for the SX.
+
+ Modified: 4/11/91
+
+ Returns: Nothing
+
+ Notes: called by: READ ReadRequest()
+ WRITE WriteRequest()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID SX_SamplingProcessing(
+ CHANNEL_PTR channel,
+ UINT32 bytes )
+{
+ /* is it soup yet ??? */
+ if( SX_SampleNeeded( channel ) ) {
+
+ /* set the lba which will be associated with the position */
+ SX_SetLBA( channel ) ;
+
+ /* determine when the next sample needs to be taken */
+ SX_NextSample( channel ) ;
+
+ SX_ShowBlock( channel, SX_SHOW_QUEUED ) ;
+ }
+
+ /* adjust the LBA for next call to SX_SamplingProcessing */
+ SX_AdjustLBANow( channel, bytes ) ;
+
+ return ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_StartSampling
+
+ Description: Contains the code to begin processing records into an SX file
+
+ Modified: 4/11/1991
+
+ Returns: Nothing
+
+ Notes: called by: READ StartRead()
+ WRITE WriteDBLK()
+ WRITE EOM_Write()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID SX_StartSampling( CHANNEL_PTR channel )
+{
+ /* open tmp file */
+ SX_OpenTmpFile( channel ) ;
+
+ if( SX_TmpFileIsOK( channel ) ) {
+
+ /* set the backup set number which will be associated with the position */
+ SX_SetBackupSetNumber( channel ) ;
+
+
+ /* FIRST figure out where we are ... */
+
+ /* we do things differently for continuation backup sets when scanning a tape ... */
+ if( SX_IsStatusSet( channel, SX_SCAN_ACTIVE ) &&
+ ( FS_IsBlockContinued( ( &channel->cur_drv->cur_vcb ) ) ) ) {
+
+ /* initialize the LBA for the first call to SX_SamplingProcessing */
+ SX_SetLBANow( channel, channel->cur_drv->cur_pos.lba_vcb ) ;
+
+ /* vs. continuation backup sets during WRITE ... */
+ } else if( AtEOM( channel ) ) {
+
+ /* initialize the LBA for the first call to SX_SamplingProcessing */
+ SX_SetLBANow( channel, channel->eom_lba ) ;
+
+ /* vs. anything else */
+ } else {
+
+ /* initialize the LBA for the first call to SX_SamplingProcessing */
+ SX_SetLBANow( channel, SX_FIRST_LBA ) ;
+ }
+
+
+ /* THEN figure out how to go about recording it ... */
+
+ /* we do things differently when scanning a tape ... */
+ if( SX_IsStatusSet( channel, SX_SCAN_ACTIVE ) ) {
+
+ /* set the lba which will be associated with the position */
+ SX_SetLBA( channel ) ;
+
+ /* setup for next call to SX_SamplingProcessing */
+ SX_SetMisc( channel, SX_GetLBANow( channel ) + SX_SAMPLE_RATE ) ;
+
+ /* record the previous SHOW for the VCB now or it might be too late */
+ SX_WriteTmpFile( channel ) ;
+
+ /* vs. anything else */
+ } else {
+
+ /* force a SHOW on next call to SX_SamplingProcessing */
+ SX_SetMisc( channel, SX_GetLBANow( channel ) ) ;
+ }
+ }
+
+ return ;
+
+}
+
+
+
+/**/
+/**
+
+ Name: SX_EndSampling
+
+ Description: Contains the code to get the last sample of the tape position for the SX.
+
+ Modified: 4/11/91
+
+ Returns: Nothing
+
+ Notes: called by: READ AcquireReadBuffer()
+ WRITE FinishWrite()
+ WRITE EOMWrite()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID SX_EndSampling( CHANNEL_PTR channel )
+{
+ INT32 tmp_file_length ;
+ CHAR sx_file_name[ SX_FILE_NAME_LENGTH ] ;
+
+ if( SX_TmpFileIsOK( channel ) ) {
+
+ /* set the LBA which will be associated with the "last" position */
+ SX_SetLBANow( channel, SX_LAST_LBA ) ;
+
+ /* set the PBA which will be associated with the "last" position */
+ SX_SetLBA( channel ) ;
+
+ /* process the "last" position */
+ SX_ShowBlock( channel, SX_SHOW_IMMEDIATE | SX_SHOW_WRITE ) ;
+
+ if( SX_TmpFileIsOK( channel ) ) {
+
+ /* generate the name in the form "TAPE ID"."TS_NUM" */
+ sprintf( sx_file_name, SX_FILE_FORMAT, channel->tape_id, channel->ts_num ) ;
+
+ /* form the full path name */
+ strcpy( lw_cat_file_path_end, sx_file_name ) ;
+
+ /* open the SX file */
+// if( ( SX_FileHandle( channel ) = UNI_fopen( lw_cat_file_path, SX_WRITE_FLAG ) ) != -1 ) {
+ if ( 0 ) {
+
+ /* indicate the SX file is open */
+ SX_SetStatus( channel, SX_OPEN_FOR_WRITE ) ;
+
+ /* save the length of the SX file */
+ SX_SetMisc( channel, filelength( SX_FileHandle( channel ) ) ) ;
+
+ /* save the length of the temp file */
+ tmp_file_length = filelength( SX_TmpFileHandle( channel ) ) ;
+
+ /* if the lengths of the files are OK ... */
+ if( ( SX_GetMisc( channel ) != -1L ) && ( tmp_file_length != -1L ) ) {
+
+ /* seek to the beginning of the TMP file */
+ SX_SeekFile( channel, 0L, SEEK_SET, SX_TMP_FILE ) ;
+
+ /* seek to the end of the SX file */
+ SX_SeekFile( channel, 0L, SEEK_END, SX_FILE ) ;
+
+ /* if the length of the SX file can be properly extended to include all of the tmp file ... */
+ if( SX_IsOK( channel ) && ( chsize( SX_FileHandle( channel ), SX_GetMisc( channel ) + tmp_file_length ) != -1L ) ) {
+
+ /* reseek to the end of the SX file */
+ SX_OffsetFile( channel ) ;
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ while( read( SX_TmpFileHandle( channel ),
+ ( CHAR_PTR )&( SX_GetRecord( channel ) ),
+ sizeof( SX_RECORD ) )
+ == sizeof( SX_RECORD ) ) {
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ write( SX_FileHandle( channel ),
+ ( CHAR_PTR )&( SX_GetRecord( channel ) ),
+ sizeof( SX_RECORD ) ) ;
+ }
+ } else {
+ /* out of disk space */
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ } else {
+ /* ??? */
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ } else {
+ /* out of disk space or ??? */
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+ }
+ }
+
+ /* all the positioning info has been gathered for this set so close the SX file */
+ SX_CloseFile( channel ) ;
+
+
+ return ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_OpenTmpFile
+
+ Description: Contains the code to open the SX tmp file
+
+ Modified: 4/12/91
+
+ Returns: TRUE - successful
+ FALSE - unsuccessful
+
+ Notes: called by: SX_StartSampling()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static BOOLEAN SX_OpenTmpFile( CHANNEL_PTR channel )
+{
+ BOOLEAN result = TRUE ;
+
+ /* form the full path name */
+ strcpy( lw_cat_file_path_end, SX_TMP_FILE_NAME ) ;
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ /* open the file */
+// if( ( SX_TmpFileHandle( channel ) = UNI_fopen( lw_cat_file_path, SX_TMP_FLAG ) ) == -1 ) {
+//
+ SX_SetStatus( channel, SX_ERROR ) ;
+ result = FALSE ;
+
+// } else {
+//
+// SX_SetStatus( channel, SX_TMP_OPEN_FOR_WRITE ) ;
+// }
+
+ return( result ) ;
+
+}
+
+
+
+/**/
+/**
+
+ Name: SX_SeekFile
+
+ Description: Contains the code to lseek in the SX file.
+
+ Modified: 5/5/91
+
+ Returns: TRUE - successful
+ FALSE - unsuccessful
+
+ Notes: called by: SX_OpenFile()
+ SX_FindBlock()
+ SX_SeekSetInFile()
+ SX_StartSampling()
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static BOOLEAN SX_SeekFile(
+ CHANNEL_PTR channel,
+ INT32 offset,
+ INT origin,
+ INT file_type )
+{
+ BOOLEAN result = FALSE ;
+ INT32 position = -1L ;
+
+ /* do it for either the SX file or the SX tmp file according to file_type */
+ if( ( file_type == SX_FILE ) ? SX_FileIsOK( channel ) : SX_TmpFileIsOK( channel ) ) {
+
+ if( ( position = lseek( ( file_type == SX_FILE ) ? SX_FileHandle( channel )
+ : SX_TmpFileHandle( channel ),
+ offset,
+ origin ) ) != -1L ) {
+ result = TRUE ;
+ }
+ }
+
+ /* if you can't get there from here ... */
+ if( position == -1L ) {
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+
+ if( SX_IsStatusSet( channel, SX_OPEN_FOR_READ ) ) {
+ /* this is how we know where we are at */
+ SX_SetMisc( channel, position ) ;
+ }
+
+ if( file_type == SX_FILE ) {
+ /* we are no longer where we were */
+ SX_ClearAt( channel ) ;
+ }
+
+ return( result ) ;
+
+}
+
+
+
+
+/**/
+/**
+
+ Name: SX_ReadFile
+
+ Description: Contains the code to read a record from the SX file.
+
+ Modified: 4/12/91
+
+ Returns: TRUE - successful
+ FALSE - unsuccessful
+
+ Notes: called by: SX_OpenFile()
+ SX_SeekSetInFile()
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static BOOLEAN SX_ReadFile( CHANNEL_PTR channel )
+{
+ BOOLEAN result = FALSE ;
+
+ /* the SX file needs to be open ... */
+ if( SX_FileIsOK( channel ) ) {
+
+ /* relinquish control */
+ ThreadSwitch( ) ;
+
+ /* read a record */
+ if( read( SX_FileHandle( channel ),
+ ( CHAR_PTR )&( SX_GetRecord( channel ) ),
+ sizeof( SX_RECORD ) )
+ == sizeof( SX_RECORD ) ) {
+ result = TRUE ;
+ }
+ } else {
+ SX_SetStatus( channel, SX_ERROR ) ;
+ }
+
+ /* we are no longer where we were */
+ SX_ClearAt( channel ) ;
+
+ return( result ) ;
+
+}
+
+
+
+#ifdef SX_DEBUG
+
+/**/
+/**
+
+ Name: SX_InfoDump
+
+ Description: Contains the code to debug the current sx_info
+
+ Modified: 4/23/91
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID SX_InfoDump(
+ CHANNEL_PTR channel,
+ CHAR_PTR message )
+{
+ INT16 index ;
+
+ BE_Zprintf( 0, TEXT("\n\nposition") ) ;
+
+ for( index = 0 ; index < sizeof( SX_POSITION ) ; index++ ) {
+ BE_Zprintf( 0, TEXT(" %02X"), channel->sx_info.sx_record.sx_position.data[ index ] ) ;
+ }
+
+ BE_Zprintf( 0, TEXT("\nset 0x%04x"), channel->sx_info.sx_record.set ) ;
+ BE_Zprintf( 0, TEXT("\nlba 0x%08lx"), channel->sx_info.sx_record.lba ) ;
+ BE_Zprintf( 0, TEXT("\nlba_now 0x%08lx"), channel->sx_info.lba_now ) ;
+ BE_Zprintf( 0, TEXT("\nmisc 0x%08lx"), channel->sx_info.misc ) ;
+ BE_Zprintf( 0, TEXT("\nhdl 0x%04x"), channel->sx_info.sx_hdl ) ;
+ BE_Zprintf( 0, TEXT("\ntmp 0x%04x"), channel->sx_info.sx_tmp ) ;
+ BE_Zprintf( 0, TEXT("\nstatus 0x%04x"), channel->sx_info.status ) ;
+
+ BE_Zprintf( 0, TEXT("\n\n%s\n\n"), message ) ;
+
+ return ;
+
+}
+
+#endif
+
+
diff --git a/private/utils/ntbackup/src/sypl10rd.c b/private/utils/ntbackup/src/sypl10rd.c
new file mode 100644
index 000000000..4652b440a
--- /dev/null
+++ b/private/utils/ntbackup/src/sypl10rd.c
@@ -0,0 +1,1365 @@
+/**
+Copyright(c) Archive Software Division 1984-89
+
+
+ Name: sypl10rd.c
+
+ Description: Translator for Sytos Plus V. 1.0
+
+ $Log: T:/LOGFILES/SYPL10RD.C_V $
+
+ Rev 1.38.1.2 01 Jun 1994 14:08:00 GREGG
+Process the ACL data stream BEFORE the EA data stream.
+
+ Rev 1.38.1.1 24 May 1994 14:56:32 GREGG
+Clear channel skip_stream bit in ReadMakeStreams.
+
+ Rev 1.38.1.0 02 Mar 1994 18:28:34 GREGG
+Don't screw with the channel's stream info in init!!!
+
+ Rev 1.38 22 Feb 1994 18:03:36 GREGG
+Reset the 'streamMode' flag at the start of all read operations (EPR 91).
+
+ Rev 1.37 16 Feb 1994 19:17:00 GREGG
+More fixes to ConvertName, and changed return types to match func tab.
+
+ Rev 1.36 14 Feb 1994 17:06:32 GREGG
+Fixed reading of UNC path names. Cleaned up ConvertName function and
+added error handling to loop reading past the first filemark in the
+NewTape routine.
+
+ Rev 1.35 24 Jan 1994 15:59:34 GREGG
+Fixed warnings.
+
+ Rev 1.34 16 Jan 1994 14:31:56 GREGG
+Unicode bug fixes.
+
+ Rev 1.33 14 Jan 1994 15:25:36 BARRY
+Adjust string counts and terminate strings after strncpy calls
+
+ Rev 1.32 15 Dec 1993 19:48:24 GREGG
+Added support for UNC path specification.
+
+ Rev 1.31 22 Nov 1993 18:07:08 BARRY
+Unicode fixes. Used ANSI versions of string functions. Made about
+a million unnecessary casts to CHAR_PTR because the FSYS headers
+aren't correct. These should probably be cleaned up at a later time.
+
+
+ Rev 1.30 21 Oct 1993 15:57:36 BARRY
+Fixed warning
+
+ Rev 1.29 16 Aug 1993 22:43:08 BARRY
+Fix warning.
+
+ Rev 1.28 09 Aug 1993 16:41:36 TerriLynn
+Fix for EPR#357-698
+
+ Rev 1.27 02 Aug 1993 17:04:02 TerriLynn
+Added TFLE for Use SYPL ECC Flag
+
+ Rev 1.26 26 Jul 1993 14:35:18 TerriLynn
+The Enterprise team must be able to
+see this global or they don't compile.
+
+ Rev 1.25 21 Jul 1993 18:25:14 TerriLynn
+Set the VCB's tape seq num with the one from tape.
+In New Tape, check for user requested processing
+of Sytron's ECC.
+
+ Rev 1.24 16 Jul 1993 12:13:52 STEVEN
+fix alignment problem on mips
+
+ Rev 1.23 15 Jul 1993 14:21:48 STEVEN
+fix volume header
+
+ Rev 1.22 23 Jun 1993 16:25:38 STEVEN
+fix retrans bug with ECC
+
+ Rev 1.21 17 May 1993 09:30:28 TerriLynn
+fixed compiler warning from ReTranslate
+
+ Rev 1.19 13 May 1993 17:51:34 Terri_Lynn
+If EOM need to set continue obj true
+
+ Rev 1.18 13 May 1993 16:11:50 Terri_Lynn
+Changed Stream order for EAs ACLs and Data
+
+ Rev 1.17 11 May 1993 21:55:32 GREGG
+Moved Sytos translator stuff from layer-wide area to translator.
+
+ Rev 1.16 11 May 1993 08:50:40 Terri__Lynn
+Initialize pad_size in FDB and DDB
+
+ Rev 1.15 10 May 1993 17:03:00 Terri_Lynn
+ added Steve's change to make it a super streamer
+
+ Rev 1.14 10 May 1993 15:12:20 Terri_Lynn
+Added Steve's changes and My changes for EOM processing
+
+ Rev 1.13 05 May 1993 13:53:08 terri
+1) Applied stream processing to MakeDDB for ACLs and EAs via the Mountain Man
+2) Added Steve's fix to consistently set stream processing to FALSE
+
+
+ Rev 1.12 03 May 1993 16:23:16 TERRI
+
+1) Made NULL correction in ConvertName instead of MakeDDB.
+2) Re-Initialize stream stuff on the second pass.
+3) In debug code, dump the complete header and EA block.
+4) Deleted reread stuff when the common header is not found. Instead
+ continue to process as a BT_STREAM. This has the same effect.
+
+ Rev 1.11 02 May 1993 20:17:52 BARRY
+Got rid of ternary that MIPS refused to compile.
+
+ Rev 1.10 28 Apr 1993 17:58:36 TERRI
+
+Surrounded the temporary code with if
+defined SYPL10_TRANS_DEBUG
+
+ Rev 1.9 28 Apr 1993 17:34:00 TERRI
+
+Updated file name and path name with ending
+NULLS and incremented the length of each. In other
+words, "STRING" len is 6 now is "STRING0" len is 7.
+
+Also there is temporay code in this version. The code
+creates an output file, syplea.dat with EA data info.
+The format is FilenameBeginofEAData. For the Mountain Man.
+
+ Rev 1.8 26 Apr 1993 02:43:42 GREGG
+Sixth in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Redefined attribute bits to match the spec.
+ - Eliminated unused/undocumented bits.
+ - Added code to translate bits on tapes that were written wrong.
+
+Matches MAYN40RD.C 1.59, DBLKS.H 1.15, MAYN40.H 1.34, OTC40RD.C 1.26,
+ SYPL10RD.C 1.8, BACK_VCB.C 1.17, MAYN31RD.C 1.44, SYPL10.H 1.2
+
+ Rev 1.7 21 Apr 1993 17:02:52 TERRI
+Fixed count for number of tapes.
+Fixed display size for a backup set.
+Changed reaction when a file header can't
+be found for the second time.
+
+ Rev 1.5 08 Apr 1993 12:10:16 TERRI
+Removed references to long names EA and ACL.
+Fixed inability to create sub dirs - don't eat the sub dir header
+
+
+
+ Rev 1.4 02 Apr 1993 12:52:32 TERRI
+Took out code path for setting long names when GENing an FDB or DDB
+**
+*/
+#include <malloc.h>
+#include <string.h>
+#include <ctype.h>
+#include <memory.h>
+#include <time.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "datetime.h"
+#include "msassert.h"
+#include "channel.h"
+#include "drive.h"
+#include "drvinf.h"
+#include "dilhwd.h"
+#include "retbuf.h"
+#include "dddefs.h"
+#include "dil.h"
+#include "buffman.h"
+#include "tfl_err.h"
+#include "tfldefs.h"
+#include "translat.h"
+#include "lwprotos.h"
+#include "lw_data.h"
+#include "fmteng.h"
+#include "generr.h"
+#include "genstat.h"
+#include "transutl.h"
+#include "osinfo.h"
+
+/* local includes */
+#include "syplpto.h" /* sytos plus prototypes */
+#include "sypl10.h" /* sytos plus structures and defines */
+
+static VOID _near SYPLSetStandFields( CHANNEL_PTR, STD_DBLK_DATA_PTR ) ;
+
+#ifdef OS_DOS
+#pragma alloc_text( SYPL10RD_1, SYPL_Initialize, SYPL_DeInitialize, SYPL_GetCurrentVCB )
+#pragma alloc_text( SYPL10RD_2, SYPL_Parse, SYPL_ReadMakeDDB, SYPL_ReadMakeFDB )
+#pragma alloc_text( SYPL10RD_3, SYPL_NewTape, SYPL_ReTranslate )
+#pragma alloc_text( SYPL10RD_4, SYPLDateToDateTime, ConvertName )
+#pragma alloc_text( SYPL10RD_5, DecryptTapePassword, NextECC )
+#pragma alloc_text( SYPL10RD_6, SYPL_ReadMakeStreams SYPL_RdException )
+#pragma alloc_text( SYPL10RD_7, SYPL_MoveToVCB )
+#endif
+
+/* define iff viper tdh is fixed to propegate EOM status */
+#define TRUST_VIPER_EOM 0
+
+/**/
+/**
+
+ Name: SYPLDatetoDateTime
+
+ Description: Converts Sytos Plus' modified date format to
+ a date time pointer.
+
+**/
+static VOID NEAR SYPLDateToDateTime(
+ UINT32_PTR date, /* I pointer to Sytos Plus Date */
+ DATE_TIME_PTR datetime /* O pointer to a datetime struct */
+ )
+{
+ S10_DATE_FIELD_PTR df ;
+ S10_TIME_FIELD_PTR tf ;
+ UINT16 low ;
+ UINT16 high ;
+ UINT32 UNALIGNED *udate = (UINT32 UNALIGNED *)date ;
+ DATE_TIME UNALIGNED *udatetime = (DATE_TIME UNALIGNED *)datetime ;
+
+ udatetime->date_valid = FALSE ;
+
+ high = (UINT16)( *udate ) ; /* This is high to Sytos i.e. Motorola */
+ low = (UINT16)( *udate >> 16 ) ; /* This is low to Sytos i.e. Motorola */
+
+ df = (S10_DATE_FIELD_PTR ) &high ;
+ tf = (S10_TIME_FIELD_PTR ) &low ;
+
+ if( *udate != FAT_FILE_SYSTEM ) {
+ udatetime->second = (UINT16)tf->second ;
+ udatetime->minute = (UINT16)tf->minute ;
+ udatetime->hour = (UINT16)tf->hour ;
+ udatetime->day = (UINT16)df->day ;
+ udatetime->month = (UINT16)df->month ;
+ udatetime->year = (UINT16)df->year + 1900 ;
+ udatetime->date_valid = TRUE ;
+ udatetime->day_of_week = 0 ;
+ }
+
+}
+/**/
+/**
+
+ Name: DeterminePadSize
+
+ Description: Determines the pad size when given the length of data
+ and the current block size.
+**/
+
+static UINT16 NEAR DeterminePadSize(
+ UINT32 data_len, /* I length of data */
+ UINT16 block_size /* I current block size */
+ )
+{
+ UINT16 nbb = 0 ; /* next block boundary */
+ UINT16 blks = 0 ; /* number of blocks */
+ UINT16 pad_size = 0 ; /* pad size */
+
+ if( data_len > 0 ) {
+ /* calculate next block boundary */
+ if( data_len > block_size ) {
+ /* Calculate the next block boundary */
+ blks = (UINT16)data_len / block_size ;
+ if( data_len % block_size ) {
+ blks++ ;
+ }
+ nbb = blks * block_size ;
+ /* calculate pad size */
+ pad_size = (UINT16)(nbb - data_len) ;
+ } else {
+ if( data_len == block_size ) {
+ pad_size = 0 ;
+ } else {
+ pad_size = block_size - (UINT16)data_len ;
+ }
+ }
+ }
+ return pad_size ;
+}
+/**/
+/**
+
+ Name: DecryptTapePassword
+
+ Description: Decrypts the tapes password located in the
+ tape header.
+
+**/
+static VOID NEAR DecryptTapePassword(
+ VOID_PTR buffer /* I buffer containing the tape header */
+ )
+{
+ S10_COMMON_HEADER_PTR common_hdr_ptr = (S10_COMMON_HEADER_PTR)buffer ;
+ UINT8_PTR p = buffer ;
+ size_t size = 0 ;
+
+ switch ( common_hdr_ptr->type ) {
+
+ case tape_header_type :
+ {
+ S10_TAPE_HEADER_PTR th = (S10_TAPE_HEADER_PTR)buffer ;
+ /* decrypt the password */
+ for ( size = SHORT_NAME_LEN, p = th->password; size > 0 && *p != '\0'; p++, size-- ) {
+ *p ^= PWD_CRYPT_CHAR ;
+ }
+ }
+ break ;
+
+ default : /* garbage data */
+ msassert( FALSE ) ;
+ break ;
+ }
+}
+/**/
+/**
+
+ Name: NextECC
+
+ Description: Calculates the distance in bytes to the next
+ ECC ( -1K..15K). Uses CHANNEL::blocks_used
+ and S10_ENV::prior_blocks_used
+
+**/
+
+static INT16 NEAR NextECC( CHANNEL_PTR channel, BUF_PTR buffer )
+{
+ S10_ENV_PTR env = channel->fmt_env ;
+ UINT32 here ; /* byte offset within set */
+
+ msassert( env->using_ecc ) ;
+
+ here = ( ( env->prior_blocks_used + channel->blocks_used ) << 9 ) + BM_NextByteOffset( buffer ) ;
+ return ( 16384 - 1024 ) - (INT16)( here & 16383UL ) ;
+}
+
+/**/
+/**
+
+ Name: ConvertName
+
+ Description: Parses out file and path. Changes backslashes to nulls.
+
+ Assigns new path or file len to size.
+
+**/
+static void NEAR ConvertName( VOID_PTR header )
+{
+ S10_DIRECTORY_HEADER_PTR dh = (S10_DIRECTORY_HEADER_PTR)header ;
+ S10_FILE_HEADER_PTR fh = (S10_FILE_HEADER_PTR)header ;
+ BYTE_PTR p ;
+ UINT16 pos, len ;
+
+ switch ( dh->common.type ) {
+
+ case directory_header_type :
+ if ( ( dh->path_name[0] == '\\' ) && (dh->path_name[1] == '\\') ) {
+ /* get rid of UNC name */
+ pos = 2 ;
+ while( pos < dh->path_len &&
+ dh->path_name[pos] != '\\' &&
+ dh->path_name[pos] != '\0' ) {
+ pos++ ;
+ }
+ if( pos == dh->path_len || dh->path_name[pos] == '\0' ) {
+ /* This shouldn't happen!!! We need an error!!! */
+ msassert( FALSE ) ;
+ dh->path_name[0] = '\0' ;
+ dh->path_len = 1 ;
+ break ; // END OF CASE
+ }
+ pos++ ;
+ while( pos < dh->path_len &&
+ dh->path_name[pos] != '\\' &&
+ dh->path_name[pos] != '\0' ) {
+ pos++ ;
+ }
+ if( pos == dh->path_len || dh->path_name[pos] == '\0' ) {
+ /* This is a root */
+ dh->path_name[0] = '\0' ;
+ dh->path_len = 1 ;
+ break ; // END OF CASE
+ }
+ pos++ ;
+ dh->path_len -= pos ;
+ memmove( dh->path_name, &dh->path_name[pos], (size_t)dh->path_len );
+
+ /* Change NULLs to SLASHES in the path */
+ for( p = dh->path_name, len = 0; len < dh->path_len; p++, len++ ) {
+ if( *p == '\\' ) {
+ *p = '\0' ;
+ }
+ }
+ dh->path_name[dh->path_len++] = '\0' ;
+
+ /* get rid of the drive letter */
+ } else if( dh->path_name[1] == ':' && dh->path_len > 2 ) {
+
+ /* for the path */
+ dh->path_len -= 3 ;
+ memmove( dh->path_name, &dh->path_name[3], (size_t)dh->path_len );
+
+ /* Change NULLs to SLASHES in the path */
+ for( p = dh->path_name, len = 0; len < dh->path_len; p++, len++ ) {
+ if ( *p == '\\' ) {
+ *p = '\0' ;
+ }
+ }
+ dh->path_name[dh->path_len++] = '\0' ;
+
+ } else {
+ /* for the root */
+ dh->path_name[0] = '\0' ;
+ dh->path_len = 1 ;
+
+ }
+ break ;
+
+ case file_header_type :
+ p = fh->filename + strlenA( fh->filename ) ;
+ while( p > fh->filename && *p != '\\' ) {
+ p-- ;
+ }
+ if( *p == '\\' ) {
+ p++ ;
+ }
+ fh->filename_len = strlenA( p ) + 1 ;
+ if( p != fh->filename ) {
+ memmove( fh->filename, p, (size_t)fh->filename_len ) ;
+ }
+ break ;
+ }
+}
+
+/**/
+/**
+
+ Name: SYPL_Initialize
+
+ Description: Allocates environment memory for translator
+
+**/
+INT16 SYPL_Initialize(
+ CHANNEL_PTR channel ) /* I channel pointer */
+{
+ S10_ENV_PTR env ;
+
+ /* allocate environment memory */
+ channel->fmt_env = env = calloc( 1, sizeof( S10_ENV ) ) ;
+ if ( env == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ env->bytes_left = TRUE ;
+
+ /* Reset stream stuff */
+ env->no_streams = 0 ;
+ env->streamMode = FALSE ;
+ env->currentStream = 0 ;
+
+ return TFLE_NO_ERR ;
+}
+
+/**/
+/**
+
+ Name: SYPL_NewTape
+
+ Description: Called upon first examining a new tape. This may
+ do special per-tape things for the translator.
+ When this is called, we are sitting in the right
+ place: just after the first filemark. We use all
+ the data in the buffer. Returns TFLE_xxxx codes.
+**/
+INT16 SYPL_NewTape(
+ CHANNEL_PTR channel, /* I current channel */
+ BUF_PTR buffer, /* I buffer with bytes from beginning of tape */
+ BOOLEAN_PTR need_read ) /* O TRUE if we need to re-read tape */
+{
+ S10_ENV_PTR env = channel->fmt_env ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ TPOS_PTR tpos_ptr = channel->ui_tpos;
+
+ /* from tape just read: */
+ S10_TAPE_HEADER tape_hdr ; /* from this tape */
+ S10_TAPE_HEADER_PTR header = (VOID_PTR)(BM_NextBytePtr( buffer ));
+
+ tape_hdr = *header; /* copy our header */
+ header = &tape_hdr; /* cause we're going to kill the buffer */
+
+ env->block_size = ChannelBlkSize( channel ) ;
+
+ /* The next assignment is not good because the
+ block size of the drive is not necessarily
+ the tape's logical block size but it is needed
+ to avoid a divide by zero in read.c at Start
+ Read Operation. The size can be 512 or 1024K.
+ */
+ channel->lb_size = ChannelBlkSize( channel ) ;
+
+ DecryptTapePassword( header ) ;
+
+ if ( env->continuing ) {
+ if ( header->tape_date != env->family_id || header->tape_seq_num != env->destination_tape_seq_num ) {
+ ret_val = TF_WRONG_TAPE ;
+ tpos_ptr->tape_seq_num = env->destination_tape_seq_num ;
+ }
+ } else {
+ if ( tpos_ptr == NULL || tpos_ptr->tape_id == -1 ) { /* they don't care which family */
+ if ( header->tape_seq_num != 1 ) { /* can't read this way */
+ ret_val = TF_TAPE_OUT_OF_ORDER ;
+ }
+ } else if ( tpos_ptr->tape_id != (INT32)header->tape_date ) { /* they've specified a family */
+ ret_val = TF_WRONG_TAPE ; /* and this isn't it! */
+ } else if ( header->tape_seq_num != 1 ) { /* right family... */
+ ret_val = TF_WRONG_TAPE ; /* ...wrong starting tape */
+ tpos_ptr->tape_seq_num = 1 ; /* ensure we request it! */
+ }
+ }
+
+ if ( ret_val != TFLE_NO_ERR ) {
+ return ret_val ;
+ }
+
+ /* Get the Tape Header Information */
+
+ strncpyA( env->volname, header->tape_name, SHORT_NAME_LEN );
+ env->volname[SHORT_NAME_LEN] = '\0';
+
+ strncpyA( env->password, header->password, SHORT_NAME_LEN );
+ env->password[SHORT_NAME_LEN] = '\0';
+
+ strncpyA( env->tape_descrpt, header->tape_descrpt, DESCRPT_LEN );
+ env->tape_descrpt[DESCRPT_LEN] = '\0';
+
+ SYPLDateToDateTime( &header->tape_date, &env->tape_date ) ;
+ env->family_id = header->tape_date ;
+ env->tape_seq_num = header->tape_seq_num ;
+
+ if ( ( env->tape_seq_num = header->tape_seq_num ) == 1 ) {
+ /* Initialize Backup Set Number */
+ env->current_vcb.bset_num = 1 ;
+
+ switch( gnProcessSytronECC ) {
+ case SYPL_ECC_ON:
+ header->ecc_flag = SYPL_ECC_ON ;
+ break ;
+ case SYPL_ECC_OFF:
+ header->ecc_flag = SYPL_ECC_OFF ;
+ break ;
+ default:
+ /* leaves ecc flag as is */
+ break ;
+ }
+
+ if( header->ecc_flag ) {
+ /* Check for ECC Data */
+ /* assumes that buffers are greater than 512 bytes in length. */
+ env->using_ecc = ( BM_BytesFree( buffer ) > env->block_size ) ;
+ }
+ }
+
+ /* Did we not eat the filemark? We can fix that... */
+ while ( BM_ReadError( buffer ) == GEN_NO_ERR ) {
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ RET_BUF myret ;
+
+ if( TpRead( drv_hdl, BM_XferBase( buffer ), (UINT32)BM_XferSize( buffer ) ) != SUCCESS ) {
+ return( TFLE_DRIVER_FAILURE ) ;
+ }
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ ThreadSwitch() ;
+ }
+ BM_SetReadError( buffer, myret.gen_error );
+ }
+
+ switch( BM_ReadError( buffer ) ) {
+ case GEN_ERR_ENDSET : // This is the one we want!
+ break ;
+
+ case GEN_ERR_EOM :
+ case GEN_ERR_NO_DATA :
+ ret_val = TF_INVALID_VCB ;
+ break ;
+
+ case GEN_ERR_BAD_DATA :
+ case GEN_ERR_UNRECOGNIZED_MEDIA :
+ case GEN_ERR_WRONG_BLOCK_SIZE :
+ ret_val = TF_READ_ERROR ;
+ break ;
+
+ case GEN_ERR_NO_MEDIA :
+ ret_val = TF_NO_TAPE_PRESENT ;
+ break ;
+
+ default :
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+ }
+
+ BM_UseAll( buffer ) ; /* consume all the buffer */
+ *need_read = TRUE ; /* we need to re-read the tape */
+ channel->cur_drv->cur_pos.fmks = 1 ;
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: SYPL_MoveToVCB
+
+ Description: Move to next/prior/current VCB position
+
+
+**/
+INT16 SYPL_MoveToVCB(
+ CHANNEL_PTR channel, /* I channel pointer */
+ INT16 number, /* I number of file marks to move */
+ BOOLEAN_PTR need_read, /* I true if need to read tape */
+ BOOLEAN really_move ) /* I true if we are really moving tape */
+{
+ INT16 nmarks ; /* number of file marks to move */
+ BOOLEAN at_mos = IsPosBitSet( channel->cur_drv, AT_MOS ) != 0UL ;
+ BOOLEAN at_eos = ( ! at_mos ) && IsPosBitSet( channel->cur_drv, AT_EOS ) ;
+ BOOLEAN at_eod = IsPosBitSet( channel->cur_drv, AT_EOD ) != 0UL ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ INT16 direction ;
+ S10_ENV_PTR env = channel->fmt_env ;
+ TPOS_PTR tpos_ptr = channel->ui_tpos;
+
+ msassert( number <= 1 ) ;
+
+ if ( really_move ) {
+ *need_read = FALSE ;
+ env->prior_blocks_used = 0 ;
+ channel->blocks_used = 0 ;
+
+ if ( env->using_ecc ) {
+ channel->retranslate_size = U32_To_U64( (UINT32)NextECC( channel, channel->cur_buff ) );
+ } else {
+ channel->retranslate_size = lw_UINT64_MAX ;
+ }
+ env->in_ecc = FALSE ;
+ env->streamMode = FALSE ;
+ return TFLE_NO_ERR ;
+ }
+
+ ClrPosBit( channel->cur_drv, AT_MOS ) ;
+
+ /* compute the number of filemarks we have to move. */
+
+ if ( number == 1 ) { /* move forward */
+ *need_read = TRUE ;
+ if ( at_eod ) { /* they'll find out soon enough when they read */
+ return TFLE_NO_ERR ;
+ }
+ if ( at_eos ) {
+ env->current_vcb.bset_num++;
+ return TFLE_NO_ERR ;
+ }
+ ret_val = MoveFileMarks( channel, (INT16)1, (INT16)FORWARD ) ; /* no data? */
+ if ( ret_val == TFLE_NO_ERR ) {
+ env->current_vcb.bset_num++;
+ } else if ( ret_val == TFLE_UNEXPECTED_EOM || ret_val == TF_NO_MORE_DATA ) {
+ env->continuing = TRUE;
+ env->destination_tape_seq_num = env->tape_seq_num + 1;
+ ret_val = TF_NEED_NEW_TAPE;
+ }
+ return ret_val;
+ } else if ( number < 0 ) { /* move backward */
+ direction = BACKWARD ;
+ nmarks = -number + ( at_eos || at_eod ) ;
+ } else { /* current */
+ direction = BACKWARD ;
+ env->prior_blocks_used = 0UL ;
+ if ( at_mos ) {
+ nmarks = 0 ; /* have to go back just after immediately prior */
+ } else if ( at_eos || at_eod ) {
+ nmarks = 1 ; /* have to go back to beginning of last set */
+ } else {
+ *need_read = FALSE ;
+ return TFLE_NO_ERR ;
+ }
+ }
+
+ /* here, we have to move backwards */
+
+ /* if we have to go back to another tape
+ * or back to the start of a continued set, then start at tape 1
+ */
+ if ( nmarks > (INT16)channel->cur_drv->cur_pos.fmks - 1
+ || ( (INT16)channel->cur_drv->cur_pos.fmks - nmarks == 1
+ && env->tape_seq_num != 1 ) ) {
+ tpos_ptr->tape_seq_num = env->destination_tape_seq_num = 1;
+ ret_val = TF_WRONG_TAPE ;
+ } else {
+ * need_read = TRUE ;
+ /* !!! This code compensates for the inconsistencies of reverse
+ * motion in MoveFileMarks().
+ */
+ if ( channel->cur_drv->thw_inf.drv_info.drv_features & TDI_REV_FMK ) {
+ /* this will move nmarks+1 backward, 1 forward */
+ ret_val = MoveFileMarks( channel, (INT16)(nmarks+1), (INT16)BACKWARD ) ;
+ /* skip the header if we have to */
+ if ( ret_val == TFLE_NO_ERR && channel->cur_drv->cur_pos.fmks == 0 ) {
+ ret_val = MoveFileMarks( channel, (INT16)1, (INT16)FORWARD ) ;
+ }
+ } else {
+ if ( nmarks == 0 ) {
+ ret_val = MoveFileMarks( channel, (INT16)1, (INT16)BACKWARD );
+ if ( ret_val == TFLE_NO_ERR ) {
+ ret_val = MoveFileMarks( channel, (INT16)1, (INT16)FORWARD ) ;
+ }
+ } else {
+ ret_val = MoveFileMarks( channel, (INT16)nmarks, (INT16)BACKWARD );
+ }
+ }
+
+ if ( ret_val == TFLE_NO_ERR ) {
+ env->current_vcb.bset_num += number - at_eod;
+ }
+ }
+
+ return ret_val;
+}
+
+
+/**/
+/**
+
+ Name: SYPL_GetCurrent VCB
+
+ Description: Get the current VCB given the first chunk of a set.
+ Uses, but does not consume, data from tape.
+
+**/
+INT16 SYPL_GetCurrentVCB(
+ CHANNEL_PTR channel, /* I channel pointer */
+ BUF_PTR buffer ) /* I buffer */
+{
+ S10_DIRECTORY_HEADER_PTR dir_hdr ;
+ S10_BACKUP_SET_HEADER_PTR header = (VOID_PTR)( BM_NextBytePtr( buffer ) ) ;
+ S10_ENV_PTR env = channel->fmt_env ;
+ GEN_VCB_DATA gvcb_data ;
+ SYPL_VCB_PTR cur_vcb = &env->current_vcb ;
+ static UINT8 uniq_id[] = S10_UNIQ_ID ;
+
+ msassert( cur_vcb != NULL ) ;
+
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_VCB, (CREATE_DBLK_PTR)&gvcb_data ) ;
+ gvcb_data.std_data.dblk = channel->cur_dblk ;
+
+ if ( !env->continuing ) {
+
+ /* Initialize the vcb variables */
+ cur_vcb->attrib = 0;
+ cur_vcb->drive[1] = ':';
+ cur_vcb->drive[2] = 0;
+
+ /* Insure that this block is the backup set header */
+ if( ( !header->compression ) && (header->common.type == backup_set_header_type) &&
+ ( !memicmp( header->common.uniq_tape_id, uniq_id, UNQ_HDR_ID_LEN) ) ) {
+
+ strncpyA( env->bset_name, header->bset_name, SHORT_NAME_LEN ) ;
+ env->bset_name[SHORT_NAME_LEN] = '\0';
+
+ strncpyA( env->bset_descrpt, header->bset_descrpt, DESCRPT_LEN ) ;
+ env->bset_descrpt[DESCRPT_LEN] = '\0';
+
+ SYPLDateToDateTime( &header->bset_date, &cur_vcb->backup_date_time ) ;
+
+ } else {
+ /* Unique id does not compare with expected format for Sytos Plus
+ or Cannot process tape; the data is compressed.
+ */
+ return TFLE_TAPE_INCONSISTENCY ;
+ }
+ /* Insure that the next block is the directory header */
+ BM_UpdCnts( buffer, env->block_size ) ;
+ dir_hdr = (S10_DIRECTORY_HEADER_PTR)( BM_NextBytePtr( buffer ) ) ;
+ if( (dir_hdr->common.type == directory_header_type) &&
+ ( !memicmp( dir_hdr->common.uniq_tape_id, uniq_id, UNQ_HDR_ID_LEN) ) ) {
+ if (dir_hdr->common.drive_indicator == DRIVEROOT_TYPE ) {
+ /* assign the drive */
+ cur_vcb->drive[0] = dir_hdr->path_name[0] ;
+ }
+ } else {
+ if( BM_ReadError( buffer ) == GEN_ERR_ENDSET ) {
+ /* This is an empty set */
+ BM_UseAll( buffer ) ;
+ cur_vcb->drive[0] = 'C' ; // Fake it.
+ } else {
+ /* Unexpected format for Sytos Plus */
+ return TFLE_TAPE_INCONSISTENCY ;
+ }
+ }
+
+ } else {
+ channel->cur_dblk->com.continue_obj = TRUE ;
+ }
+
+ *gvcb_data.date = cur_vcb->backup_date_time;
+
+ /* The cur vcb attribs do not exist for a tape header. */
+ /* They could be somewhere in the unknown 197 bytes of the tape's */
+ /* header, but until this is known, no attributes will be set */
+ gvcb_data.std_data.attrib = cur_vcb->attrib ;
+
+ /* Fix for Cougar EPR# 1720 */
+ if( env->password[0] != '\0' &&
+ (channel->ui_tpos == NULL ||
+ channel->ui_tpos->backup_set_num == -1 ||
+ (channel->ui_tpos->backup_set_num == (INT16)cur_vcb->bset_num &&
+ !env->continuing) ) ){
+
+ gvcb_data.tape_password = (CHAR_PTR)env->password ; /* backup set password */
+ gvcb_data.tape_password_size = strlenA( env->password ) + 1; /* size of the above password */
+ gvcb_data.password_encrypt_alg = 0 ; /* plaintext password */
+ }
+
+ gvcb_data.std_data.blkid = (UINT32)(-1L) ;
+ gvcb_data.std_data.did = (UINT32)(-1L) ;
+ gvcb_data.std_data.string_type = BEC_ANSI_STR ;
+ gvcb_data.std_data.tape_seq_num = env->tape_seq_num ;
+ channel->cur_dblk->com.tape_seq_num = env->tape_seq_num ;
+
+ gvcb_data.f_mark = channel->cur_drv->cur_pos.fmks ; /* tape format - number of file marks */
+ gvcb_data.tape_id = env->family_id ; /* tape format - unique tape ID */
+ gvcb_data.tape_seq_num = env->tape_seq_num ; /* which tape in a tape family */
+
+ gvcb_data.tape_name = (CHAR_PTR)env->volname ;
+ gvcb_data.tape_name_size = strlenA( env->volname ) + 1;
+
+ gvcb_data.bset_name = (CHAR_PTR)env->bset_name ;
+ gvcb_data.bset_name_size = strlenA( env->bset_name ) + 1;
+ gvcb_data.bset_descript = (CHAR_PTR)env->bset_descrpt ;
+ gvcb_data.bset_descript_size = strlenA( env->bset_descrpt ) + 1;
+ gvcb_data.bset_num = cur_vcb->bset_num ; /* backup set number in tape family */
+
+ gvcb_data.tf_major_ver = 1 ; /* tape format version - major */
+ gvcb_data.tf_minor_ver = 0 ; /* tape format version - minor */
+
+ gvcb_data.user_name = (CHAR_PTR)"";
+ gvcb_data.user_name_size = 0 ;
+
+ gvcb_data.volume_name = (CHAR_PTR)cur_vcb->drive ;
+ gvcb_data.volume_name_size = 3;
+
+ /* Tell the file system to do its thing */
+ FS_CreateGenVCB( channel->cur_fsys, &gvcb_data ) ;
+
+ /* reset the flag here, knowing it will be set by RdException
+ * or MoveToVCB logic later if necessary.
+ */
+ env->continuing = FALSE;
+
+ return TFLE_NO_ERR ;
+}
+
+/**/
+/**
+
+ Name: SYPL_Parse
+
+ Description: Given a buffer, return block type BT_xxx
+
+
+**/
+INT16 SYPL_Parse(
+ CHANNEL_PTR channel, /* I channel pointer */
+ BUF_PTR buffer, /* I buffer pointer */
+ UINT16_PTR blk_type ) /* O new block type */
+{
+ S10_DIRECTORY_HEADER_PTR header = BM_NextBytePtr( buffer ) ;
+ S10_ENV_PTR env = channel->fmt_env ;
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* Initialize block type */
+ *blk_type = BT_HOSED ;
+
+ /* Eat all pads */
+ BM_UpdCnts( buffer, (UINT16)env->pad_size ) ;
+ env->pad_size = 0 ;
+
+ if ( env->using_ecc ) {
+ channel->retranslate_size = U32_To_U64( (UINT32)NextECC( channel, buffer ) );
+ }
+
+ if( BM_BytesFree( buffer ) == 0 ) {
+ env->bytes_left = FALSE ;
+ *blk_type = BT_MDB ;
+ return ret_val ;
+ }
+
+ /* Are we in a stream mode */
+ if( env->streamMode ) {
+ *blk_type = BT_STREAM ;
+ return ret_val ;
+ }
+
+ header = BM_NextBytePtr( buffer ) ;
+
+ /* see if we're in ECC; consume it if needed. */
+ if ( env->in_ecc || ( env->using_ecc && NextECC( channel, buffer ) <= 0 ) ) {
+ *blk_type = BT_MDB ;
+ return ret_val ;
+ }
+ if ( header->common.type == ecc_header_type ) {
+ env->in_ecc = TRUE ;
+ *blk_type = BT_MDB ;
+ return ret_val ;
+ }
+ if ( header->common.type == file_header_type ) {
+ *blk_type = BT_FDB ;
+ return ret_val ;
+
+ } else if ( header->common.type == directory_header_type ) {
+ *blk_type = BT_DDB ;
+ return ret_val ;
+
+ } else if ( header->common.type == backup_set_header_type ) {
+ S10_BACKUP_SET_HEADER_PTR bsh = (S10_BACKUP_SET_HEADER_PTR)header ;
+ if( bsh->end_of_backup ) {
+ if( !memicmp( bsh->eom_identifier, "SYTOS PLUS (EOM)", 16 ) ) {
+ channel->cur_dblk->com.continue_obj = TRUE ;
+ SetChannelStatus( channel, CH_AT_EOM ) ;
+ env->continuing = TRUE ;
+ env->destination_tape_seq_num = env->tape_seq_num + 1 ;
+ }
+ }
+ *blk_type = BT_MDB ;
+ return ret_val ;
+ }
+
+ if( env->tape_seq_num > 1 ) {
+ /* Forces the tape to be */
+ /* VCBed. Fixes EPR #357-698 */
+ *blk_type = BT_MDB ;
+ return ret_val ;
+ } else {
+ /* I believe that other conditions will */
+ /* preclude me from always returning this */
+ /* error. Currently, I do not know what */
+ /* those conditions are. tls */
+ return TFLE_USE_SYPL_ECC_FLAG ;
+
+ }
+}
+
+/**/
+/**
+
+ Name: SYPL_RdException
+
+ Description: Called when read returns a filemark indication
+
+**/
+UINT16 SYPL_RdException(
+ CHANNEL_PTR channel, /* I channel pointer */
+ INT16 exception ) /* I exception to operate on */
+{
+ S10_ENV_PTR env = channel->fmt_env ;
+
+ switch ( exception ) {
+ case GEN_ERR_ENDSET :
+ return FMT_EXC_EOS ;
+
+ case GEN_ERR_NO_DATA :
+#if TRUST_VIPER_EOM
+ /* this will probably only work on the Viper Drives */
+ if ( channel->cur_drv->thw_inf.drv_status & TPS_EOM ) {
+#endif /* TRUST_VIPER_EOM */
+ channel->cur_dblk->com.continue_obj = TRUE ;
+ SetChannelStatus( channel, CH_AT_EOM ) ;
+ env->prior_blocks_used += channel->blocks_used ;
+ env->continuing = TRUE;
+ env->destination_tape_seq_num = env->tape_seq_num + 1;
+ return FMT_EXC_EOM ;
+#if TRUST_VIPER_EOM
+ } else {
+ return FMT_EXC_HOSED ;
+ }
+#endif /* TRUST_VIPER_EOM */
+
+ default :
+ return FMT_EXC_HOSED ;
+ }
+}
+
+/**/
+/**
+
+ Name: SYPL_ReTranslate
+
+ Description: If called again devour ECC blocks
+
+**/
+BOOLEAN SYPL_ReTranslate(
+ CHANNEL_PTR channel, /* I channel pointer */
+ BUF_PTR buffer ) /* I buffer pointer */
+{
+ S10_ENV_PTR env = channel->fmt_env ;
+ UINT16 block_size = env->block_size ;
+
+ if ( env->next_retrans_size ) {
+ BM_UpdCnts( buffer, (UINT16)env->next_retrans_size ) ;
+ env->next_retrans_size = 0 ;
+ channel->retranslate_size = U32_To_U64( (UINT32)NextECC( channel, buffer ) );
+
+ } else if ( BM_BytesFree( buffer ) < 1024 ) {
+ env->next_retrans_size = 1024 - BM_BytesFree( buffer ) ;
+ channel->retranslate_size = U32_To_U64( 0 ) ;
+ BM_UpdCnts( buffer, BM_BytesFree( buffer ) ) ;
+ } else {
+ env->next_retrans_size = 0 ;
+ BM_UpdCnts( buffer, 1024 ) ;
+ channel->retranslate_size = U32_To_U64( (UINT32)NextECC( channel, buffer ) );
+ }
+
+
+ return SUCCESS ;
+
+}
+/**/
+/**
+
+ Name: SYPL_ReadMakeDDB
+ Description: Translates a DDB from data in the buffer.
+**/
+INT16 SYPL_ReadMakeDDB(
+ CHANNEL_PTR channel, /* I channel */
+ BUF_PTR buffer ) /* I buffer */
+{
+ S10_DIRECTORY_HEADER_PTR header = (VOID_PTR)( BM_NextBytePtr( buffer ) ) ;
+ S10_ENV_PTR env = (S10_ENV_PTR)channel->fmt_env ;
+ DBLK_PTR cur_dblk = channel->cur_dblk ;
+ STREAM_INFO_PTR currentStream ;
+ GEN_DDB_DATA gddb_data ;
+ UINT8 tmp_buf[256] ;
+ INT16 tmp_filter ;
+ DATE_TIME create_date ;
+ DATE_TIME backup_date ;
+
+ /* Initialize the file system's interface structure */
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_DDB, (CREATE_DBLK_PTR)&gddb_data ) ;
+
+ SYPLSetStandFields( channel, &gddb_data.std_data ) ;
+
+ env->in_ecc = FALSE ;
+
+ gddb_data.std_data.os_id = FS_PC_DOS ;
+
+ ConvertName( (VOID_PTR)header ) ;
+ memcpy( tmp_buf, header->path_name, header->path_len ) ;
+ gddb_data.path_name = (CHAR_PTR)tmp_buf ;
+ gddb_data.path_size = header->path_len ;
+
+ if (header->common.drive_indicator == DRIVEROOT_TYPE ) {
+ SYPLDateToDateTime( &header->dir_date, &backup_date ) ;
+ gddb_data.backup_date = &backup_date ;
+
+ /* Sytos Plus does not provide the access date (or we can't */
+ /* determine the access date) for the root directory and */
+ /* GEN_MkDDB requires an access date; therefore the backup */
+ /* date will be assigned and then invalidated. */
+ gddb_data.access_date = &backup_date ;
+ gddb_data.access_date->date_valid = 0 ;
+ env->dir_date = backup_date ;
+
+ } else {
+ SYPLDateToDateTime( &header->dir_date, &create_date ) ;
+ gddb_data.access_date = &create_date ;
+ gddb_data.creat_date = &create_date ;
+ gddb_data.mod_date = &create_date ;
+ gddb_data.backup_date = &backup_date ;
+ }
+
+ env->processed_ddb = TRUE ;
+
+ /* Sytos Plus attrib appears to be shifted left by one bit */
+ gddb_data.std_data.attrib |= ( header->dir_attribs & 0X01 ) ? OBJ_READONLY_BIT : 0 ;
+ gddb_data.std_data.attrib |= ( header->dir_attribs & 0X02 ) ? OBJ_HIDDEN_BIT : 0 ;
+ gddb_data.std_data.attrib |= ( header->dir_attribs & 0X04 ) ? OBJ_SYSTEM_BIT : 0 ;
+ gddb_data.std_data.attrib |= ( header->dir_attribs & 0X20 ) ? OBJ_MODIFIED_BIT : 0 ;
+
+ gddb_data.std_data.tape_seq_num = env->tape_seq_num ;
+ cur_dblk->com.string_type = BEC_ANSI_STR ;
+ cur_dblk->com.tape_seq_num = env->tape_seq_num ;
+ gddb_data.std_data.dblk = cur_dblk ;
+
+ gddb_data.std_data.blkid = (UINT32)(-1) ;
+ gddb_data.std_data.did = (UINT32)(-1) ;
+
+ /* Assign memory */
+ currentStream = &env->streams[env->no_streams] ;
+
+ if( header->acl_info_len ) {
+ currentStream->id = STRM_OS2_ACL ;
+ currentStream->size = U64_Init( (header->acl_info_len), 0L ) ;
+ currentStream++ ;
+ env->no_streams++ ;
+ currentStream->id = 0 ;
+ currentStream->size = U64_Init( 0L, 0L ) ;
+ }
+
+ if( header->ea_data_len ) {
+ currentStream->id = STRM_OS2_EA ;
+ currentStream->size = U64_Init( (header->ea_data_len), 0L ) ;
+ currentStream++ ;
+ env->no_streams++ ;
+ currentStream->id = 0 ;
+ currentStream->size = U64_Init( 0L, 0L ) ;
+ }
+
+ if( env->no_streams ) {
+ env->streamMode = TRUE ;
+ }
+
+ env->pad_size = 0 ;
+ tmp_filter = FS_CreateGenDDB( channel->cur_fsys, &gddb_data ) ;
+ ProcessDataFilter( channel, tmp_filter ) ;
+
+ BM_UpdCnts( buffer, env->block_size ) ;
+
+ if ( env->using_ecc ) {
+ INT16 next_ecc ;
+ next_ecc = NextECC( channel, buffer ) ;
+ channel->retranslate_size = U32_To_U64( (UINT32)next_ecc );
+ } else {
+ channel->retranslate_size = lw_UINT64_MAX ;
+ }
+
+ return TFLE_NO_ERR ;
+}
+/**/
+/**
+
+ Name: SYPL_ReadMakeFDB
+
+ Description: Translates an FDB
+
+**/
+INT16 SYPL_ReadMakeFDB( CHANNEL_PTR channel, BUF_PTR buffer )
+{
+ S10_FILE_HEADER_PTR header = (VOID_PTR)( BM_NextBytePtr( buffer ) ) ;
+ S10_ENV_PTR env = (S10_ENV_PTR)channel->fmt_env ;
+ STREAM_INFO_PTR currentStream ;
+ GEN_FDB_DATA gfdb_data ;
+ UINT8 tmp_buf[256] ;
+ INT16 tmp_filter ;
+ DATE_TIME create_date ;
+ DATE_TIME mod_date ;
+ DATE_TIME access_date ;
+ INT16 next_ecc ;
+ UINT16 pad_size = 0 ;
+
+
+ /* Initialize the file systems interface structure */
+ FS_SetDefaultDBLK( channel->cur_fsys, BT_FDB, (CREATE_DBLK_PTR)&gfdb_data ) ;
+
+ SYPLSetStandFields( channel, &gfdb_data.std_data ) ;
+
+ channel->cur_dblk->com.tape_seq_num = env->tape_seq_num ;
+ gfdb_data.std_data.tape_seq_num = env->tape_seq_num ;
+ gfdb_data.std_data.dblk = channel->cur_dblk ;
+ gfdb_data.std_data.os_id = FS_PC_DOS ;
+
+ /* obtain information for the file system create */
+ gfdb_data.std_data.os_info = NULL ;
+
+ gfdb_data.std_data.attrib |= ( header->file_attribs & 0X01 ) ? OBJ_READONLY_BIT : 0 ;
+ gfdb_data.std_data.attrib |= ( header->file_attribs & 0X02 ) ? OBJ_HIDDEN_BIT : 0 ;
+ gfdb_data.std_data.attrib |= ( header->file_attribs & 0X04 ) ? OBJ_SYSTEM_BIT : 0 ;
+ gfdb_data.std_data.attrib |= ( header->file_attribs & 0X20 ) ? OBJ_MODIFIED_BIT : 0 ;
+
+ ConvertName( (VOID_PTR)header ) ;
+ memcpy( tmp_buf, header->filename, header->filename_len ) ;
+ *( tmp_buf + header->filename_len ) = '\0';
+ gfdb_data.fname = (CHAR_PTR)tmp_buf ;
+ gfdb_data.fname_size = header->filename_len + 1;
+
+ SYPLDateToDateTime( &header->last_access_date, &access_date ) ;
+ gfdb_data.backup_date = &access_date ;
+ gfdb_data.access_date = &access_date ;
+ SYPLDateToDateTime( &header->file_create_date, &create_date ) ;
+ gfdb_data.creat_date = &create_date ;
+ SYPLDateToDateTime( &header->last_modified_date, &mod_date ) ;
+ gfdb_data.mod_date = &mod_date ;
+
+ /* Assign memory */
+ currentStream = &env->streams[env->no_streams] ;
+ currentStream->id = 0 ;
+ currentStream->size = U64_Init( 0L, 0L ) ;
+
+ if( header->acl_info_len ) {
+ currentStream->id = STRM_OS2_ACL ;
+ currentStream->size = U64_Init( (header->acl_info_len), 0L ) ;
+ currentStream++ ;
+ env->no_streams++ ;
+ currentStream->id = 0 ;
+ currentStream->size = U64_Init( 0L, 0L ) ;
+ }
+
+ if( header->ea_data_len ) {
+ currentStream->id = STRM_OS2_EA ;
+ currentStream->size = U64_Init( (header->ea_data_len), 0L ) ;
+ currentStream++ ;
+ env->no_streams++ ;
+ currentStream->id = 0 ;
+ currentStream->size = U64_Init( 0L, 0L ) ;
+
+ }
+
+ if( header->file_size ) {
+ currentStream->id = STRM_GENERIC_DATA ;
+ currentStream->size = U64_Init( (header->file_size), 0L ) ;
+ env->file_size = header->file_size ;
+ currentStream++ ;
+ env->no_streams++ ;
+ currentStream->id = 0 ;
+ currentStream->size = U64_Init( 0L, 0L ) ;
+ gfdb_data.std_data.disp_size = U64_Init( (header->file_size), 0L ) ;
+ }
+
+ /* Tell the file system to do its thing */
+ tmp_filter = FS_CreateGenFDB( channel->cur_fsys, &gfdb_data ) ;
+
+ if( env->no_streams ) {
+ env->streamMode = TRUE ;
+ }
+
+ env->pad_size = 0 ;
+ ProcessDataFilter( channel, tmp_filter ) ;
+ BM_UpdCnts( buffer, env->block_size ) ;
+
+ if ( env->using_ecc ) {
+ next_ecc = NextECC( channel, buffer ) ;
+ channel->retranslate_size = U32_To_U64( (UINT32)next_ecc );
+ } else {
+ channel->retranslate_size = lw_UINT64_MAX ;
+ }
+
+ return TFLE_NO_ERR ;
+}
+
+/**/
+/**
+
+ Name: SYPL_ReadMakeMDB
+
+ Description: Helps in devouring unneeded blocks
+**/
+INT16 SYPL_ReadMakeMDB(
+ CHANNEL_PTR channel, /* I channel pointer */
+ BUF_PTR buffer ) /* I buffer pointer */
+{
+ S10_COMMON_HEADER_PTR header = (VOID_PTR)( BM_NextBytePtr( buffer ) ) ;
+ S10_ENV_PTR env = channel->fmt_env ;
+
+ if( env->bytes_left ) {
+ BM_UpdCnts( buffer, env->block_size ) ; /* use the current block */
+
+ if ( env->using_ecc ) {
+ INT16 next_ecc ;
+ next_ecc = NextECC( channel, buffer ) ;
+ channel->retranslate_size = U32_To_U64( (UINT32)next_ecc );
+ } else {
+ channel->retranslate_size = lw_UINT64_MAX ;
+ }
+
+ } else {
+ env->bytes_left = TRUE ;
+ }
+ return TFLE_NO_ERR ;
+}
+/**/
+/**
+
+ Name: SYPL_ReadMakeStreams
+
+ Description: Creates Stream Headers for stream processing
+**/
+INT16 SYPL_ReadMakeStreams(
+ CHANNEL_PTR Channel, /* I channel pointer */
+ BUF_PTR Buffer ) /* I buffer pointer */
+{
+ S10_ENV_PTR currentEnv = ( S10_ENV_PTR ) Channel->fmt_env ;
+
+ /* get next stream */
+ Channel->current_stream = currentEnv->streams[currentEnv->currentStream++] ;
+
+ /* Set the stream's pad Size */
+ currentEnv->pad_size = DeterminePadSize( U64_Lsw(Channel->current_stream.size), currentEnv->block_size ) ;
+
+ if( --currentEnv->no_streams == 0 ) {
+ /* completed stream processing */
+ currentEnv->streamMode = FALSE ;
+
+ }
+
+ ClrChannelStatus( Channel, CH_SKIP_CURRENT_STREAM ) ;
+
+ return TFLE_NO_ERR ;
+}
+
+/**/
+/**
+
+ Name: SYPL_DeInitialize
+
+ Description: Frees memory allocated by Initialize
+**/
+VOID SYPL_DeInitialize( VOID_PTR *fmt_env )
+{
+ S10_ENV_PTR env = *fmt_env ;
+
+ free( env ) ;
+ *fmt_env = NULL ;
+}
+
+
+/**/
+/**
+
+ Name: SetStandFields
+
+ Description: Sets up the standard fields in translation to dblks.
+
+ Modified: 9/20/1989 14:8:27
+
+ Returns: Nothing.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static VOID _near SYPLSetStandFields(
+ CHANNEL_PTR channel,
+ STD_DBLK_DATA_PTR std_data )
+{
+ S10_ENV_PTR currentEnv = ( S10_ENV_PTR ) channel->fmt_env ;
+
+ /* Reset the stream stuff */
+ currentEnv->no_streams = 0 ;
+ currentEnv->currentStream = 0 ;
+ currentEnv->file_size = 0 ;
+
+ /* Set ASCII code in string type */
+ std_data->string_type = BEC_ANSI_STR ;
+
+ /* We don't have to retranslate */
+ channel->retranslate_size = lw_UINT64_MAX ;
+
+}
+
diff --git a/private/utils/ntbackup/src/tape2.bmp b/private/utils/ntbackup/src/tape2.bmp
new file mode 100644
index 000000000..1e422c6f1
--- /dev/null
+++ b/private/utils/ntbackup/src/tape2.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/tapein2.bmp b/private/utils/ntbackup/src/tapein2.bmp
new file mode 100644
index 000000000..0803f5175
--- /dev/null
+++ b/private/utils/ntbackup/src/tapein2.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/tapes2.bmp b/private/utils/ntbackup/src/tapes2.bmp
new file mode 100644
index 000000000..28e6259aa
--- /dev/null
+++ b/private/utils/ntbackup/src/tapes2.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/tapes3.ico b/private/utils/ntbackup/src/tapes3.ico
new file mode 100644
index 000000000..963db1da7
--- /dev/null
+++ b/private/utils/ntbackup/src/tapes3.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/tapesin2.bmp b/private/utils/ntbackup/src/tapesin2.bmp
new file mode 100644
index 000000000..24484439c
--- /dev/null
+++ b/private/utils/ntbackup/src/tapesin2.bmp
Binary files differ
diff --git a/private/utils/ntbackup/src/tattach.c b/private/utils/ntbackup/src/tattach.c
new file mode 100644
index 000000000..383277606
--- /dev/null
+++ b/private/utils/ntbackup/src/tattach.c
@@ -0,0 +1,419 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tattach.c
+
+ Description: This file contains code to attach and detattach to
+ a given NTFS disk device.
+
+
+ $Log: N:\logfiles\tattach.c_v $
+
+ Rev 1.13.1.3 15 Mar 1994 22:48:38 STEVEN
+fix registry bugs
+
+ Rev 1.13.1.2 11 Mar 1994 15:12:00 BARRY
+On detatch, free the cur_dir work buff in reserved area
+
+ Rev 1.13.1.1 28 Jan 1994 21:01:24 STEVEN
+MoveFileEx() doe snot support mac_sytax
+
+ Rev 1.13.1.0 19 Jan 1994 12:48:02 BARRY
+Clear warning
+
+ Rev 1.13 26 Jul 1993 17:04:00 STEVEN
+fixe restore active file with registry
+
+ Rev 1.12 09 Jun 1993 10:30:50 BARRY
+Allocate a default security descriptor that will be used in CreateObj.
+
+ Rev 1.11 17 Nov 1992 22:18:22 DAVEV
+unicode fixes
+
+ Rev 1.10 11 Nov 1992 09:52:38 GREGG
+Unicodeized literals.
+
+ Rev 1.9 10 Nov 1992 08:19:56 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.8 21 Oct 1992 19:41:14 BARRY
+Added create/destroy of linked-file queue.
+
+ Rev 1.7 06 Oct 1992 13:25:14 DAVEV
+Unicode strlen verification
+
+ Rev 1.6 24 Sep 1992 13:42:00 BARRY
+Changes for huge file name support.
+
+ Rev 1.5 12 Aug 1992 17:47:36 STEVEN
+fixed bugs at microsoft
+
+ Rev 1.4 25 Jun 1992 11:25:56 STEVEN
+assert is backwards
+
+ Rev 1.3 21 May 1992 13:49:20 STEVEN
+more long path support
+
+ Rev 1.2 04 May 1992 09:31:26 LORIB
+Changes for variable length paths.
+
+ Rev 1.1 05 Feb 1992 15:47:38 STEVEN
+added support for FindHandle Queue
+
+ Rev 1.0 17 Jan 1992 17:50:06 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "msassert.h"
+
+static VOID InitDefaultSecurityDescriptor( BE_CFG_PTR cfg, GENERIC_DLE_PTR dle );
+static VOID FreeDefaultSecurityDescriptor( GENERIC_DLE_PTR dle );
+static VOID NTFS_FixUpSysReg( FSYS_HAND fsh ) ;
+
+
+/**/
+/**
+
+ Name: NTFS_AttachToDLE()
+
+ Description: This function simply expands the OS specific
+ information in the DLE.
+
+
+ Modified: 1/10/1992 10:45:57
+
+ Returns: Error Codes:
+ INSUFFICIENT_MEMORY
+ SUCCESS
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 NTFS_AttachToDLE( fsh, dle, u_name, pswd )
+FSYS_HAND fsh ; /* I - File system handle */
+GENERIC_DLE_PTR dle; /*I/O- drive to attach to. list element expanded */
+CHAR_PTR u_name; /* I - user name NOT USED */
+CHAR_PTR pswd ; /* I - passowrd NOT USED */
+{
+ CHAR vol_name[100] = {TEXT('\0')} ;
+ CHAR fs_name[64] = {TEXT('\0')} ;
+ CHAR dev_name[4] ;
+ UINT32 fsize ;
+ UINT32 sflags ;
+
+ u_name ;
+ pswd ;
+ dle ;
+
+ msassert( dle != NULL );
+
+ InitDefaultSecurityDescriptor( fsh->cfg, dle );
+
+ /* get the volume name */
+ if ( dle->info.ntfs->volume_label == NULL ) {
+ dev_name[0] = dle->device_name[0] ;
+ dev_name[1] = TEXT(':') ;
+ dev_name[2] = TEXT('\\') ;
+ dev_name[3] = TEXT('\0') ;
+
+ GetVolumeInformation( dev_name, vol_name, 100, NULL,
+ &fsize, &sflags, fs_name, 64 ) ;
+
+ if ( *vol_name != TEXT('\0') ) {
+ dle->info.ntfs->volume_label = calloc( 1, strsize(vol_name) ) ;
+ }
+
+ if ( dle->info.ntfs->volume_label != NULL ) {
+ strcpy (dle->info.ntfs->volume_label, vol_name ) ;
+ }
+ }
+
+ /* Reserved field used for GetNext mode flag */
+ fsh->reserved.ptr = calloc( 1, sizeof( NTFS_FSYS_RESERVED ) ) ;
+
+ if ( fsh->reserved.ptr != NULL ) {
+
+ NTFS_FSYS_RESERVED_PTR resPtr = fsh->reserved.ptr;
+
+ InitQueue( &resPtr->scan_q );
+ InitQueue( &resPtr->linkq );
+
+ if ( FS_SavePath( fsh, (BYTE_PTR)TEXT("\\"), 2 * sizeof( CHAR ) ) == SUCCESS ) {
+
+ fsh->file_hand = calloc( 1, sizeof( FILE_HAND_STRUCT ) + sizeof( NTFS_OBJ_HAND ) ) ;
+ if ( fsh->file_hand != NULL ) {
+ fsh->file_hand->obj_hand.ptr = (VOID_PTR)(fsh->file_hand + 1) ;
+
+ return SUCCESS ;
+ }
+ }
+ }
+
+ return OUT_OF_MEMORY ;
+
+}
+
+/**/
+/**
+
+ Name: NTFS_DetachDLE()
+
+ Description: This function detaches form the specified DLE.
+ Part of the detachment is to release any PUSHED
+ DDBs. Also we need to free any allocated path
+ buffers and open file scans.
+
+ Modified: 1/10/1992 11:16:11
+
+ Returns: SUCCESS
+
+**/
+INT16 NTFS_DetachDLE( fsh )
+FSYS_HAND fsh ;
+{
+ DBLK_PTR dummy_dblk ;
+
+ /* Free the security info we use on file creates. */
+ FreeDefaultSecurityDescriptor( fsh->attached_dle );
+
+ /* Release any pushed min DDBs */
+
+ dummy_dblk = (DBLK_PTR)calloc( 1, sizeof(DBLK) ) ;
+
+ if ( dummy_dblk != NULL ) {
+
+ while( NTFS_PopMinDDB( fsh, dummy_dblk ) == SUCCESS )
+ ;
+
+ free( dummy_dblk ) ;
+ }
+
+ /* deal with active files and the SYSTEM registry file */
+ if ( fsh->attached_dle->info.ntfs->LastSysRegPath ) {
+ NTFS_FixUpSysReg( fsh ) ;
+ }
+
+ /* Release any allocated path buffers */
+
+ FS_FreeOSPathOrNameQueueInHand( fsh ) ;
+
+ /* Release any allocated link buffers */
+
+ if ( fsh->reserved.ptr != NULL ) {
+
+ NTFS_FSYS_RESERVED_PTR resPtr = fsh->reserved.ptr;
+ NTFS_LINK_Q_ELEM_PTR link_q_elem ;
+
+ while ( (link_q_elem = (NTFS_LINK_Q_ELEM_PTR)DeQueueElem( &resPtr->linkq )) != NULL )
+ {
+ free( link_q_elem ) ;
+ }
+ free( resPtr->work_buf );
+ }
+
+
+ /* Release any saved file scan handles */
+ NTFS_EmptyFindHandQ( fsh ) ;
+
+ /* free the allocated file handle */
+ free( fsh->file_hand );
+
+ free( fsh->reserved.ptr );
+
+ return SUCCESS ;
+}
+
+INT32 NTFS_EndOperationOnDLE( FSYS_HAND fsh )
+{
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: InitDefaultSecurityDescriptor()
+
+ Description: Allocates and initializes the default security
+ descriptor used at file create.
+
+ Modified: 09-Jun-93
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+static VOID InitDefaultSecurityDescriptor( BE_CFG_PTR cfg,
+ GENERIC_DLE_PTR dle )
+{
+ LOCAL_NTFS_DRV_DLE_INFO_PTR ntdle;
+ BOOLEAN status = FALSE;
+
+ msassert( dle != NULL );
+ msassert( cfg != NULL );
+
+ ntdle = dle->info.ntfs;
+
+ /* Make sure any existing Security stuff gets freed. */
+ FreeDefaultSecurityDescriptor( dle );
+
+ /*
+ * If we're going to be restoring information to an NTFS drive,
+ * set up default security in the DLE so it may be used by
+ * the create calls.
+ */
+
+ if ( (BEC_GetRestoreSecurity( cfg ) == TRUE) &&
+ (strcmp( ntdle->fs_name, TEXT("NTFS"))) == 0)
+ {
+ ntdle->sd = malloc( sizeof( SECURITY_DESCRIPTOR ) );
+ ntdle->sdacl = malloc( sizeof ( ACL ) );
+
+ if ( (ntdle->sd != NULL) && (ntdle->sdacl != NULL) )
+ {
+ status = InitializeSecurityDescriptor( ntdle->sd,
+ SECURITY_DESCRIPTOR_REVISION );
+ if ( status )
+ {
+ status = InitializeAcl( ntdle->sdacl,
+ sizeof( ACL ),
+ ACL_REVISION );
+ }
+
+ if ( status )
+ {
+ status = SetSecurityDescriptorDacl( ntdle->sd,
+ TRUE,
+ ntdle->sdacl,
+ FALSE );
+ }
+ }
+
+ if ( status == FALSE )
+ {
+ FreeDefaultSecurityDescriptor( dle );
+ }
+ }
+}
+
+
+/**/
+/**
+
+ Name: FreeDefaultSecurityDescriptor()
+
+ Description: Frees all the stuff that was allocated at attach time
+ for the default security descriptor.
+
+ Modified: 09-Jun-93
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+static VOID FreeDefaultSecurityDescriptor( GENERIC_DLE_PTR dle )
+{
+ if ( dle != NULL )
+ {
+ if ( dle->info.ntfs->sd != NULL )
+ {
+ free( dle->info.ntfs->sd );
+ dle->info.ntfs->sd = NULL;
+ }
+
+ if ( dle->info.ntfs->sdacl != NULL )
+ {
+ free( dle->info.ntfs->sd );
+ dle->info.ntfs->sd = NULL;
+ }
+ }
+}
+
+static VOID NTFS_FixUpSysReg( FSYS_HAND fsh )
+{
+ CHAR_PTR old_reg_name ;
+ LOCAL_NTFS_DRV_DLE_INFO_PTR ntfs_inf = fsh->attached_dle->info.ntfs ;
+ CHAR_PTR logname ;
+
+ old_reg_name = NTFS_MakeTempName( ntfs_inf->LastSysRegPath, TEXT("REG") ) ;
+
+ if ( old_reg_name != NULL ) {
+
+ if ( fsh->attached_dle->info.ntfs->mac_name_syntax ) {
+
+ MoveFileEx( old_reg_name+4, /* Existing file */
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ } else {
+ MoveFileEx( old_reg_name, /* Existing file */
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ }
+
+ logname = malloc( strsize(ntfs_inf->LastSysRegPathNew) + strsize(TEXT(".LOG"))) ;
+
+ if ( logname != NULL ) {
+
+ strcpy( logname, ntfs_inf->LastSysRegPathNew ) ;
+
+ if ( fsh->attached_dle->info.ntfs->mac_name_syntax ) {
+ MoveFileEx( logname+4,
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ } else {
+ MoveFileEx( logname,
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ }
+
+ strcat( logname, TEXT(".LOG") ) ;
+
+ if ( fsh->attached_dle->info.ntfs->mac_name_syntax ) {
+ MoveFileEx( logname+4,
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ } else {
+ MoveFileEx( logname,
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ }
+
+ free( logname ) ;
+ }
+ }
+
+ REG_MoveActiveRenameKey( fsh->attached_dle, ntfs_inf->LastSysRegPathNew ) ;
+
+ if ( old_reg_name != NULL ) {
+
+ REG_RestoreRegistryFile( fsh->attached_dle,
+ ntfs_inf->LastSysRegPath,
+ ntfs_inf->LastSysRegPathNew,
+ old_reg_name ) ;
+
+ free( old_reg_name ) ;
+ }
+}
+
+
diff --git a/private/utils/ntbackup/src/tbdpars.c b/private/utils/ntbackup/src/tbdpars.c
new file mode 100644
index 000000000..2b0cca270
--- /dev/null
+++ b/private/utils/ntbackup/src/tbdpars.c
@@ -0,0 +1,673 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tbdpars.c
+
+ Description: This file contains code to parse a date string.
+ If time strings are to be added, then they must be added
+ here.
+
+ $Log: G:/UI/LOGFILES/TBDPARS.C_V $
+
+ Rev 1.8 13 Aug 1993 15:00:48 TIMN
+Changed ALPHA define to ALETTER due to DECs ALPHA machine conflicts
+
+ Rev 1.7 23 Jul 1993 15:35:40 MARINA
+enable c++
+
+ Rev 1.6 01 Nov 1992 16:08:26 DAVEV
+Unicode changes
+
+ Rev 1.5 07 Oct 1992 14:15:58 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.4 04 Oct 1992 19:40:52 DAVEV
+Unicode Awk pass
+
+ Rev 1.3 28 Jul 1992 14:41:38 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.2 18 May 1992 09:06:38 MIKEP
+header
+
+ Rev 1.1 10 Jan 1992 16:45:12 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.0 20 Nov 1991 19:33:52 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static struct SW_TAB_TYPE montab[] =
+{
+ /* $$$ needs to be resources ??? */
+ { TEXT("APRIL"), 4 },
+ { TEXT("AUGUST"), 8 },
+ { TEXT("DECEMBER"), 12 },
+ { TEXT("FEBRUARY"), 2 },
+ { TEXT("JANUARY"), 1 },
+ { TEXT("JULY"), 7 },
+ { TEXT("JUNE"), 6 },
+ { TEXT("MARCH"), 3 },
+ { TEXT("MAY"), 5 },
+ { TEXT("NOVEMBER"), 11 },
+ { TEXT("OCTOBER"), 10 },
+ { TEXT("SEPTEMBER"), 9 }
+};
+
+static INT daymon[] =
+{
+ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+};
+
+/**
+ Inputs for tbdttab FSM
+**/
+
+#define D_DASH 0
+#define D_DIGIT 1
+#define D_EOS 2
+#define D_LETTER 3
+#define D_SLASH 4
+
+#ifdef MBS
+#define D_UNDERSCORE 5
+#endif
+
+/**/
+/**
+ Actions for tbdttab FSM
+**/
+
+#define D_BAD_FORM 0
+#define D_DEF_DY1 1
+#define D_DONE_ALPHA_MON 2 // ALPHA has been changed to ALETTER
+#define D_DONE_DY1 3
+#define D_DONE_DY2 4
+#define D_DONE_DY3 5
+#define D_DONE_MO1 6
+#define D_DONE_MO2 7
+#define D_DONE_MO3 8
+#define D_DONE_NO_DAY 9
+#define D_DONE_YEAR1 10
+#define D_DONE_YEAR2 11
+#define D_RETURN_OK 12
+#define D_STORE_ALPHA 13 // ALPHA has been changed to ALETTER
+#define D_STORE_T1 14
+#define D_STORE_T2 15
+#define D_STORE_T3 16
+
+#ifdef MBS
+#define D_STORE_HR 17
+#define D_STORE_MIN 18
+#define D_STORE_SEC 19
+#define D_DONE_HR 20
+#define D_DONE_MIN 21
+#define D_DONE_SEC 22
+#endif
+
+/**
+ States for tbdttab FSM
+**/
+
+#define D_DONE 0
+#define D_INIT 1
+#define D_MON_OR_DY 2
+#define D_MON_OR_YR1 3
+#define D_MON_OR_YR2 4
+#define D_MONTH 5
+#define D_YEAR1 6
+#define D_YEAR2 7
+
+#ifdef MBS
+#define D_HR 8
+#define D_MIN 9
+#define D_SEC 10
+#endif
+
+#ifdef MBS
+#define TBDTTAB_N_INPUTS 6
+#define TBDTTAB_N_STATES 11
+#else
+#define TBDTTAB_N_INPUTS 5
+#define TBDTTAB_N_STATES 8
+#endif
+
+struct STATE_TAB_TYPE tbdttab_state_table[ TBDTTAB_N_INPUTS ] [ TBDTTAB_N_STATES ] = {
+ {
+ { D_BAD_FORM, D_DONE /* Input: d_dash, State: d_done */ },
+ { D_BAD_FORM, D_INIT /* Input: d_dash, State: d_init */ },
+ { D_DONE_DY2, D_MON_OR_YR2 /* Input: d_dash, State: d_mon_or_dy */ },
+ { D_DONE_MO3, D_YEAR1 /* Input: d_dash, State: d_mon_or_yr1 */ },
+ { D_BAD_FORM, D_MON_OR_YR2 /* Input: d_dash, State: d_mon_or_yr2 */ },
+ { D_DONE_MO2, D_YEAR2 /* Input: d_dash, State: d_month */ },
+ { D_BAD_FORM, D_YEAR1 /* Input: d_dash, State: d_year1 */ },
+ { D_BAD_FORM, D_YEAR2 /* Input: d_dash, State: d_year2 */ },
+#ifdef MBS
+ { D_BAD_FORM, D_HR /* INPUT: D_DASH, STATE: D_HR */ },
+ { D_BAD_FORM, D_MIN /* INPUT: D_DASH, STATE: D_MIN */ },
+ { D_BAD_FORM, D_SEC /* INPUT: D_DASH, STATE: D_SEC */ }
+#endif
+ },
+ {
+ { D_BAD_FORM, D_DONE /* Input: d_digit, State: d_done */ },
+ { D_STORE_T1, D_MON_OR_DY /* Input: d_digit, State: d_init */ },
+ { D_STORE_T1, D_MON_OR_DY /* Input: d_digit, State: d_mon_or_dy */ },
+ { D_STORE_T2, D_MON_OR_YR1 /* Input: d_digit, State: d_mon_or_yr1 */ },
+ { D_DONE_DY3, D_MON_OR_YR1 /* Input: d_digit, State: d_mon_or_yr2 */ },
+ { D_DONE_MO1, D_YEAR2 /* Input: d_digit, State: d_month */ },
+ { D_STORE_T3, D_YEAR1 /* Input: d_digit, State: d_year1 */ },
+ { D_STORE_T3, D_YEAR2 /* Input: d_digit, State: d_year2 */ },
+#ifdef MBS
+ { D_STORE_HR, D_HR /* INPUT: D_DIGIT, STATE: D_HR */ },
+ { D_STORE_MIN, D_MIN /* INPUT: D_DIGIT, STATE: D_MIN */ },
+ { D_STORE_SEC, D_SEC /* INPUT: D_DIGIT, STATE: D_SEC */ },
+#endif
+ },
+ {
+ { D_RETURN_OK, D_DONE /* Input: d_eos, State: d_done */ },
+ { D_BAD_FORM, D_INIT /* Input: d_eos, State: d_init */ },
+ { D_BAD_FORM, D_MON_OR_DY /* Input: d_eos, State: d_mon_or_dy */ },
+ { D_DONE_NO_DAY, D_DONE /* Input: d_eos, State: d_mon_or_yr1 */ },
+ { D_BAD_FORM, D_MON_OR_YR2 /* Input: d_eos, State: d_mon_or_yr2 */ },
+ { D_BAD_FORM, D_MONTH /* Input: d_eos, State: d_month */ },
+ { D_DONE_YEAR1, D_DONE /* Input: d_eos, State: d_year1 */ },
+ { D_DONE_YEAR2, D_DONE /* Input: d_eos, State: d_year2 */ },
+#ifdef MBS
+ { D_BAD_FORM, D_HR /* INPUT: D_EOS, STATE: D_HR */ },
+ { D_BAD_FORM, D_MIN /* INPUT: D_EOS, STATE: D_MIN */ },
+ { D_DONE_SEC, D_DONE /* INPUT: D_EOS, STATE: D_SEC */ },
+#endif
+ },
+ {
+ { D_BAD_FORM, D_DONE /* Input: d_letter, State: d_done */ },
+ { D_DEF_DY1, D_MONTH /* Input: d_letter, State: d_init */ },
+ { D_DONE_DY1, D_MONTH /* Input: d_letter, State: d_mon_or_dy */ },
+ { D_BAD_FORM, D_MON_OR_YR1 /* Input: d_letter, State: d_mon_or_yr1 */ },
+ { D_DONE_DY1, D_MONTH /* Input: d_letter, State: d_mon_or_yr2 */ },
+ { D_STORE_T2, D_MONTH /* Input: d_letter, State: d_month */ },
+ { D_BAD_FORM, D_YEAR1 /* Input: d_letter, State: d_year1 */ },
+ { D_BAD_FORM, D_YEAR2 /* Input: d_letter, State: d_year2 */ },
+#ifdef MBS
+ { D_BAD_FORM, D_HR /* INPUT: D_LETTER, STATE: D_HR */ },
+ { D_BAD_FORM, D_MIN /* INPUT: D_LETTER, STATE: D_MIN */ },
+ { D_BAD_FORM, D_SEC /* INPUT: D_LETTER, STATE: D_SEC */ },
+#endif
+ },
+ {
+ { D_BAD_FORM, D_DONE /* Input: d_slash, State: d_done */ },
+ { D_BAD_FORM, D_INIT /* Input: d_slash, State: d_init */ },
+ { D_DONE_DY2, D_MON_OR_YR1 /* Input: d_slash, State: d_mon_or_dy */ },
+ { D_DONE_MO3, D_YEAR1 /* Input: d_slash, State: d_mon_or_yr1 */ },
+ { D_BAD_FORM, D_MON_OR_YR2 /* Input: d_slash, State: d_mon_or_yr2 */ },
+ { D_DONE_MO2, D_YEAR2 /* Input: d_slash, State: d_month */ },
+ { D_BAD_FORM, D_YEAR1 /* Input: d_slash, State: d_year1 */ },
+ { D_BAD_FORM, D_YEAR2 /* Input: d_slash, State: d_year2 */ },
+#ifdef MBS
+ { D_BAD_FORM, D_HR /* INPUT: D_SLASH, STATE: D_HR */ },
+ { D_BAD_FORM, D_MIN /* INPUT: D_SLASH, STATE: D_MIN */ },
+ { D_BAD_FORM, D_SEC /* INPUT: D_SLASH, STATE: D_SEC */ },
+#endif
+ },
+#ifdef MBS
+ {
+ { D_BAD_FORM, D_DONE /* Input: D_UNDERSCORE, State: d_done */ },
+ { D_BAD_FORM, D_INIT /* Input: D_UNDERSCORE, State: d_init */ },
+ { D_BAD_FORM, D_MON_OR_DY /* Input: D_UNDERSCORE, State: d_mon_or_dy */ },
+ { D_BAD_FORM, D_MON_OR_YR1 /* Input: D_UNDERSCORE, State: d_mon_or_yr1 */ },
+ { D_BAD_FORM, D_MON_OR_YR2 /* Input: D_UNDERSCORE, State: d_mon_or_yr2 */ },
+ { D_BAD_FORM, D_MONTH /* Input: D_UNDERSCORE, State: d_month */ },
+ { D_DONE_YEAR1, D_HR /* Input: D_UNDERSCORE, State: d_year1 */ },
+ { D_DONE_YEAR2, D_HR /* Input: D_UNDERSCORE, State: d_year2 */ },
+ { D_DONE_HR, D_MIN /* INPUT: D_UNDERSCORE, STATE: D_HR */ },
+ { D_DONE_MIN, D_SEC /* INPUT: D_UNDERSCORE, STATE: D_MIN */ },
+ { D_BAD_FORM, D_SEC /* INPUT: D_UNDERSCORE, STATE: D_SEC */ },
+ },
+#endif
+};
+
+static int comp_month( VOID_PTR, VOID_PTR ) ;
+static INT16 valid_day( INT16, INT16, CHAR_PTR, INT16 * ) ;
+static INT16 valid_month( CHAR_PTR, INT16 * ) ;
+static INT16 valid_year( CHAR_PTR, INT16 * ) ;
+static INT16 lookup_month( CHAR_PTR, INT16 * ) ;
+static INT16 dnextch( CHAR_PTR , INT16_PTR , CHAR_PTR ) ;
+
+/*****************************************************************************
+
+ Name: tbdpars()
+
+ Description: This function parses a date string to produce a
+ generic time and date structure.
+
+ Returns: SUCCESS if successful or
+ !SUCCESS if failed.
+
+*****************************************************************************/
+INT16 tbdpars(
+CHAR *candidate, /* I - String to parse */
+DATE_TIME *out_date, /* O - date returned */
+DATE_DEFAULT date_default ) /* I - How should we default the un-specified fields */
+{
+ INT16 dpars_state ; /* current state of parser fsm */
+ INT16 dpars_old_state ; /* old state of parser fsm */
+ register INT16 dpars_input; /* conditioned input for syntax fsm */
+ register INT16 dpars_action; /* action to take */
+ CHAR c ; /* latest CHAR from candidate */
+ INT16 i = 0 ;
+
+ INT16 ret_val = SUCCESS;
+
+ CHAR t1[20];
+ CHAR t2[20];
+ CHAR t3[20];
+
+ INT16 i1 = 0 ;
+ INT16 i2 = 0 ;
+ INT16 i3 = 0 ;
+
+ INT16 year = 0 ;
+ INT16 month = 0 ;
+ INT16 day = 0 ;
+
+#ifdef MBS
+ CHAR hr[ 3 ] ;
+ CHAR min[ 3 ] ;
+ CHAR sec[ 3 ] ;
+
+ INT16 hr_index = 0 ;
+ INT16 min_index = 0 ;
+ INT16 sec_index = 0 ;
+
+ *hr = *min = *sec = TEXT('\0') ;
+#endif
+
+ *t1 = *t2 = *t3 = TEXT('\0') ;
+
+ out_date->date_valid = FALSE ;
+
+ dpars_state = D_INIT ;
+ dpars_old_state = D_INIT ;
+ dpars_input = 0 ;
+
+ while( ret_val == SUCCESS ) {
+ dpars_input = dnextch( candidate, &i, &c ) ;
+
+ msassert( dpars_input >= 0 && dpars_input < TBDTTAB_N_INPUTS ) ;
+
+ dpars_old_state = dpars_state ;
+ dpars_action = tbdttab_state_table[dpars_input][dpars_old_state].action ;
+ dpars_state = tbdttab_state_table[dpars_input][dpars_old_state].next_state ;
+
+ msassert( dpars_state >= 0 && dpars_state < TBDTTAB_N_STATES ) ;
+ switch( dpars_action ) {
+ case D_BAD_FORM :
+ ret_val = 1 ; /* quit with error */
+ break ;
+
+ case D_STORE_T1 :
+ t1[i1] = (CHAR)toupper( c ) ;
+ i1++ ;
+ break ;
+
+ case D_STORE_T2 :
+ t2[i2] = (CHAR)toupper( c ) ;
+ i2++ ;
+ break ;
+
+ case D_STORE_T3 :
+ t3[i3] = (CHAR)toupper( c ) ;
+ i3++ ;
+ break ;
+
+ case D_DEF_DY1 :
+ day = 1 ;
+ ( VOID ) strcpy( t1, TEXT("1") ) ;
+ t2[i2] = (CHAR)toupper( c ) ;
+ i2++ ;
+ break ;
+
+ case D_DONE_DY1 :
+ t1[i1] = TEXT('\0') ;
+ t2[i2] = (CHAR)toupper( c ) ;
+ i2 ++ ;
+ break ;
+
+ case D_DONE_DY2 :
+ t1[i1] = TEXT('\0') ;
+ break ;
+
+ case D_DONE_DY3 :
+ t1[i1] = TEXT('\0') ;
+ t2[i2] = c ;
+ i2 ++ ;
+ break ;
+
+ case D_DONE_MO1 :
+ t2[i2] = TEXT('\0') ;
+ year = 1980;
+
+ if( lookup_month( t2, &month ) != 0 ) {
+ ret_val = 2 ;
+ }
+ if( valid_day( year, month, t1, &day ) != 0 ) {
+ ret_val = 3 ;
+ }
+ t3[i3] = c ;
+ i3 ++ ;
+ break ;
+
+ case D_DONE_MO2 :
+ t2[i2] = TEXT('\0') ;
+ year = 1980;
+ if( lookup_month( t2, &month ) != 0 ) {
+ ret_val = 4 ;
+ }
+ if( valid_day( year, month, t1, &day ) != 0 ) {
+ ret_val = 5 ;
+ }
+ break ;
+
+ case D_DONE_MO3 :
+ t2[i2] = TEXT('\0') ;
+ year = 1980;
+ if( valid_month( t1, &month ) != 0 ) {
+ ret_val = 6 ;
+ }
+ if( valid_day( year, month, t2, &day ) != 0 ) {
+ ret_val = 7;
+ }
+ break ;
+
+ case D_DONE_NO_DAY:
+ day = 1 ;
+ t2[i2] = TEXT('\0') ;
+ if( valid_year( t2, &year ) != 0 ) {
+ ret_val = 8;
+ }
+ if( valid_month( t1, &month ) != 0 ) {
+ ret_val = 9 ;
+ }
+ ret_val = -1;
+ break ;
+
+ case D_DONE_YEAR1 :
+ t3[i3] = TEXT('\0') ;
+ if( valid_year( t3, &year ) != 0 ) {
+ ret_val = 10 ;
+ }
+ if( valid_month( t1, &month ) != 0 ) {
+ ret_val = 11 ;
+ }
+ if( valid_day( year, month, t2, &day ) != 0 ) {
+ ret_val = 12 ;
+ }
+ out_date->date_valid = TRUE ;
+#ifndef MBS
+ ret_val = -1;
+#endif
+ break ;
+
+ case D_DONE_YEAR2 :
+ t3[i3] = TEXT('\0') ;
+ if( valid_year( t3, &year ) != 0 ) {
+ ret_val = 13 ;
+ }
+ if( lookup_month( t2, &month ) != 0 ) {
+ ret_val = 14 ;
+ }
+ if( valid_day( year, month, t1, &day ) != 0 ) {
+ ret_val = 15 ;
+ }
+#ifndef MBS
+ ret_val = -1;
+#endif
+ break ;
+
+#ifdef MBS
+ case D_STORE_HR :
+ hr[ hr_index ] = (CHAR)toupper( c ) ;
+ hr_index++ ;
+ break ;
+
+ case D_STORE_MIN :
+ min[ min_index ] = (CHAR)toupper( c ) ;
+ min_index++ ;
+ break ;
+
+ case D_STORE_SEC :
+ sec[ sec_index ] = (CHAR)toupper( c ) ;
+ sec_index++ ;
+ break ;
+
+ case D_DONE_HR :
+ hr[ hr_index ] = TEXT('\0') ;
+ break ;
+
+ case D_DONE_MIN :
+ min[ min_index ] = TEXT('\0') ;
+ break ;
+
+ case D_DONE_SEC :
+ sec[ sec_index ] = TEXT('\0') ;
+ ret_val = - 1;
+ break ;
+#endif
+
+ case D_RETURN_OK:
+ ret_val = -1;
+ break ;
+
+ default :
+ ret_val = 1 ; /* quit with error */
+ msassert( /* dpars: bad action */ FALSE ) ;
+ break ;
+ } /* end switch */
+ } /* end while */
+ if( ret_val == -1 ) {
+ out_date->year = year ;
+ out_date->month = month ;
+ out_date->day = day ;
+#ifdef MBS
+ out_date->hour = atoi( hr ) ;
+ out_date->minute = atoi( min ) ;
+ out_date->second = atoi( sec ) ;
+ if ( (*hr == TEXT('\0')) && (*min == TEXT('\0')) && (*sec == TEXT('\0')) &&
+ (date_default == DEFAULT_LATE_NIGHT) ) {
+ out_date->hour = 25 ;
+ out_date->minute = 61 ;
+ out_date->second = 61 ;
+ }
+#else
+ if ( date_default == DEFAULT_EARLY_MORNING ) {
+ out_date->hour = 0 ;
+ out_date->minute = 0 ;
+ out_date->second = 0 ;
+ } else {
+ out_date->hour = 25 ;
+ out_date->minute = 61 ;
+ out_date->second = 61 ;
+ }
+#endif
+ out_date->day_of_week = 0 ;
+ out_date->date_valid = TRUE ;
+ ret_val = SUCCESS ;
+ }
+
+ return( ret_val ) ;
+
+} /* end tbparse */
+/*****************************************************************************
+
+ Name: valid_date()
+
+ Description: This function returns SUCCESS if the day in the
+ day_string is valid for the month in the tdate structure.
+ It modifies "day" to equal the day indecated by the day_string.
+
+ Returns: SUCCESS if valid
+
+ Notes: Does not support leap year.
+
+ See also: $/SEE( valid_month(), valid_year() )$
+
+*****************************************************************************/
+static INT16 valid_day(
+ INT16 year , /* I - check for this year */
+ INT16 month , /* I - and this month */
+ CHAR_PTR day_string , /* I - string to parse day from */
+ INT16 *day ) /* O - day found if valid */
+{
+
+ *day = (INT16)atoi( day_string ) ;
+ daymon[1] = ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0 ) ? 29 : 28;
+
+ if ( (INT)*day < 1 || (INT)*day > daymon[month - 1] ) {
+ return( FAILURE ) ;
+ }
+ return( SUCCESS ) ;
+} /* end valid day */
+/*****************************************************************************
+
+ Name: valid_month()
+
+ Description: This function checks to see if the specified month
+ is valid.
+
+ Returns: SUCCESS if valid
+
+ Notes: simply checks to see if month is between 1 and 12
+ and converts it from string to INT.
+
+ See also: $/SEE( valid_day(), valid_year() )$
+
+*****************************************************************************/
+static INT16 valid_month (
+ CHAR_PTR month_string , /* I - month to parse TEXT("1") - TEXT("12") */
+ INT16 *month ) /* O - month if valid */
+{
+ *month = (INT16)atoi( month_string ) ;
+ if( *month < 1 || *month > 12 ) {
+ return( FAILURE ) ;
+ }
+ return( SUCCESS ) ;
+} /* end valid day */
+
+/*****************************************************************************
+
+ Name: lookup_month()
+
+ Description: Converts a string like "JAN" or "January" to a
+ string lik "1"
+
+ Returns: SUCCESS if valid
+
+ Notes: Needs the comp_month() function to pass to
+ bserach()
+
+ See also: $/SEE( valid_month() )$
+
+*****************************************************************************/
+static INT16 lookup_month(
+CHAR_PTR month_string, /* I - ascii string to parse */
+INT16 *month ) /* O - numeric string found */
+{
+ SW_TAB_PTR sp ;
+
+ *month = 0 ;
+
+ sp = (SW_TAB_PTR)bsearch( (VOID *)month_string, (VOID *)montab, 12,
+ sizeof( struct SW_TAB_TYPE ),
+ (int (__cdecl *)(const void *, const void *))comp_month ) ;
+
+ if( sp == NULL ) {
+ return( 1 ) ;
+ }
+ *month = sp->sw_action ;
+ return( 0 ) ;
+
+} /* end lookup_month */
+
+static int comp_month(
+VOID_PTR s1,
+VOID_PTR s2 )
+{
+ return( strncmp( (CHAR_PTR)s1, ((SW_TAB_PTR)s2)->sw_label, strlen( (CHAR_PTR)s1 ) ) ) ;
+}
+/*****************************************************************************
+
+ Name: valid_year()
+
+ Description: This function checks to make sure the year string
+ provided is valid. If valid it converts it to an interger.
+
+ Returns: SUCCESS if valid
+
+ Notes: This routine adds 1900 if the year is < 100.
+
+ See also: $/SEE( valid_day(), valid_month() )$
+
+*****************************************************************************/
+static INT16 valid_year(
+ CHAR_PTR year_string , /* I - string to parse */
+ INT16 *year ) /* O - year in an INT */
+{
+ *year = (INT16)atoi( year_string ) ;
+ if( *year < 100 ) {
+ *year += 1900 ;
+ }
+ if( *year > 1999 ) {
+ return( 1 ) ;
+ }
+ return( 0 ) ;
+} /* end valid_year */
+/*****************************************************************************
+
+ Name: dnextch()
+
+ Description: This function gets the next character from the
+ input stream. It returns the type of character read.
+
+ Returns: type of character :
+ D_LETTER
+ D_DIGET
+ D_DASH
+ D_SLASH
+ D_EOS
+
+ See also: $/SEE( tbdpars() )$
+
+*****************************************************************************/
+static INT16 dnextch(
+CHAR *source, /* I - data stream */
+INT16_PTR pos, /*I/O- current position */
+CHAR_PTR c ) /* O - next character found */
+{
+ *c = source[*pos] ;
+
+ ( *pos ) ++ ;
+ if( isdigit( *c ) ) {
+ return( D_DIGIT ) ;
+ }
+ if( isupper( *c ) || islower( *c ) ) {
+ return( D_LETTER ) ;
+ }
+ if( *c == TEXT('/') ) {
+ return( D_SLASH ) ;
+ }
+ if( *c == TEXT('-') ) {
+ return( D_DASH ) ;
+ }
+#ifdef MBS
+ if ( *c == TEXT('_') ) {
+ return( D_UNDERSCORE ) ;
+ }
+#endif
+ return( D_EOS ) ;
+}
diff --git a/private/utils/ntbackup/src/tbgetc.c b/private/utils/ntbackup/src/tbgetc.c
new file mode 100644
index 000000000..92fcb79da
--- /dev/null
+++ b/private/utils/ntbackup/src/tbgetc.c
@@ -0,0 +1,88 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tbgetc.c
+
+ Description: This file contains code to get & unget a character from
+ a string.
+
+ $Log: G:/UI/LOGFILES/TBGETC.C_V $
+
+ Rev 1.6 23 Jul 1993 19:11:34 MARINA
+enable c++
+
+ Rev 1.5 01 Nov 1992 16:08:38 DAVEV
+Unicode changes
+
+ Rev 1.4 07 Oct 1992 14:16:10 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.3 04 Oct 1992 19:40:56 DAVEV
+Unicode Awk pass
+
+ Rev 1.2 17 Aug 1992 13:23:22 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.1 18 May 1992 09:06:38 MIKEP
+header
+
+ Rev 1.0 20 Nov 1991 19:34:50 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: strgetc()
+
+ Description: This function gets the character at the specified
+ position in the specified string.
+
+ Returns: Character found or ^Z if end of file
+
+ See also: $/SEE( filgetc() )$
+
+*****************************************************************************/
+CHAR strgetc(
+CHAR_PTR s, /* I - string to get character from */
+INT16_PTR i ) /*I/O- current character poisition */
+{
+ CHAR next ;
+
+ next = s[*i] ;
+ if( next == TEXT('\0') )
+ {
+ next = ( CHAR ) 0x1a ; /* Control-Z, EOF */
+ }
+ ( *i ) ++ ;
+ return( next ) ;
+}
+/*****************************************************************************
+
+ Name: strpushc()
+
+ Description: This function "un-gets" the character in a string.
+
+ Returns: none
+
+ Notes: This function realy only decroments the string
+ possition.
+
+*****************************************************************************/
+VOID strpushc(
+CHAR c , /* U - not used, arround for consistancy */
+CHAR_PTR src_ptr , /* U - not used, arround for consistancy */
+INT16_PTR i ) /*I/O- string position */
+{
+ c; /* These two lines are to remove compiler warnings */
+ src_ptr ; /* */
+
+ ( *i ) -- ;
+ return ;
+}
diff --git a/private/utils/ntbackup/src/tbnextok.c b/private/utils/ntbackup/src/tbnextok.c
new file mode 100644
index 000000000..769c86303
--- /dev/null
+++ b/private/utils/ntbackup/src/tbnextok.c
@@ -0,0 +1,943 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tbnextok.c
+
+ Description: This file contains code to get next token from the
+ specified input streem.
+
+ $Log: G:/UI/LOGFILES/TBNEXTOK.C_V $
+
+ Rev 1.5 26 Jul 1993 11:56:30 MARINA
+enable c++
+
+ Rev 1.4 01 Nov 1992 16:08:58 DAVEV
+Unicode changes
+
+ Rev 1.3 07 Oct 1992 14:16:40 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.2 04 Oct 1992 19:40:58 DAVEV
+Unicode Awk pass
+
+ Rev 1.1 18 May 1992 09:06:40 MIKEP
+header
+
+ Rev 1.0 20 Nov 1991 19:35:00 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/**
+ Inputs for tblextab FSM
+**/
+
+#define AT_SIGN 0
+#define BACK_SLASH 1
+#define CLOSE_COMMENT 2
+#define COLON 3
+#define D_QUOTE 4
+#define DIGIT 5
+#define EOI 6
+#define EQUALS_SIGN 7
+#define FORWARD_SLASH 8
+#define L_BRACKET 9
+#define LETTER 10
+#define MINUS_SIGN 11
+#define OTHER_CHAR 12
+#define PERIOD 13
+#define Q_MARK 14
+#define R_BRACKET 15
+#define STAR 16
+#define START_COMMENT 17
+#define WHITE_SPACE 18
+
+/**/
+/**
+ Actions for tblextab FSM
+**/
+
+#define BAD_TOKEN 0
+#define DO_NOTHING 1
+#define HANGING_COMMENT 2
+#define HANGING_QUOTE 3
+#define POP_STATE 4
+#define PUSH_STATE 5
+#define RETURN_AT_SIGN 6
+#define RETURN_EOI 7
+#define RETURN_EQUALS 8
+#define RETURN_NONDOS 9
+#define RETURN_NONDOS_PUSH 10
+#define RETURN_PATH 11
+#define RETURN_PATH_PUSH 12
+#define RETURN_SWITCH 13
+#define RETURN_SWITCH_PUSH 14
+#define STORE_CHAR 15
+#define STORE_OP1 16
+#define STORE_OP2 17
+#define STORE_SLASH_OP1 18
+#define STORE_SLASH_OP2 19
+#define POSSIBLE_RET_PATH 20
+/**/
+/**
+ States for tblextab FSM
+**/
+
+#define EMBEDDED_SLASH1 0
+#define EMBEDDED_SLASH2 1
+#define IN_COMMENT 2
+#define IN_LITERAL1 3
+#define IN_LITERAL2 4
+#define IN_NONDOS 5
+#define IN_NONDOS2 6
+#define IN_OP1 7
+#define IN_OP2 8
+#define IN_SWITCH 9
+#define IN_WHITESPACE 10
+#define PATH_NAME 11
+#define PATH_OR_NDOS 12
+#define QUOTED_PATH_LIT 13
+
+
+#define TBLEXTAB_N_INPUTS 19
+#define TBLEXTAB_N_STATES 14
+
+static struct STATE_TAB_TYPE tblextab_state_table[TBLEXTAB_N_INPUTS] [TBLEXTAB_N_STATES] =
+{
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: at_sign, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: at_sign, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: at_sign, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: at_sign, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: at_sign, State: in_literal2 */ },
+ { STORE_CHAR, PATH_NAME /* Input: at_sign, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: at_sign, State: in_nondos2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: at_sign, State: in_op1 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: at_sign, State: in_op2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: at_sign, State: in_switch */ },
+ { RETURN_AT_SIGN, PATH_NAME /* Input: at_sign, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: at_sign, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: at_sign, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: at_sign, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: back_slash, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: back_slash, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: back_slash, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: back_slash, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: back_slash, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: back_slash, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: back_slash, State: in_nondos2 */ },
+ { RETURN_SWITCH, PATH_NAME /* Input: back_slash, State: in_op1 */ },
+ { RETURN_SWITCH, PATH_NAME /* Input: back_slash, State: in_op2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: back_slash, State: in_switch */ },
+ { STORE_CHAR, PATH_NAME /* Input: back_slash, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: back_slash, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: back_slash, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: back_slash, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: close_comment, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: close_comment, State: embedded_slash2 */ },
+ { POP_STATE, IN_COMMENT /* Input: close_comment, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: close_comment, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: close_comment, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: close_comment, State: in_nondos */ },
+ { BAD_TOKEN, IN_NONDOS2 /* Input: close_comment, State: in_nondos2 */ },
+ { BAD_TOKEN, IN_OP1 /* Input: close_comment, State: in_op1 */ },
+ { BAD_TOKEN, IN_OP2 /* Input: close_comment, State: in_op2 */ },
+ { BAD_TOKEN, IN_SWITCH /* Input: close_comment, State: in_switch */ },
+ { BAD_TOKEN, IN_WHITESPACE /* Input: close_comment, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: close_comment, State: path_name */ },
+ { STORE_CHAR, PATH_OR_NDOS /* Input: close_comment, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: close_comment, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: colon, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: colon, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: colon, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: colon, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: colon, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: colon, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: colon, State: in_nondos2 */ },
+ { DO_NOTHING, IN_OP2 /* Input: colon, State: in_op1 */ },
+ { BAD_TOKEN, IN_OP2 /* Input: colon, State: in_op2 */ },
+ { DO_NOTHING, IN_OP1 /* Input: colon, State: in_switch */ },
+ { BAD_TOKEN, IN_WHITESPACE /* Input: colon, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: colon, State: path_name */ },
+ { STORE_CHAR, IN_NONDOS /* Input: colon, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: colon, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: d_quote, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: d_quote, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: d_quote, State: in_comment */ },
+ { DO_NOTHING, IN_OP1 /* Input: d_quote, State: in_literal1 */ },
+ { DO_NOTHING, IN_OP2 /* Input: d_quote, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: d_quote, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: d_quote, State: in_nondos2 */ },
+ { DO_NOTHING, IN_LITERAL1 /* Input: d_quote, State: in_op1 */ },
+ { DO_NOTHING, IN_LITERAL2 /* Input: d_quote, State: in_op2 */ },
+ { BAD_TOKEN, IN_SWITCH /* Input: d_quote, State: in_switch */ },
+ { DO_NOTHING, QUOTED_PATH_LIT /* Input: d_quote, State: in_whitespace */ },
+ { DO_NOTHING, QUOTED_PATH_LIT /* Input: d_quote, State: path_name */ },
+ { BAD_TOKEN, PATH_OR_NDOS /* Input: d_quote, State: path_or_ndos */ },
+ { DO_NOTHING, PATH_NAME /* Input: d_quote, State: quoted_path_lit */ }
+ },
+ {
+ { STORE_SLASH_OP1, IN_OP1 /* Input: digit, State: embedded_slash1 */ },
+ { STORE_SLASH_OP2, IN_OP2 /* Input: digit, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: digit, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: digit, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: digit, State: in_literal2 */ },
+ { STORE_CHAR, IN_NONDOS /* Input: digit, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: digit, State: in_nondos2 */ },
+ { STORE_OP1, IN_OP1 /* Input: digit, State: in_op1 */ },
+ { STORE_OP2, IN_OP2 /* Input: digit, State: in_op2 */ },
+ { STORE_CHAR, IN_SWITCH /* Input: digit, State: in_switch */ },
+ { STORE_CHAR, PATH_OR_NDOS /* Input: digit, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: digit, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: digit, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: digit, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: eoi, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: eoi, State: embedded_slash2 */ },
+ { HANGING_COMMENT, IN_WHITESPACE /* Input: eoi, State: in_comment */ },
+ { HANGING_QUOTE, IN_WHITESPACE /* Input: eoi, State: in_literal1 */ },
+ { HANGING_QUOTE, IN_WHITESPACE /* Input: eoi, State: in_literal2 */ },
+ { RETURN_NONDOS_PUSH, IN_WHITESPACE /* Input: eoi, State: in_nondos */ },
+ { BAD_TOKEN, IN_NONDOS2 /* Input: eoi, State: in_nondos2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: eoi, State: in_op1 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: eoi, State: in_op2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: eoi, State: in_switch */ },
+ { RETURN_EOI, IN_WHITESPACE /* Input: eoi, State: in_whitespace */ },
+ { RETURN_PATH_PUSH, IN_WHITESPACE /* Input: eoi, State: path_name */ },
+ { RETURN_PATH_PUSH, IN_WHITESPACE /* Input: eoi, State: path_or_ndos */ },
+ { HANGING_QUOTE, IN_WHITESPACE /* Input: eoi, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: equals_sign, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: equals_sign, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: equals_sign, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: equals_sign, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: equals_sign, State: in_literal2 */ },
+ { RETURN_NONDOS_PUSH, IN_WHITESPACE /* Input: equals_sign, State: in_nondos */ },
+ { BAD_TOKEN, IN_NONDOS2 /* Input: equals_sign, State: in_nondos2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: equals_sign, State: in_op1 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: equals_sign, State: in_op2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: equals_sign, State: in_switch */ },
+ { RETURN_EQUALS, IN_WHITESPACE /* Input: equals_sign, State: in_whitespace */ },
+ { RETURN_PATH_PUSH, IN_WHITESPACE /* Input: equals_sign, State: path_name */ },
+ { RETURN_PATH_PUSH, IN_WHITESPACE /* Input: equals_sign, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: equal_sign, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: forward_slash, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: forward_slash, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: forward_slash, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: forward_slash, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: forward_slash, State: in_literal2 */ },
+ { RETURN_NONDOS, IN_SWITCH /* Input: forward_slash, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: forward_slash, State: in_nondos2 */ },
+ { DO_NOTHING, EMBEDDED_SLASH1 /* Input: forward_slash, State: in_op1 */ },
+ { DO_NOTHING, EMBEDDED_SLASH2 /* Input: forward_slash, State: in_op2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: forward_slash, State: in_switch */ },
+ { DO_NOTHING, IN_SWITCH /* Input: forward_slash, State: in_whitespace */ },
+ { POSSIBLE_RET_PATH, PATH_NAME /* Input: forward_slash, State: path_name */ },
+ { RETURN_PATH, IN_SWITCH /* Input: forward_slash, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: forward_slash, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: l_bracket, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: l_bracket, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: l_bracket, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: l_bracket, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: l_bracket, State: in_literal2 */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: l_bracket, State: in_nondos */ },
+ { BAD_TOKEN, IN_NONDOS2 /* Input: l_bracket, State: in_nondos2 */ },
+ { BAD_TOKEN, IN_OP1 /* Input: l_bracket, State: in_op1 */ },
+ { BAD_TOKEN, IN_OP2 /* Input: l_bracket, State: in_op2 */ },
+ { BAD_TOKEN, IN_SWITCH /* Input: l_bracket, State: in_switch */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: l_bracket, State: in_whitespace */ },
+ { BAD_TOKEN, PATH_NAME /* Input: l_bracket, State: path_name */ },
+ { BAD_TOKEN, PATH_OR_NDOS /* Input: l_bracket, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: l_bracket, State: quoted_path_lit */ }
+ },
+ {
+ { RETURN_SWITCH_PUSH, IN_SWITCH /* Input: letter, State: embedded_slash1 */ },
+ { RETURN_SWITCH_PUSH, IN_SWITCH /* Input: letter, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: letter, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: letter, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: letter, State: in_literal2 */ },
+ { STORE_CHAR, IN_NONDOS /* Input: letter, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: letter, State: in_nondos2 */ },
+ { STORE_OP1, IN_OP1 /* Input: letter, State: in_op1 */ },
+ { STORE_OP2, IN_OP2 /* Input: letter, State: in_op2 */ },
+ { STORE_CHAR, IN_SWITCH /* Input: letter, State: in_switch */ },
+ { STORE_CHAR, PATH_NAME /* Input: letter, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: letter, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: letter, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: letter, State: quoted_path_lit */ }
+ },
+ {
+ { RETURN_SWITCH_PUSH, IN_SWITCH /* Input: minus_sign, State: embedded_slash1 */ },
+ { RETURN_SWITCH_PUSH, IN_SWITCH /* Input: minus_sign, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: minus_sign, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: minus_sign, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: minus_sign, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: minus_sign, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: minus_sign, State: in_nondos2 */ },
+ { STORE_OP1, IN_OP1 /* Input: minus_sign, State: in_op1 */ },
+ { STORE_OP2, IN_OP2 /* Input: minus_sign, State: in_op2 */ },
+ { STORE_CHAR, IN_SWITCH /* Input: minus_sign, State: in_switch */ },
+ { STORE_CHAR, PATH_NAME /* Input: minus_sign, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: minus_sign, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: minus_sign, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: minus_sigh, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: other_char, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: other_char, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: other_char, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: other_char, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: other_char, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: other_char, State: in_nondos */ },
+ { BAD_TOKEN, IN_NONDOS2 /* Input: other_char, State: in_nondos2 */ },
+ { BAD_TOKEN, IN_OP1 /* Input: other_char, State: in_op1 */ },
+ { BAD_TOKEN, IN_OP2 /* Input: other_char, State: in_op2 */ },
+ { BAD_TOKEN, IN_SWITCH /* Input: other_char, State: in_switch */ },
+ { BAD_TOKEN, IN_WHITESPACE /* Input: other_char, State: in_whitespace */ },
+ { BAD_TOKEN, PATH_NAME /* Input: other_char, State: path_name */ },
+ { BAD_TOKEN, PATH_OR_NDOS /* Input: other_char, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: other_char, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: period, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: period, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: period, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: period, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: period, State: in_literal2 */ },
+ { STORE_CHAR, IN_NONDOS /* Input: period, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: period, State: in_nondos2 */ },
+ { BAD_TOKEN, IN_OP1 /* Input: period, State: in_op1 */ },
+ { BAD_TOKEN, IN_OP2 /* Input: period, State: in_op2 */ },
+ { BAD_TOKEN, IN_SWITCH /* Input: period, State: in_switch */ },
+ { STORE_CHAR, PATH_NAME /* Input: period, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: period, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: period, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: period, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: q_mark, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: q_mark, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: q_mark, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: q_mark, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: q_mark, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: q_mark, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: q_mark, State: in_nondos2 */ },
+ { STORE_OP1, IN_OP1 /* Input: q_mark, State: in_op1 */ },
+ { STORE_OP2, IN_OP2 /* Input: q_mark, State: in_op2 */ },
+ { STORE_OP1, IN_WHITESPACE /* Input: q_mark, State: in_switch */ },
+ { STORE_CHAR, PATH_NAME /* Input: q_mark, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: q_mark, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: q_mark, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: q_mark, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: r_bracket, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: r_bracket, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: r_bracket, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: r_bracket, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: r_bracket, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: r_bracket, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS /* Input: r_bracket, State: in_nondos2 */ },
+ { BAD_TOKEN, IN_OP1 /* Input: r_bracket, State: in_op1 */ },
+ { BAD_TOKEN, IN_OP2 /* Input: r_bracket, State: in_op2 */ },
+ { BAD_TOKEN, IN_SWITCH /* Input: r_bracket, State: in_switch */ },
+ { BAD_TOKEN, IN_WHITESPACE /* Input: r_bracket, State: in_whitespace */ },
+ { BAD_TOKEN, PATH_NAME /* Input: r_bracket, State: path_name */ },
+ { BAD_TOKEN, PATH_OR_NDOS /* Input: r_bracket, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: r_bracket, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: star, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: star, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: star, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: star, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: star, State: in_literal2 */ },
+ { BAD_TOKEN, IN_NONDOS /* Input: star, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: star, State: in_nondos2 */ },
+ { BAD_TOKEN, IN_OP1 /* Input: star, State: in_op1 */ },
+ { BAD_TOKEN, IN_OP2 /* Input: star, State: in_op2 */ },
+ { BAD_TOKEN, IN_SWITCH /* Input: star, State: in_switch */ },
+ { STORE_CHAR, PATH_NAME /* Input: star, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: star, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: star, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: star, State: quoted_path_lit */ }
+ },
+ {
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: start_comment, State: embedded_slash1 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: start_comment, State: embedded_slash2 */ },
+ { PUSH_STATE, IN_COMMENT /* Input: start_comment, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: start_comment, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: start_comment, State: in_literal2 */ },
+ { RETURN_NONDOS_PUSH, IN_WHITESPACE /* Input: start_comment, State: in_nondos */ },
+ { BAD_TOKEN, IN_NONDOS2 /* Input: start_comment, State: in_nondos2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: start_comment, State: in_op1 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: start_comment, State: in_op2 */ },
+ { RETURN_SWITCH_PUSH, IN_WHITESPACE /* Input: start_comment, State: in_switch */ },
+ { PUSH_STATE, IN_COMMENT /* Input: start_comment, State: in_whitespace */ },
+ { STORE_CHAR, PATH_NAME /* Input: start_comment, State: path_name */ },
+ { STORE_CHAR, PATH_NAME /* Input: start_comment, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: start_comment, State: quoted_path_lit */ }
+ },
+ {
+ { BAD_TOKEN, EMBEDDED_SLASH1 /* Input: white_space, State: embedded_slash1 */ },
+ { BAD_TOKEN, EMBEDDED_SLASH2 /* Input: white_space, State: embedded_slash2 */ },
+ { DO_NOTHING, IN_COMMENT /* Input: white_space, State: in_comment */ },
+ { STORE_OP1, IN_LITERAL1 /* Input: white_space, State: in_literal1 */ },
+ { STORE_OP2, IN_LITERAL2 /* Input: white_space, State: in_literal2 */ },
+ { RETURN_NONDOS, IN_WHITESPACE /* Input: white_space, State: in_nondos */ },
+ { STORE_CHAR, IN_NONDOS2 /* Input: white_space, State: in_nondos2 */ },
+ { RETURN_SWITCH, IN_WHITESPACE /* Input: white_space, State: in_op1 */ },
+ { RETURN_SWITCH, IN_WHITESPACE /* Input: white_space, State: in_op2 */ },
+ { RETURN_SWITCH, IN_WHITESPACE /* Input: white_space, State: in_switch */ },
+ { DO_NOTHING, IN_WHITESPACE /* Input: white_space, State: in_whitespace */ },
+ { RETURN_PATH, IN_WHITESPACE /* Input: white_space, State: path_name */ },
+ { RETURN_PATH, IN_WHITESPACE /* Input: white_space, State: path_or_ndos */ },
+ { STORE_CHAR, QUOTED_PATH_LIT /* Input: white_space, State: quoted_path_lit */ }
+ }
+};
+
+
+static UCHAR lex_input_conditioner[256] =
+{
+ OTHER_CHAR, /* 0 */
+ OTHER_CHAR, /* 1 */
+ OTHER_CHAR, /* 2 */
+ OTHER_CHAR, /* 3 */
+ OTHER_CHAR, /* 4 */
+ OTHER_CHAR, /* 5 */
+ OTHER_CHAR, /* 6 */
+ OTHER_CHAR, /* 7 */
+ OTHER_CHAR, /* 8 */
+ WHITE_SPACE, /* 9 */
+ WHITE_SPACE, /* 10 */
+ OTHER_CHAR, /* 11 */
+ OTHER_CHAR, /* 12 */
+ OTHER_CHAR, /* 13 */
+ OTHER_CHAR, /* 14 */
+ OTHER_CHAR, /* 15 */
+ OTHER_CHAR, /* 16 */
+ OTHER_CHAR, /* 17 */
+ OTHER_CHAR, /* 18 */
+ OTHER_CHAR, /* 19 */
+ OTHER_CHAR, /* 20 */
+ OTHER_CHAR, /* 21 */
+ OTHER_CHAR, /* 22 */
+ OTHER_CHAR, /* 23 */
+ OTHER_CHAR, /* 24 */
+ OTHER_CHAR, /* 25 */
+ EOI, /* 26 */
+ OTHER_CHAR, /* 27 */
+ OTHER_CHAR, /* 28 */
+ OTHER_CHAR, /* 29 */
+ OTHER_CHAR, /* 30 */
+ OTHER_CHAR, /* 31 */
+ WHITE_SPACE, /* 32 */
+ LETTER, /* 33 */
+ D_QUOTE, /* 34 */
+ LETTER, /* 35 */
+ LETTER, /* 36 */
+ LETTER, /* 37 */
+ LETTER, /* 38 */
+ LETTER, /* 39 */
+ LETTER, /* 40 */
+ LETTER, /* 41 */
+ STAR, /* 42 */
+ LETTER, /* 43 */
+ WHITE_SPACE, /* 44 */
+ MINUS_SIGN, /* 45 */
+ PERIOD, /* 46 */
+ FORWARD_SLASH, /* 47 */
+ DIGIT, /* 48 */
+ DIGIT, /* 49 */
+ DIGIT, /* 50 */
+ DIGIT, /* 51 */
+ DIGIT, /* 52 */
+ DIGIT, /* 53 */
+ DIGIT, /* 54 */
+ DIGIT, /* 55 */
+ DIGIT, /* 56 */
+ DIGIT, /* 57 */
+ COLON, /* 58 */
+ OTHER_CHAR, /* 59 */
+ OTHER_CHAR, /* 60 */
+ EQUALS_SIGN, /* 61 */
+ OTHER_CHAR, /* 62 */
+ Q_MARK, /* 63 */
+ AT_SIGN, /* 64 */
+ LETTER, /* 65 */
+ LETTER, /* 66 */
+ LETTER, /* 67 */
+ LETTER, /* 68 */
+ LETTER, /* 69 */
+ LETTER, /* 70 */
+ LETTER, /* 71 */
+ LETTER, /* 72 */
+ LETTER, /* 73 */
+ LETTER, /* 74 */
+ LETTER, /* 75 */
+ LETTER, /* 76 */
+ LETTER, /* 77 */
+ LETTER, /* 78 */
+ LETTER, /* 79 */
+ LETTER, /* 80 */
+ LETTER, /* 81 */
+ LETTER, /* 82 */
+ LETTER, /* 83 */
+ LETTER, /* 84 */
+ LETTER, /* 85 */
+ LETTER, /* 86 */
+ LETTER, /* 87 */
+ LETTER, /* 88 */
+ LETTER, /* 89 */
+ LETTER, /* 90 */
+ LETTER, /* 91 */
+ BACK_SLASH, /* 92 */
+ LETTER, /* 93 */
+ LETTER, /* 94 */
+ LETTER, /* 95 */
+ LETTER, /* 96 */
+ LETTER, /* 97 */
+ LETTER, /* 98 */
+ LETTER, /* 99 */
+ LETTER, /* 100 */
+ LETTER, /* 101 */
+ LETTER, /* 102 */
+ LETTER, /* 103 */
+ LETTER, /* 104 */
+ LETTER, /* 105 */
+ LETTER, /* 106 */
+ LETTER, /* 107 */
+ LETTER, /* 108 */
+ LETTER, /* 109 */
+ LETTER, /* 110 */
+ LETTER, /* 111 */
+ LETTER, /* 112 */
+ LETTER, /* 113 */
+ LETTER, /* 114 */
+ LETTER, /* 115 */
+ LETTER, /* 116 */
+ LETTER, /* 117 */
+ LETTER, /* 118 */
+ LETTER, /* 119 */
+ LETTER, /* 120 */
+ LETTER, /* 121 */
+ LETTER, /* 122 */
+ START_COMMENT, /* 123 */
+ OTHER_CHAR, /* 124 */
+ CLOSE_COMMENT, /* 125 */
+ LETTER, /* 126 */
+ OTHER_CHAR, /* 127 */
+ LETTER, /* 128 */
+ LETTER, /* 129 */
+ LETTER, /* 130 */
+ LETTER, /* 131 */
+ LETTER, /* 132 */
+ LETTER, /* 133 */
+ LETTER, /* 134 */
+ LETTER, /* 135 */
+ LETTER, /* 136 */
+ LETTER, /* 137 */
+ LETTER, /* 138 */
+ LETTER, /* 139 */
+ LETTER, /* 140 */
+ LETTER, /* 141 */
+ LETTER, /* 142 */
+ LETTER, /* 143 */
+ LETTER, /* 144 */
+ LETTER, /* 145 */
+ LETTER, /* 146 */
+ LETTER, /* 147 */
+ LETTER, /* 148 */
+ LETTER, /* 149 */
+ LETTER, /* 150 */
+ LETTER, /* 151 */
+ LETTER, /* 152 */
+ LETTER, /* 153 */
+ LETTER, /* 154 */
+ LETTER, /* 155 */
+ LETTER, /* 156 */
+ LETTER, /* 157 */
+ LETTER, /* 158 */
+ LETTER, /* 159 */
+ LETTER, /* 160 */
+ LETTER, /* 161 */
+ LETTER, /* 162 */
+ LETTER, /* 163 */
+ LETTER, /* 164 */
+ LETTER, /* 165 */
+ LETTER, /* 166 */
+ LETTER, /* 167 */
+ LETTER, /* 168 */
+ LETTER, /* 169 */
+ LETTER, /* 170 */
+ LETTER, /* 171 */
+ LETTER, /* 172 */
+ LETTER, /* 173 */
+ LETTER, /* 174 */
+ LETTER, /* 175 */
+ LETTER, /* 176 */
+ LETTER, /* 177 */
+ LETTER, /* 178 */
+ LETTER, /* 179 */
+ LETTER, /* 180 */
+ LETTER, /* 181 */
+ LETTER, /* 182 */
+ LETTER, /* 183 */
+ LETTER, /* 184 */
+ LETTER, /* 185 */
+ LETTER, /* 186 */
+ LETTER, /* 187 */
+ LETTER, /* 188 */
+ LETTER, /* 189 */
+ LETTER, /* 190 */
+ LETTER, /* 191 */
+ LETTER, /* 192 */
+ LETTER, /* 193 */
+ LETTER, /* 194 */
+ LETTER, /* 195 */
+ LETTER, /* 196 */
+ LETTER, /* 197 */
+ LETTER, /* 198 */
+ LETTER, /* 199 */
+ LETTER, /* 200 */
+ LETTER, /* 201 */
+ LETTER, /* 202 */
+ LETTER, /* 203 */
+ LETTER, /* 204 */
+ LETTER, /* 205 */
+ LETTER, /* 206 */
+ LETTER, /* 207 */
+ LETTER, /* 208 */
+ LETTER, /* 209 */
+ LETTER, /* 210 */
+ LETTER, /* 211 */
+ LETTER, /* 212 */
+ LETTER, /* 213 */
+ LETTER, /* 214 */
+ LETTER, /* 215 */
+ LETTER, /* 216 */
+ LETTER, /* 217 */
+ LETTER, /* 218 */
+ LETTER, /* 219 */
+ LETTER, /* 220 */
+ LETTER, /* 221 */
+ LETTER, /* 222 */
+ LETTER, /* 223 */
+ LETTER, /* 224 */
+ LETTER, /* 225 */
+ LETTER, /* 226 */
+ LETTER, /* 227 */
+ LETTER, /* 228 */
+ LETTER, /* 229 */
+ LETTER, /* 230 */
+ LETTER, /* 231 */
+ LETTER, /* 232 */
+ LETTER, /* 233 */
+ LETTER, /* 234 */
+ LETTER, /* 235 */
+ LETTER, /* 236 */
+ LETTER, /* 237 */
+ LETTER, /* 238 */
+ LETTER, /* 239 */
+ LETTER, /* 240 */
+ LETTER, /* 241 */
+ LETTER, /* 242 */
+ LETTER, /* 243 */
+ LETTER, /* 244 */
+ LETTER, /* 245 */
+ LETTER, /* 246 */
+ LETTER, /* 247 */
+ LETTER, /* 248 */
+ LETTER, /* 249 */
+ LETTER, /* 250 */
+ LETTER, /* 251 */
+ LETTER, /* 252 */
+ LETTER, /* 253 */
+ LETTER, /* 254 */
+ LETTER /* 255 */
+};
+
+/*****************************************************************************
+
+ Name: nexttok()
+
+ Description: This function returns a pointer to a structure
+ containing information about the next token in the input
+ stream. The returned structure has the token itself, plus
+ information as to its type and location in the input source.
+
+ Returns: Pointer to a TOKEN structure
+
+*****************************************************************************/
+TOKEN_PTR nexttok(
+CHAR ( * nextc ) ( CHAR_PTR , INT16_PTR ), /* used to get next CHAR from file or string */
+VOID ( * prevc ) ( CHAR, CHAR_PTR , INT16_PTR ), /* used to push back CHAR to file or string */
+INT16_PTR curr_state, /* used to remember state from previous invocation */
+INT16_PTR curr_line, /* line in source */
+INT16_PTR curr_col, /* col in source */
+CHAR_PTR src_ptr, /* pointer to file or string input source */
+INT16_PTR cmd_i ) /* index into source string */
+{
+ CHAR c ; /* latest CHAR from source */
+ INT16 curr_input ; /* latest conditioned input */
+ register INT16 i ; /* index into curr_token */
+ INT16 k ; /* indexes correct operand */
+ INT16 is[2] ; /* index into op strings */
+ INT16 c_nesting ; /* level of comment nesting */
+ INT16 old_state ; /* previous state */
+ register INT16 curr_action ; /* index into action jump table */
+ CHAR saved_c[10] ; /* holds raw input CHAR as string */
+ TOKEN_PTR this_token ; /* points to current token structure */
+
+ /* now malloc a structure to hold this token */
+ this_token = alltok( ) ;
+ if( this_token == NULL ) {
+ return( NULL ) ;
+ }
+
+ /* initialize everything in sight */
+ i = 0 ;
+ k = 0 ;
+ is[0] = 0 ;
+ is[1] = 0 ;
+ c_nesting = 0 ;
+ saved_c[0] = TEXT('\0') ;
+ this_token->tok_spelling[0] = TEXT('\0');
+ this_token->op_ptrs[0] = NULL ;
+ this_token->op_ptrs[1] = NULL ;
+
+ /* sanity checks */
+ msassert( nextc != NULL ) ;
+ msassert( prevc != NULL ) ;
+ msassert( src_ptr != NULL ) ;
+ msassert( *curr_state >= 0 && *curr_state < TBLEXTAB_N_STATES ) ;
+
+ while( TRUE )
+ {
+ /* get next input CHAR from the appropriate source (string or file) */
+ c = ( * nextc ) ( src_ptr, cmd_i ) ;
+ ( *curr_col ) ++ ;
+ if( c == TEXT('\n') ) {
+ ( *curr_line ) ++ ;
+ *curr_col = 1 ;
+ }
+ /* "condition" raw input to get fsm input */
+ curr_input = ( INT16 ) lex_input_conditioner[( ( UCHAR ) c )] ;
+
+ /* look into fsm table, see what to do and next state */
+ msassert( curr_input >= 0 && curr_input < TBLEXTAB_N_INPUTS ) ;
+
+ old_state = *curr_state ;
+ *curr_state = ( INT16 ) tblextab_state_table[curr_input][*curr_state].next_state ;
+
+ msassert( *curr_state >= 0 && *curr_state <= TBLEXTAB_N_STATES ) ;
+
+ curr_action = ( INT16 ) tblextab_state_table[curr_input][old_state].action ;
+
+ /* action routines */
+ switch ( curr_action ) {
+ case DO_NOTHING : /* no action, state change only */
+ continue ;
+
+ case BAD_TOKEN : /* ill-formed token */
+ this_token->tok_typ = T_BAD_TOKEN ;
+ break ;
+
+ case HANGING_COMMENT : /* comment open at eoi */
+ this_token->tok_typ = T_EARLY_EOF1 ;
+ break ;
+
+ case HANGING_QUOTE : /* quote open at eoi */
+ this_token->tok_typ = T_EARLY_EOF2 ;
+ break ;
+
+ case POP_STATE : /* TEXT("pop up") one level in comment nesting */
+ c_nesting -- ;
+ if( c_nesting == 0 ) {
+ *curr_state = IN_WHITESPACE ;
+ } else {
+ *curr_state = IN_COMMENT ;
+ }
+ continue ;
+
+ case PUSH_STATE : /* TEXT("push down") one level of comment nesting */
+ c_nesting ++ ;
+ continue ;
+
+ case RETURN_AT_SIGN : /* found include file switch TEXT("@") */
+ this_token->tok_typ = T_AT_SIGN ;
+ break ;
+
+ case RETURN_EOI : /* end of string or end of file */
+ this_token->tok_typ = T_EOF ;
+ break ;
+
+ case RETURN_EQUALS : /* found TEXT("=") seperateing target and source */
+ this_token->tok_typ = T_EQUALS ;
+ break ;
+
+ case RETURN_PATH_PUSH : /* set up to re-read last CHAR */
+ ( * prevc ) ( c , src_ptr, cmd_i ) ;
+
+ case RETURN_PATH : /* completed building a pathspec */
+ this_token->tok_typ = T_FILESPEC ;
+ break ;
+
+ case POSSIBLE_RET_PATH : /* completed building a pathspec */
+
+ {
+ CHAR_PTR p ;
+ CHAR_PTR old_p ;
+ BOOLEAN in_brack = FALSE ;
+
+ p = this_token->tok_spelling ;
+
+ if (*p == TEXT('+') || *p == TEXT('[')) {
+
+ this_token->tok_spelling[i] = TEXT('\0') ;
+
+ /* ignore all /'s in []'s */
+ do {
+ old_p = p ;
+ p = strchr( p, TEXT('[') ) ;
+
+ if ( p == NULL ) {
+ break ;
+ } else {
+ in_brack = TRUE ;
+ }
+
+ p = strchr( p, TEXT(']') ) ;
+
+ if ( p == NULL ) {
+ break ;
+ } else {
+ in_brack = FALSE ;
+ }
+ } while ( p != NULL ) ;
+
+
+ p = strchr( old_p, TEXT('/')) ;
+
+ if ( p == NULL || in_brack ) {
+
+ if( i > MAX_TOKEN_LEN ) {
+ this_token->tok_typ = T_TOKEN_TOO_LONG ;
+ i = MAX_TOKEN_LEN ;
+ *curr_state = IN_WHITESPACE ;
+ break ;
+ }
+ this_token->tok_spelling[i++] = c ;
+ continue;
+
+ }
+
+
+ }
+ *curr_state = IN_SWITCH ;
+ this_token->tok_typ = T_FILESPEC ;
+ }
+
+ break ;
+
+ case RETURN_NONDOS_PUSH : /* set up to re-read last CHAR */
+ ( * prevc ) ( c , src_ptr, cmd_i ) ;
+
+ case RETURN_NONDOS : /* completed a non-DOS path spec */
+ this_token->tok_typ = T_NONDOS ;
+ break ;
+
+ case RETURN_SWITCH_PUSH : /* set up to re-read last CHAR */
+ ( * prevc ) ( c , src_ptr, cmd_i ) ;
+
+ case RETURN_SWITCH : /* completed a switch */
+ this_token->tok_typ = T_SWITCH ;
+ /* Null terminate the operand strings, if present */
+ if( this_token->op_ptrs[0] != NULL ) {
+ this_token->op_ptrs[0][is[0]] = TEXT('\0') ;
+ }
+ if( this_token->op_ptrs[1] != NULL ) {
+ this_token->op_ptrs[1][is[1]] = TEXT('\0') ;
+ }
+ break ;
+
+ case STORE_CHAR : /* add current CHAR to token string */
+ if( i > MAX_TOKEN_LEN ) {
+ this_token->tok_typ = T_TOKEN_TOO_LONG ;
+ i = MAX_TOKEN_LEN ;
+ *curr_state = IN_WHITESPACE ;
+ break ;
+ }
+ if( (c > TEXT('`')) && (c < TEXT('{')) ) {
+ this_token->tok_spelling[i] = (CHAR)toupper( c ) ;
+ }
+ else {
+ this_token->tok_spelling[i] = c ;
+ }
+ i ++ ;
+ continue ;
+
+ case STORE_SLASH_OP1: /* deal with embedded slash in date switch */
+ case STORE_SLASH_OP2: /* deal with embedded slash in date switch */
+ case STORE_OP1 : /* store a character into 1st operand string */
+ case STORE_OP2 : /* store a character into 2nd operand string */
+ /* point to correct operand */
+ if( ( curr_action == STORE_SLASH_OP1 ) || ( curr_action == STORE_OP1 ) ) {
+ k = 0 ;
+ } else {
+ k = 1 ;
+ }
+ /* allocate storage for operand if necessary */
+ if( this_token->op_ptrs[k] == NULL ) {
+ this_token->op_ptrs[k] = (LPSTR)allop( MAX_TOKEN_LEN + 1) ;
+ if( this_token->op_ptrs[k] == NULL ) {
+ rlstok( &this_token ) ;
+ return( NULL ) ;
+ }
+ }
+ /* insert a slash if necessary */
+ if( ( curr_action == STORE_SLASH_OP1 ) || ( curr_action == STORE_SLASH_OP2 ) ) {
+ this_token->op_ptrs[k][is[k]] = TEXT('/') ;
+ is[k]++ ;
+ }
+ /* check that length is within bounds */
+ if( is[k] > MAX_TOKEN_LEN ) {
+ this_token->tok_typ = T_TOKEN_TOO_LONG ;
+ this_token->op_ptrs[k][MAX_TOKEN_LEN] = TEXT('\0') ;
+ *curr_state = IN_WHITESPACE ;
+ break ;
+ }
+ this_token->op_ptrs[k][is[k]] = c ;
+ is[k]++ ;
+ continue ;
+
+ default :
+ msassert( /* lex: invalid action */ FALSE ) ;
+ break ;
+ } /* end switch */
+ this_token->tok_spelling[i] = TEXT('\0') ;
+ this_token->src_line_no = *curr_line ;
+ this_token->src_col_no = *curr_col ;
+ return( this_token ) ;
+ } /* end while */
+} /* end nexttok */
diff --git a/private/utils/ntbackup/src/tbpdat.c b/private/utils/ntbackup/src/tbpdat.c
new file mode 100644
index 000000000..99c7a3213
--- /dev/null
+++ b/private/utils/ntbackup/src/tbpdat.c
@@ -0,0 +1,270 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tbpdat.c
+
+ Description: This funciton contains the switches used by the
+ script parser.
+
+ PLEASE NOTE: the entries in the tables must remain
+ alphabetized.
+
+
+ $Log: G:/UI/LOGFILES/TBPDAT.C_V $
+
+ Rev 1.4 01 Nov 1992 16:09:14 DAVEV
+Unicode changes
+
+ Rev 1.3 07 Oct 1992 14:17:12 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.2 04 Oct 1992 19:41:04 DAVEV
+Unicode Awk pass
+
+ Rev 1.1 15 May 1992 13:35:32 MIKEP
+nt pass 2
+
+ Rev 1.0 20 Nov 1991 19:35:14 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/* =>=>=>=>=> NOTE the flags MUST be in alphabetical order */
+
+struct SW_TAB_TYPE tbackup_switches[] =
+{
+ { TEXT("-ARCHIVE"), SW_MINUS_A, 2, 0 },
+ { TEXT("-FILES"), SW_FILES, 2, 0 },
+ { TEXT("-HIDDEN"), SW_MINUS_H, 2, 0 },
+ { TEXT("-SPECIAL"), SW_MINUS_S, 2, 0 },
+ { TEXT("3270"), SW_3270, 1, 0 },
+ { TEXT("ADATE"), SW_ACCESS_DATE, 2, 1 },
+
+ { TEXT("APPEND"), SW_APPEND, 1, 0 },
+ { TEXT("AUTOVERIFY"), SW_AUTO_VER, 2, 1 },
+ { TEXT("BACKUPNAME"), SW_BACK_NAME, 1, 1 },
+ { TEXT("CSR"), SW_CSR, 1, 2 },
+ { TEXT("DATE"), SW_DATE, 1, 2 },
+#if defined( MAYN_OS2 )
+ { TEXT("EDATE"), SW_NDATE, 2, 1 },
+#endif
+ { TEXT("EMPTY"), SW_EMPTY, 2, 0 },
+ { TEXT("ENTIRE"), SW_ENTIRE, 2, 0 },
+ { TEXT("FILES"), SW_FILES, 1, 0 },
+
+#if !defined( MAYN_OS2 )
+ { TEXT("IMAGE"), SW_DOS_IMAGE, 2, 0 },
+#endif
+
+ { TEXT("INUSE"), SW_B_INUSE, 2, 0 },
+ { TEXT("IOCHAN"), SW_IOCHAN, 2, 2 },
+ { TEXT("IRQ"), SW_IRQ, 2, 2 },
+ { TEXT("LABEL"), SW_LABEL, 2, 1 },
+ { TEXT("LEVEL"), SW_LOG_LEVEL, 2, 1 },
+ { TEXT("LISTING"), SW_LIST, 2, 2 },
+ { TEXT("MODIFIED"), SW_MODIFIED, 1, 0 },
+#if !defined( MAYN_OS2 )
+ { TEXT("NAFP"), SW_AFP, 2, 1},
+ { TEXT("NDATES"), SW_NDATE, 2, 1},
+ { TEXT("NONDOS"), SW_NONDOS, 2, 0 },
+#endif
+ { TEXT("NUMTAPE"), SW_NTAPE, 2, 1 },
+ { TEXT("PASSWORD"), SW_PASSWORD, 1, 0 },
+ { TEXT("REDIRECT"), SW_STDIN, 3, 0 },
+ { TEXT("REVISION"), SW_REV, 3, 0 },
+ { TEXT("SUBDIRECTORIES"),SW_SUBDIR, 1, 0 },
+ { TEXT("TAPENAME"), SW_TAPE_NAME, 1, 1 },
+ { TEXT("TRANSFER"), SW_TRANSFER, 2, 0 },
+ { TEXT("XCLUDE"), SW_EXCLUDE, 1, 0 },
+ { TEXT("YES"), SW_YES, 1, 0 }, /* ambiguous, resolve in */
+ { TEXT("YY"), SW_YES, 1, 0 }, /* tbprocsw based on input string */
+ { TEXT("Z"), SW_DEBUG, 1, 1 }
+};
+
+struct SW_TAB_TYPE trestore_switches[] =
+{
+ { TEXT("-FILES"), SW_FILES, 2, 0 },
+ { TEXT("3270"), SW_3270, 1, 0 },
+
+#ifdef MBS
+ { TEXT("ALL"), SW_ALL_VERSIONS, 2, 0 },
+#endif
+
+ { TEXT("AUTOVERIFY"), SW_AUTO_VER, 2, 1 },
+
+#ifdef MBS
+ { TEXT("BDATE"), SW_BKUP_DATE, 1, 2 },
+#endif
+
+ { TEXT("CSR"), SW_CSR, 1, 2 },
+ { TEXT("DATE"), SW_DATE, 1, 2 },
+
+#ifdef MBS
+ { TEXT("DELETED"), SW_DELETED_ONLY, 2, 0 },
+#endif
+
+#if defined( MAYN_OS2 )
+ { TEXT("EDATE"), SW_NDATE, 2, 1 },
+#endif
+ { TEXT("EMPTY"), SW_EMPTY, 2, 0 },
+ { TEXT("FILES"), SW_FILES, 1, 0 },
+ { TEXT("IOCHAN"), SW_IOCHAN, 2, 2 },
+ { TEXT("IRQ"), SW_IRQ, 2, 2 },
+ { TEXT("LEVEL"), SW_LOG_LEVEL, 2, 1 },
+ { TEXT("LISTING"), SW_LIST, 2, 2 },
+
+#if !defined( MAYN_OS2 )
+ { TEXT("NAFP"), SW_AFP, 2, 1},
+#endif
+
+
+#ifdef MBS
+ { TEXT("NDELETED"), SW_NON_DELETED_ONLY, 2, 0 },
+#endif
+
+
+#if !defined( MAYN_OS2 )
+ { TEXT("NONDOS"), SW_NONDOS, 2, 0 },
+#endif
+
+
+ { TEXT("NUMTAPE"), SW_NTAPE, 2, 1 },
+ { TEXT("PROMPT"), SW_P, 1, 0 },
+ { TEXT("Q"), SW_Q, 1, 0 },
+ { TEXT("REDIRECT"), SW_STDIN, 3, 0 },
+ { TEXT("REVISION"), SW_REV, 3, 0 },
+ { TEXT("SUBDIRECTORIES"),SW_SUBDIR, 1, 0 },
+ { TEXT("VOLUME"), SW_SETNO, 1, 1 },
+ { TEXT("XCLUDE"), SW_EXCLUDE, 1, 0 },
+ { TEXT("YES"), SW_YES, 1, 0 },
+ { TEXT("YY"), SW_YES, 1, 0 },
+ { TEXT("Z"), SW_DEBUG, 1, 1 },
+ { TEXT("__BSNUM"), SW_BSNUM, 5, 1 },
+ { TEXT("__TPNUM"), SW_TPNUM, 5, 1 },
+ { TEXT("__TPSEQ"), SW_BSNUM, 5, 1 }
+};
+
+struct SW_TAB_TYPE tdir_switches[] =
+{
+ { TEXT("-FILES"), SW_FILES, 2, 0 },
+ { TEXT("3270"), SW_3270, 1, 0 },
+ { TEXT("CSR"), SW_CSR, 1, 2 },
+ { TEXT("DATE"), SW_DATE, 1, 2 },
+ { TEXT("FILES"), SW_FILES, 1, 0 },
+ { TEXT("IOCHAN"), SW_IOCHAN, 2, 2 },
+ { TEXT("IRQ"), SW_IRQ, 2, 2 },
+ { TEXT("LEVEL"), SW_LOG_LEVEL, 2, 1 },
+ { TEXT("LISTING"), SW_LIST, 2, 2 },
+ { TEXT("NUMTAPE"), SW_NTAPE, 2, 1 },
+ { TEXT("PAGE"), SW_PAUSE, 1, 0 },
+ { TEXT("REDIRECT"), SW_STDIN, 3, 0 },
+ { TEXT("REVISION"), SW_REV, 3, 0 },
+ { TEXT("SUBDIRECTORIES"),SW_SUBDIR, 1, 0 },
+ { TEXT("VOLUME"), SW_SETNO, 1, 1 },
+ { TEXT("WIDE"), SW_WIDE, 1, 0 },
+ { TEXT("XCLUDE"), SW_EXCLUDE, 1, 0 },
+ { TEXT("YES"), SW_YES, 1, 0 },
+ { TEXT("YY"), SW_YES, 1, 0 },
+ { TEXT("Z"), SW_DEBUG, 1, 1 },
+ { TEXT("__BSNUM"), SW_BSNUM, 5, 1 },
+ { TEXT("__TPNUM"), SW_TPNUM, 5, 1 },
+ { TEXT("__TPSEQ"), SW_BSNUM, 5, 1 }
+};
+
+struct SW_TAB_TYPE tverify_switches[] =
+{
+ { TEXT("-FILES"), SW_FILES, 2, 0 },
+ { TEXT("3270"), SW_3270, 1, 0 },
+
+#ifdef MBS
+ { TEXT("ALL"), SW_ALL_VERSIONS, 1, 0 },
+ { TEXT("BDATE"), SW_BKUP_DATE, 1, 2 },
+#endif
+
+ { TEXT("CSR"), SW_CSR, 1, 2 },
+ { TEXT("DATE"), SW_DATE, 1, 2 },
+
+#ifdef MBS
+ { TEXT("DELETED"), SW_DELETED_ONLY, 2, 0 },
+#endif
+
+#if defined( MAYN_OS2 )
+ { TEXT("EDATE"), SW_NDATE, 2, 1 },
+#endif
+ { TEXT("EMPTY"), SW_EMPTY, 2, 0 },
+ { TEXT("FILES"), SW_FILES, 1, 0 },
+ { TEXT("IOCHAN"), SW_IOCHAN, 2, 2 },
+ { TEXT("IRQ"), SW_IRQ, 2, 2 },
+ { TEXT("LEVEL"), SW_LOG_LEVEL, 2, 1 },
+ { TEXT("LISTING"), SW_LIST, 2, 2 },
+
+#if !defined( MAYN_OS2 )
+ { TEXT("NAFP"), SW_AFP, 2, 1},
+#endif
+
+#ifdef MBS
+ { TEXT("NDELETED"), SW_NON_DELETED_ONLY, 2, 0 },
+#endif
+
+ { TEXT("NUMTAPE"), SW_NTAPE, 2, 1 },
+ { TEXT("REDIRECT"), SW_STDIN, 3, 0 },
+ { TEXT("REVISION"), SW_REV, 3, 0 },
+ { TEXT("SUBDIRECTORIES"),SW_SUBDIR, 1, 0 },
+ { TEXT("VOLUME"), SW_SETNO, 1, 1 },
+ { TEXT("XCLUDE"), SW_EXCLUDE, 1, 0 },
+ { TEXT("YES"), SW_YES, 1, 0 },
+ { TEXT("YY"), SW_YES, 1, 0 },
+ { TEXT("Z"), SW_DEBUG, 1, 1 },
+ { TEXT("__BSNUM"), SW_BSNUM, 5, 1 },
+ { TEXT("__TPNUM"), SW_TPNUM, 5, 1 },
+ { TEXT("__TPSEQ"), SW_BSNUM, 5, 1 }
+};
+
+struct SW_TAB_TYPE tension_switches[] =
+{
+ { TEXT("3270"), SW_3270, 1, 0 },
+ { TEXT("CSR"), SW_CSR, 1, 2 },
+ { TEXT("ERASE"), SW_ERASE_TAPE, 1, 0 },
+ { TEXT("FMARK"), SW_FMARK, 2, 0 },
+ { TEXT("IOCHAN"), SW_IOCHAN, 2, 2 },
+ { TEXT("IRQ"), SW_IRQ, 2, 2 },
+ { TEXT("LONG"), SW_LONG, 1, 0 },
+ { TEXT("NUMTAPE"), SW_NTAPE, 2, 1 },
+ { TEXT("REVISION"), SW_REV, 1, 0 },
+ { TEXT("YY"), SW_YES, 1, 0 },
+ { TEXT("Z"), SW_DEBUG, 1, 1 }
+};
+
+
+INT16 GetNumBkuSwitches( )
+{
+ return( sizeof( tbackup_switches ) / sizeof( struct SW_TAB_TYPE ) ) ;
+}
+
+INT16 GetNumRestSwitches( )
+{
+ return( sizeof( trestore_switches ) / sizeof( struct SW_TAB_TYPE ) ) ;
+}
+
+INT16 GetNumVerSwitches( )
+{
+ return( sizeof( tverify_switches ) / sizeof( struct SW_TAB_TYPE ) ) ;
+}
+
+INT16 GetNumDirSwitches( )
+{
+ return( sizeof( tdir_switches ) / sizeof( struct SW_TAB_TYPE ) ) ;
+}
+
+INT16 GetNumTenSwitches( )
+{
+ return( sizeof( tension_switches ) / sizeof( struct SW_TAB_TYPE ) ) ;
+}
+
diff --git a/private/utils/ntbackup/src/tbprocsw.c b/private/utils/ntbackup/src/tbprocsw.c
new file mode 100644
index 000000000..bfae7b31d
--- /dev/null
+++ b/private/utils/ntbackup/src/tbprocsw.c
@@ -0,0 +1,857 @@
+
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tbprocsw.c
+
+ Description: This file contains code to process the switches
+ in the input stream
+
+
+ $Log: G:\UI\LOGFILES\TBPROCSW.C_V $
+
+ Rev 1.13 17 Jan 1994 16:22:14 MIKEP
+fix unicode warnings
+
+ Rev 1.12 26 Jul 1993 12:25:16 MARINA
+enable c++
+
+ Rev 1.11 01 Nov 1992 16:09:30 DAVEV
+Unicode changes
+
+ Rev 1.10 07 Oct 1992 14:19:06 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.9 07 Oct 1992 14:04:46 DAVEV
+various unicode chgs
+
+ Rev 1.8 04 Oct 1992 19:41:08 DAVEV
+Unicode Awk pass
+
+ Rev 1.7 28 Jul 1992 14:52:40 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.6 08 Jul 1992 15:35:24 STEVEN
+Unicode BE changes
+
+ Rev 1.5 15 May 1992 13:35:44 MIKEP
+nt pass 2
+
+ Rev 1.4 14 May 1992 18:36:38 STEVEN
+40Format changes
+
+ Rev 1.3 31 Mar 1992 11:53:50 CHUCKB
+Don't use /append switch in selection scripts.
+
+ Rev 1.2 20 Mar 1992 12:58:04 CHUCKB
+Fixed processing for all modified, modified dates, and LAD switches.
+
+ Rev 1.1 10 Jan 1992 16:47:06 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.0 20 Nov 1991 19:35:44 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*
+ Local functions
+*/
+
+static INT16 one_op( CHAR_PTR );
+static INT16 no_ops( CHAR_PTR , CHAR_PTR );
+static INT16 create_target_dir( CHAR_PTR );
+static int comp( VOID_PTR, VOID_PTR );
+
+static INT16 GetBeforeAfterDates( CHAR_PTR sw_op1_ptr,
+ CHAR_PTR sw_op2_ptr,
+ DATE_TIME_PTR after_date_ptr,
+ DATE_TIME_PTR before_date_ptr );
+
+/*
+ Local data
+*/
+
+INT16 debug_error_no;
+
+/**/
+INT16 process_switch(
+
+ CDS_PTR *cfg , /* configuration stucture */
+ DLE_HAND dle_hand , /* Drive list handle */
+ BSD_HAND bsd_hand , /* BSD list */
+ CUR_DEF *cur_def ,
+ SW_TAB_PTR sw_tab , /* switch table */
+ INT16 n_switches , /* number of elements in sw_tab */
+ CHAR_PTR sw_name , /* switch label */
+ CHAR_PTR sw_op1 , /* 1st operand or NULL */
+ CHAR_PTR sw_op2 ) /* 2nd operand or NULL */
+{
+ SW_TAB_PTR sp;
+ DATE_TIME before_date;
+ DATE_TIME after_date;
+ INT16 status = SUCCESS;
+ INT16 itmp;
+ INT16 indx;
+// FILE *fp;
+ CUR_DEF_PTR temp_def;
+ BOOLEAN matched;
+ CHAR path_buf[ 80 ];
+ CHAR path_buf2[ 80 ];
+ INT16 psize;
+ CHAR_PTR fname;
+ BSD_PTR bsd;
+ GENERIC_DLE_PTR dle;
+ static UINT32 tpnum;
+ static UINT16 bsnum;
+ static UINT16 tpseq;
+
+ msassert( sw_tab != NULL );
+ msassert( sw_name != NULL );
+ msassert( cfg != NULL );
+
+ sp = sw_tab;
+
+ for ( itmp = 0; itmp < n_switches; itmp++ ) {
+
+ if ( !strncmp( sw_name, sp[itmp].sw_label, strlen( sw_name ) ) ) {
+
+ if( (INT16)strlen( sw_name ) >= sp[itmp].sw_min_len ) {
+
+ matched = TRUE;
+ break;
+ }
+ }
+ }
+
+ sp = (SW_TAB_PTR)(&sp[itmp]);
+
+ if ( matched != TRUE ) {
+
+ debug_error_no = 1;
+ return( SCR_INVALID_SWITCH );
+ }
+
+ if( sp->sw_num_ops == 0 ) {
+ if( !no_ops( sw_op1, sw_op2 ) ) {
+
+ debug_error_no = 3;
+ return( SCR_TOO_MANY_PARMS );
+
+ }
+ } else if( sp->sw_num_ops == 1 ) {
+ if( !one_op( sw_op2 ) ) {
+ debug_error_no = 4;
+ return( SCR_TOO_MANY_PARMS );
+ }
+ }
+
+ switch( sp->sw_action ) {
+
+ case SW_ERASE_TAPE:
+ CDS_SetEraseFlag( *cfg, ERASE_ON );
+
+ break;
+
+ case SW_FMARK:
+ CDS_SetEraseFlag( *cfg, ERASE_FMARK );
+
+ break;
+
+ case SW_LONG:
+ CDS_SetEraseFlag( *cfg, ERASE_LONG );
+ break;
+
+ case SW_3270:
+ /* Not needed in 3.0 per Dave Krinker */
+ break;
+
+ case SW_MINUS_A :
+ CDS_SetSetArchiveFlag( *cfg, (INT16)FALSE );
+ break;
+
+ case SW_TRANSFER :
+ CDS_SetTransferFlag( *cfg, TRUE );
+ break;
+
+ case SW_AUTO_VER :
+
+ if ( sw_op1 == NULL ) {
+ itmp = 1;
+ } else {
+ if ( !isdigit( sw_op1[0] ) ) {
+ debug_error_no = 30;
+ return( SCR_BAD_SWITCH_FLAG );
+ } else {
+ itmp = (INT16)atoi( sw_op1 );
+ }
+ }
+ CDS_SetAutoVerifyBackup( *cfg, itmp );
+ CDS_SetAutoVerifyRestore( *cfg, itmp );
+
+ break;
+
+ case SW_LIST :
+ if( sw_op1 != NULL ) {
+
+ psize = sizeof (path_buf);
+
+ status = FS_ParsePath( dle_hand, sw_op1, &dle, path_buf, &psize, &fname, &itmp );
+
+ if ( status == SUCCESS ) {
+
+ if ( ( psize == 1 ) && ( strchr( sw_op1, TEXT('\\') ) == NULL ) ) {
+ strcpy( path_buf2, fname );
+ } else {
+ status = FS_MakePath( path_buf2, (INT16)sizeof (path_buf2), dle, path_buf, psize, fname );
+ }
+ }
+
+
+ /**** Commented Out. Unused ****
+
+ if ( status == SUCCESS ) {
+
+ create_target_dir( path_buf2 );
+
+ CDS_SetLogFilePath( *cfg, path_buf2 );
+
+ } else {
+
+ debug_error_no = 6;
+ return( SCR_BAD_LIST_DIR );
+ }
+
+
+ if( (fp=UNI_fopen( CDS_GetLogFilePath( *cfg ), _O_TEXT|_O_APPEND )) == NULL ) {
+ debug_error_no = 6;
+ return( SCR_BAD_LIST_DIR );
+ } else {
+ fclose( fp );
+ }
+
+ ****/
+
+ }
+
+ CDS_SetOutputDest( *cfg, LOG_TO_FILE );
+ CDS_SetLogMode( *cfg, LOG_OVERWRITE );
+
+ if( ( sw_op2 != NULL ) && !strcmpi( sw_op2 , TEXT("a") ) ) { /* user gave append mode */
+ CDS_SetLogMode( *cfg, LOG_APPEND );
+
+ }
+
+ break;
+
+ case SW_LOG_LEVEL :
+ if( sw_op1 == NULL ) {
+
+ debug_error_no = 7;
+ return( SCR_BAD_LOG_LEVEL );
+
+ } else { /* get output level */
+
+ itmp = (INT16)atoi( sw_op1 );
+
+ if ( ( itmp > 0 ) && ( itmp <= 4 ) ) {
+ CDS_SetLogLevel( *cfg, itmp );
+ } else {
+ debug_error_no = 31;
+ return( SCR_BAD_SWITCH_FLAG );
+ }
+
+ }
+ break;
+
+ case SW_AFP :
+ if( sw_op1 == NULL ) {
+ debug_error_no = 9;
+ return( SCR_BAD_SWITCH_FLAG );
+ } else { /* get output level */
+
+ itmp = (INT16)atoi( sw_op1 );
+
+ if ( ( itmp >= 0 ) && ( itmp <= 2 ) ) {
+ CDS_SetAFPSupport( *cfg, itmp );
+ } else {
+ debug_error_no = 10;
+ return( SCR_BAD_SWITCH_FLAG );
+ }
+ }
+
+ case SW_NDATE:
+ if ( sw_op1 == NULL ) {
+ CDS_SetExtendedDateSupport( *cfg, (INT16)TRUE );
+ } else {
+
+ if ( isdigit( sw_op1[0] ) ) {
+ if ( atoi( sw_op1 ) ) {
+ CDS_SetExtendedDateSupport( *cfg, (INT16)TRUE );
+ } else {
+ CDS_SetExtendedDateSupport( *cfg, (INT16)FALSE );
+ }
+ } else {
+ debug_error_no = 32;
+ return( SCR_BAD_SWITCH_FLAG );
+ }
+ }
+
+ break;
+
+ case SW_MINUS_H :
+
+ CDS_SetHiddenFlag( *cfg, (INT16)FALSE );
+
+ break;
+
+ case SW_MINUS_S :
+
+ CDS_SetSpecialFlag( *cfg, (INT16)FALSE );
+
+ break;
+
+ case SW_APPEND :
+
+ // This case should be interpreted by the Windows product for tmenu
+ // compatibility; however, since jobs work differently, this switch
+ // should not be used.
+
+ // CDS_SetAppendFlag( *cfg, TRUE );
+
+ break;
+
+ case SW_ENTIRE :
+ CDS_SetYesFlag( *cfg, YES_FLAG );
+
+ status = tbbuild_def_drives( dle_hand, bsd_hand, TEXT("\0"), (INT16)1, TEXT("*.*"), *cfg, &cur_def );
+ if ( status != SUCCESS ) {
+ return( status );
+ }
+ break;
+
+ case SW_DATE :
+
+ if( ( status = GetBeforeAfterDates( sw_op1, sw_op2, &after_date,
+ &before_date ) ) != SUCCESS ) {
+ return( status );
+ }
+
+ for( temp_def = cur_def; (temp_def != NULL) && (status == SUCCESS);
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ temp_def->unused = FALSE;
+ status = FSE_SetModDate( temp_def->cur_fse, &after_date, &before_date );
+ }
+
+ }
+ break;
+
+ case SW_ACCESS_DATE:
+
+ if( sw_op1 != NULL ) {
+ /* default date to today */
+ GetCurrentDate( &before_date );
+
+ before_date.year -= 1900;
+
+ if( DU_CalcTargetDateBackwd( &before_date, (INT16)atoi( sw_op1 ) ) ) {
+
+ return SCR_INVALID_SWITCH;
+
+ }
+
+ before_date.year += 1900;
+ before_date.hour = 0;
+ before_date.minute = 0;
+ before_date.second = 0;
+
+ } else {
+
+ return SCR_INVALID_SWITCH;
+
+ }
+
+ for( temp_def = cur_def;
+ (temp_def != NULL) && (status == SUCCESS);
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+ temp_def->unused = FALSE;
+ status = FSE_SetAccDate( temp_def->cur_fse, &before_date );
+ }
+ }
+
+ if( status != SUCCESS ) {
+ debug_error_no = 13;
+ return( SCR_CANNOT_CREATE_FSE );
+ }
+ break;
+
+ case SW_EMPTY :
+ CDS_SetProcEmptyFlag( *cfg, (INT16)TRUE );
+ break;
+
+ case SW_FILES :
+ itmp = (INT16)( sw_name[0] != TEXT('-') );
+
+ CDS_SetFilesFlag( *cfg, itmp );
+
+ break;
+
+ case SW_DOS_IMAGE:
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ dle = BSD_GetDLE( temp_def->cur_bsd );
+
+ if( ( DLE_GetDeviceType( dle ) != LOCAL_DOS_DRV ) &&
+ ( DLE_GetDeviceType( dle ) != LOCAL_IMAGE ) ) {
+ debug_error_no = 14;
+ return( SCR_NO_IMAGE_FOR_DRIVE );
+
+ } else {
+
+ DLE_FindByName( dle_hand, DLE_GetDeviceName( dle ), LOCAL_IMAGE, &dle );
+ }
+
+ if ( dle == NULL ) {
+ debug_error_no = 15;
+ return( SCR_NO_IMAGE_FOR_DRIVE );
+
+ } else {
+ BSD_SetDLE( temp_def->cur_bsd, dle );
+ temp_def->unused = FALSE;
+
+ }
+ }
+ }
+ break;
+
+ case SW_B_INUSE :
+ CDS_SetBackupFilesInUse( *cfg, (INT16)TRUE );
+ break;
+
+ case SW_IOCHAN :
+ case SW_CSR :
+ case SW_IRQ:
+ /* do nothing */
+ break;
+
+ case SW_LABEL:
+ if( sw_op1 == NULL ) {
+ debug_error_no = 23;
+ return( SCR_BAD_SET_LABEL );
+ }
+
+ if ( sw_op1[0] == TEXT('?') ) {
+ // CDS_SetBackupSetDescriptor( *cfg, TRUE );
+
+ } else {
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ BSD_SetBackupDescript( temp_def->cur_bsd, (BYTE *)sw_op1,
+ (INT16) strsize( sw_op1 ) );
+ BSD_MarkBsetDescrNotChangable( temp_def->cur_bsd );
+ temp_def->unused = FALSE;
+ }
+ }
+ }
+
+
+ break;
+
+ case SW_TAPE_NAME:
+ if( sw_op1 == NULL ) {
+ debug_error_no = 23;
+ return( SCR_BAD_SET_LABEL );
+ }
+
+ if ( sw_op1[0] == TEXT('?') ) {
+ // CDS_SetPromptTapeName( *cfg, TRUE );
+
+ } else {
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ BSD_SetTapeLabel( temp_def->cur_bsd, (BYTE *)sw_op1,
+ (INT16)strsize( sw_op1 ) );
+ BSD_MarkTapeNameNotChangable( temp_def->cur_bsd );
+ }
+ }
+
+ bsd = BSD_GetFirst( bsd_hand );
+ while( bsd != NULL ) {
+ BSD_SetTapeLabel( bsd, (BYTE *)sw_op1,
+ (INT16)strsize( sw_op1 ) );
+ BSD_MarkTapeNameNotChangable( bsd );
+
+ bsd = BSD_GetNext( bsd );
+ }
+
+ }
+
+ break;
+
+ case SW_BACK_NAME:
+ if( sw_op1 == NULL ) {
+ debug_error_no = 23;
+ return( SCR_BAD_SET_LABEL );
+ }
+
+ if ( sw_op1[0] == TEXT('?') ) {
+ // CDS_SetPromptBackupSetName( *cfg, TRUE );
+
+ } else {
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ BSD_SetBackupLabel( temp_def->cur_bsd, (BYTE *)sw_op1,
+ (INT16)strsize( sw_op1 ) );
+ BSD_MarkBsetNameNotChangable( temp_def->cur_bsd );
+ temp_def->unused = FALSE;
+ }
+ }
+ }
+
+ break;
+
+ case SW_MODIFIED:
+
+ for( temp_def = cur_def; (temp_def != NULL) && (status == SUCCESS);
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ status = FSE_SetAttribInfo( temp_def->cur_fse, OBJ_MODIFIED_BIT, 0L );
+ temp_def->unused = FALSE;
+ }
+ }
+
+ if( status != SUCCESS ) {
+ debug_error_no = 25;
+ return( SCR_CANNOT_CREATE_FSE );
+ }
+
+ break;
+
+
+ case SW_TPNUM :
+
+ sscanf( sw_op1, TEXT("%lx"), &tpnum );
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ BSD_SetTapePos( temp_def->cur_bsd, tpnum, tpseq, bsnum );
+ BSD_SetFullyCataloged( temp_def->cur_bsd, TRUE );
+ }
+ }
+
+ break;
+ case SW_BSNUM :
+
+ sscanf( sw_op1, TEXT("%x"), &bsnum );
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ BSD_SetTapePos( temp_def->cur_bsd, tpnum, tpseq, bsnum );
+ BSD_SetFullyCataloged( temp_def->cur_bsd, TRUE );
+
+ }
+ }
+ break;
+
+ case SW_TPSEQ :
+
+ sscanf( sw_op1, TEXT("%x"), &tpseq );
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ BSD_SetTapePos( temp_def->cur_bsd, tpnum, tpseq, bsnum );
+ BSD_SetFullyCataloged( temp_def->cur_bsd, TRUE );
+ }
+ }
+
+ break;
+
+ case SW_SETNO:
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ BSD_SetTapePos( temp_def->cur_bsd, (UINT32)-1L, (UINT16)-1, (UINT16)( -atoi( sw_op1 ) ) );
+ }
+ }
+
+ break;
+
+ case SW_NONDOS:
+ /* does nothing */
+ break;
+
+ case SW_PASSWORD :
+ CDS_SetPasswordFlag( *cfg, TRUE );
+
+ break;
+
+ case SW_STDIN : /* read input from stdin, implies yes flag */
+
+ return( SCR_INVALID_SWITCH );
+ break;
+
+ case SW_SUBDIR:
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ FSE_SetIncSubFlag( temp_def->cur_fse, TRUE );
+ temp_def->unused = FALSE;
+ }
+ }
+
+ break;
+
+ case SW_EXCLUDE:
+
+ for( temp_def = cur_def; temp_def != NULL;
+ temp_def = temp_def->next_def ) {
+
+ if ( temp_def->cur_fse != NULL ) {
+
+ FSE_SetOperType( temp_def->cur_fse, EXCLUDE );
+ temp_def->unused = FALSE;
+ }
+ }
+
+ break;
+
+ case SW_YES:
+ if( !strcmp( sw_name, TEXT("YY") ) ) {
+ itmp = YESYES_FLAG;
+ } else {
+ itmp = YES_FLAG;
+ }
+
+ CDS_SetYesFlag( *cfg, itmp );
+
+ break;
+
+ case SW_P :
+ CDS_SetPromptFlag( *cfg, (INT16)TRUE );
+ break;
+
+ case SW_Q :
+ CDS_SetExistFlag( *cfg, (INT16)FALSE );
+ break;
+
+ case SW_WIDE :
+ // CDS_SetDirDisplayFlag( *cfg, CDS_GetDirDisplayFlag( *cfg ) | DIR_WIDE );
+ break;
+
+ case SW_PAUSE :
+ // CDS_SetDirDisplayFlag( *cfg, CDS_GetDirDisplayFlag( *cfg ) | DIR_PAGE );
+ break;
+
+ case SW_DEBUG:
+ if( sw_op1 == NULL ) {
+ itmp = (INT16)0xffff;
+ } else {
+ ( VOID ) sscanf( sw_op1, TEXT("%x"), &itmp );
+ }
+
+ CDS_SetDebugFlag( *cfg, itmp );
+
+ break;
+
+ case SW_NTAPE:
+ /* do nothing */
+/* if( sw_op1 == NULL ) { */
+/* debug_error_no = 28; */
+/* return( SCR_BAD_NUM_TAPE ); */
+/* } */
+/* */
+/* itmp = atoi( sw_op1 ); */
+/* */
+/* if( ( itmp >= 0 ) && ( itmp <= 2 ) ) { */
+/* CDS_SetNumTapeDrives( CDS_GetPerm(), itmp ); */
+/* CDS_SetNumTapeDrives( *cfg, itmp ); */
+/* } else { */
+/* debug_error_no = 29; */
+/* return( SCR_BAD_NUM_TAPE ); */
+/* } */
+ break;
+
+
+ default :
+ msassert( /* proc_sw: bad action */ FALSE );
+ break;
+ } /* end switch */
+ return( SUCCESS );
+
+ indx;
+
+} /* end process_switch */
+
+/**/
+static int comp(
+VOID_PTR s1,
+VOID_PTR s2 )
+{
+ return( strncmp( (LPSTR)s1, ((SW_TAB_PTR)s2)->sw_label, strlen( (LPSTR)s1 ) ) );
+}
+/**/
+/*
+ Check that a switch has no operands specified
+*/
+static INT16 no_ops(
+CHAR_PTR sw_op1,
+CHAR_PTR sw_op2 )
+{
+ if( ( sw_op1 != NULL ) || ( sw_op2 != NULL ) ) {
+ return( FALSE );
+ }
+ return( TRUE );
+}
+/**/
+/*
+ Check that a switch has only one operand specified
+*/
+static INT16 one_op(
+CHAR_PTR sw_op2 )
+{
+ if( sw_op2 != NULL ) {
+ return( FALSE );
+ }
+ return( TRUE );
+}
+/*****************************************************************************
+
+ Name: create_target_dir()
+
+ Description: This function creates a directory path on a DOS drive.
+ If the path is invalid then this function will create the valid
+ portion of the path and return an error.
+
+ Returns: SUCCESS if successful.
+
+*****************************************************************************/
+static INT16 create_target_dir(
+CHAR_PTR path )
+{
+ CHAR_PTR temp_ptr;
+ INT16 ret_val;
+
+ temp_ptr = strchr( path, TEXT('\\') );
+ while ( temp_ptr != NULL ) {
+
+ *temp_ptr = TEXT('\0');
+ ret_val = (INT16)mkdir( path );
+ *temp_ptr = TEXT('\\');
+
+ temp_ptr = strchr( temp_ptr + 1, TEXT('\\') );
+ }
+
+ return( ret_val );
+
+} /* end create_target_dir */
+
+/**/
+static INT16 GetBeforeAfterDates(
+ CHAR_PTR sw_op1_ptr,
+ CHAR_PTR sw_op2_ptr,
+ DATE_TIME_PTR after_date_ptr,
+ DATE_TIME_PTR before_date_ptr )
+{
+ UINT16 status;
+
+ if( ( sw_op1_ptr == NULL ) && ( sw_op2_ptr == NULL ) ) {
+ /* default before and after dates to today */
+ GetCurrentDate( before_date_ptr );
+ *after_date_ptr = *before_date_ptr;
+ } else { /* default after and before as in FSL */
+ after_date_ptr->date_valid = FALSE;
+ before_date_ptr->date_valid = FALSE;
+ }
+
+ /* try to convert what user gave, if anything */
+ if( sw_op1_ptr != NULL ) { /* after date value given */
+ status = tbdpars( sw_op1_ptr, after_date_ptr, DEFAULT_EARLY_MORNING );
+ if( status != 0 ) {
+ after_date_ptr->date_valid = FALSE;
+ debug_error_no = 11;
+ return( SCR_BAD_DATE );
+ }
+ }
+ if( sw_op2_ptr != NULL ) { /* before date value given */
+ status = tbdpars( sw_op2_ptr, before_date_ptr, DEFAULT_LATE_NIGHT );
+ if( status != 0 ) {
+ before_date_ptr->date_valid = FALSE;
+ debug_error_no = 12;
+ return( SCR_BAD_DATE );
+ }
+ }
+ return SUCCESS;
+}
+
+#ifdef MBS
+
+/**/
+static INT16 GetAccessDate(
+ CHAR_PTR sw_op1_ptr,
+ DATE_TIME_PTR access_date_ptr )
+{
+ UINT16 status;
+
+ if( sw_op1_ptr == NULL ) {
+ /* default access date to today */
+ GetCurrentDate( access_date_ptr );
+ } else { /* default access as in FSL */
+ access_date_ptr->date_valid = FALSE;
+ }
+
+ /* try to convert what user gave, if anything */
+ if( sw_op1_ptr != NULL ) { /* after date value given */
+ status = tbdpars( sw_op1_ptr, access_date_ptr );
+ if( status != 0 ) {
+ access_date_ptr->date_valid = FALSE;
+ debug_error_no = 11;
+ return( (INT16) SCR_BAD_DATE );
+ }
+ }
+ return SUCCESS;
+}
+
+#endif
diff --git a/private/utils/ntbackup/src/tbrparse.c b/private/utils/ntbackup/src/tbrparse.c
new file mode 100644
index 000000000..7db1b0f45
--- /dev/null
+++ b/private/utils/ntbackup/src/tbrparse.c
@@ -0,0 +1,882 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tbrparse.c
+
+ Description: This file contains code to parse a script file for
+ backup, restore, verify, or directory.
+
+ $Log: G:\UI\LOGFILES\TBRPARSE.C_V $
+
+ Rev 1.22 17 Jan 1994 16:18:20 MIKEP
+fix unicode warnings
+
+ Rev 1.21 26 Jul 1993 12:53:02 MARINA
+enable c++
+
+ Rev 1.20 21 Jul 1993 17:12:24 CARLS
+added bsd_ptr parameter to tbrparse function
+
+ Rev 1.19 01 Nov 1992 16:09:48 DAVEV
+Unicode changes
+
+ Rev 1.18 20 Oct 1992 10:13:50 GLENN
+Removed hardcoded APPLICATIONNAME from message boxes.
+
+ Rev 1.17 07 Oct 1992 14:17:32 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.16 04 Oct 1992 19:41:14 DAVEV
+Unicode Awk pass
+
+ Rev 1.15 17 Aug 1992 13:23:52 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.14 28 Jul 1992 15:05:04 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.13 08 Jul 1992 15:34:42 STEVEN
+Unicode BE changes
+
+ Rev 1.12 15 May 1992 13:32:04 MIKEP
+nt pass 2
+
+ Rev 1.11 23 Apr 1992 16:25:56 CHUCKB
+Cleaned up unused variables.
+
+ Rev 1.10 23 Apr 1992 16:22:04 CHUCKB
+Parser no longer removes unused BSD's.
+
+ Rev 1.9 14 Apr 1992 11:34:44 CHUCKB
+Fixed selection logging messages.
+
+ Rev 1.8 09 Apr 1992 14:51:16 CHUCKB
+Don't quit if a server is down.
+
+ Rev 1.7 23 Mar 1992 15:42:24 CHUCKB
+Fixed servers found warning.
+
+ Rev 1.6 16 Mar 1992 10:00:16 CHUCKB
+Fixed UAE if sel. file has net drives, but net shell not loaded.
+
+ Rev 1.5 25 Feb 1992 11:34:38 JOHNWT
+handle attach error and serv/map mode
+
+ Rev 1.4 13 Jan 1992 09:30:02 JOHNWT
+fixed includes
+
+ Rev 1.3 10 Jan 1992 16:47:36 DAVEV
+16/32 bit port-2nd pass
+
+ Rev 1.2 12 Dec 1991 11:04:36 JOHNWT
+removed unneeded pwdb calls
+
+ Rev 1.1 04 Dec 1991 15:22:24 MIKEP
+remoce pwxface.h
+
+ Rev 1.0 20 Nov 1991 19:24:30 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+INT16 gb_mode;
+
+extern struct SW_TAB_TYPE tbackup_switches[ ];
+extern struct SW_TAB_TYPE trestore_switches[ ];
+extern struct SW_TAB_TYPE tdir_switches[ ];
+extern struct SW_TAB_TYPE tverify_switches[ ];
+extern struct SW_TAB_TYPE tension_switches[ ];
+
+struct STATE_TAB_TYPE tbsyntab_state_table[ 10 ][ 5 ] = {
+ {
+ { TB_ERROR_EXIT, TB_EXPECT_INC1 /* Input: t_at_sign, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_EXPECT_INC2 /* Input: t_at_sign, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_at_sign, State: tb_expect_source */ },
+ { TB_DO_NOTHING, TB_EXPECT_INC1 /* Input: t_at_sign, State: tb_ready1 */ },
+ { TB_DO_NOTHING, TB_EXPECT_INC2 /* Input: t_at_sign, State: tb_ready2 */ }
+ },
+ {
+ { TB_ERROR_EXIT, TB_EXPECT_INC1 /* Input: t_bad_token, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_EXPECT_INC2 /* Input: t_bad_token, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_bad_token, State: tb_expect_source */ },
+ { TB_ERROR_EXIT, TB_READY1 /* Input: t_bad_token, State: tb_ready1 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_bad_token, State: tb_ready2 */ }
+ },
+ {
+ { TB_ERROR_EXIT, TB_EXPECT_INC1 /* Input: t_early_eof1, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_EXPECT_INC2 /* Input: t_early_eof1, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_early_eof1, State: tb_expect_source */ },
+ { TB_ERROR_EXIT, TB_READY1 /* Input: t_early_eof1, State: tb_ready1 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_early_eof1, State: tb_ready2 */ }
+ },
+ {
+ { TB_ERROR_EXIT, TB_EXPECT_INC1 /* Input: t_early_eof2, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_EXPECT_INC2 /* Input: t_early_eof2, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_early_eof2, State: tb_expect_source */ },
+ { TB_ERROR_EXIT, TB_READY1 /* Input: t_early_eof2, State: tb_ready1 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_early_eof2, State: tb_ready2 */ }
+ },
+ {
+ { TB_ERROR_EXIT, TB_EXPECT_INC1 /* Input: t_eof, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_EXPECT_INC2 /* Input: t_eof, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_eof, State: tb_expect_source */ },
+ { TB_NORMAL_RETURN, TB_READY1 /* Input: t_eof, State: tb_ready1 */ },
+ { TB_NORMAL_RETURN, TB_READY2 /* Input: t_eof, State: tb_ready2 */ }
+ },
+ {
+ { TB_ERROR_EXIT, TB_EXPECT_INC1 /* Input: t_equals, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_EXPECT_INC2 /* Input: t_equals, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_equals, State: tb_expect_source */ },
+ { TB_ERROR_EXIT, TB_READY1 /* Input: t_equals, State: tb_ready1 */ },
+ { TB_DO_NOTHING, TB_EXPECT_SOURCE /* Input: t_equals, State: tb_ready2 */ }
+ },
+ {
+ { TB_PROCESS_INCLUDE, TB_READY1 /* Input: t_filespec, State: tb_expect_inc1 */ },
+ { TB_PROCESS_INCLUDE, TB_READY2 /* Input: t_filespec, State: tb_expect_inc2 */ },
+ { TB_PROCESS_TARGET, TB_READY2 /* Input: t_filespec, State: tb_expect_source */ },
+ { TB_PROCESS_SOURCE, TB_READY1 /* Input: t_filespec, State: tb_ready1 */ },
+ { TB_PROCESS_SOURCE, TB_READY2 /* Input: t_filespec, State: tb_ready2 */ }
+ },
+ {
+ { TB_ERROR_EXIT, TB_READY1 /* Input: t_nondos, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_nondos, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_nondos, State: tb_expect_source */ },
+ { TB_PROCESS_NONDOS, TB_READY1 /* Input: t_nondos, State: tb_ready1 */ },
+ { TB_PROCESS_NONDOS, TB_READY2 /* Input: t_nondos, State: tb_ready2 */ }
+ },
+ {
+ { TB_PROCESS_SWITCH, TB_EXPECT_INC1 /* Input: t_switch, State: tb_expect_inc1 */ },
+ { TB_PROCESS_SWITCH, TB_EXPECT_INC2 /* Input: t_switch, State: tb_expect_inc2 */ },
+ { TB_PROCESS_SWITCH, TB_READY2 /* Input: t_switch, State: tb_expect_source */ },
+ { TB_PROCESS_SWITCH, TB_READY1 /* Input: t_switch, State: tb_ready1 */ },
+ { TB_PROCESS_SWITCH, TB_READY2 /* Input: t_switch, State: tb_ready2 */ }
+ },
+ {
+ { TB_ERROR_EXIT, TB_READY1 /* Input: t_token_too_long, State: tb_expect_inc1 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_token_too_long, State: tb_expect_inc2 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_token_too_long, State: tb_expect_source */ },
+ { TB_ERROR_EXIT, TB_READY1 /* Input: t_token_too_long, State: tb_ready1 */ },
+ { TB_ERROR_EXIT, TB_READY2 /* Input: t_token_too_long, State: tb_ready2 */ }
+ }
+};
+
+/*****************************************************************************
+
+ Name: tbrparse()
+
+ Description: This function sets up the parameters for a call to
+ tbparse()
+
+ Returns: error codes
+ listed in scriperr.h
+
+*****************************************************************************/
+INT tbrparse(
+CDS_PTR *cfg,
+DLE_HAND dle_hand,
+BSD_HAND bsd_hand,
+CHAR_PTR src_string,
+INT mode,
+BSD_PTR bsd_ptr )
+{
+ INT16 cmd_indx;
+ INT n_switches;
+ INT init_state;
+ INT err_code;
+ CDS_PTR copy_cfg;
+ SW_TAB_PTR sw_tab;
+
+ copy_cfg = *cfg;
+
+ gb_mode = mode;
+
+ DLE_UpdateList( dle_list, CDS_GetPermBEC() );
+
+ msassert( src_string != NULL );
+
+ /* reset globals and statics for each run */
+
+ cmd_indx = 0;
+
+ switch( mode ) {
+
+ case TARCHIVE :
+ case TBACKUP :
+ sw_tab = &( tbackup_switches[0] );
+ n_switches = GetNumBkuSwitches();
+ init_state = TB_READY1;
+ break;
+
+ case TENSION :
+ sw_tab = &( tension_switches[0] );
+ n_switches = GetNumTenSwitches();
+ init_state = TB_READY1;
+ break;
+
+ case TDIR :
+ sw_tab = &( tdir_switches[0] );
+ n_switches = GetNumDirSwitches();
+ init_state = TB_READY1;
+ break;
+
+ case TRESTORE :
+ sw_tab = &( trestore_switches[0] );
+ n_switches = GetNumRestSwitches();
+ init_state = TB_READY2;
+ break;
+
+ case TVERIFY :
+ sw_tab = &( tverify_switches[0] );
+ n_switches = GetNumVerSwitches();
+ init_state = TB_READY2;
+ break;
+
+ default :
+ msassert( /* tbrparse: bad mode */ FALSE );
+ break;
+ }
+ err_code = tbparse( &copy_cfg, dle_hand, bsd_hand, strgetc, strpushc, src_string, &cmd_indx,
+ sw_tab, n_switches, init_state, bsd_ptr );
+
+ if( err_code != 0 ) {
+ fcloseall( );
+
+ return( err_code );
+ }
+
+ return( 0 );
+
+} /* end tbrparse
+
+/*****************************************************************************
+
+ Name: tbparse()
+
+ Description: This function gets tokesns from the specified input
+ streem and calls other lower level parsers to process Switches
+ and Path names.
+
+ Returns: Error codes: see SCRIPERR.H
+
+ Notes: This function adds to the BSD list.
+
+*****************************************************************************/
+INT tbparse(
+CDS_PTR *cfg,
+DLE_HAND dle_hand, /* I - Head of DLE list needed to access drives */
+BSD_HAND bsd_hand, /* I - Head of BSD list needed to add BSDs */
+/* I - the following are functions used to read from the input streem */
+CHAR ( *inchar )( CHAR_PTR , INT16_PTR ),
+VOID ( *pushchar )( CHAR, CHAR_PTR , INT16_PTR ),
+CHAR_PTR src_ptr, /* I - pointer to input stream */
+INT16_PTR cmd_i, /* I - positon in input stream */
+SW_TAB_PTR sw_tab, /* I - table to use when parsing switches */
+INT n_switches, /* I - number of switches in above table */
+INT init_state, /* I - initial state for parsing */
+BSD_PTR bsd_ptr )
+{
+ INT16 err_code; /* error value to returned */
+ INT16 curr_line; /* line in this source file */
+ INT16 curr_col; /* column in this source file */
+ INT16 lex_state; /* old state of lexical fsm */
+ INT16 syn_old_state; /* old state of syntax fsm */
+ INT16 syn_state; /* new state for syntax fsm */
+ register INT16 syn_input; /* conditioned input for syntax fsm */
+ register INT16 syn_action; /* action to take */
+ INT16 status; /* TRUE if filename valid by tbppars */
+ FILE *fin; /* our input file */
+ INT16 dummy = 0; /* dummy string index for recursive calls */
+ TOKEN_PTR this_token = NULL; /* token built by lexical level */
+ BOOLEAN done = FALSE;
+ INT16 ret_val = SUCCESS;
+ FSYS_HAND fsh = NULL;
+ static CHAR tape_name[ 80 ] = { TEXT('\0') };
+ static CUR_DEF_PTR cur_def = NULL;
+ CUR_DEF_PTR temp_def;
+ CHAR curr_filename[ 13 ];
+ static CHAR_PTR last_fname_ptr = NULL;
+ CHAR_PTR temp_ptr;
+ GENERIC_DLE_PTR dle;
+ static CHAR path[ MAX_TOKEN_LEN ];
+ CHAR_PTR fname;
+ INT16 path_size;
+ BOOLEAN invalid_spec;
+ static INT16 nesting = 0;
+
+ curr_line = 1;
+ curr_col = 1;
+
+ lex_state = IN_WHITESPACE;
+
+ if( init_state != -1 ) {
+ syn_state = init_state;
+ }
+ syn_old_state = syn_state;
+ syn_input = 0;
+
+ msassert( syn_state >= 0 && syn_state <= TBSYNTAB_N_STATES );
+ msassert( inchar != NULL );
+ msassert( pushchar != NULL );
+
+ while( !done ) {
+
+ rlstok( &this_token );
+
+ this_token = nexttok( inchar, pushchar, &lex_state, &curr_line, &curr_col, src_ptr, cmd_i );
+
+ if( this_token == NULL ) {
+ eresprintf( (INT16) RES_OUT_OF_MEMORY );
+ ret_val = SCR_ERROR_PRINTED;
+ break;
+ }
+
+ syn_old_state = syn_state;
+ syn_input = this_token->tok_typ;
+
+ msassert( syn_input >= 0 && syn_input <= TBSYNTAB_N_INPUTS );
+ msassert( syn_old_state >= 0 && syn_old_state <= TBSYNTAB_N_STATES );
+
+ syn_action = tbsyntab_state_table[syn_input][syn_old_state].action;
+ syn_state = tbsyntab_state_table[syn_input][syn_old_state].next_state;
+
+ msassert( syn_state >= 0 && syn_state <= TBSYNTAB_N_STATES );
+
+ switch( syn_action ) {
+
+ case TB_DO_NOTHING :
+ break;
+
+ case TB_ERROR_EXIT :
+ if( nesting > 0 ) {
+ eresprintf( (INT16) RES_SCRIPT_SYNTAX_ERROR, this_token->src_line_no, last_fname_ptr );
+ ret_val = SCR_ERROR_PRINTED;
+ rlstok( &this_token );
+ done = TRUE;
+ } else {
+
+ eresprintf( (INT16) RES_COMMAND_SYNTAX_ERROR );
+ ret_val = SCR_ERROR_PRINTED;
+
+ rlstok( &this_token );
+ done = TRUE;
+ }
+ break;
+
+ case TB_NORMAL_RETURN :
+ rlstok( &this_token );
+ done = TRUE;
+ break;
+
+ case TB_PROCESS_INCLUDE :
+
+ // We're parsing a file; open it and get tokens out.
+
+ fin = UNI_fopen( this_token->tok_spelling, _O_TEXT|_O_RDONLY );
+ if( fin == NULL ) {
+
+ eresprintf( (INT16) RES_SCRIPT_OPEN_ERROR, this_token->tok_spelling );
+ ret_val = SCR_ERROR_PRINTED;
+ rlstok( &this_token );
+ done = TRUE;
+ } else {
+ nesting ++;
+ if( nesting > MAX_NESTING ) {
+ eresprintf( (INT16) RES_SCRIPT_NESTING_ERROR );
+ ret_val = SCR_ERROR_PRINTED;
+ rlstok( &this_token );
+ done = TRUE;
+ break;
+ }
+
+ temp_ptr = strrchr( this_token->tok_spelling, TEXT('\\') );
+ if( temp_ptr == NULL ) {
+ temp_ptr = strrchr( this_token->tok_spelling, TEXT(':') );
+ if( temp_ptr == NULL ) {
+ temp_ptr = this_token->tok_spelling;
+ }
+ else {
+ temp_ptr++;
+ }
+ }
+ else {
+ temp_ptr++;
+ }
+
+ curr_filename[ 0 ] = TEXT('\0');
+ strncpy( curr_filename, temp_ptr, 12 );
+ curr_filename[ 12 ] = TEXT('\0');
+
+ temp_ptr = last_fname_ptr;
+ last_fname_ptr = curr_filename;
+
+ err_code = tbparse( cfg, dle_hand, bsd_hand, filgetc, filpushc, ( CHAR_PTR )fin,
+ &dummy, sw_tab, n_switches, init_state, bsd_ptr );
+ if( err_code ) {
+ ret_val = err_code;
+ done = TRUE;
+ } else {
+ last_fname_ptr = temp_ptr;
+ }
+
+ fclose( fin );
+ nesting --;
+ }
+ break;
+
+ case TB_PROCESS_NONDOS : // work on a line or part of a line
+ case TB_PROCESS_SOURCE : // of a script file
+
+ for ( temp_def = cur_def; temp_def != NULL; ) {
+
+ if( temp_def->cur_fse != NULL ) {
+ if( temp_def->unused ) {
+ BSD_AddFSE( temp_def->cur_bsd, temp_def->cur_fse );
+ BSD_RemoveFSE( temp_def->cur_fse );
+ } else {
+ BSD_AddFSE( temp_def->cur_bsd, temp_def->cur_fse );
+ }
+
+ if( tape_name[0] != TEXT('\0') ) {
+ BSD_SetTapeLabel( temp_def->cur_bsd, (BYTE_PTR)tape_name,
+ (INT16) strsize( tape_name ) );
+ BSD_MarkTapeNameNotChangable( temp_def->cur_bsd );
+ }
+ }
+ cur_def = temp_def;
+ temp_def = temp_def->next_def;
+ free( cur_def );
+ }
+ cur_def = NULL;
+
+ invalid_spec = FALSE;
+
+ path_size = MAX_TOKEN_LEN;
+
+ status = FS_ParsePath( dle_hand, this_token->tok_spelling, &dle,
+ path, &path_size, &fname, &dummy );
+
+ // if we are about to attach/use a server and we are not in
+ // server/volume mode, skip it
+
+ if ( dle && ( ( status == FS_ATTACH_TO_PARENT ) ||
+ ( ( ( DLE_GetDeviceType ( dle ) == NOVELL_DRV ) ||
+ ( DLE_GetDeviceType ( dle ) == NOVELL_AFP_DRV ) ) &&
+ ( DLE_GetParent ( dle ) != NULL ) ) ) &&
+ ( !gfServers ) ) {
+
+ CHAR szAppName[50] ;
+ CHAR szError[255];
+
+ // If the user is watching, tell him what's going on
+
+ RSM_StringCopy( IDS_APPNAME, szAppName, sizeof ( szAppName ) ) ;
+ RSM_Sprintf( szError, ID(IDS_SERVERSFOUND), szAppName ) ;
+
+ WM_MsgBox ( ID( IDS_NETWORKERRORCAPTION ),
+ szError,
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+
+ // Log the error
+
+ lresprintf( (INT16) LOGGING_FILE, (INT16) LOG_START, FALSE );
+ lprintf( (INT16) LOGGING_FILE, szError );
+ lresprintf( (INT16) LOGGING_FILE, (INT16) LOG_END );
+
+ break;
+ }
+
+ if( status == FS_ATTACH_TO_PARENT ) {
+
+ err_code = UI_AttachDrive( &fsh, dle, FALSE );
+
+ if( err_code ) {
+ ret_val = err_code;
+ done = TRUE;
+ break;
+ }
+
+ path_size = MAX_TOKEN_LEN;
+ status = FS_ParsePath( dle_hand, this_token->tok_spelling, &dle,
+ path, &path_size, &fname, &dummy );
+ }
+
+ if( status == FS_DEFAULT_SPECIFIED ) {
+
+ status = tbbuild_def_drives( dle_hand, bsd_hand, path, path_size,
+ fname, *cfg, &cur_def );
+
+ if( status != SUCCESS ) {
+ ret_val = OUT_OF_MEMORY;
+ done = TRUE;
+ }
+ break;
+
+ } else if( status != SUCCESS ) {
+
+ CHAR szFormat [ MAX_UI_RESOURCE_SIZE ];
+ CHAR szErrMsg [ MAX_UI_RESOURCE_SIZE ];
+
+ // log the error;
+ // put a message on the screen IFF a user is there
+
+ RSM_StringCopy( RES_INVALID_SOURCE, szFormat, MAX_UI_RESOURCE_SIZE );
+ lresprintf( (INT16) LOGGING_FILE, (INT16) LOG_START, FALSE );
+ lprintf( (INT16) LOGGING_FILE, szFormat, this_token->tok_spelling );
+ lresprintf( (INT16) LOGGING_FILE, (INT16) LOG_END );
+
+ sprintf( szErrMsg, szFormat, this_token->tok_spelling );
+
+ WM_MsgBox( ID( IDS_MSGTITLE_ERROR ), szErrMsg,
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+
+ rlstok( &this_token );
+ invalid_spec = TRUE;
+
+ } else if( !DLE_DriveWriteable( dle ) && ( gb_mode == TARCHIVE ) ) {
+
+ eresprintf( (INT16) RES_REMOTE_DENIED_READ, DLE_GetDeviceName( dle ) );
+ ret_val = FAILURE;
+ rlstok( &this_token );
+ done = TRUE;
+
+ }
+
+ if( !done ) {
+
+ cur_def = (CUR_DEF_PTR)calloc( 1, sizeof( CUR_DEF ) );
+ if( cur_def == NULL ) {
+
+ ret_val = OUT_OF_MEMORY;
+ done = TRUE;
+
+ } else {
+
+ cur_def->unused = TRUE;
+
+ if( !invalid_spec ) {
+
+ /* if a bsd_ptr was passed in, use it */
+ if( bsd_ptr ) {
+ cur_def->cur_bsd = bsd_ptr ;
+ } else {
+ cur_def->cur_bsd = BSD_FindByDLE( bsd_hand, dle );
+ }
+
+ if( cur_def->cur_bsd == NULL ) {
+
+ status = BSD_Add( bsd_hand, &(cur_def->cur_bsd), BEC_CloneConfig( CDS_GetPermBEC()),
+ NULL, dle, (UINT32) -1L, (UINT16) -1, (INT16) -1, thw_list, NULL );
+ }
+
+ cur_def->unused = FALSE;
+
+ if( status == SUCCESS ) {
+ status = BSD_CreatFSE( &(cur_def->cur_fse), (INT16) INCLUDE, (BYTE_PTR)path, path_size,
+ (BYTE_PTR)fname, (INT16) strsize( fname ),
+ (BOOLEAN) USE_WILD_CARD, (BOOLEAN) FALSE );
+ }
+
+ if( status != SUCCESS ) {
+ eresprintf( (INT16) RES_OUT_OF_MEMORY );
+ ret_val = SCR_ERROR_PRINTED;
+ rlstok( &this_token );
+
+ done = TRUE;
+ }
+ }
+ }
+ } /* endif parsed OK */
+
+ break;
+
+ case TB_PROCESS_TARGET :
+
+ msassert( cur_def != NULL );
+
+ if( cur_def->cur_fse != NULL ) {
+
+ path_size = MAX_TOKEN_LEN;
+ status = FS_ParsePath( dle_hand, this_token->tok_spelling, &dle,
+ path, &path_size, &fname, &dummy );
+
+ if( status == FS_ATTACH_TO_PARENT ) {
+
+ err_code = UI_AttachDrive( &fsh, dle, FALSE );
+
+ if( err_code ) {
+ ret_val = err_code;
+ done = TRUE;
+ break;
+ }
+
+ path_size = MAX_TOKEN_LEN;
+ status = FS_ParsePath( dle_hand, this_token->tok_spelling, &dle,
+ path, &path_size, &fname, &dummy );
+ }
+
+ if( status == FS_DEFAULT_SPECIFIED ) {
+ status = tbbuild_def_drives( dle_hand, bsd_hand, path, path_size,
+ fname, *cfg, &cur_def );
+
+ if( status != SUCCESS ) {
+ ret_val = OUT_OF_MEMORY;
+ done = TRUE;
+ }
+ break;
+
+ } else if( status != SUCCESS ) {
+ eresprintf( (INT16) RES_INVALID_TARGET, this_token->tok_spelling );
+ ret_val = SCR_ERROR_PRINTED;
+ rlstok( &this_token );
+ invalid_spec = TRUE;
+ done = TRUE;
+
+ } else if( !DLE_DriveWriteable( dle ) && ( gb_mode == TRESTORE ) ) {
+
+ eresprintf( (INT16) RES_REMOTE_DENIED_READ, DLE_GetDeviceName( dle ) );
+ rlstok( &this_token );
+ done = TRUE;
+ invalid_spec = TRUE;
+ }
+
+ if( (status == SUCCESS) && !done ) {
+ if( strcmp( fname, (CHAR_PTR)FSE_GetFname( cur_def->cur_fse ) ) ) { /* fname mismatch */
+ if( fname[0] != TEXT('\0') ) { /* because user gave filename */
+
+ eresprintf( (INT16) RES_FILE_RENAME_ERROR, FSE_GetFname( cur_def->cur_fse ), fname );
+ ret_val = SCR_ERROR_PRINTED;
+ rlstok( &this_token );
+ done = TRUE;
+ break;
+ }
+ }
+
+ msassert( cur_def != NULL );
+
+ if( status != SUCCESS ) {
+
+ eresprintf( (INT16) RES_OUT_OF_MEMORY );
+ ret_val = SCR_ERROR_PRINTED;
+ done = TRUE;
+ break;
+ }
+ }
+ }
+ break;
+
+ case TB_PROCESS_SWITCH :
+
+ status = SUCCESS;
+
+ if( ( cur_def != NULL ) &&
+ ( !cur_def->unused ) ) {
+
+ status = process_switch( cfg, dle_hand, bsd_hand, cur_def, sw_tab, (INT16) n_switches,
+ this_token->tok_spelling, this_token->op_ptrs[0], this_token->op_ptrs[1] );
+ if( status != 0 ) {
+
+ eresprintf( (INT16) RES_INVALID_PARAMETER,this_token->tok_spelling );
+ ret_val = SCR_ERROR_PRINTED;
+ rlstok( &this_token );
+ done = TRUE;
+
+ } else {
+ if( BSD_IsTapeNameChangable( cur_def->cur_bsd ) == FALSE ) {
+ strncpy( tape_name, (CHAR_PTR)BSD_GetTapeLabel( cur_def->cur_bsd ), 79 );
+ tape_name[ 79 ] = TEXT('\0');
+ }
+ }
+ }
+ break;
+
+ default :
+ msassert( /* parse: invalid action */ FALSE );
+ break;
+ } /* end switch */
+
+ if( fsh != NULL ) {
+ FS_DetachDLE( fsh );
+ fsh = NULL;
+
+ /* Add code to logout of Dynamically Logged-in Servers */
+
+ if ( DLE_GetDeviceType( dle ) == NOVELL_SERVER_ONLY ) {
+ if ( DLE_ServerLoggedIn( dle ) == DYNAMIC_LOGIN ) {
+ DLE_LogoutDevice( dle );
+ }
+ }
+ }
+
+
+ } /* end while */
+
+ /* flush all switch BSDs */
+
+ if( nesting == 0 ) {
+ for( temp_def = cur_def; temp_def != NULL; ) {
+
+ if( temp_def->cur_fse != NULL ) {
+ BSD_AddFSE( temp_def->cur_bsd, temp_def->cur_fse );
+
+ if( tape_name[0] != TEXT('\0') ) {
+ BSD_SetTapeLabel( temp_def->cur_bsd, (BYTE *)tape_name,
+ (INT16) strsize( tape_name ) );
+ BSD_MarkTapeNameNotChangable( temp_def->cur_bsd );
+ }
+ }
+
+ cur_def = temp_def;
+ temp_def = temp_def->next_def;
+ free( cur_def );
+ }
+ cur_def = NULL;
+ tape_name[ 0 ] = TEXT('\0');
+ }
+
+ return( ret_val );
+
+} /* end tbparse */
+
+/**/
+/*
+ Carefully dispose of a token and its operands
+*/
+VOID rlstok(
+TOKEN_PTR *tok_ptr )
+{
+ if( *tok_ptr != NULL )
+ {
+ rlsmem( &( ( *tok_ptr )->op_ptrs[ 0 ] ) );
+ rlsmem( &( ( *tok_ptr )->op_ptrs[ 1 ] ) );
+ rlsmem( ( CHAR_PTR * ) tok_ptr );
+ }
+ return;
+
+} /* end rlstok */
+
+/*
+ Carefully free memory
+*/
+VOID rlsmem(
+CHAR_PTR *mem_ptr )
+{
+ if( *mem_ptr != NULL )
+ {
+ free( *mem_ptr );
+ *mem_ptr = NULL;
+ }
+ return;
+
+} /* end rlsmem */
+
+/*****************************************************************************
+
+ Name: tbbuild_def_drives()
+
+ Description: This routine checks to see which drives are marked as
+ default drives for backing up. For those drives we then create
+ the "*.*" /s FSL to the drive element.
+
+ Returns: error codes or SUCCESS
+
+*****************************************************************************/
+/* begin declaration */
+INT16 tbbuild_def_drives(
+DLE_HAND dle_hand,
+BSD_HAND bsd_hand,
+CHAR_PTR path,
+INT16 path_size,
+CHAR_PTR fspec,
+CDS_PTR cfg,
+CUR_DEF_PTR *cur_def )
+/* $end$ declaration */
+{
+ GENERIC_DLE_PTR dle = NULL;
+ CHAR device_name[ 20 ];
+ INT16 dev_number = 0;
+ CUR_DEF_PTR temp_def = NULL;
+ CUR_DEF_PTR prev_def = NULL;
+ INT16 status;
+ BOOLEAN done = FALSE;
+ CHAR_PTR cds_dev_name;
+ BOOLEAN bsd_created = FALSE;
+
+ if( *cur_def != NULL ) {
+ prev_def = *cur_def;
+ while( prev_def->next_def != NULL ) {
+ prev_def = prev_def->next_def;
+ }
+ }
+
+ while( !done ) {
+
+ cds_dev_name = CDS_GetDefaultDrive( cfg, dev_number++ );
+
+ if( cds_dev_name != NULL ) {
+
+ strcpy( device_name, cds_dev_name );
+ strcat( device_name, TEXT(":") );
+ if( !strcmp( device_name, TEXT(":") ) ) {
+ done = TRUE;
+ break;
+ }
+ DLE_FindByName( dle_hand, device_name, (INT16) -1, &dle );
+
+ } else {
+ if( !bsd_created ) {
+ dle = DLE_GetDefaultDrive( dle_hand );
+ } else {
+ break;
+ }
+ }
+
+ if( dle != NULL ) {
+
+ bsd_created = TRUE;
+
+ temp_def = ( CUR_DEF_PTR )calloc( 1, sizeof( CUR_DEF ) );
+ if( temp_def == NULL ) {
+ return( OUT_OF_MEMORY );
+ }
+
+ temp_def->unused = FALSE;
+
+ temp_def->cur_bsd = BSD_FindByDLE( bsd_hand, dle );
+
+ if( temp_def->cur_bsd == NULL ) {
+
+ if( cfg == NULL ) {
+
+ return( OUT_OF_MEMORY );
+
+ }
+
+ status = BSD_Add( bsd_hand, &(temp_def->cur_bsd), BEC_CloneConfig( CDS_GetPermBEC()),
+ NULL, dle, (UINT32) -1L, (UINT16) -1, (INT16) -1, thw_list, NULL );
+ }
+
+ if( status == SUCCESS ) {
+ status = BSD_CreatFSE( &( temp_def->cur_fse ), (INT16) INCLUDE, (BYTE_PTR)path,
+ path_size, (BYTE_PTR)fspec, (UINT16)strsize(fspec),
+ (BOOLEAN) USE_WILD_CARD, (BOOLEAN) TRUE );
+ }
+
+ if( *cur_def == NULL ) {
+ *cur_def = temp_def;
+ prev_def = temp_def;
+ } else {
+ prev_def->next_def = temp_def;
+ prev_def = temp_def;
+ }
+ }
+ }
+
+ return SUCCESS;
+
+}
diff --git a/private/utils/ntbackup/src/tchgdir.c b/private/utils/ntbackup/src/tchgdir.c
new file mode 100644
index 000000000..ef7bf0b99
--- /dev/null
+++ b/private/utils/ntbackup/src/tchgdir.c
@@ -0,0 +1,213 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tchgdir.c
+
+ Description: This file contains code to Change the current directory.
+
+ $Log: M:/LOGFILES/TCHGDIR.C_V $
+
+ Rev 1.13 24 Nov 1993 14:46:40 BARRY
+Unicode fixes
+
+ Rev 1.12 19 Feb 1993 09:21:42 STEVEN
+fix some bugs
+
+ Rev 1.11 11 Nov 1992 10:10:50 GREGG
+Unicodeized literals.
+
+ Rev 1.10 10 Nov 1992 08:19:44 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.9 06 Oct 1992 13:25:24 DAVEV
+Unicode strlen verification
+
+ Rev 1.8 24 Sep 1992 13:42:16 BARRY
+Changes for huge file name support.
+
+ Rev 1.7 17 Aug 1992 15:39:24 STEVEN
+fix warnings
+
+ Rev 1.6 09 Jun 1992 15:05:14 BURT
+Sync up with NT stuff
+
+ Rev 1.4 21 May 1992 13:50:52 STEVEN
+more long path stuff
+
+ Rev 1.3 04 May 1992 09:32:58 LORIB
+Changes for variable length paths.
+
+ Rev 1.2 28 Feb 1992 13:03:30 STEVEN
+step one for varible length paths
+
+ Rev 1.1 13 Feb 1992 11:29:14 STEVEN
+fix DOS-> NTFS
+
+ Rev 1.0 17 Jan 1992 17:50:04 STEVEN
+Initial revision.
+
+**/
+/* begin include list */
+#include <windows.h>
+#include <malloc.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "msassert.h"
+/* $end$ include list */
+/**/
+/**
+
+ Name: NTFS_ChangeDir()
+
+ Description: This function changes directories into the directory
+ pointed to by path.
+
+ Modified: 1/10/1992 12:45:35
+
+ Returns: Error codes:
+ SUCCESS
+ OUT_OF_MEMORY
+
+ Notes:
+
+**/
+INT16 NTFS_ChangeDir(
+FSYS_HAND fsh, /* I - file system to changing directories on */
+CHAR_PTR path, /* I - describes the path of the new directory */
+INT16 psize ) /* I - specifies the length of the path */
+{
+ INT16 ret_val = SUCCESS;
+ CHAR_PTR new_path ;
+ NTFS_FSYS_RESERVED_PTR nt_fsh ;
+ int i, cch ;
+
+ msassert( fsh->attached_dle !=NULL ) ;
+
+ nt_fsh = (NTFS_FSYS_RESERVED_PTR)( fsh->reserved.ptr ) ;
+ while( nt_fsh->work_buf_in_use )
+ ; /* wait on semaphore */
+
+ nt_fsh->work_buf_in_use = sizeof (CHAR) ;
+
+ if ( nt_fsh->work_buf_size < (UINT16)psize + 10 ) {
+
+ //??UNICODE?? should the following be psize + 100*sizeof (CHAR)??
+
+ nt_fsh->work_buf_size = (UINT16)(psize + 100) ;
+ nt_fsh->work_buf = realloc( nt_fsh->work_buf, nt_fsh->work_buf_size ) ;
+ }
+
+ if ( nt_fsh->work_buf != NULL ) {
+ new_path = nt_fsh->work_buf ;
+ } else {
+ // Probably want to release the semaphore.
+ nt_fsh->work_buf_in_use = 0 ;
+ return OUT_OF_MEMORY ;
+ }
+ /* copy path replacing '\0' with '\\' (don't put backslash at end) */
+
+ new_path[0] = TEXT('\\');
+ for ( i = 0, cch = psize / sizeof (CHAR) - 1; i< cch; i++ ) {
+
+ if ( path[i] == TEXT('\0') ) {
+ new_path[i+1] = TEXT('\\') ;
+ } else {
+ new_path[i+1] = path[i] ;
+ }
+ }
+
+ new_path[i+1] = TEXT('\0');
+ ret_val = FS_SavePath( fsh, (UINT8_PTR)new_path, (INT16)(psize + sizeof( CHAR ) ) );
+ nt_fsh->work_buf_in_use = 0 ;
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: NTFS_UpDir()
+
+ Description: This function removes the last directory name from the
+ current directory path field of the "fsh"
+
+
+ Modified: 1/10/1992 12:47:23
+
+ Returns: Error codes:
+ FS_AT_ROOT
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 NTFS_UpDir( fsh )
+FSYS_HAND fsh ; /* I - file system to change directories in */
+{
+ GENERIC_DLE_PTR dle ;
+ INT16 ret_val=SUCCESS;
+ CHAR_PTR p ;
+
+ msassert( fsh != NULL );
+ msassert( fsh->cur_dir != NULL );
+
+ dle = fsh->attached_dle ;
+ msassert( dle != NULL ) ;
+
+ p = strrchr( fsh->cur_dir, TEXT('\\') ) ;
+
+ if ( fsh->cur_dir[1] == TEXT('\0') ) {
+ ret_val = FS_AT_ROOT ; /* example \ */
+
+ } else if ( p == fsh->cur_dir ) {
+ *(p+1) = TEXT('\0') ; /* example \FRED */
+ } else {
+ *p = TEXT('\0') ; /* example \FRED\SUE */
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: NTFS_ChangeIntoDDB()
+
+ Description: This function changes into the directory specified in the
+ DBLK
+
+ Modified: 1/10/1992 12:48:54
+
+ Returns: OUT_OF_MEMORY
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 NTFS_ChangeIntoDDB( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* I - contains directory path to change into */
+{
+ NTFS_DBLK_PTR ddblk;
+ INT16 ret_val ;
+
+ msassert( fsh->attached_dle != NULL );
+ msassert( dblk->blk_type == DDB_ID ) ;
+
+ ddblk = (NTFS_DBLK_PTR)dblk ;
+
+ ret_val = FS_SavePath( fsh, (UINT8_PTR)TEXT("\\"), 2*sizeof (CHAR) );
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FS_AppendPath( fsh,
+ (UINT8_PTR)ddblk->full_name_ptr->name,
+ (INT16)(strsize( ddblk->full_name_ptr->name ) ) ) ;
+ }
+
+ return ret_val ;
+}
diff --git a/private/utils/ntbackup/src/tclose.c b/private/utils/ntbackup/src/tclose.c
new file mode 100644
index 000000000..b289922c4
--- /dev/null
+++ b/private/utils/ntbackup/src/tclose.c
@@ -0,0 +1,569 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tclose.c
+
+ Description: This file closes an opened object.
+
+
+ $Log: N:/LOGFILES/TCLOSE.C_V $
+
+ Rev 1.29.1.1 01 Jul 1994 17:40:02 STEVEN
+dont set modify tiem on verify
+
+ Rev 1.29.1.0 15 Mar 1994 22:48:40 STEVEN
+fix registry bugs
+
+ Rev 1.29 28 Jan 1994 20:58:00 BARRY
+fix MoveFileEx() does not support mac syntax
+
+ Rev 1.28 03 Jan 1994 18:44:28 BARRY
+Reset dates/times on all operations, not just restore
+
+ Rev 1.27 26 Jul 1993 17:04:34 STEVEN
+fixe restore active file with registry
+
+ Rev 1.26 29 Jun 1993 20:17:14 BARRY
+Upon registry restore, return FS_RESTORED_ACTIVE
+
+ Rev 1.25 29 Jun 1993 20:15:28 BARRY
+Don't destroy ret_val with FS_RESTORED_ACTIVE
+
+ Rev 1.24 02 Jun 1993 14:41:56 BARRY
+Link fixes
+
+ Rev 1.23 13 May 1993 13:32:42 BARRY
+Return FS_RESTORED_ACTIVE when we overwrite an active file.
+
+ Rev 1.22 24 Feb 1993 15:37:06 BARRY
+Fixed restore of active files when write errors occur.
+
+ Rev 1.21 19 Feb 1993 13:36:30 BARRY
+Fixed restoration of attributes and clear of modified bit for dirs.
+
+ Rev 1.20 15 Jan 1993 13:18:42 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.19 25 Nov 1992 16:42:20 BARRY
+Fix MakeTempFile and restore over active files.
+
+ Rev 1.18 17 Nov 1992 22:17:32 DAVEV
+unicode fixes
+
+ Rev 1.17 17 Nov 1992 16:13:10 BARRY
+Fixes for linked files.
+
+ Rev 1.16 11 Nov 1992 09:54:16 GREGG
+Unicodeized literals.
+
+ Rev 1.15 10 Nov 1992 08:19:50 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.14 21 Oct 1992 19:42:00 BARRY
+Upon close, we enqueue information about linked files.
+
+ Rev 1.13 20 Oct 1992 14:22:30 STEVEN
+temp names should not have .TMP extension
+
+ Rev 1.11 07 Oct 1992 14:23:14 STEVEN
+added CloseDir function
+
+ Rev 1.10 21 Sep 1992 13:50:40 BARRY
+Turn off archive bit when backing up directories.
+
+ Rev 1.9 12 Aug 1992 17:48:08 STEVEN
+fixed bugs at microsoft
+
+ Rev 1.8 25 Jun 1992 11:27:14 STEVEN
+logical instead of bitwize NOT for clearing attribute
+
+ Rev 1.7 09 Jun 1992 15:35:32 BURT
+Sync with NT stuff
+
+ Rev 1.6 27 May 1992 18:50:28 STEVEN
+registry api is not implemented
+
+ Rev 1.5 22 May 1992 16:05:54 STEVEN
+
+
+ Rev 1.4 21 May 1992 13:51:04 STEVEN
+more long path stuff
+
+ Rev 1.3 04 May 1992 09:26:52 LORIB
+Fixes for structure member names.
+
+ Rev 1.2 28 Feb 1992 13:03:38 STEVEN
+step one for varible length paths
+
+ Rev 1.1 12 Feb 1992 10:44:38 STEVEN
+remove warning
+
+ Rev 1.0 07 Feb 1992 16:41:14 STEVEN
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <windows.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdio.h"
+#include "std_err.h"
+#include "beconfig.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+
+static INT16 NTFS_CloseFile( FILE_HAND hand ) ;
+static INT16 NTFS_CloseDir( FILE_HAND hand ) ;
+
+/**/
+
+/**
+
+ Name: NTFS_CloseObj()
+
+ Description: This funciton closes an object.
+
+ Modified: 2/7/1992 10:55:12
+
+ Returns: Error Codes:
+ FS_OBJECT_NOT_OPENED
+ SUCCESS
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 NTFS_CloseObj( hand )
+FILE_HAND hand ; /* I - handle of object to close */
+{
+ INT16 ret_val = SUCCESS;
+ NTFS_DBLK_PTR ddblk ;
+ FSYS_HAND fsh ;
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+
+ fsh = hand->fsh ;
+
+ ddblk = (NTFS_DBLK_PTR)(hand->dblk) ;
+
+ switch (hand->dblk->blk_type) {
+
+ case FDB_ID:
+
+ ret_val = NTFS_CloseFile( hand ) ;
+
+ break ;
+
+ case DDB_ID:
+ ret_val = NTFS_CloseDir( hand ) ;
+
+ break ;
+
+ case VCB_ID :
+ break ;
+
+ default:
+ ret_val = FS_OBJECT_NOT_OPENED;
+ }
+
+ /*
+ * Here we want to be sure that if we should have seen an ACL for
+ * this object, we report an error if there was no security present.
+ */
+ if ( (hand->dblk->blk_type == FDB_ID) || (hand->dblk->blk_type == DDB_ID) )
+ {
+ if ( (ret_val == SUCCESS) &&
+ (nt_hand->sawSecurity == FALSE) &&
+ (strcmp( hand->fsh->attached_dle->info.ntfs->fs_name,
+ TEXT("NTFS")) == 0) ) {
+
+ ret_val = FS_NO_SECURITY;
+ }
+ }
+
+ if( hand->fsh->file_hand == hand ) {
+ hand->fsh->hand_in_use = FALSE ;
+ memset( hand, 0, sizeof( FILE_HAND_STRUCT ) ) ;
+ } else {
+ free( hand ) ;
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: NTFS_CloseFile()
+
+ Description: This function closes an opened file.
+
+ Modified: 2/7/1992 10:55:48
+
+ Returns: Error codes
+ FS_OBJECT_NOT_OPENED
+ SUCCESS
+
+**/
+static INT16 NTFS_CloseFile( hand )
+FILE_HAND hand ; /* I - handle to be closed */
+{
+ NTFS_OBJ_HAND_PTR nt_hand ;
+ CHAR_PTR path;
+ CHAR_PTR old_reg_name ;
+ NTFS_DBLK_PTR ddblk ;
+ INT16 ret_val = SUCCESS ;
+ FSYS_HAND fsh ;
+ DWORD attrib ;
+ LOCAL_NTFS_DRV_DLE_INFO_PTR ntfs_inf = hand->fsh->attached_dle->info.ntfs ;
+ CHAR_PTR logfile ;
+
+ fsh = hand->fsh ;
+
+ ddblk = (NTFS_DBLK_PTR)(hand->dblk) ;
+
+ nt_hand = (NTFS_OBJ_HAND_PTR)( hand->obj_hand.ptr ) ;
+
+ if ( ddblk->b.f.linkOnly )
+ {
+ if ( hand->mode == FS_WRITE )
+ {
+ ret_val = NTFS_LinkFileToFDB( hand );
+ }
+ else
+ {
+ CloseHandle( nt_hand->fhand );
+ ret_val = SUCCESS;
+ }
+ free( nt_hand->linkBuffer );
+ nt_hand->linkBuffer = NULL;
+ nt_hand->linkBufferSize = 0;
+ nt_hand->linkNameLen = 0;
+
+ return ret_val;
+ }
+
+ if ( nt_hand->context != NULL ) {
+ BackupRead( nt_hand->fhand,
+ NULL,
+ 0,
+ NULL,
+ TRUE,
+ FALSE,
+ &nt_hand->context ) ;
+ }
+
+ if ( hand->mode == FS_WRITE ) {
+ SetFileTime( nt_hand->fhand,
+ &(ddblk->dta.create_time),
+ &(ddblk->dta.access_time),
+ &(ddblk->dta.modify_time) ) ;
+
+ } else {
+ if ( fsh->attached_dle->feature_bits & DLE_FEAT_ACCESS_DATE ) {
+
+ SetFileTime( nt_hand->fhand,
+ NULL,
+ &(ddblk->dta.access_time),
+ NULL ) ;
+ }
+ }
+ if( !CloseHandle( nt_hand->fhand ) ) {
+ ret_val = FS_OBJECT_NOT_OPENED ;
+ }
+
+ if ( nt_hand->temp_file != NULL ) {
+
+ if ( hand->mode != FS_WRITE ) {
+
+ DeleteFile( nt_hand->temp_file ) ;
+
+ } else {
+
+ if ( NTFS_SetupWorkPath( fsh,
+ fsh->cur_dir,
+ ddblk->full_name_ptr->name,
+ &path ) == SUCCESS) {
+
+ /* if its the SYSTEM file save path for later processing */
+
+ if ( nt_hand->registry_file &&
+ !stricmp( ddblk->full_name_ptr->name, TEXT("SYSTEM") ) ) {
+
+ if ( ntfs_inf->LastSysRegPath != NULL ) {
+ free( ntfs_inf->LastSysRegPath ) ;
+ free( ntfs_inf->LastSysRegPathNew ) ;
+
+ }
+
+ ntfs_inf->LastSysRegPath =
+ malloc( strsize( path ) ) ;
+
+ if ( ntfs_inf->LastSysRegPath ) {
+
+ strcpy( ntfs_inf->LastSysRegPath, path ) ;
+ } else {
+
+ return OUT_OF_MEMORY ;
+ }
+
+
+ ntfs_inf->LastSysRegPathNew =
+ malloc( strsize( nt_hand->temp_file ) ) ;
+
+ if ( ntfs_inf->LastSysRegPathNew ) {
+
+ strcpy( ntfs_inf->LastSysRegPathNew,
+ nt_hand->temp_file ) ;
+ } else {
+
+ free( ntfs_inf->LastSysRegPath ) ;
+ return OUT_OF_MEMORY ;
+ }
+
+
+ ret_val = FS_RESTORED_ACTIVE;
+
+ } else if ( nt_hand->registry_file ) {
+
+ old_reg_name = NTFS_MakeTempName( path, TEXT("REG") ) ;
+
+ if ( old_reg_name != NULL ) {
+
+ NTFS_SaveTempName( path, old_reg_name) ;
+
+ ret_val = REG_RestoreRegistryFile( hand->fsh->attached_dle,
+ path,
+ nt_hand->temp_file,
+ old_reg_name ) ;
+
+ if ( fsh->attached_dle->info.ntfs->mac_name_syntax ) {
+ MoveFileEx( old_reg_name+4, /* Existing file */
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ } else {
+ MoveFileEx( old_reg_name, /* Existing file */
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ }
+
+ free( old_reg_name ) ;
+
+ logfile = malloc( strsize( nt_hand->temp_file) + strsize( TEXT(".LOG" ) ) ) ;
+ if ( logfile != NULL ) {
+
+ strcpy( logfile, nt_hand->temp_file ) ;
+ strcat( logfile, TEXT(".LOG" ) ) ;
+
+ if ( fsh->attached_dle->info.ntfs->mac_name_syntax ) {
+ MoveFileEx( logfile+4,
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ } else {
+ MoveFileEx( logfile,
+ NULL, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ }
+
+ free( logfile ) ;
+ }
+
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = FS_RESTORED_ACTIVE;
+ } else {
+ ret_val = FS_ACCESS_DENIED ;
+ }
+ } else {
+ ret_val = OUT_OF_MEMORY ;
+
+ }
+
+ } else {
+
+ if ( nt_hand->writeError == TRUE ) {
+
+ /*
+ * We had a problem writing to the temp file,
+ * so let's not replace the original with
+ * trash (or an empty file).
+ */
+ DeleteFile( nt_hand->temp_file ) ;
+ ret_val = FS_ACCESS_DENIED;
+
+ } else {
+
+ BOOLEAN stat;
+
+ if ( fsh->attached_dle->info.ntfs->mac_name_syntax ) {
+ stat = MoveFileEx( nt_hand->temp_file+4, /* Existing file */
+ path+4, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ } else {
+ stat = MoveFileEx( nt_hand->temp_file, /* Existing file */
+ path, /* New (original) */
+ MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_DELAY_UNTIL_REBOOT );
+ }
+
+ if ( stat ) {
+ ret_val = FS_RESTORED_ACTIVE;
+ } else {
+ ret_val = FS_ACCESS_DENIED; /* Really best? */
+ }
+ }
+ }
+ NTFS_ReleaseWorkPath( fsh ) ;
+ }
+ }
+ free( nt_hand->temp_file ) ;
+ nt_hand->temp_file = NULL ;
+ }
+
+ if ( (ret_val == SUCCESS) || (ret_val == FS_RESTORED_ACTIVE) ) {
+
+ if ( (hand->mode == FS_WRITE) || ((hand->mode == FS_READ) && (ddblk->dta.os_attr & 0x20)) ) {
+
+ if ( (hand->mode == FS_WRITE) || BEC_GetSetArchiveFlag( fsh->cfg ) ) {
+
+ if ( NTFS_SetupWorkPath( fsh, fsh->cur_dir,
+ ddblk->full_name_ptr->name, &path ) != SUCCESS) {
+
+ return OUT_OF_MEMORY ;
+ }
+
+ attrib = ddblk->dta.os_attr ;
+ if ( hand->mode != FS_WRITE ) {
+ attrib = ddblk->dta.os_attr & (~FILE_ATTRIBUTE_ARCHIVE ) ;
+ }
+ if ( attrib == 0 ) {
+ SetFileAttributes( path, FILE_ATTRIBUTE_NORMAL );
+ } else {
+ SetFileAttributes( path, attrib );
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+ }
+
+ }
+ }
+
+ if ( (hand->mode == FS_READ) && (ddblk->b.f.linkCount > 1) )
+ {
+ NTFS_LINK_Q_ELEM_PTR linkElem;
+
+ linkElem = NTFS_SearchLinkQueue( fsh,
+ ddblk->b.f.idHi,
+ ddblk->b.f.idLo );
+ if ( linkElem == NULL )
+ {
+ /* Add this object to the queue as the original. */
+
+ NTFS_EnqueueLinkInfo( fsh,
+ ddblk->b.f.idHi,
+ ddblk->b.f.idLo,
+ fsh->cur_dir,
+ ddblk->full_name_ptr->name );
+ }
+ else
+ {
+ /*
+ * If anyone was interested, here we could keep track
+ * of how many we links we have hit for this file.
+ */
+ }
+ }
+
+ return ret_val;
+}
+/**/
+/**
+
+ Name: NTFS_CloseDir()
+
+ Description: This function closes an opened directory.
+
+ Modified: 19-Feb-93
+
+ Returns: Error codes
+ FS_OBJECT_NOT_OPENED
+ SUCCESS
+
+**/
+static INT16 NTFS_CloseDir( hand )
+FILE_HAND hand ; /* I - handle to be closed */
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)(hand->dblk);
+ INT16 ret_val = SUCCESS;
+ FSYS_HAND fsh = hand->fsh;
+
+ if ( nt_hand->context != NULL )
+ {
+ BackupRead( nt_hand->fhand,
+ NULL,
+ 0,
+ NULL,
+ TRUE,
+ FALSE,
+ &nt_hand->context ) ;
+ }
+
+ SetFileTime( nt_hand->fhand,
+ &(ddblk->dta.create_time),
+ &(ddblk->dta.access_time),
+ &(ddblk->dta.modify_time) ) ;
+
+ if ( !CloseHandle( nt_hand->fhand ) )
+ {
+ ret_val = FS_OBJECT_NOT_OPENED ;
+ }
+ else if ( (hand->mode == FS_WRITE) ||
+ ((hand->mode == FS_READ) &&
+ (ddblk->dta.os_attr & ~FILE_ATTRIBUTE_ARCHIVE ) &&
+ BEC_GetSetArchiveFlag( fsh->cfg )) )
+ {
+ CHAR_PTR path;
+
+ /*
+ * We will only get in here if we are restoring the dir OR
+ * we were backing it up, it had the modified bit set, and
+ * we're supposed to turn off the modified bit.
+ */
+
+ if ( NTFS_SetupWorkPath( fsh, fsh->cur_dir, NULL, &path ) != SUCCESS)
+ {
+ ret_val = OUT_OF_MEMORY;
+ }
+ else
+ {
+ DWORD attrib = ddblk->dta.os_attr;
+
+ if ( hand->mode != FS_WRITE )
+ {
+ attrib &= ~FILE_ATTRIBUTE_ARCHIVE;
+ }
+ if ( attrib == 0 ) {
+ SetFileAttributes( path, FILE_ATTRIBUTE_NORMAL );
+ } else {
+ SetFileAttributes( path, attrib );
+ }
+ NTFS_ReleaseWorkPath( fsh );
+ }
+ }
+ return ret_val;
+}
+
+
diff --git a/private/utils/ntbackup/src/tcomplet.c b/private/utils/ntbackup/src/tcomplet.c
new file mode 100644
index 000000000..480442658
--- /dev/null
+++ b/private/utils/ntbackup/src/tcomplet.c
@@ -0,0 +1,260 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tcomplet.c
+
+
+ Description: This file contains code to read the path and add it to
+ the DBLK.
+
+ $Log: M:/LOGFILES/TCOMPLET.C_V $
+
+ Rev 1.10 15 Jan 1994 19:23:24 BARRY
+Call SetupOSPathOrName with BYTE_PTRs instead of CHAR_PTRs
+
+ Rev 1.9 24 Nov 1993 14:46:40 BARRY
+Unicode fixes
+
+ Rev 1.8 11 Nov 1992 22:49:20 STEVEN
+This is Gregg checking files in for Steve. I don't know what he did!
+
+ Rev 1.7 10 Nov 1992 08:20:46 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.6 21 Oct 1992 19:42:24 BARRY
+Fixed warnings.
+
+ Rev 1.5 16 Oct 1992 16:51:10 STEVEN
+fix streams to UINT64
+
+ Rev 1.4 07 Oct 1992 18:02:26 BARRY
+Set lengths correctly when reading from streams.
+
+ Rev 1.3 24 Sep 1992 13:42:50 BARRY
+Changes for huge file name support.
+
+ Rev 1.2 04 Jun 1992 15:36:32 BURT
+
+ Rev 1.1 22 May 1992 16:05:34 STEVEN
+
+
+ Rev 1.0 21 May 1992 13:49:48 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <malloc.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "fsys_prv.h"
+
+
+static INT16 SetupDDB( FSYS_HAND fsh,
+ NTFS_DBLK_PTR ddblk ) ;
+
+static INT16 SetupFDB( FSYS_HAND fsh,
+ NTFS_DBLK_PTR ddblk ) ;
+
+/**/
+/**
+
+ Name: NTFS_IsBlkComplete( )
+
+ Description: This function returns TRUE if the path is complete
+ inside the DBLK.
+
+ Modified: 5/18/1992 10:27:34
+
+ Returns: TRUE if complete
+ FALSE if path is not complete in DBLK.
+
+**/
+BOOLEAN NTFS_IsBlkComplete( FSYS_HAND fsh, DBLK_PTR dblk )
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk;
+ BOOLEAN ret;
+
+ (VOID)fsh ;
+
+ switch ( ddblk->blk_type )
+ {
+ case DDB_ID:
+ case FDB_ID:
+ ret = ddblk->name_complete;
+ break;
+
+ default:
+ ret = TRUE;
+ break;
+ }
+ return ret;
+}
+
+/**/
+/**
+
+ Name: NTFS_CompleteBlk()
+
+ Description: This function accepts data as a stream and sets up
+ the path inside the DBLK based off of this stream.
+
+ Modified: 17-Sep-92
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+
+**/
+INT16 NTFS_CompleteBlk( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ BYTE_PTR buffer,
+ UINT16 *size,
+ STREAM_INFO *s_info )
+{
+ INT16 ret_val = SUCCESS;
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk;
+ BYTE_PTR stream_data;
+ STREAM_INFO_PTR stream_info;
+
+ msassert( ddblk->name_complete == FALSE );
+
+ ret_val = FS_FillBufferWithStream( fsh, dblk, buffer, size, s_info );
+
+ if ( ret_val == FS_STREAM_COMPLETE )
+ {
+ /* buffer has been filled */
+ /* lets set up the buffers */
+
+ FS_GetStreamInfo( fsh, dblk, &stream_info, &stream_data ) ;
+
+ if ( FS_GetStrmSizeHi( stream_info ) != 0 )
+ {
+ ret_val = OUT_OF_MEMORY;
+ }
+ else
+ {
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)stream_data,
+ (INT16)FS_GetStrmSizeLo( stream_info ) ) ;
+
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+
+ switch( dblk->blk_type )
+ {
+ case DDB_ID:
+ ret_val = SetupDDB( fsh, ddblk ) ;
+ break;
+
+ case FDB_ID:
+ ret_val = SetupFDB( fsh, ddblk ) ;
+ break;
+ }
+ }
+ }
+ return ret_val;
+}
+
+
+/**/
+/**
+
+ Name: SetupDDB()
+
+ Description: Once the stream has been completely read, this function
+ sets it up the path in the DBLK.
+
+ Modified: 23-Sep-92
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+
+**/
+static INT16 SetupDDB( FSYS_HAND fsh,
+ NTFS_DBLK_PTR ddblk )
+{
+ FS_NAME_Q_ELEM_PTR path_q_elem ;
+ DBLK_PTR dblk ;
+ INT16 psize ;
+
+ dblk = (DBLK_PTR)ddblk ;
+
+ psize = dblk->com.os_name->name_size ;
+
+ path_q_elem = FS_AllocPathOrName( fsh, psize ) ;
+
+ if ( path_q_elem == NULL ) {
+ return OUT_OF_MEMORY ;
+
+ }
+
+
+ ddblk->full_name_ptr = path_q_elem ;
+ memcpy( ddblk->full_name_ptr->name,
+ dblk->com.os_name->name,
+ psize ) ;
+
+
+ NTFS_FixPath( ddblk->full_name_ptr->name,
+ &psize,
+ fsh->attached_dle->info.ntfs->fname_leng );
+
+ ddblk->full_name_ptr->name_size = strsize( ddblk->full_name_ptr->name );
+ ddblk->name_complete = TRUE ;
+
+ return SUCCESS ;
+}
+
+
+/**/
+/**
+
+ Name: SetupFDB()
+
+ Description: Once the stream has been completely read, this function
+ sets it up the file name in the DBLK.
+
+ Modified: 23-Sep-92
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+
+**/
+static INT16 SetupFDB( FSYS_HAND fsh,
+ NTFS_DBLK_PTR ddblk )
+{
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+ DBLK_PTR dblk ;
+
+ dblk = (DBLK_PTR)ddblk ;
+
+ name_q_elem = FS_AllocPathOrName( fsh, dblk->com.os_name->name_size ) ;
+
+ if ( ( name_q_elem == NULL ) ) {
+ return OUT_OF_MEMORY ;
+
+ }
+
+ ddblk->full_name_ptr = name_q_elem ;
+ memcpy( ddblk->full_name_ptr->name,
+ dblk->com.os_name->name,
+ dblk->com.os_name->name_size ) ;
+
+// NTFS_FixFname( ddblk->full_name_ptr->name,
+// (UINT16)fsh->attached_dle->info.ntfs->fname_leng ) ;
+
+ ddblk->full_name_ptr->name_size = strsize( ddblk->full_name_ptr->name ) ;
+
+ ddblk->name_complete = TRUE ;
+
+ return SUCCESS;
+}
diff --git a/private/utils/ntbackup/src/tcreate.c b/private/utils/ntbackup/src/tcreate.c
new file mode 100644
index 000000000..12da86283
--- /dev/null
+++ b/private/utils/ntbackup/src/tcreate.c
@@ -0,0 +1,508 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tcreate.c
+
+ Description: This file contains code to create a file or directory
+ path.
+
+
+ $Log: N:/LOGFILES/TCREATE.C_V $
+
+ Rev 1.34.1.1 16 Jun 1994 15:37:04 STEVEN
+do not set attrib in craete doit in close
+
+ Rev 1.34.1.0 15 Mar 1994 22:48:44 STEVEN
+fix registry bugs
+
+ Rev 1.34 01 Feb 1994 15:22:12 BARRY
+fix default security
+
+ Rev 1.33 14 Jan 1994 15:35:50 STEVEN
+do not create with posix switch
+
+ Rev 1.32 30 Nov 1993 16:16:04 BARRY
+Added call NTFS_SaveTempName for actively-restored files
+
+ Rev 1.31 24 Nov 1993 14:46:38 BARRY
+Unicode fixes
+
+ Rev 1.30 24 Aug 1993 19:47:48 STEVEN
+fix too_long bugs
+
+ Rev 1.29 04 Aug 1993 18:56:54 BARRY
+Use access macro.
+
+ Rev 1.28 26 Jul 1993 17:06:40 STEVEN
+fixe restore active file with registry
+
+ Rev 1.27 29 Jun 1993 16:19:56 BARRY
+Skip registry file if config doesn't say to restore them.
+
+ Rev 1.26 23 Jun 1993 11:10:08 BARRY
+Don't assume NT will give us valid errors on CreateDirectory.
+
+ Rev 1.25 19 Jun 1993 15:54:02 STEVEN
+need to set the attribute when creating the file
+
+ Rev 1.24 12 Jun 1993 11:56:00 BARRY
+Check only for sharing violation before creating temp files.
+
+ Rev 1.23 09 Jun 1993 10:40:18 BARRY
+Forgot to assign default security to directories as well.
+
+ Rev 1.22 09 Jun 1993 10:31:38 BARRY
+Use the default security descriptor from the DLE (allocated and inited at
+attach time) to deny all access to a file. Any ACLs that come later will
+override this default. Prevents ACL restore errors from leaving previously
+secured items vulnerable.
+
+ Rev 1.21 01 Jun 1993 16:20:16 STEVEN
+fix posix bugs
+
+ Rev 1.20 15 Mar 1993 15:11:24 BARRY
+Return better error codes.
+
+ Rev 1.19 09 Feb 1993 17:52:02 BARRY
+Fixed restore over active files.
+
+ Rev 1.18 01 Feb 1993 19:46:24 STEVEN
+bug fixes
+
+ Rev 1.17 07 Dec 1992 14:16:28 STEVEN
+updates from msoft
+
+ Rev 1.16 25 Nov 1992 16:42:16 BARRY
+Fix MakeTempFile and restore over active files.
+
+ Rev 1.15 11 Nov 1992 09:54:08 GREGG
+Unicodeized literals.
+
+ Rev 1.14 10 Nov 1992 08:19:52 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.13 29 Oct 1992 16:51:08 BARRY
+Do nothing for linked files.
+
+ Rev 1.12 20 Oct 1992 14:22:34 STEVEN
+temp names should not have .TMP extension
+
+ Rev 1.10 07 Oct 1992 15:54:50 DAVEV
+unicode strlen verification
+
+ Rev 1.9 23 Sep 1992 15:06:06 BARRY
+Changes for huge file names.
+
+ Rev 1.8 18 Sep 1992 14:13:38 BARRY
+Added suport for restore over existing files.
+
+ Rev 1.7 16 Sep 1992 08:54:36 STEVEN
+fix restore to redirected dir
+
+ Rev 1.5 09 Jun 1992 15:37:16 BURT
+Sync with NT stuff fix Dir exist bug
+
+ Rev 1.4 22 May 1992 16:05:48 STEVEN
+
+
+ Rev 1.3 21 May 1992 13:49:20 STEVEN
+more long path support
+
+ Rev 1.2 04 May 1992 09:29:32 LORIB
+Changes for variable length paths.
+
+ Rev 1.1 28 Feb 1992 13:03:40 STEVEN
+step one for varible length paths
+
+ Rev 1.0 10 Feb 1992 16:27:08 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "dle_str.h"
+#include "msassert.h"
+
+static INT16 NTFS_CreateFile( FSYS_HAND fsh, NTFS_DBLK_PTR ddblk ) ;
+static INT16 NTFS_CreateDir( FSYS_HAND fsh, NTFS_DBLK_PTR ddblk ) ;
+
+static BOOLEAN TempFileName( CHAR *template );
+#define TEMP_NAME_LEN 8
+#define TEMP_NAME_SIZE (TEMP_NAME_LEN + 2) /* BACKSLASH and terminator */
+#define MAX_ATTEMPTS 65535
+
+/**/
+/**
+
+ Name: NTFS_CreateObj()
+
+ Description: This funciton determines whether the object is a
+ file or directory. It then calls the approprate static routine
+ to create the object.
+
+ Modified: 2/10/1992 15:49:17
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ FS_DLE_NOT_ATTACHED
+ FS_ACCESS_DENIED
+ FS_OUT_OF_SPACE
+ FS_BAD_DBLK
+ SUCCESS
+
+ Notes: This function will return FS_BAD_DBLK if an IDB is
+ passed in as the object.
+
+**/
+INT16 NTFS_CreateObj( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system to create object on */
+DBLK_PTR dblk ; /* I - Describes object to create */
+{
+ GENERIC_DLE_PTR dle ;
+ INT16 ret_val ;
+ NTFS_DBLK_PTR ddblk ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ msassert( dblk != NULL );
+
+ dle = fsh->attached_dle ;
+
+ msassert( dle != NULL ) ;
+
+ switch( ddblk->blk_type ){
+
+ case DDB_ID :
+
+ ret_val = NTFS_CreateDir( fsh, ddblk ) ;
+ break ;
+
+ case FDB_ID :
+ if ( ddblk->b.f.linkOnly ) {
+ /* Do nothing for linked files -- all handled at close */
+ ret_val = SUCCESS;
+ } else {
+ ret_val = NTFS_CreateFile( fsh, ddblk ) ;
+ }
+ break ;
+
+ default :
+
+ ret_val = FS_INCOMPATIBLE_OBJECT ;
+ }
+
+ if( ret_val == FS_ACCESS_DENIED ) {
+ /* check for disk full */
+ }
+
+ return ret_val;
+}
+/**/
+/**
+
+ Name: NTFS_CreateFile()
+
+ Description: This function makes a NTFS call to create a file. If the
+ call fails, we try to remove all attributes for the specified file
+ and try to create again.
+
+
+ Modified: 2/10/1992 15:50:44
+
+ Returns: Error codes:
+ FS_ACCESS_DENIED
+
+ Notes:
+
+**/
+static INT16 NTFS_CreateFile( FSYS_HAND fsh,
+ NTFS_DBLK_PTR ddblk )
+{
+ CHAR_PTR path ;
+ INT16 ret_val ;
+ INT posix_flag = 0 ;
+ SECURITY_ATTRIBUTES satr ;
+ SECURITY_ATTRIBUTES *satr_ptr = NULL ;
+
+ if ( fsh->attached_dle->info.ntfs->sd ) {
+ satr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ satr.lpSecurityDescriptor = fsh->attached_dle->info.ntfs->sd ;
+ satr.bInheritHandle = FALSE ;
+ satr_ptr = &satr ;
+ }
+
+
+ ddblk->b.f.hand_registry = FALSE ;
+ ddblk->b.f.hand_temp_name = NULL ;
+
+
+ if ( NTFS_SetupWorkPath( fsh, fsh->cur_dir, ddblk->full_name_ptr->name, &path ) != SUCCESS )
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ if ( ddblk->b.f.PosixFile ) {
+ posix_flag = FILE_FLAG_POSIX_SEMANTICS ;
+ }
+
+ posix_flag = FALSE ; // Because the posix/win32 solution is not complete.
+ // we will backup both files but will restore them
+ // as one file.
+ // If the user wants a specific file he can select
+ // by itself and restore it to a seperate path.
+
+ ddblk->b.f.handle = CreateFile( path,
+ GENERIC_WRITE | GENERIC_READ | ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER,
+ FILE_SHARE_WRITE | FILE_SHARE_READ,
+ satr_ptr,
+ CREATE_ALWAYS,
+ FILE_FLAG_BACKUP_SEMANTICS | posix_flag,
+ NULL ) ;
+
+ ret_val = NTFS_TranslateBackupError( GetLastError() );
+
+ if ( (ddblk->b.f.handle == INVALID_HANDLE_VALUE) &&
+ (ret_val == FS_ACCESS_DENIED) ) {
+
+ SetFileAttributes( path, FILE_ATTRIBUTE_NORMAL ) ;
+
+
+ ddblk->b.f.handle = CreateFile( path,
+ GENERIC_WRITE | GENERIC_READ | ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER,
+ FILE_SHARE_WRITE | FILE_SHARE_READ,
+ satr_ptr,
+ CREATE_ALWAYS,
+ FILE_FLAG_BACKUP_SEMANTICS | posix_flag,
+ NULL ) ;
+
+ ret_val = NTFS_TranslateBackupError( GetLastError() );
+
+ }
+
+ if ( (ddblk->b.f.handle == INVALID_HANDLE_VALUE) &&
+ (ret_val == FS_ACCESS_DENIED) ) {
+
+ ddblk->b.f.handle = CreateFile( path,
+ GENERIC_WRITE | GENERIC_READ | WRITE_DAC | WRITE_OWNER,
+ FILE_SHARE_WRITE | FILE_SHARE_READ,
+ satr_ptr,
+ CREATE_ALWAYS,
+ FILE_FLAG_BACKUP_SEMANTICS | posix_flag,
+ NULL ) ;
+
+ ret_val = NTFS_TranslateBackupError( GetLastError() );
+ }
+
+ if ( ddblk->b.f.handle != INVALID_HANDLE_VALUE ) {
+ ret_val = SUCCESS ;
+
+ } else {
+ DWORD error = GetLastError();
+
+ ret_val = NTFS_TranslateBackupError( error );
+
+ /* Check the error for active file */
+ if ( ( error == ERROR_SHARING_VIOLATION ) ||
+ ( error == ERROR_USER_MAPPED_FILE ) ){
+ CHAR *tempName = NULL;
+
+ if ( REG_IsRegistryFile( fsh->attached_dle, path ) ) {
+
+ if ( BEC_GetProcSpecialFiles( fsh->cfg ) )
+ {
+ ddblk->b.f.hand_registry = TRUE ;
+ tempName = NTFS_MakeTempName( path, TEXT("REG") ) ;
+ }
+ else
+ {
+ ret_val = FS_SKIP_OBJECT;
+ }
+
+ } else {
+
+ tempName = NTFS_MakeTempName( path, TEXT("USE") ) ;
+ }
+
+ if ( tempName != NULL ) {
+
+
+ ddblk->b.f.handle = CreateFile( tempName,
+ GENERIC_WRITE | GENERIC_READ | ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER,
+ 0,
+ satr_ptr,
+ OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL| FILE_FLAG_BACKUP_SEMANTICS,
+ NULL ) ;
+
+
+ if ( ddblk->b.f.handle == INVALID_HANDLE_VALUE ) {
+
+ ddblk->b.f.handle = CreateFile( path,
+ GENERIC_WRITE | GENERIC_READ | WRITE_DAC | WRITE_OWNER,
+ FILE_SHARE_WRITE | FILE_SHARE_READ,
+ satr_ptr,
+ OPEN_ALWAYS,
+ FILE_FLAG_BACKUP_SEMANTICS | posix_flag,
+ NULL ) ;
+
+ }
+
+
+ if ( ddblk->b.f.handle != INVALID_HANDLE_VALUE ) {
+
+ NTFS_SaveTempName( path, tempName );
+
+ ddblk->b.f.hand_temp_name = tempName ;
+ ret_val = SUCCESS;
+
+ } else {
+ free( tempName );
+ }
+ }
+ }
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ return ret_val;
+}
+/**/
+/**
+
+ Name: NTFS_CreateDir()
+
+ Description: This function creates a directory path.
+
+ Modified: 2/10/1992 15:54:56
+
+ Returns: Error Codes
+ FS_ACCESS_DENIED
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: Non recursive
+
+**/
+static INT16 NTFS_CreateDir( fsh, ddblk )
+FSYS_HAND fsh ; /* I - File system to create directory on */
+NTFS_DBLK_PTR ddblk ; /* I - Decription of directory to create */
+{
+ INT16 ret_val = SUCCESS ;
+ CHAR_PTR p ;
+ CHAR_PTR path ;
+ UINT16 cch_path_leng ; //count of chars in path w/o NULL term
+ BOOLEAN isNTFS;
+ INT16 dev_name_size ;
+ SECURITY_ATTRIBUTES satr ;
+ SECURITY_ATTRIBUTES *satr_ptr = NULL ;
+
+// if ( fsh->attached_dle->info.ntfs->sd ) {
+// satr.nLength = sizeof(SECURITY_ATTRIBUTES);
+// satr.lpSecurityDescriptor = fsh->attached_dle->info.ntfs->sd ;
+// satr.bInheritHandle = FALSE ;
+// satr_ptr = &satr ;
+// }
+
+
+ isNTFS = strcmp(fsh->attached_dle->info.ntfs->fs_name, TEXT("NTFS")) == 0;
+
+ path = ddblk->full_name_ptr->name ;
+
+ if ( strlen( path ) != 0 ) {
+
+ if ( NTFS_SetupWorkPath( fsh,
+ path,
+ NULL,
+ &path ) != SUCCESS) {
+
+ return OUT_OF_MEMORY ;
+ }
+
+ cch_path_leng = (INT16)strlen( path ) ;
+
+ dev_name_size = strlen(path) - strlen( ddblk->full_name_ptr->name) ;
+
+ /* backup path until first one succeeds */
+
+ p = path + strlen(path) ;
+
+ while ( ( p > path + dev_name_size ) &&
+ !CreateDirectory( path, satr_ptr ) ) {
+
+ DWORD error = GetLastError();
+
+ satr_ptr = NULL ;
+
+ if ( error == ERROR_ALREADY_EXISTS ) {
+ break ;
+ } else {
+ /*
+ * If this is not an NTFS drive, and we get access
+ * denied from CreateDir, it may mean the directory
+ * already exists. Yes, this is a kludge.
+ */
+ if ( (isNTFS == FALSE) && (error == ERROR_ACCESS_DENIED) ) {
+ if ( GetFileAttributes( path ) != 0xffffffff ) {
+ /*
+ * If we got the attributes, the directory
+ * must exist.
+ */
+ break;
+ }
+ }
+ }
+
+ p = strrchr( path, TEXT('\\') ) ;
+ if ( p == NULL ) {
+ p = path ;
+ }
+
+ *p = TEXT('\0') ;
+
+ }
+
+ p = path ;
+
+ while ( ( ret_val == SUCCESS ) && ( (UINT16)strlen( path ) < cch_path_leng ) ) {
+
+ p = path + strlen( path ) ;
+ *p = TEXT('\\') ;
+
+ if ( (UINT16)strlen( path ) == cch_path_leng ) {
+ if ( fsh->attached_dle->info.ntfs->sd ) {
+ satr_ptr = &satr ;
+ }
+ }
+
+ if ( !CreateDirectory( path, satr_ptr ) ) {
+
+ DWORD error = GetLastError();
+
+ if ( error != ERROR_ALREADY_EXISTS ) {
+ ret_val = NTFS_TranslateBackupError( error );
+ }
+ }
+ }
+
+ if ( ret_val == SUCCESS ) {
+
+ ret_val = FS_SavePath( fsh, (UINT8_PTR)(&path[2]), (INT16)strsize( path ) ) ;
+
+ }
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ return ( ret_val ) ;
+}
diff --git a/private/utils/ntbackup/src/tdelete.c b/private/utils/ntbackup/src/tdelete.c
new file mode 100644
index 000000000..1f8c6efa6
--- /dev/null
+++ b/private/utils/ntbackup/src/tdelete.c
@@ -0,0 +1,176 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tdelete.c
+
+ Description: This file contains code to delete file and directories
+ on a LOCAL NTFS drive.
+
+
+ $Log: N:/LOGFILES/TDELETE.C_V $
+
+ Rev 1.5 10 Nov 1992 08:19:06 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.4 24 Sep 1992 13:43:12 BARRY
+Changes for huge file name support.
+
+ Rev 1.3 21 May 1992 13:50:56 STEVEN
+more long path stuff
+
+ Rev 1.2 04 May 1992 09:26:02 LORIB
+Changes for variable length paths.
+
+ Rev 1.1 28 Feb 1992 13:03:44 STEVEN
+step one for varible length paths
+
+ Rev 1.0 12 Feb 1992 14:46:14 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+
+static INT16 NTFS_DeleteDir( FSYS_HAND fsh, NTFS_DBLK_PTR ddblk) ;
+static INT16 NTFS_DeleteFile( FSYS_HAND fsh, NTFS_DBLK_PTR ddblk) ;
+
+/**/
+/**
+
+ Name: NTFS_DeleteObj()
+
+ Description: This function deletes a LOCAL NTFS object.
+
+ Modified: 2/12/1992 14:35:59
+
+ Returns: Error codes:
+ FS_NOT_FOUND
+ FS_BAD_DBLK
+ FS_ACCESS_DENIED
+
+**/
+INT16 NTFS_DeleteObj( fsh, dblk )
+FSYS_HAND fsh ;
+DBLK_PTR dblk ;
+{
+ NTFS_DBLK_PTR ddblk ;
+ INT16 ret_val ;
+
+ msassert( fsh->attached_dle != NULL ) ;
+ ddblk = (NTFS_DBLK_PTR) dblk ;
+
+
+ switch( dblk->blk_type ){
+
+ case DDB_ID :
+
+ ret_val = NTFS_DeleteDir( fsh, ddblk ) ;
+
+ break ;
+
+ case FDB_ID :
+
+ ret_val = NTFS_DeleteFile( fsh, ddblk ) ;
+
+ break ;
+
+ default :
+
+ ret_val = FS_BAD_DBLK ;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: NTFS_DeleteFile()
+
+ Description: This function deletes the file in the current directoy.
+
+ Modified: 7/28/1989
+
+ Returns: Error Codes :
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+
+**/
+static INT16 NTFS_DeleteFile( fsh, ddblk )
+FSYS_HAND fsh ; /* I - File system to delete file from */
+NTFS_DBLK_PTR ddblk ; /* I - Describes file to delete */
+{
+ CHAR_PTR path ;
+ INT16 ret_val = SUCCESS ;
+
+ if ( NTFS_SetupWorkPath( fsh, fsh->cur_dir, ddblk->full_name_ptr->name, &path ) != SUCCESS ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ if ( !DeleteFile( path ) ) {
+
+ SetFileAttributes( path, 0 ) ;
+
+ if ( !DeleteFile( path ) ) {
+ ret_val = FS_ACCESS_DENIED ;
+ }
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: NTFS_DeleteDir()
+
+ Description: This function removes a directory under the current
+ directory.
+
+ Modified: 2/12/1992 14:39:21
+
+ Returns: Error code
+ FS_ACCESS_DENIED
+ FS_NOT_FOUND
+ SUCCESS
+
+**/
+/* begin declaration */
+static INT16 NTFS_DeleteDir( fsh, ddblk )
+FSYS_HAND fsh ;
+NTFS_DBLK_PTR ddblk ;
+{
+ CHAR_PTR path ;
+ INT16 ret_val = SUCCESS ;
+
+ path = ddblk->full_name_ptr->name ;
+
+ if ( NTFS_SetupWorkPath( fsh, path, NULL, &path ) != SUCCESS) {
+ return OUT_OF_MEMORY ;
+ }
+
+ if ( !RemoveDirectory( path ) ) {
+
+ SetFileAttributes( path, 0 ) ;
+
+ if ( !RemoveDirectory( path ) ) {
+ ret_val = FS_ACCESS_DENIED ;
+ }
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ return( ret_val ) ;
+
+}
diff --git a/private/utils/ntbackup/src/tension.dlg b/private/utils/ntbackup/src/tension.dlg
new file mode 100644
index 000000000..54190da9d
--- /dev/null
+++ b/private/utils/ntbackup/src/tension.dlg
@@ -0,0 +1,11 @@
+
+IDD_TENSION DIALOG 27, 32, 270, 90
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Job Status - "
+FONT 8, "MS Shell Dlg"
+BEGIN
+ PUSHBUTTON "OK", IDD_JST_OK, 120, 71, 34, 14
+ LTEXT "Summary", 0x0069, 3, 4, 39, 8
+ LISTBOX IDD_JST_LISTBOX, 4, 15, 261, 61, WS_VSCROLL | WS_HSCROLL |
+ WS_TABSTOP
+END
diff --git a/private/utils/ntbackup/src/tfbuffs.c b/private/utils/ntbackup/src/tfbuffs.c
new file mode 100644
index 000000000..7ec0a149d
--- /dev/null
+++ b/private/utils/ntbackup/src/tfbuffs.c
@@ -0,0 +1,292 @@
+/**
+
+ Name: tfbuffs.c
+
+ Description: TF_AllocateTapeBuffers()
+ TF_FreeTapeBuffers()
+
+ $Log: T:\logfiles\tfbuffs.c_v $
+
+ Rev 1.18 01 Feb 1994 15:12:20 GREGG
+Put TEXT macros debug print format strings.
+
+ Rev 1.17 23 Jul 1992 10:11:56 GREGG
+Fixed warnings.
+
+ Rev 1.16 26 Feb 1992 12:02:18 STEVEN
+added buffnt.h
+
+ Rev 1.15 11 Feb 1992 17:12:02 NED
+changed buffman/translator interface parameters
+
+ Rev 1.14 08 Feb 1992 14:40:46 GREGG
+Fixed stupid mistake!
+
+ Rev 1.13 05 Feb 1992 20:17:56 GREGG
+Fixed buffer size math.
+
+ Rev 1.12 04 Feb 1992 19:53:02 GREGG
+Changes for dealing with new config parameters.
+
+ Rev 1.11 22 Jan 1992 15:53:06 NED
+Fixed buffer allocation parameters
+
+ Rev 1.10 16 Jan 1992 18:43:14 NED
+Skateboard: buffer manager changes
+
+ Rev 1.9 15 Jan 1992 00:45:50 GREGG
+Kludged in config stuffuntil we can fix it right.
+
+ Rev 1.8 13 Jan 1992 19:41:18 NED
+Changed allocation of buffers
+
+ Rev 1.7 13 Jan 1992 13:49:56 GREGG
+Skateboard - Bug fixes.
+
+ Rev 1.6 09 Jan 1992 10:01:06 NED
+Made hardwired 100K buffer allocation OS/2 specific.
+Improved debug messages.
+
+ Rev 1.5 03 Jan 1992 13:27:06 GREGG
+New Buffer Manager integration
+
+ Rev 1.4 03 Dec 1991 11:49:54 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.3 14 Aug 1991 14:45:14 DON
+needed OS_NLM to not reference gb_dos_pool
+
+ Rev 1.2 26 Jul 1991 11:08:54 GREGG
+Changed MAYN_OS2 to OS_OS2.
+
+ Rev 1.1 10 May 1991 16:07:16 GREGG
+Ned's new stuff
+
+ Rev 1.0 10 May 1991 10:11:56 GREGG
+Initial revision.
+
+**/
+
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "drive.h"
+#include "channel.h"
+#include "buffman.h"
+#include "tfl_err.h"
+#include "lw_data.h"
+#include "tflproto.h"
+#include "mem.h"
+#include "be_debug.h"
+#include "minmax.h"
+#include "lw_data.h"
+
+#if defined( OS_NLM )
+#include "buffnlm.h"
+#elif defined( OS_WIN )
+#include "buffwin.h"
+#elif defined( OS_DOS )
+#include "buffdos.h"
+#elif defined( OS_OS2 )
+#include "buffos2.h"
+#elif defined( OS_WIN32 )
+#include "buffnt.h"
+#endif
+
+/**/
+/**
+ * Unit: Tape Format
+ *
+ * Name: TF_AllocateTapeBuffers
+ *
+ * Modified: Tuesday, December 17, 1991
+ *
+ * Description: Allocates most of the Tape Format read/write buffers.
+ *
+ * Notes: Two buffers have already been allocated
+ * in TF_OpenTapeFormat().
+ *
+ * Returns: INT16, a TFLE_xxxx code
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** Ask the OS for avail_mem, and get his opinion on buffer size
+ **
+ ** Determine the amount of allowable memory
+ **
+ ** split available memory among channels
+ **
+ ** For each channel
+ **
+ ** if we are in write mode
+ **
+ ** mark our vcb buffer as a vcb buffer
+ **
+ ** free or resize our vcb buffer
+ **
+ ** while we haven't allocated enough memory yet
+ **
+ ** Allocate a buffer using list requirements
+ **
+ **/
+
+INT16 TF_AllocateTapeBuffers(
+ UINT16 mem_save, /* I - number of Kb we should leave free */
+ UINT16 max_buffs, /* I - number buffers maximum we should use */
+ UINT16 buff_size ) /* I - Kb buffer size (recommended) */
+{
+ UINT32 avail_mem;
+ UINT32 buffer_allowance;
+ UINT32 translator_preferred;
+ UINT32 mem_per_channel;
+ UINT16 total_buffers;
+ UINT16 index;
+ INT16 ret_val = TFLE_NO_ERR;
+
+/*
+** Ask the OS for avail_mem, and get his opinion on buffer size
+*/
+ BM_OS_BufferRequirements( &avail_mem, &buff_size );
+
+ if ( avail_mem <= mem_save ) {
+ return TFLE_NO_MEMORY;
+ }
+
+/*
+** Determine the amount of allowable memory
+*/
+ buffer_allowance = (UINT32)( (UINT32)max_buffs * (UINT32)buff_size * 1024UL + (UINT32)max_buffs * (UINT32)BM_BufferOverhead( ) );
+
+ /* Hard wired until the translator gets sane */
+ translator_preferred = 100UL * 1024UL ;
+/*
+ TF_GetPreferredBufferSpace( QueueHead( &lw_drive_list ),
+ max_buffs, (UINT32)buff_size, &translator_preferred ) ;
+*/
+ buffer_allowance = MAX( buffer_allowance, translator_preferred );
+ avail_mem = MIN( avail_mem - ( mem_save * 1024 ), buffer_allowance );
+
+/*
+** split available memory among channels
+*/
+ mem_per_channel = avail_mem / lw_tfl_control.no_channels;
+ total_buffers = 0;
+/*
+** If no default buffer requirements have been set yet
+*/
+ if ( lw_default_bm_requirements.a.min_size == BR_DONT_CARE ) {
+/*
+** try to set default buffer requirements from VCB requirements and config
+** (default to VCB requirements if incompatible)
+*/
+ lw_default_bm_requirements.a.min_size = buff_size * 1024 ;
+ if ( BM_AddRequirements( &lw_default_bm_requirements,
+ &lw_default_vcb_requirements ) != BR_NO_ERR ) {
+ lw_default_bm_requirements = lw_default_vcb_requirements ;
+ }
+ /* set reasonable sizes given allocation size */
+ lw_default_bm_requirements.tf_size
+ = lw_default_bm_requirements.rw_size
+ = lw_default_bm_requirements.a.min_size;
+ }
+/*
+** For each channel
+*/
+ for ( index = 0; index < lw_tfl_control.no_channels && ret_val == TFLE_NO_ERR; index++ ) {
+ BUF_LIST_PTR buf_list_ptr ;
+ UINT16 count ;
+ UINT16 limit ;
+
+ buf_list_ptr = &lw_channels[index].buffer_list;
+ buf_list_ptr->max_memory = mem_per_channel;
+/*
+** if list requirements haven't been set yet
+*/
+ if ( BM_ListRequirements( buf_list_ptr )->a.min_size == BR_DONT_CARE ) {
+/*
+** set the requirements to default read requirements
+*/
+ BM_SetListRequirements( buf_list_ptr, &lw_default_bm_requirements );
+ }
+/*
+** while we haven't allocated enough memory yet
+*/
+ limit = (UINT16)(mem_per_channel / BM_RequiredSize( BM_ListRequirements( buf_list_ptr ) ) );
+ if ( BM_ListRequirements( buf_list_ptr )->a.min_size == buff_size * 1024U ) {
+ limit = MIN( limit, max_buffs ) ;
+ }
+ for( count = 0; count < limit; count++ ) {
+/*
+** Allocate a buffer using list requirements
+*/
+ if ( BM_Alloc( buf_list_ptr ) == NULL ) {
+ break; /* didn't quite catch our limit! */
+ }
+ }
+
+ if( count == 0 ) {
+ ret_val = TFLE_NO_MEMORY ;
+ }
+ total_buffers += BM_ListCount( buf_list_ptr ) ;
+ BE_Zprintf( DEBUG_TEMPORARY,
+ TEXT("Allocated %u buffers, size %u bytes, total used: %lu\n"),
+ total_buffers, buf_list_ptr->requirements_context.a.min_size,
+ buf_list_ptr->memory_used );
+ }
+
+
+ return ret_val ;
+}
+
+/**/
+/**
+ * Unit: Tape Format
+ *
+ * Name: TF_FreeTapeBuffers
+ *
+ * Modified: Monday, October 21, 1991
+ *
+ * Description: Free the buffers allocated by TF_AllocateTapeBuffers()
+ *
+ * Notes: Leaves two buffers in each channel
+ *
+ * Returns: INT16, a TFLE_xxxx code
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ ** For each channel
+ **
+ ** Free all the non-reserved buffers
+ **
+ ** Ensure we have 2 buffers on the channel list
+ **
+ **/
+
+INT16 TF_FreeTapeBuffers( VOID )
+{
+ UINT16 i ;
+ INT16 orig_buffers = 0;
+ INT16 total_buffers = 0;
+/*
+** For each channel
+*/
+ for( i = 0 ; i < lw_tfl_control.no_channels ; i++ ) {
+ BUF_LIST_PTR buf_list_ptr = &lw_channels[i].buffer_list;
+ orig_buffers += BM_ListCount( buf_list_ptr );
+/*
+** Free all the non-reserved buffers
+*/
+ BM_FreeAll( buf_list_ptr );
+ total_buffers += BM_ListCount( buf_list_ptr );
+ }
+
+ BE_Zprintf( DEBUG_TEMPORARY, TEXT("TF_FreeTapeBuffers: from %d to %d buffers\n"),
+ orig_buffers, total_buffers );
+
+ return( TFLE_NO_ERR ) ;
+}
+
diff --git a/private/utils/ntbackup/src/tfclose.c b/private/utils/ntbackup/src/tfclose.c
new file mode 100644
index 000000000..d0a6b89d2
--- /dev/null
+++ b/private/utils/ntbackup/src/tfclose.c
@@ -0,0 +1,229 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tfclose.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the code for the TF close command.
+
+
+ $Log: J:/LOGFILES/TFCLOSE.C_V $
+
+ Rev 1.17 13 May 1992 13:28:34 CHARLIE
+Eliminated BE_Zprint call
+
+ Rev 1.16 13 May 1992 11:21:16 GREGG
+EPR #1295 - On fatal errors, free format env, and force rewind on next mount.
+
+ Rev 1.15 20 Mar 1992 18:00:48 NED
+added exception updating after TpReceive calls
+
+ Rev 1.14 24 Feb 1992 15:19:02 GREGG
+Split TF_CloseSet into TF_CloseTape and TF_CloseSet.
+
+ Rev 1.13 16 Jan 1992 18:42:24 NED
+Skateboard: buffer manager changes
+
+ Rev 1.12 16 Jan 1992 10:17:34 GREGG
+Skateboard - Bug fixes.
+
+ Rev 1.11 03 Dec 1991 11:43:54 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.10 17 Oct 1991 01:30:18 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.9 07 Oct 1991 22:19:16 GREGG
+Make sure the fmt env pointers are maintained in only one place at any given time.
+
+ Rev 1.8 17 Sep 1991 11:46:14 GREGG
+Always dismount the tape if you have a drive handle.
+
+ Rev 1.7 11 Sep 1991 12:49:42 GREGG
+No need to check the operation type when determining whether to save the buffer.
+
+ Rev 1.6 22 Aug 1991 16:35:00 NED
+Changed all references to internals of the buffer structure to macros.
+
+ Rev 1.5 20 Aug 1991 13:44:04 GREGG
+Don't put the cur_buff into hold_buff if the exception is NO_DATA.
+
+ Rev 1.4 20 Jun 1991 14:36:42 GREGG
+Save the current buffer if it has an exception OR unprocessed bytes.
+
+ Rev 1.3 18 Jun 1991 12:17:22 GREGG
+Removed process queue cleanup and forced rewind from Fatal Error processing.
+
+ Rev 1.2 06 Jun 1991 19:12:10 GREGG
+Save format environment after all successful operations.
+
+ Rev 1.1 10 May 1991 16:09:24 GREGG
+Ned's new stuff
+
+ Rev 1.0 10 May 1991 10:11:58 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+
+#include <stdtypes.h>
+#include <queues.h>
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tflopen.h"
+#include "lwprotos.h"
+#include "tflproto.h"
+#include "tflstats.h"
+#include "translat.h"
+#include "sx.h"
+
+/* Device Driver Interface Files */
+#include "retbuf.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+
+#include "be_debug.h"
+
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: TF_CloseTape
+
+ Description: Closes out a Tape operation for a given channel.
+
+ Modified: 9/28/1989 10:5:37
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID TF_CloseTape( UINT16 channel_no )
+{
+ CHANNEL_PTR channel = &lw_channels[channel_no] ;
+ BOOLEAN rewind ;
+
+ /* Close the drive */
+ if( channel->cur_drv->drv_hdl ) {
+ /* Tell the drive to rewind if requested and there is a tape */
+ rewind = ( BOOLEAN ) IsPosBitSet( channel->cur_drv, REW_CLOSE ) ;
+ DisMountTape( channel->cur_drv, channel->ui_tpos, rewind ) ;
+ ClrPosBit( channel->cur_drv, REW_CLOSE ) ;
+ }
+
+ ClrChannelStatus( channel, CH_IN_USE ) ;
+
+ lw_tfl_control.no_chans_open-- ;
+}
+
+
+/**
+
+ Name: TF_CloseSet
+
+ Description: Closes out a Tape operation for a given channel.
+
+ Modified: 9/28/1989 10:5:37
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID TF_CloseSet(
+ UINT16 channel_no,
+ TF_STATS_PTR setstats )
+{
+ CHANNEL_PTR channel = &lw_channels[channel_no] ;
+ BUF_PTR tmpBUF ;
+ Q_ELEM_PTR qe_ptr ;
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_TF_CLOSE_SET ) ;
+
+ /* No matter what do the SX stuff in case any drive in the channel was an SX */
+ SX_End( channel ) ;
+
+ /* A fatal error occured on this channel */
+ if( FatalError( channel ) ) {
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_FATAL_ERROR_DETECTED ) ;
+
+ PuntBuffer( channel ) ;
+
+ if( channel->eom_buff != NULL ) {
+ channel->cur_buff = channel->eom_buff ;
+ channel->eom_buff = NULL ;
+ PuntBuffer( channel ) ;
+ }
+
+ /* If another operation is tried on drive, we want a clean start */
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ channel->cur_drv->force_rewind = TRUE ;
+ }
+
+ /* If the translator is still alive, we need to keep some context info */
+ if ( channel->fmt_env != NULL ) {
+
+ /* If there is live data or an exception in the current buffer */
+ if( !IsSetDone( channel ) &&
+ channel->cur_buff != NULL &&
+ ( BM_BytesFree( channel->cur_buff ) != 0 ||
+ ( BM_ReadError( channel->cur_buff ) != GEN_NO_ERR &&
+ BM_ReadError( channel->cur_buff ) != GEN_ERR_NO_DATA ) ) ) {
+
+ /* hold on to the unprocessed buffer */
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_READ_BUFFER_LEFT_OVER ) ;
+ BM_Reserve( channel->cur_buff ) ; /* mark as reserved */
+ channel->cur_drv->hold_buff = channel->cur_buff ;
+ channel->cur_buff = NULL ;
+ }
+
+ /* save the current format environment */
+ channel->cur_drv->last_cur_fmt = channel->cur_fmt ;
+ channel->cur_drv->last_fmt_env = channel->fmt_env ;
+ channel->cur_fmt = UNKNOWN_FORMAT ;
+ channel->fmt_env = NULL ;
+
+ } else {
+ /* The translator bit the big one! Reset the buffer requirements */
+ /* to default so we'll allocate the proper size the next time we */
+ /* call TF_AllocateTapeBuffers. */
+ BM_SetListRequirements( &channel->buffer_list, &lw_default_bm_requirements );
+ }
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_NEW_LINE ) ;
+
+ PuntBuffer( channel ) ;
+
+ /* Clean up in process queue */
+ while( ( qe_ptr = DeQueueElem( &channel->cur_drv->inproc_q ) ) != NULL ) {
+ tmpBUF = QueuePtr( qe_ptr );
+ channel->cur_buff = tmpBUF ;
+ PuntBuffer( channel ) ;
+ }
+
+ /* Set up Statistics -- This is an example of a BWMPU */
+ if( setstats != NULL ) {
+ *setstats = channel->cur_drv->cur_stats ;
+ }
+
+ ClrChannelStatus( channel, CH_DONE ) ;
+}
diff --git a/private/utils/ntbackup/src/tfeject.c b/private/utils/ntbackup/src/tfeject.c
new file mode 100644
index 000000000..1348800e7
--- /dev/null
+++ b/private/utils/ntbackup/src/tfeject.c
@@ -0,0 +1,123 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+
+ Name: tfeject.c
+
+ Description: Contains the function to eject the tape from the
+ specified drive.
+
+
+ $Log: T:/LOGFILES/TFEJECT.C_V $
+
+ Rev 1.5 30 Mar 1993 16:15:36 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.4 18 Jan 1993 14:20:04 BobR
+Added MOVE_ESA macro calls(s)
+
+ Rev 1.3 20 Mar 1992 18:00:10 NED
+added exception updating after TpReceive calls
+
+ Rev 1.2 30 Oct 1991 11:29:16 GREGG
+BIGWHEEL - Changed TpSpecial call to TpEject/TpReceive and cleaned up some stuff.
+
+ Rev 1.1 23 Oct 1991 08:39:02 GREGG
+EPR #9 - Don't kill the hold_buff until after MountTape (we may still need it).
+
+ Rev 1.0 02 Oct 1991 14:07:24 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+
+#include "drive.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+#include "tflproto.h"
+#include "translat.h"
+#include "dil.h"
+#include "special.h"
+#include "generr.h"
+
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: TF_EjectTape
+
+ Description: This function rewinds the tape, resets the drive position,
+ and ejects the tape if the drive has the capability to do
+ this from software.
+
+ Returns: A TFLE_xxx error code.
+
+ Notes: None.
+
+ Declaration:
+
+**/
+
+INT16 TF_EjectTape( THW_PTR thw, /* (I) The drive to be ejected */
+ TPOS_HANDLER ui_tpos ) /* (I) For callback during */
+ /* rewind. */
+{
+ DRIVE_PTR curDRV = (DRIVE_PTR) thw ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN have_tape ;
+ RET_BUF myret ;
+
+ /* Note: These are used only for tpos handler! */
+ TPOS tpos_struct ;
+ TPOS_PTR tpos_ptr = NULL ;
+
+ msassert( curDRV != NULL ) ;
+
+ if( ui_tpos != NULL ) {
+ tpos_struct.UI_TapePosRoutine = ui_tpos ;
+ tpos_ptr = &tpos_struct ;
+ }
+ ret_val = MountTape( curDRV, tpos_ptr, &have_tape ) ;
+ if( ret_val == TFLE_NO_ERR || ret_val == TF_UNRECOGNIZED_MEDIA ) {
+ FreeFormatEnv( & curDRV->last_cur_fmt, & curDRV->last_fmt_env ) ;
+ if( curDRV->hold_buff != NULL ) {
+ BM_Put( curDRV->hold_buff ) ;
+ curDRV->hold_buff = NULL ;
+ }
+ if( have_tape ) {
+ if( ret_val != TF_UNRECOGNIZED_MEDIA ) {
+ ret_val = RewindDrive( curDRV, tpos_ptr, TRUE, TRUE, 0 ) ;
+ } else {
+ ret_val = TFLE_NO_ERR ;
+ }
+
+ if( ret_val == TFLE_NO_ERR &&
+ ( curDRV->thw_inf.drv_info.drv_features & TDI_UNLOAD ) ) {
+
+ if( TpEject( curDRV->drv_hdl ) == FAILURE ) {
+ ret_val = TFLE_DRIVER_FAILURE ;
+ } else {
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( thw->the, myret.the ) ;
+
+ if( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ }
+ }
+ }
+ DisMountTape( curDRV, NULL, FALSE ) ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
diff --git a/private/utils/ntbackup/src/tfinit.c b/private/utils/ntbackup/src/tfinit.c
new file mode 100644
index 000000000..c4c8cb005
--- /dev/null
+++ b/private/utils/ntbackup/src/tfinit.c
@@ -0,0 +1,501 @@
+/**/
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tfinit.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the High Level Tape Format Entry Points ( No I
+ Don't Know Why I'm Capitalizing ).
+
+
+ $Log: J:/LOGFILES/TFINIT.C_V $
+
+ Rev 1.33 23 Jul 1993 08:53:50 DON
+Needed to use 'calloc' instead of 'malloc' when allocating the software_name
+
+ Rev 1.32 22 Jul 1993 12:12:48 ZEIR
+ad'd software_name logic to OpenTapeFormat
+
+ Rev 1.31 18 Jan 1993 14:21:46 BobR
+Added MOVE_ESA macro call(s)
+
+ Rev 1.30 08 Oct 1992 15:20:16 GREGG
+Changed mallocs to callocs of n chars at sizeof( CHAR ) for Unicode support.
+
+ Rev 1.29 06 Oct 1992 13:23:40 DAVEV
+Unicode strlen verification
+
+ Rev 1.28 17 Aug 1992 08:42:26 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.27 27 Jul 1992 14:04:52 GREGG
+Fixed more warnings...
+
+ Rev 1.26 27 Jul 1992 12:55:40 GREGG
+Fixed more warnings...
+
+ Rev 1.25 05 Apr 1992 18:25:40 GREGG
+ROLLER BLADES - Changed lw_sx_file_path to lw_cat_file_path.
+
+ Rev 1.24 11 Mar 1992 14:49:04 GREGG
+If TF_NO_MAY_ID is defined, always call TpSpecial SS_NO_MAY_ID.
+
+ Rev 1.23 12 Feb 1992 16:25:54 STEVEN
+fix errors for NT
+
+ Rev 1.22 11 Feb 1992 17:11:16 NED
+changed buffman/translator interface parameters
+
+ Rev 1.21 04 Feb 1992 19:52:42 GREGG
+Changes for dealing with new config parameters.
+
+ Rev 1.20 16 Jan 1992 18:42:00 NED
+Skateboard: buffer manager changes
+
+ Rev 1.19 15 Jan 1992 00:46:16 GREGG
+Kludged in config stuffuntil we can fix it right.
+
+ Rev 1.18 14 Jan 1992 01:59:48 GREGG
+Skateboard bug fixes.
+
+ Rev 1.17 13 Jan 1992 19:39:30 NED
+Removed declaration of BM_AllocVCB()
+
+ Rev 1.16 13 Jan 1992 13:50:56 GREGG
+Skateboard - Bug fixes.
+
+ Rev 1.15 02 Jan 1992 14:53:10 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.14 03 Dec 1991 11:45:42 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.13 17 Oct 1991 01:29:48 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.12 15 Oct 1991 07:49:50 GREGG
+Added ThreadSwitch call in empty TpReceive loops.
+
+ Rev 1.11 14 Oct 1991 11:08:58 GREGG
+Modified handling of busy poll state in CloseTapeFormat.
+
+ Rev 1.10 07 Oct 1991 16:03:50 GREGG
+Free lw_channel before setting it to NULL in Close. (might help eh?)
+
+ Rev 1.9 23 Sep 1991 15:41:22 GREGG
+8200SX - Added forced_machine_type parameter.
+
+ Rev 1.8 18 Sep 1991 11:58:18 GREGG
+Handle drive being polled as well as drive being watched at close time.
+Defined out allocation for DriverDirectoryName for NLM, and freed the
+allocated memory in DeInit for everyone else.
+
+ Rev 1.7 06 Aug 1991 13:22:32 DON
+ifdef'd calls DriverLoad & SetActiveMSL for OS_NLM
+
+ Rev 1.6 26 Jul 1991 16:05:20 GREGG
+Changed MAYN_ defs to OS_ defs.
+
+ Rev 1.5 18 Jul 1991 13:58:56 DAVIDH
+Ignore int86 calls for NLM
+
+ Rev 1.4 27 Jun 1991 15:47:46 NED
+Removed reference to "config.h" and CDS_GetMaynFolder(),
+added parameter to end of list.
+
+ Rev 1.3 06 Jun 1991 20:59:04 GREGG
+Added translator environment initialization to open, and a call to free any
+existing environments in close.
+
+ Rev 1.2 20 May 1991 10:30:48 DAVIDH
+Cleared up compiler warnings under Watcom for NLM.
+
+ Rev 1.1 10 May 1991 16:08:34 GREGG
+Ned's new stuff
+
+ Rev 1.0 10 May 1991 10:12:06 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+
+#include <malloc.h>
+#include <string.h>
+#include <dos.h>
+#include <conio.h> /* Strange, but contains inp(), etc. */
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "machine.h"
+
+#include "fsys.h"
+#include "be_debug.h"
+#include "tfldefs.h"
+#include "tflproto.h"
+#include "channel.h"
+#include "drive.h"
+#include "buffman.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+#include "translat.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "genstat.h"
+#include "dil.h"
+#include "ld_dvr.h"
+#include "detdrive.h"
+#include "lstdres.h"
+#include "lwdefs.h"
+
+#if !defined( OS_NLM )
+
+static CHAR_PTR DriverDirectory( VOID ) ;
+static CHAR_PTR DriverDirectoryName = NULL ;
+
+#endif
+
+#if !defined( TDEMO ) && !defined( OS_NLM )
+
+static STD_RESOURCES_INIT stdres = {
+#if !defined( OS_OS2 ) && !defined( OS_WIN32 )
+ intdosx,
+ free,
+ memset,
+ inp,
+ inpw,
+ outp,
+ outpw,
+ calloc,
+ int86,
+ int86x,
+#endif
+ DriverLoad,
+ DriverDirectory /* our static function */
+} ;
+
+#endif /* TDEMO and OS_NLM */
+
+/**/
+/**
+ * Unit: Tape Format
+ *
+ * Name: TF_OpenTapeFormat
+ *
+ * Modified: Tuesday, December 17, 1991
+ *
+ * Description: This function initializes the Tape Format Layer and sets
+ * up all the interface structures. One buffer is allocated
+ * per channel for the purpose of reading new tapes from
+ * TF_PollDrive().
+ *
+ * Notes:
+ *
+ * Returns: INT16, a TFLE_xxx code
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+INT16 TF_OpenTapeFormat(
+ CHAR_PTR drv_file , /* The device driver file to load */
+ DIL_HWD_PTR cards , /* The array of cards */
+ UINT16 no_cards , /* The number of cards */
+ THW_PTR *thw_ptr , /* Where to build the THW list */
+ INT16 max_channels , /* The maximum number of channels */
+ BOOLEAN use_fast_file, /* FALSE if FF to be suppressed */
+ BOOLEAN ignore_id , /* Operate on non Maynard Drives */
+ CHAR_PTR directory_name, /* for TDH */
+ INT16 forced_machine_type, /* 8200SX stuff */
+ CHAR_PTR catalog_directory, /* for SX files */
+ UINT16 initial_buff_alloc, /* DOS memory allocated at init */
+ CHAR_PTR software_name ) /* Name of software we're running */
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ INT16 i ;
+#if !defined( TDEMO ) && !defined( OS_NLM )
+ DRIVERHANDLE msl ;
+#endif
+
+ if( catalog_directory != NULL ) {
+ lw_cat_file_path = calloc( strlen( catalog_directory ) + SX_FILE_NAME_LENGTH + 1, sizeof( CHAR ) ) ;
+ if ( lw_cat_file_path == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ strcpy( lw_cat_file_path, catalog_directory ) ;
+ lw_cat_file_path_end = lw_cat_file_path + strlen( lw_cat_file_path ) ;
+ }
+
+ if( software_name != NULL ){
+ lw_software_name_len = strlen( software_name ) ;
+ lw_software_name = calloc( lw_software_name_len + 1, sizeof( CHAR ) ) ;
+ if( lw_software_name == NULL ){
+ lw_software_name_len = 0 ;
+ return TFLE_NO_MEMORY ;
+ }
+ strcpy( lw_software_name, software_name ) ;
+ }
+
+#if !defined( OS_NLM )
+
+ /* save driver directory name in private memory */
+ if ( DriverDirectoryName != NULL ) {
+ free( DriverDirectoryName ) ;
+ }
+ DriverDirectoryName = calloc( strlen( directory_name ) + 1, sizeof( CHAR ) ) ;
+ if ( DriverDirectoryName == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ strcpy( DriverDirectoryName, directory_name ) ;
+
+#else
+
+ (VOID) directory_name ; /* Reference to avoid compiler warnings. */
+
+#endif
+
+#if !defined( TDEMO ) && !defined( OS_NLM )
+
+ /* load the device driver */
+ if( drv_file != NULL ) {
+ if( ( lw_tfl_control.driver_addr = ( VOID_PTR ) DriverLoad( drv_file,&msl,&stdres,sizeof( stdres ) ) ) == NULL ) {
+ return( TFLE_DRIVER_LOAD_FAILURE ) ;
+ }
+ SetActiveMSL( msl ) ;
+ }
+
+#else
+
+ (VOID) drv_file; /* Reference to avoid compiler warnings. */
+
+#endif
+
+ /* Set up the pointer to the controller cards */
+ lw_tfl_control.cntl_cards = cards ;
+
+#if defined( TF_NO_MAY_ID )
+ TpSpecial( 0, SS_NO_MAY_ID, 0L ) ;
+#else
+ if( ignore_id ) {
+ TpSpecial( (INT16)0, (INT16)SS_NO_MAY_ID, 0L ) ;
+ }
+#endif
+
+ if( forced_machine_type != UNKNOWN_MACHINE ) {
+ TpSpecial( (INT16)0, (INT16)SS_FORCE_MACHINE_TYPE, (UINT32)forced_machine_type ) ;
+ }
+
+ lw_tfl_control.use_fast_file = use_fast_file ;
+ if( ( ret_val = SetupDriveList( cards, (INT16)no_cards ) ) == TFLE_NO_ERR ) {
+ lw_tfl_control.drives_active = TRUE ;
+ }
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_CRIT_ADDRS,
+ lw_tfl_control.driver_addr,
+ lw_channels ) ;
+
+ *thw_ptr = (THW_PTR)(VOID_PTR)QueueHead( &lw_drive_list ) ;
+
+ /* Initialize Buffer Manager */
+ BM_Init( ) ;
+
+ BM_ClearRequirements( &lw_default_bm_requirements );
+
+ /* Ask translators for their default VCB buffer requirements */
+ TF_GetVCBBufferRequirements( &lw_default_vcb_requirements,
+ QueueHead( &lw_drive_list ), TF_DEFAULT_VCB_SIZE ) ;
+ BM_SetVCBRequirements( &lw_default_vcb_requirements );
+
+ /* Allocate memory for channels */
+ if ( ( lw_channels = calloc( (size_t)max_channels, sizeof(CHANNEL) ) ) == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ lw_tfl_control.no_channels = (UINT16)max_channels ;
+
+ /* For each channel */
+ for ( i = 0 ; i < max_channels && ret_val == TFLE_NO_ERR ; i++ ) {
+ /* initialize the translator environment and index */
+ lw_channels[i].cur_fmt = UNKNOWN_FORMAT ;
+ lw_channels[i].fmt_env = NULL ;
+
+ /* initialize the temporary DBLK storage poiters */
+ lw_channels[i].lst_osvcb = NULL ;
+ lw_channels[i].lst_osddb = NULL ;
+ lw_channels[i].lst_osfdb = NULL ;
+
+ /* initialize channel's buffer list */
+ if( ( ret_val = BM_InitList( &lw_channels[i].buffer_list, initial_buff_alloc ) ) == TFLE_NO_ERR ) {
+ /* allocate one buffer for VCB reading */
+ if ( BM_AllocVCB( &lw_channels[i].buffer_list ) == NULL ) {
+ ret_val = TFLE_NO_MEMORY ;
+ }
+ }
+ }
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: TF_CloseTapeFormat
+
+ Description: Close the tape format layer
+
+ Returns: Nothing.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+VOID TF_CloseTapeFormat( VOID )
+{
+ DRIVE_PTR curDRV = (DRIVE_PTR)(VOID_PTR)QueueHead( &lw_drive_list ) ;
+ RET_BUF myret ;
+ UINT i ;
+
+ /* Rewind All The Drives */
+ if( lw_tfl_control.drives_active ) {
+
+ while( curDRV != NULL ) {
+
+ /* Was this drive watched */
+ if( IsPosBitSet( curDRV, WATCHED ) ||
+ curDRV->poll_stuff.state != st_CLOSED ) {
+
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( curDRV->thw_inf.the, myret.the ) ;
+
+ ClrPosBit( curDRV, WATCHED ) ;
+ }
+
+ if( curDRV->poll_stuff.state != st_BSTAT ) {
+ if( curDRV->poll_stuff.state != st_BMNT ||
+ myret.gen_error == GEN_NO_ERR ) {
+
+ if( curDRV->poll_stuff.state != st_CLOSED ) {
+ /* Remember we lied in PollDrive */
+ curDRV->tape_mounted = TRUE ;
+ }
+
+ DisMountTape( curDRV, NULL, FALSE ) ;
+ }
+ }
+
+ curDRV->poll_stuff.state = st_CLOSED ;
+
+ /* If there is a hold_buff, it will be handled in BM_DeInit */
+ curDRV->hold_buff = NULL ;
+
+ /* free the format environment if any */
+ if ( curDRV->last_fmt_env != NULL ) {
+ FreeFormatEnv( & curDRV->last_cur_fmt, & curDRV->last_fmt_env ) ;
+ }
+
+ lw_channels[0].cur_drv = curDRV ;
+
+ /* Close the Drive */
+ CloseDrive( curDRV, NULL, (UINT16)0, (BOOLEAN)(!( curDRV->thw_inf.drv_status & TPS_NO_TAPE ) ) ) ;
+
+ curDRV = (DRIVE_PTR)(VOID_PTR)QueueNext( &curDRV->thw_inf.link ) ;
+ }
+ lw_tfl_control.drives_active = FALSE ;
+ }
+
+ /* reset layer-wide requirements */
+ BM_ClearRequirements( &lw_default_bm_requirements );
+ BM_ClearRequirements( &lw_default_vcb_requirements );
+
+ /* free all the remaining buffers */
+ BM_DeInit( ) ;
+
+
+ /* Release the drivers */
+ if( lw_tfl_control.driver_inited ) {
+ TpRelease( ) ;
+ lw_tfl_control.driver_inited = FALSE ;
+ }
+
+ if( lw_tfl_control.driver_addr != NULL ) {
+
+#if !defined( OS_OS2 ) && !defined( TDEMO ) && !defined( OS_NLM )
+
+ DriverUnLoad( ( VOID_PTR ) lw_tfl_control.driver_addr ) ;
+
+#endif
+
+ lw_tfl_control.driver_addr = NULL ;
+ }
+
+ /* Free the stuff */
+ if( lw_channels ) {
+ for( i = 0; i < lw_tfl_control.no_channels; i++ ) {
+ if( lw_channels[i].lst_osvcb != NULL ) {
+ free( lw_channels[i].lst_osvcb ) ;
+ }
+ if( lw_channels[i].lst_osddb != NULL ) {
+ free( lw_channels[i].lst_osddb ) ;
+ }
+ if( lw_channels[i].lst_osfdb != NULL ) {
+ free( lw_channels[i].lst_osfdb ) ;
+ }
+ }
+
+ free( lw_channels ) ;
+ lw_channels = NULL ;
+ }
+ if( lw_drives ) {
+ free( lw_drives ) ;
+ lw_drives = NULL ;
+ }
+
+ if( lw_cat_file_path ) {
+ free( lw_cat_file_path ) ;
+ lw_cat_file_path = NULL ;
+ lw_cat_file_path_end = NULL ;
+ }
+
+ if( lw_software_name ){
+ free( lw_software_name ) ;
+ lw_software_name = NULL ;
+ lw_software_name_len = 0 ;
+ }
+
+#if !defined( OS_NLM )
+
+ if ( DriverDirectoryName != NULL ) {
+ free( DriverDirectoryName ) ;
+ DriverDirectoryName = NULL ;
+ }
+
+#endif
+
+}
+
+#if !defined( OS_NLM )
+
+static CHAR_PTR DriverDirectory( VOID )
+{
+ return DriverDirectoryName ;
+}
+
+#endif
+
diff --git a/private/utils/ntbackup/src/tflutils.c b/private/utils/ntbackup/src/tflutils.c
new file mode 100644
index 000000000..0237d796d
--- /dev/null
+++ b/private/utils/ntbackup/src/tflutils.c
@@ -0,0 +1,1384 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tflutils.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains various Tape Format Layers.
+
+
+ $Log: T:/LOGFILES/TFLUTILS.C_V $
+
+ Rev 1.56.1.0 02 Mar 1994 18:16:16 GREGG
+Fixed buffer resize logic.
+
+ Rev 1.56 16 Feb 1994 19:20:46 GREGG
+Fixed error in filemark count caculation when MoveFilemarks goes backward.
+
+ Rev 1.55 04 Feb 1994 12:26:12 GREGG
+Fixed bug in buff resize logic when attempting to determine the proper
+block size to read the tape.
+
+ Rev 1.54 28 Jan 1994 11:26:36 GREGG
+Handle GEN_ERR_UNRECOGNIZED_MEDIA returned on reads as well as mounts.
+
+ Rev 1.53 03 Dec 1993 01:04:18 GREGG
+Call memcmp instead of strncmp for Unicode compatability.
+
+ Rev 1.52 01 Dec 1993 18:40:54 ZEIR
+Ad'd MS SQL_Determiner logic
+
+ Rev 1.51 30 Nov 1993 20:44:14 GREGG
+Fixed some error reporting and the stepping on of a boolean.
+
+ Rev 1.50 10 Nov 1993 18:05:04 GREGG
+Check for error return from SetDrvBlkSize.
+
+ Rev 1.49 20 Oct 1993 18:36:42 GREGG
+Don't set channel fatal status in ReadABuff unless error is TFLE.
+
+ Rev 1.48 21 Aug 1993 03:50:02 GREGG
+Translate GEN_ERR_NO_DATA as TF_NO_MORE_DATA in MoveFileMarks, and let
+the translator determine if it's an error.
+
+ Rev 1.47 12 Jul 1993 17:22:10 GREGG
+Get drv_info again after 1st read to make sure we have the right block size.
+
+ Rev 1.46 30 Jun 1993 09:03:22 GREGG
+Don't skip the default size when scanning for the right block size.
+
+ Rev 1.45 19 May 1993 19:03:54 DON
+Don't continue to use cur_buff if it's NULL in ReadABuff
+
+ Rev 1.44 26 Apr 1993 11:45:50 GREGG
+Seventh in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Changed handling of EOM processing during non-OTC EOS processing.
+
+Matches CHANNEL.H 1.17, MAYN40RD.C 1.60, TFWRITE.C 1.63, MTF.H 1.5,
+ TFLUTILS.C 1.44, MTF10WDB.C 1.10, MTF10WT.C 1.9
+
+ Rev 1.43 15 Apr 1993 23:23:22 ZEIR
+357.0235 - Unitialized locals in ReadNewTape causing later problems w/ buffer
+allocation.
+
+ Rev 1.42 14 Apr 1993 01:59:54 GREGG
+Fixes to deal with non-ffr tapes in ffr drives (i.e. EXB2200 in EXB5000).
+
+ Rev 1.41 31 Mar 1993 16:03:28 GREGG
+Added GEN_ERR_UNRECONIZED_MEDIA to MapGenErr2UIMesg.
+
+ Rev 1.40 17 Mar 1993 14:50:56 GREGG
+This is Terri Lynn. Added Gregg's changes for switching a tape drive's
+block mode to match the block size of the current tape.
+
+ Rev 1.39 09 Mar 1993 18:15:22 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.38 04 Feb 1993 18:48:48 DON
+Don't set the buffer size to stream size if variable length stream
+
+ Rev 1.37 30 Jan 1993 11:51:28 DON
+Removed compiler warnings
+
+ Rev 1.36 20 Jan 1993 17:33:48 BobR
+Changes to MOVE_ESA macro calls
+
+ Rev 1.35 18 Jan 1993 14:27:28 BobR
+Added MOVE_ESA macro calls
+
+ Rev 1.34 11 Nov 1992 22:27:14 GREGG
+Unicodeized literals.
+
+ Rev 1.33 22 Oct 1992 15:53:16 HUNTER
+New Stream Stuff
+
+ Rev 1.32 22 Sep 1992 09:14:14 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.31 17 Aug 1992 09:01:18 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.30 06 Aug 1992 12:09:06 BURT
+Fixed GetData.. to force 1K logical blocks instead of 512 byte physical
+for allocations.
+
+
+ Rev 1.29 27 Jul 1992 13:01:08 GREGG
+Fixed more warnings...
+
+ Rev 1.28 31 May 1992 14:20:56 GREGG
+Sped up DumpDebug.
+
+ Rev 1.27 29 May 1992 15:19:50 GREGG
+Don't set PBA in VCB unless position info isn't available, then make sure its 0.
+
+ Rev 1.26 21 May 1992 16:17:40 GREGG
+Expect TFLE_xxx return values from DetBlockType and GetCurrentVCB.
+
+ Rev 1.25 29 Apr 1992 13:05:54 GREGG
+ROLLER BLADES - Changes for new EOM handling.
+
+ Rev 1.24 25 Mar 1992 17:45:54 GREGG
+ROLLER BLADES - Added 64 bit support.
+
+ Rev 1.23 20 Mar 1992 18:01:48 NED
+added exception updating after TpReceive calls
+
+ Rev 1.22 20 Mar 1992 14:29:46 NED
+added WRITE PROTECT handling to MapGenErr
+
+ Rev 1.21 19 Feb 1992 17:13:58 GREGG
+In ReadABuff, if we can't get a regular buffer, use the VCB buffer.
+
+ Rev 1.20 08 Feb 1992 14:28:48 GREGG
+Removed references to lst_oper in drive stucture (it no longer exits).
+
+ Rev 1.19 25 Jan 1992 15:22:18 GREGG
+Clear AT_EOD pos bit in MoveFileMarks if we are going backward.
+
+ Rev 1.18 03 Jan 1992 13:19:06 NED
+Added DumpDebug() call
+
+ Rev 1.17 02 Jan 1992 14:57:24 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.16 05 Dec 1991 13:49:30 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.15 04 Nov 1991 18:54:06 GREGG
+Check return from Tp calls. Cleaned up error handling in MoveFileMarks.
+
+ Rev 1.14 17 Oct 1991 01:24:26 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.13 19 Sep 1991 13:26:42 GREGG
+Oops! Set the format to new before calling Setup in ReadNewTape.
+
+ Rev 1.12 17 Sep 1991 13:37:02 GREGG
+Fixed logic in ReadNewTape to properly handle continuations.
+
+ Rev 1.11 23 Aug 1991 16:59:38 GREGG
+fixed BM_ macro edit problem in PuntBuffer
+
+ Rev 1.10 22 Aug 1991 16:40:40 NED
+Changed all references to internals of the buffer structure to macros.
+
+ Rev 1.9 14 Aug 1991 13:40:16 GREGG
+Update fmk count even if an error is encountered in MoveFileMarks.
+
+ Rev 1.8 30 Jul 1991 15:36:52 GREGG
+Included 'dddefs.h'.
+
+ Rev 1.7 22 Jul 1991 13:09:16 GREGG
+Removed unneeded call to UI tape positioner and setting of REW_CLOSE bit on
+unexpected EOM from MoveFileMarks routine.
+
+ Rev 1.6 15 Jul 1991 15:18:04 NED
+In new tape processing, if we are looking for a continuation tape, and we get
+a tape with a different format, force a Wrong Tape error, and don't free the
+old format.
+
+ Rev 1.5 09 Jul 1991 16:13:18 NED
+Changed GotoBckUpSet to handle inconsistent set numbering across format changes.
+
+ Rev 1.4 26 Jun 1991 16:25:00 NED
+changed EOS/MOS handling in MoveToVCB
+fixed position update in MoveToVCB
+
+ Rev 1.3 17 Jun 1991 11:41:34 NED
+maintained EOS/MOS status in ReadABuff
+added REW_CLOSE logic to error handling
+added BE_Zprintf messages
+
+ Rev 1.2 06 Jun 1991 22:56:20 NED
+Inherited all the tape positioning routines from drives.c, and made major
+changes to them to deal, in a clean manner, with problems caused by Teac's
+refusal to move over multiple filemark without reads in between, and the
+wonderful concept of appending 3.1 sets to 2.5 tapes! Also added a function
+to map format ID's to their indicies in the table.
+
+ Rev 1.1 10 May 1991 16:17:20 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:12:18 GREGG
+Initial revision.
+
+**/
+#include <string.h>
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "queues.h"
+#include "drive.h"
+#include "channel.h"
+#include "buffman.h"
+#include "fsys.h"
+#include "lwprotos.h"
+#include "tfl_err.h"
+#include "translat.h"
+#include "tfl_err.h"
+#include "lw_data.h"
+#include "sx.h"
+#include "minmax.h"
+
+#include "be_debug.h"
+
+/* Device Driver InterFace Headers */
+#include "retbuf.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "dddefs.h"
+#include "dil.h"
+#include "special.h"
+
+
+INT16 SQL_Determiner( CHANNEL_PTR channel ) ;
+
+
+/**/
+/**
+
+ Name: MapGenErr2UIMesg
+
+ Description: Maps a Generic error returned from the device driver into
+ a UI Message. If value is negative, then the error was fatal
+ and the returned value is a TFLE error.
+
+ Returns: A signed integer representing either a UI message or a
+ a fatal Tape Format Layer Error ( TFLE ).
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 MapGenErr2UIMesg(
+ INT16 gen_error ) /* The Generic error returned from the driver */
+{
+ INT16 ret_val = 0 ;
+
+ switch( gen_error ) {
+
+ case GEN_ERR_TIMEOUT:
+ case GEN_ERR_INVALID_CMD:
+ case GEN_ERR_HARDWARE:
+ case GEN_ERR_UNDETERMINED:
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+
+ case GEN_ERR_NO_MEDIA:
+ ret_val = TF_NO_TAPE_PRESENT ;
+ break ;
+
+ case GEN_ERR_EOM:
+ ret_val = TF_NEED_NEW_TAPE ;
+ break ;
+
+ case GEN_ERR_BAD_DATA:
+ case GEN_ERR_WRONG_BLOCK_SIZE:
+ ret_val = TF_READ_ERROR ;
+ break ;
+
+ case GEN_ERR_ENDSET:
+ break ;
+
+ case GEN_ERR_NO_DATA:
+ ret_val = TF_NO_MORE_DATA ;
+ break ;
+
+ case GEN_ERR_RESET:
+ break ;
+
+ case GEN_ERR_WRT_PROTECT:
+ ret_val = TFLE_WRITE_PROTECT ;
+ break ;
+
+ case GEN_ERR_UNRECOGNIZED_MEDIA:
+ ret_val = TFLE_UNRECOGNIZED_MEDIA ;
+ break ;
+
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: GetDBLKMapStorage
+
+ Description: Points channel->map_entry to the next available space
+ in the DBLK map. If there isn't enough space to add
+ another entry, an attempt is made to realloc additional
+ space.
+
+ Returns: TFLE_xxx error code.
+
+ Notes: The initial allocation will almost always be ample, and
+ the reallocation request is small. So if your failing
+ on attempts in this function, chances are your problem
+ is something other than a simple low memory condition.
+
+**/
+
+INT16 GetDBLKMapStorage(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* check for enough remaining size for map entry */
+ if( ( BM_NoDblks( buffer ) + 1 ) * sizeof( DBLKMAP ) > BM_AuxSize( buffer ) ) {
+ ret_val = BM_ReallocAux( &channel->buffer_list, buffer ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ channel->map_entry = (DBLKMAP_PTR)BM_AuxBase( buffer ) +
+ BM_NoDblks( buffer ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: GetDATAStorage
+
+ Description: Allocates a chunk of a buffer for a data space.
+
+ Returns: A pointer to the space, or a NULL if no space is available.
+
+ Notes: THIS DOES NOT UPDATE THE COUNTS IN THE BUFFER, YOU MUST
+ CALL "BM_UpdCnts" to do that.
+
+ Declaration:
+
+**/
+
+UINT8_PTR GetDATAStorage(
+ CHANNEL_PTR channel, /* I - the current channel */
+ UINT16_PTR size_avail_ptr ) /* O - Where I store the buffer size */
+{
+ UINT8_PTR tmp_ptr = NULL ;
+
+ if ( BM_BytesFree( channel->cur_buff ) != 0 ) {
+ tmp_ptr = (UINT8_PTR)BM_NextBytePtr( channel->cur_buff ) ;
+
+ if( U64_LT( channel->current_stream.size,
+ U32_To_U64( (UINT32)BM_BytesFree( channel->cur_buff ) ) ) &&
+ ! ( channel->current_stream.tf_attrib & STREAM_VARIABLE ) ) {
+
+ *size_avail_ptr = (UINT16)U64_Lsw( channel->current_stream.size ) ;
+ } else {
+ *size_avail_ptr = BM_BytesFree( channel->cur_buff ) ;
+ }
+ } else {
+ *size_avail_ptr = 0 ;
+ }
+
+ return( tmp_ptr ) ;
+}
+
+
+/**/
+/**
+
+ Name: SnagBuffer
+
+ Description: This functions attempts for get a buffer from the pool
+ and, updates the channel counts.
+
+ Returns: A Pointer to the buffer, or NULL if one wasn't allocated.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+BUF_PTR SnagBuffer( CHANNEL_PTR channel ) /* I/O - channel pointer */
+{
+ if( channel->cur_buff == NULL ) {
+ channel->cur_buff = BM_Get( &channel->buffer_list ) ;
+ }
+ return( channel->cur_buff ) ;
+}
+
+/**/
+/**
+
+ Name: PuntBuffer
+
+ Description: Puts the current channels buffer back on the free queue.
+
+ Returns: Nothing.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+VOID PuntBuffer( CHANNEL_PTR channel ) /* I/O - channel pointer */
+{
+ if( channel->cur_buff != NULL ) {
+ if( channel->cur_fmt != UNKNOWN_FORMAT ) {
+ channel->blocks_used +=
+ ( BM_NextByteOffset( channel->cur_buff )
+ + BM_BytesFree( channel->cur_buff ) )
+ / channel->lb_size ;
+ }
+ BM_Put( channel->cur_buff ) ;
+ channel->cur_buff = NULL ;
+ }
+}
+
+
+/**/
+/**
+
+ Name: ReadABuff
+
+ Description: Read in a single buffer
+
+ Returns: TFLE_xxx codes
+
+ Notes: factored out of ReadNextSet code
+
+ Declaration:
+
+**/
+INT16 ReadABuff(
+ CHANNEL_PTR channel,
+ BOOLEAN try_resize,
+ BOOLEAN_PTR resized_buff )
+{
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ INT size_index = 0 ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ RET_BUF myret ;
+ UINT32 eos_mos_state = curDRV->pos_inf & ( AT_EOS | AT_MOS ) ;
+ BOOLEAN done = FALSE ;
+ UINT16 def_size = ChannelBlkSize( channel ) ;
+
+ *resized_buff = FALSE ;
+
+ if( SnagBuffer( channel ) == NULL ) {
+ channel->cur_buff = BM_GetVCBBuff( &channel->buffer_list ) ;
+ }
+
+ if ( channel->cur_buff == NULL ) {
+ msassert(FALSE);
+ return TFLE_NO_MEMORY;
+ }
+
+ BM_InitBuf( channel->cur_buff ) ;
+ ClrPosBit( curDRV, ( AT_EOS | AT_MOS ) ) ;
+ ClrChannelStatus( channel, CH_DONE ) ;
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_TP_READ ) ;
+
+ while( !done ) {
+ done = TRUE ;
+ if( TpRead( drv_hdl, BM_XferBase( channel->cur_buff ), (UINT32)BM_XferSize( channel->cur_buff ) ) == FAILURE ) {
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ ret_val = TFLE_DRIVER_FAILURE ;
+ break ;
+ }
+ while( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ /* for non-preemptive operating systems: */
+ ThreadSwitch( ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_DRV_ERROR_BYTES_RCVD, myret.gen_error, myret.len_req, myret.len_got ) ;
+ BM_SetBytesFree( channel->cur_buff, (UINT16)myret.len_got ) ;
+ BM_SetReadError( channel->cur_buff, myret.gen_error ) ;
+
+ if( myret.gen_error ) {
+ channel->cur_drv->thw_inf.drv_status = myret.status ;
+ DumpDebug( drv_hdl ) ;
+ ret_val = MapGenErr2UIMesg( myret.gen_error ) ;
+
+ /* This is to handle the erasure of tape by placing a
+ filemark at the head of them.
+ */
+ if( ( myret.len_got == 0L &&
+ myret.gen_error == GEN_ERR_ENDSET ) ||
+ myret.gen_error == GEN_ERR_NO_DATA ) {
+
+ /* If we got no data, we be where we was. */
+ SetPosBit( curDRV, eos_mos_state ) ;
+ ret_val = TF_NO_MORE_DATA ;
+
+ } else if( myret.gen_error == GEN_ERR_UNRECOGNIZED_MEDIA ) {
+ ret_val = TF_UNRECOGNIZED_MEDIA ;
+
+ } else if( IsTFLE( ret_val ) && ret_val != TFLE_UNRECOGNIZED_MEDIA ) {
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+
+ if( myret.gen_error == GEN_ERR_ENDSET ||
+ myret.gen_error == GEN_ERR_EOM ) {
+
+ channel->cur_drv->cur_pos.fmks++ ;
+ }
+
+ /* This is to deal with drives which don't have any idea what
+ block size the tape was written with. It is only done on
+ the initial read. If the gen_error is WRONG_BLOCK_SIZE,
+ we go through a list of valid sizes in an attempt to find
+ the right size to read the tape. If we exhaust the list,
+ we report it as a FOREIGN tape.
+ */
+ if( myret.gen_error == GEN_ERR_WRONG_BLOCK_SIZE ) {
+
+ ClrChannelStatus( channel, CH_FATAL_ERR ) ;
+
+ if( !try_resize || size_index == lw_num_blk_sizes ) {
+ if( try_resize ) {
+ ret_val = SetDrvBlkSize( channel,
+ channel->cur_buff,
+ def_size,
+ resized_buff ) ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = TF_INVALID_VCB ;
+ }
+ } else {
+ if( ( ret_val = RewindDrive( curDRV, NULL, FALSE, TRUE, 0 ) ) == TFLE_NO_ERR ) {
+ ret_val = SetDrvBlkSize( channel,
+ channel->cur_buff,
+ lw_blk_size_list[size_index],
+ resized_buff ) ;
+ size_index++ ;
+ done = FALSE ;
+ }
+ }
+ }
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: MoveNextSet
+
+ Description: Moves to the next set and reads a buffer.
+
+ Returns:
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 MoveNextSet(
+ CHANNEL_PTR channel,
+ TPOS_PTR ui_tpos )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ DBLK_PTR hld_dblk = NULL ;
+ BOOLEAN need_a_buff = FALSE ;
+ BOOLEAN dummy ;
+ BE_Zprintf(0, TEXT("MoveNextSet( cur_fmt=%d )\n"), channel->cur_fmt) ;
+
+ if ( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ goto error ;
+ }
+
+ ClrPosBit( curDRV, AT_EOD ) ;
+ hld_dblk = channel->cur_dblk ;
+
+ /* If both the Beginning of Tape and the End of Set bits are set, on
+ entrance to this function, We are no longer at BOT Set */
+ if( ( IsPosBitSet( curDRV, AT_BOT ) && IsPosBitSet( curDRV, AT_EOS ) ) ) {
+ ClrPosBit( curDRV, AT_BOT ) ;
+ }
+
+ if ( ( ret_val = MoveToVCB( channel, (INT16)1, & need_a_buff, FALSE ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+
+ if( need_a_buff ) {
+ if ( ( ret_val = ReadABuff( channel, FALSE, &dummy ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+ }
+
+ /* here for error processing */
+error :
+
+ if( ret_val == TF_NO_MORE_DATA ) {
+ SetPosBit( curDRV, AT_EOD ) ;
+ }
+
+ channel->cur_dblk = hld_dblk ;
+
+ BE_Zprintf(0, TEXT("MoveNextSet() return=%d\n"), ret_val) ;
+
+ return( ret_val ) ;
+ (VOID)ui_tpos;
+}
+/**/
+/**
+
+ Name: ReadThisSet
+
+ Description: Called with buffer in channel->cur_buff, reads current
+ VCB.
+
+ Returns: TFLE_xxxx code.
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 ReadThisSet( CHANNEL_PTR channel ) /* The current Channel */
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ DBLK_PTR hld_dblk ;
+ UINT16 blk_type ;
+
+ BE_Zprintf( 0, TEXT("ReadThisSet( cur_fmt=%d )\n"), channel->cur_fmt ) ;
+
+ hld_dblk = channel->cur_dblk ;
+
+ msassert( channel->cur_fmt != UNKNOWN_FORMAT ) ;
+
+ if( ( ret_val = DetBlockType( channel, channel->cur_buff, &blk_type ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+ if( blk_type == BT_CVCB ) {
+ ret_val = TF_NEED_NEW_TAPE ;
+ goto error ;
+ }
+
+ /* handle appended dissimilar sets */
+
+ if ( VerifyVCB( channel, channel->cur_buff ) == FALSE ) {
+ FreeFormatEnv( &( channel->cur_fmt ), &( channel->fmt_env ) ) ;
+ if( ( channel->cur_fmt = DetermineFormat( BM_XferBase( channel->cur_buff ),
+ (UINT32)BM_BytesFree( channel->cur_buff ) ) ) == UNKNOWN_FORMAT ) {
+ curDRV->vcb_valid = FALSE ;
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_UNKNOWN_FMT ;
+ goto error ;
+ }
+ if( ( ret_val = SetupFormatEnv( channel ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+ }
+
+ /* now get the VCB */
+ channel->cur_dblk = & curDRV->cur_vcb ;
+
+ if ( ( ret_val = GetCurrentVCB( channel, channel->cur_buff ) ) != TFLE_NO_ERR ) {
+ curDRV->vcb_valid = FALSE ;
+ goto error ;
+ }
+
+ /* We Know The block type & It's a VCB, so tell the drive */
+ curDRV->vcb_valid = TRUE ;
+ curDRV->cur_pos.lba_vcb = FS_ViewLBAinDBLK( channel->cur_dblk ) ;
+
+ /* We need to supply 0 for pba_vcb for those translators
+ * which don't support Fast File Restore.
+ */
+ if( !( lw_fmtdescr[channel->cur_fmt].attributes & POS_INF_AVAIL ) ) {
+ FS_SetPBAinVCB( channel->cur_dblk, 0 ) ;
+ }
+
+ /* if the SX was looking for a VCB during a tape scan now we know it found one */
+ if( SupportSXShowBlk( channel->cur_drv ) && SX_IsStatusSet( channel, SX_LIST_TAPE_IN_PROGRESS ) ) {
+
+ if( SX_IsStatusSet( channel, SX_VCB_PENDING ) ) {
+ SX_SetType( channel, SX_VCB_CONFIRMED ) ;
+ }
+ }
+
+ /* here for error processing */
+error :
+
+ channel->cur_dblk = hld_dblk ;
+
+ BE_Zprintf( 0, TEXT("ReadThisSet() return=%d\n"), ret_val ) ;
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: ReadNewTape
+
+ Description: Gets an initial buffer from a new tape, prior to
+ calling ReadThisSet().
+
+ Returns: TFLE_xxx code
+
+ Notes: The 'try_resize' flag sent to ReadABuff is to deal with
+ drives which don't have any idea what block size the
+ tape was written with. Here are the cases in which
+ ReadNewTape is called, and how we deal with each:
+
+ 1. Called by PollDrive - 'read_tape' will be FALSE,
+ and PollDrive will have taken care of adjusting the
+ block size.
+ 2. Called in read mode - Allow resize.
+ 3. Called in read-continue mode - If the block size
+ doesn't match, this can't be the right continuation
+ tape. Don't allow resize.
+ 4. Called in write mode - Allow resize. Note that
+ whether they overwrite or append, we're going to
+ stick with the block size the tape was originally
+ written with.
+ 5. Called in write-continue mode - Allow resize, but
+ after tape is read, change back to the original
+ size. Note that if they want to overwrite the tape
+ we must write the same block size as we did on the
+ previous tape, and if they don't want to overwrite
+ it there is no more need to read it.
+
+ Declaration:
+
+**/
+INT16 ReadNewTape(
+ CHANNEL_PTR channel, /* The current Channel */
+ TPOS_PTR ui_tpos, /* So I can tell him I'm doing something */
+ BOOLEAN read_tape )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ DBLK_PTR hld_dblk ;
+ BOOLEAN need_a_buff = FALSE ;
+ BOOLEAN try_resize = FALSE ;
+ BOOLEAN resized_buff = FALSE ;
+ UINT16 new_fmt = UNKNOWN_FORMAT ;
+ BOOLEAN write_mode = FALSE ;
+ BOOLEAN cont_mode = FALSE ;
+ UINT16 save_size = ChannelBlkSize( channel ) ;
+ BOOLEAN dummy ;
+
+ if( ( ( channel->mode & ~0x8000 ) == TF_WRITE_OPERATION ) ||
+ ( ( channel->mode & ~0x8000 ) == TF_WRITE_APPEND ) ) {
+ write_mode = TRUE ;
+ }
+ cont_mode = IsChannelStatus( channel, CH_CONTINUING ) ? TRUE : FALSE ;
+
+ ClrPosBit( curDRV, AT_EOD ) ;
+ hld_dblk = channel->cur_dblk ;
+
+ if ( read_tape ) {
+
+ try_resize = ( DriveAttributes( curDRV ) & TDI_CHNG_BLK_SIZE ) ? TRUE : FALSE ;
+
+ if ( ( ret_val = ReadABuff( channel, try_resize, &resized_buff ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+
+ if ( BM_BytesFree( channel->cur_buff ) == 0 ) {
+ ret_val = TF_EMPTY_TAPE ;
+ goto error ;
+ }
+ }
+
+ if( TpSpecial( curDRV->drv_hdl, (INT16)SS_GET_DRV_INF, ( UINT32 )&curDRV->thw_inf.drv_info ) == FAILURE ) {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ goto error ;
+ }
+
+ /* see if format has changed */
+
+ new_fmt = DetermineFormat( BM_XferBase( channel->cur_buff ), (UINT32)BM_BytesFree( channel->cur_buff ) ) ;
+
+ if( new_fmt == UNKNOWN_FORMAT &&
+ (ret_val = SQL_Determiner( channel )) != TFLE_NO_ERR ){
+ goto error ;
+ }
+
+ /* Note: If we are continuing, but the cur_fmt is UNKNOWN then we are */
+ /* in write mode, and we treat this like a new tape with no */
+ /* prior context information known. */
+
+ if( IsChannelStatus( channel, CH_CONTINUING ) && channel->cur_fmt != UNKNOWN_FORMAT ) {
+ if( new_fmt != channel->cur_fmt ) {
+ ret_val = TF_WRONG_TAPE ; /* obviously wrong! */
+ goto error ;
+ }
+ } else {
+ if( new_fmt == UNKNOWN_FORMAT ) {
+ FreeFormatEnv( &( channel->cur_fmt ), &( channel->fmt_env ) ) ;
+ curDRV->vcb_valid = FALSE ;
+ ret_val = TF_INVALID_VCB ;
+ goto error ;
+ }
+ if( new_fmt != channel->cur_fmt ) {
+ FreeFormatEnv( &( channel->cur_fmt ), &( channel->fmt_env ) ) ;
+ channel->cur_fmt = new_fmt ;
+ if( ( ret_val = SetupFormatEnv( channel ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+ }
+ }
+
+ if ( ( ret_val = NewTape( channel, &need_a_buff ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+
+ if( need_a_buff ) {
+ if ( ( ret_val = ReadABuff( channel, FALSE, &dummy ) ) != TFLE_NO_ERR ) {
+ goto error ;
+ }
+ }
+ channel->blocks_used = 0 ;
+
+error :
+
+ if( ret_val != TFLE_NO_ERR ) {
+ if( try_resize ) {
+ SetDrvBlkSize( channel, channel->cur_buff,
+ save_size, &resized_buff ) ;
+ }
+ } else if( write_mode && cont_mode ) {
+ if( try_resize && ChannelBlkSize( channel ) != save_size ) {
+ ret_val = SetDrvBlkSize( channel, channel->cur_buff,
+ save_size, &resized_buff ) ;
+ }
+ } else {
+ if( resized_buff ) {
+ (BM_ListRequirements( &channel->buffer_list ))->a.min_size =
+ (UINT16)lw_blk_size_list[lw_num_blk_sizes-1] ;
+ ret_val = BM_ReSizeList( &channel->buffer_list ) ;
+ }
+ }
+
+ if( ret_val == TF_NO_MORE_DATA ) {
+ SetPosBit( curDRV, AT_EOD ) ;
+ }
+
+ channel->cur_dblk = hld_dblk ;
+
+ return( ret_val ) ;
+ (VOID)ui_tpos;
+}
+/**/
+/**
+
+ Name: GotoBckUpSet
+
+ Description: This function attempts to move smartly to a backup set. It
+ is assumed that the the tape id has been matched and the
+ tape sequence is also correct.
+
+ Called from PositionAtSet().
+
+ Returns: An Error Code.
+
+ Notes: THE "cur_vcb" IN THE DRIVE STRUCTURE MUST BE VALID BEFORE
+ CALLING THIS ROUTINE. THAT IS, IT MUST CONTAIN THE CURRENT
+ VCB. FURTHER, THERE MUST BE A VALID BUFFER STORE IN THE CHANNEL.
+**/
+
+INT16 GotoBckUpSet(
+ CHANNEL_PTR channel,
+ INT16_PTR desired_set_ptr,
+ TPOS_PTR ui_tpos )
+{
+ INT16 desired_set = *desired_set_ptr ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ DBLK_PTR dblk = &curDRV->cur_vcb ;
+ BOOLEAN need_read = FALSE ;
+ INT16 sets_to_move ;
+ UINT16 original_format = channel->cur_fmt ;
+ BOOLEAN resized_buff ;
+ enum {
+ gbs_START = 0,
+ gbs_SEEKING_FORWARD,
+ gbs_MOVING_BACKWARD,
+ gbs_CHECKING_FIRST_SET,
+ gbs_READING_SET_DATA,
+ gbs_MAKING_VCB,
+ gbs_END
+ } state = gbs_START ;
+
+ sets_to_move = desired_set - FS_ViewBSNumInVCB( (VOID_PTR)dblk ) ;
+
+ BE_Zprintf( 0, TEXT("GotoBckUpSet( desired=%d, this=%d )\n"), desired_set, desired_set-sets_to_move ) ;
+
+ while ( state != gbs_END ) {
+
+ BE_Zprintf(0, TEXT(" state %d, %d sets to go\n"), (INT16)state, sets_to_move) ;
+
+ switch ( state ) {
+
+ case gbs_START:
+ if ( sets_to_move > 0 ) {
+ state = gbs_SEEKING_FORWARD ;
+ } else {
+ state = gbs_MOVING_BACKWARD ;
+ }
+ break ;
+
+ case gbs_SEEKING_FORWARD:
+ ret_val = MoveNextSet( channel, ui_tpos ) ;
+ if ( ret_val == TFLE_NO_ERR ) {
+ ret_val = ReadThisSet( channel ) ;
+ }
+ if ( ret_val == TFLE_NO_ERR ) {
+ /* check to see if we have a discrepancy. */
+ if ( --sets_to_move != desired_set - FS_ViewBSNumInVCB( (VOID_PTR)dblk ) ) {
+ if ( channel->cur_fmt != original_format ) { /* we changed translators */
+ *desired_set_ptr = desired_set = FS_ViewBSNumInVCB( (VOID_PTR)dblk ) ; /* this is the one! */
+ } else {
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ }
+ state = gbs_END ;
+ }
+ }
+ if ( sets_to_move == 0 || ret_val != TFLE_NO_ERR ) {
+ state = gbs_END ;
+ } else {
+ if ( ui_tpos != NULL ) {
+ ui_tpos->UI_TapePosRoutine( TF_ACCIDENTAL_VCB, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, channel->mode ) ;
+ }
+ }
+ break ;
+
+ case gbs_MOVING_BACKWARD:
+ ret_val = MoveToVCB( channel, sets_to_move, &need_read, FALSE ) ;
+ if ( ret_val == TF_NEED_REWIND_FIRST ) {
+ state = gbs_CHECKING_FIRST_SET ;
+ } else if ( ret_val == TFLE_NO_ERR ) {
+ if ( need_read ) {
+ state = gbs_READING_SET_DATA ;
+ } else {
+ state = gbs_MAKING_VCB ;
+ }
+ } else { /* some error */
+ state = gbs_END ;
+ }
+ break ;
+
+ case gbs_CHECKING_FIRST_SET:
+ if ( ( ( ret_val = RewindDrive( channel->cur_drv, ui_tpos, TRUE, TRUE, channel->mode ) ) == TFLE_NO_ERR )
+ && ( ( ret_val = ReadNewTape( channel, ui_tpos, TRUE ) ) == TFLE_NO_ERR )
+ && ( ( ret_val = ReadThisSet( channel ) ) == TFLE_NO_ERR ) ) {
+ sets_to_move = desired_set - FS_ViewBSNumInVCB( (VOID_PTR)dblk ) ;
+ if ( sets_to_move == 0 ) {
+ state = gbs_END ;
+ } else if ( sets_to_move > 0 ) {
+ state = gbs_SEEKING_FORWARD ;
+ } else { /* wrong tape? bad tape? */
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ state = gbs_END ;
+ }
+ } else { /* some error */
+ state = gbs_END ;
+ }
+ break ;
+
+
+ case gbs_READING_SET_DATA:
+ if ( ( ret_val = ReadABuff( channel, FALSE, &resized_buff ) ) != TFLE_NO_ERR ) {
+ state = gbs_END ;
+ } else {
+ state = gbs_MAKING_VCB ;
+ }
+ break ;
+
+ case gbs_MAKING_VCB:
+ if ( ( ret_val = ReadThisSet( channel ) ) == TFLE_NO_ERR ) {
+ sets_to_move = desired_set - FS_ViewBSNumInVCB( (VOID_PTR)dblk ) ;
+ if ( sets_to_move == 0 ) {
+ state = gbs_END ;
+ } else if ( sets_to_move > 0 ) {
+ state = gbs_SEEKING_FORWARD ;
+ } else { /* need to move backwards? */
+ state = gbs_CHECKING_FIRST_SET ;
+ }
+ } else {
+ state = gbs_END ;
+ }
+ break ;
+
+ default:
+ msassert( FALSE ) ; /* can't happen */
+ break ;
+
+ }
+ }
+
+ if ( ret_val == TFLE_NO_ERR ) {
+ if ( desired_set != FS_ViewBSNumInVCB( (VOID_PTR)dblk ) ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ }
+ }
+
+ BE_Zprintf( 0, TEXT("GotoBckUpSet( ) return=%d\n"), ret_val ) ;
+
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: MoveFileMarks
+
+ Description: Used by translators' MoveToVCB routines to move
+ forward or backward by given number of filemarks.
+ Does not interpret filemarks.
+
+ Returns: TFLE_xxx code
+
+ Notes: Punts channel buffer. If trying to reverse skip on
+ a drive that doesn't support it, calls RewindDrive
+ and recurses with forward motion.
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 MoveFileMarks(
+ CHANNEL_PTR channel,
+ INT16 number, /* how many file marks */
+ INT16 direction ) /* BACKWARD or FORWARD */
+{
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ TPOS_PTR ui_tpos = channel->ui_tpos ;
+ INT16 drv_hdl = curDRV->drv_hdl ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ RET_BUF myret ;
+ INT16 new_fmks ;
+
+ BE_Zprintf( 0, TEXT("MoveFileMarks( %d )\n"), number * (( direction==FORWARD ) ? 1 : -1 ) ) ;
+
+ PuntBuffer( channel ) ; /* Put the current buffer if any */
+
+ if ( number == 0 ) {
+ return ret_val ;
+ }
+ if( ui_tpos != NULL ) {
+ ui_tpos->UI_TapePosRoutine( TF_SEARCHING, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, channel->mode ) ;
+ }
+
+ if ( direction == BACKWARD ) {
+ ClrPosBit( curDRV, AT_EOD ) ;
+ new_fmks = (INT16)curDRV->cur_pos.fmks - number ;
+ if ( new_fmks < 0 ) {
+ return TFLE_UNEXPECTED_EOM ;
+ }
+ if ( ( new_fmks > 0 ) && ( curDRV->thw_inf.drv_info.drv_features & TDI_REV_FMK ) ) {
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_READ_END_SET ) ;
+ if( TpReadEndSet( drv_hdl, number, direction ) == FAILURE) {
+ ret_val = TFLE_DRIVER_FAILURE ;
+ }
+
+ /* Now while away the hours */
+ while( ret_val == TFLE_NO_ERR && TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ if( ui_tpos != NULL ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+
+ if( (*ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, channel->mode )
+ == UI_ABORT_POSITIONING ) {
+ ret_val = TFLE_USER_ABORT ;
+ }
+ }
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if( ret_val == TFLE_NO_ERR && myret.gen_error ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ if( myret.gen_error == GEN_ERR_NO_DATA || myret.gen_error == GEN_ERR_BAD_DATA ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_BAD_TAPE ;
+ } else if ( myret.gen_error == GEN_ERR_EOM ) {
+ ret_val = TFLE_UNEXPECTED_EOM ;
+ } else {
+ ret_val = MapGenErr2UIMesg( myret.gen_error ) ;
+ }
+ /* Note: myret.misc holds the number of fmks NOT skipped. */
+ number -= (INT16)myret.misc ;
+ }
+
+ /* make sure we're on the EOM side of the filemark. */
+ if ( ret_val == TFLE_NO_ERR ) {
+ number-- ;
+ if( TpReadEndSet( drv_hdl, (INT16)1, (INT16)FORWARD ) == FAILURE ) {
+ ret_val = TFLE_DRIVER_FAILURE ;
+ }
+ }
+
+ } else { /* fake reverse motion */
+ if ( ( ret_val = RewindDrive( curDRV, ui_tpos, TRUE, TRUE, channel->mode ) ) == TFLE_NO_ERR ) {
+ if ( new_fmks > 0 ) {
+ ret_val = MoveFileMarks( channel, new_fmks, (INT16)FORWARD ) ;
+ }
+ }
+ return ret_val ;
+ }
+ } else {
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_READ_END_SET ) ;
+ if( TpReadEndSet( drv_hdl, number, direction ) == FAILURE) {
+ ret_val = TFLE_DRIVER_FAILURE ;
+ }
+ }
+
+ /* Now while away the hours */
+ while( ret_val == TFLE_NO_ERR && TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ if( ui_tpos != NULL ) {
+ /* Move ESA info directly to TPOS instead of going through
+ THW for optimal speed */
+ MOVE_ESA( ui_tpos->the, myret.the ) ;
+
+ if( (*ui_tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, ui_tpos, curDRV->vcb_valid, &curDRV->cur_vcb, channel->mode )
+ == UI_ABORT_POSITIONING ) {
+ ret_val = TFLE_USER_ABORT ;
+ }
+ }
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ BE_Zprintf(DEBUG_TAPE_FORMAT, RES_DRV_RET, myret.gen_error ) ;
+ if( myret.gen_error ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ DumpDebug( drv_hdl ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR && myret.gen_error != GEN_NO_ERR ) {
+ if( myret.gen_error == GEN_ERR_BAD_DATA ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_BAD_TAPE ;
+ } else if ( myret.gen_error == GEN_ERR_EOM ) {
+ ret_val = TFLE_UNEXPECTED_EOM ;
+ } else {
+ ret_val = MapGenErr2UIMesg( myret.gen_error ) ;
+ }
+ /* Note: myret.misc holds the number of fmks NOT skipped. */
+ number -= (INT16)myret.misc ;
+ }
+
+ if ( direction == FORWARD ) {
+ curDRV->cur_pos.fmks += (UINT32)number ;
+ } else {
+ curDRV->cur_pos.fmks -= (UINT32)number ;
+ }
+
+ if ( ret_val == TFLE_NO_ERR ) {
+ curDRV->cur_pos.lba = 0 ;
+ }
+
+ BE_Zprintf( 0, TEXT("MoveFileMarks( ) return=%d\n"), ret_val ) ;
+
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: FormatIndexFromID
+
+ Description: given format ID, returns format table index
+
+ Returns: format table index, or UNKNOWN_FORMAT
+
+ Notes:
+
+**/
+
+UINT16 FormatIndexFromID( UINT16 format_id )
+{
+ UINT16 i ;
+
+ for ( i = 0; i < lw_num_supported_fmts; i++ ) {
+ if ( lw_fmtdescr[i].format_id == format_id ) {
+ return i ;
+ }
+ }
+ return UNKNOWN_FORMAT ;
+}
+
+/**/
+/**
+ * Unit: Tape Format
+ *
+ * Name: DumpDebug
+ *
+ * Modified: Friday, January 3, 1992
+ *
+ * Description: Given the drive handle, prints first 32 bytes of the
+ * last sense data buffer in the debug window.
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID DumpDebug( INT16 drv_hdl )
+{
+ UINT8 sense_data[256] ; /* area to contain raw sense data */
+ UINT16 i ;
+
+ for ( i = 0; i < 32; i++ ) { /* clear first 32 bytes of buffer */
+ sense_data[i] = 0 ;
+ }
+
+ TpSpecial( drv_hdl, (INT16)SS_LAST_STATUS, ( UINT32 )&sense_data ) ;
+
+ BE_Zprintf( 0, TEXT("\nSense Data =\n")) ;
+ BE_Zprintf( 0, TEXT(" %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n"),
+ sense_data[0], sense_data[1], sense_data[2], sense_data[3],
+ sense_data[4], sense_data[5], sense_data[6], sense_data[7],
+ sense_data[8], sense_data[9], sense_data[10], sense_data[11],
+ sense_data[12], sense_data[13], sense_data[14], sense_data[15] ) ;
+ BE_Zprintf( 0, TEXT(" %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n"),
+ sense_data[16], sense_data[17], sense_data[18], sense_data[19],
+ sense_data[20], sense_data[21], sense_data[22], sense_data[23],
+ sense_data[24], sense_data[25], sense_data[26], sense_data[27],
+ sense_data[28], sense_data[29], sense_data[30], sense_data[31] ) ;
+}
+
+
+/**
+
+ Name: SetDrvBlkSize
+
+ Description:
+
+ Returns: TFLE_xxx code
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 SetDrvBlkSize(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT32 size,
+ BOOLEAN_PTR resized_buff )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+
+ *resized_buff = FALSE ;
+ if( TpSpecial( curDRV->drv_hdl, SS_CHANGE_BLOCK_SIZE, size ) != SUCCESS ) {
+ ret_val = TFLE_DRIVE_FAILURE ;
+ } else {
+ curDRV->thw_inf.drv_info.drv_bsize = (UINT16)size ;
+ if( BM_XferSize( buffer ) % size != 0 ) {
+ *resized_buff = TRUE ;
+ lw_default_vcb_requirements.a.min_size =
+ lw_default_vcb_requirements.tf_size =
+ lw_default_vcb_requirements.rw_size =
+ (UINT16)lw_blk_size_list[lw_num_blk_sizes-1] ;
+ BM_SetVCBRequirements( &lw_default_vcb_requirements ) ;
+
+ if( !BM_IsVCBBuff( buffer ) ) {
+ (BM_ListRequirements( &channel->buffer_list ))->a.min_size
+ = (UINT16)lw_blk_size_list[lw_num_blk_sizes-1] ;
+ }
+ ret_val = BM_ReSizeBuff( buffer, &channel->buffer_list ) ;
+ }
+ }
+ return( ret_val ) ;
+}
+
+
+/**
+ *
+ * Unit: Tape Format
+ *
+ * Name: SQL_Determiner
+ *
+ * Modified: 12/01/93
+ *
+ * Description: Determines whether we're dealing w/ an MS SQL tape
+ *
+ * Notes:
+ *
+ * Returns: TF_SQL_TAPE - if MS SQL tape
+ * TFLE_NO_ERR - otherwise, unless ReadABuff fails, in which
+ * case we return ReadABuff's excuse
+ *
+ * Global Data: None
+ *
+**/
+
+
+typedef struct {
+ UINT8 std_label[4],
+ volume_name[6],
+ access,
+ reserved[68],
+ ansi_version ;
+} SQL_VOL, *SQL_VOL_PTR ;
+
+typedef struct {
+ UINT8 hdr1_60[60],
+ syscode[8] ;
+} SQL_HDR1, *SQL_HDR1_PTR ;
+
+
+INT16 SQL_Determiner(
+
+ CHANNEL_PTR channel
+)
+{
+ SQL_VOL_PTR sql = (SQL_VOL *)BM_XferBase( channel->cur_buff ) ;
+ SQL_HDR1_PTR hdr ;
+ INT16 ret_val ;
+ BOOLEAN dummy ;
+
+
+ /* DO NOT UNICODIZE THE FOLLOWING CONSTANTS!!! */
+ if( memcmp( sql->std_label, "VOL1", 4 ) ||
+ memcmp( sql->volume_name, "SQ", 2 ) ){
+
+ return TFLE_NO_ERR ;
+ }
+
+ BM_UpdCnts( channel->cur_buff, channel->cur_drv->thw_inf.drv_info.drv_bsize ) ;
+
+ if( !BM_BytesFree( channel->cur_buff ) &&
+ ( ret_val = ReadABuff( channel, FALSE, &dummy ) ) != TFLE_NO_ERR ){
+
+ return ret_val ;
+ }
+
+ hdr = (SQL_HDR1 *)BM_NextBytePtr( channel->cur_buff ) ;
+
+ /* DO NOT UNICODIZE THE FOLLOWING CONSTANT!!! */
+ return memcmp( hdr->syscode, "MSSQL ", 8 ) ? TFLE_NO_ERR : TF_SQL_TAPE ;
+}
diff --git a/private/utils/ntbackup/src/tfopen.c b/private/utils/ntbackup/src/tfopen.c
new file mode 100644
index 000000000..5047c4bde
--- /dev/null
+++ b/private/utils/ntbackup/src/tfopen.c
@@ -0,0 +1,394 @@
+/**/
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tfopen.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the TF_OpenSet() call.
+
+
+ $Log: T:\logfiles\tfopen.c_v $
+
+ Rev 1.37 15 Dec 1993 18:32:56 GREGG
+Make sure channel->cur_buff is NULL when we start. This is a kludge fix
+for a bug found at Microsoft. We need to find out why we're coming into
+TF_OpenSet with a non-null cur_buff, becase this should never happen!
+
+ Rev 1.36 24 Sep 1993 19:31:10 GREGG
+Clear the current_stream structure in the channel before each new operation.
+
+ Rev 1.35 30 Mar 1993 16:15:20 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.34 09 Mar 1993 18:14:22 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.33 23 Feb 1993 20:08:10 DON
+Update to calculate hi-water after we've allocated the buffers
+
+ Rev 1.32 11 Nov 1992 10:53:44 GREGG
+Unicodeized literals.
+
+ Rev 1.31 20 Oct 1992 13:59:46 HUNTER
+Deleted references to data stuff in channel.
+
+ Rev 1.30 29 May 1992 15:16:38 GREGG
+Check for CAN_READ_FROM_VCB_BUFF to see if we need to rewind before positioning.
+
+ Rev 1.29 21 May 1992 13:18:50 GREGG
+Initialize new channel element.
+
+ Rev 1.28 05 Apr 1992 18:59:50 GREGG
+Free format env before calling setup as setup won't do it any more.
+
+ Rev 1.27 28 Mar 1992 18:36:42 GREGG
+ROLLER BLADES - OTC - Initial integration.
+
+ Rev 1.26 25 Mar 1992 15:44:32 GREGG
+ROLLER BLADES - Added 64 bit support.
+
+ Rev 1.25 24 Feb 1992 15:18:06 GREGG
+Split TF_OpenSet into TF_OpenTape and TF_OpenSet.
+
+ Rev 1.24 19 Feb 1992 17:08:34 GREGG
+Added vcb_only parameter, and passed it on to PositionAtSet.
+
+ Rev 1.23 08 Feb 1992 14:26:58 GREGG
+Changed check for lst_oper == -1 to check for boolean force_rewind, since
+this is what the lst_oper field in the drive structure had been reduced to.
+
+ Rev 1.22 04 Feb 1992 21:07:58 NED
+Fixed bug in High Water calculation.
+
+ Rev 1.21 16 Jan 1992 18:42:48 NED
+Skateboard: buffer manager changes
+
+ Rev 1.20 15 Jan 1992 01:40:14 GREGG
+Added param to posatset calls indicating if only a VCB of the tape is required.
+
+ Rev 1.19 13 Jan 1992 19:40:44 NED
+Added re-size of list to default requirements and
+conditional freeing of VCB buffer.
+
+ Rev 1.18 13 Jan 1992 16:15:42 NED
+corrected call to BM_IsVCBBuff()
+
+ Rev 1.17 13 Jan 1992 13:50:26 GREGG
+Skateboard - Bug fixes.
+
+ Rev 1.16 09 Jan 1992 15:06:36 ZEIR
+TF_OpenSet now initializes pad_size to 0 !
+
+ Rev 1.15 03 Dec 1991 18:55:40 GREGG
+Call PositionAtSet even if there isn't a tape in the drive (he handles it).
+
+ Rev 1.14 03 Dec 1991 11:44:32 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.13 04 Nov 1991 17:16:08 GREGG
+Count the hold buffer among the buffs used.
+
+ Rev 1.12 23 Oct 1991 08:41:28 GREGG
+BIGWHEEL - EPR #8 - Uninitialized tpos ptr was being sent to RewindDrive.
+
+ Rev 1.11 17 Oct 1991 01:29:16 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.10 14 Oct 1991 11:01:06 GREGG
+Modifications to more properly deal with the mount process.
+
+ Rev 1.9 07 Oct 1991 22:18:44 GREGG
+Make sure the fmt env pointers are maintained in only one place at any given time.
+
+ Rev 1.8 17 Sep 1991 11:44:02 GREGG
+Expect TFLE_xxx return from SetupFormatEnv.
+Don't throw away Hold Buffer after write operation.
+Be smarter about tape mounting and status checking.
+
+ Rev 1.7 28 Aug 1991 09:49:36 GREGG
+Mark vcb as invalid on fatal error exit from TF_OpenSet.
+
+ Rev 1.6 15 Jul 1991 15:06:16 NED
+Removed reference to unused channel status bits; added clear of CH_CONTINUING.
+
+ Rev 1.5 10 Jul 1991 16:30:02 NED
+Properly freed environment, translator, etc. when tape changed
+or removed between TF_CloseSet() and TF_OpenSet(). Added code
+to take Archive QIC drives into account.
+
+ Rev 1.4 17 Jun 1991 11:44:02 NED
+deleted SHORT_SET logic
+caught failure of SetupFormatEnv() as NO_MEMORY error
+
+ Rev 1.3 10 Jun 1991 13:53:24 GREGG
+Don't free the format env. unless we have a fatal error on the channel.
+
+ Rev 1.2 06 Jun 1991 22:25:10 GREGG
+Various changes to handling of format environment.
+
+ Rev 1.1 10 May 1991 16:08:06 GREGG
+Ned's new stuff
+
+ Rev 1.0 10 May 1991 10:12:12 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include <string.h>
+#include <stdtypes.h>
+#include <queues.h>
+#include "stdmath.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwdefs.h"
+#include "tflopen.h"
+#include "lwprotos.h"
+#include "tflproto.h"
+#include "translat.h"
+#include "sx.h"
+
+/* Device Driver Interface Files */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "genstat.h"
+#include "dil.h"
+
+#include "be_debug.h"
+
+/**/
+/**
+
+ Name: TF_OpenTape
+
+ Description: Opens a channel for an operation. This is the first call
+ that must be made before any subsequent operation can take
+ place.
+
+ Returns: INT16, a TFLE_xxx code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 TF_OpenTape(
+ INT16_PTR channel_no, /* channel number */
+ THW_PTR sdrv, /* starting drive */
+ TPOS_PTR tape_position ) /* position info */
+{
+ UINT16 i ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ CHANNEL_PTR channel = NULL ;
+ BOOLEAN is_tape_present ;
+
+ BE_Zprintf( 0, TEXT("TF_OpenTape()\n") ) ;
+
+ for( i = 0 ; i < lw_tfl_control.no_channels ; i++ ) {
+ if( !InUse( &lw_channels[i] ) ) {
+ tape_position->channel = *channel_no = i ;
+ channel = &lw_channels[i] ;
+ break ;
+ } else {
+ ret_val = TFLE_NO_FREE_CHANNELS ;
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+
+ /* No matter what this channel is open */
+ channel->status = CH_IN_USE ; /* clear all other channel status bits */
+ lw_tfl_control.no_chans_open++ ;
+ channel->cur_drv = (DRIVE_PTR)(VOID_PTR)sdrv ;
+
+ if( channel->cur_drv->tape_mounted ) {
+ msassert( FALSE ) ;
+ } else {
+ ret_val = MountTape( channel->cur_drv, tape_position, &is_tape_present ) ;
+ }
+ }
+
+ /* if there is an error */
+ if ( ret_val != TFLE_NO_ERR && channel != NULL ) {
+
+ if( ret_val == TF_UNRECOGNIZED_MEDIA ) {
+ ret_val = TFLE_UNRECOGNIZED_MEDIA ;
+ }
+
+ /* then handle as fatal error */
+ channel->cur_drv->vcb_valid = FALSE ;
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**
+
+ Name: TF_OpenSet
+
+ Description: Opens a channel for an operation. This is the first call
+ that must be made before any subsequent operation can take
+ place.
+
+ Returns: INT16, a TFLE_xxx code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 TF_OpenSet(
+ TFL_OPBLK_PTR open_info, /* The opening Parameter Stuff */
+ BOOLEAN vcb_only ) /* Caller doesn't intend to go into read or write loop */
+{
+ UINT16 index ;
+ INT16 nbuffs ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ CHANNEL_PTR channel ;
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_TF_OPEN_SET ) ;
+
+ channel = &lw_channels[open_info->channel] ;
+
+ /* Setup Starting drive for this channel before taking care of the SX stuff */
+ channel->cur_drv = (DRIVE_PTR)(VOID_PTR)open_info->sdrv ;
+
+ /* No matter what do the SX stuff in case any drive in the channel is an SX */
+ channel->sx_info.cat_enabled = open_info->cat_enabled ;
+ SX_Begin( channel, open_info->mode ) ;
+
+ /* Initialize important local channel variables */
+ channel->perm_filter = open_info->perm_filter ;
+ channel->cur_fsys = open_info->fsh ;
+ /* strip off the operation bits from the mode */
+ channel->mode = open_info->mode & ~TF_OPERATION_MASK ;
+ channel->eom_id = 0L ;
+ channel->hiwater = channel->buffs_enqd = 0 ;
+ channel->retranslate_size = CH_NO_RETRANSLATE_40 ;
+ channel->blocks_used = 0L ;
+ channel->read_from_tape = TRUE ;
+ channel->hold_buff = NULL ;
+ memset( &channel->current_stream, 0, sizeof( STREAM_INFO ) ) ;
+ if( channel->cur_buff != NULL ) {
+ BM_Put( channel->cur_buff ) ;
+ channel->cur_buff = NULL ;
+ }
+
+ if ( channel->cur_drv->last_fmt_env != NULL ) {
+ channel->cur_fmt = channel->cur_drv->last_cur_fmt ;
+ channel->fmt_env = channel->cur_drv->last_fmt_env ;
+ channel->cur_drv->last_cur_fmt = UNKNOWN_FORMAT ;
+ channel->cur_drv->last_fmt_env = NULL ;
+ }
+
+ if( channel->cur_drv->hold_buff != NULL ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_HOLD_BUFFER ) ;
+ channel->cur_buff = channel->cur_drv->hold_buff ;
+ BM_UnReserve( channel->cur_buff );
+ channel->cur_drv->hold_buff = NULL ;
+ }
+
+ /* The last set of conditions indicates we were using a vcb-only
+ buffer and have a format which can't start reading from it,
+ so we need to rewind and re-read.
+ */
+ if( ( channel->cur_drv->thw_inf.drv_status & ( TPS_NEW_TAPE | TPS_RESET | TPS_NO_TAPE ) )
+ || channel->cur_drv->force_rewind
+ || open_info->rewind_sdrv
+ || ( channel->cur_buff != NULL
+ && BM_IsVCBBuff( channel->cur_buff )
+ && !vcb_only
+ && !( lw_fmtdescr[ channel->cur_fmt ].attributes & CAN_READ_FROM_VCB_BUFF ) ) ) {
+
+ channel->cur_drv->force_rewind = FALSE ;
+ if( channel->cur_buff ) {
+ BM_Put( channel->cur_buff ) ;
+ channel->cur_buff = NULL ;
+ }
+
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ if( !( channel->cur_drv->thw_inf.drv_status & ( TPS_NO_TAPE ) ) ) {
+ ret_val = RewindDrive( channel->cur_drv, open_info->tape_position, TRUE, TRUE, channel->mode ) ;
+ }
+ }
+
+ /* if we have no valid translator */
+ if ( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ /* re-size the list to defaults */
+ BM_SetListRequirements( &channel->buffer_list, &lw_default_bm_requirements );
+ BM_ReSizeList( &channel->buffer_list );
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ /* Okie-Dokie ... find that backup set */
+ channel->ui_tpos = open_info->tape_position ;
+ ClrPosBit( channel->cur_drv, NO_STAT ) ;
+ ret_val = PositionAtSet( channel, open_info->tape_position, vcb_only ) ;
+ }
+
+ if ( ret_val == TFLE_NO_ERR ) {
+ /* if we're in a write mode */
+ if ( channel->mode == TF_WRITE_OPERATION ||
+ channel->mode == TF_WRITE_CONTINUE ||
+ channel->mode == TF_WRITE_APPEND ) {
+
+ /* then set the write format */
+ index = FormatIndexFromID( open_info->wrt_format ) ;
+ msassert( index != UNKNOWN_FORMAT ) ;
+ msassert( ( lw_fmtdescr[index].attributes&WT_FORMAT_BIT ) == WT_FORMAT_BIT ) ;
+ if ( ( channel->mode == TF_WRITE_APPEND ) &&
+ ( ! ( lw_fmtdescr[channel->cur_fmt].attributes&APPEND_SUPPORTED ) ) ) {
+ /* BAD IDEA !!! */
+ msassert( FALSE ) ;
+ return TFLE_PROGRAMMER_ERROR1 ;
+ }
+ if( channel->cur_fmt != index ) {
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ channel->cur_fmt = index ;
+ }
+ ret_val = SetupFormatEnv( channel ) ;
+ }
+ }
+
+ /* if there is an error */
+ if ( ret_val != TFLE_NO_ERR ) {
+
+ /* if it's not a user condition (handled in positioner) */
+ if ( ret_val != TFLE_USER_ABORT && ret_val != TFLE_UI_HAPPY_ABORT ) {
+
+ /* then handle as fatal error */
+ FreeFormatEnv( &( channel->cur_fmt ), &( channel->fmt_env ) ) ;
+ channel->cur_drv->vcb_valid = FALSE ;
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+ } else {
+ /* Set the channel hi-water mark */
+ /* are we in non-DMA mode? */
+ if ( lw_tfl_control.cntl_cards[ channel->cur_drv->thw_inf.card_no ].card_attribs & DD_CARD_NON_ASYNC ) {
+ channel->hiwater = 1;
+ } else {
+ /* DMA mode */
+ /* set channel hi-water mark to 3/4 * (number_of_buffers-1) */
+ nbuffs = BM_ListCount( &channel->buffer_list );
+ channel->hiwater = ( nbuffs >= 4 ) ? ( ( nbuffs - 1 ) * 3/4 ) : nbuffs ;
+ }
+ }
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_END_OF_TFOPEN_SET, ret_val,
+ BM_ListCount( &channel->buffer_list ), channel->hiwater ) ;
+
+ return( ret_val ) ;
+}
diff --git a/private/utils/ntbackup/src/tfpoll.c b/private/utils/ntbackup/src/tfpoll.c
new file mode 100644
index 000000000..43063df7f
--- /dev/null
+++ b/private/utils/ntbackup/src/tfpoll.c
@@ -0,0 +1,1077 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+
+ Name: tfpoll.c
+
+ Description: This module contains the API TF_PollDrive.
+
+ $Log: T:\logfiles\tfpoll.c_v $
+
+ Rev 1.31.1.6 14 Feb 1994 16:52:04 GREGG
+Handle TF_NO_MORE_DATA return from ReadNewTape or ReadThisSet as foreign tape.
+
+ Rev 1.31.1.5 04 Feb 1994 12:37:34 GREGG
+Fixed potential access of pd_channel when it's NULL.
+
+ Rev 1.31.1.4 28 Jan 1994 11:26:46 GREGG
+Handle GEN_ERR_UNRECOGNIZED_MEDIA returned on reads as well as mounts.
+
+ Rev 1.31.1.3 17 Dec 1993 16:39:58 GREGG
+Extended error reporting.
+
+ Rev 1.31.1.2 30 Nov 1993 18:26:08 GREGG
+Handle TF_SQL_TAPE response from ReadNewTape.
+
+ Rev 1.31.1.1 10 Nov 1993 18:05:06 GREGG
+Check for error return from SetDrvBlkSize.
+
+ Rev 1.31.1.0 28 Sep 1993 17:15:02 GREGG
+Setup tpos struct at startup and reference it through the channel.
+
+ Rev 1.31 20 Jul 1993 17:57:12 TIMN
+Added TEXT macro to strings
+
+ Rev 1.30 19 Jul 1993 20:15:18 GREGG
+Fixed bug in last rev.
+
+ Rev 1.29 13 Jul 1993 19:30:50 GREGG
+Added handling of TF_FUTURE_REV_MTF and TF_MTF_ECC_TAPE returns in read case.
+
+ Rev 1.28 01 Jul 1993 11:48:10 GREGG
+Reduced frequency of debug messages.
+
+ Rev 1.27 30 Jun 1993 09:16:04 GREGG
+Don't skip the default size when scanning for the right block size.
+
+ Rev 1.26 03 Jun 1993 14:47:50 STEVEN
+if FUBAR the pd_channel = NULL
+
+ Rev 1.25 11 Apr 1993 18:43:50 GREGG
+Reset no_tape_reported flag at PollDrive startup.
+
+ Rev 1.24 05 Apr 1993 15:01:40 TERRI
+Reset VCB Buff before calling TPRewind under GEN_WRONG_BLOCK_SIZE
+
+ Rev 1.23 30 Mar 1993 16:15:12 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.22 17 Mar 1993 14:38:52 GREGG
+This is Terri Lynn - Added Gregg's changes for switching a tape drive to
+1k block mode if the tape( i.e. a Sytos Plus tape ) was written in 1k block size.
+
+ Rev 1.21 18 Jan 1993 14:23:06 BobR
+Added MOVE_ESA macro call(s)
+
+ Rev 1.20 20 Oct 1992 14:01:06 HUNTER
+Deleted references to data_size
+
+ Rev 1.19 24 Apr 1992 16:34:24 BURT
+Fixed bug with pd_state containing garbage and causing an exception
+when Zprintf'ing under Nostradamus. Caused by polldrive being called
+with no buffers available, i.e. no drive on or connected to computer.
+Discovered by Dave VanCamp. Fixed by init'ing pd_state to NULL.
+
+ Rev 1.18 25 Mar 1992 16:03:52 GREGG
+ROLLER BLADES - Added 64 bit support.
+
+ Rev 1.17 20 Mar 1992 18:00:30 NED
+added exception updating after TpReceive calls
+
+ Rev 1.16 23 Jan 1992 23:38:34 GREGG
+Forgot to dismount after no data read.
+
+ Rev 1.15 07 Jan 1992 17:57:16 GREGG
+Change state after BAD_DATA.
+
+ Rev 1.14 02 Jan 1992 14:53:40 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.13 10 Dec 1991 17:11:14 GREGG
+If pd_state has not been initialized, DON'T ZPRINTF IT!
+
+ Rev 1.12 03 Dec 1991 11:45:06 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.11 25 Nov 1991 14:40:56 GREGG
+Added handling of GEN_ERR_BAD_DATA on read, and return PD_BUSY on first status call.
+
+ Rev 1.10 08 Nov 1991 10:54:04 GREGG
+Added TF_INVALID_VCB case to switch after ReadNewTape/ReadThisSet calls.
+
+ Rev 1.9 29 Oct 1991 11:44:50 GREGG
+BIGWHEEL - Check for GEN_ERR_RESET return from Tp calls.
+
+ Rev 1.8 14 Oct 1991 11:13:06 GREGG
+Yet another big redesign: return immediate on TpStatus calls.
+
+ Rev 1.7 07 Oct 1991 22:16:58 GREGG
+Make sure the fmt env pointers are maintained in only one place at any given time.
+
+ Rev 1.6 03 Oct 1991 14:49:08 GREGG
+Dismount tape after no tape detected, but don't remount until status change.
+
+ Rev 1.5 02 Oct 1991 09:20:36 GREGG
+Revamped the new tape detection and handling logic.
+
+ Rev 1.4 29 Sep 1991 23:00:34 GREGG
+Commented the code, fixed bug where vcb wasn't getting thedata it needed,
+fixed handling when re-entering poll in busy state, and pulled common code
+into static function. (whew)
+
+ Rev 1.3 17 Sep 1991 11:36:08 GREGG
+Changed TPOS_PTR parameter to TPOS_HANDLER. Removed DisMount on no tape case.
+
+ Rev 1.2 12 Sep 1991 09:52:48 GREGG
+You have to get a buffer before you try to write to it!!!
+
+ Rev 1.1 10 Sep 1991 15:49:38 GREGG
+Added break after st_HOSED state end assert after st_CLOSED and default states.
+
+ Rev 1.0 09 Sep 1991 21:07:44 GREGG
+Initial revision.
+
+**/
+
+#include <stdtypes.h>
+#include <queues.h>
+#include <stdmath.h>
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+#include "tfldefs.h"
+#include "translat.h"
+
+#include "be_debug.h"
+
+/* Device Driver Interface Files */
+#include "generr.h"
+#include "genstat.h"
+#include "dil.h"
+#include "special.h"
+
+#include "tfpoll.h"
+
+/* Prototypical Prototype - See function for details */
+static VOID _near PD_HandleStatus( DRIVE_PTR, INT16_PTR, INT16_PTR, CHANNEL_PTR ) ;
+
+/**
+
+ Name: TF_PollDrive
+
+ Description: This function keeps track of tape activity, and reports
+ changes to the caller. When a new tape is detected in
+ the drive, it VCB's the tape and supplies the caller
+ with the new VCB.
+
+ Returns: A 'PD_' message indicating the status.
+
+ Notes: This function is intended to return immediatly, and does
+ not wait for tape functions to complete. As a result, it
+ must initially be called with msg == PDMSG_START, and
+ then PDMSG_CONTINUE until the caller no longer wishes to
+ poll the drive. Then it must be called a final time with
+ PDMSG_END.
+
+ There is one exception to the immediate returns: The
+ QS1.9x and SYTOS translators require additional tape
+ operations to VCB the tape, and their new tape functions
+ are not set up for immediate return. For this reason,
+ the caller should provide a TPOS_HANDLER if they wish to
+ be called back during these tape operations.
+
+ There are two other cases where the function will wait on
+ a TpReceive from the driver:
+
+ 1) If we are closed and reopened in a busy state,we will
+ do a status call, and wait for a response from that call
+ before resuming operation. This is to determine if any
+ tape change has been performed while we were inactive.
+ If this is the case, we must start over, otherwise we can
+ continue from the state we were in when we were closed.
+
+ 2) DisMountTape is called rather than going into a busy
+ dismounting status. This was done to reduce the
+ complexity of the function, and is not expected to have a
+ large impact on the immediate return functionality as the
+ calls will be infrequent, and are quick to return. A
+ thread switch will be added to the receive loop for those
+ OS's which require such a beast.
+
+ Declaration:
+
+**/
+
+INT16 TF_PollDrive( THW_PTR thw, /* (I) The drive to be polled */
+ DBLK_PTR vcb, /* (O) The tapes VCB info */
+ FSYS_HAND fsh, /* (I) A file system handle */
+ TPOS_HANDLER ui_tpos, /* (I) For callback during new */
+ /* tape processing */
+ INT16 msg ) /* (I) START, CONTINUE or END */
+{
+ CHANNEL_PTR pd_channel = NULL ;
+ INT16_PTR pd_state = NULL ; /* Added init to fix bug, BBB */
+ DRIVE_PTR curDRV ;
+ INT16 ret_val = PD_NO_CHANGE ;
+ INT16 tmp_ret ;
+ UINT16 i ;
+ RET_BUF myret ;
+ INT16 stat ;
+ static TPOS tpos_struct ; /* Note: Used only for tpos handler! */
+ INT idx ;
+ BOOLEAN resized_buff ;
+ BOOLEAN state_changed = FALSE ;
+
+ /* Startup Stuff ... */
+ if( msg == PDMSG_START ) {
+
+ /* get a channel */
+ for( i = 0 ; i < lw_tfl_control.no_channels ; i++ ) {
+ if( !InUse( &lw_channels[i] ) ) {
+ pd_channel = &lw_channels[i] ;
+ SetChannelStatus( pd_channel, CH_IN_USE ) ;
+ lw_tfl_control.no_chans_open++ ;
+ break ;
+ }
+ }
+ if( pd_channel == NULL ) {
+ ret_val = PD_NO_FREE_CHANNELS ;
+ } else {
+
+ /* hook the drive into the channel */
+ if( ( pd_channel->cur_drv = (DRIVE_PTR) thw ) == NULL ) {
+ msassert( FALSE ) ;
+ ret_val = PD_FUBAR ; /* Specified drive does not exist!!! */
+ }
+ }
+
+ /* set up the channel stuff */
+ if( ret_val == PD_NO_CHANGE ) {
+ ClrChannelStatus( pd_channel, ( CH_FATAL_ERR | CH_DATA_PHASE ) ) ;
+ pd_channel->cur_dblk = vcb ;
+ pd_channel->cur_fsys = fsh ;
+ pd_channel->eom_id = 0L ;
+ pd_channel->hiwater = pd_channel->buffs_enqd = 0 ;
+ pd_channel->retranslate_size = U64_Init( 0xffffffffUL, 0xffffffffUL ) ;
+ pd_channel->blocks_used = 0L ;
+
+ /* We do this so the UI won't have to send us the whole struct
+ when all we need is the handler. It is only at our level
+ that a structure pointer is needed.
+ */
+ if( ui_tpos != NULL ) {
+ tpos_struct.tape_id = -1 ;
+ tpos_struct.tape_seq_num = -1 ;
+ tpos_struct.backup_set_num = -1 ;
+ tpos_struct.UI_TapePosRoutine = ui_tpos ;
+ pd_channel->ui_tpos = &tpos_struct ;
+ } else {
+ pd_channel->ui_tpos = NULL ;
+ }
+
+ if ( pd_channel->cur_drv->last_fmt_env != NULL ) {
+ pd_channel->cur_fmt = pd_channel->cur_drv->last_cur_fmt ;
+ pd_channel->fmt_env = pd_channel->cur_drv->last_fmt_env ;
+ pd_channel->cur_drv->last_cur_fmt = UNKNOWN_FORMAT ;
+ pd_channel->cur_drv->last_fmt_env = NULL ;
+ }
+ if( pd_channel->cur_drv->hold_buff != NULL ) {
+ pd_channel->cur_buff = pd_channel->cur_drv->hold_buff ;
+ pd_channel->cur_drv->hold_buff = NULL ;
+ BM_UnReserve( pd_channel->cur_buff ) ;
+ }
+ curDRV = pd_channel->cur_drv ;
+ curDRV->poll_stuff.channel = pd_channel ;
+
+ /* The drive may have been polled before end ended in a busy
+ state. If this is the case, we start up where we left off.
+ SEE HEADER NOTE!
+ */
+ pd_state = &(curDRV->poll_stuff.state) ;
+ if( *pd_state != st_CLOSED ) {
+ curDRV->poll_stuff.reentered = TRUE ;
+ } else {
+ curDRV->poll_stuff.reentered = FALSE ;
+ curDRV->poll_stuff.first_status = TRUE ;
+ curDRV->poll_stuff.no_tape_reported = FALSE ;
+ curDRV->poll_stuff.def_blk_size = ChannelBlkSize( pd_channel ) ;
+ *pd_state = st_SSDC ;
+ }
+ }
+
+ } else { /* PDMSG_CONTINUE or PDMSG_END */
+
+ /* hook the drive into the channel */
+ if( ( curDRV = (DRIVE_PTR) thw ) == NULL ) {
+ msassert( FALSE ) ;
+ ret_val = PD_FUBAR ; /* Specified drive does not exist!!! */
+ } else {
+
+ /* set state and channel to the ones saved in the drive struct */
+ pd_channel = curDRV->poll_stuff.channel ;
+ pd_state = &(curDRV->poll_stuff.state) ;
+ }
+ }
+
+ /* If no error so far ... */
+ if( ret_val == PD_NO_CHANGE ) {
+
+ /* The big switch! (after all, this is a state machine) */
+ switch( *pd_state ) {
+
+ case st_SSDC : /* Same Status, Different Call */
+
+ /* Status the tape */
+ if( TpStatus( curDRV->drv_hdl ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ *pd_state = st_BSTAT ;
+ if( curDRV->poll_stuff.first_status ) {
+ ret_val = PD_BUSY ;
+ }
+ }
+ break ;
+
+ case st_BSTAT : /* Busy STATusing */
+
+ if( curDRV->poll_stuff.first_status ) {
+ ret_val = PD_BUSY ;
+ }
+ if( TpReceive( curDRV->drv_hdl, &myret ) != FAILURE ) {
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( thw->the, myret.the ) ;
+
+ /* We don't care about unrecognized media here, we will
+ catch it when we try a mount at the point the tape
+ is first put in the drive.
+ */
+
+ if( myret.gen_error != GEN_NO_ERR &&
+ myret.gen_error != GEN_ERR_NO_MEDIA &&
+ myret.gen_error != GEN_ERR_RESET &&
+ myret.gen_error != GEN_ERR_UNRECOGNIZED_MEDIA ) {
+
+ ret_val = PD_DRIVE_FAILURE ;
+ break ; /* END CASE */
+ }
+
+ /* SEE HEADER NOTE! */
+ /* Okay here's how it goes see. If the status
+ changed, we want to do the status stuff
+ immediatly, but if it didn't change and we're
+ being reentered (ouch) we want to do it again.
+ */
+ if( curDRV->poll_stuff.reentered ) {
+ curDRV->poll_stuff.reentered = FALSE ;
+ if( curDRV->thw_inf.drv_status == myret.status ) {
+ if( TpStatus( curDRV->drv_hdl ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ }
+ break ; /* END CASE */
+ }
+ }
+
+ curDRV->thw_inf.drv_status = myret.status ;
+ PD_HandleStatus( curDRV, &ret_val, pd_state, pd_channel ) ;
+ }
+ break ;
+
+ case st_BMNT : /* Busy MouNTing */
+
+ ret_val = PD_BUSY ;
+ if( TpReceive( curDRV->drv_hdl, &myret ) != FAILURE ) {
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( thw->the, myret.the ) ;
+
+ /* If no error, check for status change */
+ if( myret.gen_error != GEN_NO_ERR &&
+ myret.gen_error != GEN_ERR_NO_MEDIA &&
+ myret.gen_error != GEN_ERR_RESET &&
+ myret.gen_error != GEN_ERR_UNRECOGNIZED_MEDIA ) {
+
+ curDRV->tape_mounted = FALSE ;
+ ret_val = PD_DRIVE_FAILURE ;
+ } else {
+
+ if( myret.gen_error == GEN_ERR_NO_MEDIA || ( myret.status & TPS_NO_TAPE ) ) {
+
+ curDRV->thw_inf.drv_status = myret.status ;
+
+ /* They popped the tape! */
+ curDRV->tape_mounted = FALSE ;
+ ret_val = PD_NO_TAPE ;
+ curDRV->poll_stuff.no_tape_reported = TRUE ;
+ *pd_state = st_SSDC ;
+
+ } else if ( myret.gen_error == GEN_ERR_UNRECOGNIZED_MEDIA ) {
+
+ /* We need not go any further with this tape */
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ } else {
+ ret_val = PD_UNRECOGNIZED_MEDIA ;
+ *pd_state = st_SSDC ;
+ }
+
+ } else if( myret.gen_error == GEN_ERR_RESET ) {
+
+ /* Let's try this again ... */
+ curDRV->tape_mounted = FALSE ;
+ if( TpMount( curDRV->drv_hdl ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ }
+ } else {
+
+ /* The mount was successful! */
+ curDRV->tape_mounted = TRUE ;
+
+ /* SEE HEADER NOTE! */
+ if( curDRV->poll_stuff.reentered ) {
+ curDRV->poll_stuff.reentered = FALSE ;
+ if( ( tmp_ret = UpdateDriveStatus( curDRV ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ break ; /* END CASE */
+ }
+ if( curDRV->thw_inf.drv_status &
+ ( TPS_NO_TAPE | TPS_NEW_TAPE | TPS_RESET ) ) {
+ /* They did something behind our
+ backs, lets start over.
+ */
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ } else {
+ PD_HandleStatus( curDRV, &ret_val, pd_state, pd_channel ) ;
+ }
+ break ; /* END CASE */
+ }
+ }
+
+ /* Start the rewind! */
+ if( TpRewind( curDRV->drv_hdl, FALSE ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ResetDrivePosition( curDRV ) ;
+ SetPosBit( curDRV, AT_BOT ) ;
+ *pd_state = st_BREW ;
+ state_changed = TRUE ;
+ }
+ }
+ }
+ }
+ break ;
+
+ case st_BREW : /* Busy REWinding */
+
+ ret_val = PD_BUSY ;
+ if( TpReceive( curDRV->drv_hdl, &myret ) != FAILURE ) {
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( thw->the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+
+ /* process return from TpRewind */
+ switch( myret.gen_error ) {
+
+ case GEN_ERR_NO_MEDIA :
+
+ /* They popped the tape!!! */
+ curDRV->tape_mounted = FALSE ;
+ ret_val = PD_NO_TAPE ;
+ curDRV->poll_stuff.no_tape_reported = TRUE ;
+ *pd_state = st_SSDC ;
+ break ;
+
+ case GEN_ERR_RESET :
+
+ /* Let's try this again ... */
+ curDRV->tape_mounted = FALSE ;
+ *pd_state = st_BMNT ;
+ state_changed = TRUE ;
+ ret_val = PD_BUSY ;
+ if( TpMount( curDRV->drv_hdl ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ }
+ break ;
+
+ case GEN_NO_ERR :
+
+ /* SEE HEADER NOTE! */
+ if( curDRV->poll_stuff.reentered ) {
+ curDRV->poll_stuff.reentered = FALSE ;
+ if( ( tmp_ret = UpdateDriveStatus( curDRV ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ break ; /* END CASE */
+ }
+ if( curDRV->thw_inf.drv_status &
+ ( TPS_NO_TAPE | TPS_NEW_TAPE | TPS_RESET ) ) {
+ /* They did something behind our
+ backs, lets start over.
+ */
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ } else {
+ PD_HandleStatus( curDRV, &ret_val, pd_state, pd_channel ) ;
+ }
+ break ; /* END CASE */
+ }
+ }
+
+ /* kick off the VCB read */
+ if( ( pd_channel->cur_buff = BM_GetVCBBuff( &pd_channel->buffer_list ) ) == NULL ) {
+ ret_val = PD_OUT_OF_MEMORY ;
+ } else {
+ if( TpRead( curDRV->drv_hdl, BM_XferBase( pd_channel->cur_buff ), (UINT32)BM_XferSize( pd_channel->cur_buff ) ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ }
+ *pd_state = st_BREAD ;
+ state_changed = TRUE ;
+ }
+ break ;
+
+ default:
+ ret_val = PD_DRIVE_FAILURE ;
+ break ;
+ }
+ }
+ break ;
+
+ case st_BREAD : /* Busy READing (Stick with me, this be a biggie) */
+
+ ret_val = PD_BUSY ;
+ if( TpReceive( curDRV->drv_hdl, &myret ) != FAILURE ) {
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( thw->the, myret.the ) ;
+
+ if ( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ }
+
+ /* process return from TpRead */
+ switch( myret.gen_error ) {
+
+ case GEN_ERR_NO_MEDIA :
+
+ /* They popped the tape!!! */
+ curDRV->tape_mounted = FALSE ;
+ ret_val = PD_NO_TAPE ;
+ curDRV->poll_stuff.no_tape_reported = TRUE ;
+ *pd_state = st_SSDC ;
+ BM_Put( pd_channel->cur_buff ) ;
+ pd_channel->cur_buff = NULL ;
+ break ;
+
+ case GEN_ERR_RESET :
+
+ /* Let's try this again ... */
+ curDRV->tape_mounted = FALSE ;
+ *pd_state = st_BMNT ;
+ state_changed = TRUE ;
+ ret_val = PD_BUSY ;
+ BM_Put( pd_channel->cur_buff ) ;
+ pd_channel->cur_buff = NULL ;
+ if( TpMount( curDRV->drv_hdl ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ }
+ break ;
+
+ case GEN_ERR_UNRECOGNIZED_MEDIA :
+
+ ret_val = PD_UNRECOGNIZED_MEDIA ;
+ *pd_state = st_SSDC ;
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ }
+ break ;
+
+ case GEN_ERR_BAD_DATA :
+
+ ret_val = PD_BAD_TAPE ;
+ *pd_state = st_SSDC ;
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ }
+ break ;
+
+ case GEN_ERR_WRONG_BLOCK_SIZE :
+ /* This is to deal with drives which don't have any
+ idea what block size the tape was written with.
+ We go through a list of valid sizes in an attempt
+ to find the right size to read the tape. Each
+ time we try a new size, we issue another rewind
+ and set the state back to st_BREW, keeping track
+ of which sizes we have tried. If we exhaust the
+ list, we report it as a FOREIGN tape.
+ */
+ idx = curDRV->poll_stuff.blk_size_idx ;
+ if( ! ( DriveAttributes( curDRV ) & TDI_CHNG_BLK_SIZE )
+ || idx == lw_num_blk_sizes ) {
+
+ *pd_state = st_SSDC ;
+ ret_val = PD_FOREIGN_TAPE ;
+ if( DriveAttributes( curDRV ) & TDI_CHNG_BLK_SIZE ) {
+ INT16 ret ;
+
+ ret = SetDrvBlkSize( pd_channel,
+ pd_channel->cur_buff,
+ curDRV->poll_stuff.def_blk_size,
+ &resized_buff ) ;
+
+ if( ret == TFLE_NO_MEMORY ) {
+ ret_val = PD_DRIVE_FAILURE ;
+ } else if( ret != TFLE_NO_ERR ) {
+ ret_val = PD_FOREIGN_TAPE ;
+ } else {
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ }
+ }
+ } else {
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ }
+ }
+ } else {
+ INT16 ret ;
+
+ ret = SetDrvBlkSize( pd_channel,
+ pd_channel->cur_buff,
+ lw_blk_size_list[idx],
+ &resized_buff ) ;
+
+ if( ret == TFLE_NO_MEMORY ) {
+ ret_val = PD_OUT_OF_MEMORY ;
+ } else {
+
+ ++curDRV->poll_stuff.blk_size_idx ;
+
+ BM_Put( pd_channel->buffer_list.vcb_buff ) ;
+ if( TpRewind( curDRV->drv_hdl, FALSE ) == FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ResetDrivePosition( curDRV ) ;
+ SetPosBit( curDRV, AT_BOT ) ;
+ *pd_state = st_BREW ;
+ state_changed = TRUE ;
+ }
+ }
+ }
+ break ;
+
+ case GEN_ERR_NO_DATA :
+ case GEN_NO_ERR :
+ case GEN_ERR_ENDSET :
+
+ curDRV->poll_stuff.def_blk_size = ChannelBlkSize( pd_channel ) ;
+
+ /* SEE HEADER NOTE! */
+ if( curDRV->poll_stuff.reentered ) {
+ curDRV->poll_stuff.reentered = FALSE ;
+ if( ( tmp_ret = UpdateDriveStatus( curDRV ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ break ; /* END CASE */
+ }
+ if( curDRV->thw_inf.drv_status &
+ ( TPS_NO_TAPE | TPS_NEW_TAPE | TPS_RESET ) ) {
+ /* They did something behind our
+ backs, lets start over.
+ */
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ } else {
+ PD_HandleStatus( curDRV, &ret_val, pd_state, pd_channel ) ;
+ }
+ break ; /* END CASE */
+ }
+ }
+
+ /* Attempt to generate a VCB */
+ ret_val = PD_BLANK_TAPE ;
+ *pd_state = st_SSDC ;
+ BM_SetBytesFree( pd_channel->cur_buff, (UINT16)myret.len_got ) ;
+ BM_SetReadError( pd_channel->cur_buff, myret.gen_error ) ;
+ if( BM_BytesFree( pd_channel->cur_buff ) ) {
+ if ( ( stat = ReadNewTape( pd_channel, pd_channel->ui_tpos, FALSE ) ) == TFLE_NO_ERR ) {
+ stat = ReadThisSet( pd_channel ) ;
+ }
+
+ switch( stat ) {
+
+ case TFLE_NO_ERR :
+
+ /* We got one!!! */
+ *pd_channel->cur_dblk = curDRV->cur_vcb ;
+ ret_val = PD_VALID_VCB ;
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ } else {
+ curDRV->vcb_valid = TRUE ;
+ }
+ break ;
+
+
+ case TF_NO_MORE_DATA :
+ case TF_SQL_TAPE :
+ case TF_INVALID_VCB :
+ case TF_FUTURE_REV_MTF :
+ case TF_MTF_ECC_TAPE :
+ case TFLE_UNKNOWN_FMT :
+ case TFLE_BAD_TAPE :
+ case TFLE_TAPE_INCONSISTENCY :
+ case TFLE_TRANSLATION_FAILURE :
+
+ if( stat == TF_FUTURE_REV_MTF ) {
+ ret_val = PD_FUTURE_REV_MTF ;
+ } else if( stat == TF_MTF_ECC_TAPE ) {
+ ret_val = PD_MTF_ECC_TAPE ;
+ } else if( stat == TF_SQL_TAPE ) {
+ ret_val = PD_SQL_TAPE ;
+ } else {
+ ret_val = PD_FOREIGN_TAPE ;
+ }
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ }
+ break ;
+
+ case TFLE_DRIVE_FAILURE :
+
+ ret_val = PD_DRIVE_FAILURE ;
+ break ;
+
+ case TFLE_DRIVER_FAILURE :
+
+ ret_val = PD_DRIVER_FAILURE ;
+ break ;
+
+ case TFLE_NO_TAPE :
+
+ /* They popped the tape!!! */
+ curDRV->tape_mounted = FALSE ;
+ ret_val = PD_NO_TAPE ;
+ curDRV->poll_stuff.no_tape_reported = TRUE ;
+ *pd_state = st_SSDC ;
+ BM_Put( pd_channel->cur_buff ) ;
+ pd_channel->cur_buff = NULL ;
+ break ;
+
+ case TFLE_NO_MEMORY :
+
+ ret_val = PD_OUT_OF_MEMORY ;
+ DisMountTape( curDRV, NULL, FALSE ) ;
+ break ;
+
+ case TF_WRONG_TAPE :
+ case TF_TAPE_OUT_OF_ORDER :
+
+ ret_val = PD_OUT_OF_SEQUENCE ;
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ }
+ break ;
+
+ default:
+ ret_val = PD_FUBAR ; /* shouldn't happen */
+ }
+ } else { /* BM_BytesFree == 0 */
+ if( ( tmp_ret = DisMountTape( curDRV, NULL, FALSE ) ) != TFLE_NO_ERR ) {
+ if( tmp_ret == TFLE_DRIVER_FAILURE ) {
+ ret_val = PD_DRIVER_FAILURE ;
+ } else {
+ ret_val = PD_DRIVE_FAILURE ;
+ }
+ }
+ }
+ break ;
+
+ default:
+
+ ret_val = PD_DRIVE_FAILURE ;
+ break ;
+ }
+ }
+ break ;
+
+ case st_HOSED : /* We reported a critical error. They should be
+ calling us with END!!!
+ */
+
+ if( msg != PDMSG_END ) {
+ msassert( FALSE ) ;
+ ret_val = PD_FUBAR ;
+ }
+ break ;
+
+ case st_CLOSED : /* This is REALLY BAD!!! */
+ default :
+
+ msassert( FALSE ) ;
+ ret_val = PD_FUBAR ;
+ }
+ }
+
+ /* Certain returns indicate the FormatEnv and buffers are no longer
+ valid. If this is the case, we ditch them.
+ */
+ switch( ret_val ) {
+
+ case PD_NO_CHANGE :
+ case PD_BUSY :
+ case PD_VALID_VCB :
+ case PD_NO_FREE_CHANNELS :
+
+ break ;
+
+ case PD_FUBAR :
+ case PD_OUT_OF_MEMORY :
+ case PD_DRIVE_FAILURE :
+ case PD_DRIVER_FAILURE :
+
+ *pd_state = st_HOSED ;
+
+ /* Fall Through */
+
+ case PD_BLANK_TAPE :
+ case PD_NO_TAPE :
+ case PD_FOREIGN_TAPE :
+ case PD_FUTURE_REV_MTF :
+ case PD_SQL_TAPE :
+ case PD_MTF_ECC_TAPE :
+ case PD_OUT_OF_SEQUENCE :
+ case PD_NEW_TAPE :
+ case PD_BAD_TAPE :
+ case PD_UNRECOGNIZED_MEDIA :
+
+ if( (pd_channel != NULL) && (pd_channel->cur_drv != NULL) ) {
+ curDRV->vcb_valid = FALSE ;
+ if( pd_channel->fmt_env != NULL ) {
+ FreeFormatEnv( &pd_channel->cur_fmt, &pd_channel->fmt_env ) ;
+ }
+ if( curDRV->hold_buff != NULL ) {
+ BM_UnReserve( curDRV->hold_buff ) ;
+ BM_Put( curDRV->hold_buff ) ;
+ curDRV->hold_buff = NULL ;
+ }
+ if( pd_channel->cur_buff != NULL ) {
+ BM_Put( pd_channel->cur_buff ) ;
+ pd_channel->cur_buff = NULL ;
+ }
+ }
+ break ;
+
+ default :
+ msassert( FALSE ) ;
+ }
+
+ /* Should we wrap it up? */
+ if( msg == PDMSG_END ) {
+
+ /* If we are currently reading into cur_buff, or it has valid data,
+ save it in hold_buff.
+ */
+ if( *pd_state == st_BREAD ) {
+ curDRV->hold_buff = pd_channel->cur_buff ;
+ pd_channel->cur_buff = NULL ;
+ BM_Reserve( curDRV->hold_buff ) ;
+
+ }else if( pd_channel != NULL && pd_channel->cur_buff != NULL &&
+ ( BM_BytesFree( pd_channel->cur_buff ) != 0 ||
+ ( BM_ReadError( pd_channel->cur_buff ) != GEN_NO_ERR &&
+ BM_ReadError( pd_channel->cur_buff ) != GEN_ERR_NO_DATA ) ) ) {
+ curDRV->hold_buff = pd_channel->cur_buff ;
+ pd_channel->cur_buff = NULL ;
+ BM_Reserve( curDRV->hold_buff ) ;
+ }
+
+ /* If the VCB's valid, save the currnt FormatEnv */
+ if( pd_channel != NULL ) {
+ if( curDRV->vcb_valid ) {
+ curDRV->last_cur_fmt = pd_channel->cur_fmt ;
+ curDRV->last_fmt_env = pd_channel->fmt_env ;
+ pd_channel->cur_fmt = UNKNOWN_FORMAT ;
+ pd_channel->fmt_env = NULL ;
+ } else if( pd_channel->fmt_env != NULL ) {
+ FreeFormatEnv( &pd_channel->cur_fmt, &pd_channel->fmt_env ) ;
+ }
+ }
+
+ /* If we're busy ... */
+ if( *pd_state == st_BMNT || *pd_state == st_BSTAT ||
+ *pd_state == st_BREW || *pd_state == st_BREAD ) {
+
+ /* Force a call to mount as next action on this drive. */
+ curDRV->tape_mounted = FALSE ;
+
+ } else {
+
+ /* Close it up! */
+ *pd_state = st_CLOSED ;
+ ClrPosBit( curDRV, REW_CLOSE ) ;
+ }
+
+ /* free up the channel */
+ if( pd_channel != NULL ) {
+ ClrChannelStatus( pd_channel, CH_IN_USE ) ;
+ curDRV->poll_stuff.channel = NULL ;
+ lw_tfl_control.no_chans_open-- ;
+ }
+ }
+
+ if( ( ret_val != PD_NO_CHANGE && ret_val != PD_BUSY ) ||
+ msg != PDMSG_CONTINUE || state_changed ) {
+
+ if( pd_state == NULL ) {
+ BE_Zprintf( 0, TEXT("PollDrive: msg: %d, NO STATE INFO, return: %d\n"), msg, ret_val ) ;
+ } else {
+ BE_Zprintf( 0, TEXT("PollDrive: msg: %d, new state: %d, return: %d\n"), msg, *pd_state, ret_val ) ;
+ }
+ }
+ return( ret_val ) ;
+}
+
+
+/**
+
+ Name: PD_HandleStatus
+
+ Description: This function checks the status of the drive and responds
+ accordingly.
+
+ Returns: Nothing, nada, zilch, zippo, ... (get the picture?)
+
+ Notes: It is important to keep in mind that the programmer was
+ not in his right mind while making this note and anything
+ said here should be ignored completely.
+
+ Declaration:
+
+**/
+
+static VOID _near PD_HandleStatus(
+ DRIVE_PTR curDRV, /* (I) drive being polled */
+ INT16_PTR ret_val, /* (O) Poll's return value */
+ INT16_PTR pd_state, /* (O) Poll's state */
+ CHANNEL_PTR pd_channel ) /* (I) active channel */
+{
+ if( curDRV->thw_inf.drv_status & TPS_NO_TAPE ) {
+
+ /* No tape in drive! */
+ *pd_state = st_SSDC ;
+
+ /* Report no tape only when it is first detected */
+ if( !curDRV->poll_stuff.no_tape_reported ) {
+ ResetDrivePosition( curDRV ) ;
+ *ret_val = PD_NO_TAPE ;
+ curDRV->poll_stuff.no_tape_reported = TRUE ;
+ ClrPosBit( curDRV, TAPE_FULL ) ;
+ }
+
+ } else {
+
+ /* We have a tape. Is it New? */
+ if( ( curDRV->thw_inf.drv_status & ( TPS_NEW_TAPE | TPS_RESET ) )
+ || ( !curDRV->vcb_valid && curDRV->poll_stuff.first_status )
+ || ( curDRV->poll_stuff.no_tape_reported ) ) {
+
+ /* Note that the second condition keeps us from constantly
+ trying to re-VCB a blank or foreign tape, and the last
+ condition is needed because the SCSI drives don't always
+ report NEW_TAPE.
+ */
+
+ /* It is new! Let's kick off the VCB process. */
+ curDRV->poll_stuff.no_tape_reported = FALSE ;
+ *ret_val = PD_NEW_TAPE ;
+ ClrPosBit( curDRV, TAPE_FULL ) ;
+ if( TpMount( curDRV->drv_hdl ) == FAILURE ) {
+ *ret_val = PD_DRIVER_FAILURE ;
+ }
+ *pd_state = st_BMNT ;
+
+ /* See the comment at GEN_ERR_WRONG_BLOCK_SIZE return
+ from TpRead.
+ */
+ curDRV->poll_stuff.blk_size_idx = 0 ;
+
+ } else {
+
+ *pd_state = st_SSDC ;
+
+ /* On first status, if this is not a new tape and we have a
+ valid VCB already, we give them the old VCB and inform
+ them that it is valid.
+ */
+ if( curDRV->poll_stuff.first_status ) {
+ *pd_channel->cur_dblk = curDRV->cur_vcb ;
+ *ret_val = PD_VALID_VCB ;
+ }
+ }
+ }
+
+ curDRV->poll_stuff.first_status = FALSE ;
+}
+
diff --git a/private/utils/ntbackup/src/tfread.c b/private/utils/ntbackup/src/tfread.c
new file mode 100644
index 000000000..eedd528cf
--- /dev/null
+++ b/private/utils/ntbackup/src/tfread.c
@@ -0,0 +1,1656 @@
+
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: read.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the support code for reading tapes.
+
+
+ $Log: T:/LOGFILES/TFREAD.C_V $
+
+ Rev 1.62 19 Oct 1993 17:34:04 GREGG
+Consider lba_offset (from GotoBlock) in calculating beginning and running LBAs.
+
+ Rev 1.61 22 Jul 1993 12:46:10 GREGG
+Fixed calc of Beginning and Running LBA after posatset call in DoRead.
+
+ Rev 1.60 14 Jul 1993 20:55:10 GREGG
+Fixed bug if CalcReTransSize dealing with stream sizes greater than 4 Gig.
+
+ Rev 1.59 30 Jun 1993 09:22:00 GREGG
+Fixed GOTO_LBA logic, and setting of running and beginning LBAs on cont tape.
+
+ Rev 1.58 25 Jun 1993 20:50:28 GREGG
+In EOM_Read, don't call FlushReads if there's an exception in the cur_buff.
+
+ Rev 1.57 24 May 1993 21:14:10 GREGG
+Fixed conditional to see if we did a seek to VCB in StartRead.
+
+ Rev 1.56 17 May 1993 20:11:54 GREGG
+Added logic to deal with the fact that the app above tape format doesn't
+keep track of the lba of the vcb.
+
+ Rev 1.55 18 Apr 1993 17:26:42 GREGG
+Don't bother reporting UDBs to loops, just skip them.
+
+ Rev 1.54 12 Mar 1993 12:32:50 DON
+Replaced empty TpReceive loops with ThreadSwitch's
+
+ Rev 1.53 10 Mar 1993 16:11:12 GREGG
+Should have been updating bytes free as well as next byte offset with offset
+returned from GotoBlock.
+
+ Rev 1.53 22 Feb 1993 12:23:08 chrish
+Added change received from MikeP.
+Restoring a set that contained a true "unexpected end of set" it trapped in
+GetData because cur_buf was NULL.
+
+ Rev 1.52 30 Jan 1993 11:51:22 DON
+Removed compiler warnings
+
+ Rev 1.51 27 Jan 1993 14:30:14 GREGG
+Preserve stream processing channel status in EOM_Read.
+
+ Rev 1.50 25 Jan 1993 12:36:06 GREGG
+Fixed bug where 'eom_id' was being set erroniously.
+
+ Rev 1.49 18 Jan 1993 14:17:48 BobR
+Added MOVE_ESA macro(s)
+
+ Rev 1.48 08 Dec 1992 21:02:50 GREGG
+Clear CH_DATA_PHASE bit after skipping data in GetData.
+
+ Rev 1.47 20 Nov 1992 13:05:42 HUNTER
+Added handling for TF_SKIP_CURRENT_STREAM
+
+ Rev 1.46 11 Nov 1992 22:27:04 GREGG
+Unicodeized literals.
+
+ Rev 1.45 04 Nov 1992 09:12:52 HUNTER
+Moved the processing of the reqrep's "filter_to_use" field
+
+ Rev 1.43 22 Oct 1992 10:24:50 HUNTER
+New data stream handling
+
+ Rev 1.42 22 Sep 1992 09:03:20 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.41 17 Aug 1992 08:42:02 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.40 23 Jul 1992 10:11:32 GREGG
+Fixed warnings.
+
+ Rev 1.39 09 Jun 1992 15:35:54 GREGG
+Changed call to check for continuation block.
+
+ Rev 1.38 21 May 1992 12:52:02 GREGG
+Changes for OTC read.
+
+ Rev 1.37 13 May 1992 12:00:16 STEVEN
+40 format changes
+
+ Rev 1.36 25 Mar 1992 17:56:08 GREGG
+ROLLER BLADES - Initial Integration. Includes support for 4.0 format, 64
+ bit file sizes and tape block sizes > the logical block size.
+
+ Rev 1.35 20 Mar 1992 18:01:10 NED
+added exception updating after TpReceive calls
+
+ Rev 1.34 03 Mar 1992 12:22:40 GREGG
+ Added TpSpecial SS_PHYS_BLOCK call after PositionAtSet call in DoRead.
+
+ Rev 1.33 28 Feb 1992 16:14:30 GREGG
+Added TpSpecial SS_PHYS_BLOCK call in EOM_Read.
+
+ Rev 1.32 27 Feb 1992 18:35:44 NED
+fixed update of channel->cur_drv->cur_pos from rr struct
+
+ Rev 1.31 25 Feb 1992 15:17:24 NED
+updated tape_seq_num in cur_drv to fix goto LBA problem
+
+ Rev 1.30 08 Feb 1992 14:22:40 GREGG
+Removed references to lst_oper in drive stucture (it no longer exits).
+
+ Rev 1.29 04 Feb 1992 21:06:20 NED
+Added code to deal with TpRead calls failing due to request queue overflow.
+
+ Rev 1.28 17 Jan 1992 08:27:04 GREGG
+Removed call to now nonexistant StartReadHook function.
+
+ Rev 1.27 15 Jan 1992 01:39:10 GREGG
+Added param to posatset calls indicating if only a VCB of the tape is required.
+
+ Rev 1.26 03 Jan 1992 13:25:52 NED
+Added DumpDebug() call
+
+ Rev 1.25 02 Jan 1992 14:52:16 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.24 03 Dec 1991 11:50:36 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.23 22 Nov 1991 15:18:24 GREGG
+Replaced TF_IDLE call with ThreadSwitch.
+
+ Rev 1.22 19 Nov 1991 09:35:32 GREGG
+CleanupDriverQ was TpReceiving if buffer had an exception and there was no fmt.
+
+ Rev 1.21 17 Oct 1991 01:27:54 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.20 07 Oct 1991 22:26:06 GREGG
+Update lba stuff after Fast File positioning across EOM.
+
+ Rev 1.19 25 Sep 1991 20:40:08 GREGG
+Update channel->cur_drv->cur_pos.tape_seq at EOM.
+Don't call translator when doing a CleanupDriverQ in an error state.
+
+ Rev 1.18 17 Sep 1991 13:33:24 GREGG
+Added TF_SKIPPING_DATA message.
+
+ Rev 1.17 22 Aug 1991 16:36:18 NED
+hanged all references to internals of the buffer structure to macros.
+
+ Rev 1.16 16 Aug 1991 09:12:52 GREGG
+Moved preservation of current format during continuation into PositionAtSet.
+
+ Rev 1.15 14 Aug 1991 11:22:28 GREGG
+Clean up the driver queue if error encountered during read
+
+ Rev 1.14 01 Aug 1991 15:01:12 GREGG
+Save the current format before calling PosAtSet to handle EOM tape changes.
+
+ Rev 1.13 24 Jul 1991 16:16:44 DAVIDH
+Cleared up warnings under Watcom.
+
+ Rev 1.12 22 Jul 1991 13:13:18 GREGG
+Removed handling of CH_CONTINUING status (now done in PositionAtSet).
+
+ Rev 1.11 15 Jul 1991 15:02:04 NED
+Added logic to set CH_CONTINUING channel status at apropriate times.
+
+ Rev 1.10 26 Jun 1991 16:15:46 NED
+added EOD handling after calls to RD_Exception(), having
+removed it from there.
+
+ Rev 1.9 25 Jun 1991 09:56:02 NED
+Don't call FlushReads from DoRead if there is an exception in the current
+buffer. Cleaned up logic in AcquireReadBuffer. Changed CleanupDriverQ to
+properly handle exceptions.
+
+ Rev 1.8 17 Jun 1991 12:00:08 GREGG
+Changed AbortRead to stop rewinding the drive and freeing the format environment.
+Added logic to set the REW_CLOSE position bit only under specific conditions.
+Free the format environment on exceptions which request REW_CLOSE.
+Handle translator communication when exception encountered during CleanupDriverQ.
+
+ Rev 1.7 07 Jun 1991 01:31:46 GREGG
+Removed call to FreeFormatEnv in AbortRead.
+
+ Rev 1.6 06 Jun 1991 21:07:14 GREGG
+Updated parameters in calls to FreeFormatEnv and MoveToVCB.
+
+ Rev 1.5 28 May 1991 14:52:10 NED
+applied changes made to old code ;
+fixed handling of exceptions when skipping in GetData.
+
+ Rev 1.4 23 May 1991 17:51:10 GREGG
+In case where next LBA is on next tape, set CH_AT_EOD before call to PosAtSet
+and reset it after, so posAtSet knows to ask for next tape, and check return
+from PosAtSet before continuing.
+
+ Rev 1.3 23 May 1991 16:23:52 NED
+Fixed handling of end-of-set when last read ended just prior
+to filemark at end.
+
+ Rev 1.2 14 May 1991 16:37:30 NED
+Added exception handling return codes from AcquireReadBuffer
+and associated code to interpret them: TFLE_xxxx for errors,
+TFLE_NO_ERR for OK (got data), and FMT_EXC_xxx for exceptions.
+
+ Rev 1.1 10 May 1991 16:07:36 GREGG
+Ned's new stuff
+
+ Rev 1.0 10 May 1991 10:12:20 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include <memory.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "stdmath.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwdefs.h"
+#include "tflopen.h"
+#include "lwprotos.h"
+#include "tflproto.h"
+#include "translat.h"
+#include "tfldefs.h"
+#include "sx.h"
+
+/* Device Driver Interface Files */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+
+#include "be_debug.h"
+
+/* $end$ include list */
+
+
+/* Static Prototypes */
+static INT16 _near StartReadOperation( CHANNEL_PTR, RR_PTR ) ;
+static INT16 _near GetData( CHANNEL_PTR, RR_PTR ) ;
+static INT16 _near EOM_Read(CHANNEL_PTR);
+static INT16 _near AcquireReadBuffer( CHANNEL_PTR, BOOLEAN ) ;
+static BOOLEAN _near ReadRequest( CHANNEL_PTR, BUF_PTR ) ;
+static VOID _near FlushReads(CHANNEL_PTR);
+static VOID _near AbortRead( CHANNEL_PTR, INT16 ) ;
+static BOOLEAN _near IsLBAInTheBuffers( CHANNEL_PTR, UINT32, INT16_PTR ) ;
+static VOID _near CleanUpDriverQ(CHANNEL_PTR);
+static UINT16 _near CalcReTransSize( CHANNEL_PTR, UINT64 ) ;
+static VOID _near HandleSXStartScanTapeConcerns( CHANNEL_PTR ) ;
+
+/**/
+/**
+
+ Name: StartReadOperation
+
+ Description: Kicks off a reading session.
+
+ Modified: 9/7/1989 13:33:9
+
+ Returns: An error code if there is an error, and a zero if there
+ is not.
+
+ Notes: THERE SHOULD ALWAYS BE A VALID READ BUFFER IN THE
+ "channel->cur_buff" pointer. This function is called after
+ positioning is done.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static INT16 _near StartReadOperation(
+ CHANNEL_PTR channel,
+ RR_PTR req )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ BOOLEAN need_read = FALSE ;
+ UINT16 lba_offset = 0 ;
+
+ /* Initialize buffer pointers */
+ req->buff_size = req->buff_used = 0 ;
+
+ /* Move to current VCB */
+ channel->running_lba = 0L ;
+ ret_val = MoveToVCB( channel, (INT16)0, & need_read, TRUE ) ;
+ if ( ret_val != TFLE_NO_ERR ) {
+ return ret_val ;
+ }
+
+ if( curDRV->vcb_valid ) {
+ /* Set the stuff up for next tape */
+ channel->tape_id = FS_ViewTapeIDInVCB( (VOID_PTR)&curDRV->cur_vcb ) ;
+ channel->ts_num = FS_ViewTSNumInVCB( (VOID_PTR)&curDRV->cur_vcb ) ;
+ channel->bs_num = FS_ViewBSNumInVCB( (VOID_PTR)&curDRV->cur_vcb ) ;
+
+ channel->cur_drv->cur_pos.tape_seq = channel->ts_num ;
+
+ /* we may be scanning tape on an SX drive */
+ HandleSXStartScanTapeConcerns( channel ) ;
+
+ /* Copy it to their memory */
+ *req->vcb_ptr = curDRV->cur_vcb ;
+ }
+
+ /* Fix for the app not knowing the LBA for a continuation VCB */
+ if( channel->cross_set == channel->ui_tpos->backup_set_num ) {
+ req->tape_loc.lba_vcb = channel->cross_lba ;
+
+ /* If we're going for the VCB itself, we need to set the LBA
+ as well for the GotoBlock math to work.
+ */
+ if( req->tape_loc.lba == 0 ) {
+ req->tape_loc.lba = channel->cross_lba ;
+ }
+ }
+
+ channel->cur_drv->cur_pos.tape_seq = req->tape_loc.tape_seq ;
+ channel->cur_drv->cur_pos.pba_vcb = req->tape_loc.pba_vcb ;
+ channel->cur_drv->cur_pos.lba_vcb = req->tape_loc.lba_vcb ;
+ channel->cur_drv->cur_pos.lba = req->tape_loc.lba ;
+
+ /* If needed, tell the drive the base block position we are positioning
+ from */
+ if( DriveAttributes( curDRV ) & TDI_REAL_BLK_POS ) {
+ TpSpecial( curDRV->drv_hdl, (INT16)SS_PHYS_BLOCK, req->tape_loc.pba_vcb ) ;
+ }
+
+ /* This is a special case where the translator is doing all the work */
+ if( !channel->read_from_tape ) {
+
+ /* Set Up Block Pointers */
+ channel->cur_dblk = req->cur_dblk ;
+
+ if( req->cur_dblk != NULL ) {
+ *req->cur_dblk = curDRV->cur_vcb ;
+ }
+
+ req->tf_message = TRR_VCB ;
+
+ /* indicate we are not doing fast file positioning */
+ req->tape_loc.pba_vcb = 0L ;
+
+ /* If we are doing fast file positioning - even on the EXABYTE 8200SX */
+ } else if( ( req->tape_loc.pba_vcb &&
+ req->tape_loc.pba_vcb != MANUFACTURED_PBA &&
+ SupportBlkPos( curDRV ) ) || SX_AbleToFindBlock( channel ) ) {
+
+ /* We Are not at end of set */
+ ClrPosBit( channel->cur_drv, ( AT_EOS | AT_EOD | AT_BOT ) ) ;
+ ClrChannelStatus( channel, CH_DONE ) ;
+
+ /* Get rid of the current buffer */
+ PuntBuffer( channel ) ;
+
+ /* Were holding on to an old vcb, and seeking to a new set! */
+ /* So update the vcb's and channel's ideas of what the set */
+ /* number is (we may need it later...). */
+ FS_SetBSNumInVCB( (VOID_PTR)&curDRV->cur_vcb, channel->ui_tpos->backup_set_num ) ;
+ channel->bs_num = channel->ui_tpos->backup_set_num ;
+
+ if( SX_AbleToFindBlock( channel ) ) {
+ /* Find that Block on the EXABYTE 8200SX */
+ ret_val = SX_FindBlock( channel, req->tape_loc.lba, channel->ui_tpos, TF_SEARCHING ) ;
+ } else {
+ /* Go to that Block */
+ ret_val = GotoBlock( channel, req->tape_loc.lba,
+ channel->ui_tpos, &lba_offset ) ;
+ }
+
+ if( ret_val == TFLE_USER_ABORT ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ }
+
+ channel->running_lba = req->tape_loc.lba -
+ lba_offset / channel->lb_size ;
+
+ } else if( curDRV->vcb_valid ) {
+
+ /* Set Up Block Pointers */
+ channel->cur_dblk = req->cur_dblk ;
+
+ if( req->cur_dblk != NULL ) {
+ *req->cur_dblk = curDRV->cur_vcb ;
+ }
+
+ req->tf_message = TRR_VCB ;
+
+ /* indicate we are not doing fast file positioning */
+ req->tape_loc.pba_vcb = 0L ;
+
+ } else {
+ /* indicate we are not doing fast file positioning */
+ req->tape_loc.pba_vcb = 0L ;
+ }
+
+ /* If no error so far */
+ if( !ret_val && channel->read_from_tape ) {
+ /* If we already have a buffer, and we haven't accounted for it
+ do so now */
+ if( channel->cur_buff != NULL ) {
+
+ channel->running_lba = req->tape_loc.lba_vcb +
+ (UINT32)( BM_XferSize( channel->cur_buff ) /
+ channel->lb_size ) ;
+
+ if( SX_IsStatusSet( channel, SX_SCAN_ACTIVE ) &&
+ SX_IsOK( channel ) ) {
+ /* adjust the LBA for the first TpRead() call */
+ SX_AdjustLBANow( channel, BM_XferSize( channel->cur_buff ) ) ;
+ }
+ BM_SetBeginningLBA( channel->cur_buff, req->tape_loc.lba_vcb ) ;
+ }
+
+ if ( channel->cur_buff == NULL || BM_ReadError( channel->cur_buff ) == GEN_NO_ERR ) {
+ FlushReads( channel ) ;
+ }
+
+ /* If Fast File - even on the EXABYTE 8200SX wait for a buffer */
+ if( ( req->tape_loc.pba_vcb &&
+ req->tape_loc.pba_vcb != MANUFACTURED_PBA &&
+ SupportBlkPos( curDRV ) ) ||
+ SX_AbleToFindBlock( channel ) ) {
+
+ ret_val = AcquireReadBuffer( channel, FALSE ) ;
+ if ( ret_val != TFLE_NO_ERR && ! IsTFLE( ret_val ) ) {
+ /* somehow we got an exception already! */
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ BM_UpdCnts( channel->cur_buff, lba_offset ) ;
+ }
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: DoRead
+
+ Description: Dispatches a read call.
+
+ Modified: 6/19/1990 9:54:37
+
+ Returns: An error code if not successful, and zero if it was.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 DoRead(
+ CHANNEL_PTR channel,
+ RR_PTR req )
+{
+ BOOLEAN done = FALSE ;
+ BOOLEAN switched_tapes = FALSE ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ BUF_PTR tmpBUF ;
+ UINT32 lba ;
+ Q_ELEM_PTR qe_ptr;
+ UINT16 blk_type ;
+
+ /* We use this as a flag for later */
+ req->tf_message = 0 ;
+
+ switch( req->lp_message ) {
+
+ case LRR_ABORT:
+ ret_val = TFLE_USER_ABORT ;
+ /* fall through */
+
+ case LRR_FINISHED:
+ AbortRead( channel, ret_val ) ;
+ break ;
+
+ /* Handle the End Of Volume Case */
+ case LRR_EOM_ACK:
+ if( ( ret_val = EOM_Read( channel ) ) != TFLE_NO_ERR ) {
+ done = TRUE ;
+ } else {
+ *req->vcb_ptr = channel->cur_drv->cur_vcb ;
+ }
+ /* fall through */
+
+ case LRR_GOTO_LBA:
+
+ /* To prevent fall thru of above case */
+ if( req->lp_message != LRR_EOM_ACK ) {
+
+ if( channel->cur_drv->cur_pos.tape_seq != req->tape_loc.tape_seq ) {
+ CleanUpDriverQ( channel ) ;
+
+ /* Ok, now lets switch to a new drive */
+ SetChannelStatus( channel, CH_AT_EOM ) ;
+ if( NextDriveInChannel( channel, TRUE ) == TF_END_CHANNEL ) {
+ ResetChannelList( channel, FALSE ) ;
+ }
+
+ channel->cur_drv->cur_pos.tape_seq = req->tape_loc.tape_seq ;
+ channel->cur_drv->cur_pos.pba_vcb = req->tape_loc.pba_vcb ;
+ channel->cur_drv->cur_pos.lba_vcb = req->tape_loc.lba_vcb ;
+ channel->cur_drv->cur_pos.lba = req->tape_loc.lba ;
+
+ channel->ui_tpos->tape_seq_num = req->tape_loc.tape_seq ;
+ channel->ts_num = req->tape_loc.tape_seq ;
+
+ if( ( ret_val = PositionAtSet( channel, channel->ui_tpos, FALSE ) ) == TFLE_NO_ERR ) {
+
+ /* Set the lba of the beginning of the buffer and
+ adjust the running lba
+ */
+ BM_SetBeginningLBA( channel->cur_buff, channel->cur_drv->cur_pos.lba_vcb ) ;
+ channel->running_lba =
+ channel->cur_drv->cur_pos.lba_vcb +
+ (UINT32)( BM_XferSize( channel->cur_buff ) /
+ channel->lb_size ) ;
+
+ /* If needed, tell the drive the base block position
+ we are positioning from.
+ */
+ if( DriveAttributes( ( channel->cur_drv ) ) & TDI_REAL_BLK_POS ) {
+ TpSpecial( channel->cur_drv->drv_hdl, (INT16)SS_PHYS_BLOCK, FS_ViewPBAinVCB( &channel->cur_drv->cur_vcb ) ) ;
+ }
+ }
+ ClrChannelStatus( channel, CH_AT_EOM ) ;
+
+ /* this is the case because we need a different tape */
+ switched_tapes = TRUE ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ /* Setup Local Variable */
+ lba = req->tape_loc.lba ;
+
+ /* We will not be in data phase ... hopefully */
+ ClrChannelStatus( channel, CH_DATA_PHASE ) ;
+
+ /* If the drive supports fast file positioning,
+ even on the EXABYTE 8200SX - MaynStream 2200+ - do it */
+ if( ( req->tape_loc.pba_vcb != MANUFACTURED_PBA &&
+ req->tape_loc.pba_vcb != 0 &&
+ SupportBlkPos( channel->cur_drv ) ) ||
+ SX_AbleToFindBlock( channel ) ) {
+
+ /* Do we already have the requested block */
+ if( !IsLBAInTheBuffers( channel, lba, &ret_val ) && ret_val == TFLE_NO_ERR ) {
+
+ UINT16 lba_offset = 0 ;
+
+ /* Clean Up any Pending driver requests */
+ CleanUpDriverQ( channel ) ;
+
+ /* Attempt to goto the correct block, if successful, re-queue all read
+ requests
+ */
+ if( SX_AbleToFindBlock( channel ) ) {
+ /* Find that Block on the EXABYTE 8200SX */
+ ret_val = SX_FindBlock( channel, req->tape_loc.lba, channel->ui_tpos, TF_SKIPPING_DATA ) ;
+ } else {
+ /* Go to that Block */
+ ret_val = GotoBlock( channel,
+ req->tape_loc.lba,
+ NULL, &lba_offset ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ /* Re-read all buffers */
+ channel->running_lba = lba -
+ lba_offset / channel->lb_size ;
+ FlushReads( channel ) ;
+ ret_val = AcquireReadBuffer( channel, TRUE ) ;
+ if ( ret_val != TFLE_NO_ERR && ! IsTFLE( ret_val ) ) {
+ /* somehow we got an exception already! */
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ BM_UpdCnts( channel->cur_buff, lba_offset ) ;
+ }
+ } else if ( ret_val == TFLE_USER_ABORT ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ }
+ }
+
+ } else {
+
+ /* indicate we are not doing fast file positioning */
+ req->tape_loc.pba_vcb = 0L ;
+
+ tmpBUF = channel->cur_buff ;
+
+ /* if we switched over to another tape then ... */
+ if( switched_tapes ) {
+
+ /* let's make sure we are back in sync ... */
+ req->tape_loc.lba_vcb = channel->cur_drv->cur_pos.lba_vcb ;
+ BM_SetBeginningLBA( tmpBUF, channel->cur_drv->cur_pos.lba_vcb ) ;
+ channel->running_lba =
+ channel->cur_drv->cur_pos.lba_vcb +
+ (UINT32)( BM_XferSize( channel->cur_buff ) /
+ channel->lb_size ) ;
+
+ FlushReads( channel ) ;
+ }
+
+ /* Simulate Goto block by reading until we hit the
+ buffer that contains the requested LBA
+ */
+ while( ret_val == TFLE_NO_ERR &&
+ ( lba > ( BM_BeginningLBA( tmpBUF ) +
+ ( ( BM_BytesFree( tmpBUF ) +
+ BM_NextByteOffset( tmpBUF ) ) /
+ channel->lb_size ) ) ) ) {
+
+ if( ( ret_val =
+ AcquireReadBuffer( channel, TRUE ) ) ==
+ TFLE_NO_ERR ) {
+ tmpBUF = channel->cur_buff ;
+ } else {
+ if ( ! IsTFLE( ret_val ) ) {
+ /* somehow we got an exception already! */
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ }
+ }
+ }
+
+ /* If no error, adjust the buffer to point to the
+ right place
+ */
+ if( ret_val == TFLE_NO_ERR ) {
+ BM_UpdCnts( tmpBUF,
+ (UINT16)( channel->lb_size -
+ ( BM_NextByteOffset( tmpBUF ) %
+ channel->lb_size ) ) ) ;
+
+ lba -= (UINT32)( BM_NextByteOffset( tmpBUF ) /
+ channel->lb_size ) ;
+ BM_UpdCnts( tmpBUF, (UINT16)( ( lba -
+ BM_BeginningLBA( tmpBUF ) ) *
+ channel->lb_size ) ) ;
+ }
+ }
+ }
+ }
+ /* fall through */
+
+ case LRR_START:
+ case LRR_STUFF:
+
+ /* If we are starting out, then do the start code */
+ if( req->lp_message == LRR_START ) {
+ ret_val = StartReadOperation( channel, req ) ;
+ /* Unless we did a seek to the start of the set, we're done.
+ otherwise we need to read in the VCB.
+ */
+ if( !req->tape_loc.pba_vcb ||
+ ( channel->cross_set == channel->bs_num &&
+ req->tape_loc.lba != channel->cross_lba ) ||
+ ( channel->cross_set != channel->bs_num &&
+ req->tape_loc.lba != 0 ) ) {
+
+ done = TRUE ;
+ }
+ }
+
+ if( req->filter_to_use == TF_SKIP_ALL_DATA || req->filter_to_use == TF_SKIP_DATA_STREAM ) {
+ if( req->filter_to_use == TF_SKIP_ALL_DATA ) {
+ SetChannelStatus( channel, CH_SKIP_ALL_STREAMS ) ;
+ } else {
+ SetChannelStatus( channel, CH_SKIP_CURRENT_STREAM ) ;
+ }
+ (*channel->ui_tpos->UI_TapePosRoutine)( TF_SKIPPING_DATA, channel->ui_tpos, FALSE, NULL, channel->mode ) ;
+ }
+
+ while( !done && ret_val == TFLE_NO_ERR ) {
+
+ /* Normal Case ... We only want one pass */
+ done = TRUE ;
+
+ /* Is there data associated with this TBLK */
+ if( DataPhase( channel ) ) {
+
+
+ ret_val = GetData( channel, req ) ;
+
+ if( req->buff_size && DataPhase( channel ) ) {
+ req->tf_message = TRR_DATA ;
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR &&
+ channel->read_from_tape &&
+ ( channel->cur_buff == NULL ||
+ BM_BytesFree( channel->cur_buff ) == 0 ) ) {
+ if ( ! AtEOM( channel ) && ! IsSetDone( channel ) ) {
+ if( ( ret_val = AcquireReadBuffer( channel, FALSE ) ) == TFLE_NO_ERR ) {
+ if( BM_BytesFree( channel->cur_buff ) == 0 ) {
+ done = FALSE ;
+ continue ; /* for another AcquireReadBuffer */
+ }
+ } else if ( ! IsTFLE( ret_val ) ) {
+ /* hitting an exception is handled later. */
+ ret_val = TFLE_NO_ERR ;
+ }
+ }
+ if( AtEOM( channel ) ) {
+ req->tf_message = TRR_EOM ;
+ req->buff_size = 0 ;
+ req->buff_used = 0 ;
+ } else if( IsSetDone( channel ) ) {
+ SetPosBit( channel->cur_drv, AT_EOS ) ;
+ req->tf_message = TRR_END ;
+ }
+ }
+
+ if( !ret_val && req->tf_message != TRR_END && req->tf_message != TRR_DATA && req->tf_message != TRR_EOM ) {
+
+ channel->cur_dblk = req->cur_dblk ;
+ channel->loop_filter = TF_KEEP_ALL_DATA ;
+ ClrChannelStatus( channel, CH_DATA_PHASE ) ;
+
+ /* Zero Out Buffer Stuff */
+ req->buff_size = req->buff_used = 0 ;
+
+ if( ( ret_val = RD_TranslateDBLK( channel, channel->cur_buff, &blk_type ) ) != TFLE_NO_ERR ) {
+ if( ret_val == TF_NO_MORE_DATA ) {
+ SetChannelStatus( channel, CH_DONE ) ;
+ SetPosBit( channel->cur_drv, AT_EOS ) ;
+ req->tf_message = TRR_END ;
+ ret_val = TFLE_NO_ERR ;
+ } else {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ req->tf_message = TRR_FATAL_ERR ;
+ }
+ } else {
+
+ switch( blk_type ) {
+
+ case BT_FDB:
+ *req->fdb_ptr = *req->cur_dblk ;
+ channel->lst_fid = FS_ViewBLKIDinDBLK( req->cur_dblk ) ;
+ req->tf_message = TRR_FDB ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( req->cur_dblk ) ;
+ break ;
+
+ case BT_DDB:
+ *req->ddb_ptr = *req->cur_dblk ;
+ channel->lst_did = FS_ViewBLKIDinDBLK( req->cur_dblk ) ;
+ req->tf_message = TRR_DDB ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( req->cur_dblk ) ;
+ break ;
+
+ case BT_VCB:
+ *req->vcb_ptr = *req->cur_dblk ;
+ req->tf_message = TRR_VCB ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( req->cur_dblk ) ;
+ break ;
+
+ case BT_MDB:
+ done = FALSE ;
+ break ;
+
+ case BT_UDB:
+ done = FALSE ;
+ break ;
+
+ case BT_IDB:
+ *req->idb_ptr = *req->cur_dblk ;
+ req->tf_message = TRR_IDB ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( req->cur_dblk ) ;
+ break ;
+
+ case BT_CFDB:
+ req->tf_message = TRR_CFDB ;
+ channel->eom_id = FS_ViewBLKIDinDBLK( req->cur_dblk ) ;
+ break ;
+
+ case BT_STREAM:
+ req->tf_message = TRR_NEW_STREAM ;
+ SetChannelStatus( channel, CH_DATA_PHASE ) ;
+ req->stream = channel->current_stream ;
+ if( IsChannelStatus( channel, ( CH_SKIP_ALL_STREAMS | CH_SKIP_CURRENT_STREAM ) ) ) {
+ done = FALSE ;
+ continue ;
+ }
+ break ;
+
+ case BT_HOSED:
+ default:
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ req->tf_message = TRR_FATAL_ERR ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ break ;
+
+ }
+ }
+
+ } else if( req->tf_message == TRR_END ) {
+ while ( ( qe_ptr = DeQueueElem( &channel->cur_drv->inproc_q ) ) != NULL ) {
+ tmpBUF = QueuePtr( qe_ptr );
+ BM_Put( tmpBUF ) ;
+ }
+ }
+ } /* while !done */
+
+ break ;
+
+ case LRR_SKIP_STREAM:
+
+ break ;
+
+
+ default:
+ msassert( FALSE );
+ break;
+ } /* end switch */
+
+ if( IsPosBitSet( channel->cur_drv, REW_CLOSE ) ) {
+ FreeFormatEnv( &( channel->cur_fmt ), &( channel->fmt_env ) ) ;
+ }
+ if( ret_val != TFLE_NO_ERR &&
+ ret_val != TFLE_USER_ABORT &&
+ ret_val != TFLE_UI_HAPPY_ABORT ) {
+
+ CleanUpDriverQ( channel ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+
+
+/**/
+/**
+
+ Name: AcquireReadBuffer
+
+ Description: Gets a packet of data from the tape.
+
+ Modified: 9/7/1989 14:14:26
+
+ Returns: if error: TFLE_xxx codes
+ if non-ignored exception: FMT_EXC_xxx codes
+ if we got data: TFLE_NO_ERR
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static INT16 _near AcquireReadBuffer(
+ CHANNEL_PTR channel,
+ BOOLEAN ignore_eos )
+{
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ BUF_PTR tmpBUF ;
+ RET_BUF myret ;
+ UINT16 exception_type ;
+ BOOLEAN done = FALSE ;
+
+ /* If this function is called, and we say we think we are done, then there
+ be a problem */
+ if( IsSetDone( channel ) && !ignore_eos ) {
+ return( TFLE_UNEXPECTED_EOS ) ;
+ }
+
+ if ( channel->cur_buff != NULL && BM_ReadError( channel->cur_buff ) != GEN_NO_ERR ) {
+
+ BM_UseAll( channel->cur_buff ) ;
+
+ /* ask the translator how to handle the exception */
+ ret_val = RD_Exception( channel, BM_ReadError( channel->cur_buff ), &exception_type ) ;
+ if ( exception_type == FMT_EXC_EOS ) {
+ SetChannelStatus( channel, CH_DONE ) ;
+ }
+
+ if ( ret_val != TFLE_NO_ERR || exception_type != FMT_EXC_IGNORE ) {
+ PuntBuffer( channel ) ;
+ if ( ret_val != TFLE_NO_ERR ) {
+ return ret_val ;
+ } else {
+ return (INT16)exception_type ;
+ }
+ }
+ }
+
+ /* Since we have called this function,
+ we must be done with the current buffer */
+
+ if ( channel->cur_buff != NULL ) {
+ PuntBuffer( channel ) ;
+
+ /* Decide if we are using DMA or PIO */
+ if( !( lw_tfl_control.cntl_cards[curDRV->thw_inf.card_no].card_attribs & DD_CARD_NON_ASYNC ) ) {
+ if( !TpSpecial( drv_hdl, (INT16)SS_IS_ERROR, 0L ) ) {
+ tmpBUF = BM_Get( &channel->buffer_list ) ;
+ if ( tmpBUF != NULL ) {
+ if ( !ReadRequest( channel, tmpBUF ) ) {
+ BM_Put( tmpBUF );
+ }
+ }
+ }
+ } else { /* PIO */
+ FlushReads( channel ) ;
+ }
+ }
+
+ while( !done ) {
+ while( TpReceive( drv_hdl, &myret ) == FAILURE )
+ ThreadSwitch() ; /* for non-preemptive operating systems */
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if( myret.call_type == GEN_SPECIAL ) {
+ /* we got a position information sample */
+ if( myret.gen_error == GEN_NO_ERR ) {
+ /* write the sample to the SX file */
+ SX_WriteTmpFile( channel ) ;
+ }
+ } else {
+
+ tmpBUF = QueuePtr( DeQueueElem( &curDRV->inproc_q ) ) ;
+ BM_SetBytesFree( tmpBUF, (UINT16)myret.len_got ) ;
+ BM_SetReadError( tmpBUF, myret.gen_error ) ;
+ channel->cur_buff = tmpBUF ;
+ done = TRUE ;
+ TF_ReadBufferHook( channel, tmpBUF );
+
+ if( myret.gen_error != GEN_NO_ERR ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_DEVICE_ERROR, myret.gen_error ) ;
+ BE_Zprintf( 0, TEXT("Len Req = %ld Len Got = %ld\n"), myret.len_req, myret.len_got ) ;
+ DumpDebug( drv_hdl ) ;
+ curDRV->thw_inf.drv_status = myret.status ;
+ curDRV->cur_stats.underruns = myret.underruns ;
+ curDRV->cur_stats.dataerrs = myret.readerrs ;
+ /* maintain our filemark position */
+ if ( myret.gen_error == GEN_ERR_ENDSET || myret.gen_error == GEN_ERR_EOM ) {
+ curDRV->cur_pos.fmks++ ;
+
+ /* consider ending the gathering of positioning information for this set */
+ if( SX_IsStatusSet( channel, SX_SCAN_ACTIVE ) ) {
+ if( SX_TmpFileIsOK( channel ) ) {
+ SX_EndSampling( channel ) ;
+ }
+
+ /* we are not scanning tape any more */
+ SX_ClearStatus( channel, SX_SCAN ) ;
+ }
+ }
+ }
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: GetData
+
+ Description: During a data phase of tape reading, parcels out data.
+
+ Modified: 9/11/1989 9:9:3
+
+ Returns: An error code, or zero if successful.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static INT16 _near GetData(
+ CHANNEL_PTR channel,
+ RR_PTR req )
+{
+
+ INT16 ret_val = TFLE_NO_ERR ;
+ BUF_PTR cur_buf = channel->cur_buff ;
+ UINT16 amount ;
+ BOOLEAN t_ret_val, status ;
+ STREAM_INFO_PTR currentStream = &channel->current_stream ;
+
+ /* To Handle aborted sets */
+ if( IsSetDone( channel ) ) {
+ if ( cur_buf == NULL ) { // chs:02-22-93 per MikeP
+ return( TFLE_TAPE_INCONSISTENCY ) ; // chs:02-22-93 per MikeP
+ } // chs:02-22-93 per MikeP
+ if( U64_GT( currentStream->size,
+ U64_Init( BM_BytesFree( cur_buf ), 0L ) ) ) {
+ return( TFLE_TAPE_INCONSISTENCY ) ;
+ }
+ }
+
+ if( IsChannelStatus( channel, ( CH_SKIP_ALL_STREAMS | CH_SKIP_CURRENT_STREAM ) ) ) {
+
+
+
+ /* Is there any data to skip */
+ while( ( U64_EQ( currentStream->size, U64_Init( 0L, 0L ) ) == FALSE ) &&
+ ret_val == TFLE_NO_ERR ) {
+ if( (*channel->ui_tpos->UI_TapePosRoutine)( TF_IDLE, channel->ui_tpos, FALSE, NULL, channel->mode ) == UI_ABORT_POSITIONING ) {
+ return( TFLE_USER_ABORT ) ;
+ }
+ if ( BM_BytesFree( cur_buf ) == 0 ) {
+ if( AtEOM( channel ) ) {
+ return( ret_val ) ;
+ } else {
+ if ( ( ret_val = AcquireReadBuffer( channel, FALSE ) ) == TFLE_NO_ERR ) {
+ cur_buf = channel->cur_buff ;
+ }
+ }
+ }
+
+ if ( ret_val == TFLE_NO_ERR ) {
+
+ amount = CalcReTransSize( channel, currentStream->size ) ;
+
+ BM_UpdCnts( cur_buf, amount ) ;
+
+ currentStream->size = U64_Sub( currentStream->size,
+ U64_Init( ( UINT32 ) amount, 0 ), &status ) ;
+
+
+ if ( U64_EQ( channel->retranslate_size, CH_NO_RETRANSLATE_40 ) == FALSE ) {
+ channel->retranslate_size =
+ U64_Sub( channel->retranslate_size,
+ U64_Init( amount, 0L ), &t_ret_val );
+ }
+ } else {
+// if ( ! IsTFLE( ret_val ) ) { /* is this FMT_EXC_xxx ? */
+// ret_val = TFLE_NO_ERR ;
+// }
+ }
+ }
+ if ( ret_val != FMT_EXC_EOM ) {
+ ClrChannelStatus( channel, CH_DATA_PHASE ) ;
+ }
+
+ } else {
+
+ /* We want the data to this stream */
+
+
+ /* Are we supposed to get any data */
+ if( ( U64_EQ( currentStream->size, U64_Init( 0L, 0L ) ) == FALSE ) &&
+ ret_val == TFLE_NO_ERR ) {
+ /* How Much did he use ? */
+ BM_UpdCnts( cur_buf, req->buff_used ) ;
+
+ currentStream->size = U64_Sub( channel->current_stream.size,
+ U64_Init( ( UINT32 ) req->buff_used, 0 ), &status ) ;
+
+ if ( U64_EQ( channel->retranslate_size,
+ CH_NO_RETRANSLATE_40 ) == FALSE ) {
+ channel->retranslate_size =
+ U64_Sub( channel->retranslate_size,
+ U64_Init( req->buff_used, 0L ), &t_ret_val ) ;
+ }
+
+ /* loop is because retranslate could eat last part of buffer */
+ do {
+ /* Is This buffer used up */
+ if( BM_BytesFree( cur_buf ) == 0 &&
+ ( U64_EQ( currentStream->size, U64_Init( 0L, 0L ) ) == FALSE ) ) {
+
+ if ( ( ret_val = AcquireReadBuffer( channel, FALSE ) ) == TFLE_NO_ERR ) {
+ cur_buf = channel->cur_buff ;
+ }
+ }
+
+ if ( ret_val == TFLE_NO_ERR ) {
+ req->buff_size = CalcReTransSize( channel,
+ currentStream->size ) ;
+ req->buff_ptr = BM_NextBytePtr( cur_buf ) ;
+ }
+
+ } while ( ret_val == TFLE_NO_ERR && req->buff_size == 0 &&
+ U64_EQ( currentStream->size, U64_Init( 0L, 0L ) ) == FALSE ) ;
+ }
+
+ }
+
+ if ( ret_val != TFLE_NO_ERR && !IsTFLE( ret_val ) ) {
+ return TFLE_NO_ERR ; /* on exceptions */
+ } else {
+ return ret_val ;
+ }
+}
+
+/**/
+/**
+
+ Name: CalcReTransSize
+
+ Description: Calculates the retranslate size based on the channel info
+
+ Modified: 4/12/1990 14:5:20
+
+ Returns: UINT16, the amount to use from this buffer
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static UINT16 _near CalcReTransSize(
+ CHANNEL_PTR channel,
+ UINT64 amount )
+{
+ UINT16 to_use, usable ;
+
+ /* There is no retranslate */
+ if( U64_EQ( channel->retranslate_size, CH_NO_RETRANSLATE_40 ) ) {
+
+ to_use = (UINT16)( ( U64_Lsw( amount ) >
+ BM_BytesFree( channel->cur_buff ) ||
+ U64_Msw( amount ) != 0L )
+ ? BM_BytesFree( channel->cur_buff )
+ : U64_Lsw( amount ) ) ;
+
+ } else if( U64_EQ( channel->retranslate_size, CH_IMMEDIATE_RETRANSLATE_40 ) ) {
+
+ if ( RD_ReTranslateDBLK( channel, channel->cur_buff ) ) {
+
+ usable = (UINT16)( ( U64_Lsw( amount ) >
+ BM_BytesFree( channel->cur_buff ) ||
+ U64_Msw( amount ) != 0L )
+ ? BM_BytesFree( channel->cur_buff )
+ : U64_Lsw( amount ) ) ;
+
+ to_use = (UINT16)( ( U64_Lsw( channel->retranslate_size ) >
+ usable ||
+ U64_Msw( amount ) != 0L )
+ ? usable
+ : U64_Lsw( channel->retranslate_size ) ) ;
+
+ } else {
+ to_use = 0 ;
+ }
+ } else {
+ usable = (UINT16)( ( U64_Lsw( amount ) >
+ BM_BytesFree( channel->cur_buff ) ||
+ U64_Msw( amount ) != 0L )
+ ? BM_BytesFree( channel->cur_buff )
+ : U64_Lsw( amount ) ) ;
+
+ to_use = (UINT16)( ( U64_Lsw( channel->retranslate_size ) >
+ usable ||
+ U64_Msw( amount ) != 0L )
+ ? usable
+ : U64_Lsw( channel->retranslate_size ) ) ;
+ }
+
+ return( to_use ) ;
+}
+
+/**/
+/**
+
+ Name: ReadRequest
+
+ Description: EnQueues a Request for Read.
+
+ Modified: 6/19/1990 9:54:20
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static BOOLEAN _near ReadRequest(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ /* do we need to sample the position for an EXABYTE 8200SX - MaynStream 2200+ ? */
+ if( SX_IsStatusSet( channel, SX_SCAN_ACTIVE ) &&
+ SX_TmpFileIsOK( channel ) ) {
+
+ SX_SamplingProcessing( channel, ( UINT32 )BM_XferSize( buffer ) ) ;
+
+ /* do we need to keep track of where the EXABYTE 8200SX - MaynStream 2200+ is a fast file search ? */
+ } else if( SX_IsStatusSet( channel, SX_AT_SET ) &&
+ SX_FileIsOK( channel ) ) {
+
+ SX_AdjustLBANow( channel, BM_XferSize( buffer ) ) ;
+ }
+
+ /* Read */
+ if ( TpRead( channel->cur_drv->drv_hdl, BM_XferBase( buffer ),
+ (UINT32)BM_XferSize( buffer ) ) == SUCCESS ) {
+
+ /* Update the first LBA in this buffer */
+ BM_SetBeginningLBA( buffer, channel->running_lba ) ;
+
+ /* Update the running LBA count */
+ channel->running_lba += (UINT32)( BM_XferSize( buffer ) /
+ channel->lb_size ) ;
+
+ /* Put it on the in process queue */
+ EnQueueElem( &channel->cur_drv->inproc_q, &BM_QElem( buffer ), FALSE ) ;
+
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+
+/**/
+/**
+
+ Name: EOM_Read
+
+ Description: Handles the EOM processing during a read sequence.
+
+ Modified: 9/13/1989 11:13:1
+
+ Returns: An error code if there is an error, and 0 if there is
+ not.
+
+ Notes: IT IS ASSUMED THAT THE "cur_dblk" IN THE CURRENT CHANNEL
+ IS SET BEFORE THIS FUNCTION IS CALLED.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static INT16 _near EOM_Read(
+ CHANNEL_PTR channel )
+{
+ INT16 ret_val = TFLE_NO_ERR, tmp ;
+ DRIVE_PTR old_drv = channel->cur_drv ;
+ BUF_PTR tmp_buf ;
+ Q_ELEM_PTR qe_ptr;
+ UINT16 save_stats = channel->status & (CH_SKIP_ALL_STREAMS|CH_SKIP_CURRENT_STREAM) ;
+
+ PuntBuffer( channel ) ;
+
+ /* Now Get rid of all pending reads */
+ while ( ( qe_ptr = DeQueueElem( &old_drv->inproc_q ) ) != NULL ) {
+ tmp_buf = QueuePtr( qe_ptr );
+ channel->cur_buff = tmp_buf ;
+ PuntBuffer( channel ) ;
+ }
+
+ /* Ok, now lets switch to a new drive */
+ tmp = NextDriveInChannel( channel, TRUE ) ;
+
+ if( IsTFLE( tmp ) ) {
+ ret_val = tmp ;
+ } else {
+ if( tmp == TF_END_CHANNEL ) {
+ tmp = ResetChannelList( channel, FALSE ) ;
+ if( IsTFLE( tmp ) ) {
+ ret_val = tmp ;
+ }
+ }
+ }
+
+ if( !ret_val ) {
+ /* If we are actually sitting at end of data, rewind drive before
+ proceeding */
+ if( IsPosBitSet( channel->cur_drv, AT_EOD ) ) {
+ RewindDrive( channel->cur_drv, channel->ui_tpos, TRUE, TRUE, channel->mode ) ;
+ }
+ /* Let's do some more positioning */
+ channel->ui_tpos->tape_id = channel->tape_id ;
+ channel->ui_tpos->tape_seq_num = ++( channel->ts_num ) ;
+ channel->cur_drv->cur_pos.tape_seq = channel->ts_num ;
+ channel->ui_tpos->backup_set_num = channel->bs_num ;
+
+ if( ( ret_val = PositionAtSet( channel, channel->ui_tpos, FALSE ) ) == TFLE_NO_ERR ) {
+
+ /* we may be scanning tape on an SX drive */
+ HandleSXStartScanTapeConcerns( channel ) ;
+
+ /* Do the continuation read */
+ if( !RD_ContinuationTape( channel, channel->cur_buff ) ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ } else {
+
+ /* If we already have a buffer, and we haven't accounted for it
+ do so now */
+ if( SX_IsStatusSet( channel, SX_SCAN_ACTIVE ) &&
+ SX_IsOK( channel ) ) {
+
+ /* adjust the LBA for the continuation TpRead() call */
+ SX_AdjustLBANow( channel, BM_XferSize( channel->cur_buff ) ) ;
+ }
+
+ /* If needed, tell the drive the base block position we
+ are positioning from.
+ */
+ if( DriveAttributes( ( channel->cur_drv ) ) & TDI_REAL_BLK_POS ) {
+ TpSpecial( channel->cur_drv->drv_hdl, (INT16)SS_PHYS_BLOCK, FS_ViewPBAinVCB( &channel->cur_drv->cur_vcb ) ) ;
+ }
+
+ if( BM_ReadError( channel->cur_buff ) == GEN_NO_ERR ) {
+ FlushReads( channel ) ;
+ }
+ }
+ }
+ }
+
+ /* set the flag to false */
+ ClrChannelStatus( channel, CH_AT_EOM ) ;
+
+ channel->status &= ~(CH_SKIP_ALL_STREAMS|CH_SKIP_CURRENT_STREAM) ;
+ channel->status |= save_stats ;
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: FlushReads
+
+ Description: Flushs the remaining allowed buffers to tape.
+
+ Modified: 2/2/1990 16:54:33
+
+ Returns: Nada
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static VOID _near FlushReads(
+ CHANNEL_PTR channel )
+{
+ BUF_PTR tmpBUF ;
+
+ /* Okie-dokie, let's fill in some of dem der buffers */
+ while ( !IsSetDone( channel ) ) {
+ if ( ( tmpBUF = BM_Get( &channel->buffer_list ) ) != NULL ) {
+ if ( !ReadRequest( channel, tmpBUF ) ) {
+ BM_Put( tmpBUF );
+ break;
+ }
+ } else {
+ break ;
+ }
+ }
+}
+
+
+/**/
+/**
+
+ Name: AbortRead
+
+ Description: Cleans up an early read termination.
+
+ Modified: 2/12/1990 17:0:8
+
+ Returns: Nothing.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static VOID _near AbortRead(
+ CHANNEL_PTR channel,
+ INT16 ret_val )
+{
+ (VOID) ret_val ;
+
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_ABORT_READ ) ;
+ CleanUpDriverQ( channel ) ;
+ if( ! ( IsPosBitSet( channel->cur_drv, AT_EOS ) ) ) {
+ SetPosBit( channel->cur_drv, AT_MOS ) ;
+ }
+}
+
+/**/
+/**
+
+ Name: IsLBAInTheBuffers
+
+ Description: Determines whether or not the requested LBA is already in the
+ buffers that we have.
+
+ Modified: 6/13/1990 9:45:30
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static BOOLEAN _near IsLBAInTheBuffers(
+ CHANNEL_PTR channel,
+ UINT32 lba,
+ INT16_PTR err_code )
+{
+ BOOLEAN ret_val = FALSE ;
+ BUF_PTR tmpBUF = channel->cur_buff ;
+
+ /* Is the requested block within the already enq'd read buffers ? */
+ if( lba < channel->running_lba ) {
+
+ /* While away the until we find the right buffer */
+ while( lba > ( BM_BeginningLBA( tmpBUF ) +
+ ( ( BM_BytesFree( tmpBUF ) +
+ BM_NextByteOffset( tmpBUF ) ) /
+ channel->lb_size ) ) ) {
+
+ if( ( *err_code = AcquireReadBuffer( channel, TRUE ) ) != TFLE_NO_ERR ) {
+ if ( !IsTFLE( *err_code ) ) {
+ *err_code = TFLE_NO_ERR ;
+ }
+ return( ret_val ) ; /* this includes EXCeptions. */
+ }
+ tmpBUF = channel->cur_buff ;
+ }
+
+ /* Now adjust the pointer to point to the requested LBA */
+ BM_UpdCnts( tmpBUF, (UINT16)( channel->lb_size -
+ ( BM_NextByteOffset( tmpBUF ) %
+ channel->lb_size ) ) ) ;
+ lba -= (UINT32)( BM_NextByteOffset( tmpBUF ) / channel->lb_size ) ;
+ BM_UpdCnts( tmpBUF, (UINT16)( ( lba - BM_BeginningLBA( tmpBUF ) ) *
+ channel->lb_size ) ) ;
+ ret_val = TRUE ;
+ }
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: CleanUpDriverQ
+
+ Description: Cleans Up any pending requests on the driver queue.
+
+ Modified: 6/14/1990 12:5:13
+
+ Returns:
+
+ Notes: Punts current buffer, also.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+static VOID _near CleanUpDriverQ( CHANNEL_PTR channel )
+{
+ BUF_PTR tmpBUF ;
+ RET_BUF myret ;
+ BOOLEAN done = FALSE ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ UINT16 exception_type ; /* translator's exception_typeretation of exception (ignored) */
+ Q_ELEM_PTR qe_ptr ;
+
+ if ( channel->cur_buff != NULL ) {
+ if ( BM_ReadError( channel->cur_buff ) != GEN_NO_ERR ) {
+ done = TRUE ;
+ if( channel->cur_fmt != UNKNOWN_FORMAT ) {
+ RD_Exception( channel, BM_ReadError( channel->cur_buff ), &exception_type ) ;
+ if ( exception_type == FMT_EXC_EOS ) {
+ SetChannelStatus( channel, CH_DONE ) ;
+ }
+ } else {
+ PuntBuffer( channel ) ;
+ }
+ } else {
+ PuntBuffer( channel ) ;
+ }
+ }
+
+ while ( !done && curDRV->inproc_q.q_count > 0 ) {
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE )
+ ThreadSwitch() ; /* for non-preemptive operating systems */
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if( myret.call_type == GEN_SPECIAL ) {
+ if( !myret.gen_error ) {
+ /* write the positioning information sample to the SX file */
+ SX_WriteTmpFile( channel ) ;
+ }
+ } else {
+ tmpBUF = QueuePtr( DeQueueElem( &curDRV->inproc_q ) ) ;
+ msassert( tmpBUF != NULL ) ;
+ BM_SetBytesFree( tmpBUF, (UINT16)myret.len_got ) ;
+ BM_SetReadError( tmpBUF, myret.gen_error ) ;
+ channel->cur_buff = tmpBUF ;
+
+ if( myret.gen_error ) {
+ done = TRUE ;
+ curDRV->thw_inf.drv_status = myret.status ;
+ if( channel->cur_fmt != UNKNOWN_FORMAT ) {
+ RD_Exception( channel, myret.gen_error, &exception_type ) ;
+ if ( exception_type == FMT_EXC_EOS ) {
+ SetChannelStatus( channel, CH_DONE ) ;
+ }
+ } else {
+ PuntBuffer( channel ) ;
+ }
+ } else {
+ PuntBuffer( channel ) ;
+ }
+ }
+ }
+
+ msassert( channel->cur_buff == NULL ) ; /* we must not have ignored the exception. */
+
+ /* Clean up the channel in-process queue */
+ while ( ( qe_ptr = DeQueueElem( &channel->cur_drv->inproc_q ) ) != NULL ) {
+ tmpBUF = QueuePtr( qe_ptr );
+ channel->cur_buff = tmpBUF ;
+ PuntBuffer( channel ) ;
+ }
+}
+
+
+/**/
+/**
+$name$
+HandleSXStartScanTapeConcerns
+
+$paths$
+functions\all
+module\read.c
+subsystem\TAPE FORMAT\read.c
+$0$
+
+ Name: HandleSXStartScanTapeConcerns
+
+ Description: Considers whether the SX positioning information should be gathered for this tape
+
+ Modified: 5/11/1991
+
+ Returns: VOID
+
+ Notes:
+
+ Declaration:
+
+$-2$
+**/
+
+static VOID _near HandleSXStartScanTapeConcerns( CHANNEL_PTR channel )
+{
+// DRIVE_PTR curDRV = channel->cur_drv ;
+
+ /* positioning information may need to be gathered if this is an EXABYTE 8200sx - MaynStream 2200+ drive */
+ if( SX_IsStatusSet( channel, SX_LIST_TAPE_IN_PROGRESS ) ) {
+
+ if( SX_IsStatusSet( channel, SX_VCB_CONFIRMED ) &&
+ SX_IsOK( channel ) ) {
+
+ /* open SX file for this physical tape */
+ if( SX_OpenFile( channel,
+ channel->tape_id,
+ channel->ts_num ) ) {
+
+ /* if some record of the set exists in the SX file THEN ... */
+ if( SX_SeekSetInFile( channel,
+ channel->bs_num,
+ (INT16)SX_CHECKING_FOR_SET ) ) {
+
+ /* indicate the operation is not necessary */
+ SX_SetStatus( channel, SX_SCAN_INOPERATIVE ) ;
+ }
+
+ /* just close the file */
+ SX_CloseFile( channel ) ;
+ }
+
+ /* if we are able and still willing to get positioning information ... */
+ if( ( !( SX_IsStatusSet( channel, SX_SCAN_INOPERATIVE ) ) ) &&
+ ( SX_IsOK( channel ) ) ) {
+
+ /* indicate the operation is needed */
+ SX_SetStatus( channel, SX_SCAN_ACTIVE ) ;
+
+ /* get the operation going */
+ SX_StartSampling( channel ) ;
+ }
+ } else {
+
+ /* indicate the operation is not able to happen */
+ SX_SetStatus( channel, SX_SCAN_INOPERATIVE ) ;
+ }
+ }
+}
+
diff --git a/private/utils/ntbackup/src/tfreten.c b/private/utils/ntbackup/src/tfreten.c
new file mode 100644
index 000000000..ec8662c42
--- /dev/null
+++ b/private/utils/ntbackup/src/tfreten.c
@@ -0,0 +1,299 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tfreten.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the function to retension the drives.
+
+
+ $Log: T:/LOGFILES/TFRETEN.C_V $
+
+ Rev 1.22 30 Mar 1993 16:15:32 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.21 30 Jan 1993 11:51:30 DON
+Removed compiler warnings
+
+ Rev 1.20 21 Jan 1993 14:23:38 GREGG
+Changed '*' to '&' in bitwise compare (details, details).
+
+ Rev 1.19 19 Jan 1993 15:41:48 GREGG
+Fixed setting of channel status bits.
+
+ Rev 1.18 18 Jan 1993 14:09:44 GREGG
+Changes to allow format command passed to driver through TpErase.
+
+ Rev 1.17 11 Nov 1992 22:16:56 GREGG
+Changed call to EraseDrive (only security boolean needed).
+
+ Rev 1.16 19 Feb 1992 17:00:12 GREGG
+Put the buffer back after user abort.
+
+ Rev 1.15 08 Feb 1992 14:27:24 GREGG
+Changed check for lst_oper == -1 to check for boolean force_rewind, since
+this is what the lst_oper field in the drive structure had been reduced to.
+
+ Rev 1.14 04 Feb 1992 21:11:16 GREGG
+If no tape is in the drive, don't rewind, but still call posatset.
+
+ Rev 1.13 22 Jan 1992 15:19:12 GREGG
+Do our own drive list traversal beacuse NextDriveInChannel does too much.
+
+ Rev 1.12 15 Jan 1992 01:40:38 GREGG
+Added param to posatset calls indicating if only a VCB of the tape is required.
+
+ Rev 1.11 02 Jan 1992 14:54:04 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.10 10 Dec 1991 17:15:32 GREGG
+Removed memset of channel structure to 0.
+
+ Rev 1.9 03 Dec 1991 11:51:14 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.8 21 Nov 1991 17:50:38 GREGG
+Check flag indicating a need to rewind before calling PositionAtSet.
+
+ Rev 1.7 17 Oct 1991 01:30:48 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.6 14 Oct 1991 11:03:08 GREGG
+Assert if we are called with the tape already mounted.
+
+ Rev 1.5 07 Oct 1991 22:18:10 GREGG
+Make sure the fmt env pointers are maintained in only one place at any given time.
+
+ Rev 1.4 25 Sep 1991 20:41:14 GREGG
+Set channel->cur_buff to NULL after BM_Put.
+
+ Rev 1.3 23 Sep 1991 12:20:16 GREGG
+Changed do-while condition to !=.
+
+ Rev 1.2 17 Sep 1991 11:33:28 GREGG
+Re-wrote TF_RetensionChannel to fix several bugs, merge in TF_EraseChannel,
+and add ability to Tension tape without pre-read.
+
+ Rev 1.1 10 May 1991 16:08:18 GREGG
+Ned's new stuff
+
+ Rev 1.0 10 May 1991 10:12:00 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwdefs.h"
+#include "tflopen.h"
+#include "lwprotos.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "translat.h"
+#include "sx.h"
+#include "fsys.h"
+
+#include "be_debug.h"
+
+/* Device Driver Interface Files */
+#include "generr.h"
+#include "genstat.h"
+#include "dil.h"
+
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: TF_RetensionChannel
+
+ Description: Retensions or Erases all devices in the current channel,
+ based on the mode sent to it.
+
+ Modified: 9/27/1989 13:18:28
+
+ Returns: An error code.
+
+ Notes: The mode is actually a bit field which tells if the oper
+ is retension or which type of erase, and also indicates
+ whether or not we should call PositionAtSet first to read
+ the tape, and confirm the operation.
+
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 TF_RetensionChannel(
+ TFL_OPBLK_PTR open_blk,
+ UINT16 mode )
+{
+
+ CHANNEL_PTR channel ;
+ UINT16 i, j ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ Q_ELEM_PTR nxt_elem ;
+ BOOLEAN is_tape_present, security ;
+
+ /* Find a free Channel Entry */
+ for( i = 0 ; i < lw_tfl_control.no_channels ; i++ ) {
+ if( !InUse( &lw_channels[i] ) ) {
+ open_blk->channel = i ;
+ channel = &lw_channels[i] ;
+ /* Find the Starting drive for this channel */
+ for( j = 0 ; j < (UINT16)lw_drive_list.q_count ; j++ ) {
+ if( lw_drives[j].thw_inf.link.q_element == open_blk->sdrv->link.q_element ) {
+ channel->cur_drv = &lw_drives[j] ;
+ }
+ }
+ break ;
+ } else {
+ ret_val = TFLE_NO_FREE_CHANNELS ;
+ }
+ }
+
+ if( !ret_val ) {
+ /* Set up channel stuff */
+ channel->ui_tpos = open_blk->tape_position ;
+ channel->cur_fsys = open_blk->fsh ;
+ channel->mode = TF_DESTROY_OPERATION ;
+ channel->status = CH_IN_USE ; /* clear all other channel status bits */
+
+ /* Loop through all the drives in the list */
+ do {
+ if( channel->cur_drv->tape_mounted ) {
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ } else {
+ ret_val = MountTape( channel->cur_drv, open_blk->tape_position, &is_tape_present ) ;
+ }
+ if( ret_val == TF_UNRECOGNIZED_MEDIA ) {
+ if( mode & TF_FMT ) {
+ mode |= TF_NO_RD ;
+ ret_val = TFLE_NO_ERR ;
+ } else {
+ ret_val = TFLE_UNRECOGNIZED_MEDIA ;
+ }
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ if( !( mode & TF_NO_RD ) ) {
+ if ( channel->cur_drv->last_fmt_env != NULL ) {
+ channel->cur_fmt = channel->cur_drv->last_cur_fmt ;
+ channel->fmt_env = channel->cur_drv->last_fmt_env ;
+ channel->cur_drv->last_cur_fmt = UNKNOWN_FORMAT ;
+ channel->cur_drv->last_fmt_env = NULL ;
+ }
+ if( channel->cur_drv->hold_buff != NULL ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_HOLD_BUFFER ) ;
+ channel->cur_buff = channel->cur_drv->hold_buff ;
+ channel->cur_drv->hold_buff = NULL ;
+ BM_UnReserve( channel->cur_buff ) ;
+ }
+ if( ( channel->cur_drv->thw_inf.drv_status & ( TPS_NEW_TAPE | TPS_RESET ) )
+ || ( channel->cur_drv->force_rewind )
+ || ( open_blk->rewind_sdrv ) ) {
+
+ channel->cur_drv->force_rewind = FALSE ;
+ if( channel->cur_buff ) {
+ BM_Put( channel->cur_buff ) ;
+ channel->cur_buff = NULL ;
+ }
+ channel->cur_drv->vcb_valid = FALSE ;
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ if( is_tape_present ) {
+ ret_val = RewindDrive( channel->cur_drv, channel->ui_tpos, TRUE, TRUE, channel->mode ) ;
+ }
+ SetPosBit( channel->cur_drv, AT_BOT ) ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = PositionAtSet( channel, open_blk->tape_position, TRUE ) ;
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ if( channel->cur_buff ) {
+ BM_Put( channel->cur_buff ) ;
+ channel->cur_buff = NULL ;
+ }
+ channel->cur_drv->vcb_valid = FALSE ;
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ if( mode & TF_FMT ) {
+ ret_val = EraseDrive( channel, TRUE, TRUE ) ;
+ } else if( mode & TF_RET ) {
+ ret_val = RetensionDrive( channel ) ;
+ } else {
+ security = (BOOLEAN)( ( mode & TF_S_ER ) &&
+ ( !( mode & TF_F_ER ) ) ) ;
+ ret_val = EraseDrive( channel, security, FALSE ) ;
+ if( ret_val == TFLE_NO_ERR ) {
+ /* In case there was EXABYTE SX - 2200+
+ positioning info in an SX file then
+ delete the SX file corresponding to the
+ physical tape in the drive which was
+ erased.
+ */
+ SX_DeleteFile( FS_ViewTapeIDInVCB( &channel->cur_drv->cur_vcb ),
+ FS_ViewTSNumInVCB( &channel->cur_drv->cur_vcb ) ) ;
+ }
+ }
+ } else if( ret_val == TFLE_USER_ABORT ) {
+
+ /* If the cur_buff has valid data, save it in hold_buff. */
+ if( channel->cur_buff != NULL &&
+ ( BM_BytesFree( channel->cur_buff ) != 0 ||
+ ( BM_ReadError( channel->cur_buff ) != GEN_NO_ERR &&
+ BM_ReadError( channel->cur_buff ) != GEN_ERR_NO_DATA ) ) ) {
+
+ BM_Reserve( channel->cur_buff ) ; /* mark as reserved */
+ channel->cur_drv->hold_buff = channel->cur_buff ;
+ channel->cur_buff = NULL ;
+ } else if( channel->cur_buff != NULL ) {
+ BM_Put( channel->cur_buff ) ;
+ channel->cur_buff = NULL ;
+ }
+
+ /* If the VCB's valid, save the currnt FormatEnv */
+ if( channel->cur_drv->vcb_valid ) {
+ channel->cur_drv->last_cur_fmt = channel->cur_fmt ;
+ channel->cur_drv->last_fmt_env = channel->fmt_env ;
+ channel->cur_fmt = UNKNOWN_FORMAT ;
+ channel->fmt_env = NULL ;
+ } else if( channel->fmt_env != NULL ) {
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ }
+ }
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = DisMountTape( channel->cur_drv, NULL, FALSE ) ;
+ } else {
+ DisMountTape( channel->cur_drv, NULL, FALSE ) ;
+ }
+
+ /* NOTE: we don't call NextDriveInChannel here because it */
+ /* does more than we want (Mount, DisMount, Rewind, etc.) */
+ if( ret_val == TFLE_NO_ERR ) {
+ if( ( nxt_elem = QueueNext( ( Q_ELEM_PTR ) &channel->cur_drv->thw_inf.channel_link ) ) != NULL ) {
+ channel->cur_drv = ( DRIVE_PTR ) GetQueueElemPtr( nxt_elem ) ;
+ }
+ }
+
+ } while( ret_val == TFLE_NO_ERR && nxt_elem != NULL ) ;
+
+ ClrChannelStatus( channel, CH_IN_USE ) ;
+ }
+
+ return( ret_val ) ;
+}
+
diff --git a/private/utils/ntbackup/src/tfrewind.c b/private/utils/ntbackup/src/tfrewind.c
new file mode 100644
index 000000000..a97721f4f
--- /dev/null
+++ b/private/utils/ntbackup/src/tfrewind.c
@@ -0,0 +1,116 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-91
+
+
+ Name: tfrwind.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: Contains the function to rewind all the drives.
+
+
+ $Log: T:/LOGFILES/TFREWIND.C_V $
+
+ Rev 1.5 30 Mar 1993 16:15:40 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.4 28 Feb 1992 15:42:50 NED
+added cast to shut compiler up
+
+ Rev 1.3 02 Jan 1992 14:54:24 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.2 17 Sep 1991 10:28:34 GREGG
+Removed unneeded includes.
+
+ Rev 1.1 21 Aug 1991 14:51:24 GREGG
+Changed to immediate return from rewind.
+
+ Rev 1.0 05 Aug 1991 12:12:36 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include "stdtypes.h"
+#include "queues.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+
+/* $end$ include list */
+
+
+/**/
+/**
+
+ Name: TF_RewindAllDrives
+
+ Description: Sets all drives with tape to rewinding, and returns.
+
+ Modified: 9/27/1989 13:18:28
+
+ Returns: A TFLE_xxx error code.
+
+ Notes: Will not rewind ANY drives if ANY of the channels are
+ currently in use.
+
+ Declaration:
+
+**/
+
+INT16 TF_RewindAllDrives( VOID )
+{
+
+ UINT16 i, j ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN is_tape_present ;
+
+ if( ! lw_tfl_control.drives_active ) {
+ ret_val = TFLE_NO_DRIVES ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+
+ /* Check for channels in use and report error if any are found. */
+ /* Otherwise mark them in use to avoid interruption. */
+ for( i = 0 ; i < lw_tfl_control.no_channels ; i++ ) {
+ if( InUse( &lw_channels[i] ) ) {
+ ret_val = TFLE_CHANNEL_IN_USE ;
+ for( j = 0 ; j < i ; j++ ) {
+ ClrChannelStatus( &lw_channels[j], CH_IN_USE ) ;
+ }
+ break ;
+ } else {
+ SetChannelStatus( &lw_channels[i], CH_IN_USE ) ;
+ }
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ /* Let's rewind them all */
+ for( i = 0 ; i < (UINT16)lw_drive_list.q_count && ret_val == TFLE_NO_ERR; i++ ) {
+
+ if( ( ret_val = MountTape( &lw_drives[i], NULL, &is_tape_present ) ) == TFLE_NO_ERR ) {
+ if( is_tape_present ) {
+ RewindDriveImmediate( &lw_drives[i] ) ;
+ }
+ ret_val = DisMountTape( &lw_drives[i], NULL, FALSE ) ;
+
+ } else if( ret_val == TF_UNRECOGNIZED_MEDIA ) {
+ /* Skip these, but don't bail out of the loop. */
+ ret_val = DisMountTape( &lw_drives[i], NULL, FALSE ) ;
+ }
+ }
+
+ /* Give them back their channels. */
+ for( i = 0 ; i < lw_tfl_control.no_channels ; i++ ) {
+ ClrChannelStatus( &lw_channels[i], CH_IN_USE ) ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
diff --git a/private/utils/ntbackup/src/tfstuff.c b/private/utils/ntbackup/src/tfstuff.c
new file mode 100644
index 000000000..a3ca63ec6
--- /dev/null
+++ b/private/utils/ntbackup/src/tfstuff.c
@@ -0,0 +1,290 @@
+/**
+Copyright(c) Conner Peripherals, Inc. 1993
+
+
+ Name: tfstuff.c
+
+ Description: This file contains functions formerly in tfgetnxt.c,
+ tfgtcfmt.c and tfgtcdev.c.
+
+ $Log: T:\logfiles\tfstuff.c_v $
+
+ Rev 1.3 17 Dec 1993 16:40:08 GREGG
+Extended error reporting.
+
+ Rev 1.2 30 Aug 1993 18:47:42 GREGG
+Modified the way we control hardware compression from software to work around
+a bug in Archive DAT DC firmware rev. 3.58 (we shipped a lot of them).
+Files Modified: lw_data.c, lw_data.h, tfstuff.c, mtf10wdb.c, mtf10wt.c and
+ drives.c
+
+ Rev 1.1 23 Jun 1993 11:11:32 GREGG
+Added cases I removed thinking they weren't needed in TF_GetNextTapeRequest.
+
+ Rev 1.0 22 Jun 1993 18:26:18 GREGG
+Combined tfgtcdev.c, tfgtcfmt.c and tfgetnxt.c, and added
+TF_SetHWCompression.
+
+**/
+
+#include <memory.h>
+#include "stdtypes.h"
+#include "queues.h"
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwdefs.h"
+#include "tflopen.h"
+#include "lwprotos.h"
+#include "tflproto.h"
+#include "translat.h"
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "be_debug.h"
+#include "dddefs.h"
+
+
+/**/
+/**
+
+ Name: TF_GetCurrentDevice
+
+ Description: Gets the current device for the specified channel.
+
+ Returns: A THW ptr to the current hardware device.
+
+ Notes:
+
+**/
+
+THW_PTR TF_GetCurrentDevice( UINT16 channel_no )
+{
+ CHANNEL_PTR channel = &lw_channels[channel_no] ;
+
+ return( &channel->cur_drv->thw_inf ) ;
+}
+
+
+/**/
+/**
+
+ Name: TF_GetTapeFormat
+
+ Description: Gets the current tape format desciptor for the specified.
+
+ Returns: An TFINF_PTR for the current format.
+
+ Notes:
+
+**/
+
+TFINF_PTR TF_GetTapeFormat( UINT16 channel_no )
+{
+ CHANNEL_PTR channel = &lw_channels[channel_no] ;
+
+ return (channel->cur_fmt != UNKNOWN_FORMAT) ? ( &lw_fmtdescr[channel->cur_fmt] ) : NULL ;
+}
+
+
+/**/
+/**
+
+ Name: TF_TapeFormatInfo
+
+ Description: Returns a pointer to the array of format descriptions.
+
+ Returns: A pointer to the first element, and the number of formats.
+
+ Notes:
+
+**/
+
+TFINF_PTR TF_GetTapeFormatInfo( UINT16_PTR num_formats )
+{
+ if ( num_formats != NULL ) {
+ *num_formats = lw_num_supported_fmts ;
+ }
+
+ return( &lw_fmtdescr[0] ) ;
+}
+
+
+/**/
+/**
+ Name: TF_GetTapeFormatID
+
+ Description: Gets the current tape format ID for the specified channel.
+
+ Returns: TFGT_UNKNOWN_FORMAT if we don't know, else an ID.
+
+ Notes:
+
+**/
+
+UINT16 TF_GetTapeFormatID( UINT16 channel_no )
+{
+ CHANNEL_PTR channel = &lw_channels[channel_no] ;
+
+ return (channel->cur_fmt != UNKNOWN_FORMAT)
+ ? ( lw_fmtdescr[channel->cur_fmt].format_id )
+ : TFGT_UNKNOWN_FORMAT ;
+}
+
+
+/**/
+/**
+ Name: TF_GetTapeFormatFromID
+
+ Description: Gets the current tape format desciptor for the specified.
+
+ Returns: A TFINF_PTR for the specified format, or NULL.
+
+ Notes:
+
+**/
+
+TFINF_PTR TF_GetTapeFormatFromID( UINT16 format_id )
+{
+ UINT16 format_index = FormatIndexFromID( format_id ) ;
+
+ return ( format_index == UNKNOWN_FORMAT ) ? NULL : lw_fmtdescr + format_index ;
+}
+
+
+/**/
+/**
+
+ Name: TF_GetNextTapeRequest
+
+ Description: Dispatches the loops IO request to the appropriate
+ handler.
+
+ Returns: A TFLE_xxx error code
+
+ Notes:
+
+**/
+
+INT16 TF_GetNextTapeRequest( RR_PTR req )
+{
+
+ INT16 ret_val = TFLE_NO_ERR ;
+ CHANNEL_PTR channel = &lw_channels[req->channel] ;
+
+ if( FatalError( channel ) ) {
+ /* A fatal error has occurred. If they are calling us with any
+ message other than an ABORT, fail the call. */
+ if( req->lp_message != LRR_ABORT || req->lp_message != LRW_ABORT ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_TF_GETNEXT_TAPE_REQUEST ) ;
+ return( TFLE_NO_ERR ) ; /* can't happen... */
+ } else {
+ return( TFLE_NO_ERR ) ;
+ }
+ }
+
+ switch( channel->mode ) {
+
+ case TF_WRITE_CONTINUE:
+ case TF_WRITE_OPERATION:
+ ret_val = DoWrite( channel, req ) ;
+ break ;
+
+ case TF_READ_CONTINUE:
+ case TF_READ_OPERATION:
+ case TF_SCAN_CONTINUE:
+ case TF_SCAN_OPERATION:
+ /* Set up the correct filter */
+ channel->loop_filter = req->filter_to_use ;
+ ret_val = DoRead( channel, req ) ;
+ break ;
+
+ default:
+ msassert( FALSE ) ;
+ break ;
+ }
+
+ if( ret_val ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_TF_GETNEXT_ERROR, ret_val ) ;
+ if ( ret_val != TFLE_USER_ABORT && ret_val != TFLE_UNEXPECTED_EOS ) {
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: TF_SetHWCompression
+
+ Description: This function used to make a TpSpecial Call to enable/
+ disable hardware compression. Due to a firmware bug in
+ early Archive DAT DC drives, we have to keep the drive
+ in uncompressed mode until we actually start a compressed
+ backup, and set it back to uncompressed mode as soon as
+ we're done. So we just set a tape format layer wide
+ global to indicate if the set is to be compressed. This
+ is yet another violation of the multiple channel concept,
+ and will have to be addressed in a different manner if
+ we ever decide to allow multiple channels.
+
+ Returns: A TFLE_xxx error code
+
+ Notes:
+
+**/
+
+INT16 TF_SetHWCompression( THW_PTR thw, BOOLEAN enable )
+{
+ (void)thw ;
+
+ lw_hw_comp = enable ;
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Name: TF_GetLastDriveError
+
+ Description: This function calls the dil layer to get the function
+ id, gen_error and contents of the misc field of the
+ last function to report an error.
+
+ Returns: FALSE if there hasn't been an error since the last
+ time the function was called, or from the app start.
+ TRUE otherwise.
+
+ Notes:
+
+**/
+
+BOOLEAN TF_GetLastDriveError(
+ THW_PTR thw,
+ INT16_PTR gen_func,
+ INT16_PTR gen_err,
+ INT32_PTR gen_misc )
+{
+ RET_BUF myret ;
+
+ if( TpSpecial( ((DRIVE_PTR)thw)->drv_hdl, SS_GET_LAST_ERROR,
+ (UINT32)&myret ) == SUCCESS ) {
+
+ *gen_func = myret.call_type ;
+ *gen_err = myret.gen_error ;
+ *gen_misc = myret.misc ;
+ return( TRUE ) ;
+ }
+
+ return( FALSE ) ;
+}
+
diff --git a/private/utils/ntbackup/src/tftpcat.c b/private/utils/ntbackup/src/tftpcat.c
new file mode 100644
index 000000000..b62ab8172
--- /dev/null
+++ b/private/utils/ntbackup/src/tftpcat.c
@@ -0,0 +1,737 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-92
+
+
+ Name: tftpcat.c
+
+ Description: Tape format API's for accessing Tape Catalogs.
+
+ $Log: T:\logfiles\tftpcat.c_v $
+
+ Rev 1.10.1.1 28 Jan 1994 11:29:42 GREGG
+Don't tell dismount to rewind if we just ejected the tape (duh)!
+
+ Rev 1.10.1.0 21 Nov 1993 23:35:10 GREGG
+Added eject on conditions where we know we need a different tape.
+
+ Rev 1.10 15 Jul 1993 11:54:08 GREGG
+Convert TF_NO_MORE_DATA to TF_EMPTY_TAPE in GetTape.
+
+ Rev 1.9 23 Jun 1993 09:03:44 DON
+Added include of 'malloc.h' to get prototypes for calloc and free.
+Also, changed use of '<>' around our internal headers. These should only
+be used for 3rd party headers.
+
+ Rev 1.8 22 Jun 1993 10:53:10 GREGG
+Added API to change the catalog directory path.
+
+ Rev 1.7 10 Jun 1993 20:24:26 GREGG
+Initialize the channel number in the tpos structure in OpenChannel.
+
+ Rev 1.6 06 Jun 1993 21:07:22 GREGG
+Added abort flag parameter to TF_CloseSetMap and TF_CloseSetCat which they
+pass to CloseChannel. We're really lost if they abort a catalog operation,
+so we need to throw away the format environment, and force a
+reinitialization of the tape.
+
+ Rev 1.5 27 May 1993 12:01:06 GREGG
+Fix for EPR 294-0299 - Buffer was being transfered from drive hold to
+channel before calling MountTape. MountTape tries to access hold buffer
+when cleaning up after PollDrive.
+
+ Rev 1.4 06 Apr 1993 14:06:32 GREGG
+Return TFLE_UI_HAPPY_ABORT if user won't give us the tape we need.
+
+ Rev 1.3 01 Apr 1993 22:47:42 GREGG
+Handle Unrecognized Media error (unformatted DC2000).
+
+ Rev 1.2 26 Mar 1993 09:37:18 GREGG
+If OTC retrieval fails, set a flag to force a rewind before the next operation.
+
+ Rev 1.1 23 Nov 1992 09:57:54 GREGG
+Fixed GetTape handling of UI_END_POSITIONING.
+
+ Rev 1.0 09 Nov 1992 14:27:26 GREGG
+Initial revision.
+
+**/
+#include <string.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "stdmath.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwprotos.h"
+#include "tfldefs.h"
+#include "translat.h"
+#include "tpos.h"
+#include "genstat.h"
+
+/* Device driver header source */
+#include "retbuf.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genstat.h"
+#include "dil.h"
+#include "tdemo.h"
+
+static INT OpenChannel( THW_PTR thw, FSYS_HAND fsh, TPOS_PTR tpos ) ;
+static INT GetTape( CHANNEL_PTR channel, BOOLEAN get_best, INT msg_in ) ;
+static VOID CloseChannel( BOOLEAN abort ) ;
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: TF_OpenSetMap
+
+ Description: This function grabs the channel, insures that the
+ requested tape is in the drive, and calls the translator
+ to load the best Set Map from the tape. If 'get_best'
+ is set to TRUE, an attempt is made to get the last tape
+ in the given family, but if it can at least get the
+ originally requested tape, it will load a Set Map and
+ report success.
+
+ Returns: INT - TFLE_xxx error code. Also, 'complete' is set to
+ TRUE if this is the last Set Map in the family.
+
+ Notes: None.
+
+**/
+
+INT TF_OpenSetMap(
+ THW_PTR thw,
+ FSYS_HAND fsh,
+ TPOS_PTR tpos,
+ BOOLEAN_PTR complete,
+ BOOLEAN get_best )
+{
+ CHANNEL_PTR channel = &lw_channels[0] ;
+ BOOLEAN done = FALSE ;
+ INT ret_val = TFLE_NO_ERR ;
+ INT dm_ret = TFLE_NO_ERR ;
+
+ ret_val = OpenChannel( thw, fsh, tpos ) ;
+ if( ret_val == TFLE_NO_ERR || !IsTFLE( ret_val ) ) {
+ if( ( ret_val = GetTape( channel, get_best, ret_val ) ) == TF_END_POSITIONING ) {
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ while( !done ) {
+ ret_val = LoadSetMap( channel, complete, get_best ) ;
+ if( ret_val == TF_NEED_NEW_TAPE ) {
+ tpos->tape_seq_num++ ;
+ ret_val = GetTape( channel, get_best, TF_NEED_NEW_TAPE ) ;
+ if( ret_val == TF_END_POSITIONING ) {
+ ret_val = LoadSetMap( channel, complete, FALSE ) ;
+ done = TRUE ;
+ } else if( ret_val != TFLE_NO_ERR ) {
+ done = TRUE ;
+ }
+ } else {
+ done = TRUE ;
+ }
+ }
+ }
+ dm_ret = DisMountTape( channel->cur_drv, NULL, FALSE ) ;
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = dm_ret ;
+ }
+ if( IsTFLE( ret_val ) ) {
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: TF_OpenSetCat
+
+ Description: This function grabs the channel, insures that the
+ requested tape is in the drive, and calls the translator
+ to load the requested Set Catalog from the tape.
+
+ Returns: INT - TFLE_xxx error code.
+
+ Notes: None.
+
+**/
+
+INT TF_OpenSetCat(
+ THW_PTR thw,
+ FSYS_HAND fsh,
+ TPOS_PTR tpos )
+{
+ CHANNEL_PTR channel = &lw_channels[0] ;
+ INT ret_val = TFLE_NO_ERR ;
+ INT dm_ret = TFLE_NO_ERR ;
+
+ ret_val = OpenChannel( thw, fsh, tpos ) ;
+ if( ret_val == TFLE_NO_ERR || !IsTFLE( ret_val ) ) {
+ ret_val = GetTape( channel, FALSE, ret_val ) ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ while( ( ret_val = LoadSetCat( channel ) ) == TF_NEED_NEW_TAPE ) {
+ tpos->tape_seq_num++ ;
+ if( ( ret_val = GetTape( channel, FALSE, TF_NEED_NEW_TAPE ) ) != TFLE_NO_ERR ) {
+ break ;
+ }
+ }
+ }
+ dm_ret = DisMountTape( channel->cur_drv, NULL, FALSE ) ;
+ if( !IsTFLE( ret_val ) && dm_ret != TFLE_NO_ERR ) {
+ ret_val = dm_ret ;
+ }
+ if( IsTFLE( ret_val ) ) {
+ SetChannelStatus( channel, CH_FATAL_ERR ) ;
+ }
+ if( ret_val == TF_END_POSITIONING ) {
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: TF_CloseSetMap
+
+ Description: This function calls CloseChannel to wrap things up after
+ TF_OpenSetMap has been called and all necessary calls to
+ TF_GetNextSMEntry have been made.
+
+ Returns: Nothing.
+
+ Notes: None.
+
+**/
+
+VOID TF_CloseSetMap( BOOLEAN abort )
+{
+ CloseChannel( abort ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: TF_CloseSetCat
+
+ Description: This function calls CloseChannel to wrap things up after
+ TF_OpenSetCat has been called and all necessary calls to
+ TF_GetNextSCEntry have been made.
+
+ Returns: Nothing.
+
+ Notes: None.
+
+**/
+
+VOID TF_CloseSetCat( BOOLEAN abort )
+{
+ CloseChannel( abort ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: TF_GetNextSMEntry
+
+ Description: This function calls the translator to translate the next
+ entry in the active Set Map into a VCB.
+
+ Returns: TFLE_xxx error code, TFLE_NO_ERR or TF_NO_MORE_ENTRIES.
+
+ Notes: None.
+
+**/
+
+INT TF_GetNextSMEntry(
+ FSYS_HAND fsh,
+ DBLK_PTR vcb )
+{
+ CHANNEL_PTR channel = &lw_channels[0] ;
+
+ if( !InUse( channel ) || channel->cur_buff == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ channel->cur_fsys = fsh ;
+ channel->cur_dblk = vcb ;
+ return( GetNextSMEntry( channel ) ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: TF_GetNextSCEntry
+
+ Description: This function calls the translator to translate the next
+ entry in the active Set Catalog into a DBLK.
+
+ Returns: TFLE_xxx error code, TFLE_NO_ERR or TF_NO_MORE_ENTRIES.
+
+ Notes: None.
+
+**/
+
+INT TF_GetNextSCEntry(
+ FSYS_HAND fsh,
+ DBLK_PTR dblk )
+{
+ CHANNEL_PTR channel = &lw_channels[0] ;
+
+ if( !InUse( channel ) || channel->cur_buff == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ channel->cur_fsys = fsh ;
+ channel->cur_dblk = dblk ;
+ return( GetNextSCEntry( channel ) ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: TF_ChangeCatPath
+
+ Description: This function calls the translator to delete any
+ existing temporary tape catalog files, and then changes
+ the layer wide catalog path string.
+
+ Returns: TFLE_xxx error code
+
+ Notes: It is not valid to call this function when we are in the
+ middle of an operation. This is checked by making sure
+ that if the channel is in use, the PollDrive state is
+ not closed.
+
+**/
+
+INT TF_ChangeCatPath( CHAR_PTR new_path )
+{
+ Q_ELEM_PTR qe_ptr ;
+ DRIVE_PTR cur_drv ;
+
+ if( ( InUse( &lw_channels[0] ) &&
+ lw_channels[0].cur_drv->poll_stuff.state == st_CLOSED ) ||
+ new_path == NULL ) {
+
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ for ( qe_ptr = QueueHead( &lw_drive_list ); qe_ptr != NULL; qe_ptr = QueueNext( qe_ptr ) ) {
+ cur_drv = (DRIVE_PTR)(VOID_PTR)qe_ptr ;
+ if ( cur_drv->last_fmt_env != NULL ) {
+ CloseTapeCatalogs( cur_drv->last_cur_fmt, cur_drv->last_fmt_env ) ;
+ }
+ }
+
+ if( lw_cat_file_path != NULL ) {
+ free( lw_cat_file_path ) ;
+ lw_cat_file_path = NULL ;
+ lw_cat_file_path_end = NULL ;
+ }
+
+ lw_cat_file_path = calloc( strlen( new_path ) + SX_FILE_NAME_LENGTH + 1, sizeof( CHAR ) ) ;
+ if ( lw_cat_file_path == NULL ) {
+ return TFLE_NO_MEMORY ;
+ }
+ strcpy( lw_cat_file_path, new_path ) ;
+ lw_cat_file_path_end = lw_cat_file_path + strlen( lw_cat_file_path ) ;
+
+ return( TFLE_NO_ERR ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: OpenChannel
+
+ Description: This function marks the channel in use, initializes the
+ channel fields, and mounts the tape in the given drive.
+
+ Returns: TFLE_xxx error code.
+
+ Notes: None.
+
+**/
+
+static INT OpenChannel(
+ THW_PTR thw,
+ FSYS_HAND fsh,
+ TPOS_PTR tpos )
+{
+ CHANNEL_PTR channel = &lw_channels[0] ;
+ INT ret_val = TFLE_NO_ERR ;
+ BOOLEAN is_tape_present ;
+ DRIVE_PTR curDRV ;
+
+ if( !InUse( channel ) ) {
+ SetChannelStatus( channel, CH_IN_USE ) ;
+ tpos->channel = 0 ;
+
+ /* hook the drive into the channel */
+ if( ( channel->cur_drv = (DRIVE_PTR)thw ) == NULL ) {
+ msassert( FALSE ) ;
+ ret_val = TFLE_NO_DRIVES ; /* Specified drive does not exist!!! */
+ } else {
+ curDRV = channel->cur_drv ;
+ }
+ } else {
+ msassert( FALSE ) ;
+ ret_val = TFLE_NO_FREE_CHANNELS ;
+ }
+
+ /* Mount that tape! */
+ if( ret_val == TFLE_NO_ERR ) {
+ if( curDRV->tape_mounted ) {
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ } else {
+ ret_val = MountTape( curDRV, tpos, &is_tape_present ) ;
+ }
+ }
+
+ /* set up the channel stuff */
+ if( ret_val == TFLE_NO_ERR ) {
+ channel->ui_tpos = tpos ;
+ channel->cur_dblk = NULL ;
+ channel->cur_fsys = fsh ;
+ channel->eom_id = 0L ;
+ channel->hiwater = channel->buffs_enqd = 0 ;
+ channel->retranslate_size = U64_Init( 0xffffffffUL, 0xffffffffUL ) ;
+ channel->blocks_used = 0L ;
+ if ( curDRV->last_fmt_env != NULL ) {
+ channel->cur_fmt = curDRV->last_cur_fmt ;
+ channel->fmt_env = curDRV->last_fmt_env ;
+ curDRV->last_cur_fmt = UNKNOWN_FORMAT ;
+ curDRV->last_fmt_env = NULL ;
+ }
+ if( curDRV->hold_buff != NULL ) {
+ channel->cur_buff = curDRV->hold_buff ;
+ curDRV->hold_buff = NULL ;
+ BM_UnReserve( channel->cur_buff ) ;
+ } else {
+ if( ( channel->cur_buff =
+ BM_GetVCBBuff( &channel->buffer_list ) ) == NULL ) {
+
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ }
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ if( ( curDRV->thw_inf.drv_status &
+ ( TPS_NEW_TAPE | TPS_RESET | TPS_NO_TAPE ) )
+ || curDRV->force_rewind ) {
+
+ curDRV->force_rewind = FALSE ;
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ if( is_tape_present ) {
+ ret_val = RewindDrive( curDRV, tpos, TRUE, TRUE, 0 ) ;
+ }
+ }
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: GetTape
+
+ Description: This function is a watered down version of PositionAtSet
+ which identifies tapes and works with the UI position
+ message handler to get the right tape in the drive.
+
+ Returns: TFLE_xxx error code.
+
+ Notes: If 'msg_in' is not zero, we pass this message on to the
+ UI, and act on their response before we make any attempt
+ to identify the tape in the drive.
+
+ If get_best is true, we accept any tape with the right
+ family ID, and a sequence number which is greater than
+ or equal to the requested sequence number.
+
+**/
+
+static INT GetTape(
+ CHANNEL_PTR channel,
+ BOOLEAN get_best,
+ INT msg_in )
+{
+ BOOLEAN done = FALSE ;
+ BOOLEAN tape_rewound = FALSE ;
+ INT ret_val = TFLE_NO_ERR ;
+ INT tmp ;
+ UINT16 ui_msg = 0 ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ BOOLEAN is_tape_present ;
+ TPOS_PTR tpos = channel->ui_tpos ;
+ RET_BUF myret ;
+
+ /* loop until we get the right tape */
+ while( !done ) {
+
+ /* if need_next is TRUE, we know we don't have the right tape */
+ if( msg_in != 0 ) {
+ ret_val = msg_in ;
+ msg_in = 0 ;
+
+ /* if the tape isn't mounted, we don't have a tape */
+ } else if( !curDRV->tape_mounted ) {
+ ret_val = TF_NO_TAPE_PRESENT ;
+
+ } else {
+ /* if we don't have a valid vcb, get one now */
+ if( !curDRV->vcb_valid ) {
+ if( ( ret_val = ReadNewTape( channel, tpos, TRUE ) )
+ == TFLE_NO_ERR ) {
+ ret_val = ReadThisSet( channel ) ;
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ /* do we have the right tape family? */
+ if( FS_ViewTapeIDInVCB( &curDRV->cur_vcb ) == (UINT32)tpos->tape_id ) {
+
+ /* if 'get_best' is true, we'll be going after the
+ best set map we can get, so if they give us a
+ tape in the family with a seq number greater
+ than the one requested, we will accept it.
+ */
+ if( get_best ) {
+ if( FS_ViewTSNumInVCB( &curDRV->cur_vcb )
+ < (UINT16)tpos->tape_seq_num ) {
+
+ ret_val = TF_WRONG_TAPE ;
+ }
+ } else {
+ if( FS_ViewTSNumInVCB( &curDRV->cur_vcb )
+ != (UINT16)tpos->tape_seq_num ) {
+
+ ret_val = TF_WRONG_TAPE ;
+ }
+ }
+
+ } else {
+ ret_val = TF_WRONG_TAPE ;
+ }
+ }
+ }
+
+ if( ret_val == TF_NO_MORE_DATA ) {
+ ret_val = TF_EMPTY_TAPE ;
+ }
+
+ if( ret_val == TF_NEED_NEW_TAPE || ret_val == TF_WRONG_TAPE ||
+ ret_val == TF_INVALID_VCB || ret_val == TF_EMPTY_TAPE ) {
+
+ tape_rewound = TRUE ;
+
+ tmp = RewindDrive( curDRV, tpos, TRUE, TRUE, 0 ) ;
+
+ if( tmp == TFLE_NO_ERR &&
+ ( curDRV->thw_inf.drv_info.drv_features & TDI_UNLOAD ) ) {
+
+ if( TpEject( curDRV->drv_hdl ) == FAILURE ) {
+ tmp = TFLE_DRIVER_FAILURE ;
+ } else {
+ while( TpReceive( curDRV->drv_hdl, &myret ) == FAILURE ) {
+ (*tpos->UI_TapePosRoutine)( TF_IDLE_NOBREAK, tpos, curDRV->vcb_valid, &curDRV->cur_vcb, 0 ) ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( thw->the, myret.the ) ;
+
+ if( myret.gen_error != GEN_NO_ERR ) {
+ curDRV->thw_inf.drv_status = myret.status ;
+ tmp = TFLE_DRIVE_FAILURE ;
+ }
+ }
+ }
+ if( tmp != TFLE_NO_ERR ) {
+ ret_val = tmp ;
+ }
+ }
+
+ if( ret_val != TFLE_NO_ERR && curDRV->tape_mounted ) {
+ if( ( tmp = DisMountTape( curDRV, tpos, (BOOLEAN)( !tape_rewound && ret_val != TF_UNRECOGNIZED_MEDIA ) ) ) != TFLE_NO_ERR ) {
+ if( !( IsTFLE( ret_val ) ) ) {
+ ret_val = tmp ;
+ }
+ ResetDrivePosition( channel->cur_drv ) ;
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ }
+ }
+
+ tape_rewound = FALSE ;
+
+ if( IsTFLE( ret_val ) || ret_val == TFLE_NO_ERR ) {
+ done = TRUE ;
+ continue ;
+ }
+
+ ui_msg = (*tpos->UI_TapePosRoutine)( (UINT16)ret_val, tpos, FALSE,
+ &curDRV->cur_vcb, 0 ) ;
+
+ switch( ui_msg ) {
+
+ case UI_END_POSITIONING :
+ done = TRUE ;
+ ret_val = MountTape( curDRV, tpos, &is_tape_present ) ;
+ if( ret_val == TFLE_NO_ERR ) {
+
+ if( ( !is_tape_present ) ||
+ ( curDRV->thw_inf.drv_status &
+ ( TPS_NEW_TAPE|TPS_RESET|TPS_NO_TAPE ) ) ) {
+
+ ret_val = DisMountTape( curDRV, tpos, TRUE ) ;
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ } else {
+ if( ( ret_val = ReadNewTape( channel, tpos, TRUE ) )
+ == TFLE_NO_ERR ) {
+ ret_val = ReadThisSet( channel ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = TF_END_POSITIONING ;
+ } else {
+ if( IsTFLE( ret_val ) ) {
+ DisMountTape( curDRV, tpos, TRUE ) ;
+ } else {
+ ret_val = DisMountTape( curDRV, tpos, TRUE ) ;
+ }
+ ResetDrivePosition( channel->cur_drv ) ;
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ }
+ }
+ } else if( ret_val == TF_UNRECOGNIZED_MEDIA ) {
+ ret_val = DisMountTape( curDRV, tpos, FALSE ) ;
+ ResetDrivePosition( channel->cur_drv ) ;
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ if( ret_val == TFLE_NO_ERR ) {
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ }
+ }
+ break ;
+
+ case UI_ABORT_POSITIONING :
+ case UI_HAPPY_ABORT :
+ ret_val = TFLE_UI_HAPPY_ABORT ;
+ done = TRUE ;
+ break ;
+
+ case UI_NEW_TAPE_INSERTED :
+ ret_val = MountTape( curDRV, tpos, &is_tape_present ) ;
+
+ if( ret_val == TF_UNRECOGNIZED_MEDIA ) {
+ /* This is cheating, but it gets the job done! */
+ msg_in = ret_val ;
+ break ;
+ }
+
+ if( ret_val != TFLE_NO_ERR ) {
+ done = TRUE ;
+ } else {
+ if( is_tape_present ) {
+ ret_val = RewindDrive( curDRV, tpos, TRUE, FALSE, 0 ) ;
+ if( ret_val != TFLE_NO_ERR ) {
+ done = TRUE ;
+ }
+ }
+ }
+ break ;
+
+ default :
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ done = TRUE ;
+ break ;
+ }
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Unit: Tape Format API's
+
+ Name: CloseChannel
+
+ Description: This function puts back the channel buffer, saves off
+ the format environment for the next operation if it is
+ valid, or frees it otherwise, and clears all the channel
+ status bits, including the one indicating the channel is
+ in use.
+
+ Returns: Most of the time.
+
+ Notes: None
+
+**/
+
+static VOID CloseChannel( BOOLEAN abort )
+{
+ CHANNEL_PTR channel = &lw_channels[0] ;
+
+ BM_Put( channel->cur_buff ) ;
+ channel->cur_buff = NULL ;
+ if( FatalError( channel ) || abort ) {
+ FreeFormatEnv( &channel->cur_fmt, &channel->fmt_env ) ;
+ ResetDrivePosition( channel->cur_drv ) ;
+ channel->cur_drv->force_rewind = TRUE ;
+ } else {
+ channel->cur_drv->last_cur_fmt = channel->cur_fmt ;
+ channel->cur_drv->last_fmt_env = channel->fmt_env ;
+ channel->cur_fmt = UNKNOWN_FORMAT ;
+ channel->fmt_env = NULL ;
+ }
+ ClrChannelStatus( channel, 0xFFFF ) ;
+}
+
diff --git a/private/utils/ntbackup/src/tfwrite.c b/private/utils/ntbackup/src/tfwrite.c
new file mode 100644
index 000000000..9510adea1
--- /dev/null
+++ b/private/utils/ntbackup/src/tfwrite.c
@@ -0,0 +1,1487 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: write.c
+
+ Description: Contains the Support for the Write Loop.
+
+
+ $Log: T:\logfiles\tfwrite.c_v $
+
+ Rev 1.72 13 Jan 1994 17:16:56 GREGG
+Don't call set aborted if we are at the end of a stream.
+
+ Rev 1.71 11 Jan 1994 13:32:50 GREGG
+Changed asserts to mscasserts.
+
+ Rev 1.70 26 Oct 1993 19:47:50 GREGG
+Stop needlessly calling FS_GetActualSizeDBLK!!!
+
+ Rev 1.69 08 Sep 1993 18:24:48 GREGG
+Reset channel->cur_dblk to req-> cur_dblk after EOM processing to fix EOM
+edge condition: EOM reported on AquireWriteBuffer call from WriteDBLK.
+
+ Rev 1.68 17 Jul 1993 17:57:14 GREGG
+Changed write translator functions to return INT16 TFLE_xxx errors instead
+of BOOLEAN TRUE/FALSE. Files changed:
+ MTF10WDB.C 1.23, TRANSLAT.H 1.22, F40PROTO.H 1.30, FMTENG.H 1.23,
+ TRANSLAT.C 1.43, TFWRITE.C 1.68, MTF10WT.C 1.18
+
+ Rev 1.67 21 Jun 1993 18:04:54 GREGG
+Don't set new_stream_completed flag if EOM hit in the middle.
+
+ Rev 1.66 26 May 1993 14:38:14 DON
+Removed threadswitch from AcquireWriteBuffer, wasn't needed afterall
+
+ Rev 1.65 21 May 1993 10:25:16 GREGG
+Fixed problem with EOM during FinishWrite. We were not flushing queued up
+buffers to tape if we didn't have a final one to write. Also replaced some
+asserts with msasserts.
+
+ Rev 1.64 20 May 1993 20:17:58 DON
+Needed a threadswitch when acquiring write buffers
+
+ Rev 1.63 26 Apr 1993 11:45:44 GREGG
+Seventh in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Changed handling of EOM processing during non-OTC EOS processing.
+
+Matches CHANNEL.H 1.17, MAYN40RD.C 1.60, TFWRITE.C 1.63, MTF.H 1.5,
+ TFLUTILS.C 1.44, MTF10WDB.C 1.10, MTF10WT.C 1.9
+
+ Rev 1.62 17 Apr 1993 19:38:58 GREGG
+Don't put entries in the DBLK map for CFDBs.
+
+ Rev 1.61 14 Apr 1993 02:00:12 GREGG
+Fixes to deal with non-ffr tapes in ffr drives (i.e. EXB2200 in EXB5000).
+
+ Rev 1.60 07 Apr 1993 16:34:26 GREGG
+Stop ignoring returns from WT_EndSet and WT_EndTape (they have meaning now)!
+
+ Rev 1.59 13 Mar 1993 17:01:14 GREGG
+Fixed so that EndData and NewStream expect buff_used to be zero.
+
+ Rev 1.58 10 Mar 1993 09:29:22 DON
+Fixed two occurances of if ret_val = NEED_NEW_BUFFER
+
+ Rev 1.57 09 Mar 1993 18:14:32 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.56 06 Feb 1993 11:03:14 DON
+Also defined out optimization pragmas for OS_NLM
+
+ Rev 1.55 05 Feb 1993 12:20:22 GREGG
+Defined out optimization pragmas for OS_WIN32.
+
+ Rev 1.54 28 Jan 1993 15:01:24 GREGG
+Fixed assert in WriteRequest to check the right buffer.
+
+ Rev 1.53 21 Jan 1993 15:53:10 GREGG
+Added parameter to call to TpGetPosition.
+
+ Rev 1.52 18 Jan 1993 16:37:40 BobR
+Added MOVE_ESA macro calls.
+
+ Rev 1.51 13 Jan 1993 20:57:48 GREGG
+Removed tabs, spaces at end of lines and unused header entries.
+
+ Rev 1.50 18 Dec 1992 17:09:08 HUNTER
+Update for variable stream.
+
+ Rev 1.49 02 Dec 1992 13:47:56 GREGG
+Copy lst_osvcb into req_rep vcb after call to EOM_Write in DoWrite.
+
+ Rev 1.48 25 Nov 1992 10:21:10 HUNTER
+EOM fix.
+
+ Rev 1.47 23 Nov 1992 11:53:26 HUNTER
+Fix for eom handling.
+
+ Rev 1.46 20 Nov 1992 16:12:18 HUNTER
+Another eom fix
+
+ Rev 1.45 20 Nov 1992 12:30:44 HUNTER
+Fix for EOM handling
+
+ Rev 1.44 12 Nov 1992 10:16:10 HUNTER
+Fixed bug in DoWrite() for not enough data space.
+
+ Rev 1.43 09 Nov 1992 09:59:20 GREGG
+Added msassert that stream size is zero when FinishWrite is called.
+
+ Rev 1.42 03 Nov 1992 09:25:02 HUNTER
+Various fixes for streams
+
+ Rev 1.40 22 Oct 1992 10:25:54 HUNTER
+Added code for stream support
+
+ Rev 1.39 25 Sep 1992 09:46:56 GREGG
+Don't get the VCB buffer before calling WT_ContinueSet.
+
+ Rev 1.38 22 Sep 1992 09:02:52 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.37 17 Aug 1992 08:42:16 GREGG
+Changes to deal with block sizeing scheme.
+
+ Rev 1.36 06 Aug 1992 12:05:46 BURT
+Added fix to update data blk size and set channel to DATA PHASE
+when processing a VBLK delayed request.
+
+
+ Rev 1.35 04 Aug 1992 18:15:22 GREGG
+Removed line accidently copied from Turtle revision for last set of changes.
+
+ Rev 1.34 04 Aug 1992 15:12:18 GREGG
+Burt's fixes for variable length block support.
+
+ Rev 1.33 27 Jul 1992 12:17:36 GREGG
+Fixed ifndef.
+
+ Rev 1.32 23 Jul 1992 10:11:46 GREGG
+Fixed warnings.
+
+ Rev 1.31 15 Jul 1992 12:19:14 GREGG
+Removed annoying debug printf.
+
+ Rev 1.30 04 Jun 1992 16:17:38 GREGG
+Fixed receive loop in FinishWrite.
+
+ Rev 1.29 21 May 1992 13:15:06 GREGG
+Added parameter in calls to RD_TranslateDBLK.
+
+ Rev 1.28 13 May 1992 12:00:54 STEVEN
+40 format changes
+
+ Rev 1.27 29 Apr 1992 13:03:44 GREGG
+ROLLER BLADES - Changes for new EOM handling.
+
+ Rev 1.26 13 Apr 1992 14:12:52 GREGG
+ROLLER BLADES - Same fix as 1.24 in FinishWrite:the other half of the equation!
+
+ Rev 1.25 05 Apr 1992 19:07:28 GREGG
+ROLLER BLADES - Removed call to WriteInit.
+
+ Rev 1.24 28 Mar 1992 18:35:42 GREGG
+ROLLER BLADES - OTC integration, and fix for EOM problem in AcquireWriteBuffer.
+
+ Rev 1.23 25 Mar 1992 18:00:08 GREGG
+ROLLER BLADES - Initial Integration. Includes support for 4.0 format, 64
+ bit file sizes and tape block sizes > the logical block size.
+
+ Rev 1.22 25 Mar 1992 14:56:22 NED
+Suppressed 0-length writes in FinishWrite
+
+ Rev 1.21 20 Mar 1992 17:59:50 NED
+added exception updating after TpReceive calls
+
+ Rev 1.20 27 Feb 1992 10:07:06 NED
+updated channel->eom_lba inside finish_write() and used channel->lst_tblk
+to suppress incorrect read translation of non-existent DDBs or FDBs
+
+ Rev 1.19 08 Feb 1992 14:23:06 GREGG
+Removed references to lst_oper in drive stucture (it no longer exits).
+
+ Rev 1.18 15 Jan 1992 01:39:46 GREGG
+Added param to posatset calls indicating if only a VCB of the tape is required.
+
+ Rev 1.17 13 Jan 1992 19:56:06 NED
+accounted for separate VCB buffer in AcquireWriteBuffer
+
+ Rev 1.16 08 Jan 1992 22:00:20 NED
+Changed BM_Get call to BM_GetVCBBuff in EOM_Setup
+
+ Rev 1.15 03 Jan 1992 11:19:48 NED
+Added DumpDebug call
+
+ Rev 1.14 02 Jan 1992 14:54:48 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.13 10 Dec 1991 17:03:20 GREGG
+Doing a QueueNext twice in a row was causing unpredictable results.
+
+ Rev 1.12 03 Dec 1991 11:46:18 GREGG
+SKATEBOARD - New Buff Mgr - Initial integration.
+
+ Rev 1.11 18 Nov 1991 20:10:30 GREGG
+When a backup is aborted, instead of writing an indication string on tape,
+we tell WT_EndSet about it so he can set an indication bit in the BSDB.
+Also corrected a bug where DATA_END case in DoWrite wasn't reseting the
+channel's DATA_PHASE and VAR_DATA bits or returning TRW_DB.
+
+ Rev 1.10 07 Nov 1991 15:29:56 HUNTER
+VBLK - Variable Length Block.
+
+
+ Rev 1.9 17 Oct 1991 01:28:40 GREGG
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.8 22 Aug 1991 16:35:38 NED
+Changed all references to internals of the buffer structure to macros.
+
+ Rev 1.7 16 Aug 1991 09:13:32 GREGG
+Moved preservation of current format during continuation into PositionAtSet.
+
+ Rev 1.6 14 Aug 1991 11:26:48 GREGG
+Fixes for EOS at EOM handling.
+
+ Rev 1.5 01 Aug 1991 15:01:44 GREGG
+Save the current format before calling PosAtSet to handle EOM tape changes.
+
+ Rev 1.4 25 Jul 1991 11:31:16 GREGG
+Added logic to report EOM back to loops in FinishWrite, and handle EOM_ACK
+returning to function which encountered EOM.
+
+ Rev 1.3 15 Jul 1991 15:02:34 NED
+Added logic to set CH_CONTINUING channel status at apropriate times.
+
+ Rev 1.2 20 Jun 1991 14:41:40 GREGG
+Removed unnecessary call to SetupFormatEnv in StartWrite and added set of the
+REW_CLOSE position bit on a translation failure error.
+
+ Rev 1.1 10 May 1991 16:09:40 GREGG
+Ned's new stuff
+
+ Rev 1.0 10 May 1991 10:12:08 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include <memory.h>
+#include <malloc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "queues.h"
+
+#include "drive.h"
+#include "channel.h"
+#include "lw_data.h"
+#include "tfl_err.h"
+#include "lwdefs.h"
+#include "tflopen.h"
+#include "lwprotos.h"
+#include "tflproto.h"
+#include "translat.h"
+
+/* Device Driver Interface Files */
+#include "retbuf.h"
+#include "special.h"
+#include "dilhwd.h"
+#include "drvinf.h"
+#include "generr.h"
+#include "genfuncs.h"
+#include "dil.h"
+#include "sx.h"
+
+#include "be_debug.h"
+
+/* $end$ include list */
+
+/* Pragmas */
+#if !defined( OS_WIN32 ) && !defined( OS_NLM )
+ #pragma loop_opt( on )
+ #pragma intrinsic( memcpy )
+#endif
+
+/* Static Functions */
+static INT16 _near StartWrite( CHANNEL_PTR );
+static INT16 _near WriteDBLK( CHANNEL_PTR, RR_PTR ) ;
+static INT16 _near AcquireWriteBuffer( CHANNEL_PTR, RR_PTR ) ;
+static INT16 _near EOM_Write( CHANNEL_PTR, BUF_PTR ) ;
+static VOID _near WriteRequest( CHANNEL_PTR, BUF_PTR, BOOLEAN ) ;
+static INT16 _near FinishWrite( CHANNEL_PTR, RR_PTR, BOOLEAN ) ;
+static VOID _near EOM_Setup( CHANNEL_PTR, RR_PTR ) ;
+static INT16 _near AbortWrite( CHANNEL_PTR, RR_PTR ) ;
+
+/**/
+/**
+
+ Name: StartWrite
+
+ Description: This function sets up the write function for a given
+ channel. This is called after an LRW_START message
+ is passed from the loops.
+
+ Returns:
+
+ Notes:
+
+ Declaration:
+
+**/
+
+static INT16 _near StartWrite( CHANNEL_PTR channel )
+{
+
+ INT16 ret_val = TFLE_NO_ERR ;
+ RET_BUF myret ;
+
+ /* We don't have a buffer, so lets get one */
+ if( channel->cur_buff == NULL ) {
+ if ( SnagBuffer( channel ) == NULL ) {
+ ret_val = TFLE_NO_FREE_BUFFERS ;
+ }
+ } else {
+ BM_InitBuf( channel->cur_buff ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR ) {
+ ClrChannelStatus( channel, CH_DATA_PHASE ) ;
+ channel->running_lba = 0L ;
+ channel->eom_lba = 0L ;
+ channel->buffs_enqd = 0 ;
+ ClrPosBit( channel->cur_drv, AT_BOT ) ;
+ channel->cur_drv->trans_started = FALSE ;
+ }
+
+ return( ret_val ) ;
+
+}
+
+
+/**/
+/**
+
+ Name: WriteDBLK
+
+ Description: Takes the current dblk and translates it to the output
+ format, and puts it in the write buffer.
+
+ Returns: An INT16 which is an error code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+static INT16 _near WriteDBLK(
+ CHANNEL_PTR channel,
+ RR_PTR req )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+
+ /* Let's get some storage for the dblk */
+ if( BM_BytesFree( channel->cur_buff ) == 0 ) {
+ WriteRequest( channel, channel->cur_buff, FALSE ) ;
+ channel->cur_buff = NULL;
+ ret_val = AcquireWriteBuffer( channel, req ) ;
+ }
+
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ ret_val = GetDBLKMapStorage( channel, channel->cur_buff ) ;
+ }
+
+ /* We know everything is set to write, so let's do it */
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ channel->map_entry->blk_offset =
+ BM_NextByteOffset( channel->cur_buff ) ;
+ channel->map_entry->blk_data = lw_UINT64_ZERO ;
+ if( ( ret_val = WT_TranslateDBLK( channel, channel->cur_buff,
+ &channel->map_entry->blk_type ) )
+ == TFLE_NO_ERR ) {
+
+ /* If we've just translated the VCB, the id and sequence
+ number are known, and we can finnally consider whether
+ the SX file needs to be opened
+ */
+ if( channel->map_entry->blk_type == BT_VCB &&
+ channel->sx_info.cat_enabled &&
+ SX_IsOK( channel ) ) {
+
+ SX_StartSampling( channel ) ;
+ }
+
+ /* if this is a CFDB, we're going to ignore the entry */
+ if( channel->map_entry->blk_type != BT_CFDB ) {
+ BM_IncNoDblks( channel->cur_buff ) ;
+ }
+
+ } else {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: DoWrite
+
+ Description: called by TF_GetNextTapeRequest during write processing.
+
+ Returns: INT16, a TFLE_xxx code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 DoWrite(
+ CHANNEL_PTR channel,
+ RR_PTR req )
+{
+ static INT16 prev_lp_message = 0 ;
+ static UINT16 prev_buff_used ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN status ;
+ BOOLEAN new_stream_complete = FALSE ;
+
+ /* Set the current dblk pointer to the requests curDBLK */
+ channel->cur_dblk = req->cur_dblk ;
+
+ switch( req->lp_message ) {
+
+ case LRW_VCB:
+ /* It's a new set, increment the backup set num */
+ channel->bs_num++ ;
+ memcpy( channel->lst_osvcb, req->cur_dblk, sizeof( DBLK ) ) ;
+ SetChannelStatus( channel, CH_VCB_DBLK ) ;
+
+ /* fall through */
+
+ case LRW_FDB:
+ case LRW_DDB:
+ case LRW_IDB:
+ case LRW_CFDB:
+ prev_buff_used = 0 ;
+ ClrChannelStatus( channel, CH_DATA_PHASE ) ;
+ if( ( ret_val = WriteDBLK( channel, req ) ) == TFLE_NO_ERR ) {
+ if( !AtEOM( channel ) ) {
+ req->tf_message = TRW_DATA ;
+ }
+ }
+
+ break ;
+
+ case LRW_NEW_STREAM:
+
+ msassert( req->buff_used == 0 ) ;
+
+ /* If the last Stream was variable, finish it out */
+ if( channel->current_stream.tf_attrib & STREAM_VARIABLE ) {
+ WT_EndVarStream( channel, channel->cur_buff, prev_buff_used ) ;
+
+ /* If we were holding a buffer for the translator, it is now
+ safe to send it off to tape.
+ */
+ if( channel->hold_buff != NULL ) {
+ WriteRequest( channel, channel->hold_buff, FALSE ) ;
+ channel->hold_buff = NULL;
+ }
+ }
+ prev_buff_used = 0 ;
+
+ /* Copy Stream Stuff */
+ channel->current_stream = req->stream ;
+
+ SetChannelStatus( channel, CH_DATA_PHASE ) ;
+ req->buff_used = 0 ;
+
+ if( ( ret_val = WT_NewDataStream( channel, channel->cur_buff,
+ &channel->current_stream ) )
+ == NEED_NEW_BUFFER ) {
+
+ /* If channel->hold_buff is not NULL, the translator needs us
+ to hold on to the old buffer, otherwise we send it off to
+ tape.
+ */
+ if( channel->hold_buff == NULL ) {
+ WriteRequest( channel, channel->cur_buff, FALSE ) ;
+ }
+
+ channel->cur_buff = NULL ;
+ ret_val = AcquireWriteBuffer( channel, req ) ;
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ if( ( ret_val = WT_NewDataStream( channel,
+ channel->cur_buff,
+ &channel->current_stream ) )
+ == NEED_NEW_BUFFER ) {
+
+ msassert( FALSE ) ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ } else {
+ new_stream_complete = TRUE ;
+ }
+ }
+ } else {
+ new_stream_complete = TRUE ;
+ }
+
+ /* Fall Thru */
+
+ case LRW_DATA:
+
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ BM_UpdCnts( channel->cur_buff, req->buff_used ) ;
+
+ prev_buff_used = req->buff_used ;
+
+ channel->current_stream.size =
+ U64_Sub( channel->current_stream.size,
+ U32_To_U64( (UINT32)req->buff_used ),
+ &status ) ;
+
+ if( ( req->buff_ptr = GetDATAStorage( channel,
+ &req->buff_size ) ) == NULL ) {
+
+ /* If we were holding a buffer for the translator, it
+ is now safe to send it off to tape.
+ */
+ if( channel->hold_buff != NULL ) {
+ WriteRequest( channel, channel->hold_buff, FALSE ) ;
+ channel->hold_buff = NULL;
+ }
+
+ WriteRequest( channel, channel->cur_buff, FALSE ) ;
+ channel->cur_buff = NULL;
+ ret_val = AcquireWriteBuffer( channel, req ) ;
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ if( channel->current_stream.tf_attrib & STREAM_VARIABLE ) {
+ ret_val = WT_ContVarStream( channel, channel->cur_buff ) ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ req->buff_ptr = GetDATAStorage( channel, &req->buff_size ) ;
+ if( req->buff_ptr == NULL ) {
+ msassert( FALSE ) ;
+ ret_val = TFLE_NO_MEMORY ;
+ }
+ }
+ }
+ }
+ }
+ break ;
+
+
+ case LRW_DATA_END:
+
+ ClrChannelStatus( channel, CH_DATA_PHASE ) ;
+ msassert( req->buff_used == 0 ) ;
+
+ if( channel->current_stream.tf_attrib & STREAM_VARIABLE ) {
+ WT_EndVarStream( channel, channel->cur_buff, prev_buff_used ) ;
+
+ /* If we were holding a buffer for the translator, it is now
+ safe to send it off to tape.
+ */
+ if( channel->hold_buff != NULL ) {
+ WriteRequest( channel, channel->hold_buff, FALSE ) ;
+ channel->hold_buff = NULL;
+ }
+ }
+ prev_buff_used = 0 ;
+
+ if( ( ret_val = WT_EndData( channel, channel->cur_buff ) )
+ == NEED_NEW_BUFFER ) {
+
+ /* If channel->hold_buff is not NULL, the translator needs us
+ to hold on to the old buffer, otherwise we send it off to
+ tape.
+ */
+ if( channel->hold_buff == NULL ) {
+ WriteRequest( channel, channel->cur_buff, FALSE ) ;
+ }
+
+ channel->cur_buff = NULL ;
+ ret_val = AcquireWriteBuffer( channel, req ) ;
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ if( ( ret_val = WT_EndData( channel, channel->cur_buff ) )
+ != TFLE_NO_ERR ) {
+
+ if( ret_val == NEED_NEW_BUFFER ) {
+ msassert( FALSE ) ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ }
+ } else {
+ /* If we were holding a buffer for the translator,
+ it is now safe to send it off to tape.
+ */
+ if( channel->hold_buff != NULL ) {
+ WriteRequest( channel, channel->hold_buff, FALSE ) ;
+ channel->hold_buff = NULL;
+ }
+ }
+ }
+ }
+
+ req->tf_message = TRW_DB ;
+
+ break ;
+
+
+ case LRW_START:
+ if( ( ret_val = StartWrite( channel ) ) == TFLE_NO_ERR ) {
+ req->tf_message = TRW_DB ;
+ }
+ break ;
+
+
+ case LRW_EOM_ACK:
+
+ /* End of Volume Processing */
+ msassert( ( AtEOM( channel ) ) ) ;
+ msassert( channel->cur_buff == NULL ) ;
+
+ if( AtEOM( channel ) ) {
+ if( ( ret_val = EOM_Write( channel, channel->eom_buff ) ) == TFLE_NO_ERR ) {
+ *req->vcb_ptr = *( (DBLK_PTR)channel->lst_osvcb ) ;
+ channel->eom_buff = NULL ;
+ /* We're done EOM, lets start anew */
+ ClrChannelStatus( channel, CH_AT_EOM ) ;
+ channel->cur_dblk = req->cur_dblk ;
+
+ switch( prev_lp_message ) {
+
+ case LRW_ABORT:
+ case LRW_END:
+ /* We were in FinishWrite */
+ ClrChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ ret_val = FinishWrite( channel, req, (BOOLEAN)(prev_lp_message == LRW_ABORT) ) ;
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ req->tf_message = TRW_DB ;
+ if( prev_lp_message == LRW_ABORT ) {
+ ret_val = TFLE_USER_ABORT ;
+ }
+ }
+ break ;
+
+ case LRW_VCB:
+ case LRW_FDB:
+ case LRW_DDB:
+ case LRW_IDB:
+ case LRW_CFDB:
+
+ if( ( ret_val = AcquireWriteBuffer( channel, req ) ) == TFLE_NO_ERR ) {
+ if( ( ret_val = WriteDBLK( channel, req ) ) == TFLE_NO_ERR ) {
+ req->tf_message = TRW_DATA ;
+ }
+ }
+ break ;
+
+
+ case LRW_NEW_STREAM:
+
+ if( ( ret_val = AcquireWriteBuffer( channel, req ) ) == TFLE_NO_ERR ) {
+ if( ( ret_val = WT_NewDataStream( channel,
+ channel->cur_buff,
+ &channel->current_stream ) )
+ == NEED_NEW_BUFFER ) {
+
+ msassert( FALSE ) ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ req->buff_ptr = GetDATAStorage( channel, &req->buff_size ) ;
+ msassert( req->buff_ptr != NULL ) ;
+ req->tf_message = TRW_DATA ;
+ }
+ }
+ break ;
+
+
+ case LRW_DATA:
+
+ if( ( ret_val = AcquireWriteBuffer( channel, req ) ) == TFLE_NO_ERR ) {
+ if( channel->current_stream.tf_attrib & STREAM_VARIABLE ) {
+ ret_val = WT_ContVarStream( channel, channel->cur_buff ) ;
+ }
+ if( ret_val == TFLE_NO_ERR ) {
+ req->buff_ptr = GetDATAStorage( channel, &req->buff_size ) ;
+ msassert( req->buff_ptr != NULL ) ;
+ req->tf_message = TRW_DATA ;
+ }
+ }
+ break ;
+
+
+ case LRW_DATA_END:
+
+ if( ( ret_val = AcquireWriteBuffer( channel, req ) ) == TFLE_NO_ERR ) {
+ if( ( ret_val = WT_EndData( channel, channel->cur_buff ) )
+ != TFLE_NO_ERR ) {
+
+ if( ret_val == NEED_NEW_BUFFER ) {
+ msassert( FALSE ) ;
+ ret_val = TFLE_TRANSLATION_FAILURE ;
+ }
+ } else {
+ /* If we were holding a buffer for the
+ translator, it is now safe to send it
+ off to tape.
+ */
+ if( channel->hold_buff != NULL ) {
+ WriteRequest( channel, channel->hold_buff, FALSE ) ;
+ channel->hold_buff = NULL;
+ }
+ req->tf_message = TRW_DB ;
+ }
+ }
+ break ;
+
+
+ case LRW_START:
+ case LRW_EOM_ACK:
+ case LRW_CATALOG:
+ default:
+ msassert( FALSE ) ;
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ break ;
+
+ }
+ }
+ }
+ break ;
+
+ case LRW_ABORT:
+ ret_val = AbortWrite( channel, req ) ;
+ if( !AtEOM( channel ) && ret_val == TFLE_NO_ERR ) {
+ ret_val = TFLE_USER_ABORT ;
+ }
+ break ;
+
+ case LRW_END:
+ ret_val = FinishWrite( channel, req, FALSE ) ;
+ break ;
+
+ case LRW_CATALOG:
+ break ;
+
+ }
+
+ /* An EOM Occurred Somewhere, so tell the Mud Pie */
+ if( AtEOM( channel ) && ret_val == TFLE_NO_ERR ) {
+ req->tf_message = TRW_EOM ;
+ req->buff_size = 0 ;
+
+ /* Setup EOM Pointers for the Loops */
+ *req->vcb_ptr = *( (DBLK_PTR)channel->lst_osvcb ) ;
+
+ switch( channel->lst_tblk ) {
+
+ case BT_FDB:
+ *req->fdb_ptr = *( (DBLK_PTR)channel->lst_osfdb ) ;
+
+ /* fall through */
+
+ case BT_DDB:
+ *req->ddb_ptr = *( (DBLK_PTR)channel->lst_osddb ) ;
+ break ;
+
+ case BT_IDB:
+ *req->idb_ptr = *( (DBLK_PTR)channel->lst_osfdb ) ;
+ break ;
+ }
+
+ }
+
+ if( ret_val != TFLE_NO_ERR ) {
+ req->tf_message = TRW_FATAL_ERR ;
+ req->error_locus = ret_val ;
+ }
+
+ if( req->lp_message != LRW_EOM_ACK ) {
+ if( req->lp_message == LRW_NEW_STREAM && new_stream_complete ) {
+ prev_lp_message = LRW_DATA ;
+ } else {
+ prev_lp_message = (INT16)req->lp_message ;
+ }
+ }
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: AcquireWriteBuffer
+
+ Description: This function attempts to get a new buffer for writing.
+ EOV processing is done from this function. Further, this
+ function switches drives in channel.
+
+ Returns: INT16, a TFLE_xxx code
+
+ Notes: IT IS ASSUMED THAT THE VALID POINTERS IN THE CHANNEL
+ LIST ARE NO LONGER VALID. THIS CAN BE ASSURED WITH A
+ CALL TO "WriteRequest()". IF YOU DON'T CALL "WriteRequest()"
+ BEFORE CALLING THIS FUNCTION, YOU WILL LOSE THE LAST FILLED
+ BUFFER.
+
+ Declaration:
+
+**/
+
+static INT16 _near AcquireWriteBuffer(
+ CHANNEL_PTR channel,
+ RR_PTR req_rep )
+{
+
+ INT16 drv_hdl = channel->cur_drv->drv_hdl, ret_val = TFLE_NO_FREE_BUFFERS ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ BUF_PTR tmpBUF ;
+ RET_BUF myret ;
+
+ /* check to see if we can get any more buffers */
+ if ( BM_ListCount( &channel->buffer_list ) > QueueCount( &channel->cur_drv->inproc_q ) ) {
+ ret_val = TFLE_NO_ERR ;
+ }
+
+ /* Assume we can't get any buffers, and let's attempt to poll the
+ driver. */
+
+ do {
+
+ while( TpReceive( drv_hdl, &myret ) == SUCCESS ) {
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ /* check to see if this is a TpSpecial( ) call made for an EXABYTE 8200SX - MaynStream 2200+ */
+ if( myret.call_type == GEN_SPECIAL ) {
+ if( !myret.gen_error ) {
+ /* write the positioning information sample to the SX file */
+ SX_WriteTmpFile( channel ) ;
+ }
+ } else {
+
+ tmpBUF = QueuePtr( DeQueueElem( &curDRV->inproc_q ) );
+
+ /* This is here to deal with the the fact that
+ we have to write full logical blocks and
+ drives that write 512 blocks might stop in
+ the middle.
+ */
+ if( ( myret.gen_error == GEN_ERR_EOM ) &&
+ ( myret.len_got % (UINT32)channel->lb_size != 0UL ) ) {
+
+ UINT32 got = myret.len_got ;
+ UINT32 req = myret.len_req ;
+
+ BM_SetNextByteOffset( tmpBUF, (UINT16)myret.len_got ) ;
+ TpWrite( channel->cur_drv->drv_hdl,
+ BM_NextBytePtr( tmpBUF ),
+ (UINT32)channel->lb_size -
+ myret.len_got % (UINT32)channel->lb_size ) ;
+
+ while( TpReceive( channel->cur_drv->drv_hdl, &myret ) == FAILURE ) {
+ ThreadSwitch( ) ;
+ }
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ myret.len_got += got ;
+ myret.len_req = req ;
+ if( myret.gen_error == GEN_NO_ERR ) {
+ myret.gen_error = GEN_ERR_EOM ;
+ }
+ }
+
+ WT_ParseWrittenBuffer( channel, tmpBUF, (UINT16)myret.len_got ) ;
+
+ channel->eom_lba += (UINT32)( myret.len_got /
+ channel->lb_size ) ;
+
+ /* For correct statistics */
+ if( myret.gen_error ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_DEVICE_ERROR, myret.gen_error ) ;
+ DumpDebug( drv_hdl ) ;
+ curDRV->thw_inf.drv_status = myret.status ;
+ curDRV->cur_stats.underruns = myret.underruns ;
+ curDRV->cur_stats.dataerrs = myret.readerrs ;
+ }
+
+ switch( myret.gen_error ) {
+
+ case GEN_NO_ERR:
+ BM_Put( tmpBUF ) ;
+ ret_val = TFLE_NO_ERR ;
+ break ;
+
+ case GEN_ERR_EOM:
+ SetChannelStatus( channel, CH_AT_EOM ) ;
+ SetPosBit( curDRV, ( AT_EOM | TAPE_FULL ) ) ;
+ if( myret.len_req != myret.len_got ) {
+ BM_SetNextByteOffset( tmpBUF, (UINT16)myret.len_got ) ;
+ channel->eom_buff = tmpBUF ;
+ } else {
+ BM_Put( tmpBUF ) ;
+ channel->eom_buff = NULL ;
+ }
+
+ PuntBuffer( channel ) ;
+ /* First We Need to write the closing VCB */
+ EOM_Setup( channel, req_rep ) ;
+ ret_val = WT_EndTape( channel ) ;
+ break ;
+
+ case GEN_ERR_NO_MEDIA:
+ BM_Put( tmpBUF ) ;
+ ret_val = TFLE_NO_TAPE ;
+ break ;
+
+ default:
+ BM_Put( tmpBUF ) ;
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+
+ }
+ }
+ }
+ } while( ret_val == TFLE_NO_FREE_BUFFERS ) ;
+
+ /* Okay Let's get a buffer */
+ if( ret_val == TFLE_NO_ERR && !AtEOM( channel ) ) {
+ if ( SnagBuffer( channel ) == NULL ) {
+ ret_val = TFLE_NO_MEMORY ;
+ }
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: EOM_Write
+
+ Description: Does the EOM write. It does the following:
+ 1) Switches drive to next drive in channel ( if there are any ).
+ 2) Writes the continuation VCB.
+ 3) Up the tape sequence number.
+ 4) Writes the appropriate continuation blocks.
+
+ Returns: INT16, a TFLE_xxx code
+
+ Notes: THE LST OS DBLK FIELDS MUST BE FILLED BEFORE CALLING THIS
+ ROUTINE.
+ ALSO, THE CLOSING VCB ON THE CURRENT EOM TAPE MUST ALREADY
+ BE WRITTEN.
+
+ Declaration:
+
+**/
+
+static INT16 _near EOM_Write(
+ CHANNEL_PTR channel, /* the current channel */
+ BUF_PTR lst_buff ) /* the last buffer put to tape */
+{
+ INT16 ret_val, i ;
+ DRIVE_PTR old_drv = channel->cur_drv ;
+ Q_HEADER tmp_q ;
+ Q_ELEM_PTR qe_ptr;
+ DBLKMAP_PTR tmp_map ;
+ UINT16 unwritten ;
+
+ if( !IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+ InitQueue( &tmp_q ) ;
+ /* time to place an ending sample in the SX file */
+ if( SX_TmpFileIsOK( channel ) ) {
+ SX_EndSampling( channel ) ;
+ }
+ }
+
+ /* Ok, now lets switch to a new drive */
+ ret_val = NextDriveInChannel( channel, TRUE ) ;
+
+ if ( ret_val == TF_END_CHANNEL ) {
+ ret_val = ResetChannelList( channel, FALSE ) ;
+ }
+ if ( ret_val != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+
+ /* Let's do some more positioning */
+ if( ( ret_val = PositionAtSet( channel, channel->ui_tpos, TRUE ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+
+ if( !IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+ /* Save the inproc queue and put them on the temp. queue */
+ MoveQueue( &old_drv->inproc_q, &tmp_q ) ;
+ }
+
+ /* Positioning was apparently successful, lets rewrite
+ the header information
+ */
+ channel->ts_num++ ;
+
+ /* we're about to process the continuation blocks so we need to
+ consider whether the SX file needs to be opened
+ */
+ if( SX_IsOK( channel ) ) {
+ SX_StartSampling( channel ) ;
+ }
+
+ if( (ret_val = WT_ContinueSet( channel ) ) != TFLE_NO_ERR ) {
+ return( ret_val ) ;
+ }
+
+ channel->cur_drv->cur_vcb = *( (DBLK_PTR)channel->lst_osvcb ) ;
+
+ /* Write the Remaining portion of the buffer, if one
+ was left over
+ */
+ if( lst_buff != NULL ) {
+ /* total amount - unused amount - amount we wrote */
+ unwritten = BM_XferSize( lst_buff ) - BM_BytesFree( lst_buff )
+ - BM_NextByteOffset( lst_buff ) ;
+
+ /* Adjust the offsets for the new position in the buffer */
+ i = (INT16)BM_NoDblks( lst_buff ) ;
+ while( i ) {
+ tmp_map = (DBLKMAP_PTR)BM_AuxBase( lst_buff ) + i - 1 ;
+ tmp_map->blk_offset -= BM_NextByteOffset( lst_buff ) ;
+ i-- ;
+ }
+ /* slide unwritten data down to start of buffer */
+ memmove( BM_XferBase( lst_buff ), BM_NextBytePtr( lst_buff ), unwritten ) ;
+ BM_SetNextByteOffset( lst_buff, unwritten ) ;
+ WriteRequest( channel, lst_buff, TRUE ) ;
+ }
+
+ if( !IsChannelStatus( channel, CH_EOS_AT_EOM ) ) {
+
+ while( ( qe_ptr = DeQueueElem( &tmp_q ) ) != NULL ) {
+ WriteRequest( channel, QueuePtr( qe_ptr ), FALSE ) ;
+ }
+ }
+ return( TFLE_NO_ERR ) ;
+}
+
+/**/
+/**
+
+ Name: WriteRequest
+
+ Description: Enqueues a request on the current drives in process queues
+ and if the number on the queue is equal to the hiwater mark,
+ starts pumping the data to tape.
+
+ Returns: Nothing
+
+ Notes: This function uses the "q_priority" field in the queue
+ element section of the buffer header to specify whether
+ the buffer has actually been given to the device driver.
+ If the field is set to '1' it has been written, and if
+ it has been set to '0' it has not.
+
+ Declaration:
+
+**/
+
+static VOID _near WriteRequest(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ BOOLEAN flush )
+{
+
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ BUF_PTR tmpBUF ;
+ Q_ELEM_PTR qe_ptr ;
+
+ BM_QElem( buffer ).q_priority = 0 ;
+ EnQueueElem( &curDRV->inproc_q, &BM_QElem( buffer ), FALSE ) ;
+ channel->buffs_enqd++ ;
+
+ if( curDRV->trans_started && TpSpecial( drv_hdl, (INT16)SS_IS_INQ_EMPTY, 0L ) ) {
+ curDRV->trans_started = FALSE ;
+ }
+
+ if( curDRV->trans_started ) {
+ /* Setting the priority to 1, says this has been written */
+ channel->buffs_enqd-- ;
+ BM_QElem( buffer ).q_priority = 1 ;
+ mscassert( BM_NextByteOffset( buffer ) % ChannelBlkSize( channel ) == 0 ) ;
+
+ /* check to see if it is time to sample the position for an EXABYTE 8200SX - MaynStream 2200+ */
+ if( SX_TmpFileIsOK( channel ) ) {
+ SX_SamplingProcessing( channel, ( UINT32 ) buffer->next_byte ) ;
+ }
+
+ TpWrite( drv_hdl, BM_XferBase( buffer ), (UINT32)BM_NextByteOffset( buffer ) ) ;
+ } else if( channel->buffs_enqd == channel->hiwater || flush ) {
+
+ for( qe_ptr = QueueHead( &curDRV->inproc_q ) ; qe_ptr != NULL ; qe_ptr = QueueNext( qe_ptr ) ) {
+ tmpBUF = QueuePtr( qe_ptr );
+ if ( qe_ptr->q_priority == 0 ) {
+ qe_ptr->q_priority = 1 ;
+ mscassert( BM_NextByteOffset( tmpBUF ) % ChannelBlkSize( channel ) == 0 ) ;
+
+ /* check to see if it is time to sample the position for an EXABYTE 8200SX - MaynStream 2200+ */
+ if( SX_TmpFileIsOK( channel ) ) {
+ SX_SamplingProcessing( channel, ( UINT32 ) tmpBUF->next_byte ) ;
+ }
+
+ TpWrite( drv_hdl, BM_XferBase( tmpBUF ), (UINT32)BM_NextByteOffset( tmpBUF ) ) ;
+ }
+ }
+ channel->buffs_enqd = 0 ;
+ curDRV->trans_started = TRUE ;
+ }
+}
+
+/**/
+/**
+
+ Name: FinishWrite
+
+ Description: This function is called when the Loops has specified the
+ end of a BackupSet.
+
+ Returns: INT16, a TFLE_xxx code
+
+ Notes: THERE SHOULD ONLY BE ONE BUFFER TO WRITE AND THAT SHOULD
+ "cur_buff".
+
+ Declaration:
+
+**/
+
+static INT16 _near FinishWrite(
+ CHANNEL_PTR channel,
+ RR_PTR req,
+ BOOLEAN abort )
+{
+ INT16 drv_hdl = channel->cur_drv->drv_hdl ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ DRIVE_PTR curDRV = channel->cur_drv ;
+ BUF_PTR tmpBUF ;
+ RET_BUF myret ;
+ BOOLEAN hit_eom = FALSE ;
+ BOOLEAN done = FALSE ; /* set upon receiving error */
+ Q_ELEM_PTR qe_ptr ;
+
+ /* # of buffers left should be <= 1 */
+
+ if( channel->cur_buff != NULL &&
+ BM_NextByteOffset( channel->cur_buff ) == 0 ) {
+
+ PuntBuffer( channel ) ;
+ }
+
+ if( channel->cur_buff != NULL ) {
+
+ /* The last buffer may only be partially full, and may not be
+ filled to an even physical block boundary (in the case where
+ the physical block size is greater than the logical block size).
+ If this is the case, we call the translator to lay down an "end
+ block" to pad out to the next physical block boundary.
+ */
+ if( BM_NextByteOffset( channel->cur_buff ) %
+ ChannelBlkSize( channel ) != 0 ) {
+ WT_EOSPadBlk( channel ) ;
+ }
+
+ WriteRequest( channel, channel->cur_buff, TRUE ) ;
+ channel->cur_buff = NULL ;
+
+ /* There may be buffers queued up attemting to reach the "high water
+ mark". We need to flush them now.
+ */
+ } else if( channel->buffs_enqd != 0 ) {
+
+ for( qe_ptr = QueueHead( &curDRV->inproc_q ) ; qe_ptr != NULL ; qe_ptr = QueueNext( qe_ptr ) ) {
+ tmpBUF = QueuePtr( qe_ptr );
+ if ( qe_ptr->q_priority == 0 ) {
+ qe_ptr->q_priority = 1 ;
+ mscassert( BM_NextByteOffset( tmpBUF ) % ChannelBlkSize( channel ) == 0 ) ;
+
+ /* check to see if it is time to sample the position for an EXABYTE 8200SX - MaynStream 2200+ */
+ if( SX_TmpFileIsOK( channel ) ) {
+ SX_SamplingProcessing( channel, ( UINT32 ) tmpBUF->next_byte ) ;
+ }
+
+ TpWrite( drv_hdl, BM_XferBase( tmpBUF ), (UINT32)BM_NextByteOffset( tmpBUF ) ) ;
+ }
+ }
+ channel->buffs_enqd = 0 ;
+ tmpBUF = NULL ;
+ }
+
+ /* Clear New */
+ while( !done ) {
+
+ while ( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ if ( TpSpecial( drv_hdl, (INT16)SS_IS_INQ_EMPTY, 0L ) == SUCCESS ) {
+ if ( TpReceive( drv_hdl, &myret ) == FAILURE ) {
+ done = TRUE ;
+ }
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ break ;
+ }
+ ThreadSwitch() ; /* for non-preemptive operating systems */
+ }
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ if ( done ) {
+ break ;
+ }
+
+ /* check to see if this is a TpSpecial( ) call made for an EXABYTE 8200SX - MaynStream 2200+ */
+ if( myret.call_type == GEN_SPECIAL ) {
+
+ if( !myret.gen_error ) {
+ /* write the positioning information sample to the SX file */
+ SX_WriteTmpFile( channel ) ;
+ }
+
+ } else if( myret.call_type == GEN_WRITE ) {
+
+ tmpBUF = QueuePtr( DeQueueElem( &channel->cur_drv->inproc_q ) ) ;
+ msassert( tmpBUF != NULL && myret.buffer == BM_XferBase( tmpBUF ) ) ;
+
+ /* This is here to deal with the the fact that
+ we have to write full logical blocks and
+ drives that write 512 blocks might stop in
+ the middle.
+ */
+ if( ( myret.gen_error == GEN_ERR_EOM ) &&
+ ( myret.len_got % (UINT32)channel->lb_size != 0UL ) ) {
+
+ UINT32 got = myret.len_got ;
+ UINT32 req = myret.len_req ;
+
+ BM_SetNextByteOffset( tmpBUF, (UINT16)myret.len_got ) ;
+ TpWrite( channel->cur_drv->drv_hdl,
+ BM_NextBytePtr( tmpBUF ),
+ (UINT32)channel->lb_size -
+ myret.len_got % (UINT32)channel->lb_size ) ;
+
+ while( TpReceive( channel->cur_drv->drv_hdl, &myret ) == FAILURE ) {
+ ThreadSwitch( ) ;
+ }
+
+ /* Move ESA info from RET_BUF to THW */
+ MOVE_ESA( channel->cur_drv->thw_inf.the, myret.the ) ;
+
+ myret.len_got += got ;
+ myret.len_req = req ;
+ if( myret.gen_error == GEN_NO_ERR ) {
+ myret.gen_error = GEN_ERR_EOM ;
+ }
+ }
+
+ WT_ParseWrittenBuffer( channel, tmpBUF, (UINT16)myret.len_got ) ;
+
+ channel->eom_lba += (UINT32)( myret.len_got / channel->lb_size ) ;
+
+ /* For correct statistics */
+ if( myret.gen_error ) {
+ BE_Zprintf( DEBUG_TAPE_FORMAT, RES_DEVICE_ERROR, myret.gen_error ) ;
+ DumpDebug( drv_hdl ) ;
+ curDRV->thw_inf.drv_status = myret.status ;
+ curDRV->cur_stats.underruns = myret.underruns ;
+ curDRV->cur_stats.dataerrs = myret.readerrs ;
+ }
+
+ switch( myret.gen_error ) {
+
+ case GEN_ERR_EOM:
+ SetChannelStatus( channel, CH_AT_EOM ) ;
+ SetPosBit( curDRV, ( AT_EOM | TAPE_FULL ) ) ;
+ if ( channel->cur_drv->inproc_q.q_count == 0 && myret.len_got == myret.len_req ) {
+ /* oops, we got the whole set written on this tape... */
+ BM_Put( tmpBUF ) ;
+ channel->eom_buff = NULL ;
+ SetChannelStatus( channel, CH_EOS_AT_EOM ) ;
+ } else {
+ if( myret.len_req != myret.len_got ) {
+ BM_SetNextByteOffset( tmpBUF, (UINT16)myret.len_got ) ;
+ channel->eom_buff = tmpBUF ;
+ } else {
+ BM_Put( tmpBUF ) ;
+ channel->eom_buff = NULL ;
+ }
+ EOM_Setup( channel, req ) ;
+ ret_val = WT_EndTape( channel ) ;
+ hit_eom = TRUE ;
+ }
+
+ break ;
+
+ case GEN_NO_ERR:
+ BM_Put( tmpBUF ) ;
+ break ;
+
+ case GEN_ERR_NO_MEDIA:
+ ret_val = TFLE_NO_TAPE ;
+ break ;
+
+ case GEN_ERR_BAD_DATA:
+ case GEN_ERR_TIMEOUT:
+ case GEN_ERR_INVALID_CMD:
+ case GEN_RESET:
+ case GEN_ERR_HARDWARE:
+ case GEN_ERR_UNDETERMINED:
+ default:
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+
+ }
+ }
+ }
+
+ /* No Error so fix it all up */
+ if( ret_val == TFLE_NO_ERR && !hit_eom ) {
+
+ /* time to place an ending sample in the SX file */
+ if( SX_TmpFileIsOK( channel ) ) {
+ SX_EndSampling( channel ) ;
+ }
+
+ /* Finish up the formatting stuff */
+ ret_val = WT_EndSet( channel, abort ) ;
+
+ if( AtEOM( channel ) && ret_val == TFLE_NO_ERR &&
+ ( lw_fmtdescr[channel->cur_fmt].attributes & MUST_WRITE_CONT ) ) {
+ EOM_Setup( channel, req ) ;
+ hit_eom = TRUE ;
+ }
+ }
+
+ if( ret_val == TFLE_NO_ERR && !hit_eom ) {
+
+ /* So We Can get the underruns */
+ UpdateDriveStatus( curDRV ) ;
+
+ /* We are at EOD ... This may not be a valid assumption on devices which
+ allow overwriting of data. */
+ SetPosBit( curDRV, ( AT_EOD | AT_EOS ) ) ;
+
+ /* Copy the last backup vcb into the current drive holder */
+ curDRV->cur_vcb = *( (DBLK_PTR)channel->lst_osvcb ) ;
+ curDRV->vcb_valid = TRUE ;
+
+ }
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: EOM_Setup
+
+ Description: Sets up the TFL for EOM stuff.
+ Calls RD_TranslateDBLK to translate the last tape blocks
+ stored in channel->lst_osXXX into DBLKs.
+
+ Returns: Nothing ...
+
+ Notes: It's raining today.
+
+ Declaration:
+**/
+
+static VOID _near EOM_Setup(
+ CHANNEL_PTR channel,
+ RR_PTR rr_buf )
+{
+ DBLK_PTR hold_dblk = channel->cur_dblk ;
+ UINT16 block_size = MinSizeForTapeBlk( channel->cur_fmt );
+ VOID_PTR save_mem_ptr ; /* used to save allocation in buffer */
+ BUF_PTR buf_ptr ; /* a temporary buffer */
+ UINT16 blk_type ;
+
+ /* get a temporary buffer, save its primary allocation pointer */
+ buf_ptr = BM_GetVCBBuff( &channel->buffer_list );
+ msassert( buf_ptr != NULL );
+ save_mem_ptr = BM_XferBase( buf_ptr );
+
+ /* Translate the Last VCB */
+ if ( !IsChannelStatus( channel, CH_VCB_DBLK ) ) {
+ BM_SetBytesFree( buf_ptr, block_size ) ;
+ BM_SetNextByteOffset( buf_ptr, 0 ) ;
+ BM_XferBase( buf_ptr ) = channel->lst_osvcb ;
+ channel->cur_dblk = rr_buf->vcb_ptr ;
+ SetChannelStatus( channel, CH_VCB_DBLK ) ;
+ (void) RD_TranslateDBLK( channel, buf_ptr, &blk_type ) ;
+ *( (DBLK_PTR)channel->lst_osvcb ) = *rr_buf->vcb_ptr ;
+ }
+
+ /* Translate the DDB (or IDB) */
+ if ( channel->lst_tblk != BT_VCB && !IsChannelStatus( channel, CH_DDB_DBLK ) ) {
+ BM_SetBytesFree( buf_ptr, block_size ) ;
+ BM_SetNextByteOffset( buf_ptr, 0 ) ;
+ BM_XferBase( buf_ptr ) = channel->lst_osddb ;
+ channel->cur_dblk = rr_buf->ddb_ptr ;
+ SetChannelStatus( channel, CH_DDB_DBLK ) ;
+ (void) RD_TranslateDBLK( channel, buf_ptr, &blk_type ) ;
+ *( (DBLK_PTR)channel->lst_osddb ) = *rr_buf->ddb_ptr ;
+ }
+
+ /* Translate the FDB only if needed */
+ if ( channel->lst_tblk == BT_FDB && !IsChannelStatus( channel, CH_FDB_DBLK ) ) {
+ BM_SetBytesFree( buf_ptr, block_size ) ;
+ BM_SetNextByteOffset( buf_ptr, 0 ) ;
+ BM_XferBase( buf_ptr ) = channel->lst_osfdb ;
+ channel->cur_dblk = rr_buf->fdb_ptr ;
+ SetChannelStatus( channel, CH_FDB_DBLK ) ;
+ (void) RD_TranslateDBLK( channel, buf_ptr, &blk_type ) ;
+ *( (DBLK_PTR)channel->lst_osfdb ) = *rr_buf->fdb_ptr ;
+ }
+
+ /* Return the buffer to the channel pool */
+ BM_XferBase( buf_ptr ) = save_mem_ptr ;
+ BM_Put( buf_ptr ) ;
+
+ channel->cur_dblk = hold_dblk ;
+}
+
+/**/
+/**
+
+ Name: AbortWrite
+
+ Description: Contains the code to abort a write operation.
+
+ Returns: INT16, a TFLE_xxx code
+
+ Notes:
+
+ Declaration:
+
+**/
+
+static INT16 _near AbortWrite( CHANNEL_PTR channel, RR_PTR req )
+{
+ UINT16 size = ChannelBlkSize( channel ) ;
+ UINT16 offset ;
+ INT16 ret_val ;
+ BOOLEAN abort_flag = TRUE ;
+
+ msassert( channel->cur_buff != NULL ) ;
+
+ /* pad the buffer out to the next block boundry */
+ offset = BM_NextByteOffset( channel->cur_buff ) ;
+ if( offset % size != 0 ) {
+ BM_UpdCnts( channel->cur_buff, (UINT16)( size - ( offset % size ) ) ) ;
+ }
+
+ /* If we finished out the file, don't call it an abort */
+ if( U64_EQ( channel->current_stream.size, lw_UINT64_ZERO ) ) {
+ abort_flag = FALSE ;
+ }
+
+ ret_val = FinishWrite( channel, req, abort_flag ) ;
+
+ return ret_val ;
+}
+
diff --git a/private/utils/ntbackup/src/tgetinfo.c b/private/utils/ntbackup/src/tgetinfo.c
new file mode 100644
index 000000000..779feb9ab
--- /dev/null
+++ b/private/utils/ntbackup/src/tgetinfo.c
@@ -0,0 +1,258 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tgetinfo.c
+
+ Description: This file contains code to completely fills out a
+ minimalized DBLK.
+
+
+ $Log: M:/LOGFILES/TGETINFO.C_V $
+
+ Rev 1.20 23 Jan 1994 14:02:10 BARRY
+Added debug code
+
+ Rev 1.19 01 Dec 1993 13:41:08 STEVEN
+Path in stream bit was incorrectly cleared
+
+ Rev 1.18 13 Sep 1993 17:22:22 BARRY
+Fixed last fix.
+
+ Rev 1.17 19 Feb 1993 09:40:10 STEVEN
+if get dir info finds file return not found
+
+ Rev 1.16 27 Jan 1993 13:50:56 STEVEN
+updates from msoft
+
+ Rev 1.15 09 Dec 1992 14:11:14 STEVEN
+getinfo for files was not using correct path
+
+ Rev 1.14 07 Dec 1992 14:17:10 STEVEN
+updates from msoft
+
+ Rev 1.13 24 Nov 1992 16:39:44 STEVEN
+fix loose name structures
+
+ Rev 1.12 11 Nov 1992 09:52:44 GREGG
+Unicodeized literals.
+
+ Rev 1.11 10 Nov 1992 08:19:46 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.10 06 Nov 1992 15:48:54 STEVEN
+test write of path in stream
+
+ Rev 1.9 23 Oct 1992 13:33:22 STEVEN
+Fixed problem referencing f.name with DDB; path-in-stream fixes for DDBs.
+
+ Rev 1.8 08 Oct 1992 14:21:40 DAVEV
+Unicode strlen verfication
+
+ Rev 1.7 24 Sep 1992 13:43:28 BARRY
+Changes for huge file name support.
+
+ Rev 1.6 21 Sep 1992 16:51:54 BARRY
+Change over from path_complete to name_complete.
+
+ Rev 1.5 27 May 1992 18:48:38 STEVEN
+need to set field in DDB correctly
+
+ Rev 1.4 21 May 1992 13:51:02 STEVEN
+more long path stuff
+
+ Rev 1.3 04 May 1992 09:28:38 LORIB
+Changes for variable length paths and fixes for structure member names.
+
+ Rev 1.2 12 Mar 1992 15:50:12 STEVEN
+64 bit changes
+
+ Rev 1.1 28 Feb 1992 13:03:32 STEVEN
+step one for varible length paths
+
+ Rev 1.0 17 Jan 1992 17:50:08 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdmacro.h"
+
+#include "fsys.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "msassert.h"
+
+/**/
+/**
+
+ Name: NTFS_GetObjInfo()
+
+ Description: This funciton fills out the missing information
+ in a DBLK.
+
+ Modified: 7/26/1989
+
+ Returns: Error Codes:
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ SUCCESS
+
+ Notes: For FDBs this funciton will check the current
+ directory for the specified file.
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 NTFS_GetObjInfo( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /*I/O- On entry it is minimal on exit Complete */
+{
+ INT16 ret_val ;
+ NTFS_DBLK_PTR ddblk;
+ HANDLE old_scan_hand ;
+ CHAR_PTR path_string ;
+ WIN32_FIND_DATA find_data ;
+
+ msassert( dblk != NULL );
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ dblk->com.os_id = FS_NTFS_ID ;
+ dblk->com.os_ver = FS_NTFS_VER ;
+
+ msassert( fsh->attached_dle != NULL ) ;
+
+ switch( dblk->blk_type ){
+
+ case FDB_ID :
+ if ( ! ddblk->os_info_complete ) {
+
+ ret_val = NTFS_SetupWorkPath( fsh,
+ fsh->cur_dir,
+ ddblk->full_name_ptr->name,
+ &path_string ) ;
+
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+
+ memset( &find_data, 0, sizeof( find_data ) ) ;
+ old_scan_hand = FindFirstFile( path_string, &find_data ) ;
+
+ if ( old_scan_hand != INVALID_HANDLE_VALUE ) {
+
+ ddblk->dta.size = U64_Init( find_data.nFileSizeLow,
+ find_data.nFileSizeHigh ) ;
+ ddblk->dta.os_attr = find_data.dwFileAttributes ;
+ ddblk->dta.create_time = find_data.ftCreationTime ;
+ ddblk->dta.modify_time = find_data.ftLastWriteTime ;
+ ddblk->dta.access_time = find_data.ftLastAccessTime ;
+ FindClose( old_scan_hand ) ;
+ } else {
+ NTFS_DebugPrint( TEXT("NTFS_GetObjInfo: ")
+ TEXT("FindFirstFile error %d, ")
+ TEXT("on FDB \"%s\""),
+ (int)GetLastError(),
+ path_string );
+
+ ret_val = FS_NOT_FOUND ;
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ } else {
+ ret_val = SUCCESS;
+ }
+
+ ddblk->os_info_complete = TRUE;
+ ddblk->name_complete = TRUE;
+
+ break ;
+
+ case DDB_ID :
+
+ if ( ! ddblk->os_info_complete ) {
+
+ if( ddblk->full_name_ptr->name[0] == TEXT('\0') ) { //root dir
+
+ ddblk->dta.os_attr = 0 ;
+ ddblk->dta.size = U64_Init( 0, 0 ) ;
+ ddblk->dta.create_time.dwLowDateTime = 0 ;
+ ddblk->dta.create_time.dwHighDateTime = 0 ;
+ ddblk->dta.modify_time.dwLowDateTime = 0 ;
+ ddblk->dta.modify_time.dwHighDateTime = 0 ;
+ ddblk->dta.access_time.dwLowDateTime = 0 ;
+ ddblk->dta.access_time.dwHighDateTime = 0 ;
+
+ ddblk->b.d.ddb_attrib = 0;
+ ret_val = SUCCESS ;
+
+ } else {
+
+ ddblk->b.d.ddb_attrib = 0;
+
+ if ( ddblk->full_name_ptr->name_size > NTFS_MAX_DSIZE ) {
+ ddblk->b.d.ddb_attrib |= (DIR_PATH_IN_STREAM_BIT) ;
+ }
+ ret_val = NTFS_SetupWorkPath( fsh, ddblk->full_name_ptr->name, NULL, &path_string ) ;
+
+ if ( ret_val != SUCCESS ) {
+ return ret_val ;
+ }
+
+ memset( &find_data, 0, sizeof( find_data ) );
+ old_scan_hand = FindFirstFile( path_string, &find_data ) ;
+
+ if ( (old_scan_hand != INVALID_HANDLE_VALUE ) &&
+ (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
+
+ ddblk->dta.size = U64_Init( 0, 0 ) ;
+ ddblk->dta.os_attr = find_data.dwFileAttributes ;
+ ddblk->dta.create_time = find_data.ftCreationTime ;
+ ddblk->dta.modify_time = find_data.ftLastWriteTime ;
+ ddblk->dta.access_time = find_data.ftLastAccessTime ;
+ FindClose( old_scan_hand ) ;
+
+ ret_val = SUCCESS ;
+
+ } else {
+ NTFS_DebugPrint( TEXT("NTFS_GetObjInfo: ")
+ TEXT("FindFirstFile error %d, ")
+ TEXT("on DDB \"%s\""),
+ (int)GetLastError(),
+ path_string );
+
+ ret_val = FS_NOT_FOUND ;
+ }
+ NTFS_ReleaseWorkPath( fsh ) ;
+ }
+
+ ddblk->blk_type = DDB_ID ;
+
+ ddblk->name_complete = TRUE;
+ ddblk->os_info_complete = TRUE;
+
+ } else {
+ ret_val = SUCCESS;
+ }
+
+ break ;
+
+
+ case VCB_ID:
+ ret_val = SUCCESS ;
+ break ;
+
+ default :
+
+ ret_val = FS_NOT_FOUND ;
+ }
+
+ return( ret_val ) ;
+}
diff --git a/private/utils/ntbackup/src/tgetnext.c b/private/utils/ntbackup/src/tgetnext.c
new file mode 100644
index 000000000..f7ba3a703
--- /dev/null
+++ b/private/utils/ntbackup/src/tgetnext.c
@@ -0,0 +1,638 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tgetnext.c
+
+ Description: This file contains code to enumerate the contents of
+ a directory.
+
+
+ $Log: N:\logfiles\tgetnext.c_v $
+
+ Rev 1.33.1.1 15 Jul 1994 19:51:30 STEVEN
+fix more net errors
+
+ Rev 1.33.1.0 17 Jun 1994 20:05:20 STEVEN
+fix bug with net dissconect
+
+ Rev 1.33 23 Jan 1994 14:04:00 BARRY
+Added debug code; cleaned up bogus use of -1 and NULL for handle values
+
+ Rev 1.32 18 Oct 1993 19:14:20 STEVEN
+add support for PERIOD & SPACE
+
+ Rev 1.31 29 Sep 1993 11:47:56 BARRY
+Don't return dead net on ERROR_PATH_NOT_FOUND.
+
+ Rev 1.30 17 Aug 1993 17:50:02 BARRY
+More cases for the net going bye-bye.
+
+ Rev 1.29 27 Jul 1993 17:33:20 BARRY
+Based on experimentation, cleaned up the error codes one more time.
+
+ Rev 1.28 26 Jul 1993 18:30:28 STEVEN
+another place to check for SPACE
+
+ Rev 1.27 26 Jul 1993 17:10:56 STEVEN
+fix files ending in SPACE
+
+ Rev 1.26 23 Jul 1993 13:48:00 BARRY
+Better error support.
+
+ Rev 1.25 21 Jul 1993 16:10:28 BARRY
+Don't return FS_NOT_FOUND from FindFirst/Next.
+
+ Rev 1.24 16 Jul 1993 14:20:50 BARRY
+If FindFirst/Next on a remote drive returns any error other than
+ERROR_NO_MORE_FILES assume something has gone really wrong and
+return FS_COMM_FAILURE. (This is a kludge because there is no good
+way to know if a device has truly died.)
+
+ Rev 1.23 30 Jun 1993 15:12:54 BARRY
+Handle those pesky Mac names.
+
+ Rev 1.22 20 May 1993 17:39:58 BARRY
+[Steve] Kludge fix for handling Unicode file names in an ASCII app.
+
+ Rev 1.21 27 Jan 1993 13:51:02 STEVEN
+updates from msoft
+
+ Rev 1.20 07 Dec 1992 14:18:46 STEVEN
+updates from msoft
+
+ Rev 1.19 11 Nov 1992 09:52:24 GREGG
+Unicodeized literals.
+
+ Rev 1.18 10 Nov 1992 08:20:54 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.17 06 Nov 1992 16:27:44 STEVEN
+test unlimited file sizes
+
+ Rev 1.16 19 Oct 1992 17:53:32 BARRY
+Was testing directory bit in wrong attribute word.
+
+ Rev 1.15 08 Oct 1992 14:21:34 DAVEV
+Unicode strlen verfication
+
+ Rev 1.14 07 Oct 1992 18:00:44 BARRY
+Use common function for FindFirst/FindNext to fill out DBLK.
+
+ Rev 1.13 05 Oct 1992 11:57:26 BARRY
+Forgot to init huge fname pointer.
+
+ Rev 1.12 24 Sep 1992 13:43:30 BARRY
+Changes for huge file name support.
+
+ Rev 1.11 21 Sep 1992 16:51:56 BARRY
+Change over from path_complete to name_complete.
+
+ Rev 1.10 17 Aug 1992 15:42:34 STEVEN
+fix warnings
+
+ Rev 1.9 20 Jul 1992 10:43:02 STEVEN
+backup short file name
+
+ Rev 1.8 09 Jun 1992 15:10:24 BURT
+Sync with NT stuff
+
+ Rev 1.6 21 May 1992 13:49:24 STEVEN
+more long path support
+
+ Rev 1.5 04 May 1992 09:32:12 LORIB
+Changes for variable length paths.
+
+ Rev 1.4 12 Mar 1992 15:50:16 STEVEN
+64 bit changes
+
+ Rev 1.3 28 Feb 1992 13:03:42 STEVEN
+step one for varible length paths
+
+ Rev 1.2 12 Feb 1992 10:46:52 STEVEN
+fix warning
+
+ Rev 1.1 05 Feb 1992 15:47:40 STEVEN
+added support for FindHandle Queue
+
+ Rev 1.0 17 Jan 1992 17:50:08 STEVEN
+Initial revision.
+
+**/
+/* begin include list */
+#include <windows.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+#include "queues.h"
+
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "tfldefs.h"
+
+static VOID NTFS_ClearFindHand(
+FSYS_HAND fsh, /* I - File system handle */
+DBLK_PTR dblk ) ; /* I - discriptor block which contains scan hand */
+
+static INT16 NTFS_EnQueueScanHand(
+FSYS_HAND fsh, /* I - File system handle */
+DBLK_PTR dblk ) ; /* I - discriptor block which contains scan hand */
+
+static INT16 TranslateFindError( FSYS_HAND fsh, DWORD err );
+
+/**/
+/**
+
+ Name: NTFS_FindFirst()
+
+ Description: This function calls WIN32S to find the entry in the
+ current directory which matches the search name (s_name).
+ This function returns an initialized FDB or DDB.
+
+ Modified: 1/10/1992 15:24:39
+
+ Returns: Error codes:
+ FS_NO_MORE
+ SUCCESS
+
+ Notes: This function will NOT return directories "." and ".."
+
+ See also: NTFS_FindNext()
+
+**/
+INT16 NTFS_FindFirst(
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+CHAR_PTR sname, /* I - search name */
+UINT16 obj_type) /* I - objects to search for (dirs, all, etc)*/
+{
+ GENERIC_DLE_PTR dle = fsh->attached_dle ;
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk ;
+ INT16 ret_val = SUCCESS;
+ NTFS_FSYS_RESERVED_PTR ntfs_fsh = fsh->reserved.ptr ;
+ WIN32_FIND_DATA find_data ;
+ CHAR_PTR path_string ;
+ DWORD findError = NO_ERROR;
+
+ msassert( dle != NULL ) ;
+
+ dblk->com.os_id = FS_NTFS_ID ;
+ dblk->com.os_ver = FS_NTFS_VER ;
+ ntfs_fsh->file_scan_mode = obj_type ;
+ memset( &find_data, 0, sizeof( find_data ) ) ;
+
+ /* form BASE_PATH */
+ if ( NTFS_SetupWorkPath( fsh, fsh->cur_dir, sname, &path_string ) != SUCCESS)
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ ddblk->dta.scan_hand = FindFirstFile( path_string, &find_data ) ;
+
+ if ( ddblk->dta.scan_hand != INVALID_HANDLE_VALUE )
+ {
+ ret_val = NTFS_EnQueueScanHand( fsh, dblk ) ;
+ }
+ else
+ {
+ findError = GetLastError();
+ }
+
+ if ( (findError == NO_ERROR) && (ret_val == SUCCESS) )
+ {
+ if ( find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
+ {
+ if ( ( find_data.cFileName[0]==TEXT('.')) &&
+ ( ( find_data.cFileName[1]==TEXT('\0')) ||
+ ( ( find_data.cFileName[1]==TEXT('.')) &&
+ ( find_data.cFileName[2]==TEXT('\0')) ) ) ) /* if dir = ".." or "." */
+ {
+
+ ret_val = NTFS_FindNext( fsh, dblk ) ;
+ }
+ else
+ {
+ ret_val = NTFS_FillOutDBLK( fsh, dblk, &find_data );
+ }
+ }
+ else
+ {
+ ret_val = NTFS_FillOutDBLK( fsh, dblk, &find_data );
+ }
+ }
+ else if ( ret_val == SUCCESS )
+ {
+ ret_val = TranslateFindError( fsh, findError );
+ if ( findError != ERROR_NO_MORE_FILES )
+ {
+ NTFS_DebugPrint( TEXT("NTFS_FindFirst: ")
+ TEXT("FindFirstFile error %d, ")
+ TEXT("path = \"%s\""),
+ (int)findError,
+ path_string );
+ }
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: NTFS_FindNext()
+
+ Description: This function calls WIN32 to get the "NEXT" directory
+ element in the current directory.
+
+ The dblk passed in must be initialized by a call to NTFS_GetFirst()
+
+ Modified: 1/10/1992 15:46:20
+
+ Returns: Error code:
+ SUCCESS
+ FILE_NOT_FOUND
+
+ Notes: This function will NOT return "." and ".."
+
+ See also: NTFS_FindFirst()
+
+**/
+INT16 NTFS_FindNext( fsh, dblk )
+FSYS_HAND fsh; /* I - File system handle */
+DBLK_PTR dblk; /* O - Discriptor block */
+{
+ INT16 ret_val = SUCCESS;
+ BOOLEAN try_again ;
+ NTFS_DBLK_PTR ddblk;
+ WIN32_FIND_DATA find_data ;
+ NTFS_FSYS_RESERVED_PTR ntfs_fsh ;
+
+ msassert( fsh->attached_dle != NULL ) ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ ntfs_fsh = fsh->reserved.ptr ;
+
+ dblk->com.os_id = FS_NTFS_ID ;
+ dblk->com.os_ver = FS_NTFS_VER ;
+
+ do {
+ try_again = FALSE ;
+
+ if ( !FindNextFile( ddblk->dta.scan_hand, &find_data ) )
+ {
+ DWORD err = GetLastError( );
+
+ ret_val = TranslateFindError( fsh, err );
+
+ if ( ret_val != FS_NO_MORE )
+ {
+ NTFS_DebugPrint( TEXT("NTFS_FindNext: ")
+ TEXT("FindNextFile failed with %d"),
+ (int)err );
+ }
+
+ NTFS_ClearFindHand( fsh, dblk ) ;
+ ddblk->dta.scan_hand = INVALID_HANDLE_VALUE ;
+ break ;
+ }
+
+ if ( find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
+ {
+ if ( ( find_data.cFileName[0]==TEXT('.')) &&
+ ( ( find_data.cFileName[1]==TEXT('\0')) ||
+ ( ( find_data.cFileName[1]==TEXT('.')) &&
+ ( find_data.cFileName[2]==TEXT('\0')) ) ) )
+ {
+ /* dir is ".." or "." */
+ try_again = TRUE ;
+ }
+ }
+ } while (try_again ) ;
+
+ if ( ret_val == SUCCESS )
+ {
+ ret_val = NTFS_FillOutDBLK( fsh, dblk, &find_data );
+ }
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_FillOutDBLK()
+
+ Description: Common function to properly fill out a DBLK.
+
+ Modified: 06-Oct-92
+
+ Returns:
+
+**/
+INT16 NTFS_FillOutDBLK( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ WIN32_FIND_DATA *find_data )
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk;
+ INT16 ret_val = SUCCESS;
+
+ dblk->com.os_name = NULL ;
+
+ ddblk->dta.size = U64_Init( find_data->nFileSizeLow,
+ find_data->nFileSizeHigh ) ;
+ ddblk->dta.os_attr = find_data->dwFileAttributes ;
+ ddblk->dta.create_time = find_data->ftCreationTime ;
+ ddblk->dta.modify_time = find_data->ftLastWriteTime ;
+ ddblk->dta.access_time = find_data->ftLastAccessTime ;
+ ddblk->name_complete = TRUE;
+
+ if ( ddblk->dta.os_attr & FILE_ATTRIBUTE_DIRECTORY ) /* if directory */
+ {
+ ddblk->blk_type = DDB_ID ;
+ ddblk->b.d.ddb_attrib = 0;
+
+ if ( strsize( fsh->cur_dir ) + strsize(find_data->cFileName) > NTFS_MAX_DSIZE )
+ {
+ ddblk->b.d.ddb_attrib |= (DIR_PATH_IN_STREAM_BIT) ;
+
+ }
+
+ if ( ! fsh->attached_dle->info.ntfs->mac_name_syntax &&
+ ( strchr( find_data->cFileName, TEXT('?') ) ||
+ ( find_data->cFileName[ strlen( find_data->cFileName ) - 1 ] == TEXT('.') ) ||
+ ( find_data->cFileName[ strlen( find_data->cFileName ) - 1 ] == TEXT(' ') ) ) ) {
+
+ ret_val = NTFS_SetupPathInDDB( fsh, dblk, &fsh->cur_dir[1], find_data->cAlternateFileName, 0 ) ;
+ } else {
+ ret_val = NTFS_SetupPathInDDB( fsh, dblk, &fsh->cur_dir[1], find_data->cFileName, 0 ) ;
+ }
+
+ if ( ret_val != SUCCESS )
+ {
+ NTFS_ClearFindHand( fsh, dblk ) ;
+ }
+
+ }
+ else
+ {
+ ddblk->blk_type = FDB_ID ;
+ ddblk->b.f.fdb_attrib = 0;
+
+ if ( find_data->cAlternateFileName[0] != TEXT('\0') ) {
+
+ ddblk->b.f.PosixFile = FALSE ;
+
+ memcpy( ddblk->b.f.alt_name,
+ find_data->cAlternateFileName,
+ sizeof( find_data->cAlternateFileName ) ) ;
+
+ } else {
+ ddblk->b.f.PosixFile = TRUE ;
+ memset( ddblk->b.f.alt_name, 0, sizeof( ddblk->b.f.alt_name ) ) ;
+
+ }
+
+ if ( (strlen( find_data->cFileName ) + 2) > NTFS_MAX_FSIZE )
+ {
+ ddblk->b.f.fdb_attrib |= (FILE_NAME_IN_STREAM_BIT) ;
+ }
+
+ // files with a '?' have a non mapable unicode character //
+ // files which end in '.' or ' ' are not accessable using WIN32 //
+
+ if ( ! fsh->attached_dle->info.ntfs->mac_name_syntax &&
+ ( strchr( find_data->cFileName, TEXT('?') ) ||
+ ( find_data->cFileName[ strlen( find_data->cFileName ) - 1 ] == TEXT('.') ) ||
+ ( find_data->cFileName[ strlen( find_data->cFileName ) - 1 ] == TEXT(' ') ) ) ) {
+
+ ret_val = NTFS_SetupFileNameInFDB( fsh,
+ dblk,
+ find_data->cAlternateFileName,
+ 0 );
+ } else {
+ ret_val = NTFS_SetupFileNameInFDB( fsh,
+ dblk,
+ find_data->cFileName,
+ 0 );
+ }
+
+ if ( ret_val != SUCCESS )
+ {
+ NTFS_ClearFindHand( fsh, dblk );
+ }
+
+ ddblk->b.f.handle = NULL ;
+ }
+ ddblk->os_info_complete = TRUE;
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: NTFS_FindClose()
+
+ Description: This function calls WIN32 to get the end the
+ scan for the specified directory.
+
+ The dblk passed in must be initialized by a call to NTFS_GetFirst() or
+ NTFS_FindClose
+
+ Modified: 1/10/1992 15:46:20
+
+ Returns: Error code:
+ SUCCESS
+ FILE_NOT_FOUND
+
+ Notes: This function will NOT return "." and ".."
+
+ See also: NTFS_FindFirst()
+
+**/
+INT16 NTFS_FindClose( FSYS_HAND fsh,
+ DBLK_PTR dblk )
+{
+ NTFS_DBLK_PTR ddblk;
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ (VOID)(fsh);
+
+ if ( ddblk->dta.scan_hand != INVALID_HANDLE_VALUE )
+ {
+ NTFS_ClearFindHand( fsh, dblk ) ;
+ }
+
+ ddblk->dta.scan_hand = INVALID_HANDLE_VALUE ;
+
+ return SUCCESS ;
+}
+
+static INT16 NTFS_EnQueueScanHand(
+FSYS_HAND fsh, /* I - File system handle */
+DBLK_PTR dblk ) /* I - discriptor block which contains scan hand */
+{
+ NTFS_DBLK_PTR ddblk;
+ NTFS_SCAN_Q_ELEM_PTR scan_q_elem ;
+ NTFS_FSYS_RESERVED_PTR ntfs_res ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ ntfs_res = (NTFS_FSYS_RESERVED_PTR)( fsh->reserved.ptr ) ;
+
+ scan_q_elem = calloc( 1, sizeof( *scan_q_elem ) ) ;
+
+ if ( scan_q_elem == NULL )
+ {
+ FindClose( ddblk->dta.scan_hand ) ;
+ return OUT_OF_MEMORY ;
+ }
+ else
+ {
+ scan_q_elem->scan_hand = ddblk->dta.scan_hand ;
+ EnQueueElem( &ntfs_res->scan_q, &scan_q_elem->q, FALSE ) ;
+ }
+
+ return SUCCESS ;
+}
+static VOID NTFS_ClearFindHand(
+FSYS_HAND fsh, /* I - File system handle */
+DBLK_PTR dblk ) /* I - discriptor block which contains scan hand */
+{
+ NTFS_DBLK_PTR ddblk;
+ NTFS_SCAN_Q_ELEM_PTR scan_q_elem ;
+ NTFS_FSYS_RESERVED_PTR ntfs_res ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ ntfs_res = (NTFS_FSYS_RESERVED_PTR)( fsh->reserved.ptr ) ;
+
+ scan_q_elem = (NTFS_SCAN_Q_ELEM_PTR)QueueHead( &ntfs_res->scan_q ) ;
+
+ while ( scan_q_elem ) {
+ if ( scan_q_elem->scan_hand == ddblk->dta.scan_hand ) {
+ RemoveQueueElem( &ntfs_res->scan_q, &scan_q_elem->q ) ;
+ free( scan_q_elem ) ;
+ break ;
+ } else {
+ scan_q_elem = ( NTFS_SCAN_Q_ELEM_PTR)QueueNext( &scan_q_elem->q) ;
+ }
+ }
+
+ if ( FindClose( ddblk->dta.scan_hand ) == FALSE )
+ {
+ NTFS_DebugPrint( TEXT("NTFS_ClearFindHand: FindClose error %d"),
+ (int)GetLastError() );
+ }
+}
+
+VOID NTFS_EmptyFindHandQ(
+FSYS_HAND fsh ) /* I - File system handle */
+{
+ NTFS_SCAN_Q_ELEM_PTR scan_q_elem ;
+ NTFS_FSYS_RESERVED_PTR ntfs_res ;
+
+ ntfs_res = (NTFS_FSYS_RESERVED_PTR)( fsh->reserved.ptr ) ;
+
+ scan_q_elem = (NTFS_SCAN_Q_ELEM_PTR)DeQueueElem( &ntfs_res->scan_q ) ;
+
+ while ( scan_q_elem )
+ {
+ if ( scan_q_elem->scan_hand != INVALID_HANDLE_VALUE )
+ {
+ FindClose( scan_q_elem->scan_hand ) ;
+ }
+ free( scan_q_elem ) ;
+ scan_q_elem = (NTFS_SCAN_Q_ELEM_PTR)DeQueueElem( &ntfs_res->scan_q ) ;
+ }
+}
+
+/**/
+/**
+
+ Name: TranslateFindError()
+
+ Description: Performs mapping from NT errors to FS errors
+ for problems on find operations.
+
+ Modified: 22-Jul-93
+
+ Returns: FS error code
+
+ Notes: Too specific to FindFirst/Next operations to use for
+ any other operations.
+
+**/
+static INT16 TranslateFindError( FSYS_HAND fsh, DWORD err )
+{
+ INT16 ret;
+ BOOLEAN remote = DLE_HasFeatures( fsh->attached_dle, DLE_FEAT_REMOTE_DRIVE );
+
+ switch ( err )
+ {
+ case NO_ERROR:
+ ret = SUCCESS;
+ break;
+
+ case ERROR_FILE_NOT_FOUND: // 2
+ case ERROR_NO_MORE_FILES: // 18
+ case ERROR_NO_MORE_ITEMS:
+ ret = FS_NO_MORE;
+ break;
+
+ case ERROR_PATH_NOT_FOUND: // 3 (cannot access directory)
+ case ERROR_ACCESS_DENIED: // 5 example: no rights to scan
+ ret = FS_ACCESS_DENIED;
+ break;
+
+ case ERROR_NETNAME_DELETED:
+ case ERROR_BAD_NETPATH:
+ case ERROR_BAD_NET_NAME:
+ case ERROR_UNEXP_NET_ERR:
+ if ( remote )
+ {
+ ret = FS_COMM_FAILURE;
+ }
+ else
+ {
+ ret = FS_ACCESS_DENIED;
+ }
+ break;
+
+
+ case ERROR_HANDLE_EOF: // kludge: we get EOF if device dies
+ if ( remote )
+ {
+ ret = FS_COMM_FAILURE;
+ }
+ else
+ {
+ ret = FS_NO_MORE;
+ }
+ break;
+
+ case ERROR_DEV_NOT_EXIST:
+ case ERROR_NOT_DOS_DISK:
+ case ERROR_READ_FAULT:
+ case ERROR_DISK_CORRUPT:
+ case ERROR_FILE_CORRUPT:
+ case ERROR_FILE_INVALID:
+ case ERROR_SEEK:
+ ret = FS_DEVICE_ERROR;
+ break;
+
+ default:
+ ret = FS_ACCESS_DENIED;
+ break;
+ }
+ return ret;
+}
+
+
diff --git a/private/utils/ntbackup/src/tgetpath.c b/private/utils/ntbackup/src/tgetpath.c
new file mode 100644
index 000000000..398269c7e
--- /dev/null
+++ b/private/utils/ntbackup/src/tgetpath.c
@@ -0,0 +1,500 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tgetpath.c
+
+ Description: This file contains code to get the current directory
+ path and the complete directory path from the file system handle.
+
+
+ $Log: M:/LOGFILES/TGETPATH.C_V $
+
+ Rev 1.23.1.1 19 Jan 1994 12:52:06 BARRY
+Supress warnings
+
+ Rev 1.23.1.0 18 Oct 1993 19:21:56 STEVEN
+add support for SPACE & PERIOD
+
+ Rev 1.23 30 Jul 1993 13:19:14 STEVEN
+if dir too deep make new one
+
+ Rev 1.22 19 Feb 1993 09:21:46 STEVEN
+fix some bugs
+
+ Rev 1.21 14 Jan 1993 13:33:52 STEVEN
+added stream_id to error message
+
+ Rev 1.20 11 Nov 1992 09:52:40 GREGG
+Unicodeized literals.
+
+ Rev 1.19 10 Nov 1992 14:54:22 STEVEN
+
+
+ Rev 1.18 10 Nov 1992 14:03:52 STEVEN
+do not queue invalid stuff
+
+ Rev 1.17 10 Nov 1992 08:19:04 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.16 06 Nov 1992 15:49:56 STEVEN
+test write of path in stream
+
+ Rev 1.15 29 Oct 1992 16:54:18 BARRY
+Some path-in-stream changes.
+
+ Rev 1.14 14 Oct 1992 14:40:06 BARRY
+Fixed spelling errors.
+
+ Rev 1.13 09 Oct 1992 14:52:22 BARRY
+Name-in-stream changes.
+
+ Rev 1.12 07 Oct 1992 14:26:08 STEVEN
+removed base_path
+
+ Rev 1.11 07 Oct 1992 13:50:58 DAVEV
+unicode strlen verification
+
+ Rev 1.10 24 Sep 1992 13:43:34 BARRY
+Changes for huge file name support.
+
+ Rev 1.9 04 Sep 1992 17:15:00 STEVEN
+fix warnings
+
+ Rev 1.8 09 Jun 1992 15:06:52 BURT
+Sync with NT stuff
+
+ Rev 1.6 22 May 1992 16:05:26 STEVEN
+
+
+ Rev 1.5 21 May 1992 13:49:08 STEVEN
+more long path support
+
+ Rev 1.4 18 May 1992 14:28:42 STEVEN
+fixed release blk
+
+ Rev 1.3 04 May 1992 09:20:50 LORIB
+Changes for variable length paths.
+
+ Rev 1.2 28 Feb 1992 13:03:48 STEVEN
+step one for varible length paths
+
+ Rev 1.1 05 Feb 1992 15:47:42 STEVEN
+added support for FindHandle Queue
+
+ Rev 1.0 17 Jan 1992 17:50:10 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfs_fs.h"
+#include "ntfsdblk.h"
+/**/
+/**
+
+ Name: NTFS_GetCurrentPath()
+
+ Description: This function sets a string to describes the current
+ path.
+
+ Modified: 1/10/1992 14:2:3
+
+ Returns: Error Codes :
+ FS_DLE_NOT_ATTACHED
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes: The delimiter between directories is '\0'
+
+**/
+INT16 NTFS_GetCurrentPath( fsh, path, size )
+FSYS_HAND fsh ; /* I - file system to get current path from */
+CHAR_PTR path ; /* O - buffer to place this path */
+INT16 *size ; /*I/O- size of buffer on entry & on exit */
+{
+ GENERIC_DLE_PTR dle ;
+ CHAR_PTR p ;
+ INT16 ret_val ;
+ INT16 temp_size ;
+
+ dle = fsh->attached_dle ;
+
+ msassert( dle != NULL ) ;
+
+ temp_size = (INT16)strsize( fsh->cur_dir ) ; /* count the last '\0' */
+
+ if ( *size < temp_size ) {
+
+ ret_val = FS_BUFFER_TO_SMALL ;
+
+ }
+ else {
+
+ /* copy the whole cur_dir over and then...*/
+
+ strcpy( path, &(fsh->cur_dir[1]) ) ;
+
+ /* ...replace backslashes with nulls */
+
+ p = strchr( path, TEXT('\\') ) ;
+ while ( p != NULL ) {
+ *p = TEXT('\0');
+ p = strchr( p+1, TEXT('\\') ) ;
+ }
+
+ ret_val = SUCCESS ;
+ }
+
+ *size = temp_size ;
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: NTFS_GetBasePath()
+
+ Description: This function returns the base (root) path.
+
+ Modified: 1/10/1992 14:44:28
+
+ Returns: Error codes:
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes: This can be used for display purposes.
+
+**/
+INT16 NTFS_GetBasePath( fsh, full_path, size )
+FSYS_HAND fsh; /* I - file system to get base path from */
+CHAR_PTR full_path ; /* O - buffer to place this path */
+INT16 *size ; /*I/O- size of buffer on entry & on exit */
+{
+ INT16 ret_val ;
+
+ msassert( fsh->attached_dle != NULL ) ;
+
+ if ( *size < 1 ) {
+
+ ret_val = FS_BUFFER_TO_SMALL ;
+
+ }
+ else {
+
+ *full_path = TEXT('\0');
+
+ ret_val = SUCCESS ;
+ }
+ *size = 1 ;
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: NTFS_GetCurrentDDB()
+
+ Description: This function initializes the provided DDB with the
+ information for the current directory.
+
+
+ Modified: 1/10/1992 14:45:26
+
+ Returns: Error code:
+ FS_INVALID_DIR
+ SUCCESS
+ OUT_OF_MEMORY
+
+ Notes:
+
+**/
+INT16 NTFS_GetCurrentDDB( fsh, dblk )
+FSYS_HAND fsh ; /* I - file system to get DDB from */
+DBLK_PTR dblk ; /* O - place to put the DDB data */
+{
+ GENERIC_DLE_PTR dle ;
+ NTFS_DBLK_PTR ddblk ;
+ INT16 ret_val = SUCCESS ;
+
+ dle = fsh->attached_dle ;
+
+ msassert( dle != NULL ) ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk ;
+ ddblk->blk_type = DDB_ID ;
+ ddblk->os_info_complete = FALSE ;
+ dblk->com.os_name = NULL ;
+
+ if ( strsize( fsh->cur_dir ) > NTFS_MAX_DSIZE ) {
+ ddblk->b.d.ddb_attrib |= (DIR_PATH_IN_STREAM_BIT) ;
+ }
+ ret_val = NTFS_SetupPathInDDB( fsh, dblk, &fsh->cur_dir[1], NULL, 0 ) ;
+
+ if ( (ret_val == SUCCESS) && (NTFS_GetObjInfo( fsh, dblk ) != SUCCESS) ) {
+ ret_val = FS_INVALID_DIR ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+VOID NTFS_GetRealBasePath( FSYS_HAND fsh, CHAR_PTR path )
+{
+ path[0] = fsh->attached_dle->info.ntfs->drive ;
+ path[1] = TEXT(':');
+ path[2] = TEXT('\0');
+}
+INT16 NTFS_SetupWorkPath(
+FSYS_HAND fsh,
+CHAR_PTR cur_dir,
+CHAR_PTR sname,
+CHAR_PTR *path_string )
+{
+ UINT16 req_size ;
+ NTFS_FSYS_RESERVED_PTR nt_fsh ;
+ CHAR_PTR path ;
+ INT16 ret_val = SUCCESS ;
+
+ nt_fsh = (NTFS_FSYS_RESERVED_PTR)( fsh->reserved.ptr ) ;
+
+ while( nt_fsh->work_buf_in_use ) ; /* wait on semaphore */
+
+ nt_fsh->work_buf_in_use = 1 ;
+
+ req_size = 10 * sizeof (CHAR) ;
+ req_size += strlen( cur_dir ) * sizeof (CHAR);
+
+ if ( sname != NULL ) {
+ //DAVEV: note: this line was 1 + strlen() - the 1 was added to
+ // allow for an additional backslash - when using strsize()
+ // this one is automatically added since the trailing NULL
+ // is counted. This may not be obvious - hence this note.
+
+ req_size += strsize( sname ) ;
+ }
+
+ if ( nt_fsh->work_buf_size < req_size ) {
+ nt_fsh->work_buf_size = (UINT16)(req_size + 100) ;
+ nt_fsh->work_buf = realloc( nt_fsh->work_buf, nt_fsh->work_buf_size ) ;
+ }
+
+ if ( nt_fsh->work_buf ) {
+
+ INT index = 0 ;
+
+ path = nt_fsh->work_buf ;
+
+ if ( fsh->attached_dle->info.ntfs->mac_name_syntax ) {
+ path[0] = path[1] = path[3] = TEXT('\\') ;
+ path[2] = TEXT('?') ;
+ index = 4 ;
+ }
+
+ path[index + 0] = fsh->attached_dle->info.ntfs->drive ;
+ path[index + 1] = TEXT(':');
+ path[index + 2] = TEXT('\0');
+
+ if( *cur_dir != TEXT('\\') ) {
+ strcat( path, TEXT("\\") ) ;
+ }
+ strcat( path, cur_dir );
+
+ if ( sname != NULL ) {
+ if ( cur_dir[1] != TEXT('\0') ) {
+ strcat( path, TEXT("\\") ) ;
+ }
+ strcat( path, sname ) ;
+ }
+
+ *path_string = path ;
+
+ } else {
+ nt_fsh->work_buf_size = 0 ;
+ nt_fsh->work_buf_in_use = 0 ;
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ return ret_val ;
+
+}
+VOID NTFS_ReleaseWorkPath(
+FSYS_HAND fsh )
+{
+ NTFS_FSYS_RESERVED_PTR nt_fsh ;
+
+ nt_fsh = (NTFS_FSYS_RESERVED_PTR)( fsh->reserved.ptr ) ;
+
+ nt_fsh->work_buf_in_use = 0 ;
+}
+
+INT16 NTFS_SetupPathInDDB(
+FSYS_HAND fsh,
+DBLK_PTR dblk,
+CHAR_PTR cur_dir,
+CHAR_PTR sub_dir_name,
+UINT16 buf_req_size )
+{
+ UINT16 req_size = 0 ;
+ NTFS_DBLK_PTR ddblk ;
+ FS_NAME_Q_ELEM_PTR path_q_elem ;
+ INT16 ret_val = SUCCESS ;
+
+ ddblk = (NTFS_DBLK_PTR)dblk ;
+
+ if ( cur_dir != NULL ) {
+ req_size = (UINT16)(strsize( cur_dir ) ) ;
+ }
+
+ if ( sub_dir_name != NULL ) {
+ req_size += (UINT16)( strsize( sub_dir_name ) ) ;
+ }
+
+ if ( req_size < buf_req_size ) {
+ req_size = buf_req_size ;
+ }
+
+ path_q_elem = FS_AllocPathOrName( fsh, req_size ) ;
+ if ( path_q_elem == NULL ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ ddblk->full_name_ptr = path_q_elem ;
+
+ if ( cur_dir != NULL || sub_dir_name != NULL ) {
+
+ if ( cur_dir != NULL ) {
+ strcpy( path_q_elem->name, cur_dir ) ;
+ }
+
+ if ( sub_dir_name != NULL ) {
+
+ if ( path_q_elem->name[0] != TEXT('\0') ) {
+ strcat( path_q_elem->name, TEXT("\\") ) ;
+ }
+ strcat( path_q_elem->name, sub_dir_name ) ;
+ }
+
+ path_q_elem->name_size = strsize( path_q_elem->name );
+
+ }
+
+ return ret_val ;
+}
+
+
+
+
+
+INT16 NTFS_SetupFileNameInFDB( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ CHAR_PTR fname,
+ UINT16 bufMinSize )
+{
+ INT16 ret_val = SUCCESS;
+ UINT16 minSize;
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk;
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+
+
+ if ( fname != NULL )
+ {
+ /* Need enough memory for name and terminator */
+ minSize = max( bufMinSize, strsize( fname ) + sizeof(CHAR) );
+ }
+ else
+ {
+ minSize = bufMinSize;
+ }
+
+
+ name_q_elem = FS_AllocPathOrName( fsh, minSize );
+
+ if ( name_q_elem == NULL )
+ {
+ return OUT_OF_MEMORY ;
+ }
+ else
+ {
+ strcpy( name_q_elem->name, fname );
+ name_q_elem->name_size = strsize( name_q_elem->name );
+ ddblk->full_name_ptr = name_q_elem ;
+ }
+
+
+ return ret_val ;
+}
+
+
+
+
+/**/
+/**
+
+ Name: NTFS_ReleaseBlk()
+
+ Description: This function releases any resources connected to a DBLK.
+ For this OS the only resource is the Path connected to the DDB
+
+ Modified: 5/18/1992 10:27:34
+
+ Returns: none
+
+**/
+VOID NTFS_ReleaseBlk(
+FSYS_HAND fsh,
+DBLK_PTR dblk )
+{
+ NTFS_DBLK_PTR ddblk ;
+
+ fsh ;
+
+ ddblk = (NTFS_DBLK_PTR)dblk ;
+
+ FS_ReleaseOSPathOrNameInDBLK( fsh, dblk ) ;
+
+ if ( ddblk->full_name_ptr != NULL ) {
+ if ( RemoveQueueElem( &fsh->in_use_name_q,
+ &ddblk->full_name_ptr->q ) == SUCCESS ) {
+
+ EnQueueElem( &fsh->avail_name_q,
+ &ddblk->full_name_ptr->q,
+ FALSE ) ;
+ }
+ ddblk->full_name_ptr = NULL ;
+ }
+}
+
+INT16 NTFS_DupBlk( FSYS_HAND fsh, DBLK_PTR db_org, DBLK_PTR db_dup )
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)db_org ;
+
+ *db_dup = *db_org ;
+
+ if ( FS_SetupOSPathOrNameInDBLK( fsh,
+ db_dup,
+ (BYTE_PTR)db_org->com.os_name->name,
+ db_org->com.os_name->name_size ) == SUCCESS ) {
+
+
+ return NTFS_SetupPathInDDB( fsh,
+ db_dup,
+ ddblk->full_name_ptr->name,
+ NULL,
+ ddblk->full_name_ptr->alloc_size ) ;
+ } else {
+
+ return (OUT_OF_MEMORY) ;
+ }
+
+}
+
diff --git a/private/utils/ntbackup/src/tgetspec.c b/private/utils/ntbackup/src/tgetspec.c
new file mode 100644
index 000000000..5c92f890f
--- /dev/null
+++ b/private/utils/ntbackup/src/tgetspec.c
@@ -0,0 +1,211 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tgetspec.c
+
+ Description: This file contains code to return DBLKS for the regestry
+ files. The object returned will be:
+ DDB -> <REGESTRY>
+
+
+ $Log: M:/LOGFILES/TGETSPEC.C_V $
+
+ Rev 1.10 04 Jan 1994 11:09:38 BARRY
+With the change in the calls for Mac name support, the pattern "*."
+no longer matches files with no extension (registry files). Fixed
+this problem by scanning all files and checking the names.
+
+
+ Rev 1.9 14 Jun 1993 18:12:22 BARRY
+Fixed last edit that required both backup/restore rights to backup registry
+
+ Rev 1.8 11 Jun 1993 14:21:36 BARRY
+Replace old PromptForBindery with new feature bits.
+
+ Rev 1.7 07 Dec 1992 14:17:02 STEVEN
+updates from msoft
+
+ Rev 1.6 10 Nov 1992 08:20:50 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.5 28 Oct 1992 10:30:42 STEVEN
+add registry support
+
+ Rev 1.4 24 Jul 1992 15:55:24 STEVEN
+fix warnings
+
+ Rev 1.2 27 May 1992 18:50:16 STEVEN
+registry api is not implemented
+
+ Rev 1.1 21 May 1992 16:45:18 STEVEN
+added support for special files
+
+ Rev 1.0 21 May 1992 13:51:22 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdmath.h"
+#include "msassert.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+
+/**/
+
+/**
+
+ Name: NTFS_GetSpecDBLKS()
+
+ Description: This function is used to return the control blocks for
+ the NTFS regestry. The CBLKs returned are:
+ DDB - <REGISTRY>
+
+ Modified: 5/21/1992 15:25:12
+
+ Returns: Error codes:
+ FS_NO_MORE
+ SUCCESS
+
+ Notes: We need to add code to exclude these files from regular
+ processing.
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 NTFS_GetSpecDBLKS( FSYS_HAND fsh,
+ DBLK_PTR dblk,
+ INT32 *index )
+{
+ INT16 ret_val = SUCCESS ;
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk;
+ GENERIC_DLE_PTR dle = fsh->attached_dle ;
+
+ // special files are now handled differently for NtBackup
+
+ return FS_NO_MORE ;
+
+
+ /* does this device have special files */
+ if ( DLE_HasFeatures( dle, DLE_FEAT_BKUP_SPECIAL_FILES ) == FALSE )
+ {
+ return FS_NO_MORE ;
+ }
+
+
+ switch ( (INT16)*index ) {
+
+ case 0:
+ case 1:
+ {
+ CHAR_PTR reg_path ;
+ CHAR_PTR path_ptr ;
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+ INT16 psize ;
+
+ *index = 2 ;
+
+ /* return DDB for system\config directory */
+ reg_path = NTFS_GetRegistryPath( dle ) ;
+
+ path_ptr = reg_path + strlen( dle->device_name ) + 1 ;
+
+ psize = strsize( path_ptr ) ;
+
+ name_q_elem = FS_AllocPathOrName( fsh, psize ) ;
+
+ if ( name_q_elem == NULL ) {
+ *index = 4 ;
+ ret_val = OUT_OF_MEMORY ;
+ break ;
+
+ }
+
+ ddblk->full_name_ptr = name_q_elem ;
+ ddblk->blk_type = DDB_ID ;
+
+ strcpy( ddblk->full_name_ptr ->name, path_ptr ) ;
+
+ ddblk->full_name_ptr->name_size = psize ;
+
+ ddblk->os_info_complete = FALSE ;
+
+ ret_val = NTFS_GetObjInfo( fsh, dblk ) ;
+
+ if ( ret_val != SUCCESS )
+ {
+ ret_val = FS_NO_MORE ;
+ *index = 4 ;
+ }
+ }
+ break ;
+
+ case 2:
+ {
+ CHAR_PTR sname = dle->info.ntfs->mac_name_syntax ? TEXT("*.*") : TEXT("*.");
+
+ *index = 3 ;
+
+ /* make sure current dir is registry dir */
+
+ if ( stricmp( NTFS_GetRegistryPath(dle) + strlen( dle->device_name ),
+ fsh->cur_dir ) )
+ {
+ ret_val = FS_NO_MORE ;
+ *index = 4 ;
+ }
+
+ ret_val = NTFS_FindFirst( fsh, dblk, sname, OBJECT_ALL ) ;
+
+ while ( ( ret_val == SUCCESS ) &&
+ (( dblk->blk_type != FDB_ID ) ||
+ ( strchr( ddblk->full_name_ptr->name, TEXT('.') ) != NULL )) )
+ {
+ ret_val = NTFS_FindNext( fsh, dblk ) ;
+ }
+
+ if ( ret_val != SUCCESS )
+ {
+ ret_val = FS_NO_MORE ;
+ *index = 4 ;
+ }
+ }
+ break ;
+
+ case 3:
+
+ /* return FS_FindNext( ) */
+ do
+ {
+ ret_val = NTFS_FindNext( fsh, dblk ) ;
+ }
+ while ( ( ret_val == SUCCESS ) &&
+ (( dblk->blk_type != FDB_ID ) ||
+ ( strchr( ddblk->full_name_ptr->name, TEXT('.') ) != NULL )) );
+
+ if ( ret_val != SUCCESS )
+ {
+ ret_val = FS_NO_MORE ;
+ *index = 4 ;
+ }
+ break ;
+
+ case 4:
+ default:
+ ret_val = FS_NO_MORE ;
+ break ;
+
+ }
+
+ return ret_val ;
+}
diff --git a/private/utils/ntbackup/src/timers.c b/private/utils/ntbackup/src/timers.c
new file mode 100644
index 000000000..48ad04939
--- /dev/null
+++ b/private/utils/ntbackup/src/timers.c
@@ -0,0 +1,511 @@
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: timers.c
+
+ Description: This file contains the functions for UI poll drive.
+
+ $Log: G:\UI\LOGFILES\TIMERS.C_V $
+
+ Rev 1.15.1.0 24 May 1994 12:22:12 Glenn
+Added frame window handle to set and kill timer.
+
+ Rev 1.15 28 Jul 1993 18:34:52 MARINA
+enable c++
+
+ Rev 1.14 18 May 1993 09:49:00 Aaron
+Fixed comments and return values for WM_InitTimer
+
+ Rev 1.13 18 Nov 1992 11:43:30 GLENN
+Increased the speed as an enhancement for the callers.
+
+ Rev 1.12 07 Oct 1992 15:11:36 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.11 04 Oct 1992 19:41:18 DAVEV
+Unicode Awk pass
+
+ Rev 1.10 17 Aug 1992 13:24:20 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.9 28 Jul 1992 14:45:26 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.8 29 May 1992 15:59:24 JOHNWT
+PCH updates
+
+ Rev 1.7 12 May 1992 21:21:20 MIKEP
+NT pass 1
+
+ Rev 1.6 11 Feb 1992 17:30:38 GLENN
+Fixed no prototype warning.
+
+ Rev 1.5 31 Jan 1992 15:04:24 GLENN
+Added reset logic to the deinit. Added mw to module-wide variables.
+
+ Rev 1.4 19 Dec 1991 15:24:20 GLENN
+Added windows.h
+
+ Rev 1.3 12 Dec 1991 17:08:12 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.2 02 Dec 1991 17:52:20 DAVEV
+16/32 bit Windows port changes
+
+ Rev 1.1 27 Nov 1991 12:11:12 GLENN
+Clean-up.
+
+ Rev 1.0 20 Nov 1991 19:32:38 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#define MAX_TIMERS 16 // Up to 16 -- the number of bits in a WORD
+#define ALL_TIMERS_USED 0xFFFF // All timers used bitmask
+
+typedef struct TIMERTABLE {
+
+ PF_VOID pfnCallBack;
+ INT nTimerLength;
+ INT nTimeRemaining;
+
+} TIMERTABLE;
+
+
+static TIMERTABLE TimerTable [ MAX_TIMERS ];
+
+static WORD mwwTimerMask;
+static INT mwnUsedTimers;
+static INT mwnUnusedTicks = 0;
+static HTIMER mwhMasterTimerInst = 0;
+static BOOL mwfTimerInUse = FALSE;
+static INT mwnBaseFrequency = TIMER_BASE;
+static INT mwnMasterFrequency = TIMER_FREQUENCY;
+static WNDPROC fnTimerInst = (WNDPROC)NULL;
+
+static FARPROC pfnTimerCallBack ;
+
+// FUNCTION PROTOTYPES
+
+static BOOL WM_ChangeMasterFrequency ( INT );
+static INT WM_CalculateFrequency ( INT );
+static UINT APIENTRY WM_TimerFunct ( HWND, MSGID, MP1, MP2 );
+
+/******************************************************************************
+
+ Name: WM_InitTimer()
+
+ Description:
+
+ Returns: TRUE if successful, FALSE otherwise
+
+******************************************************************************/
+
+BOOL WM_InitTimer ( VOID )
+
+{
+ INT i;
+
+ if ( mwhMasterTimerInst ) {
+ return FALSE;
+ }
+
+ // Clear out the timer in use flag, the timer mask and callback table.
+
+ mwfTimerInUse = FALSE;
+ mwwTimerMask = 0;
+ mwnUsedTimers = 0;
+
+ for ( i = 0; i < MAX_TIMERS; i++ ) {
+
+ TimerTable[i].pfnCallBack = (PF_VOID)0;
+ TimerTable[i].nTimerLength = 0;
+ TimerTable[i].nTimeRemaining = 0;
+ }
+
+ // Create a timer call-back function instance if one has not been created.
+
+ if ( ! fnTimerInst ) {
+
+ fnTimerInst = (WNDPROC)MakeProcInstance ( (FARPROC)WM_TimerFunct, ghInst );
+ }
+
+ // Start the master timer.
+
+ mwhMasterTimerInst = SetTimer ( ghWndFrame,
+ (INT)1,
+ mwnMasterFrequency,
+ (TIMERPROC)fnTimerInst );
+
+ if ( ! mwhMasterTimerInst ) {
+
+ mwwTimerMask = ALL_TIMERS_USED;
+ }
+
+ return (BOOL)( mwwTimerMask == 0 );
+
+} /* end WM_InitTimer() */
+
+
+/******************************************************************************
+
+ Name: WM_ChangeMasterFrequency()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+static BOOL WM_ChangeMasterFrequency (
+
+INT nFrequency ) // I - the new frequency
+
+{
+ INT i;
+
+ if ( nFrequency == mwnMasterFrequency ) {
+ return TRUE;
+ }
+
+ mwfTimerInUse = TRUE;
+
+ for ( i = 0; i < MAX_TIMERS; i++ ) {
+
+ if ( TimerTable[i].pfnCallBack ) {
+
+ // Reset the values based on the new frequency.
+
+ TimerTable[i].nTimerLength = 0;
+ TimerTable[i].nTimeRemaining = 0;
+ }
+ }
+
+ // Create a timer call-back function instance if one has not been created.
+
+ if ( ! fnTimerInst ) {
+
+ fnTimerInst = (WNDPROC)MakeProcInstance ( (FARPROC)WM_TimerFunct, ghInst );
+ }
+
+ mwnMasterFrequency = nFrequency;
+
+ // Kill the old and start an the new master timer.
+
+ KillTimer ( ghWndFrame, mwhMasterTimerInst );
+
+ mwhMasterTimerInst = SetTimer ( ghWndFrame, (INT)1, mwnMasterFrequency, (TIMERPROC)fnTimerInst );
+
+ if ( ! mwhMasterTimerInst ) {
+
+ mwwTimerMask = ALL_TIMERS_USED;
+ }
+
+ return (BOOL)( ! mwhMasterTimerInst );
+
+} /* end WM_ChangeMasterFrequency() */
+
+
+/******************************************************************************
+
+ Name: WM_DeinitTimer()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+BOOL WM_DeinitTimer ( VOID )
+
+{
+ INT i;
+ BOOL fResult;
+
+ // We can't deinit if there is no timer instance.
+
+ if ( ! mwhMasterTimerInst ) {
+ return FAILURE;
+ }
+
+ // Set the timer in use flag and clear out the timer mask and
+ // callback table.
+
+ mwfTimerInUse = TRUE;
+ mwwTimerMask = 0;
+ mwnUsedTimers = 0;
+
+ for ( i = 0; i < MAX_TIMERS; i++ ) {
+
+ TimerTable[i].pfnCallBack = (PF_VOID)0;
+ TimerTable[i].nTimerLength = 0;
+ TimerTable[i].nTimeRemaining = 0;
+ }
+
+ // Kill the timer.
+
+ fResult = ! KillTimer ( ghWndFrame, mwhMasterTimerInst );
+
+ mwhMasterTimerInst = 0;
+
+ return fResult;
+
+} /* end WM_DeinitTimer() */
+
+
+/******************************************************************************
+
+ Name: WM_HookTimer()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+HTIMER WM_HookTimer (
+
+PF_VOID pfnCallBack,
+INT nFrequency )
+
+{
+ WORD wTempMask = 1;
+ UINT i;
+
+ // If no timer, create one.
+
+ if ( ! mwwTimerMask ) {
+ WM_InitTimer ();
+ }
+
+ nFrequency = WM_CalculateFrequency ( nFrequency );
+
+ if ( mwwTimerMask == ALL_TIMERS_USED ) {
+
+ return INVALID_TIMER_HANDLE;
+ }
+
+ // Stuff the table with the callback function and the number of seconds.
+
+ for ( i = 0; i < MAX_TIMERS; i++ ) {
+
+ // If there is an available timer space, hook it.
+
+ if ( ! ( wTempMask & mwwTimerMask ) ) {
+
+ TimerTable[i].pfnCallBack = pfnCallBack;
+ TimerTable[i].nTimerLength = TimerTable[i].nTimeRemaining = nFrequency;
+ mwnUsedTimers++;
+ break;
+ }
+
+ wTempMask <<= 1;
+ }
+
+ // Set the appropriate bit in the bitmask.
+
+ mwwTimerMask |= wTempMask;
+
+ return (HTIMER)i;
+
+} /* end WM_HookTimer() */
+
+
+/******************************************************************************
+
+ Name: WM_SetTimerFrequency()
+
+ Description: Changes the specified timers frequency.
+
+ Returns: The timer's old frequency.
+
+******************************************************************************/
+
+INT WM_SetTimerFrequency (
+
+HTIMER hTimer, // I - timer handle
+INT nFrequency ) // I - the new frequency
+
+{
+ INT nOldFrequency;
+
+ // If it is an invalid timer handle, bug out.
+
+ if ( hTimer >= MAX_TIMERS || ! ( ( 1 << hTimer ) & mwwTimerMask ) ) {
+ return 0;
+ }
+
+ nOldFrequency = TimerTable[hTimer].nTimerLength;
+
+ mwfTimerInUse = TRUE;
+
+ nFrequency = WM_CalculateFrequency ( nFrequency );
+
+ TimerTable[hTimer].nTimerLength = TimerTable[hTimer].nTimeRemaining = nFrequency;
+
+ mwfTimerInUse = FALSE;
+
+ // Figure out the original callers frequency.
+
+ if ( nOldFrequency < ONE_SECOND ) {
+ nOldFrequency = ( -nOldFrequency );
+ }
+ else {
+ nOldFrequency = nOldFrequency / ONE_SECOND;
+ }
+
+ return nOldFrequency;
+
+} /* end WM_SetTimerFrequency() */
+
+
+/******************************************************************************
+
+ Name: WM_CalculateFrequency()
+
+ Description: Changes the specified timers frequency.
+
+ Returns: The timer's old frequency.
+
+******************************************************************************/
+
+static INT WM_CalculateFrequency (
+
+INT nFrequency ) // I - the new frequency
+
+{
+ if ( ! nFrequency ) {
+ nFrequency++;
+ }
+
+ if ( nFrequency > 0 ) {
+ nFrequency *= ONE_SECOND;
+ }
+ else {
+ nFrequency = abs( nFrequency );
+ }
+
+ return nFrequency;
+
+} /* end WM_CalculateFrequency() */
+
+
+/******************************************************************************
+
+ Name: WM_UnhookTimer()
+
+ Description:
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+BOOL WM_UnhookTimer (
+
+HTIMER i )
+
+{
+ WORD wTempMask = 1;
+
+ // Bug out, if there is no such timer.
+
+ if ( i >= MAX_TIMERS ) {
+ return TRUE;
+ }
+
+ TimerTable[i].pfnCallBack = (PF_VOID)0;
+ TimerTable[i].nTimerLength = 0;
+ TimerTable[i].nTimeRemaining = 0;
+ mwnUsedTimers--;
+
+ // Clear the appropriate bit in the bitmask.
+
+ mwwTimerMask &= ~( wTempMask <<= i );
+
+ return FALSE;
+
+} /* end WM_UnhookTimer() */
+
+
+
+
+// NEVER CALLED DIRECTLY FROM THE APPLICATION,
+// CALLED INTERNALLY AS A FUNCTION INSTANCE BY WINDOWS.
+
+static UINT APIENTRY WM_TimerFunct (
+
+HWND hWnd, // I - NOT USED - REQUIRED FOR WINDOWS
+MSGID msg, // I - NOT USED - REQUIRED FOR WINDOWS
+MP1 mp1, // I - NOT USED - REQUIRED FOR WINDOWS
+MP2 mp2 ) // I - first parameter - contains the time
+
+{
+ DWORD dwTime = (DWORD) mp2;
+
+ UNREFERENCED_PARAMETER ( hWnd );
+ UNREFERENCED_PARAMETER ( msg );
+ UNREFERENCED_PARAMETER ( mp1 );
+
+ // Make sure that we are not already in this timer function.
+
+ if ( mwfTimerInUse ) {
+ return 0;
+ }
+
+ mwfTimerInUse = TRUE;
+
+ // Determine if there is a function to call back.
+
+ if ( mwwTimerMask ) {
+
+ // The following is done for speed.
+
+ register INT i;
+ register WORD wTempMask = mwwTimerMask;
+
+ for ( i = 0; wTempMask; i++ ) {
+
+ if ( wTempMask & 0x01 ) {
+
+ if ( --TimerTable[i].nTimeRemaining <= 0 ) {
+
+ pfnTimerCallBack = (FARPROC)(TimerTable[i].pfnCallBack);
+
+ pfnTimerCallBack ( );
+
+ TimerTable[i].nTimeRemaining = TimerTable[i].nTimerLength;
+ }
+ }
+
+ wTempMask >>= 1;
+ }
+
+ }
+ else {
+
+ // If we have had a timer going without a hook for more than
+ // 10 seconds, we probably don't need it.
+
+ mwnUnusedTicks++;
+
+ if ( mwnUnusedTicks > ( mwnMasterFrequency * TEN_SECONDS ) ) {
+
+ WM_DeinitTimer ();
+ mwnUnusedTicks = 0;
+ return 0;
+ }
+
+ }
+
+ mwfTimerInUse = FALSE;
+
+ return 0;
+
+} /* end WM_TimerFunct() */
diff --git a/private/utils/ntbackup/src/tinitfs.c b/private/utils/ntbackup/src/tinitfs.c
new file mode 100644
index 000000000..136014698
--- /dev/null
+++ b/private/utils/ntbackup/src/tinitfs.c
@@ -0,0 +1,973 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tinitfs.c
+
+ Description: This file contains code to add NTFS dles to the
+ drive list.
+
+ $Log: N:/LOGFILES/TINITFS.C_V $
+
+ Rev 1.56.1.13 16 Jun 1994 15:40:52 STEVEN
+setup CDFS drives as readonly
+
+ Rev 1.56.1.12 26 Apr 1994 19:02:48 STEVEN
+fix floppy drive problem
+
+ Rev 1.56.1.11 20 Apr 1994 12:32:16 GREGG
+Fixed memory leak.
+
+ Rev 1.56.1.10 08 Feb 1994 18:52:04 STEVEN
+trust the fsize returned from the FS
+
+ Rev 1.56.1.9 01 Feb 1994 12:28:30 STEVEN
+when checking flopies share the open
+
+ Rev 1.56.1.8 31 Jan 1994 12:22:40 BARRY
+Make CDROMs and net drives work
+
+ Rev 1.56.1.7 25 Jan 1994 19:46:24 STEVEN
+add support for removeable media
+
+ Rev 1.56.1.6 20 Jan 1994 10:02:46 BARRY
+Change thread wait from sem to thread handle; increased wait time
+
+ Rev 1.56.1.5 19 Jan 1994 17:08:32 BARRY
+Add CDROM DLEs
+
+ Rev 1.56.1.4 14 Jan 1994 16:00:22 BARRY
+Create DLEs for removable drives
+
+ Rev 1.56.1.3 04 Jan 1994 11:04:52 BARRY
+Use flags from OS to set up feature bits where possible. Create DLEs
+for CD-ROM drives. Added Init/Deinit functions that set up the temp
+file name stuff.
+
+ Rev 1.56.1.2 02 Dec 1993 00:47:34 GREGG
+Barry's fixes for NTFS_SupportMacSyntax.
+
+ Rev 1.56.1.1 04 Nov 1993 16:04:08 STEVEN
+changes from WA
+
+ Rev 1.56 29 Sep 1993 18:26:06 BARRY
+Unicode fix
+
+ Rev 1.55 24 Aug 1993 19:42:38 STEVEN
+fix no default drive bug
+
+ Rev 1.54 18 Aug 1993 15:03:06 STEVEN
+fix unicode bug
+
+ Rev 1.53 12 Aug 1993 16:24:20 BARRY
+Make a DLE even if access is denied
+
+ Rev 1.52 04 Aug 1993 18:51:34 BARRY
+#ifdef the dle tossing based on product.
+
+ Rev 1.51 26 Jul 1993 17:05:04 STEVEN
+fixe restore active file with registry
+
+ Rev 1.50 19 Jul 1993 10:17:30 BARRY
+The UI wants a DLE thrown away even if BSDs are pointing to it.
+
+ Rev 1.49 16 Jun 1993 10:47:14 CARLS
+force the current directory to upper case
+
+ Rev 1.48 11 Jun 1993 14:20:08 BARRY
+Separated backup user and restore user into two separate flags.
+
+ Rev 1.47 07 Jun 1993 14:54:58 STEVEN
+need to assert the restore priv
+
+ Rev 1.46 03 Jun 1993 18:58:20 BARRY
+Need not have both backup and restore priviliges to backup registry.
+
+ Rev 1.45 03 Jun 1993 14:51:18 STEVEN
+added reconition for HPFS386
+
+ Rev 1.44 20 May 1993 17:22:32 BARRY
+[Steve's change] Only get user name once.
+
+ Rev 1.43 15 May 1993 16:30:14 BARRY
+Don't throw away DLEs that have attach/bsd counts.
+
+ Rev 1.42 14 May 1993 16:08:46 BARRY
+Assume that all non-FAT drives are case preserving.
+
+ Rev 1.41 16 Apr 1993 13:44:40 MIKEP
+add case feature bit
+
+ Rev 1.40 04 Apr 1993 17:09:24 BARRY
+Fixed default DLE bug.
+
+ Rev 1.39 29 Mar 1993 14:43:36 TIMN
+Added code to assign default DLE
+
+ Rev 1.38 24 Mar 1993 11:27:58 STEVEN
+if username is bad use no name
+
+ Rev 1.37 17 Mar 1993 16:03:30 BARRY
+Removed IsDriveWriteable code.
+
+ Rev 1.36 14 Mar 1993 18:30:22 BARRY
+Fix warning.
+
+ Rev 1.35 11 Mar 1993 14:02:56 BARRY
+Put in temporary kludge to determine if device is read-only.
+
+ Rev 1.34 26 Feb 1993 10:43:30 STEVEN
+need to set access date feature bit
+
+ Rev 1.33 27 Jan 1993 13:51:06 STEVEN
+updates from msoft
+
+ Rev 1.32 15 Jan 1993 13:19:18 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.31 14 Jan 1993 13:33:48 STEVEN
+added stream_id to error message
+
+ Rev 1.30 30 Dec 1992 11:04:42 STEVEN
+fixed registry support to check for backup_user priviladge.
+
+ Rev 1.29 29 Dec 1992 17:21:36 STEVEN
+fix multi-thread so it calls ThreadSwitch
+
+ Rev 1.28 09 Dec 1992 14:19:28 STEVEN
+fix user_name_size
+
+ Rev 1.27 16 Nov 1992 13:52:54 STEVEN
+more unicode fixes
+
+ Rev 1.26 13 Nov 1992 15:57:56 STEVEN
+fixes for unicode
+
+ Rev 1.25 11 Nov 1992 22:26:38 GREGG
+Unicodeized literals.
+
+ Rev 1.24 04 Nov 1992 17:59:04 BARRY
+Added fs_name to dle.
+
+ Rev 1.23 21 Oct 1992 12:40:56 STEVEN
+setup feature bits
+
+ Rev 1.22 20 Oct 1992 14:32:44 STEVEN
+Registry path should include drive
+
+ Rev 1.21 07 Oct 1992 14:01:06 STEVEN
+added registry stuff
+
+ Rev 1.20 05 Oct 1992 15:04:40 STEVEN
+add registry call to NT's initfsys
+
+ Rev 1.19 05 Oct 1992 13:26:44 DAVEV
+Unicode strlen verification
+
+ Rev 1.18 08 Sep 1992 16:09:00 STEVEN
+dev_name for Net call can not have \
+
+ Rev 1.17 03 Sep 1992 17:06:30 STEVEN
+add support for volume name
+
+ Rev 1.15 20 Aug 1992 13:53:30 BURT
+fix warnings
+
+ Rev 1.14 17 Aug 1992 15:46:44 STEVEN
+fix warnings
+
+ Rev 1.13 23 Jul 1992 16:43:18 STEVEN
+fix warnings
+
+ Rev 1.12 23 Jul 1992 12:36:42 STEVEN
+fix warnings
+
+ Rev 1.11 21 Jul 1992 14:25:32 STEVEN
+added support for user name in VCB
+
+ Rev 1.10 16 Jul 1992 11:26:46 STEVEN
+fix typo
+
+ Rev 1.9 16 Jul 1992 08:58:52 STEVEN
+fix default drive code
+
+ Rev 1.8 09 Jul 1992 13:58:20 STEVEN
+BE_Unicode updates
+
+ Rev 1.7 02 Jul 1992 10:32:38 MIKEP
+add remote bit to dle features
+
+ Rev 1.6 25 Jun 1992 11:24:12 STEVEN
+do not support CDROMS
+
+ Rev 1.5 12 Jun 1992 15:18:46 STEVEN
+remove floppies
+
+ Rev 1.4 09 Jun 1992 14:54:38 BURT
+Use changes made in Redmond
+
+ Rev 1.3 21 May 1992 13:50:54 STEVEN
+more long path stuff
+
+ Rev 1.2 05 Feb 1992 15:47:44 STEVEN
+added support for FindHandle Queue
+
+ Rev 1.1 23 Jan 1992 13:18:30 STEVEN
+
+ Rev 1.0 17 Jan 1992 17:50:12 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <winioctl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdwcs.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfs_fs.h"
+#include "gen_fs.h"
+
+BOOLEAN NTFS_SupportMacSyntax( GENERIC_DLE_PTR dle );
+
+static VOID AddNTFS_DLE( DLE_HAND hand,
+ CHAR drive,
+ UINT32 type,
+ BOOLEAN backup_user,
+ BOOLEAN restore_user,
+ GENERIC_DLE_PTR *current_dle );
+
+static VOID RemoveNTFS_DLE( DLE_HAND hand, CHAR drive ) ;
+
+BOOL MAYN_GetUserName (
+ LPSTR *pUser,
+ LPDWORD pcbUser
+ );
+
+typedef struct THREAD_PARMS {
+ DLE_HAND dle_hand;
+} THREAD_PARMS, *THREAD_PARMS_PTR ;
+
+DWORD NTFS_ThreadFindDrives( THREAD_PARMS_PTR thread_parms_ptr ) ;
+
+#define MAX_NAME_SIZE 200
+
+/**/
+/**
+
+ Name: AddDLEsForNTFS()
+
+ Description: This function creates a DLE for each mapped NTFS drive.
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+ Declaration:
+**/
+INT16 NTFS_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask )
+{
+ HANDLE hThread ;
+ DWORD pthread_id ;
+ THREAD_PARMS thread_parms ;
+
+ (VOID)cfg ;
+ (VOID)fsys_mask ;
+
+ thread_parms.dle_hand = hand ;
+
+ hThread = CreateThread( NULL,
+ 0,
+ NTFS_ThreadFindDrives,
+ &thread_parms,
+ 0,
+ &pthread_id ) ;
+
+ if ( hThread != NULL )
+ {
+ while ( WaitForSingleObject( hThread, 100 ) == WAIT_TIMEOUT )
+ {
+ ThreadSwitch( ) ;
+ }
+ CloseHandle( hThread ) ;
+ }
+ else
+ {
+ NTFS_ThreadFindDrives( &thread_parms ) ;
+ }
+ return SUCCESS ;
+}
+
+DWORD NTFS_ThreadFindDrives( THREAD_PARMS_PTR thread_parms_ptr )
+{
+ CHAR path[]=TEXT("C:\\") ;
+ CHAR drive ;
+ UINT32 type ;
+ DLE_HAND hand ;
+ LONG prev_val ;
+ BOOLEAN backup_user;
+ BOOLEAN restore_user;
+ CHAR cwd[ MAX_PATH ] ; // current working directory buffer
+ DWORD cwdSize = MAX_PATH ; // size of cwd data less '\0'
+ GENERIC_DLE_PTR pCurrentDLE ; // ptr to current DLE
+
+ hand = thread_parms_ptr->dle_hand ;
+
+ backup_user = (REG_AssertBackupPrivilege() == SUCCESS);
+ restore_user = (REG_AssertRestorePrivilege() == SUCCESS);
+
+ /* get the current working drive */
+ cwdSize = GetCurrentDirectory( cwdSize, cwd ) ;
+
+ if ( cwdSize == 0 ) {
+ // what to do if we couldn't get the drive letter
+ cwd[ 0 ] = TEXT('C') ;
+ } else {
+ strupr( cwd ) ;
+ }
+
+
+ for ( drive = TEXT('A'); drive <= TEXT('Z'); drive++ ) {
+
+ *path = drive ;
+ type = GetDriveType( path ) ;
+
+ if ( type != 1 ) { /* 1 specifies does not exist */
+ AddNTFS_DLE( hand,
+ drive,
+ type,
+ backup_user,
+ restore_user,
+ &pCurrentDLE );
+
+ // is this dle the default one
+ if ( ( pCurrentDLE != NULL ) && ( drive == cwd[ 0 ] ) ) {
+ hand->default_drv = pCurrentDLE ;
+ } else if( hand->default_drv == NULL ) {
+ hand->default_drv = pCurrentDLE ;
+ }
+ } else {
+
+ RemoveNTFS_DLE( hand, drive ) ;
+ }
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: AddDLEsForNTFS()
+
+ Description: This function creates a DLE for each mapped NTFS drive.
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+ Declaration:
+**/
+static VOID AddNTFS_DLE(
+DLE_HAND hand, /* I - Handle to DLE list */
+CHAR drive, /* I - drive letter for dle */
+UINT32 type,
+BOOLEAN backup_user,
+BOOLEAN restore_user,
+GENERIC_DLE_PTR *pCurrentDLE /* O - current dle */ )
+{
+ GENERIC_DLE_PTR dle ;
+ static LPSTR user_name = NULL ;
+ INT user_name_size = MAX_NAME_SIZE ;
+ CHAR machine[ MAX_NAME_SIZE ] = { TEXT('\0') };
+
+ CHAR vol_name[MAX_NAME_SIZE] = {TEXT('\0')} ;
+ CHAR fs_name[MAX_NAME_SIZE] = {TEXT('\0')} ;
+ CHAR dev_name[] = TEXT("C:\0");
+ UINT32 fsize ;
+ UINT32 sflags ;
+ BOOLEAN remote_flag;
+ DWORD name_size ;
+ UINT errorMode;
+
+ *pCurrentDLE = NULL ;
+
+ remote_flag = (type == DRIVE_REMOTE);
+ errorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
+
+ switch( type ) {
+
+ // This is a kludge to allow Bernoullis, etc., but discard
+ // floppies.
+ case DRIVE_REMOVABLE:
+ case DRIVE_CDROM:
+ {
+ INT status ;
+ CHAR buffer[200] ;
+ HANDLE deviceHandle ;
+ DWORD dummy;
+
+ strcpy( buffer, TEXT("\\\\.\\C:") ) ;
+ buffer[4] = drive ;
+
+ deviceHandle = CreateFile( buffer,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL ) ;
+
+ status = DeviceIoControl( deviceHandle, IOCTL_DISK_CHECK_VERIFY,
+ NULL, 0, NULL, 0, &dummy, NULL ) ;
+
+
+ CloseHandle( deviceHandle );
+
+
+ if ( !status ) {
+ RemoveNTFS_DLE( hand, drive ) ;
+ errorMode = SetErrorMode(errorMode);
+ return ;
+ }
+
+ }
+
+ case DRIVE_REMOTE:
+ case DRIVE_FIXED:
+ case DRIVE_RAMDISK:
+ dev_name[0] = drive ;
+
+ if ( DLE_FindByName( hand, dev_name, ANY_DRIVE_TYPE, &dle ) == SUCCESS ) {
+
+ if ( dle->attach_count ) {
+ errorMode = SetErrorMode(errorMode);
+ return ;
+ } else {
+ NTFS_RemoveDLE( dle ) ;
+ }
+ }
+
+ dev_name[2] = TEXT('\\') ;
+
+ if ( GetVolumeInformation( dev_name,
+ vol_name,
+ MAX_NAME_SIZE,
+ NULL,
+ &fsize,
+ &sflags,
+ fs_name,
+ MAX_NAME_SIZE ) == FALSE )
+ {
+ DWORD error = GetLastError( );
+
+ if ( error == ERROR_ACCESS_DENIED )
+ {
+ /*
+ * Kludge so the UI can show a device, even though
+ * they'll never be able to do anything with it.
+ */
+
+ fsize = 12;
+ sflags = 0;
+ vol_name[0] = TEXT( '\0' );
+ strcpy( fs_name, TEXT("FAT") );
+
+ }
+ else
+ {
+ errorMode = SetErrorMode(errorMode);
+ return ;
+ }
+ }
+
+ if ( !strcmp( fs_name, TEXT("RAW") ) ) {
+ errorMode = SetErrorMode(errorMode);
+ return ;
+ }
+
+ if ( remote_flag ) {
+ name_size = MAX_NAME_SIZE ;
+
+ dev_name[2] = TEXT('\0') ;
+ if ( WNetGetConnection( dev_name,
+ vol_name,
+ (LPDWORD)&name_size ) ) {
+
+ vol_name[0] = TEXT('\0') ;
+ } else {
+
+ CHAR *s ;
+
+ strcpy( machine, vol_name );
+ s = machine;
+ s += 2;
+ while ( *s && *s != TEXT('\\') ) s++;
+ *s = TEXT( '\0' );
+ }
+ }
+ break ;
+
+ default:
+ errorMode = SetErrorMode(errorMode);
+ return ;
+ }
+
+ errorMode = SetErrorMode(errorMode);
+
+ // Make a string "NtWins/Kevinp"
+
+ if ( user_name || MAYN_GetUserName( (LPSTR*)&user_name, (LPDWORD)&user_name_size ) ) {
+
+ user_name_size = strsize( user_name ) ;
+
+ } else {
+ user_name_size = sizeof(CHAR) ;
+ user_name = TEXT("\0") ;
+ }
+
+ /* Allocate space for DLE and device_name string */
+
+ dle = calloc ( 1, sizeof( GENERIC_DLE ) +
+ sizeof( struct LOCAL_NTFS_DRV_DLE_INFO ) +
+ user_name_size ) ;
+
+ if ( dle != NULL ) {
+
+ dle->device_name = calloc( 4, sizeof(CHAR ) ) ;
+
+ if ( dle->device_name == NULL ) {
+ free( dle ) ;
+ dle = NULL ;
+
+ } else {
+ dle->info.ntfs = (LOCAL_NTFS_DRV_DLE_INFO_PTR)(dle + 1) ;
+ dle->info.ntfs->registry_path_size = MAX_NAME_SIZE * sizeof(CHAR) ;
+ dle->info.ntfs->registry_path = calloc( 1,
+ dle->info.ntfs->registry_path_size ) ;
+
+ if ( dle->info.ntfs->registry_path == NULL ) {
+ free( dle->device_name ) ;
+ free( dle ) ;
+ dle = NULL ;
+
+ }
+ }
+ }
+
+ if ( dle != NULL ) {
+
+ /* Since memory was allocated with calloc, it is already */
+ /* initialized to zero. Therefore initializations to zero */
+ /* are not necessary. */
+
+ InitQElem( &(dle->q) ) ;
+ dle->handle = hand ;
+ /* dle->parent = NULL ; */
+ dle->type = LOCAL_NTFS_DRV ;
+ dle->path_delim = TEXT('\\') ;
+ /* dle->pswd_required = FALSE */
+ /* dle->pswd_saved = FALSE ; */
+ /* dle->attach_count = 0 ; */
+ /* dle->bsd_use_count = 0 ; */
+ /* dle->dynamic_info = FALSE ; */
+ dle->device_name[0] = drive ;
+ dle->device_name[1] = TEXT(':') ;
+ /* dle->device_name[2] = TEXT('\0'); */
+
+ dle->feature_bits = DLE_FEAT_MAPPED_DRIVE ;
+
+ if ( remote_flag ) {
+ dle->feature_bits |= DLE_FEAT_REMOTE_DRIVE;
+ }
+
+ dle->device_name_leng = strsize( dle->device_name ) ; // 8/20/92 BBB
+
+ if ( *vol_name != TEXT('\0') ) {
+ dle->info.ntfs->volume_label = calloc( 1, strsize(vol_name) ) ;
+ }
+
+ if ( dle->info.ntfs->volume_label != NULL ) {
+ strcpy (dle->info.ntfs->volume_label, vol_name ) ;
+ }
+
+ if ( (dle->info.ntfs->fs_name = calloc( 1, strsize( fs_name ))) != NULL )
+ {
+ strcpy( dle->info.ntfs->fs_name, fs_name );
+ }
+
+ dle->info.ntfs->fname_leng = (UINT16)fsize ;
+ dle->info.ntfs->vol_flags = sflags ;
+
+
+ /*
+ * The sflags we got from the GetVolumeInfo call above
+ * tell us a little about the FS. Namely, if it's case
+ * preserving, if it's case sensitive, and if it supports
+ * Unicode.
+ */
+
+ if ( strcmp( fs_name, TEXT("FAT") ) ) { // force FAT to not case preserved
+
+ dle->feature_bits |= (sflags & FS_CASE_IS_PRESERVED)
+ ? DLE_FEAT_CASE_PRESERVING
+ : 0;
+ }
+
+ dle->feature_bits |= (sflags & FS_CASE_SENSITIVE)
+ ? DLE_FEAT_CASE_SENSITIVE
+ : 0;
+
+ dle->feature_bits |= (sflags & FS_UNICODE_STORED_ON_DISK)
+ ? DLE_FEAT_UNICODE_NAMES
+ : 0;
+
+ if ( !strcmp( fs_name, TEXT("NTFS") ) )
+ {
+ dle->feature_bits |= DLE_FEAT_ACCESS_DATE |
+ DLE_FEAT_DATA_SECURITY;
+ }
+ else if ( !strcmp( fs_name, TEXT("HPFS") ) ||
+ !strcmp( fs_name, TEXT("HPFS386") ) )
+ {
+ dle->feature_bits |= DLE_FEAT_ACCESS_DATE;
+ }
+
+ dle->info.ntfs->drive = dle->device_name[0] ;
+
+ strcpy( dle->info.ntfs->user_name, user_name ) ;
+
+ dle->user_name = dle->info.ntfs->user_name ;
+ dle->user_name_leng = strsize( dle->info.ntfs->user_name ) ;
+ if ( dle->user_name == TEXT('\0') ) {
+ dle->user_name_leng = 0 ;
+ }
+
+ strcpy( dle->info.ntfs->registry_path, dle->device_name ) ;
+ dle->info.ntfs->registry_path_size -= strsize( dle->device_name ) ;
+ REG_GetRegistryPath( machine,
+ drive,
+ dle->info.ntfs->registry_path + strlen( dle->device_name ),
+ &(dle->info.ntfs->registry_path_size) ) ;
+
+ if ( strcmp( fs_name, TEXT("CDFS") ) ) { /* CDFS drives are not writable */
+ dle->dle_writeable = TRUE;
+ }
+
+ dle->info.ntfs->LastSysRegPath = NULL ;
+
+ if ( dle->info.ntfs->registry_path_size != 0 ) {
+
+ if ( backup_user ) {
+ dle->feature_bits |= DLE_FEAT_BKUP_SPECIAL_FILES ;
+ }
+
+ if ( restore_user ) {
+ dle->feature_bits |= DLE_FEAT_REST_SPECIAL_FILES ;
+ }
+
+ dle->info.ntfs->registry_path_size = strsize( dle->info.ntfs->registry_path ) ;
+ } else {
+ free( dle->info.ntfs->registry_path ) ;
+ dle->info.ntfs->registry_path = NULL ;
+ dle->info.ntfs->registry_path_size = 0 ;
+ }
+
+ DLE_QueueInsert( hand, dle ) ;
+
+ dle->info.ntfs->mac_name_syntax = NTFS_SupportMacSyntax( dle ) ;
+
+ }
+
+ /* assign current dle */
+ *pCurrentDLE = dle ;
+
+}
+
+static VOID RemoveNTFS_DLE(
+DLE_HAND hand, /* I - Handle to DLE list */
+CHAR drive) /* I - drive letter for dle */
+{
+ GENERIC_DLE_PTR dle ;
+ CHAR dev_name[] = { TEXT('A'), TEXT(':'), TEXT('\0') } ;
+
+ dev_name[0] = drive ;
+
+ DLE_FindByName( hand, dev_name, ANY_DRIVE_TYPE, &dle ) ;
+
+ if ( dle != NULL )
+ {
+ msassert( dle->parent == NULL ) ;
+
+ /* Don't remove DLEs that are busy. */
+ if ( dle->attach_count == 0 )
+ {
+ RemoveQueueElem( &(dle->handle->q_hdr), &(dle->q) ) ;
+
+ free( dle->device_name ) ;
+ free( dle->info.ntfs->registry_path ) ;
+ free( dle->info.ntfs->volume_label ) ;
+ free( dle->info.ntfs->fs_name );
+ free( dle ) ;
+ }
+ }
+
+}
+/**/
+/**
+
+ Name: NTFS_RemoveDLE()
+
+ Description: This function removes the specified DLE ;
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+**/
+VOID NTFS_RemoveDLE( GENERIC_DLE_PTR dle )
+{
+
+ free( dle->device_name ) ;
+ free( dle->info.ntfs->registry_path ) ;
+ free( dle->info.ntfs->volume_label ) ;
+ free( dle->info.ntfs->fs_name );
+
+ GEN_RemoveDLE( dle );
+}
+
+
+BOOL
+MAYN_GetUserName (
+ LPSTR *pUser,
+ LPDWORD pcbUser
+ )
+
+/*++
+
+Routine Description:
+
+ This returns the name of the user currently being impersonated.
+
+Arguments:
+
+ pBuffer - Points to the buffer that is to receive the
+ null-terminated character string containing the user name.
+
+ pcbBuffer - Specifies the maximum size (in characters) of the buffer. This
+ value should be set to at least MAX_USERNAME_LENGTH to allow
+ sufficient room in the buffer for the computer name. The length
+ of the string is returned in pcbBuffer.
+
+Return Value:
+
+ TRUE on success, FALSE on failure.
+
+
+--*/
+{
+ HANDLE TokenHandle;
+ DWORD cbNeeded;
+ TOKEN_USER *pUserToken;
+ BOOL ReturnValue=FALSE;
+ SID_NAME_USE SidNameUse;
+ DWORD cbName ;
+ DWORD cbDomain ;
+ LPSTR pName ;
+ LPSTR pDomain ;
+
+ if (!OpenThreadToken(GetCurrentThread(),
+ TOKEN_QUERY,
+ FALSE,
+ &TokenHandle)) {
+
+ if (GetLastError() == ERROR_NO_TOKEN) {
+
+ // This means we are not impersonating anybody.
+ // Instead, lets get the token out of the process.
+
+ if (!OpenProcessToken(GetCurrentProcess(),
+ TOKEN_QUERY,
+ &TokenHandle)) {
+
+ return FALSE;
+ }
+
+ } else
+
+ return FALSE;
+ }
+
+ if (!GetTokenInformation(TokenHandle, TokenUser, NULL, 0, &cbNeeded)) {
+
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
+ if (pUserToken = malloc(cbNeeded) ) {
+
+ if (GetTokenInformation(TokenHandle, TokenUser, pUserToken,
+ cbNeeded, &cbNeeded)) {
+
+ cbName = 0 ;
+ cbDomain = 0 ;
+ pName = NULL ;
+ pDomain = NULL ;
+
+ if (!LookupAccountSid(NULL, pUserToken->User.Sid,
+ NULL, &cbName, NULL,
+ &cbDomain, &SidNameUse)) {
+
+
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
+ cbDomain *= sizeof(CHAR) ;
+ cbName *= sizeof(CHAR) ;
+
+ if ( *pcbUser >= cbDomain + cbName + sizeof(CHAR) ) {
+
+ pDomain = malloc( cbDomain ) ;
+ if ( pDomain ) {
+ pName = malloc( cbName ) ;
+ }
+
+ if (pName) {
+
+ ReturnValue = LookupAccountSid(NULL,
+ pUserToken->User.Sid,
+ pName, &cbName,
+ pDomain, &cbDomain,
+ &SidNameUse);
+
+ cbDomain *= sizeof(CHAR) ;
+ cbName *= sizeof(CHAR) ;
+
+ }
+ if ( ReturnValue ) {
+ /*
+ * Need space for the names, backslash,
+ * and a null terminator
+ */
+ *pUser = malloc( cbDomain + cbName + sizeof(CHAR) * 2 ) ;
+ }
+ if ( *pUser ) {
+ strcpy( *pUser, pDomain ) ;
+ strcat( *pUser, TEXT("\\") ) ;
+ strcat( *pUser, pName ) ;
+
+ }
+ }
+
+ *pcbUser = cbDomain + cbName + sizeof(CHAR) ;
+ }
+
+ } else {
+
+ ReturnValue = TRUE;
+ }
+
+ free(pName) ;
+ free(pDomain) ;
+ }
+
+ free(pUserToken);
+ }
+ }
+ }
+
+ CloseHandle(TokenHandle) ;
+
+ return ReturnValue ;
+}
+
+BOOLEAN NTFS_SupportMacSyntax( GENERIC_DLE_PTR dle )
+{
+#if defined( UNICODE )
+ static BOOLEAN firstTime = TRUE;
+ static BOOLEAN ret_val = FALSE;
+
+ /*
+ * This function will only work on DLEs that are drive letter
+ * type DLEs. The tip of this file works correctly for all DLE
+ * types.
+ */
+ if ( firstTime )
+ {
+ CHAR path[] = TEXT("\\\\?\\C:\\");
+
+ path[4] = dle->device_name[0] ;
+
+ if ( GetFileAttributes( path ) != 0xffffffff )
+ {
+ ret_val = TRUE;
+ }
+ firstTime = FALSE;
+ }
+ return ret_val;
+#else
+ (void)dle;
+ return FALSE;
+#endif
+}
+
+/**/
+/**
+
+ Name: NTFS_InitFileSys()
+
+ Description: Performs initializations for the NT file system
+ that need be done only once per process invocation.
+
+ Modified: 04-Nov-93
+
+ Returns:
+
+ Notes:
+
+**/
+INT16 NTFS_InitFileSys( DLE_HAND hand,
+ BE_CFG_PTR cfg,
+ UINT32 fsys_mask )
+{
+ (void)hand;
+ (void)cfg;
+ (void)fsys_mask;
+
+ /*
+ * Initialize the temporary file name thingy.
+ */
+ NTFS_InitTemp();
+
+ return SUCCESS;
+}
+
+/**/
+/**
+
+ Name: NTFS_DeInitFileSys()
+
+ Description: Performs any cleanup that must be done for the
+ NT file system
+
+ Modified: 04-Nov-93
+
+ Returns: Nothing
+
+ Notes:
+
+**/
+VOID NTFS_DeInitFileSys( DLE_HAND hand )
+{
+ (void)hand;
+
+ /*
+ * Reclaim memory used by the temporary file name thingy
+ */
+ NTFS_DeinitTemp();
+}
+
+
+
+
diff --git a/private/utils/ntbackup/src/tminddb.c b/private/utils/ntbackup/src/tminddb.c
new file mode 100644
index 000000000..dcb10a160
--- /dev/null
+++ b/private/utils/ntbackup/src/tminddb.c
@@ -0,0 +1,178 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tminddb.c
+
+ Description: This file contains code to save and restore the minimal
+ information contained in a DDB.
+
+
+ $Log: N:\logfiles\tminddb.c_v $
+
+ Rev 1.9 12 Aug 1993 21:27:34 MIKEP
+fix delete bug
+
+ Rev 1.8 26 Jul 1993 13:10:14 CARLS
+added name_size to PopMinDDB call
+
+ Rev 1.7 10 Nov 1992 08:18:54 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.6 07 Oct 1992 15:54:58 DAVEV
+unicode strlen verification
+
+ Rev 1.5 24 Sep 1992 13:43:54 BARRY
+Changes for huge file name support.
+
+ Rev 1.4 21 May 1992 13:49:14 STEVEN
+more long path support
+
+ Rev 1.3 04 May 1992 09:27:36 LORIB
+Changes for variable length paths.
+
+ Rev 1.2 12 Mar 1992 15:50:20 STEVEN
+64 bit changes
+
+ Rev 1.1 28 Feb 1992 13:03:46 STEVEN
+step one for varible length paths
+
+ Rev 1.0 28 Jan 1992 14:40:46 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+
+#include "fsys.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "tfldefs.h"
+
+/**/
+/**
+
+ Name: NTFS_PushMinDDB()
+
+ Description: This function saves the specified DDB. It only saves
+ enough data to allow the restored DDB be used as a
+ parameter to a subset of the File System Calls.
+ This subset includes the following functions:
+
+ NTFS_FindNext(), NTFS_GetBlockType(),
+ NTFS_GetPathFromDDB(),
+ NTFS_RemoveDir(), and NTFS_FDBMatch()
+
+ The expected use of this function is to recursively
+ traverse a directory tree using the least amount of
+ memory.
+
+
+ Modified: 1/28/1992 12:31:14
+
+ Returns: Error codes:
+ OUT_OF_MEMMORY
+ FS_BAD_DBLK
+
+
+**/
+INT16 NTFS_PushMinDDB( fsh, dblk )
+FSYS_HAND fsh;
+DBLK_PTR dblk;
+{
+ NTFS_DBLK_PTR ddblk ;
+ NTFS_MIN_DDB_PTR mddb ;
+ INT16 ret_val ;
+ CHAR_PTR path ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk ;
+
+ msassert( fsh->attached_dle != NULL ) ;
+
+ msassert( dblk->blk_type == DDB_ID ) ;
+
+ path = ddblk->full_name_ptr->name ;
+
+ mddb = calloc( 1, sizeof(NTFS_MIN_DDB) + strsize( path ) ) ;
+
+ if ( mddb != NULL ) {
+
+ InitQElem( &(mddb->q) ) ;
+ mddb->scan_hand = ddblk->dta.scan_hand ;
+ mddb->path_in_stream = (BOOLEAN)(ddblk->b.d.ddb_attrib & DIR_PATH_IN_STREAM_BIT) ;
+ mddb->path = (CHAR_PTR)(mddb + 1) ;
+ mddb->psize = (INT16)(strlen( path ) * sizeof (CHAR)) ;
+ strcpy( mddb->path, path ) ;
+
+ PushElem( &(fsh->min_ddb_stk), &(mddb->q) ) ;
+
+ ret_val = SUCCESS ;
+
+ }
+
+ return( ret_val ) ;
+}
+/**/
+/**
+
+ Name: NTFS_PopMinDDB()
+
+ Description: This function returns a DDB which contains the minimal
+ data saved by NTFS_PushMinDDB(). The DDB returned can
+ be used as input for the following function:
+ NTFS_FindFNext(), NTFS_GetInfo(),
+
+ Modified: 1/28/1992 12:43:17
+
+ Returns: Error codes:
+ FS_STACK_EMPTY
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 NTFS_PopMinDDB( fsh, dblk )
+FSYS_HAND fsh ;
+DBLK_PTR dblk ;
+{
+ NTFS_DBLK_PTR ddblk ;
+ NTFS_MIN_DDB_PTR mddb ;
+ INT16 ret_val = SUCCESS ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk ;
+
+ mddb = (NTFS_MIN_DDB_PTR) PopElem( &(fsh->min_ddb_stk) );
+
+ if ( mddb != NULL ) {
+
+ dblk->blk_type = DDB_ID ;
+ ddblk->dta.scan_hand = mddb->scan_hand ;
+
+ ret_val = NTFS_SetupPathInDDB( fsh, dblk, mddb->path, NULL, 0 ) ;
+
+ if ( mddb->path_in_stream ) {
+ ddblk->b.d.ddb_attrib = DIR_PATH_IN_STREAM_BIT ;
+ } else {
+ ddblk->b.d.ddb_attrib = 0 ;
+ }
+
+ dblk->com.os_name = NULL ;
+ ddblk->os_info_complete = FALSE;
+ ddblk->name_complete = TRUE;
+
+ free( mddb );
+
+ } else {
+ ret_val = FS_STACK_EMPTY ;
+ }
+
+ return ret_val ;
+}
+
+
diff --git a/private/utils/ntbackup/src/tmkdblk.c b/private/utils/ntbackup/src/tmkdblk.c
new file mode 100644
index 000000000..def737257
--- /dev/null
+++ b/private/utils/ntbackup/src/tmkdblk.c
@@ -0,0 +1,718 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tmkdblk.c
+
+ Description: This file contains functions for the tape format
+ layer to use to create DBLKs. The structure's passed
+ to the create functions includes generic information which
+ is common to most file systems and os specific information.
+ The os specific information was saved when the file system
+ for that os was used to make a backup. The information in
+ the os specific portion could potentially be translated into
+ a useable format for this file system. Each file system defines
+ the format for its os specific information in the header file
+ osinfo.h.
+
+
+ $Log: M:/LOGFILES/TMKDBLK.C_V $
+
+ Rev 1.42 15 Jan 1994 19:25:08 BARRY
+Call SetupOSPathOrName with BYTE_PTRs instead of CHAR_PTRs
+
+ Rev 1.41 24 Nov 1993 14:36:22 BARRY
+Unicode fixes
+
+ Rev 1.40 20 Jul 1993 10:03:00 BARRY
+Initialize temp file name pointer used for MoveFileEx calls.
+
+ Rev 1.39 07 Jun 1993 19:43:52 BARRY
+Must convert back from local time.
+
+ Rev 1.38 14 Mar 1993 15:02:28 BARRY
+Fixed problems with making long names shorter.
+
+ Rev 1.37 07 Dec 1992 14:17:36 STEVEN
+updates from msoft
+
+ Rev 1.36 19 Nov 1992 11:19:18 STEVEN
+fix unicode fixes
+
+ Rev 1.35 16 Nov 1992 13:47:38 STEVEN
+fix unicode bug
+
+ Rev 1.33 11 Nov 1992 09:52:18 GREGG
+Unicodeized literals.
+
+ Rev 1.32 10 Nov 1992 08:19:58 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.31 29 Oct 1992 16:45:28 BARRY
+Return KEEP_ALL_DATA on dirs; minor path-in-stream changes.
+
+ Rev 1.30 20 Oct 1992 19:26:04 GREGG
+Removed line accidently block copied in during last change.
+
+ Rev 1.29 20 Oct 1992 17:20:28 STEVEN
+fix typo
+
+ Rev 1.28 20 Oct 1992 15:51:32 STEVEN
+added support for otc / catalog interface through DBLK
+
+ Rev 1.27 15 Oct 1992 11:39:04 STEVEN
+fix typos
+
+ Rev 1.26 13 Oct 1992 14:03:00 BARRY
+Wasn't setting up path length in MakeDDB.
+
+ Rev 1.25 13 Oct 1992 11:31:04 STEVEN
+Fixed support for UNICODE
+
+ Rev 1.24 09 Oct 1992 10:47:14 BARRY
+Name length updates.
+
+ Rev 1.23 01 Oct 1992 13:26:50 STEVEN
+fixes from Msoft
+
+ Rev 1.22 01 Oct 1992 13:03:44 BARRY
+Huge path/file name changes.
+
+ Rev 1.21 10 Sep 1992 09:30:36 STEVEN
+fix bugs in restore
+
+ Rev 1.20 04 Sep 1992 17:14:56 STEVEN
+fix warnings
+
+ Rev 1.19 17 Aug 1992 16:04:08 STEVEN
+fix warnings
+
+ Rev 1.17 04 Aug 1992 17:37:10 STEVEN
+fix buggs
+
+ Rev 1.16 30 Jul 1992 19:18:32 STEVEN
+fix fix_fname bug
+
+ Rev 1.15 23 Jul 1992 16:43:30 STEVEN
+fix warnings
+
+ Rev 1.14 23 Jul 1992 13:11:16 STEVEN
+fix warnings
+
+ Rev 1.13 20 Jul 1992 10:43:46 STEVEN
+backup short file name
+
+ Rev 1.12 17 Jul 1992 14:58:30 STEVEN
+fix NT bugs
+
+ Rev 1.11 16 Jul 1992 15:27:46 STEVEN
+fix type-o
+
+ Rev 1.10 09 Jul 1992 13:58:10 STEVEN
+BE_Unicode updates
+
+ Rev 1.9 09 Jun 1992 15:41:42 BURT
+Sync with NT and fixes
+
+ Rev 1.6 22 May 1992 16:05:22 STEVEN
+
+
+ Rev 1.5 21 May 1992 13:49:06 STEVEN
+more long path support
+
+ Rev 1.4 04 May 1992 09:30:36 LORIB
+Preliminary changes for variable length paths.
+
+ Rev 1.3 12 Mar 1992 15:50:18 STEVEN
+64 bit changes
+
+ Rev 1.2 28 Feb 1992 13:03:34 STEVEN
+step one for varible length paths
+
+ Rev 1.0 12 Feb 1992 12:55:12 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+#include "std_err.h"
+#include "stdmath.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "tfldefs.h"
+#include "osinfo.h"
+#include "gen_fs.h"
+
+static VOID NTFS_FixFname(
+CHAR_PTR name,
+UINT16 max_size ) ;
+
+static VOID ConvertMaynTimeToSysTime( DATE_TIME *buf, FILETIME *filetime ) ;
+
+/**/
+/**
+
+ Name: NTFS_CreateFDB
+
+ Description: This function creates a FDB based on the information
+ passed in the GEN_FDB_DATA structure. This function
+ allows the tape format layer to create DBLKs without
+ knowing their structure.
+
+ Modified: 8/24/1989
+
+ Returns: TF_KEEP_GEN_DATA_ONLY
+
+**/
+INT16 NTFS_CreateFDB( fsh, dat )
+FSYS_HAND fsh;
+GEN_FDB_DATA_PTR dat;
+{
+ NTFS_DBLK_PTR ddblk;
+ UINT16 nam_size ;
+ INT8_PTR input_str ;
+ INT cb_input_str_sz ;
+ BOOLEAN input_str_allocated = FALSE ;
+ GENERIC_DLE_PTR dle ;
+ FS_NAME_Q_ELEM_PTR os_name_q_elem ;
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+ DBLK_PTR dblk ;
+ INT16 ret_val ;
+
+ dle = fsh->attached_dle ;
+
+ dat->std_data.dblk->blk_type = FDB_ID ;
+ dat->std_data.dblk->com.blkid = dat->std_data.blkid;
+ dat->std_data.dblk->com.f_d.did = dat->std_data.did ;
+ dat->std_data.dblk->com.ba.lba = dat->std_data.lba ;
+ dat->std_data.dblk->com.continue_obj = dat->std_data.continue_obj ;
+ dat->std_data.dblk->com.os_id = dat->std_data.os_id ;
+ dat->std_data.dblk->com.os_ver = dat->std_data.os_ver ;
+
+ dat->std_data.dblk->com.tape_seq_num = dat->std_data.tape_seq_num ;
+
+ ddblk = (NTFS_DBLK_PTR)dat->std_data.dblk;
+ dblk = dat->std_data.dblk ;
+ dblk->com.string_type = dat->std_data.string_type ;
+
+ ddblk->blk_type = FDB_ID;
+ ddblk->b.f.fdb_attrib = dat->std_data.attrib ;
+ ddblk->b.f.PosixFile = FALSE ;
+
+ ConvertMaynTimeToSysTime( dat->mod_date, &ddblk->dta.modify_time ) ;
+ ConvertMaynTimeToSysTime( dat->creat_date, &ddblk->dta.create_time ) ;
+ ConvertMaynTimeToSysTime( dat->access_date, &ddblk->dta.access_time ) ;
+
+ ddblk->dta.size = dat->std_data.disp_size;
+ ddblk->dta.os_attr = FILE_ATTRIBUTE_NORMAL ;
+ ddblk->dta.scan_hand = NULL;
+
+ ddblk->os_info_complete = FALSE;
+ ddblk->name_complete = TRUE;
+ ddblk->b.f.handle = NULL;
+ ddblk->b.f.hand_temp_name = NULL;
+ ddblk->b.f.linkOnly = FALSE;
+ ddblk->b.f.alt_name[0] = TEXT('\0');
+ ddblk->b.f.idHi = 0;
+ ddblk->b.f.idLo = 0;
+ ddblk->b.f.linkCount = 0;
+ ddblk->b.f.linkOnly = FALSE;
+ ddblk->b.f.PosixFile = FALSE;
+
+
+ /* convert name to destination type UNICODE/ASCII */
+
+ if ( !( dat->std_data.attrib & FILE_NAME_IN_STREAM_BIT ) )
+ {
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)dat->fname,
+ dat->fname_size ) ;
+ if ( ret_val != SUCCESS )
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ name_q_elem = FS_AllocPathOrName( fsh, dblk->com.os_name->name_size ) ;
+ if ( name_q_elem == NULL )
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ ddblk->full_name_ptr = name_q_elem ;
+ memcpy( ddblk->full_name_ptr->name,
+ dblk->com.os_name->name,
+ dblk->com.os_name->name_size ) ;
+
+
+ NTFS_FixFname( ddblk->full_name_ptr->name, (UINT16)dle->info.ntfs->fname_leng ) ;
+
+ ddblk->full_name_ptr->name_size = strsize( ddblk->full_name_ptr->name ) ;
+
+ ddblk->name_complete = TRUE ;
+
+ }
+ else
+ {
+ ddblk->name_complete = FALSE ;
+ }
+
+
+ if ( input_str_allocated )
+ {
+ free( input_str ) ;
+ }
+
+ switch ( dat->std_data.os_id )
+ {
+
+ case FS_NTFS_ID:
+ {
+ NT_FILE_OS_INFO_PTR nt_inf ;
+
+ nt_inf = (NT_FILE_OS_INFO_PTR)dat->std_data.os_info ;
+
+ ddblk->dta.os_attr = nt_inf->file_attributes ;
+ ddblk->b.f.linkOnly = nt_inf->linkOnly;
+
+ if ( ( dle->info.ntfs->fname_leng <= 12 ) &&
+ ( nt_inf->short_name_size != 0 ) )
+ {
+ BYTE_PTR pb_short_name;
+
+ pb_short_name = (UINT8_PTR)(nt_inf) + nt_inf->short_name_offset ;
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ pb_short_name,
+ nt_inf->short_name_size ) ;
+ if ( ret_val != SUCCESS )
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ name_q_elem = FS_AllocPathOrName( fsh, dblk->com.os_name->name_size ) ;
+
+ if ( name_q_elem == NULL )
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ ddblk->full_name_ptr = name_q_elem ;
+ memcpy( ddblk->full_name_ptr->name,
+ dblk->com.os_name->name,
+ dblk->com.os_name->name_size ) ;
+
+
+ NTFS_FixFname( ddblk->full_name_ptr->name, (UINT16)dle->info.ntfs->fname_leng ) ;
+
+ ddblk->full_name_ptr->name_size = strsize( ddblk->full_name_ptr->name ) ;
+
+ ddblk->name_complete = TRUE ;
+
+ }
+ else if ( nt_inf->short_name_size == 0 )
+ {
+ ddblk->b.f.PosixFile = TRUE ;
+ }
+ break ;
+ }
+ }
+ return TF_KEEP_ALL_DATA ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_CreateDDB
+
+ Description: This function creates a DDB based on the information
+ passed in the GEN_DDB_DATA structure. This function
+ allows the tape format layer to create DBLKs without
+ knowing their structure.
+
+ Modified: 8/24/1989
+
+ Returns: TF_SKIP_ALL_DATA
+
+**/
+INT16 NTFS_CreateDDB( fsh, dat )
+FSYS_HAND fsh;
+GEN_DDB_DATA_PTR dat;
+
+{
+ NTFS_DBLK_PTR ddblk;
+ INT16 dir_size ;
+ INT16 ret_val ;
+ INT8_PTR input_str ;
+ INT cb_input_str_sz ;
+ BOOLEAN input_str_allocated = FALSE ;
+ FS_NAME_Q_ELEM_PTR name_q_elem ;
+ FS_NAME_Q_ELEM_PTR os_name_q_elem ;
+ DBLK_PTR dblk ;
+
+ dat->std_data.dblk->blk_type = DDB_ID ;
+ dat->std_data.dblk->com.blkid = dat->std_data.blkid;
+ dat->std_data.dblk->com.f_d.did = dat->std_data.did ;
+ dat->std_data.dblk->com.ba.lba = dat->std_data.lba ;
+ dat->std_data.dblk->com.os_id = dat->std_data.os_id ;
+ dat->std_data.dblk->com.os_ver = dat->std_data.os_ver ;
+
+ dat->std_data.dblk->com.continue_obj = dat->std_data.continue_obj ;
+ dat->std_data.dblk->com.tape_seq_num = dat->std_data.tape_seq_num ;
+
+ ddblk = (NTFS_DBLK_PTR)dat->std_data.dblk;
+ dblk = dat->std_data.dblk;
+ dblk->com.string_type = dat->std_data.string_type ;
+
+ ddblk->blk_type = DDB_ID;
+
+ ddblk->b.d.ddb_attrib = dat->std_data.attrib ;
+ if ( ddblk->b.d.ddb_attrib & DIR_PATH_IN_STREAM_BIT ) {
+ dat->std_data.dblk->com.stream_offset = 0 ;
+ ddblk->name_complete = FALSE ;
+ } else {
+ ddblk->name_complete = TRUE ;
+ }
+
+ ddblk->dta.scan_hand = NULL;
+ ddblk->dta.size = U64_Init( 0, 0 ) ;
+ ddblk->dta.os_attr = FILE_ATTRIBUTE_NORMAL ;
+
+ ConvertMaynTimeToSysTime( dat->mod_date, &ddblk->dta.modify_time ) ;
+ ConvertMaynTimeToSysTime( dat->creat_date, &ddblk->dta.create_time ) ;
+ ConvertMaynTimeToSysTime( dat->access_date, &ddblk->dta.access_time ) ;
+
+ ddblk->os_info_complete = FALSE;
+
+ if ( ddblk->name_complete ) {
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)dat->path_name,
+ dat->path_size ) ;
+ if ( ret_val != SUCCESS ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ name_q_elem = FS_AllocPathOrName( fsh, dblk->com.os_name->name_size ) ;
+
+ if ( name_q_elem == NULL ) {
+ return OUT_OF_MEMORY ;
+
+ }
+
+ ddblk->full_name_ptr = name_q_elem ;
+ memcpy( ddblk->full_name_ptr->name,
+ dblk->com.os_name->name,
+ dblk->com.os_name->name_size ) ;
+
+
+ dir_size = dblk->com.os_name->name_size ;
+
+ NTFS_FixPath( ddblk->full_name_ptr->name,
+ &dir_size,
+ (UINT16)fsh->attached_dle->info.ntfs->fname_leng ) ;
+
+ ddblk->full_name_ptr->name_size = strsize( ddblk->full_name_ptr->name );
+
+ ddblk->name_complete = TRUE ;
+
+
+ } else {
+
+ ddblk->name_complete = FALSE ;
+ }
+
+ if ( input_str_allocated ) {
+ free( input_str ) ;
+ }
+
+ switch ( dat->std_data.os_id ) {
+
+ case FS_NTFS_ID:
+ ddblk->dta.os_attr = ((NT_DIR_OS_INFO_PTR)dat->std_data.os_info)->dir_attributes ;
+ break ;
+ }
+
+
+ return TF_KEEP_ALL_DATA ;
+
+}
+
+
+
+/* The purpose of this function is to handle pathnames that have
+ members that are either longer than 8 chars or not of the form
+ 8.3 which is the FAT/DOS format. It does this by calling the
+ NTFS_FixFname() function to do the bulk of the work.
+
+ Entry: CHAR_PTR to the path string.
+ INT16_PTR to the size of the path string, includes terminating
+ NUL.
+ INT16 maximum size for a file name/directory path member.
+
+ Returns: Nothing. The path string is modified in place, and the passed
+ path size is altered to reflect the changed path string
+ length.
+
+ paths like: 1) \foo\fahdeedah\foo.foo
+ 2) \foo\fahdeedah.abc.def\foo.foo
+ 3) \foo\fahdeeda.h\foo.foo
+ 4) \foo\fahdeedahabcdefgh\foo.foo
+
+ will convert to: 1) \foo\fahdeeda\foo.foo
+ 2) \foo\fahdeeda\foo.foo
+ 3) \foo\fahdeeda.h\foo.foo
+ 4) \foo\fahdeeda\foo.foo
+
+*/
+
+VOID NTFS_FixPath( CHAR_PTR path,
+ INT16_PTR size,
+ INT16 fname_size )
+{
+ CHAR_PTR src;
+ CHAR_PTR member;
+ CHAR_PTR dest;
+ INT16 src_size;
+ INT16 member_size;
+
+ member = src = dest = path ;
+ src_size = *size ;
+ *size = member_size = (INT16)0 ;
+
+ if ( src_size <= sizeof(CHAR) )
+ {
+ *dest = TEXT('\0');
+ *size = sizeof(CHAR) ;
+ return ;
+ }
+
+ do
+ {
+ if ( *src == TEXT('\0') )
+ {
+ *dest = TEXT('\0');
+ if ( member_size != (INT16)0 )
+ {
+ NTFS_FixFname( member, (UINT16)fname_size ) ;
+
+ (*size) += strsize( member ) ;
+ dest = member + strlen( member );
+ member = dest + 1 ;
+ member_size = (INT16)0 ;
+ }
+
+ if ( src_size > sizeof(CHAR) )
+ {
+ *dest = TEXT('\\') ;
+ }
+ else
+ {
+ *dest = TEXT('\0') ;
+ }
+ }
+ else
+ {
+
+ *dest = *src ;
+ }
+ src++ ;
+ dest++ ;
+ src_size-=sizeof(CHAR) ;
+ member_size+=sizeof(CHAR) ;
+
+ } while ( src_size != 0 ) ;
+}
+
+
+/*
+ The purpose of this function is to insure that no member portion of
+ a pathname is more than max_size in length. This will attempt to
+ perform this action using the existing buffer which is passed in as
+ name. Illegal characters are replaced with the underscore.
+
+ Entry: CHAR_PTR to file or directory path member name string. This is
+ expected to be NUL terminated.
+ INT16 Maximum size allowed for the member name string.
+
+*/
+static VOID NTFS_FixFname(
+ CHAR_PTR name,
+ UINT16 max_size )
+{
+ CHAR_PTR badChars = TEXT(" <>\\?*|");
+ INT i ;
+
+ /* Check for potential problems with the characters in the name */
+ if ( strcspn( name, badChars ) != strlen( name ) )
+ {
+ CHAR_PTR src = name;
+ CHAR_PTR dst = name;
+ CHAR_PTR ext = strchr( name, TEXT('.') );
+
+ /*
+ * Set up definition of what characters we want to remove from
+ * name. Only remove spaces from name if the name is obviously
+ * a long name and it is being restored to a FAT drive; otherwise
+ * we could be removing spaces from a FAT name that are there
+ * for a good reason.
+ */
+
+ // Remove spaces if max_size <= 12 && (name.ext > 12 or name > 8)
+
+ if ( max_size > 12 )
+ {
+ /* Don't remove spaces -- we probably have room for them. */
+ badChars = TEXT("<>\\?*|");
+ }
+ else
+ {
+ BOOLEAN maxed;
+
+ /* Check for overflowing the 8.3 format */
+ if ( ext != NULL )
+ {
+ maxed = ((ext - name - 1) > 8) || (strlen( ext + 1 ) > 3);
+ }
+ else
+ {
+ maxed = strlen( name ) > 8;
+ }
+
+ /*
+ * If the name length doesn't exceed the max of the FAT drive,
+ * then we will not remove spaces.
+ */
+ if ( !maxed )
+ {
+ badChars = TEXT("<>\\?*|");
+ }
+ }
+
+ /*
+ * Remove bad characters by scrunching the string, not by
+ * replacement with a filler (like '_').
+ */
+ while ( *src != TEXT('\0') )
+ {
+ if ( strchr( badChars, *src ) == NULL )
+ {
+ *dst++ = *src++;
+ }
+ else
+ {
+ src++;
+ }
+ }
+
+ /* Make sure string is terminated. */
+ *dst = TEXT('\0');
+ }
+
+
+ if ( max_size == 12 ) /* FAT/DOS based 8.3 max name size. */
+ {
+ CHAR_PTR p ;
+ CHAR_PTR p1 ;
+
+ p = strchr( name, TEXT('.') ) ;
+ if ( p != NULL ) /* '.' found */
+ {
+ if ( p - name > (8*sizeof(CHAR)) ) /* name portion is > 8 chars */
+ {
+ p1 = strchr( p+1, TEXT('.') ) ;
+ if ( p1 != NULL )
+ {
+ *p1 = TEXT('\0') ; /* Kill any portion that had an additional '.' */
+ }
+ }
+ }
+
+ if ( strlen( name ) < 9 )
+ {
+ if ( p == NULL || (p - name <= 8) )
+ {
+ return; /* All should be well with the world */
+ }
+ }
+
+ /*
+ * Now we know that the name portion is greater than 8 chars
+ * if we are going to move up we would need to allow the
+ * source buffer to grow as '.'s are added. This is not likely
+ * to be the case. So.... we can't just move things around in
+ * the buffer. Basically we need to evaluate to see if we have
+ * no '.' and, if so place one at [8], overwritting the existing
+ * character.
+ */
+
+ if ( p == NULL || ((p - name) > (8*sizeof(CHAR))) ) /* No '.' */
+ {
+ if ( p != NULL )
+ {
+ name[8] = TEXT('.') ; /* Place '.' */
+ p1 = strchr( p+1, TEXT('.' ) ) ;
+ if ( p1 != NULL )
+ {
+ /* Kill any portion that had an additional '.' */
+ *p1 = TEXT('\0') ;
+ }
+ }
+
+ /* If more than 8 chars and no '.' */
+ if ( p == NULL && (strlen( name ) > 8) )
+ {
+ name[8] = TEXT('\0') ;
+ }
+ }
+
+ /* Now we need to see if we have more than 3 chars before the nul */
+ if ( strlen( &name[9] ) > 3 )
+ {
+ /*
+ * Go upstream and let fix path deal with it. But
+ * of course we are called from other spots so that
+ * won't work either.
+ */
+ name[8] = TEXT('\0') ; /* Force path processing */
+ return ;
+ }
+
+ }
+ else if ( max_size != (UINT16)0xffff )
+ {
+ if ( (UINT16)strlen( name ) > max_size )
+ {
+ name[ max_size] = TEXT('\0') ;
+ }
+ }
+}
+
+
+static VOID ConvertMaynTimeToSysTime( DATE_TIME *buf, FILETIME *filetime )
+{
+ SYSTEMTIME systime ;
+ FILETIME temp;
+
+ systime.wYear = buf->year ;
+ systime.wMonth = buf->month ;
+ systime.wDay = buf->day ;
+ systime.wHour = buf->hour ;
+ systime.wMinute= buf->minute ;
+ systime.wSecond= buf->second ;
+
+ systime.wDayOfWeek = 0 ;
+ systime.wMilliseconds = 0 ;
+
+ SystemTimeToFileTime( &systime, &temp ) ;
+ LocalFileTimeToFileTime( &temp, filetime ) ;
+
+}
diff --git a/private/utils/ntbackup/src/tmoddblk.c b/private/utils/ntbackup/src/tmoddblk.c
new file mode 100644
index 000000000..f10018c85
--- /dev/null
+++ b/private/utils/ntbackup/src/tmoddblk.c
@@ -0,0 +1,1174 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tmoddblk.c
+
+ Description: This file contains code to get/set generic information
+ from/to a NTFS FDB or DDB.
+
+
+ $Log: M:/LOGFILES/TMODDBLK.C_V $
+
+ Rev 1.39 24 Nov 1993 15:00:52 BARRY
+Changed CHAR_PTRs in I/O functions to BYTE_PTRs
+
+ Rev 1.38 06 Jul 1993 14:59:54 BARRY
+No, the nt_ddb is not necessarily the current dir.
+
+ Rev 1.37 11 Jun 1993 14:20:54 BARRY
+Only enumerate special files when dle has restore special files bit set.
+
+ Rev 1.36 03 Jun 1993 16:20:40 STEVEN
+fix time and date to local time
+
+ Rev 1.35 04 May 1993 22:56:28 BARRY
+Fixed invalid dates/times.
+
+ Rev 1.34 01 Apr 1993 14:30:02 TIMN
+Replace constant with define
+
+ Rev 1.33 11 Feb 1993 11:27:46 STEVEN
+fix CHAR_PTR to CHAR
+
+ Rev 1.32 08 Feb 1993 10:36:42 STEVEN
+we always want to process directories
+
+ Rev 1.31 04 Feb 1993 11:24:50 BARRY
+Steve's registry fixes to EnumSpecialFiles.
+
+ Rev 1.30 17 Dec 1992 13:26:56 STEVEN
+we need to backup the short names
+
+ Rev 1.29 11 Nov 1992 09:52:12 GREGG
+Unicodeized literals.
+
+ Rev 1.28 10 Nov 1992 08:20:36 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.27 06 Nov 1992 16:28:06 STEVEN
+test unlimited file sizes
+
+ Rev 1.26 06 Nov 1992 15:49:10 STEVEN
+test write of path in stream
+
+ Rev 1.25 04 Nov 1992 18:00:36 BARRY
+Moved the temporary MSOFT stream id definitions elsewhere.
+
+ Rev 1.24 29 Oct 1992 16:50:24 BARRY
+Translate ULNK IDs; add linkOnly to osinfo.
+
+ Rev 1.23 21 Oct 1992 11:52:54 STEVEN
+added SpecialExclude
+
+ Rev 1.22 14 Oct 1992 14:38:52 BARRY
+Added MSoft stream IDs (until they are public.).
+
+ Rev 1.21 09 Oct 1992 15:18:10 BARRY
+Name-in-stream changes.
+
+ Rev 1.20 07 Oct 1992 16:15:34 STEVEN
+forgot the structure
+
+ Rev 1.19 07 Oct 1992 16:10:54 STEVEN
+added MsofttoMayn
+
+ Rev 1.18 07 Oct 1992 15:54:30 DAVEV
+unicode strlen verification
+
+ Rev 1.17 01 Oct 1992 13:26:46 STEVEN
+fixes from Msoft
+
+ Rev 1.16 01 Oct 1992 13:03:48 BARRY
+Huge path/file name changes.
+
+ Rev 1.15 22 Sep 1992 15:36:18 BARRY
+Got rid of GetTotalSizeDBLK.
+
+ Rev 1.14 21 Sep 1992 16:51:58 BARRY
+Change over from path_complete to name_complete.
+
+ Rev 1.13 17 Aug 1992 16:09:20 STEVEN
+fix warnings
+
+ Rev 1.12 12 Aug 1992 17:47:44 STEVEN
+fixed bugs at microsoft
+
+ Rev 1.11 20 Jul 1992 10:43:32 STEVEN
+backup short file name
+
+ Rev 1.10 25 Jun 1992 11:21:52 STEVEN
+need to properly initialize the attribute structure
+
+ Rev 1.8 09 Jun 1992 15:14:04 BURT
+Sync with NT stuff
+
+ Rev 1.7 01 Jun 1992 10:30:56 STEVEN
+specify the file size for now
+
+ Rev 1.6 27 May 1992 18:49:30 STEVEN
+getting wrong os path
+
+ Rev 1.5 22 May 1992 16:05:38 STEVEN
+
+
+ Rev 1.4 21 May 1992 13:49:12 STEVEN
+more long path support
+
+ Rev 1.3 04 May 1992 09:22:20 LORIB
+Fixes to structure member names.
+
+ Rev 1.2 12 Mar 1992 15:50:10 STEVEN
+64 bit changes
+
+ Rev 1.1 23 Jan 1992 13:54:14 STEVEN
+fix typo of NTTS instead of NTFS
+
+ Rev 1.0 17 Jan 1992 17:50:02 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+#include "stdmath.h"
+#include "tfldefs.h"
+#include "datetime.h"
+#include "fsys.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "fsys_err.h"
+#include "osinfo.h"
+
+typedef struct {
+ UINT32 maynID;
+ UINT32 msoftID;
+} ID_TRANS_TABLE, ID_TRANS_TABLE_PTR;
+
+/**/
+/**
+
+ Name: NTFS_ModFnameFDB()
+
+ Description: This function gets/sets the file name in an FDB
+
+ Modified: 1/14/1992 10:28:22
+
+ Returns: Error codes:
+ FS_BUFFER_TO_SMALL
+ FS_BAD_INPUT_DATA
+ SUCCESS
+
+ Notes: For getting file name, be aware that this function
+ will copy a '\0' into the buffer but does not count it
+ in the size returned. For example:
+ the file name - FRED.BKS
+ we will copy - FRED.BKS\0
+ and size will equal - 8
+
+ See also: NTFS_ModPathDDB()
+
+**/
+INT16 NTFS_ModFnameFDB(
+FSYS_HAND fsh , /* I - File system handle */
+BOOLEAN set_it , /* I - TRUE if setting file name, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get file name from */
+CHAR_PTR buf , /*I/O- file name to read (or to write) */
+INT16 *size ) /*I/O- byte size buffer on entry and exit */
+{
+ UINT16 cch_temp_size ; // len of temp_name in CHARs w/o NULL term
+ CHAR temp_name[13] ;
+ INT16 ret_val = SUCCESS ;
+ NTFS_DBLK_PTR ddblk ;
+
+ fsh ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ if ( set_it ) {
+
+ if ( size == NULL ) {
+ cch_temp_size = (INT16)strlen( buf ) ;
+ }
+ else {
+ cch_temp_size = *size / sizeof (CHAR);
+ }
+
+
+ ret_val = NTFS_SetupFileNameInFDB( fsh, dblk, buf, 0 );
+
+ ddblk->name_complete = TRUE ;
+
+ } else { /* get data from FDB */
+
+ strcpy( buf, ddblk->full_name_ptr->name );
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: NTFS_ModPathDDB()
+
+ Description: This function gets/sets the path in an DDB
+
+ Modified: 1/14/1992 10:30:16
+
+ Returns: Error Codes:
+ FS_BUFFER_TO_SMALL
+ FS_BAD_INPUT_DATA
+ SUCCESS
+
+ Notes:
+
+ See also: NTFS_ModFnameFDB()
+
+**/
+INT16 NTFS_ModPathDDB(
+FSYS_HAND fsh , /* I - File system handle */
+BOOLEAN set_it , /* I - TRUE if setting path, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get path from */
+CHAR_PTR buf , /*I/O- path to read (or to write) */
+INT16 *size ) /*I/O- byte size of buffer on entry and exit */
+{
+ INT16 ret_val = SUCCESS ;
+ CHAR_PTR pos ;
+ NTFS_DBLK_PTR ddblk ;
+
+ fsh ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk ;
+
+ if ( set_it ) {
+
+ ret_val = NTFS_SetupPathInDDB( fsh, dblk, NULL, NULL, *size ) ;
+
+ if ( ret_val == SUCCESS ) {
+ memcpy( ddblk->full_name_ptr->name, buf, *size ) ;
+ ddblk->full_name_ptr->name_size = *size ;
+
+ NTFS_FixPath( ddblk->full_name_ptr->name,
+ &ddblk->full_name_ptr->name_size,
+ fsh->attached_dle->info.ntfs->fname_leng );
+
+ ddblk->name_complete = TRUE ;
+
+ }
+
+
+ } else { /* get path */
+
+ strcpy( buf, ddblk->full_name_ptr->name ) ;
+
+ pos = strchr( buf, TEXT('\\') ) ;
+ while ( pos != NULL ) {
+
+ *pos = TEXT('\0') ;
+
+ pos = strchr( pos + 1, TEXT('\\') ) ;
+ }
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: NTFS_GetOSFnameFDB()
+
+ Description: This function copies the OS file name in the specified
+ FDB to the specified buffer. The OS file name is the same as
+ the "normal" file name during backup. During restore, the
+ OS file name is the name stored on tape.
+
+ Modified: 1/14/1992 11:8:26
+
+ Returns: Error codes
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes:
+
+ See also: NTFS_ModFnameFDB()
+
+**/
+INT16 NTFS_GetOSFnameFDB( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get path from */
+CHAR_PTR buf ; /* O - buffer to place path in */
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk;
+ CHAR_PTR os_name ;
+ UINT16 os_name_size ;
+
+ if ( dblk->com.os_name != NULL )
+ {
+ os_name = dblk->com.os_name->name ;
+ os_name_size = dblk->com.os_name->name_size ;
+ }
+ else
+ {
+ os_name = ddblk->full_name_ptr->name ;
+ os_name_size = ddblk->full_name_ptr->name_size ;
+ }
+
+ memcpy( buf, os_name, os_name_size ) ;
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: NTFS_GetOSPathDDB()
+
+ Description: This function copies the OS path in the specified
+ DDB to the specified buffer. The OS path is the same as
+ the "normal" path during backup. During restore, the
+ OS path name is the name stored on tape.
+
+ Modified: 1/14/1992 11:9:5
+
+ Returns: Error codes:
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes:
+
+ See also: NTFS_GetOSFnameFDB()
+
+**/
+INT16 NTFS_GetOSPathDDB( fsh, dblk, buf )
+FSYS_HAND fsh ; /* I - File System handle */
+DBLK_PTR dblk ; /* I - Descriptor block to get path from */
+CHAR_PTR buf ; /*I/O- path to read (or to write) */
+{
+ CHAR_PTR pos ;
+ CHAR_PTR os_name ;
+ INT16 os_name_size ;
+ NTFS_DBLK_PTR ddblk ;
+
+ (VOID)fsh ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ if ( dblk->com.os_name != NULL )
+ {
+ os_name = dblk->com.os_name->name ;
+ os_name_size = dblk->com.os_name->name_size ;
+ }
+ else
+ {
+ os_name = ddblk->full_name_ptr->name ;
+ os_name_size = ddblk->full_name_ptr->name_size ;
+ }
+
+
+ memcpy( buf, os_name, os_name_size ) ;
+
+ if ( dblk->com.os_name == NULL ) // Backup only
+ {
+
+ pos = strchr( buf, TEXT('\\') );
+ while ( pos != NULL )
+ {
+ *pos = TEXT('\0') ;
+ pos = strchr( pos+1, TEXT('\\') ) ;
+ }
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: NTFS_GetFileVerFDB()
+
+ Description: Since DOS does not support file versions, this
+ function simply sets the version number to 0.
+
+ Modified: 1/14/1992 11:9:39
+
+ Returns: SUCCESS
+
+ Notes:
+
+**/
+INT16 NTFS_GetFileVerFDB( dblk, version )
+DBLK_PTR dblk ;
+UINT32 *version ;
+{
+ dblk ;
+ *version = 0 ;
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: NTFS_GetCdateDBLK()
+
+ Description: Pretend Creation date is same as Modify date
+
+ Modified: 1/14/1992 11:10:9
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: NTFS_ModBdate(), NTFS_GetMdate(), NTFS_ModAdate()
+
+**/
+INT16 NTFS_GetCdateDBLK( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ; /*I/O- createion date to read (or to write) */
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk ;
+ SYSTEMTIME systime ;
+
+ // Make sure date is valid -- some dblk date/times are set to zero
+ // for invalidity
+ if ( (ddblk->dta.create_time.dwLowDateTime == 0) &&
+ (ddblk->dta.create_time.dwHighDateTime == 0) )
+ {
+ // TF doesn't want noise in their structures
+ memset( buf, 0, sizeof(*buf) );
+ }
+ else
+ {
+ FILETIME local_time ;
+
+ FileTimeToLocalFileTime( &ddblk->dta.create_time, &local_time ) ;
+ FileTimeToSystemTime( &local_time, &systime ) ;
+
+ buf->date_valid = TRUE ;
+ buf->year = systime.wYear ;
+ buf->month = systime.wMonth ;
+ buf->day = systime.wDay ;
+ buf->hour = systime.wHour ;
+ buf->minute = systime.wMinute ;
+ buf->second = systime.wSecond ;
+ buf->day_of_week = systime.wDayOfWeek ;
+ }
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: NTFS_GetMdateDBLK()
+
+ Description: This function copies the modified date/time into (or out of)
+ the provided buffer.
+
+ Modified: 1/14/1992 11:20:6
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: NTFS_GetCdate(), NTFS_ModBdate(), NTFS_ModAdate()
+
+**/
+INT16 NTFS_GetMdateDBLK( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ; /* O - modify date to write */
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk ;
+ SYSTEMTIME systime ;
+
+ // Make sure date is valid -- some dblk date/times are set to zero
+ // for invalidity
+
+ if ( (ddblk->dta.modify_time.dwLowDateTime == 0) &&
+ (ddblk->dta.modify_time.dwHighDateTime == 0) )
+ {
+ // TF doesn't want noise in their structures
+ memset( buf, 0, sizeof(*buf) );
+ }
+ else
+ {
+ FILETIME local_time ;
+
+ FileTimeToLocalFileTime( &ddblk->dta.modify_time, &local_time ) ;
+ FileTimeToSystemTime( &local_time, &systime ) ;
+
+ buf->date_valid = TRUE ;
+ buf->year = systime.wYear ;
+ buf->month = systime.wMonth ;
+ buf->day = systime.wDay ;
+ buf->hour = systime.wHour ;
+ buf->minute = systime.wMinute ;
+ buf->second = systime.wSecond ;
+ buf->day_of_week = systime.wDayOfWeek ;
+ }
+
+ return SUCCESS ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_ModBdateDBLK()
+
+ Description: This function copies the backup date/time into (or out of)
+ the provided buffer.
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( NTFS_GetCdate(), NTFS_GetMdate(), NTFS_ModAdate()
+
+**/
+INT16 NTFS_ModBdateDBLK(
+BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ) /*I/O- createion date to read (or to write) */
+{
+ dblk;
+
+ if ( !set_it ) {
+
+ buf->date_valid = FALSE;
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: NTFS_ModAdateDBLK()
+
+ Description: This function copies the access date/time into (or out ot )
+ the provided buffer.
+
+ Modified: 1/14/1992 11:21:53
+
+ Returns: SUCCESS
+
+ See also: NTFS_GetCdate(), NTFS_GetMdate(), NTFS_ModBdate()
+
+**/
+INT16 NTFS_ModAdateDBLK(
+BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ) /*I/O- createion date to read (or to write) */
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)dblk ;
+ SYSTEMTIME systime;
+
+ if ( set_it )
+ {
+ FILETIME local_time ;
+
+ systime.wYear = buf->year ;
+ systime.wMonth = buf->month ;
+ systime.wDay = buf->day ;
+ systime.wHour = buf->hour ;
+ systime.wMinute = buf->minute ;
+ systime.wSecond = buf->second ;
+
+ SystemTimeToFileTime( &systime, &local_time ) ;
+ LocalFileTimeToFileTime( &local_time, &ddblk->dta.access_time ) ;
+ }
+ else
+ {
+ // Make sure date is valid -- some dblk date/times are set to zero
+ // for invalidity
+
+ if ( (ddblk->dta.access_time.dwLowDateTime == 0) &&
+ (ddblk->dta.access_time.dwHighDateTime == 0) )
+ {
+ // TF doesn't want noise in their structures
+ memset( buf, 0, sizeof(*buf) );
+ }
+ else
+ {
+ FILETIME local_time ;
+
+ FileTimeToLocalFileTime( &ddblk->dta.access_time, &local_time ) ;
+ FileTimeToSystemTime( &local_time, &systime ) ;
+
+ buf->date_valid = TRUE ;
+ buf->year = systime.wYear ;
+ buf->month = systime.wMonth ;
+ buf->day = systime.wDay ;
+ buf->hour = systime.wHour ;
+ buf->minute = systime.wMinute ;
+ buf->second = systime.wSecond ;
+ buf->day_of_week = systime.wDayOfWeek ;
+ }
+ }
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: NTFS_GetDisplaySizeDBLK()
+
+ Description: This function returns the generic size of a DBLK.
+ For a file, this is the file size. For a directory this is
+ allways 0.
+
+ Modified: 1/14/1992 12:15:33
+
+ Returns: Number of generic data bytes.
+
+ Notes:
+
+**/
+UINT64 NTFS_GetDisplaySizeDBLK( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* I - Descriptor block to get generic data size for */
+{
+ UINT64 size ;
+ NTFS_DBLK_PTR ddblk;
+
+ fsh ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ size = U64_Init( 0, 0 ) ;
+
+ if ( ddblk->blk_type == FDB_ID ) {
+
+ size = ddblk->dta.size ;
+
+ }
+
+ return size;
+}
+
+/**/
+/**
+
+ Name: NTFS_ModAttribDBLK()
+
+ Description: This function copies the generic attributes into
+ (or out of) the specified DBLK.
+
+ Modified: 1/14/1992 12:15:59
+
+ Returns: SUCCESS
+
+ Notes: This only supports FDBs and DDBs. This should be called
+ by the FS_... function NOT by a macro.
+
+**/
+INT16 NTFS_ModAttribDBLK(
+BOOLEAN set_it , /* I - TRUE if we are seting data */
+DBLK_PTR dblk , /*I/O- dblk to read or write data from */
+UINT32 *attrib ) /*I/O- attributre read or written */
+{
+ NTFS_DBLK_PTR ddblk ;
+ UINT32 temp_atrib = *attrib ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ if ( set_it ) {
+
+ switch ( dblk->blk_type ) {
+ case CFDB_ID:
+ ((CFDB_PTR)dblk)->attributes = *attrib ;
+ break ;
+ case VCB_ID:
+ ((VCB_PTR)dblk)->vcb_attributes = *attrib ;
+ break ;
+ case DDB_ID:
+ case FDB_ID:
+ if ( dblk->blk_type == DDB_ID ) {
+ ddblk->b.d.ddb_attrib = *attrib ;
+ } else {
+ ddblk->b.f.fdb_attrib = *attrib ;
+ }
+
+ if ( *attrib & OBJ_HIDDEN_BIT ) {
+ ddblk->dta.os_attr |= FILE_ATTRIBUTE_HIDDEN ;
+ } else {
+ ddblk->dta.os_attr &= ~FILE_ATTRIBUTE_HIDDEN ;
+ }
+ if ( *attrib & OBJ_READONLY_BIT ) {
+ ddblk->dta.os_attr |= FILE_ATTRIBUTE_READONLY ;
+ } else {
+ ddblk->dta.os_attr &= ~FILE_ATTRIBUTE_READONLY ;
+ }
+ if ( *attrib & OBJ_SYSTEM_BIT ) {
+ ddblk->dta.os_attr |= FILE_ATTRIBUTE_SYSTEM ;
+ } else {
+ ddblk->dta.os_attr &= ~FILE_ATTRIBUTE_SYSTEM ;
+ }
+ if ( *attrib & OBJ_MODIFIED_BIT ) {
+ ddblk->dta.os_attr |= FILE_ATTRIBUTE_ARCHIVE ;
+ } else {
+ ddblk->dta.os_attr &= ~FILE_ATTRIBUTE_ARCHIVE ;
+ }
+ break ;
+ default :
+ break ;
+ }
+
+ }
+ else { /* get data */
+ switch ( dblk->blk_type ) {
+ case CFDB_ID:
+ *attrib = ((CFDB_PTR)dblk)->attributes ;
+ break ;
+ case VCB_ID:
+ *attrib = ((VCB_PTR)dblk)->vcb_attributes ;
+ break ;
+ case DDB_ID:
+ case FDB_ID:
+ if ( dblk->blk_type == DDB_ID ) {
+ *attrib = ddblk->b.d.ddb_attrib ;
+ } else if ( dblk->blk_type == FDB_ID ) {
+ *attrib = ddblk->b.f.fdb_attrib ;
+ }
+
+ if ( ddblk->dta.os_attr & FILE_ATTRIBUTE_READONLY ) {
+ *attrib |= OBJ_READONLY_BIT ;
+ } else {
+ *attrib &= ~OBJ_READONLY_BIT ;
+ }
+
+ if ( ddblk->dta.os_attr & FILE_ATTRIBUTE_ARCHIVE ) {
+ *attrib |= OBJ_MODIFIED_BIT ;
+ } else {
+ *attrib &= ~OBJ_MODIFIED_BIT ;
+ }
+
+ if ( ddblk->dta.os_attr & FILE_ATTRIBUTE_HIDDEN ) {
+ *attrib |= OBJ_HIDDEN_BIT ;
+ } else {
+ *attrib &= ~OBJ_HIDDEN_BIT ;
+ }
+
+ if ( ddblk->dta.os_attr & FILE_ATTRIBUTE_SYSTEM ) {
+ *attrib |= OBJ_SYSTEM_BIT ;
+ } else {
+ *attrib &= ~OBJ_SYSTEM_BIT ;
+ }
+
+ break ;
+ default:
+ *attrib = 0 ;
+ }
+ }
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: NTFS_GetObjTypeDBLK()
+
+ Description: This function looks at the os_id in the provided DBLK
+ and returns the type of the object.
+
+ Modified: 1/14/1992 12:16:32
+
+ Returns: SUCCESS
+
+ Notes: If the os_id is unknown then type is UNKNOWN_OBJECT
+
+**/
+/* begin declaration */
+INT16 NTFS_GetObjTypeDBLK( dblk, type )
+DBLK_PTR dblk ; /* I - Descriptor block to get type of */
+OBJECT_TYPE *type ; /* O - type of DBLK */
+{
+ msassert( type != NULL );
+
+ dblk ;
+ *type = DOS_OBJECT ;
+
+ return( SUCCESS ) ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_GetOS_InfoDBLK()
+
+ Description: This function returns the OS info for the DOS
+ file system
+
+ Modified: 1/14/1992 12:16:55
+
+ Returns: Error Code
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes: This file system has no OS info.
+
+**/
+/* begin declaration */
+INT16 NTFS_GetOS_InfoDBLK( dblk, os_info, size )
+DBLK_PTR dblk ; /* I - DBLK to get the info from */
+BYTE_PTR os_info ; /* O - Buffer to place data */
+INT16 *size ; /*I/O- Buffer size / data length */
+{
+ NT_FILE_OS_INFO UNALIGNED *file_info ;
+ NT_DIR_OS_INFO UNALIGNED *dir_info ;
+ NTFS_DBLK_PTR ddblk ;
+
+ ddblk = (NTFS_DBLK_PTR) dblk ;
+
+ if ( dblk->blk_type == BT_DDB ) {
+
+ dir_info = (NT_DIR_OS_INFO UNALIGNED *) os_info ;
+ dir_info->dir_attributes = ddblk->dta.os_attr ;
+ *size = sizeof ( NT_DIR_OS_INFO ) ;
+
+ } else if ( ddblk->blk_type == BT_FDB ) {
+
+ file_info = (NT_FILE_OS_INFO UNALIGNED *) os_info ;
+ file_info->file_attributes = ddblk->dta.os_attr ;
+ file_info->linkOnly = ddblk->b.f.linkOnly;
+ *size = sizeof ( NT_FILE_OS_INFO ) ;
+
+ // if short name exist then back it up
+
+ if ( ddblk->b.f.alt_name[0] != TEXT('\0') ) {
+
+ file_info->short_name_size = strsize( ddblk->b.f.alt_name ) ;
+ file_info->short_name_offset = sizeof( *file_info ) ;
+ memcpy( (INT8_PTR)(file_info + 1),
+ ddblk->b.f.alt_name,
+ file_info->short_name_size ) ;
+ *size += file_info->short_name_size ;
+
+ } else {
+ file_info->short_name_size = 0 ;
+ file_info->short_name_offset = 0 ;
+ }
+
+ } else {
+
+ *size = 0 ;
+ }
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: NTFS_GetActualSizeDBLK
+
+ Description: This function returns the actual size of a DBLK.
+
+ Modified: 1/14/1992 12:17:33
+
+ Returns: The number of bytes
+
+ Notes:
+
+**/
+/* begin declaration */
+INT16 NTFS_GetActualSizeDBLK( fsh, dblk )
+FSYS_HAND fsh ;
+DBLK_PTR dblk ;
+{
+
+ NTFS_DBLK *ddb ;
+ INT16 size ;
+
+ fsh ;
+
+ ddb = (NTFS_DBLK_PTR)dblk ;
+ size = sizeof( NTFS_DBLK ) ;
+
+ switch( dblk->blk_type ) {
+
+ case DDB_ID:
+ case FDB_ID :
+ break ;
+
+ default:
+ size = 0 ;
+ break ;
+
+ }
+
+ return size ;
+}
+
+/**/
+/**
+
+ Name: NTFS_SetOwnerId()
+
+ Description: does nothing
+
+ Modified: 1/14/1992 12:18:25
+
+ Returns: none
+
+ Notes:
+
+**/
+VOID NTFS_SetOwnerId( fsh, dblk, id )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* O - DBLK to modify */
+UINT32 id ; /* I - value to set it to */
+{
+ fsh ;
+ dblk ;
+ id ;
+}
+
+/**/
+/**
+
+ Name: NTFS_ProcessDDB()
+
+ Description: This function allways returns FALSE to
+ specify that directories should not be restored
+ if there are no file to restore into the directory.
+
+ Modified: 10/23/1989
+
+ Returns: FALSE
+
+ Notes:
+
+**/
+/* begin declaration */
+BOOLEAN NTFS_ProcessDDB( fsh, ddb )
+FSYS_HAND fsh; /* I - file system handle */
+DBLK_PTR ddb; /* I - Directory information */
+{
+ fsh;
+ ddb;
+
+ return TRUE ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_EnumSpecialFiles()
+
+ Description: This function enumerates the special files. For NT
+ the application asks if registry files are to be included
+ before the restore process starts... Thus this function has
+ no purpose.
+
+ Modified: 5/21/1992 19:28:51
+
+ Returns: FS_NO_MORE
+
+ Notes: Starting index must be 0
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 NTFS_EnumSpecFiles( dle, index, path, psize, fname )
+GENERIC_DLE_PTR dle ;
+UINT16 *index ;
+CHAR_PTR *path ;
+INT16 *psize ;
+CHAR_PTR *fname ;
+{
+ CHAR_PTR p ;
+ static CHAR registry_path[ MAX_PATH ] ;
+ BOOLEAN hasSpecialFiles;
+
+ hasSpecialFiles = DLE_HasFeatures( dle, DLE_FEAT_REST_SPECIAL_FILES );
+
+ if ( (*index < 2) && hasSpecialFiles ) {
+
+ *fname = TEXT( "*.") ;
+
+ strcpy( registry_path, dle->info.ntfs->registry_path + strlen( dle->device_name ) + 1 ) ;
+ *psize = strsize( registry_path ) ;
+
+ for( p = registry_path; *p != TEXT('\0'); p++ ) {
+ if ( *p == '\\' ) {
+ *p = TEXT('\0') ;
+ p++ ;
+ }
+ }
+
+ *path = registry_path ;
+
+ *index = 2 ;
+ return SUCCESS ;
+ } else {
+ return FS_NO_MORE ;
+ }
+}
+/**/
+/**
+
+ Name: NTFS_SpecExcludeObj
+
+ Description: This function tells the caller what kind of file a file is.
+ The possibilities are:
+ FS_NORMAL_FILE
+ FS_SPECIAL_DIR
+ FS_SPECIAL_FILE
+ FS_EXCLUDE_FILE
+
+ This function is used to exclude / include the registry. The
+ assumptions are that the nt_system directory contains the following
+ files:
+ Active registry files
+ Inactive registry files
+ Useless .LOG and .ALT files
+ Event logger data files.
+
+
+ Modified: 1/10/1990
+
+ Returns: FS_NORMAL_FILE because this file system has no special
+ files.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 NTFS_SpecExcludeObj(
+FSYS_HAND fsh, /* I - File system handle */
+DBLK_PTR ddb, /* I - Descriptor block of ddb */
+DBLK_PTR fdb ) /* I - Descriptor block of fdb */
+{
+ NTFS_DBLK_PTR nt_fdb = (NTFS_DBLK_PTR)fdb;
+ NTFS_DBLK_PTR nt_ddb = (NTFS_DBLK_PTR)ddb;
+ CHAR_PTR name ;
+ BOOLEAN is_reg_dir = FALSE ;
+
+ return FS_NORMAL_FILE ;
+
+ //Special files are handled differently for ntbackup
+
+ if ( ( nt_fdb != NULL ) && ( nt_ddb != NULL ) ) {
+
+ if ( NTFS_GetRegistryPathSize(fsh->attached_dle) != 0 ) {
+
+ CHAR *p ;
+
+ p = strchr( NTFS_GetRegistryPath( fsh->attached_dle ), TEXT( '\\' ) ) ;
+
+ if ( (p != NULL ) && !stricmp( p+1, nt_ddb->full_name_ptr->name ) ) {
+ is_reg_dir = TRUE ;
+ }
+ }
+
+
+ if ( is_reg_dir ) {
+
+ name = strrchr( nt_fdb->full_name_ptr->name, TEXT('.') ) ;
+
+ if ( name != NULL ) {
+ if ( !stricmp( name, TEXT(".ALT") ) ||
+ !stricmp( name, TEXT(".LOG") ) ) {
+
+ return FS_EXCLUDE_FILE ;
+ }
+ }
+
+ if ( ( name == NULL ) || ( name[1] == TEXT('\0') ) ) {
+ return FS_SPECIAL_FILE ;
+ }
+ }
+ }
+ return FS_NORMAL_FILE ;
+}
+/**/
+/**
+
+ Name: NTFS_MaynToMSoft()
+
+ Description: Translates a Maynard MTF stream ID to a Microsoft
+ BackupRead/BackupWrite stream ID.
+
+ Modified: 05-Oct-92
+
+ Returns: Translated ID if translateable,
+ source ID passed if not.
+
+**/
+UINT32 NTFS_MaynToMSoft( UINT32 maynID )
+{
+ int i;
+ UINT32 ret = maynID;
+ static ID_TRANS_TABLE transTable[] =
+ /* source id ========> result ID */
+ { { STRM_GENERIC_DATA, BACKUP_DATA },
+ { STRM_NT_EA, BACKUP_EA_DATA },
+ { STRM_NT_ACL, BACKUP_SECURITY_DATA },
+ { STRM_NTFS_ALT_DATA, BACKUP_ALTERNATE_DATA },
+ { STRM_NTFS_LINK, BACKUP_LINK },
+ { STRM_INVALID, 0 } /* End of table */
+ };
+
+ for ( i = 0; ( transTable[i].maynID != STRM_INVALID ); i++ )
+ {
+ if ( transTable[i].maynID == maynID )
+ {
+ ret = transTable[i].msoftID;
+ break;
+ }
+ }
+ return ret;
+}
+
+/**/
+/**
+
+ Name: NTFS_MSoftToMayn()
+
+ Description: Translates a Microsoft BackupRead/BackupWrite stream ID
+ to a Maynard MTF stream ID.
+
+ Modified: 05-Oct-92
+
+ Returns: Translated ID if translateable,
+ source ID passed if not.
+
+**/
+UINT32 NTFS_MSoftToMayn( UINT32 msoftID )
+{
+ int i;
+ UINT32 ret = msoftID;
+ static ID_TRANS_TABLE transTable[] =
+ /* result id <=========== source ID */
+ { { STRM_GENERIC_DATA, BACKUP_DATA },
+ { STRM_NT_EA, BACKUP_EA_DATA },
+ { STRM_NT_ACL, BACKUP_SECURITY_DATA },
+ { STRM_NTFS_ALT_DATA, BACKUP_ALTERNATE_DATA },
+ { STRM_NTFS_LINK, BACKUP_LINK },
+ { STRM_INVALID, 0 }
+ };
+
+ for ( i = 0; ( transTable[i].maynID != STRM_INVALID ); i++ )
+ {
+ if ( transTable[i].msoftID == msoftID )
+ {
+ ret = transTable[i].maynID;
+ break;
+ }
+ }
+ return ret;
+}
+
+
diff --git a/private/utils/ntbackup/src/tname.c b/private/utils/ntbackup/src/tname.c
new file mode 100644
index 000000000..e7284a3fa
--- /dev/null
+++ b/private/utils/ntbackup/src/tname.c
@@ -0,0 +1,185 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tname.c
+
+
+ Description: This file contains code to get the device name and
+ volume name for the given DLE.
+
+
+ $Log: T:/LOGFILES/TNAME.C_V $
+
+ Rev 1.6 11 Nov 1992 09:53:44 GREGG
+Unicodeized literals.
+
+ Rev 1.5 07 Oct 1992 14:14:50 STEVEN
+check if volume_label is NULL
+
+ Rev 1.4 07 Oct 1992 13:50:52 DAVEV
+unicode strlen verification
+
+ Rev 1.3 04 Sep 1992 14:28:58 STEVEN
+volume name was wrong
+
+ Rev 1.2 03 Sep 1992 17:06:32 STEVEN
+add support for volume name
+
+ Rev 1.1 21 May 1992 13:50:56 STEVEN
+more long path stuff
+
+ Rev 1.0 18 May 1992 14:29:14 STEVEN
+Initial revision.
+
+ Rev 1.1 16 Dec 1991 17:26:48 STEVEN
+move common functions to tables
+
+ Rev 1.0 10 Dec 1991 09:06:54 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+#include "fsys.h"
+
+/**/
+/**
+
+ Name: NTFS_DeviceDispName()
+
+ Description: This function gets the displayable device name for
+ a DLE. This name is displayed for drive select.
+
+ Modified: 9/13/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 NTFS_DeviceDispName( dle, dev_name, size, type )
+GENERIC_DLE_PTR dle;
+CHAR_PTR dev_name;
+INT16 size ;
+INT16 type ;
+{
+ INT16 req_size = 0 ;
+ CHAR_PTR path = NULL ;
+ INT16 temp_size = 0 ;
+
+ (VOID)type;
+
+ req_size = (INT16)(3 * sizeof(CHAR) ) ;
+ if ( dle->info.ntfs->volume_label != NULL ) {
+ req_size += strsize( dle->info.ntfs->volume_label ) ;
+ }
+
+ if ( size < req_size ) {
+ return FS_BUFFER_TO_SMALL ;
+ }
+
+ strcpy( dev_name, dle->device_name ) ;
+ if ( dle->info.ntfs->volume_label != NULL ) {
+ strcat( dev_name, TEXT(" ") ) ;
+ strcat( dev_name, dle->info.ntfs->volume_label ) ;
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: GEN_GetVolName()
+
+ Description: This function coppies the volume name
+ of the specified drive to the buffer provided.
+
+ Modified: 12/4/1991 9:45:49
+
+**/
+VOID NTFS_GetVolName( dle, buffer )
+GENERIC_DLE_PTR dle;
+CHAR_PTR buffer ;
+{
+ if ( dle->type & HAND_MADE_MASK ) {
+ strcpy( buffer, dle->info.user->vol_name ) ;
+
+ } else {
+
+ if ( dle->info.ntfs->volume_label != NULL ) {
+ strcpy( buffer, dle->device_name ) ;
+ strcat( buffer, TEXT(" ") ) ;
+ strcat( buffer, dle->info.ntfs->volume_label ) ;
+ } else {
+ strcpy( buffer, dle->device_name ) ;
+ }
+ }
+}
+
+/**/
+/**
+
+ Name: NTFS_SizeofVolName()
+
+ Description: This function returns the size of the volume name
+ which will be created by DLE_GetVolName()
+
+ Modified: 12/4/1991 11:14:25
+
+ Returns: size of string including \0;
+
+**/
+INT16 NTFS_SizeofVolName( dle )
+GENERIC_DLE_PTR dle ;
+{
+ INT16 size ;
+
+ if ( dle->type & HAND_MADE_MASK ) {
+ size = (INT16)strsize( dle->info.user->vol_name ) ;
+
+ } else if ( dle->info.ntfs->volume_label == NULL ) {
+ size = 3 * sizeof (CHAR);
+
+ } else {
+ size = (INT16)((strlen( dle->info.ntfs->volume_label ) + 4) * sizeof(CHAR)) ;
+
+ }
+
+ return( size ) ;
+}
+
+/**/
+/**
+
+ Name: NTFS_InitMakeData()
+
+ Description: This function is used to initialize the parameter block
+ which is passed to CreateDBLK.
+
+ Modified: 12/4/1991 14:57:3
+
+ Returns: NONE
+
+ Notes:
+
+**/
+VOID NTFS_InitMakeData(
+FSYS_HAND fsh,
+INT16 blk_type,
+CREATE_DBLK_PTR data ) {
+
+ data->v.std_data.os_id = FS_NTFS_ID ;
+ data->v.std_data.os_ver = FS_NTFS_VER ;
+
+
+ return ;
+}
diff --git a/private/utils/ntbackup/src/topen.c b/private/utils/ntbackup/src/topen.c
new file mode 100644
index 000000000..4b477abec
--- /dev/null
+++ b/private/utils/ntbackup/src/topen.c
@@ -0,0 +1,1339 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: topen.c
+
+ Description: This file contains code to open files
+ and directories.
+
+ $Log: N:\logfiles\topen.c_v $
+
+ Rev 1.56.1.3 15 Jul 1994 19:50:54 STEVEN
+fix more net errors
+
+ Rev 1.56.1.2 17 Jun 1994 20:05:10 STEVEN
+fix bug with net dissconect
+
+ Rev 1.56.1.1 06 May 1994 18:06:36 STEVEN
+fix bug with CONFIG dir on NTFS
+
+ Rev 1.56.1.0 26 Apr 1994 19:01:12 STEVEN
+fis dissconnect bug
+
+ Rev 1.56 04 Jan 1994 20:20:40 BARRY
+Revised fix for access date/time for read-only files and shares
+
+ Rev 1.55 03 Jan 1994 18:42:16 BARRY
+Open files on FS_READ and FS_VERIFY with GENERIC_READ | GENERIC_WRITE.
+(We have to "write" to the file to reset the access date/time
+upon close.)
+
+ Rev 1.54 03 Jan 1994 18:12:18 BARRY
+Changed open flags for increased performance
+
+ Rev 1.53 30 Nov 1993 16:17:12 BARRY
+Added call NTFS_GetTempName for verify in case file has a temp name
+
+ Rev 1.52 24 Nov 1993 14:46:38 BARRY
+Unicode fixes
+
+ Rev 1.51 19 Jul 1993 11:39:28 BARRY
+Open directories for share_write
+
+ Rev 1.50 16 Jul 1993 11:43:20 BARRY
+Don't verify event files.
+
+ Rev 1.49 29 Jun 1993 16:17:04 BARRY
+Skip registry files on verify.
+
+ Rev 1.48 02 Jun 1993 14:40:14 BARRY
+Link fixes.
+
+ Rev 1.47 03 May 1993 20:44:44 BARRY
+Clean up error handling when a remote machine goes away.
+
+ Rev 1.46 02 May 1993 19:46:50 BARRY
+Incorporated Steve's fix for skipping .LOG files on floating registries.
+
+ Rev 1.45 24 Apr 1993 17:24:52 BARRY
+Release the work path semaphore on linked files before returning.
+
+ Rev 1.44 02 Apr 1993 11:49:16 BARRY
+Return more appropriate values on errors in OpenDir
+
+ Rev 1.43 31 Mar 1993 22:10:16 BARRY
+Fixed problem opening read-only directories for WRITE.
+
+ Rev 1.42 12 Mar 1993 15:26:44 STEVEN
+added support for ERROR BAD PATHNAME
+
+ Rev 1.41 24 Feb 1993 15:37:12 BARRY
+Fixed restore of active files when write errors occur.
+
+ Rev 1.40 18 Feb 1993 12:43:50 TIMN
+Report error msg for unsuccessful file open calls EPR(0008)
+
+ Rev 1.39 04 Feb 1993 15:10:42 BARRY
+Fixed open of files in POSIX mode.
+
+ Rev 1.38 01 Feb 1993 19:46:26 STEVEN
+bug fixes
+
+ Rev 1.37 15 Jan 1993 13:18:38 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.36 29 Dec 1992 13:32:56 DAVEV
+unicode fixes (3)
+
+ Rev 1.35 14 Dec 1992 16:36:48 STEVEN
+directories not in use just access denied
+
+ Rev 1.34 07 Dec 1992 14:18:38 STEVEN
+updates from msoft
+
+ Rev 1.33 25 Nov 1992 16:42:28 BARRY
+Fix MakeTempFile and restore over active files.
+
+ Rev 1.32 25 Nov 1992 09:09:12 STEVEN
+OpenEventLog returns NULL if file cannot be opened
+
+ Rev 1.31 24 Nov 1992 11:01:56 BARRY
+Changes to make LINK streams null-impregnated.
+
+ Rev 1.30 23 Nov 1992 09:32:12 STEVEN
+fix support for event log
+
+ Rev 1.29 17 Nov 1992 16:13:58 BARRY
+Null-out link path on each new object.
+
+ Rev 1.28 11 Nov 1992 09:53:34 GREGG
+Unicodeized literals.
+
+ Rev 1.27 10 Nov 1992 13:59:44 STEVEN
+fix open change dir problem
+
+ Rev 1.26 10 Nov 1992 10:12:52 BARRY
+Initialize new structure members for verify changes.
+
+ Rev 1.25 10 Nov 1992 08:19:00 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.24 30 Oct 1992 14:02:40 BARRY
+Fixed a syntactical mistake.
+
+ Rev 1.23 29 Oct 1992 16:53:00 BARRY
+Do nothing for linked files.
+
+ Rev 1.22 28 Oct 1992 12:13:20 STEVEN
+add support for EventLogs
+
+ Rev 1.21 23 Oct 1992 14:59:56 BARRY
+add init for needStreamHeader
+
+ Rev 1.20 20 Oct 1992 14:22:26 STEVEN
+temp names should not have .TMP extension
+
+ Rev 1.16 12 Oct 1992 17:46:00 STEVEN
+now processes ACL
+
+ Rev 1.15 08 Oct 1992 12:25:00 STEVEN
+initialize the hand
+
+ Rev 1.14 07 Oct 1992 15:40:38 STEVEN
+added stdmath.h
+
+ Rev 1.13 07 Oct 1992 14:22:08 STEVEN
+fix typos
+
+ Rev 1.12 07 Oct 1992 13:50:34 DAVEV
+unicode strlen verification
+
+ Rev 1.11 01 Oct 1992 13:27:12 STEVEN
+lets open us some directories
+
+ Rev 1.10 24 Sep 1992 13:24:02 BARRY
+Changes for huge file name support.
+
+ Rev 1.9 20 Aug 1992 14:02:44 BURT
+fix warnings
+
+ Rev 1.8 17 Aug 1992 16:17:24 STEVEN
+fix warnings
+
+ Rev 1.7 12 Aug 1992 17:48:16 STEVEN
+fixed bugs at microsoft
+
+ Rev 1.6 29 May 1992 13:45:26 STEVEN
+fixes
+
+ Rev 1.5 22 May 1992 16:05:18 STEVEN
+
+
+ Rev 1.4 21 May 1992 13:50:58 STEVEN
+more long path stuff
+
+ Rev 1.3 04 May 1992 09:25:16 LORIB
+Changes for variable length paths.
+
+ Rev 1.2 12 Mar 1992 15:50:14 STEVEN
+64 bit changes
+
+ Rev 1.1 28 Feb 1992 13:03:36 STEVEN
+step one for varible length paths
+
+ Rev 1.0 07 Feb 1992 16:41:12 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <winioctl.h>
+#include <string.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+
+#include "beconfig.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "tfldefs.h"
+
+/* Maximum number of attempts to create a temporary file */
+
+#define MAX_ATTEMPTS 65535
+
+
+/*
+ * Common flags for open. In other words, flags we ALWAYS want to use
+ * on calls to CreateFile
+ */
+#define NTFS_OPEN_FLAGS ( FILE_ATTRIBUTE_NORMAL | \
+ FILE_FLAG_BACKUP_SEMANTICS | \
+ FILE_FLAG_SEQUENTIAL_SCAN )
+
+
+static INT16 NTFS_OpenFile( FSYS_HAND fsh, FILE_HAND hand, NTFS_DBLK_PTR fdb, INT16 MODE );
+static INT16 NTFS_OpenDir( FSYS_HAND fsh, FILE_HAND hand, NTFS_DBLK_PTR fdb, INT16 MODE );
+
+static HANDLE NTFS_TryOpenNormal( FSYS_HAND fsh,
+ FILE_HAND hand,
+ NTFS_DBLK_PTR ddblk,
+ CHAR_PTR path,
+ INT16 mode,
+ BOOLEAN in_use,
+ INT posix_flag,
+ INT_PTR status ) ;
+
+static HANDLE NTFS_TryOpenRegistryFile( FILE_HAND fsh, NTFS_DBLK_PTR ddblk, CHAR_PTR path, BOOLEAN *log_file ) ;
+static HANDLE NTFS_TryOpenEventFile( FILE_HAND fsh, NTFS_DBLK_PTR ddblk, CHAR_PTR path ) ;
+static INT16 TranslateOpenError( FILE_HAND hand, DWORD error );
+
+/**/
+
+/**
+
+ Name: NTFS_OpenObj()
+
+ Description: This function opens files or directories.
+
+ Modified: 7/28/1989
+
+ Returns: Error Codes
+ OUT_OF_MEMORY
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ FS_IN_USE_ERROR
+ FS_OPENED_INUSE
+ SUCCESS
+
+ Notes: Valid modes are : READ, WRITE, & VERIFY
+ If a VCB is passed in then this function returns SUCCESS
+
+ See also: $/SEE( NTFS_OpenFile() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 NTFS_OpenObj( fsh, hand, dblk, mode )
+FSYS_HAND fsh ; /* I - file system that the file is opened on */
+FILE_HAND *hand ; /* O - allocated handle */
+DBLK_PTR dblk; /*I/O- describes the file to be opened */
+OPEN_MODE mode ; /* I - open mode */
+{
+ GENERIC_DLE_PTR dle ;
+ INT16 hand_size ;
+ INT16 ret_val = SUCCESS;
+ NTFS_DBLK_PTR ddblk;
+
+ msassert( dblk != NULL );
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ msassert( fsh->attached_dle != NULL );
+ msassert( (dblk->blk_type == FDB_ID) || (dblk->blk_type == DDB_ID) ) ;
+
+ dle = fsh->attached_dle ;
+
+ if ( fsh->hand_in_use ) {
+ hand_size = sizeof( FILE_HAND_STRUCT ) + sizeof ( NTFS_OBJ_HAND );
+ *hand = (FILE_HAND) calloc( 1, hand_size ) ;
+ if ( *hand == NULL ) {
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ } else {
+ *hand = fsh->file_hand ;
+ fsh->hand_in_use = TRUE ;
+ }
+
+ (*hand)->obj_hand.ptr = (VOID_PTR)((*hand) + 1) ;
+ memset( (*hand)->obj_hand.ptr, 0, sizeof( NTFS_OBJ_HAND ) ) ;
+
+
+ if ( ret_val == SUCCESS ) {
+
+ NTFS_OBJ_HAND_PTR nt_hand = (*hand)->obj_hand.ptr;
+ NTFS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+
+ (*hand)->fsh = fsh ;
+ (*hand)->mode = (INT16)mode ;
+ (*hand)->dblk = dblk ;
+
+ nt_hand->nameComplete = FALSE;
+ nt_hand->needStreamHeader = TRUE;
+ nt_hand->streamsAllVisited = FALSE;
+ nt_hand->verifyStreamPos = 0;
+ nt_hand->sawSecurity = FALSE;
+ nt_hand->writeError = FALSE;
+ res->streamIDCount = 0;
+
+ if ( nt_hand->linkBuffer != NULL )
+ {
+ *nt_hand->linkBuffer = TEXT ('\0');
+ }
+ nt_hand->linkNameLen = 0;
+
+
+ switch( dblk->blk_type ){
+
+ case FDB_ID :
+
+ ret_val = NTFS_OpenFile( fsh, *hand, ddblk, (INT16)mode ) ;
+ break ;
+
+ case DDB_ID :
+ ret_val = FS_SavePath( fsh, (UINT8_PTR)TEXT("\\"), 2 * sizeof(CHAR) ) ;
+ if ( ret_val == SUCCESS ) {
+ ret_val = FS_AppendPath( fsh,
+ (UINT8_PTR)ddblk->full_name_ptr->name,
+ (INT16)(strsize( ddblk->full_name_ptr->name )) ) ;
+ }
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = NTFS_OpenDir( fsh, *hand, ddblk, (INT16)mode ) ;
+ }
+ break ;
+
+ case VCB_ID :
+
+ ret_val = SUCCESS ;
+ break ;
+
+ default :
+
+ ret_val = FS_BAD_DBLK ;
+ }
+ }
+
+ if ( ( fsh->attached_dle->info.ntfs->vol_flags & FS_FILE_COMPRESSION ) &&
+ ( mode == FS_WRITE ) &&
+ !(ddblk->b.f.linkOnly) &&
+ ( ret_val == SUCCESS ) ) {
+
+ INT16 compress_mode= 0 ;
+ INT bytes_returned ;
+
+ if ( ddblk->dta.os_attr & FILE_ATTRIBUTE_COMPRESSED ) {
+ compress_mode = 1 ;
+ }
+ if ( !DeviceIoControl(
+ ((NTFS_OBJ_HAND_PTR)(*hand)->obj_hand.ptr)->fhand,
+ FSCTL_SET_COMPRESSION,
+ &compress_mode,
+ 2,
+ NULL,
+ 0,
+ &bytes_returned,
+ NULL) ) {
+
+ ret_val = FS_COMPRES_RESET_FAIL;
+ }
+ }
+
+ if ( ( ret_val != FS_COMPRES_RESET_FAIL ) &&
+ ( ret_val != SUCCESS ) &&
+ ( ret_val != FS_OPENED_INUSE ) ) {
+ if( fsh->file_hand == *hand ) {
+ fsh->hand_in_use = FALSE ;
+ memset( *hand, 0, sizeof( FILE_HAND_STRUCT ) ) ;
+ } else {
+ free( *hand ) ;
+ }
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: NTFS_OpenFile()
+
+ Description: This function opens a file in the current directory.
+ If the file is in use AND we are opening for READ then we
+ will attempt to open the file in DENY_NONE mode. If this
+ is successful then we lock all the records of the file.
+ For VERIFY we allways open in DENY_NONE
+ mode.
+
+ Modified: 7/28/1989
+
+ Returns: Error Codes.
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ FS_IN_USE_ERROR
+ FS_OPENED_INUSE
+ SUCCESS
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 NTFS_OpenFile(
+FSYS_HAND fsh , /* I - file system that the file is opened on */
+FILE_HAND hand , /* O - allocated handle */
+NTFS_DBLK_PTR ddblk , /*I/O- describes the file to be opened */
+INT16 mode ) /* I - open mode */
+{
+ DWORD new_size_low ;
+ DWORD new_size_high ;
+ CHAR_PTR path ;
+ DWORD open_mode ;
+ DWORD open_share ;
+ DWORD create_mode ;
+ HANDLE temp_hand ;
+ INT16 ret_val ;
+ NTFS_OBJ_HAND_PTR nt_hand ;
+ INT posix_flag = 0 ;
+ BOOLEAN log_file ;
+ INT status ;
+
+ nt_hand = ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr) ;
+
+ hand->opened_in_use = FALSE ;
+ hand->fsh = fsh ;
+ hand->size = 0 ;
+ hand->obj_pos = 0 ;
+
+ if ( (mode == FS_WRITE) && ((NTFS_DBLK_PTR)(hand->dblk))->b.f.linkOnly )
+ {
+ return SUCCESS;
+ }
+
+ if ( NTFS_SetupWorkPath( fsh,
+ fsh->cur_dir,
+ ddblk->full_name_ptr->name,
+ &path ) != SUCCESS) {
+ return OUT_OF_MEMORY ;
+ }
+
+ if ( ddblk->b.f.PosixFile ) {
+ posix_flag = FILE_FLAG_POSIX_SEMANTICS ;
+ }
+
+ if( ( mode == FS_WRITE ) && ( ddblk->b.f.handle != 0 ) )
+ {
+ temp_hand = (HANDLE)ddblk->b.f.handle ;
+ nt_hand->registry_file = ddblk->b.f.hand_registry ;
+ nt_hand->temp_file = ddblk->b.f.hand_temp_name ;
+ ret_val = SUCCESS ;
+ }
+ else
+ {
+ if ( mode == FS_VERIFY )
+ {
+ path = NTFS_GetTempName( path );
+ }
+
+
+ temp_hand = NTFS_TryOpenNormal( fsh, hand, ddblk, path, mode, FALSE, posix_flag, &status ) ;
+
+ if ( temp_hand != INVALID_HANDLE_VALUE )
+ {
+ ret_val = SUCCESS ;
+ }
+ else
+ {
+ ret_val = TranslateOpenError( hand, status );
+
+ }
+
+ if ( (ret_val == FS_IN_USE_ERROR ) &&
+ (mode == FS_READ) &&
+ (BEC_GetBackupFilesInUse(fsh->cfg)) )
+ {
+ /*
+ * If the file is in use, opening with ability to reset
+ * attributes and dates is pointless.
+ */
+ temp_hand = NTFS_TryOpenNormal( fsh,
+ hand,
+ ddblk,
+ path,
+ mode,
+ TRUE,
+ posix_flag,
+ &status ) ;
+
+
+ if ( temp_hand != INVALID_HANDLE_VALUE )
+ {
+
+ ret_val = SUCCESS ;
+ }
+ else
+ {
+
+ ret_val = TranslateOpenError( hand, status );
+
+ }
+
+
+ if ( ret_val == SUCCESS )
+ {
+ if ( LockFile( temp_hand, 0L, 0L, 0xffffffffL, 0x7fffffffL ) )
+ {
+ hand->opened_in_use = TRUE ;
+ ddblk->b.f.fdb_attrib |= FILE_IN_USE_BIT ;
+ ret_val = FS_OPENED_INUSE ;
+ }
+ else
+ {
+ NTFS_DebugPrint( TEXT("NTFS_OpenFile: LockFile error %d")
+ TEXT(" on file \"%s\""),
+ (int)GetLastError(),
+ path );
+
+ CloseHandle( temp_hand ) ;
+ ret_val = FS_IN_USE_ERROR ;
+ }
+ }
+ }
+
+ if ( ( temp_hand == INVALID_HANDLE_VALUE ) && ( mode != FS_WRITE ) ) {
+
+ CHAR event_name[256] ;
+
+ if ( (mode == FS_VERIFY) &&
+ (REG_IsRegistryFile( hand->fsh->attached_dle, path ) ||
+ REG_IsEventFile( hand->fsh->attached_dle, path, &event_name[0] ))) {
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ return FS_SKIP_OBJECT;
+
+ } else {
+
+ temp_hand = NTFS_TryOpenRegistryFile( hand, ddblk, path, &log_file ) ;
+
+ if ( temp_hand != INVALID_HANDLE_VALUE ) {
+ ret_val = SUCCESS ;
+ } else {
+ if ( log_file ) {
+ ret_val = FS_NOT_FOUND ;
+ }
+ }
+ }
+ }
+
+ if ( ( temp_hand == INVALID_HANDLE_VALUE ) && ( mode != FS_WRITE ) ) {
+
+ temp_hand = NTFS_TryOpenEventFile( hand, ddblk, path ) ;
+
+ if ( temp_hand != INVALID_HANDLE_VALUE ) {
+ ret_val = SUCCESS ;
+ }
+ }
+ }
+
+ if ( ( mode == FS_READ ) && ( temp_hand != INVALID_HANDLE_VALUE ) ) {
+ new_size_low = GetFileSize( temp_hand, &new_size_high ) ;
+ if ( ( new_size_low != 0xffffffff ) || !GetLastError() ) {
+ ddblk->dta.size = U64_Init( (UINT32)new_size_low, (UINT32)new_size_high ) ;
+ }
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ if( ( ret_val == SUCCESS ) || ( ret_val == FS_OPENED_INUSE ) ) {
+
+ ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr)->fhand = temp_hand ;
+ ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr)->context = NULL ;
+
+ hand->size = 0 ;
+ }
+
+ /* Let's collect the link information for this file */
+ if ( (mode == FS_READ) &&
+ ((ret_val == SUCCESS) || (ret_val == FS_OPENED_INUSE)) )
+ {
+ BY_HANDLE_FILE_INFORMATION info;
+ HANDLE fhand;
+
+ fhand = ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr)->fhand;
+
+ if ( GetFileInformationByHandle( fhand, &info ) )
+ {
+ NTFS_LINK_Q_ELEM_PTR linkElem = NULL;
+
+ ddblk->b.f.idHi = info.nFileIndexHigh;
+ ddblk->b.f.idLo = info.nFileIndexLow;
+ ddblk->b.f.linkCount = info.nNumberOfLinks;
+
+ if ( ddblk->b.f.linkCount > 1 )
+ {
+ linkElem = NTFS_SearchLinkQueue( fsh,
+ ddblk->b.f.idHi,
+ ddblk->b.f.idLo );
+ }
+
+ /*
+ * If there is a file with the same ID in the link q already,
+ * then set up the linkOnly flag in the DBLK. When ReadObj
+ * is called, only the path and file name will be backed up.
+ */
+ ddblk->b.f.linkOnly = (linkElem != NULL);
+ ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr)->linkPtr = linkElem;
+ }
+ else
+ {
+ /*
+ * If we can't get the info, then we better do what's
+ * necessary for the file to be backed up normally.
+ */
+ ddblk->b.f.idLo = 0;
+ ddblk->b.f.idHi = 0;
+ ddblk->b.f.linkOnly = FALSE;
+ ddblk->b.f.linkCount = 1;
+ }
+ }
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: NTFS_TryOpenNormalFile()
+
+ Description: This function opens a file a "normal" file specified
+ by the path passed in. A "normal" file is one that can be
+ opened with CreateFile(). It is not a Registry file or an
+ event file.
+
+ Since we want to open with the most possible access, we have to
+ try the highest access mode and then move to less access as we
+ get failures.
+
+ Modified: 1/7/95
+
+ Returns: NT file handle
+
+ Declaration:
+
+**/
+static HANDLE NTFS_TryOpenNormal( FSYS_HAND fsh,
+ FILE_HAND hand,
+ NTFS_DBLK_PTR ddblk,
+ CHAR_PTR path,
+ INT16 mode,
+ BOOLEAN in_use,
+ INT posix_flag,
+ INT_PTR status ) {
+
+ DWORD open_mode ;
+ DWORD open_share ;
+ DWORD create_mode ;
+ HANDLE temp_hand ;
+ INT16 ret_val ;
+
+ open_share = FILE_SHARE_READ ;
+
+ switch ( mode ) {
+
+ case FS_VERIFY:
+ open_share |= FILE_SHARE_WRITE ;
+ case FS_READ:
+ open_mode = GENERIC_READ | FILE_WRITE_ATTRIBUTES | ACCESS_SYSTEM_SECURITY ;
+ create_mode = OPEN_EXISTING ;
+
+ if ( in_use ) {
+ open_share |= FILE_SHARE_WRITE ;
+ open_mode &= ~FILE_WRITE_ATTRIBUTES ;
+ }
+
+ break ;
+
+ case FS_WRITE:
+ default :
+ msassert( FALSE );
+ }
+
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ open_share,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS | posix_flag,
+ NULL ) ;
+
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ *status = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenFile: CreateFile(1) error %d")
+ TEXT(" on file \"%s\""),
+ *status,
+ path );
+
+ ret_val = TranslateOpenError( hand, *status );
+
+ /*
+ * If we opened with the POSIX bit and the file wasn't found,
+ * let's try to open without POSIX and see what happens.
+ */
+
+ if ( posix_flag && ddblk->b.f.PosixFile && (ret_val == FS_NOT_FOUND) ) {
+
+ posix_flag = 0;
+
+ temp_hand = NTFS_TryOpenNormal( fsh, hand, ddblk, path, mode, in_use, posix_flag, status ) ;
+
+ } else if ( mode == FS_WRITE ) {
+ return ( temp_hand ) ;
+
+ } else {
+ ret_val = SUCCESS ;
+ if ( open_mode & FILE_WRITE_ATTRIBUTES ) {
+ open_mode &= ~FILE_WRITE_ATTRIBUTES ;
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ open_share,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS | posix_flag,
+ NULL ) ;
+ }
+
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ *status = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenFile: CreateFile(2) error %d")
+ TEXT(" on file \"%s\""),
+ *status,
+ path );
+
+ ret_val = TranslateOpenError( hand, *status );
+ }
+
+ if ( ret_val == FS_ACCESS_DENIED )
+ {
+
+ ret_val = SUCCESS ;
+ if ( !in_use ) {
+ open_mode |= FILE_WRITE_ATTRIBUTES ;
+ }
+ open_mode &= ~ACCESS_SYSTEM_SECURITY ;
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ open_share,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS | posix_flag,
+ NULL ) ;
+
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ *status = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenFile: CreateFile(3) error %d")
+ TEXT(" on file \"%s\""),
+ *status,
+ path );
+
+ ret_val = TranslateOpenError( hand, *status );
+ }
+ }
+
+ if ( !in_use && (ret_val == FS_ACCESS_DENIED) )
+ {
+
+ ret_val = SUCCESS ;
+ open_mode &= ~FILE_WRITE_ATTRIBUTES ;
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ open_share,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS | posix_flag,
+ NULL ) ;
+
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ *status = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenFile: CreateFile(4) error %d")
+ TEXT(" on file \"%s\""),
+ *status,
+ path );
+
+ }
+ }
+ }
+ }
+ return temp_hand ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_OpenDir()
+
+ Description: This function opens a directory for for processing.
+ If this is a special Object we will open the special file.
+ Otherwise we will process any long path followed by any
+ data associated with the object.
+
+ Modified: 5/21/1992 17:54:42
+
+ Returns: Error Codes.
+ FS_NOT_FOUND
+ SUCCESS
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 NTFS_OpenDir(
+FSYS_HAND fsh , /* I - file system that the file is opened on */
+FILE_HAND hand , /* O - allocated handle */
+NTFS_DBLK_PTR ddblk, /*I/O- describes the file to be opened */
+INT16 mode ) /* I - open mode */
+{
+ CHAR_PTR path ;
+ DWORD open_mode ;
+ DWORD create_mode ;
+ DWORD share_write = 0 ;
+ HANDLE temp_hand ;
+ INT16 ret_val = SUCCESS ;
+ DWORD osError = NO_ERROR;
+
+ hand->opened_in_use = FALSE ;
+ hand->fsh = fsh ;
+ hand->size = 0 ;
+ hand->obj_pos = 0 ;
+
+ if ( NTFS_SetupWorkPath( fsh, fsh->cur_dir, NULL, &path ) != SUCCESS)
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ switch ( mode ) {
+
+ case FS_READ:
+ case FS_VERIFY:
+ open_mode = GENERIC_READ | ACCESS_SYSTEM_SECURITY ;
+ create_mode = OPEN_EXISTING ;
+ break ;
+
+ case FS_WRITE:
+ open_mode = GENERIC_WRITE | ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER ;
+ create_mode = OPEN_ALWAYS ;
+ share_write = FILE_SHARE_WRITE ;
+ break ;
+
+ default :
+ msassert( FALSE );
+
+ }
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ FILE_SHARE_READ | share_write,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS,
+ NULL ) ;
+
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ DWORD dirAttrs;
+
+ osError = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenDir: CreateFile(1) error %d")
+ TEXT(" on dir \"%s\""),
+ (int)osError,
+ path );
+
+
+ dirAttrs = GetFileAttributes( path );
+
+ /*
+ * If the open failed, examine the attributes to see if maybe
+ * the directory has some funny attributes set on it that are
+ * preventing us for opening with write permission. If that's
+ * the case, clear all the attributes and try again. If the
+ * open still failed, restore the attributes to what they were.
+ */
+
+ if ( (dirAttrs != FILE_ATTRIBUTE_NORMAL) &&
+ (dirAttrs != 0xffffffff) && ( mode == FS_WRITE ) )
+ {
+
+ SetFileAttributes( path, FILE_ATTRIBUTE_NORMAL );
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ FILE_SHARE_READ | share_write,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS,
+ NULL ) ;
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ osError = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenDir: CreateFile(2) error %d")
+ TEXT(" on dir \"%s\""),
+ (int)osError,
+ path );
+
+ open_mode &= ~ACCESS_SYSTEM_SECURITY ;
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ FILE_SHARE_READ | share_write,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS,
+ NULL ) ;
+ }
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ osError = GetLastError();
+ SetFileAttributes( path, dirAttrs );
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenDir: CreateFile(3) error %d")
+ TEXT(" on dir \"%s\""),
+ (int)osError,
+ path );
+
+
+ }
+ }
+ else
+ {
+
+ open_mode &= ~ACCESS_SYSTEM_SECURITY ;
+
+ temp_hand = CreateFile( path,
+ open_mode,
+ FILE_SHARE_READ | share_write,
+ NULL,
+ create_mode,
+ NTFS_OPEN_FLAGS,
+ NULL ) ;
+
+
+ if ( temp_hand == INVALID_HANDLE_VALUE )
+ {
+ DWORD dirAttrs;
+
+ osError = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_OpenDir: CreateFile(4) error %d")
+ TEXT(" on dir \"%s\""),
+ (int)osError,
+ path );
+ }
+ }
+ }
+
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ if ( temp_hand != INVALID_HANDLE_VALUE )
+ {
+ ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr)->fhand = temp_hand ;
+ ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr)->context = NULL ;
+ hand->size = 0 ;
+ ret_val = SUCCESS ;
+ }
+ else
+ {
+ ret_val = TranslateOpenError( hand, osError );
+ }
+ return ret_val ;
+}
+
+static HANDLE NTFS_TryOpenRegistryFile(
+FILE_HAND hand,
+NTFS_DBLK_PTR ddblk,
+CHAR_PTR path,
+BOOLEAN *log_file )
+{
+ CHAR_PTR temp_name ;
+ HANDLE temp_hand = INVALID_HANDLE_VALUE ;
+ NTFS_OBJ_HAND_PTR nt_hand ;
+
+ *log_file = FALSE ;
+
+ nt_hand = ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr) ;
+
+ if ( !REG_IsRegistryFile( hand->fsh->attached_dle, path ) )
+ {
+ CHAR *p ;
+ p = strrchr( path, TEXT('.')) ;
+ if ( p != NULL )
+ {
+ *p = TEXT('\0') ;
+
+ if ( REG_IsRegistryFile( hand->fsh->attached_dle, path ) )
+ {
+ *log_file = TRUE ;
+ }
+ *p = TEXT('.') ;
+ }
+ return INVALID_HANDLE_VALUE ;
+ }
+ else
+ { // the file is a registry file
+
+ temp_name = NTFS_MakeTempName( path, TEXT("REG") ) ;
+ if ( temp_name == NULL )
+ {
+ return INVALID_HANDLE_VALUE ;
+ }
+
+ if ( REG_BackupRegistryFile( hand->fsh->attached_dle,
+ path,
+ temp_name ) != SUCCESS )
+ {
+ CHAR *p;
+
+ free( temp_name ) ;
+
+ p = strrchr( path, TEXT('\\') ) ;
+ if ( p== NULL ) {
+ return INVALID_HANDLE_VALUE ;
+ }
+
+ *p = TEXT('\0') ;
+ temp_name = NTFS_MakeTempName( path, TEXT("REG") ) ;
+ *p = TEXT('\\') ;
+
+ if ( temp_name == NULL )
+ {
+ return INVALID_HANDLE_VALUE ;
+ }
+
+ if ( REG_BackupRegistryFile( hand->fsh->attached_dle,
+ path,
+ temp_name ) != SUCCESS )
+ {
+ free( temp_name ) ;
+ return INVALID_HANDLE_VALUE ;
+ }
+ }
+
+ temp_hand = CreateFile( temp_name,
+ GENERIC_READ | FILE_WRITE_ATTRIBUTES,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ NTFS_OPEN_FLAGS,
+ NULL ) ;
+
+ if ( temp_hand != INVALID_HANDLE_VALUE )
+ {
+ nt_hand->temp_file = temp_name ;
+ nt_hand->registry_file = TRUE ;
+ }
+ else
+ {
+ NTFS_DebugPrint( TEXT("NTFS_TryOpenRegistryFile: CreateFile error %d")
+ TEXT(" on file \"%s\" as temp file \"%s\""),
+ GetLastError(),
+ path,
+ temp_name );
+ }
+ }
+ return temp_hand;
+}
+static HANDLE NTFS_TryOpenEventFile(
+FILE_HAND hand,
+NTFS_DBLK_PTR ddblk,
+CHAR_PTR path )
+{
+ CHAR_PTR temp_name ;
+ HANDLE temp_hand = INVALID_HANDLE_VALUE ;
+ NTFS_OBJ_HAND_PTR nt_hand ;
+ HANDLE evt_hand ;
+ CHAR event_name[256] ;
+
+ nt_hand = ((NTFS_OBJ_HAND_PTR)hand->obj_hand.ptr) ;
+
+ if ( REG_IsEventFile( hand->fsh->attached_dle, path, &event_name[0] ) )
+ {
+ evt_hand = OpenEventLog( NULL, event_name ) ;
+
+ if ( evt_hand == NULL )
+ {
+ return INVALID_HANDLE_VALUE ;
+ }
+ else
+ { // the file is a registry file
+
+ temp_name = NTFS_MakeTempName( path, TEXT("REG") ) ;
+ if ( temp_name == NULL )
+ {
+ return INVALID_HANDLE_VALUE ;
+ }
+
+ if ( BackupEventLog( evt_hand,
+ temp_name ) != TRUE )
+ {
+ CHAR *p;
+
+ free( temp_name ) ;
+ p = strrchr( path, TEXT('\\') ) ;
+ if ( p == NULL ) {
+ CloseEventLog( evt_hand ) ;
+ return INVALID_HANDLE_VALUE ;
+ }
+
+ *p = TEXT('\0') ;
+ temp_name = NTFS_MakeTempName( path, TEXT("REG") ) ;
+ *p = TEXT('\\') ;
+
+ if ( temp_name == NULL )
+ {
+ CloseEventLog( evt_hand ) ;
+ return INVALID_HANDLE_VALUE ;
+ }
+
+ if ( BackupEventLog( evt_hand,
+ temp_name ) != TRUE )
+ {
+
+
+ NTFS_DebugPrint( TEXT("NTFS_TryOpenEventFile: BackupEventLog error %d")
+ TEXT(" on file \"%s\" as temp file \"%s\""),
+ GetLastError(),
+ path,
+ temp_name );
+
+ free( temp_name ) ;
+ CloseEventLog( evt_hand ) ;
+ return INVALID_HANDLE_VALUE ;
+ }
+ }
+
+ CloseEventLog( evt_hand ) ;
+
+ temp_hand = CreateFile( temp_name,
+ GENERIC_READ | FILE_WRITE_ATTRIBUTES,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ NTFS_OPEN_FLAGS,
+ NULL ) ;
+
+ if ( temp_hand != INVALID_HANDLE_VALUE )
+ {
+ nt_hand->temp_file = temp_name ;
+ nt_hand->registry_file = TRUE ;
+ }
+ else
+ {
+ NTFS_DebugPrint( TEXT("NTFS_TryOpenEventFile: CreateFile error %d")
+ TEXT(" on file \"%s\" as temp file \"%s\""),
+ GetLastError(),
+ path,
+ temp_name );
+ }
+ }
+ }
+ return temp_hand;
+}
+
+CHAR_PTR NTFS_MakeTempName(
+CHAR_PTR path,
+CHAR_PTR prefix)
+{
+ static unsigned int counter = 0;
+ unsigned int attempts = 0;
+ CHAR_PTR template ;
+ CHAR_PTR fileName;
+ HANDLE fHandle;
+ BOOLEAN ret = FALSE;
+
+ /* Make sure the path and file name are separated by backslash. */
+
+ template = malloc( strsize( path ) + 15 * sizeof(CHAR) ) ;
+ if ( template == NULL )
+ {
+ return NULL ;
+ }
+ strcpy( template, path );
+
+ if ( (fileName = strrchr( template, TEXT('\\'))) != NULL )
+ {
+ fileName++;
+ }
+ else
+ {
+ fileName = template ;
+ }
+
+ do {
+ if ( counter >= 65535 )
+ {
+ counter = 0; /* Wrap the counter at 16 bits */
+ }
+
+ sprintf( fileName, TEXT("%s%05u"), prefix, counter++ );
+
+ fHandle = CreateFile( template,
+ GENERIC_READ, /* Mode */
+ 0, /* No sharing */
+ NULL, /* Security */
+ OPEN_EXISTING, /* Check only */
+ 0, /* Attributes */
+ 0 ); /* Template file */
+
+ if ( fHandle == INVALID_HANDLE_VALUE )
+ {
+ DWORD lastError;
+
+ /*
+ * This little scheme probably won't work unless the reason
+ * we couldn't open the file is because it wasn't found. If
+ * it wasn't found, we'll assume that we have a shot at
+ * creating it. Otherwise, there's probably no point in
+ * iterating 64K times hunting for a unique file name.
+ */
+
+ lastError = GetLastError( );
+
+ if ( lastError == ERROR_FILE_NOT_FOUND )
+ {
+ ret = TRUE;
+ break;
+ }
+ else if ( lastError != ERROR_SHARING_VIOLATION )
+ {
+ break;
+ }
+ }
+ else
+ {
+ /* We were able to open it, so it exists. Let's try again. */
+ CloseHandle( fHandle );
+ }
+
+ } while ( attempts++ < MAX_ATTEMPTS );
+
+ return template ;
+}
+
+
+static INT16 TranslateOpenError( FILE_HAND hand, DWORD error )
+{
+ INT16 ret_val;
+
+ switch ( error )
+ {
+ case ERROR_SUCCESS:
+ ret_val = SUCCESS;
+ break;
+
+ case ERROR_PRIVILEGE_NOT_HELD :
+ case ERROR_ACCESS_DENIED:
+ ret_val = FS_ACCESS_DENIED;
+ break;
+
+ case ERROR_PATH_NOT_FOUND:
+ case ERROR_FILE_NOT_FOUND:
+ case ERROR_INVALID_NAME:
+ case ERROR_BAD_PATHNAME:
+ ret_val = FS_NOT_FOUND;
+ break;
+
+ case ERROR_NETNAME_DELETED:
+ case ERROR_BAD_NET_NAME:
+ case ERROR_BAD_NETPATH:
+ case ERROR_UNEXP_NET_ERR:
+ {
+ GENERIC_DLE_PTR dle = hand->fsh->attached_dle;
+
+ if ( DLE_HasFeatures( dle, DLE_FEAT_REMOTE_DRIVE ) )
+ {
+ // Might be nice to somehow see if the net is really dead.
+ ret_val = FS_COMM_FAILURE;
+ }
+ else
+ {
+ ret_val = FS_ACCESS_DENIED;
+ }
+ break;
+ }
+
+ default:
+ if ( hand->dblk->blk_type == FDB_ID )
+ {
+ // The UI can only handle this error on FDBs -- it
+ // never examines the block type!
+ ret_val = FS_IN_USE_ERROR;
+ }
+ else
+ {
+ ret_val = FS_ACCESS_DENIED;
+ }
+ break;
+ }
+ return ret_val;
+}
+
+
diff --git a/private/utils/ntbackup/src/tposmisc.c b/private/utils/ntbackup/src/tposmisc.c
new file mode 100644
index 000000000..975f6e21b
--- /dev/null
+++ b/private/utils/ntbackup/src/tposmisc.c
@@ -0,0 +1,460 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tposmisc.c
+
+ Description: Various miscellaneous functions used by the
+ tape positioners.
+
+ $Log: J:\ui\logfiles\tposmisc.c_v $
+
+ Rev 1.27 07 Feb 1994 02:06:08 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.26 28 Jan 1994 10:57:24 MIKEP
+preserve YESYES flag when prompting for tapes
+
+ Rev 1.25 21 Apr 1993 08:46:56 CARLS
+changed ViewDescriptionInVCB to ViewSetName in function UI_DisplayVCB
+
+ Rev 1.24 12 Apr 1993 16:05:54 MIKEP
+fix null pointer check
+
+ Rev 1.23 07 Mar 1993 16:34:26 GREGG
+Call _sleep for OS_WIN32 only.
+
+ Rev 1.22 17 Feb 1993 10:43:50 STEVEN
+changes from mikep
+
+ Rev 1.21 07 Oct 1992 14:54:02 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.20 04 Oct 1992 19:41:22 DAVEV
+Unicode Awk pass
+
+ Rev 1.19 27 Jul 1992 11:10:52 JOHNWT
+ChuckB checked in for John Wright, who is no longer with us.
+
+ Rev 1.18 14 May 1992 17:24:04 MIKEP
+nt pass 2
+
+ Rev 1.17 02 Mar 1992 17:13:42 CARLS
+changes to UI_CheckUserAbort
+
+ Rev 1.16 29 Feb 1992 08:48:16 CARLS
+change to UI_CheckUserAbort - spelling error
+
+ Rev 1.15 29 Feb 1992 08:44:42 CARLS
+change to UI_CheckUserAbort
+
+ Rev 1.14 27 Feb 1992 15:58:06 MIKEP
+remove promptnexttape
+
+ Rev 1.13 25 Feb 1992 21:07:50 GLENN
+Overhauled UI_AskUserForTape and related calls, Replaced gszTprinfBuffer with
+RSM_Sprintf to fix problem with overwriting buffer.
+
+ Rev 1.12 14 Feb 1992 16:28:00 MIKEP
+header changes for NT
+
+ Rev 1.11 22 Jan 1992 16:56:58 JOHNWT
+fixed next tape prompt
+
+ Rev 1.10 21 Jan 1992 16:54:34 JOHNWT
+removed checkyy flag
+
+ Rev 1.9 14 Jan 1992 13:58:44 JOHNWT
+fixed -1 tape # in DISPLAY_BSD_VCB
+
+ Rev 1.8 10 Jan 1992 13:37:10 JOHNWT
+internationalization round 2
+
+ Rev 1.7 10 Jan 1992 12:38:50 JOHNWT
+added UI_DisplayBSDVCB
+
+ Rev 1.6 20 Dec 1991 09:32:58 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.5 18 Dec 1991 14:08:20 GLENN
+Added windows.h
+
+ Rev 1.4 04 Dec 1991 09:19:38 JOHNWT
+changed RES_TAPE_REQUEST format
+
+ Rev 1.3 03 Dec 1991 18:14:28 JOHNWT
+added UI_RequestTape
+
+ Rev 1.2 02 Dec 1991 11:17:18 JOHNWT
+NT full tape msgs
+
+ Rev 1.1 25 Nov 1991 15:29:04 JOHNWT
+removed yprompt
+
+ Rev 1.0 20 Nov 1991 19:28:26 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static INT16 UI_AskUserForTape( INT, CHAR_PTR );
+
+/*****************************************************************************
+
+ Name: UI_UpdateTpos
+
+ Description: This function updates the TPOS structure used by the
+ tape positioners and Tape Format to reflect the current
+ location on tape for subsequent positioning requests. If
+ the next set is desired by the user, the TPOS backup set
+ entry is incremented from the current VCB set value.
+
+ Returns: UI_NEW_POSITION_REQUESTED or UI_END_POSITIONING
+
+*****************************************************************************/
+UINT16 UI_UpdateTpos(
+TPOS_PTR tpos,
+DBLK_PTR cur_vcb,
+BOOLEAN next_set_desired )
+{
+
+ /* set current tape position defined by the vcb in the tpos structure */
+
+ tpos->tape_id = FS_ViewTapeIDInVCB( cur_vcb );
+ tpos->tape_seq_num = FS_ViewTSNumInVCB( cur_vcb );
+
+ if ( next_set_desired ) {
+ tpos->backup_set_num = (INT16) (FS_ViewBSNumInVCB( cur_vcb ) + 1);
+ return( UI_NEW_POSITION_REQUESTED );
+ }
+ else {
+ tpos->backup_set_num = FS_ViewBSNumInVCB( cur_vcb );
+ return( UI_END_POSITIONING );
+ }
+
+}
+
+/*****************************************************************************
+
+ Name: UI_DisplayVCB
+
+ Description: This function displays the current VCB in the status window
+ and is used by the tape positioners.
+
+ Returns: N/A
+
+*****************************************************************************/
+VOID UI_DisplayVCB( DBLK_PTR vcb_ptr )
+{
+ CHAR date_str[ MAX_UI_DATE_SIZE ];
+ CHAR time_str[ MAX_UI_TIME_SIZE ];
+ DATE_TIME_PTR dt = FS_ViewBackupDateInVCB( vcb_ptr );
+
+ UI_MakeDateString( date_str, dt->month, dt->day, dt->year % 100 );
+ UI_MakeShortTimeString( time_str, dt->hour, dt->minute );
+
+ yresprintf( RES_DISPLAY_VCB,
+ FS_ViewVolNameInVCB( vcb_ptr ),
+ date_str,
+ time_str,
+ FS_ViewBSNumInVCB( vcb_ptr ),
+ FS_ViewTSNumInVCB( vcb_ptr ),
+ FS_ViewSetNameInVCB( vcb_ptr ) );
+
+ JobStatusBackupRestore(JOB_STATUS_LISTBOX);
+
+}
+
+/*****************************************************************************
+
+ Name: UI_DisplayBSDVCB
+
+ Description: This function displays the VCB in the BSD in the status
+ window and is used by the tape positioners.
+
+ Returns: N/A
+
+*****************************************************************************/
+VOID UI_DisplayBSDVCB( BSD_PTR bsd_ptr )
+{
+ CHAR date_str[ MAX_UI_DATE_SIZE ];
+ CHAR time_str[ MAX_UI_TIME_SIZE ];
+ QTC_BSET_PTR bset_ptr;
+
+ INT16 tape_seq_num = -1;
+
+ DATE_TIME_PTR dt = BSD_ViewDate( bsd_ptr );
+
+ UI_MakeDateString( date_str, dt->month, dt->day, dt->year % 100 );
+ UI_MakeShortTimeString( time_str, dt->hour, dt->minute );
+
+
+ bset_ptr = QTC_FindBset( BSD_GetTapeID( bsd_ptr ),
+ BSD_GetTapeNum( bsd_ptr ),
+ BSD_GetSetNum( bsd_ptr ) );
+
+ if ( bset_ptr != NULL ) {
+ tape_seq_num = (INT16)bset_ptr->tape_seq_num;
+ }
+
+ yresprintf( RES_DISPLAY_BSD_VCB,
+ tape_seq_num,
+ BSD_GetTapeLabel( bsd_ptr ),
+ date_str,
+ time_str,
+ BSD_GetSetNum( bsd_ptr ),
+ BSD_GetBackupLabel( bsd_ptr ) );
+
+ JobStatusBackupRestore( JOB_STATUS_LISTBOX );
+
+ lresprintf( LOGGING_FILE, LOG_MSG, SES_ENG_MSG, RES_DISPLAY_BSD_VCB,
+ tape_seq_num,
+ BSD_GetTapeLabel( bsd_ptr ),
+ date_str,
+ time_str,
+ BSD_GetSetNum( bsd_ptr ),
+ BSD_GetBackupLabel( bsd_ptr ) );
+
+}
+
+/*****************************************************************************
+
+ Name: UI_InsertTape
+
+ Description: This function prompts the user to insert a tape into the
+ drive when one had not been supplied previously.
+
+ Returns: ( UI_AskUserForTape() )
+
+*****************************************************************************/
+INT16 UI_InsertTape( CHAR_PTR drive_name )
+{
+
+ return( UI_AskUserForTape( RES_TAPE_NOT_INSERTED, drive_name ) );
+}
+
+/*****************************************************************************
+
+ Name: UI_ReplaceTape
+
+ Description: This function prompts the user if they wish to replace
+ a given tape. A prior call to UI_DisplayVCB should be
+ performed prior to calling this function.
+
+ Returns: ( UI_AskUserForTape() )
+
+*****************************************************************************/
+INT16 UI_ReplaceTape( CHAR_PTR drive_name )
+{
+ return( UI_AskUserForTape( RES_REPLACE_OLD_TAPE, drive_name ) );
+}
+
+/*****************************************************************************
+
+ Name: UI_ReplaceBlankTape
+
+ Description: This function prompts the user to supply a tape with
+ data on it for read functions
+
+ Returns: ( UI_ReplaceTape() )
+
+*****************************************************************************/
+INT16 UI_ReplaceBlankTape( CHAR_PTR drive_name )
+{
+
+ return( UI_AskUserForTape( RES_BLANK_TAPE, drive_name ) );
+}
+
+/*****************************************************************************
+
+ Name: UI_ReplaceForeignTape
+
+ Description: This function prompts the user to replace the tape in
+ the drive with a non-foreign tape
+
+ Returns: ( UI_ReplaceTape() )
+
+*****************************************************************************/
+INT16 UI_ReplaceForeignTape( CHAR_PTR drive_name )
+{
+
+ return( UI_AskUserForTape( RES_FOREIGN_TAPE_MSG, drive_name ) );
+}
+
+/*****************************************************************************
+
+ Name: UI_CheckUserAbort
+
+ Description: Function to check current status of global abort flag and
+ return disposition indicator
+
+ Returns: TRUE or FALSE to indicate user abort should be processed
+
+ Notes: The current TF message is passed to this function, and if
+ the current message is TF_IDLE_NOBREAK, a beep() will be
+ called and the abort condition reset
+
+*****************************************************************************/
+BOOLEAN UI_CheckUserAbort( UINT16 message )
+{
+
+ if ( gb_abort_flag != CONTINUE_PROCESSING ) {
+
+ if ( message == TF_IDLE_NOBREAK ) {
+
+// gb_abort_flag = CONTINUE_PROCESSING ;
+ return FALSE; /* don't abort the operation */
+ }
+ else {
+ return TRUE; /* abort the operation */
+ }
+ }
+ else {
+ return FALSE; /* don't abort the operation */
+ }
+
+}
+
+/*****************************************************************************
+
+ Name: UI_ProcessVCBatEOD
+
+ Description: This function process responses at EOD for read operations.
+ We either for TF back to BOT, or prompt user to supply a
+ new tape.
+
+ Returns: UI_BOT, UI_ABORT_POSITIONING or ( UI_ReplaceTape() )
+
+*****************************************************************************/
+INT16 UI_ProcessVCBatEOD( TPOS_PTR tpos, CHAR_PTR drive_name )
+{
+
+ /* check for needing to get TF to position back to BOT */
+
+ if ( ( tpos->tape_id == -1 ) &&
+ ( tpos->tape_seq_num == -1 ) &&
+ ( tpos->backup_set_num == -1 ) ) {
+ return( (UINT16) UI_BOT );
+ }
+
+ /* we ran out of data on current tape, what does user want to do */
+
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_CONTINUE ),
+ ID( RES_NO_MORE_TAPE_INFO ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ), 0, 0 ) ) {
+ return( UI_ReplaceTape( drive_name ) );
+ }
+ else {
+ return( (UINT16) UI_ABORT_POSITIONING );
+ }
+
+}
+
+/*****************************************************************************
+
+ Name: UI_HandleTapeReadError
+
+ Description: Function to produce tape read error message, and prompt
+ user for another tape.
+
+ Returns: UI_NEW_TAPE_INSERTED or UI_ABORT_POSITIONING
+
+*****************************************************************************/
+INT16 UI_HandleTapeReadError( CHAR_PTR drive_name )
+{
+ CHAR text[MAX_UI_RESOURCE_SIZE] ;
+
+ if( UI_GetExtendedErrorString( TFLE_BAD_TAPE, text ) ) {
+ lprintf( LOGGING_FILE, text ) ;
+ WM_MsgBox( ID(IDS_GENERR_TITLE), text, WMMB_OK, WMMB_ICONSTOP ) ;
+ } else {
+ eresprintf( RES_FATAL_TAPE_READ_ERR, drive_name ) ;
+ }
+
+ return( UI_ReplaceTape( drive_name ) ) ;
+}
+
+
+/*****************************************************************************
+
+ Name: UI_AskUserForTape
+
+ Description: Prompt user for new tape, and ask if they wish to continue.
+
+ Returns: UI_NEW_TAPE_INSERTED or UI_ABORT_POSITIONING
+
+*****************************************************************************/
+
+static INT16 UI_AskUserForTape (
+INT res_id,
+CHAR_PTR drive_name )
+{
+ CHAR temp[ MAX_UI_RESOURCE_SIZE ];
+ INT answer;
+ INT OldFlag;
+ UINT16 status;
+
+ RSM_Sprintf( temp, ID( res_id ), drive_name );
+
+ OldFlag = CDS_GetYesFlag( CDS_GetCopy() );
+
+ CDS_SetYesFlag( CDS_GetCopy( ), NO_FLAG );
+
+ answer = WM_MessageBox( ID( IDS_MSGTITLE_INSERT ),
+ temp,
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_CONTINUE_QUEST ),
+ 0l,
+ 0
+ );
+
+ CDS_SetYesFlag( CDS_GetCopy( ), OldFlag );
+
+ if ( answer ) {
+#ifdef OS_WIN32
+ Sleep( (DWORD)3000 );
+#endif
+ status = UI_NEW_TAPE_INSERTED ;
+ }
+ else {
+ status = UI_ABORT_POSITIONING ;
+ }
+ return( (INT16)status );
+}
+
+
+/*****************************************************************************
+
+ Name: UI_ReturnToTOC
+
+ Description: Function to check if within a multi-drive environment and
+ based upon sensitivity to tape change in current drive,
+ return an indication to the caller that TOC is required.
+
+ Returns: BOOLEAN (TRUE or FALSE)
+
+*****************************************************************************/
+BOOLEAN UI_ReturnToTOC( UINT16 channel, BOOLEAN check_tape_change )
+{
+ THW_PTR thw_ptr = BE_GetCurrentDevice( channel );
+
+ if ( thw_ptr->channel_link.q_prev ) {
+ if ( check_tape_change ) {
+ return( (BOOLEAN)( ( thw_ptr->drv_status == TPS_NEW_TAPE ) ||
+ ( thw_ptr->drv_status == TPS_NO_TAPE )) );
+ }
+ else {
+ return( TRUE );
+ }
+ }
+ else {
+ return( FALSE );
+ }
+}
diff --git a/private/utils/ntbackup/src/tprintf.c b/private/utils/ntbackup/src/tprintf.c
new file mode 100644
index 000000000..a8e53f394
--- /dev/null
+++ b/private/utils/ntbackup/src/tprintf.c
@@ -0,0 +1,139 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: tprintf.c
+
+ Description: tprintf functions for "T" commands that perform word wrapping but
+ do not use windows
+
+ $Log: G:/UI/LOGFILES/TPRINTF.C_V $
+
+ Rev 1.9 14 Dec 1993 14:34:12 BARRY
+Fixed an error in last edit for ANSI builds
+
+ Rev 1.8 14 Dec 1993 11:12:26 BARRY
+Changed print buffer to dynamic memory on Unicode
+
+ Rev 1.7 07 Oct 1992 14:50:22 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.6 04 Oct 1992 19:41:24 DAVEV
+Unicode Awk pass
+
+ Rev 1.5 21 May 1992 12:03:32 MIKEP
+change assert to msassert
+
+ Rev 1.4 19 May 1992 11:58:48 MIKEP
+mips changes
+
+ Rev 1.3 18 May 1992 09:06:46 MIKEP
+header
+
+ Rev 1.2 27 Apr 1992 16:14:16 CHUCKB
+Fixed size of print buffer.
+
+ Rev 1.1 29 Jan 1992 18:04:16 DAVEV
+
+
+ * added include <windows.h>
+
+ Rev 1.0 20 Nov 1991 19:35:34 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+#if defined( UNICODE )
+
+#define PRINTF_BUFFER_CHUNK 512 // chunk size for buff realloc
+CHAR_PTR gszTprintfBuffer = NULL;
+static size_t printfBufferCount = 0; // # chars above can hold
+
+#else
+
+#define MAX_WIN_WIDTH 512
+CHAR gszTprintfBuffer[ MAX_WIN_WIDTH + 1 ];
+
+#endif
+
+
+static VOID insert_string( CHAR_PTR buf, CHAR_PTR buf_index, CHAR_PTR insertion ) ;
+
+/*****************************************************************************
+
+ Name: tprintf
+
+ Description: This function is the lowest level print function which handles word wrapping
+ for the "T" commands.
+
+ THIS IS A SPECIAL FUNCTION SPECIFICALLY
+ FOR THE "T" COMMANDS...NO WINDOWS ARE USED
+
+ Returns: VOID
+
+ Notes: Any changes to this code should be coordinated with changes to wwrap( ) in wprintf.c
+
+*****************************************************************************/
+VOID tprintf( CHAR_PTR fmt, va_list arg_ptr )
+{
+#if !defined( UNICODE )
+ /* use sprintf to fill buffer */
+ vsprintf( gszTprintfBuffer, fmt, arg_ptr ) ;
+
+ msassert( strlen( gszTprintfBuffer ) <= MAX_WIN_WIDTH ) ;
+#else
+ CHAR_PTR newBuff;
+
+ /*
+ * Be prepared to print some really large strings
+ */
+ while ( _vsnwprintf( gszTprintfBuffer, printfBufferCount, fmt, arg_ptr ) == -1 )
+ {
+ /* Buffer wasn't big enough. Realloc and try again. */
+ printfBufferCount += PRINTF_BUFFER_CHUNK;
+ newBuff = realloc( gszTprintfBuffer, printfBufferCount * sizeof(CHAR) );
+
+ if ( newBuff != NULL )
+ {
+ gszTprintfBuffer = newBuff;
+ }
+ else
+ {
+ free( gszTprintfBuffer );
+ gszTprintfBuffer = NULL;
+ printfBufferCount = 0;
+ break;
+ }
+ }
+
+#endif
+}
+
+/*****************************************************************************
+
+ Name: typrintf
+
+ Description: This function displays a message
+
+ THIS IS A SPECIAL FUNCTION SPECIFICALLY
+ FOR THE "T" COMMANDS...NO WINDOWS ARE USED
+
+ Returns: VOID
+
+ Notes: calls tprintf( )
+
+*****************************************************************************/
+VOID typrintf( CHAR_PTR fmt, ... )
+{
+ va_list arg_ptr ;
+
+ va_start( arg_ptr, fmt ) ;
+ tprintf( fmt, arg_ptr ) ;
+ va_end( arg_ptr ) ;
+}
+
diff --git a/private/utils/ntbackup/src/translat.c b/private/utils/ntbackup/src/translat.c
new file mode 100644
index 000000000..b2fb9fbac
--- /dev/null
+++ b/private/utils/ntbackup/src/translat.c
@@ -0,0 +1,1690 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: translat.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: T:\logfiles\translat.c_v $
+
+ Rev 1.45 07 Feb 1994 02:06:56 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.44 08 Sep 1993 18:18:44 GREGG
+Changed WT_InitTape to match new func tab init_tape proto in fmteng.h r1.24.
+
+ Rev 1.43 17 Jul 1993 17:57:06 GREGG
+Changed write translator functions to return INT16 TFLE_xxx errors instead
+of BOOLEAN TRUE/FALSE. Files changed:
+ MTF10WDB.C 1.23, TRANSLAT.H 1.22, F40PROTO.H 1.30, FMTENG.H 1.23,
+ TRANSLAT.C 1.43, TFWRITE.C 1.68, MTF10WT.C 1.18
+
+ Rev 1.42 22 Jun 1993 10:53:12 GREGG
+Added API to change the catalog directory path.
+
+ Rev 1.41 07 Jun 1993 23:50:42 GREGG
+Handle EOM exception in current buffer in MoveToVCB.
+
+ Rev 1.40 17 May 1993 20:49:44 GREGG
+Added logic to deal with the fact that the app above tape format doesn't
+keep track of the lba of the vcb.
+
+ Rev 1.39 22 Apr 1993 03:31:22 GREGG
+Third in a series of incremental changes to bring the translator in line
+with the MTF spec:
+
+ - Removed all references to the DBLK element 'string_storage_offset',
+ which no longer exists.
+ - Check for incompatable versions of the Tape Format and OTC and deals
+ with them the best it can, or reports tape as foreign if they're too
+ far out. Includes ignoring the OTC and not allowing append if the
+ OTC on tape is a future rev, different type, or on an alternate
+ partition.
+ - Updated OTC "location" attribute bits, and changed definition of
+ CFIL to store stream number instead of stream ID.
+
+Matches: TFL_ERR.H 1.9, MTF10WDB.C 1.7, TRANSLAT.C 1.39, FMTINF.H 1.11,
+ OTC40RD.C 1.24, MAYN40RD.C 1.56, MTF10WT.C 1.7, OTC40MSC.C 1.20
+ DETFMT.C 1.13, MTF.H 1.4
+
+ Rev 1.38 18 Apr 1993 17:23:16 GREGG
+Added handling of BT_UDB type blocks to RD_TranslateDBLK.
+
+ Rev 1.37 09 Mar 1993 18:15:02 GREGG
+Initial changes for new stream and EOM processing.
+
+ Rev 1.36 26 Jan 1993 01:30:38 GREGG
+Added Fast Append functionality.
+
+ Rev 1.35 17 Nov 1992 22:17:56 DAVEV
+unicode fixes
+
+ Rev 1.34 11 Nov 1992 10:53:50 GREGG
+Unicodeized literals.
+
+ Rev 1.33 09 Nov 1992 11:01:00 GREGG
+Added entry points for accessing tape catalogs.
+
+ Rev 1.32 03 Nov 1992 09:27:36 HUNTER
+Added prototype for ending data stream
+
+ Rev 1.31 22 Oct 1992 10:49:32 HUNTER
+New data stream changes
+
+ Rev 1.30 20 Oct 1992 14:02:42 HUNTER
+Deleted reference to tdata_size
+
+ Rev 1.29 22 Sep 1992 08:58:34 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.28 14 Aug 1992 16:33:28 GREGG
+Removed MinSizeForTapeBlk and SizeForTapeEomBlk functions.
+
+ Rev 1.27 20 May 1992 20:00:58 GREGG
+Translator read functions now return INT16 - TFLE_xxx instead of BOOLEAN.
+
+ Rev 1.26 13 May 1992 11:47:28 BURT
+Oops, cut and paste strikes again. Added channel_ptr-> to the
+cur_fmt referenced in the pasted code. All better now.
+
+
+
+ Rev 1.25 13 May 1992 10:35:40 BURT
+Added logic to StartRead to prevent calling start_read if current
+format is UNKNOWN, which may happen if a blank tape is in the drive.
+
+
+ Rev 1.24 28 Apr 1992 16:41:26 GREGG
+ROLLER BLADES - Added DetBlockType function, added a BUF_PTR parameter to
+Wt_InitTape and took out all the TABS.
+
+ Rev 1.23 05 Apr 1992 17:17:36 GREGG
+ROLLER BLADES - Initial OTC integration.
+
+ Rev 1.22 25 Mar 1992 19:04:10 GREGG
+ROLLER BLADES - 64 bit support and SizeForTapeEomBlk entry point.
+
+ Rev 1.21 13 Feb 1992 13:26:04 NED
+added check for channel->cur_buff being null prior to exception handling
+within MoveToVCB() to fix QS1.9x bug with repeated VCB motion.
+
+ Rev 1.20 11 Feb 1992 17:14:16 NED
+changed buffman/translator interface parameters
+
+ Rev 1.19 04 Feb 1992 21:24:04 NED
+Changes to Buffer Management translator hooks.
+
+ Rev 1.18 16 Jan 1992 18:39:34 NED
+Skateboard: buffer manager changes
+
+ Rev 1.17 02 Jan 1992 14:48:22 NED
+Buffer Manager/UTF translator integration.
+
+ Rev 1.16 05 Dec 1991 14:03:36 GREGG
+SKATEBOARD - New Buff Mgt - Initial Integration.
+
+ Rev 1.15 18 Nov 1991 19:54:18 GREGG
+Added BOOLEAN abort parameter to Wt_CloseSet and passed it in calls to
+wt_mk_vcb and wt_close_set with appropriate values.
+
+ Rev 1.14 07 Nov 1991 15:30:52 HUNTER
+VBLK - Added support for Variable Blocks
+
+
+ Rev 1.13 17 Sep 1991 13:43:46 GREGG
+SetupFormatEnv now returns TFLE_xxx.
+
+ Rev 1.12 28 Aug 1991 09:53:48 GREGG
+Report GEN_ERR_NO_DATA as a tape incnsistancy in RD_Exception.
+
+ Rev 1.11 22 Aug 1991 16:31:18 NED
+Changed all references to internals of the buffer structure to macros.
+
+ Rev 1.10 22 Jul 1991 12:51:08 GREGG
+Modified WT_EndSet to set the AT_EOM channel status if the drive EOM status
+is set.
+
+ Rev 1.9 15 Jul 1991 14:39:28 NED
+Removed unreferenced channel status bit.
+
+ Rev 1.8 09 Jul 1991 15:54:04 NED
+Don't call FreeFormatEnv from SetupFormatEnv if there is no current format.
+
+ Rev 1.7 01 Jul 1991 15:55:30 NED
+set AT_EOM bit in drive as well as in channel at EOM.
+
+ Rev 1.6 26 Jun 1991 16:21:08 NED
+removed setting of CH_DONE from RD_Exception()
+added handling of GEN_ERR_NO_DATA as TFLE_NO_ERR in RD_Exception()
+
+ Rev 1.5 24 Jun 1991 19:49:38 GREGG
+In MoveToVCB, handle exceptions in current buffer before calling the
+translators move routine.
+
+ Rev 1.4 17 Jun 1991 11:48:56 NED
+added REW_CLOSE logic on error
+added BE_Zprintf() calls
+interpreted UNEXPECTED_EOM error as TF_NEED_NEW_TAPE
+
+ Rev 1.3 07 Jun 1991 00:32:50 GREGG
+New parameters for the deinitializeers and FreeFormatEnv, and code changes to
+accommodate the parameter changes. Changes to MoveToVCB due to Teac problems
+and other missed cases in original logic.
+
+ Rev 1.2 14 May 1991 11:22:14 GREGG
+Changed order of includes.
+
+ Rev 1.1 10 May 1991 11:55:32 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:18:58 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdmacro.h"
+#include "tbe_defs.h"
+#include "datetime.h"
+#include "drive.h"
+#include "channel.h"
+#include "fmteng.h"
+#include "translat.h"
+#include "transprt.h"
+#include "transutl.h"
+#include "fsys.h"
+#include "tloc.h"
+#include "lw_data.h"
+#include "tfldefs.h"
+#include "tfl_err.h"
+#include "generr.h"
+#include "be_debug.h"
+#include "lwprotos.h"
+#include "minmax.h"
+
+/**/
+/**
+
+ Name: DetermineFormat
+
+ Description: This determines which tape format we are currently using.
+
+ Returns: UINT16, the tape format index number.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+UINT16 DetermineFormat(
+ VOID_PTR buf_ptr,
+ UINT32 buf_len )
+{
+ UINT16 ret = UNKNOWN_FORMAT ;
+ UINT16 i ;
+
+ if ( buf_len != 0L ) {
+ for( i = 0 ; i < lw_num_supported_fmts ; i++ ) {
+ if( (*supported_fmts[i].determiner)( buf_ptr ) ) {
+ ret = i ;
+ break ;
+ }
+ }
+ }
+
+ return( ret ) ;
+}
+/**/
+/**
+
+ Name: FreeFormatEnv
+
+ Description: Frees the Format Environment by calling the deinit
+ routine, if any. Otherwise, just frees the env mem.
+
+ Modified: 10/24/90 NK
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID FreeFormatEnv( UINT16_PTR cur_fmt, VOID_PTR *fmt_env )
+{
+ VOID (*deinitialize)( VOID_PTR * ) ;
+
+ BE_Zprintf( 0, TEXT("FreeFormatEnv( cur_fmt=%d )\n"), *cur_fmt ) ;
+
+ if ( *cur_fmt == UNKNOWN_FORMAT || *fmt_env == NULL ) {
+ return ;
+ }
+
+ if ( ( deinitialize = supported_fmts[*cur_fmt].deinitializer ) != NULL ) {
+ deinitialize( fmt_env ) ;
+ }
+
+ if ( *fmt_env != NULL ) {
+ free( *fmt_env ) ;
+ *fmt_env = NULL ;
+ }
+
+ *cur_fmt = UNKNOWN_FORMAT ;
+}
+
+/**/
+/**
+
+ Name: SetupFormatEnv
+
+ Description: Allocates space for the Format Environment
+ initializes it. Sets up for FreeFormatEnv().
+
+ Modified: 10/24/90 NK
+
+ Returns: UINT16, TFLE_xxx code.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 SetupFormatEnv( CHANNEL_PTR channel )
+{
+ UINT16 fmt = channel->cur_fmt ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ BOOLEAN (*initializer)(CHANNEL_PTR);
+
+ BE_Zprintf( 0, TEXT("SetupFormatEnv( fmt=%d )\n"), fmt ) ;
+
+ initializer = supported_fmts[fmt].initializer ;
+ if ( initializer != NULL ) {
+ ret_val = supported_fmts[fmt].initializer( channel ) ;
+ }
+
+ if ( ret_val != TFLE_NO_ERR ) {
+ channel->cur_fmt = UNKNOWN_FORMAT ;
+ }
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: NewTape
+
+ Description: Called prior to any translate operations on a tape.
+ May do translator-specific things. If no new_tape
+ routine, returns TRUE
+
+ Returns: UINT16, TFLE_xxx or TF_xxx code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 NewTape(
+ CHANNEL_PTR channel_ptr,
+ BOOLEAN_PTR need_read )
+{
+ INT16 (*func)( CHANNEL_PTR, BUF_PTR, BOOLEAN_PTR ) =
+ supported_fmts[ channel_ptr->cur_fmt ].new_tape ;
+ INT16 ret_val ;
+
+ /* Fix for the app not knowing the LBA for a continuation VCB */
+ channel_ptr->cross_set = 0 ;
+ channel_ptr->cross_lba = 0UL ;
+
+ if ( func == NULL ) {
+ * need_read = FALSE ;
+ return TFLE_NO_ERR ;
+ }
+
+ ret_val = func( channel_ptr, channel_ptr->cur_buff, need_read ) ;
+
+ if ( * need_read ) {
+ /* this is required so when the buffer is Punted,
+ our blocks_used count is properly updated. */
+ BM_SetBytesFree( channel_ptr->cur_buff, 0 ) ;
+ BM_SetNextByteOffset( channel_ptr->cur_buff, 0 ) ;
+ BM_SetReadError( channel_ptr->cur_buff, GEN_NO_ERR ) ;
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: MoveToVCB
+
+ Description: Called to change the translator's idea of the current VCB.
+ When called with "really_move" set to TRUE,
+ guaranteed to position tape at proper point
+ to begin reading.
+
+ Modified: 6/4/1991 NK
+
+ Returns: success code, further info in *status: need a read,
+ misc TFLE_xxx codes if something failed. Returns
+ TFLE_NO_ERR if no move_to_vcb routine in table.
+
+ Notes: If we're moving backwards and the translator sees that
+ reverse filemarking is unavailable on this drive, translator
+ may return TF_NEED_REWIND_FIRST, signaling that we need to
+ rewind and process sets one at a time in the forward direction.
+
+**/
+INT16 MoveToVCB(
+ CHANNEL_PTR channel,
+ INT16 number, /* how many VCBs to move (signed) */
+ BOOLEAN_PTR need_read, /* do we need to read tape? */
+ BOOLEAN really_move ) /* is this at StartRead time? */
+{
+ INT16 (*move_to_vcb)( CHANNEL_PTR, INT16, BOOLEAN_PTR, BOOLEAN ) ;
+ INT16 ret_val ;
+ BOOLEAN was_at_bot = ( IsPosBitSet( channel->cur_drv, AT_BOT ) != 0 ) ;
+ UINT16 exception_type ;
+
+ if ( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ return TFLE_UNKNOWN_FMT ;
+ }
+
+ if ( ( move_to_vcb = supported_fmts[ channel->cur_fmt ].move_to_vcb ) == NULL ) {
+ return TFLE_NO_ERR ;
+ }
+
+ /* give the translator a chance to interpret the exception */
+ if ( !really_move && channel->cur_buff != NULL && BM_ReadError( channel->cur_buff ) != GEN_NO_ERR ) {
+ ret_val = RD_Exception( channel, BM_ReadError( channel->cur_buff ), &exception_type ) ;
+ if ( ret_val != TFLE_NO_ERR ) {
+ return ret_val ;
+ }
+
+ if( exception_type == FMT_EXC_EOM ) {
+ /* Undo what the stupid exception handler did, and tell the
+ caller we need a new tape.
+ */
+ ClrChannelStatus( channel, CH_AT_EOM ) ;
+ ClrPosBit( channel->cur_drv, ( TAPE_FULL | AT_EOM ) ) ;
+ return( TF_NEED_NEW_TAPE ) ;
+ }
+ }
+
+ ret_val = move_to_vcb( channel, number, need_read, really_move ) ;
+
+ if ( ret_val == TFLE_NO_ERR && *need_read == TRUE && channel->cur_buff != NULL ) {
+ /* this is required so when the buffer is Punted,
+ our blocks_used count is properly updated. */
+ BM_SetBytesFree( channel->cur_buff, 0 ) ;
+ BM_SetNextByteOffset( channel->cur_buff, 0 ) ;
+ BM_SetReadError( channel->cur_buff, GEN_NO_ERR ) ;
+ }
+
+ if ( number > 0 && was_at_bot && ret_val == TFLE_NO_ERR ) {
+ ClrPosBit( channel->cur_drv, AT_BOT ) ;
+ }
+
+ if ( ret_val == TFLE_UNEXPECTED_EOM && number > 0 ) {
+ ret_val = TF_NEED_NEW_TAPE ;
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: SeekEOD
+
+ Description: Seek directly to end of data for fast append. Sets up
+ for the pending append operation including loading in
+ the Set Map if there is one.
+
+ Returns: TFLE_xxx error code or TF_xxx message.
+
+ Notes:
+
+**/
+INT16 SeekEOD( CHANNEL_PTR channel )
+{
+ INT16 (*func)( CHANNEL_PTR ) ;
+
+ if ( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ if ( ( func = supported_fmts[channel->cur_fmt].seek_eod ) == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ if( lw_fmtdescr[channel->cur_fmt].attributes & APPEND_SUPPORTED ) {
+ return( func( channel ) ) ;
+ } else {
+ return( TFLE_APPEND_NOT_ALLOWED ) ;
+ }
+}
+/**/
+/**
+
+ Name: GetCurrentVCB
+
+ Description: Fills in the channel->cur_dblk struct. Must have called
+ MoveToVCB( channel, n, & status, TRUE ) before
+ calling this.
+
+ Modified: 10/25/1990 NK
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 GetCurrentVCB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ INT16 (*get_current_vcb)( CHANNEL_PTR, BUF_PTR ) ;
+
+ if ( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ return TFLE_TRANSLATION_FAILURE ;
+ }
+
+ if ( ( get_current_vcb = supported_fmts[ channel->cur_fmt ].get_current_vcb ) == NULL ) {
+ return TFLE_TRANSLATION_FAILURE ;
+ } else {
+ return get_current_vcb( channel, buffer ) ;
+ }
+}
+/**/
+/**
+
+ Name: RD_TranslateDBLK
+
+ Description: During a read operation, this translates a DBLK.
+
+ Modified: 10/25/90 NK
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 RD_TranslateDBLK(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16_PTR blk_type )
+{
+ INT16 ret_val ;
+ UINT16 cur_fmt = channel->cur_fmt ;
+ INT16 (*func)( CHANNEL_PTR, BUF_PTR ) = NULL ;
+ INT16 (*parse_func)( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+
+ if ( cur_fmt == UNKNOWN_FORMAT || ( parse_func = supported_fmts[cur_fmt].parser ) == NULL ) {
+ msassert( FALSE ) ;
+ *blk_type = BT_HOSED ;
+ return( TFLE_TRANSLATION_FAILURE ) ;
+ }
+
+ if( ( ret_val = parse_func( channel, buffer, blk_type ) ) != TFLE_NO_ERR ) {
+ *blk_type = BT_HOSED ;
+ return( ret_val ) ;
+ }
+
+ switch( *blk_type ) {
+
+ case BT_STREAM:
+ func = supported_fmts[cur_fmt].rd_mk_stream ;
+ break ;
+
+ case BT_FDB:
+ func = supported_fmts[cur_fmt].rd_mk_fdb ;
+ break ;
+
+ case BT_DDB:
+ func = supported_fmts[cur_fmt].rd_mk_ddb ;
+ break ;
+
+ case BT_MDB:
+ func = supported_fmts[cur_fmt].rd_mk_mdb ;
+ break ;
+
+ case BT_VCB:
+ func = supported_fmts[cur_fmt].rd_mk_vcb ;
+ break ;
+
+ case BT_IDB:
+ func = supported_fmts[cur_fmt].rd_mk_idb ;
+ break ;
+
+ case BT_CFDB:
+ func = supported_fmts[cur_fmt].rd_mk_cfdb ;
+ break ;
+
+ case BT_BSDB:
+ func = supported_fmts[cur_fmt].rd_mk_bsdb ;
+ break ;
+
+ case BT_UDB:
+ func = supported_fmts[cur_fmt].rd_mk_osudb ;
+ break ;
+
+ default:
+ msassert( FALSE ) ;
+ break ;
+ }
+
+ if( func == NULL ) {
+ msassert( FALSE ) ;
+ *blk_type = BT_HOSED ;
+ return( TFLE_TRANSLATION_FAILURE ) ;
+ }
+
+ return( func( channel, buffer ) ) ;
+}
+/**/
+/**
+
+ Name: DetBlockType
+
+ Description: Determines the type of the next block in the buffer.
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+**/
+
+INT16 DetBlockType(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16_PTR blk_type )
+{
+ INT16 (*func)( CHANNEL_PTR, BUF_PTR, UINT16_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ||
+ ( func = supported_fmts[channel->cur_fmt].parser ) == NULL ) {
+
+ msassert( FALSE ) ;
+ *blk_type = BT_HOSED ;
+ return( TFLE_TRANSLATION_FAILURE ) ;
+ }
+
+ return( func( channel, buffer, blk_type ) ) ;
+}
+/**/
+/**
+
+ Name: RD_RetranslateDBLK
+
+ Description: Handles retranslating the dblk
+
+ Modified: 4/12/1990 15:4:7
+
+ Returns: TFLE_xxx error code
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN RD_ReTranslateDBLK(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ UINT16 cur_fmt = channel->cur_fmt ;
+ BOOLEAN (*recall)( CHANNEL_PTR, BUF_PTR ) ;
+
+ if ( cur_fmt == UNKNOWN_FORMAT || ( recall = supported_fmts[cur_fmt].rd_recall ) == NULL ) {
+ return FALSE ;
+ }
+ return recall( channel, buffer ) ;
+}
+
+
+/**/
+/**
+
+ Name: RD_ContinuationTape
+
+ Description: Reads a continuation tape and updates the buffer.
+
+ Modified: 10/24/90 NK
+
+ Returns: TRUE for success, and FALSE for failure.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+BOOLEAN RD_ContinuationTape(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ UINT16 cur_fmt = channel->cur_fmt ;
+ BOOLEAN (*func)( CHANNEL_PTR, BUF_PTR ) ;
+
+ if ( cur_fmt == UNKNOWN_FORMAT ) {
+ return FALSE ;
+ }
+
+ func = supported_fmts[cur_fmt].rd_cont_tape ;
+
+ return ( func == NULL ) ? TRUE : func( channel, buffer ) ;
+}
+
+/**/
+/**
+
+ Name: RD_Exception
+
+ Description: Calls the filemark action routine, if any.
+
+ Modified: 10/24/90 NK
+
+ Returns: TFLE_xxx codes
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 RD_Exception( CHANNEL_PTR channel, INT16 exception, UINT16_PTR ptype )
+{
+ UINT16 (*func)( CHANNEL_PTR, INT16 ) ;
+ INT16 ret_val = TFLE_NO_ERR ;
+ Q_ELEM_PTR qe_ptr ;
+
+ if ( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return TFLE_PROGRAMMER_ERROR1 ;
+ }
+
+ func = supported_fmts[channel->cur_fmt].exception_action ;
+ msassert( func != NULL ) ;
+
+ /* Put all the buffers back from the inproc_q since they are dead anyway */
+ while ( ( qe_ptr = DeQueueElem( &channel->cur_drv->inproc_q ) ) != NULL ) {
+ BM_Put( ((BUF_PTR)QueuePtr( qe_ptr )) );
+ }
+
+ /* ask the translator to interpret this exception */
+ switch ( *ptype = func( channel, exception ) ) {
+
+ case FMT_EXC_EOS: /* means end of set */
+ SetPosBit( channel->cur_drv, AT_EOS ) ;
+ if( DataPhase( channel ) &&
+ U64_GT( channel->current_stream.size, U64_Init( 0L, 0L ) ) )
+ {
+ ret_val = TFLE_UNEXPECTED_EOS ;
+ }
+ break ;
+
+ case FMT_EXC_EOM: /* means end of medium */
+ SetChannelStatus( channel, CH_AT_EOM ) ;
+ SetPosBit( channel->cur_drv, ( TAPE_FULL | AT_EOM ) ) ;
+ channel->eom_filter = channel->active_filter ;
+ break ;
+
+ case FMT_EXC_HOSED: /* translator didn't recognize exception */
+
+ switch ( exception ) { /* map our own error messages */
+
+ case GEN_ERR_EOM:
+ SetPosBit( channel->cur_drv, TAPE_FULL ) ;
+
+ /* fall through */
+
+ case GEN_ERR_ENDSET:
+ case GEN_ERR_NO_DATA:
+ SetPosBit( channel->cur_drv, REW_CLOSE ) ;
+ ret_val = TFLE_TAPE_INCONSISTENCY ;
+ break ;
+
+ case GEN_ERR_NO_MEDIA:
+ ret_val = TFLE_NO_TAPE ;
+ break ;
+
+ case GEN_ERR_BAD_DATA:
+ ret_val = TFLE_BAD_TAPE ;
+ break ;
+
+ default:
+ ret_val = TFLE_DRIVE_FAILURE ;
+ break ;
+ }
+ break ;
+
+ case FMT_EXC_IGNORE :
+ break ;
+
+ default :
+ ret_val = TFLE_PROGRAMMER_ERROR1 ;
+ break ;
+ }
+
+ if ( *ptype != FMT_EXC_IGNORE ) {
+ BM_UseAll( channel->cur_buff ) ;
+ PuntBuffer( channel ) ; /* so we don't handle exception again */
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: WT_TranslateDBLK
+
+ Description:
+
+ Modified: 10/25/90 NK
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 WT_TranslateDBLK(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16_PTR blk_type )
+{
+ INT16 ret_val = TFLE_NO_ERR ;
+ UINT16 cur_fmt = channel->cur_fmt ;
+ INT16 (*func)( CHANNEL_PTR, BUF_PTR, BOOLEAN ) = NULL ;
+
+ if ( cur_fmt == UNKNOWN_FORMAT || channel->cur_dblk == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_TRANSLATION_FAILURE ) ;
+ }
+
+ switch( FS_GetBlockType( channel->cur_dblk ) ) {
+
+ case FDB_ID:
+ func = supported_fmts[cur_fmt].wt_mk_fdb ;
+ *blk_type = BT_FDB ;
+ break ;
+
+ case DDB_ID:
+ func = supported_fmts[cur_fmt].wt_mk_ddb ;
+ *blk_type = BT_DDB ;
+ break ;
+
+ case IDB_ID:
+ func = supported_fmts[cur_fmt].wt_mk_idb ;
+ *blk_type = BT_IDB ;
+ break ;
+
+ case VCB_ID:
+ func = supported_fmts[cur_fmt].wt_mk_vcb ;
+ *blk_type = BT_VCB ;
+ break ;
+
+ case CFDB_ID:
+ func = supported_fmts[cur_fmt].wt_mk_cfdb ;
+ *blk_type = BT_CFDB ;
+ break ;
+
+ default:
+ msassert( FALSE ) ;
+ return( TFLE_TRANSLATION_FAILURE ) ;
+ break ;
+ }
+
+ if( func == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_TRANSLATION_FAILURE ) ;
+ }
+
+ return( func( channel, buffer, FALSE ) ) ;
+}
+
+
+/**/
+/**
+
+ Name: WT_EndTape
+
+ Description: Dispatches to the appropriate function for closing a
+ tape.
+
+ Modified: 10/3/1989 9:9:6
+
+ Returns: An error code if an error.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 WT_EndTape( CHANNEL_PTR channel )
+{
+ INT16 ret_val ;
+ UINT16 cur_fmt = channel->cur_fmt ;
+ DBLK_PTR hold_dblk = channel->cur_dblk ;
+ INT16 (*func)(CHANNEL_PTR);
+
+ if ( cur_fmt == UNKNOWN_FORMAT ) {
+ return TFLE_UNKNOWN_FMT ;
+ }
+
+ if ( ( func = supported_fmts[cur_fmt].wt_close_tape ) == NULL ) {
+ return TFLE_NO_ERR ;
+ }
+
+ ret_val = func( channel ) ;
+
+ channel->cur_dblk = hold_dblk ;
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: WT_EndSet
+
+ Description: Dispatches to do appropriate tape end stuff.
+
+ Modified: 10/3/1989 9:12:13
+
+ Returns: An error code if appropriate.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 WT_EndSet( CHANNEL_PTR channel,
+ BOOLEAN abort )
+{
+ INT16 (*func)(CHANNEL_PTR, BOOLEAN);
+ INT16 ret_val ;
+ UINT16 cur_fmt = channel->cur_fmt ;
+
+ if ( cur_fmt == UNKNOWN_FORMAT ) {
+ ret_val = TFLE_UNKNOWN_FMT ;
+ } else if ( ( func = supported_fmts[cur_fmt].wt_close_set ) == NULL ) {
+ ret_val = TFLE_NO_ERR ;
+ } else {
+ ret_val = func( channel, abort ) ;
+ if( IsPosBitSet( channel->cur_drv, AT_EOM ) ) {
+ SetChannelStatus( channel, CH_AT_EOM ) ;
+ }
+ }
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: WT_ContinueSet
+
+ Description:
+
+ Modified: 10/3/1989 9:14:37
+
+ Returns:
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+INT16 WT_ContinueSet( CHANNEL_PTR channel )
+{
+ INT16 (*func)(CHANNEL_PTR);
+ UINT16 cur_fmt = channel->cur_fmt ;
+
+ if ( cur_fmt == UNKNOWN_FORMAT ) {
+ return TFLE_UNKNOWN_FMT ;
+ }
+
+ if ( ( func = supported_fmts[cur_fmt].wt_cont_set ) == NULL ) {
+ return TFLE_NO_ERR ;
+ }
+
+ return( func( channel ) ) ;
+}
+
+/**/
+/**
+
+ Name: WT_ContVarStream
+
+ Description: Writes a Variable Stream continuation.
+
+ Modified:
+
+ Returns:
+
+ Notes:
+
+ See also:
+
+ Declaration:
+
+**/
+
+INT16 WT_ContVarStream(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ INT16 (*func)( CHANNEL_PTR, BUF_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+ if( ( func = supported_fmts[channel->cur_fmt].wt_cont_vstrm ) == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+ return( func( channel, buffer ) ) ;
+}
+
+/**/
+/**
+
+ Name: WT_EndVarStream
+
+ Description: Writes a Ending Variable Stream Header.
+
+ Modified:
+
+ Returns:
+
+ Notes:
+
+ See also:
+
+ Declaration:
+
+**/
+
+VOID WT_EndVarStream(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16 used )
+{
+ VOID (*func)( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+ if( ( func = supported_fmts[channel->cur_fmt].wt_end_vstrm ) == NULL ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+ func( channel, buffer, used ) ;
+}
+
+
+/**/
+/**
+
+ Name: WT_ParseWrittenBuffer
+
+ Description: Post processing of buffer written to tape.
+
+ Modified:
+
+ Returns:
+
+ Notes:
+
+ See also:
+
+ Declaration:
+
+**/
+
+VOID WT_ParseWrittenBuffer(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ UINT16 written )
+{
+ VOID (*func)( CHANNEL_PTR, BUF_PTR, UINT16 ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+ if( ( func = supported_fmts[channel->cur_fmt].wt_parse_written ) == NULL ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+ func( channel, buffer, written ) ;
+}
+
+
+/**/
+/**
+
+ Name: SizeofTapeBlock
+
+ Description: Given a buffer, returns the amount of space the tape
+ control block takes up.
+
+ Modified: 10/5/1989 10:30:49
+
+ Returns: The size in bytes of the tape control block.
+
+ Notes: THE POINTER MUST POINT TO A VALID TBLK OF THE SPECIFIED
+ FORMAT OR ELSE THE RESULTS WILL BE BOGUS.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+UINT16 SizeofTapeBlock(
+ UINT16 fmt,
+ VOID_PTR buffer )
+{
+ return( (*supported_fmts[fmt].sizeof_tblk)( buffer ) ) ;
+}
+
+/**/
+/**
+
+ Name: VerifyVCB
+
+ Description: Used to double-check format (for appended
+ dissimilar formats)
+
+ Modified: 11/13/1990 NK
+
+ Returns: TRUE if VCB is OK.
+
+ Notes: Usually calls same routine as DetermineFormat().
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+BOOLEAN VerifyVCB(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ BOOLEAN (*verify_vcb)(VOID_PTR) ;
+
+ if ( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ return FALSE ;
+ }
+ verify_vcb = supported_fmts[ channel->cur_fmt ].verify_vcb ;
+
+ if ( verify_vcb == NULL ) {
+ return TRUE ; /* and let someone else catch it */
+ } else {
+ return verify_vcb( BM_XferBase( buffer ) ) ;
+ }
+}
+
+/**
+ * Unit: Tape Format
+ *
+ * Name: TF_GetVCBBufferRequirements
+ *
+ * Modified: Thursday, January 16, 1992
+ *
+ * Description:
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID TF_GetVCBBufferRequirements(
+ BUF_REQ_PTR dest, /* O - destination structure */
+ Q_ELEM_PTR drive_head, /* I - master drive list */
+ UINT16 suggested_buff_size ) /* I - size from config */
+{
+ UINT16 block_size = 0 ;
+ Q_ELEM_PTR qe_ptr ;
+ UINT16 i ;
+/*
+** Examine drive list for maximum block size
+*/
+ for ( qe_ptr = drive_head; qe_ptr != NULL; qe_ptr = QueueNext( qe_ptr ) ) {
+ THW_PTR thw_ptr = (THW_PTR)(VOID_PTR)qe_ptr ;
+ block_size = MAX( block_size, thw_ptr->drv_info.drv_bsize );
+ }
+/*
+** Set starting dest requirements
+*/
+ BM_ClearRequirements( dest );
+ dest->tf_size =
+ dest->rw_size =
+ dest->a.min_size = MAX( suggested_buff_size, block_size ) ;
+ dest->a.block = block_size ;
+ dest->a.align = BR_ALIGN_WORD ;
+/*
+** For each translator
+*/
+ for ( i = 0 ; i < lw_num_supported_fmts ; i++ ) {
+ BM_TR_GET_VCB_REQ_FUNC_PTR buf_req_func = supported_fmts[i].set_buffer_requirements ;
+ BUF_REQ new_reqs;
+/*
+** If the translator cares, ask it what it needs for VCB buffer
+*/
+ if ( buf_req_func != NULL ) {
+ BM_ClearRequirements( &new_reqs ) ;
+
+ if ( buf_req_func( &new_reqs, drive_head, suggested_buff_size ) ) {
+ if ( BM_AddRequirements( dest, &new_reqs ) != BR_NO_ERR ) {
+ msassert( FALSE ) ;
+ break;
+ }
+ }
+ }
+ }
+}
+
+/**/
+/**
+ * Unit: Tape Format
+ *
+ * Name: TF_GetPreferredBufferSpace
+ *
+ * Modified: Monday, February 3, 1992
+ *
+ * Description:
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID TF_GetPreferredBufferSpace(
+ Q_ELEM_PTR drive_head, /* I - master drive list */
+ UINT16 suggested_number_of_buffers, /* I -- from config */
+ UINT32 suggested_buffer_size, /* I -- from config */
+ UINT32_PTR preferred_memory /* O - preferred total memory size */
+)
+{
+ UINT16 i ;
+
+ *preferred_memory = 0UL;
+/*
+** for each translator
+*/
+ for ( i = 0 ; i < lw_num_supported_fmts ; i++ ) {
+ BM_TR_GET_PREF_FUNC_PTR get_pref_func = supported_fmts[i].get_preferred_space ;
+/*
+** If the translator cares, ask it what it wants for total buffer space
+*/
+ if ( get_pref_func != NULL ) {
+ get_pref_func( drive_head,
+ suggested_number_of_buffers,
+ suggested_buffer_size,
+ preferred_memory );
+ }
+ }
+}
+
+/**/
+/**
+ * Unit: Tape Format
+ *
+ * Name: TF_ReadBufferHook
+ *
+ * Modified: Tuesday, November 12, 1991
+ *
+ * Description: Called upon reading a new buffer
+ *
+ * Notes:
+ *
+ * Returns: VOID
+ *
+ * Global Data:
+ *
+ * Processing:
+ *
+ **/
+
+VOID TF_ReadBufferHook(
+ CHANNEL_PTR channel, /* I - which channel */
+ BUF_PTR buffer ) /* O - current buffer */
+{
+ UINT16 cur_fmt = channel->cur_fmt ;
+ VOID (*func)( CHANNEL_PTR, BUF_PTR ) ;
+
+ if ( cur_fmt != UNKNOWN_FORMAT && ( func = supported_fmts[cur_fmt].read_buffer_hook ) != NULL ) {
+ func( channel, buffer ) ;
+ }
+}
+
+
+/**/
+/**
+
+ Name: StartRead
+
+ Description: Move to OTC when applicable
+
+ Returns: TFLE_xxx error code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 StartRead(
+ CHANNEL_PTR channel_ptr )
+{
+ INT16 (*func)( CHANNEL_PTR ) ;
+
+ /* Added logic to insure that we don't attempt to call start_read
+ if cur_fmt is unknown. (BBB 5/13/92)
+ */
+ if ( channel_ptr->cur_fmt != UNKNOWN_FORMAT &&
+ ( func = supported_fmts[channel_ptr->cur_fmt].start_read ) != NULL ) {
+ return( func( channel_ptr ) ) ;
+ }
+ return TFLE_NO_ERR ;
+}
+
+/**/
+/**
+
+ Name: WT_InitTape
+
+ Description: Write a tape header, if required.
+
+ Returns: TFLE_xxx error code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 WT_InitTape(
+ CHANNEL_PTR channel_ptr,
+ INT16 continuation )
+{
+ INT16 (*func)( CHANNEL_PTR, BOOLEAN, BUF_PTR ) =
+ supported_fmts[ channel_ptr->cur_fmt ].init_tape ;
+
+ if ( func == NULL ) {
+ return TFLE_NO_ERR ;
+ }
+ return( func( channel_ptr, continuation, channel_ptr->cur_buff ) ) ;
+}
+
+
+/**/
+/**
+
+ Name: WT_WriteInit
+
+ Description: Initialize OTC temporary files.
+
+ Returns: TFLE_xxx error code.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 WT_WriteInit(
+ CHANNEL_PTR channel,
+ UINT16 otc_level,
+ BUF_PTR buffer )
+{
+ INT16 (*func)( CHANNEL_PTR, UINT16, BUF_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ return TFLE_NO_ERR ;
+ }
+
+ if( ( func = supported_fmts[ channel->cur_fmt ].write_init ) == NULL ) {
+ return TFLE_NO_ERR ;
+ }
+
+ return( func( channel, otc_level, buffer ) ) ;
+}
+
+
+/**/
+/**
+
+ Name: WT_EOSPadBlk
+
+ Description: Write special ending block to pad the buffer out to an
+ even physical block boundary.
+
+ Returns: Nothing.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+VOID WT_EOSPadBlk(
+ CHANNEL_PTR channel )
+{
+ VOID (*func)( CHANNEL_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+
+ if( ( func = supported_fmts[ channel->cur_fmt ].wt_eos_pad_blk ) == NULL ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+
+ func( channel ) ;
+}
+
+/**/
+/**
+
+ Name: WT_NewDataStream
+
+ Description: Writes a new data stream header
+
+ Returns: Nothing.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 WT_NewDataStream(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer,
+ STREAM_INFO_PTR newStream )
+{
+ INT16 (*func)( CHANNEL_PTR, BUF_PTR, STREAM_INFO_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( FAILURE ) ;
+ }
+
+ if( ( func = supported_fmts[ channel->cur_fmt ].wt_mk_stream ) == NULL ) {
+ msassert( FALSE ) ;
+ return( FAILURE ) ;
+ }
+
+ return( func( channel, buffer, newStream ) ) ;
+}
+
+/**/
+/**
+
+ Name: WT_EndData
+
+ Description: Writes a pad data stream header
+
+ Returns: Nothing.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT16 WT_EndData(
+ CHANNEL_PTR channel,
+ BUF_PTR buffer )
+{
+ INT16 (*func)( CHANNEL_PTR, BUF_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( FAILURE ) ;
+ }
+
+ if( ( func = supported_fmts[ channel->cur_fmt ].wt_mk_enddata ) == NULL ) {
+ msassert( FALSE ) ;
+ return( FAILURE ) ;
+ }
+
+ return( func( channel, buffer ) ) ;
+}
+
+
+/**/
+/**
+
+ Name: LoadSetMap
+
+ Description:
+
+ Returns: TFLE_xxx error code or TF_xxx message.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT LoadSetMap(
+ CHANNEL_PTR channel,
+ BOOLEAN_PTR complete,
+ BOOLEAN get_best )
+{
+ INT (*func)( CHANNEL_PTR, BOOLEAN_PTR, BOOLEAN ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ if( ( func = supported_fmts[channel->cur_fmt].load_set_map ) == NULL ) {
+ return( TF_NO_SM_FOR_FAMILY ) ;
+ }
+
+ return( func( channel, complete, get_best ) ) ;
+}
+
+/**/
+/**
+
+ Name: LoadSetCat
+
+ Description:
+
+ Returns: TFLE_xxx error code or TF_xxx message.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT LoadSetCat(
+ CHANNEL_PTR channel )
+{
+ INT (*func)( CHANNEL_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ if( ( func = supported_fmts[channel->cur_fmt].load_set_cat ) == NULL ) {
+ return( TF_NO_SC_FOR_SET ) ;
+ }
+
+ return( func( channel ) ) ;
+}
+
+
+/**/
+/**
+
+ Name: GetNextSMEntry
+
+ Description:
+
+ Returns: TFLE_xxx error code or TF_xxx message.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT GetNextSMEntry( CHANNEL_PTR channel )
+{
+ INT (*func)( CHANNEL_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ if( ( func = supported_fmts[channel->cur_fmt].get_next_sm_entry ) == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ return( func( channel ) ) ;
+}
+
+
+/**/
+/**
+
+ Name: GetNextSCEntry
+
+ Description:
+
+ Returns: TFLE_xxx error code or TF_xxx message.
+
+ Notes:
+
+ Declaration:
+
+**/
+
+INT GetNextSCEntry( CHANNEL_PTR channel )
+{
+ INT (*func)( CHANNEL_PTR ) ;
+
+ if( channel->cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ if( ( func = supported_fmts[channel->cur_fmt].get_next_sc_entry ) == NULL ) {
+ msassert( FALSE ) ;
+ return( TFLE_PROGRAMMER_ERROR1 ) ;
+ }
+
+ return( func( channel ) ) ;
+}
+
+
+/**/
+/**
+
+ Name: CloseTapeCatalogs
+
+ Description: This function deletes any temporary tape catalog files
+ in the current catalog directory.
+
+ Returns: Nothing
+
+ Notes:
+
+ Declaration:
+
+**/
+
+VOID CloseTapeCatalogs( INT16 cur_fmt, VOID_PTR env_ptr )
+{
+ VOID (*func)( VOID_PTR ) ;
+
+ if( cur_fmt == UNKNOWN_FORMAT ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+
+ if( ( func = supported_fmts[cur_fmt].close_catalogs ) == NULL ) {
+ msassert( FALSE ) ;
+ return ;
+ }
+
+ func( env_ptr ) ;
+}
+
diff --git a/private/utils/ntbackup/src/transutl.c b/private/utils/ntbackup/src/transutl.c
new file mode 100644
index 000000000..a454813a4
--- /dev/null
+++ b/private/utils/ntbackup/src/transutl.c
@@ -0,0 +1,382 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: transutl.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+
+ $Log: T:/LOGFILES/TRANSUTL.C_V $
+
+ Rev 1.7 22 Oct 1992 10:44:50 HUNTER
+Changes for new stream headers
+
+ Rev 1.6 22 Sep 1992 08:57:00 GREGG
+Initial changes to handle physical block sizes greater than 1K.
+
+ Rev 1.5 17 Aug 1992 08:35:12 GREGG
+Added AllocChannelTmpBlks function.
+
+ Rev 1.4 24 Jul 1992 16:47:00 NED
+Incorporated Skateboard and BigWheel changed into Graceful Red code,
+including MTF4.0 translator support, adding 3.1 file-system structures
+support to the 3.1 translator, additions to GOS to support non-4.0 translators.
+Also did Unicode and 64-bit filesize changes.
+
+ Rev 1.3 25 Mar 1992 19:38:34 GREGG
+ROLLER BLADES - 64 bit support.
+
+ Rev 1.2 17 Jan 1992 14:40:22 DON
+if OS_NLM, need to clib LongSwap instead of our macro BSwapLong
+
+ Rev 1.1 10 May 1991 11:57:24 GREGG
+Ned's new stuff.
+
+ Rev 1.0 10 May 1991 10:18:52 GREGG
+Initial revision.
+
+**/
+/* begin include list */
+
+#if defined(OS_NLM)
+ #include <nwmisc.h>
+#endif
+
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+
+#include "channel.h"
+#include "tfldefs.h"
+#include "transutl.h"
+#include "datetime.h"
+#include "stdmacro.h"
+#include "tfl_err.h"
+
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: CalcChecksum
+
+ Description: This routine will calculate the checksum for "length"
+ words starting at location pointed to by "start_ptr".
+ This routine supports both INTEL and MOTOROLA byte
+ ordering as byte order is unimportant.
+
+ Modified: August 17, 1989 (2:07pm)
+
+ Returns:
+
+ Notes: If the "checksum_ptr" is within the area being checksumed then
+ it starts out with a zero value and is updated after the checksum
+ has been calculated.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+UINT16 CalcChecksum(
+ UINT16_PTR start_ptr ,
+ UINT16 length ) /* In 16 bit words */
+{
+ UINT16 result_so_far = 0 ;
+
+ while( length-- ) {
+ result_so_far ^= *start_ptr++ ;
+ }
+
+ return( result_so_far ) ;
+}
+
+
+/**/
+/**
+
+ Name: SwapBlock
+
+ Description: This routine will take an "fmt_blk" array and a Data Block and convert
+ the Data Block to the correct format for the given machine. The process
+ continues until the next "fmt_blk" entry is zero.
+
+ Modified: 9/20/1989 10:45:53
+
+ Returns: Nothing
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+VOID SwapBlock(
+ UINT16_PTR fmt_blk ,
+ UINT8_PTR data_blk )
+{
+ UINT16 i ;
+ UINT16_PTR word_ptr ;
+ UINT32_PTR dword_ptr ;
+ UINT16 length ;
+
+ /* while more to process */
+ for( ; *fmt_blk ; fmt_blk++ ) {
+ /* How many items? */
+ length = ( *fmt_blk & ~MASK_UNUSED ) ;
+ /* what must we convert? */
+ switch( *fmt_blk & MASK_UNUSED ) {
+ /* do not convert double word */
+ case SIZE_DATE_TIME :
+ data_blk += ( sizeof( DATE_TIME ) * length ) ;
+ break ;
+ case SIZE_DWORD :
+ data_blk += ( sizeof( UINT32 ) * length ) ;
+ break ;
+ case SIZE_WORD :
+ data_blk += ( sizeof( UINT16 ) * length ) ;
+ break ;
+ case SIZE_DWORD + CNV :
+ for( i = 0 ; ( i < length ) ; i++ ) {
+ dword_ptr = ( UINT32_PTR ) data_blk ;
+#if defined(OS_NLM)
+ *dword_ptr = LongSwap( *dword_ptr ) ;
+#else
+ *dword_ptr = BSwapLong( *dword_ptr ) ;
+#endif
+ data_blk += sizeof( UINT32 ) ;
+ }
+ break ;
+ case SIZE_DATE_TIME + CNV :
+ length *= ( sizeof( DATE_TIME ) / 2 ) ;
+ /* fall through */
+ case SIZE_WORD + CNV :
+ for( i = 0 ; ( i < length ) ; i++ ) {
+ word_ptr = ( UINT16_PTR ) data_blk ;
+ *word_ptr = BSwapWord( *word_ptr ) ;
+ data_blk += sizeof( UINT16 ) ;
+ }
+ break ;
+ default :
+ data_blk += ( sizeof( CHAR ) * length ) ;
+ break ;
+ }
+ }
+ return ;
+}
+
+/**/
+/**
+
+ Name: ProcessDataFilter
+
+ Description: This decides how much data to allow to be transfered.
+
+ Modified: 9/20/1989 16:2:39
+
+ Returns: Nothing
+
+ Notes: THIS FUNCTION SHOULD NOT BE CALLED FOR CONTINUATION
+ BLOCKS. ALSO TDATA MUST BE FILLED BEFORE CALLING.
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+VOID ProcessDataFilter(
+ CHANNEL_PTR channel ,
+ UINT16 filter )
+{
+
+ ClrChannelStatus( channel, ( CH_SKIP_ALL_STREAMS | CH_SKIP_CURRENT_STREAM ) ) ;
+
+ /* Let's resolve the Filters */
+ if( channel->perm_filter == TF_SKIP_ALL_DATA ||
+ channel->loop_filter == TF_SKIP_ALL_DATA ) {
+
+ filter = TF_SKIP_ALL_DATA ;
+ }
+
+ switch( filter ) {
+
+ case TF_KEEP_ALL_DATA:
+ break ;
+
+ case TF_SKIP_ALL_DATA:
+ SetChannelStatus( channel, CH_SKIP_ALL_STREAMS ) ;
+ break ;
+
+
+ case TF_SKIP_DATA_STREAM:
+ SetChannelStatus( channel, CH_SKIP_CURRENT_STREAM ) ;
+ break ;
+
+ default:
+ msassert( FALSE ) ;
+
+
+ }
+
+ channel->active_filter = filter ;
+
+ return ;
+
+}
+
+/**/
+/**
+
+ Name: F25_Chksm
+
+ Description: Calculate a checksum by the 2.0 algorilla.
+
+ Modified: 8/13/1989
+
+ Returns: The checksum.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+
+UINT16 F25_Chksm(
+ CHAR_PTR ptr ,
+ UINT16 len )
+{
+ UINT16_PTR wptr = (UINT16_PTR)ptr ;
+ UINT16 wlen = len / 2 ;
+ UINT16 result = 0 ;
+ UINT16 i ;
+
+ /* start with result being 0, then XOR with previous */
+ for( i = 0 ; i < wlen ; i++ ) result ^= wptr[i] ;
+
+ return( ( 0 - result ) ) ;
+}
+
+/**/
+/**
+
+ Name: AllocChannelTmpBlks
+
+ Description: Allocates the memory for the temporary DBLK storage in
+ the channel.
+
+ Returns: TFLE_xxx
+
+ Notes:
+
+**/
+
+INT16 AllocChannelTmpBlks(
+ CHANNEL_PTR channel,
+ UINT size )
+{
+ if( channel->lst_osvcb != NULL ) {
+ free( channel->lst_osvcb ) ;
+ channel->lst_osvcb = NULL ;
+ }
+ if( channel->lst_osddb != NULL ) {
+ free( channel->lst_osddb ) ;
+ channel->lst_osddb = NULL ;
+ }
+ if( channel->lst_osfdb != NULL ) {
+ free( channel->lst_osfdb ) ;
+ channel->lst_osfdb = NULL ;
+ }
+ if( ( channel->lst_osvcb = (UINT8_PTR)calloc( 1, size ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ if( ( channel->lst_osddb = (UINT8_PTR)calloc( 1, size ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ if( ( channel->lst_osfdb = (UINT8_PTR)calloc( 1, size ) ) == NULL ) {
+ return( TFLE_NO_MEMORY ) ;
+ }
+ return( TFLE_NO_ERR ) ;
+}
+
+
+
+
+/* string substitute routines */
+
+INT16 cstrcmp( UINT8_PTR str1, UINT8_PTR str2 )
+{
+ while ( *str1 && *str2 && *str1 == *str2 ) {
+ str1++;
+ str2++;
+ }
+ return *str1 - *str2;
+}
+
+INT16 cstrncmp( UINT8_PTR str1, UINT8_PTR str2, UINT16 maxlen )
+{
+ while ( maxlen > 0 && *str1 && *str2 && *str1 == *str2 ) {
+ str1++;
+ str2++;
+ maxlen--;
+ }
+ return *str1 - *str2;
+}
+
+UINT8_PTR cstrcpy( UINT8_PTR dest, UINT8_PTR src )
+{
+ UINT8_PTR d = dest;
+
+ while ( ( *d++ = *src++ ) != '\0' )
+ /* empty loop */;
+ return dest;
+}
+
+UINT16 cstrlen( UINT8_PTR str )
+{
+ UINT16 len = 0;
+
+ while ( *str++ ) {
+ len++;
+ }
+ return len;
+}
+
+UINT8_PTR cstrncat( UINT8_PTR dest, UINT8_PTR src, UINT16 maxlen )
+{
+ UINT8_PTR d = dest;
+
+ while ( *d++ ) /* search for end of dest */
+ /* empty loop */ ;
+
+ while ( maxlen > 0 && ( *d = *src ) != '\0' ) {
+ d++;
+ src++;
+ maxlen--;
+ }
+
+ *d = 0;
+ return dest;
+}
+
+UINT8_PTR cstrncpy( UINT8_PTR dest, UINT8_PTR src, UINT16 maxlen )
+{
+ UINT8_PTR d = dest;
+
+ while ( maxlen > 0 && ( *d = *src ) != '\0' ) {
+ d++;
+ src++;
+ maxlen--;
+ }
+
+ *d = 0;
+ return dest;
+}
diff --git a/private/utils/ntbackup/src/treadobj.c b/private/utils/ntbackup/src/treadobj.c
new file mode 100644
index 000000000..b71e44c89
--- /dev/null
+++ b/private/utils/ntbackup/src/treadobj.c
@@ -0,0 +1,841 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: treadobj.c
+
+ Description: This file contains code to read data from an object
+
+ $Log: M:/LOGFILES/TREADOBJ.C_V $
+
+ Rev 1.39.1.0 03 Mar 1994 10:39:38 BARRY
+Defend against buffers zero bytes in length
+
+ Rev 1.39 26 Jan 1994 19:25:40 BARRY
+Shut up debug on GetLastError returning 0
+
+ Rev 1.38 23 Jan 1994 14:25:10 BARRY
+Added debug code
+
+ Rev 1.37 11 Jan 1994 19:14:42 BARRY
+Make sure path read size is a multiple of the character size
+
+ Rev 1.36 10 Dec 1993 14:32:00 BARRY
+Use correct stream IDs for path/file
+
+ Rev 1.35 01 Dec 1993 13:57:42 STEVEN
+fix delimiter replacment code
+
+ Rev 1.34 24 Nov 1993 14:46:36 BARRY
+Unicode fixes
+
+ Rev 1.33 18 Aug 1993 19:27:46 BARRY
+Kludge: if a read error occurs on dirs, null out the stream.
+
+ Rev 1.32 16 Aug 1993 22:02:22 BARRY
+If read of stream failed for any reason, and we didn't get it all, it's corrupt.
+
+ Rev 1.31 12 Aug 1993 14:37:06 BARRY
+Don't return data and errors at the same time.
+
+ Rev 1.30 16 Jul 1993 11:59:12 BARRY
+Return FS_STREAM_CORRUPT on premature FS_EOF_REACHED.
+
+ Rev 1.29 27 Jan 1993 13:51:12 STEVEN
+updates from msoft
+
+ Rev 1.28 15 Jan 1993 13:18:34 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.27 07 Dec 1992 14:18:00 STEVEN
+updates from msoft
+
+ Rev 1.26 24 Nov 1992 11:02:02 BARRY
+Changes to make LINK streams null-impregnated.
+
+ Rev 1.25 17 Nov 1992 22:19:24 DAVEV
+unicode fixes
+
+ Rev 1.24 11 Nov 1992 09:57:08 GREGG
+Changed INT8_PTR to CHAR_PTR for unicode compliance.
+
+ Rev 1.23 10 Nov 1992 08:18:50 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.22 06 Nov 1992 15:49:42 STEVEN
+test write of path in stream
+
+ Rev 1.21 02 Nov 1992 11:18:04 BARRY
+Don't back up path streams with leading null.
+
+ Rev 1.20 21 Oct 1992 19:44:06 BARRY
+Backup references to original on linked files.
+
+ Rev 1.19 19 Oct 1992 17:54:04 BARRY
+Made changes for latest incarnation of stream header functionality.
+
+ Rev 1.18 16 Oct 1992 16:42:08 STEVEN
+fix streams to UINT64
+
+ Rev 1.17 14 Oct 1992 14:37:06 BARRY
+Fixes for alternate data streams.
+
+ Rev 1.16 09 Oct 1992 14:31:26 BARRY
+Path-in-stream changes.
+
+ Rev 1.14 06 Oct 1992 11:12:30 BARRY
+BackupRead stream size corrections; bug fixes in stream header redesign.
+
+ Rev 1.13 24 Sep 1992 13:24:04 BARRY
+Changes for huge file name support.
+
+ Rev 1.12 18 Sep 1992 15:37:32 BARRY
+Changes for Stream Header redesign.
+
+ Rev 1.11 04 Sep 1992 17:14:58 STEVEN
+fix warnings
+
+ Rev 1.10 02 Sep 1992 07:48:32 STEVEN
+fix typo
+
+ Rev 1.9 01 Sep 1992 16:10:48 STEVEN
+added stream headers to fsys API
+
+ Rev 1.8 17 Aug 1992 16:21:06 STEVEN
+fix warnings
+
+ Rev 1.7 12 Aug 1992 17:47:52 STEVEN
+fixed bugs at microsoft
+
+ Rev 1.6 23 Jul 1992 13:13:12 STEVEN
+fix warnings
+
+ Rev 1.5 29 May 1992 13:45:22 STEVEN
+fixes
+
+ Rev 1.4 22 May 1992 16:05:44 STEVEN
+
+
+ Rev 1.3 21 May 1992 13:49:16 STEVEN
+more long path support
+
+ Rev 1.2 26 Feb 1992 12:35:08 STEVEN
+retval not initialized
+
+ Rev 1.1 12 Feb 1992 13:00:38 STEVEN
+fix buffer size passed in
+
+ Rev 1.0 10 Feb 1992 16:57:46 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+
+static INT16 NTFS_ReadPathStream( FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static INT16 NTFS_ReadFileNameStream( FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static INT16 NTFS_ReadData(
+ FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static INT16 NTFS_ReadLinkInfo( FILE_HAND hand,
+ BYTE_PTR buff,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static INT16 BackStreamHeader(
+ FILE_HAND hand,
+ STREAM_INFO_PTR s_info );
+
+static UINT16 CalcReadSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize );
+
+/**/
+/**
+
+ Name: NTFS_ReadObj()
+
+ Description: This function reads data from an opened object.
+
+ Modified: 7/31/1989
+
+ Returns: Error Codes:
+ FS_DEVICE_ERROR
+ FS_OBJECT_NOT_OPENED
+ FS_EOF_REACHED
+ SUCCESS
+
+ Notes: This function reads data in "chunks". If the buffer
+ is not a multiple of the "chunk" size then the buffer will not
+ be filled. The "Chunk" size is returned.
+
+**/
+INT16 NTFS_ReadObj(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size , /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size , /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info) /* O - Stream information for the data returned */
+{
+ NTFS_OBJ_HAND_PTR nt_hand = (NTFS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)hand->dblk ;
+ INT16 ret_val ;
+
+ msassert( hand->mode == FS_READ ) ;
+
+ if ( (nt_hand->needStreamHeader == FALSE) && (*size == 0) )
+ {
+ /*
+ * Someone asked us to read zero bytes. According to
+ * our rules this is not allowed, but we'll be defensive
+ * anyway.
+ */
+ msassert( FALSE );
+ *blk_size = 1;
+ ret_val = SUCCESS;
+ }
+ else
+ {
+ switch ( hand->dblk->blk_type )
+ {
+
+ case FDB_ID:
+ if ( (ddblk->b.f.fdb_attrib & FILE_NAME_IN_STREAM_BIT) &&
+ (nt_hand->nameComplete == FALSE) )
+ {
+ ret_val = NTFS_ReadFileNameStream( hand, buf, size, blk_size, s_info );
+ }
+ else
+ {
+ if ( ddblk->b.f.linkOnly )
+ {
+ ret_val = NTFS_ReadLinkInfo( hand, buf, size, blk_size, s_info );
+ }
+ else
+ {
+ ret_val = NTFS_ReadData( hand, buf, size, blk_size, s_info ) ;
+ }
+ }
+ nt_hand->needStreamHeader = U64_EQ( nt_hand->curPos, nt_hand->nextStreamHeaderPos);
+ break ;
+
+ case DDB_ID:
+ if ( (ddblk->b.d.ddb_attrib & DIR_PATH_IN_STREAM_BIT) &&
+ (nt_hand->nameComplete == FALSE) )
+ {
+ ret_val = NTFS_ReadPathStream( hand, buf, size, blk_size, s_info );
+ }
+ else
+ {
+ ret_val = NTFS_ReadData( hand, buf, size, blk_size, s_info ) ;
+ }
+ nt_hand->needStreamHeader = U64_EQ( nt_hand->curPos, nt_hand->nextStreamHeaderPos);
+ break;
+
+
+ case VCB_ID:
+ ret_val = FS_EOF_REACHED ;
+ break ;
+
+ default:
+ ret_val = FS_OBJECT_NOT_OPENED;
+ }
+ }
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: NTFS_ReadData()
+
+ Description: This function calls the NT Backup APIs to read data from
+ an open object.
+
+ Modified: 2/10/1992 16:48:9
+
+ Returns: FS_DEVICE_ERROR
+ FS_OBJECT_NOT_OPENED
+ FS_EOF_REACHED
+ SUCCESS
+
+**/
+static INT16 NTFS_ReadData(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info ) /* O - Stream information for the data returned */
+{
+ NTFS_OBJ_HAND_PTR nt_hand ;
+ INT16 ret_val = SUCCESS ;
+ INT status ;
+ INT sizeout ;
+ UINT16 buffSize;
+ BOOLEAN dummy;
+
+ *blk_size = 1 ;
+ nt_hand = (NTFS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+
+ buffSize = *size;
+ *size = 0;
+
+ if ( nt_hand->needStreamHeader )
+ {
+ ret_val = BackStreamHeader( hand, s_info );
+ }
+ else
+ {
+ UINT16 readSize;
+
+ s_info->id = STRM_INVALID;
+
+ if ( (nt_hand->streamHeader.name_leng > 0) &&
+ U64_EQ( nt_hand->curPos, U64_Init( 0, 0 ) ) )
+ {
+ UINT16 nameSize;
+
+ /* CBN -- Need the real Microsoft #define here */
+ msassert( nt_hand->streamHeader.id == 4 );
+ msassert( nt_hand->streamHeader.name_leng <= NT_MAX_STREAM_NAME_LENG );
+
+ nameSize = (UINT16)(nt_hand->streamHeader.name_leng +
+ sizeof(nt_hand->streamHeader.name_leng));
+
+ if ( buffSize < nameSize )
+ {
+ *blk_size = nameSize;
+ return SUCCESS;
+ }
+
+ status = BackupRead( nt_hand->fhand,
+ (LPBYTE)&nt_hand->streamHeader.name[0],
+ nt_hand->streamHeader.name_leng,
+ (LPDWORD)&sizeout,
+ FALSE,
+ TRUE,
+ &nt_hand->context ) ;
+
+ if ( !status || (sizeout < (INT)nt_hand->streamHeader.name_leng) )
+ {
+ NTFS_DebugPrint( TEXT("NTFS_ReadData: BackupRead error (alt stream name) %d")
+ TEXT(" on \"%s\""),
+ (int)GetLastError(),
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+
+ ret_val = FS_EOF_REACHED;
+ }
+ else
+ {
+ UINT16 nameSize;
+
+ nameSize = (UINT16)(nt_hand->streamHeader.name_leng +
+ sizeof(nt_hand->streamHeader.name_leng));
+
+ *size += nameSize;
+
+ memcpy( buf,
+ &nt_hand->streamHeader.name_leng,
+ sizeof(nt_hand->streamHeader.name_leng) );
+
+ buf += sizeof( nt_hand->streamHeader.name_leng );
+
+ memcpy( buf,
+ nt_hand->streamHeader.name,
+ nt_hand->streamHeader.name_leng );
+
+ buf += nt_hand->streamHeader.name_leng;
+
+ }
+ }
+ else
+ {
+ /* Only read up until the next stream. */
+
+ readSize = CalcReadSize( nt_hand->curPos,
+ nt_hand->nextStreamHeaderPos,
+ buffSize );
+
+ status = BackupRead( nt_hand->fhand,
+ buf,
+ readSize,
+ (LPDWORD)&sizeout,
+ FALSE,
+ TRUE,
+ &nt_hand->context ) ;
+
+ if ( sizeout != 0 )
+ {
+ /* We got data; only return SUCCESS or FS_EOF_REACHED */
+
+ if ( !status )
+ {
+ ret_val = NTFS_TranslateBackupError( GetLastError( ) );
+ if ( ret_val != FS_EOF_REACHED )
+ {
+ ret_val = SUCCESS;
+ }
+ }
+ }
+ else
+ {
+ NTFS_DebugPrint( TEXT("NTFS_ReadData: BackupRead error %d")
+ TEXT(" on \"%s\""),
+ (int)GetLastError(),
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+
+ if ( hand->dblk->blk_type == FDB_ID )
+ {
+ if ( !status )
+ {
+ ret_val = NTFS_TranslateBackupError( GetLastError( ) );
+ }
+
+ if ( ret_val == SUCCESS )
+ {
+ ret_val = FS_EOF_REACHED;
+ }
+ }
+ else
+ {
+ UINT32 seek;
+
+ /*
+ * This is a dir and we had problems. We can't
+ * very well write a CFDB or report a problem,
+ * so pad the bloody stream with zeros.
+ */
+
+ memset( buf, 0, readSize );
+ sizeout = readSize;
+
+ /*
+ * Seek in case, by some miracle, a following read
+ * really does work.
+ */
+
+ seek = (UINT32)readSize;
+ NTFS_SeekObj( hand, &seek );
+ }
+ }
+ *size += sizeout;
+ }
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)*size ),
+ &dummy );
+
+ /*
+ * It seems that if a share dies (or is killed), the
+ * the only "error" we get is EOF reached (which isn't
+ * an error at all). So, if we get EOF reached, we
+ * better make sure we're at the end of the stream --
+ * if not, that's a corruption.
+ */
+
+ if ( (ret_val != SUCCESS) &&
+ !U64_EQ( nt_hand->curPos, nt_hand->nextStreamHeaderPos) )
+ {
+ ret_val = FS_STREAM_CORRUPT;
+ }
+ }
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: NTFS_ReadPathStream()
+
+ Description: This function copies the path into the provided buffer.
+ It will prepare the stream info at the beginning of the
+ stream.
+
+ Modified: 08-Sep-92
+
+ Returns: SUCCESS
+
+**/
+static INT16 NTFS_ReadPathStream( FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info )
+{
+ NTFS_OBJ_HAND_PTR nt_hand ;
+ NTFS_DBLK_PTR ddblk;
+ BYTE_PTR p ;
+ UINT16 p_offset ;
+ UINT16 sizeRead;
+ BOOLEAN dummy;
+
+ ddblk = (NTFS_DBLK_PTR)(hand->dblk) ;
+ nt_hand = (NTFS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+
+ *blk_size = 1 ;
+
+ if ( nt_hand->needStreamHeader )
+ {
+ s_info->id = STRM_PATH_NAME;
+ s_info->fs_attrib = 0;
+ s_info->tf_attrib = 0;
+ s_info->size = U64_Init( ddblk->full_name_ptr->name_size, 0 );
+ nt_hand->nextStreamHeaderPos = s_info->size ;
+ nt_hand->needStreamHeader = FALSE ;
+ nt_hand->curPos = U64_Init( 0, 0 );
+ }
+ else
+ {
+ UINT16 pathLength = (UINT16)ddblk->full_name_ptr->name_size;
+
+ s_info->id = STRM_INVALID;
+
+ p = (BYTE_PTR)ddblk->full_name_ptr->name;
+
+ p_offset = (UINT16)U64_Lsw( nt_hand->curPos );
+ p += p_offset ;
+
+ if ( p_offset < pathLength )
+ {
+ sizeRead = min( *size, pathLength );
+
+ if ( sizeRead && (sizeRead % sizeof(CHAR)) )
+ {
+ sizeRead--;
+ }
+
+ if ( sizeRead > 0 )
+ {
+ UINT16 i;
+
+ for ( i = 0; (i < sizeRead/sizeof(CHAR) ); i++ )
+ {
+ CHAR_PTR p1, p2;
+ p1 = (CHAR_PTR)p;
+ p2 = (CHAR_PTR)buf;
+
+ if ( *p1 == TEXT('\\') )
+ {
+ *p2 = TEXT('\0');
+ }
+ else
+ {
+ *p2 = *p1;
+ }
+ buf+=sizeof(CHAR) ;
+ p+=sizeof(CHAR) ;
+ }
+ }
+ }
+ else
+ {
+ sizeRead = 0;
+ }
+ nt_hand->nameComplete = ((UINT16)(p_offset + sizeRead) == pathLength);
+
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)sizeRead ),
+ &dummy );
+
+ *size = sizeRead;
+ }
+ return SUCCESS;
+}
+
+/**/
+/**
+
+ Name: NTFS_ReadFileNameStream()
+
+ Description: This function copies the file name into the provided
+ buffer. It will prepare the stream info at the beginning
+ of the stream.
+
+ Modified: 24-Sep-92
+
+ Returns: FS_EOF_REACHED
+ SUCCESS
+
+**/
+static INT16 NTFS_ReadFileNameStream( FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = (NTFS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)(hand->dblk) ;
+ BYTE_PTR p ;
+ UINT16 p_offset ;
+ BOOLEAN dummy;
+ UINT16 sizeRead ;
+
+ *blk_size = 1 ;
+
+ if ( nt_hand->needStreamHeader )
+ {
+ s_info->id = STRM_FILE_NAME;
+ s_info->fs_attrib = 0;
+ s_info->tf_attrib = 0;
+ s_info->size = U64_Init( ddblk->full_name_ptr->name_size, 0 ) ;
+ nt_hand->nextStreamHeaderPos = s_info->size ;
+ }
+ else
+ {
+ UINT16 nameSize = (UINT16)ddblk->full_name_ptr->name_size;
+
+ s_info->id = STRM_INVALID;
+
+ p = (INT8_PTR)ddblk->full_name_ptr->name ;
+ p_offset = (UINT16)U64_Lsw( nt_hand->curPos );
+ p += p_offset ;
+
+ if ( p_offset < nameSize )
+ {
+ sizeRead = min( *size,
+ (UINT16)(ddblk->full_name_ptr->name_size - p_offset) ) ;
+
+ memcpy( buf, p, (size_t)sizeRead );
+ }
+ else
+ {
+ sizeRead = 0;
+ }
+
+ nt_hand->nameComplete = (p_offset + sizeRead) == nameSize;
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)sizeRead ),
+ &dummy );
+ *size = sizeRead;
+ }
+
+ return SUCCESS;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_ReadLinkInfo()
+
+ Description: Backs up the data stream for linked files.
+
+ Modified: 20-Oct-92
+
+ Returns: SUCCESS
+ FS_EOF_REACHED
+
+ Notes: Because it returns FS_EOF_REACHED at the end of the
+ stream, there is an implicit assumption that the link
+ information is the last stream for linked files.
+
+**/
+static INT16 NTFS_ReadLinkInfo( FILE_HAND hand,
+ BYTE_PTR buff,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = (NTFS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ INT16 ret = SUCCESS;
+ UINT16 buffSize;
+
+ buffSize = *size;
+ *size = 0;
+
+ nt_hand->sawSecurity = TRUE ;
+
+ if ( nt_hand->needStreamHeader &&
+ U64_EQ( nt_hand->curPos, U64_Init( 0, 0 ) ) )
+ {
+ /* Prepare the link stream info */
+ s_info->id = STRM_NTFS_LINK;
+ s_info->size = U64_Init( (UINT32)nt_hand->linkPtr->linkNameLen, 0 );
+ s_info->fs_attrib = 0;
+ s_info->tf_attrib = 0;
+
+ nt_hand->curPos = U64_Init( 0, 0 );
+ nt_hand->nextStreamHeaderPos = s_info->size;
+ }
+ else
+ {
+ s_info->id = STRM_INVALID;
+
+ if ( U64_EQ( nt_hand->curPos, nt_hand->nextStreamHeaderPos ) )
+ {
+ ret = FS_EOF_REACHED;
+ }
+ else
+ {
+ UINT16 readSize;
+ BOOLEAN dummy;
+
+ /* Transfer the link stream to the buffer */
+
+ readSize = CalcReadSize( nt_hand->curPos,
+ nt_hand->nextStreamHeaderPos,
+ buffSize );
+ memcpy( buff,
+ (BYTE_PTR)nt_hand->linkPtr->linkName + U64_Lsw( nt_hand->curPos ),
+ readSize );
+
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)readSize ),
+ &dummy );
+ *size = readSize;
+ }
+ }
+ return ret;
+}
+
+
+/**/
+/**
+
+ Name: BackStreamHeader()
+
+ Description: This function reads an NT stream header from the
+ Backup API and translates it to STREAM_INFO.
+
+ Modified: 08-Sep-92
+
+ Returns: FS_EOF_REACHED
+ SUCCESS
+
+ Notes:
+
+**/
+static INT16 BackStreamHeader(
+ FILE_HAND hand, /* I - handle of object to read from */
+ STREAM_INFO_PTR s_info ) /* O - Stream information for the data returned */
+{
+ NTFS_OBJ_HAND_PTR nt_hand = (NTFS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ INT16 ret_val = SUCCESS ;
+ INT status ;
+ INT sizeout ;
+
+ nt_hand->curPos = U64_Init( 0, 0 );
+
+ status = BackupRead( nt_hand->fhand,
+ (LPBYTE)&nt_hand->streamHeader,
+ NT_SIZEOF_NAMELESS_STREAM_HEAD,
+ (LPDWORD)&sizeout,
+ FALSE,
+ TRUE,
+ &nt_hand->context ) ;
+
+ if ( !status || (sizeout < NT_SIZEOF_NAMELESS_STREAM_HEAD) )
+ {
+ DWORD error = GetLastError();
+
+ if ( (error != NO_ERROR) &&
+ (error != ERROR_HANDLE_EOF) &&
+ (error != ERROR_INVALID_PARAMETER) )
+ {
+ NTFS_DebugPrint( TEXT("NTFS_BackStreamHeader: BackupRead error %d")
+ TEXT(" on \"%s\""),
+ (int)error,
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+ }
+
+ s_info->id = STRM_INVALID;
+ ret_val = FS_EOF_REACHED;
+ }
+ else
+ {
+ s_info->id = NTFS_MSoftToMayn( nt_hand->streamHeader.id );
+ s_info->fs_attrib = (UINT16)nt_hand->streamHeader.attrib;
+ s_info->tf_attrib = 0 ;
+ s_info->size = U64_Init( nt_hand->streamHeader.size_lo,
+ nt_hand->streamHeader.size_hi ) ;
+
+ if ( nt_hand->streamHeader.attrib & STREAM_CONTAINS_SECURITY ) {
+ nt_hand->sawSecurity = TRUE ;
+ }
+
+ nt_hand->needStreamHeader = FALSE;
+
+ if ( nt_hand->streamHeader.name_leng > 0 )
+ {
+ BOOLEAN dummy;
+ UINT16 nameSize;
+
+ nameSize = (UINT16)(nt_hand->streamHeader.name_leng +
+ sizeof(nt_hand->streamHeader.name_leng));
+
+ s_info->size = U64_Add( s_info->size,
+ U32_To_U64( (UINT32)nameSize ),
+ &dummy ) ;
+ }
+ nt_hand->nextStreamHeaderPos = s_info->size ;
+ }
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: CalcReadSize()
+
+ Description: Calculates 16-bit read size from 64-bit position
+ information and 16-bit buffer size.
+
+ Modified: 08-Sep-92
+
+ Returns: Amount of data to read.
+
+ Notes:
+
+**/
+static UINT16 CalcReadSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize )
+{
+ UINT16 readSize;
+ BOOLEAN mathStat;
+
+ if ( U64_GT( U64_Add( startPos,
+ U32_To_U64( (UINT32)buffSize ),
+ &mathStat ),
+ endPos ) )
+ {
+ UINT64 rs;
+
+ rs = U64_Sub( endPos,
+ startPos,
+ &mathStat );
+
+ msassert( mathStat && (U64_Msw( rs ) == 0) && (U64_Lsw(rs) < 65536) );
+
+ readSize = (UINT16)U64_Lsw( rs );
+ } else {
+ readSize = buffSize;
+ }
+
+ return readSize;
+}
+
diff --git a/private/utils/ntbackup/src/tree.ico b/private/utils/ntbackup/src/tree.ico
new file mode 100644
index 000000000..bac427399
--- /dev/null
+++ b/private/utils/ntbackup/src/tree.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/treefile.ico b/private/utils/ntbackup/src/treefile.ico
new file mode 100644
index 000000000..f7e72496c
--- /dev/null
+++ b/private/utils/ntbackup/src/treefile.ico
Binary files differ
diff --git a/private/utils/ntbackup/src/tseekobj.c b/private/utils/ntbackup/src/tseekobj.c
new file mode 100644
index 000000000..663c733c7
--- /dev/null
+++ b/private/utils/ntbackup/src/tseekobj.c
@@ -0,0 +1,143 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tseekobj.c
+
+ Description: This file contains code to Seek to specific portion of
+ an opened object.
+
+
+ $Log: M:/LOGFILES/TSEEKOBJ.C_V $
+
+ Rev 1.4 22 Mar 1994 16:18:38 BARRY
+Update needStreamHeader flag after seeking on a handle opened for READ
+
+ Rev 1.3 16 Aug 1993 22:32:30 BARRY
+Allow seek of zero bytes without error.
+
+ Rev 1.2 02 Nov 1992 14:52:16 BARRY
+Added BackupSeek functionality.
+
+ Rev 1.1 21 May 1992 13:49:18 STEVEN
+more long path support
+
+ Rev 1.0 12 Feb 1992 10:48:20 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+
+/**/
+/**
+
+ Name: NTFS_SeekObj()
+
+ Description: This function seeks to the specified location of an
+ opened object.
+
+ Modified: 02-Nov-92
+
+ Returns: Error Codes :
+ FS_OBJECT_NOT_OPENED
+ FS_EOF_REACHED
+ SUCCESS
+
+**/
+INT16 NTFS_SeekObj(
+ FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ) /*I/O- Offset to seek; bytes actually seeked */
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ INT16 ret;
+
+ switch ( hand->dblk->blk_type )
+ {
+ case FDB_ID:
+ case DDB_ID:
+ {
+ DWORD wentLo;
+ DWORD wentHi;
+ BOOLEAN stat;
+
+ /*
+ * Make sure we don't seek into the next stream header
+ */
+ if ( U64_GT( U64_Add( nt_hand->curPos,
+ U32_To_U64( *offset ),
+ &stat ),
+ nt_hand->nextStreamHeaderPos ) )
+ {
+ UINT64 seek;
+
+ seek = U64_Sub( nt_hand->nextStreamHeaderPos,
+ nt_hand->curPos,
+ &stat );
+
+ msassert( stat && (U64_Msw(seek) == 0) );
+ *offset = U64_Lsw( seek );
+ }
+
+ if ( *offset == 0 )
+ {
+ /*
+ * A seek of zero bytes should be OK
+ */
+ ret = SUCCESS;
+ }
+ else
+ {
+ stat = BackupSeek( nt_hand->fhand,
+ *offset,
+ 0,
+ &wentLo,
+ &wentHi,
+ &nt_hand->context );
+ if ( stat )
+ {
+ ret = SUCCESS;
+ *offset = wentLo;
+ msassert( wentHi == 0 );
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( *offset ),
+ &stat );
+ }
+ else
+ {
+ ret = FS_EOF_REACHED;
+ }
+ }
+ break;
+ }
+
+ default:
+ *offset = 0;
+ ret = FS_OBJECT_NOT_OPENED;
+ break;
+ }
+
+ /*
+ * Since we may have moved the curPos, we need to update the flag
+ * that indicates whether we're ready for another stream header.
+ * (The only place we look at this is in the ReadObj code.)
+ */
+ if ( hand->mode == FS_READ )
+ {
+ nt_hand->needStreamHeader = U64_EQ( nt_hand->curPos,
+ nt_hand->nextStreamHeaderPos);
+ }
+ return ret;
+}
+
+
diff --git a/private/utils/ntbackup/src/tsetinfo.c b/private/utils/ntbackup/src/tsetinfo.c
new file mode 100644
index 000000000..29d7b9e7c
--- /dev/null
+++ b/private/utils/ntbackup/src/tsetinfo.c
@@ -0,0 +1,237 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tsetinfo.c
+
+ Description: This file contains code to write the OS specific
+ data stored in the DBLKS to the OS
+
+
+ $Log: N:/LOGFILES/TSETINFO.C_V $
+
+ Rev 1.8 07 Dec 1992 14:18:24 STEVEN
+updates from msoft
+
+ Rev 1.7 17 Nov 1992 22:18:44 DAVEV
+unicode fixes
+
+ Rev 1.6 11 Nov 1992 09:53:38 GREGG
+Unicodeized literals.
+
+ Rev 1.5 10 Nov 1992 08:20:38 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.4 24 Sep 1992 13:43:56 BARRY
+Changes for huge file name support.
+
+ Rev 1.3 21 May 1992 13:51:02 STEVEN
+more long path stuff
+
+ Rev 1.2 04 May 1992 09:24:22 LORIB
+Changes to variable length paths and fixes for structure member names.
+
+ Rev 1.1 28 Feb 1992 13:03:50 STEVEN
+step one for varible length paths
+
+ Rev 1.0 10 Feb 1992 16:45:24 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "msassert.h"
+
+static INT16 NTFS_SetFileInfo( FSYS_HAND fsh, NTFS_DBLK_PTR ddblk ) ;
+static INT16 NTFS_SetDirInfo( FSYS_HAND fsh, NTFS_DBLK_PTR ddblk ) ;
+
+/**/
+/**
+
+ Name: NTFS_SetObjInfo()
+
+ Description: This funciton writes the OS info in a DBLK to disk
+
+ Modified: 2/10/1992 16:31:17
+
+ Returns: Error codes:
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ SUCCESS
+
+ Notes: Only type supported are FDBs and DDBs
+
+**/
+INT16 NTFS_SetObjInfo( fsh, dblk )
+FSYS_HAND fsh ; /* I - file system handle */
+DBLK_PTR dblk ; /* I - data to write to disk */
+{
+ INT16 ret_val;
+ NTFS_DBLK_PTR ddblk;
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+
+ msassert( fsh->attached_dle != NULL ) ;
+
+ switch ( ddblk->blk_type ) {
+
+ case FDB_ID :
+
+ ret_val = NTFS_SetFileInfo( fsh, ddblk ) ;
+ break ;
+
+ case DDB_ID:
+
+ ret_val = NTFS_SetDirInfo( fsh, ddblk ) ;
+ break ;
+
+ break;
+
+ default:
+
+ ret_val = FS_NOT_FOUND ;
+ }
+
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_SetFileInfo()
+
+ Description: This funciton writes the file information
+ in the FDB to disk. The file is assumed to already
+ be closed.
+
+ Modified: 2/10/1992 16:32:55
+
+ Returns: Error codes:
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ SUCCESS
+
+ Notes:
+
+**/
+static INT16 NTFS_SetFileInfo( fsh, ddblk )
+FSYS_HAND fsh ; /* I - File system handle */
+NTFS_DBLK_PTR ddblk ; /* I - Data to write to disk */
+{
+ INT16 ret_val = SUCCESS ;
+ CHAR_PTR path ;
+
+ if ( NTFS_SetupWorkPath( fsh,
+ fsh->cur_dir,
+ ddblk->full_name_ptr->name,
+ &path ) != SUCCESS) {
+
+ return OUT_OF_MEMORY ;
+ }
+
+ ddblk->b.f.handle = CreateFile( path,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL| FILE_FLAG_BACKUP_SEMANTICS,
+ NULL ) ;
+
+
+ if ( ddblk->b.f.handle != INVALID_HANDLE_VALUE ) {
+ DWORD attrib;
+
+ SetFileTime( ddblk->b.f.handle,
+ &(ddblk->dta.create_time),
+ &(ddblk->dta.access_time),
+ &(ddblk->dta.modify_time) ) ;
+
+ CloseHandle( ddblk->b.f.handle ) ;
+
+ attrib = ddblk->dta.os_attr ;
+ if (attrib == 0 ) {
+ attrib = FILE_ATTRIBUTE_NORMAL ;
+ }
+
+ if ( !SetFileAttributes( path, attrib ) ) {
+ ret_val = FS_ACCESS_DENIED ;
+ }
+
+ } else {
+ ret_val = FS_ACCESS_DENIED ;
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ return ret_val ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_SetDirInfo()
+
+ Description: This funciton sets the attributes of a NTFS directory.
+
+ Modified: 7/26/1989
+
+ Returns: Error codes:
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ SUCCESS
+
+ Notes:
+
+ See also: $/SEE( DOS_SetDirInfo() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 NTFS_SetDirInfo( fsh, ddblk )
+FSYS_HAND fsh ; /* I - File system handle */
+NTFS_DBLK_PTR ddblk ; /* I - Data to write to disk */
+{
+ INT16 ret_val = SUCCESS ;
+ CHAR_PTR path ;
+ DWORD attrib ;
+
+ path = ddblk->full_name_ptr->name ;
+
+ if ( NTFS_SetupWorkPath( fsh, path, NULL, &path ) != SUCCESS) {
+ return OUT_OF_MEMORY ;
+ }
+
+ if ( path[3] != TEXT('\0') ) {
+
+ attrib = ddblk->dta.os_attr ;
+ if ( attrib == 0 ) {
+ attrib = FILE_ATTRIBUTE_NORMAL ;
+ }
+ if ( !SetFileAttributes( path, attrib ) ) {
+ ret_val = FS_ACCESS_DENIED ;
+ }
+
+ /* Setting the time and date for a DOS directory */
+ /* would require a disk write over the directory file. */
+ /* (see DOS 3.3 Tech Ref manual page 5-10) The directory */
+ /* entries have different structures in different version of */
+ /* DOS. */
+
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ return ret_val ;
+}
diff --git a/private/utils/ntbackup/src/tsize.c b/private/utils/ntbackup/src/tsize.c
new file mode 100644
index 000000000..256746783
--- /dev/null
+++ b/private/utils/ntbackup/src/tsize.c
@@ -0,0 +1,253 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tsize.c
+
+ Description: This file contains code to get the size of the
+ variable length fields in FDBs and DDBs
+
+
+ $Log: N:/LOGFILES/TSIZE.C_V $
+
+ Rev 1.13 21 Feb 1994 20:53:54 STEVEN
+inconsistance between info and infoSize
+
+ Rev 1.12 10 Nov 1992 08:20:42 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.11 06 Nov 1992 16:27:54 STEVEN
+test unlimited file sizes
+
+ Rev 1.10 06 Nov 1992 15:49:28 STEVEN
+test write of path in stream
+
+ Rev 1.9 09 Oct 1992 14:33:34 BARRY
+Name-in-stream changes.
+
+ Rev 1.7 24 Sep 1992 13:43:58 BARRY
+Changes for huge file name support.
+
+ Rev 1.6 20 Jul 1992 10:43:14 STEVEN
+backup short file name
+
+ Rev 1.5 09 Jun 1992 15:15:08 BURT
+Sync with NT stuff
+
+ Rev 1.3 22 May 1992 16:05:30 STEVEN
+
+
+ Rev 1.2 21 May 1992 13:49:10 STEVEN
+more long path support
+
+ Rev 1.1 04 May 1992 09:19:14 LORIB
+Changed structure member "dta" to "b.f".
+
+ Rev 1.0 17 Jan 1992 17:50:02 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+#include "msassert.h"
+#include "tfldefs.h"
+#include "fsys.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "osinfo.h"
+
+
+/**/
+/**
+
+ Name: NTFS_SizeofFname()
+
+ Description: This function returns the size of the file
+ name contained in the FDB bassed in
+
+ Modified: 9/11/1989
+
+ Returns: number of bytes including terminating NULL.
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 NTFS_SizeofFname( fsh, fdb )
+FSYS_HAND fsh; /* I - file system in use */
+DBLK_PTR fdb ; /* I - dblk to get fname from */
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)fdb;
+ INT16 size ;
+
+ (void)fsh ;
+
+ msassert( fdb->blk_type == FDB_ID ) ;
+
+ size = (INT16)ddblk->full_name_ptr->name_size ;
+
+ return size ;
+}
+
+/**/
+/**
+
+ Name: NTFS_SizeofOSFname()
+
+ Description: This function returns the size of the file
+ name (as it appears on tape) contained in the FDB bassed in
+
+ Modified: 9/11/1989
+
+ Returns: number of bytes including terminating NULL.
+
+ Notes:
+
+**/
+INT16 NTFS_SizeofOSFname( fsh, fdb )
+FSYS_HAND fsh; /* I - file system in use */
+DBLK_PTR fdb ; /* I - dblk to get fname from */
+{
+ NTFS_DBLK_PTR ddblk = (NTFS_DBLK_PTR)fdb;
+ INT16 size ;
+
+ (void)fsh ;
+
+ msassert( fdb->blk_type == FDB_ID ) ;
+
+ if ( fdb->com.os_name == NULL ) // backup only
+ {
+ size = (INT16)strsize( ddblk->full_name_ptr->name ) ;
+ }
+ else
+ {
+ size = (INT16)fdb->com.os_name->name_size ;
+
+ }
+ return size ;
+}
+
+/**/
+/**
+
+ Name: NTFS_SizeofPath()
+
+ Description: This function return the size of the path saved in the
+ DDB.
+
+ Modified: 9/11/1989
+
+ Returns: Number of bytes in path string
+
+ Notes:
+
+**/
+INT16 NTFS_SizeofPath( fsh, ddb )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR ddb ; /* I - DBLK to get path size from */
+{
+ NTFS_DBLK_PTR ddblk ;
+ INT16 size;
+
+ (VOID)fsh ;
+
+ msassert( ddb->blk_type == DDB_ID ) ;
+
+ ddblk = ( NTFS_DBLK_PTR) ddb ;
+
+ size = (INT16)ddblk->full_name_ptr->name_size;
+
+ return size;
+}
+/**/
+/**
+
+ Name: NTFS_SizeofOSPath()
+
+ Description: This function return the size of the path saved in the
+ DDB.
+
+ Modified: 9/11/1989
+
+ Returns: Number of bytes in path string
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 NTFS_SizeofOSPath( fsh, ddb )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR ddb ; /* I - DBLK to get path size from */
+{
+ NTFS_DBLK_PTR dddb = (NTFS_DBLK_PTR)ddb ;
+ INT16 size;
+
+ (void)fsh ;
+ msassert( ddb->blk_type == DDB_ID ) ;
+
+
+ if ( ddb->com.os_name != NULL )
+ {
+ size = ddb->com.os_name->name_size ;
+ }
+ else
+ {
+ size = (INT16)dddb->full_name_ptr->name_size ;
+ }
+ return size;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_SizeofOSInfo()
+
+ Description: This function returns the size of the OS info for
+ an FDB or a DDB
+
+ Modified: 9/11/1989
+
+ Returns: Size in bytes.
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 NTFS_SizeofOSInfo( fsh, dblk)
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk; /* I - DBLK to get size of OS info for */
+{
+ NTFS_DBLK_PTR ddblk ;
+ INT16 size ;
+
+ (void)fsh ;
+
+ ddblk = (NTFS_DBLK_PTR)dblk ;
+
+ if ( dblk->blk_type == BT_FDB ) {
+
+ size = sizeof( NT_FILE_OS_INFO ) ;
+
+ if ( ddblk->b.f.alt_name[0] != TEXT('\0') ) {
+
+ size += strsize( ddblk->b.f.alt_name ) ;
+ }
+
+ } else if ( dblk->blk_type == BT_DDB ) {
+ size = (INT16)sizeof( NT_DIR_OS_INFO ) ;
+
+ } else {
+
+ size = 0;
+
+ }
+ return size;
+}
diff --git a/private/utils/ntbackup/src/tverinfo.c b/private/utils/ntbackup/src/tverinfo.c
new file mode 100644
index 000000000..f7b6355d8
--- /dev/null
+++ b/private/utils/ntbackup/src/tverinfo.c
@@ -0,0 +1,279 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tverinfo.c
+
+ Description: This file contains code to verify the DBLKS
+
+ $Log: N:\logfiles\tverinfo.c_v $
+
+ Rev 1.20.1.2 15 Jul 1994 19:52:32 STEVEN
+fix more net errors
+
+ Rev 1.20.1.1 17 Jun 1994 20:05:16 STEVEN
+fix bug with net dissconect
+
+ Rev 1.20.1.0 26 Apr 1994 19:01:42 STEVEN
+fix disconnect bug
+
+ Rev 1.20 22 Feb 1994 16:27:24 STEVEN
+GetFileAttributes does not check Backup Priv
+
+ Rev 1.19 23 Jan 1994 14:04:56 BARRY
+Added debug code
+
+ Rev 1.18 04 Nov 1993 17:07:00 BARRY
+Make errors a little different when we can't get object info
+
+ Rev 1.17 18 Aug 1993 12:01:42 BARRY
+Don't do FindFirst for dirs, call GetFileAttributes instead.
+
+ Rev 1.16 29 Jun 1993 16:14:08 BARRY
+If info fails to verify, check to see if it's a registry file. If so, skip it.
+
+ Rev 1.15 01 Jun 1993 16:20:06 STEVEN
+fix posix bugs
+
+ Rev 1.14 08 Apr 1993 17:01:38 BARRY
+Don't check date/time on files.
+
+ Rev 1.13 11 Mar 1993 21:06:34 BARRY
+Now report file size and date/time differences.
+
+ Rev 1.12 24 Feb 1993 17:33:02 BARRY
+Fixed improper return code when files not found.
+
+ Rev 1.11 27 Jan 1993 13:51:16 STEVEN
+updates from msoft
+
+ Rev 1.10 11 Jan 1993 08:48:46 STEVEN
+fix bugs from microsoft
+
+ Rev 1.9 11 Nov 1992 09:53:42 GREGG
+Unicodeized literals.
+
+ Rev 1.8 10 Nov 1992 08:18:58 STEVEN
+removed path and name from dblk now use full_name_ptr
+
+ Rev 1.7 24 Sep 1992 13:43:58 BARRY
+Changes for huge file name support.
+
+ Rev 1.6 25 Jun 1992 11:20:08 STEVEN
+dates compared in wrong units
+
+ Rev 1.5 21 May 1992 13:51:00 STEVEN
+more long path stuff
+
+ Rev 1.4 04 May 1992 09:23:36 LORIB
+Changes for variable length paths.
+
+ Rev 1.3 12 Mar 1992 15:50:38 STEVEN
+64 bit changes
+
+ Rev 1.2 28 Feb 1992 13:03:30 STEVEN
+step one for varible length paths
+
+ Rev 1.0 12 Feb 1992 14:28:20 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "msassert.h"
+
+#define ATTR_MSK ( FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM )
+
+/**/
+/**
+
+ Name: NTFS_VerObjInfo()
+
+ Description: This funciton compares the data in a DBLK with
+ the data returned by the operating system.
+
+ Modified: 2/12/1992 13:6:5
+
+ Returns: Error Codes:
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ FS_INFO_DIFFERENT
+ SUCCESS
+
+ Notes: For FDBs this funciton will check the current
+ directory for the specified file.
+
+**/
+INT16 NTFS_VerObjInfo( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* I - On entry it is minimal on exit Complete */
+{
+ INT16 ret_val = SUCCESS ;
+ NTFS_DBLK_PTR ddblk;
+ HANDLE old_scan_hand ;
+ WIN32_FIND_DATA find_data ;
+ CHAR_PTR path_string ;
+ CHAR_PTR org_path_string ;
+
+ msassert( dblk != NULL );
+ msassert( fsh->attached_dle != NULL ) ;
+
+ /* form BASE_PATH */
+
+ ddblk = (NTFS_DBLK_PTR) dblk;
+
+ switch( dblk->blk_type ){
+
+ case DDB_ID :
+
+ path_string = ddblk->full_name_ptr->name ;
+
+ if ( path_string[ 0 ] != TEXT('\0') )
+ {
+
+ if ( NTFS_SetupWorkPath( fsh, path_string, NULL, &path_string ) != SUCCESS)
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ memset( &find_data, 0, sizeof( find_data ) ) ;
+ old_scan_hand = FindFirstFile( path_string, &find_data ) ;
+
+ if ( old_scan_hand == (HANDLE)-1 )
+ {
+ DWORD error = GetLastError();
+
+ if ( ( error == ERROR_NETNAME_DELETED ) ||
+ ( error == ERROR_BAD_NETPATH ) ||
+ ( error == ERROR_UNEXP_NET_ERR ) ||
+ ( error == ERROR_BAD_NET_NAME ) )
+ {
+ ret_val = FS_COMM_FAILURE ;
+ }
+
+ else if ( error == ERROR_FILE_NOT_FOUND )
+ {
+ ret_val = FS_NOT_FOUND;
+ }
+ else
+ {
+ ret_val = FS_ACCESS_DENIED;
+ }
+ }
+ else
+ {
+ if ( (find_data.dwFileAttributes & ATTR_MSK) != (ddblk->dta.os_attr & ATTR_MSK) )
+ {
+ ret_val = FS_INFO_DIFFERENT;
+ }
+ FindClose( old_scan_hand ) ;
+
+ }
+
+ NTFS_ReleaseWorkPath( fsh ) ;
+
+ }
+ else
+ {
+ /* info about NTFS root directories cannot be modified */
+ ret_val = SUCCESS ;
+ }
+ break;
+
+
+
+ case FDB_ID :
+
+ if ( NTFS_SetupWorkPath( fsh,
+ fsh->cur_dir,
+ ddblk->full_name_ptr->name,
+ &path_string ) != SUCCESS)
+ {
+ return OUT_OF_MEMORY ;
+ }
+
+ org_path_string = path_string ;
+ path_string = NTFS_GetTempName( path_string );
+
+ memset( &find_data, 0, sizeof( find_data ) ) ;
+ old_scan_hand = FindFirstFile( path_string, &find_data ) ;
+
+ /*
+ * if the names differ only by case then look for another
+ * file with same name
+ */
+ if ( ( old_scan_hand != INVALID_HANDLE_VALUE ) &&
+ ( fsh->attached_dle->feature_bits & DLE_FEAT_CASE_PRESERVING ) &&
+ ( path_string == org_path_string ) &&
+ strcmp( ddblk->full_name_ptr->name, find_data.cFileName ) ) {
+
+
+ if ( !FindNextFile( old_scan_hand, &find_data ) )
+ {
+ old_scan_hand = INVALID_HANDLE_VALUE;
+ }
+ }
+
+ if ( old_scan_hand == INVALID_HANDLE_VALUE )
+ {
+ DWORD error = GetLastError();
+
+ NTFS_DebugPrint( TEXT("NTFS_VerObjInfo: FindFirst/NextFile")
+ TEXT(" error = %d, path = \"%s\""),
+ (int)GetLastError(),
+ path_string );
+
+ if ( ( error == ERROR_NETNAME_DELETED ) ||
+ ( error == ERROR_BAD_NET_NAME ) )
+ {
+ ret_val = FS_COMM_FAILURE ;
+ }
+ else if ( error == ERROR_FILE_NOT_FOUND )
+ {
+ ret_val = FS_NOT_FOUND;
+ }
+ else
+ {
+ ret_val = FS_ACCESS_DENIED;
+ }
+ }
+ else
+ {
+ UINT64 fsize;
+
+ fsize = U64_Init( find_data.nFileSizeLow, find_data.nFileSizeHigh ) ;
+
+ if ( ((find_data.dwFileAttributes & ATTR_MSK) != (ddblk->dta.os_attr & ATTR_MSK)) ||
+ (!U64_EQ( fsize, ddblk->dta.size)) )
+ {
+ if ( REG_IsRegistryFile( fsh->attached_dle, path_string ) )
+ {
+ ret_val = FS_SKIP_OBJECT;
+ }
+ else
+ {
+ ret_val = FS_INFO_DIFFERENT ;
+ }
+ }
+ FindClose( old_scan_hand ) ;
+ }
+ NTFS_ReleaseWorkPath( fsh ) ;
+ break ;
+
+ case VCB_ID:
+ ret_val = SUCCESS ;
+ break ;
+
+ default :
+ ret_val = FS_NOT_FOUND ;
+ }
+ return ret_val ;
+}
diff --git a/private/utils/ntbackup/src/tverobj.c b/private/utils/ntbackup/src/tverobj.c
new file mode 100644
index 000000000..39a3ff2a4
--- /dev/null
+++ b/private/utils/ntbackup/src/tverobj.c
@@ -0,0 +1,920 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tverobj.c
+
+ Description: This file verifies the object data.
+
+
+ $Log: M:/LOGFILES/TVEROBJ.C_V $
+
+ Rev 1.26.2.1 24 Mar 1994 20:28:58 BARRY
+Fix frag on alt stream names
+
+ Rev 1.26.2.0 21 Mar 1994 18:34:10 GREGG
+Steve's fix of bug with verify and mac info.
+
+ Rev 1.26 28 Jan 1994 10:34:20 GREGG
+More Warning Fixes
+
+ Rev 1.25 23 Jan 1994 14:21:34 BARRY
+Added debug code
+
+ Rev 1.24 06 Jan 1994 12:35:50 BARRY
+Don't bother calling the OS if a zero-byte buffer comes down
+
+ Rev 1.23 10 Dec 1993 14:31:16 BARRY
+Use correct stream IDs for path/file
+
+ Rev 1.22 24 Nov 1993 15:00:54 BARRY
+Changed CHAR_PTRs in I/O functions to BYTE_PTRs
+
+ Rev 1.21 14 Oct 1993 17:50:08 STEVEN
+fix unicode bugs
+
+ Rev 1.20 12 Aug 1993 16:01:12 BARRY
+Don't do infinite loop on zero bytes read.
+
+ Rev 1.19 08 Jul 1993 12:20:08 BARRY
+Don't verify CRC streams
+
+ Rev 1.18 29 Jun 1993 16:21:10 BARRY
+Don't verify registry files.
+
+ Rev 1.17 03 Jun 1993 18:44:06 BARRY
+Got rid of redundant local var.
+
+ Rev 1.16 01 Jun 1993 16:20:24 STEVEN
+fix posix bugs
+
+ Rev 1.15 26 May 1993 14:44:38 STEVEN
+alignment bug with mips
+
+ Rev 1.14 11 Mar 1993 12:09:54 BARRY
+Fixed to uniquely identify alternate data streams.
+
+ Rev 1.13 08 Feb 1993 11:49:44 BARRY
+Discard NACL streams if restoreSecurity in config is FALSE.
+
+ Rev 1.12 27 Jan 1993 13:51:20 STEVEN
+updates from msoft
+
+ Rev 1.11 08 Dec 1992 10:30:56 STEVEN
+fix verify of alt data stream
+
+ Rev 1.10 07 Dec 1992 14:16:16 STEVEN
+updates from msoft
+
+ Rev 1.9 09 Nov 1992 17:37:42 BARRY
+Make verify stream-aware.
+
+ Rev 1.8 02 Nov 1992 10:38:24 STEVEN
+needed to set blk_size
+
+ Rev 1.7 18 Sep 1992 15:39:12 BARRY
+Changes for Stream Header redesign.
+
+ Rev 1.6 02 Sep 1992 07:48:34 STEVEN
+fix typo
+
+ Rev 1.5 01 Sep 1992 16:11:14 STEVEN
+added stream headers to fsys API
+
+ Rev 1.4 17 Aug 1992 16:22:50 STEVEN
+fix warnings
+
+ Rev 1.3 12 Aug 1992 17:48:00 STEVEN
+fixed bugs at microsoft
+
+ Rev 1.2 11 Jun 1992 16:34:28 STEVEN
+verify was failing
+
+ Rev 1.1 21 May 1992 13:49:22 STEVEN
+more long path support
+
+ Rev 1.0 12 Feb 1992 14:34:36 STEVEN
+Initial revision.
+
+**/
+#define FS_DEBUG 1
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdmath.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+#include "msassert.h"
+
+
+static INT16 NTFS_VerData( FILE_HAND hand,
+ BYTE *buf,
+ BYTE *data,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static INT16 SeekToStream( FILE_HAND hand,
+ NT_STREAM_HEADER *inputHeader,
+ NT_STREAM_HEADER *outputHeader );
+
+static INT16 SeekForward( FILE_HAND hand,
+ NT_STREAM_HEADER *inputHeader,
+ NT_STREAM_HEADER *outputHeader );
+
+static INT16 Rewind( FILE_HAND hand );
+
+static INT16 ReadStreamHeader( FILE_HAND hand, NT_STREAM_HEADER *sh );
+
+static INT16 GetStreamPos( FILE_HAND hand, NT_STREAM_HEADER *sh );
+
+static INT16 EnqueueStreamID( FILE_HAND hand, NT_STREAM_HEADER *sh );
+
+static INT16 ClassifyError( FILE_HAND hand, UINT32 streamID );
+
+static BOOLEAN ExtractNameFromBuffer( NTFS_OBJ_HAND_PTR nt_hand,
+ NT_STREAM_HEADER_PTR streamHeader,
+ BYTE_PTR data,
+ UINT16 *size,
+ UINT16 *blk_size );
+/**/
+/**
+
+ Name: NTFS_VerObj()
+
+ Description: This function verifies the data in an object.
+
+ Modified: 2/12/1992 14:29:33
+
+ Returns: Error Codes:
+ FS_DEVICE_ERROR
+ FS_EOF_REACHED
+ FS_GDATA_DIFFERENT
+ FS_SECURITY_DATA_DIFFERENT
+ SUCCESS
+
+**/
+/* begin declaration */
+INT16 NTFS_VerObj(
+FILE_HAND hand, /* I - file handle to verify data with */
+BYTE_PTR buf, /* I - buffer needed to perform verify */
+BYTE_PTR data, /* I - data to verify against */
+UINT16 *size, /*I/O- size of buffers / amount verified */
+UINT16 *blk_size, /* O - minum size of block for next call */
+STREAM_INFO_PTR s_info ) /* I - Stream information for the data to be written */
+{
+ INT16 ret_val ;
+
+ msassert( hand != NULL );
+ msassert( hand->mode == FS_VERIFY ) ;
+
+ switch (hand->dblk->blk_type) {
+
+ case FDB_ID:
+ case DDB_ID:
+ ret_val = NTFS_VerData( hand, (BYTE_PTR)buf, (BYTE_PTR)data, size, blk_size, s_info ) ;
+ break ;
+
+ case VCB_ID:
+ ret_val = FS_EOF_REACHED ;
+ break ;
+
+ default:
+ ret_val = FS_OBJECT_NOT_OPENED;
+ }
+
+ return( ret_val ) ;
+}
+
+/**/
+/**
+
+ Name: NTFS_VerData()
+
+ Description: This function verifies the data in an open file with
+ the specified data. If a difference is found then the
+ size parameter passed in specifies the location of the
+ first difference.
+
+ Modified: 09-Mar-93
+
+ Returns:
+ FS_DEVICE_ERROR
+ FS_EOF_REACHED
+ FS_GDATA_DIFFERENT
+ FS_EADATA_DIFFERENT
+ FS_SECURITY_DIFFERENT
+ SUCCESS
+
+**/
+INT16 NTFS_VerData(
+ FILE_HAND hand, /* I - file handle to verify data with */
+ BYTE_PTR buf, /* I - buffer needed to perform verify */
+ BYTE_PTR data, /* I - data to verify against */
+ UINT16 *size, /*I/O- size of buffers / amount verified */
+ UINT16 *blk_size,/* O - minum size of block for next call */
+ STREAM_INFO_PTR s_info ) /* I - Stream information for the data */
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ INT16 ret_val = SUCCESS;
+ UINT16 bufferSize = *size;
+ INT status;
+ DWORD sizeout;
+ BOOLEAN dummy;
+
+ *blk_size = 1;
+ *size = 0;
+
+ if ( s_info->id != STRM_INVALID )
+ {
+ if ( nt_hand->registry_file )
+ {
+ return FS_DONT_WANT_STREAM;
+ }
+
+ switch ( s_info->id )
+ {
+ case STRM_PATH_NAME : /* Don't verify these streams */
+ case STRM_FILE_NAME :
+ case STRM_NTFS_LINK :
+ case STRM_OS2_ACL :
+ case STRM_OS2_EA :
+ case STRM_CHECKSUM_DATA:
+ ret_val = FS_DONT_WANT_STREAM;
+ break;
+
+ case STRM_NT_ACL :
+ /*
+ * If we don't want to process security, let's stop now.
+ * Otherwise, we'll fall through and process normally.
+ */
+ if ( BEC_GetRestoreSecurity( hand->fsh->cfg ) == FALSE )
+ {
+ ret_val = FS_DONT_WANT_STREAM;
+ break;
+ }
+
+ default:
+ { /* Let's move to the proper stream so we can verify. */
+ if ( U64_EQ( nt_hand->curPos, nt_hand->nextStreamHeaderPos ) )
+ {
+ nt_hand->streamHeader.id = NTFS_MaynToMSoft( s_info->id );
+ nt_hand->streamHeader.size_lo = U64_Lsw( s_info->size );
+ nt_hand->streamHeader.size_hi = U64_Msw( s_info->size );
+ nt_hand->streamHeader.name_leng = 0 ;
+ nt_hand->streamHeader.attrib = (UINT32)s_info->tf_attrib << 16 |
+ s_info->fs_attrib;
+
+ nt_hand->curPos = U64_Init( 0, 0 );
+ nt_hand->nextStreamHeaderPos = U64_Init( nt_hand->streamHeader.size_lo,
+ nt_hand->streamHeader.size_hi );
+ nt_hand->altNameComplete = FALSE;
+ }
+ else
+ {
+ ret_val = FAILURE;
+ }
+
+ if ( (ret_val != SUCCESS) && (ret_val != OUT_OF_MEMORY) )
+ {
+ ret_val = ClassifyError( hand,
+ nt_hand->streamHeader.id );
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ /* Check to see if we need to pull the alternate name from data */
+ if ( bufferSize > 0 )
+ {
+ BOOLEAN needAltName;
+
+ if ( (nt_hand->streamHeader.id == BACKUP_ALTERNATE_DATA) &&
+ (nt_hand->altNameComplete == FALSE) )
+ {
+ needAltName = TRUE;
+ }
+ else
+ {
+ needAltName = FALSE;
+ }
+
+
+ if ( needAltName || U64_EQ( nt_hand->curPos, U64_Init(0,0) ) )
+ {
+ NT_STREAM_HEADER diskHeader;
+
+ /*
+ * Check to see if we need to pull the alternate
+ * stream's name from data
+ */
+ if ( needAltName )
+ {
+ UINT16 bsize = bufferSize;
+
+ status = ExtractNameFromBuffer( nt_hand,
+ &nt_hand->streamHeader,
+ data,
+ &bsize,
+ blk_size );
+ if ( !status )
+ {
+ NTFS_DebugPrint( TEXT("Had to frag on %s"),
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+ return SUCCESS;
+ }
+ else
+ {
+ *size = bsize;
+ buf += *size;
+ data += *size;
+ bufferSize -= *size;
+ }
+
+ if ( nt_hand->altNameComplete == FALSE )
+ {
+ return SUCCESS;
+ }
+ }
+ ret_val = SeekToStream( hand,
+ &nt_hand->streamHeader,
+ &diskHeader );
+ }
+ }
+
+ if ( (ret_val == SUCCESS) && (bufferSize > 0) )
+ {
+ status = BackupRead( nt_hand->fhand,
+ buf,
+ bufferSize,
+ &sizeout,
+ FALSE,
+ TRUE,
+ &nt_hand->context );
+
+ *size += (UINT16)sizeout;
+
+ if ( status && *size > 0 )
+ {
+ UINT16 offset = (UINT16)sizeout;
+
+ ret_val = SUCCESS;
+ if ( memver( buf, data, &offset ) )
+ {
+ ret_val = ClassifyError( hand,
+ nt_hand->streamHeader.id );
+ if ( ret_val != SUCCESS )
+ {
+ /* compute proper offset for failure? */
+ }
+ }
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)sizeout ),
+ &dummy );
+
+ }
+ else if ( status )
+ {
+ ret_val = FS_EOF_REACHED;
+ }
+ else
+ {
+ NTFS_DebugPrint( TEXT("NTFS_VerData: BackupRead error (data) %d")
+ TEXT(" on \"%s\""),
+ (int)GetLastError(),
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+
+ ret_val = FS_DEVICE_ERROR;
+ }
+ }
+ }
+ return ret_val;
+}
+
+
+/**/
+/**
+
+ Name: SeekToStream()
+
+ Description: Given a stream ID, seeks the object described by "hand"
+ to the given stream.
+
+ Modified: 06-Nov-92
+
+ Returns: SUCCESS Found stream
+ FS_EOF_REACHED Didn't find stream.
+ OUT_OF_MEMORY Couldn't enqueue stream IDs.
+
+ Notes: Assumes that for a given object that there will be
+ only one occurrence of a given stream type.
+
+**/
+static INT16 SeekToStream( FILE_HAND hand,
+ NT_STREAM_HEADER *inputHeader,
+ NT_STREAM_HEADER *diskHeader )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ INT16 ret = SUCCESS;
+ INT16 desiredPos;
+
+ desiredPos = GetStreamPos( hand, inputHeader );
+
+ if ( nt_hand->streamsAllVisited && (desiredPos != -1) )
+ {
+ ret = FS_EOF_REACHED;
+ }
+ else
+ {
+ if ( (desiredPos != -1) && (desiredPos < nt_hand->verifyStreamPos) )
+ {
+ ret = Rewind( hand );
+ }
+
+ if ( ret == SUCCESS )
+ {
+ ret = SeekForward( hand, inputHeader, diskHeader );
+ }
+ }
+ return ret;
+}
+
+
+/**/
+/**
+
+ Name: SeekForward()
+
+ Description: Seeks forward in the object until it reaches
+ the stream specified by "streamID."
+
+ Modified: 06-Nov-92
+
+ Returns: FS_EOF_REACHED
+ OUT_OF_MEMORY
+ SUCCESS
+
+ Notes: Assumes that upon entry, if a read is performed, a
+ stream header will be returned.
+
+ Assumes that for a given object that there will be
+ only one occurrence of a given stream type.
+
+**/
+static INT16 SeekForward( FILE_HAND hand,
+ NT_STREAM_HEADER *inputHeader,
+ NT_STREAM_HEADER *diskHeader )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ INT16 ret = SUCCESS;
+
+ while ( ret == SUCCESS )
+ {
+ ret = ReadStreamHeader( hand, diskHeader );
+
+ if ( ret != SUCCESS )
+ {
+ nt_hand->streamsAllVisited = TRUE;
+ }
+ else
+ {
+ DWORD wentHi;
+ DWORD wentLo;
+
+ nt_hand->verifyStreamPos++;
+
+ ret = EnqueueStreamID( hand, diskHeader );
+
+ if ( inputHeader->id == diskHeader->id )
+ {
+ LARGE_INTEGER disk_size ;
+ LARGE_INTEGER tape_size ;
+
+ disk_size.LowPart = diskHeader->size_lo ;
+ disk_size.HighPart = diskHeader->size_hi ;
+
+ tape_size.LowPart = inputHeader->size_lo ;
+ tape_size.HighPart = inputHeader->size_hi ;
+
+ //only for streams with names.
+ if ( diskHeader->name_leng ) {
+ tape_size.QuadPart -= (inputHeader->name_leng + 4) ;
+ }
+
+ if ( tape_size.QuadPart == disk_size.QuadPart )
+ {
+
+ if ( inputHeader->name_leng == diskHeader->name_leng )
+ {
+ if ( (inputHeader->name_leng == 0) ||
+ (memcmp(inputHeader->name,
+ diskHeader->name,
+ inputHeader->name_leng) == 0) )
+ {
+ break;
+ }
+ }
+ }
+ }
+ BackupSeek( nt_hand->fhand,
+ 0xffffffff, /* Seek to next stream */
+ 0xffffffff,
+ &wentHi,
+ &wentLo,
+ &nt_hand->context );
+ }
+ }
+ return ret;
+}
+
+/**/
+/**
+
+ Name: ReadStreamHeader()
+
+ Description: Reads a complete stream header using BackupRead.
+
+ Modified: 09-Mar-93
+
+ Returns: SUCCESS
+ FS_EOF_REACHED
+
+ Notes: Assumes that if a backup read is performed, a stream
+ header will be returned from BackupRead.
+
+**/
+static INT16 ReadStreamHeader( FILE_HAND hand,
+ NT_STREAM_HEADER *streamHeader )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ BOOLEAN status;
+ INT16 ret = FS_EOF_REACHED;
+ DWORD sizeout;
+
+ status = BackupRead( nt_hand->fhand,
+ (BYTE_PTR)streamHeader,
+ NT_SIZEOF_NAMELESS_STREAM_HEAD,
+ (LPDWORD)&sizeout,
+ FALSE,
+ TRUE,
+ &nt_hand->context );
+
+ if ( status && (sizeout == NT_SIZEOF_NAMELESS_STREAM_HEAD) )
+ {
+ if ( streamHeader->id != BACKUP_ALTERNATE_DATA )
+ {
+ ret = SUCCESS;
+ }
+ else
+ {
+ /* Now read the stream name itself */
+ status = BackupRead( nt_hand->fhand,
+ (INT8_PTR)&streamHeader->name,
+ streamHeader->name_leng,
+ (LPDWORD)&sizeout,
+ FALSE,
+ TRUE,
+ &nt_hand->context );
+
+ if ( status && (sizeout == streamHeader->name_leng) )
+ {
+ /* Everything went OK */
+ ret = SUCCESS;
+ }
+ }
+ }
+
+ if ( !status )
+ {
+ DWORD error = GetLastError();
+
+ if ( (error != ERROR_HANDLE_EOF) &&
+ (error != ERROR_INVALID_PARAMETER) )
+ {
+ NTFS_DebugPrint( TEXT("NTFS_ReadStreamHeader: BackupRead error (stream header) %d")
+ TEXT(" on \"%s\""),
+ (int)error,
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+ }
+
+ }
+ return ret;
+}
+
+/**/
+/**
+
+ Name: Rewind()
+
+ Description: Seeks the object back to the beginning.
+
+ Modified: 06-Nov-92
+
+ Returns: SUCCESS
+ FS_EOF_REACHED (if object can't be rewound)
+
+ Notes:
+
+**/
+static INT16 Rewind( FILE_HAND hand )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ DWORD sizeout;
+ BOOLEAN status;
+
+ status = BackupRead( nt_hand->fhand,
+ NULL,
+ 0,
+ (LPDWORD)&sizeout,
+ TRUE,
+ FALSE,
+ &nt_hand->context );
+
+ nt_hand->context = NULL;
+
+ return status ? SUCCESS : FS_EOF_REACHED;
+}
+
+
+/**/
+/**
+
+ Name: EnqueueStreamID()
+
+ Description: Enqueues on the hand a stream ID. Later, verify can
+ search for a stream ID to determine if it has been
+ visited, and if so, what is its relative position.
+
+ Modified: 06-Nov-92
+
+ Returns: SUCCESS
+ OUT_OF_MEMORY
+
+ Notes: Assumes that for a given object that there will be
+ only one occurrence of a given stream type.
+
+**/
+static INT16 EnqueueStreamID( FILE_HAND hand,
+ NT_STREAM_HEADER *streamHeader )
+{
+ NTFS_FSYS_RESERVED_PTR resInfo = hand->fsh->reserved.ptr;
+ INT16 ret = SUCCESS;
+
+ if ( GetStreamPos( hand, streamHeader ) == -1 ) /* Is stream enqueued? */
+ {
+ if ( resInfo->streamIDCount >= resInfo->streamIDBufferSize )
+ {
+ resInfo->streamIDBufferSize += 8;
+ resInfo->streamIDs = realloc( resInfo->streamIDs,
+ resInfo->streamIDBufferSize *
+ sizeof( NTFS_STREAM_ID ) );
+
+ if ( resInfo->streamIDs == NULL )
+ {
+ resInfo->streamIDBufferSize = 0;
+ ret = OUT_OF_MEMORY;
+ }
+ }
+ if ( ret == SUCCESS )
+ {
+ NTFS_STREAM_ID *streamIdentifier;
+
+ streamIdentifier = resInfo->streamIDs + resInfo->streamIDCount;
+
+ streamIdentifier->streamID = streamHeader->id;
+ streamIdentifier->nameLength = streamHeader->name_leng;
+ memcpy( streamIdentifier->name,
+ streamHeader->name,
+ streamHeader->name_leng );
+
+ resInfo->streamIDCount++;
+ }
+ }
+ return ret;
+}
+
+/**/
+/**
+
+ Name: GetStreamPos()
+
+ Description: Determines relative position in the object of a
+ given stream.
+
+ Modified: 09-Nov-92
+
+ Returns: Position within the object, or -1 if not found.
+
+**/
+static INT16 GetStreamPos( FILE_HAND hand,
+ NT_STREAM_HEADER *streamHeader )
+{
+ NTFS_FSYS_RESERVED_PTR resInfo = hand->fsh->reserved.ptr;
+ NTFS_STREAM_ID *streams;
+ INT16 ret = -1;
+ INT16 i;
+
+ /* Return relative position [0 - (n-1)] of stream */
+
+ for ( streams = resInfo->streamIDs, i = 0;
+ (i < resInfo->streamIDCount);
+ i++, streams++ )
+ {
+ if ( streams->streamID == streamHeader->id )
+ {
+ if ( streams->nameLength == streamHeader->name_leng )
+ {
+ if ( (streams->nameLength == 0) ||
+ (memcmp(streams->name,
+ streamHeader->name,
+ streams->nameLength) == 0) )
+ {
+ ret = i;
+ break;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+/**/
+/**
+
+ Name: ExtractNameFromBuffer()
+
+ Description: Extracts a stream size & name from buffer.
+
+ Modified: 09-Mar-93
+
+ Returns: TRUE if success,
+ FALSE if failure
+
+ Notes: Upon failure, *blk_size will contain the size needed
+ to successfully extract the name.
+
+ Upon success, *size will contain the number of bytes
+ extracted from the stream.
+
+**/
+static BOOLEAN ExtractNameFromBuffer( NTFS_OBJ_HAND_PTR nt_hand,
+ NT_STREAM_HEADER_PTR streamHeader,
+ BYTE_PTR data,
+ UINT16 *size,
+ UINT16 *blk_size )
+{
+ BOOLEAN status = TRUE;
+ BOOLEAN gotDataThisPass = FALSE;
+ UINT16 bufferSize = *size;
+ BOOLEAN dummy;
+
+ *size = 0;
+ *blk_size = 1;
+
+ /*
+ * Determine what we are supposed to read. This is either
+ * 1) the size of the name of alternate data stream
+ * 2) the name stream itself
+ *
+ * We can determine which we are supposed to read based on
+ * our current position.
+ * If it is zero, we have to get the size name.
+ * If it is non-zero, we can assume we got the name earlier.
+ *
+ * If we could read either one, we return success.
+ * If we lacked room for one, we return false and set blk_size.
+ *
+ * Once we have the name filled out in the stream header in its
+ * entirety, we set nt_hand->altNameComplete to TRUE;
+ */
+
+ if ( U64_EQ( nt_hand->curPos, U64_Init(0,0) ) )
+ {
+ UINT16 nameLenSize; /* Size of stream header name length field */
+
+ nameLenSize = sizeof( streamHeader->name_leng );
+
+ if ( bufferSize >= nameLenSize )
+ {
+ memcpy( &streamHeader->name_leng, data, nameLenSize );
+
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)nameLenSize ),
+ &dummy );
+ data += nameLenSize;
+ bufferSize -= nameLenSize;
+ *size += nameLenSize;
+ gotDataThisPass = TRUE;
+ }
+ else
+ {
+ *blk_size = nameLenSize;
+ status = FALSE;
+ }
+ }
+
+ if ( (status == TRUE) && !U64_EQ( nt_hand->curPos, U64_Init(0,0) ) )
+ {
+ if ( bufferSize >= streamHeader->name_leng )
+ {
+ memcpy( &streamHeader->name,
+ data,
+ streamHeader->name_leng );
+
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64(streamHeader->name_leng),
+ &dummy );
+
+ data += streamHeader->name_leng;
+ bufferSize -= (UINT16)streamHeader->name_leng;
+ *size += (UINT16)streamHeader->name_leng;
+
+ gotDataThisPass = TRUE;
+ nt_hand->altNameComplete = TRUE;
+ }
+ else
+ {
+ if ( gotDataThisPass == FALSE )
+ {
+ *blk_size = (UINT16)streamHeader->name_leng;
+ status = FALSE;
+ }
+ }
+ }
+ return status;
+}
+
+
+/**/
+/**
+
+ Name: ClassifyError()
+
+ Description: Returns the proper file system error code upon
+ a verify error (based on stream type).
+
+ Modified: 09-Nov-92
+
+ Returns: FS error code
+
+**/
+static INT16 ClassifyError( FILE_HAND hand, UINT32 streamID )
+{
+ INT16 ret;
+
+ switch ( streamID )
+ {
+ case BACKUP_DATA :
+ ret = FS_GDATA_DIFFERENT;
+ break;
+
+ case BACKUP_EA_DATA :
+ ret = FS_EADATA_DIFFERENT;
+ break;
+
+ case BACKUP_SECURITY_DATA :
+ ret = FS_SECURITY_DIFFERENT;
+ break;
+
+ case BACKUP_ALTERNATE_DATA :
+ if ( strcmp( TEXT("NTFS"), hand->fsh->attached_dle->info.ntfs->fs_name ) == 0 )
+ {
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+
+ if ( (nt_hand->streamHeader.name_leng != 0) &&
+ (wcscmp( L":AFP_AfpInfo:$DATA",
+ (WCHAR *)nt_hand->streamHeader.name ) == 0) )
+ {
+ /*
+ * It's just Finder info -- ignore the error
+ */
+ ret = SUCCESS;
+ }
+ else
+ {
+ ret = FS_GDATA_DIFFERENT;
+ }
+ }
+ else
+ {
+ ret = SUCCESS;
+ }
+ break;
+
+ default:
+ ret = FAILURE; /* CBN -- ??? */
+ break;
+ }
+ return ret;
+}
+
+
diff --git a/private/utils/ntbackup/src/twritobj.c b/private/utils/ntbackup/src/twritobj.c
new file mode 100644
index 000000000..be28f0da8
--- /dev/null
+++ b/private/utils/ntbackup/src/twritobj.c
@@ -0,0 +1,676 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: twritobj.c
+
+ Description: This function writes data to an open object.
+
+
+ $Log: M:/LOGFILES/TWRITOBJ.C_V $
+
+ Rev 1.30.1.0 03 Mar 1994 10:39:36 BARRY
+Defend against buffers zero bytes in length
+
+ Rev 1.30 28 Jan 1994 10:34:24 GREGG
+More Warning Fixes
+
+ Rev 1.29 23 Jan 1994 14:01:22 BARRY
+Added debug code
+
+ Rev 1.28 24 Nov 1993 14:59:02 BARRY
+Changed CHAR_PTRs in I/O functions to BYTE_PTRs
+
+ Rev 1.27 14 Oct 1993 17:49:58 STEVEN
+fix unicode bugs
+
+ Rev 1.26 08 Jul 1993 12:18:38 BARRY
+Don't send CRC streams to the BackupWrite
+
+ Rev 1.25 02 Jun 1993 14:17:28 STEVEN
+fix alignment fault
+
+ Rev 1.24 13 May 1993 20:32:34 BARRY
+Checked in Steve's changes for restoration of OS/2 EAs.
+
+ Rev 1.23 24 Feb 1993 15:37:22 BARRY
+Fixed restore of active files when write errors occur.
+
+ Rev 1.22 17 Feb 1993 14:59:16 STEVEN
+fix bug with security after alt data
+
+ Rev 1.21 11 Feb 1993 14:47:04 STEVEN
+fix restore of mult alt data streams
+
+ Rev 1.20 08 Feb 1993 11:49:48 BARRY
+Discard NACL streams if restoreSecurity in config is FALSE.
+
+ Rev 1.19 27 Jan 1993 13:51:26 STEVEN
+updates from msoft
+
+ Rev 1.18 15 Jan 1993 13:19:00 BARRY
+added support for new error messages and backup priviladge
+
+ Rev 1.17 07 Dec 1992 14:16:40 STEVEN
+updates from msoft
+
+ Rev 1.16 24 Nov 1992 11:02:08 BARRY
+Changes to make LINK streams null-impregnated.
+
+ Rev 1.15 11 Nov 1992 10:54:22 GREGG
+Unicodeized literals.
+
+ Rev 1.14 29 Oct 1992 16:46:44 BARRY
+Restore links.
+
+ Rev 1.13 21 Oct 1992 19:44:30 BARRY
+Got rid of warnings.
+
+ Rev 1.12 16 Oct 1992 16:48:16 STEVEN
+fix streams to UINT64
+
+ Rev 1.11 14 Oct 1992 14:37:46 BARRY
+Fixes for alternate data streams.
+
+ Rev 1.10 09 Oct 1992 14:31:28 BARRY
+Path-in-stream changes.
+
+ Rev 1.8 06 Oct 1992 11:12:34 BARRY
+BackupRead stream size corrections; bug fixes in stream header redesign.
+
+ Rev 1.7 18 Sep 1992 15:37:50 BARRY
+Changes for Stream Header redesign.
+
+ Rev 1.6 02 Sep 1992 07:48:36 STEVEN
+fix typo
+
+ Rev 1.5 01 Sep 1992 16:11:02 STEVEN
+added stream headers to fsys API
+
+ Rev 1.4 17 Aug 1992 15:36:54 STEVEN
+fix warnings
+
+ Rev 1.3 12 Aug 1992 17:47:30 STEVEN
+fixed bugs at microsoft
+
+ Rev 1.2 22 May 1992 16:05:12 STEVEN
+
+
+ Rev 1.1 21 May 1992 13:50:50 STEVEN
+more long path stuff
+
+ Rev 1.0 12 Feb 1992 13:04:50 STEVEN
+Initial revision.
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "ntfsdblk.h"
+#include "ntfs_fs.h"
+
+static INT16 NTFS_WriteData(
+ FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static INT16 CollectLinkName( FILE_HAND hand,
+ BYTE_PTR buff,
+ UINT16 *size,
+ STREAM_INFO *s_info );
+
+static UINT16 CalcWriteSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize );
+
+/**/
+/**
+
+ Name: NTFS_WriteObj()
+
+ Description: This function writes data to an opened object on
+ disk.
+
+ Modified: 2/12/1992 12:57:2
+
+ Returns: Error Codes:
+ FS_DEVICE_ERROR
+ FS_OBJECT_NOT_OPENED
+ FS_OUT_OF_SPACE
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 NTFS_WriteObj(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size need for next read */
+ STREAM_INFO_PTR s_info ) /* I - Stream information for the data to be written */
+{
+ INT16 ret_val;
+
+ msassert( hand->mode == FS_WRITE );
+
+ if ( (s_info->id == STRM_INVALID) && (*size == 0) )
+ {
+ /*
+ * Someone asked us to write zero bytes. According to
+ * our rules this is not allowed, but we'll be defensive
+ * anyway.
+ */
+ msassert( FALSE );
+ *blk_size = 1;
+ ret_val = SUCCESS;
+ }
+ else
+ {
+ switch (hand->dblk->blk_type)
+ {
+ case FDB_ID:
+ {
+ NTFS_DBLK_PTR fdb = (NTFS_DBLK_PTR)hand->dblk;
+
+ if ( fdb->b.f.linkOnly ) {
+ *blk_size = 1;
+ ret_val = CollectLinkName( hand, buf, size, s_info );
+ } else {
+ ret_val = NTFS_WriteData( hand, buf, size, blk_size, s_info ) ;
+ }
+ break;
+ }
+
+ case DDB_ID:
+ ret_val = NTFS_WriteData( hand, buf, size, blk_size, s_info ) ;
+ break ;
+
+ case VCB_ID:
+ ret_val = FS_EOF_REACHED ;
+ break ;
+
+ default:
+ ret_val = FS_OBJECT_NOT_OPENED;
+ }
+ }
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: NTFS_WriteData()
+
+ Description: This function writes data to an open NTFS object.
+
+ Modified: 10-Sep-92
+
+ Returns: FS_OUT_OF_SPACE
+ SUCCESS
+
+ Notes:
+
+**/
+static INT16 NTFS_WriteData(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* I - buffer to write */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: bytes written */
+ UINT16 *blk_size, /* O - Block size need for next write */
+ STREAM_INFO_PTR s_info ) /* I - Stream information for the data */
+{
+ NT_STREAM_NAME UNALIGNED *namePtr = (NT_STREAM_NAME UNALIGNED *)buf;
+ NTFS_OBJ_HAND_PTR nt_hand ;
+ INT16 ret_val = SUCCESS ;
+ UINT16 bufferSize;
+ DWORD sizeout;
+ INT status;
+ UINT16 writeSize; /* Size sent to BackupWrite */
+ NT_STREAM_HEADER streamHeader; /* Composed from s_info */
+ BOOLEAN dummy;
+
+ nt_hand = (NTFS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ bufferSize = *size;
+ *size = 0;
+ *blk_size = 1;
+
+ if ( s_info->id != STRM_INVALID )
+ {
+ UINT16 buffUsed = 0; /* Amount of buf we wrote (name) */
+
+ writeSize = NT_SIZEOF_NAMELESS_STREAM_HEAD;
+
+ streamHeader.id = NTFS_MaynToMSoft( s_info->id );
+
+ streamHeader.attrib = (s_info->tf_attrib << 16) |
+ s_info->fs_attrib;
+
+ streamHeader.size_lo = FS_GetStrmSizeLo( s_info ) ;
+ streamHeader.size_hi = FS_GetStrmSizeHi( s_info ) ;
+ streamHeader.name_leng = 0;
+
+ if ( s_info->id == STRM_NT_ACL )
+ {
+ if ( BEC_GetRestoreSecurity( hand->fsh->cfg ) == FALSE )
+ {
+ return FS_DONT_WANT_STREAM;
+ }
+ }
+ else if ( s_info->id == STRM_OS2_ACL )
+ {
+ return FS_DONT_WANT_STREAM;
+ }
+ else if ( s_info->id == STRM_CHECKSUM_DATA )
+ {
+ return FS_DONT_WANT_STREAM;
+ }
+ else if ( s_info->id == STRM_OS2_EA )
+ {
+ if ( nt_hand->os2_ea_buffer == NULL ) {
+ nt_hand->os2_ea_buffer = malloc( 0xfff0 ) ;
+ }
+ if ( nt_hand->os2_ea_buffer == NULL ) {
+ return FS_DONT_WANT_STREAM;
+ }
+ streamHeader.id = BACKUP_EA_DATA ;
+ nt_hand->processing_os2_ea = TRUE ;
+ nt_hand->curPos = U64_Init( 0, 0 );
+ nt_hand->streamHeader = streamHeader ;
+
+ return SUCCESS ;
+ }
+ else if ( s_info->id == STRM_NTFS_ALT_DATA )
+ {
+
+ if ( strcmp( hand->fsh->attached_dle->info.ntfs->fs_name, TEXT("NTFS") ) ) {
+ UINT32 seeked_low ;
+ UINT32 seeked_hi ;
+
+ BackupSeek( nt_hand->fhand,
+ 0xFFFFFFFF, 0xFFFFFFFF,
+ &seeked_low, &seeked_hi,
+ &nt_hand->context ) ;
+
+
+ return FS_DONT_WANT_STREAM ;
+ }
+
+
+ nt_hand->curPos = U64_Init( 0, 0 );
+ nt_hand->streamHeader = streamHeader ;
+ nt_hand->nextStreamHeaderPos = U64_Init( streamHeader.size_lo,
+ streamHeader.size_hi );
+ return SUCCESS ;
+ }
+
+ status = BackupWrite( nt_hand->fhand,
+ (LPBYTE)&streamHeader,
+ writeSize,
+ (LPDWORD)&sizeout,
+ FALSE,
+ BEC_GetRestoreSecurity( hand->fsh->cfg ),
+ &nt_hand->context );
+
+ nt_hand->streamHeader = streamHeader ;
+
+ if ( status && (sizeout == writeSize) )
+ {
+ nt_hand->curPos = U64_Init( 0, 0 );
+ nt_hand->nextStreamHeaderPos = U64_Init( streamHeader.size_lo,
+ streamHeader.size_hi );
+ }
+ else
+ {
+ if ( !status )
+ {
+ NTFS_DebugPrint( TEXT("NTFS_WriteData: BackupWrite error (stream header) %d")
+ TEXT(" on \"%s\""),
+ (int)GetLastError(),
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+
+ ret_val = NTFS_TranslateBackupError( GetLastError( ) );
+ }
+ else
+ {
+ /* CBN -- is this right */
+ if ( sizeout != writeSize )
+ {
+ ret_val = FS_DONT_WANT_STREAM;
+ }
+ else
+ {
+ ret_val = SUCCESS;
+ }
+ }
+ }
+
+ }
+ else
+ {
+ if ( nt_hand->processing_os2_ea ) {
+
+ *size = bufferSize ;
+
+ ret_val = SUCCESS ;
+
+ streamHeader = nt_hand->streamHeader ;
+
+ memcpy( nt_hand->os2_ea_buffer + U64_Lsw( nt_hand->curPos ),
+ buf, *size ) ;
+
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)*size ),
+ &dummy );
+
+ if ( U64_Lsw(nt_hand->curPos) == streamHeader.size_lo ) {
+ int index ;
+ int delta ;
+ int stream_size ;
+ struct FEA_STR {
+ UINT32 next_ea ;
+ BYTE fea ;
+ BYTE name_size ;
+ UINT16 value_size ;
+ } *fea_data ;
+
+
+ stream_size = nt_hand->streamHeader.size_lo ;
+ fea_data = NULL ;
+
+ for ( index = 0 ; index < stream_size ; ) {
+
+ delta = 0 ;
+
+ if ( index % sizeof( UINT32 ) ) {
+ delta = sizeof(UINT32 ) - (index % sizeof(UINT32) ) ;
+ fea_data->next_ea += delta ;
+ }
+ if ( index != 0 ) {
+ delta += sizeof(UINT32) ;
+ }
+
+ if ( delta ) {
+ stream_size += delta ;
+ memmove( nt_hand->os2_ea_buffer+index+delta,
+ nt_hand->os2_ea_buffer+index,
+ stream_size - index ) ;
+
+ if ( index != 0 ) {
+ index += delta - sizeof(UINT32) ;
+ } else {
+ index += delta ;
+ }
+
+ }
+
+ fea_data = (struct FEA_STR *)(&nt_hand->os2_ea_buffer[index]) ;
+
+ index += fea_data->value_size + (fea_data->name_size+1) + sizeof(struct FEA_STR ) ;
+
+ fea_data->next_ea = fea_data->value_size + (fea_data->name_size+1) + sizeof(struct FEA_STR ) ;
+
+ }
+
+ fea_data->next_ea = 0 ;
+
+ streamHeader.size_lo = stream_size ;
+ streamHeader.size_hi = 0 ;
+ writeSize = NT_SIZEOF_NAMELESS_STREAM_HEAD;
+
+ status = BackupWrite( nt_hand->fhand,
+ (LPBYTE)&streamHeader,
+ writeSize,
+ (LPDWORD)&sizeout,
+ FALSE,
+ BEC_GetRestoreSecurity( hand->fsh->cfg ),
+ &nt_hand->context );
+
+ if ( status ) {
+ status = BackupWrite( nt_hand->fhand,
+ (LPBYTE)nt_hand->os2_ea_buffer,
+ stream_size,
+ (LPDWORD)&sizeout,
+ FALSE,
+ BEC_GetRestoreSecurity( hand->fsh->cfg ),
+ &nt_hand->context );
+ }
+
+ free( nt_hand->os2_ea_buffer ) ;
+ nt_hand->os2_ea_buffer = NULL ;
+ nt_hand->processing_os2_ea = FALSE ;
+
+ if ( !status ) {
+ ret_val = FS_DEVICE_ERROR ;
+ }
+
+ }
+
+ return ret_val ;
+ }
+
+ if ( ( nt_hand->streamHeader.id == BACKUP_ALTERNATE_DATA ) &&
+ U64_EQ( nt_hand->curPos, U64_Init( 0, 0 ) ) )
+ {
+ UINT16 nameSize;
+
+ writeSize = NT_SIZEOF_NAMELESS_STREAM_HEAD;
+ nameSize = sizeof( namePtr->name_leng );
+
+ if ( bufferSize < nameSize )
+ {
+ *blk_size = nameSize;
+ *size = 0 ;
+ return SUCCESS;
+ }
+ else
+ {
+ UINT64 u64StreamSize ;
+ UINT64 u64_namesize ;
+
+ streamHeader = nt_hand->streamHeader ;
+
+ u64StreamSize = U64_Init( streamHeader.size_lo,
+ streamHeader.size_hi ) ;
+
+ u64_namesize = U64_Init( namePtr->name_leng + nameSize, 0 ) ;
+
+ u64StreamSize = U64_Sub( u64StreamSize, u64_namesize, &dummy ) ;
+
+ streamHeader.size_lo = U64_Lsw( u64StreamSize ) ;
+ streamHeader.size_hi = U64_Msw( u64StreamSize ) ;
+
+ streamHeader.name_leng = namePtr->name_leng ;
+
+ status = BackupWrite( nt_hand->fhand,
+ (LPBYTE)&streamHeader,
+ writeSize,
+ (LPDWORD)&sizeout,
+ FALSE,
+ BEC_GetRestoreSecurity( hand->fsh->cfg ),
+ &nt_hand->context );
+
+ if ( status )
+ {
+ *size += nameSize ;
+ buf += nameSize ;
+ bufferSize -= nameSize ;
+ }
+ else
+ {
+ ret_val = FS_DONT_WANT_STREAM;
+ }
+ }
+ }
+ }
+
+ if ( (ret_val == SUCCESS) && (s_info->id == STRM_INVALID) )
+ {
+ BOOLEAN dummy;
+
+ bufferSize = CalcWriteSize( nt_hand->curPos,
+ nt_hand->nextStreamHeaderPos,
+ bufferSize );
+
+ status = BackupWrite( nt_hand->fhand,
+ buf,
+ bufferSize,
+ (LPDWORD)&sizeout,
+ FALSE,
+ BEC_GetRestoreSecurity( hand->fsh->cfg ),
+ &nt_hand->context ) ;
+
+ if ( !status )
+ {
+ DWORD error = GetLastError();
+
+ nt_hand-> writeError = TRUE;
+ ret_val = NTFS_TranslateBackupError( error );
+
+ NTFS_DebugPrint( TEXT("NTFS_WriteData: BackupWrite error (data) %d")
+ TEXT(" on \"%s\""),
+ (int)error,
+ ((NTFS_DBLK_PTR)hand->dblk)->full_name_ptr->name );
+ }
+ else
+ {
+ ret_val = SUCCESS;
+ }
+
+ *size += (UINT16)sizeout;
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)*size ),
+ &dummy );
+ }
+ return ret_val;
+}
+
+
+/**/
+/**
+
+ Name: CollectLinkName()
+
+ Description: Pulls a full path for a linked file from the stream
+ and saves it. All other streams are simply discarded.
+
+ Modified: 28-Oct-92
+
+ Returns: SUCCESS
+ FS_DONT_WANT_STREAM
+ OUT_OF_MEMORY
+
+ Notes:
+
+**/
+static INT16 CollectLinkName( FILE_HAND hand,
+ BYTE_PTR buff,
+ UINT16 *size,
+ STREAM_INFO *s_info )
+{
+ NTFS_OBJ_HAND_PTR nt_hand = hand->obj_hand.ptr;
+ INT16 ret = SUCCESS;
+
+ if ( s_info->id != STRM_INVALID )
+ {
+ if ( s_info->id == STRM_NTFS_LINK )
+ {
+ size_t buffSizeNeeded;
+
+ nt_hand->curPos = U64_Init( 0, 0 );
+ nt_hand->nextStreamHeaderPos = s_info->size;
+
+ /* Make sure everything's kosher with the sizes */
+ msassert( U64_Msw( s_info->size ) == 0 );
+ msassert( U64_Lsw( s_info->size ) < 65536 );
+
+ buffSizeNeeded = (size_t)U64_Lsw( s_info->size );
+ buffSizeNeeded += strsize( DLE_GetDeviceName( hand->fsh->attached_dle ) );
+ buffSizeNeeded += sizeof( CHAR ) * 10; /* path separator(s) */
+
+ if ( nt_hand->linkBufferSize < buffSizeNeeded )
+ {
+ nt_hand->linkBufferSize = buffSizeNeeded;
+ nt_hand->linkBuffer = realloc( nt_hand->linkBuffer,
+ buffSizeNeeded );
+
+ }
+
+ if ( nt_hand->linkBuffer != NULL )
+ {
+ strcpy( nt_hand->linkBuffer,
+ DLE_GetDeviceName( hand->fsh->attached_dle ) );
+ strcat( nt_hand->linkBuffer, TEXT("\\") );
+
+ nt_hand->linkNameLen = strlen( nt_hand->linkBuffer ) * sizeof( CHAR );
+ nt_hand->curPos = U64_Init( nt_hand->linkNameLen, 0 );
+ nt_hand->linkNameLen += (UINT16)U64_Lsw( s_info->size );
+ }
+ else
+ {
+ nt_hand->linkBufferSize = 0;
+ ret = OUT_OF_MEMORY;
+ }
+ }
+ else
+ {
+ ret = FS_DONT_WANT_STREAM;
+ }
+ *size = 0;
+ }
+ else
+ {
+ if ( *size > 0 )
+ {
+ BOOLEAN dummy;
+
+ memcpy( nt_hand->linkBuffer + U64_Lsw( nt_hand->curPos)/sizeof(CHAR),
+ buff,
+ (size_t)*size );
+
+ nt_hand->curPos = U64_Add( nt_hand->curPos,
+ U32_To_U64( (UINT32)*size ),
+ &dummy );
+ msassert( dummy == TRUE );
+ }
+ }
+ return ret;
+}
+
+
+static UINT16 CalcWriteSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize )
+{
+ UINT16 writeSize;
+ BOOLEAN mathStat;
+
+ if ( U64_GT( U64_Add( startPos,
+ U32_To_U64( (UINT32)buffSize ),
+ &mathStat ),
+ endPos ) )
+ {
+ UINT64 rs;
+
+ rs = U64_Sub( endPos,
+ startPos,
+ &mathStat );
+
+ msassert( mathStat && (U64_Msw( rs ) == 0) && (U64_Lsw(rs) < 65536) );
+
+ writeSize = (UINT16)U64_Lsw( rs );
+ } else {
+ writeSize = buffSize;
+ }
+
+ return writeSize;
+}
diff --git a/private/utils/ntbackup/src/uadd_dle.c b/private/utils/ntbackup/src/uadd_dle.c
new file mode 100644
index 000000000..0d6d270b2
--- /dev/null
+++ b/private/utils/ntbackup/src/uadd_dle.c
@@ -0,0 +1,119 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: uadd_dle.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This file contains code to add a HAND_MADE dle to the drive list.
+
+
+ $Log: O:/LOGFILES/UADD_DLE.C_V $
+
+ Rev 1.7 04 Feb 1993 14:56:36 TIMN
+Added Unicode header to resolve link errors
+
+ Rev 1.6 11 Nov 1992 22:26:58 GREGG
+Unicodeized literals.
+
+ Rev 1.5 06 Oct 1992 13:24:28 DAVEV
+Unicode strlen verification
+
+ Rev 1.4 18 Aug 1992 10:24:14 STEVEN
+fix warnings
+
+ Rev 1.3 13 Jan 1992 18:46:24 STEVEN
+changes for WIN32 compile
+
+ Rev 1.2 01 Oct 1991 11:17:54 BARRY
+Include standard headers.
+
+ Rev 1.1 25 Jun 1991 09:35:02 BARRY
+Changes for new config.
+
+ Rev 1.0 09 May 1991 13:38:52 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdwcs.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name FS_AddTempDLE()
+
+ Description: This function creates a DLE with the data specified
+ and adds this DLE to the DLE list.
+
+ Modified: 7/12/1989
+
+ Returns: Error codes
+ SUCCESS
+ FAILURE
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 FS_AddTempDLE(
+DLE_HAND hand, /* I - Handle to DLE list */
+CHAR_PTR name, /* I - device name */
+CHAR_PTR vol_name, /* I - volume name */
+INT16 type ) /* I - type of DLE */
+{
+ INT16 cb_dle_size ; //size of dle buffer in bytes
+ GENERIC_DLE_PTR dle ;
+
+ type |= HAND_MADE_MASK ;
+
+ /* Allocate space for DLE and device_name string */
+
+ cb_dle_size = sizeof( GENERIC_DLE ) ;
+ cb_dle_size += strsize( name ) ;
+ cb_dle_size += strsize( vol_name ) ;
+
+ dle = calloc ( 1, cb_dle_size ) ;
+
+ if ( dle != NULL ) {
+
+ /* Since memory was allocated with calloc, it is already */
+ /* initialized to zero. Therefore initializations to zero */
+ /* are not necessary. */
+
+ InitQElem( &((dle)->q) ) ;
+ (dle)->handle = hand ;
+ /* (dle)->parent = NULL ; */
+ (dle)->type = (INT8)type ;
+ (dle)->path_delim = TEXT('\\') ;
+ /* (dle)->pswd_required = FALSE */
+ /* (dle)->pswd_saved = FALSE ; */
+ /* (dle)->dle_writeable = FALSE ; */
+ /* (dle)->attach_count = 0 ; */
+ /* (dle)->bsd_use_count = 0 ; */
+ /* (dle)->dynamic_info = FALSE ; */
+ (dle)->device_name = (CHAR *) (dle) + sizeof ( GENERIC_DLE );
+ strcpy( (dle)->device_name, name ) ;
+
+ (dle)->info.user = (HAND_MADE_DLE_INFO_PTR)((dle)->device_name + strlen(name) + 1 ) ;
+ strcpy( (dle)->info.user->vol_name, vol_name ) ;
+
+ EnQueueElem( &(hand->q_hdr), &((dle)->q), FALSE ) ;
+
+ return( SUCCESS ) ;
+ } else {
+ return( FAILURE ) ;
+ }
+}
diff --git a/private/utils/ntbackup/src/unicode.c b/private/utils/ntbackup/src/unicode.c
new file mode 100644
index 000000000..12a5b7e95
--- /dev/null
+++ b/private/utils/ntbackup/src/unicode.c
@@ -0,0 +1,892 @@
+/**
+
+ Name: unicode.c
+
+ Description: Wide character versions of standard C library functions.
+
+
+ $Log: M:/LOGFILES/UNICODE.C_V $
+
+ Rev 1.3 16 Dec 1993 10:20:20 BARRY
+Replaced asserts with msasserts -- return errors on same conditions
+
+ Rev 1.2 24 Nov 1993 13:03:58 BARRY
+Undefine OpenFile in OpenFileW to prevent infinite recursion
+
+ Rev 1.1 22 Nov 1993 11:22:04 BARRY
+Free path buffer allocated in OpenFile
+
+ Rev 1.0 08 Nov 1993 18:50:52 GREGG
+Initial revision.
+
+**/
+
+#ifdef UNICODE
+
+#include <wchar.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <malloc.h>
+#include <io.h>
+#include <direct.h>
+#include <share.h>
+#include <ctype.h>
+#include <windows.h>
+#include <sys\types.h>
+#include <sys\stat.h>
+#include <stdarg.h>
+
+
+#define INCL_MS_INTERNALS //include defines from MS internal headers...
+
+#include <unic_io.h> //fcn prototypes for unicode-supporting io functions.
+
+#include "msassert.h"
+
+
+long _CRTAPI1 atolW(
+ const wchar_t *nptr
+ )
+{
+ wchar_t c; /* current char */
+ long total; /* current total */
+ wchar_t sign; /* if '-', then negative, otherwise positive */
+
+ /* skip whitespace */
+ while (iswspace(*nptr))
+ ++nptr;
+
+ c = *nptr++;
+ sign = c; /* save sign indication */
+ if (c == L'-' || c == L'+')
+ c = *nptr++; /* skip sign */
+
+ total = 0;
+
+ while (iswdigit(c)) {
+ total = 10 * total + (c - '0'); /* accumulate digit */
+ c = *nptr++; /* get next char */
+ }
+
+ if (sign == L'-')
+ return -total;
+ else
+ return total; /* return result, negated if necessary */
+}
+
+
+int _CRTAPI1 atoiW(
+ const wchar_t *nptr
+ )
+{
+ return (int)atolW(nptr);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+////////////////////////////////////////////////////////////////
+
+
+static wchar_t _inc ( FILE *fileptr );
+
+wchar_t * _CRTAPI1 fgetsW (
+ wchar_t *string,
+ int count,
+ FILE *str
+ )
+{
+ FILE *stream;
+ wchar_t *pointer = string;
+ wchar_t *retval = string;
+ wchar_t ch;
+
+ msassert(string != NULL);
+ msassert(str != NULL);
+
+ if ( string == NULL || str == NULL )
+ {
+ return NULL;
+ }
+
+ if (count <= 0)
+ return(NULL);
+
+ /* Init stream pointer */
+ stream = str;
+
+ _lock_str(index);
+
+ while (--count)
+ {
+ if ((ch = _inc(stream)) == WEOF)
+ {
+ if (pointer == string) {
+ retval=NULL;
+ goto done;
+ }
+
+ break;
+ }
+
+ if ((*pointer++ = (char)ch) == L'\n')
+ break;
+ }
+
+ *pointer = L'\0';
+
+/* Common return */
+done:
+ _unlock_str(index);
+ return(retval);
+}
+
+/*
+ * Manipulate wide-chars in a file.
+ * A wide-char is hard-coded to be two chars for efficiency.
+ */
+
+static wchar_t _inc ( FILE *fileptr )
+{
+ wchar_t c1, c2;
+
+ c1 = (wchar_t)_getc_lk(fileptr);
+ c2 = (wchar_t)_getc_lk(fileptr);
+ return (wchar_t)((feof(fileptr) || ferror(fileptr)) ? WEOF : c2<<8 | c1);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+
+
+#define CMASK 0644 /* rw-r--r-- */
+
+//////////////////////////////////////////////////////////////////////////
+
+
+int _CRTAPI1 _chdirW(
+ const wchar_t *path
+ )
+{
+ char *envcurdir;
+ char dirtmp[4];
+ unsigned dirlen;
+
+ _mlock(_ENV_LOCK);
+
+ if ( SetCurrentDirectoryW( (LPWSTR) path ) ) {
+
+ /*
+ * Try to update the environment variable that specifies the
+ * current directory for the drive which is the current drive.
+ * To do this, get the full current directory, build the
+ * environment variable string and call _putenv(). If an error
+ * occurs, just return to the caller.
+ *
+ * The current directory should have the form of the example
+ * below:
+ *
+ * D:\nt\private\mytests
+ *
+ * so that the environment variable should be of the form:
+ *
+ * =D:=D:\nt\private\mytests
+ *
+ */
+
+ // NTKLUG: note that the environment does not support Unicode strings!
+ // NTKLUG: so we put in a MBCS string into the local environment.
+
+ if ( (dirlen = GetCurrentDirectoryA(0L, dirtmp)) &&
+ ((envcurdir = malloc(dirlen + 5)) != NULL) ) {
+
+ if ( GetCurrentDirectoryA(dirlen, &envcurdir[4])&&
+ (envcurdir[5] == ':') ) {
+ /*
+ * The current directory string has been
+ * copied into &envcurdir[3]. Prepend the
+ * special environment variable name and the
+ * '='.
+ */
+ envcurdir[0] = envcurdir[3] = '=';
+ envcurdir[1] = envcurdir[4];
+ envcurdir[2] = ':';
+ if ( _putenv_lk(envcurdir) )
+ free(envcurdir);
+ }
+ else
+ free(envcurdir);
+
+ }
+ _munlock(_ENV_LOCK);
+ return 0;
+ }
+ else {
+// _dosmaperr(GetLastError());
+ _munlock(_ENV_LOCK);
+ return -1;
+ }
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+//
+//int _CRTAPI1 _mkdirW (
+// const wchar_t *path
+// )
+//{
+// unsigned long dosretval;
+//
+// /* ask OS to create directory */
+// if (!CreateDirectoryW((LPWSTR)path, (LPSECURITY_ATTRIBUTES)NULL))
+// {
+// dosretval = GetLastError();
+// }
+// else
+// {
+// dosretval = 0;
+// }
+// if (dosretval)
+// {
+// /* error occured -- map error code and return */
+// _dosmaperr(dosretval);
+// return -1;
+// }
+// return 0;
+//}
+
+
+///////////////////////////////////////////////////////////////////////
+
+
+int _CRTAPI1 removeW (
+ const wchar_t *path
+ )
+{
+ unsigned long dosretval;
+
+
+ /* ask OS/2 to remove the file */
+
+ if (!DeleteFileW((LPWSTR)path))
+ dosretval = GetLastError();
+ else
+ dosretval = 0;
+
+
+ if (dosretval) {
+ /* error occured -- map error code and return */
+// _dosmaperr(dosretval);
+ return -1;
+ }
+
+ return 0;
+}
+
+int _CRTAPI1 _unlinkW (
+ const wchar_t *path
+ )
+{
+ /* remove is synonym for unlink */
+ return removeW(path);
+}
+
+
+/////////////////////////////////////////////////////////////////////
+
+
+
+wchar_t * _CRTAPI1 _getcwdW (
+ wchar_t *pnbuf,
+ int maxlen
+ )
+{
+ wchar_t *retval;
+
+ _mlock(_ENV_LOCK);
+
+ retval = _getdcwdW_lk(0, pnbuf, maxlen);
+
+ _munlock(_ENV_LOCK);
+
+ return retval;
+}
+
+
+wchar_t * _CRTAPI1 _getdcwdW (
+ int drive,
+ wchar_t *pnbuf,
+ int maxlen // number of characters
+ )
+
+{
+ wchar_t *p;
+ wchar_t dirbuf[1];
+ int len; // number of characters
+ char DirOnDriveVar[8];
+ char *envval;
+
+ /*
+ * Only works for default drive in Win32 environment.
+ */
+ if ( drive != 0 )
+ {
+ DWORD sys_flags ;
+ DWORD fname_leng ;
+ DWORD serial_num ;
+ wchar_t vol_name[256];
+ wchar_t fsys_name[256] ;
+ wchar_t root_path[256] ;
+
+ /*
+ * Not the default drive - make sure it's valid.
+ */
+
+ root_path[0] = (wchar_t)('A' + (wchar_t)drive - (wchar_t)1);
+ root_path[1] = ':' ;
+ root_path[2] = '\\' ;
+ root_path[3] = 0;
+
+ if ( !GetVolumeInformation( root_path, vol_name, 255, &serial_num, &fname_leng, &sys_flags,
+ fsys_name, 255) )
+ {
+ errno = EACCES;
+ return NULL;
+ }
+
+ /*
+ * Get special environment variable that specifies the current
+ * directory on drive.
+ */
+ DirOnDriveVar[0] = '=';
+ DirOnDriveVar[1] = (char)('A' + (char)drive - (char)1);
+ DirOnDriveVar[2] = ':';
+ DirOnDriveVar[3] = '\0';
+
+ if ( (envval = _getenv_lk(DirOnDriveVar)) == NULL )
+ {
+ /*
+ * Environment variable not defined! Define it to be the
+ * root on that drive.
+ */
+ DirOnDriveVar[3] = '=';
+ DirOnDriveVar[4] = (char)('A' + (char)drive - (char)1);
+ DirOnDriveVar[5] = ':';
+ DirOnDriveVar[6] = '\\';
+ DirOnDriveVar[7] = '\0';
+
+ if ( _putenv_lk(DirOnDriveVar) != 0 )
+ {
+ errno = ENOMEM; /* must be out of heap memory */
+ return NULL;
+ }
+ envval = &DirOnDriveVar[4];
+ }
+
+ len = strlen(envval) + 1;
+
+ }
+ else // get directory for current drive
+ {
+
+ /*
+ * Ask OS the length of the current directory string
+ */
+ len = GetCurrentDirectoryW(sizeof(dirbuf)/sizeof(wchar_t),
+ (LPWSTR)dirbuf) + 1;
+ }
+
+ /*
+ * Set up the buffer.
+ */
+ if ( (p = pnbuf) == NULL )
+ {
+ /*
+ * Allocate a buffer for the user.
+ */
+ maxlen = __max(len, maxlen);
+ if ( (p = malloc(maxlen * sizeof(wchar_t))) == NULL )
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+ }
+ else if ( len > maxlen )
+ {
+ /*
+ * Won't fit in the user-supplied buffer!
+ */
+ errno = ERANGE; /* Won't fit in user buffer */
+ return NULL;
+ }
+
+ /*
+ * Place the current directory string into the user buffer
+ */
+
+ if ( drive != 0 )
+ {
+ /*
+ * Copy value of special environment variable into user buffer
+ * and convert it to unicode.
+ */
+ mbstowcs (p, envval, maxlen+1);
+ }
+ else
+ {
+ /*
+ * Get the current directory directly from the OS
+ */
+ if ( GetCurrentDirectoryW(len,p) == 0 )
+ {
+ /*
+ * Oops. For lack of a better idea, assume some sort
+ * of access error has occurred.
+ */
+ errno = EACCES;
+ _doserrno = GetLastError();
+ return NULL;
+ }
+ }
+ return p;
+}
+
+//////////////////////////////////////////////////////////////
+
+
+
+///////////////////////////////////////////////////////////////////////////
+
+int _CRTAPI1 _accessW (
+ const wchar_t *path,
+ int amode
+ )
+{
+ DWORD attr;
+
+
+ attr = GetFileAttributesW((LPWSTR)path);
+
+ if (attr == 0xffffffff)
+ {
+ /* error occured -- map error code and return */
+ errno = ENOENT ;
+// _dosmaperr(GetLastError());
+ return -1;
+ }
+
+ /* no error; see if returned premission settings OK */
+ if (attr & FILE_ATTRIBUTE_READONLY && (amode & 2))
+ {
+ /* no write permission on file, return error */
+ errno = EACCES;
+// _doserrno = E_access;
+ return -1;
+ }
+ else
+ {
+ /* file exists and has requested permission setting */
+ return 0;
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////
+
+
+int _CRTAPI1 _chmodW (
+ const wchar_t *path,
+ int mode
+ )
+{
+ DWORD attr;
+
+ attr = GetFileAttributesW((LPWSTR)path);
+ if (attr == 0xffffffff)
+ {
+ /* error occured -- map error code and return */
+// _dosmaperr(GetLastError());
+ return -1;
+ }
+
+ if (mode & _S_IWRITE)
+ {
+ /* clear read only bit */
+ attr &= ~FILE_ATTRIBUTE_READONLY;
+ }
+ else
+ {
+ /* set read only bit */
+ attr |= FILE_ATTRIBUTE_READONLY;
+ }
+
+ /* set new attribute */
+ if (!SetFileAttributesW((LPWSTR)path, attr))
+ {
+ /* error occured -- map error code and return */
+// _dosmaperr(GetLastError());
+ return -1;
+ }
+ return 0;
+}
+
+
+/////////////////////////////////////////////////////////////
+
+
+//static wchar_t * _stripquoteW (wchar_t * src );
+//
+//#define TMP_BUF_SIZE 256 //size of buffer for TMP environment variable
+//
+//wchar_t * _CRTAPI1 _tempnamW (
+// wchar_t *dir,
+// wchar_t *pfx
+// )
+//{
+//
+// wchar_t *ptr;
+// unsigned int pfxlength=0;
+// wchar_t * s;
+// wchar_t * pfin;
+// unsigned int first;
+// wchar_t * qptr = NULL; /* ptr to TMP path with quotes stripped out */
+//
+// wchar_t szTmp[TMP_BUF_SIZE] = L"";
+// int cchTmp = 0;
+//
+//
+//
+// /* try TMP path */
+// if ((cchTmp = GetEnvironmentVariableW (L"TMP", szTmp, sizeof (szTmp)))
+// && (-1 != _accessW (szTmp, 0)) )
+// {
+// dir = szTmp;
+// }
+// else /* try stripping quotes out of TMP path */
+// if ( (cchTmp != 0)
+// && (qptr = _stripquoteW(szTmp))
+// && (-1 != _accessW(qptr, 0)) )
+// {
+// dir = qptr;
+// }
+// else /* TMP path not available, use alternatives */
+// if (!( dir != NULL && ( _accessW( dir, 0 ) != -1 ) ) )
+// {
+// /* do not "simplify" this depends on side effects!! */
+// free(qptr); /* free buffer, if non-NULL */
+//
+// /* convert global variable to a Unicode string */
+// cchTmp = mbstowcs ( szTmp, _P_tmpdir, strlen (_P_tmpdir)+1 );
+//
+// if ((cchTmp > 0)
+// && (_accessW( szTmp, 0 ) != -1 ))
+// {
+// dir = szTmp;
+// }
+// else
+// {
+// dir = L".";
+// }
+// }
+//
+//
+// if (pfx)
+// {
+// pfxlength = wcslen(pfx);
+// }
+// /* the 8 below allows for a backslash, 6 char temp string and */
+// /* a null terminator */
+//
+// if ( ( s = malloc (wcslen(dir) + pfxlength + 8*sizeof(wchar_t)) ) == NULL )
+// {
+// goto done2;
+// }
+// *s = L'\0';
+// wcscat( s, dir );
+// pfin = &(dir[ wcslen( dir ) - 1 ]);
+//
+// if ( ( *pfin != L'\\' ) && ( *pfin != L'/' ) )
+// {
+// wcscat( s, L"\\" );
+// }
+// if ( pfx != NULL )
+// {
+// wcscat( s, pfx );
+// }
+// ptr = &s [ wcslen( s ) ];
+//
+// /*
+// Re-initialize _tempoff if necessary. If we don't re-init _tempoff, we
+// can get into an infinate loop (e.g., (a) _tempoff is a big number on
+// entry, (b) prefix is a long string (e.g., 8 chars) and all tempfiles
+// with that prefix exist, (c) _tempoff will never equal first and we'll
+// loop forever).
+//
+// [NOTE: To avoid a conflict that causes the same bug as that discussed
+// above, _tempnam() uses _tempoff; tmpnam() uses _tmpoff]
+// */
+//
+// _mlock(_TMPNAM_LOCK); /* Lock access to _old_pfxlen and _tempoff */
+//
+// if (_old_pfxlen < pfxlength)
+// {
+// _tempoff = 1;
+// }
+// _old_pfxlen = pfxlength;
+//
+// first = _tempoff;
+//
+// do {
+// if ( ++_tempoff == first ) {
+// free(s);
+// s = NULL;
+// goto done1;
+// }
+// swprintf ( ptr, L"%d", _tempoff );
+// //_itoa( _tempoff, ptr, 10 );
+//
+// if ( wcslen( ptr ) + pfxlength > 8 )
+// {
+// *ptr = L'\0';
+// _tempoff = 0;
+// }
+// }
+// while ( (_accessW( s, 0 ) == 0 ) || (errno == EACCES) );
+//
+//
+// /* Common return */
+//done1:
+// _munlock(_TMPNAM_LOCK); /* release tempnam lock */
+//done2:
+// free(qptr); /* free temp ptr, if non-NULL */
+// return(s);
+//}
+//
+//
+//static wchar_t * _stripquoteW (wchar_t * src )
+//{
+// wchar_t * dst;
+// wchar_t * ret;
+// unsigned int q = 0;
+//
+//
+// /* get a buffer for the new string */
+//
+// if ((dst = malloc((wcslen(src)+1)*sizeof(wchar_t)) ) == NULL)
+// {
+// return(NULL);
+// }
+// /* copy the string stripping out the quotes */
+//
+// ret = dst; /* save base ptr */
+//
+// while (*src)
+// {
+//
+// if (*src == L'\"')
+// {
+// src++; q++;
+// }
+// else
+// {
+// *dst++ = *src++;
+// }
+// }
+// if (q)
+// {
+// *dst = L'\0'; /* final nul */
+// return(ret);
+// }
+// else
+// {
+// free(ret);
+// return(NULL);
+// }
+//
+//}
+
+///////////////////////////////////////////////////////
+
+int _CRTAPI1 renameW (
+ const wchar_t *oldname,
+ const wchar_t *newname
+ )
+{
+ ULONG dosretval;
+
+ /* ask OS to move file */
+
+ if (!MoveFileW((LPWSTR)oldname, (LPWSTR)newname))
+ dosretval = GetLastError();
+ else
+ dosretval = 0;
+
+ if (dosretval) {
+ /* error occured -- map error code and return */
+// _dosmaperr(dosretval);
+ return -1;
+ }
+
+ return 0;
+}
+
+FILE * UNI_fopen( wchar_t *fname, unsigned long flags )
+{
+ int mode = GENERIC_READ ;
+ int append = OPEN_ALWAYS ;
+ HANDLE fhand;
+ INT crt_hand = -1 ;
+ FILE *strm_hand = NULL ;
+
+ if ( (flags & _O_RDONLY) == 0 ) {
+ mode |= GENERIC_WRITE ;
+ if ( (flags & _O_APPEND) == 0 ) {
+ append = CREATE_ALWAYS ;
+ }
+ }
+ fhand = CreateFileW(fname, mode, FILE_SHARE_READ, NULL, append, FILE_ATTRIBUTE_NORMAL, NULL ) ;
+
+ if ( fhand != INVALID_HANDLE_VALUE ) {
+ crt_hand = _open_osfhandle( (long)fhand, flags&~_O_APPEND ) ;
+ if ( crt_hand == -1 ) {
+ CloseHandle( fhand) ;
+ } else {
+ if ( (flags & _O_RDONLY) == 0 ) {
+ if ( (flags & _O_APPEND) == 0 ) {
+ if ( (flags & _O_TEXT) == 0 ) {
+ strm_hand = _fdopen( crt_hand, "wb+" ) ;
+ } else {
+ strm_hand = _fdopen( crt_hand, "wt+" ) ;
+ }
+ } else {
+ if ( (flags & _O_TEXT) == 0 ) {
+ strm_hand = _fdopen( crt_hand, "ab+" ) ;
+ } else {
+ strm_hand = _fdopen( crt_hand, "at+" ) ;
+ }
+ fseek( strm_hand, 0L, SEEK_END ) ;
+ }
+ } else {
+ if ( (flags & _O_TEXT) == 0 ) {
+ strm_hand = _fdopen( crt_hand, "rb" ) ;
+ } else {
+ strm_hand = _fdopen( crt_hand, "rt" ) ;
+ }
+ strm_hand = _fdopen( crt_hand, "rb" ) ;
+ }
+ }
+ }
+
+ return strm_hand ;
+}
+
+
+
+
+///////////////////////////////////////////////////////////////
+
+/*
+ * Let's undefine OpenFile (from OpenFileW) so we don't call ourselves.
+ * This is a total kludge, though. We should be using CreateFile on Win32.
+ */
+
+///////////////////////////////////////////////////////////////////
+
+
+static void xtoa (
+ unsigned long val,
+ wchar_t *buf,
+ unsigned radix,
+ int is_neg
+ )
+{
+ wchar_t *p; /* pointer to traverse string */
+ wchar_t *firstdig; /* pointer to first digit */
+ wchar_t temp; /* temp char */
+ unsigned digval; /* value of digit */
+
+ p = buf;
+
+ if (is_neg) {
+ long l;
+
+ /* negative, so output '-' and negate */
+ *p++ = L'-';
+ l = (long)val;
+ val = (unsigned long)(-l);
+ }
+
+ firstdig = p; /* save pointer to first digit */
+
+ do {
+ digval = (unsigned) (val % radix);
+ val /= radix; /* get next digit */
+
+ /* convert to ascii and store */
+ if (digval > 9)
+ *p++ = (wchar_t) (digval - 10 + L'a'); /* a letter */
+ else
+ *p++ = (wchar_t) (digval + L'0'); /* a digit */
+ } while (val > 0);
+
+ /* We now have the digit of the number in the buffer, but in reverse
+ order. Thus we reverse them now. */
+
+ *p-- = '\0'; /* terminate string; p points to last digit */
+
+ do {
+ temp = *p;
+ *p = *firstdig;
+ *firstdig = temp; /* swap *p and *firstdig */
+ --p;
+ ++firstdig; /* advance to next two digits */
+ } while (firstdig < p); /* repeat until halfway */
+}
+
+
+/* Actual functions just call conversion helper with neg flag set correctly,
+ and return pointer to buffer. */
+
+wchar_t * _CRTAPI1 _itoaW (
+ int val,
+ wchar_t *buf,
+ int radix
+ )
+{
+ if (radix == 10 && val < 0)
+ xtoa((unsigned long)val, buf, radix, 1);
+ else
+ xtoa((unsigned long)(unsigned int)val, buf, radix, 0);
+ return buf;
+}
+
+wchar_t * _CRTAPI1 _ltoaW (
+ long val,
+ wchar_t *buf,
+ int radix
+ )
+{
+ xtoa((unsigned long)val, buf, radix, (radix == 10 && val < 0));
+ return buf;
+}
+
+wchar_t * _CRTAPI1 _ultoaW (
+ unsigned long val,
+ wchar_t *buf,
+ int radix
+ )
+{
+ xtoa(val, buf, radix, 0);
+ return buf;
+}
+
+#endif //UNICODE
diff --git a/private/utils/ntbackup/src/unitinit.c b/private/utils/ntbackup/src/unitinit.c
new file mode 100644
index 000000000..a6865ffaf
--- /dev/null
+++ b/private/utils/ntbackup/src/unitinit.c
@@ -0,0 +1,480 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: unitinit.c
+
+ Description: This file contains the user interface arbitrator entry
+ point function (UI_UnitsInit) that handles setting up
+ to call the backup engine init entry point (BE_Init).
+
+ $Log: G:/UI/LOGFILES/UNITINIT.C_V $
+
+ Rev 1.26 03 Aug 1993 18:09:38 MARINA
+enable c++
+
+ Rev 1.25 23 Jul 1993 14:25:26 GLENN
+Replaced the app name of the software name string with the long app name.
+
+ Rev 1.24 22 Jul 1993 12:04:36 GLENN
+Added software name support to pass to TF layer for identifying software on tape.
+
+ Rev 1.23 15 Jun 1993 12:05:44 GLENN
+Added support for the NT dummy device driver.
+
+ Rev 1.22 23 Dec 1992 15:39:46 GLENN
+Now displaying no config warning during unattended jobs.
+
+ Rev 1.21 07 Oct 1992 14:50:56 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.20 04 Oct 1992 19:41:26 DAVEV
+Unicode Awk pass
+
+ Rev 1.19 30 Sep 1992 10:44:56 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.18 08 Aug 1992 09:39:54 MIKEP
+start changes for nt hw config
+
+ Rev 1.17 25 Jun 1992 14:06:56 DAVEV
+mwDil is specific to OS_WIN32, not OEM_MSOFT
+
+ Rev 1.16 10 Jun 1992 10:25:50 STEVEN
+would not compile for mips
+
+ Rev 1.15 27 May 1992 18:44:48 STEVEN
+switch should be WIN32 not MSOFT
+
+ Rev 1.14 14 May 1992 17:23:52 MIKEP
+nt pass 2
+
+ Rev 1.13 11 May 1992 14:25:56 DAVEV
+OS_WIN32: chgd STEVE's OEM_MSOFT changes to OS_WIN32, 'cause they's NT specific
+
+ Rev 1.12 27 Apr 1992 14:30:30 CARLS
+changed tdemo number of tapes from 1 to 3
+
+ Rev 1.11 22 Apr 1992 17:48:54 GLENN
+Added TdemoInit() call for TDEMO version only.
+
+ Rev 1.10 30 Mar 1992 18:12:18 GLENN
+Changed return code when no driver string is found.
+
+ Rev 1.9 26 Mar 1992 16:55:02 STEVEN
+update for OEM_MSOFT
+
+ Rev 1.8 03 Mar 1992 18:26:44 GLENN
+Added a change to exe dir call just before reiniting the TF layer for reading .DLLs
+
+ Rev 1.7 11 Feb 1992 17:29:30 GLENN
+Put hardware warning message in string table.
+
+ Rev 1.6 27 Jan 1992 12:48:16 GLENN
+Changed dialog support calls.
+
+ Rev 1.5 17 Jan 1992 16:48:40 JOHNWT
+changed data to cat path
+
+ Rev 1.4 10 Jan 1992 15:46:46 CARLS
+removed strings
+
+ Rev 1.3 07 Jan 1992 17:31:58 GLENN
+Added support for polldrive retry after hwinit failure
+
+ Rev 1.2 19 Dec 1991 17:41:30 DAVEV
+16/32 bit port - 2nd pass
+
+ Rev 1.1 18 Dec 1991 14:07:02 GLENN
+Added windows.h
+
+ Rev 1.0 20 Nov 1991 19:18:54 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// PRIVATE STATIC VARIABLES
+
+static BOOLEAN mwfTFInitialized = FALSE;
+
+/* Definition of resources for the loadable DriverDetermine module */
+
+#if !defined( TDEMO ) && !defined( OS_WIN32 )
+
+ static STD_RESOURCES_INIT detres = {
+ #if !defined( MAYN_OS2)
+ ( PF_intdosx )intdosx,
+ ( PF_free )free,
+ ( PF_memset )memset,
+ ( PF_inp )inp,
+ ( PF_inpw )inpw,
+ ( PF_outp )outp,
+ ( PF_outpw )outpw,
+ ( PF_calloc )calloc,
+ ( PF_int86 )int86,
+ ( PF_int86x )int86x,
+ #endif
+ ( PF_DriverLoad )DriverLoad,
+ ( PF_CDS_GetMaynFolder )CDS_GetExePath
+ } ;
+
+#endif /* TDEMO */
+
+/*****************************************************************************
+
+ Name: UI_UnitsInit
+
+ Description:
+
+ Returns: error returned from BE_Init, or controller related error
+
+ See also: $/SEE( init.c be_init.c hwconf.c )$
+
+*****************************************************************************/
+INT16 UI_UnitsInit (
+
+BE_INIT_STR_PTR pBE, // I - Backup Engine Init Structure pointer
+INT16 nInitType ) // I - Init TYPE
+
+{
+ INT nErrorBE ;
+ INT nErrorUI = FALSE ;
+ CHAR szDriverName[9] ;
+ INT nNumDILs = 0 ;
+ INT rc = 1;
+
+#ifdef MAYN_OS2
+
+ // First attempt to apply a lock to the backup engine.
+
+ if ( ( nInitType & INIT_TFL ) && ( UI_LockBackupEngine( ) != SUCCESS ) ) {
+ return BENGINE_IN_USE ;
+ }
+
+#endif
+
+ WM_ShowWaitCursor ( TRUE );
+
+ // Initialize be_init structure elements.
+
+ pBE->critical_error_handler = NULL;
+ pBE->debug_print = ( VOID ( * )( UINT16, CHAR_PTR, va_list ) )zvprintf;
+ pBE->units_to_init = 0;
+ pBE->dle_list_ptr = &dle_list;
+ pBE->bsd_list_ptr = &bsd_list;
+ pBE->remote_filter = NRL_LANBACK_DRIVE;
+
+ pBE->driver_directory = ( CHAR_PTR )calloc( ( strlen( CDS_GetExePath() ) + sizeof ( CHAR ) ), sizeof ( CHAR ) );
+ strcpy( pBE->driver_directory, CDS_GetExePath( ) );
+
+ pBE->catalog_directory = ( CHAR_PTR )calloc( ( strlen( CDS_GetCatDataPath() ) + sizeof ( CHAR ) ), sizeof ( CHAR ) );
+ strcpy( pBE->catalog_directory, CDS_GetCatDataPath( ) );
+
+ // Get the software application name, version, and revision for the
+ // tape format to write on tape.
+
+ {
+ CHAR szSoftwareName[MAX_UI_RESOURCE_SIZE];
+ CHAR szAppName[120];
+ CHAR szAppExeName[20];
+ CHAR szAppVersion[60];
+ CHAR szAppVerNum[10];
+ CHAR szAppRevNum[10];
+
+ RSM_StringCopy ( IDS_LONGAPPNAME, szAppName, sizeof ( szAppName ) );
+ RSM_StringCopy ( IDS_EXEFILENAME, szAppExeName, sizeof ( szAppExeName ) );
+ RSM_StringCopy ( IDS_APPVERSION, szAppVersion, sizeof ( szAppVersion ) );
+ RSM_StringCopy ( IDS_APPEXEVER, szAppVerNum, sizeof ( szAppVerNum ) );
+ RSM_StringCopy ( IDS_APPENGREL, szAppRevNum, sizeof ( szAppRevNum ) );
+
+ strcat ( szAppName, TEXT(" (") );
+ strcat ( szAppName, szAppExeName );
+ strcat ( szAppName, TEXT(") ") );
+ strcat ( szAppName, szAppVersion );
+
+ sprintf ( szSoftwareName, szAppName, szAppVerNum, szAppRevNum );
+
+ pBE->software_name = ( CHAR_PTR )calloc ( ( strlen ( szSoftwareName ) + sizeof ( CHAR ) ), sizeof ( CHAR ) );
+
+ if ( pBE->software_name ) {
+ strcpy( pBE->software_name, szSoftwareName );
+ }
+
+ }
+
+ if ( ( nInitType & REINIT_TFL ) || ( nInitType & INIT_TFL ) ) {
+
+# if !defined( OS_WIN32 )
+
+ // Simply get the currently defined device driver from config.
+
+ strcpy ( szDriverName, ( CDS_GetActiveDriver( CDS_GetPerm() ) ) );
+
+ WM_ShowWaitCursor ( FALSE );
+
+ while ( ( ! strlen ( szDriverName ) ) && ( ! (BOOL)( nErrorUI) ) ) {
+
+ if ( ! CDS_GetAdvToConfig ( CDS_GetPerm () ) ) {
+
+ rc = WM_MsgBox ( ID(IDS_HWC_WARNING_TITLE),
+ ID(IDS_HWC_NO_CONFIG),
+ WMMB_YESNO | WMMB_NOYYCHECK,
+ WMMB_ICONQUESTION );
+
+ if ( rc == WMMB_IDYES ) {
+
+ CDS_SetAdvToConfig ( CDS_GetPerm (), TRUE );
+ rc = DM_ShowDialog ( ghWndFrame, IDD_SETTINGSHARDWARE, (PVOID)0 );
+ CDS_SetAdvToConfig ( CDS_GetPerm (), FALSE );
+
+ // Try again to get the currently defined device
+ // driver from config.
+
+ strcpy ( szDriverName, ( CDS_GetActiveDriver ( CDS_GetPerm() ) ) );
+ }
+ else {
+
+ nErrorUI = HW_ERROR_DETECTED;
+ }
+ }
+ }
+
+ WM_ShowWaitCursor ( TRUE );
+
+ if ( strlen ( szDriverName ) ) {
+
+ zprintf ( DEBUG_DEVICE_DRIVER, RES_LOADING_DRIVER, szDriverName );
+
+ // Call user interface hardware support routine to fill out
+ // the DIL HW structure.
+
+ nErrorUI = HWC_InitDILHWD( &gb_dhw_ptr, &nNumDILs );
+
+ if ( nErrorUI == SUCCESS ) {
+
+ /* Setup the tape format init parameters in the be_init structure */
+
+ strcpy( pBE->driver_name, CDS_GetExePath( ) ) ;
+ strcat( pBE->driver_name, szDriverName ) ;
+ strcat( pBE->driver_name, DLL_EXTENSION ) ;
+
+ pBE->dhwd_ptr = gb_dhw_ptr ;
+ pBE->number_of_cards = (INT16) nNumDILs ; /* number of dil structures allocated */
+ pBE->thw_list_ptr = &thw_list ; /* TF fills this out */
+ pBE->max_channels = 1 ; /* ms 3.0 only supports a single channel */
+ pBE->tf_buffer_size = CDS_GetTFLBuffSize ( CDS_GetPerm() ) ;
+ }
+ }
+# else
+
+ if ( gfDummyDriver ) {
+
+ CHAR szDriverName [MAX_UI_SMALLRES_SIZE];
+
+ RSM_StringCopy ( IDS_HWC_DUMMY_DEVICE_DLL, szDriverName, sizeof ( szDriverName ) );
+
+ strcpy ( pBE->driver_name, CDS_GetExePath( ) ) ;
+ strcat ( pBE->driver_name, szDriverName ) ;
+
+ }
+ else {
+ strcpy ( pBE->driver_name, TEXT("") );
+ }
+
+ gb_dhw_ptr = &gb_NTDIL ;
+ memset( gb_dhw_ptr, 0, sizeof(gb_NTDIL) ) ;
+
+ pBE->dhwd_ptr = gb_dhw_ptr ;
+ pBE->number_of_cards = (UINT16) 1 ;
+ pBE->thw_list_ptr = &thw_list ; /* TF fills this out */
+ pBE->max_channels = 1 ; /* ms 3.0 only supports a single channel */
+ pBE->tf_buffer_size = CDS_GetTFLBuffSize ( CDS_GetPerm() ) ;
+
+# endif //OS_WIN32
+
+ }
+
+ /* If NO driver determination error has occurred, init the entire backup */
+ /* engine, otherwise, init backup engine excluding initing Tape Format */
+
+ if ( ! nErrorUI ) {
+
+ switch ( nInitType ) {
+
+ case INIT_ALL:
+ case INIT_FSYS_BSDU:
+
+# if defined( TDEMO )
+ {
+ TdemoInit ( CDS_GetUserDataPath (), /* TDEMO?.DAT directory */
+ 3, /* number of tapes ( 3 max ) */
+ (VOID_PTR)1, /* workstation resource */
+ (VOID_PTR)1, /* alias resource */
+ FALSE /* demo speed */
+ );
+
+
+ }
+# endif // TDEMO
+
+ zprintf ( DEBUG_USER_INTERFACE, RES_INIT_FILE_SYSTEM );
+
+ STM_SetIdleText ( IDS_INITFILESYS );
+
+ pBE->units_to_init |= BE_INIT_FSYS ;
+ pBE->units_to_init |= BE_INIT_BSDU ;
+ nErrorBE = BE_Init( pBE, CDS_GetPermBEC() ) ;
+ break ;
+
+ case INIT_TFL:
+ case REINIT_TFL:
+
+# if !defined( OS_WIN32 )
+
+ if ( !strlen ( szDriverName ) ) {
+ break ;
+ }
+# endif
+
+
+ zprintf ( DEBUG_USER_INTERFACE, RES_INIT_HARDWARE );
+
+ STM_SetIdleText ( IDS_INITHARDWARE );
+
+ CDS_ChangeToExeDir ();
+
+ if ( gfDummyDriver ) {
+ WM_ShowWaitCursor ( SWC_PAUSE );
+ }
+
+ nErrorBE = BE_ReinitTFLayer( pBE, CDS_GetPermBEC() ) ;
+
+ if ( gfDummyDriver ) {
+ WM_ShowWaitCursor ( SWC_RESUME );
+ }
+
+ // Quality check the expected number of drives attached
+ // and define the logical drive channel.
+
+ if( nErrorBE == BE_INIT_SUCCESS ) {
+ DefineChannel( pBE ) ;
+ }
+
+ // If this is the firt time for INIT_TFL or REINIT_TFL, add
+ // the UI_UnitsDeInit () to the exit list. This must be
+ // done so that the atexit() call in the DriverLoad() call
+ // can be placed in the list before the this modules call.
+
+ if ( ! mwfTFInitialized ) {
+
+ mwfTFInitialized = TRUE;
+ }
+
+
+ break ;
+
+ }
+
+ nErrorUI = nErrorBE ;
+ }
+
+ if ( pBE->software_name ) {
+ free ( pBE->software_name );
+ }
+
+ WM_ShowWaitCursor ( FALSE );
+
+ return (INT16) nErrorUI ;
+}
+
+#ifdef MAYN_OS2
+
+/*****************************************************************************
+
+ Name: UI_LockBackupEngine
+
+ Description: Creates a system semaphore which indicates that the Backup
+ Engine is in use. If the semaphore has already been
+ created, the engine is already in use and locked and the
+ caller is returned FALSE.
+
+ Returns: SUCCESS (0) or FAILURE (!0).
+
+*****************************************************************************/
+INT16 UI_LockBackupEngine( VOID )
+{
+ INT16 rc = SUCCESS ;
+
+ if ( rc = DosCreateSem( SHARED, &mw_bengine_sem, BENGINE_SEM ) )
+ {
+ mw_bengine_locked = FALSE ;
+ }
+ else
+ {
+ mw_bengine_locked = TRUE ;
+ };
+
+ return( rc );
+
+} /* end UI_LockBackupEngine() */
+
+/*****************************************************************************
+
+ Name: UI_UnlockBackupEngine
+
+ Description: Closes the system semaphore which indicates that the Backup
+ Engine is in use, only if the semaphore exists.
+
+ Returns: SUCCESS (0) or FAILURE (!0).
+
+*****************************************************************************/
+INT16 UI_UnlockBackupEngine( VOID )
+{
+ INT16 rc = SUCCESS ;
+
+ /****************************************************************
+ * If the Backup Engine semaphore is open, close it. *
+ ****************************************************************/
+
+ if ( mw_bengine_locked ) {
+ rc = DosCloseSem( mw_bengine_sem ) ;
+ }
+
+ return( rc ) ;
+
+} /* end UI_UnlockBackupEngine() */
+
+#endif
+
+
+/*****************************************************************************
+
+ Name: UI_UnitsDeInit
+
+ Description: This function is automatically called at exit time because
+ UI_UnitsInit set it up as an atexit function. This function
+ should reverse the effect of UI_UnitsInit.
+
+ Returns: nothing
+
+ Notes: atexit functions cannot take any parameters.
+
+*****************************************************************************/
+VOID UI_UnitsDeInit( VOID )
+{
+
+ BE_Deinit( dle_list );
+
+#ifdef MAYN_OS2
+ UI_UnlockBackupEngine() ;
+#endif
+
+}
+
+
diff --git a/private/utils/ntbackup/src/version.rc b/private/utils/ntbackup/src/version.rc
new file mode 100644
index 000000000..0102dbd2c
--- /dev/null
+++ b/private/utils/ntbackup/src/version.rc
@@ -0,0 +1,43 @@
+/*
+** Version resources for NTBackup.
+**
+** Ntverp.h defines several global values that don't need to be
+** changed except for official releases such as betas, sdk updates, etc.
+**
+** Common.ver has the actual version resource structure that all these
+** #defines eventually initialize.
+*/
+
+#include <ntverp.h>
+
+/* VER_FILETYPE, VER_FILESUBTYPE, VER_FILEDESCRIPTION_STR
+ * and VER_INTERNALNAME_STR must be defined before including COMMON.VER
+ * The strings don't need a '\0', since common.ver has them.
+ */
+#define VER_FILETYPE VFT_APP
+/* possible values: VFT_UNKNOWN
+ VFT_APP
+ VFT_DLL
+ VFT_DRV
+ VFT_FONT
+ VFT_VXD
+ VFT_STATIC_LIB
+*/
+#define VER_FILESUBTYPE VFT2_UNKNOWN
+/* possible values VFT2_UNKNOWN
+ VFT2_DRV_PRINTER
+ VFT2_DRV_KEYBOARD
+ VFT2_DRV_LANGUAGE
+ VFT2_DRV_DISPLAY
+ VFT2_DRV_MOUSE
+ VFT2_DRV_NETWORK
+ VFT2_DRV_SYSTEM
+ VFT2_DRV_INSTALLABLE
+ VFT2_DRV_SOUND
+ VFT2_DRV_COMM
+*/
+#define VER_FILEDESCRIPTION_STR "NT Tape Backup Utility"
+#define VER_INTERNALNAME_STR "NTBackup.Exe"
+#define VER_ORIGINALFILENAME_STR "NTBackup.Exe"
+
+#include "common.ver"
diff --git a/private/utils/ntbackup/src/very_dle.c b/private/utils/ntbackup/src/very_dle.c
new file mode 100644
index 000000000..0c04b16ff
--- /dev/null
+++ b/private/utils/ntbackup/src/very_dle.c
@@ -0,0 +1,270 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: very_dle.c
+
+ Description: this file contains the routine to process a single dle for verify.
+
+ $Log: N:\logfiles\very_dle.c_v $
+
+ Rev 1.15.1.1 26 Apr 1994 18:59:28 STEVEN
+fix dissconect bug
+
+ Rev 1.15.1.0 07 Feb 1994 02:06:46 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.15 14 Jan 1993 13:33:06 STEVEN
+added stream_id to error message
+
+ Rev 1.14 08 Apr 1992 17:39:58 NED
+added handling of TFLE_USER_ABORT
+from LP_StartTPEDialog().
+Marilyn made me do it!
+
+ Rev 1.13 16 Mar 1992 16:23:28 STEVEN
+initialize the DBLKS
+
+ Rev 1.12 24 Feb 1992 10:00:32 GREGG
+Call TF_OpenTape at beginning of loop, Open/Close Set in loop, CloseTape at end.
+
+ Rev 1.11 19 Feb 1992 16:00:46 GREGG
+Added vcb_only parameter to call to TF_OpenSet.
+
+ Rev 1.10 06 Nov 1991 18:21:50 GREGG
+BIGWHEEL - 8200sx - Get cat_enabled from lp instead of lis.
+
+ Rev 1.9 17 Oct 1991 01:52:04 ED
+BIGWHEEL - 8200sx - Initial integration.
+
+ Rev 1.8 16 Aug 1991 17:11:34 STEVEN
+Could not Verify or Restore multiple sets
+
+ Rev 1.7 24 Jul 1991 15:55:18 DAVIDH
+Cleared up warnings under Watcom.
+
+ Rev 1.6 27 Jun 1991 13:12:16 STEVEN
+use config for write format
+
+ Rev 1.5 24 Jun 1991 17:22:44 STEVEN
+remove date time from StartBS
+
+ Rev 1.4 21 Jun 1991 08:49:12 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:11:08 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 24 May 1991 13:19:02 STEVEN
+updates from BSDU redesign
+
+ Rev 1.1 15 May 1991 11:00:48 DAVIDH
+Cleared up type mismatch found by Watcom compiler.
+
+ Rev 1.0 09 May 1991 13:37:06 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "queues.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "get_next.h"
+#include "beconfig.h"
+/* $end$ include list */
+
+/**/
+/**
+
+ Name: LP_VerifyDLE()
+
+ Description: this routine process a single dle for verification
+
+ Modified: 5/24/1991 10:58:3
+
+ Returns: tape backup engine error
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_VerifyDLE(
+BSD_PTR bsd_ptr, /* I - The verify selections */
+register LP_ENV_PTR lp, /* I - The Loop Environment struct */
+BOOLEAN reuse_bsd, /* I - TRUE if this is the same BSD */
+INT16 channel_no, /* I - The channel number */
+THW_PTR sdrv ) /* I - The starting drive */
+{
+ INT16 return_status ;
+ DBLK_PTR curr_blk ;
+ TFL_OPBLK pb ;
+ DATA_FRAGMENT data_frag ;
+ LBA_ELEM lba_elem ;
+ BOOLEAN lba_empty ;
+
+ /* setup requested tape id and tape seq number */
+ if( ( ( BSD_GetTapeID( bsd_ptr ) != -1 ) ||
+ ( BSD_GetTapeNum( bsd_ptr ) != -1 ) ) &&
+ ( !reuse_bsd ) ) {
+ lp->tpos.tape_id = BSD_GetTapeID( bsd_ptr ) ;
+ lp->tpos.tape_seq_num = BSD_GetTapeNum( bsd_ptr ) ;
+ }
+
+ memset( lp->curr_ddb, 0, sizeof(DBLK) ) ;
+ memset( lp->curr_blk, 0, sizeof(DBLK) ) ;
+
+ lp->lis_ptr->curr_bsd_ptr = bsd_ptr ;
+ pb.tape_position = &lp->tpos ;
+ pb.sdrv = sdrv ;
+ pb.channel = channel_no ;
+ pb.rewind_sdrv = FALSE ;
+ pb.perm_filter = TF_KEEP_ALL_DATA ;
+ pb.attributes = 0L ;
+ pb.fsh = lp->curr_fsys ;
+ pb.mode = TF_READ_OPERATION ;
+ pb.ignore_clink = FALSE ;
+ pb.wrt_format = BEC_GetWriteFormat( BSD_GetConfigData(bsd_ptr) ) ;
+ pb.idle_call = NULL ;
+ pb.cat_enabled = lp->cat_enabled ;
+
+ memset( &data_frag, 0, sizeof( data_frag ) ) ;
+
+ if( !reuse_bsd ) {
+ /* Setup for FFR based operation... */
+ lp->tpos.tape_loc.pba_vcb = BSD_GetPBA( bsd_ptr );
+ lp->rr.tape_loc.pba_vcb = BSD_GetPBA( bsd_ptr );
+ }
+
+ lba_empty = BSD_GetFirstLBA( bsd_ptr, &lba_elem ) ;
+
+ if ( !reuse_bsd && !lba_empty ) {
+ lp->tpos.tape_loc.tape_seq = LBA_GetTapeNum( &lba_elem ) ;
+ lp->tpos.tape_loc.lba = LBA_GetLBA( &lba_elem ) ;
+ lp->rr.tape_loc.tape_seq = LBA_GetTapeNum( &lba_elem ) ;
+ lp->rr.tape_loc.lba = LBA_GetLBA( &lba_elem ) ;
+ pb.tape_position->tape_seq_num = LBA_GetTapeNum( &lba_elem ) ;
+ pb.tape_position->tape_id = BSD_GetTapeID( bsd_ptr ) ;
+
+ } else {
+
+ /* If not a FFR drive, nor a drive which can mode switch to FFR, nor an SX drive then
+ make sure that PBA of the VCB has been cleared */
+ if( !( BSD_HardwareSupportsFeature( bsd_ptr, TDI_FAST_NBLK ) ||
+ BSD_HardwareSupportsFeature( bsd_ptr, TDI_MODE_CHANGE ) ||
+ BSD_HardwareSupportsFeature( bsd_ptr, TDI_FIND_BLK ) ) ) {
+ lp->tpos.tape_loc.pba_vcb = 0 ;
+ lp->rr.tape_loc.pba_vcb = 0 ;
+ }
+
+ }
+
+
+ /* Now open the backup set */
+ if( ( return_status = TF_OpenSet( &pb, FALSE ) ) == SUCCESS ) {
+
+ /* store the channel */
+ lp->channel = pb.channel ;
+
+ if( ( return_status = LP_StartTPEDialogue( lp, FALSE ) ) == SUCCESS ) {
+
+ /* log start of backup set */
+ LP_MsgStartBS( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, lp->curr_blk ) ;
+
+ if( return_status == SUCCESS ) {
+
+ /* Now we have the GetNextItemLoop */
+ do {
+ if( ( return_status = LP_GetNextTPEBlock( lp, &curr_blk ) ) == SUCCESS ) {
+
+ if ( curr_blk != NULL ) {
+
+ return_status = LP_VerifyOBJ( lp, curr_blk, &data_frag ) ;
+ if( FS_GetBlockType( curr_blk ) == IDB_ID ) {
+ /* This is a kludge to cover for the fact that */
+ /* the image is treated as a single object. */
+ break ;
+ }
+ } else {
+ break ;
+ }
+
+ }
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ /* falling through (no break) */
+
+ case ABORT_PROCESSED:
+ return_status = USER_ABORT ;
+ break ;
+
+ case ABORT_AT_EOM:
+ return_status = USER_ABORT ;
+ break ;
+ }
+
+ } while( !return_status &&
+ (curr_blk != NULL) &&
+ (lp->rr.tf_message != TRR_END ) ) ;
+
+ }
+
+ /* Log end of backup set */
+ LP_MsgEndBS( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos ) ;
+
+
+ /* Process last tape format request as long as no fatal error occurred */
+ if( ( return_status != SUCCESS ) && ( LP_GetAbortFlag( lp->lis_ptr ) != ABORT_AT_EOM ) ) {
+ lp->rr.lp_message = LRR_ABORT ;
+ if( ( return_status = TF_GetNextTapeRequest( &lp->rr ) ) != SUCCESS ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+ } else if ( return_status == TFLE_USER_ABORT ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+ }
+
+ /* Close set, save current tape device and post tape stats */
+ LP_CloseSet( pb.channel ) ;
+
+ }
+ else {
+ TF_CloseSet( lp->channel, NULL ) ;
+ if( return_status == TFLE_USER_ABORT ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ } else if( return_status != TFLE_UI_HAPPY_ABORT ) {
+ LP_MsgError( lp->lis_ptr->pid, bsd_ptr, lp->curr_fsys, &lp->tpos, return_status, NULL, NULL, 0L ) ;
+ }
+ }
+
+ free( data_frag.buffer ) ;
+
+ return( return_status ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/very_obj.c b/private/utils/ntbackup/src/very_obj.c
new file mode 100644
index 000000000..6a68a1d92
--- /dev/null
+++ b/private/utils/ntbackup/src/very_obj.c
@@ -0,0 +1,494 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: very_obj.c
+
+ Description: contains routine to verify single object
+
+ $Log: N:\logfiles\very_obj.c_v $
+
+ Rev 1.27.1.0 26 Apr 1994 18:59:34 STEVEN
+fix dissconect bug
+
+ Rev 1.27 29 Jun 1993 16:16:08 BARRY
+Now can skip files at the time they're opened.
+
+ Rev 1.26 01 Jun 1993 16:19:58 STEVEN
+fix posix bugs
+
+ Rev 1.25 09 Mar 1993 12:29:08 STEVEN
+we need to break out of loop if an error occurs
+
+ Rev 1.24 09 Feb 1993 09:27:48 STEVEN
+parameters to macro were wrong.
+
+ Rev 1.23 20 Jan 1993 16:36:42 DON
+fixed bug in macro LP_MsgLogDifference for special IDB logic
+
+ Rev 1.22 14 Jan 1993 16:40:14 STEVEN
+fix bugs in last checkin
+
+ Rev 1.21 14 Jan 1993 13:34:04 STEVEN
+added stream_id to error message
+
+ Rev 1.20 04 Nov 1992 13:23:44 STEVEN
+fix various bugs with read
+
+ Rev 1.19 04 Nov 1992 09:29:08 STEVEN
+fix initial receive
+
+ Rev 1.18 03 Nov 1992 10:09:20 STEVEN
+change the way we skip data
+
+ Rev 1.17 28 Oct 1992 15:05:30 STEVEN
+very buffer is buffer size
+
+ Rev 1.16 05 Oct 1992 10:29:34 STEVEN
+remove TotalSize
+
+ Rev 1.15 16 Sep 1992 16:55:34 STEVEN
+added support for stream info struct for Tpfmt
+
+ Rev 1.14 01 Sep 1992 16:11:42 STEVEN
+added stream headers to fsys API
+
+ Rev 1.13 23 Jul 1992 13:16:52 STEVEN
+fix warnings
+
+ Rev 1.12 14 May 1992 12:40:48 TIMN
+Changed CHAR to INT8
+
+ Rev 1.11 05 May 1992 17:19:08 STEVEN
+fixed typos and misc bugs
+
+ Rev 1.10 16 Mar 1992 16:34:56 STEVEN
+more 64 bit support for format 40
+
+ Rev 1.9 13 Mar 1992 09:23:16 STEVEN
+4.0 tape format 64 bit
+
+ Rev 1.8 04 Feb 1992 10:35:56 DON
+if NOT defined FS_IMAGE then Images should be ignored
+
+ Rev 1.7 17 Jan 1992 17:42:18 STEVEN
+fix warnings for WIN32
+
+ Rev 1.6 11 Dec 1991 14:09:28 STEVEN
+read converted to FS_READ
+
+ Rev 1.5 27 Jun 1991 13:07:06 STEVEN
+removed unused parm to ReceiveData
+
+ Rev 1.4 21 Jun 1991 08:48:52 STEVEN
+new config unit
+
+ Rev 1.3 30 May 1991 09:11:40 STEVEN
+bsdu_err.h no longer exists
+
+ Rev 1.2 24 May 1991 13:19:16 STEVEN
+updates from BSDU redesign
+
+ Rev 1.1 15 May 1991 11:01:36 DAVIDH
+Initialized blk_size to clear Watcom compiler warning.
+
+
+ Rev 1.0 09 May 1991 13:38:54 HUNTER
+Initial revision.
+
+**/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "queues.h"
+#include "beconfig.h"
+#include "msassert.h"
+#include "tbe_defs.h"
+#include "tbe_err.h"
+#include "bsdu.h"
+#include "fsys.h"
+#include "datetime.h"
+#include "tflproto.h"
+#include "tfldefs.h"
+#include "loops.h"
+#include "loop_prv.h"
+#include "lis.h"
+#include "sleep.h"
+
+/* static dblk used for comparing dblk information */
+static DBLK disk_dblk ;
+
+/**/
+/**
+
+ Name: LP_VerifyOBJ()
+
+ Description: this routine verifies a single object
+
+ Modified: 5/24/1991 11:12:39
+
+ Returns: tape backup engine error
+
+ Notes: none
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 LP_VerifyOBJ(
+register LP_ENV_PTR lp, /* I - Loop Environment structure */
+DBLK_PTR tape_dblk_ptr, /* I - The object to verify */
+DATA_FRAGMENT_PTR frag_ptr ) /* I - Buffer to user for fragments */
+{
+ UINT64 amount_verified ;
+ UINT16 very_size ;
+ UINT16 blk_size = 0 ;
+ INT16 error = SUCCESS ;
+ FILE_HAND hdl ;
+ BOOLEAN info_different_flag ;
+ INT8_PTR tape_data_buf ;
+ INT16 buffer_used_size ;
+ UINT16 read_size ;
+ BSD_PTR bsd_ptr;
+ FSYS_HAND fsh ;
+ UINT32 pid ;
+ BE_CFG_PTR cfg ;
+ BOOLEAN math_status ;
+
+ fsh = lp->curr_fsys ;
+ bsd_ptr = lp->lis_ptr->curr_bsd_ptr ;
+ pid = lp->lis_ptr->pid ;
+
+ cfg = BSD_GetConfigData( bsd_ptr ) ;
+
+ amount_verified = U64_Init(0,0) ;
+
+#ifndef FS_IMAGE
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == BT_IDB ) {
+ LP_SkipData( lp ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ LP_FinishedOper( lp ) ;
+ return SUCCESS ;
+ }
+
+#endif
+
+ /* anything that's done is considered processed ... */
+ LP_MsgBlockProcessed( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr ) ;
+
+ disk_dblk = *tape_dblk_ptr ;
+
+ /* make sure the disk based DBLK is properly set for display purposes */
+ FS_GetObjInfo( fsh, &disk_dblk ) ;
+
+ /* if the current directory is invalid AND it is a file ... */
+ if( lp->ddb_create_error && FS_GetBlockType( tape_dblk_ptr ) == FDB_ID ) {
+
+ /* ... but skip the data and log it not found ... */
+ LP_SkipData( lp ) ;
+
+ LP_MsgBlkNotFound( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ return SUCCESS ;
+
+ }
+
+ /* do a verify info on the object to compare dates, attributes, sizes, etc for mismatch */
+ error = FS_VerObjInfo( fsh, tape_dblk_ptr );
+ switch( error ) {
+
+ case SUCCESS:
+ info_different_flag = FALSE ;
+
+ /* if it is a directory ... */
+ if( FS_GetBlockType( tape_dblk_ptr ) == DDB_ID ) {
+ lp->ddb_create_error = SUCCESS ;
+ }
+ break ;
+
+ case FS_COMM_FAILURE:
+
+ LP_MsgCommFailure( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ lp->curr_ddb,
+ tape_dblk_ptr,
+ 0L );
+
+ return (error) ;
+
+ case FS_INFO_DIFFERENT:
+ case FS_OS_ATTRIB_DIFFER:
+ info_different_flag = error ;
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == DDB_ID ) {
+ lp->ddb_create_error = SUCCESS;
+ }
+ break ;
+
+ case FS_NO_MORE:
+ case FS_NOT_FOUND:
+ LP_MsgBlkNotFound( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == DDB_ID ) {
+ lp->ddb_create_error = error ;
+ }
+
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ case FS_SKIP_OBJECT:
+ /* skip the data and log it not found ... */
+ LP_SkipData( lp ) ;
+
+ return SUCCESS ;
+
+ case FS_DEVICE_ERROR:
+ case FS_ACCESS_DENIED:
+ default:
+ LP_MsgLogDifference( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb, 0L, error ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos,
+ FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ /* skip the data and log it inaccessable ... */
+ LP_SkipData( lp ) ;
+
+ return SUCCESS ;
+
+ }
+
+ /* special IDB logic */
+ if( FS_GetBlockType( tape_dblk_ptr ) == IDB_ID ) {
+ if( info_different_flag ) {
+ LP_MsgBlkDifferent( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, &disk_dblk, (info_different_flag == FS_OS_ATTRIB_DIFFER), error ) ;
+ LP_MsgLogDifference( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb, 0L, LP_DATA_VERIFIED ) ;
+
+ /* skip the data and log it inaccessable ... */
+ LP_SkipData( lp ) ;
+
+ return SUCCESS ;
+
+ }
+ }
+
+ error = FS_OpenObj( fsh, &hdl, tape_dblk_ptr, FS_VERIFY ) ;
+
+ LP_MsgLogBlock( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr ) ;
+
+ if( error != SUCCESS ) {
+
+ /* skip the data and log it ... */
+ LP_SkipData( lp ) ;
+
+ if ( error == FS_COMM_FAILURE ) {
+ LP_MsgCommFailure( pid,
+ bsd_ptr,
+ fsh,
+ &lp->tpos,
+ lp->curr_ddb,
+ tape_dblk_ptr,
+ 0L );
+
+ return (error) ;
+
+ }
+
+ if ( error == FS_INCOMPATIBLE_OBJECT ) {
+ LP_MsgBlkNotFound( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+
+ } else {
+ if ( error != FS_SKIP_OBJECT ) {
+
+ if( info_different_flag ) {
+ LP_MsgBlkDifferent( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, &disk_dblk, (info_different_flag == FS_OS_ATTRIB_DIFFER), error ) ;
+ }
+
+ LP_MsgLogDifference( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb, 0L, error ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+ }
+ }
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == IDB_ID ) {
+
+ LP_FinishedOper( lp ) ;
+ return( error ) ;
+
+ } else {
+ return SUCCESS ;
+
+ }
+
+ } else {
+
+ /* verify the object here */
+ if ( !lp->ignore_data_for_ddb ) {
+ buffer_used_size = lp->initial_tape_buf_used ;
+
+ /* get initial data */
+ if( ( error = LP_ReceiveData( lp, (UINT32)buffer_used_size ) ) != ABORT_OPERATION ) {
+ tape_data_buf = lp->rr.buff_ptr ;
+ very_size = lp->rr.buff_size ;
+ }
+ }
+
+ while( !lp->ignore_data_for_ddb && !error && lp->rr.tf_message == TRR_DATA ) {
+
+ read_size = very_size;
+#ifdef TDEMO
+ if ( (FAST_TDEMO & BEC_GetSpecialWord( cfg )) == 0 ) {
+ sleep( (UINT32) (very_size / 130) );
+ }
+ error = SUCCESS ;
+#else
+ error = FS_VerifyObj( hdl, lp->very_buff, tape_data_buf, &very_size, &blk_size, &lp->rr.stream ) ;
+#endif
+ amount_verified = U64_Add( amount_verified, U64_Init( very_size, 0 ), &math_status ) ;
+
+ if( error == FS_DONT_WANT_STREAM ) {
+ LP_SkipStream( lp ) ;
+ error = SUCCESS ;
+
+ } else if( error != SUCCESS ) {
+ LP_MsgBlkDifferent( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, &disk_dblk, FALSE, error ) ;
+ LP_MsgLogDifference( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb,
+ lp->current_stream_id, error ) ;
+ LP_MsgBlockSkipped( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb ) ;
+ LP_MsgBytesSkipped( pid, bsd_ptr, fsh, &lp->tpos, FS_GetDisplaySizeFromDBLK( fsh, tape_dblk_ptr ) ) ;
+
+ if( FS_GetBlockType( tape_dblk_ptr ) == IDB_ID ) {
+ LP_FinishedOper( lp ) ;
+ FS_CloseObj( hdl ) ;
+ return( SUCCESS ) ;
+
+ }
+
+ } else {
+ if( FS_GetBlockType( tape_dblk_ptr ) == IDB_ID ) {
+ /* let's lie about the number of bytes processed ( so that we can handle 2.5 images ) */
+ /* the msg handlers must know that we are lying */
+#ifdef TDEMO
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, amount_verified ) ;
+#else
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, U64_Init(FS_GetObjPosition( hdl ),0) ) ;
+#endif
+ } else {
+ LP_MsgBytesProcessed( pid, bsd_ptr, fsh, &lp->tpos, U64_Init(very_size, 0) ) ;
+ }
+
+ if ( tape_data_buf == lp->rr.buff_ptr ) { /* INT8 = UINT8, cast or change UINT8, Error??? TIMN */
+ buffer_used_size = very_size ;
+ }
+
+ if ( ( read_size != very_size ) &&
+ ( (UINT16)(read_size - very_size) < blk_size ) ) {
+
+ if ( frag_ptr->memory_allocated < blk_size ) {
+
+ free( frag_ptr->buffer ) ;
+
+ frag_ptr->buffer = calloc( 1, blk_size ) ;
+ if( frag_ptr->buffer == NULL ) {
+#ifndef TDEMO
+ FS_CloseObj( hdl ) ;
+#endif
+ LP_FinishedOper( lp ) ;
+ return OUT_OF_MEMORY ;
+ }
+
+ frag_ptr->memory_allocated = blk_size ;
+ }
+
+ frag_ptr->buffer_used = read_size - very_size ;
+ memcpy( frag_ptr->buffer, tape_data_buf + very_size,
+ frag_ptr->buffer_used ) ;
+ buffer_used_size = read_size ;
+ }
+ }
+
+ if ( !error ) {
+ /* get more data */
+ error = LP_ReceiveData( lp, (UINT32)buffer_used_size ) ;
+
+ if ( ( error != ABORT_OPERATION) && ( frag_ptr->buffer_used != 0 ) ) {
+
+ if ( lp->rr.buff_size < (UINT16)(blk_size - frag_ptr->buffer_used) ) {
+ memcpy( frag_ptr->buffer + frag_ptr->buffer_used, lp->rr.buff_ptr,
+ lp->rr.buff_size ) ;
+ frag_ptr->buffer_used += lp->rr.buff_size ;
+ buffer_used_size = lp->rr.buff_size ;
+ very_size = 0 ;
+
+ } else {
+ memcpy( frag_ptr->buffer + frag_ptr->buffer_used, lp->rr.buff_ptr,
+ blk_size - frag_ptr->buffer_used ) ;
+ tape_data_buf = frag_ptr->buffer ;
+ very_size = blk_size ;
+ buffer_used_size = blk_size - frag_ptr->buffer_used ;
+ frag_ptr->buffer_used = 0 ;
+ }
+
+ } else {
+ very_size = lp->rr.buff_size ;
+ tape_data_buf = lp->rr.buff_ptr ; /* INT8 = UINT8, cast or change UINT8, Error??? TIMN */
+ }
+ }
+
+ /* check for abort conditions */
+ switch( LP_GetAbortFlag( lp->lis_ptr ) ) {
+
+ case CONTINUE_PROCESSING:
+ break ;
+
+ case ABORT_CTRL_BREAK:
+ LP_MsgError( pid, bsd_ptr, fsh, &lp->tpos, LP_USER_ABORT_ERROR, NULL, NULL, 0L ) ;
+
+ /* falling through */
+
+ case ABORT_PROCESSED:
+ case ABORT_AT_EOM:
+ error = USER_ABORT ;
+ break ;
+ }
+ }
+
+ FS_CloseObj( hdl ) ;
+
+ }
+
+ if( ( error == SUCCESS ) && ( FS_GetBlockType( tape_dblk_ptr ) != IDB_ID ) ) {
+
+ if( info_different_flag ) {
+ LP_MsgBlkDifferent( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, &disk_dblk, (info_different_flag == FS_OS_ATTRIB_DIFFER), error ) ;
+ LP_MsgLogDifference( pid, bsd_ptr, fsh, &lp->tpos, tape_dblk_ptr, lp->curr_ddb, LP_DATA_VERIFIED, error ) ;
+ }
+
+ } else if( error == ABORT_OPERATION ) {
+
+ return( error ) ;
+
+ } else if( error != USER_ABORT ) {
+
+ /* skip the data but do not log it as skipped since the attempt to verify was performed */
+ LP_SkipData( lp ) ;
+
+ return SUCCESS ;
+
+ }
+
+ return( error ) ;
+
+}
+
+
diff --git a/private/utils/ntbackup/src/viewproc.c b/private/utils/ntbackup/src/viewproc.c
new file mode 100644
index 000000000..245c86b07
--- /dev/null
+++ b/private/utils/ntbackup/src/viewproc.c
@@ -0,0 +1,460 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+RCG
+
+ Name: viewproc.c
+
+ Description: This file contains the functions for processing messages
+ sent by Windows to a View class window.
+
+
+ The following routines are in this module:
+
+ WM_ViewWndProc
+
+ $Log: G:/UI/LOGFILES/VIEWPROC.C_V $
+
+ Rev 1.11 14 Jan 1993 16:22:38 DAVEV
+chg LPLONG to INT32_PTR
+
+ Rev 1.10 01 Nov 1992 16:10:06 DAVEV
+Unicode changes
+
+ Rev 1.9 14 Oct 1992 15:46:10 GLENN
+Added some.h
+
+ Rev 1.8 04 Oct 1992 19:41:30 DAVEV
+Unicode Awk pass
+
+ Rev 1.7 07 Jul 1992 15:41:46 MIKEP
+unicode changes
+
+ Rev 1.6 18 May 1992 09:00:50 MIKEP
+header
+
+ Rev 1.5 02 Apr 1992 16:25:18 ROBG
+Modified logic to change tabs to spaces on a view log file.
+
+ Rev 1.4 24 Mar 1992 10:36:02 ROBG
+Added logic to use system colors when displaying text.
+
+ Rev 1.3 12 Mar 1992 11:37:42 ROBG
+changed
+
+ Rev 1.2 10 Mar 1992 08:19:52 ROBG
+changed
+
+ Rev 1.1 09 Mar 1992 15:57:26 ROBG
+changed
+
+ Rev 1.0 09 Mar 1992 15:49:16 ROBG
+Initial Release
+
+
+
+/******************************************************************************
+
+ Name: WM_ViewWndProc()
+
+ Description: This function is called internally by Windows when events
+ occur relating to the log view MDI document windows.
+
+ Returns: NULL or a default message handler's return code.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static VOID WM_SetUpScrolls ( HWND hWnd, DLM_LOGITEM_PTR pDlm ) ;
+
+
+WINRESULT APIENTRY WM_ViewWndProc (
+
+register HWND hWnd, // I - window handle of the list box
+ MSGID msg, // I - message
+register MP1 mp1, // I - another message parameter
+ MP2 mp2) // I - yet another message parameter
+
+{
+
+ PDS_WMINFO pInfoPtr ;
+ DLM_LOGITEM_PTR pDlm ;
+ HWND hParent ;
+
+
+
+ hParent = GetParent( hWnd ) ;
+
+ pInfoPtr = WM_GetInfoPtr( hWnd ) ;
+ pInfoPtr = WM_GetInfoPtr( hParent ) ;
+
+ if ( pInfoPtr ) {
+ pDlm = (DLM_LOGITEM_PTR) WMDS_GetAppInfo( pInfoPtr ) ;
+ }
+
+ // Both memory areas must exist.
+
+ if ( !pInfoPtr || !pDlm ) {
+ return DefWindowProc (hWnd, msg, mp1, mp2 ) ;
+ }
+
+ switch (msg) {
+
+ case WM_CREATE: { /* Begin of Block */
+
+ HDC hDC ;
+ TEXTMETRIC tm ;
+ HANDLE hSaveObject ;
+
+ hDC = GetDC ( hWnd ) ;
+
+ hSaveObject = SelectObject( hDC, L_GetFont( pDlm ) ) ;
+
+ GetTextMetrics (hDC, &tm) ;
+
+ L_SetCharWidth ( pDlm, tm.tmAveCharWidth ) ;
+ L_SetCharWidthCaps( pDlm, (tm.tmPitchAndFamily & 1 ? 3 : 2) * L_GetCharWidth( pDlm ) / 2 ) ;
+ L_SetCharHeight ( pDlm, tm.tmHeight + tm.tmExternalLeading ) ;
+
+ SelectObject( hDC, hSaveObject ) ;
+
+ ReleaseDC (hWnd, hDC ) ;
+
+ L_SetMaxWidth ( pDlm, L_GetMaxWidth( pDlm ) * 2 * L_GetCharWidth( pDlm ) ) ;
+
+ return(0) ;
+
+ } /* End of Block */
+
+
+ case WM_SIZE:
+
+ L_SetClientHeight( pDlm, HIWORD (mp2) ) ;
+ L_SetClientWidth ( pDlm , LOWORD (mp2) ) ;
+
+ WM_SetUpScrolls( hWnd, pDlm ) ;
+
+ return(0) ;
+
+
+ case WM_VSCROLL: { /* Begin of Block */
+
+ INT nVscrollInc ;
+
+ switch (mp1) {
+
+ case SB_TOP:
+ nVscrollInc = -L_GetVscrollPos( pDlm ) ;
+ break ;
+
+ case SB_BOTTOM:
+ nVscrollInc = L_GetVscrollMax( pDlm ) - L_GetVscrollPos( pDlm ) ;
+ break ;
+
+ case SB_LINEUP:
+ nVscrollInc = -1 ;
+ break ;
+
+ case SB_LINEDOWN:
+ nVscrollInc = 1 ;
+ break ;
+
+ case SB_PAGEUP:
+ nVscrollInc = min (-1, -(L_GetClientHeight( pDlm ) ) / L_GetCharHeight( pDlm ) ) ;
+ break ;
+
+ case SB_PAGEDOWN:
+ nVscrollInc = max (1, L_GetClientHeight ( pDlm ) / L_GetCharHeight( pDlm ) ) ;
+ break ;
+
+ case SB_THUMBTRACK:
+ nVscrollInc = LOWORD (mp2) - L_GetVscrollPos( pDlm ) ;
+ break ;
+
+ default:
+ nVscrollInc = 0 ;
+ }
+
+ if ( nVscrollInc = max (-L_GetVscrollPos( pDlm ),
+ min ( nVscrollInc, L_GetVscrollMax( pDlm ) - L_GetVscrollPos( pDlm )))) {
+
+ L_SetVscrollPos( pDlm , L_GetVscrollPos( pDlm) + nVscrollInc ) ;
+ ScrollWindow (hWnd, 0, -(L_GetCharHeight( pDlm )) * nVscrollInc, NULL, NULL) ;
+ SetScrollPos (hWnd, SB_VERT, L_GetVscrollPos( pDlm ), TRUE) ;
+ UpdateWindow (hWnd) ;
+ }
+
+ return (0) ;
+
+ } /* End of Block */
+
+
+
+ case WM_HSCROLL: { /* Begin of Block */
+
+ INT nHscrollInc ;
+
+ switch (mp1) {
+
+ case SB_LINEUP:
+ nHscrollInc = -1 ;
+ break ;
+
+ case SB_LINEDOWN:
+ nHscrollInc = 1 ;
+ break ;
+
+ case SB_PAGEUP:
+ nHscrollInc = -(L_GetCharWidth( pDlm ) );
+ break ;
+
+ case SB_PAGEDOWN:
+ nHscrollInc = L_GetCharWidth( pDlm ) ;
+ break ;
+
+ case SB_THUMBPOSITION:
+ nHscrollInc = LOWORD (mp2) - L_GetHscrollPos( pDlm ) ;
+ break ;
+
+ default:
+ nHscrollInc = 0 ;
+ }
+
+ if (nHscrollInc = max (-L_GetHscrollPos( pDlm ),
+ min (nHscrollInc, L_GetHscrollMax( pDlm ) - L_GetHscrollPos( pDlm )))) {
+
+ L_SetHscrollPos( pDlm, L_GetHscrollPos( pDlm) + nHscrollInc ) ;
+ ScrollWindow (hWnd, -(L_GetCharWidth( pDlm ) * nHscrollInc), 0, NULL, NULL) ;
+ SetScrollPos (hWnd, SB_HORZ, L_GetHscrollPos( pDlm ), TRUE) ;
+ }
+
+ return (0) ;
+
+ } /* End of Block */
+
+ case WM_KEYDOWN:
+
+ if ( HM_KeyDown ( hWnd, mp1 ) ) {
+ return(0) ;
+ }
+
+ switch (mp1) {
+
+ case VK_HOME:
+ SendMessage (hWnd, WM_VSCROLL, SB_TOP, 0L) ;
+ break ;
+
+ case VK_END:
+ SendMessage (hWnd, WM_VSCROLL, SB_BOTTOM, 0L) ;
+ break ;
+
+ case VK_PRIOR:
+ SendMessage (hWnd, WM_VSCROLL, SB_PAGEUP, 0L) ;
+ break ;
+
+ case VK_NEXT:
+ SendMessage (hWnd, WM_VSCROLL, SB_PAGEDOWN, 0L) ;
+ break ;
+
+ case VK_UP:
+ SendMessage (hWnd, WM_VSCROLL, SB_LINEUP, 0L) ;
+ break ;
+
+ case VK_DOWN:
+ SendMessage (hWnd, WM_VSCROLL, SB_LINEDOWN, 0L) ;
+ break ;
+
+ case VK_LEFT:
+ SendMessage (hWnd, WM_HSCROLL, SB_PAGEUP, 0L) ;
+ break ;
+
+ case VK_RIGHT:
+ SendMessage (hWnd, WM_HSCROLL, SB_PAGEDOWN, 0L) ;
+ break ;
+ }
+ return (0) ;
+
+
+ case WM_PAINT: { /* Begin Block */
+
+ HDC hDC ;
+ INT i ;
+ INT y ;
+ INT x ;
+ INT nPaintBeg ;
+ INT nPaintEnd ;
+ INT nBlock ;
+ INT nRec ;
+ INT32_PTR pBlock ;
+ HANDLE hSaveObject ;
+ PAINTSTRUCT ps ;
+ LPSTR pszBuffer ;
+ LPSTR pStr ;
+ CHAR szLineNo[ 30 ] ;
+ INT nOffset ;
+
+ L_SetFilePtr ( pDlm, UNI_fopen ( L_GetFileName( pDlm ), _O_RDONLY ) ) ;
+
+ if ( L_GetFilePtr( pDlm ) == NULL ) {
+
+ // Problem opening log file .
+
+ CHAR szFormat[ MAX_UI_RESOURCE_SIZE ] ;
+ CHAR szString[ MAX_UI_RESOURCE_SIZE ] ;
+
+ RSM_StringCopy( IDS_CANTOPEN, szFormat, MAX_UI_RESOURCE_LEN ) ;
+ wsprintf( szString, szFormat, L_GetFileName( pDlm ) );
+ WM_MsgBox( ID(IDS_LOGVIEWMINWINDOWNAME), szString,
+ (WORD)WMMB_OK, (WORD)WMMB_ICONINFORMATION ) ;
+ return( 0 ) ;
+ }
+
+
+ hDC = BeginPaint (hWnd, &ps) ;
+
+ nPaintBeg = max (0, L_GetVscrollPos( pDlm ) + ps.rcPaint.top / L_GetCharHeight( pDlm ) - 1) ;
+ nPaintEnd = min ( (INT) L_GetTrackMax( pDlm ),
+ L_GetVscrollPos( pDlm ) + ps.rcPaint.bottom / L_GetCharHeight( pDlm ) ) ;
+
+ L_SetPaintBeg( pDlm, nPaintBeg ) ;
+ L_SetPaintEnd( pDlm, nPaintEnd ) ;
+
+ // Set Font.
+
+ hSaveObject = SelectObject( hDC, L_GetFont( pDlm ) );
+
+ pszBuffer = L_GetBuffer( pDlm ) ;
+ nOffset = L_GetCharWidth( pDlm ) ;
+
+ SetBkColor ( hDC, gColorBackGnd ) ;
+ SetTextColor( hDC, gColorForeGnd ) ;
+
+ for (i = nPaintBeg ; i < nPaintEnd ; i++) {
+
+ x = L_GetCharWidth ( pDlm ) * (1 - L_GetHscrollPos( pDlm )) ;
+ y = L_GetCharHeight( pDlm ) * (1 - L_GetVscrollPos( pDlm ) + i) ;
+
+ if ( i < LOG_NUMHEADERLINES ) {
+
+ LOG_GetViewHdrLine( pDlm, i, pszBuffer ) ;
+
+ strcpy( szLineNo, TEXT(" ") ) ;
+ TextOut ( hDC, x, y, szLineNo, strlen( szLineNo ) ) ;
+ TextOut ( hDC, x+10*nOffset, y , pszBuffer, strlen( pszBuffer ) ) ;
+ continue ;
+ }
+
+ nBlock = i / L_GetRecsPerBlock( pDlm ) ;
+ nRec = i % L_GetRecsPerBlock( pDlm ) ;
+
+ pBlock = L_GetBlockPtr( pDlm, nBlock ) ;
+
+ fseek ( L_GetFilePtr( pDlm ),*(pBlock+nRec), SEEK_SET ) ;
+
+ fgets( pszBuffer, (L_GetMaxStringLen( pDlm )-1), L_GetFilePtr( pDlm ) ) ;
+
+ // Get rid of CR, new pages, and end-of-file markers.
+
+ if ( pStr = strrchr( pszBuffer, 0x0d )) *pStr = 0 ;
+ if ( pStr = strrchr( pszBuffer, 0x0c )) *pStr = TEXT(' ') ;
+ if ( pStr = strrchr( pszBuffer, 0x1a )) *pStr = TEXT(' ') ;
+
+ // Change all tabs to spaces
+
+ while ( pStr = strrchr( pszBuffer, 0x09 ) ) {
+ *pStr = TEXT(' ') ;
+ }
+
+ wsprintf(szLineNo, TEXT("%5d "), i+1-LOG_NUMHEADERLINES );
+
+ TextOut ( hDC, x, y, szLineNo, strlen( szLineNo ) ) ;
+
+ TextOut ( hDC, x+10*nOffset, y , pszBuffer, strlen( pszBuffer ) ) ;
+
+ }
+
+ SelectObject( hDC, hSaveObject ) ;
+
+ if ( L_GetFilePtr( pDlm ) ) {
+ fclose( L_GetFilePtr( pDlm ) ) ;
+ L_SetFilePtr( pDlm, NULL ) ;
+ }
+
+
+ EndPaint (hWnd, &ps) ;
+ return (0) ;
+
+ } /* End Block */
+
+ case WM_LBUTTONDOWN:
+
+ if ( HM_ContextLbuttonDown( hWnd, mp1, mp2 ) == TRUE ) {
+ return (0) ;
+ }
+
+ break ;
+
+ case WM_SETCURSOR: /* Begin of Block */
+
+ // In help mode it is necessary to reset the cursor in response
+ // to every WM_SETCURSOR message.Otherwise, by default, Windows
+ // will reset the cursor to that of the window class.
+
+ if ( HM_SetCursor( hWnd ) == TRUE ) {
+ return (0) ;
+ }
+ default :
+ break ;
+ }
+
+ return DefWindowProc (hWnd, msg, mp1, mp2) ;
+
+}
+
+
+
+
+static VOID WM_SetUpScrolls (
+
+HWND hWnd ,
+DLM_LOGITEM_PTR pDlm )
+
+{
+
+ L_SetHscrollMax( pDlm, max (0, 2 + (L_GetMaxWidth( pDlm ) - L_GetClientWidth( pDlm )) / L_GetCharWidth( pDlm ) ) );
+
+ // See if the parent window is maximized.
+
+ if ( WM_IsMaximized( GetParent( hWnd ) ) ) {
+
+ // Set Window to the left most position.
+
+ L_GetHscrollPos( pDlm ) = 0 ;
+
+ // Erase the background of the parent.
+
+ InvalidateRect( GetParent( hWnd), NULL, TRUE ) ;
+
+ }
+
+ L_SetHscrollPos( pDlm, min (L_GetHscrollPos( pDlm ), L_GetHscrollMax( pDlm ) ) ) ;
+
+ SetScrollRange (hWnd, SB_HORZ, 0, L_GetHscrollMax( pDlm ), FALSE) ;
+ SetScrollPos (hWnd, SB_HORZ, L_GetHscrollPos( pDlm ), TRUE) ;
+
+ // Vertical Settings
+
+ L_SetVscrollMax( pDlm , max (0, L_GetTrackMax( pDlm ) + 2 + LOG_NUMHEADERLINES - L_GetClientHeight( pDlm ) / L_GetCharHeight( pDlm ) ) ) ;
+ L_SetVscrollPos( pDlm , min (L_GetVscrollPos( pDlm ), L_GetVscrollMax( pDlm )) ) ;
+
+ SetScrollRange (hWnd, SB_VERT, 0, L_GetVscrollMax( pDlm ), FALSE) ;
+ SetScrollPos (hWnd, SB_VERT, L_GetVscrollPos( pDlm ), TRUE) ;
+
+}
+
+
diff --git a/private/utils/ntbackup/src/vlm_bset.c b/private/utils/ntbackup/src/vlm_bset.c
new file mode 100644
index 000000000..9f04aa21e
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_bset.c
@@ -0,0 +1,2797 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_BSET.C
+
+ Description:
+
+ This file contains most of the code for processing the BSETS
+ window and lists.
+
+ $Log: G:\UI\LOGFILES\VLM_BSET.C_V $
+
+ Rev 1.85.1.2 31 Jan 1994 17:01:02 Glenn
+Now setting UI catalog button when catalogging an unknown BSET.
+
+ Rev 1.85.1.1 08 Dec 1993 11:19:06 MikeP
+deep pathes and unicode support
+
+ Rev 1.85 29 Jul 1993 16:02:38 MIKEP
+support sms sets
+
+ Rev 1.84 19 Jul 1993 21:12:04 MIKEP
+support ecc sets
+
+ Rev 1.83 13 Jul 1993 10:19:40 MIKEP
+start fixing MAX_SIZE vs MAX_LEN problems
+
+ Rev 1.82 14 Jun 1993 21:00:22 MIKEP
+enable c++
+
+ Rev 1.81 04 Jun 1993 10:50:58 GLENN
+Now setting the focus to the runtime dialog after a real catalog.
+
+ Rev 1.80 24 May 1993 15:21:58 BARRY
+Unicode fixes.
+
+ Rev 1.79 23 May 1993 14:50:42 MIKEP
+Fix epr's 357-0315 and 357-341.
+
+ Rev 1.78 21 May 1993 13:44:28 GLENN
+Fixed hard coded text strings.
+
+ Rev 1.77 06 May 1993 13:52:50 MIKEP
+Fix size display of 0 byte sets. Not needed for nostraddamus
+but won't make any differenece if taken.
+
+ Rev 1.76 26 Apr 1993 08:52:16 MIKEP
+Add numerous changes to fully support the font case selection
+for various file system types. Also add refresh for tapes window
+and sorting of tapes window.
+
+ Rev 1.74 16 Apr 1993 13:53:28 MIKEP
+fix for 1K sets again
+
+ Rev 1.73 11 Apr 1993 13:03:40 MIKEP
+ fix display size for sets < 1K
+
+ Rev 1.72 05 Apr 1993 16:59:50 chrish
+Added one line "gbCurrentOperation = OPERATION_CATALOG" for CAYMAN NT.
+
+
+
+ Rev 1.71 17 Mar 1993 16:04:52 chrish
+Added one liner to set gbCurrentOperation flag where we are coming from.
+
+ Rev 1.70 17 Mar 1993 15:28:14 DARRYLP
+EPR fix for 357-0041, pretty text in display windows.
+
+ Rev 1.69 13 Mar 1993 18:41:00 MIKEP
+fix bset size display
+
+ Rev 1.68 10 Mar 1993 13:26:50 MIKEP
+fix to display set size
+
+ Rev 1.67 09 Mar 1993 11:34:04 MIKEP
+fix to display set #, if no set name
+
+ Rev 1.66 23 Feb 1993 12:42:48 ROBG
+Added "Cataloging the tape..." when double clicking on a save-set
+in Tapes Window.
+
+ Rev 1.65 20 Jan 1993 21:38:12 MIKEP
+floppy support
+
+ Rev 1.64 06 Jan 1993 10:52:16 MIKEP
+remove set size for msoft
+
+ Rev 1.62 14 Dec 1992 12:24:10 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.61 24 Nov 1992 21:02:32 MIKEP
+fix bug with multitape set display
+
+ Rev 1.60 17 Nov 1992 20:00:56 MIKEP
+add unformat display
+
+ Rev 1.59 11 Nov 1992 16:35:16 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.58 01 Nov 1992 16:10:30 DAVEV
+Unicode changes
+
+ Rev 1.57 20 Oct 1992 14:32:08 MIKEP
+changes for otc
+
+ Rev 1.56 12 Oct 1992 13:24:40 MIKEP
+cataloging a set fix
+
+ Rev 1.55 09 Oct 1992 13:30:34 MIKEP
+add daily copy backup type
+
+ Rev 1.54 09 Oct 1992 12:56:56 MIKEP
+catalog a set changes for NT
+
+ Rev 1.53 07 Oct 1992 15:02:24 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.52 04 Oct 1992 19:41:36 DAVEV
+Unicode Awk pass
+
+ Rev 1.51 02 Sep 1992 21:25:50 CHUCKB
+Added Mike P.'s changes from Microsoft, Part II.
+
+ Rev 1.50 17 Aug 1992 13:25:06 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.49 04 Aug 1992 11:43:04 MIKEP
+chnage .. to /
+
+ Rev 1.48 03 Aug 1992 19:37:48 MIKEP
+multitape changes for NT
+
+ Rev 1.47 29 Jul 1992 09:42:14 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.46 22 Jul 1992 10:18:00 MIKEP
+warning fixes
+
+ Rev 1.45 10 Jul 1992 08:34:56 JOHNWT
+more gas guage work
+
+ Rev 1.44 08 Jul 1992 15:35:04 STEVEN
+Unicode BE changes
+
+ Rev 1.43 30 Jun 1992 13:18:56 JOHNWT
+dynamically alloc stats
+
+ Rev 1.42 29 Jun 1992 10:43:42 JOHNWT
+added selected dir counts
+
+ Rev 1.41 19 Jun 1992 14:44:20 JOHNWT
+more gas
+
+ Rev 1.40 14 May 1992 18:06:00 MIKEP
+nt pass 2
+
+ Rev 1.39 11 May 1992 09:13:38 MIKEP
+64Bit support
+
+ Rev 1.38 06 May 1992 14:41:42 MIKEP
+unicode pass two
+
+ Rev 1.37 04 May 1992 13:38:58 MIKEP
+unicode pass 1
+
+ Rev 1.36 23 Apr 1992 09:47:12 MIKEP
+fix null poinmter access
+
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// the number of items displayed in the bsets window for each bset
+
+#ifndef OEM_MSOFT
+#define BSET_NUM_DISPLAY_ITEMS 10
+#else
+#define BSET_NUM_DISPLAY_ITEMS 9
+#endif
+
+
+// The max number of characters displayed for the kbytes in a set
+
+#define MAX_BSET_KBYTES_SIZE 20
+
+
+// Static local function prototypes.
+
+static BYTE VLM_BsetGetSelect( BSET_OBJECT_PTR );
+static VOID_PTR VLM_BsetSetTag( BSET_OBJECT_PTR, BYTE );
+static BYTE VLM_BsetGetTag( BSET_OBJECT_PTR );
+static USHORT VLM_BsetGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_BsetGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_BsetGetPrevItem( BSET_OBJECT_PTR );
+static VOID_PTR VLM_BsetGetNextItem( BSET_OBJECT_PTR );
+static VOID_PTR VLM_BsetGetObjects( BSET_OBJECT_PTR );
+
+static BSET_OBJECT_PTR VLM_CreateBSET( INT, INT, INT, INT, INT, INT, INT, INT, INT, INT );
+static VOID VLM_SetBsetStringMaxValues( TAPE_OBJECT_PTR, BSET_OBJECT_PTR );
+static BOOLEAN VLM_SetBsetFlags( BSET_OBJECT_PTR, QTC_BSET_PTR, BOOLEAN, INT16 );
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_FillInBSD( BSD_PTR bsd_ptr )
+{
+ BSET_OBJECT_PTR bset;
+ TAPE_OBJECT_PTR tape;
+ UINT32 tape_fid;
+ INT16 bset_num;
+
+ if ( bsd_ptr == NULL ) {
+ return;
+ }
+
+ tape_fid = BSD_GetTapeID( bsd_ptr );
+ bset_num = BSD_GetSetNum( bsd_ptr );
+
+ bset = NULL;
+ tape = VLM_GetFirstTAPE( );
+
+ while ( bset == NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == bset_num ) {
+ break;
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+ }
+
+ if ( bset == NULL ) {
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ }
+
+ BSD_SetTapeLabel( bsd_ptr, (INT8_PTR)TAPE_GetName( tape ),
+ (INT16)strsize(TAPE_GetName( tape )) );
+ BSD_SetBackupLabel( bsd_ptr, (INT8_PTR)BSET_GetName( bset ),
+ (INT16)strsize(BSET_GetName(bset)) );
+ BSD_SetBackupDescript( bsd_ptr, (INT8_PTR)BSET_GetName( bset ),
+ (INT16)strsize(BSET_GetName(bset)) );
+ BSD_SetUserName( bsd_ptr, (INT8_PTR)BSET_GetUserName( bset ),
+ (INT16)strsize(BSET_GetUserName( bset )) );
+}
+
+
+
+/*********************
+
+ Name: VLM_FindBset
+
+ Description: Get the backup set.
+
+ Returns:
+
+**********************/
+
+BSET_OBJECT_PTR VLM_FindBset(
+UINT32 tape_fid, // I - tape fid
+INT16 bset_num ) // I - bset number
+{
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( TAPE_GetFID( tape ) == tape_fid ) {
+
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ while ( bset != NULL ) {
+
+ if ( BSET_GetBsetNum( bset ) == bset_num ) {
+
+ return( bset ); // Return what they want
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ return( NULL );
+}
+
+
+/*********************
+
+ Name: VLM_GetBsetName
+
+ Description: Get the name of a backup set.
+
+ Returns: Pointer to that name.
+
+**********************/
+
+CHAR_PTR VLM_GetBsetName(
+UINT32 tape_fid, // I - tape fid
+INT16 bset_num ) // I - bset number
+{
+ BSET_OBJECT_PTR bset;
+
+ bset = VLM_FindBset( tape_fid, bset_num );
+
+ if ( bset != NULL ) {
+ return( BSET_GetName( bset ) ); // Return what they want
+ }
+
+ return( NULL );
+}
+
+
+/*********************
+
+ Name: VLM_GetSortDate
+
+ Description: Get the date/time.
+
+ Returns: A pointer to the user name.
+
+**********************/
+
+
+VOID VLM_GetSortDate(
+UINT32 tape_fid, // I - tape fid
+INT16 bset_num, // I - bset number
+DATE_TIME_PTR sort_date )
+{
+ BSET_OBJECT_PTR bset;
+
+ bset = VLM_FindBset( tape_fid, bset_num );
+
+ if ( bset != NULL ) {
+ DateTimeDOS( bset->backup_date, bset->backup_time, sort_date );
+ }
+ else {
+ memset( sort_date, 0, sizeof( DATE_TIME ) );
+ }
+
+}
+
+
+/*********************
+
+ Name: VLM_GetUserName
+
+ Description: Get the user name string from a bset.
+
+ Returns: A pointer to the user name.
+
+**********************/
+
+
+CHAR_PTR VLM_GetUserName(
+UINT32 tape_fid, // I - tape fid
+INT16 bset_num ) // I - bset number
+{
+ BSET_OBJECT_PTR bset;
+
+ bset = VLM_FindBset( tape_fid, bset_num );
+
+ if ( bset != NULL ) {
+ return( BSET_GetUserName( bset ) );
+ }
+
+ return( NULL );
+}
+
+/*********************
+
+ Name: VLM_GetBackupDate
+
+ Description: Return the DOS format backup date.
+
+ Returns:
+
+**********************/
+
+UINT16 VLM_GetBackupDate(
+UINT32 tape_fid, // I - tape fid
+INT16 bset_num ) // I - bset number
+{
+ BSET_OBJECT_PTR bset;
+
+ bset = VLM_FindBset( tape_fid, bset_num );
+
+ if ( bset != NULL ) {
+ return( BSET_GetDate( bset ) );
+ }
+
+ return( (UINT16)0 );
+}
+
+
+
+/*********************
+
+ Name: VLM_GetBackupTime
+
+ Description: Return the DOS format backup time for a bset.
+
+ Returns:
+
+**********************/
+
+
+UINT16 VLM_GetBackupTime(
+UINT32 tape_fid, // I - tape fid
+INT16 bset_num ) // I - bset number
+{
+ BSET_OBJECT_PTR bset;
+
+ bset = VLM_FindBset( tape_fid, bset_num );
+
+ if ( bset != NULL ) {
+ return( BSET_GetTime( bset ) );
+ }
+
+ return( (UINT16)0 );
+}
+
+
+/*********************
+
+ Name: VLM_GetBackupType
+
+ Description: Return the backup type, defined in QTC.H
+
+ Returns:
+
+**********************/
+
+
+INT VLM_GetBackupType(
+UINT32 tape_fid, // I - tape fid
+INT16 bset_num ) // I - bset number
+{
+ BSET_OBJECT_PTR bset;
+
+ bset = VLM_FindBset( tape_fid, bset_num );
+
+ if ( bset != NULL ) {
+ return( BSET_GetBackupType( bset ) );
+ }
+
+ return( 0 );
+}
+
+
+
+/*********************
+
+ Name: VLM_RemoveBset
+
+ Description:
+
+ A backup set has been removed, through catalog maintenance or overwriting
+ a tape. This function is called to remove all references to the set from
+ the VLM area. It will close any windows that happen to be open from this
+ set, remove any BSD's, and call the search code to delete any references
+ to this set in the search results window.
+
+ Returns: Nothing.
+
+****************/
+
+VOID VLM_RemoveBset(
+UINT32 tape_fid, // I - the tape family id
+INT16 tape_num, // I - the tape number or -1
+INT16 bset_num,
+BOOLEAN UpdateScreen ) // I - the backup set number
+{
+ BSET_OBJECT_PTR bset;
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR temp_bset;
+ TAPE_OBJECT_PTR temp_tape;
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ BSD_PTR bsd;
+ APPINFO_PTR temp_appinfo;
+ WININFO_PTR temp_wininfo;
+ HWND win;
+
+
+ // Currently the UI does not support the removal of a single member
+ // of a tape family. When it does this param will be used.
+
+ DBG_UNREFERENCED_PARAMETER ( tape_num );
+
+ // See if tapes window has been created yet !
+
+ if ( gb_tapes_win == (HWND)NULL ) {
+ return;
+ }
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = (APPINFO_PTR)WM_GetAppPtr( gb_tapes_win );
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( TAPE_GetFID( tape ) == tape_fid ) {
+ break;
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ if ( tape == NULL ) {
+ return;
+ }
+
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ while ( bset != NULL ) {
+
+ if ( BSET_GetBsetNum( bset ) == bset_num ) {
+ break;
+ }
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ if ( bset != NULL ) {
+
+ if ( appinfo->open_tape->tape_fid == tape_fid ) {
+
+ temp_bset = VLM_GetPrevBSET( bset );
+
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMDELETEITEMS,
+ (LMHANDLE)temp_bset, 1 );
+ }
+ }
+
+ RemoveQueueElem( &TAPE_GetBsetQueue( tape ), &(bset->q_elem) );
+ free( bset );
+ }
+
+ if ( QueueCount( &TAPE_GetBsetQueue( tape ) ) == 0 ) {
+
+ /*
+ Remove this tape since no bsets are left.
+ If this was the active tape change it here !
+ */
+
+ temp_tape = VLM_GetPrevTAPE( tape );
+
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMDELETEITEMS,
+ (LMHANDLE)temp_tape, 0 );
+ }
+
+ RemoveQueueElem( WMDS_GetTreeList( wininfo ), &(tape->q_elem) );
+
+ if ( appinfo->open_tape == tape ) {
+
+ appinfo->open_tape = VLM_GetFirstTAPE( );
+
+ if ( appinfo->open_tape != NULL ) {
+
+ TAPE_SetStatus( appinfo->open_tape,
+ appinfo->open_tape->status | (UINT16)INFO_OPEN );
+ WMDS_SetFlatList( wininfo, &TAPE_GetBsetQueue( appinfo->open_tape ) );
+ }
+ else {
+ WMDS_SetFlatList( wininfo, NULL );
+ }
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)WMDS_GetFlatList( wininfo ), 0 );
+ }
+ }
+
+ free( tape );
+ }
+
+ // If any windows are open for this tape/bset then close them
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ temp_wininfo = WM_GetInfoPtr( win );
+
+ if ( WMDS_GetWinType( temp_wininfo ) == WMTYPE_TAPETREE ) {
+
+ temp_appinfo = (APPINFO_PTR)WM_GetAppPtr( win );
+
+ if ( ( temp_appinfo->tape_fid == tape_fid ) &&
+ ( temp_appinfo->bset_num == bset_num ) ) {
+
+ WM_Destroy( win );
+ break;
+ }
+ }
+ win = WM_GetNext( win );
+ }
+
+ // Remove the bsd from the tape_bsd_list for this tape/bset
+
+ bsd = BSD_FindByTapeID( tape_bsd_list, tape_fid, bset_num );
+
+ if ( bsd != NULL ) {
+ BSD_Remove( bsd );
+ }
+
+ // Remove any search results entries from this bset.
+
+ VLM_SearchRemoveSet( tape_fid, bset_num );
+
+}
+
+
+/**********************
+
+ NAME : VLM_GetFirstBSET
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+BSET_OBJECT_PTR VLM_GetFirstBSET( Q_HEADER_PTR qhdr )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ if ( qhdr == NULL ) {
+ return( NULL );
+ }
+
+ q_elem_ptr = QueueHead( qhdr );
+
+ if ( q_elem_ptr != NULL ) {
+ return( (BSET_OBJECT_PTR)q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : VLM_GetLastBSET
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+BSET_OBJECT_PTR VLM_GetLastBSET( Q_HEADER_PTR qhdr )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ if ( qhdr == NULL ) {
+ return( NULL );
+ }
+
+ q_elem_ptr = QueueTail( qhdr );
+
+ if ( q_elem_ptr != NULL ) {
+ return( (BSET_OBJECT_PTR)q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : VLM_GetNextBSET
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+BSET_OBJECT_PTR VLM_GetNextBSET( BSET_OBJECT_PTR bset_ptr )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueNext( &(bset_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return( (BSET_OBJECT_PTR)q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : VLM_GetPrevBSET
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+BSET_OBJECT_PTR VLM_GetPrevBSET( BSET_OBJECT_PTR bset_ptr )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueuePrev( &(bset_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return( (BSET_OBJECT_PTR)q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+
+/**********************
+
+ NAME : VLM_SetBsetStringMaxValues
+
+ DESCRIPTION :
+
+ The bset passed in is the new one, if it doesn't change anything, then
+ don't change all the others.
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_SetBsetStringMaxValues(
+TAPE_OBJECT_PTR tape,
+BSET_OBJECT_PTR new_bset )
+{
+ BSET_OBJECT_PTR bset;
+ BOOLEAN change = FALSE;
+ UINT max_name = 0;
+ UINT max_user = 0;
+ UINT max_date = 0;
+ UINT max_time = 0;
+ UINT max_set = 0;
+ UINT max_volume = 0;
+ UINT max_tape = 0;
+ UINT max_kbytes = 0;
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ if ( QueueCount( &tape->bset_list ) != 1 ) {
+
+ // Just see what they are all currently set to.
+
+ while ( bset->bset_num == new_bset->bset_num ) {
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ max_name = (UINT)bset->max_name;
+ max_user = (UINT)bset->max_user;
+ max_volume = (UINT)bset->max_volume;
+ max_date = (UINT)bset->max_date;
+ max_time = (UINT)bset->max_time;
+ max_set = (UINT)bset->max_set;
+ max_tape = (UINT)bset->max_tapes;
+ max_kbytes = (UINT)bset->max_kbytes;
+ }
+
+ if ( strlen( new_bset->name ) > max_name ) {
+ change = TRUE;
+ max_name = (UINT)strlen( new_bset->name );
+ }
+ if ( strlen( new_bset->user_name ) > max_user ) {
+ change = TRUE;
+ max_user = (UINT)strlen( new_bset->user_name );
+ }
+ if ( strlen( new_bset->volume_name ) > max_volume ) {
+ change = TRUE;
+ max_volume = (UINT)strlen( new_bset->volume_name );
+ }
+ if ( strlen( new_bset->date_str ) > max_date ) {
+ change = TRUE;
+ max_date = (UINT)strlen( new_bset->date_str );
+ }
+ if ( strlen( new_bset->time_str ) > max_time ) {
+ change = TRUE;
+ max_time = (UINT)strlen( new_bset->time_str );
+ }
+ if ( strlen( new_bset->bset_num_str ) > max_set ) {
+ change = TRUE;
+ max_set = (UINT)strlen( new_bset->bset_num_str );
+ }
+ if ( strlen( new_bset->tape_num_str ) > max_tape ) {
+ change = TRUE;
+ max_tape = (UINT)strlen( new_bset->tape_num_str );
+ }
+ if ( strlen( new_bset->kbytes_str ) > max_kbytes ) {
+ change = TRUE;
+ max_kbytes = (UINT)strlen( new_bset->kbytes_str );
+ }
+ // Note: For better looking listboxes, we will reset our spaces to
+ // 8 minimum for dates (MM-DD-YY(, and 11 for time (HH:MM:YY XM).
+
+ if (max_date < 8)
+ {
+ change = TRUE;
+ max_date = 8;
+ }
+ if (max_time < 11)
+ {
+ change = TRUE;
+ max_time = 11;
+ }
+ if (max_kbytes < 10)
+ {
+ change = TRUE;
+ max_kbytes = 10;
+ }
+ // Now we have the max sizes.
+
+ if ( change ) {
+
+ // Change the entire list.
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ bset->max_name = (UINT16) max_name;
+ bset->max_user = (UINT16) max_user;
+ bset->max_volume = (UINT16) max_volume;
+ bset->max_date = (UINT16) max_date;
+ bset->max_time = (UINT16) max_time;
+ bset->max_set = (UINT16) max_set;
+ bset->max_tapes = (UINT16) max_tape;
+ bset->max_kbytes = (UINT16) max_kbytes;
+
+ bset = VLM_GetNextBSET( bset );
+ }
+ }
+ else {
+ // Now set just the new guy.
+
+ new_bset->max_name = (UINT16) max_name;
+ new_bset->max_user = (UINT16) max_user;
+ new_bset->max_volume = (UINT16) max_volume;
+ new_bset->max_date = (UINT16) max_date;
+ new_bset->max_time = (UINT16) max_time;
+ new_bset->max_set = (UINT16) max_set;
+ new_bset->max_tapes = (UINT16) max_tape;
+ new_bset->max_kbytes = (UINT16) max_kbytes;
+ }
+}
+
+
+
+INT VLM_InsertTapeInQueue(
+Q_HEADER_PTR tape_list,
+TAPE_OBJECT_PTR tape )
+{
+ TAPE_OBJECT_PTR temp;
+
+ if ( ( tape == NULL ) || ( tape_list == NULL ) ) {
+ return( FAILURE );
+ }
+
+ if ( QueueCount( tape_list ) == 0 ) {
+ EnQueueElem( tape_list, &(tape->q_elem), FALSE );
+ return( SUCCESS );
+ }
+
+ if ( tape->fake_tape ) {
+
+ // Blank or foriegn tape, or tape drive busy/empty.
+ // Put it at the end.
+ EnQueueElem( tape_list, &(tape->q_elem), FALSE );
+ }
+ else {
+
+ // Insert alphabetically
+
+ temp = VLM_GetFirstTAPE( );
+
+ while ( temp ) {
+
+ if ( stricmp( FLM_GetName( tape ),
+ FLM_GetName( temp ) ) < 0 ) {
+ break;
+ }
+ temp = VLM_GetNextTAPE( temp );
+ }
+
+ if ( temp == NULL ) {
+ InsertElem( tape_list, QueueTail( tape_list ), &(tape->q_elem), AFTER );
+ }
+ else {
+ InsertElem( tape_list, &(temp->q_elem), &(tape->q_elem), BEFORE );
+ }
+ }
+
+ return( SUCCESS );
+}
+
+
+
+/*********************
+
+ Name: VLM_AddBset
+
+ Description:
+
+ The catalogs have added a new backup set and they are calling the VLM
+ to annouce its birth. If the tape exists then it will be added to it,
+ otherwise the tape will be added first.
+
+ It is also possible that the bset has been recataloged and only its
+ attributes have changed.
+
+ A third possibility is that the catalogs are telling us about another
+ piece of this set that is on another tape, ie. it spanned tapes.
+
+**********************/
+
+VOID VLM_AddBset(
+UINT32 tape_fid, // I
+INT16 tape_seq_num, // I
+INT16 bset_num, // I
+VOID_PTR init_qtc, // I
+BOOLEAN UpdateScreen ) // I
+{
+ BSET_OBJECT_PTR bset;
+ BSET_OBJECT_PTR temp_bset;
+ TAPE_OBJECT_PTR tape;
+ QTC_BSET_PTR qtc;
+ QTC_HEADER_PTR header = NULL;
+ QTC_HEADER_PTR qtc_header = NULL;
+ QTC_TAPE_PTR qtc_tape;
+ QTC_BSET_PTR qtc_bset;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ WININFO_PTR temp_wininfo;
+ APPINFO_PTR temp_appinfo;
+ INT16 last_seq_num;
+ UINT64 temp64;
+ UINT64 total64;
+ BOOLEAN u64_stat;
+ BOOLEAN changed = FALSE;
+ BOOLEAN ScreenNeedsUpdating = FALSE;
+ BOOLEAN make_new_tape_current = FALSE;
+ HWND win;
+ CHAR tape_name[ MAX_TAPE_NAME_SIZE ];
+ CHAR bset_name[ MAX_BSET_NAME_SIZE ];
+ CHAR tape_num_str[ MAX_BSET_NAME_SIZE ];
+ CHAR buffer[ VLM_BUFFER_SIZE ];
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR *unknown_kbytes_string = TEXT( " ?K" );
+ CHAR numeral[ MAX_UI_RESOURCE_SIZE ];
+
+
+ // The guy who called us had access to the actual qtc set pointer
+ // so he passed it to us to save look up time.
+
+ if ( init_qtc != NULL ) {
+ qtc = (QTC_BSET_PTR)init_qtc;
+ }
+ else {
+ qtc = QTC_FindBset( tape_fid, tape_seq_num, bset_num );
+ }
+
+ // Someone lied the set wasn't there.
+
+ if ( qtc == NULL ) {
+ return;
+ }
+
+ header = QTC_LoadHeader( qtc );
+ if ( header == NULL ) {
+ return;
+ }
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = (APPINFO_PTR)WM_GetAppPtr( gb_tapes_win );
+
+ // Look for the tape in our list
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+ break;
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ if ( tape == NULL ) {
+
+ // Add the tape first
+
+ if ( strlen( header->tape_name ) == 0 ) {
+
+ // Generate a tape name, must be DOS, OS/2 or NLM tape.
+
+ RSM_StringCopy( IDS_VLMTAPENAME, tape_name, MAX_TAPE_NAME_LEN );
+ }
+ else {
+ strncpy( tape_name, header->tape_name, MAX_TAPE_NAME_LEN );
+ tape_name[ MAX_TAPE_NAME_LEN ] = TEXT( '\0' );
+ }
+
+ tape = VLM_CreateTAPE( (INT16)((strlen( tape_name ) + 1) * sizeof(CHAR)) );
+ if ( tape == NULL ) {
+ return;
+ }
+
+ tape->tape_fid = tape_fid;
+ tape->tape_num = tape_seq_num;
+ tape->fake_tape = FALSE;
+ tape->status = INFO_DISPLAY;
+ tape->current = FALSE;
+ TAPE_SetXtraBytes( tape, wininfo );
+ TAPE_SetMultiTape( tape, FALSE );
+ TAPE_SetName( tape, tape_name );
+
+ if ( qtc->status & QTC_FLOPPY ) {
+ tape->status |= INFO_FLOPPY;
+ }
+
+ VLM_InsertTapeInQueue( WMDS_GetTreeList( wininfo ), tape );
+
+ // Add the new tape to the display.
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMADDITEMS,
+ (LMHANDLE)VLM_GetPrevTAPE( tape ), 1 );
+ }
+
+ // See if he is the only tape or the current tape is a fake tape.
+
+ if ( QueueCount( WMDS_GetTreeList( wininfo ) ) == 1 ) {
+
+ make_new_tape_current = TRUE;
+ }
+ else {
+
+ if ( appinfo->open_tape != NULL ) {
+
+ if ( appinfo->open_tape->fake_tape ) {
+ make_new_tape_current = TRUE;
+ }
+ }
+ }
+
+ if ( make_new_tape_current ) {
+
+ // Make him the open tape.
+
+ appinfo->open_tape = VLM_GetFirstTAPE( );
+
+ appinfo->open_tape->status |= INFO_OPEN;
+ wininfo->pFlatList = &appinfo->open_tape->bset_list;
+
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win, DLM_TREELISTBOX, WM_DLMUPDATEITEM,
+ (LMHANDLE)appinfo->open_tape, 0 );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)appinfo->open_tape );
+ }
+ }
+ }
+
+ // See if it's already in our list.
+
+ bset = VLM_GetLastBSET( &tape->bset_list );
+
+ if ( bset != NULL ) {
+
+ if ( bset->bset_num > bset_num ) {
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+ }
+ }
+
+ temp_bset = bset;
+
+ // Look for the backup set in our list
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == bset_num ) {
+ break;
+ }
+
+ if ( bset->bset_num > bset_num ) {
+ bset = NULL;
+ break;
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ temp_bset = bset;
+
+ }
+
+ do {
+
+ if ( header->tape_seq_num > 1 ) {
+ if ( ! TAPE_GetMultiTape( tape ) ) {
+ ScreenNeedsUpdating = TRUE;
+ }
+ TAPE_SetMultiTape( tape, TRUE );
+ }
+
+ if ( bset == NULL ) {
+
+ UI_IntToDate( buffer, (INT16)header->backup_date );
+ UI_IntToTime( &buffer[40], (UINT16)header->backup_time );
+
+ // Initialize with longest possible
+
+ RSM_StringCopy( IDS_VLMONTAPES, text, MAX_UI_RESOURCE_LEN );
+
+ sprintf( tape_num_str, text, 999, 999 );
+
+ // Add a new backup set
+
+ if ( ! strlen( header->bset_name ) ) {
+
+ RSM_StringCopy( IDS_VLMSETNUMBER, text, MAX_BSET_NAME_LEN );
+
+ sprintf( bset_name, text, bset_num );
+ }
+ else {
+ strncpy( bset_name, header->bset_name, MAX_BSET_NAME_LEN );
+ bset_name[ MAX_BSET_NAME_LEN ] = TEXT( '\0' );
+ }
+
+ bset = VLM_CreateBSET( (strlen( bset_name ) + 1) * sizeof(CHAR),
+ (INT16)header->user_name_size,
+ (INT16)header->volume_name_size,
+ (strlen( tape_num_str ) + 1 ) * sizeof(CHAR),
+ (strlen( buffer ) + 1) * sizeof(CHAR),
+ (strlen( &buffer[40] ) + 1) * sizeof(CHAR),
+ MAX_BSET_KBYTES_SIZE * sizeof(CHAR),
+ (INT16)max( header->tape_password_size,
+ header->bset_password_size),
+ header->OS_id,
+ header->OS_ver);
+
+ if ( bset == NULL ) {
+ return;
+ }
+
+ // Fill in the set name.
+
+ strcpy( bset->name, bset_name );
+
+ // Fill in size of the bset in kilobytes
+ // This doesn't handle crossing sets yet !
+
+ bset->total_bytes = U64_Init( header->num_bytes, header->num_bytes_msw );
+
+ U64_Litoa( bset->total_bytes, numeral, (INT16) 10, &u64_stat );
+
+ UI_BuildNumeralWithCommas( numeral );
+
+ if ( header->num_bytes_msw || header->num_bytes ) {
+
+
+ // Display a size for the set.
+
+ if ( strlen( numeral ) < 5 ) {
+ strcpy( numeral, TEXT( "1" ) );
+ }
+ else {
+ numeral[ strlen( numeral ) - 4 ] = TEXT( '\0' );
+ }
+
+ sprintf( bset->kbytes_str, TEXT( "%sK" ), numeral );
+
+ }
+ else {
+
+ if ( header->status & QTC_PARTIAL ) {
+ // We don't know how big it is.
+ strcpy( bset->kbytes_str, unknown_kbytes_string );
+ }
+ else {
+
+ // If its not partial and the byte count is really 0.
+ strcpy( bset->kbytes_str, TEXT( "0K" ) );
+ }
+ }
+
+ bset->status = INFO_DISPLAY;
+
+ BSET_SetBaseTape( bset, 0 );
+ BSET_SetFullMask( bset, 0 );
+ BSET_SetIncoMask( bset, 0 );
+ BSET_SetTapeMask( bset, 0 ); // Init for SetBsetFlags
+ BSET_SetNumTapes( bset, 0 );
+
+ VLM_SetBsetFlags( bset, qtc, FALSE, (INT16)0 );
+
+ msassert( bset->base_tape != 0 );
+
+ if ( header->OS_id == FS_NOV_SMS ) {
+ bset->status |= INFO_SMS;
+ }
+ if ( header->status & QTC_IMAGE ) {
+ bset->status |= INFO_IMAGE;
+ }
+ if ( header->status & QTC_FUTURE_VER ) {
+ }
+ if ( header->status & QTC_COMPRESSED ) {
+ bset->status |= INFO_COMPRESSED;
+ }
+ if ( header->status & QTC_ENCRYPTED ) {
+ bset->status |= INFO_ENCRYPTED;
+ }
+
+ bset->backup_time = (INT16)header->backup_time;
+ bset->backup_date = (INT16)header->backup_date;
+
+ if ( bset->num_tapes > 1 ) {
+ if ( ! TAPE_GetMultiTape( tape ) ) {
+ ScreenNeedsUpdating = TRUE;
+ }
+ TAPE_SetMultiTape( tape, TRUE );
+ RSM_StringCopy( IDS_VLMONTAPES, text, MAX_UI_RESOURCE_LEN );
+ sprintf( tape_num_str, text, bset->base_tape, bset->base_tape + bset->num_tapes - 1 );
+ }
+ else {
+ RSM_StringCopy( IDS_VLMONTAPE, text, MAX_UI_RESOURCE_LEN );
+ sprintf( tape_num_str, text, bset->base_tape );
+ }
+
+ BSET_SetTapeNumStr( bset, tape_num_str );
+ BSET_SetDateStr( bset, buffer );
+ BSET_SetTimeStr( bset, &buffer[40] );
+
+ RSM_StringCopy( IDS_VLMSETNUMBER, text, MAX_UI_RESOURCE_LEN );
+
+ sprintf( buffer, text, bset_num );
+ BSET_SetBsetNumStr( bset, buffer );
+
+ bset->backup_type = (UINT8)header->backup_type;
+
+ bset->num_files = (UINT32)header->num_files ;
+ bset->num_dirs = (UINT32)header->num_dirs ;
+ bset->num_corrupt = (UINT32)header->num_corrupt_files ;
+
+ // which password to use
+
+ bset->encrypt_algor = (UINT16)header->encrypt_algor;
+
+ if ( header->bset_password_size ) {
+ memcpy( bset->password,
+ header->bset_password,
+ (INT)header->bset_password_size );
+ bset->password_size = (INT16)header->bset_password_size;
+ bset->bset_password = TRUE;
+ }
+ else {
+ memcpy( bset->password,
+ header->tape_password,
+ (INT)header->tape_password_size);
+ bset->password_size = (INT16)header->tape_password_size;
+ bset->bset_password = FALSE;
+ }
+
+ bset->tape_fid = tape->tape_fid;
+ bset->bset_num = bset_num;
+
+ BSET_SetXtraBytes( bset, wininfo );
+
+ strcpy( bset->user_name, header->user_name );
+ strcpy( bset->volume_name, header->volume_name );
+
+ if ( QueueCount( &tape->bset_list ) == 0 ) {
+
+ EnQueueElem( &(tape->bset_list), &(bset->q_elem), FALSE );
+ }
+ else {
+ if ( temp_bset ) {
+ InsertElem( &tape->bset_list, &(temp_bset->q_elem), &(bset->q_elem), BEFORE );
+ }
+ else {
+ temp_bset = VLM_GetLastBSET( &tape->bset_list );
+ InsertElem( &tape->bset_list, &(temp_bset->q_elem), &(bset->q_elem), AFTER );
+ }
+ }
+
+ VLM_SetBsetStringMaxValues( tape, bset );
+
+ // See if its the active tape
+
+ if ( appinfo->open_tape != NULL ) {
+
+ if ( appinfo->open_tape->tape_fid == tape_fid ) {
+
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMADDITEMS,
+ (LMHANDLE)VLM_GetPrevBSET( bset ), 1 );
+
+ if ( QueueCount( &tape->bset_list ) == 1 ) {
+ DLM_SetAnchor( WMDS_GetWinFlatList( wininfo ),
+ 0,
+ (LMHANDLE)bset );
+ }
+ }
+ }
+ }
+ }
+ else {
+
+ // The "new" backup set is already in our list, so some attribute
+ // must have changed or hopefully we wouldn't have been called.
+ // Or we got another piece of it.
+
+
+ // First to handle the crossing set size problem. If it is
+ // a crossing set, then add up all the known pieces to get
+ // the set size.
+
+ if ( ( header->status & QTC_SPLIT ) ||
+ ( header->status & QTC_CONTINUATION ) ) {
+
+ total64 = U64_Init( 0L, 0L );
+
+ qtc_tape = QTC_GetFirstTape();
+
+ while ( qtc_tape != NULL ) {
+
+ if ( qtc_tape->tape_fid == tape_fid ) {
+
+ qtc_bset = QTC_GetFirstBset( qtc_tape );
+
+ while ( qtc_bset != NULL ) {
+
+ if ( qtc_bset->bset_num == header->bset_num ) {
+
+
+ qtc_header = QTC_LoadHeader( qtc_bset );
+
+ if ( qtc_header ) {
+
+ temp64 = U64_Init( qtc_header->num_bytes,
+ qtc_header->num_bytes_msw );
+
+ total64 = U64_Add( total64, temp64, &u64_stat );
+
+ free( qtc_header );
+ }
+ }
+
+ qtc_bset = QTC_GetNextBset( qtc_bset );
+ }
+
+ }
+
+ qtc_tape = QTC_GetNextTape( qtc_tape );
+ }
+
+
+ bset->total_bytes = total64;
+
+ }
+ else {
+
+ if ( ( U64_Msw( bset->total_bytes ) == 0L ) &&
+ ( U64_Lsw( bset->total_bytes ) == 0L ) ) {
+
+ // Fill in size of the bset in bytes.
+
+ bset->total_bytes = U64_Init( header->num_bytes, header->num_bytes_msw );
+ }
+
+ }
+
+
+ if ( bset->num_files != (INT32)header->num_files ) {
+ bset->num_files = (INT32)header->num_files ;
+ changed = TRUE ;
+ }
+
+ if ( bset->num_dirs != (INT32)header->num_dirs ) {
+ bset->num_dirs = (INT32)header->num_dirs ;
+ changed = TRUE ;
+ }
+
+ if ( bset->num_corrupt != (INT32)header->num_corrupt_files ) {
+ bset->num_corrupt = (INT32)header->num_corrupt_files ;
+ changed = TRUE ;
+ }
+
+ if ( VLM_SetBsetFlags( bset, qtc, FALSE, (INT16)0 ) == TRUE ) {
+ changed = TRUE;
+ }
+
+ if ( bset->num_tapes > 1 ) {
+ RSM_StringCopy( IDS_VLMONTAPES, text, MAX_UI_RESOURCE_LEN );
+ sprintf( tape_num_str, text, bset->base_tape, bset->base_tape + bset->num_tapes - 1 );
+ BSET_SetTapeNumStr( bset, tape_num_str );
+ }
+
+
+ // Display the correct set size string.
+
+
+ U64_Litoa( bset->total_bytes, numeral, (INT16) 10, &u64_stat );
+
+ UI_BuildNumeralWithCommas( numeral );
+
+ if ( U64_Lsw( bset->total_bytes ) || U64_Msw( bset->total_bytes ) ) {
+
+ if ( strlen( numeral ) < 5 ) {
+ strcpy( numeral, TEXT( "1K" ) );
+ }
+ else {
+
+ // truncate down to kilobytes.
+ numeral[ strlen( numeral ) - 4 ] = TEXT( '\0' );
+ }
+
+ sprintf( bset->kbytes_str, TEXT( "%sK" ), numeral );
+ }
+ else {
+
+ if ( header->status & QTC_PARTIAL ) {
+ strcpy( bset->kbytes_str, unknown_kbytes_string );
+ }
+ else {
+
+ // If its not partial and the byte count is really 0.
+ strcpy( bset->kbytes_str, TEXT( "0K" ) );
+ }
+
+ }
+
+ if ( header->OS_id == FS_NOV_SMS ) {
+ bset->status |= INFO_SMS;
+ }
+ if ( header->status & QTC_IMAGE ) {
+ bset->status |= INFO_IMAGE;
+ }
+ if ( header->status & QTC_FUTURE_VER ) {
+ }
+ if ( header->status & QTC_COMPRESSED ) {
+ bset->status |= INFO_COMPRESSED;
+ }
+ if ( header->status & QTC_ENCRYPTED ) {
+ bset->status |= INFO_ENCRYPTED;
+ }
+
+ VLM_SetBsetStringMaxValues( tape, bset );
+
+ // See if its the active tape
+
+ if ( ( appinfo->open_tape != NULL ) && ( changed == TRUE ) ) {
+
+ if ( appinfo->open_tape->tape_fid == tape_fid ) {
+
+ if ( UpdateScreen ){
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)bset, 0 );
+ }
+ }
+ }
+ }
+
+ last_seq_num = (INT16)header->tape_seq_num;
+
+ qtc = NULL;
+
+ if ( tape_seq_num == -1 ) {
+
+ // try for another one.
+
+ qtc = QTC_FindBset( tape_fid, (INT16)(last_seq_num + 1), bset_num );
+
+ if ( qtc ) {
+ free( header );
+ header = QTC_LoadHeader( qtc );
+ }
+ }
+
+ } while ( qtc != NULL && header != NULL );
+
+ free( header );
+
+ if ( ScreenNeedsUpdating ) {
+
+ // It's possible that we received this message because the bset was just
+ // converted from full cataloging to partial. If this is the case then
+ // we need to close the tree window for this bset, if its open.
+
+ if ( ! bset->full ) {
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ temp_wininfo = WM_GetInfoPtr( win );
+
+ if ( temp_wininfo->wType == WMTYPE_TAPETREE ) {
+
+ temp_appinfo = (APPINFO_PTR)WM_GetAppPtr( win );
+
+ if ( ( temp_appinfo->tape_fid == tape_fid ) &&
+ ( temp_appinfo->bset_num == bset_num ) ) {
+
+ WM_Destroy( win );
+ break;
+ }
+ }
+ win = WM_GetNext( win );
+ }
+
+ }
+
+ // Update the check marks for the tape.
+
+ VLM_UpdateTapeStatus( tape, UpdateScreen );
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_SetBsetFlags
+
+ DESCRIPTION :
+
+ We get sent the pieces of a bset, that spans tapes, one at a time, in
+ no particular order. We need to determine in this routine if we have
+ all the pieces of it. If we don't, we mark it as missing.
+ We are also required to keep track of knowing if all the parts
+ are fully cataloged or not.
+
+ NOTE:
+
+ The goal here is to set three flags correctly at all times for each set.
+ They are "incomplete", "missing", and "full".
+
+ full - "One or more pieces are fully or incompletely cataloged".
+
+ Incomplete - "One or more pieces are incompletely cataloged".
+
+ Missing - "One or more pieces are missing", ie. NOT in the catalogs.
+
+ To keep track of all this we use three arrays of 32 bits. The assumption
+ is that no ONE set will end up on more than 32 tapes. Each bit in the
+ arrays represents a tape in the family. BIT32 is the first tape the
+ set starts on and works to the right.
+
+ The three arrays:
+ tapes_mask - A bit is set if the tape is in the catalogs.
+ full_mask - A bit is set if the piece is fully cataloged.
+ inco_mask - A bit is set if the piece is cataloged, but not completely.
+
+ Now your thinking how do I know which bit to use for tape X. Good
+ question. Each set we get has the tape number its on and a type
+ designation.
+
+ The designation is one of:
+
+ NOTHING - This set is only on 1 tape.
+ SPLIT - This tape is the first part of a multi tape set.
+ CONTINUATION - This tape is the last part of a multi tape set.
+ SPLIT & CONTINUATION - This tape is a middle piece of at least a
+ three piece set.
+
+ In addition, in the bset we use what we think the starting tape of
+ a family is in 'base_tape' and the current guess about how many
+ tapes the set is on in 'num_tapes'. The first real tape we have
+ present is in tape_num.
+
+ So with all this information the work is in keeping all your bits
+ set correctly. And then setting the flags based on the bits.
+
+ NOTE TWO:
+
+ This code correct handles the removal of sets, and flag setting. But
+ the current UI doesn't designate which tape of a family was deleted
+ or overwritten. So if any part of a set goes away, the whole set
+ goes away for the duration of the session. It will reappear next time
+ if there are any parts of it left.
+
+ NOTE THREE:
+
+ Keep in mind that the same piece may be sent multiple times, with or
+ without changing.
+
+ RETURNS : TRUE if the status changed.
+
+**********************/
+
+static BOOLEAN VLM_SetBsetFlags(
+BSET_OBJECT_PTR bset, // I - the bset changing
+QTC_BSET_PTR qtc, // I - the new piece if an insertion
+BOOLEAN removal, // I - TRUE if a removal, not an insertion
+INT16 tape_seq_num ) // I - Valid only if removal is TRUE.
+{
+ BOOLEAN old_full;
+ BOOLEAN old_missing;
+ BOOLEAN old_incomplete;
+ UINT32 mask;
+ INT i;
+ INT shift;
+
+ // If its not FULL it's partial.
+ // If its FULL, it can also be "FULL INCOMPLETE" or "FULL MISSING",
+ // or "FULL INCOMPLETE MISSING".
+
+ old_full = BSET_GetFull( bset );
+ old_missing = BSET_GetMissing( bset );
+ old_incomplete = BSET_GetIncomplete( bset );
+
+ if ( removal ) {
+
+ // A set has been deleted.
+
+ mask = 0x80000000 >> ( tape_seq_num - bset->base_tape );
+
+ bset->full_mask &= ~mask;
+ bset->inco_mask &= ~mask;
+ bset->tape_mask &= ~mask;
+
+ }
+ else {
+
+ // Simple case first, doesn't cross tape.
+
+ if ( ! ( qtc->status & ( QTC_SPLIT | QTC_CONTINUATION ) ) ) {
+
+ BSET_SetBaseTape( bset, (INT16)qtc->tape_seq_num );
+ BSET_SetNumTapes( bset, 1 );
+ mask = 0x80000000;
+ }
+
+ // Last tape in multiple tape set.
+
+ if ( ! ( qtc->status & QTC_SPLIT ) &&
+ ( qtc->status & QTC_CONTINUATION ) ) {
+
+ if ( bset->tape_mask ) {
+
+ if ( ( bset->base_tape + bset->num_tapes - 1 ) != (INT)qtc->tape_seq_num ) {
+ bset->num_tapes += (INT16)qtc->tape_seq_num -
+ ( bset->base_tape + bset->num_tapes - 1 );
+ }
+
+ }
+ else {
+ bset->base_tape = (INT)qtc->tape_seq_num - (INT16)1;
+ bset->num_tapes = 2;
+ }
+
+ }
+
+ // First part in multiple tape set.
+
+ if ( ( qtc->status & QTC_SPLIT ) &&
+ ! ( qtc->status & QTC_CONTINUATION ) ) {
+
+ if ( bset->tape_mask ) {
+
+ if ( bset->base_tape != (INT)qtc->tape_seq_num ) {
+
+ shift = (INT)qtc->tape_seq_num - bset->base_tape;
+
+ // shift all arrays by 'shift' to the right
+
+ bset->full_mask >>= shift;
+ bset->tape_mask >>= shift;
+ bset->inco_mask >>= shift;
+
+ bset->num_tapes += shift;
+ }
+
+ }
+ else {
+ bset->base_tape = (INT16)qtc->tape_seq_num;
+ bset->num_tapes = 2;
+ }
+
+ }
+
+ // Middle set, not first or last.
+
+ if ( ( qtc->status & QTC_SPLIT ) &&
+ ( qtc->status & QTC_CONTINUATION ) ) {
+
+ if ( bset->tape_mask ) {
+
+ if ( (INT16)qtc->tape_seq_num <= bset->base_tape ) {
+
+ // shift everything right because the base is wrongly
+ // set it to high a tape number. And lower the base.
+
+ shift = bset->base_tape - (INT16)qtc->tape_seq_num + 1;
+
+ bset->full_mask >>= shift;
+ bset->tape_mask >>= shift;
+ bset->inco_mask >>= shift;
+
+ bset->num_tapes += shift;
+ bset->base_tape -= shift;
+ }
+ else {
+
+ if ( ( bset->base_tape + bset->num_tapes - 1 ) <= (INT16)qtc->tape_seq_num ) {
+
+ // It goes after the known end. Bump where the end is to a
+ // a higher number.
+
+ bset->num_tapes += (INT16)qtc->tape_seq_num - bset->base_tape + 2;
+ }
+ }
+ }
+ else {
+
+ bset->base_tape = (INT16)qtc->tape_seq_num - (INT16)1;
+ bset->num_tapes = 3;
+ }
+
+ }
+
+ mask = 0x80000000 >> ( qtc->tape_seq_num - bset->base_tape );
+
+ // Now we have determine the position in the array that this
+ // new item goes, 'mask'. Use mask to set the array flags
+ // correctly. Keep in mind this could be a repeat set, so
+ // clear any bits that shouldn't be set.
+
+ bset->tape_mask |= mask;
+
+ if ( ! ( qtc->status & QTC_PARTIAL ) ) {
+
+ if ( qtc->status & QTC_INCOMPLETE ) {
+ bset->inco_mask |= mask;
+ bset->full_mask &= ~mask;
+ }
+ else {
+ bset->full_mask |= mask;
+ bset->inco_mask &= ~mask;
+ }
+ }
+ else {
+ bset->full_mask &= ~mask;
+ bset->inco_mask &= ~mask;
+ }
+ }
+
+
+ // Now that all the array bits have been properly updated we can set
+ // the full, incomplete, and missing flags as they should be now.
+
+ if ( bset->full_mask || bset->inco_mask ) {
+ bset->full = TRUE;
+ }
+ else {
+ bset->full = FALSE;
+ }
+
+ // Now set incomplete and missing flags
+
+ bset->incomplete = FALSE;
+
+ bset->missing = FALSE;
+
+ mask = 0x80000000;
+
+ for ( i = 0; i < bset->num_tapes; i++ ) {
+
+ if ( ! ( bset->tape_mask & mask ) ) {
+ bset->missing = TRUE;
+ }
+ else {
+ if ( ! ( bset->full_mask & mask ) ) {
+ bset->incomplete = TRUE;
+ }
+ }
+
+ mask >>= 1;
+ }
+
+ // Set the tape_num to be the lowest numbered tape that is present.
+
+ bset->tape_num = bset->base_tape;
+ mask = 0x80000000;
+
+ for ( i = 0; i < 32; i++ ) {
+ if ( bset->tape_mask & mask ) {
+ break;
+ }
+ bset->tape_num++;
+ mask >>= 1;
+ }
+
+ if ( ( bset->missing != old_missing ) ||
+ ( bset->full != old_full ) ||
+ ( bset->incomplete != old_incomplete ) ) {
+
+ return( TRUE );
+ }
+
+ return( FALSE ); // If status changed
+}
+
+
+
+
+/**********************
+
+ NAME : VLM_CreateBSET
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BSET_OBJECT_PTR VLM_CreateBSET(
+INT name_size,
+INT user_name_size,
+INT volume_name_size,
+INT tape_num_size,
+INT date_size,
+INT time_size,
+INT bytes_size,
+INT password_size,
+INT os_id,
+INT os_ver )
+{
+ BSET_OBJECT_PTR bset;
+
+ // sizes are in bytes
+
+ bset = (BSET_OBJECT_PTR)malloc( sizeof(BSET_OBJECT) + name_size +
+ user_name_size +
+ volume_name_size +
+ tape_num_size +
+ date_size +
+ time_size +
+ bytes_size +
+ password_size );
+
+ if ( bset != NULL ) {
+
+ bset->q_elem.q_ptr = bset;
+ bset->name = (CHAR_PTR)(((INT8_PTR)bset) + sizeof(BSET_OBJECT));
+ bset->user_name = bset->name + name_size / sizeof(CHAR);
+ bset->volume_name = bset->user_name + user_name_size / sizeof(CHAR);
+ bset->tape_num_str = bset->volume_name + volume_name_size / sizeof( CHAR );
+ bset->date_str = bset->tape_num_str + tape_num_size / sizeof(CHAR);
+ bset->time_str = bset->date_str + date_size / sizeof(CHAR);
+ bset->kbytes_str = bset->time_str + time_size / sizeof(CHAR);
+ bset->password = bset->kbytes_str + bytes_size / sizeof(CHAR);
+ bset->os_id = (INT)((INT16)os_id) ;
+ bset->os_ver = os_ver ;
+ }
+
+ return( bset );
+}
+
+/**********************
+
+ NAME : VLM_BsetFillInDLM
+
+ DESCRIPTION :
+
+ This window is actually created in the VLM_TAPE file, but by filling in
+ the DLM structure in this file, I can make all the callback functions
+ static.
+
+ RETURNS : nothing
+
+**********************/
+
+
+VOID VLM_BsetFillInDLM( VOID_PTR dlm )
+{
+ DLM_INIT *flat_dlm;
+
+ flat_dlm = (DLM_INIT *)dlm;
+
+ DLM_ListBoxType( flat_dlm, DLM_FLATLISTBOX );
+ DLM_Mode( flat_dlm, DLM_SINGLECOLUMN );
+ DLM_Display( flat_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( flat_dlm, NULL );
+ DLM_TextFont( flat_dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( flat_dlm, VLM_BsetGetItemCount );
+ DLM_GetFirstItem( flat_dlm, VLM_BsetGetFirstItem );
+ DLM_GetNext( flat_dlm, VLM_BsetGetNextItem );
+ DLM_GetPrev( flat_dlm, VLM_BsetGetPrevItem );
+ DLM_GetTag( flat_dlm, VLM_BsetGetTag );
+ DLM_SetTag( flat_dlm, VLM_BsetSetTag );
+ DLM_GetSelect( flat_dlm, VLM_BsetGetSelect );
+ DLM_SetSelect( flat_dlm, VLM_BsetSetSelect );
+ DLM_GetObjects( flat_dlm, VLM_BsetGetObjects );
+ DLM_SetObjects( flat_dlm, VLM_BsetSetObjects );
+ DLM_SSetItemFocus( flat_dlm, NULL );
+ DLM_MaxNumObjects( flat_dlm, BSET_NUM_DISPLAY_ITEMS );
+}
+
+
+
+
+/**********************
+
+ NAME : VLM_SelectBsets
+
+ DESCRIPTION :
+
+ The user has tagged one or more backup sets and hit the
+ select or unselect button. This function does the processing for that
+ command.
+
+ RETURNS :
+
+**********************/
+
+
+VOID VLM_SelectBsets(
+BYTE attr ) // I - select or deselect ?
+{
+ BSET_OBJECT_PTR bset;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = (APPINFO_PTR)WM_GetAppPtr( gb_tapes_win );
+
+ if ( WM_IsFlatActive( wininfo ) ) {
+
+ // Have the display list manager update our tags for us.
+
+ DLM_UpdateTags( gb_tapes_win, DLM_FLATLISTBOX );
+
+ bset = VLM_GetFirstBSET( wininfo->pFlatList );
+
+ while ( bset != NULL ) {
+
+ if ( bset->status & INFO_TAGGED ) {
+
+ VLM_BsetSetSelect( bset, attr );
+ }
+ bset = VLM_GetNextBSET( bset );
+ }
+ }
+
+ if ( WM_IsTreeActive( wininfo ) ) {
+
+ if ( appinfo->open_tape ) {
+
+ VLM_TapeSetSelect( appinfo->open_tape, attr );
+ }
+ }
+
+}
+
+/**********************
+
+ NAME : VLM_BsetSetSelect
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID_PTR VLM_BsetSetSelect( BSET_OBJECT_PTR bset, BYTE attr )
+{
+ TAPE_OBJECT_PTR tape;
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse_ptr;
+ HWND win;
+ INT16 error;
+ BOOL all_subdirs;
+ BE_CFG_PTR bec_config;
+ UINT16 status;
+ DATE_TIME sort_date;
+ SLM_OBJECT_PTR slm;
+ BOOLEAN open_win;
+ QTC_BSET_PTR qtc_bset;
+ QTC_HEADER_PTR header;
+ INT16 tape_num;
+ CHAR_PTR server_name;
+
+ gbCurrentOperation = OPERATION_CATALOG; // chs:04-05-93
+
+ // You can't select these bsets, no matter how hard you try.
+
+ if ( bset->status & (INFO_SMS|INFO_IMAGE|INFO_COMPRESSED|INFO_ENCRYPTED ) ) {
+ return( NULL );
+ }
+
+ // Check for password protected set.
+
+ if ( attr ) {
+ if ( PSWD_CheckForPassword( bset->tape_fid, bset->bset_num ) ) {
+ return( NULL );
+ }
+ }
+
+ all_subdirs = CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ // we need to find this guys parent and mark him also
+
+ wininfo = WM_GetInfoPtr( bset->XtraBytes->hWnd );
+
+ if ( attr ) {
+ if ( all_subdirs ) {
+ status = INFO_SELECT;
+ }
+ else {
+ status = (INFO_PARTIAL|INFO_SELECT);
+ }
+ }
+ else {
+ status = 0;
+ }
+
+ if ( (UINT16)(bset->status & (UINT16)(INFO_PARTIAL|INFO_SELECT) ) != status ) {
+
+ bset->status &= ~(INFO_PARTIAL|INFO_SELECT);
+ bset->status |= status;
+
+ DLM_Update( gb_tapes_win, DLM_FLATLISTBOX, WM_DLMUPDATEITEM,
+ (LMHANDLE)bset, 0 );
+ }
+
+ // Add code to create FSE for this Bset
+
+ if ( attr ) {
+ error = BSD_CreatFSE( &fse_ptr, (INT16)INCLUDE,
+ (INT8_PTR)TEXT(""), (INT16) sizeof(CHAR),
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ (BOOLEAN)USE_WILD_CARD,
+ (BOOLEAN) all_subdirs );
+ }
+ else {
+ error = BSD_CreatFSE( &fse_ptr, (INT16) EXCLUDE,
+ (INT8_PTR)TEXT(""), (INT16) sizeof(CHAR),
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) TRUE );
+ }
+
+ if ( error ) {
+ return( NULL );
+ }
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape->tape_fid != bset->tape_fid ) {
+
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ bset->tape_fid, bset->bset_num );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ DateTimeDOS( bset->backup_date, bset->backup_time, &sort_date );
+
+ BSD_Add( tape_bsd_list, &bsd_ptr, bec_config, NULL,
+ NULL, bset->tape_fid, bset->tape_num, bset->bset_num,
+ NULL, &sort_date );
+
+ if ( bsd_ptr ) {
+ BSD_SetOsId(bsd_ptr, bset->os_id) ;
+ BSD_SetOsVer(bsd_ptr, bset->os_ver) ;
+
+ server_name = bset->volume_name;
+ while ( *server_name ) server_name++;
+
+ while ( ( *server_name != TEXT( '\\' ) ) &&
+ ( server_name != bset->volume_name ) )
+ server_name--;
+
+ if ( server_name != bset->volume_name ) {
+
+ *server_name = TEXT( '\0' );
+
+ while ( ( *server_name != TEXT( '\\' ) ) &&
+ ( server_name != bset->volume_name ) )
+ server_name--;
+ if ( server_name != bset->volume_name ) {
+
+ server_name++;
+ }
+
+ BSD_SetVolumeLabel( bsd_ptr, server_name, (UINT16)strsize( server_name ) );
+
+ while ( *server_name ) server_name++;
+ *server_name = TEXT( '\\' );
+
+ } else {
+
+ BSD_SetVolumeLabel( bsd_ptr, server_name, (UINT16)strsize( server_name ) );
+ }
+ }
+
+ VLM_FillInBSD( bsd_ptr );
+ }
+
+ if ( bsd_ptr != NULL ) {
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+ }
+
+ VLM_UpdateTapeStatus( tape, TRUE );
+
+ // see if we have an open window for the bset
+
+ open_win = FALSE;
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( WMDS_GetWinType( wininfo ) == WMTYPE_TAPETREE ) {
+
+ appinfo = (APPINFO_PTR)WM_GetAppPtr( win );
+
+ if ( ( appinfo->bset_num == bset->bset_num ) &&
+ ( appinfo->tape_fid == bset->tape_fid ) ) {
+
+ open_win = TRUE;
+
+ if ( attr ) {
+ VLM_SubdirListManager( win, SLM_SEL_ALL );
+ if ( bsd_ptr != NULL ) {
+ VLM_MatchSLMList( wininfo, bsd_ptr, FALSE );
+ }
+ }
+ else {
+ VLM_SubdirListManager( win, SLM_SEL_NONE );
+ VLM_DeselectAll( wininfo, FALSE );
+ }
+ break;
+ }
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ // update search window selections
+
+ VLM_UpdateSearchSelections( bset->tape_fid, bset->bset_num );
+
+ return( NULL );
+}
+
+
+/**********************
+
+ NAME : VLM_BsetGetSelect
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BYTE VLM_BsetGetSelect( BSET_OBJECT_PTR bset )
+{
+ if ( BSET_GetStatus( bset ) & INFO_SELECT ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/**********************
+
+ NAME : VLM_BsetSetTag
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_BsetSetTag( BSET_OBJECT_PTR bset, BYTE attr )
+{
+ if ( attr ) {
+ bset->status |= INFO_TAGGED;
+ }
+ else {
+ bset->status &= ~INFO_TAGGED;
+ }
+ return( NULL );
+}
+
+/**********************
+
+ NAME : VLM_BsetGetTag
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BYTE VLM_BsetGetTag( BSET_OBJECT_PTR bset )
+{
+ if ( INFO_TAGGED & BSET_GetStatus( bset ) ) {
+ return( 1 );
+ }
+ return( 0 );
+}
+
+/**********************
+
+ NAME : VLM_BsetGetItemCount
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static USHORT VLM_BsetGetItemCount( Q_HEADER_PTR bset_list )
+{
+
+ if ( bset_list == NULL ) {
+ return( 0 );
+ }
+
+ return( QueueCount( bset_list ) );
+}
+
+/**********************
+
+ NAME : VLM_BsetGetFirstItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_BsetGetFirstItem( Q_HEADER_PTR bset_list )
+{
+ if ( bset_list == NULL ) {
+ return( NULL );
+ }
+
+ return( (VOID_PTR)VLM_GetFirstBSET( bset_list) );
+}
+
+/**********************
+
+ NAME : VLM_BsetGetPrevItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_BsetGetPrevItem( BSET_OBJECT_PTR bset )
+{
+ return( (VOID_PTR)VLM_GetPrevBSET( bset ) );
+}
+
+/**********************
+
+ NAME : VLM_BsetGetNextItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_BsetGetNextItem( BSET_OBJECT_PTR bset )
+{
+ return( (VOID_PTR)VLM_GetNextBSET( bset ) );
+}
+
+/**********************
+
+ NAME : VLM_BsetGetObjects
+
+ DESCRIPTION :
+
+ For a given object get the information that needs to be displayed.
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_BsetGetObjects( BSET_OBJECT_PTR bset )
+{
+ BYTE item_num = 1;
+ BYTE_PTR memblk;
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+
+ /* malloc enough room to store info */
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ memblk = (BYTE_PTR)DLM_GetObjectsBuffer( wininfo->hWndFlatList );
+
+ /* Store the number of items in the first two bytes. */
+
+ *memblk = BSET_NUM_DISPLAY_ITEMS;
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( bset->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( bset->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_BITMAP;
+
+ switch ( bset->os_id ) {
+
+ case FS_EMS_MDB_ID:
+ if (bset->num_dirs == 0) {
+ DLM_ItemwId( item ) = IDRBM_EMS_MDBP;
+ } else if ( bset->num_corrupt == 0 ) {
+ DLM_ItemwId( item ) = IDRBM_EMS_MDB;
+ } else {
+ DLM_ItemwId( item ) = IDRBM_EMS_MDBX;
+ }
+ break;
+
+ case FS_EMS_DSA_ID:
+ if (bset->num_dirs == 0) {
+ DLM_ItemwId( item ) = IDRBM_EMS_DSAP;
+ } else if ( bset->num_corrupt == 0 ) {
+ DLM_ItemwId( item ) = IDRBM_EMS_DSA;
+ } else {
+ DLM_ItemwId( item ) = IDRBM_EMS_DSAX;
+ }
+ break;
+
+ default:
+ DLM_ItemwId( item ) = IDRBM_BSET;
+ if ( ! bset->full ) {
+ DLM_ItemwId( item ) = IDRBM_BSETPART;
+ }
+ }
+
+ // Don't display encrypted or compressed or newer version sets as full
+
+ if ( bset->status & (INFO_COMPRESSED | INFO_ENCRYPTED ) ) {
+
+ DLM_ItemwId( item ) = IDRBM_BSETPART;
+ }
+
+ if ( bset->status & INFO_IMAGE ) {
+ DLM_ItemwId( item ) = IDRBM_IMAGE;
+ }
+
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text string to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)bset->max_volume;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)bset->volume_name );
+
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)bset->max_set;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)BSET_GetBsetNumStr( bset ) );
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)bset->max_tapes;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)BSET_GetTapeNumStr( bset ) );
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = 5;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ if ( bset->backup_type == QTC_NORM_BACKUP ) {
+ RSM_StringCopy ( IDS_VLMNORM, text, MAX_UI_RESOURCE_LEN );
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), text );
+ }
+ if ( bset->backup_type == QTC_DIFF_BACKUP ) {
+ RSM_StringCopy ( IDS_VLMDIFF, text, MAX_UI_RESOURCE_LEN );
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), text );
+ }
+ if ( bset->backup_type == QTC_COPY_BACKUP ) {
+ RSM_StringCopy ( IDS_VLMCOPY, text, MAX_UI_RESOURCE_LEN );
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), text );
+ }
+ if ( bset->backup_type == QTC_INCR_BACKUP ) {
+ RSM_StringCopy ( IDS_VLMINCR, text, MAX_UI_RESOURCE_LEN );
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), text );
+ }
+ if ( bset->backup_type == QTC_DAIL_BACKUP ) {
+ RSM_StringCopy ( IDS_VLMDAILY, text, MAX_UI_RESOURCE_LEN );
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), text );
+ }
+ if ( bset->status & INFO_IMAGE ) {
+ RSM_StringCopy ( IDS_VLMIMAGE, text, MAX_UI_RESOURCE_LEN );
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), text );
+ }
+
+#ifndef OEM_MSOFT
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)bset->max_kbytes;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ sprintf(text, TEXT("%10s"), (CHAR_PTR)bset->kbytes_str);
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)text );
+#endif
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)bset->max_date;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ sprintf(text, TEXT("%8s"), (CHAR_PTR)bset->date_str);
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)text );
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)bset->max_time;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ sprintf(text, TEXT("%11s"), (CHAR_PTR)bset->time_str);
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)text );
+
+ item++;
+ DLM_ItemcbNum( item ) = item_num++;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)bset->max_name;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)bset->name );
+
+ return( memblk );
+}
+
+/**********************
+
+ NAME : VLM_BsetSetObjects
+
+ DESCRIPTION :
+
+ Handle that we got a click or a double click.
+
+ RETURNS :
+
+**********************/
+
+BOOLEAN VLM_BsetSetObjects(
+BSET_OBJECT_PTR bset,
+WORD operation,
+WORD ObjectNum )
+{
+ BOOLEAN found = FALSE;
+ HWND win;
+ BSET_OBJECT_PTR temp_bset;
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ CHAR keyb_char;
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+
+
+ gbCurrentOperation = OPERATION_CATALOG; // chs:03-16-93
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_bset = bset;
+
+ do {
+
+ temp_bset = VLM_GetNextBSET( temp_bset );
+
+ if ( temp_bset != NULL ) {
+
+ if ( keyb_char == (CHAR)toupper( *BSET_GetName( temp_bset ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( BSET_GetXtraBytes( temp_bset ) ),
+ 0,
+ (LMHANDLE)temp_bset );
+ return( TRUE );
+ }
+ }
+
+ } while ( temp_bset != NULL );
+
+ temp_bset = VLM_GetFirstBSET( WMDS_GetFlatList( BSET_GetXtraBytes( bset ) ) );
+
+ while ( temp_bset != NULL && temp_bset != bset ) {
+
+ if ( keyb_char == (CHAR)toupper( *BSET_GetName( temp_bset ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( BSET_GetXtraBytes( temp_bset ) ),
+ 0,
+ (LMHANDLE)temp_bset );
+ return( TRUE );
+ }
+
+ temp_bset = VLM_GetNextBSET( temp_bset );
+ }
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( BSET_GetXtraBytes( bset ) ),
+ 0,
+ (LMHANDLE)bset );
+ }
+
+ if ( ( operation == WM_DLMDBCLK ) &&
+ ( ObjectNum >= 2 ) ) {
+
+#ifdef OEM_EMS
+ if ( ( bset->os_id == FS_EMS_MDB_ID ) ||
+ ( bset->os_id == FS_EMS_DSA_ID ) ) {
+
+ return TRUE;
+ }
+#endif
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo->wType == WMTYPE_TAPETREE ) {
+
+ appinfo = (APPINFO_PTR)WM_GetAppPtr( win );
+
+ if ( ( appinfo->bset_num == bset->bset_num ) &&
+ ( appinfo->tape_fid == bset->tape_fid ) ) {
+ found = TRUE;
+ WM_DocActivate( win );
+ break;
+ }
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ if ( ! found ) {
+
+ if ( bset->status & INFO_IMAGE ) {
+
+ RSM_StringCopy( IDS_VLMCATWARNING, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSETIMAGE, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title,
+ text,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+
+ return( FALSE );
+ }
+ if ( bset->status & INFO_COMPRESSED ) {
+
+ RSM_StringCopy( IDS_VLMCATWARNING, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSETCOMPRESSED, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title,
+ text,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+
+ return( FALSE );
+ }
+ if ( bset->status & INFO_ENCRYPTED ) {
+
+ RSM_StringCopy( IDS_VLMCATWARNING, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSETENCRYPT, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title,
+ text,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+
+ return( FALSE );
+ }
+ if ( bset->status & INFO_SMS ) {
+
+ RSM_StringCopy( IDS_VLMCATWARNING, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSETSMS, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title,
+ text,
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+
+ return( FALSE );
+ }
+
+ if ( PSWD_CheckForPassword( bset->tape_fid, bset->bset_num ) ) {
+ return( FALSE );
+ }
+
+ if ( ! bset->full ) {
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+
+ RSM_StringCopy( IDS_VLMCATWARNING, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSETPARTIAL, text, MAX_UI_RESOURCE_LEN );
+
+ if ( WM_MsgBox( title,
+ text,
+ WMMB_OKCANCEL,
+ WMMB_ICONQUESTION ) != WMMB_IDOK ) {
+
+ return( FALSE );
+ }
+
+ if ( ! MUI_DisableOperations( IDM_OPERATIONSCATALOG ) ) {
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ do_catalog( bset->tape_fid,
+ bset->tape_num,
+ bset->bset_num );
+
+ VLM_CatalogSync( VLM_SYNCMORE );
+ }
+
+ MUI_EnableOperations( IDM_OPERATIONSCATALOG );
+ }
+
+
+ }
+# else
+ {
+
+ if ( ! MUI_DisableOperations( IDM_OPERATIONSCATALOG ) ) {
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ // WM_ShowWaitCursor( TRUE );
+ STM_SetIdleText( IDS_CATALOGING );
+ VLM_CatalogSet( bset->tape_fid,
+ bset->tape_num,
+ bset->bset_num );
+ STM_SetIdleText( IDS_READY );
+ // WM_ShowWaitCursor( FALSE );
+
+ }
+
+ MUI_EnableOperations( 0 );
+ }
+
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+ if ( bset->full ) {
+
+ WM_ShowWaitCursor( TRUE );
+
+ VLM_SubdirListCreate( (GENERIC_DLE_PTR)NULL,
+ bset->tape_fid,
+ bset->bset_num,
+ bset->tape_num,
+ gb_tapes_win );
+
+ WM_ShowWaitCursor( FALSE );
+ }
+
+ }
+ else {
+
+ if ( bset->incomplete || bset->missing ) {
+
+ RSM_StringCopy( IDS_VLMCATWARNING, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSETINCOMPLETE, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title,
+ text,
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ }
+
+ WM_ShowWaitCursor( TRUE );
+
+ VLM_SubdirListCreate( (GENERIC_DLE_PTR)NULL,
+ bset->tape_fid,
+ bset->bset_num,
+ bset->tape_num,
+ gb_tapes_win );
+
+ WM_ShowWaitCursor( FALSE );
+ }
+
+ if ( IsWindow ( ghModelessDialog ) ) {
+ SetFocus ( ghModelessDialog );
+ }
+ }
+ }
+
+ return( FALSE );
+}
diff --git a/private/utils/ntbackup/src/vlm_cat.c b/private/utils/ntbackup/src/vlm_cat.c
new file mode 100644
index 000000000..41fdc3aeb
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_cat.c
@@ -0,0 +1,571 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_CAT.C
+
+ Description:
+
+ VLM's interface to the catalogs.
+
+
+ $Log: G:\ui\logfiles\vlm_cat.c_v $
+
+ Rev 1.40.1.1 16 Jun 1994 15:30:06 STEVEN
+return if wondow not present
+
+ Rev 1.40.1.0 08 Dec 1993 11:26:50 MikeP
+deep pathes and unicode
+
+ Rev 1.40 03 Aug 1993 17:52:16 BARRY
+Don't sort the BSD that's added for the catalog -- it should always be last.
+
+ Rev 1.39 27 Jul 1993 12:41:46 MARINA
+enable c++
+
+ Rev 1.38 07 Jun 1993 08:11:12 MIKEP
+fix warnings due to typo.
+
+ Rev 1.37 15 May 1993 13:47:12 MIKEP
+Change to code to fix bug in cayman when changing catalog data path live.
+
+ Rev 1.36 02 May 1993 17:36:38 MIKEP
+add call to support catalog data path changing.
+
+ Rev 1.35 26 Apr 1993 08:51:08 MIKEP
+Add numerous changes to fully support the font case selection
+for various file system types. Also add refresh for tapes window
+and sorting of tapes window.
+
+ Rev 1.34 26 Jan 1993 17:18:20 MIKEP
+change to .D?? catalog names
+
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+
+static INT VLM_CatalogSyncLess( VOID );
+static INT VLM_CatalogSyncMore( VOID );
+
+/***************************
+
+ The user through the ever more powerful features we provide has
+ dynamicly changed the catalog data path while the app is running.
+ We need to shutdown the old catalogs and then start up new ones.
+
+****************************/
+
+
+INT VLM_CatalogDataPathChanged( )
+{
+
+ // Shutdown the old catalo unit.
+
+ QTC_Deinit( (INT) FALSE );
+
+ // Init a new one.
+
+ QTC_Init( CDS_GetCatDataPath(), NULL );
+
+ // Now have the VLM area see what files are lying in
+ // the current catalog directory.
+
+ VLM_LookForCatalogFiles( );
+
+ // Add tape in the drive to new data location
+
+ if ( VLM_GetDriveStatus( NULL ) == VLM_VALID_TAPE ) {
+ VLM_AddTapeIfUnknown( FALSE );
+ }
+
+ // Align the VLM and QTC queues. And update screen.
+
+ VLM_CatalogSync( VLM_SYNCMORE|VLM_SYNCLESS );
+
+ return( SUCCESS );
+}
+
+
+/************************
+
+ The user wishes to fully catalog a single set.
+
+ Call do_catalog with the right parameters and then sync the windows.
+
+*************************/
+
+
+INT VLM_CatalogSet(
+UINT32 tape_fid,
+INT16 tape_num,
+INT16 bset_num )
+{
+
+ do_catalog( tape_fid,
+ tape_num,
+ bset_num );
+
+ VLM_CatalogSync( VLM_SYNCMORE );
+
+ return( SUCCESS );
+}
+
+
+
+/**********************
+
+ NAME : VLM_LookForCatalogFiles
+
+ DESCRIPTION :
+
+ Used at startup time to go out and look for any catalog files that we
+ need to read in.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_LookForCatalogFiles( )
+{
+ VLM_FIND_PTR vlm_find = NULL;
+ CHAR *path;
+ CHAR file[ VLM_MAXFNAME ];
+
+ path = malloc( strsize( CDS_GetCatDataPath() ) + 256 );
+
+ if ( path ) {
+#ifndef UNICODE
+ sprintf( path, TEXT("%s????????.D??"), CDS_GetCatDataPath() );
+#else //UNICODE
+ sprintf( path, TEXT("%s????????.U??"), CDS_GetCatDataPath() );
+#endif //UNICODE
+
+ vlm_find = VLM_FindFirst( path, VLMFIND_NORMAL, file );
+
+ if ( vlm_find != NULL ) {
+
+ do {
+
+ QTC_LoadBsetInfo( file, NULL );
+
+ } while ( VLM_FindNext( vlm_find, file ) );
+ }
+
+ VLM_FindClose( &vlm_find );
+ free( path );
+ }
+}
+
+
+
+
+/*
+ A catalog operation has occurred which could have changed the known tapes
+ and bsets lists. So we need to update the VLM's list of tapes and bsets
+ to match the catalog's list.
+*/
+
+VOID VLM_CatalogSync( INT msg )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ INT16 tape_seq_num;
+
+ // This code takes advantage of the fact that only whole tapes go
+ // away. By erase or a replace operation.
+
+ if ( msg & VLM_SYNCLESS ) {
+
+ // Operation could have removed stuff from the catalogs.
+
+ VLM_CatalogSyncLess();
+ }
+
+ if ( msg & VLM_SYNCMORE ) {
+
+ // Operation could have added stuff to the catalogs.
+
+ VLM_CatalogSyncMore();
+ }
+
+ // Completely update both lists.
+
+ if ( !IsWindow(gb_tapes_win) ) {
+ return ;
+ }
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = (APPINFO_PTR)WM_GetAppPtr( gb_tapes_win );
+
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pTreeList, 0 );
+
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pFlatList, 0 );
+
+ // Set the anchor item.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)appinfo->open_tape );
+ return;
+}
+
+
+
+
+static INT VLM_CatalogSyncLess( )
+{
+ QTC_BSET_PTR qtc_bset;
+ TAPE_OBJECT_PTR vlm_tape;
+ BSET_OBJECT_PTR vlm_bset;
+ BSET_OBJECT_PTR temp_bset;
+
+ // Get rid of any tapes/bsets that no longer exist in the QTC.
+
+ vlm_tape = VLM_GetFirstTAPE( );
+
+ while ( vlm_tape != NULL ) {
+
+ qtc_bset = QTC_FindBset( vlm_tape->tape_fid, (INT16)-1, (INT16)-1 );
+
+ if ( qtc_bset == NULL && ! TAPE_GetFake( vlm_tape ) ) {
+
+ // NO bsets found for this whole tape, so yank it.
+
+ VLM_RemoveTape( vlm_tape->tape_fid, (INT16)-1, FALSE );
+
+ vlm_tape = VLM_GetFirstTAPE( );
+ }
+ else {
+
+ // They could have yanked only 1 tape from a multitape
+ // family. Handle that case.
+
+ vlm_bset = VLM_GetFirstBSET( &vlm_tape->bset_list );
+
+ while ( vlm_bset != NULL ) {
+
+ temp_bset = vlm_bset;
+
+ vlm_bset = VLM_GetNextBSET( vlm_bset );
+
+ // See if this set exists at all anymore.
+
+ qtc_bset = QTC_FindBset( temp_bset->tape_fid, (INT16)-1, temp_bset->bset_num );
+
+ if ( qtc_bset == NULL ) {
+
+ // remove the vlm set from this tape.
+
+ VLM_RemoveBset( temp_bset->tape_fid, (INT16)-1, temp_bset->bset_num, FALSE );
+ }
+ }
+
+ // Move to the next tape.
+
+ vlm_tape = VLM_GetNextTAPE( vlm_tape );
+ }
+
+ }
+
+ return( SUCCESS );
+}
+
+
+static INT VLM_CatalogSyncMore( )
+{
+ QTC_BSET_PTR bset;
+ QTC_TAPE_PTR tape;
+
+ /*
+ Now do it the other way around and make sure that we add
+ any that are in the QTC and not the VLM.
+ Calling VLM_AddBset() twice doesn't hurt, it's just slow.
+ */
+
+ tape = QTC_GetFirstTape( );
+
+ while ( tape != NULL ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ // WM_MultiTask();
+
+ VLM_AddBset( bset->tape_fid,
+ (INT16)bset->tape_seq_num,
+ (INT16)bset->bset_num, bset, FALSE );
+
+ bset = QTC_GetNextBset( bset );
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( SUCCESS );
+}
+
+
+
+/**************
+ This function will create a new BSD for the drive the catalogs are being
+ kept on and insert it at the end of the BSD list. This allows us to
+ include the catalogs in a backup. An FSE is inserted for each of the
+ known catalog files. If the backup operation is a REPLACE and not an
+ APPEND then another catalog file will be created during the backup and
+ it will need to be added also.
+**************/
+
+INT VLM_IncludeCatalogs( )
+{
+ QTC_TAPE_PTR tape;
+ BSD_PTR bsd_ptr;
+ BE_CFG_PTR bec_config;
+ GENERIC_DLE_PTR dle_ptr;
+ DATE_TIME sortdate;
+ CHAR *path;
+ INT16 path_size;
+ BOOLEAN dummy;
+ CHAR bset_name[ MAX_BSET_NAME_SIZE ];
+
+
+ path_size = strsize( CDS_GetCatDataPath() );
+
+ path = malloc( path_size );
+ if ( path == NULL ) {
+ return( FAILURE );
+ }
+
+
+ // We need to know the drive the catalogs are on
+ // and create a new bsd for it. Set the date for
+ // the year 2025 so that it will be added to the
+ // end of the bsd list. Then add FSE's for all
+ // the known catalog files. If a new catalog file
+ // is created or removed during the backup operation
+ // then the FSE list will need to be updated also.
+
+ sortdate.date_valid = TRUE;
+ sortdate.year = 2025; /* year since 1900 */
+ sortdate.month = 10; /* 1 to 12 */
+ sortdate.day = 16; /* 1 to 31 */
+ sortdate.hour = 0; /* 0 to 23 */
+ sortdate.minute = 0; /* 0 to 59 */
+ sortdate.second = 0; /* 0 to 59 */
+ sortdate.day_of_week = 1; /* 1 to 7 for Sunday to Saturday */
+
+ /* find the dle based on the user path */
+
+ if ( FS_ParsePath( dle_list, CDS_GetCatDataPath(), &dle_ptr, path,
+ &path_size, NULL, &dummy ) != SUCCESS ) {
+ free( path );
+ return( FAILURE );
+ }
+
+ free( path );
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ BEC_SetSortBSD( bec_config, FALSE );
+
+ BSD_Add( bsd_list, &bsd_ptr, bec_config, NULL,
+ dle_ptr, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, &sortdate );
+
+
+ if ( bsd_ptr == NULL ) {
+ return( FAILURE );
+ }
+
+ /* get name for the catalog set and update the bsd */
+
+ RSM_StringCopy( IDS_CATALOGSETNAME, bset_name, MAX_BSET_NAME_SIZE );
+
+ BSD_SetBackupDescript( bsd_ptr, (INT8_PTR)bset_name, (INT16)strsize(bset_name) );
+ BSD_SetBackupLabel( bsd_ptr, (INT8_PTR)bset_name, (INT16)strsize(bset_name) );
+ BSD_SetFullyCataloged( bsd_ptr, TRUE );
+ BSD_SetTapePos( bsd_ptr, (UINT32)-1L, (UINT16)-1, (UINT16)-1 );
+ BSD_SetTHW( bsd_ptr, thw_list );
+
+ tape = QTC_GetFirstTape();
+
+ while ( tape ) {
+ VLM_AddFileForInclude( tape->tape_fid, tape->tape_seq_num, FALSE );
+ tape = QTC_GetNextTape( tape );
+ }
+
+ return( SUCCESS );
+}
+
+
+INT VLM_AddFileForInclude(
+UINT32 tape_fid,
+INT16 tape_seq_num,
+BOOLEAN wild_flag )
+{
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse_ptr;
+ CHAR_PTR filename;
+ CHAR_PTR path;
+ CHAR_PTR buffer;
+ DATE_TIME_PTR sortdate;
+ INT16 path_size;
+
+
+ // We need to add the filename for the family id and sequence number
+ // passed in. We first locate the right BSD by matching the 2025
+ // date. If it is found, we add the QTC filename as an include fse.
+ // If the wild flag is set, we make the sequence number a wild card.
+ // ie - famid.C??
+
+ // See if we can find the right BSD
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ // Look for correct BSD
+
+ while ( bsd_ptr != NULL ) {
+
+ sortdate = BSD_ViewDate( bsd_ptr );
+
+ if ( sortdate != NULL ) {
+ if ( sortdate->date_valid ) {
+ if ( sortdate->year == 2025 ) {
+ break;
+ }
+ }
+ }
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ // Not really a bad error, happens sometimes.
+
+ if ( bsd_ptr == NULL ) {
+ return( FAILURE );
+ }
+
+ // 512 should be way more than enough to handle "xxxxxxxx.D01"
+
+ buffer = malloc( strsize( CDS_GetCatDataPath() ) + 512 );
+
+ if ( buffer == NULL ) {
+ return( FAILURE );
+ }
+
+ QTC_GetFileName( tape_fid, tape_seq_num, buffer );
+
+ /* locate the filename at the end of the buffer */
+
+ filename = buffer;
+ while ( *filename ) filename++;
+ while ( *filename != TEXT('\\') ) filename--;
+ *filename = 0; /* set the end of the path portion to null */
+ filename++;
+
+ /* if the wild_flag is set, make the sequence number wild cards */
+ /* QTC names are always 8.3 */
+
+ if ( wild_flag == USE_WILD_CARD ) {
+ *(filename + 10) = TEXT('?');
+ *(filename + 11) = TEXT('?');
+ }
+
+ /* make path NULL impregnated and calculate the size */
+
+ path = &buffer[ 2 ];
+ path_size = 1;
+
+ if ( *path != 0 ) {
+ path++;
+ while( buffer[path_size+2] != 0 ) {
+ if( buffer[path_size+2] == TEXT('\\') ) {
+ buffer[path_size+2] = 0 ;
+ }
+ path_size++ ;
+ }
+ }
+
+ path_size *= sizeof(CHAR); // convert to bytes
+
+ /* create and add the bsd */
+
+ if ( BSD_CreatFSE( &fse_ptr, INCLUDE, (INT8_PTR)path, path_size,
+ (INT8_PTR)filename, (INT16)strsize( filename ),
+ wild_flag, FALSE ) ) {
+ return( FAILURE );
+ }
+
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+
+ return( SUCCESS );
+
+}
+
+
+INT VLM_CheckForCatalogError( QTC_BUILD_PTR qtc_ptr )
+{
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+
+ if ( qtc_ptr == NULL ) {
+ return( SUCCESS );
+ }
+
+ switch ( QTC_GetErrorCondition( qtc_ptr ) ) {
+
+ case SUCCESS:
+ return( SUCCESS );
+ break;
+
+ case QTC_DISK_FULL:
+ RSM_StringCopy ( IDS_VLMCATFULLERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case QTC_OPEN_FAILED:
+ RSM_StringCopy ( IDS_VLMCATOPENERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case QTC_WRITE_FAILED:
+ RSM_StringCopy ( IDS_VLMCATWRITEERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case QTC_READ_FAILED:
+ RSM_StringCopy ( IDS_VLMCATREADERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case QTC_SEEK_FAILED:
+ RSM_StringCopy ( IDS_VLMCATSEEKERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case QTC_NO_MEMORY:
+ RSM_StringCopy ( IDS_VLMCATMEMERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case QTC_NO_FILE_HANDLES:
+ RSM_StringCopy ( IDS_VLMCATHANDLEERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+
+ default:
+ RSM_StringCopy ( IDS_VLMCATUNKNOWNERROR, text, MAX_UI_RESOURCE_LEN );
+ break;
+ }
+
+ RSM_StringCopy ( IDS_VLMCATERROR, title, MAX_UI_RESOURCE_LEN );
+ WM_MsgBox( title, text, WMMB_OK, WMMB_ICONINFORMATION );
+
+ return( FAILURE );
+}
diff --git a/private/utils/ntbackup/src/vlm_disk.c b/private/utils/ntbackup/src/vlm_disk.c
new file mode 100644
index 000000000..db5f99a28
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_disk.c
@@ -0,0 +1,1180 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_DISK.C
+
+ Description:
+
+ This file contains the functions needed to maintain the
+ selections in the DISKS window. These are LOCAL or
+ MAPPED drives.
+
+ $Log: G:\UI\LOGFILES\VLM_DISK.C_V $
+
+ Rev 1.43.1.2 26 Jan 1994 11:17:08 Glenn
+Added CD ROM support.
+
+ Rev 1.43.1.1 08 Dec 1993 11:15:16 MikeP
+very deep pathes and unicode
+
+ Rev 1.43.1.0 21 Sep 1993 15:56:52 BARRY
+Unicode fix.
+
+ Rev 1.43 27 Jul 1993 12:58:20 MARINA
+enable c++
+
+ Rev 1.42 26 Jul 1993 17:25:44 MIKEP
+one last time at refresh fix
+
+ Rev 1.41 26 Jul 1993 16:52:30 MIKEP
+fix drive refresh if same letter, but diff map
+
+ Rev 1.40 20 Jul 1993 11:07:02 MIKEP
+
+ Rev 1.39 07 May 1993 18:18:40 MIKEP
+remove cdrom ifdef
+
+ Rev 1.38 04 May 1993 10:18:34 Aaron
+Changed condition from !OS_WIN32 to OS_WIN32 && !OEM_MSOFT
+
+ Rev 1.37 23 Apr 1993 10:17:06 MIKEP
+Fix invalid window handle reference epr and upper/lower case
+support.
+
+ Rev 1.36 25 Feb 1993 12:34:06 STEVEN
+fix more stuff
+
+ Rev 1.35 24 Feb 1993 11:07:06 STEVEN
+make net drive icon the default
+
+ Rev 1.34 11 Nov 1992 16:35:52 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.33 01 Nov 1992 16:11:12 DAVEV
+Unicode changes
+
+ Rev 1.32 30 Oct 1992 15:46:44 GLENN
+Added Frame and MDI Doc window size and position saving and restoring.
+
+ Rev 1.31 07 Oct 1992 15:02:58 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.30 04 Oct 1992 19:41:56 DAVEV
+Unicode Awk pass
+
+ Rev 1.29 03 Sep 1992 13:17:30 MIKEP
+nt fixes for display
+
+ Rev 1.27 29 Jul 1992 09:41:56 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.26 22 Jul 1992 10:16:48 MIKEP
+warning fixes
+
+ Rev 1.25 20 Jul 1992 09:59:08 JOHNWT
+gas gauge display work
+
+ Rev 1.24 10 Jul 1992 08:36:42 JOHNWT
+more gas guage work
+
+ Rev 1.23 08 Jul 1992 15:32:06 STEVEN
+Unicode BE changes
+
+ Rev 1.22 06 Jul 1992 10:36:38 MIKEP
+started adding ramdrive and cdrom icons
+
+ Rev 1.21 14 May 1992 18:05:14 MIKEP
+nt pass 2
+
+ Rev 1.20 06 May 1992 14:41:08 MIKEP
+unicode pass two
+
+ Rev 1.19 04 May 1992 13:39:52 MIKEP
+unicode pass 1
+
+ Rev 1.18 24 Mar 1992 14:42:30 DAVEV
+OEM_MSOFT: Removed Servers windows and associated code
+
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*
+ Local function prototypes.
+*/
+
+static BYTE VLM_VlmGetSelect( VLM_OBJECT_PTR );
+static VOID_PTR VLM_VlmSetSelect( VLM_OBJECT_PTR, BYTE );
+static VOID_PTR VLM_VlmSetTag( VLM_OBJECT_PTR, BYTE );
+static BYTE VLM_VlmGetTag( VLM_OBJECT_PTR );
+static USHORT VLM_VlmGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_VlmGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_VlmGetPrevItem( VLM_OBJECT_PTR );
+static VOID_PTR VLM_VlmGetNextItem( VLM_OBJECT_PTR );
+static VOID_PTR VLM_VlmGetObjects( VLM_OBJECT_PTR );
+static BOOLEAN VLM_VlmSetObjects( VLM_OBJECT_PTR, WORD, WORD );
+static VOID VLM_VlmSetItemFocus( VLM_OBJECT_PTR );
+
+
+// used to tell DLM how wide to make columns
+
+static INT mwMaxVolumeLabelLength = 0;
+
+/*
+ Fast access to primary windows.
+*/
+
+
+HWND gb_servers_win = (HWND)NULL;
+HWND gb_tapes_win = (HWND)NULL;
+HWND gb_disks_win = (HWND)NULL;
+HWND gb_search_win = (HWND)NULL;
+
+#ifdef OEM_EMS
+Q_HEADER gq_exchange_win;
+#endif
+
+
+VOID VLM_SetMaxVolumeLabelLength( Q_HEADER_PTR vlm_list )
+{
+ VLM_OBJECT_PTR vlm;
+
+ // Look for VLM drives we have that no longer exist.
+
+ vlm = VLM_GetFirstVLM( vlm_list );
+
+ // kludge
+
+ mwMaxVolumeLabelLength = 0;
+
+ while ( vlm != NULL ) {
+
+ if ( (INT)strlen( vlm->label ) > mwMaxVolumeLabelLength ) {
+ mwMaxVolumeLabelLength = strlen( vlm->label );
+ }
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+}
+
+
+/********************
+
+ Name: VLM_DisksSync
+
+ Description:
+
+ The user has done a refresh call and we have performed a DLE_Update
+ call. Now we need to see which VLM's are no longer around and get
+ rid of them. We also need to check and see if any new ones popped
+ up, which need to be included.
+
+ Returns: nothing
+
+*********************/
+
+VOID VLM_DisksSync( )
+{
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR temp_vlm;
+ GENERIC_DLE_PTR dle;
+ WININFO_PTR wininfo;
+ BSD_PTR bsd_ptr;
+ BOOLEAN change_made = FALSE;
+ INT16 vlm_count;
+ CHAR szVolName[ 256 ];
+
+
+ wininfo = WM_GetInfoPtr( gb_disks_win );
+
+ // Look for VLM drives we have that no longer exist.
+
+ vlm = VLM_GetFirstVLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( vlm != NULL ) {
+
+ temp_vlm = vlm;
+
+ vlm = VLM_GetNextVLM( vlm );
+
+ DLE_FindByName( dle_list, VLM_GetName( temp_vlm ), ANY_DRIVE_TYPE, &dle );
+
+
+ if ( dle != NULL ) {
+
+ // make sure it's the same one.
+
+ VLM_GetDriveLabel( dle, szVolName, sizeof( szVolName )/sizeof(CHAR) );
+
+ if ( stricmp( szVolName, VLM_GetLabel( temp_vlm ) ) ) {
+
+ // Yes there is still a G: drive but it is not mapped
+ // to the same place. Force it to refresh.
+
+ dle = NULL;
+ }
+ }
+
+
+ if ( dle == NULL ) {
+
+ // Drive went away so remove it.
+
+ change_made = TRUE;
+
+ bsd_ptr = BSD_FindByName( bsd_list, VLM_GetName( temp_vlm ) );
+
+ if ( bsd_ptr != NULL ) {
+
+ BSD_Remove( bsd_ptr );
+ }
+
+ RemoveQueueElem( WMDS_GetFlatList( wininfo ), &(temp_vlm->q_elem) );
+ free( temp_vlm );
+ }
+ }
+
+ // Look for new DLE's that aren't in the VLM queue.
+
+ vlm_count = QueueCount( WMDS_GetFlatList( wininfo ) );
+
+ VLM_BuildVolumeList( WMDS_GetFlatList( wininfo ), wininfo );
+
+ if ( vlm_count != QueueCount( WMDS_GetFlatList( wininfo ) ) ) {
+ change_made = TRUE;
+ }
+
+ if ( change_made ) {
+
+ DLM_Update( gb_disks_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)WMDS_GetFlatList( wininfo ), 0 );
+ }
+}
+
+
+/********************
+
+ Name: VLM_UpdateDiskStatus
+
+ Description:
+
+ Set the checkbox on the disk to match the BSD status.
+
+ Returns: nothing
+
+*********************/
+
+VOID VLM_UpdateDiskStatus(
+VLM_OBJECT_PTR vlm ) // I - vlm of disk to update
+{
+ UINT16 new_status = 0;
+ BSD_PTR bsd;
+ GENERIC_DLE_PTR dle;
+
+
+ DLE_FindByName( dle_list, VLM_GetName( vlm ), ANY_DRIVE_TYPE, &dle );
+
+ if ( dle != NULL ) {
+
+ bsd = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd != NULL ) {
+
+ switch ( BSD_GetMarkStatus( bsd ) ) {
+
+ case SOME_SELECTED:
+ new_status = INFO_SELECT | INFO_PARTIAL;
+ break;
+
+ case ALL_SELECTED:
+ new_status = INFO_SELECT;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ if ( (UINT16)( VLM_GetStatus( vlm ) & (UINT16)(INFO_SELECT|INFO_PARTIAL) ) !=
+ new_status ) {
+
+ VLM_SetStatus( vlm, VLM_GetStatus( vlm ) & (UINT16)~( INFO_SELECT|INFO_PARTIAL ) );
+ VLM_SetStatus( vlm, VLM_GetStatus( vlm ) | (UINT16)new_status );
+
+ DLM_Update( gb_disks_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+ }
+
+}
+
+
+
+/************
+
+ Name: VLM_SelectDisks
+
+ Description:
+
+ The user has tagged one or more drives and hit the select or deselect
+ button to do them all at once.
+
+ Returns: Nothing
+
+*****/
+
+VOID VLM_SelectDisks(
+BYTE attr ) // I - select or deselect ?
+{
+ VLM_OBJECT_PTR vlm;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( gb_disks_win );
+
+ // Have the display list manager update our tags for us.
+
+ DLM_UpdateTags( gb_disks_win, DLM_FLATLISTBOX );
+
+
+ // Now look for the ones that are selected.
+
+ vlm = VLM_GetFirstVLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( vlm != NULL ) {
+
+ if ( VLM_GetStatus( vlm ) & INFO_TAGGED ) {
+
+ VLM_VlmSetSelect( vlm, attr ); // select the drive
+ }
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+}
+
+
+/*********************
+
+ Name: VLM_ClearAllDiskSelections
+
+ Description:
+
+ Run through the disks queue and make all the drives check boxes clear.
+
+ Returns: Nothing.
+
+**********************/
+
+VOID VLM_ClearAllDiskSelections( )
+{
+ VLM_OBJECT_PTR vlm;
+ WININFO_PTR wininfo;
+
+ // Get the wininfo, to get our queue header
+
+ wininfo = WM_GetInfoPtr( gb_disks_win );
+
+
+ // Loop through entire queue.
+
+ vlm = VLM_GetFirstVLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( vlm != NULL ) {
+
+
+ // If it's set, clear it.
+
+ if ( VLM_GetStatus( vlm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ VLM_SetStatus( vlm, VLM_GetStatus( vlm ) & (UINT16)~(INFO_PARTIAL|INFO_SELECT) );
+
+ DLM_Update( gb_disks_win, DLM_FLATLISTBOX, WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+
+ }
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+}
+
+
+/*********************
+
+ Name: VLM_DisksListCreate
+
+ Description:
+
+ Create the window and lists for the Disks window.
+
+ Returns: SUCCESS or FAILURE.
+
+**********************/
+
+BOOLEAN VLM_DisksListCreate()
+{
+ WININFO_PTR wininfo;
+ Q_HEADER_PTR vlm_list;
+ DLM_INIT dlm;
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+ // Initialize our queue.
+
+ vlm_list = (Q_HEADER_PTR)malloc( sizeof(Q_HEADER) );
+
+ if ( vlm_list == NULL ) {
+ return( FAILURE );
+ }
+
+ InitQueue( vlm_list );
+
+ // Create the window.
+
+ wininfo = ( WININFO_PTR )malloc( sizeof( WININFO ) );
+
+ if ( wininfo == NULL ) {
+ return( FAILURE );
+ }
+
+ // Build our queue from the DLE list created by the backup engine.
+
+ VLM_BuildVolumeList( vlm_list, wininfo );
+
+ /* fill in the wininfo structure. */
+
+ WMDS_SetWinType( wininfo, WMTYPE_DISKS );
+ WMDS_SetCursor( wininfo, RSM_CursorLoad( IDRC_HSLIDER ) );
+ WMDS_SetDragCursor( wininfo, 0 );
+ WMDS_SetIcon( wininfo, RSM_IconLoad( IDRI_DISKS ) );
+ WMDS_SetWinHelpID( wininfo, 0 );
+ WMDS_SetStatusLineID( wininfo, 0 );
+ WMDS_SetRibbonState( wininfo, 0 );
+ WMDS_SetRibbon( wininfo, NULL );
+ WMDS_SetFlatList( wininfo, (Q_HEADER_PTR)vlm_list );
+ WMDS_SetAppInfo( wininfo, NULL );
+
+ /* Fill in the display manager stuff. */
+
+ DLM_ListBoxType( &dlm, DLM_FLATLISTBOX );
+ DLM_Mode( &dlm, DLM_MULTICOLUMN );
+ DLM_Display( &dlm, DLM_LARGEBITMAPSLTEXT );
+ DLM_DispHdr( &dlm, vlm_list );
+ DLM_TextFont( &dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &dlm, VLM_VlmGetItemCount );
+ DLM_GetFirstItem( &dlm, VLM_VlmGetFirstItem );
+ DLM_GetNext( &dlm, VLM_VlmGetNextItem );
+ DLM_GetPrev( &dlm, VLM_VlmGetPrevItem );
+ DLM_GetTag( &dlm, VLM_VlmGetTag );
+ DLM_SetTag( &dlm, VLM_VlmSetTag );
+ DLM_GetSelect( &dlm, VLM_VlmGetSelect );
+ DLM_SetSelect( &dlm, VLM_VlmSetSelect );
+ DLM_GetObjects( &dlm, VLM_VlmGetObjects );
+ DLM_SetObjects( &dlm, VLM_VlmSetObjects );
+ DLM_SSetItemFocus( &dlm, VLM_VlmSetItemFocus );
+
+
+ // Tell the display manager what the maximum number of objects
+ // we will tell him to display per item. His minimum is 6.
+
+ DLM_MaxNumObjects( &dlm, 6 );
+
+
+
+ DLM_DispListInit( wininfo, &dlm );
+
+ /* Create the window. */
+
+ RSM_StringCopy ( IDS_VLMDISKTITLE, title, MAX_UI_RESOURCE_LEN );
+
+ gb_disks_win = WM_Create( (WORD)(WM_MDIPRIMARY | WM_FLATLISTMC | (WORD)CDS_GetDiskInfo ( pCDS ).nSize),
+ title,
+ (LPSTR)NULL,
+ (INT)CDS_GetDiskInfo ( pCDS ).x,
+ (INT)CDS_GetDiskInfo ( pCDS ).y,
+ (INT)CDS_GetDiskInfo ( pCDS ).cx,
+ (INT)CDS_GetDiskInfo ( pCDS ).cy,
+ wininfo );
+
+ if ( gb_disks_win == (HWND)NULL ) {
+ return( FAILURE );
+ }
+
+ /* Start up the Display Manager. */
+
+ DLM_DispListProc( WMDS_GetWinFlatList( wininfo ), 0, NULL );
+
+ if ( VLM_GetFirstVLM( vlm_list ) ) {
+ DLM_SetAnchor( WMDS_GetWinFlatList( wininfo ),
+ 0,
+ (LMHANDLE)VLM_GetFirstVLM( vlm_list ) );
+ }
+
+ return( SUCCESS );
+}
+
+
+
+/***************************************************
+
+ Name: VLM_GetFirstVLM
+
+ Description:
+
+ Get the first drive element off a queue of known drives.
+
+ Returns: Pointer to first drive.
+
+*****************************************************/
+
+VLM_OBJECT_PTR VLM_GetFirstVLM(
+Q_HEADER_PTR qhdr) // I - queue header to work from
+{
+ Q_ELEM_PTR q_elem;
+
+ if ( qhdr != NULL ) {
+
+ q_elem = QueueHead( qhdr );
+
+ if ( q_elem != NULL ) {
+ return ( VLM_OBJECT_PTR )( q_elem->q_ptr ) ;
+ }
+ }
+
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetNextVLM
+
+ Description:
+
+ Get the next drive element off a queue of known drives.
+
+ Returns: Pointer to next drive element or NULL.
+
+*****************************************************/
+
+VLM_OBJECT_PTR VLM_GetNextVLM(
+VLM_OBJECT_PTR vlm ) // I - current vlm
+{
+ Q_ELEM_PTR q_elem;
+
+ q_elem = QueueNext( &(vlm->q_elem) );
+
+ if ( q_elem != NULL ) {
+ return (VLM_OBJECT_PTR )( q_elem->q_ptr ) ;
+ }
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetPrevVLM
+
+ Description:
+
+ Get the previous drive element off a queue of known drives.
+
+ Returns: Pointer to next drive element or NULL.
+
+*****************************************************/
+
+VLM_OBJECT_PTR VLM_GetPrevVLM(
+VLM_OBJECT_PTR vlm ) // I - current vlm
+{
+ Q_ELEM_PTR q_elem;
+
+ q_elem = QueuePrev( &(vlm->q_elem) );
+
+ if ( q_elem != NULL ) {
+ return ( VLM_OBJECT_PTR )( q_elem->q_ptr );
+ }
+
+ return( NULL );
+}
+
+
+/***************************************************
+
+ Name: VLM_VlmSetSelect
+
+ Description:
+
+ The callback function for the display manager to tell me that the
+ selection status on a disk has changed.
+
+*****************************************************/
+
+static VOID_PTR VLM_VlmSetSelect(
+VLM_OBJECT_PTR vlm, // I - vlm to change
+BYTE attr ) // I - what to change it to
+{
+ CHAR title[ VLM_BUFFER_SIZE ]; // this works with deep pathes
+ GENERIC_DLE_PTR dle;
+ WININFO_PTR wininfo;
+ FSYS_HAND temp_fsh;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse_ptr;
+ HWND win;
+ INT16 error;
+ INT length;
+ BOOL all_subdirs;
+ BE_CFG_PTR bec_config;
+ UINT16 status;
+ BOOLEAN open_win;
+ SLM_OBJECT_PTR slm;
+ INT16 bset_num;
+ QTC_BSET_PTR qtc_bset;
+ QTC_HEADER_PTR header;
+
+#ifdef OEM_EMS
+ UNREFERENCED_PARAMETER( slm );
+ UNREFERENCED_PARAMETER( qtc_bset );
+ UNREFERENCED_PARAMETER( header );
+ UNREFERENCED_PARAMETER( bset_num );
+#endif
+
+ all_subdirs = CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ // change the status
+
+ if ( attr ) {
+
+ if ( all_subdirs ) {
+ status = INFO_SELECT;
+ }
+ else {
+ status = (INFO_PARTIAL|INFO_SELECT);
+ }
+ }
+ else {
+ status = 0;
+ }
+
+ if ( (UINT16)( VLM_GetStatus( vlm ) & (UINT16)(INFO_PARTIAL|INFO_SELECT)) != status ) {
+
+ VLM_SetStatus( vlm, VLM_GetStatus( vlm ) & (UINT16)~(INFO_PARTIAL|INFO_SELECT) );
+ VLM_SetStatus( vlm, VLM_GetStatus( vlm ) | (UINT16)status );
+
+ DLM_Update( gb_disks_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+ }
+
+ // Create an FSE entry for the backup engine
+
+ if ( attr ) {
+ error = BSD_CreatFSE( &fse_ptr, (INT16) INCLUDE,
+ (INT8_PTR)TEXT(""), (INT16)sizeof(CHAR),
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ (BOOLEAN)USE_WILD_CARD, (BOOLEAN) all_subdirs );
+ }
+ else {
+ error = BSD_CreatFSE( &fse_ptr, (INT16) EXCLUDE,
+ (INT8_PTR)TEXT(""), (INT16) sizeof(CHAR),
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ (BOOLEAN)USE_WILD_CARD, (BOOLEAN) TRUE );
+ }
+
+ if ( error ) {
+ return( NULL );
+ }
+
+ DLE_FindByName( dle_list, VLM_GetName( vlm ), ANY_DRIVE_TYPE, &dle );
+
+ if ( dle == NULL ) {
+ msassert( FALSE );
+ return( NULL );
+ }
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd_ptr == NULL ) {
+
+ // Do a quick attach/detach so that the backup engine knows
+ // the volume name.
+
+ if ( UI_AttachDrive( &temp_fsh, dle, FALSE ) ) {
+ return( NULL );
+ }
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+
+ BEC_UnLockConfig( bec_config );
+
+ BSD_Add( bsd_list, &bsd_ptr, bec_config,
+ NULL, dle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+
+ FS_DetachDLE( temp_fsh );
+ }
+
+ if ( bsd_ptr != NULL ) {
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+ }
+
+ // See if this drive has any open file display windows
+ // If we find one then all its entries will need updating
+
+ open_win = FALSE;
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ /* Is it a directory list ? */
+
+ if ( WMDS_GetWinType( wininfo ) == WMTYPE_DISKTREE ) {
+
+ WM_GetTitle( win, title, VLM_BUFFER_SIZE );
+
+ length = strlen( VLM_GetName( vlm ) );
+
+ if ( ! strnicmp( title, VLM_GetName( vlm ), length ) ) {
+
+ open_win = TRUE;
+
+ if ( attr ) {
+ VLM_SubdirListManager( win, SLM_SEL_ALL );
+ if ( bsd_ptr != NULL ) {
+ VLM_MatchSLMList( wininfo, bsd_ptr, FALSE );
+ }
+ }
+ else {
+ VLM_SubdirListManager( win, SLM_SEL_NONE );
+ VLM_DeselectAll( wininfo, FALSE );
+ }
+ break;
+ }
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ return(NULL);
+}
+
+/***************************************************
+
+ Name: VLM_VlmGetSelect
+
+ Description:
+
+ A callback function for the display manager to get the selection
+ status of a disk.
+
+*****************************************************/
+
+static BYTE VLM_VlmGetSelect(
+VLM_OBJECT_PTR vlm ) // I - vlm to get the status of
+{
+ if ( VLM_GetStatus( vlm ) & INFO_SELECT ) {
+ return( 1 );
+ }
+
+ return( 0 );
+}
+
+/***************************************************
+
+ Name: VLM_VlmSetTag
+
+ Description:
+
+ A callback function for the display manager to set the tag status
+ of a disk for me.
+
+*****************************************************/
+
+static VOID_PTR VLM_VlmSetTag(
+VLM_OBJECT_PTR vlm, // I - vlm to work with
+BYTE attr ) // I - what to set it to
+{
+ if ( attr ) {
+ VLM_SetStatus( vlm, VLM_GetStatus( vlm ) | (UINT16)INFO_TAGGED );
+ }
+ else {
+ VLM_SetStatus( vlm, VLM_GetStatus( vlm ) & (UINT16)~INFO_TAGGED );
+ }
+
+ return(NULL);
+}
+
+/***************************************************
+
+ Name: VLM_VlmGetTag
+
+ Description:
+
+ A callback function for the display manager to get the tag status
+ of a disk from me.
+
+*****************************************************/
+
+static BYTE VLM_VlmGetTag(
+VLM_OBJECT_PTR vlm ) // I - vlm to work with
+{
+ if ( VLM_GetStatus( vlm ) & INFO_TAGGED ) {
+ return( 1 );
+ }
+ return( 0 );
+}
+
+/***************************************************
+
+ Name: VLM_VlmGetItemCount
+
+ Description:
+
+ A callback function for the display manager to get the
+ number of displayable drives.
+
+*****************************************************/
+
+static USHORT VLM_VlmGetItemCount(
+Q_HEADER_PTR vlm_list ) // I - queue header to get count from
+{
+ return( QueueCount( vlm_list ) );
+}
+
+/***************************************************
+
+ Name: VLM_VlmGetFirstItem
+
+ Description:
+
+ A callback function for the display manager to get the first drive
+ to display.
+
+*****************************************************/
+
+static VOID_PTR VLM_VlmGetFirstItem(
+Q_HEADER_PTR vlm_list ) // I - queue to get first item from
+{
+ return( VLM_GetFirstVLM( vlm_list ) );
+}
+
+/***************************************************
+
+ Name: VLM_VlmGetPrevItem
+
+ Description:
+
+ A callback function for the display manager to get the previous
+ disk in a list of disks.
+
+*****************************************************/
+
+static VOID_PTR VLM_VlmGetPrevItem(
+VLM_OBJECT_PTR vlm ) // I - current vlm
+{
+ return( VLM_GetPrevVLM( vlm ) );
+}
+
+/***************************************************
+
+ Name: VLM_VlmGetNextItem
+
+ Description:
+
+ A callback function for the display manager to get the next
+ disk in a list of disks.
+
+*****************************************************/
+
+static VOID_PTR VLM_VlmGetNextItem(
+VLM_OBJECT_PTR vlm ) // I - current vlm
+{
+ return( VLM_GetNextVLM( vlm ) );
+}
+
+/***************************************************
+
+ Name: VLM_VlmGetObjects
+
+ Description:
+
+ A callback function for the display manager to get the object list
+ to display for a given disk.
+
+*****************************************************/
+
+static VOID_PTR VLM_VlmGetObjects(
+VLM_OBJECT_PTR vlm ) // I - current vlm
+{
+ BYTE_PTR memblk;
+ CHAR_PTR s;
+ DLM_ITEM_PTR item;
+ WORD type;
+
+
+ // get the buffer to fill for this window
+
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( WMDS_GetWinFlatList( vlm->XtraBytes ) );
+
+
+ /* Store the number of items to display in the first two bytes. */
+
+
+#ifdef OS_WIN32
+ *memblk = 4;
+#else
+ *memblk = 3;
+#endif
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( VLM_GetStatus( vlm ) & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( VLM_GetStatus( vlm ) & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up Bitmap, ie. Floppy, Hard, Network. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+
+ s = VLM_GetName( vlm );
+
+#ifdef OS_WIN32
+ {
+ CHAR dir[4] = TEXT(" :\\");
+
+ dir[ 0 ] = *s;
+ type = (WORD)GetDriveType( dir );
+ }
+#else
+
+ type = (WORD)GetDriveType( (INT)(toupper( *s ) - TEXT('A')) );
+
+#endif
+
+ switch ( type ) {
+
+ case DRIVE_REMOVABLE:
+ DLM_ItemwId( item ) = IDRBM_FLOPPYDRIVE;
+ break;
+
+ case DRIVE_FIXED:
+ DLM_ItemwId( item ) = IDRBM_HARDDRIVE;
+ break;
+
+ case DRIVE_CDROM:
+ DLM_ItemwId( item ) = IDRBM_CDROM;
+ break;
+
+ case DRIVE_REMOTE:
+ default:
+ DLM_ItemwId( item ) = IDRBM_NETDRIVE;
+ break;
+
+ }
+
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text string to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = 2;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)vlm->name );
+
+#ifdef OS_WIN32
+ item++;
+ DLM_ItemcbNum( item ) = 4;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mwMaxVolumeLabelLength;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)vlm->label );
+#endif
+
+ return( memblk );
+}
+
+/***************************************************
+
+ Name: VLM_VlmSetObjects
+
+ Description:
+
+ A callback function for the display manager to tell me that the
+ user tried to do something with this drive.
+
+*****************************************************/
+
+static BOOLEAN VLM_VlmSetObjects(
+VLM_OBJECT_PTR vlm, // I - current vlm
+WORD operation, // I - operation the user did
+WORD ObjectNum ) // I - object he did it on
+{
+ HWND win;
+ VLM_OBJECT_PTR temp_vlm;
+ GENERIC_DLE_PTR dle;
+ WININFO_PTR wininfo;
+ CHAR title[ VLM_BUFFER_SIZE ]; // this works with deep pathes
+ BOOLEAN found = FALSE;
+ CHAR keyb_char;
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_vlm = vlm;
+
+ do {
+
+ temp_vlm = VLM_GetNextVLM( temp_vlm );
+
+ if ( temp_vlm != NULL ) {
+
+ if ( keyb_char == (CHAR)toupper( *VLM_GetName( temp_vlm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( temp_vlm ) ),
+ 0,
+ (LMHANDLE)temp_vlm );
+ return( TRUE );
+ }
+ }
+
+ } while ( temp_vlm != NULL );
+
+ temp_vlm = VLM_GetFirstVLM( WMDS_GetFlatList( VLM_GetXtraBytes( vlm ) ) );
+
+ while ( temp_vlm != NULL && temp_vlm != vlm ) {
+
+ if ( keyb_char == (CHAR)toupper( *VLM_GetName( temp_vlm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( temp_vlm ) ),
+ 0,
+ (LMHANDLE)temp_vlm );
+ return( TRUE );
+ }
+
+ temp_vlm = VLM_GetNextVLM( temp_vlm );
+ }
+
+ }
+
+
+ if ( ( operation == WM_DLMDBCLK ) &&
+ ( ObjectNum >= 2 ) ) {
+
+ /*
+ If a hierarchical exists for this drive then make it active
+ else create one by calling SubdirListCreate().
+ */
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( WMDS_GetWinType( wininfo ) == WMTYPE_DISKTREE ) {
+
+ WM_GetTitle( win, title, VLM_BUFFER_SIZE );
+
+ if ( ! strnicmp( title,
+ VLM_GetName( vlm ),
+ strlen( VLM_GetName( vlm ) ) ) ) {
+ found = TRUE;
+ WM_DocActivate( win );
+ break;
+ }
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ DLE_FindByName( dle_list, VLM_GetName( vlm ), ANY_DRIVE_TYPE, &dle );
+
+ if ( ! found ) {
+ WM_ShowWaitCursor( TRUE );
+ VLM_SubdirListCreate( dle, (UINT16)0, (UINT16)0, (UINT16)0, gb_disks_win );
+ WM_ShowWaitCursor( FALSE );
+ }
+ }
+
+ return( FALSE );
+}
+
+/*********************
+
+ Name: VLM_VlmSetItemFocus
+
+ Description:
+
+ Update the status line with the drive name for the active drive.
+
+ Returns:
+
+**********************/
+
+static VOID VLM_VlmSetItemFocus( VLM_OBJECT_PTR vlm )
+{
+#ifndef OS_WIN32
+ GENERIC_DLE_PTR dle;
+ CHAR buffer[ VLM_BUFFER_SIZE ]; // this works with deep pathes
+
+ if ( vlm == NULL ) { // Safety precaution
+ return;
+ }
+
+ if ( strlen( VLM_GetLabel( vlm ) ) ) {
+
+ STM_DrawText( VLM_GetLabel( vlm ) );
+
+ }
+ else {
+
+ DLE_FindByName( dle_list, VLM_GetName( vlm ), ANY_DRIVE_TYPE, &dle );
+
+ if ( dle == NULL ) {
+ return;
+ }
+
+ if ( DLE_SizeofVolName( dle ) ) {
+
+ DLE_GetVolName( dle, buffer );
+
+ STM_DrawText( buffer );
+ }
+ }
+#endif
+}
diff --git a/private/utils/ntbackup/src/vlm_file.c b/private/utils/ntbackup/src/vlm_file.c
new file mode 100644
index 000000000..232738578
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_file.c
@@ -0,0 +1,3496 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_FILE.C
+
+ Description:
+
+ This file contains most of the code for processing file lists
+ in the right hand window.
+
+ $Log: J:/UI/LOGFILES/VLM_FILE.C_V $
+
+ Rev 1.87.1.3 16 Mar 1994 15:35:16 GREGG
+Fixed memory leak during file selection.
+
+ Rev 1.87.1.2 14 Jan 1994 14:36:48 MIKEP
+fix refresh and up arrow display
+
+ Rev 1.87.1.1 10 Jan 1994 11:15:24 MikeP
+fix epr 253 & 179
+
+ Rev 1.87.1.0 08 Dec 1993 10:52:30 MikeP
+very deep path support
+
+ Rev 1.87 16 Aug 1993 15:05:56 BARRY
+Don't do the search stuff for NTBACKUP.
+
+ Rev 1.86 01 Aug 1993 13:55:56 MIKEP
+fix info button trap on empty window
+
+ Rev 1.85 27 Jul 1993 23:20:02 MIKEP
+fix access denied handling
+
+ Rev 1.84 27 Jul 1993 13:22:44 MARINA
+enable c++
+
+ Rev 1.83 26 Jul 1993 16:31:32 MIKEP
+try again to display huge file sizes
+
+ Rev 1.82 23 Jul 1993 15:43:26 MIKEP
+handle file system error codes
+
+ Rev 1.81 23 Jul 1993 15:02:38 MIKEP
+Fix display of huge files. Use 64 bit routines to build size string.
+
+ Rev 1.80 20 Jul 1993 14:07:26 BARRY
+Need to call FS_FindObjClose.
+
+ Rev 1.79 15 Jul 1993 09:24:00 KEVINS
+When sorting files by date, sort newest to oldest.
+
+ Rev 1.78 01 Jul 1993 09:14:44 KEVINS
+Corrected sorting logic problems.
+
+ Rev 1.77 19 Jun 1993 13:55:48 MIKEP
+add msg box for info button if no file with focus
+
+ Rev 1.76 23 May 1993 20:24:34 BARRY
+Unicode fixes.
+
+ Rev 1.75 01 May 1993 19:02:30 MIKEP
+fix lack of scroll bar in files window if file name really long. Fix
+useful to nostrad and cayman.
+
+ Rev 1.74 23 Apr 1993 10:15:30 MIKEP
+Continue work on upper/lower case font support. Plus
+added ability to sort files by name, date, size, and type.
+
+ Rev 1.72 02 Apr 1993 08:30:34 MIKEP
+fix last change
+
+ Rev 1.71 01 Apr 1993 19:48:38 MIKEP
+add display info stuff
+
+ Rev 1.70 17 Mar 1993 18:11:24 DARRYLP
+Cleaned up display of time/date and file sizes.
+
+ Rev 1.69 10 Mar 1993 14:52:42 MIKEP
+fix directory contents display
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+static int bug1, bug2;
+
+
+#define SORT_BY_NAME 0
+#define SORT_BY_SIZE 1
+#define SORT_BY_DATE 2
+#define SORT_BY_TYPE 3
+
+
+// files for the flat list
+
+static VOID_PTR VLM_FlmSetSelect( FLM_OBJECT_PTR, BYTE );
+static BYTE VLM_FlmGetSelect( FLM_OBJECT_PTR );
+static VOID_PTR VLM_FlmSetTag( FLM_OBJECT_PTR, BYTE );
+static BYTE VLM_FlmGetTag( FLM_OBJECT_PTR );
+static USHORT VLM_FlmGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_FlmGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_FlmGetPrevItem( FLM_OBJECT_PTR );
+static VOID_PTR VLM_FlmGetNextItem( FLM_OBJECT_PTR );
+static VOID_PTR VLM_FlmGetObjects( FLM_OBJECT_PTR );
+static BOOLEAN VLM_FlmSetObjects( FLM_OBJECT_PTR, WORD, WORD );
+
+// Local prototypes
+
+static CHAR * VLM_GetFlmNameExt( FLM_OBJECT_PTR );
+static FLM_OBJECT_PTR VLM_CreateFlm( INT, INT, INT, INT );
+static FLM_OBJECT_PTR VLM_FindFLM( Q_HEADER_PTR, CHAR_PTR, BOOLEAN, FLM_OBJECT_PTR * );
+static VOID VLM_SetMaxFlmSize( Q_HEADER_PTR );
+static VOID VLM_InsertFlmInQueue( Q_HEADER_PTR, FLM_OBJECT_PTR, FLM_OBJECT_PTR, INT );
+static VOID VLM_InsertFlmByName( Q_HEADER_PTR, FLM_OBJECT_PTR, FLM_OBJECT_PTR );
+static VOID VLM_InsertFlmBySize( Q_HEADER_PTR, FLM_OBJECT_PTR, FLM_OBJECT_PTR );
+static VOID VLM_InsertFlmByDate( Q_HEADER_PTR, FLM_OBJECT_PTR, FLM_OBJECT_PTR );
+static VOID VLM_InsertFlmByExtn( Q_HEADER_PTR, FLM_OBJECT_PTR, FLM_OBJECT_PTR );
+static CHAR_PTR VLM_GetPathForSLM( SLM_OBJECT_PTR, CHAR_PTR, INT *, INT16_PTR );
+
+
+/***********************
+
+ We have been asked to resort an active file list. The user has changed
+ sorting by name to date, size, etc. Move all the entries to a temp
+ queue, and then reinsert them.
+
+************************/
+
+INT VLM_ResortFileList( HWND win )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ FLM_OBJECT_PTR flm;
+ FLM_OBJECT_PTR prev_flm;
+ Q_HEADER temp_list;
+ Q_HEADER_PTR flm_list;
+ Q_ELEM_PTR q_elem;
+ INT SortType = SORT_BY_NAME;
+
+
+ InitQueue( &temp_list );
+
+ wininfo = WM_GetInfoPtr( win );
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( wininfo );
+
+
+ if ( WMDS_GetMenuState( wininfo ) & MMDOC_SORTNAME ) {
+ SortType = SORT_BY_NAME;
+ }
+ if ( WMDS_GetMenuState( wininfo ) & MMDOC_SORTSIZE ) {
+ SortType = SORT_BY_SIZE;
+ }
+ if ( WMDS_GetMenuState( wininfo ) & MMDOC_SORTDATE ) {
+ SortType = SORT_BY_DATE;
+ }
+ if ( WMDS_GetMenuState( wininfo ) & MMDOC_SORTTYPE ) {
+ SortType = SORT_BY_TYPE;
+ }
+
+
+ flm_list = WMDS_GetFlatList( wininfo );
+
+ // Release all the old FLM structures in the queue
+
+ q_elem = DeQueueElem( flm_list );
+
+ while ( q_elem != NULL ) {
+
+ if ( QueueCount( &temp_list ) ) {
+ InsertElem( &temp_list, QueueHead(&temp_list), q_elem, BEFORE );
+ }
+ else {
+ EnQueueElem( &temp_list, q_elem, FALSE );
+ }
+
+ q_elem = DeQueueElem( flm_list );
+ }
+
+
+ prev_flm = NULL;
+
+ q_elem = DeQueueElem( &temp_list );
+
+ while ( q_elem != NULL ) {
+
+ flm = (FLM_OBJECT_PTR)q_elem->q_ptr;
+
+ VLM_InsertFlmInQueue( flm_list, flm, prev_flm, SortType );
+
+ prev_flm = flm;
+
+ q_elem = DeQueueElem( &temp_list );
+
+ }
+
+
+ // Now update the screen to show the new list
+
+ // if flm_list has more than one item and its not at level 1
+ // then set the anchor to the second item.
+
+ flm = VLM_GetFirstFLM( flm_list );
+
+ if ( flm != NULL ) {
+
+ if ( ! strcmp( FLM_GetName( flm ), TEXT("..") ) ) {
+ flm = VLM_GetNextFLM( flm );
+ }
+ }
+
+ DLM_Update( win, DLM_FLATLISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+
+ if ( flm != NULL ) {
+ DLM_SetAnchor( WMDS_GetWinFlatList( wininfo ), 0, (LMHANDLE)flm );
+ }
+
+
+ return( SUCCESS );
+}
+
+
+/***********************
+
+Return a pointer to the file name's extension. Really useful for
+sorting files by name extension.
+
+************************/
+
+static CHAR * VLM_GetFlmNameExt( FLM_OBJECT_PTR flm )
+{
+ CHAR *s;
+
+ s = NULL;
+
+ if ( flm ) {
+ s = FLM_GetName( flm );
+ while ( *s && ( *s != TEXT( '.' ) ) ) s++;
+ if ( *s == TEXT( '.' ) ) s++;
+ }
+
+ return( s );
+}
+
+
+#if !defined( OEM_MSOFT ) // Unsupported feature in Microsoft App
+/**********************
+
+ NAME : VLM_DisplayInfo()
+
+ DESCRIPTION :
+
+ RETURNS : nothing
+
+**********************/
+
+INT VLM_DisplayInfo ( VOID )
+{
+ HWND window;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ FLM_OBJECT_PTR flm;
+ CHAR *s;
+ CHAR *directory;
+ INT BytesNeeded;
+ BOOL Error = TRUE;
+
+ window = WM_GetActiveDoc();
+ wininfo = WM_GetInfoPtr( window );
+
+ if ( WM_IsFlatActive( wininfo ) ) {
+
+ flm = ( FLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndFlatList );
+
+ if ( flm != NULL ) {
+
+ if ( ! ( FLM_GetStatus( flm ) & INFO_ISADIR ) ) {
+
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( wininfo );
+
+ BytesNeeded = WM_GetTitle( window, directory, 0 );
+ BytesNeeded += 1;
+ BytesNeeded *= sizeof(CHAR);
+
+ directory = malloc( BytesNeeded );
+
+ if ( directory != NULL ) {
+
+ WM_GetTitle( window, directory, BytesNeeded / sizeof(CHAR ) );
+
+ s = directory;
+ while ( *s ) {
+ s++;
+ }
+
+ while ( *s != TEXT('\\') ) {
+ s--; // skip over *.*
+ }
+
+ s++;
+ strcpy( s, FLM_GetName( flm ) );
+ while ( *s != TEXT(':') ) {
+ s--;
+ }
+
+ s++;
+
+ // Pass "\dos\bin\cl.exe"
+
+ VLM_StartSearch( s );
+ Error = FALSE;
+ }
+ }
+ }
+ }
+
+ if ( Error ) {
+
+ WM_MsgBox( ID( IDS_VLMINFOTITLE ),
+ ID( IDS_VLMINFONOFILE ),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+ }
+
+ return 0;
+}
+#endif // !defined( OEM_MSOFT )
+
+/**********************
+
+ NAME : VLM_IsInfoAvailable()
+
+ DESCRIPTION :
+
+ RETURNS : TRUE, if information can be displayed. Otherwise, FALSE.
+
+**********************/
+
+BOOL VLM_IsInfoAvailable ( VOID )
+
+{
+ WININFO_PTR wininfo;
+ FLM_OBJECT_PTR flm;
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+
+ if ( WM_IsFlatActive( wininfo ) ) {
+
+ flm = ( FLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndFlatList );
+
+ if ( flm != NULL ) {
+ if ( ! ( FLM_GetStatus( flm ) & INFO_ISADIR ) ) {
+ return( TRUE );
+ }
+ }
+ }
+
+ return( FALSE );
+}
+
+
+/**********************
+
+ NAME : VLM_SelectFiles
+
+ DESCRIPTION :
+
+ The user has tagged a group of files and hit select or deselect. Find
+ out which ones are tagged and perform the selection on them.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_SelectFiles(
+HWND win, // I - Tree window
+BYTE attr ) // I - select or deselect ?
+{
+ WININFO_PTR wininfo;
+ FLM_OBJECT_PTR flm;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( WM_IsFlatActive( wininfo ) ) {
+
+ // Have the display list manager update our tags for us.
+
+ DLM_UpdateTags( win, DLM_FLATLISTBOX );
+
+ // Process the list of file.
+
+ flm = VLM_GetFirstFLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( flm != NULL ) {
+
+ if ( FLM_GetStatus( flm ) & INFO_TAGGED ) {
+
+ VLM_FlmSetSelect( flm, attr );
+ }
+
+ flm = VLM_GetNextFLM( flm );
+ }
+ }
+}
+
+
+
+
+/**********************
+
+ NAME : VLM_FlmFillInDLM
+
+ DESCRIPTION :
+
+ This window is actually created in the VLM_TREE file, but by filling in
+ the DLM structure in this file, I can make all the callback functions
+ static.
+
+ RETURNS : nothing
+
+**********************/
+
+
+VOID VLM_FlmFillInDLM( VOID_PTR dlm )
+{
+ DLM_INIT *flat_dlm;
+
+ flat_dlm = (DLM_INIT *)dlm;
+
+ DLM_GetItemCount( flat_dlm, VLM_FlmGetItemCount );
+ DLM_GetFirstItem( flat_dlm, VLM_FlmGetFirstItem );
+ DLM_GetNext( flat_dlm, VLM_FlmGetNextItem );
+ DLM_GetPrev( flat_dlm, VLM_FlmGetPrevItem );
+ DLM_GetTag( flat_dlm, VLM_FlmGetTag );
+ DLM_SetTag( flat_dlm, VLM_FlmSetTag );
+ DLM_GetSelect( flat_dlm, VLM_FlmGetSelect );
+ DLM_SetSelect( flat_dlm, VLM_FlmSetSelect );
+ DLM_GetObjects( flat_dlm, VLM_FlmGetObjects );
+ DLM_SetObjects( flat_dlm, VLM_FlmSetObjects );
+ DLM_SSetItemFocus( flat_dlm, NULL );
+ DLM_MaxNumObjects( flat_dlm, 8 );
+}
+
+
+
+/***************************************************
+
+ Name: VLM_GetFirstFLM
+
+ Description:
+
+ Get the first flm element from a queue of flm's.
+
+*****************************************************/
+
+FLM_OBJECT_PTR VLM_GetFirstFLM(
+Q_HEADER_PTR qhdr ) // I - queue header
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ if ( qhdr != NULL ) {
+
+ q_elem_ptr = QueueHead( qhdr );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( FLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+ }
+ return( NULL ) ;
+}
+
+/***************************************************
+
+ Name: VLM_GetLastFLM
+
+ Description:
+
+ Get the last flm element from a queue of flm's.
+
+*****************************************************/
+
+FLM_OBJECT_PTR VLM_GetLastFLM(
+Q_HEADER_PTR qhdr ) // I - queue header
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ if ( qhdr != NULL ) {
+
+ q_elem_ptr = QueueTail( qhdr );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( FLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+ }
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetNextFLM
+
+ Description:
+
+ Get the next flm element from a queue of flm's.
+
+*****************************************************/
+
+FLM_OBJECT_PTR VLM_GetNextFLM(
+FLM_OBJECT_PTR flm_ptr ) // I - current flm
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueNext( &(flm_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( FLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetPrevFLM
+
+ Description:
+
+ Get the previous flm element from a queue of flm's.
+
+*****************************************************/
+
+FLM_OBJECT_PTR VLM_GetPrevFLM(
+FLM_OBJECT_PTR flm_ptr ) // I - current flm
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueuePrev( &(flm_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( FLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+
+
+/***************************************************
+
+ Name: VLM_FileListReuse
+
+ Description:
+
+ Every time the user clicks on a different subdirectory this guy gets
+ called to free the previous flm list and create a new one from the
+ new path passed to it.
+
+*****************************************************/
+
+INT VLM_FileListReuse(
+HWND win, // I - tree window to use
+CHAR_PTR path ) // I - new path to display
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ FLM_OBJECT_PTR flm;
+ Q_HEADER_PTR flm_list;
+ Q_ELEM_PTR q_elem;
+ INT ret;
+
+ wininfo = WM_GetInfoPtr( win );
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( wininfo );
+
+ flm_list = WMDS_GetFlatList( wininfo );
+
+ // Release all the old FLM structures in the queue
+
+ q_elem = DeQueueElem( flm_list );
+
+ while ( q_elem != NULL ) {
+ free( q_elem->q_ptr );
+ q_elem = DeQueueElem( flm_list );
+ }
+
+ // Now build a new FLM list
+
+ if ( appinfo->dle != NULL ) {
+
+ ret = VLM_BuildFileList( appinfo->fsh,
+ path,
+ flm_list,
+ wininfo );
+ }
+ else {
+
+ ret = VLM_BuildTapeFileList( path,
+ flm_list,
+ appinfo->tape_fid,
+ appinfo->bset_num,
+ wininfo );
+ }
+
+ // Now update the screen to show the new list
+
+ // if flm_list has more than one item and its not at level 1
+ // then set the anchor to the second item.
+
+ flm = VLM_GetFirstFLM( flm_list );
+
+ if ( flm != NULL ) {
+
+ if ( ! strcmp( FLM_GetName( flm ), TEXT("..") ) ) {
+ flm = VLM_GetNextFLM( flm );
+ }
+ }
+
+ DLM_Update( win, DLM_FLATLISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+
+ if ( flm != NULL ) {
+ DLM_SetAnchor( WMDS_GetWinFlatList( wininfo ), 0, (LMHANDLE)flm );
+ }
+
+ return( ret );
+}
+
+/***************************************************
+
+ Name: VLM_FileListManager
+
+ Description:
+
+ This guy is called to force a fast selection/deselection of all
+ the files in the flat list.
+
+*****************************************************/
+
+VOID VLM_FileListManager(
+HWND win, // I - window to work with
+WORD msg ) // I - message of what to do
+{
+ WININFO_PTR wininfo;
+ FLM_OBJECT_PTR flm;
+ BOOLEAN all_subdirs;
+
+
+ all_subdirs = (BOOLEAN) CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( msg == FLM_SEL_ALL ) {
+
+ flm = VLM_GetFirstFLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( flm != NULL ) {
+
+ // mark this item as selected if its a file or were including
+ // all subdirectories.
+
+ if ( ! ( FLM_GetStatus( flm ) & INFO_ISADIR ) ||
+ ( all_subdirs ) ) {
+
+ if ( ( FLM_GetStatus( flm ) & (INFO_SELECT|INFO_PARTIAL) ) != INFO_SELECT ) {
+
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_SELECT );
+ FLM_SetStatus( flm, flm->status & (UINT16)~INFO_PARTIAL );
+
+ DLM_Update( win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)flm, 0 );
+ }
+ }
+
+ flm = VLM_GetNextFLM( flm );
+ }
+ }
+
+ if ( msg == FLM_SEL_NONE ) {
+
+ flm = VLM_GetFirstFLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( flm != NULL ) {
+
+ // mark this item as NOT selected
+
+ if ( FLM_GetStatus( flm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ FLM_SetStatus( flm, flm->status & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+
+ DLM_Update( win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)flm, 0 );
+ }
+
+ flm = VLM_GetNextFLM( flm );
+ }
+ }
+
+}
+
+/***************************************************
+
+ Name: VLM_FillInDetails
+
+ Description:
+
+ This routine will allocate and fill in the details fields that
+ are displayed whenever the user requests to view file details.
+ To save space its not called until its needed.
+
+*****************************************************/
+
+VOID VLM_FillInDetails(
+CHAR_PTR date_buffer,
+UINT16 date,
+CHAR_PTR time_buffer,
+UINT16 time,
+CHAR_PTR attr_buffer,
+UINT32 attribute,
+BOOLEAN is_it_a_dir,
+BOOLEAN is_it_afp )
+{
+ CHAR_PTR s;
+
+ s = attr_buffer;
+
+ UI_IntToDate( date_buffer, date );
+ UI_IntToTime( time_buffer, time );
+
+ if ( is_it_a_dir ) {
+
+ if ( attribute & OBJ_READONLY_BIT ) {
+ *s++ = TEXT('R');
+ }
+ if ( attribute & OBJ_HIDDEN_BIT ) {
+ *s++ = TEXT('H');
+ }
+ if ( attribute & OBJ_SYSTEM_BIT ) {
+ *s++ = TEXT('S');
+ }
+ }
+ else {
+
+ if ( is_it_afp ) {
+ *s++ = TEXT('A');
+ *s++ = TEXT('F');
+ *s++ = TEXT('P');
+ }
+ if ( attribute & OBJ_READONLY_BIT ) {
+ *s++ = TEXT('R');
+ }
+ if ( attribute & OBJ_HIDDEN_BIT ) {
+ *s++ = TEXT('H');
+ }
+ if ( attribute & OBJ_SYSTEM_BIT ) {
+ *s++ = TEXT('S');
+ }
+ if ( attribute & OBJ_MODIFIED_BIT ) {
+ *s++ = TEXT('A');
+ }
+ if ( attribute & FILE_IN_USE_BIT ) {
+ *s++ = TEXT('I');
+ }
+ }
+ *s = 0;
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static FLM_OBJECT_PTR VLM_FindFLM(
+Q_HEADER_PTR flm_list,
+CHAR_PTR name,
+BOOLEAN directory,
+FLM_OBJECT_PTR *prev_flm )
+{
+ FLM_OBJECT_PTR flm;
+
+ // Directories are put first so if it's a dir start at the beginning.
+ // For a file start at the end and work backwards.
+ // This let's you stop quicker and search less.
+
+ if ( directory ) {
+
+ *prev_flm = NULL;
+
+ flm = VLM_GetFirstFLM( flm_list );
+
+ while ( flm ) {
+
+ // Look for end of directories.
+
+ if ( ! ( flm->status & INFO_ISADIR ) ) {
+ flm = NULL;
+ break;
+ }
+
+ if ( stricmp( name, flm->name ) < 0 ) {
+ flm = NULL;
+ break;
+ }
+
+ if ( ! stricmp( name, flm->name ) ) {
+ break;
+ }
+
+ *prev_flm = flm;
+
+ flm = VLM_GetNextFLM( flm );
+ }
+ }
+ else {
+
+ *prev_flm = NULL;
+
+ flm = VLM_GetLastFLM( flm_list );
+
+ while ( flm ) {
+
+ // Look for start of directories.
+
+ if ( flm->status & INFO_ISADIR ) {
+ flm = NULL;
+ break;
+ }
+
+ if ( stricmp( name, flm->name ) > 0 ) {
+ flm = NULL;
+ break;
+ }
+
+ if ( ! stricmp( name, flm->name ) ) {
+ break;
+ }
+
+ *prev_flm = flm;
+
+ flm = VLM_GetPrevFLM( flm );
+ }
+ }
+
+ return( flm );
+}
+
+/***************************************************
+
+ Name: VLM_BuildTapeFileList
+
+ Description:
+
+ For the given path and tape and bset info, query the catalogs
+ and build an flm list to display.
+
+*****************************************************/
+
+INT VLM_BuildTapeFileList(
+CHAR_PTR path, // I - path to get files from
+Q_HEADER_PTR flm_list, // I - queue to put items in
+UINT32 tape_fid, // I - tape family to use
+INT16 bset_num, // I - bset to use
+WININFO_PTR XtraBytes ) // I - pointer to windows xtra bytes
+{
+ INT16 result;
+ INT16 psize;
+ INT level;
+ INT BytesNeeded;
+ INT buffer_size;
+ CHAR_PTR s;
+ CHAR_PTR buffer;
+ CHAR details_buffer[ VLM_BUFFER_SIZE ];
+ QTC_QUERY_PTR query;
+ FLM_OBJECT_PTR flm;
+ FLM_OBJECT_PTR prev_flm = NULL;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse;
+ DATE_TIME acc_date;
+ DATE_TIME mod_date;
+ INT16 search_path_length;
+ CHAR_PTR search_path;
+ BOOLEAN dir_flag;
+ BOOLEAN afp_flag;
+ BOOLEAN stat ;
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR format_string[ MAX_UI_RESOURCE_SIZE ];
+ APPINFO_PTR appinfo;
+ BOOLEAN fLowerCase = FALSE;
+ INT SortType = SORT_BY_NAME;
+
+
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTNAME ) {
+ SortType = SORT_BY_NAME;
+ }
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTSIZE ) {
+ SortType = SORT_BY_SIZE;
+ }
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTDATE ) {
+ SortType = SORT_BY_DATE;
+ }
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTTYPE ) {
+ SortType = SORT_BY_TYPE;
+ }
+
+
+
+ RSM_StringCopy( IDS_VLMFILESSCANNED, format_string, MAX_UI_RESOURCE_LEN );
+
+ acc_date.date_valid = FALSE;
+
+ // DON'T trash the path that is passed in. It is used in the title.
+
+ buffer_size = strsize( path );
+ buffer = malloc( buffer_size );
+ if ( buffer == NULL ) {
+ return( SUCCESS );
+ }
+
+ strcpy( buffer, path );
+
+ // Tell the catalogs which bset & tape family to use
+
+ query = QTC_InitQuery();
+
+ if ( query == NULL ) {
+ free( buffer );
+ return( SUCCESS );
+ }
+
+ QTC_SetTapeFID( query, tape_fid );
+ QTC_SetTapeSeq( query, -1 );
+ QTC_SetBsetNum( query, bset_num );
+
+ // separate path from title
+
+ s = buffer;
+ s += strlen( buffer ); // work backwords from end
+
+ while ( *s != TEXT(':') ) {
+ s--;
+ }
+ while ( *s != TEXT('\\') && *s ) {
+ s++;
+ }
+ if ( *s ) {
+ s++;
+ }
+
+ search_path_length = (INT16)strsize( s );
+ search_path = s;
+
+ level = 1;
+ if ( *s ) {
+ level++;
+ }
+ while ( *s ) {
+ if ( (*s == TEXT('\\')) || (*s == 0) ) {
+ *s = 0;
+ level++;
+ }
+ s++;
+ }
+
+ QTC_SetSearchPath( query, search_path, search_path_length );
+
+ // Find the BSD for this BSET so we can do the matching later
+
+ if ( tape_fid == 0L ) {
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( XtraBytes );
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+ }
+ else {
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list, tape_fid, bset_num );
+ }
+
+
+ // If they want to lower case everything then we will lowercase tapes.
+ // I can't tell what kind of file system it was to determine if it was
+ // FAT or not.
+
+ if ( CDS_GetFontCase( CDS_GetPerm() ) ) {
+ fLowerCase = TRUE;
+ }
+
+ result = (INT16) QTC_GetFirstObj( query );
+
+ // Check for it returning the root.
+
+ if ( strlen( QTC_GetItemName( query) ) == 0 ) {
+ strcpy( QTC_GetItemName( query ), TEXT("\\") ); // <<-- FIX THIS !!!!
+ }
+
+ while ( ! result ) {
+
+ if ( QTC_GetItemStatus( query ) & QTC_DIRECTORY ) {
+ dir_flag = TRUE;
+ }
+ else {
+ dir_flag = FALSE;
+ }
+
+ if ( QTC_GetItemStatus( query ) & QTC_AFP ) {
+ afp_flag = TRUE;
+ }
+ else {
+ afp_flag = FALSE;
+ }
+
+ VLM_FillInDetails( details_buffer, QTC_GetItemDate( query ),
+ &details_buffer[ 20 ], QTC_GetItemTime( query ),
+ &details_buffer[ 40 ], QTC_GetItemAttrib( query ),
+ dir_flag, afp_flag );
+
+ // If it doesn't find this entry already in the queue, then it
+ // will set prev_flm to the element right before where this new
+ // one should go. That way we can do an immediate insertion.
+
+ flm = VLM_FindFLM( flm_list, QTC_GetItemName( query ), dir_flag, &prev_flm );
+
+
+ // Repeated roots will have strlen == 0, don't add them.
+
+
+ if ( ( flm == NULL ) && strlen( QTC_GetItemName( query ) ) ) {
+
+ // Create the new flm and fill in some fields.
+
+ flm = VLM_CreateFlm( strsize( QTC_GetItemName( query ) ),
+ strsize( details_buffer ),
+ strsize( &details_buffer[ 20 ] ),
+ strsize( &details_buffer[ 40 ] ));
+
+ if ( flm == NULL ) {
+ break;
+ }
+
+ FLM_SetAttribute( flm, QTC_GetItemAttrib( query ) );
+ FLM_SetStatus( flm, INFO_DISPLAY | INFO_TAPE );
+ if ( QTC_GetItemStatus( query ) & QTC_CORRUPT ) {
+ FLM_SetStatus( flm, flm->status | (UINT16) INFO_CORRUPT );
+ }
+ FLM_SetLevel( flm, level );
+ FLM_SetSize( flm, QTC_GetItemSize( query ) );
+ FLM_SetXtraBytes( flm, XtraBytes );
+ FLM_SetName( flm, QTC_GetItemName( query ) );
+ FLM_SetDateString( flm, details_buffer );
+ FLM_SetTimeString( flm, &details_buffer[ 20 ] );
+ FLM_SetAttribString( flm, &details_buffer[ 40 ] );
+
+
+ U64_Litoa( FLM_GetSize( flm ), details_buffer, (INT16) 10, &stat );
+ details_buffer[ FLM_MAX_FILE_SIZE - 1 ] = 0;
+ FLM_SetSizeString( flm, details_buffer );
+
+ // Convert to the big date time structure
+ // from the compressed DOS structure the catalogs store
+
+ FLM_SetModDate( flm, QTC_GetItemDate( query ) );
+ FLM_SetModTime( flm, QTC_GetItemTime( query ) );
+
+
+ // Lowercase it
+
+ if ( fLowerCase ) {
+
+ strlwr( FLM_GetName( flm ) );
+ strlwr( FLM_GetAttribString( flm ) );
+ }
+
+ // See if we can set any special flags
+
+ if ( QTC_GetItemStatus( query ) & QTC_CORRUPT ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_CORRUPT );
+ }
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ if ( QTC_GetItemStatus( query ) & QTC_EMPTY ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_EMPTY );
+ }
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ if ( dir_flag ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_ISADIR );
+ }
+ else {
+
+ s = FLM_GetName( flm );
+
+ while ( *s && *s != TEXT('.') ) s++;
+
+ if ( ! stricmp( s, TEXT(".EXE") ) || ! stricmp( s, TEXT(".COM") ) ||
+#if defined ( WIN32 )
+ ! stricmp( s, TEXT(".CMD") ) ||
+#endif
+ ! stricmp( s, TEXT(".BAT") ) || ! stricmp( s, TEXT(".PIF") ) ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_EXEFILE );
+ }
+ }
+
+ // Now use the BSD_Match function to see if it's selected already
+
+ if ( bsd_ptr != NULL ) {
+
+ DateTimeDOS( FLM_GetModDate( flm ),
+ FLM_GetModTime( flm ), &mod_date );
+
+ if ( dir_flag ) {
+
+ BytesNeeded = query->path_size + strsize( FLM_GetName( flm ) );
+ if ( BytesNeeded > buffer_size ) {
+ free( buffer );
+ buffer = malloc( BytesNeeded );
+ buffer_size = BytesNeeded;
+ }
+
+ if ( query->path_size != sizeof (CHAR) ) {
+ memcpy( buffer, QTC_GetPath( query ), QTC_GetPathLength( query ) );
+ strcpy( &buffer[ QTC_GetPathLength( query )/sizeof (CHAR) ], flm->name );
+ psize = (INT16)(QTC_GetPathLength( query ) + strsize(flm->name) );
+ }
+ else {
+ strcpy( buffer, FLM_GetName( flm ) );
+ psize = (UINT16)strsize( FLM_GetName( flm ));
+ }
+
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL,
+ buffer,
+ psize,
+ FLM_GetAttribute( flm ),
+ &mod_date, &acc_date, NULL,
+ FALSE, TRUE );
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+
+ FLM_SetStatus( flm, flm->status | (UINT16)(INFO_SELECT | INFO_PARTIAL) );
+ }
+
+ if ( result == BSD_PROCESS_ENTIRE_DIR ) {
+
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_SELECT ); // turn red check mark on
+ }
+
+ }
+ else {
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse,
+ FLM_GetName( flm ),
+ QTC_GetPath( query ),
+ (INT16) QTC_GetPathLength( query ),
+ FLM_GetAttribute( flm ),
+ &mod_date, &acc_date, NULL,
+ FALSE, TRUE );
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+
+ // turn red check mark on
+
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_SELECT );
+ }
+ }
+
+ }
+
+ // Insert the new flm in the queue in the proper place. 75 % of
+ // the time we will insert the new one after the last one we
+ // inserted. So we use prev_flm to speed up the "find the right
+ // location to insert" process. And it really works.
+
+ VLM_InsertFlmInQueue( flm_list, flm, prev_flm, SortType );
+
+ prev_flm = flm;
+ }
+
+ // tell the user how many files we've found so far.
+
+ if ( ! ( QueueCount( flm_list ) % 10 ) ) {
+ sprintf( text, format_string, QueueCount( flm_list ) ) ;
+ STM_DrawText( text ) ;
+ }
+
+ // get the next file/dir.
+
+ result = (INT16) QTC_GetNextObj( query );
+ }
+
+ free( buffer );
+
+ QTC_CloseQuery( query );
+
+ // We need to insert a ".." fake entry here if we are not in the root.
+
+ if ( level != 1 ) {
+
+ flm = VLM_CreateFlm( strsize( TEXT("..") ),
+ sizeof(CHAR),
+ sizeof(CHAR),
+ sizeof(CHAR) );
+
+ if ( flm != NULL ) {
+
+ FLM_SetStatus( flm, INFO_DISPLAY | INFO_TAPE | INFO_ISADIR );
+ FLM_SetLevel( flm, level );
+ FLM_SetXtraBytes( flm, XtraBytes );
+ FLM_SetName( flm, TEXT("..") );
+ FLM_SetDateString( flm, TEXT("") );
+ FLM_SetTimeString( flm, TEXT("") );
+ FLM_SetAttribString( flm, TEXT("") );
+
+ if ( QueueCount( flm_list ) ) {
+ InsertElem( flm_list, QueueHead(flm_list), &(flm->q_elem), BEFORE );
+ }
+ else {
+ EnQueueElem( flm_list, &(flm->q_elem), FALSE );
+ }
+ }
+ }
+
+ VLM_SetMaxFlmSize( flm_list );
+
+ STM_DrawIdle( );
+
+ return( SUCCESS );
+}
+
+
+/***************************************************
+
+ Name: VLM_CreateFlm
+
+ Description:
+
+ Create a new FLM structure.
+
+ Returns: Null or the new pointer.
+
+*****************************************************/
+
+static FLM_OBJECT_PTR VLM_CreateFlm(
+INT name_size,
+INT date_size,
+INT time_size,
+INT attrib_size )
+{
+ FLM_OBJECT_PTR flm;
+
+ // All sizes are in bytes.
+
+ flm = ( FLM_OBJECT_PTR )malloc( sizeof(FLM_OBJECT) + name_size +
+ date_size +
+ time_size +
+ attrib_size );
+
+ if ( flm != NULL ) {
+
+ flm->name = (CHAR_PTR)((INT8_PTR)flm + sizeof(FLM_OBJECT));
+ flm->date_str = (CHAR_PTR)((INT8_PTR)flm->name + name_size);
+ flm->time_str = (CHAR_PTR)((INT8_PTR)flm->date_str + date_size );
+ flm->attrib_str = (CHAR_PTR)((INT8_PTR)flm->time_str + time_size );
+ flm->q_elem.q_ptr = flm;
+ }
+
+ return( flm );
+}
+
+/***************************************************
+
+ Name: VLM_BuildFileList
+
+ Description:
+
+ For the fsh and base passed, build a list of all the files so that
+ they can be displayed.
+
+ Returns: last FS_xxx code from the file system
+
+ usually FS_NO_MORE or FS_ACCESS_DENIED
+
+
+*****************************************************/
+
+INT VLM_BuildFileList(
+FSYS_HAND fsh, // I - file system handle
+CHAR_PTR base, // I - base path to use
+Q_HEADER_PTR flm_list, // I - queue to add stuff to
+WININFO_PTR XtraBytes ) // I - windows xtrabytes pointer
+{
+ INT16 ret;
+ INT16 psize;
+ INT16 orig_psize;
+ INT16 path_len;
+ CHAR details_buffer[ VLM_BUFFER_SIZE ];
+ CHAR_PTR buffer = NULL;
+ CHAR_PTR path = NULL;
+ CHAR_PTR name = NULL;
+ CHAR_PTR s;
+ FLM_OBJECT_PTR flm;
+ FLM_OBJECT_PTR prev_flm = NULL;
+ APPINFO_PTR appinfo;
+ FSE_PTR fse;
+ BSD_PTR bsd_ptr;
+ DBLK dblk;
+ DATE_TIME acc_date;
+ DATE_TIME mod_date;
+ BOOLEAN dir_flag;
+ BOOLEAN afp_flag;
+ BOOLEAN stat;
+ OBJECT_TYPE object_type;
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR format_string[ MAX_UI_RESOURCE_SIZE ];
+ SLM_OBJECT_PTR slm;
+ BOOLEAN fLowerCase = FALSE;
+ INT SortType = SORT_BY_NAME;
+ INT buffer_size = 0;
+
+ RSM_StringCopy( IDS_VLMFILESSCANNED, format_string, MAX_UI_RESOURCE_LEN );
+
+ buffer = malloc( VLM_BUFFER_SIZE );
+ buffer_size = VLM_BUFFER_SIZE;
+
+ path = malloc( strsize( base ) );
+
+ if ( path == NULL || buffer == NULL ) {
+ free( buffer );
+ free( path );
+ return( FAILURE );
+ }
+
+ s = base;
+ s += strlen( base ); // go to the end
+
+ while ( *s != TEXT(':') ) {
+ s--;
+ }
+
+ while ( *s != TEXT('\\') && *s ) {
+ s++;
+ }
+
+ if ( *s ) {
+ s++;
+ }
+
+ strcpy( path, s );
+
+ // determine the path length and turn \'s into 0's
+
+ path_len = 0;
+
+ while ( path[ path_len ] ) {
+
+ if ( path[ path_len ] == TEXT('\\') ) {
+ path[ path_len ] = 0;
+ }
+ path_len++;
+ }
+ path_len++;
+
+ path_len *= sizeof(CHAR);
+
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( XtraBytes );
+
+
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTNAME ) {
+ SortType = SORT_BY_NAME;
+ }
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTSIZE ) {
+ SortType = SORT_BY_SIZE;
+ }
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTDATE ) {
+ SortType = SORT_BY_DATE;
+ }
+ if ( WMDS_GetMenuState( XtraBytes ) & MMDOC_SORTTYPE ) {
+ SortType = SORT_BY_TYPE;
+ }
+
+
+ // make sure the dirs have been blown out for this parent
+
+ slm = VLM_FindSLM( WMDS_GetTreeList( XtraBytes ), path, path_len );
+
+ VLM_BlowOutDir( slm );
+
+ ret = FS_ChangeDir( fsh, path, path_len );
+
+ if ( ret != SUCCESS ) {
+
+ zprintf ( DEBUG_TEMPORARY, TEXT("FS_ChangeDir failed %04X"), ret );
+ return( ret );
+ }
+
+ // Try to find the BSD for use with BSD_Match later
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+
+ if ( CDS_GetFontCase( CDS_GetPerm() ) ) {
+ fLowerCase = TRUE;
+ }
+ else {
+ if ( CDS_GetFontCaseFAT( CDS_GetPerm() ) ) {
+
+ // Change this to DLE_FEATURE_FAT_DRIVE
+
+ if ( ! DLE_HasFeatures( appinfo->dle, DLE_FEAT_CASE_PRESERVING ) ) {
+ fLowerCase = TRUE;
+ }
+ }
+ }
+
+ ret = FS_FindFirstObj( fsh, &dblk, TEXT("*.*") );
+
+
+ if ( ret != SUCCESS ) {
+
+ // Only insert this FLM if there are no items in this directory
+ // Otherwise wait till your done sorting, then insert it.
+ // Insert the special ".." entry.
+
+ if ( path_len != sizeof ( CHAR ) ) {
+
+ flm = VLM_CreateFlm( strsize(TEXT("..")),
+ sizeof(CHAR),
+ sizeof(CHAR),
+ sizeof(CHAR) );
+
+ if ( flm ) {
+ FLM_SetStatus( flm, INFO_DISPLAY | INFO_ISADIR );
+ FLM_SetAttribute( flm, 0 );
+ FLM_SetSize( flm, U64_Init(0L, 0L) );
+ FLM_SetXtraBytes( flm, XtraBytes );
+ FLM_SetName( flm, TEXT("..") );
+ FLM_SetDateString( flm, TEXT("") );
+ FLM_SetTimeString( flm, TEXT("") );
+ FLM_SetAttribString( flm, TEXT("") );
+ EnQueueElem( flm_list, &(flm->q_elem), FALSE );
+ }
+ }
+
+ VLM_SetMaxFlmSize( flm_list );
+
+ STM_DrawIdle( );
+
+ return( ret );
+ }
+
+ do {
+
+ // Was it a directory name we got ?
+
+ if ( FS_GetBlockType( &dblk ) == DDB_ID ) {
+
+ orig_psize = FS_SizeofOSPathInDDB( fsh, &dblk );
+
+ if ( buffer_size < orig_psize ) {
+ free( buffer );
+ buffer = malloc( orig_psize + 256 );
+ buffer_size = orig_psize + 256;
+ }
+
+ FS_GetOSPathFromDDB( fsh, &dblk, buffer );
+
+ psize = (INT16) (orig_psize - sizeof(CHAR));
+ psize /= sizeof(CHAR);
+
+ do {
+ psize--;
+ } while ( psize && buffer[ psize ] );
+
+ if ( psize ) {
+ psize++;
+ }
+ name = &buffer[ psize ];
+
+ slm = VLM_FindSLM( WMDS_GetTreeList( XtraBytes ), buffer, orig_psize );
+ }
+
+ // Was it a file we got ?
+
+ if ( FS_GetBlockType( &dblk ) == FDB_ID ) {
+ FS_GetOSFnameFromFDB( fsh, &dblk, buffer );
+ name = buffer;
+ dir_flag = FALSE;
+ }
+ else {
+ dir_flag = TRUE;
+ }
+
+ FS_GetObjTypeDBLK( fsh, &dblk, &object_type );
+
+ if ( object_type == AFP_OBJECT ) {
+ afp_flag = TRUE;
+ }
+ else {
+ afp_flag = FALSE;
+ }
+
+ FS_GetMDateFromDBLK( fsh, &dblk, &mod_date );
+
+ VLM_FillInDetails( details_buffer, ConvertDateDOS( &mod_date ),
+ &details_buffer[ 20 ], ConvertTimeDOS( &mod_date ),
+ &details_buffer[ 40 ], FS_GetAttribFromDBLK( fsh, &dblk ),
+ dir_flag, afp_flag );
+
+
+ if ( fLowerCase ) {
+ strlwr( &details_buffer[ 40 ] ); // lower case attributes
+ strlwr( name ); // lower case file name
+ }
+
+
+ flm = VLM_CreateFlm( strsize( name ),
+ strsize( details_buffer ),
+ strsize( &details_buffer[ 20 ] ),
+ strsize( &details_buffer[ 40 ] ) );
+
+ if ( flm == NULL ) {
+ break;
+ }
+
+ FLM_SetStatus( flm, INFO_DISPLAY );
+ FLM_SetAttribute( flm, FS_GetAttribFromDBLK( fsh, &dblk ) );
+ FLM_SetSize( flm, FS_GetDisplaySizeFromDBLK( fsh, &dblk ) );
+ FLM_SetXtraBytes( flm, XtraBytes );
+ FLM_SetName( flm, name );
+ FLM_SetDateString( flm, details_buffer );
+ FLM_SetTimeString( flm, &details_buffer[ 20 ] );
+ FLM_SetAttribString( flm, &details_buffer[ 40 ] );
+
+ U64_Litoa( FLM_GetSize( flm ), details_buffer, (INT16) 10, &stat );
+ details_buffer[ FLM_MAX_FILE_SIZE - 1 ] = 0;
+ FLM_SetSizeString( flm, details_buffer );
+
+ FLM_SetModDate( flm, ConvertDateDOS( &mod_date ) );
+ FLM_SetModTime( flm, ConvertTimeDOS( &mod_date ) );
+
+ FS_GetADateFromDBLK( fsh, &dblk, &acc_date );
+ FLM_SetAccDate( flm, ConvertDateDOS( &acc_date ) );
+ FLM_SetAccTime( flm, ConvertTimeDOS( &acc_date ) );
+
+ // Try to set some special flags
+
+ if ( FS_GetBlockType( &dblk ) == DDB_ID ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_ISADIR );
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ if ( SLM_GetStatus( slm ) & INFO_EMPTY ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_EMPTY );
+ }
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ }
+ else {
+
+ s = flm->name;
+
+ while ( *s && *s != TEXT('.') ) s++;
+
+ if ( ! stricmp( s, TEXT(".EXE") ) || ! stricmp( s, TEXT(".COM") ) ||
+ ! stricmp( s, TEXT(".CMD") ) ||
+ ! stricmp( s, TEXT(".BAT") ) || ! stricmp( s, TEXT(".PIF") ) ) {
+
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_EXEFILE );
+ }
+ }
+
+ // See if this guys already selected
+
+ if ( bsd_ptr != NULL ) {
+
+ if ( FLM_GetStatus( flm ) & INFO_ISADIR ) {
+
+ ret = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL,
+ buffer,
+ orig_psize,
+ FLM_GetAttribute( flm ),
+ &mod_date, &acc_date,
+ NULL, FALSE, TRUE );
+
+ if ( ret == BSD_PROCESS_OBJECT ) {
+
+ FLM_SetStatus( flm, flm->status | (UINT16) (INFO_SELECT | INFO_PARTIAL) );
+ }
+ if ( ret == BSD_PROCESS_ENTIRE_DIR ) {
+
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_SELECT ); // turn red check mark on
+ }
+ }
+ else {
+ ret = BSD_MatchPathAndFile( bsd_ptr, &fse,
+ FLM_GetName( flm ),
+ path, path_len,
+ FLM_GetAttribute( flm ),
+ &mod_date, &acc_date,
+ NULL, FALSE, TRUE );
+
+ if ( ret == BSD_PROCESS_OBJECT ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_SELECT ); // set the little red check mark
+ }
+ }
+ }
+
+ VLM_InsertFlmInQueue( flm_list, flm, prev_flm, SortType );
+
+ prev_flm = flm;
+
+ if ( ! ( QueueCount( flm_list ) % 10 ) ) {
+ sprintf( text, format_string, QueueCount( flm_list ) ) ;
+ STM_DrawText( text ) ;
+ }
+
+ FS_ReleaseDBLK( fsh, &dblk );
+
+ ret = FS_FindNextObj( fsh, &dblk );
+
+ } while ( ret == SUCCESS );
+
+ FS_FindObjClose( fsh, &dblk );
+
+ free( path );
+ free( buffer );
+
+ // Now after sorting insert first element at start !
+
+ if ( path_len != sizeof(CHAR) ) {
+
+ flm = VLM_CreateFlm( strsize( TEXT("..") ),
+ sizeof(CHAR),
+ sizeof(CHAR),
+ sizeof(CHAR) );
+
+ if ( flm ) {
+ FLM_SetStatus( flm, INFO_DISPLAY | INFO_ISADIR );
+ FLM_SetAttribute( flm, 0 );
+ FLM_SetSize( flm, U64_Init(0L, 0L) );
+ FLM_SetXtraBytes( flm, XtraBytes );
+ FLM_SetName( flm, TEXT("..") );
+ FLM_SetDateString( flm, TEXT("") );
+ FLM_SetTimeString( flm, TEXT("") );
+ FLM_SetAttribString( flm, TEXT("") );
+
+ if ( QueueCount( flm_list ) ) {
+ InsertElem( flm_list, QueueHead(flm_list), &(flm->q_elem), BEFORE );
+ }
+ else {
+ EnQueueElem( flm_list, &(flm->q_elem), FALSE );
+ }
+ }
+ }
+
+ VLM_SetMaxFlmSize( flm_list );
+
+ STM_DrawIdle( );
+
+ return( ret );
+}
+
+/**********************
+
+ NAME : VLM_InsertFlmInQueue
+
+ DESCRIPTION :
+
+ This routine handles all the sorting.
+
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_InsertFlmInQueue(
+Q_HEADER_PTR flm_list,
+FLM_OBJECT_PTR flm,
+FLM_OBJECT_PTR prev_flm,
+INT SortType )
+{
+ if ( ! strcmp( FLM_GetName( flm ), TEXT("..") ) ) {
+ if ( QueueCount( flm_list ) == 0 ) {
+ EnQueueElem( flm_list, &(flm->q_elem), FALSE );
+ }
+ else {
+ InsertElem( flm_list, QueueHead(flm_list), &(flm->q_elem), BEFORE );
+ }
+ }
+
+ else if ( QueueCount( flm_list ) == 0 ) {
+ EnQueueElem( flm_list, &(flm->q_elem), FALSE );
+ }
+
+ else {
+
+ switch ( SortType ) {
+
+ case SORT_BY_SIZE:
+ VLM_InsertFlmBySize( flm_list, flm, prev_flm );
+ break;
+
+ case SORT_BY_DATE:
+ VLM_InsertFlmByDate( flm_list, flm, prev_flm );
+ break;
+
+ case SORT_BY_TYPE:
+ VLM_InsertFlmByExtn( flm_list, flm, prev_flm );
+ break;
+
+ case SORT_BY_NAME:
+ default:
+ VLM_InsertFlmByName( flm_list, flm, prev_flm );
+ break;
+ }
+ }
+ return;
+}
+
+/**********************
+
+ NAME : VLM_InsertFlmByName
+
+ DESCRIPTION : Insert a new flm entry sorted by name.
+
+ RETURNS : nothing.
+
+**********************/
+
+static VOID VLM_InsertFlmByName(
+Q_HEADER_PTR flm_list,
+FLM_OBJECT_PTR flm,
+FLM_OBJECT_PTR prev_flm )
+{
+ FLM_OBJECT_PTR flm1, flm2;
+
+ if ( ! ( flm->status & INFO_ISADIR ) ) {
+
+ flm1 = VLM_GetLastFLM( flm_list );
+
+ if ( prev_flm ) {
+ if ( ! ( prev_flm->status & INFO_ISADIR ) ) {
+
+ if ( stricmp( FLM_GetName( flm ),
+ FLM_GetName( prev_flm ) ) < 0 ) {
+
+ // We got lucky !
+
+ flm1 = prev_flm;
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ if ( flm1->status & INFO_ISADIR ) {
+ break;
+ }
+
+ if ( stricmp( FLM_GetName( flm ),
+ FLM_GetName( flm1 ) ) >= 0 ) {
+ break;
+ }
+
+ flm2 = flm1;
+ flm1 = VLM_GetPrevFLM( flm1 );
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), BEFORE );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), AFTER );
+ }
+
+ }
+ else {
+
+ flm1 = VLM_GetFirstFLM( flm_list );
+
+ // Try to start positioning at last flm inserted.
+
+ if ( prev_flm ) {
+ if ( prev_flm->status & INFO_ISADIR ) {
+
+ if ( stricmp( FLM_GetName( flm ),
+ FLM_GetName( prev_flm ) ) >= 0 ) {
+
+ // We got lucky !
+
+ flm1 = prev_flm;
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ if ( ! ( flm1->status & INFO_ISADIR ) ) {
+ break;
+ }
+ if ( stricmp( FLM_GetName( flm ),
+ FLM_GetName( flm1 ) ) < 0 ) {
+ break;
+ }
+ flm2 = flm1;
+ flm1 = VLM_GetNextFLM( flm1 );
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), AFTER );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), BEFORE );
+ }
+ }
+
+ return;
+}
+
+/**********************
+
+ NAME : VLM_InsertFlmByDate
+
+ DESCRIPTION : Insert a new flm entry sorted by date.
+
+ RETURNS : nothing.
+
+**********************/
+
+static VOID VLM_InsertFlmByDate(
+Q_HEADER_PTR flm_list,
+FLM_OBJECT_PTR flm,
+FLM_OBJECT_PTR prev_flm )
+{
+ FLM_OBJECT_PTR flm1, flm2;
+
+ if ( ! ( flm->status & INFO_ISADIR ) ) {
+
+ flm1 = VLM_GetLastFLM( flm_list );
+
+ if ( prev_flm ) {
+ if ( ! ( prev_flm->status & INFO_ISADIR ) ) {
+
+ if ( FLM_GetModDate( flm ) == FLM_GetModDate( prev_flm ) ) {
+ if ( FLM_GetModTime( flm ) > FLM_GetModTime( prev_flm ) ) {
+ // We got lucky !
+ flm1 = prev_flm;
+ }
+ }
+ else {
+ if ( FLM_GetModDate( flm ) > FLM_GetModDate( prev_flm ) ) {
+ // We got lucky !
+ flm1 = prev_flm;
+ }
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ if ( flm1->status & INFO_ISADIR ) {
+ break;
+ }
+
+ if ( FLM_GetModDate( flm ) == FLM_GetModDate( flm1 ) ) {
+ if ( FLM_GetModTime( flm ) <= FLM_GetModTime( flm1 ) ) {
+ break;
+ }
+ }
+ else {
+ if ( FLM_GetModDate( flm ) <= FLM_GetModDate( flm1 ) ) {
+ break;
+ }
+ }
+
+ flm2 = flm1;
+ flm1 = VLM_GetPrevFLM( flm1 );
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), BEFORE );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), AFTER );
+ }
+
+ }
+ else {
+
+ flm1 = VLM_GetFirstFLM( flm_list );
+
+ // Try to start positioning at last flm inserted.
+
+ if ( prev_flm ) {
+ if ( prev_flm->status & INFO_ISADIR ) {
+
+ if ( FLM_GetModDate( flm ) == FLM_GetModDate( prev_flm ) ) {
+ if ( FLM_GetModTime( flm ) <= FLM_GetModTime( prev_flm ) ) {
+
+ // We got lucky !
+ flm1 = prev_flm;
+ }
+ }
+ else {
+ if ( FLM_GetModDate( flm ) <= FLM_GetModDate( prev_flm ) ) {
+
+ // We got lucky !
+ flm1 = prev_flm;
+ }
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ if ( ! ( flm1->status & INFO_ISADIR ) ) {
+ break;
+ }
+ if ( FLM_GetModDate( flm ) == FLM_GetModDate( flm1 ) ) {
+
+ if ( FLM_GetModTime( flm ) > FLM_GetModTime( flm1 ) ) {
+ break;
+ }
+ }
+ else {
+ if ( FLM_GetModDate( flm ) > FLM_GetModDate( flm1 ) ) {
+ break;
+ }
+ }
+ flm2 = flm1;
+ flm1 = VLM_GetNextFLM( flm1 );
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), AFTER );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), BEFORE );
+ }
+ }
+
+ return;
+}
+
+/**********************
+
+ NAME : VLM_InsertFlmBySize
+
+ DESCRIPTION : Insert a new flm entry sorted by size.
+
+ RETURNS : nothing.
+
+**********************/
+
+static VOID VLM_InsertFlmBySize(
+Q_HEADER_PTR flm_list,
+FLM_OBJECT_PTR flm,
+FLM_OBJECT_PTR prev_flm )
+{
+ FLM_OBJECT_PTR flm1, flm2;
+
+ if ( ! ( flm->status & INFO_ISADIR ) ) {
+
+ flm1 = VLM_GetLastFLM( flm_list );
+
+ if ( prev_flm ) {
+ if ( ! ( prev_flm->status & INFO_ISADIR ) ) {
+
+ if ( U64_GE( FLM_GetSize( flm ), FLM_GetSize( prev_flm ) ) ) {
+
+ // We got lucky !
+
+ flm1 = prev_flm;
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ if ( flm1->status & INFO_ISADIR ) {
+ break;
+ }
+
+ if ( U64_LT( FLM_GetSize( flm ), FLM_GetSize( flm1 ) ) ) {
+ break;
+ }
+
+ flm2 = flm1;
+ flm1 = VLM_GetPrevFLM( flm1 );
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), BEFORE );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), AFTER );
+ }
+
+ }
+ else {
+
+ flm1 = VLM_GetFirstFLM( flm_list );
+
+ // Try to start positioning at last flm inserted.
+
+ if ( prev_flm ) {
+
+ if ( prev_flm->status & INFO_ISADIR ) {
+
+ if ( U64_LT( FLM_GetSize( flm ), FLM_GetSize( prev_flm ) ) ) {
+
+ // We got lucky !
+
+ flm1 = prev_flm;
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ if ( ! ( flm1->status & INFO_ISADIR ) ) {
+ break;
+ }
+ if ( U64_GE( FLM_GetSize( flm ), FLM_GetSize( flm1 ) ) ) {
+ break;
+ }
+ flm2 = flm1;
+ flm1 = VLM_GetNextFLM( flm1 );
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), AFTER );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), BEFORE );
+ }
+ }
+
+ return;
+}
+
+
+
+
+
+/**********************
+
+ NAME : VLM_InsertFlmByExtn
+
+ DESCRIPTION : Insert a new flm entry sorted by extension.
+
+ RETURNS : nothing.
+
+**********************/
+
+static VOID VLM_InsertFlmByExtn(
+Q_HEADER_PTR flm_list,
+FLM_OBJECT_PTR flm,
+FLM_OBJECT_PTR prev_flm )
+{
+ FLM_OBJECT_PTR flm1, flm2;
+ CHAR *ext, *ext1, *prev_ext; // pointers to file extensions
+
+ ext = VLM_GetFlmNameExt( flm );
+
+ if ( ! ( flm->status & INFO_ISADIR ) ) {
+
+ flm1 = VLM_GetLastFLM( flm_list );
+
+ if ( prev_flm ) {
+
+ prev_ext = VLM_GetFlmNameExt( prev_flm );
+
+ if ( ! ( prev_flm->status & INFO_ISADIR ) ) {
+
+ if ( stricmp( ext, prev_ext ) < 0 ) {
+
+ // We got lucky !
+
+ flm1 = prev_flm;
+ ext1 = VLM_GetFlmNameExt( flm1 );;
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ ext1 = VLM_GetFlmNameExt( flm1 );
+
+ if ( flm1->status & INFO_ISADIR ) {
+ break;
+ }
+
+ if ( stricmp( ext, ext1 ) == 0 ) {
+ if ( stricmp( FLM_GetName( flm ), FLM_GetName( flm1 ) ) > 0 ) {
+ break;
+ }
+ }
+
+ else if ( stricmp( ext, ext1 ) > 0 ) {
+ break;
+ }
+
+ flm2 = flm1;
+ flm1 = VLM_GetPrevFLM( flm1 );
+
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), BEFORE );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), AFTER );
+ }
+
+ }
+ else {
+
+ flm1 = VLM_GetFirstFLM( flm_list );
+
+ // Try to start positioning at last flm inserted.
+
+ if ( prev_flm ) {
+
+ prev_ext = VLM_GetFlmNameExt( prev_flm );
+
+ if ( prev_flm->status & INFO_ISADIR ) {
+
+ if ( stricmp( ext, prev_ext ) > 0 ) {
+
+ // We got lucky !
+
+ flm1 = prev_flm;
+ ext1 = VLM_GetFlmNameExt( flm1 );
+ }
+ }
+ }
+
+ while ( flm1 ) {
+
+ ext1 = VLM_GetFlmNameExt( flm1 );
+
+ if ( ! ( flm1->status & INFO_ISADIR ) ) {
+ break;
+ }
+
+ if ( stricmp( ext, ext1 ) == 0 ) {
+ if ( stricmp( FLM_GetName( flm ), FLM_GetName( flm1 ) ) < 0 ) {
+ break;
+ }
+ }
+
+ else if ( stricmp( ext, ext1 ) < 0 ) {
+ break;
+ }
+
+ flm2 = flm1;
+ flm1 = VLM_GetNextFLM( flm1 );
+ }
+
+ if ( flm1 == NULL ) {
+ InsertElem( flm_list, &(flm2->q_elem), &(flm->q_elem), AFTER );
+ }
+ else {
+ InsertElem( flm_list, &(flm1->q_elem), &(flm->q_elem), BEFORE );
+ }
+ }
+
+ return;
+}
+
+
+/**********************
+
+ NAME : VLM_SetMaxFlmSize
+
+ DESCRIPTION : Set the max name string length in all the flm's.
+
+ RETURNS : nothing.
+
+**********************/
+
+static VOID VLM_SetMaxFlmSize( Q_HEADER_PTR flm_list )
+{
+ UINT name_max = 0;
+ UINT date_max = 0;
+ UINT time_max = 0;
+ UINT attr_max = 0;
+ UINT size_max = 3;
+ FLM_OBJECT_PTR flm;
+ UINT64 kilo;
+ UINT64 mega;
+ UINT64 giga;
+
+ // I know there must be an easier way !
+
+ kilo = U64_Init( 999L , 0L );
+ mega = U64_Init( 999999L, 0L );
+ giga = U64_Init( 999999999L, 0L );
+
+ // Calculate the max.
+
+ flm = VLM_GetFirstFLM( flm_list );
+
+ while ( flm != NULL ) {
+
+ if ( U64_GE( flm->size, kilo ) && ( size_max < 6 ) ) {
+ size_max = 6;
+ }
+
+ if ( U64_GE( flm->size, mega ) && ( size_max < 9 ) ) {
+ size_max = 9;
+ }
+
+ if ( U64_GE( flm->size, giga ) && ( size_max < 12 ) ) {
+ size_max = 12;
+ }
+
+ if ( strlen( FLM_GetName( flm ) ) > name_max ) {
+ name_max = strlen( FLM_GetName( flm ) );
+ }
+ if ( strlen( FLM_GetDateString( flm ) ) > date_max ) {
+ date_max = strlen( FLM_GetDateString( flm ) );
+ }
+ if ( strlen( FLM_GetTimeString( flm ) ) > time_max ) {
+ time_max = strlen( FLM_GetTimeString( flm ) );
+ }
+ if ( strlen( FLM_GetAttribString( flm ) ) > attr_max ) {
+ attr_max = strlen( FLM_GetAttribString( flm ) );
+ }
+
+ // Note: For better looking listboxes, we will reset our spaces to
+ // 8 minimum for dates (MM-DD-YY(, and 11 for time (HH:MM:YY XM).
+
+ if (date_max < 8)
+ {
+ date_max = 8;
+ }
+ if (time_max < 11)
+ {
+ time_max = 11;
+ }
+
+ flm = VLM_GetNextFLM( flm );
+ }
+
+ // Set the max.
+
+ flm = VLM_GetFirstFLM( flm_list );
+
+ while ( flm != NULL ) {
+
+ FLM_SetMaxName( flm, name_max );
+ FLM_SetMaxDate( flm, date_max );
+ FLM_SetMaxTime( flm, time_max );
+ FLM_SetMaxAttr( flm, attr_max );
+ FLM_SetMaxSize( flm, size_max );
+
+ flm = VLM_GetNextFLM( flm );
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_GetPathForSLM
+
+ DESCRIPTION :
+
+ GIven an slm pointer fill in the buffer with it's complete path.
+
+ RETURNS : nothing
+
+**********************/
+
+static CHAR_PTR VLM_GetPathForSLM(
+SLM_OBJECT_PTR slm, // I
+CHAR_PTR path, // O
+INT *path_size,
+INT16_PTR path_len ) // O
+{
+ CHAR_PTR temp_path;
+ INT level;
+ INT StringLength;
+ INT BytesNeeded;
+ INT16 i;
+
+ if ( slm->level == 0 ) {
+
+ if ( *path_size < sizeof(CHAR) ) {
+ free( path );
+ path = malloc( sizeof(CHAR) );
+ *path_size = sizeof(CHAR);
+ }
+
+ strcpy( path, TEXT("") );
+ *path_len = sizeof(CHAR);
+ }
+ else {
+
+ *path_len = 0;
+
+ level = SLM_GetLevel( slm );
+
+ while ( SLM_GetLevel( slm ) != 0 ) {
+
+ if ( SLM_GetLevel( slm ) == level ) {
+
+ // Add this slm->name into path here
+
+ BytesNeeded = *path_len + strsize( SLM_GetName( slm ) );
+
+ if ( *path_size < BytesNeeded ) {
+ temp_path = malloc( BytesNeeded );
+ *path_size = BytesNeeded;
+ memcpy( temp_path, path, *path_len );
+ free( path );
+ path = temp_path;
+ }
+
+ StringLength = strlen( SLM_GetName( slm ) );
+ for ( i = *path_len / sizeof(CHAR); i > 0; i-- ) {
+ path[ i + StringLength ] = path[ i - 1 ];
+ }
+
+ strcpy( path, SLM_GetName( slm ) );
+
+ *path_len += strsize( SLM_GetName( slm ) );
+
+ level--;
+ }
+
+ slm = VLM_GetPrevSLM( slm );
+ }
+
+ }
+
+ return( path );
+}
+
+
+
+/***************************************************
+
+ Name: VLM_FlmSetSelect
+
+ Description:
+
+ The user has selected or deselected the given file or directory
+ in the flat list. Either way the whole tree of parents will
+ need to be updated.
+
+*****************************************************/
+
+static VOID_PTR VLM_FlmSetSelect(
+FLM_OBJECT_PTR flm, // I - current flm
+BYTE attr ) // I - what to set it to
+{
+ CHAR_PTR path;
+ CHAR_PTR s;
+ CHAR_PTR parent_dir;
+ INT16 path_len;
+ INT path_size;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ BSET_OBJECT_PTR bset;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR matching_slm;
+ FSE_PTR fse_ptr;
+ BSD_PTR bsd_ptr;
+ UINT16 status = 0;
+ UINT16 new_status;
+ INT level;
+ INT16 error;
+ INT16 result;
+ BOOLEAN all_subdirs;
+ BE_CFG_PTR bec_config;
+ DATE_TIME sort_date;
+ INT total_dirs;
+ INT total_files;
+ UINT64 total_bytes;
+ BOOLEAN u64_stat;
+
+
+ all_subdirs = (BOOLEAN) CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ // No, you can't select this guy no matter how hard you try.
+
+ if ( ! strcmp( FLM_GetName( flm ), TEXT("..") ) ) {
+ return( NULL );
+ }
+
+ wininfo = FLM_GetXtraBytes( flm );
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( wininfo );
+
+ // Find the same directory in the hierarchical list if the flm is a
+ // directory. There is no garantee that the subdirectory is in the
+ // tree yet, so you may not find it.
+
+ if ( FLM_GetStatus( flm ) & INFO_ISADIR ) {
+
+ matching_slm = appinfo->open_slm;
+
+ while ( ( SLM_GetLevel( matching_slm ) !=
+ ( SLM_GetLevel( appinfo->open_slm ) + 1 ) ) ||
+ stricmp( FLM_GetName( flm ), SLM_GetName( matching_slm ) ) ) {
+
+ matching_slm = VLM_GetNextSLM( matching_slm );
+
+ if ( matching_slm == NULL ) break;
+ if ( matching_slm->level == appinfo->open_slm->level ) {
+ matching_slm = NULL;
+ break;
+ }
+ }
+ }
+
+ // determine path length
+ // insert 0's for \'s
+
+ path_size = strlen( WMDS_GetWinTitle( WM_GetInfoPtr( appinfo->win ) ) );
+ path_size += strlen( FLM_GetName( flm ) );
+ path_size += 256;
+ path_size *= sizeof(CHAR);
+
+ path = malloc( path_size );
+ if ( path == NULL ) {
+ return NULL;
+ }
+
+ WM_GetTitle( appinfo->win, path, path_size / sizeof(CHAR) );
+
+ path_len = 0;
+
+ s = path + strlen( path );
+ while ( *s != TEXT(':') ) s--;
+ s++;
+ while ( *s != TEXT('*') && *s ) {
+ path_len++;
+ if ( *s == TEXT('\\') ) {
+ *s = 0;
+ }
+ s++;
+ }
+ if ( path_len == 0 ) {
+ path_len = 1;
+ }
+ else {
+ path_len--;
+ }
+ *s = 0;
+
+
+ // point to start of path, skipping over drive
+
+ parent_dir = path;
+ while ( *parent_dir++ ) ;
+
+ if ( FLM_GetStatus( flm ) & INFO_ISADIR ) {
+
+ if ( path_len == 1 ) {
+ path_len--;
+ }
+ strcpy( parent_dir + path_len , FLM_GetName( flm ) );
+ path_len += strlen( FLM_GetName( flm ) ) + 1;
+ path_len *= sizeof(CHAR); // change to bytes
+
+ if ( attr ) {
+ error = BSD_CreatFSE( &fse_ptr, INCLUDE,
+ (INT8_PTR)parent_dir, path_len,
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ USE_WILD_CARD,
+ all_subdirs );
+ }
+ else {
+ error = BSD_CreatFSE( &fse_ptr, EXCLUDE,
+ (INT8_PTR)parent_dir, path_len,
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ USE_WILD_CARD,
+ TRUE );
+ }
+ }
+ else {
+
+ if ( path_len == 0 ) {
+ path_len++;
+ }
+ path_len *= sizeof(CHAR); // change to bytes
+
+ if ( attr ) {
+ error = BSD_CreatFSE( &fse_ptr, INCLUDE,
+ (INT8_PTR)parent_dir, path_len,
+ (INT8_PTR)FLM_GetName( flm ),
+ (INT16)strsize( FLM_GetName( flm ) ),
+ USE_WILD_CARD, FALSE );
+ }
+ else {
+ error = BSD_CreatFSE( &fse_ptr, EXCLUDE,
+ (INT8_PTR)parent_dir, path_len,
+ (INT8_PTR)FLM_GetName( flm ),
+ (INT16)strsize( FLM_GetName( flm ) ),
+ USE_WILD_CARD, FALSE );
+ }
+ }
+
+ if ( error ) {
+ free( path );
+ return NULL;
+ }
+
+ if ( appinfo->dle != NULL ) {
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ BSD_Add( bsd_list, &bsd_ptr, bec_config, NULL,
+ appinfo->dle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+ }
+
+ }
+ else {
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ appinfo->tape_fid,
+ appinfo->bset_num );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ VLM_GetSortDate( appinfo->tape_fid, appinfo->bset_num, &sort_date );
+
+ bset = VLM_FindBset( appinfo->tape_fid, appinfo->bset_num );
+
+ BSD_Add( tape_bsd_list, &bsd_ptr, bec_config, NULL,
+ NULL, bset->tape_fid, bset->tape_num, bset->bset_num, NULL, &sort_date );
+
+ VLM_FillInBSD( bsd_ptr );
+
+ }
+ }
+
+ if ( bsd_ptr != NULL ) {
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+ }
+
+ // Set the new selection status
+ // return if nothing is going to change
+
+ new_status = 0;
+
+ if ( attr ) {
+
+ attr = 1;
+
+ if ( ( FLM_GetStatus( flm ) & INFO_ISADIR ) &&
+ ( ! all_subdirs ) ) {
+
+ new_status = (INFO_SELECT|INFO_PARTIAL);
+ }
+ else {
+
+ new_status = INFO_SELECT;
+ }
+ }
+
+ if ( (UINT16)( FLM_GetStatus( flm ) & (INFO_SELECT|INFO_PARTIAL) ) != new_status ) {
+
+ FLM_SetStatus( flm, flm->status & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+ FLM_SetStatus( flm, flm->status | new_status );
+
+ DLM_Update( appinfo->win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)flm, 0 );
+
+ }
+
+ if ( appinfo->dle == NULL ) {
+ VLM_UpdateSearchSelections( appinfo->tape_fid, appinfo->bset_num );
+ }
+
+ // Now we taken care of the fse list, let's turn our attention
+ // to getting all those stupid check boxes right.
+
+ if ( BSD_GetMarkStatus( bsd_ptr ) == NONE_SELECTED ) {
+
+ VLM_DeselectAll( wininfo, TRUE );
+ free( path ) ;
+ return NULL;
+
+ }
+
+ // If the flm we just selected/deselected was a directory then all his
+ // subdirectories will need to be checked in the tree.
+
+ if ( ( FLM_GetStatus( flm ) & INFO_ISADIR ) &&
+ ( matching_slm != NULL ) ) {
+
+ VLM_MarkAllSLMChildren( matching_slm, attr, &total_dirs, &total_files, &total_bytes );
+
+ if ( ( SLM_GetStatus( matching_slm ) & (INFO_SELECT|INFO_PARTIAL) ) !=
+ ( FLM_GetStatus( flm ) & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ SLM_SetStatus( matching_slm, matching_slm->status & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+ SLM_SetStatus( matching_slm, matching_slm->status | (flm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL) ) );
+
+ DLM_Update( appinfo->win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)matching_slm, 0 );
+ }
+
+ }
+
+ slm = appinfo->open_slm;
+ level = SLM_GetLevel( slm );
+
+ // Adjust all the slm's parents
+
+ do {
+
+ // Is it a parent directory ?
+
+ if ( SLM_GetLevel( slm ) == level ) {
+
+ path = VLM_GetPathForSLM( slm, path, &path_size, &path_len );
+
+ // this path_len is in bytes.
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse_ptr, NULL,
+ path,
+ path_len,
+ SLM_GetAttribute( slm ),
+ NULL, NULL, NULL,
+ FALSE, TRUE );
+ status = 0;
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+ status = INFO_SELECT|INFO_PARTIAL;
+ }
+
+ if ( result == BSD_PROCESS_ENTIRE_DIR ) {
+ status = INFO_SELECT;
+ }
+
+ if ( (UINT16)(SLM_GetStatus( slm ) & (UINT16)(INFO_PARTIAL|INFO_SELECT)) != status ) {
+
+ SLM_SetStatus( slm, slm->status & (UINT16)~( INFO_SELECT | INFO_PARTIAL ) );
+ SLM_SetStatus( slm, slm->status | status );
+
+ DLM_Update( appinfo->win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+
+
+ if ( SLM_GetLevel( slm ) == 0 ) {
+ VLM_UpdateRoot( appinfo->win );
+ }
+
+ level = SLM_GetLevel( slm ) - 1; // New level to look for
+ }
+
+ slm = VLM_GetPrevSLM( slm );
+
+ } while ( slm != NULL );
+
+ free( path ) ;
+ return NULL;
+
+}
+
+
+/***************************************************
+
+ Name: VLM_FlmGetSelect
+
+ Description:
+
+ A callback function for the display manager to get the selection
+ status for this flm.
+
+*****************************************************/
+
+static BYTE VLM_FlmGetSelect(
+FLM_OBJECT_PTR flm ) // I - flm of interest
+{
+ if ( FLM_GetStatus( flm ) & INFO_SELECT ) {
+ return( 1 );
+ }
+
+ return( 0 );
+}
+
+
+/***************************************************
+
+ Name: VLM_FlmSetTag
+
+ Description:
+
+ A callback function for the display manager to set the tag status.
+
+*****************************************************/
+
+static VOID_PTR VLM_FlmSetTag(
+FLM_OBJECT_PTR flm, // I - flm to set
+BYTE attr ) // I - what to set it to
+{
+ if ( attr ) {
+ FLM_SetStatus( flm, flm->status | (UINT16)INFO_TAGGED );
+ }
+ else {
+ FLM_SetStatus( flm, flm->status & (UINT16)~INFO_TAGGED );
+ }
+
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_FlmGetTag
+
+ Description:
+
+ A callback function for the display manager to get the tag status.
+
+*****************************************************/
+
+static BYTE VLM_FlmGetTag(
+FLM_OBJECT_PTR flm ) // I - flm of interest
+{
+ if ( FLM_GetStatus( flm ) & INFO_TAGGED ) {
+ return( 1 );
+ }
+ return( 0 );
+}
+
+/***************************************************
+
+ Name: VLM_FlmGetItemCount
+
+ Description:
+
+ A callback function for the display manager to see how many
+ items we are going to display.
+
+*****************************************************/
+
+static USHORT VLM_FlmGetItemCount(
+Q_HEADER_PTR QHdr ) // I - queue to use
+{
+ return( QueueCount(QHdr) );
+}
+
+/***************************************************
+
+ Name: VLM_FlmGetFirstItem
+
+ Description:
+
+ A callback function for the display manager to get the first flm
+ to display.
+
+*****************************************************/
+
+static VOID_PTR VLM_FlmGetFirstItem(
+Q_HEADER_PTR Q_hdr ) // I - queue to use
+{
+ return( VLM_GetFirstFLM( Q_hdr ) );
+}
+
+/***************************************************
+
+ Name: VLM_FlmGetPrevItem
+
+ Description:
+
+ A callback function for the display manager to get the previous
+ flm to display.
+
+*****************************************************/
+
+static VOID_PTR VLM_FlmGetPrevItem(
+FLM_OBJECT_PTR flm ) // I - current flm
+{
+
+ return( VLM_GetPrevFLM( flm ) );
+
+}
+
+/***************************************************
+
+ Name: VLM_FlmGetNextItem
+
+ Description:
+
+ A callback function for the display manager to get the next
+ flm to display.
+
+*****************************************************/
+
+static VOID_PTR VLM_FlmGetNextItem(
+FLM_OBJECT_PTR flm ) // I - current flm
+{
+
+ return( VLM_GetNextFLM( flm ) );
+
+}
+
+
+/***************************************************
+
+ Name: VLM_FlmGetObjects
+
+ Description:
+
+ A callback function for the display manager to get the objects
+ that I want displayed for this flm.
+
+*****************************************************/
+
+
+static VOID_PTR VLM_FlmGetObjects(
+FLM_OBJECT_PTR flm ) // I - flm to use
+{
+ BYTE_PTR memblk;
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+ INT uparrow = FALSE;
+ INT directory = FALSE;
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ static BYTE NT_Kludge[ 1000 ];
+
+
+ /***********
+
+ Some how under NT only the app is acting more multithreaded than normal
+ When the file list is changed, the old one is thrown out, but the DLM
+ calls me from DLM_WMMeasureItem before I have told him the list has been
+ updated. I have been unable to solve this bug. The NT_Kludge variable
+ covers it up.
+
+ ************/
+
+ // data area has a 6 byte header
+
+ wininfo = FLM_GetXtraBytes( flm );
+
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( WMDS_GetWinFlatList( wininfo ) );
+
+ if ( memblk == NULL ) {
+ memblk = NT_Kludge;
+ }
+
+ // skip over 6 bytes before starting
+
+ item = (DLM_ITEM_PTR)(memblk + 6);
+
+ if ( WMDS_GetMenuState( wininfo ) & MMDOC_NAMEONLY ) {
+ *memblk = 3; // number of items in list
+ }
+ else {
+ *memblk = 7; // number of items in list
+ }
+
+
+ if ( FLM_GetStatus( flm ) & INFO_ISADIR ) {
+ directory = TRUE;
+ }
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembMaxTextLen( item ) = (BYTE)FLM_GetMaxSize( flm );
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+
+ // Patch it, if it was a fake parent directory entry.
+
+ if ( strcmp( TEXT(".."), FLM_GetName( flm ) ) ) {
+
+ if ( FLM_GetStatus( flm ) & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( FLM_GetStatus( flm ) & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ }
+ else {
+
+ // No check box if up arrow at top of list.
+
+ DLM_ItemwId( item ) = 0;
+ }
+
+ item++;
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+
+ if ( FLM_GetStatus( flm ) & INFO_ISADIR ) {
+
+ if ( FLM_GetStatus( flm ) & INFO_EMPTY ) {
+
+ if ( flm->status & INFO_CORRUPT ) {
+ DLM_ItemwId( item ) = IDRBM_FOLDER_ECN;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EN;
+ }
+ }
+ else {
+
+ if ( flm->status & INFO_CORRUPT ) {
+ DLM_ItemwId( item ) = IDRBM_FOLDERC;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_FOLDER;
+ }
+ }
+ }
+ else {
+
+ if ( FLM_GetAttribute( flm ) & OBJ_HIDDEN_BIT ) {
+
+ if ( FLM_GetStatus( flm ) & INFO_EXEFILE ) {
+ DLM_ItemwId( item ) = IDRBM_HEXEFILE;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_HFILE;
+ }
+
+ if ( FLM_GetStatus( flm ) & INFO_CORRUPT ) {
+ DLM_ItemwId( item ) = IDRBM_HCRPTFILE;
+ }
+ }
+ else {
+ if ( FLM_GetStatus( flm ) & INFO_EXEFILE ) {
+ DLM_ItemwId( item ) = IDRBM_EXE;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_FILE;
+ }
+
+ if ( FLM_GetStatus( flm ) & INFO_CORRUPT ) {
+ DLM_ItemwId( item ) = IDRBM_CORRUPTFILE;
+ }
+ }
+ }
+
+
+ // Patch it, if it was a fake parent directory entry.
+
+ if ( ! strcmp( TEXT(".."), FLM_GetName( flm ) ) ) {
+ DLM_ItemwId( item ) = IDRBM_PARENTDIR;
+ uparrow = TRUE;
+ }
+
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)FLM_GetMaxName( flm );
+ DLM_ItembLevel( item ) = 0;
+ if ( uparrow ) {
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), TEXT("") );
+ }
+ else {
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)FLM_GetName( flm ) );
+ }
+
+
+
+ // Now fill in the other 4 fields if we are going to display them.
+
+
+ if ( ! ( WMDS_GetMenuState( wininfo ) & MMDOC_NAMEONLY ) ) {
+
+ item++;
+ DLM_ItemcbNum( item ) = 4;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)FLM_GetMaxSize( flm );
+ DLM_ItembLevel( item ) = 0;
+ if ( directory || uparrow ) {
+ sprintf((CHAR_PTR)text, TEXT("%12s"), TEXT("") );
+ }
+ else {
+ sprintf((CHAR_PTR)text, TEXT("%12s"), (CHAR_PTR)flm->size_str );
+ }
+ strcpy((CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)text);
+
+ item++;
+ DLM_ItemcbNum( item ) = 5;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)flm->max_date;
+ DLM_ItembLevel( item ) = 0;
+ if ( uparrow ) {
+ sprintf((CHAR_PTR)text, TEXT("%8s"), TEXT("") );
+ }
+ else {
+ sprintf((CHAR_PTR)text, TEXT("%8s"), (CHAR_PTR)flm->date_str );
+ }
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)text);
+
+ item++;
+ DLM_ItemcbNum( item ) = 6;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)flm->max_time;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItembLevel( item ) = 0;
+ if ( uparrow ) {
+ sprintf((CHAR_PTR)text, TEXT("%8s"), TEXT("") );
+ }
+ else {
+ sprintf((CHAR_PTR)text, TEXT("%8s"), (CHAR_PTR)flm->time_str );
+ }
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)text);
+
+ item++;
+ DLM_ItemcbNum( item ) = 7;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)FLM_GetMaxAttr( flm );
+ DLM_ItembLevel( item ) = 0;
+ if ( uparrow ) {
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), TEXT("") );
+ }
+ else {
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)flm->attrib_str );
+ }
+
+ }
+
+ return( memblk );
+}
+
+
+/***************************************************
+
+ Name: VLM_FlmSetObjects
+
+ Description:
+
+ A callback function for the display manager to tell me that the
+ user click or double clicked on an flm item.
+
+*****************************************************/
+
+static BOOLEAN VLM_FlmSetObjects(
+FLM_OBJECT_PTR flm, // I - flm to use
+WORD operation, // I - what user did
+WORD ObjectNum ) // I - what item he did it to
+{
+ CHAR_PTR s;
+ FLM_OBJECT_PTR temp_flm;
+ SLM_OBJECT_PTR slm;
+ CHAR keyb_char;
+ CHAR *directory;
+ INT directory_size;
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ HWND window;
+ CHAR msg_title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR msg_text[ MAX_UI_RESOURCE_SIZE ];
+
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ // Work forward from current location.
+
+ temp_flm = flm;
+
+ do {
+
+ temp_flm = VLM_GetNextFLM( temp_flm );
+
+ if ( temp_flm != NULL ) {
+
+ if ( keyb_char == toupper( *FLM_GetName( temp_flm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( FLM_GetXtraBytes( temp_flm ) ),
+ 0,
+ (LMHANDLE)temp_flm );
+ return( TRUE );
+ }
+ }
+
+ } while ( temp_flm != NULL );
+
+ // Start at the beginning again.
+
+ temp_flm = VLM_GetFirstFLM( WMDS_GetFlatList( FLM_GetXtraBytes( flm ) ) );
+
+ while ( temp_flm != flm && temp_flm != NULL ) {
+
+ if ( temp_flm != NULL ) {
+
+ if ( keyb_char == *FLM_GetName( temp_flm ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( FLM_GetXtraBytes( temp_flm ) ),
+ 0,
+ (LMHANDLE)temp_flm );
+ return( TRUE );
+ }
+
+ temp_flm = VLM_GetNextFLM( temp_flm );
+ }
+
+ }
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( FLM_GetXtraBytes( flm ) ),
+ 0,
+ (LMHANDLE)flm );
+ }
+
+ // If the item was a directory, then make that the active directory
+ // otherwise do nothing.
+
+ if ( ( operation == WM_DLMDBCLK ) &&
+ ( ObjectNum >= 2 ) ) {
+
+ if ( FLM_GetStatus( flm ) & INFO_ISADIR ) {
+
+ WM_ShowWaitCursor( TRUE );
+
+ wininfo = FLM_GetXtraBytes( flm );
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( wininfo );
+ window = WMDS_GetWin( wininfo );
+
+ directory_size = WM_GetTitle( window, NULL, 0 );
+ directory_size += strlen( FLM_GetName( flm ) );
+ directory_size += 256;
+ directory_size *= sizeof(CHAR);
+
+ directory = malloc( directory_size );
+
+ WM_GetTitle( window, directory, directory_size / sizeof(CHAR ) );
+
+ s = directory;
+ while ( *s ) {
+ s++;
+ }
+
+ while ( *s != TEXT('\\') ) {
+ s--; // skip over *.*
+ }
+
+ if ( strcmp( TEXT(".."), FLM_GetName( flm ) ) ) {
+ s++;
+ strcpy( s, FLM_GetName( flm ) ); // add new dir
+ }
+ else {
+ s--;
+ while ( *s != TEXT('\\') ) s--; // skip over last dir
+ *s = TEXT( '\0' );
+ }
+
+ slm = VLM_RetrieveSLM( directory, window );
+
+ if ( slm != NULL ) {
+
+ SLM_SetStatus( appinfo->open_slm, appinfo->open_slm->status & (UINT16)~INFO_OPEN );
+ appinfo->open_slm = slm;
+
+ SLM_SetStatus( appinfo->open_slm, appinfo->open_slm->status | (UINT16)INFO_OPEN );
+
+ // Make our new open_slm the active one.
+
+ VLM_MakeSLMActive( appinfo->open_slm );
+
+ // Now redo the file list to match the open slm
+
+ VLM_HandleFSError( VLM_FileListReuse( window, directory ) );
+
+ // Change the title
+
+ strcat( directory, TEXT("\\*.*") );
+ WM_SetTitle( window, directory );
+ }
+ else {
+
+ // They need a refresh command.
+ // New directories are around that are not in the tree.
+ }
+
+ free( directory );
+
+ WM_ShowWaitCursor( FALSE );
+ }
+ else {
+
+#ifndef OEM_MSOFT
+
+ wininfo = FLM_GetXtraBytes( flm );
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( wininfo );
+ window = WMDS_GetWin( wininfo );
+
+ directory_size = WM_GetTitle( window, directory, 0 );
+ directory_size += strlen( FLM_GetName( flm ) );
+ directory_size += 256;
+
+ directory_size *= sizeof(CHAR);
+
+ directory = malloc( directory_size );
+
+ WM_GetTitle( window, directory, directory_size / sizeof(CHAR) );
+
+ s = directory;
+ while ( *s ) {
+ s++;
+ }
+
+ while ( *s != TEXT('\\') ) {
+ s--; // skip over *.*
+ }
+
+ s++;
+ strcpy( s, FLM_GetName( flm ) );
+
+ while ( *s != TEXT(':') ) {
+ s--;
+ }
+
+ s++;
+
+ // Pass "\dos\bin\cl.exe"
+
+ VLM_StartSearch( s );
+
+ free( directory );
+#endif
+ }
+ }
+
+ return( FALSE );
+}
+
+/***************************************************
+
+ Name: VLM_MakeSLMActive
+
+ Description:
+
+ Take the given slm and make it the currently tagged one. If we
+ have not checked it for children that will have to be done. Also
+ if its not displayed, it will need to be.
+
+*****************************************************/
+
+VOID VLM_MakeSLMActive(
+SLM_OBJECT_PTR slm ) // I - slm to use
+{
+ WININFO_PTR wininfo;
+ INT level;
+ HWND window;
+ SLM_OBJECT_PTR anchor_slm;
+ SLM_OBJECT_PTR start_slm;
+
+ // To make this guy displayable we have to make all his brothers
+ // displayable also. And if any of them haven't been checked for
+ // children they must be.
+
+ wininfo = SLM_GetXtraBytes( slm );
+ window = WMDS_GetWin( wininfo );
+
+ anchor_slm = slm;
+
+ // find the earliest related brother !
+
+ level = SLM_GetLevel( slm );
+
+ start_slm = slm;
+
+ slm = VLM_GetPrevSLM( slm );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetLevel( slm ) < level ) {
+ SLM_SetStatus( slm, slm->status | (UINT16)INFO_EXPAND); // change parent to a minus
+ break;
+ }
+ start_slm = slm;
+ slm = VLM_GetPrevSLM( slm );
+ }
+
+ slm = start_slm;
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetLevel( slm ) < level ) {
+ break;
+ }
+
+ if ( ( SLM_GetLevel( slm ) == level ) ) {
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_DISPLAY ) ) {
+
+ SLM_SetStatus( slm, slm->status | (UINT16)INFO_DISPLAY );
+ }
+
+ slm = slm->next_brother;
+ }
+ else {
+ slm = VLM_GetNextSLM( slm );
+ }
+ }
+
+ VLM_UpdateBrothers( WMDS_GetTreeList( wininfo ) );
+
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)anchor_slm, 0 );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ), 0, (LMHANDLE)anchor_slm );
+}
+
+
+/***************************************************
+
+ Name: VLM_RetrieveSLM
+
+ Description:
+
+ Given the path and window, find the slm which is the deepest
+ directory in that path.
+
+*****************************************************/
+
+SLM_OBJECT_PTR VLM_RetrieveSLM(
+CHAR_PTR path, // I - path of interest
+HWND win ) // I - window path is from
+{
+ INT level = 0;
+ INT height = 0;
+ SLM_OBJECT_PTR slm;
+ CHAR_PTR s;
+ CHAR_PTR local_path;
+ WININFO_PTR wininfo;
+ CHAR *temp_path;
+ INT16 ret;
+
+ local_path = ( LPSTR )malloc( strsize(path) );
+
+ if ( local_path == NULL ) {
+ return( (SLM_OBJECT_PTR)NULL );
+ }
+
+ s = path + strlen( path );
+ while ( *s != TEXT(':') ) s--;
+ s++;
+ strcpy( local_path, s );
+ s = local_path;
+ while ( *s ) {
+ if ( *s == TEXT('\\') ) {
+ level++;
+ *s = 0;
+ }
+ s++;
+ }
+
+ wininfo = WM_GetInfoPtr( win );
+
+ slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) );
+
+ s = local_path;
+
+ while ( height <= level ) {
+
+ do {
+
+ if ( SLM_GetLevel( slm ) == height ) {
+
+ if ( ! stricmp( s, SLM_GetName( slm ) ) ||
+ ((height == 0) && (SLM_GetLevel( slm ) == 0)) ) {
+
+ if ( ! ( slm->status & INFO_VALID ) && ( height < level ) ) {
+
+ // The desired SLM is not in the tree yet.
+
+ temp_path = VLM_BuildPath( slm );
+
+ ret = VLM_CheckForChildren( WMDS_GetTreeList( wininfo ),
+ slm, temp_path,
+ 1, // <- depth to look
+ FALSE );
+
+ free( temp_path );
+
+ slm->status |= INFO_VALID;
+ }
+
+ height++;
+ break;
+ }
+ else {
+ slm = slm->next_brother;
+ }
+ }
+ else {
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ if ( slm == NULL ) { // could happen !
+ return( NULL ); // if refresh needed.
+ }
+
+ } while ( TRUE );
+
+ while ( *s++ ) ;
+ }
+
+ free( local_path );
+ return( slm );
+}
+
+
+/***************************************************
+
+ Name: VLM_UpdateFlmItem
+
+ Description:
+
+ A user selected or deselected a subdirectory in the tree list that
+ also is currently displayed in the file list. This routine finds
+ the correct flm, and updates it.
+
+*****************************************************/
+
+VOID VLM_UpdateFLMItem(
+HWND window, // I - window flm is in
+SLM_OBJECT_PTR slm ) // I - what to set it to
+{
+ WININFO_PTR wininfo;
+ FLM_OBJECT_PTR flm;
+ BOOLEAN all_subdirs;
+
+ all_subdirs = (BOOLEAN) CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ wininfo = WM_GetInfoPtr( window );
+
+ flm = VLM_GetFirstFLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( flm != NULL ) {
+
+ if ( ! stricmp( SLM_GetName( slm ), FLM_GetName( flm ) ) ) {
+ break;
+ }
+
+ flm = VLM_GetNextFLM( flm );
+ }
+
+ if ( flm != NULL ) {
+
+ if ( ( FLM_GetStatus( flm ) & (INFO_SELECT|INFO_PARTIAL) ) !=
+ ( SLM_GetStatus( slm ) & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ FLM_SetStatus( flm, flm->status & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+ FLM_SetStatus( flm, flm->status | (slm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL)) );
+
+ DLM_Update( window,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)flm, 0 );
+ }
+ }
+
+}
diff --git a/private/utils/ntbackup/src/vlm_find.c b/private/utils/ntbackup/src/vlm_find.c
new file mode 100644
index 000000000..4c758d89d
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_find.c
@@ -0,0 +1,480 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_FIND.C
+
+ Description:
+
+ This file contains file find routines which use the file
+ manager for searching directories.
+
+ The following public functions are implemented in this file:
+
+ VLM_FindFirst - Find first matching file or subdirectory
+ VLM_FindNext - Find next file in set
+ VLM_FindClose - Terminate a FindFirst/FindNext sequence
+
+ $Log: G:/UI/LOGFILES/VLM_FIND.C_V $
+
+ Rev 1.11 27 Jul 1993 14:14:04 MARINA
+enable c++
+
+ Rev 1.10 23 Jul 1993 11:19:20 MIKEP
+Fix logfile dates to match the logfile times.
+
+ Rev 1.9 18 Feb 1993 11:16:58 BURT
+Change to convert from universal time to local file time/date
+for Cayman (OS_WIN32)
+
+
+ Rev 1.8 07 Oct 1992 15:08:58 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.7 04 Oct 1992 19:42:22 DAVEV
+Unicode Awk pass
+
+ Rev 1.6 14 May 1992 18:05:30 MIKEP
+nt pass 2
+
+ Rev 1.5 06 May 1992 14:41:18 MIKEP
+unicode pass two
+
+ Rev 1.4 04 May 1992 13:40:04 MIKEP
+unicode pass 1
+
+ Rev 1.3 05 Feb 1992 14:57:18 DAVEV
+NT-Only: return value from FindFirstFile is -1 if no files found - not 0
+
+ Rev 1.1.1.1 03 Feb 1992 14:28:12 DAVEV
+fixes for NT
+
+ Rev 1.1 07 Jan 1992 15:31:26 DAVEV
+Change dos_findfirst,etc. to VLM_FindFirst,etc.
+
+ Rev 1.0 23 Dec 1991 14:03:06 DAVEV
+first revision
+
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// VLM_ValidateAttr -- compare a found file to the specified attributes
+// -----------------------------------------------------------------------
+
+// Compare the attributes of a found file to the Inclusion/Exclusion
+// flags and return TRUE if the file is ok, FALSE otherwise.
+
+// If it is subdirectory or system or hidden, these types
+// are never returned unless explicitly specified in the
+// find attributes, otherwise, this is a normal file. Check
+// if the normal file inclusion flag is specified.
+
+// Next check to see if it is an excluded type. If not, this
+// is an acceptable entry, so copy it into the buffer and
+// we are done.
+
+// Input:USHORT targ inclusion/exclusion attribute flags
+// USHORT attr attributes of file to validate
+
+// Return: TRUE file is validated as acceptable
+// FALSE file is not of proper type
+
+
+#ifdef OS_WIN32 //32-bit Windows / NT version:
+
+
+# define VLM_ValidateAttr(targ,attr) \
+ ( ( ( ((targ) & VLMFIND_SUBDIR ) \
+ && ((attr) & FILE_ATTRIBUTE_DIRECTORY) ) \
+ || ( ((targ) & VLMFIND_NORMAL ) \
+ && !((attr) & FILE_ATTRIBUTE_DIRECTORY) ) ) \
+ && ( ((targ) & VLMFIND_HIDDEN ) \
+ || !((attr) & FILE_ATTRIBUTE_HIDDEN ) ) \
+ && ( ((targ) & VLMFIND_SYSTEM ) \
+ || !((attr) & FILE_ATTRIBUTE_SYSTEM ) ) \
+ && !( ((targ) & VLMFIND_NOARCH ) \
+ && ((attr) & FILE_ATTRIBUTE_ARCHIVE ) ) \
+ && !( ((targ) & VLMFIND_NORDONLY) \
+ && ((attr) & FILE_ATTRIBUTE_READONLY ) ) )
+
+#else // 16-bit Windows/DOS version:
+
+# define VLM_ValidateAttr(targ,attr) \
+ ( ( ( (attr) & ( _A_HIDDEN | _A_SYSTEM | _A_SUBDIR ) ) \
+ || ( (targ) & VLMFIND_NORMAL ) ) \
+ && !( ( (targ) & VLMFIND_NOARCH ) && ( (attr) & _A_ARCH ) ) \
+ && !( ( (targ) & VLMFIND_NORDONLY ) && ( (attr) & _A_RDONLY ) ) )
+
+#endif
+
+/**********************
+
+ NAME : VLM_FindFirst, VLM_FindNext, VLM_FindClose
+
+ PROTOTYPE:
+
+ #include <stdtypes.h>
+ #include <vlm.h>
+
+ VLM_FIND_PTR VLM_FindFirst (
+ TCHAR_PTR file, // I - name of file or subdirectory
+ // may contain (OS specific) wildcards
+ VLM_FINDATTR findAttr, // I - search criteria flags
+ TCHAR_PTR first); // O - First matching file name found
+ // (without drive or path)
+
+ BOOLEAN VLM_FindNext (
+ VLM_FIND_PTR find, // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+ TCHAR_PTR next); // O - File name of next file found
+
+ VOID VLM_FindClose (
+ VLM_FIND_PTR *find); // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+
+ DESCRIPTION :
+
+ Find all files or subdirectories in a set specified using
+ an Operating Sysytem specific file name path which may contain any wild
+ cards normally allowed by the operating system.
+
+ VLM_FindFirst must be called first to get the first file found in
+ the set. VLM_FindNext may then be repeatedly called to obtain all
+ subsequent files in the set. The order of the file names returned
+ may be arbitrary.
+
+ VLM_FindClose MUST be called to free system resources after the program
+ has finished.
+
+ VLM_FindFirst RETURNS :
+
+ NULL - if an error occurred, otherwise
+ VLM_FIND_PTR - pointer to an internal data structure required for
+ subsequent calls to VLM_FindNext and VLM_FindClose.
+
+ NOTE: This pointer should never be accessed by the
+ calling program!
+
+ file - The buffer provided by the caller is filled with the
+ file name (sans path or drive) of the first file
+ found matching the specifications.
+
+ VLM_FindNext RETURNS:
+
+ TRUE - A matching file was found and placed in the pszNext
+ buffer.
+ FALSE - The list of matching files is exhausted. VLM_FindClose
+ should now be called to free system resources.
+
+ next - The buffer provided by the caller is filled with the
+ next file found in the set specified by the initial
+ VLM_FindFirst call.
+
+ VLM_FindClose RETURNS:
+
+ Nothing. The VLM_FIND_PTR pointed to in the function parameter is
+ set to NULL.
+
+ NOTES:
+
+ file - The form used to specify the filename pattern is
+ operating system dependant.
+ For DOS, OS/2 and NT, it is a standard drive, path and
+ file name string:
+ [d:][path]fname
+
+ The path must utilize backslashes as unit seperators,
+ like normal. The file name may contain ? and * wildcards
+ in the normal maner.
+
+ findAttr - This parameter may contain one or more of the following
+ flags logically or'd together:
+
+ VLMFIND_NORMAL - Include matching files
+ VLMFIND_SUBDIR - Include matching subdirs
+
+ VLMFIND_NORDONLY - Exclude read-only files/subdirs
+ VLMFIND_NOARCH - Exclude archived files/subdirs
+
+ VLMFIND_HIDDEN - Include hidden files/subdirs
+ VLMFIND_SYSTEM - Include system files/subdirs
+
+ Notice that these flags are divided into three groups.
+ The first group (NORMAL and SUBDIR) determine whether
+ (normal) files, subdirectories or both are to be
+ retrieved. If neither of these flags are specified,
+ VLMFIND_NORMAL is presumed (only files will be
+ retrieved - no subdirectories.)
+
+ The second group specifies whether read-only and/or
+ archive files or subdirectories should be excluded from
+ the retrieved list. These types will be included
+ unless otherwise specified.
+
+ Finally, the last group determines whether hidden or
+ system files or subdirectories are to be included.
+ These types will be excluded unless specified.
+
+ Examples:
+ VLMFIND_NORMAL | VLMFIND_SUBDIR
+ This will find all files and subdirectories which
+ do not have thier hidden or system flags set.
+
+ VLMFIND_NORMAL | VLMFIND_NORDONLY | VLMFIND_NOARCH
+ This will find only those files (no subdirectories)
+ which have no flags set at all.
+
+
+ VLMFIND_SUBDIR
+ This will only find subdirectories (no files)
+ which are neither hidden nor system.
+
+ first - These must point to a character buffer which MUST be
+ long enough to hold the largest possible returned
+ next file name. This length is defined by VLM_MAXFNAME
+ in VLM_FIND.H. The following declaration is
+ recommended:
+
+ CHAR szName [VLM_MAXFNAME];
+
+**********************/
+
+VLM_FIND_PTR VLM_FindFirst (
+ CHAR_PTR file, // I - name of file or subdirectory
+ // may contain (OS specific) wildcards
+ VLM_FINDATTR findAttr, // I - search criteria flags
+ CHAR_PTR first) // O - First matching file name found
+ // (without drive or path)
+
+{
+ VLM_FIND_PTR find_ptr = NULL;
+
+ if ( file && *file && first &&
+ ( find_ptr = (VLM_FIND_PTR)calloc( 1, sizeof( VLM_FIND ) ) ) )
+ {
+ *first = 0;
+
+ find_ptr->attr = findAttr;
+
+ // Use VLMFIND_NORMAL as the default if no inclusion type is specified
+
+ if ( !( find_ptr->attr & ( VLMFIND_SUBDIR | VLMFIND_NORMAL ) ) )
+ find_ptr->attr = ( VLM_FINDATTR )( (find_ptr->attr) | VLMFIND_NORMAL );
+
+
+# if defined (OS_WIN32) //32-bit Windows/NT version...
+ {
+ find_ptr->hFind = NULL;
+ // Get the first matching entry ...
+
+ find_ptr->hFind = FindFirstFile( file,
+ &find_ptr->nt_findbuf );
+
+ if ( find_ptr->hFind != (HANDLE)-1 )
+ {
+ do {
+ // compare the file type to the specified attributes...
+
+ if ( VLM_ValidateAttr ( find_ptr->attr,
+ find_ptr->nt_findbuf.dwFileAttributes ) )
+ {
+ // We have found the first match!
+ strcpy (first, find_ptr->nt_findbuf.cFileName);
+ }
+
+ // Otherwise, keep trying files to find the first good one...
+
+ } while ( ! *first &&
+ FindNextFile( find_ptr->hFind, &find_ptr->nt_findbuf ) );
+ }
+ }
+# else //16 bit Windows & DOS version...
+ {
+ unsigned usAttr = _A_NORMAL; //_dos_findfirst attributes
+
+ if ( find_ptr->attr & VLMFIND_SUBDIR ) usAttr |= _A_SUBDIR;
+ if ( find_ptr->attr & VLMFIND_HIDDEN ) usAttr |= _A_HIDDEN;
+ if ( find_ptr->attr & VLMFIND_SYSTEM ) usAttr |= _A_SYSTEM;
+
+ // Get the first matching entry ...
+
+ if ( !_dos_findfirst( file, usAttr, &find_ptr->dos_findbuf ) )
+ {
+ do {
+ // compare the file type to the specified attributes...
+
+ if ( VLM_ValidateAttr( find_ptr->attr,
+ find_ptr->dos_findbuf.attrib ) )
+ {
+ // We have found the first match!
+ strcpy( first, find_ptr->dos_findbuf.name );
+ }
+
+ // Otherwise, keep trying files to find the first good one...
+
+ } while ( !*first && !_dos_findnext ( &find_ptr->dos_findbuf ) );
+ }
+ }
+# endif
+
+ if ( !*first )
+ {
+ VLM_FindClose( &find_ptr );
+ }
+ }
+
+ return( find_ptr );
+}
+
+
+BOOLEAN VLM_FindNext (
+ VLM_FIND_PTR find_ptr, // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+ CHAR_PTR next_ptr) // O - File name of next file in set
+
+{
+ if ( find_ptr && next_ptr)
+ {
+ *next_ptr = 0;
+
+# if defined ( OS_WIN32 ) //32-bit Windows/NT version...
+ {
+ while ( !*next_ptr && FindNextFile ( find_ptr->hFind,
+ &find_ptr->nt_findbuf ) )
+ {
+ // compare the file type to the specified attributes...
+
+ if ( VLM_ValidateAttr ( find_ptr->attr,
+ find_ptr->nt_findbuf.dwFileAttributes ) )
+ {
+ // We have found the first match!
+ strcpy( next_ptr, find_ptr->nt_findbuf.cFileName);
+ }
+ }
+ }
+# else //16-bit Windows/DOS version ...
+ {
+ while ( !*next_ptr && !_dos_findnext ( &find_ptr->dos_findbuf ) )
+ {
+ // compare the file type to the specified attributes...
+
+ if ( VLM_ValidateAttr( find_ptr->attr,
+ find_ptr->dos_findbuf.attrib ) )
+ {
+ // We have found the next match!
+ strcpy (next_ptr, find_ptr->dos_findbuf.name);
+ }
+ }
+ }
+# endif
+ }
+ return ( *next_ptr != 0 );
+}
+
+
+VOID VLM_FindClose (
+ VLM_FIND_PTR FAR * find_ptr) // IO- Find data structure returned from
+ // a previous VLM_FindFirst
+{
+ if ( find_ptr && *find_ptr )
+ {
+# if defined ( OS_WIN32 )
+ {
+ if ( (*find_ptr)->hFind )
+ {
+ FindClose ( (*find_ptr)->hFind );
+ }
+ }
+# endif
+
+ free ( *find_ptr );
+ *find_ptr = NULL;
+ }
+}
+
+#if defined ( OS_WIN32 ) //These functions are unique to 32-bit Windows/NT
+
+ /*
+ * VLM_FindDosTime, VLM_FindDosDate
+ *
+ * Given an NT-style file time structure, return the DOS-style
+ * file date or time. Note that the file's date/time stamp must be
+ * between 1/1/1980 and 12/31/2099 for these functions to work
+ * properly. If the file date/time stamp is outside of this range
+ * the returned values will be 0.
+ *
+ * THESE FUNCTIONS ARE A KLUDGE. THEY AND THE VLM_FindXxxxXxxx()
+ * DATE/TIME MACROS IN VLM_FIND.H NEED TO BE FIXED IN THE FUTURE.
+ */
+
+ USHORT VLM_FindDosTime (FILETIME ft)
+ {
+ USHORT usDosDate;
+ USHORT usDosTime;
+#ifdef OS_WIN32
+ FILETIME tft ; // Needed to convert to local time from U time.
+
+ FileTimeToLocalFileTime( &ft, &tft ) ; // Do the conversion
+ // Must use temp FILETIME var since can't use the input arg
+ // as the target of the previous conversion.
+ if (!FileTimeToDosDateTime ( &tft, &usDosDate, &usDosTime ))
+ {
+ return 0;
+ }
+#else
+
+ if (!FileTimeToDosDateTime ( &ft, &usDosDate, &usDosTime ))
+ {
+ return 0;
+ }
+#endif
+ return usDosTime;
+ }
+
+ USHORT VLM_FindDosDate (FILETIME ft)
+ {
+ USHORT usDosDate;
+ USHORT usDosTime;
+
+#ifdef OS_WIN32
+ FILETIME tft ; // Needed to convert to local time from U time.
+
+ FileTimeToLocalFileTime( &ft, &tft ) ; // Do the conversion
+ // Must use temp FILETIME var since can't use the input arg
+ // as the target of the previous conversion.
+ if (!FileTimeToDosDateTime ( &tft, &usDosDate, &usDosTime ))
+ {
+ return 0;
+ }
+#else
+
+ if (!FileTimeToDosDateTime ( &ft, &usDosDate, &usDosTime ))
+ {
+ return 0;
+ }
+
+#endif
+ return usDosDate;
+ }
+
+#endif //end 32-bit Windows/NT unique functions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/private/utils/ntbackup/src/vlm_init.c b/private/utils/ntbackup/src/vlm_init.c
new file mode 100644
index 000000000..aec48efe5
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_init.c
@@ -0,0 +1,144 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_INIT.C
+
+ Description:
+
+ VLM init code.
+
+ $Log: G:/UI/LOGFILES/VLM_INIT.C_V $
+
+ Rev 1.18 07 Oct 1992 15:04:56 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.17 04 Oct 1992 19:42:24 DAVEV
+Unicode Awk pass
+
+ Rev 1.16 29 Jul 1992 09:51:44 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.15 27 Jun 1992 17:58:34 MIKEP
+changes for qtc
+
+ Rev 1.14 14 May 1992 18:06:14 MIKEP
+nt pass 2
+
+ Rev 1.13 06 May 1992 14:40:46 MIKEP
+unicode pass two
+
+ Rev 1.12 04 May 1992 13:39:34 MIKEP
+unicode pass 1
+
+ Rev 1.11 27 Apr 1992 16:20:30 JOHNWT
+added flag for reading startup.bks
+
+ Rev 1.10 09 Mar 1992 16:32:38 ROBG
+no changes
+
+ Rev 1.9 14 Jan 1992 12:59:12 MIKEP
+vcs header
+
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/*
+ The function to init and create the primary windows.
+*/
+
+BOOL VLM_Init( BOOL read_startup )
+
+{
+ BSD_PTR bsd;
+
+ WM_ShowWaitCursor( TRUE );
+
+ zprintf( DEBUG_USER_INTERFACE, RES_INIT_VLM );
+
+ // Load up the catalogs
+
+ VLM_LookForCatalogFiles();
+
+ // Call the backup engine init stuff
+
+ bsd = BSD_GetFirst( bsd_list );
+
+ while ( bsd != NULL ) {
+
+ BSD_SetTHW( bsd, thw_list );
+ bsd = BSD_GetNext( bsd );
+ }
+
+ // Init bsd_list for tapes, This is NEW for GUI.
+
+ tape_bsd_list = (BSD_HAND)malloc( sizeof(BSD_LIST) );
+
+ if ( tape_bsd_list == NULL ) {
+ goto failure;
+ }
+
+ InitQueue( &(tape_bsd_list->current_q_hdr) );
+ InitQueue( &(tape_bsd_list->last_q_hdr) );
+
+ if ( VLM_DisksListCreate() != SUCCESS ) {
+ goto failure;
+ }
+
+ // If needed create the servers window
+
+ if ( gfServers ) {
+
+ if ( VLM_ShowServers( TRUE ) != SUCCESS ) {
+ goto failure;
+ }
+ }
+
+#ifdef OEM_EMS // Initialize the exchange window queue and add any entries.
+
+ if ( VLM_ExchangeInit( ) != SUCCESS ) {
+ goto failure;
+ }
+#endif //OEM_EMS
+
+ // Create the tapes window
+
+ if ( VLM_TapesListCreate( ) != SUCCESS ) {
+ goto failure;
+ }
+
+ // Init the Password list.
+
+ if ( PSWD_InitPSWDList() != SUCCESS ) {
+ goto failure;
+ }
+
+ // Load the default file selections.
+
+ if ( read_startup ) {
+ VLM_LoadDefaultSelections();
+ }
+
+ WM_ShowWaitCursor( FALSE );
+
+ return( SUCCESS );
+
+failure:
+
+ WM_ShowWaitCursor( FALSE );
+
+ return( FAILURE );
+
+}
+
+
+
+
diff --git a/private/utils/ntbackup/src/vlm_menu.c b/private/utils/ntbackup/src/vlm_menu.c
new file mode 100644
index 000000000..29aa58dd9
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_menu.c
@@ -0,0 +1,1041 @@
+
+/*******************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_MENU.C
+
+ Description:
+
+ This file contains the functions used when a user initiates an action
+ with a menu selection or ribbon button. These include things like
+ expanding directory trees, selecting all tagged files, or adding an
+ advanced FSE selection.
+
+ $Log: G:\UI\LOGFILES\VLM_MENU.C_V $
+
+ Rev 1.52.1.0 08 Dec 1993 11:23:26 MikeP
+very deep pathes and unicode
+
+ Rev 1.52 27 Jul 1993 14:40:02 MARINA
+enable c++
+
+ Rev 1.51 15 Jul 1993 10:39:50 BARRY
+Don't create a second fse fred* when fred*.* is created; need bsdmatch.c fix.
+
+ Rev 1.50 07 Jul 1993 15:22:46 CARLS
+added WM_ShowWaitCursor to password prompt
+
+ Rev 1.49 07 May 1993 14:22:00 DARRYLP
+Added Rob's fixes for Windows double clicks and ID_DELETE key trappings.
+
+ Rev 1.48 27 Apr 1993 05:20:34 GREGG
+Don't do the fancy sort stuff for OEM_MSOFT.
+
+ Rev 1.47 26 Apr 1993 08:52:30 MIKEP
+Add numerous changes to fully support the font case selection
+for various file system types. Also add refresh for tapes window
+and sorting of tapes window.
+
+ Rev 1.46 23 Apr 1993 10:20:38 MIKEP
+Add ability to refresh tapes window.
+Add support for sorting files window by various methods.
+Fix refresh of sorting windows.
+
+ Rev 1.45 24 Mar 1993 17:50:14 STEVEN
+fix dot problem
+
+ Rev 1.44 11 Nov 1992 16:36:44 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.43 01 Nov 1992 16:12:12 DAVEV
+Unicode changes
+
+ Rev 1.42 07 Oct 1992 15:07:14 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.41 04 Oct 1992 19:42:28 DAVEV
+Unicode Awk pass
+
+ Rev 1.40 29 Jul 1992 09:32:18 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.39 10 Jul 1992 08:37:28 JOHNWT
+more gas guage work
+
+ Rev 1.38 07 Jul 1992 15:31:40 MIKEP
+unicode changes
+
+ Rev 1.37 30 Jun 1992 13:18:32 JOHNWT
+dynamically alloc stats
+
+ Rev 1.36 29 Jun 1992 10:42:16 JOHNWT
+added selected dir counts
+
+ Rev 1.35 19 Jun 1992 14:43:54 JOHNWT
+more gas
+
+ Rev 1.34 14 May 1992 18:05:32 MIKEP
+nt pass 2
+
+ Rev 1.33 13 May 1992 11:42:02 MIKEP
+NT changes
+
+ Rev 1.32 06 May 1992 14:41:36 MIKEP
+unicode pass two
+
+ Rev 1.31 04 May 1992 13:40:00 MIKEP
+unicode pass 1
+
+ Rev 1.30 30 Apr 1992 14:40:24 DAVEV
+OEM_MSOFT: Fix View-All File Details
+
+
+*******************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+// function prototypes for use in this file ONLY
+
+static VOID VLM_SelectButton( BYTE );
+
+
+/**********************
+
+ NAME : VLM_UpdateRoot
+
+ DESCRIPTION :
+
+ Update the parent device to match the selection status of the root
+ directory in the tree.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_UpdateRoot(
+HWND win ) // I - window to update root on
+{
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR server_vlm;
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ APPINFO_PTR server_appinfo;
+ SLM_OBJECT_PTR root;
+
+ (VOID)server_vlm ;
+ (VOID)server_appinfo ;
+
+ wininfo = WM_GetInfoPtr( win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( ( wininfo->wType != WMTYPE_DISKTREE ) &&
+ ( wininfo->wType != WMTYPE_TAPETREE ) ) {
+
+ // I told you NOT to do this !
+
+ return;
+ }
+
+ root = VLM_GetFirstSLM( wininfo->pTreeList );
+
+ if ( root == NULL ) {
+
+ // I can't imagine how you managed this
+
+ return;
+ }
+
+ // Update status of server/volume, disk, or tape/bset
+ // to match root.
+
+ if ( wininfo->wType == WMTYPE_DISKTREE ) {
+
+#ifndef OEM_MSOFT //unsupported feature
+
+ if ( appinfo->parent == gb_servers_win ) { // SERVERS
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ server_appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_servers_win );
+
+ server_vlm = VLM_GetFirstVLM( wininfo->pTreeList );
+
+ while ( server_vlm != NULL ) {
+
+ if ( QueueCount( &server_vlm->children ) ) {
+
+ vlm = VLM_GetFirstVLM( &server_vlm->children );
+
+ while ( vlm != NULL ) {
+
+ if ( ! strcmp( DLE_GetDeviceName(appinfo->dle),
+ vlm->name ) ) {
+
+ if ( ( vlm->status & (INFO_SELECT|INFO_PARTIAL) ) !=
+ ( root->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ vlm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ vlm->status |= root->status & (INFO_SELECT|INFO_PARTIAL);
+
+ if ( ! stricmp( DLE_GetDeviceName( server_appinfo->dle),
+ server_vlm->name ) ) {
+
+ DLM_Update( gb_servers_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+ }
+ VLM_UpdateServerStatus( server_vlm );
+ }
+ return;
+ }
+ vlm = VLM_GetNextVLM( vlm );
+ }
+ }
+ server_vlm = VLM_GetNextVLM( server_vlm );
+ } /*while*/
+
+ }
+ else // DISKS
+
+#endif //OEM_MSOFT //unsupported feature
+
+ {
+ wininfo = WM_GetInfoPtr( gb_disks_win );
+ vlm = VLM_GetFirstVLM( wininfo->pFlatList );
+
+ while ( vlm != NULL ) {
+
+ if ( ! stricmp( DLE_GetDeviceName( appinfo->dle ), vlm->name ) ) {
+
+ if ( ( vlm->status & (INFO_SELECT|INFO_PARTIAL) ) !=
+ ( root->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ vlm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ vlm->status |= root->status & (INFO_SELECT|INFO_PARTIAL);
+
+ DLM_Update( gb_disks_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+ }
+
+ return;
+ }
+ vlm = VLM_GetNextVLM( vlm );
+ }
+ }
+ }
+ else { // TAPES
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == appinfo->tape_fid ) {
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ if ( appinfo->bset_num == bset->bset_num ) {
+
+ if ( ( bset->status & (INFO_SELECT|INFO_PARTIAL) ) !=
+ ( root->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ bset->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ bset->status |= root->status & (INFO_SELECT|INFO_PARTIAL);
+
+ if ( tape->status & INFO_OPEN ) {
+
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)bset, 0 );
+ }
+
+ VLM_UpdateTapeStatus( tape, TRUE );
+ }
+
+ return;
+ }
+ bset = VLM_GetNextBSET( bset );
+ }
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ }
+
+}
+
+/**********************
+
+ NAME : VLM_CloseAll
+
+ DESCRIPTION :
+
+ The poor user has managed to open so many windows at once that he has
+ requested we just go ahead and close them all for him to start over.
+ This will NOT lose any of his selections, just close all the windows.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_CloseAll()
+{
+ WM_MinimizeDocs();
+}
+
+
+
+/**********************
+
+ NAME : VLM_AddAdvancedSelection
+
+ DESCRIPTION :
+
+ The user wants to add an advanced selection to the FSE list. This
+ routine takes the information from the data structure that the dialogs
+ filled out and creates the FSE.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_AddAdvancedSelection(
+HWND worthless, // I - worthless window
+DS_ADVANCED_PTR pds ) // I - advanced selection data
+{
+ GENERIC_DLE_PTR dle;
+ VLM_OBJECT_PTR vlm;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse_ptr;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ INT16 path_len;
+ CHAR_PTR path_ptr;
+ CHAR_PTR s;
+ BOOLEAN was_slash;
+ BSET_OBJECT_PTR bset;
+ INT16 predate = 0, postdate = 0;
+ HWND win;
+ BE_CFG_PTR bec_config;
+ DATE_TIME sort_date;
+
+ DBG_UNREFERENCED_PARAMETER( worthless );
+
+ path_len = 0;
+ path_ptr = pds->Path;
+ if ( *path_ptr == TEXT('\\') ) path_ptr++;
+
+ s = path_ptr;
+ was_slash = FALSE; // Used to NOT count trailing TEXT('\\')
+ while ( *s != 0 ) {
+ if ( *s == TEXT('\\') ) {
+ *s = 0;
+ was_slash = TRUE;
+ }
+ else {
+ was_slash = FALSE;
+ }
+ s++;
+ path_len++;
+ }
+
+ if ( was_slash ) {
+ path_len--; // was it a trailing slash
+ }
+
+ path_len++; // count final zero
+
+ path_len *= sizeof(CHAR); // convert to bytes
+
+ vlm = (VLM_OBJECT_PTR)pds->vlm;
+
+ if ( vlm == NULL ) {
+
+ // It's a restore request, see if they know the password.
+
+ WM_ShowWaitCursor ( SWC_PAUSE );
+ if ( PSWD_CheckForPassword( pds->tape_fid, (INT16)pds->bset_num ) ) {
+ WM_ShowWaitCursor ( SWC_RESUME );
+ return;
+ }
+ WM_ShowWaitCursor ( SWC_RESUME );
+ }
+
+// Create the new FSE
+
+ if ( pds->Include ) {
+
+ if ( BSD_CreatFSE( &fse_ptr, (INT16)INCLUDE,
+ (INT8_PTR) path_ptr, (INT16)path_len,
+ (INT8_PTR) pds->File,
+ (INT16) strsize( pds->File ),
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) pds->Subdirs ) ) {
+ return;
+ }
+ }
+ else {
+
+ if ( BSD_CreatFSE( &fse_ptr, (INT16)EXCLUDE,
+ (INT8_PTR) path_ptr, (INT16)path_len,
+ (INT8_PTR) pds->File,
+ (INT16) strsize( pds->File ),
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) pds->Subdirs ) ) {
+ return;
+ }
+ }
+
+ // Right here set the complex info, Modified, Dates
+
+ switch ( pds->criteria ) {
+
+ case ADV_MOD:
+
+ FSE_SetAttribInfo( fse_ptr, OBJ_MODIFIED_BIT, 0L );
+ break;
+
+ case ADV_ACCESS:
+
+ FSE_SetAccDate( fse_ptr, &(pds->LastAccessDate) );
+ break;
+
+ case ADV_DATES:
+
+ FSE_SetModDate( fse_ptr, &(pds->AfterDate), &(pds->BeforeDate) );
+ break;
+
+ default:
+ break;
+ }
+
+ // Find the BSD to add it to
+
+ if ( vlm != NULL ) {
+
+ DLE_FindByName( dle_list, vlm->name, ANY_DRIVE_TYPE, &dle );
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ BSD_Add( bsd_list, &bsd_ptr, bec_config, NULL,
+ dle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+ }
+
+ }
+else {
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ (UINT32)pds->tape_fid,
+ (UINT16)pds->bset_num );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ VLM_GetSortDate( (UINT32)pds->tape_fid, (INT16)pds->bset_num, &sort_date );
+
+ bset = VLM_FindBset( pds->tape_fid, (INT16)pds->bset_num );
+
+ BSD_Add( tape_bsd_list, &bsd_ptr,
+ bec_config, NULL,
+ NULL, (UINT32)pds->tape_fid, (UINT16)bset->tape_num, (INT16)pds->bset_num, NULL, &sort_date );
+
+ VLM_FillInBSD( bsd_ptr );
+ }
+ }
+
+ // Add the new FSE
+
+ if ( bsd_ptr != NULL ) {
+
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+
+ // Now we have NO idea which selections may have changed because of the
+ // addition of this FSE. So the best we can do is to completely
+ // rematch the entire list of files and subdirectories.
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) && ( vlm != NULL ) ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( ! stricmp( DLE_GetDeviceName( appinfo->dle ), vlm->name ) ) {
+ VLM_RematchList( win );
+ }
+ }
+
+ if ( ( wininfo->wType == WMTYPE_TAPETREE ) && ( vlm == NULL ) ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( ( appinfo->tape_fid == (UINT32)pds->tape_fid ) &&
+ ( appinfo->bset_num == (INT16) pds->bset_num ) ) {
+ VLM_RematchList( win );
+ }
+ }
+ win = WM_GetNext( win );
+ }
+
+ if ( vlm != NULL ) {
+ if ( vlm->parent != NULL ) {
+ VLM_UpdateServers();
+ }
+ else {
+ VLM_UpdateDisks();
+ }
+ }
+ else {
+ VLM_UpdateTapes( );
+ VLM_UpdateSearchSelections( (UINT32)pds->tape_fid, (INT16)pds->bset_num );
+ }
+ }
+}
+
+
+
+
+/**********************
+
+ NAME : VLM_SelectButton
+
+ DESCRIPTION :
+
+ The user has pressed a select button. We need to go find all the tagged
+ items for that window and process the selections. We have to look at the
+ type of the window, to determine how to handle it. The current types
+ supported are:
+
+ - files lists
+ - bsets
+ - servers volumes
+ - disks
+
+ RETURNS :
+
+**********************/
+
+
+static VOID VLM_SelectButton(
+BYTE attr ) // I - select or deselect ?
+{
+ WININFO_PTR wininfo;
+
+ // attr == 0, unselect all taggged files
+ // == 1, select all tagged files
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+
+ switch ( wininfo->wType ) {
+
+ case WMTYPE_DISKTREE:
+ case WMTYPE_TAPETREE:
+ VLM_SelectTree( WM_GetActiveDoc(), attr );
+ break;
+ case WMTYPE_DISKS:
+ VLM_SelectDisks( attr );
+ break;
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE:
+ VLM_SelectExchangeShares( attr, wininfo );
+ break;
+#endif
+ case WMTYPE_SERVERS:
+ VLM_SelectVolumes( attr );
+ break;
+ case WMTYPE_TAPES:
+ VLM_SelectBsets( attr );
+ break;
+
+ case WMTYPE_SEARCH:
+ VLM_SelectSearch( attr );
+ break;
+
+ default:
+ break;
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_ChangeSettings
+
+ DESCRIPTION :
+
+ Someone somewhere has changed something !
+ Its our job to now update everything to reflect that change.
+ A job which can only be handled by a real manly man, because the
+ the skills required are massive, and the pitfalls many. If you
+ are a little girly man then turn back now. At least remember you were
+ warned, when you go crawling away later in total humiliation, your sense
+ of self worth completely destroyed, while little girl scouts point
+ and laugh at you. After that no one will doubt just what kind of man
+ you really are.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_ChangeSettings(
+INT16 msg, // I - what changed
+INT32 lParam ) // I - nothing
+{
+ WININFO_PTR wininfo;
+ UNREFERENCED_PARAMETER(lParam);
+
+ switch ( msg ) {
+
+ case ID_VIEWFONT:
+ WM_ShowWaitCursor( TRUE );
+ VLM_FontCaseChange( );
+ WM_ShowWaitCursor( FALSE );
+ break;
+
+#ifndef OEM_MSOFT
+ case ID_SORTNAME:
+ case ID_SORTDATE:
+ case ID_SORTSIZE:
+ case ID_SORTTYPE:
+
+ // Change the order of the file list.
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ VLM_ResortFileList( WM_GetActiveDoc() );
+ }
+ break;
+#endif
+
+ case ID_TREEANDFLAT:
+
+ // User has requested we display both the tree and flat lists
+ // Just change the icon.
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ wininfo->hIcon = RSM_IconLoad( IDRI_TREEFILE );
+ }
+ break;
+
+ case ID_TREEONLY:
+
+ // User has requested we display only the tree list
+ // Just change the icon.
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ wininfo->hIcon = RSM_IconLoad( IDRI_TREE );
+ }
+ break;
+
+ case ID_FLATONLY:
+
+ // User has requested we display only the flat list
+ // Just change the icon.
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ wininfo->hIcon = RSM_IconLoad( IDRI_FILES );
+ }
+ break;
+
+ case ID_FILEDETAILS:
+
+ // User has requested we display all file details
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ DLM_DispListModeSet( WM_GetActiveDoc(),
+ DLM_FLATLISTBOX,
+ DLM_SINGLECOLUMN );
+ }
+ break;
+
+
+ case ID_NAMEONLY:
+
+ // User has requested we display file names only
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ DLM_DispListModeSet( WM_GetActiveDoc(),
+ DLM_FLATLISTBOX,
+ DLM_COLUMN_VECTOR );
+ }
+ break;
+
+# if !defined ( OEM_MSOFT ) // - unsupported feature
+
+ case ID_SERVERS:
+
+ // user has requested to toggle servers on or off
+
+ VLM_ShowServers( FALSE );
+ break;
+
+# endif // !defined ( OEM_MSOFT ) // - unsupported feature
+
+
+ case ID_SELECT:
+
+ // User hit select button
+ VLM_SelectButton( 1 );
+ break;
+
+ case ID_DESELECT:
+
+ // User hit deselect button
+ VLM_SelectButton( 0 );
+ break;
+
+ case ID_EXPANDALL:
+
+ // Expand the whole tree and display it
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+
+ WM_ShowWaitCursor( TRUE );
+ VLM_ExpandTree( WM_GetActiveDoc() );
+ WM_ShowWaitCursor( FALSE );
+ }
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSExpandTree( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_EXPANDONE:
+
+ // Expand one level from current node
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ VLM_ExpandOne( WM_GetActiveDoc() );
+ }
+
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSExpandOne( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_EXPANDBRANCH:
+
+ // Expand this branch only all the way
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ WM_ShowWaitCursor( TRUE );
+ VLM_ExpandBranch( WM_GetActiveDoc() );
+ WM_ShowWaitCursor( FALSE );
+ }
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSExpandBranch( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_COLLAPSEBRANCH:
+
+ // Close off this branch, ie. hide it
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+ VLM_CollapseBranch( WM_GetActiveDoc() );
+ }
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSCollapseBranch( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_CLOSEALL:
+
+ // User has requested all windows be closed for him.
+
+ VLM_CloseAll();
+ break;
+
+ case ID_CTRLARROWUP:
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+
+ VLM_PrevBrotherDir( WM_GetActiveDoc() );
+ }
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSPrevBrotherDir( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_CTRLARROWDOWN:
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+
+ VLM_NextBrotherDir( WM_GetActiveDoc() );
+ }
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSNextBrotherDir( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_ARROWLEFT:
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+
+ VLM_UpOneDir( WM_GetActiveDoc() );
+ }
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSUpOneDir( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_ARROWRIGHT:
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE ) ) {
+
+ VLM_DownOneDir( WM_GetActiveDoc() );
+ }
+#ifdef OEM_EMS
+ if ( wininfo->wType == WMTYPE_EXCHANGE ) {
+ SLM_EMSDownOneDir( WM_GetActiveDoc() );
+ }
+#endif
+ break;
+
+ case ID_DELETE:
+ break;
+
+ default:
+
+ // Someone added a new message and didn't tell me !
+ break;
+ }
+}
+
+
+
+
+/**********************
+
+ NAME : VLM_FreeVLMList
+
+ DESCRIPTION :
+
+ Every time the user flips servers on/off we have to remove all the
+ mapped drives or add them in to our vlm_list. It easier to just free
+ the whole list and rebuild it from scratch. This function does that
+ freeing process, so it can be rebuilt.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_FreeVLMList(
+Q_HEADER_PTR vlm_list ) // I - queue to use
+{
+ VLM_OBJECT_PTR vlm;
+ Q_ELEM_PTR ptr;
+ Q_ELEM_PTR ptr2;
+
+ // Why would you pass me a NULL vlm_list pointer ?
+
+ if ( vlm_list != NULL ) {
+
+ ptr = DeQueueElem( vlm_list );
+
+ while ( ptr != NULL ) {
+
+ vlm = ( VLM_OBJECT_PTR )ptr->q_ptr; // Get a VLM
+
+ // Now try to free her children
+
+ ptr2 = DeQueueElem( &vlm->children ); // Get her first child
+
+ while ( ptr2 != NULL ) {
+ free( ptr2->q_ptr );
+ ptr2 = DeQueueElem( &vlm->children ); // get next child
+ }
+
+ free( vlm ); // free the vlm
+
+ ptr = DeQueueElem( vlm_list ); // get next vlm
+ }
+ }
+
+
+}
+
+/**********************
+
+ NAME : VLM_ShowServers
+
+ DESCRIPTION :
+
+ User has toggled between servers and mapped drives, close off one
+ and then open the other.
+
+ RETURNS :
+
+**********************/
+
+BOOLEAN VLM_ShowServers( BOOLEAN init )
+{
+ GENERIC_DLE_PTR dle;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ BSD_PTR bsd;
+ HWND win;
+ HWND bad_win;
+
+
+ // close all mapped drive/server volume disktree windows
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ bad_win = (HWND)NULL;
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo->wType == WMTYPE_DISKTREE ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( DLE_HasFeatures( appinfo->dle, DLE_FEAT_REMOTE_DRIVE ) ) {
+
+ bad_win = win;
+ }
+ }
+
+ win = WM_GetNext( win );
+
+ if ( bad_win ) {
+ WM_Destroy( bad_win );
+ }
+ }
+
+ // Now look for bsd's that should not be around.
+
+ bsd = BSD_GetFirst( bsd_list );
+
+ while ( bsd != NULL ) {
+
+ dle = BSD_GetDLE( bsd );
+
+ if ( ( DLE_GetDeviceType( dle ) != LOCAL_DOS_DRV ) &&
+ ( DLE_GetDeviceType( dle ) != LOCAL_NTFS_DRV ) ) {
+
+ BSD_ClearAllFSE( bsd );
+ BSD_Remove( bsd );
+ bsd = BSD_GetFirst( bsd_list );
+ }
+ else {
+ bsd = BSD_GetNext( bsd );
+ }
+ }
+
+
+ // Now that you have closed off all the offending windows
+
+ if ( ! init ) {
+
+ // remove or add mapped drives from drive window list
+
+ wininfo = WM_GetInfoPtr( gb_disks_win );
+
+ // trash the whole list
+
+ VLM_FreeVLMList( wininfo->pFlatList );
+
+ // and the rebuild it
+
+ VLM_BuildVolumeList( wininfo->pFlatList, wininfo );
+
+ // Update the screen
+
+ DLM_Update( gb_disks_win, DLM_FLATLISTBOX, WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pFlatList, 0 );
+
+ // update selection boxes
+
+ VLM_UpdateDisks( );
+ }
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if ( gfServers ) {
+
+ // open up server window
+ if ( gb_servers_win == (HWND)NULL ) {
+ VLM_ServerListCreate( );
+ }
+ }
+ else {
+
+ if ( gb_servers_win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ wininfo->wClosable = TRUE;
+
+ // close server window
+
+ WM_Destroy( gb_servers_win );
+ gb_servers_win = (HWND)NULL;
+ }
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ return( SUCCESS );
+
+}
diff --git a/private/utils/ntbackup/src/vlm_poll.c b/private/utils/ntbackup/src/vlm_poll.c
new file mode 100644
index 000000000..92fbfb86f
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_poll.c
@@ -0,0 +1,722 @@
+
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_POLL.C
+
+ Description:
+
+ Poll drive stuff
+
+ $Log: J:\ui\logfiles\vlm_poll.c_v $
+
+ Rev 1.48.1.1 07 Feb 1994 02:05:58 GREGG
+Fixed and expanded 'extended error reporting'.
+
+ Rev 1.48.1.0 01 Dec 1993 14:16:24 mikep
+add SQL recognition support to poll drive
+
+ Rev 1.48 27 Jul 1993 22:05:26 MIKEP
+add out of seq msg
+
+ Rev 1.47 27 Jul 1993 14:44:18 MARINA
+enable c++
+
+ Rev 1.46 19 Jul 1993 21:06:00 MIKEP
+add support for ecc, future ver, and encrypted tapes.
+
+ Rev 1.45 07 Jul 1993 08:51:32 MIKEP
+fix epr 357-463. It was repainting the sets side of the
+tape window when it didn't need to.
+
+ Rev 1.44 27 Jun 1993 14:07:20 MIKEP
+continue work on status monitor stuff
+
+ Rev 1.43 08 Jun 1993 11:04:44 CARLS
+Remove VLM_GetFirstSSETonTapeAttributes - not needed
+
+ Rev 1.42 07 Jun 1993 08:12:52 MIKEP
+fix transfer so afterwards there is an active tape displayed.
+
+ Rev 1.41 27 May 1993 15:39:28 CARLS
+Added function call VLM_GetSSETonTapeAttribute and
+code in VLM_TapeChanged to save the first SSET attribute.
+
+ Rev 1.40 12 May 1993 08:26:24 MIKEP
+change way addfake tape works.
+
+ Rev 1.39 06 May 1993 14:51:06 MIKEP
+fix the tapes window to be more accurate to tape drive state.
+
+ Rev 1.38 03 May 1993 16:13:30 MIKEP
+Put current tape as focus tape in tapes window.
+
+ Rev 1.37 28 Apr 1993 16:36:32 CARLS
+added code for drive failure in GetDriveStatus call
+
+ Rev 1.36 26 Apr 1993 08:52:34 MIKEP
+Add numerous changes to fully support the font case selection
+for various file system types. Also add refresh for tapes window
+and sorting of tapes window.
+
+ Rev 1.34 02 Apr 1993 15:52:30 CARLS
+changes for DC2000 unformatted tape
+
+ Rev 1.33 30 Mar 1993 16:24:18 GREGG
+Changed PD_UNFORMATTED_TAPE to PD_UNRECOGNIZED_MEDIA.
+
+ Rev 1.32 13 Mar 1993 16:28:50 MIKEP
+foreign tape prompt
+
+ Rev 1.31 12 Mar 1993 15:17:40 MIKEP
+add unformated tape support
+
+ Rev 1.30 12 Mar 1993 14:43:16 MIKEP
+auto call erase if foreign tape
+
+ Rev 1.29 14 Dec 1992 12:24:56 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.28 17 Nov 1992 20:00:48 MIKEP
+add unformat display
+
+ Rev 1.27 27 Oct 1992 17:07:52 MIKEP
+display fixes
+
+ Rev 1.26 07 Oct 1992 15:08:22 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.25 04 Oct 1992 19:42:32 DAVEV
+Unicode Awk pass
+
+ Rev 1.24 02 Sep 1992 16:32:30 GLENN
+MikeP changes for NT.
+
+ Rev 1.23 29 Jul 1992 09:53:52 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.22 19 Jun 1992 16:42:30 MIKEP
+add drive empty to tapes window
+
+ Rev 1.21 31 May 1992 11:12:14 MIKEP
+auto catalog changes
+
+ Rev 1.20 28 May 1992 15:22:50 MIKEP
+auto cat try #1
+
+ Rev 1.19 14 May 1992 18:05:58 MIKEP
+nt pass 2
+
+ Rev 1.18 11 May 1992 09:13:56 MIKEP
+64Bit support
+
+ Rev 1.17 06 May 1992 14:40:42 MIKEP
+unicode pass two
+
+ Rev 1.16 04 May 1992 13:39:32 MIKEP
+unicode pass 1
+
+ Rev 1.15 09 Apr 1992 08:46:14 MIKEP
+speed up lots of sets
+
+
+****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// Used to maintain the info about the current tape in the drive.
+
+static DBLK current_vcb;
+static INT16 current_status = VLM_NO_TAPE;
+
+/**********************
+
+ NAME : VLM_GetDriveStatus
+
+ DESCRIPTION :
+
+ This function is used by all the dialogs and other areas that want to
+ know the status of the tape in the drive. If there is a valid vcb, it
+ will set thier vcb pointer to point to the vcb we save.
+
+ RETURNS :
+
+ VLM_VALID_TAPE - a good vcb is available
+ VLM_FOREIGN_TAPE - tape has unknown format
+ VLM_BLANK_TAPE - blank tape in drive
+ VLM_NO_TAPE - drive is empty
+ VLM_BUSY - drive is busy vcb'ing a tape
+ VLM_BAD_TAPE - read failed, propably exabyte tape in wrong type of drive
+ VLM_GOOFY_TAPE - must have tape 1 to tell what it is
+ VLM_DISABLED - poll drive is no longer working
+ VLM_UNFORMATED - dc2000 tape
+ VLM_FUTURE_VER - made with a future version of the software
+ VLM_ECC_TAPE - encrypted tape
+
+
+**********************/
+
+INT VLM_GetDriveStatus( DBLK_PTR *vcb )
+{
+
+ if ( ! gfPollDrive ) {
+ return( VLM_DISABLED );
+ }
+
+ if ( vcb != NULL ) {
+ if ( current_status == VLM_VALID_TAPE ) {
+ *vcb = &current_vcb;
+ }
+ else {
+ *vcb = NULL;
+ }
+ }
+
+ return( current_status );
+}
+
+
+
+/**********************
+
+ NAME : VLM_ClearCurrentTape
+
+ DESCRIPTION :
+ Clear any tape's current status if it's tape fid is not the
+ one passed in.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_ClearCurrentTape( UINT32 tape_fid, BOOLEAN UpdateScreen )
+{
+ TAPE_OBJECT_PTR tape;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ BOOL UpdateFlatList = FALSE;
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_tapes_win );
+
+ tape = VLM_GetFirstTAPE();
+
+ while ( tape != NULL ) {
+
+ // If it was current change the bitmap on it.
+
+ if ( ( tape->current ) && ( tape->tape_fid != tape_fid ) ) {
+
+ tape->current = FALSE;
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)tape, 0 );
+ }
+ }
+
+ // Remove any fake tapes.
+
+ if ( tape->fake_tape ) {
+
+ // If it was active then pick a new active.
+
+ if ( appinfo->open_tape == tape ) {
+
+ UpdateFlatList = TRUE;
+
+ appinfo->open_tape = VLM_GetFirstTAPE( );
+
+ while ( appinfo->open_tape ) {
+
+ if ( appinfo->open_tape->fake_tape ) {
+ appinfo->open_tape = VLM_GetNextTAPE( appinfo->open_tape );
+ }
+ else {
+ break;
+ }
+ }
+
+ if ( appinfo->open_tape != NULL ) {
+ appinfo->open_tape->status |= INFO_OPEN;
+ wininfo->pFlatList = &appinfo->open_tape->bset_list;
+ }
+ else {
+ wininfo->pFlatList = NULL;
+ }
+ }
+
+ // Remove it from queue and memory
+
+ RemoveQueueElem( wininfo->pTreeList, &(tape->q_elem) );
+ free( tape );
+
+ // Update the lists.
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pTreeList, 0 );
+
+ if ( UpdateFlatList ) {
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pFlatList, 0 );
+ }
+ }
+
+ tape = VLM_GetFirstTAPE();
+ }
+ else {
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ }
+}
+
+/**********************
+
+ NAME : VLM_AddFakeTape
+
+ DESCRIPTION :
+
+ The user has a blank, foriegn or bad tape in the drive. So place a dummy
+ entry in the tapes list for it.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_AddFakeTape( INT16 status )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ TAPE_OBJECT_PTR tape;
+ CHAR name[ MAX_UI_RESOURCE_SIZE ];
+
+ switch ( status ) {
+
+ case VLM_ECC_TAPE:
+ RSM_StringCopy( RES_VLM_ECC_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_FUTURE_VER:
+ RSM_StringCopy( RES_VLM_FUTURE_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_SQL_TAPE:
+ RSM_StringCopy( RES_VLM_SQL_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_BLANK_TAPE:
+ RSM_StringCopy( RES_VLM_BLANK_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_BAD_TAPE:
+ RSM_StringCopy( RES_VLM_BAD_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_FOREIGN_TAPE:
+ RSM_StringCopy( RES_VLM_FOREIGN_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_NO_TAPE:
+ RSM_StringCopy( RES_VLM_NO_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_BUSY:
+ RSM_StringCopy( RES_VLM_BUSY_DRIVE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_GOOFY_TAPE:
+ RSM_StringCopy( RES_VLM_GOOFY_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ case VLM_UNFORMATED:
+ RSM_StringCopy( RES_VLM_UNFORMATED_TAPE, name, MAX_UI_RESOURCE_LEN );
+ break;
+
+ default:
+ return;
+ }
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_tapes_win );
+
+ tape = VLM_CreateTAPE( (INT16) strsize( name ) );
+
+ if ( tape == NULL ) {
+
+ // We tried.
+ return;
+ }
+
+ TAPE_SetFID( tape, 0 );
+ TAPE_SetTapeNum( tape, 0 );
+ TAPE_SetFake( tape, TRUE );
+ TAPE_SetStatus( tape, INFO_DISPLAY );
+ TAPE_SetCurrent( tape, TRUE );
+ TAPE_SetXtraBytes( tape, wininfo );
+ TAPE_SetName( tape, name );
+
+ VLM_InsertTapeInQueue( wininfo->pTreeList, tape );
+
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pTreeList, 0 );
+
+ if ( QueueCount( wininfo->pTreeList ) == 1 ) {
+
+ appinfo->open_tape = tape;
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0, (LMHANDLE)tape );
+ }
+}
+
+
+/**********************
+
+ NAME : VLM_TapeChanged
+
+ DESCRIPTION :
+
+ Poll drive has returned that a change has occurred in the status of the
+ tape drive. The UI is being told.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_TapeChanged( INT16 msg, DBLK_PTR vcb, FSYS_HAND fsh )
+{
+
+ DBG_UNREFERENCED_PARAMETER ( fsh );
+
+
+ //
+ // Always set the current_status before calling MUI_TapeInDrive() it will query it for button state.
+ //
+
+
+ switch ( msg ) {
+
+ case PD_DRIVE_FAILURE:
+ case PD_DRIVER_FAILURE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_ERROR );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ current_status = VLM_DRIVE_FAILURE;
+ MUI_TapeInDrive( FALSE );
+ break;
+
+ case PD_NEW_TAPE:
+ current_status = VLM_BUSY;
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_BUSY );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ MUI_TapeInDrive( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+ break;
+
+ case PD_FOREIGN_TAPE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_FOREIGN_TAPE ) {
+ current_status = VLM_FOREIGN_TAPE;
+ MUI_TapeInDrive ( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+
+ WM_ShowWaitCursor( FALSE ) ;
+
+ WM_MsgBox( ID( IDS_VLMFOREIGNTITLE ),
+ ID( IDS_VLMFOREIGNTEXT ),
+ WMMB_IDOK,
+ WMMB_ICONEXCLAMATION ) ;
+ }
+ break;
+
+ case PD_SQL_TAPE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_SQL_TAPE ) {
+ current_status = VLM_SQL_TAPE;
+ MUI_TapeInDrive ( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+
+ WM_MsgBox( ID( IDS_VLMFOREIGNTITLE ),
+ ID( IDS_VLMSQLTEXT ),
+ WMMB_IDOK,
+ WMMB_ICONEXCLAMATION ) ;
+ }
+ break;
+
+
+ case PD_FUTURE_REV_MTF:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_FUTURE_VER ) {
+ current_status = VLM_FUTURE_VER;
+ MUI_TapeInDrive ( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+
+ WM_MsgBox( ID( IDS_VLMFOREIGNTITLE ),
+ ID( IDS_VLMFUTURETEXT ),
+ WMMB_IDOK,
+ WMMB_ICONEXCLAMATION ) ;
+ }
+ break;
+
+ case PD_MTF_ECC_TAPE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_FOREIGN );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_ECC_TAPE ) {
+ current_status = VLM_ECC_TAPE;
+ MUI_TapeInDrive ( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+
+ WM_MsgBox( ID( IDS_VLMFOREIGNTITLE ),
+ ID( IDS_VLMECCTEXT ),
+ WMMB_IDOK,
+ WMMB_ICONEXCLAMATION ) ;
+ }
+ break;
+
+
+ case PD_UNRECOGNIZED_MEDIA:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_UNFORMATTED );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_UNFORMATED ) {
+ current_status = VLM_UNFORMATED;
+ MUI_TapeInDrive ( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+
+ WM_MsgBox( ID( IDS_VLMUNFORMATEDTITLE ),
+ ID( IDS_VLMUNFORMATEDTEXT ),
+ WMMB_IDOK,
+ WMMB_ICONEXCLAMATION ) ;
+
+
+ }
+ break;
+
+
+ case PD_BLANK_TAPE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_BLANK );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_BLANK_TAPE ) {
+ current_status = VLM_BLANK_TAPE;
+ MUI_TapeInDrive( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+ }
+ break;
+
+ case PD_NO_TAPE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_EMPTY );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_NO_TAPE ) {
+ current_status = VLM_NO_TAPE;
+ MUI_TapeInDrive( FALSE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+ }
+ break;
+
+ case PD_BUSY:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_BUSY );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_BUSY ) {
+ current_status = VLM_BUSY;
+ MUI_TapeInDrive( FALSE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+ }
+ break;
+
+ case PD_VALID_VCB:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_VALID );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)FS_ViewTapeIDInVCB( vcb ) );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)FS_ViewTSNumInVCB( vcb ) );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)FS_ViewBSNumInVCB( vcb ) );
+
+ current_status = VLM_VALID_TAPE;
+ MUI_TapeInDrive ( TRUE );
+ memcpy( &current_vcb, vcb, sizeof( DBLK ) );
+ VLM_AddTapeIfUnknown( TRUE );
+
+ break;
+
+ case PD_BAD_TAPE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_BAD );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_BAD_TAPE ) {
+ current_status = VLM_BAD_TAPE;
+ MUI_TapeInDrive ( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+ }
+ break;
+
+ case PD_OUT_OF_SEQUENCE:
+ SetStatusBlock( IDSM_DRIVESTATUS, STAT_DRIVE_VALID );
+ SetStatusBlock( IDSM_TAPEFAMILY, (DWORD)0 );
+ SetStatusBlock( IDSM_TAPESEQNUMBER, (DWORD)0 );
+ SetStatusBlock( IDSM_BACKUPSET, (DWORD)0 );
+ if ( current_status != VLM_GOOFY_TAPE ) {
+ current_status = VLM_GOOFY_TAPE;
+ MUI_TapeInDrive( TRUE );
+ VLM_ClearCurrentTape( 0L, TRUE );
+ VLM_AddFakeTape( current_status );
+
+ WM_MsgBox( ID( IDS_VLMGOOFYTITLE ),
+ ID( IDS_VLMGOOFYTEXT ),
+ WMMB_IDOK,
+ WMMB_ICONEXCLAMATION ) ;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+/**********************
+
+ NAME : VLM_AddTapeIfUnknown
+
+ DESCRIPTION :
+
+ This function will add the tape in the drive to the cats/vlm if it is
+ not known and/or make it the current tape. It is called when poll
+ drive reports a new tape.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_AddTapeIfUnknown( BOOLEAN UpdateScreen )
+{
+ TAPE_OBJECT_PTR tape;
+ QTC_BUILD_PTR qtc;
+ UINT32 tape_fid;
+ INT16 tape_num;
+ INT16 bset_num;
+
+ if ( current_status == VLM_VALID_TAPE ) {
+
+ // See which tape it is.
+
+ tape_fid = FS_ViewTapeIDInVCB( &current_vcb );
+ tape_num = FS_ViewTSNumInVCB( &current_vcb );
+ bset_num = FS_ViewBSNumInVCB( &current_vcb );
+
+ // Clear the old current tape, if its not the same one.
+
+ VLM_ClearCurrentTape( tape_fid, UpdateScreen );
+
+ // See if the catalogs know of this set already.
+
+ if ( QTC_FindBset( tape_fid, tape_num, bset_num ) == NULL ) {
+
+ // Add the new tape to QTC and VLM here
+ // because we've never seen it before.
+
+ qtc = QTC_GetBuildHandle( );
+ QTC_DoFullCataloging( qtc, FALSE );
+ QTC_StartBackup( qtc, &current_vcb );
+
+ VLM_CheckForCatalogError( qtc );
+
+ QTC_FreeBuildHandle( qtc );
+
+ VLM_AddBset( tape_fid, tape_num, bset_num, NULL, UpdateScreen );
+ }
+
+ if ( VLM_FindBset( tape_fid, bset_num ) == NULL ) {
+
+ VLM_AddBset( tape_fid, tape_num, bset_num, NULL, UpdateScreen );
+ }
+
+ // Now that we know the tape should be around, find it.
+
+ tape = VLM_GetFirstTAPE();
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+ break;
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ if ( tape != NULL ) {
+
+ // Make this tape the current tape.
+
+ if ( ! tape->current ) {
+
+ tape->current = TRUE;
+
+ if ( UpdateScreen ) {
+
+ // Add the tape to the current list.
+
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)tape, 0 );
+
+ // Let's make it viewable.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( TAPE_GetXtraBytes( tape ) ),
+ 0,
+ (LMHANDLE)tape );
+
+ // Make it the active tape.
+
+ VLM_TapeSetObjects( tape, WM_DLMDOWN, 2 );
+
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/private/utils/ntbackup/src/vlm_refr.c b/private/utils/ntbackup/src/vlm_refr.c
new file mode 100644
index 000000000..a19009e1c
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_refr.c
@@ -0,0 +1,735 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_REFR.C
+
+ Description:
+
+ This file contains the functions needed to perform
+ the refresh call.
+
+ $Log: G:\UI\LOGFILES\VLM_REFR.C_V $
+
+ Rev 1.31.1.2 14 Jan 1994 14:36:24 MIKEP
+fix refresh and up arrow display
+
+ Rev 1.31.1.1 14 Dec 1993 15:25:34 GREGG
+Go deeper!!!
+
+ Rev 1.31.1.0 08 Dec 1993 11:28:54 MikeP
+deep pathes and unicode
+
+ Rev 1.31 05 Aug 1993 10:52:36 MIKEP
+fix refresh epr
+
+ Rev 1.30 27 Jul 1993 14:51:00 MARINA
+enable c++
+
+ Rev 1.29 15 Jul 1993 16:05:50 MIKEP
+fix refresh tapes window call.
+
+ Rev 1.28 21 Jun 1993 15:58:00 KEVINS
+Allow a refresh of Log files window, when it is active.
+
+ Rev 1.27 01 Jun 1993 15:51:36 MIKEP
+make drive letter support match winfile.
+
+ Rev 1.26 20 May 1993 17:20:12 KEVINS
+Made VLM_RefreshDLE static again. Overlooked VLM_Refresh.
+
+ Rev 1.25 12 May 1993 17:58:26 KEVINS
+Made VLM_RefreshDLE public.
+
+ Rev 1.24 12 May 1993 08:28:44 MIKEP
+fix upper/lower case support for drives.
+
+ Rev 1.23 02 May 1993 15:28:30 MIKEP
+Fix pointer exception bug. Everyone needs this.
+
+ Rev 1.22 01 May 1993 16:26:22 MIKEP
+Fix case support for tree windows. You need vlm.h, vlm_tree.c, vlm_refr.c,
+and qtc.h.
+
+ Rev 1.21 26 Apr 1993 11:26:18 MIKEP
+Fix bug in last check in. If you took the last one, you really want
+this one instead. I was using a dle pointer right off the stack.
+
+ Rev 1.20 26 Apr 1993 08:52:46 MIKEP
+Add numerous changes to fully support the font case selection
+for various file system types. Also add refresh for tapes window
+and sorting of tapes window.
+
+ Rev 1.19 23 Apr 1993 10:20:32 MIKEP
+Add ability to refresh tapes window.
+Add support for sorting files window by various methods.
+Fix refresh of sorting windows.
+
+ Rev 1.18 22 Dec 1992 08:52:42 MIKEP
+fixes from msoft
+
+ Rev 1.17 07 Oct 1992 15:08:38 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.16 04 Oct 1992 19:42:36 DAVEV
+Unicode Awk pass
+
+ Rev 1.15 29 Jul 1992 09:32:26 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.14 14 May 1992 18:06:08 MIKEP
+nt pass 2
+
+ Rev 1.13 06 May 1992 14:41:12 MIKEP
+unicode pass two
+
+ Rev 1.12 04 May 1992 13:40:06 MIKEP
+unicode pass 1
+
+ Rev 1.11 24 Mar 1992 14:41:52 DAVEV
+OEM_MSOFT: Removed Servers windows and associated code
+
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// Local static prototypes
+
+static INT VLM_FontCaseChangeDisks( HWND );
+static INT VLM_FontCaseChangeTree( HWND );
+static VOID VLM_RefreshDLE( VOID );
+static VOID VLM_RefreshTree( HWND );
+static INT VLM_RefreshDirList( Q_HEADER_PTR );
+static VOID VLM_ResetNextBrothers( Q_HEADER_PTR );
+
+/************************************
+
+ The user has changed the font case and we need to paint all the
+ windows if they need it. After adjusting any strings that need it.
+
+ Applies to Disks, Tape/Disk Tree, Search windows.
+
+*************************************/
+
+VOID VLM_FontCaseChange( )
+{
+ HWND win;
+ WININFO_PTR wininfo;
+
+ WM_ShowWaitCursor( TRUE );
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ switch ( wininfo->wType ) {
+
+ case WMTYPE_TAPETREE:
+ case WMTYPE_DISKTREE:
+
+ // Refresh a tree window.
+
+ VLM_FontCaseChangeTree( win );
+
+ break;
+
+ case WMTYPE_DISKS:
+
+ // Refresh the disks window.
+
+ VLM_FontCaseChangeDisks( win );
+
+ break;
+
+ default:
+ // We don't handle anything else right now.
+
+ break;
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ WM_ShowWaitCursor( FALSE );
+
+ return;
+}
+
+static INT VLM_FontCaseChangeTree( HWND win )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR slm;
+ BOOLEAN fLowerCase;
+ CHAR temp_buff[ VLM_BUFFER_SIZE ];
+ CHAR *temp;
+ CHAR *title;
+ CHAR *directory;
+ CHAR *s;
+ INT title_size;
+
+#ifdef OEM_EMS
+ UNREFERENCED_PARAMETER( s );
+#endif
+
+ wininfo = WM_GetInfoPtr( win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ fLowerCase = FALSE;
+
+ // If new display name is different then the old one,
+ // update that item.
+
+ if ( CDS_GetFontCase( CDS_GetPerm() ) ) {
+ fLowerCase = TRUE;
+ }
+ else {
+ if ( CDS_GetFontCaseFAT( CDS_GetPerm() ) &&
+ appinfo->fFatDrive ) {
+ fLowerCase = TRUE;
+ }
+ }
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ while ( slm ) {
+ if ( fLowerCase ) {
+ strlwr( SLM_GetName( slm ) );
+ }
+ else {
+ strcpy( SLM_GetName( slm ), SLM_GetOriginalName( slm ) );
+ if ( appinfo->fFatDrive ) {
+ strupr( SLM_GetName( slm ) );
+ }
+ }
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ title_size = WM_GetTitle( win, NULL, 0 );
+
+ title = malloc( ( title_size + 1 ) * sizeof(CHAR ) );
+
+ if ( fLowerCase ) {
+ WM_GetTitle( win, title, title_size + 1 );
+ strlwr( title );
+ WM_SetTitle( win, title );
+ }
+ else {
+ WM_GetTitle( win, title, title_size + 1 );
+ strupr( title );
+ WM_SetTitle( win, title );
+ }
+
+ free( title );
+
+ DLM_Update( win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pTreeList, 0 );
+
+ // Set the anchor item.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)appinfo->open_slm );
+
+
+ // Do a file list reuse here of the same directory.
+ // to redo the files list on the screen.
+
+ if ( appinfo->dle != NULL ) {
+
+ DLE_GetVolName( appinfo->dle, temp_buff );
+
+ if ( temp_buff[ strlen( temp_buff ) - 1 ] != TEXT(':') ) {
+ strcat( temp_buff, TEXT(":") );
+ }
+
+ }
+ else {
+
+ sprintf( temp_buff, TEXT("%s-%s:"),
+ VLM_GetTapeName( appinfo->tape_fid ),
+ VLM_GetBsetName( appinfo->tape_fid, appinfo->bset_num ) );
+ }
+
+ temp = VLM_BuildPath( appinfo->open_slm );
+
+ directory = malloc( strsize( temp_buff ) + strsize( temp ) + 256 );
+
+ strcpy( directory, temp_buff );
+
+ if ( SLM_GetLevel( appinfo->open_slm ) != 0 ) {
+ strcat( directory, TEXT("\\") );
+ strcat( directory, temp );
+ }
+
+ free( temp );
+
+ // Change the displayed files
+
+ VLM_HandleFSError( VLM_FileListReuse( appinfo->win, directory ) ) ;
+
+ free( directory );
+
+ return( SUCCESS );
+}
+
+
+static INT VLM_FontCaseChangeDisks( HWND win )
+{
+
+ return( SUCCESS );
+}
+
+
+
+/**********************
+
+ NAME : VLM_Refresh
+
+ DESCRIPTION :
+
+ Refresh the current window. Determines type of window and calls
+ appropriate function to do work.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_Refresh( )
+{
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( WM_GetActiveDoc() );
+
+ if ( wininfo == NULL ) {
+ msassert( FALSE );
+ return;
+ }
+
+ switch ( WMDS_GetWinType( wininfo ) ) {
+
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE:
+#endif //OEM_EMS
+
+ case WMTYPE_SERVERS:
+ case WMTYPE_DISKS:
+ WM_ShowWaitCursor( TRUE );
+ VLM_RefreshDLE();
+ WM_ShowWaitCursor( FALSE );
+ break;
+
+ case WMTYPE_TAPES:
+ WM_ShowWaitCursor( TRUE );
+ VLM_CatalogDataPathChanged();
+ WM_ShowWaitCursor( FALSE );
+ break;
+
+ case WMTYPE_DISKTREE:
+ WM_ShowWaitCursor( TRUE );
+ VLM_RefreshTree( WM_GetActiveDoc() );
+ WM_ShowWaitCursor( FALSE );
+ break;
+
+ case WMTYPE_LOGFILES:
+ WM_ShowWaitCursor( TRUE );
+ LOG_Refresh( );
+ WM_ShowWaitCursor( FALSE );
+ break;
+
+ default:
+ break;
+
+ }
+
+}
+
+INT VLM_RefreshTapesWindow()
+{
+ return( SUCCESS );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_RefreshDLE( )
+{
+ GENERIC_DLE_PTR dle;
+ GENERIC_DLE_PTR child_dle;
+
+ // We increment the bsd count on all server volume dle's to keep
+ // them around when we detach from the server. To allow the call
+ // to UpdateList to work we have to decrement the bsd count first
+ // because no dle's deemed "inuse" will be removed. Also our code
+ // expects that child dle's will be present. And the update call
+ // will yank any dle not inuse, ie. selections made. So after
+ // the update call we need to reattach and bump the bsd count.
+
+ DLE_GetFirst( dle_list, &dle );
+
+ while ( dle ) {
+
+ if ( DLE_GetDeviceType( dle ) == NOVELL_SERVER_ONLY ) {
+
+ DLE_GetFirstChild( dle, &child_dle );
+
+ while ( child_dle ) {
+
+ DLE_DecBSDCount( child_dle );
+ DLE_GetNext( &child_dle );
+ }
+ }
+
+ DLE_GetNext( &dle );
+ }
+
+ DLE_UpdateList( dle_list, CDS_GetPermBEC() );
+
+ if ( gb_disks_win != (HWND)NULL ) {
+
+ VLM_DisksSync( );
+ }
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if ( gb_servers_win != (HWND)NULL ) {
+
+ VLM_ServersSync( );
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+#ifdef OEM_EMS
+ if ( gfExchange ) {
+
+ VLM_ExchangeSync( );
+ }
+#endif // OEM_EMS
+
+}
+
+/**********************
+
+ NAME : VLM_RefreshTree
+
+ DESCRIPTION :
+
+ Refresh the tree by making sure that all the files and directories present
+ are still on disk and new ones on disk are added.
+
+ RETURNS : nothing.
+
+**********************/
+
+static VOID VLM_RefreshTree( HWND win )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR temp_slm;
+ FLM_OBJECT_PTR flm;
+ BOOLEAN something_added = FALSE;
+ BOOLEAN something_removed = FALSE;
+ CHAR_PTR directory;
+ CHAR focus_item[ VLM_BUFFER_SIZE ];
+ CHAR_PTR s;
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR *temp;
+
+#ifdef OEM_EMS
+ UNREFERENCED_PARAMETER( s );
+ UNREFERENCED_PARAMETER( text );
+ UNREFERENCED_PARAMETER( title );
+#endif
+
+ wininfo = WM_GetInfoPtr( win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ // Mark all the SLM's as NOT present.
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ while ( slm ) {
+
+ SLM_SetStatus( slm, (UINT16)INFO_OLD | SLM_GetStatus( slm ) );
+ SLM_SetStatus( slm, (UINT16)~INFO_NEW & SLM_GetStatus( slm ) );
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ // See which SLM's are still there.
+
+ VLM_RefreshDirList( WMDS_GetTreeList( wininfo ) );
+
+ // See if the open directory went away.
+
+ if ( SLM_GetStatus( appinfo->open_slm ) & INFO_OLD ) {
+
+ slm = VLM_GetFirstSLM( slm_list );
+ slm->status |= INFO_OPEN;
+ appinfo->open_slm = slm;
+ }
+
+ temp = VLM_BuildPath( appinfo->open_slm );
+
+ directory = malloc( strsize( temp ) + 256 );
+ if ( directory == NULL ) {
+ free( temp );
+ return;
+ }
+
+ DLE_GetVolName( appinfo->dle, directory );
+
+ if ( directory[ strlen( directory ) - 1 ] != TEXT(':') ) {
+ strcat( directory, TEXT(":") );
+ }
+
+ // Change the title
+
+ if ( SLM_GetLevel( appinfo->open_slm ) != 0 ) {
+ strcat( directory, TEXT("\\") );
+ }
+
+ strcat( directory, temp );
+ free( temp );
+
+ flm = ( FLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndFlatList );
+
+ if ( flm != NULL ) {
+ strcpy( focus_item, FLM_GetName( flm ) );
+ }
+ else {
+ focus_item[0] = TEXT( '\0' );
+ }
+
+ VLM_HandleFSError( VLM_FileListReuse( appinfo->win, directory ) ) ;
+
+ strcat( directory, TEXT("\\*.*") );
+ WM_SetTitle( appinfo->win, directory );
+
+ free( directory );
+
+ flm = VLM_GetFirstFLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( flm != NULL ) {
+
+ if ( ! ( stricmp( focus_item, FLM_GetName( flm ) ) ) ) {
+ break;
+ }
+ flm = VLM_GetNextFLM( flm );
+ }
+
+ if ( flm != NULL ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( wininfo ),
+ 0,
+ (LMHANDLE)flm );
+ }
+
+
+ // Remove any that are no longer presnt.
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ temp_slm = NULL;
+
+ while ( slm ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_NEW ) {
+ something_added = TRUE;
+ }
+
+ if ( SLM_GetStatus( slm ) & INFO_OLD ) {
+
+ temp_slm = slm;
+ something_removed = TRUE;
+ }
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~INFO_NEW );
+
+ if ( slm != NULL ) {
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ if ( temp_slm ) {
+ RemoveQueueElem( slm_list, &(temp_slm->q_elem) );
+ free( temp_slm );
+ temp_slm = NULL;
+ }
+ }
+
+ if ( something_removed ) {
+ VLM_ResetNextBrothers( slm_list );
+ }
+
+ // Update the lines on the left of the screen.
+ // Items could have been removed or inserted.
+
+ if ( something_added || something_removed ) {
+
+ VLM_UpdateBrothers( WMDS_GetTreeList( wininfo ) );
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)appinfo->open_slm );
+ }
+
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static INT VLM_RefreshDirList(
+Q_HEADER_PTR slm_list ) // I - queue to fill in
+{
+ SLM_OBJECT_PTR slm;
+ WININFO_PTR XtraBytes;
+ APPINFO_PTR appinfo;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse;
+ INT16 ret;
+
+ /*
+ 2. Mark all the slm's as old
+ 3. Call check for children with root
+ 4. remove any slm's that are still marked as old.
+ 5. New SLM's that have INFO_DISPLAY set need to be displayed.
+ 6. If the current path slm still exists
+ A. Save focus flm
+ B. Refresh flm list same way.
+ Else switch to the root for files.
+ */
+
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ XtraBytes = SLM_GetXtraBytes( slm );
+
+ appinfo = ( APPINFO_PTR )XtraBytes->pAppInfo;
+
+ FS_ChangeDir( appinfo->fsh, TEXT(""), (UINT16)sizeof(CHAR) );
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+
+ // Mark root as being present.
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~INFO_OLD );
+
+ // Now let check for children do the rest
+
+ if ( VLM_CheckForChildren( slm_list, slm, TEXT(""), 10000, TRUE ) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SUBS );
+ }
+ else {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~INFO_SUBS );
+ }
+
+ if ( bsd_ptr != NULL ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~( INFO_PARTIAL | INFO_SELECT ) );
+
+ ret = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL, TEXT(""),
+ (UINT16)sizeof(CHAR), SLM_GetAttribute( slm ),
+ NULL, NULL, NULL, FALSE, TRUE );
+
+ if ( ret == BSD_PROCESS_OBJECT ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)(INFO_SELECT | INFO_PARTIAL) );
+ }
+
+ if ( ret == BSD_PROCESS_ENTIRE_DIR ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SELECT );
+ }
+ }
+
+ return( 0 );
+}
+
+
+/**********************
+
+ NAME : VLM_ResetNextBrothers
+
+ DESCRIPTION :
+
+ Correctly sets all the next_brother pointers in the slm list. Used after
+ an slm removal, which only happens during a refresh call.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_ResetNextBrothers( Q_HEADER_PTR slm_list )
+{
+
+// It won't blow up if you go deeper than this, but tree performance will
+// suffer. Display accuracy may suffer also.
+
+#define MAX_DEPTH 4000
+
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR array[ MAX_DEPTH ];
+ INT i;
+
+ for ( i = 0; i < MAX_DEPTH; i++ ) {
+ array[ i ] = NULL;
+ }
+
+ slm = VLM_GetLastSLM( slm_list );
+
+ while ( slm ) {
+
+ if ( slm->level > (UINT8)MAX_DEPTH ) {
+
+ slm->next_brother = NULL;
+ }
+ else {
+
+ slm->next_brother = array[ slm->level ];
+
+ array[ slm->level ] = slm;
+
+ for ( i = slm->level + 1; i < MAX_DEPTH; i++ ) {
+ array[ i ] = NULL;
+ }
+ }
+
+ slm = VLM_GetPrevSLM( slm );
+ }
+}
diff --git a/private/utils/ntbackup/src/vlm_srch.c b/private/utils/ntbackup/src/vlm_srch.c
new file mode 100644
index 000000000..21c52ed15
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_srch.c
@@ -0,0 +1,1997 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_SRCH.C
+
+ Description:
+
+ This file contains the functions needed to maintain the
+ search results window.
+
+ $Log: G:\UI\LOGFILES\VLM_SRCH.C_V $
+
+ Rev 1.49.1.0 08 Dec 1993 11:14:04 MikeP
+deep paths and unicode support
+
+ Rev 1.47 27 Jul 1993 15:14:34 MARINA
+enable c++
+
+ Rev 1.46 23 Jul 1993 15:10:36 MIKEP
+
+ Rev 1.45 22 Jun 1993 11:15:26 KEVINS
+Corrected another backup set password problem.
+
+ Rev 1.44 25 May 1993 17:20:44 KEVINS
+Corrected password checking logic regarding the searching of backup sets.
+
+ Rev 1.43 24 May 1993 15:22:12 BARRY
+Unicode fixes.
+
+ Rev 1.42 21 May 1993 13:42:34 GLENN
+Fixed hard coded text strings.
+
+ Rev 1.41 19 May 1993 14:54:00 KEVINS
+Correct problem of not searhing all catalogs when user double clicked on file.
+
+ Rev 1.40 18 May 1993 11:11:52 KEVINS
+Set first item in the search results window as the tagged item.
+
+ Rev 1.39 14 May 1993 14:15:38 KEVINS
+Don't create search results window if there are no search results.
+
+ Rev 1.38 27 Apr 1993 18:18:30 KEVINS
+Fixed compile error on line 661.
+
+ Rev 1.36 27 Apr 1993 14:38:02 KEVINS
+Shorten the history for test of pvcs get/put.
+
+ Rev 1.35 17 Mar 1993 18:12:22 DARRYLP
+Cleaned up display of file/date/time.
+
+ Rev 1.34 02 Mar 1993 16:49:08 ROBG
+Added *.CMD files to be displayed as executables for WIN32 apps.
+
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+
+// How many objects are we going to display for each item:
+// check box, icon, name, path, size, date, time, attrib,
+// tape name, bset name, bset number
+
+#define NUM_DISPLAY_OBJECTS 11
+
+// This file only, there is ONLY ONE search window.
+
+static UINT8 mw_max_name_str; // max length of any srch name
+static UINT8 mw_max_path_str; // max length of any srch path
+static UINT8 mw_max_tape_str; // max length of any srch tape name
+static UINT8 mw_max_bset_str; // max length of any srch bset name
+static UINT8 mw_max_date_str; // max length of any srch date
+static UINT8 mw_max_time_str; // max length of any srch time
+static UINT8 mw_max_attr_str; // max length of any srch attribute
+static UINT8 mw_max_size_str; // max length of any srch size
+static UINT8 mw_max_set_str; // max length of any set size
+
+/*
+ The definition of a search object structure. Not currently used outside
+ this file.
+*/
+
+typedef struct srch_object {
+ Q_ELEM q_elem; // queue stuff
+ UINT16 status; // a bunch of bits
+ UINT32 attrib; // attributes
+ UINT16 mod_date; // date & time
+ UINT16 mod_time; // date & time
+ UINT64 size; // size in bytes
+ CHAR size_str[ FLM_MAX_FILE_SIZE ]; // size in text
+ CHAR_PTR date_str; // time,date,attr text
+ CHAR_PTR time_str; // time,date,attr text
+ CHAR_PTR attr_str; // time,date,attr text
+ CHAR_PTR name_str; // file name
+ CHAR_PTR path_str; // path
+ CHAR_PTR tape_str; // the tape it was found on
+ CHAR_PTR bset_str; // the bset it was found in
+ CHAR_PTR set_str; // set number;
+ UINT32 tape_fid; // tape family id
+ INT16 bset_num; // bset number
+ UINT8 level; // height in tree, 0 = root
+ WININFO_PTR XtraBytes; // pointer to xtrabytes
+
+} SRCH_OBJECT, *SRCH_OBJECT_PTR;
+
+
+// Local prototypes
+
+static INT VLM_CreateSearchWindowSpecs( PDS_WMINFO* );
+static INT VLM_FindSrchItem( Q_HEADER_PTR, QTC_QUERY_PTR );
+static VOID VLM_SetSelectionStatus( Q_HEADER_PTR, UINT32, INT16 );
+
+static SRCH_OBJECT_PTR VLM_GetFirstSRCH( Q_HEADER_PTR );
+static SRCH_OBJECT_PTR VLM_GetNextSRCH( SRCH_OBJECT_PTR );
+static SRCH_OBJECT_PTR VLM_GetPrevSRCH( SRCH_OBJECT_PTR );
+
+// Display call backs
+
+static BYTE VLM_SrchGetSelect( SRCH_OBJECT_PTR );
+static VOID_PTR VLM_SrchSetTag( SRCH_OBJECT_PTR, BYTE );
+static BYTE VLM_SrchGetTag( SRCH_OBJECT_PTR );
+static USHORT VLM_SrchGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_SrchGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_SrchGetPrevItem( SRCH_OBJECT_PTR );
+static VOID_PTR VLM_SrchGetNextItem( SRCH_OBJECT_PTR );
+static VOID_PTR VLM_SrchGetObjects( SRCH_OBJECT_PTR );
+static BOOLEAN VLM_SrchSetObjects( SRCH_OBJECT_PTR, WORD, WORD );
+static VOID_PTR VLM_SrchSetSelect( SRCH_OBJECT_PTR, BYTE );
+
+/*********************
+
+ NAME : VLM_SelectSearch
+
+ DESCRIPTION :
+
+ The user has tagged one or more files in the search window and hit the
+ select or unselect button. This function does the processing for that
+ command.
+
+ RETURNS: nothing.
+
+*****/
+
+
+VOID VLM_SelectSearch(
+BYTE attr ) // I - select or deselect ?
+{
+#ifndef OEM_MSOFT
+ SRCH_OBJECT_PTR srch;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( gb_search_win );
+
+ // Have the display list manager update our tags for us.
+
+ DLM_UpdateTags( gb_search_win, DLM_FLATLISTBOX );
+
+ srch = VLM_GetFirstSRCH( wininfo->pFlatList );
+
+ while ( srch != NULL ) {
+
+ if ( srch->status & INFO_TAGGED ) {
+
+ VLM_SrchSetSelect( srch, attr );
+ }
+ srch = VLM_GetNextSRCH( srch );
+ }
+#endif
+}
+
+
+/**********************
+
+ NAME : VLM_ClearAllSearchSelections
+
+ DESCRIPTION :
+
+ Clear all the check boxes in the search window.
+
+ RETURNS : nothing
+
+**********************/
+
+
+VOID VLM_ClearAllSearchSelections( )
+{
+#ifndef OEM_MSOFT
+ WININFO_PTR wininfo;
+ SRCH_OBJECT_PTR srch;
+
+ if ( gb_search_win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( gb_search_win );
+
+ srch = VLM_GetFirstSRCH( wininfo->pFlatList );
+
+ while ( srch != NULL ) {
+
+ if ( srch->status & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ srch->status &= ~(INFO_SELECT|INFO_PARTIAL);
+
+ DLM_Update( gb_search_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)srch, 0 );
+ }
+ srch = VLM_GetNextSRCH( srch );
+ }
+
+ }
+#endif
+}
+
+
+
+/**********************
+
+ NAME : VLM_CreateSearchWindowSpecs
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static INT VLM_CreateSearchWindowSpecs( PDS_WMINFO* winspecs )
+{
+#ifndef OEM_MSOFT
+ Q_HEADER_PTR srch_list;
+ WININFO_PTR wininfo;
+ DLM_INIT dlm;
+
+ srch_list = (Q_HEADER_PTR)malloc( sizeof(Q_HEADER) );
+
+ if ( srch_list == NULL ) {
+ return( FAILURE );
+ }
+
+ InitQueue( srch_list );
+
+ wininfo = ( WININFO_PTR )malloc( sizeof( WININFO ) );
+ *winspecs = wininfo;
+
+ if ( wininfo == NULL ) {
+ return( FAILURE );
+ }
+
+ /* fill in the wininfo structure. */
+
+ wininfo->wType = WMTYPE_SEARCH;
+ wininfo->hCursor = RSM_CursorLoad( IDRC_HSLIDER );
+ wininfo->hDragCursor = 0;
+ wininfo->hIcon = RSM_IconLoad( IDRI_SEARCH );
+ wininfo->wHelpID = 0;
+ wininfo->wStatusLineID = 0;
+ wininfo->dwRibbonState = 0;
+ wininfo->hRibbon = NULL;
+ wininfo->pFlatList = (Q_HEADER_PTR)srch_list;
+ wininfo->pAppInfo = NULL;
+
+ /* Fill in the display manager stuff. */
+
+ DLM_ListBoxType( &dlm, DLM_FLATLISTBOX );
+ DLM_Mode( &dlm, DLM_SINGLECOLUMN );
+ DLM_Display( &dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &dlm, srch_list );
+ DLM_TextFont( &dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &dlm, VLM_SrchGetItemCount );
+ DLM_GetFirstItem( &dlm, VLM_SrchGetFirstItem );
+ DLM_GetNext( &dlm, VLM_SrchGetNextItem );
+ DLM_GetPrev( &dlm, VLM_SrchGetPrevItem );
+ DLM_GetTag( &dlm, VLM_SrchGetTag );
+ DLM_SetTag( &dlm, VLM_SrchSetTag );
+ DLM_GetSelect( &dlm, VLM_SrchGetSelect );
+ DLM_SetSelect( &dlm, VLM_SrchSetSelect );
+ DLM_GetObjects( &dlm, VLM_SrchGetObjects );
+ DLM_SetObjects( &dlm, VLM_SrchSetObjects );
+ DLM_SSetItemFocus( &dlm, NULL );
+ DLM_MaxNumObjects( &dlm, NUM_DISPLAY_OBJECTS );
+
+ DLM_DispListInit( wininfo, &dlm );
+
+#endif
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME : VLM_FillInSrchDetails
+
+ DESCRIPTION :
+
+ Fills in the date, size, and attribute fields.
+
+ RETURNS : nothing.
+
+**********************/
+
+static VOID VLM_FillInSrchDetails(
+CHAR_PTR date_buffer,
+UINT16 date,
+CHAR_PTR time_buffer,
+UINT16 time,
+CHAR_PTR attr_buffer,
+UINT32 attribute )
+{
+#ifndef OEM_MSOFT
+ CHAR_PTR s;
+
+ s = attr_buffer;
+
+ UI_IntToDate( date_buffer, date );
+ UI_IntToTime( time_buffer, time );
+
+ if ( attribute & OBJ_READONLY_BIT ) {
+ *s++ = TEXT('R');
+ }
+ if ( attribute & OBJ_HIDDEN_BIT ) {
+ *s++ = TEXT('H');
+ }
+ if ( attribute & OBJ_SYSTEM_BIT ) {
+ *s++ = TEXT('S');
+ }
+ if ( attribute & OBJ_MODIFIED_BIT ) {
+ *s++ = TEXT('A');
+ }
+
+ *s = TEXT( '\0' );
+#endif
+}
+
+
+static SRCH_OBJECT_PTR VLM_CreateSrch(
+INT name_size,
+INT path_size,
+INT date_size,
+INT time_size,
+INT attr_size,
+INT tape_size,
+INT bset_size,
+INT set_size )
+{
+ SRCH_OBJECT_PTR srch;
+#ifndef OEM_MSOFT
+
+ // All these sizes are in bytes.
+
+ srch = ( SRCH_OBJECT_PTR )malloc( sizeof( SRCH_OBJECT) +
+ name_size +
+ path_size +
+ date_size +
+ time_size +
+ attr_size +
+ tape_size +
+ bset_size +
+ set_size
+ );
+
+ if ( srch != NULL ) {
+
+ srch->name_str = (CHAR_PTR)((UINT8_PTR)srch + sizeof( SRCH_OBJECT ));
+ srch->path_str = (CHAR_PTR)((UINT8_PTR)srch->name_str + name_size);
+ srch->date_str = (CHAR_PTR)((UINT8_PTR)srch->path_str + path_size);
+ srch->time_str = (CHAR_PTR)((UINT8_PTR)srch->date_str + date_size);
+ srch->attr_str = (CHAR_PTR)((UINT8_PTR)srch->time_str + time_size);
+ srch->tape_str = (CHAR_PTR)((UINT8_PTR)srch->attr_str + attr_size);
+ srch->bset_str = (CHAR_PTR)((UINT8_PTR)srch->tape_str + tape_size);
+ srch->set_str = (CHAR_PTR)((UINT8_PTR)srch->bset_str + bset_size);
+
+ srch->q_elem.q_ptr = srch;
+
+ }
+
+#endif
+ return( srch );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_SetMaxSizes( Q_HEADER_PTR srch_list )
+{
+#ifndef OEM_MSOFT
+ SRCH_OBJECT_PTR srch;
+ UINT64 kilo;
+ UINT64 mega;
+ UINT64 giga;
+
+ // I know there must be an easier way !
+
+ kilo = U64_Init( 999L , 0L );
+ mega = U64_Init( 999999L, 0L );
+ giga = U64_Init( 999999999L, 0L );
+
+ mw_max_name_str = 0;
+ mw_max_path_str = 0;
+ mw_max_date_str = 0;
+ mw_max_time_str = 0;
+ mw_max_attr_str = 0;
+ mw_max_tape_str = 0;
+ mw_max_bset_str = 0;
+ mw_max_size_str = 3;
+ mw_max_set_str = 0;
+
+ srch = VLM_GetFirstSRCH( srch_list );
+
+ while ( srch != NULL ) {
+
+ if ( U64_GE( srch->size, kilo ) && ( mw_max_size_str < 6 ) ) {
+ mw_max_size_str = 6;
+ }
+
+ if ( U64_GE( srch->size, mega ) && ( mw_max_size_str < 9 ) ) {
+ mw_max_size_str = 9;
+ }
+
+ if ( U64_GE( srch->size, giga ) && ( mw_max_size_str < 12 ) ) {
+ mw_max_size_str = 12;
+ }
+
+ if ( strlen( srch->name_str ) > mw_max_name_str ) {
+ mw_max_name_str = (UINT8)strlen( srch->name_str );
+ }
+
+ if ( strlen( srch->path_str ) > mw_max_path_str ) {
+ mw_max_path_str = (UINT8)strlen( srch->path_str );
+ }
+
+ if ( strlen( srch->date_str ) > mw_max_date_str ) {
+ mw_max_date_str = (UINT8)strlen( srch->date_str );
+ }
+
+ if ( strlen( srch->time_str ) > mw_max_time_str ) {
+ mw_max_time_str = (UINT8)strlen( srch->time_str );
+ }
+
+ if ( strlen( srch->attr_str ) > mw_max_attr_str ) {
+ mw_max_attr_str = (UINT8)strlen( srch->attr_str );
+ }
+
+ if ( strlen( srch->tape_str ) > mw_max_tape_str ) {
+ mw_max_tape_str = (UINT8)strlen( srch->tape_str );
+ }
+
+ if ( strlen( srch->bset_str ) > mw_max_bset_str ) {
+ mw_max_bset_str = (UINT8)strlen( srch->bset_str );
+ }
+
+ if ( strlen( srch->set_str ) > mw_max_set_str ) {
+ mw_max_set_str = (UINT8)strlen( srch->set_str );
+ }
+
+ srch = VLM_GetNextSRCH( srch );
+ }
+
+#endif
+}
+
+
+/**********************
+
+ NAME : VLM_FindSrchItem
+
+ DESCRIPTION :
+
+ See if this item is already in our list. On sets that cross tape the
+ catalogs can return the same file twice.
+
+ RETURNS :
+
+**********************/
+
+static INT VLM_FindSrchItem(
+Q_HEADER_PTR srch_list,
+QTC_QUERY_PTR query )
+{
+#ifndef OEM_MSOFT
+ SRCH_OBJECT_PTR srch;
+ CHAR *buffer = NULL;
+ INT buffer_size = 0;
+ INT i;
+ INT BytesNeeded;
+
+ srch = VLM_GetFirstSRCH( srch_list );
+
+ // Look through all known search results.
+
+ while ( srch ) {
+
+ // Look for same tape/set first.
+
+ if ( ( QTC_GetTapeFID( query ) == srch->tape_fid ) &&
+ ( QTC_GetBsetNum( query ) == srch->bset_num ) ) {
+
+ // Then look for same file name.
+
+ if ( ! stricmp( srch->name_str, QTC_GetItemName( query ) ) ) {
+
+ // Now check the path.
+
+ BytesNeeded = QTC_GetPathLength( query ) + 256;
+
+ if ( buffer_size < BytesNeeded ) {
+ free( buffer );
+ buffer = malloc( BytesNeeded );
+ buffer_size = BytesNeeded;
+ if ( buffer == NULL ) {
+ return( FAILURE );
+ }
+ }
+
+ strcpy( buffer, TEXT("\\") );
+
+ if ( QTC_GetPathLength( query ) != sizeof(CHAR) ) {
+
+ memcpy( &buffer[1],
+ QTC_GetPath( query ),
+ QTC_GetPathLength( query ) );
+
+ for ( i = 0; i < QTC_GetPathLength( query )/(INT)sizeof(CHAR); i++ ) {
+
+ if ( buffer[i] == TEXT( '\0' ) ) {
+ buffer[i] = TEXT('\\');
+ }
+ }
+ }
+
+ if ( ! stricmp( srch->path_str, buffer ) ) {
+ free( buffer );
+ return( SUCCESS );
+ }
+ }
+
+ }
+
+ srch = VLM_GetNextSRCH( srch );
+ }
+
+ free( buffer );
+
+#endif
+
+ return( FAILURE );
+}
+
+/**********************
+
+ NAME : VLM_StartSearch
+
+ DESCRIPTION :
+
+ Start a search operation. If a filename has been passed in then default
+ to searching for that file, and don't prompt the user.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_StartSearch( CHAR_PTR filename )
+{
+#ifndef OEM_MSOFT
+ QTC_QUERY_PTR query;
+ Q_HEADER_PTR srch_list;
+ Q_HEADER_PTR tape_list;
+ Q_ELEM_PTR curr_elem = NULL;
+ SRCH_OBJECT_PTR srch;
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+ INT path_length; // num characters in path buffer.
+ INT path_size = 0; // bytes allocated in path buffer.
+ INT i;
+ INT result;
+ INT bsets_searched = 0;
+ CHAR_PTR path = NULL;
+ CHAR_PTR s;
+ WININFO_PTR wininfo;
+ DS_SEARCH_PTR pds = NULL;
+ CDS_PTR pPermCDS = CDS_GetPerm () ;
+ CHAR set_number_str[ 50 ];
+ CHAR buff[ VLM_BUFFER_SIZE ]; // ok, with deep pathes.
+ CHAR volume[ VLM_BUFFER_SIZE ]; // ok, with deep pathes.
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR DirectSrchMethod = FALSE;
+ BOOLEAN stat;
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ tape_list = wininfo->pTreeList;
+
+ tape = VLM_GetFirstTAPE( );
+
+ if ( tape == NULL ) {
+
+ // Tell the user there are no tapes
+
+ RSM_StringCopy( IDS_VLMSRCHOOPS, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSRCHNOCATALOGS, text, MAX_UI_RESOURCE_LEN );
+ WM_MsgBox( title, text, WMMB_OK, WMMB_ICONINFORMATION );
+ return;
+ }
+
+ if ( filename == NULL ) {
+
+ // Ask the user what to search for and where to search for it.
+
+ pds = DM_GetSearchItem();
+
+ if ( pds == NULL ) {
+
+ return; // User hit cancel
+ }
+ }
+
+ // let's fake out the user entered search criteria via dialog box
+
+ else {
+
+ DirectSrchMethod = TRUE;
+
+ pds = (DS_SEARCH_PTR) calloc ( 1, sizeof ( DS_SEARCH ) );
+
+ pds->MaxSrchResults = CDS_GetSearchLimit ( pPermCDS );
+
+ pds->SrchPasswProtTapes = CDS_GetSearchPwdTapes ( pPermCDS );
+ }
+
+ query = QTC_InitQuery( );
+
+ if ( query == NULL ) {
+
+ // Couldn't get a catalog handle
+
+ return;
+ }
+
+ WM_ShowWaitCursor( TRUE );
+
+ if ( gb_search_win == (HWND)NULL ) {
+
+ // Create search window structures and display manager items
+
+ if ( VLM_CreateSearchWindowSpecs( & wininfo ) ) {
+
+ // Create failed.
+
+ return;
+ }
+
+ srch_list = wininfo->pFlatList;
+ }
+
+ else {
+
+ // empty previous list
+
+ wininfo = WM_GetInfoPtr( gb_search_win );
+ srch_list = wininfo->pFlatList;
+
+ curr_elem = DeQueueElem( srch_list );
+
+ while ( curr_elem != NULL ) {
+ free( curr_elem->q_ptr );
+ curr_elem = DeQueueElem( srch_list );
+ }
+
+ DLM_Update( gb_search_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)NULL, 0 );
+ }
+
+ // Also need to parse out drive\volume name and sanity check
+
+ if ( filename == NULL ) {
+
+ QTC_SetSubdirs( query, CDS_GetSearchSubdirs ( pPermCDS ) );
+
+ s = pds->Path;
+ while ( *s == TEXT(' ') ) s++;
+
+ if ( ! *s ) {
+ strcpy( pds->Path, TEXT("\\") );
+ s = pds->Path;
+ }
+
+ volume[0] = TEXT( '\0' );
+
+ if ( strchr( s, TEXT(':') ) ) {
+ i = 0;
+ while ( *s != TEXT(':') ) {
+ volume[i] = *s++;
+ i++;
+ }
+ volume[i++] = *s++; // copy TEXT(':')
+ volume[i] = TEXT( '\0' );
+ }
+
+ if ( *s == TEXT('\\') ) {
+ s++;
+ }
+
+ path_size = strsize( s ) + 256;
+ path = malloc( path_size );
+
+ if ( path == NULL ) {
+ if ( gb_search_win ) {
+ WM_Destroy( gb_search_win );
+ gb_search_win = (HWND)NULL;
+ }
+ WM_ShowWaitCursor( FALSE );
+ return;
+ }
+
+ strcpy( path, s );
+
+ path_length = strlen( path ) + 1;
+
+ for ( i = 0; i < path_length; i++ ) {
+ if ( path[i] == TEXT('\\') ) {
+ path[i] = TEXT( '\0' );
+ }
+ }
+
+ filename = pds->File;
+ while ( *filename == TEXT(' ') ) {
+ filename++;
+ }
+
+ if ( ! strlen( filename ) ) {
+
+ // Tell user invalid filename was entered
+
+ RSM_StringCopy ( IDS_VLMSRCHOOPS, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy ( IDS_VLMSRCHBADFILENAME, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title, text, WMMB_OK, WMMB_ICONINFORMATION );
+
+ QTC_CloseQuery( query );
+
+ if ( gb_search_win ) {
+ WM_Destroy( gb_search_win );
+ gb_search_win = (HWND)NULL;
+ }
+ WM_ShowWaitCursor( FALSE );
+ free( path );
+ return;
+ }
+ }
+ else {
+
+ QTC_SetSubdirs( query, FALSE );
+
+ volume[0] = TEXT( '\0' );
+
+ s = filename;
+ while ( *s ) s++;
+ while ( *s != TEXT('\\') ) s--;
+ *s = TEXT( '\0' );
+
+ path_size = strsize( filename ) + 256;
+ path = malloc( path_size );
+
+ if ( path == NULL ) {
+
+ QTC_CloseQuery( query );
+
+ if ( gb_search_win ) {
+ WM_Destroy( gb_search_win );
+ gb_search_win = (HWND)NULL;
+ }
+ WM_ShowWaitCursor( FALSE );
+ return;
+ }
+
+ if ( strlen( filename ) == 0 ) {
+
+ // "\config.sys"
+
+ filename++;
+ path[0] = TEXT( '\0' );
+ path_length = 1;
+ }
+ else {
+
+ // "\dos\format.exe"
+
+ strcpy( path, &filename[1] );
+ path_length = strlen( path ) + 1;
+
+ for ( i = 0; i < path_length; i++ ) {
+ if ( path[i] == TEXT('\\') ) {
+ path[ i ] = TEXT( '\0' );
+ }
+ }
+
+ s++;
+ filename = s;
+ }
+ }
+
+ // Set up the catalog search criteria
+
+ QTC_SetSearchPath( query, path, path_length * sizeof(CHAR) );
+ QTC_SetSearchName( query, filename ); // TEXT("*.C")
+ QTC_SetPreDate( query, 0 );
+ QTC_SetPostDate( query, 0 );
+ QTC_SetTapeSeq( query, -1 );
+
+ free( path );
+
+ // Find the starting tape/bset to search.
+
+ tape = VLM_GetFirstTAPE( );
+
+ do {
+
+ if ( ( DirectSrchMethod ) || ( tape == NULL ) ) {
+ break;
+ }
+
+ if ( ( pds->Tape == tape->tape_fid ) || ( pds->Tape == -1 ) ) {
+ break;
+ }
+
+ tape = VLM_GetNextTAPE( tape );
+
+ } while ( TRUE );
+
+ // Now loop until we have nothing left to search.
+
+ while ( tape != NULL ) {
+
+ QTC_SetTapeFID( query, tape->tape_fid );
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ // Look for bset from correct path/volume !!!
+ // If this bset is not from the correct volume skip it.
+
+ if ( strlen( volume ) ) {
+
+ if ( strnicmp( volume, bset->volume_name, strlen( volume ) ) ) {
+ bset = VLM_GetNextBSET( bset );
+ continue;
+ }
+ }
+
+ if ( ( bset != NULL ) && ( bset->password_size ) ) {
+
+ if ( pds->SrchPasswProtTapes ) {
+
+ if ( PSWD_CheckForPassword( bset->tape_fid, bset->bset_num ) ) {
+
+ // skip all subsequent password protected backup sets
+ pds->SrchPasswProtTapes = FALSE;
+
+ // password failure
+ bset = VLM_GetNextBSET( bset );
+ continue;
+ }
+ }
+
+ else {
+ bset = VLM_GetNextBSET( bset );
+ continue;
+ }
+ }
+
+ if ( ( bset != NULL ) && ( QueueCount( srch_list ) < pds->MaxSrchResults ) ) {
+
+ bsets_searched++;
+
+ QTC_SetBsetNum( query, bset->bset_num );
+
+ // Tell status line what we are searching.
+
+
+ RSM_StringCopy ( IDS_VLMSRCHINGWHAT, text, MAX_UI_RESOURCE_LEN );
+
+ sprintf( buff, text, tape->name, bset->bset_num );
+
+ STM_DrawText( buff );
+
+ RSM_StringCopy ( IDS_VLMSETNUMBER, text, MAX_UI_RESOURCE_LEN );
+
+ sprintf( set_number_str, text, bset->bset_num );
+
+ result = QTC_SearchFirstItem( query );
+
+ while ( ! result && ( QueueCount( srch_list ) < pds->MaxSrchResults ) ) {
+
+ if ( VLM_FindSrchItem( srch_list,
+ query ) != SUCCESS ) {
+
+ VLM_FillInSrchDetails( buff, QTC_GetItemDate( query ),
+ &buff[20], QTC_GetItemTime( query ),
+ &buff[40], QTC_GetItemAttrib( query ) );
+
+ srch = VLM_CreateSrch( (strlen( QTC_GetItemName( query ) ) + 1) * sizeof(CHAR),
+ QTC_GetPathLength( query ) + 1 * sizeof(CHAR),
+ (strlen( buff ) + 1) * sizeof(CHAR),
+ (strlen( &buff[20] ) + 1) * sizeof(CHAR),
+ (strlen( &buff[40] ) + 1) * sizeof(CHAR),
+ (strlen( tape->name ) + 1) * sizeof(CHAR),
+ (strlen( bset->name ) + 1) * sizeof(CHAR),
+ (strlen( set_number_str ) + 1) * sizeof(CHAR) );
+
+ if ( srch == NULL ) {
+ break;
+ }
+
+ srch->attrib = QTC_GetItemAttrib( query );
+ srch->status = INFO_DISPLAY | INFO_TAPE;
+ if ( QTC_GetItemStatus( query ) & QTC_CORRUPT ) {
+ srch->status |= INFO_CORRUPT;
+ }
+ srch->size = QTC_GetItemSize( query );
+ srch->XtraBytes = wininfo;
+ srch->tape_fid = QTC_GetTapeFID( query );
+ srch->bset_num = (INT16)QTC_GetBsetNum( query );
+
+ U64_Litoa( srch->size, srch->size_str, (INT16) 10, &stat );
+
+ strcpy( srch->date_str, buff );
+ strcpy( srch->time_str, &buff[20] );
+ strcpy( srch->attr_str, &buff[40] );
+ strcpy( srch->tape_str, tape->name );
+ strcpy( srch->bset_str, bset->name );
+ strcpy( srch->set_str, set_number_str );
+
+ strcpy( srch->name_str, QTC_GetItemName( query ) );
+
+ s = srch->name_str;
+ while ( *s ) {
+ *s = (CHAR)toupper( *s );
+ s++;
+ }
+
+ strcpy( srch->path_str, TEXT("\\") );
+
+ if ( QTC_GetPathLength( query ) != sizeof(CHAR) ) {
+
+ memcpy( &srch->path_str[1],
+ QTC_GetPath( query ),
+ QTC_GetPathLength( query ) );
+
+ for ( i = 0; i < QTC_GetPathLength( query )/(INT)sizeof(CHAR); i++ ) {
+
+ if ( srch->path_str[i] == TEXT( '\0' ) ) {
+ srch->path_str[i] = TEXT('\\');
+ }
+ srch->path_str[i] = (CHAR)toupper( srch->path_str[i] );
+ }
+ }
+
+ // Convert to the big date time structure
+ // from the compressed DOS structure the catalogs store
+
+ srch->mod_date = QTC_GetItemDate( query );
+ srch->mod_time = QTC_GetItemTime( query );
+
+ // See if we can set any special flags, date and time.
+
+ s = srch->name_str;
+ while ( *s && *s != TEXT('.') ) s++;
+ if ( ! stricmp( s, TEXT(".EXE") ) ||
+ ! stricmp( s, TEXT(".COM") ) ||
+ ! stricmp( s, TEXT(".BAT") ) ||
+ ! stricmp( s, TEXT(".CMD") ) ||
+ ! stricmp( s, TEXT(".PIF") ) ) {
+ srch->status |= INFO_EXEFILE;
+ }
+
+ // Add this new item to our list.
+
+ if ( curr_elem == NULL ) {
+ EnQueueElem( srch_list, &(srch->q_elem), FALSE );
+ }
+ else {
+ InsertElem( srch_list, curr_elem, &(srch->q_elem), AFTER );
+ }
+
+ curr_elem = &(srch->q_elem);
+
+ }
+
+ result = QTC_SearchNextItem( query );
+ }
+
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ // There are multiple tapes for each tape family
+ // See if there are anymore in this family to search
+
+ do {
+
+ tape = VLM_GetNextTAPE( tape );
+
+ if ( ( DirectSrchMethod ) || ( tape == NULL ) || ( pds == NULL ) ) {
+ break;
+ }
+
+ } while ( (tape->tape_fid != pds->Tape) && (pds->Tape != -1 ) );
+
+ }
+
+ // Searching is done, let's see what we got.
+
+ STM_SetIdleText( IDS_READY );
+
+ if ( QueueCount( srch_list ) == pds->MaxSrchResults ) {
+
+ // Message box to inform user that search
+ // generated too many solutions to finish.
+
+ RSM_StringCopy( IDS_VLMSRCHOOPS, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSRCHTOOMANY, text, MAX_UI_RESOURCE_LEN );
+ WM_MsgBox( title, text, WMMB_OK, WMMB_ICONINFORMATION );
+ }
+
+ QTC_CloseQuery( query );
+
+ if ( pds != NULL ) {
+ free( pds );
+ }
+
+ if ( QueueCount( srch_list ) ) {
+
+ // Create the window, if necessary
+
+ if ( gb_search_win == (HWND)NULL ) {
+
+ RSM_StringCopy ( IDS_VLMSEARCHTITLE, title, MAX_UI_RESOURCE_LEN );
+
+ gb_search_win = WM_Create( WM_MDISECONDARY | WM_FLATLISTSC ,
+ title,
+ NULL,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ wininfo );
+
+ if ( gb_search_win == (HWND)NULL ) {
+ WM_ShowWaitCursor( FALSE );
+ return;
+ }
+ }
+
+ VLM_SetMaxSizes( srch_list );
+
+ VLM_SetSelectionStatus( srch_list, (UINT32)-1L, -1 );
+
+ /* Start up the Display Manager. */
+ DLM_DispListProc( wininfo->hWndFlatList, 0, NULL );
+
+ DLM_SetAnchor ( WMDS_GetWinFlatList( wininfo ),
+ 0,
+ (LMHANDLE) VLM_GetFirstSRCH( srch_list ) );
+
+ WM_DocActivate( gb_search_win );
+ }
+ else {
+
+ if ( bsets_searched != 0 ) {
+
+ // MessageBox to tell user no matches were found.
+
+ RSM_StringCopy( IDS_VLMSRCHOOPS, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSRCHNOFILESFOUND, text, MAX_UI_RESOURCE_LEN );
+ }
+ else {
+
+ // MessageBox to tell user no bsets were searched.
+
+ RSM_StringCopy( IDS_VLMSRCHOOPS, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMSRCHNOMATCHINGSETS, text, MAX_UI_RESOURCE_LEN );
+ }
+
+ WM_MsgBox( title, text, WMMB_OK, WMMB_ICONINFORMATION );
+
+ if ( gb_search_win ) {
+ WM_Destroy( gb_search_win );
+ }
+
+ }
+
+ WM_ShowWaitCursor( FALSE );
+
+#endif
+}
+
+
+/**********************
+
+ NAME : VLM_UpdateSearchSelections
+
+ DESCRIPTION :
+
+ The user has selected or deselected, some files on tape somewhere,
+ somehow. The exact tape and backup set that chenged are passed in
+ and we need to see if any of our results were affected.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_UpdateSearchSelections( UINT32 tape_fid, INT16 bset_num )
+{
+#ifndef OEM_MSOFT
+ WININFO_PTR wininfo;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse;
+ SRCH_OBJECT_PTR srch;
+ CHAR_PTR path;
+ CHAR_PTR buff = NULL;
+ INT16 result;
+ INT16 i;
+ INT16 path_length;
+ UINT16 status;
+ INT BytesNeeded;
+ INT buff_size = 0;
+ DATE_TIME mod_date;
+
+ if ( gb_search_win == (HWND)NULL ) {
+
+ // There isn't a search window.
+
+ return;
+ }
+
+ wininfo = WM_GetInfoPtr( gb_search_win );
+
+ if ( wininfo != NULL ) {
+
+ srch = VLM_GetFirstSRCH( wininfo->pFlatList );
+
+ while ( srch ) {
+
+ if ( ( ( tape_fid == srch->tape_fid ) || ( tape_fid == -1 ) ) &&
+ ( ( bset_num == srch->bset_num ) || ( bset_num == -1 ) ) ) {
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ srch->tape_fid,
+ srch->bset_num );
+
+ if ( bsd_ptr != NULL ) {
+
+ BytesNeeded = strsize( srch->path_str ) + 256;
+
+ if ( buff_size < BytesNeeded ) {
+ free( buff );
+ buff = malloc( BytesNeeded );
+ buff_size = BytesNeeded;
+
+ if ( buff == NULL ) {
+ return;
+ }
+ }
+
+ strcpy( buff, srch->path_str );
+
+ // set path
+ path = buff;
+ if ( *path == TEXT('\\') ) path++;
+
+ // and path_length
+ path_length = (INT16) (strlen( path ) + 1);
+
+ for ( i = 0; i < path_length; i++ ) {
+ if ( path[i] == TEXT('\\') ) path[ i ] = TEXT( '\0' );
+ }
+
+ mod_date.date_valid = FALSE;
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse, srch->name_str,
+ path,
+ (INT16)(path_length * sizeof(CHAR)),
+ srch->attrib,
+ &mod_date,
+ NULL, NULL, FALSE, TRUE );
+
+ status = 0;
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+ status = INFO_SELECT;
+ }
+
+ if ( ( srch->status & (UINT16)INFO_SELECT ) != status ) {
+
+ srch->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ srch->status |= status;
+
+ DLM_Update( gb_search_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)srch, 0 );
+ }
+ }
+ }
+ srch = VLM_GetNextSRCH( srch );
+ }
+
+ }
+#endif
+}
+
+
+/**********************
+
+ NAME : VLM_SearchRemoveSet
+
+ DESCRIPTION :
+
+ Removes all the items in the search window that were from a certain
+ backup set. Usually because that set went away ...
+
+ RETURNS : Number of items removed.
+
+**********************/
+
+INT VLM_SearchRemoveSet( UINT32 tape_fid, INT16 bset_num )
+{
+ INT16 count = 0;
+
+#ifndef OEM_MSOFT
+
+ SRCH_OBJECT_PTR srch;
+ WININFO_PTR wininfo;
+
+ if ( gb_search_win == (HWND)NULL ) {
+ return( 0 );
+ }
+
+ wininfo = WM_GetInfoPtr( gb_search_win );
+
+ if ( wininfo != NULL ) {
+
+ srch = VLM_GetFirstSRCH( wininfo->pFlatList );
+
+ }
+
+ while ( srch ) {
+
+ if ( ( srch->tape_fid == tape_fid ) &&
+ ( ( srch->bset_num == bset_num ) || ( bset_num == -1 ) ) ) {
+
+ RemoveQueueElem( wininfo->pFlatList, &(srch->q_elem) );
+ free( srch );
+ count++;
+ srch = VLM_GetFirstSRCH( wininfo->pFlatList );
+ }
+ else {
+ srch = VLM_GetNextSRCH( srch );
+ }
+ }
+
+ if ( count ) {
+
+ DLM_Update( gb_search_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)NULL, 0 );
+
+ }
+
+ if ( ! QueueCount( wininfo->pFlatList ) ) {
+ if ( gb_search_win ) {
+ WM_Destroy( gb_search_win );
+ }
+ }
+#endif
+ return( count );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_SetSelectionStatus( Q_HEADER_PTR srch_list,
+ UINT32 tape_fid,
+ INT16 bset_num )
+{
+#ifndef OEM_MSOFT
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse;
+ SRCH_OBJECT_PTR srch;
+ CHAR_PTR path;
+ CHAR_PTR buff = NULL;
+ INT BytesNeeded;
+ INT buff_size = 0;
+ INT16 result;
+ INT16 i;
+ INT16 path_length;
+ DATE_TIME mod_date;
+
+
+ srch = VLM_GetFirstSRCH( srch_list );
+
+ while ( srch ) {
+
+ if ( ( ( tape_fid == srch->tape_fid ) &&
+ ( bset_num == srch->bset_num ) ) ||
+ ( bset_num == -1 ) ) {
+
+ srch->status &= ~(INFO_SELECT|INFO_PARTIAL);
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ srch->tape_fid,
+ srch->bset_num );
+
+ if ( bsd_ptr != NULL ) {
+
+ BytesNeeded = strsize( srch->path_str ) + 256;
+ if ( buff_size < BytesNeeded ) {
+ buff_size = BytesNeeded;
+ free( buff );
+ buff = malloc( BytesNeeded );
+ if ( buff == NULL ) {
+ return;
+ }
+ }
+
+ strcpy( buff, srch->path_str );
+
+ // set path
+ path = buff;
+ if ( *path == TEXT('\\') ) path++;
+
+ // and path_length
+ path_length = (INT16)(strlen( path ) + 1);
+
+ for ( i = 0; i < path_length; i++ ) {
+ if ( path[i] == TEXT('\\') ) path[ i ] = TEXT( '\0' );
+ }
+
+ mod_date.date_valid = FALSE;
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse, srch->name_str,
+ path,
+ (INT16)(path_length * sizeof(CHAR)),
+ srch->attrib,
+ &mod_date, NULL, NULL, FALSE, TRUE );
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+ srch->status |= INFO_SELECT;
+ }
+
+ }
+ }
+ srch = VLM_GetNextSRCH( srch );
+ }
+
+ free( buff );
+#endif
+}
+
+
+
+/***************************************************
+
+ Name: VLM_GetFirstSRCH
+
+ Description:
+
+ Get the first drive element off a queue of known drives.
+
+*****************************************************/
+
+
+static SRCH_OBJECT_PTR VLM_GetFirstSRCH(
+Q_HEADER_PTR qhdr) // I - queue header to work from
+{
+ Q_ELEM_PTR q_elem;
+
+ if ( qhdr != NULL ) {
+
+ q_elem = QueueHead( qhdr );
+
+ if ( q_elem != NULL ) {
+ return ( SRCH_OBJECT_PTR )( q_elem->q_ptr );
+ }
+ }
+
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetNextSRCH
+
+ Description:
+
+ Get the next drive element off a queue of known drives.
+
+*****************************************************/
+
+static SRCH_OBJECT_PTR VLM_GetNextSRCH(
+SRCH_OBJECT_PTR srch ) // I - current vlm
+{
+ Q_ELEM_PTR q_elem;
+
+ q_elem = QueueNext( &(srch->q_elem) );
+
+ if ( q_elem != NULL ) {
+ return (SRCH_OBJECT_PTR )( q_elem->q_ptr );
+ }
+ else {
+ return( NULL );
+ }
+}
+
+/***************************************************
+
+ Name: VLM_GetFirstSRCH
+
+ Description:
+
+ Get the previous drive element off a queue of known drives.
+
+*****************************************************/
+
+static SRCH_OBJECT_PTR VLM_GetPrevSRCH(
+SRCH_OBJECT_PTR srch ) // I - current vlm
+{
+ Q_ELEM_PTR q_elem;
+
+ q_elem = QueuePrev( &(srch->q_elem) );
+
+ if ( q_elem != NULL ) {
+ return( SRCH_OBJECT_PTR )( q_elem->q_ptr );
+ }
+ else {
+ return( NULL );
+ }
+}
+
+
+
+
+
+/***************************************************
+
+ Name: VLM_SrchSetSelect
+
+ Description:
+
+ The callback function for the display manager to tell me that the
+ selection status on a disk has changed.
+
+*****************************************************/
+
+static VOID_PTR VLM_SrchSetSelect(
+SRCH_OBJECT_PTR srch, // I - srch to change
+BYTE attr ) // I - what to change it to
+{
+#ifndef OEM_MSOFT
+ CHAR_PTR buff;
+ CHAR_PTR path;
+ INT16 path_len;
+ FSE_PTR fse_ptr;
+ BSD_PTR bsd_ptr;
+ INT16 error;
+ INT16 i;
+ UINT16 status;
+ HWND win;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ BE_CFG_PTR bec_config;
+ DATE_TIME sort_date;
+ BSET_OBJECT_PTR bset;
+
+ // change the status
+
+ if ( attr ) {
+ status = INFO_SELECT;
+ }
+ else {
+ status = 0;
+ }
+
+ // determine path length
+ // insert 0's for \'s
+
+ buff = malloc( strsize( srch->path_str ) );
+ if ( buff == NULL ) {
+ return;
+ }
+
+ strcpy( buff, srch->path_str );
+ path = buff;
+ if ( *path == TEXT('\\') ) {
+ path++;
+ }
+
+ path_len = (INT16)(strlen( path ) + 1);
+
+ for ( i = 0; i < path_len; i++ ) {
+ if ( path[i] == TEXT('\\') ) path[i] = TEXT( '\0' );
+ }
+
+ path_len *= sizeof(CHAR);
+
+ if ( attr ) {
+ error = BSD_CreatFSE( &fse_ptr, INCLUDE, path, path_len,
+ srch->name_str,
+ (INT16) strsize(srch->name_str),
+ USE_WILD_CARD, FALSE );
+ }
+ else {
+ error = BSD_CreatFSE( &fse_ptr, EXCLUDE, path, path_len,
+ srch->name_str,
+ (INT16) strsize(srch->name_str),
+ USE_WILD_CARD, FALSE );
+ }
+
+ free( buff );
+
+ if ( error ) {
+ return NULL;
+ }
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ srch->tape_fid,
+ srch->bset_num );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ VLM_GetSortDate( srch->tape_fid, srch->bset_num, &sort_date );
+
+ bset = VLM_FindBset( srch->tape_fid, srch->bset_num );
+
+ BSD_Add( tape_bsd_list, &bsd_ptr, bec_config,
+ NULL, NULL,
+ bset->tape_fid, bset->tape_num, bset->bset_num,
+ NULL, &sort_date );
+
+ }
+
+ if ( bsd_ptr != NULL ) {
+
+ VLM_FillInBSD( bsd_ptr );
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+ }
+
+ if ( (srch->status & (UINT16)INFO_SELECT) == status ) {
+
+ return( NULL );
+ }
+
+ srch->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ srch->status |= status;
+
+ DLM_Update( gb_search_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)srch, 0 );
+
+ // Now check to see if any other WMTYPE_TAPETREE windows are open and update
+ // them accordingly.
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo->wType == WMTYPE_TAPETREE ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( ( appinfo->tape_fid == srch->tape_fid ) &&
+ ( appinfo->bset_num == srch->bset_num ) ) {
+
+ VLM_RematchList( win );
+ break;
+ }
+ }
+
+ win = WM_GetNext( (HWND)win );
+ }
+
+ VLM_UpdateTapes( );
+
+#endif
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_SrchGetSelect
+
+ Description:
+
+ A callback function for the display manager to get the selection
+ status of a disk.
+
+*****************************************************/
+
+static BYTE VLM_SrchGetSelect(
+SRCH_OBJECT_PTR srch ) // I - vlm to get the status of
+{
+ if ( srch->status & INFO_SELECT ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/***************************************************
+
+ Name: VLM_VlmSetTag
+
+ Description:
+
+ A callback function for the display manager to set the tag status
+ of a disk for me.
+
+*****************************************************/
+
+static VOID_PTR VLM_SrchSetTag(
+SRCH_OBJECT_PTR srch, // I - srch to work with
+BYTE attr ) // I - what to set it to
+{
+ if ( attr ) {
+ srch->status |= INFO_TAGGED;
+ }
+ else {
+ srch->status &= ~INFO_TAGGED;
+ }
+ return(NULL);
+}
+
+/***************************************************
+
+ Name: VLM_SrchGetTag
+
+ Description:
+
+ A callback function for the display manager to get the tag status
+ of a disk from me.
+
+*****************************************************/
+
+static BYTE VLM_SrchGetTag(
+SRCH_OBJECT_PTR srch ) // I - srch to work with
+{
+ if ( srch->status & INFO_TAGGED ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/***************************************************
+
+ Name: VLM_SrchGetItemCount
+
+ Description:
+
+ A callback function for the display manager to get the
+ number of displayable drives.
+
+*****************************************************/
+
+static USHORT VLM_SrchGetItemCount(
+Q_HEADER_PTR srch_list ) // I - queue header to get count from
+{
+ return( QueueCount( srch_list ) );
+}
+
+/***************************************************
+
+ Name: VLM_SrchGetFirstItem
+
+ Description:
+
+ A callback function for the display manager to get the first drive
+ to display.
+
+*****************************************************/
+
+static VOID_PTR VLM_SrchGetFirstItem(
+Q_HEADER_PTR srch_list ) // I - queue to get first item from
+{
+ return( VLM_GetFirstSRCH( srch_list ) );
+}
+
+/***************************************************
+
+ Name: VLM_SrchGetPrevItem
+
+ Description:
+
+ A callback function for the display manager to get the previous
+ disk in a list of disks.
+
+*****************************************************/
+
+static VOID_PTR VLM_SrchGetPrevItem(
+SRCH_OBJECT_PTR srch ) // I - current srch
+{
+ return( VLM_GetPrevSRCH( srch ) );
+}
+
+/***************************************************
+
+ Name: VLM_SrchGetNextItem
+
+ Description:
+
+ A callback function for the display manager to get the next
+ disk in a list of disks.
+
+*****************************************************/
+
+static VOID_PTR VLM_SrchGetNextItem(
+SRCH_OBJECT_PTR srch ) // I - current srch
+{
+ return( VLM_GetNextSRCH( srch ) );
+}
+
+/***************************************************
+
+ Name: VLM_SrchGetObjects
+
+ Description:
+
+ A callback function for the display manager to get the object list
+ to display for a given disk.
+
+*****************************************************/
+
+static VOID_PTR VLM_SrchGetObjects(
+SRCH_OBJECT_PTR srch ) // I - current srch
+{
+ BYTE_PTR memblk;
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+
+#ifndef OEM_MSOFT
+
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+
+
+ wininfo = WM_GetInfoPtr( gb_search_win );
+
+ // get the buffer to fill for this window
+
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( wininfo->hWndFlatList );
+
+ /* Store the number of items in the first two bytes. */
+
+ *memblk = NUM_DISPLAY_OBJECTS;
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( srch->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( srch->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up Bitmap, ie. Floppy, Hard, Network. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+
+ if ( srch->attrib & OBJ_HIDDEN_BIT ) {
+
+ if ( srch->status & INFO_EXEFILE ) {
+ DLM_ItemwId( item ) = IDRBM_HEXEFILE;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_HFILE;
+ }
+ if ( srch->status & INFO_CORRUPT ) {
+ DLM_ItemwId( item ) = IDRBM_HCRPTFILE;
+ }
+ }
+ else {
+ if ( srch->status & INFO_EXEFILE ) {
+ DLM_ItemwId( item ) = IDRBM_EXE;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_FILE;
+ }
+ if ( srch->status & INFO_CORRUPT ) {
+ DLM_ItemwId( item ) = IDRBM_CORRUPTFILE;
+ }
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text strings to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_name_str;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), srch->name_str );
+
+ item++;
+ DLM_ItemcbNum( item ) = 4;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItembTextMode( item ) = DLM_RIGHT_JUSTIFY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_size_str;
+ DLM_ItembLevel( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), srch->size_str );
+
+ item++;
+ DLM_ItemcbNum( item ) = 5;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_date_str;
+ DLM_ItembLevel( item ) = 0;
+ sprintf(text, TEXT("%8s"), (CHAR_PTR)srch->date_str);
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), (CHAR_PTR)text );
+
+ item++;
+ DLM_ItemcbNum( item ) = 6;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_time_str;
+ DLM_ItembLevel( item ) = 0;
+ sprintf(text, TEXT("%11s"), (CHAR_PTR)srch->time_str);
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), (CHAR_PTR)text );
+
+ item++;
+ DLM_ItemcbNum( item ) = 7;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_attr_str;
+ DLM_ItembLevel( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), srch->attr_str );
+
+
+ item++;
+ DLM_ItemcbNum( item ) = 8;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_path_str;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), srch->path_str );
+
+ item++;
+ DLM_ItemcbNum( item ) = 9;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_set_str;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), srch->set_str );
+
+ item++;
+ DLM_ItemcbNum( item ) = 10;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_tape_str;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), srch->tape_str );
+
+ item++;
+ DLM_ItemcbNum( item ) = 11;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = mw_max_bset_str;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), srch->bset_str );
+
+#endif
+ return( memblk );
+}
+
+/***************************************************
+
+ Name: VLM_VlmSetObjects
+
+ Description:
+
+ A callback function for the display manager to tell me that the
+ user tried to do something with this drive.
+
+*****************************************************/
+
+static BOOLEAN VLM_SrchSetObjects(
+SRCH_OBJECT_PTR srch, // I - current srch
+WORD operation, // I - operation the user did
+WORD ObjectNum ) // I - object he did it on
+{
+#ifndef OEM_MSOFT
+
+ CHAR keyb_char;
+ SRCH_OBJECT_PTR temp_srch;
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_srch = srch;
+
+ do {
+
+ temp_srch = VLM_GetNextSRCH( temp_srch );
+
+ if ( temp_srch != NULL ) {
+
+ if ( keyb_char == (CHAR)toupper( temp_srch->name_str[0] ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( temp_srch->XtraBytes ),
+ 0,
+ (LMHANDLE)temp_srch );
+ return( TRUE );
+ }
+ }
+
+ } while ( temp_srch != NULL );
+
+ temp_srch = VLM_GetFirstSRCH( WMDS_GetFlatList( srch->XtraBytes ) );
+
+ while ( temp_srch != srch && temp_srch != NULL ) {
+
+ if ( keyb_char == (CHAR)toupper( temp_srch->name_str[0] ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( temp_srch->XtraBytes ),
+ 0,
+ (LMHANDLE)temp_srch );
+ return( TRUE );
+ }
+
+ temp_srch = VLM_GetNextSRCH( temp_srch );
+ }
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( srch->XtraBytes ),
+ 0,
+ (LMHANDLE)srch );
+
+
+ }
+
+#endif
+ return( FALSE );
+}
+
diff --git a/private/utils/ntbackup/src/vlm_srv.c b/private/utils/ntbackup/src/vlm_srv.c
new file mode 100644
index 000000000..cca0dcb5e
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_srv.c
@@ -0,0 +1,1897 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_SRV.C
+
+ Description:
+
+ This file contains most of the code for processing the servers
+ window and list.
+
+ $Log: G:\UI\LOGFILES\VLM_SRV.C_V $
+
+ Rev 1.37.1.0 08 Dec 1993 11:20:34 MikeP
+very deep pathes
+
+ Rev 1.37 27 Jul 1993 15:34:56 MARINA
+enable c++
+
+ Rev 1.36 11 Nov 1992 16:37:00 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.35 07 Oct 1992 15:06:00 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.34 04 Oct 1992 19:42:56 DAVEV
+Unicode Awk pass
+
+ Rev 1.33 29 Jul 1992 09:51:48 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.32 20 Jul 1992 09:58:50 JOHNWT
+gas gauge display work
+
+ Rev 1.31 08 Jul 1992 15:33:54 STEVEN
+Unicode BE changes
+
+ Rev 1.30 14 May 1992 18:05:36 MIKEP
+nt pass 2
+
+ Rev 1.29 13 May 1992 11:42:18 MIKEP
+NT changes
+
+ Rev 1.28 06 May 1992 14:41:22 MIKEP
+unicode pass two
+
+ Rev 1.27 04 May 1992 13:39:44 MIKEP
+unicode pass 1
+
+ Rev 1.26 24 Mar 1992 14:45:18 DAVEV
+OEM_MSOFT: Removed Servers windows and associated code
+
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+// Local Prototypes
+
+static VOID_PTR VLM_SrvSetSelect( VLM_OBJECT_PTR, BYTE );
+static BYTE VLM_SrvGetSelect( VLM_OBJECT_PTR );
+static VOID_PTR VLM_SrvSetTag( VLM_OBJECT_PTR, BYTE );
+static BYTE VLM_SrvGetTag( VLM_OBJECT_PTR );
+static USHORT VLM_SrvGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_SrvGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_SrvGetPrevItem( VLM_OBJECT_PTR );
+static VOID_PTR VLM_SrvGetNextItem( VLM_OBJECT_PTR );
+static VOID_PTR VLM_SrvGetObjects( VLM_OBJECT_PTR );
+static BOOLEAN VLM_SrvSetObjects( VLM_OBJECT_PTR, WORD, WORD );
+
+static VOID_PTR VLM_VolSetSelect( VLM_OBJECT_PTR, BYTE );
+static BYTE VLM_VolGetSelect( VLM_OBJECT_PTR );
+static VOID_PTR VLM_VolSetTag( VLM_OBJECT_PTR, BYTE );
+static BYTE VLM_VolGetTag( VLM_OBJECT_PTR );
+static USHORT VLM_VolGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_VolGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_VolGetPrevItem( VLM_OBJECT_PTR );
+static VOID_PTR VLM_VolGetNextItem( VLM_OBJECT_PTR );
+static VOID_PTR VLM_VolGetObjects( VLM_OBJECT_PTR );
+static BOOLEAN VLM_VolSetObjects( VLM_OBJECT_PTR, WORD, WORD );
+static VOID_PTR VLM_DoVolSetSelect( VLM_OBJECT_PTR, BYTE );
+
+static BOOLEAN VLM_MayWeAttachToVolume( GENERIC_DLE_PTR );
+
+
+/**********************
+
+ NAME : VLM_MayWeAttachToVolume
+
+ DESCRIPTION :
+
+ There is one reason that we would not be allowed to attach to a
+ volume:
+
+ 1. This server has a mixture of AFP and NON-AFP volumes and one of
+ the opposite type is already open. This is a NOVELL bug.
+
+ RETURNS : TRUE/FALSE
+
+**********************/
+
+static BOOLEAN VLM_MayWeAttachToVolume( GENERIC_DLE_PTR dle )
+{
+ HWND win;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ GENERIC_DLE_PTR parent_dle;
+
+
+ if ( ( DLE_GetDeviceType( dle ) != NOVELL_AFP_DRV ) &&
+ ( DLE_GetDeviceType( dle ) != NOVELL_DRV ) ) {
+ return( TRUE );
+ }
+
+ parent_dle = DLE_GetParent( dle );
+
+ if ( parent_dle == NULL ) {
+ return( TRUE );
+ }
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo->wType == WMTYPE_DISKTREE ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( parent_dle == DLE_GetParent( appinfo->dle ) ) {
+
+ if ( DLE_GetDeviceType( appinfo->dle ) !=
+ DLE_GetDeviceType( dle ) ) {
+
+ // NO, NO, NO !
+ // You may not open afp and non-afp volumes on the same
+ // server at the same time, its a novell bug.
+
+ return( FALSE );
+ }
+ }
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ return( TRUE );
+}
+
+
+/**********************
+
+ NAME : VLM_ServersSync
+
+ DESCRIPTION :
+
+ The user has performed a refresh call and it is our job to see to it that
+ any servers no longer on line are removed and any new ones are inserted.
+ Any server with a window open will not go away, because we are attached
+ to it. Also any server with selections made will not go away. All server
+ children dle's need there bsd count incremented to keep them around.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_ServersSync( )
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR temp_vlm;
+ VLM_OBJECT_PTR child_vlm;
+ VLM_OBJECT_PTR parent_vlm;
+ GENERIC_DLE_PTR dle;
+ GENERIC_DLE_PTR child_dle;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ BOOLEAN change_made = FALSE;
+ INT16 vlm_count;
+ FSYS_HAND temp_fsh;
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_servers_win );
+
+ // Look for VLM drives we have that no longer exist.
+
+ vlm = VLM_GetFirstVLM( wininfo->pTreeList );
+
+ while ( vlm != NULL ) {
+
+ parent_vlm = vlm;
+
+ vlm = VLM_GetNextVLM( vlm );
+
+ DLE_FindByName( dle_list, VLM_GetName( parent_vlm ), -1, &dle );
+
+ if ( dle == NULL ) {
+
+ // Server/Drive went away so remove it.
+
+ change_made = TRUE;
+
+ RemoveQueueElem( WMDS_GetTreeList( wininfo ), &(parent_vlm->q_elem) );
+
+ VLM_FreeVLMList( &VLM_GetChildren( parent_vlm ) );
+ free( parent_vlm );
+ }
+ else {
+
+
+ // Make sure all this servers old volumes are still on line.
+
+ child_vlm = VLM_GetFirstVLM( &parent_vlm->children );
+
+ if ( child_vlm ) {
+
+ if ( ! UI_AttachDrive( &temp_fsh, dle, FALSE ) ) {
+
+ // Keep children around by faking a bsd.
+
+ DLE_GetFirstChild( dle, &child_dle );
+
+ while ( child_dle ) {
+
+ // Only increment those that we previously decremented.
+ // NOT the new volume that just appeared.
+
+ if ( VLM_FindVLMByName( &parent_vlm->children,
+ DLE_GetDeviceName( child_dle ) ) != NULL ) {
+ DLE_IncBSDCount( child_dle );
+ }
+ DLE_GetNext( &child_dle );
+ }
+
+ FS_DetachDLE( temp_fsh );
+ }
+ }
+
+ while ( child_vlm ) {
+
+ temp_vlm = child_vlm;
+
+ child_vlm = VLM_GetNextVLM( child_vlm );
+
+ DLE_FindByName( dle_list, VLM_GetName( temp_vlm ), -1, &dle );
+
+ if ( dle == NULL ) {
+
+ change_made = TRUE;
+
+ RemoveQueueElem( &parent_vlm->children, &(temp_vlm->q_elem) );
+
+ free( temp_vlm );
+ }
+ }
+ }
+
+ }
+
+ // Look for new DLE's that aren't in the VLM queue.
+
+ vlm_count = QueueCount( WMDS_GetTreeList( wininfo ) );
+
+ VLM_BuildServerList( WMDS_GetTreeList( wininfo ), wininfo );
+
+ if ( vlm_count != QueueCount( WMDS_GetTreeList( wininfo ) ) ) {
+ change_made = TRUE;
+ }
+
+ if ( change_made ) {
+
+ DLM_Update( gb_servers_win, DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)WMDS_GetTreeList( wininfo ), 0 );
+ }
+ }
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+
+/*****
+
+ NAME : VLM_UpdateServerStatus
+
+ DESCRIPTION :
+
+ We have changed the selection status on one of this server's volumes. So
+ let's quickly update his status based on the selction status of all his
+ volumes. Run through the list and stop as soon as you hit a partially
+ selected one.
+
+*****/
+
+VOID VLM_UpdateServerStatus(
+VLM_OBJECT_PTR server_vlm ) // I - vlm of server to update
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ UINT16 status = 0;
+ VLM_OBJECT_PTR vlm;
+
+ vlm = VLM_GetFirstVLM( &VLM_GetChildren( server_vlm ) );
+
+ // Set up our start state
+
+ if ( vlm == NULL ) {
+
+ // OK, how did you ask for an update on a server with NO volumes ?
+
+ return;
+ }
+
+ if ( vlm->status & INFO_PARTIAL ) {
+ status = 1;
+ }
+ else {
+ if ( vlm->status & INFO_SELECT ) {
+ status = 2;
+ }
+ }
+
+ while ( vlm != NULL && status != 1 ) {
+
+ if ( vlm->status & INFO_PARTIAL ) {
+ status = 1;
+ }
+ else {
+
+ if ( ( vlm->status & INFO_SELECT ) &&
+ ( status == 0 ) ) {
+ status = 1;
+ }
+ if ( ! ( vlm->status & INFO_SELECT ) &&
+ ( status == 2 ) ) {
+ status = 1;
+ }
+ }
+
+ // get next volume
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+ // reset server selection status
+
+ switch ( status ) {
+
+ case 0:
+ status = 0;
+ break;
+ case 1:
+ status |= (INFO_SELECT|INFO_PARTIAL);
+ break;
+ case 2:
+ status |= INFO_SELECT;
+ break;
+ }
+
+ // Update the screen
+
+ if ( ( server_vlm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL) ) != status ) {
+
+ server_vlm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ server_vlm->status |= status;
+
+ DLM_Update( gb_servers_win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)server_vlm, 0 );
+ }
+ }
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+
+/**********************
+
+ NAME : VLM_ClearAllServerSelections
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_ClearAllServerSelections( )
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR child_vlm;
+ GENERIC_DLE_PTR dle;
+
+ if ( gb_servers_win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_servers_win );
+
+ vlm = VLM_GetFirstVLM( WMDS_GetTreeList( wininfo ) );
+
+ while ( vlm != NULL ) {
+
+ DLE_FindByName( dle_list, VLM_GetName( vlm ), -1, &dle );
+
+ if ( VLM_GetStatus( vlm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ VLM_SetStatus( vlm, vlm->status & (UINT16)~(INFO_PARTIAL|INFO_SELECT|INFO_OPEN) );
+ child_vlm = VLM_GetFirstVLM( &VLM_GetChildren( vlm ) );
+
+ while ( child_vlm != NULL ) {
+
+ if ( VLM_GetStatus( child_vlm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ VLM_SetStatus( child_vlm, child_vlm->status & (UINT16)~(INFO_PARTIAL|INFO_SELECT) );
+
+ if ( dle == appinfo->dle ) {
+
+ DLM_Update( gb_servers_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)child_vlm, 0 );
+ }
+
+ }
+ child_vlm = VLM_GetNextVLM( child_vlm );
+ }
+
+ DLM_Update( gb_servers_win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+ }
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+ }
+ }
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+
+
+/**********************
+
+ NAME : VLM_ServerListCreate
+
+ DESCRIPTION :
+
+ Create the servers window.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_ServerListCreate( )
+{
+#if !defined ( OEM_MSOFT )
+ {
+
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ DLM_INIT tree_dlm;
+ DLM_INIT flat_dlm;
+ Q_HEADER_PTR srv_list;
+ VLM_OBJECT_PTR vlm;
+ GENERIC_DLE_PTR dle;
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+
+
+ srv_list = (Q_HEADER_PTR)malloc( sizeof(Q_HEADER) );
+
+ if ( srv_list == NULL ) {
+ return;
+ }
+
+ InitQueue( srv_list );
+
+ appinfo = ( APPINFO_PTR )malloc( sizeof( APPINFO ) );
+
+ if ( appinfo == NULL ) {
+ return;
+ }
+
+ appinfo->dle = NULL;
+
+ // initialize directory list queue
+
+ wininfo = ( WININFO_PTR )malloc( sizeof( WININFO ) );
+
+ if ( wininfo == NULL ) {
+ return;
+ }
+
+ VLM_BuildServerList( srv_list, wininfo );
+
+ // fill in wininfo structure
+
+ WMDS_SetWinType( wininfo, WMTYPE_SERVERS );
+ WMDS_SetCursor( wininfo, RSM_CursorLoad( IDRC_HSLIDER ) );
+ WMDS_SetDragCursor( wininfo, 0 );
+ WMDS_SetIcon( wininfo, RSM_IconLoad( IDRI_SERVERS ) );
+ WMDS_SetWinHelpID( wininfo, 0 );
+ WMDS_SetStatusLineID( wininfo, 0 );
+ WMDS_SetRibbonState( wininfo, 0 );
+ WMDS_SetMenuState( wininfo, 0 );
+ WMDS_SetRibbon( wininfo, NULL );
+ WMDS_SetTreeList( wininfo, srv_list );
+ WMDS_SetFlatList( wininfo, ( Q_HEADER_PTR )NULL );
+ WMDS_SetTreeDisp( wininfo, NULL );
+ WMDS_SetFlatDisp( wininfo, NULL );
+ WMDS_SetAppInfo( wininfo, appinfo );
+
+ // Init display list
+
+ DLM_ListBoxType( &tree_dlm, DLM_TREELISTBOX );
+ DLM_Mode( &tree_dlm, DLM_HIERARCHICAL );
+ DLM_Display( &tree_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &tree_dlm, srv_list );
+ DLM_TextFont( &tree_dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &tree_dlm, VLM_SrvGetItemCount );
+ DLM_GetFirstItem( &tree_dlm, VLM_SrvGetFirstItem );
+ DLM_GetNext( &tree_dlm, VLM_SrvGetNextItem );
+ DLM_GetPrev( &tree_dlm, VLM_SrvGetPrevItem );
+ DLM_GetTag( &tree_dlm, VLM_SrvGetTag );
+ DLM_SetTag( &tree_dlm, VLM_SrvSetTag );
+ DLM_GetSelect( &tree_dlm, VLM_SrvGetSelect );
+ DLM_SetSelect( &tree_dlm, VLM_SrvSetSelect );
+ DLM_GetObjects( &tree_dlm, VLM_SrvGetObjects );
+ DLM_SetObjects( &tree_dlm, VLM_SrvSetObjects );
+ DLM_SSetItemFocus( &tree_dlm, NULL );
+ DLM_MaxNumObjects( &tree_dlm, 6 );
+
+ DLM_DispListInit( wininfo, &tree_dlm );
+
+ DLM_ListBoxType( &flat_dlm, DLM_FLATLISTBOX );
+ DLM_Mode( &flat_dlm, DLM_SINGLECOLUMN );
+ DLM_Display( &flat_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &flat_dlm, NULL );
+ DLM_TextFont( &flat_dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &flat_dlm, VLM_VolGetItemCount );
+ DLM_GetFirstItem( &flat_dlm, VLM_VolGetFirstItem );
+ DLM_GetNext( &flat_dlm, VLM_VolGetNextItem );
+ DLM_GetPrev( &flat_dlm, VLM_VolGetPrevItem );
+ DLM_GetTag( &flat_dlm, VLM_VolGetTag );
+ DLM_SetTag( &flat_dlm, VLM_VolSetTag );
+ DLM_GetSelect( &flat_dlm, VLM_VolGetSelect );
+ DLM_SetSelect( &flat_dlm, VLM_VolSetSelect );
+ DLM_GetObjects( &flat_dlm, VLM_VolGetObjects );
+ DLM_SetObjects( &flat_dlm, VLM_VolSetObjects );
+ DLM_SSetItemFocus( &flat_dlm, NULL );
+ DLM_MaxNumObjects( &flat_dlm, 6 );
+
+ DLM_DispListInit( wininfo, &flat_dlm );
+
+ // open a new window
+ RSM_StringCopy ( IDS_VLMSERVERTITLE, title, MAX_UI_RESOURCE_LEN );
+
+ gb_servers_win = WM_Create( WM_MDIPRIMARY |
+ WM_TREELIST | WM_FLATLISTSC | WM_MIN,
+ title,
+ NULL,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ wininfo );
+
+ appinfo->win = gb_servers_win;
+
+ // Start display manager up.
+
+ DLM_DispListProc( WMDS_GetWinTreeList( wininfo ), 0, NULL );
+ DLM_DispListProc( WMDS_GetWinFlatList( wininfo ), 0, NULL );
+
+ // Now that it is all set up, find the first logged in server
+ // and send myself a double click message on it.
+
+ vlm = VLM_GetFirstVLM( srv_list );
+
+ while ( vlm != NULL ) {
+
+ DLE_FindByName( dle_list, vlm->name, -1, &dle );
+ if ( dle != NULL ) {
+ if ( DLE_ServerLoggedIn( dle ) ) {
+ break;
+ }
+ }
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+ if ( vlm != NULL ) {
+ // make it active.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)vlm );
+
+ VLM_SrvSetObjects( vlm, WM_DLMDBCLK, 2 );
+ }
+ }
+#endif
+}
+
+
+
+/**********************
+
+ NAME : VLM_BuildServerList
+
+ DESCRIPTION :
+
+ Go through the global DLE list and create VLM entries for all the
+ servers you find.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_BuildServerList(
+Q_HEADER_PTR srv_list, // I - queue of servers
+WININFO_PTR XtraBytes ) // I
+{
+ GENERIC_DLE_PTR server_dle;
+ GENERIC_DLE_PTR temp_dle;
+ VLM_OBJECT_PTR server_vlm;
+
+ DLE_GetFirst( dle_list, &server_dle );
+
+ do {
+
+ do {
+
+ if ( DLE_GetDeviceType( server_dle ) == NOVELL_SERVER_ONLY ) {
+ break;
+ }
+
+ DLE_GetNext( &server_dle );
+
+ } while ( server_dle != NULL );
+
+ if ( server_dle != NULL ) {
+
+ temp_dle = server_dle;
+ DLE_GetNext( &server_dle );
+
+ if ( VLM_FindVLMByName( srv_list,
+ DLE_GetDeviceName( temp_dle ) ) == NULL ) {
+
+ server_vlm = VLM_CreateVLM( DLE_SizeofVolName( temp_dle ),
+ (INT16)(strlen( DLE_GetDeviceName( temp_dle ) ) * sizeof(CHAR)) );
+
+ if ( server_vlm != NULL ) {
+
+ VLM_SetName( server_vlm, DLE_GetDeviceName( temp_dle ) );
+ VLM_SetXtraBytes( server_vlm, XtraBytes );
+ DLE_GetVolName( temp_dle, server_vlm->label ) ;
+
+ EnQueueElem( srv_list, &(server_vlm->q_elem), FALSE );
+
+ // Ideally this would handle dynamic logins too.
+
+ if ( DLE_ServerLoggedIn( temp_dle ) ) {
+
+ // Attach so that we get child dle's created
+
+ VLM_FindServerChildren( server_vlm );
+ }
+ }
+ }
+ }
+
+ } while ( server_dle != NULL );
+
+ SortQueue( srv_list, VLM_VlmCompare );
+
+}
+
+/**********************
+
+ NAME : VLM_VlmCompare
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT16 VLM_VlmCompare(
+Q_ELEM_PTR e1, // I - queue element 1
+Q_ELEM_PTR e2 ) // I - queue element 2
+{
+ VLM_OBJECT_PTR vlm1, vlm2;
+ CHAR_PTR s;
+
+ vlm1 = ( VLM_OBJECT_PTR )e1->q_ptr;
+ vlm2 = ( VLM_OBJECT_PTR )e2->q_ptr;
+
+ // Always put SYS: first
+
+ s = strrchr( VLM_GetName( vlm1 ), TEXT('/') );
+
+ if ( s != NULL ) {
+
+ if ( ! stricmp( s, TEXT("/SYS:") ) ) {
+ return( (INT16)-1 );
+ }
+
+ }
+
+ s = strrchr( VLM_GetName( vlm2 ), TEXT('/') );
+
+ if ( s != NULL ) {
+
+ if ( ! stricmp( s, TEXT("/SYS:") ) ) {
+ return( (INT16)1 );
+ }
+
+ }
+
+ // sort by alphabet
+
+ return( (INT16)stricmp( VLM_GetName( vlm1 ), VLM_GetName( vlm2 ) ) );
+}
+
+
+/**********************
+
+ NAME : VLM_FindServerChildren
+
+ DESCRIPTION :
+
+ We wish to see what children exist for a given server. So do a quick
+ attach to make the children visible and build VLM structures for them.
+
+ RETURNS : number of children (volumes) found.
+
+**********************/
+
+
+INT VLM_FindServerChildren( VLM_OBJECT_PTR server_vlm )
+{
+ FSYS_HAND temp_fsh;
+ GENERIC_DLE_PTR dle;
+
+ DLE_FindByName( dle_list, server_vlm->name, ANY_DRIVE_TYPE, &dle );
+
+ if ( dle == NULL ) {
+ return( 0 );
+ }
+
+ if ( UI_AttachDrive( &temp_fsh, dle, FALSE ) ) {
+ return( 0 );
+ }
+
+ VLM_AddInServerChildren( server_vlm );
+
+ FS_DetachDLE( temp_fsh );
+
+ return( QueueCount( &server_vlm->children ) );
+}
+
+/**********************
+
+ NAME : VLM_AddInServerChildren
+
+ DESCRIPTION :
+
+ Adds VLM structures for all the Servers volumes.
+
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_AddInServerChildren(
+VLM_OBJECT_PTR parent_vlm ) // I - server vlm
+{
+ GENERIC_DLE_PTR parent_dle;
+ GENERIC_DLE_PTR dle;
+ VLM_OBJECT_PTR vlm;
+
+
+ DLE_FindByName( dle_list, VLM_GetName( parent_vlm ), ANY_DRIVE_TYPE, &parent_dle );
+
+ if ( parent_dle == NULL ) {
+ return;
+ }
+
+ DLE_GetFirstChild( parent_dle, &dle );
+
+ while ( dle != NULL ) {
+
+ if ( VLM_FindVLMByName( &VLM_GetChildren( parent_vlm ),
+ DLE_GetDeviceName( dle ) ) == NULL ) {
+
+ vlm = VLM_CreateVLM( DLE_SizeofVolName( dle ),
+ (INT16)(strlen( DLE_GetDeviceName( dle ) ) * sizeof(CHAR)) );
+
+ if ( vlm != NULL ) {
+ VLM_SetName( vlm, DLE_GetDeviceName( dle ) );
+ DLE_GetVolName( dle, vlm->label ) ;
+ DLE_IncBSDCount( dle );
+ VLM_SetParent( vlm, parent_vlm );
+ VLM_SetXtraBytes( vlm, VLM_GetXtraBytes( parent_vlm ) );
+ EnQueueElem( &VLM_GetChildren( parent_vlm ), &(vlm->q_elem), FALSE );
+ }
+ }
+
+ DLE_GetNext( &dle );
+ }
+
+ SortQueue( & VLM_GetChildren( parent_vlm ), VLM_VlmCompare );
+}
+
+/**********************
+
+ NAME : VLM_SrvSetSelect
+
+ DESCRIPTION :
+
+ RETURNS : nothing
+
+**********************/
+
+static VOID_PTR VLM_SrvSetSelect(
+VLM_OBJECT_PTR server_vlm,
+BYTE attr )
+{
+#if !defined ( OEM_MSOFT )
+ {
+ VLM_OBJECT_PTR vlm;
+ APPINFO_PTR appinfo;
+ UINT16 status;
+ FSYS_HAND temp_fsh;
+ BOOLEAN all_subdirs;
+ GENERIC_DLE_PTR server_dle;
+
+
+ all_subdirs = (BOOLEAN) CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_servers_win );
+
+ DLE_FindByName( dle_list, server_vlm->name, -1, &server_dle );
+
+ if ( server_dle == NULL ) {
+ return( NULL );
+ }
+
+ if ( QueueCount( &server_vlm->children ) == 0 ) {
+
+ if ( UI_AttachDrive( &temp_fsh, server_dle, FALSE ) ) {
+ return( NULL );
+ }
+
+ VLM_AddInServerChildren( server_vlm );
+
+ FS_DetachDLE( temp_fsh );
+ }
+
+ if ( QueueCount( &server_vlm->children ) == 0 ) {
+ return( NULL );
+ }
+
+ if ( attr ) {
+ if ( all_subdirs ) {
+ status = INFO_SELECT;
+ }
+ else {
+ status = (INFO_PARTIAL|INFO_SELECT);
+ }
+ }
+ else {
+ status = 0;
+ }
+
+ if ( (server_vlm->status & (UINT16)(INFO_PARTIAL|INFO_SELECT) ) != status ) {
+
+ server_vlm->status &= ~(INFO_PARTIAL|INFO_SELECT);
+ server_vlm->status |= status;
+
+ DLM_Update( gb_servers_win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)server_vlm, 0 );
+ }
+
+ // update the vol list if this server is the currently selected
+
+ if ( server_dle == appinfo->dle ) {
+ DLM_Update( gb_servers_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)&server_vlm->children, 0 );
+ }
+
+ // do all the volumes
+
+ vlm = VLM_GetFirstVLM( &server_vlm->children );
+
+ while ( vlm != NULL ) {
+
+ VLM_DoVolSetSelect( vlm, attr );
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+ }
+#endif
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static BYTE VLM_SrvGetSelect( VLM_OBJECT_PTR vlm )
+{
+ if ( vlm->status & INFO_SELECT ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_SrvSetTag( VLM_OBJECT_PTR vlm, BYTE attr )
+{
+
+ if ( attr ) {
+ vlm->status |= INFO_TAGGED;
+ }
+ else {
+ vlm->status &= ~INFO_TAGGED;
+ }
+ return(NULL);
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static BYTE VLM_SrvGetTag( VLM_OBJECT_PTR vlm )
+{
+ if ( INFO_TAGGED & vlm->status ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static USHORT VLM_SrvGetItemCount( Q_HEADER_PTR srv_list )
+{
+ return( QueueCount( srv_list ) );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_SrvGetFirstItem( Q_HEADER_PTR srv_list )
+{
+ return( VLM_GetFirstVLM( srv_list ) );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_SrvGetPrevItem( VLM_OBJECT_PTR vlm )
+{
+ return( VLM_GetPrevVLM( vlm ) );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_SrvGetNextItem( VLM_OBJECT_PTR vlm )
+{
+ return( VLM_GetNextVLM( vlm ) );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_SrvGetObjects( VLM_OBJECT_PTR vlm )
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ BYTE_PTR memblk;
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+ GENERIC_DLE_PTR dle;
+
+ DLE_FindByName( dle_list, vlm->name, -1, &dle );
+
+ /* malloc enough room to store info */
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( wininfo->hWndFlatList );
+
+ /* Store the number of items in the first two bytes. */
+
+ *memblk = 3;
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( vlm->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( vlm->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up Bitmap, ie. Floppy, Hard, Network. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+ DLM_ItemwId( item ) = IDRBM_SERVERDETACHED;
+ if ( dle ) {
+ if ( DLE_ServerLoggedIn( dle ) ) {
+ DLM_ItemwId( item ) = IDRBM_SERVER;
+ }
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text string to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)strlen( vlm->name );
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), vlm->name );
+
+ return( memblk );
+ }
+#else //if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ return NULL;
+ }
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static BOOLEAN VLM_SrvSetObjects(
+VLM_OBJECT_PTR vlm,
+WORD operation,
+WORD ObjectNum )
+{
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ INT16 result;
+ GENERIC_DLE_PTR dle;
+ VLM_OBJECT_PTR old_vlm;
+ VLM_OBJECT_PTR temp_vlm;
+ CHAR keyb_char;
+ BOOLEAN ret_val = FALSE;
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+
+ (void)old_vlm ;
+ (void)text ;
+ (void)dle ;
+ (void)wininfo ;
+ (void)result ;
+ (void)appinfo ;
+
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_vlm = vlm;
+
+ do {
+
+ temp_vlm = VLM_GetNextVLM( temp_vlm );
+
+ if ( temp_vlm != NULL ) {
+
+ if ( keyb_char == (CHAR)toupper( *VLM_GetName( temp_vlm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( temp_vlm ) ),
+ 0,
+ (LMHANDLE)temp_vlm );
+ vlm = temp_vlm;
+ operation = WM_DLMDOWN;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ break;
+ }
+ }
+
+ } while ( temp_vlm != NULL );
+
+ if ( ret_val == FALSE ) {
+ temp_vlm = VLM_GetFirstVLM( WMDS_GetTreeList( VLM_GetXtraBytes( vlm ) ) );
+
+ while ( temp_vlm != NULL && temp_vlm != vlm ) {
+
+ if ( keyb_char == (CHAR)toupper( *VLM_GetName( temp_vlm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( temp_vlm ) ),
+ 0,
+ (LMHANDLE)temp_vlm );
+ vlm = temp_vlm;
+ operation = WM_DLMDOWN;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ }
+
+ temp_vlm = VLM_GetNextVLM( temp_vlm );
+
+ }
+ }
+
+ if ( ret_val == FALSE ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( vlm ) ),
+ 0,
+ (LMHANDLE)vlm );
+
+ }
+ }
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if ( ( operation == WM_DLMDBCLK || operation == WM_DLMDOWN ) &&
+ ( ObjectNum >= 2 ) ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_servers_win );
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+
+ // if current server then do nothing
+
+ DLE_FindByName( dle_list, VLM_GetName( vlm ), -1, &dle );
+
+ if ( ( dle == NULL ) || ( dle == appinfo->dle ) ) {
+ return( ret_val );
+ }
+
+ if ( ( appinfo->server_fsh != NULL ) && ( appinfo->dle != NULL ) ) {
+
+ FS_DetachDLE( appinfo->server_fsh );
+ appinfo->server_fsh = NULL;
+
+ old_vlm = VLM_FindVLMByName( wininfo->pTreeList,
+ DLE_GetDeviceName( appinfo->dle ) );
+
+ DLM_Update( gb_servers_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)old_vlm, 0 );
+ }
+
+ result = FAILURE;
+
+ if ( ( operation == WM_DLMDBCLK ) ||
+ ( DLE_ServerLoggedIn( dle ) ) ) {
+
+ result = UI_AttachDrive( &appinfo->server_fsh, dle, FALSE ) ;
+ }
+
+ if ( result != SUCCESS ) {
+
+
+ RSM_StringCopy( IDS_VLMSERVERNOTLOGGEDIN, text, MAX_UI_RESOURCE_LEN );
+
+ STM_DrawText( text );
+
+ appinfo->server_fsh = NULL;
+ appinfo->dle = NULL;
+ wininfo->pFlatList = NULL;
+
+ DLM_Update( gb_servers_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)NULL, 0 );
+ return( ret_val );
+ }
+
+ // See if any new volumes have come on line.
+
+ VLM_AddInServerChildren( vlm );
+
+ STM_SetIdleText( IDS_READY );
+
+ appinfo->dle = dle;
+
+ // change pointer for volume list to this dle
+
+ wininfo->pFlatList = &VLM_GetChildren( vlm );
+
+ // update server
+
+ DLM_Update( gb_servers_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+
+ // update volume list
+
+ DLM_Update( gb_servers_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)&VLM_GetChildren( vlm ), 0 );
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ return( ret_val );
+}
+
+//************
+// VOLUMES
+//************
+
+/*****
+ In my terminology, a volume is a server volume and a disk is a mapped or
+ local dos drive. The user has tagged one or more volumes and hit the
+ select or unselect button. This function does the processing for that
+ command.
+*****/
+
+/**********************
+
+ NAME : VLM_SelectVolumes
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+VOID VLM_SelectVolumes(
+BYTE attr ) // I - select or deselect ?
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR server_vlm;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_servers_win );
+
+ if ( WM_IsFlatActive( wininfo ) ) {
+
+ // Have the display list manager update our tags for us.
+
+ DLM_UpdateTags( gb_servers_win, DLM_FLATLISTBOX );
+
+ vlm = VLM_GetFirstVLM( wininfo->pFlatList );
+
+ while ( vlm != NULL ) {
+
+ if ( vlm->status & INFO_TAGGED ) {
+
+ VLM_VolSetSelect( vlm, attr );
+ }
+ vlm = VLM_GetNextVLM( vlm );
+ }
+ }
+
+ if ( WM_IsTreeActive( wininfo ) ) {
+
+ server_vlm = VLM_GetFirstVLM( wininfo->pTreeList );
+
+ while ( server_vlm != NULL ) {
+
+ if ( server_vlm->status & INFO_TAGGED ) {
+
+ VLM_SrvSetSelect( server_vlm, attr );
+ }
+
+ server_vlm = VLM_GetNextVLM( server_vlm );
+ }
+ }
+ }
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+/**********************
+
+ NAME : VLM_VolSetSelect
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_VolSetSelect( VLM_OBJECT_PTR vlm, BYTE attr )
+{
+ // we need mark this guys parent
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ DLM_Update( gb_servers_win, DLM_FLATLISTBOX, WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ VLM_UpdateServerStatus( vlm->parent );
+
+ return( VLM_DoVolSetSelect( vlm, attr ) );
+}
+
+
+/**********************
+
+ NAME : VLM_DoVolSetSelect
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_DoVolSetSelect( VLM_OBJECT_PTR vlm, BYTE attr )
+{
+ GENERIC_DLE_PTR dle;
+ CHAR title[VLM_BUFFER_SIZE];
+ INT16 length;
+ WININFO_PTR wininfo;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse_ptr;
+ HWND win;
+ INT16 error;
+ BOOLEAN all_subdirs;
+ BE_CFG_PTR bec_config;
+ BOOLEAN open_win;
+ SLM_OBJECT_PTR slm;
+ INT16 bset_num;
+ QTC_BSET_PTR qtc_bset;
+ QTC_HEADER_PTR header;
+
+
+ all_subdirs = (BOOLEAN) CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ // change the status
+
+ if ( attr ) {
+
+ if ( all_subdirs ) {
+ vlm->status &= ~INFO_PARTIAL;
+ vlm->status |= INFO_SELECT;
+ }
+ else {
+ vlm->status |= (INFO_PARTIAL|INFO_SELECT);
+ }
+ }
+ else {
+ vlm->status &= ~(INFO_PARTIAL|INFO_SELECT);
+ }
+
+ if ( attr ) {
+ error = BSD_CreatFSE( &fse_ptr, INCLUDE,
+ (INT8_PTR)TEXT(""), (UINT16)sizeof(CHAR),
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ USE_WILD_CARD, TRUE );
+ }
+ else {
+ error = BSD_CreatFSE( &fse_ptr, EXCLUDE,
+ (INT8_PTR)TEXT(""), (UINT16)sizeof(CHAR),
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ USE_WILD_CARD, TRUE );
+ }
+
+ if ( error ) {
+ return( NULL );
+ }
+
+
+ DLE_FindByName( dle_list, vlm->name, ANY_DRIVE_TYPE, &dle );
+
+ if ( dle == NULL ) {
+ return( NULL );
+ }
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ BSD_Add( bsd_list, &bsd_ptr, bec_config,
+ NULL, dle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+ }
+
+ if ( bsd_ptr != NULL ) {
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+ }
+
+ // See if this drive has any open file display windows
+ // If we find one then all its entries will need updating
+
+ open_win = FALSE;
+ win = WM_GetNext( (HWND)NULL );
+ length = (INT16)strlen( vlm->name );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ /* Is it a directory list ? */
+
+ if ( WMDS_GetWinType( wininfo ) == WMTYPE_DISKTREE ) {
+
+ WM_GetTitle( win, title, VLM_BUFFER_SIZE );
+
+ if ( ! strnicmp( title, VLM_GetName( vlm ), length) ) {
+
+ open_win = TRUE;
+
+ if ( attr ) {
+ VLM_SubdirListManager( win, SLM_SEL_ALL );
+ if ( bsd_ptr != NULL ) {
+ VLM_MatchSLMList( wininfo, bsd_ptr, FALSE );
+ }
+ }
+ else {
+ VLM_SubdirListManager( win, SLM_SEL_NONE );
+ VLM_DeselectAll( wininfo, FALSE );
+ }
+ break;
+ }
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ return( NULL );
+}
+
+
+/*
+ Get the selection status for the Display Manager.
+*/
+/**********************
+
+ NAME : VLM_VolGetSelect
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BYTE VLM_VolGetSelect( VLM_OBJECT_PTR vlm )
+{
+ if ( vlm->status & INFO_SELECT ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/*
+ Set the tag status for the Display Manager.
+*/
+/**********************
+
+ NAME : VLM_VolSetTag
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_VolSetTag( VLM_OBJECT_PTR vlm, BYTE attr )
+{
+ if ( attr ) {
+ vlm->status |= INFO_TAGGED;
+ }
+ else {
+ vlm->status &= ~INFO_TAGGED;
+ }
+
+ return( NULL );
+}
+
+/*
+ Get the tag status for the Display Manager.
+*/
+/**********************
+
+ NAME : VLM_VolGetTag
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BYTE VLM_VolGetTag( VLM_OBJECT_PTR vlm )
+{
+ if ( INFO_TAGGED & vlm->status ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/*
+ Get the item count in our list for the Display Manager.
+*/
+/**********************
+
+ NAME : VLM_VolGetItemCount
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static USHORT VLM_VolGetItemCount( Q_HEADER_PTR vol_list )
+{
+ if ( vol_list == NULL ) {
+ return( 0 );
+ }
+ return( QueueCount(vol_list) );
+}
+
+/*
+ Return the first item for the Display Manager.
+*/
+/**********************
+
+ NAME : VLM_VolGetFirstItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_VolGetFirstItem( Q_HEADER_PTR vol_list )
+{
+ if ( vol_list == NULL ) {
+ return( NULL );
+ }
+ return( QueueHead( vol_list ) );
+}
+
+/*
+ Get the previous list item for the Display Manager.
+*/
+/**********************
+
+ NAME : VLM_VolGetPrevItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_VolGetPrevItem( VLM_OBJECT_PTR vlm )
+{
+ return( VLM_GetPrevVLM( vlm ) );
+}
+
+/*
+ Get the next list item for the Display Manager.
+*/
+/**********************
+
+ NAME : VLM_VolGetNextItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_VolGetNextItem( VLM_OBJECT_PTR vlm )
+{
+ return( VLM_GetNextVLM( vlm ) );
+}
+
+/*
+ For a given object get the information that needs to be displayed.
+*/
+/**********************
+
+ NAME : VLM_VolGetObjects
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_VolGetObjects( VLM_OBJECT_PTR vlm )
+{
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ BYTE_PTR memblk;
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+
+ /* malloc enough room to store info */
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( wininfo->hWndTreeList );
+
+ /* Store the number of items in the first two bytes. */
+
+ *memblk = 3;
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( vlm->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( vlm->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ item++;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+ DLM_ItemwId( item ) = IDRBM_SDISK;
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text string to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)strlen( VLM_GetName( vlm ) );
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), VLM_GetName( vlm ) );
+
+ return( memblk );
+ }
+# else //if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ return NULL;
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+/*
+ Handle that we got a click or a double click.
+*/
+/**********************
+
+ NAME : VLM_VolSetObjects
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BOOLEAN VLM_VolSetObjects(
+VLM_OBJECT_PTR vlm, // I
+WORD operation, // I
+WORD ObjectNum ) // I
+{
+ INT16 length;
+ VLM_OBJECT_PTR temp_vlm;
+ BOOLEAN found = FALSE;
+ HWND win;
+ WININFO_PTR wininfo;
+ GENERIC_DLE_PTR dle;
+ CHAR keyb_char;
+ CHAR title[ VLM_BUFFER_SIZE ];
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_vlm = vlm;
+
+ do {
+
+ temp_vlm = VLM_GetNextVLM( temp_vlm );
+
+ if ( temp_vlm != NULL ) {
+
+ if ( keyb_char == (CHAR)toupper( *VLM_GetName( temp_vlm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( temp_vlm ) ),
+ 0,
+ (LMHANDLE)temp_vlm );
+ return( TRUE );
+ }
+ }
+
+ } while ( temp_vlm != NULL );
+
+ temp_vlm = VLM_GetFirstVLM( WMDS_GetFlatList( VLM_GetXtraBytes( vlm ) ) );
+
+ while ( temp_vlm != NULL && temp_vlm != vlm ) {
+
+ if ( keyb_char == (CHAR)toupper( *VLM_GetName( temp_vlm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( temp_vlm ) ),
+ 0,
+ (LMHANDLE)temp_vlm );
+ return( TRUE );
+ }
+
+ temp_vlm = VLM_GetNextVLM( temp_vlm );
+
+ }
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( VLM_GetXtraBytes( vlm ) ),
+ 0,
+ (LMHANDLE)vlm );
+ return( TRUE );
+ }
+
+ if ( ( operation == WM_DLMDBCLK || operation == WM_DLMCLICK ) &&
+ ( ObjectNum >= 2 ) ) {
+
+ length = (INT16)strlen( VLM_GetName( vlm ) );
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( WMDS_GetWinType( wininfo ) == WMTYPE_DISKTREE ) {
+
+ WM_GetTitle( win, title, VLM_BUFFER_SIZE );
+
+ if ( ! strnicmp( title, VLM_GetName( vlm ), length ) ) {
+ found = TRUE;
+ WM_DocActivate( win );
+ break;
+ }
+ }
+
+ win = WM_GetNext( win );
+ }
+
+ if ( ! found ) {
+
+ WM_ShowWaitCursor( TRUE );
+
+ DLE_FindByName( dle_list, VLM_GetName( vlm ), -1, &dle );
+
+ if ( dle != NULL ) {
+
+ if ( VLM_MayWeAttachToVolume( dle ) ) {
+
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ VLM_SubdirListCreate( dle, 0, 0, 0, gb_servers_win );
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+ }
+ else {
+
+ RSM_StringCopy( IDS_VLMAFPTITLE, title, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_VLMAFPTEXT, text, MAX_UI_RESOURCE_LEN );
+
+ WM_MsgBox( title,
+ text,
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ }
+ }
+
+ WM_ShowWaitCursor( FALSE );
+ }
+
+ }
+
+ return( FALSE );
+}
diff --git a/private/utils/ntbackup/src/vlm_strt.c b/private/utils/ntbackup/src/vlm_strt.c
new file mode 100644
index 000000000..02510e1a0
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_strt.c
@@ -0,0 +1,684 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_STRT.C
+
+ Description:
+
+ This file contains the functions needed to start operations.
+
+ $Log: G:/UI/LOGFILES/VLM_STRT.C_V $
+
+ Rev 1.48.2.1 16 Jun 1994 15:32:40 STEVEN
+print to log if nothing selected
+
+ Rev 1.48.2.0 15 Mar 1994 22:54:02 STEVEN
+exclude registry files on restore-veryf
+
+ Rev 1.48 18 Jun 1993 16:50:20 CARLS
+added NtDemoChangeTape calls for NtDemo
+
+ Rev 1.47 26 Apr 1993 08:52:36 MIKEP
+Add numerous changes to fully support the font case selection
+for various file system types. Also add refresh for tapes window
+and sorting of tapes window.
+
+ Rev 1.46 21 Apr 1993 16:10:56 GLENN
+Status line now shows when deleting transferred files.
+
+ Rev 1.45 06 Apr 1993 17:54:16 GLENN
+Now changing the status line to say Verifying when verify is called during opertion.
+
+ Rev 1.44 25 Mar 1993 15:47:50 CARLS
+added RestoreSecurity in start backup for verify after
+
+ Rev 1.43 12 Mar 1993 14:42:50 CARLS
+changes for format tape
+
+ Rev 1.42 10 Mar 1993 12:49:08 CARLS
+Changes to move Format tape to the Operations menu
+
+ Rev 1.41 11 Feb 1993 16:21:04 STEVEN
+do not verify registry files
+
+ Rev 1.40 08 Feb 1993 15:28:50 CARLS
+Fixed the problem were the tape window showed a blank tape
+and the user canceled from the target backup screen,
+causing the blank tape entry to go away.
+
+ Rev 1.39 08 Feb 1993 11:24:36 CARLS
+add BSD_SetProcElemOnlyFlg to False to process security info on verify after backup
+
+ Rev 1.38 17 Nov 1992 21:22:52 DAVEV
+unicode fixes
+
+ Rev 1.37 26 Oct 1992 13:45:14 MIKEP
+fix replace on blank tape
+
+ Rev 1.36 20 Oct 1992 14:32:18 MIKEP
+changes for otc
+
+ Rev 1.35 12 Oct 1992 13:24:54 MIKEP
+cataloging a set fix
+
+ Rev 1.34 09 Oct 1992 12:57:04 MIKEP
+catalog a set changes for NT
+
+ Rev 1.33 07 Oct 1992 15:06:34 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.32 04 Oct 1992 19:43:04 DAVEV
+Unicode Awk pass
+
+ Rev 1.31 02 Sep 1992 21:13:46 CHUCKB
+Put in changes from MikeP from Microsoft.
+
+ Rev 1.30 29 Jul 1992 09:34:16 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.29 14 May 1992 18:05:40 MIKEP
+nt pass 2
+
+ Rev 1.28 06 May 1992 14:40:22 MIKEP
+unicode pass two
+
+ Rev 1.27 04 May 1992 13:40:08 MIKEP
+unicode pass 1
+
+ Rev 1.26 09 Apr 1992 08:46:18 MIKEP
+speed up lots of sets
+
+
+*****************************************************/
+
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+/**********************
+
+ NAME : VLM_StartCatalog
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+INT VLM_StartCatalog( )
+{
+ INT error = SUCCESS;
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ error = do_catalog( (UINT32)-1L, (UINT16)-1, (UINT16)-1 );
+ VLM_CatalogSync( VLM_SYNCMORE );
+ }
+
+ return( error );
+}
+
+
+/**********************
+
+ NAME : VLM_StartBackup
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+INT VLM_StartBackup( )
+{
+ BSD_PTR bsd_ptr;
+ BSD_PTR nxt_bsd_ptr;
+ INT error = SUCCESS;
+ TCHAR bset_name[ MAX_BSET_NAME_SIZE ];
+
+ /* First, verify that the tape hardware was initialized successfully */
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ VLM_RemoveUnusedBSDs( bsd_list );
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ if ( bsd_ptr == NULL ) {
+ if ( CDS_GetYesFlag ( CDS_GetCopy() ) == YESYES_FLAG ) {
+ lresprintf( LOGGING_FILE, LOG_START, FALSE );
+ lresprintf( LOGGING_FILE, LOG_ERROR, (UINT) SES_ENG_ERR, RES_BACKUP_NO_SELECTIONS );
+ lresprintf( LOGGING_FILE, LOG_END );
+ } else {
+ eresprintf( RES_BACKUP_NO_SELECTIONS );
+ }
+ return( -1 );
+ }
+
+ while ( bsd_ptr != NULL ) {
+ nxt_bsd_ptr = bsd_ptr;
+ nxt_bsd_ptr = BSD_GetNext( nxt_bsd_ptr );
+ BSD_SetTapePos( bsd_ptr, (UINT32)-1L, (UINT16)-1, (UINT16)-1 );
+ BSD_SetTHW( bsd_ptr, thw_list );
+ bsd_ptr = nxt_bsd_ptr;
+ }
+
+ /* perform backup operation */
+ gb_error_during_operation = FALSE;
+
+ error = do_backup( BACKUP_OPER );
+
+ if ( error != ABNORMAL_TERMINATION ) {
+ if ( CDS_GetAutoVerifyBackup( CDS_GetCopy() ) ) {
+
+#ifdef OS_WIN32
+ bsd_ptr = BSD_GetFirst( bsd_list );
+ while ( bsd_ptr != NULL ) {
+
+ /* process security info */
+ BSD_SetProcElemOnlyFlg( bsd_ptr, FALSE );
+ if ( BSD_GetProcSpecialFlg( bsd_ptr ) ) {
+
+ UI_AddSpecialIncOrExc( bsd_ptr, FALSE ) ;
+ BSD_SetProcSpecialFlg( bsd_ptr, FALSE );
+ }
+ BEC_SetRestoreSecurity( BSD_GetConfigData( bsd_ptr ), TRUE );
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+#endif // OS_WIN32
+
+ STM_SetIdleText ( IDS_VERIFYING );
+ do_verify( VERIFY_LAST_BACKUP_OPER );
+ }
+ BSD_ClearCurrOper( bsd_list );
+ error = SUCCESS;
+ }
+ else {
+ bsd_ptr = BSD_GetFirst( bsd_list );
+ while ( bsd_ptr != NULL ) {
+
+ /* reset the flag indicating the file was backed up */
+ BSD_ClearDelete( bsd_ptr );
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ /* if backup was canceled, remove the catalog BSD */
+ /* get name for the catalog set */
+ RSM_StringCopy( IDS_CATALOGSETNAME, bset_name, MAX_BSET_NAME_SIZE );
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while( bsd_ptr != NULL ) {
+
+ /* if this is a catalog BSD - remove from BSD list */
+ /* the Do_back routine will insert it back in the list */
+
+ /* if there was a description, check if catalog */
+ if( BSD_GetBackupDescript( bsd_ptr ) ) {
+
+ if(! strcmp( bset_name, (CHAR_PTR)BSD_GetBackupDescript( bsd_ptr ) ) ) {
+ BSD_Remove( bsd_ptr ) ;
+ break;
+ }
+ }
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+ }
+
+ /* if the user canceled the backup - don't clear the tape window */
+
+ if( error == SUCCESS ) {
+
+ // I have no idea why this was here.
+ // VLM_ClearCurrentTape( (UINT32)0 );
+
+ }
+ VLM_CatalogSync( VLM_SYNCMORE | VLM_SYNCLESS );
+ }
+
+ return( error );
+}
+
+
+
+
+/**********************
+
+ NAME : VLM_StartVerify
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+INT VLM_StartVerify( )
+{
+ INT error;
+ BSD_PTR bsd;
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ VLM_RemoveUnusedBSDs( tape_bsd_list );
+
+ bsd = BSD_GetFirst( tape_bsd_list );
+
+ if ( bsd == NULL ) {
+ eresprintf( RES_VERIFY_NO_SELECTIONS );
+ return( -1 );
+ }
+
+ if ( DM_StartVerifyBackupSet() ) {
+ error = ABORT_OPERATION;
+ }
+ else {
+ gb_error_during_operation = FALSE;
+
+ error = do_verify( VERIFY_OPER );
+ if ( error != ABNORMAL_TERMINATION ) {
+
+ BSD_ClearCurrOper( tape_bsd_list );
+ error = SUCCESS;
+ }
+ }
+
+ }
+ return( error );
+}
+
+
+
+/**********************
+
+ NAME : VLM_StartRestore
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT VLM_StartRestore( )
+{
+ INT error = SUCCESS;
+ BSD_PTR bsd;
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ VLM_RemoveUnusedBSDs( tape_bsd_list );
+
+ bsd = BSD_GetFirst( tape_bsd_list );
+
+ if ( bsd == NULL ) {
+ eresprintf( RES_RESTORE_NO_SELECTIONS );
+ return( -1 );
+ }
+
+ gb_error_during_operation = FALSE;
+
+ error = do_restore( RESTORE_OPER );
+
+ if ( error != ABNORMAL_TERMINATION ) {
+ if ( CDS_GetAutoVerifyRestore( CDS_GetCopy() ) ) {
+
+ bsd = BSD_GetFirst( tape_bsd_list );
+ while ( bsd != NULL ) {
+
+ /* reset the flag indicating the file was backed up */
+ BSD_ClearDelete( bsd );
+ if ( BSD_GetProcSpecialFlg( bsd ) ) {
+
+ UI_AddSpecialIncOrExc( bsd, FALSE ) ;
+ BSD_SetProcSpecialFlg( bsd, FALSE );
+ }
+
+ bsd = BSD_GetNext( bsd ) ;
+ }
+
+ STM_SetIdleText ( IDS_VERIFYING );
+ do_verify( VERIFY_LAST_RESTORE_OPER );
+ }
+ BSD_ClearCurrOper( tape_bsd_list );
+ error = SUCCESS;
+ }
+
+ if ( !error ) {
+ FSYS_HAND fsh = NULL ;
+ GENERIC_DLE_PTR dle ;
+ INT status = FAILURE ;
+ BSD_PTR bsd ;
+
+ bsd = BSD_GetFirst( tape_bsd_list );
+ while ( bsd != NULL ) {
+
+ dle = BSD_GetDLE( bsd ) ;
+ if ( dle ) {
+ status = FS_AttachToDLE( &fsh,
+ dle,
+ BSD_GetConfigData(bsd),
+ NULL,
+ NULL ) ;
+ }
+ if ( !status ) {
+ status = FS_EndOperationOnDLE( fsh ) ;
+ }
+
+ if ( status == LP_END_OPER_FAILED ) {
+ eresprintf_cancel( RES_ERROR_EMS_RESTART, DLE_GetDeviceName( dle ) ) ;
+ gb_error_during_operation = TRUE;
+ }
+
+ if ( fsh ) {
+ FS_DetachDLE( fsh ) ;
+ }
+
+ bsd = BSD_GetNext( bsd ) ;
+ }
+ }
+ }
+ return( error );
+}
+
+
+/**********************
+
+ NAME : VLM_StartTension
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+VOID VLM_StartTension()
+{
+ INT status;
+
+ /* display the retension message dialog */
+
+ status = WM_MessageBox( (CHAR_PTR) ID( IDS_MSGTITLE_RETENSION ),
+ (CHAR_PTR) ID( RES_RETENSION_MESSAGE ),
+ (WORD) WMMB_CONTCANCEL,
+ (WORD) WMMB_ICONEXCLAMATION,
+ (CHAR_PTR) NULL,
+ (WORD) 0,
+ (WORD) HELPID_DIALOGTENSION );
+
+ if( status == WMMB_IDCONTINUE) {
+
+ lresprintf( LOGGING_FILE, LOG_END );
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+ do_tension( TENSION_OPER );
+ }
+ }
+}
+
+
+/**********************
+
+ NAME : VLM_StartErase
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_StartErase()
+{
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ if ( DM_StartErase () ) {
+
+ lresprintf( LOGGING_FILE, LOG_END );
+
+ if ( CDS_GetEraseFlag( CDS_GetCopy() ) == ERASE_LONG ) {
+
+ if ( CDS_GetYesFlag( CDS_GetPerm() ) == YESYES_FLAG ) {
+
+ do_tension( SEC_ERASE_NO_READ_OPER );
+ }
+ else {
+ do_tension( SECURITY_ERASE_OPER );
+ }
+
+ }
+ else {
+
+ if ( CDS_GetYesFlag( CDS_GetPerm() ) == YESYES_FLAG ) {
+
+ do_tension( ERASE_NO_READ_OPER );
+ }
+ else {
+ do_tension( ERASE_OPER );
+ }
+ }
+
+ VLM_CatalogSync( VLM_SYNCLESS );
+ }
+ }
+}
+
+#ifdef OS_WIN32
+
+/**********************
+
+ NAME : VLM_StartFormat
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_StartFormat()
+{
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ if ( DM_StartFormat () ) {
+
+ lresprintf( LOGGING_FILE, LOG_END );
+
+ do_tension( FORMAT_OPER );
+ VLM_CatalogSync( VLM_SYNCLESS );
+ }
+ }
+}
+#endif // OS_WIN32
+
+
+/**********************
+
+ NAME : VLM_StartTransfer
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+INT VLM_StartTransfer( )
+{
+ BSD_PTR bsd_ptr;
+ BSD_PTR nxt_bsd_ptr;
+ INT error = SUCCESS;
+ BOOLEAN make_copy = FALSE;
+ BOOLEAN delete_flag = FALSE ;
+ TCHAR bset_name[ MAX_BSET_NAME_SIZE ];
+
+
+ /* First, verify that the tape hardware was initialized successfully */
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ VLM_RemoveUnusedBSDs( bsd_list );
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ if ( bsd_ptr == NULL ) {
+ eresprintf( RES_ARCHIVE_NO_SELECTIONS );
+ return( -1 );
+ }
+
+ while ( bsd_ptr != NULL ) {
+ nxt_bsd_ptr = bsd_ptr;
+ nxt_bsd_ptr = BSD_GetNext( nxt_bsd_ptr );
+ BSD_SetTapePos( bsd_ptr, (UINT32)-1L, (UINT16)-1, (UINT16)-1 );
+ BSD_SetTHW( bsd_ptr, thw_list );
+ bsd_ptr = nxt_bsd_ptr;
+ }
+
+ /* perform backup operation */
+ gb_error_during_operation = FALSE;
+
+ do {
+
+ error = do_backup( ARCHIVE_BACKUP_OPER );
+
+ if ( error == SUCCESS ) {
+
+ STM_SetIdleText ( IDS_VERIFYING );
+
+ error = do_verify( ARCHIVE_VERIFY_OPER );
+
+ if ( error == SUCCESS ) {
+
+ /* if the backup and the verify operation was successful */
+ /* then set the delete flag to prompt to delete files */
+
+ delete_flag = TRUE ;
+
+ /* if the YESYES flag is set - assume this is a job */
+ /* and don't ask to make another copy */
+
+ if ( CDS_GetYesFlag( CDS_GetPerm() ) == YESYES_FLAG ) {
+ make_copy = FALSE;
+ }
+ else {
+ if ( WM_MessageBox( ID( IDS_MSGTITLE_COPY ),
+ ID( RES_WAIT_AND_REPLACE_TAPE ),
+ WMMB_YESNO,
+ WMMB_ICONQUESTION,
+ ID( RES_MAKE_ANOTHER_COPY ),
+ 0, 0 ) ) {
+#ifdef OS_WIN32
+ NtDemoChangeTape( 1u ) ;
+#endif
+
+ make_copy = TRUE;
+
+ /* Reset bsd tape position values */
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while( bsd_ptr != NULL ) {
+
+ /* reset the flag indicating the file was backed up */
+ BSD_ClearDelete( bsd_ptr );
+
+ BSD_SetTapePos( bsd_ptr, (UINT32)-1, (UINT16)-1, (UINT16)-1 );
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ /* if makeing another copy, remove the catalog BSD */
+ /* get name for the catalog set */
+ RSM_StringCopy( IDS_CATALOGSETNAME, bset_name, MAX_BSET_NAME_SIZE );
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while( bsd_ptr != NULL ) {
+
+ /* if this is a catalog BSD - remove from BSD list */
+ /* the Do_back routine will insert it back in the list */
+
+ /* if there was a description, check if catalog */
+ if( BSD_GetBackupDescript( bsd_ptr ) ) {
+
+ if(! strcmp( bset_name, (CHAR_PTR)BSD_GetBackupDescript( bsd_ptr ) ) ) {
+ BSD_Remove( bsd_ptr ) ;
+ break;
+ }
+ }
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+ }
+ else {
+ make_copy = FALSE;
+ }
+ }
+ }
+ }
+ /* there was and error or user aborted, so remove the catalogs BSD */
+ else {
+
+ /* get name for the catalog set */
+ RSM_StringCopy( IDS_CATALOGSETNAME, bset_name, MAX_BSET_NAME_SIZE );
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while( bsd_ptr != NULL ) {
+
+ /* if this is a catalog BSD - remove from BSD list */
+ /* the Do_back routine will insert it back in the list */
+
+ /* if there was a description, check if catalog */
+ if( BSD_GetBackupDescript( bsd_ptr ) ) {
+
+ if(! strcmp( bset_name, (CHAR_PTR)BSD_GetBackupDescript( bsd_ptr ) ) ) {
+ BSD_Remove( bsd_ptr ) ;
+ break;
+ }
+ }
+
+ /* reset the flag indicating the file was backed up */
+ BSD_ClearDelete( bsd_ptr );
+
+ BSD_SetTapePos( bsd_ptr, (UINT32)-1, (UINT16)-1, (UINT16)-1 );
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+ }
+
+ } while ( (error == SUCCESS) && make_copy );
+
+ /* the delete flag will be set if there was a successful backup */
+ /* and verify operation */
+
+ if ( delete_flag == TRUE ) {
+
+ bsd_ptr = BSD_GetFirst( bsd_list );
+
+ while( bsd_ptr != NULL ) {
+
+ /* reset the flag indicating the file was backed up */
+ BSD_ClearDelete( bsd_ptr );
+
+ bsd_ptr = BSD_GetNext( bsd_ptr );
+ }
+
+ /* Do the delete step... */
+
+# ifndef OEM_MSOFT
+ {
+ STM_SetIdleText ( IDS_DELAFTERTRANS );
+ }
+# endif
+
+ do_delete( ARCHIVE_DELETE_OPER );
+
+ BSD_ClearCurrOper( bsd_list );
+ }
+
+ VLM_CatalogSync( VLM_SYNCMORE | VLM_SYNCLESS );
+
+ }
+
+ return( error );
+}
diff --git a/private/utils/ntbackup/src/vlm_tape.c b/private/utils/ntbackup/src/vlm_tape.c
new file mode 100644
index 000000000..c68839a7b
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_tape.c
@@ -0,0 +1,1382 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_TAPE.C
+
+ Description:
+
+ This file contains most of the code for processing the TAPES
+ window and lists.
+
+ $Log: G:/UI/LOGFILES/VLM_TAPE.C_V $
+
+ Rev 1.51 03 Aug 1993 19:47:50 MARINA
+updated param type cast
+
+ Rev 1.50 28 Jul 1993 14:10:30 MARINA
+enable c++
+
+ Rev 1.49 03 May 1993 16:15:46 MIKEP
+make current tape the focus tape.
+
+ Rev 1.48 26 Apr 1993 13:28:16 MIKEP
+Update tapes window at app start up. I broke this
+with my last checkin.
+
+ Rev 1.47 26 Apr 1993 08:52:42 MIKEP
+Add numerous changes to fully support the font case selection
+for various file system types. Also add refresh for tapes window
+and sorting of tapes window.
+
+ Rev 1.46 22 Mar 1993 20:12:42 CHUCKB
+Fixed #ifdef for next_tape functionality.
+
+ Rev 1.45 20 Jan 1993 21:38:26 MIKEP
+floppy support
+
+ Rev 1.44 17 Nov 1992 21:21:08 DAVEV
+unicode fixes
+
+ Rev 1.43 17 Nov 1992 20:01:06 MIKEP
+add unformat display
+
+ Rev 1.42 11 Nov 1992 16:37:20 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.41 01 Nov 1992 16:13:14 DAVEV
+Unicode changes
+
+ Rev 1.40 30 Oct 1992 15:46:26 GLENN
+Added Frame and MDI Doc window size and position saving and restoring.
+
+ Rev 1.39 20 Oct 1992 14:31:58 MIKEP
+changes for otc
+
+ Rev 1.38 16 Oct 1992 15:29:10 MIKEP
+Added Bitmap width and height size info to tapes window.(GLENN)
+
+ Rev 1.37 07 Oct 1992 15:06:52 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.36 04 Oct 1992 19:43:10 DAVEV
+Unicode Awk pass
+
+ Rev 1.35 02 Sep 1992 21:14:02 CHUCKB
+Put in changes from MikeP from Microsoft.
+
+ Rev 1.34 04 Aug 1992 13:02:14 GLENN
+Changed to multitape bitmap IDs.
+
+ Rev 1.33 03 Aug 1992 19:38:10 MIKEP
+multitape changes for NT
+
+ Rev 1.32 29 Jul 1992 09:50:20 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.31 20 Jul 1992 09:58:26 JOHNWT
+gas gauge display work
+
+ Rev 1.30 16 Jun 1992 16:00:08 MIKEP
+fix rentrantcy problem to tape operations
+
+ Rev 1.29 01 Jun 1992 08:40:18 MIKEP
+auto catalog fix
+
+ Rev 1.28 31 May 1992 11:12:16 MIKEP
+auto catalog changes
+
+ Rev 1.27 14 May 1992 18:05:42 MIKEP
+nt pass 2
+
+ Rev 1.26 06 May 1992 14:41:16 MIKEP
+unicode pass two
+
+ Rev 1.25 04 May 1992 13:39:56 MIKEP
+unicode pass 1
+
+ Rev 1.24 09 Apr 1992 08:46:12 MIKEP
+speed up lots of sets
+
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+// Static local function prototypes.
+
+static BYTE VLM_TapeGetSelect( TAPE_OBJECT_PTR );
+static VOID_PTR VLM_TapeSetTag( TAPE_OBJECT_PTR, BYTE );
+static BYTE VLM_TapeGetTag( TAPE_OBJECT_PTR );
+static USHORT VLM_TapeGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_TapeGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_TapeGetPrevItem( TAPE_OBJECT_PTR );
+static VOID_PTR VLM_TapeGetNextItem( TAPE_OBJECT_PTR );
+static VOID_PTR VLM_TapeGetObjects( TAPE_OBJECT_PTR );
+
+static VOID VLM_BuildTapeList( VOID );
+
+
+
+/*********************
+
+ Name: VLM_GetTapeName
+
+ Description: Get the name of a tape family.
+
+ Returns: Pointer to the tape name.
+
+**********************/
+
+CHAR_PTR VLM_GetTapeName(
+UINT32 tape_fid ) // I - tape fid to find
+{
+ TAPE_OBJECT_PTR tape;
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( TAPE_GetFID( tape ) == tape_fid ) {
+
+ return( TAPE_GetName( tape ) ); // Return what they wanted
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ return( NULL );
+}
+
+
+/*********************
+
+ Name: VLM_PartializeTape
+
+ Description:
+
+ The user has asked the catalogs to partialize a tape. Now the VLM Tapes
+ window must be partialized for this tape family also.
+
+ Returns:
+
+**********************/
+
+
+VOID VLM_PartializeTape( UINT32 tape_fid )
+{
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ HWND win;
+ BSD_PTR bsd;
+
+ if ( gb_tapes_win == (HWND)NULL ) {
+ return;
+ }
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_tapes_win );
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( TAPE_GetFID( tape ) == tape_fid ) {
+
+ // We've found the right tape, now yank all the bsets.
+
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ while ( bset != NULL ) {
+
+ // Remove any selections that have been made.
+
+ bsd = BSD_FindByTapeID( tape_bsd_list,
+ tape_fid,
+ BSET_GetBsetNum( bset ) );
+
+ if ( bsd != NULL ) {
+ BSD_Remove( bsd );
+ }
+
+ // Now make the icon partial.
+ // Tell the icon generator that there are no
+ // pieces that are fully cataloged.
+
+ bset->full_mask = 0;
+
+ VLM_AddBset( tape_fid, (UINT16)-1, BSET_GetBsetNum( bset ), NULL, TRUE );
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ break;
+ }
+
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ /*
+ Remove any windows that are open from this tape family.
+ */
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( WMDS_GetWinType( wininfo ) == WMTYPE_TAPETREE ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( appinfo->tape_fid == tape_fid ) {
+
+ WM_Destroy( win );
+ win = (HWND)NULL;
+ }
+ }
+ win = WM_GetNext( win );
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_UpdateTapes
+
+ DESCRIPTION :
+
+ Recheck all the selection status indicators on all the bsets and tapes
+ and update the tapes window.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_UpdateTapes( )
+{
+ BSD_PTR bsd;
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ UINT32 old_bset_status;
+ UINT32 new_tape_status;
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+
+ if ( wininfo != NULL ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_tapes_win );
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ new_tape_status = (UINT16)-1;
+
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ while ( bset != NULL ) {
+
+ old_bset_status = bset->status & (UINT16)(INFO_SELECT|INFO_PARTIAL);
+ bset->status &= ~( INFO_PARTIAL | INFO_SELECT );
+
+ bsd = BSD_FindByTapeID( tape_bsd_list,
+ bset->tape_fid, bset->bset_num );
+
+ if ( bsd != NULL ) { // not likely, but possible nonetheless
+
+ switch ( BSD_GetMarkStatus( bsd ) ) {
+
+ case ALL_SELECTED:
+ bset->status |= INFO_SELECT;
+ break;
+
+ case SOME_SELECTED:
+ bset->status |= (INFO_SELECT|INFO_PARTIAL);
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+ if ( new_tape_status == (UINT16)-1 ) {
+ new_tape_status = bset->status & (UINT16)(INFO_SELECT|INFO_PARTIAL);
+ }
+ else {
+
+ if ( ( new_tape_status & (INFO_SELECT|INFO_PARTIAL) ) !=
+ ( bset->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ new_tape_status |= (INFO_PARTIAL | INFO_SELECT);
+ }
+ }
+
+
+// if ( ( bset->status & INFO_SELECT ) &&
+// CDS_GetEnableStatsFlag ( CDS_GetPerm () ) ) {
+//
+// check for a non-open (displayed) bset here, if you find one -
+// this is a problem, we have a selection (most likely partial) and no
+// SLM list to match it against to get totals
+//
+// }
+
+
+ if ( tape == appinfo->open_tape ) {
+
+ if ( old_bset_status != (UINT16)(bset->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)bset, 0 );
+ }
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ if ( new_tape_status != (UINT16)(tape->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ tape->status &= ~(INFO_SELECT|INFO_PARTIAL);
+
+ if ( ! tape->fake_tape ) {
+ tape->status |= new_tape_status;
+ }
+
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)tape, 0 );
+ }
+
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ }
+
+}
+
+
+/*********************
+
+ Name: VLM_UpdateTapeStatus
+
+ Description:
+
+ Make the tape's selection box match the selection boces of its bsets.
+ Make it red if all bsets are red, clear if all bsets are clear, otherwise
+ make it gray.
+
+ Returns: nothing.
+
+**********************/
+
+
+VOID VLM_UpdateTapeStatus(
+TAPE_OBJECT_PTR tape, // I - Tape to update
+BOOLEAN UpdateScreen )
+{
+ UINT16 status = 0;
+ BSET_OBJECT_PTR bset;
+
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ if ( bset == NULL ) {
+
+ // This tape has no known bsets !, Can't happen, except fake tapes.
+ return;
+ }
+
+ if ( BSET_GetStatus( bset ) & INFO_PARTIAL ) {
+ status = 1;
+ }
+ else {
+ if ( BSET_GetStatus( bset ) & INFO_SELECT ) {
+ status = 2;
+ }
+ }
+
+ while ( ( bset != NULL ) && ( status != 1 ) ) {
+
+ if ( BSET_GetStatus( bset ) & INFO_PARTIAL ) {
+ status = 1;
+ }
+ else {
+ if ( ( BSET_GetStatus( bset ) & INFO_SELECT ) &&
+ ( status == 0 ) ) {
+ status = 1;
+ }
+ if ( ! ( BSET_GetStatus( bset ) & INFO_SELECT ) &&
+ ( status == 2 ) ) {
+ status = 1;
+ }
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ // Update tape selection status
+
+ switch ( status ) {
+ case 0:
+ status = 0;
+ break;
+ case 1:
+ status = (INFO_SELECT|INFO_PARTIAL);
+ break;
+ case 2:
+ status = INFO_SELECT;
+ break;
+ }
+
+ // Update screen
+
+ if ( ((UINT16)( TAPE_GetStatus( tape ) & (INFO_SELECT|INFO_PARTIAL) )) != status ) {
+
+ TAPE_SetStatus( tape, TAPE_GetStatus( tape ) & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+ TAPE_SetStatus( tape, TAPE_GetStatus( tape ) | status );
+
+ if ( UpdateScreen ) {
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)tape, 0 );
+ }
+ }
+}
+
+
+
+/*********************
+
+ Name: VLM_ClearAllTapeSelections
+
+ Description:
+
+ Clear all the check boxes for all the tapes, and free thier BSD's.
+
+ Returns:
+
+**********************/
+
+
+VOID VLM_ClearAllTapeSelections( )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+
+ if ( gb_tapes_win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_tapes_win );
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( TAPE_GetStatus( tape ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ TAPE_SetStatus( tape, tape->status & (UINT16)~(INFO_PARTIAL|INFO_SELECT) );
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ while ( bset != NULL ) {
+
+ if ( BSET_GetStatus( bset ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ BSET_SetStatus( bset, bset->status & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+
+ if ( tape == appinfo->open_tape ) {
+
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)bset, 0 );
+ }
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ DLM_Update( gb_tapes_win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)tape, 0 );
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+ }
+}
+
+
+/*********************
+
+ Name: VLM_RemoveTape
+
+ Description:
+
+ A tape has been removed, through catalog maintenance or overwriting
+ a tape. This function is called to remove all references to the tape from
+ the VLM area. It will close any windows that happen to be open from this
+ tape, remove any BSD's, and call the search code to delete any references
+ to this tape in the search results window.
+
+ Returns:
+
+****************/
+
+VOID VLM_RemoveTape( UINT32 tape_fid, INT16 tape_num, BOOLEAN UpdateScreen )
+{
+ BSET_OBJECT_PTR bset;
+ BSET_OBJECT_PTR temp_bset;
+ TAPE_OBJECT_PTR tape;
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ BSD_PTR bsd;
+ APPINFO_PTR temp_appinfo;
+ WININFO_PTR temp_wininfo;
+ HWND win;
+
+ // See if tapes window has been created yet !
+
+ if ( gb_tapes_win == (HWND)NULL ) {
+ return;
+ }
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_tapes_win );
+
+ // Find the right tape in list
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( TAPE_GetFID( tape ) == tape_fid ) {
+ break;
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ if ( tape == NULL ) {
+ return;
+ }
+
+ // Free each backup set that this tape had.
+
+ bset = VLM_GetFirstBSET( &TAPE_GetBsetQueue( tape ) );
+
+ while ( bset != NULL ) {
+
+ temp_bset = bset;
+
+ bset = VLM_GetNextBSET( bset );
+
+ if ( ( ( BSET_GetTapeNum( temp_bset ) <= tape_num ) &&
+ ( temp_bset->tape_num + temp_bset->num_tapes > tape_num ) ) ||
+ ( tape_num == -1 ) ) {
+
+ // Remove the bsd from the tape_bsd_list for this tape
+
+ bsd = BSD_FindByTapeID( tape_bsd_list,
+ tape_fid,
+ BSET_GetBsetNum( temp_bset ) );
+
+ if ( bsd != NULL ) {
+ BSD_Remove( bsd );
+ }
+
+ RemoveQueueElem( &TAPE_GetBsetQueue( tape ), &(temp_bset->q_elem) );
+ free( temp_bset );
+
+ }
+ }
+
+ // If any windows are open for this tape then close them
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ temp_wininfo = WM_GetInfoPtr( win );
+
+ if ( WMDS_GetWinType( temp_wininfo ) == WMTYPE_TAPETREE ) {
+
+ temp_appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( ( temp_appinfo->tape_fid == tape_fid ) &&
+ ( ( temp_appinfo->tape_num == tape_num ) ||
+ ( tape_num == -1 ) ) ) {
+
+ WM_Destroy( win );
+ win = (HWND)NULL;
+ }
+ }
+ win = WM_GetNext( win );
+ }
+
+ // See if the reference to this tape can be removed also.
+
+ if ( QueueCount( &TAPE_GetBsetQueue( tape ) ) == 0 ) {
+
+ RemoveQueueElem( WMDS_GetTreeList( wininfo ), &(tape->q_elem) );
+
+ // See if the tape being removed is the currently open one.
+
+ if ( appinfo->open_tape == tape ) {
+
+ appinfo->open_tape = VLM_GetFirstTAPE( );
+
+ if ( appinfo->open_tape != NULL ) {
+ appinfo->open_tape->status |= INFO_OPEN;
+ WMDS_SetFlatList( wininfo, &TAPE_GetBsetQueue( appinfo->open_tape ) );
+ }
+ else {
+ WMDS_SetFlatList( wininfo, NULL );
+ }
+ }
+
+ free( tape );
+ }
+
+ // Update both lists on the screen
+
+ if ( UpdateScreen ) {
+
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)WMDS_GetTreeList( wininfo ), 0 );
+
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)WMDS_GetFlatList( wininfo ), 0 );
+ }
+
+ // Remove any search results entries from this tape.
+
+ VLM_SearchRemoveSet( tape_fid, (INT16)-1 );
+}
+
+
+/**********************
+
+ NAME : VLM_GetFirstTAPE
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+TAPE_OBJECT_PTR VLM_GetFirstTAPE( )
+{
+ Q_ELEM_PTR q_elem_ptr;
+ WININFO_PTR wininfo;
+
+ if ( gb_tapes_win == (HWND)NULL ) {
+ return( NULL );
+ }
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+
+ q_elem_ptr = QueueHead( WMDS_GetTreeList( wininfo ) );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( TAPE_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+ return( NULL );
+}
+
+
+/**********************
+
+ NAME : VLM_GetNextTAPE
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+TAPE_OBJECT_PTR VLM_GetNextTAPE( TAPE_OBJECT_PTR tape_ptr )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueNext( &(tape_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( TAPE_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+ return( NULL );
+}
+
+/**********************
+
+ NAME : VLM_GetPrevTAPE
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+TAPE_OBJECT_PTR VLM_GetPrevTAPE( TAPE_OBJECT_PTR tape_ptr )
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueuePrev( &(tape_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( TAPE_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+ return( NULL );
+}
+
+/**********************
+
+ NAME : VLM_CreateTAPE
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+TAPE_OBJECT_PTR VLM_CreateTAPE( INT16 name_size )
+{
+ TAPE_OBJECT_PTR tape;
+
+ tape = ( TAPE_OBJECT_PTR )malloc( sizeof(TAPE_OBJECT) + name_size );
+
+ if ( tape != NULL ) {
+ InitQueue( &tape->bset_list );
+ tape->name = (CHAR_PTR)(((INT8_PTR)tape) + sizeof(TAPE_OBJECT));
+ tape->q_elem.q_ptr = tape;
+ }
+
+ return( tape );
+}
+
+
+
+/**********************
+
+ NAME : VLM_BuildTapeList
+
+ DESCRIPTION :
+
+ The app has just started and we need to initialize the tape/bset list
+ by asking the catalogs what tapes/bsets they know about.
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_BuildTapeList( )
+{
+ QTC_TAPE_PTR tape;
+ QTC_BSET_PTR bset;
+
+ // Ask the catalogs for a list of tapes and bsets
+
+ tape = QTC_GetFirstTape();
+
+ while ( tape != NULL ) {
+
+ bset = QTC_GetFirstBset( tape );
+
+ while ( bset != NULL ) {
+
+ VLM_AddBset( bset->tape_fid,
+ (INT16)bset->tape_seq_num,
+ (INT16)bset->bset_num,
+ bset, FALSE );
+
+ bset = QTC_GetNextBset( bset );
+ }
+
+ tape = QTC_GetNextTape( tape );
+ }
+}
+
+/**********************
+
+ NAME : VLM_TapesListCreate
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+BOOLEAN VLM_TapesListCreate( )
+{
+ DLM_INIT tree_dlm;
+ DLM_INIT flat_dlm;
+ Q_HEADER_PTR tape_list;
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ INT nWidth;
+ INT nHeight;
+ CDS_PTR pCDS = CDS_GetPerm ();
+
+
+ appinfo = ( APPINFO_PTR )calloc( sizeof( APPINFO ), 1 );
+ wininfo = (WININFO_PTR)calloc( sizeof(WININFO), 1 );
+
+ // initialize tape list queue
+
+ tape_list = (Q_HEADER_PTR)calloc( sizeof(Q_HEADER), 1 );
+
+ if ( tape_list == NULL ) {
+ return( FAILURE );
+ }
+
+ InitQueue( tape_list );
+
+ // Fill in wininfo data structure.
+
+ WMDS_SetWinType ( wininfo, WMTYPE_TAPES );
+ WMDS_SetCursor ( wininfo, RSM_CursorLoad( IDRC_HSLIDER ) );
+ WMDS_SetDragCursor ( wininfo, 0 );
+ WMDS_SetIcon ( wininfo, RSM_IconLoad( IDRI_TAPES ) );
+ WMDS_SetWinHelpID ( wininfo, 0 );
+ WMDS_SetStatusLineID ( wininfo, 0 );
+ WMDS_SetRibbonState ( wininfo, 0 );
+ WMDS_SetMenuState ( wininfo, 0 );
+ WMDS_SetRibbon ( wininfo, NULL );
+ WMDS_SetTreeList ( wininfo, tape_list );
+ WMDS_SetFlatList ( wininfo, NULL );
+ WMDS_SetTreeDisp ( wininfo, NULL );
+ WMDS_SetFlatDisp ( wininfo, NULL );
+ WMDS_SetAppInfo ( wininfo, appinfo );
+ WMDS_SetSliderPos ( wininfo, CDS_GetTapeInfo ( pCDS ).nSliderPos );
+
+ // Fill in and init the display list structure.
+
+ DLM_ListBoxType( &tree_dlm, DLM_TREELISTBOX );
+ DLM_Mode( &tree_dlm, DLM_HIERARCHICAL );
+ DLM_Display( &tree_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &tree_dlm, tape_list );
+ DLM_TextFont( &tree_dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &tree_dlm, VLM_TapeGetItemCount );
+ DLM_GetFirstItem( &tree_dlm, VLM_TapeGetFirstItem );
+ DLM_GetNext( &tree_dlm, VLM_TapeGetNextItem );
+ DLM_GetPrev( &tree_dlm, VLM_TapeGetPrevItem );
+ DLM_GetTag( &tree_dlm, VLM_TapeGetTag );
+ DLM_SetTag( &tree_dlm, VLM_TapeSetTag );
+ DLM_GetSelect( &tree_dlm, VLM_TapeGetSelect );
+ DLM_SetSelect( &tree_dlm, VLM_TapeSetSelect );
+ DLM_GetObjects( &tree_dlm, VLM_TapeGetObjects );
+ DLM_SetObjects( &tree_dlm, VLM_TapeSetObjects );
+ DLM_SSetItemFocus( &tree_dlm, NULL );
+ DLM_MaxNumObjects( &tree_dlm, 6 );
+
+ DLM_DispListInit( wininfo, &tree_dlm );
+
+ if ( ! RSM_GetBitmapSize( IDRBM_TAPES, ( LPINT )&nWidth, ( LPINT )&nHeight ) ) {
+
+ DLM_SetBitMapWidth ( WMDS_GetTreeDisp ( wininfo ), (USHORT) nWidth ) ;
+ DLM_SetBitMapHeight( WMDS_GetTreeDisp ( wininfo ), (USHORT) nHeight ) ;
+
+ }
+
+ VLM_BsetFillInDLM( &flat_dlm );
+
+ DLM_DispListInit( wininfo, &flat_dlm );
+
+ if ( ! RSM_GetBitmapSize( IDRBM_BSET, ( LPINT )&nWidth, ( LPINT )&nHeight ) ) {
+
+ DLM_SetBitMapWidth ( WMDS_GetFlatDisp ( wininfo ), (USHORT) nWidth ) ;
+ DLM_SetBitMapHeight( WMDS_GetFlatDisp ( wininfo ), (USHORT) nHeight ) ;
+
+ }
+
+ // open a new window
+
+ RSM_StringCopy( IDS_VLMTAPETITLE, title, MAX_UI_RESOURCE_LEN );
+
+ gb_tapes_win = WM_Create( (WORD)(WM_MDIPRIMARY | WM_TREELIST |
+ WM_MIN |
+ WM_FLATLISTSC | (WORD)CDS_GetTapeInfo ( pCDS ).nSize),
+ title,
+ NULL,
+ (INT)CDS_GetTapeInfo ( pCDS ).x,
+ (INT)CDS_GetTapeInfo ( pCDS ).y,
+ (INT)CDS_GetTapeInfo ( pCDS ).cx,
+ (INT)CDS_GetTapeInfo ( pCDS ).cy,
+ wininfo );
+
+
+ if ( gb_tapes_win == (HWND)NULL ) {
+ return( FAILURE );
+ }
+
+ appinfo->win = gb_tapes_win;
+ appinfo->open_tape = NULL;
+
+ DLM_DispListProc( wininfo->hWndTreeList, 0, NULL );
+ DLM_DispListProc( wininfo->hWndFlatList, 0, NULL );
+
+ // You can't add the new bsets until the window is created.
+
+ VLM_BuildTapeList( );
+
+ DLM_Update( gb_tapes_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pTreeList, 0 );
+
+ DLM_Update( gb_tapes_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pFlatList, 0 );
+
+ // Set the anchor item.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)appinfo->open_tape );
+
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME : VLM_TapeSetSelect
+
+ DESCRIPTION :
+
+ Callback function for Display Manager. To set select status of drive.
+
+ RETURNS :
+
+**********************/
+
+VOID_PTR VLM_TapeSetSelect( TAPE_OBJECT_PTR tape, BYTE attr )
+{
+ BSET_OBJECT_PTR bset;
+
+ // Check to see if the user tried to select a "BLANK" or "FOREIGN" tape.
+
+ if ( tape->fake_tape ) {
+ return( NULL );
+ }
+
+ // Add code to backup up this whole tape here
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ if ( attr ) {
+
+ if ( PSWD_CheckForPassword( bset->tape_fid, bset->bset_num ) ) {
+ break;
+ }
+ }
+
+ VLM_BsetSetSelect( bset, attr );
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ // Update the search window
+
+ VLM_UpdateSearchSelections( tape->tape_fid, (INT16)-1 );
+ return ( NULL ) ;
+
+}
+
+/**********************
+
+ NAME : VLM_TapeGetSelect
+
+ DESCRIPTION :
+
+ Get the selection status for the Display Manager.
+
+ RETURNS :
+
+**********************/
+
+static BYTE VLM_TapeGetSelect( TAPE_OBJECT_PTR tape )
+{
+ if ( tape->status & INFO_SELECT ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_TapeSetTag( TAPE_OBJECT_PTR tape, BYTE attr )
+{
+ if ( attr ) {
+ tape->status |= INFO_TAGGED;
+ }
+ else {
+ tape->status &= ~INFO_TAGGED;
+ }
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BYTE VLM_TapeGetTag( TAPE_OBJECT_PTR tape )
+{
+ if ( INFO_TAGGED & tape->status ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static USHORT VLM_TapeGetItemCount( Q_HEADER_PTR tape_list )
+{
+ return( QueueCount( tape_list ) );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_TapeGetFirstItem( Q_HEADER_PTR tape_list )
+{
+ DBG_UNREFERENCED_PARAMETER (tape_list);
+
+ return( (VOID_PTR)VLM_GetFirstTAPE( ) );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_TapeGetPrevItem( TAPE_OBJECT_PTR tape )
+{
+ tape = VLM_GetPrevTAPE( tape );
+
+ return( (VOID_PTR)tape );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_TapeGetNextItem( TAPE_OBJECT_PTR tape )
+{
+ tape = VLM_GetNextTAPE( tape );
+
+ return( (VOID_PTR)tape );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_TapeGetObjects( TAPE_OBJECT_PTR tape )
+{
+ BYTE_PTR memblk;
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+
+ /* malloc enough room to store info */
+
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( wininfo->hWndTreeList );
+
+ /* Store the number of items in the first two bytes. */
+
+ *memblk = 3;
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( tape->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( tape->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up Bitmap, ie. Floppy, Hard, Network. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+
+
+ if ( TAPE_GetIsFloppy( tape ) ) {
+ if ( tape->current ) {
+ if ( TAPE_GetMultiTape( tape ) ) {
+ DLM_ItemwId( item ) = IDRBM_FLOPPYSINDRIVE;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_FLOPPYINDRIVE;
+ }
+ }
+ else {
+ if ( TAPE_GetMultiTape( tape ) ) {
+ DLM_ItemwId( item ) = IDRBM_FLOPPYS;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_FLOPPY;
+ }
+ }
+ }
+ else {
+ if ( tape->current ) {
+ if ( TAPE_GetMultiTape( tape ) ) {
+ DLM_ItemwId( item ) = IDRBM_TAPESINDRIVE;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_TAPEINDRIVE;
+ }
+ }
+ else {
+ if ( TAPE_GetMultiTape( tape ) ) {
+ DLM_ItemwId( item ) = IDRBM_TAPES;
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_TAPE;
+ }
+ }
+ }
+
+
+
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text string to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (UINT8)(strlen( tape->name ) + 1);
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)tape->name);
+
+ return( memblk );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+BOOLEAN VLM_TapeSetObjects(
+TAPE_OBJECT_PTR tape,
+WORD operation,
+WORD ObjectNum )
+{
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ TAPE_OBJECT_PTR temp_tape;
+ CHAR keyb_char;
+ BOOLEAN ret_val = FALSE;
+
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_tape = tape;
+
+ do {
+
+ temp_tape = VLM_GetNextTAPE( temp_tape );
+
+ if ( temp_tape != NULL ) {
+
+ if ( keyb_char == (CHAR)toupper( *TAPE_GetName( temp_tape ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( TAPE_GetXtraBytes( temp_tape ) ),
+ 0,
+ (LMHANDLE)temp_tape );
+ operation = WM_DLMDBCLK;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ break;
+ }
+ }
+
+ } while ( temp_tape != NULL );
+
+ temp_tape = VLM_GetFirstTAPE( );
+
+ while ( temp_tape != NULL && temp_tape != tape && ret_val != TRUE ) {
+
+ if ( keyb_char == (CHAR)toupper( *TAPE_GetName( temp_tape ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( TAPE_GetXtraBytes( temp_tape ) ),
+ 0,
+ (LMHANDLE)temp_tape );
+ operation = WM_DLMDOWN;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ break;
+ }
+
+ temp_tape = VLM_GetNextTAPE( temp_tape );
+ }
+
+ if ( ret_val != TRUE ) {
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( TAPE_GetXtraBytes( tape ) ),
+ 0,
+ (LMHANDLE)tape );
+ }
+ }
+
+ if ( ( operation == WM_DLMDBCLK || operation == WM_DLMDOWN ) &&
+ ( ObjectNum >= 2 ) ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( gb_tapes_win );
+ wininfo = WM_GetInfoPtr( gb_tapes_win );
+
+ if ( tape != appinfo->open_tape ) {
+
+ if ( appinfo->open_tape != NULL ) {
+ appinfo->open_tape->status &= ~INFO_OPEN;
+ DLM_Update( gb_tapes_win, DLM_TREELISTBOX, WM_DLMUPDATEITEM,
+ (LMHANDLE)appinfo->open_tape, 0 );
+ }
+ appinfo->open_tape = tape;
+ tape->status |= INFO_OPEN;
+
+ DLM_Update( gb_tapes_win, DLM_TREELISTBOX, WM_DLMUPDATEITEM,
+ (LMHANDLE)appinfo->open_tape, 0 );
+
+ wininfo->pFlatList = &tape->bset_list;
+
+ DLM_Update( gb_tapes_win, DLM_FLATLISTBOX, WM_DLMUPDATELIST,
+ (LMHANDLE)&tape->bset_list, 0 );
+ }
+
+ if ( ( operation == WM_DLMDBCLK ) && ( TAPE_GetCurrent( tape ) ) &&
+ ( ! tape->fake_tape ) ) {
+
+# if !defined( OS_WIN32 )
+ if ( ! MUI_DisableOperations( IDM_OPERATIONSCATALOG ) ) {
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ DM_StartNextSet( );
+ }
+
+ MUI_EnableOperations( IDM_OPERATIONSCATALOG );
+ }
+# else
+ if ( ! MUI_DisableOperations( 0 ) ) {
+
+ if ( ! HWC_TapeHWProblem( bsd_list ) ) {
+
+ STM_SetIdleText( IDS_CATALOGING );
+
+ VLM_StartCatalog( );
+
+ STM_SetIdleText( IDS_READY );
+
+ MUI_EnableOperations( 0 );
+ }
+ }
+# endif
+ }
+ }
+
+ return( ret_val );
+}
+
diff --git a/private/utils/ntbackup/src/vlm_tree.c b/private/utils/ntbackup/src/vlm_tree.c
new file mode 100644
index 000000000..fb05d5671
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_tree.c
@@ -0,0 +1,3830 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_TREE.C
+
+ Description:
+ This code handles the hierarchical directory list and processes most of
+ the commands sent to it. The same code is used for DISK and TAPE trees.
+
+ $Log: G:\ui\logfiles\vlm_tree.c_v $
+
+ Rev 1.75.1.5 21 Mar 1994 12:42:00 STEVEN
+change title from device error to something better
+
+ Rev 1.75.1.4 25 Jan 1994 08:41:30 MIKEP
+fix warnings in orcas
+
+ Rev 1.75.1.3 14 Jan 1994 14:36:34 MIKEP
+fix refresh and up arrow display
+
+ Rev 1.75.1.2 14 Dec 1993 15:25:10 GREGG
+Go deeper!!!
+
+ Rev 1.75.1.1 08 Dec 1993 10:50:46 MikeP
+very deep path support
+
+ Rev 1.75 18 Aug 1993 15:00:26 STEVEN
+fix unicode bug
+
+ Rev 1.74 28 Jul 1993 15:00:24 MARINA
+enable c++
+
+ Rev 1.73 27 Jul 1993 23:20:28 MIKEP
+fix access denied handling
+
+ Rev 1.72 24 Jul 1993 15:18:14 GLENN
+Fixed list creation type.
+
+ Rev 1.71 23 Jul 1993 17:21:36 MIKEP
+fix ; missing
+
+ Rev 1.70 23 Jul 1993 15:41:08 MIKEP
+handle error return codes from file system.
+
+*****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// functions local to this source file
+
+static INT VLM_BuildDirList( Q_HEADER_PTR, WININFO_PTR );
+static VOID VLM_BuildTapeDirList( Q_HEADER_PTR, UINT32, INT16, WININFO_PTR );
+static VOID VLM_InsertTapeSLM( Q_HEADER_PTR, SLM_OBJECT_PTR, SLM_OBJECT_PTR );
+static VOID VLM_InsertDiskSLM( Q_HEADER_PTR, SLM_OBJECT_PTR, SLM_OBJECT_PTR, SLM_OBJECT_PTR );
+static CHAR_PTR VLM_ReplaceEntry( CHAR_PTR, INT *, CHAR_PTR, INT );
+static INT VLM_MatchSLM( SLM_OBJECT_PTR, BSD_PTR );
+
+// Display manager call backs
+
+static VOID_PTR VLM_SlmSetSelect( SLM_OBJECT_PTR, BYTE );
+static BYTE VLM_SlmGetSelect( SLM_OBJECT_PTR );
+static VOID_PTR VLM_SlmSetTag( SLM_OBJECT_PTR, BYTE );
+static BYTE VLM_SlmGetTag( SLM_OBJECT_PTR );
+static USHORT VLM_SlmGetItemCount( Q_HEADER_PTR );
+static VOID_PTR VLM_SlmGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR VLM_SlmGetPrevItem( SLM_OBJECT_PTR );
+static VOID_PTR VLM_SlmGetNextItem( SLM_OBJECT_PTR );
+static VOID_PTR VLM_SlmGetObjects( SLM_OBJECT_PTR );
+static BOOLEAN VLM_SlmSetObjects( SLM_OBJECT_PTR, WORD, WORD );
+
+
+
+
+
+/**********************
+
+ NAME : VLM_PrevBrotherDir
+
+ DESCRIPTION :
+
+ User hit CTRL-Up Arrow, go to previous brother.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_PrevBrotherDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ // Get the active directory slm.
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ // Try to find a previous brother and make him active directory.
+
+ new_slm = VLM_GetPrevSLM( old_slm );
+
+ while ( new_slm != NULL ) {
+
+ if ( SLM_GetLevel( new_slm ) < SLM_GetLevel( old_slm ) ) {
+
+ // No previous brother.
+ break;
+ }
+
+ if ( SLM_GetLevel( new_slm ) == SLM_GetLevel( old_slm ) ) {
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ // Fake a single click call to make this guy active.
+ VLM_SlmSetObjects( new_slm, WM_DLMDOWN, 2 );
+ break;
+ }
+
+ new_slm = VLM_GetPrevSLM( new_slm );
+ }
+
+}
+/**********************
+
+ NAME : VLM_NextBrotherDir
+
+ DESCRIPTION :
+
+ User hit Ctrl-Down Arrow. Go to next brother down the tree.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_NextBrotherDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ // get the active directory slm.
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ // Get his next brother.
+
+ new_slm = old_slm->next_brother;
+
+ if ( new_slm != NULL ) {
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ // Make him the active item.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ // Fake a single click message to myself.
+
+ VLM_SlmSetObjects( new_slm, WM_DLMDOWN, 2 );
+ }
+
+}
+
+/**********************
+
+ NAME : VLM_DownOneDir
+
+ DESCRIPTION :
+
+ Move down the tree one level deeper to the active directories first
+ child, if there is one.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_DownOneDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ SLM_OBJECT_PTR temp_slm;
+ Q_HEADER_PTR slm_list;
+ WININFO_PTR wininfo;
+ INT count = 0;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ // Get active directory slm.
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ if ( ! ( SLM_GetStatus( old_slm ) & INFO_SUBS ) ) {
+
+ // The guy has no subs.
+ return;
+ }
+
+ WM_ShowWaitCursor( TRUE );
+
+ // check to make sure this dir has been blown out
+
+ VLM_BlowOutDir( old_slm );
+
+ old_slm->status |= INFO_EXPAND;
+
+ // now set the subdirs to DISPLAY
+
+ temp_slm = VLM_GetNextSLM( old_slm );
+
+ while ( temp_slm &&
+ ( temp_slm->level == old_slm->level + 1 ) ) {
+
+ if ( ! ( temp_slm->status & INFO_DISPLAY ) ) {
+
+ count++;
+ temp_slm->status |= INFO_DISPLAY;
+ }
+
+ temp_slm = temp_slm->next_brother;
+ }
+
+ STM_DrawIdle();
+
+ if ( count ) {
+ VLM_UpdateBrothers( slm_list );
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMADDITEMS,
+ (LMHANDLE)old_slm, (USHORT)count );
+ }
+
+ WM_ShowWaitCursor( FALSE );
+
+ // Now make the first child active.
+
+ new_slm = VLM_GetNextSLM( old_slm );
+
+ while ( new_slm != NULL ) {
+
+ if ( SLM_GetLevel( new_slm ) <= SLM_GetLevel( old_slm ) ) {
+ break;
+ }
+
+ if ( SLM_GetLevel( new_slm ) == SLM_GetLevel( old_slm ) + 1 ) {
+
+ // We've found the right one.
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ // Fake a single click message to myself.
+
+ VLM_SlmSetObjects( new_slm, WM_DLMDOWN, 2 );
+ break;
+ }
+
+ new_slm = VLM_GetNextSLM( new_slm );
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_BlowOutDir
+
+ DESCRIPTION :
+
+ Blow out a dir without displaying it.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_BlowOutDir( SLM_OBJECT_PTR slm )
+{
+ WININFO_PTR wininfo;
+ CHAR *new_path;
+
+
+ // if he has no subs or he has already been blown-out, return
+
+ if ( ( ! ( SLM_GetStatus( slm ) & INFO_SUBS ) ) ||
+ ( SLM_GetStatus( slm ) & INFO_EXPAND ) ||
+ ( SLM_GetStatus( slm ) & INFO_VALID ) ) {
+ return;
+ }
+
+ wininfo = SLM_GetXtraBytes( slm );
+
+ new_path = VLM_BuildPath( slm );
+
+ if ( VLM_CheckForChildren( WMDS_GetTreeList( wininfo ),
+ slm,
+ new_path,
+ 1, // <- depth to look
+ FALSE) ) {
+
+ slm->status |= INFO_SUBS;
+ }
+
+ slm->status |= INFO_VALID;
+
+ free( new_path );
+}
+
+
+/**********************
+
+ NAME : VLM_UpOneDir
+
+ DESCRIPTION :
+
+ Make the parent of the active directory the active directory.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID VLM_UpOneDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ new_slm = VLM_GetPrevSLM( old_slm );
+
+ while ( new_slm != NULL ) {
+
+ if ( SLM_GetLevel( new_slm ) == SLM_GetLevel( old_slm ) - 1 ) {
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ VLM_SlmSetObjects( new_slm, WM_DLMDOWN, 2 );
+ break;
+ }
+
+ new_slm = VLM_GetPrevSLM( new_slm );
+ }
+
+}
+
+
+
+/**********************
+
+ NAME : VLM_ExpandTree
+
+ DESCRIPTION :
+
+ Blow out the whole tree of subdirectories.
+ A fairly simple process, go through the list and mark everything as
+ displayed, expanded, and valid. Of course any ~valid items will need
+ to be checked for child subdirectories.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_ExpandTree( HWND win )
+{
+
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR focus_slm;
+ WININFO_PTR wininfo;
+ CHAR *path;
+
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( ( WMDS_GetWinType( wininfo ) != WMTYPE_DISKTREE ) &&
+ ( WMDS_GetWinType( wininfo ) != WMTYPE_TAPETREE ) ) {
+
+ // The menu screwed up, we shouldn't have been called.
+
+ return;
+ }
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ while ( slm != NULL ) {
+
+ // Do branch processing.
+
+ do {
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_VALID ) ) {
+
+ path = VLM_BuildPath( slm );
+
+ if ( VLM_CheckForChildren( slm_list, slm,
+ path,
+ 1, FALSE ) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SUBS );
+ }
+
+ free( path );
+ }
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)(INFO_DISPLAY | INFO_EXPAND | INFO_VALID) );
+
+ slm = VLM_GetNextSLM( slm );
+
+ } while ( slm != NULL && SLM_GetLevel( slm ) > 1 );
+
+ // Find next level 1
+
+ while ( slm && ( SLM_GetLevel ( slm ) != 1 ) ) {
+ slm = VLM_GetNextSLM( slm );
+ }
+ }
+
+ STM_SetIdleText( IDS_READY );
+
+ // Update where the lines go down the left side of screen
+
+ VLM_UpdateBrothers( slm_list );
+
+ // Update the directory window display
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ), 0, (LMHANDLE)focus_slm );
+
+ return;
+
+}
+
+
+/**********************
+
+ NAME : VLM_CollapseBranch
+
+ DESCRIPTION :
+
+ Collapse a single branch on the tree and undisplay it.
+ Until you hit a brother at the same level or the end of the list, mark
+ all items as undisplayed and unexpanded.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_CollapseBranch( HWND win )
+{
+ INT level;
+ WININFO_PTR wininfo;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR focus_slm;
+
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( ( WMDS_GetWinType( wininfo ) != WMTYPE_DISKTREE ) &&
+ ( WMDS_GetWinType( wininfo ) != WMTYPE_TAPETREE )
+ ) {
+
+ // The menu screwed up, we shouldn't have been called.
+
+ return;
+ }
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ slm = focus_slm;
+
+ if ( slm == NULL ) {
+ return;
+ }
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_EXPAND ) ) {
+ return;
+ }
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~INFO_EXPAND );
+
+ level = SLM_GetLevel( slm );
+
+ slm = VLM_GetNextSLM( slm );
+
+ if ( slm != NULL ) {
+
+ do {
+
+ if ( SLM_GetLevel( slm ) <= level ) {
+ break;
+ }
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~(INFO_DISPLAY | INFO_EXPAND) );
+
+ slm = VLM_GetNextSLM( slm );
+
+ } while ( slm != NULL );
+ }
+
+ // Redisplay the new list on the screen
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ), 0, (LMHANDLE)focus_slm );
+}
+
+/**********************
+
+ NAME : VLM_ExpandBranch
+
+ DESCRIPTION :
+
+ Display an entire branch on a tree, after finding any children that
+ we don't know about yet. Stop the process when you hit a brother
+ at the same level or the end of the list.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_ExpandBranch( HWND win )
+{
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR focus_slm;
+ WININFO_PTR wininfo;
+ CHAR *path;
+ INT level;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( ( WMDS_GetWinType( wininfo ) != WMTYPE_DISKTREE ) &&
+ ( WMDS_GetWinType( wininfo ) != WMTYPE_TAPETREE )
+ ) {
+
+ // The menu screwed up, we shouldn't have been called.
+
+ return;
+ }
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ // Look for the tagged directory
+
+ slm = focus_slm;
+
+ if ( slm == NULL ) { // This should never happen !
+ return;
+ }
+
+ level = SLM_GetLevel( slm ); // Save the level to stop at
+
+ WM_ShowWaitCursor( TRUE );
+
+ do {
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_VALID ) ) {
+
+ path = VLM_BuildPath( slm );
+
+ if ( VLM_CheckForChildren( slm_list, slm,
+ path,
+ 10000, FALSE ) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SUBS );
+ }
+
+ free( path );
+ }
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)(INFO_DISPLAY | INFO_EXPAND | INFO_VALID) );
+
+ slm = VLM_GetNextSLM( slm );
+
+ } while ( slm != NULL && SLM_GetLevel( slm ) > level );
+
+ // Update where the lines on the screen go for subdirectories
+
+ VLM_UpdateBrothers( slm_list );
+
+ WM_ShowWaitCursor( FALSE );
+
+ // Update the screen
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ), 0, (LMHANDLE)focus_slm );
+
+ STM_SetIdleText( IDS_READY );
+}
+
+/**********************
+
+ NAME : VLM_ExpandOne
+
+ DESCRIPTION :
+
+ Expand current branch one level deeper.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_ExpandOne( HWND win )
+{
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR focus_slm;
+ WININFO_PTR wininfo;
+ CHAR *path;
+ INT level;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( ( WMDS_GetWinType( wininfo ) != WMTYPE_DISKTREE ) &&
+ ( WMDS_GetWinType( wininfo ) != WMTYPE_TAPETREE )
+ ) {
+
+ // The menu screwed up, we shouldn't have been called.
+
+ return;
+ }
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ // look for current branch
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ slm = focus_slm;
+
+ if ( slm == NULL ) {
+ return;
+ }
+ // Is it already expanded ?
+
+ if ( SLM_GetStatus( slm ) & INFO_EXPAND ) {
+ return;
+ }
+
+ // Expand it
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_EXPAND );
+
+ level = SLM_GetLevel( slm ); // Save starting/stopping level
+
+ WM_ShowWaitCursor( TRUE );
+
+ do {
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_VALID ) ) {
+
+ if ( ( SLM_GetLevel( slm ) <= level + 1 ) ) {
+
+ path = VLM_BuildPath( slm );
+
+ if ( VLM_CheckForChildren( slm_list, slm,
+ path,
+ 1, // <- depth to look
+ FALSE ) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SUBS );
+ }
+
+ free( path );
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_VALID );
+ }
+ }
+
+ if ( SLM_GetLevel( slm ) == level + 1 ) {
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_DISPLAY );
+ }
+
+ slm = VLM_GetNextSLM( slm );
+
+ } while ( slm != NULL && SLM_GetLevel( slm ) > level );
+
+ // Update the lines again
+
+ VLM_UpdateBrothers( slm_list );
+
+ // Update the actual screen display
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ), 0, (LMHANDLE)focus_slm );
+
+ STM_SetIdleText( IDS_READY );
+ WM_ShowWaitCursor( FALSE );
+}
+
+/**********************
+
+ NAME : VLM_SelectTree
+
+ DESCRIPTION :
+
+ The user has selected one or more files and directories that were
+ displayed in a disk or tape tree window. And then he hit the select
+ or deselect button. This function does the work.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_SelectTree(
+HWND win, // I - Tree window
+BYTE attr ) // I - select or deselect ?
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ // See which side of the window was active.
+
+ if ( WM_IsFlatActive( wininfo ) ) {
+
+ VLM_SelectFiles( win, attr );
+ }
+
+ if ( WM_IsTreeActive( wininfo ) ) {
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ VLM_SlmSetSelect( appinfo->open_slm, attr );
+ }
+}
+
+
+/**********************
+
+ NAME : VLM_ClearAllTreeSelections
+
+ DESCRIPTION :
+
+ Run through all the windows clearing all the checkboxes in TREE
+ windows.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_ClearAllTreeSelections( )
+{
+ HWND win;
+ WININFO_PTR wininfo;
+
+ win = WM_GetNext( (HWND) NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( ( WMDS_GetWinType( wininfo ) == WMTYPE_DISKTREE ) ||
+ ( WMDS_GetWinType( wininfo ) == WMTYPE_TAPETREE ) ) {
+
+ VLM_DeselectAll( wininfo, TRUE );
+
+ }
+
+ win = WM_GetNext( win );
+ }
+
+}
+
+/***************************************************
+
+ Name: VLM_GetFirstSLM
+
+ Description:
+
+ A function to return the first slm entry from an slm queue.
+ Which must ALWAYS be the root.
+
+*****************************************************/
+
+SLM_OBJECT_PTR VLM_GetFirstSLM(
+Q_HEADER_PTR qhdr ) // I - Queue header to work on
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ if ( qhdr != NULL ) {
+
+ q_elem_ptr = QueueHead( qhdr );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( SLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+ }
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetLastSLM
+
+ Description:
+
+ A function to return the last slm entry from an slm queue.
+
+*****************************************************/
+
+SLM_OBJECT_PTR VLM_GetLastSLM(
+Q_HEADER_PTR qhdr ) // I - queue header to work on
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueTail( qhdr );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( SLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetNextSLM
+
+ Description:
+
+ A function to return the next slm entry from an slm queue.
+
+*****************************************************/
+
+SLM_OBJECT_PTR VLM_GetNextSLM(
+SLM_OBJECT_PTR slm_ptr ) // I - current slm
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueueNext( &(slm_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( SLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+/***************************************************
+
+ Name: VLM_GetPrevSLM
+
+ Description:
+
+ A function to return the prev slm entry from an slm queue.
+
+*****************************************************/
+
+SLM_OBJECT_PTR VLM_GetPrevSLM(
+SLM_OBJECT_PTR slm_ptr ) // I - current slm
+{
+ Q_ELEM_PTR q_elem_ptr;
+
+ q_elem_ptr = QueuePrev( &(slm_ptr->q_elem) );
+
+ if ( q_elem_ptr != NULL ) {
+ return ( SLM_OBJECT_PTR )( q_elem_ptr->q_ptr );
+ }
+
+ return( NULL );
+}
+
+
+/***************************************************
+
+ Name: VLM_GetParentSLM
+
+ Description:
+
+ A function to return the parent slm entry for an slm entry.
+
+ This function can be dropped when parent pointers are put
+ in the slm entries.
+
+*****************************************************/
+
+SLM_OBJECT_PTR VLM_GetParentSLM(
+SLM_OBJECT_PTR slm_ptr ) // I - current slm
+{
+ SLM_OBJECT_PTR parent_ptr;
+
+ parent_ptr = VLM_GetPrevSLM( slm_ptr );
+
+ while ( parent_ptr &&
+ ( parent_ptr->level >= slm_ptr->level ) ) {
+
+ parent_ptr = VLM_GetPrevSLM( parent_ptr );
+ }
+
+ return( parent_ptr );
+}
+
+
+/***************************************************
+
+ Name: VLM_SubdirListCreate
+
+ Description:
+
+ A function to create a new subdirectory display window. It can be
+ called by the disks, tapes, or servers subsystem. If it's from
+ the tape subsystem then the dle parameter will be NULL. If it's
+ not from a TAPE, then check the parent to see if DISK or SERVER.
+
+*****************************************************/
+
+INT VLM_SubdirListCreate(
+GENERIC_DLE_PTR dle, // I - dle
+UINT32 tape_fid, // I - tape family
+INT16 bset_num, // I - bset number
+INT16 tape_num, // I - tape number in family
+HWND parent ) // I - parent window
+{
+ WININFO_PTR wininfo;
+ DLM_INIT tree_dlm;
+ DLM_INIT flat_dlm;
+ Q_HEADER_PTR slm_list;
+ Q_HEADER_PTR flm_list;
+ APPINFO_PTR appinfo;
+
+ CHAR path[ VLM_BUFFER_SIZE ]; // these should all survive deep pathes and unicode
+ CHAR win_title[ VLM_BUFFER_SIZE ]; // because they are only used on the create call,
+
+ QTC_BSET_PTR bset;
+ BSD_PTR bsd_ptr;
+ BYTE bMode;
+ WORD wDocListTypes;
+
+ // set up the app info stuff for this new window
+
+ appinfo = ( APPINFO_PTR )malloc( sizeof( APPINFO ) );
+ wininfo = ( WININFO_PTR )malloc( sizeof( WININFO ) );
+ slm_list = ( Q_HEADER_PTR )malloc( sizeof(Q_HEADER) );
+ flm_list = ( Q_HEADER_PTR )malloc( sizeof(Q_HEADER) );
+
+ if ( ( appinfo == NULL ) || ( wininfo == NULL ) ||
+ ( slm_list == NULL ) || ( flm_list == NULL ) ) {
+
+ goto failure;
+ }
+
+ appinfo->parent = parent;
+ appinfo->dle = dle;
+ appinfo->tape_fid = tape_fid;
+ appinfo->bset_num = bset_num;
+ appinfo->tape_num = tape_num;
+ appinfo->fsh = NULL;
+
+
+ if ( dle != NULL ) {
+
+ if ( UI_AttachDrive( &(appinfo->fsh), dle, FALSE ) ) {
+
+ goto failure;
+ }
+
+ if ( ! DLE_HasFeatures( appinfo->dle, DLE_FEAT_CASE_PRESERVING ) ) {
+ appinfo->fFatDrive = TRUE;
+ }
+ else {
+ appinfo->fFatDrive = FALSE;
+ }
+
+ DLE_GetVolName( dle, path );
+
+ if ( path[ strlen( path ) - 1 ] != TEXT(':') ) {
+ strcat( path, TEXT(":") );
+ }
+
+ sprintf( win_title, TEXT("%s"), path );
+
+ }
+ else {
+
+ bset = QTC_FindBset( tape_fid, tape_num, bset_num );
+
+ if ( bset != NULL ) {
+
+ if ( bset->status & QTC_FATDRIVE ) {
+ appinfo->fFatDrive = TRUE;
+ }
+ else {
+ appinfo->fFatDrive = FALSE;
+ }
+ }
+
+ wsprintf( win_title, TEXT("%s-%s:"), VLM_GetTapeName( tape_fid ),
+ VLM_GetBsetName( tape_fid, bset_num ) );
+ }
+
+ // initialize directory and file list queues
+
+ InitQueue( slm_list );
+ InitQueue( flm_list );
+
+ // fill in wininfo structure
+
+ if ( dle != NULL ) {
+ WMDS_SetWinType( wininfo, WMTYPE_DISKTREE );
+ }
+ else {
+ WMDS_SetWinType( wininfo, WMTYPE_TAPETREE );
+ }
+
+ WMDS_SetCursor( wininfo, RSM_CursorLoad( IDRC_HSLIDER ) );
+ WMDS_SetDragCursor( wininfo, 0 );
+ WMDS_SetIcon( wininfo, RSM_IconLoad( IDRI_TREEFILE ) );
+ WMDS_SetWinHelpID( wininfo, 0 );
+ WMDS_SetStatusLineID( wininfo, 0 );
+ WMDS_SetRibbonState( wininfo, 0 );
+ WMDS_SetRibbon( wininfo, NULL );
+ WMDS_SetTreeList( wininfo, slm_list );
+ WMDS_SetFlatList( wininfo, flm_list );
+ WMDS_SetTreeDisp( wininfo, NULL );
+ WMDS_SetFlatDisp( wininfo, NULL );
+ WMDS_SetAppInfo( wininfo, appinfo );
+
+ // Set up the menus state stuff.
+
+ {
+ CDS_PTR pCDS = CDS_GetPerm ();
+ DWORD dwTemp = 0;
+
+ // Set up the last known file detail option.
+
+ switch ( CDS_GetFileDetails ( pCDS ) ) {
+
+ case CDS_DISABLE:
+ dwTemp |= MMDOC_NAMEONLY;
+ bMode = DLM_COLUMN_VECTOR;
+ wDocListTypes = WM_TREEANDFLATMC;
+ break;
+
+ case CDS_ENABLE:
+ dwTemp |= MMDOC_FILEDETAILS;
+ bMode = DLM_SINGLECOLUMN;
+ wDocListTypes = WM_TREEANDFLATSC;
+ break;
+ }
+
+ // Set up the last known sort option.
+
+ switch ( CDS_GetSortOptions ( pCDS ) ) {
+
+ case ID_SORTNAME:
+ dwTemp |= MMDOC_SORTNAME;
+ break;
+
+ case ID_SORTTYPE:
+ dwTemp |= MMDOC_SORTTYPE;
+ break;
+
+ case ID_SORTSIZE:
+ dwTemp |= MMDOC_SORTSIZE;
+ break;
+
+ case ID_SORTDATE:
+ dwTemp |= MMDOC_SORTDATE;
+ break;
+ }
+
+ WMDS_SetMenuState( wininfo, MMDOC_TREEANDDIR | dwTemp );
+ }
+
+ // Fill in directory and file queues
+
+ strcpy( path, win_title );
+ strcat( path, TEXT("\\*.*") );
+
+ if ( dle != NULL ) {
+
+
+ VLM_BuildDirList( slm_list, wininfo );
+
+ VLM_HandleFSError( VLM_BuildFileList( appinfo->fsh, win_title,
+ flm_list, wininfo ) );
+
+ }
+ else {
+
+ VLM_BuildTapeDirList( slm_list, tape_fid, bset_num, wininfo );
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list, tape_fid, bset_num );
+
+ if ( bsd_ptr != NULL ) {
+ VLM_MatchSLMList( wininfo, bsd_ptr, FALSE );
+ }
+
+ VLM_BuildTapeFileList( win_title, flm_list, tape_fid, bset_num, wininfo );
+ }
+
+ if ( ! QueueCount( slm_list ) ) {
+
+ // We ran into problems, probably out of memory.
+ // Don't display window.
+
+ goto failure;
+ }
+
+ appinfo->open_slm = VLM_GetFirstSLM( slm_list );
+
+ // Init the display list stuff
+
+ DLM_ListBoxType( &tree_dlm, DLM_TREELISTBOX );
+ DLM_Mode( &tree_dlm, DLM_HIERARCHICAL );
+ DLM_Display( &tree_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &tree_dlm, slm_list );
+ DLM_TextFont( &tree_dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &tree_dlm, VLM_SlmGetItemCount );
+ DLM_GetFirstItem( &tree_dlm, VLM_SlmGetFirstItem );
+ DLM_GetNext( &tree_dlm, VLM_SlmGetNextItem );
+ DLM_GetPrev( &tree_dlm, VLM_SlmGetPrevItem );
+ DLM_GetTag( &tree_dlm, VLM_SlmGetTag );
+ DLM_SetTag( &tree_dlm, VLM_SlmSetTag );
+ DLM_GetSelect( &tree_dlm, VLM_SlmGetSelect );
+ DLM_SetSelect( &tree_dlm, VLM_SlmSetSelect );
+ DLM_GetObjects( &tree_dlm, VLM_SlmGetObjects );
+ DLM_SetObjects( &tree_dlm, VLM_SlmSetObjects );
+ DLM_SSetItemFocus( &tree_dlm, NULL );
+
+ // Tell the DLM what the maximum number of objects we will display
+ // per item is.
+
+ DLM_MaxNumObjects( &tree_dlm, 6 );
+
+ DLM_DispListInit( wininfo, &tree_dlm );
+
+ DLM_ListBoxType( &flat_dlm, DLM_FLATLISTBOX );
+ DLM_Mode( &flat_dlm, bMode );
+ DLM_Display( &flat_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &flat_dlm, flm_list );
+ DLM_TextFont( &flat_dlm, DLM_SYSTEM_FONT );
+ VLM_FlmFillInDLM( &flat_dlm );
+
+ DLM_DispListInit( wininfo, &flat_dlm );
+
+
+ // open a new window
+
+
+ appinfo->win = WM_Create( (WORD)(WM_MDISECONDARY | wDocListTypes | WM_MENUS),
+ path,
+ win_title,
+ WM_DEFAULT, WM_DEFAULT,
+ WM_DEFAULT, WM_DEFAULT,
+ wininfo );
+
+ if ( appinfo->win == (HWND)NULL ) {
+ goto failure;
+ }
+
+ DLM_DispListProc( WMDS_GetWinTreeList( wininfo ), 0, NULL );
+ DLM_DispListProc( WMDS_GetWinFlatList( wininfo ), 0, NULL );
+
+ return( SUCCESS );
+
+failure:
+
+ if ( appinfo ) {
+ if ( appinfo->fsh ) {
+ FS_DetachDLE( appinfo->fsh );
+ }
+ }
+ free( appinfo );
+ free( wininfo );
+ free( slm_list );
+ free( flm_list );
+ return( FAILURE );
+
+}
+
+
+/***************************************************
+
+ Name: VLM_SubdirListManager
+
+ Description:
+
+ A function that other systems can call if they wish to select all
+ or none of a directory/file window. Usually this is called when
+ the user selects an entire drive/bset/volume and it has a window
+ already open displaying the dirs/files.
+
+*****************************************************/
+
+VOID VLM_SubdirListManager(
+HWND win, // I - window to work on
+WORD msg ) // I - message of what to do
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ SLM_OBJECT_PTR slm;
+ BOOL all_subdirs;
+
+ all_subdirs = CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( msg == SLM_SEL_ALL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) );
+
+ if ( ! all_subdirs ) {
+
+ // make the root partial
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)(INFO_SELECT|INFO_PARTIAL) );
+
+ if ( SLM_GetStatus( slm ) & INFO_OPEN ) {
+ VLM_FileListManager( appinfo->win, FLM_SEL_ALL );
+ }
+
+ DLM_Update( win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+ else {
+
+ while ( slm != NULL ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SELECT );
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~INFO_PARTIAL );
+
+ slm = VLM_GetNextSLM( slm );
+ }
+ VLM_FileListManager( appinfo->win, FLM_SEL_ALL );
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+ }
+
+ }
+
+ if ( msg == SLM_SEL_NONE ) {
+
+ wininfo = WM_GetInfoPtr( win );
+ slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) );
+
+ while ( slm != NULL ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~(INFO_SELECT | INFO_PARTIAL) );
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+ VLM_FileListManager( appinfo->win, FLM_SEL_NONE );
+ }
+
+}
+
+/***************************************************
+
+ Name: VLM_BuildTapeDirList
+
+ Description:
+
+ Called to fill out a queue of directories so that a new directory
+ display window can be created. It will grab the whole list of
+ directories from the catalogs. This is slightly
+ different from the similar function that builds a list of dirs off
+ a disk.
+
+*****************************************************/
+
+static VOID VLM_BuildTapeDirList(
+Q_HEADER_PTR slm_list, // I - queue header to fill in
+UINT32 tape_fid, // I - tape to get info from
+INT16 bset_num, // I - bset to get info from
+WININFO_PTR XtraBytes ) // I - pointer to windows xtra bytes
+{
+ INT16 count = 0;
+ INT16 result;
+ INT16 i;
+ INT path_size = 0; // sizeof 'path' buffer in bytes
+ INT path_length; // length of the path in the buffer
+ INT level;
+ INT fLowerCase;
+ INT dir_count = 0;
+ INT BytesNeeded;
+ DATE_TIME mdate;
+ QTC_QUERY_PTR query;
+ SLM_OBJECT_PTR prev_slm = NULL;
+ SLM_OBJECT_PTR temp_slm;
+ SLM_OBJECT_PTR slm;
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR format_string[ MAX_UI_RESOURCE_SIZE ];
+ CHAR *path = NULL;
+ CHAR_PTR s;
+ APPINFO_PTR appinfo;
+
+
+ appinfo = ( APPINFO_PTR )XtraBytes->pAppInfo;
+
+ RSM_StringCopy( IDS_DIRSCANNED, format_string, MAX_UI_RESOURCE_LEN );
+
+ query = QTC_InitQuery( );
+ if ( query == NULL ) {
+ return;
+ }
+
+ QTC_SetTapeFID( query, tape_fid );
+ QTC_SetTapeSeq( query, -1 );
+ QTC_SetBsetNum( query, bset_num );
+
+ result = (INT16) QTC_GetFirstDir( query );
+
+ // Another one of those things that should never happen ...
+
+ if ( result ) {
+ QTC_CloseQuery( query );
+ return;
+ }
+
+ fLowerCase = FALSE;
+
+ if ( CDS_GetFontCase( CDS_GetPerm() ) ) {
+ fLowerCase = TRUE;
+ }
+ else {
+
+ if ( appinfo->fFatDrive && CDS_GetFontCase( CDS_GetPerm() ) ) {
+
+ fLowerCase = TRUE;
+ }
+ }
+
+ if ( strlen( QTC_GetItemName( query ) ) == 0 ) {
+ strcpy( QTC_GetItemName( query ), TEXT("\\") ); // <-- FIX THIS !!!
+ }
+
+ while ( ! result ) {
+
+ if ( ! (++dir_count % 10) ) {
+ sprintf( text, format_string, dir_count );
+ STM_DrawText( text );
+ }
+
+ if ( strcmp( QTC_GetItemName( query ), TEXT("\\") ) ) {
+
+ level = 1;
+
+ if ( QTC_GetPathLength( query ) != sizeof(CHAR) ) {
+
+ s = QTC_GetPath( query );
+
+ for ( i = 0; i < (INT16) QTC_GetPathLength( query ); i+=sizeof (CHAR) ) {
+ if ( *s == TEXT( '\0' ) ) {
+ level++;
+ }
+ s++;
+ }
+ }
+ }
+ else {
+ level = 0;
+ }
+
+ // Build complete path by adding new directory to end.
+
+ BytesNeeded = QTC_GetPathLength( query ) + strsize( QTC_GetItemName( query ) );
+
+ if ( BytesNeeded > path_size ) {
+ free( path );
+ path = malloc( BytesNeeded );
+ path_size = BytesNeeded;
+ }
+
+ if ( path == NULL ) {
+ break;
+ }
+
+ if ( QTC_GetPathLength( query ) != sizeof(CHAR) ) {
+
+ memcpy( path, QTC_GetPath( query ), QTC_GetPathLength( query ) );
+ strcpy( &path[ QTC_GetPathLength( query ) / sizeof(CHAR) ], QTC_GetItemName( query ) );
+ path_length = QTC_GetPathLength( query );
+ path_length += strsize( QTC_GetItemName( query ) );
+ }
+ else {
+
+ strcpy( path, QTC_GetItemName( query ) );
+ path_length = strsize( path );
+ }
+
+ slm = VLM_FindSLM( slm_list,
+ path,
+ path_length );
+
+ if ( slm == NULL ) {
+
+ slm = VLM_CreateSlm( (INT)( ( 4 * ( ( level / 32 ) + 1 ) ) ),
+ (INT)strsize( QTC_GetItemName( query ) ),
+ TRUE, appinfo->fFatDrive );
+
+ if ( slm == NULL ) {
+ break;
+ }
+
+ SLM_SetAttribute( slm, QTC_GetItemAttrib( query ) );
+ SLM_SetStatus( slm, INFO_VALID );
+
+ if ( QTC_GetItemStatus( query ) & QTC_CORRUPT ) {
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_CORRUPT );
+ }
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ if ( QTC_GetItemStatus( query ) & QTC_EMPTY ) {
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_EMPTY );
+ }
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ slm->next_brother = NULL;
+
+ SLM_SetLevel( slm, level );
+ SLM_SetDate( slm, QTC_GetItemDate( query ) );
+ SLM_SetTime( slm, QTC_GetItemTime( query ) );
+
+ DateTimeDOS( SLM_GetDate( slm ), SLM_GetTime( slm ), &mdate );
+
+ if ( SLM_GetLevel( slm ) < 2 ) {
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_DISPLAY );
+ }
+ SLM_SetXtraBytes( slm, XtraBytes );
+ SLM_SetName( slm, QTC_GetItemName( query ) );
+ SLM_SetOriginalName( slm, QTC_GetItemName( query ) );
+
+
+ if ( fLowerCase ) {
+
+ strlwr( SLM_GetName( slm ) );
+ }
+
+ // Add this new slm to our list and be real smart about
+ // where it goes cause some bozo will have 3000 on a 10MHz AT.
+
+ VLM_InsertTapeSLM( slm_list, prev_slm, slm );
+
+ if ( prev_slm == NULL ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)(INFO_EXPAND | INFO_OPEN) );
+ }
+ else {
+
+ if ( SLM_GetLevel( slm ) > SLM_GetLevel( prev_slm ) ) {
+ SLM_SetStatus( prev_slm, SLM_GetStatus( prev_slm ) | (UINT16)INFO_SUBS );
+ }
+ }
+
+ prev_slm = slm;
+
+ // If this slm is corrupt then mark all his parents as corrupt
+
+ if ( SLM_GetStatus( slm ) & INFO_CORRUPT ) {
+
+ level = SLM_GetLevel( slm ) - 1;
+ temp_slm = slm;
+
+ while ( temp_slm != NULL ) {
+
+ if ( SLM_GetLevel( temp_slm ) == level ) {
+ SLM_SetStatus( temp_slm, SLM_GetStatus( temp_slm ) | (UINT16)INFO_CORRUPT );
+ level--;
+ }
+
+ temp_slm = VLM_GetPrevSLM( temp_slm );
+ }
+ }
+
+ }
+ else {
+
+ // Here's the deal ...
+ // If a directory is not going to be created because it is
+ // a duplicate, then we have to help our insertion cacheing
+ // algorithm out by telling it who the new "current" parent
+ // is. This way the upcoming children from this duplicate
+ // will get inserted in the right place.
+
+ VLM_InsertTapeSLM( NULL, NULL, slm );
+
+ prev_slm = slm; // <- this is just for fun.
+ }
+
+ result = (INT16)QTC_GetNextDir( query );
+ }
+
+ free( path );
+
+ QTC_CloseQuery( query );
+
+ VLM_UpdateBrothers( slm_list );
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ Used for inserting an slm into a tape based tree.
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_InsertTapeSLM(
+Q_HEADER_PTR slm_list,
+SLM_OBJECT_PTR prev_slm,
+SLM_OBJECT_PTR new_slm )
+{
+ static SLM_OBJECT_PTR *parents = (SLM_OBJECT_PTR *)NULL;
+ static INT MaxParents = 0;
+
+ SLM_OBJECT_PTR *temp_parents;
+
+ SLM_OBJECT_PTR parent_slm; // parent of all this new guy's brothers
+ SLM_OBJECT_PTR temp_slm; // used to move through list
+ SLM_OBJECT_PTR best_slm; // insert after this guy
+ SLM_OBJECT_PTR last_brother; // new guy's prev brother after insertion
+ SLM_OBJECT_PTR next_brother; // new guy's next brother after insertion
+ INT level; // height of new guy in tree
+
+
+ if ( ( new_slm->level >= MaxParents ) || ( parents == (SLM_OBJECT_PTR *)NULL ) ) {
+
+ temp_parents = (SLM_OBJECT_PTR *)malloc( (MaxParents + 100 ) * sizeof(SLM_OBJECT_PTR) );
+
+ if ( temp_parents ) {
+
+ memcpy( temp_parents, parents, sizeof( SLM_OBJECT_PTR) * MaxParents );
+ free( parents );
+ parents = temp_parents;
+ MaxParents += 100;
+ }
+ else {
+ return;
+ }
+ }
+
+ // The code that calls us has decided not to create an slm because
+ // a duplicate already exists in the list. We have to use it as the
+ // correct parent for the possible upcoming children of the duplicate.
+
+ if ( slm_list == NULL ) {
+ parents[ new_slm->level ] = new_slm;
+ return;
+ }
+
+ // The parents array keeps us from having to look back through the queue
+ // to find this new guys parent. We need the parent so that we can
+ // insert this new guy as the possible first child.
+
+ if ( prev_slm == NULL ) {
+
+ // First entry, must be the root.
+
+ parents[ 0 ] = new_slm;
+ EnQueueElem( slm_list, &(new_slm->q_elem), FALSE );
+ return;
+ }
+
+ // Get height of new item.
+
+ level = new_slm->level;
+
+ // Set up for this guys possible children.
+
+ parents[ level ] = new_slm;
+
+ // Find this guys parent.
+
+ parent_slm = parents[ level - 1 ];
+
+ // Now find the right location to insert the new slm among his brothers.
+
+ best_slm = parent_slm;
+
+ last_brother = NULL;
+ next_brother = NULL;
+
+ // Try to skip a bunch of the brothers. Suppose ths guy has 20 brothers
+ // and the last slm inserted was his brother Jose. If this new guys
+ // name is Juan, then we can start looking with Jose.
+
+ if ( prev_slm->level == new_slm->level ) {
+
+ if ( stricmp( prev_slm->name, new_slm->name ) < 0 ) {
+ best_slm = prev_slm;
+ last_brother = best_slm;
+ }
+ }
+
+ temp_slm = best_slm;
+
+ if ( best_slm->level < level ) {
+
+ temp_slm = VLM_GetNextSLM( best_slm );
+ if ( ( temp_slm != NULL ) && ( temp_slm->level != level ) ) {
+ temp_slm = NULL;
+ }
+ }
+
+ // Now remember there may be children between the brothers that we
+ // don't care about and MUST ignore in determining where this slm
+ // should be located.
+
+ // temp_slm is NULL or first brother
+
+ while ( temp_slm ) {
+
+ next_brother = temp_slm;
+
+ if ( stricmp( temp_slm->name, new_slm->name ) >= 0 ) {
+
+ // Get out of while loop.
+ break;
+ }
+
+ last_brother = temp_slm;
+ best_slm = temp_slm;
+ temp_slm = temp_slm->next_brother;
+ }
+
+ // Insert after best_slm and any children > level.
+
+ if ( ( best_slm->level == level ) && ( best_slm->next_brother != NULL ) ) {
+
+ best_slm = VLM_GetPrevSLM( best_slm->next_brother );
+ }
+ else {
+
+ temp_slm = best_slm;
+
+ while ( temp_slm ) {
+
+ if ( temp_slm->level < level ) {
+ break;
+ }
+
+ best_slm = temp_slm;
+
+ if ( temp_slm->next_brother != NULL ) {
+ temp_slm = temp_slm->next_brother;
+ }
+ else {
+ temp_slm = VLM_GetNextSLM( temp_slm );
+ }
+
+ }
+ }
+
+ // Update next_brother pointers;
+
+ if ( last_brother != NULL ) {
+ new_slm->next_brother = last_brother->next_brother;
+ last_brother->next_brother = new_slm;
+ }
+ else {
+ new_slm->next_brother = next_brother;
+ }
+
+ InsertElem( slm_list, &(best_slm->q_elem), &(new_slm->q_elem), AFTER );
+
+}
+
+
+
+/***************************************************
+
+ Name: VLM_CreateSlm
+
+ Description:
+
+ Creates an SLM object for you.
+
+ Returns: either a pointer or NULL.
+
+*****************************************************/
+
+
+SLM_OBJECT_PTR VLM_CreateSlm(
+INT brother_bytes,
+INT name_size,
+BOOLEAN use_stats,
+BOOLEAN fat_drive )
+{
+ SLM_OBJECT_PTR slm;
+ INT slm_size;
+ INT stats_size;
+ INT original_name_size = 0;
+
+ // Everything must be 32 bit (4 byte) aligned for MIPs, so we
+ // round up all the sizes to the next 4 byte boundary (if
+ // required).
+
+ slm_size = sizeof( SLM_OBJECT );
+ if ( slm_size % 4 ) {
+ slm_size += 4 - ( slm_size % 4 );
+ }
+
+ if ( brother_bytes % 4 ) {
+ brother_bytes += 4 - ( brother_bytes % 4 );
+ }
+
+ if ( name_size % 4 ) {
+ name_size += 4 - ( name_size % 4 );
+ }
+
+ // If it is not a FAT drive we need to keep two name strings.
+ // This allows us to display the name in lower case.
+
+ if ( ! fat_drive ) {
+ original_name_size = name_size;
+ }
+
+ slm = ( SLM_OBJECT_PTR )malloc( slm_size +
+ brother_bytes +
+ name_size +
+ original_name_size +
+ 0 );
+
+ if ( slm != NULL ) {
+
+ // The seemingly redundant casting is for unicode support
+
+ slm->name = (CHAR_PTR) ( ((BYTE_PTR)slm) + slm_size );
+ if ( fat_drive ) {
+ slm->original_name = slm->name;
+ }
+ else {
+ slm->original_name = (CHAR_PTR)((BYTE_PTR)slm->name + name_size);
+ }
+ slm->brothers = ((BYTE_PTR)slm->original_name) + name_size;
+ slm->q_elem.q_ptr = slm;
+ }
+
+ return( slm );
+}
+
+
+/***************************************************
+
+ Name: VLM_BuildDirList
+
+ Description:
+
+ This function will build a sorted directory list from a disk for
+ displaying in the tree window. Most of the work is done by calling
+ check for children to blow out as much of the tree as needed.
+
+*****************************************************/
+
+static INT VLM_BuildDirList(
+Q_HEADER_PTR slm_list, // I - queue to fill in
+WININFO_PTR XtraBytes ) // I - windows extra bytes pointer
+{
+ SLM_OBJECT_PTR slm;
+ APPINFO_PTR appinfo;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse;
+ INT16 ret;
+
+
+ appinfo = ( APPINFO_PTR )XtraBytes->pAppInfo;
+
+ if ( ! DLE_HasFeatures( appinfo->dle, DLE_FEAT_CASE_PRESERVING ) ) {
+ appinfo->fFatDrive = TRUE;
+ }
+ else {
+ appinfo->fFatDrive = FALSE;
+ }
+
+ if ( FS_ChangeDir( appinfo->fsh, TEXT(""), (UINT16)sizeof(CHAR) ) ) {
+
+ return( 0 );
+ }
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+
+ // Make the root and enter it into the list
+
+ slm = VLM_CreateSlm( (INT) 4,
+ (INT)(strlen(TEXT("..")) + 1) * sizeof(CHAR),
+ FALSE, appinfo->fFatDrive );
+
+ if ( slm == NULL ) {
+ return(0);
+ }
+
+ SLM_SetAttribute( slm, 0 );
+ SLM_SetLevel( slm, 0 );
+ SLM_SetXtraBytes( slm, XtraBytes );
+ SLM_SetName( slm, TEXT("\\") );
+ SLM_SetOriginalName( slm, TEXT("\\") );
+ SLM_SetNextBrother( slm, NULL );
+ SLM_SetStatus( slm, INFO_DISPLAY | INFO_VALID | INFO_OPEN | INFO_EXPAND );
+
+ EnQueueElem( slm_list, &(slm->q_elem), FALSE );
+
+ // Now let check for children do the rest
+
+ // The 1 is the depth to search.
+
+ if ( VLM_CheckForChildren( slm_list, slm, TEXT(""), 1, FALSE ) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SUBS );
+ }
+
+ if ( bsd_ptr != NULL ) {
+
+ ret = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL, TEXT(""),
+ (UINT16)sizeof(CHAR),
+ SLM_GetAttribute( slm ),
+ NULL, NULL, NULL, FALSE, TRUE );
+
+ if ( ret == BSD_PROCESS_OBJECT ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)(INFO_SELECT | INFO_PARTIAL) );
+ }
+
+ if ( ret == BSD_PROCESS_ENTIRE_DIR ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SELECT );
+ }
+ }
+
+ // Make the first two levels displayed
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetLevel( slm ) < 2 ) {
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_DISPLAY );
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ VLM_UpdateBrothers( slm_list );
+
+ return( 0 );
+}
+
+/***************************************************
+
+ NAME : VLM_UpdateBrothers
+
+ DESCRIPTION :
+
+ For each item in the list the DLM needs to know if brothers exist later
+ in the list at a deeper level in the tree. This allows the DLM to draw
+ pretty lines that run down the side of the tree. So we scan the list
+ backwards. This method supports an infinite depth of subdirectory levels,
+ by indicating each level with a single bit in double word(s) stored with
+ each item. Each double word can handle 32 levels and as many double words
+ are allocated as needed. As new nodes are expanded the entire list is
+ completely rescanned, this is not needed, but I haven't written the code
+ to handle sections at a time yet. This algorithm is very hard to under-
+ stand, so don't waste too much time trying unless it's important to you.
+
+ RETURNS : nothing.
+
+*****************************************************/
+
+VOID VLM_UpdateBrothers(
+Q_HEADER_PTR slm_list ) // I - Queue to update
+{
+ static UINT32 clr_masks[ 32 ] = {
+ 0x00000000, 0x80000000, 0xC0000000, 0xE0000000,
+ 0xf0000000, 0xf8000000, 0xfC000000, 0xfE000000,
+ 0xff000000, 0xff800000, 0xffC00000, 0xffE00000,
+ 0xfff00000, 0xfff80000, 0xfffC0000, 0xfffE0000,
+ 0xffff0000, 0xffff8000, 0xffffC000, 0xffffE000,
+ 0xfffff000, 0xfffff800, 0xfffffC00, 0xfffffE00,
+ 0xffffff00, 0xffffff80, 0xffffffC0, 0xffffffE0,
+ 0xfffffff0, 0xfffffff8, 0xfffffffC, 0xfffffffE };
+
+ static UINT32 set_masks[ 32 ] = {
+ 0x80000000, 0x40000000, 0x20000000, 0x10000000,
+ 0x08000000, 0x04000000, 0x02000000, 0x01000000,
+ 0x00800000, 0x00400000, 0x00200000, 0x00100000,
+ 0x00080000, 0x00040000, 0x00020000, 0x00010000,
+ 0x00008000, 0x00004000, 0x00002000, 0x00001000,
+ 0x00000800, 0x00000400, 0x00000200, 0x00000100,
+ 0x00000080, 0x00000040, 0x00000020, 0x00000010,
+ 0x00000008, 0x00000004, 0x00000002, 0x00000001 };
+
+ SLM_OBJECT_PTR slm;
+
+ INT16 working_block; // block of data to work on for this slm
+
+ INT prev_level; // height in tree of previous slm
+ INT curr_level; // height in tree of current slm
+
+ UINT32_PTR mask; // pointer into current mask buffer
+ UINT32_PTR last_mask; // pointer into previous mask buffer
+
+ INT16 mask_size; // current size of mask buffers
+ UINT32_PTR temp_mask; // temporary mask buffer
+ UINT32_PTR curr_mask; // current slm mask buffer
+ UINT32_PTR prev_mask; // previous slm mask buffer
+
+ UINT32_PTR brothers;
+
+ slm = VLM_GetLastSLM( slm_list );
+
+ while ( slm && ! ( slm->status & INFO_DISPLAY ) ) {
+ slm = VLM_GetPrevSLM( slm );
+ }
+
+ prev_level = SLM_GetLevel( slm );
+
+ mask_size = (INT16)(( SLM_GetLevel( slm ) / 32 ) + 1);
+
+ curr_mask = ( UINT32_PTR )calloc( mask_size * 4, 1 );
+ prev_mask = ( UINT32_PTR )calloc( mask_size * 4, 1 );
+
+ last_mask = prev_mask;
+
+ if ( ( curr_mask != NULL ) && ( prev_mask != NULL ) ) {
+
+ while ( slm != NULL ) {
+
+ // set this item
+
+ curr_level = SLM_GetLevel( slm );
+
+ working_block = (INT16)(( curr_level / 32 ) + 1);
+
+ if ( mask_size < working_block ) {
+
+ // expand current mask
+
+ temp_mask = ( UINT32_PTR )calloc( 4 * working_block, 1 );
+ if ( temp_mask == NULL ) {
+ break;
+ }
+ memcpy( temp_mask, curr_mask, mask_size * 4 );
+ free( curr_mask );
+ curr_mask = temp_mask;
+
+ // expand previous mask
+
+ temp_mask = ( UINT32_PTR )calloc( 4 * working_block, 1 );
+ if ( temp_mask == NULL ) {
+ break;
+ }
+ memcpy( temp_mask, prev_mask, mask_size * 4 );
+ free( prev_mask );
+ prev_mask = temp_mask;
+
+ mask_size = working_block;
+ }
+
+ mask = curr_mask;
+ mask += working_block - 1;
+
+ // clear everything higher than this bit
+
+ temp_mask = mask;
+ *temp_mask &= clr_masks[ curr_level & 0x1F ];
+
+ if ( working_block < mask_size ) {
+
+ // clear out the rest of the masks
+
+ temp_mask = curr_mask;
+ temp_mask += working_block;
+ memset( temp_mask, 0, 4 * (mask_size - working_block) );
+ }
+
+ // set a bit for this node
+
+ *mask |= set_masks[ curr_level & 0x1F ];
+
+ // Copy new mask into slm
+
+ brothers = (UINT32_PTR)SLM_GetBrothers( slm );
+ memcpy( brothers, curr_mask, working_block * 4 );
+
+ brothers += working_block - 1;
+
+ if ( ( prev_level < curr_level ) ||
+ ! ( *last_mask & set_masks[ curr_level & 0x1F ] ) ) {
+
+ *brothers &= ~set_masks[ curr_level & 0x1F ];
+ }
+
+ // Copy current mask and level to previous mask and level
+
+ last_mask = prev_mask;
+ last_mask += working_block - 1;
+
+ memcpy( prev_mask, curr_mask, 4 * working_block );
+
+ prev_level = curr_level;
+
+ do {
+ slm = VLM_GetPrevSLM( slm );
+ } while ( slm && ! ( slm->status & INFO_DISPLAY ) );
+ }
+ }
+
+ if ( prev_mask ) {
+ free( prev_mask );
+ }
+
+ if ( curr_mask ) {
+ free( curr_mask );
+ }
+ return;
+}
+
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+SLM_OBJECT_PTR VLM_FindSLM(
+Q_HEADER_PTR slm_list,
+CHAR_PTR path,
+INT path_size )
+{
+ SLM_OBJECT_PTR slm;
+ INT level;
+ INT index = 0;
+
+ if ( path_size == 0 ) {
+ msassert( FALSE );
+ }
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ if ( path_size == sizeof(CHAR) ) { // root
+ return( slm );
+ }
+
+ if ( path_size == ( 2 * sizeof(CHAR ) ) ) {
+ if ( ! strcmp( path, TEXT( "\\" ) ) ) {
+ return( slm );
+ }
+ }
+
+ level = 1;
+
+ if ( slm ) {
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ while ( slm != NULL ) {
+
+ // We didn't find proper child, before next brother, so abort.
+
+ if ( slm->level < level ) {
+ return( NULL );
+ }
+
+ if ( slm->level == level ) {
+
+ if ( ! stricmp( slm->name, &path[ index ] ) ) {
+
+ while ( path[ index ] ) index++;
+ index++;
+
+ // Have we found the whole path ?
+
+ if ( (INT)(index * sizeof (CHAR)) == path_size ) {
+ return( slm );
+ }
+ level++;
+ }
+ else {
+ slm = slm->next_brother;
+ continue;
+ }
+ }
+
+ slm = VLM_GetNextSLM( slm );
+
+ }
+
+ return( slm );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+SLM_OBJECT_PTR VLM_GetNextBrotherSLM(
+SLM_OBJECT_PTR slm )
+{
+
+ // New faster method. Was a real function to new field was added.
+
+ return( slm->next_brother );
+}
+
+
+/***************************************************
+
+ Name: VLM_CheckForChildren
+
+ Description:
+
+ This is one of those recursive calls that descends down the tree as
+ deep as requested to locate all the brothers and sisters that exist
+ on the disk. For efficiency the directories at level N are found
+ and inserted in order, before descending deeper to locate any
+ children at level N+1.
+
+ Warning:
+
+ This function is designed to work only with DISK or SERVER windows.
+ However the code that processes TAPE windows also has calls to this
+ function. The idea here is that it will never be called because the
+ catalogs construct the entire tree for tapes and so all the children
+ are already known.
+
+ Returns:
+
+ Number of new directories found. This is only used to see if any
+ at all were found, so ZERO/NON-ZERO would work as well.
+
+*****************************************************/
+
+INT VLM_CheckForChildren(
+Q_HEADER_PTR slm_list, // I - queue to add children to
+SLM_OBJECT_PTR parent_slm, // I - slm to add children under
+CHAR_PTR base_path, // I - path of parent slm
+INT depth, // I - how much deeper to go
+BOOLEAN refresh ) // I - is it real or is it refreshing ?
+{
+ WININFO_PTR XtraBytes;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR prev_slm_inserted = NULL;
+ SLM_OBJECT_PTR start_slm = NULL;
+ INT16 count = 0;
+ INT16 psize;
+ INT16 orig_psize;
+ INT16 ret;
+ INT16 dir_count;
+ INT16 fs_status;
+ CHAR_PTR buffer;
+ CHAR_PTR name;
+ CHAR_PTR path;
+ CHAR_PTR s;
+ APPINFO_PTR appinfo;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse;
+ DBLK_PTR dblk;
+ DATE_TIME mdate;
+ BOOLEAN displayed = FALSE;
+ static CHAR format_string[ MAX_UI_RESOURCE_SIZE ];
+ INT BytesNeeded;
+ INT level;
+ INT file_count = 0;
+ INT fLowerCase = FALSE;
+ INT buffer_size = 0;
+
+
+ level = SLM_GetLevel( parent_slm );
+ level++;
+
+ XtraBytes = SLM_GetXtraBytes( parent_slm );
+ appinfo = ( APPINFO_PTR )XtraBytes->pAppInfo;
+
+ RSM_StringCopy( IDS_DIRSCANNED, format_string, MAX_UI_RESOURCE_LEN );
+
+ buffer = ( CHAR_PTR )malloc( VLM_BUFFER_SIZE );
+ buffer_size = VLM_BUFFER_SIZE;
+
+ dblk = (DBLK_PTR)malloc( sizeof(DBLK ) );
+
+ psize = (INT16)strsize( base_path );
+
+ path = malloc( psize );
+
+ if ( path == NULL || dblk == NULL || buffer == NULL ) {
+ free( buffer );
+ free( dblk );
+ free( path );
+ return( 0 );
+ }
+
+ strcpy( path, base_path );
+
+ s = path;
+
+ while ( *s ) {
+ if ( *s == TEXT('\\') ) {
+ *s = TEXT( '\0' );
+ }
+ s++;
+ }
+
+ if ( CDS_GetFontCase( CDS_GetPerm() ) ) {
+ fLowerCase = TRUE;
+ }
+ else {
+ if ( CDS_GetFontCaseFAT( CDS_GetPerm() ) ) {
+
+ // Change this to DLE_FEATURE_FAT_DRIVE
+
+ if ( ! DLE_HasFeatures( appinfo->dle, DLE_FEAT_CASE_PRESERVING ) ) {
+ fLowerCase = TRUE;
+ }
+ }
+ }
+
+
+ if ( FS_ChangeDir( appinfo->fsh, path, psize ) ) {
+ free( buffer );
+ free( dblk );
+ free( path );
+ return( 0 );
+ }
+
+ free( path );
+
+ // WM_MultiTask(); <--- broke mikep 6/21/93
+
+ fs_status = FS_FindFirstObj( appinfo->fsh, dblk, TEXT("*.*") );
+
+ // VLM_HandleFSError( (INT)fs_status );
+
+ if ( fs_status == SUCCESS ) {
+
+ // Get the BSD pointer for this drive.
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+
+ // Get the directory count for the status line
+
+ dir_count = QueueCount( XtraBytes->pTreeList );
+
+ // Add all the directories at this level
+
+ do {
+
+ if ( FS_GetBlockType( dblk ) == BT_DDB ) {
+ count++;
+ } else {
+ file_count++;
+ }
+
+ // If depth == 0 then they only wanted to know if there were subs.
+
+ if ( depth == 0 && count && file_count ) {
+ FS_ReleaseDBLK( appinfo->fsh, dblk );
+ break;
+ }
+
+ if ( ( FS_GetBlockType( dblk ) != BT_DDB ) || ( depth == 0 ) ) {
+ FS_ReleaseDBLK( appinfo->fsh, dblk );
+ }
+ else {
+
+ if ( ! (++dir_count % 5) ) {
+ sprintf( buffer, format_string, dir_count );
+ STM_DrawText( buffer );
+ }
+
+ orig_psize = FS_SizeofOSPathInDDB( appinfo->fsh, dblk );
+ if ( orig_psize > buffer_size ) {
+ free( buffer );
+ buffer = malloc( orig_psize );
+ }
+
+ FS_GetOSPathFromDDB( appinfo->fsh, dblk, buffer );
+
+ psize = (INT16) (orig_psize - sizeof(CHAR));
+ psize /= sizeof(CHAR);
+
+ do {
+ psize--;
+ } while ( psize && buffer[psize] );
+
+ if ( psize ) {
+ psize++;
+ }
+ name = &buffer[psize];
+
+ slm = VLM_FindSLM( slm_list, buffer, orig_psize );
+
+ if ( fLowerCase ) {
+
+ strlwr( name );
+ }
+
+ if ( slm == NULL ) {
+
+ slm = VLM_CreateSlm( (INT)(4 * ( ( level / 32 ) + 1 ) ),
+ (INT)strsize( name ),
+ FALSE, appinfo->fFatDrive );
+
+ if ( slm == NULL ) {
+ break;
+ }
+
+ SLM_SetStatus( slm, 0 );
+ }
+ else {
+ slm->status |= INFO_OLD;
+ }
+
+ slm->status |= INFO_NEW;
+
+ SLM_SetAttribute( slm, FS_GetAttribFromDBLK( appinfo->fsh, dblk ) );
+ SLM_SetLevel( slm, level );
+ SLM_SetXtraBytes( slm, XtraBytes );
+ SLM_SetName( slm, name );
+ SLM_SetOriginalName( slm, name );
+
+ FS_GetMDateFromDBLK( appinfo->fsh, dblk, &mdate );
+ SLM_SetDate( slm, ConvertDateDOS( &mdate ) );
+ SLM_SetTime( slm, ConvertTimeDOS( &mdate ) );
+
+ if ( bsd_ptr != NULL ) {
+
+ slm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+
+ ret = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL, buffer,
+ orig_psize,
+ slm->attrib,
+ &mdate, NULL, NULL, FALSE, TRUE );
+
+ if ( ret == BSD_PROCESS_OBJECT ) {
+ slm->status |= INFO_SELECT | INFO_PARTIAL;
+ }
+ if ( ret == BSD_PROCESS_ENTIRE_DIR ) {
+ slm->status |= INFO_SELECT;
+ }
+ }
+
+ // The idea now is to start at the first new item we've added and
+ // insert this new one in the right place.
+
+ // Don't reinsert an OLD SLM that's already there during refresh call.
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_OLD ) ) {
+
+ VLM_InsertDiskSLM( slm_list, parent_slm, prev_slm_inserted, slm );
+ }
+
+ prev_slm_inserted = slm;
+
+ FS_ReleaseDBLK( appinfo->fsh, dblk );
+
+ }
+
+ } while ( FS_FindNextObj( appinfo->fsh, dblk ) == SUCCESS );
+
+ FS_FindObjClose( appinfo->fsh, dblk );
+
+ // If we are refreshing and we added some new dirs, then we need to
+ // check to see if any old brothers are VALID to determine if we
+ // need to look deeper for subdirectories or not. If a brother knows
+ // if he has children, then this new guy MUST know too.
+
+ // In addition mark all found old slm's as neither OLD nor NEW.
+
+ if ( refresh ) {
+
+ depth = 0;
+
+ slm = VLM_GetNextSLM( parent_slm );
+
+ while ( slm ) {
+
+ if ( slm->status & INFO_OLD ) {
+
+ if ( slm->status & INFO_DISPLAY ) {
+ displayed = TRUE;
+ }
+
+ if ( slm->status & INFO_VALID ) {
+ depth = 10000;
+ }
+
+ if ( slm->status & INFO_NEW ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~(INFO_OLD|INFO_NEW) );
+ }
+ }
+
+ slm = slm->next_brother;
+
+ }
+
+ }
+
+ // Now that we've found all the children at this level let's
+ // go look at lower levels for their kids if required.
+
+ if ( depth && count ) {
+
+ slm = VLM_GetNextSLM( parent_slm );
+
+ while ( slm ) {
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_VALID ) || refresh ) {
+
+ BytesNeeded = strsize( base_path ) + strsize( slm->name );
+ if ( buffer_size < BytesNeeded ) {
+ free( buffer );
+ buffer = malloc( BytesNeeded );
+ buffer_size = BytesNeeded;
+ }
+
+ if ( strlen( base_path ) ) {
+ strcpy( buffer, base_path );
+ strcat( buffer, TEXT("\\") );
+ strcat( buffer, slm->name );
+ }
+ else {
+ strcpy( buffer, slm->name );
+ }
+
+ if ( VLM_CheckForChildren( slm_list, slm, buffer,
+ depth - 1, refresh ) ) {
+ slm->status |= INFO_SUBS;
+ }
+ else {
+ slm->status &= ~INFO_SUBS;
+ slm->status |= INFO_VALID;
+ }
+
+ // Only for refresh.
+
+ if ( displayed ) {
+ slm->status |= INFO_DISPLAY;
+ }
+ }
+
+ // Step over the children found already
+
+ slm = slm->next_brother;
+ }
+ }
+
+ }
+
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ if ( file_count ) {
+ SLM_SetStatus( parent_slm, SLM_GetStatus( parent_slm ) & (UINT16)~INFO_EMPTY );
+ }
+ else {
+ SLM_SetStatus( parent_slm, SLM_GetStatus( parent_slm ) | (UINT16)INFO_EMPTY );
+ }
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ free( buffer );
+ free( dblk );
+ return( count );
+}
+
+
+INT VLM_HandleFSError( INT error ) {
+
+ switch ( error ) {
+
+ case FS_NO_MORE:
+ case FAILURE:
+ case SUCCESS:
+ default:
+ break;
+
+ case FS_ACCESS_DENIED:
+ WM_MsgBox( ID(IDS_BACKUPERRORTITLE ),
+ ID(IDS_VLMACCESSDENIEDMSG ),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+ break;
+
+ case FS_DEVICE_ERROR:
+ case FS_COMM_FAILURE:
+
+ WM_MsgBox( ID( IDS_BACKUPERRORTITLE ),
+ ID(IDS_VLMDEVICEERRORMSG),
+ WMMB_OK,
+ WMMB_ICONEXCLAMATION );
+ break;
+
+ }
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ Used to insert an slm into a disk based tree.
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_InsertDiskSLM(
+Q_HEADER_PTR slm_list,
+SLM_OBJECT_PTR parent_slm,
+SLM_OBJECT_PTR prev_slm,
+SLM_OBJECT_PTR new_slm )
+{
+
+ SLM_OBJECT_PTR temp_slm; // used to move through list
+ SLM_OBJECT_PTR best_slm; // insert after this guy
+ SLM_OBJECT_PTR last_brother; // new guy's prev brother after insertion
+ SLM_OBJECT_PTR next_brother; // new guy's next brother after insertion
+ INT level; // height of new guy in tree
+
+
+ // Get height of new item.
+
+ level = new_slm->level;
+
+ // Now find the right location to insert the new slm among his brothers.
+
+ best_slm = parent_slm;
+
+ last_brother = NULL;
+ next_brother = NULL;
+
+ // Try to skip a bunch of the brothers, to speed the insertion.
+
+ if ( prev_slm != NULL ) {
+
+ if ( stricmp( prev_slm->name, new_slm->name ) < 0 ) {
+
+ best_slm = prev_slm;
+ last_brother = best_slm;
+ }
+ }
+
+ temp_slm = best_slm;
+
+ if ( best_slm->level < level ) {
+
+ temp_slm = VLM_GetNextSLM( best_slm );
+ if ( ( temp_slm != NULL ) && ( temp_slm->level != level ) ) {
+ temp_slm = NULL;
+ }
+ }
+
+ // Look through all this guys brothers for correct insertion spot.
+ // temp_slm is NULL or first brother in family.
+
+ while ( temp_slm ) {
+
+ next_brother = temp_slm;
+
+ if ( stricmp( temp_slm->name, new_slm->name ) >= 0 ) {
+
+ // Get out of while loop, we have found the
+ // correct brother to insert before.
+ break;
+ }
+
+ last_brother = temp_slm;
+ best_slm = temp_slm;
+ temp_slm = temp_slm->next_brother;
+ }
+
+ // Insert after best_slm and any children > level.
+ // best_slm may have children and we need to insert after those kids.
+
+ if ( ( best_slm->level == level ) && ( best_slm->next_brother != NULL ) ) {
+
+ // If same height get last kid slm before next brother.
+
+ best_slm = VLM_GetPrevSLM( best_slm->next_brother );
+
+ }
+ else {
+
+ temp_slm = best_slm;
+
+ while ( temp_slm ) {
+
+ if ( temp_slm->level < level ) {
+
+ break;
+ }
+
+ best_slm = temp_slm;
+
+ if ( temp_slm->next_brother != NULL ) {
+ temp_slm = temp_slm->next_brother;
+ }
+ else {
+ temp_slm = VLM_GetNextSLM( temp_slm );
+ }
+
+ }
+ }
+
+ // Update the next_brother pointers.
+
+ if ( last_brother != NULL ) {
+
+ // new_slm is not the first brother.
+
+ new_slm->next_brother = last_brother->next_brother;
+ last_brother->next_brother = new_slm;
+ }
+ else {
+
+ // We need to set this guy's next brother if he has one.
+ // new_slm has become the first brother in the family.
+
+ new_slm->next_brother = next_brother;
+ }
+
+ // Perform insertion.
+
+ InsertElem( slm_list, &(best_slm->q_elem), &(new_slm->q_elem), AFTER );
+}
+
+
+/***************************************************
+
+ Name: VLM_SlmSetSelect
+
+ Description:
+
+ The callback function that is used when the display manager wants
+ me to change the selection status of a subdirectory. This function
+ is rather long and complicated so be careful changing it. When the
+ selection status of a subdirectory changes the changes must be
+ propagated everywhere, up and down the tree, and possibly in the
+ files display window also.
+
+*****************************************************/
+
+static VOID_PTR VLM_SlmSetSelect(
+SLM_OBJECT_PTR slm, // I - current slm
+BYTE attr ) // I - what to set him to
+{
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ SLM_OBJECT_PTR temp_slm;
+ BSD_PTR bsd_ptr;
+ FSE_PTR fse_ptr;
+ CHAR_PTR s;
+ INT16 path_len;
+ UINT32 status;
+ INT16 error;
+ INT level;
+ HWND window;
+ BOOL all_subdirs;
+ BE_CFG_PTR bec_config;
+ DATE_TIME sort_date;
+ CHAR *path;
+ BSET_OBJECT_PTR bset;
+ INT total_dirs;
+ INT total_files;
+ UINT64 total_bytes;
+ BOOLEAN u64_stat;
+ UINT32 old_status;
+
+
+ all_subdirs = CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ // Change the selection status of the item requested
+
+ if ( attr ) {
+
+ if ( all_subdirs ) {
+
+ // include all subdirs
+
+ status = INFO_SELECT;
+ }
+ else {
+ status = (INFO_SELECT|INFO_PARTIAL);
+ }
+ }
+ else {
+ status = 0;
+ }
+
+ window = slm->XtraBytes->hWnd;
+ wininfo = WM_GetInfoPtr( window );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( window );
+
+ old_status = slm->status;
+
+ if ( status != (UINT16)( slm->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ slm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ slm->status |= status;
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMUPDATEITEM, (LMHANDLE)slm, 0 );
+ }
+
+ // Find the correct BSD
+
+ if ( appinfo->dle != NULL ) {
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ BSD_Add( bsd_list, &bsd_ptr, bec_config,
+ NULL, appinfo->dle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+ }
+ }
+ else {
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ appinfo->tape_fid,
+ appinfo->bset_num );
+
+ if ( bsd_ptr == NULL ) {
+
+ bec_config = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( bec_config );
+
+ VLM_GetSortDate( appinfo->tape_fid, appinfo->bset_num, &sort_date );
+
+ bset = VLM_FindBset( appinfo->tape_fid, appinfo->bset_num );
+
+ BSD_Add( tape_bsd_list, &bsd_ptr, bec_config, NULL,
+ NULL, bset->tape_fid, bset->tape_num, bset->bset_num, NULL, &sort_date );
+
+ if ( bsd_ptr != NULL ) {
+
+ VLM_FillInBSD( bsd_ptr );
+ }
+ }
+ }
+
+ // Add this new selection to the FSE list for this BSD
+
+ path = VLM_BuildPath( slm );
+ path_len = 2;
+ s = path;
+ while ( *s ) {
+ if ( *s == TEXT('\\') ) {
+ *s = TEXT( '\0' );
+ }
+ s++;
+ path_len += sizeof(CHAR);
+ }
+
+ if ( attr ) {
+ error = BSD_CreatFSE( &fse_ptr, (INT16) INCLUDE, (INT8_PTR)path, (INT16) path_len,
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) all_subdirs );
+ }
+ else {
+ error = BSD_CreatFSE( &fse_ptr, (INT16) EXCLUDE, (INT8_PTR)path, (INT16) path_len,
+ (INT8_PTR)ALL_FILES, ALL_FILES_LENG,
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) TRUE );
+ }
+
+ free( path );
+
+ if ( error ) {
+ return NULL;
+ }
+
+ if ( bsd_ptr != NULL ) {
+ BSD_AddFSE( bsd_ptr, fse_ptr );
+ }
+
+ if ( appinfo->dle == NULL ) {
+ VLM_UpdateSearchSelections( appinfo->tape_fid, appinfo->bset_num );
+ }
+
+ // If no fse's then clear whole window and return
+
+ if ( BSD_GetMarkStatus( bsd_ptr ) == NONE_SELECTED ) {
+
+ VLM_DeselectAll( wininfo, TRUE );
+ return NULL;
+ }
+
+ // save a pointer to the original slm
+
+ temp_slm = slm;
+
+ // see if the current files displayed are from this guy
+
+ if ( SLM_GetStatus( slm ) & INFO_OPEN ) {
+
+ // They are so select/deselect all of them
+
+ if ( attr ) {
+ VLM_FileListManager( appinfo->win, FLM_SEL_ALL );
+ }
+ else {
+ VLM_FileListManager( appinfo->win, FLM_SEL_NONE );
+ }
+ }
+ else {
+
+ // We need to find this guys parent and see if its the open slm.
+ // If so then we need to have the file window update the same item
+ // in it. This subdirectory name is in both windows at same time.
+
+ if ( (slm->level != 0) && ! (slm->status & INFO_OPEN) ) {
+
+ level = slm->level;
+
+ do {
+ slm = VLM_GetPrevSLM( slm );
+
+ } while ( slm->level != level - 1 );
+
+ if ( SLM_GetStatus( slm ) & INFO_OPEN ) {
+ VLM_UpdateFLMItem( window, temp_slm );
+ }
+ }
+ }
+
+ // mark all this guys child subdirectories
+
+ slm = temp_slm;
+
+ status = slm->status;
+ slm->status = old_status;
+ VLM_MarkAllSLMChildren( slm, attr, &total_dirs, &total_files, &total_bytes );
+ slm->status = status;
+
+ // Now lets start marking all this guys parents
+
+ if ( slm->level == 0 ) {
+
+ VLM_UpdateRoot( window );
+ }
+ else {
+
+ level = slm->level - 1;
+
+ do {
+
+ // Is it a parent directory ?
+
+ if ( slm->level == level ) {
+
+ if ( ! ( slm->status & INFO_SELECT ) ) {
+ total_dirs++;
+ }
+
+ if ( VLM_MatchSLM( slm, bsd_ptr ) == FALSE ) {
+ break;
+ }
+ else {
+
+ // It changed, if it's parent is the open SLM then
+ // this slm is also diplayed in the files window.
+
+ temp_slm = VLM_GetParentSLM( slm );
+
+ if ( temp_slm && ( SLM_GetStatus( temp_slm ) & INFO_OPEN ) ) {
+ VLM_UpdateFLMItem( window, slm );
+ }
+
+ }
+
+ // Special case root to set disk, tape, or server also.
+
+ if ( slm->level == 0 ) {
+ VLM_UpdateRoot( window );
+ }
+
+ level--;
+ }
+
+ slm = VLM_GetPrevSLM( slm );
+
+ } while ( slm != NULL );
+ }
+
+ return(NULL);
+}
+
+/*****************************
+
+ Update the selection status of a single slm. Return true if it
+ changed, false if it was correct already.
+
+******************************/
+
+INT VLM_MatchSLM(
+SLM_OBJECT_PTR slm,
+BSD_PTR bsd_ptr ) //I - BSD to match against
+{
+ HWND win;
+ WININFO_PTR wininfo;
+ FSE_PTR fse;
+ CHAR *path;
+ CHAR_PTR s;
+ INT16 result;
+ INT16 path_len;
+ UINT16 status;
+ DATE_TIME mod_date;
+ INT fChanged = FALSE;
+
+ if ( slm == NULL ) {
+ return( FALSE );
+ }
+
+ win = slm->XtraBytes->hWnd;
+
+ path = VLM_BuildPath( slm );
+ s = path;
+ path_len = 0;
+ while ( *s ) {
+ if ( *s == TEXT('\\') ) *s = TEXT( '\0' );
+ s++;
+ path_len++;
+ }
+ path_len++;
+
+ DateTimeDOS( slm->date, slm->time, &mod_date );
+
+ path_len *= sizeof( CHAR );
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL,
+ path,
+ path_len,
+ slm->attrib,
+ &mod_date, NULL, NULL, FALSE, TRUE );
+
+ free( path );
+
+ status = 0;
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+ status = INFO_SELECT | INFO_PARTIAL;
+ }
+
+ if ( result == BSD_PROCESS_ENTIRE_DIR ) {
+ status = INFO_SELECT;
+ }
+
+ // if selection status has changed, update it
+
+ if ( (UINT16)( slm->status & (INFO_SELECT|INFO_PARTIAL) ) != status ) {
+
+ fChanged = TRUE;
+ slm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ slm->status |= status;
+
+ DLM_Update( win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+
+ }
+
+ return( fChanged );
+}
+
+
+
+
+/***************************************************
+
+ Name: VLM_SlmGetSelect
+
+ Description:
+
+ The callback function that is used when the display manager wants
+ to get the selection status for a subdirectory.
+
+*****************************************************/
+
+static BYTE VLM_SlmGetSelect( SLM_OBJECT_PTR slm )
+{
+ if ( SLM_GetStatus( slm ) & INFO_SELECT ) {
+ return( 1 );
+ }
+
+ return( 0 );
+}
+
+/***************************************************
+
+ Name: VLM_SlmSetTag
+
+ Description:
+
+ The callback function that is used when the display manager wants
+ to set the tag status for a subdirectory.
+
+*****************************************************/
+
+static VOID_PTR VLM_SlmSetTag( SLM_OBJECT_PTR slm, BYTE attr )
+{
+ if ( attr ) {
+ slm->status |= INFO_TAGGED;
+ }
+ else {
+ slm->status &= ~INFO_TAGGED;
+ }
+ return(NULL);
+}
+
+/***************************************************
+
+ Name: VLM_SlmGetTag
+
+ Description:
+
+ The callback function that is used when the display manager wants
+ to get the tag status for a subdirectory.
+
+*****************************************************/
+
+static BYTE VLM_SlmGetTag( SLM_OBJECT_PTR slm )
+{
+ if ( SLM_GetStatus( slm ) & INFO_TAGGED ) {
+ return( 1 );
+ }
+ return( 0 );
+}
+
+
+/***************************************************
+
+ Name: VLM_SlmGetItemCount
+
+ Description:
+
+ The callback function that is used when the display manager wants
+ to get the number of currently displayable directories. There are
+ often directories in the tree which are NOT displayed and these
+ are not counted.
+
+*****************************************************/
+
+static USHORT VLM_SlmGetItemCount( Q_HEADER_PTR ListHdr )
+{
+ USHORT count = 0;
+ SLM_OBJECT_PTR slm;
+
+ slm = VLM_GetFirstSLM( ListHdr );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_DISPLAY ) {
+ count++;
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ return( count );
+}
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_SlmGetFirstItem( Q_HEADER_PTR ListHdr )
+{
+ SLM_OBJECT_PTR slm;
+
+ slm = VLM_GetFirstSLM( ListHdr );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_DISPLAY ) {
+ return( slm );
+ }
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ return( slm );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR VLM_SlmGetPrevItem( SLM_OBJECT_PTR slm )
+{
+
+ do {
+
+ slm = VLM_GetPrevSLM( slm );
+
+ if ( slm == NULL ) {
+ break;
+ }
+
+ } while ( ! ( SLM_GetStatus( slm ) & INFO_DISPLAY ) );
+
+ return( slm );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_SlmGetNextItem( SLM_OBJECT_PTR slm )
+{
+ do {
+
+ slm = VLM_GetNextSLM( slm );
+
+ if ( slm == NULL ) {
+ break;
+ }
+ } while ( ! ( SLM_GetStatus( slm ) & INFO_DISPLAY ) );
+
+ return( slm );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR VLM_SlmGetObjects( SLM_OBJECT_PTR slm )
+{
+ BYTE_PTR memblk;
+ BYTE_PTR buff;
+ BYTE_PTR source;
+ WININFO_PTR wininfo;
+ DLM_ITEM_PTR item;
+ INT16 num_blocks;
+ INT i;
+
+ wininfo = SLM_GetXtraBytes( slm );
+
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( WMDS_GetWinTreeList( wininfo ) );
+
+ buff = memblk;
+
+ *buff++ = 3; // number of objects in list to display
+
+ // pass DLM the hierarchical stuff he needs for lines
+
+
+ num_blocks = (UINT16)(( slm->level / 32 ) + 1);
+
+ *buff++ = (BYTE)num_blocks;
+
+ source = (BYTE_PTR)slm->brothers;
+
+ for ( i = 0; i < ( 4 * num_blocks ); i++ ) {
+ *buff++ = *source++;
+ }
+
+ // Now start passing object data to display
+
+ item = (DLM_ITEM_PTR)buff;
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+
+ if ( slm->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( slm->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = (BYTE)SLM_GetLevel( slm );
+
+ item++;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+
+ switch ( slm->status & ( INFO_OPEN |
+ INFO_CORRUPT |
+ INFO_SUBS |
+ INFO_EXPAND |
+ INFO_EMPTY ) ) {
+
+ case ( INFO_EMPTY | INFO_CORRUPT | INFO_OPEN | INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EOCM;
+ break;
+
+ case ( INFO_EMPTY | INFO_CORRUPT | INFO_OPEN | INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EOCP;
+ break;
+
+ case ( INFO_EMPTY | INFO_CORRUPT | INFO_OPEN | INFO_EXPAND ) :
+ case ( INFO_EMPTY | INFO_CORRUPT | INFO_OPEN ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EOCN;
+ break;
+
+ case ( INFO_EMPTY | INFO_CORRUPT | INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_ECM;
+ break;
+
+ case ( INFO_EMPTY | INFO_CORRUPT | INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_ECP;
+ break;
+
+ case ( INFO_EMPTY | INFO_CORRUPT | INFO_EXPAND ) :
+ case ( INFO_EMPTY | INFO_CORRUPT ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_ECN;
+ break;
+
+ case ( INFO_EMPTY | INFO_OPEN | INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EOM;
+ break;
+
+ case ( INFO_EMPTY | INFO_OPEN | INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EOP;
+ break;
+
+ case ( INFO_EMPTY | INFO_OPEN | INFO_EXPAND ) :
+ case ( INFO_EMPTY | INFO_OPEN ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EON;
+ break;
+
+ case ( INFO_EMPTY | INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EM;
+ break;
+
+ case ( INFO_EMPTY | INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EP;
+ break;
+
+ case ( INFO_EMPTY | INFO_EXPAND ) :
+ case ( INFO_EMPTY ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER_EN;
+ break;
+
+ case ( INFO_CORRUPT | INFO_OPEN | INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERMINUSOPENC;
+ break;
+
+ case ( INFO_CORRUPT | INFO_OPEN | INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERPLUSOPENC;
+ break;
+
+ case ( INFO_CORRUPT | INFO_OPEN | INFO_EXPAND ) :
+ case ( INFO_CORRUPT | INFO_OPEN ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDEROPENC;
+ break;
+
+ case ( INFO_CORRUPT | INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERMINUSC;
+ break;
+
+ case ( INFO_CORRUPT | INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERPLUSC;
+ break;
+
+ case ( INFO_CORRUPT | INFO_EXPAND ) :
+ case ( INFO_CORRUPT ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERC;
+ break;
+
+ case ( INFO_OPEN | INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERMINUSOPEN;
+ break;
+
+ case ( INFO_OPEN | INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERPLUSOPEN;
+ break;
+
+ case ( INFO_OPEN | INFO_EXPAND ) :
+ case ( INFO_OPEN ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDEROPEN;
+ break;
+
+ case ( INFO_SUBS | INFO_EXPAND ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERMINUS;
+ break;
+
+ case ( INFO_SUBS ) :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDERPLUS;
+ break;
+
+ default :
+
+ DLM_ItemwId( item ) = IDRBM_FOLDER;
+ break;
+
+ }
+
+ DLM_ItembLevel( item ) = (BYTE)SLM_GetLevel( slm );
+ DLM_ItembMaxTextLen( item ) = 0;
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)(strlen( SLM_GetName( slm ) ) + 1);
+ DLM_ItembLevel( item ) = (BYTE)SLM_GetLevel( slm );
+ strcpy( (CHAR_PTR)DLM_ItemqszString( item ), (CHAR_PTR)SLM_GetName( slm ) );
+
+ return( memblk );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BOOLEAN VLM_SlmSetObjects(
+SLM_OBJECT_PTR slm, // I
+WORD operation, // I
+WORD ObjectNum ) // I
+{
+ HWND window;
+ INT level;
+ INT16 count;
+ INT ret;
+ WININFO_PTR wininfo;
+ CHAR volume_name[ VLM_BUFFER_SIZE ];
+ CHAR_PTR directory;
+ CHAR_PTR new_path;
+ CHAR_PTR s;
+ CHAR *path;
+ CHAR keyb_char;
+ SLM_OBJECT_PTR slm2;
+ SLM_OBJECT_PTR temp_slm;
+ BOOLEAN found = FALSE;
+ Q_HEADER_PTR slm_list;
+ APPINFO_PTR appinfo;
+
+ CHAR msg_title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR msg_text[ MAX_UI_RESOURCE_SIZE ];
+
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_slm = slm;
+
+ do {
+
+ temp_slm = VLM_GetNextSLM( temp_slm );
+
+ if ( temp_slm != NULL ) {
+
+ if ( SLM_GetStatus( temp_slm ) & INFO_DISPLAY ) {
+
+ if ( keyb_char == (CHAR)toupper( *SLM_GetName( temp_slm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( SLM_GetXtraBytes( temp_slm ) ),
+ 0,
+ (LMHANDLE)temp_slm );
+ return( TRUE );
+ }
+ }
+ }
+
+ } while ( temp_slm != NULL );
+
+ temp_slm = VLM_GetFirstSLM( WMDS_GetTreeList( SLM_GetXtraBytes( slm ) ) );
+
+ while ( temp_slm != NULL && temp_slm != slm ) {
+
+ if ( SLM_GetStatus( temp_slm ) & INFO_DISPLAY ) {
+
+ if ( keyb_char == (CHAR)toupper( *SLM_GetName( temp_slm ) ) ) {
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( SLM_GetXtraBytes( temp_slm ) ),
+ 0,
+ (LMHANDLE)temp_slm );
+ return( TRUE );
+ }
+ }
+
+ temp_slm = VLM_GetNextSLM( temp_slm );
+
+ }
+
+ return( FALSE );
+ }
+
+
+ // If it's a single click then just change the file list. If its a
+ // double click then expand/contract the tree and don't change the
+ // file list. This works because whenever I'm sent a double click
+ // it is always preceeded by a single click on the same object.
+
+ // Contracting the tree is done by marking directory items as so
+ // they are not displayed. They are left in the list forever.
+
+ wininfo = SLM_GetXtraBytes( slm );
+
+ window = WMDS_GetWin( wininfo );
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( window );
+
+ if ( ( operation == WM_DLMDOWN ) &&
+ ( ObjectNum == 3 || ObjectNum == 2 ) ) {
+
+ if ( slm != appinfo->open_slm ) {
+
+ WM_ShowWaitCursor( TRUE );
+
+ slm2 = appinfo->open_slm;
+ slm2->status &= ~INFO_OPEN;
+
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm2, 0 );
+
+ slm->status |= INFO_OPEN;
+ appinfo->open_slm = slm;
+
+ path = VLM_BuildPath( slm );
+
+ directory = malloc( strsize( path ) + VLM_BUFFER_SIZE );
+
+ if ( appinfo->dle != NULL ) {
+
+ DLE_GetVolName( appinfo->dle, volume_name );
+
+ if ( volume_name[ strlen( volume_name ) - 1 ] != TEXT(':') ) {
+ strcat( volume_name, TEXT(":") );
+ }
+
+ sprintf( directory, TEXT("%s"), volume_name );
+ }
+ else {
+
+ sprintf( directory, TEXT("%s-%s:"),
+ VLM_GetTapeName( appinfo->tape_fid ),
+ VLM_GetBsetName( appinfo->tape_fid, appinfo->bset_num ) );
+ }
+
+ if ( SLM_GetLevel( slm ) != 0 ) {
+ strcat( directory, TEXT("\\") );
+ }
+
+ strcat( directory, path );
+ free( path );
+
+ // Change the displayed files
+
+ VLM_HandleFSError( VLM_FileListReuse( appinfo->win, directory ) ) ;
+
+ // Change the title
+
+ strcat( directory, TEXT("\\*.*") );
+ WM_SetTitle( window, directory );
+
+ free( directory );
+
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+
+ WM_ShowWaitCursor( FALSE );
+ }
+ }
+
+ // Look for an expansion or not
+
+ if ( ( operation == WM_DLMDBCLK ) &&
+ ( ObjectNum == 2 || ObjectNum == 3 ) ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_SUBS ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_EXPAND ) {
+
+ level = SLM_GetLevel( slm );
+ slm->status &= ~INFO_EXPAND;
+ slm2 = slm;
+ count = 0;
+
+ do {
+
+ slm2 = VLM_GetNextSLM( slm2 );
+
+ if ( slm2 == NULL ) break;
+
+ if ( SLM_GetLevel( slm2 ) <= level ) break;
+
+ if ( SLM_GetStatus( slm2 ) & INFO_DISPLAY ) {
+
+ slm2->status &= ~(INFO_DISPLAY|INFO_EXPAND);
+ count++;
+ }
+
+ } while ( TRUE );
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMDELETEITEMS,
+ (LMHANDLE)slm, count );
+ }
+ else {
+
+ WM_ShowWaitCursor( TRUE );
+
+ slm->status |= INFO_EXPAND;
+
+ if ( ! ( SLM_GetStatus( slm ) & INFO_VALID ) ) {
+
+ new_path = VLM_BuildPath( slm );
+
+ if ( VLM_CheckForChildren( slm_list,
+ slm,
+ new_path,
+ 1, // <- depth to search
+ FALSE) ) {
+
+ slm->status |= INFO_SUBS;
+ }
+
+ free( new_path );
+
+ slm->status |= INFO_VALID;
+
+ }
+
+ slm2 = slm;
+ level = SLM_GetLevel( slm );
+ count = 0;
+
+ do {
+
+ slm2 = VLM_GetNextSLM( slm2 );
+
+ if ( slm2 == NULL ) {
+ break;
+ }
+
+ if ( ( slm2->level == level + 1 ) &&
+ ! ( SLM_GetStatus( slm2 ) & INFO_DISPLAY ) ) {
+
+ count++;
+
+ slm2->status |= INFO_DISPLAY;
+ }
+ else {
+
+ if ( SLM_GetLevel( slm2 ) <= level ) {
+ break;
+ }
+ }
+
+ } while ( TRUE );
+
+ STM_DrawIdle();
+
+ VLM_UpdateBrothers( slm_list );
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMADDITEMS,
+ (LMHANDLE)slm, count );
+
+ WM_ShowWaitCursor( FALSE );
+ }
+ }
+ }
+
+ return( FALSE );
+}
+
+// The idea here is to work backwords up the list, throw away any entries
+// that are at a deeper level than the current one. And replace the
+// Nth level entry in our path with each new entry we hit at level N until
+// we finally hit the first level 1 entry, then stop.
+
+// finish with path[] = DOS\BRIEF\BACKUP
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+CHAR_PTR VLM_BuildPath( SLM_OBJECT_PTR slm ) // I
+{
+ INT level;
+ INT i;
+ INT path_size = 0;
+ INT BytesNeeded;
+ CHAR_PTR temp;
+ CHAR_PTR path;
+ CHAR_PTR s;
+
+
+ level = SLM_GetLevel( slm );
+
+ BytesNeeded = strsize( SLM_GetName( slm ) ) + ( level * sizeof(CHAR) );
+ path = malloc( BytesNeeded );
+ path_size = BytesNeeded;
+
+ if ( level == 0 ) {
+ *path = TEXT( '\0' );
+ return( path );
+ }
+
+ if ( level == 1 ) {
+ strcpy( path, SLM_GetName( slm ) );
+ return( path );
+ }
+
+ s = path;
+ for ( i = 1; i < level; i++ ) {
+ *s++ = TEXT('\\');
+ }
+ strcpy( s, SLM_GetName( slm ) ); // append the last entry in our new path.
+
+ while ( slm != NULL ) {
+
+ slm = VLM_GetPrevSLM( slm );
+
+ if ( slm == NULL ) {
+ break;
+ }
+
+ if ( SLM_GetLevel( slm ) >= level ) {
+ continue;
+ }
+
+ path = VLM_ReplaceEntry( path, &path_size, SLM_GetName( slm ), SLM_GetLevel( slm ) );
+
+ if ( SLM_GetLevel( slm ) == 1 ) {
+ break;
+ }
+
+ }
+
+ return( path );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ given JOHN \ PAUL \ HERB 0, MARGARET, 2
+ produces JOHN \ MARGARET \ HERB 0
+
+ RETURNS :
+
+**********************/
+
+static CHAR_PTR VLM_ReplaceEntry( CHAR_PTR path, INT *path_size, CHAR_PTR name, INT depth )
+{
+ INT i, start, index;
+ INT needed, avail;
+ INT BytesNeeded;
+ CHAR_PTR s, t1, t2;
+ CHAR_PTR temp;
+
+ start = 0;
+ s = path;
+ for ( i = 1; i < depth; i++ ) {
+ while ( *s && *s != TEXT('\\') ) {
+ s++;
+ start++;
+ }
+ s++;
+ start++;
+ }
+
+ avail = 0;
+ while ( s[avail] && s[avail] != TEXT('\\') ) {
+ avail++;
+ }
+
+ if ( avail != 0 ) {
+ return( path ); // someone screwed up !
+ }
+
+ needed = strlen( name );
+
+ if ( needed > avail ) {
+ BytesNeeded = *path_size + ((needed - avail) * sizeof(CHAR));
+ temp = (CHAR *)malloc( BytesNeeded );
+ memcpy( (BYTE *)temp, (BYTE *)path, *path_size );
+ *path_size = BytesNeeded;
+ free( path );
+ path = temp;
+ }
+
+ t1 = path + strlen(path) + needed - avail; // ...\abcdef\...0
+ t2 = path + strlen(path);
+ s = path + start;
+
+ index = strlen(path) - start - avail + 1;
+ for ( i = 0; i < index; i++ ) {
+ *t1-- = *t2--;
+ }
+ while ( *name ) {
+ *s++ = *name++;
+ }
+ if ( *s ) *s = TEXT('\\');
+
+ return( path );
+}
diff --git a/private/utils/ntbackup/src/vlm_util.c b/private/utils/ntbackup/src/vlm_util.c
new file mode 100644
index 000000000..d34be18c8
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_util.c
@@ -0,0 +1,2162 @@
+
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_UTIL.C
+
+ Description:
+
+ A lot of utility functions for dealing with the display lists for
+ disks, tapes, and servers.
+
+ $Log: G:\UI\LOGFILES\VLM_UTIL.C_V $
+
+ Rev 1.70.1.1 12 Dec 1993 19:58:58 MikeP
+put code back into vlm_validatepath
+
+ Rev 1.70.1.0 08 Dec 1993 11:44:30 MikeP
+very deep pathes and unicode
+
+ Rev 1.70 05 Aug 1993 17:35:42 MARINA
+enable c++
+
+ Rev 1.69 29 Jul 1993 23:27:42 MIKEP
+yank mapi.h
+
+ Rev 1.68 21 Jul 1993 17:10:08 CARLS
+change to tbrparse call
+
+ Rev 1.67 17 Jun 1993 15:33:56 Aaron
+Removed the meat of VLM_ValidatePath for Bimini (following lead of
+Nostradamus and Cayman).
+
+ Rev 1.66 15 Jun 1993 17:01:04 Aaron
+For display of local drives only, look at device type instead of
+lack of SUPPORTS_CHILDREN. Accept NTFS or DOS drive types.
+
+ Rev 1.65 01 Jun 1993 15:51:00 MIKEP
+make drive letter case match winfile
+
+ Rev 1.64 12 May 1993 08:27:38 MIKEP
+Fix upper/lower case support.
+
+ Rev 1.63 23 Apr 1993 10:19:22 MIKEP
+Add ability to refresh tapes window.
+Add support for sorting files window by various methods.
+Fix refresh of sorting windows.
+
+ Rev 1.62 05 Apr 1993 03:09:12 DARRYLP
+Prep work for email addition to Cayman.
+
+ Rev 1.61 30 Mar 1993 15:19:58 DARRYLP
+Added Net Connect and Disconnect.
+
+ Rev 1.60 11 Mar 1993 17:25:48 STEVEN
+fix trap on exit bug
+
+ Rev 1.59 18 Feb 1993 10:42:24 BURT
+Changes for CAYMAN
+
+
+ Rev 1.58 20 Jan 1993 20:47:22 MIKEP
+change status to 32bits
+
+ Rev 1.57 17 Nov 1992 21:22:32 DAVEV
+unicode fixes
+
+ Rev 1.56 15 Nov 1992 17:41:44 MIKEP
+cleanup and bug fixes
+
+ Rev 1.55 05 Nov 1992 17:23:14 DAVEV
+fix ts
+
+ Rev 1.53 30 Oct 1992 15:46:10 GLENN
+Added Frame and MDI Doc window size and position saving and restoring.
+
+ Rev 1.52 07 Oct 1992 15:07:34 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.51 07 Oct 1992 14:04:24 DAVEV
+various unicode chgs
+
+ Rev 1.50 05 Oct 1992 16:29:34 GLENN
+Reintegrated changes from 1.47 to the tip. DaveV checked in over 1.48.
+Added Net Connect and Disconnect. Now pulling BKS extension from resources.
+
+ Rev 1.49 04 Oct 1992 19:43:46 DAVEV
+Unicode Awk pass
+
+ Rev 1.48 30 Sep 1992 10:40:02 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.46 11 Sep 1992 14:25:54 GLENN
+Changed DLE search to key off of Child Support.
+
+ Rev 1.45 03 Sep 1992 13:18:02 MIKEP
+nt fixes for volume labels
+
+ Rev 1.43 04 Aug 1992 17:00:28 CHUCKB
+Removed an errant (?) msassert.
+
+ Rev 1.42 29 Jul 1992 09:53:42 MIKEP
+ChuckB checked in after NT warnings were fixed.
+
+ Rev 1.41 20 Jul 1992 09:58:04 JOHNWT
+gas gauge display work
+
+ Rev 1.40 10 Jul 1992 08:34:30 JOHNWT
+more gas guage work
+
+ Rev 1.39 07 Jul 1992 15:41:24 MIKEP
+unicode changes
+
+ Rev 1.38 30 Jun 1992 13:17:32 JOHNWT
+dynamically alloc stats
+
+ Rev 1.37 29 Jun 1992 10:42:40 JOHNWT
+added selected dir counts
+
+ Rev 1.36 19 Jun 1992 14:43:30 JOHNWT
+more gas
+
+ Rev 1.35 10 Jun 1992 14:20:48 JOHNWT
+msoft'ed startup.bks processing
+
+ Rev 1.34 10 Jun 1992 11:49:24 JOHNWT
+gas guage changes
+
+ Rev 1.33 09 Jun 1992 15:14:36 JOHNWT
+gas gauge work
+
+ Rev 1.32 02 Jun 1992 08:05:52 MIKEP
+kludge to validate path
+
+ Rev 1.31 14 May 1992 18:05:28 MIKEP
+nt pass 2
+
+ Rev 1.30 06 May 1992 14:40:26 MIKEP
+unicode pass two
+
+ Rev 1.29 04 May 1992 13:39:38 MIKEP
+unicode pass 1
+
+
+****************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+#ifndef OEM_MSOFT
+// If we are doing Wind for Wkgrps (EMAIL would be more proper)
+#ifdef WFW
+ #include "mapinit.h"
+#ifndef CAYMAN
+ #define API FAR PASCAL
+ #include "winnet.h"
+#endif
+#endif
+
+#endif // OEM_MSOFT
+
+
+
+/**********************
+
+ NAME : VLM_DeselectAll
+
+ DESCRIPTION : remove all selections from SLM/FLM lists
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_DeselectAll( WININFO_PTR wininfo, BOOLEAN display )
+{
+
+ SLM_OBJECT_PTR slm;
+ FLM_OBJECT_PTR flm;
+ HWND window;
+
+ slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) );
+ window = slm->XtraBytes->hWnd;
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetStatus( slm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+
+ if ( display ) {
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+
+ }
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ flm = VLM_GetFirstFLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( flm != NULL ) {
+
+ if ( FLM_GetStatus( flm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ FLM_SetStatus( flm, FLM_GetStatus( flm ) & (UINT16)~(INFO_SELECT|INFO_PARTIAL) );
+
+ if ( display ) {
+ DLM_Update( window, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)flm, 0 );
+ }
+ }
+ flm = VLM_GetNextFLM( flm );
+ }
+
+ if ( display ) {
+ VLM_UpdateRoot( window );
+ }
+
+ return;
+}
+
+
+/**********************
+
+ NAME : VLM_Deinit
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_Deinit()
+{
+ HWND win;
+ HWND close_win = (HWND)NULL;
+ WININFO_PTR wininfo;
+
+ win = WM_GetNext( (HWND)NULL );
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+ if ( ( wininfo->wType == WMTYPE_DISKTREE ) ||
+ ( wininfo->wType == WMTYPE_TAPETREE )
+#ifdef OEM_EMS
+ || ( wininfo->wType == WMTYPE_EXCHANGE )
+#endif
+ ) {
+ close_win = win;
+ }
+
+ win = WM_GetNext( win );
+
+ if ( close_win ) {
+ WM_Destroy( close_win );
+ close_win = (HWND)NULL;
+ }
+ }
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( ( wininfo->wType == WMTYPE_DISKS ) ||
+ ( wininfo->wType == WMTYPE_SERVERS ) ||
+ ( wininfo->wType == WMTYPE_TAPES )
+#ifdef OEM_EMS
+ || ( wininfo->wType == WMTYPE_EXCHANGE )
+#endif
+ ) {
+ close_win = win;
+ }
+
+ switch ( wininfo->wType ) {
+
+ case WMTYPE_DISKS:
+ CDS_WriteDiskWinSize ( win );
+ break;
+
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE:
+ break;
+#endif
+
+ case WMTYPE_SERVERS:
+ CDS_WriteServerWinSize ( win );
+ break;
+
+ case WMTYPE_TAPES:
+ CDS_WriteTapeWinSize ( win );
+ break;
+
+ }
+
+ win = WM_GetNext( win );
+
+ if ( close_win ) {
+ WM_Destroy( close_win );
+ close_win = (HWND)NULL;
+ }
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_FindVLMByName
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+VLM_OBJECT_PTR VLM_FindVLMByName( Q_HEADER_PTR vlm_list, CHAR_PTR name )
+{
+ VLM_OBJECT_PTR vlm;
+
+ vlm = VLM_GetFirstVLM( vlm_list );
+
+ while ( vlm != NULL ) {
+
+ if ( ! stricmp( name, VLM_GetName( vlm ) ) ) {
+ return( vlm );
+ }
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+ return( vlm );
+
+}
+
+
+/**********************
+
+ NAME : VLM_BuildVolumeList
+
+ DESCRIPTION :
+
+ This function constructs a list of VLM's by looking at the dle_list
+ which is a global list of drives and servers. If the gfServers
+ flag is set then servers are being displayed and mapped drives are
+ not included. Otherwise local drives and mapped drives are included.
+
+***********************/
+
+VOID VLM_BuildVolumeList(
+Q_HEADER_PTR vlm_list, // I - queue to use
+WININFO_PTR XtraBytes ) // I
+{
+ GENERIC_DLE_PTR dle;
+ GENERIC_DLE_PTR temp_dle;
+ VLM_OBJECT_PTR vlm;
+ CHAR label_buffer[ 256 ];
+ BOOL fGoodDLE;
+
+ // Run through dle list
+
+ DLE_GetFirst( dle_list, &dle );
+
+ do {
+
+ if ( gfServers ) {
+
+ fGoodDLE = FALSE;
+
+ // Only display local drives, servers have their own window.
+
+ while ( ( ! fGoodDLE ) && ( dle != NULL ) ) {
+
+ if ( ( DLE_GetDeviceType( dle ) == LOCAL_NTFS_DRV ) ||
+ ( DLE_GetDeviceType( dle ) == LOCAL_DOS_DRV ) ) {
+ fGoodDLE = TRUE;
+ }
+ else {
+ DLE_GetNext( &dle );
+ }
+
+ }
+
+ }
+ else {
+
+ fGoodDLE = FALSE;
+
+ // Display locals and mapped drives, no server window.
+
+ while ( ( ! fGoodDLE ) && ( dle != NULL ) ) {
+
+ if ( ! DLE_HasFeatures( dle, DLE_FEAT_SUPPORTS_CHILDREN ) ) {
+ fGoodDLE = TRUE;
+ }
+ else {
+ DLE_GetNext( &dle );
+ }
+
+ }
+
+ }
+
+ // Add our new DLE to the list that we will work with
+
+ if ( dle != NULL ) {
+
+ temp_dle = dle;
+ DLE_GetNext( &dle );
+
+ if ( VLM_FindVLMByName( vlm_list,
+ DLE_GetDeviceName( temp_dle ) ) == NULL ) {
+
+ VLM_GetDriveLabel( temp_dle, label_buffer, 256 );
+
+ vlm = VLM_CreateVLM( (INT16)(strlen( label_buffer ) * sizeof (CHAR)),
+ (INT16)(strlen( DLE_GetDeviceName( temp_dle ) ) * sizeof (CHAR)) );
+
+ if ( vlm != NULL ) {
+
+ VLM_SetLabel( vlm, label_buffer );
+ VLM_SetName( vlm, DLE_GetDeviceName( temp_dle ) );
+
+ strupr( VLM_GetName( vlm ) ); // always upper case E:
+
+ if ( ! strncmp( VLM_GetLabel( vlm ), TEXT( "\\\\" ), 2 ) ) {
+ strlwr( VLM_GetLabel( vlm ) );
+ }
+
+ VLM_SetXtraBytes( vlm, XtraBytes );
+ EnQueueElem( vlm_list, &(vlm->q_elem), FALSE );
+ }
+ }
+ }
+
+ } while ( dle != NULL );
+
+
+ VLM_SetMaxVolumeLabelLength( vlm_list );
+
+ SortQueue( vlm_list, VLM_VlmCompare );
+
+
+}
+
+
+/**********************
+
+ NAME : VLM_CreateVLM
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VLM_OBJECT_PTR VLM_CreateVLM( INT16 label_size, INT16 name_size )
+{
+ VLM_OBJECT_PTR vlm;
+
+ // We add two bytes for the 0's on the end of the strings in case
+ // the app forgets. We add another two bytes because the backup
+ // eng. under estimates the size of the volume name on AFP drives by
+ // 2 bytes.
+
+ vlm = (VLM_OBJECT_PTR)malloc( sizeof( VLM_OBJECT ) +
+ label_size + name_size + 4 * sizeof(CHAR) );
+
+ if ( vlm != NULL ) {
+
+ vlm->q_elem.q_ptr = vlm;
+ vlm->label = (CHAR_PTR)((INT8_PTR)vlm + sizeof( VLM_OBJECT ));
+ vlm->name = (CHAR_PTR)((INT8_PTR)vlm->label + label_size + 3*sizeof (CHAR));
+ vlm->parent = NULL;
+ InitQueue( &vlm->children );
+ vlm->status = 0;
+ }
+
+ return( vlm );
+}
+
+
+/******************
+
+
+ Try our best to get a label of some kind for the given drive.
+
+
+*******************/
+
+INT VLM_GetDriveLabel( GENERIC_DLE_PTR dle, CHAR_PTR buffer, INT buffer_size )
+{
+ INT i;
+
+ DLE_GetVolName( dle, buffer );
+
+ if ( strlen( buffer ) >= 3 ) {
+ for ( i = 0; i < buffer_size - 3; i++ ) {
+ buffer[ i ] = buffer[ i + 3 ];
+ }
+ }
+
+ return( SUCCESS );
+
+}
+
+/**********************
+
+ NAME : VLM_GetSetCreationDate
+
+ DESCRIPTION :
+
+ For the given tape family id and backup set, return the creation date of the lpwest numbered set available.
+
+**********************/
+
+
+BOOLEAN VLM_GetSetCreationDate( UINT32 tape_fid, INT16 bset_num, INT16 *date, INT16 *time )
+{
+
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == bset_num ) {
+ *date = bset->backup_date;
+ *time = bset->backup_time;
+ return( SUCCESS );
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ return( FAILURE );
+}
+
+
+
+/**********************
+
+ NAME : VLM_GetTapeCreationDate
+
+ DESCRIPTION :
+
+ For the given tape family id and backup set, return the creation date of the lpwest numbered set available.
+
+**********************/
+
+
+BOOLEAN VLM_GetTapeCreationDate( UINT32 tape_fid, INT16 *date, INT16 *time )
+{
+
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset = NULL;
+ BSET_OBJECT_PTR temp;
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+
+ temp = VLM_GetFirstBSET( &tape->bset_list );
+
+ if ( temp != NULL ) {
+
+ if ( bset == NULL ) {
+ bset = temp;
+ }
+
+ if ( temp->bset_num < bset->bset_num ) {
+ bset = temp;
+ }
+
+ }
+
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ if ( bset != NULL ) {
+ *time = bset->backup_time;
+ *date = bset->backup_date;
+ }
+
+ return( SUCCESS );
+}
+
+
+/**********************
+
+ NAME : VLM_GetTapeOwnersName
+
+ DESCRIPTION :
+
+ For the given tape family id and backup set, return the owners name.
+
+**********************/
+
+
+BOOLEAN VLM_GetTapeOwnersName( UINT32 tape_fid, CHAR_PTR buffer )
+{
+
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset = NULL;
+ BSET_OBJECT_PTR temp;
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+
+ temp = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( temp != NULL ) {
+
+ if ( bset == NULL ) {
+ bset = temp;
+ }
+
+ if ( bset->bset_num >= temp->bset_num ) {
+
+ strcpy( buffer, bset->user_name );
+ }
+
+ temp = VLM_GetNextBSET( temp );
+ }
+
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+
+ if ( bset == NULL ) {
+ strcpy( buffer, TEXT(" ") );
+ }
+
+ return( FAILURE );
+}
+
+
+/**********************
+
+ NAME : VLM_GetSetOwnersName
+
+ DESCRIPTION :
+
+ For the given tape family id and backup set, return the owners name.
+
+**********************/
+
+
+BOOLEAN VLM_GetSetOwnersName( UINT32 tape_fid, INT16 bset_num, CHAR_PTR buffer )
+{
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == bset_num ) {
+
+ strcpy( buffer, bset->user_name );
+ return( SUCCESS );
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ strcpy( buffer, TEXT(" ") );
+ return( FAILURE );
+}
+
+
+/**********************
+
+ NAME : VLM_GetVolumeName
+
+ DESCRIPTION :
+
+ For the given tape family id and backup set, return the volume name.
+
+**********************/
+
+
+CHAR_PTR VLM_GetVolumeName( UINT32 tape_fid, INT16 bset_num )
+{
+ TAPE_OBJECT_PTR tape;
+ BSET_OBJECT_PTR bset;
+
+ tape = VLM_GetFirstTAPE( );
+
+ while ( tape != NULL ) {
+
+ if ( tape->tape_fid == tape_fid ) {
+
+ bset = VLM_GetFirstBSET( &tape->bset_list );
+
+ while ( bset != NULL ) {
+
+ if ( bset->bset_num == bset_num ) {
+ return( bset->volume_name );
+ }
+
+ bset = VLM_GetNextBSET( bset );
+ }
+
+ }
+ tape = VLM_GetNextTAPE( tape );
+ }
+
+ return( NULL );
+}
+
+
+/**********************
+
+ NAME : VLM_RemoveUnusedBSDs
+
+ DESCRIPTION :
+
+ A tape function is about to happen and we want to remove any BSD's that
+ are not important, because they have no FSE's.
+
+ RETURNS : nothing.
+
+**********************/
+
+
+VOID VLM_RemoveUnusedBSDs( BSD_HAND bsd_list )
+{
+ BSD_PTR bsd, bsd_to_remove;
+
+ bsd = BSD_GetFirst( bsd_list );
+
+ while ( bsd != NULL ) {
+
+ /* Check if the BSD has any selections */
+
+ if ( BSD_GetMarkStatus( bsd ) == NONE_SELECTED ) {
+
+ /* No, then remove it */
+ bsd_to_remove = bsd;
+ bsd = BSD_GetNext( bsd );
+ BSD_Remove( bsd_to_remove );
+ }
+ else {
+ bsd = BSD_GetNext( bsd );
+ }
+
+ }
+}
+
+
+/***************************************************
+
+ Name: VLM_AnySelFiles ()
+
+ Description: checks msii directory for the existence of
+ any files containing file selection scripts
+
+ Modified:
+
+ Returns: BOOL true if any selection files were found;
+ false otherwise
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+INT VLM_AnySelFiles( )
+{
+ BOOLEAN rtn = FALSE; //Return value
+ VLM_FIND_PTR vlm_find = NULL;
+ CHAR *path;
+ CHAR file[VLM_MAXFNAME];
+
+ path = (CHAR *)malloc( strsize( CDS_GetUserDataPath() ) + 256 );
+
+ if ( path != NULL ) {
+
+ strcpy( path, CDS_GetUserDataPath() );
+ strcat( path, SELECTION_EXTENSION );
+
+ if ( vlm_find = VLM_FindFirst( path, VLMFIND_NORMAL, file ) ) {
+ rtn = TRUE;
+ VLM_FindClose( &vlm_find );
+ }
+
+ free( path );
+ }
+
+ return( rtn );
+}
+
+
+/***************************************************
+
+ Name: VLM_AnyDiskSelections
+
+ Description: Tells whether any files have been selected for backup
+ from the disk list.
+
+ Modified: 19 July 1991
+
+ Returns: TRUE if any files are selected; FALSE otherwise
+
+ Notes:
+
+ See also: VLM_AnyTapeSelections()
+
+*****************************************************/
+
+INT VLM_AnyDiskSelections( )
+{
+ BSD_PTR bsd;
+
+ bsd = BSD_GetFirst( bsd_list );
+
+ while ( bsd != NULL ) {
+
+ if ( BSD_GetMarkStatus ( bsd ) != NONE_SELECTED ) {
+ return( TRUE );
+ }
+ bsd = BSD_GetNext ( bsd );
+ }
+
+ return( FALSE );
+}
+
+/***************************************************
+
+ Name: VLM_AnyTapeSelections ()
+
+ Description: Tells whether any files have been selected for restore
+ from the tape list.
+
+ Modified: 19 July 1991
+
+ Returns: TRUE if any files are selected; FALSE otherwise
+
+ Notes:
+
+ See also: VLM_AnyDiskSelections()
+
+*****************************************************/
+
+INT VLM_AnyTapeSelections( )
+{
+ BSD_PTR bsd;
+
+ bsd = BSD_GetFirst( tape_bsd_list );
+
+ while ( bsd != NULL ) {
+
+ if ( BSD_GetMarkStatus( bsd ) != NONE_SELECTED ) {
+ return( TRUE );
+ }
+ bsd = BSD_GetNext( bsd );
+ }
+
+ return( FALSE );
+}
+
+/***************************************************
+
+ Name: VLM_LoadDefaultSelections ()
+
+ Description: checks to see if there is a file called default.bks;
+ if there is, that file is parsed, and the files it
+ specifies are selected as defaults
+
+ Modified: 9-12-91
+
+ Returns: VOID
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+VOID VLM_LoadDefaultSelections ( )
+{
+#if !defined ( OEM_MSOFT ) //unsupported feature
+
+ CHAR *path;
+ CHAR file[ VLM_MAXFNAME ];
+ CHAR text[ MAX_UI_RESOURCE_SIZE ];
+ CHAR exten[ MAX_UI_SMALLRES_SIZE ];
+ HWND win;
+ CDS_PTR cds_ptr;
+ WININFO_PTR wininfo;
+ VLM_FIND_PTR vlm_find = NULL;
+
+
+ path = malloc( strsize( CDS_GetMaynFolder() ) + 256 );
+
+ if ( path == NULL ) {
+ return;
+ }
+
+ RSM_StringCopy( IDS_VLMSTARTUPBKS, text, MAX_UI_RESOURCE_LEN );
+ RSM_StringCopy( IDS_SELECTIONEXTENSION, exten, MAX_UI_SMALLRES_LEN );
+
+ strcpy( path, CDS_GetMaynFolder() );
+ strcat( path, text );
+ strcat( path, exten );
+
+ if ( vlm_find = VLM_FindFirst ( path, VLMFIND_NORMAL, file ) ) {
+
+ // re-write the path with a @ as the first character,
+ // and call the parser
+
+ strcpy( path, TEXT( '@' ) );
+ strcat( path, CDS_GetMaynFolder() );
+ strcat( path, text );
+ strcat( path, exten );
+
+ cds_ptr = CDS_GetPerm();
+ tbrparse( &cds_ptr, dle_list, bsd_list, path, TBACKUP, NULL );
+
+ // update the windows to show the selections
+
+ win = WM_GetNext( (HWND) NULL );
+
+ while ( win != (HWND) NULL ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo->wType == WMTYPE_DISKTREE ) {
+
+ VLM_RematchList( win );
+ }
+ win = WM_GetNext( win );
+ }
+
+ VLM_UpdateDisks( );
+ VLM_UpdateServers( );
+
+ VLM_FindClose( &vlm_find );
+ }
+
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+}
+
+/***************************************************
+
+ Name: VLM_UpdateDisks()
+
+ Description: Determines how to check a disk in the disk window
+ when a selection script is used, and updates the
+ disk window with the appropriate marks.
+
+ Modified: 19 July 1991
+
+ Returns: nuthin'
+
+ Notes:
+
+ See also:
+
+*****************************************************/
+
+
+VOID VLM_UpdateDisks( )
+{
+ GENERIC_DLE_PTR dle;
+ BSD_PTR bsd;
+ VLM_OBJECT_PTR vlm;
+ WININFO_PTR wininfo;
+ UINT32 old_status;
+ INT16 bset_num;
+ QTC_BSET_PTR qtc_bset;
+ QTC_HEADER_PTR header;
+
+#ifdef OEM_EMS
+ UNREFERENCED_PARAMETER( qtc_bset );
+ UNREFERENCED_PARAMETER( header );
+ UNREFERENCED_PARAMETER( bset_num );
+#endif
+
+ wininfo = WM_GetInfoPtr( gb_disks_win );
+
+ if ( wininfo != NULL ) {
+
+ vlm = VLM_GetFirstVLM( wininfo->pFlatList );
+
+
+ while ( vlm != NULL ) {
+
+ old_status = vlm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL);
+ vlm->status &= ~( INFO_PARTIAL | INFO_SELECT );
+
+ DLE_FindByName( dle_list, vlm->name, ANY_DRIVE_TYPE, &dle );
+
+ bsd = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd != NULL ) { // not likely, but possible nonetheless
+
+ switch ( BSD_GetMarkStatus( bsd ) ) {
+
+ case ALL_SELECTED:
+ vlm->status |= INFO_SELECT;
+ break;
+
+ case SOME_SELECTED:
+ vlm->status |= (INFO_SELECT|INFO_PARTIAL);
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+ // Update the check mark
+
+ if ( old_status != (UINT16)(vlm->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ DLM_Update( gb_disks_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)vlm, 0 );
+ }
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+ }
+}
+
+
+/**********************
+
+ NAME : VLM_UpdateVolumes
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+VOID VLM_UpdateVolumes( VLM_OBJECT_PTR server_vlm )
+{
+ GENERIC_DLE_PTR dle;
+ BSD_PTR bsd;
+ VLM_OBJECT_PTR child_vlm;
+ INT16 bset_num;
+ QTC_BSET_PTR qtc_bset;
+ QTC_HEADER_PTR header;
+
+#ifdef OEM_EMS
+ UNREFERENCED_PARAMETER( qtc_bset );
+ UNREFERENCED_PARAMETER( header );
+ UNREFERENCED_PARAMETER( bset_num );
+#endif
+
+ child_vlm = VLM_GetFirstVLM( &server_vlm->children );
+
+ while ( child_vlm != NULL ) {
+
+ child_vlm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+
+ DLE_FindByName( dle_list, child_vlm->name, ANY_DRIVE_TYPE, &dle );
+
+ bsd = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd != NULL ) {
+
+ switch ( BSD_GetMarkStatus( bsd ) ) {
+
+ case ALL_SELECTED:
+ child_vlm->status |= INFO_SELECT;
+ break;
+
+ case SOME_SELECTED:
+ child_vlm->status |= (INFO_SELECT|INFO_PARTIAL);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ child_vlm = VLM_GetNextVLM( child_vlm );
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_UpdateServers
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+VOID VLM_UpdateServers( )
+{
+#if !defined( CAYMAN )
+#if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ VLM_OBJECT_PTR vlm;
+ VLM_OBJECT_PTR child_vlm;
+ WININFO_PTR wininfo;
+ UINT16 status;
+
+ if ( gb_servers_win == (HWND)NULL ) {
+ return;
+ }
+
+ wininfo = WM_GetInfoPtr( gb_servers_win );
+
+ if ( wininfo ) {
+
+ vlm = VLM_GetFirstVLM( wininfo->pTreeList );
+
+ while ( vlm != NULL ) {
+
+ if ( QueueCount( &vlm->children ) ) {
+
+ VLM_UpdateVolumes( vlm );
+
+ child_vlm = VLM_GetFirstVLM( &vlm->children );
+
+ status = child_vlm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL);
+
+ while ( child_vlm != NULL ) {
+
+ if ( status != ( child_vlm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL) ) ) {
+ status = INFO_SELECT|INFO_PARTIAL;
+ break;
+ }
+ child_vlm = VLM_GetNextVLM( child_vlm );
+ }
+
+ vlm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ vlm->status |= status;
+ }
+ else {
+ vlm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ }
+
+ vlm = VLM_GetNextVLM( vlm );
+ }
+
+ DLM_Update( gb_servers_win, DLM_FLATLISTBOX, WM_DLMUPDATELIST,
+ (LMHANDLE)NULL, 0 );
+ DLM_Update( gb_servers_win, DLM_TREELISTBOX, WM_DLMUPDATELIST,
+ (LMHANDLE)NULL, 0 );
+ }
+ }
+#endif //!defined ( OEM_MSOFT ) //unsupported feature
+#endif
+}
+
+
+/**********************
+
+ NAME : VLM_CloseWin
+
+ DESCRIPTION :
+
+ Close the given window and free its lists.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_CloseWin(
+HWND win ) // I - window to close
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ TAPE_OBJECT_PTR tape;
+ Q_ELEM_PTR q_elem;
+ Q_ELEM_PTR q_elem2;
+ DLM_LOGITEM_PTR dlm_ptr;
+ GENERIC_DLE_PTR enterprise_dle;
+
+ /* Now get the list so that it can be free'd */
+
+ wininfo = WM_GetInfoPtr( win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ if ( ( appinfo != NULL ) && ( wininfo->wType != WMTYPE_LOGVIEW ) ) {
+
+ if ( appinfo->fsh != NULL ) {
+ FS_DetachDLE( appinfo->fsh );
+ }
+
+ if ( appinfo->server_fsh != NULL ) {
+ FS_DetachDLE( appinfo->server_fsh );
+ }
+ }
+
+ switch ( wininfo->wType ) {
+
+ case WMTYPE_LOGVIEW:
+
+ // Clear and free pointers of blocks.
+
+ dlm_ptr = (DLM_LOGITEM_PTR)WMDS_GetAppInfo( wininfo );
+
+ if ( dlm_ptr ) {
+
+ // Deallocate the memory blocks used in viewing the file.
+
+ LOG_ClearBlocks( dlm_ptr );
+
+ if ( L_GetFilePtr( dlm_ptr ) ) {
+ fclose( L_GetFilePtr( dlm_ptr ) );
+ }
+
+ if ( L_GetArrayPtr( dlm_ptr ) ) {
+ free( L_GetArrayPtr( dlm_ptr ) );
+ }
+
+ if ( L_GetBuffer( dlm_ptr ) ) {
+ free( L_GetBuffer( dlm_ptr ) );
+ }
+
+ if ( L_GetFilePtr( dlm_ptr ) ) {
+ fclose( L_GetFilePtr( dlm_ptr ) );
+ L_SetFilePtr( dlm_ptr, NULL );
+ }
+
+ }
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ ghWndLogFileView = (HWND)NULL;
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+
+ break;
+
+ case WMTYPE_DISKS:
+ VLM_FreeVLMList( wininfo->pFlatList );
+ free( wininfo->pFlatList );
+ break;
+
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE:
+
+ // Check for closable because we may change this window type to MDISECONDARY later
+ if ( wininfo->wClosable ) {
+
+ if ( ( NULL != WMDS_GetTreeList( wininfo ) ) &&
+ ( NULL != VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) ) ) ) {
+
+ enterprise_dle = SLM_GetDle( VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) ) );
+ }
+
+ SLM_EMSFreeSLMList( wininfo->pTreeList );
+ free( wininfo->pFlatList );
+ SLM_EMSFreeSLMList( wininfo->pFlatList );
+ free( wininfo->pFlatList );
+
+
+ }
+ break;
+#endif //OEM_EMS
+
+ case WMTYPE_SERVERS:
+ VLM_FreeVLMList( wininfo->pTreeList );
+ free( wininfo->pTreeList );
+ break;
+
+ case WMTYPE_TAPES:
+ q_elem = DeQueueElem( wininfo->pTreeList );
+ while ( q_elem ) {
+
+ tape = (TAPE_OBJECT_PTR)q_elem->q_ptr;
+
+ // free all his bset's
+
+ q_elem2 = DeQueueElem( &TAPE_GetBsetQueue( tape ) );
+
+ while ( q_elem2 ) {
+ free( q_elem2->q_ptr );
+ q_elem2 = DeQueueElem( &TAPE_GetBsetQueue( tape ) );
+ }
+
+ free( q_elem->q_ptr );
+ q_elem = DeQueueElem( wininfo->pTreeList );
+ }
+ free( wininfo->pTreeList );
+ wininfo->pTreeList = NULL ;
+ break;
+
+ case WMTYPE_SEARCH:
+
+ q_elem = DeQueueElem( wininfo->pFlatList );
+
+ while ( q_elem ) {
+ free( q_elem->q_ptr );
+ q_elem = DeQueueElem( wininfo->pFlatList );
+ }
+ free( wininfo->pFlatList );
+ gb_search_win = (HWND)NULL;
+ break;
+
+ default:
+ if ( wininfo->pFlatList != NULL ) {
+
+ q_elem = DeQueueElem( wininfo->pFlatList );
+
+ while ( q_elem != NULL ) {
+
+ free( q_elem->q_ptr );
+ q_elem = DeQueueElem( wininfo->pFlatList );
+ }
+ free( wininfo->pFlatList );
+ }
+
+ if ( wininfo->pTreeList != NULL ) {
+
+ q_elem = DeQueueElem( wininfo->pTreeList );
+
+ while ( q_elem != NULL ) {
+
+ free( q_elem->q_ptr );
+ q_elem = DeQueueElem( wininfo->pTreeList );
+ }
+ free( wininfo->pTreeList );
+ wininfo->pTreeList = NULL ;
+ }
+ break;
+
+ }
+
+ // Clean exit routine up
+
+ if ( win == gb_tapes_win ) {
+ gb_tapes_win = (HWND)NULL;
+ }
+#if !defined ( CAYMAN )
+# if !defined ( OEM_MSOFT ) //unsupported feature
+ {
+ if ( win == gb_servers_win ) {
+ gb_servers_win = (HWND)NULL;
+ }
+ }
+# endif //!defined ( OEM_MSOFT ) //unsupported feature
+#endif // !defined ( CAYMAN )
+
+ if ( win == gb_disks_win ) {
+ gb_disks_win = (HWND)NULL;
+ }
+
+ if ( appinfo ) {
+ free( appinfo );
+ }
+
+ if ( wininfo ) {
+ free( wininfo );
+ WM_SetInfoPtr( win, NULL );
+ }
+}
+
+
+
+/**********************
+
+ NAME : VLM_MarkAllSLMChildren
+
+ DESCRIPTION :
+
+ Given an slm pointer, mark all his children as selected, unselected, or
+ partially selected.
+
+ attr: 2 = partial
+ 1 = selected
+ 0 = unselected
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_MarkAllSLMChildren(
+
+SLM_OBJECT_PTR slm, // I - slm to use
+INT16 attr, // I - attribute to set
+INT_PTR total_dirs_ptr,
+INT_PTR total_files_ptr,
+UINT64_PTR total_bytes_ptr )
+
+{
+
+ BOOLEAN all_subdirs;
+ INT level;
+ HWND window;
+ INT new_files;
+ UINT64 new_bytes;
+ BOOLEAN u64_stat;
+ SLM_OBJECT_PTR parent_slm;
+ SLM_OBJECT_PTR orig_slm;
+
+#ifdef OEM_EMS
+ UNREFERENCED_PARAMETER( u64_stat );
+ UNREFERENCED_PARAMETER( parent_slm );
+ UNREFERENCED_PARAMETER( new_bytes );
+ UNREFERENCED_PARAMETER( new_files );
+#endif
+
+ window = slm->XtraBytes->hWnd;
+ all_subdirs = CDS_GetIncludeSubdirs( CDS_GetPerm() );
+ orig_slm = slm;
+
+ *total_dirs_ptr = 0;
+ *total_files_ptr = 0;
+ *total_bytes_ptr = U64_Init( 0L, 0L );
+
+ if ( attr && ( ! all_subdirs ) ) {
+
+ // Do nothing his subdirectories weren't selected.
+
+ }
+ else {
+
+ level = slm->level;
+
+ slm = VLM_GetNextSLM( slm );
+
+ while ( slm != NULL ) {
+
+ if ( slm->level <= level ) {
+ break;
+ }
+
+ if ( SLM_GetStatus( slm ) & INFO_OPEN ) {
+
+ if ( attr ) {
+ VLM_FileListManager( window, FLM_SEL_ALL );
+ }
+ else {
+ VLM_FileListManager( window, FLM_SEL_NONE );
+ }
+ }
+
+ if ( attr ) {
+
+ if ( ( SLM_GetStatus( slm ) & (INFO_PARTIAL|INFO_SELECT) ) != INFO_SELECT ) {
+
+ slm->status |= INFO_SELECT;
+ slm->status &= ~INFO_PARTIAL;
+
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+ }
+ else {
+
+ if ( slm->status & (INFO_PARTIAL|INFO_SELECT) ) {
+
+ slm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+ }
+
+ return;
+
+}
+
+
+/**********************
+
+ NAME : VLM_MakeAllParentsPartial
+
+ DESCRIPTION :
+
+ Anytime we select or unselect a single file or directory all its
+ parent directories must be marked as partially selected. This
+ function will do that work for you. when you are moving up the
+ list, you can stop at the first partially selected directory.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_MakeAllParentsPartial(
+SLM_OBJECT_PTR slm ) // I - slm to use
+{
+ INT level;
+ APPINFO_PTR appinfo;
+
+ level = slm->level;
+ appinfo = ( APPINFO_PTR )( slm->XtraBytes->pAppInfo );
+
+ do {
+
+ // Is it a parent directory ?
+
+ if ( slm->level == level ) {
+
+ if ( ( slm->status & ( INFO_SELECT | INFO_PARTIAL ) ) ==
+ ( INFO_SELECT | INFO_PARTIAL ) ) {
+ break;
+ }
+ else {
+ slm->status |= ( INFO_SELECT | INFO_PARTIAL );
+ DLM_Update( appinfo->win, DLM_TREELISTBOX, WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+
+ level--;
+ }
+
+ slm = VLM_GetPrevSLM( slm );
+
+ } while ( slm != NULL );
+
+}
+
+
+/**********************
+
+ NAME : VLM_ClearAllSelections
+
+ DESCRIPTION :
+
+ After we complete a backup or restore we need to clear out all our
+ selections so the user can start fresh. This routine does that for
+ you. Note that restore as well as backup selections are blown away
+ at the same time. Restore selections may have become invalid during
+ a transfer. And backup selections may be confused by a restore.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_ClearAllSelections( )
+{
+ BSD_PTR bsd;
+
+ bsd = BSD_GetFirst( tape_bsd_list );
+ while ( bsd != NULL ) {
+ BSD_Remove( bsd );
+ bsd = BSD_GetFirst( tape_bsd_list );
+ }
+
+ bsd = BSD_GetFirst( bsd_list );
+ while ( bsd != NULL ) {
+ BSD_Remove( bsd );
+ bsd = BSD_GetFirst( bsd_list );
+ }
+
+ VLM_ClearAllTapeSelections();
+ VLM_ClearAllTreeSelections();
+ VLM_ClearAllDiskSelections();
+ VLM_ClearAllSearchSelections();
+ VLM_ClearAllServerSelections();
+#ifdef OEM_EMS
+ VLM_ClearAllExchangeSelections();
+#endif //OEM_EMS
+}
+
+
+
+/**********************
+
+ NAME : VLM_RematchList
+
+ DESCRIPTION :
+
+ The user has added or removed an advanced selection to the FSE list.
+ Now since we have no clue, which directories and files are now selected
+ we need to rerun the entire SLM and FLM lists through BSD Match.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_RematchList(
+HWND win ) // I - window to rematch lists on
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ BSD_PTR bsd_ptr;
+ FLM_OBJECT_PTR flm;
+ FSE_PTR fse;
+ CHAR *buffer = NULL;
+ CHAR *path = NULL;
+ CHAR_PTR s;
+ INT16 result;
+ INT16 path_len;
+ INT16 psize;
+ UINT16 status;
+ DATE_TIME mod_date;
+ DATE_TIME acc_date;
+
+ wininfo = WM_GetInfoPtr( win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( win );
+
+ // see if there is a BSD to match against
+
+ if ( appinfo->dle != NULL ) {
+
+ bsd_ptr = BSD_FindByDLE( bsd_list, appinfo->dle );
+
+ }
+ else {
+
+ bsd_ptr = BSD_FindByTapeID( tape_bsd_list,
+ appinfo->tape_fid,
+ appinfo->bset_num );
+ }
+
+ // if no BSD, no matches
+
+ if ( ( bsd_ptr == NULL ) ||
+ ( BSD_GetMarkStatus ( bsd_ptr ) == NONE_SELECTED ) ) {
+
+ VLM_DeselectAll( wininfo, TRUE );
+ return;
+
+ }
+
+ // match the SLM list and generate selected totals
+
+ VLM_MatchSLMList( wininfo, bsd_ptr, TRUE );
+
+ // Now do the flat list of files and directories
+
+ path = VLM_BuildPath( appinfo->open_slm );
+
+ s = path;
+ path_len = 0;
+ while ( *s ) {
+ if ( *s == TEXT('\\') ) *s = 0;
+ s++;
+ path_len++;
+ }
+
+ path_len++; // add in final zero
+
+ flm = VLM_GetFirstFLM( wininfo->pFlatList );
+
+ while ( flm != NULL ) {
+
+ DateTimeDOS( flm->mod_date, flm->mod_time, &mod_date );
+ DateTimeDOS( flm->acc_date, flm->acc_time, &acc_date );
+
+ if ( flm->status & INFO_ISADIR ) {
+
+ free( buffer );
+
+ buffer = malloc( ( path_len * 2 ) + strsize( flm->name ) );
+
+ if ( path_len != sizeof( CHAR ) ) {
+
+ memcpy( buffer, path, path_len * sizeof(CHAR) );
+ strcpy( &buffer[ path_len ], flm->name );
+ psize = (UINT16)(path_len + strlen(flm->name) + 1);
+ }
+ else {
+ strcpy( buffer, flm->name );
+ psize = (UINT16) (strlen( flm->name ) + 1);
+ }
+
+ psize *= sizeof( CHAR ); // convert to bytes
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL,
+ buffer,
+ psize,
+ flm->attrib,
+ &mod_date, &acc_date, NULL,
+ FALSE, TRUE );
+ status = 0;
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+ status = INFO_SELECT | INFO_PARTIAL;
+ }
+
+ if ( result == BSD_PROCESS_ENTIRE_DIR ) {
+ status = INFO_SELECT;
+ }
+
+ if ( (UINT16)( flm->status & (INFO_SELECT|INFO_PARTIAL) ) != status ) {
+
+ flm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ flm->status |= status;
+
+ DLM_Update( win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)flm, 0 );
+ }
+ }
+ else {
+
+ path_len *= sizeof( CHAR ); // convert to bytes
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse, flm->name,
+ path,
+ path_len,
+ flm->attrib,
+ &mod_date, &acc_date,
+ NULL, FALSE, TRUE );
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+ status = INFO_SELECT;
+ }
+ else {
+ status = 0;
+ }
+
+ if ( (UINT16)( flm->status & (INFO_SELECT|INFO_PARTIAL) ) != status ) {
+
+ flm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ flm->status |= status;
+
+ DLM_Update( win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)flm, 0 );
+ }
+
+ }
+
+ flm = VLM_GetNextFLM( flm );
+ }
+
+ free( path );
+ free( buffer );
+
+ VLM_UpdateRoot( win );
+
+ return;
+
+}
+
+
+/**********************
+
+ NAME : VLM_MatchSLMList
+
+ DESCRIPTION :
+
+ Run the entire SLM and file lists for partially selected directories
+ through BSD Match.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_MatchSLMList(
+
+WININFO_PTR wininfo, //I - wininfo structure
+BSD_PTR bsd_ptr, //I - BSD to match against
+BOOLEAN display ) //I - update display flag
+
+{
+ HWND win;
+ SLM_OBJECT_PTR slm;
+ FSE_PTR fse;
+ CHAR *path = NULL;
+ CHAR_PTR s;
+ INT16 result;
+ INT16 path_len;
+ UINT16 status;
+ DATE_TIME mod_date;
+ SLM_OBJECT_PTR parent_slm;
+
+#ifdef OEM_EMS
+ UNREFERENCED_PARAMETER( parent_slm );
+#endif
+
+ slm = VLM_GetFirstSLM( wininfo->pTreeList );
+
+ if ( display && ( slm != NULL ) ) {
+ win = slm->XtraBytes->hWnd;
+ }
+
+ while ( slm != NULL ) {
+
+ free( path );
+
+ path = VLM_BuildPath( slm );
+ s = path;
+ path_len = 0;
+ while ( *s ) {
+ if ( *s == TEXT('\\') ) *s = 0;
+ s++;
+ path_len++;
+ }
+ path_len++;
+
+ DateTimeDOS( slm->date, slm->time, &mod_date );
+
+ path_len *= sizeof( CHAR );
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse, NULL,
+ path,
+ path_len,
+ slm->attrib,
+ &mod_date, NULL, NULL, FALSE, TRUE );
+
+ status = 0;
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+ status = INFO_SELECT | INFO_PARTIAL;
+ }
+
+ if ( result == BSD_PROCESS_ENTIRE_DIR ) {
+ status = INFO_SELECT;
+ }
+
+ // if selection status has changed, update it
+
+ if ( (UINT16)( slm->status & (INFO_SELECT|INFO_PARTIAL) ) != status ) {
+
+ slm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ slm->status |= status;
+
+ if ( display ) {
+ DLM_Update( win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ free( path );
+
+ return;
+
+}
+
+
+/**********************
+
+ NAME : VLM_AddPartials
+
+ DESCRIPTION :
+
+ Run through the entire file list for a path and calculate the selected
+ file sizes.
+
+ RETURNS : SUCCESS
+ FAILURE
+
+**********************/
+
+INT VLM_AddPartials(
+
+CHAR_PTR path,
+INT16 path_length,
+BSD_PTR bsd_ptr,
+UINT32 tape_fid,
+INT16 bset_num,
+INT_PTR sel_files_ptr,
+UINT64_PTR sel_bytes_ptr )
+
+{
+ INT16 result;
+ QTC_QUERY_PTR query;
+ FSE_PTR fse;
+ DATE_TIME acc_date;
+ DATE_TIME mod_date;
+ BOOLEAN u64_stat;
+
+ // first set totals to zero
+
+ *sel_files_ptr = 0;
+ *sel_bytes_ptr = U64_Init( 0L, 0L );
+
+ acc_date.date_valid = FALSE;
+
+ // Tell the catalogs which bset & tape family to use
+
+ query = QTC_InitQuery();
+
+ if ( query == NULL ) {
+ return( FAILURE );
+ }
+
+ QTC_SetTapeFID( query, tape_fid );
+ QTC_SetTapeSeq( query, -1 );
+ QTC_SetBsetNum( query, bset_num );
+
+ QTC_SetSearchPath( query, path, path_length );
+
+ // start loop to get each file
+
+ result = (INT16) QTC_GetFirstObj( query );
+
+ while ( ! result ) {
+
+ if ( ! ( QTC_GetItemStatus( query ) & QTC_DIRECTORY ) ) {
+
+ // use the BSD_Match function to see if it's selected
+
+ DateTimeDOS( QTC_GetItemDate( query ),
+ QTC_GetItemTime( query ), &mod_date );
+
+ result = BSD_MatchPathAndFile( bsd_ptr, &fse,
+ QTC_GetItemName( query ),
+ QTC_GetPath( query ),
+ (INT16) QTC_GetPathLength( query ),
+ QTC_GetItemAttrib( query ),
+ &mod_date, &acc_date, NULL,
+ FALSE, TRUE );
+
+ if ( result == BSD_PROCESS_OBJECT ) {
+
+ // increment the number of files and add its size to the total
+
+ (*sel_files_ptr)++;
+ *sel_bytes_ptr = U64_Add( *sel_bytes_ptr, QTC_GetItemSize( query ), &u64_stat );
+
+ }
+
+ }
+
+ // get the next file/dir.
+
+ result = (INT16) QTC_GetNextObj( query );
+ }
+
+ QTC_CloseQuery( query );
+
+ return( SUCCESS );
+
+}
+
+
+/**********************
+
+ NAME : VLM_RematchAllSelections
+
+ DESCRIPTION :
+
+ Currently if an error occurs during backup, we occasionally save pieces
+ of the bsd list. This function will update every check box known to man.
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_RematchAllLists( )
+{
+ HWND win;
+ WININFO_PTR wininfo;
+
+ win = WM_GetNext( (HWND)NULL );
+
+ while ( win ) {
+
+ wininfo = WM_GetInfoPtr( win );
+
+ switch ( wininfo->wType ) {
+
+ case WMTYPE_DISKTREE:
+ case WMTYPE_TAPETREE:
+ VLM_RematchList( win );
+ break;
+
+ case WMTYPE_TAPES:
+ VLM_UpdateTapes();
+ break;
+
+ case WMTYPE_DISKS:
+ VLM_UpdateDisks();
+ break;
+
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE:
+ // VLM_UpdateExchange( win ); - Function doesn't do what is needed.
+ break;
+#endif //OEM_EMS
+
+ case WMTYPE_SERVERS:
+ VLM_UpdateServers();
+ break;
+
+ case WMTYPE_SEARCH:
+ VLM_UpdateSearchSelections( (UINT32)-1L, (INT16)-1 );
+ break;
+
+ default:
+ break;
+ }
+
+ win = WM_GetNext( win );
+ }
+}
+
+/******************************************************************************
+
+ Name: VLM_ValidatePath()
+
+ Description: Checks to see if a backup path is valid (NOT if it exists!!!)
+
+ Only checks for "\\server" and "E:", both of which we don't
+ allow.
+
+ Returns: INT non-zero for success, or zero for failure
+
+******************************************************************************/
+
+// the following code was stolen from tmenu
+
+INT VLM_ValidatePath(
+CHAR_PTR path,
+BOOLEAN allow_drive_spec,
+BOOLEAN use_dle )
+{
+ (VOID)allow_drive_spec;
+ (VOID)use_dle;
+
+ // skip white space
+
+ while ( *path && *path == TEXT( ' ' ) ) {
+ path++;
+ }
+
+ // skip first character
+
+ if ( *path ) {
+
+ // look for \\server\volume
+
+ if ( ! strncmp( path, TEXT("\\\\" ), 2 ) ) {
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE ),
+ ID( IDS_RESTOREPATHINVALID ),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ return( 0 );
+ }
+
+ path++;
+ }
+
+ // see if second character is a colon
+
+ if ( *path ) {
+ if ( *path == TEXT( ':' ) ) {
+ WM_MsgBox( ID( IDS_MSGTITLE_RESTORE ),
+ ID( IDS_RESTOREPATHINVALID ),
+ WMMB_OK, WMMB_ICONEXCLAMATION );
+ return( 0 );
+ }
+ }
+
+ return( -1 );
+}
+
+
+/******************************************************************************
+
+ Name: VLM_NetConnect ()
+
+ Description: Connects to a network drive.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID VLM_NetConnect ( VOID )
+
+{
+
+#ifndef OEM_MSOFT
+
+#ifdef CAYMAN
+ WNetConnectionDialog ( ghWndFrame, RESOURCETYPE_DISK );
+#else
+ WNetConnectionDialog ( ghWndFrame, WNBD_CONN_DISKTREE );
+#endif
+ if ( gb_disks_win != (HWND)NULL ) {
+
+ WM_SetActiveDoc( gb_disks_win );
+
+ VLM_Refresh ( );
+ }
+#endif
+
+} /* end VLM_NetConnect () */
+
+
+/******************************************************************************
+
+ Name: VLM_NetDisconnect ()
+
+ Description: Disconnects a network drive.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID VLM_NetDisconnect ( VOID )
+
+{
+
+#ifndef OEM_MSOFT
+
+#ifdef CAYMAN
+ WNetDisconnectDialog ( ghWndFrame, RESOURCETYPE_DISK );
+#else
+ WNetDisconnectDialog ( ghWndFrame, WNBD_CONN_DISKTREE );
+#endif
+ if ( gb_disks_win != (HWND)NULL ) {
+
+ WM_SetActiveDoc( gb_disks_win );
+
+ VLM_Refresh ( );
+ }
+#endif
+
+} /* end VLM_NetConnect () */
+
+
+
diff --git a/private/utils/ntbackup/src/vlm_xchg.c b/private/utils/ntbackup/src/vlm_xchg.c
new file mode 100644
index 000000000..7f9d15004
--- /dev/null
+++ b/private/utils/ntbackup/src/vlm_xchg.c
@@ -0,0 +1,3630 @@
+/***************************************************
+Copyright (C) Maynard, An Archive Company. 1991
+
+ Name: VLM_XCHG.C
+
+ Description:
+
+ This file contains most of the code for processing the Exchange
+ window and list.
+
+ $Log: $
+
+*****************************************************/
+
+#ifdef OEM_EMS // Entire File
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+
+// Local Prototypes
+static BOOLEAN DLE_EnterpriseInDleTree ( GENERIC_DLE_PTR, DLE_HAND );
+static SLM_OBJECT_PTR VLM_BuildExchangeList ( Q_HEADER_PTR, WININFO_PTR, GENERIC_DLE_PTR );
+static SLM_OBJECT_PTR SLM_FindSLMByName ( Q_HEADER_PTR, CHAR_PTR );
+static INT SLM_FindEnterpriseChildren ( Q_HEADER_PTR, SLM_OBJECT_PTR,
+ INT, GENERIC_DLE_PTR, SLM_OBJECT_PTR * );
+static SLM_OBJECT_PTR SLM_AddInExchangeChildren ( Q_HEADER_PTR, SLM_OBJECT_PTR,
+ INT, GENERIC_DLE_PTR );
+static VOID VLM_InsertXchgSLM ( Q_HEADER_PTR, SLM_OBJECT_PTR,
+ SLM_OBJECT_PTR, SLM_OBJECT_PTR );
+static VOID VLM_MarkAllEntSLMChildren ( SLM_OBJECT_PTR, BYTE );
+static INT SLM_XchgListReuse ( SLM_OBJECT_PTR );
+static WORD SLM_GetBitmap ( SLM_OBJECT_PTR );
+static INT SLM_AddBSD ( SLM_OBJECT_PTR );
+static VOID SLM_UpdateNodeList ( SLM_OBJECT_PTR ,BYTE );
+static VOID SLM_UpdateNode ( SLM_OBJECT_PTR );
+static VOID VLM_MarkAllEntSLMParents ( SLM_OBJECT_PTR, BYTE );
+static SLM_OBJECT_PTR SLM_FindByDLE ( GENERIC_DLE_PTR, SLM_OBJECT_PTR );
+static SLM_OBJECT_PTR SLM_CreateSLM ( INT, INT, INT, BOOLEAN, BOOLEAN );
+static HWND DLE_GetEnterpriseWindow ( GENERIC_DLE_PTR );
+static VOID SLM_EnterpriseRefresh ( SLM_OBJECT_PTR, GENERIC_DLE_PTR );
+
+static VOID_PTR SLM_EntSetSelect( SLM_OBJECT_PTR, BYTE );
+static BYTE SLM_EntGetSelect( SLM_OBJECT_PTR );
+static VOID_PTR SLM_EntSetTag( SLM_OBJECT_PTR, BYTE );
+static BYTE SLM_EntGetTag( SLM_OBJECT_PTR );
+static USHORT SLM_EntGetItemCount( Q_HEADER_PTR );
+static VOID_PTR SLM_EntGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR SLM_EntGetPrevItem( SLM_OBJECT_PTR );
+static VOID_PTR SLM_EntGetNextItem( SLM_OBJECT_PTR );
+static VOID_PTR SLM_EntGetObjects( SLM_OBJECT_PTR );
+static BOOLEAN SLM_EntSetObjects( SLM_OBJECT_PTR, WORD, WORD );
+
+static VOID_PTR SLM_NodeSetSelect( SLM_OBJECT_PTR, BYTE );
+static BYTE SLM_NodeGetSelect( SLM_OBJECT_PTR );
+static VOID_PTR SLM_NodeSetTag( SLM_OBJECT_PTR, BYTE );
+static BYTE SLM_NodeGetTag( SLM_OBJECT_PTR );
+static USHORT SLM_NodeGetItemCount( Q_HEADER_PTR );
+static VOID_PTR SLM_NodeGetFirstItem( Q_HEADER_PTR );
+static VOID_PTR SLM_NodeGetPrevItem( SLM_OBJECT_PTR );
+static VOID_PTR SLM_NodeGetNextItem( SLM_OBJECT_PTR );
+static VOID_PTR SLM_NodeGetObjects( SLM_OBJECT_PTR );
+static BOOLEAN SLM_NodeSetObjects( SLM_OBJECT_PTR, WORD, WORD );
+static VOID_PTR SLM_DoNodeSetSelect( SLM_OBJECT_PTR, BYTE );
+static BOOLEAN VLM_ExchangeDleExist( VOID );
+
+
+/**********************
+
+ NAME : VLM_ExchangeInit
+
+ DESCRIPTION :
+
+ Creates the queue for the exchange enterprise windows and steps through
+ the enterprise server list, creating windows for any names found there.
+
+ RETURNS : SUCCESS if the windows could be created (if needed). FAILURE otherwise.
+
+**********************/
+
+BOOLEAN VLM_ExchangeInit ( )
+{
+ GENERIC_DLE_PTR dle;
+ Q_ELEM_PTR elem_ptr;
+ WININFO_PTR wininfo;
+ SLM_OBJECT_PTR slm;
+ HWND enterprise_win;
+
+ InitQueue( (Q_HEADER_PTR) &gq_exchange_win );
+
+ dle = (GENERIC_DLE_PTR)QueueHead( &(dle_list->q_hdr) ) ;
+
+ while ( dle ) {
+
+ if ( ( DLE_GetDeviceType( dle ) == FS_EMS_DRV ) &&
+ ( DLE_GetDeviceSubType( dle ) == EMS_ENTERPRISE ) ) {
+
+ if ( SUCCESS != VLM_ExchangeListCreate( DLE_GetDeviceName( dle ) ) ) {
+
+ return FAILURE;
+ }
+
+ // Blow out entire tree for the dle.
+ for ( elem_ptr = QueueHead( &gq_exchange_win );
+ NULL != elem_ptr;
+ elem_ptr = QueueNext( elem_ptr ) ) {
+
+ if ( !( enterprise_win = ( HWND )QueuePtr( elem_ptr ) ) ) {
+ // Something's wrong - we've got a queue entry but no window.
+ RemoveElem( &gq_exchange_win, elem_ptr );
+ continue;
+ }
+
+ if ( NULL == ( wininfo = WM_GetInfoPtr( enterprise_win ) ) ) {
+ // Something's wrong - we've got a window but no enterprise info.
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ continue;
+ }
+
+ if ( NULL == ( slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) ) ) ) {
+ // Something's wrong - we've got info, but no entries in the slm list.
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ continue;
+ }
+
+ if ( dle == SLM_GetDle( slm ) ) {
+
+ SLM_EMSExpandTree( enterprise_win );
+ break;
+ }
+ }
+ }
+
+ dle = (GENERIC_DLE_PTR)QueueNext( &(dle->q) ) ;
+ }
+
+ return SUCCESS;
+}
+
+
+/**********************
+
+ NAME : VLM_ExchangeSync
+
+ DESCRIPTION :
+
+ The user has performed a refresh call and it is our job to see to it that
+ any servers no longer on line are removed and any new ones are inserted.
+ Any server with a window open will not go away, because we are attached
+ to it. Also any server with selections made will not go away. All server
+ children dle's need there bsd count incremented to keep them around.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID VLM_ExchangeSync( )
+{
+ HWND enterprise_win;
+ Q_ELEM_PTR elem_ptr;
+ WININFO_PTR wininfo;
+ SLM_OBJECT_PTR slm;
+ GENERIC_DLE_PTR enterprise_dle = NULL;
+
+ // Find and check the DLE tree for each enterprise window. We'll only check entire
+ // trees here and wait until we loop through the DLEs to make check individual elements
+ // of the trees.
+
+ for ( elem_ptr = QueueHead( &gq_exchange_win ); NULL != elem_ptr; elem_ptr = QueueNext( elem_ptr ) ) {
+
+ if ( !( enterprise_win = ( HWND )QueuePtr( elem_ptr ) ) ) {
+ // Something's wrong - we've got a queue entry but no window.
+ RemoveElem( &gq_exchange_win, elem_ptr );
+ continue;
+ }
+
+ if ( NULL == ( wininfo = WM_GetInfoPtr( enterprise_win ) ) ) {
+ // Something's wrong - we've got a window but no enterprise info.
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ continue;
+ }
+
+ if ( NULL == ( slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) ) ) ) {
+ // Something's wrong - we've got info, but no entries in the slm list.
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ continue;
+ }
+
+ if ( NULL == ( enterprise_dle = SLM_GetDle( slm ) ) ) {
+ // Something's wrong - we've got an enterprise slm tree without DLEs
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ continue;
+ }
+
+ if ( !DLE_EnterpriseInDleTree( enterprise_dle, dle_list ) ) {
+ // We no longer have a connection to that DLE tree.
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ continue;
+ }
+
+ }
+
+ // Find and check the window for each DLE tree. Also check the individual elements of
+ // the tree.
+ for ( enterprise_dle = (GENERIC_DLE_PTR)QueueHead( &(dle_list->q_hdr) );
+ NULL != enterprise_dle;
+ enterprise_dle = (GENERIC_DLE_PTR)QueueNext( &(enterprise_dle->q) ) ) {
+
+ if ( ( DLE_GetDeviceType( enterprise_dle ) != FS_EMS_DRV ) ||
+ ( DLE_GetDeviceSubType( enterprise_dle ) != EMS_ENTERPRISE ) ) {
+ continue; // Try the next dle.
+ }
+
+ if ( !( enterprise_win = DLE_GetEnterpriseWindow( enterprise_dle ) ) ) {
+
+ // Create a new window because this DLE tree doesn't have one.
+ VLM_ExchangeListCreate( DLE_GetDeviceName( enterprise_dle ) );
+
+ } else {
+
+ // Match the slm tree to the dle tree.
+
+ if ( NULL == ( wininfo = WM_GetInfoPtr( enterprise_win ) ) ) {
+ // Something's wrong - we've got a window but no window display info.
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ VLM_ExchangeListCreate( DLE_GetDeviceName( enterprise_dle ) );
+ continue;
+ }
+
+ if ( NULL == ( slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) ) ) ) {
+ // Something's wrong - we've got info, but no entries in the slm list.
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)enterprise_win, 0L );
+ VLM_ExchangeListCreate( DLE_GetDeviceName( enterprise_dle ) );
+ continue;
+ }
+
+ SLM_EnterpriseRefresh( slm, enterprise_dle );
+ }
+ }
+}
+
+
+/**********************
+
+ NAME : DLE_InDleTree
+
+ DESCRIPTION :
+
+ Checks to see if a DLE tree exists in a list of DLEs.
+
+ RETURNS : BOOLEAN.
+
+**********************/
+static BOOLEAN DLE_EnterpriseInDleTree(
+ GENERIC_DLE_PTR dle,
+ DLE_HAND hand
+)
+{
+ GENERIC_DLE_PTR temp_dle;
+
+ if ( ( dle == NULL ) ||
+ ( hand == NULL ) ) {
+ return FALSE;
+ }
+
+ temp_dle = (GENERIC_DLE_PTR)QueueHead( &(hand->q_hdr) ) ;
+
+ while ( temp_dle ) {
+
+ if ( temp_dle == dle ) {
+
+ return TRUE;
+ }
+
+ temp_dle = (GENERIC_DLE_PTR)QueueNext( &(temp_dle->q) ) ;
+ }
+
+ return FALSE;
+
+}
+
+/**********************
+
+ NAME : SLM_EnterpriseRefresh
+
+ DESCRIPTION :
+
+ Compares the SLM tree to it corresponding DLE tree, adding any new DLEs, if necessary.
+
+ RETURNS : nothing.
+
+**********************/
+static VOID SLM_EnterpriseRefresh(
+ SLM_OBJECT_PTR parent_slm,
+ GENERIC_DLE_PTR parent_dle
+)
+{
+ SLM_OBJECT_PTR child_slm;
+ GENERIC_DLE_PTR child_dle;
+ WININFO_PTR wininfo;
+
+ if ( ( parent_slm == NULL ) ||
+ ( parent_dle == NULL ) ) {
+ return;
+ }
+
+ wininfo = SLM_GetXtraBytes( parent_slm );
+
+ if ( SLM_GetMailType( parent_slm ) == EMS_SERVER ) {
+ return;
+ }
+
+ // We will step through the children at this level assuming that the slm and dle children
+ // are in the same (alphabetical) sort order. If this changes, then this routine will have
+ // to change. Another assumption is that nodes will never disappear from the dle tree. This
+ // means that a node cannot appear in the slm tree that does not appear in the dle tree.
+ for ( child_slm = VLM_GetNextSLM( parent_slm ), DLE_GetFirstChild( parent_dle, &child_dle )
+ ; ( NULL != child_dle )
+ ; DLE_GetNext( &child_dle ) ) {
+
+ // if we're out of slm children but there are still more dle children so these must
+ // be added.
+ if ( child_slm == NULL ) {
+
+ SLM_AddInExchangeChildren( WMDS_GetTreeList( wininfo ), parent_slm, -1, child_dle );
+ continue;
+ }
+
+ // Add any dle children that exist before the next known slm child.
+ while ( ( NULL != child_slm ) &&
+ ( SLM_GetDle( child_slm ) != child_dle ) ) {
+
+ SLM_AddInExchangeChildren( WMDS_GetTreeList( wininfo ), parent_slm, -1, child_dle );
+ DLE_GetNext( &child_dle );
+ }
+
+ // Recurse through the next level of children then go on to the next slm brother.
+ if ( child_slm != NULL ) {
+ SLM_EnterpriseRefresh( child_slm, child_dle );
+ child_slm = SLM_GetNextBrother( child_slm );
+ }
+ }
+}
+
+
+/**********************
+
+ NAME : SLM_EMSExpandTree
+
+ DESCRIPTION :
+
+ Expand entire exchange tree.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID SLM_EMSExpandTree( HWND win )
+{
+ SLM_OBJECT_PTR focus_slm;
+ SLM_OBJECT_PTR slm;
+ WININFO_PTR wininfo = WM_GetInfoPtr( win );
+
+ if ( ( NULL != wininfo ) &&
+ ( WMTYPE_EXCHANGE == WMDS_GetWinType( wininfo ) ) ) {
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+ slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) );
+
+ while ( slm ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)(INFO_DISPLAY | INFO_EXPAND | INFO_VALID) );
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ VLM_UpdateBrothers( WMDS_GetTreeList( wininfo ) );
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+
+ SLM_EntSetObjects( focus_slm, WM_DLMDOWN, 2 );
+ }
+}
+
+
+/**********************
+
+ NAME : SLM_EMSExpandOne
+
+ DESCRIPTION :
+
+ Expand one node of the exchange tree.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID SLM_EMSExpandOne( HWND win )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ SLM_OBJECT_PTR focus_slm;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo) {
+ appinfo = WMDS_GetAppInfo( wininfo );
+ }
+
+ if ( appinfo ) {
+
+ focus_slm = appinfo->open_slm;
+
+ } else {
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ }
+
+ if ( focus_slm == NULL ) {
+
+ return;
+ }
+
+ if ( SLM_GetStatus( focus_slm ) & INFO_EXPAND ) {
+ return;
+ }
+
+ SLM_EntSetObjects( focus_slm, WM_DLMDBCLK, 2 );
+
+}
+
+
+/**********************
+
+ NAME : SLM_EMSExpandBranch
+
+ DESCRIPTION :
+
+ Expand one node of the exchange tree.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID SLM_EMSExpandBranch( HWND win )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ SLM_OBJECT_PTR focus_slm;
+ SLM_OBJECT_PTR child_slm;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo) {
+ appinfo = WMDS_GetAppInfo( wininfo );
+ }
+
+ if ( appinfo ) {
+
+ focus_slm = appinfo->open_slm;
+
+ } else {
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ }
+
+ if ( focus_slm == NULL ) {
+
+ return;
+ }
+
+ child_slm = VLM_GetNextSLM( focus_slm );
+
+ while ( child_slm &&
+ ( child_slm != SLM_GetNextBrother( focus_slm ) ) ) {
+
+ SLM_SetStatus( child_slm,
+ SLM_GetStatus( child_slm ) |
+ (UINT16)(INFO_DISPLAY | INFO_EXPAND | INFO_VALID) );
+
+ child_slm = VLM_GetNextSLM( child_slm );
+ }
+
+ DLM_Update( win, DLM_TREELISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+}
+
+
+/**********************
+
+ NAME : SLM_EMSCollapseBranch
+
+ DESCRIPTION :
+
+ Collapses a branch of the exchange tree.
+
+ RETURNS : nothing.
+
+**********************/
+
+VOID SLM_EMSCollapseBranch( HWND win )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ SLM_OBJECT_PTR focus_slm;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ if ( wininfo) {
+ appinfo = WMDS_GetAppInfo( wininfo );
+ }
+
+ if ( appinfo ) {
+
+ focus_slm = appinfo->open_slm;
+
+ } else {
+
+ focus_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ }
+
+ if ( focus_slm == NULL ) {
+
+ return;
+ }
+
+ if ( !( SLM_GetStatus( focus_slm ) & INFO_EXPAND ) ) {
+ return;
+ }
+
+ SLM_EntSetObjects( focus_slm, WM_DLMDBCLK, 2 );
+
+}
+
+
+/**********************
+
+ NAME : SLM_EMSPrevBrotherDir
+
+ DESCRIPTION :
+
+ User hit CTRL-Up Arrow, go to previous brother.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID SLM_EMSPrevBrotherDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ // Get the active directory slm.
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ // Try to find a previous brother and make him active directory.
+
+ new_slm = VLM_GetPrevSLM( old_slm );
+
+ while ( new_slm != NULL ) {
+
+ if ( SLM_GetLevel( new_slm ) < SLM_GetLevel( old_slm ) ) {
+
+ // No previous brother.
+ break;
+ }
+
+ if ( SLM_GetLevel( new_slm ) == SLM_GetLevel( old_slm ) ) {
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ // Fake a single click call to make this guy active.
+ SLM_EntSetObjects( new_slm, WM_DLMDOWN, 2 );
+ break;
+ }
+
+ new_slm = VLM_GetPrevSLM( new_slm );
+ }
+
+}
+
+/**********************
+
+ NAME : SLM_EMSNextBrotherDir
+
+ DESCRIPTION :
+
+ User hit Ctrl-Down Arrow. Go to next brother down the tree.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID SLM_EMSNextBrotherDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ // get the active directory slm.
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ // Get his next brother.
+
+ new_slm = old_slm->next_brother;
+
+ if ( new_slm != NULL ) {
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ // Make him the active item.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ // Fake a single click message to myself.
+
+ SLM_EntSetObjects( new_slm, WM_DLMDOWN, 2 );
+ }
+
+}
+
+
+/**********************
+
+ NAME : SLM_EMSUpOneDir
+
+ DESCRIPTION :
+
+ Make the parent of the active directory the active directory.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID SLM_EMSUpOneDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ WININFO_PTR wininfo;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ new_slm = SLM_GetParent( old_slm );
+
+ if ( new_slm != NULL ) {
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ SLM_EntSetObjects( new_slm, WM_DLMDOWN, 2 );
+ }
+
+}
+
+/**********************
+
+ NAME : SLM_EMSDownOneDir
+
+ DESCRIPTION :
+
+ Move down the tree one level deeper to the active directories first
+ child, if there is one.
+
+ RETURNS : nothing
+
+**********************/
+
+VOID SLM_EMSDownOneDir( HWND win )
+{
+ SLM_OBJECT_PTR old_slm;
+ SLM_OBJECT_PTR new_slm;
+ Q_HEADER_PTR slm_list;
+ WININFO_PTR wininfo;
+ INT count = 0;
+
+ wininfo = WM_GetInfoPtr( win );
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ // Get active directory slm.
+
+ old_slm = ( SLM_OBJECT_PTR )DLM_GetFocusItem( wininfo->hWndTreeList );
+
+ if ( old_slm == NULL ) {
+ return;
+ }
+
+ if ( ! ( SLM_GetStatus( old_slm ) & INFO_SUBS ) ) {
+
+ // The guy has no subs.
+ return;
+ }
+
+
+ if( !( SLM_GetStatus( old_slm ) & INFO_EXPAND ) ) {
+
+ SLM_EntSetObjects( old_slm, WM_DLMDBCLK, 2 );
+ }
+
+ // Now make the first child active.
+
+ new_slm = VLM_GetNextSLM( old_slm );
+
+ while ( new_slm != NULL ) {
+
+ if ( SLM_GetLevel( new_slm ) <= SLM_GetLevel( old_slm ) ) {
+ break;
+ }
+
+ if ( SLM_GetLevel( new_slm ) == SLM_GetLevel( old_slm ) + 1 ) {
+
+ // We've found the right one.
+
+ SLM_SetStatus( old_slm, old_slm->status & (UINT16)~INFO_TAGGED );
+ SLM_SetStatus( new_slm, new_slm->status | (UINT16)INFO_TAGGED );
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ),
+ 0,
+ (LMHANDLE)new_slm );
+
+ // Fake a single click message to myself.
+
+ SLM_EntSetObjects( new_slm, WM_DLMDOWN, 2 );
+ break;
+ }
+
+ new_slm = VLM_GetNextSLM( new_slm );
+ }
+
+}
+
+/*****
+
+ NAME : VLM_UpdateEnterprise
+
+ DESCRIPTION :
+
+ We have changed the selection status on one of this enterprises's volumes. So
+ let's quickly update his status based on the selction status of all his
+ volumes. Run through the list and stop as soon as you hit a partially
+ selected one.
+
+*****/
+
+VOID VLM_UpdateExchange( HWND exchange_win )
+{
+ GENERIC_DLE_PTR dle;
+ BSD_PTR bsd;
+ SLM_OBJECT_PTR slm;
+ WININFO_PTR wininfo;
+ UINT32 old_status;
+
+ wininfo = WM_GetInfoPtr( exchange_win );
+
+ if ( wininfo != NULL ) {
+
+ slm = VLM_GetFirstSLM( wininfo->pTreeList );
+
+ while ( slm != NULL ) {
+
+ if ( ( EMS_MDB == SLM_GetMailType( slm ) ) ||
+ ( EMS_DSA == SLM_GetMailType( slm ) ) ) {
+
+ old_status = slm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL);
+ slm->status &= ~( INFO_PARTIAL | INFO_SELECT );
+
+ dle = SLM_GetDle( slm );
+
+ bsd = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd != NULL ) {
+
+ switch ( BSD_GetMarkStatus( bsd ) ) {
+
+ case ALL_SELECTED:
+ slm->status |= INFO_SELECT;
+ break;
+
+ case SOME_SELECTED:
+ slm->status |= (INFO_SELECT|INFO_PARTIAL);
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+ // Update the check mark
+
+ if ( old_status != (UINT16)(slm->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ DLM_Update( exchange_win,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ // Update the flat list now
+ slm = VLM_GetFirstSLM( wininfo->pFlatList );
+
+ while ( slm != NULL ) {
+
+ if ( ( EMS_MDB == SLM_GetMailType( slm ) ) ||
+ ( EMS_DSA == SLM_GetMailType( slm ) ) ) {
+
+ old_status = slm->status & (UINT16)(INFO_SELECT|INFO_PARTIAL);
+ slm->status &= ~( INFO_PARTIAL | INFO_SELECT );
+
+ dle = SLM_GetDle( slm );
+
+ bsd = BSD_FindByDLE( bsd_list, dle );
+
+ if ( bsd != NULL ) {
+
+ switch ( BSD_GetMarkStatus( bsd ) ) {
+
+ case ALL_SELECTED:
+ slm->status |= INFO_SELECT;
+ break;
+
+ case SOME_SELECTED:
+ slm->status |= (INFO_SELECT|INFO_PARTIAL);
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+ // Update the check mark
+
+ if ( old_status != (UINT16)(slm->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ DLM_Update( exchange_win,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ }
+}
+
+
+/**********************
+
+ NAME : VLM_ClearAllExchangeSelections
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+VOID VLM_ClearAllExchangeSelections( )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ SLM_OBJECT_PTR slm;
+ Q_ELEM_PTR qp_elem;
+ HWND exchange_win;
+
+ if ( QueueCount( &gq_exchange_win ) > 0 ) {
+
+ qp_elem = QueueHead( &gq_exchange_win );
+ if ( qp_elem != NULL ) {
+
+ exchange_win = ( HWND ) GetQueueElemPtr( qp_elem );
+
+ } else {
+
+ return;
+ }
+
+ } else {
+
+ return;
+ }
+
+ while ( exchange_win != (HWND)NULL ) {
+
+ wininfo = WM_GetInfoPtr( exchange_win );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( exchange_win );
+
+ slm = VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetStatus( slm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ SLM_SetStatus( slm, slm->status & (UINT16)~(INFO_PARTIAL|INFO_SELECT) );
+
+ DLM_Update( exchange_win, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ slm = VLM_GetFirstSLM( WMDS_GetFlatList( wininfo ) );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetStatus( slm ) & (INFO_SELECT|INFO_PARTIAL) ) {
+
+ SLM_SetStatus( slm, slm->status & (UINT16)~(INFO_PARTIAL|INFO_SELECT) );
+
+
+ DLM_Update( exchange_win, DLM_FLATLISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ qp_elem = QueueNext( qp_elem );
+
+ if ( qp_elem != NULL ) {
+
+ exchange_win = ( HWND ) GetQueueElemPtr( qp_elem );
+
+ } else {
+
+ exchange_win = NULL;
+ }
+ }
+}
+
+
+
+/**********************
+
+ NAME : VLM_ExchangeListCreate
+
+ DESCRIPTION :
+
+ Create the Exchange window.
+
+ RETURNS : nothing
+
+**********************/
+
+BOOLEAN VLM_ExchangeListCreate( CHAR_PTR szServer )
+{
+
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ HWND hWnd;
+ Q_ELEM_PTR pQElem;
+ DLM_INIT tree_dlm;
+ DLM_INIT flat_dlm;
+ Q_HEADER_PTR xchg_list;
+ Q_HEADER_PTR node_list;
+ CHAR title[ MAX_UI_RESOURCE_SIZE ];
+ CHAR szBuffer[ MAX_UI_RESOURCE_SIZE ];
+ CDS_PTR pCDS = CDS_GetPerm ();
+ GENERIC_DLE_PTR server_dle;
+ SLM_OBJECT_PTR anchor_slm;
+ SLM_OBJECT_PTR enterprise_slm;
+ SLM_OBJECT_PTR temp_slm;
+ GENERIC_DLE_PTR enterprise_dle;
+
+
+ if ( ( SUCCESS == DLE_FindByName( dle_list, szServer, FS_EMS_DRV, &server_dle ) ) ) {
+
+ // DLE tree already exists for this server.
+ gfExchange = TRUE;
+
+ // First find enterprise DLE for the server
+ enterprise_dle = DLE_GetEnterpriseDLE( server_dle );
+
+ if ( NULL == enterprise_dle ) {
+
+ return SUCCESS;
+ }
+
+ // Then check to see if the enterprise DLE is in a window.
+ if ( hWnd = DLE_GetEnterpriseWindow( enterprise_dle ) ) {
+
+ // if the DLE has an SLM then display it.
+ if ( NULL != ( wininfo = WM_GetInfoPtr( hWnd ) ) ) {
+
+ if ( NULL != ( xchg_list = WMDS_GetTreeList( wininfo ) ) ) {
+
+ if ( NULL != ( enterprise_slm = VLM_GetFirstSLM( xchg_list ) ) ) {
+
+ if ( NULL != ( anchor_slm = SLM_FindByDLE( server_dle, enterprise_slm ) ) ) {
+
+ SLM_DisplayExchangeDLE( server_dle );
+
+ } else {
+
+ // No slm. Find the first DLE parent with a SLM and display from there down.
+ enterprise_dle = DLE_GetParent( server_dle );
+ temp_slm = NULL;
+
+ while ( ( enterprise_dle ) &&
+ ( NULL == temp_slm ) ) {
+
+ temp_slm = SLM_FindByDLE( enterprise_dle, enterprise_slm );
+ enterprise_dle = DLE_GetParent( enterprise_dle );
+ }
+
+ if ( NULL != temp_slm ) {
+
+ // We found an ancestor slm in the tree. Let's add its newly born branch.
+ if ( NULL != ( anchor_slm = SLM_AddInExchangeChildren( xchg_list,
+ temp_slm,
+ -1,
+ server_dle ) ) ) {
+
+ // Restore the window if it's iconic
+ if ( IsIconic( hWnd ) ) {
+
+ SendMessage( ghWndMDIClient, WM_MDIRESTORE, (MPARAM1) hWnd, (MPARAM2) 0 );
+ }
+
+ // Update the listbox in the window and set the anchor to the newfound slm.
+ VLM_UpdateBrothers( xchg_list );
+ DLM_Update( hWnd, DLM_TREELISTBOX, WM_DLMUPDATELIST, (LMHANDLE)xchg_list, 0 );
+
+ SLM_EntSetObjects( anchor_slm, WM_DLMDOWN, 2 );
+
+ }
+
+ else return SUCCESS;
+ }
+
+ else return SUCCESS;
+ }
+
+ }
+
+ else return SUCCESS;
+ }
+
+ else return SUCCESS;
+ }
+
+ return SUCCESS;
+ }
+ }
+
+ if ( NULL == server_dle ) {
+
+ return SUCCESS;
+ }
+
+ xchg_list = (Q_HEADER_PTR)malloc( sizeof(Q_HEADER) );
+
+ if ( xchg_list == NULL ) {
+
+ return FAILURE;
+ }
+
+ InitQueue( xchg_list );
+
+ node_list = (Q_HEADER_PTR)malloc( sizeof(Q_HEADER) );
+
+ if ( node_list == NULL ) {
+
+ return FAILURE;
+ }
+
+ InitQueue( node_list );
+
+ appinfo = ( APPINFO_PTR )malloc( sizeof( APPINFO ) );
+
+ if ( appinfo == NULL ) {
+ return FAILURE;
+ }
+
+ appinfo->dle = NULL;
+
+ // initialize directory list queue
+ // This is the enterprise list queue for OEM_EMS
+
+ wininfo = ( WININFO_PTR )malloc( sizeof( WININFO ) );
+
+ if ( wininfo == NULL ) {
+ return FAILURE;
+ }
+
+ // fill in wininfo structure
+
+ WMDS_SetWinType( wininfo, WMTYPE_EXCHANGE );
+ WMDS_SetCursor( wininfo, RSM_CursorLoad( IDRC_HSLIDER ) );
+ WMDS_SetDragCursor( wininfo, 0 );
+ WMDS_SetIcon( wininfo, RSM_IconLoad( IDRI_EXCHANGE ) );
+ WMDS_SetWinHelpID( wininfo, 0 );
+ WMDS_SetStatusLineID( wininfo, 0 );
+ WMDS_SetRibbonState( wininfo, 0 );
+ WMDS_SetMenuState( wininfo, MMDOC_TREEANDDIR );
+ WMDS_SetRibbon( wininfo, NULL );
+ WMDS_SetTreeList( wininfo, xchg_list );
+ WMDS_SetFlatList( wininfo, node_list );
+ WMDS_SetTreeDisp( wininfo, NULL );
+ WMDS_SetFlatDisp( wininfo, NULL );
+ WMDS_SetAppInfo( wininfo, appinfo );
+ WMDS_SetSliderPos ( wininfo, CDS_GetTapeInfo ( pCDS ).nSliderPos );
+
+ // Init display list
+
+ DLM_ListBoxType( &tree_dlm, DLM_TREELISTBOX );
+ DLM_Mode( &tree_dlm, DLM_HIERARCHICAL );
+ DLM_Display( &tree_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &tree_dlm, xchg_list );
+ DLM_TextFont( &tree_dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &tree_dlm, SLM_EntGetItemCount );
+ DLM_GetFirstItem( &tree_dlm, SLM_EntGetFirstItem );
+ DLM_GetNext( &tree_dlm, SLM_EntGetNextItem );
+ DLM_GetPrev( &tree_dlm, SLM_EntGetPrevItem );
+ DLM_GetTag( &tree_dlm, SLM_EntGetTag );
+ DLM_SetTag( &tree_dlm, SLM_EntSetTag );
+ DLM_GetSelect( &tree_dlm, SLM_EntGetSelect );
+ DLM_SetSelect( &tree_dlm, SLM_EntSetSelect );
+ DLM_GetObjects( &tree_dlm, SLM_EntGetObjects );
+ DLM_SetObjects( &tree_dlm, SLM_EntSetObjects );
+ DLM_SSetItemFocus( &tree_dlm, NULL );
+ DLM_MaxNumObjects( &tree_dlm, 6 );
+
+ DLM_DispListInit( wininfo, &tree_dlm );
+
+ DLM_ListBoxType( &flat_dlm, DLM_FLATLISTBOX );
+ DLM_Mode( &flat_dlm, DLM_SINGLECOLUMN );
+ DLM_Display( &flat_dlm, DLM_SMALL_BITMAPS );
+ DLM_DispHdr( &flat_dlm, node_list );
+ DLM_TextFont( &flat_dlm, DLM_SYSTEM_FONT );
+ DLM_GetItemCount( &flat_dlm, SLM_NodeGetItemCount );
+ DLM_GetFirstItem( &flat_dlm, SLM_NodeGetFirstItem );
+ DLM_GetNext( &flat_dlm, SLM_NodeGetNextItem );
+ DLM_GetPrev( &flat_dlm, SLM_NodeGetPrevItem );
+ DLM_GetTag( &flat_dlm, SLM_NodeGetTag );
+ DLM_SetTag( &flat_dlm, SLM_NodeSetTag );
+ DLM_GetSelect( &flat_dlm, SLM_NodeGetSelect );
+ DLM_SetSelect( &flat_dlm, SLM_NodeSetSelect );
+ DLM_GetObjects( &flat_dlm, SLM_NodeGetObjects );
+ DLM_SetObjects( &flat_dlm, SLM_NodeSetObjects );
+ DLM_SSetItemFocus( &flat_dlm, NULL );
+ DLM_MaxNumObjects( &flat_dlm, 6 );
+
+ DLM_DispListInit( wininfo, &flat_dlm );
+
+ anchor_slm = VLM_BuildExchangeList( xchg_list, wininfo, server_dle );
+ enterprise_slm = VLM_GetFirstSLM( xchg_list );
+
+ appinfo->dle = SLM_GetDle( enterprise_slm );
+
+ // open a new window
+ RSM_StringCopy ( IDS_VLMEMSTITLE, title, MAX_UI_RESOURCE_LEN );
+ wsprintf( szBuffer, title, SLM_GetName( enterprise_slm ) );
+ strcpy ( title, SLM_GetName( enterprise_slm ) );
+
+ hWnd = WM_Create( WM_MDIPRIMARY | WM_TREELIST | WM_TREEANDFLATSC | WM_MENUS,
+ szBuffer,
+ title,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ WM_DEFAULT,
+ wininfo );
+
+ appinfo->win = hWnd;
+ WMDS_SetWin( wininfo, hWnd );
+
+ // Start display manager up.
+
+ DLM_DispListProc( WMDS_GetWinTreeList( wininfo ), 0, NULL );
+ DLM_DispListProc( WMDS_GetWinFlatList( wininfo ), 0, NULL );
+
+ DLM_Update( hWnd,
+ DLM_TREELISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pTreeList, 0 );
+
+ // Now that it is displayed, set the anchor.
+ anchor_slm = ( NULL != anchor_slm ) ? anchor_slm : enterprise_slm;
+ appinfo->open_slm = anchor_slm;
+ SLM_EntSetObjects( anchor_slm, WM_DLMDOWN, 2 );
+
+ DLM_Update( hWnd,
+ DLM_FLATLISTBOX,
+ WM_DLMUPDATELIST,
+ (LMHANDLE)wininfo->pFlatList, 0 );
+
+ pQElem = ( Q_ELEM_PTR ) malloc( sizeof( Q_ELEM ) );
+ InitQElem( pQElem );
+ QueuePtr( pQElem ) = (VOID *) hWnd;
+ EnQueueElem( &gq_exchange_win, pQElem, FALSE );
+
+ return SUCCESS;
+}
+
+
+/**********************
+
+ NAME : SLM_DisplayExchangeDLE
+
+ DESCRIPTION :
+
+ Open the window and set the anchor to the slm corresponding to the input dle
+
+ RETURNS :
+
+**********************/
+BOOLEAN SLM_DisplayExchangeDLE(
+ GENERIC_DLE_PTR dle
+)
+{
+
+ GENERIC_DLE_PTR enterprise_dle;
+ HWND enterprise_win;
+ WININFO_PTR wininfo;
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR enterprise_slm;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR parent_slm;
+ SLM_OBJECT_PTR sib_slm;
+
+ // First, find the enterprise dle for the input dle.
+ if ( NULL == ( enterprise_dle = DLE_GetEnterpriseDLE( dle ) ) ) {
+
+ return FALSE;
+ }
+
+ // Next, get the enterprise window.
+ if ( ! ( enterprise_win = DLE_GetEnterpriseWindow( enterprise_dle ) ) ) {
+
+ return FALSE;
+ }
+
+ // Get the enterprise slm.
+ if ( NULL != ( wininfo = WM_GetInfoPtr( enterprise_win ) ) ) {
+
+ if ( NULL != ( slm_list = WMDS_GetTreeList( wininfo ) ) ) {
+
+ if ( NULL != ( enterprise_slm = VLM_GetFirstSLM( slm_list ) ) ) {
+
+ if ( NULL == ( slm = SLM_FindByDLE( dle, enterprise_slm ) ) ) {
+
+ return FALSE;
+ }
+ }
+ }
+ }
+
+ // Set the display attributes for the slm, its parent, grandparents, and aunts and uncles
+ // Direct ancestors get display & expand, aunts, uncles and siblings get diplay.
+ if ( ! ( INFO_DISPLAY & SLM_GetStatus( slm ) ) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | INFO_DISPLAY );
+
+ parent_slm = SLM_GetParent( slm );
+
+ while ( parent_slm ) {
+
+ // First the parent
+ SLM_SetStatus( parent_slm, SLM_GetStatus( slm ) | INFO_DISPLAY | INFO_EXPAND );
+
+ // Then the sibs
+ sib_slm = VLM_GetNextSLM( parent_slm );
+
+ while( sib_slm ) {
+
+ SLM_SetStatus( sib_slm, SLM_GetStatus( slm ) | INFO_DISPLAY );
+ sib_slm = sib_slm->next_brother;
+ }
+
+ parent_slm = SLM_GetParent( parent_slm );
+ }
+ }
+
+ // Restore the window if it's iconic
+ if ( IsIconic( enterprise_win ) ) {
+
+ SendMessage( ghWndMDIClient, WM_MDIRESTORE, (MPARAM1) enterprise_win, (MPARAM2) 0 );
+ }
+
+ // Update the listbox in the window and set the anchor to the newfound slm.
+ DLM_Update( enterprise_win, DLM_TREELISTBOX, WM_DLMUPDATELIST, (LMHANDLE)slm_list, 0 );
+
+ SLM_EntSetObjects( slm, WM_DLMDOWN, 2 );
+
+ return TRUE;
+
+}
+
+/**********************
+
+ NAME : SLM_FreeSLMList
+
+ DESCRIPTION :
+
+ The user has closed an Exchange window (or all of them) and we need to
+ free up the SLM lists displayed in the window.
+
+ RETURNS :
+
+**********************/
+
+VOID SLM_EMSFreeSLMList(
+ Q_HEADER_PTR pqHdr
+)
+{
+ SLM_OBJECT_PTR slm;
+ Q_ELEM_PTR pElem;
+
+ if ( pqHdr == NULL ) {
+
+ return;
+ }
+
+ pElem = DeQueueElem( pqHdr );
+
+ while ( pElem != NULL ) {
+
+ slm = ( SLM_OBJECT_PTR ) QueuePtr( pElem );
+
+ if( slm != NULL ) {
+
+ // Remove the BSD for this slm.
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) & ~INFO_SELECT );
+ SLM_AddBSD( slm );
+
+ free( slm );
+ }
+
+ pElem = DeQueueElem( pqHdr );
+ }
+}
+
+
+/**********************
+
+ NAME : VLM_BuildExchangeList
+
+ DESCRIPTION :
+
+ Go through the global DLE list and create VLM entries for all the
+ enterprises you find.
+
+ RETURNS : nothing
+
+**********************/
+
+static SLM_OBJECT_PTR VLM_BuildExchangeList(
+Q_HEADER_PTR enterprise_list, // I - queue of enterprises
+WININFO_PTR wininfo,
+GENERIC_DLE_PTR server_dle ) // I
+{
+ GENERIC_DLE_PTR enterprise_dle;
+ SLM_OBJECT_PTR enterprise_slm;
+ CHAR dev_name[MAX_DEVICE_NAME_LEN];
+ SLM_OBJECT_PTR return_slm = NULL;
+ // SLM_OBJECT_PTR brother_slm;
+
+ if ( NULL == server_dle ) {
+
+ return ( NULL );
+ }
+
+ // Find the enterprise DLE for the server
+ enterprise_dle = DLE_GetEnterpriseDLE( server_dle );
+
+ if ( enterprise_dle != NULL ) {
+
+ if ( ( SLM_FindSLMByName( enterprise_list,
+ DLE_GetDeviceName( enterprise_dle ) ) ) == NULL ) {
+
+ DLE_DeviceDispName( enterprise_dle, dev_name, MAX_DEVICE_NAME_LEN, 0 );
+
+ enterprise_slm = SLM_CreateSLM( strsize( dev_name ),
+ (INT16)(strsize( DLE_GetDeviceName( enterprise_dle ) ) ),
+ (INT) 4,
+ FALSE,
+ FALSE );
+
+ if ( enterprise_slm != NULL ) {
+
+ SLM_SetName( enterprise_slm, dev_name );
+ SLM_SetOriginalName( enterprise_slm, DLE_GetDeviceName( enterprise_dle ) );
+ SLM_SetStatus( enterprise_slm, INFO_DISPLAY | INFO_VALID | INFO_EXPAND );
+ SLM_SetLevel( enterprise_slm, 0 );
+ SLM_SetAttribute( enterprise_slm, 0 );
+ SLM_SetXtraBytes( enterprise_slm, wininfo );
+ SLM_SetNextBrother( enterprise_slm, NULL );
+ SLM_SetMailType( enterprise_slm, EMS_ENTERPRISE );
+ SLM_SetParent( enterprise_slm, NULL );
+ SLM_SetDle( enterprise_slm, enterprise_dle );
+
+ EnQueueElem( enterprise_list, &(enterprise_slm->q_elem), FALSE );
+
+ // Now let check for children do the rest
+
+ if ( SLM_FindEnterpriseChildren( enterprise_list, enterprise_slm, -1, server_dle, &return_slm ) ) {
+
+ SLM_SetStatus( enterprise_slm, SLM_GetStatus( enterprise_slm ) | (UINT16)INFO_SUBS );
+
+ VLM_UpdateBrothers( enterprise_list );
+ }
+ }
+ }
+ }
+
+ return ( return_slm );
+}
+
+
+/**********************
+
+ NAME : SLM_FindSLMByName
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static SLM_OBJECT_PTR SLM_FindSLMByName (
+ Q_HEADER_PTR slm_list, CHAR_PTR name
+ )
+{
+ SLM_OBJECT_PTR slm;
+
+ slm = VLM_GetFirstSLM( slm_list );
+
+ while ( slm != NULL ) {
+
+ if ( ! stricmp( name, SLM_GetOriginalName( slm ) ) ) {
+ return( slm );
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ return( slm );
+
+}
+
+/**********************
+
+ NAME : SLM_XchgCompare
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+INT16 SLM_XchgCompare(
+Q_ELEM_PTR e1, // I - queue element 1
+Q_ELEM_PTR e2 ) // I - queue element 2
+{
+ SLM_OBJECT_PTR slm1, slm2;
+
+ slm1 = ( SLM_OBJECT_PTR )e1->q_ptr;
+ slm2 = ( SLM_OBJECT_PTR )e2->q_ptr;
+
+ // sort by alphabet
+
+ return( (INT16)stricmp( SLM_GetName( slm1 ), SLM_GetName( slm2 ) ) );
+}
+
+
+/**********************
+
+ NAME : SLM_FindExchangeChildren
+
+ DESCRIPTION :
+
+ We wish to see what children exist for a given enterprise. So do a quick
+ attach to make the children visible and build SLM structures for them.
+
+ RETURNS : number of children (volumes) found.
+
+**********************/
+
+
+static INT SLM_FindEnterpriseChildren(
+ Q_HEADER_PTR exchange_list,
+ SLM_OBJECT_PTR enterprise_slm,
+ INT level,
+ GENERIC_DLE_PTR server_dle,
+ SLM_OBJECT_PTR *return_slm
+ )
+{
+
+ *return_slm = SLM_AddInExchangeChildren( exchange_list, enterprise_slm, level, server_dle );
+
+ return( DLE_GetNumChild( SLM_GetDle( enterprise_slm) ) );
+}
+
+/**********************
+
+ NAME : SLM_AddInExchangeChildren
+
+ DESCRIPTION :
+
+ Adds SLM structures for all the Exchange volumes.
+
+
+ RETURNS : nothing.
+
+**********************/
+
+static SLM_OBJECT_PTR SLM_AddInExchangeChildren(
+ Q_HEADER_PTR exchange_list,
+ SLM_OBJECT_PTR parent_slm , // I - Exchange slm
+ INT level,
+ GENERIC_DLE_PTR server_dle
+ )
+{
+ GENERIC_DLE_PTR parent_dle;
+ GENERIC_DLE_PTR dle;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR return_slm = NULL;
+ SLM_OBJECT_PTR prev_slm_inserted = NULL;
+ SLM_OBJECT_PTR sibling_slm = NULL;
+ WININFO_PTR wininfo;
+ CHAR dev_name[ MAX_DEVICE_NAME_LEN ];
+ UINT16 dev_name_len;
+ UINT32 server_status = INFO_VALID;
+
+ wininfo = SLM_GetXtraBytes ( parent_slm );
+ parent_dle = SLM_GetDle( parent_slm );
+
+ if ( parent_dle == NULL ) {
+ return ( NULL );
+ }
+
+ DLE_GetFirstChild( parent_dle, &dle );
+
+ while ( dle != NULL ) {
+
+ if ( ( DLE_GetDeviceSubType( dle ) != EMS_MDB ) &&
+ ( DLE_GetDeviceSubType( dle ) != EMS_DSA ) ) {
+
+ DLE_DeviceDispName( dle, dev_name, MAX_DEVICE_NAME_LEN, 0 );
+ dev_name_len = strsize( dev_name );
+
+ if ( ( (slm = SLM_FindSLMByName( WMDS_GetTreeList ( wininfo ),
+ dev_name )) == NULL) || slm->level <= parent_slm->level ) {
+
+ slm = SLM_CreateSLM( dev_name_len,
+ strsize( DLE_GetDeviceName( dle ) ) ,
+ (INT)( ( 4 * ( ( ( SLM_GetLevel( parent_slm ) + 1 ) / 32 ) + 1 ) ) ),
+ FALSE,
+ FALSE );
+
+ if ( slm != NULL ) {
+
+ SLM_SetName( slm, dev_name );
+ SLM_SetOriginalName( slm, DLE_GetDeviceName( dle ) );
+ SLM_SetLevel( slm, SLM_GetLevel( parent_slm ) + 1 );
+ SLM_SetAttribute( slm, 0 );
+ SLM_SetXtraBytes( slm, wininfo );
+ SLM_SetNextBrother( slm, NULL );
+ SLM_SetMailType( slm, DLE_GetDeviceSubType( dle ) );
+ SLM_SetParent( slm, parent_slm );
+ SLM_SetDle( slm, dle );
+
+ // Show all the siblings of the connected server
+ if ( dle == server_dle ) {
+
+ SLM_SetStatus( parent_slm, SLM_GetStatus( parent_slm ) | INFO_EXPAND );
+ server_status = INFO_VALID | INFO_DISPLAY;
+
+ // Get first child of the parent and mark it and all brothers.
+ sibling_slm = VLM_GetNextSLM( parent_slm );
+
+ while ( sibling_slm ) {
+
+ SLM_SetStatus ( sibling_slm, server_status );
+ sibling_slm = sibling_slm->next_brother;
+ }
+
+ // Save the current slm for returning.
+ return_slm = slm;
+ }
+
+ switch( DLE_GetDeviceSubType( dle ) ) {
+
+ case EMS_SERVER:
+ SLM_SetStatus( slm, server_status );
+ break;
+
+ case EMS_SITE:
+ SLM_SetStatus( slm, INFO_VALID | INFO_DISPLAY );
+ break;
+
+ default:
+ SLM_SetStatus( slm, INFO_VALID | INFO_DISPLAY | INFO_EXPAND );
+ break;
+
+ }
+
+ // Added the new slm to the total list and the parent's children.
+ VLM_InsertXchgSLM( exchange_list, parent_slm, prev_slm_inserted, slm );
+ prev_slm_inserted = slm;
+
+ if ( DLE_GetNumChild( dle ) > 0 ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | (UINT16)INFO_SUBS );
+
+ if ( 1 != level ) { // -1 means keep going until you run out of DLE children
+
+ sibling_slm = SLM_AddInExchangeChildren( exchange_list, slm, level - 1, server_dle );
+
+ if ( NULL != sibling_slm ) {
+ return_slm = sibling_slm;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ DLE_GetNext( &dle );
+ }
+
+ return ( return_slm );
+ // SortQueue( & SLM_GetChildren( parent_slm ), SLM_XchgCompare );
+}
+
+/***************************************************
+
+ Name: SLM_CreateSLM
+
+ Description:
+
+ Creates an SLM object for you.
+
+ Returns: either a pointer or NULL.
+
+*****************************************************/
+
+
+static SLM_OBJECT_PTR SLM_CreateSLM(
+ INT name_size,
+ INT original_name_size,
+ INT brother_bytes,
+ BOOLEAN use_stats,
+ BOOLEAN fat_drive )
+{
+ SLM_OBJECT_PTR slm;
+ INT slm_size;
+
+ // Everything must be 32 bit (4 byte) aligned for MIPs, so we
+ // round up all the sizes to the next 4 byte boundary (if
+ // required).
+
+ slm_size = sizeof( SLM_OBJECT );
+ if ( slm_size % 4 ) {
+ slm_size += 4 - ( slm_size % 4 );
+ }
+
+ if ( brother_bytes % 4 ) {
+ brother_bytes += 4 - ( brother_bytes % 4 );
+ }
+
+ if ( name_size % 4 ) {
+ name_size += 4 - ( name_size % 4 );
+ }
+
+ if ( original_name_size % 4 ) {
+ original_name_size += 4 - ( original_name_size % 4 );
+ }
+
+ slm = ( SLM_OBJECT_PTR )malloc( slm_size +
+ name_size +
+ original_name_size +
+ brother_bytes +
+ 0 );
+
+ if ( slm != NULL ) {
+
+ // The seemingly redundant casting is for unicode support
+
+ slm->name = (CHAR_PTR) ( ((BYTE_PTR)slm) + slm_size );
+ slm->original_name = (CHAR_PTR) ( ((BYTE_PTR)slm->name) + name_size );
+ slm->brothers = ((BYTE_PTR)slm->original_name) + original_name_size;
+ slm->q_elem.q_ptr = slm;
+ }
+
+ return( slm );
+}
+
+/**********************
+
+ NAME : VLM_InsertXchgSLM
+
+ DESCRIPTION :
+
+ Used to insert an slm into an Exchange based tree.
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_InsertXchgSLM(
+ Q_HEADER_PTR slm_list,
+ SLM_OBJECT_PTR parent_slm,
+ SLM_OBJECT_PTR prev_slm,
+ SLM_OBJECT_PTR new_slm
+ )
+{
+
+ SLM_OBJECT_PTR temp_slm; // used to move through list
+ SLM_OBJECT_PTR best_slm; // insert after this guy
+ SLM_OBJECT_PTR last_brother; // new guy's prev brother after insertion
+ SLM_OBJECT_PTR next_brother; // new guy's next brother after insertion
+ INT level; // height of new guy in tree
+
+
+ // Get height of new item.
+
+ level = new_slm->level;
+
+ // Now find the right location to insert the new slm among his brothers.
+
+ best_slm = parent_slm;
+
+ last_brother = NULL;
+ next_brother = NULL;
+
+ // Try to skip a bunch of the brothers, to speed the insertion.
+
+ if ( prev_slm != NULL ) {
+
+ if ( stricmp( prev_slm->name, new_slm->name ) < 0 ) {
+
+ best_slm = prev_slm;
+ last_brother = best_slm;
+ }
+ }
+
+ temp_slm = best_slm;
+
+ if ( best_slm->level < level ) {
+
+ temp_slm = VLM_GetNextSLM( best_slm );
+ if ( ( temp_slm != NULL ) && ( temp_slm->level != level ) ) {
+ temp_slm = NULL;
+ }
+ }
+
+ // Look through all this guys brothers for correct insertion spot.
+ // temp_slm is NULL or first brother in family.
+
+ while ( temp_slm ) {
+
+ next_brother = temp_slm;
+
+ if ( stricmp( temp_slm->name, new_slm->name ) >= 0 ) {
+
+ // Get out of while loop, we have found the
+ // correct brother to insert before.
+ break;
+ }
+
+ last_brother = temp_slm;
+ best_slm = temp_slm;
+ temp_slm = temp_slm->next_brother;
+ }
+
+ // Insert after best_slm and any children > level.
+ // best_slm may have children and we need to insert after those kids.
+
+ if ( ( best_slm->level == level ) && ( best_slm->next_brother != NULL ) ) {
+
+ // If same height get last kid slm before next brother.
+
+ best_slm = VLM_GetPrevSLM( best_slm->next_brother );
+
+ }
+ else {
+
+ temp_slm = best_slm;
+
+ while ( temp_slm ) {
+
+ if ( temp_slm->level < level ) {
+
+ break;
+ }
+
+ best_slm = temp_slm;
+
+ if ( temp_slm->next_brother != NULL ) {
+ temp_slm = temp_slm->next_brother;
+ }
+ else {
+ temp_slm = VLM_GetNextSLM( temp_slm );
+ }
+
+ }
+ }
+
+ // Update the next_brother pointers.
+
+ if ( last_brother != NULL ) {
+
+ // new_slm is not the first brother.
+
+ new_slm->next_brother = last_brother->next_brother;
+ last_brother->next_brother = new_slm;
+ }
+ else {
+
+ // We need to set this guy's next brother if he has one.
+ // new_slm has become the first brother in the family.
+
+ new_slm->next_brother = next_brother;
+ }
+
+ // Perform insertion.
+
+ InsertElem( slm_list, &(best_slm->q_elem), &(new_slm->q_elem), AFTER );
+}
+
+/**********************
+
+ NAME : SLM_EntSetSelect
+
+ DESCRIPTION :
+
+ RETURNS : nothing
+
+**********************/
+
+static VOID_PTR SLM_EntSetSelect(
+SLM_OBJECT_PTR enterprise_slm,
+BYTE attr )
+{
+ HWND window;
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ UINT16 status;
+ BOOLEAN all_subdirs;
+ SLM_OBJECT_PTR parent_slm;
+
+ GENERIC_DLE_PTR dle = NULL;
+
+ all_subdirs = (BOOLEAN) CDS_GetIncludeSubdirs( CDS_GetPerm() );
+
+ if ( attr ) {
+
+ if ( all_subdirs ) {
+
+ // include all subdirs
+
+ status = INFO_SELECT;
+ }
+ else {
+ status = (INFO_SELECT|INFO_PARTIAL);
+ }
+ }
+ else {
+ status = 0;
+ }
+
+ window = enterprise_slm->XtraBytes->hWnd;
+ wininfo = WM_GetInfoPtr( window );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( window );
+
+ if ( status != (UINT16)( enterprise_slm->status & (INFO_SELECT|INFO_PARTIAL) ) ) {
+
+ enterprise_slm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+ enterprise_slm->status |= status;
+
+ if ( FALSE == SLM_AddBSD ( enterprise_slm ) ) {
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMUPDATEITEM, (LMHANDLE)enterprise_slm, 0 );
+ }
+ }
+
+ // If this node is open then update its children in the node list.
+ if ( SLM_GetStatus( enterprise_slm ) & INFO_OPEN ) {
+
+ SLM_UpdateNodeList( enterprise_slm, attr );
+
+ }
+
+ /* Mark the children correctly (this will also update the node list,
+ if any of the children are open). */
+
+ VLM_MarkAllEntSLMChildren( enterprise_slm, attr );
+
+ // If this one's parent is open, then update it counterpart in the node list.
+ parent_slm = SLM_GetParent( enterprise_slm );
+
+ if ( ( NULL != parent_slm ) &&
+ ( SLM_GetStatus ( parent_slm ) & INFO_OPEN ) ) {
+
+ SLM_UpdateNode ( enterprise_slm );
+
+ }
+
+ // Set the selection for the parents to partial, if necessary.
+ VLM_MarkAllEntSLMParents( enterprise_slm, attr );
+
+ return( NULL );
+}
+
+/**********************
+
+ NAME : SLM_AddBSD
+
+ DESCRIPTION :
+
+ Given an slm pointer, create or remove a bsd for its DLE, based on its status.
+
+ RETURNS : TRUE if there's an error, FALSE otherwise.
+
+**********************/
+static INT SLM_AddBSD (
+ SLM_OBJECT_PTR slm
+)
+
+{
+ BSET_OBJECT_PTR pbset = NULL;
+ BSD_PTR pbsd = NULL;
+ FSE_PTR pfse = NULL;
+ BE_CFG_PTR pbeConfig = NULL;
+ GENERIC_DLE_PTR dle;
+ GENERIC_DLE_PTR server_dle = SLM_GetDle( slm );
+
+ if( NULL == server_dle ) {
+
+ return TRUE;
+
+ }
+
+ switch ( SLM_GetMailType( slm ) ) {
+
+ case EMS_SERVER:
+ DLE_GetFirstChild( server_dle, &dle );
+ break;
+
+ case EMS_MDB:
+ case EMS_DSA:
+ dle = SLM_GetDle( slm );
+ break;
+
+ default:
+ dle = NULL;
+ }
+
+ while ( NULL != dle ) {
+
+ pbsd = BSD_FindByDLE ( bsd_list, dle );
+
+ if ( slm->status & INFO_SELECT ) {
+
+ if ( pbsd == NULL ) {
+
+ if ( BSD_CreatFSE( &pfse, (INT16)INCLUDE,
+ (CHAR_PTR) TEXT( "" ),
+ (INT16) sizeof( CHAR ),
+ (CHAR_PTR) ALL_FILES,
+ (INT16) ALL_FILES_LENG,
+ (BOOLEAN) USE_WILD_CARD,
+ (BOOLEAN) TRUE ) != SUCCESS ) {
+
+ return( TRUE );
+
+ }
+
+ pbeConfig = BEC_CloneConfig( CDS_GetPermBEC() );
+ BEC_UnLockConfig( pbeConfig );
+
+ BSD_Add( bsd_list, &pbsd, pbeConfig, NULL,
+ dle, (UINT32)-1L, (UINT16)-1, (INT16)-1, NULL, NULL );
+
+ if ( pbsd != NULL ) {
+
+ BSD_AddFSE( pbsd, pfse );
+ }
+ }
+
+ } else {
+
+ pbsd = BSD_FindByDLE ( bsd_list, dle );
+
+ if ( NULL != pbsd ) {
+
+ BSD_Remove ( pbsd );
+
+ }
+ }
+
+ switch ( SLM_GetMailType ( slm ) ) {
+
+ case EMS_SERVER:
+ DLE_GetNext( &dle );
+ break;
+
+ default:
+ dle = NULL;
+ }
+ }
+
+ return FALSE;
+}
+
+
+/**********************
+
+ NAME : VLM_MarkAllEntSLMChildren
+
+ DESCRIPTION :
+
+ Given an slm pointer, mark all his children as selected, unselected, or
+ partially selected.
+
+ attr: 2 = partial
+ 1 = selected
+ 0 = unselected
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_MarkAllEntSLMChildren(
+ SLM_OBJECT_PTR enterprise_slm, // I - slm to use
+ BYTE attr // I - attribute to set
+ )
+
+{
+
+ HWND window;
+ INT level;
+ WININFO_PTR wininfo;
+ Q_HEADER_PTR pNodeList;
+ SLM_OBJECT_PTR slm = enterprise_slm;
+
+ window = slm->XtraBytes->hWnd;
+ wininfo = SLM_GetXtraBytes ( slm );
+ pNodeList = WMDS_GetFlatList ( wininfo );
+
+ level = slm->level;
+
+ slm = VLM_GetNextSLM( slm );
+
+ while ( slm != NULL ) {
+
+ if ( slm->level <= level ) {
+ break;
+ }
+
+ if ( attr ) {
+
+ if ( ( SLM_GetStatus( slm ) & (INFO_PARTIAL|INFO_SELECT) ) != INFO_SELECT ) {
+
+ slm->status |= INFO_SELECT;
+ slm->status &= ~INFO_PARTIAL;
+
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+ }
+ else {
+
+ if ( slm->status & (INFO_PARTIAL|INFO_SELECT) ) {
+
+ slm->status &= ~(INFO_SELECT|INFO_PARTIAL);
+
+ DLM_Update( window, DLM_TREELISTBOX,
+ WM_DLMUPDATEITEM,
+ (LMHANDLE)slm, 0 );
+ }
+ }
+
+ if ( SLM_GetStatus( slm ) & INFO_OPEN ) {
+
+ SLM_UpdateNodeList( slm, attr );
+
+ }
+
+ SLM_AddBSD( slm );
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ if ( SLM_GetStatus( enterprise_slm ) & INFO_OPEN ) {
+
+ SLM_UpdateNodeList( enterprise_slm, attr );
+
+ }
+
+ return;
+
+}
+
+/**********************
+
+ NAME : SLM_UpdateNodeList
+
+ DESCRIPTION :
+
+ Set the status on the list of nodes appearing in the node list window.
+
+ RETURNS :
+
+**********************/
+
+static VOID SLM_UpdateNodeList(
+ SLM_OBJECT_PTR slm,
+ BYTE attr
+)
+{
+ WININFO_PTR wininfo = SLM_GetXtraBytes ( slm );
+ HWND window = WMDS_GetWin ( wininfo );
+ Q_HEADER_PTR pNodeList = WMDS_GetFlatList ( wininfo );
+ SLM_OBJECT_PTR node_slm = VLM_GetFirstSLM( pNodeList );
+ UINT16 status = ( attr ) ? INFO_SELECT : 0;
+
+ while ( NULL != node_slm ) {
+
+ SLM_SetStatus ( node_slm, SLM_GetStatus ( node_slm ) & ~(INFO_SELECT | INFO_PARTIAL ) );
+ SLM_SetStatus ( node_slm, SLM_GetStatus ( node_slm ) | status );
+
+ node_slm = VLM_GetNextSLM( node_slm );
+
+ }
+
+ DLM_Update( window, DLM_FLATLISTBOX, WM_DLMUPDATELIST, (LMHANDLE)node_slm, 0 );
+}
+
+
+/**********************
+
+ NAME : SLM_UpdateNode
+
+ DESCRIPTION :
+
+ Set the status on a node from the tree list also appearing in the flat list.
+
+ RETURNS :
+
+**********************/
+
+static VOID SLM_UpdateNode (
+ SLM_OBJECT_PTR enterprise_slm
+)
+{
+ WININFO_PTR wininfo = SLM_GetXtraBytes ( enterprise_slm );
+ HWND window = WMDS_GetWin ( wininfo );
+ Q_HEADER_PTR pNodeList = WMDS_GetFlatList ( wininfo );
+ SLM_OBJECT_PTR node_slm = VLM_GetFirstSLM( pNodeList );
+ GENERIC_DLE_PTR dle = SLM_GetDle ( enterprise_slm );
+
+ while ( NULL != node_slm ) {
+
+ if ( dle == SLM_GetDle ( node_slm ) ) {
+
+ SLM_SetStatus ( node_slm, SLM_GetStatus ( enterprise_slm ) );
+ break;
+ }
+
+ node_slm = VLM_GetNextSLM( node_slm );
+
+ }
+
+ if ( NULL != node_slm ) {
+
+ DLM_Update( window, DLM_FLATLISTBOX, WM_DLMUPDATEITEM, (LMHANDLE)node_slm, 0 );
+ }
+
+}
+
+
+/**********************
+
+ NAME : VLM_MarkAllEntSLMParents
+
+ DESCRIPTION :
+
+ Marks all the parents of an slm node in the hierarchical tree.
+
+ RETURNS :
+
+**********************/
+
+static VOID VLM_MarkAllEntSLMParents(
+ SLM_OBJECT_PTR enterprise_slm,
+ BYTE attr
+)
+{
+ WININFO_PTR wininfo = SLM_GetXtraBytes ( enterprise_slm );
+ HWND window = WMDS_GetWin ( wininfo );
+ SLM_OBJECT_PTR parent_slm = SLM_GetParent ( enterprise_slm );
+ SLM_OBJECT_PTR child_slm;
+ UINT32 status;
+ UINT8 level;
+
+ while ( NULL != parent_slm ) {
+
+ level = SLM_GetLevel ( parent_slm );
+
+ // We can be sure one child exists so the next slm in the list is the first child.
+ child_slm = VLM_GetNextSLM ( parent_slm );
+
+ status = SLM_GetStatus ( child_slm ) & ( INFO_PARTIAL | INFO_SELECT );
+
+ while ( child_slm ) {
+
+ // If the child has a different selection status then the parent is partial
+ if ( ( SLM_GetStatus ( child_slm ) & ( INFO_PARTIAL | INFO_SELECT ) ) != status ) {
+
+ status = INFO_PARTIAL | INFO_SELECT;
+ break;
+ }
+
+ // If the child's level is less than or equal to the parent's level then it's not a child.
+ child_slm = VLM_GetNextSLM ( child_slm );
+
+ if ( ( NULL == child_slm ) ||
+ ( SLM_GetLevel ( child_slm ) <= level ) ) {
+
+ break ;
+ }
+ }
+
+ status |= SLM_GetStatus ( parent_slm ) & ~( INFO_PARTIAL | INFO_SELECT );
+ SLM_SetStatus ( parent_slm, status );
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMUPDATEITEM, (LMHANDLE)parent_slm, 0 );
+
+ // If this parent's parent is open then update its counterpart in the node window.
+ child_slm = parent_slm;
+
+ parent_slm = SLM_GetParent ( child_slm );
+
+ if ( ( NULL != parent_slm ) &&
+ ( SLM_GetStatus ( parent_slm ) & INFO_OPEN ) ) {
+
+ SLM_UpdateNode ( child_slm );
+ }
+ }
+}
+
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static BYTE SLM_EntGetSelect( SLM_OBJECT_PTR slm )
+{
+ if ( slm->status & INFO_SELECT ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR SLM_EntSetTag( SLM_OBJECT_PTR slm, BYTE attr )
+{
+
+ if ( attr ) {
+ slm->status |= INFO_TAGGED;
+ }
+ else {
+ slm->status &= ~INFO_TAGGED;
+ }
+ return(NULL);
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static BYTE SLM_EntGetTag( SLM_OBJECT_PTR slm )
+{
+ if ( INFO_TAGGED & slm->status ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static USHORT SLM_EntGetItemCount( Q_HEADER_PTR exchange_list )
+{
+ USHORT count = 0;
+ SLM_OBJECT_PTR slm;
+
+ slm = VLM_GetFirstSLM( exchange_list );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_DISPLAY ) {
+ count++;
+ }
+
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ return( count );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR SLM_EntGetFirstItem( Q_HEADER_PTR xchg_list )
+{
+ SLM_OBJECT_PTR slm;
+
+ slm = VLM_GetFirstSLM( xchg_list );
+
+ while ( slm != NULL ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_DISPLAY ) {
+ return( slm );
+ }
+ slm = VLM_GetNextSLM( slm );
+ }
+
+ return( slm );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR SLM_EntGetPrevItem( SLM_OBJECT_PTR slm )
+{
+ do {
+
+ slm = VLM_GetPrevSLM( slm );
+
+ if ( slm == NULL ) {
+ break;
+ }
+
+ } while ( ! ( SLM_GetStatus( slm ) & INFO_DISPLAY ) );
+
+ return( slm );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR SLM_EntGetNextItem( SLM_OBJECT_PTR slm )
+{
+ do {
+
+ slm = VLM_GetNextSLM( slm );
+
+ if ( slm == NULL ) {
+ break;
+ }
+ } while ( ! ( SLM_GetStatus( slm ) & INFO_DISPLAY ) );
+
+ return( slm );
+}
+
+/**********************
+
+ NAME :
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static VOID_PTR SLM_EntGetObjects( SLM_OBJECT_PTR slm )
+{
+
+ BYTE_PTR memblk;
+ BYTE_PTR buff;
+ BYTE_PTR source;
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+ INT16 num_blocks;
+ INT i;
+
+ /* malloc enough room to store info */
+
+ wininfo = SLM_GetXtraBytes( slm );
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( wininfo->hWndTreeList );
+
+ buff = memblk;
+
+ *buff++ = 3; // number of objects in list to display
+
+ // pass DLM the hierarchical stuff he needs for lines
+
+
+ num_blocks = (UINT16)(( slm->level / 32 ) + 1);
+
+ *buff++ = (BYTE)num_blocks;
+
+ source = (BYTE_PTR)slm->brothers;
+
+ for ( i = 0; i < ( 4 * num_blocks ); i++ ) {
+ *buff++ = *source++;
+ }
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)buff;
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( slm->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( slm->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = (BYTE)SLM_GetLevel( slm );
+ // DLM_ItembTag( item ) = 0;
+
+ /* Set up Bitmap, ie. Floppy, Hard, Network. */
+
+ item++;
+
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+ DLM_ItemwId( item ) = SLM_GetBitmap( slm );
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = (BYTE)SLM_GetLevel( slm );
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text string to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)(strlen( SLM_GetName( slm ) ) + 1);
+ DLM_ItembLevel( item ) = (BYTE)SLM_GetLevel( slm );
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( CHAR_PTR )DLM_ItemqszString( item ), (CHAR_PTR)SLM_GetName( slm ) );
+
+ return( memblk );
+
+}
+
+
+/**********************
+
+ NAME : SLM_GetBitmap
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static WORD SLM_GetBitmap( SLM_OBJECT_PTR slm )
+{
+
+ GENERIC_DLE_PTR dle;
+
+ dle = SLM_GetDle( slm );
+
+ if ( NULL == dle ) {
+
+ return IDRBM_EMS_ENTERPRISE;
+
+ } else {
+
+ switch ( DLE_GetDeviceSubType( dle ) ) {
+
+ case EMS_ENTERPRISE:
+ return IDRBM_EMS_ENTERPRISE;
+
+ case EMS_SITE:
+ return IDRBM_EMS_SITE;
+
+ case EMS_SERVER:
+ return IDRBM_EMS_SERVER;
+
+ case EMS_MDB:
+ return IDRBM_EMS_MDB;
+
+ case EMS_DSA:
+ return IDRBM_EMS_DSA;
+
+ default:
+ return IDRBM_EMS_ENTERPRISE;
+
+ }
+ }
+}
+
+
+/**********************
+
+ NAME : SLM_EntSetObjects
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+static BOOLEAN SLM_EntSetObjects(
+SLM_OBJECT_PTR slm,
+WORD operation,
+WORD ObjectNum )
+{
+ SLM_OBJECT_PTR temp_slm;
+ SLM_OBJECT_PTR slm2;
+ CHAR keyb_char;
+ Q_HEADER_PTR slm_list;
+ INT level;
+ USHORT count;
+ HWND window;
+
+ APPINFO_PTR appinfo;
+ WININFO_PTR wininfo;
+ GENERIC_DLE_PTR dle;
+ BOOLEAN ret_val = FALSE;
+ // CHAR text[ MAX_UI_RESOURCE_SIZE ];
+
+ wininfo = ( WININFO_PTR )SLM_GetXtraBytes( slm );
+ window = WMDS_GetWin( wininfo );
+ appinfo = ( APPINFO_PTR )WM_GetAppPtr( window );
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_slm = slm;
+
+ do {
+
+ temp_slm = VLM_GetNextSLM( temp_slm );
+
+ if ( temp_slm != NULL ) {
+
+ if ( SLM_GetStatus( temp_slm ) & INFO_DISPLAY ) {
+
+ if ( keyb_char == (CHAR)toupper( *SLM_GetName( temp_slm ) ) ) {
+
+ slm = temp_slm;
+ operation = WM_DLMDOWN;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ break;
+ }
+ }
+ }
+
+ } while ( temp_slm != NULL );
+
+ if ( ret_val == FALSE ) {
+ temp_slm = VLM_GetFirstSLM( WMDS_GetTreeList( VLM_GetXtraBytes( slm ) ) );
+
+ while ( temp_slm != NULL && temp_slm != slm ) {
+
+ if ( SLM_GetStatus( temp_slm ) & INFO_DISPLAY ) {
+
+ if ( keyb_char == (CHAR)toupper( *SLM_GetName( temp_slm ) ) ) {
+
+ slm = temp_slm;
+ operation = WM_DLMDOWN;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ }
+ }
+
+ temp_slm = VLM_GetNextSLM( temp_slm );
+
+ }
+ }
+ }
+
+ if ( ( operation == WM_DLMDBCLK || operation == WM_DLMDOWN ) &&
+ ( ObjectNum >= 2 ) ) {
+
+ slm2 = appinfo->open_slm;
+ slm2->status &= ~INFO_OPEN;
+
+ slm->status |= INFO_OPEN;
+ appinfo->open_slm = slm;
+
+ STM_SetIdleText( IDS_READY );
+
+ dle = SLM_GetDle( slm );
+ appinfo->dle = dle;
+
+ // Reset the slm list in the flat display for this slm
+
+ SLM_XchgListReuse( slm );
+
+ // Set the anchor in the Tree list.
+
+ DLM_SetAnchor( WMDS_GetWinTreeList( wininfo ), 0, (LMHANDLE)slm );
+
+ }
+
+ // Look for an expansion or not
+
+ if ( ( operation == WM_DLMDBCLK ) &&
+ ( ObjectNum == 2 || ObjectNum == 3 ) ) {
+
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ if ( SLM_GetStatus( slm ) & INFO_SUBS ) {
+
+ if ( SLM_GetStatus( slm ) & INFO_EXPAND ) {
+
+ level = SLM_GetLevel( slm );
+ slm->status &= ~INFO_EXPAND;
+ slm2 = slm;
+ count = 0;
+
+ do { // while ( TRUE )
+
+ slm2 = VLM_GetNextSLM( slm2 );
+
+ if ( slm2 == NULL ) break;
+
+ if ( SLM_GetLevel( slm2 ) <= level ) break;
+
+ if ( SLM_GetStatus( slm2 ) & INFO_DISPLAY ) {
+
+ slm2->status &= ~(INFO_DISPLAY|INFO_EXPAND);
+ count++;
+ } // if ( SLM_GetStatus( slm2 ) & INFO_DISPLAY )
+
+ } while ( TRUE );
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMDELETEITEMS,
+ (LMHANDLE)slm, count );
+
+ } else {
+
+ // Node needs to be expanded.
+
+ if ( EMS_SERVER != SLM_GetMailType ( slm ) ) {
+
+ WM_ShowWaitCursor( TRUE );
+
+ slm->status |= INFO_EXPAND;
+
+ slm2 = slm;
+ level = SLM_GetLevel( slm );
+ count = 0;
+
+ do {
+
+ slm2 = VLM_GetNextSLM( slm2 );
+
+ if ( slm2 == NULL ) {
+ break;
+ }
+
+ if ( ( slm2->level == level + 1 ) &&
+ ! ( SLM_GetStatus( slm2 ) & INFO_DISPLAY ) ) {
+
+ count++;
+
+ slm2->status |= INFO_DISPLAY;
+ } else {
+
+ if ( SLM_GetLevel( slm2 ) <= level ) {
+ break;
+ }
+ }
+
+ } while ( TRUE );
+
+ STM_DrawIdle();
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMADDITEMS,
+ (LMHANDLE)slm, count );
+
+ WM_ShowWaitCursor( FALSE );
+ }
+ }
+
+ VLM_UpdateBrothers( slm_list );
+ }
+ }
+
+ // update node list display
+
+ slm = VLM_GetFirstSLM( WMDS_GetFlatList( wininfo ) );
+
+ DLM_Update( window, DLM_FLATLISTBOX, WM_DLMUPDATELIST, NULL, 0 );
+
+ if ( slm != NULL ) {
+ DLM_SetAnchor( WMDS_GetWinFlatList( wininfo ), 0, (LMHANDLE)slm );
+ }
+
+ return( ret_val );
+}
+
+/***************************************************
+
+ Name: SLM_XchgListReuse
+
+ Description:
+
+ Every time the user clicks on a different subdirectory this guy gets
+ called to free the previous slm list and create a new one from the
+ slm passed to it.
+
+*****************************************************/
+
+static INT SLM_XchgListReuse(
+ SLM_OBJECT_PTR parent_slm )
+{
+ WININFO_PTR wininfo;
+ APPINFO_PTR appinfo;
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR tree_slm;
+ Q_HEADER_PTR flat_list;
+ Q_ELEM_PTR q_elem;
+ GENERIC_DLE_PTR parent_dle;
+ GENERIC_DLE_PTR dle;
+ SLM_OBJECT_PTR prev_slm_inserted = NULL;
+ CHAR dev_name[ MAX_DEVICE_NAME_LEN ];
+
+ wininfo = SLM_GetXtraBytes ( parent_slm );
+ appinfo = ( APPINFO_PTR )WMDS_GetAppInfo( wininfo );
+
+ flat_list = WMDS_GetFlatList( wininfo );
+
+ // Release all the old Node structures in the queue
+
+ if ( !flat_list ) {
+ return SUCCESS ;
+ }
+
+ q_elem = DeQueueElem( flat_list );
+
+ while ( q_elem != NULL ) {
+ free( q_elem->q_ptr );
+ q_elem = DeQueueElem( flat_list );
+ }
+
+ // Now build a new Node list
+
+ parent_dle = SLM_GetDle( parent_slm );
+
+ if ( parent_dle == NULL ) {
+ return ( FAILURE );
+ }
+
+ /* If the parent is a server then the children don't appear in the tree list and need
+ to be created from the DLEs. */
+
+ if ( EMS_SERVER == SLM_GetMailType( parent_slm ) ) {
+
+ DLE_GetFirstChild( parent_dle, &dle );
+
+ while ( NULL != dle ) {
+
+ DLE_DeviceDispName( dle, dev_name, MAX_DEVICE_NAME_LEN, 0 );
+
+ if ( SLM_FindSLMByName( flat_list, DLE_GetDeviceName( dle ) ) == NULL ) {
+
+ slm = SLM_CreateSLM( strsize( dev_name ),
+ strsize( DLE_GetDeviceName( dle ) ),
+ (INT)( ( 4 * ( ( ( SLM_GetLevel( parent_slm ) + 1 ) / 32 ) + 1 ) ) ),
+ FALSE,
+ FALSE );
+
+ if ( slm != NULL ) {
+ SLM_SetName( slm, dev_name );
+ SLM_SetOriginalName( slm, DLE_GetDeviceName( dle ) );
+ SLM_SetStatus( slm, INFO_DISPLAY );
+ SLM_SetLevel( slm, SLM_GetLevel( parent_slm ) + 1 );
+ SLM_SetAttribute( slm, 0 );
+ SLM_SetXtraBytes( slm, wininfo );
+ SLM_SetNextBrother( slm, NULL );
+ SLM_SetMailType( slm, DLE_GetDeviceSubType( dle ) );
+ SLM_SetParent( slm, parent_slm );
+ SLM_SetDle( slm, dle );
+
+ DLE_IncBSDCount( dle );
+
+ // Added the new slm to the total list and the parent's children.
+ EnQueueElem( flat_list, &(slm->q_elem), 0 );
+
+ if ( NULL != BSD_FindByDLE( bsd_list, dle ) ) {
+
+ SLM_SetStatus( slm, SLM_GetStatus( slm ) | INFO_SELECT );
+
+ }
+
+ } else { // slm == NULL
+
+ return ( FAILURE );
+
+ } // if slm != NULL
+
+ } else {
+
+ return ( FAILURE );
+
+ }
+
+ DLE_GetNext( &dle );
+ }
+
+ } else {
+
+ // Children are already in tree list and should be copied.
+
+ tree_slm = VLM_GetNextSLM( parent_slm );
+
+ if ( !tree_slm ) {
+ return SUCCESS ;
+ }
+
+ if ( SLM_GetLevel( tree_slm ) <= SLM_GetLevel( parent_slm ) ) {
+ return SUCCESS;
+ }
+
+ while ( tree_slm != NULL ) {
+
+ dle = SLM_GetDle( tree_slm );
+
+ DLE_DeviceDispName( dle, dev_name, MAX_DEVICE_NAME_LEN, 0 );
+
+ if ( SLM_FindSLMByName( flat_list, DLE_GetDeviceName( dle ) ) == NULL ) {
+
+ slm = SLM_CreateSLM( strsize( dev_name ),
+ strsize( DLE_GetDeviceName( dle ) ),
+ (INT)( ( 4 * ( ( ( SLM_GetLevel( parent_slm ) + 1 ) / 32 ) + 1 ) ) ),
+ FALSE,
+ FALSE );
+
+ if ( slm != NULL ) {
+ SLM_SetName( slm, dev_name );
+ SLM_SetOriginalName( slm, DLE_GetDeviceName( dle ) );
+ SLM_SetStatus( slm, SLM_GetStatus( tree_slm ) );
+ SLM_SetLevel( slm, SLM_GetLevel( tree_slm ) );
+ SLM_SetAttribute( slm, SLM_GetAttribute( tree_slm ) );
+ SLM_SetXtraBytes( slm, wininfo );
+ SLM_SetNextBrother( slm, tree_slm );
+ SLM_SetMailType( slm, DLE_GetDeviceSubType( dle ) );
+ SLM_SetParent( slm, parent_slm );
+ SLM_SetDle( slm, dle );
+
+ DLE_IncBSDCount( dle );
+
+ // Added the new slm to the total list and the parent's children.
+ EnQueueElem( flat_list, &(slm->q_elem), 0 );
+
+ } else {
+
+ return ( FAILURE );
+
+ }
+
+ } else {
+
+ return ( FAILURE );
+
+ }
+
+ tree_slm = SLM_GetNextBrother( tree_slm );
+
+ }
+
+ }
+
+ SortQueue( flat_list, SLM_XchgCompare );
+
+ // Now update the screen to show the new list
+
+ return( SUCCESS );
+}
+
+
+//************
+// VOLUMES
+//************
+
+/*****
+ In my terminology, a volume is a server volume and a disk is a mapped or
+ local dos drive. The user has tagged one or more volumes and hit the
+ select or unselect button. This function does the processing for that
+ command.
+*****/
+
+/**********************
+
+ NAME : VLM_SelectExchangeShares
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+VOID VLM_SelectExchangeShares(
+ BYTE attr,
+ WININFO_PTR wininfo
+)
+{
+
+ SLM_OBJECT_PTR slm;
+ SLM_OBJECT_PTR exchange_slm;
+ HWND exchange_win;
+
+ exchange_win = WMDS_GetWin( wininfo );
+ if ( WM_IsFlatActive( wininfo ) ) {
+
+ // Have the display list manager update our tags for us.
+
+ DLM_UpdateTags( exchange_win, DLM_FLATLISTBOX );
+
+ slm = VLM_GetFirstSLM( wininfo->pFlatList );
+
+ while ( slm != NULL ) {
+
+ if ( slm->status & INFO_TAGGED ) {
+
+ SLM_NodeSetSelect( slm, attr );
+ }
+ slm = VLM_GetNextSLM( slm );
+ }
+ }
+
+ if ( WM_IsTreeActive( wininfo ) ) {
+
+ exchange_slm = VLM_GetFirstSLM( wininfo->pTreeList );
+
+ while ( exchange_slm != NULL ) {
+
+ if ( exchange_slm->status & INFO_TAGGED ) {
+
+ SLM_EntSetSelect( exchange_slm, attr );
+ }
+
+ exchange_slm = VLM_GetNextSLM( exchange_slm );
+ }
+ }
+}
+
+/**********************
+
+ NAME : SLM_NodeSetSelect
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+
+
+static VOID_PTR SLM_NodeSetSelect( SLM_OBJECT_PTR slm_node, BYTE attr )
+{
+
+ SLM_OBJECT_PTR tree_slm;
+ GENERIC_DLE_PTR dle;
+ WININFO_PTR wininfo = SLM_GetXtraBytes ( slm_node );
+ HWND window;
+ UINT32 status;
+
+ // Need to make changes for server children at this point (if that's what we're looking at)
+
+ if ( EMS_SERVER == ( SLM_GetMailType( SLM_GetParent( slm_node ) ) ) ) {
+
+ window = WMDS_GetWin( wininfo );
+
+ status = ( attr ) ? INFO_SELECT : 0;
+
+ if ( status != (UINT32)( SLM_GetStatus( slm_node ) & (INFO_SELECT) ) ) {
+
+ slm_node->status &= ~(INFO_SELECT);
+ slm_node->status |= status;
+
+ if ( FALSE == SLM_AddBSD ( slm_node ) ) {
+
+ DLM_Update( window, DLM_FLATLISTBOX, WM_DLMUPDATEITEM, (LMHANDLE)slm_node, 0 );
+ }
+ }
+
+ // Set the status for the server in the tree window.
+
+ dle = SLM_GetParent( SLM_GetDle( slm_node ) );
+
+ tree_slm = SLM_FindByDLE ( dle, VLM_GetFirstSLM( WMDS_GetTreeList( wininfo ) ) );
+
+ slm_node = VLM_GetFirstSLM ( WMDS_GetFlatList( wininfo ) );
+
+ status = SLM_GetStatus ( slm_node ) & ( INFO_PARTIAL | INFO_SELECT );
+
+ while ( NULL != slm_node ) {
+
+ // If the child has a different selection status then the parent is partial
+ if ( ( SLM_GetStatus ( slm_node ) & ( INFO_PARTIAL | INFO_SELECT ) ) != status ) {
+
+ status = INFO_PARTIAL | INFO_SELECT;
+ break;
+ }
+
+ slm_node = VLM_GetNextSLM ( slm_node );
+
+ }
+
+ status |= SLM_GetStatus ( tree_slm ) & ~( INFO_PARTIAL | INFO_SELECT );
+ SLM_SetStatus ( tree_slm, status );
+
+ DLM_Update( window, DLM_TREELISTBOX, WM_DLMUPDATEITEM, (LMHANDLE)tree_slm, 0 );
+
+ // Now go on up the line.
+ VLM_MarkAllEntSLMParents( tree_slm, attr );
+
+ return( NULL );
+
+ }
+
+ // Change the status in the tree window. This will update the flat window.
+
+ dle = SLM_GetDle( slm_node );
+
+ tree_slm = SLM_FindByDLE ( dle, VLM_GetFirstSLM( WMDS_GetTreeList ( wininfo ) ) );
+
+ if ( tree_slm == NULL ) {
+ return( NULL );
+ }
+
+ SLM_EntSetSelect( tree_slm, attr );
+
+ return( NULL );
+}
+
+
+/**********************
+
+ NAME : SLM_FindByDLE
+
+ DESCRIPTION : Finds the slm in a slm list with a matching DLE
+
+ RETURNS :
+
+**********************/
+
+static SLM_OBJECT_PTR SLM_FindByDLE (
+ GENERIC_DLE_PTR dle,
+ SLM_OBJECT_PTR slm
+)
+{
+ while ( NULL != slm ) {
+
+ if ( dle == SLM_GetDle ( slm ) ) {
+
+ return ( slm );
+ }
+
+ slm = VLM_GetNextSLM ( slm );
+ }
+
+ return ( NULL );
+}
+
+
+/*
+ Get the selection status for the Display Manager.
+*/
+/**********************
+
+ NAME : SLM_NodeGetSelect
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BYTE SLM_NodeGetSelect( SLM_OBJECT_PTR slm )
+{
+ if ( slm->status & INFO_SELECT ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/*
+ Set the tag status for the Display Manager.
+*/
+/**********************
+
+ NAME : SLM_NodeSetTag
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR SLM_NodeSetTag( SLM_OBJECT_PTR slm, BYTE attr )
+{
+ if ( attr ) {
+ slm->status |= INFO_TAGGED;
+ }
+ else {
+ slm->status &= ~INFO_TAGGED;
+ }
+
+ return( NULL );
+}
+
+/*
+ Get the tag status for the Display Manager.
+*/
+/**********************
+
+ NAME : SLM_NodeGetTag
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BYTE SLM_NodeGetTag( SLM_OBJECT_PTR slm )
+{
+ if ( INFO_TAGGED & slm->status ) {
+ return( 1 );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/*
+ Get the item count in our list for the Display Manager.
+*/
+/**********************
+
+ NAME : SLM_NodeGetItemCount
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static USHORT SLM_NodeGetItemCount( Q_HEADER_PTR vol_list )
+{
+ if ( vol_list == NULL ) {
+ return( 0 );
+ }
+ return( QueueCount(vol_list) );
+}
+
+/*
+ Return the first item for the Display Manager.
+*/
+/**********************
+
+ NAME : SLM_NodeGetFirstItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR SLM_NodeGetFirstItem( Q_HEADER_PTR vol_list )
+{
+ if ( vol_list == NULL ) {
+ return( NULL );
+ }
+ return( QueueHead( vol_list ) );
+}
+
+/*
+ Get the previous list item for the Display Manager.
+*/
+/**********************
+
+ NAME : SLM_NodeGetPrevItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR SLM_NodeGetPrevItem( SLM_OBJECT_PTR slm )
+{
+ return( VLM_GetPrevSLM( slm ) );
+}
+
+/*
+ Get the next list item for the Display Manager.
+*/
+/**********************
+
+ NAME : SLM_NodeGetNextItem
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR SLM_NodeGetNextItem( SLM_OBJECT_PTR slm )
+{
+ return( VLM_GetNextSLM( slm ) );
+}
+
+/*
+ For a given object get the information that needs to be displayed.
+*/
+/**********************
+
+ NAME : SLM_NodeGetObjects
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static VOID_PTR SLM_NodeGetObjects( SLM_OBJECT_PTR slm )
+{
+ BYTE_PTR memblk;
+ DLM_ITEM_PTR item;
+ WININFO_PTR wininfo;
+
+ /* malloc enough room to store info */
+
+ wininfo = SLM_GetXtraBytes( slm );
+ memblk = ( BYTE_PTR )DLM_GetObjectsBuffer( wininfo->hWndFlatList );
+
+ /* Store the number of items in the first two bytes. */
+
+ *memblk = 3;
+
+ /* Set up check box. */
+
+ item = (DLM_ITEM_PTR)( memblk + 6 );
+
+ DLM_ItemcbNum( item ) = 1;
+ DLM_ItembType( item ) = DLM_CHECKBOX;
+ if ( slm->status & INFO_SELECT ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_ALL;
+ if ( slm->status & INFO_PARTIAL ) {
+ DLM_ItemwId( item ) = IDRBM_SEL_PART;
+ }
+ }
+ else {
+ DLM_ItemwId( item ) = IDRBM_SEL_NONE;
+ }
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ item++;
+ DLM_ItemcbNum( item ) = 2;
+ DLM_ItembType( item ) = DLM_BITMAP;
+ DLM_ItemwId( item ) = SLM_GetBitmap( slm );
+ DLM_ItembMaxTextLen( item ) = 0;
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+
+ /* Set up the text string to be displayed. */
+
+ item++;
+ DLM_ItemcbNum( item ) = 3;
+ DLM_ItembType( item ) = DLM_TEXT_ONLY;
+ DLM_ItemwId( item ) = 0;
+ DLM_ItembMaxTextLen( item ) = (BYTE)strlen( SLM_GetName( slm ) );
+ DLM_ItembLevel( item ) = 0;
+ DLM_ItembTag( item ) = 0;
+ strcpy( ( LPSTR )DLM_ItemqszString( item ), SLM_GetName( slm ) );
+
+ return( memblk );
+
+}
+
+/*
+ Handle that we got a click or a double click.
+*/
+/**********************
+
+ NAME : SLM_NodeSetObjects
+
+ DESCRIPTION :
+
+ RETURNS :
+
+**********************/
+
+static BOOLEAN SLM_NodeSetObjects(
+SLM_OBJECT_PTR slm, // I
+WORD operation, // I
+WORD ObjectNum ) // I
+{
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR temp_slm;
+ BOOLEAN ret_val = FALSE;
+ WININFO_PTR wininfo;
+ GENERIC_DLE_PTR dle;
+ GENERIC_DLE_PTR parent_dle;
+ CHAR keyb_char;
+
+ wininfo = ( WININFO_PTR )SLM_GetXtraBytes( slm );
+
+ if ( operation == WM_DLMCHAR ) {
+
+ keyb_char = (CHAR)ObjectNum;
+
+ keyb_char = (CHAR)toupper( keyb_char );
+
+ temp_slm = slm;
+
+ do {
+
+ temp_slm = VLM_GetNextSLM( temp_slm );
+
+ if ( temp_slm != NULL ) {
+
+ if ( SLM_GetStatus( temp_slm ) & INFO_DISPLAY ) {
+
+ if ( keyb_char == (CHAR)toupper( *SLM_GetName( temp_slm ) ) ) {
+
+ slm = temp_slm;
+ operation = WM_DLMDOWN;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ break;
+ }
+ }
+ }
+
+ } while ( temp_slm != NULL );
+
+ if ( ret_val == FALSE ) {
+ temp_slm = VLM_GetFirstSLM( WMDS_GetFlatList( VLM_GetXtraBytes( slm ) ) );
+
+ while ( temp_slm != NULL && temp_slm != slm ) {
+
+ if ( SLM_GetStatus( temp_slm ) & INFO_DISPLAY ) {
+
+ if ( keyb_char == (CHAR)toupper( *SLM_GetName( temp_slm ) ) ) {
+
+ slm = temp_slm;
+ operation = WM_DLMDOWN;
+ ObjectNum = 2;
+ ret_val = TRUE;
+ }
+ }
+
+ temp_slm = VLM_GetNextSLM( temp_slm );
+
+ }
+ }
+ }
+
+ if ( ( operation == WM_DLMDBCLK || operation == WM_DLMDOWN ) &&
+ ( ObjectNum >= 2 ) ) {
+
+ STM_SetIdleText( IDS_READY );
+
+ DLM_SetAnchor( WMDS_GetWinFlatList( wininfo ), 0, (LMHANDLE)slm );
+
+ ret_val = TRUE;
+
+ }
+
+ // Double and single clicks are the same for MDB or DSA nodes.
+ if ( EMS_MDB == SLM_GetMailType( slm ) ||
+ EMS_DSA == SLM_GetMailType( slm ) ) {
+
+ return( ret_val );
+
+ }
+
+ if ( ( operation == WM_DLMDBCLK ) &&
+ ( ObjectNum == 2 || ObjectNum == 3 ) ) {
+
+ wininfo = SLM_GetXtraBytes( slm );
+ slm_list = WMDS_GetTreeList( wininfo );
+
+ dle = SLM_GetDle( slm );
+
+ if ( NULL != dle &&
+ NULL != slm_list ) {
+
+ parent_dle = DLE_GetParent( dle );
+
+ if ( NULL != parent_dle ) {
+
+ slm = SLM_FindByDLE ( parent_dle, VLM_GetFirstSLM( slm_list ) );
+
+ if ( NULL != slm ) {
+
+ if ( !(SLM_GetStatus( slm ) & INFO_EXPAND ) ) {
+
+ SLM_EntSetObjects( slm, WM_DLMDBCLK, 2 );
+ ret_val = TRUE;
+ }
+ }
+ }
+ }
+
+ if ( NULL != dle &&
+ NULL != slm_list ) {
+
+ slm = SLM_FindByDLE ( dle, slm ); // Start at the parent's slm
+
+ if ( NULL != slm ) {
+
+ SLM_EntSetObjects( slm, WM_DLMDOWN, 2 );
+ ret_val = TRUE;
+ }
+ }
+ }
+
+ return( ret_val );
+}
+
+
+/**********************
+
+ NAME : VLM_ExchangeDleExist
+
+ DESCRIPTION : Are there any Exchange DLEs in the dle list?
+
+ RETURNS : TRUE if there are, FALSE otherwise.
+
+**********************/
+
+BOOLEAN VLM_ExchangeDleExist()
+{
+ GENERIC_DLE_PTR pDLE;
+
+ if ( SUCCESS == DLE_GetFirst( dle_list, &pDLE ) ) {
+
+ do {
+
+ if ( FS_EMS_DRV == DLE_GetDeviceType( pDLE ) ) {
+
+ return TRUE;
+ }
+
+ } while ( SUCCESS == DLE_GetNext( &pDLE ) );
+ }
+
+ return FALSE;
+}
+
+
+GENERIC_DLE_PTR DLE_GetEnterpriseDLE(
+ GENERIC_DLE_PTR dle
+)
+{
+ if ( NULL == dle ) return NULL;
+
+ while ( NULL != DLE_GetParent( dle ) ) {
+
+ dle = DLE_GetParent( dle );
+ }
+ if ( DLE_GetDeviceSubType( dle ) == EMS_ENTERPRISE ) {
+
+ return dle;
+
+ } else {
+
+ return NULL;
+ }
+}
+
+static HWND DLE_GetEnterpriseWindow(
+ GENERIC_DLE_PTR enterprise_dle
+)
+{
+ Q_ELEM_PTR pqElem;
+ HWND exchange_win;
+ WININFO_PTR wininfo;
+ Q_HEADER_PTR slm_list;
+ SLM_OBJECT_PTR enterprise_slm;
+
+ pqElem = QueueHead( &gq_exchange_win );
+
+ while ( pqElem != NULL ) {
+
+ if ( exchange_win = ( HWND )QueuePtr( pqElem ) ) {
+
+ if ( NULL != ( wininfo = WM_GetInfoPtr( exchange_win ) ) ) {
+
+ if ( NULL != ( slm_list = WMDS_GetTreeList( wininfo ) ) ) {
+
+ if ( NULL != ( enterprise_slm = VLM_GetFirstSLM( slm_list ) ) ) {
+
+ if ( enterprise_dle == SLM_GetDle( enterprise_slm ) ) {
+
+ return exchange_win;
+ }
+ }
+ }
+ }
+ }
+
+ pqElem = QueueNext( pqElem );
+ }
+
+ return ( (HWND)0 );
+}
+
+#endif // OEM_EMS
+
diff --git a/private/utils/ntbackup/src/vmstubs.c b/private/utils/ntbackup/src/vmstubs.c
new file mode 100644
index 000000000..92017b485
--- /dev/null
+++ b/private/utils/ntbackup/src/vmstubs.c
@@ -0,0 +1,109 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: vmstubs.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description: This module replaces the virtual memory manager with
+ standard malloc.
+
+
+ $Log: J:/LOGFILES/VMSTUBS.C_V $
+
+ Rev 1.2 19 Nov 1992 16:29:50 CHARLIE
+Changed PSIZE to PAGESIZE to avoid NT conflict
+
+ Rev 1.1 16 May 1991 09:40:06 DAVIDH
+Referenced parameters in each function to avoid Watcom compiler warnings.
+
+ Rev 1.0 13 May 1991 10:34:54 STEVEN
+Initial revision.
+
+ Rev 1.0 09 May 1991 13:38:56 HUNTER
+Initial revision.
+
+**/
+/* begin include list */
+#include <stdio.h>
+#include <process.h>
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "vm.h"
+#include "msassert.h"
+
+
+VM_HDL VM_InitVM(
+PAGE num_pages,
+PAGESIZE page_size,
+PAGE num_pages_in_mem,
+CHAR_PTR vm_filename,
+VM_PF_CERR critical_error,
+VOID_PTR app_ptr )
+{
+ /* Reference parameters to avoid compiler warnings. */
+ (VOID) num_pages ;
+ (VOID) page_size ;
+ (VOID) num_pages_in_mem ;
+ (VOID) vm_filename ;
+ (VOID) critical_error ;
+ (VOID) app_ptr ;
+
+ return NULL ;
+}
+
+VOID VM_RemoveVM(
+VM_HDL vm_hdl )
+{
+ /* Reference parameter to avoid compiler warnings. */
+ (VOID) vm_hdl ;
+
+ return ;
+}
+
+VM_PTR VM_Alloc(
+VM_HDL vm_hdl,
+UINT16 size )
+{
+ /* Reference parameter to avoid compiler warnings. */
+ (VOID) vm_hdl;
+
+ return( (VM_PTR)malloc( size ) ) ;
+}
+
+
+VOID VM_Free(
+VM_HDL vm_hdl,
+VM_PTR vm_buf )
+{
+ /* Reference parameter to avoid compiler warnings. */
+ (VOID) vm_hdl ;
+
+ free( (VOID_PTR) vm_buf ) ;
+ return;
+}
+
+VOID_PTR VM_MemLock(
+VM_HDL vm_hdl,
+VM_PTR vm_buf,
+INT16 mode )
+{
+ /* Reference parameters to avoid compiler warnings. */
+ (VOID) vm_hdl ;
+ (VOID) mode ;
+
+ return( (VOID_PTR)vm_buf ) ;
+}
+
+VOID VM_MemUnLock(
+VM_HDL vm_hdl,
+VM_PTR vm_buf )
+{
+ /* Reference parameter to avoid compiler warnings. */
+ (VOID) vm_hdl ;
+ (VOID) vm_buf ;
+
+ return;
+}
diff --git a/private/utils/ntbackup/src/vset.dlg b/private/utils/ntbackup/src/vset.dlg
new file mode 100644
index 000000000..2bfeb2979
--- /dev/null
+++ b/private/utils/ntbackup/src/vset.dlg
@@ -0,0 +1,87 @@
+/**************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+RCG
+
+ Name: vset.dlg
+
+ Description: This file contains a dialog template.
+
+ $Log: G:\ui\logfiles\vset.dlv $
+
+ Rev 1.13 16 Jul 1993 10:22:24 KEVINS
+ Allow displaying of the ampersand character.
+
+ Rev 1.12 19 May 1993 10:47:20 KEVINS
+ Added browse button.
+
+ Rev 1.11 15 Apr 1993 12:20:52 CHUCKB
+ Removed hot keys from OK and Cancel.
+
+ Rev 1.10 18 Dec 1992 11:24:26 chrish
+ Moved #include to dialogs.rc
+
+ Rev 1.9 22 Apr 1992 17:07:16 CHUCKB
+ Took out ... from help.
+
+ Rev 1.8 06 Apr 1992 07:38:12 CARLS
+ added DLGINCLUDE
+
+ Rev 1.7 12 Mar 1992 15:51:50 CHUCKB
+ Added ... to Help.
+
+ Rev 1.6 02 Mar 1992 15:39:50 CHUCKB
+ Fixed hotkeys.
+
+ Rev 1.5 25 Feb 1992 16:31:08 CARLS
+ changed combo box size
+
+ Rev 1.4 21 Feb 1992 15:37:30 CHUCKB
+ Changed backup set to backup label.
+
+ Rev 1.3 27 Jan 1992 00:45:24 CHUCKB
+ Updated dialog id's.
+
+ Rev 1.2 18 Dec 1991 11:12:44 CARLS
+
+ Rev 1.1 07 Dec 1991 12:15:38 CARLS
+
+ Rev 1.0 20 Nov 1991 19:18:06 SYSTEM
+ Initial revision.
+
+**************************************************************************/
+
+IDD_VERIFYSET DIALOG 7, 18, 325, 177
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Verify"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Tape Information", IDD_RSET_SET_INFO, 5, 0, 260, 36
+ LTEXT "Tape Name:", IDD_RSET_TAPE_NAME_TEXT, 9, 17, 49, 10,
+ NOT WS_GROUP
+ LTEXT "", IDD_RSET_TAPE_NAME, 61, 17, 195, 10, SS_NOPREFIX |
+ NOT WS_GROUP
+ GROUPBOX "Set Information ", IDD_RSET_INFO_TITLE, 5, 44, 310, 105
+ LTEXT "Verify to &Drive:", IDD_RSET_DRIVE_TEXT, 10, 100, 60, 9,
+ NOT WS_GROUP
+ COMBOBOX IDD_RSET_DRIVE_BOX, 72, 98, 175, 60, CBS_DROPDOWNLIST |
+ CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Backup Label:", IDD_RSET_SET_TEXT, 10, 59, 50, 10, NOT
+ WS_GROUP
+ LTEXT "", IDD_RSET_SET_LINE_1, 60, 59, 193, 10, SS_NOPREFIX |
+ NOT WS_GROUP
+ LTEXT "", IDD_RSET_SET_LINE_2, 35, 72, 213, 22, SS_NOPREFIX |
+ NOT WS_GROUP
+ LTEXT "Verify &Path:", IDD_RSET_PATH_TEXT, 10, 118, 50, 9, NOT
+ WS_GROUP
+ PUSHBUTTON "&Browse", IDD_RSET_BROWSE_BUTTON, 255, 97, 40, 14
+ EDITTEXT IDD_RSET_RESTORE_PATH, 72, 116, 175, 12, ES_AUTOHSCROLL
+ SCROLLBAR IDD_RSET_SCROLLBAR, 304, 48, 11, 100, SBS_VERT |
+ WS_TABSTOP
+ DEFPUSHBUTTON "OK", IDD_RSET_OK_BUTTON, 68, 157, 40, 14
+ PUSHBUTTON "Cancel", IDD_RSET_CANCEL_BUTTON, 128, 157, 40, 14
+ PUSHBUTTON "&Help", IDD_RSET_HELP_BUTTON, 188, 157, 40, 14
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 9, 149, 309, 4
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 315, 53, 4, 98
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 10, 36, 257, 3
+ CONTROL "", 0xFFFF, "Static", SS_BLACKRECT, 265, 9, 3, 30
+END
diff --git a/private/utils/ntbackup/src/winassrt.c b/private/utils/ntbackup/src/winassrt.c
new file mode 100644
index 000000000..843fe4dc1
--- /dev/null
+++ b/private/utils/ntbackup/src/winassrt.c
@@ -0,0 +1,167 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: winassrt.c
+
+ Date Updated: 23-Mar-93
+
+ Description: Some real Windows UI assert code. One must not use
+ the Backup Engine msassert.c in conjunction with this
+ module.
+
+ Notes: These functions do not operate on Unicode strings.
+ Since the compiler always generates ASCII strings
+ from __FILE__ and __LINE__, no attempt is made for
+ automatic remapping and the function parameters
+ must be "char *" not "CHAR_PTR".
+
+
+ $Log: G:/UI/LOGFILES/WINASSRT.C_V $
+
+ Rev 1.5 04 Jan 1994 10:55:46 BARRY
+Don't pass expression to function
+
+ Rev 1.0 04 Jan 1994 10:55:38 BARRY
+Don't pass expression to function
+
+ Rev 1.4 03 Dec 1993 11:27:38 mikep
+handle qtc dll building
+
+ Rev 1.3 16 Nov 1993 15:50:38 BARRY
+Fixes for Unicode; call MessageBox instead of WM_MessageBox
+
+ Rev 1.2 12 Aug 1993 12:53:04 BARRY
+How about checking the expression before asserting in mscassert?
+
+ Rev 1.1 24 May 1993 15:22:16 BARRY
+Unicode fixes.
+
+ Rev 1.0 23 Mar 1993 19:44:12 BARRY
+Initial revision.
+
+**/
+
+#include "all.h"
+
+#define MSASSERT_BUFFER_SIZE 512
+
+static CHAR fmtString[] = TEXT( "Assertion Failed in %s:\n\nExpression: %S\nFile: %S\nLine: %d\n\nSelect OK to continue or Cancel to abort" );
+
+
+/**/
+/**
+
+ Name: msassert_func()
+
+ Description: Creates a modal dialog with information about an
+ assertion failure. Can be used in Windows NT console
+ or Windows applications.
+
+ Modified: 11-Nov-93
+
+ Returns: Nothing
+
+**/
+VOID msassert_func( char *expString, char *fileName, int line )
+{
+ CHAR message[ MSASSERT_BUFFER_SIZE + 1 ];
+ BOOLEAN abort;
+ char *f;
+ STARTUPINFO startupInfo;
+
+ /*
+ * Get the startup info for the process so we can print the
+ * name of the app that's asserting.
+ */
+ GetStartupInfo( &startupInfo );
+
+ /*
+ * Since having the fully qualified path of the source file is of
+ * no real benefit (all source file names are unique), let's strip
+ * off the path. This may be kind of ugly, but it sure is easier
+ * for someone to read the dialog box that pops up.
+ */
+ if ( (f = strrchrA( fileName, '\\' )) != NULL )
+ {
+ f++;
+ }
+ else
+ {
+ f = fileName;
+ }
+
+ /*
+ * Make sure that we are not going to crash trying to do an assert.
+ * Check string sizes along with a guess of a 5 digit line number
+ * as the size of the string.
+ */
+ if ( MSASSERT_BUFFER_SIZE <
+ (strlen( fmtString ) +
+ wcslen( startupInfo.lpTitle ) +
+ strlenA( expString ) +
+ strlenA( f ) + 5) )
+ {
+ abort = TRUE;
+ }
+ else
+ {
+ INT choice = IDCANCEL;
+
+#ifndef QTCDLL
+ /* Form the text for the dialog. */
+ sprintf( message,
+ fmtString,
+ startupInfo.lpTitle,
+ expString,
+ f,
+ line );
+
+ choice = MessageBox( NULL,
+ message,
+ TEXT("Assertion Failed"),
+ MB_TASKMODAL | MB_OKCANCEL | MB_ICONSTOP | MB_DEFBUTTON2 );
+
+#endif
+ /*
+ * The user has the option to continue from the dialog.
+ * Only set the abort flag if they selected cancel.
+ */
+ abort = (choice == IDCANCEL);
+ }
+
+ if ( abort )
+ {
+ RaiseException( EXCEPTION_BREAKPOINT,
+ EXCEPTION_NONCONTINUABLE,
+ 0,
+ NULL ) ;
+ }
+}
+
+/**/
+/**
+
+ Name: mscassert_func()
+
+ Description: Critical assert function. Raises an exception without
+ any attempt to put up a fancy window.
+
+ Modified: 11-Nov-93
+
+ Returns: Nothing
+
+**/
+VOID mscassert_func( char *expString, char *fileName )
+{
+ (void)expString;
+ (void)fileName;
+
+ RaiseException( EXCEPTION_BREAKPOINT,
+ EXCEPTION_NONCONTINUABLE,
+ 0,
+ NULL ) ;
+
+}
+
+
diff --git a/private/utils/ntbackup/src/winmang.c b/private/utils/ntbackup/src/winmang.c
new file mode 100644
index 000000000..05f6a7ada
--- /dev/null
+++ b/private/utils/ntbackup/src/winmang.c
@@ -0,0 +1,2061 @@
+
+/******************************************************************************
+Copyright (c) Maynard, an Archive Company. 1991
+GSH
+
+ Name: winmang.c
+
+ Description: This file contains the functions for the GUI Window
+ Manager (WM).
+
+ The following routines are in this module:
+
+ WM_CloseAllDocs
+ WM_Create
+ WM_CreateObjects
+ WM_Deinit
+ WM_DeleteObjects
+ WM_GetNext
+ WM_Init
+ WM_QueryCloseAllDocs
+ WM_SetAppIcon
+ WM_SetMinTitle
+ WM_SetTitle
+ WM_SubClassListBox
+ WM_SubClassMDIClient
+ WM_ShowWaitCursor
+ WM_SetCursor
+
+ $Log: G:\UI\LOGFILES\WINMANG.C_V $
+
+ Rev 1.56.1.3 31 Jan 1994 10:34:18 Glenn
+Changed memcpy to strncpy - UNICODE fix.
+
+ Rev 1.56.1.2 26 Jan 1994 12:34:32 Glenn
+Invalidating rect when moving window so that a complete repaint occurs.
+
+ Rev 1.56.1.1 08 Dec 1993 20:20:44 GREGG
+Added Mikes deep path fix to Orcas branch.
+
+ Rev 1.56.1.0 04 Nov 1993 15:46:28 STEVEN
+japanese changes
+
+ Rev 1.56 05 Aug 1993 17:35:56 GLENN
+Now restoring docs only if minimized.
+
+ Rev 1.55 28 Jul 1993 18:55:16 MARINA
+enable c++
+
+ Rev 1.54 19 Jul 1993 11:14:50 GLENN
+Clearing out the menu state if not menu bits are specified. More objective way.
+
+ Rev 1.53 01 Jun 1993 15:43:34 DARRYLP
+Setting the Icon for the last Icon change.
+
+ Rev 1.52 26 May 1993 16:26:24 DARRYLP
+Reactivated the animated app icon.
+
+ Rev 1.51 18 May 1993 18:32:42 GLENN
+Changed RestoreDocs code to activate the existing top window if it was new (closable).
+
+ Rev 1.50 18 May 1993 14:56:00 GLENN
+Appended INI base name to the title of frame and runtime dialog.
+
+ Rev 1.49 06 May 1993 08:53:50 MIKEP
+Fix for epr 355 to bring cataloged set window to foreground after
+cataloging completes.
+
+ Rev 1.48 22 Apr 1993 15:57:48 GLENN
+Added file SORT option support.
+
+ Rev 1.47 18 Feb 1993 13:59:58 BURT
+Change for Cayman
+
+
+ Rev 1.46 16 Dec 1992 10:25:38 STEVEN
+fix mips bugs
+
+ Rev 1.45 14 Dec 1992 12:25:52 DAVEV
+Enabled for Unicode compile
+
+ Rev 1.44 18 Nov 1992 11:39:14 GLENN
+Release the cursor capture if the cursor point is outside of the frame.
+
+ Rev 1.43 01 Nov 1992 16:15:02 DAVEV
+Unicode changes
+
+ Rev 1.42 30 Oct 1992 15:47:24 GLENN
+Added Frame and MDI Doc window size and position saving and restoring.
+
+ Rev 1.41 14 Oct 1992 15:53:50 GLENN
+Added Font selection to Config and INI.
+
+ Rev 1.40 04 Oct 1992 19:44:08 DAVEV
+Unicode Awk pass
+
+ Rev 1.39 02 Oct 1992 16:52:26 GLENN
+Added WM_SetCursor() to help fix NT WM_ShowWaitCursor problems when leaving app.
+
+ Rev 1.38 28 Sep 1992 17:03:02 GLENN
+MikeP changes (strcpy to memcpy).
+
+ Rev 1.37 17 Sep 1992 15:54:14 DAVEV
+UNICODE modifications: strlen usage check
+
+ Rev 1.36 10 Sep 1992 17:05:54 GLENN
+Set the tool bar background color to be like FM.
+
+ Rev 1.35 09 Sep 1992 17:00:54 GLENN
+Updated NEW LOOK font stuff for BIMINI.
+
+ Rev 1.34 02 Sep 1992 15:13:14 GLENN
+Created a highlight brush and color. Moved the font stuff to font.c
+
+ Rev 1.33 29 Jul 1992 14:23:18 GLENN
+ChuckB checked in after NT fixes.
+
+ Rev 1.32 10 Jul 1992 10:13:52 GLENN
+In process of adding font selection support.
+
+ Rev 1.31 07 Jul 1992 15:32:24 MIKEP
+unicode changes
+
+ Rev 1.30 10 Jun 1992 16:14:54 GLENN
+Updated according to NT SPEC.
+
+ Rev 1.29 15 May 1992 13:32:26 MIKEP
+nt pass 2
+
+ Rev 1.28 05 May 1992 15:59:04 JOHNWT
+changed ternary thing
+
+ Rev 1.27 22 Apr 1992 17:50:36 GLENN
+Put in auto log to debug file when /z is used.
+
+ Rev 1.26 20 Apr 1992 13:48:22 GLENN
+Added status line get/set capability.
+
+ Rev 1.25 07 Apr 1992 15:39:22 GLENN
+Fixed WM_MakeAppActive() to bring up frame.
+
+ Rev 1.24 02 Apr 1992 15:44:18 GLENN
+NT font and class changes - TESTED in WP and NT.
+
+ Rev 1.23 31 Mar 1992 11:23:28 DAVEV
+OEM_MSOFT: no icon animation allowed
+
+ Rev 1.22 24 Mar 1992 10:34:28 ROBG
+Added logic to use system colors when creating a log file view.
+
+ Rev 1.21 19 Mar 1992 14:29:02 STEVEN
+do not subclass MDI client if getlong fails - NTKLUG
+
+ Rev 1.20 19 Mar 1992 11:44:54 JOHNWT
+added WM_MakeAppActive
+
+ Rev 1.19 10 Mar 1992 16:28:16 GLENN
+Added WM_MoveWindow().
+
+ Rev 1.18 03 Mar 1992 18:24:46 GLENN
+Updated animate icon. Added new log view window support.
+
+ Rev 1.17 23 Feb 1992 13:44:54 GLENN
+Added valid window check to ResoreDocs().
+
+ Rev 1.16 20 Feb 1992 11:16:58 GLENN
+Changed the MDI create maximized code for NT compatibility.
+
+ Rev 1.15 18 Feb 1992 21:02:28 GLENN
+Added support for min/max/restore docs before/after operations.
+
+ Rev 1.14 11 Feb 1992 17:30:18 GLENN
+Added support for MDI client subclassing.
+
+ Rev 1.13 05 Feb 1992 17:56:38 GLENN
+Yanked out win32 redundant code.
+
+ Rev 1.12 29 Jan 1992 18:02:30 GLENN
+Increased animate icon rect.
+
+ Rev 1.11 24 Jan 1992 14:54:00 GLENN
+Changed HM_Deinit call to match it's prototype.
+
+ Rev 1.10 23 Jan 1992 12:30:58 GLENN
+Added defs for array sizes.
+
+ Rev 1.9 23 Jan 1992 09:04:44 MIKEP
+fix title size
+
+ Rev 1.8 21 Jan 1992 13:32:26 GLENN
+Added WM_AnimateAppIcon() function.
+
+ Rev 1.7 10 Jan 1992 16:39:04 JOHNWT
+moved set idle text from GUI_Init to WM_Init
+
+ Rev 1.6 07 Jan 1992 17:40:32 GLENN
+Changed debug stuff
+
+ Rev 1.5 26 Dec 1991 13:46:28 GLENN
+Changed show flags to use CDS calls
+
+ Rev 1.4 11 Dec 1991 13:03:34 DAVEV
+16/32 bit port -2nd pass
+
+ Rev 1.3 10 Dec 1991 13:56:44 GLENN
+Added feature to WM_Create function to create single column FLAT list boxes
+
+ Rev 1.2 04 Dec 1991 15:20:42 DAVEV
+Modifications for 16/32-bit Windows port - 1st pass.
+
+
+ Rev 1.1 03 Dec 1991 15:58:58 GLENN
+Updated as per code review.
+
+ Rev 1.0 20 Nov 1991 19:25:44 SYSTEM
+Initial revision.
+
+******************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+// PRIVATE DEFINITIONS
+
+#define MAX_FONTFACENAME_LEN 30
+
+// MODULE-WIDE VARIABLES
+
+static HWND mwhWndLastTop = (HWND)NULL;
+static BOOL mwfWaiting = FALSE; // flag showing current show wait state
+static BOOL mwfDocsMinimized = FALSE;
+
+// PRIVATE FUNCTION PROTOTYPES
+
+
+// FUNCTIONS
+
+/******************************************************************************
+
+ Name: WM_CloseAllDocs()
+
+ Description: This function sends a destroy message to all MDI documents.
+ Effectively, all MDI primary document windows are minimized
+ and all secondary MDI document windows are destroyed.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_CloseAllDocs ( VOID )
+{
+ HWND hWndTemp;
+
+ // Hide the MDI client window to avoid multiple repaints.
+
+ WM_Hide( ghWndMDIClient );
+
+ // As long as the MDI client has a child, minimize it or destroy it.
+
+ while ( hWndTemp = GetWindow ( ghWndMDIClient, GW_CHILD ) ) {
+
+ // Skip the icon title windows.
+
+ while ( hWndTemp && GetWindow ( hWndTemp, GW_OWNER ) ) {
+ hWndTemp = GetWindow ( hWndTemp, GW_HWNDNEXT );
+ }
+
+ if ( ! hWndTemp ) {
+ break;
+ }
+
+ // Destroy the window.
+
+ SendMessage ( ghWndMDIClient, WM_MDIDESTROY, (MP1)hWndTemp, 0L );
+ }
+
+} /* end WM_CloseAllDocs() */
+
+
+/******************************************************************************
+
+ Name: WM_Create()
+
+ Description: This function creates a window of the specified type.
+
+ Returns: A handle to the newly created window if successful.
+ Otherwise, returns NULL.
+
+ Notes: It is a good idea to refer to the GUI Window Manager
+ Documentation about this function. When creating a ribbon
+ window, the pdsWinInfo parameter will contain the parent
+ to the ribbon being created.
+
+******************************************************************************/
+
+HWND WM_Create (
+
+WORD wType, // I - type of window to create
+LPSTR pszTitle, // I - window title
+LPSTR pszMinTitle, // I - short version of the window title
+INT X, // I - upper left X position
+INT Y, // I - upper left Y position
+INT nWidth, // I - width
+INT nHeight, // I - height
+PDS_WMINFO pdsWinInfo ) // I - window info structure to be attached
+ // to the window's extra bytes
+
+{
+
+ HWND hWnd;
+ DWORD dwStyle;
+
+ // Determine the display window size.
+
+ switch ( wType & WM_MINMAX_BITS ) {
+
+ case WM_MIN:
+ dwStyle = WS_ICONIC;
+ break;
+
+ case WM_MAX:
+ dwStyle = WS_MAXIMIZE;
+ break;
+
+ default:
+ dwStyle = 0;
+ break;
+ }
+
+ // Determine and create the appropriate window.
+
+ switch ( wType & WM_TYPE_BITS ) {
+
+ case WM_FRAME: // Create the frame window.
+
+ dwStyle |= WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
+
+ hWnd = CreateWindow( WMCLASS_FRAME, // class name
+ pszTitle, // window title
+ dwStyle, // window style
+ X, // starting x position
+ Y, // starting y position
+ nWidth, // window width
+ nHeight, // window height
+ (HWND)NULL, // parent window handle
+ LoadMenu ( ghResInst, IDRM_MAINMENU ), // menu handle
+ ghInst, // instance (global)
+ (LPSTR)NULL // window creation parameter
+ );
+
+ break;
+
+ case WM_CLIENT: { // Create the client window.
+
+ CLIENTCREATESTRUCT ccs;
+
+ ccs.hWindowMenu = GetSubMenu ( GetMenu ( ghWndFrame ), WINDOWSMENUPOSITION );
+ ccs.idFirstChild = IDM_WINDOWSFIRSTCHILD;
+
+ dwStyle |= WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL;
+
+ hWnd = CreateWindow( WMCLASS_CLIENT, // class name
+ pszTitle, // window title
+ dwStyle, // window style
+ X, // starting x position
+ Y, // starting y position
+ nWidth, // window width
+ nHeight, // window height
+ ghWndFrame, // parent window handle
+ (HMENU)WM_CLIENT_ID, // menu handle
+ ghInst, // instance (global)
+ (LPSTR)&ccs // window creation parameter
+ );
+
+ break;
+
+ }
+
+ case WM_RIBBON: // Create a ribbon window window.
+
+// dwStyle |= WS_CHILD | WS_CLIPCHILDREN | SS_USERITEM;
+ dwStyle |= WS_CHILD | WS_CLIPCHILDREN;
+
+ hWnd = CreateWindow( WMCLASS_RIBBON, // class name
+ pszTitle, // window title
+ dwStyle, // window style
+ X, // starting x position
+ Y, // starting y position
+ nWidth, // window width
+ nHeight, // window height
+ EXTRACT_RIBBON_PARENT_HWND( pdsWinInfo ),
+ (HMENU)NULL, // menu handle
+ ghInst, // instance (global)
+ (LPSTR)NULL // window creation parameter
+ );
+
+ break;
+
+ case WM_DEBUG:
+ case WM_MDIPRIMARY: // Create a MDI document window.
+ case WM_MDISECONDARY: {
+
+ HWND hWndActive = WM_GetActiveDoc ();
+ MDICREATESTRUCT mcs;
+
+ msassert ( pdsWinInfo != (VOID_PTR)NULL );
+
+ // If the currently active MDI Doc is maximized, we need to
+ // follow suit and maximize this doc.
+
+ if ( hWndActive && WM_IsMaximized ( hWndActive ) ) {
+ dwStyle = WS_MAXIMIZE;
+ }
+
+ // Set the rest of the style.
+
+ dwStyle |= WS_CLIPSIBLINGS;
+
+ // Set the size indicator to the default.
+
+ WMDS_SetSize ( pdsWinInfo, WMSIZE_UNKNOWN );
+
+ // Determine the list box types.
+
+ switch ( wType & WM_STYLE_BITS ) {
+
+ case WM_VIEWWIN:
+ pdsWinInfo->dwWindowState = WMDOC_VIEWWIN;
+ break;
+
+ case WM_FLATLISTMC:
+ pdsWinInfo->dwWindowState = WMDOC_FLATMC;
+ break;
+
+ case WM_FLATLISTSC:
+ pdsWinInfo->dwWindowState = WMDOC_FLATSC;
+ break;
+
+ case WM_TREELISTSC:
+ pdsWinInfo->dwWindowState = WMDOC_TREESC;
+ break;
+
+ case WM_TREEANDFLATSC:
+ pdsWinInfo->dwWindowState = WMDOC_TREEANDFLAT | WMDOC_TREESC |
+ WMDOC_FLATSC | WMDOC_SLIDER;
+ break;
+
+ case WM_TREEANDFLATMC:
+ default:
+ pdsWinInfo->dwWindowState = WMDOC_TREEANDFLAT | WMDOC_TREESC |
+ WMDOC_FLATMC | WMDOC_SLIDER;
+ break;
+ }
+
+ // Clear out the menu state if not used.
+
+ if ( ! ( wType & WM_MENU_BITS ) ) {
+
+ pdsWinInfo->dwMenuState = 0L;
+ }
+
+ if ( ( wType & WM_TYPE_BITS ) == WM_MDIPRIMARY ) {
+ pdsWinInfo->wClosable = FALSE;
+ }
+ else {
+ pdsWinInfo->wClosable = TRUE;
+ }
+
+ if ( ! pdsWinInfo->nSliderPos ) {
+ pdsWinInfo->nSliderPos = WM_SLIDERUNKNOWN;
+ }
+
+ // Set up the NORMAL and MINIMIZED window titles.
+
+ if ( pszTitle ) {
+
+ pdsWinInfo->pTitle = ( CHAR_PTR )calloc ( sizeof ( CHAR ), strlen ( pszTitle ) + 1 );
+
+ if ( ! pdsWinInfo->pTitle ) {
+ return (HWND)NULL;
+ }
+
+ strcpy ( pdsWinInfo->pTitle, pszTitle );
+ }
+
+ if ( pszMinTitle ) {
+
+ pdsWinInfo->pMinTitle = ( CHAR_PTR )calloc ( sizeof ( CHAR ), strlen ( pszMinTitle ) + 1 );
+
+ if ( ! pdsWinInfo->pMinTitle ) {
+ return (HWND)NULL;
+ }
+
+ strcpy ( pdsWinInfo->pMinTitle, pszMinTitle );
+ }
+
+ // Use the appropriate window title.
+
+ if ( ( dwStyle & WS_ICONIC ) && pszMinTitle ) {
+ mcs.szTitle = pszMinTitle;
+ }
+ else {
+ mcs.szTitle = pszTitle;
+ }
+
+ mcs.szClass = WMCLASS_DOC;
+ mcs.hOwner = ghInst;
+ mcs.x = X;
+ mcs.y = Y;
+ mcs.cx = nWidth;
+ mcs.cy = nHeight;
+ mcs.style = WS_CHILD | dwStyle;
+ mcs.lParam = (LONG)pdsWinInfo;
+
+ hWnd = (HWND) SendMessage ( ghWndMDIClient,
+ WM_MDICREATE,
+ 0,
+ (MP2)&mcs
+ );
+
+ break;
+ }
+
+ case WM_DDECLIENT:
+
+ dwStyle |= WS_OVERLAPPEDWINDOW ;
+
+ hWnd = CreateWindow( WMCLASS_DDECLIENT, // class name
+ pszTitle, // window title
+ dwStyle, // window style
+ X, // starting x position
+ Y, // starting y position
+ nWidth, // window width
+ nHeight, // window height
+ (HWND)NULL, // parent window handle
+ (HMENU)NULL, // menu handle
+ ghInst, // instance (global)
+ (LPSTR)NULL // window creation parameter
+ );
+
+ break;
+
+ default: // THIS SHOULD NOT HAPPEN
+
+ msassert ( FALSE );
+
+ } /* end switch */
+
+
+ return hWnd;
+
+} /* end WM_Create() */
+
+
+/******************************************************************************
+
+ Name: WM_CreateObjects()
+
+ Description: This function creates the pens, brushes, and fonts, used
+ to display windows graphics.
+
+ Returns: SUCCESS, if successful. Otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL WM_CreateObjects ( VOID )
+
+{
+ CDS_PTR pCDS = CDS_GetPerm ();
+ CHAR szFontFace[MAX_FONTFACENAME_LEN + 1];
+ HDC hDC;
+ INT nFontHeight;
+ DWORD csfont ;
+
+ if (IS_JAPAN() ) {
+ CHARSETINFO csi;
+ DWORD dw = GetACP();
+
+ if (!TranslateCharsetInfo((DWORD*)dw, &csi, TCI_SRCCODEPAGE)){
+ csfont = csi.ciCharset = ANSI_CHARSET;
+ }
+ csfont = csi.ciCharset ;
+
+ } else {
+
+ csfont = ANSI_CHARSET ;
+ }
+
+ // Determine the font height.
+
+ hDC = GetDC ( (HWND)NULL );
+ nFontHeight = MulDiv ( -CDS_GetFontSize ( pCDS ), GetDeviceCaps ( hDC, LOGPIXELSY ), 72 );
+ ReleaseDC ( (HWND)NULL, hDC );
+
+
+ // Create a bunch of pens, brushes, and fonts for drawing.
+
+ gColorBackGnd = GetSysColor ( COLOR_WINDOW );
+ gColorForeGnd = GetSysColor ( COLOR_WINDOWTEXT );
+
+ gColorHighLight = GetSysColor ( COLOR_HIGHLIGHT );
+ gColorHighLightText = GetSysColor ( COLOR_HIGHLIGHTTEXT );
+
+ ghPenBlack = GetStockObject ( BLACK_PEN );
+ ghPenWhite = GetStockObject ( WHITE_PEN );
+ ghPenBackGnd = CreatePen ( PS_SOLID, 1, gColorBackGnd );
+ ghPenForeGnd = CreatePen ( PS_SOLID, 1, gColorForeGnd );
+ ghPenGray = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_GRAYTEXT ) );
+ ghPenBtnText = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_BTNTEXT ) );
+ ghPenLtGray = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_BTNFACE ) );
+ ghPenDkGray = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_BTNSHADOW ) );
+
+ ghBrushGray = GetStockObject ( GRAY_BRUSH );
+ ghBrushDkGray = GetStockObject ( DKGRAY_BRUSH );
+ ghBrushLtGray = CreateSolidBrush ( GetSysColor ( COLOR_BTNFACE ) );
+ ghBrushWhite = CreateSolidBrush ( gColorBackGnd );
+ ghBrushBlack = CreateSolidBrush ( gColorForeGnd );
+
+ ghBrushHighLight = CreateSolidBrush ( gColorHighLight );
+
+ if ( IS_JAPAN() ) {
+ RSM_StringCopy ( IDS_FONTSYSTEM, szFontFace, MAX_FONTFACENAME_LEN );
+ } else {
+ RSM_StringCopy ( IDS_FONTHELV, szFontFace, MAX_FONTFACENAME_LEN );
+ }
+
+ ghFontStatus = CreateFont( 16, // Height
+ 7, // Width
+ 0, // Escapement
+ 0, // Orientation
+ 400, // Weight
+ 0, // Italics?
+ 0, // Underline?
+ 0, // Strike out?
+ (IS_JAPAN()?csfont:ANSI_CHARSET ),
+ OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS,
+ DEFAULT_QUALITY,
+ DEFAULT_PITCH | FF_SWISS,
+ szFontFace
+ );
+
+ ghFontMsgBox = CreateFont( 13, // Height
+ 5, // Width
+ 0, // Escapement
+ 0, // Orientation
+ (IS_JAPAN()?400:FW_BOLD), //Weight
+ 0, // Italics?
+ 0, // Underline?
+ 0, // Strike out?
+ (IS_JAPAN()?csfont:ANSI_CHARSET ),
+ OUT_STRING_PRECIS, //
+ CLIP_STROKE_PRECIS,
+ DEFAULT_QUALITY,
+ VARIABLE_PITCH | FF_DONTCARE,
+ szFontFace
+ );
+
+ ghFontFiles = CreateFont ( nFontHeight,
+ 0, // Width
+ 0, // Escapement
+ 0, // Orientation
+ CDS_GetFontWeight ( pCDS ),
+ (BYTE)CDS_GetFontItalics ( pCDS ),
+ 0, // Underline?
+ 0, // Strike out?
+ (IS_JAPAN()?csfont:ANSI_CHARSET ),
+ OUT_STRING_PRECIS, //
+ CLIP_STROKE_PRECIS,
+ DEFAULT_QUALITY,
+ VARIABLE_PITCH | FF_SWISS,
+ CDS_GetFontFace ( pCDS )
+ );
+
+ ghFontIconLabels = ghFontFiles;
+
+ ghFontRibbon = CreateFont( 13, // Height
+ 5, // Width
+ 0, // Escapement
+ 0, // Orientation
+ (IS_JAPAN()?400:FW_BOLD),
+ 0, // Italics?
+ 0, // Underline?
+ 0, // Strike out?
+ (IS_JAPAN()?csfont:ANSI_CHARSET ),
+ OUT_STRING_PRECIS, //
+ CLIP_STROKE_PRECIS,
+ DEFAULT_QUALITY,
+ VARIABLE_PITCH | FF_DONTCARE,
+ szFontFace
+ );
+
+ if ( IS_JAPAN() ) {
+ RSM_StringCopy ( IDS_FONTSYSTEM, szFontFace, MAX_FONTFACENAME_LEN );
+ } else {
+ RSM_StringCopy ( IDS_FONTCOURIER, szFontFace, MAX_FONTFACENAME_LEN );
+ }
+
+ ghFontLog = CreateFont( 13, // Height
+ 8, // Width
+ 0, // Escapement
+ 0, // Orientation
+ 400, // Weight
+ 0, // Italics?
+ 0, // Underline?
+ 0, // Strike out?
+ (IS_JAPAN()?csfont:ANSI_CHARSET ),
+ OUT_STRING_PRECIS, //
+ CLIP_STROKE_PRECIS,
+ DEFAULT_QUALITY,
+ FIXED_PITCH | FF_MODERN,
+ szFontFace
+ );
+
+ // Initialize the bitmap resources.
+
+ RSM_BitmapInit ();
+
+ // Get the Windows border width so that it can be used in determining
+ // the MDI Document slider width.
+
+ gnBorderWidth = GetSystemMetrics ( SM_CXFRAME );
+
+ return SUCCESS;
+
+} /* end WM_CreateObjects() */
+
+
+/******************************************************************************
+
+ Name: WM_Deinit()
+
+ Description: This function deinitializes the GUI Window Manager by
+ unregistering window classes and deleting objects.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_Deinit ( VOID )
+
+{
+ // Deinitialize the Help Manager.
+
+ HM_Deinit () ;
+
+ // Unregister the classes and delete the objects.
+
+ UnregisterClass ( WMCLASS_FRAME, ghInst );
+ UnregisterClass ( WMCLASS_DOC, ghInst );
+ UnregisterClass ( WMCLASS_RIBBON, ghInst );
+ UnregisterClass ( WMCLASS_DDECLIENT, ghInst );
+ UnregisterClass ( WMCLASS_VIEWWIN, ghInst );
+
+ WM_DeleteObjects ();
+
+} /* end WM_Deinit() */
+
+
+/******************************************************************************
+
+ Name: WM_DeleteObjects()
+
+ Description: This function deletes the pens, brushes, and fonts, used
+ to display windows graphics. It also deletes any bitmaps
+ in the bitmap table.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_DeleteObjects ( VOID )
+
+{
+ // Delete only the NON-STOCK OBJECTS (pens, brushes, and fonts).
+
+ DeleteObject ( ghPenGray );
+ DeleteObject ( ghPenBackGnd );
+ DeleteObject ( ghPenForeGnd );
+ DeleteObject ( ghPenBtnText );
+ DeleteObject ( ghPenLtGray );
+ DeleteObject ( ghPenDkGray );
+
+ DeleteObject ( ghBrushLtGray );
+ DeleteObject ( ghBrushWhite );
+ DeleteObject ( ghBrushBlack );
+
+ DeleteObject ( ghFontStatus );
+ DeleteObject ( ghFontFiles );
+ DeleteObject ( ghFontRibbon );
+ DeleteObject ( ghFontMsgBox );
+ DeleteObject ( ghFontLog );
+
+ // Delete any bitmaps in the bitmap table.
+
+ RSM_BitmapFreeAll ();
+
+} /* end WM_DeleteObjects() */
+
+
+/******************************************************************************
+
+ Name: WM_GetNext()
+
+ Description: This function gets the next MDI document window handle.
+ If the current window handle is NULL, the call gets the
+ first MDI document window handle.
+
+ Returns: A handle to a MDI document window. It returns NULL or 0 if
+ there are no more MDI document windows.
+
+******************************************************************************/
+
+HWND WM_GetNext (
+
+register HWND hWndCurrent ) // I - the current window handle
+
+{
+ // If the current window handle is 0, get the first MDI doc.
+
+ if ( ! hWndCurrent ) {
+ hWndCurrent = GetWindow( ghWndMDIClient, GW_CHILD );
+ }
+ else {
+ hWndCurrent = GetWindow( hWndCurrent, GW_HWNDNEXT );
+ }
+
+ for ( ; hWndCurrent; hWndCurrent = GetWindow( hWndCurrent, GW_HWNDNEXT ) ) {
+
+ // Skip if the window is an icon title window.
+
+ if ( GetWindow( hWndCurrent, GW_OWNER ) ) {
+ continue;
+ }
+ else {
+ return hWndCurrent; // This is the next MDI child window.
+ }
+ }
+
+ return hWndCurrent; // The handle will be NULL by this point.
+
+
+} /* end WM_GetNext() */
+
+
+/******************************************************************************
+
+ Name: WM_Init()
+
+ Description: This function initializes the GUI Window Manager by
+ registering window classes, creating objects, and creating
+ the frame through which the MDI client is created.
+
+ Returns: SUCCESS, if successful. Otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL WM_Init (
+
+LPSTR lpCmdLine, // I - pointer to the command line
+INT nCmdShow ) // I - show parm from windows for describing how
+ // to show the frame window
+
+{
+ WNDCLASS wc;
+ CHAR szTitle[MAX_UI_RESOURCE_SIZE];
+ CDS_PTR pCDS = CDS_GetPerm ();
+ BOOL fOldShowStatus;
+
+ // Create Pens, Brushes, and Font objects.
+
+ if ( WM_CreateObjects () ) {
+
+ return FAILURE;
+ }
+
+ // Register the Frame class.
+
+ wc.style = 0;
+ wc.lpfnWndProc = WM_FrameWndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = ghInst;
+ wc.hIcon = RSM_IconLoad ( IDRI_WNTRPARK );
+ wc.hCursor = RSM_CursorLoad ( ID(IDRC_ARROW) );
+ wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WMCLASS_FRAME;
+
+ if ( ! RegisterClass( &wc ) ) {
+ return FAILURE;
+ }
+
+ // Register the MDI Doc class(es).
+
+ wc.style = CS_DBLCLKS;
+ wc.lpfnWndProc = WM_MDIDocWndProc;
+ wc.hIcon = (HICON)NULL;
+ wc.hCursor = (HCURSOR)NULL;
+ wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1);
+ wc.lpszMenuName = NULL;
+ wc.cbWndExtra = sizeof(PDS_WMINFO);
+ wc.lpszClassName = WMCLASS_DOC;
+
+ if ( ! RegisterClass( &wc ) ) {
+ return FAILURE;
+ }
+
+ // Register the Ribbon class(es).
+
+# if !defined ( OEM_MSOFT )
+ {
+ wc.style = 0;
+ wc.lpfnWndProc = WM_RibbonWndProc;
+ wc.hIcon = (HICON)NULL;
+ wc.hCursor = RSM_CursorLoad ( IDRC_HAND );
+ wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+ wc.lpszMenuName = NULL;
+ wc.cbWndExtra = sizeof(PDS_RIBINFO) + sizeof(WORD);
+ wc.lpszClassName = WMCLASS_RIBBON;
+ }
+# else
+ {
+ wc.style = 0;
+ wc.lpfnWndProc = WM_RibbonWndProc;
+ wc.hIcon = (HICON)NULL;
+ wc.hCursor = RSM_CursorLoad ( ID(IDRC_ARROW) );
+ wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+ wc.lpszMenuName = NULL;
+ wc.cbWndExtra = sizeof(PDS_RIBINFO) + sizeof(WORD);
+ wc.lpszClassName = WMCLASS_RIBBON;
+ }
+# endif
+
+ if ( ! RegisterClass( &wc ) ) {
+ return FAILURE;
+ }
+
+ // Register the DDEclient class(es).
+
+ wc.style = 0;
+ wc.lpfnWndProc = WM_DDEClientWndProc;
+ wc.hIcon = (HICON)NULL;
+ wc.hCursor = (HCURSOR)NULL;
+ wc.hbrBackground = (HBRUSH)NULL;
+ wc.lpszMenuName = NULL;
+ wc.cbWndExtra = 0;
+ wc.lpszClassName = WMCLASS_DDECLIENT;
+
+ if ( ! RegisterClass( &wc ) ) {
+ return FAILURE;
+ }
+
+ // Register the Dumb Window class.
+
+ wc.style = 0;
+ wc.lpfnWndProc = WM_ViewWndProc;
+ wc.hIcon = (HICON)NULL;
+ wc.hCursor = RSM_CursorLoad ( ID(IDRC_ARROW) ) ;
+ wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
+ wc.lpszMenuName = NULL;
+ wc.cbWndExtra = sizeof(PVOID);
+ wc.lpszClassName = WMCLASS_VIEWWIN;
+
+ if ( ! RegisterClass( &wc ) ) {
+ return FAILURE;
+ }
+
+ // Load main menu accelerators.
+
+ if ( ! ( ghAccel = LoadAccelerators ( ghResInst, IDRA_ACCKEYS ) ) ) {
+ return FAILURE;
+ }
+
+ // Copy command line into our global variable.
+
+ if ( lpCmdLine ) {
+
+ glpCmdLine = (LPSTR)calloc( strlen( lpCmdLine ) + 1, sizeof ( CHAR ) );
+
+ if ( ! glpCmdLine ) {
+ return FAILURE;
+ }
+
+ strcpy ( glpCmdLine, lpCmdLine );
+
+ strupr ( glpCmdLine );
+
+ MUI_ProcessCommandLine ( glpCmdLine, &nCmdShow );
+
+ }
+ else {
+
+ glpCmdLine = (LPSTR)calloc( 1, sizeof ( CHAR ) );
+
+ if ( ! glpCmdLine ) {
+ return FAILURE;
+ }
+
+ glpCmdLine[0] = TEXT('\0');
+ }
+
+ // Get the frame window title and concatenate the command line INI
+ // file name if there was one found.
+
+ RSM_StringCopy( IDS_APPNAME, szTitle, MAX_UI_RESOURCE_LEN );
+
+ if ( CDS_UsingCmdLineINI () ) {
+
+ CHAR szTemp[MAX_UI_RESOURCE_SIZE];
+ LPSTR p;
+
+ CDS_GetIniFileName ( szTemp, sizeof ( szTemp ) );
+
+ p = strstr ( szTemp, TEXT(".INI") );
+
+ *p = (CHAR)NULL;
+
+ strcat ( szTitle, TEXT(" - ") );
+ strcat ( szTitle, szTemp );
+ }
+
+// strcat( szTitle, TEXT("-build 327.4") ) ;
+
+ // Create the frame.
+
+ ghWndFrame = WM_Create( (WORD)(WM_FRAME | CDS_GetFrameSize ( pCDS )),
+ szTitle,
+ (LPSTR)NULL,
+ (INT)CDS_GetFrameInfo ( pCDS ).x,
+ (INT)CDS_GetFrameInfo ( pCDS ).y,
+ (INT)CDS_GetFrameInfo ( pCDS ).cx,
+ (INT)CDS_GetFrameInfo ( pCDS ).cy,
+ (PDS_WMINFO)NULL );
+
+ if ( ( ! ghWndFrame ) || ( ! ghWndMDIClient ) ) {
+ return FAILURE;
+ }
+
+ // Show the WAIT cursor and capture all mouse messages to the frame
+ // window. Its complement is in frameproc.c after the app is initialized.
+
+ WM_ShowWaitCursor ( TRUE );
+
+ if ( ! gfDebug ) {
+
+ // If there is no debug option, remove the debug window settings from
+ // the settings menu.
+
+#if defined( CAYMAN )
+// Remove the Networks menu entry
+ DeleteMenu ( GetMenu( ghWndFrame ), IDM_SETTINGSNETWORK, MF_BYCOMMAND );
+#endif
+
+# if !defined ( OEM_MSOFT ) // unsupported feature
+ {
+ DeleteMenu ( GetMenu( ghWndFrame ), IDM_SETTINGSDEBUGWINDOW, MF_BYCOMMAND );
+ }
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+#if !defined ( OEM_MSOFT ) | defined( CAYMAN )
+ DrawMenuBar( ghWndFrame );
+#endif
+ }
+
+ // Create the MDI Client and MDI Document List Box sub-class Instances.
+
+ glpfnNewMDIClientProc = MakeProcInstance ( (WNDPROC)WM_MDIClientWndProc, ghInst );
+ glpfnNewListProc = MakeProcInstance ( (WNDPROC)WM_DocListWndProc, ghInst );
+
+ // Now, go ahead and SubClass the MDI Client.
+
+ WM_SubClassMDIClient ( ghWndMDIClient );
+
+ // We need the Jobs Pop-up Menu Handle so that we can attach Job Names
+ // to it. This must be done now, since windows MDI processing can
+ // add to or remove from the menu.
+
+ // Get the Jobs Menu handle for deleting and appending from/to this menu.
+
+ ghMenuJobs = GetSubMenu ( GetMenu ( ghWndFrame ), JOBSMENUPOSITION );
+
+ // Initialize the Display List Manager.
+
+ if ( DLM_Init ( ghWndFrame ) ) {
+ return FAILURE;
+ }
+
+ // Set status line to initializing
+
+ fOldShowStatus = gfShowStatusLine;
+ gfShowStatusLine = SUCCESS;
+ STM_SetIdleText ( IDS_INITIALIZING );
+ gfShowStatusLine = fOldShowStatus;
+
+ // Display the frame window as it is written in the INI file,
+ // unless the command line told us to show it minimized.
+
+ if ( nCmdShow == SW_SHOWNORMAL || nCmdShow == SW_SHOWMAXIMIZED ) {
+
+ if ( (WORD)CDS_GetFrameSize ( pCDS ) == WM_MAX ) {
+ nCmdShow = SW_SHOWMAXIMIZED;
+ }
+ else {
+ nCmdShow = SW_SHOWNORMAL;
+ }
+ }
+
+ ShowWindow ( ghWndFrame, nCmdShow );
+
+ // Update the client area.
+
+ WM_Update ( ghWndFrame );
+
+ // Initialize the GUI Help Manager.
+
+ HM_Init ();
+
+ return SUCCESS;
+
+} /* end WM_Init() */
+
+
+/******************************************************************************
+
+ Name: WM_QueryCloseAllDocs()
+
+ Description: This function asks if all secondary MDI document windows
+ can be closed.
+
+ Returns: TRUE, if all can be closed. Otherwise, FALSE.
+
+******************************************************************************/
+
+BOOL WM_QueryCloseAllDocs( VOID )
+{
+ HWND hWndTemp;
+
+ for ( hWndTemp = GetWindow ( ghWndMDIClient, GW_CHILD );
+ hWndTemp;
+ hWndTemp = GetWindow ( hWndTemp, GW_HWNDNEXT ) ) {
+
+ // Skip if an icon title window.
+
+ if ( GetWindow ( hWndTemp, GW_OWNER ) ) {
+ continue;
+ }
+
+ if ( ! SendMessage ( hWndTemp, WM_QUERYENDSESSION, 0, 0L ) ) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+
+} /* end WM_QueryCloseAllDocs() */
+
+
+/******************************************************************************
+
+ Name: WM_GetTitle()
+
+ Description: This function copies the long version of the MDI Doc title
+ from the WinInfo structure to the callers specified area.
+
+ Returns: The number of bytes copied.
+
+******************************************************************************/
+
+INT WM_GetTitle (
+
+HWND hWnd, // I - handle of a MDI document window
+LPSTR pDestTitle, // I - pointer to the destination title string.
+INT nDestLen ) // I - max # of characters to copy.
+
+
+{
+ PDS_WMINFO pdsWinInfo;
+ LPSTR pBuffer;
+
+ msassert ( hWnd != (HWND)NULL );
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ msassert ( pdsWinInfo != (VOID_PTR)NULL );
+
+ pBuffer = WMDS_GetWinTitle ( pdsWinInfo );
+
+ if ( pBuffer && nDestLen > 0 ) {
+ strncpy ( pDestTitle, pBuffer, nDestLen );
+ }
+
+ return strlen ( pBuffer );
+
+
+} /* end WM_GetTitle() */
+
+
+/******************************************************************************
+
+ Name: WM_SetMinTitle()
+
+ Description: This function sets the minimum title in the extra-bytes of a
+ MDI document window to the one specified, then changes the
+ caption title of the document window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_SetMinTitle (
+
+HWND hWnd, // I - handle of a MDI document window
+LPSTR pMinTitle ) // I - pointer to the minimum title to be copied to
+ // the window's extra-bytes.
+
+{
+ INT nLen;
+ PDS_WMINFO pdsWinInfo;
+ LPSTR pBuffer;
+
+ msassert ( hWnd != (HWND)NULL );
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ msassert ( pdsWinInfo != (VOID_PTR)NULL );
+
+ // Allocate space for the new title, then copy it.
+
+ nLen = strlen ( pMinTitle ) + 1;
+
+ pBuffer = ( LPSTR )calloc ( nLen, sizeof ( CHAR ) );
+
+ if ( ! pBuffer ) {
+ return;
+ }
+
+ strncpy ( pBuffer, pMinTitle, nLen );
+
+ // If there already is a title, trash it, then set it to the new one.
+
+ if ( pdsWinInfo->pMinTitle ) {
+ free ( pdsWinInfo->pMinTitle );
+ }
+
+ pdsWinInfo->pMinTitle = pBuffer;
+
+ SetWindowText ( hWnd, pBuffer );
+
+} /* end WM_SetMinTitle() */
+
+
+/******************************************************************************
+
+ Name: WM_SetTitle()
+
+ Description: This function sets the normal title in the extra-bytes of a
+ MDI document window to the one specified, then changes the
+ caption title of the document window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_SetTitle (
+
+HWND hWnd, // I - handle of a MDI document window
+LPSTR pTitle ) // I - pointer to the normal title to be copied to
+ // the window's extra-bytes.
+{
+ INT nLen;
+ PDS_WMINFO pdsWinInfo;
+ LPSTR pBuffer;
+ CHAR chTemp;
+
+ msassert ( hWnd != (HWND)NULL );
+
+ pdsWinInfo = WM_GetInfoPtr ( hWnd );
+
+ msassert ( pdsWinInfo != (VOID_PTR)NULL );
+
+ // Allocate space for the new title, then copy it.
+
+ nLen = strlen ( pTitle ) + 1;
+
+ pBuffer = ( LPSTR )calloc ( nLen, sizeof ( CHAR ) );
+
+ if ( ! pBuffer ) {
+ return;
+ }
+
+ strncpy ( pBuffer, pTitle, nLen );
+
+ // If there already is a title, trash it, then set it to the new one.
+
+ if ( pdsWinInfo->pTitle ) {
+ free ( pdsWinInfo->pTitle );
+ }
+
+ pdsWinInfo->pTitle = pBuffer;
+
+ // Guarantee that the title we send to Windows is less than or
+ // equal to the MAX_UI_WIN_TITLE_LEN, otherwise, Windows may blow up.
+
+ chTemp = 0;
+
+ if ( strlen ( pBuffer ) > MAX_UI_WIN_TITLE_LEN ) {
+ chTemp = pBuffer[ MAX_UI_WIN_TITLE_LEN ];
+ pBuffer[ MAX_UI_WIN_TITLE_LEN ] = 0;
+ }
+
+ SetWindowText ( hWnd, pBuffer );
+
+ if ( chTemp != 0 ) {
+ pBuffer[ MAX_UI_WIN_TITLE_LEN ] = chTemp;
+ }
+
+} /* end WM_SetTitle() */
+
+
+/******************************************************************************
+
+ Name: WM_SubClassListBox()
+
+ Description: This function is called by WM_DocCreate when a list box
+ must be created inside of a MDI document window.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_SubClassListBox (
+
+register HWND hWnd ) // I - handle of the list box to sub-class
+
+{
+ // Grab the old procedure-instance for the MDI Document list boxes.
+ // (only if there wasn't one grabbed previously)
+
+ if ( ! glpfnOldListProc ) {
+
+ glpfnOldListProc = (WNDPROC) GetWindowLong ( hWnd, GWL_WNDPROC );
+ }
+
+ // Subclass the specified window.
+
+ SetWindowLong ( hWnd, GWL_WNDPROC, (DWORD)glpfnNewListProc );
+
+} /* end WM_SubClassListBox() */
+
+
+/******************************************************************************
+
+ Name: WM_SubClassMDIClient()
+
+ Description: This function is called after creating the Frame.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_SubClassMDIClient (
+
+register HWND hWnd ) // I - handle of the MDI Client to sub-class
+
+{
+ // Grab the old procedure-instance for the MDI Client.
+ // (only if there wasn't one grabbed previously)
+
+ if ( ! glpfnOldMDIClientProc ) {
+
+ glpfnOldMDIClientProc = (WNDPROC) GetWindowLong ( hWnd, GWL_WNDPROC );
+ }
+
+ // Subclass the specified window.
+
+ if ( glpfnOldMDIClientProc ) {
+ SetWindowLong ( hWnd, GWL_WNDPROC, (DWORD)glpfnNewMDIClientProc );
+ }
+
+} /* end WM_SubClassMDIClient() */
+
+
+/******************************************************************************
+
+ Name: WM_ShowWaitCursor()
+
+ Description: This function captures the mouse and sets the cursor to
+ the common HOURGLASS, if the parameter passed is TRUE.
+ Otherwise, if currently waiting, and the parameter passed
+ is FALSE, the mouse is released from capture, and the
+ old cursor is restored.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_ShowWaitCursor (
+
+BOOL fWait ) // I - flag indicating whether to wait or continue
+
+{
+ static UINT unWaitSem = 0; // counting semaphore
+ static HCURSOR hCursorFrame; // old frame window class cursor handle
+ static HCURSOR hCursorWindows; // old windows current cursor handle
+
+ // Check for the type of waiting.
+
+ switch ( fWait ) {
+
+ case SWC_SHOW:
+
+ unWaitSem++;
+
+ if ( ! mwfWaiting ) {
+
+ HCURSOR hCursorWait = RSM_CursorLoad ( ID(IDC_WAIT) );
+
+ // WAIT - iff told to wait and not already waiting.
+
+ hCursorWindows = SetCursor ( hCursorWait );
+ hCursorFrame = WM_SetClassCursor ( ghWndFrame, hCursorWait );
+ SetCapture ( ghWndFrame );
+ mwfWaiting = TRUE;
+ }
+
+ break;
+
+ case SWC_HIDE:
+
+ if ( unWaitSem ) {
+ unWaitSem--;
+ }
+
+ if ( mwfWaiting && ! unWaitSem ) {
+
+ // STOP WAIT - iff told to stop waiting and currently waiting.
+
+ WM_SetClassCursor ( ghWndFrame, hCursorFrame );
+ // SetCursor ( hCursorWindows );
+ SetCursor ( hCursorFrame );
+ ReleaseCapture ( );
+ mwfWaiting = FALSE;
+ }
+
+ break;
+
+ case SWC_PAUSE:
+
+ if ( mwfWaiting ) {
+
+ WM_SetClassCursor ( ghWndFrame, hCursorFrame );
+ SetCursor ( hCursorFrame );
+ ReleaseCapture ( );
+ mwfWaiting = FALSE;
+ }
+
+ break;
+
+ case SWC_RESUME:
+
+ if ( ! mwfWaiting && unWaitSem ) {
+
+ HCURSOR hCursorWait = RSM_CursorLoad ( ID(IDC_WAIT) );
+
+ // WAIT - iff told to wait and not already waiting.
+
+ hCursorWindows = SetCursor ( hCursorWait );
+ hCursorFrame = WM_SetClassCursor ( ghWndFrame, hCursorWait );
+ SetCapture ( ghWndFrame );
+ mwfWaiting = TRUE;
+ }
+
+ break;
+
+ } /* end switch() */
+
+} /* end WM_ShowWaitCursor() */
+
+
+/******************************************************************************
+
+ Name: WM_SetCursor ()
+
+ Description: Sets the cursor to the appropriate one. This function
+ should be smart enough to set the cursor to an hour glass,
+ the help cursor, and be able to detect when the cursor
+ moves outside of this applications windows and allow the
+ cursor to be changed by other apps, if the mode of this
+ app allows this.
+
+
+ Returns: TRUE, if no further processing should be done.
+ Otherwise, FALSE.
+
+******************************************************************************/
+
+BOOL WM_SetCursor (
+
+HWND hWnd )
+
+{
+ if ( mwfWaiting ) {
+
+ HWND hWndCapture = GetCapture ();
+
+ // If the app should be showing the wait cursor, make sure that we
+ // are still capturing while we are moving around here.
+
+ if ( ! hWndCapture ) {
+ SetCapture ( ghWndFrame );
+ }
+ else if ( hWndCapture == ghWndFrame ) {
+
+ POINT pt;
+
+ GetCursorPos ( &pt );
+
+ if ( ! IsChild ( ghWndFrame, WindowFromPoint ( pt ) ) ) {
+ ReleaseCapture();
+ }
+ }
+
+
+ SetCursor ( RSM_CursorLoad ( ID(IDC_WAIT) ) );
+ return TRUE;
+ }
+
+ return FALSE;
+
+} /* end WM_SetCursor() */
+
+
+/******************************************************************************
+
+ Name: WM_GetAppIcon()
+
+ Description: This function gets the icon that will be displayed when an
+ application is running.
+
+ Returns: The application icon.
+
+******************************************************************************/
+
+HICON WM_GetAppIcon ( VOID )
+
+{
+ return WM_GetClassIcon ( ghWndFrame );
+
+} /* end WM_GetAppIcon() */
+
+
+/******************************************************************************
+
+ Name: WM_SetAppIcon()
+
+ Description: This function sets the icon that will be displayed when an
+ application is running.
+
+ Returns: The old application icon.
+
+******************************************************************************/
+
+HICON WM_SetAppIcon (
+
+HICON hIcon ) // I - icon handle
+
+{
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ HICON hOldIcon;
+
+ if ( IsIconic ( ghWndFrame ) ) {
+
+ RedrawWindow( ghWndFrame,
+ NULL,
+ NULL,
+ RDW_ERASE|RDW_FRAME|RDW_INTERNALPAINT|RDW_INVALIDATE|
+ RDW_ERASENOW);
+
+ }
+
+ hOldIcon = WM_SetClassIcon ( ghWndFrame, hIcon );
+
+ return hOldIcon;
+
+# else //if !defined ( OEM_MSOFT ) // unsupported feature
+
+ return WM_GetClassIcon ( ghWndFrame );
+
+# endif //!defined ( OEM_MSOFT ) // unsupported feature
+
+} /* end WM_SetAppIcon() */
+
+
+/******************************************************************************
+
+ Name: WM_AnimateAppIcon()
+
+ Description: This function animates the icon that will be displayed when
+ an application is running.
+
+ Returns: SUCCESS, if successful. Otherwise, FAILURE.
+
+******************************************************************************/
+
+BOOL WM_AnimateAppIcon (
+
+WORD wType, // I - type of animation sequence.
+BOOL fReset ) // I - flag to reset the animation sequence.
+
+{
+# if !defined ( OEM_MSOFT ) // unsupported feature
+
+ static WORD wLastAnimationType = 0;
+ static INT nLastSlideNumber = 0;
+
+ LPSTR lpIconID;
+
+ if ( IsIconic ( ghWndFrame ) ) {
+
+ if ( fReset || wType != wLastAnimationType ) {
+ nLastSlideNumber = 0;
+ }
+
+ wLastAnimationType = wType;
+
+ switch ( wType ) {
+
+ case IDM_OPERATIONSBACKUP:
+ case IDM_OPERATIONSTRANSFER:
+
+ switch ( nLastSlideNumber ) {
+
+ case 0:
+ lpIconID = IDRI_BKUP0;
+ break;
+
+ case 1:
+ lpIconID = IDRI_BKUP1;
+ break;
+
+ case 2:
+ lpIconID = IDRI_BKUP2;
+ break;
+
+ case 3:
+ lpIconID = IDRI_BKUP3;
+ break;
+
+ case 4:
+ lpIconID = IDRI_BKUP4;
+ break;
+
+ case 5:
+ lpIconID = IDRI_BKUP5;
+ break;
+
+ case 6:
+ lpIconID = IDRI_BKUP6;
+ break;
+
+ case 7:
+ lpIconID = IDRI_BKUP7;
+ break;
+
+ }
+
+ nLastSlideNumber = ++nLastSlideNumber % 8;
+ break;
+
+ case IDM_OPERATIONSRESTORE:
+
+ switch ( nLastSlideNumber ) {
+
+ case 0:
+ lpIconID = IDRI_BKUP0;
+ break;
+
+ case 1:
+ lpIconID = IDRI_BKUP7;
+ break;
+
+ case 2:
+ lpIconID = IDRI_BKUP6;
+ break;
+
+ case 3:
+ lpIconID = IDRI_BKUP5;
+ break;
+
+ case 4:
+ lpIconID = IDRI_BKUP4;
+ break;
+
+ case 5:
+ lpIconID = IDRI_BKUP3;
+ break;
+
+ case 6:
+ lpIconID = IDRI_BKUP2;
+ break;
+
+ case 7:
+ lpIconID = IDRI_BKUP1;
+ break;
+
+ }
+
+ nLastSlideNumber = ++nLastSlideNumber % 8;
+ break;
+
+
+ case IDM_OPERATIONSVERIFY:
+ case IDM_OPERATIONSCATALOG:
+
+ switch ( nLastSlideNumber ) {
+
+ case 0:
+ lpIconID = IDRI_SPIN0;
+ break;
+
+ case 1:
+ lpIconID = IDRI_SPIN1;
+ break;
+
+ case 2:
+ lpIconID = IDRI_SPIN2;
+ break;
+
+ case 3:
+ lpIconID = IDRI_SPIN3;
+ break;
+
+ }
+
+ nLastSlideNumber = ++nLastSlideNumber % 4;
+ break;
+
+ default:
+ return FAILURE;
+ }
+
+ WM_SetAppIcon ( RSM_IconLoad ( lpIconID ) );
+ return SUCCESS;
+ }
+ return FAILURE;
+
+# else // !defined ( OEM_MSOFT ) // unsupported feature
+
+ return SUCCESS;
+
+# endif // !defined ( OEM_MSOFT ) // unsupported feature
+
+} /* end WM_AnimateAppIcon() */
+
+
+/******************************************************************************
+
+ Name: WM_SetDocSizes()
+
+ Description: This function initializes the document sizes.
+
+ WMSIZE_NORMAL
+ WMSIZE_MIN
+ WMSIZE_MAX
+ WMSIZE_IGNORE *
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_SetDocSizes ( VOID )
+
+{
+ HWND hWndThis = WM_GetNext( (HWND) NULL );
+ WININFO_PTR pdsWinInfo;
+
+ mwhWndLastTop = WM_GetActiveDoc ();
+
+ while ( hWndThis ) {
+
+ pdsWinInfo = WM_GetInfoPtr ( hWndThis );
+
+ WMDS_SetSize ( pdsWinInfo, WMSIZE_UNKNOWN );
+
+ hWndThis = WM_GetNext ( hWndThis );
+ }
+
+} /* end WM_SetDocSizes() */
+
+
+/******************************************************************************
+
+ Name: WM_MinimizeDocs()
+
+ Description: This function minimizes all primary docs, except the debug,
+ and destroys all secondary docs.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_MinimizeDocs ( VOID )
+
+{
+ HWND hWndNext = WM_GetNext ( (HWND) NULL );
+ HWND hWndThis;
+ WININFO_PTR pdsWinInfo;
+ INT nSize;
+ CHAR szOldStatusLine[MAX_STATUS_LINE_SIZE];
+
+ // Save the old status line text.
+
+ strncpy ( szOldStatusLine, STM_GetStatusLineText (), MAX_STATUS_LINE_LEN );
+ szOldStatusLine [ MAX_STATUS_LINE_LEN ] = (CHAR)0;
+
+ while ( hWndNext ) {
+
+ hWndThis = hWndNext;
+ pdsWinInfo = WM_GetInfoPtr ( hWndThis );
+
+ // You have to grab the next one right away and hold on to it.
+
+ hWndNext = WM_GetNext ( hWndNext );
+
+ if ( WMDS_GetSize ( pdsWinInfo ) == WMSIZE_UNKNOWN ) {
+
+ if ( WM_IsMinimized ( hWndThis ) ) {
+ nSize = WMSIZE_MIN;
+ }
+ else if ( WM_IsMaximized ( hWndThis ) ) {
+ nSize = WMSIZE_MAX;
+ }
+ else {
+ nSize = WMSIZE_NORMAL;
+ }
+
+ // Minimize primary docs. Trash the secondary docs.
+
+ switch ( WMDS_GetWinType ( pdsWinInfo ) ) {
+
+#ifdef OEM_EMS
+ case WMTYPE_EXCHANGE:
+#endif //OEM_EMS
+ case WMTYPE_DISKS:
+ case WMTYPE_TAPES:
+ case WMTYPE_SERVERS:
+ case WMTYPE_LOGFILES:
+
+ WMDS_SetSize ( pdsWinInfo, nSize );
+ break;
+
+ case WMTYPE_DEBUG:
+
+ nSize = WMSIZE_IGNORE;
+ WMDS_SetSize ( pdsWinInfo, nSize );
+ break;
+
+ default:
+
+ nSize = WMSIZE_IGNORE;
+ WM_Destroy ( hWndThis );
+ break;
+
+ }
+
+ // Minimize if it is normal or maximized.
+
+ if ( nSize == WMSIZE_NORMAL || nSize == WMSIZE_MAX ) {
+ WM_MinimizeDoc ( hWndThis );
+ }
+ }
+ }
+
+ WM_MultiTask ();
+
+ // Restore the old status line text.
+
+ STM_SetStatusLineText ( szOldStatusLine );
+ STM_DrawText ( szOldStatusLine );
+
+ // Set the documents minimized flag.
+
+ mwfDocsMinimized = TRUE;
+
+} /* end WM_MinimizeDocs() */
+
+
+/******************************************************************************
+
+ Name: WM_RestoreDocs()
+
+ Description: This function Restores all primary docs, except the debug.
+
+ Last Change: Alter it to check to see if a tree type window is
+ already open. If so see to it it ends up on top of
+ pile of windows, rather than the bottom. This is
+ needed for slow cataloged sets. Otherwise the new
+ tree window ends up buried by the other windows.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_RestoreDocs ( VOID )
+
+{
+ HWND hWndNext = WM_GetNext ( (HWND) NULL );
+ HWND hWndThis;
+ HWND hWndTop = (HWND) NULL;
+ WININFO_PTR pdsWinInfo;
+ INT nSize;
+ BOOL fActivateLastTop = FALSE;
+
+ // If the documents were never minimized, don't bother
+ // restoring them.
+
+ if ( ! mwfDocsMinimized ) {
+ return;
+ }
+
+ while ( hWndNext && ( hWndTop == (HWND)NULL ) ) {
+
+ pdsWinInfo = WM_GetInfoPtr ( hWndNext );
+
+ if ( pdsWinInfo->wClosable ) {
+ hWndTop = hWndNext;
+ }
+
+ hWndNext = WM_GetNext( hWndNext );
+ }
+
+ hWndNext = WM_GetNext ( (HWND) NULL );
+
+ while ( hWndNext ) {
+
+ hWndThis = hWndNext;
+ pdsWinInfo = WM_GetInfoPtr ( hWndThis );
+
+ // You have to grab the next one right away and hold on to it.
+
+ hWndNext = WM_GetNext ( hWndNext );
+
+ nSize = WMDS_GetSize ( pdsWinInfo );
+
+ if ( ( nSize == WMSIZE_NORMAL ) || ( nSize == WMSIZE_MAX ) ) {
+
+ // Set the flag to restore the doc if it was previously
+ // normal or maximized.
+
+ if ( mwhWndLastTop == hWndThis ) {
+ fActivateLastTop = TRUE;
+ }
+
+ if ( nSize == WMSIZE_NORMAL ) {
+ WM_RestoreDoc ( hWndThis );
+ WMDS_SetSize ( pdsWinInfo, WMSIZE_IGNORE );
+ }
+ else {
+ WM_MaximizeDoc ( hWndThis );
+ WMDS_SetSize ( pdsWinInfo, WMSIZE_IGNORE );
+ }
+ }
+ }
+
+ // Set the active window to the previous top window, if it still
+ // exists.
+
+ if ( hWndTop != (HWND)NULL ) {
+ WM_SetActiveDoc ( hWndTop );
+ }
+ else if ( fActivateLastTop ) {
+ WM_SetActiveDoc ( mwhWndLastTop );
+ }
+
+ mwfDocsMinimized = FALSE;
+
+} /* end WM_RestoreDocs() */
+
+
+/******************************************************************************
+
+ Name: WM_MoveWindow()
+
+ Description: This function moves a window. This function is a consistant
+ way of moving a window, apparently unlike WIN 3.0 vs WIN 3.1
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_MoveWindow (
+
+HWND hWnd, // I - handle of a MDI document window
+INT x,
+INT y,
+INT nWidth,
+INT nHeight,
+BOOL fRepaint )
+
+{
+
+ WORD wFlags;
+
+ wFlags = ( fRepaint ) ? ( SWP_DRAWFRAME | SWP_NOZORDER ) : ( SWP_NOZORDER | SWP_NOREDRAW );
+
+ InvalidateRect ( hWnd, (LPRECT)NULL, fRepaint );
+
+ SetWindowPos ( hWnd, (HWND)NULL, x, y, nWidth, nHeight, wFlags );
+
+} /* end WM_MoveWindow() */
+
+
+/******************************************************************************
+
+ Name: WM_MakeAppActive()
+
+ Description: This makes our app the active app.
+
+ Returns: Nothing.
+
+******************************************************************************/
+
+VOID WM_MakeAppActive( VOID )
+
+{
+
+ // restore the app if minimized
+
+ if ( WM_IsMinimized ( ghWndFrame ) ) {
+
+ WM_Restore ( ghWndFrame );
+
+ } else {
+
+ HWND hWndTop = WM_GetActive ();
+
+ while ( hWndTop && hWndTop != ghWndFrame ) {
+ hWndTop = GetParent ( hWndTop );
+ }
+
+ // if our app is not active, make it active
+
+ if ( hWndTop != ghWndFrame ) {
+
+ WM_SetActive ( ghWndFrame );
+
+ if ( ghModelessDialog ) {
+
+ WM_SetActive ( ghModelessDialog );
+ }
+
+ }
+
+ }
+
+} /* end WM_MakeAppActive() */
+
diff --git a/private/utils/ntbackup/src/writescr.c b/private/utils/ntbackup/src/writescr.c
new file mode 100644
index 000000000..fb6781028
--- /dev/null
+++ b/private/utils/ntbackup/src/writescr.c
@@ -0,0 +1,298 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: writescr.c
+
+ Description: This file contains code to write a script to
+ a file
+
+ $Log: G:/UI/LOGFILES/WRITESCR.C_V $
+
+ Rev 1.12 11 Nov 1992 16:38:12 DAVEV
+UNICODE: remove compile warnings
+
+ Rev 1.11 05 Nov 1992 17:23:40 DAVEV
+fix ts
+
+ Rev 1.9 07 Oct 1992 14:19:18 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.8 07 Oct 1992 14:04:06 DAVEV
+various unicode chgs
+
+ Rev 1.7 04 Oct 1992 19:44:18 DAVEV
+Unicode Awk pass
+
+ Rev 1.6 28 Jul 1992 14:43:28 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.5 19 May 1992 13:01:18 MIKEP
+mips changes
+
+ Rev 1.4 18 May 1992 09:00:34 MIKEP
+header
+
+ Rev 1.3 15 May 1992 09:52:04 STEVEN
+40Format changes
+
+ Rev 1.2 04 Mar 1992 18:17:30 MIKEP
+fix attribute bug
+
+ Rev 1.1 11 Dec 1991 18:12:46 CHUCKB
+Removed unreferenced local variable.
+
+ Rev 1.0 20 Nov 1991 19:24:50 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+static UINT16 WriteFlags( FILE *fptr, BE_CFG_PTR cfg );
+static VOID WriteDate( FILE *fptr, FSE_PTR fse );
+
+static VOID WriteScriptLine( FILE *, CHAR_PTR, ... );
+
+
+
+
+static BOOLEAN mw_write_err;
+
+/****************************************************************************
+
+ Name: WriteScriptFile
+
+ Description: This function writes the BSD information to
+ a script file .
+
+ Returns: SUCCESS or FAILURE
+
+*****************************************************************************/
+INT16 WriteScriptFile( BSD_HAND bsd_hand, CHAR_PTR fname )
+{
+ BOOLEAN file_opened = FALSE;
+ BSD_PTR cur_bsd;
+ INT16 ret_val = 0;
+ FILE *fptr;
+
+ mw_write_err = FALSE;
+
+ /* Now check to see if there is anything to save */
+
+ cur_bsd = BSD_GetFirst( bsd_hand );
+
+ while( cur_bsd != NULL ) {
+
+ if ( BSD_GetMarkStatus( cur_bsd ) != NONE_SELECTED ) {
+ if ( !file_opened ) {
+ fptr = UNI_fopen( fname, _O_TEXT );
+ if ( fptr == NULL ) {
+ ret_val = SCR_CANNOT_OPEN_SCRIPT;
+ break;
+ } else {
+
+ file_opened = TRUE;
+ WriteFlags( fptr, BSD_GetConfigData( cur_bsd ) );
+ }
+ }
+
+ SCR_ProcessBSD( fptr, cur_bsd );
+ }
+
+
+ cur_bsd = BSD_GetNext( cur_bsd );
+
+ }
+ if ( file_opened ) {
+ if ( fclose( fptr ) || ( mw_write_err ) ) {
+ ret_val = SCR_ERROR_WRITING_SCRIPT;
+ }
+ }
+
+ return ret_val;
+}
+
+INT16 SCR_ProcessBSD( FILE *fptr, BSD_PTR bsd )
+{
+ FSE_PTR cur_fse;
+ CHAR path[MAX_TOKEN_LEN + 1];
+ CHAR quoted_path[MAX_TOKEN_LEN + 1 + 2];
+ CHAR_PTR temp_path;
+ CHAR_PTR temp_fname;
+ CHAR_PTR qpath_ptr;
+ INT16 path_size;
+ UINT32 off_attrib;
+ UINT32 on_attrib;
+ INT16 status;
+
+ GENERIC_DLE_PTR dle;
+
+ dle = BSD_GetDLE( bsd );
+
+ cur_fse = BSD_GetFirstFSE( bsd );
+
+ while( cur_fse != NULL ) {
+ FSE_GetPath( cur_fse, &(INT8_PTR)temp_path, &path_size );
+ temp_fname = (CHAR_PTR)FSE_GetFname( cur_fse );
+
+ status = (INT16) FS_MakePath( path, (INT16)sizeof (path), dle,
+ temp_path, path_size, temp_fname );
+
+ if ( status != SUCCESS ) {
+ return( FAILURE );
+
+ } else {
+
+ /*
+ * Check path for spaces and plus signs: if neccessary,
+ * write a quoted path.
+ */
+ if ( ( strchr( path, TEXT(' ') ) != NULL ) ||
+ ( ( path[0] != TEXT('+') ) && ( strchr( path, TEXT('+') ) != NULL ) ) ) {
+
+ /* Let's not mess up a drive spec (these aren't quoted) */
+ if ( path[1] == TEXT(':') ) {
+ strncpy( quoted_path, path, 2 );
+ quoted_path[2] = TEXT('\0');
+ qpath_ptr = &path[2];
+ } else {
+ quoted_path[0] = TEXT('\0');
+ qpath_ptr = &path[0];
+ }
+
+ strcat( quoted_path, TEXT("\"") );
+ strcat( quoted_path, qpath_ptr );
+ strcat( quoted_path, TEXT("\"") );
+
+ WriteScriptLine( fptr, TEXT("%s"), quoted_path );
+
+ } else {
+
+ WriteScriptLine( fptr, TEXT("%s"), path );
+
+ }
+
+ if ( FSE_GetOperType( cur_fse ) == EXCLUDE ) {
+ WriteScriptLine( fptr, TEXT(" /XCLUDE") );
+ }
+
+ if ( FSE_GetIncSubFlag( cur_fse ) ) {
+ WriteScriptLine( fptr, TEXT(" /SUBDIR"));
+ }
+
+ FSE_GetAttribInfo( cur_fse, &on_attrib, &off_attrib );
+
+ if ( on_attrib & OBJ_MODIFIED_BIT ) {
+ WriteScriptLine( fptr, TEXT(" /MODIFIED") );
+ }
+
+ if ( off_attrib & OBJ_HIDDEN_BIT ) {
+ WriteScriptLine( fptr, TEXT(" /-HIDDEN") );
+ }
+
+ if ( ( off_attrib & OBJ_SYSTEM_BIT ) &&
+ ( off_attrib & OBJ_READONLY_BIT ) ) {
+ WriteScriptLine( fptr, TEXT(" /-SPECIAL") );
+ }
+
+ WriteDate( fptr, cur_fse );
+
+ WriteScriptLine( fptr, TEXT("\n") );
+ }
+
+ cur_fse = BSD_GetNextFSE( cur_fse );
+ }
+
+ return( SUCCESS );
+}
+
+
+/**/
+/**
+
+ write flags to file
+
+**/
+static UINT16 WriteFlags( FILE *fptr, BE_CFG_PTR cfg )
+{
+ /* if append flag is set, then write out Append parameter */
+ if ( CDS_GetAppendFlag( CDS_GetCopy() ) ) {
+ WriteScriptLine( fptr, TEXT(" /APPEND") );
+ }
+ if ( !BEC_GetSetArchiveFlag( cfg ) ) {
+ WriteScriptLine( fptr, TEXT(" /-ARCHIVE") );
+ }
+ if ( !BEC_GetHiddenFlag( cfg ) ) {
+ WriteScriptLine( fptr, TEXT(" /-HIDDEN") );
+ }
+ if ( !BEC_GetSpecialFlag( cfg ) ) {
+ WriteScriptLine( fptr, TEXT(" /-SPECIAL") );
+ }
+ WriteScriptLine( fptr, TEXT("\n") );
+ return TRUE;
+}
+
+/**/
+/**
+
+ This routine writes a date to the script file
+
+**/
+static VOID WriteDate( FILE *fptr, FSE_PTR fse )
+{
+ DATE_TIME_PTR before_date;
+ DATE_TIME_PTR after_date;
+ DATE_TIME_PTR access_date;
+ INT16 days_back;
+
+ FSE_GetModDate ( fse, &before_date, &after_date );
+ FSE_GetAccDate ( fse, &access_date );
+
+ if ( (before_date && before_date->date_valid) ||
+ (after_date && after_date->date_valid) ) {
+
+ WriteScriptLine( fptr, TEXT(" /DATE:") );
+
+ if ( after_date && after_date->date_valid ) {
+
+ WriteScriptLine( fptr, TEXT("%d/%02d/%4d"), after_date->month, after_date->day,
+ after_date->year );
+
+ }
+ if ( before_date && before_date->date_valid ) {
+
+ WriteScriptLine( fptr, TEXT(":%d/%02d/%4d"), before_date->month, before_date->day,
+ before_date->year );
+
+ }
+ }
+
+ if ( access_date && access_date->date_valid ) {
+ access_date->year -= 1900;
+ DU_CalcNumberDaysBackwd( access_date, &days_back );
+ access_date->year += 1900;
+ WriteScriptLine( fptr, TEXT(" /ADATE:%d"), days_back );
+ }
+}
+
+
+static VOID WriteScriptLine( FILE *fptr, CHAR_PTR fmt, ... )
+{
+ va_list arg_ptr;
+
+ va_start( arg_ptr, fmt );
+
+ if ( vfprintf( fptr, fmt, arg_ptr ) < 0 ) {
+ mw_write_err = TRUE;
+ }
+
+ va_end( arg_ptr );
+
+ return;
+}
+
+
diff --git a/private/utils/ntbackup/src/xattach.c b/private/utils/ntbackup/src/xattach.c
new file mode 100644
index 000000000..05e822410
--- /dev/null
+++ b/private/utils/ntbackup/src/xattach.c
@@ -0,0 +1,560 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xattach.c
+
+ Description: This file contains code to attach and detattach to
+ a given EMS disk device. At Detach time, the server will be
+ 'kicked' if tye cfg specifies that it should. When the server
+ is 'kicked', we will violate layer boundaries and call the UI
+ directly. This is dirty but easy. The Exchange folks want
+ a "% complete" dialog for the kicking..
+
+
+ $Log: M:/LOGFILES/XATTACH.C_V $
+
+**/
+#include <windows.h>
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "jet.h"
+#include "jetbcli.h"
+#include "edbmsg.h"
+
+#include "stdtypes.h"
+#include "ems_jet.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "msassert.h"
+
+static INT16 EMS_StartOpenedService( SC_HANDLE serv_hand ) ;
+
+VOID XchgKickPct(
+ VOID_PTR pVoid,
+ GENERIC_DLE_PTR dle,
+ EC (* pfnPct)( PVOID, INT *, INT * ),
+ INT *status );
+
+INT EMS_RestorePercentComplete( PVOID a, INT *b, INT *c ) ;
+
+
+typedef struct KICK_PARMS {
+ FSYS_HAND fsh;
+ INT SetSize ;
+ INT SoFar ;
+ JET_RSTMAP jet_map[3] ;
+ EMS_FSYS_RESERVED_PTR res ;
+ VOID_PTR context ;
+ INT status ;
+} KICK_THREAD_PARMS, *KICK_THREAD_PARMS_PTR ;
+
+INT EMS_ThreadKickServer( KICK_THREAD_PARMS_PTR thread_parms_ptr ) ;
+
+
+
+/**/
+/**
+
+ Name: EMS_AttachToDLE()
+
+ Description: This function simply expands the OS specific
+ information in the DLE. At attach time we get all the
+ relevent paths that are saveed in the registry. These
+ paths are backed up as the first data stream. At restore
+ time these paths are used to determine how to match source
+ streams with destination paths.
+
+
+ Modified: 1/10/1992 10:45:57
+
+ Returns: Error Codes:
+ INSUFFICIENT_MEMORY
+ SUCCESS
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 EMS_AttachToDLE( fsh, dle, u_name, pswd )
+FSYS_HAND fsh ; /* I - File system handle */
+GENERIC_DLE_PTR dle; /*I/O- drive to attach to. list element expanded */
+CHAR_PTR u_name; /* I - user name NOT USED */
+CHAR_PTR pswd ; /* I - passowrd NOT USED */
+{
+ u_name ;
+ pswd ;
+ dle ;
+
+ msassert( dle != NULL );
+
+ /* Reserved field used for GetNext mode flag */
+ fsh->reserved.ptr = calloc( 1, sizeof( EMS_FSYS_RESERVED ) ) ;
+
+ BEC_SetSkipOpenFiles( fsh->cfg, BEC_SKIP_OPEN_FILES ) ;
+
+ if (BEC_GetModifiedOnlyFlag( fsh->cfg ) ) {
+ PVOID context ;
+ INT status ;
+ CHAR_PTR db_name ;
+
+ if ( dle->info.xserv->type == EMS_MDB ) {
+ db_name = TEXT("Exchange MDB Database") ;
+ } else{
+ db_name = TEXT("Exchange DS Database") ;
+ }
+
+ status = EMS_BackupPrepare( dle->parent->device_name,
+ db_name,
+ JET_bitBackupIncremental,
+ BACKUP_TYPE_LOGS_ONLY,
+ &context ) ;
+
+
+ if ( (status == hrInvalidParameter ) ||
+ (status == hrIncrementalBackupDisabled ) ||
+ (status == hrLogFileNotFound ) ) {
+ return FS_EMS_NO_LOG_BKUP ;
+ } else if ( status == hrCircularLogging ) {
+ return FS_EMS_CIRC_LOG;
+ } else if (!status) {
+ EMS_BackupEnd( context ) ;
+ }
+
+ }
+
+ if ( fsh->reserved.ptr != NULL ) {
+
+ if ( FS_SavePath( fsh, (BYTE_PTR)TEXT("\\"), 2 * sizeof( CHAR ) ) == SUCCESS ) {
+
+ fsh->file_hand = calloc( 1, sizeof( FILE_HAND_STRUCT ) + sizeof( EMS_OBJ_HAND ) ) ;
+ if ( fsh->file_hand != NULL ) {
+ fsh->file_hand->obj_hand.ptr = (VOID_PTR)(fsh->file_hand + 1) ;
+
+ return SUCCESS ;
+ }
+ }
+ }
+
+ return OUT_OF_MEMORY ;
+
+}
+
+/**/
+/**
+
+ Name: EMS_DetachDLE()
+
+ Description: This function detaches form the specified DLE.
+ Since MinDDB is not supported by this file system, we donn't have
+ to release PUSHED DDBs. Also we need to free any allocated path
+ buffers and open file scans.
+
+ At detach time on a restore, we will "kick" the attached server.
+ This is a 3+ hour process. During this time the server is fixing up
+ it's internal databse structures, and re-running the transaction
+ logs. We violate the layer boundary here so we can display a progress
+ dialog. This is the easist and cheepest way to do this...
+
+ Modified: 1/10/1992 11:16:11
+
+ Returns: SUCCESS
+
+**/
+INT16 EMS_DetachDLE( fsh )
+FSYS_HAND fsh ;
+{
+ DBLK_PTR dummy_dblk ;
+ EMS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+
+ /* Release any pushed min DDBs */
+ // Push & Pop Min not implemented because Ntbackup suppot only.
+
+ /* Release any allocated path buffers */
+
+ FS_FreeOSPathOrNameQueueInHand( fsh ) ;
+
+
+ /* free the allocated file handle */
+ free( fsh->file_hand );
+
+ free( res->service_restart_list ) ;
+
+ free( fsh->reserved.ptr );
+
+ return SUCCESS ;
+}
+
+INT32 EMS_EndOperationOnDLE( FSYS_HAND fsh )
+{
+ EMS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+ INT x;
+ CHAR_PTR db_name ;
+ INT status = 0;
+ KICK_THREAD_PARMS kick ;
+ HANDLE hThread ;
+ LPENUM_SERVICE_STATUS enum_list = res->service_restart_list ;
+ CHAR machine[256];
+ SC_HANDLE mach_hand ;
+ SC_HANDLE serv_hand ;
+ SERVICE_STATUS serv_status ;
+ INT i ;
+
+ kick.res = res ;
+ kick.context = NULL ;
+ kick.status = SUCCESS ;
+
+ if ( BEC_GetEmsRipKick( fsh->cfg ) ) {
+ CHAR_PTR sub_key_name ;
+
+ if ( fsh->attached_dle->info.xserv->type == EMS_MDB ) {
+ sub_key_name = REG_SUBKEY_MDB_RIP ;
+ } else {
+ sub_key_name = REG_SUBKEY_DSA_RIP ;
+ }
+
+ strcpy( machine, TEXT("\\\\") ) ;
+ strcat( machine, fsh->attached_dle->parent->device_name ) ;
+
+ mach_hand = OpenSCManager( machine, NULL, SC_MANAGER_ALL_ACCESS ) ;
+ if ( mach_hand == NULL ) {
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ if ( fsh->attached_dle->info.xserv->type == EMS_MDB ) {
+ serv_hand = OpenService( mach_hand, SERVICE_MESSAGE_DB,
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ } else {
+ serv_hand = OpenService( mach_hand, SERVICE_DIRECTORY,
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ }
+
+ if ( serv_hand == NULL ) {
+ CloseServiceHandle( mach_hand ) ;
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ if ( EMS_StartOpenedService( serv_hand ) != SUCCESS ) {
+ CloseServiceHandle( mach_hand ) ;
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ for (i = res->service_restart_list_size-1; i >=0; i-- ) {
+
+ serv_hand = OpenService( mach_hand, enum_list[i].lpServiceName,
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ if ( serv_hand == NULL ) {
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ if ( EMS_StartOpenedService( serv_hand ) != SUCCESS ) {
+ CloseServiceHandle( mach_hand ) ;
+
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ }
+ }
+
+ return kick.status ;
+
+}
+
+
+INT EMS_RestorePercentComplete( PVOID kick, INT *SetSize, INT *SoFar )
+{
+ static INT temp_size= 100;
+ static INT temp_sofar = 0;
+ KICK_THREAD_PARMS_PTR parms = kick;
+
+ if ( parms->context) {
+
+ if (temp_sofar > 100 ) {
+ temp_sofar = 0 ;
+ }
+
+ *SetSize= temp_size ;
+ *SoFar = temp_sofar ++ ;
+ } else {
+ *SetSize = parms->SetSize ;
+ *SoFar = parms->SoFar ;
+ }
+ return SUCCESS ;
+}
+
+INT16 EMS_StartOpenedService( SC_HANDLE serv_hand )
+{
+ SERVICE_STATUS serv_status ;
+ INT k ;
+
+
+ if ( !StartService( serv_hand, 0, NULL ) ) {
+ CloseServiceHandle( serv_hand ) ;
+ return FS_ACCESS_DENIED ;
+ }
+
+ for ( k = 0; k < 180; k++ ) {
+
+ if ( QueryServiceStatus( serv_hand, &serv_status ) &&
+ (serv_status.dwCurrentState != SERVICE_START_PENDING ) ) {
+
+ break ;
+ }
+ ThreadSwitch() ;
+ Sleep( 1000 ) ;
+ }
+
+ CloseServiceHandle( serv_hand ) ;
+
+ return SUCCESS ;
+
+}
+
+INT EMS_ThreadKickServer( KICK_THREAD_PARMS_PTR parms )
+{
+ INT stat ;
+ INT status = SUCCESS ;
+ FSYS_HAND fsh = parms->fsh ;
+ PVOID context = parms->context;
+ EMS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+
+
+ // The backup log path is useless as maintained.
+ // In our case, the BackupLogPath and LogPath are the same
+ // go figure....
+
+// status = EMS_Restore(
+// parms->context,
+// parms->res->CheckpointFilePath,
+// parms->res->LogPath,
+// parms->jet_map,
+// parms->res->map_size,
+// parms->res->LogPath,
+// parms->res->low_log,
+// parms->res->high_log
+// );
+//
+//
+// parms->context = NULL ;
+ stat = EMS_RestoreEnd( context ) ;
+
+ parms->SetSize = 3 + res->service_restart_list_size *2;
+ parms->SoFar = 0 ;
+
+ /* lsts restart the services */
+ if ( !status ) {
+ LPENUM_SERVICE_STATUS enum_list = res->service_restart_list ;
+ CHAR machine[256];
+ SC_HANDLE mach_hand ;
+ SC_HANDLE serv_hand ;
+ SERVICE_STATUS serv_status ;
+ INT i ;
+
+ status = stat ;
+
+ strcpy( machine, TEXT("\\\\") ) ;
+ strcat( machine, fsh->attached_dle->parent->device_name ) ;
+
+ mach_hand = OpenSCManager( machine, NULL, SC_MANAGER_ALL_ACCESS ) ;
+ if ( mach_hand == NULL ) {
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ parms->SoFar++;
+
+ if ( fsh->attached_dle->info.xserv->type == EMS_MDB ) {
+ serv_hand = OpenService( mach_hand, SERVICE_MESSAGE_DB,
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ } else {
+ serv_hand = OpenService( mach_hand, SERVICE_DIRECTORY,
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ }
+
+ if ( serv_hand == NULL ) {
+ CloseServiceHandle( mach_hand ) ;
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ parms->SoFar++ ;
+
+ if ( EMS_StartOpenedService( serv_hand ) != SUCCESS ) {
+ CloseServiceHandle( mach_hand ) ;
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ parms->SoFar++ ;
+
+ for (i = res->service_restart_list_size-1; i >=0; i-- ) {
+
+ serv_hand = OpenService( mach_hand, enum_list[i].lpServiceName,
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+ if ( serv_hand == NULL ) {
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+
+ parms->SoFar++ ;
+ if ( EMS_StartOpenedService( serv_hand ) != SUCCESS ) {
+ CloseServiceHandle( mach_hand ) ;
+
+ status = FS_ACCESS_DENIED ;
+ return SUCCESS ;
+ }
+ parms->SoFar++ ;
+ }
+ }
+
+ parms->status = status ;
+
+ return 0 ;
+}
+
+
+
+/**/
+/**
+
+ Name: EMS_GetValFromReg()
+
+ Description: This is a really cool helper function that will return
+ the value for a given key and value name on a specific machine.
+ if any of the internal calls fail this function will return the
+ win32 error.
+
+**/
+
+INT EMS_GetValFromReg(
+CHAR_PTR machine,
+CHAR_PTR key_name,
+CHAR_PTR value_name,
+CHAR_PTR buffer,
+INT buf_size )
+{
+ HKEY key_machine;
+ HKEY requested_key;
+ INT status ;
+ CHAR machine_name[256] ;
+
+ // first lsts try to connect to the machine...
+
+ if ( machine ) {
+ strcpy( machine_name, TEXT("\\\\") );
+ strcat( machine_name, machine ) ;
+
+ status = RegConnectRegistry( machine_name,
+ HKEY_LOCAL_MACHINE,
+ &key_machine ) ;
+ } else {
+
+ status = RegConnectRegistry( machine,
+ HKEY_LOCAL_MACHINE,
+ &key_machine ) ;
+ }
+
+ if ( !status ) {
+ /* now lets open the specific Key.... */
+ status = RegOpenKeyEx( key_machine,
+ key_name,
+ 0,
+ KEY_QUERY_VALUE,
+ &requested_key );
+
+ if ( !status ) {
+ // finally lets try to read the value
+
+ status = RegQueryValueEx( requested_key,
+ value_name,
+ NULL,
+ NULL,
+ (LPBYTE)buffer,
+ &buf_size );
+
+ RegCloseKey( requested_key ) ;
+ }
+
+ RegCloseKey( key_machine ) ;
+ }
+
+ return status ;
+}
+
+/**/
+/**
+
+ Name: EMS_SetValFromReg()
+
+ Description: This is a really cool helper function that will set
+ the value for a given key and value name on a specific machine.
+ if any of the internal calls fail this function will return the
+ win32 error.
+
+**/
+
+INT EMS_SetValFromReg(
+CHAR_PTR machine,
+CHAR_PTR key_name,
+CHAR_PTR value_name,
+CHAR_PTR buffer)
+{
+ HKEY key_machine;
+ HKEY requested_key;
+ INT status ;
+ CHAR machine_name[256] ;
+
+ // First lets try to connect to the machine.
+ if ( machine ) {
+ strcpy( machine_name, TEXT("\\\\") );
+ strcat( machine_name, machine ) ;
+
+ status = RegConnectRegistry( machine_name,
+ HKEY_LOCAL_MACHINE,
+ &key_machine ) ;
+ } else {
+
+ status = RegConnectRegistry( machine,
+ HKEY_LOCAL_MACHINE,
+ &key_machine ) ;
+ }
+
+ if ( !status ) {
+ /* now lets open the specific key.... */
+ status = RegOpenKeyEx( key_machine,
+ key_name,
+ 0,
+ KEY_QUERY_VALUE,
+ &requested_key );
+
+ if ( !status ) {
+ // finaly lets set the value
+ status = RegSetValueEx( requested_key,
+ value_name,
+ 0,
+ REG_SZ,
+ (LPBYTE)buffer,
+ strsize(buffer) );
+
+ RegCloseKey( requested_key ) ;
+ }
+
+ RegCloseKey( key_machine ) ;
+ }
+
+ return status ;
+}
+
+
+
diff --git a/private/utils/ntbackup/src/xchgdir.c b/private/utils/ntbackup/src/xchgdir.c
new file mode 100644
index 000000000..2e3d71e38
--- /dev/null
+++ b/private/utils/ntbackup/src/xchgdir.c
@@ -0,0 +1,106 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xchgdir.c
+
+ Description: Since EMS is a single object, we don't have a need to
+ change directories or any of that goo. The Object we backup is
+ a DDB. This ddb has a name that is not the root. This can be
+ rather flakey to the UI, but once again it is cheep and simple
+
+ $Log: M:/LOGFILES/XCHGDIR.C_V $
+
+
+**/
+/* begin include list */
+#include <windows.h>
+#include <malloc.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "msassert.h"
+/* $end$ include list */
+/**/
+/**
+
+ Name: EMS_ChangeDir()
+
+ Description: This function changes directories into the directory
+ pointed to by path.
+
+ Modified: 1/10/1992 12:45:35
+
+ Returns: Error codes:
+ SUCCESS
+ OUT_OF_MEMORY
+
+ Notes:
+
+**/
+INT16 EMS_ChangeDir(
+FSYS_HAND fsh, /* I - file system to changing directories on */
+CHAR_PTR path, /* I - describes the path of the new directory */
+INT16 psize ) /* I - specifies the length of the path */
+{
+ (void)fsh;
+ (void)path;
+ (void)psize;
+ return( SUCCESS ) ;
+}
+/**/
+/**
+
+ Name: EMS_UpDir()
+
+ Description: This function removes the last directory name from the
+ current directory path field of the "fsh"
+
+
+ Modified: 1/10/1992 12:47:23
+
+ Returns: Error codes:
+ FS_AT_ROOT
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 EMS_UpDir( fsh )
+FSYS_HAND fsh ; /* I - file system to change directories in */
+{
+ (void)fsh ;
+ return( SUCCESS ) ;
+}
+
+/**/
+/**
+
+ Name: EMS_ChangeIntoDDB()
+
+ Description: This function changes into the directory specified in the
+ DBLK
+
+ Modified: 1/10/1992 12:48:54
+
+ Returns: OUT_OF_MEMORY
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 EMS_ChangeIntoDDB( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* I - contains directory path to change into */
+{
+ (void)fsh;
+ (void)dblk;
+
+
+ return SUCCESS ;
+}
diff --git a/private/utils/ntbackup/src/xclose.c b/private/utils/ntbackup/src/xclose.c
new file mode 100644
index 000000000..460f9078e
--- /dev/null
+++ b/private/utils/ntbackup/src/xclose.c
@@ -0,0 +1,153 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xclose.c
+
+ Description: This file closes an opened object.
+
+
+ $Log: N:\logfiles\xclose.c_v $
+
+
+**/
+#include <stdio.h>
+#include <windows.h>
+#include <string.h>
+#include <malloc.h>
+
+
+#include "jet.h"
+#include "jetbcli.h"
+#include "ems_jet.h"
+#include "edbmsg.h"
+
+#include "stdtypes.h"
+#include "stdio.h"
+#include "std_err.h"
+#include "beconfig.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+
+
+/**/
+
+/**
+
+ Name: EMS_CloseObj()
+
+ Description: This funciton closes an object. If the object was opened
+ for an incremental or full backup we need to truncate the transaction
+ logs.
+
+ Modified: 2/7/1992 10:55:12
+
+ Returns: Error Codes:
+ FS_OBJECT_NOT_OPENED
+ SUCCESS
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 EMS_CloseObj( hand )
+FILE_HAND hand ; /* I - handle of object to close */
+{
+ INT16 ret_val = SUCCESS;
+ FSYS_HAND fsh = hand->fsh ;
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR)hand->dblk ;
+
+ switch (hand->fsh->attached_dle->info.xserv->type) {
+
+ case EMS_MDB:
+ case EMS_DSA:
+
+ if ( hand->mode == FS_READ) {
+ if ( BEC_GetSetArchiveFlag( hand->fsh->cfg ) &&
+ ddblk->backup_completed ) {
+
+ EMS_TruncateLogs( ems_hand->context ) ;
+ }
+
+ if ( ems_hand->context ) {
+ EMS_BackupEnd( ems_hand->context ) ;
+ }
+
+ } else if ( hand->mode == FS_WRITE ) {
+
+ EMS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+
+ if ( res->restore_context &&
+ ddblk->backup_completed ) {
+
+
+ if ( res->map_size != 0 ) {
+ EDB_RSTMAP rest_map[3] ;
+ int i ;
+ CHAR_PTR path;
+
+ path = res->jet_rstmap ;
+
+ for (i = 0; i < res->map_size; i ++ ) {
+ rest_map[i].wszDatabaseName = path ;
+
+ path += strlen(path) +1 ;
+ rest_map[i].wszNewDatabaseName = path ;
+
+ path += strlen(path) +1 ;
+ }
+
+ if (EMS_RestoreRegister( res->restore_context,
+ res->CheckpointFilePath,
+ res->LogPath,
+ rest_map,
+ res->map_size,
+ res->LogPath,
+ res->low_log,
+ res->high_log ) ) {
+ ret_val = FS_COMM_FAILURE ;
+ }
+ } else {
+ if (EMS_RestoreRegister( res->restore_context,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ res->LogPath,
+ res->low_log,
+ res->high_log ) ) {
+ ret_val = FS_COMM_FAILURE ;
+ }
+ }
+
+ EMS_RestoreComplete( res->restore_context, hrNone ) ;
+
+ }
+
+ if ( res->restore_context ) {
+
+ EMS_RestoreEnd( res->restore_context ) ;
+ }
+
+ CloseHandle( ems_hand->fhand ) ;
+
+ }
+
+ break ;
+
+ case EMS_BRICK:
+ default:
+ ret_val = FS_OBJECT_NOT_OPENED;
+ }
+
+
+ return ret_val ;
+}
+
+
diff --git a/private/utils/ntbackup/src/xcreate.c b/private/utils/ntbackup/src/xcreate.c
new file mode 100644
index 000000000..630282d19
--- /dev/null
+++ b/private/utils/ntbackup/src/xcreate.c
@@ -0,0 +1,310 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xcreate.c
+
+ Description: Since Exchange does have files or directories and since the data
+ necessary to actually do anyting is in the first stream, all we can do here
+ is try to stop the service that is running at the server.
+
+
+ $Log: N:\logfiles\xcreate.c_v $
+
+**/
+#include <windows.h>
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <lm.h>
+
+#include <wtypes.h>
+
+#include "jet.h"
+#include "jetbcli.h"
+#include "ems_jet.h"
+#include "edbmsg.h"
+
+#include "stdtypes.h"
+#include "omevent.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "dle_str.h"
+#include "msassert.h"
+
+static INT16 EMS_ServiceShutdown( FSYS_HAND fsh, SC_HANDLE mach_hand, CHAR_PTR service_name ) ;
+
+/**/
+/**
+
+ Name: EMS_CreateObj()
+
+ Description: This function will simply stop the IS or DS service. If the System
+ Attendant is not running then the restore can not be performed and we will
+ return an approprate error.
+
+
+ Modified: 2/10/1992 15:49:17
+
+ Returns: Error Codes:
+ OUT_OF_MEMORY
+ FS_ACCESS_DENIED
+ FS_OUT_OF_SPACE
+ FS_BAD_DBLK
+ SUCCESS
+
+ Notes: This function will return FS_BAD_DBLK if an IDB is
+ passed in as the object.
+
+**/
+INT16 EMS_CreateObj( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system to create object on */
+DBLK_PTR dblk ; /* I - Describes object to create */
+{
+ GENERIC_DLE_PTR dle = fsh->attached_dle;
+ INT16 ret_val = SUCCESS ;
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR)dblk;
+ EMS_FSYS_RESERVED_PTR resPtr = fsh->reserved.ptr;
+ BYTE_PTR dummy = NULL;
+ CHAR machine[256];
+ SC_HANDLE mach_hand ;
+ SC_HANDLE serv_hand ;
+ SERVICE_STATUS serv_status ;
+ INT i ;
+ INT status;
+ CHAR_PTR db_name;
+
+ msassert( dblk != NULL );
+ msassert( dle != NULL ) ;
+
+ resPtr->restore_context = NULL ;
+
+ if ( resPtr->attach_failed ) {
+ return FS_COMM_FAILURE ;
+ }
+
+ if ( dle->info.xserv->type == EMS_MDB ) {
+ db_name = TEXT("Exchange MDB Database") ;
+ } else{
+ db_name = TEXT("Exchange DS Database") ;
+ }
+
+ status = EMS_RestorePrepare( dle->parent->device_name,
+ db_name,
+ &resPtr->restore_context ) ;
+ if ( status ) {
+ return FS_COMM_FAILURE ;
+ }
+
+ strcpy( machine, TEXT("\\\\") ) ;
+ strcat( machine, dle->parent->device_name ) ;
+
+ // Make sure MAD (The system attendant) is running
+
+ mach_hand = OpenSCManager( machine, NULL, SC_MANAGER_ALL_ACCESS ) ;
+ if ( mach_hand == NULL ) {
+ if ( GetLastError() == ERROR_ACCESS_DENIED ) {
+ return FS_ACCESS_DENIED ;
+ } else {
+ return FS_COMM_FAILURE ;
+ }
+ }
+
+ serv_hand = OpenService( mach_hand, SERVICE_MAD, SERVICE_QUERY_STATUS ) ;
+ if ( serv_hand == NULL ) {
+ CloseServiceHandle( mach_hand ) ;
+ if ( GetLastError() == ERROR_ACCESS_DENIED ) {
+ return FS_ACCESS_DENIED ;
+ } else {
+ return FS_COMM_FAILURE ;
+ }
+ }
+
+ if ( !QueryServiceStatus( serv_hand, &serv_status ) ||
+ (serv_status.dwCurrentState!=SERVICE_RUNNING ) ) {
+
+ CloseServiceHandle( serv_hand ) ;
+ CloseServiceHandle( mach_hand ) ;
+ if ( GetLastError() == ERROR_ACCESS_DENIED ) {
+ return FS_ACCESS_DENIED ;
+ } else {
+ return FS_COMM_FAILURE ;
+ }
+ }
+
+ CloseServiceHandle( serv_hand ) ;
+
+ switch( dle->info.xserv->type ){
+
+ case EMS_MDB :
+
+ ret_val = EMS_ServiceShutdown( fsh, mach_hand, SERVICE_MESSAGE_DB ) ;
+ break ;
+
+ case EMS_DSA :
+ ret_val = EMS_ServiceShutdown( fsh, mach_hand, SERVICE_DIRECTORY ) ;
+
+ break ;
+
+ default :
+ ret_val = FS_INCOMPATIBLE_OBJECT ;
+ }
+
+
+ return ret_val;
+}
+
+INT16 EMS_ServiceShutdown( FSYS_HAND fsh, SC_HANDLE mach_hand, CHAR_PTR service_name )
+{
+ EMS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+ INT16 ret_val = SUCCESS ;
+ SC_HANDLE dep_serv_hand ;
+ SC_HANDLE serv_hand ;
+ BYTE_PTR buffer;
+ LPENUM_SERVICE_STATUS enum_list;
+ SERVICE_STATUS serv_status ;
+ INT size_needed ;
+ INT num_services ;
+ INT i ,k ;
+ INT status;
+
+ buffer = malloc( 4096 ) ;
+ if ( buffer == NULL ) {
+ return OUT_OF_MEMORY ;
+ }
+
+ serv_hand = OpenService( mach_hand, service_name,
+ SERVICE_STOP | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS ) ;
+ if ( serv_hand == NULL ) {
+
+ OMEVENT_LogEMSError ( TEXT("OpenService()"), GetLastError(), service_name ) ;
+
+ if ( GetLastError() == ERROR_ACCESS_DENIED ) {
+ return FS_ACCESS_DENIED ;
+ } else {
+ return FS_COMM_FAILURE ;
+ }
+ }
+
+ enum_list = (LPENUM_SERVICE_STATUS)buffer ;
+
+ if (EnumDependentServices( serv_hand,
+ SERVICE_ACTIVE,
+ enum_list,
+ 4096,
+ &size_needed,
+ &num_services ) ) {
+
+ res->service_restart_list = buffer;
+ res->service_restart_list_size = num_services;
+
+ /* first close all dependant services */
+ for ( i = 0 ; i < num_services; i ++ ) {
+
+ dep_serv_hand = OpenService( mach_hand, enum_list[i].lpServiceName,
+ SERVICE_STOP | SERVICE_QUERY_STATUS ) ;
+
+ if ( dep_serv_hand == NULL ) {
+ OMEVENT_LogEMSError ( TEXT("OpenService()"),
+ GetLastError(),
+ enum_list[i].lpServiceName ) ;
+ CloseServiceHandle( serv_hand ) ;
+
+ if ( GetLastError() == ERROR_ACCESS_DENIED ) {
+ return FS_ACCESS_DENIED ;
+ } else {
+ return FS_COMM_FAILURE ;
+ }
+ }
+
+
+ if ( !ControlService( dep_serv_hand, SERVICE_CONTROL_STOP, &serv_status ) ||
+ ((serv_status.dwCurrentState != SERVICE_STOPPED) &&
+ (serv_status.dwCurrentState != SERVICE_STOP_PENDING ) ) ) {
+
+
+ status = GetLastError() ;
+ if ( status != ERROR_SERVICE_NOT_ACTIVE ) {
+ OMEVENT_LogEMSError ( TEXT("ControlService(STOP)"),
+ status,
+ enum_list[i].lpServiceName ) ;
+
+ CloseServiceHandle( dep_serv_hand ) ;
+ CloseServiceHandle( serv_hand ) ;
+ if ( GetLastError() == ERROR_ACCESS_DENIED ) {
+ return FS_ACCESS_DENIED ;
+ } else {
+ return FS_COMM_FAILURE ;
+ }
+ }
+ }
+
+ for ( k = 0; k < 240; k++ ) {
+
+ if ( QueryServiceStatus( dep_serv_hand, &serv_status ) &&
+ (serv_status.dwCurrentState != SERVICE_STOP_PENDING ) ) {
+ break ;
+ }
+ ThreadSwitch() ;
+ Sleep( 1000 ) ;
+ }
+
+ CloseServiceHandle( dep_serv_hand ) ;
+ }
+
+ if ( !ControlService( serv_hand, SERVICE_CONTROL_STOP, &serv_status ) ||
+ ((serv_status.dwCurrentState != SERVICE_STOPPED) &&
+ (serv_status.dwCurrentState != SERVICE_STOP_PENDING ) ) ) {
+
+ status = GetLastError() ;
+ if ( ( status != ERROR_SERVICE_NOT_ACTIVE ) &&
+ (status != ERROR_SERVICE_REQUEST_TIMEOUT ) ) {
+ OMEVENT_LogEMSError ( TEXT("ControlService(STOP)"),
+ status,
+ service_name ) ;
+
+ CloseServiceHandle( serv_hand ) ;
+ return FS_COMM_FAILURE ;
+ }
+ }
+
+ for ( k = 0; k < 240; k++ ) {
+
+ if ( QueryServiceStatus( serv_hand, &serv_status ) &&
+ (serv_status.dwCurrentState != SERVICE_STOP_PENDING ) ) {
+ break ;
+ }
+ ThreadSwitch() ;
+ Sleep( 1000 ) ;
+ }
+
+ CloseServiceHandle( serv_hand ) ;
+
+ if (serv_status.dwCurrentState == SERVICE_STOP_PENDING ) {
+ OMEVENT_LogEMSError ( TEXT("ControlService(STOP)"),
+ ERROR_SERVICE_REQUEST_TIMEOUT,
+ service_name ) ;
+ return FS_COMM_FAILURE ;
+ }
+
+
+ } else {
+ OMEVENT_LogEMSError ( TEXT("EnumDependentServices()"),
+ GetLastError(),
+ service_name ) ;
+
+ if ( GetLastError() == ERROR_ACCESS_DENIED ) {
+ return FS_ACCESS_DENIED ;
+ } else {
+ return FS_COMM_FAILURE ;
+ }
+ }
+
+ return SUCCESS ;
+}
+
+
diff --git a/private/utils/ntbackup/src/xgetinfo.c b/private/utils/ntbackup/src/xgetinfo.c
new file mode 100644
index 000000000..d5ebc06c0
--- /dev/null
+++ b/private/utils/ntbackup/src/xgetinfo.c
@@ -0,0 +1,51 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xgetinfo.c
+
+ Description: This file contains code to completely fills out a
+ minimalized DBLK.
+
+
+ $Log: M:/LOGFILES/XGETINFO.C_V $
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "stdmacro.h"
+
+#include "fsys.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "msassert.h"
+
+/**/
+/**
+
+ Name: EMS_GetObjInfo()
+
+ Description: This is a simple return. There is no exta info to get....
+
+ Modified: 7/26/1989
+
+ Returns: Error Codes:
+ SUCCESS
+
+ Notes: For FDBs this funciton will check the current
+ directory for the specified file.
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 EMS_GetObjInfo( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /*I/O- On entry it is minimal on exit Complete */
+{
+ return( SUCCESS ) ;
+}
diff --git a/private/utils/ntbackup/src/xgetnext.c b/private/utils/ntbackup/src/xgetnext.c
new file mode 100644
index 000000000..c732c5978
--- /dev/null
+++ b/private/utils/ntbackup/src/xgetnext.c
@@ -0,0 +1,86 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xgetnext.c
+
+ Description: This file contains code that does nothing but return...
+ Excahnge has only one object and it is returned by GetCurrent DDB...
+
+ $Log: M:/LOGFILES/XGETNEXT.C_V $
+
+**/
+/* begin include list */
+#include <windows.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+#include "queues.h"
+
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "tfldefs.h"
+
+
+/**/
+/**
+
+ Name: EMS_FindFirst()
+
+ Description: Returns FS_NO_MORE
+
+ Modified: 1/10/1992 15:24:39
+
+ Returns: Error codes:
+ FS_NO_MORE
+**/
+
+INT16 EMS_FindFirst(
+FSYS_HAND fsh, /* I - file system handle */
+DBLK_PTR dblk, /* O - pointer to place to put the dblk data */
+CHAR_PTR sname, /* I - search name */
+UINT16 obj_type) /* I - objects to search for (dirs, all, etc)*/
+{
+ return FS_NO_MORE ;
+}
+
+/**/
+/**
+
+ Name: EMS_FindNext()
+
+ Description: return FS_N_MORE
+
+**/
+INT16 EMS_FindNext( fsh, dblk )
+FSYS_HAND fsh; /* I - File system handle */
+DBLK_PTR dblk; /* O - Discriptor block */
+{
+ return FS_NO_MORE ;
+}
+
+
+
+/**/
+/**
+
+ Name: EMS_FindClose()
+
+ Description: Return Success
+
+**/
+INT16 EMS_FindClose( FSYS_HAND fsh,
+ DBLK_PTR dblk )
+{
+ (void)fsh;
+ (void)dblk;
+ return SUCCESS ;
+}
+
+
diff --git a/private/utils/ntbackup/src/xgetpath.c b/private/utils/ntbackup/src/xgetpath.c
new file mode 100644
index 000000000..85b48bef1
--- /dev/null
+++ b/private/utils/ntbackup/src/xgetpath.c
@@ -0,0 +1,189 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xgetpath.c
+
+ Description: This file contains code to get the current directory
+ path and the complete directory path from the file system handle.
+ For exchange (monolithic) backup the only block that exists is the
+ one MDB or DSA block. GetCurrendDDB retuns this block.
+
+
+ $Log: M:/LOGFILES/XGETPATH.C_V $
+
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "queues.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+/**/
+/**
+
+ Name: EMS_GetCurrentPath()
+
+ Description: This function sets a string to describes the current
+ path.
+
+ Modified: 1/10/1992 14:2:3
+
+ Returns: Error Codes :
+ FS_DLE_NOT_ATTACHED
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes: The delimiter between directories is '\0'
+
+**/
+INT16 EMS_GetCurrentPath( fsh, path, size )
+FSYS_HAND fsh ; /* I - file system to get current path from */
+CHAR_PTR path ; /* O - buffer to place this path */
+INT16 *size ; /*I/O- size of buffer on entry & on exit */
+{
+ GENERIC_DLE_PTR dle ;
+ CHAR_PTR p ;
+ INT16 ret_val ;
+ INT16 temp_size ;
+
+ dle = fsh->attached_dle ;
+
+ msassert( dle != NULL ) ;
+
+ temp_size = (INT16)strsize( fsh->cur_dir ) ; /* count the last '\0' */
+
+ if ( *size < temp_size ) {
+
+ ret_val = FS_BUFFER_TO_SMALL ;
+
+ }
+ else {
+
+ /* copy the whole cur_dir over and then...*/
+
+ strcpy( path, &(fsh->cur_dir[1]) ) ;
+
+ /* ...replace backslashes with nulls */
+
+ p = strchr( path, TEXT('\\') ) ;
+ while ( p != NULL ) {
+ *p = TEXT('\0');
+ p = strchr( p+1, TEXT('\\') ) ;
+ }
+
+ ret_val = SUCCESS ;
+ }
+
+ *size = temp_size ;
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: EMS_GetCurrentDDB()
+
+ Description: This function initializes the provided DDB with the
+ information for the current directory.
+
+
+ Modified: 1/10/1992 14:45:26
+
+ Returns: Error code:
+ FS_INVALID_DIR
+ SUCCESS
+ OUT_OF_MEMORY
+
+ Notes:
+
+**/
+INT16 EMS_GetCurrentDDB( fsh, dblk )
+FSYS_HAND fsh ; /* I - file system to get DDB from */
+DBLK_PTR dblk ; /* O - place to put the DDB data */
+{
+ GENERIC_DLE_PTR dle = fsh->attached_dle ;
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR)dblk ;
+ INT16 ret_val = SUCCESS ;
+
+ ddblk->ems_type = dle->info.xserv->type ;
+ ddblk->os_info_complete = TRUE ;
+ dblk->blk_type = DDB_ID ;
+
+ if ( dle->info.xserv->type == EMS_MDB ) {
+ dblk->com.os_id = FS_EMS_MDB_ID ;
+ dblk->com.os_ver = FS_EMS_MDB_VER ;
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)EMS_String( MDB_Monolithic ),
+ (INT16)strsize(EMS_String( MDB_Monolithic ) ) ) ;
+
+
+ } else if ( dle->info.xserv->type == EMS_DSA ) {
+ dblk->com.os_id = FS_EMS_DSA_ID ;
+ dblk->com.os_ver = FS_EMS_DSA_VER ;
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)EMS_String( DSA ),
+ (INT16)strsize(EMS_String( DSA ) ) ) ;
+
+
+ } else {
+ msassert( "We currently don't support bricked" == NULL ) ;
+ }
+
+ return( ret_val ) ;
+}
+
+
+/**/
+/**
+
+ Name: EMS_ReleaseBlk()
+
+ Description: This function releases any resources connected to a DBLK.
+ For this OS the only resource is the Path connected to the DDB
+
+ Modified: 5/18/1992 10:27:34
+
+ Returns: none
+
+**/
+VOID EMS_ReleaseBlk(
+FSYS_HAND fsh,
+DBLK_PTR dblk )
+{
+ EMS_DBLK_PTR ddblk ;
+
+ fsh ;
+
+ ddblk = (EMS_DBLK_PTR)dblk ;
+
+ FS_ReleaseOSPathOrNameInDBLK( fsh, dblk ) ;
+
+}
+
+INT16 EMS_DupBlk( FSYS_HAND fsh, DBLK_PTR db_org, DBLK_PTR db_dup )
+{
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR)db_org ;
+
+ *db_dup = *db_org ;
+
+ return( FS_SetupOSPathOrNameInDBLK( fsh,
+ db_dup,
+ (BYTE_PTR)db_org->com.os_name->name,
+ db_org->com.os_name->name_size ) );
+
+
+
+}
+
diff --git a/private/utils/ntbackup/src/xinitfs.c b/private/utils/ntbackup/src/xinitfs.c
new file mode 100644
index 000000000..eed7e68f5
--- /dev/null
+++ b/private/utils/ntbackup/src/xinitfs.c
@@ -0,0 +1,1192 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tinitfs.c
+
+ Description: This file contains code to add EMS dles to the
+ drive list.
+
+ $Log: N:/LOGFILES/TINITFS.C_V $
+
+
+**/
+#include <windows.h>
+#include <winioctl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "sadapi.h"
+#include "jet.h"
+#include "jetbcli.h"
+#include "edbmsg.h"
+
+#include "stdtypes.h"
+#include "ems_jet.h"
+#include "omevent.h"
+
+#include "std_err.h"
+#include "stdwcs.h"
+
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "gen_fs.h"
+
+extern CHAR gszDleDsName[];
+extern CHAR gszDleIsName[];
+
+static EC (FAR PASCAL *ems_BackupPrepare) (LPSTR, LPSTR, unsigned long, INT , HBC *) = 0;
+static EC (FAR PASCAL *ems_BackupGetAttachmentInfo)( PVOID a, CHAR **b, LPDWORD c ) = 0;
+static EC (FAR PASCAL *ems_BackupRead)(PVOID, PVOID, DWORD, PDWORD ) = 0;
+static EC (FAR PASCAL *ems_BackupClose)(PVOID ) = 0;
+static EC (FAR PASCAL *ems_BackupOpen)(PVOID, LPSTR, DWORD, LARGE_INTEGER *) = 0;
+static EC (FAR PASCAL *ems_GetBackupLogs)( PVOID, LPSTR *, LPDWORD ) = 0;
+static EC (FAR PASCAL *ems_TruncateLogs)(PVOID ) = 0 ;
+static EC (FAR PASCAL *ems_BackupEnd)(PVOID ) = 0;
+static EC (FAR PASCAL *ems_BackupFree)(PVOID) ;
+static EC (FAR PASCAL *ems_RestorePrepare)( PVOID, PVOID, PVOID * ) ;
+static EC (FAR PASCAL *ems_RestoreRegister)( PVOID, PVOID, PVOID, PVOID, INT, PVOID, INT, INT ) ;
+static EC (FAR PASCAL *ems_RestoreLocations)( PVOID, PVOID, INT *);
+static EC (FAR PASCAL *ems_RestoreEnd)(PVOID) ;
+static EC (FAR PASCAL *ems_RestoreComplete)(PVOID, ULONG) ;
+
+VOID EMS_StartSAD( CHAR_PTR server_name ) ;
+
+BOOL MAYN_GetUserName (
+ LPSTR *pUser,
+ LPDWORD pcbUser
+ );
+
+
+CHAR_PTR gszEmsStringList[] = {
+ TEXT("MDB Bricked"), //MDB_Bricked
+ gszDleIsName, //MDB_Monolithic
+ gszDleDsName, //DSA
+ TEXT("Mailboxes"), //Mailboxes
+ TEXT("Public Folders") //Public_Folders
+ };
+
+
+#define EMS_SERVER_LIST_STOP -1
+static CHAR_PTR EMS_EnumServerInList( INT *index ) ;
+static VOID EMS_ZeroServerListEntry( INT index ) ;
+static VOID AddEMS_DLE( DLE_HAND hand,
+ CHAR_PTR drive,
+ UINT32 type,
+ GENERIC_DLE_PTR *current_dle );
+
+
+typedef struct THREAD_PARMS {
+ DLE_HAND dle_hand;
+} THREAD_PARMS, *THREAD_PARMS_PTR ;
+
+DWORD EMS_ThreadFindDrives( THREAD_PARMS_PTR thread_parms_ptr ) ;
+
+// this function is for debug only
+static VOID GetServerListForEnterprise( CHAR_PTR server_name, BackupListNode *node_root ) ;
+
+
+/**/
+/**
+
+ Name: AddDLEsForEMS()
+
+ Description: This function starts a thread that creates a DLE for each exchange
+ server on the enterprises of interest..
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+ Declaration:
+**/
+INT16 EMS_FindDrives( DLE_HAND hand, BE_CFG_PTR cfg, UINT32 fsys_mask )
+{
+ HANDLE hThread ;
+ DWORD pthread_id ;
+ THREAD_PARMS thread_parms ;
+
+ (VOID)cfg ;
+ (VOID)fsys_mask ;
+
+ thread_parms.dle_hand = hand ;
+
+ hThread = CreateThread( NULL,
+ 0,
+ EMS_ThreadFindDrives,
+ &thread_parms,
+ 0,
+ &pthread_id ) ;
+
+ if ( hThread != NULL )
+ {
+ while ( WaitForSingleObject( hThread, 100 ) == WAIT_TIMEOUT )
+ {
+ ThreadSwitch( ) ;
+ }
+ CloseHandle( hThread ) ;
+ }
+ else
+ {
+ EMS_ThreadFindDrives( &thread_parms ) ;
+ }
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: EMS_ThreadFindDrives()
+
+ Description: This function actuall call the System attendant on the servers of
+ interest asking for a list of sites and servers on the exchagne. Form this
+ info, this function will create the DLE tree.
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+ Declaration:
+**/
+HINSTANCE JetApi = NULL ;
+
+DWORD EMS_ThreadFindDrives( THREAD_PARMS_PTR thread_parms_ptr )
+{
+ DLE_HAND hand = thread_parms_ptr->dle_hand ;
+ GENERIC_DLE_PTR pCurrentDLE ; // ptr to current DLE
+ INT index ;
+ CHAR_PTR server_name ;
+ INT status ;
+ CHAR machineName[256] ;
+
+ // With any luch, we will get a LIB to link with. When that happens we can
+ // get rid of the load library stuff
+
+ if ( !JetApi ) {
+ JetApi = LoadLibrary( TEXT("edbbcli.dll")) ;
+ }
+
+ if (JetApi ) {
+ ems_BackupPrepare = (VOID *)GetProcAddress( JetApi, "HrBackupPrepareW") ;
+ ems_BackupGetAttachmentInfo =
+ (VOID *)GetProcAddress( JetApi, "HrBackupGetDatabaseNamesW") ;
+ ems_BackupRead = (VOID *)GetProcAddress( JetApi, "HrBackupRead") ;
+ ems_BackupClose = (VOID *)GetProcAddress( JetApi, "HrBackupClose");
+ ems_BackupOpen = (VOID *)GetProcAddress( JetApi, "HrBackupOpenFileW") ;
+ ems_GetBackupLogs = (VOID *)GetProcAddress( JetApi, "HrBackupGetBackupLogsW");
+ ems_TruncateLogs = (VOID *)GetProcAddress( JetApi, "HrBackupTruncateLogs") ;
+ ems_BackupEnd = (VOID *)GetProcAddress( JetApi, "HrBackupEnd") ;
+ ems_BackupFree = (VOID *)GetProcAddress( JetApi, "BackupFree") ;
+ ems_RestorePrepare = (VOID *)GetProcAddress( JetApi, "HrRestorePrepareW") ;
+ ems_RestoreRegister = (VOID *)GetProcAddress( JetApi, "HrRestoreRegisterW") ;
+ ems_RestoreComplete = (VOID *)GetProcAddress( JetApi, "HrRestoreRegisterComplete") ;
+ ems_RestoreLocations = (VOID *)GetProcAddress( JetApi, "HrRestoreGetDatabaseLocationsW") ;
+ ems_RestoreEnd = (VOID *)GetProcAddress( JetApi, "HrRestoreEnd") ;
+ }
+
+ if ( !JetApi ||
+ !ems_BackupPrepare ||
+ !ems_BackupGetAttachmentInfo ||
+ !ems_BackupRead ||
+ !ems_BackupClose ||
+ !ems_BackupOpen ||
+ !ems_GetBackupLogs ||
+ !ems_TruncateLogs ||
+ !ems_BackupEnd ||
+ !ems_BackupFree ||
+ !ems_RestorePrepare ||
+ !ems_RestoreRegister ||
+ !ems_RestoreComplete ||
+ !ems_RestoreLocations ||
+ !ems_RestoreEnd )
+ {
+
+ return FAILURE ;
+ }
+
+
+ // lets add the current machine to the list of interesting servers.
+
+ memset( machineName, 0, sizeof(machineName) );
+
+ status = EMS_GetValFromReg(
+ NULL, // machine name
+ TEXT("SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName"),
+ TEXT("ComputerName"),
+ machineName,
+ sizeof(machineName));
+
+ EMS_AddToServerList( hand, machineName );
+
+
+ // Now lets ask each interesting server to provide a Enterprise tree.
+ index = EMS_SERVER_LIST_STOP ;
+
+ do {
+ BackupListNode *node_root, *Enterprise, *Site, *Server ;
+ GENERIC_DLE_PTR EnterpriseDLE = NULL ;
+ GENERIC_DLE_PTR SiteDLE = NULL ;
+ GENERIC_DLE_PTR ServerDLE = NULL ;
+ GENERIC_DLE_PTR temp_dle = NULL ;
+
+ server_name = EMS_EnumServerInList( &index ) ;
+
+ if ( server_name ) {
+
+ node_root = NULL ;
+
+ EMS_StartSAD( server_name ) ;
+
+ SAD_ScGetBackupListNodeW(server_name, &node_root);
+
+ if ( node_root == NULL ) {
+ /* if MAD servies is running then lets just add the server */
+ if (EMS_IsServiceRunning( server_name, SERVICE_MAD ) ) {
+
+ ServerDLE = NULL ;
+
+ AddEMS_DLE( hand,
+ server_name,
+ EMS_SERVER,
+ &ServerDLE );
+ } else {
+
+
+ EMS_ZeroServerListEntry( index ) ;
+ continue ;
+ }
+ }
+
+ Enterprise = node_root ;
+
+ while ( Enterprise ) {
+ BOOLEAN found = FALSE ;
+
+ EnterpriseDLE = NULL ;
+
+ // Lets verify that this DLE doesn't already exist
+
+ if ( SUCCESS == DLE_FindByName( hand, server_name, FS_EMS_DRV, &temp_dle ) ) {
+ if ( temp_dle->parent != NULL ) {
+
+ found = TRUE ;
+ EnterpriseDLE = temp_dle->parent->parent ;
+ } else {
+ EMS_RemoveDLE( temp_dle ) ;
+ }
+
+ }
+ if ( !found ) {
+
+ if ( SUCCESS == DLE_FindByName( hand,
+ Enterprise->szName,
+ FS_EMS_DRV,
+ &temp_dle ) )
+ {
+
+ DLE_GetFirstChild( temp_dle, &temp_dle ) ;
+ if( temp_dle ) {
+ DLE_GetFirstChild( temp_dle, &temp_dle ) ;
+ }
+ if ( temp_dle ) {
+ Site = Enterprise->pnodeChildren ;
+ while( Site ) {
+ Server = Site->pnodeChildren ;
+ while( Server ) {
+ if ( !stricmp( Server->szName, DLE_GetDeviceName( temp_dle ) ) ) {
+ EnterpriseDLE = temp_dle->parent->parent ;
+ }
+ Server = Server->pnodeNext ;
+ }
+ Site = Site->pnodeNext ;
+ }
+ }
+ }
+ }
+
+ if ( EnterpriseDLE == NULL ) {
+ AddEMS_DLE( hand,
+ Enterprise->szName,
+ EMS_ENTERPRISE,
+ &EnterpriseDLE );
+ }
+
+ Site = Enterprise->pnodeChildren ;
+
+ while ( EnterpriseDLE && Site ) {
+
+ DLE_GetFirstChild( EnterpriseDLE, &SiteDLE ) ;
+
+ while ( SiteDLE ) {
+ if ( !stricmp( Site->szName, DLE_GetDeviceName( SiteDLE ) ) ) {
+ break ;
+ }
+ DLE_GetNext( &SiteDLE ) ;
+ }
+
+ if ( !SiteDLE ) {
+ SiteDLE = EnterpriseDLE ;
+
+ AddEMS_DLE( hand,
+ Site->szName,
+ EMS_SITE,
+ &SiteDLE );
+ }
+
+ Server = Site->pnodeChildren ;
+
+ while (SiteDLE && Server) {
+
+ DLE_GetFirstChild( SiteDLE, &ServerDLE ) ;
+
+ while ( ServerDLE ) {
+ if ( !stricmp( Server->szName, DLE_GetDeviceName( ServerDLE ) ) ) {
+ break ;
+ }
+ DLE_GetNext( &ServerDLE ) ;
+ }
+
+ if ( !ServerDLE ) {
+
+ ServerDLE = SiteDLE ;
+
+ AddEMS_DLE( hand,
+ Server->szName,
+ EMS_SERVER,
+ &ServerDLE );
+ }
+
+ Server = Server->pnodeNext ;
+ }
+
+ Site = Site->pnodeNext ;
+ }
+
+ Enterprise = Enterprise->pnodeNext ;
+ }
+ }
+
+ } while ( index != EMS_SERVER_LIST_STOP ) ;
+
+
+ return SUCCESS ;
+}
+
+
+/**/
+/**
+
+ Name: AddDLEsForEMS()
+
+ Description: This function creates the DLE Exchange Enterprise/Site/Server/Store
+
+ For this function the pCurrentDLE must be the parent dle on entry and will be
+ set to the created DLE on exit. If an error occurs then pCurrentDLE is set
+ to NULL.
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+ Declaration:
+**/
+static VOID AddEMS_DLE(
+DLE_HAND hand, /* I - Handle to DLE list */
+CHAR_PTR name, /* I - drive letter for dle */
+UINT32 type,
+GENERIC_DLE_PTR *pCurrentDLE /* O - current dle */ )
+{
+ GENERIC_DLE_PTR dle ;
+ BYTE_PTR dummy ;
+ GENERIC_DLE_PTR temp_dle = NULL;
+ static LPSTR user_name = NULL ;
+ INT user_name_size ;
+
+ // OK now since this is a new one, lets create it.
+
+ switch( type ) {
+
+ case EMS_ENTERPRISE:
+ case EMS_SITE:
+
+ dle = calloc ( 1, sizeof( GENERIC_DLE ) +
+ sizeof( struct EMS_SERVER_DLE_INFO ) ) ;
+
+ if ( dle != NULL ) {
+
+ dle->device_name = malloc ( strsize( name ) ) ;
+
+ if ( dle->device_name == NULL ) {
+ free( dle ) ;
+ dle = NULL ;
+ } else {
+ dle->info.xserv = (EMS_SERVER_DLE_INFO_PTR)(dle + 1) ;
+ dle->info.xserv->type = type ;
+ strcpy( dle->device_name, name ) ;
+ dle->info.xserv->server_name = dle->device_name ;
+ }
+ }
+
+ if ( dle != NULL ) {
+
+ /* Since memory was allocated with calloc, it is already */
+ /* initialized to zero. Therefore initializations to zero */
+ /* are not necessary. */
+
+ InitQElem( &(dle->q) ) ;
+ dle->os_id = 0 ;
+ dle->handle = hand ;
+ dle->parent = *pCurrentDLE ;
+ dle->type = FS_EMS_DRV ;
+ dle->subtype = (UINT8)type ;
+
+ dle->path_delim = TEXT('\\') ;
+ /* dle->pswd_required = FALSE */
+ /* dle->pswd_saved = FALSE ; */
+ /* dle->attach_count = 0 ; */
+ /* dle->bsd_use_count = 0 ; */
+ /* dle->dynamic_info = FALSE ; */
+
+ dle->device_name_leng = strsize( dle->device_name ) ;
+
+ dle->dle_writeable = TRUE;
+ dle->feature_bits = DLE_FEAT_SUPPORTS_CHILDREN |
+ DLE_FEAT_REMOTE_DRIVE ;
+
+ }
+
+ if ( dle ) {
+ if ( *pCurrentDLE ) {
+ DLE_QueueInsert( (HEAD_DLE *)(&((*pCurrentDLE)->child_q)), dle ) ;
+ } else {
+ DLE_QueueInsert( hand, dle ) ;
+ }
+ }
+
+ break ;
+
+ case EMS_SERVER:
+
+// if ( NetServiceGetInfo( name, SERVICE_MESSAGE_DB, 0, &dummy ) ) {
+// // the necessary service is not running on the requsted machine
+// return ;
+// }
+
+ dle = calloc ( 1, sizeof( GENERIC_DLE ) +
+ sizeof( struct EMS_SERVER_DLE_INFO ) ) ;
+
+ if ( dle != NULL ) {
+
+ dle->device_name = malloc ( strsize( name ) ) ;
+
+ if ( dle->device_name == NULL ) {
+ free( dle ) ;
+ dle = NULL ;
+
+ } else {
+ dle->info.xserv = (EMS_SERVER_DLE_INFO_PTR)(dle + 1) ;
+ dle->info.xserv->type = type ;
+ strcpy( dle->device_name, name ) ;
+ dle->info.xserv->server_name = dle->device_name ;
+ }
+ }
+
+ if ( dle != NULL ) {
+
+ /* Since memory was allocated with calloc, it is already */
+ /* initialized to zero. Therefore initializations to zero */
+ /* are not necessary. */
+
+ InitQElem( &(dle->q) ) ;
+ dle->handle = hand ;
+ dle->parent = *pCurrentDLE ;
+ dle->type = FS_EMS_DRV ;
+ dle->subtype = (UINT8)type ;
+ dle->path_delim = TEXT('\\') ;
+ /* dle->pswd_required = FALSE */
+ /* dle->pswd_saved = FALSE ; */
+ /* dle->attach_count = 0 ; */
+ /* dle->bsd_use_count = 0 ; */
+ /* dle->dynamic_info = FALSE ; */
+
+ dle->device_name_leng = strsize( dle->device_name ) ; // 8/20/92 BBB
+ dle->dle_writeable = TRUE;
+ dle->feature_bits = DLE_FEAT_SUPPORTS_CHILDREN |
+ DLE_FEAT_REMOTE_DRIVE ;
+
+ }
+
+ if ( dle ) {
+
+ if ( *pCurrentDLE ) {
+ DLE_QueueInsert( (HEAD_DLE *)(&((*pCurrentDLE)->child_q)), dle ) ;
+ } else {
+ DLE_QueueInsert( hand, dle ) ;
+ }
+
+ temp_dle = dle ;
+ AddEMS_DLE( hand, EMS_String(MDB_Monolithic), EMS_MDB, &temp_dle ) ;
+ temp_dle = dle ;
+ AddEMS_DLE( hand, EMS_String(DSA), EMS_DSA, &temp_dle ) ;
+ }
+
+ break ;
+
+ case EMS_MDB:
+ case EMS_DSA:
+
+ user_name_size = 200 ;
+ if ( user_name || MAYN_GetUserName( (LPSTR*)&user_name, (LPDWORD)&user_name_size ) ) {
+ user_name_size = strsize( user_name ) ;
+
+ } else {
+ user_name_size = 0 ;
+ user_name = NULL ;
+ }
+
+ dle = calloc ( 1, sizeof( GENERIC_DLE ) +
+ sizeof( struct EMS_MDB_DSA_DLE_INFO ) ) ;
+
+ if ( dle != NULL ) {
+ INT name_size ;
+
+ name_size = strsize(name);
+ if ( *pCurrentDLE ) {
+ name_size += strsize( (*pCurrentDLE)->device_name ) ;
+ }
+
+ dle->device_name = malloc ( name_size ) ;
+
+ if ( dle->device_name == NULL ) {
+ free( dle ) ;
+ dle = NULL ;
+
+ } else {
+ dle->user_name = user_name ;
+ dle->user_name_leng = user_name_size ;
+
+ dle->info.xmono = (EMS_MDB_DSA_DLE_INFO_PTR)(dle + 1) ;
+ dle->info.xmono->type = type ;
+ dle->info.xmono->server_name = (*pCurrentDLE)->info.xserv->server_name ;
+
+ if ( *pCurrentDLE ) {
+ strcpy( dle->device_name, (*pCurrentDLE)->device_name ) ;
+ strcat( dle->device_name, TEXT("\\") ) ;
+ strcat( dle->device_name, name ) ;
+ } else {
+ strcpy( dle->device_name, name ) ;
+ }
+ }
+ }
+
+ if ( dle != NULL ) {
+
+ /* Since memory was allocated with calloc, it is already */
+ /* initialized to zero. Therefore initializations to zero */
+ /* are not necessary. */
+
+ InitQElem( &(dle->q) ) ;
+ if ( type == EMS_MDB ) {
+ dle->os_id = FS_EMS_MDB_ID ;
+ } else {
+ dle->os_id = FS_EMS_DSA_ID ;
+ }
+
+ dle->handle = hand ;
+ dle->parent = *pCurrentDLE ;
+ dle->type = FS_EMS_DRV ;
+ dle->subtype = (UINT8)type ;
+ dle->path_delim = TEXT(' ') ;
+ /* dle->pswd_required = FALSE */
+ /* dle->pswd_saved = FALSE ; */
+ /* dle->attach_count = 0 ; */
+ /* dle->bsd_use_count = 0 ; */
+ /* dle->dynamic_info = FALSE ; */
+
+ dle->feature_bits = DLE_FEAT_NON_DISPLAYABLE_CONT |
+ DLE_FEAT_REMOTE_DRIVE ;
+
+ dle->device_name_leng = strsize( dle->device_name ) ; // 8/20/92 BBB
+
+ dle->dle_writeable = TRUE;
+
+ }
+
+ if ( dle ) {
+ // for now if the machine is the current machine add to root
+
+ if ( !*pCurrentDLE ) {
+
+ DLE_QueueInsert( hand, dle ) ;
+ } else {
+
+ DLE_QueueInsert( (HEAD_DLE*)(&((*pCurrentDLE)->child_q)), dle ) ;
+ }
+ }
+
+ break ;
+
+ case EMS_BRICK:
+ break ;
+
+ default:
+ return ;
+ }
+
+
+ /* assign current dle */
+ *pCurrentDLE = dle ;
+
+}
+
+
+/**/
+/**
+
+ Name: EMS_RemoveDLE()
+
+ Description: This function removes the specified DLE ;
+
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+**/
+VOID EMS_RemoveDLE( GENERIC_DLE_PTR dle )
+{
+
+ free( dle->device_name ) ;
+ GEN_RemoveDLE( dle );
+}
+
+/**/
+/**
+
+ Name: EMS_AddToServerList() & EMS_EnumServerList()
+
+ Description: These funcitons will maintain the list of ems servers
+ Modified: 12/2/1991 16:29:59
+
+ Returns: none
+
+ Declaration:
+**/
+static CHAR_PTR *server_list = NULL ;
+static INT server_list_size = 0 ;
+static INT next_free_index = 0 ;
+
+#ifdef FS_EMS
+INT EMS_AddToServerList( DLE_HAND dle_list, CHAR_PTR server_name )
+{
+
+ INT i ;
+ GENERIC_DLE_PTR dle ;
+
+ if ( ( next_free_index == server_list_size ) ) {
+ server_list_size += 20;
+ server_list = realloc ( server_list, server_list_size * sizeof(CHAR_PTR) ) ;
+ }
+
+ if ( server_list == NULL ) {
+ server_list_size = 0 ;
+ next_free_index = 0 ;
+ }
+
+ if ( server_name ) {
+ server_list[ next_free_index ] = malloc( strsize( server_name ) ) ;
+ if ( server_list[ next_free_index ] ) {
+ strcpy( server_list[ next_free_index ], server_name ) ;
+ next_free_index ++ ;
+ } else {
+ return FAILURE ;
+ }
+ }
+
+ if ( next_free_index ) {
+ return SUCCESS ;
+ } else {
+ return FAILURE ;
+ }
+
+}
+#ifdef FS_EMS
+INT EMS_RemoveFromServerList( CHAR_PTR server_name )
+{
+
+ INT i;
+
+ for( i = next_free_index - 1; i >= 0; i-- ) {
+
+ if ( server_list[i] &&
+ !stricmp( server_name, server_list[i] ) ) {
+
+ EMS_ZeroServerListEntry( i );
+ break;
+ }
+ }
+
+ return SUCCESS;
+}
+#endif
+
+CHAR_PTR EMS_EnumSvrInList( INT *index )
+{
+ return EMS_EnumServerInList( index );
+}
+
+
+#endif
+CHAR_PTR EMS_EnumServerInList( INT *index )
+{
+ if ( *index == EMS_SERVER_LIST_STOP ) {
+ *index = 0 ;
+ } else {
+ *index += 1 ;
+ }
+
+ if ( *index >= next_free_index ) {
+ *index = EMS_SERVER_LIST_STOP ;
+ return NULL ;
+ } else {
+ return server_list[ *index ] ;
+ }
+}
+
+static VOID EMS_ZeroServerListEntry( INT index )
+{
+ if (index < next_free_index ) {
+ free( server_list[index] ) ;
+ server_list[index] = NULL ;
+ }
+}
+
+
+EC EMS_BackupPrepare(LPSTR a, LPSTR b, unsigned long c, INT d, HBC *e)
+{
+ EC status ;
+ status = (*ems_BackupPrepare)(a,b,c,d,e) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText ( TEXT("BackupPrepare()"), message, a ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText ( TEXT("BackupPrepare()"), message, a ) ;
+ LocalFree( message ) ;
+
+ } else {
+ OMEVENT_LogEMSError ( TEXT("BackupPrepare()"), status, a ) ;
+ }
+ }
+ return ( status ) ;
+}
+
+EC EMS_BackupGetAttachmentInfo( PVOID a, CHAR **b, LPDWORD c)
+{
+ EC status ;
+ status = (*ems_BackupGetAttachmentInfo)( a,b,c ) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupGetAttachmentInfo()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupGetAttachmentInfo()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("BackupGetAttachmentInfo()"), status, TEXT(" - ") ) ;
+ }
+ }
+ return ( status ) ;
+}
+
+EC EMS_BackupRead(PVOID a, PVOID b, DWORD c, PDWORD d)
+{
+ EC status ;
+ status = (*ems_BackupRead)(a,b,c,d) ;
+
+ return ( status ) ;
+}
+EC EMS_BackupClose(PVOID a )
+{
+ EC status = 0;
+
+ if ( a ) {
+ status = (*ems_BackupClose)(a) ;
+ }
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupClose()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupClose()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("BackupClose()"), status, TEXT(" - ") ) ;
+ }
+ }
+ return ( status ) ;
+}
+EC EMS_BackupOpen(PVOID a, LPSTR b, DWORD c, LARGE_INTEGER *d )
+{
+ EC status ;
+ status = (*ems_BackupOpen)(a,b,c,d) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupOpen()"), message, b ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupOpen()"), message, b ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("BackupOpen()"), status, b ) ;
+ }
+ }
+ return ( status ) ;
+}
+EC EMS_GetBackupLogs( PVOID a, LPSTR *b, LPDWORD c)
+{
+ EC status ;
+ status = (*ems_GetBackupLogs)( a,b,c ) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupLogs()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupLogs()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("BackupLogs()"), status, TEXT(" - ") ) ;
+ }
+ }
+ return ( status ) ;
+}
+EC EMS_TruncateLogs( PVOID a )
+{
+ EC status ;
+ status = (*ems_TruncateLogs)(a) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("TruncateLogs()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("TruncateLogs()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("TruncateLogs()"), status, TEXT(" - ") ) ;
+ }
+ }
+ return ( status ) ;
+}
+
+EC EMS_BackupEnd(PVOID a )
+{
+ EC status ;
+ status = (*ems_BackupEnd)(a) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupEnd()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("BackupEnd()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("BackupEnd()"), status, TEXT(" - ") ) ;
+ }
+ }
+ return ( status ) ;
+}
+
+VOID EMS_BackupFree(PVOID a)
+{
+ (*ems_BackupFree)(a) ;
+}
+
+EC EMS_RestoreEnd(PVOID a )
+{
+ EC status ;
+ status = (*ems_RestoreEnd)(a) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreEnd()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreEnd()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("RestoreEnd()"), status, TEXT(" - ") ) ;
+ }
+ }
+ return ( status ) ;
+}
+
+EC EMS_RestorePrepare( PVOID a, PVOID b, PVOID *c ) {
+ EC status ;
+ status = (*ems_RestorePrepare)(a,b,c);
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestorePrepare()"), message, a ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestorePrepare()"), message, a ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("RestorePrepare()"), status, a ) ;
+ }
+ }
+ return ( status ) ;
+}
+
+EC EMS_RestoreRegister( PVOID a, PVOID b, PVOID c, PVOID d, INT e, PVOID f, INT g, INT h ) {
+ EC status ;
+ status = (*ems_RestoreRegister)(a,b,c,d,e,f,g,h) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreRegister()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreRegister()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("RestoreRegister()"), status, TEXT(" - ") ) ;
+ }
+ }
+ return ( status ) ;
+}
+
+EC EMS_RestoreLocations( PVOID a, PVOID b, INT *c ) {
+ EC status ;
+
+ status =(*ems_RestoreLocations)(a,b,c) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreLocations()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreLocations()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("RestoreLocations()"), status, TEXT(" - ") ) ;
+ }
+ }
+
+ return ( status ) ;
+
+}
+
+EC EMS_RestoreComplete( PVOID a, INT b ) {
+ EC status ;
+
+ status =(*ems_RestoreComplete)(a,b) ;
+
+ if ( status ) {
+ CHAR_PTR message = NULL;
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ (HINSTANCE)JetApi, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreComplete()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, status, 0, (LPSTR)(&message), 0, NULL ) ) {
+
+ OMEVENT_LogEMSErrorText( TEXT("RestoreComplete()"), message, TEXT(" - ") ) ;
+ LocalFree( message ) ;
+ } else {
+ OMEVENT_LogEMSError ( TEXT("RestoreComplete()"), status, TEXT(" - ") ) ;
+ }
+ }
+
+ return ( status ) ;
+
+}
+
+void __RPC_FAR * __RPC_API midl_user_allocate(size_t cb)
+{
+ void * pv;
+
+ pv = GlobalAlloc(GMEM_FIXED, cb);
+ if (!pv)
+ RpcRaiseException(RPC_S_OUT_OF_MEMORY);
+
+ return pv;;
+}
+
+void __RPC_API midl_user_free(void __RPC_FAR * pv)
+{
+ GlobalFree(pv);
+}
+
+
+
+
+BOOLEAN EMS_IsServiceRunning( CHAR_PTR server_name, CHAR_PTR service_name )
+{
+ CHAR machine[256] ;
+ SC_HANDLE mach_hand ;
+ SC_HANDLE serv_hand ;
+ SERVICE_STATUS serv_status ;
+
+ strcpy( machine, TEXT("\\\\") ) ;
+ strcat( machine, server_name ) ;
+
+ // Make sure MAD (The system attendant) is running
+
+ mach_hand = OpenSCManager( machine, NULL, SC_MANAGER_ALL_ACCESS ) ;
+ if ( mach_hand == NULL ) {
+ return FALSE ;
+ }
+
+ serv_hand = OpenService( mach_hand, service_name, SERVICE_QUERY_STATUS ) ;
+ if ( serv_hand == NULL ) {
+ CloseServiceHandle( mach_hand ) ;
+ return FALSE ;
+ }
+
+ if ( !QueryServiceStatus( serv_hand, &serv_status ) ||
+ (serv_status.dwCurrentState!=SERVICE_RUNNING ) ) {
+
+ CloseServiceHandle( serv_hand ) ;
+ CloseServiceHandle( mach_hand ) ;
+ return FALSE ;
+ }
+
+ CloseServiceHandle( serv_hand ) ;
+ CloseServiceHandle( mach_hand ) ;
+
+ return TRUE ;
+}
+
+VOID EMS_StartSAD( CHAR_PTR server_name )
+{
+ CHAR machine[256] ;
+ SC_HANDLE mach_hand ;
+ SC_HANDLE serv_hand ;
+ SERVICE_STATUS serv_status ;
+
+ strcpy( machine, TEXT("\\\\") ) ;
+ strcat( machine, server_name ) ;
+
+ // Make sure MAD (The system attendant) is running
+
+ mach_hand = OpenSCManager( machine, NULL, SC_MANAGER_ALL_ACCESS ) ;
+ if ( mach_hand == NULL ) {
+ return ;
+ }
+
+ serv_hand = OpenService( mach_hand, SERVICE_MAD,
+ SERVICE_START | SERVICE_QUERY_STATUS ) ;
+
+ if ( serv_hand == NULL ) {
+ CloseServiceHandle( mach_hand ) ;
+ return ;
+ }
+
+ if ( !QueryServiceStatus( serv_hand, &serv_status ) ||
+ (serv_status.dwCurrentState!=SERVICE_RUNNING ) ) {
+
+ INT k ;
+
+ if ( !StartService( serv_hand, 0, NULL ) ) {
+ CloseServiceHandle( serv_hand ) ;
+ return ;
+ }
+
+ for ( k = 0; k < 180; k++ ) {
+
+ if ( QueryServiceStatus( serv_hand, &serv_status ) &&
+ (serv_status.dwCurrentState != SERVICE_START_PENDING ) ) {
+
+ break ;
+ }
+ ThreadSwitch() ;
+ Sleep( 1000 ) ;
+ }
+
+ CloseServiceHandle( serv_hand ) ;
+ CloseServiceHandle( mach_hand ) ;
+ return ;
+ }
+
+ CloseServiceHandle( serv_hand ) ;
+
+}
+
diff --git a/private/utils/ntbackup/src/xmkdblk.c b/private/utils/ntbackup/src/xmkdblk.c
new file mode 100644
index 000000000..186460b5b
--- /dev/null
+++ b/private/utils/ntbackup/src/xmkdblk.c
@@ -0,0 +1,126 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xmkdblk.c
+
+ Description: This file contains functions for the tape format
+ layer to use to create DBLKs. The structure's passed
+ to the create functions includes generic information which
+ is common to most file systems and os specific information.
+ The os specific information was saved when the file system
+ for that os was used to make a backup. The information in
+ the os specific portion could potentially be translated into
+ a useable format for this file system. Each file system defines
+ the format for its os specific information in the header file
+ osinfo.h.
+
+
+ $Log: M:/LOGFILES/XMKDBLK.C_V $
+
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+#include "std_err.h"
+#include "stdmath.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "tfldefs.h"
+#include "osinfo.h"
+#include "gen_fs.h"
+
+
+/**/
+/**
+
+ Name: EMSCreateFDB
+
+ Description: This function creates a FDB based on the information
+ passed in the GEN_FDB_DATA structure. This function
+ allows the tape format layer to create DBLKs without
+ knowing their structure.
+
+ Modified: 8/24/1989
+
+ Returns: TF_KEEP_GEN_DATA_ONLY
+
+**/
+INT16 EMS_CreateFDB( fsh, dat )
+FSYS_HAND fsh;
+GEN_FDB_DATA_PTR dat;
+{
+ return TF_SKIP_ALL_DATA ;
+}
+
+
+/**/
+/**
+
+ Name: NTFS_CreateDDB
+
+ Description: This function creates a DDB based on the information
+ passed in the GEN_DDB_DATA structure. This function
+ allows the tape format layer to create DBLKs without
+ knowing their structure.
+
+ Modified: 8/24/1989
+
+ Returns: TF_SKIP_ALL_DATA
+
+**/
+INT16 EMS_CreateDDB( fsh, dat )
+FSYS_HAND fsh;
+GEN_DDB_DATA_PTR dat;
+
+{
+ EMS_DBLK_PTR ddblk;
+ INT16 ret_val ;
+ DBLK_PTR dblk ;
+
+ dat->std_data.dblk->blk_type = DDB_ID ;
+ dat->std_data.dblk->com.blkid = dat->std_data.blkid;
+ dat->std_data.dblk->com.f_d.did = dat->std_data.did ;
+ dat->std_data.dblk->com.ba.lba = dat->std_data.lba ;
+ dat->std_data.dblk->com.os_id = dat->std_data.os_id ;
+ dat->std_data.dblk->com.os_ver = dat->std_data.os_ver ;
+
+ dat->std_data.dblk->com.continue_obj = dat->std_data.continue_obj ;
+ dat->std_data.dblk->com.tape_seq_num = dat->std_data.tape_seq_num ;
+
+ ddblk = (EMS_DBLK_PTR)dat->std_data.dblk;
+ dblk = dat->std_data.dblk;
+ dblk->com.string_type = dat->std_data.string_type ;
+
+ ddblk->blk_type = DDB_ID;
+
+ ddblk->os_info_complete = TRUE ;
+
+ if ( dat->std_data.os_id == FS_EMS_MDB_ID ) {
+ ddblk->ems_type = EMS_MDB ;
+ } else if ( dat->std_data.os_id == FS_EMS_DSA_ID ) {
+ ddblk->ems_type = EMS_DSA ;
+ }
+
+ ret_val = FS_SetupOSPathOrNameInDBLK( fsh,
+ dblk,
+ (BYTE_PTR)dat->path_name,
+ dat->path_size ) ;
+
+ switch ( dat->std_data.os_id ) {
+
+ case FS_EMS_DSA_ID:
+ case FS_EMS_MDB_ID:
+ break ;
+ }
+
+
+ return TF_KEEP_ALL_DATA ;
+
+}
+
diff --git a/private/utils/ntbackup/src/xmoddblk.c b/private/utils/ntbackup/src/xmoddblk.c
new file mode 100644
index 000000000..ab191ec1d
--- /dev/null
+++ b/private/utils/ntbackup/src/xmoddblk.c
@@ -0,0 +1,618 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tmoddblk.c
+
+ Description: This file contains code to get/set generic information
+ from/to a EMS FDB or DDB.
+
+
+ $Log: M:/LOGFILES/TMODDBLK.C_V $
+
+
+**/
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+#include "stdmath.h"
+#include "tfldefs.h"
+#include "datetime.h"
+#include "fsys.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "fsys_err.h"
+#include "osinfo.h"
+
+typedef struct {
+ UINT32 maynID;
+ UINT32 msoftID;
+} ID_TRANS_TABLE, ID_TRANS_TABLE_PTR;
+
+/**/
+/**
+
+ Name: EMS_ModFnameFDB()
+
+ Description: ASSERT!!! FDB are not supported!!!!
+
+ Modified: 1/14/1992 10:28:22
+
+ Returns: Error codes:
+ FAILURE
+
+**/
+INT16 EMS_ModFnameFDB(
+FSYS_HAND fsh , /* I - File system handle */
+BOOLEAN set_it , /* I - TRUE if setting file name, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get file name from */
+CHAR_PTR buf , /*I/O- file name to read (or to write) */
+INT16 *size ) /*I/O- byte size buffer on entry and exit */
+{
+ fsh ;
+ set_it;
+ dblk ;
+ buf ;
+ (void)*size ;
+
+ msassert( "EMS_ModFnameMDB should not be called" == NULL ) ;
+
+ return FAILURE ;
+}
+/**/
+/**
+
+ Name: EMS_ModPathDDB()
+
+ Description: This function gets/sets the path in an DDB
+
+ Modified: 1/14/1992 10:30:16
+
+ Returns: Error Codes:
+ FS_BUFFER_TO_SMALL
+ FS_BAD_INPUT_DATA
+ SUCCESS
+
+ Notes:
+
+ See also: EMS_ModFnameFDB()
+
+**/
+INT16 EMS_ModPathDDB(
+FSYS_HAND fsh , /* I - File system handle */
+BOOLEAN set_it , /* I - TRUE if setting path, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get path from */
+CHAR_PTR buf , /*I/O- path to read (or to write) */
+INT16 *size ) /*I/O- byte size of buffer on entry and exit */
+{
+ INT16 ret_val = SUCCESS ;
+ CHAR_PTR pos ;
+ EMS_DBLK_PTR ddblk ;
+ GENERIC_DLE_PTR dle = fsh->attached_dle ;
+
+ ddblk = (EMS_DBLK_PTR) dblk ;
+
+ if ( set_it ) {
+
+ msassert( dle->info.xserv->type == EMS_BRICKED ) ;
+ return SUCCESS ;
+
+ } else { /* get path */
+
+ if ( ( dle->info.xserv->type == EMS_MDB ) ||
+ ( dle->info.xserv->type == EMS_DSA ) ) {
+
+ strcpy( buf, dblk->com.os_name->name ) ;
+
+ } else { //bricked
+
+
+ }
+ }
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: EMS_GetOSFnameFDB()
+
+ Description: Assert!! there are no FDBs
+
+ Modified: 1/14/1992 11:8:26
+
+ Returns: Error codes
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes:
+
+ See also: EMS_ModFnameFDB()
+
+**/
+INT16 EMS_GetOSFnameFDB( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get path from */
+CHAR_PTR buf ; /* O - buffer to place path in */
+{
+
+ (void)dblk;
+ (void)buf;
+
+ msassert( "EMS_GetOSFnameFDB should not be called" == NULL ) ;
+ return FAILURE ;
+}
+
+/**/
+/**
+
+ Name: EMS_GetOSPathDDB()
+
+ Description: This function copies the OS path in the specified
+ DDB to the specified buffer. The OS path is the same as
+ the "normal" path during backup. During restore, the
+ OS path name is the name stored on tape.
+
+ Modified: 1/14/1992 11:9:5
+
+ Returns: Error codes:
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes:
+
+ See also: EMS_GetOSFnameFDB()
+
+**/
+INT16 EMS_GetOSPathDDB( fsh, dblk, buf )
+FSYS_HAND fsh ; /* I - File System handle */
+DBLK_PTR dblk ; /* I - Descriptor block to get path from */
+CHAR_PTR buf ; /*I/O- path to read (or to write) */
+{
+ CHAR_PTR pos ;
+ CHAR_PTR os_name ;
+ INT16 os_name_size ;
+ EMS_DBLK_PTR ddblk ;
+
+ (VOID)fsh ;
+
+ ddblk = (EMS_DBLK_PTR) dblk;
+
+ if ( dblk->com.os_name != NULL )
+ {
+ os_name = dblk->com.os_name->name ;
+ os_name_size = dblk->com.os_name->name_size ;
+ }
+ else
+ {
+ os_name = ddblk->full_name_ptr->name ;
+ os_name_size = ddblk->full_name_ptr->name_size ;
+ }
+
+
+ memcpy( buf, os_name, os_name_size ) ;
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: EMS_GetFileVerFDB()
+
+ Description: Since DOS does not support file versions, this
+ function simply sets the version number to 0.
+
+ Modified: 1/14/1992 11:9:39
+
+ Returns: SUCCESS
+
+ Notes:
+
+**/
+INT16 EMS_GetFileVerFDB( dblk, version )
+DBLK_PTR dblk ;
+UINT32 *version ;
+{
+ dblk ;
+ *version = 0 ;
+ msassert( "EMS_GetOSFnameFDB should not be called" == NULL ) ;
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: EMS_GetCdateDBLK()
+
+ Description: Pretend Creation date is same as Modify date
+
+ Modified: 1/14/1992 11:10:9
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: EMS_ModBdate(), EMS_GetMdate(), EMS_ModAdate()
+
+**/
+INT16 EMS_GetCdateDBLK( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ; /*I/O- createion date to read (or to write) */
+{
+ (void)dblk;
+
+ buf->date_valid = FALSE;
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: EMS_GetMdateDBLK()
+
+ Description: This function copies the modified date/time into (or out of)
+ the provided buffer.
+
+ Modified: 1/14/1992 11:20:6
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: EMS_GetCdate(), EMS_ModBdate(), EMS_ModAdate()
+
+**/
+INT16 EMS_GetMdateDBLK( dblk, buf )
+DBLK_PTR dblk ; /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ; /* O - modify date to write */
+{
+ (void)dblk;
+
+ buf->date_valid = FALSE;
+
+ return SUCCESS ;
+}
+
+
+/**/
+/**
+
+ Name: EMS_ModBdateDBLK()
+
+ Description: This function copies the backup date/time into (or out of)
+ the provided buffer.
+
+ Modified: 8/15/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( EMS_GetCdate(), EMS_GetMdate(), EMS_ModAdate()
+
+**/
+INT16 EMS_ModBdateDBLK(
+BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ) /*I/O- createion date to read (or to write) */
+{
+ dblk;
+
+ if ( !set_it ) {
+
+ buf->date_valid = FALSE;
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: EMS_ModAdateDBLK()
+
+ Description: This function copies the access date/time into (or out ot )
+ the provided buffer.
+
+ Modified: 1/14/1992 11:21:53
+
+ Returns: SUCCESS
+
+ See also: EMS_GetCdate(), EMS_GetMdate(), EMS_ModBdate()
+
+**/
+INT16 EMS_ModAdateDBLK(
+BOOLEAN set_it , /* I - TRUE if setting creation date, FALSE if getting */
+DBLK_PTR dblk , /* I - Descriptor block to get creation date */
+DATE_TIME_PTR buf ) /*I/O- createion date to read (or to write) */
+{
+ dblk;
+
+ if ( !set_it ) {
+
+ buf->date_valid = FALSE;
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: EMS_GetDisplaySizeDBLK()
+
+ Description: This function returns the generic size of a DBLK.
+ For a file, this is the file size. For a directory this is
+ allways 0.
+
+ Modified: 1/14/1992 12:15:33
+
+ Returns: Number of generic data bytes.
+
+ Notes:
+
+**/
+UINT64 EMS_GetDisplaySizeDBLK( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* I - Descriptor block to get generic data size for */
+{
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR) dblk;
+
+ (void)fsh ;
+
+ return ddblk->display_size;
+}
+
+/**/
+/**
+
+ Name: EMS_ModAttribDBLK()
+
+ Description: This function copies the generic attributes into
+ (or out of) the specified DBLK.
+
+ Modified: 1/14/1992 12:15:59
+
+ Returns: SUCCESS
+
+ Notes: This only supports FDBs and DDBs. This should be called
+ by the FS_... function NOT by a macro.
+
+**/
+INT16 EMS_ModAttribDBLK(
+BOOLEAN set_it , /* I - TRUE if we are seting data */
+DBLK_PTR dblk , /*I/O- dblk to read or write data from */
+UINT32 *attrib ) /*I/O- attributre read or written */
+{
+ if ( set_it ) {
+ return SUCCESS;
+ }
+ else { /* get data */
+ *attrib = 0 ;
+ }
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: EMS_GetObjTypeDBLK()
+
+ Description: This function looks at the os_id in the provided DBLK
+ and returns the type of the object.
+
+ Modified: 1/14/1992 12:16:32
+
+ Returns: SUCCESS
+
+ Notes: If the os_id is unknown then type is UNKNOWN_OBJECT
+
+**/
+/* begin declaration */
+INT16 EMS_GetObjTypeDBLK( dblk, type )
+DBLK_PTR dblk ; /* I - Descriptor block to get type of */
+OBJECT_TYPE *type ; /* O - type of DBLK */
+{
+ msassert( type != NULL );
+
+ dblk ;
+ *type = DOS_OBJECT ;
+
+ return( SUCCESS ) ;
+}
+
+
+/**/
+/**
+
+ Name: EMS_GetOS_InfoDBLK()
+
+ Description: This function returns the OS info for the DOS
+ file system
+
+ Modified: 1/14/1992 12:16:55
+
+ Returns: Error Code
+ FS_BUFFER_TO_SMALL
+ SUCCESS
+
+ Notes: This file system has no OS info.
+
+**/
+/* begin declaration */
+INT16 EMS_GetOS_InfoDBLK( dblk, os_info, size )
+DBLK_PTR dblk ; /* I - DBLK to get the info from */
+BYTE_PTR os_info ; /* O - Buffer to place data */
+INT16 *size ; /*I/O- Buffer size / data length */
+{
+ (void)os_info;
+ (void)dblk ;
+ *size = 0 ;
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: EMS_GetActualSizeDBLK
+
+ Description: This function returns the actual size of a DBLK.
+
+ Modified: 1/14/1992 12:17:33
+
+ Returns: The number of bytes
+
+ Notes:
+
+**/
+/* begin declaration */
+INT16 EMS_GetActualSizeDBLK( fsh, dblk )
+FSYS_HAND fsh ;
+DBLK_PTR dblk ;
+{
+
+ EMS_DBLK *ddb ;
+ INT16 size ;
+
+ fsh ;
+
+ ddb = (EMS_DBLK_PTR)dblk ;
+ size = sizeof( EMS_DBLK ) ;
+
+ return size ;
+}
+
+/**/
+/**
+
+ Name: EMS_SetOwnerId()
+
+ Description: does nothing
+
+ Modified: 1/14/1992 12:18:25
+
+ Returns: none
+
+ Notes:
+
+**/
+VOID EMS_SetOwnerId( fsh, dblk, id )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* O - DBLK to modify */
+UINT32 id ; /* I - value to set it to */
+{
+ fsh ;
+ dblk ;
+ id ;
+}
+
+/**/
+/**
+
+ Name: EMS_ProcessDDB()
+
+ Description: This function allways returns FALSE to
+ specify that directories should not be restored
+ if there are no file to restore into the directory.
+
+ Modified: 10/23/1989
+
+ Returns: FALSE
+
+ Notes:
+
+**/
+/* begin declaration */
+BOOLEAN EMS_ProcessDDB( fsh, ddb )
+FSYS_HAND fsh; /* I - file system handle */
+DBLK_PTR ddb; /* I - Directory information */
+{
+ fsh;
+ ddb;
+
+ return TRUE ;
+}
+
+
+/**/
+/**
+
+ Name: EMS_EnumSpecialFiles()
+
+ Description: This function enumerates the special files. For NT
+ the application asks if registry files are to be included
+ before the restore process starts... Thus this function has
+ no purpose.
+
+ Modified: 5/21/1992 19:28:51
+
+ Returns: FS_NO_MORE
+
+ Notes: Starting index must be 0
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 EMS_EnumSpecFiles( dle, index, path, psize, fname )
+GENERIC_DLE_PTR dle ;
+UINT16 *index ;
+CHAR_PTR *path ;
+INT16 *psize ;
+CHAR_PTR *fname ;
+{
+ (void)index;
+ (void)path;
+ (void)psize;
+ (void)fname ;
+
+ return FS_NO_MORE ;
+}
+/**/
+/**
+
+ Name: EMS_SpecExcludeObj
+
+ Description: This function tells the caller what kind of file a file is.
+ The possibilities are:
+ FS_NORMAL_FILE
+ FS_SPECIAL_DIR
+ FS_SPECIAL_FILE
+ FS_EXCLUDE_FILE
+
+ This function is used to exclude / include the registry. The
+ assumptions are that the nt_system directory contains the following
+ files:
+ Active registry files
+ Inactive registry files
+ Useless .LOG and .ALT files
+ Event logger data files.
+
+
+ Modified: 1/10/1990
+
+ Returns: FS_NORMAL_FILE because this file system has no special
+ files.
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 EMS_SpecExcludeObj(
+FSYS_HAND fsh, /* I - File system handle */
+DBLK_PTR ddb, /* I - Descriptor block of ddb */
+DBLK_PTR fdb ) /* I - Descriptor block of fdb */
+{
+ (void)fsh;
+ (void)ddb;
+ (void)fdb;
+ return FS_NORMAL_FILE ;
+}
diff --git a/private/utils/ntbackup/src/xname.c b/private/utils/ntbackup/src/xname.c
new file mode 100644
index 000000000..2778fac9d
--- /dev/null
+++ b/private/utils/ntbackup/src/xname.c
@@ -0,0 +1,160 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tname.c
+
+
+ Description: This file contains code to get the device name and
+ volume name for the given DLE.
+
+
+**/
+#include <windows.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "stdtypes.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+
+/**/
+/**
+
+ Name: EMS_DeviceDispName()
+
+ Description: This function gets the displayable device name for
+ a DLE. This name is displayed for drive select.
+
+ Modified: 9/13/1989
+
+ Returns: SUCCESS
+
+ Notes:
+
+ See also: $/SEE( )$
+
+ Declaration:
+
+**/
+INT16 EMS_DeviceDispName( dle, dev_name, size, type )
+GENERIC_DLE_PTR dle;
+CHAR_PTR dev_name;
+INT16 size ;
+INT16 type ;
+{
+ CHAR_PTR p ;
+ (VOID)type;
+
+ if ( size < (INT16)strsize(dle->device_name) ) {
+ return FS_BUFFER_TO_SMALL ;
+ }
+
+
+ strcpy( dev_name, dle->device_name ) ;
+
+ if ( ( dle->os_id == FS_EMS_MDB_ID ) ||
+ ( dle->os_id == FS_EMS_DSA_ID ) ) {
+
+ p = strchr( dle->device_name, TEXT('\\') ) ;
+ if ( p ) {
+ strcpy( dev_name, p+1 ) ;
+ }
+ }
+
+ return SUCCESS ;
+}
+/**/
+/**
+
+ Name: EMS_GetVolName()
+
+ Description: This function coppies the volume name
+ of the specified drive to the buffer provided.
+
+ Modified: 12/4/1991 9:45:49
+
+**/
+VOID EMS_GetVolName( dle, buffer )
+GENERIC_DLE_PTR dle;
+CHAR_PTR buffer ;
+{
+
+ if (dle->parent ) {
+ EMS_GetVolName( dle->parent, buffer ) ;
+ strcat( buffer, TEXT("\\") ) ;
+
+ EMS_DeviceDispName(dle, buffer + strlen(buffer), 256, 1) ;
+
+ } else {
+ strcpy( buffer, dle->device_name ) ;
+ }
+
+}
+
+/**/
+/**
+
+ Name: EMS_SizeofVolName()
+
+ Description: This function returns the size of the volume name
+ which will be created by DLE_GetVolName()
+
+ Modified: 12/4/1991 11:14:25
+
+ Returns: size of string including \0;
+
+**/
+INT16 EMS_SizeofVolName( dle )
+GENERIC_DLE_PTR dle ;
+{
+ INT16 size ;
+
+
+ if (dle->parent ) {
+ size = EMS_SizeofVolName( dle->parent ) ;
+ return ( strsize( dle->device_name ) + 1 + size );
+ } else {
+ return ( strsize( dle->device_name ) );
+ }
+
+}
+
+/**/
+/**
+
+ Name: EMS_InitMakeData()
+
+ Description: This function is used to initialize the parameter block
+ which is passed to CreateDBLK.
+
+ Modified: 12/4/1991 14:57:3
+
+ Returns: NONE
+
+ Notes:
+
+**/
+VOID EMS_InitMakeData(
+FSYS_HAND fsh,
+INT16 blk_type,
+CREATE_DBLK_PTR data ) {
+
+ switch ( fsh->attached_dle->info.xserv->type ) {
+
+ case EMS_MDB:
+ data->v.std_data.os_id = FS_EMS_MDB_ID ;
+ data->v.std_data.os_ver = FS_EMS_MDB_VER ;
+ break ;
+
+ case EMS_DSA:
+ data->v.std_data.os_id = FS_EMS_DSA_ID ;
+ data->v.std_data.os_ver = FS_EMS_DSA_VER ;
+ break ;
+
+ }
+
+ return ;
+}
diff --git a/private/utils/ntbackup/src/xopen.c b/private/utils/ntbackup/src/xopen.c
new file mode 100644
index 000000000..4242533f9
--- /dev/null
+++ b/private/utils/ntbackup/src/xopen.c
@@ -0,0 +1,661 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xopen.c
+
+ Description: This file contains code to open files
+ and directories.
+
+ $Log: N:/LOGFILES/XOPEN.C_V $
+
+
+**/
+#include <windows.h>
+#include <string.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <wtypes.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+
+#include "omevent.h"
+
+#include "ems_jet.h"
+
+#include "beconfig.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "tfldefs.h"
+
+#include "jet.h"
+#include "jetbcli.h"
+#include "edbmsg.h"
+
+/* Maximum number of attempts to create a temporary file */
+
+static INT16 EMS_OpenDSAorMDB( FSYS_HAND fsh, FILE_HAND hand, EMS_DBLK_PTR fdb, INT16 MODE );
+static INT16 EMS_LoadPathList( FSYS_HAND fsh, FILE_HAND hand ) ;
+static INT16 EMS_OpenBricked( FSYS_HAND fsh, FILE_HAND hand, EMS_DBLK_PTR fdb, INT16 MODE );
+
+static INT16 EMS_WipeLogFiles( FSYS_HAND fsh, CHAR_PTR log_dir ) ;
+
+/**/
+
+/**
+
+ Name: EMS_OpenObj()
+
+ Description: This function opens files or directories.
+
+ Modified: 7/28/1989
+
+ Returns: Error Codes
+ OUT_OF_MEMORY
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ FS_IN_USE_ERROR
+ FS_OPENED_INUSE
+ SUCCESS
+
+ Notes: Valid modes are : READ, WRITE, & VERIFY
+ If a VCB is passed in then this function returns SUCCESS
+
+ See also: $/SEE( EMS_OpenFile() )$
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 EMS_OpenObj( fsh, hand, dblk, mode )
+FSYS_HAND fsh ; /* I - file system that the file is opened on */
+FILE_HAND *hand ; /* O - allocated handle */
+DBLK_PTR dblk; /*I/O- describes the file to be opened */
+OPEN_MODE mode ; /* I - open mode */
+{
+ GENERIC_DLE_PTR dle = fsh->attached_dle;
+ INT16 hand_size ;
+ INT16 ret_val = SUCCESS;
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR) dblk;
+ EMS_FSYS_RESERVED_PTR resPtr = fsh->reserved.ptr;
+ EMS_OBJ_HAND_PTR ems_hand = NULL ;
+
+ msassert( dblk != NULL );
+ msassert( fsh->attached_dle != NULL );
+ msassert( dblk->blk_type == DDB_ID ) ;
+
+ if ( fsh->hand_in_use ) {
+ hand_size = sizeof( FILE_HAND_STRUCT ) + sizeof ( EMS_OBJ_HAND );
+ *hand = (FILE_HAND) calloc( 1, hand_size ) ;
+ if ( *hand == NULL ) {
+ ret_val = OUT_OF_MEMORY ;
+ }
+
+ } else {
+ *hand = fsh->file_hand ;
+ fsh->hand_in_use = TRUE ;
+ }
+
+ (*hand)->obj_hand.ptr = (VOID_PTR)((*hand) + 1) ;
+ memset( (*hand)->obj_hand.ptr, 0, sizeof( EMS_OBJ_HAND ) ) ;
+
+
+ if ( ret_val == SUCCESS ) {
+ EMS_FSYS_RESERVED_PTR res = fsh->reserved.ptr;
+
+ ems_hand = (*hand)->obj_hand.ptr;
+
+ (*hand)->fsh = fsh ;
+ (*hand)->mode = (INT16)mode ;
+ (*hand)->dblk = dblk ;
+
+ ems_hand->nameComplete = FALSE;
+ ems_hand->needPathList = TRUE;
+ ems_hand->needStreamHeader = TRUE;
+ ems_hand->name_list = NULL ;
+ ems_hand->name_list_offset = 0 ;
+
+ switch( dle->info.xserv->type ){
+
+ case EMS_MDB :
+ case EMS_DSA :
+
+ ret_val = EMS_OpenDSAorMDB( fsh, *hand, ddblk, (INT16)mode ) ;
+ ddblk->backup_completed = FALSE ;
+
+ if ( !ret_val && (mode == FS_WRITE) ) {
+ res->map_size = 0 ;
+ res->low_log = 0x7fffffff ;
+ res->high_log = 0 ;
+
+ *res->jet_rstmap = TEXT('\0') ;
+
+ }
+ break ;
+
+ case EMS_BRICK :
+
+ ret_val = FS_SavePath( fsh, (UINT8_PTR)TEXT("\\"), 2 * sizeof(CHAR) ) ;
+ if ( ret_val == SUCCESS ) {
+ ret_val = FS_AppendPath( fsh,
+ (UINT8_PTR)ddblk->full_name_ptr->name,
+ (INT16)(strsize( ddblk->full_name_ptr->name )) ) ;
+ }
+
+ if ( ret_val == SUCCESS ) {
+ ret_val = EMS_OpenBricked( fsh, *hand, ddblk, (INT16)mode ) ;
+ }
+ break ;
+
+ }
+ }
+
+ if ( ems_hand ) {
+ ems_hand->open_ret_val = ret_val ;
+ return SUCCESS ;
+ }
+
+ if( ( ret_val != SUCCESS ) && ( ret_val != FS_OPENED_INUSE ) ) {
+ if( fsh->file_hand == *hand ) {
+ fsh->hand_in_use = FALSE ;
+ memset( *hand, 0, sizeof( FILE_HAND_STRUCT ) ) ;
+ } else {
+ free( *hand ) ;
+ }
+ }
+
+ return ret_val ;
+}
+/**/
+/**
+
+ Name: EMS_OpenDSAorMDB()
+
+ Description: This function calls RestorePrepare in order to load the
+ path list and calls BackupPrepare in order the the
+ attached database list.
+
+ Modified: 7/28/1989
+
+ Returns: Error Codes.
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ FS_IN_USE_ERROR
+ FS_OPENED_INUSE
+ SUCCESS
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 EMS_OpenDSAorMDB(
+FSYS_HAND fsh , /* I - file system that the file is opened on */
+FILE_HAND hand , /* O - allocated handle */
+EMS_DBLK_PTR ddblk , /*I/O- describes the file to be opened */
+INT16 mode ) /* I - open mode */
+{
+ GENERIC_DLE_PTR dle = fsh->attached_dle ;
+ INT16 ret_val = SUCCESS;
+ EMS_OBJ_HAND_PTR ems_hand = ((EMS_OBJ_HAND_PTR)hand->obj_hand.ptr) ;
+ INT status = SUCCESS;
+ CHAR_PTR db_name;
+ INT buf_size ;
+ EMS_FSYS_RESERVED_PTR resPtr = fsh->reserved.ptr;
+ INT grebit = 0;
+ INT backup_type = BACKUP_TYPE_FULL ;
+
+
+ hand->opened_in_use = FALSE ;
+ hand->fsh = fsh ;
+ hand->size = 0 ;
+ hand->obj_pos = 0 ;
+
+ if ( dle->info.xserv->type == EMS_MDB ) {
+ db_name = TEXT("Exchange MDB Database") ;
+ } else{
+ db_name = TEXT("Exchange DS Database") ;
+ }
+
+ if ( mode == FS_WRITE ) {
+// moved this to create.
+// status = EMS_RestorePrepare( dle->parent->device_name,
+// db_name,
+// &resPtr->restore_context ) ;
+
+ } else {
+ resPtr->restore_context = NULL ;
+ }
+
+ if ( !status && ( mode == FS_READ ) ) {
+
+ if ( BEC_GetModifiedOnlyFlag( fsh->cfg ) ) {
+ grebit = JET_bitBackupIncremental ;
+ backup_type = BACKUP_TYPE_LOGS_ONLY ;
+ }
+ status = EMS_BackupPrepare( fsh->attached_dle->parent->device_name,
+ db_name,
+ grebit,
+ backup_type,
+ &(ems_hand->context) ) ;
+
+ }
+
+ if ( status ) {
+ ems_hand->context = NULL;
+ ret_val = EMS_ConvertJetError( status ) ;
+ if ( status == hrInvalidParameter ) {
+ ret_val = FS_EMS_NO_LOG_BKUP ;
+ }
+
+ } else {
+
+ if ( mode == FS_WRITE ) {
+ ret_val = EMS_LoadPathList( fsh, hand ) ;
+ }
+
+ if ( ( ret_val == SUCCESS ) && (mode == FS_WRITE ) &&
+ ( fsh->attached_dle->info.xserv->type == EMS_MDB ) ) {
+
+ if ( ( BEC_GetEmsPubPri( fsh->cfg) & BEC_EMS_PUBLIC ) &&
+ (*resPtr->paths.mdb.FnamePublic == TEXT('\0') ) ) {
+
+ ret_val = FS_EMS_NO_PUBLIC ;
+ }
+ if ( ( BEC_GetEmsPubPri( fsh->cfg) & BEC_EMS_PRIVATE ) &&
+ (*resPtr->paths.mdb.FnamePrivate == TEXT('\0') ) ) {
+
+ ret_val = FS_EMS_NO_PRIVATE ;
+ }
+ }
+ }
+
+ if ( !ret_val ) {
+
+ if ( mode == FS_READ ) {
+
+ if ( ( fsh->attached_dle->parent == NULL ) ||
+ ( fsh->attached_dle->parent->parent == NULL ) ) {
+
+ return FS_COMM_FAILURE ;
+ }
+
+ if ( BEC_GetModifiedOnlyFlag( fsh->cfg ) ) {
+ ret_val = EMS_LoadNameList( fsh, hand, EMS_DOING_LOGS ) ;
+ } else {
+ ret_val = EMS_LoadNameList( fsh, hand, EMS_DOING_DB ) ;
+ }
+
+ } else if ( (mode == FS_WRITE) && BEC_GetEmsWipeClean( fsh->cfg ) ) {
+
+ if ( dle->info.xserv->type == EMS_MDB ){
+ EMS_WipeLogFiles( fsh, resPtr->paths.mdb.LogDir ) ;
+ } else {
+ EMS_WipeLogFiles( fsh, resPtr->paths.dsa.LogDir ) ;
+ }
+ }
+ } else {
+ if ( resPtr->restore_context ) {
+ EMS_RestoreEnd( resPtr->restore_context ) ;
+ }
+ }
+
+ return ret_val ;
+}
+
+/**/
+/**
+
+ Name: EMS_OpenBricked()
+
+ Description: This function opens a directory for for processing.
+ If this is a special Object we will open the special file.
+ Otherwise we will process any long path followed by any
+ data associated with the object.
+
+ Modified: 5/21/1992 17:54:42
+
+ Returns: Error Codes.
+ FS_NOT_FOUND
+ SUCCESS
+
+ Declaration:
+
+**/
+/* begin declaration */
+static INT16 EMS_OpenBricked(
+FSYS_HAND fsh , /* I - file system that the file is opened on */
+FILE_HAND hand , /* O - allocated handle */
+EMS_DBLK_PTR ddblk, /*I/O- describes the file to be opened */
+INT16 mode ) /* I - open mode */
+{
+ return FS_ACCESS_DENIED ;
+}
+
+
+INT16 EMS_LoadNameList( FSYS_HAND fsh, FILE_HAND hand, INT list_type )
+{
+ GENERIC_DLE_PTR dle = fsh->attached_dle ;
+ INT16 ret_val = SUCCESS;
+ EMS_OBJ_HAND_PTR ems_hand = ((EMS_OBJ_HAND_PTR)hand->obj_hand.ptr) ;
+ INT status = SUCCESS;
+ CHAR *db_name;
+ INT buf_size ;
+ CHAR *buffer ;
+ INT i ;
+
+ if ( ems_hand->name_list != NULL ) {
+ free( ems_hand->name_list ) ;
+ ems_hand->name_list = NULL ;
+ }
+
+ buffer = NULL ;
+
+ if ( !status && (list_type == EMS_DOING_DB ) ) {
+
+ status = EMS_BackupGetAttachmentInfo( ems_hand->context,
+ &buffer,
+ &buf_size ) ;
+
+ } else if ( !status && (list_type == EMS_DOING_LOGS ) ) {
+
+ status = EMS_GetBackupLogs( ems_hand->context,
+ &buffer,
+ &buf_size ) ;
+
+ }
+
+
+ if ( !status ) {
+ INT i ;
+ INT num_files = 0 ;
+
+ ems_hand->name_list = malloc( buf_size ) ;
+
+ if ( ems_hand->name_list == NULL ) {
+
+ // lets do some major clean up...
+ EMS_BackupFree( buffer ) ;
+ if ( list_type == EMS_DOING_DB ) {
+ EMS_BackupClose( ems_hand->context ) ;
+ }
+
+ return OUT_OF_MEMORY ;
+ }
+
+ for ( i=0; i< (INT)(buf_size/sizeof(CHAR) -1); i++ ) {
+ ems_hand->name_list[i] = buffer[i] ;
+ if ( buffer[i] == TEXT('\0') ) {
+ num_files ++ ;
+ }
+ }
+
+ if ( list_type == EMS_DOING_DB ) {
+// if ( dle->info.xserv->type == EMS_MDB ) {
+// if ( num_files != 3 ) {
+//
+// OMEVENT_LogEMSToFewDbError ( num_files, 3 ) ;
+//
+// return FS_COMM_FAILURE ;
+// }
+// } else {
+// if ( num_files != 2 ) {
+// OMEVENT_LogEMSToFewDbError ( num_files, 2 ) ;
+// return FS_COMM_FAILURE ;
+// }
+// }
+ }
+
+ ems_hand->db_or_log = list_type ;
+ ems_hand->name_list_offset = 0 ;
+ EMS_BackupFree( buffer ) ;
+ } else {
+ BEC_SetSkipOpenFiles( fsh->cfg, BEC_SKIP_OPEN_FILES ) ;
+ }
+
+ ret_val = EMS_ConvertJetError( status ) ;
+
+ if ( ret_val == RPC_S_SERVER_TOO_BUSY ) {
+ ret_val = FS_COMM_FAILURE ;
+ }
+
+ return ret_val ;
+}
+
+
+INT16 EMS_ConvertJetError( INT status )
+{
+ INT16 ret_val ;
+
+ switch( status ) {
+
+ case SUCCESS :
+ ret_val = SUCCESS ;
+ break ;
+
+ case hrBFInUse:
+ case hrRestoreInProgress:
+ case hrBackupInProgress:
+ ret_val = FS_IN_USE_ERROR ;
+ break ;
+
+ case hrCouldNotConnect:
+ ret_val = FS_BAD_ATTACH_TO_SERVER ;
+ break ;
+
+ case hrTooManyIO:
+ ret_val = FS_COMM_FAILURE ;
+ break ;
+
+ case hrFileAccessDenied:
+ case hrAccessDenied:
+ ret_val = FS_ACCESS_DENIED;
+ break ;
+ case RPC_S_SERVER_TOO_BUSY :
+ ret_val = RPC_S_SERVER_TOO_BUSY ;
+ break ;
+ default:
+ ret_val = FS_COMM_FAILURE ;
+ break ;
+ }
+
+ return ret_val ;
+}
+
+
+
+
+static INT16 EMS_WipeLogFiles( FSYS_HAND fsh, CHAR_PTR log_dir )
+{
+ WIN32_FIND_DATA find_data ;
+ HANDLE scan_hand;
+ INT16 ret_val = SUCCESS ;
+ CHAR path[256] ;
+ CHAR_PTR file ;
+
+ strcpy(path, log_dir ) ;
+
+ strcat( path, TEXT("*") ) ;
+
+ scan_hand = FindFirstFile( path, &find_data ) ;
+
+ while (scan_hand != INVALID_HANDLE_VALUE ) {
+
+ file = EMS_BuildMungedName( fsh, log_dir, find_data.cFileName ) ;
+
+ if ( !FindNextFile( scan_hand, &find_data ) ) {
+ FindClose( scan_hand ) ;
+ scan_hand = INVALID_HANDLE_VALUE ;
+ }
+
+ if ( file != NULL ) {
+ if ( !DeleteFile( file ) ) {
+ ret_val = FS_ACCESS_DENIED;
+ }
+ free( file ) ;
+ } else {
+ return OUT_OF_MEMORY ;
+ }
+ }
+
+ FindClose( scan_hand ) ;
+
+ return ret_val ;
+
+}
+
+INT16 EMS_LoadPathList( FSYS_HAND fsh, FILE_HAND hand )
+{
+ EMS_FSYS_RESERVED_PTR resPtr = fsh->reserved.ptr;
+ CHAR_PTR paths = NULL ;
+ CHAR_PTR p ;
+ INT paths_size ;
+ INT status ;
+
+ status = EMS_RestoreLocations( resPtr->restore_context, &paths, &paths_size ) ;
+
+ memset (&resPtr->paths, 0, sizeof( resPtr->paths ) ) ;
+
+ if ( !status && (paths != NULL) && *paths ) {
+
+ if ( fsh->attached_dle->info.xserv->type == EMS_MDB ) {
+
+ if (*paths == TEXT('\\') ) {
+
+ strcpy( resPtr->paths.mdb.FnameSystem, paths ) ;
+
+ paths += strlen(paths) + 1 ;
+
+ if (!*paths) {
+ return FS_ACCESS_DENIED ;
+ }
+
+ strcpy( resPtr->paths.mdb.LogDir, paths ) ;
+
+ paths += strlen(paths) + 1 ;
+
+ if (!*paths) {
+ return FS_ACCESS_DENIED ;
+ }
+
+ strcpy( resPtr->paths.mdb.FnamePrivate, paths ) ;
+
+ paths += strlen(paths) + 1 ;
+
+ if (!*paths) {
+ return FS_ACCESS_DENIED ;
+ }
+
+ strcpy( resPtr->paths.mdb.FnamePublic, paths ) ;
+
+ strcpy( resPtr->CheckpointFilePath, resPtr->paths.mdb.FnameSystem ) ;
+
+ strcpy( resPtr->LogPath, resPtr->paths.mdb.LogDir ) ;
+
+ } else {
+ while (*paths ) {
+ switch(*(paths++)) {
+ case BFT_CHECKPOINT_DIR :/*checkpoint */
+ strcpy( resPtr->CheckpointFilePath, paths ) ;
+ strcpy( resPtr->paths.mdb.FnameSystem, paths ) ;
+ if ( paths[strlen(paths)-1] != TEXT('\\') ) {
+ strcat( resPtr->paths.mdb.FnameSystem, TEXT("\\") ) ;
+ }
+ break ;
+
+ case BFT_MDB_PUBLIC_DATABASE : /*public*/
+ strcpy( resPtr->paths.mdb.FnamePublic, paths ) ;
+ break ;
+
+ case BFT_MDB_PRIVATE_DATABASE: /*private*/
+ strcpy( resPtr->paths.mdb.FnamePrivate, paths ) ;
+ break ;
+
+ case BFT_LOG_DIR: /*logs*/
+ strcpy( resPtr->paths.mdb.LogDir, paths ) ;
+ if ( paths[strlen(paths)-1] != TEXT('\\') ) {
+ strcat( resPtr->paths.mdb.LogDir, TEXT("\\") ) ;
+ }
+ strcpy( resPtr->LogPath, paths ) ;
+ break ;
+
+ default:
+ status = hrInvalidParam ;
+ break ;
+ }
+ paths += strlen( paths ) + 1 ;
+ }
+ }
+
+ } else if ( fsh->attached_dle->info.xserv->type == EMS_DSA ) {
+
+ if (*paths == TEXT('\\') ) {
+ strcpy( resPtr->paths.dsa.SystemPath, paths ) ;
+
+ paths += strlen(paths) + 1 ;
+
+ if (!*paths) {
+ return FS_ACCESS_DENIED ;
+ }
+
+ strcpy( resPtr->paths.dsa.LogDir, paths ) ;
+
+ paths += strlen(paths) + 1 ;
+
+ if (!*paths) {
+ return FS_ACCESS_DENIED ;
+ }
+
+ strcpy( resPtr->paths.dsa.DbPath, paths ) ;
+
+ strcpy( resPtr->CheckpointFilePath, resPtr->paths.dsa.SystemPath ) ;
+
+ strcpy( resPtr->LogPath, resPtr->paths.dsa.LogDir ) ;
+ } else {
+ while (*paths ) {
+ switch(*(paths++)) {
+ case BFT_CHECKPOINT_DIR :/*checkpoint */
+ strcpy( resPtr->CheckpointFilePath, paths ) ;
+ strcpy( resPtr->paths.dsa.SystemPath, paths ) ;
+ if ( paths[strlen(paths)-1] != TEXT('\\') ) {
+ strcat( resPtr->paths.dsa.SystemPath, TEXT("\\") ) ;
+ }
+ break ;
+
+ case BFT_DSA_DATABASE : /*public*/
+ strcpy( resPtr->paths.dsa.DbPath, paths ) ;
+ break ;
+
+ case BFT_LOG_DIR: /*logs*/
+ strcpy( resPtr->paths.dsa.LogDir, paths ) ;
+ if ( paths[strlen(paths)-1] != TEXT('\\') ) {
+ strcat( resPtr->paths.dsa.LogDir, TEXT("\\") ) ;
+ }
+ strcpy( resPtr->LogPath, paths ) ;
+ break ;
+
+ default:
+ status = hrInvalidParam ;
+ break ;
+ }
+
+ paths += strlen( paths ) + 1 ;
+ }
+ }
+ }
+ }
+ if (status ) {
+ return EMS_ConvertJetError( status ) ;
+ } else {
+ return SUCCESS ;
+ }
+
+}
+
diff --git a/private/utils/ntbackup/src/xreadobj.c b/private/utils/ntbackup/src/xreadobj.c
new file mode 100644
index 000000000..eddc36565
--- /dev/null
+++ b/private/utils/ntbackup/src/xreadobj.c
@@ -0,0 +1,625 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: treadobj.c
+
+ Description: This file contains code to read data from an object
+
+ $Log: M:/LOGFILES/TREADOBJ.C_V $
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "omevent.h"
+#include "ems_jet.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+
+VOID EMS_ZeroCheckSum( FILE_HAND hand ) ;
+VOID EMS_CalcCheckSum( FILE_HAND hand, BYTE_PTR buf, INT size ) ;
+
+static INT16 EMS_ReadData(
+ FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static INT16 BackupCheckSum(
+ FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size ,
+ UINT16 *blk_size ,
+ STREAM_INFO_PTR s_info) ;
+
+static INT16 BackupPathList(
+ FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size ,
+ UINT16 *blk_size ,
+ STREAM_INFO_PTR s_info) ;
+
+static INT16 BackStreamHeader(
+ FILE_HAND hand,
+ STREAM_INFO_PTR s_info );
+
+static UINT16 CalcReadSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize );
+
+/**/
+/**
+
+ Name: EMS_ReadObj()
+
+ Description: This function reads data from an opened object.
+
+ Modified: 7/31/1989
+
+ Returns: Error Codes:
+ FS_DEVICE_ERROR
+ FS_OBJECT_NOT_OPENED
+ FS_EOF_REACHED
+ SUCCESS
+
+ Notes: This function reads data in "chunks". If the buffer
+ is not a multiple of the "chunk" size then the buffer will not
+ be filled. The "Chunk" size is returned.
+
+**/
+INT16 EMS_ReadObj(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size , /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size , /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info) /* O - Stream information for the data returned */
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR)hand->dblk ;
+ INT16 ret_val ;
+
+ msassert( hand->mode == FS_READ ) ;
+
+ if ( ems_hand->open_ret_val ) {
+ if ( ems_hand->needStreamHeader ) {
+ ems_hand->needStreamHeader = FALSE ;
+ return FS_COMM_FAILURE ;
+ } else {
+ return FS_EOF_REACHED ;
+ }
+ }
+
+ if ( (ems_hand->needStreamHeader == FALSE) && (*size == 0) )
+ {
+ /*
+ * Someone asked us to read zero bytes. According to
+ * our rules this is not allowed, but we'll be defensive
+ * anyway.
+ */
+ msassert( FALSE );
+ *blk_size = 1;
+ ret_val = SUCCESS;
+ }
+ else
+ {
+ switch ( hand->fsh->attached_dle->info.xserv->type )
+ {
+
+ case EMS_DSA:
+ case EMS_MDB:
+
+ ret_val = EMS_ReadData( hand, buf, size, blk_size, s_info ) ;
+ break ;
+
+ case EMS_BRICK:
+ return FS_ACCESS_DENIED ;
+ break;
+
+ default:
+ ret_val = FS_OBJECT_NOT_OPENED;
+ }
+ }
+
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: EMS_ReadData()
+
+ Description: This function calls the NT Backup APIs to read data from
+ an open object.
+
+ Modified: 2/10/1992 16:48:9
+
+ Returns: FS_DEVICE_ERROR
+ FS_OBJECT_NOT_OPENED
+ FS_EOF_REACHED
+ SUCCESS
+
+**/
+static INT16 EMS_ReadData(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info ) /* O - Stream information for the data returned */
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ INT16 ret_val = SUCCESS ;
+ INT status ;
+ INT sizeout ;
+ UINT16 buffSize;
+ BOOLEAN dummy;
+ BYTE_PTR org_buf = buf ;
+
+ *blk_size = 1 ;
+
+ s_info->id = STRM_INVALID;
+
+ if ( ems_hand->needPathList )
+ {
+ ret_val = BackupPathList( hand, buf, size, blk_size, s_info ) ;
+ return ret_val ;
+ }
+ else if ( ems_hand->time_for_checksum )
+ {
+ ret_val = BackupCheckSum( hand, buf, size, blk_size, s_info ) ;
+ return ret_val ;
+
+ }
+ else if ( ems_hand->needStreamHeader )
+ {
+ EMS_ZeroCheckSum( hand ) ;
+ ret_val = BackStreamHeader( hand, s_info );
+ *size = 0 ;
+ if ( ret_val == RPC_S_SERVER_TOO_BUSY ) {
+ ems_hand->needStreamHeader = TRUE ;
+ return SUCCESS ;
+ }
+ }
+ else
+ {
+ UINT16 readSize;
+
+ buffSize = *size;
+ *size = 0;
+
+ s_info->id = STRM_INVALID;
+
+ if ( (ems_hand->strm_name.name_leng > 0) &&
+ U64_EQ( ems_hand->curPos, U64_Init( 0, 0 ) ) )
+ {
+ UINT16 nameSize;
+
+ nameSize = (UINT16)(ems_hand->strm_name.name_leng +
+ sizeof(ems_hand->strm_name.name_leng));
+
+ if ( buffSize < nameSize )
+ {
+ *blk_size = nameSize;
+ return SUCCESS;
+
+ } else {
+
+ memcpy( buf, &(ems_hand->strm_name.name_leng), nameSize ) ;
+ buffSize -= nameSize ;
+ buf += nameSize ;
+ *size = nameSize ;
+ }
+ }
+ // If I'm here then I have file data to read...
+
+ readSize = CalcReadSize( ems_hand->curPos,
+ ems_hand->nextStreamHeaderPos,
+ buffSize );
+
+ if ( readSize ) {
+
+ status = EMS_BackupRead( ems_hand->context,
+ buf,
+ readSize,
+ (LPDWORD)&sizeout ) ;
+ } else {
+ sizeout = 0 ;
+ status = SUCCESS ;
+ }
+
+ if ( status && (readSize & 4095) ) {
+
+ readSize -= (readSize%4096) ;
+
+ if ( !readSize ) {
+ if (*size==0) {
+ *blk_size = 4096 ;
+ }
+ status = SUCCESS;
+ sizeout = 0 ;
+
+ } else {
+ status = EMS_BackupRead( ems_hand->context,
+ buf,
+ readSize,
+ (LPDWORD)&sizeout ) ;
+ }
+
+ }
+
+ if ( status == RPC_S_SERVER_TOO_BUSY ) {
+ sizeout = 0 ;
+ status = SUCCESS ;
+ }
+
+ if ( !status ) {
+ *size += sizeout;
+ ems_hand->curPos = U64_Add( ems_hand->curPos,
+ U32_To_U64( (UINT32)*size ),
+ &dummy );
+ } else {
+ // translate the error
+ OMEVENT_LogEMSError ( TEXT("BackupRead()"), status, TEXT(" - ") ) ;
+ ret_val = EMS_ConvertJetError( status );
+ }
+
+ }
+
+ ems_hand->needStreamHeader = U64_EQ( ems_hand->curPos, ems_hand->nextStreamHeaderPos);
+
+ EMS_CalcCheckSum( hand, org_buf, (UINT32)*size ) ;
+
+ if ( ems_hand->needStreamHeader) {
+ EMS_BackupClose( ems_hand->context ) ;
+ ems_hand->time_for_checksum = TRUE ;
+ }
+
+ return ret_val;
+}
+
+VOID EMS_ZeroCheckSum( FILE_HAND hand )
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR) hand->obj_hand.ptr ;
+ ems_hand->check_sum = 0 ;
+ ems_hand->residule_byte_count = 0 ;
+}
+
+VOID EMS_CalcCheckSum( FILE_HAND hand, BYTE_PTR buf, INT size )
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR) hand->obj_hand.ptr ;
+ UINT32 UNALIGNED *word_ptr = (UINT32_PTR)buf ;
+ INT i ;
+
+ // handle residule from last call
+ if ( ems_hand->residule_byte_count ) {
+ UINT32 continue_word ;
+ INT bytes_to_integrate = sizeof(UINT32) - ems_hand->residule_byte_count;
+
+ for ( i = 0;
+ (i <size) && (i < bytes_to_integrate );
+ i++ ) {
+
+ INT shift_count ;
+
+ shift_count = i+ ems_hand->residule_byte_count ;
+
+ continue_word = *buf ;
+ continue_word <<= (8*shift_count) ;
+ ems_hand->check_sum ^= continue_word ;
+ buf ++ ;
+ }
+
+ if ( size < bytes_to_integrate ) {
+ ems_hand->residule_byte_count += size ;
+ size = 0 ;
+ return ;
+ } else {
+ size -= bytes_to_integrate ;
+ }
+ }
+
+ word_ptr = (UINT32_PTR)buf ;
+
+ // handle middle data
+ for ( i = 0; i < (INT)(size/sizeof(UINT32)); i++ ) {
+ ems_hand->check_sum ^= *word_ptr ;
+ word_ptr ++ ;
+ buf += sizeof(UINT32);
+ }
+
+ // handle the leftover
+ ems_hand->residule_byte_count = size%sizeof(UINT32) ;
+ if ( ems_hand->residule_byte_count ) {
+ UINT32 left_over ;
+
+ for ( i = 0; i < (INT)(size%sizeof(UINT32)); i++ ) {
+
+ left_over = *buf;
+ left_over <<= (8*i);
+ ems_hand->check_sum ^= left_over ;
+ buf ++ ;
+ }
+ }
+}
+
+
+static INT16 BackupCheckSum(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size , /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size , /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info) /* O - Stream information for the data returned */
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ INT16 ret_val = SUCCESS ;
+ INT status ;
+ INT sizeout ;
+ UINT16 buffSize;
+ BOOLEAN dummy;
+
+ if ( ems_hand->needStreamHeader ) {
+ s_info->id = STRM_CHECKSUM_DATA ;
+ s_info->fs_attrib = 0 ;
+ s_info->tf_attrib = 0 ;
+ s_info->size.lsw = sizeof(UINT32) ;
+ s_info->size.msw = 0 ;
+ ems_hand->needStreamHeader = FALSE ;
+ } else {
+ if ( *size < sizeof(UINT32) ) {
+ *blk_size = sizeof(UINT32) ;
+ *size = 0 ;
+ } else {
+ memcpy( buf, &ems_hand->check_sum, sizeof(UINT32) ) ;
+ *size = sizeof(UINT32) ;
+ ems_hand->needStreamHeader = TRUE ;
+ ems_hand->time_for_checksum = FALSE ;
+ }
+ }
+
+ return ret_val ;
+}
+
+static INT16 BackupPathList(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size , /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size , /* O - Block size needed for next read */
+ STREAM_INFO_PTR s_info) /* O - Stream information for the data returned */
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ EMS_FSYS_RESERVED_PTR resPtr = hand->fsh->reserved.ptr ;
+
+ if ( ems_hand->needStreamHeader ) {
+ int s_size = 0 ;
+
+ if ( hand->dblk->com.os_id == FS_EMS_MDB_ID ) {
+ s_size = strsize( resPtr->paths.mdb.FnamePrivate ) ;
+ s_size += strsize( resPtr->paths.mdb.FnamePublic ) ;
+ s_size += strsize( resPtr->paths.mdb.FnameSystem ) ;
+ s_size += strsize( resPtr->paths.mdb.LogDir ) ;
+ } else {
+
+ s_size = strsize( resPtr->paths.dsa.DbPath ) ;
+ s_size += strsize( resPtr->paths.dsa.SystemPath ) ;
+ s_size += strsize( resPtr->paths.dsa.LogDir ) ;
+ }
+
+ s_info->id = STRM_EMS_MONO_PATHS;
+ s_info->fs_attrib = 0 ;
+ s_info->tf_attrib = 0 ;
+
+ s_info->size.lsw = s_size ;
+ s_info->size.msw = 0 ;
+
+ ems_hand->pathListSize = s_size ;
+ ems_hand->needStreamHeader = FALSE ;
+
+ } else {
+ if ( *size < ems_hand->pathListSize ) {
+ *blk_size = ems_hand->pathListSize ;
+ *size = 0 ;
+ } else {
+ int s_size = 0 ;
+
+ if ( hand->dblk->com.os_id == FS_EMS_MDB_ID ) {
+ strcpy( (CHAR_PTR)(buf + s_size), resPtr->paths.mdb.FnamePrivate ) ;
+ s_size = strsize( resPtr->paths.mdb.FnamePrivate ) ;
+ strcpy( (CHAR_PTR)(buf + s_size), resPtr->paths.mdb.FnamePublic ) ;
+ s_size += strsize( resPtr->paths.mdb.FnamePublic ) ;
+ strcpy( (CHAR_PTR)(buf + s_size), resPtr->paths.mdb.FnameSystem ) ;
+ s_size += strsize( resPtr->paths.mdb.FnameSystem ) ;
+ strcpy( (CHAR_PTR)(buf + s_size), resPtr->paths.mdb.LogDir ) ;
+ s_size += strsize( resPtr->paths.mdb.LogDir ) ;
+ } else {
+
+ strcpy( (CHAR_PTR)(buf + s_size), resPtr->paths.dsa.DbPath ) ;
+ s_size = strsize( resPtr->paths.dsa.DbPath ) ;
+ strcpy( (CHAR_PTR)(buf + s_size), resPtr->paths.dsa.SystemPath ) ;
+ s_size += strsize( resPtr->paths.dsa.SystemPath ) ;
+ strcpy( (CHAR_PTR)(buf + s_size), resPtr->paths.dsa.LogDir ) ;
+ s_size += strsize( resPtr->paths.dsa.LogDir ) ;
+ }
+
+ *size = ems_hand->pathListSize ;
+ ems_hand->needStreamHeader = TRUE ;
+ ems_hand->needPathList = FALSE ;
+ ems_hand->time_for_checksum = FALSE ;
+ }
+ }
+
+ return SUCCESS ;
+}
+
+
+/**/
+/**
+
+ Name: BackStreamHeader()
+
+ Description: This function reads an NT stream header from the
+ Backup API and translates it to STREAM_INFO.
+
+ Modified: 08-Sep-92
+
+ Returns: FS_EOF_REACHED
+ SUCCESS
+
+ Notes:
+
+**/
+static INT16 BackStreamHeader(
+ FILE_HAND hand, /* I - handle of object to read from */
+ STREAM_INFO_PTR s_info ) /* O - Stream information for the data returned */
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR)hand->dblk ;
+ INT16 ret_val = SUCCESS ;
+ INT status ;
+ CHAR filename[256] ;
+ INT fname_size ;
+ INT i ;
+ LARGE_INTEGER stream_size ;
+ BOOLEAN mathStat;
+ CHAR exch_id = 0 ;
+
+
+ ems_hand->curPos = U64_Init( 0, 0 );
+
+ if ( ems_hand->name_list[ems_hand->name_list_offset] ) {
+
+ if (ems_hand->name_list[ems_hand->name_list_offset] != TEXT('\\') ) {
+ exch_id = ems_hand->name_list[ems_hand->name_list_offset] ;
+ ems_hand->name_list_offset ++ ;
+ }
+
+ ems_hand->strm_name.name_leng =
+ strsize( &ems_hand->name_list[ems_hand->name_list_offset] ) + sizeof(CHAR);
+
+
+ strcpy( (CHAR_PTR)(ems_hand->strm_name.name),
+ &ems_hand->name_list[ems_hand->name_list_offset] ) ;
+
+ fname_size = strlen( &ems_hand->name_list[ems_hand->name_list_offset] ) ;
+
+ *(((CHAR_PTR)ems_hand->strm_name.name) + fname_size + 1) = exch_id ;
+
+ strcpy( filename, &ems_hand->name_list[ems_hand->name_list_offset] ) ;
+
+ ems_hand->name_list_offset += fname_size +1 ;
+
+ status = EMS_BackupOpen( ems_hand->context,
+ filename,
+ 32 * 1024,
+ &stream_size ) ;
+ if ( !status ) {
+ // lets initialize the stream header
+ if ( ems_hand->db_or_log == EMS_DOING_DB ) {
+ s_info->id = STRM_EMS_MONO_DB ;
+ } else {
+ s_info->id = STRM_EMS_MONO_LOG ;
+ }
+ s_info->fs_attrib = 0 ;
+ s_info->tf_attrib = 0 ;
+ s_info->size.lsw = stream_size.LowPart ;
+ s_info->size.msw = stream_size.HighPart ;
+
+ s_info->size = U64_Add( s_info->size,
+ U32_To_U64(ems_hand->strm_name.name_leng + sizeof(UINT32)) ,
+ &mathStat ) ;
+
+ ems_hand->nextStreamHeaderPos = s_info->size ;
+
+ return SUCCESS ;
+
+ } else {
+ return EMS_ConvertJetError( status ) ;
+ }
+ } else {
+ if ( ems_hand->db_or_log == EMS_DOING_DB ) {
+ ret_val = EMS_LoadNameList( hand->fsh, hand, EMS_DOING_LOGS ) ;
+ if ( ret_val == SUCCESS ) {
+ return (BackStreamHeader( hand, s_info ) );
+ } else {
+ return ret_val ;
+ }
+ }
+
+ ddblk->backup_completed = TRUE ;
+ s_info->id = STRM_INVALID;
+ return FS_EOF_REACHED ;
+ }
+
+ return SUCCESS ;
+}
+
+/**/
+/**
+
+ Name: CalcReadSize()
+
+ Description: Calculates 16-bit read size from 64-bit position
+ information and 16-bit buffer size.
+
+ Modified: 08-Sep-92
+
+ Returns: Amount of data to read.
+
+ Notes:
+
+**/
+static UINT16 CalcReadSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize )
+{
+ UINT16 readSize;
+ BOOLEAN mathStat;
+
+ if ( U64_GT( U64_Add( startPos,
+ U32_To_U64( (UINT32)buffSize ),
+ &mathStat ),
+ endPos ) )
+ {
+ UINT64 rs;
+
+ rs = U64_Sub( endPos,
+ startPos,
+ &mathStat );
+
+ msassert( mathStat && (U64_Msw( rs ) == 0) && (U64_Lsw(rs) < 65536) );
+
+ readSize = (UINT16)U64_Lsw( rs );
+ } else {
+ readSize = buffSize;
+ }
+
+ return readSize;
+}
+
+#ifdef FS_EMS
+VOID
+EMS_GetStreamName(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size ) /*I/O- Entry: size of buf; Exit: number of bytes read */
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ UINT32 sizeout ;
+
+ sizeout = *size ;
+ if ( sizeout > ems_hand->strm_name.name_leng ) {
+ sizeout = ems_hand->strm_name.name_leng ;
+ }
+
+ memcpy( buf, ems_hand->strm_name.name, sizeout ) ;
+ *size = (UINT16)sizeout ;
+}
+
+#endif
diff --git a/private/utils/ntbackup/src/xseekobj.c b/private/utils/ntbackup/src/xseekobj.c
new file mode 100644
index 000000000..e881bcee9
--- /dev/null
+++ b/private/utils/ntbackup/src/xseekobj.c
@@ -0,0 +1,102 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xseekobj.c
+
+ Description: This file contains code to Seek to specific portion of
+ an opened object.
+
+
+ $Log: M:/LOGFILES/XSEEKOBJ.C_V $
+
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ems_jet.h"
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+
+/**/
+/**
+
+ Name: EMS_SeekObj()
+
+ Description: This function seeks to the specified location of an
+ opened object.
+
+ Modified: 02-Nov-92
+
+ Returns: Error Codes :
+ FS_OBJECT_NOT_OPENED
+ FS_EOF_REACHED
+ SUCCESS
+
+**/
+INT16 EMS_SeekObj(
+ FILE_HAND hand, /* I - Opened object to seek into */
+ UINT32 *offset ) /*I/O- Offset to seek; bytes actually seeked */
+{
+ EMS_OBJ_HAND_PTR ems_hand = hand->obj_hand.ptr;
+ BOOLEAN stat ;
+
+ /*
+ * Make sure we don't seek into the next stream header
+ */
+ if ( U64_GT( U64_Add( ems_hand->curPos,
+ U32_To_U64( *offset ),
+ &stat ),
+ ems_hand->nextStreamHeaderPos ) )
+ {
+ UINT64 seek;
+
+ seek = U64_Sub( ems_hand->nextStreamHeaderPos,
+ ems_hand->curPos,
+ &stat );
+
+ msassert( stat && (U64_Msw(seek) == 0) );
+ *offset = U64_Lsw( seek );
+ }
+
+ if ( *offset == 0 )
+ {
+ /*
+ * A seek of zero bytes should be OK
+ */
+ }
+ else
+ {
+ ems_hand->curPos = U64_Add( ems_hand->curPos,
+ U32_To_U64( *offset ),
+ &stat );
+ }
+
+ /*
+ * Since we may have moved the curPos, we need to update the flag
+ * that indicates whether we're ready for another stream header.
+ * (The only place we look at this is in the ReadObj code.)
+ */
+ if ( hand->mode == FS_READ )
+ {
+ ems_hand->needStreamHeader = U64_EQ( ems_hand->curPos,
+ ems_hand->nextStreamHeaderPos);
+
+ if ( ems_hand->needStreamHeader) {
+ EMS_BackupClose( ems_hand->context ) ;
+ }
+ }
+
+ return SUCCESS;
+}
+
+
diff --git a/private/utils/ntbackup/src/xsetinfo.c b/private/utils/ntbackup/src/xsetinfo.c
new file mode 100644
index 000000000..804c46435
--- /dev/null
+++ b/private/utils/ntbackup/src/xsetinfo.c
@@ -0,0 +1,50 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tsetinfo.c
+
+ Description: This file contains code to write the OS specific
+ data stored in the DBLKS to the OS
+
+
+ $Log: N:/LOGFILES/TSETINFO.C_V $
+
+
+**/
+#include <windows.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "msassert.h"
+
+/**/
+/**
+
+ Name: EMS_SetObjInfo()
+
+ Description: This funciton writes the OS info in a DBLK to disk
+
+ Modified: 2/10/1992 16:31:17
+
+ Returns: Error codes:
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ SUCCESS
+
+ Notes: Only type supported are FDBs and DDBs
+
+**/
+INT16 EMS_SetObjInfo( fsh, dblk )
+FSYS_HAND fsh ; /* I - file system handle */
+DBLK_PTR dblk ; /* I - data to write to disk */
+{
+
+ return SUCCESS ;
+}
diff --git a/private/utils/ntbackup/src/xsize.c b/private/utils/ntbackup/src/xsize.c
new file mode 100644
index 000000000..31cae79f5
--- /dev/null
+++ b/private/utils/ntbackup/src/xsize.c
@@ -0,0 +1,185 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tsize.c
+
+ Description: This file contains code to get the size of the
+ variable length fields in FDBs and DDBs
+
+
+ $Log: N:/LOGFILES/TSIZE.C_V $
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdwcs.h"
+#include "msassert.h"
+#include "tfldefs.h"
+#include "fsys.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "osinfo.h"
+
+
+/**/
+/**
+
+ Name: EMS_SizeofFname()
+
+ Description: This function returns the size of the file
+ name contained in the FDB bassed in
+
+ Modified: 9/11/1989
+
+ Returns: number of bytes including terminating NULL.
+
+ Notes:
+
+ Declaration:
+
+**/
+/* begin declaration */
+INT16 EMS_SizeofFname( fsh, fdb )
+FSYS_HAND fsh; /* I - file system in use */
+DBLK_PTR fdb ; /* I - dblk to get fname from */
+{
+ (void)fsh ;
+ (void)fdb ;
+
+ msassert( "EMS_SizeofFname()"==NULL ) ;
+
+ return 0 ;
+}
+
+/**/
+/**
+
+ Name: EMS_SizeofOSFname()
+
+ Description: This function returns the size of the file
+ name (as it appears on tape) contained in the FDB bassed in
+
+ Modified: 9/11/1989
+
+ Returns: number of bytes including terminating NULL.
+
+ Notes:
+
+**/
+INT16 EMS_SizeofOSFname( fsh, fdb )
+FSYS_HAND fsh; /* I - file system in use */
+DBLK_PTR fdb ; /* I - dblk to get fname from */
+{
+ (void)fsh ;
+ (void)fdb;
+ msassert( "EMS_SizeofOSFname()"==NULL ) ;
+ return 0 ;
+}
+
+/**/
+/**
+
+ Name: EMS_SizeofPath()
+
+ Description: This function return the size of the path saved in the
+ DDB.
+
+ Modified: 9/11/1989
+
+ Returns: Number of bytes in path string
+
+ Notes:
+
+**/
+INT16 EMS_SizeofPath( fsh, ddb )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR ddb ; /* I - DBLK to get path size from */
+{
+ EMS_DBLK_PTR ddblk ;
+ INT16 size;
+ GENERIC_DLE_PTR dle=fsh->attached_dle ;
+
+ msassert( ddb->blk_type == DDB_ID ) ;
+
+ ddblk = ( EMS_DBLK_PTR) ddb ;
+
+ if ( ( dle->info.xserv->type == EMS_MDB ) ||
+ ( dle->info.xserv->type == EMS_DSA ) ) {
+
+ size = ddb->com.os_name->name_size ;
+
+ } else { //bricked
+
+ size = (INT16)ddblk->full_name_ptr->name_size;
+ }
+
+ return size;
+}
+/**/
+/**
+
+ Name: EMS_SizeofOSPath()
+
+ Description: This function return the size of the path saved in the
+ DDB.
+
+ Modified: 9/11/1989
+
+ Returns: Number of bytes in path string
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 EMS_SizeofOSPath( fsh, ddb )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR ddb ; /* I - DBLK to get path size from */
+{
+ EMS_DBLK_PTR dddb = (EMS_DBLK_PTR)ddb ;
+ INT16 size;
+
+ (void)fsh ;
+ msassert( ddb->blk_type == DDB_ID ) ;
+
+
+ if ( ddb->com.os_name != NULL )
+ {
+ size = ddb->com.os_name->name_size ;
+ }
+ else
+ {
+ size = (INT16)dddb->full_name_ptr->name_size ;
+ }
+ return size;
+}
+
+
+/**/
+/**
+
+ Name: EMS_SizeofOSInfo()
+
+ Description: This function returns the size of the OS info for
+ an FDB or a DDB
+
+ Modified: 9/11/1989
+
+ Returns: Size in bytes.
+
+ Notes:
+
+ Declaration:
+
+**/
+INT16 EMS_SizeofOSInfo( fsh, dblk)
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk; /* I - DBLK to get size of OS info for */
+{
+ (void)fsh ;
+ (void)dblk ;
+ return 0 ;
+}
diff --git a/private/utils/ntbackup/src/xverinfo.c b/private/utils/ntbackup/src/xverinfo.c
new file mode 100644
index 000000000..ad92993ad
--- /dev/null
+++ b/private/utils/ntbackup/src/xverinfo.c
@@ -0,0 +1,50 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: tverinfo.c
+
+ Description: This file contains code to verify the DBLKS
+
+ $Log: N:/LOGFILES/TVERINFO.C_V $
+
+**/
+#include <windows.h>
+#include <string.h>
+
+#include "stdtypes.h"
+#include "stdmath.h"
+#include "std_err.h"
+#include "fsys.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "msassert.h"
+
+
+/**/
+/**
+
+ Name: EMS_VerObjInfo()
+
+ Description: This funciton compares the data in a DBLK with
+ the data returned by the operating system.
+
+ Modified: 2/12/1992 13:6:5
+
+ Returns: Error Codes:
+ FS_NOT_FOUND
+ FS_ACCESS_DENIED
+ FS_INFO_DIFFERENT
+ SUCCESS
+
+ Notes: For FDBs this funciton will check the current
+ directory for the specified file.
+
+**/
+INT16 EMS_VerObjInfo( fsh, dblk )
+FSYS_HAND fsh ; /* I - File system handle */
+DBLK_PTR dblk ; /* I - On entry it is minimal on exit Complete */
+{
+ return SUCCESS ;
+}
diff --git a/private/utils/ntbackup/src/xverobj.c b/private/utils/ntbackup/src/xverobj.c
new file mode 100644
index 000000000..b80b89cb5
--- /dev/null
+++ b/private/utils/ntbackup/src/xverobj.c
@@ -0,0 +1,100 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: xverobj.c
+
+ Description: This file verifies the object data.
+
+
+ $Log: M:/LOGFILES/XVEROBJ.C_V $
+
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "std_err.h"
+#include "stdmath.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "msassert.h"
+
+
+/**/
+/**
+
+ Name: EMS_VerObj()
+
+ Description: This function verifies the data in an object.
+
+ Modified: 2/12/1992 14:29:33
+
+ Returns: Error Codes:
+ FS_DEVICE_ERROR
+ FS_EOF_REACHED
+ FS_GDATA_DIFFERENT
+ FS_SECURITY_DATA_DIFFERENT
+ SUCCESS
+
+**/
+/* begin declaration */
+INT16 EMS_VerObj(
+FILE_HAND hand, /* I - file handle to verify data with */
+BYTE_PTR buf, /* I - buffer needed to perform verify */
+BYTE_PTR data, /* I - data to verify against */
+UINT16 *size, /*I/O- size of buffers / amount verified */
+UINT16 *blk_size, /* O - minum size of block for next call */
+STREAM_INFO_PTR s_info ) /* I - Stream information for the data to be written */
+{
+ INT16 ret_val = SUCCESS ;
+ EMS_OBJ_HAND_PTR ems_hand = hand->obj_hand.ptr;
+ *blk_size = 1 ;
+
+ msassert( hand != NULL );
+ msassert( hand->mode == FS_VERIFY ) ;
+
+ if ( s_info->id != STRM_INVALID ) {
+
+ if ( s_info->id == STRM_CHECKSUM_DATA ) {
+ ems_hand->time_for_checksum = TRUE ;
+
+ } else {
+
+ EMS_ZeroCheckSum( hand ) ;
+ }
+
+ } else {
+ if ( ems_hand->time_for_checksum ) {
+ if (*size < sizeof(UINT32) ) {
+ *blk_size = sizeof(UINT32) ;
+ *size = 0 ;
+ } else {
+ UINT32 csum = 0;
+ UINT32 hold = 0 ;
+ INT i;
+ for ( i=0; i < sizeof(UINT32); i++ ) {
+ hold = data[i] ;
+ hold <<= (8*i) ;
+ csum |= hold ;
+ }
+ if ( csum != ems_hand->check_sum ) {
+ ret_val = FS_GDATA_DIFFERENT;
+ }
+ ems_hand->time_for_checksum = FALSE ;
+ }
+ } else {
+ EMS_CalcCheckSum( hand, data, *size ) ;
+ }
+ }
+
+
+ return( ret_val ) ;
+}
+
diff --git a/private/utils/ntbackup/src/xwritobj.c b/private/utils/ntbackup/src/xwritobj.c
new file mode 100644
index 000000000..c9cb89e12
--- /dev/null
+++ b/private/utils/ntbackup/src/xwritobj.c
@@ -0,0 +1,724 @@
+/**
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+
+ Name: twritobj.c
+
+ Description: This function writes data to an open object.
+
+
+ $Log: M:/LOGFILES/TWRITOBJ.C_V $
+
+
+**/
+#include <windows.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#include "stdtypes.h"
+#include "jetbcli.h"
+#include "std_err.h"
+#include "stdmath.h"
+#include "msassert.h"
+#include "fsys.h"
+#include "fsys_prv.h"
+#include "fsys_err.h"
+#include "emsdblk.h"
+#include "ems_fs.h"
+#include "omevent.h"
+
+static INT ua_strsize( BYTE_PTR name ) ;
+
+static INT16 EMS_WriteData(
+ FILE_HAND hand,
+ BYTE_PTR buf,
+ UINT16 *size,
+ UINT16 *blk_size,
+ STREAM_INFO_PTR s_info );
+
+static CHAR_PTR EMS_MungeFname( FSYS_HAND fsh, FILE_HAND hand, CHAR_PTR name, CHAR exch_id ) ;
+
+static BOOLEAN EMS_PathMatch( CHAR_PTR p_end, CHAR_PTR q_start ) ;
+
+static UINT16 CalcWriteSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize );
+
+static VOID EMS_AddToJetRstmap( FILE_HAND hand, CHAR_PTR org_name, CHAR_PTR new_name ) ;
+
+static VOID EMS_UpdateRipLogKey( FILE_HAND hand, CHAR_PTR log_name, BOOLEAN low_able ) ;
+
+/**/
+/**
+
+ Name: EMS_WriteObj()
+
+ Description: This function writes data to an opened object on
+ disk.
+
+ Modified: 2/12/1992 12:57:2
+
+ Returns: Error Codes:
+ FS_DEVICE_ERROR
+ FS_OBJECT_NOT_OPENED
+ FS_OUT_OF_SPACE
+ SUCCESS
+
+ Notes:
+
+**/
+INT16 EMS_WriteObj(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* O - buffer to place data into */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: number of bytes read */
+ UINT16 *blk_size, /* O - Block size need for next read */
+ STREAM_INFO_PTR s_info ) /* I - Stream information for the data to be written */
+{
+ INT16 ret_val;
+
+ msassert( hand->mode == FS_WRITE );
+
+ if ( (s_info->id == STRM_INVALID) && (*size == 0) )
+ {
+ /*
+ * Someone asked us to write zero bytes. According to
+ * our rules this is not allowed, but we'll be defensive
+ * anyway.
+ */
+ msassert( FALSE );
+ *blk_size = 1;
+ ret_val = SUCCESS;
+ }
+ else
+ {
+ ret_val = EMS_WriteData( hand, buf, size, blk_size, s_info ) ;
+ }
+ return ret_val;
+}
+
+/**/
+/**
+
+ Name: EMS_WriteData()
+
+ Description: This function writes data to an open NTFS object.
+
+ Modified: 10-Sep-92
+
+ Returns: FS_OUT_OF_SPACE
+ SUCCESS
+
+ Notes:
+
+**/
+static INT16 EMS_WriteData(
+ FILE_HAND hand, /* I - handle of object to read from */
+ BYTE_PTR buf, /* I - buffer to write */
+ UINT16 *size, /*I/O- Entry: size of buf; Exit: bytes written */
+ UINT16 *blk_size, /* O - Block size need for next write */
+ STREAM_INFO_PTR s_info ) /* I - Stream information for the data */
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ EMS_FSYS_RESERVED_PTR res = hand->fsh->reserved.ptr;
+ INT16 ret_val = SUCCESS ;
+ UINT16 bufferSize;
+ DWORD sizeout;
+ INT status;
+ UINT16 writeSize; /* Size sent to BackupWrite */
+ BOOLEAN dummy;
+ CHAR_PTR server_name = hand->fsh->attached_dle->parent->device_name ;
+ EMS_DBLK_PTR ddblk = (EMS_DBLK_PTR)hand->dblk ;
+
+ bufferSize = *size;
+ *size = 0;
+ *blk_size = 1;
+
+ if ( s_info->id != STRM_INVALID )
+ {
+ UINT16 buffUsed = 0; /* Amount of buf we wrote (name) */
+
+ ems_hand->skip_data = FALSE ;
+
+ if ( (ems_hand->fhand != NULL) &&
+ (ems_hand->fhand != INVALID_HANDLE_VALUE) ) {
+ CloseHandle( ems_hand->fhand ) ;
+ ems_hand->fhand = INVALID_HANDLE_VALUE ;
+ }
+
+ if (s_info->id == STRM_EMS_MONO_PATHS ) {
+ ems_hand->needPathList = TRUE ;
+ ems_hand->pathListSize = s_info->size.lsw ;
+ } else {
+ ems_hand->needPathList = FALSE ;
+ }
+
+ if ( s_info->id == STRM_CHECKSUM_DATA ) {
+ ems_hand->skip_data = TRUE ;
+
+ } else if ( (s_info->id != STRM_EMS_MONO_DB ) &&
+ (s_info->id != STRM_EMS_MONO_PATHS ) &&
+ (s_info->id != STRM_EMS_MONO_LOG ) ) {
+
+ return FS_DONT_WANT_STREAM ;
+ }
+
+ ems_hand->currentStreamId = s_info->id ;
+ ems_hand->curPos = U64_Init( 0, 0 );
+ ems_hand->nextStreamHeaderPos = s_info->size ;
+
+ bufferSize = 0 ;
+
+ } else {
+
+ if ( ems_hand->skip_data ) {
+ *size = bufferSize ;
+ return SUCCESS ;
+
+ } else if ( ems_hand->needPathList ) {
+
+ if ( bufferSize < ems_hand->pathListSize ) {
+ *blk_size = ems_hand->pathListSize ;
+ return SUCCESS ;
+
+ } else {
+ INT byte_count ;
+
+ ddblk->backup_completed = FALSE ;
+
+ if ( hand->dblk->com.os_id == FS_EMS_MDB_ID ) {
+
+ byte_count = ua_strsize(buf) ;
+ memcpy( ems_hand->org_paths.mdb.FnamePrivate, buf, byte_count) ;
+ buf += byte_count ;
+
+ byte_count = ua_strsize(buf) ;
+ memcpy( ems_hand->org_paths.mdb.FnamePublic, buf, byte_count ) ;
+ buf += byte_count ;
+
+ byte_count = ua_strsize(buf) ;
+ memcpy( ems_hand->org_paths.mdb.FnameSystem, buf, byte_count ) ;
+ buf += byte_count ;
+
+ byte_count = ua_strsize(buf) ;
+ memcpy( ems_hand->org_paths.mdb.LogDir, buf, byte_count ) ;
+
+
+ } else {
+
+ byte_count = ua_strsize(buf) ;
+ memcpy( ems_hand->org_paths.dsa.DbPath, buf, byte_count ) ;
+ buf += byte_count ;
+
+ byte_count = ua_strsize(buf) ;
+ memcpy( ems_hand->org_paths.dsa.SystemPath, buf, byte_count ) ;
+
+ buf += byte_count ;
+
+ byte_count = ua_strsize(buf) ;
+ memcpy( ems_hand->org_paths.dsa.LogDir, buf, byte_count ) ;
+
+ }
+
+ *size = ems_hand->pathListSize ;
+ ems_hand->needPathList = FALSE ;
+ return SUCCESS ;
+ }
+
+
+ } else if ( (*((UINT32 UNALIGNED *)buf) > 0) &&
+ U64_EQ( ems_hand->curPos, U64_Init( 0, 0 ) ) ) {
+
+ EMS_STREAM_NAME UNALIGNED *stream_name = (EMS_STREAM_NAME *)buf;
+
+ if ( bufferSize < sizeof(UINT32) ) {
+ *blk_size = sizeof(UINT32) ;
+ bufferSize = 0 ;
+
+ } else if ( stream_name->name_leng + sizeof(UINT32) > bufferSize ) {
+ *blk_size = (UINT16)(stream_name->name_leng + sizeof( UINT32 )) ;
+ bufferSize = 0 ;
+
+ } else {
+ CHAR UNALIGNED *name ;
+ CHAR exch_id = 0 ;
+ CHAR UNALIGNED *p ;
+ CHAR str_name[EMS_MAX_STREAM_NAME_LENG] ;
+
+ p = (CHAR UNALIGNED *)stream_name->name ;
+
+ // name = strrchr((CHAR_PTR)stream_name->name, TEXT('\\') ) ;
+
+ while (*p ) {
+ if (*p == TEXT('\\') ) {
+ name = p ;
+ }
+ p++ ;
+ }
+
+ memcpy( str_name,
+ name,
+ ua_strsize( (char *)name ) ) ;
+
+
+ if ( ua_strsize((char *)stream_name->name) != (INT)stream_name->name_leng ){
+ p = (CHAR UNALIGNED *)stream_name->name ;
+ p += ua_strsize( stream_name->name ) / sizeof(CHAR) ;
+
+ exch_id = *p ;
+ }
+
+ if ( ems_hand->currentStreamId == STRM_EMS_MONO_LOG ) {
+
+ EMS_UpdateRipLogKey( hand,
+ str_name,
+ ems_hand->db_restored ) ;
+
+ } else if ( hand->dblk->com.os_id == FS_EMS_MDB_ID ) {
+
+ res->low_log = 0x7fffffff ;
+
+ ems_hand->db_restored = TRUE ;
+
+ if ( name && BEC_GetEmsPubPri(hand->fsh->cfg) == BEC_EMS_PUBLIC ) {
+ // if this is a private file then skip it.
+
+ if ((exch_id == BFT_MDB_PRIVATE_DATABASE) ||
+ !memcmp( (BYTE_PTR)name,
+ ems_hand->org_paths.mdb.FnamePrivate +
+ strlen(ems_hand->org_paths.mdb.FnamePrivate) -
+ strlen( str_name),
+ ua_strsize( (BYTE_PTR)name ) ) )
+ {
+
+ ems_hand->skip_data = TRUE ;
+ *size = bufferSize;
+ return FS_DONT_WANT_STREAM ;
+ }
+
+ } else if ( name && BEC_GetEmsPubPri(hand->fsh->cfg) == BEC_EMS_PRIVATE ) {
+ // if this is a public file then skip it.
+
+ if ((exch_id == BFT_MDB_PUBLIC_DATABASE) ||
+ !memcmp( (BYTE_PTR)name,
+ ems_hand->org_paths.mdb.FnamePublic +
+ strlen(ems_hand->org_paths.mdb.FnamePublic) -
+ strlen(str_name),
+ ua_strsize( (BYTE_PTR)name ) ) )
+ {
+
+ ems_hand->skip_data = TRUE ;
+ *size = bufferSize;
+ return FS_DONT_WANT_STREAM ;
+ }
+
+ }
+
+ } else if (hand->dblk->com.os_id == FS_EMS_DSA_ID ) {
+
+ res->low_log = 0x7fffffff ;
+ ems_hand->db_restored = TRUE ;
+
+ }
+
+ *size = (UINT16)(stream_name->name_leng + sizeof( UINT32 ) ) ;
+
+ memcpy( str_name,
+ stream_name->name,
+ ua_strsize( stream_name->name ) ) ;
+
+ name = EMS_MungeFname( hand->fsh, hand, str_name, exch_id ) ;
+ if ( name == NULL ) {
+ OMEVENT_LogEMSError ( TEXT("MungeFname()"), -1,str_name ) ;
+ return FS_DEVICE_ERROR ;
+ }
+
+ ems_hand->strm_name.name_leng = ua_strsize( (BYTE_PTR)name) ;
+ memcpy( ems_hand->strm_name.name,
+ (BYTE_PTR)name,
+ ems_hand->strm_name.name_leng ) ;
+
+ ems_hand->fhand = CreateFile( (CHAR_PTR)ems_hand->strm_name.name,
+ GENERIC_WRITE,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_SEQUENTIAL_SCAN | FILE_ATTRIBUTE_NORMAL,
+ NULL ) ;
+
+ if ( ems_hand->fhand == INVALID_HANDLE_VALUE ) {
+ ret_val = FS_COMM_FAILURE ;
+ }
+
+ free( name ) ;
+ bufferSize-= *size ;
+ buf += *size ;
+ }
+
+ }
+ }
+
+ if ( ret_val == SUCCESS && bufferSize ) {
+
+ bufferSize = CalcWriteSize( ems_hand->curPos,
+ ems_hand->nextStreamHeaderPos,
+ bufferSize );
+
+ status = WriteFile( ems_hand->fhand,
+ buf,
+ bufferSize,
+ (LPDWORD)&sizeout,
+ NULL ) ;
+
+
+ if ( status ) { // returns TRUE if success
+ *size +=(UINT16)sizeout ;
+ } else {
+ status = GetLastError() ;
+ if ( ( status == ERROR_DISK_FULL ) ||
+ ( status == ERROR_HANDLE_DISK_FULL ) ) {
+
+ return FS_OUT_OF_SPACE ;
+ }
+
+ ret_val = FS_COMM_FAILURE ;
+ OMEVENT_LogEMSError ( TEXT("BackupWrite()"), status, TEXT(" - ") ) ;
+ }
+
+ }
+
+ ems_hand->curPos = U64_Add( ems_hand->curPos,
+ U32_To_U64( (UINT32)*size ),
+ &dummy );
+
+ if ( U64_EQ( ems_hand->curPos, ems_hand->nextStreamHeaderPos ) ) {
+ ddblk->backup_completed = TRUE ;
+
+ if ( (ems_hand->fhand != NULL) &&
+ (ems_hand->fhand != INVALID_HANDLE_VALUE) ) {
+ CloseHandle( ems_hand->fhand ) ;
+ ems_hand->fhand = INVALID_HANDLE_VALUE ;
+ }
+ }
+
+
+ return ret_val ;
+}
+
+
+
+static UINT16 CalcWriteSize( UINT64 startPos,
+ UINT64 endPos,
+ UINT16 buffSize )
+{
+ UINT16 writeSize;
+ BOOLEAN mathStat;
+
+ if ( U64_GT( U64_Add( startPos,
+ U32_To_U64( (UINT32)buffSize ),
+ &mathStat ),
+ endPos ) )
+ {
+ UINT64 rs;
+
+ rs = U64_Sub( endPos,
+ startPos,
+ &mathStat );
+
+ msassert( mathStat && (U64_Msw( rs ) == 0) && (U64_Lsw(rs) < 65536) );
+
+ writeSize = (UINT16)U64_Lsw( rs );
+ } else {
+ writeSize = buffSize;
+ }
+
+ return writeSize;
+}
+
+static CHAR_PTR EMS_MungeFname( FSYS_HAND fsh, FILE_HAND hand, CHAR_PTR name, CHAR exch_id )
+{
+ EMS_OBJ_HAND_PTR ems_hand = (EMS_OBJ_HAND_PTR)(hand->obj_hand.ptr ) ;
+ EMS_FSYS_RESERVED_PTR resPtr = hand->fsh->reserved.ptr ;
+ CHAR_PTR new_name = NULL ;
+ CHAR_PTR p,q ;
+ CHAR_PTR fname ;
+ CHAR_PTR old_name ;
+
+ // first make sure the name is at least reasonable so our parsing can make some assumptions
+
+ if ( !strchr(name, TEXT('\\') ) ) {
+ return NULL ;
+ }
+
+ // I will compare the paths backwards. So I need the end of the input path.
+
+ old_name = calloc( strsize( name ), 1 ) ;
+ if ( old_name ) {
+ strcpy( old_name, name ) ;
+ }
+
+ fname = strrchr( name, TEXT('\\') ) ;
+
+ switch (exch_id ) {
+ case BFT_MDB_PRIVATE_DATABASE:
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.FnamePrivate, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+ break ;
+
+ case BFT_MDB_PUBLIC_DATABASE:
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.FnamePublic, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+ break ;
+
+ case BFT_DSA_DATABASE:
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.dsa.DbPath, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+ break ;
+
+ case BFT_LOG :
+ case BFT_PATCH_FILE :
+ if ( fsh->attached_dle->info.xserv->type == EMS_DSA ) {
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.dsa.LogDir, fname+1 ) ;
+ } else {
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.LogDir, fname+1 ) ;
+ }
+ break ;
+
+ default:
+ if ( fsh->attached_dle->info.xserv->type == EMS_DSA ) {
+ if ( EMS_PathMatch( name, ems_hand->org_paths.dsa.DbPath ) ) {
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.dsa.DbPath, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+
+
+ } else if ( EMS_PathMatch( name, ems_hand->org_paths.dsa.SystemPath ) ) {
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.dsa.SystemPath, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+
+ } else {
+
+ *fname = TEXT('\0') ;
+
+ if ( EMS_PathMatch( name, ems_hand->org_paths.dsa.LogDir ) ) {
+
+ strcpy( resPtr->BackupLogPath, name ) ;
+ *fname = TEXT('\\') ;
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.dsa.LogDir, fname+1 ) ;
+
+ } else if ( EMS_PathMatch( name, ems_hand->org_paths.dsa.SystemPath ) ) {
+
+ *fname = TEXT('\\') ;
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.dsa.SystemPath, fname+1 ) ;
+ }
+ }
+
+ } else {
+ if ( EMS_PathMatch( name, ems_hand->org_paths.mdb.FnameSystem ) ) {
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.FnameSystem, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+
+ } else if ( EMS_PathMatch( name, ems_hand->org_paths.mdb.FnamePublic ) ) {
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.FnamePublic, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+
+ } else if ( EMS_PathMatch( name, ems_hand->org_paths.mdb.FnamePrivate ) ) {
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.FnamePrivate, NULL ) ;
+ EMS_AddToJetRstmap( hand, old_name, new_name ) ;
+
+
+ } else {
+ *fname = TEXT('\0') ;
+
+ if ( EMS_PathMatch( name, ems_hand->org_paths.mdb.LogDir ) ) {
+ strcpy( resPtr->BackupLogPath, name ) ;
+ *fname = TEXT('\\') ;
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.LogDir, fname+1 ) ;
+
+ } else if ( EMS_PathMatch( name, ems_hand->org_paths.mdb.FnameSystem ) ) {
+ *fname = TEXT('\\') ;
+ new_name = EMS_BuildMungedName( fsh, resPtr->paths.mdb.FnameSystem, fname+1 ) ;
+
+ }
+
+ }
+ }
+ }
+
+ free( old_name ) ;
+
+ return new_name ;
+}
+
+BOOLEAN EMS_PathMatch( CHAR_PTR p_start, CHAR_PTR q_start )
+{
+ CHAR_PTR q_end ;
+ CHAR_PTR p_end ;
+
+ p_end = p_start + strlen(p_start) -1 ;
+ q_end = q_start + strlen(q_start) -1 ;
+
+ if (*p_end == TEXT('\\') ) {
+ p_end -- ;
+ }
+ if (*q_end == TEXT('\\') ) {
+ q_end -- ;
+ }
+
+ do {
+ if (toupper(*p_end) != toupper(*q_end) ) {
+ if ( *p_end == TEXT('$') ) {
+ if ( (*q_end != TEXT('$')) && (*q_end != TEXT(':')) ) {
+ return FALSE ;
+ }
+ p_end --; q_end -- ;
+ if ( toupper(*p_end) == toupper(*q_end) ) {
+ return TRUE ;
+ }
+ }
+ return FALSE ;
+ }
+ p_end --; q_end -- ;
+
+ } while ( q_end != q_start ) ;
+
+ return TRUE ;
+}
+
+
+CHAR_PTR EMS_BuildMungedName( FSYS_HAND fsh, CHAR_PTR new_path, CHAR_PTR fname )
+{
+ INT size ;
+ CHAR_PTR new_name ;
+ CHAR_PTR p ;
+
+ // sizeof "\\servername"
+ size = strsize( fsh->attached_dle->parent->device_name ) + 4;
+
+ // sizeof C$\path
+
+ size += strsize( new_path ) ;
+
+ if ( fname ) {
+ size += strsize(fname) ;
+ }
+
+ new_name = calloc( size, 1 ) ;
+
+ if ( new_name ) {
+ if ( strncmp( new_path, TEXT("\\\\"), 2 ) ) {
+ strcpy( new_name, TEXT("\\\\") ) ;
+ strcat( new_name, fsh->attached_dle->parent->device_name ) ;
+ strcat( new_name, TEXT("\\") ) ;
+ }
+ strcat( new_name, new_path ) ;
+ if ( fname) {
+ if ( new_name[strlen(new_name) -1] != TEXT('\\') ) {
+ strcat( new_name, TEXT("\\") ) ;
+ }
+ strcat( new_name, fname ) ;
+ }
+
+ p = strchr( new_name, TEXT(':') ) ;
+
+ if ( p ) {
+ *p = TEXT('$') ;
+ }
+ }
+
+ return ( new_name ) ;
+}
+
+
+
+VOID EMS_UpdateRipLogKey( FILE_HAND hand, CHAR_PTR log_name, BOOLEAN low_able )
+{
+ EMS_FSYS_RESERVED_PTR res = hand->fsh->reserved.ptr;
+ CHAR_PTR p, endp ;
+ CHAR_PTR dummy ;
+ CHAR_PTR key_name;
+ ULONG log_num = 0x7fffffff;
+
+ endp = p = strrchr( log_name, TEXT('.') ) ;
+ if (stricmp( endp, TEXT(".log") ) ) {
+ return ;
+ }
+
+ if (p) {
+ p-=5 ;
+ *endp = TEXT('\0') ;
+ log_num = wcstoul( p, &dummy, 16 ) ;
+
+ *endp = TEXT('.') ;
+ }
+
+ if ( low_able && log_num ) {
+ if ( log_num < res->low_log ) {
+ res->low_log = log_num ;
+ }
+ }
+
+ if ( log_num > res->high_log ) {
+ res->high_log = log_num ;
+ }
+
+}
+
+
+VOID EMS_AddToJetRstmap( FILE_HAND hand, CHAR_PTR old_name, CHAR_PTR new_name )
+{
+ EMS_FSYS_RESERVED_PTR res = hand->fsh->reserved.ptr;
+ CHAR_PTR name_ptr ;
+ INT i ;
+
+ name_ptr = res->jet_rstmap ;
+
+ if ( ( new_name == NULL ) || ( old_name == NULL ) ) {
+ return ;
+ }
+
+ for ( i = 0 ; i < 3; i ++ ) {
+
+ if (*name_ptr == TEXT('\0') ) {
+ break ;
+ }
+
+ if ( !stricmp( old_name, name_ptr ) ) {
+ return ;
+ }
+
+ /* this assumes that we always write in pares */
+ name_ptr += strlen( name_ptr ) + 1 ;
+ name_ptr += strlen( name_ptr ) + 1 ;
+ }
+
+ if ( i != 3 ) {
+ strcpy( name_ptr, old_name ) ;
+ name_ptr += strlen( name_ptr ) + 1 ;
+ strcpy( name_ptr, new_name ) ;
+ name_ptr += strlen( name_ptr ) + 1 ;
+ *name_ptr = TEXT('\0') ;
+ res->map_size = i+1 ;
+ }
+}
+
+
+static INT ua_strsize( BYTE_PTR buf )
+{
+ INT align_factor;
+ INT byte_count ;
+
+ align_factor = sizeof(CHAR) -1 ;
+
+ if ( (DWORD)buf & align_factor ) { // if unaligned
+ byte_count = sizeof(CHAR) ;
+ while( ( *buf != 0 ) && ( (*buf+1) != 0) ){
+ buf+=sizeof(CHAR) ;
+ byte_count +=sizeof(CHAR);
+ }
+ } else {
+ byte_count = strsize( (CHAR_PTR)buf ) ;
+ }
+ return byte_count ;
+}
+
+
diff --git a/private/utils/ntbackup/src/yprintf.c b/private/utils/ntbackup/src/yprintf.c
new file mode 100644
index 000000000..ad5723868
--- /dev/null
+++ b/private/utils/ntbackup/src/yprintf.c
@@ -0,0 +1,120 @@
+/*****************************************************************************
+ Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: yprintf.c
+
+ Description: Replacement status printf functions for "T" commands that
+ do not use windows
+
+
+ $Log: G:/UI/LOGFILES/YPRINTF.C_V $
+
+ Rev 1.10 26 Jul 1993 17:56:24 MARINA
+enable c++
+
+ Rev 1.9 07 Oct 1992 14:50:00 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.8 04 Oct 1992 19:44:20 DAVEV
+Unicode Awk pass
+
+ Rev 1.7 17 Aug 1992 13:25:44 DAVEV
+MikeP's changes at Microsoft
+
+ Rev 1.6 28 Jul 1992 14:53:26 CHUCKB
+Fixed warnings for NT.
+
+ Rev 1.5 10 Jun 1992 08:58:32 BURT
+Fixed prototype to be ANSI
+
+ Rev 1.4 19 May 1992 11:58:38 MIKEP
+mips changes
+
+ Rev 1.3 18 May 1992 09:06:44 MIKEP
+header
+
+ Rev 1.2 29 Jan 1992 17:58:42 DAVEV
+
+
+ * added include <windows.h>
+
+ Rev 1.1 10 Dec 1991 21:19:50 MIKEP
+fix msassert call
+
+ Rev 1.0 20 Nov 1991 19:17:10 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: yresprintf
+
+ Description: This function displays a message from SES_ENG_ERR
+
+ THIS IS A SPECIAL FUNCTION SPECIFICALLY
+ FOR THE "T" COMMANDS...NO WINDOWS ARE USED
+
+ Modified: 2/10/1990
+
+ Returns: VOID
+
+ Notes: calls tprintf( )
+
+*****************************************************************************/
+VOID yresprintf( INT res_id, ... )
+{
+ UINT16 error ;
+ CHAR_PTR fmt ;
+ UINT16 tmp ;
+ va_list arg_ptr ;
+
+ fmt = (LPSTR)RM_GetResource( rm, SES_ENG_MSG, res_id, &tmp, &error ) ;
+ msassert( fmt != NULL );
+
+ va_start( arg_ptr, res_id ) ;
+ tprintf( fmt, arg_ptr ) ;
+ va_end( arg_ptr ) ;
+
+ return ;
+
+}
+
+/*****************************************************************************
+
+ Name: yprintf
+
+ Description: This function displays a message
+
+ THIS IS A SPECIAL FUNCTION SPECIFICALLY
+ FOR THE "T" COMMANDS...NO WINDOWS ARE USED
+
+ Returns: VOID
+
+ Notes: calls tprintf( )
+
+*****************************************************************************/
+VOID yprintf( CHAR_PTR fmt, ... )
+{
+ va_list arg_ptr ;
+
+ va_start( arg_ptr, fmt ) ;
+ tprintf( fmt, arg_ptr ) ;
+ va_end( arg_ptr ) ;
+
+ return ;
+
+}
+
+
+
+
+
+
+
diff --git a/private/utils/ntbackup/src/zprintf.c b/private/utils/ntbackup/src/zprintf.c
new file mode 100644
index 000000000..2ac2195ca
--- /dev/null
+++ b/private/utils/ntbackup/src/zprintf.c
@@ -0,0 +1,111 @@
+/*****************************************************************************
+Copyright(c) Maynard Electronics, Inc. 1984-89
+
+ Name: zprintf.c
+
+ Date Updated: $./FDT$ $./FTM$
+
+ Description:
+
+ $Log: G:/UI/LOGFILES/ZPRINTF.C_V $
+
+ Rev 1.7 07 Oct 1992 14:49:46 DARRYLP
+Precompiled header revisions.
+
+ Rev 1.6 04 Oct 1992 19:44:22 DAVEV
+Unicode Awk pass
+
+ Rev 1.5 30 Sep 1992 10:41:24 DAVEV
+Unicode strlen verification, MikeP's chgs from MS
+
+ Rev 1.4 19 May 1992 11:58:50 MIKEP
+mips changes
+
+ Rev 1.3 14 May 1992 16:51:08 MIKEP
+nt pass 2
+
+ Rev 1.2 07 Feb 1992 16:23:20 JOHNWT
+removed use of tprint buffer
+
+ Rev 1.1 03 Feb 1992 16:37:40 DAVEV
+added include <windows.h> to resolve error in muiconf.h: WORD undefined
+
+ Rev 1.0 20 Nov 1991 19:17:16 SYSTEM
+Initial revision.
+
+*****************************************************************************/
+
+#include "all.h"
+
+#ifdef SOME
+#include "some.h"
+#endif
+
+/*****************************************************************************
+
+ Name: zprintf
+
+ Description: This function displays a debug message
+
+ Modified: 2/10/1990
+
+ Returns: VOID
+
+*****************************************************************************/
+
+VOID zprintf( UINT16 mask_bits, ... )
+{
+ va_list arg_ptr ;
+
+ va_start( arg_ptr, mask_bits ) ;
+
+ zvprintf( mask_bits, arg_ptr ) ;
+
+ va_end( arg_ptr ) ;
+
+ return ;
+}
+
+/*****************************************************************************
+
+ Name: zvprintf
+
+ Description: This function displays a debug message
+
+ Modified: 2/7/1992
+
+ Returns: VOID
+
+ Notes:
+
+*****************************************************************************/
+
+VOID zvprintf( UINT16 mask_bits, va_list arg_list )
+{
+ CDS_PTR conf_ptr = CDS_GetCopy( ) ;
+ CHAR_PTR fmt ;
+ UINT16 res_num ;
+ TCHAR buffer[ MAX_UI_RESOURCE_SIZE ];
+
+ if( ( CDS_GetDebugFlag( conf_ptr ) & mask_bits ) ||
+ ( (mask_bits == 0) && CDS_GetDebugFlag( conf_ptr ) ) ) {
+
+ if ( mask_bits != 0 ) {
+ res_num = va_arg( arg_list, UINT16 );
+ fmt = ( CHAR_PTR ) RM_GetResource( rm, SES_ENG_DBUG, res_num, NULL, NULL );
+ msassert( fmt != NULL );
+ }
+ else {
+ fmt = va_arg( arg_list, CHAR_PTR );
+ }
+
+ vsprintf( buffer, fmt, arg_list ) ;
+
+ msassert( strlen( buffer ) <= MAX_UI_RESOURCE_SIZE ) ;
+
+ DBM_InsertItem( buffer );
+
+ }
+
+ return ;
+}